Commit b3b891b1 authored by akling@apple.com's avatar akling@apple.com

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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140677 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 44c1e1e8
2013-01-24 Andreas Kling <akling@apple.com>
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 <kai.koehne@digia.com>
[Qt] Webkit debug build links against release binaries of ANGLE libEGL, libGLESv2
......@@ -73,7 +73,7 @@ void CSSPageRule::setSelectorText(const String& selectorText)
CSSParser parser(parserContext());
CSSSelectorList selectorList;
parser.parseSelector(selectorText, selectorList);
if (!selectorList.first())
if (!selectorList.isValid())
return;
CSSStyleSheet::RuleMutationScope mutationScope(this);
......
......@@ -43,7 +43,8 @@ public:
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]; }
......
......@@ -96,7 +96,7 @@ void CSSStyleRule::setSelectorText(const String& selectorText)
CSSParser p(parserContext());
CSSSelectorList selectorList;
p.parseSelector(selectorText, selectorList);
if (!selectorList.first())
if (!selectorList.isValid())
return;
CSSStyleSheet::RuleMutationScope mutationScope(this);
......
......@@ -192,7 +192,7 @@ bool HTMLContentElement::validateSelect() const
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)) {
......
......@@ -831,7 +831,7 @@ static bool checkStyleRuleSelector(Document* document, const String& selector)
{
CSSSelectorList selectorList;
createCSSParser(document)->parseSelector(selector, selectorList);
return selectorList.first();
return selectorList.isValid();
}
CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionCode& ec)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment