various baseline fixes

This commit is contained in:
daboe01
2015-07-03 20:03:53 +02:00
parent 5e880f6bfa
commit 46f50f55c2
3 changed files with 32 additions and 10 deletions
+9 -4
View File
@@ -663,7 +663,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
[self insertText:placeholderString]; // FIXME: this hack to provide the visual space for the inputmanager should at least bypass the undomanager
var caretOrigin = [_layoutManager boundingRectForGlyphRange:CPMakeRange(MAX(0, _selectionRange.location - 1), 1) inTextContainer:_textContainer].origin;
caretOrigin.y += [_layoutManager _characterOffsetAtLocation:MAX(0, _selectionRange.location - 1) inTextContainer:_textContainer];
caretOrigin.y += [_layoutManager _characterOffsetAtLocation:MAX(0, _selectionRange.location - 1)];
caretOrigin.x += 2; // two pixel offset to the LHS character
#if PLATFORM(DOM)
@@ -922,7 +922,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(sindex, 1) inTextContainer:_textContainer],
point = rectSource.origin;
if (point.y <= 0)
if (point.y <= 2)
return;
if (_stickyXLocation)
@@ -1780,14 +1780,19 @@ var kDelegateRespondsTo_textShouldBeginEditing
else
caretRect = [_layoutManager boundingRectForGlyphRange:CPMakeRange(_selectionRange.location, 1) inTextContainer:_textContainer];
var caretOffset = [_layoutManager _characterOffsetAtLocation:_selectionRange.location inTextContainer:_textContainer],
oldYPosition = CGRectGetMaxY(caretRect);
var caretOffset = [_layoutManager _characterOffsetAtLocation:_selectionRange.location],
oldYPosition = CGRectGetMaxY(caretRect),
caretDescend = [_layoutManager _descentAtLocation:_selectionRange.location];
if (caretOffset > 0)
{
caretRect.origin.y += caretOffset;
caretRect.size.height = oldYPosition - caretRect.origin.y;
}
if (caretDescend < 0)
{
caretRect.size.height -= caretDescend;
}
caretRect.origin.x += _textContainerOrigin.x;
caretRect.origin.y += _textContainerOrigin.y;