本文整理汇总了C++中StyleSheet::ownerNode方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleSheet::ownerNode方法的具体用法?C++ StyleSheet::ownerNode怎么用?C++ StyleSheet::ownerNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleSheet
的用法示例。
在下文中一共展示了StyleSheet::ownerNode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSelectorText
void CSSStyleRule::setSelectorText(const String& selectorText)
{
Document* doc = 0;
StyleSheet* ownerStyleSheet = m_style->stylesheet();
if (ownerStyleSheet) {
if (ownerStyleSheet->isCSSStyleSheet())
doc = static_cast<CSSStyleSheet*>(ownerStyleSheet)->document();
if (!doc)
doc = ownerStyleSheet->ownerNode() ? ownerStyleSheet->ownerNode()->document() : 0;
}
if (!doc)
doc = m_style->node() ? m_style->node()->document() : 0;
if (!doc)
return;
CSSParser p;
CSSSelectorList selectorList;
p.parseSelector(selectorText, doc, selectorList);
if (!selectorList.first())
return;
String oldSelectorText = this->selectorText();
m_selectorList.adopt(selectorList);
if (this->selectorText() == oldSelectorText)
return;
doc->styleSelectorChanged(DeferRecalcStyle);
}
示例2: calculateGroupId
static GroupId calculateGroupId(StyleBase* styleBase)
{
ASSERT(styleBase);
StyleBase* current = styleBase;
StyleSheet* styleSheet = 0;
while (true) {
// Special case: CSSStyleDeclarations might be either inline and in this case
// we need to group them with their node or regular ones.
if (current->isMutableStyleDeclaration()) {
CSSMutableStyleDeclaration* cssMutableStyleDeclaration = static_cast<CSSMutableStyleDeclaration*>(current);
if (cssMutableStyleDeclaration->isInlineStyleDeclaration()) {
ASSERT(cssMutableStyleDeclaration->parent()->isStyleSheet());
return calculateGroupId(cssMutableStyleDeclaration->node());
}
// Either we have no parent, or this parent is a CSSRule.
ASSERT(cssMutableStyleDeclaration->parent() == cssMutableStyleDeclaration->parentRule());
}
if (current->isStyleSheet())
styleSheet = static_cast<StyleSheet*>(current);
StyleBase* parent = current->parent();
if (!parent)
break;
current = parent;
}
if (styleSheet) {
if (Node* ownerNode = styleSheet->ownerNode())
return calculateGroupId(ownerNode);
return GroupId(styleSheet);
}
return GroupId(current);
}
示例3: baseURL
KURL StyleBase::baseURL() const
{
// Try to find the style sheet. If found look for its URL.
// If it has none, get the URL from the parent sheet or the parent node.
StyleSheet* sheet = const_cast<StyleBase*>(this)->stylesheet();
if (!sheet)
return KURL();
if (!sheet->href().isNull())
return KURL(sheet->href());
if (sheet->parent())
return sheet->parent()->baseURL();
if (!sheet->ownerNode())
return KURL();
return sheet->ownerNode()->document()->baseURL();
}
示例4: ASSERT
void* V8StyleSheet::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
{
ASSERT(!wrapper.IsIndependent());
StyleSheet* impl = static_cast<StyleSheet*>(object);
if (Node* owner = impl->ownerNode())
return V8GCController::opaqueRootForGC(owner);
return object;
}
示例5: markChildren
void JSStyleSheet::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
StyleSheet* sheet = impl();
JSGlobalData& globalData = *Heap::heap(this)->globalData();
unsigned length = sheet->length();
for (unsigned i = 0; i < length; ++i)
markDOMObjectWrapper(markStack, globalData, sheet->item(i));
// This prevents us from having a style sheet with a dangling ownerNode pointer.
// A better solution would be to handle this on the DOM side -- if the style sheet
// is kept around, then we want the node to stay around too. One possibility would
// be to make ref/deref on the style sheet ref/deref the node instead, but there's
// a lot of disentangling of the CSS DOM objects that would need to happen first.
if (Node* ownerNode = sheet->ownerNode())
markDOMNodeWrapper(markStack, ownerNode->document(), ownerNode);
}
示例6: getValueProperty
JSValue* JSStyleSheet::getValueProperty(ExecState* exec, int token) const
{
switch (token) {
case TypeAttrNum: {
StyleSheet* imp = static_cast<StyleSheet*>(impl());
return jsStringOrNull(exec, imp->type());
}
case DisabledAttrNum: {
StyleSheet* imp = static_cast<StyleSheet*>(impl());
return jsBoolean(imp->disabled());
}
case OwnerNodeAttrNum: {
StyleSheet* imp = static_cast<StyleSheet*>(impl());
return toJS(exec, WTF::getPtr(imp->ownerNode()));
}
case ParentStyleSheetAttrNum: {
StyleSheet* imp = static_cast<StyleSheet*>(impl());
return toJS(exec, WTF::getPtr(imp->parentStyleSheet()));
}
case HrefAttrNum: {
StyleSheet* imp = static_cast<StyleSheet*>(impl());
return jsStringOrNull(exec, imp->href());
}
case TitleAttrNum: {
StyleSheet* imp = static_cast<StyleSheet*>(impl());
return jsStringOrNull(exec, imp->title());
}
case MediaAttrNum: {
StyleSheet* imp = static_cast<StyleSheet*>(impl());
return toJS(exec, WTF::getPtr(imp->media()));
}
case ConstructorAttrNum:
return getConstructor(exec);
}
return 0;
}
示例7: ownerNodeAttrGetter
static v8::Handle<v8::Value> ownerNodeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.StyleSheet.ownerNode._get");
StyleSheet* imp = V8StyleSheet::toNative(info.Holder());
return toV8(imp->ownerNode());
}
示例8: ownerNodeAttrGetter
static v8::Handle<v8::Value> ownerNodeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
StyleSheet* imp = V8StyleSheet::toNative(info.Holder());
return toV8Fast(imp->ownerNode(), info, imp);
}