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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp

Issue 2692853016: Change PaintLayer::m_layoutObject to a reference. (Closed)
Patch Set: restore inadvertantly removed null check Created 3 years, 10 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/LayoutGeometryMap.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp
index 989d93ade5b931da4d7d54a6beb988c1c6ba09c8..9c55011fd10d037355ccbe7e0b74509159f730f1 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp
@@ -190,9 +190,9 @@ void LayoutGeometryMap::pushMappingsToAncestor(
isTopmostLayoutView(m_mapping[0].m_layoutObject));
}
-static bool canMapBetweenLayoutObjects(const LayoutObject* layoutObject,
- const LayoutObject* ancestor) {
- for (const LayoutObject* current = layoutObject;;
+static bool canMapBetweenLayoutObjects(const LayoutObject& layoutObject,
+ const LayoutObject& ancestor) {
+ for (const LayoutObject* current = &layoutObject;;
current = current->parent()) {
const ComputedStyle& style = current->styleRef();
if (style.position() == EPosition::kFixed ||
@@ -203,7 +203,7 @@ static bool canMapBetweenLayoutObjects(const LayoutObject* layoutObject,
current->isLayoutFlowThread() || current->isSVGRoot())
return false;
- if (current == ancestor)
+ if (current == &ancestor)
break;
if (current->isFloatingWithNonContainingBlockParent())
@@ -216,18 +216,18 @@ static bool canMapBetweenLayoutObjects(const LayoutObject* layoutObject,
void LayoutGeometryMap::pushMappingsToAncestor(
const PaintLayer* layer,
const PaintLayer* ancestorLayer) {
- const LayoutObject* layoutObject = layer->layoutObject();
+ const LayoutObject& layoutObject = layer->layoutObject();
bool crossDocument =
ancestorLayer &&
- layer->layoutObject()->frame() != ancestorLayer->layoutObject()->frame();
+ layoutObject.frame() != ancestorLayer->layoutObject().frame();
ASSERT(!crossDocument || m_mapCoordinatesFlags & TraverseDocumentBoundaries);
// We have to visit all the layoutObjects to detect flipped blocks. This might
// defeat the gains from mapping via layers.
bool canConvertInLayerTree =
(ancestorLayer && !crossDocument)
- ? canMapBetweenLayoutObjects(layer->layoutObject(),
+ ? canMapBetweenLayoutObjects(layoutObject,
ancestorLayer->layoutObject())
: false;
@@ -242,21 +242,21 @@ void LayoutGeometryMap::pushMappingsToAncestor(
// The LayoutView must be pushed first.
if (!m_mapping.size()) {
- ASSERT(ancestorLayer->layoutObject()->isLayoutView());
- pushMappingsToAncestor(ancestorLayer->layoutObject(), 0);
+ DCHECK(ancestorLayer->layoutObject().isLayoutView());
+ pushMappingsToAncestor(&ancestorLayer->layoutObject(), 0);
}
AutoReset<size_t> positionChange(&m_insertionPosition, m_mapping.size());
bool accumulatingTransform =
- layer->layoutObject()->style()->preserves3D() ||
- ancestorLayer->layoutObject()->style()->preserves3D();
- push(layoutObject, toLayoutSize(layerOffset),
+ layoutObject.style()->preserves3D() ||
+ ancestorLayer->layoutObject().style()->preserves3D();
+ push(&layoutObject, toLayoutSize(layerOffset),
accumulatingTransform ? AccumulatingTransform : 0);
return;
}
const LayoutBoxModelObject* ancestorLayoutObject =
- ancestorLayer ? ancestorLayer->layoutObject() : 0;
- pushMappingsToAncestor(layoutObject, ancestorLayoutObject);
+ ancestorLayer ? &ancestorLayer->layoutObject() : 0;
+ pushMappingsToAncestor(&layoutObject, ancestorLayoutObject);
}
void LayoutGeometryMap::push(const LayoutObject* layoutObject,
@@ -328,7 +328,7 @@ void LayoutGeometryMap::popMappingsToAncestor(
void LayoutGeometryMap::popMappingsToAncestor(const PaintLayer* ancestorLayer) {
const LayoutBoxModelObject* ancestorLayoutObject =
- ancestorLayer ? ancestorLayer->layoutObject() : 0;
+ ancestorLayer ? &ancestorLayer->layoutObject() : 0;
popMappingsToAncestor(ancestorLayoutObject);
}

Powered by Google App Engine
This is Rietveld 408576698