diff --git a/engine/bindings/core/v8/ScriptController.cpp b/engine/bindings/core/v8/ScriptController.cpp index db558ee2bc6..1f5fec302af 100644 --- a/engine/bindings/core/v8/ScriptController.cpp +++ b/engine/bindings/core/v8/ScriptController.cpp @@ -53,7 +53,6 @@ #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" -#include "core/html/HTMLLinkElement.h" #include "core/html/imports/HTMLImportChild.h" #include "core/html/imports/HTMLImportLoader.h" #include "core/html/parser/HTMLDocumentParser.h" diff --git a/engine/core/core.gni b/engine/core/core.gni index afffcf52c16..2531a7b15ac 100644 --- a/engine/core/core.gni +++ b/engine/core/core.gni @@ -760,8 +760,6 @@ sky_core_files = [ "html/HTMLImageLoader.h", "html/HTMLImportElement.cpp", "html/HTMLImportElement.h", - "html/HTMLLinkElement.cpp", - "html/HTMLLinkElement.h", "html/HTMLMediaElement.cpp", "html/HTMLMediaSource.cpp", "html/HTMLMediaSource.h", @@ -783,10 +781,6 @@ sky_core_files = [ "html/HTMLVideoElement.h", "html/ImageData.cpp", "html/ImageData.h", - "html/LinkRelAttribute.cpp", - "html/LinkRelAttribute.h", - "html/LinkResource.cpp", - "html/LinkResource.h", "html/MediaError.h", "html/MediaFragmentURIParser.cpp", "html/MediaFragmentURIParser.h", @@ -922,8 +916,6 @@ sky_core_files = [ "html/imports/HTMLImportTreeRoot.h", "html/imports/HTMLImportsController.cpp", "html/imports/HTMLImportsController.h", - "html/imports/LinkImport.cpp", - "html/imports/LinkImport.h", "html/parser/AtomicHTMLToken.h", "html/parser/BackgroundHTMLParser.cpp", "html/parser/BackgroundHTMLParser.h", @@ -1271,7 +1263,6 @@ core_idl_files = get_path_info([ "html/HTMLElement.idl", "html/HTMLImageElement.idl", "html/HTMLImportElement.idl", - "html/HTMLLinkElement.idl", "html/HTMLMediaElement.idl", "html/HTMLMetaElement.idl", "html/HTMLPictureElement.idl", diff --git a/engine/core/css/CSSStyleSheet.cpp b/engine/core/css/CSSStyleSheet.cpp index f57c5b845b0..133da5cfc3b 100644 --- a/engine/core/css/CSSStyleSheet.cpp +++ b/engine/core/css/CSSStyleSheet.cpp @@ -77,7 +77,6 @@ static bool isAcceptableCSSStyleSheetParent(Node* parentNode) // clearOwnerNode() in the owner's destructor in oilpan. return !parentNode || parentNode->isDocumentNode() - || isHTMLLinkElement(*parentNode) || isHTMLStyleElement(*parentNode); } #endif diff --git a/engine/core/dom/Document.cpp b/engine/core/dom/Document.cpp index 80675feb6fd..a4bb624ab98 100644 --- a/engine/core/dom/Document.cpp +++ b/engine/core/dom/Document.cpp @@ -101,7 +101,6 @@ #include "core/html/HTMLAnchorElement.h" #include "core/html/HTMLCanvasElement.h" #include "core/html/HTMLDocument.h" -#include "core/html/HTMLLinkElement.h" #include "core/html/HTMLMetaElement.h" #include "core/html/HTMLScriptElement.h" #include "core/html/HTMLStyleElement.h" @@ -1525,7 +1524,6 @@ void Document::implicitClose() if (frame()) { ImageLoader::dispatchPendingLoadEvents(); ImageLoader::dispatchPendingErrorEvents(); - HTMLLinkElement::dispatchPendingLoadEvents(); } // JS running below could remove the frame or destroy the RenderView so we call diff --git a/engine/core/dom/Document.h b/engine/core/dom/Document.h index 23b3f058aed..ea4c0b85b00 100644 --- a/engine/core/dom/Document.h +++ b/engine/core/dom/Document.h @@ -94,7 +94,6 @@ class HTMLElement; class HTMLImport; class HTMLImportLoader; class HTMLImportsController; -class HTMLLinkElement; class HTMLScriptElement; class HitTestRequest; class LayoutPoint; diff --git a/engine/core/dom/DocumentStyleSheetCollection.cpp b/engine/core/dom/DocumentStyleSheetCollection.cpp index f9ec3de5847..1aa68c6efac 100644 --- a/engine/core/dom/DocumentStyleSheetCollection.cpp +++ b/engine/core/dom/DocumentStyleSheetCollection.cpp @@ -50,17 +50,6 @@ void DocumentStyleSheetCollection::collectStyleSheetsFromCandidates(StyleEngine* Node* n = *it; StyleSheetCandidate candidate(*n); - if (candidate.isImport()) { - Document* document = candidate.importedDocument(); - if (!document) - continue; - if (collector.hasVisited(document)) - continue; - collector.willVisit(document); - document->styleEngine()->updateStyleSheetsInImport(collector); - continue; - } - StyleSheet* sheet = candidate.sheet(); if (!sheet) continue; diff --git a/engine/core/dom/DocumentTest.cpp b/engine/core/dom/DocumentTest.cpp index ff38700bc87..8bd8b16a0ca 100644 --- a/engine/core/dom/DocumentTest.cpp +++ b/engine/core/dom/DocumentTest.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "core/dom/Document.h" -#include "core/html/HTMLLinkElement.h" #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include diff --git a/engine/core/dom/Element.cpp b/engine/core/dom/Element.cpp index b2ed848c9bb..5ecf31db868 100644 --- a/engine/core/dom/Element.cpp +++ b/engine/core/dom/Element.cpp @@ -1502,7 +1502,7 @@ KURL Element::hrefURL() const { // FIXME: These all have href() or url(), but no common super class. Why doesn't // implement URLUtils? - if (isHTMLAnchorElement(*this) || isHTMLLinkElement(*this)) + if (isHTMLAnchorElement(*this)) return getURLAttribute(HTMLNames::hrefAttr); return KURL(); } diff --git a/engine/core/dom/StyleEngine.cpp b/engine/core/dom/StyleEngine.cpp index 1dc05a2a008..72bde653d1e 100644 --- a/engine/core/dom/StyleEngine.cpp +++ b/engine/core/dom/StyleEngine.cpp @@ -36,7 +36,7 @@ #include "core/dom/Element.h" #include "core/dom/ShadowTreeStyleSheetCollection.h" #include "core/dom/shadow/ShadowRoot.h" -#include "core/html/HTMLLinkElement.h" +#include "core/html/HTMLStyleElement.h" #include "core/html/imports/HTMLImportsController.h" #include "core/page/Page.h" #include "core/frame/Settings.h" diff --git a/engine/core/dom/StyleSheetCandidate.cpp b/engine/core/dom/StyleSheetCandidate.cpp index 680a4039e49..80ea3d06dfe 100644 --- a/engine/core/dom/StyleSheetCandidate.cpp +++ b/engine/core/dom/StyleSheetCandidate.cpp @@ -29,23 +29,11 @@ #include "core/dom/Element.h" #include "core/dom/StyleEngine.h" -#include "core/html/HTMLLinkElement.h" #include "core/html/HTMLStyleElement.h" #include "core/html/imports/HTMLImport.h" namespace blink { -bool StyleSheetCandidate::isImport() const -{ - return m_type == HTMLLink && toHTMLLinkElement(node()).isImport(); -} - -Document* StyleSheetCandidate::importedDocument() const -{ - ASSERT(isImport()); - return toHTMLLinkElement(node()).import(); -} - bool StyleSheetCandidate::canBeActivated() const { StyleSheet* sheet = this->sheet(); @@ -55,8 +43,6 @@ bool StyleSheetCandidate::canBeActivated() const StyleSheetCandidate::Type StyleSheetCandidate::typeOf(Node& node) { if (node.isHTMLElement()) { - if (isHTMLLinkElement(node)) - return HTMLLink; if (isHTMLStyleElement(node)) return HTMLStyle; @@ -71,8 +57,6 @@ StyleSheetCandidate::Type StyleSheetCandidate::typeOf(Node& node) StyleSheet* StyleSheetCandidate::sheet() const { switch (m_type) { - case HTMLLink: - return toHTMLLinkElement(node()).sheet(); case HTMLStyle: return toHTMLStyleElement(node()).sheet(); } diff --git a/engine/core/dom/StyleSheetCandidate.h b/engine/core/dom/StyleSheetCandidate.h index 6fba5c06c69..d6242edd75d 100644 --- a/engine/core/dom/StyleSheetCandidate.h +++ b/engine/core/dom/StyleSheetCandidate.h @@ -41,7 +41,6 @@ class StyleSheetCandidate { STACK_ALLOCATED(); public: enum Type { - HTMLLink, HTMLStyle, }; @@ -50,11 +49,9 @@ public: , m_type(typeOf(node)) { } - bool isImport() const; bool canBeActivated() const; StyleSheet* sheet() const; - Document* importedDocument() const; private: Node& node() const { return *m_node; } diff --git a/engine/core/dom/TreeScopeStyleSheetCollection.cpp b/engine/core/dom/TreeScopeStyleSheetCollection.cpp index 6afe5f1327b..492d30cbd3f 100644 --- a/engine/core/dom/TreeScopeStyleSheetCollection.cpp +++ b/engine/core/dom/TreeScopeStyleSheetCollection.cpp @@ -33,7 +33,6 @@ #include "core/css/resolver/StyleResolver.h" #include "core/dom/Element.h" #include "core/dom/StyleEngine.h" -#include "core/html/HTMLLinkElement.h" #include "core/html/HTMLStyleElement.h" namespace blink { diff --git a/engine/core/editing/DeleteSelectionCommand.cpp b/engine/core/editing/DeleteSelectionCommand.cpp index 3a45fa7fa6c..4a29796c5c4 100644 --- a/engine/core/editing/DeleteSelectionCommand.cpp +++ b/engine/core/editing/DeleteSelectionCommand.cpp @@ -334,7 +334,7 @@ void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPr RefPtr node = range->firstNode(); while (node && node != range->pastLastNode()) { RefPtr nextNode = NodeTraversal::next(*node); - if (isHTMLStyleElement(*node) || isHTMLLinkElement(*node)) { + if (isHTMLStyleElement(*node)) { nextNode = NodeTraversal::nextSkippingChildren(*node); RefPtr rootEditableElement = node->rootEditableElement(); if (rootEditableElement.get()) { diff --git a/engine/core/html/HTMLImportElement.cpp b/engine/core/html/HTMLImportElement.cpp index 6d166cdc0fb..bb759cb0716 100644 --- a/engine/core/html/HTMLImportElement.cpp +++ b/engine/core/html/HTMLImportElement.cpp @@ -6,6 +6,7 @@ #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" diff --git a/engine/core/html/HTMLLinkElement.cpp b/engine/core/html/HTMLLinkElement.cpp deleted file mode 100644 index 0ecfa86a8cc..00000000000 --- a/engine/core/html/HTMLLinkElement.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "core/html/HTMLLinkElement.h" - -#include "core/HTMLNames.h" -#include "core/css/MediaList.h" -#include "core/css/MediaQueryEvaluator.h" -#include "core/css/StyleSheetContents.h" -#include "core/css/resolver/StyleResolver.h" -#include "core/dom/Attribute.h" -#include "core/dom/Document.h" -#include "core/dom/StyleEngine.h" -#include "core/events/Event.h" -#include "core/events/EventSender.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/frame/FrameView.h" -#include "core/frame/LocalFrame.h" -#include "core/html/imports/LinkImport.h" -#include "core/html/parser/HTMLParserIdioms.h" -#include "core/loader/FrameLoaderClient.h" -#include "core/rendering/style/RenderStyle.h" -#include "core/rendering/style/StyleInheritedData.h" -#include "platform/RuntimeEnabledFeatures.h" -#include "wtf/StdLibExtras.h" - -namespace blink { - -template -static void parseSizes(const CharacterType* value, unsigned length, Vector& iconSizes) -{ - enum State { - ParseStart, - ParseWidth, - ParseHeight - }; - int width = 0; - unsigned start = 0; - unsigned i = 0; - State state = ParseStart; - bool invalid = false; - for (; i < length; ++i) { - if (state == ParseWidth) { - if (value[i] == 'x' || value[i] == 'X') { - if (i == start) { - invalid = true; - break; - } - width = charactersToInt(value + start, i - start); - start = i + 1; - state = ParseHeight; - } else if (value[i] < '0' || value[i] > '9') { - invalid = true; - break; - } - } else if (state == ParseHeight) { - if (value[i] == ' ') { - if (i == start) { - invalid = true; - break; - } - int height = charactersToInt(value + start, i - start); - iconSizes.append(IntSize(width, height)); - start = i + 1; - state = ParseStart; - } else if (value[i] < '0' || value[i] > '9') { - invalid = true; - break; - } - } else if (state == ParseStart) { - if (value[i] >= '0' && value[i] <= '9') { - start = i; - state = ParseWidth; - } else if (value[i] != ' ') { - invalid = true; - break; - } - } - } - if (invalid || state == ParseWidth || (state == ParseHeight && start == i)) { - iconSizes.clear(); - return; - } - if (state == ParseHeight && i > start) { - int height = charactersToInt(value + start, i - start); - iconSizes.append(IntSize(width, height)); - } -} - -static LinkEventSender& linkLoadEventSender() -{ - DEFINE_STATIC_LOCAL(LinkEventSender, sharedLoadEventSender, (EventTypeNames::load)); - return sharedLoadEventSender; -} - -void HTMLLinkElement::parseSizesAttribute(const AtomicString& value, Vector& iconSizes) -{ - ASSERT(iconSizes.isEmpty()); - if (value.isEmpty()) - return; - if (value.is8Bit()) - parseSizes(value.characters8(), value.length(), iconSizes); - else - parseSizes(value.characters16(), value.length(), iconSizes); -} - -inline HTMLLinkElement::HTMLLinkElement(Document& document, bool createdByParser) - : HTMLElement(HTMLNames::linkTag, document) - , m_sizes(DOMSettableTokenList::create()) - , m_createdByParser(createdByParser) - , m_isInShadowTree(false) -{ - ScriptWrappable::init(this); -} - -PassRefPtr HTMLLinkElement::create(Document& document, bool createdByParser) -{ - return adoptRef(new HTMLLinkElement(document, createdByParser)); -} - -HTMLLinkElement::~HTMLLinkElement() -{ -#if !ENABLE(OILPAN) - m_link.clear(); - - if (inDocument()) - document().styleEngine()->removeStyleSheetCandidateNode(this); -#endif - - linkLoadEventSender().cancelEvent(this); -} - -void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicString& value) -{ - if (name == HTMLNames::relAttr) { - m_relAttribute = LinkRelAttribute(value); - process(); - } else if (name == HTMLNames::hrefAttr) { - process(); - } else if (name == HTMLNames::typeAttr) { - m_type = value; - process(); - } else if (name == HTMLNames::sizesAttr) { - m_sizes->setValue(value); - parseSizesAttribute(value, m_iconSizes); - process(); - } else if (name == HTMLNames::mediaAttr) { - m_media = value.string().lower(); - process(); - } else { - HTMLElement::parseAttribute(name, value); - } -} - -LinkResource* HTMLLinkElement::linkResourceToProcess() -{ - bool visible = inDocument() && !m_isInShadowTree; - if (!visible) - return 0; - - if (!m_link && m_relAttribute.isImport()) - m_link = LinkImport::create(this); - - return m_link.get(); -} - -LinkImport* HTMLLinkElement::linkImport() const -{ - if (!m_link || m_link->type() != LinkResource::Import) - return 0; - return static_cast(m_link.get()); -} - -Document* HTMLLinkElement::import() const -{ - if (LinkImport* link = linkImport()) - return link->importedDocument(); - return 0; -} - -void HTMLLinkElement::process() -{ - if (LinkResource* link = linkResourceToProcess()) - link->process(); -} - -Node::InsertionNotificationRequest HTMLLinkElement::insertedInto(ContainerNode* insertionPoint) -{ - HTMLElement::insertedInto(insertionPoint); - if (!insertionPoint->inDocument()) - return InsertionDone; - - m_isInShadowTree = isInShadowTree(); - if (m_isInShadowTree) - return InsertionDone; - - document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser); - - process(); - - if (m_link) - m_link->ownerInserted(); - - return InsertionDone; -} - -void HTMLLinkElement::removedFrom(ContainerNode* insertionPoint) -{ - HTMLElement::removedFrom(insertionPoint); - if (!insertionPoint->inDocument()) - return; - - if (m_isInShadowTree) - return; - document().styleEngine()->removeStyleSheetCandidateNode(this); - - RefPtr removedSheet = sheet(); - - if (m_link) - m_link->ownerRemoved(); - - document().removedStyleSheet(removedSheet.get()); -} - -void HTMLLinkElement::finishParsingChildren() -{ - m_createdByParser = false; - HTMLElement::finishParsingChildren(); -} - -void HTMLLinkElement::dispatchPendingLoadEvents() -{ - linkLoadEventSender().dispatchPendingEvents(); -} - -void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender) -{ - ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender()); - ASSERT(m_link); - // FIXME(sky): Remove -} - -void HTMLLinkElement::scheduleEvent() -{ - linkLoadEventSender().dispatchEventSoon(this); -} - -bool HTMLLinkElement::isURLAttribute(const Attribute& attribute) const -{ - return attribute.name().localName() == HTMLNames::hrefAttr || HTMLElement::isURLAttribute(attribute); -} - -bool HTMLLinkElement::hasLegalLinkAttribute(const QualifiedName& name) const -{ - return name == HTMLNames::hrefAttr || HTMLElement::hasLegalLinkAttribute(name); -} - -const QualifiedName& HTMLLinkElement::subResourceAttributeName() const -{ - // If the link element is not css, ignore it. - if (equalIgnoringCase(getAttribute(HTMLNames::typeAttr), "text/css")) { - // FIXME: Add support for extracting links of sub-resources which - // are inside style-sheet such as @import, @font-face, url(), etc. - return HTMLNames::hrefAttr; - } - return HTMLElement::subResourceAttributeName(); -} - -KURL HTMLLinkElement::href() const -{ - return document().completeURL(getAttribute(HTMLNames::hrefAttr)); -} - -const AtomicString& HTMLLinkElement::rel() const -{ - return getAttribute(HTMLNames::relAttr); -} - -const AtomicString& HTMLLinkElement::type() const -{ - return getAttribute(HTMLNames::typeAttr); -} - -bool HTMLLinkElement::async() const -{ - return hasAttribute(HTMLNames::asyncAttr); -} - -String HTMLLinkElement::as() const -{ - return stripLeadingAndTrailingHTMLSpaces(getAttribute(HTMLNames::asAttr)); -} - -const Vector& HTMLLinkElement::iconSizes() const -{ - return m_iconSizes; -} - -DOMSettableTokenList* HTMLLinkElement::sizes() const -{ - return m_sizes.get(); -} - -void HTMLLinkElement::trace(Visitor* visitor) -{ - visitor->trace(m_link); - visitor->trace(m_sizes); - HTMLElement::trace(visitor); -} - -} // namespace blink diff --git a/engine/core/html/HTMLLinkElement.h b/engine/core/html/HTMLLinkElement.h deleted file mode 100644 index b236386fb5f..00000000000 --- a/engine/core/html/HTMLLinkElement.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef HTMLLinkElement_h -#define HTMLLinkElement_h - -#include "core/css/CSSStyleSheet.h" -#include "core/dom/DOMSettableTokenList.h" -#include "core/fetch/ResourceOwner.h" -#include "core/html/HTMLElement.h" -#include "core/html/LinkRelAttribute.h" -#include "core/html/LinkResource.h" - -namespace blink { - -class DocumentFragment; -class HTMLLinkElement; -class KURL; -class LinkImport; - -template class EventSender; -typedef EventSender LinkEventSender; - -class HTMLLinkElement final : public HTMLElement { - DEFINE_WRAPPERTYPEINFO(); -public: - static PassRefPtr create(Document&, bool createdByParser); - virtual ~HTMLLinkElement(); - - KURL href() const; - const AtomicString& rel() const; - String media() const { return m_media; } - String typeValue() const { return m_type; } - const LinkRelAttribute& relAttribute() const { return m_relAttribute; } - - const AtomicString& type() const; - - // the icon sizes as parsed from the HTML attribute - const Vector& iconSizes() const; - - bool async() const; - String as() const; - - CSSStyleSheet* sheet() const { return 0; } - Document* import() const; - - bool isImport() const { return linkImport(); } - bool isDisabled() const { return false; } - - DOMSettableTokenList* sizes() const; - - void dispatchPendingEvent(LinkEventSender*); - void scheduleEvent(); - void dispatchEventImmediately(); - static void dispatchPendingLoadEvents(); - - // For LinkStyle - bool shouldProcessStyle() { return false; } - bool isCreatedByParser() const { return m_createdByParser; } - - // Parse the icon size attribute into |iconSizes|, make this method public - // visible for testing purpose. - static void parseSizesAttribute(const AtomicString& value, Vector& iconSizes); - - virtual void trace(Visitor*) override; - -private: - virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; - - LinkImport* linkImport() const; - LinkResource* linkResourceToProcess(); - - void process(); - static void processCallback(Node*); - - // From Node and subclassses - virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; - virtual void removedFrom(ContainerNode*) override; - virtual bool isURLAttribute(const Attribute&) const override; - virtual bool hasLegalLinkAttribute(const QualifiedName&) const override; - virtual const QualifiedName& subResourceAttributeName() const override; - virtual void finishParsingChildren() override; - -private: - HTMLLinkElement(Document&, bool createdByParser); - - OwnPtr m_link; - - String m_type; - String m_media; - RefPtr m_sizes; - Vector m_iconSizes; - LinkRelAttribute m_relAttribute; - - bool m_createdByParser; - bool m_isInShadowTree; -}; - -} // namespace blink - -#endif // HTMLLinkElement_h diff --git a/engine/core/html/HTMLLinkElement.idl b/engine/core/html/HTMLLinkElement.idl deleted file mode 100644 index 50fb48bb547..00000000000 --- a/engine/core/html/HTMLLinkElement.idl +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2006 Samuel Weinig - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -interface HTMLLinkElement : HTMLElement { - [Reflect, URL] attribute DOMString href; - [Reflect] attribute DOMString rel; - readonly attribute Document import; -}; diff --git a/engine/core/html/HTMLLinkElementSizesAttributeTest.cpp b/engine/core/html/HTMLLinkElementSizesAttributeTest.cpp deleted file mode 100644 index 1c901b7dc51..00000000000 --- a/engine/core/html/HTMLLinkElementSizesAttributeTest.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// 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/HTMLLinkElement.h" - -#include - -using namespace blink; - -namespace { - -class HTMLLinkElementSizesAttributeTest : public testing::Test { -}; - -TEST(HTMLLinkElementSizesAttributeTest, parseSizes) -{ - AtomicString sizesAttribute = "32x33"; - Vector sizes; - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(1U, sizes.size()); - EXPECT_EQ(32, sizes[0].width()); - EXPECT_EQ(33, sizes[0].height()); - - UChar attribute[] = {'3', '2', 'x', '3', '3', 0}; - sizesAttribute = attribute; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(1U, sizes.size()); - EXPECT_EQ(32, sizes[0].width()); - EXPECT_EQ(33, sizes[0].height()); - - - sizesAttribute = " 32x33 16X17 128x129 "; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(3U, sizes.size()); - EXPECT_EQ(32, sizes[0].width()); - EXPECT_EQ(33, sizes[0].height()); - EXPECT_EQ(16, sizes[1].width()); - EXPECT_EQ(17, sizes[1].height()); - EXPECT_EQ(128, sizes[2].width()); - EXPECT_EQ(129, sizes[2].height()); - - sizesAttribute = "any"; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(0U, sizes.size()); - - sizesAttribute = "32x33 32"; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(0U, sizes.size()); - - sizesAttribute = "32x33 32x"; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(0U, sizes.size()); - - sizesAttribute = "32x33 x32"; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(0U, sizes.size()); - - sizesAttribute = "32x33 any"; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(0U, sizes.size()); - - sizesAttribute = "32x33, 64x64"; - sizes.clear(); - HTMLLinkElement::parseSizesAttribute(sizesAttribute, sizes); - ASSERT_EQ(0U, sizes.size()); -} - -} // namespace diff --git a/engine/core/html/HTMLTagNames.in b/engine/core/html/HTMLTagNames.in index b70db649620..1879c94c0d4 100644 --- a/engine/core/html/HTMLTagNames.in +++ b/engine/core/html/HTMLTagNames.in @@ -7,7 +7,6 @@ canvas content interfaceName=HTMLContentElement img interfaceName=HTMLImageElement, constructorNeedsCreatedByParser import -link constructorNeedsCreatedByParser meta picture interfaceName=HTMLPictureElement script diff --git a/engine/core/html/LinkRelAttribute.cpp b/engine/core/html/LinkRelAttribute.cpp deleted file mode 100644 index 1c55756306f..00000000000 --- a/engine/core/html/LinkRelAttribute.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "config.h" -#include "core/html/LinkRelAttribute.h" - -#include "platform/RuntimeEnabledFeatures.h" - -namespace blink { - -LinkRelAttribute::LinkRelAttribute(const String& rel) - : m_isStyleSheet(false) - , m_isLinkPrefetch(false) - , m_isLinkSubresource(false) - , m_isLinkNext(false) - , m_isImport(false) - , m_isManifest(false) -{ - if (rel.isEmpty()) - return; - String relCopy = rel; - relCopy.replace('\n', ' '); - Vector list; - relCopy.split(' ', list); - Vector::const_iterator end = list.end(); - for (Vector::const_iterator it = list.begin(); it != end; ++it) { - if (equalIgnoringCase(*it, "stylesheet")) { - if (!m_isImport) - m_isStyleSheet = true; - } else if (equalIgnoringCase(*it, "import")) { - if (!m_isStyleSheet) - m_isImport = true; - } else if (equalIgnoringCase(*it, "prefetch")) { - m_isLinkPrefetch = true; - } else if (equalIgnoringCase(*it, "subresource")) { - m_isLinkSubresource = true; - } else if (equalIgnoringCase(*it, "next")) { - m_isLinkNext = true; - } else if (equalIgnoringCase(*it, "manifest")) { - m_isManifest = true; - } - } -} - -} diff --git a/engine/core/html/LinkRelAttribute.h b/engine/core/html/LinkRelAttribute.h deleted file mode 100644 index b450024f2f1..00000000000 --- a/engine/core/html/LinkRelAttribute.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef LinkRelAttribute_h -#define LinkRelAttribute_h - -#include "wtf/text/WTFString.h" - -namespace blink { - -class LinkRelAttribute { -public: - explicit LinkRelAttribute(const String& = ""); - - bool isStyleSheet() const { return m_isStyleSheet; } - bool isLinkPrefetch() const { return m_isLinkPrefetch; } - bool isLinkSubresource() const { return m_isLinkSubresource; } - bool isLinkNext() const { return m_isLinkNext; } - bool isImport() const { return m_isImport; } - bool isManifest() const { return m_isManifest; } - -private: - bool m_isStyleSheet : 1; - bool m_isLinkPrefetch : 1; - bool m_isLinkSubresource : 1; - bool m_isLinkNext : 1; - bool m_isImport : 1; - bool m_isManifest : 1; -}; - -} - -#endif - diff --git a/engine/core/html/LinkResource.cpp b/engine/core/html/LinkResource.cpp deleted file mode 100644 index b08d090feed..00000000000 --- a/engine/core/html/LinkResource.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/html/LinkResource.h" - -#include "core/HTMLNames.h" -#include "core/dom/Document.h" -#include "core/html/HTMLLinkElement.h" -#include "core/html/imports/HTMLImportsController.h" - -namespace blink { - -LinkResource::LinkResource(HTMLLinkElement* owner) - : m_owner(owner) -{ -} - -LinkResource::~LinkResource() -{ -} - -bool LinkResource::shouldLoadResource() const -{ - return m_owner->document().frame() || m_owner->document().importsController(); -} - -LocalFrame* LinkResource::loadingFrame() const -{ - HTMLImportsController* importsController = m_owner->document().importsController(); - if (!importsController) - return m_owner->document().frame(); - return importsController->master()->frame(); -} - -void LinkResource::trace(Visitor* visitor) -{ - visitor->trace(m_owner); -} - -LinkRequestBuilder::LinkRequestBuilder(HTMLLinkElement* owner) - : m_owner(owner) - , m_url(owner->getNonEmptyURLAttribute(HTMLNames::hrefAttr)) -{ - m_charset = m_owner->getAttribute(HTMLNames::charsetAttr); - if (m_charset.isEmpty() && m_owner->document().frame()) - m_charset = m_owner->document().charset(); -} - -FetchRequest LinkRequestBuilder::build(bool blocking) const -{ - ResourceLoadPriority priority = blocking ? ResourceLoadPriorityUnresolved : ResourceLoadPriorityVeryLow; - return FetchRequest(ResourceRequest(m_owner->document().completeURL(m_url)), m_owner->localName(), m_charset, priority); -} - -} // namespace blink diff --git a/engine/core/html/LinkResource.h b/engine/core/html/LinkResource.h deleted file mode 100644 index d8531ae6f14..00000000000 --- a/engine/core/html/LinkResource.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef LinkResource_h -#define LinkResource_h - -#include "core/fetch/FetchRequest.h" -#include "platform/heap/Handle.h" -#include "platform/weborigin/KURL.h" -#include "wtf/text/WTFString.h" - -namespace blink { - -class HTMLLinkElement; - -class LinkResource : public DummyBase { - WTF_MAKE_NONCOPYABLE(LinkResource); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; -public: - enum Type { - Style, - Import, - Manifest - }; - - explicit LinkResource(HTMLLinkElement*); - virtual ~LinkResource(); - - bool shouldLoadResource() const; - LocalFrame* loadingFrame() const; - - virtual Type type() const = 0; - virtual void process() = 0; - virtual void ownerRemoved() { } - virtual void ownerInserted() { } - virtual bool hasLoaded() const = 0; - - virtual void trace(Visitor*); - -protected: - RawPtr m_owner; -}; - -class LinkRequestBuilder { - STACK_ALLOCATED(); -public: - explicit LinkRequestBuilder(HTMLLinkElement* owner); - - bool isValid() const { return !m_url.isEmpty() && m_url.isValid(); } - const KURL& url() const { return m_url; } - const AtomicString& charset() const { return m_charset; } - FetchRequest build(bool blocking) const; - -private: - RawPtr m_owner; - KURL m_url; - AtomicString m_charset; -}; - -} // namespace blink - -#endif // LinkResource_h diff --git a/engine/core/html/imports/HTMLImportsController.h b/engine/core/html/imports/HTMLImportsController.h index 032e0112f5a..640e1f950b2 100644 --- a/engine/core/html/imports/HTMLImportsController.h +++ b/engine/core/html/imports/HTMLImportsController.h @@ -33,7 +33,6 @@ #include "core/dom/DocumentSupplementable.h" #include "core/fetch/RawResource.h" -#include "core/html/LinkResource.h" #include "core/html/imports/HTMLImport.h" #include "platform/Supplementable.h" #include "platform/Timer.h" diff --git a/engine/core/html/imports/LinkImport.cpp b/engine/core/html/imports/LinkImport.cpp deleted file mode 100644 index 5ab258dfb29..00000000000 --- a/engine/core/html/imports/LinkImport.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/html/imports/LinkImport.h" - -#include "core/dom/Document.h" -#include "core/html/HTMLLinkElement.h" -#include "core/html/imports/HTMLImportChild.h" -#include "core/html/imports/HTMLImportLoader.h" -#include "core/html/imports/HTMLImportTreeRoot.h" -#include "core/html/imports/HTMLImportsController.h" - -namespace blink { - -PassOwnPtr LinkImport::create(HTMLLinkElement* owner) -{ - return adoptPtr(new LinkImport(owner)); -} - -LinkImport::LinkImport(HTMLLinkElement* owner) - : LinkResource(owner) - , m_child(nullptr) -{ -} - -LinkImport::~LinkImport() -{ -#if !ENABLE(OILPAN) - if (m_child) { - m_child->clearClient(); - m_child = nullptr; - } -#endif -} - -Document* LinkImport::importedDocument() const -{ - if (!m_child || !m_owner || !m_owner->inDocument()) - return 0; - if (m_child->loader()->hasError()) - return 0; - return m_child->document(); -} - -void LinkImport::process() -{ - if (m_child) - return; - if (!m_owner) - return; - if (!shouldLoadResource()) - return; - - if (!m_owner->document().importsController()) { - ASSERT(m_owner->document().frame()); // The document should be the master. - HTMLImportsController::provideTo(m_owner->document()); - } - - LinkRequestBuilder builder(m_owner); - if (!builder.isValid()) { - didFinish(); - return; - } - - m_child = m_owner->document().importsController()->load(m_owner->document().import(), this, builder.build(true)); - if (!m_child) { - didFinish(); - return; - } -} - -void LinkImport::didFinish() -{ - if (!m_owner || !m_owner->inDocument()) - return; - m_owner->scheduleEvent(); -} - -#if !ENABLE(OILPAN) -void LinkImport::importChildWasDestroyed(HTMLImportChild* child) -{ - ASSERT(m_child == child); - m_child = nullptr; - m_owner = nullptr; -} -#endif - -bool LinkImport::isSync() const -{ - return m_owner && !m_owner->async(); -} - -Element* LinkImport::link() -{ - return m_owner; -} - -bool LinkImport::hasLoaded() const -{ - // Should never be called after importChildWasDestroyed was called. - ASSERT(m_owner); - return m_child && m_child->isDone() && !m_child->loader()->hasError(); -} - -void LinkImport::ownerInserted() -{ - if (m_child) - m_child->ownerInserted(); -} - -void LinkImport::trace(Visitor* visitor) -{ - visitor->trace(m_child); - HTMLImportChildClient::trace(visitor); - LinkResource::trace(visitor); -} - -} // namespace blink diff --git a/engine/core/html/imports/LinkImport.h b/engine/core/html/imports/LinkImport.h deleted file mode 100644 index 0d7187e17ec..00000000000 --- a/engine/core/html/imports/LinkImport.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef LinkImport_h -#define LinkImport_h - -#include "core/html/LinkResource.h" -#include "core/html/imports/HTMLImportChildClient.h" -#include "wtf/FastAllocBase.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/RefPtr.h" - -namespace blink { - -class Document; -class HTMLImportChild; - -// -// A LinkResource subclasss used for @rel=import. -// -class LinkImport final : public LinkResource, public HTMLImportChildClient { - WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; - WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LinkImport); -public: - - static PassOwnPtr create(HTMLLinkElement* owner); - - explicit LinkImport(HTMLLinkElement* owner); - virtual ~LinkImport(); - - // LinkResource - virtual void process() override; - virtual Type type() const override { return Import; } - virtual bool hasLoaded() const override; - virtual void trace(Visitor*) override; - virtual void ownerInserted() override; - - // HTMLImportChildClient - virtual void didFinish() override; -#if !ENABLE(OILPAN) - virtual void importChildWasDestroyed(HTMLImportChild*) override; -#endif - virtual bool isSync() const override; - virtual Element* link() override; - - Document* importedDocument() const; - -private: - RawPtr m_child; -}; - -} // namespace blink - -#endif // LinkImport_h diff --git a/engine/web/WebLocalFrameImpl.cpp b/engine/web/WebLocalFrameImpl.cpp index 6ec435a86ba..db4917af2f8 100644 --- a/engine/web/WebLocalFrameImpl.cpp +++ b/engine/web/WebLocalFrameImpl.cpp @@ -99,7 +99,6 @@ #include "core/frame/LocalDOMWindow.h" #include "core/frame/Settings.h" #include "core/html/HTMLAnchorElement.h" -#include "core/html/HTMLLinkElement.h" #include "core/inspector/ConsoleMessage.h" #include "core/inspector/ScriptCallStack.h" #include "core/loader/MojoLoader.h" diff --git a/engine/web/WebViewImpl.cpp b/engine/web/WebViewImpl.cpp index b28e54ed713..e683f066f82 100644 --- a/engine/web/WebViewImpl.cpp +++ b/engine/web/WebViewImpl.cpp @@ -50,7 +50,7 @@ #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" -#include "core/html/HTMLLinkElement.h" +#include "core/html/HTMLImportElement.h" #include "core/html/HTMLMediaElement.h" #include "core/html/ime/InputMethodContext.h" #include "core/loader/FrameLoader.h" @@ -1660,12 +1660,11 @@ WebFrame* WebViewImpl::focusedFrame() void WebViewImpl::injectModule(const WebString& path) { RefPtr document = m_page->mainFrame()->document(); - RefPtr link = HTMLLinkElement::create(*document, false); - link->setAttribute(HTMLNames::relAttr, "import"); - link->setAttribute(HTMLNames::hrefAttr, path); + RefPtr import = HTMLImportElement::create(*document); + import->setAttribute(HTMLNames::srcAttr, path); if (!document->documentElement()) return; - document->documentElement()->appendChild(link.release()); + document->documentElement()->appendChild(import.release()); } void WebViewImpl::setFocusedFrame(WebFrame* frame)