Title: [150642] trunk/Source/WebCore
Revision
150642
Author
[email protected]
Date
2013-05-24 09:18:16 -0700 (Fri, 24 May 2013)

Log Message

Refactor shouldAddBorderPaddingMargin()
https://bugs.webkit.org/show_bug.cgi?id=98803

Reviewed by Ryosuke Niwa.

Make this helper function less clever-stupid in its misguided sacrifice of intelligibility
for the sake of concision.

No new tests, refactoring.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::shouldAddBorderPaddingMargin):
(WebCore::inlineLogicalWidth):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150641 => 150642)


--- trunk/Source/WebCore/ChangeLog	2013-05-24 15:51:18 UTC (rev 150641)
+++ trunk/Source/WebCore/ChangeLog	2013-05-24 16:18:16 UTC (rev 150642)
@@ -1,3 +1,19 @@
+2013-05-24  Robert Hogan  <[email protected]>
+
+        Refactor shouldAddBorderPaddingMargin()
+        https://bugs.webkit.org/show_bug.cgi?id=98803
+
+        Reviewed by Ryosuke Niwa.
+
+        Make this helper function less clever-stupid in its misguided sacrifice of intelligibility
+        for the sake of concision.
+
+        No new tests, refactoring.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::shouldAddBorderPaddingMargin):
+        (WebCore::inlineLogicalWidth):
+
 2013-05-24  Xiaobo Wang  <[email protected]>
 
         [BlackBerry] DRT - crashed on GraphicsContext3D::makeContextCurrent

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (150641 => 150642)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-05-24 15:51:18 UTC (rev 150641)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-05-24 16:18:16 UTC (rev 150642)
@@ -348,12 +348,10 @@
     return child->marginEnd() + child->paddingEnd() + child->borderEnd();
 }
 
-static bool shouldAddBorderPaddingMargin(RenderObject* child, bool &checkSide)
+static inline bool shouldAddBorderPaddingMargin(RenderObject* child)
 {
-    if (!child || (child->isText() && !toRenderText(child)->textLength()))
-        return true;
-    checkSide = false;
-    return checkSide;
+    // When deciding whether we're at the edge of an inline, adjacent collapsed whitespace is the same as no sibling at all.
+    return !child || (child->isText() && !toRenderText(child)->textLength());
 }
 
 static RenderObject* previousInFlowSibling(RenderObject* child)
@@ -364,7 +362,7 @@
     return child;
 }
 
-static LayoutUnit inlineLogicalWidth(RenderObject* child, bool start = true, bool end = true)
+static LayoutUnit inlineLogicalWidth(RenderObject* child, bool checkStartEdge = true, bool checkEndEdge = true)
 {
     unsigned lineDepth = 1;
     LayoutUnit extraWidth = 0;
@@ -372,11 +370,13 @@
     while (parent->isRenderInline() && lineDepth++ < cMaxLineDepth) {
         RenderInline* parentAsRenderInline = toRenderInline(parent);
         if (!isEmptyInline(parentAsRenderInline)) {
-            if (start && shouldAddBorderPaddingMargin(previousInFlowSibling(child), start))
+            checkStartEdge = checkStartEdge && shouldAddBorderPaddingMargin(previousInFlowSibling(child));
+            if (checkStartEdge)
                 extraWidth += borderPaddingMarginStart(parentAsRenderInline);
-            if (end && shouldAddBorderPaddingMargin(child->nextSibling(), end))
+            checkEndEdge = checkEndEdge && shouldAddBorderPaddingMargin(child->nextSibling());
+            if (checkEndEdge)
                 extraWidth += borderPaddingMarginEnd(parentAsRenderInline);
-            if (!start && !end)
+            if (!checkStartEdge && !checkEndEdge)
                 return extraWidth;
         }
         child = parent;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to