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

Side by Side Diff: sky/engine/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 721473002: Removed ScrollingCoordinator and a bunch of composited scrolling' (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cr comments Created 6 years, 1 month 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
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 18 matching lines...) Expand all
29 29
30 #include "core/fetch/ImageResource.h" 30 #include "core/fetch/ImageResource.h"
31 #include "core/frame/FrameView.h" 31 #include "core/frame/FrameView.h"
32 #include "core/html/HTMLCanvasElement.h" 32 #include "core/html/HTMLCanvasElement.h"
33 #include "core/html/canvas/CanvasRenderingContext.h" 33 #include "core/html/canvas/CanvasRenderingContext.h"
34 #include "core/inspector/InspectorNodeIds.h" 34 #include "core/inspector/InspectorNodeIds.h"
35 #include "core/inspector/InspectorTraceEvents.h" 35 #include "core/inspector/InspectorTraceEvents.h"
36 #include "core/page/Chrome.h" 36 #include "core/page/Chrome.h"
37 #include "core/page/ChromeClient.h" 37 #include "core/page/ChromeClient.h"
38 #include "core/page/Page.h" 38 #include "core/page/Page.h"
39 #include "core/page/scrolling/ScrollingCoordinator.h"
40 #include "core/rendering/FilterEffectRenderer.h" 39 #include "core/rendering/FilterEffectRenderer.h"
41 #include "core/rendering/RenderImage.h" 40 #include "core/rendering/RenderImage.h"
42 #include "core/rendering/RenderLayerStackingNodeIterator.h" 41 #include "core/rendering/RenderLayerStackingNodeIterator.h"
43 #include "core/rendering/RenderView.h" 42 #include "core/rendering/RenderView.h"
44 #include "core/rendering/compositing/RenderLayerCompositor.h" 43 #include "core/rendering/compositing/RenderLayerCompositor.h"
45 #include "core/rendering/style/KeyframeList.h" 44 #include "core/rendering/style/KeyframeList.h"
46 #include "platform/LengthFunctions.h" 45 #include "platform/LengthFunctions.h"
47 #include "platform/RuntimeEnabledFeatures.h" 46 #include "platform/RuntimeEnabledFeatures.h"
48 #include "platform/fonts/FontCache.h" 47 #include "platform/fonts/FontCache.h"
49 #include "platform/geometry/TransformState.h" 48 #include "platform/geometry/TransformState.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 115
117 // Simple background that is contained within the contents rect. 116 // Simple background that is contained within the contents rect.
118 return contentsRect(renderer).contains(backgroundRect(renderer)); 117 return contentsRect(renderer).contains(backgroundRect(renderer));
119 } 118 }
120 119
121 static inline bool isAcceleratedContents(RenderObject* renderer) 120 static inline bool isAcceleratedContents(RenderObject* renderer)
122 { 121 {
123 return isAcceleratedCanvas(renderer); 122 return isAcceleratedCanvas(renderer);
124 } 123 }
125 124
126 // Get the scrolling coordinator in a way that works inside CompositedLayerMappi ng's destructor.
127 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer& layer)
128 {
129 Page* page = layer.renderer()->frame()->page();
130 if (!page)
131 return 0;
132
133 return page->scrollingCoordinator();
134 }
135
136 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) 125 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer)
137 : m_owningLayer(layer) 126 : m_owningLayer(layer)
138 , m_contentOffsetInCompositingLayerDirty(false) 127 , m_contentOffsetInCompositingLayerDirty(false)
139 , m_pendingUpdateScope(GraphicsLayerUpdateNone) 128 , m_pendingUpdateScope(GraphicsLayerUpdateNone)
140 , m_requiresOwnBackingStoreForIntrinsicReasons(false) 129 , m_requiresOwnBackingStoreForIntrinsicReasons(false)
141 , m_requiresOwnBackingStoreForAncestorReasons(false) 130 , m_requiresOwnBackingStoreForAncestorReasons(false)
142 , m_backgroundLayerPaintsFixedRootBackground(false) 131 , m_backgroundLayerPaintsFixedRootBackground(false)
143 , m_scrollingContentsAreEmpty(false)
144 { 132 {
145 createPrimaryGraphicsLayer(); 133 createPrimaryGraphicsLayer();
146 } 134 }
147 135
148 CompositedLayerMapping::~CompositedLayerMapping() 136 CompositedLayerMapping::~CompositedLayerMapping()
149 { 137 {
150 // Hits in compositing/squashing/squash-onto-nephew.html. 138 // Hits in compositing/squashing/squash-onto-nephew.html.
151 DisableCompositingQueryAsserts disabler; 139 DisableCompositingQueryAsserts disabler;
152 140
153 // Do not leave the destroyed pointer dangling on any RenderLayers that pain ted to this mapping's squashing layer. 141 // Do not leave the destroyed pointer dangling on any RenderLayers that pain ted to this mapping's squashing layer.
154 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 142 for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
155 RenderLayer* oldSquashedLayer = m_squashedLayers[i].renderLayer; 143 RenderLayer* oldSquashedLayer = m_squashedLayers[i].renderLayer;
156 if (oldSquashedLayer->groupedMapping() == this) { 144 if (oldSquashedLayer->groupedMapping() == this) {
157 oldSquashedLayer->setGroupedMapping(0, true); 145 oldSquashedLayer->setGroupedMapping(0, true);
158 oldSquashedLayer->setLostGroupedMapping(true); 146 oldSquashedLayer->setLostGroupedMapping(true);
159 } 147 }
160 } 148 }
161 149
162 updateClippingLayers(false, false); 150 updateClippingLayers(false, false);
163 updateOverflowControlsLayers(false, false, false);
164 updateChildTransformLayer(false); 151 updateChildTransformLayer(false);
165 updateForegroundLayer(false); 152 updateForegroundLayer(false);
166 updateBackgroundLayer(false); 153 updateBackgroundLayer(false);
167 updateMaskLayer(false); 154 updateMaskLayer(false);
168 updateClippingMaskLayers(false); 155 updateClippingMaskLayers(false);
169 updateScrollingLayers(false);
170 updateSquashingLayers(false); 156 updateSquashingLayers(false);
171 destroyGraphicsLayers(); 157 destroyGraphicsLayers();
172 } 158 }
173 159
174 PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compositin gReasons reasons) 160 PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compositin gReasons reasons)
175 { 161 {
176 GraphicsLayerFactory* graphicsLayerFactory = 0; 162 GraphicsLayerFactory* graphicsLayerFactory = 0;
177 if (Page* page = renderer()->frame()->page()) 163 if (Page* page = renderer()->frame()->page())
178 graphicsLayerFactory = page->chrome().client().graphicsLayerFactory(); 164 graphicsLayerFactory = page->chrome().client().graphicsLayerFactory();
179 165
(...skipping 26 matching lines...) Expand all
206 m_graphicsLayer->removeFromParent(); 192 m_graphicsLayer->removeFromParent();
207 193
208 m_ancestorClippingLayer = nullptr; 194 m_ancestorClippingLayer = nullptr;
209 m_graphicsLayer = nullptr; 195 m_graphicsLayer = nullptr;
210 m_foregroundLayer = nullptr; 196 m_foregroundLayer = nullptr;
211 m_backgroundLayer = nullptr; 197 m_backgroundLayer = nullptr;
212 m_childContainmentLayer = nullptr; 198 m_childContainmentLayer = nullptr;
213 m_childTransformLayer = nullptr; 199 m_childTransformLayer = nullptr;
214 m_maskLayer = nullptr; 200 m_maskLayer = nullptr;
215 m_childClippingMaskLayer = nullptr; 201 m_childClippingMaskLayer = nullptr;
216
217 m_scrollingLayer = nullptr;
218 m_scrollingContentsLayer = nullptr;
219 m_scrollingBlockSelectionLayer = nullptr;
220 } 202 }
221 203
222 void CompositedLayerMapping::updateOpacity(const RenderStyle* style) 204 void CompositedLayerMapping::updateOpacity(const RenderStyle* style)
223 { 205 {
224 m_graphicsLayer->setOpacity(compositingOpacity(style->opacity())); 206 m_graphicsLayer->setOpacity(compositingOpacity(style->opacity()));
225 } 207 }
226 208
227 void CompositedLayerMapping::updateTransform(const RenderStyle* style) 209 void CompositedLayerMapping::updateTransform(const RenderStyle* style)
228 { 210 {
229 // FIXME: This could use m_owningLayer.transform(), but that currently has t ransform-origin 211 // FIXME: This could use m_owningLayer.transform(), but that currently has t ransform-origin
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if (scrollParent) { 335 if (scrollParent) {
354 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped 336 // If our containing block is our ancestor scrolling layer, then we'll a lready be clipped
355 // to it via our scroll parent and we don't need an ancestor clipping la yer. 337 // to it via our scroll parent and we don't need an ancestor clipping la yer.
356 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o wningLayer.ancestorScrollingLayer()) 338 if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_o wningLayer.ancestorScrollingLayer())
357 needsAncestorClip = false; 339 needsAncestorClip = false;
358 } 340 }
359 341
360 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) 342 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer))
361 layerConfigChanged = true; 343 layerConfigChanged = true;
362 344
363 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), needsAncestorClip))
364 layerConfigChanged = true;
365
366 bool scrollingConfigChanged = false;
367 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) {
368 layerConfigChanged = true;
369 scrollingConfigChanged = true;
370 }
371
372 bool hasPerspective = false; 345 bool hasPerspective = false;
373 if (RenderStyle* style = renderer->style()) 346 if (RenderStyle* style = renderer->style())
374 hasPerspective = style->hasPerspective(); 347 hasPerspective = style->hasPerspective();
375 bool needsChildTransformLayer = hasPerspective && (layerForChildrenTransform () == m_childTransformLayer.get()) && renderer->isBox(); 348 bool needsChildTransformLayer = hasPerspective && (layerForChildrenTransform () == m_childTransformLayer.get()) && renderer->isBox();
376 if (updateChildTransformLayer(needsChildTransformLayer)) 349 if (updateChildTransformLayer(needsChildTransformLayer))
377 layerConfigChanged = true; 350 layerConfigChanged = true;
378 351
379 updateScrollParent(scrollParent);
380 updateClipParent(); 352 updateClipParent();
381 353
382 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) 354 if (updateSquashingLayers(!m_squashedLayers.isEmpty()))
383 layerConfigChanged = true; 355 layerConfigChanged = true;
384 356
385 if (layerConfigChanged) 357 if (layerConfigChanged)
386 updateInternalHierarchy(); 358 updateInternalHierarchy();
387 359
388 if (scrollingConfigChanged) {
389 if (renderer->view())
390 compositor->scrollingLayerDidChange(&m_owningLayer);
391 }
392
393 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer 360 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer
394 // that's plugged into another GraphicsLayer that is part of the hierarchy. 361 // that's plugged into another GraphicsLayer that is part of the hierarchy.
395 // It has no parent or child GraphicsLayer. For that reason, we process it 362 // It has no parent or child GraphicsLayer. For that reason, we process it
396 // here, after the hierarchy has been updated. 363 // here, after the hierarchy has been updated.
397 bool maskLayerChanged = false; 364 bool maskLayerChanged = false;
398 if (updateMaskLayer(renderer->hasMask())) { 365 if (updateMaskLayer(renderer->hasMask())) {
399 maskLayerChanged = true; 366 maskLayerChanged = true;
400 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 367 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
401 } 368 }
402 369
403 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni ngLayer) && (hasClippingLayer() || hasScrollingLayer()); 370 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni ngLayer) && (hasClippingLayer());
404 // If we have a border radius or clip path on a scrolling layer, we need a c lipping mask to properly 371 // If we have a border radius or clip path on a scrolling layer, we need a c lipping mask to properly
405 // clip the scrolled contents, even if there are no composited descendants. 372 // clip the scrolled contents, even if there are no composited descendants.
406 bool hasClipPath = renderer->style()->clipPath(); 373 bool hasClipPath = renderer->style()->clipPath();
407 bool needsChildClippingMask = (hasClipPath || renderer->style()->hasBorderRa dius()) && (hasChildClippingLayer || isAcceleratedContents(renderer) || hasScrol lingLayer()); 374 bool needsChildClippingMask = (hasClipPath || renderer->style()->hasBorderRa dius()) && (hasChildClippingLayer || isAcceleratedContents(renderer));
408 if (updateClippingMaskLayers(needsChildClippingMask)) { 375 if (updateClippingMaskLayers(needsChildClippingMask)) {
409 // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto 376 // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto
410 // the main m_graphicsLayer. 377 // the main m_graphicsLayer.
411 if (hasClipPath) 378 if (hasClipPath)
412 m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get()); 379 m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get());
413 else if (hasClippingLayer()) 380 else if (hasClippingLayer())
414 clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get()); 381 clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
415 else if (hasScrollingLayer())
416 scrollingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
417 else if (isAcceleratedContents(renderer)) 382 else if (isAcceleratedContents(renderer))
418 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay er.get()); 383 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay er.get());
419 } 384 }
420 385
421 updateBackgroundColor(); 386 updateBackgroundColor();
422 387
423 if (renderer->isImage()) { 388 if (renderer->isImage()) {
424 if (isDirectlyCompositedImage()) { 389 if (isDirectlyCompositedImage()) {
425 updateImageContents(); 390 updateImageContents();
426 } else if (m_graphicsLayer->hasContentsLayer()) { 391 } else if (m_graphicsLayer->hasContentsLayer()) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 if (m_childContainmentLayer) 567 if (m_childContainmentLayer)
603 clippingBox = clipBox(toRenderBox(renderer())); 568 clippingBox = clipBox(toRenderBox(renderer()));
604 569
605 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); 570 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds);
606 updateChildTransformLayerGeometry(); 571 updateChildTransformLayerGeometry();
607 572
608 updateMaskLayerGeometry(); 573 updateMaskLayerGeometry();
609 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi tingBounds); 574 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi tingBounds);
610 updateForegroundLayerGeometry(contentsSize, clippingBox); 575 updateForegroundLayerGeometry(contentsSize, clippingBox);
611 updateBackgroundLayerGeometry(contentsSize); 576 updateBackgroundLayerGeometry(contentsSize);
612 updateScrollingLayerGeometry(localCompositingBounds);
613 updateChildClippingMaskLayerGeometry(); 577 updateChildClippingMaskLayerGeometry();
614 578
615 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll sOverflow()) 579 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll sOverflow())
616 m_owningLayer.scrollableArea()->positionOverflowControls(IntSize()); 580 m_owningLayer.scrollableArea()->positionOverflowControls(IntSize());
617 581
618 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { 582 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
619 updateLayerBlendMode(renderer()->style()); 583 updateLayerBlendMode(renderer()->style());
620 updateIsRootForIsolatedGroup(); 584 updateIsRootForIsolatedGroup();
621 } 585 }
622 586
623 updateContentsRect(); 587 updateContentsRect();
624 updateBackgroundColor(); 588 updateBackgroundColor();
625 updateDrawsContent(); 589 updateDrawsContent();
626 updateContentsOpaque(); 590 updateContentsOpaque();
627 updateRenderingContext(); 591 updateRenderingContext();
628 updateShouldFlattenTransform(); 592 updateShouldFlattenTransform();
629 updateChildrenTransform(); 593 updateChildrenTransform();
630 updateScrollParent(compositor()->preferCompositingToLCDTextEnabled() ? m_own ingLayer.scrollParent() : 0);
631 594
632 updateCompositingReasons(); 595 updateCompositingReasons();
633 } 596 }
634 597
635 void CompositedLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& rela tiveCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& gr aphicsLayerParentLocation) 598 void CompositedLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& rela tiveCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& gr aphicsLayerParentLocation)
636 { 599 {
637 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation)); 600 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
638 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion())); 601 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion()));
639 602
640 FloatSize oldSize = m_graphicsLayer->size(); 603 FloatSize oldSize = m_graphicsLayer->size();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 } 679 }
717 680
718 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds) 681 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds)
719 { 682 {
720 if (!m_childContainmentLayer) 683 if (!m_childContainmentLayer)
721 return; 684 return;
722 685
723 m_childContainmentLayer->setPosition(FloatPoint(clippingBox.location() - loc alCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulati on()))); 686 m_childContainmentLayer->setPosition(FloatPoint(clippingBox.location() - loc alCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulati on())));
724 m_childContainmentLayer->setSize(clippingBox.size()); 687 m_childContainmentLayer->setSize(clippingBox.size());
725 m_childContainmentLayer->setOffsetFromRenderer(toIntSize(clippingBox.locatio n())); 688 m_childContainmentLayer->setOffsetFromRenderer(toIntSize(clippingBox.locatio n()));
726 if (m_childClippingMaskLayer && !m_scrollingLayer && !renderer()->style()->c lipPath()) { 689 if (m_childClippingMaskLayer && !renderer()->style()->clipPath()) {
727 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position( )); 690 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position( ));
728 m_childClippingMaskLayer->setSize(m_childContainmentLayer->size()); 691 m_childClippingMaskLayer->setSize(m_childContainmentLayer->size());
729 m_childClippingMaskLayer->setOffsetFromRenderer(m_childContainmentLayer- >offsetFromRenderer()); 692 m_childClippingMaskLayer->setOffsetFromRenderer(m_childContainmentLayer- >offsetFromRenderer());
730 } 693 }
731 } 694 }
732 695
733 void CompositedLayerMapping::updateChildTransformLayerGeometry() 696 void CompositedLayerMapping::updateChildTransformLayerGeometry()
734 { 697 {
735 if (!m_childTransformLayer) 698 if (!m_childTransformLayer)
736 return; 699 return;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); 736 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
774 } else { 737 } else {
775 FloatPoint3D compositedTransformOrigin( 738 FloatPoint3D compositedTransformOrigin(
776 relativeCompositingBounds.width() * 0.5f, 739 relativeCompositingBounds.width() * 0.5f,
777 relativeCompositingBounds.height() * 0.5f, 740 relativeCompositingBounds.height() * 0.5f,
778 0.f); 741 0.f);
779 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); 742 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
780 } 743 }
781 } 744 }
782 745
783 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds)
784 {
785 if (!m_scrollingLayer)
786 return;
787
788 ASSERT(m_scrollingContentsLayer);
789 RenderBox* renderBox = toRenderBox(renderer());
790 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
791
792 IntSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedScrol lOffset();
793 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localComposi tingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())));
794 m_scrollingLayer->setSize(clientBox.size());
795
796 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
797 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()));
798
799 if (m_childClippingMaskLayer && !renderer()->style()->clipPath()) {
800 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
801 m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
802 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.loca tion()));
803 }
804
805 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->o ffsetFromRenderer();
806
807 IntSize scrollSize(renderBox->scrollWidth(), renderBox->scrollHeight());
808 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged )
809 m_scrollingContentsLayer->setNeedsDisplay();
810
811 IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjustedS crollOffset);
812 if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer( ) || scrollSize != m_scrollingContentsLayer->size()) {
813 bool coordinatorHandlesOffset = compositor()->scrollingLayerDidChange(&m _owningLayer);
814 m_scrollingContentsLayer->setPosition(coordinatorHandlesOffset ? FloatPo int() : FloatPoint(-adjustedScrollOffset));
815 }
816
817 m_scrollingContentsLayer->setSize(scrollSize);
818 // FIXME: The paint offset and the scroll offset should really be separate c oncepts.
819 m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, Gra phicsLayer::DontSetNeedsDisplay);
820
821 if (m_foregroundLayer) {
822 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
823 m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
824 m_foregroundLayer->setNeedsDisplay();
825 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offse tFromRenderer());
826 }
827
828 updateScrollingBlockSelection();
829 }
830
831 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() 746 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry()
832 { 747 {
833 if (!m_childClippingMaskLayer || !renderer()->style()->clipPath()) 748 if (!m_childClippingMaskLayer || !renderer()->style()->clipPath())
834 return; 749 return;
835 RenderBox* renderBox = toRenderBox(renderer()); 750 RenderBox* renderBox = toRenderBox(renderer());
836 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); 751 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
837 752
838 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position()); 753 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position());
839 m_childClippingMaskLayer->setSize(m_graphicsLayer->size()); 754 m_childClippingMaskLayer->setSize(m_graphicsLayer->size());
840 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.location ())); 755 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.location ()));
(...skipping 24 matching lines...) Expand all
865 // "window" onto the clipped layer. 780 // "window" onto the clipped layer.
866 781
867 m_foregroundLayer->setPosition(-m_childTransformLayer->position()); 782 m_foregroundLayer->setPosition(-m_childTransformLayer->position());
868 } 783 }
869 784
870 if (foregroundSize != m_foregroundLayer->size()) { 785 if (foregroundSize != m_foregroundLayer->size()) {
871 m_foregroundLayer->setSize(foregroundSize); 786 m_foregroundLayer->setSize(foregroundSize);
872 m_foregroundLayer->setNeedsDisplay(); 787 m_foregroundLayer->setNeedsDisplay();
873 } 788 }
874 m_foregroundLayer->setOffsetFromRenderer(foregroundOffset); 789 m_foregroundLayer->setOffsetFromRenderer(foregroundOffset);
875
876 // NOTE: there is some more configuring going on in updateScrollingLayerGeom etry().
877 } 790 }
878 791
879 void CompositedLayerMapping::updateBackgroundLayerGeometry(const FloatSize& rela tiveCompositingBoundsSize) 792 void CompositedLayerMapping::updateBackgroundLayerGeometry(const FloatSize& rela tiveCompositingBoundsSize)
880 { 793 {
881 if (!m_backgroundLayer) 794 if (!m_backgroundLayer)
882 return; 795 return;
883 796
884 FloatSize backgroundSize = relativeCompositingBoundsSize; 797 FloatSize backgroundSize = relativeCompositingBoundsSize;
885 if (backgroundLayerPaintsFixedRootBackground()) { 798 if (backgroundLayerPaintsFixedRootBackground()) {
886 FrameView* frameView = toRenderView(renderer())->frameView(); 799 FrameView* frameView = toRenderView(renderer())->frameView();
(...skipping 17 matching lines...) Expand all
904 m_graphicsLayer->removeFromParent(); 817 m_graphicsLayer->removeFromParent();
905 818
906 if (m_ancestorClippingLayer) 819 if (m_ancestorClippingLayer)
907 m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); 820 m_ancestorClippingLayer->addChild(m_graphicsLayer.get());
908 821
909 if (m_childContainmentLayer) 822 if (m_childContainmentLayer)
910 m_graphicsLayer->addChild(m_childContainmentLayer.get()); 823 m_graphicsLayer->addChild(m_childContainmentLayer.get());
911 else if (m_childTransformLayer) 824 else if (m_childTransformLayer)
912 m_graphicsLayer->addChild(m_childTransformLayer.get()); 825 m_graphicsLayer->addChild(m_childTransformLayer.get());
913 826
914 if (m_scrollingLayer) {
915 GraphicsLayer* superLayer = m_graphicsLayer.get();
916
917 if (m_childContainmentLayer)
918 superLayer = m_childContainmentLayer.get();
919
920 if (m_childTransformLayer)
921 superLayer = m_childTransformLayer.get();
922
923 superLayer->addChild(m_scrollingLayer.get());
924 }
925
926 // The clip for child layers does not include space for overflow controls, s o they exist as 827 // The clip for child layers does not include space for overflow controls, s o they exist as
927 // siblings of the clipping layer if we have one. Normal children of this la yer are set as 828 // siblings of the clipping layer if we have one. Normal children of this la yer are set as
928 // children of the clipping layer. 829 // children of the clipping layer.
929 if (m_overflowControlsClippingLayer) { 830 if (m_overflowControlsClippingLayer) {
930 ASSERT(m_overflowControlsHostLayer); 831 ASSERT(m_overflowControlsHostLayer);
931 m_graphicsLayer->addChild(m_overflowControlsClippingLayer.get()); 832 m_graphicsLayer->addChild(m_overflowControlsClippingLayer.get());
932 m_overflowControlsClippingLayer->addChild(m_overflowControlsHostLayer.ge t()); 833 m_overflowControlsClippingLayer->addChild(m_overflowControlsHostLayer.ge t());
933 } else if (m_overflowControlsHostLayer) { 834 } else if (m_overflowControlsHostLayer) {
934 m_graphicsLayer->addChild(m_overflowControlsHostLayer.get()); 835 m_graphicsLayer->addChild(m_overflowControlsHostLayer.get());
935 } 836 }
936 837
937 if (m_layerForHorizontalScrollbar)
938 m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get( ));
939 if (m_layerForVerticalScrollbar)
940 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get()) ;
941
942 // The squashing containment layer, if it exists, becomes a no-op parent. 838 // The squashing containment layer, if it exists, becomes a no-op parent.
943 if (m_squashingLayer) { 839 if (m_squashingLayer) {
944 ASSERT(compositor()->layerSquashingEnabled()); 840 ASSERT(compositor()->layerSquashingEnabled());
945 ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || (!m_ ancestorClippingLayer && m_squashingContainmentLayer)); 841 ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || (!m_ ancestorClippingLayer && m_squashingContainmentLayer));
946 842
947 if (m_squashingContainmentLayer) { 843 if (m_squashingContainmentLayer) {
948 m_squashingContainmentLayer->removeAllChildren(); 844 m_squashingContainmentLayer->removeAllChildren();
949 m_squashingContainmentLayer->addChild(m_graphicsLayer.get()); 845 m_squashingContainmentLayer->addChild(m_graphicsLayer.get());
950 m_squashingContainmentLayer->addChild(m_squashingLayer.get()); 846 m_squashingContainmentLayer->addChild(m_squashingLayer.get());
951 } else { 847 } else {
952 // The ancestor clipping layer is already set up and has m_graphicsL ayer under it. 848 // The ancestor clipping layer is already set up and has m_graphicsL ayer under it.
953 m_ancestorClippingLayer->addChild(m_squashingLayer.get()); 849 m_ancestorClippingLayer->addChild(m_squashingLayer.get());
954 } 850 }
955 } 851 }
956 } 852 }
957 853
958 void CompositedLayerMapping::updatePaintingPhases() 854 void CompositedLayerMapping::updatePaintingPhases()
959 { 855 {
960 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); 856 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
961 if (m_scrollingContentsLayer) {
962 GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowConten ts | GraphicsLayerPaintCompositedScroll;
963 if (!m_foregroundLayer)
964 paintPhase |= GraphicsLayerPaintForeground;
965 m_scrollingContentsLayer->setPaintingPhase(paintPhase);
966 m_scrollingBlockSelectionLayer->setPaintingPhase(paintPhase);
967 }
968 } 857 }
969 858
970 void CompositedLayerMapping::updateContentsRect() 859 void CompositedLayerMapping::updateContentsRect()
971 { 860 {
972 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); 861 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
973 } 862 }
974 863
975 void CompositedLayerMapping::updateContentsOffsetInCompositingLayer(const IntPoi nt& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLoca tion) 864 void CompositedLayerMapping::updateContentsOffsetInCompositingLayer(const IntPoi nt& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLoca tion)
976 { 865 {
977 // m_graphicsLayer is positioned relative to our compositing ancestor 866 // m_graphicsLayer is positioned relative to our compositing ancestor
(...skipping 25 matching lines...) Expand all
1003 // graphics layers. 892 // graphics layers.
1004 // 893 //
1005 // And drawing of composited children takes into account the subpixel 894 // And drawing of composited children takes into account the subpixel
1006 // accumulation of this CLM already (through its own 895 // accumulation of this CLM already (through its own
1007 // graphicsLayerParentLocation it appears). 896 // graphicsLayerParentLocation it appears).
1008 FloatPoint offsetDueToAncestorGraphicsLayers = m_graphicsLayer->position() + graphicsLayerParentLocation; 897 FloatPoint offsetDueToAncestorGraphicsLayers = m_graphicsLayer->position() + graphicsLayerParentLocation;
1009 m_contentOffsetInCompositingLayer = LayoutSize(snappedOffsetFromCompositedAn cestor - offsetDueToAncestorGraphicsLayers); 898 m_contentOffsetInCompositingLayer = LayoutSize(snappedOffsetFromCompositedAn cestor - offsetDueToAncestorGraphicsLayers);
1010 m_contentOffsetInCompositingLayerDirty = false; 899 m_contentOffsetInCompositingLayerDirty = false;
1011 } 900 }
1012 901
1013 void CompositedLayerMapping::updateScrollingBlockSelection()
1014 {
1015 if (!m_scrollingBlockSelectionLayer)
1016 return;
1017
1018 if (!m_scrollingContentsAreEmpty) {
1019 // In this case, the selection will be painted directly into m_scrolling ContentsLayer.
1020 m_scrollingBlockSelectionLayer->setDrawsContent(false);
1021 return;
1022 }
1023
1024 const IntRect blockSelectionGapsBounds = m_owningLayer.blockSelectionGapsBou nds();
1025 const bool shouldDrawContent = !blockSelectionGapsBounds.isEmpty();
1026 m_scrollingBlockSelectionLayer->setDrawsContent(shouldDrawContent);
1027 if (!shouldDrawContent)
1028 return;
1029
1030 const IntPoint position = blockSelectionGapsBounds.location() + m_owningLaye r.scrollableArea()->adjustedScrollOffset();
1031 if (m_scrollingBlockSelectionLayer->size() == blockSelectionGapsBounds.size( ) && m_scrollingBlockSelectionLayer->position() == position)
1032 return;
1033
1034 m_scrollingBlockSelectionLayer->setPosition(position);
1035 m_scrollingBlockSelectionLayer->setSize(blockSelectionGapsBounds.size());
1036 m_scrollingBlockSelectionLayer->setOffsetFromRenderer(toIntSize(blockSelecti onGapsBounds.location()), GraphicsLayer::SetNeedsDisplay);
1037 }
1038
1039 void CompositedLayerMapping::updateDrawsContent() 902 void CompositedLayerMapping::updateDrawsContent()
1040 { 903 {
1041 if (m_scrollingLayer) {
1042 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere.
1043 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint.
1044 // m_scrollingLayer never has backing store.
1045 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint.
1046 bool hasNonScrollingPaintedContent = m_owningLayer.hasBoxDecorationsOrBa ckground();
1047 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
1048
1049 m_scrollingContentsAreEmpty = !(renderer()->hasBackground() || paintsChi ldren());
1050 m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty);
1051
1052 updateScrollingBlockSelection();
1053 return;
1054 }
1055
1056 bool hasPaintedContent = containsPaintedContent(); 904 bool hasPaintedContent = containsPaintedContent();
1057 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { 905 if (hasPaintedContent && isAcceleratedCanvas(renderer())) {
1058 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext(); 906 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext();
1059 // Content layer may be null if context is lost. 907 // Content layer may be null if context is lost.
1060 if (WebLayer* contentLayer = context->platformLayer()) { 908 if (WebLayer* contentLayer = context->platformLayer()) {
1061 Color bgColor(Color::transparent); 909 Color bgColor(Color::transparent);
1062 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { 910 if (contentLayerSupportsDirectBackgroundComposition(renderer())) {
1063 bgColor = rendererBackgroundColor(); 911 bgColor = rendererBackgroundColor();
1064 } 912 }
1065 contentLayer->setBackgroundColor(bgColor.rgb()); 913 contentLayer->setBackgroundColor(bgColor.rgb());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 } 978 }
1131 979
1132 return layersChanged; 980 return layersChanged;
1133 } 981 }
1134 982
1135 void CompositedLayerMapping::setBackgroundLayerPaintsFixedRootBackground(bool ba ckgroundLayerPaintsFixedRootBackground) 983 void CompositedLayerMapping::setBackgroundLayerPaintsFixedRootBackground(bool ba ckgroundLayerPaintsFixedRootBackground)
1136 { 984 {
1137 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB ackground; 985 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB ackground;
1138 } 986 }
1139 987
1140 // Only a member function so it can call createGraphicsLayer.
1141 bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason)
1142 {
1143 if (needsLayer == !!layer)
1144 return false;
1145 layer = needsLayer ? createGraphicsLayer(reason) : nullptr;
1146 return true;
1147 }
1148
1149 bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalSc rollbarLayer, bool needsVerticalScrollbarLayer, bool needsAncestorClip)
1150 {
1151 bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerF orHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForH orizontalScrollbar);
1152 bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerFor VerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVertica lScrollbar);
1153
1154 bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needs VerticalScrollbarLayer;
1155 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr olsHostLayer, CompositingReasonLayerForOverflowControlsHost);
1156 bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncesto rClip;
1157 toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowC lipLayer, CompositingReasonLayerForOverflowControlsHost);
1158
1159 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1160 if (horizontalScrollbarLayerChanged)
1161 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), HorizontalScrollbar);
1162 if (verticalScrollbarLayerChanged)
1163 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer.scrollableArea(), VerticalScrollbar);
1164 }
1165
1166 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged;
1167 }
1168
1169 void CompositedLayerMapping::positionOverflowControlsLayers(const IntSize& offse tFromRoot)
1170 {
1171 IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer() - rounded IntSize(m_owningLayer.subpixelAccumulation());
1172 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
1173 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar();
1174 if (hBar) {
1175 layer->setPosition(hBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer);
1176 layer->setSize(hBar->frameRect().size());
1177 if (layer->hasContentsLayer())
1178 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e()));
1179 }
1180 layer->setDrawsContent(hBar && !layer->hasContentsLayer());
1181 }
1182
1183 if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
1184 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar();
1185 if (vBar) {
1186 layer->setPosition(vBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer);
1187 layer->setSize(vBar->frameRect().size());
1188 if (layer->hasContentsLayer())
1189 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz e()));
1190 }
1191 layer->setDrawsContent(vBar && !layer->hasContentsLayer());
1192 }
1193 }
1194
1195 bool CompositedLayerMapping::hasUnpositionedOverflowControlsLayers() const
1196 {
1197 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
1198 if (!layer->drawsContent())
1199 return true;
1200 }
1201
1202 if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
1203 if (!layer->drawsContent())
1204 return true;
1205 }
1206
1207 return false;
1208 }
1209
1210 enum ApplyToGraphicsLayersModeFlags { 988 enum ApplyToGraphicsLayersModeFlags {
1211 ApplyToCoreLayers = (1 << 0), 989 ApplyToCoreLayers = (1 << 0),
1212 ApplyToSquashingLayer = (1 << 1), 990 ApplyToSquashingLayer = (1 << 1),
1213 ApplyToScrollbarLayers = (1 << 2),
1214 ApplyToBackgroundLayer = (1 << 3), 991 ApplyToBackgroundLayer = (1 << 3),
1215 ApplyToMaskLayers = (1 << 4), 992 ApplyToMaskLayers = (1 << 4),
1216 ApplyToContentLayers = (1 << 5), 993 ApplyToContentLayers = (1 << 5),
1217 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers | ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToCoreLayers | ApplyToContent Layers) 994 ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToCoreLayers | ApplyToContentLayers)
1218 }; 995 };
1219 typedef unsigned ApplyToGraphicsLayersMode; 996 typedef unsigned ApplyToGraphicsLayersMode;
1220 997
1221 template <typename Func> 998 template <typename Func>
1222 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F unc& f, ApplyToGraphicsLayersMode mode) 999 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const F unc& f, ApplyToGraphicsLayersMode mode)
1223 { 1000 {
1224 ASSERT(mode); 1001 ASSERT(mode);
1225 1002
1226 if ((mode & ApplyToCoreLayers) && mapping->squashingContainmentLayer()) 1003 if ((mode & ApplyToCoreLayers) && mapping->squashingContainmentLayer())
1227 f(mapping->squashingContainmentLayer()); 1004 f(mapping->squashingContainmentLayer());
1228 if ((mode & ApplyToCoreLayers) && mapping->childTransformLayer()) 1005 if ((mode & ApplyToCoreLayers) && mapping->childTransformLayer())
1229 f(mapping->childTransformLayer()); 1006 f(mapping->childTransformLayer());
1230 if ((mode & ApplyToCoreLayers) && mapping->ancestorClippingLayer()) 1007 if ((mode & ApplyToCoreLayers) && mapping->ancestorClippingLayer())
1231 f(mapping->ancestorClippingLayer()); 1008 f(mapping->ancestorClippingLayer());
1232 if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping ->mainGraphicsLayer()) 1009 if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping ->mainGraphicsLayer())
1233 f(mapping->mainGraphicsLayer()); 1010 f(mapping->mainGraphicsLayer());
1234 if ((mode & ApplyToCoreLayers) && mapping->clippingLayer()) 1011 if ((mode & ApplyToCoreLayers) && mapping->clippingLayer())
1235 f(mapping->clippingLayer()); 1012 f(mapping->clippingLayer());
1236 if ((mode & ApplyToCoreLayers) && mapping->scrollingLayer())
1237 f(mapping->scrollingLayer());
1238 if ((mode & ApplyToCoreLayers) && mapping->scrollingBlockSelectionLayer())
1239 f(mapping->scrollingBlockSelectionLayer());
1240 if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping ->scrollingContentsLayer())
1241 f(mapping->scrollingContentsLayer());
1242 if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping ->foregroundLayer()) 1013 if (((mode & ApplyToCoreLayers) || (mode & ApplyToContentLayers)) && mapping ->foregroundLayer())
1243 f(mapping->foregroundLayer()); 1014 f(mapping->foregroundLayer());
1244 1015
1245 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer()) 1016 if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer())
1246 f(mapping->squashingLayer()); 1017 f(mapping->squashingLayer());
1247 1018
1248 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping ->maskLayer()) 1019 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping ->maskLayer())
1249 f(mapping->maskLayer()); 1020 f(mapping->maskLayer());
1250 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping ->childClippingMaskLayer()) 1021 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping ->childClippingMaskLayer())
1251 f(mapping->childClippingMaskLayer()); 1022 f(mapping->childClippingMaskLayer());
1252 1023
1253 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers)) && ma pping->backgroundLayer()) 1024 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers)) && ma pping->backgroundLayer())
1254 f(mapping->backgroundLayer()); 1025 f(mapping->backgroundLayer());
1255
1256 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar( ))
1257 f(mapping->layerForHorizontalScrollbar());
1258 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar())
1259 f(mapping->layerForVerticalScrollbar());
1260 } 1026 }
1261 1027
1262 struct UpdateRenderingContextFunctor { 1028 struct UpdateRenderingContextFunctor {
1263 void operator() (GraphicsLayer* layer) const { layer->setRenderingContext(re nderingContext); } 1029 void operator() (GraphicsLayer* layer) const { layer->setRenderingContext(re nderingContext); }
1264 int renderingContext; 1030 int renderingContext;
1265 }; 1031 };
1266 1032
1267 void CompositedLayerMapping::updateRenderingContext() 1033 void CompositedLayerMapping::updateRenderingContext()
1268 { 1034 {
1269 // All layers but the squashing layer (which contains 'alien' content) shoul d be included in this 1035 // All layers but the squashing layer (which contains 'alien' content) shoul d be included in this
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 ApplyToGraphicsLayers(this, functor, mode); 1068 ApplyToGraphicsLayers(this, functor, mode);
1303 1069
1304 // Note, if we apply perspective, we have to set should flatten differently 1070 // Note, if we apply perspective, we have to set should flatten differently
1305 // so that the transform propagates to child layers correctly. 1071 // so that the transform propagates to child layers correctly.
1306 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) { 1072 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) {
1307 bool hasPerspective = false; 1073 bool hasPerspective = false;
1308 if (RenderStyle* style = m_owningLayer.renderer()->style()) 1074 if (RenderStyle* style = m_owningLayer.renderer()->style())
1309 hasPerspective = style->hasPerspective(); 1075 hasPerspective = style->hasPerspective();
1310 if (hasPerspective) 1076 if (hasPerspective)
1311 childTransformLayer->setShouldFlattenTransform(false); 1077 childTransformLayer->setShouldFlattenTransform(false);
1312
1313 // Note, if the target is the scrolling layer, we need to ensure that th e
1314 // scrolling content layer doesn't flatten the transform. (It would be n ice
1315 // if we could apply transform to the scrolling content layer, but that' s
1316 // too late, we need the children transform to be applied _before_ the
1317 // scrolling offset.)
1318 if (childTransformLayer == m_scrollingLayer.get()) {
1319 m_scrollingContentsLayer->setShouldFlattenTransform(false);
1320 m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false);
1321 }
1322 } 1078 }
1323 } 1079 }
1324 1080
1325 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer) 1081 bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
1326 { 1082 {
1327 bool layerChanged = false; 1083 bool layerChanged = false;
1328 if (needsForegroundLayer) { 1084 if (needsForegroundLayer) {
1329 if (!m_foregroundLayer) { 1085 if (!m_foregroundLayer) {
1330 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); 1086 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground);
1331 m_foregroundLayer->setDrawsContent(true); 1087 m_foregroundLayer->setDrawsContent(true);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildCl ippingMask); 1157 m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildCl ippingMask);
1402 layerChanged = true; 1158 layerChanged = true;
1403 } 1159 }
1404 } else if (m_childClippingMaskLayer) { 1160 } else if (m_childClippingMaskLayer) {
1405 m_childClippingMaskLayer = nullptr; 1161 m_childClippingMaskLayer = nullptr;
1406 layerChanged = true; 1162 layerChanged = true;
1407 } 1163 }
1408 return layerChanged; 1164 return layerChanged;
1409 } 1165 }
1410 1166
1411 bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers)
1412 {
1413 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer);
1414
1415 bool layerChanged = false;
1416 if (needsScrollingLayers) {
1417 if (!m_scrollingLayer) {
1418 // Outer layer which corresponds with the scroll view.
1419 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer);
1420 m_scrollingLayer->setDrawsContent(false);
1421 m_scrollingLayer->setMasksToBounds(true);
1422
1423 // Inner layer which renders the content that scrolls.
1424 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents);
1425 m_scrollingContentsLayer->setDrawsContent(true);
1426 m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
1427
1428 m_scrollingBlockSelectionLayer = createGraphicsLayer(CompositingReas onLayerForScrollingBlockSelection);
1429 m_scrollingBlockSelectionLayer->setDrawsContent(true);
1430 m_scrollingContentsLayer->addChild(m_scrollingBlockSelectionLayer.ge t());
1431
1432 layerChanged = true;
1433 if (scrollingCoordinator)
1434 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.scrollableArea());
1435 }
1436 } else if (m_scrollingLayer) {
1437 m_scrollingLayer = nullptr;
1438 m_scrollingContentsLayer = nullptr;
1439 m_scrollingBlockSelectionLayer = nullptr;
1440 layerChanged = true;
1441 if (scrollingCoordinator)
1442 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.scrollableArea());
1443 }
1444
1445 return layerChanged;
1446 }
1447
1448 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, RenderLayer* scrollParent, ScrollingCoordinator* scrollingCoor dinator)
1449 {
1450 if (!layer)
1451 return;
1452
1453 // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
1454 if (layer != topmostLayer)
1455 scrollParent = 0;
1456
1457 scrollingCoordinator->updateScrollParentForGraphicsLayer(layer, scrollParent );
1458 }
1459
1460 void CompositedLayerMapping::updateScrollParent(RenderLayer* scrollParent)
1461 {
1462 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1463 GraphicsLayer* topmostLayer = childForSuperlayers();
1464 updateScrollParentForGraphicsLayer(m_squashingContainmentLayer.get(), to pmostLayer, scrollParent, scrollingCoordinator);
1465 updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmos tLayer, scrollParent, scrollingCoordinator);
1466 updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
1467 }
1468 }
1469
1470 void CompositedLayerMapping::updateClipParent() 1167 void CompositedLayerMapping::updateClipParent()
1471 { 1168 {
1472 if (owningLayerClippedByLayerNotAboveCompositedAncestor()) 1169 if (owningLayerClippedByLayerNotAboveCompositedAncestor())
1473 return; 1170 return;
1474 1171
1475 RenderLayer* clipParent = m_owningLayer.clipParent(); 1172 RenderLayer* clipParent = m_owningLayer.clipParent();
1476 if (clipParent) 1173 if (clipParent)
1477 clipParent = clipParent->enclosingLayerWithCompositedLayerMapping(Includ eSelf); 1174 clipParent = clipParent->enclosingLayerWithCompositedLayerMapping(Includ eSelf);
1478
1479 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer))
1480 scrollingCoordinator->updateClipParentForGraphicsLayer(m_graphicsLayer.g et(), clipParent);
1481 } 1175 }
1482 1176
1483 bool CompositedLayerMapping::updateSquashingLayers(bool needsSquashingLayers) 1177 bool CompositedLayerMapping::updateSquashingLayers(bool needsSquashingLayers)
1484 { 1178 {
1485 bool layersChanged = false; 1179 bool layersChanged = false;
1486 1180
1487 if (needsSquashingLayers) { 1181 if (needsSquashingLayers) {
1488 ASSERT(compositor()->layerSquashingEnabled()); 1182 ASSERT(compositor()->layerSquashingEnabled());
1489 1183
1490 if (!m_squashingLayer) { 1184 if (!m_squashingLayer) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 GraphicsLayerPaintingPhase CompositedLayerMapping::paintingPhaseForPrimaryLayer( ) const 1222 GraphicsLayerPaintingPhase CompositedLayerMapping::paintingPhaseForPrimaryLayer( ) const
1529 { 1223 {
1530 unsigned phase = 0; 1224 unsigned phase = 0;
1531 if (!m_backgroundLayer) 1225 if (!m_backgroundLayer)
1532 phase |= GraphicsLayerPaintBackground; 1226 phase |= GraphicsLayerPaintBackground;
1533 if (!m_foregroundLayer) 1227 if (!m_foregroundLayer)
1534 phase |= GraphicsLayerPaintForeground; 1228 phase |= GraphicsLayerPaintForeground;
1535 if (!m_maskLayer) 1229 if (!m_maskLayer)
1536 phase |= GraphicsLayerPaintMask; 1230 phase |= GraphicsLayerPaintMask;
1537 1231
1538 if (m_scrollingContentsLayer) {
1539 phase &= ~GraphicsLayerPaintForeground;
1540 phase |= GraphicsLayerPaintCompositedScroll;
1541 }
1542
1543 return static_cast<GraphicsLayerPaintingPhase>(phase); 1232 return static_cast<GraphicsLayerPaintingPhase>(phase);
1544 } 1233 }
1545 1234
1546 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const 1235 float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const
1547 { 1236 {
1548 float finalOpacity = rendererOpacity; 1237 float finalOpacity = rendererOpacity;
1549 1238
1550 for (RenderLayer* curr = m_owningLayer.parent(); curr; curr = curr->parent() ) { 1239 for (RenderLayer* curr = m_owningLayer.parent(); curr; curr = curr->parent() ) {
1551 // We only care about parents that are stacking contexts. 1240 // We only care about parents that are stacking contexts.
1552 // Recall that opacity creates stacking context. 1241 // Recall that opacity creates stacking context.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 { 1426 {
1738 GraphicsLayer* host = m_overflowControlsClippingLayer.get(); 1427 GraphicsLayer* host = m_overflowControlsClippingLayer.get();
1739 if (!host) 1428 if (!host)
1740 host = m_overflowControlsHostLayer.get(); 1429 host = m_overflowControlsHostLayer.get();
1741 host->removeFromParent(); 1430 host->removeFromParent();
1742 return host; 1431 return host;
1743 } 1432 }
1744 1433
1745 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const 1434 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const
1746 { 1435 {
1747 if (m_scrollingBlockSelectionLayer)
1748 return m_scrollingBlockSelectionLayer.get();
1749
1750 if (m_scrollingContentsLayer)
1751 return m_scrollingContentsLayer.get();
1752
1753 if (m_childContainmentLayer) 1436 if (m_childContainmentLayer)
1754 return m_childContainmentLayer.get(); 1437 return m_childContainmentLayer.get();
1755 1438
1756 if (m_childTransformLayer) 1439 if (m_childTransformLayer)
1757 return m_childTransformLayer.get(); 1440 return m_childTransformLayer.get();
1758 1441
1759 return m_graphicsLayer.get(); 1442 return m_graphicsLayer.get();
1760 } 1443 }
1761 1444
1762 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const 1445 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const
1763 { 1446 {
1764 if (m_squashingContainmentLayer) 1447 if (m_squashingContainmentLayer)
1765 return m_squashingContainmentLayer.get(); 1448 return m_squashingContainmentLayer.get();
1766 1449
1767 if (m_ancestorClippingLayer) 1450 if (m_ancestorClippingLayer)
1768 return m_ancestorClippingLayer.get(); 1451 return m_ancestorClippingLayer.get();
1769 1452
1770 return m_graphicsLayer.get(); 1453 return m_graphicsLayer.get();
1771 } 1454 }
1772 1455
1773 GraphicsLayer* CompositedLayerMapping::layerForChildrenTransform() const 1456 GraphicsLayer* CompositedLayerMapping::layerForChildrenTransform() const
1774 { 1457 {
1775 if (GraphicsLayer* clipLayer = clippingLayer()) 1458 if (GraphicsLayer* clipLayer = clippingLayer())
1776 return clipLayer; 1459 return clipLayer;
1777 if (m_scrollingLayer)
1778 return m_scrollingLayer.get();
1779 return m_childTransformLayer.get(); 1460 return m_childTransformLayer.get();
1780 } 1461 }
1781 1462
1782 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForAncestorReasons(con st RenderLayer* compositingAncestorLayer) 1463 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForAncestorReasons(con st RenderLayer* compositingAncestorLayer)
1783 { 1464 {
1784 unsigned previousRequiresOwnBackingStoreForAncestorReasons = m_requiresOwnBa ckingStoreForAncestorReasons; 1465 unsigned previousRequiresOwnBackingStoreForAncestorReasons = m_requiresOwnBa ckingStoreForAncestorReasons;
1785 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor(); 1466 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor();
1786 bool canPaintIntoAncestor = compositingAncestorLayer 1467 bool canPaintIntoAncestor = compositingAncestorLayer
1787 && (compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLaye r()->drawsContent() 1468 && (compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLaye r()->drawsContent()
1788 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom positedAncestor()); 1469 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom positedAncestor());
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintLayerFlags ); 1652 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintLayerFlags );
1972 context->restore(); 1653 context->restore();
1973 } 1654 }
1974 1655
1975 ASSERT(!paintInfo.renderLayer->usedTransparency()); 1656 ASSERT(!paintInfo.renderLayer->usedTransparency());
1976 1657
1977 // Manually restore the context to its original state by applying the opposi te translation. 1658 // Manually restore the context to its original state by applying the opposi te translation.
1978 context->translate(offset.width(), offset.height()); 1659 context->translate(offset.width(), offset.height());
1979 } 1660 }
1980 1661
1981 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
1982 {
1983 if (!scrollbar)
1984 return;
1985
1986 context.save();
1987 const IntRect& scrollbarRect = scrollbar->frameRect();
1988 context.translate(-scrollbarRect.x(), -scrollbarRect.y());
1989 IntRect transformedClip = clip;
1990 transformedClip.moveBy(scrollbarRect.location());
1991 scrollbar->paint(&context, transformedClip);
1992 context.restore();
1993 }
1994
1995 // Up-call from compositing layer drawing callback. 1662 // Up-call from compositing layer drawing callback.
1996 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect& clip) 1663 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect& clip)
1997 { 1664 {
1998 // https://code.google.com/p/chromium/issues/detail?id=343772 1665 // https://code.google.com/p/chromium/issues/detail?id=343772
1999 DisableCompositingQueryAsserts disabler; 1666 DisableCompositingQueryAsserts disabler;
2000 #if ENABLE(ASSERT) 1667 #if ENABLE(ASSERT)
2001 // FIXME: once the state machine is ready, this can be removed and we can re fer to that instead. 1668 // FIXME: once the state machine is ready, this can be removed and we can re fer to that instead.
2002 if (Page* page = renderer()->frame()->page()) 1669 if (Page* page = renderer()->frame()->page())
2003 page->setIsPainting(true); 1670 page->setIsPainting(true);
2004 #endif 1671 #endif
2005 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data" , InspectorPaintEvent::data(m_owningLayer.renderer(), clip, graphicsLayer)); 1672 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data" , InspectorPaintEvent::data(m_owningLayer.renderer(), clip, graphicsLayer));
2006 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack()); 1673 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
2007 1674
2008 PaintLayerFlags paintLayerFlags = 0; 1675 PaintLayerFlags paintLayerFlags = 0;
2009 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) 1676 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground)
2010 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; 1677 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase;
2011 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) 1678 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground)
2012 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; 1679 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase;
2013 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) 1680 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask)
2014 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; 1681 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase;
2015 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) 1682 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask)
2016 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; 1683 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase;
2017 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) 1684 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents)
2018 paintLayerFlags |= PaintLayerPaintingOverflowContents; 1685 paintLayerFlags |= PaintLayerPaintingOverflowContents;
2019 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll)
2020 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase;
2021 1686
2022 if (graphicsLayer == m_backgroundLayer) 1687 if (graphicsLayer == m_backgroundLayer)
2023 paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPai ntingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroun dPhase to walk child layers. 1688 paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPai ntingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroun dPhase to walk child layers.
2024 else if (compositor()->fixedRootBackgroundLayer()) 1689 else if (compositor()->fixedRootBackgroundLayer())
2025 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; 1690 paintLayerFlags |= PaintLayerPaintingSkipRootBackground;
2026 1691
2027 if (graphicsLayer == m_graphicsLayer.get() 1692 if (graphicsLayer == m_graphicsLayer.get()
2028 || graphicsLayer == m_foregroundLayer.get() 1693 || graphicsLayer == m_foregroundLayer.get()
2029 || graphicsLayer == m_backgroundLayer.get() 1694 || graphicsLayer == m_backgroundLayer.get()
2030 || graphicsLayer == m_maskLayer.get() 1695 || graphicsLayer == m_maskLayer.get()
2031 || graphicsLayer == m_childClippingMaskLayer.get() 1696 || graphicsLayer == m_childClippingMaskLayer.get()) {
2032 || graphicsLayer == m_scrollingContentsLayer.get()
2033 || graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2034 1697
2035 GraphicsLayerPaintInfo paintInfo; 1698 GraphicsLayerPaintInfo paintInfo;
2036 paintInfo.renderLayer = &m_owningLayer; 1699 paintInfo.renderLayer = &m_owningLayer;
2037 paintInfo.compositedBounds = compositedBounds(); 1700 paintInfo.compositedBounds = compositedBounds();
2038 paintInfo.offsetFromRenderer = graphicsLayer->offsetFromRenderer(); 1701 paintInfo.offsetFromRenderer = graphicsLayer->offsetFromRenderer();
2039 1702
2040 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. 1703 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
2041 doPaintTask(paintInfo, paintLayerFlags, &context, clip); 1704 doPaintTask(paintInfo, paintLayerFlags, &context, clip);
2042 } else if (graphicsLayer == m_squashingLayer.get()) { 1705 } else if (graphicsLayer == m_squashingLayer.get()) {
2043 ASSERT(compositor()->layerSquashingEnabled()); 1706 ASSERT(compositor()->layerSquashingEnabled());
2044 for (size_t i = 0; i < m_squashedLayers.size(); ++i) 1707 for (size_t i = 0; i < m_squashedLayers.size(); ++i)
2045 doPaintTask(m_squashedLayers[i], paintLayerFlags, &context, clip); 1708 doPaintTask(m_squashedLayers[i], paintLayerFlags, &context, clip);
2046 } else if (graphicsLayer == layerForHorizontalScrollbar()) {
2047 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co ntext, clip);
2048 } else if (graphicsLayer == layerForVerticalScrollbar()) {
2049 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont ext, clip);
2050 } 1709 }
2051 #if ENABLE(ASSERT) 1710 #if ENABLE(ASSERT)
2052 if (Page* page = renderer()->frame()->page()) 1711 if (Page* page = renderer()->frame()->page())
2053 page->setIsPainting(false); 1712 page->setIsPainting(false);
2054 #endif 1713 #endif
2055 } 1714 }
2056 1715
2057 bool CompositedLayerMapping::isTrackingPaintInvalidations() const 1716 bool CompositedLayerMapping::isTrackingPaintInvalidations() const
2058 { 1717 {
2059 GraphicsLayerClient* client = compositor(); 1718 GraphicsLayerClient* client = compositor();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 } else if (graphicsLayer == m_backgroundLayer.get()) { 1807 } else if (graphicsLayer == m_backgroundLayer.get()) {
2149 name = m_owningLayer.debugName() + " (background) Layer"; 1808 name = m_owningLayer.debugName() + " (background) Layer";
2150 } else if (graphicsLayer == m_childContainmentLayer.get()) { 1809 } else if (graphicsLayer == m_childContainmentLayer.get()) {
2151 name = "Child Containment Layer"; 1810 name = "Child Containment Layer";
2152 } else if (graphicsLayer == m_childTransformLayer.get()) { 1811 } else if (graphicsLayer == m_childTransformLayer.get()) {
2153 name = "Child Transform Layer"; 1812 name = "Child Transform Layer";
2154 } else if (graphicsLayer == m_maskLayer.get()) { 1813 } else if (graphicsLayer == m_maskLayer.get()) {
2155 name = "Mask Layer"; 1814 name = "Mask Layer";
2156 } else if (graphicsLayer == m_childClippingMaskLayer.get()) { 1815 } else if (graphicsLayer == m_childClippingMaskLayer.get()) {
2157 name = "Child Clipping Mask Layer"; 1816 name = "Child Clipping Mask Layer";
2158 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
2159 name = "Horizontal Scrollbar Layer";
2160 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
2161 name = "Vertical Scrollbar Layer";
2162 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { 1817 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
2163 name = "Overflow Controls Host Layer"; 1818 name = "Overflow Controls Host Layer";
2164 } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) { 1819 } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) {
2165 name = "Overflow Controls ClipLayer Layer"; 1820 name = "Overflow Controls ClipLayer Layer";
2166 } else if (graphicsLayer == m_scrollingLayer.get()) {
2167 name = "Scrolling Layer";
2168 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2169 name = "Scrolling Contents Layer";
2170 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2171 name = "Scrolling Block Selection Layer";
2172 } else { 1821 } else {
2173 ASSERT_NOT_REACHED(); 1822 ASSERT_NOT_REACHED();
2174 } 1823 }
2175 1824
2176 return name; 1825 return name;
2177 } 1826 }
2178 1827
2179 } // namespace blink 1828 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698