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

Side by Side Diff: Source/core/platform/ParsingUtilities.h

Issue 23861003: Enable srcset support in HTMLImageElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rewrote HTMLSrcsetParser, making it more efficient and readable. Addressed abarth's review comments. Created 7 years, 3 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ParsingUtilities_h
6 #define ParsingUtilities_h
7
8 template<typename CharType>
9 bool skipExactly(const CharType*& position, const CharType* end, CharType delimi ter)
10 {
11 if (position < end && *position == delimiter) {
12 ++position;
13 return true;
14 }
15 return false;
16 }
17
18 template<typename CharType, bool characterPredicate(CharType)>
cbiesinger 2013/09/19 23:01:44 Couldn't you make CharType the second template arg
abarth-chromium 2013/09/20 16:08:07 +1
19 bool skipExactly(const CharType*& position, const CharType* end)
20 {
21 if (position < end && characterPredicate(*position)) {
22 ++position;
23 return true;
24 }
25 return false;
26 }
27
28 template<typename CharType>
29 void skipUntil(const CharType*& position, const CharType* end, CharType delimite r)
30 {
31 while (position < end && *position != delimiter)
32 ++position;
33 }
34
35 template<typename CharType, bool characterPredicate(CharType)>
36 void skipUntil(const CharType*& position, const CharType* end)
37 {
38 while (position < end && !characterPredicate(*position))
39 ++position;
40 }
41
42 template<typename CharType, bool characterPredicate(CharType)>
43 void skipWhile(const CharType*& position, const CharType* end)
44 {
45 while (position < end && characterPredicate(*position))
46 ++position;
47 }
48
49 #endif
50
OLDNEW
« Source/core/html/parser/HTMLSrcsetParser.cpp ('K') | « Source/core/page/RuntimeEnabledFeatures.in ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698