 Chromium Code Reviews
 Chromium Code Reviews Issue 2575423003:
  Fix geometry mapping issues for float under inline  (Closed)
    
  
    Issue 2575423003:
  Fix geometry mapping issues for float under inline  (Closed) 
  | 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 } | 889 } | 
| 890 | 890 | 
| 891 // This function returns the containing block of the object. | 891 // This function returns the containing block of the object. | 
| 892 // Due to CSS being inconsistent, a containing block can be a relatively | 892 // Due to CSS being inconsistent, a containing block can be a relatively | 
| 893 // positioned inline, thus we can't return a LayoutBlock from this function. | 893 // positioned inline, thus we can't return a LayoutBlock from this function. | 
| 894 // | 894 // | 
| 895 // This method is extremely similar to containingBlock(), but with a few | 895 // This method is extremely similar to containingBlock(), but with a few | 
| 896 // notable exceptions. | 896 // notable exceptions. | 
| 897 // (1) It can be used on orphaned subtrees, i.e., it can be called safely | 897 // (1) It can be used on orphaned subtrees, i.e., it can be called safely | 
| 898 // even when the object is not part of the primary document subtree yet. | 898 // even when the object is not part of the primary document subtree yet. | 
| 899 // (2) For normal flow elements, it just returns the parent. | 899 // (2) For normal flow elements except for floating objects, it just returns | 
| 
Xianzhu
2016/12/16 20:06:42
Based on https://www.w3.org/TR/CSS2/visuren.html#p
 | |
