Changeset 176262 in webkit
- Timestamp:
- Nov 18, 2014 9:54:52 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r176258 r176262 1 2014-11-17 David Hyatt <hyatt@apple.com> 2 3 Improve Ruby selection (getting rid of overlap and improving gap filling) 4 https://bugs.webkit.org/show_bug.cgi?id=138250 5 6 Reviewed by Dean Jackson. 7 8 Added fast/repaint/selection-ruby-rl.html 9 10 * fast/repaint/selection-ruby-rl-expected.txt: Added. 11 * fast/repaint/selection-ruby-rl.html: Added. 12 1 13 2014-11-18 Commit Queue <commit-queue@webkit.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r176261 r176262 1 2014-11-17 David Hyatt <hyatt@apple.com> 2 3 Improve Ruby selection (getting rid of overlap and improving gap filling) 4 https://bugs.webkit.org/show_bug.cgi?id=138250 5 6 Reviewed by Dean Jackson. 7 8 * rendering/RenderBlock.cpp: 9 (WebCore::RenderBlock::selectionGaps): 10 (WebCore::RenderBlock::blockSelectionGaps): 11 Add Ruby text in along with the Ruby base. 12 13 * rendering/RenderBlockFlow.cpp: 14 (WebCore::RenderBlockFlow::inlineSelectionGaps): 15 Don't let block gaps get filled in here. 16 17 * rendering/RenderRubyBase.h: 18 Expose accessor to the ruby run. 19 20 * rendering/RenderRubyText.cpp: 21 (WebCore::RenderRubyText::rubyRun): 22 * rendering/RenderRubyText.h: 23 Add accessor to the ruby run. 24 25 * rendering/RootInlineBox.cpp: 26 (WebCore::RootInlineBox::selectionTop): 27 (WebCore::RootInlineBox::selectionBottom): 28 Improve selectionTop and selectionBottom of ruby bases to avoid the 29 ruby text. Improve the selectionTop and selectionBottom of ruby texts 30 to fill the gap up to the previous/next line as appropriate. 31 1 32 2014-11-18 Shivakumar JM <shiva.jm@samsung.com> 2 33 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r175965 r176262 1883 1883 1884 1884 // Go ahead and fill the vertical gap all the way to the bottom of our block if the selection extends past our block. 1885 if (&rootBlock == this && (selectionState() != SelectionBoth && selectionState() != SelectionEnd) && !isRubyBase() ) {1885 if (&rootBlock == this && (selectionState() != SelectionBoth && selectionState() != SelectionEnd) && !isRubyBase() && !isRubyText()) { 1886 1886 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, 1887 1887 lastLogicalTop, lastLogicalLeft, lastLogicalRight, logicalHeight(), cache, paintInfo)); … … 1928 1928 1929 1929 bool paintsOwnSelection = curr->shouldPaintSelectionGaps() || curr->isTable(); // FIXME: Eventually we won't special-case table like this. 1930 bool fillBlockGaps = !isRubyBase() && (paintsOwnSelection || (curr->canBeSelectionLeaf() && childState != SelectionNone));1930 bool fillBlockGaps = (paintsOwnSelection || (curr->canBeSelectionLeaf() && childState != SelectionNone)) && !isRubyBase() && !isRubyText(); 1931 1931 if (fillBlockGaps) { 1932 1932 // We need to fill the vertical gap above this object. -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r175583 r176262 3013 3013 3014 3014 if (!containsStart && !lastSelectedLine && 3015 selectionState() != SelectionStart && selectionState() != SelectionBoth )3015 selectionState() != SelectionStart && selectionState() != SelectionBoth && !isRubyBase()) 3016 3016 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, selTop, cache, paintInfo)); 3017 3017 -
trunk/Source/WebCore/rendering/RenderRubyBase.h
r175084 r176262 44 44 45 45 virtual const char* renderName() const override { return "RenderRubyBase (anonymous)"; } 46 47 RenderRubyRun* rubyRun() const; 46 48 47 49 private: … … 56 58 void moveBlockChildren(RenderRubyBase* toBase, RenderObject* beforeChild = 0); 57 59 58 RenderRubyRun* rubyRun() const;59 60 60 // Allow RenderRubyRun to manipulate the children within ruby bases. 61 61 friend class RenderRubyRun; … … 64 64 } // namespace WebCore 65 65 66 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderRubyBase, isRubyBase()) 67 66 68 #endif // RenderRubyBase_h -
trunk/Source/WebCore/rendering/RenderRubyText.cpp
r170774 r176262 33 33 34 34 #include "RenderRubyText.h" 35 #include "RenderRubyRun.h" 35 36 36 37 namespace WebCore { … … 43 44 RenderRubyText::~RenderRubyText() 44 45 { 46 } 47 48 RenderRubyRun* RenderRubyText::rubyRun() const 49 { 50 ASSERT(parent()); 51 return downcast<RenderRubyRun>(parent()); 45 52 } 46 53 -
trunk/Source/WebCore/rendering/RenderRubyText.h
r174117 r176262 44 44 45 45 virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const override; 46 47 RenderRubyRun* rubyRun() const; 46 48 47 49 private: … … 57 59 } // namespace WebCore 58 60 61 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderRubyText, isRubyText()) 62 59 63 #endif // RenderRubyText_h -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r174840 r176262 35 35 #include "RenderFlowThread.h" 36 36 #include "RenderInline.h" 37 #include "RenderRubyBase.h" 38 #include "RenderRubyRun.h" 39 #include "RenderRubyText.h" 37 40 #include "RenderView.h" 38 41 #include "VerticalPositionCache.h" … … 595 598 { 596 599 LayoutUnit selectionTop = m_lineTop; 597 600 598 601 if (m_hasAnnotationsBefore) 599 602 selectionTop -= !renderer().style().isFlippedLinesWritingMode() ? computeOverAnnotationAdjustment(m_lineTop) : computeUnderAnnotationAdjustment(m_lineTop); … … 601 604 if (renderer().style().isFlippedLinesWritingMode()) 602 605 return selectionTop; 606 607 if (renderer().isRubyBase()) { 608 // The ruby base selection should avoid intruding into the ruby text. This is only the case if there is an actual ruby text above us. 609 RenderRubyBase* base = &downcast<RenderRubyBase>(renderer()); 610 RenderRubyRun* run = base->rubyRun(); 611 if (run) { 612 RenderRubyText* text = run->rubyText(); 613 if (text && text->logicalTop() < base->logicalTop()) { 614 // The ruby text is above the ruby base. Just return now in order to avoid painting on top of the ruby text. 615 return selectionTop; 616 } 617 } 618 } else if (renderer().isRubyText()) { 619 // The ruby text selection should go all the way to the selection top of the containing line. 620 RenderRubyText* text = &downcast<RenderRubyText>(renderer()); 621 RenderRubyRun* run = text->rubyRun(); 622 if (run && run->inlineBoxWrapper()) { 623 RenderRubyBase* base = run->rubyBase(); 624 if (base && text->logicalTop() < base->logicalTop()) { 625 // The ruby text is above the ruby base. 626 const RootInlineBox& containingLine = run->inlineBoxWrapper()->root(); 627 LayoutUnit enclosingSelectionTop = containingLine.selectionTop(); 628 LayoutUnit deltaBetweenObjects = text->logicalTop() + run->logicalTop(); 629 LayoutUnit selectionTopInRubyTextCoords = enclosingSelectionTop - deltaBetweenObjects; 630 return std::min(selectionTop, selectionTopInRubyTextCoords); 631 } 632 } 633 } 603 634 604 635 LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : blockFlow().borderAndPaddingBefore(); … … 650 681 if (m_hasAnnotationsAfter) 651 682 selectionBottom += !renderer().style().isFlippedLinesWritingMode() ? computeUnderAnnotationAdjustment(m_lineBottom) : computeOverAnnotationAdjustment(m_lineBottom); 652 683 653 684 if (!renderer().style().isFlippedLinesWritingMode() || !nextRootBox()) 654 685 return selectionBottom; 686 687 if (renderer().isRubyBase()) { 688 // The ruby base selection should avoid intruding into the ruby text. This is only the case if there is an actual ruby text below us. 689 RenderRubyBase* base = &downcast<RenderRubyBase>(renderer()); 690 RenderRubyRun* run = base->rubyRun(); 691 if (run) { 692 RenderRubyText* text = run->rubyText(); 693 if (text && text->logicalTop() > base->logicalTop()) { 694 // The ruby text is below the ruby base. Just return now in order to avoid painting on top of the ruby text. 695 return selectionBottom; 696 } 697 } 698 } else if (renderer().isRubyText()) { 699 // The ruby text selection should go all the way to the selection bottom of the containing line. 700 RenderRubyText* text = &downcast<RenderRubyText>(renderer()); 701 RenderRubyRun* run = text->rubyRun(); 702 if (run && run->inlineBoxWrapper()) { 703 RenderRubyBase* base = run->rubyBase(); 704 if (base && text->logicalTop() > base->logicalTop()) { 705 // The ruby text is above the ruby base. 706 const RootInlineBox& containingLine = run->inlineBoxWrapper()->root(); 707 LayoutUnit enclosingSelectionBottom = containingLine.selectionBottom(); 708 LayoutUnit deltaBetweenObjects = text->logicalTop() + run->logicalTop(); 709 LayoutUnit selectionBottomInRubyTextCoords = enclosingSelectionBottom - deltaBetweenObjects; 710 return std::min(selectionBottom, selectionBottomInRubyTextCoords); 711 } 712 } 713 } 655 714 656 715 LayoutUnit nextTop = nextRootBox()->selectionTop();
Note: See TracChangeset
for help on using the changeset viewer.