Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 FrameTree::FrameTree(Frame* thisFrame) | 45 FrameTree::FrameTree(Frame* thisFrame) |
| 46 : m_thisFrame(thisFrame) | 46 : m_thisFrame(thisFrame) |
| 47 , m_scopedChildCount(invalidChildCount) | 47 , m_scopedChildCount(invalidChildCount) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 FrameTree::~FrameTree() | 51 FrameTree::~FrameTree() |
| 52 { | 52 { |
| 53 #if !ENABLE(OILPAN) | |
| 53 // FIXME: Why is this here? Doesn't this parallel what we already do in ~Loc alFrame? | 54 // FIXME: Why is this here? Doesn't this parallel what we already do in ~Loc alFrame? |
|
haraken
2014/09/08 07:25:59
Not related to this CL, it looks like we can remov
sof
2014/09/08 21:17:46
I don't actually understand the FIXME's claim.
| |
| 54 for (Frame* child = firstChild(); child; child = child->tree().nextSibling() ) { | 55 for (Frame* child = firstChild(); child; child = child->tree().nextSibling() ) { |
| 55 if (child->isLocalFrame()) | 56 if (child->isLocalFrame()) |
| 56 toLocalFrame(child)->setView(nullptr); | 57 toLocalFrame(child)->setView(nullptr); |
| 57 else if (child->isRemoteFrame()) | 58 else if (child->isRemoteFrame()) |
| 58 toRemoteFrame(child)->setView(nullptr); | 59 toRemoteFrame(child)->setView(nullptr); |
| 59 } | 60 } |
| 61 #endif | |
| 60 } | 62 } |
| 61 | 63 |
| 62 void FrameTree::setName(const AtomicString& name, const AtomicString& fallbackNa me) | 64 void FrameTree::setName(const AtomicString& name, const AtomicString& fallbackNa me) |
| 63 { | 65 { |
| 64 m_name = name; | 66 m_name = name; |
| 65 if (!parent()) { | 67 if (!parent()) { |
| 66 m_uniqueName = name; | 68 m_uniqueName = name; |
| 67 return; | 69 return; |
| 68 } | 70 } |
| 69 m_uniqueName = AtomicString(); // Remove our old frame name so it's not cons idered in uniqueChildName. | 71 m_uniqueName = AtomicString(); // Remove our old frame name so it's not cons idered in uniqueChildName. |
| 70 m_uniqueName = parent()->tree().uniqueChildName(name.isEmpty() ? fallbackNam e : name); | 72 m_uniqueName = parent()->tree().uniqueChildName(name.isEmpty() ? fallbackNam e : name); |
| 71 } | 73 } |
| 72 | 74 |
| 73 Frame* FrameTree::parent() const | 75 Frame* FrameTree::parent() const |
| 74 { | 76 { |
| 75 if (!m_thisFrame->client()) | 77 if (!m_thisFrame->client()) |
| 76 return 0; | 78 return 0; |
| 77 return m_thisFrame->client()->parent(); | 79 return m_thisFrame->client()->parent(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 Frame* FrameTree::top() const | 82 Frame* FrameTree::top() const |
| 81 { | 83 { |
| 82 // FIXME: top() should never return null, so here are some hacks to deal | 84 // FIXME: top() should never return null, so here are some hacks to deal |
| 83 // with EmptyFrameLoaderClient and cases where the frame is detached | 85 // with EmptyFrameLoaderClient and cases where the frame is detached |
| 84 // already... | 86 // already... |
| 85 if (!m_thisFrame->client()) | 87 if (!m_thisFrame->client()) |
| 86 return m_thisFrame; | 88 return m_thisFrame; |
| 87 Frame* candidate = m_thisFrame->client()->top(); | 89 Frame* candidate = m_thisFrame->client()->top(); |
| 88 return candidate ? candidate : m_thisFrame; | 90 return candidate ? candidate : m_thisFrame.get(); |
| 89 } | 91 } |
| 90 | 92 |
| 91 Frame* FrameTree::previousSibling() const | 93 Frame* FrameTree::previousSibling() const |
| 92 { | 94 { |
| 93 if (!m_thisFrame->client()) | 95 if (!m_thisFrame->client()) |
| 94 return 0; | 96 return 0; |
| 95 return m_thisFrame->client()->previousSibling(); | 97 return m_thisFrame->client()->previousSibling(); |
| 96 } | 98 } |
| 97 | 99 |
| 98 Frame* FrameTree::nextSibling() const | 100 Frame* FrameTree::nextSibling() const |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 | 249 |
| 248 Frame* FrameTree::find(const AtomicString& name) const | 250 Frame* FrameTree::find(const AtomicString& name) const |
| 249 { | 251 { |
| 250 if (name == "_self" || name == "_current" || name.isEmpty()) | 252 if (name == "_self" || name == "_current" || name.isEmpty()) |
| 251 return m_thisFrame; | 253 return m_thisFrame; |
| 252 | 254 |
| 253 if (name == "_top") | 255 if (name == "_top") |
| 254 return top(); | 256 return top(); |
| 255 | 257 |
| 256 if (name == "_parent") | 258 if (name == "_parent") |
| 257 return parent() ? parent() : m_thisFrame; | 259 return parent() ? parent() : m_thisFrame.get(); |
| 258 | 260 |
| 259 // 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. |
| 260 if (name == "_blank") | 262 if (name == "_blank") |
| 261 return 0; | 263 return 0; |
| 262 | 264 |
| 263 // Search subtree starting with this frame first. | 265 // Search subtree starting with this frame first. |
| 264 for (Frame* frame = m_thisFrame; frame; frame = frame->tree().traverseNext(m _thisFrame)) | 266 for (Frame* frame = m_thisFrame; frame; frame = frame->tree().traverseNext(m _thisFrame)) |
| 265 if (frame->tree().name() == name) | 267 if (frame->tree().name() == name) |
| 266 return frame; | 268 return frame; |
| 267 | 269 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 | 372 |
| 371 Frame* FrameTree::deepLastChild() const | 373 Frame* FrameTree::deepLastChild() const |
| 372 { | 374 { |
| 373 Frame* result = m_thisFrame; | 375 Frame* result = m_thisFrame; |
| 374 for (Frame* last = lastChild(); last; last = last->tree().lastChild()) | 376 for (Frame* last = lastChild(); last; last = last->tree().lastChild()) |
| 375 result = last; | 377 result = last; |
| 376 | 378 |
| 377 return result; | 379 return result; |
| 378 } | 380 } |
| 379 | 381 |
| 382 void FrameTree::trace(Visitor* visitor) | |
| 383 { | |
| 384 visitor->trace(m_thisFrame); | |
| 385 } | |
| 386 | |
| 380 } // namespace blink | 387 } // namespace blink |
| 381 | 388 |
| 382 #ifndef NDEBUG | 389 #ifndef NDEBUG |
| 383 | 390 |
| 384 static void printIndent(int indent) | 391 static void printIndent(int indent) |
| 385 { | 392 { |
| 386 for (int i = 0; i < indent; ++i) | 393 for (int i = 0; i < indent; ++i) |
| 387 printf(" "); | 394 printf(" "); |
| 388 } | 395 } |
| 389 | 396 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 414 { | 421 { |
| 415 if (!frame) { | 422 if (!frame) { |
| 416 printf("Null input frame\n"); | 423 printf("Null input frame\n"); |
| 417 return; | 424 return; |
| 418 } | 425 } |
| 419 | 426 |
| 420 printFrames(frame->tree().top(), frame, 0); | 427 printFrames(frame->tree().top(), frame, 0); |
| 421 } | 428 } |
| 422 | 429 |
| 423 #endif | 430 #endif |
| OLD | NEW |