| Index: third_party/WebKit/Source/core/editing/commands/ApplyStyleCommandTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommandTest.cpp b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommandTest.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5357b8e35e2e444e785e6b943538fe652c855396
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommandTest.cpp
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "core/editing/commands/ApplyStyleCommand.h"
|
| +
|
| +#include "core/css/StylePropertySet.h"
|
| +#include "core/dom/Document.h"
|
| +#include "core/editing/EditingTestBase.h"
|
| +#include "core/editing/FrameSelection.h"
|
| +#include "core/frame/LocalFrame.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class ApplyStyleCommandTest : public EditingTestBase {};
|
| +
|
| +// This is a regression test for https://crbug.com/675727
|
| +TEST_F(ApplyStyleCommandTest, RemoveRedundantBlocksWithStarEditableStyle) {
|
| + // The second <div> below is redundant from Blink's perspective (no siblings
|
| + // && no attributes) and will be removed by
|
| + // |DeleteSelectionCommand::removeRedundantBlocks()|.
|
| + setBodyContent(
|
| + "<div><div>"
|
| + "<div></div>"
|
| + "<ul>"
|
| + "<li>"
|
| + "<div></div>"
|
| + "<input>"
|
| + "<style> * {-webkit-user-modify: read-write;}</style><div></div>"
|
| + "</li>"
|
| + "</ul></div></div>");
|
| +
|
| + Element* li = document().querySelector("li");
|
| +
|
| + LocalFrame* frame = document().frame();
|
| + frame->selection().setSelection(
|
| + SelectionInDOMTree::Builder()
|
| + .collapse(Position(li, PositionAnchorType::BeforeAnchor))
|
| + .build());
|
| +
|
| + MutableStylePropertySet* style =
|
| + MutableStylePropertySet::create(HTMLQuirksMode);
|
| + style->setProperty(CSSPropertyTextAlign, "center");
|
| + ApplyStyleCommand::create(document(), EditingStyle::create(style),
|
| + InputEvent::InputType::FormatJustifyCenter,
|
| + ApplyStyleCommand::ForceBlockProperties)
|
| + ->apply(EditCommandSource::kDOM);
|
| + // Shouldn't crash.
|
| +}
|
| +
|
| +} // namespace blink
|
|
|