Title: [140235] trunk/Source/WebCore
- Revision
- 140235
- Author
- [email protected]
- Date
- 2013-01-18 22:15:39 -0800 (Fri, 18 Jan 2013)
Log Message
Move attributeNameMatches from SelectorChecker to its proper place on Attribute.
https://bugs.webkit.org/show_bug.cgi?id=107358
Reviewed by Andreas Kling.
Refactoring, covered by existing tests.
* css/SelectorChecker.cpp:
(WebCore::anyAttributeMatches): Changed to use the new name.
* css/SelectorChecker.h:
(SelectorChecker): Moved attributeNameMatches out of here.
(WebCore::SelectorChecker::checkExactAttribute): Changed to use the new name.
* dom/Attribute.h:
(WebCore::Attribute::matches): Moved attributeNameMatches to here.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (140234 => 140235)
--- trunk/Source/WebCore/ChangeLog 2013-01-19 05:48:00 UTC (rev 140234)
+++ trunk/Source/WebCore/ChangeLog 2013-01-19 06:15:39 UTC (rev 140235)
@@ -1,3 +1,20 @@
+2013-01-18 Dimitri Glazkov <[email protected]>
+
+ Move attributeNameMatches from SelectorChecker to its proper place on Attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=107358
+
+ Reviewed by Andreas Kling.
+
+ Refactoring, covered by existing tests.
+
+ * css/SelectorChecker.cpp:
+ (WebCore::anyAttributeMatches): Changed to use the new name.
+ * css/SelectorChecker.h:
+ (SelectorChecker): Moved attributeNameMatches out of here.
+ (WebCore::SelectorChecker::checkExactAttribute): Changed to use the new name.
+ * dom/Attribute.h:
+ (WebCore::Attribute::matches): Moved attributeNameMatches to here.
+
2013-01-18 Simon Fraser <[email protected]>
Fix bug that caused pages with fixed backgrounds to not be fast scrollable
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (140234 => 140235)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2013-01-19 05:48:00 UTC (rev 140234)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2013-01-19 06:15:39 UTC (rev 140235)
@@ -530,7 +530,7 @@
for (size_t i = 0; i < element->attributeCount(); ++i) {
const Attribute* attributeItem = element->attributeItem(i);
- if (!SelectorChecker::attributeNameMatches(attributeItem, selectorAttr))
+ if (!attributeItem->matches(selectorAttr))
continue;
if (attributeValueMatches(attributeItem, match, selectorValue, caseSensitive))
Modified: trunk/Source/WebCore/css/SelectorChecker.h (140234 => 140235)
--- trunk/Source/WebCore/css/SelectorChecker.h 2013-01-19 05:48:00 UTC (rev 140234)
+++ trunk/Source/WebCore/css/SelectorChecker.h 2013-01-19 06:15:39 UTC (rev 140235)
@@ -91,7 +91,6 @@
void setMode(Mode mode) { m_mode = mode; }
static bool tagMatches(const Element*, const CSSSelector*);
- static bool attributeNameMatches(const Attribute*, const QualifiedName&);
static bool isCommonPseudoClassSelector(const CSSSelector*);
bool matchesFocusPseudoClass(const Element*) const;
static bool fastCheckRightmostAttributeSelector(const Element*, const CSSSelector*);
@@ -141,13 +140,6 @@
return namespaceURI == starAtom || namespaceURI == element->namespaceURI();
}
-inline bool SelectorChecker::attributeNameMatches(const Attribute* attribute, const QualifiedName& selectorAttributeName)
-{
- if (selectorAttributeName.localName() != attribute->localName())
- return false;
- return selectorAttributeName.prefix() == starAtom || selectorAttributeName.namespaceURI() == attribute->namespaceURI();
-}
-
inline bool SelectorChecker::checkExactAttribute(const Element* element, const QualifiedName& selectorAttributeName, const AtomicStringImpl* value)
{
if (!element->hasAttributesWithoutUpdate())
@@ -155,7 +147,7 @@
unsigned size = element->attributeCount();
for (unsigned i = 0; i < size; ++i) {
const Attribute* attribute = element->attributeItem(i);
- if (attributeNameMatches(attribute, selectorAttributeName) && (!value || attribute->value().impl() == value))
+ if (attribute->matches(selectorAttributeName) && (!value || attribute->value().impl() == value))
return true;
}
return false;
Modified: trunk/Source/WebCore/dom/Attribute.h (140234 => 140235)
--- trunk/Source/WebCore/dom/Attribute.h 2013-01-19 05:48:00 UTC (rev 140234)
+++ trunk/Source/WebCore/dom/Attribute.h 2013-01-19 06:15:39 UTC (rev 140235)
@@ -52,6 +52,7 @@
const QualifiedName& name() const { return m_name; }
bool isEmpty() const { return m_value.isEmpty(); }
+ bool matches(const QualifiedName&) const;
void setValue(const AtomicString& value) { m_value = value; }
void setPrefix(const AtomicString& prefix) { m_name.setPrefix(prefix); }
@@ -73,6 +74,13 @@
AtomicString m_value;
};
+inline bool Attribute::matches(const QualifiedName& qualifiedName) const
+{
+ if (qualifiedName.localName() != localName())
+ return false;
+ return qualifiedName.prefix() == starAtom || qualifiedName.namespaceURI() == namespaceURI();
+}
+
} // namespace WebCore
#endif // Attribute_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes