| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 #include "core/layout/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
| 7 #include "core/layout/api/LayoutViewItem.h" | 7 #include "core/layout/api/LayoutViewItem.h" |
| 8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
| 9 #include "platform/graphics/paint/GeometryMapper.h" |
| 9 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 11 #include "platform/testing/UnitTestHelpers.h" |
| 11 #include "platform/text/TextStream.h" | 12 #include "platform/text/TextStream.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "wtf/HashMap.h" | 14 #include "wtf/HashMap.h" |
| 14 #include "wtf/Vector.h" | 15 #include "wtf/Vector.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 class PaintPropertyTreeBuilderTest : public RenderingTest { | 19 class PaintPropertyTreeBuilderTest : public RenderingTest { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 44 { | 45 { |
| 45 RenderingTest::TearDown(); | 46 RenderingTest::TearDown(); |
| 46 | 47 |
| 47 Settings::setMockScrollbarsEnabled(false); | 48 Settings::setMockScrollbarsEnabled(false); |
| 48 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); | 49 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool m_originalSlimmingPaintV2Enabled; | 52 bool m_originalSlimmingPaintV2Enabled; |
| 52 }; | 53 }; |
| 53 | 54 |
| 55 #define CHECK_VISUAL_RECT(sourceLayoutObject, ancestorLayoutObject) \ |
| 56 do { \ |
| 57 GeometryMapper geometryMapper; \ |
| 58 LayoutRect source(sourceLayoutObject->localOverflowRectForPaintInvalidation(
)); \ |
| 59 source.moveBy(sourceLayoutObject->objectPaintProperties()->localBorderBoxPro
perties()->paintOffset); \ |
| 60 bool success = false; \ |
| 61 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ |
| 62 FloatRect(source), \ |
| 63 sourceLayoutObject->objectPaintProperties()->localBorderBoxProperties()-
>propertyTreeState, \ |
| 64 ancestorLayoutObject->objectPaintProperties()->localBorderBoxProperties(
)->propertyTreeState, success); \ |
| 65 EXPECT_TRUE(success); \ |
| 66 \ |
| 67 LayoutRect expected = sourceLayoutObject->localOverflowRectForPaintInvalidat
ion(); \ |
| 68 sourceLayoutObject->mapToVisualRectInAncestorSpace(ancestorLayoutObject, exp
ected); \ |
| 69 EXPECT_EQ(expected, LayoutRect(actual)); \ |
| 70 } while (0); |
| 71 |
| 54 TEST_F(PaintPropertyTreeBuilderTest, FixedPosition) | 72 TEST_F(PaintPropertyTreeBuilderTest, FixedPosition) |
| 55 { | 73 { |
| 56 loadTestData("fixed-position.html"); | 74 loadTestData("fixed-position.html"); |
| 57 | 75 |
| 58 FrameView* frameView = document().view(); | 76 FrameView* frameView = document().view(); |
| 59 | 77 |
| 60 // target1 is a fixed-position element inside an absolute-position scrolling
element. | 78 // target1 is a fixed-position element inside an absolute-position scrolling
element. |
| 61 // It should be attached under the viewport to skip scrolling and offset of
the parent. | 79 // It should be attached under the viewport to skip scrolling and offset of
the parent. |
| 62 Element* target1 = document().getElementById("target1"); | 80 Element* target1 = document().getElementById("target1"); |
| 63 ObjectPaintProperties* target1Properties = target1->layoutObject()->objectPa
intProperties(); | 81 ObjectPaintProperties* target1Properties = target1->layoutObject()->objectPa
intProperties(); |
| 64 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai
ntOffsetTranslation()->matrix()); | 82 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai
ntOffsetTranslation()->matrix()); |
| 65 EXPECT_EQ(frameView->preTranslation(), target1Properties->paintOffsetTransla
tion()->parent()); | 83 EXPECT_EQ(frameView->preTranslation(), target1Properties->paintOffsetTransla
tion()->parent()); |
| 66 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov
erflowClip()->localTransformSpace()); | 84 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov
erflowClip()->localTransformSpace()); |
| 67 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip(
)->clipRect()); | 85 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip(
)->clipRect()); |
| 68 // Likewise, it inherits clip from the viewport, skipping overflow clip of t
he scroller. | 86 // Likewise, it inherits clip from the viewport, skipping overflow clip of t
he scroller. |
| 69 EXPECT_EQ(frameView->contentClip(), target1Properties->overflowClip()->paren
t()); | 87 EXPECT_EQ(frameView->contentClip(), target1Properties->overflowClip()->paren
t()); |
| 70 | 88 |
| 71 // target2 is a fixed-position element inside a transformed scrolling elemen
t. | 89 // target2 is a fixed-position element inside a transformed scrolling elemen
t. |
| 72 // It should be attached under the scrolled box of the transformed element. | 90 // It should be attached under the scrolled box of the transformed element. |
| 73 Element* target2 = document().getElementById("target2"); | 91 Element* target2 = document().getElementById("target2"); |
| 74 ObjectPaintProperties* target2Properties = target2->layoutObject()->objectPa
intProperties(); | 92 ObjectPaintProperties* target2Properties = target2->layoutObject()->objectPa
intProperties(); |
| 75 Element* scroller = document().getElementById("scroller"); | 93 Element* scroller = document().getElementById("scroller"); |
| 76 ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->object
PaintProperties(); | 94 ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->object
PaintProperties(); |
| 77 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai
ntOffsetTranslation()->matrix()); | 95 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai
ntOffsetTranslation()->matrix()); |
| 78 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO
ffsetTranslation()->parent()); | 96 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO
ffsetTranslation()->parent()); |
| 79 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov
erflowClip()->localTransformSpace()); | 97 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov
erflowClip()->localTransformSpace()); |
| 80 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip(
)->clipRect()); | 98 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip(
)->clipRect()); |
| 81 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli
p()->parent()); | 99 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli
p()->parent()); |
| 100 |
| 101 CHECK_VISUAL_RECT(target1->layoutObject(), frameView->layoutView()); |
| 82 } | 102 } |
| 83 | 103 |
| 84 TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll) | 104 TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll) |
| 85 { | 105 { |
| 86 loadTestData("position-and-scroll.html"); | 106 loadTestData("position-and-scroll.html"); |
| 87 | 107 |
| 88 Element* scroller = document().getElementById("scroller"); | 108 Element* scroller = document().getElementById("scroller"); |
| 89 scroller->scrollTo(0, 100); | 109 scroller->scrollTo(0, 100); |
| 90 FrameView* frameView = document().view(); | 110 FrameView* frameView = document().view(); |
| 91 frameView->updateAllLifecyclePhases(); | 111 frameView->updateAllLifecyclePhases(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 "<div id='nodeWithoutOpacity'>" | 229 "<div id='nodeWithoutOpacity'>" |
| 210 " <div id='childWithOpacity' style='opacity: 0.5'>" | 230 " <div id='childWithOpacity' style='opacity: 0.5'>" |
| 211 " <div id='grandChildWithoutOpacity'>" | 231 " <div id='grandChildWithoutOpacity'>" |
| 212 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2'/>" | 232 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2'/>" |
| 213 " </div>" | 233 " </div>" |
| 214 " </div>" | 234 " </div>" |
| 215 "</div>"); | 235 "</div>"); |
| 216 | 236 |
| 217 LayoutObject& nodeWithoutOpacity = *document().getElementById("nodeWithoutOp
acity")->layoutObject(); | 237 LayoutObject& nodeWithoutOpacity = *document().getElementById("nodeWithoutOp
acity")->layoutObject(); |
| 218 ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpacity.obj
ectPaintProperties(); | 238 ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpacity.obj
ectPaintProperties(); |
| 219 EXPECT_EQ(nullptr, nodeWithoutOpacityProperties); | 239 EXPECT_NE(nullptr, nodeWithoutOpacityProperties); |
| 220 | 240 |
| 221 LayoutObject& childWithOpacity = *document().getElementById("childWithOpacit
y")->layoutObject(); | 241 LayoutObject& childWithOpacity = *document().getElementById("childWithOpacit
y")->layoutObject(); |
| 222 ObjectPaintProperties* childWithOpacityProperties = childWithOpacity.objectP
aintProperties(); | 242 ObjectPaintProperties* childWithOpacityProperties = childWithOpacity.objectP
aintProperties(); |
| 223 EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity()); | 243 EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity()); |
| 224 // childWithOpacity is the root effect node. | 244 // childWithOpacity is the root effect node. |
| 225 EXPECT_NE(nullptr, childWithOpacityProperties->effect()->parent()); | 245 EXPECT_NE(nullptr, childWithOpacityProperties->effect()->parent()); |
| 226 | 246 |
| 227 LayoutObject& grandChildWithoutOpacity = *document().getElementById("grandCh
ildWithoutOpacity")->layoutObject(); | 247 LayoutObject& grandChildWithoutOpacity = *document().getElementById("grandCh
ildWithoutOpacity")->layoutObject(); |
| 228 EXPECT_EQ(nullptr, grandChildWithoutOpacity.objectPaintProperties()); | 248 EXPECT_NE(nullptr, grandChildWithoutOpacity.objectPaintProperties()); |
| 229 | 249 |
| 230 LayoutObject& greatGrandChildWithOpacity = *document().getElementById("great
GrandChildWithOpacity")->layoutObject(); | 250 LayoutObject& greatGrandChildWithOpacity = *document().getElementById("great
GrandChildWithOpacity")->layoutObject(); |
| 231 ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGrandChil
dWithOpacity.objectPaintProperties(); | 251 ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGrandChil
dWithOpacity.objectPaintProperties(); |
| 232 EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity()); | 252 EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity()); |
| 233 EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityPr
operties->effect()->parent()); | 253 EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityPr
operties->effect()->parent()); |
| 234 } | 254 } |
| 235 | 255 |
| 236 TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) | 256 TEST_F(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) |
| 237 { | 257 { |
| 238 setBodyInnerHTML( | 258 setBodyInnerHTML( |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 " <div id='child' style='position:relative;'></div>" | 746 " <div id='child' style='position:relative;'></div>" |
| 727 " <div style='height:10000px;'></div>" | 747 " <div style='height:10000px;'></div>" |
| 728 "</div>" | 748 "</div>" |
| 729 ); | 749 ); |
| 730 | 750 |
| 731 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); | 751 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); |
| 732 ObjectPaintProperties* scrollerProperties = scroller.objectPaintProperties()
; | 752 ObjectPaintProperties* scrollerProperties = scroller.objectPaintProperties()
; |
| 733 LayoutObject& child = *document().getElementById("child")->layoutObject(); | 753 LayoutObject& child = *document().getElementById("child")->layoutObject(); |
| 734 ObjectPaintProperties* childProperties = child.objectPaintProperties(); | 754 ObjectPaintProperties* childProperties = child.objectPaintProperties(); |
| 735 | 755 |
| 736 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->clip); | 756 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->propertyTreeState.clip); |
| 737 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->transform); | 757 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->propertyTreeState.transform); |
| 738 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->effect); | 758 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTree
State.effect); |
| 739 } | 759 } |
| 740 | 760 |
| 741 TEST_F(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) | 761 TEST_F(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) |
| 742 { | 762 { |
| 743 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 763 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 744 // for a (pseudo) stacking context that has a scrolling painting ancestor th
at is not its | 764 // for a (pseudo) stacking context that has a scrolling painting ancestor th
at is not its |
| 745 // containing block (thus should not be scrolled by it). | 765 // containing block (thus should not be scrolled by it). |
| 746 | 766 |
| 747 setBodyInnerHTML( | 767 setBodyInnerHTML( |
| 748 "<style>body { margin: 0; }</style>" | 768 "<style>body { margin: 0; }</style>" |
| 749 "<div id='scroller' style='overflow:scroll; opacity:0.5;'>" | 769 "<div id='scroller' style='overflow:scroll; opacity:0.5;'>" |
| 750 " <div id='child' style='position:absolute; left:0; top:0;'></div>" | 770 " <div id='child' style='position:absolute; left:0; top:0;'></div>" |
| 751 " <div style='height:10000px;'></div>" | 771 " <div style='height:10000px;'></div>" |
| 752 "</div>" | 772 "</div>" |
| 753 ); | 773 ); |
| 754 | 774 |
| 755 FrameView* frameView = document().view(); | 775 FrameView* frameView = document().view(); |
| 756 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); | 776 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); |
| 757 ObjectPaintProperties* scrollerProperties = scroller.objectPaintProperties()
; | 777 ObjectPaintProperties* scrollerProperties = scroller.objectPaintProperties()
; |
| 758 LayoutObject& child = *document().getElementById("child")->layoutObject(); | 778 LayoutObject& child = *document().getElementById("child")->layoutObject(); |
| 759 ObjectPaintProperties* childProperties = child.objectPaintProperties(); | 779 ObjectPaintProperties* childProperties = child.objectPaintProperties(); |
| 760 | 780 |
| 761 EXPECT_EQ(frameView->contentClip(), childProperties->localBorderBoxPropertie
s()->clip); | 781 EXPECT_EQ(frameView->contentClip(), childProperties->localBorderBoxPropertie
s()->propertyTreeState.clip); |
| 762 EXPECT_EQ(frameView->scrollTranslation(), childProperties->localBorderBoxPro
perties()->transform); | 782 EXPECT_EQ(frameView->scrollTranslation(), childProperties->localBorderBoxPro
perties()->propertyTreeState.transform); |
| 763 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->effect); | 783 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->propertyTreeState.effect); |
| 764 } | 784 } |
| 765 | 785 |
| 766 TEST_F(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) | 786 TEST_F(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) |
| 767 { | 787 { |
| 768 // This test verifies that the border box space of a table cell is being cor
rectly computed. | 788 // This test verifies that the border box space of a table cell is being cor
rectly computed. |
| 769 // Table cells have weird location adjustment in our layout/paint implementa
tion. | 789 // Table cells have weird location adjustment in our layout/paint implementa
tion. |
| 770 setBodyInnerHTML( | 790 setBodyInnerHTML( |
| 771 "<style>" | 791 "<style>" |
| 772 " body {" | 792 " body {" |
| 773 " margin: 0;" | 793 " margin: 0;" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 793 " <tr><td></td><td></td></tr>" | 813 " <tr><td></td><td></td></tr>" |
| 794 " <tr><td></td><td><div id='target'></div></td></tr>" | 814 " <tr><td></td><td><div id='target'></div></td></tr>" |
| 795 "</table>" | 815 "</table>" |
| 796 ); | 816 ); |
| 797 | 817 |
| 798 FrameView* frameView = document().view(); | 818 FrameView* frameView = document().view(); |
| 799 LayoutObject& target = *document().getElementById("target")->layoutObject(); | 819 LayoutObject& target = *document().getElementById("target")->layoutObject(); |
| 800 ObjectPaintProperties* targetProperties = target.objectPaintProperties(); | 820 ObjectPaintProperties* targetProperties = target.objectPaintProperties(); |
| 801 | 821 |
| 802 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); | 822 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); |
| 803 EXPECT_EQ(frameView->scrollTranslation(), targetProperties->localBorderBoxPr
operties()->transform); | 823 EXPECT_EQ(frameView->scrollTranslation(), targetProperties->localBorderBoxPr
operties()->propertyTreeState.transform); |
| 804 } | 824 } |
| 805 | 825 |
| 806 TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) | 826 TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
| 807 { | 827 { |
| 808 // This test verifies that clip tree hierarchy being generated correctly for
the hard case | 828 // This test verifies that clip tree hierarchy being generated correctly for
the hard case |
| 809 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. | 829 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. |
| 810 setBodyInnerHTML( | 830 setBodyInnerHTML( |
| 811 "<style>" | 831 "<style>" |
| 812 " #clip {" | 832 " #clip {" |
| 813 " position: absolute;" | 833 " position: absolute;" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 832 FrameView* frameView = document().view(); | 852 FrameView* frameView = document().view(); |
| 833 | 853 |
| 834 LayoutObject& clip = *document().getElementById("clip")->layoutObject(); | 854 LayoutObject& clip = *document().getElementById("clip")->layoutObject(); |
| 835 ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); | 855 ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
| 836 EXPECT_EQ(frameView->contentClip(), clipProperties->cssClip()->parent()); | 856 EXPECT_EQ(frameView->contentClip(), clipProperties->cssClip()->parent()); |
| 837 EXPECT_EQ(frameView->scrollTranslation(), clipProperties->cssClip()->localTr
ansformSpace()); | 857 EXPECT_EQ(frameView->scrollTranslation(), clipProperties->cssClip()->localTr
ansformSpace()); |
| 838 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 858 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 839 | 859 |
| 840 LayoutObject& fixed = *document().getElementById("fixed")->layoutObject(); | 860 LayoutObject& fixed = *document().getElementById("fixed")->layoutObject(); |
| 841 ObjectPaintProperties* fixedProperties = fixed.objectPaintProperties(); | 861 ObjectPaintProperties* fixedProperties = fixed.objectPaintProperties(); |
| 842 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->clip); | 862 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->propertyTreeState.clip); |
| 843 EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProper
ties()->transform->parent()); | 863 EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProper
ties()->propertyTreeState.transform->parent()); |
| 844 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->transform->matrix()); | 864 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->propertyTreeState.transform->matrix()); |
| 845 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); | 865 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); |
| 846 } | 866 } |
| 847 | 867 |
| 848 TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) | 868 TEST_F(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
| 849 { | 869 { |
| 850 // This test is similar to CSSClipFixedPositionDescendant above, except that | 870 // This test is similar to CSSClipFixedPositionDescendant above, except that |
| 851 // now we have a parent overflow clip that should be escaped by the fixed de
scendant. | 871 // now we have a parent overflow clip that should be escaped by the fixed de
scendant. |
| 852 setBodyInnerHTML( | 872 setBodyInnerHTML( |
| 853 "<style>" | 873 "<style>" |
| 854 " body {" | 874 " body {" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); | 911 ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
| 892 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); | 912 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); |
| 893 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); | 913 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); |
| 894 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 914 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 895 EXPECT_EQ(frameView->contentClip(), clipProperties->cssClipFixedPosition()->
parent()); | 915 EXPECT_EQ(frameView->contentClip(), clipProperties->cssClipFixedPosition()->
parent()); |
| 896 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); | 916 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); |
| 897 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); | 917 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); |
| 898 | 918 |
| 899 LayoutObject& fixed = *document().getElementById("fixed")->layoutObject(); | 919 LayoutObject& fixed = *document().getElementById("fixed")->layoutObject(); |
| 900 ObjectPaintProperties* fixedProperties = fixed.objectPaintProperties(); | 920 ObjectPaintProperties* fixedProperties = fixed.objectPaintProperties(); |
| 901 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord
erBoxProperties()->clip); | 921 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord
erBoxProperties()->propertyTreeState.clip); |
| 902 EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProper
ties()->transform->parent()); | 922 EXPECT_EQ(frameView->preTranslation(), fixedProperties->localBorderBoxProper
ties()->propertyTreeState.transform->parent()); |
| 903 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->transform->matrix()); | 923 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->propertyTreeState.transform->matrix()); |
| 904 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); | 924 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); |
| 905 } | 925 } |
| 906 | 926 |
| 907 TEST_F(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) | 927 TEST_F(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) |
| 908 { | 928 { |
| 909 setBodyInnerHTML( | 929 setBodyInnerHTML( |
| 910 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" | 930 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" |
| 911 " <div style='position: relative; top: 100px; left: 100px'>" | 931 " <div style='position: relative; top: 100px; left: 100px'>" |
| 912 " <div id='spanner' style='column-span: all; opacity: 0.5; width: 100
px; height: 100px;'></div>" | 932 " <div id='spanner' style='column-span: all; opacity: 0.5; width: 100
px; height: 100px;'></div>" |
| 913 " </div>" | 933 " </div>" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 // The residual subpixel adjustment should still be (-0.3,0). | 1080 // The residual subpixel adjustment should still be (-0.3,0). |
| 1061 EXPECT_EQ(subpixelAccumulation, fixedProperties->localBorderBoxProperties()-
>paintOffset); | 1081 EXPECT_EQ(subpixelAccumulation, fixedProperties->localBorderBoxProperties()-
>paintOffset); |
| 1062 | 1082 |
| 1063 // d should be painted starting at subpixelAccumulation + (0.7,0) = (0.4,0). | 1083 // d should be painted starting at subpixelAccumulation + (0.7,0) = (0.4,0). |
| 1064 LayoutPoint dPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.7
, 0)); | 1084 LayoutPoint dPaintOffset = subpixelAccumulation + LayoutPoint(FloatPoint(0.7
, 0)); |
| 1065 ObjectPaintProperties* dProperties = document().getElementById("d")->layoutO
bject()->objectPaintProperties(); | 1085 ObjectPaintProperties* dProperties = document().getElementById("d")->layoutO
bject()->objectPaintProperties(); |
| 1066 EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset
); | 1086 EXPECT_EQ(dPaintOffset, dProperties->localBorderBoxProperties()->paintOffset
); |
| 1067 } | 1087 } |
| 1068 | 1088 |
| 1069 } // namespace blink | 1089 } // namespace blink |
| OLD | NEW |