Changeset 110129 in webkit


Ignore:
Timestamp:
Mar 7, 2012 6:50:39 PM (12 years ago)
Author:
ukai@chromium.org
Message:

Unreviewed, rolling out r110126.
http://trac.webkit.org/changeset/110126
https://bugs.webkit.org/show_bug.cgi?id=80558

compile failed on AppleMac (Requested by ukai on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-03-07

Source/WebCore:

  • WebCore.exp.in:
  • css/CSSCalculationValue.cpp:
  • css/CSSCalculationValue.h:

(WebCore):
(CSSCalcExpressionNode):
(CSSCalcValue):

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):

  • css/CSSStyleApplyProperty.cpp:

(WebCore::ApplyPropertyLength::applyValue):

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::collectMatchingRulesForList):

  • css/CSSStyleSelector.h:
  • platform/CalculationValue.cpp:
  • platform/CalculationValue.h:
  • platform/Length.cpp:

(WebCore::newLengthArray):

  • platform/Length.h:

(WebCore::Length::operator*=):
(WebCore::Length::value):
(WebCore::Length::setValue):
(Length):
(WebCore::Length::calcValue):
(WebCore::Length::calcMinValue):
(WebCore::Length::calcFloatValue):
(WebCore::Length::isZero):
(WebCore::Length::isPositive):
(WebCore::Length::isNegative):
(WebCore::Length::isPercent):
(WebCore::Length::isSpecified):

