2
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
2
* Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
4
4
* Redistribution and use in source and binary forms, with or without
5
5
* modification, are permitted provided that the following conditions
46
47
if (styleSheet->isCSSStyleSheet())
47
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, CSSStyleSheet, styleSheet);
48
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CSSStyleSheet, styleSheet);
49
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, StyleSheet, styleSheet);
50
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, StyleSheet, styleSheet);
54
void JSStyleSheet::mark()
55
void JSStyleSheet::markChildren(MarkStack& markStack)
57
Base::markChildren(markStack);
59
StyleSheet* sheet = impl();
60
JSGlobalData& globalData = *Heap::heap(this)->globalData();
62
unsigned length = sheet->length();
63
for (unsigned i = 0; i < length; ++i)
64
markDOMObjectWrapper(markStack, globalData, sheet->item(i));
58
66
// This prevents us from having a style sheet with a dangling ownerNode pointer.
59
67
// A better solution would be to handle this on the DOM side -- if the style sheet
60
68
// is kept around, then we want the node to stay around too. One possibility would
61
69
// be to make ref/deref on the style sheet ref/deref the node instead, but there's
62
70
// a lot of disentangling of the CSS DOM objects that would need to happen first.
63
if (Node* ownerNode = impl()->ownerNode()) {
64
if (JSNode* ownerNodeWrapper = getCachedDOMNodeWrapper(ownerNode->document(), ownerNode)) {
65
if (!ownerNodeWrapper->marked())
66
ownerNodeWrapper->mark();
71
if (Node* ownerNode = sheet->ownerNode()) {
72
if (JSNode* ownerNodeWrapper = getCachedDOMNodeWrapper(ownerNode->document(), ownerNode))
73
markStack.append(ownerNodeWrapper);