Changeset 84436 in webkit


Ignore:
Timestamp:
Apr 20, 2011 4:48:23 PM (13 years ago)
Author:
eric@webkit.org
Message:

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

Reviewed by Ryosuke Niwa.

Split bidiFirst into two functions
https://bugs.webkit.org/show_bug.cgi?id=59025

I don't have a full understanding of the skipInlines case yet
(hence it's not as pretty as the non-skipping case), but
this is clearly a win, as both functions are much simpler
than their combined version.

Both of these functions still have bad names. However the
bidiNext/bidiFirst names date all the way back to revision 1
of the WebKit repository. :) So I don't feel too bad keeping
them for the moment.

  • rendering/InlineIterator.h: (WebCore::bidiNext): (WebCore::bidiFirstSkippingInlines): (WebCore::bidiFirstNotSkippingInlines):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::simplifiedNormalFlowLayout):
  • rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::layoutInlineChildren): (WebCore::RenderBlock::determineStartPosition):
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84433 r84436  
     12011-04-20  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        Split bidiFirst into two functions
     6        https://bugs.webkit.org/show_bug.cgi?id=59025
     7
     8        I don't have a full understanding of the skipInlines case yet
     9        (hence it's not as pretty as the non-skipping case), but
     10        this is clearly a win, as both functions are much simpler
     11        than their combined version.
     12
     13        Both of these functions still have bad names.  However the
     14        bidiNext/bidiFirst names date all the way back to revision 1
     15        of the WebKit repository. :)  So I don't feel too bad keeping
     16        them for the moment.
     17
     18        * rendering/InlineIterator.h:
     19        (WebCore::bidiNext):
     20        (WebCore::bidiFirstSkippingInlines):
     21        (WebCore::bidiFirstNotSkippingInlines):
     22        * rendering/RenderBlock.cpp:
     23        (WebCore::RenderBlock::simplifiedNormalFlowLayout):
     24        * rendering/RenderBlockLineLayout.cpp:
     25        (WebCore::RenderBlock::layoutInlineChildren):
     26        (WebCore::RenderBlock::determineStartPosition):
     27
    1282011-04-20  Jia Pu  <jpu@apple.com>
    229
  • trunk/Source/WebCore/rendering/InlineIterator.h

    r83240 r84436  
    138138{
    139139    RenderObject* next = 0;
     140    // oldEndOfInline denotes if when we last stopped iterating if we were at the end of an inline.
    140141    bool oldEndOfInline = endOfInlinePtr ? *endOfInlinePtr : false;
    141142    bool endOfInline = false;
     
    148149        }
    149150
     151        // We hit this when either current has no children, or when current is not a renderer we care about.
    150152        if (!next) {
     153            // If it is a renderer we care about, and we're doing our inline-walk, return it.
    151154            if (!skipInlines && !oldEndOfInline && current->isRenderInline()) {
    152155                next = current;
     
    189192}
    190193
    191 static inline RenderObject* bidiFirst(RenderObject* root, InlineBidiResolver* resolver, bool skipInlines = true)
    192 {
    193     if (!root->firstChild())
     194static inline RenderObject* bidiFirstSkippingInlines(RenderObject* root, InlineBidiResolver* resolver)
     195{
     196    ASSERT(resolver);
     197    RenderObject* o = root->firstChild();
     198    if (!o)
    194199        return 0;
    195200
    196     RenderObject* o = root->firstChild();
    197201    if (o->isRenderInline()) {
    198202        notifyResolverEnteredObject(resolver, o);
    199         if (skipInlines && o->firstChild())
    200             o = bidiNext(root, o, resolver, skipInlines);
     203        if (o->firstChild())
     204            o = bidiNext(root, o, resolver, true);
    201205        else {
    202206            // Never skip empty inlines.
     
    207211    }
    208212
     213    // FIXME: Unify this with the bidiNext call above.
    209214    if (o && !o->isText() && !o->isReplaced() && !o->isFloating() && !o->isPositioned())
    210         o = bidiNext(root, o, resolver, skipInlines);
    211 
    212     if (resolver)
    213         resolver->commitExplicitEmbedding();
     215        o = bidiNext(root, o, resolver, true);
     216
     217    resolver->commitExplicitEmbedding();
    214218    return o;
     219}
     220
     221// FIXME: This method needs to be renamed when bidiNext finds a good name.
     222static inline RenderObject* bidiFirstNotSkippingInlines(RenderObject* root)
     223{
     224    RenderObject* o = root->firstChild();
     225    // If either there are no children to walk, or the first one is correct
     226    // then just return it.
     227    if (!o || o->isRenderInline() || o->isText() || o->isReplaced() || o->isFloating() || o->isPositioned())
     228        return o;
     229
     230    return bidiNext(root, o, 0, false);
    215231}
    216232
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r84096 r84436  
    20822082        ListHashSet<RootInlineBox*> lineBoxes;
    20832083        bool endOfInline = false;
    2084         RenderObject* o = bidiFirst(this, 0, false);
     2084        RenderObject* o = bidiFirstNotSkippingInlines(this);
    20852085        while (o) {
    20862086            if (!o->isPositioned() && (o->isReplaced() || o->isFloating())) {
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r84119 r84436  
    754754        // layout replaced elements
    755755        bool endOfInline = false;
    756         RenderObject* o = bidiFirst(this, 0, false);
     756        RenderObject* o = bidiFirstNotSkippingInlines(this);
    757757        Vector<FloatWithRect> floats;
    758758        bool hasInlineChild = false;
     
    12751275        resolver.setContext(BidiContext::create(ltr ? 0 : 1, direction, style()->unicodeBidi() == Override, FromStyleOrDOM));
    12761276
    1277         startObj = bidiFirst(this, &resolver);
     1277        startObj = bidiFirstSkippingInlines(this, &resolver);
    12781278    }
    12791279
Note: See TracChangeset for help on using the changeset viewer.