2 * Copyright (C) 2011 Samsung Electronics
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.
27 #include "WebPageProxy.h"
29 #include "EwkViewImpl.h"
30 #include "NativeWebKeyboardEvent.h"
31 #include "NotImplemented.h"
32 #include "PageClientImpl.h"
33 #include "WebPageMessages.h"
34 #include "WebProcessProxy.h"
36 #include <sys/utsname.h>
39 #include "DrawingAreaMessages.h"
41 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
42 #include "LayerTreeCoordinatorProxy.h"
44 #include "NativeWebKeyboardEvent.h"
46 #include "WebPageMessages.h"
47 #include "WebProcessProxy.h"
48 #include <WebCore/IntSize.h>
49 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
50 #include "WebContextMenuProxy.h"
51 #include "ewk_view_private.h"
54 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
56 #if ENABLE(TIZEN_LINK_MAGNIFIER)
57 #include "LinkMagnifierProxy.h"
60 #if ENABLE(TIZEN_SCREEN_READER)
61 #include "ScreenReaderProxy.h"
62 #include "ewk_view_private.h"
66 #include <WebCore/ContentSecurityPolicy.h>
69 using namespace WebCore;
74 Evas_Object* WebPageProxy::viewWidget()
76 return static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->view();
79 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
82 return String::fromUTF8("Mozilla/5.0 (Linux; Tizen 2.1; sdk) AppleWebKit/537.3 (KHTML, like Gecko) Version/2.1 Mobile Safari/537.3");
87 WTF::String osVersion;
94 version = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.',
95 String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
97 if (uname(&name) != -1)
98 osVersion = WTF::String(name.sysname) + " " + WTF::String(name.machine);
100 osVersion = "Unknown";
102 if (applicationNameForUserAgent.isEmpty())
103 return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
104 " (KHTML, like Gecko) Version/5.0 Safari/", version);
106 return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
107 " (KHTML, like Gecko) Version/5.0 Safari/", version, applicationNameForUserAgent);
110 void WebPageProxy::getEditorCommandsForKeyEvent(Vector<WTF::String>& commandsList)
115 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
120 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
125 void WebPageProxy::setThemePath(const String& themePath)
127 process()->send(Messages::WebPage::SetThemePath(themePath), m_pageID, 0);
130 #if ENABLE(TIZEN_CUSTOM_HEADERS)
131 void WebPageProxy::addCustomHeader(const String& name, const String& value)
142 process()->send(Messages::WebPage::AddCustomHeader(name, value), m_pageID);
145 void WebPageProxy::removeCustomHeader(const String& name)
153 process()->send(Messages::WebPage::RemoveCustomHeader(name), m_pageID);
156 void WebPageProxy::clearCustomHeaders()
161 process()->send(Messages::WebPage::ClearCustomHeaders(), m_pageID);
166 bool WebPageProxy::scrollMainFrameBy(const IntSize& scrollOffset)
168 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
169 return static_cast<PageClientImpl*>(m_pageClient)->scrollBy(scrollOffset);
174 process()->send(Messages::WebPage::ScrollMainFrameBy(scrollOffset), m_pageID);
179 void WebPageProxy::scrollMainFrameTo(const IntPoint& scrollPosition)
181 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
182 static_cast<PageClientImpl*>(m_pageClient)->scrollTo(scrollPosition);
187 process()->send(Messages::WebPage::ScrollMainFrameTo(scrollPosition), m_pageID);
191 void WebPageProxy::didChangeScrollPositionForMainFrame(const IntPoint& scrollPosition)
193 #if !ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
194 m_scrollPosition = scrollPosition;
198 void WebPageProxy::didChangeContentsSize(const IntSize& size)
200 if (m_contentsSize == size)
203 m_contentsSize = size;
204 m_pageClient->didChangeContentsSize(size);
207 PassRefPtr<WebImage> WebPageProxy::createSnapshot(const IntRect& rect, float scaleFactor)
212 ShareableBitmap::Handle snapshotHandle;
213 // Do not wait for more than a second (arbitrary) for the WebProcess to get the snapshot so
214 // that the UI Process is not permanently stuck waiting on a potentially crashing Web Process.
215 static const double createSnapshotSyncMessageTimeout = 1.0;
216 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
217 float baseScaleFactor = static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
218 scaleFactor = scaleFactor * baseScaleFactor;
220 IntRect visibleContentRect = static_cast<PageClientImpl*>(m_pageClient)->visibleContentRect();
221 IntRect scaledRect = rect;
222 scaledRect.move(visibleContentRect.x(), visibleContentRect.y());
223 scaledRect.scale(1/baseScaleFactor);
224 process()->sendSync(Messages::WebPage::CreateSnapshot(scaledRect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
226 process()->sendSync(Messages::WebPage::CreateSnapshot(rect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
228 if (snapshotHandle.isNull())
230 return WebImage::create(ShareableBitmap::create(snapshotHandle));
233 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
234 void WebPageProxy::textChangeInTextField(const String& name, const String& value)
236 static_cast<PageClientImpl*>(m_pageClient)->textChangeInTextField(name, value);
240 #if ENABLE(TIZEN_ISF_PORT)
241 void WebPageProxy::setInputMethodState(bool active)
243 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
244 if (!inputMethodContext)
247 inputMethodContext->setUseInputMethod(active);
250 int WebPageProxy::getCursorOffset()
256 process()->sendSync(Messages::WebPage::GetCursorOffset(), Messages::WebPage::GetCursorOffset::Reply(offset), m_pageID);
260 void WebPageProxy::getSurroundingTextAndCursorOffset(String& text, int& offset)
265 process()->sendSync(Messages::WebPage::GetSurroundingTextAndCursorOffset(), Messages::WebPage::GetSurroundingTextAndCursorOffset::Reply(text, offset), m_pageID);
268 IntRect WebPageProxy::getSelectionRect(bool isOnlyEditable)
271 process()->sendSync(Messages::WebPage::GetSelectionRect(isOnlyEditable), Messages::WebPage::GetSelectionRect::Reply(rect), m_pageID);
275 void WebPageProxy::deleteSurroundingText(int offset, int count)
280 process()->send(Messages::WebPage::DeleteSurroundingText(offset, count), m_pageID);
283 void WebPageProxy::didCancelComposition()
285 m_didCancelCompositionFromWebProcess = true;
286 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
287 if (inputMethodContext)
288 inputMethodContext->resetIMFContext();
289 m_didCancelCompositionFromWebProcess = false;
293 void WebPageProxy::requestUpdateFormNavigation()
298 process()->send(Messages::WebPage::RequestUpdateFormNavigation(), m_pageID);
301 void WebPageProxy::moveFocus(int newIndex)
306 process()->send(Messages::WebPage::MoveFocus(newIndex), m_pageID);
309 void WebPageProxy::updateFormNavigation(int length, int offset)
311 static_cast<PageClientImpl*>(m_pageClient)->updateFormNavigation(length, offset);
314 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
315 Eina_Bool WebPageProxy::pageContentResumeTimerFired(void* data)
317 static_cast<WebPageProxy*>(data)->resumeActiveDOMObjectsAndAnimations();
318 static_cast<WebPageProxy*>(data)->m_pageContentResumeTimer = 0;
319 return ECORE_CALLBACK_CANCEL;
323 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
324 void WebPageProxy::setCaretPosition(const WebCore::IntPoint& pos)
329 process()->send(Messages::WebPage::SetCaretPosition(pos), m_pageID);
332 void WebPageProxy::getCaretPosition(WebCore::IntRect& rect)
337 process()->sendSync(Messages::WebPage::GetCaretPosition(), Messages::WebPage::GetCaretPosition::Reply(rect), m_pageID);
341 #if ENABLE(TIZEN_PLUGIN_CUSTOM_REQUEST)
342 void WebPageProxy::processPluginCustomRequest(const String& request, const String& msg)
344 if (String("requestKeyboard,plugin") == request) {
346 if (String("show") == msg)
348 #if ENABLE(TIZEN_ISF_PORT)
349 m_editorState = EditorState();
350 m_editorState.isContentEditable = active;
351 m_pageClient->updateTextInputState();
354 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
355 else if (String("requestToNative,json") == request)
356 m_tizenClient.processJSBridgePlugin(this, request, msg);
362 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) || ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
363 void WebPageProxy::setFocusedInputElementValue(const String& inputValue)
368 process()->send(Messages::WebPage::SetFocusedInputElementValue(inputValue), m_pageID);
371 String WebPageProxy::getFocusedInputElementValue()
377 process()->sendSync(Messages::WebPage::GetFocusedInputElementValue(), Messages::WebPage::GetFocusedInputElementValue::Reply(inputValue), m_pageID);
382 #if ENABLE(TIZEN_DATALIST_ELEMENT)
383 Vector<String> WebPageProxy::getFocusedInputElementDataList()
386 return Vector<String>();
388 Vector<String> optionList;
389 process()->sendSync(Messages::WebPage::GetFocusedInputElementDataList(), Messages::WebPage::GetFocusedInputElementDataList::Reply(optionList), m_pageID);
394 void WebPageProxy::focusedNodeChanged(const IntRect& focusedNodeRect)
396 static_cast<PageClientImpl*>(m_pageClient)->setFocusedNodeRect(focusedNodeRect);
399 void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client)
401 m_tizenClient.initialize(client);
404 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
405 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode)
407 WebHitTestResult::Data hitTestResultData;
409 return hitTestResultData;
411 process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode),
412 Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
414 return hitTestResultData;
418 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
419 void WebPageProxy::hideContextMenu()
421 if (m_activeContextMenu)
422 m_activeContextMenu->hideContextMenu();
425 String WebPageProxy::contextMenuAbsoluteLinkURLString()
427 if (!m_activeContextMenu)
430 return m_activeContextMenuHitTestResultData.absoluteLinkURL;
433 String WebPageProxy::contextMenuAbsoluteImageURLString()
435 if (!m_activeContextMenu)
438 return m_activeContextMenuHitTestResultData.absoluteImageURL;
442 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
443 void WebPageProxy::pasteContextMenuSelected()
445 static_cast<PageClientImpl*>(m_pageClient)->pasteContextMenuSelected();
448 void WebPageProxy::didSelectPasteMenuFromContextMenu(const String& data, const String& type)
453 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
454 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
456 WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
457 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
461 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
462 void WebPageProxy::setClipboardData(const String& data, const String& type)
464 static_cast<PageClientImpl*>(m_pageClient)->setClipboardData(data, type);
467 void WebPageProxy::clearClipboardData()
469 static_cast<PageClientImpl*>(m_pageClient)->clearClipboardData();
473 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
474 void WebPageProxy::executePasteFromClipboardItem(const String& data, const String& type)
479 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
480 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
482 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument("Paste", data), m_pageID);
485 void WebPageProxy::clipboardContextMenuSelected()
487 static_cast<PageClientImpl*>(m_pageClient)->clipboardContextMenuSelected();
491 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
492 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
497 uint32_t assignedPort = 0;
498 process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
502 bool WebPageProxy::stopInspectorServer()
508 process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
513 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
514 void WebPageProxy::createPagesToPDF(const IntSize& surfaceSize, const IntSize& contentsSize, const String& fileName)
516 process()->send(Messages::WebPage::CreatePagesToPDF(surfaceSize, contentsSize, fileName), m_pageID);
520 #if ENABLE(TIZEN_WEB_STORAGE)
521 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
522 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
524 RefPtr<WebStorageQuotaCallback> callback = prpCallback;
526 callback->invalidate();
530 uint64_t callbackID = callback->callbackID();
531 m_quotaCallbacks.set(callbackID, callback.get());
532 process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
535 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
537 RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
539 // FIXME: Log error or assert.
540 // this can validly happen if a load invalidated the callback, though
544 m_quotaCallbacks.remove(callbackID);
546 RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
547 callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
551 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
556 process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
560 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
562 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
563 static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
565 scalePage(scaleFactor, origin);
569 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin)
571 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
572 static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin);
574 scalePage(scaleFactor, origin);
578 double WebPageProxy::scaleFactor()
580 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
581 return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
583 return pageScaleFactor();
587 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
588 void WebPageProxy::sendOrientationChangeEvent(int orientation)
590 process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
594 void WebPageProxy::suspendPainting()
599 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
602 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
603 void WebPageProxy::suspendPaintingOfInactiveView()
605 if (!isValid() || isViewVisible())
608 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
612 void WebPageProxy::resumePainting()
617 process()->send(Messages::DrawingArea::ResumePainting(), m_pageID);
620 void WebPageProxy::suspendJavaScriptAndResource()
625 process()->send(Messages::WebPage::SuspendJavaScriptAndResources(), m_pageID);
628 void WebPageProxy::resumeJavaScriptAndResource()
633 process()->send(Messages::WebPage::ResumeJavaScriptAndResources(), m_pageID);
636 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
637 void WebPageProxy::suspendPlugin()
642 process()->send(Messages::WebPage::SuspendPlugin(), m_pageID);
645 void WebPageProxy::resumePlugin()
650 process()->send(Messages::WebPage::ResumePlugin(), m_pageID);
654 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
655 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
660 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
661 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableLayerFocused())
662 return drawingArea()->layerTreeCoordinatorProxy()->setOffsetForFocusedScrollingContentsLayer(offset);
664 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableNodeFocused()) {
665 bool scrolled = false;
666 process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
673 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point, bool checkOverflowLayer, WebLayerID& webLayerID)
678 bool pressed = false;
679 process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point, checkOverflowLayer), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed, webLayerID), m_pageID);
684 void WebPageProxy::setOverflowResult(bool pressed, uint32_t webLayerID)
686 static_cast<PageClientImpl*>(m_pageClient)->setOverflowResult(pressed, webLayerID);
690 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
695 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
696 if (commandName == ignoreSpellingCommandName)
697 ++m_pendingLearnOrIgnoreWordMessageCount;
699 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
702 void WebPageProxy::replyJavaScriptAlert()
707 m_alertReply->send();
708 m_alertReply = nullptr;
709 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
710 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
714 void WebPageProxy::replyJavaScriptConfirm(bool result)
719 m_confirmReply->send(result);
720 m_confirmReply = nullptr;
721 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
722 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
726 void WebPageProxy::replyJavaScriptPrompt(const String& result)
731 m_promptReply->send(result);
732 m_promptReply = nullptr;
733 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
734 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
738 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
739 void WebPageProxy::replyBeforeUnloadConfirmPanel(bool result)
741 if (!m_beforeUnloadConfirmPanelReply)
744 m_beforeUnloadConfirmPanelReply->send(result);
745 m_beforeUnloadConfirmPanelReply = nullptr;
746 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
747 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
752 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
753 void WebPageProxy::replyPolicyForCertificateError(bool result)
758 m_allowedReply->send(result);
759 m_allowedReply = nullptr;
763 #if PLUGIN_ARCHITECTURE(X11)
764 void WebPageProxy::createPluginContainer(uint64_t& windowID)
769 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
775 void WebPageProxy::didRenderFrame()
777 static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
780 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
782 static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
785 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
786 bool WebPageProxy::makeContextCurrent()
788 return static_cast<PageClientImpl*>(m_pageClient)->makeContextCurrent();
792 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
793 void WebPageProxy::getTextStyleStateForSelection()
795 process()->send(Messages::WebPage::GetTextStyleStateForSelection(), m_pageID, 0);
798 void WebPageProxy::didGetTextStyleStateForSelection(int underlineState, int italicState, int boldState)
800 static_cast<PageClientImpl*>(m_pageClient)->didGetTextStyleStateForSelection(underlineState, italicState, boldState);
804 #if ENABLE(TIZEN_ICON_DATABASE)
805 void WebPageProxy::didReceiveIcon()
807 static_cast<PageClientImpl*>(m_pageClient)->didReceiveIcon();
811 #if ENABLE(TIZEN_MULTIPLE_SELECT)
812 void WebPageProxy::valueChangedForPopupMenuMultiple(WebPopupMenuProxy*, Vector<int32_t> newSelectedIndex)
814 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenuMultiple(newSelectedIndex), m_pageID);
818 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
819 void WebPageProxy::pageDidRequestRestoreVisibleContentRect(const IntPoint& point, float scale)
821 m_pageClient->pageDidRequestRestoreVisibleContentRect(point, scale);
825 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
826 void WebPageProxy::saveSerializedHTMLDataForMainPage(const String& serializedData, const String& fileName)
828 static_cast<PageClientImpl*>(m_pageClient)->saveSerializedHTMLDataForMainPage(serializedData, fileName);
831 void WebPageProxy::saveSubresourcesData(Vector<WebSubresourceTizen> subresourceData)
833 static_cast<PageClientImpl*>(m_pageClient)->saveSubresourcesData(subresourceData);
836 void WebPageProxy::startOfflinePageSave(String subresourceFolderName)
841 process()->send(Messages::WebPage::StartOfflinePageSave(subresourceFolderName), m_pageID);
845 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
846 bool WebPageProxy::selectClosestWord(const IntPoint& point, bool isStartedTextSelectionFromOutside)
852 process()->sendSync(Messages::WebPage::SelectClosestWord(point, isStartedTextSelectionFromOutside), Messages::WebPage::SelectClosestWord::Reply(result), m_pageID);
856 bool WebPageProxy::setLeftSelection(const IntPoint& point)
862 process()->sendSync(Messages::WebPage::SetLeftSelection(point), Messages::WebPage::SetLeftSelection::Reply(result), m_pageID);
866 bool WebPageProxy::setRightSelection(const IntPoint& point)
872 process()->sendSync(Messages::WebPage::SetRightSelection(point), Messages::WebPage::SetRightSelection::Reply(result), m_pageID);
876 bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
882 process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect), m_pageID);
883 if (!leftRect.size().isZero() || !rightRect.size().isZero())
889 String WebPageProxy::getSelectionText()
895 process()->sendSync(Messages::WebPage::GetSelectionText(), Messages::WebPage::GetSelectionText::Reply(ret), m_pageID);
899 bool WebPageProxy::selectionRangeClear()
905 process()->sendSync(Messages::WebPage::SelectionRangeClear(), Messages::WebPage::SelectionRangeClear::Reply(result), m_pageID);
909 bool WebPageProxy::scrollContentByCharacter(const IntPoint& point, SelectionDirection direction)
915 process()->sendSync(Messages::WebPage::ScrollContentByCharacter(point, direction), Messages::WebPage::ScrollContentByCharacter::Reply(result), m_pageID);
920 #if ENABLE(TIZEN_LINK_MAGNIFIER)
921 void WebPageProxy::getLinkMagnifierRect(const WebCore::IntPoint& position, const WebCore::IntSize& size)
923 process()->send(Messages::WebPage::GetLinkMagnifierRect(position, size), m_pageID);
926 void WebPageProxy::didGetLinkMagnifierRect(const IntPoint& position, const IntRect& rect)
929 LinkMagnifierProxy::linkMagnifier().show(EwkViewImpl::fromEvasObject(viewWidget()), position, rect);
934 void WebPageProxy::openLink(const IntPoint& position)
936 #if ENABLE(GESTURE_EVENTS)
937 IntPoint globalPosition(EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position));
938 WebGestureEvent gesture(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get());
939 handleGestureEvent(gesture);
944 #if ENABLE(TIZEN_SCREEN_READER)
945 void WebPageProxy::raiseTapEvent(const IntPoint& position)
947 #if ENABLE(GESTURE_EVENTS)
948 IntPoint globalPosition = EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position);
949 process()->send(Messages::WebPage::RaiseTapEvent(position, globalPosition), m_pageID);
951 UNUSED_PARAM(position);
955 bool WebPageProxy::moveScreenReaderFocus(bool forward)
958 process()->sendSync(Messages::WebPage::MoveScreenReaderFocus(forward), Messages::WebPage::MoveScreenReaderFocus::Reply(result), m_pageID);
962 void WebPageProxy::moveScreenReaderFocusByPoint(const IntPoint& point)
964 process()->send(Messages::WebPage::MoveScreenReaderFocusByPoint(point), m_pageID);
967 void WebPageProxy::recalcScreenReaderFocusRect()
969 if (!ScreenReaderProxy::screenReader().isEnabled())
972 process()->send(Messages::WebPage::RecalcScreenReaderFocusRect(), m_pageID);
975 void WebPageProxy::clearScreenReader()
977 process()->send(Messages::WebPage::ClearScreenReader(), m_pageID);
980 void WebPageProxy::didScreenReaderFocusRectChanged(const IntRect& rect)
982 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
983 FocusRing* focusRing = ewkViewGetFocusRing(viewWidget());
988 focusRing->show(rect);
990 focusRing->hide(false);
996 void WebPageProxy::didScreenReaderTextChanged(const String& text)
998 ScreenReaderProxy::screenReader().setText(text);
1002 #if ENABLE(TIZEN_CSP)
1003 void WebPageProxy::setContentSecurityPolicy(const String& policy, WebCore::ContentSecurityPolicy::HeaderType type)
1005 process()->send(Messages::WebPage::SetContentSecurityPolicy(policy, type), m_pageID);
1009 #if ENABLE(TIZEN_APPLICATION_CACHE)
1010 void WebPageProxy::requestApplicationCachePermission(uint64_t frameID, const String& originIdentifier, PassRefPtr<Messages::WebPageProxy::RequestApplicationCachePermission::DelayedReply> allow)
1012 WebFrameProxy* frame = process()->webFrame(frameID);
1013 MESSAGE_CHECK(frame);
1015 // Since requestApplicationCachePermission() can spin a nested run loop we need to turn off the responsiveness timer.
1016 process()->responsivenessTimer()->stop();
1018 m_applicationCacheReply = allow;
1019 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1020 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1022 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1024 if (!m_tizenClient.decidePolicyForApplicationCachePermissionRequest(this, origin.get(), frame))
1025 replyApplicationCachePermission(true);
1028 void WebPageProxy::replyApplicationCachePermission(bool allow)
1030 if (!m_applicationCacheReply)
1033 m_applicationCacheReply->send(allow);
1034 m_applicationCacheReply = nullptr;
1035 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1036 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1041 #if ENABLE(TIZEN_INDEXED_DATABASE)
1042 void WebPageProxy::exceededIndexedDatabaseQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededIndexedDatabaseQuota::DelayedReply> reply)
1044 WebFrameProxy* frame = process()->webFrame(frameID);
1045 MESSAGE_CHECK(frame);
1047 // Since exceededIndexedDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1048 process()->responsivenessTimer()->stop();
1050 m_exceededIndexedDatabaseQuotaReply = reply;
1051 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1052 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1055 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1057 if (!m_tizenClient.exceededIndexedDatabaseQuota(this, origin.get(), currentUsage, frame))
1058 replyExceededIndexedDatabaseQuota(false);
1061 void WebPageProxy::replyExceededIndexedDatabaseQuota(bool allow)
1063 if (!m_exceededIndexedDatabaseQuotaReply)
1066 m_exceededIndexedDatabaseQuotaReply->send(allow);
1067 m_exceededIndexedDatabaseQuotaReply = nullptr;
1068 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1069 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1074 #if ENABLE(TIZEN_SQL_DATABASE)
1075 void WebPageProxy::replyExceededDatabaseQuota(bool allow)
1077 if (!m_exceededDatabaseQuotaReply) {
1078 TIZEN_LOGE("m_exceededDatabaseQuotaReply does not exist");
1082 m_exceededDatabaseQuotaReply->send(allow);
1083 m_exceededDatabaseQuotaReply = nullptr;
1084 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1085 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1090 #if ENABLE(TIZEN_FILE_SYSTEM)
1091 void WebPageProxy::exceededLocalFileSystemQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededLocalFileSystemQuota::DelayedReply> reply)
1093 WebFrameProxy* frame = process()->webFrame(frameID);
1094 MESSAGE_CHECK(frame);
1096 // Since exceededLocalFileSystemQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1097 process()->responsivenessTimer()->stop();
1098 m_exceededLocalFileSystemQuotaReply = reply;
1099 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1100 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1103 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1105 if (!m_tizenClient.exceededLocalFileSystemQuota(this, origin.get(), currentUsage, frame))
1106 replyExceededLocalFileSystemQuota(false);
1109 void WebPageProxy::replyExceededLocalFileSystemQuota(bool allow)
1111 if (!m_exceededLocalFileSystemQuotaReply)
1114 m_exceededLocalFileSystemQuotaReply->send(allow);
1115 m_exceededLocalFileSystemQuotaReply = nullptr;
1116 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1117 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1122 #endif // #if OS(TIZEN)
1124 void WebPageProxy::handleInputMethodKeydown(bool& handled)
1126 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1127 handled = m_keyEventQueue.first().forwardedEvent.isFiltered();
1129 handled = m_keyEventQueue.first().isFiltered();
1133 void WebPageProxy::confirmComposition(const String& compositionString)
1138 #if ENABLE(TIZEN_ISF_PORT)
1139 if (m_didCancelCompositionFromWebProcess)
1143 process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID, 0);
1146 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
1151 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
1152 // Suspend layout&paint at the key input, and resume layout&paint after 150 ms.
1153 suspendActiveDOMObjectsAndAnimations();
1154 if (m_pageContentResumeTimer)
1155 ecore_timer_del(m_pageContentResumeTimer);
1156 m_pageContentResumeTimer = ecore_timer_add(150.0/1000.0, pageContentResumeTimerFired, this);
1159 process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID, 0);
1162 void WebPageProxy::cancelComposition()
1167 process()->send(Messages::WebPage::CancelComposition(), m_pageID, 0);
1170 } // namespace WebKit