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. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * (C) 2007 Eric Seidel (eric@webkit.org) | 9 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 10 * | 10 * |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 if (!hasRareData()) | 210 if (!hasRareData()) |
| 211 return; | 211 return; |
| 212 elementRareData()->clearElementFlag(mask); | 212 elementRareData()->clearElementFlag(mask); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void Element::clearTabIndexExplicitlyIfNeeded() { | 215 void Element::clearTabIndexExplicitlyIfNeeded() { |
| 216 if (hasRareData()) | 216 if (hasRareData()) |
| 217 elementRareData()->clearTabIndexExplicitly(); | 217 elementRareData()->clearTabIndexExplicitly(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void Element::setTabIndexExplicitly(short tabIndex) { | 220 void Element::setTabIndexExplicitly(int tabIndex) { |
| 221 ensureElementRareData().setTabIndexExplicitly(tabIndex); | 221 ensureElementRareData().setTabIndexExplicitly(tabIndex); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void Element::setTabIndex(int value) { | 224 void Element::setTabIndex(int value) { |
| 225 setIntegralAttribute(tabindexAttr, value); | 225 setIntegralAttribute(tabindexAttr, value); |
| 226 } | 226 } |
| 227 | 227 |
| 228 short Element::tabIndex() const { | 228 int Element::tabIndex() const { |
| 229 return hasRareData() ? elementRareData()->tabIndex() : 0; | 229 return hasRareData() ? elementRareData()->tabIndex() : 0; |
| 230 } | 230 } |
| 231 | 231 |
| 232 bool Element::layoutObjectIsFocusable() const { | 232 bool Element::layoutObjectIsFocusable() const { |
| 233 // Elements in canvas fallback content are not rendered, but they are allowed | 233 // Elements in canvas fallback content are not rendered, but they are allowed |
| 234 // to be focusable as long as their canvas is displayed and visible. | 234 // to be focusable as long as their canvas is displayed and visible. |
| 235 if (isInCanvasSubtree()) { | 235 if (isInCanvasSubtree()) { |
| 236 const HTMLCanvasElement* canvas = | 236 const HTMLCanvasElement* canvas = |
| 237 Traversal<HTMLCanvasElement>::firstAncestorOrSelf(*this); | 237 Traversal<HTMLCanvasElement>::firstAncestorOrSelf(*this); |
| 238 DCHECK(canvas); | 238 DCHECK(canvas); |
| (...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2426 if (name == tabindexAttr) { | 2426 if (name == tabindexAttr) { |
| 2427 int tabindex = 0; | 2427 int tabindex = 0; |
| 2428 if (value.isEmpty()) { | 2428 if (value.isEmpty()) { |
| 2429 clearTabIndexExplicitlyIfNeeded(); | 2429 clearTabIndexExplicitlyIfNeeded(); |
| 2430 if (adjustedFocusedElementInTreeScope() == this) { | 2430 if (adjustedFocusedElementInTreeScope() == this) { |
| 2431 // We might want to call blur(), but it's dangerous to dispatch | 2431 // We might want to call blur(), but it's dangerous to dispatch |
| 2432 // events here. | 2432 // events here. |
| 2433 document().setNeedsFocusedElementCheck(); | 2433 document().setNeedsFocusedElementCheck(); |
| 2434 } | 2434 } |
| 2435 } else if (parseHTMLInteger(value, tabindex)) { | 2435 } else if (parseHTMLInteger(value, tabindex)) { |
| 2436 // Clamp tabindex to the range of 'short' to match Firefox's behavior. | 2436 setTabIndexExplicitly(tabindex); |
|
kochi
2016/10/18 02:37:24
Could you add a comment here for the behavior when
rwlbuis
2016/10/19 00:43:43
Done.
| |
| 2437 setTabIndexExplicitly( | |
| 2438 max(static_cast<int>(std::numeric_limits<short>::min()), | |
| 2439 std::min(tabindex, | |
| 2440 static_cast<int>(std::numeric_limits<short>::max())))); | |
| 2441 } | 2437 } |
| 2442 } else if (name == XMLNames::langAttr) { | 2438 } else if (name == XMLNames::langAttr) { |
| 2443 pseudoStateChanged(CSSSelector::PseudoLang); | 2439 pseudoStateChanged(CSSSelector::PseudoLang); |
| 2444 } | 2440 } |
| 2445 } | 2441 } |
| 2446 | 2442 |
| 2447 bool Element::parseAttributeName(QualifiedName& out, | 2443 bool Element::parseAttributeName(QualifiedName& out, |
| 2448 const AtomicString& namespaceURI, | 2444 const AtomicString& namespaceURI, |
| 2449 const AtomicString& qualifiedName, | 2445 const AtomicString& qualifiedName, |
| 2450 ExceptionState& exceptionState) { | 2446 ExceptionState& exceptionState) { |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4082 } | 4078 } |
| 4083 | 4079 |
| 4084 DEFINE_TRACE_WRAPPERS(Element) { | 4080 DEFINE_TRACE_WRAPPERS(Element) { |
| 4085 if (hasRareData()) { | 4081 if (hasRareData()) { |
| 4086 visitor->traceWrappers(elementRareData()); | 4082 visitor->traceWrappers(elementRareData()); |
| 4087 } | 4083 } |
| 4088 ContainerNode::traceWrappers(visitor); | 4084 ContainerNode::traceWrappers(visitor); |
| 4089 } | 4085 } |
| 4090 | 4086 |
| 4091 } // namespace blink | 4087 } // namespace blink |
| OLD | NEW |