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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 6c63e3e501bae956eefcec22ad1d4cff3840b2d8..c8b74c6cdc332c6ddf1eed63625e5fe44dd2d872 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -4149,21 +4149,23 @@ void LayoutBlockFlow::UpdateAncestorShouldPaintFloatingObject(
break;
FloatingObject& floating_object = **it;
- if (!float_box_is_self_painting_layer) {
- // This repeats the logic in addOverhangingFloats() about shouldPaint
- // flag:
- // - The nearest enclosing block in which the float doesn't overhang
- // paints the float;
- // - Or even if the float overhangs, if the ancestor block has
- // self-painting layer, it paints the float.
- if (ancestor_block->HasSelfPaintingLayer() ||
- !ancestor_block->IsOverhangingFloat(floating_object)) {
- floating_object.SetShouldPaint(true);
- return;
- }
- } else {
- floating_object.SetShouldPaint(false);
- }
+ // This repeats the logic in addOverhangingFloats() about shouldPaint
+ // flag:
+ // - The nearest enclosing block in which the float doesn't overhang
+ // paints the float;
+ // - Or even if the float overhangs, if the ancestor block has
+ // self-painting layer, it paints the float.
+ LayoutBlockFlow* parent_block =
+ ToLayoutBlockFlow(floating_object.GetLayoutObject()->Parent());
+ bool is_overhanging_float =
+ parent_block && parent_block->IsOverhangingFloat(floating_object);
+ bool should_paint =
+ !float_box_is_self_painting_layer &&
+ (ancestor_block->HasSelfPaintingLayer() || !is_overhanging_float);
+ floating_object.SetShouldPaint(should_paint);
+
+ if (floating_object.ShouldPaint())
+ return;
}
}
« 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