Chromium Code Reviews| 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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 892 bool behavesLikeBlockContainer() const { | 892 bool behavesLikeBlockContainer() const { |
| 893 return isLayoutBlockFlow() || isLayoutButton(); | 893 return isLayoutBlockFlow() || isLayoutButton(); |
| 894 } | 894 } |
| 895 | 895 |
| 896 // This function returns the containing block of the object. | 896 // This function returns the containing block of the object. |
| 897 // Due to CSS being inconsistent, a containing block can be a relatively | 897 // Due to CSS being inconsistent, a containing block can be a relatively |
| 898 // positioned inline, thus we can't return a LayoutBlock from this function. | 898 // positioned inline, thus we can't return a LayoutBlock from this function. |
| 899 // | 899 // |
| 900 // This method is extremely similar to containingBlock(), but with a few | 900 // This method is extremely similar to containingBlock(), but with a few |
| 901 // notable exceptions. | 901 // notable exceptions. |
| 902 // (1) It can be used on orphaned subtrees, i.e., it can be called safely | 902 // (1) For normal flow elements, it just returns the parent. |
| 903 // even when the object is not part of the primary document subtree yet. | 903 // (2) For absolute positioned elements, it will return a relative |
| 904 // (2) For normal flow elements, it just returns the parent. | |
| 905 // (3) For absolute positioned elements, it will return a relative | |
| 906 // positioned inline. containingBlock() simply skips relpositioned inlines | 904 // positioned inline. containingBlock() simply skips relpositioned inlines |
| 907 // and lets an enclosing block handle the layout of the positioned object. | 905 // and lets an enclosing block handle the layout of the positioned object. |
| 908 // This does mean that computePositionedLogicalWidth and | 906 // This does mean that computePositionedLogicalWidth and |
| 909 // computePositionedLogicalHeight have to use container(). | 907 // computePositionedLogicalHeight have to use container(). |
| 910 // | 908 // |
| 909 // Note that floating objects don't belong to either of the above exceptions. | |
| 910 // | |
| 911 // This function should be used for any invalidation as it would correctly | 911 // This function should be used for any invalidation as it would correctly |
| 912 // walk the containing block chain. See e.g. markContainerChainForLayout. | 912 // walk the containing block chain. See e.g. markContainerChainForLayout. |
| 913 // It is also used for correctly sizing absolutely positioned elements | 913 // It is also used for correctly sizing absolutely positioned elements |
| 914 // (point 3 above). | 914 // (point 3 above). |
| 915 // | 915 // |
| 916 // If |ancestor| and |ancestorSkipped| are not null, on return | 916 // If |ancestor| and |ancestorSkipped| are not null, on return |
| 917 // *ancestorSkipped is true if the layoutObject returned is an ancestor of | 917 // *ancestorSkipped is true if the layoutObject returned is an ancestor of |
| 918 // |ancestor|. | 918 // |ancestor|. |
| 919 LayoutObject* container(const LayoutBoxModelObject* ancestor = nullptr, | 919 LayoutObject* container(const LayoutBoxModelObject* ancestor = nullptr, |
| 920 bool* ancestorSkipped = nullptr, | 920 bool* ancestorSkipped = nullptr, |
| 921 bool* filterSkipped = nullptr) const; | 921 bool* filterSkipped = nullptr) const; |
| 922 // Finds the container as if this object is fixed-position. | 922 // Finds the container as if this object is fixed-position. |
| 923 LayoutBlock* containerForFixedPosition( | 923 LayoutBlock* containerForFixedPosition( |
| 924 const LayoutBoxModelObject* ancestor = nullptr, | 924 const LayoutBoxModelObject* ancestor = nullptr, |
| 925 bool* ancestorSkipped = nullptr, | 925 bool* ancestorSkipped = nullptr, |
| 926 bool* filterSkipped = nullptr) const; | 926 bool* filterSkipped = nullptr) const; |
| 927 // Finds the containing block as if this object is absolute-position. | 927 // Finds the containing block as if this object is absolute-position. |
| 928 LayoutBlock* containingBlockForAbsolutePosition() const; | 928 LayoutBlock* containingBlockForAbsolutePosition( |
| 929 const LayoutBoxModelObject* ancestor = nullptr, | |
| 930 bool* ancestorSkipped = nullptr, | |
| 931 bool* filterSkipped = nullptr) const; | |
| 929 | 932 |
| 930 virtual LayoutObject* hoverAncestor() const { return parent(); } | 933 virtual LayoutObject* hoverAncestor() const { return parent(); } |
| 931 | 934 |
| 932 Element* offsetParent(const Element* = nullptr) const; | 935 Element* offsetParent(const Element* = nullptr) const; |
| 933 | 936 |
| 934 void markContainerChainForLayout(bool scheduleRelayout = true, | 937 void markContainerChainForLayout(bool scheduleRelayout = true, |
| 935 SubtreeLayoutScope* = nullptr); | 938 SubtreeLayoutScope* = nullptr); |
| 936 void setNeedsLayout(LayoutInvalidationReasonForTracing, | 939 void setNeedsLayout(LayoutInvalidationReasonForTracing, |
| 937 MarkingBehavior = MarkContainerChain, | 940 MarkingBehavior = MarkContainerChain, |
| 938 SubtreeLayoutScope* = nullptr); | 941 SubtreeLayoutScope* = nullptr); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1107 // non-anonymous LayoutBlock. | 1110 // non-anonymous LayoutBlock. |
| 1108 // Note that in the previous examples, the returned LayoutBlock has no | 1111 // Note that in the previous examples, the returned LayoutBlock has no |
| 1109 // logical relationship to the original element. | 1112 // logical relationship to the original element. |
| 1110 // | 1113 // |
| 1111 // LayoutBlocks are the one that handle laying out positioned elements, | 1114 // LayoutBlocks are the one that handle laying out positioned elements, |
| 1112 // thus this function is important during layout, to insert the positioned | 1115 // thus this function is important during layout, to insert the positioned |
| 1113 // elements into the correct LayoutBlock. | 1116 // elements into the correct LayoutBlock. |
| 1114 // | 1117 // |
| 1115 // See container() for the function that returns the containing block. | 1118 // See container() for the function that returns the containing block. |
| 1116 // See LayoutBlock.h for some extra explanations on containing blocks. | 1119 // See LayoutBlock.h for some extra explanations on containing blocks. |
| 1117 LayoutBlock* containingBlock() const; | 1120 LayoutBlock* containingBlock(const LayoutBoxModelObject* ancestor = nullptr, |
|
mstensho (USE GERRIT)
2017/01/05 10:31:30
How about a struct that holds these three variable
Xianzhu
2017/01/06 00:42:35
Sounds good. Would like to address this in a follo
| |
| 1121 bool* ancestorSkipped = nullptr, | |
| 1122 bool* filterSkipped = nullptr) const; | |
| 1118 | 1123 |
| 1119 bool canContainAbsolutePositionObjects() const { | 1124 bool canContainAbsolutePositionObjects() const { |
| 1120 return m_style->canContainAbsolutePositionObjects() || | 1125 return m_style->canContainAbsolutePositionObjects() || |
| 1121 canContainFixedPositionObjects(); | 1126 canContainFixedPositionObjects(); |
| 1122 } | 1127 } |
| 1123 bool canContainFixedPositionObjects() const { | 1128 bool canContainFixedPositionObjects() const { |
| 1124 return isLayoutView() || isSVGForeignObject() || | 1129 return isLayoutView() || isSVGForeignObject() || |
| 1125 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); | 1130 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); |
| 1126 } | 1131 } |
| 1127 | 1132 |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2671 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2676 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
| 2672 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2677 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
| 2673 // We don't make object2 an optional parameter so that showLayoutTree | 2678 // We don't make object2 an optional parameter so that showLayoutTree |
| 2674 // can be called from gdb easily. | 2679 // can be called from gdb easily. |
| 2675 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2680 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
| 2676 const blink::LayoutObject* object2); | 2681 const blink::LayoutObject* object2); |
| 2677 | 2682 |
| 2678 #endif | 2683 #endif |
| 2679 | 2684 |
| 2680 #endif // LayoutObject_h | 2685 #endif // LayoutObject_h |
| OLD | NEW |