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

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

Issue 2504573002: Don't call isURLAllowed() from layout. (Closed)
Patch Set: Fix bad formatting that caused clang-format-diff to get confused. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/HTMLNames.h" 5 #include "core/HTMLNames.h"
6 #include "core/frame/FrameView.h" 6 #include "core/frame/FrameView.h"
7 #include "core/layout/LayoutTestHelper.h" 7 #include "core/layout/LayoutTestHelper.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/paint/PaintLayer.h" 9 #include "core/paint/PaintLayer.h"
10 #include "platform/graphics/GraphicsLayer.h" 10 #include "platform/graphics/GraphicsLayer.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 document().view()->setTracksPaintInvalidations(false); 309 document().view()->setTracksPaintInvalidations(false);
310 } 310 }
311 311
312 TEST_P(BoxPaintInvalidatorTest, NonCompositedLayoutViewResize) { 312 TEST_P(BoxPaintInvalidatorTest, NonCompositedLayoutViewResize) {
313 setBodyInnerHTML( 313 setBodyInnerHTML(
314 "<style>" 314 "<style>"
315 " body { margin: 0 }" 315 " body { margin: 0 }"
316 " iframe { display: block; width: 100px; height: 100px; border: none; }" 316 " iframe { display: block; width: 100px; height: 100px; border: none; }"
317 "</style>" 317 "</style>"
318 "<iframe id='iframe'></iframe>"); 318 "<iframe id='iframe'></iframe>");
319 Document& frameDocument = setupChildIframe( 319 setChildFrameHTML(
320 "iframe",
321 "<style>" 320 "<style>"
322 " ::-webkit-scrollbar { display: none }" 321 " ::-webkit-scrollbar { display: none }"
323 " body { margin: 0; background: green; height: 0 }" 322 " body { margin: 0; background: green; height: 0 }"
324 "</style>" 323 "</style>"
325 "<div id='content' style='width: 200px; height: 200px'></div>"); 324 "<div id='content' style='width: 200px; height: 200px'></div>");
326 document().view()->updateAllLifecyclePhases(); 325 document().view()->updateAllLifecyclePhases();
327 Element* iframe = document().getElementById("iframe"); 326 Element* iframe = document().getElementById("iframe");
328 Element* content = frameDocument.getElementById("content"); 327 Element* content = childDocument().getElementById("content");
329 EXPECT_EQ(layoutView(), 328 EXPECT_EQ(layoutView(),
330 content->layoutObject()->containerForPaintInvalidation()); 329 content->layoutObject()->containerForPaintInvalidation());
331 330
332 // Resize the content. 331 // Resize the content.
333 document().view()->setTracksPaintInvalidations(true); 332 document().view()->setTracksPaintInvalidations(true);
334 content->setAttribute(HTMLNames::styleAttr, "height: 500px"); 333 content->setAttribute(HTMLNames::styleAttr, "height: 500px");
335 document().view()->updateAllLifecyclePhases(); 334 document().view()->updateAllLifecyclePhases();
336 // No invalidation because the changed part of layout overflow is clipped. 335 // No invalidation because the changed part of layout overflow is clipped.
337 EXPECT_FALSE(getRasterInvalidationTracking()); 336 EXPECT_FALSE(getRasterInvalidationTracking());
338 document().view()->setTracksPaintInvalidations(false); 337 document().view()->setTracksPaintInvalidations(false);
(...skipping 24 matching lines...) Expand all
363 document().view()->setTracksPaintInvalidations(false); 362 document().view()->setTracksPaintInvalidations(false);
364 } 363 }
365 364
366 TEST_P(BoxPaintInvalidatorTest, NonCompositedLayoutViewGradientResize) { 365 TEST_P(BoxPaintInvalidatorTest, NonCompositedLayoutViewGradientResize) {
367 setBodyInnerHTML( 366 setBodyInnerHTML(
368 "<style>" 367 "<style>"
369 " body { margin: 0 }" 368 " body { margin: 0 }"
370 " iframe { display: block; width: 100px; height: 100px; border: none; }" 369 " iframe { display: block; width: 100px; height: 100px; border: none; }"
371 "</style>" 370 "</style>"
372 "<iframe id='iframe'></iframe>"); 371 "<iframe id='iframe'></iframe>");
373 Document& frameDocument = setupChildIframe( 372 setChildFrameHTML(
374 "iframe",
375 "<style>" 373 "<style>"
376 " ::-webkit-scrollbar { display: none }" 374 " ::-webkit-scrollbar { display: none }"
377 " body {" 375 " body {"
378 " margin: 0;" 376 " margin: 0;"
379 " height: 0;" 377 " height: 0;"
380 " background-image: linear-gradient(blue, yellow);" 378 " background-image: linear-gradient(blue, yellow);"
381 " }" 379 " }"
382 "</style>" 380 "</style>"
383 "<div id='content' style='width: 200px; height: 200px'></div>"); 381 "<div id='content' style='width: 200px; height: 200px'></div>");
384 document().view()->updateAllLifecyclePhases(); 382 document().view()->updateAllLifecyclePhases();
385 Element* iframe = document().getElementById("iframe"); 383 Element* iframe = document().getElementById("iframe");
386 Element* content = frameDocument.getElementById("content"); 384 Element* content = childDocument().getElementById("content");
387 LayoutView* frameLayoutView = content->layoutObject()->view(); 385 LayoutView* frameLayoutView = content->layoutObject()->view();
388 EXPECT_EQ(layoutView(), 386 EXPECT_EQ(layoutView(),
389 content->layoutObject()->containerForPaintInvalidation()); 387 content->layoutObject()->containerForPaintInvalidation());
390 388
391 // Resize the content. 389 // Resize the content.
392 document().view()->setTracksPaintInvalidations(true); 390 document().view()->setTracksPaintInvalidations(true);
393 content->setAttribute(HTMLNames::styleAttr, "height: 500px"); 391 content->setAttribute(HTMLNames::styleAttr, "height: 500px");
394 document().view()->updateAllLifecyclePhases(); 392 document().view()->updateAllLifecyclePhases();
395 const auto* rasterInvalidations = 393 const auto* rasterInvalidations =
396 &getRasterInvalidationTracking()->trackedRasterInvalidations; 394 &getRasterInvalidationTracking()->trackedRasterInvalidations;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 getRasterInvalidationTracking()->trackedRasterInvalidations; 565 getRasterInvalidationTracking()->trackedRasterInvalidations;
568 ASSERT_EQ(1u, rasterInvalidations.size()); 566 ASSERT_EQ(1u, rasterInvalidations.size());
569 EXPECT_EQ(IntRect(0, 120, 70, 120), rasterInvalidations[0].rect); 567 EXPECT_EQ(IntRect(0, 120, 70, 120), rasterInvalidations[0].rect);
570 EXPECT_EQ(static_cast<const DisplayItemClient*>(target->layoutObject()), 568 EXPECT_EQ(static_cast<const DisplayItemClient*>(target->layoutObject()),
571 rasterInvalidations[0].client); 569 rasterInvalidations[0].client);
572 EXPECT_EQ(PaintInvalidationIncremental, rasterInvalidations[0].reason); 570 EXPECT_EQ(PaintInvalidationIncremental, rasterInvalidations[0].reason);
573 document().view()->setTracksPaintInvalidations(false); 571 document().view()->setTracksPaintInvalidations(false);
574 } 572 }
575 573
576 } // namespace blink 574 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698