+++ /dev/null
-/*
- Copyright (C) 2013 Samsung Electronics
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef ewk_hit_test_h
-#define ewk_hit_test_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Creates a type name for _Ewk_Hit_Test */
-typedef struct _Ewk_Hit_Test Ewk_Hit_Test;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // ewk_hit_test_h
#include <Eina.h>
#include "third_party/skia/include/core/SkBitmap.h"
-
-#include "public/ewk_hit_test.h"
#include "tizen_webview/public/tw_hit_test.h"
typedef std::map<std::string, std::string> NodeAttributesMap;
struct _Ewk_Hit_Test {
_Ewk_Hit_Test();
_Ewk_Hit_Test(const _Ewk_Hit_Test& other);
+ // TODO: check whether bitwise assignment is acceptable (e.g, attributeHash)
+ // If not, proper implementation for below should be added:
+ // _Ewk_Hit_Test& operator=(const _Ewk_Hit_Test&);
+ // Note: Currently the operation is used in EwebView::UpdateHitTestData().
tizen_webview::Hit_Test_Result_Context context;
std::string linkURI;
}
void RenderMessageFilterEfl::OnReceivedHitTestData(int render_view,
- const Ewk_Hit_Test& hit_test_data,
+ const _Ewk_Hit_Test& hit_test_data,
const NodeAttributesMap& node_attributes) {
- if (content::WebContents* web_contents = WebContentsFromViewID(render_process_id_, render_view)) {
+ content::WebContents* web_contents = WebContentsFromViewID(
+ render_process_id_, render_view);
+
+ if (web_contents) {
content::WebContentsDelegateEfl* delegate =
static_cast<content::WebContentsDelegateEfl*>(web_contents->GetDelegate());
delegate->web_view()->UpdateHitTestData(hit_test_data, node_attributes);
content::BrowserThread::ID*) OVERRIDE;
private:
- void OnDecideNavigationPolicy(NavigationPolicyParams, bool*);
- void OnReceivedHitTestData(int, const Ewk_Hit_Test&, const NodeAttributesMap&);
+ void OnDecideNavigationPolicy(NavigationPolicyParams, bool* handled);
+ void OnReceivedHitTestData(int view, const _Ewk_Hit_Test& hit_test_data,
+ const NodeAttributesMap& node_attributes);
int render_process_id_;
};
#TODO: making separate gyp for tizen_webview
'<(chrome_src_dir)/tizen_webview/public/tw_custom_handlers.h',
'<(chrome_src_dir)/tizen_webview/public/tw_custom_handlers.cc',
+ '<(chrome_src_dir)/tizen_webview/public/tw_hit_test.h',
+ '<(chrome_src_dir)/tizen_webview/public/tw_hit_test.cc',
'<(chrome_src_dir)/tizen_webview/public/tw_notification.cc',
'<(chrome_src_dir)/tizen_webview/public/tw_notification.h',
'<(chrome_src_dir)/tizen_webview/public/tw_security_origin.cc',
IPC_ENUM_TRAITS(tizen_webview::Hit_Test_Mode)
IPC_ENUM_TRAITS(tizen_webview::Hit_Test_Result_Context)
-IPC_STRUCT_TRAITS_BEGIN(Ewk_Hit_Test::Hit_Test_Node_Data)
+IPC_STRUCT_TRAITS_BEGIN(_Ewk_Hit_Test::Hit_Test_Node_Data)
IPC_STRUCT_TRAITS_MEMBER(tagName)
IPC_STRUCT_TRAITS_MEMBER(nodeValue)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(Ewk_Hit_Test::Hit_Test_Image_Buffer)
+IPC_STRUCT_TRAITS_BEGIN(_Ewk_Hit_Test::Hit_Test_Image_Buffer)
IPC_STRUCT_TRAITS_MEMBER(fileNameExtension)
IPC_STRUCT_TRAITS_MEMBER(imageBitmap)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(Ewk_Hit_Test)
+IPC_STRUCT_TRAITS_BEGIN(_Ewk_Hit_Test)
IPC_STRUCT_TRAITS_MEMBER(context)
IPC_STRUCT_TRAITS_MEMBER(linkURI)
IPC_STRUCT_TRAITS_MEMBER(linkLabel)
IPC_MESSAGE_CONTROL3(EwkViewHostMsg_HitTestReply,
int, /* render_view_id */
- Ewk_Hit_Test, /* Ewk Hit test data without node map */
+ _Ewk_Hit_Test, /* Ewk Hit test data without node map */
NodeAttributesMap /* node attributes */)
IPC_MESSAGE_ROUTED1(EwkViewMsg_GetMHTMLData,
#include "grit/webkit_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "devtools_delegate_efl.h"
+
+#include "tizen_webview/public/tw_hit_test.h"
#include "tizen_webview/public/tw_touch_point.h"
#include "tizen_webview/public/tw_web_context.h"
#ifdef OS_TIZEN
ClearSelection();
if (settings && settings->textSelectionEnabled()) {
- _Ewk_Hit_Test* hit_test_data = RequestHitTestDataAt(event->x(), event->y(), TW_HIT_TEST_MODE_DEFAULT);
+ tizen_webview::Hit_Test* hit_test = RequestHitTestDataAt(event->x(), event->y(), TW_HIT_TEST_MODE_DEFAULT);
+ _Ewk_Hit_Test* hit_test_data = hit_test->impl;
if (hit_test_data && hit_test_data->context & TW_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
selection_controller_->SetSelectionStatus(true);
selection_controller_->SetCaretSelectionStatus(true);
} else {
LOG(INFO) << __PRETTY_FUNCTION__ << ":: hit_test = " << hit_test_data->context;
}
- delete hit_test_data;
+ delete hit_test;
rwhv()->HandleGesture(event);
}
} else if ((event->details().type() == ui::ET_GESTURE_TAP) || (event->details().type() == ui::ET_GESTURE_SHOW_PRESS)) {
- _Ewk_Hit_Test* hit_test_data = RequestHitTestDataAt(event->x(), event->y(), TW_HIT_TEST_MODE_DEFAULT);
+ tizen_webview::Hit_Test* hit_test = RequestHitTestDataAt(event->x(), event->y(), TW_HIT_TEST_MODE_DEFAULT);
+ _Ewk_Hit_Test* hit_test_data = hit_test->impl;
LOG(INFO) << __PRETTY_FUNCTION__ << " hit_test = " << hit_test_data;
if (hit_test_data && hit_test_data->context & TW_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
LOG(INFO) << "DispatchPostponedGestureEvent :: TW_HIT_TEST_RESULT_CONTEXT_EDITABLE";
selection_controller_->SetSelectionEditable(false);
//ClearSelection();
}
- delete hit_test_data;
+ delete hit_test;
rwhv()->HandleGesture(event);
} else {
ClearSelection();
return retval;
}
-Ewk_Hit_Test* EWebView::RequestHitTestDataAt(int x, int y, tizen_webview::Hit_Test_Mode mode) {
+tizen_webview::Hit_Test* EWebView::RequestHitTestDataAt(int x, int y, tizen_webview::Hit_Test_Mode mode) {
RenderViewHost* render_view_host = web_contents_delegate()->web_contents()->GetRenderViewHost();
DCHECK(render_view_host);
base::ThreadRestrictions::ScopedAllowWait allow_wait;
hit_test_completion_.Wait();
}
- return new Ewk_Hit_Test(hit_test_data_);
+ return new tizen_webview::Hit_Test(hit_test_data_);
}
-void EWebView::UpdateHitTestData(const Ewk_Hit_Test& hit_test_data, const NodeAttributesMap& node_attributes) {
+void EWebView::UpdateHitTestData(const _Ewk_Hit_Test& hit_test_data, const NodeAttributesMap& node_attributes) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
hit_test_data_ = hit_test_data;
hit_test_data_.nodeData.PopulateNodeAtributes(node_attributes);
#include "API/ewk_settings_private.h"
#include "API/ewk_web_application_icon_data_private.h"
#include "eweb_view_callbacks.h"
-#include "public/ewk_hit_test.h"
#include "public/ewk_policy_decision.h"
#include "public/ewk_view.h"
#include "selection_controller_efl.h"
#include "browser/selectpicker/popup_picker.h"
#endif
-#include "tizen_webview/public/tw_hit_test.h"
-#include "tizen_webview/public/tw_touch_event.h"
#include "tizen_webview/public/tw_input_type.h"
#include "tizen_webview/public/tw_find_options.h"
+#include "tizen_webview/public/tw_touch_event.h"
namespace content {
class RenderViewHost;
namespace tizen_webview {
class WebContext;
+class Hit_Test;
}
class EwkViewPlainTextGetCallback {
NavigationPolicyParams params, bool* handled);
void UseSettingsFont();
- Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, tizen_webview::Hit_Test_Mode mode);
- void UpdateHitTestData(const Ewk_Hit_Test& hit_test_data, const NodeAttributesMap& node_attributes);
+ tizen_webview::Hit_Test* RequestHitTestDataAt(int x, int y, tizen_webview::Hit_Test_Mode mode);
+ void UpdateHitTestData(const _Ewk_Hit_Test& hit_test_data, const NodeAttributesMap& node_attributes);
int current_find_request_id() const { return current_find_request_id_; }
bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data);
gfx::Size contents_area_;
double progress_;
mutable std::string title_;
- Ewk_Hit_Test hit_test_data_;
+ _Ewk_Hit_Test hit_test_data_;
base::WaitableEvent hit_test_completion_;
IDMap<MHTMLCallbackDetails, IDMapOwnPointer> mhtml_callback_map_;
double page_scale_factor_;
return parsing_status;
}
-void PopulateEwkHitTestData(const blink::WebHitTestResult& web_hit_test, Ewk_Hit_Test* ewk_hit_test)
+void PopulateEwkHitTestData(const blink::WebHitTestResult& web_hit_test, _Ewk_Hit_Test* ewk_hit_test)
{
DCHECK(ewk_hit_test);
ewk_hit_test->imageURI = web_hit_test.absoluteImageURL().string().utf8();
--- /dev/null
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tw_hit_test.h"
+#include <algorithm>
+#include "API/ewk_hit_test_private.h"
+
+namespace tizen_webview {
+
+Hit_Test::Hit_Test()
+ : impl (new _Ewk_Hit_Test) {
+}
+
+Hit_Test::Hit_Test(const Hit_Test& other)
+ : impl (new _Ewk_Hit_Test(*other.impl)) {
+}
+
+Hit_Test::Hit_Test(const Hit_Test_Impl& impl_)
+ : impl (new _Ewk_Hit_Test(impl_)) {
+}
+
+Hit_Test::~Hit_Test() {
+ delete impl;
+}
+
+Hit_Test& Hit_Test::operator=(const Hit_Test& other) {
+ if (this != &other) {
+ Hit_Test temp (other);
+ Swap(temp);
+ }
+ return *this;
+}
+
+void Hit_Test::Swap(Hit_Test& other) {
+ std::swap(impl, other.impl);
+}
+
+tizen_webview::Hit_Test_Result_Context Hit_Test::GetResultContext() const {
+ return impl->context;
+}
+
+const char* Hit_Test::GetLinkUri() const {
+ return impl->linkURI.c_str();
+}
+
+const char* Hit_Test::GetLinkTitle() const {
+ return impl->linkTitle.c_str();
+}
+
+const char* Hit_Test::GetLinkLabel() const {
+ return impl->linkLabel.c_str();
+}
+
+const char* Hit_Test::GetImageUri() const {
+ return impl->imageURI.c_str();
+}
+
+const char* Hit_Test::GetImageFilenameExtension() const {
+ return impl->imageData.fileNameExtension.c_str();
+}
+
+int Hit_Test::GetImageWidth() const {
+ return impl->imageData.imageBitmap.width();
+}
+
+int Hit_Test::GetImageHeight() const {
+ return impl->imageData.imageBitmap.height();
+}
+
+void* Hit_Test::GetImageBuffer() const {
+ return impl->imageData.imageBitmap.getPixels();
+}
+
+size_t Hit_Test::GetImageBufferLength() const {
+ return impl->imageData.imageBitmap.getSize();
+}
+
+const char* Hit_Test::GetMediaUri() const {
+ return impl->mediaURI.c_str();
+}
+
+const char* Hit_Test::GetNodeTagName() const {
+ return impl->nodeData.tagName.c_str();
+}
+
+const char* Hit_Test::GetNodeValue() const {
+ return impl->nodeData.nodeValue.c_str();
+}
+
+Eina_Hash* Hit_Test::GetNodeAttributeHash() const {
+ return impl->nodeData.attributeHash;
+}
+
+} // namespace tizen_webview
#ifndef TIZEN_WEBVIEW_PUBLIC_TW_HIT_TEST_MODE_H_
#define TIZEN_WEBVIEW_PUBLIC_TW_HIT_TEST_MODE_H_
+#include <eina_hash.h>
+#include <cstddef> // Provides size_t
+
+struct _Ewk_Hit_Test;
+class EWebView;
+
namespace tizen_webview {
/**
TW_HIT_TEST_RESULT_CONTEXT_TEXT = 1 << 7
};
+
+class Hit_Test {
+ public:
+ Hit_Test();
+ Hit_Test(const Hit_Test& other);
+ ~Hit_Test();
+ Hit_Test& operator=(const Hit_Test& other);
+
+ Hit_Test_Result_Context GetResultContext() const;
+
+ const char* GetLinkUri() const;
+ const char* GetLinkTitle() const;
+ const char* GetLinkLabel() const;
+
+ const char* GetImageUri() const;
+ const char* GetImageFilenameExtension() const;
+ int GetImageWidth() const;
+ int GetImageHeight() const;
+ void* GetImageBuffer() const;
+ size_t GetImageBufferLength() const;
+
+ const char* GetMediaUri() const;
+
+ const char* GetNodeTagName() const;
+ const char* GetNodeValue() const;
+ Eina_Hash* GetNodeAttributeHash() const;
+
+ private:
+ typedef _Ewk_Hit_Test Hit_Test_Impl;
+ Hit_Test_Impl* impl;
+
+ // construct directly from the impl class;
+ explicit Hit_Test(const Hit_Test_Impl& impl_);
+
+ // utility function
+ void Swap(Hit_Test& other);
+
+ friend class ::EWebView;
+};
+
} // namespace tizen_webview
#endif // TIZEN_WEBVIEW_PUBLIC_TW_HIT_TEST_MODE_H_