| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 } | 772 } |
| 773 | 773 |
| 774 void LayoutBoxModelObject::updateStickyPositionConstraints() const { | 774 void LayoutBoxModelObject::updateStickyPositionConstraints() const { |
| 775 const FloatSize constrainingSize = computeStickyConstrainingRect().size(); | 775 const FloatSize constrainingSize = computeStickyConstrainingRect().size(); |
| 776 | 776 |
| 777 PaintLayerScrollableArea* scrollableArea = | 777 PaintLayerScrollableArea* scrollableArea = |
| 778 layer()->ancestorOverflowLayer()->getScrollableArea(); | 778 layer()->ancestorOverflowLayer()->getScrollableArea(); |
| 779 StickyPositionScrollingConstraints constraints; | 779 StickyPositionScrollingConstraints constraints; |
| 780 FloatSize skippedContainersOffset; | 780 FloatSize skippedContainersOffset; |
| 781 LayoutBlock* containingBlock = this->containingBlock(); | 781 LayoutBlock* containingBlock = this->containingBlock(); |
| 782 // The location container for boxes is not always the containing block. |
| 783 LayoutBox* locationContainer = isLayoutInline() |
| 784 ? containingBlock |
| 785 : toLayoutBox(this)->locationContainer(); |
| 782 // Skip anonymous containing blocks. | 786 // Skip anonymous containing blocks. |
| 783 while (containingBlock->isAnonymous()) { | 787 while (containingBlock->isAnonymous()) { |
| 784 skippedContainersOffset += | |
| 785 toFloatSize(FloatPoint(containingBlock->frameRect().location())); | |
| 786 containingBlock = containingBlock->containingBlock(); | 788 containingBlock = containingBlock->containingBlock(); |
| 787 } | 789 } |
| 790 MapCoordinatesFlags flags = 0; |
| 791 skippedContainersOffset = |
| 792 toFloatSize(locationContainer |
| 793 ->localToAncestorQuadWithoutTransforms( |
| 794 FloatQuad(), containingBlock, flags) |
| 795 .boundingBox() |
| 796 .location()); |
| 788 LayoutBox* scrollAncestor = | 797 LayoutBox* scrollAncestor = |
| 789 layer()->ancestorOverflowLayer()->isRootLayer() | 798 layer()->ancestorOverflowLayer()->isRootLayer() |
| 790 ? nullptr | 799 ? nullptr |
| 791 : toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject()); | 800 : toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject()); |
| 792 | 801 |
| 793 LayoutUnit maxContainerWidth = | 802 LayoutUnit maxContainerWidth = |
| 794 containingBlock->isLayoutView() | 803 containingBlock->isLayoutView() |
| 795 ? containingBlock->logicalWidth() | 804 ? containingBlock->logicalWidth() |
| 796 : containingBlock->containingBlockLogicalWidthForContent(); | 805 : containingBlock->containingBlockLogicalWidthForContent(); |
| 797 // Sticky positioned element ignore any override logical width on the | 806 // Sticky positioned element ignore any override logical width on the |
| 798 // containing block, as they don't call containingBlockLogicalWidthForContent. | 807 // containing block, as they don't call containingBlockLogicalWidthForContent. |
| 799 // It's unclear whether this is totally fine. | 808 // It's unclear whether this is totally fine. |
| 800 // Compute the container-relative area within which the sticky element is | 809 // Compute the container-relative area within which the sticky element is |
| 801 // allowed to move. | 810 // allowed to move. |
| 802 LayoutUnit maxWidth = containingBlock->availableLogicalWidth(); | 811 LayoutUnit maxWidth = containingBlock->availableLogicalWidth(); |
| 803 | 812 |
| 804 // Map the containing block to the inner corner of the scroll ancestor without | 813 // Map the containing block to the inner corner of the scroll ancestor without |
| 805 // transforms. | 814 // transforms. |
| 806 FloatRect scrollContainerRelativePaddingBoxRect( | 815 FloatRect scrollContainerRelativePaddingBoxRect( |
| 807 containingBlock->layoutOverflowRect()); | 816 containingBlock->layoutOverflowRect()); |
| 808 FloatSize scrollContainerBorderOffset; | 817 FloatSize scrollContainerBorderOffset; |
| 809 if (scrollAncestor) { | 818 if (scrollAncestor) { |
| 810 scrollContainerBorderOffset = | 819 scrollContainerBorderOffset = |
| 811 FloatSize(scrollAncestor->borderLeft(), scrollAncestor->borderTop()); | 820 FloatSize(scrollAncestor->borderLeft(), scrollAncestor->borderTop()); |
| 812 } | 821 } |
| 813 if (containingBlock != scrollAncestor) { | 822 if (containingBlock != scrollAncestor) { |
| 814 FloatQuad localQuad(FloatRect(containingBlock->paddingBoxRect())); | 823 FloatQuad localQuad(FloatRect(containingBlock->paddingBoxRect())); |
| 815 TransformState transformState(TransformState::ApplyTransformDirection, | |
| 816 localQuad.boundingBox().center(), localQuad); | |
| 817 containingBlock->mapLocalToAncestor(scrollAncestor, transformState, | |
| 818 ApplyContainerFlip); | |
| 819 transformState.flatten(); | |
| 820 scrollContainerRelativePaddingBoxRect = | 824 scrollContainerRelativePaddingBoxRect = |
| 821 transformState.lastPlanarQuad().boundingBox(); | 825 containingBlock |
| 826 ->localToAncestorQuadWithoutTransforms(localQuad, scrollAncestor, |
| 827 flags) |
| 828 .boundingBox(); |
| 822 | 829 |
| 823 // The sticky position constraint rects should be independent of the current | 830 // The sticky position constraint rects should be independent of the current |
| 824 // scroll position, so after mapping we add in the scroll position to get | 831 // scroll position, so after mapping we add in the scroll position to get |
| 825 // the container's position within the ancestor scroller's unscrolled layout | 832 // the container's position within the ancestor scroller's unscrolled layout |
| 826 // overflow. | 833 // overflow. |
| 827 ScrollOffset scrollOffset( | 834 ScrollOffset scrollOffset( |
| 828 scrollAncestor | 835 scrollAncestor |
| 829 ? toFloatSize(scrollAncestor->getScrollableArea()->scrollPosition()) | 836 ? toFloatSize(scrollAncestor->getScrollableArea()->scrollPosition()) |
| 830 : FloatSize()); | 837 : FloatSize()); |
| 831 scrollContainerRelativePaddingBoxRect.move(scrollOffset); | 838 scrollContainerRelativePaddingBoxRect.move(scrollOffset); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 if (rootElementStyle->hasBackground()) | 1352 if (rootElementStyle->hasBackground()) |
| 1346 return false; | 1353 return false; |
| 1347 | 1354 |
| 1348 if (node() != document().firstBodyElement()) | 1355 if (node() != document().firstBodyElement()) |
| 1349 return false; | 1356 return false; |
| 1350 | 1357 |
| 1351 return true; | 1358 return true; |
| 1352 } | 1359 } |
| 1353 | 1360 |
| 1354 } // namespace blink | 1361 } // namespace blink |
| OLD | NEW |