| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 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 SKY_ENGINE_PUBLIC_WEB_WEBFRAME_H_ | |
| 32 #define SKY_ENGINE_PUBLIC_WEB_WEBFRAME_H_ | |
| 33 | |
| 34 #include "mojo/public/cpp/system/data_pipe.h" | |
| 35 #include "sky/engine/public/platform/WebCanvas.h" | |
| 36 #include "sky/engine/public/platform/WebPrivateOwnPtr.h" | |
| 37 #include "sky/engine/public/platform/WebReferrerPolicy.h" | |
| 38 #include "sky/engine/public/platform/WebURL.h" | |
| 39 #include "sky/engine/public/platform/WebURLRequest.h" | |
| 40 #include "sky/engine/public/web/WebCompositionUnderline.h" | |
| 41 #include "sky/engine/public/web/WebNode.h" | |
| 42 #include "sky/engine/public/web/WebURLLoaderOptions.h" | |
| 43 | |
| 44 | |
| 45 namespace v8 { | |
| 46 class Context; | |
| 47 class Function; | |
| 48 class Object; | |
| 49 class Value; | |
| 50 template <class T> class Handle; | |
| 51 template <class T> class Local; | |
| 52 } | |
| 53 | |
| 54 namespace blink { | |
| 55 | |
| 56 class Frame; | |
| 57 class WebData; | |
| 58 class WebDocument; | |
| 59 class WebElement; | |
| 60 class WebFrameClient; | |
| 61 class WebLayer; | |
| 62 class WebLocalFrame; | |
| 63 class WebRange; | |
| 64 class WebString; | |
| 65 class WebURL; | |
| 66 class WebURLLoader; | |
| 67 class WebURLRequest; | |
| 68 class WebView; | |
| 69 struct WebConsoleMessage; | |
| 70 struct WebFloatPoint; | |
| 71 struct WebFloatRect; | |
| 72 struct WebPoint; | |
| 73 struct WebRect; | |
| 74 struct WebScriptSource; | |
| 75 struct WebSize; | |
| 76 struct WebURLLoaderOptions; | |
| 77 | |
| 78 template <typename T> class WebVector; | |
| 79 | |
| 80 // FIXME(sky): fold WebLocalFrame into this class. | |
| 81 class WebFrame { | |
| 82 public: | |
| 83 // Control of renderTreeAsText output | |
| 84 enum RenderAsTextControl { | |
| 85 RenderAsTextNormal = 0, | |
| 86 RenderAsTextDebug = 1 << 0, | |
| 87 }; | |
| 88 typedef unsigned RenderAsTextControls; | |
| 89 | |
| 90 // Returns the number of live WebFrame objects, used for leak checking. | |
| 91 BLINK_EXPORT static int instanceCount(); | |
| 92 | |
| 93 virtual bool isWebLocalFrame() const = 0; | |
| 94 virtual WebLocalFrame* toWebLocalFrame() = 0; | |
| 95 | |
| 96 // This method closes and deletes the WebFrame. | |
| 97 virtual void close() = 0; | |
| 98 | |
| 99 // Geometry ----------------------------------------------------------- | |
| 100 | |
| 101 // NOTE: These routines do not force page layout so their results may | |
| 102 // not be accurate if the page layout is out-of-date. | |
| 103 | |
| 104 // The size of the contents area. | |
| 105 virtual WebSize contentsSize() const = 0; | |
| 106 | |
| 107 // Returns true if the contents (minus scrollbars) has non-zero area. | |
| 108 virtual bool hasVisibleContent() const = 0; | |
| 109 | |
| 110 // Returns the visible content rect (minus scrollbars, in absolute coordinat
e) | |
| 111 virtual WebRect visibleContentRect() const = 0; | |
| 112 | |
| 113 // Hierarchy ---------------------------------------------------------- | |
| 114 | |
| 115 // Returns the containing view. | |
| 116 virtual WebView* view() const = 0; | |
| 117 | |
| 118 // Content ------------------------------------------------------------ | |
| 119 | |
| 120 virtual WebDocument document() const = 0; | |
| 121 | |
| 122 | |
| 123 // Closing ------------------------------------------------------------- | |
| 124 | |
| 125 // Executes script in the context of the current page. | |
| 126 virtual void executeScript(const WebScriptSource&) = 0; | |
| 127 | |
| 128 // Logs to the console associated with this frame. | |
| 129 virtual void addMessageToConsole(const WebConsoleMessage&) = 0; | |
| 130 | |
| 131 // Calls window.gc() if it is defined. | |
| 132 virtual void collectGarbage() = 0; | |
| 133 | |
| 134 | |
| 135 // Navigation ---------------------------------------------------------- | |
| 136 | |
| 137 virtual void load(const WebURL&) = 0; | |
| 138 | |
| 139 virtual void loadFromDataPipeWithURL(mojo::ScopedDataPipeConsumerHandle, con
st WebURL&) = 0; | |
| 140 | |
| 141 | |
| 142 // Editing ------------------------------------------------------------- | |
| 143 | |
| 144 // Replaces the selection with the given text. | |
| 145 virtual void replaceSelection(const WebString& text) = 0; | |
| 146 | |
| 147 virtual void insertText(const WebString& text) = 0; | |
| 148 | |
| 149 virtual void setMarkedText(const WebString& text, unsigned location, unsigne
d length) = 0; | |
| 150 virtual void unmarkText() = 0; | |
| 151 virtual bool hasMarkedText() const = 0; | |
| 152 | |
| 153 // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll, | |
| 154 // Unselect, etc. See EditorCommand.cpp for the full list of supported | |
| 155 // commands. | |
| 156 virtual bool executeCommand(const WebString&, const WebNode& = WebNode()) =
0; | |
| 157 virtual bool executeCommand(const WebString&, const WebString& value, const
WebNode& = WebNode()) = 0; | |
| 158 virtual bool isCommandEnabled(const WebString&) const = 0; | |
| 159 | |
| 160 // Spell-checking support. | |
| 161 virtual void enableContinuousSpellChecking(bool) = 0; | |
| 162 virtual bool isContinuousSpellCheckingEnabled() const = 0; | |
| 163 virtual void requestTextChecking(const WebElement&) = 0; | |
| 164 virtual void replaceMisspelledRange(const WebString&) = 0; | |
| 165 virtual void removeSpellingMarkers() = 0; | |
| 166 | |
| 167 // Selection ----------------------------------------------------------- | |
| 168 | |
| 169 virtual bool hasSelection() const = 0; | |
| 170 | |
| 171 virtual WebRange selectionRange() const = 0; | |
| 172 | |
| 173 virtual WebString selectionAsText() const = 0; | |
| 174 | |
| 175 // Expands the selection to a word around the caret and returns | |
| 176 // true. Does nothing and returns false if there is no caret or | |
| 177 // there is ranged selection. | |
| 178 virtual bool selectWordAroundCaret() = 0; | |
| 179 | |
| 180 // DEPRECATED: Use moveRangeSelection. | |
| 181 virtual void selectRange(const WebPoint& base, const WebPoint& extent) = 0; | |
| 182 | |
| 183 virtual void selectRange(const WebRange&) = 0; | |
| 184 | |
| 185 // Move the current selection to the provided window point/points. If the | |
| 186 // current selection is editable, the new selection will be restricted to | |
| 187 // the root editable element. | |
| 188 virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent
) = 0; | |
| 189 virtual void moveCaretSelection(const WebPoint&) = 0; | |
| 190 | |
| 191 virtual bool setEditableSelectionOffsets(int start, int end) = 0; | |
| 192 virtual bool setCompositionFromExistingText(int compositionStart, int compos
itionEnd, const WebVector<WebCompositionUnderline>& underlines) = 0; | |
| 193 virtual void extendSelectionAndDelete(int before, int after) = 0; | |
| 194 | |
| 195 virtual void setCaretVisible(bool) = 0; | |
| 196 | |
| 197 | |
| 198 // Utility ------------------------------------------------------------- | |
| 199 | |
| 200 // Returns the contents of this frame as a string. If the text is | |
| 201 // longer than maxChars, it will be clipped to that length. WARNING: | |
| 202 // This function may be slow depending on the number of characters | |
| 203 // retrieved and page complexity. For a typically sized page, expect | |
| 204 // it to take on the order of milliseconds. | |
| 205 // | |
| 206 // If there is room, subframe text will be recursively appended. Each | |
| 207 // frame will be separated by an empty line. | |
| 208 virtual WebString contentAsText(size_t maxChars) const = 0; | |
| 209 | |
| 210 // Returns a text representation of the render tree. This method is used | |
| 211 // to support layout tests. | |
| 212 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTex
tNormal) const = 0; | |
| 213 | |
| 214 // Only for testing purpose: | |
| 215 // Returns true if selection.anchorNode has a marker on range from |from| wi
th |length|. | |
| 216 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const
= 0; | |
| 217 | |
| 218 #if BLINK_IMPLEMENTATION | |
| 219 static WebFrame* fromFrame(Frame*); | |
| 220 #endif | |
| 221 | |
| 222 protected: | |
| 223 explicit WebFrame(); | |
| 224 virtual ~WebFrame(); | |
| 225 | |
| 226 private: | |
| 227 }; | |
| 228 | |
| 229 #if BLINK_IMPLEMENTATION | |
| 230 Frame* toCoreFrame(const WebFrame*); | |
| 231 #endif | |
| 232 | |
| 233 } // namespace blink | |
| 234 | |
| 235 #endif // SKY_ENGINE_PUBLIC_WEB_WEBFRAME_H_ | |
| OLD | NEW |