Diff
Modified: trunk/Source/WebCore/ChangeLog (89976 => 89977)
--- trunk/Source/WebCore/ChangeLog 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/ChangeLog 2011-06-28 23:56:01 UTC (rev 89977)
@@ -1,3 +1,23 @@
+2011-06-28 Emil A Eklund <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Switch RenderBox position/size to to new layout types
+ https://bugs.webkit.org/show_bug.cgi?id=63571
+
+ Switch location and size methods for RenderBox over to the new layout unit abstraction.
+
+ No new tests, no functionality changes.
+
+ * rendering/RenderBox.cpp:
+ * rendering/RenderBox.h:
+ * rendering/RenderBoxModelObject.cpp:
+ * rendering/RenderBoxModelObject.h:
+ * rendering/RenderInline.cpp:
+ * rendering/RenderInline.h:
+ * rendering/RenderVideo.cpp:
+ * rendering/RenderVideo.h:
+
2011-06-28 Sheriff Bot <[email protected]>
Unreviewed, rolling out r89968.
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2011-06-28 23:56:01 UTC (rev 89977)
@@ -403,12 +403,12 @@
// More IE extensions. clientWidth and clientHeight represent the interior of an object
// excluding border and scrollbar.
-int RenderBox::clientWidth() const
+LayoutUnit RenderBox::clientWidth() const
{
return width() - borderLeft() - borderRight() - verticalScrollbarWidth();
}
-int RenderBox::clientHeight() const
+LayoutUnit RenderBox::clientHeight() const
{
return height() - borderTop() - borderBottom() - horizontalScrollbarHeight();
}
@@ -714,30 +714,30 @@
return hasOverrideSize() ? overrideSize() : height();
}
-int RenderBox::computeBorderBoxLogicalWidth(int width) const
+LayoutUnit RenderBox::computeBorderBoxLogicalWidth(LayoutUnit width) const
{
- int bordersPlusPadding = borderAndPaddingLogicalWidth();
+ LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth();
if (style()->boxSizing() == CONTENT_BOX)
return width + bordersPlusPadding;
return max(width, bordersPlusPadding);
}
-int RenderBox::computeBorderBoxLogicalHeight(int height) const
+LayoutUnit RenderBox::computeBorderBoxLogicalHeight(LayoutUnit height) const
{
- int bordersPlusPadding = borderAndPaddingLogicalHeight();
+ LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight();
if (style()->boxSizing() == CONTENT_BOX)
return height + bordersPlusPadding;
return max(height, bordersPlusPadding);
}
-int RenderBox::computeContentBoxLogicalWidth(int width) const
+LayoutUnit RenderBox::computeContentBoxLogicalWidth(LayoutUnit width) const
{
if (style()->boxSizing() == BORDER_BOX)
width -= borderAndPaddingLogicalWidth();
return max(0, width);
}
-int RenderBox::computeContentBoxLogicalHeight(int height) const
+LayoutUnit RenderBox::computeContentBoxLogicalHeight(LayoutUnit height) const
{
if (style()->boxSizing() == BORDER_BOX)
height -= borderAndPaddingLogicalHeight();
Modified: trunk/Source/WebCore/rendering/RenderBox.h (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderBox.h 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2011-06-28 23:56:01 UTC (rev 89977)
@@ -44,59 +44,59 @@
RenderBox* firstChildBox() const;
RenderBox* lastChildBox() const;
- int x() const { return m_frameRect.x(); }
- int y() const { return m_frameRect.y(); }
- int width() const { return m_frameRect.width(); }
- int height() const { return m_frameRect.height(); }
+ LayoutUnit x() const { return m_frameRect.x(); }
+ LayoutUnit y() const { return m_frameRect.y(); }
+ LayoutUnit width() const { return m_frameRect.width(); }
+ LayoutUnit height() const { return m_frameRect.height(); }
- void setX(int x) { m_frameRect.setX(x); }
- void setY(int y) { m_frameRect.setY(y); }
- void setWidth(int width) { m_frameRect.setWidth(width); }
- void setHeight(int height) { m_frameRect.setHeight(height); }
+ void setX(LayoutUnit x) { m_frameRect.setX(x); }
+ void setY(LayoutUnit y) { m_frameRect.setY(y); }
+ void setWidth(LayoutUnit width) { m_frameRect.setWidth(width); }
+ void setHeight(LayoutUnit height) { m_frameRect.setHeight(height); }
- int logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); }
- int logicalRight() const { return logicalLeft() + logicalWidth(); }
- int logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); }
- int logicalBottom() const { return logicalTop() + logicalHeight(); }
- int logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); }
- int logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); }
+ LayoutUnit logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); }
+ LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
+ LayoutUnit logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); }
+ LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); }
+ LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); }
+ LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); }
- void setLogicalLeft(int left)
+ void setLogicalLeft(LayoutUnit left)
{
if (style()->isHorizontalWritingMode())
setX(left);
else
setY(left);
}
- void setLogicalTop(int top)
+ void setLogicalTop(LayoutUnit top)
{
if (style()->isHorizontalWritingMode())
setY(top);
else
setX(top);
}
- void setLogicalLocation(const IntPoint& location)
+ void setLogicalLocation(const LayoutPoint& location)
{
if (style()->isHorizontalWritingMode())
setLocation(location);
else
setLocation(location.transposedPoint());
}
- void setLogicalWidth(int size)
+ void setLogicalWidth(LayoutUnit size)
{
if (style()->isHorizontalWritingMode())
setWidth(size);
else
setHeight(size);
}
- void setLogicalHeight(int size)
+ void setLogicalHeight(LayoutUnit size)
{
if (style()->isHorizontalWritingMode())
setHeight(size);
else
setWidth(size);
}
- void setLogicalSize(const IntSize& size)
+ void setLogicalSize(const LayoutSize& size)
{
if (style()->isHorizontalWritingMode())
setSize(size);
@@ -104,25 +104,25 @@
setSize(size.transposedSize());
}
- IntPoint location() const { return m_frameRect.location(); }
- IntSize locationOffset() const { return IntSize(x(), y()); }
- IntSize size() const { return m_frameRect.size(); }
+ LayoutPoint location() const { return m_frameRect.location(); }
+ LayoutSize locationOffset() const { return LayoutSize(x(), y()); }
+ LayoutSize size() const { return m_frameRect.size(); }
- void setLocation(const IntPoint& location) { m_frameRect.setLocation(location); }
+ void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(location); }
- void setSize(const IntSize& size) { m_frameRect.setSize(size); }
- void move(int dx, int dy) { m_frameRect.move(dx, dy); }
+ void setSize(const LayoutSize& size) { m_frameRect.setSize(size); }
+ void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); }
- IntRect frameRect() const { return m_frameRect; }
- void setFrameRect(const IntRect& rect) { m_frameRect = rect; }
+ LayoutRect frameRect() const { return m_frameRect; }
+ void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; }
- IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); }
- virtual IntRect borderBoundingBox() const { return borderBoxRect(); }
+ LayoutRect borderBoxRect() const { return LayoutRect(0, 0, width(), height()); }
+ virtual LayoutRect borderBoundingBox() const { return borderBoxRect(); }
// The content area of the box (excludes padding and border).
- IntRect contentBoxRect() const { return IntRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
+ LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
// The content box in absolute coords. Ignores transforms.
- IntRect absoluteContentBox() const;
+ LayoutRect absoluteContentBox() const;
// The content box converted to absolute coords (taking transforms into account).
FloatQuad absoluteContentQuad() const;
@@ -169,26 +169,26 @@
void blockDirectionOverflow(bool isLineHorizontal, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,
int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow);
- int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
- int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
- int contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
- int contentLogicalHeight() const { return style()->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
+ LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
+ LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
+ LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
+ LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
// IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
// to return the remaining width on a given line (and the height of a single line).
- virtual int offsetWidth() const { return width(); }
- virtual int offsetHeight() const { return height(); }
+ virtual LayoutUnit offsetWidth() const { return width(); }
+ virtual LayoutUnit offsetHeight() const { return height(); }
// More IE extensions. clientWidth and clientHeight represent the interior of an object
// excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth.
- int clientLeft() const { return borderLeft(); }
- int clientTop() const { return borderTop(); }
- int clientWidth() const;
- int clientHeight() const;
- int clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); }
- int clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); }
- int clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); }
- IntRect clientBoxRect() const { return IntRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); }
+ LayoutUnit clientLeft() const { return borderLeft(); }
+ LayoutUnit clientTop() const { return borderTop(); }
+ LayoutUnit clientWidth() const;
+ LayoutUnit clientHeight() const;
+ LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); }
+ LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); }
+ LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); }
+ LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); }
// scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the
// object has overflow:hidden/scroll/auto specified and also has overflow.
@@ -254,10 +254,10 @@
virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
- int computeBorderBoxLogicalWidth(int width) const;
- int computeBorderBoxLogicalHeight(int height) const;
- int computeContentBoxLogicalWidth(int width) const;
- int computeContentBoxLogicalHeight(int height) const;
+ LayoutUnit computeBorderBoxLogicalWidth(LayoutUnit width) const;
+ LayoutUnit computeBorderBoxLogicalHeight(LayoutUnit height) const;
+ LayoutUnit computeContentBoxLogicalWidth(LayoutUnit width) const;
+ LayoutUnit computeContentBoxLogicalHeight(LayoutUnit height) const;
virtual void borderFitAdjust(IntRect&) const { } // Shrink the box in which the border paints if border-fit is set.
@@ -467,7 +467,7 @@
private:
// The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent).
- IntRect m_frameRect;
+ LayoutRect m_frameRect;
protected:
int m_marginLeft;
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2011-06-28 23:56:01 UTC (rev 89977)
@@ -380,7 +380,7 @@
setHorizontalWritingMode(style()->isHorizontalWritingMode());
}
-int RenderBoxModelObject::relativePositionOffsetX() const
+LayoutUnit RenderBoxModelObject::relativePositionOffsetX() const
{
// Objects that shrink to avoid floats normally use available line width when computing containing block width. However
// in the case of relative positioning using percentages, we can't do this. The offset should always be resolved using the
@@ -399,7 +399,7 @@
return 0;
}
-int RenderBoxModelObject::relativePositionOffsetY() const
+LayoutUnit RenderBoxModelObject::relativePositionOffsetY() const
{
RenderBlock* containingBlock = this->containingBlock();
@@ -424,7 +424,7 @@
return 0;
}
-int RenderBoxModelObject::offsetLeft() const
+LayoutUnit RenderBoxModelObject::offsetLeft() const
{
// If the element is the HTML body element or does not have an associated box
// return 0 and stop this algorithm.
@@ -432,7 +432,7 @@
return 0;
RenderBoxModelObject* offsetPar = offsetParent();
- int xPos = (isBox() ? toRenderBox(this)->x() : 0);
+ LayoutUnit xPos = (isBox() ? toRenderBox(this)->x() : 0);
// If the offsetParent of the element is null, or is the HTML body element,
// return the distance between the canvas origin and the left border edge
@@ -458,7 +458,7 @@
return xPos;
}
-int RenderBoxModelObject::offsetTop() const
+LayoutUnit RenderBoxModelObject::offsetTop() const
{
// If the element is the HTML body element or does not have an associated box
// return 0 and stop this algorithm.
@@ -466,7 +466,7 @@
return 0;
RenderBoxModelObject* offsetPar = offsetParent();
- int yPos = (isBox() ? toRenderBox(this)->y() : 0);
+ LayoutUnit yPos = (isBox() ? toRenderBox(this)->y() : 0);
// If the offsetParent of the element is null, or is the HTML body element,
// return the distance between the canvas origin and the top border edge
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2011-06-28 23:56:01 UTC (rev 89977)
@@ -50,17 +50,17 @@
virtual void destroy();
- int relativePositionOffsetX() const;
- int relativePositionOffsetY() const;
- IntSize relativePositionOffset() const { return IntSize(relativePositionOffsetX(), relativePositionOffsetY()); }
- IntSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); }
+ LayoutUnit relativePositionOffsetX() const;
+ LayoutUnit relativePositionOffsetY() const;
+ LayoutSize relativePositionOffset() const { return LayoutSize(relativePositionOffsetX(), relativePositionOffsetY()); }
+ LayoutSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); }
// IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
// to return the remaining width on a given line (and the height of a single line).
- virtual int offsetLeft() const;
- virtual int offsetTop() const;
- virtual int offsetWidth() const = 0;
- virtual int offsetHeight() const = 0;
+ virtual LayoutUnit offsetLeft() const;
+ virtual LayoutUnit offsetTop() const;
+ virtual LayoutUnit offsetWidth() const = 0;
+ virtual LayoutUnit offsetHeight() const = 0;
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
@@ -71,7 +71,7 @@
virtual bool requiresLayer() const { return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection() || style()->specifiesColumns(); }
// This will work on inlines to return the bounding box of all of the lines' border boxes.
- virtual IntRect borderBoundingBox() const = 0;
+ virtual LayoutRect borderBoundingBox() const = 0;
// Virtual since table cells override
virtual int paddingTop(bool includeIntrinsicPadding = true) const;
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2011-06-28 23:56:01 UTC (rev 89977)
@@ -631,17 +631,17 @@
}
}
-int RenderInline::offsetLeft() const
+LayoutUnit RenderInline::offsetLeft() const
{
- int x = RenderBoxModelObject::offsetLeft();
+ LayoutUnit x = RenderBoxModelObject::offsetLeft();
if (InlineBox* firstBox = firstLineBoxIncludingCulling())
x += firstBox->x();
return x;
}
-int RenderInline::offsetTop() const
+LayoutUnit RenderInline::offsetTop() const
{
- int y = RenderBoxModelObject::offsetTop();
+ LayoutUnit y = RenderBoxModelObject::offsetTop();
if (InlineBox* firstBox = firstLineBoxIncludingCulling())
y += firstBox->y();
return y;
Modified: trunk/Source/WebCore/rendering/RenderInline.h (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderInline.h 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2011-06-28 23:56:01 UTC (rev 89977)
@@ -121,10 +121,10 @@
virtual bool requiresLayer() const { return isRelPositioned() || isTransparent() || hasMask(); }
- virtual int offsetLeft() const;
- virtual int offsetTop() const;
- virtual int offsetWidth() const { return linesBoundingBox().width(); }
- virtual int offsetHeight() const { return linesBoundingBox().height(); }
+ virtual LayoutUnit offsetLeft() const;
+ virtual LayoutUnit offsetTop() const;
+ virtual LayoutUnit offsetWidth() const { return linesBoundingBox().width(); }
+ virtual LayoutUnit offsetHeight() const { return linesBoundingBox().height(); }
virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth);
@@ -135,10 +135,10 @@
virtual VisiblePosition positionForPoint(const IntPoint&);
- virtual IntRect borderBoundingBox() const
+ virtual LayoutRect borderBoundingBox() const
{
- IntRect boundingBox = linesBoundingBox();
- return IntRect(0, 0, boundingBox.width(), boundingBox.height());
+ LayoutRect boundingBox = linesBoundingBox();
+ return LayoutRect(0, 0, boundingBox.width(), boundingBox.height());
}
virtual InlineFlowBox* createInlineFlowBox(); // Subclassed by SVG and Ruby
Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderVideo.cpp 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp 2011-06-28 23:56:01 UTC (rev 89977)
@@ -300,28 +300,28 @@
return fullScreen->placeholder();
}
-int RenderVideo::offsetLeft() const
+LayoutUnit RenderVideo::offsetLeft() const
{
if (const RenderBlock* block = rendererPlaceholder(this))
return block->offsetLeft();
return RenderMedia::offsetLeft();
}
-int RenderVideo::offsetTop() const
+LayoutUnit RenderVideo::offsetTop() const
{
if (const RenderBlock* block = rendererPlaceholder(this))
return block->offsetTop();
return RenderMedia::offsetTop();
}
-int RenderVideo::offsetWidth() const
+LayoutUnit RenderVideo::offsetWidth() const
{
if (const RenderBlock* block = rendererPlaceholder(this))
return block->offsetWidth();
return RenderMedia::offsetWidth();
}
-int RenderVideo::offsetHeight() const
+LayoutUnit RenderVideo::offsetHeight() const
{
if (const RenderBlock* block = rendererPlaceholder(this))
return block->offsetHeight();
Modified: trunk/Source/WebCore/rendering/RenderVideo.h (89976 => 89977)
--- trunk/Source/WebCore/rendering/RenderVideo.h 2011-06-28 23:52:14 UTC (rev 89976)
+++ trunk/Source/WebCore/rendering/RenderVideo.h 2011-06-28 23:56:01 UTC (rev 89977)
@@ -75,10 +75,10 @@
virtual int minimumReplacedHeight() const;
#if ENABLE(FULLSCREEN_API)
- virtual int offsetLeft() const;
- virtual int offsetTop() const;
- virtual int offsetWidth() const;
- virtual int offsetHeight() const;
+ virtual LayoutUnit offsetLeft() const;
+ virtual LayoutUnit offsetTop() const;
+ virtual LayoutUnit offsetWidth() const;
+ virtual LayoutUnit offsetHeight() const;
#endif
void updatePlayer();