示例#1
0
void ProcessingInstruction::parseStyleSheet(const String& sheet) {
  if (m_isCSS)
    toCSSStyleSheet(m_sheet.get())->contents()->parseString(sheet);
  else if (m_isXSL)
    toXSLStyleSheet(m_sheet.get())->parseString(sheet);

  clearResource();
  m_loading = false;

  if (m_isCSS)
    toCSSStyleSheet(m_sheet.get())->contents()->checkLoaded();
  else if (m_isXSL)
    toXSLStyleSheet(m_sheet.get())->checkLoaded();
}
v8::Handle<v8::Object> wrap(StyleSheet* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
    ASSERT(impl);
    if (impl->isCSSStyleSheet())
        return wrap(toCSSStyleSheet(impl), creationContext, isolate);
    return V8StyleSheet::createWrapper(impl, creationContext, isolate);
}
示例#3
0
void ProcessingInstruction::parseStyleSheet(const String& sheet)
{
    if (m_isCSS)
        toCSSStyleSheet(*m_sheet).contents().parseString(sheet);
#if ENABLE(XSLT)
    else if (m_isXSL)
        static_cast<XSLStyleSheet*>(m_sheet.get())->parseString(sheet);
#endif

    if (m_cachedSheet)
        m_cachedSheet->removeClient(this);
    m_cachedSheet = 0;

    m_loading = false;

    if (m_isCSS)
        toCSSStyleSheet(*m_sheet).contents().checkLoaded();
#if ENABLE(XSLT)
    else if (m_isXSL)
        static_cast<XSLStyleSheet*>(m_sheet.get())->checkLoaded();
#endif
}
示例#4
0
bool ElementShadow::hasSameStyles(const ElementShadow* other) const
{
    ShadowRoot* root = &youngestShadowRoot();
    ShadowRoot* otherRoot = &other->youngestShadowRoot();
    while (root || otherRoot) {
        if (!root || !otherRoot)
            return false;

        StyleSheetList& list = root->styleSheets();
        StyleSheetList& otherList = otherRoot->styleSheets();

        if (list.length() != otherList.length())
            return false;

        for (size_t i = 0; i < list.length(); i++) {
            if (toCSSStyleSheet(list.item(i))->contents() != toCSSStyleSheet(otherList.item(i))->contents())
                return false;
        }
        root = root->olderShadowRoot();
        otherRoot = otherRoot->olderShadowRoot();
    }

    return true;
}
void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine* engine, DocumentStyleSheetCollector& collector)
{
    DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
    DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
    for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
        Node* n = *it;
        StyleSheetCandidate candidate(*n);

        StyleSheet* sheet = candidate.sheet();
        if (!sheet)
            continue;

        collector.appendSheetForList(sheet);
        if (candidate.canBeActivated())
            collector.appendActiveStyleSheet(toCSSStyleSheet(sheet));
    }
}
void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine* engine, DocumentStyleSheetCollector& collector)
{
    DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
    DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
    for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
        Node* n = *it;
        StyleSheetCandidate candidate(*n);

        ASSERT(!candidate.isXSL());
        if (candidate.isImport()) {
            Document* document = candidate.importedDocument();
            if (!document)
                continue;
            if (collector.hasVisited(document))
                continue;
            collector.willVisit(document);
            document->styleEngine()->updateStyleSheetsInImport(collector);
            continue;
        }

        if (candidate.isEnabledAndLoading()) {
            // it is loading but we should still decide which style sheet set to use
            if (candidate.hasPreferrableName(engine->preferredStylesheetSetName()))
                engine->selectStylesheetSetName(candidate.title());
            continue;
        }

        StyleSheet* sheet = candidate.sheet();
        if (!sheet)
            continue;

        if (candidate.hasPreferrableName(engine->preferredStylesheetSetName()))
            engine->selectStylesheetSetName(candidate.title());
        collector.appendSheetForList(sheet);
        if (candidate.canBeActivated(engine->preferredStylesheetSetName()))
            collector.appendActiveStyleSheet(toCSSStyleSheet(sheet));
    }
}