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 15 matching lines...) Expand all Loading... |
26 #include "core/layout/LayoutBoxModelObject.h" | 26 #include "core/layout/LayoutBoxModelObject.h" |
27 | 27 |
28 #include "core/frame/FrameView.h" | 28 #include "core/frame/FrameView.h" |
29 #include "core/frame/LocalFrame.h" | 29 #include "core/frame/LocalFrame.h" |
30 #include "core/html/HTMLBodyElement.h" | 30 #include "core/html/HTMLBodyElement.h" |
31 #include "core/layout/ImageQualityController.h" | 31 #include "core/layout/ImageQualityController.h" |
32 #include "core/layout/LayoutBlock.h" | 32 #include "core/layout/LayoutBlock.h" |
33 #include "core/layout/LayoutFlexibleBox.h" | 33 #include "core/layout/LayoutFlexibleBox.h" |
34 #include "core/layout/LayoutGeometryMap.h" | 34 #include "core/layout/LayoutGeometryMap.h" |
35 #include "core/layout/LayoutInline.h" | 35 #include "core/layout/LayoutInline.h" |
| 36 #include "core/layout/LayoutTableCell.h" |
36 #include "core/layout/LayoutView.h" | 37 #include "core/layout/LayoutView.h" |
37 #include "core/layout/compositing/CompositedLayerMapping.h" | 38 #include "core/layout/compositing/CompositedLayerMapping.h" |
38 #include "core/layout/compositing/PaintLayerCompositor.h" | 39 #include "core/layout/compositing/PaintLayerCompositor.h" |
39 #include "core/paint/ObjectPaintInvalidator.h" | 40 #include "core/paint/ObjectPaintInvalidator.h" |
40 #include "core/paint/PaintLayer.h" | 41 #include "core/paint/PaintLayer.h" |
41 #include "core/style/ShadowList.h" | 42 #include "core/style/ShadowList.h" |
42 #include "platform/LengthFunctions.h" | 43 #include "platform/LengthFunctions.h" |
43 #include "platform/geometry/TransformState.h" | 44 #include "platform/geometry/TransformState.h" |
44 #include "platform/scroll/MainThreadScrollingReason.h" | 45 #include "platform/scroll/MainThreadScrollingReason.h" |
45 #include "wtf/PtrUtil.h" | 46 #include "wtf/PtrUtil.h" |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 sticky_location -= container_border_offset; | 982 sticky_location -= container_border_offset; |
982 constraints.SetScrollContainerRelativeStickyBoxRect( | 983 constraints.SetScrollContainerRelativeStickyBoxRect( |
983 FloatRect(scroll_container_relative_padding_box_rect.Location() + | 984 FloatRect(scroll_container_relative_padding_box_rect.Location() + |
984 ToFloatSize(sticky_location), | 985 ToFloatSize(sticky_location), |
985 flipped_sticky_box_rect.size())); | 986 flipped_sticky_box_rect.size())); |
986 | 987 |
987 // To correctly compute the offsets, the constraints need to know about any | 988 // To correctly compute the offsets, the constraints need to know about any |
988 // nested position:sticky elements between themselves and their | 989 // nested position:sticky elements between themselves and their |
989 // containingBlock, and between the containingBlock and their scrollAncestor. | 990 // containingBlock, and between the containingBlock and their scrollAncestor. |
990 // | 991 // |
991 // The respective search ranges are [container, containingBlock) and | 992 // The respective search ranges are [locationContainer, containingBlock) and |
992 // [containingBlock, scrollAncestor). | 993 // [containingBlock, scrollAncestor). |
| 994 |
| 995 // Table cells are a special case; Blink ignores them for locationContainer() |
| 996 // purposes, but their sticky offset does affect descendant sticky objects. |
| 997 // TODO(smcgruer): Remove cell override once Blink supports the correct |
| 998 // locationContainer for CSS 3. |
| 999 LayoutObject* location_container_for_sticky = |
| 1000 IsTableCell() ? ToLayoutTableCell(this)->Row() : location_container; |
| 1001 |
993 constraints.SetNearestStickyBoxShiftingStickyBox( | 1002 constraints.SetNearestStickyBoxShiftingStickyBox( |
994 FindFirstStickyBetween(location_container, containing_block)); | 1003 FindFirstStickyBetween(location_container_for_sticky, containing_block)); |
| 1004 |
995 // We cannot use |scrollAncestor| here as it disregards the root | 1005 // We cannot use |scrollAncestor| here as it disregards the root |
996 // ancestorOverflowLayer(), which we should include. | 1006 // ancestorOverflowLayer(), which we should include. |
997 constraints.SetNearestStickyBoxShiftingContainingBlock(FindFirstStickyBetween( | 1007 constraints.SetNearestStickyBoxShiftingContainingBlock(FindFirstStickyBetween( |
998 containing_block, &Layer()->AncestorOverflowLayer()->GetLayoutObject())); | 1008 containing_block, &Layer()->AncestorOverflowLayer()->GetLayoutObject())); |
999 | 1009 |
1000 // We skip the right or top sticky offset if there is not enough space to | 1010 // We skip the right or top sticky offset if there is not enough space to |
1001 // honor both the left/right or top/bottom offsets. | 1011 // honor both the left/right or top/bottom offsets. |
1002 LayoutUnit horizontal_offsets = | 1012 LayoutUnit horizontal_offsets = |
1003 MinimumValueForLength(Style()->Right(), | 1013 MinimumValueForLength(Style()->Right(), |
1004 LayoutUnit(constraining_size.Width())) + | 1014 LayoutUnit(constraining_size.Width())) + |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 if (root_element_style->HasBackground()) | 1489 if (root_element_style->HasBackground()) |
1480 return false; | 1490 return false; |
1481 | 1491 |
1482 if (GetNode() != GetDocument().FirstBodyElement()) | 1492 if (GetNode() != GetDocument().FirstBodyElement()) |
1483 return false; | 1493 return false; |
1484 | 1494 |
1485 return true; | 1495 return true; |
1486 } | 1496 } |
1487 | 1497 |
1488 } // namespace blink | 1498 } // namespace blink |
OLD | NEW |