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

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

Issue 612323011: Use fragmented bounding box for hit-test/paint clipping. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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/RenderLayer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 9c306c9dd320254c78ad2ed96a6a0be03fe7c60c..0ef6af831f65206fd354ced0408bced9ff8b27db 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -1121,7 +1121,7 @@ LayoutRect RenderLayer::transparencyClipBox(const RenderLayer* layer, const Rend
// We don't use fragment boxes when collecting a transformed layer's bounding box, since it always
// paints unfragmented.
- LayoutRect clipRect = layer->physicalBoundingBox(layer);
+ LayoutRect clipRect = layer->boundingBox(layer);
expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transparencyBehavior, subPixelAccumulation, paintBehavior);
layer->renderer()->style()->filterOutsets().expandRect(clipRect);
LayoutRect result = transform.mapRect(clipRect);
@@ -1140,7 +1140,7 @@ LayoutRect RenderLayer::transparencyClipBox(const RenderLayer* layer, const Rend
return result;
}
- LayoutRect clipRect = layer->physicalBoundingBox(rootLayer);
+ LayoutRect clipRect = layer->fragmentedBoundingBox(rootLayer);
expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, subPixelAccumulation, paintBehavior);
layer->renderer()->style()->filterOutsets().expandRect(clipRect);
clipRect.move(subPixelAccumulation);
@@ -1412,7 +1412,7 @@ void RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutR
{
LayoutPoint delta;
convertToLayerCoords(ancestorLayer, delta);
- rect.move(-delta.x(), -delta.y());
+ rect.moveBy(delta);
}
void RenderLayer::didUpdateNeedsCompositedScrolling()
@@ -1486,7 +1486,7 @@ void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
outlineRectInFlowThread, &offsetWithinPaginatedLayer);
// Take our bounding box within the flow thread and clip it.
- LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer);
+ LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : boundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer);
layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect());
// Shift the dirty rect into flow thread coordinates.
@@ -2186,7 +2186,7 @@ bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo
// Otherwise we need to compute the bounding box of this single layer and see if it intersects
// the damage rect.
- return physicalBoundingBox(rootLayer, offsetFromRoot).intersects(damageRect);
+ return boundingBox(rootLayer, offsetFromRoot).intersects(damageRect);
}
LayoutRect RenderLayer::logicalBoundingBox() const
@@ -2225,21 +2225,46 @@ LayoutRect RenderLayer::logicalBoundingBox() const
return result;
}
-LayoutRect RenderLayer::physicalBoundingBox(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot) const
+LayoutRect RenderLayer::flippedLogicalBoundingBox() const
{
LayoutRect result = logicalBoundingBox();
if (m_renderer->isBox())
renderBox()->flipForWritingMode(result);
else
m_renderer->containingBlock()->flipForWritingMode(result);
+ return result;
+}
- LayoutPoint delta;
+LayoutRect RenderLayer::boundingBox(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot) const
+{
+ LayoutRect result = flippedLogicalBoundingBox();
if (offsetFromRoot)
- delta = *offsetFromRoot;
+ result.moveBy(*offsetFromRoot);
else
- convertToLayerCoords(ancestorLayer, delta);
+ convertToLayerCoords(ancestorLayer, result);
+ return result;
+}
- result.moveBy(delta);
+LayoutRect RenderLayer::fragmentedBoundingBox(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot) const
andersr 2014/10/02 11:01:21 Is fragmentsBoundingBox a better name? (Like Rende
rune 2014/10/02 11:17:34 Yes.
rune 2014/10/03 09:15:46 Done.
+{
+ if (!enclosingPaginationLayer())
+ return boundingBox(ancestorLayer, offsetFromRoot);
+
+ LayoutRect result = flippedLogicalBoundingBox();
+
+ // Split our box up into the actual fragment boxes that render in the columns/pages and unite those together to
+ // get our true bounding box.
+ LayoutPoint offsetWithinPaginationLayer;
+ convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginationLayer);
+ result.moveBy(offsetWithinPaginationLayer);
+
+ RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginationLayer()->renderer());
+ result = enclosingFlowThread->fragmentsBoundingBox(result);
+
mstensho (USE GERRIT) 2014/10/02 12:43:59 At this point, |result| is a nice visual rectangle
rune 2014/10/03 09:15:46 Done. I also removed the offsetFromRoot pointer,
+ if (offsetFromRoot)
+ result.moveBy(*offsetFromRoot);
+ else
+ convertToLayerCoords(ancestorLayer, result);
return result;
}
@@ -2267,10 +2292,10 @@ static void expandRectForReflectionAndStackingChildren(const RenderLayer* ancest
}
}
-LayoutRect RenderLayer::physicalBoundingBoxIncludingReflectionAndStackingChildren(const RenderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const
+LayoutRect RenderLayer::boundingBoxIncludingReflectionAndStackingChildren(const RenderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const
{
LayoutPoint origin;
- LayoutRect result = physicalBoundingBox(ancestorLayer, &origin);
+ LayoutRect result = boundingBox(ancestorLayer, &origin);
const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
@@ -2316,7 +2341,7 @@ LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay
}
LayoutPoint origin;
- LayoutRect result = physicalBoundingBox(ancestorLayer, &origin);
+ LayoutRect result = boundingBox(ancestorLayer, &origin);
const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
@@ -2809,9 +2834,9 @@ void RenderLayer::computeSelfHitTestRects(LayerHitTestRects& rects) const
if (const RenderLayer* parentLayer = parent()) {
LayerHitTestRects::iterator iter = rects.find(parentLayer);
if (iter == rects.end()) {
- rects.add(parentLayer, Vector<LayoutRect>()).storedValue->value.append(physicalBoundingBox(parentLayer));
+ rects.add(parentLayer, Vector<LayoutRect>()).storedValue->value.append(boundingBox(parentLayer));
} else {
- iter->value.append(physicalBoundingBox(parentLayer));
+ iter->value.append(boundingBox(parentLayer));
}
}
} else {
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698