| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "TreeScope.h" | 27 #include "TreeScope.h" |
| 28 | 28 |
| 29 #include "ComposedShadowTreeWalker.h" | 29 #include "ComposedShadowTreeWalker.h" |
| 30 #include "ContainerNode.h" | 30 #include "ContainerNode.h" |
| 31 #include "ContextFeatures.h" |
| 31 #include "DOMSelection.h" | 32 #include "DOMSelection.h" |
| 32 #include "DOMWindow.h" | 33 #include "DOMWindow.h" |
| 33 #include "Document.h" | 34 #include "Document.h" |
| 34 #include "Element.h" | 35 #include "Element.h" |
| 35 #include "FocusController.h" | 36 #include "FocusController.h" |
| 36 #include "Frame.h" | 37 #include "Frame.h" |
| 37 #include "HTMLAnchorElement.h" | 38 #include "HTMLAnchorElement.h" |
| 38 #include "HTMLFrameOwnerElement.h" | 39 #include "HTMLFrameOwnerElement.h" |
| 39 #include "HTMLLabelElement.h" | 40 #include "HTMLLabelElement.h" |
| 40 #include "HTMLMapElement.h" | 41 #include "HTMLMapElement.h" |
| 41 #include "HTMLNames.h" | 42 #include "HTMLNames.h" |
| 42 #include "IdTargetObserverRegistry.h" | 43 #include "IdTargetObserverRegistry.h" |
| 43 #include "InsertionPoint.h" | 44 #include "InsertionPoint.h" |
| 44 #include "Page.h" | 45 #include "Page.h" |
| 45 #include "RuntimeEnabledFeatures.h" | |
| 46 #include "ShadowRoot.h" | 46 #include "ShadowRoot.h" |
| 47 #include "TreeScopeAdopter.h" | 47 #include "TreeScopeAdopter.h" |
| 48 #include <wtf/Vector.h> | 48 #include <wtf/Vector.h> |
| 49 #include <wtf/text/AtomicString.h> | 49 #include <wtf/text/AtomicString.h> |
| 50 #include <wtf/text/CString.h> | 50 #include <wtf/text/CString.h> |
| 51 | 51 |
| 52 namespace WebCore { | 52 namespace WebCore { |
| 53 | 53 |
| 54 using namespace HTMLNames; | 54 using namespace HTMLNames; |
| 55 | 55 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (!rootNode()->document()->frame()) | 182 if (!rootNode()->document()->frame()) |
| 183 return 0; | 183 return 0; |
| 184 | 184 |
| 185 if (m_selection) | 185 if (m_selection) |
| 186 return m_selection.get(); | 186 return m_selection.get(); |
| 187 | 187 |
| 188 // FIXME: The correct selection in Shadow DOM requires that Position can hav
e a ShadowRoot | 188 // FIXME: The correct selection in Shadow DOM requires that Position can hav
e a ShadowRoot |
| 189 // as a container. It is now enabled only if runtime Shadow DOM feature is e
nabled. | 189 // as a container. It is now enabled only if runtime Shadow DOM feature is e
nabled. |
| 190 // See https://bugs.webkit.org/show_bug.cgi?id=82697 | 190 // See https://bugs.webkit.org/show_bug.cgi?id=82697 |
| 191 #if ENABLE(SHADOW_DOM) | 191 #if ENABLE(SHADOW_DOM) |
| 192 if (RuntimeEnabledFeatures::shadowDOMEnabled()) { | 192 if (ContextFeatures::shadowDOMEnabled(rootNode()->document())) { |
| 193 m_selection = DOMSelection::create(this); | 193 m_selection = DOMSelection::create(this); |
| 194 return m_selection.get(); | 194 return m_selection.get(); |
| 195 } | 195 } |
| 196 #endif | 196 #endif |
| 197 | 197 |
| 198 if (this != rootNode()->document()) | 198 if (this != rootNode()->document()) |
| 199 return rootNode()->document()->getSelection(); | 199 return rootNode()->document()->getSelection(); |
| 200 | 200 |
| 201 m_selection = DOMSelection::create(rootNode()->document()); | 201 m_selection = DOMSelection::create(rootNode()->document()); |
| 202 return m_selection.get(); | 202 return m_selection.get(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 size_t indexA = treeScopesA.size(); | 308 size_t indexA = treeScopesA.size(); |
| 309 size_t indexB = treeScopesB.size(); | 309 size_t indexB = treeScopesB.size(); |
| 310 | 310 |
| 311 for (; indexA > 0 && indexB > 0 && treeScopesA[indexA - 1] == treeScopesB[in
dexB - 1]; --indexA, --indexB) { } | 311 for (; indexA > 0 && indexB > 0 && treeScopesA[indexA - 1] == treeScopesB[in
dexB - 1]; --indexA, --indexB) { } |
| 312 | 312 |
| 313 return treeScopesA[indexA] == treeScopesB[indexB] ? treeScopesA[indexA] : 0; | 313 return treeScopesA[indexA] == treeScopesB[indexB] ? treeScopesA[indexA] : 0; |
| 314 } | 314 } |
| 315 | 315 |
| 316 } // namespace WebCore | 316 } // namespace WebCore |
| OLD | NEW |