| 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 } | 767 } |
| 768 | 768 |
| 769 void LayoutBoxModelObject::updateStickyPositionConstraints() const { | 769 void LayoutBoxModelObject::updateStickyPositionConstraints() const { |
| 770 const FloatSize constrainingSize = computeStickyConstrainingRect().size(); | 770 const FloatSize constrainingSize = computeStickyConstrainingRect().size(); |
| 771 | 771 |
| 772 PaintLayerScrollableArea* scrollableArea = | 772 PaintLayerScrollableArea* scrollableArea = |
| 773 layer()->ancestorOverflowLayer()->getScrollableArea(); | 773 layer()->ancestorOverflowLayer()->getScrollableArea(); |
| 774 StickyPositionScrollingConstraints constraints; | 774 StickyPositionScrollingConstraints constraints; |
| 775 FloatSize skippedContainersOffset; | 775 FloatSize skippedContainersOffset; |
| 776 LayoutBlock* containingBlock = this->containingBlock(); | 776 LayoutBlock* containingBlock = this->containingBlock(); |
| 777 // The location container for boxes is not always the containing block. |
| 778 LayoutBox* locationContainer = isLayoutInline() |
| 779 ? containingBlock |
| 780 : toLayoutBox(this)->locationContainer(); |
| 777 // Skip anonymous containing blocks. | 781 // Skip anonymous containing blocks. |
| 778 while (containingBlock->isAnonymous()) { | 782 while (containingBlock->isAnonymous()) { |
| 779 skippedContainersOffset += | |
| 780 toFloatSize(FloatPoint(containingBlock->frameRect().location())); | |
| 781 containingBlock = containingBlock->containingBlock(); | 783 containingBlock = containingBlock->containingBlock(); |
| 782 } | 784 } |
| 785 MapCoordinatesFlags flags = 0; |
| 786 skippedContainersOffset = |
| 787 toFloatSize(locationContainer |
| 788 ->localToAncestorQuadWithoutTransforms( |
| 789 FloatQuad(), containingBlock, flags) |
| 790 .boundingBox() |
| 791 .location()); |
| 783 LayoutBox* scrollAncestor = | 792 LayoutBox* scrollAncestor = |
| 784 layer()->ancestorOverflowLayer()->isRootLayer() | 793 layer()->ancestorOverflowLayer()->isRootLayer() |
| 785 ? nullptr | 794 ? nullptr |
| 786 : toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject()); | 795 : toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject()); |
| 787 | 796 |
| 788 LayoutUnit maxContainerWidth = | 797 LayoutUnit maxContainerWidth = |
| 789 containingBlock->isLayoutView() | 798 containingBlock->isLayoutView() |
| 790 ? containingBlock->logicalWidth() | 799 ? containingBlock->logicalWidth() |
| 791 : containingBlock->containingBlockLogicalWidthForContent(); | 800 : containingBlock->containingBlockLogicalWidthForContent(); |
| 792 // Sticky positioned element ignore any override logical width on the | 801 // Sticky positioned element ignore any override logical width on the |
| 793 // containing block, as they don't call containingBlockLogicalWidthForContent. | 802 // containing block, as they don't call containingBlockLogicalWidthForContent. |
| 794 // It's unclear whether this is totally fine. | 803 // It's unclear whether this is totally fine. |
| 795 // Compute the container-relative area within which the sticky element is | 804 // Compute the container-relative area within which the sticky element is |
| 796 // allowed to move. | 805 // allowed to move. |
| 797 LayoutUnit maxWidth = containingBlock->availableLogicalWidth(); | 806 LayoutUnit maxWidth = containingBlock->availableLogicalWidth(); |
| 798 | 807 |
| 799 // Map the containing block to the inner corner of the scroll ancestor without | 808 // Map the containing block to the inner corner of the scroll ancestor without |
| 800 // transforms. | 809 // transforms. |
| 801 FloatRect scrollContainerRelativePaddingBoxRect( | 810 FloatRect scrollContainerRelativePaddingBoxRect( |
| 802 containingBlock->layoutOverflowRect()); | 811 containingBlock->layoutOverflowRect()); |
| 803 FloatSize scrollContainerBorderOffset; | 812 FloatSize scrollContainerBorderOffset; |
| 804 if (scrollAncestor) { | 813 if (scrollAncestor) { |
| 805 scrollContainerBorderOffset = | 814 scrollContainerBorderOffset = |
| 806 FloatSize(scrollAncestor->borderLeft(), scrollAncestor->borderTop()); | 815 FloatSize(scrollAncestor->borderLeft(), scrollAncestor->borderTop()); |
| 807 } | 816 } |
| 808 if (containingBlock != scrollAncestor) { | 817 if (containingBlock != scrollAncestor) { |
| 809 FloatQuad localQuad(FloatRect(containingBlock->paddingBoxRect())); | 818 FloatQuad localQuad(FloatRect(containingBlock->paddingBoxRect())); |
| 810 TransformState transformState(TransformState::ApplyTransformDirection, | |
| 811 localQuad.boundingBox().center(), localQuad); | |
| 812 containingBlock->mapLocalToAncestor(scrollAncestor, transformState, | |
| 813 ApplyContainerFlip); | |
| 814 transformState.flatten(); | |
| 815 scrollContainerRelativePaddingBoxRect = | 819 scrollContainerRelativePaddingBoxRect = |
| 816 transformState.lastPlanarQuad().boundingBox(); | 820 containingBlock |
| 821 ->localToAncestorQuadWithoutTransforms(localQuad, scrollAncestor, |
| 822 flags) |
| 823 .boundingBox(); |
| 817 | 824 |
| 818 // The sticky position constraint rects should be independent of the current | 825 // The sticky position constraint rects should be independent of the current |
| 819 // scroll position, so after mapping we add in the scroll position to get | 826 // scroll position, so after mapping we add in the scroll position to get |
| 820 // the container's position within the ancestor scroller's unscrolled layout | 827 // the container's position within the ancestor scroller's unscrolled layout |
| 821 // overflow. | 828 // overflow. |
| 822 ScrollOffset scrollOffset( | 829 ScrollOffset scrollOffset( |
| 823 scrollAncestor | 830 scrollAncestor |
| 824 ? toFloatSize(scrollAncestor->getScrollableArea()->scrollPosition()) | 831 ? toFloatSize(scrollAncestor->getScrollableArea()->scrollPosition()) |
| 825 : FloatSize()); | 832 : FloatSize()); |
| 826 scrollContainerRelativePaddingBoxRect.move(scrollOffset); | 833 scrollContainerRelativePaddingBoxRect.move(scrollOffset); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 if (rootElementStyle->hasBackground()) | 1347 if (rootElementStyle->hasBackground()) |
| 1341 return false; | 1348 return false; |
| 1342 | 1349 |
| 1343 if (node() != document().firstBodyElement()) | 1350 if (node() != document().firstBodyElement()) |
| 1344 return false; | 1351 return false; |
| 1345 | 1352 |
| 1346 return true; | 1353 return true; |
| 1347 } | 1354 } |
| 1348 | 1355 |
| 1349 } // namespace blink | 1356 } // namespace blink |
| OLD | NEW |