Title: [140677] trunk/Source/WebCore
Revision
140677
Author
[email protected]
Date
2013-01-24 05:14:04 -0800 (Thu, 24 Jan 2013)

Log Message

Add CSSSelectorList::isValid().
<http://webkit.org/b/107809>

Reviewed by Antti Koivisto.

Add an isValid() method to CSSSelectorList and use that where applicable instead of checking
if first() is a null pointer.

* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::setSelectorText):
* css/CSSSelectorList.cpp:
* css/CSSSelectorList.h:
(WebCore::CSSSelectorList::isValid):
(WebCore::CSSSelectorList::first):
(CSSSelectorList):
* css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::setSelectorText):
* html/shadow/HTMLContentElement.cpp:
(WebCore::HTMLContentElement::validateSelect):
* inspector/InspectorStyleSheet.cpp:
(WebCore::checkStyleRuleSelector):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140676 => 140677)


--- trunk/Source/WebCore/ChangeLog	2013-01-24 12:25:19 UTC (rev 140676)
+++ trunk/Source/WebCore/ChangeLog	2013-01-24 13:14:04 UTC (rev 140677)
@@ -1,3 +1,27 @@
+2013-01-24  Andreas Kling  <[email protected]>
+
+        Add CSSSelectorList::isValid().
+        <http://webkit.org/b/107809>
+
+        Reviewed by Antti Koivisto.
+
+        Add an isValid() method to CSSSelectorList and use that where applicable instead of checking
+        if first() is a null pointer.
+
+        * css/CSSPageRule.cpp:
+        (WebCore::CSSPageRule::setSelectorText):
+        * css/CSSSelectorList.cpp:
+        * css/CSSSelectorList.h:
+        (WebCore::CSSSelectorList::isValid):
+        (WebCore::CSSSelectorList::first):
+        (CSSSelectorList):
+        * css/CSSStyleRule.cpp:
+        (WebCore::CSSStyleRule::setSelectorText):
+        * html/shadow/HTMLContentElement.cpp:
+        (WebCore::HTMLContentElement::validateSelect):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::checkStyleRuleSelector):
+
 2013-01-24  Kai Koehne  <[email protected]>
 
         [Qt] Webkit debug build links against release binaries of ANGLE libEGL, libGLESv2

Modified: trunk/Source/WebCore/css/CSSPageRule.cpp (140676 => 140677)


--- trunk/Source/WebCore/css/CSSPageRule.cpp	2013-01-24 12:25:19 UTC (rev 140676)
+++ trunk/Source/WebCore/css/CSSPageRule.cpp	2013-01-24 13:14:04 UTC (rev 140677)
@@ -73,7 +73,7 @@
     CSSParser parser(parserContext());
     CSSSelectorList selectorList;
     parser.parseSelector(selectorText, selectorList);
-    if (!selectorList.first())
+    if (!selectorList.isValid())
         return;
 
     CSSStyleSheet::RuleMutationScope mutationScope(this);

Modified: trunk/Source/WebCore/css/CSSSelectorList.h (140676 => 140677)


--- trunk/Source/WebCore/css/CSSSelectorList.h	2013-01-24 12:25:19 UTC (rev 140676)
+++ trunk/Source/WebCore/css/CSSSelectorList.h	2013-01-24 13:14:04 UTC (rev 140677)
@@ -43,7 +43,8 @@
     void adopt(CSSSelectorList& list);
     void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector);
 
-    const CSSSelector* first() const { return m_selectorArray ? m_selectorArray : 0; }
+    bool isValid() const { return !!m_selectorArray; }
+    const CSSSelector* first() const { return m_selectorArray; }
     static const CSSSelector* next(const CSSSelector*);
     bool hasOneSelector() const { return m_selectorArray && !next(m_selectorArray); }
     const CSSSelector* selectorAt(size_t index) const { return &m_selectorArray[index]; }

Modified: trunk/Source/WebCore/css/CSSStyleRule.cpp (140676 => 140677)


--- trunk/Source/WebCore/css/CSSStyleRule.cpp	2013-01-24 12:25:19 UTC (rev 140676)
+++ trunk/Source/WebCore/css/CSSStyleRule.cpp	2013-01-24 13:14:04 UTC (rev 140677)
@@ -96,7 +96,7 @@
     CSSParser p(parserContext());
     CSSSelectorList selectorList;
     p.parseSelector(selectorText, selectorList);
-    if (!selectorList.first())
+    if (!selectorList.isValid())
         return;
 
     CSSStyleSheet::RuleMutationScope mutationScope(this);

Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp (140676 => 140677)


--- trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp	2013-01-24 12:25:19 UTC (rev 140676)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp	2013-01-24 13:14:04 UTC (rev 140677)
@@ -192,7 +192,7 @@
     if (select().isNull() || select().isEmpty())
         return true;
 
-    if (!m_selectorList.first())
+    if (!m_selectorList.isValid())
         return false;
 
     for (const CSSSelector* selector = m_selectorList.first(); selector; selector = m_selectorList.next(selector)) {

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (140676 => 140677)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2013-01-24 12:25:19 UTC (rev 140676)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2013-01-24 13:14:04 UTC (rev 140677)
@@ -831,7 +831,7 @@
 {
     CSSSelectorList selectorList;
     createCSSParser(document)->parseSelector(selector, selectorList);
-    return selectorList.first();
+    return selectorList.isValid();
 }
 
 CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionCode& ec)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to