fix history context menu bug

    http://b/issue?id=2953912

    Note: the bookmark status (star) is not correct
    and will be fixed separately

Change-Id: I20d1e52e9d6f6aeb7c0f1c66a61bed4d001e9092
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 590235c..ff9a418 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -1627,6 +1627,9 @@
         if (v instanceof TitleBarBase) {
             return;
         }
+        if (!(v instanceof WebView)) {
+            return;
+        }
         WebView webview = (WebView) v;
         WebView.HitTestResult result = webview.getHitTestResult();
         if (result == null) {
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java
index ab622b1..e565696 100644
--- a/src/com/android/browser/BrowserHistoryPage.java
+++ b/src/com/android/browser/BrowserHistoryPage.java
@@ -167,6 +167,7 @@
             Bundle savedInstanceState) {
         View root = inflater.inflate(R.layout.history, container, false);
         mList = (ExpandableListView) root.findViewById(android.R.id.list);
+        mList.setCacheColorHint(0);
         mList.setOnCreateContextMenuListener(this);
         mList.setOnChildClickListener(this);
         mAdapter = new HistoryAdapter(getActivity());
@@ -316,8 +317,8 @@
     @Override
     public boolean onChildClick(ExpandableListView parent, View v,
             int groupPosition, int childPosition, long id) {
-        if (v instanceof BookmarkItem) {
-            mCallbacks.onUrlSelected(((BookmarkItem) v).getUrl(), false);
+        if (v instanceof HistoryItem) {
+            mCallbacks.onUrlSelected(((HistoryItem) v).getUrl(), false);
             return true;
         }
         return false;
@@ -331,9 +332,9 @@
         @Override
         public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
                 View convertView, ViewGroup parent) {
-            BookmarkItem item;
-            if (null == convertView || !(convertView instanceof BookmarkItem)) {
-                item = new BookmarkItem(getContext());
+            HistoryItem item;
+            if (null == convertView || !(convertView instanceof HistoryItem)) {
+                item = new HistoryItem(getContext());
                 // Add padding on the left so it will be indented from the
                 // arrows on the group views.
                 item.setPadding(item.getPaddingLeft() + 10,
@@ -341,7 +342,7 @@
                         item.getPaddingRight(),
                         item.getPaddingBottom());
             } else {
-                item = (BookmarkItem) convertView;
+                item = (HistoryItem) convertView;
             }
 
             // Bail early if the Cursor is closed.