Bug 530629 - Add fastFind support to <editor> element. r=Neil
authoraceman <acelists@atlas.sk>
Fri, 18 Apr 2014 10:30:04 -0400
changeset 179647 0ce418853a12b5e7c91ec1b66e24cf97665621cd
parent 179646 d947c69441bcd987e482be609ab56e60ff9e043b
child 179648 d69cced6e24223c83aabd152b3f2208556da88dd
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersNeil
bugs530629
milestone31.0a1
Bug 530629 - Add fastFind support to <editor> element. r=Neil
toolkit/content/widgets/editor.xml
--- a/toolkit/content/widgets/editor.xml
+++ b/toolkit/content/widgets/editor.xml
@@ -82,16 +82,55 @@
         <parameter name="containingWindow"/>
         <body>
         <![CDATA[
           var editor = this.editingSession.getEditorForWindow(containingWindow);
           return editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
         ]]>
         </body>
       </method>
+
+      <field name="_finder">null</field>
+      <property name="finder" readonly="true">
+        <getter><![CDATA[
+          if (!this._finder) {
+            if (!this.docShell)
+              return null;
+
+            let Finder = Components.utils.import("resource://gre/modules/Finder.jsm", {}).Finder;
+            this._finder = new Finder(this.docShell);
+          }
+          return this._finder;
+        ]]></getter>
+      </property>
+
+      <field name="_fastFind">null</field>
+      <property name="fastFind"
+                readonly="true">
+        <getter>
+        <![CDATA[
+          if (!this._fastFind) {
+            if (!("@mozilla.org/typeaheadfind;1" in Components.classes))
+              return null;
+
+            if (!this.docShell)
+              return null;
+
+            this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"]
+                                       .createInstance(Components.interfaces.nsITypeAheadFind);
+            this._fastFind.init(this.docShell);
+          }
+          return this._fastFind;
+        ]]>
+        </getter>
+      </property>
+
+      <field name="_lastSearchString">null</field>
+      <field name="_lastSearchHighlight">false</field>
+
       <property name="editortype"
                 onget="return this.getAttribute('editortype');"
                 onset="this.setAttribute('editortype', val); return val;"/>
       <property name="webNavigation"
                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
                 readonly="true"/>
       <property name="contentDocument" readonly="true"
                 onget="return this.webNavigation.document;"/>