| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 return true; | 163 return true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 inline bool ShadowDOMSiblingTraversalStrategy::isFirstOfType(Element& element, c
onst QualifiedName& type) const | 166 inline bool ShadowDOMSiblingTraversalStrategy::isFirstOfType(Element& element, c
onst QualifiedName& type) const |
| 167 { | 167 { |
| 168 ASSERT(element == toElement(m_siblings[m_nth])); | 168 ASSERT(element == toElement(m_siblings[m_nth])); |
| 169 | 169 |
| 170 for (int i = m_nth - 1; i >= 0; --i) { | 170 for (int i = m_nth - 1; i >= 0; --i) { |
| 171 if (m_siblings[i]->hasTagName(type)) | 171 if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagNa
me(type)) |
| 172 return false; | 172 return false; |
| 173 } | 173 } |
| 174 | 174 |
| 175 return true; | 175 return true; |
| 176 } | 176 } |
| 177 | 177 |
| 178 inline bool ShadowDOMSiblingTraversalStrategy::isLastOfType(Element& element, co
nst QualifiedName& type) const | 178 inline bool ShadowDOMSiblingTraversalStrategy::isLastOfType(Element& element, co
nst QualifiedName& type) const |
| 179 { | 179 { |
| 180 ASSERT(element == toElement(m_siblings[m_nth])); | 180 ASSERT(element == toElement(m_siblings[m_nth])); |
| 181 | 181 |
| 182 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { | 182 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { |
| 183 if (m_siblings[i]->hasTagName(type)) | 183 if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagNa
me(type)) |
| 184 return false; | 184 return false; |
| 185 } | 185 } |
| 186 | 186 |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 inline int ShadowDOMSiblingTraversalStrategy::countElementsBefore(Element& eleme
nt) const | 190 inline int ShadowDOMSiblingTraversalStrategy::countElementsBefore(Element& eleme
nt) const |
| 191 { | 191 { |
| 192 ASSERT(element == toElement(m_siblings[m_nth])); | 192 ASSERT(element == toElement(m_siblings[m_nth])); |
| 193 | 193 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 212 | 212 |
| 213 return count; | 213 return count; |
| 214 } | 214 } |
| 215 | 215 |
| 216 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element&
element, const QualifiedName& type) const | 216 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element&
element, const QualifiedName& type) const |
| 217 { | 217 { |
| 218 ASSERT(element == toElement(m_siblings[m_nth])); | 218 ASSERT(element == toElement(m_siblings[m_nth])); |
| 219 | 219 |
| 220 int count = 0; | 220 int count = 0; |
| 221 for (int i = m_nth - 1; i >= 0; --i) { | 221 for (int i = m_nth - 1; i >= 0; --i) { |
| 222 if (m_siblings[i]->hasTagName(type)) | 222 if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagNa
me(type)) |
| 223 ++count; | 223 ++count; |
| 224 } | 224 } |
| 225 | 225 |
| 226 return count; | 226 return count; |
| 227 } | 227 } |
| 228 | 228 |
| 229 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element&
element, const QualifiedName& type) const | 229 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element&
element, const QualifiedName& type) const |
| 230 { | 230 { |
| 231 ASSERT(element == toElement(m_siblings[m_nth])); | 231 ASSERT(element == toElement(m_siblings[m_nth])); |
| 232 | 232 |
| 233 int count = 0; | 233 int count = 0; |
| 234 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { | 234 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { |
| 235 if (m_siblings[i]->hasTagName(type)) | 235 if (m_siblings[i]->isElementNode() && toElement(m_siblings[i])->hasTagNa
me(type)) |
| 236 return ++count; | 236 return ++count; |
| 237 } | 237 } |
| 238 | 238 |
| 239 return count; | 239 return count; |
| 240 } | 240 } |
| 241 | 241 |
| 242 } | 242 } |
| 243 | 243 |
| 244 #endif | 244 #endif |
| OLD | NEW |