Index: third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp |
diff --git a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp |
index c6c2fb012185c9044f448af1ed6d33fde383bb05..d9c2b1bb690abca582abc5959f5f951b040da350 100644 |
--- a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp |
+++ b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp |
@@ -411,7 +411,7 @@ void BackgroundImageGeometry::calculate( |
const LayoutRect& paintRect) { |
LayoutUnit left; |
LayoutUnit top; |
- LayoutSize positioningAreaSize; |
+ LayoutRect positioningArea; |
bool isLayoutView = obj.isLayoutView(); |
const LayoutBox* rootBox = nullptr; |
if (isLayoutView) { |
@@ -473,8 +473,9 @@ void BackgroundImageGeometry::calculate( |
// The background of the box generated by the root element covers the |
// entire canvas and will be painted by the view object, but the we should |
// still use the root element box for positioning. |
- positioningAreaSize = |
- rootBox->size() - LayoutSize(left + right, top + bottom); |
+ positioningArea.setSize(rootBox->size()); |
+ positioningArea.contractEdges(top, right, bottom, left); |
+ |
// The input paint rect is specified in root element local coordinate |
// (i.e. a transform is applied on the context for painting), and is |
// expanded to cover the whole canvas. Since left/top is relative to the |
@@ -482,12 +483,14 @@ void BackgroundImageGeometry::calculate( |
left -= paintRect.x(); |
top -= paintRect.y(); |
} else { |
- positioningAreaSize = |
- (cellUsingContainerBackground |
- ? getBackgroundObjectDimensions(toLayoutTableCell(obj), |
- toLayoutBox(positioningBox)) |
- : paintRect.size()) - |
- LayoutSize(left + right, top + bottom); |
+ if (cellUsingContainerBackground) { |
+ positioningArea.setSize(getBackgroundObjectDimensions( |
+ toLayoutTableCell(obj), toLayoutBox(positioningBox))); |
+ } else { |
+ positioningArea = paintRect; |
+ } |
+ |
+ positioningArea.contractEdges(top, right, bottom, left); |
} |
} else { |
setHasNonLocalGeometry(); |
@@ -509,11 +512,11 @@ void BackgroundImageGeometry::calculate( |
LayoutPoint(-paintContainer->localToAbsolute(FloatPoint()))); |
setDestRect(viewportRect); |
- positioningAreaSize = destRect().size(); |
+ positioningArea = viewportRect; |
} |
LayoutSize fillTileSize( |
- calculateFillTileSize(positioningBox, fillLayer, positioningAreaSize)); |
+ calculateFillTileSize(positioningBox, fillLayer, positioningArea.size())); |
// It's necessary to apply the heuristic here prior to any further |
// calculations to avoid incorrectly using sub-pixel values that won't be |
// present in the painted tile. |
@@ -522,12 +525,12 @@ void BackgroundImageGeometry::calculate( |
EFillRepeat backgroundRepeatX = fillLayer.repeatX(); |
EFillRepeat backgroundRepeatY = fillLayer.repeatY(); |
LayoutUnit unsnappedAvailableWidth = |
- positioningAreaSize.width() - fillTileSize.width(); |
+ positioningArea.width() - fillTileSize.width(); |
LayoutUnit unsnappedAvailableHeight = |
- positioningAreaSize.height() - fillTileSize.height(); |
- positioningAreaSize = |
- LayoutSize(snapSizeToPixel(positioningAreaSize.width(), m_destRect.x()), |
- snapSizeToPixel(positioningAreaSize.height(), m_destRect.y())); |
+ positioningArea.height() - fillTileSize.height(); |
+ LayoutSize positioningAreaSize = |
+ LayoutSize(snapSizeToPixel(positioningArea.width(), m_destRect.x()), |
+ snapSizeToPixel(positioningArea.height(), m_destRect.y())); |
LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width(); |
LayoutUnit availableHeight = |
positioningAreaSize.height() - tileSize().height(); |