LayoutTests:

  • css3/calc/margin-expected.txt:
  • css3/calc/padding-expected.txt:
  • css3/calc/simple-calcs-expected.txt:
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r110126 r110129  
     12012-03-07  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r110126.
     4        http://trac.webkit.org/changeset/110126
     5        https://bugs.webkit.org/show_bug.cgi?id=80558
     6
     7        compile failed on AppleMac (Requested by ukai on #webkit).
     8
     9        * css3/calc/margin-expected.txt:
     10        * css3/calc/padding-expected.txt:
     11        * css3/calc/simple-calcs-expected.txt:
     12
    1132012-03-07  Mike Lawther  <mikelawther@chromium.org>
    214
  • trunk/LayoutTests/css3/calc/margin-expected.txt

    r110126 r110129  
    1919PASS computedMarginRight("simple-bottom") is "0px"
    2020PASS computedMarginBottom("simple-bottom") is "25px"
    21 PASS computedMarginLeft("percent-all") is "25px"
    22 PASS computedMarginTop("percent-all") is "25px"
    23 PASS computedMarginRight("percent-all") is "25px"
    24 PASS computedMarginBottom("percent-all") is "25px"
    25 PASS computedMarginLeft("percent-left") is "25px"
     21FAIL computedMarginLeft("percent-all") should be 25px. Was 0px.
     22FAIL computedMarginTop("percent-all") should be 25px. Was 0px.
     23FAIL computedMarginRight("percent-all") should be 25px. Was 0px.
     24FAIL computedMarginBottom("percent-all") should be 25px. Was 0px.
     25FAIL computedMarginLeft("percent-left") should be 25px. Was 0px.
    2626PASS computedMarginTop("percent-left") is "0px"
    2727PASS computedMarginRight("percent-left") is "0px"
     
    2929PASS computedMarginLeft("percent-right") is "0px"
    3030PASS computedMarginTop("percent-right") is "0px"
    31 PASS computedMarginRight("percent-right") is "25px"
     31FAIL computedMarginRight("percent-right") should be 25px. Was 0px.
    3232PASS computedMarginBottom("percent-right") is "0px"
    3333PASS computedMarginLeft("percent-top") is "0px"
    34 PASS computedMarginTop("percent-top") is "25px"
     34FAIL computedMarginTop("percent-top") should be 25px. Was 0px.
    3535PASS computedMarginRight("percent-top") is "0px"
    3636PASS computedMarginBottom("percent-top") is "0px"
     
    3838PASS computedMarginTop("percent-bottom") is "0px"
    3939PASS computedMarginRight("percent-bottom") is "0px"
    40 PASS computedMarginBottom("percent-bottom") is "25px"
     40FAIL computedMarginBottom("percent-bottom") should be 25px. Was 0px.
    4141PASS successfullyParsed is true
    4242
  • trunk/LayoutTests/css3/calc/padding-expected.txt

    r110126 r110129  
    99This element should have a bottom padding of 25 pixels. => PASS
    1010
    11 This element should have an overall padding of 25 pixels (10% of parent width of 300px minus 5px). => PASS
     11This element should have an overall padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong width, wrong height
    1212
    13 This element should have a left padding of 25 pixels (10% of parent width of 300px minus 5px). => PASS
     13This element should have a left padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong width
    1414
    15 This element should have a right padding of 25 pixels (10% of parent width of 300px minus 5px). => PASS
     15This element should have a right padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong width
    1616
    17 This element should have a top padding of 25 pixels (10% of parent width of 300px minus 5px). => PASS
     17This element should have a top padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong height
    1818
    19 This element should have a bottom padding of 25 pixels (10% of parent width of 300px minus 5px). => PASS
     19This element should have a bottom padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong height
  • trunk/LayoutTests/css3/calc/simple-calcs-expected.txt

    r110126 r110129  
    212150px + 10px * 5 (operation order) => PASS
    2222100%/2 (where 100% is 200px) => PASS
    23 100% + -100px (where 100% is 200px) => PASS
    24 80% - 60px (where 100% is 200px) => PASS
    25 300px - 100% (where 100% is 200px) => PASS
    26 -100px + 100% (where 100% is 200px) => PASS
     23100% + -100px (where 100% is 200px) => FAIL: @zoom=1 expected width of 100, but was 256; @zoom=1.2 expected width of 100, but was 256; @zoom=2 expected width of 100, but was 256
     2480% - 60px (where 100% is 200px) => FAIL: @zoom=1 expected width of 100, but was 256; @zoom=1.2 expected width of 100, but was 256; @zoom=2 expected width of 100, but was 256
     25300px - 100% (where 100% is 200px) => FAIL: @zoom=1 expected width of 100, but was 256; @zoom=1.2 expected width of 100, but was 256; @zoom=2 expected width of 100, but was 256
     26-100px + 100% (where 100% is 200px) => FAIL: @zoom=1 expected width of 100, but was 256; @zoom=1.2 expected width of 100, but was 256; @zoom=2 expected width of 100, but was 256
    272720% + 30% (where 100% is 200px) => PASS
    282880% - 30% (where 100% is 200px) => PASS
  • trunk/Source/WebCore/ChangeLog

    r110128 r110129  
     12012-03-07  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r110126.
     4        http://trac.webkit.org/changeset/110126
     5        https://bugs.webkit.org/show_bug.cgi?id=80558
     6
     7        compile failed on AppleMac (Requested by ukai on #webkit).
     8
     9        * WebCore.exp.in:
     10        * css/CSSCalculationValue.cpp:
     11        * css/CSSCalculationValue.h:
     12        (WebCore):
     13        (CSSCalcExpressionNode):
     14        (CSSCalcValue):
     15        * css/CSSPrimitiveValue.cpp:
     16        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     17        * css/CSSStyleApplyProperty.cpp:
     18        (WebCore::ApplyPropertyLength::applyValue):
     19        * css/CSSStyleSelector.cpp:
     20        (WebCore::CSSStyleSelector::collectMatchingRulesForList):
     21        * css/CSSStyleSelector.h:
     22        * platform/CalculationValue.cpp:
     23        * platform/CalculationValue.h:
     24        * platform/Length.cpp:
     25        (WebCore::newLengthArray):
     26        * platform/Length.h:
     27        (WebCore::Length::operator*=):
     28        (WebCore::Length::value):
     29        (WebCore::Length::setValue):
     30        (Length):
     31        (WebCore::Length::calcValue):
     32        (WebCore::Length::calcMinValue):
     33        (WebCore::Length::calcFloatValue):
     34        (WebCore::Length::isZero):
     35        (WebCore::Length::isPositive):
     36        (WebCore::Length::isNegative):
     37        (WebCore::Length::isPercent):
     38        (WebCore::Length::isSpecified):
     39
    1402012-03-05  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    241
  • trunk/Source/WebCore/WebCore.exp.in

    r110126 r110129  
    14231423__ZNK7WebCore6Editor9canDeleteEv
    14241424__ZNK7WebCore6JSNode21pushEventHandlerScopeEPN3JSC9ExecStateEPNS1_14ScopeChainNodeE
    1425 __ZNK7WebCore6Length22decrementCalculatedRefEv
    14261425__ZNK7WebCore6Region5rectsEv
    14271426__ZNK7WebCore6Widget14platformWidgetEv
  • trunk/Source/WebCore/css/CSSCalculationValue.cpp

    r110126 r110129  
    115115    }
    116116
    117     virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const
    118     {
    119         switch (m_category) {
    120         case CalcNumber:
    121             return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
    122         case CalcLength:
    123             return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, zoom)));
    124         case CalcPercent:
    125         case CalcPercentLength:
    126             return adoptPtr(new CalcExpressionLength(CSSStyleSelector::convertToFloatLength(m_value.get(), style, rootStyle, zoom)));
    127         // Only types that could be part of a Length expression can be converted
    128         // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length.
    129         case CalcPercentNumber:
    130         case CalcOther:
    131             ASSERT_NOT_REACHED();
    132         }
    133         return nullptr;
    134     }
    135 
    136117    virtual double doubleValue() const
    137118    {
     
    228209    }
    229210
    230     virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const
    231     {
    232         OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, zoom));
    233         if (!left)
    234             return nullptr;
    235         OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, zoom));
    236         if (!right)
    237             return nullptr;
    238         return adoptPtr(new CalcExpressionBinaryOperation(left.release(), right.release(), m_operator));
    239     }
    240 
    241211    virtual double doubleValue() const
    242212    {
  • trunk/Source/WebCore/css/CSSCalculationValue.h

    r110126 r110129  
    4444class CSSValueList;
    4545class RenderStyle;
    46 class CalculationValue;
     46class CalcValue;
    4747class CalcExpressionNode;
    4848
     
    5959public:
    6060   
    61     virtual ~CSSCalcExpressionNode() = 0;
     61    virtual ~CSSCalcExpressionNode() = 0; 
    6262    virtual bool isZero() const = 0;
    63     virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, double zoom = 1.0) const = 0;   
    6463    virtual double doubleValue() const = 0;
    6564    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;
     
    8281public:
    8382    static PassRefPtr<CSSCalcValue> create(CSSParserString name, CSSParserValueList*, CalculationPermittedValueRange);
    84     static PassRefPtr<CSSCalcValue> create(CalculationValue*);
    8583
    86     PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom = 1.0) const
    87     {
    88         return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, zoom), m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll);
    89     }
    9084    CalculationCategory category() const { return m_expression->category(); }
    9185    bool isInt() const { return m_expression->isInteger(); }   
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r110126 r110129  
    267267            m_value.num = length.percent();
    268268            break;
    269         case Calculated:
    270269        case Relative:
    271270        case Undefined:
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r110126 r110129  
    2727
    2828#include "CSSAspectRatioValue.h"
    29 #include "CSSCalculationValue.h"
    3029#include "CSSCursorImageValue.h"
    3130#include "CSSFlexValue.h"
     
    391390            } else if (primitiveValue->isPercentage())
    392391                setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent));
    393             else if (primitiveValue->isCalculatedPercentageWithLength())
    394                 setValue(selector->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom())));           
    395392        }
    396393    }
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r110126 r110129  
    3131#include "Attribute.h"
    3232#include "CachedImage.h"
    33 #include "CalculationValue.h"
    3433#include "ContentData.h"
    3534#include "Counter.h"
    3635#include "CounterContent.h"
    3736#include "CSSBorderImage.h"
    38 #include "CSSCalculationValue.h"
    3937#include "CSSCursorImageValue.h"
    4038#include "CSSFontFaceRule.h"
     
    25502548}
    25512549
    2552 Length CSSStyleSelector::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
     2550static Length convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1)
    25532551{
    25542552    return convertToLength(primitiveValue, style, rootStyle, false, multiplier);
    25552553}
    25562554
    2557 Length CSSStyleSelector::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
     2555static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier = 1)
    25582556{
    25592557    return convertToLength(primitiveValue, style, rootStyle, true, multiplier);
  • trunk/Source/WebCore/css/CSSStyleSelector.h

    r110126 r110129  
    363363    bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
    364364
    365     static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
    366     static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
    367 
    368365private:
    369366    static RenderStyle* s_styleNotYetAvailable;
  • trunk/Source/WebCore/platform/CalculationValue.cpp

    r110126 r110129  
    3232#include "CalculationValue.h"
    3333
    34 #include <limits>
    35 
    3634namespace WebCore {
    3735
    38 float CalcExpressionBinaryOperation::evaluate(float maxValue) const
    39 {
    40     float left = m_leftSide->evaluate(maxValue);
    41     float right = m_rightSide->evaluate(maxValue);
    42     switch (m_operator) {
    43     case CalcAdd:
    44         return left + right;
    45     case CalcSubtract:
    46         return left - right;
    47     case CalcMultiply:
    48         return left * right;
    49     case CalcDivide:
    50         if (!right)
    51             return std::numeric_limits<float>::quiet_NaN();
    52         return left / right;
    53     }
    54     ASSERT_NOT_REACHED();
    55     return std::numeric_limits<float>::quiet_NaN();
    56 }
    57 
    58 PassRefPtr<CalculationValue> CalculationValue::create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange range)
    59 {
    60     return adoptRef(new CalculationValue(value, range));
    61 }
    62 
    63 float CalculationValue::evaluate(float maxValue) const
    64 {
    65     float result = m_value->evaluate(maxValue);
    66     // FIXME calc https://webkit.org/b/80411 : result is NaN when there is a division
    67     // by zero which isn't found at parse time.
    68     if (isnan(result))
    69         return 0;
    70     return m_isNonNegative && result < 0 ? 0 : result;
    71 }
    72 
    7336} // namespace WebCore
  • trunk/Source/WebCore/platform/CalculationValue.h

    r110126 r110129  
    5151    CalculationRangeNonNegative
    5252};
    53        
    54 class CalcExpressionNode {
    55 public:
    56     virtual ~CalcExpressionNode()
    57     {
    58     }
    59    
    60     virtual float evaluate(float maxValue) const = 0;
    61 };
    62    
    63 class CalculationValue : public RefCounted<CalculationValue> {
    64 public:
    65     static PassRefPtr<CalculationValue> create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange);
    66     float evaluate(float maxValue) const;
    67    
    68 private:
    69     CalculationValue(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange range)
    70         : m_value(value)
    71         , m_isNonNegative(range == CalculationRangeNonNegative)
    72     {
    73     }
    74    
    75     OwnPtr<CalcExpressionNode> m_value;
    76     bool m_isNonNegative;
    77 };
    78 
    79 class CalcExpressionNumber : public CalcExpressionNode {
    80 public:
    81     explicit CalcExpressionNumber(float value)
    82         : m_value(value)
    83     {
    84     }
    85 
    86     virtual float evaluate(float) const
    87     {
    88         return m_value;
    89     }
    90    
    91 private:
    92     float m_value;
    93 };
    94 
    95 class CalcExpressionLength : public CalcExpressionNode {
    96 public:
    97     explicit CalcExpressionLength(Length length)
    98         : m_length(length)
    99     {
    100     }
    101 
    102     virtual float evaluate(float maxValue) const
    103     {
    104         return m_length.calcFloatValue(maxValue);
    105     }
    106    
    107 private:
    108     Length m_length;
    109 };
    110 
    111 class CalcExpressionBinaryOperation : public CalcExpressionNode {
    112 public:
    113     CalcExpressionBinaryOperation(PassOwnPtr<CalcExpressionNode> leftSide, PassOwnPtr<CalcExpressionNode> rightSide, CalcOperator op)
    114         : m_leftSide(leftSide)
    115         , m_rightSide(rightSide)
    116         , m_operator(op)
    117     {
    118     }
    119 
    120     virtual float evaluate(float) const;
    121 
    122 private:
    123     OwnPtr<CalcExpressionNode> m_leftSide;
    124     OwnPtr<CalcExpressionNode> m_rightSide;
    125     CalcOperator m_operator;
    126 };
    12753
    12854} // namespace WebCore
  • trunk/Source/WebCore/platform/Length.cpp

    r110126 r110129  
    2626#include "Length.h"
    2727
    28 #include "CalculationValue.h"
    2928#include "PlatformString.h"
    3029#include <wtf/ASCIICType.h>
     
    150149    return r.release();
    151150}
    152        
    153 class CalculationValueHandleMap {
    154 public:
    155     CalculationValueHandleMap()
    156         : m_index(1)
    157     {
    158     }
    159    
    160     int insert(PassRefPtr<CalculationValue> calcValue)
    161     {
    162         ASSERT(m_index);
    163         // FIXME calc(): https://bugs.webkit.org/show_bug.cgi?id=80489
    164         // This monotonically increasing handle generation scheme is potentially wasteful
    165         // of the handle space. Consider reusing empty handles.
    166         while (m_map.contains(m_index))
    167             m_index++;
    168        
    169         m_map.set(m_index, calcValue);       
    170        
    171         return m_index;
    172     }
    173 
    174     void remove(int index)
    175     {
    176         ASSERT(m_map.contains(index));
    177         m_map.remove(index);
    178     }
    179    
    180     PassRefPtr<CalculationValue> get(int index)
    181     {
    182         ASSERT(m_map.contains(index));
    183         return m_map.get(index);
    184     }
    185    
    186 private:       
    187     int m_index;
    188     HashMap<int, RefPtr<CalculationValue> > m_map;
    189 };
    190    
    191 static CalculationValueHandleMap& calcHandles()
    192 {
    193     DEFINE_STATIC_LOCAL(CalculationValueHandleMap, handleMap, ());
    194     return handleMap;
    195 }
    196 
    197 Length::Length(PassRefPtr<CalculationValue> calc)
    198     : m_quirk(false)
    199     , m_type(Calculated)
    200     , m_isFloat(false)
    201 {
    202     m_intValue = calcHandles().insert(calc);
    203 }
    204    
    205 PassRefPtr<CalculationValue> Length::calculationValue() const
    206 {
    207     ASSERT(isCalculated());
    208     return calcHandles().get(calculationHandle());
    209 }
    210    
    211 void Length::incrementCalculatedRef() const
    212 {
    213     ASSERT(isCalculated());
    214     calculationValue()->ref();
    215 }
    216 
    217 void Length::decrementCalculatedRef() const
    218 {
    219     ASSERT(isCalculated());
    220     RefPtr<CalculationValue> calcLength = calculationValue();
    221     if (calcLength->hasOneRef())
    222         calcHandles().remove(calculationHandle());
    223     calcLength->deref();
    224 }   
    225 
    226 float Length::nonNanCalculatedValue(int maxValue) const
    227 {
    228     ASSERT(isCalculated());
    229     float result = calculationValue()->evaluate(maxValue);
    230     if (isnan(result))
    231         return 0;
    232     return result;
    233 }
    234151
    235152class SameSizeAsLength {
  • trunk/Source/WebCore/platform/Length.h

    r110126 r110129  
    2727#include <wtf/FastAllocBase.h>
    2828#include <wtf/Forward.h>
    29 #include <wtf/HashMap.h>
    3029#include <wtf/MathExtras.h>
    3130#include <wtf/PassOwnArrayPtr.h>
     
    3635const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int
    3736
    38 enum LengthType { Auto, Relative, Percent, Fixed, Intrinsic, MinIntrinsic, Calculated, Undefined };
    39  
    40 class CalculationValue;   
    41    
     37enum LengthType { Auto, Relative, Percent, Fixed, Intrinsic, MinIntrinsic, Undefined };
     38
    4239struct Length {
    4340    WTF_MAKE_FAST_ALLOCATED;
     
    6966    }
    7067
    71     explicit Length(PassRefPtr<CalculationValue>);
    72 
    73     Length(const Length& length)
    74     {
    75         initFromLength(length);
    76     }
    77    
    78     Length& operator=(const Length& length)
    79     {
    80         initFromLength(length);
    81         return *this;
    82     }
    83    
    84     ~Length()
    85     {
    86         if (isCalculated())
    87             decrementCalculatedRef();
    88     } 
    89    
    9068    bool operator==(const Length& o) const { return (m_type == o.m_type) && (m_quirk == o.m_quirk) && (isUndefined() || (getFloatValue() == o.getFloatValue())); }
    9169    bool operator!=(const Length& o) const { return !(*this == o); }
    9270
    9371    const Length& operator*=(float v)
    94     {       
    95         if (isCalculated()) {
    96             ASSERT_NOT_REACHED();
    97             return *this;
    98         }
    99        
     72    {       
    10073        if (m_isFloat)
    10174            m_floatValue = static_cast<float>(m_floatValue * v);
     
    10881    int value() const
    10982    {
    110         if (isCalculated()) {
    111             ASSERT_NOT_REACHED();
    112             return 0;
    113         }
    11483        return getIntValue();
    11584    }
     
    12089        return getFloatValue();
    12190    }
    122 
    123     PassRefPtr<CalculationValue> calculationValue() const;
    12491
    12592    LengthType type() const { return static_cast<LengthType>(m_type); }
     
    140107    void setValue(int value)
    141108    {
    142         if (isCalculated()) {
    143             ASSERT_NOT_REACHED();
    144             return;
    145         }
    146109        setValue(Fixed, value);
    147110    }
     
    159122    }
    160123
     124    // Note: May only be called for Fixed, Percent and Auto lengths.
     125    // Other types will ASSERT in order to catch invalid length calculations.
    161126    int calcValue(int maxValue, bool roundPercentages = false) const
    162127    {
     
    164129            case Fixed:
    165130            case Percent:
    166             case Calculated:
    167131                return calcMinValue(maxValue, roundPercentages);
    168132            case Auto:
     
    189153                // Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
    190154                return static_cast<int>(static_cast<float>(maxValue * percent() / 100.0f));
    191             case Calculated:
    192                 return nonNanCalculatedValue(maxValue);
    193155            case Auto:
    194156                return 0;
     
    213175            case Auto:
    214176                return static_cast<float>(maxValue);
    215             case Calculated:
    216                 return nonNanCalculatedValue(maxValue);               
    217177            case Relative:
    218178            case Intrinsic:
     
    227187
    228188    bool isUndefined() const { return type() == Undefined; }
    229 
    230     // FIXME calc: https://bugs.webkit.org/show_bug.cgi?id=80357. A calculated Length
    231     // always contains a percentage, and without a maxValue passed to these functions
    232     // it's impossible to determine the sign or zero-ness. We assume all calc values
    233     // are positive and non-zero for now.   
    234189    bool isZero() const
    235190    {
    236191        ASSERT(!isUndefined());
    237         if (isCalculated())
    238             return false;
    239            
    240192        return m_isFloat ? !m_floatValue : !m_intValue;
    241193    }
    242     bool isPositive() const
    243     {
    244         if (isUndefined())
    245             return false;
    246         if (isCalculated())
    247             return true;
    248                
    249         return getFloatValue() > 0;
    250     }
    251     bool isNegative() const
    252     {
    253         if (isUndefined() || isCalculated())
    254             return false;
    255            
    256         return getFloatValue() < 0;
    257     }
    258194   
     195    bool isPositive() const { return isUndefined() ? false : getFloatValue() > 0; }
     196    bool isNegative() const { return isUndefined() ? false : getFloatValue() < 0; }
     197
    259198    bool isAuto() const { return type() == Auto; }
    260199    bool isRelative() const { return type() == Relative; }
    261     bool isPercent() const { return type() == Percent || type() == Calculated; }
     200    bool isPercent() const { return type() == Percent; }
    262201    bool isFixed() const { return type() == Fixed; }
    263202    bool isIntrinsicOrAuto() const { return type() == Auto || type() == MinIntrinsic || type() == Intrinsic; }
    264     bool isSpecified() const { return type() == Fixed || type() == Percent || type() == Calculated; }
    265     bool isCalculated() const { return type() == Calculated; }
     203    bool isSpecified() const { return type() == Fixed || type() == Percent; }
    266204
    267205    Length blend(const Length& from, double progress) const
     
    302240    }
    303241
    304     void initFromLength(const Length &length)
    305     {
    306         m_quirk = length.m_quirk;
    307         m_type = length.m_type;
    308         m_isFloat = length.m_isFloat;
    309        
    310         if (m_isFloat)
    311             m_floatValue = length.m_floatValue;
    312         else
    313             m_intValue = length.m_intValue;
    314        
    315         if (isCalculated())
    316             incrementCalculatedRef();
    317     }
    318    
    319     float nonNanCalculatedValue(int maxValue) const;
    320     int calculationHandle() const
    321     {
    322         ASSERT(isCalculated());
    323         return getIntValue();
    324     }
    325     void incrementCalculatedRef() const;
    326     void decrementCalculatedRef() const;   
    327    
    328242    union {
    329243        int m_intValue;
Note: See TracChangeset for help on using the changeset viewer.