Diff
Modified: trunk/Source/WebCore/ChangeLog (158832 => 158833)
--- trunk/Source/WebCore/ChangeLog 2013-11-07 10:08:04 UTC (rev 158832)
+++ trunk/Source/WebCore/ChangeLog 2013-11-07 10:11:43 UTC (rev 158833)
@@ -1,5 +1,15 @@
2013-11-07 Andreas Kling <[email protected]>
+ More CSSPrimitiveValue constructors should return PassRef.
+ <https://webkit.org/b/123953>
+
+ Make some more CSSPrimitiveValue constructor helpers (that are
+ known to never return null) return PassRef instead of PassRefPtr.
+
+ Reviewed by Antti Koivisto.
+
+2013-11-07 Andreas Kling <[email protected]>
+
Generate type casting helpers for line boxes and use them.
<https://webkit.org/b/123976>
Modified: trunk/Source/WebCore/css/CSSCalculationValue.cpp (158832 => 158833)
--- trunk/Source/WebCore/css/CSSCalculationValue.cpp 2013-11-07 10:08:04 UTC (rev 158832)
+++ trunk/Source/WebCore/css/CSSCalculationValue.cpp 2013-11-07 10:11:43 UTC (rev 158833)
@@ -213,7 +213,7 @@
{
if (std::isnan(value) || std::isinf(value))
return 0;
- return adoptRef(new CSSCalcPrimitiveValue(CSSPrimitiveValue::create(value, type).get(), isInteger));
+ return adoptRef(new CSSCalcPrimitiveValue(CSSPrimitiveValue::create(value, type), isInteger));
}
virtual bool isZero() const
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (158832 => 158833)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.h 2013-11-07 10:08:04 UTC (rev 158832)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h 2013-11-07 10:11:43 UTC (rev 158833)
@@ -216,9 +216,9 @@
static PassRefPtr<CSSPrimitiveValue> createParserOperator(int parserOperator) { return adoptRef(new CSSPrimitiveValue(parserOperator)); }
static PassRef<CSSPrimitiveValue> createColor(unsigned rgbValue) { return adoptRef(*new CSSPrimitiveValue(rgbValue)); }
- static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
- static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
- static PassRefPtr<CSSPrimitiveValue> create(const Length& value, const RenderStyle* style) { return adoptRef(new CSSPrimitiveValue(value, style)); }
+ static PassRef<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
+ static PassRef<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(*new CSSPrimitiveValue(value, type)); }
+ static PassRef<CSSPrimitiveValue> create(const Length& value, const RenderStyle* style) { return adoptRef(*new CSSPrimitiveValue(value, style)); }
template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value)
{
Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (158832 => 158833)
--- trunk/Source/WebCore/css/CSSValuePool.cpp 2013-11-07 10:08:04 UTC (rev 158832)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp 2013-11-07 10:11:43 UTC (rev 158833)
@@ -87,7 +87,7 @@
return *entry.iterator->value;
}
-PassRefPtr<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitTypes type)
+PassRef<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitTypes type)
{
if (value < 0 || value > maximumCacheableIntegerValue)
return CSSPrimitiveValue::create(value, type);
@@ -113,7 +113,7 @@
if (!cache[intValue])
cache[intValue] = CSSPrimitiveValue::create(value, type);
- return cache[intValue];
+ return *cache[intValue];
}
PassRefPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName)
Modified: trunk/Source/WebCore/css/CSSValuePool.h (158832 => 158833)
--- trunk/Source/WebCore/css/CSSValuePool.h 2013-11-07 10:08:04 UTC (rev 158832)
+++ trunk/Source/WebCore/css/CSSValuePool.h 2013-11-07 10:11:43 UTC (rev 158833)
@@ -50,9 +50,9 @@
PassRef<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
PassRef<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
PassRef<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
- PassRefPtr<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
- PassRefPtr<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
- PassRefPtr<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle* style) { return CSSPrimitiveValue::create(value, style); }
+ PassRef<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
+ PassRef<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
+ PassRef<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle* style) { return CSSPrimitiveValue::create(value, style); }
template<typename T> static PassRefPtr<CSSPrimitiveValue> createValue(T value) { return CSSPrimitiveValue::create(value); }
void drain();
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (158832 => 158833)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-07 10:08:04 UTC (rev 158832)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-07 10:11:43 UTC (rev 158833)
@@ -1522,8 +1522,16 @@
class ApplyPropertyPageSize {
private:
- static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
- static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
+ static Length mmLength(double mm)
+ {
+ Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM));
+ return value.get().computeLength<Length>(0, 0);
+ }
+ static Length inchLength(double inch)
+ {
+ Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN));
+ return value.get().computeLength<Length>(0, 0);
+ }
static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
{
DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (158832 => 158833)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2013-11-07 10:08:04 UTC (rev 158832)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2013-11-07 10:11:43 UTC (rev 158833)
@@ -2555,7 +2555,8 @@
result *= 3;
else if (primitiveValue->getValueID() == CSSValueThick)
result *= 5;
- width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
+ Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS));
+ width = value.get().computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
break;
}
default:
@@ -2588,7 +2589,8 @@
perspectiveValue = primitiveValue->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
else if (primitiveValue->isNumber()) {
// For backward compatibility, treat valueless numbers as px.
- perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
+ Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX));
+ perspectiveValue = value.get().computeLength<float>(state.style(), state.rootElementStyle(), zoomFactor);
} else
return;