Commit 14de3e22 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Drop unnecessary RadioNodeList::m_onlyMatchImgElements member

Drop unnecessary RadioNodeList::m_onlyMatchImgElements member and replace it by
an inline function that does a CollectionType comparison.

The generated assembly for RadioNodeList.o is about the same size (1 line
shorter).

R=adamk@chromium.org

Review URL: https://codereview.chromium.org/480473002

git-svn-id: svn://svn.chromium.org/blink/trunk@180374 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 64cd0f94
......@@ -41,7 +41,6 @@ using namespace HTMLNames;
RadioNodeList::RadioNodeList(ContainerNode& rootNode, const AtomicString& name, CollectionType type)
: LiveNodeList(rootNode, type, InvalidateForFormControls, isHTMLFormElement(rootNode) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode)
, m_name(name)
, m_onlyMatchImgElements(type == RadioImgNodeListType)
{
ScriptWrappable::init(this);
}
......@@ -49,7 +48,7 @@ RadioNodeList::RadioNodeList(ContainerNode& rootNode, const AtomicString& name,
RadioNodeList::~RadioNodeList()
{
#if !ENABLE(OILPAN)
ownerNode().nodeLists()->removeCache(this, m_onlyMatchImgElements ? RadioImgNodeListType : RadioNodeListType, m_name);
ownerNode().nodeLists()->removeCache(this, type(), m_name);
#endif
}
......@@ -65,7 +64,7 @@ static inline HTMLInputElement* toRadioButtonInputElement(Element& element)
String RadioNodeList::value() const
{
if (m_onlyMatchImgElements)
if (shouldOnlyMatchImgElements())
return String();
unsigned length = this->length();
for (unsigned i = 0; i < length; ++i) {
......@@ -79,7 +78,7 @@ String RadioNodeList::value() const
void RadioNodeList::setValue(const String& value)
{
if (m_onlyMatchImgElements)
if (shouldOnlyMatchImgElements())
return;
unsigned length = this->length();
for (unsigned i = 0; i < length; ++i) {
......@@ -98,7 +97,7 @@ bool RadioNodeList::matchesByIdOrName(const Element& testElement) const
bool RadioNodeList::checkElementMatchesRadioNodeListFilter(const Element& testElement) const
{
ASSERT(!m_onlyMatchImgElements);
ASSERT(!shouldOnlyMatchImgElements());
ASSERT(isHTMLObjectElement(testElement) || testElement.isFormControlElement());
if (isHTMLFormElement(ownerNode())) {
HTMLFormElement* formElement = toHTMLElement(testElement).formOwner();
......@@ -111,7 +110,7 @@ bool RadioNodeList::checkElementMatchesRadioNodeListFilter(const Element& testEl
bool RadioNodeList::elementMatches(const Element& element) const
{
if (m_onlyMatchImgElements) {
if (shouldOnlyMatchImgElements()) {
if (!isHTMLImageElement(element))
return false;
......
......@@ -51,11 +51,11 @@ private:
bool checkElementMatchesRadioNodeListFilter(const Element&) const;
bool matchesByIdOrName(const Element&) const;
bool shouldOnlyMatchImgElements() const { return type() == RadioImgNodeListType; }
virtual bool elementMatches(const Element&) const OVERRIDE;
AtomicString m_name;
const bool m_onlyMatchImgElements;
};
} // namespace
......
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