mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The primary goal of this change was to remove EventTarget from the
sky_engine C++ code. Since EventTarget is so core to the entire event
system that sky_engine was based on, this is a rather invasive change.
As such, it had some knock-on effects. I deleted some of the files
that were affected, and cauterised the remainder.
In many cases, a file would depend on another file that it didn't
include directly, but instead included indirectly via another file
that I deleted. When this happened, if the features that this broke
were obsolete, I sometimes just removed the features instead.
Specifically:
- removed EventTarget
- removed EventQueue, since without a target, what's a queue going to
do?
- same with EventDispatch*
- removed ExecutionContext, since it had an EventQueue and nothing
else it did was relevant to Sky anymore
- removed ActiveDOMObject, which was all about ExecutionContexts
- removed ContextLifecycleNotifier since it dependend on
ExecutionContext and ActiveDOMObject
- removed the other Lifecycle classes for consistency, and replaced
them with four booleans in the Document class
- removed some of the attributes that are no longer relevant from
IDLExtendedAttributes (ConstructorCallWith and
CallWith=ExecutionContext)
- removed the Document member on DOMDartState since we never set it to
anything but null.
- removed BuiltinSky::InstallWindow since it relied on the Document
member of DOMDartState
- removed EventHandler, EventListener, and mentions of those in
various binding scripts
- removed NewEventHandler, since we're not using that either
- removed the following interfaces from the Sky Dart API:
- EventTarget
- EventListener (since without a target, there's no way to listen)
- FocusEvent (since it's only member was an EventTarget)
- HashChangeEvent (mostly by accident, but it's defunct anyway)
- FontFace (it used ConstructorCallWith=ExecutionContext)
- changed the following interfaces of the Sky DART API:
- MediaQueryList is no longer an EventTarget
- Node is no longer an EventTarget
- Document no longer has defaultView (depended on
DOMDartState's document)
- DocumentFragment, Element, Range, and Text no longer have a
constructor (they all depended on DOMDartState's document, which
is now gone)
- Event lost its EventTarget members and path.
- Window lost its WindowTimers partial interface (it used
EventTarget and ExecutionContext a lot)
- removed numerous hacks in the bindings around features that are now
gone, like addEventListener
- removed a bunch of console logging code, since that relied on
ExecutionContext
- cauterised the wound in FontFace.cpp by removing constructors and
methods that called now-removed features
- same with MediaQuery and friends
- same with some editor features and focus-related features
- same with Document
- removed DOMTimer classes since they use ExecutionContexts
158 lines
5.1 KiB
C++
158 lines
5.1 KiB
C++
/*
|
|
* Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
|
|
* 1999-2001 Lars Knoll <knoll@kde.org>
|
|
* 1999-2001 Antti Koivisto <koivisto@kde.org>
|
|
* 2000-2001 Simon Hausmann <hausmann@kde.org>
|
|
* 2000-2001 Dirk Mueller <mueller@kde.org>
|
|
* 2000 Stefan Schimanski <1Stein@gmx.de>
|
|
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
|
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
|
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
|
|
*
|
|
* 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 SKY_ENGINE_CORE_FRAME_LOCALFRAME_H_
|
|
#define SKY_ENGINE_CORE_FRAME_LOCALFRAME_H_
|
|
|
|
#include "sky/engine/core/frame/Frame.h"
|
|
#include "sky/engine/core/loader/FrameLoader.h"
|
|
#include "sky/engine/platform/Supplementable.h"
|
|
#include "sky/engine/platform/heap/Handle.h"
|
|
#include "sky/engine/wtf/HashSet.h"
|
|
|
|
namespace blink {
|
|
|
|
class Color;
|
|
class DartController;
|
|
class Document;
|
|
class Editor;
|
|
class Element;
|
|
class FloatRect;
|
|
class FloatSize;
|
|
class FrameDestructionObserver;
|
|
class FrameSelection;
|
|
class FrameView;
|
|
class InputMethodController;
|
|
class IntPoint;
|
|
class IntSize;
|
|
class Node;
|
|
class Range;
|
|
class RenderView;
|
|
class SpellChecker;
|
|
class TreeScope;
|
|
class TreeScope;
|
|
class VisiblePosition;
|
|
|
|
class LocalFrame : public Frame, public Supplementable<LocalFrame> {
|
|
public:
|
|
static PassRefPtr<LocalFrame> create(FrameLoaderClient*, FrameHost*);
|
|
|
|
void setView(PassRefPtr<FrameView>);
|
|
void createView(const IntSize&, const Color&, bool transparent);
|
|
|
|
virtual ~LocalFrame();
|
|
|
|
virtual void detach() override;
|
|
|
|
void addDestructionObserver(FrameDestructionObserver*);
|
|
void removeDestructionObserver(FrameDestructionObserver*);
|
|
|
|
void willDetachFrameHost();
|
|
void detachFromFrameHost();
|
|
|
|
virtual void setDOMWindow(PassRefPtr<LocalDOMWindow>) override;
|
|
void setDocument(Document*);
|
|
FrameView* view() const;
|
|
Document* document() const;
|
|
|
|
RenderView* contentRenderer() const; // Root of the render tree for the document contained in this frame.
|
|
|
|
Editor& editor() const;
|
|
FrameSelection& selection() const;
|
|
InputMethodController& inputMethodController() const;
|
|
SpellChecker& spellChecker() const;
|
|
|
|
FrameLoaderClient* loaderClient() const;
|
|
|
|
// ======== All public functions below this point are candidates to move out of LocalFrame into another class. ========
|
|
|
|
FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize);
|
|
|
|
void deviceOrPageScaleFactorChanged();
|
|
double devicePixelRatio() const;
|
|
|
|
String selectedText() const;
|
|
|
|
VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
|
|
PassRefPtr<Range> rangeForPoint(const IntPoint& framePoint);
|
|
|
|
void removeSpellingMarkersUnderWords(const Vector<String>& words);
|
|
|
|
// ========
|
|
|
|
private:
|
|
LocalFrame(FrameLoaderClient*, FrameHost*);
|
|
|
|
HashSet<FrameDestructionObserver*> m_destructionObservers;
|
|
mutable FrameLoader m_deprecatedLoader;
|
|
|
|
RefPtr<FrameView> m_view;
|
|
|
|
const OwnPtr<Editor> m_editor;
|
|
const OwnPtr<SpellChecker> m_spellChecker;
|
|
const OwnPtr<FrameSelection> m_selection;
|
|
OwnPtr<InputMethodController> m_inputMethodController;
|
|
|
|
Document* m_document;
|
|
};
|
|
|
|
inline FrameView* LocalFrame::view() const
|
|
{
|
|
return m_view.get();
|
|
}
|
|
|
|
inline FrameSelection& LocalFrame::selection() const
|
|
{
|
|
return *m_selection;
|
|
}
|
|
|
|
inline Editor& LocalFrame::editor() const
|
|
{
|
|
return *m_editor;
|
|
}
|
|
|
|
inline SpellChecker& LocalFrame::spellChecker() const
|
|
{
|
|
return *m_spellChecker;
|
|
}
|
|
|
|
inline InputMethodController& LocalFrame::inputMethodController() const
|
|
{
|
|
return *m_inputMethodController;
|
|
}
|
|
|
|
DEFINE_TYPE_CASTS(LocalFrame, Frame, localFrame, true, true);
|
|
|
|
} // namespace blink
|
|
|
|
// During refactoring, there are some places where we need to do type conversions that
|
|
// will not be needed once all instances of LocalFrame and RemoteFrame are sorted out.
|
|
// At that time this #define will be removed and all the uses of it will need to be corrected.
|
|
#define toLocalFrameTemporary toLocalFrame
|
|
|
|
#endif // SKY_ENGINE_CORE_FRAME_LOCALFRAME_H_
|