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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2237433004: Adds DevTools commands for forced viewport override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove offset/scale params, rename commands, clip by backing size. Created 4 years, 4 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
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 6248097b19031e13208183b785a026fa7d0538de..a4a1958195159b1183f92138f762a6899ac8eef9 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -2282,6 +2282,8 @@ static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context,
scrollbar->paint(context, CullRect(transformedClip));
}
+// TODO(eseckler): Make recording distance configurable, e.g. for use in
+// headless, where we would like to record an exact area (distance = 0).
static const int kPixelDistanceToRecord = 4000;
IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graphicsLayer) const
@@ -2312,12 +2314,13 @@ IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph
graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject);
// Now map the bounds to its visible content rect in screen space, including applying clips along the way.
- LayoutRect visibleContentRect(graphicsLayerBoundsInObjectSpace);
+ LayoutRect graphicsLayerBoundsInScreenSpace(graphicsLayerBoundsInObjectSpace);
chrishtr 2016/08/22 22:00:42 It's not screen space, it's the space of the root
Eric Seckler 2016/08/23 09:32:19 Makes sense, updated the comments as well.
LayoutView* rootView = anchorLayoutObject->view();
while (rootView->frame()->ownerLayoutObject())
rootView = rootView->frame()->ownerLayoutObject()->view();
- anchorLayoutObject->mapToVisualRectInAncestorSpace(rootView, visibleContentRect);
- visibleContentRect.intersect(LayoutRect(rootView->frameView()->visibleContentRect()));
+ anchorLayoutObject->mapToVisualRectInAncestorSpace(rootView, graphicsLayerBoundsInScreenSpace);
+ FloatRect visibleContentRect(graphicsLayerBoundsInScreenSpace);
+ rootView->frameView()->clipPaintRect(&visibleContentRect);
IntRect enclosingGraphicsLayerBounds(enclosingIntRect(graphicsLayerBounds));
@@ -2325,7 +2328,7 @@ IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph
IntRect localInterestRect;
// If the visible content rect is empty, then it makes no sense to map it back since there is nothing to map.
if (!visibleContentRect.isEmpty()) {
- localInterestRect = anchorLayoutObject->absoluteToLocalQuad(FloatRect(visibleContentRect), UseTransforms | TraverseDocumentBoundaries).enclosingBoundingBox();
+ localInterestRect = anchorLayoutObject->absoluteToLocalQuad(visibleContentRect, UseTransforms | TraverseDocumentBoundaries).enclosingBoundingBox();
localInterestRect.move(-offsetFromAnchorLayoutObject);
// TODO(chrishtr): the code below is a heuristic, instead we should detect and return whether the mapping failed.
// In some cases, absoluteToLocalQuad can fail to map back to the local space, due to passing through

Powered by Google App Engine
This is Rietveld 408576698