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

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

Issue 1174893002: Implement ShadowRoot.delegatesFocus 1/4 (focus navigation) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix for nit review comment 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 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 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 ASSERT(RuntimeEnabledFeatures::createShadowRootWithParameterEnabled()); 1807 ASSERT(RuntimeEnabledFeatures::createShadowRootWithParameterEnabled());
1808 UseCounter::count(document(), UseCounter::ElementCreateShadowRootWithParamet er); 1808 UseCounter::count(document(), UseCounter::ElementCreateShadowRootWithParamet er);
1809 1809
1810 OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::F eature::ElementCreateShadowRoot); 1810 OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::F eature::ElementCreateShadowRoot);
1811 // TODO(kochi): Add support for closed shadow root. crbug.com/459136 1811 // TODO(kochi): Add support for closed shadow root. crbug.com/459136
1812 if (shadowRootInitDict.hasMode() && shadowRootInitDict.mode() == "closed") { 1812 if (shadowRootInitDict.hasMode() && shadowRootInitDict.mode() == "closed") {
1813 exceptionState.throwDOMException(NotSupportedError, "Closed shadow root is not implemented yet."); 1813 exceptionState.throwDOMException(NotSupportedError, "Closed shadow root is not implemented yet.");
1814 return nullptr; 1814 return nullptr;
1815 } 1815 }
1816 1816
1817 return createShadowRoot(exceptionState); 1817 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRoot(exceptionState) ;
1818
1819 if (shadowRootInitDict.hasDelegatesFocus())
1820 shadowRoot->setDelegatesFocus(shadowRootInitDict.delegatesFocus());
1821
1822 return shadowRoot.release();
1818 } 1823 }
1819 1824
1820 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& exc eptionState) 1825 PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& exc eptionState)
1821 { 1826 {
1822 if (alwaysCreateUserAgentShadowRoot()) 1827 if (alwaysCreateUserAgentShadowRoot())
1823 ensureUserAgentShadowRoot(); 1828 ensureUserAgentShadowRoot();
1824 1829
1825 // Some elements make assumptions about what kind of layoutObjects they allo w 1830 // Some elements make assumptions about what kind of layoutObjects they allo w
1826 // as children so we can't allow author shadows on them for now. An override 1831 // as children so we can't allow author shadows on them for now. An override
1827 // flag is provided for testing how author shadows interact on these element s. 1832 // flag is provided for testing how author shadows interact on these element s.
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 } 2250 }
2246 2251
2247 bool Element::supportsFocus() const 2252 bool Element::supportsFocus() const
2248 { 2253 {
2249 // FIXME: supportsFocus() can be called when layout is not up to date. 2254 // FIXME: supportsFocus() can be called when layout is not up to date.
2250 // Logic that deals with the layoutObject should be moved to layoutObjectIsF ocusable(). 2255 // Logic that deals with the layoutObject should be moved to layoutObjectIsF ocusable().
2251 // But supportsFocus must return true when the element is editable, or else 2256 // But supportsFocus must return true when the element is editable, or else
2252 // it won't be focusable. Furthermore, supportsFocus cannot just return true 2257 // it won't be focusable. Furthermore, supportsFocus cannot just return true
2253 // always or else tabIndex() will change for all HTML elements. 2258 // always or else tabIndex() will change for all HTML elements.
2254 return hasElementFlag(TabIndexWasSetExplicitly) || (hasEditableStyle() && pa rentNode() && !parentNode()->hasEditableStyle()) 2259 return hasElementFlag(TabIndexWasSetExplicitly) || (hasEditableStyle() && pa rentNode() && !parentNode()->hasEditableStyle())
2260 || (isShadowHost(this) && shadowRoot() && shadowRoot()->delegatesFocus() )
2255 || supportsSpatialNavigationFocus(); 2261 || supportsSpatialNavigationFocus();
2256 } 2262 }
2257 2263
2258 bool Element::supportsSpatialNavigationFocus() const 2264 bool Element::supportsSpatialNavigationFocus() const
2259 { 2265 {
2260 // This function checks whether the element satisfies the extended criteria 2266 // This function checks whether the element satisfies the extended criteria
2261 // for the element to be focusable, introduced by spatial navigation feature , 2267 // for the element to be focusable, introduced by spatial navigation feature ,
2262 // i.e. checks if click or keyboard event handler is specified. 2268 // i.e. checks if click or keyboard event handler is specified.
2263 // This is the way to make it possible to navigate to (focus) elements 2269 // This is the way to make it possible to navigate to (focus) elements
2264 // which web designer meant for being active (made them respond to click eve nts). 2270 // which web designer meant for being active (made them respond to click eve nts).
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
3388 { 3394 {
3389 #if ENABLE(OILPAN) 3395 #if ENABLE(OILPAN)
3390 if (hasRareData()) 3396 if (hasRareData())
3391 visitor->trace(elementRareData()); 3397 visitor->trace(elementRareData());
3392 visitor->trace(m_elementData); 3398 visitor->trace(m_elementData);
3393 #endif 3399 #endif
3394 ContainerNode::trace(visitor); 3400 ContainerNode::trace(visitor);
3395 } 3401 }
3396 3402
3397 } // namespace blink 3403 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/webexposed/global-interface-listing-expected.txt ('k') | Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698