Changeset 107119 in webkit
- Timestamp:
- Feb 8, 2012 12:24:57 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107118 r107119 1 2012-02-08 Anders Carlsson <andersca@apple.com> 2 3 Add a content shadow layer to the render layer compositor 4 https://bugs.webkit.org/show_bug.cgi?id=78133 5 <rdar://problem/10797742> 6 7 Reviewed by Beth Dakin. 8 9 Have the render layer compositor optionally create a content shadow layer, 10 and add a ScrollbarTheme::setUpContentShadowLayer member function that subclasses 11 can use to set content shadow properties. 12 13 * platform/mac/ScrollbarThemeMac.mm: 14 (WebCore::ScrollbarThemeMac::setUpContentShadowLayer): 15 Set the layer properties once, and set the shadow path on every call, since we know that this 16 function will be called every time the size of the content shadow layer changes. 17 18 * rendering/RenderLayerCompositor.cpp: 19 (WebCore::RenderLayerCompositor::updateRootLayerPosition): 20 Reposition the content shadow layer, and call ScrollbarTheme::setUpContentShadowLayer if the size changes. 21 22 (WebCore::RenderLayerCompositor::requiresContentShadowLayer): 23 Add new helper function. 24 25 (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): 26 Create a content shadow layer if needed. 27 1 28 2012-02-07 Andy Estes <aestes@apple.com> 2 29 -
trunk/Source/WebCore/platform/ScrollbarTheme.h
r106588 r107119 91 91 #if USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING) 92 92 virtual void setUpOverhangAreasLayerContents(GraphicsLayer*) { } 93 virtual void setUpContentShadowLayer(GraphicsLayer*) { } 93 94 #endif 94 95 -
trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h
r106588 r107119 84 84 #if !PLATFORM(CHROMIUM) && USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING) 85 85 virtual void setUpOverhangAreasLayerContents(GraphicsLayer*) OVERRIDE; 86 virtual void setUpContentShadowLayer(GraphicsLayer*) OVERRIDE; 86 87 #endif 87 88 }; -
trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
r106588 r107119 625 625 } 626 626 627 void ScrollbarThemeMac::setUpContentShadowLayer(GraphicsLayer* graphicsLayer) 628 { 629 // We operate on the CALayer directly here, since GraphicsLayer doesn't have the concept 630 // of shadows, and we know that WebCore won't touch this layer. 631 CALayer *contentShadowLayer = graphicsLayer->platformLayer(); 632 633 static const CGFloat shadowOpacity = 0.66; 634 static const CGFloat shadowRadius = 3; 635 636 // We only need to set these shadow properties once. 637 if (!contentShadowLayer.shadowOpacity) { 638 contentShadowLayer.shadowColor = CGColorGetConstantColor(kCGColorBlack); 639 contentShadowLayer.shadowOffset = CGSizeZero; 640 contentShadowLayer.shadowOpacity = shadowOpacity; 641 contentShadowLayer.shadowRadius = shadowRadius; 642 } 643 644 RetainPtr<CGPathRef> shadowPath = adoptCF(CGPathCreateWithRect(CGRectMake(0, 0, graphicsLayer->size().width(), graphicsLayer->size().height()), NULL)); 645 contentShadowLayer.shadowPath = shadowPath.get(); 646 } 647 627 648 #endif 628 649 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r107024 r107119 1232 1232 m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size()); 1233 1233 } 1234 1235 #if ENABLE(RUBBER_BANDING) 1236 if (m_contentShadowLayer) { 1237 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); 1238 1239 FloatSize rootContentLayerSize = m_rootContentLayer->size(); 1240 if (m_contentShadowLayer->size() != rootContentLayerSize) { 1241 m_contentShadowLayer->setSize(rootContentLayerSize); 1242 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLayer.get()); 1243 } 1244 } 1245 #endif 1234 1246 } 1235 1247 … … 1723 1735 return false; 1724 1736 } 1737 1738 bool RenderLayerCompositor::requiresContentShadowLayer() const 1739 { 1740 // We don't want a layer if this is a subframe. 1741 if (m_renderView->document()->ownerElement()) 1742 return false; 1743 1744 #if PLATFORM(MAC) && ENABLE(THREADED_SCROLLING) 1745 // On Mac, we want a content shadow layer if we have a scrolling coordinator. 1746 if (scrollingCoordinator()) 1747 return true; 1748 #endif 1749 1750 return false; 1751 } 1725 1752 #endif 1726 1753 … … 1746 1773 m_layerForOverhangAreas->removeFromParent(); 1747 1774 m_layerForOverhangAreas = nullptr; 1775 } 1776 1777 if (requiresContentShadowLayer()) { 1778 if (!m_contentShadowLayer) { 1779 m_contentShadowLayer = GraphicsLayer::create(this); 1780 #ifndef NDEBUG 1781 m_contentShadowLayer->setName("content shadow"); 1782 #endif 1783 m_contentShadowLayer->setSize(m_rootContentLayer->size()); 1784 m_contentShadowLayer->setPosition(m_rootContentLayer->position()); 1785 ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLayer.get()); 1786 1787 m_scrollLayer->addChildBelow(m_contentShadowLayer.get(), m_rootContentLayer.get()); 1788 } 1789 } else if (m_contentShadowLayer) { 1790 m_contentShadowLayer->removeFromParent(); 1791 m_contentShadowLayer = nullptr; 1748 1792 } 1749 1793 #endif -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r107024 r107119 292 292 #if ENABLE(RUBBER_BANDING) 293 293 bool requiresOverhangAreasLayer() const; 294 bool requiresContentShadowLayer() const; 294 295 #endif 295 296 … … 338 339 #if ENABLE(RUBBER_BANDING) 339 340 OwnPtr<GraphicsLayer> m_layerForOverhangAreas; 341 OwnPtr<GraphicsLayer> m_contentShadowLayer; 340 342 #endif 341 343 #if PROFILE_LAYER_REBUILD
Note: See TracChangeset
for help on using the changeset viewer.