Index: Source/WebCore/rendering/RenderBox.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderBox.cpp (revision 122126) |
+++ Source/WebCore/rendering/RenderBox.cpp (working copy) |
@@ -249,24 +249,17 @@ |
{ |
clearOverrideSize(); |
- RenderStyle* styleToUse = style(); |
- if (styleToUse && (styleToUse->logicalHeight().isPercent() || styleToUse->logicalMinHeight().isPercent() || styleToUse->logicalMaxHeight().isPercent())) |
- RenderBlock::removePercentHeightDescendant(this); |
+ if (style()) { |
+ RenderBlock::removePercentHeightDescendantIfNeeded(this); |
- if (styleToUse) { |
if (RenderView* view = this->view()) { |
if (FrameView* frameView = view->frameView()) { |
- if (styleToUse->position() == FixedPosition) |
+ if (style()->position() == FixedPosition) |
frameView->removeFixedObject(); |
} |
} |
} |
- // If the following assertion fails, logicalHeight()/logicalMinHeight()/ |
- // logicalMaxHeight() values are changed from a percent value to a non-percent |
- // value during laying out. It causes a use-after-free bug. |
- ASSERT(!RenderBlock::hasPercentHeightDescendant(this)); |
- |
RenderBoxModelObject::willBeDestroyed(); |
} |
@@ -347,12 +340,16 @@ |
void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) |
{ |
+ // Horizontal writing mode definition is updated in RenderBoxModelObject::updateBoxModelInfoFromStyle, |
+ // (as part of the RenderBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal |
+ // writing mode value before style change here. |
+ bool oldHorizontalWritingMode = isHorizontalWritingMode(); |
+ |
RenderBoxModelObject::styleDidChange(diff, oldStyle); |
RenderStyle* newStyle = style(); |
if (needsLayout() && oldStyle) { |
- if (oldStyle && (oldStyle->logicalHeight().isPercent() || oldStyle->logicalMinHeight().isPercent() || oldStyle->logicalMaxHeight().isPercent())) |
- RenderBlock::removePercentHeightDescendant(this); |
+ RenderBlock::removePercentHeightDescendantIfNeeded(this); |
// Normally we can do optimized positioning layout for absolute/fixed positioned objects. There is one special case, however, which is |
// when the positioned object's margin-before is changed. In this case the parent has to get a layout in order to run margin collapsing |
@@ -362,6 +359,10 @@ |
parent()->setChildNeedsLayout(true); |
} |
+ if (RenderBlock::hasPercentHeightContainerMap() && firstChild() |
+ && oldHorizontalWritingMode != isHorizontalWritingMode()) |
+ RenderBlock::clearPercentHeightDescendantsFrom(this); |
+ |
// If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the |
// new zoomed coordinate space. |
if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() != newStyle->effectiveZoom()) { |