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

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

Issue 2595593002: Fix CSS clips cannot be correctly handled by composited scroller (Closed)
Patch Set: Add unit test && nit Created 3 years, 11 months 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/paint/PaintLayerScrollableArea.h" 5 #include "core/paint/PaintLayerScrollableArea.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutBoxModelObject.h" 8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 ASSERT_TRUE(whiteLayer); 455 ASSERT_TRUE(whiteLayer);
456 ASSERT_TRUE(blackLayer); 456 ASSERT_TRUE(blackLayer);
457 457
458 ASSERT_EQ(ScrollbarOverlayColorTheme::ScrollbarOverlayColorThemeDark, 458 ASSERT_EQ(ScrollbarOverlayColorTheme::ScrollbarOverlayColorThemeDark,
459 noneLayer->getScrollableArea()->getScrollbarOverlayColorTheme()); 459 noneLayer->getScrollableArea()->getScrollbarOverlayColorTheme());
460 ASSERT_EQ(ScrollbarOverlayColorTheme::ScrollbarOverlayColorThemeDark, 460 ASSERT_EQ(ScrollbarOverlayColorTheme::ScrollbarOverlayColorThemeDark,
461 whiteLayer->getScrollableArea()->getScrollbarOverlayColorTheme()); 461 whiteLayer->getScrollableArea()->getScrollbarOverlayColorTheme());
462 ASSERT_EQ(ScrollbarOverlayColorTheme::ScrollbarOverlayColorThemeLight, 462 ASSERT_EQ(ScrollbarOverlayColorTheme::ScrollbarOverlayColorThemeLight,
463 blackLayer->getScrollableArea()->getScrollbarOverlayColorTheme()); 463 blackLayer->getScrollableArea()->getScrollbarOverlayColorTheme());
464 } 464 }
465
466 // Test that css clip applied to the scroller will cause the
467 // scrolling contents layer to not be promoted.
468 TEST_F(PaintLayerScrollableAreaTest,
469 OnlyAutoClippedScrollingContentsLayerPromoted) {
470 setBodyInnerHTML(
471 "<style>"
472 ".clip { clip: rect(0px,60px,50px,0px); }"
473 "#scroller { position: absolute; overflow: auto;"
474 "height: 100px; width: 100px; background: grey;"
475 "will-change:transform; }"
476 "#scrolled { height: 300px; }"
477 "</style>"
478 "<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
479 document().view()->updateAllLifecyclePhases();
480
481 Element* scroller = document().getElementById("scroller");
482 PaintLayer* paintLayer =
483 toLayoutBoxModelObject(scroller->layoutObject())->layer();
484 ASSERT_TRUE(paintLayer);
485 EXPECT_TRUE(paintLayer->needsCompositedScrolling());
486
487 // Add clip to scroller.
488 scroller->setAttribute("class", "clip", ASSERT_NO_EXCEPTION);
489 document().view()->updateAllLifecyclePhases();
490 paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer();
491 ASSERT_TRUE(paintLayer);
492 EXPECT_FALSE(paintLayer->needsCompositedScrolling());
493
494 // Change the scroller to be auto clipped again.
495 scroller->removeAttribute("class");
496 document().view()->updateAllLifecyclePhases();
497 paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer();
498 ASSERT_TRUE(paintLayer);
499 EXPECT_TRUE(paintLayer->needsCompositedScrolling());
465 } 500 }
501 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698