[Webkit-unassigned] [Bug 74921] [EFL] Add new commands for Ewk_Editor_Command.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 25 08:05:42 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=74921





--- Comment #11 from Raphael Kubo da Costa (rakuco) <rakuco at webkit.org>  2012-04-25 08:05:41 PST ---
(From update of attachment 138327)
I think separating the enum definition from the _ewk_editor_commands array is error prone; one might inadvertently make the two data structures out of sync and cause havoc. How about doing the following in ewk_editor.cpp (this is similar to what exists in EditorClientQt.cpp):

  struct EditorCommand {
      Ewk_Editor_Command ewkCommand;
      const char editorCommand;
  };

  static const EditorCommand editorCommands[] = {
      { EWK_EDITOR_COMMAND_INSERT_IMAGE, "InsertImage" },
      { EWK_EDITOR_COMMAND_INSERT_TEXT, "InsertText" },
      // ...
  };

  static const char* _ewk_editor_command_get(Ewk_Editor_Command command)
  {
      static Eina_Hash* commandHash = 0;

      if (!commandHash) {
          // Initialize the hash map with Ewk_Editor_Command as key and
          // a const char* as value.
      }

      return static_cast<const char*>(eina_hash_find(...));
  }

  Eina_Bool ewk_editor_command_execute(...)
  {
      // ...
  }

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list