Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
|
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
| |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebFrameWidgetImpl_h | |
| 32 #define WebFrameWidgetImpl_h | |
| 33 | |
| 34 #include "platform/graphics/GraphicsLayer.h" | |
| 35 #include "platform/scroll/ScrollTypes.h" | |
| 36 #include "public/platform/WebPoint.h" | |
| 37 #include "public/platform/WebSize.h" | |
| 38 #include "public/web/WebFrameWidget.h" | |
| 39 #include "public/web/WebInputEvent.h" | |
| 40 #include "web/PageWidgetDelegate.h" | |
| 41 #include "wtf/OwnPtr.h" | |
| 42 #include "wtf/RefCounted.h" | |
| 43 | |
| 44 namespace blink { | |
| 45 class Frame; | |
| 46 class Element; | |
| 47 class LocalFrame; | |
| 48 class Page; | |
| 49 class RenderLayerCompositor; | |
| 50 class UserGestureToken; | |
| 51 class WebLayer; | |
| 52 class WebLayerTreeView; | |
| 53 class WebLocalFrameImpl; | |
| 54 class WebMouseEvent; | |
| 55 class WebMouseWheelEvent; | |
| 56 | |
| 57 class WebFrameWidgetImpl : public WebFrameWidget | |
| 58 , public PageWidgetEventHandler | |
| 59 , public RefCounted<WebFrameWidgetImpl> { | |
| 60 public: | |
| 61 static WebFrameWidgetImpl* create(WebWidgetClient*, WebView*); | |
| 62 | |
| 63 // WebWidget functions: | |
| 64 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.
| |
| 65 virtual WebSize size() override; | |
| 66 virtual void willStartLiveResize() override; | |
| 67 virtual void resize(const WebSize&) override; | |
| 68 virtual void resizePinchViewport(const WebSize&) override; | |
| 69 virtual void willEndLiveResize() override; | |
| 70 virtual void willEnterFullScreen() override; | |
| 71 virtual void didEnterFullScreen() override; | |
| 72 virtual void willExitFullScreen() override; | |
| 73 virtual void didExitFullScreen() override; | |
| 74 virtual void beginFrame(const WebBeginFrameArgs&) override; | |
| 75 virtual void layout() override; | |
| 76 virtual void paint(WebCanvas*, const WebRect&) override; | |
| 77 virtual void compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback* ) override; | |
| 78 virtual bool isTrackingRepaints() const override; | |
| 79 virtual void themeChanged() override; | |
| 80 virtual bool handleInputEvent(const WebInputEvent&) override; | |
| 81 virtual void setCursorVisibilityState(bool isVisible) override; | |
| 82 virtual bool hasTouchEventHandlersAt(const WebPoint&) override; | |
| 83 | |
| 84 // FIXME(bokan): Old pinch path only - This should be removed once old pinch | |
| 85 // is removed. | |
| 86 virtual void applyViewportDeltas( | |
| 87 const WebSize& scrollDelta, | |
| 88 float pageScaleDelta, | |
| 89 float topControlsDelta) override; | |
| 90 virtual void applyViewportDeltas( | |
| 91 const WebSize& pinchViewportDelta, | |
| 92 const WebSize& mainFrameDelta, | |
| 93 float pageScaleDelta, | |
| 94 float topControlsDelta) override; | |
| 95 virtual void mouseCaptureLost() override; | |
| 96 virtual void setFocus(bool enable) override; | |
| 97 virtual bool setComposition( | |
| 98 const WebString& text, | |
| 99 const WebVector<WebCompositionUnderline>& underlines, | |
| 100 int selectionStart, int selectionEnd) override; | |
| 101 virtual bool confirmComposition() override; | |
| 102 virtual bool confirmComposition(ConfirmCompositionBehavior selectionBehavior ) override; | |
| 103 virtual bool confirmComposition(const WebString& text) override; | |
| 104 virtual bool compositionRange(size_t* location, size_t* length) override; | |
| 105 virtual WebTextInputInfo textInputInfo() override; | |
| 106 virtual WebColor backgroundColor() const override; | |
| 107 virtual bool selectionBounds(WebRect& anchor, WebRect& focus) const override ; | |
| 108 virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirectio n& end) const override; | |
| 109 virtual bool isSelectionAnchorFirst() const override; | |
| 110 virtual bool caretOrSelectionRange(size_t* location, size_t* length) overrid e; | |
| 111 virtual void setTextDirection(WebTextDirection) override; | |
| 112 virtual bool isAcceleratedCompositingActive() const override; | |
| 113 virtual void willCloseLayerTreeView() override; | |
| 114 virtual void didChangeWindowResizerRect() override; | |
| 115 | |
| 116 WebWidgetClient* client() { return m_client; } | |
|
dcheng
2014/12/10 21:00:59
const
kenrb
2014/12/16 18:51:00
Done.
| |
| 117 | |
| 118 // WebFrameWidget functions: | |
| 119 virtual void setLocalRoot(WebLocalFrame*) override; | |
| 120 | |
| 121 // 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.
| |
| 122 | |
| 123 Frame* focusedCoreFrame() const; | |
| 124 | |
| 125 // Returns the currently focused Element or null if no element has focus. | |
| 126 Element* focusedElement() const; | |
| 127 | |
| 128 void hasTouchEventHandlers(bool); | |
| 129 | |
| 130 void scheduleAnimation(); | |
| 131 | |
| 132 RenderLayerCompositor* compositor() const; | |
| 133 void suppressInvalidations(bool enable); | |
| 134 void setRootGraphicsLayer(GraphicsLayer*); | |
| 135 | |
| 136 // Exposed for the purpose of overriding device metrics. | |
| 137 void sendResizeEventAndRepaint(); | |
| 138 | |
| 139 void updateMainFrameLayoutSize(); | |
| 140 | |
| 141 // Returns the page object associated with this widget. This may be null whe n | |
| 142 // the page is shutting down, but will be valid at all other times. | |
| 143 Page* page() const | |
| 144 { | |
| 145 return m_page; | |
| 146 } | |
| 147 | |
| 148 // Returns true if the event leads to scrolling. | |
| 149 static bool mapKeyCodeForScroll( | |
| 150 int keyCode, | |
| 151 ScrollDirection*, | |
| 152 ScrollGranularity*); | |
| 153 | |
| 154 private: | |
| 155 friend class WebFrameWidget; // For WebFrameWidget::create. | |
| 156 friend class WTF::RefCounted<WebFrameWidgetImpl>; | |
| 157 | |
| 158 explicit WebFrameWidgetImpl(WebWidgetClient*, WebView*); | |
| 159 ~WebFrameWidgetImpl(); | |
| 160 | |
| 161 // Returns true if the event was actually processed. | |
| 162 bool keyEventDefault(const WebKeyboardEvent&); | |
| 163 | |
| 164 // Returns true if the view was scrolled. | |
| 165 bool scrollViewWithKeyboard(int keyCode, int modifiers); | |
| 166 | |
| 167 void initializeLayerTreeView(); | |
| 168 | |
| 169 void setIsAcceleratedCompositingActive(bool); | |
| 170 void updateLayerTreeViewport(); | |
| 171 void updateLayerTreeBackgroundColor(); | |
| 172 void updateLayerTreeDeviceScaleFactor(); | |
| 173 | |
| 174 bool isTransparent() const; | |
| 175 | |
| 176 // PageWidgetEventHandler functions | |
| 177 virtual void handleMouseLeave(LocalFrame&, const WebMouseEvent&) override; | |
| 178 virtual void handleMouseDown(LocalFrame&, const WebMouseEvent&) override; | |
| 179 virtual void handleMouseUp(LocalFrame&, const WebMouseEvent&) override; | |
| 180 virtual bool handleMouseWheel(LocalFrame&, const WebMouseWheelEvent&) overri de; | |
| 181 virtual bool handleGestureEvent(const WebGestureEvent&) override; | |
| 182 virtual bool handleKeyEvent(const WebKeyboardEvent&) override; | |
| 183 virtual bool handleCharEvent(const WebKeyboardEvent&) override; | |
| 184 | |
| 185 WebWidgetClient* m_client; | |
| 186 | |
| 187 // WebFrameWidget is associated with a subtree of the frame tree, correspond ing to a maximal | |
| 188 // connected tree of LocalFrames. This member points to the root of that sub tree. | |
| 189 WebLocalFrameImpl* m_localRoot; | |
| 190 | |
| 191 WebSize m_size; | |
| 192 | |
| 193 // If set, the (plugin) node which has mouse capture. | |
| 194 RefPtrWillBePersistent<Node> m_mouseCaptureNode; | |
| 195 RefPtr<UserGestureToken> m_mouseCaptureGestureToken; | |
| 196 | |
| 197 WebLayerTreeView* m_layerTreeView; | |
| 198 WebLayer* m_rootLayer; | |
| 199 GraphicsLayer* m_rootGraphicsLayer; | |
| 200 bool m_isAcceleratedCompositingActive; | |
| 201 bool m_layerTreeViewClosed; | |
| 202 | |
| 203 Page* m_page; | |
| 204 | |
| 205 bool m_suppressNextKeypressEvent; | |
| 206 | |
| 207 bool m_ignoreInputEvents; | |
| 208 | |
| 209 // The point relative to the client area where the mouse was last pressed | |
| 210 // down. This is used by the drag client to determine what was under the | |
| 211 // mouse when the drag was initiated. We need to track this here in | |
| 212 // WebViewImpl since DragClient::startDrag does not pass the position the | |
| 213 // mouse was at when the drag was initiated, only the current point, which | |
| 214 // can be misleading as it is usually not over the element the user actually | |
| 215 // dragged by the time a drag is initiated. | |
| 216 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
| |
| 217 | |
| 218 static const WebInputEvent* m_currentInputEvent; | |
| 219 | |
| 220 WebColor m_baseBackgroundColor; | |
| 221 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
| |
| 222 }; | |
| 223 | |
| 224 } // namespace blink | |
| 225 | |
| 226 #endif | |
| 227 | |
| OLD | NEW |