Commit 00daa6ff authored by lukasza's avatar lukasza Committed by Commit bot

Rename caretDisplayItemClient() to getCaretDisplayItemClient().

The rename is needed to avoid a naming collision after changing from
Blink to Chromium naming style.  Right now we have a
|CaretDisplayItemClient| type and a |caretDisplayItemClient| accessor
method in the CaretDisplayItemClientTest class (differing by case of the
first character); after a naive rename by the rewrite_to_chrome_style
tool we would end up with |CaretDisplayItemClient| being the name of
both the type and the accessor method (with both living in the same
namespace).

Prepending a "get" prefix to the name of the accessor method is the
workaround that fits into the guidance on the recommended
post-Blink-to-Chromium-rename style suggested by esprehn@ in
https://crbug.com/582312#c17:
- Getters favor not using "Get", ex. FirstChild()
- Unless the type name conflicts, in which case you can either rename
  the type if it's easy and makes sense, or add "Get", ex. GetContext().

BUG=582312
TBR=yosin@chromium.org

Review-Url: https://codereview.chromium.org/2803363002
Cr-Commit-Position: refs/heads/master@{#463051}
parent ae910dd7
...@@ -36,17 +36,19 @@ class CaretDisplayItemClientTest : public RenderingTest { ...@@ -36,17 +36,19 @@ class CaretDisplayItemClientTest : public RenderingTest {
return document().view()->frame().selection(); return document().view()->frame().selection();
} }
const DisplayItemClient& caretDisplayItemClient() const { const DisplayItemClient& getCaretDisplayItemClient() const {
return selection().caretDisplayItemClientForTesting(); return selection().caretDisplayItemClientForTesting();
} }
const LayoutBlock* caretLayoutBlock() const { const LayoutBlock* caretLayoutBlock() const {
return static_cast<const CaretDisplayItemClient&>(caretDisplayItemClient()) return static_cast<const CaretDisplayItemClient&>(
getCaretDisplayItemClient())
.m_layoutBlock; .m_layoutBlock;
} }
const LayoutBlock* previousCaretLayoutBlock() const { const LayoutBlock* previousCaretLayoutBlock() const {
return static_cast<const CaretDisplayItemClient&>(caretDisplayItemClient()) return static_cast<const CaretDisplayItemClient&>(
getCaretDisplayItemClient())
.m_previousLayoutBlock; .m_previousLayoutBlock;
} }
...@@ -88,7 +90,7 @@ TEST_F(CaretDisplayItemClientTest, CaretPaintInvalidation) { ...@@ -88,7 +90,7 @@ TEST_F(CaretDisplayItemClientTest, CaretPaintInvalidation) {
updateAllLifecyclePhases(); updateAllLifecyclePhases();
EXPECT_TRUE(block->shouldPaintCursorCaret()); EXPECT_TRUE(block->shouldPaintCursorCaret());
LayoutRect caretVisualRect = caretDisplayItemClient().visualRect(); LayoutRect caretVisualRect = getCaretDisplayItemClient().visualRect();
EXPECT_EQ(1, caretVisualRect.width()); EXPECT_EQ(1, caretVisualRect.width());
EXPECT_EQ(block->location(), caretVisualRect.location()); EXPECT_EQ(block->location(), caretVisualRect.location());
...@@ -115,7 +117,7 @@ TEST_F(CaretDisplayItemClientTest, CaretPaintInvalidation) { ...@@ -115,7 +117,7 @@ TEST_F(CaretDisplayItemClientTest, CaretPaintInvalidation) {
updateAllLifecyclePhases(); updateAllLifecyclePhases();
EXPECT_TRUE(block->shouldPaintCursorCaret()); EXPECT_TRUE(block->shouldPaintCursorCaret());
LayoutRect newCaretVisualRect = caretDisplayItemClient().visualRect(); LayoutRect newCaretVisualRect = getCaretDisplayItemClient().visualRect();
EXPECT_EQ(caretVisualRect.size(), newCaretVisualRect.size()); EXPECT_EQ(caretVisualRect.size(), newCaretVisualRect.size());
EXPECT_EQ(caretVisualRect.y(), newCaretVisualRect.y()); EXPECT_EQ(caretVisualRect.y(), newCaretVisualRect.y());
EXPECT_LT(caretVisualRect.x(), newCaretVisualRect.x()); EXPECT_LT(caretVisualRect.x(), newCaretVisualRect.x());
...@@ -144,7 +146,7 @@ TEST_F(CaretDisplayItemClientTest, CaretPaintInvalidation) { ...@@ -144,7 +146,7 @@ TEST_F(CaretDisplayItemClientTest, CaretPaintInvalidation) {
selection().setSelection(SelectionInDOMTree()); selection().setSelection(SelectionInDOMTree());
updateAllLifecyclePhases(); updateAllLifecyclePhases();
EXPECT_FALSE(block->shouldPaintCursorCaret()); EXPECT_FALSE(block->shouldPaintCursorCaret());
EXPECT_EQ(LayoutRect(), caretDisplayItemClient().visualRect()); EXPECT_EQ(LayoutRect(), getCaretDisplayItemClient().visualRect());
rasterInvalidations = rasterInvalidations =
&getRasterInvalidationTracking()->trackedRasterInvalidations; &getRasterInvalidationTracking()->trackedRasterInvalidations;
...@@ -174,7 +176,7 @@ TEST_F(CaretDisplayItemClientTest, CaretMovesBetweenBlocks) { ...@@ -174,7 +176,7 @@ TEST_F(CaretDisplayItemClientTest, CaretMovesBetweenBlocks) {
// Focus the body. // Focus the body.
document().body()->focus(); document().body()->focus();
updateAllLifecyclePhases(); updateAllLifecyclePhases();
LayoutRect caretVisualRect1 = caretDisplayItemClient().visualRect(); LayoutRect caretVisualRect1 = getCaretDisplayItemClient().visualRect();
EXPECT_EQ(1, caretVisualRect1.width()); EXPECT_EQ(1, caretVisualRect1.width());
EXPECT_EQ(block1->visualRect().location(), caretVisualRect1.location()); EXPECT_EQ(block1->visualRect().location(), caretVisualRect1.location());
EXPECT_TRUE(block1->shouldPaintCursorCaret()); EXPECT_TRUE(block1->shouldPaintCursorCaret());
...@@ -187,7 +189,7 @@ TEST_F(CaretDisplayItemClientTest, CaretMovesBetweenBlocks) { ...@@ -187,7 +189,7 @@ TEST_F(CaretDisplayItemClientTest, CaretMovesBetweenBlocks) {
.build()); .build());
updateAllLifecyclePhases(); updateAllLifecyclePhases();
LayoutRect caretVisualRect2 = caretDisplayItemClient().visualRect(); LayoutRect caretVisualRect2 = getCaretDisplayItemClient().visualRect();
EXPECT_EQ(1, caretVisualRect2.width()); EXPECT_EQ(1, caretVisualRect2.width());
EXPECT_EQ(block2->visualRect().location(), caretVisualRect2.location()); EXPECT_EQ(block2->visualRect().location(), caretVisualRect2.location());
EXPECT_FALSE(block1->shouldPaintCursorCaret()); EXPECT_FALSE(block1->shouldPaintCursorCaret());
...@@ -215,7 +217,7 @@ TEST_F(CaretDisplayItemClientTest, CaretMovesBetweenBlocks) { ...@@ -215,7 +217,7 @@ TEST_F(CaretDisplayItemClientTest, CaretMovesBetweenBlocks) {
.build()); .build());
updateAllLifecyclePhases(); updateAllLifecyclePhases();
EXPECT_EQ(caretVisualRect1, caretDisplayItemClient().visualRect()); EXPECT_EQ(caretVisualRect1, getCaretDisplayItemClient().visualRect());
EXPECT_TRUE(block1->shouldPaintCursorCaret()); EXPECT_TRUE(block1->shouldPaintCursorCaret());
EXPECT_FALSE(block2->shouldPaintCursorCaret()); EXPECT_FALSE(block2->shouldPaintCursorCaret());
...@@ -303,7 +305,7 @@ TEST_F(CaretDisplayItemClientTest, CaretHideMoveAndShow) { ...@@ -303,7 +305,7 @@ TEST_F(CaretDisplayItemClientTest, CaretHideMoveAndShow) {
updateAllLifecyclePhases(); updateAllLifecyclePhases();
const auto* block = toLayoutBlock(document().body()->layoutObject()); const auto* block = toLayoutBlock(document().body()->layoutObject());
LayoutRect caretVisualRect = caretDisplayItemClient().visualRect(); LayoutRect caretVisualRect = getCaretDisplayItemClient().visualRect();
EXPECT_EQ(1, caretVisualRect.width()); EXPECT_EQ(1, caretVisualRect.width());
EXPECT_EQ(block->location(), caretVisualRect.location()); EXPECT_EQ(block->location(), caretVisualRect.location());
...@@ -317,7 +319,7 @@ TEST_F(CaretDisplayItemClientTest, CaretHideMoveAndShow) { ...@@ -317,7 +319,7 @@ TEST_F(CaretDisplayItemClientTest, CaretHideMoveAndShow) {
selection().setCaretVisible(true); selection().setCaretVisible(true);
updateAllLifecyclePhases(); updateAllLifecyclePhases();
LayoutRect newCaretVisualRect = caretDisplayItemClient().visualRect(); LayoutRect newCaretVisualRect = getCaretDisplayItemClient().visualRect();
EXPECT_EQ(caretVisualRect.size(), newCaretVisualRect.size()); EXPECT_EQ(caretVisualRect.size(), newCaretVisualRect.size());
EXPECT_EQ(caretVisualRect.y(), newCaretVisualRect.y()); EXPECT_EQ(caretVisualRect.y(), newCaretVisualRect.y());
EXPECT_LT(caretVisualRect.x(), newCaretVisualRect.x()); EXPECT_LT(caretVisualRect.x(), newCaretVisualRect.x());
...@@ -363,17 +365,19 @@ TEST_F(CaretDisplayItemClientTest, CompositingChange) { ...@@ -363,17 +365,19 @@ TEST_F(CaretDisplayItemClientTest, CompositingChange) {
EXPECT_TRUE(editorBlock->shouldPaintCursorCaret()); EXPECT_TRUE(editorBlock->shouldPaintCursorCaret());
EXPECT_EQ(editorBlock, caretLayoutBlock()); EXPECT_EQ(editorBlock, caretLayoutBlock());
EXPECT_EQ(LayoutRect(116, 105, 1, 1), caretDisplayItemClient().visualRect()); EXPECT_EQ(LayoutRect(116, 105, 1, 1),
getCaretDisplayItemClient().visualRect());
// Composite container. // Composite container.
container->setAttribute(HTMLNames::styleAttr, "will-change: transform"); container->setAttribute(HTMLNames::styleAttr, "will-change: transform");
updateAllLifecyclePhases(); updateAllLifecyclePhases();
EXPECT_EQ(LayoutRect(50, 50, 1, 1), caretDisplayItemClient().visualRect()); EXPECT_EQ(LayoutRect(50, 50, 1, 1), getCaretDisplayItemClient().visualRect());
// Uncomposite container. // Uncomposite container.
container->setAttribute(HTMLNames::styleAttr, ""); container->setAttribute(HTMLNames::styleAttr, "");
updateAllLifecyclePhases(); updateAllLifecyclePhases();
EXPECT_EQ(LayoutRect(116, 105, 1, 1), caretDisplayItemClient().visualRect()); EXPECT_EQ(LayoutRect(116, 105, 1, 1),
getCaretDisplayItemClient().visualRect());
} }
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment