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

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

Issue 2793993003: Make GeometryMapper fully static (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 e6431c5a5bbce3e44431ca2143b39a55a30c30dc..111f00ae4ba2c1698ee4c5d23587a4d43824c326 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -49,6 +49,7 @@
#include "core/layout/LayoutView.h"
#include "core/paint/ObjectPaintProperties.h"
#include "core/paint/PaintLayer.h"
+#include "platform/graphics/paint/GeometryMapper.h"
namespace blink {
@@ -109,8 +110,8 @@ static void applyClipRects(const ClipRectsContext& context,
}
PaintLayerClipper::PaintLayerClipper(const PaintLayer& layer,
- GeometryMapper* geometryMapper)
- : m_layer(layer), m_geometryMapper(geometryMapper) {}
+ bool usegeometryMapper)
+ : m_layer(layer), m_useGeometryMapper(usegeometryMapper) {}
ClipRects* PaintLayerClipper::clipRectsIfCached(
const ClipRectsContext& context) const {
@@ -154,7 +155,7 @@ ClipRects& PaintLayerClipper::storeClipRectsInCache(
ClipRects& PaintLayerClipper::getClipRects(
const ClipRectsContext& context) const {
- DCHECK(!m_geometryMapper);
+ DCHECK(!m_useGeometryMapper);
if (ClipRects* result = clipRectsIfCached(context))
return *result;
// Note that it's important that we call getClipRects on our parent
@@ -163,7 +164,7 @@ ClipRects& PaintLayerClipper::getClipRects(
ClipRects* parentClipRects = nullptr;
if (context.rootLayer != &m_layer && m_layer.parent()) {
parentClipRects =
- &PaintLayerClipper(*m_layer.parent(), nullptr).getClipRects(context);
+ &PaintLayerClipper(*m_layer.parent(), false).getClipRects(context);
}
RefPtr<ClipRects> clipRects = ClipRects::create();
calculateClipRects(context, *clipRects);
@@ -189,7 +190,7 @@ void PaintLayerClipper::clearClipRectsIncludingDescendants(
while (!layers.empty()) {
const PaintLayer* currentLayer = layers.top();
layers.pop();
- PaintLayerClipper(*currentLayer, m_geometryMapper).clearCache(cacheSlot);
+ PaintLayerClipper(*currentLayer, m_useGeometryMapper).clearCache(cacheSlot);
for (const PaintLayer* layer = currentLayer->firstChild(); layer;
layer = layer->nextSibling())
layers.push(layer);
@@ -199,7 +200,7 @@ void PaintLayerClipper::clearClipRectsIncludingDescendants(
LayoutRect PaintLayerClipper::localClipRect(
const PaintLayer& clippingRootLayer) const {
ClipRectsContext context(&clippingRootLayer, PaintingClipRects);
- if (m_geometryMapper) {
+ if (m_useGeometryMapper) {
ClipRect clipRect;
calculateBackgroundClipRectWithGeometryMapper(context, clipRect);
LayoutRect premappedRect = clipRect.rect();
@@ -214,7 +215,7 @@ LayoutRect PaintLayerClipper::localClipRect(
const auto* layerTransform =
m_layer.layoutObject().localBorderBoxProperties()->transform();
FloatRect clippedRectInLocalSpace(premappedRect);
- m_geometryMapper->sourceToDestinationRect(
+ GeometryMapper::sourceToDestinationRect(
clipRootLayerTransform, layerTransform, clippedRectInLocalSpace);
clippedRectInLocalSpace.moveBy(
-FloatPoint(m_layer.layoutObject().paintOffset()));
@@ -294,7 +295,7 @@ void PaintLayerClipper::calculateRects(
ClipRect& backgroundRect,
ClipRect& foregroundRect,
const LayoutPoint* offsetFromRoot) const {
- if (m_geometryMapper) {
+ if (m_useGeometryMapper) {
calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds,
backgroundRect, foregroundRect,
offsetFromRoot);
@@ -367,7 +368,7 @@ void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context,
// Ensure that our parent's clip has been calculated so that we can examine
// the values.
if (parentLayer) {
- PaintLayerClipper(*parentLayer, m_geometryMapper)
+ PaintLayerClipper(*parentLayer, m_useGeometryMapper)
.getOrCalculateClipRects(context, clipRects);
} else {
clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
@@ -401,7 +402,7 @@ static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects,
void PaintLayerClipper::calculateBackgroundClipRectWithGeometryMapper(
const ClipRectsContext& context,
ClipRect& output) const {
- DCHECK(m_geometryMapper);
+ DCHECK(m_useGeometryMapper);
PropertyTreeState sourcePropertyTreeState(nullptr, nullptr, nullptr);
PropertyTreeState destinationPropertyTreeState(nullptr, nullptr, nullptr);
initializeCommonClipRectState(context, sourcePropertyTreeState,
@@ -428,12 +429,12 @@ void PaintLayerClipper::calculateBackgroundClipRectWithGeometryMapper(
if (shouldClipOverflow(context)) {
FloatRect clipRect(localVisualRect());
clipRect.moveBy(FloatPoint(m_layer.layoutObject().paintOffset()));
- m_geometryMapper->sourceToDestinationVisualRect(
+ GeometryMapper::sourceToDestinationVisualRect(
sourcePropertyTreeState, destinationPropertyTreeState, clipRect);
output.setRect(FloatClipRect(clipRect));
} else {
const FloatClipRect& clippedRectInRootLayerSpace =
- m_geometryMapper->sourceToDestinationClipRect(
+ GeometryMapper::sourceToDestinationClipRect(
sourcePropertyTreeState, destinationPropertyTreeState);
output.setRect(clippedRectInRootLayerSpace);
}
@@ -445,7 +446,7 @@ void PaintLayerClipper::initializeCommonClipRectState(
const ClipRectsContext& context,
PropertyTreeState& sourcePropertyTreeState,
PropertyTreeState& destinationPropertyTreeState) const {
- DCHECK(m_geometryMapper);
+ DCHECK(m_useGeometryMapper);
DCHECK(m_layer.layoutObject().localBorderBoxProperties());
sourcePropertyTreeState = *m_layer.layoutObject().localBorderBoxProperties();
@@ -468,7 +469,7 @@ void PaintLayerClipper::initializeCommonClipRectState(
void PaintLayerClipper::calculateForegroundClipRectWithGeometryMapper(
const ClipRectsContext& context,
ClipRect& output) const {
- DCHECK(m_geometryMapper);
+ DCHECK(m_useGeometryMapper);
PropertyTreeState sourcePropertyTreeState(nullptr, nullptr, nullptr);
PropertyTreeState destinationPropertyTreeState(nullptr, nullptr, nullptr);
initializeCommonClipRectState(context, sourcePropertyTreeState,
@@ -498,8 +499,8 @@ void PaintLayerClipper::calculateForegroundClipRectWithGeometryMapper(
}
const FloatClipRect& clippedRectInRootLayerSpace =
- m_geometryMapper->sourceToDestinationClipRect(
- sourcePropertyTreeState, destinationPropertyTreeState);
+ GeometryMapper::sourceToDestinationClipRect(sourcePropertyTreeState,
+ destinationPropertyTreeState);
output.setRect(clippedRectInRootLayerSpace);
output.moveBy(-context.rootLayer->layoutObject().paintOffset());
@@ -528,7 +529,7 @@ LayoutRect PaintLayerClipper::localVisualRect() const {
void PaintLayerClipper::calculateBackgroundClipRect(
const ClipRectsContext& context,
ClipRect& output) const {
- if (m_geometryMapper) {
+ if (m_useGeometryMapper) {
// TODO(chrishtr): fix the underlying bug that causes this situation.
if (!m_layer.layoutObject().paintProperties() &&
!m_layer.layoutObject().localBorderBoxProperties()) {
@@ -552,7 +553,7 @@ void PaintLayerClipper::calculateBackgroundClipRect(
if (&m_layer == context.rootLayer) {
parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect()));
} else {
- PaintLayerClipper(*m_layer.parent(), m_geometryMapper)
+ PaintLayerClipper(*m_layer.parent(), m_useGeometryMapper)
.getOrCalculateClipRects(context, *parentClipRects);
}
@@ -569,7 +570,7 @@ void PaintLayerClipper::calculateBackgroundClipRect(
void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context,
ClipRects& clipRects) const {
- DCHECK(!m_geometryMapper);
+ DCHECK(!m_useGeometryMapper);
if (context.usesCache())
clipRects = getClipRects(context);
@@ -608,7 +609,7 @@ ClipRects& PaintLayerClipper::paintingClipRects(
const PaintLayer* rootLayer,
ShouldRespectOverflowClipType respectOverflowClip,
const LayoutSize& subpixelAccumulation) const {
- DCHECK(!m_geometryMapper);
+ DCHECK(!m_useGeometryMapper);
ClipRectsContext context(rootLayer, PaintingClipRects,
IgnorePlatformOverlayScrollbarSize,
subpixelAccumulation);

Powered by Google App Engine
This is Rietveld 408576698