Title: [92342] trunk/Source/WebCore
Revision
92342
Author
[email protected]
Date
2011-08-03 19:09:19 -0700 (Wed, 03 Aug 2011)

Log Message

Support cast between CSSPrimitiveValue and EBoxSizing, use in CSSStyleSelector.
https://bugs.webkit.org/show_bug.cgi?id=65657

Reviewed by Simon Fraser.

No new tests / refactoring only.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
Implement cast from EBoxSizing.
(WebCore::CSSPrimitiveValue::operator EBoxSizing):
Implement cast to EBoxSizing.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
Use appropriate macro to simplify code using cast.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92341 => 92342)


--- trunk/Source/WebCore/ChangeLog	2011-08-04 02:01:31 UTC (rev 92341)
+++ trunk/Source/WebCore/ChangeLog	2011-08-04 02:09:19 UTC (rev 92342)
@@ -1,3 +1,21 @@
+2011-08-03  Luke Macpherson   <[email protected]>
+
+        Support cast between CSSPrimitiveValue and EBoxSizing, use in CSSStyleSelector.
+        https://bugs.webkit.org/show_bug.cgi?id=65657
+
+        Reviewed by Simon Fraser.
+
+        No new tests / refactoring only.
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        Implement cast from EBoxSizing.
+        (WebCore::CSSPrimitiveValue::operator EBoxSizing):
+        Implement cast to EBoxSizing.
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        Use appropriate macro to simplify code using cast.
+
 2011-08-03  Ian Henderson  <[email protected]>
 
         Draw rectangular box shadow for elements with border-radius if no corners are visible

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (92341 => 92342)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-08-04 02:01:31 UTC (rev 92341)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-08-04 02:09:19 UTC (rev 92342)
@@ -597,6 +597,33 @@
     }
 }
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxSizing e)
+    : m_type(CSS_IDENT)
+    , m_hasCachedCSSText(false)
+{
+    switch (e) {
+    case BORDER_BOX:
+        m_value.ident = CSSValueBorderBox;
+        break;
+    case CONTENT_BOX:
+        m_value.ident = CSSValueContentBox;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator EBoxSizing() const
+{
+    switch (m_value.ident) {
+    case CSSValueBorderBox:
+        return BORDER_BOX;
+    case CSSValueContentBox:
+        return CONTENT_BOX;
+    default:
+        ASSERT_NOT_REACHED();
+        return BORDER_BOX;
+    }
+}
+
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)
     : m_type(CSS_IDENT)
     , m_hasCachedCSSText(false)

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (92341 => 92342)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-04 02:01:31 UTC (rev 92341)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-04 02:09:19 UTC (rev 92342)
@@ -4546,13 +4546,7 @@
         m_style->setBoxOrdinalGroup((unsigned int)(primitiveValue->getDoubleValue()));
         return;
     case CSSPropertyBoxSizing:
-        HANDLE_INHERIT_AND_INITIAL(boxSizing, BoxSizing)
-        if (!primitiveValue)
-            return;
-        if (primitiveValue->getIdent() == CSSValueContentBox)
-            m_style->setBoxSizing(CONTENT_BOX);
-        else
-            m_style->setBoxSizing(BORDER_BOX);
+        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(boxSizing, BoxSizing);
         return;
     case CSSPropertyWebkitColumnSpan: {
         HANDLE_INHERIT_AND_INITIAL(columnSpan, ColumnSpan)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to