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

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

Issue 1899063002: Mark layer needsPaintPhaseFloat if a LayoutBlockFlow contains float (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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.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 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/layout/LayoutBlock.h"
6 #include "core/layout/LayoutInline.h"
5 #include "core/layout/compositing/CompositedLayerMapping.h" 7 #include "core/layout/compositing/CompositedLayerMapping.h"
6 #include "core/paint/PaintControllerPaintTest.h" 8 #include "core/paint/PaintControllerPaintTest.h"
7 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
8 10
9 namespace blink { 11 namespace blink {
10 12
11 class PaintLayerPainterTest 13 class PaintLayerPainterTest
12 : public PaintControllerPaintTest 14 : public PaintControllerPaintTest
13 , public testing::WithParamInterface<FrameSettingOverrideFunction> { 15 , public testing::WithParamInterface<FrameSettingOverrideFunction> {
14 USING_FAST_MALLOC(PaintLayerPainterTest); 16 USING_FAST_MALLOC(PaintLayerPainterTest);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 314
313 // needsPaintPhaseFloat should be set when any descendant on the same layer has float. 315 // needsPaintPhaseFloat should be set when any descendant on the same layer has float.
314 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith Float); 316 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith Float);
315 updateLifecyclePhasesBeforePaint(); 317 updateLifecyclePhasesBeforePaint();
316 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat()); 318 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat());
317 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); 319 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
318 paint(); 320 paint();
319 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), floatDiv, DisplayItem::BoxDecorationBackground)); 321 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), floatDiv, DisplayItem::BoxDecorationBackground));
320 } 322 }
321 323
324 TEST_P(PaintLayerPainterTest, PaintPhaseFloatUnderInlineLayer)
325 {
326 setBodyInnerHTML(
327 "<div id='self-painting-layer' style='position: absolute'>"
328 " <div id='non-self-painting-layer' style='overflow: hidden'>"
329 " <span id='span' style='position: relative'>"
330 " <div id='float' style='width: 10px; height: 10px; background-colo r: blue; float: left'></div>"
331 " </span>"
332 " </div>"
333 "</div>");
334 document().view()->updateAllLifecyclePhases();
335
336 LayoutObject& floatDiv = *document().getElementById("float")->layoutObject() ;
337 LayoutInline& span = *toLayoutInline(document().getElementById("span")->layo utObject());
338 PaintLayer& spanLayer = *span.layer();
339 ASSERT_TRUE(&spanLayer == floatDiv.enclosingLayer());
340 ASSERT_FALSE(spanLayer.needsPaintPhaseFloat());
341 LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementB yId("self-painting-layer")->layoutObject());
342 PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer();
343 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer());
344 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle mentById("non-self-painting-layer")->layoutObject())->layer();
345 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer());
346
347 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat());
348 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
349 EXPECT_FALSE(spanLayer.needsPaintPhaseFloat());
350 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), floatDiv, DisplayItem::BoxDecorationBackground));
351 }
352
322 TEST_P(PaintLayerPainterTest, PaintPhaseBlockBackground) 353 TEST_P(PaintLayerPainterTest, PaintPhaseBlockBackground)
323 { 354 {
324 AtomicString styleWithoutBackground = "width: 50px; height: 50px"; 355 AtomicString styleWithoutBackground = "width: 50px; height: 50px";
325 AtomicString styleWithBackground = "background: blue; " + styleWithoutBackgr ound; 356 AtomicString styleWithBackground = "background: blue; " + styleWithoutBackgr ound;
326 setBodyInnerHTML( 357 setBodyInnerHTML(
327 "<div id='self-painting-layer' style='position: absolute'>" 358 "<div id='self-painting-layer' style='position: absolute'>"
328 " <div id='non-self-painting-layer' style='overflow: hidden'>" 359 " <div id='non-self-painting-layer' style='overflow: hidden'>"
329 " <div>" 360 " <div>"
330 " <div id='background'></div>" 361 " <div id='background'></div>"
331 " </div>" 362 " </div>"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 document().view()->updateAllLifecyclePhases(); 445 document().view()->updateAllLifecyclePhases();
415 ASSERT_TRUE(layerDiv.hasLayer()); 446 ASSERT_TRUE(layerDiv.hasLayer());
416 PaintLayer& layer = *layerDiv.layer(); 447 PaintLayer& layer = *layerDiv.layer();
417 ASSERT_TRUE(layer.isSelfPaintingLayer()); 448 ASSERT_TRUE(layer.isSelfPaintingLayer());
418 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); 449 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines());
419 EXPECT_TRUE(layer.needsPaintPhaseFloat()); 450 EXPECT_TRUE(layer.needsPaintPhaseFloat());
420 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 451 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
421 } 452 }
422 453
423 } // namespace blink 454 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698