本文整理汇总了C++中HTMLStyleElement类的典型用法代码示例。如果您正苦于以下问题:C++ HTMLStyleElement类的具体用法?C++ HTMLStyleElement怎么用?C++ HTMLStyleElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLStyleElement类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nameGetter
EncodedJSValue JSStyleSheetList::nameGetter(ExecState* exec, JSObject* slotBase, EncodedJSValue, PropertyName propertyName)
{
JSStyleSheetList* thisObj = jsCast<JSStyleSheetList*>(slotBase);
HTMLStyleElement* element = thisObj->impl().getNamedItem(propertyNameToString(propertyName));
ASSERT(element);
return JSValue::encode(toJS(exec, thisObj->globalObject(), element->sheet()));
}
示例2: nameGetter
JSValue* JSStyleSheetList::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(slot.slotBase());
HTMLStyleElement* element = thisObj->impl()->getNamedItem(propertyName);
ASSERT(element);
return toJS(exec, element->sheet());
}
示例3: nameGetter
JSValue JSStyleSheetList::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(asObject(slotBase));
HTMLStyleElement* element = thisObj->impl()->getNamedItem(identifierToString(propertyName));
ASSERT(element);
return toJS(exec, thisObj->globalObject(), element->sheet());
}
示例4: getNamedItem
CSSStyleSheet* StyleSheetList::anonymousNamedGetter(const AtomicString& name)
{
HTMLStyleElement* item = getNamedItem(name);
if (!item)
return 0;
return item->sheet();
}
示例5: jsHTMLStyleElementSheet
JSValue jsHTMLStyleElementSheet(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLStyleElement* castedThis = static_cast<JSHTMLStyleElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(castedThis->impl());
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->sheet()));
return result;
}
示例6: jsHTMLStyleElementType
JSValue jsHTMLStyleElementType(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLStyleElement* castedThis = static_cast<JSHTMLStyleElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(castedThis->impl());
JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::typeAttr));
return result;
}
示例7: jsHTMLStyleElementDisabled
JSValue jsHTMLStyleElementDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLStyleElement* castedThis = static_cast<JSHTMLStyleElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(castedThis->impl());
JSValue result = jsBoolean(imp->disabled());
return result;
}
示例8: INC_STATS
v8::Handle<v8::Value> V8StyleSheetList::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.StyleSheetList.NamedPropertyGetter");
if (info.Holder()->HasRealNamedProperty(name))
return v8Undefined();
// Search style sheet.
StyleSheetList* imp = V8StyleSheetList::toNative(info.Holder());
HTMLStyleElement* item = imp->getNamedItem(toWebCoreString(name));
if (!item)
return v8Undefined();
return toV8(item->sheet(), info.Holder()->CreationContext(), info.GetIsolate());
}
示例9: toHTMLStyleElement
void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleEngine* engine, StyleSheetCollection& collection)
{
DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
Node* node = *it;
StyleSheet* sheet = 0;
CSSStyleSheet* activeSheet = 0;
if (!isHTMLStyleElement(*node))
continue;
HTMLStyleElement* element = toHTMLStyleElement(node);
const AtomicString& title = element->fastGetAttribute(titleAttr);
bool enabledViaScript = false;
sheet = element->sheet();
if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
activeSheet = toCSSStyleSheet(sheet);
// FIXME: clarify how PREFERRED or ALTERNATE works in shadow trees.
// Should we set preferred/selected stylesheets name in shadow trees and
// use the name in document?
if (!enabledViaScript && sheet && !title.isEmpty()) {
if (engine->preferredStylesheetSetName().isEmpty()) {
engine->setPreferredStylesheetSetName(title);
engine->setSelectedStylesheetSetName(title);
}
if (title != engine->preferredStylesheetSetName())
activeSheet = 0;
}
const AtomicString& rel = element->fastGetAttribute(relAttr);
if (rel.contains("alternate") && title.isEmpty())
activeSheet = 0;
if (sheet)
collection.appendSheetForList(sheet);
if (activeSheet)
collection.appendActiveStyleSheet(activeSheet);
}
}
示例10: ASSERT
const ContainerNode* ScopedStyleResolver::scopingNodeFor(const CSSStyleSheet* sheet)
{
ASSERT(sheet);
Document* document = sheet->ownerDocument();
if (!document)
return 0;
Node* ownerNode = sheet->ownerNode();
if (!ownerNode || !ownerNode->isHTMLElement() || !ownerNode->hasTagName(HTMLNames::styleTag))
return 0;
HTMLStyleElement* styleElement = static_cast<HTMLStyleElement*>(ownerNode);
if (!styleElement->scoped())
return styleElement->isInShadowTree() ? styleElement->containingShadowRoot() : 0;
ContainerNode* parent = styleElement->parentNode();
if (!parent)
return 0;
return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0;
}
示例11: urlForBlankFrame
void PageSerializer::serializeFrame(Frame* frame)
{
Document* document = frame->document();
KURL url = document->url();
if (!url.isValid() || url.protocolIs("about")) {
// For blank frames we generate a fake URL so they can be referenced by their containing frame.
url = urlForBlankFrame(frame);
}
if (m_resourceURLs.contains(url)) {
// FIXME: We could have 2 frame with the same URL but which were dynamically changed and have now
// different content. So we should serialize both and somehow rename the frame src in the containing
// frame. Arg!
return;
}
Vector<Node*> nodes;
SerializerMarkupAccumulator accumulator(this, document, &nodes);
TextEncoding textEncoding(document->charset());
CString data;
if (!textEncoding.isValid()) {
// FIXME: iframes used as images trigger this. We should deal with them correctly.
return;
}
String text = accumulator.serializeNodes(document->documentElement(), 0, IncludeNode);
CString frameHTML = textEncoding.encode(text.characters(), text.length(), EntitiesForUnencodables);
m_resources->append(Resource(url, document->suggestedMIMEType(), SharedBuffer::create(frameHTML.data(), frameHTML.length())));
m_resourceURLs.add(url);
for (Vector<Node*>::iterator iter = nodes.begin(); iter != nodes.end(); ++iter) {
Node* node = *iter;
if (!node->isElementNode())
continue;
Element* element = toElement(node);
// We have to process in-line style as it might contain some resources (typically background images).
if (element->isStyledElement())
retrieveResourcesForCSSDeclaration(static_cast<StyledElement*>(element)->inlineStyleDecl(), document);
if (element->hasTagName(HTMLNames::imgTag)) {
HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(element);
KURL url = document->completeURL(imageElement->getAttribute(HTMLNames::srcAttr));
CachedImage* cachedImage = imageElement->cachedImage();
addImageToResources(cachedImage, imageElement->renderer(), url);
} else if (element->hasTagName(HTMLNames::linkTag)) {
HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(element);
if (CSSStyleSheet* sheet = linkElement->sheet()) {
KURL url = document->completeURL(linkElement->getAttribute(HTMLNames::hrefAttr));
serializeCSSStyleSheet(sheet, url);
ASSERT(m_resourceURLs.contains(url));
}
} else if (element->hasTagName(HTMLNames::styleTag)) {
HTMLStyleElement* styleElement = static_cast<HTMLStyleElement*>(element);
if (CSSStyleSheet* sheet = styleElement->sheet())
serializeCSSStyleSheet(sheet, KURL());
}
}
for (Frame* childFrame = frame->tree()->firstChild(); childFrame; childFrame = childFrame->tree()->nextSibling())
serializeFrame(childFrame);
}
示例12: setJSHTMLStyleElementType
void setJSHTMLStyleElementType(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSHTMLStyleElement* castedThis = static_cast<JSHTMLStyleElement*>(thisObject);
HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(castedThis->impl());
imp->setAttribute(WebCore::HTMLNames::typeAttr, valueToStringWithNullCheck(exec, value));
}
示例13: setJSHTMLStyleElementDisabled
void setJSHTMLStyleElementDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSHTMLStyleElement* castedThis = static_cast<JSHTMLStyleElement*>(thisObject);
HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(castedThis->impl());
imp->setDisabled(value.toBoolean(exec));
}