2011-04-06 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 17:06:14 +0000 (17:06 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 17:06:14 +0000 (17:06 +0000)
        Reviewed by Dimitri Glazkov.

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

        * rendering/RenderBlockLineLayout.cpp:
        (WebCore::borderPaddingMarginStart): Extracted from getBorderPaddingMargin.
        (WebCore::borderPaddingMarginEnd): Ditto.
        (WebCore::inlineLogicalWidth): Calls borderPaddingMarginStart and borderPaddingMarginEnd.
        (WebCore::RenderBlock::findNextLineBreak): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83066 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlockLineLayout.cpp

index a3a34a9ab11145d80a0fefe42a587330fdd1ac4e..15b9fa44718e60d070dc581c7650ebd5f5eb6be3 100644 (file)
@@ -1,3 +1,16 @@
+2011-04-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Split getBorderPaddingMargin into two functions
+        https://bugs.webkit.org/show_bug.cgi?id=57947
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::borderPaddingMarginStart): Extracted from getBorderPaddingMargin.
+        (WebCore::borderPaddingMarginEnd): Ditto.
+        (WebCore::inlineLogicalWidth): Calls borderPaddingMarginStart and borderPaddingMarginEnd.
+        (WebCore::RenderBlock::findNextLineBreak): Ditto.
+
 2011-04-06  MORITA Hajime  <morrita@google.com>
 
         Reviewed by Dimitri Glazkov.
index 04aac36ab2e1eb699e45d65296b68d4e16f748e5..4e77123e9566e0aaa39391c6ba6f05605f9ca060 100644 (file)
@@ -60,23 +60,29 @@ namespace WebCore {
 // We don't let our line box tree for a single line get any deeper than this.
 const unsigned cMaxLineDepth = 200;
 
-static int getBorderPaddingMargin(RenderBoxModelObject* child, bool endOfInline)
+static inline int borderPaddingMarginStart(RenderBoxModelObject* child)
 {
-    if (endOfInline)
-        return child->marginEnd() + child->paddingEnd() + child->borderEnd();
+    // FIXME: Should we call marginStartForChild instead?
     return child->marginStart() + child->paddingStart() + child->borderStart();
 }
 
+static inline int borderPaddingMarginEnd(RenderBoxModelObject* child)
+{
+    return child->marginEnd() + child->paddingEnd() + child->borderEnd();
+}
+
 static int inlineLogicalWidth(RenderObject* child, bool start = true, bool end = true)
 {
     unsigned lineDepth = 1;
     int extraWidth = 0;
     RenderObject* parent = child->parent();
     while (parent->isInline() && !parent->isInlineBlockOrInlineTable() && lineDepth++ < cMaxLineDepth) {
+        RenderBoxModelObject* parentAsBoxModelObject = toRenderBoxModelObject(parent);
+        ASSERT(parentAsBoxModelObject);
         if (start && !child->previousSibling())
-            extraWidth += getBorderPaddingMargin(toRenderBoxModelObject(parent), false);
+            extraWidth += borderPaddingMarginStart(parentAsBoxModelObject);
         if (end && !child->nextSibling())
-            extraWidth += getBorderPaddingMargin(toRenderBoxModelObject(parent), true);
+            extraWidth += borderPaddingMarginEnd(parentAsBoxModelObject);
         child = parent;
         parent = child->parent();
     }
@@ -1718,8 +1724,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
                 }
             }
 
-            tmpW += flowBox->marginStart() + flowBox->borderStart() + flowBox->paddingStart() +
-                    flowBox->marginEnd() + flowBox->borderEnd() + flowBox->paddingEnd();
+            tmpW += borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox);
         } else if (o->isReplaced()) {
             RenderBox* replacedBox = toRenderBox(o);