Changeset 84527 in webkit
- Timestamp:
- Apr 21, 2011 11:29:12 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84522 r84527 1 2011-04-20 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 Removed a use of markDOMObjectWrapper: CSS Object Model 6 https://bugs.webkit.org/show_bug.cgi?id=59057 7 8 This is 24 hours of my life I will never get back. Thank you, W3C. 9 10 * GNUmakefile.list.am: 11 * WebCore.gypi: 12 * WebCore.vcproj/WebCore.vcproj: 13 * WebCore.xcodeproj/project.pbxproj: Build! 14 15 * bindings/js/JSCSSFontFaceRuleCustom.cpp: 16 * bindings/js/JSCSSImportRuleCustom.cpp: 17 * bindings/js/JSCSSMediaRuleCustom.cpp: 18 * bindings/js/JSCSSPageRuleCustom.cpp: 19 * bindings/js/JSCSSRuleCustom.cpp: 20 (WebCore::JSCSSRuleOwner::isReachableFromOpaqueRoots): 21 (WebCore::JSCSSRuleOwner::finalize): 22 (WebCore::wrapperOwner): 23 (WebCore::wrapperContext): 24 (WebCore::JSCSSRule::markChildren): 25 * bindings/js/JSCSSRuleListCustom.cpp: 26 (WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots): 27 (WebCore::JSCSSRuleListOwner::finalize): 28 (WebCore::wrapperOwner): 29 (WebCore::wrapperContext): 30 (WebCore::toJS): 31 * bindings/js/JSCSSStyleDeclarationCustom.cpp: 32 (WebCore::JSCSSStyleDeclarationOwner::isReachableFromOpaqueRoots): 33 (WebCore::JSCSSStyleDeclarationOwner::finalize): 34 (WebCore::wrapperOwner): 35 (WebCore::wrapperContext): 36 (WebCore::JSCSSStyleDeclaration::markChildren): Removed custom mark functions, 37 and replaced with use of the opaque roots system. This has the nice benefit 38 of allowing us to eagerly recycle far more CSS wrappers and their associated 39 DOM wrappers. 40 41 (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue): Made this function 42 custom because it must maintain the sorrowful invariant that primitive 43 values can be mapped back to objects that are reachable through the DOM. 44 We maintain this invariant through an external hash table because 45 making all primitive values bigger would be a too-large memory use 46 penalty. Luckily, nobody uses this feature, so the cost of the hash table 47 is no big deal. 48 49 (WebCore::toJS): We need a custom toJS so we can specify our own WeakHandleOwner. 50 51 * bindings/js/JSCSSStyleRuleCustom.cpp: Removed custom mark, as above. 52 53 * bindings/js/JSCSSValueCustom.cpp: 54 (WebCore::cssValueRoots): 55 (WebCore::JSCSSValueOwner::isReachableFromOpaqueRoots): 56 (WebCore::JSCSSValueOwner::finalize): 57 (WebCore::wrapperOwner): 58 (WebCore::wrapperContext): Use the opaque roots system. Piggy-back on 59 the external hash table filled by JSCSSStyleDeclaration::getPropertyCSSValue. 60 61 * bindings/js/JSDocumentCustom.cpp: 62 (WebCore::JSDocument::markChildren): No need to mark our stylesheet list, 63 since all style-related objects can use our opaque root to determine 64 liveness. 65 66 * bindings/js/JSMediaListCustom.cpp: Added. 67 (WebCore::JSMediaListOwner::isReachableFromOpaqueRoots): 68 (WebCore::JSMediaListOwner::finalize): 69 (WebCore::wrapperOwner): 70 (WebCore::wrapperContext): 71 (WebCore::toJS): Use the opaque roots system. 72 73 * bindings/js/JSNodeCustom.h: 74 (WebCore::root): Added helpers for computing style-related roots. 75 76 * bindings/js/JSStyleSheetCustom.cpp: 77 (WebCore::JSStyleSheetOwner::isReachableFromOpaqueRoots): 78 (WebCore::JSStyleSheetOwner::finalize): 79 (WebCore::wrapperOwner): 80 (WebCore::wrapperContext): 81 (WebCore::JSStyleSheet::markChildren): Use the opaque roots system instead 82 of direct marking. 83 84 * bindings/js/JSStyleSheetListCustom.cpp: 85 (WebCore::JSStyleSheetListOwner::isReachableFromOpaqueRoots): 86 (WebCore::JSStyleSheetListOwner::finalize): 87 (WebCore::wrapperOwner): 88 (WebCore::wrapperContext): 89 (WebCore::toJS): Ditto. 90 91 * bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp: 92 * bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp: 93 * css/CSSFontFaceRule.idl: 94 * css/CSSImportRule.idl: No more custom mark, since we use the opaque 95 roots system instead. 96 97 * css/CSSMediaRule.cpp: 98 (WebCore::CSSMediaRule::CSSMediaRule): Fixed a bug where a media rule 99 would incorrectly have no parent, since this got in the way of correctly 100 computing the media rule's root. 101 102 * css/CSSMediaRule.idl: 103 * css/CSSPageRule.idl: 104 * css/CSSRuleList.idl: 105 * css/CSSStyleDeclaration.idl: 106 * css/CSSStyleRule.idl: 107 * css/MediaList.idl: Match behavior changes above. 108 109 * css/StyleBase.cpp: 110 (WebCore::StyleBase::node): Helper function for computing roots of the 111 style system. This object model is pretty weird and not very well factored, 112 but I'm pretty sure this covers all the relevant cases. 113 114 * css/StyleBase.h: 115 * css/StyleSheetList.idl: 116 * css/WebKitCSSKeyframeRule.idl: 117 * css/WebKitCSSKeyframesRule.idl: Updated to match the behavior changes above. 118 1 119 2011-04-21 Dirk Schulze <krit@webkit.org> 2 120 -
trunk/Source/WebCore/GNUmakefile.list.am
r84522 r84527 761 761 Source/WebCore/bindings/js/JSMainThreadExecState.cpp \ 762 762 Source/WebCore/bindings/js/JSMainThreadExecState.h \ 763 Source/WebCore/bindings/js/JSMediaListCustom.cpp \ 763 764 Source/WebCore/bindings/js/JSMemoryInfoCustom.cpp \ 764 765 Source/WebCore/bindings/js/JSMessageChannelCustom.cpp \ -
trunk/Source/WebCore/UseJSC.cmake
r83792 r84527 19 19 bindings/js/JSCSSFontFaceRuleCustom.cpp 20 20 bindings/js/JSCSSImportRuleCustom.cpp 21 bindings/js/JSCSSMediaListCustom.cpp 21 22 bindings/js/JSCSSMediaRuleCustom.cpp 22 23 bindings/js/JSCSSPageRuleCustom.cpp -
trunk/Source/WebCore/WebCore.gypi
r84522 r84527 1825 1825 'bindings/js/JSMainThreadExecState.cpp', 1826 1826 'bindings/js/JSMainThreadExecState.h', 1827 'bindings/js/JSMediaListCustom.cpp', 1827 1828 'bindings/js/JSMemoryInfoCustom.cpp', 1828 1829 'bindings/js/JSMessageChannelCustom.cpp', -
trunk/Source/WebCore/WebCore.pro
r84522 r84527 239 239 bindings/js/JSCSSFontFaceRuleCustom.cpp \ 240 240 bindings/js/JSCSSImportRuleCustom.cpp \ 241 bindings/js/JSCSSMediaListCustom.cpp \ 241 242 bindings/js/JSCSSMediaRuleCustom.cpp \ 242 243 bindings/js/JSCSSPageRuleCustom.cpp \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r84522 r84527 61494 61494 </File> 61495 61495 <File 61496 RelativePath="..\bindings\js\JSMediaListCustom.cpp" 61497 > 61498 <FileConfiguration 61499 Name="Debug|Win32" 61500 ExcludedFromBuild="true" 61501 > 61502 <Tool 61503 Name="VCCLCompilerTool" 61504 /> 61505 </FileConfiguration> 61506 <FileConfiguration 61507 Name="Release|Win32" 61508 ExcludedFromBuild="true" 61509 > 61510 <Tool 61511 Name="VCCLCompilerTool" 61512 /> 61513 </FileConfiguration> 61514 <FileConfiguration 61515 Name="Debug_Cairo_CFLite|Win32" 61516 ExcludedFromBuild="true" 61517 > 61518 <Tool 61519 Name="VCCLCompilerTool" 61520 /> 61521 </FileConfiguration> 61522 <FileConfiguration 61523 Name="Release_Cairo_CFLite|Win32" 61524 ExcludedFromBuild="true" 61525 > 61526 <Tool 61527 Name="VCCLCompilerTool" 61528 /> 61529 </FileConfiguration> 61530 <FileConfiguration 61531 Name="Debug_All|Win32" 61532 ExcludedFromBuild="true" 61533 > 61534 <Tool 61535 Name="VCCLCompilerTool" 61536 /> 61537 </FileConfiguration> 61538 <FileConfiguration 61539 Name="Production|Win32" 61540 ExcludedFromBuild="true" 61541 > 61542 <Tool 61543 Name="VCCLCompilerTool" 61544 /> 61545 </FileConfiguration> 61546 </File> 61547 <File 61496 61548 RelativePath="..\bindings\js\JSMemoryInfoCustom.cpp" 61497 61549 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r84522 r84527 299 299 1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1449E24A107D4A8400B5793F /* JSCallbackData.h */; }; 300 300 1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1449E286107D4DB400B5793F /* JSCallbackData.cpp */; }; 301 1464E06C135EC10600FDB00A /* JSMediaListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1464E06B135EC10600FDB00A /* JSMediaListCustom.cpp */; }; 301 302 1477E7760BF4134A00152872 /* PageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1477E7740BF4134A00152872 /* PageCache.cpp */; }; 302 303 1477E7770BF4134A00152872 /* PageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1477E7750BF4134A00152872 /* PageCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 6748 6749 1449E24A107D4A8400B5793F /* JSCallbackData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackData.h; sourceTree = "<group>"; }; 6749 6750 1449E286107D4DB400B5793F /* JSCallbackData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackData.cpp; sourceTree = "<group>"; }; 6751 1464E06B135EC10600FDB00A /* JSMediaListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaListCustom.cpp; sourceTree = "<group>"; }; 6750 6752 1477E7740BF4134A00152872 /* PageCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PageCache.cpp; sourceTree = "<group>"; }; 6751 6753 1477E7750BF4134A00152872 /* PageCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PageCache.h; sourceTree = "<group>"; }; … … 18204 18206 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */, 18205 18207 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */, 18208 1464E06B135EC10600FDB00A /* JSMediaListCustom.cpp */, 18206 18209 9FDC8FF112FAB0060099AB1C /* JSMemoryInfoCustom.cpp */, 18207 18210 93B70D4F09EB0C7C009D8468 /* JSPluginElementFunctions.cpp */, … … 25770 25773 E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 25771 25774 977E2E0E12F0FC9C00C13379 /* XSSFilter.cpp in Sources */, 25775 1464E06C135EC10600FDB00A /* JSMediaListCustom.cpp in Sources */, 25772 25776 087E0AF613606D0B00FA4BA8 /* SVGGlyph.cpp in Sources */, 25773 25777 4358E86B1360A21600E4748C /* DOMSVGFEDropShadowElement.mm in Sources */, -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r83079 r84527 114 114 #include "JSLocationCustom.cpp" 115 115 #include "JSMainThreadExecState.cpp" 116 #include "JSMediaListCustom.cpp" 116 117 #include "JSMemoryInfoCustom.cpp" 117 118 #include "JSMessageChannelCustom.cpp" -
trunk/Source/WebCore/bindings/js/JSCSSFontFaceRuleCustom.cpp
r72590 r84527 33 33 namespace WebCore { 34 34 35 void JSCSSFontFaceRule::markChildren(MarkStack& markStack)36 {37 Base::markChildren(markStack);38 39 if (CSSMutableStyleDeclaration* style = static_cast<CSSFontFaceRule*>(impl())->style())40 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);41 35 } 42 43 } -
trunk/Source/WebCore/bindings/js/JSCSSImportRuleCustom.cpp
r72590 r84527 33 33 namespace WebCore { 34 34 35 void JSCSSImportRule::markChildren(MarkStack& markStack)36 {37 Base::markChildren(markStack);38 39 if (CSSStyleSheet* sheet = static_cast<CSSImportRule*>(impl())->styleSheet())40 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), sheet);41 42 if (MediaList* media = static_cast<CSSImportRule*>(impl())->media())43 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), media);44 35 } 45 46 } -
trunk/Source/WebCore/bindings/js/JSCSSMediaRuleCustom.cpp
r72590 r84527 33 33 namespace WebCore { 34 34 35 void JSCSSMediaRule::markChildren(MarkStack& markStack)36 {37 Base::markChildren(markStack);38 39 if (MediaList* media = static_cast<CSSMediaRule*>(impl())->media())40 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), media);41 42 if (CSSRuleList* rules = static_cast<CSSMediaRule*>(impl())->cssRules())43 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), rules);44 35 } 45 46 } -
trunk/Source/WebCore/bindings/js/JSCSSPageRuleCustom.cpp
r72590 r84527 33 33 namespace WebCore { 34 34 35 void JSCSSPageRule::markChildren(MarkStack& markStack)36 {37 Base::markChildren(markStack);38 39 if (CSSMutableStyleDeclaration* style = static_cast<CSSPageRule*>(impl())->style())40 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);41 35 } 42 43 } -
trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
r84194 r84527 39 39 #include "JSCSSPageRule.h" 40 40 #include "JSCSSStyleRule.h" 41 #include "JSNode.h" 41 42 #include "JSWebKitCSSKeyframeRule.h" 42 43 #include "JSWebKitCSSKeyframesRule.h" … … 48 49 namespace WebCore { 49 50 51 class JSCSSRuleOwner : public JSC::WeakHandleOwner { 52 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 53 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); 54 }; 55 56 bool JSCSSRuleOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, MarkStack& markStack) 57 { 58 JSCSSRule* jsCSSRule = static_cast<JSCSSRule*>(handle.get().asCell()); 59 if (!jsCSSRule->hasCustomProperties()) 60 return false; 61 return markStack.containsOpaqueRoot(root(jsCSSRule->impl())); 62 } 63 64 void JSCSSRuleOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) 65 { 66 JSCSSRule* jsCSSRule = static_cast<JSCSSRule*>(handle.get().asCell()); 67 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); 68 uncacheWrapper(world, jsCSSRule->impl(), jsCSSRule); 69 } 70 71 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, CSSRule*) 72 { 73 DEFINE_STATIC_LOCAL(JSCSSRuleOwner, jsCSSRuleOwner, ()); 74 return &jsCSSRuleOwner; 75 } 76 77 inline void* wrapperContext(DOMWrapperWorld* world, CSSRule*) 78 { 79 return world; 80 } 81 50 82 void JSCSSRule::markChildren(MarkStack& markStack) 51 83 { 52 84 Base::markChildren(markStack); 53 54 if (CSSStyleSheet* parentStyleSheet = impl()->parentStyleSheet()) 55 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), parentStyleSheet); 56 57 if (CSSRule* parentRule = impl()->parentRule()) 58 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), parentRule); 85 markStack.addOpaqueRoot(root(impl())); 59 86 } 60 87 -
trunk/Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp
r47165 r84527 27 27 #include "JSCSSRuleList.h" 28 28 29 #include "CSSRule.h" 29 30 #include "CSSRuleList.h" 31 #include "JSNode.h" 32 #include "StyleList.h" 30 33 31 34 using namespace JSC; … … 33 36 namespace WebCore { 34 37 35 void JSCSSRuleList::markChildren(MarkStack& markStack) 38 class JSCSSRuleListOwner : public JSC::WeakHandleOwner { 39 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 40 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); 41 }; 42 43 bool JSCSSRuleListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, MarkStack& markStack) 36 44 { 37 Base::markChildren(markStack); 45 JSCSSRuleList* jsCSSRuleList = static_cast<JSCSSRuleList*>(handle.get().asCell()); 46 if (!jsCSSRuleList->hasCustomProperties()) 47 return false; 48 if (StyleList* styleList = jsCSSRuleList->impl()->styleList()) 49 return markStack.containsOpaqueRoot(root(styleList)); 50 if (CSSRule* cssRule = jsCSSRuleList->impl()->item(0)) 51 return markStack.containsOpaqueRoot(root(cssRule)); 52 return false; 53 } 38 54 39 CSSRuleList* list = impl(); 40 JSGlobalData& globalData = *Heap::heap(this)->globalData(); 55 void JSCSSRuleListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) 56 { 57 JSCSSRuleList* jsCSSRuleList = static_cast<JSCSSRuleList*>(handle.get().asCell()); 58 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); 59 uncacheWrapper(world, jsCSSRuleList->impl(), jsCSSRuleList); 60 } 41 61 42 unsigned length = list->length(); 43 for (unsigned i = 0; i < length; ++i) 44 markDOMObjectWrapper(markStack, globalData, list->item(i)); 62 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, CSSRuleList*) 63 { 64 DEFINE_STATIC_LOCAL(JSCSSRuleListOwner, jsCSSRuleListOwner, ()); 65 return &jsCSSRuleListOwner; 66 } 67 68 inline void* wrapperContext(DOMWrapperWorld* world, CSSRuleList*) 69 { 70 return world; 71 } 72 73 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRuleList* impl) 74 { 75 return wrap<JSCSSRuleList>(exec, globalObject, impl); 45 76 } 46 77 -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r83119 r84527 30 30 #include "CSSPrimitiveValue.h" 31 31 #include "CSSValue.h" 32 #include "JSCSSValue.h" 33 #include "JSNode.h" 32 34 #include "PlatformString.h" 33 35 #include <runtime/StringObjectThatMasqueradesAsUndefined.h> … … 43 45 namespace WebCore { 44 46 47 class JSCSSStyleDeclarationOwner : public JSC::WeakHandleOwner { 48 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 49 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); 50 }; 51 52 bool JSCSSStyleDeclarationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, MarkStack& markStack) 53 { 54 JSCSSStyleDeclaration* jsCSSStyleDeclaration = static_cast<JSCSSStyleDeclaration*>(handle.get().asCell()); 55 return markStack.containsOpaqueRoot(root(jsCSSStyleDeclaration->impl())); 56 } 57 58 void JSCSSStyleDeclarationOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) 59 { 60 JSCSSStyleDeclaration* jsCSSStyleDeclaration = static_cast<JSCSSStyleDeclaration*>(handle.get().asCell()); 61 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); 62 uncacheWrapper(world, jsCSSStyleDeclaration->impl(), jsCSSStyleDeclaration); 63 } 64 65 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, CSSStyleDeclaration*) 66 { 67 DEFINE_STATIC_LOCAL(JSCSSStyleDeclarationOwner, jsCSSStyleDeclarationOwner, ()); 68 return &jsCSSStyleDeclarationOwner; 69 } 70 71 inline void* wrapperContext(DOMWrapperWorld* world, CSSStyleDeclaration*) 72 { 73 return world; 74 } 75 45 76 void JSCSSStyleDeclaration::markChildren(MarkStack& markStack) 46 77 { 47 78 Base::markChildren(markStack); 48 49 CSSStyleDeclaration* declaration = impl(); 50 JSGlobalData& globalData = *Heap::heap(this)->globalData(); 51 52 if (CSSRule* parentRule = declaration->parentRule()) 53 markDOMObjectWrapper(markStack, globalData, parentRule); 54 55 if (declaration->isMutableStyleDeclaration()) { 56 CSSMutableStyleDeclaration* mutableDeclaration = static_cast<CSSMutableStyleDeclaration*>(declaration); 57 CSSMutableStyleDeclaration::const_iterator end = mutableDeclaration->end(); 58 for (CSSMutableStyleDeclaration::const_iterator it = mutableDeclaration->begin(); it != end; ++it) 59 markDOMObjectWrapper(markStack, globalData, it->value()); 60 } 79 markStack.addOpaqueRoot(root(impl())); 61 80 } 62 81 … … 176 195 } 177 196 178 179 197 bool JSCSSStyleDeclaration::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&) 180 198 { … … 193 211 } 194 212 213 JSValue JSCSSStyleDeclaration::getPropertyCSSValue(ExecState* exec) 214 { 215 const String& propertyName(ustringToString(exec->argument(0).toString(exec))); 216 if (exec->hadException()) 217 return jsUndefined(); 218 219 RefPtr<CSSValue> cssValue = impl()->getPropertyCSSValue(propertyName); 220 if (!cssValue) 221 return jsNull(); 222 223 cssValueRoots().add(cssValue.get(), root(impl())); // Balanced by JSCSSValueOwner::finalize(). 224 return toJS(exec, globalObject(), WTF::getPtr(cssValue)); 225 } 226 227 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSStyleDeclaration* impl) 228 { 229 return wrap<JSCSSStyleDeclaration>(exec, globalObject, impl); 230 } 231 195 232 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSCSSStyleRuleCustom.cpp
r72590 r84527 33 33 namespace WebCore { 34 34 35 void JSCSSStyleRule::markChildren(MarkStack& markStack)36 {37 Base::markChildren(markStack);38 39 if (CSSMutableStyleDeclaration* style = static_cast<CSSStyleRule*>(impl())->style())40 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);41 35 } 42 43 } -
trunk/Source/WebCore/bindings/js/JSCSSValueCustom.cpp
r84194 r84527 31 31 #include "JSCSSPrimitiveValue.h" 32 32 #include "JSCSSValueList.h" 33 #include "JSNode.h" 33 34 #include "JSWebKitCSSTransformValue.h" 34 35 #include "WebKitCSSTransformValue.h" … … 44 45 45 46 namespace WebCore { 47 48 HashMap<CSSValue*, void*>& cssValueRoots() 49 { 50 typedef HashMap<CSSValue*, void*> MapType; 51 DEFINE_STATIC_LOCAL(MapType, cssValueRoots, ()); 52 return cssValueRoots; 53 } 54 55 class JSCSSValueOwner : public JSC::WeakHandleOwner { 56 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 57 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); 58 }; 59 60 bool JSCSSValueOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, MarkStack& markStack) 61 { 62 JSCSSValue* jsCSSValue = static_cast<JSCSSValue*>(handle.get().asCell()); 63 if (!jsCSSValue->hasCustomProperties()) 64 return false; 65 void* root = cssValueRoots().get(jsCSSValue->impl()); 66 if (!root) 67 return false; 68 return markStack.containsOpaqueRoot(root); 69 } 70 71 void JSCSSValueOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) 72 { 73 JSCSSValue* jsCSSValue = static_cast<JSCSSValue*>(handle.get().asCell()); 74 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); 75 uncacheWrapper(world, jsCSSValue->impl(), jsCSSValue); 76 cssValueRoots().remove(jsCSSValue->impl()); 77 } 78 79 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, CSSValue*) 80 { 81 DEFINE_STATIC_LOCAL(JSCSSValueOwner, jsCSSValueOwner, ()); 82 return &jsCSSValueOwner; 83 } 84 85 inline void* wrapperContext(DOMWrapperWorld* world, CSSValue*) 86 { 87 return world; 88 } 46 89 47 90 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSValue* value) -
trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp
r84371 r84527 57 57 markActiveObjectsForContext(markStack, globalData, document); 58 58 markDOMObjectWrapper(markStack, globalData, document->implementation()); 59 markDOMObjectWrapper(markStack, globalData, document->styleSheets());60 59 } 61 60 -
trunk/Source/WebCore/bindings/js/JSNodeCustom.h
r84194 r84527 28 28 29 29 #include "JSDOMBinding.h" 30 #include "StyleBase.h" 30 31 #include <wtf/AlwaysInline.h> 31 32 32 33 namespace WebCore { 34 35 class CSSValue; 33 36 34 37 class JSNodeOwner : public JSC::WeakHandleOwner { … … 87 90 } 88 91 89 static inline Node* root(Node* node)92 static inline void* root(Node* node) 90 93 { 91 94 if (node->inDocument()) … … 97 100 } 98 101 102 static inline void* root(StyleBase* styleBase) 103 { 104 while (styleBase->parent()) 105 styleBase = styleBase->parent(); 106 107 if (Node* node = styleBase->node()) 108 return root(node); 109 return styleBase; 110 } 111 112 HashMap<CSSValue*, void*>& cssValueRoots(); 113 99 114 } 100 115 -
trunk/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp
r84194 r84527 36 36 namespace WebCore { 37 37 38 class JSStyleSheetOwner : public JSC::WeakHandleOwner { 39 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 40 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); 41 }; 42 43 bool JSStyleSheetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, MarkStack& markStack) 44 { 45 JSStyleSheet* jsStyleSheet = static_cast<JSStyleSheet*>(handle.get().asCell()); 46 if (!jsStyleSheet->hasCustomProperties()) 47 return false; 48 return markStack.containsOpaqueRoot(root(jsStyleSheet->impl())); 49 } 50 51 void JSStyleSheetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) 52 { 53 JSStyleSheet* jsStyleSheet = static_cast<JSStyleSheet*>(handle.get().asCell()); 54 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); 55 uncacheWrapper(world, jsStyleSheet->impl(), jsStyleSheet); 56 } 57 58 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, StyleSheet*) 59 { 60 DEFINE_STATIC_LOCAL(JSStyleSheetOwner, jsStyleSheetOwner, ()); 61 return &jsStyleSheetOwner; 62 } 63 64 inline void* wrapperContext(DOMWrapperWorld* world, StyleSheet*) 65 { 66 return world; 67 } 68 69 void JSStyleSheet::markChildren(MarkStack& markStack) 70 { 71 Base::markChildren(markStack); 72 markStack.addOpaqueRoot(root(impl())); 73 } 74 38 75 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, StyleSheet* styleSheet) 39 76 { … … 53 90 } 54 91 55 void JSStyleSheet::markChildren(MarkStack& markStack)56 {57 Base::markChildren(markStack);58 59 StyleSheet* sheet = impl();60 JSGlobalData& globalData = *Heap::heap(this)->globalData();61 62 unsigned length = sheet->length();63 for (unsigned i = 0; i < length; ++i)64 markDOMObjectWrapper(markStack, globalData, sheet->item(i));65 }66 67 92 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp
r57738 r84527 36 36 namespace WebCore { 37 37 38 void JSStyleSheetList::markChildren(MarkStack& markStack) 38 class JSStyleSheetListOwner : public JSC::WeakHandleOwner { 39 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 40 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); 41 }; 42 43 bool JSStyleSheetListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, MarkStack& markStack) 39 44 { 40 Base::markChildren(markStack); 45 JSStyleSheetList* jsStyleSheetList = static_cast<JSStyleSheetList*>(handle.get().asCell()); 46 if (!jsStyleSheetList->hasCustomProperties()) 47 return false; 48 Document* document = jsStyleSheetList->impl()->document(); 49 if (!document) 50 return false; 51 return markStack.containsOpaqueRoot(document); 52 } 41 53 42 StyleSheetList* list = impl(); 43 JSGlobalData& globalData = *Heap::heap(this)->globalData(); 54 void JSStyleSheetListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) 55 { 56 JSStyleSheetList* jsStyleSheetList = static_cast<JSStyleSheetList*>(handle.get().asCell()); 57 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); 58 uncacheWrapper(world, jsStyleSheetList->impl(), jsStyleSheetList); 59 } 44 60 45 unsigned length = list->length(); 46 for (unsigned i = 0; i < length; ++i) 47 markDOMObjectWrapper(markStack, globalData, list->item(i)); 61 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, StyleSheetList*) 62 { 63 DEFINE_STATIC_LOCAL(JSStyleSheetListOwner, jsStyleSheetListOwner, ()); 64 return &jsStyleSheetListOwner; 65 } 66 67 inline void* wrapperContext(DOMWrapperWorld* world, StyleSheetList*) 68 { 69 return world; 48 70 } 49 71 … … 61 83 } 62 84 85 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, StyleSheetList* impl) 86 { 87 return wrap<JSStyleSheetList>(exec, globalObject, impl); 88 } 89 63 90 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp
r72590 r84527 33 33 namespace WebCore { 34 34 35 void JSWebKitCSSKeyframeRule::markChildren(MarkStack& markStack)36 {37 Base::markChildren(markStack);38 39 if (CSSMutableStyleDeclaration* style = static_cast<WebKitCSSKeyframeRule*>(impl())->style())40 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);41 35 } 42 43 } -
trunk/Source/WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp
r72590 r84527 33 33 namespace WebCore { 34 34 35 void JSWebKitCSSKeyframesRule::markChildren(MarkStack& markStack)36 {37 Base::markChildren(markStack);38 39 if (CSSRuleList* rules = static_cast<WebKitCSSKeyframesRule*>(impl())->cssRules())40 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), rules);41 35 } 42 43 } -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r84319 r84527 2554 2554 return 0 if $interfaceName eq "SVGElementInstance"; 2555 2555 return 0 if $interfaceName eq "NodeList"; 2556 return 0 if $interfaceName eq "CSSRuleList"; 2557 return 0 if $interfaceName eq "CSSStyleDeclaration"; 2558 return 0 if $interfaceName eq "MediaList"; 2559 return 0 if $interfaceName eq "StyleSheetList"; 2556 2560 2557 2561 # For everything else, do what JSC does. -
trunk/Source/WebCore/css/CSSFontFaceRule.idl
r72590 r84527 22 22 23 23 // Introduced in DOM Level 2: 24 interface [CustomMarkFunction]CSSFontFaceRule : CSSRule {24 interface CSSFontFaceRule : CSSRule { 25 25 readonly attribute CSSStyleDeclaration style; 26 26 }; -
trunk/Source/WebCore/css/CSSImportRule.idl
r72590 r84527 22 22 23 23 // Introduced in DOM Level 2: 24 interface [CustomMarkFunction]CSSImportRule : CSSRule {24 interface CSSImportRule : CSSRule { 25 25 readonly attribute [ConvertNullStringTo=Null] DOMString href; 26 26 readonly attribute MediaList media; -
trunk/Source/WebCore/css/CSSMediaRule.cpp
r76728 r84527 34 34 , m_lstCSSRules(rules) 35 35 { 36 m_lstMedia->setParent(this); 36 37 int length = m_lstCSSRules->length(); 37 38 for (int i = 0; i < length; i++) -
trunk/Source/WebCore/css/CSSMediaRule.idl
r72590 r84527 22 22 23 23 // Introduced in DOM Level 2: 24 interface [CustomMarkFunction]CSSMediaRule : CSSRule {24 interface CSSMediaRule : CSSRule { 25 25 readonly attribute MediaList media; 26 26 readonly attribute CSSRuleList cssRules; -
trunk/Source/WebCore/css/CSSPageRule.idl
r72590 r84527 22 22 23 23 // Introduced in DOM Level 2: 24 interface [CustomMarkFunction]CSSPageRule : CSSRule {24 interface CSSPageRule : CSSRule { 25 25 26 26 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText; -
trunk/Source/WebCore/css/CSSRuleList.idl
r52921 r84527 28 28 // Introduced in DOM Level 2: 29 29 interface [ 30 Custom MarkFunction,30 CustomToJS, 31 31 HasIndexGetter 32 32 ] CSSRuleList { -
trunk/Source/WebCore/css/CSSStyleDeclaration.idl
r52921 r84527 24 24 interface [ 25 25 CustomMarkFunction, 26 CustomToJS, 26 27 DelegatingPutFunction, 27 28 HasNameGetter, … … 32 33 33 34 [ConvertNullStringTo=Null] DOMString getPropertyValue(in DOMString propertyName); 34 CSSValue getPropertyCSSValue(in DOMString propertyName);35 [JSCCustom] CSSValue getPropertyCSSValue(in DOMString propertyName); 35 36 [ConvertNullStringTo=Null] DOMString removeProperty(in DOMString propertyName) 36 37 raises(DOMException); -
trunk/Source/WebCore/css/CSSStyleRule.idl
r72590 r84527 22 22 23 23 // Introduced in DOM Level 2: 24 interface [CustomMarkFunction]CSSStyleRule : CSSRule {24 interface CSSStyleRule : CSSRule { 25 25 26 26 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText; -
trunk/Source/WebCore/css/MediaList.idl
r52921 r84527 28 28 // Introduced in DOM Level 2: 29 29 interface [ 30 CustomToJS, 30 31 HasIndexGetter 31 32 ] MediaList { -
trunk/Source/WebCore/css/StyleBase.cpp
r54645 r84527 24 24 #include "StyleBase.h" 25 25 26 #include "CSSMutableStyleDeclaration.h" 26 27 #include "Document.h" 27 28 #include "Node.h" … … 39 40 if (parent()) 40 41 parent()->checkLoaded(); 42 } 43 44 Node* StyleBase::node() 45 { 46 if (isStyleSheet()) 47 return static_cast<StyleSheet*>(this)->ownerNode(); 48 49 if (isMutableStyleDeclaration()) 50 return static_cast<CSSMutableStyleDeclaration*>(this)->node(); 51 52 return 0; 41 53 } 42 54 -
trunk/Source/WebCore/css/StyleBase.h
r72116 r84527 29 29 namespace WebCore { 30 30 31 class KURL; 32 class Node; 31 33 class StyleSheet; 32 class KURL;33 34 34 35 // Base class for most CSS DOM objects. … … 72 73 73 74 StyleSheet* stylesheet(); 75 Node* node(); 74 76 75 77 protected: -
trunk/Source/WebCore/css/StyleSheetList.idl
r52921 r84527 23 23 // Introduced in DOM Level 2: 24 24 interface [ 25 Custom MarkFunction,25 CustomToJS, 26 26 HasIndexGetter, 27 27 HasNameGetter -
trunk/Source/WebCore/css/WebKitCSSKeyframeRule.idl
r72590 r84527 30 30 31 31 // Introduced in DOM Level ?: 32 interface [CustomMarkFunction]WebKitCSSKeyframeRule : CSSRule {32 interface WebKitCSSKeyframeRule : CSSRule { 33 33 34 34 attribute DOMString keyText; -
trunk/Source/WebCore/css/WebKitCSSKeyframesRule.idl
r72590 r84527 31 31 // Introduced in DOM Level ?: 32 32 interface [ 33 CustomMarkFunction,34 33 HasIndexGetter 35 34 ] WebKitCSSKeyframesRule : CSSRule {
Note: See TracChangeset
for help on using the changeset viewer.