void CSSImportRule::insertedIntoParent() { CSSStyleSheet* parentSheet = parentStyleSheet(); if (!parentSheet) return; DocLoader* docLoader = parentSheet->doc()->docLoader(); if (!docLoader) return; String absHref = m_strHref; if (!parentSheet->putativeBaseURL().isNull()) // use parent styleheet's URL as the base URL absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string(); // Check for a cycle in our import chain. If we encounter a stylesheet // in our parent chain with the same URL, then just bail. StyleBase* root = this; for (StyleBase* curr = parent(); curr; curr = curr->parent()) { // FIXME: This is wrong if the putativeBaseURL was updated via document::updateBaseURL. if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->putativeBaseURL().string()) return; root = curr; } if (parentSheet->isUserStyleSheet()) m_cachedSheet = docLoader->requestUserCSSStyleSheet(absHref, parentSheet->charset()); else m_cachedSheet = docLoader->requestCSSStyleSheet(absHref, parentSheet->charset()); if (m_cachedSheet) { // 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 (parentSheet && parentSheet->loadCompleted() && root == parentSheet) parentSheet->doc()->addPendingSheet(); m_loading = true; m_cachedSheet->addClient(this); } }