本文整理汇总了C++中StyleBase类的典型用法代码示例。如果您正苦于以下问题:C++ StyleBase类的具体用法?C++ StyleBase怎么用?C++ StyleBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StyleBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getParsedVariable
CSSValueList* CSSVariablesDeclaration::getParsedVariable(const String& variableName)
{
StyleBase* result = m_variablesMap.get(variableName).get();
if (result->isValueList())
return static_cast<CSSValueList*>(result);
return 0;
}
示例2: stylesheet
StyleSheet* StyleBase::stylesheet()
{
StyleBase *b = this;
while (b && !b->isStyleSheet())
b = b->parent();
return static_cast<StyleSheet*>(b);
}
示例3: notifyChanged
void MediaList::notifyChanged()
{
for (StyleBase* p = parent(); p; p = p->parent()) {
if (p->isCSSStyleSheet())
return static_cast<CSSStyleSheet*>(p)->styleSheetChanged();
}
}
示例4: 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);
}
示例5: getVariableValue
String CSSVariablesDeclaration::getVariableValue(const String& variableName)
{
StyleBase* val = m_variablesMap.get(variableName).get();
if (val)
return val->cssText();
return "";
}
示例6: getParsedVariableDeclarationBlock
CSSMutableStyleDeclaration* CSSVariablesDeclaration::getParsedVariableDeclarationBlock(const String& variableName)
{
StyleBase* result = m_variablesMap.get(variableName).get();
if (result->isMutableStyleDeclaration())
return static_cast<CSSMutableStyleDeclaration*>(result);
return 0;
}
示例7: serializeCSSStyleSheet
void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KURL& url)
{
StringBuilder cssText;
for (unsigned i = 0; i < styleSheet->length(); ++i) {
StyleBase* item = styleSheet->item(i);
String itemText = item->cssText();
if (!itemText.isEmpty()) {
cssText.append(itemText);
if (i < styleSheet->length() - 1)
cssText.append("\n\n");
}
// Some rules have resources associated with them that we need to retrieve.
if (item->isImportRule()) {
CSSImportRule* importRule = static_cast<CSSImportRule*>(item);
KURL importURL = styleSheet->document()->completeURL(importRule->href());
if (m_resourceURLs.contains(importURL))
continue;
serializeCSSStyleSheet(importRule->styleSheet(), importURL);
} else if (item->isFontFaceRule()) {
// FIXME: Add support for font face rule. It is not clear to me at this point if the actual otf/eot file can
// be retrieved from the CSSFontFaceRule object.
} else if (item->isStyleRule())
retrieveResourcesForCSSRule(static_cast<CSSStyleRule*>(item));
}
if (url.isValid() && !m_resourceURLs.contains(url)) {
// FIXME: We should check whether a charset has been specified and if none was found add one.
TextEncoding textEncoding(styleSheet->charset());
ASSERT(textEncoding.isValid());
String textString = cssText.toString();
CString text = textEncoding.encode(textString.characters(), textString.length(), EntitiesForUnencodables);
m_resources->append(Resource(url, String("text/css"), SharedBuffer::create(text.data(), text.length())));
m_resourceURLs.add(url);
}
}
示例8: while
void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
{
if (m_node) {
// FIXME: Ideally, this should be factored better and there
// should be a subclass of CSSMutableStyleDeclaration just
// for inline style declarations that handles this
bool isInlineStyleDeclaration = m_node->isStyledElement() && this == static_cast<StyledElement*>(m_node)->inlineStyleDecl();
if (isInlineStyleDeclaration) {
m_node->setNeedsStyleRecalc(InlineStyleChange);
static_cast<StyledElement*>(m_node)->invalidateStyleAttribute();
if (m_node->document())
InspectorInstrumentation::didInvalidateStyleAttr(m_node->document(), m_node);
} else
m_node->setNeedsStyleRecalc(FullStyleChange);
return;
}
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
if (root->isCSSStyleSheet()) {
if (Document* document = static_cast<CSSStyleSheet*>(root)->document())
document->styleSelectorChanged(DeferRecalcStyle);
}
}
示例9: while
void CSSVariablesDeclaration::setChanged()
{
// FIXME: Make this much better (it has the same problem CSSMutableStyleDeclaration does).
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
if (root->isCSSStyleSheet())
static_cast<CSSStyleSheet*>(root)->doc()->updateStyleSelector();
}
示例10: length
bool CSSStyleSheet::isLoading()
{
unsigned len = length();
for (unsigned i = 0; i < len; ++i) {
StyleBase* rule = item(i);
if (rule->isImportRule() && static_cast<CSSImportRule*>(rule)->isLoading())
return true;
}
return false;
}
示例11: getParsedVariableDeclarationBlock
CSSMutableStyleDeclaration* CSSVariablesDeclaration::getParsedVariableDeclarationBlock(const String&)
{
// FIXME: Disabling declarations as variable values for now since they no longer have a common base class with CSSValues.
#if 0
StyleBase* result = m_variablesMap.get(variableName).get();
if (result->isMutableStyleDeclaration())
return static_cast<CSSMutableStyleDeclaration*>(result);
#endif
return 0;
}
示例12: item
CSSRule* CSSRuleList::item(unsigned index)
{
if (m_list) {
StyleBase* rule = m_list->item(index);
ASSERT(!rule || rule->isRule());
return static_cast<CSSRule*>(rule);
}
if (index < m_lstCSSRules.size())
return m_lstCSSRules[index].get();
return 0;
}
示例13: length
bool XSLStyleSheet::isLoading()
{
unsigned len = length();
for (unsigned i = 0; i < len; ++i) {
StyleBase* rule = item(i);
if (rule->isImportRule()) {
XSLImportRule* import = static_cast<XSLImportRule*>(rule);
if (import->isLoading())
return true;
}
}
return false;
}
示例14: append
CSSRuleList::CSSRuleList(StyleList* list, bool omitCharsetRules)
{
m_list = list;
if (list && omitCharsetRules) {
m_list = 0;
unsigned len = list->length();
for (unsigned i = 0; i < len; ++i) {
StyleBase* style = list->item(i);
if (style->isRule() && !style->isCharsetRule())
append(static_cast<CSSRule*>(style));
}
}
}
示例15: while
void CSSStyleSheet::styleSheetChanged()
{
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
Document* documentToUpdate = root->isCSSStyleSheet() ? static_cast<CSSStyleSheet*>(root)->document() : 0;
/* FIXME: We don't need to do everything updateStyleSelector does,
* basically we just need to recreate the document's selector with the
* already existing style sheets.
*/
if (documentToUpdate)
documentToUpdate->styleSelectorChanged(DeferRecalcStyle);
}