Add SafeHtml support to DirectionEstimator


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9264 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/tools/api-checker/config/gwt21_22userApi.conf b/tools/api-checker/config/gwt21_22userApi.conf
index 237247f..8daae36 100644
--- a/tools/api-checker/config/gwt21_22userApi.conf
+++ b/tools/api-checker/config/gwt21_22userApi.conf
@@ -137,3 +137,9 @@
 com.google.gwt.user.client.impl.DOMImplMozillaOld MISSING
 com.google.gwt.user.client.ui.impl.RichTextAreaImplOldMozilla MISSING
 com.google.gwt.xml.client.impl.XMLParserImplMozillaOld MISSING
+
+# DirectionEstimator::estimateDirection(SafeHtml html) was added, and does not accept null
+com.google.gwt.i18n.shared.AnyRtlDirectionEstimator::estimateDirection(Ljava/lang/String;) OVERLOADED_METHOD_CALL
+com.google.gwt.i18n.shared.DirectionEstimator::estimateDirection(Ljava/lang/String;) OVERLOADED_METHOD_CALL
+com.google.gwt.i18n.shared.FirstStrongDirectionEstimator::estimateDirection(Ljava/lang/String;) OVERLOADED_METHOD_CALL
+com.google.gwt.i18n.shared.WordCountDirectionEstimator::estimateDirection(Ljava/lang/String;) OVERLOADED_METHOD_CALL
diff --git a/user/src/com/google/gwt/i18n/shared/DirectionEstimator.java b/user/src/com/google/gwt/i18n/shared/DirectionEstimator.java
index 9488e54..112cc3a 100644
--- a/user/src/com/google/gwt/i18n/shared/DirectionEstimator.java
+++ b/user/src/com/google/gwt/i18n/shared/DirectionEstimator.java
@@ -16,6 +16,7 @@
 package com.google.gwt.i18n.shared;
 
 import com.google.gwt.i18n.client.HasDirection.Direction;
+import com.google.gwt.safehtml.shared.SafeHtml;
 
 /**
  * Interface for direction estimators.
@@ -41,4 +42,15 @@
   public Direction estimateDirection(String str, boolean isHtml) {
     return estimateDirection(BidiUtils.get().stripHtmlIfNeeded(str, isHtml));
   }
+  
+  /**
+   * Estimates the direction of a SafeHtml.
+   * 
+   * @param html The string to check.
+   * @return {@code html}'s estimated direction.
+   */
+  public Direction estimateDirection(SafeHtml html) {
+    return estimateDirection(BidiUtils.get().stripHtmlIfNeeded(html.asString(),
+        true));
+  }
 }