| 900 // the parent. | |
| 900 // (3) For absolute positioned elements, it will return a relative | 901 // (3) For absolute positioned elements, it will return a relative | 
| 901 // positioned inline. containingBlock() simply skips relpositioned inlines | 902 // positioned inline. containingBlock() simply skips relpositioned inlines | 
| 902 // and lets an enclosing block handle the layout of the positioned object. | 903 // and lets an enclosing block handle the layout of the positioned object. | 
| 903 // This does mean that computePositionedLogicalWidth and | 904 // This does mean that computePositionedLogicalWidth and | 
| 904 // computePositionedLogicalHeight have to use container(). | 905 // computePositionedLogicalHeight have to use container(). | 
| 905 // | 906 // | 
| 906 // This function should be used for any invalidation as it would correctly | 907 // This function should be used for any invalidation as it would correctly | 
| 907 // walk the containing block chain. See e.g. markContainerChainForLayout. | 908 // walk the containing block chain. See e.g. markContainerChainForLayout. | 
| 908 // It is also used for correctly sizing absolutely positioned elements | 909 // It is also used for correctly sizing absolutely positioned elements | 
| 909 // (point 3 above). | 910 // (point 3 above). | 
| 910 // | 911 // | 
| 911 // If |ancestor| and |ancestorSkipped| are not null, on return | 912 // If |ancestor| and |ancestorSkipped| are not null, on return | 
| 912 // *ancestorSkipped is true if the layoutObject returned is an ancestor of | 913 // *ancestorSkipped is true if the layoutObject returned is an ancestor of | 
| 913 // |ancestor|. | 914 // |ancestor|. | 
| 914 LayoutObject* container(const LayoutBoxModelObject* ancestor = nullptr, | 915 LayoutObject* container(const LayoutBoxModelObject* ancestor = nullptr, | 
| 915 bool* ancestorSkipped = nullptr, | 916 bool* ancestorSkipped = nullptr, | 
| 916 bool* filterSkipped = nullptr) const; | 917 bool* filterSkipped = nullptr) const; | 
| 917 // Finds the container as if this object is fixed-position. | 918 // Finds the container as if this object is fixed-position. | 
| 918 LayoutBlock* containerForFixedPosition( | 919 LayoutBlock* containerForFixedPosition( | 
| 919 const LayoutBoxModelObject* ancestor = nullptr, | 920 const LayoutBoxModelObject* ancestor = nullptr, | 
| 920 bool* ancestorSkipped = nullptr, | 921 bool* ancestorSkipped = nullptr, | 
| 921 bool* filterSkipped = nullptr) const; | 922 bool* filterSkipped = nullptr) const; | 
| 922 // Finds the containing block as if this object is absolute-position. | 923 // Finds the containing block as if this object is absolute-position. | 
| 923 LayoutBlock* containingBlockForAbsolutePosition() const; | 924 LayoutBlock* containingBlockForAbsolutePosition( | 
| 925 const LayoutBoxModelObject* ancestor = nullptr, | |
| 926 bool* ancestorSkipped = nullptr, | |
| 927 bool* filterSkipped = nullptr) const; | |
| 924 | 928 | 
| 925 virtual LayoutObject* hoverAncestor() const { return parent(); } | 929 virtual LayoutObject* hoverAncestor() const { return parent(); } | 
| 926 | 930 | 
| 927 Element* offsetParent(const Element* = nullptr) const; | 931 Element* offsetParent(const Element* = nullptr) const; | 
| 928 | 932 | 
| 929 void markContainerChainForLayout(bool scheduleRelayout = true, | 933 void markContainerChainForLayout(bool scheduleRelayout = true, | 
| 930 SubtreeLayoutScope* = nullptr); | 934 SubtreeLayoutScope* = nullptr); | 
| 931 void setNeedsLayout(LayoutInvalidationReasonForTracing, | 935 void setNeedsLayout(LayoutInvalidationReasonForTracing, | 
| 932 MarkingBehavior = MarkContainerChain, | 936 MarkingBehavior = MarkContainerChain, | 
| 933 SubtreeLayoutScope* = nullptr); | 937 SubtreeLayoutScope* = nullptr); | 
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1102 // non-anonymous LayoutBlock. | 1106 // non-anonymous LayoutBlock. | 
| 1103 // Note that in the previous examples, the returned LayoutBlock has no | 1107 // Note that in the previous examples, the returned LayoutBlock has no | 
| 1104 // logical relationship to the original element. | 1108 // logical relationship to the original element. | 
| 1105 // | 1109 // | 
| 1106 // LayoutBlocks are the one that handle laying out positioned elements, | 1110 // LayoutBlocks are the one that handle laying out positioned elements, | 
| 1107 // thus this function is important during layout, to insert the positioned | 1111 // thus this function is important during layout, to insert the positioned | 
| 1108 // elements into the correct LayoutBlock. | 1112 // elements into the correct LayoutBlock. | 
| 1109 // | 1113 // | 
| 1110 // See container() for the function that returns the containing block. | 1114 // See container() for the function that returns the containing block. | 
| 1111 // See LayoutBlock.h for some extra explanations on containing blocks. | 1115 // See LayoutBlock.h for some extra explanations on containing blocks. | 
| 1112 LayoutBlock* containingBlock() const; | 1116 LayoutBlock* containingBlock(const LayoutBoxModelObject* ancestor = nullptr, | 
| 1117 bool* ancestorSkipped = nullptr, | |
| 1118 bool* filterSkipped = nullptr) const; | |
| 1113 | 1119 | 
| 1114 bool canContainAbsolutePositionObjects() const { | 1120 bool canContainAbsolutePositionObjects() const { | 
| 1115 return m_style->canContainAbsolutePositionObjects() || | 1121 return m_style->canContainAbsolutePositionObjects() || | 
| 1116 canContainFixedPositionObjects(); | 1122 canContainFixedPositionObjects(); | 
| 1117 } | 1123 } | 
| 1118 bool canContainFixedPositionObjects() const { | 1124 bool canContainFixedPositionObjects() const { | 
| 1119 return isLayoutView() || isSVGForeignObject() || | 1125 return isLayoutView() || isSVGForeignObject() || | 
| 1120 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); | 1126 (isLayoutBlock() && m_style->canContainFixedPositionObjects()); | 
| 1121 } | 1127 } | 
| 1122 | 1128 | 
| (...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2656 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2662 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 
| 2657 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2663 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 
| 2658 // We don't make object2 an optional parameter so that showLayoutTree | 2664 // We don't make object2 an optional parameter so that showLayoutTree | 
| 2659 // can be called from gdb easily. | 2665 // can be called from gdb easily. | 
| 2660 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2666 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 
| 2661 const blink::LayoutObject* object2); | 2667 const blink::LayoutObject* object2); | 
| 2662 | 2668 | 
| 2663 #endif | 2669 #endif | 
| 2664 | 2670 | 
| 2665 #endif // LayoutObject_h | 2671 #endif // LayoutObject_h | 
| OLD | NEW |