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 #include "core/editing/FrameSelection.h" | 6 #include "core/editing/FrameSelection.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // To force layout in next updateLayout calling, widen view. | 125 // To force layout in next updateLayout calling, widen view. |
126 FrameView& frameView = dummyPageHolder().frameView(); | 126 FrameView& frameView = dummyPageHolder().frameView(); |
127 IntRect frameRect = frameView.frameRect(); | 127 IntRect frameRect = frameView.frameRect(); |
128 frameRect.setWidth(frameRect.width() + 1); | 128 frameRect.setWidth(frameRect.width() + 1); |
129 frameRect.setHeight(frameRect.height() + 1); | 129 frameRect.setHeight(frameRect.height() + 1); |
130 dummyPageHolder().frameView().setFrameRect(frameRect); | 130 dummyPageHolder().frameView().setFrameRect(frameRect); |
131 } | 131 } |
132 OwnPtr<PaintController> paintController = PaintController::create(); | 132 OwnPtr<PaintController> paintController = PaintController::create(); |
133 GraphicsContext context(*paintController); | 133 GraphicsContext context(*paintController); |
134 DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView().layo
utView(), DisplayItem::Caret, LayoutRect::infiniteIntRect()); | 134 DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView().layo
utView(), DisplayItem::Caret, LayoutRect::infiniteIntRect()); |
135 selection().paintCaret(&context, LayoutPoint()); | 135 selection().paintCaret(context, LayoutPoint()); |
136 EXPECT_EQ(startCount, layoutCount()); | 136 EXPECT_EQ(startCount, layoutCount()); |
137 } | 137 } |
138 | 138 |
139 #define EXPECT_EQ_SELECTED_TEXT(text) \ | 139 #define EXPECT_EQ_SELECTED_TEXT(text) \ |
140 EXPECT_EQ(text, WebString(selection().selectedText()).utf8()) | 140 EXPECT_EQ(text, WebString(selection().selectedText()).utf8()) |
141 | 141 |
142 TEST_F(FrameSelectionTest, SelectWordAroundPosition) | 142 TEST_F(FrameSelectionTest, SelectWordAroundPosition) |
143 { | 143 { |
144 // "Foo Bar Baz," | 144 // "Foo Bar Baz," |
145 RefPtrWillBeRawPtr<Text> text = appendTextNode("Foo Bar Baz,"); | 145 RefPtrWillBeRawPtr<Text> text = appendTextNode("Foo Bar Baz,"); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start()); | 209 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start()); |
210 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end()); | 210 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end()); |
211 | 211 |
212 EXPECT_EQ(PositionInComposedTree(bottom, 3), visibleSelectionInComposedTree(
).base()); | 212 EXPECT_EQ(PositionInComposedTree(bottom, 3), visibleSelectionInComposedTree(
).base()); |
213 EXPECT_EQ(PositionInComposedTree(top, 1), visibleSelectionInComposedTree().e
xtent()); | 213 EXPECT_EQ(PositionInComposedTree(top, 1), visibleSelectionInComposedTree().e
xtent()); |
214 EXPECT_EQ(PositionInComposedTree(top, 1), visibleSelectionInComposedTree().s
tart()); | 214 EXPECT_EQ(PositionInComposedTree(top, 1), visibleSelectionInComposedTree().s
tart()); |
215 EXPECT_EQ(PositionInComposedTree(bottom, 3), visibleSelectionInComposedTree(
).end()); | 215 EXPECT_EQ(PositionInComposedTree(bottom, 3), visibleSelectionInComposedTree(
).end()); |
216 } | 216 } |
217 | 217 |
218 } // namespace blink | 218 } // namespace blink |
OLD | NEW |