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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
751 FloatRect constrainingRect = computeStickyConstrainingRect(); | 751 FloatRect constrainingRect = computeStickyConstrainingRect(); |
752 PaintLayerScrollableArea* scrollableArea = ancestorOverflowLayer->getScrolla bleArea(); | 752 PaintLayerScrollableArea* scrollableArea = ancestorOverflowLayer->getScrolla bleArea(); |
753 | 753 |
754 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms). | 754 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms). |
755 // TODO: Force compositing input update if we ask for offset with stale comp ositing inputs. | 755 // TODO: Force compositing input update if we ask for offset with stale comp ositing inputs. |
756 if (!scrollableArea->stickyConstraintsMap().contains(layer())) | 756 if (!scrollableArea->stickyConstraintsMap().contains(layer())) |
757 return LayoutSize(); | 757 return LayoutSize(); |
758 return LayoutSize(scrollableArea->stickyConstraintsMap().get(layer()).comput eStickyOffset(constrainingRect)); | 758 return LayoutSize(scrollableArea->stickyConstraintsMap().get(layer()).comput eStickyOffset(constrainingRect)); |
759 } | 759 } |
760 | 760 |
761 LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToOffsetParent(const L ayoutPoint& startPoint) const | 761 LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToUnclosedOffsetParent (const LayoutPoint& startPoint) const |
762 { | 762 { |
763 // If the element is the HTML body element or doesn't have a parent | 763 // If the element is the HTML body element or doesn't have a parent |
764 // return 0 and stop this algorithm. | 764 // return 0 and stop this algorithm. |
765 if (isBody() || !parent()) | 765 if (isBody() || !parent()) |
766 return LayoutPoint(); | 766 return LayoutPoint(); |
767 | 767 |
768 LayoutPoint referencePoint = startPoint; | 768 LayoutPoint referencePoint = startPoint; |
769 referencePoint.move(parent()->columnOffset(referencePoint)); | 769 referencePoint.move(parent()->columnOffset(referencePoint)); |
770 | 770 |
771 // If the offsetParent of the element is null, or is the HTML body element, | 771 // Calling unclosedOffsetParent() here to skip through non-unclosed (i.e. |
772 // inaccessible in a closed shadow or UA shadow) nodes to get offset parent. | |
773 // If the unclosedOffsetParent of the element is null, | |
772 // return the distance between the canvas origin and the left border edge | 774 // return the distance between the canvas origin and the left border edge |
773 // of the element and stop this algorithm. | 775 // of the element and stop this algorithm. |
774 Element* element = offsetParent(); | 776 Element* element = unclosedOffsetParent(); |
hayato
2016/06/10 01:41:51
Why did you change the behavior of LayoutBoxModelO
kochi
2016/06/10 02:07:49
adjustedPositionRelativeToOffsetParent() is called
| |
775 if (!element) | 777 if (!element) |
776 return referencePoint; | 778 return referencePoint; |
777 | 779 |
778 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { | 780 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { |
779 if (offsetParent->isBox() && !offsetParent->isBody()) | 781 if (offsetParent->isBox() && !offsetParent->isBody()) |
780 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop()); | 782 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop()); |
781 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { | 783 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { |
782 if (isInFlowPositioned()) | 784 if (isInFlowPositioned()) |
783 referencePoint.move(offsetForInFlowPosition()); | 785 referencePoint.move(offsetForInFlowPosition()); |
784 | 786 |
(...skipping 23 matching lines...) Expand all Loading... | |
808 if (isStickyPositioned()) | 810 if (isStickyPositioned()) |
809 return stickyPositionOffset(); | 811 return stickyPositionOffset(); |
810 | 812 |
811 return LayoutSize(); | 813 return LayoutSize(); |
812 } | 814 } |
813 | 815 |
814 LayoutUnit LayoutBoxModelObject::offsetLeft() const | 816 LayoutUnit LayoutBoxModelObject::offsetLeft() const |
815 { | 817 { |
816 // Note that LayoutInline and LayoutBox override this to pass a different | 818 // Note that LayoutInline and LayoutBox override this to pass a different |
817 // startPoint to adjustedPositionRelativeToOffsetParent. | 819 // startPoint to adjustedPositionRelativeToOffsetParent. |
818 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x(); | 820 return adjustedPositionRelativeToUnclosedOffsetParent(LayoutPoint()).x(); |
819 } | 821 } |
820 | 822 |
821 LayoutUnit LayoutBoxModelObject::offsetTop() const | 823 LayoutUnit LayoutBoxModelObject::offsetTop() const |
822 { | 824 { |
823 // Note that LayoutInline and LayoutBox override this to pass a different | 825 // Note that LayoutInline and LayoutBox override this to pass a different |
824 // startPoint to adjustedPositionRelativeToOffsetParent. | 826 // startPoint to adjustedPositionRelativeToOffsetParent. |
825 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y(); | 827 return adjustedPositionRelativeToUnclosedOffsetParent(LayoutPoint()).y(); |
826 } | 828 } |
827 | 829 |
828 int LayoutBoxModelObject::pixelSnappedOffsetWidth() const | 830 int LayoutBoxModelObject::pixelSnappedOffsetWidth() const |
829 { | 831 { |
830 return snapSizeToPixel(offsetWidth(), offsetLeft()); | 832 return snapSizeToPixel(offsetWidth(), offsetLeft()); |
831 } | 833 } |
832 | 834 |
833 int LayoutBoxModelObject::pixelSnappedOffsetHeight() const | 835 int LayoutBoxModelObject::pixelSnappedOffsetHeight() const |
834 { | 836 { |
835 return snapSizeToPixel(offsetHeight(), offsetTop()); | 837 return snapSizeToPixel(offsetHeight(), offsetTop()); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1126 if (rootElementStyle->hasBackground()) | 1128 if (rootElementStyle->hasBackground()) |
1127 return false; | 1129 return false; |
1128 | 1130 |
1129 if (node() != document().firstBodyElement()) | 1131 if (node() != document().firstBodyElement()) |
1130 return false; | 1132 return false; |
1131 | 1133 |
1132 return true; | 1134 return true; |
1133 } | 1135 } |
1134 | 1136 |
1135 } // namespace blink | 1137 } // namespace blink |
OLD | NEW |