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


C++ StyleSheet类代码示例

本文整理汇总了C++中StyleSheet的典型用法代码示例。如果您正苦于以下问题:C++ StyleSheet类的具体用法?C++ StyleSheet怎么用?C++ StyleSheet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了StyleSheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: inspectorStyleSheet

CSSStyleSheet* InspectorCSSStore::inspectorStyleSheet(Document* ownerDocument, bool createIfAbsent, long callId)
{
    DocumentToStyleSheetMap::iterator it = m_documentNodeToInspectorStyleSheetMap.find(ownerDocument);
    if (it != m_documentNodeToInspectorStyleSheetMap.end())
        return it->second.get();
    if (!createIfAbsent)
        return 0;
    ExceptionCode ec = 0;
    RefPtr<Element> styleElement = ownerDocument->createElement("style", ec);
    if (!ec)
        styleElement->setAttribute("type", "text/css", ec);
    if (!ec)
        ownerDocument->head()->appendChild(styleElement, ec);
    if (ec) {
        m_inspectorController->inspectorFrontend()->didAddRule(callId, ScriptValue::undefined(), false);
        return 0;
    }
    StyleSheetList* styleSheets = ownerDocument->styleSheets();
    StyleSheet* styleSheet = styleSheets->item(styleSheets->length() - 1);
    if (!styleSheet->isCSSStyleSheet()) {
        m_inspectorController->inspectorFrontend()->didAddRule(callId, ScriptValue::undefined(), false);
        return 0;
    }
    CSSStyleSheet* inspectorStyleSheet = static_cast<CSSStyleSheet*>(styleSheet);
    m_documentNodeToInspectorStyleSheetMap.set(ownerDocument, inspectorStyleSheet);
    return inspectorStyleSheet;
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:27,代码来源:InspectorCSSStore.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: disabledAttrSetter

static void disabledAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    StyleSheet* imp = V8StyleSheet::toNative(info.Holder());
    bool v = value->BooleanValue();
    imp->setDisabled(v);
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8StyleSheet.cpp

示例4: 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

示例5: 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

示例6: sheet

bool HTMLStyleElement::disabled() const
{
    StyleSheet* styleSheet = sheet();
    if (!styleSheet)
        return false;

    return styleSheet->disabled();
}
开发者ID:studiomobile,项目名称:webcore,代码行数:8,代码来源:HTMLStyleElement.cpp

示例7: switch

void JSStyleSheet::putValueProperty(ExecState* exec, int token, JSValue* value)
{
    switch (token) {
    case DisabledAttrNum: {
        StyleSheet* imp = static_cast<StyleSheet*>(impl());
        imp->setDisabled(value->toBoolean(exec));
        break;
    }
    }
}
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:10,代码来源:JSStyleSheet.cpp

示例8: parentStyleSheet

// static
CSSStyleSheet* InspectorCSSAgent::parentStyleSheet(StyleBase* styleBase)
{
    if (!styleBase)
        return 0;

    StyleSheet* styleSheet = styleBase->stylesheet();
    if (styleSheet && styleSheet->isCSSStyleSheet())
        return static_cast<CSSStyleSheet*>(styleSheet);

    return 0;
}
开发者ID:NewDreamUser2,项目名称:webkit-webcl,代码行数:12,代码来源:InspectorCSSAgent.cpp

示例9: impl

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));
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:11,代码来源:JSStyleSheetCustom.cpp

示例10: getSubresourceAttributeStrings

void HTMLStyleElement::getSubresourceAttributeStrings(Vector<String>& urls) const
{    
    HashSet<String> styleURLs;
    StyleSheet* styleSheet = const_cast<HTMLStyleElement*>(this)->sheet();
    if (styleSheet)
        styleSheet->addSubresourceURLStrings(styleURLs, ownerDocument()->baseURL());
    
    HashSet<String>::iterator end = styleURLs.end();
    for (HashSet<String>::iterator i = styleURLs.begin(); i != end; ++i)
        urls.append(*i);
}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:11,代码来源:HTMLStyleElement.cpp

示例11: mediaAttrGetter

static v8::Handle<v8::Value> mediaAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    StyleSheet* imp = V8StyleSheet::toNative(info.Holder());
    RefPtr<MediaList> result = imp->media();
    v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "media", wrapper);
    }
    return wrapper;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:12,代码来源:V8StyleSheet.cpp

示例12: canBeActivated

bool StyleSheetCandidate::canBeActivated(const String& currentPreferrableName) const
{
    StyleSheet* sheet = this->sheet();
    if (!sheet || sheet->disabled() || !sheet->isCSSStyleSheet())
        return false;
    const AtomicString& title = this->title();
    if (!isEnabledViaScript() && !title.isEmpty() && title != currentPreferrableName)
        return false;
    if (isAlternate() && title.isEmpty())
        return false;

    return true;
}
开发者ID:kublaj,项目名称:blink,代码行数:13,代码来源:StyleSheetCandidate.cpp

示例13: mediaAttrGetter

static v8::Handle<v8::Value> mediaAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.StyleSheet.media._get");
    StyleSheet* imp = V8StyleSheet::toNative(info.Holder());
    RefPtr<MediaList> result = imp->media();
    v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Value>();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setHiddenReference(info.Holder(), wrapper);
    }
    return wrapper;
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:13,代码来源:V8StyleSheet.cpp

示例14: getStyleFromStylesheet

OleMainStream::Style OleMainStream::getStyleFromStylesheet(unsigned int styleId, const StyleSheet &stylesheet) {
	//TODO optimize it: StyleSheet can be map structure with styleId key
	Style style;
	if (styleId != Style::STYLE_INVALID && styleId != Style::STYLE_NIL && styleId != Style::STYLE_USER) {
		for (std::size_t index = 0; index < stylesheet.size(); ++index) {
			if (stylesheet.at(index).StyleIdCurrent == styleId) {
				return stylesheet.at(index);
			}
		}
	}
	style.StyleIdCurrent = styleId;
	return style;
}
开发者ID:MastAvalons,项目名称:FBReaderJ,代码行数:13,代码来源:OleMainStream.cpp

示例15: getStyleIndex

int OleMainStream::getStyleIndex(unsigned int styleId, const std::vector<bool> &isFilled, const StyleSheet &stylesheet) {
	//TODO optimize it: StyleSheet can be map structure with styleId key
	//in that case, this method will be excess
	if (styleId == Style::STYLE_INVALID) {
		return -1;
	}
	for (int index = 0; index < (int)stylesheet.size(); ++index) {
		if (isFilled.at(index) && stylesheet.at(index).StyleIdCurrent == styleId) {
			return index;
		}
	}
	return -1;
}
开发者ID:MastAvalons,项目名称:FBReaderJ,代码行数:13,代码来源:OleMainStream.cpp


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