Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp

Issue 1235603003: Use DOMSettableTokenList for {HTMLAnchorElement, HTMLAreaElement}.ping. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase it(2). Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
index a5b29fa83b4746787b77ea9b5a6ab09ed6f15fe2..d75888ddd79f04c1de7c90c24f717c7eb8161c9c 100644
--- a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
@@ -50,9 +50,17 @@ HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& doc
, m_linkRelations(0)
, m_cachedVisitedLinkHash(0)
, m_wasFocusedByMouse(false)
+ , m_ping(DOMSettableTokenList::create(this))
{
}
+DEFINE_TRACE(HTMLAnchorElement)
+{
+ visitor->trace(m_ping);
+ HTMLElement::trace(visitor);
+ DOMSettableTokenListObserver::trace(visitor);
+}
+
PassRefPtrWillBeRawPtr<HTMLAnchorElement> HTMLAnchorElement::create(Document& document)
{
return adoptRefWillBeNoop(new HTMLAnchorElement(aTag, document));
@@ -60,6 +68,9 @@ PassRefPtrWillBeRawPtr<HTMLAnchorElement> HTMLAnchorElement::create(Document& do
HTMLAnchorElement::~HTMLAnchorElement()
{
+#if !ENABLE(OILPAN)
+ m_ping->setObserver(nullptr);
+#endif
}
bool HTMLAnchorElement::supportsFocus() const
@@ -220,6 +231,8 @@ void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt
// Do nothing.
} else if (name == relAttr) {
setRel(value);
+ } else if (name == pingAttr) {
+ m_ping->setValue(value);
} else {
HTMLElement::parseAttribute(name, value);
}
@@ -320,17 +333,21 @@ bool HTMLAnchorElement::isLiveLink() const
void HTMLAnchorElement::sendPings(const KURL& destinationURL) const
{
- const AtomicString& pingValue = getAttribute(pingAttr);
- if (pingValue.isNull() || !document().settings() || !document().settings()->hyperlinkAuditingEnabled())
+ if (m_ping->value().isNull() || !document().settings() || !document().settings()->hyperlinkAuditingEnabled())
return;
UseCounter::count(document(), UseCounter::HTMLAnchorElementPingAttribute);
- SpaceSplitString pingURLs(pingValue, SpaceSplitString::ShouldNotFoldCase);
+ const SpaceSplitString& pingURLs = m_ping->tokens();
for (unsigned i = 0; i < pingURLs.size(); i++)
PingLoader::sendLinkAuditPing(document().frame(), document().completeURL(pingURLs[i]), destinationURL);
}
+DOMSettableTokenList* HTMLAnchorElement::ping() const
+{
+ return m_ping.get();
+}
+
void HTMLAnchorElement::handleClick(Event* event)
{
event->setDefaultHandled();
@@ -373,6 +390,11 @@ void HTMLAnchorElement::handleClick(Event* event)
}
}
+void HTMLAnchorElement::valueChanged()
+{
+ setSynchronizedLazyAttribute(pingAttr, m_ping->value());
+}
+
bool isEnterKeyKeydownEvent(Event* event)
{
return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAnchorElement.h ('k') | third_party/WebKit/Source/core/html/HTMLAnchorElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698