OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/LayoutText.h" |
8 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
9 #include "core/layout/compositing/LayerCompositor.h" | 10 #include "core/layout/compositing/LayerCompositor.h" |
10 #include "core/layout/line/InlineTextBox.h" | 11 #include "core/layout/line/InlineTextBox.h" |
11 #include "core/page/FocusController.h" | 12 #include "core/page/FocusController.h" |
12 #include "core/paint/LayerClipRecorder.h" | 13 #include "core/paint/LayerClipRecorder.h" |
13 #include "core/paint/LayerPainter.h" | 14 #include "core/paint/LayerPainter.h" |
14 #include "core/paint/RenderDrawingRecorder.h" | 15 #include "core/paint/RenderDrawingRecorder.h" |
15 #include "core/paint/ScopeRecorder.h" | 16 #include "core/paint/ScopeRecorder.h" |
16 #include "core/paint/SubtreeRecorder.h" | 17 #include "core/paint/SubtreeRecorder.h" |
17 #include "core/rendering/RenderText.h" | |
18 #include "platform/graphics/GraphicsContext.h" | 18 #include "platform/graphics/GraphicsContext.h" |
19 #include "platform/graphics/GraphicsLayer.h" | 19 #include "platform/graphics/GraphicsLayer.h" |
20 #include "platform/graphics/paint/DisplayItemList.h" | 20 #include "platform/graphics/paint/DisplayItemList.h" |
21 #include "platform/graphics/paint/DrawingDisplayItem.h" | 21 #include "platform/graphics/paint/DrawingDisplayItem.h" |
22 #include "third_party/skia/include/core/SkCanvas.h" | 22 #include "third_party/skia/include/core/SkCanvas.h" |
23 #include <gtest/gtest.h> | 23 #include <gtest/gtest.h> |
24 | 24 |
25 namespace blink { | 25 namespace blink { |
26 | 26 |
27 class ViewDisplayListTest : public RenderingTest { | 27 class ViewDisplayListTest : public RenderingTest { |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(false); | 429 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(false); |
430 | 430 |
431 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); | 431 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); |
432 document().page()->focusController().setActive(true); | 432 document().page()->focusController().setActive(true); |
433 document().page()->focusController().setFocused(true); | 433 document().page()->focusController().setFocused(true); |
434 LayoutView* layoutView = document().layoutView(); | 434 LayoutView* layoutView = document().layoutView(); |
435 Layer* rootLayer = layoutView->layer(); | 435 Layer* rootLayer = layoutView->layer(); |
436 LayoutObject* htmlRenderer = document().documentElement()->renderer(); | 436 LayoutObject* htmlRenderer = document().documentElement()->renderer(); |
437 Element* div = toElement(document().body()->firstChild()); | 437 Element* div = toElement(document().body()->firstChild()); |
438 LayoutObject* divRenderer = document().body()->firstChild()->renderer(); | 438 LayoutObject* divRenderer = document().body()->firstChild()->renderer(); |
439 InlineTextBox* textInlineBox = toRenderText(div->firstChild()->renderer())->
firstTextBox(); | 439 InlineTextBox* textInlineBox = toLayoutText(div->firstChild()->renderer())->
firstTextBox(); |
440 | 440 |
441 SkCanvas canvas(800, 600); | 441 SkCanvas canvas(800, 600); |
442 GraphicsContext context(&canvas, &rootDisplayItemList()); | 442 GraphicsContext context(&canvas, &rootDisplayItemList()); |
443 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB
ehaviorNormal, LayoutSize()); | 443 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB
ehaviorNormal, LayoutSize()); |
444 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay
erPaintingCompositingAllPhases); | 444 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay
erPaintingCompositingAllPhases); |
445 rootDisplayItemList().endNewPaints(); | 445 rootDisplayItemList().endNewPaints(); |
446 | 446 |
447 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, | 447 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, |
448 TestDisplayItem(htmlRenderer, DisplayItem::BoxDecorationBackground), | 448 TestDisplayItem(htmlRenderer, DisplayItem::BoxDecorationBackground), |
449 TestDisplayItem(textInlineBox->displayItemClient(), DisplayItem::paintPh
aseToDrawingType(PaintPhaseForeground))); | 449 TestDisplayItem(textInlineBox->displayItemClient(), DisplayItem::paintPh
aseToDrawingType(PaintPhaseForeground))); |
(...skipping 15 matching lines...) Expand all Loading... |
465 | 465 |
466 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); | 466 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); |
467 document().page()->focusController().setActive(true); | 467 document().page()->focusController().setActive(true); |
468 document().page()->focusController().setFocused(true); | 468 document().page()->focusController().setFocused(true); |
469 LayoutView* layoutView = document().layoutView(); | 469 LayoutView* layoutView = document().layoutView(); |
470 Layer* rootLayer = layoutView->layer(); | 470 Layer* rootLayer = layoutView->layer(); |
471 LayoutObject* htmlRenderer = document().documentElement()->renderer(); | 471 LayoutObject* htmlRenderer = document().documentElement()->renderer(); |
472 LayoutObject* bodyRenderer = document().body()->renderer(); | 472 LayoutObject* bodyRenderer = document().body()->renderer(); |
473 Element* div = toElement(document().body()->firstChild()); | 473 Element* div = toElement(document().body()->firstChild()); |
474 LayoutObject* divRenderer = document().body()->firstChild()->renderer(); | 474 LayoutObject* divRenderer = document().body()->firstChild()->renderer(); |
475 InlineTextBox* textInlineBox = toRenderText(div->firstChild()->renderer())->
firstTextBox(); | 475 InlineTextBox* textInlineBox = toLayoutText(div->firstChild()->renderer())->
firstTextBox(); |
476 | 476 |
477 SkCanvas canvas(800, 600); | 477 SkCanvas canvas(800, 600); |
478 GraphicsContext context(&canvas, &rootDisplayItemList()); | 478 GraphicsContext context(&canvas, &rootDisplayItemList()); |
479 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB
ehaviorNormal, LayoutSize()); | 479 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB
ehaviorNormal, LayoutSize()); |
480 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay
erPaintingCompositingAllPhases); | 480 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay
erPaintingCompositingAllPhases); |
481 rootDisplayItemList().endNewPaints(); | 481 rootDisplayItemList().endNewPaints(); |
482 | 482 |
483 EXPECT_EQ((size_t)10, rootDisplayItemList().paintList().size()); | 483 EXPECT_EQ((size_t)10, rootDisplayItemList().paintList().size()); |
484 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 10, | 484 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 10, |
485 TestDisplayItem(htmlRenderer, DisplayItem::paintPhaseToBeginSubtreeType(
PaintPhaseBlockBackground)), | 485 TestDisplayItem(htmlRenderer, DisplayItem::paintPhaseToBeginSubtreeType(
PaintPhaseBlockBackground)), |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4, | 751 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4, |
752 TestDisplayItem(multicol, DisplayItem::paintPhaseToDrawingType(PaintPhas
eBlockBackground)), | 752 TestDisplayItem(multicol, DisplayItem::paintPhaseToDrawingType(PaintPhas
eBlockBackground)), |
753 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase
Foreground)), | 753 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase
Foreground)), |
754 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase
Foreground)), | 754 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase
Foreground)), |
755 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase
Foreground))); | 755 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase
Foreground))); |
756 EXPECT_NE(picture1, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p
aintList()[1].get())->picture()); | 756 EXPECT_NE(picture1, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p
aintList()[1].get())->picture()); |
757 EXPECT_NE(picture2, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p
aintList()[2].get())->picture()); | 757 EXPECT_NE(picture2, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p
aintList()[2].get())->picture()); |
758 } | 758 } |
759 | 759 |
760 } // namespace blink | 760 } // namespace blink |
OLD | NEW |