Diff
Modified: trunk/Source/WebCore/ChangeLog (122640 => 122641)
--- trunk/Source/WebCore/ChangeLog 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/ChangeLog 2012-07-13 23:23:40 UTC (rev 122641)
@@ -1,3 +1,62 @@
+2012-07-13 Emil A Eklund <[email protected]>
+
+ Use LayoutBoxExtent for image outsets
+ https://bugs.webkit.org/show_bug.cgi?id=91166
+
+ Reviewed by Tony Chang.
+
+ Change RenderStyle and calling code to use LayoutBoxExtent for image
+ outsets and remove text direction and writing mode versions of the
+ outline getters from RenderStyle as LayoutBoxExtent provides the same
+ functionality.
+
+ No new tests, no change in functionality.
+
+ * platform/graphics/FractionalLayoutBoxExtent.h:
+ * platform/graphics/FractionalLayoutBoxExtent.cpp:
+ (WebCore::FractionalLayoutBoxExtent::logicalTop):
+ (WebCore::FractionalLayoutBoxExtent::logicalBottom):
+ Add logicalTop and logicalBottom methods to go with the existing
+ logicalLeft and logicalRight ones.
+
+ * platform/graphics/FractionalLayoutRect.h:
+ (WebCore::FractionalLayoutRect::expand):
+ Add FractionalLayoutBoxExtent version of expand method.
+
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::addBorderOutsetVisualOverflow):
+ Change implementation to use the new FractionalLayoutBoxExtent version of
+ borderImageOutsets and the logicalTop/Bottom/Left/Right methods.
+
+ (WebCore::clipRectForNinePieceImageStrip):
+ Change implementation to use the new FractionalLayoutBoxExtent version of
+ borderImageOutsets.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::maskClipRect):
+ Change implementation to use the new FractionalLayoutBoxExtent version of
+ borderImageOutsets and the new FractionalLayoutRect::expand method.
+
+ (WebCore::RenderBox::addVisualEffectOverflow):
+ Change implementation to use the new FractionalLayoutBoxExtent version of
+ borderImageOutsets.
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintNinePieceImage):
+ Change implementation to use the new FractionalLayoutBoxExtent version of
+ borderImageOutsets and the new FractionalLayoutRect::expand method.
+
+ * rendering/style/RenderStyle.h:
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::imageOutsets):
+ Change getImageOutsets to return a FractionalLayoutBoxExtent object and
+ rename to imageOutsets to match the webkit naming convention for getters.
+
+ Remove getBorderImageHorizontalOutsets, getBorderImageVerticalOutsets,
+ getBorderImageInlineDirectionOutsets, getImageHorizontalOutsets,
+ getImageVerticalOutsets and getBorderImageBlockDirectionOutsets methods
+ as the same functionality is provided by FractionalLayoutBoxExtent.
+
2012-07-13 David Hyatt <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=91278
Modified: trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp (122640 => 122641)
--- trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp 2012-07-13 23:23:40 UTC (rev 122641)
@@ -35,6 +35,16 @@
namespace WebCore {
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const
+{
+ return style->isHorizontalWritingMode() ? m_top : m_left;
+}
+
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const
+{
+ return style->isHorizontalWritingMode() ? m_bottom : m_right;
+}
+
FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const
{
return style->isHorizontalWritingMode() ? m_left : m_top;
Modified: trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h (122640 => 122641)
--- trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h 2012-07-13 23:23:40 UTC (rev 122641)
@@ -53,6 +53,8 @@
inline void setBottom(FractionalLayoutUnit value) { m_bottom = value; }
inline void setLeft(FractionalLayoutUnit value) { m_left = value; }
+ FractionalLayoutUnit logicalTop(const RenderStyle*) const;
+ FractionalLayoutUnit logicalBottom(const RenderStyle*) const;
FractionalLayoutUnit logicalLeft(const RenderStyle*) const;
FractionalLayoutUnit logicalRight(const RenderStyle*) const;
Modified: trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h (122640 => 122641)
--- trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h 2012-07-13 23:23:40 UTC (rev 122641)
@@ -31,6 +31,7 @@
#ifndef FractionalLayoutRect_h
#define FractionalLayoutRect_h
+#include "FractionalLayoutBoxExtent.h"
#include "FractionalLayoutPoint.h"
#include "IntRect.h"
#include <wtf/Vector.h>
@@ -99,6 +100,11 @@
void move(FractionalLayoutUnit dx, FractionalLayoutUnit dy) { m_location.move(dx, dy); }
void expand(const FractionalLayoutSize& size) { m_size += size; }
+ void expand(const FractionalLayoutBoxExtent& box)
+ {
+ m_location.move(-box.left(), -box.top());
+ m_size.expand(box.left() + box.right(), box.top() + box.bottom());
+ }
void expand(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(dw, dh); }
void contract(const FractionalLayoutSize& size) { m_size -= size; }
void contract(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(-dw, -dh); }
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (122640 => 122641)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2012-07-13 23:23:40 UTC (rev 122641)
@@ -788,11 +788,14 @@
RenderStyle* style = renderer()->style(isFirstLineStyle());
if (!style->hasBorderImageOutsets())
return;
-
- LayoutUnit borderOutsetLogicalTop;
- LayoutUnit borderOutsetLogicalBottom;
- style->getBorderImageBlockDirectionOutsets(borderOutsetLogicalTop, borderOutsetLogicalBottom);
+ FractionalLayoutBoxExtent borderOutsets = style->borderImageOutsets();
+
+ LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style);
+ LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style);
+ LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style);
+ LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style);
+
// Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since
// the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes.
LayoutUnit outsetLogicalTop = style->isFlippedLinesWritingMode() ? borderOutsetLogicalBottom : borderOutsetLogicalTop;
@@ -800,10 +803,6 @@
LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() - outsetLogicalTop, logicalVisualOverflow.y());
LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY());
-
- LayoutUnit borderOutsetLogicalLeft;
- LayoutUnit borderOutsetLogicalRight;
- style->getBorderImageInlineDirectionOutsets(borderOutsetLogicalLeft, borderOutsetLogicalRight);
LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : ZERO_LAYOUT_UNIT;
LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : ZERO_LAYOUT_UNIT;
@@ -1187,29 +1186,25 @@
{
LayoutRect clipRect(paintRect);
RenderStyle* style = box->renderer()->style();
- LayoutUnit topOutset;
- LayoutUnit rightOutset;
- LayoutUnit bottomOutset;
- LayoutUnit leftOutset;
- style->getImageOutsets(image, topOutset, rightOutset, bottomOutset, leftOutset);
+ LayoutBoxExtent outsets = style->imageOutsets(image);
if (box->isHorizontal()) {
- clipRect.setY(paintRect.y() - topOutset);
- clipRect.setHeight(paintRect.height() + topOutset + bottomOutset);
+ clipRect.setY(paintRect.y() - outsets.top());
+ clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom());
if (box->includeLogicalLeftEdge()) {
- clipRect.setX(paintRect.x() - leftOutset);
- clipRect.setWidth(paintRect.width() + leftOutset);
+ clipRect.setX(paintRect.x() - outsets.left());
+ clipRect.setWidth(paintRect.width() + outsets.left());
}
if (box->includeLogicalRightEdge())
- clipRect.setWidth(clipRect.width() + rightOutset);
+ clipRect.setWidth(clipRect.width() + outsets.right());
} else {
- clipRect.setX(paintRect.x() - leftOutset);
- clipRect.setWidth(paintRect.width() + leftOutset + rightOutset);
+ clipRect.setX(paintRect.x() - outsets.left());
+ clipRect.setWidth(paintRect.width() + outsets.left() + outsets.right());
if (box->includeLogicalLeftEdge()) {
- clipRect.setY(paintRect.y() - topOutset);
- clipRect.setHeight(paintRect.height() + topOutset);
+ clipRect.setY(paintRect.y() - outsets.top());
+ clipRect.setHeight(paintRect.height() + outsets.top());
}
if (box->includeLogicalRightEdge())
- clipRect.setHeight(clipRect.height() + bottomOutset);
+ clipRect.setHeight(clipRect.height() + outsets.bottom());
}
return clipRect;
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (122640 => 122641)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2012-07-13 23:23:40 UTC (rev 122641)
@@ -934,17 +934,7 @@
LayoutRect borderImageRect = borderBoxRect();
// Apply outsets to the border box.
- LayoutUnit topOutset;
- LayoutUnit rightOutset;
- LayoutUnit bottomOutset;
- LayoutUnit leftOutset;
- style()->getMaskBoxImageOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
-
- borderImageRect.setX(borderImageRect.x() - leftOutset);
- borderImageRect.setY(borderImageRect.y() - topOutset);
- borderImageRect.setWidth(borderImageRect.width() + leftOutset + rightOutset);
- borderImageRect.setHeight(borderImageRect.height() + topOutset + bottomOutset);
-
+ borderImageRect.expand(style()->maskBoxImageOutsets());
return borderImageRect;
}
@@ -3585,18 +3575,14 @@
// Now compute border-image-outset overflow.
if (style()->hasBorderImageOutsets()) {
- LayoutUnit borderOutsetLeft;
- LayoutUnit borderOutsetRight;
- LayoutUnit borderOutsetTop;
- LayoutUnit borderOutsetBottom;
- style()->getBorderImageOutsets(borderOutsetTop, borderOutsetRight, borderOutsetBottom, borderOutsetLeft);
+ LayoutBoxExtent borderOutsets = style()->borderImageOutsets();
// In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right
// border is at the lower x coordinate value.
- overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsetLeft : borderOutsetRight));
- overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsetRight : borderOutsetLeft));
- overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsetTop : borderOutsetBottom));
- overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsetBottom : borderOutsetTop));
+ overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsets.left() : borderOutsets.right()));
+ overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsets.right() : borderOutsets.left()));
+ overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsets.top() : borderOutsets.bottom()));
+ overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsets.bottom() : borderOutsets.top()));
}
// Add in the final overflow with shadows and outsets combined.
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (122640 => 122641)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-07-13 23:23:40 UTC (rev 122641)
@@ -1234,18 +1234,10 @@
// FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function
// doesn't have any understanding of the zoom that is in effect on the tile.
- LayoutUnit topOutset;
- LayoutUnit rightOutset;
- LayoutUnit bottomOutset;
- LayoutUnit leftOutset;
- style->getImageOutsets(ninePieceImage, topOutset, rightOutset, bottomOutset, leftOutset);
+ LayoutRect rectWithOutsets = rect;
+ rectWithOutsets.expand(style->imageOutsets(ninePieceImage));
+ IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets);
- LayoutUnit topWithOutset = rect.y() - topOutset;
- LayoutUnit bottomWithOutset = rect.maxY() + bottomOutset;
- LayoutUnit leftWithOutset = rect.x() - leftOutset;
- LayoutUnit rightWithOutset = rect.maxX() + rightOutset;
- IntRect borderImageRect = pixelSnappedIntRect(leftWithOutset, topWithOutset, rightWithOutset - leftWithOutset, bottomWithOutset - topWithOutset);
-
IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size(), DoNotScaleByEffectiveZoom);
// If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any.
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (122640 => 122641)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-07-13 23:23:40 UTC (rev 122641)
@@ -1478,24 +1478,12 @@
}
#endif
-void RenderStyle::getImageOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
+LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const
{
- top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth());
- right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth());
- bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth());
- left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth());
+ return LayoutBoxExtent(NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()),
+ NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()),
+ NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()),
+ NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()));
}
-void RenderStyle::getImageHorizontalOutsets(const NinePieceImage& image, LayoutUnit& left, LayoutUnit& right) const
-{
- right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth());
- left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth());
-}
-
-void RenderStyle::getImageVerticalOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& bottom) const
-{
- top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth());
- bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth());
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (122640 => 122641)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-07-13 23:12:14 UTC (rev 122640)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-07-13 23:23:40 UTC (rev 122641)
@@ -440,36 +440,20 @@
return hasBackgroundImage();
}
- void getImageOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
+ LayoutBoxExtent imageOutsets(const NinePieceImage&) const;
bool hasBorderImageOutsets() const
{
return borderImage().hasImage() && borderImage().outset().nonZero();
}
- void getBorderImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
+ LayoutBoxExtent borderImageOutsets() const
{
- return getImageOutsets(borderImage(), top, right, bottom, left);
+ return imageOutsets(borderImage());
}
- void getBorderImageHorizontalOutsets(LayoutUnit& left, LayoutUnit& right) const
+
+ LayoutBoxExtent maskBoxImageOutsets() const
{
- return getImageHorizontalOutsets(borderImage(), left, right);
+ return imageOutsets(maskBoxImage());
}
- void getBorderImageVerticalOutsets(LayoutUnit& top, LayoutUnit& bottom) const
- {
- return getImageVerticalOutsets(borderImage(), top, bottom);
- }
- void getBorderImageInlineDirectionOutsets(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
- {
- return getImageInlineDirectionOutsets(borderImage(), logicalLeft, logicalRight);
- }
- void getBorderImageBlockDirectionOutsets(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
- {
- return getImageBlockDirectionOutsets(borderImage(), logicalTop, logicalBottom);
- }
-
- void getMaskBoxImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
- {
- return getImageOutsets(maskBoxImage(), top, right, bottom, left);
- }
#if ENABLE(CSS_FILTERS)
void getFilterOutsets(int& top, int& right, int& bottom, int& left) const
@@ -1754,18 +1738,6 @@
return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
}
- // Helpers for obtaining border image outsets for overflow.
- void getImageHorizontalOutsets(const NinePieceImage&, LayoutUnit& left, LayoutUnit& right) const;
- void getImageVerticalOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& bottom) const;
- void getImageInlineDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
- {
- return isHorizontalWritingMode() ? getImageHorizontalOutsets(image, logicalLeft, logicalRight) : getImageVerticalOutsets(image, logicalLeft, logicalRight);
- }
- void getImageBlockDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
- {
- return isHorizontalWritingMode() ? getImageVerticalOutsets(image, logicalTop, logicalBottom) : getImageHorizontalOutsets(image, logicalTop, logicalBottom);
- }
-
// Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
Color invalidColor() const { static Color invalid; return invalid; }
Color borderLeftColor() const { return surround->border.left().color(); }