Added support for -apple-dashboard-region:none. And fixed
authorrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Oct 2004 21:31:02 +0000 (21:31 +0000)
committerrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Oct 2004 21:31:02 +0000 (21:31 +0000)
a few computed style problems.

        Fixed <rdar://problem/3833532> -apple-dashboard-region: none; is needed
        Reviewed by Hyatt.

        * khtml/css/css_computedstyle.cpp:
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        * khtml/css/css_valueimpl.cpp:
        (CSSPrimitiveValueImpl::cssText):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (CSSParser::parseDashboardRegions):
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/rendering/render_style.cpp:
        (RenderStyle::noneDashboardRegions):
        * khtml/rendering/render_style.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::dashboardRegionsDictionary):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7826 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/css/css_computedstyle.cpp
WebCore/khtml/css/css_valueimpl.cpp
WebCore/khtml/css/cssparser.cpp
WebCore/khtml/css/cssstyleselector.cpp
WebCore/khtml/rendering/render_style.cpp
WebCore/khtml/rendering/render_style.h
WebCore/kwq/KWQKHTMLPart.mm

index ca5318f408440e58e75d9c59bfe58255db9413a8..8e57af7409e7a18b9b076dd631f75e818425366a 100644 (file)
@@ -1,3 +1,26 @@
+2004-10-13  Richard Williamson   <rjw@apple.com>
+
+        Added support for -apple-dashboard-region:none.  And fixed
+       a few computed style problems.
+
+        Fixed <rdar://problem/3833532> -apple-dashboard-region: none; is needed
+        Reviewed by Hyatt.
+
+        * khtml/css/css_computedstyle.cpp:
+        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
+        * khtml/css/css_valueimpl.cpp:
+        (CSSPrimitiveValueImpl::cssText):
+        * khtml/css/cssparser.cpp:
+        (CSSParser::parseValue):
+        (CSSParser::parseDashboardRegions):
+        * khtml/css/cssstyleselector.cpp:
+        (khtml::CSSStyleSelector::applyProperty):
+        * khtml/rendering/render_style.cpp:
+        (RenderStyle::noneDashboardRegions):
+        * khtml/rendering/render_style.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::dashboardRegionsDictionary):
+
 2004-10-13  David Hyatt  <hyatt@apple.com>
 
        Rework block layout to clean it up and simplify it (r=kocienda).  
index b77559a1097f85fef7d4ab5af3b8ce7e258e22bb..f12ca4a204da1541dce414ffd22312bc3ecaeffd 100644 (file)
@@ -810,6 +810,10 @@ CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyI
             uint i, count = regions.count();
             DashboardRegionImpl *firstRegion = new DashboardRegionImpl(), *region;
             region = firstRegion;
+            
+            if (count == 1 && regions[0].type == StyleDashboardRegion::None)
+                return new CSSPrimitiveValueImpl (CSS_VAL_NONE);
+                
             for (i = 0; i < count; i++) {
                 StyleDashboardRegion styleRegion = regions[i];
                 region->m_label = styleRegion.label;
index 4670df4e03b032d41ebb932864e66bbf19c008a1..cdfde96b7824e26c30c550ac72a2fc6bb44be86d 100644 (file)
@@ -823,19 +823,19 @@ DOM::DOMString CSSPrimitiveValueImpl::cssText() const
                 text = "dashboard-region(";
                 text += region->m_label;
                 if (region->m_isCircle){
-                    text = " circle ";
+                    text += " circle ";
                 }
                 else if (region->m_isRectangle){
-                    text = " rectangle ";
+                    text += " rectangle ";
                 }
                 else
                     break;
-                text += " ";
                 text += region->top()->cssText() + " ";
                 text += region->right()->cssText() + " ";
                 text += region->bottom()->cssText() + " ";
                 text += region->left()->cssText();
                 text += ")";
+                region = region->m_next;
             }
             break;
         }
