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

Unified Diff: Source/core/page/FrameTree.cpp

Issue 1157563004: Revert of Update Blink to use the tree scope info on WebFrame for scoping checks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/web/WebEmbeddedWorkerImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FrameTree.cpp
diff --git a/Source/core/page/FrameTree.cpp b/Source/core/page/FrameTree.cpp
index 27677ce7cfd7db35886482923a4b133276633619..3c73ba1ff8529189d166609c663e38058ae67847 100644
--- a/Source/core/page/FrameTree.cpp
+++ b/Source/core/page/FrameTree.cpp
@@ -172,34 +172,62 @@
Frame* FrameTree::scopedChild(unsigned index) const
{
+ // TODO(dcheng, alexmos): Currently, all children of a RemoteFrame are
+ // visible, even through a shadow DOM scope. Once RemoteFrames have a
+ // TreeScope, it should be used here.
+ TreeScope* scope = nullptr;
+ if (m_thisFrame->isLocalFrame()) {
+ scope = toLocalFrame(m_thisFrame)->document();
+ if (!scope)
+ return nullptr;
+ }
+
unsigned scopedIndex = 0;
- for (Frame* child = firstChild(); child; child = child->tree().nextSibling()) {
- if (child->client()->inShadowTree())
+ for (Frame* result = firstChild(); result; result = result->tree().nextSibling()) {
+ // TODO(dcheng, alexmos): Currently, RemoteFrames are always visible,
+ // even through a shadow DOM scope. Once RemoteFrames have a TreeScope,
+ // the scoping check should apply to RemoteFrames too.
+ if (scope && result->isLocalFrame() && !toLocalFrame(result)->inScope(scope))
continue;
if (scopedIndex == index)
+ return result;
+ scopedIndex++;
+ }
+
+ return nullptr;
+}
+
+Frame* FrameTree::scopedChild(const AtomicString& name) const
+{
+ // TODO(dcheng, alexmos): Currently, all children of a RemoteFrame are
+ // visible, even through a shadow DOM scope. Once RemoteFrames have a
+ // TreeScope, it should be used here.
+ TreeScope* scope = nullptr;
+ if (m_thisFrame->isLocalFrame()) {
+ scope = toLocalFrame(m_thisFrame)->document();
+ if (!scope)
+ return nullptr;
+ }
+
+ for (Frame* child = firstChild(); child; child = child->tree().nextSibling())
+ // TODO(dcheng, alexmos): Currently, RemoteFrames are always visible,
+ // even through a shadow DOM scope. Once RemoteFrames have a TreeScope,
+ // the scoping check should apply to RemoteFrames too.
+ if (child->tree().name() == name && (!scope || !child->isLocalFrame() || toLocalFrame(child)->inScope(scope)))
return child;
- scopedIndex++;
- }
-
- return nullptr;
-}
-
-Frame* FrameTree::scopedChild(const AtomicString& name) const
-{
- for (Frame* child = firstChild(); child; child = child->tree().nextSibling()) {
- if (child->client()->inShadowTree())
- continue;
- if (child->tree().name() == name)
- return child;
- }
return nullptr;
}
inline unsigned FrameTree::scopedChildCount(TreeScope* scope) const
{
+ // TODO(dcheng, alexmos): Once RemoteFrames have a TreeScope, this should
+ // return 0 if there is no scope.
+
unsigned scopedCount = 0;
- for (Frame* child = firstChild(); child; child = child->tree().nextSibling()) {
- if (child->client()->inShadowTree())
+ for (Frame* result = firstChild(); result; result = result->tree().nextSibling()) {
+ // FIXME: Currently, RemoteFrames are always visible, even through a shadow DOM scope.
+ // Once RemoteFrames have a TreeScope, the scoping check should apply to RemoteFrames too.
+ if (scope && result->isLocalFrame() && !toLocalFrame(result)->inScope(scope))
continue;
scopedCount++;
}
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/web/WebEmbeddedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698