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

Side by Side Diff: sky/engine/core/rendering/RenderLayerModelObject.cpp

Issue 953673002: Delete RenderLayerModelObject. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
(Empty)
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010, 2012 Google Inc. All rights reserved.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 */
24
25 #include "sky/engine/config.h"
26 #include "sky/engine/core/rendering/RenderLayerModelObject.h"
27
28 #include "sky/engine/core/frame/LocalFrame.h"
29 #include "sky/engine/core/rendering/RenderLayer.h"
30 #include "sky/engine/core/rendering/RenderView.h"
31
32 namespace blink {
33
34 RenderLayerModelObject::RenderLayerModelObject(ContainerNode* node)
35 : RenderObject(node)
36 {
37 }
38
39 RenderLayerModelObject::~RenderLayerModelObject()
40 {
41 // Our layer should have been destroyed and cleared by now
42 ASSERT(!hasLayer());
43 ASSERT(!m_layer);
44 }
45
46 void RenderLayerModelObject::destroyLayer()
47 {
48 setHasLayer(false);
49 m_layer = nullptr;
50 }
51
52 void RenderLayerModelObject::createLayer(LayerType type)
53 {
54 ASSERT(!m_layer);
55 m_layer = adoptPtr(new RenderLayer(this, type));
56 setHasLayer(true);
57 m_layer->insertOnlyThisLayer();
58 }
59
60 bool RenderLayerModelObject::hasSelfPaintingLayer() const
61 {
62 return m_layer && m_layer->isSelfPaintingLayer();
63 }
64
65 void RenderLayerModelObject::collectSelfPaintingLayers(Vector<RenderBox*>& layer s)
66 {
67 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
68 if (child->isBox()) {
69 RenderBox* childBox = toRenderBox(child);
70 if (childBox->hasSelfPaintingLayer())
71 layers.append(childBox);
72 else
73 childBox->collectSelfPaintingLayers(layers);
74 } else if (child->isLayerModelObject()) {
75 toRenderLayerModelObject(child)->collectSelfPaintingLayers(layers);
76 }
77 }
78 }
79
80 void RenderLayerModelObject::willBeDestroyed()
81 {
82 RenderObject::willBeDestroyed();
83 destroyLayer();
84 }
85
86 void RenderLayerModelObject::styleWillChange(StyleDifference diff, const RenderS tyle& newStyle)
87 {
88 if (RenderStyle* oldStyle = style()) {
89 if (parent()) {
90 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip()
91 || oldStyle->clip() != newStyle.clip())
92 layer()->clipper().clearClipRectsIncludingDescendants();
93 }
94 }
95
96 RenderObject::styleWillChange(diff, newStyle);
97 }
98
99 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt yle* oldStyle)
100 {
101 bool hadTransform = hasTransform();
102
103 RenderObject::styleDidChange(diff, oldStyle);
104 updateFromStyle();
105
106 LayerType type = layerTypeRequired();
107 if (type != NoLayer) {
108 if (!layer()) {
109 createLayer(type);
110 if (parent() && !needsLayout()) {
111 // FIXME: We should call a specialized version of this function.
112 layer()->updateLayerPositionsAfterLayout();
113 }
114 }
115 } else if (layer() && layer()->parent()) {
116 setHasTransform(false); // Either a transform wasn't specified or the ob ject doesn't support transforms, so just null out the bit.
117 layer()->removeOnlyThisLayer(); // calls destroyLayer() which clears m_l ayer
118 if (hadTransform)
119 setNeedsLayoutAndPrefWidthsRecalc();
120 }
121
122 if (layer()) {
123 // FIXME: Ideally we shouldn't need this setter but we can't easily infe r an overflow-only layer
124 // from the style.
125 layer()->setLayerType(type);
126 layer()->styleChanged(diff, oldStyle);
127 }
128 }
129
130 } // namespace blink
131
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayerModelObject.h ('k') | sky/engine/core/rendering/RenderLayerStackingNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698