static void filterEnabledNonemptyCSSStyleSheets(Vector<RefPtr<CSSStyleSheet> >& result, const Vector<RefPtr<StyleSheet> >& sheets)
{
    for (unsigned i = 0; i < sheets.size(); ++i) {
        if (!sheets[i]->isCSSStyleSheet())
            continue;
        if (sheets[i]->disabled())
            continue;
        CSSStyleSheet* sheet = static_cast<CSSStyleSheet*>(sheets[i].get());
        if (!sheet->length())
            continue;
        result.append(sheet);
    }
}
Esempio n. 2
0
void SVGFontFaceElement::removeFromMappedElementSheet()
{
    CSSStyleSheet* mappedElementSheet = document()->mappedElementSheet();
    if (!mappedElementSheet)
        return;

    for (unsigned i = 0; i < mappedElementSheet->length(); ++i) {
        if (mappedElementSheet->item(i) == m_fontFaceRule) {
            mappedElementSheet->remove(i);
            break;
        }
    }
    document()->styleSelectorChanged(DeferRecalcStyle);
}
static CSSStyleSheet* findStyleSheet(StyleEngine* styleEngine, StyleRule* rule)
{
    // FIXME: StyleEngine has a bunch of different accessors for StyleSheet lists, is this the only one we need to care about?
    const Vector<RefPtr<CSSStyleSheet> >& stylesheets = styleEngine->activeAuthorStyleSheets();
    for (size_t i = 0; i < stylesheets.size(); ++i) {
        CSSStyleSheet* sheet = stylesheets[i].get();
        for (unsigned j = 0; j < sheet->length(); ++j) {
            CSSRule* cssRule = sheet->item(j);
            if (cssRule->type() != CSSRule::STYLE_RULE)
                continue;
            CSSStyleRule* cssStyleRule = toCSSStyleRule(cssRule);
            if (cssStyleRule->styleRule() == rule)
                return sheet;
        }
    }
    return 0;
}
Esempio n. 4
0
void CSSStyleSheet::addSubresourceStyleURLs(ListHashSet<KURL>& urls)
{
    Deque<CSSStyleSheet*> styleSheetQueue;
    styleSheetQueue.append(this);

    while (!styleSheetQueue.isEmpty()) {
        CSSStyleSheet* styleSheet = styleSheetQueue.takeFirst();

        for (unsigned i = 0; i < styleSheet->length(); ++i) {
            CSSRule* rule = styleSheet->item(i);
            if (rule->isImportRule()) {
                if (CSSStyleSheet* ruleStyleSheet = static_cast<CSSImportRule*>(rule)->styleSheet())
                    styleSheetQueue.append(ruleStyleSheet);
            }
            rule->addSubresourceStyleURLs(urls);
        }
    }
}
Esempio n. 5
0
void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle)
{
    if (m_isRevalidating)
        return;

    m_isRevalidating = true;
    CSSStyleSheet* parsedSheet = m_parsedStyleSheet->cssStyleSheet();
    for (unsigned i = 0, size = parsedSheet->length(); i < size; ++i) {
        StyleBase* styleBase = parsedSheet->item(i);
        CSSStyleRule* parsedRule = InspectorCSSAgent::asCSSStyleRule(styleBase);
        if (!parsedRule)
            continue;
        if (parsedRule->style() == pageStyle) {
            if (parsedRule->style()->cssText() != pageStyle->cssText())
                innerSetStyleText(pageStyle, pageStyle->cssText());
            break;
        }
    }
    m_isRevalidating = false;
}