Changeset 21911 in webkit
- Timestamp:
- May 30, 2007 10:21:11 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r21909 r21911 1 2007-05-30 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Oliver. 4 5 Update results for http://bugs.webkit.org/show_bug.cgi?id=13943 6 Autogenerate the JS bindings for the CSSStyleSheet 7 8 * fast/dom/Window/window-properties-expected.txt: 9 1 10 2007-05-30 Sam Weinig <sam@webkit.org> 2 11 -
trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt
r21909 r21911 213 213 window.CSSStyleRule [object CSSStyleRuleConstructor] 214 214 window.CSSStyleRule.prototype [printed above as window.CSSRule.prototype] 215 window.CSSStyleSheet [object StyleSheetConstructor] 216 window.CSSStyleSheet.prototype [object StyleSheetPrototype] 215 217 window.CSSValue [object CSSValueConstructor] 216 218 window.CSSValue.CSS_CUSTOM [number] … … 805 807 window.RangeException.prototype.INVALID_NODE_TYPE_ERR [number] 806 808 window.ReferenceError [function] 807 window.StyleSheet [object StyleSheetConstructor] 808 window.StyleSheet.prototype [object StyleSheetPrototype] 809 window.StyleSheet [printed above as window.CSSStyleSheet] 809 810 window.SyntaxError [function] 810 811 window.Text [object TextConstructor] -
trunk/WebCore/ChangeLog
r21910 r21911 1 2007-05-30 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Oliver. 4 5 Patch for http://bugs.webkit.org/show_bug.cgi?id=13943 6 Autogenerate the JS bindings for the CSSStyleSheet 7 8 * DerivedSources.make: 9 * WebCore.pro: 10 * WebCore.xcodeproj/project.pbxproj: 11 * bindings/js/JSStyleSheetCustom.cpp: 12 (WebCore::toJS): 13 * bindings/js/kjs_css.cpp: 14 * bindings/js/kjs_css.h: 15 * bindings/scripts/CodeGeneratorJS.pm: 16 * css/CSSStyleSheet.cpp: 17 (WebCore::CSSStyleSheet::addRule): 18 (WebCore::CSSStyleSheet::cssRules): 19 * css/CSSStyleSheet.h: 20 (WebCore::CSSStyleSheet::rules): 21 (WebCore::CSSStyleSheet::removeRule): 22 * css/CSSStyleSheet.idl: 23 * page/DOMWindow.idl: 24 1 25 2007-05-30 Sam Weinig <sam@webkit.org> 2 26 -
trunk/WebCore/DerivedSources.make
r21896 r21911 310 310 JSCSSRuleList.h \ 311 311 JSCSSStyleRule.h \ 312 JSCSSStyleSheet.h \ 312 313 JSCSSValue.h \ 313 314 JSCSSValueList.h \ -
trunk/WebCore/WebCore.pro
r21910 r21911 172 172 css/CSSStyleDeclaration.idl \ 173 173 css/CSSStyleRule.idl \ 174 css/CSSStyleSheet.idl \ 174 175 css/CSSValue.idl \ 175 176 css/CSSValueList.idl \ -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r21910 r21911 2854 2854 BCC47E2709A3D6F100ADB771 /* FontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC47E2509A3D6F100ADB771 /* FontFamily.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2855 2855 BCC47E6B09A3FE4700ADB771 /* FontDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC47E6A09A3FE4700ADB771 /* FontDescription.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2856 BCC5BE000C0E93110011C2DB /* JSCSSStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC5BDFE0C0E93110011C2DB /* JSCSSStyleSheet.cpp */; }; 2857 BCC5BE010C0E93110011C2DB /* JSCSSStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC5BDFF0C0E93110011C2DB /* JSCSSStyleSheet.h */; }; 2856 2858 BCC71A130A0FF94D0014EE6E /* GlyphBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC71A120A0FF94D0014EE6E /* GlyphBuffer.h */; }; 2857 2859 BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; }; … … 6128 6130 BCC47E2509A3D6F100ADB771 /* FontFamily.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontFamily.h; sourceTree = "<group>"; }; 6129 6131 BCC47E6A09A3FE4700ADB771 /* FontDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontDescription.h; sourceTree = "<group>"; }; 6132 BCC5BDFE0C0E93110011C2DB /* JSCSSStyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleSheet.cpp; sourceTree = "<group>"; }; 6133 BCC5BDFF0C0E93110011C2DB /* JSCSSStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSStyleSheet.h; sourceTree = "<group>"; }; 6130 6134 BCC71A120A0FF94D0014EE6E /* GlyphBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GlyphBuffer.h; sourceTree = "<group>"; }; 6131 6135 BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ColorData.gperf; sourceTree = "<group>"; }; … … 6467 6471 BC46C2040C0DDCA10020CFC3 /* JSCSSStyleRule.cpp */, 6468 6472 BC46C2050C0DDCA10020CFC3 /* JSCSSStyleRule.h */, 6473 BCC5BDFE0C0E93110011C2DB /* JSCSSStyleSheet.cpp */, 6474 BCC5BDFF0C0E93110011C2DB /* JSCSSStyleSheet.h */, 6469 6475 14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */, 6470 6476 14CF78A509F58CD800EB3665 /* JSCSSValue.h */, … … 11493 11499 BC46C2030C0DDC8F0020CFC3 /* JSCSSPageRule.h in Headers */, 11494 11500 BC46C2070C0DDCA10020CFC3 /* JSCSSStyleRule.h in Headers */, 11501 BCC5BE010C0E93110011C2DB /* JSCSSStyleSheet.h in Headers */, 11495 11502 ); 11496 11503 runOnlyForDeploymentPostprocessing = 0; … … 12904 12911 BC46C2060C0DDCA10020CFC3 /* JSCSSStyleRule.cpp in Sources */, 12905 12912 BC20FB7F0C0E8E6C00D1447F /* JSCSSValueCustom.cpp in Sources */, 12913 BCC5BE000C0E93110011C2DB /* JSCSSStyleSheet.cpp in Sources */, 12906 12914 ); 12907 12915 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/JSStyleSheetCustom.cpp
r21873 r21911 28 28 29 29 #include "CSSStyleSheet.h" 30 #include "kjs_css.h" 30 #include "JSCSSStyleSheet.h" 31 #include "StyleSheet.h" 31 32 32 33 namespace WebCore { … … 43 44 44 45 if (styleSheet->isCSSStyleSheet()) 45 ret = new KJS::DOMCSSStyleSheet(exec, static_cast<CSSStyleSheet*>(styleSheet));46 ret = new JSCSSStyleSheet(exec, static_cast<CSSStyleSheet*>(styleSheet)); 46 47 else 47 48 ret = new JSStyleSheet(exec, styleSheet); -
trunk/WebCore/bindings/js/kjs_css.cpp
r21910 r21911 158 158 // ------------------------------------------------------------------------- 159 159 160 const ClassInfo DOMCSSStyleSheet::info = { "CSSStyleSheet", &WebCore::JSStyleSheet::info, &DOMCSSStyleSheetTable, 0 };161 162 /*163 @begin DOMCSSStyleSheetTable 5164 ownerRule DOMCSSStyleSheet::OwnerRule DontDelete|ReadOnly165 cssRules DOMCSSStyleSheet::CssRules DontDelete|ReadOnly166 # MSIE extension167 rules DOMCSSStyleSheet::Rules DontDelete|ReadOnly168 @end169 @begin DOMCSSStyleSheetPrototypeTable 6170 insertRule DOMCSSStyleSheet::InsertRule DontDelete|Function 2171 deleteRule DOMCSSStyleSheet::DeleteRule DontDelete|Function 1172 # MSIE extensions173 addRule DOMCSSStyleSheet::AddRule DontDelete|Function 2174 removeRule DOMCSSStyleSheet::RemoveRule DontDelete|Function 1175 @end176 */177 KJS_DEFINE_PROTOTYPE(DOMCSSStyleSheetPrototype)178 KJS_IMPLEMENT_PROTOTYPE_FUNCTION(DOMCSSStyleSheetPrototypeFunction)179 KJS_IMPLEMENT_PROTOTYPE("DOMCSSStyleSheet",DOMCSSStyleSheetPrototype,DOMCSSStyleSheetPrototypeFunction) // warning, use _WITH_PARENT if DOMStyleSheet gets a prototype180 181 DOMCSSStyleSheet::DOMCSSStyleSheet(ExecState* exec, CSSStyleSheet *ss)182 : JSStyleSheet(exec, ss)183 {184 setPrototype(DOMCSSStyleSheetPrototype::self(exec));185 }186 187 DOMCSSStyleSheet::~DOMCSSStyleSheet()188 {189 }190 191 JSValue* DOMCSSStyleSheet::getValueProperty(ExecState* exec, int token) const192 {193 switch (token) {194 case OwnerRule:195 return toJS(exec, static_cast<CSSStyleSheet*>(impl())->ownerRule());196 case CssRules:197 return toJS(exec, static_cast<CSSStyleSheet*>(impl())->cssRules());198 case Rules:199 return toJS(exec, static_cast<CSSStyleSheet*>(impl())->cssRules(true));200 default:201 ASSERT(0);202 return jsUndefined();203 }204 }205 206 bool DOMCSSStyleSheet::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)207 {208 return getStaticValueSlot<DOMCSSStyleSheet, JSStyleSheet>(exec, &DOMCSSStyleSheetTable, this, propertyName, slot);209 }210 211 JSValue* DOMCSSStyleSheetPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args)212 {213 if (!thisObj->inherits(&KJS::DOMCSSStyleSheet::info))214 return throwError(exec, TypeError);215 DOMExceptionTranslator exception(exec);216 CSSStyleSheet &styleSheet = *static_cast<CSSStyleSheet*>(static_cast<DOMCSSStyleSheet*>(thisObj)->impl());217 switch (id) {218 case DOMCSSStyleSheet::InsertRule:219 return jsNumber(styleSheet.insertRule(args[0]->toString(exec), args[1]->toInt32(exec), exception));220 case DOMCSSStyleSheet::DeleteRule:221 styleSheet.deleteRule(args[0]->toInt32(exec), exception);222 return jsUndefined();223 case DOMCSSStyleSheet::AddRule: {224 int index = args.size() >= 3 ? args[2]->toInt32(exec) : -1;225 styleSheet.addRule(args[0]->toString(exec), args[1]->toString(exec), index, exception);226 // As per Microsoft documentation, always return -1.227 return jsNumber(-1);228 }229 case DOMCSSStyleSheet::RemoveRule: {230 int index = args.size() >= 1 ? args[0]->toInt32(exec) : 0;231 styleSheet.removeRule(index, exception);232 return jsUndefined();233 }234 }235 return jsUndefined();236 }237 238 // -------------------------------------------------------------------------239 240 160 const ClassInfo DOMRGBColor::info = { "RGBColor", 0, &DOMRGBColorTable, 0 }; 241 161 -
trunk/WebCore/bindings/js/kjs_css.h
r21910 r21911 61 61 JSValue* toJS(ExecState*, WebCore::StyleSheetList*, WebCore::Document*); 62 62 63 class DOMCSSStyleSheet : public WebCore::JSStyleSheet {64 public:65 DOMCSSStyleSheet(ExecState*, WebCore::CSSStyleSheet*);66 virtual ~DOMCSSStyleSheet();67 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);68 JSValue* getValueProperty(ExecState*, int token) const;69 // no put - all read-only70 virtual const ClassInfo* classInfo() const { return &info; }71 static const ClassInfo info;72 enum { OwnerRule, CssRules, Rules, InsertRule, DeleteRule, AddRule, RemoveRule };73 };74 75 63 class DOMRGBColor : public DOMObject { 76 64 public: -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r21910 r21911 1491 1491 $implIncludes{"kjs_dom.h"} = 1; 1492 1492 $implIncludes{"NamedNodeMap.h"} = 1; 1493 } elsif ($type eq "CSSStyleSheet") {1494 $implIncludes{"CSSStyleSheet.h"} = 1;1495 $implIncludes{"kjs_css.h"} = 1;1496 1493 } elsif ($type eq "Rect") { 1497 1494 $implIncludes{"RectImpl.h"} = 1; -
trunk/WebCore/css/CSSStyleSheet.cpp
r17825 r21911 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 5 * Copyright (C) 2004, 2006 Apple Computer, Inc.3 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 20 18 * Boston, MA 02111-1307, USA. 21 19 */ 20 22 21 #include "config.h" 23 22 #include "CSSStyleSheet.h" … … 25 24 #include "CSSImportRule.h" 26 25 #include "CSSNamespace.h" 27 #include "cssparser.h"28 26 #include "CSSRuleList.h" 29 27 #include "Document.h" 30 28 #include "ExceptionCode.h" 31 29 #include "Node.h" 30 #include "cssparser.h" 32 31 33 32 namespace WebCore { … … 95 94 } 96 95 97 unsigned CSSStyleSheet::addRule(const String &selector, const String &style, int index, ExceptionCode& ec) 98 { 99 if (index == -1) 100 index = length(); 101 return insertRule(selector + " { " + style + " }", index, ec); 102 } 103 104 CSSRuleList *CSSStyleSheet::cssRules(bool omitCharsetRules) 96 int CSSStyleSheet::addRule(const String& selector, const String& style, int index, ExceptionCode& ec) 97 { 98 insertRule(selector + " { " + style + " }", index, ec); 99 100 // As per Microsoft documentation, always return -1. 101 return -1; 102 } 103 104 int CSSStyleSheet::addRule(const String& selector, const String& style, ExceptionCode& ec) 105 { 106 return addRule(selector, style, length(), ec); 107 } 108 109 110 CSSRuleList* CSSStyleSheet::cssRules(bool omitCharsetRules) 105 111 { 106 112 return new CSSRuleList(this, omitCharsetRules); -
trunk/WebCore/css/CSSStyleSheet.h
r18874 r21911 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 5 * Copyright (C) 2004, 2006 Apple Computer, Inc.3 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 37 35 typedef int ExceptionCode; 38 36 39 class CSSStyleSheet : public StyleSheet 40 { 37 class CSSStyleSheet : public StyleSheet { 41 38 public: 42 39 CSSStyleSheet(Node* parentNode, const String& href = String(), const String& charset = String()); … … 54 51 unsigned insertRule(const String& rule, unsigned index, ExceptionCode&); 55 52 void deleteRule(unsigned index, ExceptionCode&); 56 unsigned addRule(const String& selector, const String& style, int index, ExceptionCode&); 53 54 // IE Extensions 55 CSSRuleList* rules() { return cssRules(true); } 56 int addRule(const String& selector, const String& style, int index, ExceptionCode&); 57 int addRule(const String& selector, const String& style, ExceptionCode&); 57 58 void removeRule(unsigned index, ExceptionCode& ec) { deleteRule(index, ec); } 58 59 void removeRule(ExceptionCode& ec) { deleteRule(0, ec); } 60 59 61 void addNamespace(CSSParser*, const AtomicString& prefix, const AtomicString& uri); 60 62 const AtomicString& determineNamespace(const AtomicString& prefix); -
trunk/WebCore/css/CSSStyleSheet.idl
r16645 r21911 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 31 31 void deleteRule(in unsigned long index) 32 32 raises(DOMException); 33 34 // IE Extensions 35 readonly attribute CSSRuleList rules; 36 37 long addRule(in DOMString selector, 38 in DOMString style, 39 in [Optional] unsigned long index) 40 raises(DOMException); 41 void removeRule(in [Optional] unsigned long index) 42 raises(DOMException); 33 43 }; 34 44 -
trunk/WebCore/page/DOMWindow.idl
r21909 r21911 43 43 44 44 // Global constructors 45 attribute StyleSheetConstructor StyleSheet; 46 attribute CSSStyleSheetConstructor CSSStyleSheet; 47 48 attribute CSSValueConstructor CSSValue; 45 49 attribute CSSPrimitiveValueConstructor CSSPrimitiveValue; 50 attribute CSSValueListConstructor CSSValueList; 51 46 52 attribute CSSRuleConstructor CSSRule; 47 53 attribute CSSCharsetRuleConstructor CSSCharsetRule; … … 51 57 attribute CSSPageRuleConstructor CSSPageRule; 52 58 attribute CSSStyleRuleConstructor CSSStyleRule; 59 53 60 attribute CSSStyleDeclarationConstructor CSSStyleDeclaration; 54 attribute CSSValueConstructor CSSValue;55 61 attribute MediaListConstructor MediaList; 56 attribute StyleSheetConstructor StyleSheet;57 62 attribute CounterConstructor Counter; 58 63 attribute CSSRuleListConstructor CSSRuleList; 59 attribute CSSValueListConstructor CSSValueList;60 64 61 65 // FIXME: Implement the commented-out global constructors for interfaces listed in DOM Level 3 Core specification.
Note: See TracChangeset
for help on using the changeset viewer.