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

Side by Side Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 189233012: Convert CompositingLayerMapping code to use reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make RenderLayer non-copyable Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 static inline bool isAcceleratedContents(RenderObject* renderer) 139 static inline bool isAcceleratedContents(RenderObject* renderer)
140 { 140 {
141 return isAcceleratedCanvas(renderer) 141 return isAcceleratedCanvas(renderer)
142 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->al lowsAcceleratedCompositing()) 142 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->al lowsAcceleratedCompositing())
143 || renderer->isVideo(); 143 || renderer->isVideo();
144 } 144 }
145 145
146 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi ng's destructor. 146 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi ng's destructor.
147 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer* layer) 147 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer& layer)
148 { 148 {
149 Page* page = layer->renderer()->frame()->page(); 149 Page* page = layer.renderer()->frame()->page();
150 if (!page) 150 if (!page)
151 return 0; 151 return 0;
152 152
153 return page->scrollingCoordinator(); 153 return page->scrollingCoordinator();
154 } 154 }
155 155
156 CompositedLayerMapping::CompositedLayerMapping(RenderLayer* layer) 156 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer)
157 : m_owningLayer(layer) 157 : m_owningLayer(layer)
158 , m_artificiallyInflatedBounds(false) 158 , m_artificiallyInflatedBounds(false)
159 , m_isMainFrameRenderViewLayer(false) 159 , m_isMainFrameRenderViewLayer(false)
160 , m_requiresOwnBackingStoreForIntrinsicReasons(true) 160 , m_requiresOwnBackingStoreForIntrinsicReasons(true)
161 , m_requiresOwnBackingStoreForAncestorReasons(true) 161 , m_requiresOwnBackingStoreForAncestorReasons(true)
162 , m_canCompositeFilters(false) 162 , m_canCompositeFilters(false)
163 , m_backgroundLayerPaintsFixedRootBackground(false) 163 , m_backgroundLayerPaintsFixedRootBackground(false)
164 { 164 {
165 if (layer->isRootLayer() && renderer()->frame()->isMainFrame()) 165 if (layer.isRootLayer() && renderer()->frame()->isMainFrame())
166 m_isMainFrameRenderViewLayer = true; 166 m_isMainFrameRenderViewLayer = true;
167 167
168 createPrimaryGraphicsLayer(); 168 createPrimaryGraphicsLayer();
169 } 169 }
170 170
171 CompositedLayerMapping::~CompositedLayerMapping() 171 CompositedLayerMapping::~CompositedLayerMapping()
172 { 172 {
173 // Do not leave the destroyed pointer dangling on any RenderLayers that pain ted to this mapping's squashing layer. 173 // Do not leave the destroyed pointer dangling on any RenderLayers that pain ted to this mapping's squashing layer.
174 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 174 for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
175 RenderLayer* oldSquashedLayer = m_squashedLayers[i].renderLayer; 175 RenderLayer* oldSquashedLayer = m_squashedLayers[i].renderLayer;
(...skipping 23 matching lines...) Expand all
199 199
200 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac tory, this); 200 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac tory, this);
201 201
202 graphicsLayer->setCompositingReasons(reasons); 202 graphicsLayer->setCompositingReasons(reasons);
203 203
204 return graphicsLayer.release(); 204 return graphicsLayer.release();
205 } 205 }
206 206
207 void CompositedLayerMapping::createPrimaryGraphicsLayer() 207 void CompositedLayerMapping::createPrimaryGraphicsLayer()
208 { 208 {
209 m_graphicsLayer = createGraphicsLayer(m_owningLayer->compositingReasons()); 209 m_graphicsLayer = createGraphicsLayer(m_owningLayer.compositingReasons());
210 210
211 #if !OS(ANDROID) 211 #if !OS(ANDROID)
212 if (m_isMainFrameRenderViewLayer) 212 if (m_isMainFrameRenderViewLayer)
213 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true ); 213 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true );
214 #endif 214 #endif
215 215
216 updateOpacity(renderer()->style()); 216 updateOpacity(renderer()->style());
217 updateTransform(renderer()->style()); 217 updateTransform(renderer()->style());
218 updateFilters(renderer()->style()); 218 updateFilters(renderer()->style());
219 219
(...skipping 21 matching lines...) Expand all
241 m_scrollingContentsLayer = nullptr; 241 m_scrollingContentsLayer = nullptr;
242 } 242 }
243 243
244 void CompositedLayerMapping::updateOpacity(const RenderStyle* style) 244 void CompositedLayerMapping::updateOpacity(const RenderStyle* style)
245 { 245 {
246 m_graphicsLayer->setOpacity(compositingOpacity(style->opacity())); 246 m_graphicsLayer->setOpacity(compositingOpacity(style->opacity()));
247 } 247 }
248 248
249 void CompositedLayerMapping::updateTransform(const RenderStyle* style) 249 void CompositedLayerMapping::updateTransform(const RenderStyle* style)
250 { 250 {
251 // FIXME: This could use m_owningLayer->transform(), but that currently has transform-origin 251 // FIXME: This could use m_owningLayer.transform(), but that currently has t ransform-origin
252 // baked into it, and we don't want that. 252 // baked into it, and we don't want that.
253 TransformationMatrix t; 253 TransformationMatrix t;
254 if (m_owningLayer->hasTransform()) { 254 if (m_owningLayer.hasTransform()) {
255 style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxR ect().size(), RenderStyle::ExcludeTransformOrigin); 255 style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxR ect().size(), RenderStyle::ExcludeTransformOrigin);
256 makeMatrixRenderable(t, compositor()->canRender3DTransforms()); 256 makeMatrixRenderable(t, compositor()->canRender3DTransforms());
257 } 257 }
258 258
259 m_graphicsLayer->setTransform(t); 259 m_graphicsLayer->setTransform(t);
260 } 260 }
261 261
262 void CompositedLayerMapping::updateFilters(const RenderStyle* style) 262 void CompositedLayerMapping::updateFilters(const RenderStyle* style)
263 { 263 {
264 bool didCompositeFilters = m_canCompositeFilters; 264 bool didCompositeFilters = m_canCompositeFilters;
265 m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer()->computeFi lterOperations(style)); 265 m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer().computeFil terOperations(style));
266 if (didCompositeFilters != m_canCompositeFilters) { 266 if (didCompositeFilters != m_canCompositeFilters) {
267 // 267 //
268 // If filters used to be painted in software and are now painted in the compositor, we need to: 268 // If filters used to be painted in software and are now painted in the compositor, we need to:
269 // (1) Remove the FilterEffectRenderer, which was used for painting filt ers in software. 269 // (1) Remove the FilterEffectRenderer, which was used for painting filt ers in software.
270 // (2) Repaint the layer contents to remove the software-applied filter because the compositor will apply it. 270 // (2) Repaint the layer contents to remove the software-applied filter because the compositor will apply it.
271 // 271 //
272 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to: 272 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to:
273 // (1) Create a FilterEffectRenderer. 273 // (1) Create a FilterEffectRenderer.
274 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it. 274 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
275 // 275 //
276 m_owningLayer->updateOrRemoveFilterEffectRenderer(); 276 m_owningLayer.updateOrRemoveFilterEffectRenderer();
277 setContentsNeedDisplay(); 277 setContentsNeedDisplay();
278 } 278 }
279 } 279 }
280 280
281 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle* style) 281 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle* style)
282 { 282 {
283 setBlendMode(style->blendMode()); 283 setBlendMode(style->blendMode());
284 } 284 }
285 285
286 void CompositedLayerMapping::updateIsRootForIsolatedGroup() 286 void CompositedLayerMapping::updateIsRootForIsolatedGroup()
287 { 287 {
288 bool isolate = m_owningLayer->shouldIsolateCompositedDescendants(); 288 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants();
289 289
290 // non stacking context layers should never isolate 290 // non stacking context layers should never isolate
291 ASSERT(m_owningLayer->stackingNode()->isStackingContext() || !isolate); 291 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate);
292 292
293 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); 293 m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
294 } 294 }
295 295
296 void CompositedLayerMapping::updateContentsOpaque() 296 void CompositedLayerMapping::updateContentsOpaque()
297 { 297 {
298 // For non-root layers, background is always painted by the primary graphics layer. 298 // For non-root layers, background is always painted by the primary graphics layer.
299 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); 299 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
300 if (m_backgroundLayer) { 300 if (m_backgroundLayer) {
301 m_graphicsLayer->setContentsOpaque(false); 301 m_graphicsLayer->setContentsOpaque(false);
302 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds())); 302 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds()));
303 } else { 303 } else {
304 m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeO paqueInRect(compositedBounds())); 304 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp aqueInRect(compositedBounds()));
305 } 305 }
306 } 306 }
307 307
308 static bool hasNonZeroTransformOrigin(const RenderObject* renderer) 308 static bool hasNonZeroTransformOrigin(const RenderObject* renderer)
309 { 309 {
310 RenderStyle* style = renderer->style(); 310 RenderStyle* style = renderer->style();
311 return (style->transformOriginX().type() == Fixed && style->transformOriginX ().value()) 311 return (style->transformOriginX().type() == Fixed && style->transformOriginX ().value())
312 || (style->transformOriginY().type() == Fixed && style->transformOriginY ().value()); 312 || (style->transformOriginY().type() == Fixed && style->transformOriginY ().value());
313 } 313 }
314 314
315 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer* layer) 315 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer* layer)
316 { 316 {
317 for (RenderLayer* curr = layer; curr; curr = curr->parent()) { 317 for (RenderLayer* curr = layer; curr; curr = curr->parent()) {
318 if (curr->hasTransform() || curr->needsCompositedScrolling()) 318 if (curr->hasTransform() || curr->needsCompositedScrolling())
319 return true; 319 return true;
320 } 320 }
321 321
322 return false; 322 return false;
323 } 323 }
324 324
325 bool CompositedLayerMapping::shouldClipCompositedBounds() const 325 bool CompositedLayerMapping::shouldClipCompositedBounds() const
326 { 326 {
327 // Scrollbar layers use this layer for relative positioning, so don't clip. 327 // Scrollbar layers use this layer for relative positioning, so don't clip.
328 if (layerForHorizontalScrollbar() || layerForVerticalScrollbar()) 328 if (layerForHorizontalScrollbar() || layerForVerticalScrollbar())
329 return false; 329 return false;
330 330
331 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer)) 331 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(&m_owningLayer))
332 return false; 332 return false;
333 333
334 // Scrolled composited layers are clipped by their ancestor clipping layer, 334 // Scrolled composited layers are clipped by their ancestor clipping layer,
335 // so don't clip these, either. 335 // so don't clip these, either.
336 if (!compositor()->clippedByAncestor(m_owningLayer)) 336 if (!compositor()->clippedByAncestor(&m_owningLayer))
337 return true; 337 return true;
338 338
339 if (m_owningLayer->renderer()->containingBlock()->enclosingLayer() != m_owni ngLayer->ancestorScrollingLayer()) 339 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() != m_ownin gLayer.ancestorScrollingLayer())
340 return true; 340 return true;
341 341
342 return false; 342 return false;
343 } 343 }
344 344
345 void CompositedLayerMapping::updateCompositedBounds() 345 void CompositedLayerMapping::updateCompositedBounds()
346 { 346 {
347 // We need to know if we draw content in order to update our bounds (this ha s an effect 347 // We need to know if we draw content in order to update our bounds (this ha s an effect
348 // on whether or not descendands will paint into our backing). Update this v alue now. 348 // on whether or not descendands will paint into our backing). Update this v alue now.
349 updateDrawsContent(); 349 updateDrawsContent();
350 350
351 LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLay er, m_owningLayer); 351 LayoutRect layerBounds = compositor()->calculateCompositedBounds(&m_owningLa yer, &m_owningLayer);
352 352
353 // Clip to the size of the document or enclosing overflow-scroll layer. 353 // Clip to the size of the document or enclosing overflow-scroll layer.
354 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with. 354 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with.
355 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist. 355 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist.
356 if (shouldClipCompositedBounds()) { 356 if (shouldClipCompositedBounds()) {
357 RenderView* view = m_owningLayer->renderer()->view(); 357 RenderView* view = m_owningLayer.renderer()->view();
358 RenderLayer* rootLayer = view->layer(); 358 RenderLayer* rootLayer = view->layer();
359 359
360 LayoutRect clippingBounds; 360 LayoutRect clippingBounds;
361 if (renderer()->style()->position() == FixedPosition && renderer()->cont ainer() == view) 361 if (renderer()->style()->position() == FixedPosition && renderer()->cont ainer() == view)
362 clippingBounds = view->frameView()->viewportConstrainedVisibleConten tRect(); 362 clippingBounds = view->frameView()->viewportConstrainedVisibleConten tRect();
363 else 363 else
364 clippingBounds = view->unscaledDocumentRect(); 364 clippingBounds = view->unscaledDocumentRect();
365 365
366 if (m_owningLayer != rootLayer) 366 if (&m_owningLayer != rootLayer)
367 clippingBounds.intersect(m_owningLayer->clipper().backgroundClipRect (ClipRectsContext(rootLayer, AbsoluteClipRects)).rect()); 367 clippingBounds.intersect(m_owningLayer.clipper().backgroundClipRect( ClipRectsContext(rootLayer, AbsoluteClipRects)).rect());
368 368
369 LayoutPoint delta; 369 LayoutPoint delta;
370 m_owningLayer->convertToLayerCoords(rootLayer, delta); 370 m_owningLayer.convertToLayerCoords(rootLayer, delta);
371 clippingBounds.move(-delta.x(), -delta.y()); 371 clippingBounds.move(-delta.x(), -delta.y());
372 372
373 layerBounds.intersect(clippingBounds); 373 layerBounds.intersect(clippingBounds);
374 } 374 }
375 375
376 // If the element has a transform-origin that has fixed lengths, and the ren derer has zero size, 376 // If the element has a transform-origin that has fixed lengths, and the ren derer has zero size,
377 // then we need to ensure that the compositing layer has non-zero size so th at we can apply 377 // then we need to ensure that the compositing layer has non-zero size so th at we can apply
378 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse d as a fractional value). 378 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse d as a fractional value).
379 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { 379 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) {
380 layerBounds.setWidth(1); 380 layerBounds.setWidth(1);
(...skipping 15 matching lines...) Expand all
396 ASSERT(contentsBox().location() == flooredIntPoint(contentsBox().loc ation())); 396 ASSERT(contentsBox().location() == flooredIntPoint(contentsBox().loc ation()));
397 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents Box().location())); 397 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents Box().location()));
398 } 398 }
399 } 399 }
400 } 400 }
401 401
402 void CompositedLayerMapping::updateCompositingReasons() 402 void CompositedLayerMapping::updateCompositingReasons()
403 { 403 {
404 // All other layers owned by this mapping will have the same compositing rea son 404 // All other layers owned by this mapping will have the same compositing rea son
405 // for their lifetime, so they are initialized only when created. 405 // for their lifetime, so they are initialized only when created.
406 m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons()); 406 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons());
407 } 407 }
408 408
409 void CompositedLayerMapping::updateAfterLayout(UpdateAfterLayoutFlags flags) 409 void CompositedLayerMapping::updateAfterLayout(UpdateAfterLayoutFlags flags)
410 { 410 {
411 RenderLayerCompositor* layerCompositor = compositor(); 411 RenderLayerCompositor* layerCompositor = compositor();
412 if (!layerCompositor->compositingLayersNeedRebuild()) { 412 if (!layerCompositor->compositingLayersNeedRebuild()) {
413 // Calling updateGraphicsLayerGeometry() here gives incorrect results, b ecause the 413 // Calling updateGraphicsLayerGeometry() here gives incorrect results, b ecause the
414 // position of this layer's GraphicsLayer depends on the position of our compositing 414 // position of this layer's GraphicsLayer depends on the position of our compositing
415 // ancestor's GraphicsLayer. That cannot be determined until all the des cendant 415 // ancestor's GraphicsLayer. That cannot be determined until all the des cendant
416 // RenderLayers of that ancestor have been processed via updateLayerPosi tions(). 416 // RenderLayers of that ancestor have been processed via updateLayerPosi tions().
417 // 417 //
418 // The solution is to update compositing children of this layer here, 418 // The solution is to update compositing children of this layer here,
419 // via updateCompositingChildrenGeometry(). 419 // via updateCompositingChildrenGeometry().
420 updateCompositedBounds(); 420 updateCompositedBounds();
421 layerCompositor->updateCompositingDescendantGeometry(m_owningLayer->stac kingNode(), m_owningLayer, flags & CompositingChildrenOnly); 421 layerCompositor->updateCompositingDescendantGeometry(m_owningLayer.stack ingNode(), &m_owningLayer, flags & CompositingChildrenOnly);
422 422
423 if (flags & IsUpdateRoot) { 423 if (flags & IsUpdateRoot) {
424 updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate); 424 updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate);
425 layerCompositor->updateRootLayerPosition(); 425 layerCompositor->updateRootLayerPosition();
426 RenderLayerStackingNode* stackingContainer = m_owningLayer->stacking Node()->enclosingStackingContainerNode(); 426 RenderLayerStackingNode* stackingContainer = m_owningLayer.stackingN ode()->enclosingStackingContainerNode();
427 if (!layerCompositor->compositingLayersNeedRebuild() && stackingCont ainer && (stackingContainer != m_owningLayer->stackingNode())) 427 if (!layerCompositor->compositingLayersNeedRebuild() && stackingCont ainer && (stackingContainer != m_owningLayer.stackingNode()))
428 layerCompositor->updateCompositingDescendantGeometry(stackingCon tainer, stackingContainer->layer(), flags & CompositingChildrenOnly); 428 layerCompositor->updateCompositingDescendantGeometry(stackingCon tainer, stackingContainer->layer(), flags & CompositingChildrenOnly);
429 } 429 }
430 } 430 }
431 431
432 if (flags & NeedsFullRepaint && !paintsIntoCompositedAncestor()) 432 if (flags & NeedsFullRepaint && !paintsIntoCompositedAncestor())
433 setContentsNeedDisplay(); 433 setContentsNeedDisplay();
434 } 434 }
435 435
436 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() 436 bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
437 { 437 {
438 RenderLayerCompositor* compositor = this->compositor(); 438 RenderLayerCompositor* compositor = this->compositor();
439 RenderObject* renderer = this->renderer(); 439 RenderObject* renderer = this->renderer();
440 440
441 m_owningLayer->updateDescendantDependentFlags(); 441 m_owningLayer.updateDescendantDependentFlags();
442 m_owningLayer->stackingNode()->updateZOrderLists(); 442 m_owningLayer.stackingNode()->updateZOrderLists();
443 443
444 bool layerConfigChanged = false; 444 bool layerConfigChanged = false;
445 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(m_owningLayer)); 445 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(&m_owningLayer));
446 446
447 // The background layer is currently only used for fixed root backgrounds. 447 // The background layer is currently only used for fixed root backgrounds.
448 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) 448 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
449 layerConfigChanged = true; 449 layerConfigChanged = true;
450 450
451 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owning Layer))) 451 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin gLayer)))
452 layerConfigChanged = true; 452 layerConfigChanged = true;
453 453
454 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants (m_owningLayer); 454 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants (&m_owningLayer);
455 455
456 // Our scrolling layer will clip. 456 // Our scrolling layer will clip.
457 if (m_owningLayer->needsCompositedScrolling()) 457 if (m_owningLayer.needsCompositedScrolling())
458 needsDescendentsClippingLayer = false; 458 needsDescendentsClippingLayer = false;
459 459
460 RenderLayer* scrollParent = m_owningLayer->scrollParent(); 460 RenderLayer* scrollParent = m_owningLayer.scrollParent();
461 bool needsAncestorClip = compositor->clippedByAncestor(m_owningLayer); 461 bool needsAncestorClip = compositor->clippedByAncestor(&m_owningLayer);
462 if (scrollParent) { 462 if (scrollParent) {
463 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped 463 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped
464 // to it via our scroll parent and we don't need an ancestor clipping la yer. 464 // to it via our scroll parent and we don't need an ancestor clipping la yer.
465 if (m_owningLayer->renderer()->containingBlock()->enclosingLayer() == m_ owningLayer->ancestorCompositedScrollingLayer()) 465 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o wningLayer.ancestorCompositedScrollingLayer())
466 needsAncestorClip = false; 466 needsAncestorClip = false;
467 } 467 }
468 468
469 if (updateClippingLayers(needsAncestorClip, needsDescendentsClippingLayer)) 469 if (updateClippingLayers(needsAncestorClip, needsDescendentsClippingLayer))
470 layerConfigChanged = true; 470 layerConfigChanged = true;
471 471
472 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer())) 472 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer()))
473 layerConfigChanged = true; 473 layerConfigChanged = true;
474 474
475 if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling())) 475 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling()))
476 layerConfigChanged = true; 476 layerConfigChanged = true;
477 477
478 bool hasPerspective = false; 478 bool hasPerspective = false;
479 if (RenderStyle* style = renderer->style()) 479 if (RenderStyle* style = renderer->style())
480 hasPerspective = style->hasPerspective(); 480 hasPerspective = style->hasPerspective();
481 bool needsChildTransformLayer = hasPerspective && (layerForChildrenTransform () == m_childTransformLayer.get()); 481 bool needsChildTransformLayer = hasPerspective && (layerForChildrenTransform () == m_childTransformLayer.get());
482 if (updateChildTransformLayer(needsChildTransformLayer)) 482 if (updateChildTransformLayer(needsChildTransformLayer))
483 layerConfigChanged = true; 483 layerConfigChanged = true;
484 484
485 updateScrollParent(scrollParent); 485 updateScrollParent(scrollParent);
486 updateClipParent(m_owningLayer->clipParent()); 486 updateClipParent(m_owningLayer.clipParent());
487 487
488 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) 488 if (updateSquashingLayers(!m_squashedLayers.isEmpty()))
489 layerConfigChanged = true; 489 layerConfigChanged = true;
490 490
491 if (layerConfigChanged) 491 if (layerConfigChanged)
492 updateInternalHierarchy(); 492 updateInternalHierarchy();
493 493
494 if (updateMaskLayer(renderer->hasMask())) 494 if (updateMaskLayer(renderer->hasMask()))
495 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 495 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
496 496
497 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(m_ownin gLayer) && (hasClippingLayer() || hasScrollingLayer()); 497 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni ngLayer) && (hasClippingLayer() || hasScrollingLayer());
498 bool needsChildClippingMask = (renderer->style()->clipPath() || renderer->st yle()->hasBorderRadius()) && (hasChildClippingLayer || isAcceleratedContents(ren derer)); 498 bool needsChildClippingMask = (renderer->style()->clipPath() || renderer->st yle()->hasBorderRadius()) && (hasChildClippingLayer || isAcceleratedContents(ren derer));
499 if (updateClippingMaskLayers(needsChildClippingMask)) { 499 if (updateClippingMaskLayers(needsChildClippingMask)) {
500 if (hasClippingLayer()) 500 if (hasClippingLayer())
501 clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get()); 501 clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
502 else if (hasScrollingLayer()) 502 else if (hasScrollingLayer())
503 scrollingLayer()->setMaskLayer(m_childClippingMaskLayer.get()); 503 scrollingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
504 else if (isAcceleratedContents(renderer)) 504 else if (isAcceleratedContents(renderer))
505 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay er.get()); 505 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay er.get());
506 } 506 }
507 507
508 if (m_owningLayer->reflectionInfo()) { 508 if (m_owningLayer.reflectionInfo()) {
509 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) { 509 if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLaye rMapping()) {
510 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); 510 GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->ref lectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
511 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); 511 m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
512 } 512 }
513 } else { 513 } else {
514 m_graphicsLayer->setReplicatedByLayer(0); 514 m_graphicsLayer->setReplicatedByLayer(0);
515 } 515 }
516 516
517 updateBackgroundColor(); 517 updateBackgroundColor();
518 518
519 if (isDirectlyCompositedImage()) 519 if (isDirectlyCompositedImage())
520 updateImageContents(); 520 updateImageContents();
(...skipping 29 matching lines...) Expand all
550 if (renderer->hasClip()) 550 if (renderer->hasClip())
551 result.intersect(renderer->clipRect(LayoutPoint())); 551 result.intersect(renderer->clipRect(LayoutPoint()));
552 552
553 return pixelSnappedIntRect(result); 553 return pixelSnappedIntRect(result);
554 } 554 }
555 555
556 void CompositedLayerMapping::adjustBoundsForSubPixelAccumulation(const RenderLay er* compositedAncestor, IntRect& localBounds, IntRect& relativeBounds, IntPoint& delta) 556 void CompositedLayerMapping::adjustBoundsForSubPixelAccumulation(const RenderLay er* compositedAncestor, IntRect& localBounds, IntRect& relativeBounds, IntPoint& delta)
557 { 557 {
558 LayoutRect localRawCompositingBounds = compositedBounds(); 558 LayoutRect localRawCompositingBounds = compositedBounds();
559 LayoutPoint rawDelta; 559 LayoutPoint rawDelta;
560 m_owningLayer->convertToLayerCoords(compositedAncestor, rawDelta); 560 m_owningLayer.convertToLayerCoords(compositedAncestor, rawDelta);
561 delta = flooredIntPoint(rawDelta); 561 delta = flooredIntPoint(rawDelta);
562 m_subpixelAccumulation = toLayoutSize(rawDelta).fraction(); 562 m_subpixelAccumulation = toLayoutSize(rawDelta).fraction();
563 RELEASE_ASSERT(m_subpixelAccumulation.width() < 1 && m_subpixelAccumulation. height() < 1); 563 RELEASE_ASSERT(m_subpixelAccumulation.width() < 1 && m_subpixelAccumulation. height() < 1);
564 564
565 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat ive to absolute pixels instead of local coordinates. 565 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat ive to absolute pixels instead of local coordinates.
566 localRawCompositingBounds.move(m_subpixelAccumulation); 566 localRawCompositingBounds.move(m_subpixelAccumulation);
567 localBounds = pixelSnappedIntRect(localRawCompositingBounds); 567 localBounds = pixelSnappedIntRect(localRawCompositingBounds);
568 568
569 relativeBounds = localBounds; 569 relativeBounds = localBounds;
570 relativeBounds.moveBy(delta); 570 relativeBounds.moveBy(delta);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 613
614 // FIXME: find a better design to avoid this redundant value - most like ly it will make 614 // FIXME: find a better design to avoid this redundant value - most like ly it will make
615 // sense to move the paint task info into RenderLayer's m_compositingPro perties. 615 // sense to move the paint task info into RenderLayer's m_compositingPro perties.
616 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer); 616 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer);
617 } 617 }
618 } 618 }
619 619
620 GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom etry(GraphicsLayerUpdater::UpdateType updateType) 620 GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom etry(GraphicsLayerUpdater::UpdateType updateType)
621 { 621 {
622 // If we haven't built z-order lists yet, wait until later. 622 // If we haven't built z-order lists yet, wait until later.
623 if (m_owningLayer->stackingNode()->isStackingContainer() && m_owningLayer->s tackingNode()->zOrderListsDirty()) 623 if (m_owningLayer.stackingNode()->isStackingContainer() && m_owningLayer.sta ckingNode()->zOrderListsDirty())
624 return updateType; 624 return updateType;
625 625
626 if (!m_needToUpdateGeometry && updateType != GraphicsLayerUpdater::ForceUpda te) 626 if (!m_needToUpdateGeometry && updateType != GraphicsLayerUpdater::ForceUpda te)
627 return updateType; 627 return updateType;
628 m_needToUpdateGeometry = false; 628 m_needToUpdateGeometry = false;
629 if (m_needToUpdateGeometryOfAllDecendants) 629 if (m_needToUpdateGeometryOfAllDecendants)
630 updateType = GraphicsLayerUpdater::ForceUpdate; 630 updateType = GraphicsLayerUpdater::ForceUpdate;
631 631
632 // Set transform property, if it is not animating. We have to do this here b ecause the transform 632 // Set transform property, if it is not animating. We have to do this here b ecause the transform
633 // is affected by the layer dimensions. 633 // is affected by the layer dimensions.
634 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform )) 634 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform ))
635 updateTransform(renderer()->style()); 635 updateTransform(renderer()->style());
636 636
637 // Set opacity, if it is not animating. 637 // Set opacity, if it is not animating.
638 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)) 638 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity))
639 updateOpacity(renderer()->style()); 639 updateOpacity(renderer()->style());
640 640
641 m_owningLayer->updateDescendantDependentFlags(); 641 m_owningLayer.updateDescendantDependentFlags();
642 642
643 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing 643 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing
644 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any 644 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any
645 // non-compositing visible layers. 645 // non-compositing visible layers.
646 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers(); 646 bool contentsVisible = m_owningLayer.hasVisibleContent() || hasVisibleNonCom positingDescendantLayers();
647 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { 647 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) {
648 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node()); 648 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node());
649 if (mediaElement->isFullscreen()) 649 if (mediaElement->isFullscreen())
650 contentsVisible = false; 650 contentsVisible = false;
651 } 651 }
652 m_graphicsLayer->setContentsVisible(contentsVisible); 652 m_graphicsLayer->setContentsVisible(contentsVisible);
653 653
654 RenderStyle* style = renderer()->style(); 654 RenderStyle* style = renderer()->style();
655 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible); 655 m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == Backfa ceVisibilityVisible);
656 656
657 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); 657 RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer();
658 658
659 // We compute everything relative to the enclosing compositing layer. 659 // We compute everything relative to the enclosing compositing layer.
660 IntRect ancestorCompositingBounds; 660 IntRect ancestorCompositingBounds;
661 if (compAncestor) { 661 if (compAncestor) {
662 ASSERT(compAncestor->hasCompositedLayerMapping()); 662 ASSERT(compAncestor->hasCompositedLayerMapping());
663 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds()); 663 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited LayerMapping()->compositedBounds());
664 } 664 }
665 665
666 IntRect localCompositingBounds; 666 IntRect localCompositingBounds;
667 IntRect relativeCompositingBounds; 667 IntRect relativeCompositingBounds;
(...skipping 14 matching lines...) Expand all
682 682
683 if (compAncestor && compAncestor->needsCompositedScrolling()) { 683 if (compAncestor && compAncestor->needsCompositedScrolling()) {
684 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); 684 RenderBox* renderBox = toRenderBox(compAncestor->renderer());
685 IntSize scrollOffset = renderBox->scrolledContentOffset(); 685 IntSize scrollOffset = renderBox->scrolledContentOffset();
686 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); 686 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop());
687 graphicsLayerParentLocation = scrollOrigin - scrollOffset; 687 graphicsLayerParentLocation = scrollOrigin - scrollOffset;
688 } 688 }
689 689
690 if (compAncestor && m_ancestorClippingLayer) { 690 if (compAncestor && m_ancestorClippingLayer) {
691 ClipRectsContext clipRectsContext(compAncestor, CompositingClipRects, Ig noreOverlayScrollbarSize, IgnoreOverflowClip); 691 ClipRectsContext clipRectsContext(compAncestor, CompositingClipRects, Ig noreOverlayScrollbarSize, IgnoreOverflowClip);
692 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->clipper().ba ckgroundClipRect(clipRectsContext).rect()); 692 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().bac kgroundClipRect(clipRectsContext).rect());
693 ASSERT(parentClipRect != PaintInfo::infiniteRect()); 693 ASSERT(parentClipRect != PaintInfo::infiniteRect());
694 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location( ) - graphicsLayerParentLocation)); 694 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location( ) - graphicsLayerParentLocation));
695 m_ancestorClippingLayer->setSize(parentClipRect.size()); 695 m_ancestorClippingLayer->setSize(parentClipRect.size());
696 696
697 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords. 697 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
698 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta); 698 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta);
699 699
700 // The primary layer is then parented in, and positioned relative to thi s clipping layer. 700 // The primary layer is then parented in, and positioned relative to thi s clipping layer.
701 graphicsLayerParentLocation = parentClipRect.location(); 701 graphicsLayerParentLocation = parentClipRect.location();
702 } 702 }
(...skipping 25 matching lines...) Expand all
728 728
729 if (m_maskLayer) { 729 if (m_maskLayer) {
730 if (m_maskLayer->size() != m_graphicsLayer->size()) { 730 if (m_maskLayer->size() != m_graphicsLayer->size()) {
731 m_maskLayer->setSize(m_graphicsLayer->size()); 731 m_maskLayer->setSize(m_graphicsLayer->size());
732 m_maskLayer->setNeedsDisplay(); 732 m_maskLayer->setNeedsDisplay();
733 } 733 }
734 m_maskLayer->setPosition(FloatPoint()); 734 m_maskLayer->setPosition(FloatPoint());
735 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer() ); 735 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer() );
736 } 736 }
737 737
738 if (m_owningLayer->hasTransform()) { 738 if (m_owningLayer.hasTransform()) {
739 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBox Rect(); 739 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBox Rect();
740 740
741 // Get layout bounds in the coords of compAncestor to match relativeComp ositingBounds. 741 // Get layout bounds in the coords of compAncestor to match relativeComp ositingBounds.
742 IntRect layerBounds(delta + roundedIntSize(m_subpixelAccumulation), bord erBox.size()); 742 IntRect layerBounds(delta + roundedIntSize(m_subpixelAccumulation), bord erBox.size());
743 743
744 // Update properties that depend on layer dimensions 744 // Update properties that depend on layer dimensions
745 FloatPoint3D transformOrigin = computeTransformOrigin(borderBox); 745 FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
746 // Compute the anchor point, which is in the center of the renderer box unless transform-origin is set. 746 // Compute the anchor point, which is in the center of the renderer box unless transform-origin is set.
747 FloatPoint3D anchor( 747 FloatPoint3D anchor(
748 relativeCompositingBounds.width() ? (layerBounds.x() - relativeCompo sitingBounds.x() + transformOrigin.x()) / relativeCompositingBounds.width() : 0 .5f, 748 relativeCompositingBounds.width() ? (layerBounds.x() - relativeCompo sitingBounds.x() + transformOrigin.x()) / relativeCompositingBounds.width() : 0 .5f,
(...skipping 29 matching lines...) Expand all
778 backgroundSize = frameView->visibleContentRect().size(); 778 backgroundSize = frameView->visibleContentRect().size();
779 } 779 }
780 m_backgroundLayer->setPosition(FloatPoint()); 780 m_backgroundLayer->setPosition(FloatPoint());
781 if (backgroundSize != m_backgroundLayer->size()) { 781 if (backgroundSize != m_backgroundLayer->size()) {
782 m_backgroundLayer->setSize(backgroundSize); 782 m_backgroundLayer->setSize(backgroundSize);
783 m_backgroundLayer->setNeedsDisplay(); 783 m_backgroundLayer->setNeedsDisplay();
784 } 784 }
785 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); 785 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer());
786 } 786 }
787 787
788 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) { 788 if (m_owningLayer.reflectionInfo() && m_owningLayer.reflectionInfo()->reflec tionLayer()->hasCompositedLayerMapping()) {
789 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); 789 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er.reflectionInfo()->reflectionLayer()->compositedLayerMapping();
790 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLa yerUpdater::ForceUpdate); 790 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLa yerUpdater::ForceUpdate);
791 791
792 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 792 // The reflection layer has the bounds of m_owningLayer.reflectionLayer( ),
793 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. 793 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately.
794 FloatRect layerBounds = compositedBounds(); 794 FloatRect layerBounds = compositedBounds();
795 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); 795 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds();
796 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; 796 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ;
797 } 797 }
798 798
799 if (m_scrollingLayer) { 799 if (m_scrollingLayer) {
800 ASSERT(m_scrollingContentsLayer); 800 ASSERT(m_scrollingContentsLayer);
801 RenderBox* renderBox = toRenderBox(renderer()); 801 RenderBox* renderBox = toRenderBox(renderer());
802 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); 802 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
803 803
804 IntSize adjustedScrollOffset = m_owningLayer->scrollableArea()->adjusted ScrollOffset(); 804 IntSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedS crollOffset();
805 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom positingBounds.location() + roundedIntSize(m_subpixelAccumulation))); 805 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom positingBounds.location() + roundedIntSize(m_subpixelAccumulation)));
806 m_scrollingLayer->setSize(clientBox.size()); 806 m_scrollingLayer->setSize(clientBox.size());
807 807
808 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer() ; 808 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer() ;
809 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()) ); 809 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()) );
810 810
811 if (m_childClippingMaskLayer) { 811 if (m_childClippingMaskLayer) {
812 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); 812 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
813 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); 813 m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
814 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox. location())); 814 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox. location()));
815 } 815 }
816 816
817 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLaye r->offsetFromRenderer(); 817 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLaye r->offsetFromRenderer();
818 818
819 IntSize scrollSize(renderBox->scrollWidth(), renderBox->scrollHeight()); 819 IntSize scrollSize(renderBox->scrollWidth(), renderBox->scrollHeight());
820 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetCha nged) 820 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetCha nged)
821 m_scrollingContentsLayer->setNeedsDisplay(); 821 m_scrollingContentsLayer->setNeedsDisplay();
822 822
823 IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjus tedScrollOffset); 823 IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjus tedScrollOffset);
824 if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRende rer() || scrollSize != m_scrollingContentsLayer->size()) { 824 if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRende rer() || scrollSize != m_scrollingContentsLayer->size()) {
825 bool coordinatorHandlesOffset = compositor()->scrollingLayerDidChang e(m_owningLayer); 825 bool coordinatorHandlesOffset = compositor()->scrollingLayerDidChang e(&m_owningLayer);
826 m_scrollingContentsLayer->setPosition(coordinatorHandlesOffset ? Flo atPoint() : FloatPoint(-adjustedScrollOffset)); 826 m_scrollingContentsLayer->setPosition(coordinatorHandlesOffset ? Flo atPoint() : FloatPoint(-adjustedScrollOffset));
827 } 827 }
828 828
829 m_scrollingContentsLayer->setSize(scrollSize); 829 m_scrollingContentsLayer->setSize(scrollSize);
830 // FIXME: The paint offset and the scroll offset should really be separa te concepts. 830 // FIXME: The paint offset and the scroll offset should really be separa te concepts.
831 m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay); 831 m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay);
832 832
833 if (m_foregroundLayer) { 833 if (m_foregroundLayer) {
834 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size()) 834 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
835 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); 835 m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
836 m_foregroundLayer->setNeedsDisplay(); 836 m_foregroundLayer->setNeedsDisplay();
837 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->o ffsetFromRenderer()); 837 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->o ffsetFromRenderer());
838 } 838 }
839 } 839 }
840 840
841 updateSquashingLayerGeometry(delta); 841 updateSquashingLayerGeometry(delta);
842 842
843 if (m_owningLayer->scrollableArea() && m_owningLayer->scrollableArea()->scro llsOverflow()) 843 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll sOverflow())
844 m_owningLayer->scrollableArea()->positionOverflowControls(); 844 m_owningLayer.scrollableArea()->positionOverflowControls();
845 845
846 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit edLayerMapping 846 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit edLayerMapping
847 // since it depends on whether compAncestor draws content, which gets update d later. 847 // since it depends on whether compAncestor draws content, which gets update d later.
848 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor); 848 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor);
849 849
850 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { 850 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
851 updateLayerBlendMode(style); 851 updateLayerBlendMode(style);
852 updateIsRootForIsolatedGroup(); 852 updateIsRootForIsolatedGroup();
853 } 853 }
854 854
(...skipping 12 matching lines...) Expand all
867 return updateType; 867 return updateType;
868 } 868 }
869 869
870 void CompositedLayerMapping::registerScrollingLayers() 870 void CompositedLayerMapping::registerScrollingLayers()
871 { 871 {
872 // Register fixed position layers and their containers with the scrolling co ordinator. 872 // Register fixed position layers and their containers with the scrolling co ordinator.
873 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); 873 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer);
874 if (!scrollingCoordinator) 874 if (!scrollingCoordinator)
875 return; 875 return;
876 876
877 compositor()->updateViewportConstraintStatus(m_owningLayer); 877 compositor()->updateViewportConstraintStatus(&m_owningLayer);
878 878
879 scrollingCoordinator->updateLayerPositionConstraint(m_owningLayer); 879 scrollingCoordinator->updateLayerPositionConstraint(&m_owningLayer);
880 880
881 // Page scale is applied as a transform on the root render view layer. Becau se the scroll 881 // Page scale is applied as a transform on the root render view layer. Becau se the scroll
882 // layer is further up in the hierarchy, we need to avoid marking the root r ender view 882 // layer is further up in the hierarchy, we need to avoid marking the root r ender view
883 // layer as a container. 883 // layer as a container.
884 bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLa yer(); 884 bool isContainer = m_owningLayer.hasTransform() && !m_owningLayer.isRootLaye r();
885 // FIXME: we should make certain that childForSuperLayers will never be the m_squashingContainmentLayer here 885 // FIXME: we should make certain that childForSuperLayers will never be the m_squashingContainmentLayer here
886 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(localRootFor OwningLayer(), isContainer); 886 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(localRootFor OwningLayer(), isContainer);
887 } 887 }
888 888
889 void CompositedLayerMapping::updateInternalHierarchy() 889 void CompositedLayerMapping::updateInternalHierarchy()
890 { 890 {
891 // m_foregroundLayer has to be inserted in the correct order with child laye rs, 891 // m_foregroundLayer has to be inserted in the correct order with child laye rs,
892 // so it's not inserted here. 892 // so it's not inserted here.
893 if (m_ancestorClippingLayer) 893 if (m_ancestorClippingLayer)
894 m_ancestorClippingLayer->removeAllChildren(); 894 m_ancestorClippingLayer->removeAllChildren();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); 946 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
947 } 947 }
948 948
949 void CompositedLayerMapping::updateDrawsContent() 949 void CompositedLayerMapping::updateDrawsContent()
950 { 950 {
951 if (m_scrollingLayer) { 951 if (m_scrollingLayer) {
952 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. 952 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere.
953 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint. 953 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint.
954 // m_scrollingLayer never has backing store. 954 // m_scrollingLayer never has backing store.
955 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint. 955 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint.
956 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && m_owningLayer->hasBoxDecorationsOrBackground(); 956 bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() & & m_owningLayer.hasBoxDecorationsOrBackground();
957 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); 957 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
958 958
959 bool hasScrollingPaintedContent = m_owningLayer->hasVisibleContent() && (renderer()->hasBackground() || paintsChildren()); 959 bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && ( renderer()->hasBackground() || paintsChildren());
960 m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent); 960 m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent);
961 return; 961 return;
962 } 962 }
963 963
964 bool hasPaintedContent = containsPaintedContent(); 964 bool hasPaintedContent = containsPaintedContent();
965 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { 965 if (hasPaintedContent && isAcceleratedCanvas(renderer())) {
966 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext(); 966 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext();
967 // Content layer may be null if context is lost. 967 // Content layer may be null if context is lost.
968 if (blink::WebLayer* contentLayer = context->platformLayer()) { 968 if (blink::WebLayer* contentLayer = context->platformLayer()) {
969 Color bgColor(Color::transparent); 969 Color bgColor(Color::transparent);
(...skipping 10 matching lines...) Expand all
980 if (m_foregroundLayer) 980 if (m_foregroundLayer)
981 m_foregroundLayer->setDrawsContent(hasPaintedContent); 981 m_foregroundLayer->setDrawsContent(hasPaintedContent);
982 982
983 if (m_backgroundLayer) 983 if (m_backgroundLayer)
984 m_backgroundLayer->setDrawsContent(hasPaintedContent); 984 m_backgroundLayer->setDrawsContent(hasPaintedContent);
985 } 985 }
986 986
987 void CompositedLayerMapping::updateChildrenTransform() 987 void CompositedLayerMapping::updateChildrenTransform()
988 { 988 {
989 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) { 989 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) {
990 childTransformLayer->setTransform(owningLayer()->perspectiveTransform()) ; 990 childTransformLayer->setTransform(owningLayer().perspectiveTransform());
991 bool hasPerspective = false; 991 bool hasPerspective = false;
992 if (RenderStyle* style = m_owningLayer->renderer()->style()) 992 if (RenderStyle* style = m_owningLayer.renderer()->style())
993 hasPerspective = style->hasPerspective(); 993 hasPerspective = style->hasPerspective();
994 if (hasPerspective) 994 if (hasPerspective)
995 childTransformLayer->setShouldFlattenTransform(false); 995 childTransformLayer->setShouldFlattenTransform(false);
996 996
997 // Note, if the target is the scrolling layer, we need to ensure that th e 997 // Note, if the target is the scrolling layer, we need to ensure that th e
998 // scrolling content layer doesn't flatten the transform. (It would be n ice 998 // scrolling content layer doesn't flatten the transform. (It would be n ice
999 // if we could apply transform to the scrolling content layer, but that' s 999 // if we could apply transform to the scrolling content layer, but that' s
1000 // too late, we need the children transform to be applied _before_ the 1000 // too late, we need the children transform to be applied _before_ the
1001 // scrolling offset.) 1001 // scrolling offset.)
1002 if (childTransformLayer == m_scrollingLayer.get()) 1002 if (childTransformLayer == m_scrollingLayer.get())
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 } 1073 }
1074 1074
1075 bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalSc rollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) 1075 bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalSc rollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer)
1076 { 1076 {
1077 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH orizontalScrollbar); 1077 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH orizontalScrollbar);
1078 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica lScrollbar); 1078 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica lScrollbar);
1079 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner); 1079 bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrol lCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner);
1080 1080
1081 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) { 1081 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1082 if (horizontalScrollbarLayerChanged) 1082 if (horizontalScrollbarLayerChanged)
1083 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer->scrollableArea(), HorizontalScrollbar); 1083 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), HorizontalScrollbar);
1084 if (verticalScrollbarLayerChanged) 1084 if (verticalScrollbarLayerChanged)
1085 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer->scrollableArea(), VerticalScrollbar); 1085 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), VerticalScrollbar);
1086 } 1086 }
1087 1087
1088 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged; 1088 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged;
1089 } 1089 }
1090 1090
1091 void CompositedLayerMapping::positionOverflowControlsLayers(const IntSize& offse tFromRoot) 1091 void CompositedLayerMapping::positionOverflowControlsLayers(const IntSize& offse tFromRoot)
1092 { 1092 {
1093 IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer() - rounded IntSize(m_subpixelAccumulation); 1093 IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer() - rounded IntSize(m_subpixelAccumulation);
1094 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { 1094 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
1095 Scrollbar* hBar = m_owningLayer->scrollableArea()->horizontalScrollbar() ; 1095 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar();
1096 if (hBar) { 1096 if (hBar) {
1097 layer->setPosition(hBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer); 1097 layer->setPosition(hBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer);
1098 layer->setSize(hBar->frameRect().size()); 1098 layer->setSize(hBar->frameRect().size());
1099 if (layer->hasContentsLayer()) 1099 if (layer->hasContentsLayer())
1100 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e())); 1100 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e()));
1101 } 1101 }
1102 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); 1102 layer->setDrawsContent(hBar && !layer->hasContentsLayer());
1103 } 1103 }
1104 1104
1105 if (GraphicsLayer* layer = layerForVerticalScrollbar()) { 1105 if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
1106 Scrollbar* vBar = m_owningLayer->scrollableArea()->verticalScrollbar(); 1106 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar();
1107 if (vBar) { 1107 if (vBar) {
1108 layer->setPosition(vBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer); 1108 layer->setPosition(vBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer);
1109 layer->setSize(vBar->frameRect().size()); 1109 layer->setSize(vBar->frameRect().size());
1110 if (layer->hasContentsLayer()) 1110 if (layer->hasContentsLayer())
1111 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz e())); 1111 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz e()));
1112 } 1112 }
1113 layer->setDrawsContent(vBar && !layer->hasContentsLayer()); 1113 layer->setDrawsContent(vBar && !layer->hasContentsLayer());
1114 } 1114 }
1115 1115
1116 if (GraphicsLayer* layer = layerForScrollCorner()) { 1116 if (GraphicsLayer* layer = layerForScrollCorner()) {
1117 const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollableArea ()->scrollCornerAndResizerRect(); 1117 const LayoutRect& scrollCornerAndResizer = m_owningLayer.scrollableArea( )->scrollCornerAndResizerRect();
1118 layer->setPosition(scrollCornerAndResizer.location() - offsetFromRendere r); 1118 layer->setPosition(scrollCornerAndResizer.location() - offsetFromRendere r);
1119 layer->setSize(scrollCornerAndResizer.size()); 1119 layer->setSize(scrollCornerAndResizer.size());
1120 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); 1120 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
1121 } 1121 }
1122 } 1122 }
1123 1123
1124 bool CompositedLayerMapping::hasUnpositionedOverflowControlsLayers() const 1124 bool CompositedLayerMapping::hasUnpositionedOverflowControlsLayers() const
1125 { 1125 {
1126 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { 1126 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
1127 if (!layer->drawsContent()) 1127 if (!layer->drawsContent())
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 int id = 0; 1205 int id = 0;
1206 1206
1207 // NB, it is illegal at this point to query an ancestor's compositing state. Some compositing 1207 // NB, it is illegal at this point to query an ancestor's compositing state. Some compositing
1208 // reasons depend on the compositing state of ancestors. So if we want a ren dering context id 1208 // reasons depend on the compositing state of ancestors. So if we want a ren dering context id
1209 // for the context root, we cannot ask for the id of its associated WebLayer now; it may not have 1209 // for the context root, we cannot ask for the id of its associated WebLayer now; it may not have
1210 // one yet. We could do a second past after doing the compositing updates to get these ids, 1210 // one yet. We could do a second past after doing the compositing updates to get these ids,
1211 // but this would actually be harmful. We do not want to attach any semantic meaning to 1211 // but this would actually be harmful. We do not want to attach any semantic meaning to
1212 // the context id other than the fact that they group a number of layers tog ether for the 1212 // the context id other than the fact that they group a number of layers tog ether for the
1213 // sake of 3d sorting. So instead we will ask the compositor to vend us an a rbitrary, but 1213 // sake of 3d sorting. So instead we will ask the compositor to vend us an a rbitrary, but
1214 // consistent id. 1214 // consistent id.
1215 if (RenderLayer* root = m_owningLayer->renderingContextRoot()) { 1215 if (RenderLayer* root = m_owningLayer.renderingContextRoot()) {
1216 if (Node* node = root->renderer()->node()) 1216 if (Node* node = root->renderer()->node())
1217 id = static_cast<int>(WTF::PtrHash<Node*>::hash(node)); 1217 id = static_cast<int>(WTF::PtrHash<Node*>::hash(node));
1218 } 1218 }
1219 1219
1220 UpdateRenderingContextFunctor functor = { id }; 1220 UpdateRenderingContextFunctor functor = { id };
1221 ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashin gLayer; 1221 ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashin gLayer;
1222 ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode); 1222 ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode);
1223 } 1223 }
1224 1224
1225 struct UpdateShouldFlattenTransformFunctor { 1225 struct UpdateShouldFlattenTransformFunctor {
1226 void operator() (GraphicsLayer* layer) const { layer->setShouldFlattenTransf orm(shouldFlatten); } 1226 void operator() (GraphicsLayer* layer) const { layer->setShouldFlattenTransf orm(shouldFlatten); }
1227 bool shouldFlatten; 1227 bool shouldFlatten;
1228 }; 1228 };
1229 1229
1230 void CompositedLayerMapping::updateShouldFlattenTransform() 1230 void CompositedLayerMapping::updateShouldFlattenTransform()
1231 { 1231 {
1232 // All CLM-managed layers that could affect a descendant layer should update their 1232 // All CLM-managed layers that could affect a descendant layer should update their
1233 // should-flatten-transform value (the other layers' transforms don't matter here). 1233 // should-flatten-transform value (the other layers' transforms don't matter here).
1234 UpdateShouldFlattenTransformFunctor functor = { m_owningLayer->shouldFlatten Transform() }; 1234 UpdateShouldFlattenTransformFunctor functor = { m_owningLayer.shouldFlattenT ransform() };
1235 ApplyToGraphicsLayersMode mode = ApplyToCoreLayers; 1235 ApplyToGraphicsLayersMode mode = ApplyToCoreLayers;
1236 ApplyToGraphicsLayers(this, functor, mode); 1236 ApplyToGraphicsLayers(this, functor, mode);
1237 } 1237 }
1238 1238
1239 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) 1239 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
1240 { 1240 {
1241 bool layerChanged = false; 1241 bool layerChanged = false;
1242 if (needsForegroundLayer) { 1242 if (needsForegroundLayer) {
1243 if (!m_foregroundLayer) { 1243 if (!m_foregroundLayer) {
1244 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); 1244 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 if (m_backgroundLayer) { 1277 if (m_backgroundLayer) {
1278 m_backgroundLayer->removeFromParent(); 1278 m_backgroundLayer->removeFromParent();
1279 m_backgroundLayer = nullptr; 1279 m_backgroundLayer = nullptr;
1280 #if !OS(ANDROID) 1280 #if !OS(ANDROID)
1281 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles( true); 1281 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles( true);
1282 #endif 1282 #endif
1283 layerChanged = true; 1283 layerChanged = true;
1284 } 1284 }
1285 } 1285 }
1286 1286
1287 if (layerChanged && !m_owningLayer->renderer()->documentBeingDestroyed()) 1287 if (layerChanged && !m_owningLayer.renderer()->documentBeingDestroyed())
1288 compositor()->rootFixedBackgroundsChanged(); 1288 compositor()->rootFixedBackgroundsChanged();
1289 1289
1290 return layerChanged; 1290 return layerChanged;
1291 } 1291 }
1292 1292
1293 bool CompositedLayerMapping::updateMaskLayer(bool needsMaskLayer) 1293 bool CompositedLayerMapping::updateMaskLayer(bool needsMaskLayer)
1294 { 1294 {
1295 bool layerChanged = false; 1295 bool layerChanged = false;
1296 if (needsMaskLayer) { 1296 if (needsMaskLayer) {
1297 if (!m_maskLayer) { 1297 if (!m_maskLayer) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents); 1344 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents);
1345 m_scrollingContentsLayer->setDrawsContent(true); 1345 m_scrollingContentsLayer->setDrawsContent(true);
1346 GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowCo ntents | GraphicsLayerPaintCompositedScroll; 1346 GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowCo ntents | GraphicsLayerPaintCompositedScroll;
1347 if (!m_foregroundLayer) 1347 if (!m_foregroundLayer)
1348 paintPhase |= GraphicsLayerPaintForeground; 1348 paintPhase |= GraphicsLayerPaintForeground;
1349 m_scrollingContentsLayer->setPaintingPhase(paintPhase); 1349 m_scrollingContentsLayer->setPaintingPhase(paintPhase);
1350 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); 1350 m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
1351 1351
1352 layerChanged = true; 1352 layerChanged = true;
1353 if (scrollingCoordinator) 1353 if (scrollingCoordinator)
1354 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer->scrollableArea()); 1354 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.scrollableArea());
1355 } 1355 }
1356 } else if (m_scrollingLayer) { 1356 } else if (m_scrollingLayer) {
1357 m_scrollingLayer = nullptr; 1357 m_scrollingLayer = nullptr;
1358 m_scrollingContentsLayer = nullptr; 1358 m_scrollingContentsLayer = nullptr;
1359 layerChanged = true; 1359 layerChanged = true;
1360 if (scrollingCoordinator) 1360 if (scrollingCoordinator)
1361 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er->scrollableArea()); 1361 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.scrollableArea());
1362 } 1362 }
1363 1363
1364 if (layerChanged) { 1364 if (layerChanged) {
1365 updateInternalHierarchy(); 1365 updateInternalHierarchy();
1366 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); 1366 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
1367 m_graphicsLayer->setNeedsDisplay(); 1367 m_graphicsLayer->setNeedsDisplay();
1368 if (renderer()->view()) 1368 if (renderer()->view())
1369 compositor()->scrollingLayerDidChange(m_owningLayer); 1369 compositor()->scrollingLayerDidChange(&m_owningLayer);
1370 } 1370 }
1371 1371
1372 return layerChanged; 1372 return layerChanged;
1373 } 1373 }
1374 1374
1375 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, RenderLayer* scrollParent, ScrollingCoordinator* scrollingCoor dinator) 1375 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, RenderLayer* scrollParent, ScrollingCoordinator* scrollingCoor dinator)
1376 { 1376 {
1377 if (!layer) 1377 if (!layer)
1378 return; 1378 return;
1379 1379
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 if (!m_foregroundLayer) 1445 if (!m_foregroundLayer)
1446 phase |= GraphicsLayerPaintForeground; 1446 phase |= GraphicsLayerPaintForeground;
1447 if (!m_maskLayer) 1447 if (!m_maskLayer)
1448 phase |= GraphicsLayerPaintMask; 1448 phase |= GraphicsLayerPaintMask;
1449 1449
1450 if (m_scrollingContentsLayer) { 1450 if (m_scrollingContentsLayer) {
1451 phase &= ~GraphicsLayerPaintForeground; 1451 phase &= ~GraphicsLayerPaintForeground;
1452 phase |= GraphicsLayerPaintCompositedScroll; 1452 phase |= GraphicsLayerPaintCompositedScroll;
1453 } 1453 }
1454 1454
1455 if (m_owningLayer->compositingReasons() & CompositingReasonOverflowScrolling Parent) 1455 if (m_owningLayer.compositingReasons() & CompositingReasonOverflowScrollingP arent)
1456 phase |= GraphicsLayerPaintCompositedScroll; 1456 phase |= GraphicsLayerPaintCompositedScroll;
1457 1457
1458 return static_cast<GraphicsLayerPaintingPhase>(phase); 1458 return static_cast<GraphicsLayerPaintingPhase>(phase);
1459 } 1459 }
1460 1460
1461 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const 1461 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const
1462 { 1462 {
1463 float finalOpacity = rendererOpacity; 1463 float finalOpacity = rendererOpacity;
1464 1464
1465 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent( )) { 1465 for (RenderLayer* curr = m_owningLayer.parent(); curr; curr = curr->parent() ) {
1466 // We only care about parents that are stacking contexts. 1466 // We only care about parents that are stacking contexts.
1467 // Recall that opacity creates stacking context. 1467 // Recall that opacity creates stacking context.
1468 if (!curr->stackingNode()->isStackingContainer()) 1468 if (!curr->stackingNode()->isStackingContainer())
1469 continue; 1469 continue;
1470 1470
1471 // If we found a composited layer, regardless of whether it actually 1471 // If we found a composited layer, regardless of whether it actually
1472 // paints into it, we want to compute opacity relative to it. So we can 1472 // paints into it, we want to compute opacity relative to it. So we can
1473 // break here. 1473 // break here.
1474 // 1474 //
1475 // FIXME: with grouped backings, a composited descendant will have to 1475 // FIXME: with grouped backings, a composited descendant will have to
(...skipping 19 matching lines...) Expand all
1495 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor); 1495 return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor);
1496 } 1496 }
1497 1497
1498 void CompositedLayerMapping::updateBackgroundColor() 1498 void CompositedLayerMapping::updateBackgroundColor()
1499 { 1499 {
1500 m_graphicsLayer->setBackgroundColor(rendererBackgroundColor()); 1500 m_graphicsLayer->setBackgroundColor(rendererBackgroundColor());
1501 } 1501 }
1502 1502
1503 bool CompositedLayerMapping::paintsChildren() const 1503 bool CompositedLayerMapping::paintsChildren() const
1504 { 1504 {
1505 if (m_owningLayer->hasVisibleContent() && m_owningLayer->hasNonEmptyChildRen derers()) 1505 if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildRende rers())
1506 return true; 1506 return true;
1507 1507
1508 if (hasVisibleNonCompositingDescendantLayers()) 1508 if (hasVisibleNonCompositingDescendantLayers())
1509 return true; 1509 return true;
1510 1510
1511 return false; 1511 return false;
1512 } 1512 }
1513 1513
1514 static bool isCompositedPlugin(RenderObject* renderer) 1514 static bool isCompositedPlugin(RenderObject* renderer)
1515 { 1515 {
(...skipping 22 matching lines...) Expand all
1538 } 1538 }
1539 1539
1540 return false; 1540 return false;
1541 } 1541 }
1542 1542
1543 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something 1543 // FIXME: By name the implementation is correct. But the code that uses this fun ction means something
1544 // very slightly different - the implementation needs to also include composited descendants that 1544 // very slightly different - the implementation needs to also include composited descendants that
1545 // don't paint into their own backing, and instead paint into this backing. 1545 // don't paint into their own backing, and instead paint into this backing.
1546 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const 1546 bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const
1547 { 1547 {
1548 return hasVisibleNonCompositingDescendant(m_owningLayer); 1548 return hasVisibleNonCompositingDescendant(&m_owningLayer);
1549 } 1549 }
1550 1550
1551 bool CompositedLayerMapping::containsPaintedContent() const 1551 bool CompositedLayerMapping::containsPaintedContent() const
1552 { 1552 {
1553 if (paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owni ngLayer->isReflection()) 1553 if (paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owni ngLayer.isReflection())
1554 return false; 1554 return false;
1555 1555
1556 if (isDirectlyCompositedImage()) 1556 if (isDirectlyCompositedImage())
1557 return false; 1557 return false;
1558 1558
1559 RenderObject* renderObject = renderer(); 1559 RenderObject* renderObject = renderer();
1560 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely, 1560 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
1561 // and set background color on the layer in that case, instead of allocating backing store and painting. 1561 // and set background color on the layer in that case, instead of allocating backing store and painting.
1562 if (renderObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo ()) 1562 if (renderObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo ())
1563 return m_owningLayer->hasBoxDecorationsOrBackground(); 1563 return m_owningLayer.hasBoxDecorationsOrBackground();
1564 1564
1565 if (m_owningLayer->hasVisibleBoxDecorations()) 1565 if (m_owningLayer.hasVisibleBoxDecorations())
1566 return true; 1566 return true;
1567 1567
1568 if (renderObject->hasMask()) // masks require special treatment 1568 if (renderObject->hasMask()) // masks require special treatment
1569 return true; 1569 return true;
1570 1570
1571 if (renderObject->isReplaced() && !isCompositedPlugin(renderObject)) 1571 if (renderObject->isReplaced() && !isCompositedPlugin(renderObject))
1572 return true; 1572 return true;
1573 1573
1574 if (renderObject->isRenderRegion()) 1574 if (renderObject->isRenderRegion())
1575 return true; 1575 return true;
(...skipping 16 matching lines...) Expand all
1592 // FIXME: it's O(n^2). A better solution is needed. 1592 // FIXME: it's O(n^2). A better solution is needed.
1593 return paintsChildren(); 1593 return paintsChildren();
1594 } 1594 }
1595 1595
1596 // An image can be directly compositing if it's the sole content of the layer, a nd has no box decorations 1596 // An image can be directly compositing if it's the sole content of the layer, a nd has no box decorations
1597 // that require painting. Direct compositing saves backing store. 1597 // that require painting. Direct compositing saves backing store.
1598 bool CompositedLayerMapping::isDirectlyCompositedImage() const 1598 bool CompositedLayerMapping::isDirectlyCompositedImage() const
1599 { 1599 {
1600 RenderObject* renderObject = renderer(); 1600 RenderObject* renderObject = renderer();
1601 1601
1602 if (!renderObject->isImage() || m_owningLayer->hasBoxDecorationsOrBackground () || renderObject->hasClip()) 1602 if (!renderObject->isImage() || m_owningLayer.hasBoxDecorationsOrBackground( ) || renderObject->hasClip())
1603 return false; 1603 return false;
1604 1604
1605 RenderImage* imageRenderer = toRenderImage(renderObject); 1605 RenderImage* imageRenderer = toRenderImage(renderObject);
1606 if (ImageResource* cachedImage = imageRenderer->cachedImage()) { 1606 if (ImageResource* cachedImage = imageRenderer->cachedImage()) {
1607 if (!cachedImage->hasImage()) 1607 if (!cachedImage->hasImage())
1608 return false; 1608 return false;
1609 1609
1610 Image* image = cachedImage->imageForRenderer(imageRenderer); 1610 Image* image = cachedImage->imageForRenderer(imageRenderer);
1611 return image->isBitmapImage(); 1611 return image->isBitmapImage();
1612 } 1612 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 1743
1744 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor) 1744 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor)
1745 paintsIntoCompositedAncestorChanged(); 1745 paintsIntoCompositedAncestorChanged();
1746 return m_requiresOwnBackingStoreForAncestorReasons != previousRequiresOwnBac kingStoreForAncestorReasons; 1746 return m_requiresOwnBackingStoreForAncestorReasons != previousRequiresOwnBac kingStoreForAncestorReasons;
1747 } 1747 }
1748 1748
1749 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForIntrinsicReasons() 1749 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForIntrinsicReasons()
1750 { 1750 {
1751 bool previousRequiresOwnBackingStoreForIntrinsicReasons = m_requiresOwnBacki ngStoreForIntrinsicReasons; 1751 bool previousRequiresOwnBackingStoreForIntrinsicReasons = m_requiresOwnBacki ngStoreForIntrinsicReasons;
1752 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor(); 1752 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor();
1753 RenderObject* renderer = m_owningLayer->renderer(); 1753 RenderObject* renderer = m_owningLayer.renderer();
1754 m_requiresOwnBackingStoreForIntrinsicReasons = m_owningLayer->isRootLayer() 1754 m_requiresOwnBackingStoreForIntrinsicReasons = m_owningLayer.isRootLayer()
1755 || (m_owningLayer->compositingReasons() & CompositingReasonComboReasonsT hatRequireOwnBacking) 1755 || (m_owningLayer.compositingReasons() & CompositingReasonComboReasonsTh atRequireOwnBacking)
1756 || m_owningLayer->transform() 1756 || m_owningLayer.transform()
1757 || m_owningLayer->clipsCompositingDescendantsWithBorderRadius() // FIXME : Revisit this if the paintsIntoCompositedAncestor state is removed. 1757 || m_owningLayer.clipsCompositingDescendantsWithBorderRadius() // FIXME: Revisit this if the paintsIntoCompositedAncestor state is removed.
1758 || renderer->isTransparent() 1758 || renderer->isTransparent()
1759 || renderer->hasMask() 1759 || renderer->hasMask()
1760 || renderer->hasReflection() 1760 || renderer->hasReflection()
1761 || renderer->hasFilter(); 1761 || renderer->hasFilter();
1762 1762
1763 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor) 1763 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor)
1764 paintsIntoCompositedAncestorChanged(); 1764 paintsIntoCompositedAncestorChanged();
1765 return m_requiresOwnBackingStoreForIntrinsicReasons != previousRequiresOwnBa ckingStoreForIntrinsicReasons; 1765 return m_requiresOwnBackingStoreForIntrinsicReasons != previousRequiresOwnBa ckingStoreForIntrinsicReasons;
1766 } 1766 }
1767 1767
1768 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged() 1768 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged()
1769 { 1769 {
1770 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when 1770 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when
1771 // it changes we have to clear clip rects on descendants. 1771 // it changes we have to clear clip rects on descendants.
1772 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s); 1772 m_owningLayer.clipper().clearClipRectsIncludingDescendants(PaintingClipRects );
1773 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants(); 1773 m_owningLayer.repainter().computeRepaintRectsIncludingDescendants();
1774 1774
1775 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ; 1775 compositor()->repaintInCompositedAncestor(&m_owningLayer, compositedBounds() );
1776 } 1776 }
1777 1777
1778 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) 1778 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode)
1779 { 1779 {
1780 if (m_ancestorClippingLayer) { 1780 if (m_ancestorClippingLayer) {
1781 m_ancestorClippingLayer->setBlendMode(blendMode); 1781 m_ancestorClippingLayer->setBlendMode(blendMode);
1782 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); 1782 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal);
1783 } else { 1783 } else {
1784 m_graphicsLayer->setBlendMode(blendMode); 1784 m_graphicsLayer->setBlendMode(blendMode);
1785 } 1785 }
1786 } 1786 }
1787 1787
1788 void CompositedLayerMapping::setNeedsGeometryUpdate() 1788 void CompositedLayerMapping::setNeedsGeometryUpdate()
1789 { 1789 {
1790 m_needToUpdateGeometryOfAllDecendants = true; 1790 m_needToUpdateGeometryOfAllDecendants = true;
1791 1791
1792 for (RenderLayer* current = m_owningLayer; current; current = current->ances torCompositingLayer()) { 1792 for (RenderLayer* current = &m_owningLayer; current; current = current->ance storCompositingLayer()) {
1793 // FIXME: We should be able to return early from this function once we 1793 // FIXME: We should be able to return early from this function once we
1794 // find a CompositedLayerMapping that has m_needToUpdateGeometry set. 1794 // find a CompositedLayerMapping that has m_needToUpdateGeometry set.
1795 // However, we can't do that until we remove the incremental compositing 1795 // However, we can't do that until we remove the incremental compositing
1796 // updates because they can clear m_needToUpdateGeometry without walking 1796 // updates because they can clear m_needToUpdateGeometry without walking
1797 // the whole tree. 1797 // the whole tree.
1798 ASSERT(current->hasCompositedLayerMapping()); 1798 ASSERT(current->hasCompositedLayerMapping());
1799 CompositedLayerMappingPtr mapping = current->compositedLayerMapping(); 1799 CompositedLayerMappingPtr mapping = current->compositedLayerMapping();
1800 mapping->m_needToUpdateGeometry = true; 1800 mapping->m_needToUpdateGeometry = true;
1801 } 1801 }
1802 } 1802 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 // Up-call from compositing layer drawing callback. 1936 // Up-call from compositing layer drawing callback.
1937 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G raphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect & clip) 1937 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G raphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect & clip)
1938 { 1938 {
1939 // https://code.google.com/p/chromium/issues/detail?id=343772 1939 // https://code.google.com/p/chromium/issues/detail?id=343772
1940 DisableCompositingQueryAsserts disabler; 1940 DisableCompositingQueryAsserts disabler;
1941 #ifndef NDEBUG 1941 #ifndef NDEBUG
1942 // FIXME: once the state machine is ready, this can be removed and we can re fer to that instead. 1942 // FIXME: once the state machine is ready, this can be removed and we can re fer to that instead.
1943 if (Page* page = renderer()->frame()->page()) 1943 if (Page* page = renderer()->frame()->page())
1944 page->setIsPainting(true); 1944 page->setIsPainting(true);
1945 #endif 1945 #endif
1946 InspectorInstrumentation::willPaint(m_owningLayer->renderer(), graphicsLayer ); 1946 InspectorInstrumentation::willPaint(m_owningLayer.renderer(), graphicsLayer) ;
1947 1947
1948 if (graphicsLayer == m_graphicsLayer.get() 1948 if (graphicsLayer == m_graphicsLayer.get()
1949 || graphicsLayer == m_foregroundLayer.get() 1949 || graphicsLayer == m_foregroundLayer.get()
1950 || graphicsLayer == m_backgroundLayer.get() 1950 || graphicsLayer == m_backgroundLayer.get()
1951 || graphicsLayer == m_maskLayer.get() 1951 || graphicsLayer == m_maskLayer.get()
1952 || graphicsLayer == m_childClippingMaskLayer.get() 1952 || graphicsLayer == m_childClippingMaskLayer.get()
1953 || graphicsLayer == m_scrollingContentsLayer.get()) { 1953 || graphicsLayer == m_scrollingContentsLayer.get()) {
1954 1954
1955 GraphicsLayerPaintInfo paintInfo; 1955 GraphicsLayerPaintInfo paintInfo;
1956 paintInfo.renderLayer = m_owningLayer; 1956 paintInfo.renderLayer = &m_owningLayer;
1957 paintInfo.compositedBounds = compositedBounds(); 1957 paintInfo.compositedBounds = compositedBounds();
1958 paintInfo.offsetFromRenderer = graphicsLayer->offsetFromRenderer(); 1958 paintInfo.offsetFromRenderer = graphicsLayer->offsetFromRenderer();
1959 paintInfo.paintingPhase = paintingPhase; 1959 paintInfo.paintingPhase = paintingPhase;
1960 paintInfo.isBackgroundLayer = (graphicsLayer == m_backgroundLayer); 1960 paintInfo.isBackgroundLayer = (graphicsLayer == m_backgroundLayer);
1961 1961
1962 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. 1962 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
1963 doPaintTask(paintInfo, &context, clip); 1963 doPaintTask(paintInfo, &context, clip);
1964 } else if (graphicsLayer == m_squashingLayer.get()) { 1964 } else if (graphicsLayer == m_squashingLayer.get()) {
1965 ASSERT(compositor()->layerSquashingEnabled()); 1965 ASSERT(compositor()->layerSquashingEnabled());
1966 for (size_t i = 0; i < m_squashedLayers.size(); ++i) 1966 for (size_t i = 0; i < m_squashedLayers.size(); ++i)
1967 doPaintTask(m_squashedLayers[i], &context, clip); 1967 doPaintTask(m_squashedLayers[i], &context, clip);
1968 } else if (graphicsLayer == layerForHorizontalScrollbar()) { 1968 } else if (graphicsLayer == layerForHorizontalScrollbar()) {
1969 paintScrollbar(m_owningLayer->scrollableArea()->horizontalScrollbar(), c ontext, clip); 1969 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co ntext, clip);
1970 } else if (graphicsLayer == layerForVerticalScrollbar()) { 1970 } else if (graphicsLayer == layerForVerticalScrollbar()) {
1971 paintScrollbar(m_owningLayer->scrollableArea()->verticalScrollbar(), con text, clip); 1971 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont ext, clip);
1972 } else if (graphicsLayer == layerForScrollCorner()) { 1972 } else if (graphicsLayer == layerForScrollCorner()) {
1973 const IntRect& scrollCornerAndResizer = m_owningLayer->scrollableArea()- >scrollCornerAndResizerRect(); 1973 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()-> scrollCornerAndResizerRect();
1974 context.save(); 1974 context.save();
1975 context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y ()); 1975 context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y ());
1976 IntRect transformedClip = clip; 1976 IntRect transformedClip = clip;
1977 transformedClip.moveBy(scrollCornerAndResizer.location()); 1977 transformedClip.moveBy(scrollCornerAndResizer.location());
1978 m_owningLayer->scrollableArea()->paintScrollCorner(&context, IntPoint(), transformedClip); 1978 m_owningLayer.scrollableArea()->paintScrollCorner(&context, IntPoint(), transformedClip);
1979 m_owningLayer->scrollableArea()->paintResizer(&context, IntPoint(), tran sformedClip); 1979 m_owningLayer.scrollableArea()->paintResizer(&context, IntPoint(), trans formedClip);
1980 context.restore(); 1980 context.restore();
1981 } 1981 }
1982 InspectorInstrumentation::didPaint(m_owningLayer->renderer(), graphicsLayer, &context, clip); 1982 InspectorInstrumentation::didPaint(m_owningLayer.renderer(), graphicsLayer, &context, clip);
1983 #ifndef NDEBUG 1983 #ifndef NDEBUG
1984 if (Page* page = renderer()->frame()->page()) 1984 if (Page* page = renderer()->frame()->page())
1985 page->setIsPainting(false); 1985 page->setIsPainting(false);
1986 #endif 1986 #endif
1987 } 1987 }
1988 1988
1989 bool CompositedLayerMapping::isTrackingRepaints() const 1989 bool CompositedLayerMapping::isTrackingRepaints() const
1990 { 1990 {
1991 GraphicsLayerClient* client = compositor(); 1991 GraphicsLayerClient* client = compositor();
1992 return client ? client->isTrackingRepaints() : false; 1992 return client ? client->isTrackingRepaints() : false;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 2078
2079 // Any additional squashed RenderLayers in the array no longer exist, and re moving invalidates the squashingLayer contents. 2079 // Any additional squashed RenderLayers in the array no longer exist, and re moving invalidates the squashingLayer contents.
2080 if (nextSquashedLayerIndex < m_squashedLayers.size()) 2080 if (nextSquashedLayerIndex < m_squashedLayers.size())
2081 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex); 2081 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
2082 } 2082 }
2083 2083
2084 String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer) 2084 String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer)
2085 { 2085 {
2086 String name; 2086 String name;
2087 if (graphicsLayer == m_graphicsLayer.get()) { 2087 if (graphicsLayer == m_graphicsLayer.get()) {
2088 name = m_owningLayer->debugName(); 2088 name = m_owningLayer.debugName();
2089 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { 2089 } else if (graphicsLayer == m_squashingContainmentLayer.get()) {
2090 name = "Squashing Containment Layer"; 2090 name = "Squashing Containment Layer";
2091 } else if (graphicsLayer == m_squashingLayer.get()) { 2091 } else if (graphicsLayer == m_squashingLayer.get()) {
2092 name = "Squashing Layer"; 2092 name = "Squashing Layer";
2093 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { 2093 } else if (graphicsLayer == m_ancestorClippingLayer.get()) {
2094 name = "Ancestor Clipping Layer"; 2094 name = "Ancestor Clipping Layer";
2095 } else if (graphicsLayer == m_foregroundLayer.get()) { 2095 } else if (graphicsLayer == m_foregroundLayer.get()) {
2096 name = m_owningLayer->debugName() + " (foreground) Layer"; 2096 name = m_owningLayer.debugName() + " (foreground) Layer";
2097 } else if (graphicsLayer == m_backgroundLayer.get()) { 2097 } else if (graphicsLayer == m_backgroundLayer.get()) {
2098 name = m_owningLayer->debugName() + " (background) Layer"; 2098 name = m_owningLayer.debugName() + " (background) Layer";
2099 } else if (graphicsLayer == m_childContainmentLayer.get()) { 2099 } else if (graphicsLayer == m_childContainmentLayer.get()) {
2100 name = "Child Containment Layer"; 2100 name = "Child Containment Layer";
2101 } else if (graphicsLayer == m_childTransformLayer.get()) { 2101 } else if (graphicsLayer == m_childTransformLayer.get()) {
2102 name = "Child Transform Layer"; 2102 name = "Child Transform Layer";
2103 } else if (graphicsLayer == m_maskLayer.get()) { 2103 } else if (graphicsLayer == m_maskLayer.get()) {
2104 name = "Mask Layer"; 2104 name = "Mask Layer";
2105 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { 2105 } else if (graphicsLayer == m_childClippingMaskLayer.get()) {
2106 name = "Child Clipping Mask Layer"; 2106 name = "Child Clipping Mask Layer";
2107 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { 2107 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
2108 name = "Horizontal Scrollbar Layer"; 2108 name = "Horizontal Scrollbar Layer";
2109 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { 2109 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
2110 name = "Vertical Scrollbar Layer"; 2110 name = "Vertical Scrollbar Layer";
2111 } else if (graphicsLayer == m_layerForScrollCorner.get()) { 2111 } else if (graphicsLayer == m_layerForScrollCorner.get()) {
2112 name = "Scroll Corner Layer"; 2112 name = "Scroll Corner Layer";
2113 } else if (graphicsLayer == m_scrollingLayer.get()) { 2113 } else if (graphicsLayer == m_scrollingLayer.get()) {
2114 name = "Scrolling Layer"; 2114 name = "Scrolling Layer";
2115 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2115 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2116 name = "Scrolling Contents Layer"; 2116 name = "Scrolling Contents Layer";
2117 } else { 2117 } else {
2118 ASSERT_NOT_REACHED(); 2118 ASSERT_NOT_REACHED();
2119 } 2119 }
2120 2120
2121 return name; 2121 return name;
2122 } 2122 }
2123 2123
2124 } // namespace WebCore 2124 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698