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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // logic below. | 361 // logic below. |
362 const bool isRootFixedPos = position == FixedPosition && containingBlock->en
closingLayer() == rootLayer; | 362 const bool isRootFixedPos = position == FixedPosition && containingBlock->en
closingLayer() == rootLayer; |
363 const bool otherIsRootFixedPos = otherPosition == FixedPosition && otherCont
ainingBlock->enclosingLayer() == rootLayer; | 363 const bool otherIsRootFixedPos = otherPosition == FixedPosition && otherCont
ainingBlock->enclosingLayer() == rootLayer; |
364 | 364 |
365 // FIXME: some of these cases don't look quite right. | 365 // FIXME: some of these cases don't look quite right. |
366 if (isRootFixedPos && otherIsRootFixedPos) | 366 if (isRootFixedPos && otherIsRootFixedPos) |
367 return false; | 367 return false; |
368 if (isRootFixedPos || otherIsRootFixedPos) | 368 if (isRootFixedPos || otherIsRootFixedPos) |
369 return true; | 369 return true; |
370 | 370 |
371 if (containingBlock == otherContainingBlock) | 371 if (containingBlock->enclosingLayer() == otherContainingBlock->enclosingLaye
r()) |
372 return false; | 372 return false; |
373 | 373 |
374 // Maintain a set of containing blocks between the first layer and its | 374 // Maintain a set of containing blocks between the first layer and its |
375 // closest scrollable ancestor. | 375 // closest scrollable ancestor. |
376 HashSet<const RenderObject*> containingBlocks; | 376 HashSet<const RenderLayer*> containingBlocks; |
377 while (containingBlock) { | 377 while (containingBlock) { |
378 if (containingBlock->enclosingLayer()->scrollsOverflow()) { | 378 containingBlocks.add(containingBlock->enclosingLayer()); |
| 379 if (containingBlock->enclosingLayer()->scrollsOverflow()) |
379 break; | 380 break; |
380 } | 381 |
381 if (containingBlock->enclosingLayer() == other) { | 382 if (containingBlock->enclosingLayer() == other) { |
382 // This layer does not scroll with respect to the other layer if the
other one does not scroll and this one is a child. | 383 // This layer does not scroll with respect to the other layer if the
other one does not scroll and this one is a child. |
383 return false; | 384 return false; |
384 } | 385 } |
385 containingBlocks.add(containingBlock); | 386 |
386 containingBlock = containingBlock->containingBlock(); | 387 containingBlock = containingBlock->containingBlock(); |
387 } | 388 } |
388 | 389 |
389 // Do the same for the 2nd layer, but if we find a common containing block, | 390 // Do the same for the 2nd layer, but if we find a common containing block, |
390 // it means both layers are contained within a single non-scrolling subtree. | 391 // it means both layers are contained within a single non-scrolling subtree. |
391 // Hence, they will not scroll with respect to each other. | 392 // Hence, they will not scroll with respect to each other. |
392 bool thisLayerScrollsOverflow = scrollsOverflow(); | |
393 while (otherContainingBlock) { | 393 while (otherContainingBlock) { |
394 if (containingBlocks.contains(otherContainingBlock)) | 394 if (containingBlocks.contains(otherContainingBlock->enclosingLayer())) |
395 return false; | 395 return false; |
396 // The other layer scrolls with respect to this one if this one scrolls
and it's a child. | |
397 if (!thisLayerScrollsOverflow && otherContainingBlock->enclosingLayer()
== this) | |
398 return false; | |
399 // The other layer does not scroll with respect to this one if this one
does not scroll and it's a child. | |
400 if (otherContainingBlock->enclosingLayer()->scrollsOverflow()) | 396 if (otherContainingBlock->enclosingLayer()->scrollsOverflow()) |
401 break; | 397 break; |
402 otherContainingBlock = otherContainingBlock->containingBlock(); | 398 otherContainingBlock = otherContainingBlock->containingBlock(); |
403 } | 399 } |
404 | 400 |
405 return true; | 401 return true; |
406 } | 402 } |
407 | 403 |
408 void RenderLayer::updateLayerPositionsAfterDocumentScroll() | 404 void RenderLayer::updateLayerPositionsAfterDocumentScroll() |
409 { | 405 { |
(...skipping 3451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3861 } | 3857 } |
3862 } | 3858 } |
3863 | 3859 |
3864 void showLayerTree(const WebCore::RenderObject* renderer) | 3860 void showLayerTree(const WebCore::RenderObject* renderer) |
3865 { | 3861 { |
3866 if (!renderer) | 3862 if (!renderer) |
3867 return; | 3863 return; |
3868 showLayerTree(renderer->enclosingLayer()); | 3864 showLayerTree(renderer->enclosingLayer()); |
3869 } | 3865 } |
3870 #endif | 3866 #endif |
OLD | NEW |