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

Unified Diff: Source/core/paint/DisplayItemListPaintTest.cpp

Issue 1327563003: Don't cache subsequence whose layer is not fully contained by repaint rect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/DisplayItemListPaintTest.cpp
diff --git a/Source/core/paint/DisplayItemListPaintTest.cpp b/Source/core/paint/DisplayItemListPaintTest.cpp
index 13d142b5fc64a2ec75aecaed73d7ea14e96a0d34..a06132853543e1eda0b240bf50496434910a609d 100644
--- a/Source/core/paint/DisplayItemListPaintTest.cpp
+++ b/Source/core/paint/DisplayItemListPaintTest.cpp
@@ -9,9 +9,7 @@
#include "core/layout/line/InlineTextBox.h"
#include "core/page/FocusController.h"
#include "core/paint/DeprecatedPaintLayerPainter.h"
-#include "core/paint/LayerClipRecorder.h"
#include "core/paint/LayoutObjectDrawingRecorder.h"
-#include "core/paint/ScopeRecorder.h"
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/paint/DrawingDisplayItem.h"
@@ -92,6 +90,7 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, FullDocumentPaintingWithCaret
setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>XYZ</div>");
document().page()->focusController().setActive(true);
document().page()->focusController().setFocused(true);
+ DeprecatedPaintLayer& rootLayer = *layoutView().layer();
DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
Element& div = *toElement(document().body()->firstChild());
LayoutObject& divLayoutObject = *document().body()->firstChild()->layoutObject();
@@ -99,26 +98,31 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, FullDocumentPaintingWithCaret
document().view()->updateAllLifecyclePhases();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 4,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 6,
+ TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
- TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
+ TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence),
+ TestDisplayItem(rootLayer, DisplayItem::EndSubsequence));
div.focus();
document().view()->updateAllLifecyclePhases();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 5,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 7,
+ TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
TestDisplayItem(divLayoutObject, DisplayItem::Caret), // New!
- TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
+ TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence),
+ TestDisplayItem(rootLayer, DisplayItem::EndSubsequence));
}
TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
{
setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAAA BBBBBBBBBB</div>");
+ DeprecatedPaintLayer& rootLayer = *layoutView().layer();
DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
Element& div = *toElement(document().body()->firstChild());
LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layoutObject());
@@ -127,11 +131,13 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
document().view()->updateAllLifecyclePhases();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 4,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 6,
+ TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(firstTextBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
- TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
+ TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence),
+ TestDisplayItem(rootLayer, DisplayItem::EndSubsequence));
div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px");
document().view()->updateAllLifecyclePhases();
@@ -140,73 +146,14 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
InlineTextBox& newFirstTextBox = *newText.firstTextBox();
InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 5,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 7,
+ TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
- TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
-}
-
-TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequence)
-{
- setBodyInnerHTML(
- "<div id='container1' style='position: relative; width: 200px; height: 200px; background-color: blue'>"
- " <div id='content1' style='width: 100px; height: 100px; background-color: red'></div>"
- "</div>"
- "<div id='container2' style='position: relative; width: 200px; height: 200px; background-color: blue'>"
- " <div id='content2' style='width: 100px; height: 100px; background-color: green'></div>"
- "</div>");
- document().view()->updateAllLifecyclePhases();
-
- DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
- LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
- DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
- LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
- LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
- DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
- LayoutObject& content2 = *document().getElementById("content2")->layoutObject();
-
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 11,
- TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground),
- TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container1, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(content1, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(container1Layer, DisplayItem::EndSubsequence),
- TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container2, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(content2, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(container2Layer, DisplayItem::EndSubsequence),
- TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
-
- toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "width: 100px; height: 100px; background-color: green");
- updateLifecyclePhasesToPaintForSlimmingPaintV2Clean();
-
- EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(rootDisplayItemList().newDisplayItems(), 8,
- TestDisplayItem(layoutView(), DisplayItem::drawingTypeToCachedDrawingType(DisplayItem::BoxDecorationBackground)),
- TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container1, DisplayItem::drawingTypeToCachedDrawingType(DisplayItem::BoxDecorationBackground)),
- TestDisplayItem(content1, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(container1Layer, DisplayItem::EndSubsequence),
- TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence),
- TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
-
- compositeForSlimmingPaintV2();
-
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 11,
- TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground),
- TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container1, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(content1, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(container1Layer, DisplayItem::EndSubsequence),
- TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence),
- TestDisplayItem(container2, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(content2, DisplayItem::BoxDecorationBackground),
- TestDisplayItem(container2Layer, DisplayItem::EndSubsequence),
- TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
+ TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence),
+ TestDisplayItem(rootLayer, DisplayItem::EndSubsequence));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698