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

Side by Side Diff: Source/core/dom/StyleSheetCandidate.cpp

Issue 192293002: Use new is*Element() helper functions in DOM code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add is*Element(PassRefPtr) helper Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 return true; 98 return true;
99 } 99 }
100 100
101 StyleSheetCandidate::Type StyleSheetCandidate::typeOf(Node& node) 101 StyleSheetCandidate::Type StyleSheetCandidate::typeOf(Node& node)
102 { 102 {
103 if (node.nodeType() == Node::PROCESSING_INSTRUCTION_NODE) 103 if (node.nodeType() == Node::PROCESSING_INSTRUCTION_NODE)
104 return Pi; 104 return Pi;
105 105
106 if (node.isHTMLElement()) { 106 if (node.isHTMLElement()) {
107 if (node.hasTagName(linkTag)) 107 if (isHTMLLinkElement(node))
108 return HTMLLink; 108 return HTMLLink;
109 if (node.hasTagName(styleTag)) 109 if (isHTMLStyleElement(node))
110 return HTMLStyle; 110 return HTMLStyle;
111 111
112 ASSERT_NOT_REACHED(); 112 ASSERT_NOT_REACHED();
113 return HTMLStyle; 113 return HTMLStyle;
114 } 114 }
115 115
116 if (node.isSVGElement() && node.hasTagName(SVGNames::styleTag)) 116 if (isSVGStyleElement(node))
117 return SVGStyle; 117 return SVGStyle;
118 118
119 ASSERT_NOT_REACHED(); 119 ASSERT_NOT_REACHED();
120 return HTMLStyle; 120 return HTMLStyle;
121 } 121 }
122 122
123 StyleSheet* StyleSheetCandidate::sheet() const 123 StyleSheet* StyleSheetCandidate::sheet() const
124 { 124 {
125 switch (m_type) { 125 switch (m_type) {
126 case HTMLLink: 126 case HTMLLink:
127 return toHTMLLinkElement(m_node).sheet(); 127 return toHTMLLinkElement(m_node).sheet();
128 case HTMLStyle: 128 case HTMLStyle:
129 return toHTMLStyleElement(m_node).sheet(); 129 return toHTMLStyleElement(m_node).sheet();
130 case SVGStyle: 130 case SVGStyle:
131 return toSVGStyleElement(m_node).sheet(); 131 return toSVGStyleElement(m_node).sheet();
132 case Pi: 132 case Pi:
133 return toProcessingInstruction(m_node).sheet(); 133 return toProcessingInstruction(m_node).sheet();
134 } 134 }
135 135
136 ASSERT_NOT_REACHED(); 136 ASSERT_NOT_REACHED();
137 return 0; 137 return 0;
138 } 138 }
139 139
140 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698