本文整理汇总了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;
}
示例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: 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;
}
示例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);
}
示例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;
}
示例6: sheet
bool HTMLStyleElement::disabled() const
{
StyleSheet* styleSheet = sheet();
if (!styleSheet)
return false;
return styleSheet->disabled();
}
示例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;
}
}
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}