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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 // (including having a real, non-viewport containing block). | 355 // (including having a real, non-viewport containing block). |
356 // | 356 // |
357 // Below, a "root" fixed position element is defined to be one whose | 357 // Below, a "root" fixed position element is defined to be one whose |
358 // containing block is the root. These root-fixed-position elements are | 358 // containing block is the root. These root-fixed-position elements are |
359 // the only ones that need this special case code - other fixed position | 359 // the only ones that need this special case code - other fixed position |
360 // elements, as well as all absolute, relative, and static elements use the | 360 // elements, as well as all absolute, relative, and static elements use the |
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. |
hartmanng
2014/06/18 17:54:01
Chris, I believe you added this FIXME. Can you exp
| |
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()) |
hartmanng
2014/06/18 17:54:01
We need to compare enclosingLayers, not just Rende
| |
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 if (containingBlock->enclosingLayer() == other) { | |
hartmanng
2014/06/18 17:54:01
I don't think these special cases are required any
Ian Vollick
2014/06/18 18:28:30
I think we were also looking to early out for effi
hartmanng
2014/06/18 18:46:12
It's still valid, I just thought it was unnecessar
| |
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 return false; | |
384 } | |
385 containingBlocks.add(containingBlock); | |
386 containingBlock = containingBlock->containingBlock(); | 381 containingBlock = containingBlock->containingBlock(); |
387 } | 382 } |
388 | 383 |
389 // Do the same for the 2nd layer, but if we find a common containing block, | 384 // 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. | 385 // it means both layers are contained within a single non-scrolling subtree. |
391 // Hence, they will not scroll with respect to each other. | 386 // Hence, they will not scroll with respect to each other. |
392 bool thisLayerScrollsOverflow = scrollsOverflow(); | |
393 while (otherContainingBlock) { | 387 while (otherContainingBlock) { |
394 if (containingBlocks.contains(otherContainingBlock)) | 388 if (containingBlocks.contains(otherContainingBlock->enclosingLayer())) |
395 return false; | 389 return false; |
396 // The other layer scrolls with respect to this one if this one scrolls and it's a child. | |
hartmanng
2014/06/18 18:46:12
I don't think this early-out will gain us much in
Ian Vollick
2014/06/18 20:40:02
I buy it.
| |
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()) | 390 if (otherContainingBlock->enclosingLayer()->scrollsOverflow()) |
401 break; | 391 break; |
402 otherContainingBlock = otherContainingBlock->containingBlock(); | 392 otherContainingBlock = otherContainingBlock->containingBlock(); |
403 } | 393 } |
404 | 394 |
405 return true; | 395 return true; |
406 } | 396 } |
407 | 397 |
408 void RenderLayer::updateLayerPositionsAfterDocumentScroll() | 398 void RenderLayer::updateLayerPositionsAfterDocumentScroll() |
409 { | 399 { |
(...skipping 3451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3861 } | 3851 } |
3862 } | 3852 } |
3863 | 3853 |
3864 void showLayerTree(const WebCore::RenderObject* renderer) | 3854 void showLayerTree(const WebCore::RenderObject* renderer) |
3865 { | 3855 { |
3866 if (!renderer) | 3856 if (!renderer) |
3867 return; | 3857 return; |
3868 showLayerTree(renderer->enclosingLayer()); | 3858 showLayerTree(renderer->enclosingLayer()); |
3869 } | 3859 } |
3870 #endif | 3860 #endif |
OLD | NEW |