Changeset 102196 in webkit
- Timestamp:
- Dec 6, 2011, 5:17:49 PM (15 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (modified) (9 diffs)
-
WebCore/platform/graphics/chromium/LayerChromium.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/chromium/LayerChromium.h (modified) (7 diffs)
-
WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/chromium/NonCompositedContentHost.h (modified) (1 diff)
-
WebKit/chromium/ChangeLog (modified) (1 diff)
-
WebKit/chromium/tests/LayerChromiumTest.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102190 r102196 1 2011-12-06 Adrienne Walker <enne@google.com> 2 3 [chromium] setNeedsCommit on non-composited host layers should trigger commit 4 https://bugs.webkit.org/show_bug.cgi?id=73711 5 6 Reviewed by James Robinson. 7 8 Pipe non-composited content host syncs to setNeedsCommit. 9 10 Since now the NonCompositedContentHost generates setNeedsCommit, don't 11 call it unnecessarily, e.g. calling setBackgroundColor to the same 12 color each frame should not retrigger more commits. 13 14 * platform/graphics/chromium/GraphicsLayerChromium.cpp: 15 (WebCore::GraphicsLayerChromium::setAnchorPoint): 16 (WebCore::GraphicsLayerChromium::setTransform): 17 (WebCore::GraphicsLayerChromium::setChildrenTransform): 18 (WebCore::GraphicsLayerChromium::setMasksToBounds): 19 (WebCore::GraphicsLayerChromium::setBackgroundColor): 20 (WebCore::GraphicsLayerChromium::clearBackgroundColor): 21 (WebCore::GraphicsLayerChromium::setContentsOpaque): 22 (WebCore::GraphicsLayerChromium::setBackfaceVisibility): 23 (WebCore::GraphicsLayerChromium::setOpacity): 24 * platform/graphics/chromium/LayerChromium.cpp: 25 (WebCore::LayerChromium::setNeedsCommit): 26 (WebCore::LayerChromium::setAnchorPoint): 27 (WebCore::LayerChromium::setAnchorPointZ): 28 (WebCore::LayerChromium::setBackgroundColor): 29 (WebCore::LayerChromium::setMasksToBounds): 30 (WebCore::LayerChromium::setMaskLayer): 31 (WebCore::LayerChromium::setOpacity): 32 (WebCore::LayerChromium::setOpaque): 33 (WebCore::LayerChromium::setPosition): 34 (WebCore::LayerChromium::setSublayerTransform): 35 (WebCore::LayerChromium::setTransform): 36 (WebCore::LayerChromium::setScrollPosition): 37 (WebCore::LayerChromium::setScrollable): 38 (WebCore::LayerChromium::setDoubleSided): 39 * platform/graphics/chromium/LayerChromium.h: 40 (WebCore::LayerChromium::setReplicaLayer): 41 * platform/graphics/chromium/NonCompositedContentHost.cpp: 42 (WebCore::NonCompositedContentHost::notifySyncRequired): 43 * platform/graphics/chromium/NonCompositedContentHost.h: 44 1 45 2011-12-06 Kenichi Ishibashi <bashi@chromium.org> 2 46 -
trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
r102174 r102196 174 174 void GraphicsLayerChromium::setAnchorPoint(const FloatPoint3D& point) 175 175 { 176 if (point == m_anchorPoint)177 return;178 179 176 GraphicsLayer::setAnchorPoint(point); 180 177 updateAnchorPoint(); … … 195 192 updateContentsScale(); 196 193 197 if (transform == m_transform)198 return;199 200 194 GraphicsLayer::setTransform(transform); 201 195 updateTransform(); … … 204 198 void GraphicsLayerChromium::setChildrenTransform(const TransformationMatrix& transform) 205 199 { 206 if (transform == m_childrenTransform)207 return;208 209 200 GraphicsLayer::setChildrenTransform(transform); 210 201 updateChildrenTransform(); … … 222 213 void GraphicsLayerChromium::setMasksToBounds(bool masksToBounds) 223 214 { 224 if (masksToBounds == m_masksToBounds)225 return;226 227 215 GraphicsLayer::setMasksToBounds(masksToBounds); 228 216 updateMasksToBounds(); … … 240 228 void GraphicsLayerChromium::setBackgroundColor(const Color& color) 241 229 { 242 if (m_backgroundColorSet && m_backgroundColor == color)243 return;244 245 230 GraphicsLayer::setBackgroundColor(color); 246 231 … … 251 236 void GraphicsLayerChromium::clearBackgroundColor() 252 237 { 253 if (!m_backgroundColorSet)254 return;255 256 238 GraphicsLayer::clearBackgroundColor(); 257 239 m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0)); … … 260 242 void GraphicsLayerChromium::setContentsOpaque(bool opaque) 261 243 { 262 if (m_contentsOpaque == opaque)263 return;264 265 244 GraphicsLayer::setContentsOpaque(opaque); 266 245 updateContentsOpaque(); … … 282 261 void GraphicsLayerChromium::setBackfaceVisibility(bool visible) 283 262 { 284 if (m_backfaceVisibility == visible)285 return;286 287 263 GraphicsLayer::setBackfaceVisibility(visible); 288 264 updateBackfaceVisibility(); … … 292 268 { 293 269 float clampedOpacity = max(min(opacity, 1.0f), 0.0f); 294 295 if (m_opacity == clampedOpacity)296 return;297 298 270 GraphicsLayer::setOpacity(clampedOpacity); 299 271 primaryLayer()->setOpacity(opacity); -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
r102170 r102196 121 121 void LayerChromium::setNeedsCommit() 122 122 { 123 // Call notifySyncRequired(), which for non-root layers plumbs through to124 // call setRootLayerNeedsDisplay() on the WebView, which will cause LayerRendererChromium125 // to render a frame.126 // This function has no effect on root layers.127 123 if (m_delegate) 128 124 m_delegate->notifySyncRequired(); … … 248 244 for (size_t i = 0; i < listSize; i++) 249 245 addChild(children[i]); 246 } 247 248 void LayerChromium::setAnchorPoint(const FloatPoint& anchorPoint) 249 { 250 if (m_anchorPoint == anchorPoint) 251 return; 252 m_anchorPoint = anchorPoint; 253 setNeedsCommit(); 254 } 255 256 void LayerChromium::setAnchorPointZ(float anchorPointZ) 257 { 258 if (m_anchorPointZ == anchorPointZ) 259 return; 260 m_anchorPointZ = anchorPointZ; 261 setNeedsCommit(); 262 } 263 264 void LayerChromium::setBackgroundColor(const Color& backgroundColor) 265 { 266 if (m_backgroundColor == backgroundColor) 267 return; 268 m_backgroundColor = backgroundColor; 269 setNeedsCommit(); 270 } 271 272 void LayerChromium::setMasksToBounds(bool masksToBounds) 273 { 274 if (m_masksToBounds == masksToBounds) 275 return; 276 m_masksToBounds = masksToBounds; 277 setNeedsCommit(); 278 } 279 280 void LayerChromium::setMaskLayer(LayerChromium* maskLayer) 281 { 282 if (m_maskLayer == maskLayer) 283 return; 284 m_maskLayer = maskLayer; 285 setNeedsCommit(); 286 } 287 288 void LayerChromium::setOpacity(float opacity) 289 { 290 if (m_opacity == opacity) 291 return; 292 m_opacity = opacity; 293 setNeedsCommit(); 294 } 295 296 void LayerChromium::setOpaque(bool opaque) 297 { 298 if (m_opaque == opaque) 299 return; 300 m_opaque = opaque; 301 setNeedsCommit(); 302 } 303 304 void LayerChromium::setPosition(const FloatPoint& position) 305 { 306 if (m_position == position) 307 return; 308 m_position = position; 309 setNeedsCommit(); 310 } 311 312 void LayerChromium::setSublayerTransform(const TransformationMatrix& sublayerTransform) 313 { 314 if (m_sublayerTransform == sublayerTransform) 315 return; 316 m_sublayerTransform = sublayerTransform; 317 setNeedsCommit(); 318 } 319 320 void LayerChromium::setTransform(const TransformationMatrix& transform) 321 { 322 if (m_transform == transform) 323 return; 324 m_transform = transform; 325 setNeedsCommit(); 326 } 327 328 void LayerChromium::setScrollPosition(const IntPoint& scrollPosition) 329 { 330 if (m_scrollPosition == scrollPosition) 331 return; 332 m_scrollPosition = scrollPosition; 333 setNeedsCommit(); 334 } 335 336 void LayerChromium::setScrollable(bool scrollable) 337 { 338 if (m_scrollable == scrollable) 339 return; 340 m_scrollable = scrollable; 341 setNeedsCommit(); 342 } 343 344 void LayerChromium::setDoubleSided(bool doubleSided) 345 { 346 if (m_doubleSided == doubleSided) 347 return; 348 m_doubleSided = doubleSided; 349 setNeedsCommit(); 250 350 } 251 351 -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h
r102165 r102196 84 84 const Vector<RefPtr<LayerChromium> >& children() const { return m_children; } 85 85 86 void setAnchorPoint(const FloatPoint& anchorPoint) { m_anchorPoint = anchorPoint; setNeedsCommit(); }86 void setAnchorPoint(const FloatPoint&); 87 87 FloatPoint anchorPoint() const { return m_anchorPoint; } 88 88 89 void setAnchorPointZ(float anchorPointZ) { m_anchorPointZ = anchorPointZ; setNeedsCommit(); }89 void setAnchorPointZ(float); 90 90 float anchorPointZ() const { return m_anchorPointZ; } 91 91 92 void setBackgroundColor(const Color& color) { m_backgroundColor = color; setNeedsCommit(); }92 void setBackgroundColor(const Color&); 93 93 Color backgroundColor() const { return m_backgroundColor; } 94 94 … … 97 97 virtual IntSize contentBounds() const { return bounds(); } 98 98 99 void setMasksToBounds(bool masksToBounds) { m_masksToBounds = masksToBounds; setNeedsCommit(); }99 void setMasksToBounds(bool); 100 100 bool masksToBounds() const { return m_masksToBounds; } 101 101 … … 103 103 const String& name() const { return m_name; } 104 104 105 void setMaskLayer(LayerChromium* maskLayer) { m_maskLayer = maskLayer; setNeedsCommit(); }105 void setMaskLayer(LayerChromium*); 106 106 LayerChromium* maskLayer() const { return m_maskLayer.get(); } 107 107 … … 110 110 virtual bool needsDisplay() const { return m_needsDisplay; } 111 111 112 void setOpacity(float opacity) { m_opacity = opacity; setNeedsCommit(); }112 void setOpacity(float); 113 113 float opacity() const { return m_opacity; } 114 114 115 void setOpaque(bool opaque) { m_opaque = opaque; setNeedsCommit(); }115 void setOpaque(bool); 116 116 bool opaque() const { return m_opaque; } 117 117 118 void setPosition(const FloatPoint& position) { m_position = position; setNeedsCommit(); }118 void setPosition(const FloatPoint&); 119 119 FloatPoint position() const { return m_position; } 120 120 121 void setSublayerTransform(const TransformationMatrix& transform) { m_sublayerTransform = transform; setNeedsCommit(); }121 void setSublayerTransform(const TransformationMatrix&); 122 122 const TransformationMatrix& sublayerTransform() const { return m_sublayerTransform; } 123 123 124 124 TransformationMatrix zoomAnimatorTransform() const { return TransformationMatrix(); } 125 125 126 void setTransform(const TransformationMatrix& transform) { m_transform = transform; setNeedsCommit(); }126 void setTransform(const TransformationMatrix&); 127 127 const TransformationMatrix& transform() const { return m_transform; } 128 128 … … 130 130 void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; } 131 131 132 void setScrollPosition(const IntPoint&); 132 133 const IntPoint& scrollPosition() const { return m_scrollPosition; } 133 void setScrollPosition(const IntPoint& scrollPosition) { m_scrollPosition = scrollPosition; } 134 134 135 void setScrollable(bool); 135 136 bool scrollable() const { return m_scrollable; } 136 void setScrollable(bool scrollable) { m_scrollable = true; setNeedsCommit(); }137 137 138 138 IntSize scrollDelta() const { return IntSize(); } … … 140 140 float pageScaleDelta() const { return 1; } 141 141 142 void setDoubleSided(bool); 142 143 bool doubleSided() const { return m_doubleSided; } 143 void setDoubleSided(bool doubleSided) { m_doubleSided = doubleSided; setNeedsCommit(); }144 144 145 145 void setPreserves3D(bool preserve3D) { m_preserves3D = preserve3D; } … … 156 156 void setDelegate(CCLayerDelegate* delegate) { m_delegate = delegate; } 157 157 158 void setReplicaLayer(LayerChromium* layer) { m_replicaLayer = layer; }158 void setReplicaLayer(LayerChromium* layer) { m_replicaLayer = layer; setNeedsCommit(); } 159 159 LayerChromium* replicaLayer() const { return m_replicaLayer.get(); } 160 160 -
trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp
r102165 r102196 32 32 #include "LayerChromium.h" 33 33 #include "LayerPainterChromium.h" 34 #include "cc/CCLayerTreeHost.h" 34 35 35 36 namespace WebCore { … … 121 122 void NonCompositedContentHost::notifySyncRequired(const GraphicsLayer*) 122 123 { 124 CCLayerTreeHost* layerTreeHost = m_graphicsLayer->platformLayer()->layerTreeHost(); 125 if (layerTreeHost) 126 layerTreeHost->setNeedsCommit(); 123 127 } 124 128 -
trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h
r102165 r102196 60 60 GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); } 61 61 62 pr ivate:62 protected: 63 63 explicit NonCompositedContentHost(PassOwnPtr<LayerPainterChromium> contentPaint); 64 64 65 private: 65 66 // GraphicsLayerClient 66 67 virtual void notifyAnimationStarted(const GraphicsLayer*, double time); -
trunk/Source/WebKit/chromium/ChangeLog
r102181 r102196 1 2011-12-06 Adrienne Walker <enne@google.com> 2 3 [chromium] setNeedsCommit on non-composited host layers should trigger commit 4 https://bugs.webkit.org/show_bug.cgi?id=73711 5 6 Reviewed by James Robinson. 7 8 Add some tests to make sure that modifying the noncomposited content 9 host triggers commits. 10 11 Properties that trigger setNeedsCommit should only do so when the 12 property changes. Additionally, make more property changes properly 13 trigger commits. 14 15 * tests/LayerChromiumTest.cpp: 16 1 17 2011-12-06 David Reveman <reveman@chromium.org> 2 18 -
trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
r102165 r102196 28 28 29 29 #include "CCLayerTreeTestCommon.h" 30 #include "LayerPainterChromium.h" 31 #include "NonCompositedContentHost.h" 30 32 #include <gmock/gmock.h> 31 33 #include <gtest/gtest.h> … … 51 53 MOCK_METHOD2(paintContents, void(GraphicsContext&, const IntRect&)); 52 54 MOCK_METHOD0(notifySyncRequired, void()); 55 }; 56 57 class MockLayerPainterChromium : public LayerPainterChromium { 58 public: 59 virtual void paint(GraphicsContext&, const IntRect&) { } 60 }; 61 62 class MockNonCompositedContentHost : public NonCompositedContentHost { 63 public: 64 static PassOwnPtr<MockNonCompositedContentHost> create() 65 { 66 return adoptPtr(new MockNonCompositedContentHost); 67 } 68 69 MOCK_METHOD1(notifySyncRequired, void(const GraphicsLayer*)); 70 71 private: 72 MockNonCompositedContentHost() 73 : NonCompositedContentHost(adoptPtr(new MockLayerPainterChromium())) 74 { 75 m_scrollLayer = GraphicsLayer::create(0); 76 setScrollLayer(m_scrollLayer.get()); 77 } 78 OwnPtr<GraphicsLayer> m_scrollLayer; 53 79 }; 54 80 … … 621 647 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setName("Test Layer")); 622 648 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setVisibleLayerRect(IntRect(0, 0, 40, 50))); 623 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setScrollPosition(IntPoint(10, 10)));624 649 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setUsesLayerClipping(true)); 625 650 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setIsNonCompositedContent(true)); 626 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setReplicaLayer(dummyLayer.get()));627 651 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setDrawOpacity(0.5f)); 628 652 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 0, testLayer->setClipRect(IntRect(3, 3, 8, 8))); … … 635 659 // Next, test properties that should call setNeedsCommit (but not setNeedsDisplay) 636 660 // These properties should indirectly call notifySyncRequired, but the needsDisplay flag should not change. 637 // Note that for many of these properties it is important to test setting the property to a value that638 // is different than what the constructor initializes it to.661 // All properties need to be set to new values in order for setNeedsCommit 662 // to be called. 639 663 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setAnchorPoint(FloatPoint(1.23f, 4.56f))); 640 664 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setAnchorPointZ(0.7f)); … … 643 667 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setMaskLayer(dummyLayer.get())); 644 668 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setOpacity(0.5f)); 645 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setOpaque( false));669 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setOpaque(true)); 646 670 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setPosition(FloatPoint(4.0f, 9.0f))); 647 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setSublayerTransform(TransformationMatrix())); 671 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setReplicaLayer(dummyLayer.get())); 672 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setSublayerTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); 648 673 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setScrollable(true)); 649 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setTransform(TransformationMatrix())); 674 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setScrollPosition(IntPoint(10, 10))); 675 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); 650 676 EXECUTE_AND_VERIFY_NOTIFY_SYNC_BEHAVIOR(mockDelegate, 1, testLayer->setDoubleSided(false)); 651 677 … … 661 687 } 662 688 689 TEST_F(LayerChromiumTest, checkNonCompositedContentPropertyChangeCausesCommit) 690 { 691 OwnPtr<MockNonCompositedContentHost> nonCompositedContentHost(MockNonCompositedContentHost::create()); 692 693 GraphicsLayer* rootLayer = nonCompositedContentHost->topLevelRootLayer(); 694 695 EXPECT_CALL(*nonCompositedContentHost, notifySyncRequired(_)).Times(1); 696 rootLayer->platformLayer()->setScrollPosition(IntPoint(1, 1)); 697 Mock::VerifyAndClearExpectations(nonCompositedContentHost.get()); 698 699 EXPECT_CALL(*nonCompositedContentHost, notifySyncRequired(_)).Times(AtLeast(1)); 700 nonCompositedContentHost->setViewport(IntSize(30, 30), IntSize(20, 20), IntPoint(10, 10), 1); 701 } 702 663 703 } // namespace
Note:
See TracChangeset
for help on using the changeset viewer.