Bug 393820 - expose bounds of accessible for accessible properties view, r=swilsh, l10n, sr=neil, a=dsicore
authorsurkov.alexander@gmail.com
Tue, 05 Feb 2008 23:04:36 -0800
changeset 11246 73d7e0778a8730b2aaed108ed0a392e3ce733463
parent 11245 ff046a01d0c5ed9a77a786821436b9fe16724774
child 11247 7e350be8d85f5824d409779a63ee48c6dc328e61
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersswilsh, l10n, neil, dsicore
bugs393820
milestone1.9b4pre
Bug 393820 - expose bounds of accessible for accessible properties view, r=swilsh, l10n, sr=neil, a=dsicore
extensions/inspector/resources/content/viewers/accessibleProps/accessibleProps.js
extensions/inspector/resources/content/viewers/accessibleProps/accessibleProps.xul
extensions/inspector/resources/locale/en-US/viewers/accessibleProps.dtd
extensions/inspector/resources/locale/en-US/viewers/accessibleProps.properties
extensions/inspector/resources/locale/jar.mn
--- a/extensions/inspector/resources/content/viewers/accessibleProps/accessibleProps.js
+++ b/extensions/inspector/resources/content/viewers/accessibleProps/accessibleProps.js
@@ -36,16 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
  
  
 ///////////////////////////////////////////////////////////////////////////////
 //// Global Variables
 
 var viewer;
+var gBundle;
 
 ///////////////////////////////////////////////////////////////////////////////
 //// Global Constants
 
 const kAccessibleRetrievalCID = "@mozilla.org/accessibleRetrieval;1";
 
 const nsIAccessibleRetrieval = Components.interfaces.nsIAccessibleRetrieval;
 const nsIAccessible = Components.interfaces.nsIAccessible;
@@ -54,16 +55,18 @@ const nsIPropertyElement = Components.in
 
 ///////////////////////////////////////////////////////////////////////////////
 //// Initialization/Destruction
 
 window.addEventListener("load", AccessiblePropsViewer_initialize, false);
 
 function AccessiblePropsViewer_initialize()
 {
+  gBundle = document.getElementById("accessiblePropsBundle");
+
   viewer = new AccessiblePropsViewer();
   viewer.initialize(parent.FrameExchange.receiveData(window));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 //// class AccessiblePropsViewer
 function AccessiblePropsViewer()
 {
@@ -131,32 +134,50 @@ AccessiblePropsViewer.prototype =
         XPCU.QI(this.mAccSubject, nsIAccessible);
       else
         this.mAccSubject = this.mAccService.getAccessibleFor(this.mSubject);
     } catch(e) {
       dump("Failed to get accessible object for node.");
       return;
     }
 
+    // accessible properties.
     var containers = document.getElementsByAttribute("prop", "*");
     for (var i = 0; i < containers.length; ++i) {
       var value = "";
       try {
         var prop = containers[i].getAttribute("prop");
         value = this[prop];
       } catch (e) {
         dump("Accessibility " + prop + " property is not available.\n");
       }
 
       if (value instanceof Array)
         containers[i].textContent = value.join(", ");
       else
         containers[i].textContent = value;
     }
 
+    // accessible bounds
+    var x = { value: 0 };
+    var y = { value: 0 };
+    var width = {value: 0 };
+    var height = {value: 0 };
+    this.mAccSubject.getBounds(x, y, width, height);
+
+    document.getElementById("bounds-x").textContent =
+      gBundle.getFormattedString("accBoundsX", [x.value]);
+    document.getElementById("bounds-y").textContent =
+      gBundle.getFormattedString("accBoundsY", [y.value]);
+    document.getElementById("bounds-width").textContent =
+      gBundle.getFormattedString("accBoundsWidth", [width.value]);
+    document.getElementById("bounds-height").textContent =
+      gBundle.getFormattedString("accBoundsHeight", [height.value]);
+
+    // accessible attributes
     var attrs = this.mAccSubject.attributes;
     if (attrs) {
       var enumerate = attrs.enumerate();
       while (enumerate.hasMoreElements())
         this.addAccessibleAttribute(enumerate.getNext());
     }
   },
 
--- a/extensions/inspector/resources/content/viewers/accessibleProps/accessibleProps.xul
+++ b/extensions/inspector/resources/content/viewers/accessibleProps/accessibleProps.xul
@@ -51,16 +51,19 @@
 
   <script type="application/javascript"
           src="chrome://inspector/content/jsutil/xpcom/XPCU.js"/>
   <script type="application/javascript"
           src="chrome://inspector/content/jsutil/events/ObserverManager.js"/>
   <script type="application/javascript"
           src="chrome://inspector/content/viewers/accessibleProps/accessibleProps.js"/>
 
