Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
index 1c92df5400c91c95558a8266871c7923bbed128c..0ca3d6bcd6ab6ae048a816583ec0b1a7fca0b965 100644 |
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
@@ -1944,9 +1944,12 @@ void CanvasRenderingContext2D::setFont(const String& newFont) |
// Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work |
// relative to the canvas. |
RefPtr<RenderStyle> newStyle = RenderStyle::create(); |
- if (RenderStyle* computedStyle = canvas()->computedStyle()) |
- newStyle->setFontDescription(computedStyle->fontDescription()); |
- else { |
+ if (RenderStyle* computedStyle = canvas()->computedStyle()) { |
+ FontDescription elementFontDescription(computedStyle->fontDescription()); |
+ // Reset the computed size to avoid inheriting the zoom factor from the <canvas> element. |
+ elementFontDescription.setComputedSize(elementFontDescription.specifiedSize()); |
+ newStyle->setFontDescription(elementFontDescription); |
+ } else { |
FontFamily fontFamily; |
fontFamily.setFamily(defaultFontFamily); |