Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(756)

Unified Diff: third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp

Issue 2690053002: Calculate positioningArea and not just size, for tiling background. (Closed)
Patch Set: Removed unnecessary change. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698