+  <stringbundle id="accessiblePropsBundle"
+                src="chrome://inspector/locale/viewers/accessibleProps.properties"/>
+
   <grid>
     <columns>
       <column/>
       <column flex="1"/>
     </columns>
     <rows>
       <row>
         <description>&descRole.label;</description>
@@ -81,19 +84,39 @@
       <row>
         <description>&descState.label;</description>
         <description prop="state"/>
       </row>
       <row>
         <description>&descActionName.label;</description>
         <description prop="actionNames"/>
       </row>
+      <row>
+        <description>&descBounds.label;</description>
+        <grid>
+          <columns>
+            <column/>
+            <column/>
+            <column/>
+            <column/>
+          </columns>
+          <rows>
+            <row>
+              <description id="bounds-x"/>
+              <description id="bounds-y"/>
+              <description id="bounds-width"/>
+              <description id="bounds-height"/>
+            </row>
+          </rows>
+        </grid>
+      </row>
     </rows>
   </grid>
-  
+
   <tree flex="1">
     <treecols>
       <treecol label="attrKey" flex="1"/>
       <treecol label="attrValue" flex="2"/>
     </treecols>
     <treechildren id="trAttrBody"/>
   </tree>
 </page>
+
--- a/extensions/inspector/resources/locale/en-US/viewers/accessibleProps.dtd
+++ b/extensions/inspector/resources/locale/en-US/viewers/accessibleProps.dtd
@@ -37,8 +37,10 @@
 #endif
    - ***** END LICENSE BLOCK ***** -->
 <!ENTITY descRole.label "Role:">
 <!ENTITY descName.label "Name:">
 <!ENTITY descDescription.label "Description:">
 <!ENTITY descValue.label "Value:">
 <!ENTITY descState.label "State:">
 <!ENTITY descActionName.label "Action Name:">
+<!ENTITY descBounds.label "Bounds:">
+
new file mode 100644
--- /dev/null
+++ b/extensions/inspector/resources/locale/en-US/viewers/accessibleProps.properties
@@ -0,0 +1,42 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (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.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is DOM Inspector.
+#
+# The Initial Developer of the Original Code is
+# Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2007
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+accBoundsX = x: $S;
+accBoundsY = y: $S;
+accBoundsWidth = width: $S;
+accBoundsHeight = height: $S;
+
--- a/extensions/inspector/resources/locale/jar.mn
+++ b/extensions/inspector/resources/locale/jar.mn
@@ -5,16 +5,17 @@ inspector.jar:
 * locale/@AB_CD@/inspector/contents.rdf                                 (contents.rdf)
   locale/@AB_CD@/inspector/inspector.dtd                                (@AB_CD@/inspector.dtd)
   locale/@AB_CD@/inspector/prefs.dtd                                    (@AB_CD@/prefs.dtd)
   locale/@AB_CD@/inspector/editing.dtd                                  (@AB_CD@/editing.dtd)
   locale/@AB_CD@/inspector/tasksOverlay.dtd                             (@AB_CD@/tasksOverlay.dtd)
 * locale/@AB_CD@/inspector/viewers/accessibleEvent.dtd                  (@AB_CD@/viewers/accessibleEvent.dtd)
 * locale/@AB_CD@/inspector/viewers/accessibleEvents.dtd                 (@AB_CD@/viewers/accessibleEvents.dtd)
 * locale/@AB_CD@/inspector/viewers/accessibleProps.dtd                  (@AB_CD@/viewers/accessibleProps.dtd)
+* locale/@AB_CD@/inspector/viewers/accessibleProps.properties           (@AB_CD@/viewers/accessibleProps.properties)
 * locale/@AB_CD@/inspector/viewers/accessibleRelations.dtd              (@AB_CD@/viewers/accessibleRelations.dtd)
 * locale/@AB_CD@/inspector/viewers/accessibleTree.dtd                   (@AB_CD@/viewers/accessibleTree.dtd)
 * locale/@AB_CD@/inspector/viewers/accessibleTreeEvalJSDialog.dtd       (@AB_CD@/viewers/accessibleTreeEvalJSDialog.dtd)
 * locale/@AB_CD@/inspector/viewers/dom.dtd                              (@AB_CD@/viewers/dom.dtd)
 * locale/@AB_CD@/inspector/viewers/domNode.dtd                          (@AB_CD@/viewers/domNode.dtd)
 * locale/@AB_CD@/inspector/viewers/styleRules.dtd                       (@AB_CD@/viewers/styleRules.dtd)
 * locale/@AB_CD@/inspector/viewers/stylesheets.dtd                      (@AB_CD@/viewers/stylesheets.dtd)
 * locale/@AB_CD@/inspector/viewers/xblBindings.dtd                      (@AB_CD@/viewers/xblBindings.dtd)