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

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

Issue 1141553006: Update Blink to use the tree scope info on WebFrame for scoping checks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase 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
Index: Source/core/page/FrameTree.cpp
diff --git a/Source/core/page/FrameTree.cpp b/Source/core/page/FrameTree.cpp
index 3c73ba1ff8529189d166609c663e38058ae67847..27677ce7cfd7db35886482923a4b133276633619 100644
--- a/Source/core/page/FrameTree.cpp
+++ b/Source/core/page/FrameTree.cpp
@@ -172,25 +172,12 @@ AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const
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* 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))
+ for (Frame* child = firstChild(); child; child = child->tree().nextSibling()) {
+ if (child->client()->inShadowTree())
continue;
if (scopedIndex == index)
- return result;
+ return child;
scopedIndex++;
}
@@ -199,35 +186,20 @@ Frame* FrameTree::scopedChild(unsigned index) const
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)))
+ 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* 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))
+ for (Frame* child = firstChild(); child; child = child->tree().nextSibling()) {
+ if (child->client()->inShadowTree())
continue;
scopedCount++;
}

Powered by Google App Engine
This is Rietveld 408576698