index 96b9a25b3e7a52e134d37040cbfc4e73bff49f22..4445082bcf9767407da358c212229d60aa9816e8 100644 (file)
@@ -523,7 +523,7 @@ bool CSSParser::parseValue( int propId, bool important )
 
 #if APPLE_CHANGES
     case CSS_PROP__APPLE_DASHBOARD_REGION:                 // <dashboard-region> | <dashboard-region> 
-       if ( value->unit == Value::Function )
+       if ( value->unit == Value::Function || id == CSS_VAL_NONE)
            return parseDashboardRegions( propId, important );
        break;
 #endif
@@ -1538,9 +1538,15 @@ bool CSSParser::parseDashboardRegions( int propId, bool important )
 {
     bool valid = true;
     
+    Value *value = valueList->current();
+
+    if (value->id == CSS_VAL_NONE) {
+        addProperty( propId, new CSSPrimitiveValueImpl( value->id ), important );
+        return valid;
+    }
+        
     DashboardRegionImpl *firstRegion = new DashboardRegionImpl(), *region = 0;
 
-    Value *value = valueList->current();
     while (value) {
         if (region == 0) {
             region = firstRegion;
index 7cfc653e81956cda7a057b516a567d5eaf881ca0..5316d89fbd8775f2ff67e2c3673cfb53685cb3a9 100644 (file)
@@ -3776,10 +3776,14 @@ void CSSStyleSelector::applyProperty( int id, DOM::CSSValueImpl *value )
     }
     case CSS_PROP__APPLE_DASHBOARD_REGION: {
         HANDLE_INHERIT_AND_INITIAL(dashboardRegions, DashboardRegions)
-
         if (!primitiveValue)
             return;
 
+        if(primitiveValue->getIdent() == CSS_VAL_NONE) {
+            style->setDashboardRegions(RenderStyle::noneDashboardRegions());
+            return;
+        }
+
         DashboardRegionImpl *region = primitiveValue->getDashboardRegionValue();
         if (!region)
             return;
index 52f0240307b099f0c3a4ecc46096f723bcade3b9..ab268eebb69c52c1c0e7aeba14e021111ecf1d09 100644 (file)
@@ -934,3 +934,22 @@ const QValueList<StyleDashboardRegion>& RenderStyle::initialDashboardRegions()
     static QValueList<StyleDashboardRegion> emptyList;
     return emptyList;
 }
+
+const QValueList<StyleDashboardRegion>& RenderStyle::noneDashboardRegions()
+{ 
+    static QValueList<StyleDashboardRegion> noneList;
+    static bool noneListInitialized = false;
+    
+    if (!noneListInitialized) {
+        StyleDashboardRegion region;
+        region.label = "";
+        region.offset.top  = Length();
+        region.offset.right = Length();
+        region.offset.bottom = Length();
+        region.offset.left = Length();
+        region.type = StyleDashboardRegion::None;
+        noneList.append (region);
+        noneListInitialized = true;
+    }
+    return noneList;
+}
index 6a1bc9505b9c806aa71aa98f2a9f205ed041cfad..8801b5f6fcdf563501a1541201f15f9ce86c683c 100644 (file)
@@ -1485,6 +1485,7 @@ public:
     static int initialLineClamp() { return -1; }
     static bool initialTextSizeAdjust() { return true; }
     static const QValueList<StyleDashboardRegion>& initialDashboardRegions();
+    static const QValueList<StyleDashboardRegion>& noneDashboardRegions();
 #endif
 };
 
index 1ffb7c985b5feeb4434028a8b9476ce2d966b192..e8a0209121abff535a51ae275e407b8589f056e3 100644 (file)
@@ -4143,6 +4143,10 @@ NSMutableDictionary *KWQKHTMLPart::dashboardRegionsDictionary()
     NSMutableDictionary *webRegions = [[[NSMutableDictionary alloc] initWithCapacity:count] autorelease];
     for (i = 0; i < count; i++) {
         DashboardRegionValue region = regions[i];
+
+        if (region.type == StyleDashboardRegion::None)
+            continue;
+            
         NSRect clip;
         clip.origin.x = region.clip.x();
         clip.origin.y = region.clip.y();