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

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

Issue 2191953002: Fix asserts when updating shouldPaint for floating objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 } 3339 }
3340 3340
3341 LayoutUnit LayoutBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 3341 LayoutUnit LayoutBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
3342 { 3342 {
3343 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) 3343 if (m_floatingObjects && m_floatingObjects->hasRightObjects())
3344 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo gicalHeight); 3344 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo gicalHeight);
3345 3345
3346 return fixedOffset; 3346 return fixedOffset;
3347 } 3347 }
3348 3348
3349 void LayoutBlockFlow::setAncestorShouldPaintFloatingObject(const LayoutBox& floa tBox, bool shouldPaint) 3349 void LayoutBlockFlow::setAncestorShouldPaintFloatingObject(const LayoutBox& floa tBox)
3350 { 3350 {
3351 ASSERT(floatBox.isFloating()); 3351 ASSERT(floatBox.isFloating());
3352 ASSERT(!floatBox.hasSelfPaintingLayer()); 3352 bool floatBoxIsSelfPaintingLayer = floatBox.hasLayer() && floatBox.layer()-> isSelfPaintingLayer();
3353 for (LayoutObject* ancestor = floatBox.parent(); ancestor && ancestor->isLay outBlockFlow(); ancestor = ancestor->parent()) { 3353 for (LayoutObject* ancestor = floatBox.parent(); ancestor && ancestor->isLay outBlockFlow(); ancestor = ancestor->parent()) {
3354 LayoutBlockFlow* ancestorBlock = toLayoutBlockFlow(ancestor); 3354 LayoutBlockFlow* ancestorBlock = toLayoutBlockFlow(ancestor);
3355 FloatingObjects* ancestorFloatingObjects = ancestorBlock->m_floatingObje cts.get(); 3355 FloatingObjects* ancestorFloatingObjects = ancestorBlock->m_floatingObje cts.get();
3356 if (!ancestorFloatingObjects) 3356 if (!ancestorFloatingObjects)
3357 break; 3357 break;
3358 FloatingObjectSet::iterator it = ancestorFloatingObjects->mutableSet().f ind<FloatingObjectHashTranslator>(const_cast<LayoutBox*>(&floatBox)); 3358 FloatingObjectSet::iterator it = ancestorFloatingObjects->mutableSet().f ind<FloatingObjectHashTranslator>(const_cast<LayoutBox*>(&floatBox));
3359 if (it == ancestorFloatingObjects->mutableSet().end()) 3359 if (it == ancestorFloatingObjects->mutableSet().end())
3360 break; 3360 break;
3361 3361
3362 FloatingObject& floatingObject = **it; 3362 FloatingObject& floatingObject = **it;
3363 if (shouldPaint) { 3363 if (!floatBoxIsSelfPaintingLayer) {
3364 ASSERT(!floatingObject.shouldPaint());
3365 // This repeats the logic in addOverhangingFloats() about shouldPain t flag: 3364 // This repeats the logic in addOverhangingFloats() about shouldPain t flag:
3366 // - The nearest enclosing block in which the float doesn't overhang paints the float; 3365 // - The nearest enclosing block in which the float doesn't overhang paints the float;
3367 // - Or even if the float overhangs, if the ancestor block has self- painting layer, it 3366 // - Or even if the float overhangs, if the ancestor block has self- painting layer, it
3368 // paints the float. 3367 // paints the float.
3369 if (ancestorBlock->hasSelfPaintingLayer() || !ancestorBlock->isOverh angingFloat(floatingObject)) { 3368 if (ancestorBlock->hasSelfPaintingLayer() || !ancestorBlock->isOverh angingFloat(floatingObject)) {
3370 floatingObject.setShouldPaint(true); 3369 floatingObject.setShouldPaint(true);
3371 return; 3370 return;
3372 } 3371 }
3373 } else if (floatingObject.shouldPaint()) { 3372 } else if (floatingObject.shouldPaint()) {
3374 floatingObject.setShouldPaint(false); 3373 floatingObject.setShouldPaint(false);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
3776 if (!rect.isEmpty()) 3775 if (!rect.isEmpty())
3777 rects.append(rect); 3776 rects.append(rect);
3778 } 3777 }
3779 } 3778 }
3780 3779
3781 if (inlineElementContinuation) 3780 if (inlineElementContinuation)
3782 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows); 3781 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows);
3783 } 3782 }
3784 3783
3785 } // namespace blink 3784 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | third_party/WebKit/Source/core/paint/PaintLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698