1bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)/*
2bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * Copyright (C) 2013 Intel Corporation. All rights reserved.
4bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *
5bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *
7bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * Other contributors:
8bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *   Robert O'Callahan <roc+@cs.cmu.edu>
9bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *   David Baron <dbaron@fas.harvard.edu>
10bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *   Christian Biesinger <cbiesinger@web.de>
11bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *   Randall Jesup <rjesup@wgate.com>
12bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
13bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *   Josh Soref <timeless@mac.com>
14bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *   Boris Zbarsky <bzbarsky@mit.edu>
15bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *
16bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * This library is free software; you can redistribute it and/or
17bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * modify it under the terms of the GNU Lesser General Public
18bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * License as published by the Free Software Foundation; either
19bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * version 2.1 of the License, or (at your option) any later version.
20bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *
21bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * This library is distributed in the hope that it will be useful,
22bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * but WITHOUT ANY WARRANTY; without even the implied warranty of
23bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * Lesser General Public License for more details.
25bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *
26bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * You should have received a copy of the GNU Lesser General Public
27bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * License along with this library; if not, write to the Free Software
28bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
29bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) *
30bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * Alternatively, the contents of this file may be used under the terms
31bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * of either the Mozilla Public License Version 1.1, found at
32bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
33bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
34bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * (the "GPL"), in which case the provisions of the MPL or the GPL are
35bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * applicable instead of those above.  If you wish to allow use of your
36bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * version of this file only under the terms of one of those two
37bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * licenses (the MPL or the GPL) and not to allow others to use your
38bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * version of this file under the LGPL, indicate your decision by
39bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * deletingthe provisions above and replace them with the notice and
40bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * other provisions required by the MPL or the GPL, as the case may be.
41bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * If you do not delete the provisions above, a recipient may use your
42bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) * version of this file under any of the LGPL, the MPL or the GPL.
43bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) */
44bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
45bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#ifndef RenderLayerStackingNode_h
46bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#define RenderLayerStackingNode_h
47bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
48bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "core/rendering/RenderLayerModelObject.h"
49bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "wtf/Noncopyable.h"
50bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "wtf/OwnPtr.h"
51bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "wtf/Vector.h"
52bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
53c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
54bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
55bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)class RenderLayer;
56bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)class RenderLayerCompositor;
57bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)class RenderStyle;
58bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
59bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)class RenderLayerStackingNode {
60bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    WTF_MAKE_NONCOPYABLE(RenderLayerStackingNode);
61bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)public:
62bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    explicit RenderLayerStackingNode(RenderLayer*);
63f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    ~RenderLayerStackingNode();
64bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
65bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    int zIndex() const { return renderer()->style()->zIndex(); }
66bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
67bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    // A stacking context is a layer that has a non-auto z-index.
68d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    bool isStackingContext() const { return !renderer()->style()->hasAutoZIndex(); }
69bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
70bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    // Update our normal and z-index lists.
71bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void updateLayerListsIfNeeded();
72bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
73bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    bool zOrderListsDirty() const { return m_zOrderListsDirty; }
74bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void dirtyZOrderLists();
75bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void updateZOrderLists();
76bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void clearZOrderLists();
77d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    void dirtyStackingContextZOrderLists();
78bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
7951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList()->size(); }
80bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList()->size(); }
81bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
82d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    // FIXME: should check for dirtiness here?
83bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    bool isNormalFlowOnly() const { return m_isNormalFlowOnly; }
84bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void updateIsNormalFlowOnly();
85bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    bool normalFlowListDirty() const { return m_normalFlowListDirty; }
86bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void dirtyNormalFlowList();
87bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
88bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void updateStackingNodesAfterStyleChange(const RenderStyle* oldStyle);
89bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
90d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    RenderLayerStackingNode* ancestorStackingContextNode() const;
91f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)
92d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    // Gets the enclosing stacking context for this node, possibly the node
93d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    // itself, if it is a stacking context.
94d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    RenderLayerStackingNode* enclosingStackingContextNode() { return isStackingContext() ? this : ancestorStackingContextNode(); }
95f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)
96f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    RenderLayer* layer() const { return m_layer; }
97f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)
98197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#if ENABLE(ASSERT)
99bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
100bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = flag; }
101bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#endif
102bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
103bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)private:
10451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    friend class RenderLayerStackingNodeIterator;
10551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    friend class RenderLayerStackingNodeReverseIterator;
10651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    friend class RenderTreeAsText;
10751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)
10851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    Vector<RenderLayerStackingNode*>* posZOrderList() const
10951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    {
11051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)        ASSERT(!m_zOrderListsDirty);
111d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)        ASSERT(isStackingContext() || !m_posZOrderList);
11251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)        return m_posZOrderList.get();
11351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    }
11451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)
11551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    Vector<RenderLayerStackingNode*>* normalFlowList() const
11651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    {
11751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)        ASSERT(!m_normalFlowListDirty);
11851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)        return m_normalFlowList.get();
11951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    }
12051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)
12151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    Vector<RenderLayerStackingNode*>* negZOrderList() const
12251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    {
12351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)        ASSERT(!m_zOrderListsDirty);
124d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)        ASSERT(isStackingContext() || !m_negZOrderList);
12551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)        return m_negZOrderList.get();
12651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    }
12751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)
128bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void rebuildZOrderLists();
129d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    void collectLayers(OwnPtr<Vector<RenderLayerStackingNode*> >& posZOrderList, OwnPtr<Vector<RenderLayerStackingNode*> >& negZOrderList);
130bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
131197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#if ENABLE(ASSERT)
132f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    bool isInStackingParentZOrderLists() const;
133f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    bool isInStackingParentNormalFlowList() const;
134f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    void updateStackingParentForZOrderLists(RenderLayerStackingNode* stackingParent);
135f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    void updateStackingParentForNormalFlowList(RenderLayerStackingNode* stackingParent);
136f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    void setStackingParent(RenderLayerStackingNode* stackingParent) { m_stackingParent = stackingParent; }
137f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)#endif
138f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)
139bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    bool shouldBeNormalFlowOnly() const;
140bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
141bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    void updateNormalFlowList();
142bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
143d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackingContext(); }
14451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)
145bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    RenderLayerCompositor* compositor() const;
146bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    // FIXME: Investigate changing this to Renderbox.
147bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    RenderLayerModelObject* renderer() const;
148bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
149bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    RenderLayer* m_layer;
150bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
151f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // m_posZOrderList holds a sorted list of all the descendant nodes within
152f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // that have z-indices of 0 or greater (auto will count as 0).
153f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // m_negZOrderList holds descendants within our stacking context with
154f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // negative z-indices.
155f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    OwnPtr<Vector<RenderLayerStackingNode*> > m_posZOrderList;
156f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    OwnPtr<Vector<RenderLayerStackingNode*> > m_negZOrderList;
157bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
158f6b7aed3f7ce69aca0d7a032d144cbd088b04393Torne (Richard Coles)    // This list contains child nodes that cannot create stacking contexts.
159f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    OwnPtr<Vector<RenderLayerStackingNode*> > m_normalFlowList;
160bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
161bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    unsigned m_zOrderListsDirty : 1;
162bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    unsigned m_normalFlowListDirty: 1;
163bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    unsigned m_isNormalFlowOnly : 1;
164bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
165197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#if ENABLE(ASSERT)
166bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    unsigned m_layerListMutationAllowed : 1;
167f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    RenderLayerStackingNode* m_stackingParent;
168bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#endif
169bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)};
170bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
171bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)inline void RenderLayerStackingNode::clearZOrderLists()
172bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){
173d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    ASSERT(!isStackingContext());
174bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
175197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#if ENABLE(ASSERT)
176f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    updateStackingParentForZOrderLists(0);
177f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)#endif
178f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)
179bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    m_posZOrderList.clear();
180bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    m_negZOrderList.clear();
181bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)}
182bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
183bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)inline void RenderLayerStackingNode::updateZOrderLists()
184bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){
185bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    if (!m_zOrderListsDirty)
186bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        return;
187bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
188d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    if (!isStackingContext()) {
189bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        clearZOrderLists();
190bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        m_zOrderListsDirty = false;
191bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        return;
192bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    }
193bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
194bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    rebuildZOrderLists();
195bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)}
196bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
197197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#if ENABLE(ASSERT)
198bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)class LayerListMutationDetector {
199bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)public:
200bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    explicit LayerListMutationDetector(RenderLayerStackingNode* stackingNode)
201bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        : m_stackingNode(stackingNode)
202bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        , m_previousMutationAllowedState(stackingNode->layerListMutationAllowed())
203bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {
204bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        m_stackingNode->setLayerListMutationAllowed(false);
205bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    }
206bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
207bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    ~LayerListMutationDetector()
208bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {
209bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        m_stackingNode->setLayerListMutationAllowed(m_previousMutationAllowedState);
210bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    }
211bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
212bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)private:
213bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    RenderLayerStackingNode* m_stackingNode;
214bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    bool m_previousMutationAllowedState;
215bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)};
216bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#endif
217bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
218c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
219bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
220bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#endif // RenderLayerStackingNode_h
221