summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLMapElement.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/HTMLMapElement.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/html/HTMLMapElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLMapElement.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/Source/WebCore/html/HTMLMapElement.cpp b/Source/WebCore/html/HTMLMapElement.cpp
index bb1ba20bb..01e6edad0 100644
--- a/Source/WebCore/html/HTMLMapElement.cpp
+++ b/Source/WebCore/html/HTMLMapElement.cpp
@@ -25,11 +25,12 @@
#include "Attribute.h"
#include "Document.h"
#include "ElementIterator.h"
+#include "GenericCachedHTMLCollection.h"
#include "HTMLAreaElement.h"
-#include "HTMLCollection.h"
#include "HTMLImageElement.h"
#include "HitTestResult.h"
#include "IntSize.h"
+#include "NodeRareData.h"
namespace WebCore {
@@ -41,14 +42,14 @@ HTMLMapElement::HTMLMapElement(const QualifiedName& tagName, Document& document)
ASSERT(hasTagName(mapTag));
}
-PassRefPtr<HTMLMapElement> HTMLMapElement::create(Document& document)
+Ref<HTMLMapElement> HTMLMapElement::create(Document& document)
{
- return adoptRef(new HTMLMapElement(mapTag, document));
+ return adoptRef(*new HTMLMapElement(mapTag, document));
}
-PassRefPtr<HTMLMapElement> HTMLMapElement::create(const QualifiedName& tagName, Document& document)
+Ref<HTMLMapElement> HTMLMapElement::create(const QualifiedName& tagName, Document& document)
{
- return adoptRef(new HTMLMapElement(tagName, document));
+ return adoptRef(*new HTMLMapElement(tagName, document));
}
HTMLMapElement::~HTMLMapElement()
@@ -77,10 +78,8 @@ bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size,
HTMLImageElement* HTMLMapElement::imageElement()
{
if (m_name.isEmpty())
- return 0;
- AtomicString lowercasedName = m_name.lower();
- ASSERT(lowercasedName.impl());
- return document().imageElementByLowercasedUsemap(*lowercasedName.impl());
+ return nullptr;
+ return document().imageElementByUsemap(*m_name.impl());
}
void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -88,20 +87,20 @@ void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicStrin
// FIXME: This logic seems wrong for XML documents.
// Either the id or name will be used depending on the order the attributes are parsed.
- if (isIdAttributeName(name) || name == nameAttr) {
- if (isIdAttributeName(name)) {
+ if (name == HTMLNames::idAttr || name == HTMLNames::nameAttr) {
+ if (name == HTMLNames::idAttr) {
// Call base class so that hasID bit gets set.
HTMLElement::parseAttribute(name, value);
if (document().isHTMLDocument())
return;
}
- if (inDocument())
+ if (isConnected())
treeScope().removeImageMap(*this);
String mapName = value;
if (mapName[0] == '#')
mapName = mapName.substring(1);
- m_name = document().isHTMLDocument() ? mapName.lower() : mapName;
- if (inDocument())
+ m_name = mapName;
+ if (isConnected())
treeScope().addImageMap(*this);
return;
@@ -110,22 +109,22 @@ void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicStrin
HTMLElement::parseAttribute(name, value);
}
-PassRefPtr<HTMLCollection> HTMLMapElement::areas()
+Ref<HTMLCollection> HTMLMapElement::areas()
{
- return ensureCachedHTMLCollection(MapAreas);
+ return ensureRareData().ensureNodeLists().addCachedCollection<GenericCachedHTMLCollection<CollectionTypeTraits<MapAreas>::traversalType>>(*this, MapAreas);
}
Node::InsertionNotificationRequest HTMLMapElement::insertedInto(ContainerNode& insertionPoint)
{
Node::InsertionNotificationRequest request = HTMLElement::insertedInto(insertionPoint);
- if (insertionPoint.inDocument())
+ if (insertionPoint.isConnected())
treeScope().addImageMap(*this);
return request;
}
void HTMLMapElement::removedFrom(ContainerNode& insertionPoint)
{
- if (insertionPoint.inDocument())
+ if (insertionPoint.isConnected())
treeScope().removeImageMap(*this);
HTMLElement::removedFrom(insertionPoint);
}