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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/canvas/font-no-zoom.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 return; 1937 return;
1938 1938
1939 // The parse succeeded. 1939 // The parse succeeded.
1940 String newFontSafeCopy(newFont); // Create a string copy since newFont can b e deleted inside realizeSaves. 1940 String newFontSafeCopy(newFont); // Create a string copy since newFont can b e deleted inside realizeSaves.
1941 realizeSaves(); 1941 realizeSaves();
1942 modifiableState().m_unparsedFont = newFontSafeCopy; 1942 modifiableState().m_unparsedFont = newFontSafeCopy;
1943 1943
1944 // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work 1944 // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work
1945 // relative to the canvas. 1945 // relative to the canvas.
1946 RefPtr<RenderStyle> newStyle = RenderStyle::create(); 1946 RefPtr<RenderStyle> newStyle = RenderStyle::create();
1947 if (RenderStyle* computedStyle = canvas()->computedStyle()) 1947 if (RenderStyle* computedStyle = canvas()->computedStyle()) {
1948 newStyle->setFontDescription(computedStyle->fontDescription()); 1948 FontDescription elementFontDescription(computedStyle->fontDescription()) ;
1949 else { 1949 // Reset the computed size to avoid inheriting the zoom factor from the <canvas> element.
1950 elementFontDescription.setComputedSize(elementFontDescription.specifiedS ize());
1951 newStyle->setFontDescription(elementFontDescription);
1952 } else {
1950 FontFamily fontFamily; 1953 FontFamily fontFamily;
1951 fontFamily.setFamily(defaultFontFamily); 1954 fontFamily.setFamily(defaultFontFamily);
1952 1955
1953 FontDescription defaultFontDescription; 1956 FontDescription defaultFontDescription;
1954 defaultFontDescription.setFamily(fontFamily); 1957 defaultFontDescription.setFamily(fontFamily);
1955 defaultFontDescription.setSpecifiedSize(defaultFontSize); 1958 defaultFontDescription.setSpecifiedSize(defaultFontSize);
1956 defaultFontDescription.setComputedSize(defaultFontSize); 1959 defaultFontDescription.setComputedSize(defaultFontSize);
1957 1960
1958 newStyle->setFontDescription(defaultFontDescription); 1961 newStyle->setFontDescription(defaultFontDescription);
1959 } 1962 }
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 c->setAlphaAsFloat(1.0); 2353 c->setAlphaAsFloat(1.0);
2351 c->clearShadow(); 2354 c->clearShadow();
2352 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2355 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2353 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2356 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2354 c->restore(); 2357 c->restore();
2355 validateStateStack(); 2358 validateStateStack();
2356 didDraw(dirtyRect); 2359 didDraw(dirtyRect);
2357 } 2360 }
2358 2361
2359 } // namespace WebCore 2362 } // namespace WebCore
OLDNEW
« 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