[WK2] Change how to check the state of keypad
[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 #if ENABLE(TIZEN_READER)
50 #include "MutableDictionary.h"
51 #endif
52
53 using namespace WebCore;
54 #endif
55
56 namespace WebKit {
57
58 Evas_Object* WebPageProxy::viewWidget()
59 {
60     return static_cast<PageClientImpl*>(m_pageClient)->viewWidget();
61 }
62
63 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
64 {
65     WTF::String platform;
66     WTF::String version;
67     WTF::String osVersion;
68
69 #if PLATFORM(X11)
70     platform = "X11";
71 #else
72     platform = "Unknown";
73 #endif
74     version = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.',
75                          String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
76     struct utsname name;
77     if (uname(&name) != -1)
78         osVersion = WTF::String(name.sysname) + " " + WTF::String(name.machine);
79     else
80         osVersion = "Unknown";
81
82     if (applicationNameForUserAgent.isEmpty())
83         return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
84                " (KHTML, like Gecko) Version/5.0 Safari/", version);
85
86     return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
87            " (KHTML, like Gecko) Version/5.0 Safari/", version, applicationNameForUserAgent);
88 }
89
90 void WebPageProxy::getEditorCommandsForKeyEvent(Vector<WTF::String>& commandsList)
91 {
92     notImplemented();
93 }
94
95 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
96 {
97     notImplemented();
98 }
99
100 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
101 {
102     notImplemented();
103 }
104
105 #if ENABLE(TIZEN_CUSTOM_HEADERS)
106 void WebPageProxy::addCustomHeader(const String& name, const String& value)
107 {
108     if (name.isEmpty())
109         return;
110
111     if (value.isEmpty())
112         return;
113
114     if (!isValid())
115         return;
116     process()->send(Messages::WebPage::AddCustomHeader(name, value), m_pageID);
117
118 }
119 #endif
120
121 #if OS(TIZEN)
122 bool WebPageProxy::scrollMainFrameBy(const IntSize& scrollOffset)
123 {
124 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
125     return static_cast<PageClientImpl*>(m_pageClient)->scrollBy(scrollOffset);
126 #else
127     if (!isValid())
128         return false;
129
130     process()->send(Messages::WebPage::ScrollMainFrameBy(scrollOffset), m_pageID);
131     return true;
132 #endif
133 }
134
135 void WebPageProxy::scrollMainFrameTo(const IntPoint& scrollPosition)
136 {
137 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
138     static_cast<PageClientImpl*>(m_pageClient)->scrollTo(scrollPosition);
139 #else
140     if (!isValid())
141         return;
142
143     process()->send(Messages::WebPage::ScrollMainFrameTo(scrollPosition), m_pageID);
144 #endif
145 }
146
147 void WebPageProxy::didChangeScrollPositionForMainFrame(const IntPoint& scrollPosition)
148 {
149 #if !ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
150     m_scrollPosition = scrollPosition;
151 #endif
152 }
153
154 void WebPageProxy::didChangeContentsSize(const IntSize& size)
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
244 void WebPageProxy::handleInputMethodForFocusedNode()
245 {
246     if (!isValid())
247         return;
248
249     process()->send(Messages::WebPage::HandleInputMethodForFocusedNode(), m_pageID);
250 }
251 #endif
252
253 void WebPageProxy::requestUpdateFormNavigation()
254 {
255     if (!isValid())
256         return;
257
258     process()->send(Messages::WebPage::RequestUpdateFormNavigation(), m_pageID);
259 }
260
261 void WebPageProxy::moveFocus(int newIndex)
262 {
263     if (!isValid())
264         return;
265
266     process()->send(Messages::WebPage::MoveFocus(newIndex), m_pageID);
267 }
268
269 void WebPageProxy::updateFormNavigation(int length, int offset)
270 {
271     static_cast<PageClientImpl*>(m_pageClient)->updateFormNavigation(length, offset);
272 }
273
274 void WebPageProxy::handleInputMethodKeydown(bool& handled)
275 {
276     static_cast<PageClientImpl*>(m_pageClient)->handleInputMethodKeydown();
277
278 #if ENABLE(TIZEN_ISF_PORT)
279     NativeWebKeyboardEvent event = m_keyEventQueue.first();
280     handled = event.isFiltered();
281 #endif
282 }
283
284 void WebPageProxy::confirmComposition(const String& compositionString)
285 {
286     if (!isValid())
287         return;
288
289     process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID);
290 }
291
292 void WebPageProxy::setComposition(const String& compositionString, Vector<CompositionUnderline>& underlines, int cursorPosition)
293 {
294     if (!isValid())
295         return;
296
297     process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID);
298 }
299 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
300 void WebPageProxy::setCaretPosition(const WebCore::IntPoint& pos)
301 {
302     if (!isValid())
303         return;
304
305     process()->send(Messages::WebPage::SetCaretPosition(pos), m_pageID);
306 }
307
308 void WebPageProxy::getCaretPosition(WebCore::IntRect& rect)
309 {
310     if (!isValid())
311         return;
312
313     process()->sendSync(Messages::WebPage::GetCaretPosition(), Messages::WebPage::GetCaretPosition::Reply(rect), m_pageID);
314 }
315 #endif
316 #if ENABLE(TIZEN_MM_PLAYER)
317 void WebPageProxy::processHTML5Video(const String& url, const String& cookie)
318 {
319     m_tizenClient.processHTML5Video(this, url, cookie);
320 }
321 #endif
322
323 #if ENABLE(TIZEN_PLUGIN_CUSTOM_REQUEST)
324 void WebPageProxy::processPluginCustomRequest(const String& request, const String& msg)
325 {
326     if (String("requestKeyboard,plugin") == request) {
327         bool active = false;
328         if (String("show") == msg)
329             active = true;
330 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
331         AtomicString inputType;
332         WTF::String inputValue;
333         setInputMethodState(active, inputType,inputValue);
334 #else
335         setInputMethodState(active);
336 #endif
337         // plugin does not use preedit.
338         if (active && static_cast<PageClientImpl*>(m_pageClient)->getIMFContext())
339             ecore_imf_context_prediction_allow_set(static_cast<PageClientImpl*>(m_pageClient)->getIMFContext(), false);
340     }
341 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
342     else if (String("requestToNative,json") == request)
343         m_tizenClient.processJSBridgePlugin(this, request, msg);
344 #endif
345 }
346 #endif
347
348
349 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
350 void WebPageProxy::setFocusedInputElementValue(const String& inputValue)
351 {
352     if (!isValid())
353         return;
354
355     process()->send(Messages::WebPage::SetFocusedInputElementValue(inputValue), m_pageID);
356 }
357
358 String WebPageProxy::getFocusedInputElementValue()
359 {
360     if (!isValid())
361         return String();
362
363     String inputValue;
364     process()->sendSync(Messages::WebPage::GetFocusedInputElementValue(), Messages::WebPage::GetFocusedInputElementValue::Reply(inputValue), m_pageID);
365     return inputValue;
366 }
367 #endif
368
369 void WebPageProxy::focusedNodeChanged(const IntRect& focusedNodeRect)
370 {
371     static_cast<PageClientImpl*>(m_pageClient)->setFocusedNodeRect(focusedNodeRect);
372 }
373
374 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
375 void WebPageProxy::updateScrollbar(const IntPoint& scrollPosition)
376 {
377     static_cast<PageClientImpl*>(m_pageClient)->updateScrollbar(scrollPosition);
378 }
379 #endif
380
381 #if ENABLE(TIZEN_READER)
382 void WebPageProxy::checkPageForReader(PassRefPtr<DictionaryCallback> prpCallback)
383 {
384     RefPtr<DictionaryCallback> callback = prpCallback;
385     if (!isValid()) {
386         callback->invalidate();
387         return;
388     }
389
390     uint64_t callbackID = callback->callbackID();
391     m_dictionaryCallbacks.set(callbackID, callback.get());
392     process()->send(Messages::WebPage::CheckPageForReader(callbackID), m_pageID);
393 }
394
395 void WebPageProxy::showReaderForArticle(const String& readerUrl, const String& readerHtml, uint64_t callbackID)
396 {
397     RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
398     if (!callback)
399         return;
400
401     if (readerHtml.isEmpty()) {
402         callback->performCallbackWithReturnValue(0);
403         return;
404     }
405
406     RefPtr<MutableDictionary> readerData = MutableDictionary::create();
407     readerData->set("url", RefPtr<WebString>(WebString::create(readerUrl)).get());
408     readerData->set("html", RefPtr<WebString>(WebString::create(readerHtml)).get());
409     callback->performCallbackWithReturnValue(readerData.get());
410 }
411 #endif
412
413 void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client)
414 {
415     m_tizenClient.initialize(client);
416 }
417
418 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
419 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode)
420 {
421     WebHitTestResult::Data hitTestResultData;
422     if (!isValid())
423         return hitTestResultData;
424
425     process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode),
426                         Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
427
428     return hitTestResultData;
429 }
430 #endif
431
432 #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
433 void WebPageProxy::getRssItems(PassRefPtr<RssCallback> prpCallback)
434 {
435     RefPtr<RssCallback> callback = prpCallback;
436     if (!isValid()) {
437         callback->invalidate();
438         return;
439     }
440
441     uint64_t callbackID = callback->callbackID();
442     m_rssCallbacks.set(callbackID, callback.get());
443     process()->send(Messages::WebPage::GetRssItems(callbackID), m_pageID);
444 }
445
446 void WebPageProxy::getRssItemsCallback(const Vector<WebKit::RssItemEfl>& rssItems, uint64_t callbackID)
447 {
448     RefPtr<RssCallback> callback = m_rssCallbacks.take(callbackID);
449     if (!callback) {
450         // FIXME: Log error or assert.
451         return;
452     }
453
454     // Convert Vector<WebKit::RssItemEfl> to Eina_List which has WKRssItemEfl.
455     Eina_List* retList = 0;
456     for (size_t i = 0; i < rssItems.size(); ++i)
457     {
458         WKRssItemEfl* rssItem = static_cast<WKRssItemEfl*>(malloc(sizeof(WKRssItemEfl)));
459         rssItem->type = static_cast<LinkTypeEfl>(rssItems[i].type());
460         if (!rssItems[i].href().isEmpty())
461             rssItem->href = strdup(rssItems[i].href().utf8().data());
462         else
463             rssItem->href = 0;
464         if (!rssItems[i].title().isEmpty())
465             rssItem->title = strdup(rssItems[i].title().utf8().data());
466         else
467             rssItem->title = 0;
468         retList = eina_list_append(retList, rssItem);
469     }
470
471     callback->performCallbackWithReturnValue(retList);
472
473     // Free retList.
474     void* data;
475     EINA_LIST_FREE(retList, data) {
476         if (data) {
477             WKRssItemEfl* rssItem = static_cast<WKRssItemEfl*>(data);
478             if (rssItem->href)
479                 free(const_cast<char*>(rssItem->href));
480             if (rssItem->title)
481                 free(const_cast<char*>(rssItem->title));
482             free(rssItem);
483         }
484     }
485 }
486 #endif // #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
487
488 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
489 void WebPageProxy::recordingSurfaceSetEnableSet(bool enable)
490 {
491     if (!isValid())
492         return;
493
494     process()->send(Messages::WebPage::RecordingSurfaceSetEnableSet(enable), m_pageID, 0);
495 }
496 #endif
497
498 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
499 void WebPageProxy::hideContextMenu()
500 {
501     if (m_activeContextMenu)
502         m_activeContextMenu->hideContextMenu();
503 }
504
505 String WebPageProxy::contextMenuAbsoluteLinkURLString()
506 {
507     if (!m_activeContextMenu)
508         return String();
509
510     return m_activeContextMenuHitTestResultData.absoluteLinkURL;
511 }
512
513 String WebPageProxy::contextMenuAbsoluteImageURLString()
514 {
515     if (!m_activeContextMenu)
516         return String();
517
518     return m_activeContextMenuHitTestResultData.absoluteImageURL;
519 }
520 #endif
521
522 #if ENABLE(TIZEN_WEBKIT_PASTEBOARD)
523 void WebPageProxy::writeDataToClipboardWithType(const String& data, uint64_t type)
524 {
525     static_cast<PageClientImpl*>(m_pageClient)->writeDataToClipboardWithType(data, static_cast<Pasteboard::PasteboardDataType>(type));
526 }
527
528 void WebPageProxy::pasteWithClipboard()
529 {
530     static_cast<PageClientImpl*>(m_pageClient)->pasteWithClipboard();
531 }
532
533 void WebPageProxy::sendPasteMessageWithData(const String& data, Pasteboard::PasteboardDataType type)
534 {
535 #if ENABLE(CONTEXT_MENUS)
536     if (!isValid())
537         return;
538
539     process()->send(Messages::WebPage::SetDataToPasteboardWithType(data, static_cast<uint64_t>(type)), m_pageID);
540     WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
541     process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
542 #endif
543 }
544 #endif
545
546 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
547 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
548 {
549     if (!isValid())
550         return 0;
551
552     uint32_t assignedPort = 0;
553     process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
554     return assignedPort;
555 }
556
557 bool WebPageProxy::stopInspectorServer()
558 {
559     if (!isValid())
560         return false;
561
562     bool result = false;
563     process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
564     return result;
565 }
566 #endif
567
568 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
569 void WebPageProxy::createPagesToPDF(const IntSize& size, const String& fileName)
570 {
571     process()->send(Messages::WebPage::CreatePagesToPDF(size, fileName), m_pageID);
572 }
573 #endif
574
575 #if ENABLE(TIZEN_WEB_STORAGE)
576 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
577 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
578 {
579     RefPtr<WebStorageQuotaCallback> callback = prpCallback;
580     if (!isValid()) {
581         callback->invalidate();
582         return;
583     }
584
585     uint64_t callbackID = callback->callbackID();
586     m_quotaCallbacks.set(callbackID, callback.get());
587     process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
588 }
589
590 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
591 {
592     RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
593     if (!callback) {
594         // FIXME: Log error or assert.
595         // this can validly happen if a load invalidated the callback, though
596         return;
597     }
598
599     m_quotaCallbacks.remove(callbackID);
600
601     RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
602     callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
603 }
604 #endif
605
606 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
607 {
608     if (!isValid())
609         return;
610
611     process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
612 }
613 #endif
614
615 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
616 {
617 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
618     static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
619 #else
620     scalePage(scaleFactor, origin);
621 #endif
622 }
623
624 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin, bool adjustToBoundary)
625 {
626 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
627     static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin, adjustToBoundary);
628 #else
629     scalePage(scaleFactor, origin);
630 #endif
631 }
632
633 double WebPageProxy::scaleFactor()
634 {
635 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
636     return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
637 #else
638     return pageScaleFactor();
639 #endif
640 }
641
642 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
643 void WebPageProxy::sendOrientationChangeEvent(int orientation)
644 {
645     process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
646 }
647 #endif
648
649 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
650 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
651 {
652 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
653     return isValid() ? drawingArea()->layerTreeHostProxy()->setOffsetForFocusedScrollingContentsLayer(offset) : false;
654 #else
655     bool scrolled = false;
656     if (!isValid())
657         return scrolled;
658
659     process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
660
661     return scrolled;
662 #endif
663 }
664
665 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point)
666 {
667     bool pressed = false;
668     if (!isValid())
669         return pressed;
670
671     process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed), m_pageID);
672
673     return pressed;
674 }
675 #endif
676
677 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
678 {
679     if (!isValid())
680         return;
681
682     DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
683     if (commandName == ignoreSpellingCommandName)
684         ++m_pendingLearnOrIgnoreWordMessageCount;
685
686     process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
687 }
688
689 #if ENABLE(TIZEN_FIX_PLUGIN_DOWNLOAD)
690 bool WebPageProxy::arePluginsEnabled() const
691 {
692     bool enabled = false;
693
694     process()->sendSync(Messages::WebPage::ArePluginsEnabled(), Messages::WebPage::ArePluginsEnabled::Reply(enabled), m_pageID);
695
696     return enabled;
697 }
698 #endif // ENABLE(TIZEN_FIX_PLUGIN_DOWNLOAD)
699
700 void WebPageProxy::replyJavaScriptAlert()
701 {
702     if (!m_alertReply)
703         return;
704
705     m_alertReply->send();
706     m_alertReply = nullptr;
707 }
708
709 void WebPageProxy::replyJavaScriptConfirm(bool result)
710 {
711     if (!m_confirmReply)
712         return;
713
714     m_confirmReply->send(result);
715     m_confirmReply = nullptr;
716 }
717
718 void WebPageProxy::replyJavaScriptPrompt(const String& result)
719 {
720     if (!m_promptReply)
721         return;
722
723     m_promptReply->send(result);
724     m_promptReply = nullptr;
725 }
726
727 #if PLUGIN_ARCHITECTURE(X11)
728 void WebPageProxy::createPluginContainer(uint64_t& windowID)
729 {
730     notImplemented();
731 }
732
733 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
734 {
735     notImplemented();
736 }
737 #endif
738
739 #if ENABLE(TIZEN_WEBKIT2_THEME_SET)
740 void WebPageProxy::setThemePath(const String& themePath)
741 {
742     process()->send(Messages::WebPage::SetThemePath(themePath), m_pageID, 0);
743 }
744 #endif
745
746 void WebPageProxy::didRenderFrame()
747 {
748     static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
749 }
750
751 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
752 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
753 {
754     static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
755 }
756 #endif
757
758 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
759 void WebPageProxy::getTextStyleStateForSelection()
760 {
761     process()->send(Messages::WebPage::GetTextStyleStateForSelection(), m_pageID, 0);
762 }
763
764 void WebPageProxy::didGetTextStyleStateForSelection(int underlineState, int italicState, int boldState)
765 {
766     static_cast<PageClientImpl*>(m_pageClient)->didGetTextStyleStateForSelection(underlineState, italicState, boldState);
767 }
768 #endif
769
770 #endif // #if OS(TIZEN)
771
772 } // namespace WebKit