Title: [89448] trunk/Source/WebCore
Revision
89448
Author
macpher...@chromium.org
Date
2011-06-22 10:42:28 -0700 (Wed, 22 Jun 2011)

Log Message

2011-06-22  Luke Macpherson   <macpher...@chromium.org>

        Reviewed by Dimitri Glazkov.

        Support cast from CSSPrimitiveValue to short and use for CSSPropertyWidows and CSSPropertyOrphans.
        https://bugs.webkit.org/show_bug.cgi?id=62964

        No new tests / refactoring only.

        * css/CSSPrimitiveValueMappings.h:
        Support cast to/from short.
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        Use cast to short to allow CSSPropertWidows and CSSPropertyOrphans to use existing macro.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89447 => 89448)


--- trunk/Source/WebCore/ChangeLog	2011-06-22 17:27:22 UTC (rev 89447)
+++ trunk/Source/WebCore/ChangeLog	2011-06-22 17:42:28 UTC (rev 89448)
@@ -1,3 +1,18 @@
+2011-06-22  Luke Macpherson   <macpher...@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Support cast from CSSPrimitiveValue to short and use for CSSPropertyWidows and CSSPropertyOrphans.
+        https://bugs.webkit.org/show_bug.cgi?id=62964
+
+        No new tests / refactoring only.
+
+        * css/CSSPrimitiveValueMappings.h:
+        Support cast to/from short.
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        Use cast to short to allow CSSPropertWidows and CSSPropertyOrphans to use existing macro.
+
 2011-06-22  Eunmi Lee  <eunmi15....@samsung.com>
 
         Reviewed by Martin Robinson.

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (89447 => 89448)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-06-22 17:27:22 UTC (rev 89447)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-06-22 17:42:28 UTC (rev 89448)
@@ -47,6 +47,22 @@
 
 namespace WebCore {
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i)
+    : m_type(CSS_NUMBER)
+    , m_hasCachedCSSText(false)
+{
+    m_value.num = static_cast<double>(i);
+}
+
+template<> inline CSSPrimitiveValue::operator short() const
+{
+    if (m_type == CSS_NUMBER) // Valid for CSS outline-style
+        return static_cast<short>(m_value.num);
+
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
     : m_type(CSS_IDENT)
     , m_hasCachedCSSText(false)

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (89447 => 89448)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-06-22 17:27:22 UTC (rev 89447)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-06-22 17:42:28 UTC (rev 89448)
@@ -4030,23 +4030,11 @@
         return;
     }
     case CSSPropertyWidows:
-    {
-        HANDLE_INHERIT_AND_INITIAL(widows, Widows)
-        if (!primitiveValue || primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
-            return;
-        m_style->setWidows(primitiveValue->getIntValue());
+        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(widows, Widows)
         return;
-    }
-        
     case CSSPropertyOrphans:
-    {
-        HANDLE_INHERIT_AND_INITIAL(orphans, Orphans)
-        if (!primitiveValue || primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
-            return;
-        m_style->setOrphans(primitiveValue->getIntValue());
+        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(orphans, Orphans)
         return;
-    }        
-
 // length, percent, number
     case CSSPropertyLineHeight:
     {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to