Title: [167447] trunk/Source/WebCore
Revision
167447
Author
ddkil...@apple.com
Date
2014-04-17 12:39:22 -0700 (Thu, 17 Apr 2014)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (167446 => 167447)


--- trunk/Source/WebCore/ChangeLog	2014-04-17 19:27:28 UTC (rev 167446)
+++ trunk/Source/WebCore/ChangeLog	2014-04-17 19:39:22 UTC (rev 167447)
@@ -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-17  Andreas Kling  <akl...@apple.com>
 
         Log number of bytes reclaimed at each step of memory pressure relief.

Modified: trunk/Source/WebCore/rendering/InlineIterator.h (167446 => 167447)


--- trunk/Source/WebCore/rendering/InlineIterator.h	2014-04-17 19:27:28 UTC (rev 167446)
+++ trunk/Source/WebCore/rendering/InlineIterator.h	2014-04-17 19:39:22 UTC (rev 167447)
@@ -442,35 +442,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: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (167446 => 167447)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2014-04-17 19:27:28 UTC (rev 167446)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2014-04-17 19:39:22 UTC (rev 167447)
@@ -852,14 +852,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;
@@ -873,12 +873,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