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

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

Issue 898783003: Move rendering/RenderLayer* to layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
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 19 matching lines...) Expand all
30 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
31 #include "core/fetch/ImageResource.h" 31 #include "core/fetch/ImageResource.h"
32 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
33 #include "core/html/HTMLCanvasElement.h" 33 #include "core/html/HTMLCanvasElement.h"
34 #include "core/html/HTMLIFrameElement.h" 34 #include "core/html/HTMLIFrameElement.h"
35 #include "core/html/HTMLMediaElement.h" 35 #include "core/html/HTMLMediaElement.h"
36 #include "core/html/HTMLVideoElement.h" 36 #include "core/html/HTMLVideoElement.h"
37 #include "core/html/canvas/CanvasRenderingContext.h" 37 #include "core/html/canvas/CanvasRenderingContext.h"
38 #include "core/inspector/InspectorInstrumentation.h" 38 #include "core/inspector/InspectorInstrumentation.h"
39 #include "core/inspector/InspectorNodeIds.h" 39 #include "core/inspector/InspectorNodeIds.h"
40 #include "core/layout/compositing/RenderLayerCompositor.h" 40 #include "core/layout/LayerStackingNodeIterator.h"
41 #include "core/layout/compositing/LayerCompositor.h"
41 #include "core/page/Chrome.h" 42 #include "core/page/Chrome.h"
42 #include "core/page/ChromeClient.h" 43 #include "core/page/ChromeClient.h"
43 #include "core/page/Page.h" 44 #include "core/page/Page.h"
44 #include "core/page/scrolling/ScrollingCoordinator.h" 45 #include "core/page/scrolling/ScrollingCoordinator.h"
45 #include "core/paint/LayerPainter.h" 46 #include "core/paint/LayerPainter.h"
46 #include "core/paint/ScrollableAreaPainter.h" 47 #include "core/paint/ScrollableAreaPainter.h"
47 #include "core/paint/TransformRecorder.h" 48 #include "core/paint/TransformRecorder.h"
48 #include "core/plugins/PluginView.h" 49 #include "core/plugins/PluginView.h"
49 #include "core/rendering/FilterEffectRenderer.h" 50 #include "core/rendering/FilterEffectRenderer.h"
50 #include "core/rendering/RenderEmbeddedObject.h" 51 #include "core/rendering/RenderEmbeddedObject.h"
51 #include "core/rendering/RenderImage.h" 52 #include "core/rendering/RenderImage.h"
52 #include "core/rendering/RenderLayerStackingNodeIterator.h"
53 #include "core/rendering/RenderPart.h" 53 #include "core/rendering/RenderPart.h"
54 #include "core/rendering/RenderVideo.h" 54 #include "core/rendering/RenderVideo.h"
55 #include "core/rendering/RenderView.h" 55 #include "core/rendering/RenderView.h"
56 #include "core/rendering/style/KeyframeList.h" 56 #include "core/rendering/style/KeyframeList.h"
57 #include "platform/LengthFunctions.h" 57 #include "platform/LengthFunctions.h"
58 #include "platform/RuntimeEnabledFeatures.h" 58 #include "platform/RuntimeEnabledFeatures.h"
59 #include "platform/fonts/FontCache.h" 59 #include "platform/fonts/FontCache.h"
60 #include "platform/geometry/TransformState.h" 60 #include "platform/geometry/TransformState.h"
61 #include "platform/graphics/GraphicsContext.h" 61 #include "platform/graphics/GraphicsContext.h"
62 #include "platform/graphics/paint/ClipDisplayItem.h" 62 #include "platform/graphics/paint/ClipDisplayItem.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 static inline bool isAcceleratedContents(RenderObject* renderer) 150 static inline bool isAcceleratedContents(RenderObject* renderer)
151 { 151 {
152 return isAcceleratedCanvas(renderer) 152 return isAcceleratedCanvas(renderer)
153 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->re quiresAcceleratedCompositing()) 153 || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->re quiresAcceleratedCompositing())
154 || renderer->isVideo(); 154 || renderer->isVideo();
155 } 155 }
156 156
157 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi ng's destructor. 157 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi ng's destructor.
158 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer& layer) 158 static ScrollingCoordinator* scrollingCoordinatorFromLayer(Layer& layer)
159 { 159 {
160 Page* page = layer.renderer()->frame()->page(); 160 Page* page = layer.renderer()->frame()->page();
161 if (!page) 161 if (!page)
162 return 0; 162 return 0;
163 163
164 return page->scrollingCoordinator(); 164 return page->scrollingCoordinator();
165 } 165 }
166 166
167 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) 167 CompositedLayerMapping::CompositedLayerMapping(Layer& layer)
168 : m_owningLayer(layer) 168 : m_owningLayer(layer)
169 , m_contentOffsetInCompositingLayerDirty(false) 169 , m_contentOffsetInCompositingLayerDirty(false)
170 , m_pendingUpdateScope(GraphicsLayerUpdateNone) 170 , m_pendingUpdateScope(GraphicsLayerUpdateNone)
171 , m_isMainFrameRenderViewLayer(false) 171 , m_isMainFrameRenderViewLayer(false)
172 , m_backgroundLayerPaintsFixedRootBackground(false) 172 , m_backgroundLayerPaintsFixedRootBackground(false)
173 , m_scrollingContentsAreEmpty(false) 173 , m_scrollingContentsAreEmpty(false)
174 { 174 {
175 if (layer.isRootLayer() && renderer()->frame()->isMainFrame()) 175 if (layer.isRootLayer() && renderer()->frame()->isMainFrame())
176 m_isMainFrameRenderViewLayer = true; 176 m_isMainFrameRenderViewLayer = true;
177 177
178 createPrimaryGraphicsLayer(); 178 createPrimaryGraphicsLayer();
179 } 179 }
180 180
181 CompositedLayerMapping::~CompositedLayerMapping() 181 CompositedLayerMapping::~CompositedLayerMapping()
182 { 182 {
183 // Hits in compositing/squashing/squash-onto-nephew.html. 183 // Hits in compositing/squashing/squash-onto-nephew.html.
184 DisableCompositingQueryAsserts disabler; 184 DisableCompositingQueryAsserts disabler;
185 185
186 // Do not leave the destroyed pointer dangling on any RenderLayers that pain ted to this mapping's squashing layer. 186 // Do not leave the destroyed pointer dangling on any Layers that painted to this mapping's squashing layer.
187 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 187 for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
188 RenderLayer* oldSquashedLayer = m_squashedLayers[i].renderLayer; 188 Layer* oldSquashedLayer = m_squashedLayers[i].renderLayer;
189 if (oldSquashedLayer->groupedMapping() == this) { 189 if (oldSquashedLayer->groupedMapping() == this) {
190 oldSquashedLayer->setGroupedMapping(0, true); 190 oldSquashedLayer->setGroupedMapping(0, true);
191 oldSquashedLayer->setLostGroupedMapping(true); 191 oldSquashedLayer->setLostGroupedMapping(true);
192 } 192 }
193 } 193 }
194 194
195 updateClippingLayers(false, false); 195 updateClippingLayers(false, false);
196 updateOverflowControlsLayers(false, false, false, false); 196 updateOverflowControlsLayers(false, false, false, false);
197 updateChildTransformLayer(false); 197 updateChildTransformLayer(false);
198 updateForegroundLayer(false); 198 updateForegroundLayer(false);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds())); 326 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds()));
327 } else { 327 } else {
328 // For non-root layers, background is always painted by the primary grap hics layer. 328 // For non-root layers, background is always painted by the primary grap hics layer.
329 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp aqueInRect(compositedBounds())); 329 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp aqueInRect(compositedBounds()));
330 } 330 }
331 } 331 }
332 332
333 void CompositedLayerMapping::updateCompositedBounds() 333 void CompositedLayerMapping::updateCompositedBounds()
334 { 334 {
335 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); 335 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate);
336 // FIXME: if this is really needed for performance, it would be better to st ore it on RenderLayer. 336 // FIXME: if this is really needed for performance, it would be better to st ore it on Layer.
337 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); 337 m_compositedBounds = m_owningLayer.boundingBoxForCompositing();
338 m_contentOffsetInCompositingLayerDirty = true; 338 m_contentOffsetInCompositingLayerDirty = true;
339 } 339 }
340 340
341 void CompositedLayerMapping::updateAfterPartResize() 341 void CompositedLayerMapping::updateAfterPartResize()
342 { 342 {
343 if (renderer()->isRenderPart()) { 343 if (renderer()->isRenderPart()) {
344 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram eContentsCompositor(toRenderPart(renderer()))) { 344 if (LayerCompositor* innerCompositor = LayerCompositor::frameContentsCom positor(toRenderPart(renderer()))) {
345 innerCompositor->frameViewDidChangeSize(); 345 innerCompositor->frameViewDidChangeSize();
346 // We can floor this point because our frameviews are always aligned to pixel boundaries. 346 // We can floor this point because our frameviews are always aligned to pixel boundaries.
347 ASSERT(m_compositedBounds.location() == flooredIntPoint(m_composited Bounds.location())); 347 ASSERT(m_compositedBounds.location() == flooredIntPoint(m_composited Bounds.location()));
348 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents Box().location())); 348 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents Box().location()));
349 } 349 }
350 } 350 }
351 } 351 }
352 352
353 void CompositedLayerMapping::updateCompositingReasons() 353 void CompositedLayerMapping::updateCompositingReasons()
354 { 354 {
355 // All other layers owned by this mapping will have the same compositing rea son 355 // All other layers owned by this mapping will have the same compositing rea son
356 // for their lifetime, so they are initialized only when created. 356 // for their lifetime, so they are initialized only when created.
357 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons()); 357 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons());
358 } 358 }
359 359
360 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor () 360 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor ()
361 { 361 {
362 if (!m_owningLayer.parent()) 362 if (!m_owningLayer.parent())
363 return false; 363 return false;
364 364
365 const RenderLayer* compositingAncestor = m_owningLayer.enclosingLayerWithCom positedLayerMapping(ExcludeSelf); 365 const Layer* compositingAncestor = m_owningLayer.enclosingLayerWithComposite dLayerMapping(ExcludeSelf);
366 if (!compositingAncestor) 366 if (!compositingAncestor)
367 return false; 367 return false;
368 368
369 const RenderObject* clippingContainer = m_owningLayer.clippingContainer(); 369 const RenderObject* clippingContainer = m_owningLayer.clippingContainer();
370 if (!clippingContainer) 370 if (!clippingContainer)
371 return false; 371 return false;
372 372
373 if (compositingAncestor->renderer()->isDescendantOf(clippingContainer)) 373 if (compositingAncestor->renderer()->isDescendantOf(clippingContainer))
374 return false; 374 return false;
375 375
376 // We ignore overflow clip here; we want composited overflow content to 376 // We ignore overflow clip here; we want composited overflow content to
377 // behave as if it lives in an unclipped universe so it can prepaint, etc. 377 // behave as if it lives in an unclipped universe so it can prepaint, etc.
378 // This means that we need to check if we are actually clipped before 378 // This means that we need to check if we are actually clipped before
379 // setting up m_ancestorClippingLayer otherwise 379 // setting up m_ancestorClippingLayer otherwise
380 // updateAncestorClippingLayerGeometry will fail as the clip rect will be 380 // updateAncestorClippingLayerGeometry will fail as the clip rect will be
381 // infinite. 381 // infinite.
382 // FIXME: this should use cached clip rects, but this sometimes give 382 // FIXME: this should use cached clip rects, but this sometimes give
383 // inaccurate results (and trips the ASSERTS in RenderLayerClipper). 383 // inaccurate results (and trips the ASSERTS in LayerClipper).
384 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, Ig noreOverlayScrollbarSize); 384 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, Ig noreOverlayScrollbarSize);
385 clipRectsContext.setIgnoreOverflowClip(); 385 clipRectsContext.setIgnoreOverflowClip();
386 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgro undClipRect(clipRectsContext).rect()); 386 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgro undClipRect(clipRectsContext).rect());
387 return parentClipRect != LayoutRect::infiniteIntRect(); 387 return parentClipRect != LayoutRect::infiniteIntRect();
388 } 388 }
389 389
390 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() 390 bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
391 { 391 {
392 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); 392 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate);
393 393
394 // Note carefully: here we assume that the compositing state of all descenda nts have been updated already, 394 // Note carefully: here we assume that the compositing state of all descenda nts have been updated already,
395 // so it is legitimate to compute and cache the composited bounds for this l ayer. 395 // so it is legitimate to compute and cache the composited bounds for this l ayer.
396 updateCompositedBounds(); 396 updateCompositedBounds();
397 397
398 if (RenderLayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { 398 if (LayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) {
399 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) 399 if (reflection->reflectionLayer()->hasCompositedLayerMapping())
400 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo sitedBounds(); 400 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo sitedBounds();
401 } 401 }
402 402
403 RenderLayerCompositor* compositor = this->compositor(); 403 LayerCompositor* compositor = this->compositor();
404 RenderObject* renderer = this->renderer(); 404 RenderObject* renderer = this->renderer();
405 405
406 bool layerConfigChanged = false; 406 bool layerConfigChanged = false;
407 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(&m_owningLayer)); 407 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(&m_owningLayer));
408 408
409 // The background layer is currently only used for fixed root backgrounds. 409 // The background layer is currently only used for fixed root backgrounds.
410 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) 410 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
411 layerConfigChanged = true; 411 layerConfigChanged = true;
412 412
413 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin gLayer))) 413 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin gLayer)))
414 layerConfigChanged = true; 414 layerConfigChanged = true;
415 415
416 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants (&m_owningLayer); 416 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants (&m_owningLayer);
417 417
418 // Our scrolling layer will clip. 418 // Our scrolling layer will clip.
419 if (m_owningLayer.needsCompositedScrolling()) 419 if (m_owningLayer.needsCompositedScrolling())
420 needsDescendantsClippingLayer = false; 420 needsDescendantsClippingLayer = false;
421 421
422 RenderLayer* scrollParent = compositor->preferCompositingToLCDTextEnabled() ? m_owningLayer.scrollParent() : 0; 422 Layer* scrollParent = compositor->preferCompositingToLCDTextEnabled() ? m_ow ningLayer.scrollParent() : 0;
423 423
424 // This is required because compositing layers are parented 424 // This is required because compositing layers are parented
425 // according to the z-order hierarchy, yet clipping goes down the renderer h ierarchy. 425 // according to the z-order hierarchy, yet clipping goes down the renderer h ierarchy.
426 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor i n the renderer hierarchy, 426 // Thus, a Layer can be clipped by a Layer that is an ancestor in the render er hierarchy,
427 // but a sibling in the z-order hierarchy. Further, that sibling need not be composited at all. 427 // but a sibling in the z-order hierarchy. Further, that sibling need not be composited at all.
428 // In such scenarios, an ancestor clipping layer is necessary to apply the c omposited clip for this layer. 428 // In such scenarios, an ancestor clipping layer is necessary to apply the c omposited clip for this layer.
429 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor (); 429 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor ();
430 430
431 if (scrollParent) { 431 if (scrollParent) {
432 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped 432 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped
433 // to it via our scroll parent and we don't need an ancestor clipping la yer. 433 // to it via our scroll parent and we don't need an ancestor clipping la yer.
434 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o wningLayer.ancestorScrollingLayer()) 434 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o wningLayer.ancestorScrollingLayer())
435 needsAncestorClip = false; 435 needsAncestorClip = false;
436 } 436 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } else if (renderer->isVideo()) { 524 } else if (renderer->isVideo()) {
525 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node()); 525 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node());
526 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer( )); 526 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer( ));
527 } else if (isAcceleratedCanvas(renderer)) { 527 } else if (isAcceleratedCanvas(renderer)) {
528 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); 528 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
529 if (CanvasRenderingContext* context = canvas->renderingContext()) 529 if (CanvasRenderingContext* context = canvas->renderingContext())
530 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer() ); 530 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer() );
531 layerConfigChanged = true; 531 layerConfigChanged = true;
532 } 532 }
533 if (renderer->isRenderPart()) 533 if (renderer->isRenderPart())
534 layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toR enderPart(renderer)); 534 layerConfigChanged = LayerCompositor::parentFrameContentLayers(toRenderP art(renderer));
535 535
536 // Changes to either the internal hierarchy or the mask layer have an impact 536 // Changes to either the internal hierarchy or the mask layer have an impact
537 // on painting phases, so we need to update when either are updated. 537 // on painting phases, so we need to update when either are updated.
538 if (layerConfigChanged || maskLayerChanged) 538 if (layerConfigChanged || maskLayerChanged)
539 updatePaintingPhases(); 539 updatePaintingPhases();
540 540
541 return layerConfigChanged; 541 return layerConfigChanged;
542 } 542 }
543 543
544 static IntRect clipBox(RenderBox* renderer) 544 static IntRect clipBox(RenderBox* renderer)
545 { 545 {
546 LayoutRect result = LayoutRect::infiniteIntRect(); 546 LayoutRect result = LayoutRect::infiniteIntRect();
547 if (renderer->hasOverflowClip()) 547 if (renderer->hasOverflowClip())
548 result = renderer->overflowClipRect(LayoutPoint()); 548 result = renderer->overflowClipRect(LayoutPoint());
549 549
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 static LayoutPoint computeOffsetFromCompositedAncestor(const RenderLayer* layer, const RenderLayer* compositedAncestor) 556 static LayoutPoint computeOffsetFromCompositedAncestor(const Layer* layer, const Layer* compositedAncestor)
557 { 557 {
558 LayoutPoint offset = layer->visualOffsetFromAncestor(compositedAncestor); 558 LayoutPoint offset = layer->visualOffsetFromAncestor(compositedAncestor);
559 if (compositedAncestor) 559 if (compositedAncestor)
560 offset.move(compositedAncestor->compositedLayerMapping()->owningLayer(). subpixelAccumulation()); 560 offset.move(compositedAncestor->compositedLayerMapping()->owningLayer(). subpixelAccumulation());
561 return offset; 561 return offset;
562 } 562 }
563 563
564 void CompositedLayerMapping::computeBoundsOfOwningLayer(const RenderLayer* compo sitedAncestor, IntRect& localBounds, IntRect& compositingBoundsRelativeToComposi tedAncestor, LayoutPoint& offsetFromCompositedAncestor, 564 void CompositedLayerMapping::computeBoundsOfOwningLayer(const Layer* compositedA ncestor, IntRect& localBounds, IntRect& compositingBoundsRelativeToCompositedAnc estor, LayoutPoint& offsetFromCompositedAncestor,
565 IntPoint& snappedOffsetFromCompositedAncestor) 565 IntPoint& snappedOffsetFromCompositedAncestor)
566 { 566 {
567 LayoutRect localRawCompositingBounds = compositedBounds(); 567 LayoutRect localRawCompositingBounds = compositedBounds();
568 offsetFromCompositedAncestor = computeOffsetFromCompositedAncestor(&m_owning Layer, compositedAncestor); 568 offsetFromCompositedAncestor = computeOffsetFromCompositedAncestor(&m_owning Layer, compositedAncestor);
569 snappedOffsetFromCompositedAncestor = IntPoint(offsetFromCompositedAncestor. x().round(), offsetFromCompositedAncestor.y().round()); 569 snappedOffsetFromCompositedAncestor = IntPoint(offsetFromCompositedAncestor. x().round(), offsetFromCompositedAncestor.y().round());
570 570
571 LayoutSize subpixelAccumulation = offsetFromCompositedAncestor - snappedOffs etFromCompositedAncestor; 571 LayoutSize subpixelAccumulation = offsetFromCompositedAncestor - snappedOffs etFromCompositedAncestor;
572 m_owningLayer.setSubpixelAccumulation(subpixelAccumulation); 572 m_owningLayer.setSubpixelAccumulation(subpixelAccumulation);
573 573
574 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat ive to absolute pixels instead of local coordinates. 574 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat ive to absolute pixels instead of local coordinates.
575 localRawCompositingBounds.move(subpixelAccumulation); 575 localRawCompositingBounds.move(subpixelAccumulation);
576 localBounds = pixelSnappedIntRect(localRawCompositingBounds); 576 localBounds = pixelSnappedIntRect(localRawCompositingBounds);
577 577
578 compositingBoundsRelativeToCompositedAncestor = localBounds; 578 compositingBoundsRelativeToCompositedAncestor = localBounds;
579 compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompos itedAncestor); 579 compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompos itedAncestor);
580 } 580 }
581 581
582 void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off setFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const Re nderLayer& referenceLayer, 582 void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off setFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const La yer& referenceLayer,
583 Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, Layou tPoint* offsetFromTransformedAncestor, Vector<RenderLayer*>& layersNeedingPaintI nvalidation) 583 Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, Layou tPoint* offsetFromTransformedAncestor, Vector<Layer*>& layersNeedingPaintInvalid ation)
584 { 584 {
585 if (!squashingLayer) 585 if (!squashingLayer)
586 return; 586 return;
587 587
588 LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromComposit edAncestor); 588 LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromComposit edAncestor);
589 offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLoc ation); 589 offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLoc ation);
590 590
591 // FIXME: Cache these offsets. 591 // FIXME: Cache these offsets.
592 LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeO ffsetFromTransformedAncestor(); 592 LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeO ffsetFromTransformedAncestor();
593 593
594 LayoutRect totalSquashBounds; 594 LayoutRect totalSquashBounds;
595 for (size_t i = 0; i < layers.size(); ++i) { 595 for (size_t i = 0; i < layers.size(); ++i) {
596 LayoutRect squashedBounds = layers[i].renderLayer->boundingBoxForComposi ting(); 596 LayoutRect squashedBounds = layers[i].renderLayer->boundingBoxForComposi ting();
597 597
598 // Store the local bounds of the RenderLayer subtree before applying the offset. 598 // Store the local bounds of the Layer subtree before applying the offse t.
599 layers[i].compositedBounds = squashedBounds; 599 layers[i].compositedBounds = squashedBounds;
600 600
601 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re nderLayer->computeOffsetFromTransformedAncestor(); 601 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re nderLayer->computeOffsetFromTransformedAncestor();
602 LayoutSize offsetFromSquashingLayer = offsetFromTransformedAncestorForSq uashedLayer - referenceOffsetFromTransformedAncestor; 602 LayoutSize offsetFromSquashingLayer = offsetFromTransformedAncestorForSq uashedLayer - referenceOffsetFromTransformedAncestor;
603 603
604 squashedBounds.move(offsetFromSquashingLayer); 604 squashedBounds.move(offsetFromSquashingLayer);
605 totalSquashBounds.unite(squashedBounds); 605 totalSquashBounds.unite(squashedBounds);
606 } 606 }
607 607
608 // The totalSquashBounds is positioned with respect to referenceLayer of thi s CompositedLayerMapping. 608 // The totalSquashBounds is positioned with respect to referenceLayer of thi s CompositedLayerMapping.
609 // But the squashingLayer needs to be positioned with respect to the ancesto r CompositedLayerMapping. 609 // But the squashingLayer needs to be positioned with respect to the ancesto r CompositedLayerMapping.
610 // The conversion between referenceLayer and the ancestor CLM is already com puted as 610 // The conversion between referenceLayer and the ancestor CLM is already com puted as
611 // offsetFromReferenceLayerToParentGraphicsLayer. 611 // offsetFromReferenceLayerToParentGraphicsLayer.
612 totalSquashBounds.moveBy(offsetFromReferenceLayerToParentGraphicsLayer); 612 totalSquashBounds.moveBy(offsetFromReferenceLayerToParentGraphicsLayer);
613 const IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds); 613 const IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds);
614 const IntPoint squashLayerOrigin = squashLayerBounds.location(); 614 const IntPoint squashLayerOrigin = squashLayerBounds.location();
615 const LayoutSize squashLayerOriginInOwningLayerSpace = squashLayerOrigin - o ffsetFromReferenceLayerToParentGraphicsLayer; 615 const LayoutSize squashLayerOriginInOwningLayerSpace = squashLayerOrigin - o ffsetFromReferenceLayerToParentGraphicsLayer;
616 616
617 // Now that the squashing bounds are known, we can convert the RenderLayer p ainting offsets 617 // Now that the squashing bounds are known, we can convert the Layer paintin g offsets
618 // from CLM owning layer space to the squashing layer space. 618 // from CLM owning layer space to the squashing layer space.
619 // 619 //
620 // The painting offset we want to compute for each squashed RenderLayer is e ssentially the position of 620 // The painting offset we want to compute for each squashed Layer is essenti ally the position of
621 // the squashed RenderLayer described w.r.t. referenceLayer's origin. 621 // the squashed Layer described w.r.t. referenceLayer's origin.
622 // So we just need to convert that point from referenceLayer space to the sq uashing layer's 622 // So we just need to convert that point from referenceLayer space to the sq uashing layer's
623 // space. This is simply done by subtracing squashLayerOriginInOwningLayerSp ace, but then the offset 623 // space. This is simply done by subtracing squashLayerOriginInOwningLayerSp ace, but then the offset
624 // overall needs to be negated because that's the direction that the paintin g code expects the 624 // overall needs to be negated because that's the direction that the paintin g code expects the
625 // offset to be. 625 // offset to be.
626 for (size_t i = 0; i < layers.size(); ++i) { 626 for (size_t i = 0; i < layers.size(); ++i) {
627 const LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers [i].renderLayer->computeOffsetFromTransformedAncestor(); 627 const LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers [i].renderLayer->computeOffsetFromTransformedAncestor();
628 const LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAnc estorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOri ginInOwningLayerSpace; 628 const LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAnc estorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOri ginInOwningLayerSpace;
629 629
630 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid th().round(), offsetFromSquashLayerOrigin.height().round()); 630 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid th().round(), offsetFromSquashLayerOrigin.height().round());
631 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse tFromRenderer; 631 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse tFromRenderer;
(...skipping 13 matching lines...) Expand all
645 squashingLayer->setPosition(squashLayerBounds.location()); 645 squashingLayer->setPosition(squashLayerBounds.location());
646 squashingLayer->setSize(squashLayerBounds.size()); 646 squashingLayer->setSize(squashLayerBounds.size());
647 647
648 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; 648 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor;
649 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); 649 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace);
650 650
651 for (size_t i = 0; i < layers.size(); ++i) 651 for (size_t i = 0; i < layers.size(); ++i)
652 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer( referenceLayer, layers[i], layers); 652 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer( referenceLayer, layers[i], layers);
653 } 653 }
654 654
655 void CompositedLayerMapping::updateGraphicsLayerGeometry(const RenderLayer* comp ositingContainer, const RenderLayer* compositingStackingContext, Vector<RenderLa yer*>& layersNeedingPaintInvalidation) 655 void CompositedLayerMapping::updateGraphicsLayerGeometry(const Layer* compositin gContainer, const Layer* compositingStackingContext, Vector<Layer*>& layersNeedi ngPaintInvalidation)
656 { 656 {
657 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); 657 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate);
658 658
659 // Set transform property, if it is not animating. We have to do this here b ecause the transform 659 // Set transform property, if it is not animating. We have to do this here b ecause the transform
660 // is affected by the layer dimensions. 660 // is affected by the layer dimensions.
661 if (!renderer()->style()->isRunningTransformAnimationOnCompositor()) 661 if (!renderer()->style()->isRunningTransformAnimationOnCompositor())
662 updateTransform(renderer()->style()); 662 updateTransform(renderer()->style());
663 663
664 // Set opacity, if it is not animating. 664 // Set opacity, if it is not animating.
665 if (!renderer()->style()->isRunningOpacityAnimationOnCompositor()) 665 if (!renderer()->style()->isRunningOpacityAnimationOnCompositor())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 void CompositedLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& rela tiveCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& gr aphicsLayerParentLocation) 737 void CompositedLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& rela tiveCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& gr aphicsLayerParentLocation)
738 { 738 {
739 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation)); 739 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
740 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion())); 740 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion()));
741 741
742 FloatSize oldSize = m_graphicsLayer->size(); 742 FloatSize oldSize = m_graphicsLayer->size();
743 const IntSize& contentsSize = relativeCompositingBounds.size(); 743 const IntSize& contentsSize = relativeCompositingBounds.size();
744 if (oldSize != contentsSize) 744 if (oldSize != contentsSize)
745 m_graphicsLayer->setSize(contentsSize); 745 m_graphicsLayer->setSize(contentsSize);
746 746
747 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing 747 // m_graphicsLayer is the corresponding GraphicsLayer for this Layer and its non-compositing
748 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any 748 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any
749 // non-compositing visible layers. 749 // non-compositing visible layers.
750 bool contentsVisible = m_owningLayer.hasVisibleContent() || hasVisibleNonCom positingDescendant(&m_owningLayer); 750 bool contentsVisible = m_owningLayer.hasVisibleContent() || hasVisibleNonCom positingDescendant(&m_owningLayer);
751 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { 751 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) {
752 HTMLVideoElement* videoElement = toHTMLVideoElement(renderer()->node()); 752 HTMLVideoElement* videoElement = toHTMLVideoElement(renderer()->node());
753 if (videoElement->isFullscreen() && !HTMLMediaElement::isMediaStreamURL( videoElement->sourceURL().string())) 753 if (videoElement->isFullscreen() && !HTMLMediaElement::isMediaStreamURL( videoElement->sourceURL().string()))
754 contentsVisible = false; 754 contentsVisible = false;
755 } 755 }
756 m_graphicsLayer->setContentsVisible(contentsVisible); 756 m_graphicsLayer->setContentsVisible(contentsVisible);
757 757
758 m_graphicsLayer->setBackfaceVisibility(renderer()->style()->backfaceVisibili ty() == BackfaceVisibilityVisible); 758 m_graphicsLayer->setBackfaceVisibility(renderer()->style()->backfaceVisibili ty() == BackfaceVisibilityVisible);
759 } 759 }
760 760
761 void CompositedLayerMapping::computeGraphicsLayerParentLocation(const RenderLaye r* compositingContainer, const IntRect& ancestorCompositingBounds, IntPoint& gra phicsLayerParentLocation) 761 void CompositedLayerMapping::computeGraphicsLayerParentLocation(const Layer* com positingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsL ayerParentLocation)
762 { 762 {
763 if (compositingContainer && compositingContainer->compositedLayerMapping()-> hasClippingLayer()) { 763 if (compositingContainer && compositingContainer->compositedLayerMapping()-> hasClippingLayer()) {
764 // If the compositing ancestor has a layer to clip children, we parent i n that, and therefore 764 // If the compositing ancestor has a layer to clip children, we parent i n that, and therefore
765 // position relative to it. 765 // position relative to it.
766 IntRect clippingBox = clipBox(toRenderBox(compositingContainer->renderer ())); 766 IntRect clippingBox = clipBox(toRenderBox(compositingContainer->renderer ()));
767 graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(co mpositingContainer->subpixelAccumulation()); 767 graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(co mpositingContainer->subpixelAccumulation());
768 } else if (compositingContainer && compositingContainer->compositedLayerMapp ing()->childTransformLayer()) { 768 } else if (compositingContainer && compositingContainer->compositedLayerMapp ing()->childTransformLayer()) {
769 // Similarly, if the compositing ancestor has a child transform layer, w e parent in that, and therefore 769 // Similarly, if the compositing ancestor has a child transform layer, w e parent in that, and therefore
770 // position relative to it. It's already taken into account the contents offset, so we do not need to here. 770 // position relative to it. It's already taken into account the contents offset, so we do not need to here.
771 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp ixelAccumulation()); 771 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp ixelAccumulation());
772 } else if (compositingContainer) { 772 } else if (compositingContainer) {
773 graphicsLayerParentLocation = ancestorCompositingBounds.location(); 773 graphicsLayerParentLocation = ancestorCompositingBounds.location();
774 } else { 774 } else {
775 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio n(); 775 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio n();
776 } 776 }
777 777
778 if (compositingContainer && compositingContainer->needsCompositedScrolling() ) { 778 if (compositingContainer && compositingContainer->needsCompositedScrolling() ) {
779 RenderBox* renderBox = toRenderBox(compositingContainer->renderer()); 779 RenderBox* renderBox = toRenderBox(compositingContainer->renderer());
780 IntSize scrollOffset = renderBox->scrolledContentOffset(); 780 IntSize scrollOffset = renderBox->scrolledContentOffset();
781 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); 781 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop());
782 graphicsLayerParentLocation = scrollOrigin - scrollOffset; 782 graphicsLayerParentLocation = scrollOrigin - scrollOffset;
783 } 783 }
784 } 784 }
785 785
786 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const RenderLay er* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, I ntPoint& graphicsLayerParentLocation) 786 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const Layer* co mpositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoin t& graphicsLayerParentLocation)
787 { 787 {
788 if (!compositingContainer || !m_ancestorClippingLayer) 788 if (!compositingContainer || !m_ancestorClippingLayer)
789 return; 789 return;
790 790
791 ClipRectsContext clipRectsContext(compositingContainer, PaintingClipRectsIgn oringOverflowClip, IgnoreOverlayScrollbarSize); 791 ClipRectsContext clipRectsContext(compositingContainer, PaintingClipRectsIgn oringOverflowClip, IgnoreOverlayScrollbarSize);
792 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgro undClipRect(clipRectsContext).rect()); 792 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgro undClipRect(clipRectsContext).rect());
793 ASSERT(parentClipRect != LayoutRect::infiniteIntRect()); 793 ASSERT(parentClipRect != LayoutRect::infiniteIntRect());
794 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation)); 794 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
795 m_ancestorClippingLayer->setSize(parentClipRect.size()); 795 m_ancestorClippingLayer->setSize(parentClipRect.size());
796 796
797 // backgroundRect is relative to compositingContainer, so subtract snappedOf fsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y to get back t o local coords. 797 // backgroundRect is relative to compositingContainer, so subtract snappedOf fsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y to get back t o local coords.
798 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - s nappedOffsetFromCompositedAncestor); 798 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - s nappedOffsetFromCompositedAncestor);
799 799
800 // The primary layer is then parented in, and positioned relative to this cl ipping layer. 800 // The primary layer is then parented in, and positioned relative to this cl ipping layer.
801 graphicsLayerParentLocation = parentClipRect.location(); 801 graphicsLayerParentLocation = parentClipRect.location();
802 } 802 }
803 803
804 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(const Rende rLayer* compositingStackingContext) 804 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(const Layer * compositingStackingContext)
805 { 805 {
806 if (!m_overflowControlsHostLayer) 806 if (!m_overflowControlsHostLayer)
807 return; 807 return;
808 808
809 if (needsToReparentOverflowControls()) { 809 if (needsToReparentOverflowControls()) {
810 if (m_overflowControlsClippingLayer) { 810 if (m_overflowControlsClippingLayer) {
811 m_overflowControlsClippingLayer->setPosition(m_ancestorClippingLayer ->position()); 811 m_overflowControlsClippingLayer->setPosition(m_ancestorClippingLayer ->position());
812 m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->si ze()); 812 m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->si ze());
813 m_overflowControlsClippingLayer->setOffsetFromRenderer(m_ancestorCli ppingLayer->offsetFromRenderer()); 813 m_overflowControlsClippingLayer->setOffsetFromRenderer(m_ancestorCli ppingLayer->offsetFromRenderer());
814 m_overflowControlsClippingLayer->setMasksToBounds(true); 814 m_overflowControlsClippingLayer->setMasksToBounds(true);
815 815
816 m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControl sClippingLayer->offsetFromRenderer())); 816 m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControl sClippingLayer->offsetFromRenderer()));
817 } else { 817 } else {
818 // The controls are in the same 2D space as the compositing containe r, so we can map them into the space of the container. 818 // The controls are in the same 2D space as the compositing containe r, so we can map them into the space of the container.
819 TransformState transformState(TransformState::ApplyTransformDirectio n, FloatPoint()); 819 TransformState transformState(TransformState::ApplyTransformDirectio n, FloatPoint());
820 m_owningLayer.renderer()->mapLocalToContainer(compositingStackingCon text->renderer(), transformState, ApplyContainerFlip); 820 m_owningLayer.renderer()->mapLocalToContainer(compositingStackingCon text->renderer(), transformState, ApplyContainerFlip);
821 transformState.flatten(); 821 transformState.flatten();
822 LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState .lastPlanarPoint()); 822 LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState .lastPlanarPoint());
823 if (RenderLayerScrollableArea* scrollableArea = compositingStackingC ontext->scrollableArea()) 823 if (LayerScrollableArea* scrollableArea = compositingStackingContext ->scrollableArea())
824 offsetFromStackingContainer.move(LayoutSize(scrollableArea->adju stedScrollOffset())); 824 offsetFromStackingContainer.move(LayoutSize(scrollableArea->adju stedScrollOffset()));
825 m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStacki ngContainer)); 825 m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStacki ngContainer));
826 } 826 }
827 } else { 827 } else {
828 m_overflowControlsHostLayer->setPosition(FloatPoint()); 828 m_overflowControlsHostLayer->setPosition(FloatPoint());
829 } 829 }
830 } 830 }
831 831
832 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds) 832 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds)
833 { 833 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); 887 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
888 } else { 888 } else {
889 FloatPoint3D compositedTransformOrigin( 889 FloatPoint3D compositedTransformOrigin(
890 relativeCompositingBounds.width() * 0.5f, 890 relativeCompositingBounds.width() * 0.5f,
891 relativeCompositingBounds.height() * 0.5f, 891 relativeCompositingBounds.height() * 0.5f,
892 0.f); 892 0.f);
893 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); 893 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
894 } 894 }
895 } 895 }
896 896
897 void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<RenderLayer*>& layersNeedingPaintInvalidation) 897 void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<Layer*>& layer sNeedingPaintInvalidation)
898 { 898 {
899 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) 899 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping())
900 return; 900 return;
901 901
902 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref lectionInfo()->reflectionLayer()->compositedLayerMapping(); 902 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref lectionInfo()->reflectionLayer()->compositedLayerMapping();
903 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer , &m_owningLayer, layersNeedingPaintInvalidation); 903 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer , &m_owningLayer, layersNeedingPaintInvalidation);
904 } 904 }
905 905
906 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds) 906 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds)
907 { 907 {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 } 1110 }
1111 1111
1112 void CompositedLayerMapping::updateContentsRect() 1112 void CompositedLayerMapping::updateContentsRect()
1113 { 1113 {
1114 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); 1114 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
1115 } 1115 }
1116 1116
1117 void CompositedLayerMapping::updateContentsOffsetInCompositingLayer(const IntPoi nt& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLoca tion) 1117 void CompositedLayerMapping::updateContentsOffsetInCompositingLayer(const IntPoi nt& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLoca tion)
1118 { 1118 {
1119 // m_graphicsLayer is positioned relative to our compositing ancestor 1119 // m_graphicsLayer is positioned relative to our compositing ancestor
1120 // RenderLayer, but it's not positioned at the origin of m_owningLayer, it's 1120 // Layer, but it's not positioned at the origin of m_owningLayer, it's
1121 // offset by m_contentBounds.location(). This is what 1121 // offset by m_contentBounds.location(). This is what
1122 // contentOffsetInCompositingLayer is meant to capture, roughly speaking 1122 // contentOffsetInCompositingLayer is meant to capture, roughly speaking
1123 // (ignoring rounding and subpixel accumulation). 1123 // (ignoring rounding and subpixel accumulation).
1124 // 1124 //
1125 // Our ancestor graphics layers in this CLM (m_graphicsLayer and potentially 1125 // Our ancestor graphics layers in this CLM (m_graphicsLayer and potentially
1126 // m_ancestorClippingLayer) have pixel snapped, so if we don't adjust this 1126 // m_ancestorClippingLayer) have pixel snapped, so if we don't adjust this
1127 // offset, we'll see accumulated rounding errors due to that snapping. 1127 // offset, we'll see accumulated rounding errors due to that snapping.
1128 // 1128 //
1129 // In order to ensure that we account for this rounding, we compute 1129 // In order to ensure that we account for this rounding, we compute
1130 // contentsOffsetInCompositingLayer in a somewhat roundabout way. 1130 // contentsOffsetInCompositingLayer in a somewhat roundabout way.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 int id = 0; 1432 int id = 0;
1433 1433
1434 // NB, it is illegal at this point to query an ancestor's compositing state. Some compositing 1434 // NB, it is illegal at this point to query an ancestor's compositing state. Some compositing
1435 // reasons depend on the compositing state of ancestors. So if we want a ren dering context id 1435 // reasons depend on the compositing state of ancestors. So if we want a ren dering context id
1436 // for the context root, we cannot ask for the id of its associated WebLayer now; it may not have 1436 // for the context root, we cannot ask for the id of its associated WebLayer now; it may not have
1437 // one yet. We could do a second past after doing the compositing updates to get these ids, 1437 // one yet. We could do a second past after doing the compositing updates to get these ids,
1438 // but this would actually be harmful. We do not want to attach any semantic meaning to 1438 // but this would actually be harmful. We do not want to attach any semantic meaning to
1439 // the context id other than the fact that they group a number of layers tog ether for the 1439 // the context id other than the fact that they group a number of layers tog ether for the
1440 // sake of 3d sorting. So instead we will ask the compositor to vend us an a rbitrary, but 1440 // sake of 3d sorting. So instead we will ask the compositor to vend us an a rbitrary, but
1441 // consistent id. 1441 // consistent id.
1442 if (RenderLayer* root = m_owningLayer.renderingContextRoot()) { 1442 if (Layer* root = m_owningLayer.renderingContextRoot()) {
1443 if (Node* node = root->renderer()->node()) 1443 if (Node* node = root->renderer()->node())
1444 id = static_cast<int>(WTF::PtrHash<Node*>::hash(node)); 1444 id = static_cast<int>(WTF::PtrHash<Node*>::hash(node));
1445 } 1445 }
1446 1446
1447 UpdateRenderingContextFunctor functor = { id }; 1447 UpdateRenderingContextFunctor functor = { id };
1448 ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashin gLayer; 1448 ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashin gLayer;
1449 ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode); 1449 ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode);
1450 } 1450 }
1451 1451
1452 struct UpdateShouldFlattenTransformFunctor { 1452 struct UpdateShouldFlattenTransformFunctor {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 m_scrollingContentsLayer = nullptr; 1594 m_scrollingContentsLayer = nullptr;
1595 m_scrollingBlockSelectionLayer = nullptr; 1595 m_scrollingBlockSelectionLayer = nullptr;
1596 layerChanged = true; 1596 layerChanged = true;
1597 if (scrollingCoordinator) 1597 if (scrollingCoordinator)
1598 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.scrollableArea()); 1598 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.scrollableArea());
1599 } 1599 }
1600 1600
1601 return layerChanged; 1601 return layerChanged;
1602 } 1602 }
1603 1603
1604 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, RenderLayer* scrollParent, ScrollingCoordinator* scrollingCoor dinator) 1604 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, Layer* scrollParent, ScrollingCoordinator* scrollingCoordinato r)
1605 { 1605 {
1606 if (!layer) 1606 if (!layer)
1607 return; 1607 return;
1608 1608
1609 // Only the topmost layer has a scroll parent. All other layers have a null scroll parent. 1609 // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
1610 if (layer != topmostLayer) 1610 if (layer != topmostLayer)
1611 scrollParent = 0; 1611 scrollParent = 0;
1612 1612
1613 scrollingCoordinator->updateScrollParentForGraphicsLayer(layer, scrollParent ); 1613 scrollingCoordinator->updateScrollParentForGraphicsLayer(layer, scrollParent );
1614 } 1614 }
1615 1615
1616 void CompositedLayerMapping::updateScrollParent(RenderLayer* scrollParent) 1616 void CompositedLayerMapping::updateScrollParent(Layer* scrollParent)
1617 { 1617 {
1618 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) { 1618 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1619 GraphicsLayer* topmostLayer = childForSuperlayers(); 1619 GraphicsLayer* topmostLayer = childForSuperlayers();
1620 updateScrollParentForGraphicsLayer(m_squashingContainmentLayer.get(), to pmostLayer, scrollParent, scrollingCoordinator); 1620 updateScrollParentForGraphicsLayer(m_squashingContainmentLayer.get(), to pmostLayer, scrollParent, scrollingCoordinator);
1621 updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmos tLayer, scrollParent, scrollingCoordinator); 1621 updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmos tLayer, scrollParent, scrollingCoordinator);
1622 updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, scrollParent, scrollingCoordinator); 1622 updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
1623 } 1623 }
1624 } 1624 }
1625 1625
1626 void CompositedLayerMapping::updateClipParent() 1626 void CompositedLayerMapping::updateClipParent()
1627 { 1627 {
1628 if (owningLayerClippedByLayerNotAboveCompositedAncestor()) 1628 if (owningLayerClippedByLayerNotAboveCompositedAncestor())
1629 return; 1629 return;
1630 1630
1631 RenderLayer* clipParent = m_owningLayer.clipParent(); 1631 Layer* clipParent = m_owningLayer.clipParent();
1632 if (clipParent) 1632 if (clipParent)
1633 clipParent = clipParent->enclosingLayerWithCompositedLayerMapping(Includ eSelf); 1633 clipParent = clipParent->enclosingLayerWithCompositedLayerMapping(Includ eSelf);
1634 1634
1635 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) 1635 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer))
1636 scrollingCoordinator->updateClipParentForGraphicsLayer(m_graphicsLayer.g et(), clipParent); 1636 scrollingCoordinator->updateClipParentForGraphicsLayer(m_graphicsLayer.g et(), clipParent);
1637 } 1637 }
1638 1638
1639 bool CompositedLayerMapping::updateSquashingLayers(bool needsSquashingLayers) 1639 bool CompositedLayerMapping::updateSquashingLayers(bool needsSquashingLayers)
1640 { 1640 {
1641 bool layersChanged = false; 1641 bool layersChanged = false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 phase |= GraphicsLayerPaintCompositedScroll; 1695 phase |= GraphicsLayerPaintCompositedScroll;
1696 } 1696 }
1697 1697
1698 return static_cast<GraphicsLayerPaintingPhase>(phase); 1698 return static_cast<GraphicsLayerPaintingPhase>(phase);
1699 } 1699 }
1700 1700
1701 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const 1701 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const
1702 { 1702 {
1703 float finalOpacity = rendererOpacity; 1703 float finalOpacity = rendererOpacity;
1704 1704
1705 for (RenderLayer* curr = m_owningLayer.parent(); curr; curr = curr->parent() ) { 1705 for (Layer* curr = m_owningLayer.parent(); curr; curr = curr->parent()) {
1706 // We only care about parents that are stacking contexts. 1706 // We only care about parents that are stacking contexts.
1707 // Recall that opacity creates stacking context. 1707 // Recall that opacity creates stacking context.
1708 if (!curr->stackingNode()->isStackingContext()) 1708 if (!curr->stackingNode()->isStackingContext())
1709 continue; 1709 continue;
1710 1710
1711 // If we found a composited layer, regardless of whether it actually 1711 // If we found a composited layer, regardless of whether it actually
1712 // paints into it, we want to compute opacity relative to it. So we can 1712 // paints into it, we want to compute opacity relative to it. So we can
1713 // break here. 1713 // break here.
1714 // 1714 //
1715 // FIXME: with grouped backings, a composited descendant will have to 1715 // FIXME: with grouped backings, a composited descendant will have to
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 return true; 1749 return true;
1750 1750
1751 return false; 1751 return false;
1752 } 1752 }
1753 1753
1754 static bool isCompositedPlugin(RenderObject* renderer) 1754 static bool isCompositedPlugin(RenderObject* renderer)
1755 { 1755 {
1756 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->req uiresAcceleratedCompositing(); 1756 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->req uiresAcceleratedCompositing();
1757 } 1757 }
1758 1758
1759 bool CompositedLayerMapping::hasVisibleNonCompositingDescendant(RenderLayer* par ent) 1759 bool CompositedLayerMapping::hasVisibleNonCompositingDescendant(Layer* parent)
1760 { 1760 {
1761 if (!parent->hasVisibleDescendant()) 1761 if (!parent->hasVisibleDescendant())
1762 return false; 1762 return false;
1763 1763
1764 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. 1764 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
1765 parent->stackingNode()->updateLayerListsIfNeeded(); 1765 parent->stackingNode()->updateLayerListsIfNeeded();
1766 1766
1767 #if ENABLE(ASSERT) 1767 #if ENABLE(ASSERT)
1768 LayerListMutationDetector mutationChecker(parent->stackingNode()); 1768 LayerListMutationDetector mutationChecker(parent->stackingNode());
1769 #endif 1769 #endif
1770 1770
1771 RenderLayerStackingNodeIterator normalFlowIterator(*parent->stackingNode(), AllChildren); 1771 LayerStackingNodeIterator normalFlowIterator(*parent->stackingNode(), AllChi ldren);
1772 while (RenderLayerStackingNode* curNode = normalFlowIterator.next()) { 1772 while (LayerStackingNode* curNode = normalFlowIterator.next()) {
1773 RenderLayer* curLayer = curNode->layer(); 1773 Layer* curLayer = curNode->layer();
1774 if (curLayer->hasCompositedLayerMapping()) 1774 if (curLayer->hasCompositedLayerMapping())
1775 continue; 1775 continue;
1776 if (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant( curLayer)) 1776 if (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant( curLayer))
1777 return true; 1777 return true;
1778 } 1778 }
1779 1779
1780 return false; 1780 return false;
1781 } 1781 }
1782 1782
1783 bool CompositedLayerMapping::containsPaintedContent() const 1783 bool CompositedLayerMapping::containsPaintedContent() const
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 return contentsBox; 1918 return contentsBox;
1919 } 1919 }
1920 1920
1921 bool CompositedLayerMapping::needsToReparentOverflowControls() const 1921 bool CompositedLayerMapping::needsToReparentOverflowControls() const
1922 { 1922 {
1923 return m_owningLayer.scrollableArea() 1923 return m_owningLayer.scrollableArea()
1924 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() 1924 && m_owningLayer.scrollableArea()->hasOverlayScrollbars()
1925 && m_owningLayer.scrollableArea()->topmostScrollChild(); 1925 && m_owningLayer.scrollableArea()->topmostScrollChild();
1926 } 1926 }
1927 1927
1928 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Rend erLayer& enclosingLayer) 1928 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Laye r& enclosingLayer)
1929 { 1929 {
1930 GraphicsLayer* host = m_overflowControlsClippingLayer.get(); 1930 GraphicsLayer* host = m_overflowControlsClippingLayer.get();
1931 if (!host) 1931 if (!host)
1932 host = m_overflowControlsHostLayer.get(); 1932 host = m_overflowControlsHostLayer.get();
1933 host->removeFromParent(); 1933 host->removeFromParent();
1934 return host; 1934 return host;
1935 } 1935 }
1936 1936
1937 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const 1937 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const
1938 { 1938 {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 return &layers[i]; 2039 return &layers[i];
2040 } 2040 }
2041 return 0; 2041 return 0;
2042 } 2042 }
2043 2043
2044 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst RenderObject* renderObject, unsigned maxSquashedLayerIndex) 2044 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst RenderObject* renderObject, unsigned maxSquashedLayerIndex)
2045 { 2045 {
2046 return CompositedLayerMapping::containingSquashedLayer(renderObject, m_squas hedLayers, maxSquashedLayerIndex); 2046 return CompositedLayerMapping::containingSquashedLayer(renderObject, m_squas hedLayers, maxSquashedLayerIndex);
2047 } 2047 }
2048 2048
2049 IntRect CompositedLayerMapping::localClipRectForSquashedLayer(const RenderLayer& referenceLayer, const GraphicsLayerPaintInfo& paintInfo, const Vector<GraphicsL ayerPaintInfo>& layers) 2049 IntRect CompositedLayerMapping::localClipRectForSquashedLayer(const Layer& refer enceLayer, const GraphicsLayerPaintInfo& paintInfo, const Vector<GraphicsLayerPa intInfo>& layers)
2050 { 2050 {
2051 const RenderObject* clippingContainer = paintInfo.renderLayer->clippingConta iner(); 2051 const RenderObject* clippingContainer = paintInfo.renderLayer->clippingConta iner();
2052 if (clippingContainer == referenceLayer.clippingContainer()) 2052 if (clippingContainer == referenceLayer.clippingContainer())
2053 return LayoutRect::infiniteIntRect(); 2053 return LayoutRect::infiniteIntRect();
2054 2054
2055 ASSERT(clippingContainer); 2055 ASSERT(clippingContainer);
2056 2056
2057 const GraphicsLayerPaintInfo* ancestorPaintInfo = containingSquashedLayer(cl ippingContainer, layers, layers.size()); 2057 const GraphicsLayerPaintInfo* ancestorPaintInfo = containingSquashedLayer(cl ippingContainer, layers, layers.size());
2058 // Must be there, otherwise CompositingLayerAssigner::canSquashIntoCurrentSq uashingOwner would have disallowed squashing. 2058 // Must be there, otherwise CompositingLayerAssigner::canSquashIntoCurrentSq uashingOwner would have disallowed squashing.
2059 ASSERT(ancestorPaintInfo); 2059 ASSERT(ancestorPaintInfo);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { 2101 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) {
2102 // FIXME: GraphicsLayers need a way to split for RenderRegions. 2102 // FIXME: GraphicsLayers need a way to split for RenderRegions.
2103 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe haviorNormal, paintInfo.renderLayer->subpixelAccumulation()); 2103 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe haviorNormal, paintInfo.renderLayer->subpixelAccumulation());
2104 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, paintin gInfo, paintLayerFlags); 2104 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, paintin gInfo, paintLayerFlags);
2105 2105
2106 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) 2106 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars())
2107 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, pai ntingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); 2107 LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, pai ntingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars);
2108 } else { 2108 } else {
2109 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe haviorNormal, paintInfo.renderLayer->subpixelAccumulation()); 2109 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe haviorNormal, paintInfo.renderLayer->subpixelAccumulation());
2110 2110
2111 // RenderLayer::paintLayer assumes that the caller clips to the passed r ect. Squashed layers need to do this clipping in software, 2111 // Layer::paintLayer assumes that the caller clips to the passed rect. S quashed layers need to do this clipping in software,
2112 // since there is no graphics layer to clip them precisely. Furthermore, in some cases we squash layers that need clipping in software 2112 // since there is no graphics layer to clip them precisely. Furthermore, in some cases we squash layers that need clipping in software
2113 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor SquashedLayer()). 2113 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor SquashedLayer()).
2114 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode? 2114 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode?
2115 // FIXME: Combine similar code here and LayerClipRecorder. 2115 // FIXME: Combine similar code here and LayerClipRecorder.
2116 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); 2116 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer);
2117 { 2117 {
2118 OwnPtr<DisplayItem> clipDisplayItem = ClipDisplayItem::create(displa yItemClient(), DisplayItem::ClipLayerOverflowControls, dirtyRect); 2118 OwnPtr<DisplayItem> clipDisplayItem = ClipDisplayItem::create(displa yItemClient(), DisplayItem::ClipLayerOverflowControls, dirtyRect);
2119 if (context->displayItemList()) { 2119 if (context->displayItemList()) {
2120 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); 2120 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled());
2121 context->displayItemList()->add(clipDisplayItem.release()); 2121 context->displayItemList()->add(clipDisplayItem.release());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 renderer()->node()->document().compositorPendingAnimations().notifyComposito rAnimationStarted(monotonicTime, group); 2240 renderer()->node()->document().compositorPendingAnimations().notifyComposito rAnimationStarted(monotonicTime, group);
2241 } 2241 }
2242 2242
2243 IntRect CompositedLayerMapping::pixelSnappedCompositedBounds() const 2243 IntRect CompositedLayerMapping::pixelSnappedCompositedBounds() const
2244 { 2244 {
2245 LayoutRect bounds = m_compositedBounds; 2245 LayoutRect bounds = m_compositedBounds;
2246 bounds.move(m_owningLayer.subpixelAccumulation()); 2246 bounds.move(m_owningLayer.subpixelAccumulation());
2247 return pixelSnappedIntRect(bounds); 2247 return pixelSnappedIntRect(bounds);
2248 } 2248 }
2249 2249
2250 bool CompositedLayerMapping::updateSquashingLayerAssignment(RenderLayer* squashe dLayer, const RenderLayer& owningLayer, size_t nextSquashedLayerIndex) 2250 bool CompositedLayerMapping::updateSquashingLayerAssignment(Layer* squashedLayer , const Layer& owningLayer, size_t nextSquashedLayerIndex)
2251 { 2251 {
2252 GraphicsLayerPaintInfo paintInfo; 2252 GraphicsLayerPaintInfo paintInfo;
2253 paintInfo.renderLayer = squashedLayer; 2253 paintInfo.renderLayer = squashedLayer;
2254 // NOTE: composited bounds are updated elsewhere 2254 // NOTE: composited bounds are updated elsewhere
2255 // NOTE: offsetFromRenderer is updated elsewhere 2255 // NOTE: offsetFromRenderer is updated elsewhere
2256 2256
2257 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer. 2257 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer.
2258 // FIXME: Perhaps we can find a tighter more clever mechanism later. 2258 // FIXME: Perhaps we can find a tighter more clever mechanism later.
2259 bool updatedAssignment = false; 2259 bool updatedAssignment = false;
2260 if (nextSquashedLayerIndex < m_squashedLayers.size()) { 2260 if (nextSquashedLayerIndex < m_squashedLayers.size()) {
2261 if (paintInfo.renderLayer != m_squashedLayers[nextSquashedLayerIndex].re nderLayer) { 2261 if (paintInfo.renderLayer != m_squashedLayers[nextSquashedLayerIndex].re nderLayer) {
2262 compositor()->paintInvalidationOnCompositingChange(squashedLayer); 2262 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2263 updatedAssignment = true; 2263 updatedAssignment = true;
2264 m_squashedLayers[nextSquashedLayerIndex] = paintInfo; 2264 m_squashedLayers[nextSquashedLayerIndex] = paintInfo;
2265 } 2265 }
2266 } else { 2266 } else {
2267 compositor()->paintInvalidationOnCompositingChange(squashedLayer); 2267 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2268 m_squashedLayers.append(paintInfo); 2268 m_squashedLayers.append(paintInfo);
2269 updatedAssignment = true; 2269 updatedAssignment = true;
2270 } 2270 }
2271 squashedLayer->setGroupedMapping(this); 2271 squashedLayer->setGroupedMapping(this);
2272 return updatedAssignment; 2272 return updatedAssignment;
2273 } 2273 }
2274 2274
2275 void CompositedLayerMapping::removeRenderLayerFromSquashingGraphicsLayer(const R enderLayer* layer) 2275 void CompositedLayerMapping::removeLayerFromSquashingGraphicsLayer(const Layer* layer)
2276 { 2276 {
2277 size_t layerIndex = kNotFound; 2277 size_t layerIndex = kNotFound;
2278 2278
2279 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 2279 for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
2280 if (m_squashedLayers[i].renderLayer == layer) { 2280 if (m_squashedLayers[i].renderLayer == layer) {
2281 layerIndex = i; 2281 layerIndex = i;
2282 break; 2282 break;
2283 } 2283 }
2284 } 2284 }
2285 2285
2286 if (layerIndex == kNotFound) 2286 if (layerIndex == kNotFound)
2287 return; 2287 return;
2288 2288
2289 m_squashedLayers.remove(layerIndex); 2289 m_squashedLayers.remove(layerIndex);
2290 } 2290 }
2291 2291
2292 void CompositedLayerMapping::finishAccumulatingSquashingLayers(size_t nextSquash edLayerIndex) 2292 void CompositedLayerMapping::finishAccumulatingSquashingLayers(size_t nextSquash edLayerIndex)
2293 { 2293 {
2294 // Any additional squashed RenderLayers in the array no longer exist, and re moving invalidates the squashingLayer contents. 2294 // Any additional squashed Layers in the array no longer exist, and removing invalidates the squashingLayer contents.
2295 if (nextSquashedLayerIndex < m_squashedLayers.size()) 2295 if (nextSquashedLayerIndex < m_squashedLayers.size())
2296 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex); 2296 m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
2297 } 2297 }
2298 2298
2299 String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer) 2299 String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer)
2300 { 2300 {
2301 String name; 2301 String name;
2302 if (graphicsLayer == m_graphicsLayer.get()) { 2302 if (graphicsLayer == m_graphicsLayer.get()) {
2303 name = m_owningLayer.debugName(); 2303 name = m_owningLayer.debugName();
2304 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { 2304 } else if (graphicsLayer == m_squashingContainmentLayer.get()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2336 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2337 name = "Scrolling Block Selection Layer"; 2337 name = "Scrolling Block Selection Layer";
2338 } else { 2338 } else {
2339 ASSERT_NOT_REACHED(); 2339 ASSERT_NOT_REACHED();
2340 } 2340 }
2341 2341
2342 return name; 2342 return name;
2343 } 2343 }
2344 2344
2345 } // namespace blink 2345 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositedLayerMapping.h ('k') | Source/core/layout/compositing/CompositingInputsUpdater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698