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

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

Issue 2788053002: Fix sticky bottom is not applied with both sticky position (Closed)
Patch Set: Created 3 years, 8 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 LayoutUnit horizontalOffsets = 992 LayoutUnit horizontalOffsets =
993 minimumValueForLength(style()->right(), 993 minimumValueForLength(style()->right(),
994 LayoutUnit(constrainingSize.width())) + 994 LayoutUnit(constrainingSize.width())) +
995 minimumValueForLength(style()->left(), 995 minimumValueForLength(style()->left(),
996 LayoutUnit(constrainingSize.width())); 996 LayoutUnit(constrainingSize.width()));
997 bool skipRight = false; 997 bool skipRight = false;
998 bool skipLeft = false; 998 bool skipLeft = false;
999 if (!style()->left().isAuto() && !style()->right().isAuto()) { 999 if (!style()->left().isAuto() && !style()->right().isAuto()) {
1000 if (horizontalOffsets > 1000 if (horizontalOffsets >
1001 scrollContainerRelativeContainingBlockRect.width() || 1001 scrollContainerRelativeContainingBlockRect.width() ||
1002 horizontalOffsets + scrollContainerRelativeContainingBlockRect.width() > 1002 horizontalOffsets + stickyBoxRect.width() > constrainingSize.width()) {
1003 constrainingSize.width()) {
1004 skipRight = style()->isLeftToRightDirection(); 1003 skipRight = style()->isLeftToRightDirection();
1005 skipLeft = !skipRight; 1004 skipLeft = !skipRight;
1006 } 1005 }
1007 } 1006 }
1008 1007
1009 if (!style()->left().isAuto() && !skipLeft) { 1008 if (!style()->left().isAuto() && !skipLeft) {
1010 constraints.setLeftOffset(minimumValueForLength( 1009 constraints.setLeftOffset(minimumValueForLength(
1011 style()->left(), LayoutUnit(constrainingSize.width()))); 1010 style()->left(), LayoutUnit(constrainingSize.width())));
1012 constraints.addAnchorEdge( 1011 constraints.addAnchorEdge(
1013 StickyPositionScrollingConstraints::AnchorEdgeLeft); 1012 StickyPositionScrollingConstraints::AnchorEdgeLeft);
(...skipping 10 matching lines...) Expand all
1024 // TODO(flackr): Exclude top or bottom edge offset depending on the writing 1023 // TODO(flackr): Exclude top or bottom edge offset depending on the writing
1025 // mode when related sections are fixed in spec. 1024 // mode when related sections are fixed in spec.
1026 // See http://lists.w3.org/Archives/Public/www-style/2014May/0286.html 1025 // See http://lists.w3.org/Archives/Public/www-style/2014May/0286.html
1027 LayoutUnit verticalOffsets = 1026 LayoutUnit verticalOffsets =
1028 minimumValueForLength(style()->top(), 1027 minimumValueForLength(style()->top(),
1029 LayoutUnit(constrainingSize.height())) + 1028 LayoutUnit(constrainingSize.height())) +
1030 minimumValueForLength(style()->bottom(), 1029 minimumValueForLength(style()->bottom(),
1031 LayoutUnit(constrainingSize.height())); 1030 LayoutUnit(constrainingSize.height()));
1032 if (!style()->top().isAuto() && !style()->bottom().isAuto()) { 1031 if (!style()->top().isAuto() && !style()->bottom().isAuto()) {
1033 if (verticalOffsets > scrollContainerRelativeContainingBlockRect.height() || 1032 if (verticalOffsets > scrollContainerRelativeContainingBlockRect.height() ||
1034 verticalOffsets + scrollContainerRelativeContainingBlockRect.height() > 1033 verticalOffsets + stickyBoxRect.height() > constrainingSize.height()) {
1035 constrainingSize.height()) {
1036 skipBottom = true; 1034 skipBottom = true;
1037 } 1035 }
1038 } 1036 }
1039 1037
1040 if (!style()->top().isAuto()) { 1038 if (!style()->top().isAuto()) {
1041 constraints.setTopOffset(minimumValueForLength( 1039 constraints.setTopOffset(minimumValueForLength(
1042 style()->top(), LayoutUnit(constrainingSize.height()))); 1040 style()->top(), LayoutUnit(constrainingSize.height())));
1043 constraints.addAnchorEdge( 1041 constraints.addAnchorEdge(
1044 StickyPositionScrollingConstraints::AnchorEdgeTop); 1042 StickyPositionScrollingConstraints::AnchorEdgeTop);
1045 } 1043 }
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 if (rootElementStyle->hasBackground()) 1463 if (rootElementStyle->hasBackground())
1466 return false; 1464 return false;
1467 1465
1468 if (node() != document().firstBodyElement()) 1466 if (node() != document().firstBodyElement())
1469 return false; 1467 return false;
1470 1468
1471 return true; 1469 return true;
1472 } 1470 }
1473 1471
1474 } // namespace blink 1472 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698