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 "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 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 TEST_P(PaintPropertyTreeBuilderTest, SVGRootNoClip) | 2002 TEST_P(PaintPropertyTreeBuilderTest, SVGRootNoClip) |
2003 { | 2003 { |
2004 setBodyInnerHTML( | 2004 setBodyInnerHTML( |
2005 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' width='100px' height='
100px' style='overflow: visible'>" | 2005 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' width='100px' height='
100px' style='overflow: visible'>" |
2006 " <rect width='200' height='200' fill='red' />" | 2006 " <rect width='200' height='200' fill='red' />" |
2007 "</svg>"); | 2007 "</svg>"); |
2008 | 2008 |
2009 EXPECT_FALSE(getLayoutObjectByElementId("svg")->objectPaintProperties()->ove
rflowClip()); | 2009 EXPECT_FALSE(getLayoutObjectByElementId("svg")->objectPaintProperties()->ove
rflowClip()); |
2010 } | 2010 } |
2011 | 2011 |
| 2012 TEST_P(PaintPropertyTreeBuilderTest, MainThreadScrollReasonsWithNestedScrollers) |
| 2013 { |
| 2014 setBodyInnerHTML( |
| 2015 "<style>" |
| 2016 " #overflowA {" |
| 2017 " position: absolute;" |
| 2018 " overflow: scroll;" |
| 2019 " width: 20px;" |
| 2020 " height: 20px;" |
| 2021 " }" |
| 2022 " #overflowB {" |
| 2023 " position: absolute;" |
| 2024 " overflow: scroll;" |
| 2025 " width: 5px;" |
| 2026 " height: 3px;" |
| 2027 " }" |
| 2028 " .backgroundAttachmentFixed {" |
| 2029 " background-image: url('foo');" |
| 2030 " background-attachment: fixed;" |
| 2031 " }" |
| 2032 " .forceScroll {" |
| 2033 " height: 4000px;" |
| 2034 " }" |
| 2035 "</style>" |
| 2036 "<div id='overflowA'>" |
| 2037 " <div id='overflowB' class='backgroundAttachmentFixed'>" |
| 2038 " <div class='forceScroll'></div>" |
| 2039 " </div>" |
| 2040 " <div class='forceScroll'></div>" |
| 2041 "</div>" |
| 2042 "<div class='forceScroll'></div>"); |
| 2043 Element* overflowA = document().getElementById("overflowA"); |
| 2044 Element* overflowB = document().getElementById("overflowB"); |
| 2045 |
| 2046 EXPECT_TRUE(frameScroll()->hasMainThreadScrollingReasons(MainThreadScrolling
Reason::kHasBackgroundAttachmentFixedObjects)); |
| 2047 EXPECT_TRUE(overflowA->layoutObject()->objectPaintProperties()->scroll()->ha
sMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachmentF
ixedObjects)); |
| 2048 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2049 |
| 2050 // Removing a main thread scrolling reason should update the entire tree. |
| 2051 overflowB->removeAttribute("class"); |
| 2052 document().view()->updateAllLifecyclePhases(); |
| 2053 EXPECT_FALSE(frameScroll()->hasMainThreadScrollingReasons(MainThreadScrollin
gReason::kHasBackgroundAttachmentFixedObjects)); |
| 2054 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2055 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2056 |
| 2057 // Adding a main thread scrolling reason should update the entire tree. |
| 2058 overflowB->setAttribute(HTMLNames::classAttr, "backgroundAttachmentFixed"); |
| 2059 document().view()->updateAllLifecyclePhases(); |
| 2060 EXPECT_TRUE(frameScroll()->hasMainThreadScrollingReasons(MainThreadScrolling
Reason::kHasBackgroundAttachmentFixedObjects)); |
| 2061 EXPECT_TRUE(overflowA->layoutObject()->objectPaintProperties()->scroll()->ha
sMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachmentF
ixedObjects)); |
| 2062 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2063 } |
| 2064 |
| 2065 TEST_P(PaintPropertyTreeBuilderTest, MainThreadScrollReasonsWithFixedScroller) |
| 2066 { |
| 2067 setBodyInnerHTML( |
| 2068 "<style>" |
| 2069 " #overflowA {" |
| 2070 " position: absolute;" |
| 2071 " overflow: scroll;" |
| 2072 " width: 20px;" |
| 2073 " height: 20px;" |
| 2074 " }" |
| 2075 " #overflowB {" |
| 2076 " position: fixed;" |
| 2077 " overflow: scroll;" |
| 2078 " width: 5px;" |
| 2079 " height: 3px;" |
| 2080 " }" |
| 2081 " .backgroundAttachmentFixed {" |
| 2082 " background-image: url('foo');" |
| 2083 " background-attachment: fixed;" |
| 2084 " }" |
| 2085 " .forceScroll {" |
| 2086 " height: 4000px;" |
| 2087 " }" |
| 2088 "</style>" |
| 2089 "<div id='overflowA'>" |
| 2090 " <div id='overflowB' class='backgroundAttachmentFixed'>" |
| 2091 " <div class='forceScroll'></div>" |
| 2092 " </div>" |
| 2093 " <div class='forceScroll'></div>" |
| 2094 "</div>" |
| 2095 "<div class='forceScroll'></div>"); |
| 2096 Element* overflowA = document().getElementById("overflowA"); |
| 2097 Element* overflowB = document().getElementById("overflowB"); |
| 2098 |
| 2099 EXPECT_TRUE(rootScroll()->hasMainThreadScrollingReasons(MainThreadScrollingR
eason::kHasBackgroundAttachmentFixedObjects)); |
| 2100 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2101 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2102 |
| 2103 // Removing a main thread scrolling reason should update the entire tree. |
| 2104 overflowB->removeAttribute("class"); |
| 2105 document().view()->updateAllLifecyclePhases(); |
| 2106 EXPECT_FALSE(rootScroll()->hasMainThreadScrollingReasons(MainThreadScrolling
Reason::kHasBackgroundAttachmentFixedObjects)); |
| 2107 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2108 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2109 } |
| 2110 |
2012 } // namespace blink | 2111 } // namespace blink |
OLD | NEW |