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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 DummyPageHolder& dummyPageHolder() const { return *m_dummyPageHolder; } | 29 DummyPageHolder& dummyPageHolder() const { return *m_dummyPageHolder; } |
30 HTMLDocument& document() const; | 30 HTMLDocument& document() const; |
31 void setSelection(const VisibleSelection&); | 31 void setSelection(const VisibleSelection&); |
32 FrameSelection& selection() const; | 32 FrameSelection& selection() const; |
33 PassRefPtrWillBeRawPtr<Text> appendTextNode(const String& data); | 33 PassRefPtrWillBeRawPtr<Text> appendTextNode(const String& data); |
34 int layoutCount() const { return m_dummyPageHolder->frameView().layoutCount(
); } | 34 int layoutCount() const { return m_dummyPageHolder->frameView().layoutCount(
); } |
35 | 35 |
36 private: | 36 private: |
37 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 37 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
38 RawPtr<HTMLDocument> m_document; | 38 RawPtrWillBePersistent<HTMLDocument> m_document; |
39 RefPtrWillBePersistent<Text> m_textNode; | 39 RefPtrWillBePersistent<Text> m_textNode; |
40 }; | 40 }; |
41 | 41 |
42 void FrameSelectionTest::SetUp() | 42 void FrameSelectionTest::SetUp() |
43 { | 43 { |
44 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 44 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
45 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 45 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
46 ASSERT(m_document); | 46 ASSERT(m_document); |
47 } | 47 } |
48 | 48 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 EXPECT_EQ_SELECTED_TEXT("Bar Baz"); | 180 EXPECT_EQ_SELECTED_TEXT("Bar Baz"); |
181 // "Fo<o B|ar Baz," with the Character granularity. | 181 // "Fo<o B|ar Baz," with the Character granularity. |
182 selection().moveRangeSelection(VisiblePosition(Position(text, 5)), VisiblePo
sition(Position(text, 2)), CharacterGranularity); | 182 selection().moveRangeSelection(VisiblePosition(Position(text, 5)), VisiblePo
sition(Position(text, 2)), CharacterGranularity); |
183 EXPECT_EQ_SELECTED_TEXT("o B"); | 183 EXPECT_EQ_SELECTED_TEXT("o B"); |
184 // "Fo<o B|ar Baz," with the Word granularity. | 184 // "Fo<o B|ar Baz," with the Word granularity. |
185 selection().moveRangeSelection(VisiblePosition(Position(text, 5)), VisiblePo
sition(Position(text, 2)), WordGranularity); | 185 selection().moveRangeSelection(VisiblePosition(Position(text, 5)), VisiblePo
sition(Position(text, 2)), WordGranularity); |
186 EXPECT_EQ_SELECTED_TEXT("Foo Bar"); | 186 EXPECT_EQ_SELECTED_TEXT("Foo Bar"); |
187 } | 187 } |
188 | 188 |
189 } // namespace blink | 189 } // namespace blink |
OLD | NEW |