OLD | NEW |
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. | 7 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "core/frame/LocalFrame.h" | 28 #include "core/frame/LocalFrame.h" |
29 #include "core/layout/Layer.h" | 29 #include "core/layout/Layer.h" |
30 #include "core/layout/compositing/CompositedLayerMapping.h" | 30 #include "core/layout/compositing/CompositedLayerMapping.h" |
31 #include "core/rendering/RenderView.h" | 31 #include "core/rendering/RenderView.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 bool LayoutLayerModelObject::s_wasFloating = false; | 35 bool LayoutLayerModelObject::s_wasFloating = false; |
36 | 36 |
37 LayoutLayerModelObject::LayoutLayerModelObject(ContainerNode* node) | 37 LayoutLayerModelObject::LayoutLayerModelObject(ContainerNode* node) |
38 : RenderObject(node) | 38 : LayoutObject(node) |
39 { | 39 { |
40 } | 40 } |
41 | 41 |
42 LayoutLayerModelObject::~LayoutLayerModelObject() | 42 LayoutLayerModelObject::~LayoutLayerModelObject() |
43 { | 43 { |
44 // Our layer should have been destroyed and cleared by now | 44 // Our layer should have been destroyed and cleared by now |
45 ASSERT(!hasLayer()); | 45 ASSERT(!hasLayer()); |
46 ASSERT(!m_layer); | 46 ASSERT(!m_layer); |
47 } | 47 } |
48 | 48 |
(...skipping 26 matching lines...) Expand all Loading... |
75 if (isPositioned()) { | 75 if (isPositioned()) { |
76 // Don't use this->view() because the document's renderView has been set
to 0 during destruction. | 76 // Don't use this->view() because the document's renderView has been set
to 0 during destruction. |
77 if (LocalFrame* frame = this->frame()) { | 77 if (LocalFrame* frame = this->frame()) { |
78 if (FrameView* frameView = frame->view()) { | 78 if (FrameView* frameView = frame->view()) { |
79 if (style()->hasViewportConstrainedPosition()) | 79 if (style()->hasViewportConstrainedPosition()) |
80 frameView->removeViewportConstrainedObject(this); | 80 frameView->removeViewportConstrainedObject(this); |
81 } | 81 } |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 RenderObject::willBeDestroyed(); | 85 LayoutObject::willBeDestroyed(); |
86 | 86 |
87 destroyLayer(); | 87 destroyLayer(); |
88 } | 88 } |
89 | 89 |
90 void LayoutLayerModelObject::styleWillChange(StyleDifference diff, const RenderS
tyle& newStyle) | 90 void LayoutLayerModelObject::styleWillChange(StyleDifference diff, const RenderS
tyle& newStyle) |
91 { | 91 { |
92 s_wasFloating = isFloating(); | 92 s_wasFloating = isFloating(); |
93 | 93 |
94 if (RenderStyle* oldStyle = style()) { | 94 if (RenderStyle* oldStyle = style()) { |
95 if (parent() && diff.needsPaintInvalidationLayer()) { | 95 if (parent() && diff.needsPaintInvalidationLayer()) { |
96 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() | 96 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() |
97 || oldStyle->clip() != newStyle.clip()) | 97 || oldStyle->clip() != newStyle.clip()) |
98 layer()->clipper().clearClipRectsIncludingDescendants(); | 98 layer()->clipper().clearClipRectsIncludingDescendants(); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 RenderObject::styleWillChange(diff, newStyle); | 102 LayoutObject::styleWillChange(diff, newStyle); |
103 } | 103 } |
104 | 104 |
105 void LayoutLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt
yle* oldStyle) | 105 void LayoutLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt
yle* oldStyle) |
106 { | 106 { |
107 bool hadTransform = hasTransformRelatedProperty(); | 107 bool hadTransform = hasTransformRelatedProperty(); |
108 bool hadLayer = hasLayer(); | 108 bool hadLayer = hasLayer(); |
109 bool layerWasSelfPainting = hadLayer && layer()->isSelfPaintingLayer(); | 109 bool layerWasSelfPainting = hadLayer && layer()->isSelfPaintingLayer(); |
110 | 110 |
111 RenderObject::styleDidChange(diff, oldStyle); | 111 LayoutObject::styleDidChange(diff, oldStyle); |
112 updateFromStyle(); | 112 updateFromStyle(); |
113 | 113 |
114 LayerType type = layerTypeRequired(); | 114 LayerType type = layerTypeRequired(); |
115 if (type != NoLayer) { | 115 if (type != NoLayer) { |
116 if (!layer() && layerCreationAllowedForSubtree()) { | 116 if (!layer() && layerCreationAllowedForSubtree()) { |
117 if (s_wasFloating && isFloating()) | 117 if (s_wasFloating && isFloating()) |
118 setChildNeedsLayout(); | 118 setChildNeedsLayout(); |
119 createLayer(type); | 119 createLayer(type); |
120 if (parent() && !needsLayout()) { | 120 if (parent() && !needsLayout()) { |
121 // FIXME: We should call a specialized version of this function. | 121 // FIXME: We should call a specialized version of this function. |
(...skipping 30 matching lines...) Expand all Loading... |
152 frameView->removeViewportConstrainedObject(this); | 152 frameView->removeViewportConstrainedObject(this); |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 void LayoutLayerModelObject::addLayerHitTestRects(LayerHitTestRects& rects, cons
t Layer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& contain
erRect) const | 157 void LayoutLayerModelObject::addLayerHitTestRects(LayerHitTestRects& rects, cons
t Layer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& contain
erRect) const |
158 { | 158 { |
159 if (hasLayer()) { | 159 if (hasLayer()) { |
160 if (isRenderView()) { | 160 if (isRenderView()) { |
161 // RenderView is handled with a special fast-path, but it needs to k
now the current layer. | 161 // RenderView is handled with a special fast-path, but it needs to k
now the current layer. |
162 RenderObject::addLayerHitTestRects(rects, layer(), LayoutPoint(), La
youtRect()); | 162 LayoutObject::addLayerHitTestRects(rects, layer(), LayoutPoint(), La
youtRect()); |
163 } else { | 163 } else { |
164 // Since a RenderObject never lives outside it's container Layer, we
can switch | 164 // Since a LayoutObject never lives outside it's container Layer, we
can switch |
165 // to marking entire layers instead. This may sometimes mark more th
an necessary (when | 165 // to marking entire layers instead. This may sometimes mark more th
an necessary (when |
166 // a layer is made of disjoint objects) but in practice is a signifi
cant performance | 166 // a layer is made of disjoint objects) but in practice is a signifi
cant performance |
167 // savings. | 167 // savings. |
168 layer()->addLayerHitTestRects(rects); | 168 layer()->addLayerHitTestRects(rects); |
169 } | 169 } |
170 } else { | 170 } else { |
171 RenderObject::addLayerHitTestRects(rects, currentLayer, layerOffset, con
tainerRect); | 171 LayoutObject::addLayerHitTestRects(rects, currentLayer, layerOffset, con
tainerRect); |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 void LayoutLayerModelObject::invalidateTreeIfNeeded(const PaintInvalidationState
& paintInvalidationState) | 175 void LayoutLayerModelObject::invalidateTreeIfNeeded(const PaintInvalidationState
& paintInvalidationState) |
176 { | 176 { |
177 ASSERT(!needsLayout()); | 177 ASSERT(!needsLayout()); |
178 | 178 |
179 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) | 179 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) |
180 return; | 180 return; |
181 | 181 |
(...skipping 24 matching lines...) Expand all Loading... |
206 // Note: the subpixel accumulation of layer() does not need to be ad
ded here. It is already taken into account. | 206 // Note: the subpixel accumulation of layer() does not need to be ad
ded here. It is already taken into account. |
207 squashingLayer->setNeedsDisplayInRect(pixelSnappedIntRect(paintInval
idationRect), invalidationReason); | 207 squashingLayer->setNeedsDisplayInRect(pixelSnappedIntRect(paintInval
idationRect), invalidationReason); |
208 } | 208 } |
209 } else { | 209 } else { |
210 layer()->compositedLayerMapping()->setContentsNeedDisplayInRect(r, inval
idationReason); | 210 layer()->compositedLayerMapping()->setContentsNeedDisplayInRect(r, inval
idationReason); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 void LayoutLayerModelObject::addChildFocusRingRects(Vector<LayoutRect>& rects, c
onst LayoutPoint& additionalOffset) const | 214 void LayoutLayerModelObject::addChildFocusRingRects(Vector<LayoutRect>& rects, c
onst LayoutPoint& additionalOffset) const |
215 { | 215 { |
216 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) { | 216 for (LayoutObject* current = slowFirstChild(); current; current = current->n
extSibling()) { |
217 if (current->isText() || current->isListMarker()) | 217 if (current->isText() || current->isListMarker()) |
218 continue; | 218 continue; |
219 | 219 |
220 if (!current->isBox()) { | 220 if (!current->isBox()) { |
221 current->addFocusRingRects(rects, additionalOffset); | 221 current->addFocusRingRects(rects, additionalOffset); |
222 continue; | 222 continue; |
223 } | 223 } |
224 | 224 |
225 RenderBox* box = toRenderBox(current); | 225 RenderBox* box = toRenderBox(current); |
226 if (!box->hasLayer()) { | 226 if (!box->hasLayer()) { |
227 box->addFocusRingRects(rects, additionalOffset + box->locationOffset
()); | 227 box->addFocusRingRects(rects, additionalOffset + box->locationOffset
()); |
228 continue; | 228 continue; |
229 } | 229 } |
230 | 230 |
231 Vector<LayoutRect> layerFocusRingRects; | 231 Vector<LayoutRect> layerFocusRingRects; |
232 box->addFocusRingRects(layerFocusRingRects, LayoutPoint()); | 232 box->addFocusRingRects(layerFocusRingRects, LayoutPoint()); |
233 for (size_t i = 0; i < layerFocusRingRects.size(); ++i) { | 233 for (size_t i = 0; i < layerFocusRingRects.size(); ++i) { |
234 FloatQuad quadInBox = box->localToContainerQuad(FloatQuad(layerFocus
RingRects[i]), this); | 234 FloatQuad quadInBox = box->localToContainerQuad(FloatQuad(layerFocus
RingRects[i]), this); |
235 LayoutRect rect = LayoutRect(quadInBox.boundingBox()); | 235 LayoutRect rect = LayoutRect(quadInBox.boundingBox()); |
236 if (!rect.isEmpty()) { | 236 if (!rect.isEmpty()) { |
237 rect.moveBy(additionalOffset); | 237 rect.moveBy(additionalOffset); |
238 rects.append(rect); | 238 rects.append(rect); |
239 } | 239 } |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 } // namespace blink | 244 } // namespace blink |
245 | 245 |
OLD | NEW |