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

Unified Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 102123013: Fix painting of fixed background images in composited layers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added missing DOCTYPEs Created 6 years, 9 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 | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBoxModelObject.cpp
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index 93c7f2e6361c42bca2c1f4e55d1a1a486d777cc0..8b46f82e0f8e7502527ea8e78fa7ef7b08a563b1 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -696,7 +696,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
// no progressive loading of the background image
if (shouldPaintBackgroundImage) {
BackgroundImageGeometry geometry;
- calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, backgroundObject);
+ calculateBackgroundImageGeometry(paintInfo.paintContainer(), bgLayer, scrolledPaintRect, geometry, backgroundObject);
geometry.clip(paintInfo.rect);
if (!geometry.destRect().isEmpty()) {
CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op;
@@ -964,8 +964,8 @@ static inline int getSpace(int areaSize, int tileSize)
return space;
}
-void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const LayoutRect& paintRect,
- BackgroundImageGeometry& geometry, RenderObject* backgroundObject)
+void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer* fillLayer, const LayoutRect& paintRect,
+ BackgroundImageGeometry& geometry, RenderObject* backgroundObject) const
{
LayoutUnit left = 0;
LayoutUnit top = 0;
@@ -974,6 +974,7 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
// Determine the background positioning area and set destRect to the background painting area.
// destRect will be adjusted later if the background is non-repeating.
+ // FIXME: transforms spec says that fixed backgrounds behave like scroll inside transforms.
bool fixedAttachment = fillLayer->attachment() == FixedBackgroundAttachment;
#if ENABLE(FAST_MOBILE_SCROLLING)
@@ -1015,17 +1016,24 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
} else
positioningAreaSize = pixelSnappedIntSize(paintRect.size() - LayoutSize(left + right, top + bottom), paintRect.location());
} else {
+ geometry.setHasNonLocalGeometry();
+
IntRect viewportRect = pixelSnappedIntRect(viewRect());
if (fixedBackgroundPaintsInLocalCoordinates())
viewportRect.setLocation(IntPoint());
else if (FrameView* frameView = view()->frameView())
viewportRect.setLocation(IntPoint(frameView->scrollOffsetForFixedPosition()));
+ if (paintContainer) {
+ IntPoint absoluteContainerOffset = roundedIntPoint(paintContainer->localToAbsolute(FloatPoint()));
+ viewportRect.moveBy(-absoluteContainerOffset);
+ }
+
geometry.setDestRect(pixelSnappedIntRect(viewportRect));
positioningAreaSize = geometry.destRect().size();
}
- RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject : this;
+ const RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject : this;
IntSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize);
fillLayer->image()->setContainerSizeForRenderer(clientForBackgroundImage, fillTileSize, style()->effectiveZoom());
geometry.setTileSize(fillTileSize);
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698