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

Side by Side Diff: Source/core/css/parser/BisonCSSParser-in.cpp

Issue 1103273010: Add parseFontFaceDescriptor for @font-face handling (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: V2 Created 5 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 m_parsedRules.append(rule.release()); 719 m_parsedRules.append(rule.release());
720 CSSSelectorParser::recordSelectorStats(m_context, result->selectorList() ); 720 CSSSelectorParser::recordSelectorStats(m_context, result->selectorList() );
721 } 721 }
722 clearProperties(); 722 clearProperties();
723 return result; 723 return result;
724 } 724 }
725 725
726 StyleRuleBase* BisonCSSParser::createFontFaceRule() 726 StyleRuleBase* BisonCSSParser::createFontFaceRule()
727 { 727 {
728 m_allowImportRules = m_allowNamespaceDeclarations = false; 728 m_allowImportRules = m_allowNamespaceDeclarations = false;
729 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { 729 RefPtrWillBeRawPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create();
730 CSSProperty& property = m_parsedProperties[i]; 730 if (!rule->setProperties(createStylePropertySet())) {
731 if (property.id() == CSSPropertyFontFamily && (!property.value()->isValu eList() || toCSSValueList(property.value())->length() != 1)) { 731 clearProperties();
732 // Unlike font-family property, font-family descriptor in @font-face rule 732 return nullptr;
733 // has to be a value list with exactly one family name. It cannot ha ve a
734 // have 'initial' value and cannot 'inherit' from parent.
735 // See http://dev.w3.org/csswg/css3-fonts/#font-family-desc
736 clearProperties();
737 return 0;
738 }
739 } 733 }
740 RefPtrWillBeRawPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create();
741 rule->setProperties(createStylePropertySet());
742 clearProperties(); 734 clearProperties();
743 StyleRuleFontFace* result = rule.get(); 735 StyleRuleFontFace* result = rule.get();
744 m_parsedRules.append(rule.release()); 736 m_parsedRules.append(rule.release());
745 if (m_styleSheet) 737 if (m_styleSheet)
746 m_styleSheet->setHasFontFaceRule(true); 738 m_styleSheet->setHasFontFaceRule(true);
747 return result; 739 return result;
748 } 740 }
749 741
750 void BisonCSSParser::addNamespace(const AtomicString& prefix, const AtomicString & uri) 742 void BisonCSSParser::addNamespace(const AtomicString& prefix, const AtomicString & uri)
751 { 743 {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 rule->setProperties(createStylePropertySet()); 1004 rule->setProperties(createStylePropertySet());
1013 clearProperties(); 1005 clearProperties();
1014 1006
1015 StyleRuleViewport* result = rule.get(); 1007 StyleRuleViewport* result = rule.get();
1016 m_parsedRules.append(rule.release()); 1008 m_parsedRules.append(rule.release());
1017 1009
1018 return result; 1010 return result;
1019 } 1011 }
1020 1012
1021 } 1013 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698