X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Finternal%2FWebView%2FWebView.cs;h=2c76833aeb132b649f7b2165c1018ce6a7530629;hb=364f8d163b78ec066b1e56a404860d07d8c83d81;hp=de7c33a38cd41826b076eb6cf102728c5c9914cf;hpb=dbdad33597dcc020f7c10a8ce90cbf2479564dd6;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/internal/WebView/WebView.cs b/src/Tizen.NUI/src/internal/WebView/WebView.cs index de7c33a..2c76833 100755 --- a/src/Tizen.NUI/src/internal/WebView/WebView.cs +++ b/src/Tizen.NUI/src/internal/WebView/WebView.cs @@ -30,7 +30,7 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public class WebView : View { - private Vector4 backgroundColor; + private Vector4 contentBackgroundColor; private bool tilesClearedWhenHidden; private float tileCoverAreaMultiplier; private bool cursorEnabledByClient; @@ -67,6 +67,9 @@ namespace Tizen.NUI private EventHandler frameRenderedEventHandler; private WebViewFrameRenderedCallbackDelegate frameRenderedCallback; + private ScreenshotAcquiredCallback screenshotAcquiredCallback; + private readonly WebViewScreenshotAcquiredProxyCallback screenshotAcquiredProxyCallback; + /// /// Creates a WebView. /// @@ -118,6 +121,8 @@ namespace Tizen.NUI formRepostPolicyDecidedSignal = new WebViewFormRepostDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr)); frameRenderedSignal = new WebViewFrameRenderedSignal(Interop.WebView.WebViewFrameRenderedSignalFrameRenderedGet(SwigCPtr)); + screenshotAcquiredProxyCallback = OnScreenshotAcquired; + BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false); Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false); CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false); @@ -225,6 +230,9 @@ namespace Tizen.NUI [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WebViewFrameRenderedCallbackDelegate(IntPtr data); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WebViewScreenshotAcquiredProxyCallback(IntPtr data); + /// /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when page loading has started.
@@ -455,7 +463,7 @@ namespace Tizen.NUI /// Search text only at the beginning of the words ///
[EditorBrowsable(EditorBrowsableState.Never)] - AtWordStarts = 1 << 1, + AtWordStart = 1 << 1, /// /// Treat capital letters in the middle of words as word start @@ -750,18 +758,18 @@ namespace Tizen.NUI } /// - /// Background color of document of web page. + /// Background color of web page. /// [EditorBrowsable(EditorBrowsableState.Never)] - public Color DocumentBackgroundColor + public Color ContentBackgroundColor { get { - return (Color)GetValue(DocumentBackgroundColorProperty); + return (Color)GetValue(ContentBackgroundColorProperty); } set { - SetValue(DocumentBackgroundColorProperty, value); + SetValue(ContentBackgroundColorProperty, value); NotifyPropertyChanged(); } } @@ -1043,19 +1051,19 @@ namespace Tizen.NUI return temp; }); - private static readonly BindableProperty DocumentBackgroundColorProperty = BindableProperty.Create(nameof(DocumentBackgroundColor), typeof(Vector4), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) => + private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Vector4), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) => { var webview = (WebView)bindable; if (newValue != null) { - webview.backgroundColor = (Vector4)newValue; + webview.contentBackgroundColor = (Vector4)newValue; Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Vector4)newValue)); } }, defaultValueCreator: (bindable) => { var webview = (WebView)bindable; - return webview.backgroundColor; + return webview.contentBackgroundColor; }); private static readonly BindableProperty TilesClearedWhenHiddenProperty = BindableProperty.Create(nameof(TilesClearedWhenHidden), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) => @@ -1611,7 +1619,8 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public bool GetScreenshotAsynchronously(Rectangle viewArea, float scaleFactor, ScreenshotAcquiredCallback callback) { - System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback); + screenshotAcquiredCallback = callback; + System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(screenshotAcquiredProxyCallback); bool result = Interop.WebView.GetScreenshotAsynchronously(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor, new HandleRef(this, ip)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; @@ -1745,5 +1754,12 @@ namespace Tizen.NUI { frameRenderedEventHandler?.Invoke(this, new EventArgs()); } + + private void OnScreenshotAcquired(IntPtr data) + { + ImageView image = new ImageView(data, true); + screenshotAcquiredCallback?.Invoke(image); + image.Dispose(); + } } }