#include <FSys_VibratorImpl.h>
#include <FUiAnim_EflNode.h>
#include <FUiAnim_VisualElement.h>
+#include <FUiAnim_VisualElementImpl.h>
#include <FUi_CoordinateSystemUtils.h>
#include <FUi_AccessibilityContainer.h>
#include <FUi_AccessibilityElement.h>
std::unique_ptr<_EflWebkit> pEflWebkit(new (std::nothrow) _EflWebkit());
SysTryReturnResult(NID_WEB_CTRL, pEflWebkit.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pEflWebkit->Construct(GetAbsoluteBounds(), *GetVisualElement(), this);
+ _VisualElement* pVe = GetVisualElement();
+ r = pEflWebkit->Construct(GetAbsoluteBounds(), *pVe, this);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ _VisualElementImpl* pVeImpl = _VisualElementImpl::GetInstance(*pVe);
+ pVeImpl->SetCaptureProvider(this);
+
__pEflWebkit = std::move(pEflWebkit);
Evas_Object* pView = GetWebNativeNode();
Canvas*
_Web::OnCanvasRequestedN(const FloatRectangle& bounds)
{
- result r = E_SUCCESS;
+ SysTryReturn(NID_WEB_CTRL, bounds.width >= 0.0f && bounds.height >= 0.0f, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Canvas size is out of range. size = (%f, %f)", bounds.width, bounds.height);
+ if (bounds.width == 0.0f || bounds.height == 0.0f)
+ {
+ FloatDimension size(GetSizeF());
+ SysTryReturn(NID_WEB_CTRL, bounds.x >= 0.0f && bounds.y >= 0.0f && bounds.x <= size.width && bounds.y <= size.height, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Bounds is out of range.");
+ }
- Evas_Object* pWebFrame = GetWebNativeNode();
- Eina_Rectangle rect;
- BufferInfo bufferInfo;
+ result r = E_SUCCESS;
- Point absPoint(_CoordinateSystemUtils::ConvertToInteger(GetAbsoluteCoordinate(FloatPoint(bounds.x, bounds.y))));
- Dimension absSize(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::HorizontalTransform(bounds.width)),
- _CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::VerticalTransform(bounds.height)));
+ Rectangle absBounds(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(bounds)));
- EINA_RECTANGLE_SET(&rect, absPoint.x, absPoint.y, absSize.width, absSize.height);
+ Eina_Rectangle rect;
+ EINA_RECTANGLE_SET(&rect, absBounds.x, absBounds.y, absBounds.width, absBounds.height);
+ Evas_Object* pWebFrame = GetWebNativeNode();
Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
std::unique_ptr<Canvas> pCanvas(new (std::nothrow) Canvas());
if (pScreenShot)
{
+ BufferInfo bufferInfo;
+
r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
evas_object_del(pScreenShot);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
{
result r = E_SUCCESS;
- Evas_Object* pWebFrame = GetWebNativeNode();
- Eina_Rectangle rect;
- ByteBuffer buffer;
BufferInfo bufferInfo;
+ SysTryReturn(NID_WEB_CTRL, OnCaptureAcquire(bufferInfo), null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
- Dimension size(GetSize());
- Point absSize(GetAbsoluteCoordinate(Point(size.width, size.height)));
-
- EINA_RECTANGLE_SET(&rect, 0, 0, absSize.x, absSize.y);
-
- Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
- SysTryReturn(NID_WEB_CTRL, pScreenShot, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
-
- r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
- evas_object_del(pScreenShot);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
-
+ ByteBuffer buffer;
int bufferSize = bufferInfo.bitsPerPixel * bufferInfo.width * bufferInfo.height;
+
r = buffer.Construct(reinterpret_cast < byte* >(bufferInfo.pPixels), 0, bufferSize, bufferSize);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
}
+bool
+_Web::OnCaptureAcquire(BufferInfo& output)
+{
+ result r = E_SUCCESS;
+
+ FloatPoint position(GetPositionF());
+ FloatDimension size(GetSizeF());
+
+ Dimension absSize(_CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(size)));
+
+ Eina_Rectangle rect;
+ EINA_RECTANGLE_SET(&rect, 0, 0, absSize.width, absSize.height);
+
+ Evas_Object* pWebFrame = GetWebNativeNode();
+ Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
+ SysTryReturn(NID_WEB_CTRL, pScreenShot, false, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
+
+ r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, output);
+ evas_object_del(pScreenShot);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] propagating", GetErrorMessage(r));
+
+ return true;
+}
+
+
void
_Web::DumpPointList(void* pData)
{
#include <FUi_ITouchLongPressGestureEventListener.h>
#include <FUi_ITouchPinchGestureEventListener.h>
#include <FUi_ITouchTapGestureEventListener.h>
+#include <FUiAnim_IVisualElementCaptureProvider.h>
namespace Tizen { namespace Ui
{
class _Web
: public Tizen::Ui::_Control
- , Tizen::Ui::_ITouchFlickGestureEventListener
- , Tizen::Ui::_ITouchLongPressGestureEventListener
- , Tizen::Ui::_ITouchPinchGestureEventListener
- , Tizen::Ui::_ITouchTapGestureEventListener
+ , public Tizen::Ui::_ITouchFlickGestureEventListener
+ , public Tizen::Ui::_ITouchLongPressGestureEventListener
+ , public Tizen::Ui::_ITouchPinchGestureEventListener
+ , public Tizen::Ui::_ITouchTapGestureEventListener
+ , public Tizen::Ui::Animations::_IVisualElementCaptureProvider
, virtual public Tizen::Base::Runtime::IEventListener
, virtual public Tizen::Ui::_IUiEventListener
, virtual public Tizen::Ui::_IUiEventPreviewer
virtual Tizen::Graphics::Canvas* OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& size);
virtual Tizen::Graphics::Bitmap* OnCapturedBitmapRequestedN(void);
+ virtual bool OnCaptureAcquire(Tizen::Graphics::BufferInfo& output);
+ virtual void OnCaptureReleased(void) {};
private:
_Web(const _Web& value);
void
+OnFullScreenEntered(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ SysLog(NID_WEB_CTRL, "Enter.");
+}
+
+
+void
+OnFullScreenExited(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ SysLog(NID_WEB_CTRL, "Exit.");
+}
+
+
+void
OnVibrationRequested(uint64_t duration, void* pUserData)
{
result r = E_SUCCESS;
ewk_view_orientation_send(pView, orientation);
OnWebPageBlockSelected(pUserData, pView, pEventInfo);
+
+ SysLog(NID_WEB_CTRL, "Enter.");
}
evas_object_smart_callback_add(pWebNativeNode, "text,selected", OnWebPageBlockSelected, this);
evas_object_smart_callback_add(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation, this);
+ evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
+ evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
+
ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
SysAssertf(pContext, "Failed to get webkit instance.");
evas_object_smart_callback_del(pWebNativeNode, "text,selected", OnWebPageBlockSelected);
evas_object_smart_callback_del(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation);
+ evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
+ evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
+
ewk_view_open_panel_callback_set(null, null, null);
Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
SysAssertf(pContext, "Failed to get webkit instance.");
}
+result
+_WebImpl::AddCustomHeader(const String& name, const String& value)
+{
+ SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
+
+ std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
+ SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(value));
+
+ ewk_view_custom_header_add(__pWebCore->GetWebNativeNode(), pName.get(), pValue.get());
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebImpl::RemoveCustomHeader(const String& name)
+{
+ SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
+
+ std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
+ SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ ewk_view_custom_header_remove(__pWebCore->GetWebNativeNode(), pName.get());
+
+ return E_SUCCESS;
+}
+
+
void
_WebImpl::SetLoadingErrorOccurred(bool arg)
{
SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
break;
}
+ default:
+ break;
}
CATCH:
return r;
__pScriptAlertConfirmPopup.release();
break;
}
+ default:
+ break;
}
return E_SUCCESS;
void Reload(void) const;
- result AddCustomHeader(const Tizen::Net::Http::HttpHeader& header);
-
- void RemoveAllCustomHeaders(void);
-
bool SearchText(const Tizen::Base::String& word, bool searchForward);
result SetSetting(const Tizen::Web::Controls::WebSetting& setting);
Tizen::Graphics::Dimension GetPageSize(void) const;
+ result AddCustomHeader(const Tizen::Base::String& name, const Tizen::Base::String& value);
+
+ result RemoveCustomHeader(const Tizen::Base::String& name);
+
virtual bool IsLayoutable(void) const;
void SetEventListenerCallback(void) const;