Changeset 85732 in webkit


Ignore:
Timestamp:
May 4, 2011 4:51:09 AM (13 years ago)
Author:
eric@webkit.org
Message:

2011-05-04 Eric Seidel <eric@webkit.org>

Reviewed by Ryosuke Niwa.

Split createLineBoxesFromBidiRuns out from layoutRunsAndFloats
https://bugs.webkit.org/show_bug.cgi?id=60080

No functional change, just moving code.

  • rendering/RenderBlock.h:
  • rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::createLineBoxesFromBidiRuns): (WebCore::RenderBlock::layoutRunsAndFloats):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85731 r85732  
     12011-05-04  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        Split createLineBoxesFromBidiRuns out from layoutRunsAndFloats
     6        https://bugs.webkit.org/show_bug.cgi?id=60080
     7
     8        No functional change, just moving code.
     9
     10        * rendering/RenderBlock.h:
     11        * rendering/RenderBlockLineLayout.cpp:
     12        (WebCore::RenderBlock::createLineBoxesFromBidiRuns):
     13        (WebCore::RenderBlock::layoutRunsAndFloats):
     14
    1152011-05-04  Andreas Kling  <andreas.kling@nokia.com>
    216
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r85705 r85732  
    709709
    710710    // Helper function for layoutInlineChildren()
     711    RootInlineBox* createLineBoxesFromBidiRuns(BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun);
    711712    void layoutRunsAndFloats(bool fullLayout, bool hasInlineChild, Vector<FloatWithRect>&, int& repaintLogicalTop, int& repaintLogicalBottom);
    712713
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r85705 r85732  
    763763}
    764764
     765// This function constructs line boxes for all of the text runs in the resolver and computes their position.
     766RootInlineBox* RenderBlock::createLineBoxesFromBidiRuns(BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun)
     767{
     768    if (!bidiRuns.runCount())
     769        return 0;
     770
     771    // FIXME: Why is this only done when we had runs?
     772    lineInfo.setLastLine(!end.m_obj);
     773
     774    RootInlineBox* lineBox = constructLine(bidiRuns, lineInfo);
     775    if (!lineBox)
     776        return 0;
     777
     778    lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly());
     779   
     780#if ENABLE(SVG)
     781    bool isSVGRootInlineBox = lineBox->isSVGRootInlineBox();
     782#else
     783    bool isSVGRootInlineBox = false;
     784#endif
     785   
     786    GlyphOverflowAndFallbackFontsMap textBoxDataMap;
     787   
     788    // Now we position all of our text runs horizontally.
     789    if (!isSVGRootInlineBox)
     790        computeInlineDirectionPositionsForLine(lineBox, lineInfo, bidiRuns.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap, verticalPositionCache);
     791   
     792    // Now position our text runs vertically.
     793    computeBlockDirectionPositionsForLine(lineBox, bidiRuns.firstRun(), textBoxDataMap, verticalPositionCache);
     794   
     795#if ENABLE(SVG)
     796    // SVG text layout code computes vertical & horizontal positions on its own.
     797    // Note that we still need to execute computeVerticalPositionsForLine() as
     798    // it calls InlineTextBox::positionLineBox(), which tracks whether the box
     799    // contains reversed text or not. If we wouldn't do that editing and thus
     800    // text selection in RTL boxes would not work as expected.
     801    if (isSVGRootInlineBox) {
     802        ASSERT(isSVGText());
     803        static_cast<SVGRootInlineBox*>(lineBox)->computePerCharacterLayoutInformation();
     804    }
     805#endif
     806   
     807    // Compute our overflow now.
     808    lineBox->computeOverflow(lineBox->lineTop(), lineBox->lineBottom(), textBoxDataMap);
     809   
     810#if PLATFORM(MAC)
     811    // Highlight acts as an overflow inflation.
     812    if (style()->highlight() != nullAtom)
     813        lineBox->addHighlightOverflow();
     814#endif
     815    return lineBox;
     816}
     817
    765818void RenderBlock::layoutRunsAndFloats(bool fullLayout, bool hasInlineChild, Vector<FloatWithRect>& floats, int& repaintLogicalTop, int& repaintLogicalBottom)
    766819{
     
    872925        ASSERT(end != resolver.position());
    873926
     927        // This is a short-cut for empty lines.
    874928        if (lineInfo.isEmpty()) {
    875929            if (lastRootBox())
     
    884938            BidiRun* trailingSpaceRun = !lineInfo.previousLineBrokeCleanly() ? handleTrailingSpaces(bidiRuns, resolver.context()) : 0;
    885939
     940            if (bidiRuns.runCount() && hyphenated)
     941                bidiRuns.logicallyLastRun()->m_hasHyphen = true;
     942
    886943            // Now that the runs have been ordered, we create the line boxes.
    887944            // At the same time we figure out where border/padding/margin should be applied for
    888945            // inline flow boxes.
    889946
    890             RootInlineBox* lineBox = 0;
    891947            int oldLogicalHeight = logicalHeight();
    892             if (bidiRuns.runCount()) {
    893                 if (hyphenated)
    894                     bidiRuns.logicallyLastRun()->m_hasHyphen = true;
    895                 lineInfo.setLastLine(!end.m_obj);
    896                 lineBox = constructLine(bidiRuns, lineInfo);
    897                 if (lineBox) {
    898                     lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly());
    899 
    900 #if ENABLE(SVG)
    901                     bool isSVGRootInlineBox = lineBox->isSVGRootInlineBox();
    902 #else
    903                     bool isSVGRootInlineBox = false;
    904 #endif
    905 
    906                     GlyphOverflowAndFallbackFontsMap textBoxDataMap;
    907 
    908                     // Now we position all of our text runs horizontally.
    909                     if (!isSVGRootInlineBox)
    910                         computeInlineDirectionPositionsForLine(lineBox, lineInfo, bidiRuns.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap, verticalPositionCache);
    911 
    912                     // Now position our text runs vertically.
    913                     computeBlockDirectionPositionsForLine(lineBox, bidiRuns.firstRun(), textBoxDataMap, verticalPositionCache);
    914 
    915 #if ENABLE(SVG)
    916                     // SVG text layout code computes vertical & horizontal positions on its own.
    917                     // Note that we still need to execute computeVerticalPositionsForLine() as
    918                     // it calls InlineTextBox::positionLineBox(), which tracks whether the box
    919                     // contains reversed text or not. If we wouldn't do that editing and thus
    920                     // text selection in RTL boxes would not work as expected.
    921                     if (isSVGRootInlineBox) {
    922                         ASSERT(isSVGText());
    923                         static_cast<SVGRootInlineBox*>(lineBox)->computePerCharacterLayoutInformation();
    924                     }
    925 #endif
    926 
    927                     // Compute our overflow now.
    928                     lineBox->computeOverflow(lineBox->lineTop(), lineBox->lineBottom(), textBoxDataMap);
    929 
    930 #if PLATFORM(MAC)
    931                     // Highlight acts as an overflow inflation.
    932                     if (style()->highlight() != nullAtom)
    933                         lineBox->addHighlightOverflow();
    934 #endif
    935                 }
    936             }
     948            RootInlineBox* lineBox = createLineBoxesFromBidiRuns(bidiRuns, end, lineInfo, verticalPositionCache, trailingSpaceRun);
    937949
    938950            bidiRuns.deleteRuns();
Note: See TracChangeset for help on using the changeset viewer.