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 <memory> |
5 #include "bindings/core/v8/ExceptionState.h" | 6 #include "bindings/core/v8/ExceptionState.h" |
6 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
7 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
8 #include "core/dom/Text.h" | 9 #include "core/dom/Text.h" |
9 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
10 #include "core/frame/FrameView.h" | 11 #include "core/frame/FrameView.h" |
11 #include "core/frame/Settings.h" | 12 #include "core/frame/Settings.h" |
12 #include "core/html/HTMLBodyElement.h" | 13 #include "core/html/HTMLBodyElement.h" |
13 #include "core/html/HTMLSpanElement.h" | 14 #include "core/html/HTMLSpanElement.h" |
14 #include "core/testing/DummyPageHolder.h" | 15 #include "core/testing/DummyPageHolder.h" |
15 #include "platform/heap/Handle.h" | 16 #include "platform/heap/Handle.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "wtf/PassRefPtr.h" | 18 #include "wtf/PassRefPtr.h" |
18 #include "wtf/RefPtr.h" | 19 #include "wtf/RefPtr.h" |
19 #include "wtf/StdLibExtras.h" | 20 #include "wtf/StdLibExtras.h" |
20 #include <memory> | |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 | 23 |
24 #define EXPECT_EQ_SELECTED_TEXT(text) \ | 24 #define EXPECT_EQ_SELECTED_TEXT(text) \ |
25 EXPECT_EQ(text, WebString(selection().selectedText()).utf8()) | 25 EXPECT_EQ(text, WebString(selection().selectedText()).utf8()) |
26 | 26 |
27 IntPoint visiblePositionToContentsPoint(const VisiblePosition& pos) { | 27 IntPoint visiblePositionToContentsPoint(const VisiblePosition& pos) { |
28 IntPoint result = absoluteSelectionBoundsOf(pos).minXMaxYCorner(); | 28 IntPoint result = absoluteSelectionBoundsOf(pos).minXMaxYCorner(); |
29 // Need to move the point at least by 1 - caret's minXMaxYCorner is not | 29 // Need to move the point at least by 1 - caret's minXMaxYCorner is not |
30 // evaluated to the same line as the text by hit testing. | 30 // evaluated to the same line as the text by hit testing. |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 selection().setSelection( | 701 selection().setSelection( |
702 SelectionInDOMTree::Builder() | 702 SelectionInDOMTree::Builder() |
703 .setBaseAndExtent(Position(text, 15), Position(text, 22)) | 703 .setBaseAndExtent(Position(text, 15), Position(text, 22)) |
704 .build()); | 704 .build()); |
705 EXPECT_EQ_SELECTED_TEXT("mnopqr "); | 705 EXPECT_EQ_SELECTED_TEXT("mnopqr "); |
706 selection().moveRangeSelectionExtent(m_wordMiddles[4]); | 706 selection().moveRangeSelectionExtent(m_wordMiddles[4]); |
707 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); | 707 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); |
708 } | 708 } |
709 | 709 |
710 } // namespace blink | 710 } // namespace blink |
OLD | NEW |