Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2196763002: CL for perf try jobs on all perf try bots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CL for perf tryjob on mac Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 FloatRect constrainingRect = computeStickyConstrainingRect(); 761 FloatRect constrainingRect = computeStickyConstrainingRect();
762 PaintLayerScrollableArea* scrollableArea = ancestorOverflowLayer->getScrolla bleArea(); 762 PaintLayerScrollableArea* scrollableArea = ancestorOverflowLayer->getScrolla bleArea();
763 763
764 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms). 764 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms).
765 // TODO: Force compositing input update if we ask for offset with stale comp ositing inputs. 765 // TODO: Force compositing input update if we ask for offset with stale comp ositing inputs.
766 if (!scrollableArea->stickyConstraintsMap().contains(layer())) 766 if (!scrollableArea->stickyConstraintsMap().contains(layer()))
767 return LayoutSize(); 767 return LayoutSize();
768 return LayoutSize(scrollableArea->stickyConstraintsMap().get(layer()).comput eStickyOffset(constrainingRect)); 768 return LayoutSize(scrollableArea->stickyConstraintsMap().get(layer()).comput eStickyOffset(constrainingRect));
769 } 769 }
770 770
771 LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeTo(const LayoutPoint& startPoint, const Element* element) const 771 LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToOffsetParent(const L ayoutPoint& startPoint) const
772 { 772 {
773 // If the element is the HTML body element or doesn't have a parent 773 // If the element is the HTML body element or doesn't have a parent
774 // return 0 and stop this algorithm. 774 // return 0 and stop this algorithm.
775 if (isBody() || !parent()) 775 if (isBody() || !parent())
776 return LayoutPoint(); 776 return LayoutPoint();
777 777
778 LayoutPoint referencePoint = startPoint; 778 LayoutPoint referencePoint = startPoint;
779 referencePoint.move(parent()->columnOffset(referencePoint)); 779 referencePoint.move(parent()->columnOffset(referencePoint));
780 780
781 // If the base element is null, return the distance between the canvas origi n and 781 // If the offsetParent of the element is null, or is the HTML body element,
782 // the left border edge of the element and stop this algorithm. 782 // return the distance between the canvas origin and the left border edge
783 // of the element and stop this algorithm.
784 Element* element = offsetParent();
783 if (!element) 785 if (!element)
784 return referencePoint; 786 return referencePoint;
785 787
786 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { 788 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) {
787 if (offsetParent->isBox() && !offsetParent->isBody()) 789 if (offsetParent->isBox() && !offsetParent->isBody())
788 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop()); 790 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop());
789 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { 791 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
790 if (isInFlowPositioned()) 792 if (isInFlowPositioned())
791 referencePoint.move(offsetForInFlowPosition()); 793 referencePoint.move(offsetForInFlowPosition());
792 794
(...skipping 19 matching lines...) Expand all
812 { 814 {
813 if (isRelPositioned()) 815 if (isRelPositioned())
814 return relativePositionOffset(); 816 return relativePositionOffset();
815 817
816 if (isStickyPositioned()) 818 if (isStickyPositioned())
817 return stickyPositionOffset(); 819 return stickyPositionOffset();
818 820
819 return LayoutSize(); 821 return LayoutSize();
820 } 822 }
821 823
822 LayoutUnit LayoutBoxModelObject::offsetLeft(const Element* parent) const 824 LayoutUnit LayoutBoxModelObject::offsetLeft() const
823 { 825 {
824 // Note that LayoutInline and LayoutBox override this to pass a different 826 // Note that LayoutInline and LayoutBox override this to pass a different
825 // startPoint to adjustedPositionRelativeTo. 827 // startPoint to adjustedPositionRelativeToOffsetParent.
826 return adjustedPositionRelativeTo(LayoutPoint(), parent).x(); 828 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x();
827 } 829 }
828 830
829 LayoutUnit LayoutBoxModelObject::offsetTop(const Element* parent) const 831 LayoutUnit LayoutBoxModelObject::offsetTop() const
830 { 832 {
831 // Note that LayoutInline and LayoutBox override this to pass a different 833 // Note that LayoutInline and LayoutBox override this to pass a different
832 // startPoint to adjustedPositionRelativeTo. 834 // startPoint to adjustedPositionRelativeToOffsetParent.
833 return adjustedPositionRelativeTo(LayoutPoint(), parent).y(); 835 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y();
834 } 836 }
835 837
836 int LayoutBoxModelObject::pixelSnappedOffsetWidth(const Element* parent) const 838 int LayoutBoxModelObject::pixelSnappedOffsetWidth() const
837 { 839 {
838 return snapSizeToPixel(offsetWidth(), offsetLeft(parent)); 840 return snapSizeToPixel(offsetWidth(), offsetLeft());
839 } 841 }
840 842
841 int LayoutBoxModelObject::pixelSnappedOffsetHeight(const Element* parent) const 843 int LayoutBoxModelObject::pixelSnappedOffsetHeight() const
842 { 844 {
843 return snapSizeToPixel(offsetHeight(), offsetTop(parent)); 845 return snapSizeToPixel(offsetHeight(), offsetTop());
844 } 846 }
845 847
846 LayoutUnit LayoutBoxModelObject::computedCSSPadding(const Length& padding) const 848 LayoutUnit LayoutBoxModelObject::computedCSSPadding(const Length& padding) const
847 { 849 {
848 LayoutUnit w; 850 LayoutUnit w;
849 if (padding.hasPercent()) 851 if (padding.hasPercent())
850 w = containingBlockLogicalWidthForContent(); 852 w = containingBlockLogicalWidthForContent();
851 return minimumValueForLength(padding, w); 853 return minimumValueForLength(padding, w);
852 } 854 }
853 855
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 if (rootElementStyle->hasBackground()) 1136 if (rootElementStyle->hasBackground())
1135 return false; 1137 return false;
1136 1138
1137 if (node() != document().firstBodyElement()) 1139 if (node() != document().firstBodyElement())
1138 return false; 1140 return false;
1139 1141
1140 return true; 1142 return true;
1141 } 1143 }
1142 1144
1143 } // namespace blink 1145 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutInline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698