Title: [269212] branches/safari-611.1.4-branch/Source/WebCore
Revision
269212
Author
[email protected]
Date
2020-10-30 17:15:42 -0700 (Fri, 30 Oct 2020)

Log Message

Cherry-pick r269188. rdar://problem/70901497

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269188 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611.1.4-branch/Source/WebCore/ChangeLog (269211 => 269212)


--- branches/safari-611.1.4-branch/Source/WebCore/ChangeLog	2020-10-31 00:01:02 UTC (rev 269211)
+++ branches/safari-611.1.4-branch/Source/WebCore/ChangeLog	2020-10-31 00:15:42 UTC (rev 269212)
@@ -1,3 +1,48 @@
+2020-10-30  Alan Coon  <[email protected]>
+
+        Cherry-pick r269188. rdar://problem/70901497
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-29  Alan Coon  <[email protected]>
 
         Cherry-pick r269173. rdar://problem/70831161

Modified: branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderTextControl.cpp (269211 => 269212)


--- branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderTextControl.cpp	2020-10-31 00:01:02 UTC (rev 269211)
+++ branches/safari-611.1.4-branch/Source/WebCore/rendering/RenderTextControl.cpp	2020-10-31 00:15:42 UTC (rev 269212)
@@ -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