ASSERTION FAILED: !simpleLineLayout() in WebCore::RenderText::collectSelectionRectsForLineBoxes
https://bugs.webkit.org/show_bug.cgi?id=152115
Reviewed by Simon Fraser.
document.execCommand("indent") generates a blockquote wrapper and moves the indented content inside.
If the indented content is already inside a selection, we need to make sure that newly created flow uses
normal line layout.
This patch fixes the generic case as re-parenting an already selected renderer is not specific to document.execCommand("indent").
Source/WebCore:
Test: fast/block/selection-inside-simple-line-layout.html
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForWithReason):
(WebCore::SimpleLineLayout::printReason):
LayoutTests:
* fast/block/selection-inside-simple-line-layout-expected.txt: Added.
* fast/block/selection-inside-simple-line-layout.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@193947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/SimpleLineLayout.cpp b/Source/WebCore/rendering/SimpleLineLayout.cpp
index af699e3..7daa65d 100644
--- a/Source/WebCore/rendering/SimpleLineLayout.cpp
+++ b/Source/WebCore/rendering/SimpleLineLayout.cpp
@@ -110,7 +110,8 @@
FeatureIsDisabled = 1LLU << 46,
FlowHasNoParent = 1LLU << 47,
FlowHasNoChild = 1LLU << 48,
- EndOfReasons = 1LLU << 49
+ FlowChildIsSelected = 1LLU << 49,
+ EndOfReasons = 1LLU << 50
};
const unsigned NoReason = 0;
@@ -301,6 +302,8 @@
// This currently covers <blockflow>#text</blockflow>, <blockflow>#text<br></blockflow> and mutiple (sibling) RenderText cases.
// The <blockflow><inline>#text</inline></blockflow> case is also popular and should be relatively easy to cover.
for (const auto* child = flow.firstChild(); child;) {
+ if (child->selectionState() != RenderObject::SelectionNone)
+ SET_REASON_AND_RETURN_IF_NEEDED(FlowChildIsSelected, reasons, includeReasons);
if (is<RenderText>(*child)) {
child = child->nextSibling();
continue;
@@ -917,6 +920,9 @@
case FlowHasTextShadow:
stream << "text-shadow";
break;
+ case FlowChildIsSelected:
+ stream << "selected content";
+ break;
case FlowTextIsEmpty:
case FlowHasNoChild:
case FlowHasNoParent: