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

Side by Side Diff: Source/core/html/LinkRelAttribute.cpp

Issue 656723005: Use C++11 features in core/html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use meaningful names Created 6 years, 2 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 , m_isImport(false) 48 , m_isImport(false)
49 , m_isManifest(false) 49 , m_isManifest(false)
50 , m_isTransitionExitingStylesheet(false) 50 , m_isTransitionExitingStylesheet(false)
51 { 51 {
52 if (rel.isEmpty()) 52 if (rel.isEmpty())
53 return; 53 return;
54 String relCopy = rel; 54 String relCopy = rel;
55 relCopy.replace('\n', ' '); 55 relCopy.replace('\n', ' ');
56 Vector<String> list; 56 Vector<String> list;
57 relCopy.split(' ', list); 57 relCopy.split(' ', list);
58 Vector<String>::const_iterator end = list.end(); 58 for (const auto& linkType : list) {
59 for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) { 59 if (equalIgnoringCase(linkType, "stylesheet")) {
60 if (equalIgnoringCase(*it, "stylesheet")) {
61 if (!m_isImport) 60 if (!m_isImport)
62 m_isStyleSheet = true; 61 m_isStyleSheet = true;
63 } else if (equalIgnoringCase(*it, "import")) { 62 } else if (equalIgnoringCase(linkType, "import")) {
64 if (!m_isStyleSheet) 63 if (!m_isStyleSheet)
65 m_isImport = true; 64 m_isImport = true;
66 } else if (equalIgnoringCase(*it, "alternate")) { 65 } else if (equalIgnoringCase(linkType, "alternate")) {
67 m_isAlternate = true; 66 m_isAlternate = true;
68 } else if (equalIgnoringCase(*it, "icon")) { 67 } else if (equalIgnoringCase(linkType, "icon")) {
69 // This also allows "shortcut icon" since we just ignore the non-sta ndard "shortcut" token. 68 // This also allows "shortcut icon" since we just ignore the non-sta ndard "shortcut" token.
70 // FIXME: This doesn't really follow the spec that requires "shortcu t icon" to be the 69 // FIXME: This doesn't really follow the spec that requires "shortcu t icon" to be the
71 // entire string http://www.whatwg.org/specs/web-apps/current-work/m ultipage/links.html#rel-icon 70 // entire string http://www.whatwg.org/specs/web-apps/current-work/m ultipage/links.html#rel-icon
72 m_iconType = Favicon; 71 m_iconType = Favicon;
73 } else if (equalIgnoringCase(*it, "prefetch")) { 72 } else if (equalIgnoringCase(linkType, "prefetch")) {
74 m_isLinkPrefetch = true; 73 m_isLinkPrefetch = true;
75 } else if (equalIgnoringCase(*it, "dns-prefetch")) { 74 } else if (equalIgnoringCase(linkType, "dns-prefetch")) {
76 m_isDNSPrefetch = true; 75 m_isDNSPrefetch = true;
77 } else if (equalIgnoringCase(*it, "subresource")) { 76 } else if (equalIgnoringCase(linkType, "subresource")) {
78 m_isLinkSubresource = true; 77 m_isLinkSubresource = true;
79 } else if (equalIgnoringCase(*it, "prerender")) { 78 } else if (equalIgnoringCase(linkType, "prerender")) {
80 m_isLinkPrerender = true; 79 m_isLinkPrerender = true;
81 } else if (equalIgnoringCase(*it, "next")) { 80 } else if (equalIgnoringCase(linkType, "next")) {
82 m_isLinkNext = true; 81 m_isLinkNext = true;
83 } else if (equalIgnoringCase(*it, "apple-touch-icon")) { 82 } else if (equalIgnoringCase(linkType, "apple-touch-icon")) {
84 if (RuntimeEnabledFeatures::touchIconLoadingEnabled()) 83 if (RuntimeEnabledFeatures::touchIconLoadingEnabled())
85 m_iconType = TouchIcon; 84 m_iconType = TouchIcon;
86 } else if (equalIgnoringCase(*it, "apple-touch-icon-precomposed")) { 85 } else if (equalIgnoringCase(linkType, "apple-touch-icon-precomposed")) {
87 if (RuntimeEnabledFeatures::touchIconLoadingEnabled()) 86 if (RuntimeEnabledFeatures::touchIconLoadingEnabled())
88 m_iconType = TouchPrecomposedIcon; 87 m_iconType = TouchPrecomposedIcon;
89 } else if (equalIgnoringCase(*it, "manifest")) { 88 } else if (equalIgnoringCase(linkType, "manifest")) {
90 m_isManifest = true; 89 m_isManifest = true;
91 } else if (equalIgnoringCase(rel, "transition-exiting-stylesheet")) { 90 } else if (equalIgnoringCase(rel, "transition-exiting-stylesheet")) {
92 if (RuntimeEnabledFeatures::navigationTransitionsEnabled()) 91 if (RuntimeEnabledFeatures::navigationTransitionsEnabled())
93 m_isTransitionExitingStylesheet = true; 92 m_isTransitionExitingStylesheet = true;
94 } 93 }
95 } 94 }
96 } 95 }
97 96
98 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698