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

Unified Diff: Source/core/dom/Element.cpp

Issue 917613004: Add isTabStop attribute to Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a layout test and fix missing isTabStop() case. Created 5 years, 10 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: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 7ed385f12649b8ee4e6a28001d6003723a18e56c..449de0bc73c23771442ea3050f65d4366c9fa205 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -149,6 +149,7 @@ PassRefPtrWillBeRawPtr<Element> Element::create(const QualifiedName& tagName, Do
Element::Element(const QualifiedName& tagName, Document* document, ConstructionType type)
: ContainerNode(document, type)
, m_tagName(tagName)
+ , m_isTabStop(true)
{
}
@@ -217,6 +218,8 @@ void Element::clearTabIndexExplicitlyIfNeeded()
void Element::setTabIndexExplicitly(short tabIndex)
{
ensureElementRareData().setTabIndexExplicitly(tabIndex);
+ // isTabStop is overridden by setting tabindex.
hayato 2015/02/20 08:46:31 Not sure how setting taxIndex attribute from JavaS
kochi 2015/02/20 09:43:05 A) isTabStop = true B) isTabStop = false This is
hayato 2015/02/20 10:28:45 I understand the intention, however, I'm not sure
+ m_isTabStop = (tabIndex >= 0);
}
void Element::setTabIndex(int value)
@@ -2250,6 +2253,17 @@ bool Element::isMouseFocusable() const
return isFocusable();
}
+bool Element::isTabStop() const
+{
+ // Any element which never supports focus will always return false.
+ return supportsFocus() && m_isTabStop;
+}
+
+void Element::setIsTabStop(bool flag)
+{
+ m_isTabStop = flag;
+}
+
void Element::dispatchFocusEvent(Element* oldFocusedElement, WebFocusType type)
{
RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::focus, false, false, document().domWindow(), 0, oldFocusedElement);

Powered by Google App Engine
This is Rietveld 408576698