| 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 "core/editing/FrameSelection.h" | 5 #include "core/editing/FrameSelection.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/Text.h" | 10 #include "core/dom/Text.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 289 } |
| 290 | 290 |
| 291 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInFlatTree&, | 291 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInFlatTree&, |
| 292 TextGranularity); | 292 TextGranularity); |
| 293 | 293 |
| 294 private: | 294 private: |
| 295 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); | 295 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 TEST_F(FrameSelectionTest, SelectAllWithUnselectableRoot) { | 298 TEST_F(FrameSelectionTest, SelectAllWithUnselectableRoot) { |
| 299 Element* select = document().createElement("select", ASSERT_NO_EXCEPTION); | 299 Element* select = document().createElement("select"); |
| 300 document().replaceChild(select, document().documentElement()); | 300 document().replaceChild(select, document().documentElement()); |
| 301 selection().selectAll(); | 301 selection().selectAll(); |
| 302 EXPECT_TRUE(selection().isNone()) << "Nothing should be selected if the " | 302 EXPECT_TRUE(selection().isNone()) << "Nothing should be selected if the " |
| 303 "content of the documentElement is not " | 303 "content of the documentElement is not " |
| 304 "selctable."; | 304 "selctable."; |
| 305 } | 305 } |
| 306 | 306 |
| 307 TEST_F(FrameSelectionTest, updateIfNeededAndFrameCaret) { | 307 TEST_F(FrameSelectionTest, updateIfNeededAndFrameCaret) { |
| 308 setBodyContent("<style id=sample></style>"); | 308 setBodyContent("<style id=sample></style>"); |
| 309 document().setDesignMode("on"); | 309 document().setDesignMode("on"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 322 selection().updateIfNeeded(); | 322 selection().updateIfNeeded(); |
| 323 | 323 |
| 324 // TODO(yosin): Once lazy canonicalization implemented, selection.start | 324 // TODO(yosin): Once lazy canonicalization implemented, selection.start |
| 325 // should be Position(HTML, 0). | 325 // should be Position(HTML, 0). |
| 326 EXPECT_EQ(Position(), selection().start()) | 326 EXPECT_EQ(Position(), selection().start()) |
| 327 << "updateIfNeeded() makes selection to null."; | 327 << "updateIfNeeded() makes selection to null."; |
| 328 EXPECT_EQ(selection().start(), caretPosition().position()); | 328 EXPECT_EQ(selection().start(), caretPosition().position()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace blink | 331 } // namespace blink |
| OLD | NEW |