| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 static inline bool isAcceleratedContents(LayoutObject* renderer) | 151 static inline bool isAcceleratedContents(LayoutObject* renderer) |
| 152 { | 152 { |
| 153 return isAcceleratedCanvas(renderer) | 153 return isAcceleratedCanvas(renderer) |
| 154 || (renderer->isEmbeddedObject() && toLayoutEmbeddedObject(renderer)->re
quiresAcceleratedCompositing()) | 154 || (renderer->isEmbeddedObject() && toLayoutEmbeddedObject(renderer)->re
quiresAcceleratedCompositing()) |
| 155 || renderer->isVideo(); | 155 || renderer->isVideo(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi
ng's destructor. | 158 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi
ng's destructor. |
| 159 static ScrollingCoordinator* scrollingCoordinatorFromLayer(Layer& layer) | 159 static ScrollingCoordinator* scrollingCoordinatorFromLayer(Layer& layer) |
| 160 { | 160 { |
| 161 Page* page = layer.renderer()->frame()->page(); | 161 Page* page = layer.layoutObject()->frame()->page(); |
| 162 if (!page) | 162 if (!page) |
| 163 return 0; | 163 return 0; |
| 164 | 164 |
| 165 return page->scrollingCoordinator(); | 165 return page->scrollingCoordinator(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 CompositedLayerMapping::CompositedLayerMapping(Layer& layer) | 168 CompositedLayerMapping::CompositedLayerMapping(Layer& layer) |
| 169 : m_owningLayer(layer) | 169 : m_owningLayer(layer) |
| 170 , m_contentOffsetInCompositingLayerDirty(false) | 170 , m_contentOffsetInCompositingLayerDirty(false) |
| 171 , m_pendingUpdateScope(GraphicsLayerUpdateNone) | 171 , m_pendingUpdateScope(GraphicsLayerUpdateNone) |
| 172 , m_isMainFrameLayoutViewLayer(false) | 172 , m_isMainFrameLayoutViewLayer(false) |
| 173 , m_backgroundLayerPaintsFixedRootBackground(false) | 173 , m_backgroundLayerPaintsFixedRootBackground(false) |
| 174 , m_scrollingContentsAreEmpty(false) | 174 , m_scrollingContentsAreEmpty(false) |
| 175 { | 175 { |
| 176 if (layer.isRootLayer() && renderer()->frame()->isMainFrame()) | 176 if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame()) |
| 177 m_isMainFrameLayoutViewLayer = true; | 177 m_isMainFrameLayoutViewLayer = true; |
| 178 | 178 |
| 179 createPrimaryGraphicsLayer(); | 179 createPrimaryGraphicsLayer(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 CompositedLayerMapping::~CompositedLayerMapping() | 182 CompositedLayerMapping::~CompositedLayerMapping() |
| 183 { | 183 { |
| 184 // Hits in compositing/squashing/squash-onto-nephew.html. | 184 // Hits in compositing/squashing/squash-onto-nephew.html. |
| 185 DisableCompositingQueryAsserts disabler; | 185 DisableCompositingQueryAsserts disabler; |
| 186 | 186 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 201 updateMaskLayer(false); | 201 updateMaskLayer(false); |
| 202 updateClippingMaskLayers(false); | 202 updateClippingMaskLayers(false); |
| 203 updateScrollingLayers(false); | 203 updateScrollingLayers(false); |
| 204 updateSquashingLayers(false); | 204 updateSquashingLayers(false); |
| 205 destroyGraphicsLayers(); | 205 destroyGraphicsLayers(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compositin
gReasons reasons) | 208 PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compositin
gReasons reasons) |
| 209 { | 209 { |
| 210 GraphicsLayerFactory* graphicsLayerFactory = 0; | 210 GraphicsLayerFactory* graphicsLayerFactory = 0; |
| 211 if (Page* page = renderer()->frame()->page()) | 211 if (Page* page = layoutObject()->frame()->page()) |
| 212 graphicsLayerFactory = page->chrome().client().graphicsLayerFactory(); | 212 graphicsLayerFactory = page->chrome().client().graphicsLayerFactory(); |
| 213 | 213 |
| 214 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac
tory, this); | 214 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac
tory, this); |
| 215 | 215 |
| 216 graphicsLayer->setCompositingReasons(reasons); | 216 graphicsLayer->setCompositingReasons(reasons); |
| 217 if (Node* owningNode = m_owningLayer.renderer()->generatingNode()) | 217 if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode()) |
| 218 graphicsLayer->setOwnerNodeId(InspectorNodeIds::idForNode(owningNode)); | 218 graphicsLayer->setOwnerNodeId(InspectorNodeIds::idForNode(owningNode)); |
| 219 | 219 |
| 220 return graphicsLayer.release(); | 220 return graphicsLayer.release(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void CompositedLayerMapping::createPrimaryGraphicsLayer() | 223 void CompositedLayerMapping::createPrimaryGraphicsLayer() |
| 224 { | 224 { |
| 225 m_graphicsLayer = createGraphicsLayer(m_owningLayer.compositingReasons()); | 225 m_graphicsLayer = createGraphicsLayer(m_owningLayer.compositingReasons()); |
| 226 | 226 |
| 227 #if !OS(ANDROID) | 227 #if !OS(ANDROID) |
| 228 if (m_isMainFrameLayoutViewLayer) | 228 if (m_isMainFrameLayoutViewLayer) |
| 229 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true
); | 229 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true
); |
| 230 #endif | 230 #endif |
| 231 | 231 |
| 232 updateOpacity(renderer()->styleRef()); | 232 updateOpacity(layoutObject()->styleRef()); |
| 233 updateTransform(renderer()->styleRef()); | 233 updateTransform(layoutObject()->styleRef()); |
| 234 updateFilters(renderer()->styleRef()); | 234 updateFilters(layoutObject()->styleRef()); |
| 235 | 235 |
| 236 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { | 236 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
| 237 updateLayerBlendMode(renderer()->styleRef()); | 237 updateLayerBlendMode(layoutObject()->styleRef()); |
| 238 updateIsRootForIsolatedGroup(); | 238 updateIsRootForIsolatedGroup(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 updateScrollBlocksOn(renderer()->styleRef()); | 241 updateScrollBlocksOn(layoutObject()->styleRef()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void CompositedLayerMapping::destroyGraphicsLayers() | 244 void CompositedLayerMapping::destroyGraphicsLayers() |
| 245 { | 245 { |
| 246 if (m_graphicsLayer) | 246 if (m_graphicsLayer) |
| 247 m_graphicsLayer->removeFromParent(); | 247 m_graphicsLayer->removeFromParent(); |
| 248 | 248 |
| 249 m_ancestorClippingLayer = nullptr; | 249 m_ancestorClippingLayer = nullptr; |
| 250 m_graphicsLayer = nullptr; | 250 m_graphicsLayer = nullptr; |
| 251 m_foregroundLayer = nullptr; | 251 m_foregroundLayer = nullptr; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 264 { | 264 { |
| 265 m_graphicsLayer->setOpacity(compositingOpacity(style.opacity())); | 265 m_graphicsLayer->setOpacity(compositingOpacity(style.opacity())); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void CompositedLayerMapping::updateTransform(const LayoutStyle& style) | 268 void CompositedLayerMapping::updateTransform(const LayoutStyle& style) |
| 269 { | 269 { |
| 270 // FIXME: This could use m_owningLayer.transform(), but that currently has t
ransform-origin | 270 // FIXME: This could use m_owningLayer.transform(), but that currently has t
ransform-origin |
| 271 // baked into it, and we don't want that. | 271 // baked into it, and we don't want that. |
| 272 TransformationMatrix t; | 272 TransformationMatrix t; |
| 273 if (m_owningLayer.hasTransformRelatedProperty()) { | 273 if (m_owningLayer.hasTransformRelatedProperty()) { |
| 274 style.applyTransform(t, LayoutSize(toLayoutBox(renderer())->pixelSnapped
Size()), LayoutStyle::ExcludeTransformOrigin); | 274 style.applyTransform(t, LayoutSize(toLayoutBox(layoutObject())->pixelSna
ppedSize()), LayoutStyle::ExcludeTransformOrigin); |
| 275 makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing()); | 275 makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 m_graphicsLayer->setTransform(t); | 278 m_graphicsLayer->setTransform(t); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void CompositedLayerMapping::updateFilters(const LayoutStyle& style) | 281 void CompositedLayerMapping::updateFilters(const LayoutStyle& style) |
| 282 { | 282 { |
| 283 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style)); | 283 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style)); |
| 284 } | 284 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 306 | 306 |
| 307 if (RuntimeEnabledFeatures::cssScrollBlocksOnEnabled()) | 307 if (RuntimeEnabledFeatures::cssScrollBlocksOnEnabled()) |
| 308 blockingMode = style.scrollBlocksOn(); | 308 blockingMode = style.scrollBlocksOn(); |
| 309 | 309 |
| 310 m_graphicsLayer->setScrollBlocksOn(blockingMode); | 310 m_graphicsLayer->setScrollBlocksOn(blockingMode); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void CompositedLayerMapping::updateContentsOpaque() | 313 void CompositedLayerMapping::updateContentsOpaque() |
| 314 { | 314 { |
| 315 ASSERT(m_isMainFrameLayoutViewLayer || !m_backgroundLayer); | 315 ASSERT(m_isMainFrameLayoutViewLayer || !m_backgroundLayer); |
| 316 if (isAcceleratedCanvas(renderer())) { | 316 if (isAcceleratedCanvas(layoutObject())) { |
| 317 // Determine whether the rendering context's external texture layer is o
paque. | 317 // Determine whether the rendering context's external texture layer is o
paque. |
| 318 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node()
)->renderingContext(); | 318 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no
de())->renderingContext(); |
| 319 if (!context->hasAlpha()) | 319 if (!context->hasAlpha()) |
| 320 m_graphicsLayer->setContentsOpaque(true); | 320 m_graphicsLayer->setContentsOpaque(true); |
| 321 else if (WebLayer* layer = context->platformLayer()) | 321 else if (WebLayer* layer = context->platformLayer()) |
| 322 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()).
hasAlpha()); | 322 m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()).
hasAlpha()); |
| 323 else | 323 else |
| 324 m_graphicsLayer->setContentsOpaque(false); | 324 m_graphicsLayer->setContentsOpaque(false); |
| 325 } else if (m_backgroundLayer) { | 325 } else if (m_backgroundLayer) { |
| 326 m_graphicsLayer->setContentsOpaque(false); | 326 m_graphicsLayer->setContentsOpaque(false); |
| 327 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe
OpaqueInRect(compositedBounds())); | 327 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe
OpaqueInRect(compositedBounds())); |
| 328 } else { | 328 } else { |
| 329 // For non-root layers, background is always painted by the primary grap
hics layer. | 329 // For non-root layers, background is always painted by the primary grap
hics layer. |
| 330 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp
aqueInRect(compositedBounds())); | 330 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp
aqueInRect(compositedBounds())); |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 void CompositedLayerMapping::updateCompositedBounds() | 334 void CompositedLayerMapping::updateCompositedBounds() |
| 335 { | 335 { |
| 336 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); | 336 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); |
| 337 // FIXME: if this is really needed for performance, it would be better to st
ore it on Layer. | 337 // FIXME: if this is really needed for performance, it would be better to st
ore it on Layer. |
| 338 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); | 338 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); |
| 339 m_contentOffsetInCompositingLayerDirty = true; | 339 m_contentOffsetInCompositingLayerDirty = true; |
| 340 } | 340 } |
| 341 | 341 |
| 342 void CompositedLayerMapping::updateAfterPartResize() | 342 void CompositedLayerMapping::updateAfterPartResize() |
| 343 { | 343 { |
| 344 if (renderer()->isLayoutPart()) { | 344 if (layoutObject()->isLayoutPart()) { |
| 345 if (LayerCompositor* innerCompositor = LayerCompositor::frameContentsCom
positor(toLayoutPart(renderer()))) { | 345 if (LayerCompositor* innerCompositor = LayerCompositor::frameContentsCom
positor(toLayoutPart(layoutObject()))) { |
| 346 innerCompositor->frameViewDidChangeSize(); | 346 innerCompositor->frameViewDidChangeSize(); |
| 347 // We can floor this point because our frameviews are always aligned
to pixel boundaries. | 347 // We can floor this point because our frameviews are always aligned
to pixel boundaries. |
| 348 ASSERT(m_compositedBounds.location() == flooredIntPoint(m_composited
Bounds.location())); | 348 ASSERT(m_compositedBounds.location() == flooredIntPoint(m_composited
Bounds.location())); |
| 349 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents
Box().location())); | 349 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents
Box().location())); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 | 353 |
| 354 void CompositedLayerMapping::updateCompositingReasons() | 354 void CompositedLayerMapping::updateCompositingReasons() |
| 355 { | 355 { |
| 356 // All other layers owned by this mapping will have the same compositing rea
son | 356 // All other layers owned by this mapping will have the same compositing rea
son |
| 357 // for their lifetime, so they are initialized only when created. | 357 // for their lifetime, so they are initialized only when created. |
| 358 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons()); | 358 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons()); |
| 359 } | 359 } |
| 360 | 360 |
| 361 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor
() | 361 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor
() |
| 362 { | 362 { |
| 363 if (!m_owningLayer.parent()) | 363 if (!m_owningLayer.parent()) |
| 364 return false; | 364 return false; |
| 365 | 365 |
| 366 const Layer* compositingAncestor = m_owningLayer.enclosingLayerWithComposite
dLayerMapping(ExcludeSelf); | 366 const Layer* compositingAncestor = m_owningLayer.enclosingLayerWithComposite
dLayerMapping(ExcludeSelf); |
| 367 if (!compositingAncestor) | 367 if (!compositingAncestor) |
| 368 return false; | 368 return false; |
| 369 | 369 |
| 370 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); | 370 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); |
| 371 if (!clippingContainer) | 371 if (!clippingContainer) |
| 372 return false; | 372 return false; |
| 373 | 373 |
| 374 if (compositingAncestor->renderer()->isDescendantOf(clippingContainer)) | 374 if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer)) |
| 375 return false; | 375 return false; |
| 376 | 376 |
| 377 // We ignore overflow clip here; we want composited overflow content to | 377 // We ignore overflow clip here; we want composited overflow content to |
| 378 // behave as if it lives in an unclipped universe so it can prepaint, etc. | 378 // behave as if it lives in an unclipped universe so it can prepaint, etc. |
| 379 // This means that we need to check if we are actually clipped before | 379 // This means that we need to check if we are actually clipped before |
| 380 // setting up m_ancestorClippingLayer otherwise | 380 // setting up m_ancestorClippingLayer otherwise |
| 381 // updateAncestorClippingLayerGeometry will fail as the clip rect will be | 381 // updateAncestorClippingLayerGeometry will fail as the clip rect will be |
| 382 // infinite. | 382 // infinite. |
| 383 // FIXME: this should use cached clip rects, but this sometimes give | 383 // FIXME: this should use cached clip rects, but this sometimes give |
| 384 // inaccurate results (and trips the ASSERTS in LayerClipper). | 384 // inaccurate results (and trips the ASSERTS in LayerClipper). |
| (...skipping 10 matching lines...) Expand all Loading... |
| 395 // Note carefully: here we assume that the compositing state of all descenda
nts have been updated already, | 395 // Note carefully: here we assume that the compositing state of all descenda
nts have been updated already, |
| 396 // so it is legitimate to compute and cache the composited bounds for this l
ayer. | 396 // so it is legitimate to compute and cache the composited bounds for this l
ayer. |
| 397 updateCompositedBounds(); | 397 updateCompositedBounds(); |
| 398 | 398 |
| 399 if (LayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { | 399 if (LayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { |
| 400 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) | 400 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) |
| 401 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); | 401 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 LayerCompositor* compositor = this->compositor(); | 404 LayerCompositor* compositor = this->compositor(); |
| 405 LayoutObject* renderer = this->renderer(); | 405 LayoutObject* renderer = this->layoutObject(); |
| 406 | 406 |
| 407 bool layerConfigChanged = false; | 407 bool layerConfigChanged = false; |
| 408 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr
oundLayer(&m_owningLayer)); | 408 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr
oundLayer(&m_owningLayer)); |
| 409 | 409 |
| 410 // The background layer is currently only used for fixed root backgrounds. | 410 // The background layer is currently only used for fixed root backgrounds. |
| 411 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) | 411 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) |
| 412 layerConfigChanged = true; | 412 layerConfigChanged = true; |
| 413 | 413 |
| 414 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) | 414 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) |
| 415 layerConfigChanged = true; | 415 layerConfigChanged = true; |
| 416 | 416 |
| 417 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants
(&m_owningLayer); | 417 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants
(&m_owningLayer); |
| 418 | 418 |
| 419 // Our scrolling layer will clip. | 419 // Our scrolling layer will clip. |
| 420 if (m_owningLayer.needsCompositedScrolling()) | 420 if (m_owningLayer.needsCompositedScrolling()) |
| 421 needsDescendantsClippingLayer = false; | 421 needsDescendantsClippingLayer = false; |
| 422 | 422 |
| 423 Layer* scrollParent = compositor->preferCompositingToLCDTextEnabled() ? m_ow
ningLayer.scrollParent() : 0; | 423 Layer* scrollParent = compositor->preferCompositingToLCDTextEnabled() ? m_ow
ningLayer.scrollParent() : 0; |
| 424 | 424 |
| 425 // This is required because compositing layers are parented | 425 // This is required because compositing layers are parented |
| 426 // according to the z-order hierarchy, yet clipping goes down the renderer h
ierarchy. | 426 // according to the z-order hierarchy, yet clipping goes down the renderer h
ierarchy. |
| 427 // Thus, a Layer can be clipped by a Layer that is an ancestor in the render
er hierarchy, | 427 // Thus, a Layer can be clipped by a Layer that is an ancestor in the render
er hierarchy, |
| 428 // but a sibling in the z-order hierarchy. Further, that sibling need not be
composited at all. | 428 // but a sibling in the z-order hierarchy. Further, that sibling need not be
composited at all. |
| 429 // In such scenarios, an ancestor clipping layer is necessary to apply the c
omposited clip for this layer. | 429 // In such scenarios, an ancestor clipping layer is necessary to apply the c
omposited clip for this layer. |
| 430 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor
(); | 430 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor
(); |
| 431 | 431 |
| 432 if (scrollParent) { | 432 if (scrollParent) { |
| 433 // If our containing block is our ancestor scrolling layer, then we'll a
lready be clipped | 433 // If our containing block is our ancestor scrolling layer, then we'll a
lready be clipped |
| 434 // to it via our scroll parent and we don't need an ancestor clipping la
yer. | 434 // to it via our scroll parent and we don't need an ancestor clipping la
yer. |
| 435 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o
wningLayer.ancestorScrollingLayer()) | 435 if (m_owningLayer.layoutObject()->containingBlock()->enclosingLayer() ==
m_owningLayer.ancestorScrollingLayer()) |
| 436 needsAncestorClip = false; | 436 needsAncestorClip = false; |
| 437 } | 437 } |
| 438 | 438 |
| 439 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) | 439 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) |
| 440 layerConfigChanged = true; | 440 layerConfigChanged = true; |
| 441 | 441 |
| 442 bool scrollingConfigChanged = false; | 442 bool scrollingConfigChanged = false; |
| 443 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { | 443 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { |
| 444 layerConfigChanged = true; | 444 layerConfigChanged = true; |
| 445 scrollingConfigChanged = true; | 445 scrollingConfigChanged = true; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // offset to be. | 629 // offset to be. |
| 630 for (size_t i = 0; i < layers.size(); ++i) { | 630 for (size_t i = 0; i < layers.size(); ++i) { |
| 631 const LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers
[i].renderLayer->computeOffsetFromTransformedAncestor(); | 631 const LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers
[i].renderLayer->computeOffsetFromTransformedAncestor(); |
| 632 const LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAnc
estorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOri
ginInOwningLayerSpace; | 632 const LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAnc
estorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOri
ginInOwningLayerSpace; |
| 633 | 633 |
| 634 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid
th().round(), offsetFromSquashLayerOrigin.height().round()); | 634 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid
th().round(), offsetFromSquashLayerOrigin.height().round()); |
| 635 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse
tFromRenderer; | 635 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse
tFromRenderer; |
| 636 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n
ewOffsetFromRenderer) { | 636 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n
ewOffsetFromRenderer) { |
| 637 // It is ok to issue paint invalidation here, because all of the geo
metry needed to correctly invalidate paint is computed by this point. | 637 // It is ok to issue paint invalidation here, because all of the geo
metry needed to correctly invalidate paint is computed by this point. |
| 638 DisablePaintInvalidationStateAsserts disabler; | 638 DisablePaintInvalidationStateAsserts disabler; |
| 639 layers[i].renderLayer->renderer()->invalidatePaintIncludingNonCompos
itingDescendants(); | 639 layers[i].renderLayer->layoutObject()->invalidatePaintIncludingNonCo
mpositingDescendants(); |
| 640 | 640 |
| 641 TRACE_LAYER_INVALIDATION(layers[i].renderLayer, InspectorLayerInvali
dationTrackingEvent::SquashingLayerGeometryWasUpdated); | 641 TRACE_LAYER_INVALIDATION(layers[i].renderLayer, InspectorLayerInvali
dationTrackingEvent::SquashingLayerGeometryWasUpdated); |
| 642 layersNeedingPaintInvalidation.append(layers[i].renderLayer); | 642 layersNeedingPaintInvalidation.append(layers[i].renderLayer); |
| 643 } | 643 } |
| 644 layers[i].offsetFromRenderer = newOffsetFromRenderer; | 644 layers[i].offsetFromRenderer = newOffsetFromRenderer; |
| 645 layers[i].offsetFromRendererSet = true; | 645 layers[i].offsetFromRendererSet = true; |
| 646 | 646 |
| 647 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation); | 647 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation); |
| 648 } | 648 } |
| 649 | 649 |
| 650 squashingLayer->setPosition(squashLayerBounds.location()); | 650 squashingLayer->setPosition(squashLayerBounds.location()); |
| 651 squashingLayer->setSize(squashLayerBounds.size()); | 651 squashingLayer->setSize(squashLayerBounds.size()); |
| 652 | 652 |
| 653 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; | 653 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; |
| 654 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); | 654 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); |
| 655 | 655 |
| 656 for (size_t i = 0; i < layers.size(); ++i) | 656 for (size_t i = 0; i < layers.size(); ++i) |
| 657 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(
referenceLayer, layers[i], layers); | 657 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(
referenceLayer, layers[i], layers); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void CompositedLayerMapping::updateGraphicsLayerGeometry(const Layer* compositin
gContainer, const Layer* compositingStackingContext, Vector<Layer*>& layersNeedi
ngPaintInvalidation) | 660 void CompositedLayerMapping::updateGraphicsLayerGeometry(const Layer* compositin
gContainer, const Layer* compositingStackingContext, Vector<Layer*>& layersNeedi
ngPaintInvalidation) |
| 661 { | 661 { |
| 662 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); | 662 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); |
| 663 | 663 |
| 664 // Set transform property, if it is not animating. We have to do this here b
ecause the transform | 664 // Set transform property, if it is not animating. We have to do this here b
ecause the transform |
| 665 // is affected by the layer dimensions. | 665 // is affected by the layer dimensions. |
| 666 if (!renderer()->style()->isRunningTransformAnimationOnCompositor()) | 666 if (!layoutObject()->style()->isRunningTransformAnimationOnCompositor()) |
| 667 updateTransform(renderer()->styleRef()); | 667 updateTransform(layoutObject()->styleRef()); |
| 668 | 668 |
| 669 // Set opacity, if it is not animating. | 669 // Set opacity, if it is not animating. |
| 670 if (!renderer()->style()->isRunningOpacityAnimationOnCompositor()) | 670 if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor()) |
| 671 updateOpacity(renderer()->styleRef()); | 671 updateOpacity(layoutObject()->styleRef()); |
| 672 | 672 |
| 673 if (!renderer()->style()->isRunningFilterAnimationOnCompositor()) | 673 if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor()) |
| 674 updateFilters(renderer()->styleRef()); | 674 updateFilters(layoutObject()->styleRef()); |
| 675 | 675 |
| 676 // We compute everything relative to the enclosing compositing layer. | 676 // We compute everything relative to the enclosing compositing layer. |
| 677 IntRect ancestorCompositingBounds; | 677 IntRect ancestorCompositingBounds; |
| 678 if (compositingContainer) { | 678 if (compositingContainer) { |
| 679 ASSERT(compositingContainer->hasCompositedLayerMapping()); | 679 ASSERT(compositingContainer->hasCompositedLayerMapping()); |
| 680 ancestorCompositingBounds = compositingContainer->compositedLayerMapping
()->pixelSnappedCompositedBounds(); | 680 ancestorCompositingBounds = compositingContainer->compositedLayerMapping
()->pixelSnappedCompositedBounds(); |
| 681 } | 681 } |
| 682 | 682 |
| 683 IntRect localCompositingBounds; | 683 IntRect localCompositingBounds; |
| 684 IntRect relativeCompositingBounds; | 684 IntRect relativeCompositingBounds; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 695 | 695 |
| 696 FloatSize contentsSize = relativeCompositingBounds.size(); | 696 FloatSize contentsSize = relativeCompositingBounds.size(); |
| 697 | 697 |
| 698 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); | 698 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); |
| 699 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
graphicsLayerParentLocation); | 699 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
graphicsLayerParentLocation); |
| 700 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); | 700 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); |
| 701 | 701 |
| 702 // If we have a layer that clips children, position it. | 702 // If we have a layer that clips children, position it. |
| 703 IntRect clippingBox; | 703 IntRect clippingBox; |
| 704 if (m_childContainmentLayer) | 704 if (m_childContainmentLayer) |
| 705 clippingBox = clipBox(toLayoutBox(renderer())); | 705 clippingBox = clipBox(toLayoutBox(layoutObject())); |
| 706 | 706 |
| 707 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); | 707 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); |
| 708 updateChildTransformLayerGeometry(); | 708 updateChildTransformLayerGeometry(); |
| 709 | 709 |
| 710 updateMaskLayerGeometry(); | 710 updateMaskLayerGeometry(); |
| 711 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi
tingBounds); | 711 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi
tingBounds); |
| 712 updateForegroundLayerGeometry(contentsSize, clippingBox); | 712 updateForegroundLayerGeometry(contentsSize, clippingBox); |
| 713 updateBackgroundLayerGeometry(contentsSize); | 713 updateBackgroundLayerGeometry(contentsSize); |
| 714 updateReflectionLayerGeometry(layersNeedingPaintInvalidation); | 714 updateReflectionLayerGeometry(layersNeedingPaintInvalidation); |
| 715 updateScrollingLayerGeometry(localCompositingBounds); | 715 updateScrollingLayerGeometry(localCompositingBounds); |
| 716 updateChildClippingMaskLayerGeometry(); | 716 updateChildClippingMaskLayerGeometry(); |
| 717 | 717 |
| 718 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll
sOverflow()) | 718 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll
sOverflow()) |
| 719 m_owningLayer.scrollableArea()->positionOverflowControls(); | 719 m_owningLayer.scrollableArea()->positionOverflowControls(); |
| 720 | 720 |
| 721 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { | 721 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
| 722 updateLayerBlendMode(renderer()->styleRef()); | 722 updateLayerBlendMode(layoutObject()->styleRef()); |
| 723 updateIsRootForIsolatedGroup(); | 723 updateIsRootForIsolatedGroup(); |
| 724 } | 724 } |
| 725 | 725 |
| 726 updateContentsRect(); | 726 updateContentsRect(); |
| 727 updateBackgroundColor(); | 727 updateBackgroundColor(); |
| 728 updateDrawsContent(); | 728 updateDrawsContent(); |
| 729 updateContentsOpaque(); | 729 updateContentsOpaque(); |
| 730 updateAfterPartResize(); | 730 updateAfterPartResize(); |
| 731 updateRenderingContext(); | 731 updateRenderingContext(); |
| 732 updateShouldFlattenTransform(); | 732 updateShouldFlattenTransform(); |
| 733 updateChildrenTransform(); | 733 updateChildrenTransform(); |
| 734 updateScrollParent(compositor()->preferCompositingToLCDTextEnabled() ? m_own
ingLayer.scrollParent() : 0); | 734 updateScrollParent(compositor()->preferCompositingToLCDTextEnabled() ? m_own
ingLayer.scrollParent() : 0); |
| 735 registerScrollingLayers(); | 735 registerScrollingLayers(); |
| 736 | 736 |
| 737 updateScrollBlocksOn(renderer()->styleRef()); | 737 updateScrollBlocksOn(layoutObject()->styleRef()); |
| 738 | 738 |
| 739 updateCompositingReasons(); | 739 updateCompositingReasons(); |
| 740 } | 740 } |
| 741 | 741 |
| 742 void CompositedLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& rela
tiveCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& gr
aphicsLayerParentLocation) | 742 void CompositedLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& rela
tiveCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& gr
aphicsLayerParentLocation) |
| 743 { | 743 { |
| 744 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location()
- graphicsLayerParentLocation)); | 744 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location()
- graphicsLayerParentLocation)); |
| 745 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca
tion())); | 745 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca
tion())); |
| 746 | 746 |
| 747 FloatSize oldSize = m_graphicsLayer->size(); | 747 FloatSize oldSize = m_graphicsLayer->size(); |
| 748 const IntSize& contentsSize = relativeCompositingBounds.size(); | 748 const IntSize& contentsSize = relativeCompositingBounds.size(); |
| 749 if (oldSize != contentsSize) | 749 if (oldSize != contentsSize) |
| 750 m_graphicsLayer->setSize(contentsSize); | 750 m_graphicsLayer->setSize(contentsSize); |
| 751 | 751 |
| 752 // m_graphicsLayer is the corresponding GraphicsLayer for this Layer and its
non-compositing | 752 // m_graphicsLayer is the corresponding GraphicsLayer for this Layer and its
non-compositing |
| 753 // descendants. So, the visibility flag for m_graphicsLayer should be true i
f there are any | 753 // descendants. So, the visibility flag for m_graphicsLayer should be true i
f there are any |
| 754 // non-compositing visible layers. | 754 // non-compositing visible layers. |
| 755 bool contentsVisible = m_owningLayer.hasVisibleContent() || hasVisibleNonCom
positingDescendant(&m_owningLayer); | 755 bool contentsVisible = m_owningLayer.hasVisibleContent() || hasVisibleNonCom
positingDescendant(&m_owningLayer); |
| 756 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i
sVideo()) { | 756 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && layoutObject(
)->isVideo()) { |
| 757 HTMLVideoElement* videoElement = toHTMLVideoElement(renderer()->node()); | 757 HTMLVideoElement* videoElement = toHTMLVideoElement(layoutObject()->node
()); |
| 758 if (videoElement->isFullscreen() && !HTMLMediaElement::isMediaStreamURL(
videoElement->sourceURL().string())) | 758 if (videoElement->isFullscreen() && !HTMLMediaElement::isMediaStreamURL(
videoElement->sourceURL().string())) |
| 759 contentsVisible = false; | 759 contentsVisible = false; |
| 760 } | 760 } |
| 761 m_graphicsLayer->setContentsVisible(contentsVisible); | 761 m_graphicsLayer->setContentsVisible(contentsVisible); |
| 762 | 762 |
| 763 m_graphicsLayer->setBackfaceVisibility(renderer()->style()->backfaceVisibili
ty() == BackfaceVisibilityVisible); | 763 m_graphicsLayer->setBackfaceVisibility(layoutObject()->style()->backfaceVisi
bility() == BackfaceVisibilityVisible); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void CompositedLayerMapping::computeGraphicsLayerParentLocation(const Layer* com
positingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsL
ayerParentLocation) | 766 void CompositedLayerMapping::computeGraphicsLayerParentLocation(const Layer* com
positingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsL
ayerParentLocation) |
| 767 { | 767 { |
| 768 if (compositingContainer && compositingContainer->compositedLayerMapping()->
hasClippingLayer()) { | 768 if (compositingContainer && compositingContainer->compositedLayerMapping()->
hasClippingLayer()) { |
| 769 // If the compositing ancestor has a layer to clip children, we parent i
n that, and therefore | 769 // If the compositing ancestor has a layer to clip children, we parent i
n that, and therefore |
| 770 // position relative to it. | 770 // position relative to it. |
| 771 IntRect clippingBox = clipBox(toLayoutBox(compositingContainer->renderer
())); | 771 IntRect clippingBox = clipBox(toLayoutBox(compositingContainer->layoutOb
ject())); |
| 772 graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(co
mpositingContainer->subpixelAccumulation()); | 772 graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(co
mpositingContainer->subpixelAccumulation()); |
| 773 } else if (compositingContainer && compositingContainer->compositedLayerMapp
ing()->childTransformLayer()) { | 773 } else if (compositingContainer && compositingContainer->compositedLayerMapp
ing()->childTransformLayer()) { |
| 774 // Similarly, if the compositing ancestor has a child transform layer, w
e parent in that, and therefore | 774 // Similarly, if the compositing ancestor has a child transform layer, w
e parent in that, and therefore |
| 775 // position relative to it. It's already taken into account the contents
offset, so we do not need to here. | 775 // position relative to it. It's already taken into account the contents
offset, so we do not need to here. |
| 776 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp
ixelAccumulation()); | 776 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp
ixelAccumulation()); |
| 777 } else if (compositingContainer) { | 777 } else if (compositingContainer) { |
| 778 graphicsLayerParentLocation = ancestorCompositingBounds.location(); | 778 graphicsLayerParentLocation = ancestorCompositingBounds.location(); |
| 779 } else { | 779 } else { |
| 780 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio
n(); | 780 graphicsLayerParentLocation = layoutObject()->view()->documentRect().loc
ation(); |
| 781 } | 781 } |
| 782 | 782 |
| 783 if (compositingContainer && compositingContainer->needsCompositedScrolling()
) { | 783 if (compositingContainer && compositingContainer->needsCompositedScrolling()
) { |
| 784 LayoutBox* layoutBox = toLayoutBox(compositingContainer->renderer()); | 784 LayoutBox* layoutBox = toLayoutBox(compositingContainer->layoutObject())
; |
| 785 IntSize scrollOffset = layoutBox->scrolledContentOffset(); | 785 IntSize scrollOffset = layoutBox->scrolledContentOffset(); |
| 786 IntPoint scrollOrigin(layoutBox->borderLeft(), layoutBox->borderTop()); | 786 IntPoint scrollOrigin(layoutBox->borderLeft(), layoutBox->borderTop()); |
| 787 graphicsLayerParentLocation = scrollOrigin - scrollOffset; | 787 graphicsLayerParentLocation = scrollOrigin - scrollOffset; |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 | 790 |
| 791 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const Layer* co
mpositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoin
t& graphicsLayerParentLocation) | 791 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const Layer* co
mpositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoin
t& graphicsLayerParentLocation) |
| 792 { | 792 { |
| 793 if (!compositingContainer || !m_ancestorClippingLayer) | 793 if (!compositingContainer || !m_ancestorClippingLayer) |
| 794 return; | 794 return; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 823 LayoutPoint offset; | 823 LayoutPoint offset; |
| 824 compositingContainer->convertToLayerCoords(compositingStackingCo
ntext, offset); | 824 compositingContainer->convertToLayerCoords(compositingStackingCo
ntext, offset); |
| 825 FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(o
ffset)); | 825 FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(o
ffset)); |
| 826 position += offsetFromStackingContainer; | 826 position += offsetFromStackingContainer; |
| 827 } | 827 } |
| 828 | 828 |
| 829 m_overflowControlsClippingLayer->setPosition(position); | 829 m_overflowControlsClippingLayer->setPosition(position); |
| 830 } else { | 830 } else { |
| 831 // The controls are in the same 2D space as the compositing containe
r, so we can map them into the space of the container. | 831 // The controls are in the same 2D space as the compositing containe
r, so we can map them into the space of the container. |
| 832 TransformState transformState(TransformState::ApplyTransformDirectio
n, FloatPoint()); | 832 TransformState transformState(TransformState::ApplyTransformDirectio
n, FloatPoint()); |
| 833 m_owningLayer.renderer()->mapLocalToContainer(compositingStackingCon
text->renderer(), transformState, ApplyContainerFlip); | 833 m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackin
gContext->layoutObject(), transformState, ApplyContainerFlip); |
| 834 transformState.flatten(); | 834 transformState.flatten(); |
| 835 LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState
.lastPlanarPoint()); | 835 LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState
.lastPlanarPoint()); |
| 836 if (LayerScrollableArea* scrollableArea = compositingStackingContext
->scrollableArea()) | 836 if (LayerScrollableArea* scrollableArea = compositingStackingContext
->scrollableArea()) |
| 837 offsetFromStackingContainer.move(LayoutSize(scrollableArea->adju
stedScrollOffset())); | 837 offsetFromStackingContainer.move(LayoutSize(scrollableArea->adju
stedScrollOffset())); |
| 838 m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStacki
ngContainer)); | 838 m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStacki
ngContainer)); |
| 839 } | 839 } |
| 840 } else { | 840 } else { |
| 841 m_overflowControlsHostLayer->setPosition(FloatPoint()); | 841 m_overflowControlsHostLayer->setPosition(FloatPoint()); |
| 842 } | 842 } |
| 843 } | 843 } |
| 844 | 844 |
| 845 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect&
clippingBox, const IntRect& localCompositingBounds) | 845 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect&
clippingBox, const IntRect& localCompositingBounds) |
| 846 { | 846 { |
| 847 if (!m_childContainmentLayer) | 847 if (!m_childContainmentLayer) |
| 848 return; | 848 return; |
| 849 | 849 |
| 850 m_childContainmentLayer->setPosition(FloatPoint(clippingBox.location() - loc
alCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulati
on()))); | 850 m_childContainmentLayer->setPosition(FloatPoint(clippingBox.location() - loc
alCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulati
on()))); |
| 851 m_childContainmentLayer->setSize(clippingBox.size()); | 851 m_childContainmentLayer->setSize(clippingBox.size()); |
| 852 m_childContainmentLayer->setOffsetFromRenderer(toIntSize(clippingBox.locatio
n())); | 852 m_childContainmentLayer->setOffsetFromRenderer(toIntSize(clippingBox.locatio
n())); |
| 853 if (m_childClippingMaskLayer && !m_scrollingLayer && !renderer()->style()->c
lipPath()) { | 853 if (m_childClippingMaskLayer && !m_scrollingLayer && !layoutObject()->style(
)->clipPath()) { |
| 854 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position(
)); | 854 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position(
)); |
| 855 m_childClippingMaskLayer->setSize(m_childContainmentLayer->size()); | 855 m_childClippingMaskLayer->setSize(m_childContainmentLayer->size()); |
| 856 m_childClippingMaskLayer->setOffsetFromRenderer(m_childContainmentLayer-
>offsetFromRenderer()); | 856 m_childClippingMaskLayer->setOffsetFromRenderer(m_childContainmentLayer-
>offsetFromRenderer()); |
| 857 } | 857 } |
| 858 } | 858 } |
| 859 | 859 |
| 860 void CompositedLayerMapping::updateChildTransformLayerGeometry() | 860 void CompositedLayerMapping::updateChildTransformLayerGeometry() |
| 861 { | 861 { |
| 862 if (!m_childTransformLayer) | 862 if (!m_childTransformLayer) |
| 863 return; | 863 return; |
| 864 const IntRect borderBox = toLayoutBox(m_owningLayer.renderer())->pixelSnappe
dBorderBoxRect(); | 864 const IntRect borderBox = toLayoutBox(m_owningLayer.layoutObject())->pixelSn
appedBorderBoxRect(); |
| 865 m_childTransformLayer->setSize(borderBox.size()); | 865 m_childTransformLayer->setSize(borderBox.size()); |
| 866 m_childTransformLayer->setPosition(FloatPoint(contentOffsetInCompositingLaye
r())); | 866 m_childTransformLayer->setPosition(FloatPoint(contentOffsetInCompositingLaye
r())); |
| 867 } | 867 } |
| 868 | 868 |
| 869 void CompositedLayerMapping::updateMaskLayerGeometry() | 869 void CompositedLayerMapping::updateMaskLayerGeometry() |
| 870 { | 870 { |
| 871 if (!m_maskLayer) | 871 if (!m_maskLayer) |
| 872 return; | 872 return; |
| 873 | 873 |
| 874 if (m_maskLayer->size() != m_graphicsLayer->size()) { | 874 if (m_maskLayer->size() != m_graphicsLayer->size()) { |
| 875 m_maskLayer->setSize(m_graphicsLayer->size()); | 875 m_maskLayer->setSize(m_graphicsLayer->size()); |
| 876 m_maskLayer->setNeedsDisplay(); | 876 m_maskLayer->setNeedsDisplay(); |
| 877 } | 877 } |
| 878 m_maskLayer->setPosition(FloatPoint()); | 878 m_maskLayer->setPosition(FloatPoint()); |
| 879 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()); | 879 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()); |
| 880 } | 880 } |
| 881 | 881 |
| 882 void CompositedLayerMapping::updateTransformGeometry(const IntPoint& snappedOffs
etFromCompositedAncestor, const IntRect& relativeCompositingBounds) | 882 void CompositedLayerMapping::updateTransformGeometry(const IntPoint& snappedOffs
etFromCompositedAncestor, const IntRect& relativeCompositingBounds) |
| 883 { | 883 { |
| 884 if (m_owningLayer.hasTransformRelatedProperty()) { | 884 if (m_owningLayer.hasTransformRelatedProperty()) { |
| 885 const LayoutRect borderBox = toLayoutBox(renderer())->borderBoxRect(); | 885 const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect(
); |
| 886 | 886 |
| 887 // Get layout bounds in the coords of compositingContainer to match rela
tiveCompositingBounds. | 887 // Get layout bounds in the coords of compositingContainer to match rela
tiveCompositingBounds. |
| 888 IntRect layerBounds = pixelSnappedIntRect(toLayoutPoint(m_owningLayer.su
bpixelAccumulation()), borderBox.size()); | 888 IntRect layerBounds = pixelSnappedIntRect(toLayoutPoint(m_owningLayer.su
bpixelAccumulation()), borderBox.size()); |
| 889 layerBounds.moveBy(snappedOffsetFromCompositedAncestor); | 889 layerBounds.moveBy(snappedOffsetFromCompositedAncestor); |
| 890 | 890 |
| 891 // Update properties that depend on layer dimensions | 891 // Update properties that depend on layer dimensions |
| 892 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); | 892 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); |
| 893 | 893 |
| 894 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the | 894 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the |
| 895 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. | 895 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 915 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref
lectionInfo()->reflectionLayer()->compositedLayerMapping(); | 915 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref
lectionInfo()->reflectionLayer()->compositedLayerMapping(); |
| 916 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer
, &m_owningLayer, layersNeedingPaintInvalidation); | 916 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer
, &m_owningLayer, layersNeedingPaintInvalidation); |
| 917 } | 917 } |
| 918 | 918 |
| 919 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) | 919 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) |
| 920 { | 920 { |
| 921 if (!m_scrollingLayer) | 921 if (!m_scrollingLayer) |
| 922 return; | 922 return; |
| 923 | 923 |
| 924 ASSERT(m_scrollingContentsLayer); | 924 ASSERT(m_scrollingContentsLayer); |
| 925 LayoutBox* layoutBox = toLayoutBox(renderer()); | 925 LayoutBox* layoutBox = toLayoutBox(layoutObject()); |
| 926 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); | 926 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); |
| 927 DoubleSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedSc
rollOffset(); | 927 DoubleSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedSc
rollOffset(); |
| 928 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localComposi
tingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()))); | 928 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localComposi
tingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()))); |
| 929 m_scrollingLayer->setSize(clientBox.size()); | 929 m_scrollingLayer->setSize(clientBox.size()); |
| 930 | 930 |
| 931 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer(); | 931 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer(); |
| 932 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location())); | 932 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location())); |
| 933 | 933 |
| 934 if (m_childClippingMaskLayer && !renderer()->style()->clipPath()) { | 934 if (m_childClippingMaskLayer && !layoutObject()->style()->clipPath()) { |
| 935 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); | 935 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); |
| 936 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); | 936 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); |
| 937 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.loca
tion())); | 937 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.loca
tion())); |
| 938 } | 938 } |
| 939 | 939 |
| 940 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->o
ffsetFromRenderer(); | 940 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->o
ffsetFromRenderer(); |
| 941 | 941 |
| 942 IntSize scrollSize(layoutBox->scrollWidth(), layoutBox->scrollHeight()); | 942 IntSize scrollSize(layoutBox->scrollWidth(), layoutBox->scrollHeight()); |
| 943 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged
) | 943 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged
) |
| 944 m_scrollingContentsLayer->setNeedsDisplay(); | 944 m_scrollingContentsLayer->setNeedsDisplay(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 960 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); | 960 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); |
| 961 m_foregroundLayer->setNeedsDisplay(); | 961 m_foregroundLayer->setNeedsDisplay(); |
| 962 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offse
tFromRenderer()); | 962 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offse
tFromRenderer()); |
| 963 } | 963 } |
| 964 | 964 |
| 965 updateScrollingBlockSelection(); | 965 updateScrollingBlockSelection(); |
| 966 } | 966 } |
| 967 | 967 |
| 968 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() | 968 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() |
| 969 { | 969 { |
| 970 if (!m_childClippingMaskLayer || !renderer()->style()->clipPath()) | 970 if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath()) |
| 971 return; | 971 return; |
| 972 LayoutBox* layoutBox = toLayoutBox(renderer()); | 972 LayoutBox* layoutBox = toLayoutBox(layoutObject()); |
| 973 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); | 973 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); |
| 974 | 974 |
| 975 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position()); | 975 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position()); |
| 976 m_childClippingMaskLayer->setSize(m_graphicsLayer->size()); | 976 m_childClippingMaskLayer->setSize(m_graphicsLayer->size()); |
| 977 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.location
())); | 977 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.location
())); |
| 978 | 978 |
| 979 // NOTE: also some stuff happening in updateChildContainmentLayerGeometry(). | 979 // NOTE: also some stuff happening in updateChildContainmentLayerGeometry(). |
| 980 } | 980 } |
| 981 | 981 |
| 982 void CompositedLayerMapping::updateForegroundLayerGeometry(const FloatSize& rela
tiveCompositingBoundsSize, const IntRect& clippingBox) | 982 void CompositedLayerMapping::updateForegroundLayerGeometry(const FloatSize& rela
tiveCompositingBoundsSize, const IntRect& clippingBox) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1013 // NOTE: there is some more configuring going on in updateScrollingLayerGeom
etry(). | 1013 // NOTE: there is some more configuring going on in updateScrollingLayerGeom
etry(). |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void CompositedLayerMapping::updateBackgroundLayerGeometry(const FloatSize& rela
tiveCompositingBoundsSize) | 1016 void CompositedLayerMapping::updateBackgroundLayerGeometry(const FloatSize& rela
tiveCompositingBoundsSize) |
| 1017 { | 1017 { |
| 1018 if (!m_backgroundLayer) | 1018 if (!m_backgroundLayer) |
| 1019 return; | 1019 return; |
| 1020 | 1020 |
| 1021 FloatSize backgroundSize = relativeCompositingBoundsSize; | 1021 FloatSize backgroundSize = relativeCompositingBoundsSize; |
| 1022 if (backgroundLayerPaintsFixedRootBackground()) { | 1022 if (backgroundLayerPaintsFixedRootBackground()) { |
| 1023 FrameView* frameView = toLayoutView(renderer())->frameView(); | 1023 FrameView* frameView = toLayoutView(layoutObject())->frameView(); |
| 1024 backgroundSize = frameView->visibleContentRect().size(); | 1024 backgroundSize = frameView->visibleContentRect().size(); |
| 1025 } | 1025 } |
| 1026 m_backgroundLayer->setPosition(FloatPoint()); | 1026 m_backgroundLayer->setPosition(FloatPoint()); |
| 1027 if (backgroundSize != m_backgroundLayer->size()) { | 1027 if (backgroundSize != m_backgroundLayer->size()) { |
| 1028 m_backgroundLayer->setSize(backgroundSize); | 1028 m_backgroundLayer->setSize(backgroundSize); |
| 1029 m_backgroundLayer->setNeedsDisplay(); | 1029 m_backgroundLayer->setNeedsDisplay(); |
| 1030 } | 1030 } |
| 1031 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer
()); | 1031 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer
()); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 void CompositedLayerMapping::updateDrawsContent() | 1194 void CompositedLayerMapping::updateDrawsContent() |
| 1195 { | 1195 { |
| 1196 bool hasPaintedContent = containsPaintedContent(); | 1196 bool hasPaintedContent = containsPaintedContent(); |
| 1197 m_graphicsLayer->setDrawsContent(hasPaintedContent); | 1197 m_graphicsLayer->setDrawsContent(hasPaintedContent); |
| 1198 | 1198 |
| 1199 if (m_scrollingLayer) { | 1199 if (m_scrollingLayer) { |
| 1200 // m_scrollingLayer never has backing store. | 1200 // m_scrollingLayer never has backing store. |
| 1201 // m_scrollingContentsLayer only needs backing store if the scrolled con
tents need to paint. | 1201 // m_scrollingContentsLayer only needs backing store if the scrolled con
tents need to paint. |
| 1202 m_scrollingContentsAreEmpty = !m_owningLayer.hasVisibleContent() || !(re
nderer()->hasBackground() || paintsChildren()); | 1202 m_scrollingContentsAreEmpty = !m_owningLayer.hasVisibleContent() || !(la
youtObject()->hasBackground() || paintsChildren()); |
| 1203 m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty); | 1203 m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty); |
| 1204 updateScrollingBlockSelection(); | 1204 updateScrollingBlockSelection(); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { | 1207 if (hasPaintedContent && isAcceleratedCanvas(layoutObject())) { |
| 1208 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node()
)->renderingContext(); | 1208 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no
de())->renderingContext(); |
| 1209 // Content layer may be null if context is lost. | 1209 // Content layer may be null if context is lost. |
| 1210 if (WebLayer* contentLayer = context->platformLayer()) { | 1210 if (WebLayer* contentLayer = context->platformLayer()) { |
| 1211 Color bgColor(Color::transparent); | 1211 Color bgColor(Color::transparent); |
| 1212 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { | 1212 if (contentLayerSupportsDirectBackgroundComposition(layoutObject()))
{ |
| 1213 bgColor = rendererBackgroundColor(); | 1213 bgColor = rendererBackgroundColor(); |
| 1214 hasPaintedContent = false; | 1214 hasPaintedContent = false; |
| 1215 } | 1215 } |
| 1216 contentLayer->setBackgroundColor(bgColor.rgb()); | 1216 contentLayer->setBackgroundColor(bgColor.rgb()); |
| 1217 } | 1217 } |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 // FIXME: we could refine this to only allocate backings for one of these la
yers if possible. | 1220 // FIXME: we could refine this to only allocate backings for one of these la
yers if possible. |
| 1221 if (m_foregroundLayer) | 1221 if (m_foregroundLayer) |
| 1222 m_foregroundLayer->setDrawsContent(hasPaintedContent); | 1222 m_foregroundLayer->setDrawsContent(hasPaintedContent); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 | 1446 |
| 1447 // NB, it is illegal at this point to query an ancestor's compositing state.
Some compositing | 1447 // NB, it is illegal at this point to query an ancestor's compositing state.
Some compositing |
| 1448 // reasons depend on the compositing state of ancestors. So if we want a ren
dering context id | 1448 // reasons depend on the compositing state of ancestors. So if we want a ren
dering context id |
| 1449 // for the context root, we cannot ask for the id of its associated WebLayer
now; it may not have | 1449 // for the context root, we cannot ask for the id of its associated WebLayer
now; it may not have |
| 1450 // one yet. We could do a second past after doing the compositing updates to
get these ids, | 1450 // one yet. We could do a second past after doing the compositing updates to
get these ids, |
| 1451 // but this would actually be harmful. We do not want to attach any semantic
meaning to | 1451 // but this would actually be harmful. We do not want to attach any semantic
meaning to |
| 1452 // the context id other than the fact that they group a number of layers tog
ether for the | 1452 // the context id other than the fact that they group a number of layers tog
ether for the |
| 1453 // sake of 3d sorting. So instead we will ask the compositor to vend us an a
rbitrary, but | 1453 // sake of 3d sorting. So instead we will ask the compositor to vend us an a
rbitrary, but |
| 1454 // consistent id. | 1454 // consistent id. |
| 1455 if (Layer* root = m_owningLayer.renderingContextRoot()) { | 1455 if (Layer* root = m_owningLayer.renderingContextRoot()) { |
| 1456 if (Node* node = root->renderer()->node()) | 1456 if (Node* node = root->layoutObject()->node()) |
| 1457 id = static_cast<int>(WTF::PtrHash<Node*>::hash(node)); | 1457 id = static_cast<int>(WTF::PtrHash<Node*>::hash(node)); |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 UpdateRenderingContextFunctor functor = { id }; | 1460 UpdateRenderingContextFunctor functor = { id }; |
| 1461 ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashin
gLayer; | 1461 ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashin
gLayer; |
| 1462 ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode); | 1462 ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode); |
| 1463 } | 1463 } |
| 1464 | 1464 |
| 1465 struct UpdateShouldFlattenTransformFunctor { | 1465 struct UpdateShouldFlattenTransformFunctor { |
| 1466 void operator() (GraphicsLayer* layer) const { layer->setShouldFlattenTransf
orm(shouldFlatten); } | 1466 void operator() (GraphicsLayer* layer) const { layer->setShouldFlattenTransf
orm(shouldFlatten); } |
| 1467 bool shouldFlatten; | 1467 bool shouldFlatten; |
| 1468 }; | 1468 }; |
| 1469 | 1469 |
| 1470 void CompositedLayerMapping::updateShouldFlattenTransform() | 1470 void CompositedLayerMapping::updateShouldFlattenTransform() |
| 1471 { | 1471 { |
| 1472 // All CLM-managed layers that could affect a descendant layer should update
their | 1472 // All CLM-managed layers that could affect a descendant layer should update
their |
| 1473 // should-flatten-transform value (the other layers' transforms don't matter
here). | 1473 // should-flatten-transform value (the other layers' transforms don't matter
here). |
| 1474 UpdateShouldFlattenTransformFunctor functor = { !m_owningLayer.shouldPreserv
e3D() }; | 1474 UpdateShouldFlattenTransformFunctor functor = { !m_owningLayer.shouldPreserv
e3D() }; |
| 1475 ApplyToGraphicsLayersMode mode = ApplyToLayersAffectedByPreserve3D; | 1475 ApplyToGraphicsLayersMode mode = ApplyToLayersAffectedByPreserve3D; |
| 1476 ApplyToGraphicsLayers(this, functor, mode); | 1476 ApplyToGraphicsLayers(this, functor, mode); |
| 1477 | 1477 |
| 1478 // Note, if we apply perspective, we have to set should flatten differently | 1478 // Note, if we apply perspective, we have to set should flatten differently |
| 1479 // so that the transform propagates to child layers correctly. | 1479 // so that the transform propagates to child layers correctly. |
| 1480 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) { | 1480 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) { |
| 1481 bool hasPerspective = false; | 1481 bool hasPerspective = false; |
| 1482 // FIXME: Can |style| be really null here? | 1482 // FIXME: Can |style| be really null here? |
| 1483 if (const LayoutStyle* style = m_owningLayer.renderer()->style()) | 1483 if (const LayoutStyle* style = m_owningLayer.layoutObject()->style()) |
| 1484 hasPerspective = style->hasPerspective(); | 1484 hasPerspective = style->hasPerspective(); |
| 1485 if (hasPerspective) | 1485 if (hasPerspective) |
| 1486 childTransformLayer->setShouldFlattenTransform(false); | 1486 childTransformLayer->setShouldFlattenTransform(false); |
| 1487 | 1487 |
| 1488 // Note, if the target is the scrolling layer, we need to ensure that th
e | 1488 // Note, if the target is the scrolling layer, we need to ensure that th
e |
| 1489 // scrolling content layer doesn't flatten the transform. (It would be n
ice | 1489 // scrolling content layer doesn't flatten the transform. (It would be n
ice |
| 1490 // if we could apply transform to the scrolling content layer, but that'
s | 1490 // if we could apply transform to the scrolling content layer, but that'
s |
| 1491 // too late, we need the children transform to be applied _before_ the | 1491 // too late, we need the children transform to be applied _before_ the |
| 1492 // scrolling offset.) | 1492 // scrolling offset.) |
| 1493 if (childTransformLayer == m_scrollingLayer.get()) { | 1493 if (childTransformLayer == m_scrollingLayer.get()) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 if (m_backgroundLayer) { | 1533 if (m_backgroundLayer) { |
| 1534 m_backgroundLayer->removeFromParent(); | 1534 m_backgroundLayer->removeFromParent(); |
| 1535 m_backgroundLayer = nullptr; | 1535 m_backgroundLayer = nullptr; |
| 1536 #if !OS(ANDROID) | 1536 #if !OS(ANDROID) |
| 1537 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(
true); | 1537 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(
true); |
| 1538 #endif | 1538 #endif |
| 1539 layerChanged = true; | 1539 layerChanged = true; |
| 1540 } | 1540 } |
| 1541 } | 1541 } |
| 1542 | 1542 |
| 1543 if (layerChanged && !m_owningLayer.renderer()->documentBeingDestroyed()) | 1543 if (layerChanged && !m_owningLayer.layoutObject()->documentBeingDestroyed()) |
| 1544 compositor()->rootFixedBackgroundsChanged(); | 1544 compositor()->rootFixedBackgroundsChanged(); |
| 1545 | 1545 |
| 1546 return layerChanged; | 1546 return layerChanged; |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 bool CompositedLayerMapping::updateMaskLayer(bool needsMaskLayer) | 1549 bool CompositedLayerMapping::updateMaskLayer(bool needsMaskLayer) |
| 1550 { | 1550 { |
| 1551 bool layerChanged = false; | 1551 bool layerChanged = false; |
| 1552 if (needsMaskLayer) { | 1552 if (needsMaskLayer) { |
| 1553 if (!m_maskLayer) { | 1553 if (!m_maskLayer) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 // break here. | 1743 // break here. |
| 1744 // | 1744 // |
| 1745 // FIXME: with grouped backings, a composited descendant will have to | 1745 // FIXME: with grouped backings, a composited descendant will have to |
| 1746 // continue past the grouped (squashed) layers that its parents may | 1746 // continue past the grouped (squashed) layers that its parents may |
| 1747 // contribute to. This whole confusion can be avoided by specifying | 1747 // contribute to. This whole confusion can be avoided by specifying |
| 1748 // explicitly the composited ancestor where we would stop accumulating | 1748 // explicitly the composited ancestor where we would stop accumulating |
| 1749 // opacity. | 1749 // opacity. |
| 1750 if (curr->compositingState() == PaintsIntoOwnBacking) | 1750 if (curr->compositingState() == PaintsIntoOwnBacking) |
| 1751 break; | 1751 break; |
| 1752 | 1752 |
| 1753 finalOpacity *= curr->renderer()->opacity(); | 1753 finalOpacity *= curr->layoutObject()->opacity(); |
| 1754 } | 1754 } |
| 1755 | 1755 |
| 1756 return finalOpacity; | 1756 return finalOpacity; |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 Color CompositedLayerMapping::rendererBackgroundColor() const | 1759 Color CompositedLayerMapping::rendererBackgroundColor() const |
| 1760 { | 1760 { |
| 1761 LayoutObject* backgroundRenderer = renderer(); | 1761 LayoutObject* backgroundRenderer = layoutObject(); |
| 1762 if (backgroundRenderer->isDocumentElement()) | 1762 if (backgroundRenderer->isDocumentElement()) |
| 1763 backgroundRenderer = backgroundRenderer->rendererForRootBackground(); | 1763 backgroundRenderer = backgroundRenderer->rendererForRootBackground(); |
| 1764 | 1764 |
| 1765 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); | 1765 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); |
| 1766 } | 1766 } |
| 1767 | 1767 |
| 1768 void CompositedLayerMapping::updateBackgroundColor() | 1768 void CompositedLayerMapping::updateBackgroundColor() |
| 1769 { | 1769 { |
| 1770 m_graphicsLayer->setBackgroundColor(rendererBackgroundColor()); | 1770 m_graphicsLayer->setBackgroundColor(rendererBackgroundColor()); |
| 1771 } | 1771 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1808 } | 1808 } |
| 1809 | 1809 |
| 1810 return false; | 1810 return false; |
| 1811 } | 1811 } |
| 1812 | 1812 |
| 1813 bool CompositedLayerMapping::containsPaintedContent() const | 1813 bool CompositedLayerMapping::containsPaintedContent() const |
| 1814 { | 1814 { |
| 1815 if (m_owningLayer.isReflection()) | 1815 if (m_owningLayer.isReflection()) |
| 1816 return false; | 1816 return false; |
| 1817 | 1817 |
| 1818 if (renderer()->isImage() && isDirectlyCompositedImage()) | 1818 if (layoutObject()->isImage() && isDirectlyCompositedImage()) |
| 1819 return false; | 1819 return false; |
| 1820 | 1820 |
| 1821 LayoutObject* layoutObject = renderer(); | 1821 LayoutObject* layoutObject = this->layoutObject(); |
| 1822 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, | 1822 // FIXME: we could optimize cases where the image, video or canvas is known
to fill the border box entirely, |
| 1823 // and set background color on the layer in that case, instead of allocating
backing store and painting. | 1823 // and set background color on the layer in that case, instead of allocating
backing store and painting. |
| 1824 if (layoutObject->isVideo() && toLayoutVideo(renderer())->shouldDisplayVideo
()) | 1824 if (layoutObject->isVideo() && toLayoutVideo(layoutObject)->shouldDisplayVid
eo()) |
| 1825 return m_owningLayer.hasBoxDecorationsOrBackground(); | 1825 return m_owningLayer.hasBoxDecorationsOrBackground(); |
| 1826 | 1826 |
| 1827 if (m_owningLayer.hasVisibleBoxDecorations()) | 1827 if (m_owningLayer.hasVisibleBoxDecorations()) |
| 1828 return true; | 1828 return true; |
| 1829 | 1829 |
| 1830 if (layoutObject->hasMask()) // masks require special treatment | 1830 if (layoutObject->hasMask()) // masks require special treatment |
| 1831 return true; | 1831 return true; |
| 1832 | 1832 |
| 1833 if (layoutObject->isReplaced() && !isCompositedPlugin(layoutObject)) | 1833 if (layoutObject->isReplaced() && !isCompositedPlugin(layoutObject)) |
| 1834 return true; | 1834 return true; |
| 1835 | 1835 |
| 1836 if (layoutObject->isLayoutRegion()) | 1836 if (layoutObject->isLayoutRegion()) |
| 1837 return true; | 1837 return true; |
| 1838 | 1838 |
| 1839 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { | 1839 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) { |
| 1840 // Look to see if the root object has a non-simple background | 1840 // Look to see if the root object has a non-simple background |
| 1841 LayoutObject* rootObject = layoutObject->document().documentElement() ?
layoutObject->document().documentElement()->renderer() : 0; | 1841 LayoutObject* rootObject = layoutObject->document().documentElement() ?
layoutObject->document().documentElement()->layoutObject() : 0; |
| 1842 // Reject anything that has a border, a border-radius or outline, | 1842 // Reject anything that has a border, a border-radius or outline, |
| 1843 // or is not a simple background (no background, or solid color). | 1843 // or is not a simple background (no background, or solid color). |
| 1844 if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->styleRe
f())) | 1844 if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->styleRe
f())) |
| 1845 return true; | 1845 return true; |
| 1846 | 1846 |
| 1847 // Now look at the body's renderer. | 1847 // Now look at the body's renderer. |
| 1848 HTMLElement* body = layoutObject->document().body(); | 1848 HTMLElement* body = layoutObject->document().body(); |
| 1849 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->renderer() :
0; | 1849 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject(
) : 0; |
| 1850 if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->styleRe
f())) | 1850 if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->styleRe
f())) |
| 1851 return true; | 1851 return true; |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 // FIXME: it's O(n^2). A better solution is needed. | 1854 // FIXME: it's O(n^2). A better solution is needed. |
| 1855 return paintsChildren(); | 1855 return paintsChildren(); |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations | 1858 // An image can be directly compositing if it's the sole content of the layer, a
nd has no box decorations |
| 1859 // that require painting. Direct compositing saves backing store. | 1859 // that require painting. Direct compositing saves backing store. |
| 1860 bool CompositedLayerMapping::isDirectlyCompositedImage() const | 1860 bool CompositedLayerMapping::isDirectlyCompositedImage() const |
| 1861 { | 1861 { |
| 1862 ASSERT(renderer()->isImage()); | 1862 ASSERT(layoutObject()->isImage()); |
| 1863 | 1863 |
| 1864 LayoutObject* layoutObject = renderer(); | 1864 LayoutObject* layoutObject = this->layoutObject(); |
| 1865 if (m_owningLayer.hasBoxDecorationsOrBackground() || layoutObject->hasClip()
|| layoutObject->hasClipPath()) | 1865 if (m_owningLayer.hasBoxDecorationsOrBackground() || layoutObject->hasClip()
|| layoutObject->hasClipPath()) |
| 1866 return false; | 1866 return false; |
| 1867 | 1867 |
| 1868 LayoutImage* imageRenderer = toLayoutImage(layoutObject); | 1868 LayoutImage* imageRenderer = toLayoutImage(layoutObject); |
| 1869 if (ImageResource* cachedImage = imageRenderer->cachedImage()) { | 1869 if (ImageResource* cachedImage = imageRenderer->cachedImage()) { |
| 1870 if (!cachedImage->hasImage()) | 1870 if (!cachedImage->hasImage()) |
| 1871 return false; | 1871 return false; |
| 1872 | 1872 |
| 1873 Image* image = cachedImage->imageForRenderer(imageRenderer); | 1873 Image* image = cachedImage->imageForRenderer(imageRenderer); |
| 1874 return image->isBitmapImage(); | 1874 return image->isBitmapImage(); |
| 1875 } | 1875 } |
| 1876 | 1876 |
| 1877 return false; | 1877 return false; |
| 1878 } | 1878 } |
| 1879 | 1879 |
| 1880 void CompositedLayerMapping::contentChanged(ContentChangeType changeType) | 1880 void CompositedLayerMapping::contentChanged(ContentChangeType changeType) |
| 1881 { | 1881 { |
| 1882 if ((changeType == ImageChanged) && renderer()->isImage() && isDirectlyCompo
sitedImage()) { | 1882 if ((changeType == ImageChanged) && layoutObject()->isImage() && isDirectlyC
ompositedImage()) { |
| 1883 updateImageContents(); | 1883 updateImageContents(); |
| 1884 return; | 1884 return; |
| 1885 } | 1885 } |
| 1886 | 1886 |
| 1887 if (changeType == CanvasChanged && isAcceleratedCanvas(renderer())) { | 1887 if (changeType == CanvasChanged && isAcceleratedCanvas(layoutObject())) { |
| 1888 m_graphicsLayer->setContentsNeedsDisplay(); | 1888 m_graphicsLayer->setContentsNeedsDisplay(); |
| 1889 return; | 1889 return; |
| 1890 } | 1890 } |
| 1891 } | 1891 } |
| 1892 | 1892 |
| 1893 void CompositedLayerMapping::updateImageContents() | 1893 void CompositedLayerMapping::updateImageContents() |
| 1894 { | 1894 { |
| 1895 ASSERT(renderer()->isImage()); | 1895 ASSERT(layoutObject()->isImage()); |
| 1896 LayoutImage* imageRenderer = toLayoutImage(renderer()); | 1896 LayoutImage* imageRenderer = toLayoutImage(layoutObject()); |
| 1897 | 1897 |
| 1898 ImageResource* cachedImage = imageRenderer->cachedImage(); | 1898 ImageResource* cachedImage = imageRenderer->cachedImage(); |
| 1899 if (!cachedImage) | 1899 if (!cachedImage) |
| 1900 return; | 1900 return; |
| 1901 | 1901 |
| 1902 Image* image = cachedImage->imageForRenderer(imageRenderer); | 1902 Image* image = cachedImage->imageForRenderer(imageRenderer); |
| 1903 if (!image) | 1903 if (!image) |
| 1904 return; | 1904 return; |
| 1905 | 1905 |
| 1906 // We have to wait until the image is fully loaded before setting it on the
layer. | 1906 // We have to wait until the image is fully loaded before setting it on the
layer. |
| 1907 if (!cachedImage->isLoaded()) | 1907 if (!cachedImage->isLoaded()) |
| 1908 return; | 1908 return; |
| 1909 | 1909 |
| 1910 // This is a no-op if the layer doesn't have an inner layer for the image. | 1910 // This is a no-op if the layer doesn't have an inner layer for the image. |
| 1911 m_graphicsLayer->setContentsToImage(image); | 1911 m_graphicsLayer->setContentsToImage(image); |
| 1912 | 1912 |
| 1913 m_graphicsLayer->setFilterLevel(renderer()->style()->imageRendering() == Ima
geRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel); | 1913 m_graphicsLayer->setFilterLevel(layoutObject()->style()->imageRendering() ==
ImageRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLeve
l); |
| 1914 | 1914 |
| 1915 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 | 1915 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 |
| 1916 updateDrawsContent(); | 1916 updateDrawsContent(); |
| 1917 | 1917 |
| 1918 // Image animation is "lazy", in that it automatically stops unless someone
is drawing | 1918 // Image animation is "lazy", in that it automatically stops unless someone
is drawing |
| 1919 // the image. So we have to kick the animation each time; this has the downs
ide that the | 1919 // the image. So we have to kick the animation each time; this has the downs
ide that the |
| 1920 // image will keep animating, even if its layer is not visible. | 1920 // image will keep animating, even if its layer is not visible. |
| 1921 image->startAnimation(); | 1921 image->startAnimation(); |
| 1922 } | 1922 } |
| 1923 | 1923 |
| 1924 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const | 1924 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const |
| 1925 { | 1925 { |
| 1926 const LayoutStyle& style = renderer()->styleRef(); | 1926 const LayoutStyle& style = layoutObject()->styleRef(); |
| 1927 | 1927 |
| 1928 FloatPoint3D origin; | 1928 FloatPoint3D origin; |
| 1929 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width())
); | 1929 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width())
); |
| 1930 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()
)); | 1930 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()
)); |
| 1931 origin.setZ(style.transformOriginZ()); | 1931 origin.setZ(style.transformOriginZ()); |
| 1932 | 1932 |
| 1933 return origin; | 1933 return origin; |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 // Return the offset from the top-left of this compositing layer at which the | 1936 // Return the offset from the top-left of this compositing layer at which the |
| 1937 // renderer's contents are painted. | 1937 // renderer's contents are painted. |
| 1938 LayoutSize CompositedLayerMapping::contentOffsetInCompositingLayer() const | 1938 LayoutSize CompositedLayerMapping::contentOffsetInCompositingLayer() const |
| 1939 { | 1939 { |
| 1940 ASSERT(!m_contentOffsetInCompositingLayerDirty); | 1940 ASSERT(!m_contentOffsetInCompositingLayerDirty); |
| 1941 return m_contentOffsetInCompositingLayer; | 1941 return m_contentOffsetInCompositingLayer; |
| 1942 } | 1942 } |
| 1943 | 1943 |
| 1944 LayoutRect CompositedLayerMapping::contentsBox() const | 1944 LayoutRect CompositedLayerMapping::contentsBox() const |
| 1945 { | 1945 { |
| 1946 LayoutRect contentsBox = LayoutRect(contentsRect(renderer())); | 1946 LayoutRect contentsBox = LayoutRect(contentsRect(layoutObject())); |
| 1947 contentsBox.move(contentOffsetInCompositingLayer()); | 1947 contentsBox.move(contentOffsetInCompositingLayer()); |
| 1948 return contentsBox; | 1948 return contentsBox; |
| 1949 } | 1949 } |
| 1950 | 1950 |
| 1951 bool CompositedLayerMapping::needsToReparentOverflowControls() const | 1951 bool CompositedLayerMapping::needsToReparentOverflowControls() const |
| 1952 { | 1952 { |
| 1953 return m_owningLayer.scrollableArea() | 1953 return m_owningLayer.scrollableArea() |
| 1954 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() | 1954 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() |
| 1955 && m_owningLayer.scrollableArea()->topmostScrollChild(); | 1955 && m_owningLayer.scrollableArea()->topmostScrollChild(); |
| 1956 } | 1956 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 // FIXME: need to distinguish invalidations for different layers (e.g. the m
ain layer and scrolling layer). crbug.com/416535. | 2071 // FIXME: need to distinguish invalidations for different layers (e.g. the m
ain layer and scrolling layer). crbug.com/416535. |
| 2072 ApplyToGraphicsLayers(this, [displayItemClient](GraphicsLayer* layer) { | 2072 ApplyToGraphicsLayers(this, [displayItemClient](GraphicsLayer* layer) { |
| 2073 if (layer->drawsContent()) | 2073 if (layer->drawsContent()) |
| 2074 layer->invalidateDisplayItemClient(displayItemClient); | 2074 layer->invalidateDisplayItemClient(displayItemClient); |
| 2075 }, ApplyToContentLayers); | 2075 }, ApplyToContentLayers); |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) | 2078 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, un
signed maxSquashedLayerIndex) |
| 2079 { | 2079 { |
| 2080 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { | 2080 for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) { |
| 2081 if (layoutObject->isDescendantOf(layers[i].renderLayer->renderer())) | 2081 if (layoutObject->isDescendantOf(layers[i].renderLayer->layoutObject())) |
| 2082 return &layers[i]; | 2082 return &layers[i]; |
| 2083 } | 2083 } |
| 2084 return 0; | 2084 return 0; |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) | 2087 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co
nst LayoutObject* layoutObject, unsigned maxSquashedLayerIndex) |
| 2088 { | 2088 { |
| 2089 return CompositedLayerMapping::containingSquashedLayer(layoutObject, m_squas
hedLayers, maxSquashedLayerIndex); | 2089 return CompositedLayerMapping::containingSquashedLayer(layoutObject, m_squas
hedLayers, maxSquashedLayerIndex); |
| 2090 } | 2090 } |
| 2091 | 2091 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 | 2128 |
| 2129 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { | 2129 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { |
| 2130 LayoutRect bounds = paintInfo.compositedBounds; | 2130 LayoutRect bounds = paintInfo.compositedBounds; |
| 2131 bounds.move(paintInfo.renderLayer->subpixelAccumulation()); | 2131 bounds.move(paintInfo.renderLayer->subpixelAccumulation()); |
| 2132 dirtyRect.intersect(pixelSnappedIntRect(bounds)); | 2132 dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
| 2133 } else { | 2133 } else { |
| 2134 dirtyRect.move(roundedIntSize(paintInfo.renderLayer->subpixelAccumulatio
n())); | 2134 dirtyRect.move(roundedIntSize(paintInfo.renderLayer->subpixelAccumulatio
n())); |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 #if ENABLE(ASSERT) | 2137 #if ENABLE(ASSERT) |
| 2138 paintInfo.renderLayer->renderer()->assertSubtreeIsLaidOut(); | 2138 paintInfo.renderLayer->layoutObject()->assertSubtreeIsLaidOut(); |
| 2139 #endif | 2139 #endif |
| 2140 | 2140 |
| 2141 float deviceScaleFactor = blink::deviceScaleFactor(paintInfo.renderLayer->re
nderer()->frame()); | 2141 float deviceScaleFactor = blink::deviceScaleFactor(paintInfo.renderLayer->la
youtObject()->frame()); |
| 2142 context->setDeviceScaleFactor(deviceScaleFactor); | 2142 context->setDeviceScaleFactor(deviceScaleFactor); |
| 2143 | 2143 |
| 2144 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { | 2144 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { |
| 2145 // FIXME: GraphicsLayers need a way to split for LayoutRegions. | 2145 // FIXME: GraphicsLayers need a way to split for LayoutRegions. |
| 2146 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, LayoutRect(dirtyRe
ct), PaintBehaviorNormal, paintInfo.renderLayer->subpixelAccumulation()); | 2146 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, LayoutRect(dirtyRe
ct), PaintBehaviorNormal, paintInfo.renderLayer->subpixelAccumulation()); |
| 2147 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, paintin
gInfo, paintLayerFlags); | 2147 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, paintin
gInfo, paintLayerFlags); |
| 2148 | 2148 |
| 2149 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) | 2149 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) |
| 2150 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, pai
ntingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); | 2150 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, pai
ntingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); |
| 2151 } else { | 2151 } else { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 scrollbar->paint(&context, transformedClip); | 2191 scrollbar->paint(&context, transformedClip); |
| 2192 } | 2192 } |
| 2193 | 2193 |
| 2194 // Up-call from compositing layer drawing callback. | 2194 // Up-call from compositing layer drawing callback. |
| 2195 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& clip) | 2195 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& clip) |
| 2196 { | 2196 { |
| 2197 // https://code.google.com/p/chromium/issues/detail?id=343772 | 2197 // https://code.google.com/p/chromium/issues/detail?id=343772 |
| 2198 DisableCompositingQueryAsserts disabler; | 2198 DisableCompositingQueryAsserts disabler; |
| 2199 #if ENABLE(ASSERT) | 2199 #if ENABLE(ASSERT) |
| 2200 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. | 2200 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. |
| 2201 if (Page* page = renderer()->frame()->page()) | 2201 if (Page* page = layoutObject()->frame()->page()) |
| 2202 page->setIsPainting(true); | 2202 page->setIsPainting(true); |
| 2203 #endif | 2203 #endif |
| 2204 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data"
, InspectorPaintEvent::data(m_owningLayer.renderer(), LayoutRect(clip), graphics
Layer)); | 2204 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data"
, InspectorPaintEvent::data(m_owningLayer.layoutObject(), LayoutRect(clip), grap
hicsLayer)); |
| 2205 | 2205 |
| 2206 PaintLayerFlags paintLayerFlags = 0; | 2206 PaintLayerFlags paintLayerFlags = 0; |
| 2207 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) | 2207 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) |
| 2208 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; | 2208 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; |
| 2209 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) | 2209 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) |
| 2210 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; | 2210 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; |
| 2211 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) | 2211 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) |
| 2212 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; | 2212 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; |
| 2213 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) | 2213 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) |
| 2214 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; | 2214 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 } else if (graphicsLayer == layerForScrollCorner()) { | 2247 } else if (graphicsLayer == layerForScrollCorner()) { |
| 2248 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->
scrollCornerAndResizerRect(); | 2248 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->
scrollCornerAndResizerRect(); |
| 2249 context.save(); | 2249 context.save(); |
| 2250 context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y
()); | 2250 context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y
()); |
| 2251 IntRect transformedClip = clip; | 2251 IntRect transformedClip = clip; |
| 2252 transformedClip.moveBy(scrollCornerAndResizer.location()); | 2252 transformedClip.moveBy(scrollCornerAndResizer.location()); |
| 2253 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, IntPoint(), transformedClip); | 2253 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, IntPoint(), transformedClip); |
| 2254 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, IntPoint(), transformedClip); | 2254 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, IntPoint(), transformedClip); |
| 2255 context.restore(); | 2255 context.restore(); |
| 2256 } | 2256 } |
| 2257 InspectorInstrumentation::didPaint(m_owningLayer.renderer(), graphicsLayer,
&context, LayoutRect(clip)); | 2257 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay
er, &context, LayoutRect(clip)); |
| 2258 #if ENABLE(ASSERT) | 2258 #if ENABLE(ASSERT) |
| 2259 if (Page* page = renderer()->frame()->page()) | 2259 if (Page* page = layoutObject()->frame()->page()) |
| 2260 page->setIsPainting(false); | 2260 page->setIsPainting(false); |
| 2261 #endif | 2261 #endif |
| 2262 } | 2262 } |
| 2263 | 2263 |
| 2264 bool CompositedLayerMapping::isTrackingPaintInvalidations() const | 2264 bool CompositedLayerMapping::isTrackingPaintInvalidations() const |
| 2265 { | 2265 { |
| 2266 GraphicsLayerClient* client = compositor(); | 2266 GraphicsLayerClient* client = compositor(); |
| 2267 return client ? client->isTrackingPaintInvalidations() : false; | 2267 return client ? client->isTrackingPaintInvalidations() : false; |
| 2268 } | 2268 } |
| 2269 | 2269 |
| 2270 #if ENABLE(ASSERT) | 2270 #if ENABLE(ASSERT) |
| 2271 void CompositedLayerMapping::verifyNotPainting() | 2271 void CompositedLayerMapping::verifyNotPainting() |
| 2272 { | 2272 { |
| 2273 ASSERT(!renderer()->frame()->page() || !renderer()->frame()->page()->isPaint
ing()); | 2273 ASSERT(!layoutObject()->frame()->page() || !layoutObject()->frame()->page()-
>isPainting()); |
| 2274 } | 2274 } |
| 2275 #endif | 2275 #endif |
| 2276 | 2276 |
| 2277 void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double
monotonicTime, int group) | 2277 void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double
monotonicTime, int group) |
| 2278 { | 2278 { |
| 2279 renderer()->node()->document().compositorPendingAnimations().notifyComposito
rAnimationStarted(monotonicTime, group); | 2279 layoutObject()->node()->document().compositorPendingAnimations().notifyCompo
sitorAnimationStarted(monotonicTime, group); |
| 2280 } | 2280 } |
| 2281 | 2281 |
| 2282 IntRect CompositedLayerMapping::pixelSnappedCompositedBounds() const | 2282 IntRect CompositedLayerMapping::pixelSnappedCompositedBounds() const |
| 2283 { | 2283 { |
| 2284 LayoutRect bounds = m_compositedBounds; | 2284 LayoutRect bounds = m_compositedBounds; |
| 2285 bounds.move(m_owningLayer.subpixelAccumulation()); | 2285 bounds.move(m_owningLayer.subpixelAccumulation()); |
| 2286 return pixelSnappedIntRect(bounds); | 2286 return pixelSnappedIntRect(bounds); |
| 2287 } | 2287 } |
| 2288 | 2288 |
| 2289 bool CompositedLayerMapping::updateSquashingLayerAssignment(Layer* squashedLayer
, const Layer& owningLayer, size_t nextSquashedLayerIndex) | 2289 bool CompositedLayerMapping::updateSquashingLayerAssignment(Layer* squashedLayer
, const Layer& owningLayer, size_t nextSquashedLayerIndex) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2375 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2376 name = "Scrolling Block Selection Layer"; | 2376 name = "Scrolling Block Selection Layer"; |
| 2377 } else { | 2377 } else { |
| 2378 ASSERT_NOT_REACHED(); | 2378 ASSERT_NOT_REACHED(); |
| 2379 } | 2379 } |
| 2380 | 2380 |
| 2381 return name; | 2381 return name; |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 } // namespace blink | 2384 } // namespace blink |
| OLD | NEW |