Title: [274025] trunk/Source/WebCore
Revision
274025
Author
mmaxfi...@apple.com
Date
2021-03-05 18:26:51 -0800 (Fri, 05 Mar 2021)

Log Message

CanvasRenderingContext2DBase::canDrawTextWithParams() needs to resolve styles before using the drawingContext
https://bugs.webkit.org/show_bug.cgi?id=221257
<rdar://problem/73878095>

Reviewed by Ryosuke Niwa.

Simply call fontProxy() (which internally resolves styles) before calling drawingContext().

Test: fast/text/canvas-synchronous-events.html

* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::canDrawTextWithParams):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274024 => 274025)


--- trunk/Source/WebCore/ChangeLog	2021-03-06 02:25:48 UTC (rev 274024)
+++ trunk/Source/WebCore/ChangeLog	2021-03-06 02:26:51 UTC (rev 274025)
@@ -1,3 +1,18 @@
+2021-03-05  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        CanvasRenderingContext2DBase::canDrawTextWithParams() needs to resolve styles before using the drawingContext
+        https://bugs.webkit.org/show_bug.cgi?id=221257
+        <rdar://problem/73878095>
+
+        Reviewed by Ryosuke Niwa.
+
+        Simply call fontProxy() (which internally resolves styles) before calling drawingContext().
+
+        Test: fast/text/canvas-synchronous-events.html
+
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::CanvasRenderingContext2DBase::canDrawTextWithParams):
+
 2021-03-05  Chris Dumez  <cdu...@apple.com>
 
         Update ApplicationCacheStorage::originsWithCache() to return a HashSet<SecurityOriginData> instead of a Vector<Ref<SecurityOrigin>>

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (274024 => 274025)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2021-03-06 02:25:48 UTC (rev 274024)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2021-03-06 02:26:51 UTC (rev 274025)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2021 Apple Inc. All rights reserved.
  * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
  * Copyright (C) 2007 Alp Toker <a...@atoker.com>
  * Copyright (C) 2008 Eric Seidel <e...@webkit.org>
@@ -61,6 +61,7 @@
 #include "RenderImage.h"
 #include "RenderLayer.h"
 #include "RenderTheme.h"
+#include "ScriptDisallowedScope.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
 #include "StrokeStyleApplier.h"
@@ -2440,11 +2441,14 @@
 
 bool CanvasRenderingContext2DBase::canDrawTextWithParams(float x, float y, bool fill, Optional<float> maxWidth)
 {
+    if (!fontProxy()->realized())
+        return false;
+
+    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
+
     auto* c = drawingContext();
     if (!c)
         return false;
-    if (!this->fontProxy()->realized())
-        return false;
     if (!state().hasInvertibleTransform)
         return false;
     if (!std::isfinite(x) | !std::isfinite(y))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to