Title: [198413] branches/safari-601-branch

Diff

Modified: branches/safari-601-branch/LayoutTests/ChangeLog (198412 => 198413)


--- branches/safari-601-branch/LayoutTests/ChangeLog	2016-03-18 15:42:16 UTC (rev 198412)
+++ branches/safari-601-branch/LayoutTests/ChangeLog	2016-03-18 15:43:01 UTC (rev 198413)
@@ -1,5 +1,21 @@
 2016-03-18  Babak Shafiei  <[email protected]>
 
+        Merge r198372.
+
+    2016-03-17  Zalan Bujtas  <[email protected]>
+
+            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-18  Babak Shafiei  <[email protected]>
+
         Merge r192770.
 
     2015-11-25  Pranjal Jumde  <[email protected]>

Copied: branches/safari-601-branch/LayoutTests/fast/canvas/crash-while-resizing-canvas-expected.txt (from rev 198372, trunk/LayoutTests/fast/canvas/crash-while-resizing-canvas-expected.txt) (0 => 198413)


--- branches/safari-601-branch/LayoutTests/fast/canvas/crash-while-resizing-canvas-expected.txt	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/canvas/crash-while-resizing-canvas-expected.txt	2016-03-18 15:43:01 UTC (rev 198413)
@@ -0,0 +1 @@
+Pass if no crash or assert.   

Copied: branches/safari-601-branch/LayoutTests/fast/canvas/crash-while-resizing-canvas.html (from rev 198372, trunk/LayoutTests/fast/canvas/crash-while-resizing-canvas.html) (0 => 198413)


--- branches/safari-601-branch/LayoutTests/fast/canvas/crash-while-resizing-canvas.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/canvas/crash-while-resizing-canvas.html	2016-03-18 15:43:01 UTC (rev 198413)
@@ -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: branches/safari-601-branch/Source/WebCore/ChangeLog (198412 => 198413)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2016-03-18 15:42:16 UTC (rev 198412)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2016-03-18 15:43:01 UTC (rev 198413)
@@ -1,5 +1,23 @@
 2016-03-18  Babak Shafiei  <[email protected]>
 
+        Merge r198372.
+
+    2016-03-17  Zalan Bujtas  <[email protected]>
+
+            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-18  Babak Shafiei  <[email protected]>
+
         Merge r198370.
 
     2016-03-17  Eric Carlson  <[email protected]>

Modified: branches/safari-601-branch/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (198412 => 198413)


--- branches/safari-601-branch/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2016-03-18 15:42:16 UTC (rev 198412)
+++ branches/safari-601-branch/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2016-03-18 15:43:01 UTC (rev 198413)
@@ -2322,6 +2322,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;
@@ -2341,16 +2344,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to