| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/VisibleUnits.h" | 5 #include "core/editing/VisibleUnits.h" |
| 6 | 6 |
| 7 #include <ostream> // NOLINT | 7 #include <ostream> // NOLINT |
| 8 #include "bindings/core/v8/V8BindingForTesting.h" | 8 #include "bindings/core/v8/V8BindingForTesting.h" |
| 9 #include "core/dom/Text.h" | 9 #include "core/dom/Text.h" |
| 10 #include "core/editing/EditingTestBase.h" | 10 #include "core/editing/EditingTestBase.h" |
| (...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 TEST_F(VisibleUnitsTest, | 1902 TEST_F(VisibleUnitsTest, |
| 1903 canonicalizationWithCollapsedSpaceAndIsolatedCombiningCharacter) { | 1903 canonicalizationWithCollapsedSpaceAndIsolatedCombiningCharacter) { |
| 1904 SetBodyContent("<p> ⃣</p>"); // Leading space is necessary | 1904 SetBodyContent("<p> ⃣</p>"); // Leading space is necessary |
| 1905 | 1905 |
| 1906 Node* paragraph = GetDocument().QuerySelector("p"); | 1906 Node* paragraph = GetDocument().QuerySelector("p"); |
| 1907 Node* text = paragraph->firstChild(); | 1907 Node* text = paragraph->firstChild(); |
| 1908 Position start = CanonicalPositionOf(Position::BeforeNode(paragraph)); | 1908 Position start = CanonicalPositionOf(Position::BeforeNode(paragraph)); |
| 1909 EXPECT_EQ(Position(text, 2), start); | 1909 EXPECT_EQ(Position(text, 2), start); |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 TEST_F(VisibleUnitsTest, |
| 1913 PreviousRootInlineBoxCandidatePositionWithDisplayNone) { |
| 1914 SetBodyContent( |
| 1915 "<div contenteditable>" |
| 1916 "<div id=one>one abc</div>" |
| 1917 "<div id=two>two <b id=none style=display:none>def</b> ghi</div>" |
| 1918 "</div>"); |
| 1919 Element* const one = GetDocument().getElementById("one"); |
| 1920 Element* const two = GetDocument().getElementById("two"); |
| 1921 const VisiblePosition& visible_position = |
| 1922 CreateVisiblePosition(Position::LastPositionInNode(two)); |
| 1923 EXPECT_EQ(Position(one->firstChild(), 7), |
| 1924 PreviousRootInlineBoxCandidatePosition( |
| 1925 two->lastChild(), visible_position, kContentIsEditable)); |
| 1926 } |
| 1927 |
| 1912 } // namespace blink | 1928 } // namespace blink |
| OLD | NEW |