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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: 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(
790 scrollAncestor->getScrollableArea()->offsetFromOrigin()) 790 scrollAncestor->getScrollableArea()->absolutePosition())
791 : FloatSize()); 791 : FloatSize());
792 scrollContainerRelativePaddingBoxRect.move(scrollOffset); 792 scrollContainerRelativePaddingBoxRect.move(scrollOffset);
793 } 793 }
794 794
795 LayoutRect scrollContainerRelativeContainingBlockRect( 795 LayoutRect scrollContainerRelativeContainingBlockRect(
796 scrollContainerRelativePaddingBoxRect); 796 scrollContainerRelativePaddingBoxRect);
797 // This is removing the padding of the containing block's overflow rect to get the flow 797 // 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 798 // 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 799 // 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). 800 // 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 901
902 FloatRect LayoutBoxModelObject::computeStickyConstrainingRect() const { 902 FloatRect LayoutBoxModelObject::computeStickyConstrainingRect() const {
903 if (layer()->ancestorOverflowLayer()->isRootLayer()) 903 if (layer()->ancestorOverflowLayer()->isRootLayer())
904 return view()->frameView()->visibleContentRect(); 904 return view()->frameView()->visibleContentRect();
905 905
906 LayoutBox* enclosingClippingBox = 906 LayoutBox* enclosingClippingBox =
907 toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject()); 907 toLayoutBox(layer()->ancestorOverflowLayer()->layoutObject());
908 FloatRect constrainingRect; 908 FloatRect constrainingRect;
909 constrainingRect = 909 constrainingRect =
910 FloatRect(enclosingClippingBox->overflowClipRect(LayoutPoint(DoublePoint( 910 FloatRect(enclosingClippingBox->overflowClipRect(LayoutPoint(DoublePoint(
911 enclosingClippingBox->getScrollableArea()->offsetFromOrigin())))); 911 enclosingClippingBox->getScrollableArea()->absolutePosition()))));
912 constrainingRect.move(enclosingClippingBox->paddingLeft(), 912 constrainingRect.move(enclosingClippingBox->paddingLeft(),
913 enclosingClippingBox->paddingTop()); 913 enclosingClippingBox->paddingTop());
914 constrainingRect.contract( 914 constrainingRect.contract(
915 FloatSize(enclosingClippingBox->paddingLeft() + 915 FloatSize(enclosingClippingBox->paddingLeft() +
916 enclosingClippingBox->paddingRight(), 916 enclosingClippingBox->paddingRight(),
917 enclosingClippingBox->paddingTop() + 917 enclosingClippingBox->paddingTop() +
918 enclosingClippingBox->paddingBottom())); 918 enclosingClippingBox->paddingBottom()));
919 return constrainingRect; 919 return constrainingRect;
920 } 920 }
921 921
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 if (rootElementStyle->hasBackground()) 1328 if (rootElementStyle->hasBackground())
1329 return false; 1329 return false;
1330 1330
1331 if (node() != document().firstBodyElement()) 1331 if (node() != document().firstBodyElement())
1332 return false; 1332 return false;
1333 1333
1334 return true; 1334 return true;
1335 } 1335 }
1336 1336
1337 } // namespace blink 1337 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698