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

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

Issue 5216392399814656: Clear StyleResolverState after each resolve. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated after levi's revert Created 7 years, 5 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 | « Source/core/css/resolver/StyleResolverState.cpp ('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 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 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 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 defaultFontDescription.setFamily(fontFamily); 1987 defaultFontDescription.setFamily(fontFamily);
1988 defaultFontDescription.setSpecifiedSize(defaultFontSize); 1988 defaultFontDescription.setSpecifiedSize(defaultFontSize);
1989 defaultFontDescription.setComputedSize(defaultFontSize); 1989 defaultFontDescription.setComputedSize(defaultFontSize);
1990 1990
1991 newStyle->setFontDescription(defaultFontDescription); 1991 newStyle->setFontDescription(defaultFontDescription);
1992 } 1992 }
1993 1993
1994 newStyle->font().update(newStyle->font().fontSelector()); 1994 newStyle->font().update(newStyle->font().fontSelector());
1995 1995
1996 // Now map the font property longhands into the style. 1996 // Now map the font property longhands into the style.
1997 CSSPropertyValue properties[] = {
1998 CSSPropertyValue(CSSPropertyFontFamily, *parsedStyle),
1999 CSSPropertyValue(CSSPropertyFontStyle, *parsedStyle),
2000 CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle),
2001 CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle),
2002 CSSPropertyValue(CSSPropertyFontSize, *parsedStyle),
2003 CSSPropertyValue(CSSPropertyLineHeight, *parsedStyle),
2004 };
2005
1997 StyleResolver* styleResolver = canvas()->styleResolver(); 2006 StyleResolver* styleResolver = canvas()->styleResolver();
1998 styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getP ropertyCSSValue(CSSPropertyFontFamily).get(), newStyle.get()); 2007 styleResolver->applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(propertie s), newStyle.get());
1999 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontStyle, parsedStyle ->getPropertyCSSValue(CSSPropertyFontStyle).get());
2000 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontVariant, parsedSty le->getPropertyCSSValue(CSSPropertyFontVariant).get());
2001 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontWeight, parsedStyl e->getPropertyCSSValue(CSSPropertyFontWeight).get());
2002
2003 // As described in BUG66291, setting font-size and line-height on a font may entail a CSSPrimitiveValue::computeLengthDouble call,
2004 // which assumes the fontMetrics are available for the affected font, otherw ise a crash occurs (see http://trac.webkit.org/changeset/96122).
2005 // The updateFont() calls below update the fontMetrics and ensure the proper setting of font-size and line-height.
2006 styleResolver->updateFont();
2007 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontSize, parsedStyle- >getPropertyCSSValue(CSSPropertyFontSize).get());
2008 styleResolver->updateFont();
2009 styleResolver->applyPropertyToCurrentStyle(CSSPropertyLineHeight, parsedStyl e->getPropertyCSSValue(CSSPropertyLineHeight).get());
2010 2008
2011 modifiableState().m_font = newStyle->font(); 2009 modifiableState().m_font = newStyle->font();
2012 modifiableState().m_font.update(styleResolver->fontSelector()); 2010 modifiableState().m_font.update(styleResolver->fontSelector());
2013 modifiableState().m_realizedFont = true; 2011 modifiableState().m_realizedFont = true;
2014 styleResolver->fontSelector()->registerForInvalidationCallbacks(&modifiableS tate()); 2012 styleResolver->fontSelector()->registerForInvalidationCallbacks(&modifiableS tate());
2015 } 2013 }
2016 2014
2017 String CanvasRenderingContext2D::textAlign() const 2015 String CanvasRenderingContext2D::textAlign() const
2018 { 2016 {
2019 return textAlignName(state().m_textAlign); 2017 return textAlignName(state().m_textAlign);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 } 2230 }
2233 2231
2234 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const 2232 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const
2235 { 2233 {
2236 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate(); 2234 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate();
2237 attributes->setAlpha(m_hasAlpha); 2235 attributes->setAlpha(m_hasAlpha);
2238 return attributes.release(); 2236 return attributes.release();
2239 } 2237 }
2240 2238
2241 } // namespace WebCore 2239 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolverState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698