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

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

Issue 2782343002: Store local border box property cache outside ObjectPaintProperties (Closed)
Patch Set: Created 3 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
Index: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
index ac670bf730d2374730a42870f98319e2bd4f9368..74511ed86a62598c7bebb89f9cb113ab0543bc7c 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -210,13 +210,10 @@ LayoutRect PaintLayerClipper::localClipRect(
premappedRect.moveBy(context.rootLayer->layoutObject().paintOffset());
const auto* clipRootLayerTransform = clippingRootLayer.layoutObject()
- .paintProperties()
- ->localBorderBoxProperties()
+ .localBorderBoxProperties()
->transform();
- const auto* layerTransform = m_layer.layoutObject()
- .paintProperties()
- ->localBorderBoxProperties()
- ->transform();
+ const auto* layerTransform =
+ m_layer.layoutObject().localBorderBoxProperties()->transform();
FloatRect clippedRectInLocalSpace(premappedRect);
m_geometryMapper->sourceToDestinationRect(
clipRootLayerTransform, layerTransform, clippedRectInLocalSpace);
@@ -262,14 +259,10 @@ void PaintLayerClipper::mapLocalToRootWithGeometryMapper(
LayoutRect& rectToMap) const {
DCHECK(m_geometryMapper);
- const auto* layerTransform = m_layer.layoutObject()
- .paintProperties()
- ->localBorderBoxProperties()
- ->transform();
- const auto* rootTransform = context.rootLayer->layoutObject()
- .paintProperties()
- ->localBorderBoxProperties()
- ->transform();
+ const auto* layerTransform =
+ m_layer.layoutObject().localBorderBoxProperties()->transform();
+ const auto* rootTransform =
+ context.rootLayer->layoutObject().localBorderBoxProperties()->transform();
FloatRect floatRect(rectToMap);
floatRect.moveBy(FloatPoint(m_layer.layoutObject().paintOffset()));
@@ -287,24 +280,17 @@ void PaintLayerClipper::calculateRectsWithGeometryMapper(
ClipRect& backgroundRect,
ClipRect& foregroundRect,
const LayoutPoint* offsetFromRoot) const {
- const auto* properties = m_layer.layoutObject().paintProperties();
- // TODO(chrishtr): fix the underlying bug that causes this situation.
- if (!properties) {
- backgroundRect = ClipRect(LayoutRect(LayoutRect::infiniteIntRect()));
- foregroundRect = ClipRect(LayoutRect(LayoutRect::infiniteIntRect()));
- } else {
- calculateClipRectWithGeometryMapper(context, false, backgroundRect);
+ calculateClipRectWithGeometryMapper(context, false, backgroundRect);
- backgroundRect.move(context.subPixelAccumulation);
- backgroundRect.intersect(paintDirtyRect);
+ backgroundRect.move(context.subPixelAccumulation);
+ backgroundRect.intersect(paintDirtyRect);
- applyOverflowClipToBackgroundRectWithGeometryMapper(context,
- backgroundRect);
+ applyOverflowClipToBackgroundRectWithGeometryMapper(context, backgroundRect);
+
+ calculateClipRectWithGeometryMapper(context, true, foregroundRect);
+ foregroundRect.move(context.subPixelAccumulation);
+ foregroundRect.intersect(paintDirtyRect);
- calculateClipRectWithGeometryMapper(context, true, foregroundRect);
- foregroundRect.move(context.subPixelAccumulation);
- foregroundRect.intersect(paintDirtyRect);
- }
LayoutPoint offset;
if (offsetFromRoot)
offset = *offsetFromRoot;
@@ -448,40 +434,47 @@ void PaintLayerClipper::calculateClipRectWithGeometryMapper(
bool isForeground,
ClipRect& output) const {
DCHECK(m_geometryMapper);
- const auto* properties = m_layer.layoutObject().paintProperties();
- DCHECK(properties && properties->localBorderBoxProperties());
+ const auto* localBorderBox =
+ m_layer.layoutObject().localBorderBoxProperties();
+ DCHECK(localBorderBox);
+ PropertyTreeState propertyTreeState = *localBorderBox;
+
+ const auto* ancestorLocalBorderBox =
+ context.rootLayer->layoutObject().localBorderBoxProperties();
+ DCHECK(ancestorLocalBorderBox);
+ PropertyTreeState destinationPropertyTreeState = *ancestorLocalBorderBox;
- PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties();
const auto* ancestorProperties =
context.rootLayer->layoutObject().paintProperties();
- DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties());
- PropertyTreeState destinationPropertyTreeState =
- *ancestorProperties->localBorderBoxProperties();
+ const auto* ancestorCssClip =
+ ancestorProperties ? ancestorProperties->cssClip() : nullptr;
// CSS clip of the root is always applied.
- if (ancestorProperties->cssClip()) {
- DCHECK(destinationPropertyTreeState.clip() ==
- ancestorProperties->cssClip());
- destinationPropertyTreeState.setClip(
- ancestorProperties->cssClip()->parent());
+ if (ancestorCssClip) {
+ DCHECK(destinationPropertyTreeState.clip() == ancestorCssClip);
+ destinationPropertyTreeState.setClip(ancestorCssClip->parent());
}
+ const auto* properties = m_layer.layoutObject().paintProperties();
+ const auto* overflowClip = properties ? properties->overflowClip() : nullptr;
if (&m_layer == context.rootLayer) {
// Set the overflow clip for |propertyTreeState| so that it differs from
// |destinationPropertyTreeState| in its clip.
if (isForeground && context.respectOverflowClip == RespectOverflowClip &&
- properties->overflowClip())
- propertyTreeState.setClip(properties->overflowClip());
+ overflowClip)
+ propertyTreeState.setClip(overflowClip);
} else {
+ const auto* ancestorOverflowClip =
+ ancestorProperties ? ancestorProperties->overflowClip() : nullptr;
// Set the clip of |destinationPropertyTreeState| to be inside the
// ancestor's overflow clip, so that that clip is not applied.
if (context.respectOverflowClip == IgnoreOverflowClip &&
- ancestorProperties->overflowClip())
- destinationPropertyTreeState.setClip(ancestorProperties->overflowClip());
+ ancestorOverflowClip)
+ destinationPropertyTreeState.setClip(ancestorOverflowClip);
// Set the overflow clip for |propertyTreeState| so that it differs from
// destinationPropertyTreeState| in its clip.
- if (isForeground && properties->overflowClip())
- propertyTreeState.setClip(properties->overflowClip());
+ if (isForeground && overflowClip)
+ propertyTreeState.setClip(overflowClip);
}
const FloatClipRect& clippedRectInRootLayerSpace =

Powered by Google App Engine
This is Rietveld 408576698