Title: [110985] trunk/Source/WebCore
- Revision
- 110985
- Author
- macpher...@chromium.org
- Date
- 2012-03-16 04:25:54 -0700 (Fri, 16 Mar 2012)
Log Message
Implement cast between CSSPrimitiveValue and LineClampValue.
https://bugs.webkit.org/show_bug.cgi?id=76806
Reviewed by Andreas Kling.
Covered by many existing LayoutTests.
This simplifies code in CSSStyleSelector and future mapping to CSSStyleApplyProperty.
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator LineClampValue):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (110984 => 110985)
--- trunk/Source/WebCore/ChangeLog 2012-03-16 11:03:23 UTC (rev 110984)
+++ trunk/Source/WebCore/ChangeLog 2012-03-16 11:25:54 UTC (rev 110985)
@@ -1,3 +1,20 @@
+2012-03-16 Luke Macpherson <macpher...@chromium.org>
+
+ Implement cast between CSSPrimitiveValue and LineClampValue.
+ https://bugs.webkit.org/show_bug.cgi?id=76806
+
+ Reviewed by Andreas Kling.
+
+ Covered by many existing LayoutTests.
+
+ This simplifies code in CSSStyleSelector and future mapping to CSSStyleApplyProperty.
+
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ (WebCore::CSSPrimitiveValue::operator LineClampValue):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+
2012-03-16 Nat Duca <nd...@chromium.org>
[chromium] Bump textureUpdatesPerFrame to 32 to favor updating the screen over jank prevention
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (110984 => 110985)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2012-03-16 11:03:23 UTC (rev 110984)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2012-03-16 11:25:54 UTC (rev 110985)
@@ -37,6 +37,7 @@
#include "FontSmoothingMode.h"
#include "GraphicsTypes.h"
#include "Length.h"
+#include "LineClampValue.h"
#include "Path.h"
#include "RenderStyleConstants.h"
#include "SVGRenderStyleDefs.h"
@@ -121,6 +122,25 @@
return 0.0f;
}
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineClampValue i)
+ : CSSValue(PrimitiveClass)
+{
+ m_primitiveUnitType = i.isPercentage() ? CSS_PERCENTAGE : CSS_NUMBER;
+ m_value.num = static_cast<double>(i.value());
+}
+
+template<> inline CSSPrimitiveValue::operator LineClampValue() const
+{
+ if (m_primitiveUnitType == CSS_NUMBER)
+ return LineClampValue(clampTo<int>(m_value.num), LineClampLineCount);
+
+ if (m_primitiveUnitType == CSS_PERCENTAGE)
+ return LineClampValue(clampTo<int>(m_value.num), LineClampPercentage);
+
+ ASSERT_NOT_REACHED();
+ return LineClampValue();
+}
+
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
: CSSValue(PrimitiveClass)
{
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (110984 => 110985)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-03-16 11:03:23 UTC (rev 110984)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-03-16 11:25:54 UTC (rev 110985)
@@ -3466,16 +3466,9 @@
}
return;
}
- case CSSPropertyWebkitLineClamp: {
- HANDLE_INHERIT_AND_INITIAL(lineClamp, LineClamp)
- if (!primitiveValue)
- return;
- if (primitiveValue->isNumber())
- m_style->setLineClamp(LineClampValue(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_NUMBER), LineClampLineCount));
- else if (primitiveValue->isPercentage())
- m_style->setLineClamp(LineClampValue(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_PERCENTAGE), LineClampPercentage));
+ case CSSPropertyWebkitLineClamp:
+ HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(lineClamp, LineClamp)
return;
- }
case CSSPropertyWebkitLocale: {
HANDLE_INHERIT_AND_INITIAL(locale, Locale);
if (primitiveValue->getIdent() == CSSValueAuto)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes