From ff2cde060f11296953e512ce0ea52277b4fb40ff Mon Sep 17 00:00:00 2001 From: Elliott Sprehn Date: Mon, 26 Jan 2015 15:12:04 -0800 Subject: [PATCH] Remove more properties from the global Window. StyleMedia seems to have been removed from the web too, and self is a legacy-ism we don't want. I also removed the global find() which is a document feature. R=abarth@chromium.org Review URL: https://codereview.chromium.org/872143004 --- engine/core/core.gni | 3 -- engine/core/css/StyleMedia.cpp | 70 ---------------------------- engine/core/css/StyleMedia.h | 54 --------------------- engine/core/css/StyleMedia.idl | 32 ------------- engine/core/frame/LocalDOMWindow.cpp | 19 -------- engine/core/frame/LocalDOMWindow.h | 4 -- engine/core/frame/Window.idl | 12 ----- 7 files changed, 194 deletions(-) delete mode 100644 engine/core/css/StyleMedia.cpp delete mode 100644 engine/core/css/StyleMedia.h delete mode 100644 engine/core/css/StyleMedia.idl diff --git a/engine/core/core.gni b/engine/core/core.gni index 11e2c3c4e35..425084a431a 100644 --- a/engine/core/core.gni +++ b/engine/core/core.gni @@ -326,8 +326,6 @@ sky_core_files = [ "css/SelectorChecker.cpp", "css/SelectorChecker.h", "css/StyleColor.h", - "css/StyleMedia.cpp", - "css/StyleMedia.h", "css/StylePropertySerializer.cpp", "css/StylePropertySerializer.h", "css/StylePropertySet.cpp", @@ -1214,7 +1212,6 @@ core_idl_files = get_path_info([ "css/MediaQueryListEvent.idl", "css/Rect.idl", "css/RGBColor.idl", - "css/StyleMedia.idl", "dom/Attr.idl", "dom/CharacterData.idl", "dom/ClientRect.idl", diff --git a/engine/core/css/StyleMedia.cpp b/engine/core/css/StyleMedia.cpp deleted file mode 100644 index 2f5878397f6..00000000000 --- a/engine/core/css/StyleMedia.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2009 Apple 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "sky/engine/config.h" -#include "sky/engine/core/css/StyleMedia.h" - -#include "sky/engine/core/css/MediaList.h" -#include "sky/engine/core/css/MediaQueryEvaluator.h" -#include "sky/engine/core/dom/Document.h" -#include "sky/engine/core/frame/FrameView.h" -#include "sky/engine/core/frame/LocalFrame.h" - -namespace blink { - -StyleMedia::StyleMedia(LocalFrame* frame) - : DOMWindowProperty(frame) -{ -} - -AtomicString StyleMedia::type() const -{ - FrameView* view = m_frame ? m_frame->view() : 0; - if (view) - return view->mediaType(); - - return nullAtom; -} - -bool StyleMedia::matchMedium(const String& query) const -{ - if (!m_frame) - return false; - - Document* document = m_frame->document(); - ASSERT(document); - Element* documentElement = document->documentElement(); - if (!documentElement) - return false; - - RefPtr media = MediaQuerySet::create(); - if (!media->set(query)) - return false; - - MediaQueryEvaluator screenEval(m_frame); - return screenEval.eval(media.get()); -} - -} // namespace blink diff --git a/engine/core/css/StyleMedia.h b/engine/core/css/StyleMedia.h deleted file mode 100644 index 6e9bef6a75e..00000000000 --- a/engine/core/css/StyleMedia.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 SKY_ENGINE_CORE_CSS_STYLEMEDIA_H_ -#define SKY_ENGINE_CORE_CSS_STYLEMEDIA_H_ - -#include "sky/engine/bindings/core/v8/ScriptWrappable.h" -#include "sky/engine/core/frame/DOMWindowProperty.h" -#include "sky/engine/platform/heap/Handle.h" -#include "sky/engine/wtf/RefCounted.h" -#include "sky/engine/wtf/text/WTFString.h" - -namespace blink { - -class LocalFrame; - -class StyleMedia : public RefCounted, public DOMWindowProperty, public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); -public: - static PassRefPtr create(LocalFrame* frame) { return adoptRef(new StyleMedia(frame));} - - AtomicString type() const; - bool matchMedium(const String&) const; - -private: - explicit StyleMedia(LocalFrame*); -}; - -} // namespace blink - -#endif // SKY_ENGINE_CORE_CSS_STYLEMEDIA_H_ diff --git a/engine/core/css/StyleMedia.idl b/engine/core/css/StyleMedia.idl deleted file mode 100644 index 101bce1518f..00000000000 --- a/engine/core/css/StyleMedia.idl +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. - */ - -[ - NoInterfaceObject, -] interface StyleMedia { - readonly attribute DOMString type; - boolean matchMedium([Default=Undefined] optional DOMString mediaquery); -}; diff --git a/engine/core/frame/LocalDOMWindow.cpp b/engine/core/frame/LocalDOMWindow.cpp index a8b4461b7d3..a19e57c13b0 100644 --- a/engine/core/frame/LocalDOMWindow.cpp +++ b/engine/core/frame/LocalDOMWindow.cpp @@ -41,7 +41,6 @@ #include "sky/engine/core/css/DOMWindowCSS.h" #include "sky/engine/core/css/MediaQueryList.h" #include "sky/engine/core/css/MediaQueryMatcher.h" -#include "sky/engine/core/css/StyleMedia.h" #include "sky/engine/core/css/resolver/StyleResolver.h" #include "sky/engine/core/dom/Document.h" #include "sky/engine/core/dom/Element.h" @@ -382,7 +381,6 @@ void LocalDOMWindow::resetDOMWindowProperties() m_screen = nullptr; m_console = nullptr; m_location = nullptr; - m_media = nullptr; #if ENABLE(ASSERT) m_hasBeenReset = true; #endif @@ -449,16 +447,6 @@ void LocalDOMWindow::focus(ExecutionContext* context) m_frame->eventHandler().focusDocumentView(); } -bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const -{ - // |m_frame| can be destructed during |Editor::findString()| via - // |Document::updateLayou()|, e.g. event handler removes a frame. - RefPtr protectFrame(m_frame); - - // FIXME (13016): Support wholeWord, searchInFrames and showDialog - return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false); -} - int LocalDOMWindow::outerHeight() const { if (!m_frame) @@ -544,13 +532,6 @@ Document* LocalDOMWindow::document() const return m_document.get(); } -StyleMedia& LocalDOMWindow::styleMedia() const -{ - if (!m_media) - m_media = StyleMedia::create(m_frame); - return *m_media; -} - PassRefPtr LocalDOMWindow::getComputedStyle(Element* elt) const { if (!elt) diff --git a/engine/core/frame/LocalDOMWindow.h b/engine/core/frame/LocalDOMWindow.h index 49ccb59dde6..47b71c5f4cf 100644 --- a/engine/core/frame/LocalDOMWindow.h +++ b/engine/core/frame/LocalDOMWindow.h @@ -119,8 +119,6 @@ public: void focus(ExecutionContext* = 0); - bool find(const String&, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const; - int outerHeight() const; int outerWidth() const; int innerHeight() const; @@ -132,7 +130,6 @@ public: // FIXME(sky): keeping self for now since js-test.html uses it. LocalDOMWindow* window() const; - LocalDOMWindow* self() const { return window(); } // DOM Level 2 AbstractView Interface @@ -241,7 +238,6 @@ private: mutable RefPtr m_screen; mutable RefPtr m_console; mutable RefPtr m_location; - mutable RefPtr m_media; mutable RefPtr m_css; diff --git a/engine/core/frame/Window.idl b/engine/core/frame/Window.idl index d083f5e7091..8c5f135ef75 100644 --- a/engine/core/frame/Window.idl +++ b/engine/core/frame/Window.idl @@ -40,14 +40,6 @@ [DoNotCheckSecurity, CallWith=ExecutionContext] void focus(); - boolean find([Default=Undefined] optional DOMString string, - [Default=Undefined] optional boolean caseSensitive, - [Default=Undefined] optional boolean backwards, - [Default=Undefined] optional boolean wrap, - [Default=Undefined] optional boolean wholeWord, - [Default=Undefined] optional boolean searchInFrames, - [Default=Undefined] optional boolean showDialog); - [Replaceable] readonly attribute long outerHeight; [Replaceable] readonly attribute long outerWidth; [Replaceable] readonly attribute long innerHeight; @@ -63,7 +55,6 @@ void resizeTo([Default=Undefined] optional float width, [Default=Undefined] optional float height); // FIXME: this should take longs not floats. // Self referential attributes - [Replaceable, DoNotCheckSecurity] readonly attribute Window self; [DoNotCheckSecurity, Unforgeable] readonly attribute Window window; // DOM Level 2 AbstractView Interface @@ -72,9 +63,6 @@ // CSSOM View Module MediaQueryList matchMedia(DOMString query); - // styleMedia has been removed from the CSSOM View specification. - readonly attribute StyleMedia styleMedia; - // DOM Level 2 Style Interface CSSStyleDeclaration getComputedStyle([Default=Undefined] optional Element element);