Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2379753003: [SPInvalidation] Fix paint offset issue of descendants of composited svg root (Closed)
Patch Set: update tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/paint/PaintPropertyTreePrinter.h" 9 #include "core/paint/PaintPropertyTreePrinter.h"
10 #include "platform/graphics/paint/GeometryMapper.h" 10 #include "platform/graphics/paint/GeometryMapper.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Settings::setMockScrollbarsEnabled(false); 88 Settings::setMockScrollbarsEnabled(false);
89 } 89 }
90 }; 90 };
91 91
92 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl opFactor) \ 92 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl opFactor) \
93 do { \ 93 do { \
94 GeometryMapper geometryMapper; \ 94 GeometryMapper geometryMapper; \
95 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio n()); \ 95 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio n()); \
96 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP roperties()->paintOffset); \ 96 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP roperties()->paintOffset); \
97 bool success = false; \ 97 bool success = false; \
98 GeometryPropertyTreeState contentsProperties; \ 98 GeometryPropertyTreeState contentsTreeState; \
99 (ancestorLayoutObject)->objectPaintProperties()->getContentsProperties(conte ntsProperties); \ 99 LayoutPoint paintOffsetFromContentsTreeState; \
100 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ 100 (ancestorLayoutObject)->objectPaintProperties()->getContentsPropertyTreeStat e(contentsTreeState, paintOffsetFromContentsTreeState); \
101 LayoutRect actual = LayoutRect(geometryMapper.mapToVisualRectInDestinationSp ace( \
101 FloatRect(source), \ 102 FloatRect(source), \
102 (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties( )->geometryPropertyTreeState, \ 103 (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties( )->geometryPropertyTreeState, \
103 contentsProperties, success); \ 104 contentsTreeState, success)); \
104 ASSERT_TRUE(success); \ 105 ASSERT_TRUE(success); \
105 EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << e xpected.toString() << ", actual: " << actual.toString(); \ 106 actual.moveBy(-paintOffsetFromContentsTreeState); \
107 EXPECT_EQ(expected, actual) << "GeometryMapper: expected: " << expected.toSt ring() << ", actual: " << actual.toString(); \
106 \ 108 \
107 if (slopFactor == LayoutUnit::max()) \ 109 if (slopFactor == LayoutUnit::max()) \
108 break; \ 110 break; \
109 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv alidation(); \ 111 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv alidation(); \
110 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s lowPathRect); \ 112 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s lowPathRect); \
111 if (slopFactor) { \ 113 if (slopFactor) { \
112 LayoutRect inflatedActual = LayoutRect(actual); \ 114 LayoutRect inflatedActual = LayoutRect(actual); \
113 inflatedActual.inflate(slopFactor); \ 115 inflatedActual.inflate(slopFactor); \
114 SCOPED_TRACE(String::format("Old path rect: %s, Actual: %s, Inflated act ual: %s", slowPathRect.toString().ascii().data(), actual.toString().ascii().data (), inflatedActual.toString().ascii().data())); \ 116 SCOPED_TRACE(String::format("Old path rect: %s, Actual: %s, Inflated act ual: %s", slowPathRect.toString().ascii().data(), actual.toString().ascii().data (), inflatedActual.toString().ascii().data())); \
115 EXPECT_TRUE(slowPathRect.contains(LayoutRect(actual))); \ 117 EXPECT_TRUE(slowPathRect.contains(LayoutRect(actual))); \
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 1609
1608 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties()); 1610 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties());
1609 EXPECT_EQ(cTransformNode, cProperties->transform()); 1611 EXPECT_EQ(cTransformNode, cProperties->transform());
1610 EXPECT_EQ(bTransformNode, cTransformNode->parent()); 1612 EXPECT_EQ(bTransformNode, cTransformNode->parent());
1611 1613
1612 CHECK_EXACT_VISUAL_RECT(LayoutRect(33, 44, 50, 60), a->layoutObject(), frame View->layoutView()); 1614 CHECK_EXACT_VISUAL_RECT(LayoutRect(33, 44, 50, 60), a->layoutObject(), frame View->layoutView());
1613 CHECK_EXACT_VISUAL_RECT(LayoutRect(37, 49, 50, 20), b->layoutObject(), frame View->layoutView()); 1615 CHECK_EXACT_VISUAL_RECT(LayoutRect(37, 49, 50, 20), b->layoutObject(), frame View->layoutView());
1614 CHECK_EXACT_VISUAL_RECT(LayoutRect(114, 137, 10, 20), c->layoutObject(), fra meView->layoutView()); 1616 CHECK_EXACT_VISUAL_RECT(LayoutRect(114, 137, 10, 20), c->layoutObject(), fra meView->layoutView());
1615 } 1617 }
1616 1618
1617 TEST_P(PaintPropertyTreeBuilderTest, OverflowClipContentsProperties) 1619 TEST_P(PaintPropertyTreeBuilderTest, OverflowClipContentsTreeState)
1618 { 1620 {
1619 // This test verifies the tree builder correctly computes and records the pr operty tree context 1621 // This test verifies the tree builder correctly computes and records the pr operty tree context
1620 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of 1622 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of
1621 // the painting ancestors. 1623 // the painting ancestors.
1622 setBodyInnerHTML( 1624 setBodyInnerHTML(
1623 "<style>body { margin: 0; }</style>" 1625 "<style>body { margin: 20px 30px; }</style>"
1624 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" 1626 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>"
1625 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>" 1627 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>"
1626 "</div>" 1628 "</div>"
1627 ); 1629 );
1628 1630
1629 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject()); 1631 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject());
1630 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties (); 1632 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties ();
1631 LayoutObject* child = document().getElementById("child")->layoutObject(); 1633 LayoutObject* child = document().getElementById("child")->layoutObject();
1632 const ObjectPaintProperties* childProperties = child->objectPaintProperties( ); 1634 const ObjectPaintProperties* childProperties = child->objectPaintProperties( );
1633 1635
1634 // No scroll translation because the document does not scroll (not enough co ntent). 1636 // No scroll translation because the document does not scroll (not enough co ntent).
1635 EXPECT_TRUE(!frameScrollTranslation()); 1637 EXPECT_TRUE(!frameScrollTranslation());
1636 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()- >geometryPropertyTreeState.transform); 1638 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()- >geometryPropertyTreeState.transform);
1637 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip); 1639 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip);
1638 1640
1639 GeometryPropertyTreeState contentsProperties; 1641 GeometryPropertyTreeState contentsTreeState;
1640 clipProperties->getContentsProperties(contentsProperties); 1642 LayoutPoint paintOffsetFromContentsTreeState;
1641 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); 1643 clipProperties->getContentsPropertyTreeState(contentsTreeState, paintOffsetF romContentsTreeState);
1642 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); 1644 EXPECT_EQ(LayoutPoint(30, 20), paintOffsetFromContentsTreeState);
1645 EXPECT_EQ(framePreTranslation(), contentsTreeState.transform);
1646 EXPECT_EQ(clipProperties->overflowClip(), contentsTreeState.clip);
1643 1647
1644 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties() ->geometryPropertyTreeState.transform); 1648 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties() ->geometryPropertyTreeState.transform);
1645 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip); 1649 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip);
1646 1650
1647 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp ertyTreeState.effect); 1651 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp ertyTreeState.effect);
1648 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); 1652 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper);
1649 } 1653 }
1650 1654
1651 TEST_P(PaintPropertyTreeBuilderTest, ContainsPaintContentsProperties) 1655 TEST_P(PaintPropertyTreeBuilderTest, ContainsPaintContentsTreeState)
1652 { 1656 {
1653 setBodyInnerHTML( 1657 setBodyInnerHTML(
1654 "<style>body { margin: 0; }</style>" 1658 "<style>body { margin: 20px 30px; }</style>"
1655 "<div id='clipper' style='contain:paint; width:400px; height:300px;'>" 1659 "<div id='clipper' style='contain:paint; width:300px; height:200px;'>"
1656 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>" 1660 " <div id='child' style='position:relative; width:400px; height: 500px; '></div>"
1657 "</div>" 1661 "</div>"
1658 ); 1662 );
1659 1663
1660 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject()); 1664 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject());
1661 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties (); 1665 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties ();
1662 LayoutObject* child = document().getElementById("child")->layoutObject(); 1666 LayoutObject* child = document().getElementById("child")->layoutObject();
1663 const ObjectPaintProperties* childProperties = child->objectPaintProperties( ); 1667 const ObjectPaintProperties* childProperties = child->objectPaintProperties( );
1664 1668
1665 // No scroll translation because the document does not scroll (not enough co ntent). 1669 // No scroll translation because the document does not scroll (not enough co ntent).
1666 EXPECT_TRUE(!frameScrollTranslation()); 1670 EXPECT_TRUE(!frameScrollTranslation());
1667 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()- >geometryPropertyTreeState.transform); 1671 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()- >geometryPropertyTreeState.transform);
1668 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip); 1672 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip);
1669 1673
1670 GeometryPropertyTreeState contentsProperties; 1674 GeometryPropertyTreeState contentsTreeState;
1671 clipProperties->getContentsProperties(contentsProperties); 1675 LayoutPoint paintOffsetFromContentsTreeState;
1672 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); 1676 clipProperties->getContentsPropertyTreeState(contentsTreeState, paintOffsetF romContentsTreeState);
1673 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); 1677 EXPECT_EQ(LayoutPoint(30, 20), paintOffsetFromContentsTreeState);
1678 EXPECT_EQ(framePreTranslation(), contentsTreeState.transform);
1679 EXPECT_EQ(clipProperties->overflowClip(), contentsTreeState.clip);
1674 1680
1675 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties() ->geometryPropertyTreeState.transform); 1681 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties() ->geometryPropertyTreeState.transform);
1676 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip); 1682 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip);
1677 1683
1678 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp ertyTreeState.effect); 1684 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp ertyTreeState.effect);
1679 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); 1685 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 500), child, clipper);
1680 } 1686 }
1681 1687
1682 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) 1688 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsTreeState)
1683 { 1689 {
1684 // This test verifies the tree builder correctly computes and records the pr operty tree context 1690 // This test verifies the tree builder correctly computes and records the pr operty tree context
1685 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of 1691 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of
1686 // the painting ancestors. 1692 // the painting ancestors.
1687 setBodyInnerHTML( 1693 setBodyInnerHTML(
1688 "<style>body { margin: 0; }</style>" 1694 "<style>body { margin: 20px 30px; }</style>"
1689 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" 1695 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>"
1690 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>" 1696 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>"
1691 " <div style='width: 200px; height: 10000px'></div>" 1697 " <div style='width: 200px; height: 10000px'></div>"
1692 "</div>" 1698 "</div>"
1693 "<div id='forceScroll' style='height: 4000px;'></div>" 1699 "<div id='forceScroll' style='height: 4000px;'></div>"
1694 ); 1700 );
1695 1701
1696 Element* clipperElement = document().getElementById("clipper"); 1702 Element* clipperElement = document().getElementById("clipper");
1697 clipperElement->scrollTo(1, 2); 1703 clipperElement->scrollTo(1, 2);
1698 1704
1699 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou tObject()); 1705 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou tObject());
1700 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties (); 1706 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties ();
1701 LayoutObject* child = document().getElementById("child")->layoutObject(); 1707 LayoutObject* child = document().getElementById("child")->layoutObject();
1702 const ObjectPaintProperties* childProperties = child->objectPaintProperties( ); 1708 const ObjectPaintProperties* childProperties = child->objectPaintProperties( );
1703 1709
1704 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->geometryPropertyTreeState.transform); 1710 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->geometryPropertyTreeState.transform);
1705 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip); 1711 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip);
1706 1712
1707 GeometryPropertyTreeState contentsProperties; 1713 GeometryPropertyTreeState contentsTreeState;
1708 clipProperties->getContentsProperties(contentsProperties); 1714 LayoutPoint paintOffsetFromContentsTreeState;
1709 EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform) ; 1715 clipProperties->getContentsPropertyTreeState(contentsTreeState, paintOffsetF romContentsTreeState);
1710 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); 1716 EXPECT_EQ(LayoutPoint(30, 20), paintOffsetFromContentsTreeState);
1717 EXPECT_EQ(clipProperties->scrollTranslation(), contentsTreeState.transform);
1718 EXPECT_EQ(clipProperties->overflowClip(), contentsTreeState.clip);
1711 1719
1712 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB oxProperties()->geometryPropertyTreeState.transform); 1720 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB oxProperties()->geometryPropertyTreeState.transform);
1713 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip); 1721 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip);
1714 1722
1715 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); 1723 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper);
1716 } 1724 }
1717 1725
1718 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties) 1726 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsTreeState)
1719 { 1727 {
1720 // This test verifies the tree builder correctly computes and records the pr operty tree context 1728 // This test verifies the tree builder correctly computes and records the pr operty tree context
1721 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of 1729 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of
1722 // the painting ancestors. 1730 // the painting ancestors.
1723 setBodyInnerHTML( 1731 setBodyInnerHTML(
1724 "<style>body { margin: 0; }</style>" 1732 "<style>body { margin: 20px 30px; }</style>"
1725 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p x, 40px); width:400px; height:300px;'>" 1733 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p x, 40px); width:300px; height:200px;'>"
1726 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>" 1734 " <div id='child' style='position:relative; width:400px; height: 500px; '></div>"
1727 "</div>" 1735 "</div>"
1728 ); 1736 );
1729 1737
1730 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject()); 1738 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject());
1731 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties (); 1739 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties ();
1732 LayoutObject* child = document().getElementById("child")->layoutObject(); 1740 LayoutObject* child = document().getElementById("child")->layoutObject();
1733 1741
1734 // No scroll translation because the document does not scroll (not enough co ntent). 1742 // No scroll translation because the document does not scroll (not enough co ntent).
1735 EXPECT_TRUE(!frameScrollTranslation()); 1743 EXPECT_TRUE(!frameScrollTranslation());
1736 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()- >geometryPropertyTreeState.transform); 1744 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()- >geometryPropertyTreeState.transform);
1737 // CSS clip on an element causes it to clip itself, not just descendants. 1745 // CSS clip on an element causes it to clip itself, not just descendants.
1738 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie s()->geometryPropertyTreeState.clip); 1746 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie s()->geometryPropertyTreeState.clip);
1739 1747
1740 GeometryPropertyTreeState contentsProperties; 1748 GeometryPropertyTreeState contentsTreeState;
1741 clipProperties->getContentsProperties(contentsProperties); 1749 LayoutPoint paintOffsetFromContentsTreeState;
1742 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); 1750 clipProperties->getContentsPropertyTreeState(contentsTreeState, paintOffsetF romContentsTreeState);
1743 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); 1751 EXPECT_EQ(LayoutPoint(30, 20), paintOffsetFromContentsTreeState);
1752 EXPECT_EQ(framePreTranslation(), contentsTreeState.transform);
1753 EXPECT_EQ(clipProperties->cssClip(), contentsTreeState.clip);
1744 1754
1745 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); 1755 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 500), child, clipper);
1746 } 1756 }
1747 1757
1748 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert ies) 1758 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsTreeSta te)
1749 { 1759 {
1750 setBodyInnerHTML( 1760 setBodyInnerHTML(
1751 "<style>" 1761 "<style>"
1752 " body {" 1762 " body {"
1753 " margin: 0px;" 1763 " margin: 20px 30px;"
1754 " }" 1764 " }"
1755 " svg {" 1765 " svg {"
1756 " position: absolute;" 1766 " position: absolute;"
1757 " }" 1767 " }"
1758 " rect {" 1768 " rect {"
1759 " transform: translate(100px, 100px);" 1769 " transform: translate(100px, 100px);"
1760 " }" 1770 " }"
1761 "</style>" 1771 "</style>"
1762 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10 0 100'>" 1772 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10 0 100'>"
1763 " <rect id='rect' width='100px' height='100px' />" 1773 " <rect id='rect' width='100px' height='100px' />"
1764 "</svg>"); 1774 "</svg>");
1765 1775
1766 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")- >layoutObject(); 1776 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")- >layoutObject();
1767 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec tPaintProperties(); 1777 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec tPaintProperties();
1768 1778
1769 EXPECT_EQ(framePreTranslation(), svgWithViewBoxProperties->localBorderBoxPro perties()->geometryPropertyTreeState.transform); 1779 EXPECT_EQ(framePreTranslation(), svgWithViewBoxProperties->localBorderBoxPro perties()->geometryPropertyTreeState.transform);
1770 1780
1771 GeometryPropertyTreeState contentsProperties; 1781 GeometryPropertyTreeState contentsTreeState;
1772 svgWithViewBoxProperties->getContentsProperties(contentsProperties); 1782 LayoutPoint paintOffsetFromContentsTreeState;
1773 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents Properties.transform); 1783 svgWithViewBoxProperties->getContentsPropertyTreeState(contentsTreeState, pa intOffsetFromContentsTreeState);
1784 EXPECT_EQ(LayoutPoint(), paintOffsetFromContentsTreeState);
1785 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents TreeState.transform);
1774 } 1786 }
1775 1787
1776 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) 1788 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties)
1777 { 1789 {
1778 setBodyInnerHTML( 1790 setBodyInnerHTML(
1779 "<style>" 1791 "<style>"
1780 " body {" 1792 " body {"
1781 " margin: 0px;" 1793 " margin: 0px;"
1782 " }" 1794 " }"
1783 " #overflowHidden {" 1795 " #overflowHidden {"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 2162
2151 // Removing a main thread scrolling reason should update the entire tree. 2163 // Removing a main thread scrolling reason should update the entire tree.
2152 overflowB->removeAttribute("class"); 2164 overflowB->removeAttribute("class");
2153 document().view()->updateAllLifecyclePhases(); 2165 document().view()->updateAllLifecyclePhases();
2154 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment FixedObjects)); 2166 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment FixedObjects));
2155 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment FixedObjects)); 2167 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment FixedObjects));
2156 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground AttachmentFixedObjects)); 2168 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground AttachmentFixedObjects));
2157 } 2169 }
2158 2170
2159 } // namespace blink 2171 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698