OLD | NEW |
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return; | 127 return; |
128 | 128 |
129 RenderFlowThread* flowThread = enclosingRenderFlowThread(); | 129 RenderFlowThread* flowThread = enclosingRenderFlowThread(); |
130 flowThread->removeRenderBoxRegionInfo(this); | 130 flowThread->removeRenderBoxRegionInfo(this); |
131 } | 131 } |
132 | 132 |
133 void RenderBox::willBeDestroyed() | 133 void RenderBox::willBeDestroyed() |
134 { | 134 { |
135 clearOverrideSize(); | 135 clearOverrideSize(); |
136 | 136 |
137 RenderStyle* styleToUse = style(); | 137 if (style()) { |
138 if (styleToUse && (styleToUse->logicalHeight().isPercent() || styleToUse->lo
gicalMinHeight().isPercent() || styleToUse->logicalMaxHeight().isPercent())) | 138 RenderBlock::removePercentHeightDescendantIfNeeded(this); |
139 RenderBlock::removePercentHeightDescendant(this); | |
140 | 139 |
141 if (styleToUse) { | |
142 if (RenderView* view = this->view()) { | 140 if (RenderView* view = this->view()) { |
143 if (FrameView* frameView = view->frameView()) { | 141 if (FrameView* frameView = view->frameView()) { |
144 if (styleToUse->position() == FixedPosition) | 142 if (style()->position() == FixedPosition) |
145 frameView->removeFixedObject(this); | 143 frameView->removeFixedObject(this); |
146 } | 144 } |
147 } | 145 } |
148 } | 146 } |
149 | 147 |
150 // If the following assertion fails, logicalHeight()/logicalMinHeight()/ | |
151 // logicalMaxHeight() values are changed from a percent value to a non-perce
nt | |
152 // value during laying out. It causes a use-after-free bug. | |
153 ASSERT(!RenderBlock::hasPercentHeightDescendant(this)); | |
154 | |
155 RenderBoxModelObject::willBeDestroyed(); | 148 RenderBoxModelObject::willBeDestroyed(); |
156 } | 149 } |
157 | 150 |
158 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() | 151 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() |
159 { | 152 { |
160 ASSERT(isFloatingOrPositioned()); | 153 ASSERT(isFloatingOrPositioned()); |
161 | 154 |
162 if (documentBeingDestroyed()) | 155 if (documentBeingDestroyed()) |
163 return; | 156 return; |
164 | 157 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 else | 218 else |
226 frameView->removeFixedObject(this); | 219 frameView->removeFixedObject(this); |
227 } | 220 } |
228 } | 221 } |
229 | 222 |
230 RenderBoxModelObject::styleWillChange(diff, newStyle); | 223 RenderBoxModelObject::styleWillChange(diff, newStyle); |
231 } | 224 } |
232 | 225 |
233 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) | 226 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) |
234 { | 227 { |
| 228 // Horizontal writing mode definition is updated in RenderBoxModelObject::up
dateBoxModelInfoFromStyle, |
| 229 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we
can safely cache the horizontal |
| 230 // writing mode value before style change here. |
| 231 bool oldHorizontalWritingMode = isHorizontalWritingMode(); |
| 232 |
235 RenderBoxModelObject::styleDidChange(diff, oldStyle); | 233 RenderBoxModelObject::styleDidChange(diff, oldStyle); |
236 | 234 |
237 RenderStyle* newStyle = style(); | 235 RenderStyle* newStyle = style(); |
238 if (needsLayout() && oldStyle) { | 236 if (needsLayout() && oldStyle) { |
239 if (oldStyle && (oldStyle->logicalHeight().isPercent() || oldStyle->logi
calMinHeight().isPercent() || oldStyle->logicalMaxHeight().isPercent())) | 237 RenderBlock::removePercentHeightDescendantIfNeeded(this); |
240 RenderBlock::removePercentHeightDescendant(this); | |
241 | 238 |
242 // Normally we can do optimized positioning layout for absolute/fixed po
sitioned objects. There is one special case, however, which is | 239 // Normally we can do optimized positioning layout for absolute/fixed po
sitioned objects. There is one special case, however, which is |
243 // when the positioned object's margin-before is changed. In this case t
he parent has to get a layout in order to run margin collapsing | 240 // when the positioned object's margin-before is changed. In this case t
he parent has to get a layout in order to run margin collapsing |
244 // to determine the new static position. | 241 // to determine the new static position. |
245 if (isPositioned() && newStyle->hasStaticBlockPosition(isHorizontalWriti
ngMode()) && oldStyle->marginBefore() != newStyle->marginBefore() | 242 if (isPositioned() && newStyle->hasStaticBlockPosition(isHorizontalWriti
ngMode()) && oldStyle->marginBefore() != newStyle->marginBefore() |
246 && parent() && !parent()->normalChildNeedsLayout()) | 243 && parent() && !parent()->normalChildNeedsLayout()) |
247 parent()->setChildNeedsLayout(true); | 244 parent()->setChildNeedsLayout(true); |
248 } | 245 } |
249 | 246 |
| 247 if (RenderBlock::hasPercentHeightContainerMap() && firstChild() |
| 248 && oldHorizontalWritingMode != isHorizontalWritingMode()) |
| 249 RenderBlock::clearPercentHeightDescendantsFrom(this); |
| 250 |
250 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the | 251 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the |
251 // new zoomed coordinate space. | 252 // new zoomed coordinate space. |
252 if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() !
= newStyle->effectiveZoom()) { | 253 if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() !
= newStyle->effectiveZoom()) { |
253 if (int left = layer()->scrollXOffset()) { | 254 if (int left = layer()->scrollXOffset()) { |
254 left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(
); | 255 left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(
); |
255 layer()->scrollToXOffset(left); | 256 layer()->scrollToXOffset(left); |
256 } | 257 } |
257 if (int top = layer()->scrollYOffset()) { | 258 if (int top = layer()->scrollYOffset()) { |
258 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); | 259 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); |
259 layer()->scrollToYOffset(top); | 260 layer()->scrollToYOffset(top); |
(...skipping 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3984 } | 3985 } |
3985 | 3986 |
3986 if (didSplitParentAnonymousBoxes) | 3987 if (didSplitParentAnonymousBoxes) |
3987 markBoxForRelayoutAfterSplit(this); | 3988 markBoxForRelayoutAfterSplit(this); |
3988 | 3989 |
3989 ASSERT(beforeChild->parent() == this); | 3990 ASSERT(beforeChild->parent() == this); |
3990 return beforeChild; | 3991 return beforeChild; |
3991 } | 3992 } |
3992 | 3993 |
3993 } // namespace WebCore | 3994 } // namespace WebCore |
OLD | NEW |