Commit 4aaa715f authored by dglazkov@chromium.org's avatar dglazkov@chromium.org

Remove the importedDocument functions from HTML imports classes.

The notion of "importedDocument" only exists at the LinkImport level
(because its used, HTMLLinkElement has to deal with both importer
and the importee), so we can just call the imported documents simply
"documents" inside of the imports plumbing.

No functional changes, plumbotron.

R=morrita
BUG=

Review URL: https://codereview.chromium.org/298413004

git-svn-id: svn://svn.chromium.org/blink/trunk@175224 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b069880b
......@@ -101,13 +101,6 @@ bool HTMLImportChild::isFirst() const
return m_loader && m_loader->isFirstImport(this);
}
Document* HTMLImportChild::importedDocument() const
{
if (!m_loader)
return 0;
return m_loader->importedDocument();
}
void HTMLImportChild::importDestroyed()
{
if (parent())
......
......@@ -56,7 +56,6 @@ public:
virtual ~HTMLImportChild();
HTMLLinkElement* link() const;
Document* importedDocument() const;
const KURL& url() const { return m_url; }
void didShareLoader();
......
......@@ -63,10 +63,10 @@ void HTMLImportLoader::importDestroyed()
void HTMLImportLoader::clear()
{
m_controller = 0;
if (m_importedDocument) {
m_importedDocument->setImportsController(0);
m_importedDocument->cancelParsing();
m_importedDocument.clear();
if (m_document) {
m_document->setImportsController(0);
m_document->cancelParsing();
m_document.clear();
}
}
......@@ -109,8 +109,8 @@ HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceR
ASSERT(!m_imports.isEmpty());
DocumentInit init = DocumentInit(response.url(), 0, m_controller->master()->contextDocument(), m_controller)
.withRegistrationContext(m_controller->master()->registrationContext());
m_importedDocument = HTMLDocument::create(init);
m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeType(), "UTF-8");
m_document = HTMLDocument::create(init);
m_writer = DocumentWriter::create(m_document.get(), response.mimeType(), "UTF-8");
return StateLoading;
}
......@@ -162,14 +162,7 @@ void HTMLImportLoader::didRemoveAllPendingStylesheet()
bool HTMLImportLoader::hasPendingResources() const
{
return m_importedDocument && m_importedDocument->styleEngine()->hasPendingSheets();
}
Document* HTMLImportLoader::importedDocument() const
{
if (m_state == StateError)
return 0;
return m_importedDocument.get();
return m_document && m_document->styleEngine()->hasPendingSheets();
}
void HTMLImportLoader::didFinishLoading()
......@@ -179,7 +172,7 @@ void HTMLImportLoader::didFinishLoading()
clearResource();
ASSERT(!m_importedDocument || !m_importedDocument->parsing());
ASSERT(!m_document || !m_document->parsing());
}
void HTMLImportLoader::moveToFirst(HTMLImportChild* import)
......
......@@ -70,8 +70,7 @@ public:
virtual ~HTMLImportLoader();
Document* document() const { return m_importedDocument.get(); }
Document* importedDocument() const;
Document* document() const { return m_document.get(); }
void addImport(HTMLImportChild*);
void removeImport(HTMLImportChild*);
void moveToFirst(HTMLImportChild*);
......@@ -116,7 +115,7 @@ private:
HTMLImportsController* m_controller;
Vector<HTMLImportChild*> m_imports;
State m_state;
RefPtr<Document> m_importedDocument;
RefPtr<Document> m_document;
RefPtr<DocumentWriter> m_writer;
RefPtrWillBePersistent<CustomElementMicrotaskQueue> m_microtaskQueue;
};
......
......@@ -64,7 +64,9 @@ Document* LinkImport::importedDocument() const
{
if (!m_child || !m_owner || !m_owner->inDocument())
return 0;
return m_child->importedDocument();
if (m_child->loader()->hasError())
return 0;
return m_child->document();
}
void LinkImport::process()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment