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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 localQuad.boundingBox().center(), localQuad); 777 localQuad.boundingBox().center(), localQuad);
778 containingBlock->mapLocalToAncestor(scrollAncestor, transformState, 778 containingBlock->mapLocalToAncestor(scrollAncestor, transformState,
779 ApplyContainerFlip); 779 ApplyContainerFlip);
780 transformState.flatten(); 780 transformState.flatten();
781 scrollContainerRelativePaddingBoxRect = 781 scrollContainerRelativePaddingBoxRect =
782 transformState.lastPlanarQuad().boundingBox(); 782 transformState.lastPlanarQuad().boundingBox();
783 783
784 // The sticky position constraint rects should be independent of the current scroll position, so after 784 // The sticky position constraint rects should be independent of the current scroll position, so after
785 // mapping we add in the scroll position to get the container's position wit hin the ancestor scroller's 785 // mapping we add in the scroll position to get the container's position wit hin the ancestor scroller's
786 // unscrolled layout overflow. 786 // unscrolled layout overflow.
787 FloatSize scrollOffset( 787 ScrollOffset scrollOffset(
788 scrollAncestor 788 scrollAncestor
789 ? toFloatSize( 789 ? toFloatSize(scrollAncestor->getScrollableArea()->scrollPosition())
790 scrollAncestor->getScrollableArea()->adjustedScrollOffset())
791 : FloatSize()); 790 : FloatSize());
792 scrollContainerRelativePaddingBoxRect.move(scrollOffset); 791 scrollContainerRelativePaddingBoxRect.move(scrollOffset);
793 } 792 }
794 793
795 LayoutRect scrollContainerRelativeContainingBlockRect( 794 LayoutRect scrollContainerRelativeContainingBlockRect(
796 scrollContainerRelativePaddingBoxRect); 795 scrollContainerRelativePaddingBoxRect);
797 // This is removing the padding of the containing block's overflow rect to get the flow 796 // This is removing the padding of the containing block's overflow rect to get the flow
798 // box rectangle and removing the margin of the sticky element to ensure that space between 797 // box rectangle and removing the margin of the sticky element to ensure that space between
799 // the sticky element and its containing flow box. It is an open issue whether the margin 798 // the sticky element and its containing flow box. It is an open issue whether the margin
800 // should collapse (See https://www.w3.org/TR/css-position-3/#sticky-pos). 799 // should collapse (See https://www.w3.org/TR/css-position-3/#sticky-pos).
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 900
902 FloatRect LayoutBoxModelObject::computeStickyConstrainingRect() const { 901 FloatRect LayoutBoxModelObject::computeStickyConstrainingRect() const {
903 if (layer()->ancestorOverflowLayer()->isRootLayer()) 902 if (layer()->ancestorOverflowLayer()->isRootLayer())
904 return view()->frameView()->visibleContentRect(); 903 return view()->frameView()->visibleContentRect();
905 904
906 LayoutBox* enclosingClippingBox = 905 LayoutBox* enclosingClippingBox =
907 toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject()); 906 toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject());
908 FloatRect constrainingRect; 907 FloatRect constrainingRect;
909 constrainingRect = 908 constrainingRect =
910 FloatRect(enclosingClippingBox->overflowClipRect(LayoutPoint(DoublePoint( 909 FloatRect(enclosingClippingBox->overflowClipRect(LayoutPoint(DoublePoint(
911 enclosingClippingBox->getScrollableArea()->adjustedScrollOffset())))); 910 enclosingClippingBox->getScrollableArea()->scrollPosition()))));
912 constrainingRect.move(enclosingClippingBox->paddingLeft(), 911 constrainingRect.move(enclosingClippingBox->paddingLeft(),
913 enclosingClippingBox->paddingTop()); 912 enclosingClippingBox->paddingTop());
914 constrainingRect.contract( 913 constrainingRect.contract(
915 FloatSize(enclosingClippingBox->paddingLeft() + 914 FloatSize(enclosingClippingBox->paddingLeft() +
916 enclosingClippingBox->paddingRight(), 915 enclosingClippingBox->paddingRight(),
917 enclosingClippingBox->paddingTop() + 916 enclosingClippingBox->paddingTop() +
918 enclosingClippingBox->paddingBottom())); 917 enclosingClippingBox->paddingBottom()));
919 return constrainingRect; 918 return constrainingRect;
920 } 919 }
921 920
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 if (rootElementStyle->hasBackground()) 1327 if (rootElementStyle->hasBackground())
1329 return false; 1328 return false;
1330 1329
1331 if (node() != document().firstBodyElement()) 1330 if (node() != document().firstBodyElement())
1332 return false; 1331 return false;
1333 1332
1334 return true; 1333 return true;
1335 } 1334 }
1336 1335
1337 } // namespace blink 1336 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698