Revert "Block UI events not to be sent to the WebProcess while js popup is displayed."
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / efl / WebPageProxyEfl.cpp
1 /*
2  * Copyright (C) 2011 Samsung Electronics
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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.
24  */
25
26 #include "config.h"
27 #include "WebPageProxy.h"
28
29 #include "NotImplemented.h"
30 #include "PageClientImpl.h"
31
32 #include <sys/utsname.h>
33
34 #if OS(TIZEN)
35 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
36 #include "LayerTreeHostProxy.h"
37 #endif
38 #include "NativeWebKeyboardEvent.h"
39 #include "WebImage.h"
40 #include "WebPageMessages.h"
41 #include "WebProcessProxy.h"
42 #include <WebCore/IntSize.h>
43 #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
44 #include "WKPageTizen.h"
45 #endif
46 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
47 #include "WebContextMenuProxy.h"
48 #endif
49
50 using namespace WebCore;
51 #endif
52
53 namespace WebKit {
54
55 Evas_Object* WebPageProxy::viewWidget()
56 {
57     return static_cast<PageClientImpl*>(m_pageClient)->viewWidget();
58 }
59
60 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
61 {
62     WTF::String platform;
63     WTF::String version;
64     WTF::String osVersion;
65
66 #if PLATFORM(X11)
67     platform = "X11";
68 #else
69     platform = "Unknown";
70 #endif
71     version = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.',
72                          String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
73     struct utsname name;
74     if (uname(&name) != -1)
75         osVersion = WTF::String(name.sysname) + " " + WTF::String(name.machine);
76     else
77         osVersion = "Unknown";
78
79     if (applicationNameForUserAgent.isEmpty())
80         return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
81                " (KHTML, like Gecko) Version/5.0 Safari/", version);
82
83     return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
84            " (KHTML, like Gecko) Version/5.0 Safari/", version, applicationNameForUserAgent);
85 }
86
87 void WebPageProxy::getEditorCommandsForKeyEvent(Vector<WTF::String>& commandsList)
88 {
89     notImplemented();
90 }
91
92 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
93 {
94     notImplemented();
95 }
96
97 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
98 {
99     notImplemented();
100 }
101
102 #if ENABLE(TIZEN_CUSTOM_HEADERS)
103 void WebPageProxy::addCustomHeader(const String& name, const String& value)
104 {
105     if (name.isEmpty())
106         return;
107
108     if (value.isEmpty())
109         return;
110
111     if (!isValid())
112         return;
113     process()->send(Messages::WebPage::AddCustomHeader(name, value), m_pageID);
114
115 }
116 #endif
117
118 #if OS(TIZEN)
119 bool WebPageProxy::scrollMainFrameBy(const IntSize& scrollOffset)
120 {
121 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
122     return static_cast<PageClientImpl*>(m_pageClient)->scrollBy(scrollOffset);
123 #else
124     if (!isValid())
125         return false;
126
127     process()->send(Messages::WebPage::ScrollMainFrameBy(scrollOffset), m_pageID);
128     return true;
129 #endif
130 }
131
132 void WebPageProxy::scrollMainFrameTo(const IntPoint& scrollPosition)
133 {
134 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
135     static_cast<PageClientImpl*>(m_pageClient)->scrollTo(scrollPosition);
136 #else
137     if (!isValid())
138         return;
139
140     process()->send(Messages::WebPage::ScrollMainFrameTo(scrollPosition), m_pageID);
141 #endif
142 }
143
144 void WebPageProxy::didChangeScrollPositionForMainFrame(const IntPoint& scrollPosition)
145 {
146 #if !ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
147     m_scrollPosition = scrollPosition;
148 #endif
149 }
150
151 void WebPageProxy::didChangeContentsSize(const IntSize& size)
152 {
153     if (m_contentsSize == size)
154         return;
155
156     m_contentsSize = size;
157     m_pageClient->didChangeContentsSize(size);
158 }
159
160 PassRefPtr<WebImage> WebPageProxy::createSnapshot(const IntRect& rect, float scaleFactor)
161 {
162     if (!isValid())
163         return 0;
164
165     ShareableBitmap::Handle snapshotHandle;
166     // Do not wait for more than a second (arbitrary) for the WebProcess to get the snapshot so
167     // that the UI Process is not permanently stuck waiting on a potentially crashing Web Process.
168     static const double createSnapshotSyncMessageTimeout = 1.0;
169 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
170     float baseScaleFactor = static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
171     scaleFactor = scaleFactor * baseScaleFactor;
172     IntPoint scrollPosition = static_cast<PageClientImpl*>(m_pageClient)->scrollPosition();
173     IntRect scaledRect = rect;
174     scaledRect.move(scrollPosition.x(), scrollPosition.y());
175     scaledRect.scale(1/baseScaleFactor);
176     process()->sendSync(Messages::WebPage::CreateSnapshot(scaledRect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
177 #else
178     process()->sendSync(Messages::WebPage::CreateSnapshot(rect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
179 #endif
180     if (snapshotHandle.isNull())
181         return 0;
182     return WebImage::create(ShareableBitmap::create(snapshotHandle));
183 }
184
185 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
186 void WebPageProxy::setInputMethodState(bool active, const AtomicString& inputType, const String& inputValue)
187 {
188     static_cast<PageClientImpl*>(m_pageClient)->setInputMethodState(active, inputType, inputValue);
189 }
190 #else
191 void WebPageProxy::setInputMethodState(bool active)
192 {
193     //FIXME : it should be contributable
194     static_cast<PageClientImpl*>(m_pageClient)->setInputMethodState(active);
195 }
196 #endif
197
198 #if ENABLE(TIZEN_ISF_PORT)
199 void WebPageProxy::handleInputMethodMouseRelease()
200 {
201     static_cast<PageClientImpl*>(m_pageClient)->handleInputMethodMouseRelease();
202 }
203
204 void WebPageProxy::updateCursorPosition()
205 {
206     static_cast<PageClientImpl*>(m_pageClient)->setCursorPosition();
207 }
208
209 int WebPageProxy::getCursorOffsetPosition()
210 {
211     if (!isValid())
212         return 0;
213
214     int offset = 0;
215     process()->sendSync(Messages::WebPage::GetCursorOffsetPosition(), Messages::WebPage::GetCursorOffsetPosition::Reply(offset), m_pageID);
216     return offset;
217 }
218
219 String WebPageProxy::getContentOfPosition()
220 {
221     if (!isValid())
222         return String();
223
224     String content;
225     process()->sendSync(Messages::WebPage::GetContentOfPosition(), Messages::WebPage::GetContentOfPosition::Reply(content), m_pageID);
226     return content;
227 }
228
229 bool WebPageProxy::deleteSurroundingPosition()
230 {
231     if (!isValid())
232         return false;
233
234     bool result;
235     process()->sendSync(Messages::WebPage::DeleteSurroundingPosition(), Messages::WebPage::DeleteSurroundingPosition::Reply(result), m_pageID);
236     return result;
237 }
238
239 void WebPageProxy::getInputMethodState(bool& state)
240 {
241      state = static_cast<PageClientImpl*>(m_pageClient)->getInputMethodState();
242 }
243 #endif
244
245 void WebPageProxy::requestUpdateFormNavigation()
246 {
247     if (!isValid())
248         return;
249
250     process()->send(Messages::WebPage::RequestUpdateFormNavigation(), m_pageID);
251 }
252
253 void WebPageProxy::moveFocus(int newIndex)
254 {
255     if (!isValid())
256         return;
257
258     process()->send(Messages::WebPage::MoveFocus(newIndex), m_pageID);
259 }
260
261 void WebPageProxy::updateFormNavigation(int length, int offset)
262 {
263     static_cast<PageClientImpl*>(m_pageClient)->updateFormNavigation(length, offset);
264 }
265
266 void WebPageProxy::handleInputMethodKeydown(bool& handled)
267 {
268     static_cast<PageClientImpl*>(m_pageClient)->handleInputMethodKeydown();
269
270 #if ENABLE(TIZEN_ISF_PORT)
271     NativeWebKeyboardEvent event = m_keyEventQueue.first();
272     handled = event.isFiltered();
273 #endif
274 }
275
276 void WebPageProxy::confirmComposition(const String& compositionString)
277 {
278     if (!isValid())
279         return;
280
281     process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID);
282 }
283
284 void WebPageProxy::setComposition(const String& compositionString, Vector<CompositionUnderline>& underlines, int cursorPosition)
285 {
286     if (!isValid())
287         return;
288
289     process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID);
290 }
291 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
292 void WebPageProxy::setCaretPosition(const WebCore::IntPoint& pos)
293 {
294     if (!isValid())
295         return;
296
297     process()->send(Messages::WebPage::SetCaretPosition(pos), m_pageID);
298 }
299
300 void WebPageProxy::getCaretPosition(WebCore::IntRect& rect)
301 {
302     if (!isValid())
303         return;
304
305     process()->sendSync(Messages::WebPage::GetCaretPosition(), Messages::WebPage::GetCaretPosition::Reply(rect), m_pageID);
306 }
307 #endif
308 #if ENABLE(TIZEN_MM_PLAYER)
309 void WebPageProxy::processHTML5Video(const String& url, const String& cookie)
310 {
311     m_tizenClient.processHTML5Video(this, url, cookie);
312 }
313 #endif
314
315 #if ENABLE(TIZEN_PLUGIN_CUSTOM_REQUEST)
316 void WebPageProxy::processPluginCustomRequest(const String& request, const String& msg)
317 {
318     if (String("requestKeyboard,plugin") == request) {
319         bool active = false;
320         if (String("show") == msg)
321             active = true;
322 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
323         AtomicString inputType;
324         WTF::String inputValue;
325         setInputMethodState(active, inputType,inputValue);
326 #else
327         setInputMethodState(active);
328 #endif
329         // plugin does not use preedit.
330         if (active && static_cast<PageClientImpl*>(m_pageClient)->getIMFContext())
331             ecore_imf_context_prediction_allow_set(static_cast<PageClientImpl*>(m_pageClient)->getIMFContext(), false);
332     }
333 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
334     else if (String("requestToNative,json") == request)
335         m_tizenClient.processJSBridgePlugin(this, request, msg);
336 #endif
337 }
338 #endif
339
340
341 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
342 void WebPageProxy::setFocusedInputElementValue(const String& inputValue)
343 {
344     if (!isValid())
345         return;
346
347     process()->send(Messages::WebPage::SetFocusedInputElementValue(inputValue), m_pageID);
348 }
349
350 String WebPageProxy::getFocusedInputElementValue()
351 {
352     if (!isValid())
353         return String();
354
355     String inputValue;
356     process()->sendSync(Messages::WebPage::GetFocusedInputElementValue(), Messages::WebPage::GetFocusedInputElementValue::Reply(inputValue), m_pageID);
357     return inputValue;
358 }
359 #endif
360
361 #if ENABLE(TIZEN_DATALIST_ELEMENT)
362 Vector<String> WebPageProxy::getFocusedInputElementDataList()
363 {
364     if (!isValid())
365         return Vector<String>();
366
367     Vector<String> optionList;
368     process()->sendSync(Messages::WebPage::GetFocusedInputElementDataList(), Messages::WebPage::GetFocusedInputElementDataList::Reply(optionList), m_pageID);
369     return optionList;
370 }
371 #endif
372
373 void WebPageProxy::focusedNodeChanged(const IntRect& focusedNodeRect)
374 {
375     static_cast<PageClientImpl*>(m_pageClient)->setFocusedNodeRect(focusedNodeRect);
376 }
377
378 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
379 void WebPageProxy::updateScrollbar(const IntPoint& scrollPosition)
380 {
381     static_cast<PageClientImpl*>(m_pageClient)->updateScrollbar(scrollPosition);
382 }
383 #endif
384
385 void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client)
386 {
387     m_tizenClient.initialize(client);
388 }
389
390 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
391 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode)
392 {
393     WebHitTestResult::Data hitTestResultData;
394     if (!isValid())
395         return hitTestResultData;
396
397     process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode),
398                         Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
399
400     return hitTestResultData;
401 }
402 #endif
403
404 #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
405 void WebPageProxy::getRssItems(PassRefPtr<RssCallback> prpCallback)
406 {
407     RefPtr<RssCallback> callback = prpCallback;
408     if (!isValid()) {
409         callback->invalidate();
410         return;
411     }
412
413     uint64_t callbackID = callback->callbackID();
414     m_rssCallbacks.set(callbackID, callback.get());
415     process()->send(Messages::WebPage::GetRssItems(callbackID), m_pageID);
416 }
417
418 void WebPageProxy::getRssItemsCallback(const Vector<WebKit::RssItemEfl>& rssItems, uint64_t callbackID)
419 {
420     RefPtr<RssCallback> callback = m_rssCallbacks.take(callbackID);
421     if (!callback) {
422         // FIXME: Log error or assert.
423         return;
424     }
425
426     // Convert Vector<WebKit::RssItemEfl> to Eina_List which has WKRssItemEfl.
427     Eina_List* retList = 0;
428     for (size_t i = 0; i < rssItems.size(); ++i)
429     {
430         WKRssItemEfl* rssItem = static_cast<WKRssItemEfl*>(malloc(sizeof(WKRssItemEfl)));
431         rssItem->type = static_cast<LinkTypeEfl>(rssItems[i].type());
432         if (!rssItems[i].href().isEmpty())
433             rssItem->href = strdup(rssItems[i].href().utf8().data());
434         else
435             rssItem->href = 0;
436         if (!rssItems[i].title().isEmpty())
437             rssItem->title = strdup(rssItems[i].title().utf8().data());
438         else
439             rssItem->title = 0;
440         retList = eina_list_append(retList, rssItem);
441     }
442
443     callback->performCallbackWithReturnValue(retList);
444
445     // Free retList.
446     void* data;
447     EINA_LIST_FREE(retList, data) {
448         if (data) {
449             WKRssItemEfl* rssItem = static_cast<WKRssItemEfl*>(data);
450             if (rssItem->href)
451                 free(const_cast<char*>(rssItem->href));
452             if (rssItem->title)
453                 free(const_cast<char*>(rssItem->title));
454             free(rssItem);
455         }
456     }
457 }
458 #endif // #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
459
460 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
461 void WebPageProxy::recordingSurfaceSetEnableSet(bool enable)
462 {
463     if (!isValid())
464         return;
465
466     process()->send(Messages::WebPage::RecordingSurfaceSetEnableSet(enable), m_pageID, 0);
467 }
468 #endif
469
470 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
471 void WebPageProxy::hideContextMenu()
472 {
473     if (m_activeContextMenu)
474         m_activeContextMenu->hideContextMenu();
475 }
476
477 String WebPageProxy::contextMenuAbsoluteLinkURLString()
478 {
479     if (!m_activeContextMenu)
480         return String();
481
482     return m_activeContextMenuHitTestResultData.absoluteLinkURL;
483 }
484
485 String WebPageProxy::contextMenuAbsoluteImageURLString()
486 {
487     if (!m_activeContextMenu)
488         return String();
489
490     return m_activeContextMenuHitTestResultData.absoluteImageURL;
491 }
492 #endif
493
494 #if ENABLE(TIZEN_WEBKIT_PASTEBOARD)
495 void WebPageProxy::writeDataToClipboardWithType(const String& data, uint64_t type)
496 {
497     static_cast<PageClientImpl*>(m_pageClient)->writeDataToClipboardWithType(data, static_cast<Pasteboard::PasteboardDataType>(type));
498 }
499
500 void WebPageProxy::pasteWithClipboard()
501 {
502     static_cast<PageClientImpl*>(m_pageClient)->pasteWithClipboard();
503 }
504
505 void WebPageProxy::sendPasteMessageWithData(const String& data, Pasteboard::PasteboardDataType type)
506 {
507 #if ENABLE(CONTEXT_MENUS)
508     if (!isValid())
509         return;
510
511     process()->send(Messages::WebPage::SetDataToPasteboardWithType(data, static_cast<uint64_t>(type)), m_pageID);
512     WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
513     process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
514 #endif
515 }
516 #endif
517
518 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
519 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
520 {
521     if (!isValid())
522         return 0;
523
524     uint32_t assignedPort = 0;
525     process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
526     return assignedPort;
527 }
528
529 bool WebPageProxy::stopInspectorServer()
530 {
531     if (!isValid())
532         return false;
533
534     bool result = false;
535     process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
536     return result;
537 }
538 #endif
539
540 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
541 void WebPageProxy::createPagesToPDF(const IntSize& size, const String& fileName)
542 {
543     process()->send(Messages::WebPage::CreatePagesToPDF(size, fileName), m_pageID);
544 }
545 #endif
546
547 #if ENABLE(TIZEN_WEB_STORAGE)
548 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
549 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
550 {
551     RefPtr<WebStorageQuotaCallback> callback = prpCallback;
552     if (!isValid()) {
553         callback->invalidate();
554         return;
555     }
556
557     uint64_t callbackID = callback->callbackID();
558     m_quotaCallbacks.set(callbackID, callback.get());
559     process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
560 }
561
562 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
563 {
564     RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
565     if (!callback) {
566         // FIXME: Log error or assert.
567         // this can validly happen if a load invalidated the callback, though
568         return;
569     }
570
571     m_quotaCallbacks.remove(callbackID);
572
573     RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
574     callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
575 }
576 #endif
577
578 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
579 {
580     if (!isValid())
581         return;
582
583     process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
584 }
585 #endif
586
587 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
588 {
589 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
590     static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
591 #else
592     scalePage(scaleFactor, origin);
593 #endif
594 }
595
596 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin, bool adjustToBoundary)
597 {
598 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
599     static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin, adjustToBoundary);
600 #else
601     scalePage(scaleFactor, origin);
602 #endif
603 }
604
605 double WebPageProxy::scaleFactor()
606 {
607 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
608     return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
609 #else
610     return pageScaleFactor();
611 #endif
612 }
613
614 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
615 void WebPageProxy::sendOrientationChangeEvent(int orientation)
616 {
617     process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
618 }
619 #endif
620
621 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
622 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
623 {
624 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
625     return isValid() ? drawingArea()->layerTreeHostProxy()->setOffsetForFocusedScrollingContentsLayer(offset) : false;
626 #else
627     bool scrolled = false;
628     if (!isValid())
629         return scrolled;
630
631     process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
632
633     return scrolled;
634 #endif
635 }
636
637 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point)
638 {
639     bool pressed = false;
640     if (!isValid())
641         return pressed;
642
643     process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed), m_pageID);
644
645     return pressed;
646 }
647 #endif
648
649 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
650 {
651     if (!isValid())
652         return;
653
654     DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
655     if (commandName == ignoreSpellingCommandName)
656         ++m_pendingLearnOrIgnoreWordMessageCount;
657
658     process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
659 }
660
661 #if ENABLE(TIZEN_FIX_PLUGIN_DOWNLOAD)
662 bool WebPageProxy::arePluginsEnabled() const
663 {
664     bool enabled = false;
665
666     process()->sendSync(Messages::WebPage::ArePluginsEnabled(), Messages::WebPage::ArePluginsEnabled::Reply(enabled), m_pageID);
667
668     return enabled;
669 }
670 #endif // ENABLE(TIZEN_FIX_PLUGIN_DOWNLOAD)
671
672 void WebPageProxy::replyJavaScriptAlert()
673 {
674     if (!m_alertReply)
675         return;
676
677     m_alertReply->send();
678     m_alertReply = nullptr;
679 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
680     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
681 #endif
682 }
683
684 void WebPageProxy::replyJavaScriptConfirm(bool result)
685 {
686     if (!m_confirmReply)
687         return;
688
689     m_confirmReply->send(result);
690     m_confirmReply = nullptr;
691 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
692     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
693 #endif
694 }
695
696 void WebPageProxy::replyJavaScriptPrompt(const String& result)
697 {
698     if (!m_promptReply)
699         return;
700
701     m_promptReply->send(result);
702     m_promptReply = nullptr;
703 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
704     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
705 #endif
706 }
707
708 #if PLUGIN_ARCHITECTURE(X11)
709 void WebPageProxy::createPluginContainer(uint64_t& windowID)
710 {
711     notImplemented();
712 }
713
714 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
715 {
716     notImplemented();
717 }
718 #endif
719
720 #if ENABLE(TIZEN_WEBKIT2_THEME_SET)
721 void WebPageProxy::setThemePath(const String& themePath)
722 {
723     process()->send(Messages::WebPage::SetThemePath(themePath), m_pageID, 0);
724 }
725 #endif
726
727 void WebPageProxy::didRenderFrame()
728 {
729     static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
730 }
731
732 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
733 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
734 {
735     static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
736 }
737 #endif
738
739 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
740 void WebPageProxy::getTextStyleStateForSelection()
741 {
742     process()->send(Messages::WebPage::GetTextStyleStateForSelection(), m_pageID, 0);
743 }
744
745 void WebPageProxy::didGetTextStyleStateForSelection(int underlineState, int italicState, int boldState)
746 {
747     static_cast<PageClientImpl*>(m_pageClient)->didGetTextStyleStateForSelection(underlineState, italicState, boldState);
748 }
749 #endif
750
751 #endif // #if OS(TIZEN)
752
753 } // namespace WebKit