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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp

Issue 2171493003: [Editing][DOM][CodeHealth] Make Node::hasEditableStyle global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann <hausmann@kde.org> 4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 DEFINE_TRACE(HTMLAnchorElement) 139 DEFINE_TRACE(HTMLAnchorElement)
140 { 140 {
141 visitor->trace(m_navigationHintSender); 141 visitor->trace(m_navigationHintSender);
142 HTMLElement::trace(visitor); 142 HTMLElement::trace(visitor);
143 } 143 }
144 144
145 bool HTMLAnchorElement::supportsFocus() const 145 bool HTMLAnchorElement::supportsFocus() const
146 { 146 {
147 if (hasEditableStyle()) 147 if (hasEditableStyle(*this))
148 return HTMLElement::supportsFocus(); 148 return HTMLElement::supportsFocus();
149 // If not a link we should still be able to focus the element if it has tabI ndex. 149 // If not a link we should still be able to focus the element if it has tabI ndex.
150 return isLink() || HTMLElement::supportsFocus(); 150 return isLink() || HTMLElement::supportsFocus();
151 } 151 }
152 152
153 bool HTMLAnchorElement::matchesEnabledPseudoClass() const 153 bool HTMLAnchorElement::matchesEnabledPseudoClass() const
154 { 154 {
155 return isLink(); 155 return isLink();
156 } 156 }
157 157
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 handleClick(event); 253 handleClick(event);
254 return; 254 return;
255 } 255 }
256 } 256 }
257 257
258 HTMLElement::defaultEventHandler(event); 258 HTMLElement::defaultEventHandler(event);
259 } 259 }
260 260
261 void HTMLAnchorElement::setActive(bool down) 261 void HTMLAnchorElement::setActive(bool down)
262 { 262 {
263 if (hasEditableStyle()) 263 if (hasEditableStyle(*this))
264 return; 264 return;
265 265
266 ContainerNode::setActive(down); 266 ContainerNode::setActive(down);
267 } 267 }
268 268
269 void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& oldValue, const AtomicString& value) 269 void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& oldValue, const AtomicString& value)
270 { 270 {
271 if (name == hrefAttr) { 271 if (name == hrefAttr) {
272 bool wasLink = isLink(); 272 bool wasLink = isLink();
273 setIsLink(!value.isNull()); 273 setIsLink(!value.isNull());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 bool HTMLAnchorElement::hasLegalLinkAttribute(const QualifiedName& name) const 312 bool HTMLAnchorElement::hasLegalLinkAttribute(const QualifiedName& name) const
313 { 313 {
314 return name == hrefAttr || HTMLElement::hasLegalLinkAttribute(name); 314 return name == hrefAttr || HTMLElement::hasLegalLinkAttribute(name);
315 } 315 }
316 316
317 bool HTMLAnchorElement::canStartSelection() const 317 bool HTMLAnchorElement::canStartSelection() const
318 { 318 {
319 if (!isLink()) 319 if (!isLink())
320 return HTMLElement::canStartSelection(); 320 return HTMLElement::canStartSelection();
321 return hasEditableStyle(); 321 return hasEditableStyle(*this);
322 } 322 }
323 323
324 bool HTMLAnchorElement::draggable() const 324 bool HTMLAnchorElement::draggable() const
325 { 325 {
326 // Should be draggable if we have an href attribute. 326 // Should be draggable if we have an href attribute.
327 const AtomicString& value = getAttribute(draggableAttr); 327 const AtomicString& value = getAttribute(draggableAttr);
328 if (equalIgnoringCase(value, "true")) 328 if (equalIgnoringCase(value, "true"))
329 return true; 329 return true;
330 if (equalIgnoringCase(value, "false")) 330 if (equalIgnoringCase(value, "false"))
331 return false; 331 return false;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 385
386 short HTMLAnchorElement::tabIndex() const 386 short HTMLAnchorElement::tabIndex() const
387 { 387 {
388 // Skip the supportsFocus check in HTMLElement. 388 // Skip the supportsFocus check in HTMLElement.
389 return Element::tabIndex(); 389 return Element::tabIndex();
390 } 390 }
391 391
392 bool HTMLAnchorElement::isLiveLink() const 392 bool HTMLAnchorElement::isLiveLink() const
393 { 393 {
394 return isLink() && !hasEditableStyle(); 394 return isLink() && !hasEditableStyle(*this);
395 } 395 }
396 396
397 void HTMLAnchorElement::sendPings(const KURL& destinationURL) const 397 void HTMLAnchorElement::sendPings(const KURL& destinationURL) const
398 { 398 {
399 const AtomicString& pingValue = getAttribute(pingAttr); 399 const AtomicString& pingValue = getAttribute(pingAttr);
400 if (pingValue.isNull() || !document().settings() || !document().settings()-> hyperlinkAuditingEnabled()) 400 if (pingValue.isNull() || !document().settings() || !document().settings()-> hyperlinkAuditingEnabled())
401 return; 401 return;
402 402
403 UseCounter::count(document(), UseCounter::HTMLAnchorElementPingAttribute); 403 UseCounter::count(document(), UseCounter::HTMLAnchorElementPingAttribute);
404 404
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 484 }
485 485
486 HTMLAnchorElement::NavigationHintSender* HTMLAnchorElement::ensureNavigationHint Sender() 486 HTMLAnchorElement::NavigationHintSender* HTMLAnchorElement::ensureNavigationHint Sender()
487 { 487 {
488 if (!m_navigationHintSender) 488 if (!m_navigationHintSender)
489 m_navigationHintSender = NavigationHintSender::create(this); 489 m_navigationHintSender = NavigationHintSender::create(this);
490 return m_navigationHintSender; 490 return m_navigationHintSender;
491 } 491 }
492 492
493 } // namespace blink 493 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698