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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2692853016: Change PaintLayer::m_layoutObject to a reference. (Closed)
Patch Set: Added TODO 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 return IntRect(); 978 return IntRect();
979 979
980 IntRect result = rects[0]; 980 IntRect result = rects[0];
981 for (size_t i = 1; i < n; ++i) 981 for (size_t i = 1; i < n; ++i)
982 result.unite(rects[i]); 982 result.unite(rects[i]);
983 return result; 983 return result;
984 } 984 }
985 985
986 IntRect LayoutObject::absoluteElementBoundingBoxRect() const { 986 IntRect LayoutObject::absoluteElementBoundingBoxRect() const {
987 Vector<LayoutRect> rects; 987 Vector<LayoutRect> rects;
988 const LayoutBoxModelObject* container = enclosingLayer()->layoutObject(); 988 const LayoutBoxModelObject& container = enclosingLayer()->layoutObject();
989 addElementVisualOverflowRects( 989 addElementVisualOverflowRects(
990 rects, LayoutPoint(localToAncestorPoint(FloatPoint(), container))); 990 rects, LayoutPoint(localToAncestorPoint(FloatPoint(), &container)));
991 return container->localToAbsoluteQuad(FloatQuad(FloatRect(unionRect(rects)))) 991 return container.localToAbsoluteQuad(FloatQuad(FloatRect(unionRect(rects))))
992 .enclosingBoundingBox(); 992 .enclosingBoundingBox();
993 } 993 }
994 994
995 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(const Range* range) { 995 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(const Range* range) {
996 if (!range || !range->startContainer()) 996 if (!range || !range->startContainer())
997 return FloatRect(); 997 return FloatRect();
998 998
999 range->ownerDocument().updateStyleAndLayout(); 999 range->ownerDocument().updateStyleAndLayout();
1000 1000
1001 Vector<FloatQuad> quads; 1001 Vector<FloatQuad> quads;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const { 1048 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const {
1049 LayoutBoxModelObject* container = nullptr; 1049 LayoutBoxModelObject* container = nullptr;
1050 // FIXME: CompositingState is not necessarily up to date for many callers of 1050 // FIXME: CompositingState is not necessarily up to date for many callers of
1051 // this function. 1051 // this function.
1052 DisableCompositingQueryAsserts disabler; 1052 DisableCompositingQueryAsserts disabler;
1053 1053
1054 if (PaintLayer* paintingLayer = this->paintingLayer()) { 1054 if (PaintLayer* paintingLayer = this->paintingLayer()) {
1055 if (PaintLayer* compositingLayer = 1055 if (PaintLayer* compositingLayer =
1056 paintingLayer 1056 paintingLayer
1057 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries()) 1057 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries())
1058 container = compositingLayer->layoutObject(); 1058 container = &compositingLayer->layoutObject();
1059 } 1059 }
1060 return container; 1060 return container;
1061 } 1061 }
1062 1062
1063 String LayoutObject::decoratedName() const { 1063 String LayoutObject::decoratedName() const {
1064 StringBuilder name; 1064 StringBuilder name;
1065 name.append(this->name()); 1065 name.append(this->name());
1066 1066
1067 if (isAnonymous()) 1067 if (isAnonymous())
1068 name.append(" (anonymous)"); 1068 name.append(" (anonymous)");
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 mapToVisualRectInAncestorSpace(view(), selectionRect); 1178 mapToVisualRectInAncestorSpace(view(), selectionRect);
1179 return selectionRect; 1179 return selectionRect;
1180 } 1180 }
1181 1181
1182 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded( 1182 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(
1183 const PaintInvalidationState& paintInvalidationState) { 1183 const PaintInvalidationState& paintInvalidationState) {
1184 DCHECK(&paintInvalidationState.currentObject() == this); 1184 DCHECK(&paintInvalidationState.currentObject() == this);
1185 1185
1186 if (styleRef().hasOutline()) { 1186 if (styleRef().hasOutline()) {
1187 PaintLayer& layer = paintInvalidationState.paintingLayer(); 1187 PaintLayer& layer = paintInvalidationState.paintingLayer();
1188 if (layer.layoutObject() != this) 1188 if (&layer.layoutObject() != this)
1189 layer.setNeedsPaintPhaseDescendantOutlines(); 1189 layer.setNeedsPaintPhaseDescendantOutlines();
1190 } 1190 }
1191 1191
1192 LayoutView* v = view(); 1192 LayoutView* v = view();
1193 if (v->document().printing()) 1193 if (v->document().printing())
1194 return PaintInvalidationNone; // Don't invalidate paints if we're printing. 1194 return PaintInvalidationNone; // Don't invalidate paints if we're printing.
1195 1195
1196 PaintInvalidatorContextAdapter context(paintInvalidationState); 1196 PaintInvalidatorContextAdapter context(paintInvalidationState);
1197 1197
1198 const LayoutBoxModelObject& paintInvalidationContainer = 1198 const LayoutBoxModelObject& paintInvalidationContainer =
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 // Figure out what layer our container is in. Any offset (or new layer) for 2355 // Figure out what layer our container is in. Any offset (or new layer) for
2356 // this layoutObject within it's container will be applied in 2356 // this layoutObject within it's container will be applied in
2357 // addLayerHitTestRects. 2357 // addLayerHitTestRects.
2358 LayoutPoint layerOffset; 2358 LayoutPoint layerOffset;
2359 const PaintLayer* currentLayer = nullptr; 2359 const PaintLayer* currentLayer = nullptr;
2360 2360
2361 if (!hasLayer()) { 2361 if (!hasLayer()) {
2362 LayoutObject* container = this->container(); 2362 LayoutObject* container = this->container();
2363 currentLayer = container->enclosingLayer(); 2363 currentLayer = container->enclosingLayer();
2364 if (container && currentLayer->layoutObject() != container) { 2364 if (container && currentLayer->layoutObject() != container) {
2365 layerOffset.move( 2365 layerOffset.move(container->offsetFromAncestorContainer(
2366 container->offsetFromAncestorContainer(currentLayer->layoutObject())); 2366 &currentLayer->layoutObject()));
2367 // If the layer itself is scrolled, we have to undo the subtraction of its 2367 // If the layer itself is scrolled, we have to undo the subtraction of its
2368 // scroll offset since we want the offset relative to the scrolling 2368 // scroll offset since we want the offset relative to the scrolling
2369 // content, not the element itself. 2369 // content, not the element itself.
2370 if (currentLayer->layoutObject()->hasOverflowClip()) 2370 if (currentLayer->layoutObject().hasOverflowClip())
2371 layerOffset.move(currentLayer->layoutBox()->scrolledContentOffset()); 2371 layerOffset.move(currentLayer->layoutBox()->scrolledContentOffset());
2372 } 2372 }
2373 } 2373 }
2374 2374
2375 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, 2375 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset,
2376 LayoutRect()); 2376 LayoutRect());
2377 } 2377 }
2378 2378
2379 void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects, 2379 void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects,
2380 const PaintLayer* currentLayer, 2380 const PaintLayer* currentLayer,
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 const blink::LayoutObject* root = object1; 3495 const blink::LayoutObject* root = object1;
3496 while (root->parent()) 3496 while (root->parent())
3497 root = root->parent(); 3497 root = root->parent();
3498 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3498 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3499 } else { 3499 } else {
3500 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3500 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3501 } 3501 }
3502 } 3502 }
3503 3503
3504 #endif 3504 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698