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

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

Issue 10885027: Merge 126959 - style->fontMetrics() should be available when setting line-height (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 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/crash-set-font.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 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 newStyle->setFontDescription(computedStyle->fontDescription()); 2007 newStyle->setFontDescription(computedStyle->fontDescription());
2008 newStyle->font().update(newStyle->font().fontSelector()); 2008 newStyle->font().update(newStyle->font().fontSelector());
2009 2009
2010 // Now map the font property longhands into the style. 2010 // Now map the font property longhands into the style.
2011 StyleResolver* styleResolver = canvas()->styleResolver(); 2011 StyleResolver* styleResolver = canvas()->styleResolver();
2012 styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getP ropertyCSSValue(CSSPropertyFontFamily).get(), newStyle.get()); 2012 styleResolver->applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getP ropertyCSSValue(CSSPropertyFontFamily).get(), newStyle.get());
2013 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontStyle, parsedStyle ->getPropertyCSSValue(CSSPropertyFontStyle).get()); 2013 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontStyle, parsedStyle ->getPropertyCSSValue(CSSPropertyFontStyle).get());
2014 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontVariant, parsedSty le->getPropertyCSSValue(CSSPropertyFontVariant).get()); 2014 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontVariant, parsedSty le->getPropertyCSSValue(CSSPropertyFontVariant).get());
2015 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontWeight, parsedStyl e->getPropertyCSSValue(CSSPropertyFontWeight).get()); 2015 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontWeight, parsedStyl e->getPropertyCSSValue(CSSPropertyFontWeight).get());
2016 2016
2017 // As described in BUG66291, setting font-size on a font may entail a CSSPri mitiveValue::computeLengthDouble call, 2017 // As described in BUG66291, setting font-size and line-height on a font may entail a CSSPrimitiveValue::computeLengthDouble call,
2018 // which assumes the fontMetrics are available for the affected font, otherw ise a crash occurs (see http://trac.webkit.org/changeset/96122). 2018 // which assumes the fontMetrics are available for the affected font, otherw ise a crash occurs (see http://trac.webkit.org/changeset/96122).
2019 // The updateFont() call below updates the fontMetrics and ensures the prope r setting of font-size. 2019 // The updateFont() calls below update the fontMetrics and ensure the proper setting of font-size and line-height.
2020 styleResolver->updateFont(); 2020 styleResolver->updateFont();
2021 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontSize, parsedStyle- >getPropertyCSSValue(CSSPropertyFontSize).get()); 2021 styleResolver->applyPropertyToCurrentStyle(CSSPropertyFontSize, parsedStyle- >getPropertyCSSValue(CSSPropertyFontSize).get());
2022 styleResolver->updateFont();
2022 styleResolver->applyPropertyToCurrentStyle(CSSPropertyLineHeight, parsedStyl e->getPropertyCSSValue(CSSPropertyLineHeight).get()); 2023 styleResolver->applyPropertyToCurrentStyle(CSSPropertyLineHeight, parsedStyl e->getPropertyCSSValue(CSSPropertyLineHeight).get());
2023 2024
2024 modifiableState().m_font = newStyle->font(); 2025 modifiableState().m_font = newStyle->font();
2025 modifiableState().m_font.update(styleResolver->fontSelector()); 2026 modifiableState().m_font.update(styleResolver->fontSelector());
2026 modifiableState().m_realizedFont = true; 2027 modifiableState().m_realizedFont = true;
2027 styleResolver->fontSelector()->registerForInvalidationCallbacks(&modifiableS tate()); 2028 styleResolver->fontSelector()->registerForInvalidationCallbacks(&modifiableS tate());
2028 } 2029 }
2029 2030
2030 String CanvasRenderingContext2D::textAlign() const 2031 String CanvasRenderingContext2D::textAlign() const
2031 { 2032 {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 { 2278 {
2278 if (enabled == state().m_imageSmoothingEnabled) 2279 if (enabled == state().m_imageSmoothingEnabled)
2279 return; 2280 return;
2280 2281
2281 realizeSaves(); 2282 realizeSaves();
2282 modifiableState().m_imageSmoothingEnabled = enabled; 2283 modifiableState().m_imageSmoothingEnabled = enabled;
2283 drawingContext()->setImageInterpolationQuality(enabled ? DefaultInterpolatio nQuality : InterpolationNone); 2284 drawingContext()->setImageInterpolationQuality(enabled ? DefaultInterpolatio nQuality : InterpolationNone);
2284 } 2285 }
2285 2286
2286 } // namespace WebCore 2287 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/crash-set-font.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698