| 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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P
seudoFocus, *toElement(this)); | 1077 document().styleEngine().pseudoStateChangedForElement(CSSSelector::P
seudoFocus, *toElement(this)); |
| 1078 else if (computedStyle()->affectedByFocus()) | 1078 else if (computedStyle()->affectedByFocus()) |
| 1079 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus))
; | 1079 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c
reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus))
; |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 LayoutTheme::theme().controlStateChanged(*layoutObject(), FocusControlState)
; | 1082 LayoutTheme::theme().controlStateChanged(*layoutObject(), FocusControlState)
; |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 void ContainerNode::setFocus(bool received) | 1085 void ContainerNode::setFocus(bool received) |
| 1086 { | 1086 { |
| 1087 // Recurse up the shadow trees to mark shadow hosts if it matches :focus. | |
| 1088 if (isInShadowTree() && shadowHost()->shadowRoot()) | |
| 1089 shadowHost()->setFocus(received); | |
| 1090 | |
| 1091 // If this is an author shadow host and indirectly focused (has focused elem
ent within | |
| 1092 // its shadow root), update focus. | |
| 1093 // TODO(kochi): Handle UA shadow which marks multiple nodes as focused such
as | |
| 1094 // <input type="date"> the same way as author shadow. | |
| 1095 if (document().focusedElement() && document().focusedElement() != this) { | |
| 1096 Element* host = toElement(this); | |
| 1097 if (host->shadowRoot()) | |
| 1098 received = received && host->tabIndex() >= 0 && !host->tabStop(); | |
| 1099 } | |
| 1100 | |
| 1101 if (focused() == received) | 1087 if (focused() == received) |
| 1102 return; | 1088 return; |
| 1103 | 1089 |
| 1104 Node::setFocus(received); | 1090 Node::setFocus(received); |
| 1105 | 1091 |
| 1106 focusStateChanged(); | 1092 focusStateChanged(); |
| 1107 | 1093 |
| 1108 if (layoutObject() || received) | 1094 if (layoutObject() || received) |
| 1109 return; | 1095 return; |
| 1110 | 1096 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 return true; | 1507 return true; |
| 1522 | 1508 |
| 1523 if (node->isElementNode() && toElement(node)->shadow()) | 1509 if (node->isElementNode() && toElement(node)->shadow()) |
| 1524 return true; | 1510 return true; |
| 1525 | 1511 |
| 1526 return false; | 1512 return false; |
| 1527 } | 1513 } |
| 1528 #endif | 1514 #endif |
| 1529 | 1515 |
| 1530 } // namespace blink | 1516 } // namespace blink |
| OLD | NEW |