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

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

Issue 317493002: Change FrameTree to return Frames instead of LocalFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed conflicts Created 6 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,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 FrameTree::FrameTree(Frame* thisFrame) 43 FrameTree::FrameTree(Frame* thisFrame)
44 : m_thisFrame(thisFrame) 44 : m_thisFrame(thisFrame)
45 , m_scopedChildCount(invalidChildCount) 45 , m_scopedChildCount(invalidChildCount)
46 { 46 {
47 } 47 }
48 48
49 FrameTree::~FrameTree() 49 FrameTree::~FrameTree()
50 { 50 {
51 // FIXME: Why is this here? Doesn't this parallel what we already do in ~Loc alFrame? 51 // FIXME: Why is this here? Doesn't this parallel what we already do in ~Loc alFrame?
52 for (LocalFrame* child = firstChild(); child; child = child->tree().nextSibl ing()) 52 for (Frame* child = firstChild(); child; child = child->tree().nextSibling() ) {
53 child->setView(nullptr); 53 if (child->isLocalFrame())
54 toLocalFrame(child)->setView(nullptr);
55 }
54 } 56 }
55 57
56 void FrameTree::setName(const AtomicString& name, const AtomicString& fallbackNa me) 58 void FrameTree::setName(const AtomicString& name, const AtomicString& fallbackNa me)
57 { 59 {
58 m_name = name; 60 m_name = name;
59 if (!parent()) { 61 if (!parent()) {
60 m_uniqueName = name; 62 m_uniqueName = name;
61 return; 63 return;
62 } 64 }
63 m_uniqueName = AtomicString(); // Remove our old frame name so it's not cons idered in uniqueChildName. 65 m_uniqueName = AtomicString(); // Remove our old frame name so it's not cons idered in uniqueChildName.
64 m_uniqueName = parent()->tree().uniqueChildName(name.isEmpty() ? fallbackNam e : name); 66 m_uniqueName = parent()->tree().uniqueChildName(name.isEmpty() ? fallbackNam e : name);
65 } 67 }
66 68
67 LocalFrame* FrameTree::parent() const 69 Frame* FrameTree::parent() const
68 { 70 {
69 if (!m_thisFrame->client()) 71 if (!m_thisFrame->client())
70 return 0; 72 return 0;
71 // FIXME: Temporary hack to stage converting locations that really should be Frame. 73 // FIXME: Temporary hack to stage converting locations that really should be Frame.
dcheng 2014/06/04 18:06:37 Delete FIXMEs?
kenrb 2014/06/04 20:34:47 Done.
72 return toLocalFrame(m_thisFrame->client()->parent()); 74 return m_thisFrame->client()->parent();
73 } 75 }
74 76
75 LocalFrame* FrameTree::top() const 77 Frame* FrameTree::top() const
76 { 78 {
77 // FIXME: top() should never return null, so here are some hacks to deal 79 // FIXME: top() should never return null, so here are some hacks to deal
78 // with EmptyFrameLoaderClient and cases where the frame is detached 80 // with EmptyFrameLoaderClient and cases where the frame is detached
79 // already... 81 // already...
80 if (!m_thisFrame->client()) 82 if (!m_thisFrame->client())
81 return toLocalFrame(m_thisFrame); 83 return m_thisFrame;
82 // FIXME: Temporary hack to stage converting locations that really should be Frame. 84 // FIXME: Temporary hack to stage converting locations that really should be Frame.
83 LocalFrame* candidate = toLocalFrame(m_thisFrame->client()->top()); 85 Frame* candidate = m_thisFrame->client()->top();
84 return candidate ? candidate : toLocalFrame(m_thisFrame); 86 return candidate ? candidate : m_thisFrame;
85 } 87 }
86 88
87 LocalFrame* FrameTree::previousSibling() const 89 Frame* FrameTree::previousSibling() const
88 { 90 {
89 if (!m_thisFrame->client()) 91 if (!m_thisFrame->client())
90 return 0; 92 return 0;
91 // FIXME: Temporary hack to stage converting locations that really should be Frame. 93 // FIXME: Temporary hack to stage converting locations that really should be Frame.
92 return toLocalFrame(m_thisFrame->client()->previousSibling()); 94 return m_thisFrame->client()->previousSibling();
93 } 95 }
94 96
95 LocalFrame* FrameTree::nextSibling() const 97 Frame* FrameTree::nextSibling() const
96 { 98 {
97 if (!m_thisFrame->client()) 99 if (!m_thisFrame->client())
98 return 0; 100 return 0;
99 // FIXME: Temporary hack to stage converting locations that really should be Frame. 101 // FIXME: Temporary hack to stage converting locations that really should be Frame.
100 return toLocalFrame(m_thisFrame->client()->nextSibling()); 102 return m_thisFrame->client()->nextSibling();
101 } 103 }
102 104
103 LocalFrame* FrameTree::firstChild() const 105 Frame* FrameTree::firstChild() const
104 { 106 {
105 if (!m_thisFrame->client()) 107 if (!m_thisFrame->client())
106 return 0; 108 return 0;
107 // FIXME: Temporary hack to stage converting locations that really should be Frame. 109 // FIXME: Temporary hack to stage converting locations that really should be Frame.
108 return toLocalFrame(m_thisFrame->client()->firstChild()); 110 return m_thisFrame->client()->firstChild();
109 } 111 }
110 112
111 LocalFrame* FrameTree::lastChild() const 113 Frame* FrameTree::lastChild() const
112 { 114 {
113 if (!m_thisFrame->client()) 115 if (!m_thisFrame->client())
114 return 0; 116 return 0;
115 // FIXME: Temporary hack to stage converting locations that really should be Frame. 117 // FIXME: Temporary hack to stage converting locations that really should be Frame.
116 return toLocalFrame(m_thisFrame->client()->lastChild()); 118 return m_thisFrame->client()->lastChild();
117 } 119 }
118 120
119 bool FrameTree::uniqueNameExists(const AtomicString& name) const 121 bool FrameTree::uniqueNameExists(const AtomicString& name) const
120 { 122 {
121 for (LocalFrame* frame = top(); frame; frame = frame->tree().traverseNext()) { 123 for (Frame* frame = top(); frame; frame = frame->tree().traverseNext()) {
122 if (frame->tree().uniqueName() == name) 124 if (frame->tree().uniqueName() == name)
123 return true; 125 return true;
124 } 126 }
125 return false; 127 return false;
126 } 128 }
127 129
128 AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const 130 AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const
129 { 131 {
130 if (!requestedName.isEmpty() && !uniqueNameExists(requestedName) && requeste dName != "_blank") 132 if (!requestedName.isEmpty() && !uniqueNameExists(requestedName) && requeste dName != "_blank")
131 return requestedName; 133 return requestedName;
132 134
133 // Create a repeatable name for a child about to be added to us. The name mu st be 135 // Create a repeatable name for a child about to be added to us. The name mu st be
134 // unique within the frame tree. The string we generate includes a "path" of names 136 // unique within the frame tree. The string we generate includes a "path" of names
135 // from the root frame down to us. For this path to be unique, each set of s iblings must 137 // from the root frame down to us. For this path to be unique, each set of s iblings must
136 // contribute a unique name to the path, which can't collide with any HTML-a ssigned names. 138 // contribute a unique name to the path, which can't collide with any HTML-a ssigned names.
137 // We generate this path component by index in the child list along with an unlikely 139 // We generate this path component by index in the child list along with an unlikely
138 // frame name that can't be set in HTML because it collides with comment syn tax. 140 // frame name that can't be set in HTML because it collides with comment syn tax.
139 141
140 const char framePathPrefix[] = "<!--framePath "; 142 const char framePathPrefix[] = "<!--framePath ";
141 const int framePathPrefixLength = 14; 143 const int framePathPrefixLength = 14;
142 const int framePathSuffixLength = 3; 144 const int framePathSuffixLength = 3;
143 145
144 // Find the nearest parent that has a frame with a path in it. 146 // Find the nearest parent that has a frame with a path in it.
145 Vector<LocalFrame*, 16> chain; 147 Vector<Frame*, 16> chain;
146 LocalFrame* frame; 148 Frame* frame;
147 for (frame = toLocalFrame(m_thisFrame); frame; frame = frame->tree().parent( )) { 149 for (frame = m_thisFrame; frame; frame = frame->tree().parent()) {
148 if (frame->tree().uniqueName().startsWith(framePathPrefix)) 150 if (frame->tree().uniqueName().startsWith(framePathPrefix))
149 break; 151 break;
150 chain.append(frame); 152 chain.append(frame);
151 } 153 }
152 StringBuilder name; 154 StringBuilder name;
153 name.append(framePathPrefix); 155 name.append(framePathPrefix);
154 if (frame) { 156 if (frame) {
155 name.append(frame->tree().uniqueName().string().substring(framePathPrefi xLength, 157 name.append(frame->tree().uniqueName().string().substring(framePathPrefi xLength,
156 frame->tree().uniqueName().length() - framePathPrefixLength - frameP athSuffixLength)); 158 frame->tree().uniqueName().length() - framePathPrefixLength - frameP athSuffixLength));
157 } 159 }
158 for (int i = chain.size() - 1; i >= 0; --i) { 160 for (int i = chain.size() - 1; i >= 0; --i) {
159 frame = chain[i]; 161 frame = chain[i];
160 name.append('/'); 162 name.append('/');
161 name.append(frame->tree().uniqueName()); 163 name.append(frame->tree().uniqueName());
162 } 164 }
163 165
164 name.appendLiteral("/<!--frame"); 166 name.appendLiteral("/<!--frame");
165 name.appendNumber(childCount() - 1); 167 name.appendNumber(childCount() - 1);
166 name.appendLiteral("-->-->"); 168 name.appendLiteral("-->-->");
167 169
168 return name.toAtomicString(); 170 return name.toAtomicString();
169 } 171 }
170 172
171 LocalFrame* FrameTree::scopedChild(unsigned index) const 173 Frame* FrameTree::scopedChild(unsigned index) const
172 { 174 {
175 if (!m_thisFrame->isLocalFrame())
176 return 0;
173 TreeScope* scope = toLocalFrame(m_thisFrame)->document(); 177 TreeScope* scope = toLocalFrame(m_thisFrame)->document();
174 if (!scope) 178 if (!scope)
175 return 0; 179 return 0;
176 180
177 unsigned scopedIndex = 0; 181 unsigned scopedIndex = 0;
178 for (LocalFrame* result = firstChild(); result; result = result->tree().next Sibling()) { 182 for (Frame* result = firstChild(); result; result = result->tree().nextSibli ng()) {
179 if (result->inScope(scope)) { 183 if (result->isLocalFrame() && toLocalFrame(result)->inScope(scope)) {
180 if (scopedIndex == index) 184 if (scopedIndex == index)
181 return result; 185 return result;
182 scopedIndex++; 186 scopedIndex++;
183 } 187 }
184 } 188 }
185 189
186 return 0; 190 return 0;
187 } 191 }
188 192
189 LocalFrame* FrameTree::scopedChild(const AtomicString& name) const 193 Frame* FrameTree::scopedChild(const AtomicString& name) const
190 { 194 {
195 if (!m_thisFrame->isLocalFrame())
196 return 0;
197
191 TreeScope* scope = toLocalFrame(m_thisFrame)->document(); 198 TreeScope* scope = toLocalFrame(m_thisFrame)->document();
192 if (!scope) 199 if (!scope)
193 return 0; 200 return 0;
194 201
195 for (LocalFrame* child = firstChild(); child; child = child->tree().nextSibl ing()) 202 for (Frame* child = firstChild(); child; child = child->tree().nextSibling() )
196 if (child->tree().name() == name && child->inScope(scope)) 203 if (child->tree().name() == name && child->isLocalFrame() && toLocalFram e(child)->inScope(scope))
197 return child; 204 return child;
198 return 0; 205 return 0;
199 } 206 }
200 207
201 inline unsigned FrameTree::scopedChildCount(TreeScope* scope) const 208 inline unsigned FrameTree::scopedChildCount(TreeScope* scope) const
202 { 209 {
203 if (!scope) 210 if (!scope)
204 return 0; 211 return 0;
205 212
206 unsigned scopedCount = 0; 213 unsigned scopedCount = 0;
207 for (LocalFrame* result = firstChild(); result; result = result->tree().next Sibling()) { 214 for (Frame* result = firstChild(); result; result = result->tree().nextSibli ng()) {
208 if (result->inScope(scope)) 215 if (result->isLocalFrame() && toLocalFrame(result)->inScope(scope))
209 scopedCount++; 216 scopedCount++;
210 } 217 }
211 218
212 return scopedCount; 219 return scopedCount;
213 } 220 }
214 221
215 unsigned FrameTree::scopedChildCount() const 222 unsigned FrameTree::scopedChildCount() const
216 { 223 {
217 if (m_scopedChildCount == invalidChildCount) 224 if (m_scopedChildCount == invalidChildCount)
218 m_scopedChildCount = scopedChildCount(toLocalFrame(m_thisFrame)->documen t()); 225 m_scopedChildCount = scopedChildCount(toLocalFrame(m_thisFrame)->documen t());
219 return m_scopedChildCount; 226 return m_scopedChildCount;
220 } 227 }
221 228
222 void FrameTree::invalidateScopedChildCount() 229 void FrameTree::invalidateScopedChildCount()
223 { 230 {
224 m_scopedChildCount = invalidChildCount; 231 m_scopedChildCount = invalidChildCount;
225 } 232 }
226 233
227 unsigned FrameTree::childCount() const 234 unsigned FrameTree::childCount() const
228 { 235 {
229 unsigned count = 0; 236 unsigned count = 0;
230 for (LocalFrame* result = firstChild(); result; result = result->tree().next Sibling()) 237 for (Frame* result = firstChild(); result; result = result->tree().nextSibli ng())
231 ++count; 238 ++count;
232 return count; 239 return count;
233 } 240 }
234 241
235 LocalFrame* FrameTree::child(const AtomicString& name) const 242 Frame* FrameTree::child(const AtomicString& name) const
236 { 243 {
237 for (LocalFrame* child = firstChild(); child; child = child->tree().nextSibl ing()) 244 for (Frame* child = firstChild(); child; child = child->tree().nextSibling() )
238 if (child->tree().name() == name) 245 if (child->tree().name() == name)
239 return child; 246 return child;
240 return 0; 247 return 0;
241 } 248 }
242 249
243 LocalFrame* FrameTree::find(const AtomicString& name) const 250 Frame* FrameTree::find(const AtomicString& name) const
244 { 251 {
245 if (name == "_self" || name == "_current" || name.isEmpty()) 252 if (name == "_self" || name == "_current" || name.isEmpty())
246 return toLocalFrame(m_thisFrame); 253 return m_thisFrame;
247 254
248 if (name == "_top") 255 if (name == "_top")
249 return top(); 256 return top();
250 257
251 if (name == "_parent") 258 if (name == "_parent")
252 return parent() ? parent() : toLocalFrame(m_thisFrame); 259 return parent() ? parent() : m_thisFrame;
253 260
254 // Since "_blank" should never be any frame's name, the following just amoun ts to an optimization. 261 // Since "_blank" should never be any frame's name, the following just amoun ts to an optimization.
255 if (name == "_blank") 262 if (name == "_blank")
256 return 0; 263 return 0;
257 264
258 // Search subtree starting with this frame first. 265 // Search subtree starting with this frame first.
259 for (LocalFrame* frame = toLocalFrame(m_thisFrame); frame; frame = frame->tr ee().traverseNext(toLocalFrame(m_thisFrame))) 266 for (Frame* frame = m_thisFrame; frame; frame = frame->tree().traverseNext(m _thisFrame))
260 if (frame->tree().name() == name) 267 if (frame->tree().name() == name)
261 return frame; 268 return frame;
262 269
263 // Search the entire tree for this page next. 270 // Search the entire tree for this page next.
264 Page* page = m_thisFrame->page(); 271 Page* page = m_thisFrame->page();
265 272
266 // The frame could have been detached from the page, so check it. 273 // The frame could have been detached from the page, so check it.
267 if (!page) 274 if (!page)
268 return 0; 275 return 0;
269 276
270 for (LocalFrame* frame = page->mainFrame(); frame; frame = frame->tree().tra verseNext()) 277 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverse Next())
271 if (frame->tree().name() == name) 278 if (frame->tree().name() == name)
272 return frame; 279 return frame;
273 280
274 // Search the entire tree of each of the other pages in this namespace. 281 // Search the entire tree of each of the other pages in this namespace.
275 // FIXME: Is random order OK? 282 // FIXME: Is random order OK?
276 const HashSet<Page*>& pages = Page::ordinaryPages(); 283 const HashSet<Page*>& pages = Page::ordinaryPages();
277 HashSet<Page*>::const_iterator end = pages.end(); 284 HashSet<Page*>::const_iterator end = pages.end();
278 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { 285 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
279 Page* otherPage = *it; 286 Page* otherPage = *it;
280 if (otherPage != page) { 287 if (otherPage != page) {
281 for (LocalFrame* frame = otherPage->mainFrame(); frame; frame = fram e->tree().traverseNext()) { 288 for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tr ee().traverseNext()) {
282 if (frame->tree().name() == name) 289 if (frame->tree().name() == name)
283 return frame; 290 return frame;
284 } 291 }
285 } 292 }
286 } 293 }
287 294
288 return 0; 295 return 0;
289 } 296 }
290 297
291 bool FrameTree::isDescendantOf(const LocalFrame* ancestor) const 298 bool FrameTree::isDescendantOf(const Frame* ancestor) const
292 { 299 {
293 if (!ancestor) 300 if (!ancestor)
294 return false; 301 return false;
295 302
296 if (m_thisFrame->page() != ancestor->page()) 303 if (m_thisFrame->page() != ancestor->page())
297 return false; 304 return false;
298 305
299 for (LocalFrame* frame = toLocalFrame(m_thisFrame); frame; frame = frame->tr ee().parent()) 306 for (Frame* frame = m_thisFrame; frame; frame = frame->tree().parent())
300 if (frame == ancestor) 307 if (frame == ancestor)
301 return true; 308 return true;
302 return false; 309 return false;
303 } 310 }
304 311
305 LocalFrame* FrameTree::traverseNext(const LocalFrame* stayWithin) const 312 Frame* FrameTree::traverseNext(const Frame* stayWithin) const
306 { 313 {
307 LocalFrame* child = firstChild(); 314 Frame* child = firstChild();
308 if (child) { 315 if (child) {
309 ASSERT(!stayWithin || child->tree().isDescendantOf(stayWithin)); 316 ASSERT(!stayWithin || child->tree().isDescendantOf(stayWithin));
310 return child; 317 return child;
311 } 318 }
312 319
313 if (m_thisFrame == stayWithin) 320 if (m_thisFrame == stayWithin)
314 return 0; 321 return 0;
315 322
316 LocalFrame* sibling = nextSibling(); 323 Frame* sibling = nextSibling();
317 if (sibling) { 324 if (sibling) {
318 ASSERT(!stayWithin || sibling->tree().isDescendantOf(stayWithin)); 325 ASSERT(!stayWithin || sibling->tree().isDescendantOf(stayWithin));
319 return sibling; 326 return sibling;
320 } 327 }
321 328
322 LocalFrame* frame = toLocalFrame(m_thisFrame); 329 Frame* frame = m_thisFrame;
323 while (!sibling && (!stayWithin || frame->tree().parent() != stayWithin)) { 330 while (!sibling && (!stayWithin || frame->tree().parent() != stayWithin)) {
324 frame = frame->tree().parent(); 331 frame = frame->tree().parent();
325 if (!frame) 332 if (!frame)
326 return 0; 333 return 0;
327 sibling = frame->tree().nextSibling(); 334 sibling = frame->tree().nextSibling();
328 } 335 }
329 336
330 if (frame) { 337 if (frame) {
331 ASSERT(!stayWithin || !sibling || sibling->tree().isDescendantOf(stayWit hin)); 338 ASSERT(!stayWithin || !sibling || sibling->tree().isDescendantOf(stayWit hin));
332 return sibling; 339 return sibling;
333 } 340 }
334 341
335 return 0; 342 return 0;
336 } 343 }
337 344
338 LocalFrame* FrameTree::traverseNextWithWrap(bool wrap) const 345 Frame* FrameTree::traverseNextWithWrap(bool wrap) const
339 { 346 {
340 if (LocalFrame* result = traverseNext()) 347 if (Frame* result = traverseNext())
341 return result; 348 return result;
342 349
343 if (wrap) 350 if (wrap)
344 return m_thisFrame->page()->mainFrame(); 351 return m_thisFrame->page()->mainFrame();
345 352
346 return 0; 353 return 0;
347 } 354 }
348 355
349 LocalFrame* FrameTree::traversePreviousWithWrap(bool wrap) const 356 Frame* FrameTree::traversePreviousWithWrap(bool wrap) const
350 { 357 {
351 // FIXME: besides the wrap feature, this is just the traversePreviousNode al gorithm 358 // FIXME: besides the wrap feature, this is just the traversePreviousNode al gorithm
352 359
353 if (LocalFrame* prevSibling = previousSibling()) 360 if (Frame* prevSibling = previousSibling())
354 return prevSibling->tree().deepLastChild(); 361 return prevSibling->tree().deepLastChild();
355 if (LocalFrame* parentFrame = parent()) 362 if (Frame* parentFrame = parent())
356 return parentFrame; 363 return parentFrame;
357 364
358 // no siblings, no parent, self==top 365 // no siblings, no parent, self==top
359 if (wrap) 366 if (wrap)
360 return deepLastChild(); 367 return deepLastChild();
361 368
362 // top view is always the last one in this ordering, so prev is nil without wrap 369 // top view is always the last one in this ordering, so prev is nil without wrap
363 return 0; 370 return 0;
364 } 371 }
365 372
366 LocalFrame* FrameTree::deepLastChild() const 373 Frame* FrameTree::deepLastChild() const
367 { 374 {
368 LocalFrame* result = toLocalFrame(m_thisFrame); 375 Frame* result = m_thisFrame;
369 for (LocalFrame* last = lastChild(); last; last = last->tree().lastChild()) 376 for (Frame* last = lastChild(); last; last = last->tree().lastChild())
370 result = last; 377 result = last;
371 378
372 return result; 379 return result;
373 } 380 }
374 381
375 } // namespace WebCore 382 } // namespace WebCore
376 383
377 #ifndef NDEBUG 384 #ifndef NDEBUG
378 385
379 static void printIndent(int indent) 386 static void printIndent(int indent)
380 { 387 {
381 for (int i = 0; i < indent; ++i) 388 for (int i = 0; i < indent; ++i)
382 printf(" "); 389 printf(" ");
383 } 390 }
384 391
385 static void printFrames(const WebCore::LocalFrame* frame, const WebCore::LocalFr ame* targetFrame, int indent) 392 static void printFrames(const WebCore::Frame* frame, const WebCore::Frame* targe tFrame, int indent)
386 { 393 {
394 if (!frame->isLocalFrame())
dcheng 2014/06/04 18:06:37 I don't see a reason this shouldn't work for remot
kenrb 2014/06/04 20:34:47 Changed.
395 return;
396
387 if (frame == targetFrame) { 397 if (frame == targetFrame) {
388 printf("--> "); 398 printf("--> ");
389 printIndent(indent - 1); 399 printIndent(indent - 1);
390 } else 400 } else
391 printIndent(indent); 401 printIndent(indent);
392 402
393 WebCore::FrameView* view = frame->view(); 403 WebCore::FrameView* view = toLocalFrame(frame)->view();
394 printf("LocalFrame %p %dx%d\n", frame, view ? view->width() : 0, view ? view ->height() : 0); 404 printf("Frame %p %dx%d\n", frame, view ? view->width() : 0, view ? view->hei ght() : 0);
395 printIndent(indent); 405 printIndent(indent);
396 printf(" owner=%p\n", frame->owner()); 406 printf(" owner=%p\n", frame->owner());
397 printIndent(indent); 407 printIndent(indent);
398 printf(" frameView=%p\n", view); 408 printf(" frameView=%p\n", view);
399 printIndent(indent); 409 printIndent(indent);
400 printf(" document=%p\n", frame->document()); 410 printf(" document=%p\n", toLocalFrame(frame)->document());
401 printIndent(indent); 411 printIndent(indent);
402 printf(" uri=%s\n\n", frame->document()->url().string().utf8().data()); 412 printf(" uri=%s\n\n", toLocalFrame(frame)->document()->url().string().utf8( ).data());
403 413
404 for (WebCore::LocalFrame* child = frame->tree().firstChild(); child; child = child->tree().nextSibling()) 414 for (WebCore::Frame* child = frame->tree().firstChild(); child; child = chil d->tree().nextSibling())
405 printFrames(child, targetFrame, indent + 1); 415 printFrames(child, targetFrame, indent + 1);
406 } 416 }
407 417
408 void showFrameTree(const WebCore::LocalFrame* frame) 418 void showFrameTree(const WebCore::Frame* frame)
409 { 419 {
410 if (!frame) { 420 if (!frame) {
411 printf("Null input frame\n"); 421 printf("Null input frame\n");
412 return; 422 return;
413 } 423 }
414 424
415 printFrames(frame->tree().top(), frame, 0); 425 printFrames(frame->tree().top(), frame, 0);
416 } 426 }
417 427
418 #endif 428 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698