Changeset 153060 in webkit
- Timestamp:
- Jul 23, 2013 12:09:39 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r153058 r153060 1 2013-07-23 Alexey Proskuryakov <ap@apple.com> 2 3 Dictionary hotkey does not work on vertical text 4 https://bugs.webkit.org/show_bug.cgi?id=118993 5 <rdar://problem/14478260> 6 7 Reviewed by Enrica Casucci. 8 9 * platform/mac/editing/input/caret-primary-bidi-expected.txt: Old results had 10 some collapsed positions have a rect of width 1. Now they are all consistently 0. 11 12 * platform/mac/editing/input/firstrectforcharacterrange-vertical-expected.txt: Added. 13 * platform/mac/editing/input/firstrectforcharacterrange-vertical.html: Added. 14 * platform/wk2/TestExpectations: Skipping the new test, as WKTR doesn't implement firstRectForCharacterRange. 15 1 16 2013-07-23 Bem Jones-Bey <bjonesbe@adobe.com> 2 17 -
trunk/LayoutTests/platform/mac/editing/input/caret-primary-bidi-expected.txt
r78910 r153060 2 2 1: 21,564,0,28 3 3 2: 36,564,0,28 4 3: 48,564, 1,284 3: 48,564,0,28 5 5 4: 154,564,0,28 6 6 5: 140,564,0,28 … … 11 11 10: 73,564,0,28 12 12 11: 56,564,0,28 13 12: 1 69,564,1,2813 12: 170,564,0,28 14 14 13: 185,564,0,28 15 15 14: 198,564,0,28 … … 38 38 37: 60,478,0,28 39 39 38: 75,478,0,28 40 39: 87,478, 1,2840 39: 87,478,0,28 41 41 40: 112,478,0,28 42 42 41: 95,478,0,28 … … 61 61 60: 776,422,0,28 62 62 61: 762,422,0,28 63 62: 75 2,422,1,2863 62: 753,422,0,28 64 64 63: 722,422,0,28 65 65 64: 737,422,0,28 … … 81 81 80: 736,364,0,28 82 82 81: 722,364,0,28 83 82: 711,364, 1,2883 82: 711,364,0,28 84 84 83: 689,364,0,28 85 85 84: 702,364,0,28 -
trunk/LayoutTests/platform/wk2/TestExpectations
r150654 r153060 128 128 platform/mac/editing/input/firstrectforcharacterrange-plain.html 129 129 platform/mac/editing/input/firstrectforcharacterrange-styled.html 130 platform/mac/editing/input/firstrectforcharacterrange-vertical.html 130 131 platform/mac/editing/input/hangul-enter-confirms-and-sends-keypress.html 131 132 platform/mac/editing/input/insert-delete-smp-symbol.html -
trunk/Source/WebCore/ChangeLog
r153058 r153060 1 2013-07-23 Alexey Proskuryakov <ap@apple.com> 2 3 Dictionary hotkey does not work on vertical text 4 https://bugs.webkit.org/show_bug.cgi?id=118993 5 <rdar://problem/14478260> 6 7 Reviewed by Enrica Casucci. 8 9 Test: platform/mac/editing/input/firstrectforcharacterrange-vertical.html 10 11 * editing/Editor.cpp: 12 (WebCore::collapseCaretWidth): A helper function. 13 (WebCore::Editor::firstRectForRange): Many changes: 14 - use RenderObject::absoluteBoundingBoxRectForRange() in regular case, because 15 that's more direct that getting caret rects and computing bounding rect from those. 16 - handle collapsed ranges separately, because absoluteBoundingBoxRectForRange() 17 doesn't provide the needed result, and because it can be done faster. 18 - wherever we use carets to compute the result, account for vertical text (in a hackish 19 way, as we don't have layout information at Editor level). 20 21 * rendering/RenderBlock.cpp: (WebCore::RenderBlock::localCaretRect): Removed 22 dead code. 23 1 24 2013-07-23 Bem Jones-Bey <bjonesbe@adobe.com> 2 25 -
trunk/Source/WebCore/editing/Editor.cpp
r152668 r153060 2657 2657 } 2658 2658 2659 static inline void collapseCaretWidth(IntRect& rect) 2660 { 2661 // FIXME: Width adjustment doesn't work for rotated text. 2662 if (rect.width() == caretWidth) 2663 rect.setWidth(0); 2664 else if (rect.height() == caretWidth) 2665 rect.setHeight(0); 2666 } 2667 2659 2668 IntRect Editor::firstRectForRange(Range* range) const 2660 2669 { 2661 LayoutUnit extraWidthToEndOfLine = 0;2662 2670 ASSERT(range->startContainer()); 2663 2671 ASSERT(range->endContainer()); 2664 2672 2665 IntRect startCaretRect = RenderedPosition(VisiblePosition(range->startPosition()).deepEquivalent(), DOWNSTREAM).absoluteRect(&extraWidthToEndOfLine); 2666 if (startCaretRect == LayoutRect()) 2673 VisiblePosition startVisiblePosition(range->startPosition(), DOWNSTREAM); 2674 2675 if (range->collapsed(ASSERT_NO_EXCEPTION)) { 2676 // FIXME: Getting caret rect and removing caret width is a very roundabout way to get collapsed range location. 2677 // In particular, width adjustment doesn't work for rotated text. 2678 IntRect startCaretRect = RenderedPosition(startVisiblePosition).absoluteRect(); 2679 collapseCaretWidth(startCaretRect); 2680 return startCaretRect; 2681 } 2682 2683 VisiblePosition endVisiblePosition(range->endPosition(), UPSTREAM); 2684 2685 if (inSameLine(startVisiblePosition, endVisiblePosition)) 2686 return enclosingIntRect(RenderObject::absoluteBoundingBoxRectForRange(range)); 2687 2688 LayoutUnit extraWidthToEndOfLine = 0; 2689 IntRect startCaretRect = RenderedPosition(startVisiblePosition).absoluteRect(&extraWidthToEndOfLine); 2690 if (startCaretRect == IntRect()) 2667 2691 return IntRect(); 2668 2692 2669 IntRect endCaretRect = RenderedPosition(VisiblePosition(range->endPosition()).deepEquivalent(), UPSTREAM).absoluteRect(); 2670 if (endCaretRect == LayoutRect()) 2671 return IntRect(); 2672 2673 if (startCaretRect.y() == endCaretRect.y()) { 2674 // start and end are on the same line 2675 return IntRect(min(startCaretRect.x(), endCaretRect.x()), 2693 // When start and end aren't on the same line, we want to go from start to the end of its line. 2694 bool textIsHorizontal = startCaretRect.width() == caretWidth; 2695 return textIsHorizontal ? 2696 IntRect(startCaretRect.x(), 2676 2697 startCaretRect.y(), 2677 abs(endCaretRect.x() - startCaretRect.x()), 2678 max(startCaretRect.height(), endCaretRect.height())); 2679 } 2680 2681 // start and end aren't on the same line, so go from start to the end of its line 2682 return IntRect(startCaretRect.x(), 2683 startCaretRect.y(), 2684 startCaretRect.width() + extraWidthToEndOfLine, 2685 startCaretRect.height()); 2698 startCaretRect.width() + extraWidthToEndOfLine, 2699 startCaretRect.height()) : 2700 IntRect(startCaretRect.x(), 2701 startCaretRect.y(), 2702 startCaretRect.width(), 2703 startCaretRect.height() + extraWidthToEndOfLine); 2686 2704 } 2687 2705 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r153058 r153060 7328 7328 LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffset()); 7329 7329 7330 if (extraWidthToEndOfLine) { 7331 if (isRenderBlock()) { 7332 *extraWidthToEndOfLine = width() - caretRect.maxX(); 7333 } else { 7334 // FIXME: This code looks wrong. 7335 // myRight and containerRight are set up, but then clobbered. 7336 // So *extraWidthToEndOfLine will always be 0 here. 7337 7338 LayoutUnit myRight = caretRect.maxX(); 7339 // FIXME: why call localToAbsoluteForContent() twice here, too? 7340 FloatPoint absRightPoint = localToAbsolute(FloatPoint(myRight, 0)); 7341 7342 LayoutUnit containerRight = containingBlock()->x() + containingBlockLogicalWidthForContent(); 7343 FloatPoint absContainerPoint = localToAbsolute(FloatPoint(containerRight, 0)); 7344 7345 *extraWidthToEndOfLine = absContainerPoint.x() - absRightPoint.x(); 7346 } 7347 } 7330 // FIXME: Does this need to adjust for vertical orientation? 7331 if (extraWidthToEndOfLine) 7332 *extraWidthToEndOfLine = width() - caretRect.maxX(); 7348 7333 7349 7334 return caretRect;
Note: See TracChangeset
for help on using the changeset viewer.