/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace
{
-static WebEngine* gInstance = NULL;
+
+// Generally only one WebEngine instance exists.
+// If > 1, a new web engine has been created by CreateWindowSignal.
+static WebEngine* gInstance = 0;
static int gInstanceCount = 0;
bool OnGoBack();
bool OnGoForward();
bool OnLoadUrl();
bool OnEvaluteJavaScript();
+bool OnJavaScriptAlert();
+bool OnJavaScriptConfirm();
+bool OnJavaScriptPrompt();
+bool OnScrollEdge();
bool OnClearHistory();
-static void ConnectToGlobalSignal( bool (*func)() )
+static void ConnectToGlobalSignal( bool ( *func )() )
{
Dali::Timer timer = Dali::Timer::New( 0 );
timer.TickSignal().Connect( func );
}
-static void DisconnectFromGlobalSignal( bool (*func)() )
+static void DisconnectFromGlobalSignal( bool ( *func )() )
{
Dali::Timer timer = Dali::Timer::New( 0 );
timer.TickSignal().Disconnect( func );
}
-}
+} // namespace anonymous
class MockWebEngineContext : public Dali::WebEngineContext
{
MockWebEngineSettings()
: mockDefaultFontSize( 16 ),
mockJavaScriptEnabled( true ),
+ mockAutoFittingEnabled ( true ),
+ mockPluginsEnabled ( true ),
+ mockPrivateBrowsingEnabled( true ),
+ mockLinkMagnifierEnabled( true ),
+ mockKeypadWithoutUserActionUsed( true ),
+ mockAutofillPasswordFormEnabled( true ),
+ mockFormCandidateDataEnabled( true ),
+ mockTextSelectionEnabled( true ),
+ mockTextAutosizingEnable( true ),
+ mockArrowScrollEnable( true ),
+ mockClipboardEnabled( true ),
+ mockImePanelEnabled( true ),
mockImageLoadedAutomatically( true ),
mockDefaultTextEncodingName()
{
mockJavaScriptEnabled = enabled;
}
+ bool IsAutoFittingEnabled() const override
+ {
+ return mockAutoFittingEnabled;
+ }
+
+ void EnableAutoFitting( bool enabled ) override
+ {
+ mockAutoFittingEnabled = enabled;
+ }
+
+ bool ArePluginsEnabled() const override
+ {
+ return mockPluginsEnabled;
+ }
+
+ void EnablePlugins( bool enabled ) override
+ {
+ mockPluginsEnabled = enabled;
+ }
+
+ bool IsPrivateBrowsingEnabled() const override
+ {
+ return mockPrivateBrowsingEnabled;
+ }
+
+ void EnablePrivateBrowsing( bool enabled ) override
+ {
+ mockPrivateBrowsingEnabled = enabled;
+ }
+
+ bool IsLinkMagnifierEnabled() const override
+ {
+ return mockLinkMagnifierEnabled;
+ }
+
+ void EnableLinkMagnifier( bool enabled ) override
+ {
+ mockLinkMagnifierEnabled = enabled;
+ }
+
+ bool IsKeypadWithoutUserActionUsed() const override
+ {
+ return mockKeypadWithoutUserActionUsed;
+ }
+
+ void UseKeypadWithoutUserAction( bool used ) override
+ {
+ mockKeypadWithoutUserActionUsed = used;
+ }
+
+ bool IsAutofillPasswordFormEnabled() const override
+ {
+ return mockAutofillPasswordFormEnabled;
+ }
+
+ void EnableAutofillPasswordForm( bool enabled ) override
+ {
+ mockAutofillPasswordFormEnabled = enabled;
+ }
+
+ bool IsFormCandidateDataEnabled() const override
+ {
+ return mockFormCandidateDataEnabled;
+ }
+
+ void EnableFormCandidateData( bool enabled ) override
+ {
+ mockFormCandidateDataEnabled = enabled;
+ }
+
+ bool IsTextSelectionEnabled() const override
+ {
+ return mockTextSelectionEnabled;
+ }
+
+ void EnableTextSelection( bool enabled ) override
+ {
+ mockTextSelectionEnabled = enabled;
+ }
+
+ bool IsTextAutosizingEnabled() const override
+ {
+ return mockTextAutosizingEnable;
+ }
+
+ void EnableTextAutosizing( bool enabled ) override
+ {
+ mockTextAutosizingEnable = enabled;
+ }
+
+ bool IsArrowScrollEnabled() const override
+ {
+ return mockArrowScrollEnable;
+ }
+
+ void EnableArrowScroll( bool enabled ) override
+ {
+ mockArrowScrollEnable = enabled;
+ }
+
+ bool IsClipboardEnabled() const override
+ {
+ return mockClipboardEnabled;
+ }
+
+ void EnableClipboard( bool enabled ) override
+ {
+ mockClipboardEnabled = enabled;
+ }
+
+ bool IsImePanelEnabled() const override
+ {
+ return mockImePanelEnabled;
+ }
+
+ void EnableImePanel( bool enabled ) override
+ {
+ mockImePanelEnabled = enabled;
+ }
+
bool AreImagesLoadedAutomatically() const override
{
return mockImageLoadedAutomatically;
{
}
+ void EnableCacheBuilder( bool enabled ) override
+ {
+ }
+
+ void UseScrollbarThumbFocusNotifications( bool used ) override
+ {
+ }
+
+ void EnableDoNotTrack( bool enabled ) override
+ {
+ }
+
void AllowFileAccessFromExternalUrl( bool allowed ) override
{
}
private:
int mockDefaultFontSize;
bool mockJavaScriptEnabled;
+ bool mockAutoFittingEnabled;
+ bool mockPluginsEnabled;
+ bool mockPrivateBrowsingEnabled;
+ bool mockLinkMagnifierEnabled;
+ bool mockKeypadWithoutUserActionUsed;
+ bool mockAutofillPasswordFormEnabled;
+ bool mockFormCandidateDataEnabled;
+ bool mockTextSelectionEnabled;
+ bool mockTextAutosizingEnable;
+ bool mockArrowScrollEnable;
+ bool mockClipboardEnabled;
+ bool mockImePanelEnabled;
bool mockImageLoadedAutomatically;
std::string mockDefaultTextEncodingName;
};
{
public:
+ using JavaScriptEvaluatedResultCallback = std::function<void(const std::string&)>;
+ using JavaScriptAlertCallback = std::function<bool(const std::string&)>;
+ using JavaScriptConfirmCallback = std::function<bool(const std::string&)>;
+ using JavaScriptPromptCallback = std::function<bool(const std::string&, const std::string&)>;
+
WebEngine()
: mUrl()
, mCurrentPlusOnePos( 0 )
, mContentSize( 500, 500 )
{
gInstanceCount++;
- gInstance = this;
+ if ( gInstanceCount == 1 ) // only first web engine need be saved.
+ {
+ gInstance = this;
+ }
mockWebEngineSettings = new MockWebEngineSettings();
mockWebEngineContext = new MockWebEngineContext();
gInstanceCount--;
if( !gInstanceCount )
{
- gInstance = NULL;
+ gInstance = 0;
}
delete mockWebEngineSettings;
}
}
+ void RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
+ {
+ if ( callback )
+ {
+ ConnectToGlobalSignal( &OnJavaScriptAlert );
+ mJavaScriptAlertCallback = callback;
+ }
+ }
+
+ void RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
+ {
+ if ( callback )
+ {
+ ConnectToGlobalSignal( &OnJavaScriptConfirm );
+ mJavaScriptConfirmCallback = callback;
+ }
+ }
+
+ void RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
+ {
+ if ( callback )
+ {
+ ConnectToGlobalSignal( &OnJavaScriptPrompt );
+ mJavaScriptPromptCallback = callback;
+ }
+ }
+
void ClearHistory()
{
ConnectToGlobalSignal( &OnClearHistory );
mScrollPosition += Dali::Vector2( dx, dy );
if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
{
- gInstance->mScrollEdgeReachedSignal.Emit( Dali::WebEnginePlugin::ScrollEdge::BOTTOM );
+ ConnectToGlobalSignal( &OnScrollEdge );
}
}
return mPageLoadStartedSignal;
}
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadInProgressSignal()
+ {
+ return mPageLoadInProgressSignal;
+ }
+
Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal()
{
return mPageLoadFinishedSignal;
return mScrollEdgeReachedSignal;
}
+ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal()
+ {
+ return mUrlChangedSignal;
+ }
+
std::string mUrl;
std::vector< std::string > mHistory;
size_t mCurrentPlusOnePos;
std::string mUserAgent;
Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal;
Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
- std::vector< std::function< void( const std::string& ) > > mResultCallbacks;
+ std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
bool mEvaluating;
Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
WebEngineContext* mockWebEngineContext;
WebEngineCookieManager* mockWebEngineCookieManager;
WebEngineSettings* mockWebEngineSettings;
+ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal;
+
+ JavaScriptAlertCallback mJavaScriptAlertCallback;
+ JavaScriptConfirmCallback mJavaScriptConfirmCallback;
+ JavaScriptPromptCallback mJavaScriptPromptCallback;
};
-inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
-{
- DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
- BaseObject& handle = webEngine.GetBaseObject();
- return static_cast< Internal::Adaptor::WebEngine& >( handle );
-}
-
-inline const WebEngine& GetImplementation( const Dali::WebEngine& webEngine )
-{
- DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
- const BaseObject& handle = webEngine.GetBaseObject();
- return static_cast< const Internal::Adaptor::WebEngine& >( handle );
-}
namespace
{
gInstance->mHistory.push_back( gInstance->mUrl );
gInstance->mCurrentPlusOnePos++;
gInstance->mPageLoadStartedSignal.Emit( gInstance->mUrl );
+ gInstance->mPageLoadInProgressSignal.Emit( gInstance->mUrl );
gInstance->mPageLoadFinishedSignal.Emit( gInstance->mUrl );
+ gInstance->mUrlChangedSignal.Emit( "http://new-test" );
+ }
+ return false;
+}
+
+bool OnScrollEdge()
+{
+ DisconnectFromGlobalSignal( &OnScrollEdge );
+
+ if( gInstance )
+ {
+ gInstance->mScrollEdgeReachedSignal.Emit( Dali::WebEnginePlugin::ScrollEdge::BOTTOM );
}
+
return false;
}
return false;
}
+bool OnJavaScriptAlert()
+{
+ DisconnectFromGlobalSignal( &OnJavaScriptAlert );
+ if ( gInstance )
+ {
+ gInstance->mJavaScriptAlertCallback( "this is an alert popup." );
+ }
+ return false;
+}
+
+bool OnJavaScriptConfirm()
+{
+ DisconnectFromGlobalSignal( &OnJavaScriptConfirm );
+ if ( gInstance )
+ {
+ gInstance->mJavaScriptConfirmCallback( "this is a confirm popup." );
+ }
+ return false;
+}
+
+bool OnJavaScriptPrompt()
+{
+ DisconnectFromGlobalSignal( &OnJavaScriptPrompt );
+ if ( gInstance )
+ {
+ gInstance->mJavaScriptPromptCallback( "this is a prompt pompt.", "" );
+ }
+ return false;
+}
+
bool OnClearHistory()
{
DisconnectFromGlobalSignal( &OnClearHistory );
- if( gInstance && gInstance->mCurrentPlusOnePos ) {
+ if( gInstance && gInstance->mCurrentPlusOnePos )
+ {
std::string url = gInstance->mHistory[ gInstance->mCurrentPlusOnePos - 1 ];
std::vector< std::string >().swap( gInstance->mHistory );
gInstance->mHistory.push_back( url );
}
return false;
}
+
} // namespace
+inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
+{
+ DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
+ BaseObject& handle = webEngine.GetBaseObject();
+ return static_cast< Internal::Adaptor::WebEngine& >( handle );
+}
+
+inline const WebEngine& GetImplementation( const Dali::WebEngine& webEngine )
+{
+ DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
+ const BaseObject& handle = webEngine.GetBaseObject();
+ return static_cast< const Internal::Adaptor::WebEngine& >( handle );
+}
+
} // namespace Adaptor
} // namespace Internal
-
// Dali::WebEngine Implementation
WebEngine::WebEngine()
{
{
}
+void WebEngine::RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
+{
+ Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptAlertCallback( callback );
+}
+
+void WebEngine::JavaScriptAlertReply()
+{
+}
+
+void WebEngine::RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
+{
+ Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptConfirmCallback( callback );
+}
+
+void WebEngine::JavaScriptConfirmReply( bool confirmed )
+{
+}
+
+void WebEngine::RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
+{
+ Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptPromptCallback( callback );
+}
+
+void WebEngine::JavaScriptPromptReply( const std::string& result )
+{
+}
+
void WebEngine::ClearAllTilesResources()
{
}
return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal();
}
+Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadInProgressSignal()
+{
+ return Internal::Adaptor::GetImplementation( *this ).PageLoadInProgressSignal();
+}
+
Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
{
return Internal::Adaptor::GetImplementation( *this ).PageLoadFinishedSignal();
return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeReachedSignal();
}
+Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& WebEngine::UrlChangedSignal()
+{
+ return Internal::Adaptor::GetImplementation( *this ).UrlChangedSignal();
+}
+
} // namespace Dali;
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
gTextChangedCallBackCalled = false;
editor.SetProperty( TextEditor::Property::TEXT, "ABC" );
+ application.SendNotification();
+ application.Render();
DALI_TEST_CHECK( gTextChangedCallBackCalled );
DALI_TEST_CHECK( textChangedSignal );
+ editor.SetKeyInputFocus();
+
+ gTextChangedCallBackCalled = false;
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+
+ // Remove all text
+ editor.SetProperty( TextField::Property::TEXT, "" );
+ application.SendNotification();
+ application.Render();
+
+ // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor.
+ gTextChangedCallBackCalled = false;
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor.
+ gTextChangedCallBackCalled = false;
+ application.ProcessEvent( GenerateKey( "", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ END_TEST;
+}
+
+int utcDaliTextEditorTextChangedWithInputMethodContext(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorTextChangedWithInputMethodContext");
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+
+ application.GetScene().Add( editor );
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ editor.TextChangedSignal().Connect(&TestTextChangedCallback);
+ bool textChangedSignal = false;
+ editor.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
+
+
+ // get InputMethodContext
+ std::string text;
+ InputMethodContext::EventData imfEvent;
+ InputMethodContext inputMethodContext = DevelTextEditor::GetInputMethodContext( editor );
editor.SetKeyInputFocus();
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_EDITING, true );
+ // input text
gTextChangedCallBackCalled = false;
- application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "ㅎ", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("ㅎ"), TEST_LOCATION );
+
+ gTextChangedCallBackCalled = false;
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "호", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("호"), TEST_LOCATION );
+
+ gTextChangedCallBackCalled = false;
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "혿", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("혿"), TEST_LOCATION );
+
+ gTextChangedCallBackCalled = false;
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::COMMIT, "호", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "두", 1, 2 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("호두"), TEST_LOCATION );
END_TEST;
}
+
int utcDaliTextEditorInputStyleChanged01(void)
{
// The text-editor emits signals when the input style changes. These changes of style are
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
gTextChangedCallBackCalled = false;
field.SetProperty( TextField::Property::TEXT, "ABC" );
+ application.SendNotification();
+ application.Render();
DALI_TEST_CHECK( gTextChangedCallBackCalled );
DALI_TEST_CHECK( textChangedSignal );
+ field.SetKeyInputFocus();
+
+ gTextChangedCallBackCalled = false;
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+
+ // Remove all text
+ field.SetProperty( TextField::Property::TEXT, "" );
application.SendNotification();
+ application.Render();
+
+ // Pressing backspace key: TextChangedCallback should not be called when there is no text in textfield.
+ gTextChangedCallBackCalled = false;
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ // Pressing delete key: TextChangedCallback should not be called when there is no text in textfield.
+ gTextChangedCallBackCalled = false;
+ application.ProcessEvent( GenerateKey( "", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ END_TEST;
+}
+
+int utcDaliTextFieldTextChangedWithInputMethodContext(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldTextChangedWithInputMethodContext");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+
+ application.GetScene().Add( field );
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ field.TextChangedSignal().Connect(&TestTextChangedCallback);
+ bool textChangedSignal = false;
+ field.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
+
+
+ // get InputMethodContext
+ std::string text;
+ InputMethodContext::EventData imfEvent;
+ InputMethodContext inputMethodContext = DevelTextField::GetInputMethodContext( field );
field.SetKeyInputFocus();
+ field.SetProperty( DevelTextField::Property::ENABLE_EDITING, true );
+ // input text
gTextChangedCallBackCalled = false;
- application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "ㅎ", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("ㅎ"), TEST_LOCATION );
+
+ gTextChangedCallBackCalled = false;
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "호", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("호"), TEST_LOCATION );
+
+ gTextChangedCallBackCalled = false;
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "혿", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("혿"), TEST_LOCATION );
+
+ gTextChangedCallBackCalled = false;
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::COMMIT, "호", 0, 1 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "두", 1, 2 );
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("호두"), TEST_LOCATION );
END_TEST;
}
+
// Negative test for the textChanged signal.
int utcDaliTextFieldTextChangedN(void)
{
gTextChangedCallBackCalled = false;
field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "ABC" ); // Setting placeholder, not TEXT
+ application.SendNotification();
+ application.Render();
DALI_TEST_CHECK( !gTextChangedCallBackCalled );
DALI_TEST_CHECK( !textChangedSignal );
const char* const TEST_URL2( "http://www.somewhere.valid2.com" );
static int gPageLoadStartedCallbackCalled = 0;
+static int gPageLoadInProgressCallbackCalled = 0;
static int gPageLoadFinishedCallbackCalled = 0;
static int gScrollEdgeReachedCallbackCalled = 0;
+static int gUrlChangedCallbackCalled = 0;
static int gEvaluateJavaScriptCallbackCalled = 0;
+static int gJavaScriptAlertCallbackCalled = 0;
+static int gJavaScriptConfirmCallbackCalled = 0;
+static int gJavaScriptPromptCallbackCalled = 0;
static bool gTouched = false;
struct CallbackFunctor
gPageLoadStartedCallbackCalled++;
}
+static void OnPageLoadInProgress( WebView view, const std::string& url )
+{
+ gPageLoadInProgressCallbackCalled++;
+}
+
static void OnPageLoadFinished( WebView view, const std::string& url )
{
gPageLoadFinishedCallbackCalled++;
gScrollEdgeReachedCallbackCalled++;
}
+static void OnUrlChanged( WebView view, const std::string& url )
+{
+ gUrlChangedCallbackCalled++;
+}
+
static void OnPageLoadError( WebView view, const std::string& url, WebView::LoadErrorCode errorCode )
{
}
gEvaluateJavaScriptCallbackCalled++;
}
+static bool OnJavaScriptAlert( const std::string& result )
+{
+ gJavaScriptAlertCallbackCalled++;
+ return true;
+}
+
+static bool OnJavaScriptConfirm( const std::string& result )
+{
+ gJavaScriptConfirmCallbackCalled++;
+ return true;
+}
+
+static bool OnJavaScriptPrompt( const std::string& meesage1, const std::string& message2 )
+{
+ gJavaScriptPromptCallbackCalled++;
+ return true;
+}
+
static bool OnTouched( Actor actor, const Dali::TouchEvent& touch )
{
gTouched = true;
ConnectionTracker* testTracker = new ConnectionTracker();
view.PageLoadStartedSignal().Connect( &OnPageLoadStarted );
+ view.PageLoadInProgressSignal().Connect( &OnPageLoadInProgress );
view.PageLoadFinishedSignal().Connect( &OnPageLoadFinished );
view.PageLoadErrorSignal().Connect( &OnPageLoadError );
+ view.UrlChangedSignal().Connect( &OnUrlChanged );
bool signal1 = false;
bool signal2 = false;
bool signal3 = false;
+ bool signal4 = false;
+ bool signal5 = false;
view.ConnectSignal( testTracker, "pageLoadStarted", CallbackFunctor(&signal1) );
- view.ConnectSignal( testTracker, "pageLoadFinished", CallbackFunctor(&signal2) );
- view.ConnectSignal( testTracker, "invalidname", CallbackFunctor(&signal3) );
+ view.ConnectSignal( testTracker, "pageLoadInProgress", CallbackFunctor(&signal2) );
+ view.ConnectSignal( testTracker, "pageLoadFinished", CallbackFunctor(&signal3) );
+ view.ConnectSignal( testTracker, "urlChanged", CallbackFunctor(&signal4) );
+ view.ConnectSignal( testTracker, "invalidname", CallbackFunctor(&signal5) );
DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 0, TEST_LOCATION );
-
+ DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 0, TEST_LOCATION );
view.LoadUrl( TEST_URL1 );
view.GetNaturalSize();
Test::EmitGlobalTimerSignal();
DALI_TEST_EQUALS( view.CanGoBack(), false, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 & signal2 );
- DALI_TEST_CHECK( !signal3 );
+ DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 & signal2 & signal3 & signal4 );
+ DALI_TEST_CHECK( !signal5 );
view.LoadUrl( TEST_URL2 );
view.Suspend();
DALI_TEST_EQUALS( view.CanGoBack(), true, TEST_LOCATION );
DALI_TEST_EQUALS( view.CanGoForward(), false, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 2, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 2, TEST_LOCATION );
view.GoBack();
Test::EmitGlobalTimerSignal();
// scroll by and trigger scrollEdgeReached event.
view.ScrollBy( 50, 50 );
+ Test::EmitGlobalTimerSignal();
+
view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
DALI_TEST_CHECK( output.x == 150 && output.y == 150 );
DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 1, TEST_LOCATION );
END_TEST;
}
+int UtcDaliWebViewJavaScriptAlertConfirmPrompt(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
+
+ view.RegisterJavaScriptAlertCallback( &OnJavaScriptAlert );
+ view.LoadHtmlString( "<head><script type='text/javascript'>alert('this is an alert popup.');</script></head><body>Hello World!</body>" );
+ view.JavaScriptAlertReply();
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gJavaScriptAlertCallbackCalled, 1, TEST_LOCATION );
+
+ view.RegisterJavaScriptConfirmCallback( &OnJavaScriptConfirm );
+ view.LoadHtmlString( "<head><script type='text/javascript'>confirm('this is a confirm popup.');</script></head><body>Hello World!</body>" );
+ view.JavaScriptConfirmReply( true );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gJavaScriptConfirmCallbackCalled, 1, TEST_LOCATION );
+
+ view.RegisterJavaScriptPromptCallback( &OnJavaScriptPrompt );
+ view.LoadHtmlString( "<head><script type='text/javascript'>prompt('this is a prompt popup.');</script></head><body>Hello World!</body>" );
+ view.JavaScriptPromptReply( "it is a prompt." );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gJavaScriptPromptCallbackCalled, 1, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliWebViewMethodsForCoverage(void)
{
ToolkitTestApplication application;
settings->AllowMixedContents( false );
settings->EnableSpatialNavigation( false );
settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
settings->AllowFileAccessFromExternalUrl( false );
settings->AllowScriptsOpenWindows( false );
settings->AllowMixedContents( false );
settings->EnableSpatialNavigation( false );
settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
settings->AllowFileAccessFromExternalUrl( false );
settings->AllowScriptsOpenWindows( false );
END_TEST;
}
+int UtcDaliWebSettingsCheckEnableAutoFitting(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsAutoFittingEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnableAutoFitting( false );
+ value = settings->IsAutoFittingEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnablePlugins(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->ArePluginsEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnablePlugins( false );
+ value = settings->ArePluginsEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnablePrivateBrowsing(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsPrivateBrowsingEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnablePrivateBrowsing( false );
+ value = settings->IsPrivateBrowsingEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableLinkMagnifier(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsLinkMagnifierEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnableLinkMagnifier( false );
+ value = settings->IsLinkMagnifierEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckUseKeypadWithoutUserAction(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsKeypadWithoutUserActionUsed();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->UseKeypadWithoutUserAction( false );
+ value = settings->IsKeypadWithoutUserActionUsed();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableAutofillPasswordForm(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsAutofillPasswordFormEnabled();
+ DALI_TEST_CHECK( value );
+ settings->EnableAutofillPasswordForm( false );
+ value = settings->IsAutofillPasswordFormEnabled();
+ DALI_TEST_CHECK( !value );
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableFormCandidateData(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 );
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsFormCandidateDataEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnableFormCandidateData( false );
+ value = settings->IsFormCandidateDataEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableTextSelection(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 );
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsTextSelectionEnabled();
+ DALI_TEST_CHECK( value );
+
+ //Check Set/GetProperty
+ settings->EnableTextSelection(false);
+ value = settings->IsTextSelectionEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableTextAutosizing(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 );
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsTextAutosizingEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnableTextAutosizing(false);
+ value = settings->IsTextAutosizingEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableArrowScroll(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 );
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsArrowScrollEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnableArrowScroll(false);
+ value = settings->IsArrowScrollEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableClipboard(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 );
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsClipboardEnabled();
+ DALI_TEST_CHECK( value );
+ settings->EnableClipboard(false);
+ value = settings->IsClipboardEnabled();
+ DALI_TEST_CHECK( !value );
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableImePanel(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 );
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsImePanelEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnableImePanel(false);
+ value = settings->IsImePanelEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void)
{
ToolkitTestApplication application;
settings->AllowMixedContents( false );
settings->EnableSpatialNavigation( false );
settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
settings->AllowFileAccessFromExternalUrl( false );
settings->AllowScriptsOpenWindows( false );
settings->AllowMixedContents( false );
settings->EnableSpatialNavigation( false );
settings->EnableWebSecurity( false );
+ settings->EnableCacheBuilder( false );
+ settings->EnableDoNotTrack( false );
+ settings->UseScrollbarThumbFocusNotifications( false );
settings->AllowFileAccessFromExternalUrl( false );
settings->AllowScriptsOpenWindows( false );
ENDIF( LCOV_BIN )
ENDIF()
+IF ( BUILD_SCENE_LOADER )
+ ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/dali-scene-loader )
+ENDIF()
+
+
# Build documentation if doxygen tool is available
SET( doxygenEnabled OFF )
IF( DOXYGEN_FOUND )
SET( DOXYGEN_INTERNAL_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs-internal )
CONFIGURE_FILE( ${DOXYGEN_SRC_DIR}/dali.doxy.in ${DOXYGEN_SRC_DIR}/dali.doxy @ONLY )
CONFIGURE_FILE( ${DOXYGEN_INTERNAL_SRC_DIR}/dali-internal.doxy.in ${DOXYGEN_INTERNAL_SRC_DIR}/dali-internal.doxy @ONLY )
- ADD_CUSTOM_TARGET( doc_doxygen ALL
- DEPENDS ${name}
- COMMAND ${DOXYGEN_EXECUTABLE} -u ${DOXYGEN_SRC_DIR}/dali.doxy
- COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_SRC_DIR}/dali.doxy
- COMMAND ${CMAKE_COMMAND} -P ${DOXYGEN_SRC_DIR}/check_for_errors.cmake
- COMMENT "Generating API documentation with Doxygen"
- WORKING_DIRECTORY ${DOXYGEN_SRC_DIR}
- VERBATIM )
+
+ IF ( BUILD_SCENE_LOADER )
+ ADD_CUSTOM_TARGET( doc_doxygen ALL
+ DEPENDS ${name} dali2-scene-loader
+ COMMAND ${DOXYGEN_EXECUTABLE} -u ${DOXYGEN_SRC_DIR}/dali.doxy
+ COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_SRC_DIR}/dali.doxy
+ COMMAND ${CMAKE_COMMAND} -P ${DOXYGEN_SRC_DIR}/check_for_errors.cmake
+ COMMENT "Generating API documentation with Doxygen"
+ WORKING_DIRECTORY ${DOXYGEN_SRC_DIR}
+ VERBATIM )
+ ELSE()
+ ADD_CUSTOM_TARGET( doc_doxygen ALL
+ DEPENDS ${name}
+ COMMAND ${DOXYGEN_EXECUTABLE} -u ${DOXYGEN_SRC_DIR}/dali.doxy
+ COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_SRC_DIR}/dali.doxy
+ COMMAND ${CMAKE_COMMAND} -P ${DOXYGEN_SRC_DIR}/check_for_errors.cmake
+ COMMENT "Generating API documentation with Doxygen"
+ WORKING_DIRECTORY ${DOXYGEN_SRC_DIR}
+ VERBATIM )
+ ENDIF()
+
+ # Following target is optional - it doesn't run by default
+ # Build using "make doc_doxygen_internal".
ADD_CUSTOM_TARGET( doc_doxygen_internal
COMMAND ${DOXYGEN_EXECUTABLE} -u ${DOXYGEN_INTERNAL_SRC_DIR}/dali-internal.doxy
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INTERNAL_SRC_DIR}/dali-internal.doxy
${ROOT_SRC_DIR}/automated-tests/CMakeLists.txt @ONLY )
ENDIF()
-IF ( BUILD_SCENE_LOADER )
- ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/dali-scene-loader )
-ENDIF()
# Configuration Messages
MESSAGE( STATUS "Configuration:\n" )
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
-PERL_PATH = /usr/bin/perl
+#PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
-MSCGEN_PATH =
+#MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
-PERL_PATH = /usr/bin/perl
+#PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
-MSCGEN_PATH =
+#MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "accessible-impl.h"
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
+
+namespace Dali::Toolkit::DevelControl {
+
+AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
+: self(self),
+ modal(modal)
+{
+ auto control = Dali::Toolkit::Control::DownCast(self);
+
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+ if(controlImpl.mAccessibilityRole == Dali::Accessibility::Role::UNKNOWN)
+ controlImpl.mAccessibilityRole = role;
+
+ self.PropertySetSignal().Connect(&controlImpl, [this, &controlImpl](Dali::Handle& handle, Dali::Property::Index index, Dali::Property::Value value) {
+ if(this->self != Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor())
+ {
+ return;
+ }
+
+ if(index == DevelControl::Property::ACCESSIBILITY_NAME || (index == GetNamePropertyIndex() && !controlImpl.mAccessibilityNameSet))
+ {
+ if(controlImpl.mAccessibilityGetNameSignal.Empty())
+ {
+ Emit(Dali::Accessibility::ObjectPropertyChangeEvent::NAME);
+ }
+ }
+
+ if(index == DevelControl::Property::ACCESSIBILITY_DESCRIPTION || (index == GetDescriptionPropertyIndex() && !controlImpl.mAccessibilityDescriptionSet))
+ {
+ if(controlImpl.mAccessibilityGetDescriptionSignal.Empty())
+ {
+ Emit(Dali::Accessibility::ObjectPropertyChangeEvent::DESCRIPTION);
+ }
+ }
+ });
+}
+
+std::string AccessibleImpl::GetName()
+{
+ auto control = Dali::Toolkit::Control::DownCast(self);
+
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+
+ if(!controlImpl.mAccessibilityGetNameSignal.Empty())
+ {
+ std::string ret;
+ controlImpl.mAccessibilityGetNameSignal.Emit(ret);
+ return ret;
+ }
+
+ if(controlImpl.mAccessibilityNameSet)
+ return controlImpl.mAccessibilityName;
+
+ if(auto raw = GetNameRaw(); !raw.empty())
+ return raw;
+
+ return self.GetProperty<std::string>(Actor::Property::NAME);
+}
+
+std::string AccessibleImpl::GetNameRaw()
+{
+ return {};
+}
+
+std::string AccessibleImpl::GetDescription()
+{
+ auto control = Dali::Toolkit::Control::DownCast(self);
+
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+
+ if(!controlImpl.mAccessibilityGetDescriptionSignal.Empty())
+ {
+ std::string ret;
+ controlImpl.mAccessibilityGetDescriptionSignal.Emit(ret);
+ return ret;
+ }
+
+ if(controlImpl.mAccessibilityDescriptionSet)
+ return controlImpl.mAccessibilityDescription;
+
+ return GetDescriptionRaw();
+}
+
+std::string AccessibleImpl::GetDescriptionRaw()
+{
+ return "";
+}
+
+Dali::Accessibility::Accessible* AccessibleImpl::GetParent()
+{
+ return Dali::Accessibility::Accessible::Get(self.GetParent());
+}
+
+size_t AccessibleImpl::GetChildCount()
+{
+ return self.GetChildCount();
+}
+
+Dali::Accessibility::Accessible* AccessibleImpl::GetChildAtIndex(size_t index)
+{
+ return Dali::Accessibility::Accessible::Get(self.GetChildAt(static_cast<unsigned int>(index)));
+}
+
+size_t AccessibleImpl::GetIndexInParent()
+{
+ auto s = self;
+ auto parent = s.GetParent();
+ DALI_ASSERT_ALWAYS(parent && "can't call GetIndexInParent on object without parent");
+ auto count = parent.GetChildCount();
+ for(auto i = 0u; i < count; ++i)
+ {
+ auto c = parent.GetChildAt(i);
+ if(c == s)
+ return i;
+ }
+ DALI_ASSERT_ALWAYS(false && "object isn't child of it's parent");
+ return static_cast<size_t>(-1);
+}
+
+Dali::Accessibility::Role AccessibleImpl::GetRole()
+{
+ return self.GetProperty<Dali::Accessibility::Role>(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE);
+}
+
+Dali::Accessibility::States AccessibleImpl::CalculateStates()
+{
+ Dali::Accessibility::States s;
+ s[Dali::Accessibility::State::FOCUSABLE] = self.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE);
+ s[Dali::Accessibility::State::FOCUSED] = Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor() == self;
+ if(self.GetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE).GetType() == Dali::Property::NONE)
+ s[Dali::Accessibility::State::HIGHLIGHTABLE] = false;
+ else
+ s[Dali::Accessibility::State::HIGHLIGHTABLE] = self.GetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE).Get<bool>();
+ s[Dali::Accessibility::State::HIGHLIGHTED] = GetCurrentlyHighlightedActor() == self;
+ s[Dali::Accessibility::State::ENABLED] = true;
+ s[Dali::Accessibility::State::SENSITIVE] = true;
+ s[Dali::Accessibility::State::ANIMATED] = self.GetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED).Get<bool>();
+ s[Dali::Accessibility::State::VISIBLE] = true;
+ if(modal)
+ {
+ s[Dali::Accessibility::State::MODAL] = true;
+ }
+ s[Dali::Accessibility::State::SHOWING] = !self.GetProperty(Dali::DevelActor::Property::CULLED).Get<bool>() && self.GetCurrentProperty<bool>(Actor::Property::VISIBLE);
+
+ s[Dali::Accessibility::State::DEFUNCT] = !self.GetProperty(Dali::DevelActor::Property::CONNECTED_TO_SCENE).Get<bool>();
+ return s;
+}
+
+Dali::Accessibility::States AccessibleImpl::GetStates()
+{
+ return CalculateStates();
+}
+
+Dali::Accessibility::Attributes AccessibleImpl::GetAttributes()
+{
+ std::unordered_map<std::string, std::string> attribute_map;
+ auto q = Dali::Toolkit::Control::DownCast(self);
+ auto w =
+ q.GetProperty(Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES);
+ auto z = w.GetMap();
+
+ if(z)
+ {
+ auto map_size = z->Count();
+
+ for(unsigned int i = 0; i < map_size; i++)
+ {
+ auto map_key = z->GetKeyAt(i);
+ if(map_key.type == Dali::Property::Key::STRING)
+ {
+ std::string map_value;
+ if(z->GetValue(i).Get(map_value))
+ {
+ attribute_map.emplace(std::move(map_key.stringKey),
+ std::move(map_value));
+ }
+ }
+ }
+ }
+
+ return attribute_map;
+}
+
+Dali::Accessibility::ComponentLayer AccessibleImpl::GetLayer()
+{
+ return Dali::Accessibility::ComponentLayer::WINDOW;
+}
+
+Dali::Rect<> AccessibleImpl::GetExtents(Dali::Accessibility::CoordType ctype)
+{
+ Vector2 screenPosition =
+ self.GetProperty(Dali::DevelActor::Property::SCREEN_POSITION)
+ .Get<Vector2>();
+ auto size = self.GetCurrentProperty<Vector3>(Actor::Property::SIZE) * self.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE);
+ bool positionUsesAnchorPoint =
+ self.GetProperty(Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT)
+ .Get<bool>();
+ Vector3 anchorPointOffSet =
+ size * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT)
+ : AnchorPoint::TOP_LEFT);
+ Vector2 position = Vector2(screenPosition.x - anchorPointOffSet.x,
+ screenPosition.y - anchorPointOffSet.y);
+
+ return {position.x, position.y, size.x, size.y};
+}
+
+int16_t AccessibleImpl::GetMdiZOrder()
+{
+ return 0;
+}
+double AccessibleImpl::GetAlpha()
+{
+ return 0;
+}
+
+bool AccessibleImpl::GrabFocus()
+{
+ return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(self);
+}
+
+static Dali::Actor CreateHighlightIndicatorActor()
+{
+ std::string focusBorderImagePath(AssetManager::GetDaliImagePath());
+ focusBorderImagePath += "/keyboard_focus.9.png";
+ // Create the default if it hasn't been set and one that's shared by all the
+ // keyboard focusable actors
+ auto actor = Toolkit::ImageView::New(focusBorderImagePath);
+ actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+ DevelControl::AppendAccessibilityAttribute(actor, "highlight", "");
+ actor.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED, true);
+ actor.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, false);
+
+ return actor;
+}
+
+bool AccessibleImpl::GrabHighlight()
+{
+ auto old = GetCurrentlyHighlightedActor();
+
+ if(!Dali::Accessibility::IsUp())
+ return false;
+ if(self == old)
+ return true;
+ if(old)
+ {
+ auto c = dynamic_cast<Dali::Accessibility::Component*>(Internal::Control::Impl::GetAccessibilityObject(old));
+ if(c)
+ c->ClearHighlight();
+ }
+ auto highlight = GetHighlightActor();
+ if(!highlight)
+ {
+ highlight = CreateHighlightIndicatorActor();
+ SetHighlightActor(highlight);
+ }
+ highlight.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ highlight.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ highlight.SetProperty(Actor::Property::POSITION_Z, 1.0f);
+ highlight.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+
+ EnsureSelfVisible();
+ self.Add(highlight);
+ SetCurrentlyHighlightedActor(self);
+ EmitHighlighted(true);
+
+ return true;
+}
+
+bool AccessibleImpl::ClearHighlight()
+{
+ if(!Dali::Accessibility::IsUp())
+ return false;
+ if(GetCurrentlyHighlightedActor() == self)
+ {
+ self.Remove(GetHighlightActor());
+ SetCurrentlyHighlightedActor({});
+ EmitHighlighted(false);
+ return true;
+ }
+ return false;
+}
+
+std::string AccessibleImpl::GetActionName(size_t index)
+{
+ if(index >= GetActionCount()) return "";
+ Dali::TypeInfo type;
+ self.GetTypeInfo(type);
+ DALI_ASSERT_ALWAYS(type && "no TypeInfo object");
+ return type.GetActionName(index);
+}
+
+std::string AccessibleImpl::GetLocalizedActionName(size_t index)
+{
+ // TODO: add localization
+ return GetActionName(index);
+}
+
+std::string AccessibleImpl::GetActionDescription(size_t index)
+{
+ return "";
+}
+
+size_t AccessibleImpl::GetActionCount()
+{
+ Dali::TypeInfo type;
+ self.GetTypeInfo(type);
+ DALI_ASSERT_ALWAYS(type && "no TypeInfo object");
+ return type.GetActionCount();
+}
+
+std::string AccessibleImpl::GetActionKeyBinding(size_t index)
+{
+ return "";
+}
+
+bool AccessibleImpl::DoAction(size_t index)
+{
+ std::string actionName = GetActionName(index);
+ return self.DoAction(actionName, {});
+}
+
+bool AccessibleImpl::DoAction(const std::string& name)
+{
+ return self.DoAction(name, {});
+}
+
+bool AccessibleImpl::DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo)
+{
+ auto control = Dali::Toolkit::Control::DownCast(self);
+
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+
+ if(!controlImpl.mAccessibilityDoGestureSignal.Empty())
+ {
+ auto ret = std::make_pair(gestureInfo, false);
+ controlImpl.mAccessibilityDoGestureSignal.Emit(ret);
+ return ret.second;
+ }
+
+ return false;
+}
+
+std::vector<Dali::Accessibility::Relation> AccessibleImpl::GetRelationSet()
+{
+ auto control = Dali::Toolkit::Control::DownCast(self);
+
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+
+ std::vector<Dali::Accessibility::Relation> ret;
+
+ auto& v = controlImpl.mAccessibilityRelations;
+ for(auto i = 0u; i < v.size(); ++i)
+ {
+ if(v[i].empty())
+ continue;
+
+ ret.emplace_back(Accessibility::Relation{static_cast<Accessibility::RelationType>(i), v[i]});
+ }
+
+ return ret;
+}
+
+void AccessibleImpl::EnsureChildVisible(Actor child)
+{
+}
+
+void AccessibleImpl::EnsureSelfVisible()
+{
+ auto parent = dynamic_cast<AccessibleImpl*>(GetParent());
+ if(parent)
+ {
+ parent->EnsureChildVisible(self);
+ }
+}
+
+Dali::Property::Index AccessibleImpl::GetNamePropertyIndex()
+{
+ return Actor::Property::NAME;
+}
+
+Dali::Property::Index AccessibleImpl::GetDescriptionPropertyIndex()
+{
+ return Dali::Property::INVALID_INDEX;
+}
+
+} // namespace Dali::Toolkit::DevelControl
--- /dev/null
+#ifndef DALI_TOOLKIT_ACCESSIBLE_IMPL_H
+#define DALI_TOOLKIT_ACCESSIBLE_IMPL_H
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali::Toolkit::DevelControl {
+
+/**
+ * @brief Represents the Accessible object for Dali::Toolkit::Control and derived classes
+ *
+ * You can create a derived class (and register it using SetAccessibilityConstructor)
+ * in order to customize Accessibility for a given control.
+ *
+ * @see Dali::Toolkit::DevelControl::SetAccessibilityConstructor
+ * @see Dali::Accessibility::Accessible
+ * @see Dali::Accessibility::Component
+ * @see Dali::Accessibility::Collection
+ * @see Dali::Accessibility::Action
+ * @see Dali::Accessibility::Value
+ * @see Dali::Accessibility::Text
+ * @see Dali::Accessibility::EditableText
+ */
+struct DALI_TOOLKIT_API AccessibleImpl : public virtual Dali::Accessibility::Accessible,
+ public virtual Dali::Accessibility::Component,
+ public virtual Dali::Accessibility::Collection,
+ public virtual Dali::Accessibility::Action
+{
+ Dali::Actor self;
+ bool modal = false, root = false;
+
+ AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetName()
+ */
+ std::string GetName() override;
+
+ /**
+ * @brief Returns the actor's name in the absence of ACCESSIBILITY_NAME property
+ */
+ virtual std::string GetNameRaw();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetDescription()
+ */
+ std::string GetDescription() override;
+
+ /**
+ * @brief Returns the actor's description in the absence of ACCESSIBILITY_DESCRIPTION property
+ */
+ virtual std::string GetDescriptionRaw();
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetParent()
+ */
+ Dali::Accessibility::Accessible* GetParent() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetChildCount()
+ */
+ size_t GetChildCount() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetChildAtIndex()
+ */
+ Dali::Accessibility::Accessible* GetChildAtIndex(size_t index) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetIndexInParent()
+ */
+ size_t GetIndexInParent() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetRole()
+ */
+ Dali::Accessibility::Role GetRole() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetStates()
+ */
+ Dali::Accessibility::States GetStates() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetAttributes()
+ */
+ Dali::Accessibility::Attributes GetAttributes() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Component::GetExtents()
+ */
+ Dali::Rect<> GetExtents(Dali::Accessibility::CoordType ctype) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Component::GetLayer()
+ */
+ Dali::Accessibility::ComponentLayer GetLayer() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Component::GetMdiZOrder()
+ */
+ int16_t GetMdiZOrder() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Component::GrabFocus()
+ */
+ bool GrabFocus() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Component::GetAlpha()
+ */
+ double GetAlpha() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Component::GrabHighlight()
+ */
+ bool GrabHighlight() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Component::ClearHighlight()
+ */
+ bool ClearHighlight() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Action::GetActionName()
+ */
+ std::string GetActionName(size_t index) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Action::GetLocalizedActionName()
+ */
+ std::string GetLocalizedActionName(size_t index) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Action::GetActionDescription()
+ */
+ std::string GetActionDescription(size_t index) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Action::GetActionCount()
+ */
+ size_t GetActionCount() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Action::GetActionKeyBinding()
+ */
+ std::string GetActionKeyBinding(size_t index) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Action::DoAction(size_t)
+ */
+ bool DoAction(size_t index) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Action::DoAction(const std::string&)
+ */
+ bool DoAction(const std::string& name) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::DoGesture()
+ */
+ bool DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo) override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetRelationSet()
+ */
+ std::vector<Dali::Accessibility::Relation> GetRelationSet() override;
+
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetStates()
+ */
+ virtual Dali::Accessibility::States CalculateStates();
+
+ /**
+ * @brief Makes sure that a given child of this container (e.g. ItemView) is visible
+ */
+ virtual void EnsureChildVisible(Actor child);
+
+ /**
+ * @brief Makes sure this actor is visible (when moving the highlight frame to an
+ * actor that is scrolled out of the viewport)
+ */
+ virtual void EnsureSelfVisible();
+
+ /**
+ * @brief Returns the index of the property that represents this actor's name
+ */
+ virtual Dali::Property::Index GetNamePropertyIndex();
+
+ /**
+ * @brief Returns the index of the property that represents this actor's description
+ */
+ virtual Dali::Property::Index GetDescriptionPropertyIndex();
+};
+
+} // namespace Dali::Toolkit::DevelControl
+
+#endif // DALI_TOOLKIT_ACCESSIBLE_IMPL_H
#include <dali/devel-api/adaptor-framework/input-method-context.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/accessible-impl.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/public-api/controls/control.h>
mWebEngineSettings.EnableWebSecurity(enabled);
}
+void WebSettings::EnableCacheBuilder(bool enabled)
+{
+ mWebEngineSettings.EnableCacheBuilder(enabled);
+}
+
+void WebSettings::UseScrollbarThumbFocusNotifications(bool used)
+{
+ mWebEngineSettings.UseScrollbarThumbFocusNotifications(used);
+}
+
+void WebSettings::EnableDoNotTrack( bool enabled )
+{
+ mWebEngineSettings.EnableDoNotTrack(enabled);
+}
+
void WebSettings::AllowFileAccessFromExternalUrl(bool allowed)
{
mWebEngineSettings.AllowFileAccessFromExternalUrl(allowed);
mWebEngineSettings.EnableJavaScript(enabled);
}
+bool WebSettings::IsAutoFittingEnabled() const
+{
+ return mWebEngineSettings.IsAutoFittingEnabled();
+}
+
+void WebSettings::EnableAutoFitting(bool enabled)
+{
+ mWebEngineSettings.EnableAutoFitting(enabled);
+}
+
+bool WebSettings::ArePluginsEnabled() const
+{
+ return mWebEngineSettings.ArePluginsEnabled();
+}
+
+void WebSettings::EnablePlugins(bool enabled)
+{
+ mWebEngineSettings.EnablePlugins(enabled);
+}
+
+bool WebSettings::IsPrivateBrowsingEnabled() const
+{
+ return mWebEngineSettings.IsPrivateBrowsingEnabled();
+}
+
+void WebSettings::EnablePrivateBrowsing(bool enabled)
+{
+ mWebEngineSettings.EnablePrivateBrowsing(enabled);
+}
+
+bool WebSettings::IsLinkMagnifierEnabled() const
+{
+ return mWebEngineSettings.IsLinkMagnifierEnabled();
+}
+
+void WebSettings::EnableLinkMagnifier(bool enabled)
+{
+ mWebEngineSettings.EnableLinkMagnifier(enabled);
+}
+
+bool WebSettings::IsKeypadWithoutUserActionUsed() const
+{
+ return mWebEngineSettings.IsKeypadWithoutUserActionUsed();
+}
+
+void WebSettings::UseKeypadWithoutUserAction(bool used)
+{
+ mWebEngineSettings.UseKeypadWithoutUserAction(used);
+}
+
+bool WebSettings::IsAutofillPasswordFormEnabled() const
+{
+ return mWebEngineSettings.IsAutofillPasswordFormEnabled();
+}
+
+void WebSettings::EnableAutofillPasswordForm(bool enabled)
+{
+ mWebEngineSettings.EnableAutofillPasswordForm(enabled);
+}
+
+bool WebSettings::IsFormCandidateDataEnabled() const
+{
+ return mWebEngineSettings.IsFormCandidateDataEnabled();
+}
+
+void WebSettings::EnableFormCandidateData( bool enabled )
+{
+ mWebEngineSettings.EnableFormCandidateData(enabled);
+}
+
+bool WebSettings::IsTextSelectionEnabled() const
+{
+ return mWebEngineSettings.IsTextSelectionEnabled();
+}
+
+void WebSettings::EnableTextSelection( bool enabled )
+{
+ return mWebEngineSettings.EnableTextSelection(enabled);
+}
+
+bool WebSettings::IsTextAutosizingEnabled() const
+{
+ return mWebEngineSettings.IsTextAutosizingEnabled();
+}
+
+void WebSettings::EnableTextAutosizing( bool enabled )
+{
+ return mWebEngineSettings.EnableTextAutosizing(enabled);
+}
+
+bool WebSettings::IsArrowScrollEnabled() const
+{
+ return mWebEngineSettings.IsArrowScrollEnabled();
+}
+
+void WebSettings::EnableArrowScroll( bool enabled )
+{
+ return mWebEngineSettings.EnableArrowScroll(enabled);
+}
+
+bool WebSettings::IsClipboardEnabled() const
+{
+ return mWebEngineSettings.IsClipboardEnabled();
+}
+
+void WebSettings::EnableClipboard( bool enabled )
+{
+ return mWebEngineSettings.EnableClipboard(enabled);
+}
+
+bool WebSettings::IsImePanelEnabled() const
+{
+ return mWebEngineSettings.IsImePanelEnabled();
+}
+
+void WebSettings::EnableImePanel( bool enabled )
+{
+ return mWebEngineSettings.EnableImePanel(enabled);
+}
+
void WebSettings::AllowScriptsOpenWindows(bool allowed)
{
mWebEngineSettings.AllowScriptsOpenWindows(allowed);
void EnableWebSecurity(bool enabled);
/**
+ * @brief Enables/disables cache builder.
+ *
+ * @param[in] enabled if true, to enable the cache builder
+ * otherwise to disable
+ */
+ void EnableCacheBuilder( bool enabled );
+
+ /**
+ * @brief Used/Unused uses scrollbar thumb focus notifications. The default is used.
+ *
+ * @param[in] used True if uses scrollbar thumb focus notifications, false otherwise
+ */
+ void UseScrollbarThumbFocusNotifications ( bool used );
+
+ /**
+ * @brief Enable/disables do not track executing.
+ *
+ * @param[in] enabled if true, to enable do not track
+ * otherwise to disable
+ */
+ void EnableDoNotTrack( bool enabled );
+
+ /**
* @brief Allow/Disallow file access from external url
*
* @param[in] allowed if true, to allow file access from external url
void EnableJavaScript(bool enabled);
/**
+ * @brief Returns whether auto fitting can be executable. The default is true.
+ *
+ * @return true if auto fitting executing is enabled, false otherwise
+ */
+ bool IsAutoFittingEnabled() const;
+
+ /**
+ * @brief Enables/disables auto fitting executing. The default is enabled.
+ *
+ * @param[in] enabled True if auto fitting executing is enabled, false otherwise
+ */
+ void EnableAutoFitting( bool enabled );
+
+ /**
+ * @brief Returns whether plugins can be executable. The default is true.
+ *
+ * @return true if plugins executing is enabled, false otherwise
+ */
+ bool ArePluginsEnabled() const;
+
+ /**
+ * @brief Enables/disables Plugins executing. The default is enabled.
+ *
+ * @param[in] enabled True if Plugins executing is enabled, false otherwise
+ */
+ void EnablePlugins( bool enabled );
+
+ /**
+ * @brief Returns whether private browsing can be executable. The default is true.
+ *
+ * @return true if private browsing executing is enabled, false otherwise
+ */
+ bool IsPrivateBrowsingEnabled() const;
+
+ /**
+ * @brief Enables/disables private browsing executing. The default is enabled.
+ *
+ * @param[in] enabled True if private browsing executing is enabled, false otherwise
+ */
+ void EnablePrivateBrowsing( bool enabled );
+
+ /**
+ * @brief Returns whether link magnifier can be executable. The default is true.
+ *
+ * @return true if link magnifier executing is enabled, false otherwise
+ */
+ bool IsLinkMagnifierEnabled() const;
+
+ /**
+ * @brief Enables/disables link magnifier executing. The default is enabled.
+ *
+ * @param[in] enabled True if link magnifier executing is enabled, false otherwise
+ */
+ void EnableLinkMagnifier( bool enabled );
+
+ /**
+ * @brief Returns whether uses keypad without user action can be executable. The default is true.
+ *
+ * @return true if keypad without user action executing is used, false otherwise
+ */
+ bool IsKeypadWithoutUserActionUsed() const;
+
+ /**
+ * @brief Uses/Unused keypad without user action executing. The default is used.
+ *
+ * @param[in] used True if keypad without user action executing is used, false otherwise
+ */
+ void UseKeypadWithoutUserAction( bool used );
+
+ /**
+ * @brief Returns whether autofill password form can be executable. The default is true.
+ *
+ * @return true if autofill password form executing is enabled, false otherwise
+ */
+ bool IsAutofillPasswordFormEnabled() const;
+
+ /**
+ * @brief Enables/disables autofill password form executing. The default is enabled.
+ *
+ * @param[in] enabled True if autofill password form executing is enabled, false otherwise
+ */
+ void EnableAutofillPasswordForm( bool enabled );
+
+ /**
+ * @brief Returns whether form candidate data can be executable. The default is true.
+ *
+ * @return true if form candidate data executing is enabled, false otherwise
+ */
+ bool IsFormCandidateDataEnabled() const;
+
+ /**
+ * @brief Enables/disables form candidate data executing. The default is enabled.
+ *
+ * @param[in] enabled True if form candidate data executing is enabled, false otherwise
+ */
+ void EnableFormCandidateData( bool enabled );
+
+ /**
+ * @brief Returns whether text selection can be executable. The default is true.
+ *
+ * @return true if text selection executing is enabled, false otherwise
+ */
+ bool IsTextSelectionEnabled() const;
+
+ /**
+ * brief Enables/disables text selection executing. The default is enabled.
+ *
+ * @param[in] enabled True if text selection executing is enabled, false otherwise
+ */
+ void EnableTextSelection( bool enabled );
+
+ /**
+ * @brief Returns whether text autosizing can be executable. The default is true.
+ *
+ * @return true if text autosizing executing is enabled, false otherwise
+ */
+ bool IsTextAutosizingEnabled() const;
+
+ /**
+ * @brief Enables/disables text autosizing executing. The default is enabled.
+ *
+ * @param[in] enabled True if text autosizing executing is enabled, false otherwise
+ */
+ void EnableTextAutosizing( bool enabled );
+
+ /**
+ * @brief Returns whether arrow scroll can be executable. The default is true.
+ *
+ * @return true if arrow scroll executing is enabled, false otherwise
+ */
+ bool IsArrowScrollEnabled() const;
+
+ /**
+ * @brief Enables/disables arrow scroll executing. The default is enabled.
+ *
+ * @param[in] enabled True if arrow scroll executing is enabled, false otherwise
+ */
+ void EnableArrowScroll( bool enabled );
+
+ /**
+ * @brief Returns whether clipboard can be executable. The default is true.
+ *
+ * @return true if clipboard executing is enabled, false otherwise
+ */
+ bool IsClipboardEnabled() const;
+
+ /**
+ * @brief Enables/disables clipboard executing. The default is enabled.
+ *
+ * @param[in] enabled True if clipboard is enabled, false otherwise
+ */
+ void EnableClipboard( bool enabled );
+
+ /**
+ * @brief Returns whether ime panel can be executable. The default is true.
+ *
+ * @return true if ime panel executing is enabled, false otherwise
+ */
+ bool IsImePanelEnabled() const;
+
+ /**
+ * @brief Enables/disables ime panel executing. The default is enabled.
+ *
+ * @param[in] enabled True if ime panel executing is enabled, false otherwise
+ */
+ void EnableImePanel( bool enabled );
+
+ /**
* @brief Allow if the scripts can open new windows.
*
* @param[in] allowed if true, the scripts can open new windows,
Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
}
-void WebView::ClearAllTilesResources()
+void WebView::RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
+{
+ Dali::Toolkit::GetImpl( *this ).RegisterJavaScriptAlertCallback( callback );
+}
+
+void WebView::JavaScriptAlertReply()
+{
+ Dali::Toolkit::GetImpl( *this ).JavaScriptAlertReply();
+}
+
+void WebView::RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
+{
+ Dali::Toolkit::GetImpl( *this ).RegisterJavaScriptConfirmCallback( callback );
+}
+
+void WebView::JavaScriptConfirmReply( bool confirmed )
+{
+ Dali::Toolkit::GetImpl( *this ).JavaScriptConfirmReply( confirmed );
+}
+
+void WebView::RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
{
- Dali::Toolkit::GetImpl(*this).ClearAllTilesResources();
+ Dali::Toolkit::GetImpl( *this ).RegisterJavaScriptPromptCallback( callback );
+}
+
+void WebView::JavaScriptPromptReply( const std::string& result )
+{
+ Dali::Toolkit::GetImpl( *this ).JavaScriptPromptReply( result );
}
void WebView::ClearHistory()
Dali::Toolkit::GetImpl(*this).ClearHistory();
}
+void WebView::ClearAllTilesResources()
+{
+ Dali::Toolkit::GetImpl( *this ).ClearAllTilesResources();
+}
+
WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
{
return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
}
+WebView::WebViewPageLoadSignalType& WebView::PageLoadInProgressSignal()
+{
+ return Dali::Toolkit::GetImpl( *this ).PageLoadInProgressSignal();
+}
+
WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
{
return Dali::Toolkit::GetImpl(*this).PageLoadFinishedSignal();
return Dali::Toolkit::GetImpl(*this).ScrollEdgeReachedSignal();
}
+WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal()
+{
+ return Dali::Toolkit::GetImpl( *this ).UrlChangedSignal();
+}
+
WebView::WebView(Internal::WebView& implementation)
: Control(implementation)
{
*/
using WebViewScrollEdgeReachedSignalType = Signal<void(WebView, Dali::WebEnginePlugin::ScrollEdge)>;
+ /**
+ * @brief WebView signal type related with url changed.
+ */
+ using WebViewUrlChangedSignalType = Signal<void(WebView, const std::string&)>;
+
public:
/**
* @brief Creates an initialized WebView.
void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
/**
- * @brief Clears all tiles resources of Web.
+ * @brief Register alert callback for javascript.
+ *
+ * @param[in] callback The callback function to be called by the JavaScript runtime.
*/
- void ClearAllTilesResources();
+ void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback);
+
+ /**
+ * @brief Reply for JavaScript alert.
+ */
+ void JavaScriptAlertReply();
+
+ /**
+ * @brief Register confirm callback for javascript.
+ *
+ * @param[in] callback The callback function to be called by the JavaScript runtime.
+ */
+ void RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback);
+
+ /**
+ * @brief Reply for JavaScript confirm.
+ * @param[in] confirmed True if confirmed, false otherwise
+ */
+ void JavaScriptConfirmReply(bool confirmed);
+
+ /**
+ * @brief Register prompt callback for javascript.
+ *
+ * @param[in] callback The callback function to be called by the JavaScript runtime.
+ */
+ void RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback);
+
+ /**
+ * @brief Reply for JavaScript prompt.
+ * @param[in] result The result from input-field of prompt popup.
+ */
+ void JavaScriptPromptReply(const std::string& result);
/**
* @brief Clears the history of Web.
void ClearHistory();
/**
+ * @brief Clears all tiles resources of Web.
+ */
+ void ClearAllTilesResources();
+
+ /**
* @brief Connects to this signal to be notified when page loading is started.
*
* @return A signal object to connect with
WebViewPageLoadSignalType& PageLoadStartedSignal();
/**
+ * @brief Connects to this signal to be notified when page loading is in progress.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewPageLoadSignalType& PageLoadInProgressSignal();
+
+ /**
* @brief Connects to this signal to be notified when page loading is finished.
*
* @return A signal object to connect with
*/
WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+ /**
+ * @brief Connects to this signal to be notified when url is changed.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewUrlChangedSignalType& UrlChangedSignal();
+
public: // Not intended for application developers
/// @cond internal
/**
${devel_api_src_dir}/builder/builder.cpp
${devel_api_src_dir}/builder/json-parser.cpp
${devel_api_src_dir}/builder/tree-node.cpp
+ ${devel_api_src_dir}/controls/accessible-impl.cpp
${devel_api_src_dir}/controls/control-devel.cpp
${devel_api_src_dir}/controls/control-wrapper.cpp
${devel_api_src_dir}/controls/control-wrapper-impl.cpp
)
SET( devel_api_controls_header_files
+ ${devel_api_src_dir}/controls/accessible-impl.h
${devel_api_src_dir}/controls/control-depth-index-ranges.h
${devel_api_src_dir}/controls/control-devel.h
${devel_api_src_dir}/controls/control-wrapper.h
#include <dali/public-api/size-negotiation/relayout-container.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
namespace Dali
{
{
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/controls/control/control-renderers.h>
#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::ANIMATION));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::ANIMATION));
});
}
Dali::Accessibility::States Button::AccessibleImpl::CalculateStates()
{
- auto tmp = Control::Impl::AccessibleImpl::CalculateStates();
+ auto tmp = DevelControl::AccessibleImpl::CalculateStates();
tmp[Dali::Accessibility::State::SELECTABLE] = true;
auto slf = Toolkit::Button::DownCast(self);
tmp[Dali::Accessibility::State::ENABLED] = !slf.GetProperty<bool>(Toolkit::Button::Property::DISABLED);
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
bool mClickActionPerforming; ///< Used to manage signal emissions during action
protected:
- struct AccessibleImpl : public Control::Impl::AccessibleImpl
+ struct AccessibleImpl : public DevelControl::AccessibleImpl
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
Dali::Accessibility::States CalculateStates() override;
std::string GetNameRaw() override;
});
accessibilityConstructor = [](Dali::Actor actor) -> std::unique_ptr<Dali::Accessibility::Accessible> {
- return std::unique_ptr<Dali::Accessibility::Accessible>(new AccessibleImpl(actor,
- Dali::Accessibility::Role::UNKNOWN));
+ return std::unique_ptr<Dali::Accessibility::Accessible>(new DevelControl::AccessibleImpl(actor,
+ Dali::Accessibility::Role::UNKNOWN));
};
size_t len = static_cast<size_t>(Dali::Accessibility::RelationType::MAX_COUNT);
return nullptr;
}
-Control::Impl::AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
-: self(self),
- modal(modal)
-{
- auto control = Dali::Toolkit::Control::DownCast(self);
-
- Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
- Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
- if(controlImpl.mAccessibilityRole == Dali::Accessibility::Role::UNKNOWN)
- controlImpl.mAccessibilityRole = role;
-
- self.PropertySetSignal().Connect(&controlImpl, [this, &controlImpl](Dali::Handle& handle, Dali::Property::Index index, Dali::Property::Value value) {
- if(this->self != Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor())
- {
- return;
- }
-
- if(index == DevelControl::Property::ACCESSIBILITY_NAME || (index == GetNamePropertyIndex() && !controlImpl.mAccessibilityNameSet))
- {
- if(controlImpl.mAccessibilityGetNameSignal.Empty())
- {
- Emit(Dali::Accessibility::ObjectPropertyChangeEvent::NAME);
- }
- }
-
- if(index == DevelControl::Property::ACCESSIBILITY_DESCRIPTION || (index == GetDescriptionPropertyIndex() && !controlImpl.mAccessibilityDescriptionSet))
- {
- if(controlImpl.mAccessibilityGetDescriptionSignal.Empty())
- {
- Emit(Dali::Accessibility::ObjectPropertyChangeEvent::DESCRIPTION);
- }
- }
- });
-}
-
-std::string Control::Impl::AccessibleImpl::GetName()
-{
- auto control = Dali::Toolkit::Control::DownCast(self);
-
- Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
- Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
-
- if(!controlImpl.mAccessibilityGetNameSignal.Empty())
- {
- std::string ret;
- controlImpl.mAccessibilityGetNameSignal.Emit(ret);
- return ret;
- }
-
- if(controlImpl.mAccessibilityNameSet)
- return controlImpl.mAccessibilityName;
-
- if(auto raw = GetNameRaw(); !raw.empty())
- return raw;
-
- return self.GetProperty<std::string>(Actor::Property::NAME);
-}
-
-std::string Control::Impl::AccessibleImpl::GetNameRaw()
-{
- return {};
-}
-
-std::string Control::Impl::AccessibleImpl::GetDescription()
-{
- auto control = Dali::Toolkit::Control::DownCast(self);
-
- Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
- Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
-
- if(!controlImpl.mAccessibilityGetDescriptionSignal.Empty())
- {
- std::string ret;
- controlImpl.mAccessibilityGetDescriptionSignal.Emit(ret);
- return ret;
- }
-
- if(controlImpl.mAccessibilityDescriptionSet)
- return controlImpl.mAccessibilityDescription;
-
- return GetDescriptionRaw();
-}
-
-std::string Control::Impl::AccessibleImpl::GetDescriptionRaw()
-{
- return "";
-}
-
-Dali::Accessibility::Accessible* Control::Impl::AccessibleImpl::GetParent()
-{
- return Dali::Accessibility::Accessible::Get(self.GetParent());
-}
-
-size_t Control::Impl::AccessibleImpl::GetChildCount()
-{
- return self.GetChildCount();
-}
-
-Dali::Accessibility::Accessible* Control::Impl::AccessibleImpl::GetChildAtIndex(size_t index)
-{
- return Dali::Accessibility::Accessible::Get(self.GetChildAt(static_cast<unsigned int>(index)));
-}
-
-size_t Control::Impl::AccessibleImpl::GetIndexInParent()
-{
- auto s = self;
- auto parent = s.GetParent();
- DALI_ASSERT_ALWAYS(parent && "can't call GetIndexInParent on object without parent");
- auto count = parent.GetChildCount();
- for(auto i = 0u; i < count; ++i)
- {
- auto c = parent.GetChildAt(i);
- if(c == s)
- return i;
- }
- DALI_ASSERT_ALWAYS(false && "object isn't child of it's parent");
- return static_cast<size_t>(-1);
-}
-
-Dali::Accessibility::Role Control::Impl::AccessibleImpl::GetRole()
-{
- return self.GetProperty<Dali::Accessibility::Role>(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE);
-}
-
-Dali::Accessibility::States Control::Impl::AccessibleImpl::CalculateStates()
-{
- Dali::Accessibility::States s;
- s[Dali::Accessibility::State::FOCUSABLE] = self.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE);
- s[Dali::Accessibility::State::FOCUSED] = Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor() == self;
- if(self.GetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE).GetType() == Property::NONE)
- s[Dali::Accessibility::State::HIGHLIGHTABLE] = false;
- else
- s[Dali::Accessibility::State::HIGHLIGHTABLE] = self.GetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE).Get<bool>();
- s[Dali::Accessibility::State::HIGHLIGHTED] = GetCurrentlyHighlightedActor() == self;
- s[Dali::Accessibility::State::ENABLED] = true;
- s[Dali::Accessibility::State::SENSITIVE] = true;
- s[Dali::Accessibility::State::ANIMATED] = self.GetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED).Get<bool>();
- s[Dali::Accessibility::State::VISIBLE] = true;
- if(modal)
- {
- s[Dali::Accessibility::State::MODAL] = true;
- }
- s[Dali::Accessibility::State::SHOWING] = !self.GetProperty(Dali::DevelActor::Property::CULLED).Get<bool>() && self.GetCurrentProperty<bool>(Actor::Property::VISIBLE);
-
- s[Dali::Accessibility::State::DEFUNCT] = !self.GetProperty(Dali::DevelActor::Property::CONNECTED_TO_SCENE).Get<bool>();
- return s;
-}
-
-Dali::Accessibility::States Control::Impl::AccessibleImpl::GetStates()
-{
- return CalculateStates();
-}
-
-Dali::Accessibility::Attributes Control::Impl::AccessibleImpl::GetAttributes()
-{
- std::unordered_map<std::string, std::string> attribute_map;
- auto q = Dali::Toolkit::Control::DownCast(self);
- auto w =
- q.GetProperty(Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES);
- auto z = w.GetMap();
-
- if(z)
- {
- auto map_size = z->Count();
-
- for(unsigned int i = 0; i < map_size; i++)
- {
- auto map_key = z->GetKeyAt(i);
- if(map_key.type == Property::Key::STRING)
- {
- std::string map_value;
- if(z->GetValue(i).Get(map_value))
- {
- attribute_map.emplace(std::move(map_key.stringKey),
- std::move(map_value));
- }
- }
- }
- }
-
- return attribute_map;
-}
-
-Dali::Accessibility::ComponentLayer Control::Impl::AccessibleImpl::GetLayer()
-{
- return Dali::Accessibility::ComponentLayer::WINDOW;
-}
-
-Dali::Rect<> Control::Impl::AccessibleImpl::GetExtents(Dali::Accessibility::CoordType ctype)
-{
- Vector2 screenPosition =
- self.GetProperty(Dali::DevelActor::Property::SCREEN_POSITION)
- .Get<Vector2>();
- auto size = self.GetCurrentProperty<Vector3>(Actor::Property::SIZE) * self.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE);
- bool positionUsesAnchorPoint =
- self.GetProperty(Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT)
- .Get<bool>();
- Vector3 anchorPointOffSet =
- size * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT)
- : AnchorPoint::TOP_LEFT);
- Vector2 position = Vector2(screenPosition.x - anchorPointOffSet.x,
- screenPosition.y - anchorPointOffSet.y);
-
- return {position.x, position.y, size.x, size.y};
-}
-
-int16_t Control::Impl::AccessibleImpl::GetMdiZOrder()
-{
- return 0;
-}
-double Control::Impl::AccessibleImpl::GetAlpha()
-{
- return 0;
-}
-
-bool Control::Impl::AccessibleImpl::GrabFocus()
-{
- return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(self);
-}
-
-static Dali::Actor CreateHighlightIndicatorActor()
-{
- std::string focusBorderImagePath(AssetManager::GetDaliImagePath());
- focusBorderImagePath += "/keyboard_focus.9.png";
- // Create the default if it hasn't been set and one that's shared by all the
- // keyboard focusable actors
- auto actor = Toolkit::ImageView::New(focusBorderImagePath);
- actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
- DevelControl::AppendAccessibilityAttribute(actor, "highlight", "");
- actor.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED, true);
- actor.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, false);
-
- return actor;
-}
-
-bool Control::Impl::AccessibleImpl::GrabHighlight()
-{
- auto old = GetCurrentlyHighlightedActor();
-
- if(!Dali::Accessibility::IsUp())
- return false;
- if(self == old)
- return true;
- if(old)
- {
- auto c = dynamic_cast<Dali::Accessibility::Component*>(GetAccessibilityObject(old));
- if(c)
- c->ClearHighlight();
- }
- auto highlight = GetHighlightActor();
- if(!highlight)
- {
- highlight = CreateHighlightIndicatorActor();
- SetHighlightActor(highlight);
- }
- highlight.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- highlight.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
- highlight.SetProperty(Actor::Property::POSITION_Z, 1.0f);
- highlight.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
-
- EnsureSelfVisible();
- self.Add(highlight);
- SetCurrentlyHighlightedActor(self);
- EmitHighlighted(true);
-
- return true;
-}
-
-bool Control::Impl::AccessibleImpl::ClearHighlight()
-{
- if(!Dali::Accessibility::IsUp())
- return false;
- if(GetCurrentlyHighlightedActor() == self)
- {
- self.Remove(GetHighlightActor());
- SetCurrentlyHighlightedActor({});
- EmitHighlighted(false);
- return true;
- }
- return false;
-}
-
-std::string Control::Impl::AccessibleImpl::GetActionName(size_t index)
-{
- if(index >= GetActionCount()) return "";
- Dali::TypeInfo type;
- self.GetTypeInfo(type);
- DALI_ASSERT_ALWAYS(type && "no TypeInfo object");
- return type.GetActionName(index);
-}
-std::string Control::Impl::AccessibleImpl::GetLocalizedActionName(size_t index)
-{
- // TODO: add localization
- return GetActionName(index);
-}
-std::string Control::Impl::AccessibleImpl::GetActionDescription(size_t index)
-{
- return "";
-}
-size_t Control::Impl::AccessibleImpl::GetActionCount()
-{
- Dali::TypeInfo type;
- self.GetTypeInfo(type);
- DALI_ASSERT_ALWAYS(type && "no TypeInfo object");
- return type.GetActionCount();
-}
-std::string Control::Impl::AccessibleImpl::GetActionKeyBinding(size_t index)
-{
- return "";
-}
-bool Control::Impl::AccessibleImpl::DoAction(size_t index)
-{
- std::string actionName = GetActionName(index);
- return self.DoAction(actionName, {});
-}
-bool Control::Impl::AccessibleImpl::DoAction(const std::string& name)
-{
- return self.DoAction(name, {});
-}
-
-bool Control::Impl::AccessibleImpl::DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo)
-{
- auto control = Dali::Toolkit::Control::DownCast(self);
-
- Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
- Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
-
- if(!controlImpl.mAccessibilityDoGestureSignal.Empty())
- {
- auto ret = std::make_pair(gestureInfo, false);
- controlImpl.mAccessibilityDoGestureSignal.Emit(ret);
- return ret.second;
- }
-
- return false;
-}
-
-std::vector<Dali::Accessibility::Relation> Control::Impl::AccessibleImpl::GetRelationSet()
-{
- auto control = Dali::Toolkit::Control::DownCast(self);
-
- Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
- Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
-
- std::vector<Dali::Accessibility::Relation> ret;
-
- auto& v = controlImpl.mAccessibilityRelations;
- for(auto i = 0u; i < v.size(); ++i)
- {
- if(v[i].empty())
- continue;
-
- ret.emplace_back(Accessibility::Relation{static_cast<Accessibility::RelationType>(i), v[i]});
- }
-
- return ret;
-}
-
-void Control::Impl::AccessibleImpl::EnsureChildVisible(Actor child)
-{
-}
-
-void Control::Impl::AccessibleImpl::EnsureSelfVisible()
-{
- auto parent = dynamic_cast<Control::Impl::AccessibleImpl*>(GetParent());
- if(parent)
- {
- parent->EnsureChildVisible(self);
- }
-}
-
-Property::Index Control::Impl::AccessibleImpl::GetNamePropertyIndex()
-{
- return Actor::Property::NAME;
-}
-
-Property::Index Control::Impl::AccessibleImpl::GetDescriptionPropertyIndex()
-{
- return Property::INVALID_INDEX;
-}
-
void Control::Impl::PositionOrSizeChangedCallback(PropertyNotification& p)
{
auto self = Dali::Actor::DownCast(p.GetTarget());
*/
class Control::Impl : public ConnectionTracker, public Visual::EventObserver
{
+ friend class Toolkit::DevelControl::AccessibleImpl;
+
public:
/**
* @brief Retrieves the implementation of the internal control class.
void AccessibilityRegister();
void AccessibilityDeregister();
- struct AccessibleImpl : public virtual Dali::Accessibility::Accessible,
- public virtual Dali::Accessibility::Component,
- public virtual Dali::Accessibility::Collection,
- public virtual Dali::Accessibility::Action
- {
- Dali::Actor self;
- bool modal = false, root = false;
-
- AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
-
- std::string GetName() override;
- virtual std::string GetNameRaw();
- std::string GetDescription() override;
- virtual std::string GetDescriptionRaw();
- Dali::Accessibility::Accessible* GetParent() override;
- size_t GetChildCount() override;
- Dali::Accessibility::Accessible* GetChildAtIndex(size_t index) override;
- size_t GetIndexInParent() override;
- Dali::Accessibility::Role GetRole() override;
- Dali::Accessibility::States GetStates() override;
- Dali::Accessibility::Attributes GetAttributes() override;
- Dali::Rect<> GetExtents(Dali::Accessibility::CoordType ctype) override;
- Dali::Accessibility::ComponentLayer GetLayer() override;
- int16_t GetMdiZOrder() override;
- bool GrabFocus() override;
- double GetAlpha() override;
- bool GrabHighlight() override;
- bool ClearHighlight() override;
-
- std::string GetActionName(size_t index) override;
- std::string GetLocalizedActionName(size_t index) override;
- std::string GetActionDescription(size_t index) override;
- size_t GetActionCount() override;
- std::string GetActionKeyBinding(size_t index) override;
- bool DoAction(size_t index) override;
- bool DoAction(const std::string& name) override;
- bool DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo) override;
- std::vector<Dali::Accessibility::Relation> GetRelationSet() override;
-
- virtual Dali::Accessibility::States CalculateStates();
- virtual void EnsureChildVisible(Actor child);
- virtual void EnsureSelfVisible();
- virtual Property::Index GetNamePropertyIndex();
- virtual Property::Index GetDescriptionPropertyIndex();
- };
-
std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Actor)> accessibilityConstructor;
std::unique_ptr<Dali::Accessibility::Accessible> accessibilityObject;
Dali::PropertyNotification accessibilityNotificationPosition, accessibilityNotificationSize, accessibilityNotificationCulled;
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <sstream>
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
using namespace Dali;
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
#include <sstream>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/controls/control/control-renderers.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
uvOffsets[0].x = 0.0f;
uvOffsets[0].y = 0.0f;
- for(i = 0; i < mNumSamples >> 1; i++)
+ for(i = 0; i<mNumSamples >> 1; i++)
{
w = CalcGaussianWeight((float)(i + 1));
weights[(i << 1) + 1] = w;
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
});
//Enable highightability
#include <dali/public-api/render-tasks/render-task-list.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
});
}
#include <dali/public-api/object/type-registry-helper.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
namespace Dali
{
{
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
#include <cstring> // for strcmp
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::PAGE_TAB_LIST));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::PAGE_TAB_LIST));
});
}
// INTERNAL INCLUDES
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
Dali::Accessibility::States Popup::AccessibleImpl::CalculateStates()
{
- auto states = Control::Impl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::AccessibleImpl::CalculateStates();
auto popup = Toolkit::Popup::DownCast(self);
auto displayState = popup.GetProperty<std::string>(Toolkit::Popup::Property::DISPLAY_STATE);
#include <dali/public-api/animation/animation.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
protected:
- struct AccessibleImpl : public Control::Impl::AccessibleImpl
+ struct AccessibleImpl : public DevelControl::AccessibleImpl
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
std::string GetNameRaw() override;
Dali::Accessibility::States CalculateStates() override;
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visuals/arc-visual-properties-devel.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/public-api/align-enumerations.h>
*/
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar-devel.h>
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
Property::Map mSecondaryProgressVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
protected:
- struct AccessibleImpl : public Control::Impl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::AccessibleImpl,
public virtual Dali::Accessibility::Value
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
double GetMinimum() override;
double GetCurrent() override;
double GetMaximum() override;
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
bool mIndicatorFirstShow : 1; ///< True if the indicator has never been shown
protected:
- struct AccessibleImpl : public Control::Impl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::AccessibleImpl,
public virtual Dali::Accessibility::Value
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
double GetMinimum() override;
double GetCurrent() override;
double GetMaximum() override;
#include <dali/public-api/animation/alpha-function.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
virtual void SetOvershootSize(const Vector2& size) = 0;
protected: // From Control
- struct AccessibleImpl : public Control::Impl::AccessibleImpl
+ struct AccessibleImpl : public DevelControl::AccessibleImpl
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
bool IsScrollable() override;
};
#include <sstream>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/controls/control/control-renderers.h>
#include <dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h>
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
mSnapToMarks : 1; ///< Turn on or off snapping to marks
protected:
- struct AccessibleImpl : public Control::Impl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::AccessibleImpl,
public virtual Dali::Accessibility::Value
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
double GetMinimum() override;
double GetCurrent() override;
double GetMaximum() override;
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
});
}
#include <sstream>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
using namespace Dali;
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::TABLE));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TABLE));
});
}
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/text/rendering-backend.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/text/text-effects-style.h>
return mController->GetHeightForWidth(width) + padding.top + padding.bottom;
}
+void TextEditor::ResizeActor(Actor& actor, const Vector2& size)
+{
+ if(actor.GetProperty<Vector3>(Dali::Actor::Property::SIZE).GetVectorXY() != size)
+ {
+ actor.SetProperty(Actor::Property::SIZE, size);
+ }
+}
+
void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextEditor OnRelayout\n");
if(mStencil)
{
mStencil.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top));
+ ResizeActor(mStencil, contentSize);
}
if(mActiveLayer)
{
mActiveLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top));
+ ResizeActor(mActiveLayer, contentSize);
}
const Text::Controller::UpdateTextType updateTextType = mController->Relayout(contentSize, layoutDirection);
if(mDecorator &&
(Text::Controller::NONE_UPDATED != (Text::Controller::DECORATOR_UPDATED & updateTextType)))
{
- mDecorator->Relayout(size);
+ mDecorator->Relayout(contentSize);
}
if(!mRenderer)
}
RenderText(updateTextType);
+
+ // If there is text changed, callback is called.
+ if(mTextChanged)
+ {
+ Dali::Toolkit::TextEditor handle(GetOwner());
+ mTextChangedSignal.Emit(handle);
+ mTextChanged = false;
+ }
}
// The text-editor emits signals when the input style changes. These changes of style are
void TextEditor::TextChanged()
{
- Dali::Toolkit::TextEditor handle(GetOwner());
- mTextChangedSignal.Emit(handle);
+ mTextChanged = true;
}
void TextEditor::MaxLengthReached()
mHasBeenStaged(false),
mScrollAnimationEnabled(false),
mScrollBarEnabled(false),
- mScrollStarted(false)
+ mScrollStarted(false),
+ mTextChanged(false)
{
}
{
using namespace Dali::Accessibility;
- auto states = Control::Impl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::AccessibleImpl::CalculateStates();
states[State::EDITABLE] = true;
states[State::FOCUSABLE] = true;
#include <dali/public-api/animation/animation.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
TextEditor& operator=(const TextEditor& rhs);
/**
+ * @brief Resize actor to the given size.
+ *
+ * @param[in] actor The actor to be resized.
+ * @param[in] size Size to change.
+ */
+ void ResizeActor(Actor& actor, const Vector2& size);
+
+ /**
* @brief Render view, create and attach actor(s) to this text editor.
*/
void RenderText(Text::Controller::UpdateTextType updateTextType);
bool mScrollAnimationEnabled : 1;
bool mScrollBarEnabled : 1;
bool mScrollStarted : 1;
+ bool mTextChanged : 1;
- struct AccessibleImpl : public Control::Impl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::AccessibleImpl,
public virtual Dali::Accessibility::Text,
public virtual Dali::Accessibility::EditableText
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
std::string GetName() override;
std::string GetText(size_t startOffset, size_t endOffset) override;
return mController->GetHeightForWidth(width) + padding.top + padding.bottom;
}
+void TextField::ResizeActor(Actor& actor, const Vector2& size)
+{
+ if(actor.GetProperty<Vector3>(Dali::Actor::Property::SIZE).GetVectorXY() != size)
+ {
+ actor.SetProperty(Actor::Property::SIZE, size);
+ }
+}
+
void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextField OnRelayout\n");
if(mStencil)
{
mStencil.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top));
+ ResizeActor(mStencil, contentSize);
}
if(mActiveLayer)
{
mActiveLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top));
+ ResizeActor(mActiveLayer, contentSize);
}
const Text::Controller::UpdateTextType updateTextType = mController->Relayout(contentSize, layoutDirection);
if(mDecorator &&
(Text::Controller::NONE_UPDATED != (Text::Controller::DECORATOR_UPDATED & updateTextType)))
{
- mDecorator->Relayout(size);
+ mDecorator->Relayout(contentSize);
}
if(!mRenderer)
}
RenderText(updateTextType);
+
+ // If there is text changed, callback is called.
+ if(mTextChanged)
+ {
+ Dali::Toolkit::TextField handle(GetOwner());
+ mTextChangedSignal.Emit(handle);
+ mTextChanged = false;
+ }
}
// The text-field emits signals when the input style changes. These changes of style are
void TextField::TextChanged()
{
- Dali::Toolkit::TextField handle(GetOwner());
- mTextChangedSignal.Emit(handle);
+ mTextChanged = true;
}
void TextField::MaxLengthReached()
mAlignmentOffset(0.f),
mRenderingBackend(DEFAULT_RENDERING_BACKEND),
mExceedPolicy(Dali::Toolkit::TextField::EXCEED_POLICY_CLIP),
- mHasBeenStaged(false)
+ mHasBeenStaged(false),
+ mTextChanged(false)
{
}
{
using namespace Dali::Accessibility;
- auto states = Control::Impl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::AccessibleImpl::CalculateStates();
states[State::EDITABLE] = true;
states[State::FOCUSABLE] = true;
#include <dali/devel-api/adaptor-framework/input-method-context.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
TextField& operator=(const TextField& rhs);
/**
+ * @brief Resize actor to the given size.
+ *
+ * @param[in] actor The actor to be resized.
+ * @param[in] size Size to change.
+ */
+ void ResizeActor(Actor& actor, const Vector2& size);
+
+ /**
* @brief Render view, create and attach actor(s) to this Text Field.
*/
void RenderText(Text::Controller::UpdateTextType updateTextType);
int mRenderingBackend;
int mExceedPolicy;
bool mHasBeenStaged : 1;
+ bool mTextChanged : 1;
protected:
- struct AccessibleImpl : public Control::Impl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::AccessibleImpl,
public virtual Dali::Accessibility::Text,
public virtual Dali::Accessibility::EditableText
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
std::string GetName() override;
std::string GetText(size_t startOffset, size_t endOffset) override;
bool mTextUpdateNeeded : 1;
protected:
- struct AccessibleImpl : public Control::Impl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::AccessibleImpl,
public virtual Dali::Accessibility::Text
{
- using Control::Impl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::AccessibleImpl::AccessibleImpl;
std::string GetText(size_t startOffset, size_t endOffset) override;
size_t GetCharacterCount() override;
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::DIALOG, true));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::DIALOG, true));
});
//Enable highightability
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/helpers/color-conversion.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
});
}
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/alignment/alignment.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
namespace Dali
{
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
});
}
#include <cstring>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/public-api/controls/video-view/video-view.h>
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::VIDEO));
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::VIDEO));
});
}
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "title", STRING, TITLE )
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "videoHoleEnabled", BOOLEAN, VIDEO_HOLE_ENABLED)
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError", PAGE_LOAD_ERROR_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached", SCROLL_EDGE_REACHED_SIGNAL)
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL)
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError", PAGE_LOAD_ERROR_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached", SCROLL_EDGE_REACHED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged", URL_CHANGED_SIGNAL )
DALI_TYPE_REGISTRATION_END()
// clang-format on
mPageLoadFinishedSignal(),
mPageLoadErrorSignal(),
mVideoHoleEnabled(true),
- mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height)
+ mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
+ mUrlChangedSignal()
{
mWebEngine = Dali::WebEngine::New();
mPageLoadFinishedSignal(),
mPageLoadErrorSignal(),
mVideoHoleEnabled(true),
- mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height)
+ mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
+ mUrlChangedSignal()
{
mWebEngine = Dali::WebEngine::New();
if(mWebEngine)
{
- mWebEngine.PageLoadStartedSignal().Connect(this, &WebView::OnPageLoadStarted);
- mWebEngine.PageLoadFinishedSignal().Connect(this, &WebView::OnPageLoadFinished);
- mWebEngine.PageLoadErrorSignal().Connect(this, &WebView::OnPageLoadError);
- mWebEngine.ScrollEdgeReachedSignal().Connect(this, &WebView::OnScrollEdgeReached);
+ mWebEngine.PageLoadStartedSignal().Connect( this, &WebView::OnPageLoadStarted );
+ mWebEngine.PageLoadInProgressSignal().Connect(this, &WebView::OnPageLoadInProgress);
+ mWebEngine.PageLoadFinishedSignal().Connect( this, &WebView::OnPageLoadFinished );
+ mWebEngine.PageLoadErrorSignal().Connect( this, &WebView::OnPageLoadError );
+ mWebEngine.ScrollEdgeReachedSignal().Connect( this, &WebView::OnScrollEdgeReached );
+ mWebEngine.UrlChangedSignal().Connect(this, &WebView::OnUrlChanged);
mWebContext = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
mWebCookieManager = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
}
}
-void WebView::ClearAllTilesResources()
+void WebView::RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
{
if(mWebEngine)
{
- mWebEngine.ClearAllTilesResources();
+ mWebEngine.RegisterJavaScriptAlertCallback( callback );
+ }
+}
+
+void WebView::JavaScriptAlertReply()
+{
+ if ( mWebEngine )
+ {
+ mWebEngine.JavaScriptAlertReply();
+ }
+}
+
+void WebView::RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
+{
+ if ( mWebEngine )
+ {
+ mWebEngine.RegisterJavaScriptConfirmCallback( callback );
+ }
+}
+
+void WebView::JavaScriptConfirmReply( bool confirmed )
+{
+ if ( mWebEngine )
+ {
+ mWebEngine.JavaScriptConfirmReply( confirmed );
+ }
+}
+
+void WebView::RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
+{
+ if ( mWebEngine )
+ {
+ mWebEngine.RegisterJavaScriptPromptCallback( callback );
+ }
+}
+
+void WebView::JavaScriptPromptReply( const std::string& result )
+{
+ if ( mWebEngine )
+ {
+ mWebEngine.JavaScriptPromptReply( result );
}
}
}
}
+void WebView::ClearAllTilesResources()
+{
+ if( mWebEngine )
+ {
+ mWebEngine.ClearAllTilesResources();
+ }
+}
+
Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
{
return mPageLoadStartedSignal;
}
+Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadInProgressSignal()
+{
+ return mPageLoadInProgressSignal;
+}
+
Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
{
return mPageLoadFinishedSignal;
return mScrollEdgeReachedSignal;
}
-void WebView::OnPageLoadStarted(const std::string& url)
+Dali::Toolkit::WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal()
+{
+ return mUrlChangedSignal;
+}
+
+void WebView::OnPageLoadStarted( const std::string& url )
{
if(!mPageLoadStartedSignal.Empty())
{
}
}
-void WebView::OnPageLoadFinished(const std::string& url)
+void WebView::OnPageLoadInProgress( const std::string& url )
+{
+ if ( !mPageLoadInProgressSignal.Empty() )
+ {
+ Dali::Toolkit::WebView handle( GetOwner() );
+ mPageLoadInProgressSignal.Emit( handle, url );
+ }
+}
+
+void WebView::OnPageLoadFinished( const std::string& url )
{
if(!mPageLoadFinishedSignal.Empty())
{
}
}
-bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
+void WebView::OnUrlChanged(const std::string& url)
+{
+ if (!mUrlChangedSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mUrlChangedSignal.Emit(handle, url);
+ }
+}
+
+bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
Dali::BaseHandle handle(object);
webView.PageLoadStartedSignal().Connect(tracker, functor);
connected = true;
}
+ else if (0 == strcmp(signalName.c_str(), PAGE_LOAD_IN_PROGRESS_SIGNAL))
+ {
+ webView.PageLoadInProgressSignal().Connect(tracker, functor);
+ connected = true;
+ }
else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_FINISHED_SIGNAL))
{
webView.PageLoadFinishedSignal().Connect(tracker, functor);
webView.ScrollEdgeReachedSignal().Connect(tracker, functor);
connected = true;
}
+ else if (0 == strcmp(signalName.c_str(), URL_CHANGED_SIGNAL))
+ {
+ webView.UrlChangedSignal().Connect( tracker, functor );
+ connected = true;
+ }
return connected;
}
void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
/**
- * @brief Clears all tiles resources of Web.
+ * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback()
*/
- void ClearAllTilesResources();
+ void RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback );
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::JavaScriptAlertReply()
+ */
+ void JavaScriptAlertReply();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptConfirmCallback()
+ */
+ void RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback );
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::JavaScriptConfirmReply()
+ */
+ void JavaScriptConfirmReply( bool confirmed );
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptPromptCallback()
+ */
+ void RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::JavaScriptPromptReply()
+ */
+ void JavaScriptPromptReply( const std::string& result );
/**
* @copydoc Dali::Toolkit::WebView::ClearHistory()
void ClearHistory();
/**
+ * @brief Clears all tiles resources of Web.
+ */
+ void ClearAllTilesResources();
+
+ /**
* @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
*/
Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();
/**
+ * @copydoc Dali::Toolkit::WebView::PageLoadInProgressSignal()
+ */
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadInProgressSignal();
+
+ /**
* @copydoc Dali::Toolkit::WebView::PageLoadFinishedSignal()
*/
Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadFinishedSignal();
*/
Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+ /**
+ * @copydoc Dali::Toolkit::WebView::UrlChangedSignal()
+ */
+ Dali::Toolkit::WebView::WebViewUrlChangedSignalType& UrlChangedSignal();
+
public: // Properties
/**
* @brief Called when a property of an object of this type is set.
void OnPageLoadStarted(const std::string& url);
/**
+ * @brief Callback function to be called when page is loading in progress.
+ * @param[in] url The url currently being loaded
+ */
+ void OnPageLoadInProgress( const std::string& url );
+
+ /**
* @brief Callback function to be called when page load finished.
* @param[in] url The url currently being loaded
*/
*/
void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge);
+ /**
+ * @brief Callback function to be called when url is changed.
+ * @param[in] url The url currently being loaded
+ */
+ void OnUrlChanged( const std::string& url );
+
private:
- std::string mUrl;
- Dali::Toolkit::Visual::Base mVisual;
- Dali::Size mWebViewSize;
- Dali::WebEngine mWebEngine;
-
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
+ std::string mUrl;
+ Dali::Toolkit::Visual::Base mVisual;
+ Dali::Size mWebViewSize;
+ Dali::WebEngine mWebEngine;
+
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
- std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
- std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
- std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
- Dali::Toolkit::ImageView mFaviconView;
-
- Dali::PropertyNotification mPositionUpdateNotification;
- Dali::PropertyNotification mSizeUpdateNotification;
- Dali::PropertyNotification mScaleUpdateNotification;
- bool mVideoHoleEnabled;
- Dali::Rect<int> mWebViewArea;
+ std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
+ std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
+ std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
+ std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
+ Dali::Toolkit::ImageView mFaviconView;
+
+ Dali::PropertyNotification mPositionUpdateNotification;
+ Dali::PropertyNotification mSizeUpdateNotification;
+ Dali::PropertyNotification mScaleUpdateNotification;
+ bool mVideoHoleEnabled;
+ Dali::Rect< int > mWebViewArea;
+ Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal;
};
} // namespace Internal
1,
UPDATE_INPUT_STYLE);
}
- else if(keyCode == Dali::DevelKey::DALI_KEY_DELETE)
+ else if((controller.mImpl->mEventData->mPrimaryCursorPosition < controller.mImpl->mModel->mLogicalModel->mText.Count()) &&
+ (keyCode == Dali::DevelKey::DALI_KEY_DELETE))
{
// Remove the character after the current cursor position
removed = controller.RemoveText(0,
void Controller::Relayouter::CalculateVerticalOffset(Controller& controller, const Size& controlSize)
{
- Controller::Impl& impl = *controller.mImpl;
- ModelPtr& model = impl.mModel;
- Size layoutSize = model->mVisualModel->GetLayoutSize();
+ Controller::Impl& impl = *controller.mImpl;
+ ModelPtr& model = impl.mModel;
+ VisualModelPtr& visualModel = model->mVisualModel;
+ Size layoutSize = model->mVisualModel->GetLayoutSize();
+ Size oldLayoutSize = layoutSize;
+ float offsetY = 0.f;
+ bool needRecalc = false;
+ float defaultFontLineHeight = impl.GetDefaultFontLineHeight();
if(fabsf(layoutSize.height) < Math::MACHINE_EPSILON_1000)
{
// Get the line height of the default font.
- layoutSize.height = impl.GetDefaultFontLineHeight();
+ layoutSize.height = defaultFontLineHeight;
+ }
+
+ // Whether the text control is editable
+ const bool isEditable = NULL != impl.mEventData;
+ if (isEditable && layoutSize.height != defaultFontLineHeight)
+ {
+ // This code prevents the wrong positioning of cursor when the layout size is bigger/smaller than defaultFontLineHeight.
+ // This situation occurs when the size of placeholder text is different from the default text.
+ layoutSize.height = defaultFontLineHeight;
+ needRecalc = true;
}
switch(model->mVerticalAlignment)
case VerticalAlignment::TOP:
{
model->mScrollPosition.y = 0.f;
+ offsetY = 0.f;
break;
}
case VerticalAlignment::CENTER:
{
model->mScrollPosition.y = floorf(0.5f * (controlSize.height - layoutSize.height)); // try to avoid pixel alignment.
+ if (needRecalc) offsetY = floorf(0.5f * (layoutSize.height - oldLayoutSize.height));
break;
}
case VerticalAlignment::BOTTOM:
{
model->mScrollPosition.y = controlSize.height - layoutSize.height;
+ if (needRecalc) offsetY = layoutSize.height - oldLayoutSize.height;
break;
}
}
+
+ if (needRecalc)
+ {
+ // Update glyphPositions according to recalculation.
+ const Length positionCount = visualModel->mGlyphPositions.Count();
+ Vector<Vector2>& glyphPositions = visualModel->mGlyphPositions;
+ for(Length index = 0u; index < positionCount; index++)
+ {
+ glyphPositions[index].y += offsetY;
+ }
+ }
+
}
} // namespace Text
UnregisterProcessor();
}
-void SvgRasterizeThread::DeleteImage(VectorImageRenderer vectorRenderer)
-{
- // Lock while adding image to the delete queue
- ConditionalWait::ScopedLock lock(mConditionalWait);
-
- if(mIsThreadWaiting) // no rasterization is ongoing, save to delete
- {
- // TODO: what?
- }
- else // wait to delete until current rasterization completed.
- {
- mDeleteSvg.PushBack(&vectorRenderer);
- }
-}
-
RasterizingTaskPtr SvgRasterizeThread::NextTaskToProcess()
{
// Lock while popping task out from the queue
ConditionalWait::ScopedLock lock(mConditionalWait);
- // Delete the image here to make sure that it is not used in the nsvgRasterize()
- if(!mDeleteSvg.Empty())
- {
- mDeleteSvg.Clear();
- }
-
// conditional wait
while(mRasterizeTasks.empty())
{
void RemoveTask(SvgVisual* visual);
/**
- * Delete the parsed SVG image, called by main thread.
- *
- * The parsed svg should be deleted in worker thread, as the main thread does not know whether a rasterization of this svg is ongoing.
- *
- * @param[in] VectorImage The image to be deleted
- */
- void DeleteImage(VectorImageRenderer vectorImage);
-
- /**
* @copydoc Dali::Integration::Processor::Process()
*/
void Process() override;
private:
std::vector<RasterizingTaskPtr> mRasterizeTasks; //The queue of the tasks waiting to rasterize the SVG image
std::vector<RasterizingTaskPtr> mCompletedTasks; //The queue of the tasks with the SVG rasterization completed
- Vector<VectorImageRenderer*> mDeleteSvg; //The images that the event thread requested to delete
ConditionalWait mConditionalWait;
Dali::Mutex mMutex;
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 13;
+const unsigned int TOOLKIT_MICRO_VERSION = 17;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.0.13
+Version: 2.0.17
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT
Summary: DLI scene loading library
Group: System/Libraries
License: Apache-2.0
-
-BuildRequires: pkgconfig(dali2-toolkit)
+Requires: dali2-toolkit
%description -n %{dali2_scene_loader}
Provides functionality for loading and displaying DLI format scenes. See README.md for more details.