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

Side by Side Diff: third_party/WebKit/Source/core/page/FrameTree.cpp

Issue 2873503002: NOT YET READY: Improve granularity of window namespaces in Blink.
Patch Set: Rebasing... Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "core/page/FrameTree.h" 21 #include "core/page/FrameTree.h"
22 22
23 #include "core/dom/Document.h" 23 #include "core/dom/Document.h"
24 #include "core/frame/FrameClient.h" 24 #include "core/frame/FrameClient.h"
25 #include "core/frame/LocalFrame.h" 25 #include "core/frame/LocalFrame.h"
26 #include "core/frame/LocalFrameClient.h"
26 #include "core/frame/LocalFrameView.h" 27 #include "core/frame/LocalFrameView.h"
27 #include "core/frame/RemoteFrame.h" 28 #include "core/frame/RemoteFrame.h"
28 #include "core/frame/RemoteFrameView.h" 29 #include "core/frame/RemoteFrameView.h"
29 #include "core/frame/UseCounter.h" 30 #include "core/frame/UseCounter.h"
30 #include "core/page/Page.h" 31 #include "core/page/Page.h"
31 #include "platform/wtf/Assertions.h" 32 #include "platform/wtf/Assertions.h"
32 #include "platform/wtf/Vector.h" 33 #include "platform/wtf/Vector.h"
33 #include "platform/wtf/text/CString.h" 34 #include "platform/wtf/text/CString.h"
34 #include "platform/wtf/text/StringBuilder.h" 35 #include "platform/wtf/text/StringBuilder.h"
35 36
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (!page) 192 if (!page)
192 return nullptr; 193 return nullptr;
193 194
194 for (Frame* frame = page->MainFrame(); frame; 195 for (Frame* frame = page->MainFrame(); frame;
195 frame = frame->Tree().TraverseNext()) { 196 frame = frame->Tree().TraverseNext()) {
196 if (frame->Tree().GetName() == name) 197 if (frame->Tree().GetName() == name)
197 return frame; 198 return frame;
198 } 199 }
199 200
200 // Search the entire tree of each of the other pages in this namespace. 201 // Search the entire tree of each of the other pages in this namespace.
201 // FIXME: Is random order OK? 202 for (const Page* other_page : page->RelatedPages()) {
202 for (const Page* other_page : Page::OrdinaryPages()) {
203 if (other_page == page || other_page->IsClosing()) 203 if (other_page == page || other_page->IsClosing())
204 continue; 204 continue;
205 for (Frame* frame = other_page->MainFrame(); frame; 205 for (Frame* frame = other_page->MainFrame(); frame;
206 frame = frame->Tree().TraverseNext()) { 206 frame = frame->Tree().TraverseNext()) {
207 if (frame->Tree().GetName() == name) 207 if (frame->Tree().GetName() == name)
208 return frame; 208 return frame;
209 } 209 }
210 } 210 }
211 211
212 return nullptr; 212 // Ask the embedder as a fallback.
213 return ToLocalFrame(this_frame_)->Client()->FindFrame(name);
213 } 214 }
214 215
215 bool FrameTree::IsDescendantOf(const Frame* ancestor) const { 216 bool FrameTree::IsDescendantOf(const Frame* ancestor) const {
216 if (!ancestor) 217 if (!ancestor)
217 return false; 218 return false;
218 219
219 if (this_frame_->GetPage() != ancestor->GetPage()) 220 if (this_frame_->GetPage() != ancestor->GetPage())
220 return false; 221 return false;
221 222
222 for (Frame* frame = this_frame_; frame; frame = frame->Tree().Parent()) { 223 for (Frame* frame = this_frame_; frame; frame = frame->Tree().Parent()) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 void showFrameTree(const blink::Frame* frame) { 310 void showFrameTree(const blink::Frame* frame) {
310 if (!frame) { 311 if (!frame) {
311 printf("Null input frame\n"); 312 printf("Null input frame\n");
312 return; 313 return;
313 } 314 }
314 315
315 printFrames(&frame->Tree().Top(), frame, 0); 316 printFrames(&frame->Tree().Top(), frame, 0);
316 } 317 }
317 318
318 #endif 319 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/EmptyClients.cpp ('k') | third_party/WebKit/Source/core/page/Page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698