Title: [269188] trunk/Source/WebCore
Revision
269188
Author
[email protected]
Date
2020-10-30 09:04:24 -0700 (Fri, 30 Oct 2020)

Log Message

REGRESSION (r269146): ASSERTION FAILED: didNeedLayout || logicalHeight() == oldHeight in WebCore::RenderBlockFlow::ensureLineBoxes
https://bugs.webkit.org/show_bug.cgi?id=218350
<rdar://problem/70822708>

Reviewed by Zalan Bujtas.

Dropping of ensureLineBoxes call revealed a bug in text control style updates.

RenderTextControlSingleLine mutates style of the innerTextElement() renderer by altering the height property.
On style update this mutation is lost which causes ensureLineBoxes for innerTextElement() to miscompute block height
if RenderTextControlSingleLine layout has not happened before.

* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::styleDidChange):

Don't zero the dimension properties of the innerTextElement() unnecessarily. Instead see of the underlying style has
actually changed and set the style only in that case. That will then trigger layout as needed.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269187 => 269188)


--- trunk/Source/WebCore/ChangeLog	2020-10-30 15:34:38 UTC (rev 269187)
+++ trunk/Source/WebCore/ChangeLog	2020-10-30 16:04:24 UTC (rev 269188)
@@ -1,3 +1,23 @@
+2020-10-30  Antti Koivisto  <[email protected]>
+
+        REGRESSION (r269146): ASSERTION FAILED: didNeedLayout || logicalHeight() == oldHeight in WebCore::RenderBlockFlow::ensureLineBoxes
+        https://bugs.webkit.org/show_bug.cgi?id=218350
+        <rdar://problem/70822708>
+
+        Reviewed by Zalan Bujtas.
+
+        Dropping of ensureLineBoxes call revealed a bug in text control style updates.
+
+        RenderTextControlSingleLine mutates style of the innerTextElement() renderer by altering the height property.
+        On style update this mutation is lost which causes ensureLineBoxes for innerTextElement() to miscompute block height
+        if RenderTextControlSingleLine layout has not happened before.
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::styleDidChange):
+
+        Don't zero the dimension properties of the innerTextElement() unnecessarily. Instead see of the underlying style has
+        actually changed and set the style only in that case. That will then trigger layout as needed.
+
 2020-10-30  Simon Fraser  <[email protected]>
 
         Convert ScrollingTreeNode change flags to an OptionSet<>

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (269187 => 269188)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2020-10-30 15:34:38 UTC (rev 269187)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2020-10-30 16:04:24 UTC (rev 269188)
@@ -64,12 +64,13 @@
     if (!innerText)
         return;
     RenderTextControlInnerBlock* innerTextRenderer = innerText->renderer();
-    if (innerTextRenderer) {
-        // We may have set the width and the height in the old style in layout().
-        // Reset them now to avoid getting a spurious layout hint.
-        innerTextRenderer->mutableStyle().setHeight(Length());
-        innerTextRenderer->mutableStyle().setWidth(Length());
-        innerTextRenderer->setStyle(textFormControlElement().createInnerTextStyle(style()));
+    if (innerTextRenderer && oldStyle) {
+        // FIXME: The height property of the inner text block style may be mutated by RenderTextControlSingleLine::layout.
+        // See if the original has changed before setting it and triggering a layout.
+        auto newInnerTextStyle = textFormControlElement().createInnerTextStyle(style());
+        auto oldInnerTextStyle = textFormControlElement().createInnerTextStyle(*oldStyle);
+        if (newInnerTextStyle != oldInnerTextStyle)
+            innerTextRenderer->setStyle(WTFMove(newInnerTextStyle));
     }
     textFormControlElement().updatePlaceholderVisibility();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to