Don't expose the intrinsic padding concept to the code outside rendering
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 04:15:37 +0000 (04:15 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 04:15:37 +0000 (04:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83380

Reviewed by Eric Seidel.

No new tests, refactoring only.

The current code would expose the concept of intrinsic padding to every
object holding a renderer through an enum on the padding* functions.

This was very fragile as only the class using intrinsic padding should know about
its very existence, the rest of the code shouldn't have to special case for it.
There is one exception: the getComputedStyle logic needs the opposite value
rendering needs. To handle that, we make it more explicit what returns the
computed values vs the rendering values.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::sizingBox):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
Updated those functions to use the new computedCSS* functions below.

* rendering/RenderBox.h:
(RenderBox):
(WebCore::RenderBox::computedCSSContentBoxRect):
This is the computed content box. It includes the intrinsic padding.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computedCSSPaddingTop):
(WebCore::RenderBoxModelObject::computedCSSPaddingBottom):
(WebCore::RenderBoxModelObject::computedCSSPaddingLeft):
(WebCore::RenderBoxModelObject::computedCSSPaddingRight):
(WebCore::RenderBoxModelObject::computedCSSPaddingBefore):
(WebCore::RenderBoxModelObject::computedCSSPaddingAfter):
(WebCore::RenderBoxModelObject::computedCSSPaddingStart):
(WebCore::RenderBoxModelObject::computedCSSPaddingEnd):
Renamed from padding* as they returned the CSS computed values.

* rendering/RenderBoxModelObject.h:
(RenderBoxModelObject):
Killed the enum paddingOptions!

(WebCore::RenderBoxModelObject::paddingTop):
(WebCore::RenderBoxModelObject::paddingBottom):
(WebCore::RenderBoxModelObject::paddingLeft):
(WebCore::RenderBoxModelObject::paddingRight):
(WebCore::RenderBoxModelObject::paddingBefore):
(WebCore::RenderBoxModelObject::paddingAfter):
(WebCore::RenderBoxModelObject::paddingStart):
(WebCore::RenderBoxModelObject::paddingEnd):
All padding* functions call the computedCSSPadding* ones above.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paddingTop):
(WebCore::RenderTableCell::paddingBottom):
(WebCore::RenderTableCell::paddingLeft):
(WebCore::RenderTableCell::paddingRight):
(WebCore::RenderTableCell::paddingBefore):
(WebCore::RenderTableCell::paddingAfter):
Updated these functions after the renaming.

* rendering/RenderTableCell.h:
(RenderTableCell):
Updated the functions signature and decorated them with OVERRIDE.

* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::paddingTop):
(WebCore::RenderMathMLBlock::paddingBottom):
(WebCore::RenderMathMLBlock::paddingLeft):
(WebCore::RenderMathMLBlock::paddingRight):
(WebCore::RenderMathMLBlock::paddingBefore):
(WebCore::RenderMathMLBlock::paddingAfter):
(WebCore::RenderMathMLBlock::paddingStart):
(WebCore::RenderMathMLBlock::paddingEnd):
* rendering/mathml/RenderMathMLBlock.h:
(RenderMathMLBlock):
Updated these functions after the renaming.

* rendering/mathml/RenderMathMLSquareRoot.cpp:
(WebCore::RenderMathMLSquareRoot::paint):
Updated this function to use computeCSSContentBoxRect.location().

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h
Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
Source/WebCore/rendering/mathml/RenderMathMLBlock.h
Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp

index 2cae4c2..410dbb8 100644 (file)
@@ -1,3 +1,86 @@
+2012-04-10  Julien Chaffraix  <jchaffraix@webkit.org>
+
+        Don't expose the intrinsic padding concept to the code outside rendering
+        https://bugs.webkit.org/show_bug.cgi?id=83380
+
+        Reviewed by Eric Seidel.
+
+        No new tests, refactoring only.
+
+        The current code would expose the concept of intrinsic padding to every
+        object holding a renderer through an enum on the padding* functions.
+
+        This was very fragile as only the class using intrinsic padding should know about
+        its very existence, the rest of the code shouldn't have to special case for it.
+        There is one exception: the getComputedStyle logic needs the opposite value
+        rendering needs. To handle that, we make it more explicit what returns the
+        computed values vs the rendering values.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::sizingBox):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        Updated those functions to use the new computedCSS* functions below.
+
+        * rendering/RenderBox.h:
+        (RenderBox):
+        (WebCore::RenderBox::computedCSSContentBoxRect):
+        This is the computed content box. It includes the intrinsic padding.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::computedCSSPaddingTop):
+        (WebCore::RenderBoxModelObject::computedCSSPaddingBottom):
+        (WebCore::RenderBoxModelObject::computedCSSPaddingLeft):
+        (WebCore::RenderBoxModelObject::computedCSSPaddingRight):
+        (WebCore::RenderBoxModelObject::computedCSSPaddingBefore):
+        (WebCore::RenderBoxModelObject::computedCSSPaddingAfter):
+        (WebCore::RenderBoxModelObject::computedCSSPaddingStart):
+        (WebCore::RenderBoxModelObject::computedCSSPaddingEnd):
+        Renamed from padding* as they returned the CSS computed values.
+
+        * rendering/RenderBoxModelObject.h:
+        (RenderBoxModelObject):
+        Killed the enum paddingOptions!
+
+        (WebCore::RenderBoxModelObject::paddingTop):
+        (WebCore::RenderBoxModelObject::paddingBottom):
+        (WebCore::RenderBoxModelObject::paddingLeft):
+        (WebCore::RenderBoxModelObject::paddingRight):
+        (WebCore::RenderBoxModelObject::paddingBefore):
+        (WebCore::RenderBoxModelObject::paddingAfter):
+        (WebCore::RenderBoxModelObject::paddingStart):
+        (WebCore::RenderBoxModelObject::paddingEnd):
+        All padding* functions call the computedCSSPadding* ones above.
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paddingTop):
+        (WebCore::RenderTableCell::paddingBottom):
+        (WebCore::RenderTableCell::paddingLeft):
+        (WebCore::RenderTableCell::paddingRight):
+        (WebCore::RenderTableCell::paddingBefore):
+        (WebCore::RenderTableCell::paddingAfter):
+        Updated these functions after the renaming.
+
+        * rendering/RenderTableCell.h:
+        (RenderTableCell):
+        Updated the functions signature and decorated them with OVERRIDE.
+
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        (WebCore::RenderMathMLBlock::paddingTop):
+        (WebCore::RenderMathMLBlock::paddingBottom):
+        (WebCore::RenderMathMLBlock::paddingLeft):
+        (WebCore::RenderMathMLBlock::paddingRight):
+        (WebCore::RenderMathMLBlock::paddingBefore):
+        (WebCore::RenderMathMLBlock::paddingAfter):
+        (WebCore::RenderMathMLBlock::paddingStart):
+        (WebCore::RenderMathMLBlock::paddingEnd):
+        * rendering/mathml/RenderMathMLBlock.h:
+        (RenderMathMLBlock):
+        Updated these functions after the renaming.
+
+        * rendering/mathml/RenderMathMLSquareRoot.cpp:
+        (WebCore::RenderMathMLSquareRoot::paint):
+        Updated this function to use computeCSSContentBoxRect.location().
+
 2012-04-10  Lauro Neto  <lauro.neto@openbossa.org>
 
         TextureMapperGL.cpp breaks build with OpenGL ES
index 5291d7b..dde2ac7 100644 (file)
@@ -669,13 +669,7 @@ static LayoutRect sizingBox(RenderObject* renderer)
         return LayoutRect();
 
     RenderBox* box = toRenderBox(renderer);
-    if (box->style()->boxSizing() == BORDER_BOX)
-        return box->borderBoxRect();
-    LayoutUnit cssPaddingLeft = box->paddingLeft(ExcludeIntrinsicPadding);
-    LayoutUnit cssPaddingTop = box->paddingTop(ExcludeIntrinsicPadding);
-    LayoutUnit cssWidth = box->clientWidth() - cssPaddingLeft - box->paddingRight(ExcludeIntrinsicPadding);
-    LayoutUnit cssHeight = box->clientHeight() - cssPaddingTop - box->paddingBottom(ExcludeIntrinsicPadding);
-    return LayoutRect(box->borderLeft() + cssPaddingLeft, box->borderTop() + cssPaddingTop, cssWidth, cssHeight);
+    return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect();
 }
 
 static inline bool hasCompositedLayer(RenderObject* renderer)
@@ -1861,19 +1855,19 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
             return cssValuePool().createValue(style->overflowY());
         case CSSPropertyPaddingTop:
             if (renderer && renderer->isBox())
-                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(ExcludeIntrinsicPadding), style.get());
+                return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingTop(), style.get());
             return zoomAdjustedPixelValueForLength(style->paddingTop(), style.get());
         case CSSPropertyPaddingRight:
             if (renderer && renderer->isBox())
