From 586a535b7f9bd450b04ca4fe38f89c15bf86d0e2 Mon Sep 17 00:00:00 2001 From: Elliott Sprehn Date: Fri, 12 Dec 2014 15:47:57 -0800 Subject: [PATCH] Delete StyleSheetList and support code. We don't need this since we don't expose the list of sheets from Document or ShadowRoot in Sky. After removing this code I also simplified the system and deleted StyleSheetCandidate and DocumentStyleSheetCollector which don't really do anything anymore. Even if we do want to add back a list of sheets later it won't need code because we don't have a concept of a remote sheet like did, and we don't have to deal with non-CSS sheets. R=ojan@chromium.org Review URL: https://codereview.chromium.org/803673003 --- engine/core/core.gni | 6 -- engine/core/css/StyleSheetList.cpp | 91 ------------------- engine/core/css/StyleSheetList.h | 66 -------------- engine/core/dom/Document.cpp | 1 - engine/core/dom/Document.h | 1 - .../core/dom/DocumentStyleSheetCollection.cpp | 27 ++---- .../core/dom/DocumentStyleSheetCollection.h | 5 +- .../core/dom/DocumentStyleSheetCollector.cpp | 71 --------------- engine/core/dom/DocumentStyleSheetCollector.h | 79 ---------------- .../dom/ShadowTreeStyleSheetCollection.cpp | 6 +- engine/core/dom/StyleEngine.cpp | 16 ++-- engine/core/dom/StyleEngine.h | 3 +- engine/core/dom/StyleSheetCandidate.cpp | 69 -------------- engine/core/dom/StyleSheetCandidate.h | 68 -------------- engine/core/dom/StyleSheetCollection.cpp | 13 --- engine/core/dom/StyleSheetCollection.h | 8 -- engine/core/dom/TreeScope.cpp | 5 +- engine/core/dom/shadow/ElementShadow.cpp | 1 - engine/core/dom/shadow/ShadowRoot.cpp | 1 - 19 files changed, 23 insertions(+), 514 deletions(-) delete mode 100644 engine/core/css/StyleSheetList.cpp delete mode 100644 engine/core/css/StyleSheetList.h delete mode 100644 engine/core/dom/DocumentStyleSheetCollector.cpp delete mode 100644 engine/core/dom/DocumentStyleSheetCollector.h delete mode 100644 engine/core/dom/StyleSheetCandidate.cpp delete mode 100644 engine/core/dom/StyleSheetCandidate.h diff --git a/engine/core/core.gni b/engine/core/core.gni index 7521e4c682a..f43c4703e8d 100644 --- a/engine/core/core.gni +++ b/engine/core/core.gni @@ -342,8 +342,6 @@ sky_core_files = [ "css/StyleKeyframe.cpp", "css/StyleRuleKeyframes.h", "css/StyleRuleKeyframes.cpp", - "css/StyleSheetList.cpp", - "css/StyleSheetList.h", "css/StyleSheetContents.cpp", "css/StyleSheetContents.h", "dom/ActiveDOMObject.cpp", @@ -432,8 +430,6 @@ sky_core_files = [ "dom/DocumentParser.h", "dom/DocumentStyleSheetCollection.cpp", "dom/DocumentStyleSheetCollection.h", - "dom/DocumentStyleSheetCollector.cpp", - "dom/DocumentStyleSheetCollector.h", "dom/DocumentSupplementable.h", "dom/DOMError.cpp", "dom/DOMError.h", @@ -524,8 +520,6 @@ sky_core_files = [ "dom/StaticNodeList.h", "dom/StyleEngine.cpp", "dom/StyleEngine.h", - "dom/StyleSheetCandidate.cpp", - "dom/StyleSheetCandidate.h", "dom/StyleSheetCollection.cpp", "dom/StyleSheetCollection.h", "dom/TemplateContentDocumentFragment.h", diff --git a/engine/core/css/StyleSheetList.cpp b/engine/core/css/StyleSheetList.cpp deleted file mode 100644 index bc6a821b163..00000000000 --- a/engine/core/css/StyleSheetList.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/** - * (C) 1999-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2006, 2007 Apple 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 "sky/engine/config.h" -#include "sky/engine/core/css/StyleSheetList.h" - -#include "sky/engine/core/dom/Document.h" -#include "sky/engine/core/dom/StyleEngine.h" -#include "sky/engine/core/html/HTMLStyleElement.h" -#include "sky/engine/wtf/text/WTFString.h" - -namespace blink { - -StyleSheetList::StyleSheetList(TreeScope* treeScope) - : m_treeScope(treeScope) -{ -} - -StyleSheetList::~StyleSheetList() -{ -} - -inline const Vector >& StyleSheetList::styleSheets() -{ -#if !ENABLE(OILPAN) - if (!m_treeScope) - return m_detachedStyleSheets; -#endif - return document()->styleEngine()->styleSheetsForStyleSheetList(*m_treeScope); -} - -void StyleSheetList::detachFromDocument() -{ - m_detachedStyleSheets = document()->styleEngine()->styleSheetsForStyleSheetList(*m_treeScope); - m_treeScope = nullptr; -} - -unsigned StyleSheetList::length() -{ - return styleSheets().size(); -} - -CSSStyleSheet* StyleSheetList::item(unsigned index) -{ - const Vector >& sheets = styleSheets(); - return index < sheets.size() ? sheets[index].get() : 0; -} - -HTMLStyleElement* StyleSheetList::getNamedItem(const AtomicString& name) const -{ -#if !ENABLE(OILPAN) - if (!m_treeScope) - return 0; -#endif - - // IE also supports retrieving a stylesheet by name, using the name/id of the