| 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/dom/Document.h" | 5 #include "core/dom/Document.h" |
| 6 #include "core/html/HTMLIFrameElement.h" | 6 #include "core/html/HTMLIFrameElement.h" |
| 7 #include "core/layout/LayoutView.h" | |
| 8 #include "core/paint/PaintLayer.h" | |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "web/tests/sim/SimCompositor.h" | 8 #include "web/tests/sim/SimCompositor.h" |
| 11 #include "web/tests/sim/SimDisplayItemList.h" | 9 #include "web/tests/sim/SimDisplayItemList.h" |
| 12 #include "web/tests/sim/SimRequest.h" | 10 #include "web/tests/sim/SimRequest.h" |
| 13 #include "web/tests/sim/SimTest.h" | 11 #include "web/tests/sim/SimTest.h" |
| 14 | 12 |
| 15 namespace blink { | 13 namespace blink { |
| 16 | 14 |
| 17 using namespace HTMLNames; | 15 using namespace HTMLNames; |
| 18 | 16 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // script that touched offsetTop in the child frame. | 263 // script that touched offsetTop in the child frame. |
| 266 auto* childFrame = toHTMLIFrameElement(document().getElementById("frame")); | 264 auto* childFrame = toHTMLIFrameElement(document().getElementById("frame")); |
| 267 childFrame->contentDocument()->updateLayoutIgnorePendingStylesheets(); | 265 childFrame->contentDocument()->updateLayoutIgnorePendingStylesheets(); |
| 268 | 266 |
| 269 auto frame2 = compositor().beginFrame(); | 267 auto frame2 = compositor().beginFrame(); |
| 270 | 268 |
| 271 // The child frame still has pending sheets, and the parent frame has no | 269 // The child frame still has pending sheets, and the parent frame has no |
| 272 // invalid paint so we shouldn't draw any text. | 270 // invalid paint so we shouldn't draw any text. |
| 273 EXPECT_FALSE(frame2.containsText()); | 271 EXPECT_FALSE(frame2.containsText()); |
| 274 | 272 |
| 275 LayoutView* iframeLayoutView = childFrame->contentDocument()->layoutView(); | |
| 276 const DisplayItemList& displayItemList = iframeLayoutView->layer()->graphics
LayerBacking()->getPaintController().getDisplayItemList(); | |
| 277 // Check that the DisplayItemList has no subsequene caching markers. These a
re not allowed in pending-style-sheets mode | |
| 278 // since otherwise caching would be incorrect. | |
| 279 ASSERT_EQ(2u, displayItemList.size()); | |
| 280 EXPECT_EQ(DisplayItem::DocumentBackground, displayItemList[0].getType()); | |
| 281 EXPECT_EQ(DisplayItem::BoxDecorationBackground, displayItemList[1].getType()
); | |
| 282 | |
| 283 // 1 for the main frame background (white), | 273 // 1 for the main frame background (white), |
| 284 // 1 for the iframe background (pink) | 274 // 1 for the iframe background (pink) |
| 285 // 1 for the composited transform layer in the iframe (green). | 275 // 1 for the composited transform layer in the iframe (green). |
| 286 // TODO(esprehn): Why FOUC the background (borders, etc.) of iframes and | 276 // TODO(esprehn): Why FOUC the background (borders, etc.) of iframes and |
| 287 // composited layers? Seems like a bug. | 277 // composited layers? Seems like a bug. |
| 288 EXPECT_EQ(3, frame2.drawCount()); | 278 EXPECT_EQ(3, frame2.drawCount()); |
| 289 EXPECT_TRUE(frame2.contains(SimCanvas::Rect, "white")); | 279 EXPECT_TRUE(frame2.contains(SimCanvas::Rect, "white")); |
| 290 EXPECT_TRUE(frame2.contains(SimCanvas::Rect, "pink")); | 280 EXPECT_TRUE(frame2.contains(SimCanvas::Rect, "pink")); |
| 291 EXPECT_TRUE(frame2.contains(SimCanvas::Rect, "green")); | 281 EXPECT_TRUE(frame2.contains(SimCanvas::Rect, "green")); |
| 292 | 282 |
| 293 // Finish loading the sheets in the child frame. After it should issue a | 283 // Finish loading the sheets in the child frame. After it should issue a |
| 294 // paint invalidation for every layer since frame2 painted them but skipped | 284 // paint invalidation for every layer since frame2 painted them but skipped |
| 295 // painting the real content to avoid FOUC. | 285 // painting the real content to avoid FOUC. |
| 296 cssResource.complete(); | 286 cssResource.complete(); |
| 297 | 287 |
| 298 // First frame where all frames are loaded, should paint the text in the | 288 // First frame where all frames are loaded, should paint the text in the |
| 299 // child frame. | 289 // child frame. |
| 300 auto frame3 = compositor().beginFrame(); | 290 auto frame3 = compositor().beginFrame(); |
| 301 EXPECT_TRUE(frame3.containsText()); | 291 EXPECT_TRUE(frame3.containsText()); |
| 302 } | 292 } |
| 303 | 293 |
| 304 } // namespace blink | 294 } // namespace blink |
| OLD | NEW |