-                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(ExcludeIntrinsicPadding), style.get());
+                return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingRight(), style.get());
             return zoomAdjustedPixelValueForLength(style->paddingRight(), style.get());
         case CSSPropertyPaddingBottom:
             if (renderer && renderer->isBox())
-                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(ExcludeIntrinsicPadding), style.get());
+                return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingBottom(), style.get());
             return zoomAdjustedPixelValueForLength(style->paddingBottom(), style.get());
         case CSSPropertyPaddingLeft:
             if (renderer && renderer->isBox())
-                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(ExcludeIntrinsicPadding), style.get());
+                return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPaddingLeft(), style.get());
             return zoomAdjustedPixelValueForLength(style->paddingLeft(), style.get());
         case CSSPropertyPageBreakAfter:
             return cssValuePool().createValue(style->pageBreakAfter());
index 01b7389..712bba7 100644 (file)
@@ -136,13 +136,17 @@ public:
     IntRect borderBoxRect() const { return IntRect(IntPoint(), IntSize(m_frameRect.pixelSnappedWidth(), m_frameRect.pixelSnappedHeight())); }
     virtual IntRect borderBoundingBox() const { return borderBoxRect(); } 
 
-    // The content area of the box (excludes padding and border).
+    // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border).
     LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
     // The content box in absolute coords. Ignores transforms.
     IntRect absoluteContentBox() const;
     // The content box converted to absolute coords (taking transforms into account).
     FloatQuad absoluteContentQuad() const;
 
+    // This returns the content area of the box (excluding padding and border). The only difference with contentBoxRect is that computedCSSContentBoxRect
+    // does include the intrinsic padding in the content box as this is what some callers expect (like getComputedStyle).
+    LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft() + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth() - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - computedCSSPaddingTop() - computedCSSPaddingBottom()); }
+
     // Bounds of the outline box in absolute coords. Respects transforms
     virtual LayoutRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, LayoutPoint* cachedOffsetToRepaintContainer) const;
     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&);
index d60fe18..4b3b8b7 100644 (file)
@@ -555,7 +555,7 @@ int RenderBoxModelObject::pixelSnappedOffsetHeight() const
     return snapSizeToPixel(offsetHeight(), offsetTop());
 }
 
-LayoutUnit RenderBoxModelObject::paddingTop(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingTop() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
@@ -567,7 +567,7 @@ LayoutUnit RenderBoxModelObject::paddingTop(PaddingOptions) const
     return minimumValueForLength(padding, w, renderView);
 }
 
-LayoutUnit RenderBoxModelObject::paddingBottom(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingBottom() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
@@ -579,7 +579,7 @@ LayoutUnit RenderBoxModelObject::paddingBottom(PaddingOptions) const
     return minimumValueForLength(padding, w, renderView);
 }
 
-LayoutUnit RenderBoxModelObject::paddingLeft(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingLeft() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
@@ -591,7 +591,7 @@ LayoutUnit RenderBoxModelObject::paddingLeft(PaddingOptions) const
     return minimumValueForLength(padding, w, renderView);
 }
 
-LayoutUnit RenderBoxModelObject::paddingRight(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingRight() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
@@ -603,7 +603,7 @@ LayoutUnit RenderBoxModelObject::paddingRight(PaddingOptions) const
     return minimumValueForLength(padding, w, renderView);
 }
 
-LayoutUnit RenderBoxModelObject::paddingBefore(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingBefore() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
@@ -615,7 +615,7 @@ LayoutUnit RenderBoxModelObject::paddingBefore(PaddingOptions) const
     return minimumValueForLength(padding, w, renderView);
 }
 
-LayoutUnit RenderBoxModelObject::paddingAfter(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingAfter() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
@@ -627,7 +627,7 @@ LayoutUnit RenderBoxModelObject::paddingAfter(PaddingOptions) const
     return minimumValueForLength(padding, w, renderView);
 }
 
-LayoutUnit RenderBoxModelObject::paddingStart(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingStart() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
@@ -639,7 +639,7 @@ LayoutUnit RenderBoxModelObject::paddingStart(PaddingOptions) const
     return minimumValueForLength(padding, w, renderView);
 }
 
