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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 1184413005: Clean up some CSSPropertyID helpers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 7523 matching lines...) Expand 10 before | Expand all | Expand 10 after
7534 unsigned length = string.length(); 7534 unsigned length = string.length();
7535 7535
7536 if (!length) 7536 if (!length)
7537 return CSSPropertyInvalid; 7537 return CSSPropertyInvalid;
7538 if (length > maxCSSPropertyNameLength) 7538 if (length > maxCSSPropertyNameLength)
7539 return CSSPropertyInvalid; 7539 return CSSPropertyInvalid;
7540 7540
7541 return string.is8Bit() ? unresolvedCSSPropertyID(string.characters8(), lengt h) : unresolvedCSSPropertyID(string.characters16(), length); 7541 return string.is8Bit() ? unresolvedCSSPropertyID(string.characters8(), lengt h) : unresolvedCSSPropertyID(string.characters16(), length);
7542 } 7542 }
7543 7543
7544 CSSPropertyID cssPropertyID(const String& string)
7545 {
7546 return resolveCSSPropertyID(unresolvedCSSPropertyID(string));
7547 }
7548
7549 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString& string)
7550 {
7551 unsigned length = string.length();
7552
7553 if (!length)
7554 return CSSPropertyInvalid;
7555 if (length > maxCSSPropertyNameLength)
7556 return CSSPropertyInvalid;
7557
7558 return string.is8Bit() ? unresolvedCSSPropertyID(string.characters8(), lengt h) : unresolvedCSSPropertyID(string.characters16(), length);
7559 }
7560
7561 template <typename CharacterType> 7544 template <typename CharacterType>
7562 static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned length) 7545 static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned length)
7563 { 7546 {
7564 char buffer[maxCSSValueKeywordLength + 1]; // 1 for null character 7547 char buffer[maxCSSValueKeywordLength + 1]; // 1 for null character
7565 7548
7566 for (unsigned i = 0; i != length; ++i) { 7549 for (unsigned i = 0; i != length; ++i) {
7567 CharacterType c = valueKeyword[i]; 7550 CharacterType c = valueKeyword[i];
7568 if (c == 0 || c >= 0x7F) 7551 if (c == 0 || c >= 0x7F)
7569 return CSSValueInvalid; // illegal character 7552 return CSSValueInvalid; // illegal character
7570 buffer[i] = WTF::toASCIILower(c); 7553 buffer[i] = WTF::toASCIILower(c);
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
8179 } 8162 }
8180 } 8163 }
8181 8164
8182 if (!list->length()) 8165 if (!list->length())
8183 return nullptr; 8166 return nullptr;
8184 8167
8185 return list.release(); 8168 return list.release();
8186 } 8169 }
8187 8170
8188 } // namespace blink 8171 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698