Implement RenderWidgetHostViewEfl::ImeCompositionRangeChanged()
authorMurugappan Nataraj <m.nataraj@samsung.com>
Mon, 21 Apr 2014 08:49:22 +0000 (14:19 +0530)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
Implementation provided to set composition range. 1 new function added.
This commit is part of EFL port P0 API implementation.

Additionally, RenderWidgetHostViewEfl now also inherits from
TextInputClient. Most overwritten methods got stub implementations,
except for GetCompositionCharacterBounds and DidStopFlinging.

Change-Id: I65b3d87dc41595694b22dae5b638a75daa4106fc

tizen_src/impl/browser/renderer_host/render_widget_host_view_efl.cc
tizen_src/impl/browser/renderer_host/render_widget_host_view_efl.h

index 900dc04..335198d 100644 (file)
@@ -267,10 +267,27 @@ void RenderWidgetHostViewEfl::ImeCancelComposition() {
     im_context_->CancelComposition();
 }
 
+bool RenderWidgetHostViewEfl::GetCompositionCharacterBounds(uint32 index, gfx::Rect* rect) const
+{
+  DCHECK(rect);
+  if (index >= composition_character_bounds_.size())
+    return false;
+
+  *rect = composition_character_bounds_[index];
+  return true;
+}
+
 void RenderWidgetHostViewEfl::ImeCompositionRangeChanged(
-  const gfx::Range&, 
-  const std::vector<gfx::Rect>&) {
-  NOTIMPLEMENTED();
+    const gfx::Range& range,
+    const std::vector<gfx::Rect>& character_bounds) {
+  SelectionControllerEfl* controller = web_view_->GetSelectionController();
+  if (controller) {
+    if(controller->GetCaretSelectionStatus()){
+      controller->SetCaretSelectionStatus(false);
+    }
+  }
+
+  composition_character_bounds_ = character_bounds;
 }
 
 void RenderWidgetHostViewEfl::DidUpdateBackingStore(
index 03aa95e..4c6e40d 100644 (file)
@@ -20,6 +20,7 @@
 #include "content/browser/accessibility/browser_accessibility_manager.h"
 #include "content/browser/compositor/image_transport_factory.h"
 #include "content/browser/compositor/owned_mailbox.h"
+#include "ui/base/ime/text_input_client.h"
 #include "eweb_view.h"
 #include <Evas.h>
 #include <Ecore_Evas.h>
@@ -43,6 +44,7 @@ class ReadbackYUVInterface;
 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
 class RenderWidgetHostViewEfl
   : public RenderWidgetHostViewBase,
+    public ui::TextInputClient,
     public base::SupportsWeakPtr<RenderWidgetHostViewEfl>,
     public IPC::Sender {
  public:
@@ -133,12 +135,42 @@ class RenderWidgetHostViewEfl
   // IPC::Sender implementation:
   virtual bool Send(IPC::Message*) OVERRIDE;
 
+  // Overridden from ui::TextInputClient implementation:
+  virtual void SetCompositionText(
+      const ui::CompositionText& composition) OVERRIDE {}
+  virtual void ConfirmCompositionText() OVERRIDE {}
+  virtual void ClearCompositionText() OVERRIDE {}
+  virtual void InsertText(const base::string16& text) OVERRIDE {}
+  virtual void InsertChar(base::char16 ch, int flags) OVERRIDE {}
+  virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE { return gfx::NativeWindow(); }
+  virtual ui::TextInputType GetTextInputType() const OVERRIDE { return ui::TextInputType(); }
+  virtual ui::TextInputMode GetTextInputMode() const OVERRIDE { return ui::TextInputMode(); }
+  virtual bool CanComposeInline() const OVERRIDE { return false; }
+  virtual gfx::Rect GetCaretBounds() const OVERRIDE { return gfx::Rect(); }
+  virtual bool GetCompositionCharacterBounds(uint32 index,
+                                             gfx::Rect* rect) const OVERRIDE;
+  virtual bool HasCompositionText() const OVERRIDE { return false; }
+  virtual bool GetTextRange(gfx::Range* range) const OVERRIDE { return false; }
+  virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE { return false; }
+  virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE { return false; }
+  virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE { return false; }
+  virtual bool DeleteRange(const gfx::Range& range) OVERRIDE { return false; }
+  virtual bool GetTextFromRange(const gfx::Range& range,
+                                base::string16* text) const OVERRIDE { return false; }
+  virtual void OnInputMethodChanged() OVERRIDE {}
+  virtual bool ChangeTextDirectionAndLayoutAlignment(
+      base::i18n::TextDirection direction) OVERRIDE { return false; }
+  virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE {}
+  virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE {}
+  virtual void OnCandidateWindowShown() OVERRIDE {}
+  virtual void OnCandidateWindowUpdated() OVERRIDE {}
+  virtual void OnCandidateWindowHidden() OVERRIDE {}
+
   void OnDidFirstVisuallyNonEmptyLayout();
   void OnSelectionTextStyleState(const SelectionStylePrams&);
   void OnDidChangeMaxScrollOffset(int, int);
 
-  Evas* evas() const
-  {
+  Evas* evas() const {
     DCHECK(evas_);
     return evas_;
   } 
@@ -149,7 +181,7 @@ class RenderWidgetHostViewEfl
 
   void HandleShow();
   void HandleHide();
-  void HandleMove(int, int) { }
+  void HandleMove(int, int) {}
   void HandleResize(int, int );
   void HandleFocusIn();
   void HandleFocusOut();
@@ -205,6 +237,9 @@ class RenderWidgetHostViewEfl
   typedef std::map<gfx::PluginWindowHandle, Ecore_X_Window> PluginWindowToWidgetMap;
   PluginWindowToWidgetMap plugin_window_to_widget_map_;
 
+  // The current composition character bounds.
+  std::vector<gfx::Rect> composition_character_bounds_;
+
   // YUV readback pipeline.
   scoped_ptr<content::ReadbackYUVInterface>
       yuv_readback_pipeline_;