Changeset 83813 in webkit


Ignore:
Timestamp:
Apr 13, 2011 10:35:54 PM (13 years ago)
Author:
yael.aharon@nokia.com
Message:

2011-04-13 Yael Aharon <yael.aharon@nokia.com>

Reviewed by Eric Seidel.

constructLine should take bidiRuns as a parameter
https://bugs.webkit.org/show_bug.cgi?id=58458

Pass bidiRuns to constructLine and move reachedEndOfTextRenderer so that it is
declared before constructLine.

No new tests as this is refactoring only.

  • rendering/RenderBlock.h:
  • rendering/RenderBlockLineLayout.cpp: (WebCore::reachedEndOfTextRenderer): (WebCore::RenderBlock::constructLine): (WebCore::RenderBlock::layoutInlineChildren):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83808 r83813  
     12011-04-13  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        constructLine should take bidiRuns as a parameter
     6        https://bugs.webkit.org/show_bug.cgi?id=58458
     7
     8        Pass bidiRuns to constructLine and move reachedEndOfTextRenderer so that it is
     9        declared before constructLine.
     10
     11        No new tests as this is refactoring only.
     12
     13        * rendering/RenderBlock.h:
     14        * rendering/RenderBlockLineLayout.cpp:
     15        (WebCore::reachedEndOfTextRenderer):
     16        (WebCore::RenderBlock::constructLine):
     17        (WebCore::RenderBlock::layoutInlineChildren):
     18
    1192011-04-13  Oliver Hunt  <oliver@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r83794 r83813  
    501501    InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, LineBreakIteratorInfo&, bool& previousLineBrokeCleanly, bool& hyphenated,
    502502                                     EClear*, FloatingObject* lastFloatFromPreviousLine, Vector<RenderBox*>& positionedObjects);
    503     RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, bool isLogicallyLastRunWrapped, RenderObject* logicallyLastRunRenderer);
     503    RootInlineBox* constructLine(BidiRunList<BidiRun>&, bool firstLine, bool lastLine);
    504504    InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine, InlineBox* childBox);
    505505
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r83794 r83813  
    267267}
    268268
    269 RootInlineBox* RenderBlock::constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, bool isLogicallyLastRunWrapped, RenderObject* logicallyLastRunRenderer)
    270 {
    271     ASSERT(firstRun);
     269static bool reachedEndOfTextRenderer(const BidiRunList<BidiRun>& bidiRuns)
     270{
     271    BidiRun* run = bidiRuns.logicallyLastRun();
     272    if (!run)
     273        return true;
     274    unsigned int pos = run->stop();
     275    RenderObject* r = run->m_object;
     276    if (!r->isText() || r->isBR())
     277        return false;
     278    RenderText* renderText = toRenderText(r);
     279    if (pos >= renderText->textLength())
     280        return true;
     281
     282    while (isASCIISpace(renderText->characters()[pos])) {
     283        pos++;
     284        if (pos >= renderText->textLength())
     285            return true;
     286    }
     287    return false;
     288}
     289
     290RootInlineBox* RenderBlock::constructLine(BidiRunList<BidiRun>& bidiRuns, bool firstLine, bool lastLine)
     291{
     292    ASSERT(bidiRuns.firstRun());
    272293
    273294    bool rootHasSelectedChildren = false;
    274295    InlineFlowBox* parentBox = 0;
    275     for (BidiRun* r = firstRun; r; r = r->next()) {
     296    for (BidiRun* r = bidiRuns.firstRun(); r; r = r->next()) {
    276297        // Create a box for our object.
    277         bool isOnlyRun = (runCount == 1);
    278         if (runCount == 2 && !r->m_object->isListMarker())
    279             isOnlyRun = (!style()->isLeftToRightDirection() ? lastRun : firstRun)->m_object->isListMarker();
     298        bool isOnlyRun = (bidiRuns.runCount() == 1);
     299        if (bidiRuns.runCount() == 2 && !r->m_object->isListMarker())
     300            isOnlyRun = (!style()->isLeftToRightDirection() ? bidiRuns.lastRun() : bidiRuns.firstRun())->m_object->isListMarker();
    280301
    281302        InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun);
     
    326347    // we determine the horizontal positions and widths of all the inline boxes on
    327348    // the line.
    328     lastLineBox()->determineSpacingForFlowBoxes(lastLine, isLogicallyLastRunWrapped, logicallyLastRunRenderer);
     349    bool isLogicallyLastRunWrapped = bidiRuns.logicallyLastRun()->m_object && bidiRuns.logicallyLastRun()->m_object->isText() ? !reachedEndOfTextRenderer(bidiRuns) : true;
     350    lastLineBox()->determineSpacingForFlowBoxes(lastLine, isLogicallyLastRunWrapped, bidiRuns.logicallyLastRun()->m_object);
    329351
    330352    // Now mark the line boxes as being constructed.
     
    640662}
    641663
    642 static bool reachedEndOfTextRenderer(const BidiRunList<BidiRun>& bidiRuns)
    643 {
    644     BidiRun* run = bidiRuns.logicallyLastRun();
    645     if (!run)
    646         return true;
    647     unsigned int pos = run->stop();
    648     RenderObject* r = run->m_object;
    649     if (!r->isText() || r->isBR())
    650         return false;
    651     RenderText* renderText = toRenderText(r);
    652     if (pos >= renderText->textLength())
    653         return true;
    654 
    655     while (isASCIISpace(renderText->characters()[pos])) {
    656         pos++;
    657         if (pos >= renderText->textLength())
    658             return true;
    659     }
    660     return false;
    661 }
    662    
    663664inline BidiRun* RenderBlock::handleTrailingSpaces(BidiRunList<BidiRun>& bidiRuns, BidiContext* currentContext)
    664665{
     
    903904                    if (hyphenated)
    904905                        bidiRuns.logicallyLastRun()->m_hasHyphen = true;
    905                     bool isLogicallyLastRunWrapped = bidiRuns.logicallyLastRun()->m_object && bidiRuns.logicallyLastRun()->m_object->isText() ? !reachedEndOfTextRenderer(bidiRuns) : true;
    906                     // FIXME: Clearly constructLine should just take a bidiRuns object.
    907                     lineBox = constructLine(bidiRuns.runCount(), bidiRuns.firstRun(), bidiRuns.lastRun(), firstLine, !end.m_obj, isLogicallyLastRunWrapped, bidiRuns.logicallyLastRun()->m_object);
     906                    lineBox = constructLine(bidiRuns, firstLine, !end.m_obj);
    908907                    if (lineBox) {
    909908                        lineBox->setEndsWithBreak(previousLineBrokeCleanly);
Note: See TracChangeset for help on using the changeset viewer.