Title: [265722] trunk/Source/WebCore
Revision
265722
Author
[email protected]
Date
2020-08-14 17:28:52 -0700 (Fri, 14 Aug 2020)

Log Message

RenderTextControlSingleLine::scroll* functions should not call Element::scroll* on the inner text content
https://bugs.webkit.org/show_bug.cgi?id=215516
<rdar://problem/64739768>

Reviewed by Simon Fraser.

Normally the RenderBox::content*, border*, padding* and scroll* functions grab the geometry information from the renderer itself.
The clients of these functions expect the geometry data to be consistent with the rest of the rendering context
(e.g coordinates are in the coordinate system of the containing block, paint time operations are not applied etc).
Also these functions are supposed to be const. They should not mutate the geometry or the render tree itself.
Forwarding ::scroll* calls to Element::scroll* can't guarantee neither of these above.

* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::scrollWidth const):
(WebCore::RenderTextControlSingleLine::scrollHeight const):
(WebCore::RenderTextControlSingleLine::scrollLeft const):
(WebCore::RenderTextControlSingleLine::scrollTop const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265721 => 265722)


--- trunk/Source/WebCore/ChangeLog	2020-08-15 00:17:02 UTC (rev 265721)
+++ trunk/Source/WebCore/ChangeLog	2020-08-15 00:28:52 UTC (rev 265722)
@@ -1,3 +1,23 @@
+2020-08-14  Zalan Bujtas  <[email protected]>
+
+        RenderTextControlSingleLine::scroll* functions should not call Element::scroll* on the inner text content
+        https://bugs.webkit.org/show_bug.cgi?id=215516
+        <rdar://problem/64739768>
+
+        Reviewed by Simon Fraser.
+
+        Normally the RenderBox::content*, border*, padding* and scroll* functions grab the geometry information from the renderer itself.
+        The clients of these functions expect the geometry data to be consistent with the rest of the rendering context
+        (e.g coordinates are in the coordinate system of the containing block, paint time operations are not applied etc).
+        Also these functions are supposed to be const. They should not mutate the geometry or the render tree itself.
+        Forwarding ::scroll* calls to Element::scroll* can't guarantee neither of these above.
+
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::scrollWidth const):
+        (WebCore::RenderTextControlSingleLine::scrollHeight const):
+        (WebCore::RenderTextControlSingleLine::scrollLeft const):
+        (WebCore::RenderTextControlSingleLine::scrollTop const):
+
 2020-08-14  Chris Dumez  <[email protected]>
 
         OfflineAudioContext.destination has incorrect number of channels & channel count mode

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (265721 => 265722)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2020-08-15 00:17:02 UTC (rev 265721)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2020-08-15 00:28:52 UTC (rev 265722)
@@ -357,29 +357,29 @@
 
 int RenderTextControlSingleLine::scrollWidth() const
 {
-    if (innerTextElement())
-        return innerTextElement()->scrollWidth();
+    if (auto innerTextElement = this->innerTextElement(); innerTextElement && innerTextElement->renderer())
+        return innerTextElement->renderer()->scrollWidth();
     return RenderBlockFlow::scrollWidth();
 }
 
 int RenderTextControlSingleLine::scrollHeight() const
 {
-    if (innerTextElement())
-        return innerTextElement()->scrollHeight();
+    if (auto innerTextElement = this->innerTextElement(); innerTextElement && innerTextElement->renderer())
+        return innerTextElement->renderer()->scrollHeight();
     return RenderBlockFlow::scrollHeight();
 }
 
 int RenderTextControlSingleLine::scrollLeft() const
 {
-    if (innerTextElement())
-        return innerTextElement()->scrollLeft();
+    if (auto innerTextElement = this->innerTextElement(); innerTextElement && innerTextElement->renderer())
+        return innerTextElement->renderer()->scrollLeft();
     return RenderBlockFlow::scrollLeft();
 }
 
 int RenderTextControlSingleLine::scrollTop() const
 {
-    if (innerTextElement())
-        return innerTextElement()->scrollTop();
+    if (auto innerTextElement = this->innerTextElement(); innerTextElement && innerTextElement->renderer())
+        return innerTextElement->renderer()->scrollTop();
     return RenderBlockFlow::scrollTop();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to