[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

antti at apple.com antti at apple.com
Wed Dec 22 15:57:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0fa74f17dadde8356f613bffb50f7d613c997801
Author: antti at apple.com <antti at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 17 03:15:47 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=31223
    Make primitive values immutable.
    
    Patch by Antti Koivisto <koivisto at iki.fi> on 2010-11-16
    Reviewed by Adam Barth.
    
    Make CSSPrimitiveValue setFloatValue and setStringValue always throw NO_MODIFICATION_ALLOWED exception.
    
    Reasoning:
    - these setters never worked correctly, style was not invalidated so changing values would have no effect on rendering
    - computed style is immutable in all cases, and it wasn't
    - no other engine seems to support mutable primitives, as a result there is no content using these APIs
    - mutable primitive values are pointless, the usual way to change the value of a propertly is to replace it with a new value
    - allowing mutation of primitive values makes optimizations harder
    
    * css/CSSPrimitiveValue.cpp:
    (WebCore::CSSPrimitiveValue::setFloatValue):
    (WebCore::CSSPrimitiveValue::setStringValue):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72163 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index cb662ee..2e93b93 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-11-16  Antti Koivisto  <koivisto at iki.fi>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31223
+        Make primitive values immutable.
+        
+        Make CSSPrimitiveValue setFloatValue and setStringValue always throw NO_MODIFICATION_ALLOWED exception.
+    
+        Reasoning:
+        - these setters never worked correctly, style was not invalidated so changing values would have no effect on rendering
+        - computed style is immutable in all cases, and it wasn't
+        - no other engine seems to support mutable primitives, as a result there is no content using these APIs
+        - mutable primitive values are pointless, the usual way to change the value of a propertly is to replace it with a new value
+        - allowing mutation of primitive values makes optimizations harder
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::setFloatValue):
+        (WebCore::CSSPrimitiveValue::setStringValue):
+
 2010-11-16  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp
index e03219a..032eb7e 100644
--- a/WebCore/css/CSSPrimitiveValue.cpp
+++ b/WebCore/css/CSSPrimitiveValue.cpp
@@ -407,19 +407,12 @@ double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r
     return zoomedResult;
 }
 
-void CSSPrimitiveValue::setFloatValue(unsigned short unitType, double floatValue, ExceptionCode& ec)
+void CSSPrimitiveValue::setFloatValue(unsigned short, double, ExceptionCode& ec)
 {
-    ec = 0;
-
-    if (m_type < CSS_NUMBER || m_type > CSS_DIMENSION || unitType < CSS_NUMBER || unitType > CSS_DIMENSION) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
-    cleanup();
-
-    m_value.num = floatValue;
-    m_type = unitType;
+    // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects. 
+    // No other engine supports mutating style through this API. Computed style is always read-only anyway.
+    // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
+    ec = NO_MODIFICATION_ALLOWED_ERR;
 }
 
 static double scaleFactorForConversion(unsigned short unitType)
@@ -496,23 +489,12 @@ double CSSPrimitiveValue::getDoubleValue(unsigned short unitType)
 }
 
 
-void CSSPrimitiveValue::setStringValue(unsigned short stringType, const String& stringValue, ExceptionCode& ec)
+void CSSPrimitiveValue::setStringValue(unsigned short, const String&, ExceptionCode& ec)
 {
-    ec = 0;
-
-    if (m_type < CSS_STRING || m_type > CSS_ATTR || stringType < CSS_STRING || stringType > CSS_ATTR) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
-    cleanup();
-
-    if (stringType != CSS_IDENT) {
-        m_value.string = stringValue.impl();
-        m_value.string->ref();
-        m_type = stringType;
-    }
-    // FIXME: parse ident
+    // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects. 
+    // No other engine supports mutating style through this API. Computed style is always read-only anyway.
+    // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
+    ec = NO_MODIFICATION_ALLOWED_ERR;
 }
 
 String CSSPrimitiveValue::getStringValue(ExceptionCode& ec) const

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list