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

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

Issue 96283002: Web Animations API: Start implementation of Element.animate(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout test for animate() Created 7 years 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "core/css/Pair.h" 72 #include "core/css/Pair.h"
73 #include "core/css/Rect.h" 73 #include "core/css/Rect.h"
74 #include "core/css/StylePropertySet.h" 74 #include "core/css/StylePropertySet.h"
75 #include "core/css/StyleRule.h" 75 #include "core/css/StyleRule.h"
76 #include "core/css/StyleRuleImport.h" 76 #include "core/css/StyleRuleImport.h"
77 #include "core/css/StyleSheetContents.h" 77 #include "core/css/StyleSheetContents.h"
78 #include "core/dom/Document.h" 78 #include "core/dom/Document.h"
79 #include "core/html/parser/HTMLParserIdioms.h" 79 #include "core/html/parser/HTMLParserIdioms.h"
80 #include "core/inspector/InspectorInstrumentation.h" 80 #include "core/inspector/InspectorInstrumentation.h"
81 #include "core/page/PageConsole.h" 81 #include "core/page/PageConsole.h"
82 #include "core/page/RuntimeCSSEnabled.h"
82 #include "core/page/Settings.h" 83 #include "core/page/Settings.h"
83 #include "core/rendering/RenderTheme.h" 84 #include "core/rendering/RenderTheme.h"
84 #include "core/svg/SVGParserUtilities.h" 85 #include "core/svg/SVGParserUtilities.h"
85 #include "platform/FloatConversion.h" 86 #include "platform/FloatConversion.h"
86 #include "wtf/BitArray.h" 87 #include "wtf/BitArray.h"
87 #include "wtf/HexNumber.h" 88 #include "wtf/HexNumber.h"
88 #include "wtf/text/StringBuffer.h" 89 #include "wtf/text/StringBuffer.h"
89 #include "wtf/text/StringBuilder.h" 90 #include "wtf/text/StringBuilder.h"
90 #include "wtf/text/StringImpl.h" 91 #include "wtf/text/StringImpl.h"
91 #include "wtf/text/TextEncoding.h" 92 #include "wtf/text/TextEncoding.h"
(...skipping 10120 matching lines...) Expand 10 before | Expand all | Expand 10 after
10212 unsigned length = string.length(); 10213 unsigned length = string.length();
10213 10214
10214 if (!length) 10215 if (!length)
10215 return CSSPropertyInvalid; 10216 return CSSPropertyInvalid;
10216 if (length > maxCSSPropertyNameLength) 10217 if (length > maxCSSPropertyNameLength)
10217 return CSSPropertyInvalid; 10218 return CSSPropertyInvalid;
10218 10219
10219 return string.is8Bit() ? cssPropertyID(string.characters8(), length) : cssPr opertyID(string.characters16(), length); 10220 return string.is8Bit() ? cssPropertyID(string.characters8(), length) : cssPr opertyID(string.characters16(), length);
10220 } 10221 }
10221 10222
10223 CSSPropertyID camelCaseCSSPropertyNameToID(StringImpl* propertyName)
10224 {
10225 typedef HashMap<StringImpl*, CSSPropertyID> CSSPropertyIDMap;
10226 DEFINE_STATIC_LOCAL(CSSPropertyIDMap, map, ());
10227
10228 CSSPropertyID id = map.get(propertyName);
10229
10230 if (!id) {
10231 StringBuilder builder;
10232 size_t position = 0;
10233 size_t end;
10234 while ((end = propertyName->find(isASCIIUpper, position)) != kNotFound) {
10235 builder.append(propertyName->substring(position, end) + "-" + toASCI ILower((*propertyName)[end]));
esprehn 2013/12/09 18:51:25 You shouldn't add this, instead refactor the V8CSS
Steve Block 2013/12/09 23:32:20 I recommended this too, but after discussion with
esprehn 2013/12/09 23:36:16 Why is it safe to ignore the webkit prefix? It doe
shans 2013/12/09 23:48:40 We don't intend the Web Animations API to support
10236 position = end + 1;
10237 }
10238 builder.append(propertyName->substring(position));
10239 // Doesn't handle prefixed properties.
10240 id = cssPropertyID(builder.toString());
10241 if (id != CSSPropertyInvalid && RuntimeCSSEnabled::isCSSPropertyEnabled( id))
10242 map.add(propertyName, id);
esprehn 2013/12/09 18:51:25 This is a memory leak, it'll just grow forever wit
shans 2013/12/09 23:25:57 Invalid property names are explicitly filtered out
esprehn 2013/12/09 23:36:16 Awesome.
10243 }
10244
10245 return id;
10246 }
10247
10222 template <typename CharacterType> 10248 template <typename CharacterType>
10223 static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned length) 10249 static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned length)
10224 { 10250 {
10225 char buffer[maxCSSValueKeywordLength + 1]; // 1 for null character 10251 char buffer[maxCSSValueKeywordLength + 1]; // 1 for null character
10226 10252
10227 for (unsigned i = 0; i != length; ++i) { 10253 for (unsigned i = 0; i != length; ++i) {
10228 CharacterType c = valueKeyword[i]; 10254 CharacterType c = valueKeyword[i];
10229 if (c == 0 || c >= 0x7F) 10255 if (c == 0 || c >= 0x7F)
10230 return CSSValueInvalid; // illegal character 10256 return CSSValueInvalid; // illegal character
10231 buffer[i] = WTF::toASCIILower(c); 10257 buffer[i] = WTF::toASCIILower(c);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
10406 { 10432 {
10407 // The tokenizer checks for the construct of an+b. 10433 // The tokenizer checks for the construct of an+b.
10408 // However, since the {ident} rule precedes the {nth} rule, some of those 10434 // However, since the {ident} rule precedes the {nth} rule, some of those
10409 // tokens are identified as string literal. Furthermore we need to accept 10435 // tokens are identified as string literal. Furthermore we need to accept
10410 // "odd" and "even" which does not match to an+b. 10436 // "odd" and "even" which does not match to an+b.
10411 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 10437 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
10412 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 10438 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
10413 } 10439 }
10414 10440
10415 } 10441 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698