| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // (including having a real, non-viewport containing block). | 409 // (including having a real, non-viewport containing block). |
| 410 // | 410 // |
| 411 // Below, a "root" fixed position element is defined to be one whose | 411 // Below, a "root" fixed position element is defined to be one whose |
| 412 // containing block is the root. These root-fixed-position elements are | 412 // containing block is the root. These root-fixed-position elements are |
| 413 // the only ones that need this special case code - other fixed position | 413 // the only ones that need this special case code - other fixed position |
| 414 // elements, as well as all absolute, relative, and static elements use the | 414 // elements, as well as all absolute, relative, and static elements use the |
| 415 // logic below. | 415 // logic below. |
| 416 const bool isRootFixedPos = position == FixedPosition && containingBlock->en
closingLayer() == rootLayer; | 416 const bool isRootFixedPos = position == FixedPosition && containingBlock->en
closingLayer() == rootLayer; |
| 417 const bool otherIsRootFixedPos = otherPosition == FixedPosition && otherCont
ainingBlock->enclosingLayer() == rootLayer; | 417 const bool otherIsRootFixedPos = otherPosition == FixedPosition && otherCont
ainingBlock->enclosingLayer() == rootLayer; |
| 418 | 418 |
| 419 // FIXME: some of these cases don't look quite right. |
| 419 if (isRootFixedPos && otherIsRootFixedPos) | 420 if (isRootFixedPos && otherIsRootFixedPos) |
| 420 return false; | 421 return false; |
| 421 if (isRootFixedPos || otherIsRootFixedPos) | 422 if (isRootFixedPos || otherIsRootFixedPos) |
| 422 return true; | 423 return true; |
| 423 | 424 |
| 424 if (containingBlock == otherContainingBlock) | 425 if (containingBlock == otherContainingBlock) |
| 425 return false; | 426 return false; |
| 426 | 427 |
| 427 // Maintain a set of containing blocks between the first layer and its | 428 // Maintain a set of containing blocks between the first layer and its |
| 428 // closest scrollable ancestor. | 429 // closest scrollable ancestor. |
| 429 HashSet<const RenderObject*> containingBlocks; | 430 HashSet<const RenderObject*> containingBlocks; |
| 430 while (containingBlock) { | 431 while (containingBlock) { |
| 431 if (containingBlock->enclosingLayer()->scrollsOverflow()) | 432 if (containingBlock->enclosingLayer()->scrollsOverflow()) { |
| 432 break; | 433 break; |
| 434 } |
| 435 if (containingBlock->enclosingLayer() == other) { |
| 436 // This layer does not scroll with respect to the other layer if the
other one does not scroll and this one is a child. |
| 437 return false; |
| 438 } |
| 433 containingBlocks.add(containingBlock); | 439 containingBlocks.add(containingBlock); |
| 434 containingBlock = containingBlock->containingBlock(); | 440 containingBlock = containingBlock->containingBlock(); |
| 435 } | 441 } |
| 436 | 442 |
| 437 // Do the same for the 2nd layer, but if we find a common containing block, | 443 // Do the same for the 2nd layer, but if we find a common containing block, |
| 438 // it means both layers are contained within a single non-scrolling subtree. | 444 // it means both layers are contained within a single non-scrolling subtree. |
| 439 // Hence, they will not scroll with respect to each other. | 445 // Hence, they will not scroll with respect to each other. |
| 446 bool thisLayerScrollsOverflow = scrollsOverflow(); |
| 440 while (otherContainingBlock) { | 447 while (otherContainingBlock) { |
| 441 if (containingBlocks.contains(otherContainingBlock)) | 448 if (containingBlocks.contains(otherContainingBlock)) |
| 442 return false; | 449 return false; |
| 450 // The other layer scrolls with respect to this one if this one scrolls
and it's a child. |
| 451 if (!thisLayerScrollsOverflow && otherContainingBlock->enclosingLayer()
== this) |
| 452 return false; |
| 453 // The other layer does not scroll with respect to this one if this one
does not scroll and it's a child. |
| 443 if (otherContainingBlock->enclosingLayer()->scrollsOverflow()) | 454 if (otherContainingBlock->enclosingLayer()->scrollsOverflow()) |
| 444 break; | 455 break; |
| 445 otherContainingBlock = otherContainingBlock->containingBlock(); | 456 otherContainingBlock = otherContainingBlock->containingBlock(); |
| 446 } | 457 } |
| 447 | 458 |
| 448 return true; | 459 return true; |
| 449 } | 460 } |
| 450 | 461 |
| 451 void RenderLayer::updateLayerPositionsAfterDocumentScroll() | 462 void RenderLayer::updateLayerPositionsAfterDocumentScroll() |
| 452 { | 463 { |
| (...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4010 } | 4021 } |
| 4011 } | 4022 } |
| 4012 | 4023 |
| 4013 void showLayerTree(const WebCore::RenderObject* renderer) | 4024 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4014 { | 4025 { |
| 4015 if (!renderer) | 4026 if (!renderer) |
| 4016 return; | 4027 return; |
| 4017 showLayerTree(renderer->enclosingLayer()); | 4028 showLayerTree(renderer->enclosingLayer()); |
| 4018 } | 4029 } |
| 4019 #endif | 4030 #endif |
| OLD | NEW |