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 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 detachAttrNodeAtIndex(attr, index); | 2217 detachAttrNodeAtIndex(attr, index); |
2218 return attr; | 2218 return attr; |
2219 } | 2219 } |
2220 | 2220 |
2221 void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con
st AtomicString& value) | 2221 void Element::parseAttribute(const QualifiedName& name, const AtomicString&, con
st AtomicString& value) |
2222 { | 2222 { |
2223 if (name == tabindexAttr) { | 2223 if (name == tabindexAttr) { |
2224 int tabindex = 0; | 2224 int tabindex = 0; |
2225 if (value.isEmpty()) { | 2225 if (value.isEmpty()) { |
2226 clearTabIndexExplicitlyIfNeeded(); | 2226 clearTabIndexExplicitlyIfNeeded(); |
2227 if (treeScope().adjustedFocusedElement() == this) { | 2227 if (isInTreeScope() && rootTreeScope().adjustedFocusedElement() == t
his) { |
2228 // We might want to call blur(), but it's dangerous to dispatch | 2228 // We might want to call blur(), but it's dangerous to dispatch |
2229 // events here. | 2229 // events here. |
2230 document().setNeedsFocusedElementCheck(); | 2230 document().setNeedsFocusedElementCheck(); |
2231 } | 2231 } |
2232 } else if (parseHTMLInteger(value, tabindex)) { | 2232 } else if (parseHTMLInteger(value, tabindex)) { |
2233 // Clamp tabindex to the range of 'short' to match Firefox's behavio
r. | 2233 // Clamp tabindex to the range of 'short' to match Firefox's behavio
r. |
2234 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short
>::min()), std::min(tabindex, static_cast<int>(std::numeric_limits<short>::max()
)))); | 2234 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short
>::min()), std::min(tabindex, static_cast<int>(std::numeric_limits<short>::max()
)))); |
2235 } | 2235 } |
2236 } else if (name == XMLNames::langAttr) { | 2236 } else if (name == XMLNames::langAttr) { |
2237 pseudoStateChanged(CSSSelector::PseudoLang); | 2237 pseudoStateChanged(CSSSelector::PseudoLang); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 frame->selection().setSelection(newSelection, FrameSelection::CloseTypi
ng | FrameSelection::ClearTypingStyle | FrameSelection::DoNotSetFocus); | 2415 frame->selection().setSelection(newSelection, FrameSelection::CloseTypi
ng | FrameSelection::ClearTypingStyle | FrameSelection::DoNotSetFocus); |
2416 frame->selection().revealSelection(); | 2416 frame->selection().revealSelection(); |
2417 } else if (layoutObject() && !layoutObject()->isLayoutPart()) { | 2417 } else if (layoutObject() && !layoutObject()->isLayoutPart()) { |
2418 layoutObject()->scrollRectToVisible(boundingBox()); | 2418 layoutObject()->scrollRectToVisible(boundingBox()); |
2419 } | 2419 } |
2420 } | 2420 } |
2421 | 2421 |
2422 void Element::blur() | 2422 void Element::blur() |
2423 { | 2423 { |
2424 cancelFocusAppearanceUpdate(); | 2424 cancelFocusAppearanceUpdate(); |
2425 if (treeScope().adjustedFocusedElement() == this) { | 2425 if (isInTreeScope() && rootTreeScope().adjustedFocusedElement() == this) { |
2426 Document& doc = document(); | 2426 Document& doc = document(); |
2427 if (doc.page()) | 2427 if (doc.page()) |
2428 doc.page()->focusController().setFocusedElement(0, doc.frame()); | 2428 doc.page()->focusController().setFocusedElement(0, doc.frame()); |
2429 else | 2429 else |
2430 doc.clearFocusedElement(); | 2430 doc.clearFocusedElement(); |
2431 } | 2431 } |
2432 } | 2432 } |
2433 | 2433 |
2434 bool Element::supportsFocus() const | 2434 bool Element::supportsFocus() const |
2435 { | 2435 { |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3137 } | 3137 } |
3138 | 3138 |
3139 inline void Element::updateId(const AtomicString& oldId, const AtomicString& new
Id) | 3139 inline void Element::updateId(const AtomicString& oldId, const AtomicString& new
Id) |
3140 { | 3140 { |
3141 if (!isInTreeScope()) | 3141 if (!isInTreeScope()) |
3142 return; | 3142 return; |
3143 | 3143 |
3144 if (oldId == newId) | 3144 if (oldId == newId) |
3145 return; | 3145 return; |
3146 | 3146 |
3147 updateId(treeScope(), oldId, newId); | 3147 updateId(rootTreeScope(), oldId, newId); |
3148 } | 3148 } |
3149 | 3149 |
3150 inline void Element::updateId(TreeScope& scope, const AtomicString& oldId, const
AtomicString& newId) | 3150 inline void Element::updateId(TreeScope& scope, const AtomicString& oldId, const
AtomicString& newId) |
3151 { | 3151 { |
3152 DCHECK(isInTreeScope()); | 3152 DCHECK(isInTreeScope()); |
3153 DCHECK_NE(oldId, newId); | 3153 DCHECK_NE(oldId, newId); |
3154 | 3154 |
3155 if (!oldId.isEmpty()) | 3155 if (!oldId.isEmpty()) |
3156 scope.removeElementById(oldId, this); | 3156 scope.removeElementById(oldId, this); |
3157 if (!newId.isEmpty()) | 3157 if (!newId.isEmpty()) |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3689 | 3689 |
3690 DEFINE_TRACE(Element) | 3690 DEFINE_TRACE(Element) |
3691 { | 3691 { |
3692 if (hasRareData()) | 3692 if (hasRareData()) |
3693 visitor->trace(elementRareData()); | 3693 visitor->trace(elementRareData()); |
3694 visitor->trace(m_elementData); | 3694 visitor->trace(m_elementData); |
3695 ContainerNode::trace(visitor); | 3695 ContainerNode::trace(visitor); |
3696 } | 3696 } |
3697 | 3697 |
3698 } // namespace blink | 3698 } // namespace blink |
OLD | NEW |