当前位置: 首页>>代码示例>>C++>>正文


C++ StyleSheet::ownerNode方法代码示例

本文整理汇总了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);
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:29,代码来源:CSSStyleRule.cpp

示例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);
}
开发者ID:ohyeah521,项目名称:GT-I9300_Platform,代码行数:35,代码来源:V8GCController.cpp

示例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();
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:16,代码来源:StyleBase.cpp

示例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;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:8,代码来源:V8StyleSheet.cpp

示例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);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:19,代码来源:JSStyleSheetCustom.cpp

示例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;
}
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:36,代码来源:JSStyleSheet.cpp

示例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());
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:6,代码来源:V8StyleSheet.cpp

示例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);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8StyleSheet.cpp


注:本文中的StyleSheet::ownerNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。