Chromium Code Reviews| Index: Source/web/WebFrameWidgetImpl.h |
| diff --git a/Source/web/WebFrameWidgetImpl.h b/Source/web/WebFrameWidgetImpl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..831c39dd7e97c2ff9dc2230e00466b950d71804c |
| --- /dev/null |
| +++ b/Source/web/WebFrameWidgetImpl.h |
| @@ -0,0 +1,227 @@ |
| +/* |
|
Nate Chapin
2014/12/10 19:19:03
It looks like there's a bunch of stuff in these ne
kenrb
2014/12/10 19:59:27
The end goal is to make WebViewImpl no longer inhe
|
| + * Copyright (C) 2014 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 WebFrameWidgetImpl_h |
| +#define WebFrameWidgetImpl_h |
| + |
| +#include "platform/graphics/GraphicsLayer.h" |
| +#include "platform/scroll/ScrollTypes.h" |
| +#include "public/platform/WebPoint.h" |
| +#include "public/platform/WebSize.h" |
| +#include "public/web/WebFrameWidget.h" |
| +#include "public/web/WebInputEvent.h" |
| +#include "web/PageWidgetDelegate.h" |
| +#include "wtf/OwnPtr.h" |
| +#include "wtf/RefCounted.h" |
| + |
| +namespace blink { |
| +class Frame; |
| +class Element; |
| +class LocalFrame; |
| +class Page; |
| +class RenderLayerCompositor; |
| +class UserGestureToken; |
| +class WebLayer; |
| +class WebLayerTreeView; |
| +class WebLocalFrameImpl; |
| +class WebMouseEvent; |
| +class WebMouseWheelEvent; |
| + |
| +class WebFrameWidgetImpl : public WebFrameWidget |
| + , public PageWidgetEventHandler |
| + , public RefCounted<WebFrameWidgetImpl> { |
| +public: |
| + static WebFrameWidgetImpl* create(WebWidgetClient*, WebView*); |
| + |
| + // WebWidget functions: |
| + virtual void close() override; |
|
dcheng
2014/12/10 21:00:59
No virtual if using 'override'.
kenrb
2014/12/11 20:21:21
Where is that rule from? It isn't consistent with
dcheng
2014/12/11 23:31:45
https://groups.google.com/a/chromium.org/forum/#!t
kenrb
2014/12/16 18:51:00
Done.
|
| + virtual WebSize size() override; |
| + virtual void willStartLiveResize() override; |
| + virtual void resize(const WebSize&) override; |
| + virtual void resizePinchViewport(const WebSize&) override; |
| + virtual void willEndLiveResize() override; |
| + virtual void willEnterFullScreen() override; |
| + virtual void didEnterFullScreen() override; |
| + virtual void willExitFullScreen() override; |
| + virtual void didExitFullScreen() override; |
| + virtual void beginFrame(const WebBeginFrameArgs&) override; |
| + virtual void layout() override; |
| + virtual void paint(WebCanvas*, const WebRect&) override; |
| + virtual void compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback*) override; |
| + virtual bool isTrackingRepaints() const override; |
| + virtual void themeChanged() override; |
| + virtual bool handleInputEvent(const WebInputEvent&) override; |
| + virtual void setCursorVisibilityState(bool isVisible) override; |
| + virtual bool hasTouchEventHandlersAt(const WebPoint&) override; |
| + |
| + // FIXME(bokan): Old pinch path only - This should be removed once old pinch |
| + // is removed. |
| + virtual void applyViewportDeltas( |
| + const WebSize& scrollDelta, |
| + float pageScaleDelta, |
| + float topControlsDelta) override; |
| + virtual void applyViewportDeltas( |
| + const WebSize& pinchViewportDelta, |
| + const WebSize& mainFrameDelta, |
| + float pageScaleDelta, |
| + float topControlsDelta) override; |
| + virtual void mouseCaptureLost() override; |
| + virtual void setFocus(bool enable) override; |
| + virtual bool setComposition( |
| + const WebString& text, |
| + const WebVector<WebCompositionUnderline>& underlines, |
| + int selectionStart, int selectionEnd) override; |
| + virtual bool confirmComposition() override; |
| + virtual bool confirmComposition(ConfirmCompositionBehavior selectionBehavior) override; |
| + virtual bool confirmComposition(const WebString& text) override; |
| + virtual bool compositionRange(size_t* location, size_t* length) override; |
| + virtual WebTextInputInfo textInputInfo() override; |
| + virtual WebColor backgroundColor() const override; |
| + virtual bool selectionBounds(WebRect& anchor, WebRect& focus) const override; |
| + virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const override; |
| + virtual bool isSelectionAnchorFirst() const override; |
| + virtual bool caretOrSelectionRange(size_t* location, size_t* length) override; |
| + virtual void setTextDirection(WebTextDirection) override; |
| + virtual bool isAcceleratedCompositingActive() const override; |
| + virtual void willCloseLayerTreeView() override; |
| + virtual void didChangeWindowResizerRect() override; |
| + |
| + WebWidgetClient* client() { return m_client; } |
|
dcheng
2014/12/10 21:00:59
const
kenrb
2014/12/16 18:51:00
Done.
|
| + |
| + // WebFrameWidget functions: |
| + virtual void setLocalRoot(WebLocalFrame*) override; |
| + |
| + // WebFrameWidgetImpl functions: |
|
dcheng
2014/12/10 21:00:59
This comment isn't necessary--we don't generally a
kenrb
2014/12/11 20:21:21
Done.
|
| + |
| + Frame* focusedCoreFrame() const; |
| + |
| + // Returns the currently focused Element or null if no element has focus. |
| + Element* focusedElement() const; |
| + |
| + void hasTouchEventHandlers(bool); |
| + |
| + void scheduleAnimation(); |
| + |
| + RenderLayerCompositor* compositor() const; |
| + void suppressInvalidations(bool enable); |
| + void setRootGraphicsLayer(GraphicsLayer*); |
| + |
| + // Exposed for the purpose of overriding device metrics. |
| + void sendResizeEventAndRepaint(); |
| + |
| + void updateMainFrameLayoutSize(); |
| + |
| + // Returns the page object associated with this widget. This may be null when |
| + // the page is shutting down, but will be valid at all other times. |
| + Page* page() const |
| + { |
| + return m_page; |
| + } |
| + |
| + // Returns true if the event leads to scrolling. |
| + static bool mapKeyCodeForScroll( |
| + int keyCode, |
| + ScrollDirection*, |
| + ScrollGranularity*); |
| + |
| +private: |
| + friend class WebFrameWidget; // For WebFrameWidget::create. |
| + friend class WTF::RefCounted<WebFrameWidgetImpl>; |
| + |
| + explicit WebFrameWidgetImpl(WebWidgetClient*, WebView*); |
| + ~WebFrameWidgetImpl(); |
| + |
| + // Returns true if the event was actually processed. |
| + bool keyEventDefault(const WebKeyboardEvent&); |
| + |
| + // Returns true if the view was scrolled. |
| + bool scrollViewWithKeyboard(int keyCode, int modifiers); |
| + |
| + void initializeLayerTreeView(); |
| + |
| + void setIsAcceleratedCompositingActive(bool); |
| + void updateLayerTreeViewport(); |
| + void updateLayerTreeBackgroundColor(); |
| + void updateLayerTreeDeviceScaleFactor(); |
| + |
| + bool isTransparent() const; |
| + |
| + // PageWidgetEventHandler functions |
| + virtual void handleMouseLeave(LocalFrame&, const WebMouseEvent&) override; |
| + virtual void handleMouseDown(LocalFrame&, const WebMouseEvent&) override; |
| + virtual void handleMouseUp(LocalFrame&, const WebMouseEvent&) override; |
| + virtual bool handleMouseWheel(LocalFrame&, const WebMouseWheelEvent&) override; |
| + virtual bool handleGestureEvent(const WebGestureEvent&) override; |
| + virtual bool handleKeyEvent(const WebKeyboardEvent&) override; |
| + virtual bool handleCharEvent(const WebKeyboardEvent&) override; |
| + |
| + WebWidgetClient* m_client; |
| + |
| + // WebFrameWidget is associated with a subtree of the frame tree, corresponding to a maximal |
| + // connected tree of LocalFrames. This member points to the root of that subtree. |
| + WebLocalFrameImpl* m_localRoot; |
| + |
| + WebSize m_size; |
| + |
| + // If set, the (plugin) node which has mouse capture. |
| + RefPtrWillBePersistent<Node> m_mouseCaptureNode; |
| + RefPtr<UserGestureToken> m_mouseCaptureGestureToken; |
| + |
| + WebLayerTreeView* m_layerTreeView; |
| + WebLayer* m_rootLayer; |
| + GraphicsLayer* m_rootGraphicsLayer; |
| + bool m_isAcceleratedCompositingActive; |
| + bool m_layerTreeViewClosed; |
| + |
| + Page* m_page; |
| + |
| + bool m_suppressNextKeypressEvent; |
| + |
| + bool m_ignoreInputEvents; |
| + |
| + // The point relative to the client area where the mouse was last pressed |
| + // down. This is used by the drag client to determine what was under the |
| + // mouse when the drag was initiated. We need to track this here in |
| + // WebViewImpl since DragClient::startDrag does not pass the position the |
| + // mouse was at when the drag was initiated, only the current point, which |
| + // can be misleading as it is usually not over the element the user actually |
| + // dragged by the time a drag is initiated. |
| + WebPoint m_lastMouseDownPoint; |
|
dcheng
2014/12/10 21:00:59
I don't think this belongs on WebFrameWidget.
kenrb
2014/12/11 20:21:21
Ok I have removed it, and the reference to it in h
|
| + |
| + static const WebInputEvent* m_currentInputEvent; |
| + |
| + WebColor m_baseBackgroundColor; |
| + WebColor m_backgroundColorOverride; |
|
dcheng
2014/12/10 21:00:59
We should only have one base background color per
kenrb
2014/12/11 20:21:22
This is true, although in order to make this chang
|
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif |
| + |