| 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 27 matching lines...) Expand all Loading... |
| 38 enum { TagNameSalt = 13, IdAttributeSalt = 17, ClassAttributeSalt = 19 }; | 38 enum { TagNameSalt = 13, IdAttributeSalt = 17, ClassAttributeSalt = 19 }; |
| 39 | 39 |
| 40 static inline void collectElementIdentifierHashes(const Element& element, Vector
<unsigned, 4>& identifierHashes) | 40 static inline void collectElementIdentifierHashes(const Element& element, Vector
<unsigned, 4>& identifierHashes) |
| 41 { | 41 { |
| 42 identifierHashes.append(element.localNameForSelectorMatching().impl()->exist
ingHash() * TagNameSalt); | 42 identifierHashes.append(element.localNameForSelectorMatching().impl()->exist
ingHash() * TagNameSalt); |
| 43 if (element.hasID()) | 43 if (element.hasID()) |
| 44 identifierHashes.append(element.idForStyleResolution().impl()->existingH
ash() * IdAttributeSalt); | 44 identifierHashes.append(element.idForStyleResolution().impl()->existingH
ash() * IdAttributeSalt); |
| 45 if (element.isStyledElement() && element.hasClass()) { | 45 if (element.isStyledElement() && element.hasClass()) { |
| 46 const SpaceSplitString& classNames = element.classNames(); | 46 const SpaceSplitString& classNames = element.classNames(); |
| 47 size_t count = classNames.size(); | 47 size_t count = classNames.size(); |
| 48 for (size_t i = 0; i < count; ++i) | 48 for (size_t i = 0; i < count; ++i) { |
| 49 identifierHashes.append(classNames[i].impl()->existingHash() * Class
AttributeSalt); | 49 DCHECK(classNames[i].impl()); |
| 50 // Speculative fix for https://crbug.com/646026 |
| 51 if (classNames[i].impl()) |
| 52 identifierHashes.append(classNames[i].impl()->existingHash() * C
lassAttributeSalt); |
| 53 } |
| 50 } | 54 } |
| 51 } | 55 } |
| 52 | 56 |
| 53 void SelectorFilter::pushParentStackFrame(Element& parent) | 57 void SelectorFilter::pushParentStackFrame(Element& parent) |
| 54 { | 58 { |
| 55 ASSERT(m_ancestorIdentifierFilter); | 59 ASSERT(m_ancestorIdentifierFilter); |
| 56 ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent.par
entOrShadowHostElement()); | 60 ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent.par
entOrShadowHostElement()); |
| 57 ASSERT(!m_parentStack.isEmpty() || !parent.parentOrShadowHostElement()); | 61 ASSERT(!m_parentStack.isEmpty() || !parent.parentOrShadowHostElement()); |
| 58 m_parentStack.append(ParentStackFrame(parent)); | 62 m_parentStack.append(ParentStackFrame(parent)); |
| 59 ParentStackFrame& parentFrame = m_parentStack.last(); | 63 ParentStackFrame& parentFrame = m_parentStack.last(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 { | 187 { |
| 184 visitor->trace(element); | 188 visitor->trace(element); |
| 185 } | 189 } |
| 186 | 190 |
| 187 DEFINE_TRACE(SelectorFilter) | 191 DEFINE_TRACE(SelectorFilter) |
| 188 { | 192 { |
| 189 visitor->trace(m_parentStack); | 193 visitor->trace(m_parentStack); |
| 190 } | 194 } |
| 191 | 195 |
| 192 } // namespace blink | 196 } // namespace blink |
| OLD | NEW |