| 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/LayoutObject.h" | 5 #include "core/layout/LayoutObject.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | |
| 8 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 9 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 10 #include "core/layout/api/LayoutAPIShim.h" | 9 #include "core/layout/api/LayoutAPIShim.h" |
| 11 #include "platform/JSONValues.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 11 |
| 14 namespace blink { | 12 namespace blink { |
| 15 | 13 |
| 16 class LayoutObjectTest : public RenderingTest { | 14 class LayoutObjectTest : public RenderingTest { |
| 17 public: | 15 public: |
| 18 LayoutObjectTest() | 16 LayoutObjectTest() |
| 19 : RenderingTest(SingleChildFrameLoaderClient::create()) {} | 17 : RenderingTest(SingleChildFrameLoaderClient::create()) {} |
| 20 protected: | 18 protected: |
| 21 LayoutView& layoutView() const { return *toLayoutView(LayoutAPIShim::layoutO
bjectFrom(document().layoutViewItem())); } | 19 LayoutView& layoutView() const { return *toLayoutView(LayoutAPIShim::layoutO
bjectFrom(document().layoutViewItem())); } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 " <div style='column-span: all'>" | 117 " <div style='column-span: all'>" |
| 120 " <div id='overflow-clip-layer' style='height: 100px; overflow: hidde
n'></div>" | 118 " <div id='overflow-clip-layer' style='height: 100px; overflow: hidde
n'></div>" |
| 121 " </div>" | 119 " </div>" |
| 122 "</div>"); | 120 "</div>"); |
| 123 | 121 |
| 124 LayoutObject* overflowClipObject = getLayoutObjectByElementId("overflow-clip
-layer"); | 122 LayoutObject* overflowClipObject = getLayoutObjectByElementId("overflow-clip
-layer"); |
| 125 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns")); | 123 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns")); |
| 126 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer()); | 124 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer()); |
| 127 } | 125 } |
| 128 | 126 |
| 129 TEST_F(LayoutObjectTest, TraverseNonCompositingDescendantsInPaintOrder) | |
| 130 { | |
| 131 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 132 return; | |
| 133 | |
| 134 enableCompositing(); | |
| 135 setBodyInnerHTML( | |
| 136 "<style>div { width: 10px; height: 10px; background-color: green; }</sty
le>" | |
| 137 "<div id='container' style='position: fixed'>" | |
| 138 " <div id='normal-child'></div>" | |
| 139 " <div id='stacked-child' style='position: relative'></div>" | |
| 140 " <div id='composited-stacking-context' style='will-change: transform'>
" | |
| 141 " <div id='normal-child-of-composited-stacking-context'></div>" | |
| 142 " <div id='stacked-child-of-composited-stacking-context' style='posit
ion: relative'></div>" | |
| 143 " </div>" | |
| 144 " <div id='composited-non-stacking-context' style='backface-visibility:
hidden'>" | |
| 145 " <div id='normal-child-of-composited-non-stacking-context'></div>" | |
| 146 " <div id='stacked-child-of-composited-non-stacking-context' style='p
osition: relative'></div>" | |
| 147 " <div id='non-stacked-layered-child-of-composited-non-stacking-conte
xt' style='overflow: scroll'></div>" | |
| 148 " </div>" | |
| 149 "</div>"); | |
| 150 | |
| 151 document().view()->setTracksPaintInvalidations(true); | |
| 152 getLayoutObjectByElementId("container")->invalidateDisplayItemClientsIncludi
ngNonCompositingDescendants(PaintInvalidationSubtree); | |
| 153 RefPtr<JSONArray> invalidations = document().view()->trackedObjectPaintInval
idationsAsJSON(); | |
| 154 document().view()->setTracksPaintInvalidations(false); | |
| 155 | |
| 156 ASSERT_EQ(4u, invalidations->length()); | |
| 157 String s; | |
| 158 static_cast<JSONObject*>(invalidations->get(0).get())->get("object")->asStri
ng(&s); | |
| 159 EXPECT_EQ(getLayoutObjectByElementId("container")->debugName(), s); | |
| 160 static_cast<JSONObject*>(invalidations->get(1).get())->get("object")->asStri
ng(&s); | |
| 161 EXPECT_EQ(getLayoutObjectByElementId("normal-child")->debugName(), s); | |
| 162 static_cast<JSONObject*>(invalidations->get(2).get())->get("object")->asStri
ng(&s); | |
| 163 EXPECT_EQ(getLayoutObjectByElementId("stacked-child")->debugName(), s); | |
| 164 static_cast<JSONObject*>(invalidations->get(3).get())->get("object")->asStri
ng(&s); | |
| 165 EXPECT_EQ(getLayoutObjectByElementId("stacked-child-of-composited-non-stacki
ng-context")->debugName(), s); | |
| 166 } | |
| 167 | |
| 168 } // namespace blink | 127 } // namespace blink |
| OLD | NEW |