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

Side by Side Diff: Source/core/css/StyleRule.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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 11 matching lines...) Expand all
22 #include "config.h" 22 #include "config.h"
23 #include "core/css/StyleRule.h" 23 #include "core/css/StyleRule.h"
24 24
25 #include "core/css/CSSFontFaceRule.h" 25 #include "core/css/CSSFontFaceRule.h"
26 #include "core/css/CSSImportRule.h" 26 #include "core/css/CSSImportRule.h"
27 #include "core/css/CSSKeyframesRule.h" 27 #include "core/css/CSSKeyframesRule.h"
28 #include "core/css/CSSMediaRule.h" 28 #include "core/css/CSSMediaRule.h"
29 #include "core/css/CSSPageRule.h" 29 #include "core/css/CSSPageRule.h"
30 #include "core/css/CSSStyleRule.h" 30 #include "core/css/CSSStyleRule.h"
31 #include "core/css/CSSSupportsRule.h" 31 #include "core/css/CSSSupportsRule.h"
32 #include "core/css/CSSValueList.h"
32 #include "core/css/CSSViewportRule.h" 33 #include "core/css/CSSViewportRule.h"
33 #include "core/css/StylePropertySet.h" 34 #include "core/css/StylePropertySet.h"
34 #include "core/css/StyleRuleImport.h" 35 #include "core/css/StyleRuleImport.h"
35 #include "core/css/StyleRuleKeyframe.h" 36 #include "core/css/StyleRuleKeyframe.h"
36 #include "core/css/StyleRuleNamespace.h" 37 #include "core/css/StyleRuleNamespace.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 struct SameSizeAsStyleRuleBase : public RefCountedWillBeGarbageCollectedFinalize d<SameSizeAsStyleRuleBase> { 41 struct SameSizeAsStyleRuleBase : public RefCountedWillBeGarbageCollectedFinalize d<SameSizeAsStyleRuleBase> {
41 unsigned bitfields; 42 unsigned bitfields;
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 { 341 {
341 } 342 }
342 343
343 MutableStylePropertySet& StyleRuleFontFace::mutableProperties() 344 MutableStylePropertySet& StyleRuleFontFace::mutableProperties()
344 { 345 {
345 if (!m_properties->isMutable()) 346 if (!m_properties->isMutable())
346 m_properties = m_properties->mutableCopy(); 347 m_properties = m_properties->mutableCopy();
347 return *toMutableStylePropertySet(m_properties); 348 return *toMutableStylePropertySet(m_properties);
348 } 349 }
349 350
350 void StyleRuleFontFace::setProperties(PassRefPtrWillBeRawPtr<StylePropertySet> p roperties) 351 bool StyleRuleFontFace::setProperties(PassRefPtrWillBeRawPtr<StylePropertySet> p roperties)
351 { 352 {
353 // FIXME: This logic should be in CSSPropertyParser
354 // FIXME: Shouldn't we fail if font-family or src aren't specified?
355 for (unsigned i = 0; i < properties->propertyCount(); ++i) {
356 StylePropertySet::PropertyReference property = properties->propertyAt(i) ;
357 if (property.id() == CSSPropertyFontFamily && (!property.value()->isValu eList() || toCSSValueList(property.value())->length() != 1))
358 return false;
359 }
360
352 m_properties = properties; 361 m_properties = properties;
362 return true;
353 } 363 }
354 364
355 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleFontFace) 365 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleFontFace)
356 { 366 {
357 visitor->trace(m_properties); 367 visitor->trace(m_properties);
358 StyleRuleBase::traceAfterDispatch(visitor); 368 StyleRuleBase::traceAfterDispatch(visitor);
359 } 369 }
360 370
361 StyleRuleGroup::StyleRuleGroup(Type type, WillBeHeapVector<RefPtrWillBeMember<St yleRuleBase>>& adoptRule) 371 StyleRuleGroup::StyleRuleGroup(Type type, WillBeHeapVector<RefPtrWillBeMember<St yleRuleBase>>& adoptRule)
362 : StyleRuleBase(type) 372 : StyleRuleBase(type)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 m_properties = properties; 458 m_properties = properties;
449 } 459 }
450 460
451 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport) 461 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport)
452 { 462 {
453 visitor->trace(m_properties); 463 visitor->trace(m_properties);
454 StyleRuleBase::traceAfterDispatch(visitor); 464 StyleRuleBase::traceAfterDispatch(visitor);
455 } 465 }
456 466
457 } // namespace blink 467 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698