diff options
Diffstat (limited to 'Source/WebCore/dom/Attribute.h')
-rw-r--r-- | Source/WebCore/dom/Attribute.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Source/WebCore/dom/Attribute.h b/Source/WebCore/dom/Attribute.h index 61c9ec5a8..72dbed69e 100644 --- a/Source/WebCore/dom/Attribute.h +++ b/Source/WebCore/dom/Attribute.h @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012, 2014 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,8 +22,7 @@ * */ -#ifndef Attribute_h -#define Attribute_h +#pragma once #include "QualifiedName.h" @@ -44,13 +43,16 @@ public: // as the Attribute stays in place. For example, calling a function that mutates // an Element's internal attribute storage may invalidate them. const AtomicString& value() const { return m_value; } + static ptrdiff_t valueMemoryOffset() { return OBJECT_OFFSETOF(Attribute, m_value); } const AtomicString& prefix() const { return m_name.prefix(); } const AtomicString& localName() const { return m_name.localName(); } const AtomicString& namespaceURI() const { return m_name.namespaceURI(); } const QualifiedName& name() const { return m_name; } + static ptrdiff_t nameMemoryOffset() { return OBJECT_OFFSETOF(Attribute, m_name); } bool isEmpty() const { return m_value.isEmpty(); } + static bool nameMatchesFilter(const QualifiedName&, const AtomicString& filterPrefix, const AtomicString& filterLocalName, const AtomicString& filterNamespaceURI); bool matches(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI) const; void setValue(const AtomicString& value) { m_value = value; } @@ -72,13 +74,16 @@ private: AtomicString m_value; }; -inline bool Attribute::matches(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI) const +inline bool Attribute::nameMatchesFilter(const QualifiedName& name, const AtomicString& filterPrefix, const AtomicString& filterLocalName, const AtomicString& filterNamespaceURI) { - if (localName != this->localName()) + if (filterLocalName != name.localName()) return false; - return prefix == starAtom || namespaceURI == this->namespaceURI(); + return filterPrefix == starAtom || filterNamespaceURI == name.namespaceURI(); } -} // namespace WebCore +inline bool Attribute::matches(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI) const +{ + return nameMatchesFilter(m_name, prefix, localName, namespaceURI); +} -#endif // Attribute_h +} // namespace WebCore |