Chromium Code Reviews| OLD | NEW |
|---|---|
| 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) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 } | 142 } |
| 143 | 143 |
| 144 PassRefPtrWillBeRawPtr<Element> Element::create(const QualifiedName& tagName, Do cument* document) | 144 PassRefPtrWillBeRawPtr<Element> Element::create(const QualifiedName& tagName, Do cument* document) |
| 145 { | 145 { |
| 146 return adoptRefWillBeNoop(new Element(tagName, document, CreateElement)); | 146 return adoptRefWillBeNoop(new Element(tagName, document, CreateElement)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 Element::Element(const QualifiedName& tagName, Document* document, ConstructionT ype type) | 149 Element::Element(const QualifiedName& tagName, Document* document, ConstructionT ype type) |
| 150 : ContainerNode(document, type) | 150 : ContainerNode(document, type) |
| 151 , m_tagName(tagName) | 151 , m_tagName(tagName) |
| 152 , m_isTabStop(true) | |
| 152 { | 153 { |
| 153 } | 154 } |
| 154 | 155 |
| 155 Element::~Element() | 156 Element::~Element() |
| 156 { | 157 { |
| 157 ASSERT(needsAttach()); | 158 ASSERT(needsAttach()); |
| 158 | 159 |
| 159 #if !ENABLE(OILPAN) | 160 #if !ENABLE(OILPAN) |
| 160 if (hasRareData()) | 161 if (hasRareData()) |
| 161 elementRareData()->clearShadow(); | 162 elementRareData()->clearShadow(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 | 211 |
| 211 void Element::clearTabIndexExplicitlyIfNeeded() | 212 void Element::clearTabIndexExplicitlyIfNeeded() |
| 212 { | 213 { |
| 213 if (hasRareData()) | 214 if (hasRareData()) |
| 214 elementRareData()->clearTabIndexExplicitly(); | 215 elementRareData()->clearTabIndexExplicitly(); |
| 215 } | 216 } |
| 216 | 217 |
| 217 void Element::setTabIndexExplicitly(short tabIndex) | 218 void Element::setTabIndexExplicitly(short tabIndex) |
| 218 { | 219 { |
| 219 ensureElementRareData().setTabIndexExplicitly(tabIndex); | 220 ensureElementRareData().setTabIndexExplicitly(tabIndex); |
| 221 // 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
| |
| 222 m_isTabStop = (tabIndex >= 0); | |
| 220 } | 223 } |
| 221 | 224 |
| 222 void Element::setTabIndex(int value) | 225 void Element::setTabIndex(int value) |
| 223 { | 226 { |
| 224 setIntegralAttribute(tabindexAttr, value); | 227 setIntegralAttribute(tabindexAttr, value); |
| 225 } | 228 } |
| 226 | 229 |
| 227 short Element::tabIndex() const | 230 short Element::tabIndex() const |
| 228 { | 231 { |
| 229 return hasRareData() ? elementRareData()->tabIndex() : 0; | 232 return hasRareData() ? elementRareData()->tabIndex() : 0; |
| (...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2243 bool Element::isKeyboardFocusable() const | 2246 bool Element::isKeyboardFocusable() const |
| 2244 { | 2247 { |
| 2245 return isFocusable() && tabIndex() >= 0; | 2248 return isFocusable() && tabIndex() >= 0; |
| 2246 } | 2249 } |
| 2247 | 2250 |
| 2248 bool Element::isMouseFocusable() const | 2251 bool Element::isMouseFocusable() const |
| 2249 { | 2252 { |
| 2250 return isFocusable(); | 2253 return isFocusable(); |
| 2251 } | 2254 } |
| 2252 | 2255 |
| 2256 bool Element::isTabStop() const | |
| 2257 { | |
| 2258 // Any element which never supports focus will always return false. | |
| 2259 return supportsFocus() && m_isTabStop; | |
| 2260 } | |
| 2261 | |
| 2262 void Element::setIsTabStop(bool flag) | |
| 2263 { | |
| 2264 m_isTabStop = flag; | |
| 2265 } | |
| 2266 | |
| 2253 void Element::dispatchFocusEvent(Element* oldFocusedElement, WebFocusType type) | 2267 void Element::dispatchFocusEvent(Element* oldFocusedElement, WebFocusType type) |
| 2254 { | 2268 { |
| 2255 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::fo cus, false, false, document().domWindow(), 0, oldFocusedElement); | 2269 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::fo cus, false, false, document().domWindow(), 0, oldFocusedElement); |
| 2256 EventDispatcher::dispatchEvent(*this, FocusEventDispatchMediator::create(eve nt.release())); | 2270 EventDispatcher::dispatchEvent(*this, FocusEventDispatchMediator::create(eve nt.release())); |
| 2257 } | 2271 } |
| 2258 | 2272 |
| 2259 void Element::dispatchBlurEvent(Element* newFocusedElement) | 2273 void Element::dispatchBlurEvent(Element* newFocusedElement) |
| 2260 { | 2274 { |
| 2261 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::bl ur, false, false, document().domWindow(), 0, newFocusedElement); | 2275 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::bl ur, false, false, document().domWindow(), 0, newFocusedElement); |
| 2262 EventDispatcher::dispatchEvent(*this, BlurEventDispatchMediator::create(even t.release())); | 2276 EventDispatcher::dispatchEvent(*this, BlurEventDispatchMediator::create(even t.release())); |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3370 { | 3384 { |
| 3371 #if ENABLE(OILPAN) | 3385 #if ENABLE(OILPAN) |
| 3372 if (hasRareData()) | 3386 if (hasRareData()) |
| 3373 visitor->trace(elementRareData()); | 3387 visitor->trace(elementRareData()); |
| 3374 visitor->trace(m_elementData); | 3388 visitor->trace(m_elementData); |
| 3375 #endif | 3389 #endif |
| 3376 ContainerNode::trace(visitor); | 3390 ContainerNode::trace(visitor); |
| 3377 } | 3391 } |
| 3378 | 3392 |
| 3379 } // namespace blink | 3393 } // namespace blink |
| OLD | NEW |