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

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentOrShadowRoot.h

Issue 2146013003: Rename adjustPointerLockElement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename function and update comments. Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/TreeScope.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DocumentOrShadowRoot_h 5 #ifndef DocumentOrShadowRoot_h
6 #define DocumentOrShadowRoot_h 6 #define DocumentOrShadowRoot_h
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/shadow/ShadowRoot.h" 9 #include "core/dom/shadow/ShadowRoot.h"
10 #include "core/frame/UseCounter.h" 10 #include "core/frame/UseCounter.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const Element* target = document.pointerLockElement(); 54 const Element* target = document.pointerLockElement();
55 if (!target) 55 if (!target)
56 return nullptr; 56 return nullptr;
57 // For Shadow DOM V0 compatibility: We allow returning an element in V0 shadow tree, 57 // For Shadow DOM V0 compatibility: We allow returning an element in V0 shadow tree,
58 // even though it leaks the Shadow DOM. 58 // even though it leaks the Shadow DOM.
59 // TODO(kochi): Once V0 code is removed, the following V0 check is unnec essary. 59 // TODO(kochi): Once V0 code is removed, the following V0 check is unnec essary.
60 if (target && target->isInV0ShadowTree()) { 60 if (target && target->isInV0ShadowTree()) {
61 UseCounter::count(document, UseCounter::DocumentPointerLockElementIn V0Shadow); 61 UseCounter::count(document, UseCounter::DocumentPointerLockElementIn V0Shadow);
62 return const_cast<Element*>(target); 62 return const_cast<Element*>(target);
63 } 63 }
64 return document.adjustedPointerLockElement(*target); 64 return document.adjustedElement(*target);
hayato 2016/07/15 06:24:40 Nit: Can we rename this `adjustedElement` to `adju
kochi 2016/07/15 06:40:09 returns an adjusted element of *target (for docume
65 } 65 }
66 66
67 static Element* pointerLockElement(ShadowRoot& shadowRoot) 67 static Element* pointerLockElement(ShadowRoot& shadowRoot)
68 { 68 {
69 // TODO(kochi): Once V0 code is removed, the following non-V1 check is u nnecessary. 69 // TODO(kochi): Once V0 code is removed, the following non-V1 check is u nnecessary.
70 // After V0 code is removed, we can use the same logic for Document and ShadowRoot. 70 // After V0 code is removed, we can use the same logic for Document and ShadowRoot.
71 if (!shadowRoot.isV1()) 71 if (!shadowRoot.isV1())
72 return nullptr; 72 return nullptr;
73 UseCounter::count(shadowRoot.document(), UseCounter::ShadowRootPointerLo ckElement); 73 UseCounter::count(shadowRoot.document(), UseCounter::ShadowRootPointerLo ckElement);
74 const Element* target = shadowRoot.document().pointerLockElement(); 74 const Element* target = shadowRoot.document().pointerLockElement();
75 if (!target) 75 if (!target)
76 return nullptr; 76 return nullptr;
77 return shadowRoot.adjustedPointerLockElement(*target); 77 return shadowRoot.adjustedElement(*target);
78 } 78 }
79 }; 79 };
80 80
81 } // namespace blink 81 } // namespace blink
82 82
83 #endif // DocumentOrShadowRoot_h 83 #endif // DocumentOrShadowRoot_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/TreeScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698