void DocumentStyleSheetCollection::maybeAddContentExtensionSheet(const String& identifier, StyleSheetContents& sheet) { ASSERT(sheet.isUserStyleSheet()); if (m_contentExtensionSheets.contains(identifier)) return; Ref<CSSStyleSheet> cssSheet = CSSStyleSheet::create(sheet, &m_document); m_contentExtensionSheets.set(identifier, &cssSheet.get()); m_userStyleSheets.append(adoptRef(cssSheet.leakRef())); m_styleResolverChangedTimer.startOneShot(0); }
void StyleRuleImport::requestStyleSheet(CSSStyleSheet* rootSheet, const CSSParserContext& parserContext) { ASSERT(!rootSheet->parentStyleSheet()); ASSERT(!m_cachedSheet); Node* ownerNode = rootSheet->ownerNode(); if (!ownerNode) return; Document* document = ownerNode->document(); KURL resolvedURL; if (!parserContext.baseURL.isNull()) resolvedURL = KURL(parserContext.baseURL, m_strHref); else resolvedURL = document->completeURL(m_strHref); StyleSheetContents* rootSheetContents = rootSheet->contents(); if (rootSheetContents->hasImportCycle(this, resolvedURL, document->baseURL())) return; ResourceRequest request(resolvedURL); CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader(); if (rootSheetContents->isUserStyleSheet()) m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, parserContext.charset); else m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request, parserContext.charset); if (!m_cachedSheet) return; // if the import rule is issued dynamically, the sheet may be // removed from the pending sheet count, so let the doc know // the sheet being imported is pending. if (rootSheetContents->loadCompleted()) ownerNode->startLoadingDynamicSheet(); m_loadContext = adoptPtr(new LoadContext(rootSheet, parserContext)); m_cachedSheet->addClient(this); }