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

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

Issue 2391893004: Reformat comments in core/layout up until LayoutBox (Closed)
Patch Set: Rebase w/HEAD (again) Created 4 years, 2 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
6 * All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 8 *
8 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 12 * version 2 of the License, or (at your option) any later version.
12 * 13 *
13 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 m_isDescendant(isDescendant), 82 m_isDescendant(isDescendant),
82 m_isPlaced(true), 83 m_isPlaced(true),
83 m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild) 84 m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild)
84 #if ENABLE(ASSERT) 85 #if ENABLE(ASSERT)
85 , 86 ,
86 m_isInPlacedTree(false) 87 m_isInPlacedTree(false)
87 #endif 88 #endif
88 { 89 {
89 m_shouldPaint = shouldPaint; 90 m_shouldPaint = shouldPaint;
90 // TODO(chrishtr): Avoid the following hack when performing an unsafe clone. 91 // TODO(chrishtr): Avoid the following hack when performing an unsafe clone.
91 // This avoids a use-after-free bug due to the fact that we sometimes fail to remove 92 // This avoids a use-after-free bug due to the fact that we sometimes fail to
92 // floats from their container when detaching (crbug.com/619380). This is actu ally a bug in the 93 // remove floats from their container when detaching (crbug.com/619380).
93 // floats detach machinery, which needs to be fixed, in which case this workar ound can be removed. 94 // This is actually a bug in the floats detach machinery, which needs to be
94 // In any case, it should be safe because moving floats from one owner to anot her should cause layout, 95 // fixed, in which case this workaround can be removed. In any case, it should
95 // which will in turn update the m_shouldPaint property. 96 // be safe because moving floats from one owner to another should cause
97 // layout, which will in turn update the m_shouldPaint property.
96 if (!performingUnsafeClone) 98 if (!performingUnsafeClone)
97 m_shouldPaint = m_shouldPaint || shouldPaintForCompositedLayoutPart(); 99 m_shouldPaint = m_shouldPaint || shouldPaintForCompositedLayoutPart();
98 } 100 }
99 101
100 bool FloatingObject::shouldPaintForCompositedLayoutPart() { 102 bool FloatingObject::shouldPaintForCompositedLayoutPart() {
101 // HACK: only non-self-painting floats should paint. However, due to the funda mental compositing bug, some LayoutPart objects 103 // HACK: only non-self-painting floats should paint. However, due to the
102 // may become self-painting due to being composited. This leads to a chicken-e gg issue because layout may not depend on compositing. 104 // fundamental compositing bug, some LayoutPart objects may become
103 // If this is the case, set shouldPaint() to true even if the layer is technic ally self-painting. This lets the float which contains 105 // self-painting due to being composited. This leads to a chicken-egg issue
104 // a LayoutPart start painting as soon as it stops being composited, without h aving to re-layout the float. 106 // because layout may not depend on compositing.
107 // If this is the case, set shouldPaint() to true even if the layer is
108 // technically self-painting. This lets the float which contains a LayoutPart
109 // start painting as soon as it stops being composited, without having to
110 // re-layout the float.
105 // This hack can be removed after SPv2. 111 // This hack can be removed after SPv2.
106 return m_layoutObject->layer() && 112 return m_layoutObject->layer() &&
107 m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart() && 113 m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart() &&
108 !RuntimeEnabledFeatures::slimmingPaintV2Enabled(); 114 !RuntimeEnabledFeatures::slimmingPaintV2Enabled();
109 } 115 }
110 116
111 std::unique_ptr<FloatingObject> FloatingObject::create( 117 std::unique_ptr<FloatingObject> FloatingObject::create(
112 LayoutBox* layoutObject) { 118 LayoutBox* layoutObject) {
113 std::unique_ptr<FloatingObject> newObj = 119 std::unique_ptr<FloatingObject> newObj =
114 wrapUnique(new FloatingObject(layoutObject)); 120 wrapUnique(new FloatingObject(layoutObject));
115 121
116 // If a layer exists, the float will paint itself. Otherwise someone else will . 122 // If a layer exists, the float will paint itself. Otherwise someone else
123 // will.
117 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() || 124 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() ||
118 newObj->shouldPaintForCompositedLayoutPart()); 125 newObj->shouldPaintForCompositedLayoutPart());
119 126
120 newObj->setIsDescendant(true); 127 newObj->setIsDescendant(true);
121 128
122 return newObj; 129 return newObj;
123 } 130 }
124 131
125 bool FloatingObject::shouldPaint() const { 132 bool FloatingObject::shouldPaint() const {
126 return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer(); 133 return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 m_belowLogicalHeight, m_aboveLogicalHeight)); 288 m_belowLogicalHeight, m_aboveLogicalHeight));
282 289
283 LayoutUnit floatBottom = m_layoutObject.logicalBottomForFloat(floatingObject); 290 LayoutUnit floatBottom = m_layoutObject.logicalBottomForFloat(floatingObject);
284 291
285 if (ShapeOutsideInfo* shapeOutside = 292 if (ShapeOutsideInfo* shapeOutside =
286 floatingObject.layoutObject()->shapeOutsideInfo()) { 293 floatingObject.layoutObject()->shapeOutsideInfo()) {
287 LayoutUnit shapeBottom = 294 LayoutUnit shapeBottom =
288 m_layoutObject.logicalTopForFloat(floatingObject) + 295 m_layoutObject.logicalTopForFloat(floatingObject) +
289 m_layoutObject.marginBeforeForChild(*floatingObject.layoutObject()) + 296 m_layoutObject.marginBeforeForChild(*floatingObject.layoutObject()) +
290 shapeOutside->shapeLogicalBottom(); 297 shapeOutside->shapeLogicalBottom();
291 // Use the shapeBottom unless it extends outside of the margin box, in which case it is clipped. 298 // Use the shapeBottom unless it extends outside of the margin box, in which
299 // case it is clipped.
292 m_nextShapeLogicalBottom = m_nextShapeLogicalBottom 300 m_nextShapeLogicalBottom = m_nextShapeLogicalBottom
293 ? std::min(shapeBottom, floatBottom) 301 ? std::min(shapeBottom, floatBottom)
294 : shapeBottom; 302 : shapeBottom;
295 } else { 303 } else {
296 m_nextShapeLogicalBottom = 304 m_nextShapeLogicalBottom =
297 m_nextShapeLogicalBottom 305 m_nextShapeLogicalBottom
298 ? std::min(m_nextShapeLogicalBottom, floatBottom) 306 ? std::min(m_nextShapeLogicalBottom, floatBottom)
299 : floatBottom; 307 : floatBottom;
300 } 308 }
301 309
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 template <FloatingObject::Type FloatTypeValue> 682 template <FloatingObject::Type FloatTypeValue>
675 DISABLE_CFI_PERF inline void 683 DISABLE_CFI_PERF inline void
676 ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded( 684 ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(
677 const IntervalType& interval) { 685 const IntervalType& interval) {
678 const FloatingObject& floatingObject = *(interval.data()); 686 const FloatingObject& floatingObject = *(interval.data());
679 if (floatingObject.getType() != FloatTypeValue || 687 if (floatingObject.getType() != FloatTypeValue ||
680 !rangesIntersect(interval.low(), interval.high(), m_lineTop, 688 !rangesIntersect(interval.low(), interval.high(), m_lineTop,
681 m_lineBottom)) 689 m_lineBottom))
682 return; 690 return;
683 691
684 // Make sure the float hasn't changed since it was added to the placed floats tree. 692 // Make sure the float hasn't changed since it was added to the placed floats
693 // tree.
685 ASSERT(floatingObject.isPlaced()); 694 ASSERT(floatingObject.isPlaced());
686 ASSERT(interval.low() == m_layoutObject->logicalTopForFloat(floatingObject)); 695 ASSERT(interval.low() == m_layoutObject->logicalTopForFloat(floatingObject));
687 ASSERT(interval.high() == 696 ASSERT(interval.high() ==
688 m_layoutObject->logicalBottomForFloat(floatingObject)); 697 m_layoutObject->logicalBottomForFloat(floatingObject));
689 698
690 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); 699 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
691 if (floatIsNewExtreme) 700 if (floatIsNewExtreme)
692 m_outermostFloat = &floatingObject; 701 m_outermostFloat = &floatingObject;
693 } 702 }
694 703
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 const FloatingObject* floatingObject) { 758 const FloatingObject* floatingObject) {
750 return String::format("%p (%gx%g %gx%g)", floatingObject, 759 return String::format("%p (%gx%g %gx%g)", floatingObject,
751 floatingObject->frameRect().x().toFloat(), 760 floatingObject->frameRect().x().toFloat(),
752 floatingObject->frameRect().y().toFloat(), 761 floatingObject->frameRect().y().toFloat(),
753 floatingObject->frameRect().maxX().toFloat(), 762 floatingObject->frameRect().maxX().toFloat(),
754 floatingObject->frameRect().maxY().toFloat()); 763 floatingObject->frameRect().maxY().toFloat());
755 } 764 }
756 #endif 765 #endif
757 766
758 } // namespace blink 767 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/FloatingObjects.h ('k') | third_party/WebKit/Source/core/layout/FragmentainerIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698