mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix (most) generated includes to have gen/ in their path. This makes it easier to tell where files exist on disk. Unfortunately I had to leave the old include path in engine/BUILD.gn to support all the v8 includes which were too many to deal with in this patch. It's a little nasty to have the raw build directory in our include path, but it produces nicer paths. R=abarth@chromium.org
86 lines
2.0 KiB
C++
86 lines
2.0 KiB
C++
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "config.h"
|
|
#include "core/html/HTMLImportElement.h"
|
|
|
|
#include "core/dom/Document.h"
|
|
#include "core/fetch/FetchRequest.h"
|
|
#include "core/html/imports/HTMLImportsController.h"
|
|
#include "core/html/imports/HTMLImportChild.h"
|
|
#include "core/events/Event.h"
|
|
#include "gen/sky/core/EventTypeNames.h"
|
|
|
|
namespace blink {
|
|
|
|
HTMLImportElement::HTMLImportElement(Document& document)
|
|
: HTMLElement(HTMLNames::importTag, document)
|
|
, m_child(nullptr)
|
|
{
|
|
}
|
|
|
|
HTMLImportElement::~HTMLImportElement()
|
|
{
|
|
if (m_child) {
|
|
m_child->clearClient();
|
|
m_child = nullptr;
|
|
}
|
|
}
|
|
|
|
PassRefPtr<HTMLImportElement> HTMLImportElement::create(Document& document)
|
|
{
|
|
return adoptRef(new HTMLImportElement(document));
|
|
}
|
|
|
|
Node::InsertionNotificationRequest HTMLImportElement::insertedInto(ContainerNode* insertionPoint)
|
|
{
|
|
HTMLElement::insertedInto(insertionPoint);
|
|
if (!insertionPoint->inDocument() || isInShadowTree())
|
|
return InsertionDone;
|
|
|
|
if (shouldLoad())
|
|
load();
|
|
|
|
return InsertionDone;
|
|
}
|
|
|
|
bool HTMLImportElement::shouldLoad() const
|
|
{
|
|
return document().frame() || document().importsController();
|
|
}
|
|
|
|
void HTMLImportElement::load()
|
|
{
|
|
if (m_child || !hasAttribute(HTMLNames::srcAttr))
|
|
return;
|
|
KURL url = document().completeURL(getAttribute(HTMLNames::srcAttr));
|
|
m_child = document().ensureImportsController().load(document().import(), this, FetchRequest(ResourceRequest(url)));
|
|
|
|
if (m_child)
|
|
m_child->ownerInserted();
|
|
}
|
|
|
|
void HTMLImportElement::didFinish()
|
|
{
|
|
dispatchEvent(Event::create(EventTypeNames::load));
|
|
}
|
|
|
|
void HTMLImportElement::importChildWasDestroyed(HTMLImportChild* child)
|
|
{
|
|
ASSERT(m_child == child);
|
|
m_child = nullptr;
|
|
}
|
|
|
|
bool HTMLImportElement::isSync() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
Element* HTMLImportElement::link()
|
|
{
|
|
return this;
|
|
}
|
|
|
|
}
|