Use cellIndex and sectionRowIndex in HTMLTable::getCellForEvent
Review: http://gwt-code-reviews.appspot.com/143805


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7557 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java b/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java
index 414e4c3..61a6ea9 100644
--- a/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java
+++ b/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java
@@ -71,13 +71,12 @@
   public native Element getChild(Element elem, int index) /*-{
     var count = 0, child = elem.firstChild;
     while (child) {
-      var next = child.nextSibling;
       if (child.nodeType == 1) {
         if (index == count)
           return child;
         ++count;
       }
-      child = next;
+      child = child.nextSibling;
     }
 
     return null;
diff --git a/user/src/com/google/gwt/user/client/ui/HTMLTable.java b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
index 54095a2..8278ca0 100644
--- a/user/src/com/google/gwt/user/client/ui/HTMLTable.java
+++ b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
@@ -16,6 +16,8 @@
 package com.google.gwt.user.client.ui;
 
 import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.TableCellElement;
+import com.google.gwt.dom.client.TableRowElement;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.event.dom.client.HasClickHandlers;
@@ -791,11 +793,8 @@
       return null;
     }
 
-    Element tr = DOM.getParent(td);
-    Element body = DOM.getParent(tr);
-    int row = DOM.getChildIndex(body, tr);
-    int column = DOM.getChildIndex(tr, td);
-
+    int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex();
+    int column = TableCellElement.as(td).getCellIndex();
     return new Cell(row, column);
   }