2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
29 #include "APIObject.h"
30 #include "DrawingArea.h"
31 #include "FindController.h"
32 #include "GeolocationPermissionRequestManager.h"
33 #include "ImageOptions.h"
34 #include "ImmutableArray.h"
35 #if ENABLE(CONTEXT_MENUS)
36 #include "InjectedBundlePageContextMenuClient.h"
38 #include "InjectedBundlePageDiagnosticLoggingClient.h"
39 #include "InjectedBundlePageEditorClient.h"
40 #include "InjectedBundlePageFormClient.h"
41 #include "InjectedBundlePageFullScreenClient.h"
42 #include "InjectedBundlePageLoaderClient.h"
43 #include "InjectedBundlePagePolicyClient.h"
44 #include "InjectedBundlePageResourceLoadClient.h"
45 #include "InjectedBundlePageUIClient.h"
46 #include "MessageSender.h"
47 #include "TapHighlightController.h"
49 #include "SandboxExtension.h"
50 #include "ShareableBitmap.h"
51 #include "WebHitTestResult.h"
52 #include "WebUndoStep.h"
53 #include <WebCore/DictationAlternative.h>
54 #include <WebCore/DragData.h>
55 #include <WebCore/Editor.h>
56 #include <WebCore/FrameLoaderTypes.h>
57 #include <WebCore/IntRect.h>
58 #include <WebCore/Page.h>
59 #if ENABLE(PAGE_VISIBILITY_API)
60 #include <WebCore/PageVisibilityState.h>
62 #include <WebCore/PlatformScreen.h>
63 #include <WebCore/ScrollTypes.h>
64 #include <WebCore/WebCoreKeyboardUIMode.h>
65 #include <wtf/HashMap.h>
66 #include <wtf/OwnPtr.h>
67 #include <wtf/PassRefPtr.h>
68 #include <wtf/RefPtr.h>
69 #include <wtf/text/WTFString.h>
72 #include "ArgumentCodersQt.h"
73 #include "QtNetworkAccessManager.h"
74 #include "QtNetworkReply.h"
75 #include "QtNetworkReplyData.h"
76 #include "QtNetworkRequestData.h"
77 #include <QNetworkReply>
78 #include <QNetworkRequest>
82 #include "ArgumentCodersGtk.h"
83 #include "WebPageAccessibilityObject.h"
84 #include "WebPrintOperationGtk.h"
87 #if ENABLE(TOUCH_EVENTS)
88 #include <WebCore/PlatformTouchEvent.h>
92 #include "DictionaryPopupInfo.h"
93 #include "LayerHostingContext.h"
94 #include <wtf/RetainPtr.h>
95 OBJC_CLASS NSDictionary;
97 OBJC_CLASS WKAccessibilityWebPageObject;
100 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
101 #include <WebCore/PageVisibilityState.h>
104 #if ENABLE(TIZEN_CUSTOM_HEADERS)
105 #include <WebCore/HTTPHeaderMap.h>
108 #if ENABLE(TIZEN_DATALIST_ELEMENT)
109 #include "HTMLDataListElement.h"
112 #if ENABLE(TIZEN_DRAG_SUPPORT)
113 #include "ArgumentCodersTizen.h"
116 #if ENABLE(TIZEN_SCREEN_READER)
117 #include "ScreenReader.h"
121 class ArgumentDecoder;
127 class GraphicsContext;
130 class HTMLPlugInElement;
135 class ResourceRequest;
137 class VisibleSelection;
138 struct KeypressCommand;
140 #if ENABLE(TIZEN_DATALIST_ELEMENT)
141 class HTMLDataListElement;
148 class InjectedBundleBackForwardList;
149 class NotificationPermissionRequestManager;
153 class WebColorChooser;
154 class WebContextMenu;
155 class WebContextMenuItemData;
158 class WebFullScreenManager;
161 class WebInspectorClient;
162 class WebKeyboardEvent;
164 class WebNotificationClient;
165 class WebOpenPanelResultListener;
166 class WebPageGroupProxy;
169 struct AttributedString;
172 struct WebPageCreationParameters;
173 struct WebPreferencesStore;
175 #if ENABLE(WEB_INTENTS)
179 #if ENABLE(GESTURE_EVENTS)
180 class WebGestureEvent;
183 #if ENABLE(TOUCH_EVENTS)
187 #if ENABLE(TIZEN_MEDIA_STREAM)
188 class UserMediaPermissionRequestManager;
189 class WebUserMediaClient;
192 #if ENABLE(TIZEN_ISF_PORT)
193 class NativeWebKeyboardEvent;
196 class WebPage : public APIObject, public CoreIPC::MessageSender<WebPage> {
198 static const Type APIType = TypeBundlePage;
200 static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&);
203 // Used by MessageSender.
204 CoreIPC::Connection* connection() const;
205 uint64_t destinationID() const { return pageID(); }
209 WebCore::Page* corePage() const { return m_page.get(); }
210 uint64_t pageID() const { return m_pageID; }
212 void setSize(const WebCore::IntSize&);
213 const WebCore::IntSize& size() const { return m_viewSize; }
214 WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
216 InjectedBundleBackForwardList* backForwardList();
217 DrawingArea* drawingArea() const { return m_drawingArea.get(); }
219 WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
221 void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
223 void scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
225 void centerSelectionInVisibleArea();
228 void confirmComposition(const String& compositionString);
229 void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
230 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
231 bool setCaretPosition(const WebCore::IntPoint&);
232 void getCaretPosition(WebCore::IntRect&);
234 #if ENABLE(TIZEN_ISF_PORT)
235 void updateCursorOffset();
236 void didCancelComposition(WebCore::Node*);
238 void getCursorOffset(int&);
239 void getSurroundingTextAndCursorOffset(String&, int&);
240 void getSelectionRect(bool, WebCore::IntRect&);
241 void deleteSurroundingText(int, int);
243 void scrollMainFrameBy(const WebCore::IntSize&);
244 void scrollMainFrameTo(const WebCore::IntPoint&);
245 void createSnapshot(const WebCore::IntRect, float, ShareableBitmap::Handle&);
246 void requestUpdateFormNavigation();
247 void moveFocus(int newIndex);
248 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
249 void createPagesToPDF(const WebCore::IntSize&, const WebCore::IntSize&, const String&);
251 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
252 void hitTestResultAtPoint(const WebCore::IntPoint&, int hitTestMode, WebHitTestResult::Data&);
255 #if ENABLE(TIZEN_WEB_STORAGE)
256 void getStorageQuotaBytes(uint64_t callbackID);
257 void setStorageQuotaBytes(uint32_t quota);
260 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
261 void setClipboardDataForPaste(const String& data, const String& type);
264 void suspendJavaScriptAndResources();
265 void resumeJavaScriptAndResources();
266 #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME)
267 void suspendAnimationController();
268 void resumeAnimationController();
270 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
271 void suspendPlugin();
275 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
276 void startInspectorServer(uint32_t port, uint32_t& assignedPort);
277 void stopInspectorServer(bool& result);
279 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
280 void sendOrientationChangeEvent(int orientation);
283 #if ENABLE(INSPECTOR)
284 WebInspector* inspector();
287 #if ENABLE(FULLSCREEN_API)
288 WebFullScreenManager* fullScreenManager();
291 // -- Called by the DrawingArea.
292 // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
293 void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
294 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
295 void selectClosestWord(const WebCore::IntPoint&, bool isStartedTextSelectionFromOutside, bool& result);
296 void setLeftSelection(const WebCore::IntPoint&, bool& result);
297 void setRightSelection(const WebCore::IntPoint&, bool& result);
298 void getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect);
299 void getSelectionText(String& result);
300 void selectionRangeClear(bool& result);
301 void selectionClearAllSelection(WebCore::Frame* frame);
304 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
305 void startOfflinePageSave(String subresourceFolderName);
308 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE)
309 void selectLink(WebCore::IntPoint positionForSelection, bool& result);
312 void drawPageOverlay(WebCore::GraphicsContext&, const WebCore::IntRect&);
313 void layoutIfNeeded();
314 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
315 void recordingSurfaceSetEnableSet(bool enable);
316 void recordingSurfaceSetEnableURL(const String&);
318 bool recordingSurfaceEnabled() { return m_recordingSurfaceSetEnable; }
320 void setRecordingSurfaceLoadStart(bool enable) { m_recordingSurfaceSetLoadStart = enable; }
321 bool recordingSurfaceLoadStart() { return m_recordingSurfaceSetLoadStart; }
323 void setRecordingSurfaceLoadFinish(bool enable) { m_recordingSurfaceSetLoadFinished = enable; }
324 bool recordingSurfaceLoadFinish() { return m_recordingSurfaceSetLoadFinished; }
327 // -- Called from WebCore clients.
329 bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*, bool saveCommands);
331 bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
335 String userAgent() const { return m_userAgent; }
336 WebCore::IntRect windowResizerRect() const;
337 WebCore::KeyboardUIMode keyboardUIMode();
339 WebUndoStep* webUndoStep(uint64_t);
340 void addWebUndoStep(uint64_t, WebUndoStep*);
341 void removeWebEditCommand(uint64_t);
342 bool isInRedo() const { return m_isInRedo; }
344 void setActivePopupMenu(WebPopupMenu*);
346 #if ENABLE(INPUT_TYPE_COLOR)
347 WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
348 void setActiveColorChooser(WebColorChooser*);
349 void didChooseColor(const WebCore::Color&);
350 void didEndColorChooser();
353 WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
354 void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>);
356 // -- Called from WebProcess.
357 void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
358 void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
360 // -- InjectedBundle methods
361 #if ENABLE(CONTEXT_MENUS)
362 void initializeInjectedBundleContextMenuClient(WKBundlePageContextMenuClient*);
364 void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*);
365 void initializeInjectedBundleFormClient(WKBundlePageFormClient*);
366 void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*);
367 void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient*);
368 void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient*);
369 void initializeInjectedBundleUIClient(WKBundlePageUIClient*);
370 #if ENABLE(FULLSCREEN_API)
371 void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClient*);
373 void initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClient*);
375 #if ENABLE(CONTEXT_MENUS)
376 InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; }
378 InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
379 InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; }
380 InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
381 InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
382 InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
383 InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
384 InjectedBundlePageDiagnosticLoggingClient& injectedBundleDiagnosticLoggingClient() { return m_logDiagnosticMessageClient; }
385 #if ENABLE(FULLSCREEN_API)
386 InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
389 void setUnderlayPage(PassRefPtr<WebPage> underlayPage) { m_underlayPage = underlayPage; }
391 bool findStringFromInjectedBundle(const String&, FindOptions);
393 WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
395 WebCore::Frame* mainFrame() const; // May return 0.
396 WebCore::FrameView* mainFrameView() const; // May return 0.
398 PassRefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&);
400 EditorState editorState() const;
402 String renderTreeExternalRepresentation() const;
403 uint64_t renderTreeSize() const;
404 void setPaintedObjectsCounterThreshold(uint64_t);
406 void setTracksRepaints(bool);
407 bool isTrackingRepaints() const;
408 void resetTrackedRepaints();
409 PassRefPtr<ImmutableArray> trackedRepaintRects();
411 void executeEditingCommand(const String& commandName, const String& argument);
412 bool isEditingCommandEnabled(const String& commandName);
413 void clearMainFrameName();
416 double textZoomFactor() const;
417 void setTextZoomFactor(double);
418 double pageZoomFactor() const;
419 void setPageZoomFactor(double);
420 void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
421 void windowScreenDidChange(uint64_t);
422 void setViewMode(WebCore::Page::ViewMode);
424 void scalePage(double scale, const WebCore::IntPoint& origin);
425 double pageScaleFactor() const;
427 void setUseFixedLayout(bool);
428 bool useFixedLayout() const { return m_useFixedLayout; }
429 void setFixedLayoutSize(const WebCore::IntSize&);
431 void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */);
432 void setPaginationBehavesLikeColumns(bool);
433 void setPageLength(double);
434 void setGapBetweenPages(double);
436 bool drawsBackground() const { return m_drawsBackground; }
437 bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
440 void stopLoadingFrame(uint64_t frameID);
441 void setDefersLoading(bool deferLoading);
443 #if USE(ACCELERATED_COMPOSITING)
444 void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
445 void exitAcceleratedCompositingMode();
448 void addPluginView(PluginView*);
449 void removePluginView(PluginView*);
452 LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
453 void setLayerHostingMode(LayerHostingMode);
455 bool windowIsVisible() const { return m_windowIsVisible; }
456 void updatePluginsActiveAndFocusedState();
457 const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
458 const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
460 HWND nativeWindow() const { return m_nativeWindow; }
463 bool windowIsFocused() const;
464 bool windowAndWebPageAreFocused() const;
465 void installPageOverlay(PassRefPtr<PageOverlay>);
466 void uninstallPageOverlay(PageOverlay*, bool fadeOut);
467 bool hasPageOverlay() const { return m_pageOverlay; }
468 WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
469 WebCore::IntRect windowToScreen(const WebCore::IntRect&);
471 PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
472 PassRefPtr<WebImage> scaledSnapshotInViewCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
473 PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
474 PassRefPtr<WebImage> scaledSnapshotInDocumentCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
476 static const WebEvent* currentEvent();
478 FindController& findController() { return m_findController; }
479 #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT)
480 TapHighlightController& tapHighlightController() { return m_tapHighlightController; }
483 #if ENABLE(GEOLOCATION)
484 GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
487 NotificationPermissionRequestManager* notificationPermissionRequestManager();
488 #if ENABLE(TIZEN_MEDIA_STREAM)
489 UserMediaPermissionRequestManager* userMediaPermissionRequestManager();
491 void pageDidScroll();
492 #if USE(TILED_BACKING_STORE)
493 void pageDidRequestScroll(const WebCore::IntPoint&);
495 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
496 void pageDidRequestRestoreVisibleContentRect(const WebCore::IntPoint&, float);
499 void setFixedVisibleContentRect(const WebCore::IntRect&);
500 void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&);
501 void resizeToContentsIfNeeded();
502 void sendViewportAttributesChanged();
503 void setViewportSize(const WebCore::IntSize&);
504 WebCore::IntSize viewportSize() const { return m_viewportSize; }
506 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
507 WebCore::IntSize contentsSize() const;
512 #if ENABLE(CONTEXT_MENUS)
513 WebContextMenu* contextMenu();
516 bool hasLocalDataForURL(const WebCore::KURL&);
517 String cachedResponseMIMETypeForURL(const WebCore::KURL&);
518 String cachedSuggestedFilenameForURL(const WebCore::KURL&);
519 PassRefPtr<WebCore::SharedBuffer> cachedResponseDataForURL(const WebCore::KURL&);
521 static bool canHandleRequest(const WebCore::ResourceRequest&);
523 class SandboxExtensionTracker {
525 ~SandboxExtensionTracker();
529 void beginLoad(WebFrame*, const SandboxExtension::Handle& handle);
530 void willPerformLoadDragDestinationAction(PassRefPtr<SandboxExtension> pendingDropSandboxExtension);
531 void didStartProvisionalLoad(WebFrame*);
532 void didCommitProvisionalLoad(WebFrame*);
533 void didFailProvisionalLoad(WebFrame*);
536 void setPendingProvisionalSandboxExtension(PassRefPtr<SandboxExtension>);
538 RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
539 RefPtr<SandboxExtension> m_provisionalSandboxExtension;
540 RefPtr<SandboxExtension> m_committedSandboxExtension;
543 SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
546 void setThemePath(const String&);
550 void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
551 void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
552 void cancelComposition();
556 void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
557 WKAccessibilityWebPageObject* accessibilityRemoteObject();
558 WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }
560 void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
562 void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, EditorState& newState);
563 void confirmComposition(EditorState& newState);
564 void cancelComposition(EditorState& newState);
565 void insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, bool& handled, EditorState& newState);
566 void getMarkedRange(uint64_t& location, uint64_t& length);
567 void getSelectedRange(uint64_t& location, uint64_t& length);
568 void getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString&);
569 void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
570 void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect);
571 void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
572 void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
573 void getStringSelectionForPasteboard(WTF::String& stringValue);
574 void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
575 void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
576 void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
577 bool performNonEditingBehaviorForSelector(const String&);
578 void insertDictatedText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool& handled, EditorState& newState);
580 void confirmComposition(const String& compositionString);
581 void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
582 void firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect);
583 void getSelectedText(WTF::String&);
585 void gestureWillBegin(const WebCore::IntPoint&, bool& canBeginPanning);
586 void gestureDidScroll(const WebCore::IntSize&);
587 void gestureDidEnd();
590 void updateAccessibilityTree();
591 bool handleMousePressedEvent(const WebCore::PlatformMouseEvent&);
592 #if USE(TEXTURE_MAPPER_GL)
593 void widgetMapped(int64_t nativeWindowHandle);
597 void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
598 bool hasCompositionForTesting();
599 void confirmCompositionForTesting(const String& compositionString);
601 // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
602 // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
606 void performDictionaryLookupForSelection(DictionaryPopupInfo::Type, WebCore::Frame*, const WebCore::VisibleSelection&);
609 void speak(const String&);
612 bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
615 #if ENABLE(WEB_INTENTS)
616 void deliverIntentToFrame(uint64_t frameID, const IntentData&);
619 void replaceSelectionWithText(WebCore::Frame*, const String&);
620 void clearSelection();
622 #if ENABLE(DRAG_SUPPORT)
624 void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
625 #elif PLATFORM(QT) || PLATFORM(GTK)
626 void performDragControllerAction(uint64_t action, WebCore::DragData);
628 #if ENABLE(TIZEN_DRAG_SUPPORT)
629 void performDragControllerAction(uint64_t action, WebCore::DragData);
631 void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
634 void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
636 void willPerformLoadDragDestinationAction();
637 void mayPerformUploadDragDestinationAction();
638 #endif // ENABLE(DRAG_SUPPORT)
640 void beginPrinting(uint64_t frameID, const PrintInfo&);
642 void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
643 #if PLATFORM(MAC) || PLATFORM(WIN)
644 void drawRectToPDF(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, uint64_t callbackID);
645 void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
647 void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
650 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
651 void getWebAppCapable(uint64_t callbackID);
652 void getWebAppIconURL(uint64_t callbackID);
655 void setMediaVolume(float);
657 bool mainFrameHasCustomRepresentation() const;
659 void didChangeScrollOffsetForMainFrame();
661 void mainFrameDidLayout();
663 bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
664 void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
666 bool canRunModal() const { return m_canRunModal; }
667 void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
671 void setDeviceScaleFactor(float);
672 float deviceScaleFactor() const;
674 void setMemoryCacheMessagesEnabled(bool);
676 void forceRepaintWithoutCallback();
678 void unmarkAllMisspellings();
679 void unmarkAllBadGrammar();
680 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
681 void handleAlternativeTextUIResult(const String&);
684 // For testing purpose.
685 void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
686 void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
687 void simulateMouseMotion(WebCore::IntPoint, double time);
689 #if ENABLE(CONTEXT_MENUS)
690 void contextMenuShowing() { m_isShowingContextMenu = true; }
694 void registerApplicationScheme(const String& scheme);
695 void applicationSchemeReply(const QtNetworkReplyData&);
696 void receivedApplicationSchemeRequest(const QNetworkRequest&, QtNetworkReply*);
697 void setUserScripts(const Vector<String>&);
699 void wheelEvent(const WebWheelEvent&);
700 #if ENABLE(GESTURE_EVENTS)
701 void gestureEvent(const WebGestureEvent&);
704 void numWheelEventHandlersChanged(unsigned);
705 void recomputeShortCircuitHorizontalWheelEventsState();
707 bool willGoToBackForwardItemCallbackEnabled() const { return m_willGoToBackForwardItemCallbackEnabled; }
709 #if ENABLE(PAGE_VISIBILITY_API)
710 void setVisibilityState(int visibilityState, bool isInitialState);
713 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) || ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
714 void setFocusedInputElementValue(const String& inputValue);
715 void getFocusedInputElementValue(String& inputValue);
718 #if ENABLE(TIZEN_DATALIST_ELEMENT)
719 void getFocusedInputElementDataList(Vector<String>&);
722 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
723 void scrollOverflow(const WebCore::FloatPoint&, bool& scrolled);
724 void setPressedNodeAtPoint(const WebCore::IntPoint&, bool checkOverflowLayer, bool& pressed, uint32_t& id);
727 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
728 void scrollOverflowWithTrajectoryVector(const WebCore::FloatPoint&);
731 #if ENABLE(TIZEN_CUSTOM_HEADERS)
732 void addCustomHeader(const String& name, const String& value);
733 void removeCustomHeader(const String& name);
734 void clearCustomHeaders();
735 WebCore::HTTPHeaderMap customHeaders();
738 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
739 void getTextStyleStateForSelection();
742 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
743 uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
746 #if ENABLE(TIZEN_MULTIPLE_SELECT)
747 void didChangeSelectedIndexForActivePopupMenuMultiple(Vector<int32_t>);
750 #if ENABLE(TIZEN_LINK_MAGNIFIER)
751 void getLinkMagnifierRect(const WebCore::IntPoint&, const WebCore::IntSize&);
754 #if ENABLE(TIZEN_SCREEN_READER)
755 void raiseTapEvent(const WebCore::IntPoint&, const WebCore::IntPoint&);
756 void moveScreenReaderFocus(bool, bool&);
757 void moveScreenReaderFocusByPoint(const WebCore::IntPoint&);
758 void recalcScreenReaderFocusRect();
759 void updateScreenReaderFocus(WebCore::RenderObject*);
760 void clearScreenReader();
763 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
764 void notifyTransitionToCommitted(bool);
767 #if ENABLE(TIZEN_CSP)
768 void setContentSecurityPolicy(const String& policy, uint32_t headerType);
771 #if ENABLE(TIZEN_INDEXED_DATABASE)
772 void setIndexedDatabaseDirectory(const String& path);
775 #if ENABLE(TIZEN_WEB_STORAGE)
776 void setLocalStorageDirectory(const String& path);
780 WebPage(uint64_t pageID, const WebPageCreationParameters&);
782 virtual Type type() const { return APIType; }
784 void platformInitialize();
786 void didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
787 void didReceiveSyncWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
790 static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
792 bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
795 bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
798 String sourceForFrame(WebFrame*);
800 void loadData(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::KURL& baseURL, const WebCore::KURL& failingURL);
802 bool platformHasLocalDataForURL(const WebCore::KURL&);
806 void loadURL(const String&, const SandboxExtension::Handle&);
807 void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle&);
808 void loadHTMLString(const String& htmlString, const String& baseURL);
809 void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
810 void loadPlainTextString(const String&);
811 void loadWebArchiveData(const CoreIPC::DataReference&);
813 void loadContentsbyMimeType(const CoreIPC::DataReference&, const String& mimeType, const String& encoding, const String& baseURL);
815 void linkClicked(const String& url, const WebMouseEvent&);
816 void reload(bool reloadFromOrigin, const SandboxExtension::Handle&);
817 void goForward(uint64_t);
818 void goBack(uint64_t);
819 void goToBackForwardItem(uint64_t);
820 void tryRestoreScrollPosition();
821 void setActive(bool);
822 void setFocused(bool);
823 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
824 void setWindowResizerSize(const WebCore::IntSize&);
825 void setIsInWindow(bool);
826 void validateCommand(const String&, uint64_t);
827 void executeEditCommand(const String&);
829 void executeEditCommandWithArgument(const String& command, const String& argument);
832 void mouseEvent(const WebMouseEvent&);
833 void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
834 void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
835 #if ENABLE(TIZEN_ISF_PORT)
836 void keyEvent(const NativeWebKeyboardEvent&);
838 void keyEvent(const WebKeyboardEvent&);
840 void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
841 #if ENABLE(TOUCH_EVENTS)
842 void touchEvent(const WebTouchEvent&);
843 void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
845 void highlightPotentialActivation(const WebCore::IntPoint&, const WebCore::IntSize& area);
848 #if ENABLE(CONTEXT_MENUS)
849 void contextMenuHidden() { m_isShowingContextMenu = false; }
852 static void scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
853 static void logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
855 uint64_t restoreSession(const SessionState&);
856 void restoreSessionAndNavigateToCurrentItem(const SessionState&);
858 void didRemoveBackForwardItem(uint64_t);
860 void setWillGoToBackForwardItemCallbackEnabled(bool enabled) { m_willGoToBackForwardItemCallbackEnabled = enabled; }
862 void setDrawsBackground(bool);
863 void setDrawsTransparentBackground(bool);
865 void viewWillStartLiveResize();
866 void viewWillEndLiveResize();
868 void getContentsAsString(uint64_t callbackID);
870 void getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding);
872 void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
873 void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
874 void getRenderTreeExternalRepresentation(uint64_t callbackID);
875 void getSelectionOrContentsAsString(uint64_t callbackID);
876 void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
877 void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
878 void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
879 void forceRepaint(uint64_t callbackID);
881 void preferencesDidChange(const WebPreferencesStore&);
882 void platformPreferencesDidChange(const WebPreferencesStore&);
883 void updatePreferences(const WebPreferencesStore&);
885 void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID);
886 void setUserAgent(const String&);
887 void setCustomTextEncodingName(const String&);
888 void suspendActiveDOMObjectsAndAnimations();
889 void resumeActiveDOMObjectsAndAnimations();
892 void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
893 void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*, NSDictionary *options);
895 void setWindowIsVisible(bool windowIsVisible);
896 void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
898 RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
899 void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
900 void drawRectToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
901 void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
904 void unapplyEditCommand(uint64_t commandID);
905 void reapplyEditCommand(uint64_t commandID);
906 void didRemoveEditCommand(uint64_t commandID);
908 void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
909 void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
910 void getImageForFindMatch(uint32_t matchIndex);
911 void selectFindMatch(uint32_t matchIndex);
913 void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
915 #if PLATFORM(QT) || OS(TIZEN)
916 void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
919 void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
920 void setTextForActivePopupMenu(int32_t index);
923 void failedToShowPopupMenu();
926 void hidePopupMenu();
927 void selectedIndex(int32_t newIndex);
930 void didChooseFilesForOpenPanel(const Vector<String>&);
931 void didCancelForOpenPanel();
932 #if ENABLE(WEB_PROCESS_SANDBOX)
933 void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
936 void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
938 void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
939 #if ENABLE(TIZEN_MEDIA_STREAM)
940 void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
943 void advanceToNextMisspelling(bool startBeforeSelection);
944 void changeSpellingToWord(const String& word);
946 void uppercaseWord();
947 void lowercaseWord();
948 void capitalizeWord();
952 void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; }
955 #if ENABLE(CONTEXT_MENUS)
956 void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
959 void changeSelectedIndex(int32_t index);
960 void setCanStartMediaTimerFired();
962 static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
963 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
964 void dumpMemorySnapshot();
966 OwnPtr<WebCore::Page> m_page;
967 RefPtr<WebFrame> m_mainFrame;
968 RefPtr<InjectedBundleBackForwardList> m_backForwardList;
970 RefPtr<WebPageGroupProxy> m_pageGroup;
974 WebCore::IntSize m_viewSize;
975 OwnPtr<DrawingArea> m_drawingArea;
977 HashSet<PluginView*> m_pluginViews;
979 bool m_useFixedLayout;
981 bool m_drawsBackground;
982 bool m_drawsTransparentBackground;
988 #if ENABLE(TIZEN_CUSTOM_HEADERS)
989 WebCore::HTTPHeaderMap m_customHeaders;
993 // Whether the containing window is visible or not.
994 bool m_windowIsVisible;
996 // Whether smart insert/delete is enabled or not.
997 bool m_isSmartInsertDeleteEnabled;
999 // The frame of the containing window in screen coordinates.
1000 WebCore::IntRect m_windowFrameInScreenCoordinates;
1002 // The frame of the view in window coordinates.
1003 WebCore::IntRect m_viewFrameInWindowCoordinates;
1005 // The accessibility position of the view.
1006 WebCore::IntPoint m_accessibilityPosition;
1008 // The layer hosting mode.
1009 LayerHostingMode m_layerHostingMode;
1011 RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1013 WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted;
1016 // Our view's window (in the UI process).
1017 HWND m_nativeWindow;
1019 RefPtr<WebCore::Node> m_gestureTargetNode;
1021 WebPageAccessibilityObject* m_accessibilityObject;
1023 #if USE(TEXTURE_MAPPER_GL)
1024 // Our view's window in the UI process.
1025 uint64_t m_nativeWindowHandle;
1029 WebCore::RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1031 HashMap<uint64_t, RefPtr<WebUndoStep> > m_undoStepMap;
1033 WebCore::IntSize m_windowResizerSize;
1035 #if ENABLE(CONTEXT_MENUS)
1036 InjectedBundlePageContextMenuClient m_contextMenuClient;
1038 InjectedBundlePageEditorClient m_editorClient;
1039 InjectedBundlePageFormClient m_formClient;
1040 InjectedBundlePageLoaderClient m_loaderClient;
1041 InjectedBundlePagePolicyClient m_policyClient;
1042 InjectedBundlePageResourceLoadClient m_resourceLoadClient;
1043 InjectedBundlePageUIClient m_uiClient;
1044 #if ENABLE(FULLSCREEN_API)
1045 InjectedBundlePageFullScreenClient m_fullScreenClient;
1047 InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient;
1049 #if USE(TILED_BACKING_STORE)
1050 WebCore::IntSize m_viewportSize;
1053 FindController m_findController;
1054 #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT)
1055 TapHighlightController m_tapHighlightController;
1057 RefPtr<PageOverlay> m_pageOverlay;
1059 RefPtr<WebPage> m_underlayPage;
1061 #if ENABLE(INSPECTOR)
1062 RefPtr<WebInspector> m_inspector;
1064 #if ENABLE(FULLSCREEN_API)
1065 RefPtr<WebFullScreenManager> m_fullScreenManager;
1067 RefPtr<WebPopupMenu> m_activePopupMenu;
1068 #if ENABLE(CONTEXT_MENUS)
1069 RefPtr<WebContextMenu> m_contextMenu;
1071 #if ENABLE(INPUT_TYPE_COLOR)
1072 WebColorChooser* m_activeColorChooser;
1074 RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1075 RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1076 #if ENABLE(TIZEN_MEDIA_STREAM)
1077 RefPtr<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1080 #if ENABLE(GEOLOCATION)
1081 GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
1084 OwnPtr<WebCore::PrintContext> m_printContext;
1086 RefPtr<WebPrintOperationGtk> m_printOperation;
1089 SandboxExtensionTracker m_sandboxExtensionTracker;
1092 RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1093 Vector<RefPtr<SandboxExtension> > m_pendingDropExtensionsForFileUpload;
1095 bool m_canRunBeforeUnloadConfirmPanel;
1098 bool m_isRunningModal;
1100 bool m_cachedMainFrameIsPinnedToLeftSide;
1101 bool m_cachedMainFrameIsPinnedToRightSide;
1102 bool m_canShortCircuitHorizontalWheelEvents;
1103 unsigned m_numWheelEventHandlers;
1105 unsigned m_cachedPageCount;
1107 #if ENABLE(CONTEXT_MENUS)
1108 bool m_isShowingContextMenu;
1111 bool m_willGoToBackForwardItemCallbackEnabled;
1114 bool m_gestureReachedScrollingLimit;
1118 HashMap<String, QtNetworkReply*> m_applicationSchemeReplies;
1120 #if ENABLE(PAGE_VISIBILITY_API)
1121 WebCore::PageVisibilityState m_visibilityState;
1123 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
1124 bool m_recordingSurfaceSetEnable;
1125 bool m_recordingSurfaceSetLoadStart;
1126 bool m_recordingSurfaceSetLoadFinished;
1127 bool m_recordingSurfaceSetSettings;
1129 #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME)
1130 bool m_suspendedAnimationController;
1133 WebInspectorClient* m_inspectorClient;
1135 #if ENABLE(TIZEN_SCREEN_READER)
1136 OwnPtr<ScreenReader> m_screenReader;
1139 #if ENABLE(TIZEN_ISF_PORT)
1140 bool m_isSettingComposition;
1144 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
1145 void dumpMemorySnapshot();
1148 } // namespace WebKit