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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp

Issue 1895443003: Mark foregroundLayer under scrollingContentsLayer GraphicsLayerPaintOverflowContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositing/CompositedLayerMapping.h" 5 #include "core/layout/compositing/CompositedLayerMapping.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/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 // Scroll 3000 pixels down to bring the scrollable area to somewhere in the middle. 595 // Scroll 3000 pixels down to bring the scrollable area to somewhere in the middle.
596 frameDocument.view()->setScrollPosition(DoublePoint(0.0, 3000.0), Programmat icScroll); 596 frameDocument.view()->setScrollPosition(DoublePoint(0.0, 3000.0), Programmat icScroll);
597 document().view()->updateAllLifecyclePhases(); 597 document().view()->updateAllLifecyclePhases();
598 598
599 ASSERT_TRUE(frameDocument.view()->layoutView()->hasLayer()); 599 ASSERT_TRUE(frameDocument.view()->layoutView()->hasLayer());
600 // The width is 485 pixels due to the size of the scrollbar. 600 // The width is 485 pixels due to the size of the scrollbar.
601 EXPECT_RECT_EQ(IntRect(0, 0, 500, 7500), recomputeInterestRect(frameDocument .view()->layoutView()->enclosingLayer()->graphicsLayerBacking())); 601 EXPECT_RECT_EQ(IntRect(0, 0, 500, 7500), recomputeInterestRect(frameDocument .view()->layoutView()->enclosingLayer()->graphicsLayerBacking()));
602 } 602 }
603 603
604 TEST_F(CompositedLayerMappingTest, ScrollingContentsAndForegroundLayerPaintingPh ase)
605 {
606 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
607 setBodyInnerHTML(
608 "<div id='container' style='position: relative; z-index: 1; overflow: sc roll; width: 300px; height: 300px'>"
609 " <div id='negative-composited-child' style='background-color: red; w idth: 1px; height: 1px; position: absolute; backface-visibility: hidden; z-index : -1'></div>"
610 " <div style='background-color: blue; width: 2000px; height: 2000px; position: relative; top: 10px'></div>"
611 "</div>");
612
613 CompositedLayerMapping* mapping = toLayoutBlock(getLayoutObjectByElementId(" container"))->layer()->compositedLayerMapping();
614 ASSERT_TRUE(mapping->scrollingContentsLayer());
615 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow Contents | GraphicsLayerPaintCompositedScroll), mapping->scrollingContentsLayer( )->paintingPhase());
616 ASSERT_TRUE(mapping->foregroundLayer());
617 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintForegrou nd | GraphicsLayerPaintOverflowContents), mapping->foregroundLayer()->paintingPh ase());
618
619 Element* negativeCompositedChild = document().getElementById("negative-compo sited-child");
620 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild);
621 document().view()->updateAllLifecyclePhases();
622
623 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c ompositedLayerMapping();
624 ASSERT_TRUE(mapping->scrollingContentsLayer());
625 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m apping->scrollingContentsLayer()->paintingPhase());
626 EXPECT_FALSE(mapping->foregroundLayer());
627 }
628
604 } // namespace blink 629 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698