OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 // Step 4: If |checkParent| is set, climb up to our parent and check its sib
lings that | 518 // Step 4: If |checkParent| is set, climb up to our parent and check its sib
lings that |
519 // follow us to see if we can locate a layer. | 519 // follow us to see if we can locate a layer. |
520 if (checkParent && parent()) | 520 if (checkParent && parent()) |
521 return parent()->findNextLayer(parentLayer, this, true); | 521 return parent()->findNextLayer(parentLayer, this, true); |
522 | 522 |
523 return 0; | 523 return 0; |
524 } | 524 } |
525 | 525 |
526 RenderLayer* RenderObject::enclosingLayer() const | 526 RenderLayer* RenderObject::enclosingLayer() const |
527 { | 527 { |
528 const RenderObject* curr = this; | 528 for (const RenderObject* current = this; current; current = current->parent(
)) { |
529 while (curr) { | 529 if (current->hasLayer()) |
530 RenderLayer* layer = curr->hasLayer() ? toRenderLayerModelObject(curr)->
layer() : 0; | 530 return toRenderLayerModelObject(current)->layer(); |
531 if (layer) | |
532 return layer; | |
533 curr = curr->parent(); | |
534 } | 531 } |
| 532 // This line of code should be unreachable. However, if |this| is zero, we |
| 533 // can reach this line. Of course, it's undefined behavior to call a member |
| 534 // function on a zero pointer, but that doesn't stop |
| 535 // FrameView::paintContents. :) |
535 return 0; | 536 return 0; |
536 } | 537 } |
537 | 538 |
538 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign
ment& alignX, const ScrollAlignment& alignY) | 539 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign
ment& alignX, const ScrollAlignment& alignY) |
539 { | 540 { |
540 RenderBox* enclosingBox = this->enclosingBox(); | 541 RenderBox* enclosingBox = this->enclosingBox(); |
541 if (!enclosingBox) | 542 if (!enclosingBox) |
542 return false; | 543 return false; |
543 | 544 |
544 enclosingBox->scrollRectToVisible(rect, alignX, alignY); | 545 enclosingBox->scrollRectToVisible(rect, alignX, alignY); |
(...skipping 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3408 { | 3409 { |
3409 if (object1) { | 3410 if (object1) { |
3410 const WebCore::RenderObject* root = object1; | 3411 const WebCore::RenderObject* root = object1; |
3411 while (root->parent()) | 3412 while (root->parent()) |
3412 root = root->parent(); | 3413 root = root->parent(); |
3413 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3414 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3414 } | 3415 } |
3415 } | 3416 } |
3416 | 3417 |
3417 #endif | 3418 #endif |
OLD | NEW |