Title: [102544] trunk/Source/WebCore
Revision
102544
Author
macpher...@chromium.org
Date
2011-12-11 16:24:29 -0800 (Sun, 11 Dec 2011)

Log Message

Implement CSS resize property in CSSStyleApplyProperty.
https://bugs.webkit.org/show_bug.cgi?id=74162

Reviewed by Julien Chaffraix.

No new tests / refactoring only.

* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyResize::applyValue):
(WebCore::ApplyPropertyResize::createHandler):
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102543 => 102544)


--- trunk/Source/WebCore/ChangeLog	2011-12-11 23:07:54 UTC (rev 102543)
+++ trunk/Source/WebCore/ChangeLog	2011-12-12 00:24:29 UTC (rev 102544)
@@ -1,3 +1,19 @@
+2011-12-11  Luke Macpherson   <macpher...@chromium.org>
+
+        Implement CSS resize property in CSSStyleApplyProperty.
+        https://bugs.webkit.org/show_bug.cgi?id=74162
+
+        Reviewed by Julien Chaffraix.
+
+        No new tests / refactoring only.
+
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyResize::applyValue):
+        (WebCore::ApplyPropertyResize::createHandler):
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+
 2011-12-11  Andreas Kling  <kl...@webkit.org>
 
         Move CSSElementStyleDeclaration to its own cpp/h files.

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (102543 => 102544)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-12-11 23:07:54 UTC (rev 102543)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-12-12 00:24:29 UTC (rev 102544)
@@ -37,6 +37,7 @@
 #include "Pair.h"
 #include "RenderObject.h"
 #include "RenderStyle.h"
+#include "Settings.h"
 #include <wtf/StdLibExtras.h>
 #include <wtf/UnusedParam.h>
 
@@ -1169,6 +1170,36 @@
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
 };
 
+class ApplyPropertyResize {
+public:
+    static void applyValue(CSSStyleSelector* selector, CSSValue* value)
+    {
+        if (!value->isPrimitiveValue())
+            return;
+
+        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+
+        EResize r = RESIZE_NONE;
+        switch (primitiveValue->getIdent()) {
+        case 0:
+            return;
+        case CSSValueAuto:
+            if (Settings* settings = selector->document()->settings())
+                r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
+            break;
+        default:
+            r = *primitiveValue;
+        }
+        selector->style()->setResize(r);
+    }
+
+    static PropertyHandler createHandler()
+    {
+        PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize>::createHandler();
+        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
+    }
+};
+
 class ApplyPropertyVerticalAlign {
 public:
     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
@@ -1520,6 +1551,8 @@
     setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler());
     setPropertyHandler(CSSPropertyPadding, ApplyPropertyExpanding<SuppressValue, CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft>::createHandler());
 
+    setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
+
     setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
 
     setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (102543 => 102544)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-11 23:07:54 UTC (rev 102543)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-12 00:24:29 UTC (rev 102544)
@@ -2724,24 +2724,6 @@
     case CSSPropertyWebkitMatchNearestMailBlockquoteColor:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(matchNearestMailBlockquoteColor, MatchNearestMailBlockquoteColor)
         return;
-
-    case CSSPropertyResize:
-    {
-        HANDLE_INHERIT_AND_INITIAL(resize, Resize)
-
-        if (!primitiveValue->getIdent())
-            return;
-
-        EResize r = RESIZE_NONE;
-        if (primitiveValue->getIdent() == CSSValueAuto) {
-            if (Settings* settings = m_checker.document()->settings())
-                r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
-        } else
-            r = *primitiveValue;
-
-        m_style->setResize(r);
-        return;
-    }
     case CSSPropertyFontSize:
     {
         FontDescription fontDescription = m_style->fontDescription();
@@ -3932,6 +3914,7 @@
     case CSSPropertyPaddingBottom:
     case CSSPropertyPaddingLeft:
     case CSSPropertyPadding:
+    case CSSPropertyResize:
     case CSSPropertySize:
     case CSSPropertyTextAlign:
     case CSSPropertyTextIndent:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to