Changeset 112436 in webkit
- Timestamp:
- Mar 28, 2012 1:42:19 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r112433 r112436 1 2012-03-26 Shawn Singh <shawnsingh@chromium.org> 2 3 [chromium] layer->clipRect() is not initialized for layers that create a renderSurface. 4 https://bugs.webkit.org/show_bug.cgi?id=74147 5 6 Reviewed by Adrienne Walker. 7 8 * platform/chromium/test_expectations.txt: marked test as needing rebaselining 9 1 10 2012-03-28 John Abd-El-Malek <jam@chromium.org> 2 11 [chromium] Update worker-multi-port-expected.txt. -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r112429 r112436 4125 4125 BUGWK78412 MAC WIN : fast/table/cell-pref-width-invalidation.html = TEXT 4126 4126 4127 // Needs rebaselining after https://bugs.webkit.org/show_bug.cgi?id=74147. 4128 // It is correct for the reflected text to be visible. 4129 BUGWK74147 : compositing/reflections/nested-reflection-on-overflow.html = IMAGE 4130 4127 4131 // Need rebaselining. 4128 4132 BUGWK37244 : tables/mozilla/bugs/bug27038-1.html = IMAGE+TEXT -
trunk/Source/WebCore/ChangeLog
r112434 r112436 1 2012-03-26 Shawn Singh <shawnsingh@chromium.org> 2 3 [chromium] layer->clipRect() is not initialized for layers that create a renderSurface. 4 https://bugs.webkit.org/show_bug.cgi?id=74147 5 6 Reviewed by Adrienne Walker. 7 8 Added 3 additional unit tests; Modified existing unit tests and layout tests. 9 10 The layer's clipRect and usesLayerClipping information was not 11 being initialized for layers that created a renderSurface. (It 12 was, however, being initialized for the renderSurface itself.) 13 This patch adds a unit test that reproduces that this is an error, 14 other unit tests to tightly test the value of clipRect being 15 initialized, and adds the logic to properly initialize the 16 clipRect. 17 18 Before this patch, this bug was causing flashing on tab-switch on 19 the apple iphone page. Even worse, with partial swap enabled, the 20 layers would simply disappear, because the first frame the 21 clipRect is uninitialized and the layer is not drawn, and the 22 second frame onwards, the damage tracker correctly things nothing 23 is damaged, so it doesn't draw that layer again until other damage 24 causes it to be redrawn. 25 26 * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: 27 (WebCore::calculateDrawTransformsAndVisibilityInternal): 28 1 29 2012-03-28 Anders Carlsson <andersca@apple.com> 2 30 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
r112327 r112436 159 159 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } 160 160 161 // Usage: if this->usesLayerClipping() is false, then this clipRect should not be used. 161 162 const IntRect& clipRect() const { return m_clipRect; } 162 163 void setClipRect(const IntRect& rect) { m_clipRect = rect; } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
r112332 r112436 387 387 renderSurface->setClipRect(layer->parent() ? layer->parent()->clipRect() : layer->clipRect()); 388 388 389 // The layer's clipRect can be reset here. The renderSurface will correctly clip the subtree. 390 layer->setUsesLayerClipping(false); 391 layer->setClipRect(IntRect()); 392 389 393 if (layer->maskLayer()) { 390 394 renderSurface->setMaskLayer(layer->maskLayer()); … … 423 427 layer->setTargetRenderSurface(layer->parent()->targetRenderSurface()); 424 428 } 425 426 if (layer->masksToBounds()) { 427 IntRect clipRect = transformedLayerRect; 429 } 430 431 if (layer->masksToBounds()) { 432 IntRect clipRect = transformedLayerRect; 433 434 // If the layer already inherited a clipRect, we need to intersect with it before 435 // overriding the layer's clipRect and usesLayerClipping. 436 if (layer->usesLayerClipping()) 428 437 clipRect.intersect(layer->clipRect()); 429 layer->setClipRect(clipRect); 430 layer->setUsesLayerClipping(true);431 }438 439 layer->setClipRect(clipRect); 440 layer->setUsesLayerClipping(true); 432 441 } 433 442 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
r112327 r112436 341 341 const RenderSurfaceType* targetSurface = m_stack.last().surface; 342 342 FloatRect totalScissor = targetSurface->contentRect(); 343 // FIXME: layer->clipRect() and layer->usesLayerClipping() is changing: https://bugs.webkit.org/show_bug.cgi?id=80622 344 if (!layer->clipRect().isEmpty()) 343 if (layer->usesLayerClipping()) 345 344 totalScissor.intersect(layer->clipRect()); 346 345 return enclosingIntRect(totalScissor); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h
r111909 r112436 104 104 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; } 105 105 106 // Usage: this clipRect should not be used if one of the two conditions is true: (a) clipRect() is empty, or (b) owningLayer->parent()->usesLayerClipping() is false. 106 107 void setClipRect(const IntRect&); 107 108 const IntRect& clipRect() const { return m_clipRect; } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h
r102838 r112436 44 44 const TransformationMatrix& layerTransform() const { return m_layerTransform; } 45 45 const IntRect& layerRect() const { return m_layerRect; } 46 // Usage: if clipRect is empty, this clipRect should not be used. 46 47 const IntRect& clipRect() const { return m_clipRect; } 47 48 -
trunk/Source/WebKit/chromium/ChangeLog
r112432 r112436 1 2012-03-26 Shawn Singh <shawnsingh@chromium.org> 2 3 [chromium] layer->clipRect() is not initialized for layers that create a renderSurface. 4 https://bugs.webkit.org/show_bug.cgi?id=74147 5 6 Reviewed by Adrienne Walker. 7 8 Added 3 more unit tests. One reproduces the clipRect problem in an 9 integrated manner, the other two directly test that clipRects are 10 properly initialized. 11 12 * tests/CCLayerTreeHostCommonTest.cpp: 13 (WebCore::TEST): 14 (WebCore): 15 * tests/CCLayerTreeTestCommon.h: 16 (WebKitTests): 17 1 18 2012-03-28 Adrienne Walker <enne@google.com> 2 19 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
r112332 r112436 626 626 greatGrandChild->setOpacity(0.4); 627 627 628 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; 629 Vector<RefPtr<LayerChromium> > dummyLayerList; 630 int dummyMaxTextureSize = 512; 631 632 // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. 633 parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); 634 renderSurfaceLayerList.append(parent.get()); 635 636 CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); 637 638 ASSERT_EQ(2U, renderSurfaceLayerList.size()); 639 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); 640 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); 641 } 642 643 TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro) 644 { 645 // This is a similar situation as verifyClipRectCullsRenderSurfaces, except that 646 // it reproduces a crash bug http://code.google.com/p/chromium/issues/detail?id=106734. 647 648 const TransformationMatrix identityMatrix; 649 RefPtr<LayerChromium> parent = LayerChromium::create(); 650 RefPtr<LayerChromium> child = LayerChromium::create(); 651 RefPtr<LayerChromium> grandChild = LayerChromium::create(); 652 RefPtr<LayerChromium> greatGrandChild = LayerChromium::create(); 653 RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 654 RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 655 parent->createRenderSurface(); 656 parent->addChild(child); 657 child->addChild(grandChild); 658 grandChild->addChild(greatGrandChild); 659 660 // leafNode1 ensures that parent and child are kept on the renderSurfaceLayerList, 661 // even though grandChild and greatGrandChild should be clipped. 662 child->addChild(leafNode1); 663 greatGrandChild->addChild(leafNode2); 664 665 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); 666 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); 667 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false); 668 setLayerPropertiesForTesting(greatGrandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); 669 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); 670 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); 671 672 child->setMasksToBounds(true); 673 child->setOpacity(0.4); 674 grandChild->setOpacity(0.5); 675 greatGrandChild->setOpacity(0.4); 676 628 677 // Contaminate the grandChild and greatGrandChild's clipRect to reproduce the crash 629 678 // bug found in http://code.google.com/p/chromium/issues/detail?id=106734. In this … … 633 682 // that an empty renderSurface will always be the last item on the list, which 634 683 // ultimately caused the crash. 635 //636 // FIXME: it is also useful to test with this commented out. Eventually we should637 // create several test cases that test clipRect/drawableContentRect computation.638 684 child->setClipRect(IntRect(IntPoint::zero(), IntSize(20, 20))); 639 685 greatGrandChild->setClipRect(IntRect(IntPoint::zero(), IntSize(1234, 1234))); … … 652 698 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); 653 699 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); 700 } 701 702 TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) 703 { 704 // Verify that layers get the appropriate clipRects when their parent masksToBounds is true. 705 // 706 // grandChild1 - completely inside the region; clipRect should be the mask region (larger than this layer's bounds). 707 // grandChild2 - partially clipped but NOT masksToBounds; the clipRect should be the parent's clipRect regardless of the layer's bounds. 708 // grandChild3 - partially clipped and masksToBounds; the clipRect will be the intersection of layerBounds and the mask region. 709 // grandChild4 - outside parent's clipRect, and masksToBounds; the clipRect should be empty. 710 // 711 712 const TransformationMatrix identityMatrix; 713 RefPtr<LayerChromium> parent = LayerChromium::create(); 714 RefPtr<LayerChromium> child = LayerChromium::create(); 715 RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); 716 RefPtr<LayerChromium> grandChild2 = LayerChromium::create(); 717 RefPtr<LayerChromium> grandChild3 = LayerChromium::create(); 718 RefPtr<LayerChromium> grandChild4 = LayerChromium::create(); 719 720 parent->createRenderSurface(); 721 parent->addChild(child); 722 child->addChild(grandChild1); 723 child->addChild(grandChild2); 724 child->addChild(grandChild3); 725 child->addChild(grandChild4); 726 727 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); 728 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); 729 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false); 730 setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false); 731 setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false); 732 setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false); 733 734 child->setMasksToBounds(true); 735 grandChild3->setMasksToBounds(true); 736 grandChild4->setMasksToBounds(true); 737 738 // Force everyone to be a render surface. 739 child->setOpacity(0.4); 740 grandChild1->setOpacity(0.5); 741 grandChild2->setOpacity(0.5); 742 grandChild3->setOpacity(0.5); 743 grandChild4->setOpacity(0.5); 744 745 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; 746 Vector<RefPtr<LayerChromium> > dummyLayerList; 747 int dummyMaxTextureSize = 512; 748 749 // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. 750 parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); 751 renderSurfaceLayerList.append(parent.get()); 752 753 CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); 754 755 EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild1->clipRect()); 756 EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild2->clipRect()); 757 EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->clipRect()); 758 EXPECT_TRUE(grandChild4->clipRect().isEmpty()); 759 } 760 761 TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) 762 { 763 // Verify that renderSurfaces (and their layers) get the appropriate clipRects when their parent masksToBounds is true. 764 // 765 // Layers that own renderSurfaces (at least for now) do not inherit any clipRect; 766 // instead the surface will enforce the clip for the entire subtree. They may still 767 // have a clipRect of their own layer bounds, however, if masksToBounds was true. 768 // 769 770 const TransformationMatrix identityMatrix; 771 RefPtr<LayerChromium> parent = LayerChromium::create(); 772 RefPtr<LayerChromium> child = LayerChromium::create(); 773 RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); 774 RefPtr<LayerChromium> grandChild2 = LayerChromium::create(); 775 RefPtr<LayerChromium> grandChild3 = LayerChromium::create(); 776 RefPtr<LayerChromium> grandChild4 = LayerChromium::create(); 777 RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 778 RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 779 RefPtr<LayerChromiumWithForcedDrawsContent> leafNode3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 780 RefPtr<LayerChromiumWithForcedDrawsContent> leafNode4 = adoptRef(new LayerChromiumWithForcedDrawsContent()); 781 782 parent->createRenderSurface(); 783 parent->addChild(child); 784 child->addChild(grandChild1); 785 child->addChild(grandChild2); 786 child->addChild(grandChild3); 787 child->addChild(grandChild4); 788 789 // the leaf nodes ensure that these grandChildren become renderSurfaces for this test. 790 grandChild1->addChild(leafNode1); 791 grandChild2->addChild(leafNode2); 792 grandChild3->addChild(leafNode3); 793 grandChild4->addChild(leafNode4); 794 795 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); 796 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); 797 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false); 798 setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false); 799 setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false); 800 setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false); 801 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); 802 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); 803 setLayerPropertiesForTesting(leafNode3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); 804 setLayerPropertiesForTesting(leafNode4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); 805 806 child->setMasksToBounds(true); 807 grandChild3->setMasksToBounds(true); 808 grandChild4->setMasksToBounds(true); 809 810 // Force everyone to be a render surface. 811 child->setOpacity(0.4); 812 grandChild1->setOpacity(0.5); 813 grandChild2->setOpacity(0.5); 814 grandChild3->setOpacity(0.5); 815 grandChild4->setOpacity(0.5); 816 817 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; 818 Vector<RefPtr<LayerChromium> > dummyLayerList; 819 int dummyMaxTextureSize = 512; 820 821 // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. 822 parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); 823 renderSurfaceLayerList.append(parent.get()); 824 825 CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); 826 827 ASSERT_TRUE(grandChild1->renderSurface()); 828 ASSERT_TRUE(grandChild2->renderSurface()); 829 ASSERT_TRUE(grandChild3->renderSurface()); 830 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entirely clipped, it is expected to not have a renderSurface. 831 832 // Surfaces are clipped by their parent, but un-affected by the owning layer's masksToBounds. 833 EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect()); 834 EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect()); 835 EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect()); 836 837 // Layers do not inherit the clipRect from their owned surfaces, but if masksToBounds is true, they do create their own clipRect. 838 EXPECT_FALSE(grandChild1->usesLayerClipping()); 839 EXPECT_FALSE(grandChild2->usesLayerClipping()); 840 EXPECT_TRUE(grandChild3->usesLayerClipping()); 841 EXPECT_TRUE(grandChild4->usesLayerClipping()); 654 842 } 655 843 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h
r101318 r112436 28 28 namespace WebKitTests { 29 29 30 // Th is is a macro instead of functionso that we get useful line numbers where a test failed.30 // These are macros instead of functions so that we get useful line numbers where a test failed. 31 31 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \ 32 32 EXPECT_FLOAT_EQ((expected).location().x(), (actual).location().x()); \ … … 34 34 EXPECT_FLOAT_EQ((expected).size().width(), (actual).size().width()); \ 35 35 EXPECT_FLOAT_EQ((expected).size().height(), (actual).size().height()) 36 37 #define EXPECT_INT_RECT_EQ(expected, actual) \ 38 EXPECT_EQ((expected).location().x(), (actual).location().x()); \ 39 EXPECT_EQ((expected).location().y(), (actual).location().y()); \ 40 EXPECT_EQ((expected).size().width(), (actual).size().width()); \ 41 EXPECT_EQ((expected).size().height(), (actual).size().height()) 36 42 37 43 // This is a macro instead of a function so that we get useful line numbers where a test failed.
Note: See TracChangeset
for help on using the changeset viewer.