Index: Source/core/css/CSSPrimitiveValue.cpp |
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp |
index 1eb2d16ebea7f91ff3144031a9868585198db0f8..749f4b658af36df3d3261f5a16dde9b8eb2983bd 100644 |
--- a/Source/core/css/CSSPrimitiveValue.cpp |
+++ b/Source/core/css/CSSPrimitiveValue.cpp |
@@ -26,7 +26,6 @@ |
#include "core/css/CSSHelper.h" |
#include "core/css/CSSMarkup.h" |
#include "core/css/CSSToLengthConversionData.h" |
-#include "core/css/Counter.h" |
#include "core/css/Pair.h" |
#include "core/css/Rect.h" |
#include "core/css/StyleSheetContents.h" |
@@ -159,13 +158,6 @@ bool CSSPrimitiveValue::colorIsDerivedFromElement() const |
} |
} |
-typedef HashMap<const CSSPrimitiveValue*, String> CSSTextCache; |
-static CSSTextCache& cssTextCache() |
-{ |
- AtomicallyInitializedStaticReference(ThreadSpecific<CSSTextCache>, cache, new ThreadSpecific<CSSTextCache>()); |
- return *cache; |
-} |
- |
CSSPrimitiveValue::UnitType CSSPrimitiveValue::typeWithCalcResolved() const |
{ |
if (type() != UnitType::Calc) |
@@ -342,13 +334,6 @@ void CSSPrimitiveValue::init(const LengthSize& lengthSize, const ComputedStyle& |
m_value.pair = Pair::create(create(lengthSize.width(), style.effectiveZoom()), create(lengthSize.height(), style.effectiveZoom()), Pair::KeepIdenticalValues).leakRef(); |
} |
-void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<Counter> c) |
-{ |
- init(UnitType::Counter); |
- m_hasCachedCSSText = false; |
- m_value.counter = c.leakRef(); |
-} |
- |
void CSSPrimitiveValue::init(PassRefPtrWillBeRawPtr<Rect> r) |
{ |
init(UnitType::Rect); |
@@ -399,12 +384,6 @@ void CSSPrimitiveValue::cleanup() |
if (m_value.string) |
m_value.string->deref(); |
break; |
- case UnitType::Counter: |
- // We must not call deref() when oilpan is enabled because m_value.counter is traced. |
-#if !ENABLE(OILPAN) |
- m_value.counter->deref(); |
-#endif |
- break; |
case UnitType::Rect: |
// We must not call deref() when oilpan is enabled because m_value.rect is traced. |
#if !ENABLE(OILPAN) |
@@ -475,10 +454,6 @@ void CSSPrimitiveValue::cleanup() |
case UnitType::ValueID: |
break; |
} |
- if (m_hasCachedCSSText) { |
- cssTextCache().remove(this); |
- m_hasCachedCSSText = false; |
- } |
} |
double CSSPrimitiveValue::computeSeconds() |
@@ -918,7 +893,6 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type) |
case UnitType::ValueID: |
case UnitType::PropertyID: |
case UnitType::Attribute: |
- case UnitType::Counter: |
case UnitType::Rect: |
case UnitType::Quad: |
case UnitType::RGBColor: |
@@ -936,19 +910,12 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type) |
String CSSPrimitiveValue::customCSSText() const |
{ |
- if (m_hasCachedCSSText) { |
- ASSERT(cssTextCache().contains(this)); |
- return cssTextCache().get(this); |
- } |
- |
- String text; |
switch (type()) { |
case UnitType::Unknown: |
// FIXME |
- break; |
+ return ""; |
case UnitType::Integer: |
- text = String::format("%d", getIntValue()); |
- break; |
+ return String::format("%d", getIntValue()); |
case UnitType::Number: |
case UnitType::Percentage: |
case UnitType::Ems: |
@@ -977,24 +944,18 @@ String CSSPrimitiveValue::customCSSText() const |
case UnitType::ViewportHeight: |
case UnitType::ViewportMin: |
case UnitType::ViewportMax: |
- text = formatNumber(m_value.num, unitTypeToString(type())); |
- break; |
+ return formatNumber(m_value.num, unitTypeToString(type())); |
case UnitType::CustomIdentifier: |
- text = quoteCSSStringIfNeeded(m_value.string); |
- break; |
+ return quoteCSSStringIfNeeded(m_value.string); |
case UnitType::String: { |
- text = serializeString(m_value.string); |
- break; |
+ return serializeString(m_value.string); |
} |
case UnitType::URI: |
- text = "url(" + quoteCSSURLIfNeeded(m_value.string) + ")"; |
- break; |
+ return "url(" + quoteCSSURLIfNeeded(m_value.string) + ")"; |
case UnitType::ValueID: |
- text = valueName(m_value.valueID); |
- break; |
+ return valueName(m_value.valueID); |
case UnitType::PropertyID: |
- text = propertyName(m_value.propertyID); |
- break; |
+ return propertyName(m_value.propertyID); |
case UnitType::Attribute: { |
StringBuilder result; |
result.reserveCapacity(6 + m_value.string->length()); |
@@ -1002,63 +963,27 @@ String CSSPrimitiveValue::customCSSText() const |
result.append(m_value.string); |
result.append(')'); |
- text = result.toString(); |
- break; |
- } |
- case UnitType::Counter: { |
- StringBuilder result; |
- String separator = m_value.counter->separator(); |
- if (separator.isEmpty()) |
- result.appendLiteral("counter("); |
- else |
- result.appendLiteral("counters("); |
- |
- result.append(m_value.counter->identifier()); |
- if (!separator.isEmpty()) { |
- result.appendLiteral(", "); |
- result.append(serializeString(separator)); |
- } |
- String listStyle = m_value.counter->listStyle(); |
- bool isDefaultListStyle = m_value.counter->listStyleIdent() == CSSValueDecimal; |
- if (!listStyle.isEmpty() && !isDefaultListStyle) { |
- result.appendLiteral(", "); |
- result.append(listStyle); |
- } |
- result.append(')'); |
- |
- text = result.toString(); |
- break; |
+ return result.toString(); |
} |
case UnitType::Rect: |
- text = getRectValue()->cssText(); |
- break; |
+ return getRectValue()->cssText(); |
case UnitType::Quad: |
- text = getQuadValue()->cssText(); |
- break; |
+ return getQuadValue()->cssText(); |
case UnitType::RGBColor: { |
- text = Color(m_value.rgbcolor).serializedAsCSSComponentValue(); |
- break; |
+ return Color(m_value.rgbcolor).serializedAsCSSComponentValue(); |
} |
case UnitType::Pair: |
- text = getPairValue()->cssText(); |
- break; |
+ return getPairValue()->cssText(); |
case UnitType::Calc: |
- text = m_value.calc->customCSSText(); |
- break; |
+ return m_value.calc->customCSSText(); |
case UnitType::Shape: |
- text = m_value.shape->cssText(); |
- break; |
+ return m_value.shape->cssText(); |
case UnitType::CalcPercentageWithNumber: |
case UnitType::CalcPercentageWithLength: |
case UnitType::QuirkyEms: |
ASSERT_NOT_REACHED(); |
- break; |
+ return ""; |
} |
- |
- ASSERT(!cssTextCache().contains(this)); |
- cssTextCache().set(this, text); |
- m_hasCachedCSSText = true; |
- return text; |
} |
bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const |
@@ -1106,8 +1031,6 @@ bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const |
case UnitType::URI: |
case UnitType::Attribute: |
return equal(m_value.string, other.m_value.string); |
- case UnitType::Counter: |
- return m_value.counter && other.m_value.counter && m_value.counter->equals(*other.m_value.counter); |
case UnitType::Rect: |
return m_value.rect && other.m_value.rect && m_value.rect->equals(*other.m_value.rect); |
case UnitType::Quad: |
@@ -1134,9 +1057,6 @@ DEFINE_TRACE_AFTER_DISPATCH(CSSPrimitiveValue) |
{ |
#if ENABLE(OILPAN) |
switch (type()) { |
- case UnitType::Counter: |
- visitor->trace(m_value.counter); |
- break; |
case UnitType::Rect: |
visitor->trace(m_value.rect); |
break; |