[jbosstools-commits] JBoss Tools SVN: r22784 - trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/util.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jun 14 08:02:55 EDT 2010


Author: yradtsevich
Date: 2010-06-14 08:02:55 -0400 (Mon, 14 Jun 2010)
New Revision: 22784

Modified:
   trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/util/XulRunnerVpeUtils.java
Log:
https://jira.jboss.org/browse/JBIDE-6429
- Reverting XulRunnerVpeUtils

Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/util/XulRunnerVpeUtils.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/util/XulRunnerVpeUtils.java	2010-06-14 11:30:01 UTC (rev 22783)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/util/XulRunnerVpeUtils.java	2010-06-14 12:02:55 UTC (rev 22784)
@@ -105,40 +105,41 @@
 	 * {@code selectionContainer}.
 	 */
 	public static Rectangle getTextSelectionBounds(nsIDOMText selectionContainer) {
-//		nsIAccessibleText accessibleTextAncestor = getAccessibleTextAncestor(selectionContainer);
-//		if (accessibleTextAncestor == null) {
-//			// cannot get selection bounds
-//			return null;
-//		}
-//		if (accessibleTextAncestor.getSelectionCount() == 0) {
-//			// no text selected
-//			return null;
-//		}
-//		
-//		int[] startOffset = new int[1];
-//		int[] endOffset = new int[1];
-//		accessibleTextAncestor.getSelectionBounds(0, startOffset, endOffset);
-//		
-//		int[] x = new int[1];
-//		int[] y = new int[1];
-//		int[] width = new int[1];
-//		int[] height = new int[1];
-//		accessibleTextAncestor.getRangeExtents(startOffset[0], endOffset[0],
-//				x, y, width, height, nsIAccessibleCoordinateType.COORDTYPE_PARENT_RELATIVE);
-//
-//		nsIAccessible ancestorAccessibleParent
-//				= queryInterface(accessibleTextAncestor, nsIAccessible.class).getParent();
-//		nsIDOMNode ancestorParent
-//				= queryInterface(ancestorAccessibleParent, nsIAccessNode.class).getDOMNode();
-//
-//		Rectangle ancestorParentBounds;
-//		if (ancestorParent != null) {
-//			ancestorParentBounds = getElementBounds(ancestorParent);
-//		} else {
-//			ancestorParentBounds = new Rectangle(0, 0, 0, 0);
-//		}
-//		
-		return new Rectangle(0, 0, 0, 0);
+		nsIAccessibleText accessibleTextAncestor = getAccessibleTextAncestor(selectionContainer);
+		if (accessibleTextAncestor == null) {
+			// cannot get selection bounds
+			return null;
+		}
+		if (accessibleTextAncestor.getSelectionCount() == 0) {
+			// no text selected
+			return null;
+		}
+		
+		int[] startOffset = new int[1];
+		int[] endOffset = new int[1];
+		accessibleTextAncestor.getSelectionBounds(0, startOffset, endOffset);
+		
+		int[] x = new int[1];
+		int[] y = new int[1];
+		int[] width = new int[1];
+		int[] height = new int[1];
+		accessibleTextAncestor.getRangeExtents(startOffset[0], endOffset[0],
+				x, y, width, height, nsIAccessibleCoordinateType.COORDTYPE_PARENT_RELATIVE);
+
+		nsIAccessible ancestorAccessibleParent
+				= queryInterface(accessibleTextAncestor, nsIAccessible.class).getParent();
+		nsIDOMNode ancestorParent
+				= queryInterface(ancestorAccessibleParent, nsIAccessNode.class).getDOMNode();
+
+		Rectangle ancestorParentBounds;
+		if (ancestorParent != null) {
+			ancestorParentBounds = getElementBounds(ancestorParent);
+		} else {
+			ancestorParentBounds = new Rectangle(0, 0, 0, 0);
+		}
+		
+		return new Rectangle(ancestorParentBounds.x + x[0], ancestorParentBounds.y + y[0],
+				width[0], height[0]);
 	}
 	
 	/**



More information about the jbosstools-commits mailing list