| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 | 300 |
| 301 static void applyPropertyToCurrentStyle(StyleResolver* styleResolver, CSSPropert
yID id, const RefPtr<StylePropertySet>& parsedStyle) | 301 static void applyPropertyToCurrentStyle(StyleResolver* styleResolver, CSSPropert
yID id, const RefPtr<StylePropertySet>& parsedStyle) |
| 302 { | 302 { |
| 303 styleResolver->applyPropertyToCurrentStyle(id, parsedStyle->getPropertyCSSVa
lue(id).get()); | 303 styleResolver->applyPropertyToCurrentStyle(id, parsedStyle->getPropertyCSSVa
lue(id).get()); |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool FontLoader::resolveFontStyle(const String& fontString, Font& font) | 306 bool FontLoader::resolveFontStyle(const String& fontString, Font& font) |
| 307 { | 307 { |
| 308 // Interpret fontString in the same way as the 'font' attribute of CanvasRen
deringContext2D. | 308 // Interpret fontString in the same way as the 'font' attribute of CanvasRen
deringContext2D. |
| 309 RefPtr<StylePropertySet> parsedStyle = StylePropertySet::create(); | 309 RefPtr<MutableStylePropertySet> parsedStyle = MutableStylePropertySet::creat
e(); |
| 310 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, true,
CSSStrictMode, 0); | 310 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, true,
CSSStrictMode, 0); |
| 311 if (parsedStyle->isEmpty()) | 311 if (parsedStyle->isEmpty()) |
| 312 return false; | 312 return false; |
| 313 | 313 |
| 314 String fontValue = parsedStyle->getPropertyValue(CSSPropertyFont); | 314 String fontValue = parsedStyle->getPropertyValue(CSSPropertyFont); |
| 315 if (fontValue == "inherit" || fontValue == "initial") | 315 if (fontValue == "inherit" || fontValue == "initial") |
| 316 return false; | 316 return false; |
| 317 | 317 |
| 318 RefPtr<RenderStyle> style = RenderStyle::create(); | 318 RefPtr<RenderStyle> style = RenderStyle::create(); |
| 319 | 319 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 343 applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontSize, parsedStyle)
; | 343 applyPropertyToCurrentStyle(styleResolver, CSSPropertyFontSize, parsedStyle)
; |
| 344 styleResolver->updateFont(); | 344 styleResolver->updateFont(); |
| 345 applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyl
e); | 345 applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyl
e); |
| 346 | 346 |
| 347 font = style->font(); | 347 font = style->font(); |
| 348 font.update(styleResolver->fontSelector()); | 348 font.update(styleResolver->fontSelector()); |
| 349 return true; | 349 return true; |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace WebCore | 352 } // namespace WebCore |
| OLD | NEW |