Title: [199413] releases/WebKitGTK/webkit-2.12
Revision
199413
Author
carlo...@webkit.org
Date
2016-04-12 23:47:52 -0700 (Tue, 12 Apr 2016)

Log Message

Merge r198372 - Don't initiate a style recall while drawing text
https://bugs.webkit.org/show_bug.cgi?id=155618

Patch by Zalan Bujtas <za...@apple.com> on 2016-03-17
Reviewed by Simon Fraser.

This patch ensures that we don't initiate a style recalc while in the middle of text drawing.

Source/WebCore:

Test: fast/canvas/crash-while-resizing-canvas.html

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawTextInternal):

LayoutTests:

* fast/canvas/crash-while-resizing-canvas-expected.txt: Added.
* fast/canvas/crash-while-resizing-canvas.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (199412 => 199413)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-13 06:46:39 UTC (rev 199412)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-13 06:47:52 UTC (rev 199413)
@@ -1,3 +1,15 @@
+2016-03-17  Zalan Bujtas  <za...@apple.com>
+
+        Don't initiate a style recall while drawing text 
+        https://bugs.webkit.org/show_bug.cgi?id=155618
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that we don't initiate a style recalc while in the middle of text drawing.
+
+        * fast/canvas/crash-while-resizing-canvas-expected.txt: Added.
+        * fast/canvas/crash-while-resizing-canvas.html: Added.
+
 2016-03-17  Brady Eidson  <beid...@apple.com>
 
         Don't try to restore deleted MemoryIndexes if their owning object store is not restored.

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/crash-while-resizing-canvas-expected.txt (0 => 199413)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/crash-while-resizing-canvas-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/crash-while-resizing-canvas-expected.txt	2016-04-13 06:47:52 UTC (rev 199413)
@@ -0,0 +1 @@
+Pass if no crash or assert.   

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/crash-while-resizing-canvas.html (0 => 199413)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/crash-while-resizing-canvas.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/crash-while-resizing-canvas.html	2016-04-13 06:47:52 UTC (rev 199413)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that changing the canvas size while executing fillText does not crash.</title>
+</head>
+<body>
+Pass if no crash or assert.
+<canvas id=ca></canvas>
+<textarea autofocus='below' _onfocusin_ = 'changeCanvasWidth()'></textarea>
+<script>
+function changeCanvasWidth() {
+    for (var i = 0; i < 1000; ++i) {
+      c3 = document.getElementById("ca");
+      c3.width = i;
+    }
+}
+
+function fillText() {
+    c2 = document.getElementById("ca").getContext("2d");
+    c2.fillText("foobar", 100, 34);
+}
+
+document.write("<iframe _onbeforeload_='fillText()'></iframe>");
+
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (199412 => 199413)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-13 06:46:39 UTC (rev 199412)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-13 06:47:52 UTC (rev 199413)
@@ -1,3 +1,17 @@
+2016-03-17  Zalan Bujtas  <za...@apple.com>
+
+        Don't initiate a style recall while drawing text 
+        https://bugs.webkit.org/show_bug.cgi?id=155618
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that we don't initiate a style recalc while in the middle of text drawing.
+
+        Test: fast/canvas/crash-while-resizing-canvas.html
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::drawTextInternal):
+
 2016-03-17  Eric Carlson  <eric.carl...@apple.com>
 
         Improve some metadata tests

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (199412 => 199413)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2016-04-13 06:46:39 UTC (rev 199412)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2016-04-13 06:47:52 UTC (rev 199413)
@@ -2421,6 +2421,9 @@
 
 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth, bool useMaxWidth)
 {
+    const auto& fontProxy = this->fontProxy();
+    const FontMetrics& fontMetrics = fontProxy.fontMetrics();
+
     GraphicsContext* c = drawingContext();
     if (!c)
         return;
@@ -2440,16 +2443,12 @@
     if (fill && gradient && gradient->isZeroSize())
         return;
 
-    const auto& fontProxy = this->fontProxy();
-    const FontMetrics& fontMetrics = fontProxy.fontMetrics();
-
     String normalizedText = text;
     normalizeSpaces(normalizedText);
 
     // FIXME: Need to turn off font smoothing.
 
     RenderStyle* computedStyle;
-    canvas()->document().updateStyleIfNeeded();
     TextDirection direction = toTextDirection(state().direction, &computedStyle);
     bool isRTL = direction == RTL;
     bool override = computedStyle ? isOverride(computedStyle->unicodeBidi()) : false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to