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