Changeset 92651 in webkit
- Timestamp:
- Aug 8, 2011 4:21:16 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r92643 r92651 1 2 Logic to compute visible display rect in GraphicsLayerCA::syncCompositingState 3 https://bugs.webkit.org/show_bug.cgi?id=65708 4 5 Add logic to syncCompositingState to compute the visible rect for each 6 layer. This can be used to synchronously render the visible tiles of a 7 TiledLayer and avoid the flashing that often occurs when tiles are rendered 8 asynchronously. A new synchronouslyDisplayTilesInRect is also added to do 9 the actual rendering, but the call is not currently being made. 10 11 Reviewed by Simon Fraser. 12 13 * page/FrameView.cpp: 14 (WebCore::FrameView::syncCompositingStateForThisFrame): 15 * platform/graphics/GraphicsLayer.h: 16 (WebCore::GraphicsLayer::syncCompositingState): 17 * platform/graphics/ca/GraphicsLayerCA.cpp: 18 (WebCore::GraphicsLayerCA::syncCompositingState): 19 (WebCore::GraphicsLayerCA::recursiveCommitChanges): 20 (WebCore::GraphicsLayerCA::platformCALayerPaintContents): 21 (WebCore::GraphicsLayerCA::updateSublayerList): 22 (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): 23 * platform/graphics/ca/GraphicsLayerCA.h: 24 * platform/graphics/ca/PlatformCALayer.h: 25 * platform/graphics/ca/mac/PlatformCALayerMac.mm: 26 (PlatformCALayer::synchronouslyDisplayTilesInRect): 27 * platform/graphics/transforms/TransformState.cpp: 28 (WebCore::TransformState::operator=): 29 * platform/graphics/transforms/TransformState.h: 30 (WebCore::TransformState::TransformState): 31 * rendering/RenderLayerCompositor.cpp: 32 (WebCore::RenderLayerCompositor::flushPendingLayerChanges): 33 1 34 2011-08-08 Sheriff Bot <webkit.review.bot@gmail.com> 2 35 -
trunk/Source/WebCore/page/FrameView.cpp
r92545 r92651 702 702 if (isDocumentRunningFullScreenAnimation(document)) { 703 703 RenderLayerBacking* backing = document->fullScreenRenderer()->layer()->backing(); 704 if (GraphicsLayer* fullScreenLayer = backing->graphicsLayer()) 705 fullScreenLayer->syncCompositingState(); 704 if (GraphicsLayer* fullScreenLayer = backing->graphicsLayer()) { 705 // FIXME: Passing frameRect() is correct only when RenderLayerCompositor uses a ScrollLayer (as in WebKit2) 706 // otherwise, the passed clip rect needs to take scrolling into account 707 fullScreenLayer->syncCompositingState(frameRect()); 708 } 706 709 } 707 710 #endif -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
r91161 r92651 366 366 // with updates drawn into the window. These methods flush internal batched state on this layer 367 367 // and descendant layers, and this layer only. 368 virtual void syncCompositingState( ) { }368 virtual void syncCompositingState(const FloatRect& /* clipRect */) { } 369 369 virtual void syncCompositingStateForThisLayerOnly() { } 370 370 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r91623 r92651 37 37 #include "ScaleTransformOperation.h" 38 38 #include "SystemTime.h" 39 #include "TransformState.h" 39 40 #include "TranslateTransformOperation.h" 40 41 #include <QuartzCore/CATransform3D.h> … … 811 812 } 812 813 813 void GraphicsLayerCA::syncCompositingState() 814 { 815 recursiveCommitChanges(); 814 void GraphicsLayerCA::syncCompositingState(const FloatRect& clipRect) 815 { 816 TransformState state(TransformState::UnapplyInverseTransformDirection, FloatQuad(clipRect)); 817 recursiveCommitChanges(state); 816 818 } 817 819 … … 824 826 } 825 827 826 void GraphicsLayerCA::recursiveCommitChanges(float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale) 827 { 828 void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale) 829 { 830 // Save the state before sending down to kids and restore it after 831 TransformState localState = state; 832 833 TransformState::TransformAccumulation accumulation = preserves3D() ? TransformState::AccumulateTransform : TransformState::FlattenTransform; 834 localState.move(-m_position.x(), -m_position.y(), accumulation); 835 836 if (!transform().isIdentity()) { 837 TransformationMatrix transformWithAnchorPoint; 838 FloatPoint3D absoluteAnchorPoint(anchorPoint()); 839 absoluteAnchorPoint.scale(size().width(), size().height(), 1); 840 transformWithAnchorPoint.translate3d(absoluteAnchorPoint.x(), absoluteAnchorPoint.y(), absoluteAnchorPoint.z()); 841 transformWithAnchorPoint.multiply(transform()); 842 transformWithAnchorPoint.translate3d(-absoluteAnchorPoint.x(), -absoluteAnchorPoint.y(), -absoluteAnchorPoint.z()); 843 localState.applyTransform(transformWithAnchorPoint, accumulation); 844 } 845 846 FloatRect clipRectForChildren = localState.lastPlanarQuad().boundingBox(); 847 FloatRect clipRectForSelf; 848 849 if (masksToBounds()) { 850 ASSERT(accumulation == TransformState::FlattenTransform); 851 852 // Replace the quad in the TransformState with one that is clipped to this layer's bounds 853 clipRectForSelf = FloatRect(0, 0, m_size.width(), m_size.height()); 854 clipRectForSelf.intersect(clipRectForChildren); 855 localState.setQuad(clipRectForSelf); 856 } 857 858 #ifdef VISIBLE_TILE_WASH 859 if (m_visibleTileWashLayer) { 860 if (clipRectForSelf.isEmpty()) { 861 clipRectForSelf = FloatRect(0, 0, m_size.width(), m_size.height()); 862 clipRectForSelf.intersect(clipRectForChildren); 863 } 864 m_visibleTileWashLayer->setFrame(clipRectForSelf); 865 } 866 #endif 867 828 868 bool hadChanges = m_uncommittedChanges; 829 869 … … 845 885 const Vector<GraphicsLayer*>& childLayers = children(); 846 886 size_t numChildren = childLayers.size(); 887 888 if (!childrenTransform().isIdentity()) 889 localState.applyTransform(childrenTransform(), accumulation); 890 847 891 for (size_t i = 0; i < numChildren; ++i) { 848 892 GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayers[i]); 849 curChild->recursiveCommitChanges( pageScaleFactor, baseRelativePosition, affectedByPageScale);893 curChild->recursiveCommitChanges(localState, pageScaleFactor, baseRelativePosition, affectedByPageScale); 850 894 } 851 895 852 896 if (m_replicaLayer) 853 static_cast<GraphicsLayerCA*>(m_replicaLayer)->recursiveCommitChanges( pageScaleFactor, baseRelativePosition, affectedByPageScale);897 static_cast<GraphicsLayerCA*>(m_replicaLayer)->recursiveCommitChanges(localState, pageScaleFactor, baseRelativePosition, affectedByPageScale); 854 898 855 899 if (m_maskLayer) … … 860 904 if (hadChanges && client()) 861 905 client()->didCommitChangesForLayer(this); 906 } 907 908 void GraphicsLayerCA::platformCALayerPaintContents(GraphicsContext& context, const IntRect& clip) 909 { 910 paintGraphicsLayerContents(context, clip); 862 911 } 863 912 … … 990 1039 newSublayers[i]->removeFromSuperlayer(); 991 1040 } 1041 1042 #ifdef VISIBLE_TILE_WASH 1043 if (m_visibleTileWashLayer) 1044 newSublayers.append(m_visibleTileWashLayer); 1045 #endif 992 1046 993 1047 if (m_structuralLayer) { … … 2063 2117 m_usingTiledLayer = useTiledLayer; 2064 2118 2119 #ifdef VISIBLE_TILE_WASH 2120 if (useTiledLayer) { 2121 static Color washFillColor(255, 0, 0, 50); 2122 static Color washBorderColor(255, 0, 0, 100); 2123 2124 m_visibleTileWashLayer = PlatformCALayer::create(PlatformCALayer::LayerTypeLayer, this); 2125 m_visibleTileWashLayer->setName("Visible Tile Wash Layer"); 2126 m_visibleTileWashLayer->setAnchorPoint(FloatPoint3D(0, 0, 0)); 2127 m_visibleTileWashLayer->setBorderColor(washBorderColor); 2128 m_visibleTileWashLayer->setBorderWidth(8); 2129 m_visibleTileWashLayer->setBackgroundColor(washFillColor); 2130 } else 2131 m_visibleTileWashLayer = 0; 2132 #endif 2133 2065 2134 if (useTiledLayer) { 2066 2135 #if !HAVE_MODERN_QUARTZCORE … … 2075 2144 2076 2145 m_layer->adoptSublayers(oldLayer.get()); 2077 2146 2147 #ifdef VISIBLE_TILE_WASH 2148 if (m_visibleTileWashLayer) 2149 m_layer->appendSublayer(m_visibleTileWashLayer.get()); 2150 #endif 2151 2078 2152 // FIXME: Skip this step if we don't have a superlayer. This is problably a benign 2079 2153 // case that happens while restructuring the layer tree. -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r91294 r92651 38 38 #include <wtf/text/StringHash.h> 39 39 40 // Enable this to add a light red wash over the visible portion of Tiled Layers, as computed 41 // by syncCompositingState(). 42 // #define VISIBLE_TILE_WASH 43 40 44 namespace WebCore { 41 45 42 46 class PlatformCALayer; 47 class TransformState; 43 48 44 49 class GraphicsLayerCA : public GraphicsLayer, public PlatformCALayerClient { … … 120 125 virtual void pageScaleFactorChanged(); 121 126 122 void recursiveCommitChanges( float pageScaleFactor = 1, const FloatPoint& positionRelativeToBase = FloatPoint(), bool affectedByPageScale = false);123 124 virtual void syncCompositingState( );127 void recursiveCommitChanges(const TransformState&, float pageScaleFactor = 1, const FloatPoint& positionRelativeToBase = FloatPoint(), bool affectedByPageScale = false); 128 129 virtual void syncCompositingState(const FloatRect&); 125 130 virtual void syncCompositingStateForThisLayerOnly(); 126 131 … … 138 143 virtual void platformCALayerAnimationStarted(CFTimeInterval beginTime); 139 144 virtual CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return contentsOrientation(); } 140 virtual void platformCALayerPaintContents(GraphicsContext& context, const IntRect& clip) { paintGraphicsLayerContents(context, clip); }145 virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& clip); 141 146 virtual bool platformCALayerShowDebugBorders() const { return showDebugBorders(); } 142 147 virtual bool platformCALayerShowRepaintCounter() const { return showRepaintCounter(); } … … 349 354 OwnPtr<LayerMap> m_structuralLayerClones; 350 355 OwnPtr<LayerMap> m_contentsLayerClones; 356 357 #ifdef VISIBLE_TILE_WASH 358 RefPtr<PlatformCALayer> m_visibleTileWashLayer; 359 #endif 351 360 352 361 enum ContentsLayerPurpose { -
trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h
r84416 r92651 196 196 #endif 197 197 198 #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 199 void synchronouslyDisplayTilesInRect(const FloatRect&); 200 #endif 201 198 202 protected: 199 203 PlatformCALayer(LayerType, PlatformLayer*, PlatformCALayerClient*); -
trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
r89651 r92651 90 90 @end 91 91 92 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 93 @interface CATiledLayer(GraphicsLayerCAPrivate) 94 - (void)displayInRect:(CGRect)r levelOfDetail:(int)lod options:(NSDictionary *)dict; 95 - (BOOL)canDrawConcurrently; 96 - (void)setCanDrawConcurrently:(BOOL)flag; 97 @end 98 #endif 99 92 100 @interface CALayer(Private) 93 101 - (void)setContentsChanged; … … 751 759 } 752 760 761 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 762 void PlatformCALayer::synchronouslyDisplayTilesInRect(const FloatRect& rect) 763 { 764 if (m_layerType != LayerTypeWebTiledLayer) 765 return; 766 767 WebTiledLayer *tiledLayer = static_cast<WebTiledLayer*>(m_layer.get()); 768 769 BEGIN_BLOCK_OBJC_EXCEPTIONS 770 BOOL oldCanDrawConcurrently = [tiledLayer canDrawConcurrently]; 771 [tiledLayer setCanDrawConcurrently:NO]; 772 [tiledLayer displayInRect:rect levelOfDetail:0 options:nil]; 773 [tiledLayer setCanDrawConcurrently:oldCanDrawConcurrently]; 774 END_BLOCK_OBJC_EXCEPTIONS 775 } 776 #endif 777 753 778 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp
r91130 r92651 30 30 31 31 namespace WebCore { 32 33 TransformState& TransformState::operator=(const TransformState& other) 34 { 35 m_mapPoint = other.m_mapPoint; 36 m_mapQuad = other.m_mapQuad; 37 if (m_mapPoint) 38 m_lastPlanarPoint = other.m_lastPlanarPoint; 39 if (m_mapQuad) 40 m_lastPlanarQuad = other.m_lastPlanarQuad; 41 m_accumulatingTransform = other.m_accumulatingTransform; 42 m_direction = other.m_direction; 43 44 m_accumulatedTransform.clear(); 45 46 if (other.m_accumulatedTransform) 47 m_accumulatedTransform = adoptPtr(new TransformationMatrix(*other.m_accumulatedTransform)); 48 49 return *this; 50 } 32 51 33 52 void TransformState::move(int x, int y, TransformAccumulation accumulate) -
trunk/Source/WebCore/platform/graphics/transforms/TransformState.h
r91130 r92651 37 37 38 38 class TransformState { 39 WTF_MAKE_NONCOPYABLE(TransformState);40 39 public: 41 40 enum TransformDirection { ApplyTransformDirection, UnapplyInverseTransformDirection }; … … 69 68 { 70 69 } 70 71 TransformState(const TransformState& other) { *this = other; } 72 73 TransformState& operator=(const TransformState&); 71 74 72 75 void setQuad(const FloatQuad& quad) { m_lastPlanarQuad = quad; } -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r91542 r92651 204 204 m_flushingLayers = true; 205 205 206 if (GraphicsLayer* rootLayer = rootGraphicsLayer()) 207 rootLayer->syncCompositingState(); 208 206 if (GraphicsLayer* rootLayer = rootGraphicsLayer()) { 207 FrameView* frameView = m_renderView ? m_renderView->frameView() : 0; 208 if (frameView) { 209 // FIXME: Passing frameRect() is correct only when RenderLayerCompositor uses a ScrollLayer (as in WebKit2) 210 // otherwise, the passed clip rect needs to take scrolling into account 211 rootLayer->syncCompositingState(frameView->frameRect()); 212 } 213 } 214 209 215 ASSERT(m_flushingLayers); 210 216 m_flushingLayers = false; -
trunk/Source/WebKit/mac/ChangeLog
r92552 r92651 1 2011-08-08 Chris Marrin <cmarrin@apple.com> 2 3 Logic to compute visible display rect in GraphicsLayerCA::syncCompositingState 4 https://bugs.webkit.org/show_bug.cgi?id=65708 5 6 Supply initial display rects for the full-screen case 7 8 Reviewed by Simon Fraser. 9 10 * WebView/WebFullScreenController.mm: 11 (-[WebFullScreenController enterFullscreen:]): 12 (-[WebFullScreenController exitFullscreen]): 13 1 14 2011-08-06 Joseph Pecoraro <joepeck@webkit.org> 2 15 -
trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm
r92347 r92651 422 422 // tell the renderer's layer to sync it's compositing state: 423 423 GraphicsLayer* rendererGraphics = _renderer->layer()->backing()->graphicsLayer(); 424 rendererGraphics->syncCompositingState( );424 rendererGraphics->syncCompositingState(destinationFrame); 425 425 426 426 CALayer* rendererLayer = rendererGraphics->platformLayer(); … … 573 573 [self _document]->setFullScreenRendererBackgroundColor(Color::transparent); 574 574 575 rendererGraphics->syncCompositingState( );575 rendererGraphics->syncCompositingState(layerEndFrame); 576 576 577 577 CALayer* rendererLayer = rendererGraphics->platformLayer(); -
trunk/Source/WebKit2/ChangeLog
r92603 r92651 1 2011-08-08 Chris Marrin <cmarrin@apple.com> 2 3 Logic to compute visible display rect in GraphicsLayerCA::syncCompositingState 4 https://bugs.webkit.org/show_bug.cgi?id=65708 5 6 Supply initial display rects for the full-screen case 7 8 Reviewed by Simon Fraser. 9 10 * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm: 11 (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer): 12 (WebKit::WebFullScreenManagerMac::beginEnterFullScreenAnimation): 13 (WebKit::WebFullScreenManagerMac::beginExitFullScreenAnimation): 14 1 15 2011-08-08 Dan Bernstein <mitz@apple.com> 2 16 -
trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm
r89398 r92651 174 174 m_rootLayer->removeAllChildren(); 175 175 m_rootLayer->addChild(layer); 176 m_rootLayer->syncCompositingState( );176 m_rootLayer->syncCompositingState(getFullScreenRect()); 177 177 [CATransaction commit]; 178 178 … … 204 204 IntRect destinationFrame = getFullScreenRect(); 205 205 m_element->document()->setFullScreenRendererSize(destinationFrame.size()); 206 m_rootLayer->syncCompositingState( );206 m_rootLayer->syncCompositingState(destinationFrame); 207 207 208 208 // FIXME: Once we gain the ability to do native WebKit animations of generated … … 227 227 IntRect destinationFrame = getFullScreenRect(); 228 228 m_element->document()->setFullScreenRendererSize(destinationFrame.size()); 229 m_rootLayer->syncCompositingState( );229 m_rootLayer->syncCompositingState(destinationFrame); 230 230 231 231 // FIXME: Once we gain the ability to do native WebKit animations of generated
Note: See TracChangeset
for help on using the changeset viewer.