Changeset 126663 in webkit
- Timestamp:
- Aug 24, 2012 5:35:34 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 34 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/platform/chromium/TestExpectations
r126655 r126663 3440 3440 BUGWK94261 DEBUG : http/tests/inspector/indexeddb/resources-panel.html = PASS CRASH TIMEOUT 3441 3441 3442 // ENABLE_OVERFLOW_SCROLLING is not currently enabled in Chromium. 3443 BUGWK94353 : compositing/overflow/overflow-clip-with-accelerated-scrolling-ancestor.html = TEXT 3444 BUGWK94353 : compositing/overflow/scrolling-content-clip-to-viewport.html = TEXT 3445 BUGWK94353 : compositing/overflow/textarea-scroll-touch.html = TEXT 3446 BUGWK94353 : compositing/overflow/nested-scrolling.html = IMAGE+TEXT 3447 BUGWK94353 : compositing/overflow/overflow-auto-with-touch.html = TEXT 3448 BUGWK94353 : compositing/overflow/overflow-overlay-with-touch.html = TEXT 3449 3442 3450 // Needs a rebaseline. 3443 3451 BUGWK40272 : svg/css/circle-in-mask-with-shadow.svg = IMAGE -
trunk/Source/WebCore/ChangeLog
r126657 r126663 1 2012-08-24 Sami Kyostila <skyostil@chromium.org> 2 3 Add support for compositing the contents of overflow:scroll areas 4 https://bugs.webkit.org/show_bug.cgi?id=91117 5 6 Reviewed by Simon Fraser. 7 8 Patch by Simon Fraser with modifications by Sami Kyostila and Ian Vollick. 9 10 Allow a RenderLayer which exists for overflow scrolling 11 to use a composited layer for the scrolled contents, which 12 allows for compositing-accelerated overflow scrolling. 13 14 Tests: 15 compositing/overflow/clipping-ancestor-with-accelerated-scrolling-ancestor.html 16 compositing/overflow/iframe-inside-overflow-clipping.html 17 compositing/overflow/nested-scrolling.html 18 compositing/overflow/overflow-auto-with-touch-no-overflow.html 19 compositing/overflow/overflow-auto-with-touch.html 20 compositing/overflow/overflow-clip-with-accelerated-scrolling-ancestor.html 21 compositing/overflow/overflow-hidden-with-touch.html 22 compositing/overflow/overflow-overlay-with-touch-no-overflow.html 23 compositing/overflow/overflow-overlay-with-touch.html 24 compositing/overflow/overflow-scroll-with-touch-no-overflow.html 25 compositing/overflow/overflow-visible-with-touch.html 26 compositing/overflow/remove-overflow-crash.html 27 compositing/overflow/remove-overflow-crash2.html 28 compositing/overflow/scrolling-content-clip-to-viewport.html 29 compositing/overflow/textarea-scroll-touch.html 30 31 * platform/graphics/GraphicsLayerClient.h: New paint phase flag 32 used for scrolled contents. Provide a typedef for the flags 33 so that they can be ORed together. 34 35 * rendering/RenderLayer.h: 36 (WebCore::ClipRectsCache::ClipRectsCache): 37 (ClipRectsCache): In debug builds, store a m_respectingOverflowClip 38 flag so we can ASSERT later that we're fetching clip rects with the 39 same setting the rects were generated with. 40 Add new PaintLayerPaintingOverflowContents painting flag. 41 42 * rendering/RenderLayer.cpp: 43 (WebCore::RenderLayer::usesCompositedScrolling): New method returns 44 true if this layer is using composited overflow scrolling. 45 (WebCore::RenderLayer::scrollTo): Don't repaint if we're doing 46 a composited scroll. 47 (WebCore::RenderLayer::paintLayer): Pass the right flags to backgroundClipRect(); 48 if we're painting scrolled contents, we don't want to take the overflow clip rect 49 into account. 50 (WebCore::RenderLayer::paintLayerContents): Ditto. Also don't do the intersectsDamageRect() 51 check if we're painting scrolled contents. 52 (WebCore::RenderLayer::updateClipRects): New parameter to tell whether to respect overflow clipping. 53 Assert if we're fetching cached rects with a different 'respect clip' flag to the one they were generated 54 with. 55 (WebCore::RenderLayer::calculateClipRects): Take the 'respectOverflowClip' flag into account 56 when computing clip rects. 57 (WebCore::RenderLayer::parentClipRects): Ditto 58 (WebCore::RenderLayer::backgroundClipRect): Ditto 59 (WebCore::RenderLayer::calculateRects): Ditto 60 (WebCore::RenderLayer::childrenClipRect): This function is called from widget code, so may use a different 61 'respect clip rects' setting than that used for painting, so it has to compute clip rects on the fly. 62 (WebCore::RenderLayer::shouldBeNormalFlowOnly): Composited scrolling makes a layer not normal-flow only. 63 64 * rendering/RenderLayerBacking.h: 65 (RenderLayerBacking): New member variables for the layers for scrolled contents, and the scrolling 66 layer which handles the scroll offset. 67 (WebCore::RenderLayerBacking::hasScrollingLayer): 68 (WebCore::RenderLayerBacking::scrollingLayer): 69 (WebCore::RenderLayerBacking::scrollingContentsLayer): 70 71 * rendering/RenderLayerBacking.cpp: 72 (WebCore::RenderLayerBacking::~RenderLayerBacking): 73 (WebCore::RenderLayerBacking::destroyGraphicsLayers): Tear down the scrolling layers, if any. 74 (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling): Renamed from layerOrAncestorIsTransformed, 75 since it has to look for composited scrolling layers too. 76 (WebCore::RenderLayerBacking::shouldClipCompositedBounds): We don't want the contents of scrolling layers 77 to get clipped to the viewport. 78 (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Create scrolling layers if necessary. 79 (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Set scrolling layer geometry. 80 (WebCore::RenderLayerBacking::updateInternalHierarchy): Hook up scrolling layers. 81 (WebCore::RenderLayerBacking::updateDrawsContent): Scrolling layers affect whether the main graphics layer 82 needs to draw content. 83 (WebCore::RenderLayerBacking::updateScrollingLayers): Create or destroy scrolling layers. 84 (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer): If we have a scrolled contents layer, 85 the main layer should not paint the foreground. 86 (WebCore::RenderLayerBacking::parentForSublayers): Sublayers are parented in the scrolling contents 87 layer if one exists. 88 (WebCore::RenderLayerBacking::setContentsNeedDisplay): Need to dirty the scrolling contents layer. 89 (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): Ditto. 90 (WebCore::RenderLayerBacking::paintIntoLayer): Set the right painting flags. 91 (WebCore::RenderLayerBacking::paintContents): Only clip to the bounds if we're not painting overflow contents. 92 1 93 2012-08-24 Florin Malita <fmalita@chromium.org> 2 94 -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp
r123999 r126663 81 81 , m_appliesPageScale(false) 82 82 , m_usingTileCache(false) 83 , m_paintingPhase(GraphicsLayerPaintAll )83 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) 84 84 , m_contentsOrientation(CompositingCoordinatesTopDown) 85 85 , m_parent(0) -
trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h
r124550 r126663 37 37 class FloatPoint; 38 38 39 enum GraphicsLayerPaintingPhase {39 enum GraphicsLayerPaintingPhaseFlags { 40 40 GraphicsLayerPaintBackground = (1 << 0), 41 41 GraphicsLayerPaintForeground = (1 << 1), 42 42 GraphicsLayerPaintMask = (1 << 2), 43 GraphicsLayerPaintAll = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask) 43 GraphicsLayerPaintOverflowContents = (1 << 3), 44 GraphicsLayerPaintAllWithOverflowClip = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask) 44 45 }; 46 typedef unsigned GraphicsLayerPaintingPhase; 45 47 46 48 enum AnimatedPropertyID { -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r126520 r126663 1553 1553 } 1554 1554 1555 bool RenderLayer::usesCompositedScrolling() const 1556 { 1557 #if USE(ACCELERATED_COMPOSITING) 1558 if (!scrollsOverflow() || !allowsScrolling()) 1559 return false; 1560 1561 #if ENABLE(OVERFLOW_SCROLLING) 1562 return renderer()->style()->useTouchOverflowScrolling(); 1563 #else 1564 return false; 1565 #endif 1566 #else 1567 return false; 1568 #endif 1569 } 1570 1555 1571 static inline int adjustedScrollDelta(int beginningDelta) { 1556 1572 // This implemention matches Firefox's. … … 1704 1720 1705 1721 // Just schedule a full repaint of our object. 1706 if (view )1722 if (view && !usesCompositedScrolling()) 1707 1723 renderer()->repaintUsingContainer(repaintContainer, m_repaintRect); 1708 1724 … … 3010 3026 ClipRect clipRect = paintDirtyRect; 3011 3027 if (parent()) { 3012 clipRect = backgroundClipRect(rootLayer, region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects); 3028 clipRect = backgroundClipRect(rootLayer, region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, 3029 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip); 3013 3030 clipRect.intersect(paintDirtyRect); 3014 3031 … … 3126 3143 3127 3144 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 3128 calculateRects(rootLayer, region, (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); 3145 calculateRects(rootLayer, region, (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, 3146 IgnoreOverlayScrollbarSize, localPaintFlags & PaintLayerPaintingOverflowContents ? IgnoreOverflowClip : RespectOverflowClip); 3129 3147 paintOffset = toPoint(layerBounds.location() - renderBoxLocation() + subPixelAccumulation); 3130 3148 } … … 3145 3163 3146 3164 // We want to paint our layer, but only if we intersect the damage rect. 3147 shouldPaintContent &= intersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); 3165 if (this != rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) 3166 shouldPaintContent &= intersectsDamageRect(layerBounds, damageRect.rect(), rootLayer); 3148 3167 3149 3168 if (localPaintFlags & PaintLayerPaintingCompositingBackgroundPhase) { … … 3892 3911 } 3893 3912 3894 void RenderLayer::updateClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy relevancy )3913 void RenderLayer::updateClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy relevancy, ShouldRespectOverflowClip respectOverflowClip) 3895 3914 { 3896 3915 ASSERT(clipRectsType < NumCachedClipRectsTypes); 3897 3916 if (m_clipRectsCache && m_clipRectsCache->m_clipRects[clipRectsType]) { 3898 3917 ASSERT(rootLayer == m_clipRectsCache->m_clipRectsRoot[clipRectsType]); 3918 ASSERT(m_clipRectsCache->m_respectingOverflowClip[clipRectsType] == (respectOverflowClip == RespectOverflowClip)); 3899 3919 return; // We have the correct cached value. 3900 3920 } … … 3904 3924 RenderLayer* parentLayer = rootLayer != this ? parent() : 0; 3905 3925 if (parentLayer) 3906 parentLayer->updateClipRects(rootLayer, region, clipRectsType, relevancy );3926 parentLayer->updateClipRects(rootLayer, region, clipRectsType, relevancy, respectOverflowClip); 3907 3927 3908 3928 ClipRects clipRects; 3909 calculateClipRects(rootLayer, region, clipRectsType, clipRects, relevancy );3929 calculateClipRects(rootLayer, region, clipRectsType, clipRects, relevancy, respectOverflowClip); 3910 3930 3911 3931 if (!m_clipRectsCache) … … 3919 3939 #ifndef NDEBUG 3920 3940 m_clipRectsCache->m_clipRectsRoot[clipRectsType] = rootLayer; 3921 #endif 3922 } 3923 3924 void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, ClipRects& clipRects, OverlayScrollbarSizeRelevancy relevancy) const 3941 m_clipRectsCache->m_respectingOverflowClip[clipRectsType] = respectOverflowClip == RespectOverflowClip; 3942 #endif 3943 } 3944 3945 void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, ClipRects& clipRects, OverlayScrollbarSizeRelevancy relevancy, ShouldRespectOverflowClip respectOverflowClip) const 3925 3946 { 3926 3947 if (!parent()) { … … 3941 3962 clipRects = *parentLayer->clipRects(clipRectsType); 3942 3963 else 3943 parentLayer->calculateClipRects(rootLayer, region, clipRectsType, clipRects );3964 parentLayer->calculateClipRects(rootLayer, region, clipRectsType, clipRects, IgnoreOverlayScrollbarSize, respectOverflowClip); 3944 3965 } else 3945 3966 clipRects.reset(PaintInfo::infiniteRect()); … … 3957 3978 3958 3979 // Update the clip rects that will be passed to child layers. 3959 if ( renderer()->hasClipOrOverflowClip()) {3980 if ((renderer()->hasOverflowClip() && (respectOverflowClip == RespectOverflowClip || this != rootLayer)) || renderer()->hasClip()) { 3960 3981 // This layer establishes a clip of some kind. 3961 3982 … … 3988 4009 } 3989 4010 3990 void RenderLayer::parentClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, ClipRects& clipRects, OverlayScrollbarSizeRelevancy relevancy ) const4011 void RenderLayer::parentClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, ClipRects& clipRects, OverlayScrollbarSizeRelevancy relevancy, ShouldRespectOverflowClip respectOverflowClip) const 3991 4012 { 3992 4013 ASSERT(parent()); 3993 4014 if (clipRectsType == TemporaryClipRects) { 3994 parent()->calculateClipRects(rootLayer, region, clipRectsType, clipRects, relevancy );3995 return; 3996 } 3997 3998 parent()->updateClipRects(rootLayer, region, clipRectsType, relevancy );4015 parent()->calculateClipRects(rootLayer, region, clipRectsType, clipRects, relevancy, respectOverflowClip); 4016 return; 4017 } 4018 4019 parent()->updateClipRects(rootLayer, region, clipRectsType, relevancy, respectOverflowClip); 3999 4020 clipRects = *parent()->clipRects(clipRectsType); 4000 4021 } … … 4011 4032 } 4012 4033 4013 ClipRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy relevancy ) const4034 ClipRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy relevancy, ShouldRespectOverflowClip respectOverflowClip) const 4014 4035 { 4015 4036 ASSERT(parent()); 4016 4037 ClipRects parentRects; 4017 parentClipRects(rootLayer, region, clipRectsType, parentRects, relevancy );4038 parentClipRects(rootLayer, region, clipRectsType, parentRects, relevancy, respectOverflowClip); 4018 4039 ClipRect backgroundClipRect = backgroundClipRectForPosition(parentRects, renderer()->style()->position()); 4019 4040 RenderView* view = renderer()->view(); … … 4028 4049 4029 4050 void RenderLayer::calculateRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, 4030 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, OverlayScrollbarSizeRelevancy relevancy ) const4051 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, OverlayScrollbarSizeRelevancy relevancy, ShouldRespectOverflowClip respectOverflowClip) const 4031 4052 { 4032 4053 if (rootLayer != this && parent()) { 4033 backgroundRect = backgroundClipRect(rootLayer, region, clipRectsType, relevancy );4054 backgroundRect = backgroundClipRect(rootLayer, region, clipRectsType, relevancy, respectOverflowClip); 4034 4055 backgroundRect.intersect(paintDirtyRect); 4035 4056 } else … … 4046 4067 if (renderer()->hasClipOrOverflowClip()) { 4047 4068 // This layer establishes a clip of some kind. 4048 if (renderer()->hasOverflowClip() ) {4069 if (renderer()->hasOverflowClip() && (this != rootLayer || respectOverflowClip == RespectOverflowClip)) { 4049 4070 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset, region, relevancy)); 4050 4071 if (renderer()->style()->hasBorderRadius()) … … 4069 4090 renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // Layers are in physical coordinates, so the overflow has to be flipped. 4070 4091 layerBoundsWithVisualOverflow.moveBy(offset); 4071 backgroundRect.intersect(layerBoundsWithVisualOverflow); 4092 if (this != rootLayer || respectOverflowClip == RespectOverflowClip) 4093 backgroundRect.intersect(layerBoundsWithVisualOverflow); 4072 4094 } else { 4073 4095 // Shift the bounds to be for our region only. 4074 4096 LayoutRect bounds = renderBox()->borderBoxRectInRegion(region); 4075 4097 bounds.moveBy(offset); 4076 backgroundRect.intersect(bounds); 4098 if (this != rootLayer || respectOverflowClip == RespectOverflowClip) 4099 backgroundRect.intersect(bounds); 4077 4100 } 4078 4101 } … … 4087 4110 LayoutRect layerBounds; 4088 4111 ClipRect backgroundRect, foregroundRect, outlineRect; 4089 calculateRects(clippingRootLayer, 0, PaintingClipRects, renderView->unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); 4112 // Need to use temporary clip rects, because the value of 'dontClipToOverflow' may be different from the painting path (<rdar://problem/11844909>). 4113 calculateRects(clippingRootLayer, 0, TemporaryClipRects, renderView->unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); 4090 4114 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox(); 4091 4115 } … … 4784 4808 && !renderer()->hasFilter() 4785 4809 #endif 4786 && !isTransparent(); 4810 && !isTransparent() 4811 && !usesCompositedScrolling(); 4787 4812 } 4788 4813 -
trunk/Source/WebCore/rendering/RenderLayer.h
r126520 r126663 231 231 { 232 232 #ifndef NDEBUG 233 for (int i = 0; i < NumCachedClipRectsTypes; ++i) 233 for (int i = 0; i < NumCachedClipRectsTypes; ++i) { 234 234 m_clipRectsRoot[i] = 0; 235 m_respectingOverflowClip[i] = false; 236 } 235 237 #endif 236 238 } … … 239 241 #ifndef NDEBUG 240 242 const RenderLayer* m_clipRectsRoot[NumCachedClipRectsTypes]; 243 bool m_respectingOverflowClip[NumCachedClipRectsTypes]; 241 244 #endif 242 245 }; … … 361 364 362 365 void updateScrollInfoAfterLayout(); 366 bool usesCompositedScrolling() const; 363 367 364 368 bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1); … … 505 509 PaintLayerPaintingCompositingForegroundPhase = 1 << 6, 506 510 PaintLayerPaintingCompositingMaskPhase = 1 << 7, 511 PaintLayerPaintingOverflowContents = 1 << 8, 507 512 PaintLayerPaintingCompositingAllPhases = (PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase | PaintLayerPaintingCompositingMaskPhase) 508 513 }; … … 520 525 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot); 521 526 527 enum ShouldRespectOverflowClip { IgnoreOverflowClip, RespectOverflowClip }; 528 522 529 // This method figures out our layerBounds in coordinates relative to 523 530 // |rootLayer}. It also computes our background and foreground clip rects … … 525 532 void calculateRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, 526 533 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, 527 OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize ) const;534 OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const; 528 535 529 536 // Compute and cache clip rects computed with the given layer as the root 530 void updateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize );537 void updateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip); 531 538 // Compute and return the clip rects. If useCached is true, will used previously computed clip rects on ancestors 532 539 // (rather than computing them all from scratch up the parent chain). 533 void calculateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize ) const;540 void calculateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const; 534 541 535 542 ClipRects* clipRects(ClipRectsType type) const { ASSERT(type < NumCachedClipRectsTypes); return m_clipRectsCache ? m_clipRectsCache->m_clipRects[type].get() : 0; } … … 830 837 #endif 831 838 832 void parentClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize ) const;833 ClipRect backgroundClipRect(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize ) const;839 void parentClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const; 840 ClipRect backgroundClipRect(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip) const; 834 841 LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior); 835 842 -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r126105 r126663 139 139 updateForegroundLayer(false); 140 140 updateMaskLayer(false); 141 updateScrollingLayers(false); 141 142 destroyGraphicsLayers(); 142 143 } … … 219 220 m_containmentLayer = nullptr; 220 221 m_maskLayer = nullptr; 222 223 m_scrollingLayer = nullptr; 224 m_scrollingContentsLayer = nullptr; 221 225 } 222 226 … … 259 263 } 260 264 261 static bool layerOrAncestorIsTransformed (RenderLayer* layer)265 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer* layer) 262 266 { 263 267 for (RenderLayer* curr = layer; curr; curr = curr->parent()) { 264 if (curr->hasTransform() )268 if (curr->hasTransform() || curr->usesCompositedScrolling()) 265 269 return true; 266 270 } … … 281 285 return false; 282 286 283 if (layerOrAncestorIsTransformed (m_owningLayer))287 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer)) 284 288 return false; 285 289 … … 367 371 layerConfigChanged = true; 368 372 369 if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), compositor->clipsCompositingDescendants(m_owningLayer))) 373 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants(m_owningLayer); 374 375 // Our scrolling layer will clip. 376 if (m_owningLayer->usesCompositedScrolling()) 377 needsDescendentsClippingLayer = false; 378 379 if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), needsDescendentsClippingLayer)) 370 380 layerConfigChanged = true; 371 381 372 382 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer())) 383 layerConfigChanged = true; 384 385 if (updateScrollingLayers(m_owningLayer->usesCompositedScrolling())) 373 386 layerConfigChanged = true; 374 387 … … 521 534 else 522 535 graphicsLayerParentLocation = renderer()->view()->documentRect().location(); 536 537 if (compAncestor && compAncestor->usesCompositedScrolling()) { 538 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); 539 IntSize scrollOffset = compAncestor->scrolledContentOffset(); 540 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); 541 graphicsLayerParentLocation = scrollOrigin - scrollOffset; 542 } 523 543 524 544 if (compAncestor && m_ancestorClippingLayer) { … … 526 546 // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects 527 547 // for a compositing layer, rootLayer is the layer itself. 528 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundClipRect(compAncestor, 0, TemporaryClipRects ).rect()); // FIXME: Incorrect for CSS regions.548 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundClipRect(compAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, RenderLayer::IgnoreOverflowClip).rect()); // FIXME: Incorrect for CSS regions. 529 549 ASSERT(parentClipRect != PaintInfo::infiniteRect()); 530 550 m_ancestorClippingLayer->setPosition(FloatPoint() + (parentClipRect.location() - graphicsLayerParentLocation)); … … 634 654 } 635 655 656 if (m_scrollingLayer) { 657 ASSERT(m_scrollingContentsLayer); 658 RenderBox* renderBox = toRenderBox(renderer()); 659 IntRect paddingBox(renderBox->borderLeft(), renderBox->borderTop(), renderBox->width() - renderBox->borderLeft() - renderBox->borderRight(), renderBox->height() - renderBox->borderTop() - renderBox->borderBottom()); 660 IntSize scrollOffset = m_owningLayer->scrolledContentOffset(); 661 662 m_scrollingLayer->setPosition(FloatPoint() + (paddingBox.location() - localCompositingBounds.location())); 663 m_scrollingLayer->setSize(paddingBox.size()); 664 m_scrollingContentsLayer->setPosition(FloatPoint(-scrollOffset.width(), -scrollOffset.height())); 665 666 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer(); 667 m_scrollingLayer->setOffsetFromRenderer(IntPoint() - paddingBox.location()); 668 bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer(); 669 670 IntSize scrollSize(m_owningLayer->scrollWidth(), m_owningLayer->scrollHeight()); 671 if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged) 672 m_scrollingContentsLayer->setNeedsDisplay(); 673 674 m_scrollingContentsLayer->setSize(scrollSize); 675 // FIXME: Scrolling the content layer does not need to trigger a repaint. The offset will be compensated away during painting. 676 // FIXME: The paint offset and the scroll offset should really be separate concepts. 677 m_scrollingContentsLayer->setOffsetFromRenderer(paddingBox.location() - IntPoint() - scrollOffset); 678 } 679 636 680 m_graphicsLayer->setContentsRect(contentsBox()); 637 681 … … 658 702 } 659 703 704 if (m_scrollingLayer) { 705 GraphicsLayer* superlayer = m_containmentLayer ? m_containmentLayer.get() : m_graphicsLayer.get(); 706 m_scrollingLayer->removeFromParent(); 707 superlayer->addChild(m_scrollingLayer.get()); 708 } 709 660 710 // The clip for child layers does not include space for overflow controls, so they exist as 661 711 // siblings of the clipping layer if we have one. Normal children of this layer are set as … … 677 727 void RenderLayerBacking::updateDrawsContent() 678 728 { 729 if (m_scrollingLayer) { 730 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. 731 // m_graphicsLayer only needs backing store if the non-scrolling parts (background, outlines, borders, shadows etc) need to paint. 732 // m_scrollingLayer never has backing store. 733 // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint. 734 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && hasBoxDecorationsOrBackground(renderer()); 735 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); 736 737 bool hasScrollingPaintedContent = m_owningLayer->hasVisibleContent() && (renderer()->hasBackground() || paintsChildren()); 738 m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent); 739 return; 740 } 741 679 742 bool hasPaintedContent = containsPaintedContent(); 680 743 … … 827 890 } 828 891 892 bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers) 893 { 894 bool layerChanged = false; 895 if (needsScrollingLayers) { 896 if (!m_scrollingLayer) { 897 // Outer layer which corresponds with the scroll view. 898 m_scrollingLayer = createGraphicsLayer("Scrolling container"); 899 m_scrollingLayer->setDrawsContent(false); 900 m_scrollingLayer->setMasksToBounds(true); 901 902 // Inner layer which renders the content that scrolls. 903 m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents"); 904 m_scrollingContentsLayer->setDrawsContent(true); 905 m_scrollingContentsLayer->setPaintingPhase(GraphicsLayerPaintForeground | GraphicsLayerPaintOverflowContents); 906 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); 907 908 layerChanged = true; 909 } 910 } else if (m_scrollingLayer) { 911 m_scrollingLayer = nullptr; 912 m_scrollingContentsLayer = nullptr; 913 layerChanged = true; 914 } 915 916 if (layerChanged) { 917 updateInternalHierarchy(); 918 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); 919 m_graphicsLayer->setNeedsDisplay(); 920 } 921 922 return layerChanged; 923 } 924 829 925 GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const 830 926 { … … 834 930 if (!m_maskLayer) 835 931 phase |= GraphicsLayerPaintMask; 932 933 if (m_scrollingContentsLayer) 934 phase &= ~GraphicsLayerPaintForeground; 836 935 837 936 return static_cast<GraphicsLayerPaintingPhase>(phase); … … 1167 1266 } 1168 1267 1268 GraphicsLayer* RenderLayerBacking::parentForSublayers() const 1269 { 1270 if (m_scrollingContentsLayer) 1271 return m_scrollingContentsLayer.get(); 1272 1273 return m_containmentLayer ? m_containmentLayer.get() : m_graphicsLayer.get(); 1274 } 1275 1169 1276 bool RenderLayerBacking::paintsIntoWindow() const 1170 1277 { … … 1215 1322 if (m_maskLayer && m_maskLayer->drawsContent()) 1216 1323 m_maskLayer->setNeedsDisplay(); 1324 1325 if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) 1326 m_scrollingContentsLayer->setNeedsDisplay(); 1217 1327 } 1218 1328 … … 1238 1348 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer()); 1239 1349 m_maskLayer->setNeedsDisplayInRect(layerDirtyRect); 1350 } 1351 1352 if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) { 1353 IntRect layerDirtyRect = r; 1354 layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer()); 1355 m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect); 1240 1356 } 1241 1357 } … … 1260 1376 if (paintingPhase & GraphicsLayerPaintMask) 1261 1377 paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase; 1262 1378 if (paintingPhase & GraphicsLayerPaintOverflowContents) 1379 paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents; 1380 1263 1381 // FIXME: GraphicsLayers need a way to split for RenderRegions. 1264 1382 m_owningLayer->paintLayerContents(rootLayer, context, paintDirtyRect, LayoutSize(), paintBehavior, paintingRoot, 0, 0, paintFlags); … … 1291 1409 page->setIsPainting(true); 1292 1410 #endif 1293 if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundLayer.get() || graphicsLayer == m_maskLayer.get()) { 1411 1412 if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundLayer.get() || graphicsLayer == m_maskLayer.get() || graphicsLayer == m_scrollingContentsLayer.get()) { 1294 1413 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_owningLayer->renderer()->frame(), &context, clip); 1295 1414 1296 1415 // The dirtyRect is in the coords of the painting root. 1297 IntRect dirtyRect = compositedBounds(); 1298 dirtyRect.intersect(clip); 1416 IntRect dirtyRect = clip; 1417 if (!(paintingPhase & GraphicsLayerPaintOverflowContents)) 1418 dirtyRect.intersect(compositedBounds()); 1299 1419 1300 1420 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. … … 1638 1758 backingMemory += m_maskLayer->backingStoreMemoryEstimate(); 1639 1759 1760 if (m_scrollingContentsLayer) 1761 backingMemory += m_scrollingContentsLayer->backingStoreMemoryEstimate(); 1762 1640 1763 if (m_layerForHorizontalScrollbar) 1641 1764 backingMemory += m_layerForHorizontalScrollbar->backingStoreMemoryEstimate(); -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r126105 r126663 84 84 bool hasContentsLayer() const { return m_foregroundLayer != 0; } 85 85 GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); } 86 87 bool hasScrollingLayer() const { return m_scrollingLayer; } 88 GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); } 89 GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); } 86 90 87 91 bool hasMaskLayer() const { return m_maskLayer != 0; } 88 92 89 GraphicsLayer* parentForSublayers() const { return m_containmentLayer ? m_containmentLayer.get() : m_graphicsLayer.get(); }93 GraphicsLayer* parentForSublayers() const; 90 94 GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer.get() : m_graphicsLayer.get(); } 91 95 … … 187 191 bool requiresVerticalScrollbarLayer() const; 188 192 bool requiresScrollCornerLayer() const; 193 bool updateScrollingLayers(bool scrollingLayers); 189 194 190 195 GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const; … … 248 253 OwnPtr<GraphicsLayer> m_layerForScrollCorner; 249 254 255 OwnPtr<GraphicsLayer> m_scrollingLayer; // only used if the layer is using composited scrolling. 256 OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // only used if the layer is using composited scrolling. 257 250 258 IntRect m_compositedBounds; 251 259 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r125597 r126663 1026 1026 // If the layer has a clipping layer the overflow controls layers will be siblings of the clipping layer. 1027 1027 // Otherwise, the overflow control layers are normal children. 1028 if (!layerBacking->hasClippingLayer() ) {1028 if (!layerBacking->hasClippingLayer() && !layerBacking->hasScrollingLayer()) { 1029 1029 if (GraphicsLayer* overflowControlLayer = layerBacking->layerForHorizontalScrollbar()) { 1030 1030 overflowControlLayer->removeFromParent(); … … 1445 1445 || requiresCompositingForAnimation(renderer) 1446 1446 || requiresCompositingForFilters(renderer) 1447 || requiresCompositingForPosition(renderer, layer); 1447 || requiresCompositingForPosition(renderer, layer) 1448 || requiresCompositingForOverflowScrolling(layer); 1448 1449 } 1449 1450 … … 1474 1475 || requiresCompositingForFilters(renderer) 1475 1476 || requiresCompositingForPosition(renderer, layer) 1477 || requiresCompositingForOverflowScrolling(layer) 1476 1478 || renderer->isTransparent() 1477 1479 || renderer->hasMask() … … 1530 1532 if (requiresCompositingForPosition(renderer, layer)) 1531 1533 return "position: fixed"; 1534 1535 if (requiresCompositingForOverflowScrolling(layer)) 1536 return "-webkit-overflow-scrolling: touch"; 1532 1537 1533 1538 if (layer->indirectCompositingReason() == RenderLayer::IndirectCompositingForStacking) … … 1833 1838 1834 1839 return true; 1840 } 1841 1842 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const RenderLayer* layer) const 1843 { 1844 return layer->usesCompositedScrolling(); 1835 1845 } 1836 1846 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r121461 r126663 293 293 bool requiresCompositingForScrollableFrame() const; 294 294 bool requiresCompositingForPosition(RenderObject*, const RenderLayer*) const; 295 bool requiresCompositingForOverflowScrolling(const RenderLayer*) const; 295 296 bool requiresCompositingForIndirectReason(RenderObject*, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&) const; 296 297
Note: See TracChangeset
for help on using the changeset viewer.