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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 552053003: CanvasRenderingContext2D should update the render tree to avoid stale computed style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unnecessary code from tests! Created 6 years, 3 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
« no previous file with comments | « LayoutTests/fast/canvas/canvas-set-font-with-updated-style-expected.txt ('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 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 return; 1943 return;
1944 1944
1945 // The parse succeeded. 1945 // The parse succeeded.
1946 String newFontSafeCopy(newFont); // Create a string copy since newFont can b e deleted inside realizeSaves. 1946 String newFontSafeCopy(newFont); // Create a string copy since newFont can b e deleted inside realizeSaves.
1947 realizeSaves(0); 1947 realizeSaves(0);
1948 modifiableState().m_unparsedFont = newFontSafeCopy; 1948 modifiableState().m_unparsedFont = newFontSafeCopy;
1949 1949
1950 // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work 1950 // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work
1951 // relative to the canvas. 1951 // relative to the canvas.
1952 RefPtr<RenderStyle> newStyle = RenderStyle::create(); 1952 RefPtr<RenderStyle> newStyle = RenderStyle::create();
1953 canvas()->document().updateRenderTreeIfNeeded();
1953 if (RenderStyle* computedStyle = canvas()->computedStyle()) { 1954 if (RenderStyle* computedStyle = canvas()->computedStyle()) {
1954 FontDescription elementFontDescription(computedStyle->fontDescription()) ; 1955 FontDescription elementFontDescription(computedStyle->fontDescription()) ;
1955 // Reset the computed size to avoid inheriting the zoom factor from the <canvas> element. 1956 // Reset the computed size to avoid inheriting the zoom factor from the <canvas> element.
1956 elementFontDescription.setComputedSize(elementFontDescription.specifiedS ize()); 1957 elementFontDescription.setComputedSize(elementFontDescription.specifiedS ize());
1957 newStyle->setFontDescription(elementFontDescription); 1958 newStyle->setFontDescription(elementFontDescription);
1958 } else { 1959 } else {
1959 FontFamily fontFamily; 1960 FontFamily fontFamily;
1960 fontFamily.setFamily(defaultFontFamily); 1961 fontFamily.setFamily(defaultFontFamily);
1961 1962
1962 FontDescription defaultFontDescription; 1963 FontDescription defaultFontDescription;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 2503
2503 unsigned CanvasRenderingContext2D::hitRegionsCount() const 2504 unsigned CanvasRenderingContext2D::hitRegionsCount() const
2504 { 2505 {
2505 if (m_hitRegionManager) 2506 if (m_hitRegionManager)
2506 return m_hitRegionManager->getHitRegionsCount(); 2507 return m_hitRegionManager->getHitRegionsCount();
2507 2508
2508 return 0; 2509 return 0;
2509 } 2510 }
2510 2511
2511 } // namespace blink 2512 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/canvas-set-font-with-updated-style-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698