Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 2875163002: Use floating_object's parent object to check for overhanging floats. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4131 matching lines...) Expand 10 before | Expand all | Expand 10 after
4142 if (!ancestor_floating_objects) 4142 if (!ancestor_floating_objects)
4143 break; 4143 break;
4144 FloatingObjectSet::iterator it = 4144 FloatingObjectSet::iterator it =
4145 ancestor_floating_objects->MutableSet() 4145 ancestor_floating_objects->MutableSet()
4146 .Find<FloatingObjectHashTranslator>( 4146 .Find<FloatingObjectHashTranslator>(
4147 const_cast<LayoutBox*>(&float_box)); 4147 const_cast<LayoutBox*>(&float_box));
4148 if (it == ancestor_floating_objects->MutableSet().end()) 4148 if (it == ancestor_floating_objects->MutableSet().end())
4149 break; 4149 break;
4150 4150
4151 FloatingObject& floating_object = **it; 4151 FloatingObject& floating_object = **it;
4152 if (!float_box_is_self_painting_layer) { 4152 // This repeats the logic in addOverhangingFloats() about shouldPaint
4153 // This repeats the logic in addOverhangingFloats() about shouldPaint 4153 // flag:
4154 // flag: 4154 // - The nearest enclosing block in which the float doesn't overhang
4155 // - The nearest enclosing block in which the float doesn't overhang 4155 // paints the float;
4156 // paints the float; 4156 // - Or even if the float overhangs, if the ancestor block has
4157 // - Or even if the float overhangs, if the ancestor block has 4157 // self-painting layer, it paints the float.
4158 // self-painting layer, it paints the float. 4158 LayoutBlockFlow* parent_block =
4159 if (ancestor_block->HasSelfPaintingLayer() || 4159 ToLayoutBlockFlow(floating_object.GetLayoutObject()->Parent());
4160 !ancestor_block->IsOverhangingFloat(floating_object)) { 4160 bool is_overhanging_float =
4161 floating_object.SetShouldPaint(true); 4161 parent_block && parent_block->IsOverhangingFloat(floating_object);
4162 return; 4162 bool should_paint =
4163 } 4163 !float_box_is_self_painting_layer &&
4164 } else { 4164 (ancestor_block->HasSelfPaintingLayer() || !is_overhanging_float);
4165 floating_object.SetShouldPaint(false); 4165 floating_object.SetShouldPaint(should_paint);
4166 } 4166
4167 if (floating_object.ShouldPaint())
4168 return;
4167 } 4169 }
4168 } 4170 }
4169 4171
4170 bool LayoutBlockFlow::AllowsPaginationStrut() const { 4172 bool LayoutBlockFlow::AllowsPaginationStrut() const {
4171 // The block needs to be contained by a LayoutBlockFlow (and not by e.g. a 4173 // The block needs to be contained by a LayoutBlockFlow (and not by e.g. a
4172 // flexbox, grid, or a table (the latter being the case for table cell or 4174 // flexbox, grid, or a table (the latter being the case for table cell or
4173 // table caption)). The reason for this limitation is simply that 4175 // table caption)). The reason for this limitation is simply that
4174 // LayoutBlockFlow child layout code is the only place where we pick up the 4176 // LayoutBlockFlow child layout code is the only place where we pick up the
4175 // struts and handle them. We handle floats and regular in-flow children, and 4177 // struts and handle them. We handle floats and regular in-flow children, and
4176 // that's all. We could handle this in other layout modes as well (and even 4178 // that's all. We could handle this in other layout modes as well (and even
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 return LayoutBlock::DeprecatedInvalidatePaint(paint_invalidation_state); 4694 return LayoutBlock::DeprecatedInvalidatePaint(paint_invalidation_state);
4693 } 4695 }
4694 4696
4695 void LayoutBlockFlow::InvalidateDisplayItemClients( 4697 void LayoutBlockFlow::InvalidateDisplayItemClients(
4696 PaintInvalidationReason invalidation_reason) const { 4698 PaintInvalidationReason invalidation_reason) const {
4697 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients( 4699 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients(
4698 invalidation_reason); 4700 invalidation_reason);
4699 } 4701 }
4700 4702
4701 } // namespace blink 4703 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698