| 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 | 6 |
| 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.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" |
| 11 #include "core/dom/Text.h" | 11 #include "core/dom/Text.h" |
| 12 #include "core/editing/FrameSelection.h" | 12 #include "core/editing/FrameSelection.h" |
| 13 #include "core/frame/FrameView.h" | 13 #include "core/frame/FrameView.h" |
| 14 #include "core/frame/Settings.h" | 14 #include "core/frame/Settings.h" |
| 15 #include "core/html/HTMLBodyElement.h" | 15 #include "core/html/HTMLBodyElement.h" |
| 16 #include "core/html/HTMLDocument.h" | 16 #include "core/html/HTMLDocument.h" |
| 17 #include "core/testing/DummyPageHolder.h" | 17 #include "core/testing/DummyPageHolder.h" |
| 18 #include "wtf/OwnPtr.h" | 18 #include "wtf/OwnPtr.h" |
| 19 #include "wtf/PassRefPtr.h" | 19 #include "wtf/PassRefPtr.h" |
| 20 #include "wtf/RefPtr.h" | 20 #include "wtf/RefPtr.h" |
| 21 #include "wtf/StdLibExtras.h" | 21 #include "wtf/StdLibExtras.h" |
| 22 #include "wtf/testing/WTFTestHelpers.h" | |
| 23 #include <gtest/gtest.h> | 22 #include <gtest/gtest.h> |
| 24 | 23 |
| 25 namespace blink { | 24 namespace blink { |
| 26 | 25 |
| 27 #define EXPECT_EQ_SELECTED_TEXT(text) \ | 26 #define EXPECT_EQ_SELECTED_TEXT(text) \ |
| 28 EXPECT_EQ(text, WebString(selection().selectedText()).utf8()) | 27 EXPECT_EQ(text, WebString(selection().selectedText()).utf8()) |
| 29 | 28 |
| 30 IntPoint visiblePositionToContentsPoint(const VisiblePosition& pos) | 29 IntPoint visiblePositionToContentsPoint(const VisiblePosition& pos) |
| 31 { | 30 { |
| 32 IntPoint result = pos.absoluteCaretBounds().minXMaxYCorner(); | 31 IntPoint result = pos.absoluteCaretBounds().minXMaxYCorner(); |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 652 |
| 654 // "ab cd efghijkl ^mnopqr |>stuvwi inm," (^ means base and | means extent, | 653 // "ab cd efghijkl ^mnopqr |>stuvwi inm," (^ means base and | means extent, |
| 655 // > means end). | 654 // > means end). |
| 656 selection().setSelection(VisibleSelection(Position(text, 15), Position(text,
22))); | 655 selection().setSelection(VisibleSelection(Position(text, 15), Position(text,
22))); |
| 657 EXPECT_EQ_SELECTED_TEXT("mnopqr "); | 656 EXPECT_EQ_SELECTED_TEXT("mnopqr "); |
| 658 selection().moveRangeSelectionExtent(m_wordMiddles[4]); | 657 selection().moveRangeSelectionExtent(m_wordMiddles[4]); |
| 659 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); | 658 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); |
| 660 } | 659 } |
| 661 | 660 |
| 662 } // namespace blink | 661 } // namespace blink |
| OLD | NEW |