OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2977 AddChildBeforeDescendant(new_child, before_child); | 2977 AddChildBeforeDescendant(new_child, before_child); |
2978 return; | 2978 return; |
2979 } | 2979 } |
2980 | 2980 |
2981 bool made_boxes_non_inline = false; | 2981 bool made_boxes_non_inline = false; |
2982 | 2982 |
2983 // A block has to either have all of its children inline, or all of its | 2983 // A block has to either have all of its children inline, or all of its |
2984 // children as blocks. | 2984 // children as blocks. |
2985 // So, if our children are currently inline and a block child has to be | 2985 // So, if our children are currently inline and a block child has to be |
2986 // inserted, we move all our inline children into anonymous block boxes. | 2986 // inserted, we move all our inline children into anonymous block boxes. |
2987 bool child_is_block_level = | 2987 bool child_is_block_level = !new_child->IsInline(); |
2988 !new_child->IsInline() && !new_child->IsFloatingOrOutOfFlowPositioned(); | 2988 |
2989 // ** LayoutNG ** | |
2990 // We want to use the block layout for out of flow positioned | |
2991 // objects when they go in front of inline blocks or if they are just | |
2992 // standalone objects. | |
2993 // Example 1: | |
2994 // <div id="zero"><div id="oof"></div></div> | |
2995 // Legacy Layout: #oof is in inline context. | |
2996 // LayoutNG: #oof is in block context. | |
2997 // | |
2998 // Example 2: | |
2999 // <div id=container><oof></oof>Hello!</div> | |
3000 // Legacy Layout: oof is in inline context. | |
3001 // LayoutNG: oof is in block context. | |
3002 // | |
3003 // Example 3: | |
3004 // <div id=container>Hello!<oof></oof></div> | |
3005 // Legacy Layout: oof is in inline context. | |
3006 // LayoutNG: oof is in inline context. | |
ikilpatrick
2017/04/27 20:34:23
did we want the end children in the inline context
| |
3007 bool layout_ng_enabled = RuntimeEnabledFeatures::layoutNGEnabled(); | |
3008 if (new_child->IsFloatingOrOutOfFlowPositioned()) | |
3009 child_is_block_level = layout_ng_enabled && !FirstChild(); | |
3010 | |
2989 if (ChildrenInline()) { | 3011 if (ChildrenInline()) { |
2990 if (child_is_block_level) { | 3012 if (child_is_block_level) { |
2991 // Wrap the inline content in anonymous blocks, to allow for the new block | 3013 // Wrap the inline content in anonymous blocks, to allow for the new block |
2992 // child to be inserted. | 3014 // child to be inserted. |
2993 MakeChildrenNonInline(before_child); | 3015 MakeChildrenNonInline(before_child); |
2994 made_boxes_non_inline = true; | 3016 made_boxes_non_inline = true; |
2995 | 3017 |
2996 if (before_child && before_child->Parent() != this) { | 3018 if (before_child && before_child->Parent() != this) { |
2997 before_child = before_child->Parent(); | 3019 before_child = before_child->Parent(); |
2998 DCHECK(before_child->IsAnonymousBlock()); | 3020 DCHECK(before_child->IsAnonymousBlock()); |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4655 return LayoutBlock::InvalidatePaintIfNeeded(paint_invalidation_state); | 4677 return LayoutBlock::InvalidatePaintIfNeeded(paint_invalidation_state); |
4656 } | 4678 } |
4657 | 4679 |
4658 void LayoutBlockFlow::InvalidateDisplayItemClients( | 4680 void LayoutBlockFlow::InvalidateDisplayItemClients( |
4659 PaintInvalidationReason invalidation_reason) const { | 4681 PaintInvalidationReason invalidation_reason) const { |
4660 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients( | 4682 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients( |
4661 invalidation_reason); | 4683 invalidation_reason); |
4662 } | 4684 } |
4663 | 4685 |
4664 } // namespace blink | 4686 } // namespace blink |
OLD | NEW |