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

Side by Side Diff: third_party/WebKit/Source/core/paint/LayerClipRecorder.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/LayerClipRecorder.h" 5 #include "core/paint/LayerClipRecorder.h"
6 6
7 #include "core/layout/LayoutView.h" 7 #include "core/layout/LayoutView.h"
8 #include "core/paint/ClipRect.h" 8 #include "core/paint/ClipRect.h"
9 #include "core/paint/PaintLayer.h" 9 #include "core/paint/PaintLayer.h"
10 #include "platform/geometry/IntRect.h" 10 #include "platform/geometry/IntRect.h"
(...skipping 24 matching lines...) Expand all
35 35
36 m_graphicsContext.getPaintController().createAndAppend<ClipDisplayItem>( 36 m_graphicsContext.getPaintController().createAndAppend<ClipDisplayItem>(
37 layoutObject, m_clipType, snappedClipRect, roundedRects); 37 layoutObject, m_clipType, snappedClipRect, roundedRects);
38 } 38 }
39 39
40 static bool inContainingBlockChain(PaintLayer* startLayer, 40 static bool inContainingBlockChain(PaintLayer* startLayer,
41 PaintLayer* endLayer) { 41 PaintLayer* endLayer) {
42 if (startLayer == endLayer) 42 if (startLayer == endLayer)
43 return true; 43 return true;
44 44
45 LayoutView* view = startLayer->layoutObject()->view(); 45 LayoutView* view = startLayer->layoutObject().view();
46 for (const LayoutBlock* currentBlock = 46 for (const LayoutBlock* currentBlock =
47 startLayer->layoutObject()->containingBlock(); 47 startLayer->layoutObject().containingBlock();
48 currentBlock && currentBlock != view; 48 currentBlock && currentBlock != view;
49 currentBlock = currentBlock->containingBlock()) { 49 currentBlock = currentBlock->containingBlock()) {
50 if (currentBlock->layer() == endLayer) 50 if (currentBlock->layer() == endLayer)
51 return true; 51 return true;
52 } 52 }
53 53
54 return false; 54 return false;
55 } 55 }
56 56
57 void LayerClipRecorder::collectRoundedRectClips( 57 void LayerClipRecorder::collectRoundedRectClips(
(...skipping 16 matching lines...) Expand all
74 // via a mask layer. We do not want to apply a border-radius clip to the 74 // via a mask layer. We do not want to apply a border-radius clip to the
75 // layer contents itself, because that would require re-rastering every 75 // layer contents itself, because that would require re-rastering every
76 // frame to update the clip. We only want to make sure that the mask layer 76 // frame to update the clip. We only want to make sure that the mask layer
77 // is properly clipped so that it can in turn clip the scrolled contents in 77 // is properly clipped so that it can in turn clip the scrolled contents in
78 // the compositor. 78 // the compositor.
79 if (layer->needsCompositedScrolling() && 79 if (layer->needsCompositedScrolling() &&
80 !(paintFlags & PaintLayerPaintingChildClippingMaskPhase || 80 !(paintFlags & PaintLayerPaintingChildClippingMaskPhase ||
81 paintFlags & PaintLayerPaintingAncestorClippingMaskPhase)) 81 paintFlags & PaintLayerPaintingAncestorClippingMaskPhase))
82 break; 82 break;
83 83
84 if (layer->layoutObject()->hasOverflowClip() && 84 if (layer->layoutObject().hasOverflowClip() &&
85 layer->layoutObject()->style()->hasBorderRadius() && 85 layer->layoutObject().style()->hasBorderRadius() &&
86 inContainingBlockChain(&paintLayer, layer)) { 86 inContainingBlockChain(&paintLayer, layer)) {
87 LayoutPoint delta(fragmentOffset); 87 LayoutPoint delta(fragmentOffset);
88 layer->convertToLayerCoords(clipRoot, delta); 88 layer->convertToLayerCoords(clipRoot, delta);
89 89
90 // The PaintLayer's size is pixel-snapped if it is a LayoutBox. We can't 90 // The PaintLayer's size is pixel-snapped if it is a LayoutBox. We can't
91 // use a pre-snapped border rect for clipping, since 91 // use a pre-snapped border rect for clipping, since
92 // getRoundedInnerBorderFor assumes it has not been snapped yet. 92 // getRoundedInnerBorderFor assumes it has not been snapped yet.
93 LayoutSize size(layer->layoutBox() 93 LayoutSize size(layer->layoutBox()
94 ? toLayoutBox(layer->layoutObject())->size() 94 ? toLayoutBox(layer->layoutObject()).size()
95 : LayoutSize(layer->size())); 95 : LayoutSize(layer->size()));
96 roundedRectClips.push_back( 96 roundedRectClips.push_back(
97 layer->layoutObject()->style()->getRoundedInnerBorderFor( 97 layer->layoutObject().style()->getRoundedInnerBorderFor(
98 LayoutRect(delta, size))); 98 LayoutRect(delta, size)));
99 } 99 }
100 100
101 if (layer == clipRoot) 101 if (layer == clipRoot)
102 break; 102 break;
103 } 103 }
104 } 104 }
105 105
106 LayerClipRecorder::~LayerClipRecorder() { 106 LayerClipRecorder::~LayerClipRecorder() {
107 m_graphicsContext.getPaintController().endItem<EndClipDisplayItem>( 107 m_graphicsContext.getPaintController().endItem<EndClipDisplayItem>(
108 m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType)); 108 m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType));
109 } 109 }
110 110
111 } // namespace blink 111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698