X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=Source%2FWebKit2%2FWebProcess%2FWebPage%2Fefl%2FWebPageEfl.cpp;h=785697b66a66c1c76356f47e56731ba5fdc5f12d;hb=6cfa0d1a8d21fcdb6851fdf7ff67ae713a416eb1;hp=f9ba8e82e02016c9f44c8ee540ce9fb032a519b1;hpb=ed1798cf2324cf2d189c2a2510101d40b4eea5d2;p=framework%2Fweb%2Fwebkit-efl.git diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp index f9ba8e8..785697b 100755 --- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp @@ -74,8 +74,8 @@ #include #endif -#if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR) -#include "WebInspectorServerEfl.h" +#if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR) +#include "WebInspectorServerTizen.h" #endif #if ENABLE(TIZEN_WEB_STORAGE) @@ -139,6 +139,10 @@ #include "WebEventConversion.h" #endif +#if ENABLE(TIZEN_SCREEN_READER) || ENABLE(TIZEN_FOCUS_UI) || ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) +#include +#endif + #if ENABLE(TIZEN_CSP) #include #endif @@ -146,6 +150,15 @@ #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE) #include "WebPageSerializerTizen.h" #endif + +#if ENABLE(TIZEN_USE_SETTINGS_FONT) +#include "fontconfig/fontconfig.h" +#include +#endif + +#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) +#include "visible_units.h" +#endif #endif // #if OS(TIZEN) using namespace WebCore; @@ -169,6 +182,9 @@ void WebPage::platformPreferencesDidChange(const WebPreferencesStore& store) #if ENABLE(TIZEN_LOAD_REMOTE_IMAGES) settings->setLoadRemoteImages(store.getBoolValueForKey(WebPreferencesKey::loadRemoteImagesKey())); #endif +#if ENABLE(TIZEN_LINK_EFFECT) + settings->setLinkEffectEnabled(store.getBoolValueForKey(WebPreferencesKey::linkEffectEnabledKey())); +#endif #if ENABLE(TIZEN_ISF_PORT) settings->setEnableDefaultKeypad(store.getBoolValueForKey(WebPreferencesKey::defaultKeypadEnabledKey())); #endif @@ -274,7 +290,18 @@ void WebPage::confirmComposition(const String& compositionString) if (!targetFrame) return; +#if ENABLE(TIZEN_ISF_PORT) + if (m_prepareKeyDownEvent) { + m_keyPressCommands.append(adoptPtr(new ConfirmCompositionKeyPressCommand(compositionString))); + return; + } +#endif + targetFrame->editor()->confirmComposition(compositionString); + +#if ENABLE(TIZEN_ISF_PORT) + m_page->editorClient()->respondToChangedSelection(targetFrame); +#endif } void WebPage::setComposition(const String& compositionString, const Vector& underlines, uint64_t cursorPosition) @@ -284,6 +311,14 @@ void WebPage::setComposition(const String& compositionString, const Vectoreditor()->hasComposition() && compositionString.isEmpty()) + return; + + if (m_prepareKeyDownEvent) { + m_keyPressCommands.append(adoptPtr(new SetCompositionKeyPressCommand(compositionString, underlines, cursorPosition))); + return; + } + if (targetFrame->selection()->rootEditableElement()) { HTMLTextFormControlElement* textFormControl = toTextFormControl(targetFrame->selection()->rootEditableElement()->shadowAncestorNode()); if (textFormControl && textFormControl->maxLength() >= 0) { @@ -312,6 +347,10 @@ void WebPage::setComposition(const String& compositionString, const Vectoreditor()->setComposition(compositionString, underlines, cursorPosition, 0); + +#if ENABLE(TIZEN_ISF_PORT) + m_page->editorClient()->respondToChangedSelection(targetFrame); +#endif } void WebPage::cancelComposition() @@ -552,6 +591,11 @@ bool WebPage::setCaretPosition(const IntPoint& pos) if (!node || !node->renderer()) return false; + Element* currentRootEditableElement = node->rootEditableElement(); + Element* newRootEditableElement = innerNode->rootEditableElement(); + if (currentRootEditableElement != newRootEditableElement) + return false; + IntRect rect = controller->caretRenderer()->absoluteBoundingBoxRect(true); // The below wirtten code is not correct way to implement. Presntly the is no @@ -637,6 +681,17 @@ void WebPage::didCancelComposition(Node* valueChangedNode) send(Messages::WebPageProxy::DidCancelComposition()); } +void WebPage::prepareKeyDownEvent() +{ + m_prepareKeyDownEvent = true; + m_keyPressCommands.clear(); +} + +void WebPage::swapKeyPressCommands(Vector >& commands) +{ + m_keyPressCommands.swap(commands); +} + void WebPage::getCursorOffset(int& offset) { offset = 0; @@ -692,6 +747,11 @@ void WebPage::deleteSurroundingText(int offset, int count) if (!frame || !frame->editor()->canEdit()) return; + if (m_prepareKeyDownEvent) { + m_keyPressCommands.append(adoptPtr(new DeleteTextKeyPressCommand(offset, count))); + return; + } + Position base(frame->selection()->base()); offset += base.offsetInContainerNode(); base.moveToOffset(offset); @@ -839,28 +899,82 @@ static IntRect getNodeRect(Node* node, Node* focusableNode, bool isImage) #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) +static bool isClickableOrFocusable(Node* focusableNode) +{ + + if (!focusableNode) + return false; + if (focusableNode->disabled()) + return false; + if (!focusableNode->inDocument()) + return false; + if (!focusableNode->renderer() || focusableNode->renderer()->style()->visibility() != VISIBLE) + return false; + if (focusableNode->isFocusable()) { + if (focusableNode->isLink() + || focusableNode->hasTagName(HTMLNames::inputTag) + || focusableNode->hasTagName(HTMLNames::selectTag) + || focusableNode->hasTagName(HTMLNames::buttonTag)) + return true; + } + if (focusableNode->supportsFocus() + || focusableNode->hasEventListeners(eventNames().clickEvent) + || focusableNode->hasEventListeners(eventNames().mousedownEvent) + || focusableNode->hasEventListeners(eventNames().mouseupEvent)) { + return true; + } + return false; +} + +#if ENABLE(TOUCH_ADJUSTMENT) +static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page, const IntPoint& point, const IntSize& area) +#else static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page) +#endif { Node* node = hitTestResult.innerNode(); +#if ENABLE(TOUCH_ADJUSTMENT) + Node* adjustedNode = 0; + IntPoint adustedPoint; + Frame* mainFrame = page->mainFrame(); + if (!isClickableOrFocusable(node)) + mainFrame->eventHandler()->bestClickableNodeForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), adustedPoint, adjustedNode); + + if (adjustedNode) + node = adjustedNode; +#endif + if (!node) + return IntRect(); + bool isFocusRingDrawable = false; Node* focusableNode = node; while (focusableNode) { RenderObject* renderer = focusableNode->renderer(); - if (renderer && renderer->isRoot()) + if (renderer && (renderer->isBody() || renderer->isRenderView() || renderer->isRoot())) break; - if (focusableNode->isFocusable()) { - if (focusableNode->isLink() - || focusableNode->hasTagName(HTMLNames::inputTag) - || focusableNode->hasTagName(HTMLNames::selectTag) - || focusableNode->hasTagName(HTMLNames::buttonTag)) - isFocusRingDrawable = true; + if (isClickableOrFocusable(focusableNode)) { + isFocusRingDrawable = true; break; } focusableNode = focusableNode->parentNode(); } + // Don't draw focus ring if child is focusable or has trigger + if (focusableNode && focusableNode->isContainerNode() && !focusableNode->isLink()) { + WebCore::Node *child = static_cast(focusableNode)->firstChild(); + while(child) { + if( child->supportsFocus() + || child->hasEventListeners(eventNames().clickEvent) + || child->hasEventListeners(eventNames().mousedownEvent) + || child->hasEventListeners(eventNames().mouseupEvent)) { + return IntRect(); + } + child = child->traverseNextNode(focusableNode); + } + } + if (!isFocusRingDrawable) { if (node->hasTagName(HTMLNames::imgTag)) return getNodeRect(node, node, !hitTestResult.absoluteImageURL().isEmpty()); @@ -872,7 +986,11 @@ static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page) } #endif +#if ENABLE(TOUCH_ADJUSTMENT) +void WebPage::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, const IntSize& area, WebHitTestResult::Data& hitTestResultData) +#else void WebPage::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, WebHitTestResult::Data& hitTestResultData) +#endif { Frame* frame = m_page->mainFrame(); FrameView* frameView = frame->view(); @@ -885,6 +1003,7 @@ void WebPage::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, WebHi hitTestResultData.absoluteMediaURL = hitTestResult.absoluteMediaURL().string(); hitTestResultData.linkLabel = hitTestResult.textContent(); hitTestResultData.linkTitle = hitTestResult.titleDisplayString(); + hitTestResultData.isContentEditable = hitTestResult.isContentEditable(); #if ENABLE(TIZEN_DRAG_SUPPORT) hitTestResultData.isDragSupport = hitTestResult.isDragSupport(); #endif @@ -908,7 +1027,19 @@ void WebPage::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, WebHi hitTestResultData.hitTestMode = hitTestMode; #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) +#if ENABLE(TOUCH_ADJUSTMENT) + hitTestResultData.focusedRect = getFocusedRect(hitTestResult, m_page.get(), point, area); +#else hitTestResultData.focusedRect = getFocusedRect(hitTestResult, m_page.get()); +#endif + + // Don't display FocusRect if the size is too big.. + IntRect framerect = frameView->visibleContentRect(true); + if (hitTestResultData.focusedRect.width() > (0.8 * framerect.width()) + && hitTestResultData.focusedRect.height() > (0.8 * framerect.height())) { + hitTestResultData.focusedRect = IntRect(); + } + if (hitTestResult.innerNode() && hitTestResult.innerNode()->renderer() && hitTestResult.innerNode()->renderer()->style()) { hitTestResultData.focusedColor = hitTestResult.innerNode()->renderer()->style()->tapHighlightColor(); if (!hitTestResultData.focusedColor.hasAlpha()) @@ -966,13 +1097,6 @@ void WebPage::setStorageQuotaBytes(uint32_t quota) } #endif -#if ENABLE(TIZEN_RECORDING_SURFACE_SET) -void WebPage::recordingSurfaceSetEnableSet(bool enable) -{ - m_recordingSurfaceSetSettings = enable; -} -#endif - #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD) void WebPage::setClipboardDataForPaste(const String& data, const String& type) { @@ -1011,6 +1135,26 @@ void WebPage::resumeJavaScriptAndResources() mainFrame->loader()->resumeAllLoaders(); } +void WebPage::suspendAnimations() +{ + Frame* mainFrame = m_page->mainFrame(); + if (!mainFrame) + return; + + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) + frame->animation()->suspendAnimationsForDocument(frame->document()); +} + +void WebPage::resumeAnimations() +{ + Frame* mainFrame = m_page->mainFrame(); + if (!mainFrame) + return; + + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) + frame->animation()->resumeAnimationsForDocument(frame->document()); +} + #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME) void WebPage::suspendAnimationController() { @@ -1041,19 +1185,19 @@ void WebPage::resumeAnimationController() } #endif -#if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR) +#if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR) void WebPage::startInspectorServer(uint32_t port, uint32_t& allocatedPort) { - bool ret = WebInspectorServerEfl::server()->startServer(port); + bool ret = WebInspectorServerTizen::server()->startServer(port); if (ret) - allocatedPort = WebInspectorServerEfl::server()->getServerPort(); + allocatedPort = WebInspectorServerTizen::server()->getServerPort(); else allocatedPort = 0; } void WebPage::stopInspectorServer(bool& result) { - result = WebInspectorServerEfl::server()->stopServer(); + result = WebInspectorServerTizen::server()->stopServer(); } #endif @@ -1136,19 +1280,6 @@ void WebPage::resumePlugin() } #endif -#if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION) -void WebPage::getTextStyleStateForSelection() -{ - Frame* frame = m_page->focusController()->focusedOrMainFrame(); - - int underlineState = frame->editor()->selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline"); - int italicState = frame->editor()->selectionHasStyle(CSSPropertyFontStyle, "italic"); - int boldState = frame->editor()->selectionHasStyle(CSSPropertyFontWeight, "bold"); - - send(Messages::WebPageProxy::DidGetTextStyleStateForSelection(underlineState, italicState, boldState)); -} -#endif - #if ENABLE(TIZEN_MULTIPLE_SELECT) void WebPage::didChangeSelectedIndexForActivePopupMenuMultiple(Vector newIndex) { @@ -1172,7 +1303,7 @@ void WebPage::startOfflinePageSave(String subresourceFolderName) #endif #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) -void WebPage::selectClosestWord(const IntPoint& point, bool isStartedTextSelectionFromOutside, bool& result) +void WebPage::selectClosestWord(const IntPoint& point, bool& result) { result = false; @@ -1191,9 +1322,7 @@ void WebPage::selectClosestWord(const IntPoint& point, bool isStartedTextSelecti focusedFrame = newFocusFrame; } -#if ENABLE(TIZEN_INPUT_TAG_EXTENSION) HTMLInputElement* inputElement = node->toInputElement(); -#endif if (hitTestResult.isContentEditable()) { #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) @@ -1216,14 +1345,25 @@ void WebPage::selectClosestWord(const IntPoint& point, bool isStartedTextSelecti #endif return; - if (!isStartedTextSelectionFromOutside) { - for (Node* node = hitTestResult.innerNonSharedNode(); node; node = node->parentNode()) { - if (node->isFocusable()) { - // Text selection shoud not be started when text of