OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 30 matching lines...) Expand all Loading... |
41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
42 */ | 42 */ |
43 | 43 |
44 #include "core/paint/PaintLayerStackingNode.h" | 44 #include "core/paint/PaintLayerStackingNode.h" |
45 | 45 |
46 #include "core/layout/LayoutMultiColumnFlowThread.h" | 46 #include "core/layout/LayoutMultiColumnFlowThread.h" |
47 #include "core/layout/LayoutView.h" | 47 #include "core/layout/LayoutView.h" |
48 #include "core/layout/compositing/PaintLayerCompositor.h" | 48 #include "core/layout/compositing/PaintLayerCompositor.h" |
49 #include "core/paint/PaintLayer.h" | 49 #include "core/paint/PaintLayer.h" |
50 #include "public/platform/Platform.h" | 50 #include "public/platform/Platform.h" |
51 #include "wtf/PtrUtil.h" | |
52 #include <algorithm> | 51 #include <algorithm> |
53 #include <memory> | |
54 | 52 |
55 namespace blink { | 53 namespace blink { |
56 | 54 |
57 // FIXME: This should not require PaintLayer. There is currently a cycle where | 55 // FIXME: This should not require PaintLayer. There is currently a cycle where |
58 // in order to determine if we isStacked() we have to ask the paint | 56 // in order to determine if we isStacked() we have to ask the paint |
59 // layer about some of its state. | 57 // layer about some of its state. |
60 PaintLayerStackingNode::PaintLayerStackingNode(PaintLayer* layer) | 58 PaintLayerStackingNode::PaintLayerStackingNode(PaintLayer* layer) |
61 : m_layer(layer) | 59 : m_layer(layer) |
62 #if ENABLE(ASSERT) | 60 #if ENABLE(ASSERT) |
63 , m_layerListMutationAllowed(true) | 61 , m_layerListMutationAllowed(true) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // If the viewport is paginated, everything (including "top-layer" eleme
nts) gets | 141 // If the viewport is paginated, everything (including "top-layer" eleme
nts) gets |
144 // redirected to the flow thread. So that's where we have to look, in th
at case. | 142 // redirected to the flow thread. So that's where we have to look, in th
at case. |
145 if (LayoutBlockFlow* multiColumnFlowThread = rootBlock->multiColumnFlowT
hread()) | 143 if (LayoutBlockFlow* multiColumnFlowThread = rootBlock->multiColumnFlowT
hread()) |
146 rootBlock = multiColumnFlowThread; | 144 rootBlock = multiColumnFlowThread; |
147 for (LayoutObject* child = rootBlock->firstChild(); child; child = child
->nextSibling()) { | 145 for (LayoutObject* child = rootBlock->firstChild(); child; child = child
->nextSibling()) { |
148 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; | 146 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; |
149 if (childElement && childElement->isInTopLayer()) { | 147 if (childElement && childElement->isInTopLayer()) { |
150 PaintLayer* layer = toLayoutBoxModelObject(child)->layer(); | 148 PaintLayer* layer = toLayoutBoxModelObject(child)->layer(); |
151 // Create the buffer if it doesn't exist yet. | 149 // Create the buffer if it doesn't exist yet. |
152 if (!m_posZOrderList) | 150 if (!m_posZOrderList) |
153 m_posZOrderList = wrapUnique(new Vector<PaintLayerStackingNo
de*>); | 151 m_posZOrderList = adoptPtr(new Vector<PaintLayerStackingNode
*>); |
154 m_posZOrderList->append(layer->stackingNode()); | 152 m_posZOrderList->append(layer->stackingNode()); |
155 } | 153 } |
156 } | 154 } |
157 } | 155 } |
158 | 156 |
159 #if ENABLE(ASSERT) | 157 #if ENABLE(ASSERT) |
160 updateStackingParentForZOrderLists(this); | 158 updateStackingParentForZOrderLists(this); |
161 #endif | 159 #endif |
162 | 160 |
163 m_zOrderListsDirty = false; | 161 m_zOrderListsDirty = false; |
164 } | 162 } |
165 | 163 |
166 void PaintLayerStackingNode::collectLayers(std::unique_ptr<Vector<PaintLayerStac
kingNode*>>& posBuffer, std::unique_ptr<Vector<PaintLayerStackingNode*>>& negBuf
fer) | 164 void PaintLayerStackingNode::collectLayers(OwnPtr<Vector<PaintLayerStackingNode*
>>& posBuffer, OwnPtr<Vector<PaintLayerStackingNode*>>& negBuffer) |
167 { | 165 { |
168 if (layer()->isInTopLayer()) | 166 if (layer()->isInTopLayer()) |
169 return; | 167 return; |
170 | 168 |
171 if (isStacked()) { | 169 if (isStacked()) { |
172 std::unique_ptr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >=
0) ? posBuffer : negBuffer; | 170 OwnPtr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posB
uffer : negBuffer; |
173 if (!buffer) | 171 if (!buffer) |
174 buffer = wrapUnique(new Vector<PaintLayerStackingNode*>); | 172 buffer = adoptPtr(new Vector<PaintLayerStackingNode*>); |
175 buffer->append(this); | 173 buffer->append(this); |
176 } | 174 } |
177 | 175 |
178 if (!isStackingContext()) { | 176 if (!isStackingContext()) { |
179 for (PaintLayer* child = layer()->firstChild(); child; child = child->ne
xtSibling()) { | 177 for (PaintLayer* child = layer()->firstChild(); child; child = child->ne
xtSibling()) { |
180 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect
ionLayer() != child) | 178 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect
ionLayer() != child) |
181 child->stackingNode()->collectLayers(posBuffer, negBuffer); | 179 child->stackingNode()->collectLayers(posBuffer, negBuffer); |
182 } | 180 } |
183 } | 181 } |
184 } | 182 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 255 } |
258 return 0; | 256 return 0; |
259 } | 257 } |
260 | 258 |
261 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const | 259 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const |
262 { | 260 { |
263 return m_layer->layoutObject(); | 261 return m_layer->layoutObject(); |
264 } | 262 } |
265 | 263 |
266 } // namespace blink | 264 } // namespace blink |
OLD | NEW |