| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 * | 29 * |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "config.h" | 32 #include "config.h" |
| 33 #include "core/html/LinkRelAttribute.h" | 33 #include "core/html/LinkRelAttribute.h" |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 LinkRelAttribute::LinkRelAttribute() | 37 LinkRelAttribute::LinkRelAttribute() |
| 38 : m_isStyleSheet(false) | 38 : m_iconType(InvalidIcon) |
| 39 , m_iconType(InvalidIcon) | 39 , m_isStyleSheet(false) |
| 40 , m_isAlternate(false) | 40 , m_isAlternate(false) |
| 41 , m_isDNSPrefetch(false) | 41 , m_isDNSPrefetch(false) |
| 42 , m_isLinkPrefetch(false) | 42 , m_isLinkPrefetch(false) |
| 43 , m_isLinkSubresource(false) | 43 , m_isLinkSubresource(false) |
| 44 , m_isLinkPrerender(false) | 44 , m_isLinkPrerender(false) |
| 45 , m_isImport(false) |
| 45 { | 46 { |
| 46 } | 47 } |
| 47 | 48 |
| 48 LinkRelAttribute::LinkRelAttribute(const String& rel) | 49 LinkRelAttribute::LinkRelAttribute(const String& rel) |
| 49 : m_isStyleSheet(false) | 50 : m_iconType(InvalidIcon) |
| 50 , m_iconType(InvalidIcon) | 51 , m_isStyleSheet(false) |
| 51 , m_isAlternate(false) | 52 , m_isAlternate(false) |
| 52 , m_isDNSPrefetch(false) | 53 , m_isDNSPrefetch(false) |
| 53 , m_isLinkPrefetch(false) | 54 , m_isLinkPrefetch(false) |
| 54 , m_isLinkSubresource(false) | 55 , m_isLinkSubresource(false) |
| 55 , m_isLinkPrerender(false) | 56 , m_isLinkPrerender(false) |
| 57 , m_isImport(false) |
| 56 { | 58 { |
| 57 if (equalIgnoringCase(rel, "stylesheet")) | 59 if (equalIgnoringCase(rel, "stylesheet")) |
| 58 m_isStyleSheet = true; | 60 m_isStyleSheet = true; |
| 59 else if (equalIgnoringCase(rel, "icon") || equalIgnoringCase(rel, "shortcut
icon")) | 61 else if (equalIgnoringCase(rel, "icon") || equalIgnoringCase(rel, "shortcut
icon")) |
| 60 m_iconType = Favicon; | 62 m_iconType = Favicon; |
| 61 #if ENABLE(TOUCH_ICON_LOADING) | 63 #if ENABLE(TOUCH_ICON_LOADING) |
| 62 else if (equalIgnoringCase(rel, "apple-touch-icon")) | 64 else if (equalIgnoringCase(rel, "apple-touch-icon")) |
| 63 m_iconType = TouchIcon; | 65 m_iconType = TouchIcon; |
| 64 else if (equalIgnoringCase(rel, "apple-touch-icon-precomposed")) | 66 else if (equalIgnoringCase(rel, "apple-touch-icon-precomposed")) |
| 65 m_iconType = TouchPrecomposedIcon; | 67 m_iconType = TouchPrecomposedIcon; |
| 66 #endif | 68 #endif |
| 67 else if (equalIgnoringCase(rel, "dns-prefetch")) | 69 else if (equalIgnoringCase(rel, "dns-prefetch")) |
| 68 m_isDNSPrefetch = true; | 70 m_isDNSPrefetch = true; |
| 69 else if (equalIgnoringCase(rel, "alternate stylesheet") || equalIgnoringCase
(rel, "stylesheet alternate")) { | 71 else if (equalIgnoringCase(rel, "alternate stylesheet") || equalIgnoringCase
(rel, "stylesheet alternate")) { |
| 70 m_isStyleSheet = true; | 72 m_isStyleSheet = true; |
| 71 m_isAlternate = true; | 73 m_isAlternate = true; |
| 74 } else if (equalIgnoringCase(rel, "dns-prefetch")) { |
| 75 m_isDNSPrefetch = true; |
| 76 } else if (equalIgnoringCase(rel, "import")) { |
| 77 m_isImport = true; |
| 72 } else { | 78 } else { |
| 73 // Tokenize the rel attribute and set bits based on specific keywords th
at we find. | 79 // Tokenize the rel attribute and set bits based on specific keywords th
at we find. |
| 74 String relCopy = rel; | 80 String relCopy = rel; |
| 75 relCopy.replace('\n', ' '); | 81 relCopy.replace('\n', ' '); |
| 76 Vector<String> list; | 82 Vector<String> list; |
| 77 relCopy.split(' ', list); | 83 relCopy.split(' ', list); |
| 78 Vector<String>::const_iterator end = list.end(); | 84 Vector<String>::const_iterator end = list.end(); |
| 79 for (Vector<String>::const_iterator it = list.begin(); it != end; ++it)
{ | 85 for (Vector<String>::const_iterator it = list.begin(); it != end; ++it)
{ |
| 80 if (equalIgnoringCase(*it, "stylesheet")) | 86 if (equalIgnoringCase(*it, "stylesheet")) |
| 81 m_isStyleSheet = true; | 87 m_isStyleSheet = true; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 93 m_isLinkPrefetch = true; | 99 m_isLinkPrefetch = true; |
| 94 else if (equalIgnoringCase(*it, "subresource")) | 100 else if (equalIgnoringCase(*it, "subresource")) |
| 95 m_isLinkSubresource = true; | 101 m_isLinkSubresource = true; |
| 96 else if (equalIgnoringCase(*it, "prerender")) | 102 else if (equalIgnoringCase(*it, "prerender")) |
| 97 m_isLinkPrerender = true; | 103 m_isLinkPrerender = true; |
| 98 } | 104 } |
| 99 } | 105 } |
| 100 } | 106 } |
| 101 | 107 |
| 102 } | 108 } |
| OLD | NEW |