Title: [168279] releases/WebKitGTK/webkit-2.4/Source/WebCore
Revision
168279
Author
carlo...@webkit.org
Date
2014-05-05 04:32:34 -0700 (Mon, 05 May 2014)

Log Message

Merge r167447 - 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.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (168278 => 168279)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2014-05-05 11:23:51 UTC (rev 168278)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2014-05-05 11:32:34 UTC (rev 168279)
@@ -1,3 +1,30 @@
+2014-04-17  David Kilzer  <ddkil...@apple.com>
+
+        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.
+
 2014-04-02  David Kilzer  <ddkil...@apple.com>
 
         Use outermost containing isolate when constructing bidi runs

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/rendering/InlineIterator.h (168278 => 168279)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/rendering/InlineIterator.h	2014-05-05 11:23:51 UTC (rev 168278)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/rendering/InlineIterator.h	2014-05-05 11:32:34 UTC (rev 168279)
@@ -408,35 +408,28 @@
     m_current.increment(this);
 }
 
-static inline bool isIsolatedInline(RenderObject* object)
+static inline bool isIsolatedInline(RenderObject& object)
 {
-    ASSERT(object);
-    return object->isRenderInline() && isIsolated(object->style().unicodeBidi());
+    return object.isRenderInline() && isIsolated(object.style().unicodeBidi());
 }
 
-static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject* object, RenderObject* root)
+static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject& initialObject, RenderObject* root)
 {
-    ASSERT(object);
-    RenderObject* containingIsolateObject = 0;
-    while (object && object != root) {
-        if (isIsolatedInline(object))
+    RenderObject* containingIsolateObject = nullptr;
+    for (RenderObject* object = &initialObject; object && object != root; object = object->parent()) {
+        if (isIsolatedInline(*object))
             containingIsolateObject = object;
-
-        object = object->parent();
     }
     return containingIsolateObject;
 }
 
 static inline unsigned numberOfIsolateAncestors(const InlineIterator& iter)
 {
-    RenderObject* object = iter.renderer();
-    if (!object)
-        return 0;
     unsigned count = 0;
-    while (object && object != iter.root()) {
-        if (isIsolatedInline(object))
+    typedef RenderObject* RenderObjectPtr;
+    for (RenderObjectPtr object = iter.renderer(), root = iter.root(); object && object != root; object = object->parent()) {
+        if (isIsolatedInline(*object))
             count++;
-        object = object->parent();
     }
     return count;
 }

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/rendering/RenderBlockLineLayout.cpp (168278 => 168279)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2014-05-05 11:23:51 UTC (rev 168278)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2014-05-05 11:32:34 UTC (rev 168279)
@@ -896,14 +896,14 @@
         BidiRun* isolatedRun = topResolver.isolatedRuns().last();
         topResolver.isolatedRuns().removeLast();
 
-        RenderObject& startObj = isolatedRun->renderer();
+        RenderObject& startObject = isolatedRun->renderer();
 
         // Only inlines make sense with unicode-bidi: isolate (blocks are already isolated).
         // FIXME: Because enterIsolate is not passed a RenderObject, we have to crawl up the
         // tree to see which parent inline is the isolate. We could change enterIsolate
         // to take a RenderObject and do this logic there, but that would be a layering
         // violation for BidiResolver (which knows nothing about RenderObject).
-        RenderInline* isolatedInline = toRenderInline(highestContainingIsolateWithinRoot(&startObj, currentRoot));
+        RenderInline* isolatedInline = toRenderInline(highestContainingIsolateWithinRoot(startObject, currentRoot));
         ASSERT(isolatedInline);
 
         InlineBidiResolver isolatedResolver;
@@ -917,12 +917,12 @@
         }
         isolatedResolver.setStatus(BidiStatus(direction, isOverride(unicodeBidi)));
 
-        setUpResolverToResumeInIsolate(isolatedResolver, isolatedInline, &startObj);
+        setUpResolverToResumeInIsolate(isolatedResolver, isolatedInline, &startObject);
 
         // The starting position is the beginning of the first run within the isolate that was identified
         // during the earlier call to createBidiRunsForLine. This can be but is not necessarily the
         // first run within the isolate.
-        InlineIterator iter = InlineIterator(isolatedInline, &startObj, isolatedRun->m_start);
+        InlineIterator iter = InlineIterator(isolatedInline, &startObject, isolatedRun->m_start);
         isolatedResolver.setPositionIgnoringNestedIsolates(iter);
 
         // We stop at the next end of line; we may re-enter this isolate in the next call to constructBidiRuns().
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to