-LayoutUnit RenderBoxModelObject::paddingEnd(PaddingOptions) const
+LayoutUnit RenderBoxModelObject::computedCSSPaddingEnd() const
 {
     LayoutUnit w = 0;
     RenderView* renderView = 0;
index f14d055..6581bb9 100644 (file)
@@ -40,8 +40,6 @@ enum BackgroundBleedAvoidance {
     BackgroundBleedUseTransparencyLayer
 };
 
-enum PaddingOptions { IncludeIntrinsicPadding, ExcludeIntrinsicPadding };
-
 // This class is the base for all objects that adhere to the CSS box model as described
 // at http://www.w3.org/TR/CSS21/box.html
 
@@ -79,15 +77,26 @@ public:
     // This will work on inlines to return the bounding box of all of the lines' border boxes.
     virtual IntRect borderBoundingBox() const = 0;
 
-    // Virtual since table cells and some MathML renderers override
-    virtual LayoutUnit paddingTop(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingBottom(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingLeft(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingRight(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingBefore(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingAfter(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingStart(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingEnd(PaddingOptions = IncludeIntrinsicPadding) const;
+    // These return the CSS computed padding values.
+    LayoutUnit computedCSSPaddingTop() const;
+    LayoutUnit computedCSSPaddingBottom() const;
+    LayoutUnit computedCSSPaddingLeft() const;
+    LayoutUnit computedCSSPaddingRight() const;
+    LayoutUnit computedCSSPaddingBefore() const;
+    LayoutUnit computedCSSPaddingAfter() const;
+    LayoutUnit computedCSSPaddingStart() const;
+    LayoutUnit computedCSSPaddingEnd() const;
+
+    // These functions are used during layout. Table cells and the MathML
+    // code override them to include some extra intrinsic padding.
+    virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); }
+    virtual LayoutUnit paddingBottom() const { return computedCSSPaddingBottom(); }
+    virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); }
+    virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight(); }
+    virtual LayoutUnit paddingBefore() const { return computedCSSPaddingBefore(); }
+    virtual LayoutUnit paddingAfter() const { return computedCSSPaddingAfter(); }
+    virtual LayoutUnit paddingStart() const { return computedCSSPaddingStart(); }
+    virtual LayoutUnit paddingEnd() const { return computedCSSPaddingEnd(); }
 
     virtual int borderTop() const { return style()->borderTopWidth(); }
     virtual int borderBottom() const { return style()->borderBottomWidth(); }
index c12d255..b56e8d8 100644 (file)
@@ -191,53 +191,47 @@ void RenderTableCell::layout()
     setCellWidthChanged(false);
 }
 
-LayoutUnit RenderTableCell::paddingTop(PaddingOptions paddingOption) const
+LayoutUnit RenderTableCell::paddingTop() const
 {
-    LayoutUnit result = RenderBlock::paddingTop();
-    if (paddingOption == ExcludeIntrinsicPadding || !isHorizontalWritingMode())
+    LayoutUnit result = computedCSSPaddingTop();
+    if (!isHorizontalWritingMode())
         return result;
     return result + (style()->writingMode() == TopToBottomWritingMode ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
 }
 
-LayoutUnit RenderTableCell::paddingBottom(PaddingOptions paddingOption) const
+LayoutUnit RenderTableCell::paddingBottom() const
 {
-    LayoutUnit result = RenderBlock::paddingBottom();
-    if (paddingOption == ExcludeIntrinsicPadding || !isHorizontalWritingMode())
+    LayoutUnit result = computedCSSPaddingBottom();
+    if (!isHorizontalWritingMode())
         return result;
     return result + (style()->writingMode() == TopToBottomWritingMode ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
 }
 
-LayoutUnit RenderTableCell::paddingLeft(PaddingOptions paddingOption) const
+LayoutUnit RenderTableCell::paddingLeft() const
 {
-    LayoutUnit result = RenderBlock::paddingLeft();
-    if (paddingOption == ExcludeIntrinsicPadding || isHorizontalWritingMode())
+    LayoutUnit result = computedCSSPaddingLeft();
+    if (isHorizontalWritingMode())
         return result;
     return result + (style()->writingMode() == LeftToRightWritingMode ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
     
 }
 
-LayoutUnit RenderTableCell::paddingRight(PaddingOptions paddingOption) const
+LayoutUnit RenderTableCell::paddingRight() const
 {   
-    LayoutUnit result = RenderBlock::paddingRight();
-    if (paddingOption == ExcludeIntrinsicPadding || isHorizontalWritingMode())
+    LayoutUnit result = computedCSSPaddingRight();
+    if (isHorizontalWritingMode())
         return result;
     return result + (style()->writingMode() == LeftToRightWritingMode ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
 }
 
-LayoutUnit RenderTableCell::paddingBefore(PaddingOptions paddingOption) const
+LayoutUnit RenderTableCell::paddingBefore() const
 {
-    LayoutUnit result = RenderBlock::paddingBefore();
-    if (paddingOption == ExcludeIntrinsicPadding)
-        return result;
-    return result + intrinsicPaddingBefore();
+    return computedCSSPaddingBefore() + intrinsicPaddingBefore();
 }
 
-LayoutUnit RenderTableCell::paddingAfter(PaddingOptions paddingOption) const
+LayoutUnit RenderTableCell::paddingAfter() const
 {
-    LayoutUnit result = RenderBlock::paddingAfter();
-    if (paddingOption == ExcludeIntrinsicPadding)
-        return result;
-    return result + intrinsicPaddingAfter();
+    return computedCSSPaddingAfter() + intrinsicPaddingAfter();
 }
 
 void RenderTableCell::setOverrideHeightFromRowHeight(LayoutUnit rowHeight)
index 51e9bf6..06a2774 100644 (file)
@@ -120,16 +120,16 @@ public:
     int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; }
     int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; }
 
-    virtual LayoutUnit paddingTop(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingBottom(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingLeft(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingRight(PaddingOptions = IncludeIntrinsicPadding) const;
+    virtual LayoutUnit paddingTop() const OVERRIDE;
+    virtual LayoutUnit paddingBottom() const OVERRIDE;
+    virtual LayoutUnit paddingLeft() const OVERRIDE;
+    virtual LayoutUnit paddingRight() const OVERRIDE;
     
     // FIXME: For now we just assume the cell has the same block flow direction as the table.  It's likely we'll
     // create an extra anonymous RenderBlock to handle mixing directionality anyway, in which case we can lock
     // the block flow directionality of the cells to the table's directionality.
-    virtual LayoutUnit paddingBefore(PaddingOptions = IncludeIntrinsicPadding) const;
-    virtual LayoutUnit paddingAfter(PaddingOptions = IncludeIntrinsicPadding) const;
+    virtual LayoutUnit paddingBefore() const OVERRIDE;
+    virtual LayoutUnit paddingAfter() const OVERRIDE;
 
     void setOverrideHeightFromRowHeight(LayoutUnit);
 
index dcb3ba1..bd6704f 100644 (file)
@@ -54,11 +54,9 @@ bool RenderMathMLBlock::isChildAllowed(RenderObject* child, RenderStyle*) const
     return child->node() && child->node()->nodeType() == Node::ELEMENT_NODE;
 }
 
-LayoutUnit RenderMathMLBlock::paddingTop(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingTop() const
 {
-    LayoutUnit result = RenderBlock::paddingTop(ExcludeIntrinsicPadding);
-    if (paddingOption == ExcludeIntrinsicPadding)
-        return result;
+    LayoutUnit result = computedCSSPaddingTop();
     switch (style()->writingMode()) {
     case TopToBottomWritingMode:
         return result + m_intrinsicPaddingBefore;
@@ -72,11 +70,9 @@ LayoutUnit RenderMathMLBlock::paddingTop(PaddingOptions paddingOption) const
     return result;
 }
 
-LayoutUnit RenderMathMLBlock::paddingBottom(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingBottom() const
 {
-    LayoutUnit result = RenderBlock::paddingBottom(ExcludeIntrinsicPadding);
-    if (paddingOption == ExcludeIntrinsicPadding)
-        return result;
+    LayoutUnit result = computedCSSPaddingBottom();
     switch (style()->writingMode()) {
     case TopToBottomWritingMode:
         return result + m_intrinsicPaddingAfter;
@@ -90,11 +86,9 @@ LayoutUnit RenderMathMLBlock::paddingBottom(PaddingOptions paddingOption) const
     return result;
 }
 
-LayoutUnit RenderMathMLBlock::paddingLeft(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingLeft() const
 {
-    LayoutUnit result = RenderBlock::paddingLeft(ExcludeIntrinsicPadding);
-    if (paddingOption == ExcludeIntrinsicPadding)
-        return result;
+    LayoutUnit result = computedCSSPaddingLeft();
     switch (style()->writingMode()) {
     case LeftToRightWritingMode:
         return result + m_intrinsicPaddingBefore;
@@ -108,11 +102,9 @@ LayoutUnit RenderMathMLBlock::paddingLeft(PaddingOptions paddingOption) const
     return result;
 }
 
-LayoutUnit RenderMathMLBlock::paddingRight(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingRight() const
 {
-    LayoutUnit result = RenderBlock::paddingRight(ExcludeIntrinsicPadding);
-    if (paddingOption == ExcludeIntrinsicPadding)
-        return result;
+    LayoutUnit result = computedCSSPaddingRight();
     switch (style()->writingMode()) {
     case RightToLeftWritingMode:
         return result + m_intrinsicPaddingBefore;
@@ -126,24 +118,24 @@ LayoutUnit RenderMathMLBlock::paddingRight(PaddingOptions paddingOption) const
     return result;
 }
 
-LayoutUnit RenderMathMLBlock::paddingBefore(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingBefore() const
 {
-    return RenderBlock::paddingBefore(ExcludeIntrinsicPadding) + (paddingOption == IncludeIntrinsicPadding ? m_intrinsicPaddingBefore : 0);
+    return computedCSSPaddingBefore() + m_intrinsicPaddingBefore;
 }
 
-LayoutUnit RenderMathMLBlock::paddingAfter(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingAfter() const
 {
-    return RenderBlock::paddingAfter(ExcludeIntrinsicPadding) + (paddingOption == IncludeIntrinsicPadding ? m_intrinsicPaddingAfter : 0);
+    return computedCSSPaddingAfter() + m_intrinsicPaddingAfter;
 }
 
-LayoutUnit RenderMathMLBlock::paddingStart(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingStart() const
 {
-    return RenderBlock::paddingStart(ExcludeIntrinsicPadding) + (paddingOption == IncludeIntrinsicPadding ? m_intrinsicPaddingStart : 0);
+    return computedCSSPaddingStart() + m_intrinsicPaddingStart;
 }
 
-LayoutUnit RenderMathMLBlock::paddingEnd(PaddingOptions paddingOption) const
+LayoutUnit RenderMathMLBlock::paddingEnd() const
 {
-    return RenderBlock::paddingEnd(ExcludeIntrinsicPadding) + (paddingOption == IncludeIntrinsicPadding ? m_intrinsicPaddingEnd : 0);
+    return computedCSSPaddingEnd() + m_intrinsicPaddingEnd;
 }
 
 RenderMathMLBlock* RenderMathMLBlock::createAlmostAnonymousBlock(EDisplay display)
index c2fc327..1dc3fc8 100644 (file)
@@ -56,14 +56,14 @@ public:
     virtual RenderMathMLOperator* unembellishedOperator() { return 0; }
     virtual void stretchToHeight(int height);
 
-    virtual LayoutUnit paddingTop(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
-    virtual LayoutUnit paddingBottom(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
-    virtual LayoutUnit paddingLeft(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
-    virtual LayoutUnit paddingRight(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
-    virtual LayoutUnit paddingBefore(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
-    virtual LayoutUnit paddingAfter(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
-    virtual LayoutUnit paddingStart(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
-    virtual LayoutUnit paddingEnd(PaddingOptions = IncludeIntrinsicPadding) const OVERRIDE;
+    virtual LayoutUnit paddingTop() const OVERRIDE;
+    virtual LayoutUnit paddingBottom() const OVERRIDE;
+    virtual LayoutUnit paddingLeft() const OVERRIDE;
+    virtual LayoutUnit paddingRight() const OVERRIDE;
+    virtual LayoutUnit paddingBefore() const OVERRIDE;
+    virtual LayoutUnit paddingAfter() const OVERRIDE;
+    virtual LayoutUnit paddingStart() const OVERRIDE;
+    virtual LayoutUnit paddingEnd() const OVERRIDE;
     
 #if ENABLE(DEBUG_MATH_LAYOUT)
     virtual void paint(PaintInfo&, const LayoutPoint&);
index 0c7359f..b040f88 100644 (file)
@@ -116,9 +116,8 @@ void RenderMathMLSquareRoot::paint(PaintInfo& info, const LayoutPoint& paintOffs
     
     if (info.context->paintingDisabled())
         return;
-    
-    LayoutSize cssContentLeftTop(borderLeft() + paddingLeft(ExcludeIntrinsicPadding), borderTop() + paddingTop(ExcludeIntrinsicPadding));
-    IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + cssContentLeftTop);
+
+    IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + computedCSSContentBoxRect().location());
     
     int baseHeight = roundToInt(getBoxModelObjectHeight(firstChild()));
     int overbarWidth = roundToInt(getBoxModelObjectWidth(firstChild()));