Changeset 167447 in webkit


Ignore:
Timestamp:
Apr 17, 2014 12:39:22 PM (10 years ago)
Author:
ddkilzer@apple.com
Message:

Tidy up isIsolatedInline() and highestContainingIsolateWithinRoot()
<http://webkit.org/b/131117>

Reviewed by Daniel Bates.

Based on review feedback for r166650.

  • rendering/InlineIterator.h:

(WebCore::isIsolatedInline):

  • Switch argument to a reference since it is never called with a nullptr.

(WebCore::highestContainingIsolateWithinRoot):

  • Switch first argument to a reference since it's never a nullptr.
  • Use nullptr for pointer initialization.
  • Switch while() loop to for() loop. Pass reference to isIsolatedInline().

(WebCore::numberOfIsolateAncestors):

  • Switch while() loop to for() loop. Pass reference to isIsolatedInline().
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::constructBidiRunsForSegment):

  • Rename startObj to startObject.
  • No longer need to pass the address of startObject here.
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167445 r167447  
     12014-04-17  David Kilzer  <ddkilzer@apple.com>
     2
     3        Tidy up isIsolatedInline() and highestContainingIsolateWithinRoot()
     4        <http://webkit.org/b/131117>
     5
     6        Reviewed by Daniel Bates.
     7
     8        Based on review feedback for r166650.
     9
     10        * rendering/InlineIterator.h:
     11        (WebCore::isIsolatedInline):
     12        - Switch argument to a reference since it is never called with a
     13          nullptr.
     14        (WebCore::highestContainingIsolateWithinRoot):
     15        - Switch first argument to a reference since it's never a
     16          nullptr.
     17        - Use nullptr for pointer initialization.
     18        - Switch while() loop to for() loop. Pass reference to
     19          isIsolatedInline().
     20        (WebCore::numberOfIsolateAncestors):
     21        - Switch while() loop to for() loop. Pass reference to
     22          isIsolatedInline().
     23        * rendering/RenderBlockLineLayout.cpp:
     24        (WebCore::constructBidiRunsForSegment):
     25        - Rename startObj to startObject.
     26        - No longer need to pass the address of startObject here.
     27
    1282014-04-17  Andreas Kling  <akling@apple.com>
    229
  • trunk/Source/WebCore/rendering/InlineIterator.h

    r166650 r167447  
    443443}
    444444
    445 static inline bool isIsolatedInline(RenderObject* object)
    446 {
    447     ASSERT(object);
    448     return object->isRenderInline() && isIsolated(object->style().unicodeBidi());
    449 }
    450 
    451 static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject* object, RenderObject* root)
    452 {
    453     ASSERT(object);
    454     RenderObject* containingIsolateObject = 0;
    455     while (object && object != root) {
    456         if (isIsolatedInline(object))
     445static inline bool isIsolatedInline(RenderObject& object)
     446{
     447    return object.isRenderInline() && isIsolated(object.style().unicodeBidi());
     448}
     449
     450static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject& initialObject, RenderObject* root)
     451{
     452    RenderObject* containingIsolateObject = nullptr;
     453    for (RenderObject* object = &initialObject; object && object != root; object = object->parent()) {
     454        if (isIsolatedInline(*object))
    457455            containingIsolateObject = object;
    458 
    459         object = object->parent();
    460456    }
    461457    return containingIsolateObject;
     
    464460static inline unsigned numberOfIsolateAncestors(const InlineIterator& iter)
    465461{
    466     RenderObject* object = iter.renderer();
    467     if (!object)
    468         return 0;
    469462    unsigned count = 0;
    470     while (object && object != iter.root()) {
    471         if (isIsolatedInline(object))
     463    typedef RenderObject* RenderObjectPtr;
     464    for (RenderObjectPtr object = iter.renderer(), root = iter.root(); object && object != root; object = object->parent()) {
     465        if (isIsolatedInline(*object))
    472466            count++;
    473         object = object->parent();
    474467    }
    475468    return count;
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r167283 r167447  
    853853        topResolver.isolatedRuns().removeLast();
    854854
    855         RenderObject& startObj = isolatedRun->renderer();
     855        RenderObject& startObject = isolatedRun->renderer();
    856856
    857857        // Only inlines make sense with unicode-bidi: isolate (blocks are already isolated).
     
    860860        // to take a RenderObject and do this logic there, but that would be a layering
    861861        // violation for BidiResolver (which knows nothing about RenderObject).
    862         RenderInline* isolatedInline = toRenderInline(highestContainingIsolateWithinRoot(&startObj, currentRoot));
     862        RenderInline* isolatedInline = toRenderInline(highestContainingIsolateWithinRoot(startObject, currentRoot));
    863863        ASSERT(isolatedInline);
    864864
     
    874874        isolatedResolver.setStatus(BidiStatus(direction, isOverride(unicodeBidi)));
    875875
    876         setUpResolverToResumeInIsolate(isolatedResolver, isolatedInline, &startObj);
     876        setUpResolverToResumeInIsolate(isolatedResolver, isolatedInline, &startObject);
    877877
    878878        // The starting position is the beginning of the first run within the isolate that was identified
    879879        // during the earlier call to createBidiRunsForLine. This can be but is not necessarily the
    880880        // first run within the isolate.
    881         InlineIterator iter = InlineIterator(isolatedInline, &startObj, isolatedRun->m_start);
     881        InlineIterator iter = InlineIterator(isolatedInline, &startObject, isolatedRun->m_start);
    882882        isolatedResolver.setPositionIgnoringNestedIsolates(iter);
    883883
Note: See TracChangeset for help on using the changeset viewer.