| 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 "core/paint/PaintControllerPaintTest.h" | 5 #include "core/paint/PaintControllerPaintTest.h" |
| 6 | 6 |
| 7 #include "core/editing/FrameCaret.h" |
| 8 #include "core/editing/FrameSelection.h" |
| 7 #include "core/layout/LayoutText.h" | 9 #include "core/layout/LayoutText.h" |
| 8 #include "core/layout/line/InlineTextBox.h" | 10 #include "core/layout/line/InlineTextBox.h" |
| 9 #include "core/page/FocusController.h" | 11 #include "core/page/FocusController.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 11 #include "core/paint/ObjectPaintProperties.h" | 13 #include "core/paint/ObjectPaintProperties.h" |
| 12 #include "core/paint/PaintLayerPainter.h" | 14 #include "core/paint/PaintLayerPainter.h" |
| 13 #include "platform/graphics/GraphicsContext.h" | 15 #include "platform/graphics/GraphicsContext.h" |
| 14 #include "platform/graphics/paint/DrawingDisplayItem.h" | 16 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 15 | 17 |
| 16 namespace blink { | 18 namespace blink { |
| 17 | 19 |
| 18 INSTANTIATE_TEST_CASE_P(All, PaintControllerPaintTestForSlimmingPaintV1AndV2, ::
testing::Bool()); | 20 INSTANTIATE_TEST_CASE_P(All, PaintControllerPaintTestForSlimmingPaintV1AndV2, ::
testing::Bool()); |
| 19 | 21 |
| 20 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, FullDocumentPaintingWith
Caret) | 22 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, FullDocumentPaintingWith
Caret) |
| 21 { | 23 { |
| 22 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); | 24 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); |
| 23 document().page()->focusController().setActive(true); | 25 document().page()->focusController().setActive(true); |
| 24 document().page()->focusController().setFocused(true); | 26 document().page()->focusController().setFocused(true); |
| 25 Element& div = *toElement(document().body()->firstChild()); | 27 Element& div = *toElement(document().body()->firstChild()); |
| 26 LayoutObject& divLayoutObject = *document().body()->firstChild()->layoutObje
ct(); | |
| 27 InlineTextBox& textInlineBox = *toLayoutText(div.firstChild()->layoutObject(
))->firstTextBox(); | 28 InlineTextBox& textInlineBox = *toLayoutText(div.firstChild()->layoutObject(
))->firstTextBox(); |
| 28 | 29 |
| 29 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, | 30 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, |
| 30 TestDisplayItem(layoutView(), documentBackgroundType), | 31 TestDisplayItem(layoutView(), documentBackgroundType), |
| 31 TestDisplayItem(textInlineBox, foregroundType)); | 32 TestDisplayItem(textInlineBox, foregroundType)); |
| 32 | 33 |
| 33 div.focus(); | 34 div.focus(); |
| 34 document().view()->updateAllLifecyclePhases(); | 35 document().view()->updateAllLifecyclePhases(); |
| 35 | 36 |
| 36 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, | 37 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, |
| 37 TestDisplayItem(layoutView(), documentBackgroundType), | 38 TestDisplayItem(layoutView(), documentBackgroundType), |
| 38 TestDisplayItem(textInlineBox, foregroundType), | 39 TestDisplayItem(textInlineBox, foregroundType), |
| 39 TestDisplayItem(divLayoutObject, DisplayItem::kCaret)); // New! | 40 TestDisplayItem(*document().frame()->selection().m_frameCaret, DisplayIt
em::kCaret)); // New! |
| 40 } | 41 } |
| 41 | 42 |
| 42 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, InlineRelayout) | 43 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, InlineRelayout) |
| 43 { | 44 { |
| 44 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); | 45 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); |
| 45 Element& div = *toElement(document().body()->firstChild()); | 46 Element& div = *toElement(document().body()->firstChild()); |
| 46 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); | 47 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); |
| 47 LayoutText& text = *toLayoutText(divBlock.firstChild()); | 48 LayoutText& text = *toLayoutText(divBlock.firstChild()); |
| 48 InlineTextBox& firstTextBox = *text.firstTextBox(); | 49 InlineTextBox& firstTextBox = *text.firstTextBox(); |
| 49 | 50 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 4, | 112 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 4, |
| 112 TestDisplayItem(layoutView(), documentBackgroundType), | 113 TestDisplayItem(layoutView(), documentBackgroundType), |
| 113 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), | 114 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
| 114 // The begin and end compositing display items have been folded into thi
s one. | 115 // The begin and end compositing display items have been folded into thi
s one. |
| 115 TestDisplayItem(subDiv, backgroundType), | 116 TestDisplayItem(subDiv, backgroundType), |
| 116 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); | 117 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); |
| 117 } | 118 } |
| 118 | 119 |
| 119 | 120 |
| 120 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |