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 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 author shadow trees to mark shadow hosts if it matches :focus. | |
| 1088 // TODO(kochi): Handle UA shadows which marks multiple nodes as focused such as | |
| 1089 // <input type="date"> the same way as author shadow. | |
| 1090 if (isInShadowTree() && shadowHost()->shadowRoot()) | |
|
hayato
2015/06/12 07:59:29
How about this? The intention would becomes more c
kochi
2015/06/12 08:21:35
Adopted your first suggestion.
| |
| 1091 shadowHost()->setFocus(received); | |
| 1092 | |
| 1093 // If this is an author shadow host and indirectly focused (has focused elem ent within | |
| 1094 // its shadow root), update focus. | |
| 1095 if (isElementNode() && document().focusedElement() && document().focusedElem ent() != this) { | |
| 1096 if (toElement(this)->shadowRoot()) | |
| 1097 received = received && toElement(this)->shadowRoot()->delegatesFocus (); | |
| 1098 } | |
| 1099 | |
| 1087 if (focused() == received) | 1100 if (focused() == received) |
| 1088 return; | 1101 return; |
| 1089 | 1102 |
| 1090 Node::setFocus(received); | 1103 Node::setFocus(received); |
| 1091 | 1104 |
| 1092 focusStateChanged(); | 1105 focusStateChanged(); |
| 1093 | 1106 |
| 1094 if (layoutObject() || received) | 1107 if (layoutObject() || received) |
| 1095 return; | 1108 return; |
| 1096 | 1109 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1507 return true; | 1520 return true; |
| 1508 | 1521 |
| 1509 if (node->isElementNode() && toElement(node)->shadow()) | 1522 if (node->isElementNode() && toElement(node)->shadow()) |
| 1510 return true; | 1523 return true; |
| 1511 | 1524 |
| 1512 return false; | 1525 return false; |
| 1513 } | 1526 } |
| 1514 #endif | 1527 #endif |
| 1515 | 1528 |
| 1516 } // namespace blink | 1529 } // namespace blink |
| OLD | NEW |