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

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

Issue 2907663004: FrameTree::Find only searches relative to local frames. (Closed)
Patch Set: . Created 3 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 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,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 unsigned FrameTree::ChildCount() const { 143 unsigned FrameTree::ChildCount() const {
144 unsigned count = 0; 144 unsigned count = 0;
145 for (Frame* result = FirstChild(); result; 145 for (Frame* result = FirstChild(); result;
146 result = result->Tree().NextSibling()) 146 result = result->Tree().NextSibling())
147 ++count; 147 ++count;
148 return count; 148 return count;
149 } 149 }
150 150
151 Frame* FrameTree::Find(const AtomicString& name) const { 151 Frame* FrameTree::Find(const AtomicString& name) const {
152 // Named frame lookup should always be relative to a local frame.
153 DCHECK(this_frame_->IsLocalFrame());
154
152 if (EqualIgnoringASCIICase(name, "_self") || 155 if (EqualIgnoringASCIICase(name, "_self") ||
153 EqualIgnoringASCIICase(name, "_current") || name.IsEmpty()) 156 EqualIgnoringASCIICase(name, "_current") || name.IsEmpty())
154 return this_frame_; 157 return this_frame_;
155 158
156 if (EqualIgnoringASCIICase(name, "_top")) 159 if (EqualIgnoringASCIICase(name, "_top"))
157 return &Top(); 160 return &Top();
158 161
159 if (EqualIgnoringASCIICase(name, "_parent")) 162 if (EqualIgnoringASCIICase(name, "_parent"))
160 return Parent() ? Parent() : this_frame_.Get(); 163 return Parent() ? Parent() : this_frame_.Get();
161 164
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 void showFrameTree(const blink::Frame* frame) { 299 void showFrameTree(const blink::Frame* frame) {
297 if (!frame) { 300 if (!frame) {
298 printf("Null input frame\n"); 301 printf("Null input frame\n");
299 return; 302 return;
300 } 303 }
301 304
302 printFrames(&frame->Tree().Top(), frame, 0); 305 printFrames(&frame->Tree().Top(), frame, 0);
303 } 306 }
304 307
305 #endif 308 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698