Changeset 114784 in webkit
- Timestamp:
- Apr 20, 2012 2:40:26 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r114777 r114784 1 2012-04-20 Dan Bernstein <mitz@apple.com> 2 3 Selection highlights of lines in adjoining blocks can overlap 4 https://bugs.webkit.org/show_bug.cgi?id=84489 5 6 Reviewed by Anders Carlsson. 7 8 * fast/block/line-layout/selection-highlight-overlap-expected.html: Added. 9 * fast/block/line-layout/selection-highlight-overlap.html: Added. 10 1 11 2012-04-20 Dmitry Titov <dimich@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r114783 r114784 1 2012-04-20 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/10786000> Selection highlights of lines in adjoining blocks can overlap 4 https://bugs.webkit.org/show_bug.cgi?id=84489 5 6 Reviewed by Anders Carlsson. 7 8 Test: fast/block/line-layout/selection-highlight-overlap.html 9 10 * rendering/EllipsisBox.cpp: 11 (WebCore::EllipsisBox::selectionRect): Changed to use 12 selection{Top,Height}AdjustedForPrecedingBlock(). 13 * rendering/InlineTextBox.cpp: 14 (WebCore::InlineTextBox::paintSelection): Ditto. 15 * rendering/RenderBlock.cpp: 16 (WebCore::RenderBlock::inlineSelectionGaps): Ditto. 17 (WebCore::RenderBlock::blockBeforeWithinSelectionRoot): Added. Returns the block which is 18 likely to contain the selected line just before the first line in this block, if it is 19 within the same selection root. 20 * rendering/RenderBlock.h: 21 * rendering/RootInlineBox.cpp: 22 (WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock): Added. If the selection 23 starts before our block, finds the last line in the preceding block and adjusts the selection 24 top to avoid overlap with that line’s selection bottom. 25 * rendering/RootInlineBox.h: 26 (WebCore::RootInlineBox::selectionHeightAdjustedForPrecedingBlock): Added. Like 27 selectionHeight(), but uses selectionTopAdjustedForPrecedingBlock(). 28 1 29 2012-04-20 Xianzhu Wang <wangxianzhu@chromium.org> 2 30 -
trunk/Source/WebCore/rendering/EllipsisBox.cpp
r112512 r114784 79 79 const Font& font = style->font(); 80 80 // FIXME: Why is this always LTR? Fix by passing correct text run flags below. 81 return enclosingIntRect(font.selectionRectForText(RenderBlock::constructTextRun(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(x(), y() + root()->selectionTop ()), root()->selectionHeight()));81 return enclosingIntRect(font.selectionRectForText(RenderBlock::constructTextRun(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(x(), y() + root()->selectionTopAdjustedForPrecedingBlock()), root()->selectionHeightAdjustedForPrecedingBlock())); 82 82 } 83 83 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r114220 r114784 842 842 ePos = textRun.length(); 843 843 844 int deltaY = renderer()->style()->isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop(); 845 int selHeight = selectionHeight(); 844 LayoutUnit selectionBottom = root()->selectionBottom(); 845 LayoutUnit selectionTop = root()->selectionTopAdjustedForPrecedingBlock(); 846 847 int deltaY = renderer()->style()->isFlippedLinesWritingMode() ? selectionBottom - logicalBottom() : logicalTop() - selectionTop; 848 int selHeight = max<LayoutUnit>(0, selectionBottom - selectionTop); 849 846 850 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); 847 851 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r114537 r114784 3214 3214 // Now paint the gaps for the lines. 3215 3215 for (; curr && curr->hasSelectedChildren(); curr = curr->nextRootBox()) { 3216 LayoutUnit selTop = curr->selectionTop ();3217 LayoutUnit selHeight = curr->selectionHeight ();3216 LayoutUnit selTop = curr->selectionTopAdjustedForPrecedingBlock(); 3217 LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock(); 3218 3218 3219 3219 if (!containsStart && !lastSelectedLine && … … 3405 3405 } 3406 3406 return logicalRight; 3407 } 3408 3409 RenderBlock* RenderBlock::blockBeforeWithinSelectionRoot(LayoutSize& offset) const 3410 { 3411 if (isSelectionRoot()) 3412 return 0; 3413 3414 const RenderBox* object = this; 3415 RenderBox* sibling; 3416 do { 3417 sibling = object->previousSiblingBox(); 3418 while (sibling && (!sibling->isRenderBlock() || toRenderBlock(sibling)->isSelectionRoot())) 3419 sibling = sibling->previousSiblingBox(); 3420 3421 offset -= LayoutSize(object->logicalLeft(), object->logicalTop()); 3422 object = object->parentBox(); 3423 } while (!sibling && object && object->isRenderBlock() && !toRenderBlock(object)->isSelectionRoot()); 3424 3425 if (!sibling) 3426 return 0; 3427 3428 offset += LayoutSize(sibling->logicalLeft(), sibling->logicalTop()); 3429 3430 RenderObject* child = sibling->lastChild(); 3431 while (child && child->isRenderBlock()) { 3432 sibling = toRenderBlock(child); 3433 offset += LayoutSize(sibling->logicalLeft(), sibling->logicalTop()); 3434 child = sibling->lastChild(); 3435 } 3436 return toRenderBlock(sibling); 3407 3437 } 3408 3438 -
trunk/Source/WebCore/rendering/RenderBlock.h
r113885 r114784 211 211 RenderObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo*); 212 212 void getSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap); 213 RenderBlock* blockBeforeWithinSelectionRoot(LayoutSize& offset) const; 214 213 215 LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, const LayoutRect& logicalRect); 214 216 … … 802 804 LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit position); 803 805 LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position); 804 806 805 807 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const; 806 808 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r113221 r114784 546 546 } 547 547 548 LayoutUnit RootInlineBox::selectionTopAdjustedForPrecedingBlock() const 549 { 550 LayoutUnit top = selectionTop(); 551 552 RenderObject::SelectionState blockSelectionState = root()->block()->selectionState(); 553 if (blockSelectionState != RenderObject::SelectionInside && blockSelectionState != RenderObject::SelectionEnd) 554 return top; 555 556 LayoutSize offsetToBlockBefore; 557 if (RenderBlock* block = root()->block()->blockBeforeWithinSelectionRoot(offsetToBlockBefore)) { 558 if (RootInlineBox* lastLine = block->lastRootBox()) { 559 RenderObject::SelectionState lastLineSelectionState = lastLine->selectionState(); 560 if (lastLineSelectionState != RenderObject::SelectionInside && lastLineSelectionState != RenderObject::SelectionStart) 561 return top; 562 563 LayoutUnit lastLineSelectionBottom = lastLine->selectionBottom() + offsetToBlockBefore.height(); 564 top = max(top, lastLineSelectionBottom); 565 } 566 } 567 568 return top; 569 } 570 548 571 LayoutUnit RootInlineBox::selectionBottom() const 549 572 { -
trunk/Source/WebCore/rendering/RootInlineBox.h
r113221 r114784 63 63 LayoutUnit selectionBottom() const; 64 64 LayoutUnit selectionHeight() const { return max<LayoutUnit>(0, selectionBottom() - selectionTop()); } 65 66 LayoutUnit selectionTopAdjustedForPrecedingBlock() const; 67 LayoutUnit selectionHeightAdjustedForPrecedingBlock() const { return max<LayoutUnit>(0, selectionBottom() - selectionTopAdjustedForPrecedingBlock()); } 65 68 66 69 int blockDirectionPointInLine() const { return max(lineTop(), selectionTop()); }
Note: See TracChangeset
for help on using the changeset viewer.