| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 return; | 242 return; |
| 243 | 243 |
| 244 RenderFlowThread* flowThread = enclosingRenderFlowThread(); | 244 RenderFlowThread* flowThread = enclosingRenderFlowThread(); |
| 245 flowThread->removeRenderBoxRegionInfo(this); | 245 flowThread->removeRenderBoxRegionInfo(this); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void RenderBox::willBeDestroyed() | 248 void RenderBox::willBeDestroyed() |
| 249 { | 249 { |
| 250 clearOverrideSize(); | 250 clearOverrideSize(); |
| 251 | 251 |
| 252 RenderStyle* styleToUse = style(); | 252 if (style()) { |
| 253 if (styleToUse && (styleToUse->logicalHeight().isPercent() || styleToUse->lo
gicalMinHeight().isPercent() || styleToUse->logicalMaxHeight().isPercent())) | 253 RenderBlock::removePercentHeightDescendantIfNeeded(this); |
| 254 RenderBlock::removePercentHeightDescendant(this); | |
| 255 | 254 |
| 256 if (styleToUse) { | |
| 257 if (RenderView* view = this->view()) { | 255 if (RenderView* view = this->view()) { |
| 258 if (FrameView* frameView = view->frameView()) { | 256 if (FrameView* frameView = view->frameView()) { |
| 259 if (styleToUse->position() == FixedPosition) | 257 if (style()->position() == FixedPosition) |
| 260 frameView->removeFixedObject(); | 258 frameView->removeFixedObject(); |
| 261 } | 259 } |
| 262 } | 260 } |
| 263 } | 261 } |
| 264 | 262 |
| 265 // If the following assertion fails, logicalHeight()/logicalMinHeight()/ | |
| 266 // logicalMaxHeight() values are changed from a percent value to a non-perce
nt | |
| 267 // value during laying out. It causes a use-after-free bug. | |
| 268 ASSERT(!RenderBlock::hasPercentHeightDescendant(this)); | |
| 269 | |
| 270 RenderBoxModelObject::willBeDestroyed(); | 263 RenderBoxModelObject::willBeDestroyed(); |
| 271 } | 264 } |
| 272 | 265 |
| 273 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() | 266 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() |
| 274 { | 267 { |
| 275 ASSERT(isFloatingOrPositioned()); | 268 ASSERT(isFloatingOrPositioned()); |
| 276 | 269 |
| 277 if (documentBeingDestroyed()) | 270 if (documentBeingDestroyed()) |
| 278 return; | 271 return; |
| 279 | 272 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 else | 333 else |
| 341 frameView->removeFixedObject(); | 334 frameView->removeFixedObject(); |
| 342 } | 335 } |
| 343 } | 336 } |
| 344 | 337 |
| 345 RenderBoxModelObject::styleWillChange(diff, newStyle); | 338 RenderBoxModelObject::styleWillChange(diff, newStyle); |
| 346 } | 339 } |
| 347 | 340 |
| 348 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) | 341 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) |
| 349 { | 342 { |
| 343 // Horizontal writing mode definition is updated in RenderBoxModelObject::up
dateBoxModelInfoFromStyle, |
| 344 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we
can safely cache the horizontal |
| 345 // writing mode value before style change here. |
| 346 bool oldHorizontalWritingMode = isHorizontalWritingMode(); |
| 347 |
| 350 RenderBoxModelObject::styleDidChange(diff, oldStyle); | 348 RenderBoxModelObject::styleDidChange(diff, oldStyle); |
| 351 | 349 |
| 352 RenderStyle* newStyle = style(); | 350 RenderStyle* newStyle = style(); |
| 353 if (needsLayout() && oldStyle) { | 351 if (needsLayout() && oldStyle) { |
| 354 if (oldStyle && (oldStyle->logicalHeight().isPercent() || oldStyle->logi
calMinHeight().isPercent() || oldStyle->logicalMaxHeight().isPercent())) | 352 RenderBlock::removePercentHeightDescendantIfNeeded(this); |
| 355 RenderBlock::removePercentHeightDescendant(this); | |
| 356 | 353 |
| 357 // Normally we can do optimized positioning layout for absolute/fixed po
sitioned objects. There is one special case, however, which is | 354 // Normally we can do optimized positioning layout for absolute/fixed po
sitioned objects. There is one special case, however, which is |
| 358 // 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 | 355 // 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 |
| 359 // to determine the new static position. | 356 // to determine the new static position. |
| 360 if (isPositioned() && newStyle->hasStaticBlockPosition(isHorizontalWriti
ngMode()) && oldStyle->marginBefore() != newStyle->marginBefore() | 357 if (isPositioned() && newStyle->hasStaticBlockPosition(isHorizontalWriti
ngMode()) && oldStyle->marginBefore() != newStyle->marginBefore() |
| 361 && parent() && !parent()->normalChildNeedsLayout()) | 358 && parent() && !parent()->normalChildNeedsLayout()) |
| 362 parent()->setChildNeedsLayout(true); | 359 parent()->setChildNeedsLayout(true); |
| 363 } | 360 } |
| 364 | 361 |
| 362 if (RenderBlock::hasPercentHeightContainerMap() && firstChild() |
| 363 && oldHorizontalWritingMode != isHorizontalWritingMode()) |
| 364 RenderBlock::clearPercentHeightDescendantsFrom(this); |
| 365 |
| 365 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the | 366 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the |
| 366 // new zoomed coordinate space. | 367 // new zoomed coordinate space. |
| 367 if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() !
= newStyle->effectiveZoom()) { | 368 if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() !
= newStyle->effectiveZoom()) { |
| 368 if (int left = layer()->scrollXOffset()) { | 369 if (int left = layer()->scrollXOffset()) { |
| 369 left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(
); | 370 left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(
); |
| 370 layer()->scrollToXOffset(left); | 371 layer()->scrollToXOffset(left); |
| 371 } | 372 } |
| 372 if (int top = layer()->scrollYOffset()) { | 373 if (int top = layer()->scrollYOffset()) { |
| 373 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); | 374 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); |
| 374 layer()->scrollToYOffset(top); | 375 layer()->scrollToYOffset(top); |
| (...skipping 3676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4051 } | 4052 } |
| 4052 | 4053 |
| 4053 if (didSplitParentAnonymousBoxes) | 4054 if (didSplitParentAnonymousBoxes) |
| 4054 markBoxForRelayoutAfterSplit(this); | 4055 markBoxForRelayoutAfterSplit(this); |
| 4055 | 4056 |
| 4056 ASSERT(beforeChild->parent() == this); | 4057 ASSERT(beforeChild->parent() == this); |
| 4057 return beforeChild; | 4058 return beforeChild; |
| 4058 } | 4059 } |
| 4059 | 4060 |
| 4060 } // namespace WebCore | 4061 } // namespace WebCore |
| OLD | NEW |