Fix assertions triggered by CSS calc changes in r166860
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Apr 2014 08:58:43 +0000 (08:58 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Apr 2014 08:58:43 +0000 (08:58 +0000)
commit6939a0c8c79edb090a81eec921eb0581ffdadd31
tree6f743e9646a36fdb3b6e1d1477631e7fda3007a6
parentd2a3d5da3e18f0c8f069c4eb87399988c8d61059
Fix assertions triggered by CSS calc changes in r166860
https://bugs.webkit.org/show_bug.cgi?id=131346

Reviewed by Andrei Bucur.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::getBorderRadiusCornerValues): Use isPercentNotCalculated() instead of
type() == Percent; no behavior change.
(WebCore::getBorderRadiusCornerValue): Ditto.
(WebCore::lineHeightFromStyle): Use isPercentNotCalculated() before code
that calls percent(), which won't work for a calculated length.

* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyBorderRadius::applyValue): Use isNegative and isZero rather
than calling value() unconditionally. Should make calculated values work better.

* html/HTMLPlugInImageElement.cpp:
(WebCore::is100Percent): Use isPercentNotCalculated() before code
that calls percent(), which won't work for a calculated length.

* platform/Length.cpp:
(WebCore::CalculationValueMap::deref): Use adoptRef here instead of calling deref
immediately, so the deref will happen after calling remove. This makes the code
work properly even if it's reentered inside the calculation value's destructor.

* platform/Length.h:
(WebCore::Length::percent): Change assert to isPercentNotCalculated, since the
value function this calls only works for non-calculated values anyway.
(WebCore::Length::isPercentNotCalculated): Added.
(WebCore::Length::isPercent): Changed to call isPercentNotCalculated.
(WebCore::Length::isSpecified): Changed to call isPercent.

* platform/graphics/transforms/TranslateTransformOperation.h:
(WebCore::TranslateTransformOperation::apply): Use isPercentNotCalculated()
instead of type() == Percent; no behavior change.

* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn): Use isPercentNotCalculated()
before code that calls value() or percent(), which won't work for a calculated length.
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths): Ditto.
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth): Ditto.
(WebCore::AutoTableLayout::layout): Ditto.
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::layout): Ditto.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): Ditto.
* rendering/RenderTableSection.cpp:
(WebCore::updateLogicalHeightForCell): Ditto.
(WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows): Ditto.
(WebCore::RenderTableSection::distributeExtraLogicalHeightToRows): Ditto.

* rendering/style/RenderStyle.cpp:
(WebCore::requireTransformOrigin): Use modern for loop. Also marked function static,
since it's private to this file.
(WebCore::RenderStyle::applyTransform): Use isPercentNotCalculated() instead of
type() == Percent; no behavior change. Also use a modern for loop and auto& to avoid
a really long type name.

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): Use isPercentNotCalculated()
before code that calls percent(), which won't work for a calculated length.

* platform/Length.h:
(WebCore::Length::percent):
(WebCore::Length::isPercentNotCalculated):
(WebCore::Length::isPercent):
(WebCore::Length::isSpecified):
* platform/graphics/transforms/TranslateTransformOperation.h:
(WebCore::TranslateTransformOperation::apply):
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):
(WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
(WebCore::AutoTableLayout::layout):
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::layout):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
* rendering/RenderTableSection.cpp:
(WebCore::updateLogicalHeightForCell):
(WebCore::RenderTableSection::distributeExtraLogicalHeightToPercentRows):
(WebCore::RenderTableSection::distributeExtraLogicalHeightToRows):
* rendering/style/RenderStyle.cpp:
(WebCore::requireTransformOrigin):
(WebCore::RenderStyle::applyTransform):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/platform/Length.cpp
Source/WebCore/platform/Length.h
Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
Source/WebCore/rendering/AutoTableLayout.cpp
Source/WebCore/rendering/FixedTableLayout.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp