OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 // positioned inline, thus we can't return a LayoutBlock from this function. | 946 // positioned inline, thus we can't return a LayoutBlock from this function. |
947 // | 947 // |
948 // This method is extremely similar to containingBlock(), but with a few | 948 // This method is extremely similar to containingBlock(), but with a few |
949 // notable exceptions. | 949 // notable exceptions. |
950 // (1) For normal flow elements, it just returns the parent. | 950 // (1) For normal flow elements, it just returns the parent. |
951 // (2) For absolute positioned elements, it will return a relative | 951 // (2) For absolute positioned elements, it will return a relative |
952 // positioned inline. containingBlock() simply skips relpositioned inlines | 952 // positioned inline. containingBlock() simply skips relpositioned inlines |
953 // and lets an enclosing block handle the layout of the positioned object. | 953 // and lets an enclosing block handle the layout of the positioned object. |
954 // This does mean that computePositionedLogicalWidth and | 954 // This does mean that computePositionedLogicalWidth and |
955 // computePositionedLogicalHeight have to use container(). | 955 // computePositionedLogicalHeight have to use container(). |
956 // | 956 // (3) For floating object, it returns the nearest ancestor whose |
957 // Note that floating objects don't belong to either of the above exceptions. | 957 // canContainFloatingObject(*this) is true. |
958 // | 958 // |
959 // This function should be used for any invalidation as it would correctly | 959 // This function should be used for any invalidation as it would correctly |
960 // walk the containing block chain. See e.g. markContainerChainForLayout. | 960 // walk the containing block chain. See e.g. markContainerChainForLayout. |
961 // It is also used for correctly sizing absolutely positioned elements | 961 // It is also used for correctly sizing absolutely positioned elements |
962 // (point 3 above). | 962 // (point 3 above). |
963 LayoutObject* container(AncestorSkipInfo* = nullptr) const; | 963 LayoutObject* container(AncestorSkipInfo* = nullptr) const; |
964 // Finds the container as if this object is fixed-position. | 964 // Finds the container as if this object is fixed-position. |
965 LayoutBlock* containerForFixedPosition(AncestorSkipInfo* = nullptr) const; | 965 LayoutBlock* containerForFixedPosition(AncestorSkipInfo* = nullptr) const; |
966 // Finds the containing block as if this object is absolute-position. | 966 // Finds the containing block as if this object is absolute-position. |
967 LayoutBlock* containingBlockForAbsolutePosition( | 967 LayoutBlock* containingBlockForAbsolutePosition( |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 | 1158 |
1159 bool canContainAbsolutePositionObjects() const { | 1159 bool canContainAbsolutePositionObjects() const { |
1160 return m_style->canContainAbsolutePositionObjects() || | 1160 return m_style->canContainAbsolutePositionObjects() || |
1161 canContainFixedPositionObjects(); | 1161 canContainFixedPositionObjects(); |
1162 } | 1162 } |
1163 bool canContainFixedPositionObjects() const { | 1163 bool canContainFixedPositionObjects() const { |
1164 return isLayoutView() || isSVGForeignObject() || | 1164 return isLayoutView() || isSVGForeignObject() || |
1165 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); | 1165 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); |
1166 } | 1166 } |
1167 | 1167 |
| 1168 // A block can contain floating objects. A stacked inline can contain stacked |
| 1169 // floating objects. A floating object's container is the nearest ancestor |
| 1170 // that can contain the object. |
| 1171 bool canContainFloatingObject(const LayoutObject& floating) const { |
| 1172 DCHECK(floating.isFloating()); |
| 1173 return isLayoutBlock() || |
| 1174 (styleRef().isStacked() && floating.styleRef().isStacked()); |
| 1175 } |
| 1176 |
1168 // Convert the given local point to absolute coordinates | 1177 // Convert the given local point to absolute coordinates |
1169 // FIXME: Temporary. If UseTransforms is true, take transforms into account. | 1178 // FIXME: Temporary. If UseTransforms is true, take transforms into account. |
1170 // Eventually localToAbsolute() will always be transform-aware. | 1179 // Eventually localToAbsolute() will always be transform-aware. |
1171 FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), | 1180 FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), |
1172 MapCoordinatesFlags = 0) const; | 1181 MapCoordinatesFlags = 0) const; |
1173 | 1182 |
1174 // If the LayoutBoxModelObject ancestor is non-null, the input point is in the | 1183 // If the LayoutBoxModelObject ancestor is non-null, the input point is in the |
1175 // space of the ancestor. | 1184 // space of the ancestor. |
1176 // Otherwise: | 1185 // Otherwise: |
1177 // If TraverseDocumentBoundaries is specified, the input point is in the | 1186 // If TraverseDocumentBoundaries is specified, the input point is in the |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2709 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
2701 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2710 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
2702 // We don't make object2 an optional parameter so that showLayoutTree | 2711 // We don't make object2 an optional parameter so that showLayoutTree |
2703 // can be called from gdb easily. | 2712 // can be called from gdb easily. |
2704 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2713 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
2705 const blink::LayoutObject* object2); | 2714 const blink::LayoutObject* object2); |
2706 | 2715 |
2707 #endif | 2716 #endif |
2708 | 2717 |
2709 #endif // LayoutObject_h | 2718 #endif // LayoutObject_h |
OLD | NEW |