Bug 785246: Recreate BrowserToolbar curve with low-level window functions. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Fri, 31 Aug 2012 11:59:50 -0700
changeset 104048 dbb57b1e7917d3b5cad3a5b5550ce3cb53eeb01f
parent 104047 8f36eacd03be012c9634fc92b9048c86947f180d
child 104049 987945f36cbc373998c56139f06be1a4dcf8199b
push id23392
push userryanvm@gmail.com
push dateSat, 01 Sep 2012 01:35:58 +0000
treeherderautoland@a21fd4d085ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs785246
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 785246: Recreate BrowserToolbar curve with low-level window functions. [r=mfinkle]
mobile/android/base/BrowserToolbarBackground.java
mobile/android/base/CanvasDelegate.java
mobile/android/base/GeckoViewsFactory.java
mobile/android/base/Makefile.in
mobile/android/base/resources/drawable-hdpi/address_bar_bg_curve.png
mobile/android/base/resources/drawable-land-hdpi-v14/address_bar_bg_curve.png
mobile/android/base/resources/drawable-land-mdpi-v14/address_bar_bg_curve.png
mobile/android/base/resources/drawable-land-xhdpi-v14/address_bar_bg_curve.png
mobile/android/base/resources/drawable-large-hdpi-v11/address_bar_bg_curve.png
mobile/android/base/resources/drawable-large-mdpi-v11/address_bar_bg_curve.png
mobile/android/base/resources/drawable-large-xhdpi-v11/address_bar_bg_curve.png
mobile/android/base/resources/drawable-xhdpi/address_bar_bg_curve.png
mobile/android/base/resources/drawable/address_bar_bg_curve.png
mobile/android/base/resources/layout-land-v14/browser_toolbar.xml
mobile/android/base/resources/layout-land-v14/browser_toolbar_menu.xml
mobile/android/base/resources/layout-large-v11/browser_toolbar_menu.xml
mobile/android/base/resources/layout/browser_toolbar.xml
mobile/android/base/resources/layout/browser_toolbar_menu.xml
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/BrowserToolbarBackground.java
@@ -0,0 +1,53 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Path;
+import android.graphics.PorterDuff.Mode;
+import android.util.AttributeSet;
+import android.widget.LinearLayout;
+
+public class BrowserToolbarBackground extends LinearLayout
+                                      implements CanvasDelegate.DrawManager { 
+    Path mPath;
+    CanvasDelegate mCanvasDelegate;
+
+    public BrowserToolbarBackground(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        // Path is clipped.
+        mPath = new Path();
+        mCanvasDelegate = new CanvasDelegate(this, Mode.DST_OUT);
+    }
+
+    @Override
+    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+        int width = getMeasuredWidth();
+        int height = getMeasuredHeight();
+        float curve = height * 1.125f;
+
+        mPath.reset();
+        mPath.moveTo(width, height);
+        mPath.cubicTo((width - (curve * 0.75f)), height,
+                      (width - (curve * 0.25f)), 0,
+                      (width - curve), 0);
+        mPath.lineTo(width, 0);
+        mPath.lineTo(width, height);
+    }
+
+    @Override
+    public void draw(Canvas canvas) {
+        mCanvasDelegate.draw(canvas, mPath, getWidth(), getHeight());
+    }
+
+    @Override
+    public void defaultDraw(Canvas canvas) {
+        super.draw(canvas);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/CanvasDelegate.java
@@ -0,0 +1,69 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko;
+
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Path;
+import android.graphics.Paint;
+import android.graphics.PorterDuffXfermode;
+import android.graphics.PorterDuff.Mode;
+import android.os.Build;
+
+public class CanvasDelegate { 
+    Paint mPaint;
+    PorterDuffXfermode mMode;
+    DrawManager mDrawManager;
+
+    // DrawManager would do a default draw of the background.
+    public static interface DrawManager {
+        public void defaultDraw(Canvas cavas);
+    }
+
+    public CanvasDelegate(DrawManager drawManager, Mode mode) {
+        mDrawManager = drawManager;
+
+        // DST_IN masks, DST_OUT clips.
+        mMode = new PorterDuffXfermode(mode);
+
+        mPaint = new Paint();
+        mPaint.setAntiAlias(true);
+        mPaint.setColor(0xFFFF0000);
+    }
+
+    public void draw(Canvas canvas, Path path, int width, int height) {
+        // Save the canvas. All PorterDuff operations should be done in a offscreen bitmap.
+        int count = canvas.saveLayer(0, 0, width, height, null,
+                                     Canvas.MATRIX_SAVE_FLAG |
+                                     Canvas.CLIP_SAVE_FLAG |
+                                     Canvas.HAS_ALPHA_LAYER_SAVE_FLAG |
+                                     Canvas.FULL_COLOR_LAYER_SAVE_FLAG |
+                                     Canvas.CLIP_TO_LAYER_SAVE_FLAG);
+
+        // Do a default draw.
+        mDrawManager.defaultDraw(canvas);
+
+        if (path != null && !path.isEmpty()) {
+            // ICS added double-buffering, which made it easier for drawing the Path directly over the DST.
+            // In pre-ICS, drawPath() doesn't seem to use ARGB_8888 mode for performance, hence transparency is not preserved.
+            if (Build.VERSION.SDK_INT >= 14) {
+                mPaint.setXfermode(mMode);
+                canvas.drawPath(path, mPaint);
+            } else {
+                // Allocate a bitmap and draw the masking/clipping path.
+                Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+                (new Canvas(bitmap)).drawPath(path, mPaint);
+
+                mPaint.setXfermode(mMode);
+                canvas.drawBitmap(bitmap, 0, 0, mPaint);
+
+                mPaint.setXfermode(null);
+            }
+        }
+
+        // Restore the canvas.
+        canvas.restoreToCount(count);
+    }
+}
--- a/mobile/android/base/GeckoViewsFactory.java
+++ b/mobile/android/base/GeckoViewsFactory.java
@@ -39,16 +39,18 @@ public final class GeckoViewsFactory imp
             Log.i(LOGTAG, "Creating custom Gecko view: " + viewName);
 
             if (TextUtils.equals(viewName, "AboutHomePromoBox"))
                 return new AboutHomePromoBox(context, attrs);
             else if (TextUtils.equals(viewName, "AboutHomeSection"))
                 return new AboutHomeSection(context, attrs);
             else if (TextUtils.equals(viewName, "AwesomeBarTabs"))
                 return new AwesomeBarTabs(context, attrs);
+            else if (TextUtils.equals(viewName, "BrowserToolbarBackground"))
+                return new BrowserToolbarBackground(context, attrs);
             else if (TextUtils.equals(viewName, "FormAssistPopup"))
                 return new FormAssistPopup(context, attrs);
             else if (TextUtils.equals(viewName, "LinkTextView"))
                 return new LinkTextView(context, attrs);
             else if (TextUtils.equals(viewName, "FindInPageBar"))
                 return new FindInPageBar(context, attrs);
             else if (TextUtils.equals(viewName, "TabsPanel"))
                 return new TabsPanel(context, attrs);
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -46,18 +46,20 @@ FENNEC_JAVA_FILES = \
   AwesomebarResultHandler.java \
   AwesomeBarTabs.java \
   awesomebar/AwesomeBarTab.java \
   awesomebar/AllPagesTab.java \
   awesomebar/BookmarksTab.java \
   awesomebar/HistoryTab.java \
   BrowserApp.java \
   BrowserToolbar.java \
+  BrowserToolbarBackground.java \
   CameraImageResultHandler.java \
   CameraVideoResultHandler.java \
+  CanvasDelegate.java \
   SyncPreference.java \
   db/BrowserDB.java \
   db/LocalBrowserDB.java \
   db/DBUtils.java \
   DoorHanger.java \
   DoorHangerPopup.java \
   Favicons.java \
   FilePickerResultHandler.java \
@@ -459,17 +461,16 @@ RES_DRAWABLE_BASE = \
   res/drawable/tabs_carat.png \
   res/drawable/tabs_crop_normal.png \
   res/drawable/tabs_crop_pressed.png \
   res/drawable/tabs_full_normal.png \
   res/drawable/tabs_full_pressed.png \
   res/drawable/address_bar_back_button.xml \
   res/drawable/address_bar_back_button_bg.xml \
   res/drawable/address_bar_back_button_pressed_bg.xml \
-  res/drawable/address_bar_bg_curve.png \
   res/drawable/address_bar_forward_button.xml \
   res/drawable/address_bar_texture_port.png \
   res/drawable/address_bar_url.xml \
   res/drawable/address_bar_url_default.9.png \
   res/drawable/address_bar_url_pressed.9.png \
   res/drawable/doorhanger_arrow.png \
   res/drawable/doorhanger_bg.9.png \
   res/drawable/doorhanger_shadow_bg.9.png \
@@ -540,17 +541,16 @@ RES_DRAWABLE_HDPI = \
   res/drawable-hdpi/tab_close.png \
   res/drawable-hdpi/tab_thumbnail_default.png \
   res/drawable-hdpi/tab_thumbnail_shadow.png \
   res/drawable-hdpi/tabs_carat.png \
   res/drawable-hdpi/tabs_crop_normal.png \
   res/drawable-hdpi/tabs_crop_pressed.png \
   res/drawable-hdpi/tabs_full_normal.png \
   res/drawable-hdpi/tabs_full_pressed.png \
-  res/drawable-hdpi/address_bar_bg_curve.png \
   res/drawable-hdpi/address_bar_texture_port.png \
   res/drawable-hdpi/address_bar_url_default.9.png \
   res/drawable-hdpi/address_bar_url_pressed.9.png \
   res/drawable-hdpi/doorhanger_arrow.png \
   res/drawable-hdpi/doorhanger_bg.9.png \
   res/drawable-hdpi/doorhanger_shadow_bg.9.png \
   res/drawable-hdpi/doorhanger_popup_bg.9.png \
   res/drawable-hdpi/find_close.png \
@@ -576,17 +576,16 @@ RES_DRAWABLE_XHDPI = \
   res/drawable-xhdpi/folder.png \
   res/drawable-xhdpi/abouthome_icon.png \
   res/drawable-xhdpi/abouthome_logo.png \
   res/drawable-xhdpi/abouthome_promo_box_bg.9.png \
   res/drawable-xhdpi/abouthome_promo_box_pressed_bg.9.png \
   res/drawable-xhdpi/abouthome_promo_logo_apps.png \
   res/drawable-xhdpi/abouthome_promo_logo_sync.png \
   res/drawable-xhdpi/abouthome_thumbnail.png \
-  res/drawable-xhdpi/address_bar_bg_curve.png \
   res/drawable-xhdpi/address_bar_bg_shadow.png \
   res/drawable-xhdpi/address_bar_texture_port.png \
   res/drawable-xhdpi/address_bar_url_default.9.png \
   res/drawable-xhdpi/address_bar_url_pressed.9.png \
   res/drawable-xhdpi/alert_addon.png \
   res/drawable-xhdpi/alert_app.png \
   res/drawable-xhdpi/alert_download.png \
   res/drawable-xhdpi/awesomebar_tab_center.9.png \
@@ -723,17 +722,16 @@ RES_DRAWABLE_XHDPI_V11 = \
 
 RES_DRAWABLE_LAND_V14 = \
   res/drawable-land-v14/address_bar_bg.xml \
   $(NULL)
 
 RES_DRAWABLE_LAND_MDPI_V14 = \
   res/drawable-land-mdpi-v14/ic_awesomebar_go.png \
   res/drawable-land-mdpi-v14/ic_awesomebar_search.png \
-  res/drawable-land-mdpi-v14/address_bar_bg_curve.png \
   res/drawable-land-mdpi-v14/address_bar_texture_land.png \
   res/drawable-land-mdpi-v14/address_bar_url_default.9.png \
   res/drawable-land-mdpi-v14/address_bar_url_pressed.9.png \
   res/drawable-land-mdpi-v14/remote_tabs_off.png \
   res/drawable-land-mdpi-v14/remote_tabs_on.png \
   res/drawable-land-mdpi-v14/tab_new.png \
   res/drawable-land-mdpi-v14/tab_new_normal.png \
   res/drawable-land-mdpi-v14/tab_new_pressed.png \
@@ -749,17 +747,16 @@ RES_DRAWABLE_LAND_MDPI_V14 = \
   res/drawable-land-mdpi-v14/reader.png \
   res/drawable-land-mdpi-v14/site_security_identified.png \
   res/drawable-land-mdpi-v14/site_security_verified.png \
   $(NULL)
 
 RES_DRAWABLE_LAND_HDPI_V14 = \
   res/drawable-land-hdpi-v14/ic_awesomebar_go.png \
   res/drawable-land-hdpi-v14/ic_awesomebar_search.png \
-  res/drawable-land-hdpi-v14/address_bar_bg_curve.png \
   res/drawable-land-hdpi-v14/address_bar_texture_land.png \
   res/drawable-land-hdpi-v14/address_bar_url_default.9.png \
   res/drawable-land-hdpi-v14/address_bar_url_pressed.9.png \
   res/drawable-land-hdpi-v14/remote_tabs_off.png \
   res/drawable-land-hdpi-v14/remote_tabs_on.png \
   res/drawable-land-hdpi-v14/tab_new.png \
   res/drawable-land-hdpi-v14/tab_new_normal.png \
   res/drawable-land-hdpi-v14/tab_new_pressed.png \
@@ -775,17 +772,16 @@ RES_DRAWABLE_LAND_HDPI_V14 = \
   res/drawable-land-hdpi-v14/reader.png \
   res/drawable-land-hdpi-v14/site_security_identified.png \
   res/drawable-land-hdpi-v14/site_security_verified.png \
   $(NULL)
 
 RES_DRAWABLE_LAND_XHDPI_V14 = \
   res/drawable-land-xhdpi-v14/ic_awesomebar_go.png \
   res/drawable-land-xhdpi-v14/ic_awesomebar_search.png \
-  res/drawable-land-xhdpi-v14/address_bar_bg_curve.png \
   res/drawable-land-xhdpi-v14/address_bar_texture_land.png \
   res/drawable-land-xhdpi-v14/address_bar_url_default.9.png \
   res/drawable-land-xhdpi-v14/address_bar_url_pressed.9.png \
   res/drawable-land-xhdpi-v14/remote_tabs_off.png \
   res/drawable-land-xhdpi-v14/remote_tabs_on.png \
   res/drawable-land-xhdpi-v14/tab_new.png \
   res/drawable-land-xhdpi-v14/tab_new_normal.png \
   res/drawable-land-xhdpi-v14/tab_new_pressed.png \
@@ -799,17 +795,16 @@ RES_DRAWABLE_LAND_XHDPI_V14 = \
   res/drawable-land-xhdpi-v14/menu_normal.png \
   res/drawable-land-xhdpi-v14/menu_pressed.png \
   res/drawable-land-xhdpi-v14/reader.png \
   res/drawable-land-xhdpi-v14/site_security_identified.png \
   res/drawable-land-xhdpi-v14/site_security_verified.png \
   $(NULL)
 
 RES_DRAWABLE_LARGE_MDPI_V11 = \
-  res/drawable-large-mdpi-v11/address_bar_bg_curve.png \
   res/drawable-large-mdpi-v11/address_bar_bg.xml \
   res/drawable-large-mdpi-v11/address_bar_texture_tablet.png \
   res/drawable-large-mdpi-v11/address_bar_back_button_bg.png \
   res/drawable-large-mdpi-v11/address_bar_back_button_pressed_bg.png \
   res/drawable-large-mdpi-v11/address_bar_url_default.9.png \
   res/drawable-large-mdpi-v11/address_bar_url_pressed.9.png \
   res/drawable-large-mdpi-v11/ic_awesomebar_go.png \
   res/drawable-large-mdpi-v11/ic_awesomebar_search.png \
@@ -832,17 +827,16 @@ RES_DRAWABLE_LARGE_MDPI_V11 = \
   res/drawable-large-mdpi-v11/tabs_carat.png \
   res/drawable-large-mdpi-v11/tabs_crop_normal.png \
   res/drawable-large-mdpi-v11/tabs_crop_pressed.png \
   res/drawable-large-mdpi-v11/tabs_full_normal.png \
   res/drawable-large-mdpi-v11/tabs_full_pressed.png \
   $(NULL)
 
 RES_DRAWABLE_LARGE_HDPI_V11 = \
-  res/drawable-large-hdpi-v11/address_bar_bg_curve.png \
   res/drawable-large-hdpi-v11/address_bar_texture_tablet.png \
   res/drawable-large-hdpi-v11/address_bar_back_button_bg.png \
   res/drawable-large-hdpi-v11/address_bar_back_button_pressed_bg.png \
   res/drawable-large-hdpi-v11/address_bar_url_default.9.png \
   res/drawable-large-hdpi-v11/address_bar_url_pressed.9.png \
   res/drawable-large-hdpi-v11/ic_awesomebar_go.png \
   res/drawable-large-hdpi-v11/ic_awesomebar_search.png \
   res/drawable-large-hdpi-v11/ic_menu_bookmark_add.png \
@@ -864,17 +858,16 @@ RES_DRAWABLE_LARGE_HDPI_V11 = \
   res/drawable-large-hdpi-v11/tabs_carat.png \
   res/drawable-large-hdpi-v11/tabs_crop_normal.png \
   res/drawable-large-hdpi-v11/tabs_crop_pressed.png \
   res/drawable-large-hdpi-v11/tabs_full_normal.png \
   res/drawable-large-hdpi-v11/tabs_full_pressed.png \
   $(NULL)
 
 RES_DRAWABLE_LARGE_XHDPI_V11 = \
-  res/drawable-large-xhdpi-v11/address_bar_bg_curve.png \
   res/drawable-large-xhdpi-v11/address_bar_texture_tablet.png \
   res/drawable-large-xhdpi-v11/address_bar_back_button_bg.png \
   res/drawable-large-xhdpi-v11/address_bar_back_button_pressed_bg.png \
   res/drawable-large-xhdpi-v11/address_bar_url_default.9.png \
   res/drawable-large-xhdpi-v11/address_bar_url_pressed.9.png \
   res/drawable-large-xhdpi-v11/ic_awesomebar_go.png \
   res/drawable-large-xhdpi-v11/ic_awesomebar_search.png \
   res/drawable-large-xhdpi-v11/ic_menu_bookmark_add.png \
deleted file mode 100644
index 44c7f9f03f71063266fcb0fe7967108fe6093404..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 4c45eb707074a468d40fb7d3f320748693e684fb..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 59037f45bd426a859c10ed5bc9d376f28149e487..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index ef9b71bde2531ebb5a3d874963f099a335b8562e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index d9478f1be04e62e216e3c5c48097f8d3ba4e9c53..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 719b2dd3246f930ac621da40eb0088119230baa7..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 0954184880e9e746bcb5b3046508c481788730ac..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 0199df0ebffca40b70646f005a2498eb5fbfc20e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index aeb2a165553191451709785f8e3b14a0eb273c42..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/android/base/resources/layout-land-v14/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout-land-v14/browser_toolbar.xml
@@ -18,28 +18,22 @@
                      android:contentDescription="@string/forward"
                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <LinearLayout android:id="@+id/menu_items"
                       android:layout_width="0dip"
                       android:layout_height="0dip"
                       android:visibility="gone"/>
 
-        <View android:id="@+id/curve"
-              android:layout_width="60dip"
-              android:layout_height="fill_parent"
-              android:layout_alignParentRight="true"
-              android:background="@drawable/address_bar_bg_curve"/>
-
-        <View android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_alignParentLeft="true"
-              android:layout_alignParentBottom="true"
-              android:layout_toLeftOf="@id/curve"
-              android:background="@drawable/address_bar_bg"/>
+        <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
+                                                    android:layout_height="fill_parent"
+                                                    android:layout_marginRight="14dip"
+                                                    android:layout_alignParentTop="true"
+                                                    android:layout_alignParentRight="true"
+                                                    android:background="@drawable/address_bar_bg"/>
 
         <ImageButton android:id="@+id/menu"
                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <ImageButton android:id="@+id/tabs"
                      style="@style/AddressBar.ImageButton"
                      android:layout_width="60dip"
                      android:layout_alignParentRight="true"
--- a/mobile/android/base/resources/layout-land-v14/browser_toolbar_menu.xml
+++ b/mobile/android/base/resources/layout-land-v14/browser_toolbar_menu.xml
@@ -18,29 +18,22 @@
                      android:contentDescription="@string/forward"
                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <LinearLayout android:id="@+id/menu_items"
                       android:layout_width="0dip"
                       android:layout_height="0dip"
                       android:visibility="gone"/>
 
-        <View android:id="@+id/curve"
-              android:layout_width="60dip"
-              android:layout_height="fill_parent"
-              android:layout_marginRight="35dip"
-              android:layout_alignParentRight="true"
-              android:background="@drawable/address_bar_bg_curve"/>
-
-        <View android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_alignParentLeft="true"
-              android:layout_alignParentBottom="true"
-              android:layout_toLeftOf="@id/curve"
-              android:background="@drawable/address_bar_bg"/>
+        <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
+                                                    android:layout_height="fill_parent"
+                                                    android:layout_marginRight="50dip"
+                                                    android:layout_alignParentTop="true"
+                                                    android:layout_alignParentRight="true"
+                                                    android:background="@drawable/address_bar_bg"/>
 
         <ImageButton android:id="@+id/menu"
                      style="@style/AddressBar.ImageButton"
                      android:layout_width="65dip"
                      android:layout_alignParentRight="true"
                      android:gravity="center_vertical"
                      android:src="@drawable/menu_level"
                      android:contentDescription="@string/menu"
--- a/mobile/android/base/resources/layout-large-v11/browser_toolbar_menu.xml
+++ b/mobile/android/base/resources/layout-large-v11/browser_toolbar_menu.xml
@@ -5,29 +5,22 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:id="@+id/browser_toolbar"
               style="@style/BrowserToolbar">
 
     <RelativeLayout android:id="@+id/address_bar"
                     style="@style/AddressBar">
 
-        <View android:id="@+id/curve"
-              android:layout_width="84dip"
-              android:layout_height="fill_parent"
-              android:layout_marginRight="56dip"
-              android:layout_alignParentRight="true"
-              android:background="@drawable/address_bar_bg_curve"/>
-
-        <View android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_alignParentLeft="true"
-              android:layout_alignParentBottom="true"
-              android:layout_toLeftOf="@id/curve"
-              android:background="@drawable/address_bar_bg"/>
+        <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
+                                                    android:layout_height="fill_parent"
+                                                    android:layout_marginRight="75dip"
+                                                    android:layout_alignParentTop="true"
+                                                    android:layout_alignParentRight="true"
+                                                    android:background="@drawable/address_bar_bg"/>
 
         <ImageButton android:id="@+id/menu"
                      style="@style/AddressBar.ImageButton"
                      android:layout_width="90dip"
                      android:layout_alignParentRight="true"
                      android:gravity="center_vertical"
                      android:src="@drawable/menu_level"
                      android:contentDescription="@string/menu"
--- a/mobile/android/base/resources/layout/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout/browser_toolbar.xml
@@ -18,28 +18,22 @@
                      android:contentDescription="@string/forward"
                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <LinearLayout android:id="@+id/menu_items"
                       android:layout_width="0dip"
                       android:layout_height="0dip"
                       android:visibility="gone"/>
 
-        <View android:id="@+id/curve"
-              android:layout_width="72dip"
-              android:layout_height="fill_parent"
-              android:layout_alignParentRight="true"
-              android:background="@drawable/address_bar_bg_curve"/>
-
-        <View android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_alignParentLeft="true"
-              android:layout_alignParentBottom="true"
-              android:layout_toLeftOf="@id/curve"
-              android:background="@drawable/address_bar_bg"/>
+        <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
+                                                    android:layout_height="fill_parent"
+                                                    android:layout_marginRight="17dip"
+                                                    android:layout_alignParentTop="true"
+                                                    android:layout_alignParentRight="true"
+                                                    android:background="@drawable/address_bar_bg"/>
 
         <ImageButton android:id="@+id/menu"
                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <ImageButton android:id="@+id/tabs"
                      style="@style/AddressBar.ImageButton"
                      android:layout_width="72dip"
                      android:layout_alignParentRight="true"
@@ -115,18 +109,18 @@
                              android:src="@drawable/urlbar_stop"
                              android:contentDescription="@string/stop"
                              android:visibility="gone"/>
 
             </LinearLayout>
 
         </FrameLayout>
 
-         <ImageView android:id="@+id/shadow"
-                    android:layout_width="fill_parent"
-                    android:layout_height="2dp"
-                    android:layout_alignParentBottom="true"
-                    android:background="@drawable/address_bar_bg_shadow_repeat"
-                    android:visibility="gone"/>
+        <ImageView android:id="@+id/shadow"
+                   android:layout_width="fill_parent"
+                   android:layout_height="2dp"
+                   android:layout_alignParentBottom="true"
+                   android:background="@drawable/address_bar_bg_shadow_repeat"
+                   android:visibility="gone"/>
 
     </RelativeLayout>
 
 </LinearLayout>
--- a/mobile/android/base/resources/layout/browser_toolbar_menu.xml
+++ b/mobile/android/base/resources/layout/browser_toolbar_menu.xml
@@ -18,29 +18,22 @@
                      android:contentDescription="@string/forward"
                      style="@style/AddressBar.ImageButton.Unused"/>
 
         <LinearLayout android:id="@+id/menu_items"
                       android:layout_width="0dip"
                       android:layout_height="0dip"
                       android:visibility="gone"/>
 
-        <View android:id="@+id/curve"
-              android:layout_width="72dip"
-              android:layout_height="fill_parent"
-              android:layout_marginRight="48dip"
-              android:layout_alignParentRight="true"
-              android:background="@drawable/address_bar_bg_curve"/>
-
-        <View android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-              android:layout_alignParentLeft="true"
-              android:layout_alignParentBottom="true"
-              android:layout_toLeftOf="@id/curve"
-              android:background="@drawable/address_bar_bg"/>
+        <org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
+                                                    android:layout_height="fill_parent"
+                                                    android:layout_marginRight="64dip"
+                                                    android:layout_alignParentTop="true"
+                                                    android:layout_alignParentRight="true"
+                                                    android:background="@drawable/address_bar_bg"/>
 
         <ImageButton android:id="@+id/menu"
                      style="@style/AddressBar.ImageButton"
                      android:layout_width="78dip"
                      android:layout_alignParentRight="true"
                      android:gravity="center_vertical"
                      android:src="@drawable/menu_level"
                      android:contentDescription="@string/menu"
@@ -126,18 +119,18 @@
                              android:src="@drawable/urlbar_stop"
                              android:contentDescription="@string/stop"
                              android:visibility="gone"/>
 
             </LinearLayout>
 
         </FrameLayout>
 
-         <ImageView android:id="@+id/shadow"
-                    android:layout_width="fill_parent"
-                    android:layout_height="2dp"
-                    android:layout_alignParentBottom="true"
-                    android:background="@drawable/address_bar_bg_shadow_repeat"
-                    android:visibility="gone"/>
+        <ImageView android:id="@+id/shadow"
+                   android:layout_width="fill_parent"
+                   android:layout_height="2dp"
+                   android:layout_alignParentBottom="true"
+                   android:background="@drawable/address_bar_bg_shadow_repeat"
+                   android:visibility="gone"/>
 
     </RelativeLayout>
 
 </LinearLayout>