Title: [126978] branches/chromium/1229
Revision
126978
Author
ba...@chromium.org
Date
2012-08-29 03:27:08 -0700 (Wed, 29 Aug 2012)

Log Message

Merge 126959 - style->fontMetrics() should be available when setting line-height
https://bugs.webkit.org/show_bug.cgi?id=93327

Reviewed by Darin Adler.

Source/WebCore:

Setting line-height assumes the fontMetrics are available for the affected font, but
the fontMetrics won't be available immediately after setting other properties like
font-size. Call styleResolver->updateFont() before setting line-height to update fontMetrics.

Added a test case to fast/canvas/crash-set-font.html.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
Call styleResolver->updateFont() before styleResolver->applyPropertyToCurrentStyle(CSSPropertyLineHeight,...)

LayoutTests:

* fast/canvas/crash-set-font.html: Add a test case that sets both font-size and line-height.


TBR=ba...@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10885027

Modified Paths

Diff

Modified: branches/chromium/1229/LayoutTests/fast/canvas/crash-set-font.html (126977 => 126978)


--- branches/chromium/1229/LayoutTests/fast/canvas/crash-set-font.html	2012-08-29 10:17:51 UTC (rev 126977)
+++ branches/chromium/1229/LayoutTests/fast/canvas/crash-set-font.html	2012-08-29 10:27:08 UTC (rev 126978)
@@ -9,6 +9,7 @@
         oContext2d.font = "small-caps .0ex G";
         oContext2d.font = "italic .0ex G";
         oContext2d.font = "italic 400 .0ex G";
+        oContext2d.font = "italic 400 small/.0ex G";
     </script>
 </head>
 <body>

Modified: branches/chromium/1229/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (126977 => 126978)


--- branches/chromium/1229/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-08-29 10:17:51 UTC (rev 126977)
+++ branches/chromium/1229/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-08-29 10:27:08 UTC (rev 126978)
@@ -2014,11 +2014,12 @@
     styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontVariant, parsedStyle->getPropertyCSSValue(CSSPropertyFontVariant).get());
     styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontWeight, parsedStyle->getPropertyCSSValue(CSSPropertyFontWeight).get());
 
-    // As described in BUG66291, setting font-size on a font may entail a CSSPrimitiveValue::computeLengthDouble call,
+    // As described in BUG66291, setting font-size and line-height on a font may entail a CSSPrimitiveValue::computeLengthDouble call,
     // which assumes the fontMetrics are available for the affected font, otherwise a crash occurs (see http://trac.webkit.org/changeset/96122).
-    // The updateFont() call below updates the fontMetrics and ensures the proper setting of font-size.
+    // The updateFont() calls below update the fontMetrics and ensure the proper setting of font-size and line-height.
     styleResolver->updateFont();
     styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontSize, parsedStyle->getPropertyCSSValue(CSSPropertyFontSize).get());
+    styleResolver->updateFont();
     styleResolver->applyPropertyToCurrentStyle(CSSPropertyLineHeight, parsedStyle->getPropertyCSSValue(CSSPropertyLineHeight).get());
 
     modifiableState().m_font = newStyle->font();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to