Modified: trunk/Source/WebCore/ChangeLog (280628 => 280629)
--- trunk/Source/WebCore/ChangeLog 2021-08-04 05:36:03 UTC (rev 280628)
+++ trunk/Source/WebCore/ChangeLog 2021-08-04 08:19:22 UTC (rev 280629)
@@ -1,3 +1,14 @@
+2021-08-04 Carlos Garcia Campos <cgar...@igalia.com>
+
+ Add missing null-check in Touch constructor
+ https://bugs.webkit.org/show_bug.cgi?id=228231
+
+ Reviewed by Darin Adler.
+
+ * dom/Touch.cpp:
+ (WebCore::scaledLocation): Helper to initialize absolutePosition.
+ (WebCore::Touch::Touch): Use scaledLocation().
+
2021-08-03 Alexey Shvayka <shvaikal...@gmail.com>
ReadableStream's pipeTo() and pipeThrough() don't properly check for AbortSignal
Modified: trunk/Source/WebCore/dom/Touch.cpp (280628 => 280629)
--- trunk/Source/WebCore/dom/Touch.cpp 2021-08-04 05:36:03 UTC (rev 280628)
+++ trunk/Source/WebCore/dom/Touch.cpp 2021-08-04 08:19:22 UTC (rev 280629)
@@ -55,6 +55,14 @@
return frameView->scrollY() / frame->pageZoomFactor() / frame->frameScaleFactor();
}
+static LayoutPoint scaledLocation(Frame* frame, int pageX, int pageY)
+{
+ if (!frame)
+ return { pageX, pageY };
+ float scaleFactor = frame->pageZoomFactor() * frame->frameScaleFactor();
+ return { pageX * scaleFactor, pageY * scaleFactor };
+}
+
Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, int screenX, int screenY, int pageX, int pageY, int radiusX, int radiusY, float rotationAngle, float force)
: m_target(target)
, m_identifier(identifier)
@@ -68,9 +76,8 @@
, m_radiusY(radiusY)
, m_rotationAngle(rotationAngle)
, m_force(force)
+ , m_absoluteLocation(scaledLocation(frame, pageX, pageY))
{
- float scaleFactor = frame->pageZoomFactor() * frame->frameScaleFactor();
- m_absoluteLocation = LayoutPoint(pageX * scaleFactor, pageY * scaleFactor);
}
Touch::Touch(EventTarget* target, unsigned identifier, int clientX, int clientY, int screenX, int screenY, int pageX, int pageY, int radiusX, int radiusY, float rotationAngle, float force, LayoutPoint absoluteLocation)