OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "bindings/core/v8/ExceptionState.h" | 5 #include "bindings/core/v8/ExceptionState.h" |
6 #include "core/HTMLNames.h" | 6 #include "core/HTMLNames.h" |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/QualifiedName.h" | 8 #include "core/dom/QualifiedName.h" |
9 #include "core/editing/EditingTestBase.h" | 9 #include "core/editing/EditingTestBase.h" |
10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 IndentOutdentCommand* command = IndentOutdentCommand::Create( | 71 IndentOutdentCommand* command = IndentOutdentCommand::Create( |
72 GetDocument(), IndentOutdentCommand::kIndent); | 72 GetDocument(), IndentOutdentCommand::kIndent); |
73 command->Apply(); | 73 command->Apply(); |
74 | 74 |
75 EXPECT_EQ( | 75 EXPECT_EQ( |
76 "<head><style>li:first-child { visibility:visible; }</style></head>" | 76 "<head><style>li:first-child { visibility:visible; }</style></head>" |
77 "<body><ul style=\"visibility:hidden\"><ul></ul><li>xyz</li></ul></body>", | 77 "<body><ul style=\"visibility:hidden\"><ul></ul><li>xyz</li></ul></body>", |
78 GetDocument().documentElement()->innerHTML()); | 78 GetDocument().documentElement()->innerHTML()); |
79 } | 79 } |
80 | 80 |
| 81 // This is a regression test for https://crbug.com/712510 |
| 82 TEST_F(ApplyBlockElementCommandTest, IndentHeadingIntoBlockquote) { |
| 83 SetBodyContent( |
| 84 "<div contenteditable=\"true\">" |
| 85 "<h6><button><table></table></button></h6>" |
| 86 "<object></object>" |
| 87 "</div>"); |
| 88 Element* button = GetDocument().QuerySelector("button"); |
| 89 Element* object = GetDocument().QuerySelector("object"); |
| 90 Selection().SetSelection(SelectionInDOMTree::Builder() |
| 91 .Collapse(Position(button, 0)) |
| 92 .Extend(Position(object, 0)) |
| 93 .Build()); |
| 94 |
| 95 IndentOutdentCommand* command = IndentOutdentCommand::Create( |
| 96 GetDocument(), IndentOutdentCommand::kIndent); |
| 97 command->Apply(); |
| 98 |
| 99 // This only records the current behavior, which can be wrong. |
| 100 EXPECT_EQ( |
| 101 "<div contenteditable=\"true\">" |
| 102 "<blockquote style=\"margin: 0 0 0 40px; border: none; padding: 0px;\">" |
| 103 "<h6><button></button></h6>" |
| 104 "<h6><button><table></table></button></h6>" |
| 105 "</blockquote>" |
| 106 "<h6><button></button></h6><br>" |
| 107 "<object></object>" |
| 108 "</div>", |
| 109 GetDocument().body()->innerHTML()); |
| 110 } |
| 111 |
81 } // namespace blink | 112 } // namespace blink |
OLD | NEW |