Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 326893003: Reset computed size of the <canvas> FontDescription when setting CRC2D.font (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/canvas/font-no-zoom.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « LayoutTests/fast/canvas/font-no-zoom.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698