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

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

Issue 2322703002: Revert of Copy float list of ruby base when merging it with a sibling (Closed)
Patch Set: Created 4 years, 3 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. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #endif 57 #endif
58 { 58 {
59 EFloat type = layoutObject->style()->floating(); 59 EFloat type = layoutObject->style()->floating();
60 ASSERT(type != NoFloat); 60 ASSERT(type != NoFloat);
61 if (type == LeftFloat) 61 if (type == LeftFloat)
62 m_type = FloatLeft; 62 m_type = FloatLeft;
63 else if (type == RightFloat) 63 else if (type == RightFloat)
64 m_type = FloatRight; 64 m_type = FloatRight;
65 } 65 }
66 66
67 FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR ect& frameRect, bool shouldPaint, bool isDescendant, bool isLowestNonOverhanging FloatInChild) 67 FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR ect& frameRect, bool shouldPaint, bool isDescendant, bool isLowestNonOverhanging FloatInChild, bool performingUnsafeClone)
68 : m_layoutObject(layoutObject) 68 : m_layoutObject(layoutObject)
69 , m_originatingLine(nullptr) 69 , m_originatingLine(nullptr)
70 , m_frameRect(frameRect) 70 , m_frameRect(frameRect)
71 , m_type(type) 71 , m_type(type)
72 , m_isDescendant(isDescendant) 72 , m_isDescendant(isDescendant)
73 , m_isPlaced(true) 73 , m_isPlaced(true)
74 , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild) 74 , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild)
75 #if ENABLE(ASSERT) 75 #if ENABLE(ASSERT)
76 , m_isInPlacedTree(false) 76 , m_isInPlacedTree(false)
77 #endif 77 #endif
78 { 78 {
79 m_shouldPaint = shouldPaint || shouldPaintForCompositedLayoutPart(); 79 m_shouldPaint = shouldPaint;
80 // TODO(chrishtr): Avoid the following hack when performing an unsafe clone.
81 // This avoids a use-after-free bug due to the fact that we sometimes fail t o remove
82 // floats from their container when detaching (crbug.com/619380). This is ac tually a bug in the
83 // floats detach machinery, which needs to be fixed, in which case this work around can be removed.
84 // In any case, it should be safe because moving floats from one owner to an other should cause layout,
85 // which will in turn update the m_shouldPaint property.
86 if (!performingUnsafeClone)
87 m_shouldPaint = m_shouldPaint || shouldPaintForCompositedLayoutPart();
80 } 88 }
81 89
82 bool FloatingObject::shouldPaintForCompositedLayoutPart() 90 bool FloatingObject::shouldPaintForCompositedLayoutPart()
83 { 91 {
84 // HACK: only non-self-painting floats should paint. However, due to the fun damental compositing bug, some LayoutPart objects 92 // HACK: only non-self-painting floats should paint. However, due to the fun damental compositing bug, some LayoutPart objects
85 // may become self-painting due to being composited. This leads to a chicken -egg issue because layout may not depend on compositing. 93 // may become self-painting due to being composited. This leads to a chicken -egg issue because layout may not depend on compositing.
86 // If this is the case, set shouldPaint() to true even if the layer is techn ically self-painting. This lets the float which contains 94 // If this is the case, set shouldPaint() to true even if the layer is techn ically self-painting. This lets the float which contains
87 // a LayoutPart start painting as soon as it stops being composited, without having to re-layout the float. 95 // a LayoutPart start painting as soon as it stops being composited, without having to re-layout the float.
88 // This hack can be removed after SPv2. 96 // This hack can be removed after SPv2.
89 return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnl yBecauseIsCompositedPart() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled(); 97 return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnl yBecauseIsCompositedPart() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled();
(...skipping 16 matching lines...) Expand all
106 return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer(); 114 return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer();
107 } 115 }
108 116
109 std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize of fset, bool shouldPaint, bool isDescendant) const 117 std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize of fset, bool shouldPaint, bool isDescendant) const
110 { 118 {
111 return wrapUnique(new FloatingObject(layoutObject(), getType(), LayoutRect(f rameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild())); 119 return wrapUnique(new FloatingObject(layoutObject(), getType(), LayoutRect(f rameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild()));
112 } 120 }
113 121
114 std::unique_ptr<FloatingObject> FloatingObject::unsafeClone() const 122 std::unique_ptr<FloatingObject> FloatingObject::unsafeClone() const
115 { 123 {
116 std::unique_ptr<FloatingObject> cloneObject = wrapUnique(new FloatingObject( layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false)); 124 std::unique_ptr<FloatingObject> cloneObject = wrapUnique(new FloatingObject( layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false, tr ue));
117 cloneObject->m_isPlaced = m_isPlaced; 125 cloneObject->m_isPlaced = m_isPlaced;
118 return cloneObject; 126 return cloneObject;
119 } 127 }
120 128
121 template <FloatingObject::Type FloatTypeValue> 129 template <FloatingObject::Type FloatTypeValue>
122 class ComputeFloatOffsetAdapter { 130 class ComputeFloatOffsetAdapter {
123 public: 131 public:
124 typedef FloatingObjectInterval IntervalType; 132 typedef FloatingObjectInterval IntervalType;
125 133
126 ComputeFloatOffsetAdapter(const LayoutBlockFlow* layoutObject, LayoutUnit li neTop, LayoutUnit lineBottom, LayoutUnit offset) 134 ComputeFloatOffsetAdapter(const LayoutBlockFlow* layoutObject, LayoutUnit li neTop, LayoutUnit lineBottom, LayoutUnit offset)
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 647 }
640 648
641 String ValueToString<FloatingObject*>::toString(const FloatingObject* floatingOb ject) 649 String ValueToString<FloatingObject*>::toString(const FloatingObject* floatingOb ject)
642 { 650 {
643 return String::format("%p (%gx%g %gx%g)", floatingObject, floatingObject->fr ameRect().x().toFloat(), floatingObject->frameRect().y().toFloat(), floatingObje ct->frameRect().maxX().toFloat(), floatingObject->frameRect().maxY().toFloat()); 651 return String::format("%p (%gx%g %gx%g)", floatingObject, floatingObject->fr ameRect().x().toFloat(), floatingObject->frameRect().y().toFloat(), floatingObje ct->frameRect().maxX().toFloat(), floatingObject->frameRect().maxY().toFloat());
644 } 652 }
645 #endif 653 #endif
646 654
647 655
648 } // namespace blink 656 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/FloatingObjects.h ('k') | third_party/WebKit/Source/core/layout/LayoutRubyBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698