OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (!layoutObject->style()->hasBackground()) | 131 if (!layoutObject->style()->hasBackground()) |
132 return true; | 132 return true; |
133 | 133 |
134 // Simple background that is contained within the contents rect. | 134 // Simple background that is contained within the contents rect. |
135 return contentsRect(layoutObject).contains(backgroundRect(layoutObject)); | 135 return contentsRect(layoutObject).contains(backgroundRect(layoutObject)); |
136 } | 136 } |
137 | 137 |
138 static WebLayer* platformLayerForPlugin(LayoutObject* layoutObject) | 138 static WebLayer* platformLayerForPlugin(LayoutObject* layoutObject) |
139 { | 139 { |
140 if (!layoutObject->isEmbeddedObject()) | 140 if (!layoutObject->isEmbeddedObject()) |
141 return 0; | 141 return nullptr; |
142 Widget* widget = toLayoutEmbeddedObject(layoutObject)->widget(); | 142 Widget* widget = toLayoutEmbeddedObject(layoutObject)->widget(); |
143 if (!widget || !widget->isPluginView()) | 143 if (!widget || !widget->isPluginView()) |
144 return 0; | 144 return nullptr; |
145 return toPluginView(widget)->platformLayer(); | 145 return toPluginView(widget)->platformLayer(); |
146 | 146 |
147 } | 147 } |
148 | 148 |
149 static inline bool isAcceleratedContents(LayoutObject* layoutObject) | 149 static inline bool isAcceleratedContents(LayoutObject* layoutObject) |
150 { | 150 { |
151 return isAcceleratedCanvas(layoutObject) | 151 return isAcceleratedCanvas(layoutObject) |
152 || (layoutObject->isEmbeddedObject() && toLayoutEmbeddedObject(layoutObj
ect)->requiresAcceleratedCompositing()) | 152 || (layoutObject->isEmbeddedObject() && toLayoutEmbeddedObject(layoutObj
ect)->requiresAcceleratedCompositing()) |
153 || layoutObject->isVideo(); | 153 || layoutObject->isVideo(); |
154 } | 154 } |
155 | 155 |
156 // Get the scrolling coordinator in a way that works inside CompositedDeprecated
PaintLayerMapping's destructor. | 156 // Get the scrolling coordinator in a way that works inside CompositedDeprecated
PaintLayerMapping's destructor. |
157 static ScrollingCoordinator* scrollingCoordinatorFromLayer(DeprecatedPaintLayer&
layer) | 157 static ScrollingCoordinator* scrollingCoordinatorFromLayer(DeprecatedPaintLayer&
layer) |
158 { | 158 { |
159 Page* page = layer.layoutObject()->frame()->page(); | 159 Page* page = layer.layoutObject()->frame()->page(); |
160 if (!page) | 160 return (!page) ? nullptr : page->scrollingCoordinator(); |
161 return 0; | |
162 | |
163 return page->scrollingCoordinator(); | |
164 } | 161 } |
165 | 162 |
166 CompositedDeprecatedPaintLayerMapping::CompositedDeprecatedPaintLayerMapping(Dep
recatedPaintLayer& layer) | 163 CompositedDeprecatedPaintLayerMapping::CompositedDeprecatedPaintLayerMapping(Dep
recatedPaintLayer& layer) |
167 : m_owningLayer(layer) | 164 : m_owningLayer(layer) |
168 , m_contentOffsetInCompositingLayerDirty(false) | 165 , m_contentOffsetInCompositingLayerDirty(false) |
169 , m_pendingUpdateScope(GraphicsLayerUpdateNone) | 166 , m_pendingUpdateScope(GraphicsLayerUpdateNone) |
170 , m_isMainFrameLayoutViewLayer(false) | 167 , m_isMainFrameLayoutViewLayer(false) |
171 , m_backgroundLayerPaintsFixedRootBackground(false) | 168 , m_backgroundLayerPaintsFixedRootBackground(false) |
172 , m_scrollingContentsAreEmpty(false) | 169 , m_scrollingContentsAreEmpty(false) |
173 { | 170 { |
(...skipping 24 matching lines...) Expand all Loading... |
198 updateBackgroundLayer(false); | 195 updateBackgroundLayer(false); |
199 updateMaskLayer(false); | 196 updateMaskLayer(false); |
200 updateClippingMaskLayers(false); | 197 updateClippingMaskLayers(false); |
201 updateScrollingLayers(false); | 198 updateScrollingLayers(false); |
202 updateSquashingLayers(false); | 199 updateSquashingLayers(false); |
203 destroyGraphicsLayers(); | 200 destroyGraphicsLayers(); |
204 } | 201 } |
205 | 202 |
206 PassOwnPtr<GraphicsLayer> CompositedDeprecatedPaintLayerMapping::createGraphicsL
ayer(CompositingReasons reasons) | 203 PassOwnPtr<GraphicsLayer> CompositedDeprecatedPaintLayerMapping::createGraphicsL
ayer(CompositingReasons reasons) |
207 { | 204 { |
208 GraphicsLayerFactory* graphicsLayerFactory = 0; | 205 GraphicsLayerFactory* graphicsLayerFactory = nullptr; |
209 if (Page* page = layoutObject()->frame()->page()) | 206 if (Page* page = layoutObject()->frame()->page()) |
210 graphicsLayerFactory = page->chromeClient().graphicsLayerFactory(); | 207 graphicsLayerFactory = page->chromeClient().graphicsLayerFactory(); |
211 | 208 |
212 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac
tory, this); | 209 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac
tory, this); |
213 | 210 |
214 graphicsLayer->setCompositingReasons(reasons); | 211 graphicsLayer->setCompositingReasons(reasons); |
215 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) | 212 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) |
216 graphicsLayer->setOwnerNodeId(DOMNodeIds::idForNode(owningNode)); | 213 graphicsLayer->setOwnerNodeId(DOMNodeIds::idForNode(owningNode)); |
217 | 214 |
218 return graphicsLayer.release(); | 215 return graphicsLayer.release(); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 else if (isAcceleratedContents(layoutObject)) | 496 else if (isAcceleratedContents(layoutObject)) |
500 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay
er.get()); | 497 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay
er.get()); |
501 } | 498 } |
502 | 499 |
503 if (m_owningLayer.reflectionInfo()) { | 500 if (m_owningLayer.reflectionInfo()) { |
504 if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedDepr
ecatedPaintLayerMapping()) { | 501 if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedDepr
ecatedPaintLayerMapping()) { |
505 GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->ref
lectionLayer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer(); | 502 GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->ref
lectionLayer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer(); |
506 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); | 503 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); |
507 } | 504 } |
508 } else { | 505 } else { |
509 m_graphicsLayer->setReplicatedByLayer(0); | 506 m_graphicsLayer->setReplicatedByLayer(nullptr); |
510 } | 507 } |
511 | 508 |
512 updateBackgroundColor(); | 509 updateBackgroundColor(); |
513 | 510 |
514 if (layoutObject->isImage()) { | 511 if (layoutObject->isImage()) { |
515 if (isDirectlyCompositedImage()) { | 512 if (isDirectlyCompositedImage()) { |
516 updateImageContents(); | 513 updateImageContents(); |
517 } else if (m_graphicsLayer->hasContentsLayer()) { | 514 } else if (m_graphicsLayer->hasContentsLayer()) { |
518 m_graphicsLayer->setContentsToImage(0); | 515 m_graphicsLayer->setContentsToImage(nullptr); |
519 } | 516 } |
520 } | 517 } |
521 | 518 |
522 if (WebLayer* layer = platformLayerForPlugin(layoutObject)) { | 519 if (WebLayer* layer = platformLayerForPlugin(layoutObject)) { |
523 m_graphicsLayer->setContentsToPlatformLayer(layer); | 520 m_graphicsLayer->setContentsToPlatformLayer(layer); |
524 } else if (layoutObject->node() && layoutObject->node()->isFrameOwnerElement
() && toHTMLFrameOwnerElement(layoutObject->node())->contentFrame()) { | 521 } else if (layoutObject->node() && layoutObject->node()->isFrameOwnerElement
() && toHTMLFrameOwnerElement(layoutObject->node())->contentFrame()) { |
525 Frame* frame = toHTMLFrameOwnerElement(layoutObject->node())->contentFra
me(); | 522 Frame* frame = toHTMLFrameOwnerElement(layoutObject->node())->contentFra
me(); |
526 if (frame->isRemoteFrame()) { | 523 if (frame->isRemoteFrame()) { |
527 WebLayer* layer = toRemoteFrame(frame)->remotePlatformLayer(); | 524 WebLayer* layer = toRemoteFrame(frame)->remotePlatformLayer(); |
528 m_graphicsLayer->setContentsToPlatformLayer(layer); | 525 m_graphicsLayer->setContentsToPlatformLayer(layer); |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 layer->invalidateDisplayItemClient(displayItemClient); | 2044 layer->invalidateDisplayItemClient(displayItemClient); |
2048 }, ApplyToContentLayers); | 2045 }, ApplyToContentLayers); |
2049 } | 2046 } |
2050 | 2047 |
2051 const GraphicsLayerPaintInfo* CompositedDeprecatedPaintLayerMapping::containingS
quashedLayer(const LayoutObject* layoutObject, const Vector<GraphicsLayerPaintIn
fo>& layers, unsigned maxSquashedLayerIndex) | 2048 const GraphicsLayerPaintInfo* CompositedDeprecatedPaintLayerMapping::containingS
quashedLayer(const LayoutObject* layoutObject, const Vector<GraphicsLayerPaintIn
fo>& layers, unsigned maxSquashedLayerIndex) |
2052 { | 2049 { |
2053 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2050 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
2054 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) | 2051 if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject())) |
2055 return &layers[i]; | 2052 return &layers[i]; |
2056 } | 2053 } |
2057 return 0; | 2054 return nullptr; |
2058 } | 2055 } |
2059 | 2056 |
2060 const GraphicsLayerPaintInfo* CompositedDeprecatedPaintLayerMapping::containingS
quashedLayer(const LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) | 2057 const GraphicsLayerPaintInfo* CompositedDeprecatedPaintLayerMapping::containingS
quashedLayer(const LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) |
2061 { | 2058 { |
2062 return CompositedDeprecatedPaintLayerMapping::containingSquashedLayer(layout
Object, m_squashedLayers, maxSquashedLayerIndex); | 2059 return CompositedDeprecatedPaintLayerMapping::containingSquashedLayer(layout
Object, m_squashedLayers, maxSquashedLayerIndex); |
2063 } | 2060 } |
2064 | 2061 |
2065 IntRect CompositedDeprecatedPaintLayerMapping::localClipRectForSquashedLayer(con
st DeprecatedPaintLayer& referenceLayer, const GraphicsLayerPaintInfo& paintInfo
, const Vector<GraphicsLayerPaintInfo>& layers) | 2062 IntRect CompositedDeprecatedPaintLayerMapping::localClipRectForSquashedLayer(con
st DeprecatedPaintLayer& referenceLayer, const GraphicsLayerPaintInfo& paintInfo
, const Vector<GraphicsLayerPaintInfo>& layers) |
2066 { | 2063 { |
2067 const LayoutObject* clippingContainer = paintInfo.paintLayer->clippingContai
ner(); | 2064 const LayoutObject* clippingContainer = paintInfo.paintLayer->clippingContai
ner(); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2345 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2342 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2346 name = "Scrolling Block Selection Layer"; | 2343 name = "Scrolling Block Selection Layer"; |
2347 } else { | 2344 } else { |
2348 ASSERT_NOT_REACHED(); | 2345 ASSERT_NOT_REACHED(); |
2349 } | 2346 } |
2350 | 2347 |
2351 return name; | 2348 return name; |
2352 } | 2349 } |
2353 | 2350 |
2354 } // namespace blink | 2351 } // namespace blink |
OLD | NEW |