Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: Source/core/dom/ContainerNode.cpp

Issue 1177673005: Implement ShadowRoot.delegatesFocus 4/4 (match CSS :focus for shadow host) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix for comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 (ShadowRoot* root = containingShadowRoot()) {
1091 if (root->type() == ShadowRoot::OpenShadowRoot)
1092 shadowHost()->setFocus(received);
1093 }
1094
1095 // If this is an author shadow host and indirectly focused (has focused elem ent within
1096 // its shadow root), update focus.
1097 if (isElementNode() && document().focusedElement() && document().focusedElem ent() != this) {
1098 if (toElement(this)->shadowRoot())
1099 received = received && toElement(this)->shadowRoot()->delegatesFocus ();
1100 }
1101
1087 if (focused() == received) 1102 if (focused() == received)
1088 return; 1103 return;
1089 1104
1090 Node::setFocus(received); 1105 Node::setFocus(received);
1091 1106
1092 focusStateChanged(); 1107 focusStateChanged();
1093 1108
1094 if (layoutObject() || received) 1109 if (layoutObject() || received)
1095 return; 1110 return;
1096 1111
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 return true; 1522 return true;
1508 1523
1509 if (node->isElementNode() && toElement(node)->shadow()) 1524 if (node->isElementNode() && toElement(node)->shadow())
1510 return true; 1525 return true;
1511 1526
1512 return false; 1527 return false;
1513 } 1528 }
1514 #endif 1529 #endif
1515 1530
1516 } // namespace blink 1531 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/focus-with-dom-mutation-expected.txt ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698