| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "../platform/WebColor.h" | 34 #include "../platform/WebColor.h" |
| 35 #include "../platform/WebString.h" | 35 #include "../platform/WebString.h" |
| 36 #include "../platform/WebVector.h" | 36 #include "../platform/WebVector.h" |
| 37 #include "sky/engine/public/web/WebPageVisibilityState.h" | 37 #include "sky/engine/public/web/WebPageVisibilityState.h" |
| 38 #include "sky/engine/public/web/WebWidget.h" | 38 #include "sky/engine/public/web/WebWidget.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class WebFrame; | 42 class WebFrame; |
| 43 class WebFrameClient; | 43 class WebFrameClient; |
| 44 class WebGraphicsContext3D; | |
| 45 class WebHitTestResult; | 44 class WebHitTestResult; |
| 46 class WebNode; | |
| 47 class WebRange; | |
| 48 class WebSettings; | 45 class WebSettings; |
| 49 class WebSpellCheckClient; | 46 class WebSpellCheckClient; |
| 50 class WebString; | |
| 51 class WebViewClient; | 47 class WebViewClient; |
| 52 struct WebActiveWheelFlingParameters; | 48 struct WebActiveWheelFlingParameters; |
| 53 struct WebPoint; | 49 struct WebPoint; |
| 54 struct WebFloatPoint; | |
| 55 | 50 |
| 56 class WebView : public WebWidget { | 51 class WebView : public WebWidget { |
| 57 public: | 52 public: |
| 58 // Initialization ------------------------------------------------------ | 53 // Initialization ------------------------------------------------------ |
| 59 | 54 |
| 60 // Creates a WebView that is NOT yet initialized. You will need to | 55 // Creates a WebView that is NOT yet initialized. You will need to |
| 61 // call setMainFrame to finish the initialization. It is valid | 56 // call setMainFrame to finish the initialization. It is valid |
| 62 // to pass a null client pointer. | 57 // to pass a null client pointer. |
| 63 BLINK_EXPORT static WebView* create(WebViewClient*); | 58 BLINK_EXPORT static WebView* create(WebViewClient*); |
| 64 | 59 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 virtual void setTabKeyCyclesThroughElements(bool) = 0; | 101 virtual void setTabKeyCyclesThroughElements(bool) = 0; |
| 107 | 102 |
| 108 // Controls the WebView's active state, which may affect the rendering | 103 // Controls the WebView's active state, which may affect the rendering |
| 109 // of elements on the page (i.e., tinting of input elements). | 104 // of elements on the page (i.e., tinting of input elements). |
| 110 virtual bool isActive() const = 0; | 105 virtual bool isActive() const = 0; |
| 111 virtual void setIsActive(bool) = 0; | 106 virtual void setIsActive(bool) = 0; |
| 112 | 107 |
| 113 // Allows disabling domain relaxation. | 108 // Allows disabling domain relaxation. |
| 114 virtual void setDomainRelaxationForbidden(bool, const WebString& scheme) = 0
; | 109 virtual void setDomainRelaxationForbidden(bool, const WebString& scheme) = 0
; |
| 115 | 110 |
| 116 // Marks the WebView as being opened by a DOM call. This is relevant | |
| 117 // for whether window.close() may be called. | |
| 118 virtual void setOpenedByDOM() = 0; | |
| 119 | |
| 120 | |
| 121 // Frames -------------------------------------------------------------- | 111 // Frames -------------------------------------------------------------- |
| 122 | 112 |
| 123 virtual WebFrame* mainFrame() = 0; | 113 virtual WebFrame* mainFrame() = 0; |
| 124 | 114 |
| 125 virtual void injectModule(const WebString& path) = 0; | 115 virtual void injectModule(const WebString& path) = 0; |
| 126 | 116 |
| 127 // Focus --------------------------------------------------------------- | 117 // Focus --------------------------------------------------------------- |
| 128 | 118 |
| 129 virtual WebFrame* focusedFrame() = 0; | 119 virtual WebFrame* focusedFrame() = 0; |
| 130 virtual void setFocusedFrame(WebFrame*) = 0; | 120 virtual void setFocusedFrame(WebFrame*) = 0; |
| 131 | 121 |
| 132 // Focus the first (last if reverse is true) focusable node. | 122 // Focus the first (last if reverse is true) focusable node. |
| 133 virtual void setInitialFocus(bool reverse) = 0; | 123 virtual void setInitialFocus(bool reverse) = 0; |
| 134 | 124 |
| 135 // Clears the focused element (and selection if a text field is focused) | 125 // Clears the focused element (and selection if a text field is focused) |
| 136 // to ensure that a text field on the page is not eating keystrokes we | 126 // to ensure that a text field on the page is not eating keystrokes we |
| 137 // send it. | 127 // send it. |
| 138 virtual void clearFocusedElement() = 0; | 128 virtual void clearFocusedElement() = 0; |
| 139 | 129 |
| 140 // Scrolls the node currently in focus into |rect|, where |rect| is in | |
| 141 // window space. | |
| 142 virtual void scrollFocusedNodeIntoRect(const WebRect&) { } | |
| 143 | |
| 144 // Advance the focus of the WebView forward to the next element or to the | 130 // Advance the focus of the WebView forward to the next element or to the |
| 145 // previous element in the tab sequence (if reverse is true). | 131 // previous element in the tab sequence (if reverse is true). |
| 146 virtual void advanceFocus(bool reverse) { } | 132 virtual void advanceFocus(bool reverse) { } |
| 147 | 133 |
| 148 | 134 |
| 149 // Zoom ---------------------------------------------------------------- | 135 // Zoom ---------------------------------------------------------------- |
| 150 | 136 |
| 151 // TODO: Reevaluate if this is needed once all users are converted to using
the | |
| 152 // virtual viewport pinch model. | |
| 153 // Temporary to keep old style pinch viewport working while we gradually bri
ng up | |
| 154 // virtual viewport pinch. | |
| 155 virtual void setMainFrameScrollOffset(const WebPoint& origin) = 0; | |
| 156 | |
| 157 // Reset any saved values for the scroll and scale state. | |
| 158 virtual void resetScrollAndScaleState() = 0; | |
| 159 | |
| 160 // Returns the "preferred" contents size, defined as the preferred minimum w
idth of the main document's contents | |
| 161 // and the minimum height required to display the main document without scro
llbars. | |
| 162 virtual WebSize contentsPreferredMinimumSize() = 0; | |
| 163 | |
| 164 // The ratio of the current device's screen DPI to the target device's scree
n DPI. | 137 // The ratio of the current device's screen DPI to the target device's scree
n DPI. |
| 165 virtual float deviceScaleFactor() const = 0; | 138 virtual float deviceScaleFactor() const = 0; |
| 166 | 139 |
| 167 // Sets the ratio as computed by computePageScaleConstraints. | 140 // Sets the ratio as computed by computePageScaleConstraints. |
| 168 virtual void setDeviceScaleFactor(float) = 0; | 141 virtual void setDeviceScaleFactor(float) = 0; |
| 169 | 142 |
| 170 | 143 |
| 171 // Fixed Layout -------------------------------------------------------- | |
| 172 | |
| 173 // Locks main frame's layout size to specified size. Passing WebSize(0, 0) | |
| 174 // removes the lock. | |
| 175 virtual void setFixedLayoutSize(const WebSize&) = 0; | |
| 176 | |
| 177 // Data exchange ------------------------------------------------------- | 144 // Data exchange ------------------------------------------------------- |
| 178 | 145 |
| 179 // Do a hit test at given point and return the HitTestResult. | 146 // Do a hit test at given point and return the HitTestResult. |
| 180 virtual WebHitTestResult hitTestResultAt(const WebPoint&) = 0; | 147 virtual WebHitTestResult hitTestResultAt(const WebPoint&) = 0; |
| 181 | 148 |
| 182 // Copy to the clipboard the image located at a particular point in the | |
| 183 // WebView (if there is such an image) | |
| 184 virtual void copyImageAt(const WebPoint&) = 0; | |
| 185 | |
| 186 // Save as the image located at a particular point in the | |
| 187 // WebView (if there is such an image) | |
| 188 virtual void saveImageAt(const WebPoint&) = 0; | |
| 189 | |
| 190 // Notfies the WebView that the system drag and drop operation has ended. | |
| 191 virtual void dragSourceSystemDragEnded() = 0; | |
| 192 | |
| 193 // Retrieves a list of spelling markers. | 149 // Retrieves a list of spelling markers. |
| 194 virtual void spellingMarkers(WebVector<uint32_t>* markers) = 0; | 150 virtual void spellingMarkers(WebVector<uint32_t>* markers) = 0; |
| 195 virtual void removeSpellingMarkersUnderWords(const WebVector<WebString>& wor
ds) = 0; | 151 virtual void removeSpellingMarkersUnderWords(const WebVector<WebString>& wor
ds) = 0; |
| 196 | 152 |
| 197 | 153 |
| 198 // Developer tools ----------------------------------------------------- | 154 // Developer tools ----------------------------------------------------- |
| 199 | 155 |
| 200 // Set an override of device scale factor passed from WebView to | 156 // Set an override of device scale factor passed from WebView to |
| 201 // compositor. Pass zero to cancel override. This is used to implement | 157 // compositor. Pass zero to cancel override. This is used to implement |
| 202 // device metrics emulation. | 158 // device metrics emulation. |
| 203 virtual void setCompositorDeviceScaleFactorOverride(float) = 0; | 159 virtual void setCompositorDeviceScaleFactorOverride(float) = 0; |
| 204 | 160 |
| 205 // Set offset and scale on the root composited layer. This is used | |
| 206 // to implement device metrics emulation. | |
| 207 virtual void setRootLayerTransform(const WebSize& offset, float scale) = 0; | |
| 208 | |
| 209 // SmartClip support --------------------------------------------------- | |
| 210 virtual void extractSmartClipData(WebRect initRect, WebString& text, WebStri
ng& html, WebRect& resultRect) = 0; | |
| 211 | |
| 212 // Custom colors ------------------------------------------------------- | |
| 213 | |
| 214 virtual void setSelectionColors(unsigned activeBackgroundColor, | |
| 215 unsigned activeForegroundColor, | |
| 216 unsigned inactiveBackgroundColor, | |
| 217 unsigned inactiveForegroundColor) = 0; | |
| 218 | |
| 219 // Called to inform the WebView that a wheel fling animation was started ext
ernally (for instance | 161 // Called to inform the WebView that a wheel fling animation was started ext
ernally (for instance |
| 220 // by the compositor) but must be completed by the WebView. | 162 // by the compositor) but must be completed by the WebView. |
| 221 virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingPara
meters&) = 0; | 163 virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingPara
meters&) = 0; |
| 222 | 164 |
| 223 // Cancels an active fling, returning true if a fling was active. | 165 // Cancels an active fling, returning true if a fling was active. |
| 224 virtual bool endActiveFlingAnimation() = 0; | 166 virtual bool endActiveFlingAnimation() = 0; |
| 225 | 167 |
| 226 virtual void setShowPaintRects(bool) = 0; | 168 virtual void setShowPaintRects(bool) = 0; |
| 227 virtual void setShowFPSCounter(bool) = 0; | 169 virtual void setShowFPSCounter(bool) = 0; |
| 228 virtual void setContinuousPaintingEnabled(bool) = 0; | 170 virtual void setContinuousPaintingEnabled(bool) = 0; |
| 229 virtual void setShowScrollBottleneckRects(bool) = 0; | 171 virtual void setShowScrollBottleneckRects(bool) = 0; |
| 230 | 172 |
| 231 // Compute the bounds of the root element of the current selection and fills | |
| 232 // the out-parameter on success. |bounds| coordinates will be relative to | |
| 233 // the contents window and will take into account the current scale level. | |
| 234 virtual void getSelectionRootBounds(WebRect& bounds) const = 0; | |
| 235 | |
| 236 // Visibility ----------------------------------------------------------- | 173 // Visibility ----------------------------------------------------------- |
| 237 | 174 |
| 238 // Sets the visibility of the WebView. | 175 // Sets the visibility of the WebView. |
| 239 virtual void setVisibilityState(WebPageVisibilityState visibilityState, | 176 virtual void setVisibilityState(WebPageVisibilityState visibilityState, |
| 240 bool isInitialState) { } | 177 bool isInitialState) { } |
| 241 | 178 |
| 242 // i18n ----------------------------------------------------------------- | 179 // i18n ----------------------------------------------------------------- |
| 243 | 180 |
| 244 // Inform the WebView that the accept languages have changed. | 181 // Inform the WebView that the accept languages have changed. |
| 245 // If the WebView wants to get the accept languages value, it will have | 182 // If the WebView wants to get the accept languages value, it will have |
| 246 // to call the WebViewClient::acceptLanguages(). | 183 // to call the WebViewClient::acceptLanguages(). |
| 247 virtual void acceptLanguagesChanged() = 0; | 184 virtual void acceptLanguagesChanged() = 0; |
| 248 | 185 |
| 249 // Testing functionality for TestRunner --------------------------------- | 186 // Testing functionality for TestRunner --------------------------------- |
| 250 | 187 |
| 251 protected: | 188 protected: |
| 252 ~WebView() {} | 189 ~WebView() {} |
| 253 }; | 190 }; |
| 254 | 191 |
| 255 } // namespace blink | 192 } // namespace blink |
| 256 | 193 |
| 257 #endif // SKY_ENGINE_PUBLIC_WEB_WEBVIEW_H_ | 194 #endif // SKY_ENGINE_PUBLIC_WEB_WEBVIEW_H_ |
| OLD | NEW |