Bug 601751 - Redesign the Edit Bookmark Panel to have the new look [r=mbrubeck]
--- a/mobile/chrome/content/BookmarkHelper.js
+++ b/mobile/chrome/content/BookmarkHelper.js
@@ -1,12 +1,17 @@
var BookmarkHelper = {
- _panel: null,
_editor: null,
+ get box() {
+ delete this.box;
+ this.box = document.getElementById("bookmark-container");
+ return this.box;
+ },
+
edit: function BH_edit(aURI) {
if (!aURI)
aURI = getBrowser().currentURI;
let itemId = PlacesUtils.getMostRecentBookmarkForURI(aURI);
if (itemId == -1)
return;
@@ -21,44 +26,42 @@ var BookmarkHelper = {
this._editor.setAttribute("ui", "manage");
this._editor.setAttribute("title", title);
this._editor.setAttribute("uri", aURI.spec);
this._editor.setAttribute("itemid", itemId);
this._editor.setAttribute("tags", tags.join(", "));
this._editor.setAttribute("onclose", "BookmarkHelper.hide()");
document.getElementById("bookmark-form").appendChild(this._editor);
- let toolbar = document.getElementById("toolbar-main");
- let top = toolbar.top + toolbar.boxObject.height;
+ this.box.hidden = false;
+ BrowserUI.pushPopup(this, this.box);
- this._panel = document.getElementById("bookmark-container");
- this._panel.top = (top < 0 ? 0 : top);
- this._panel.hidden = false;
- BrowserUI.pushPopup(this, this._panel);
-
- let self = this;
- BrowserUI.lockToolbar();
- Browser.forceChromeReflow();
- self._editor.startEditing();
+ function waitForWidget(self) {
+ try {
+ self._editor.startEditing();
+ } catch(e) {
+ setTimeout(waitForWidget, 0, this);
+ }
+ }
+ setTimeout(waitForWidget, 0, this);
},
save: function BH_save() {
this._editor.stopEditing(true);
},
hide: function BH_hide() {
- BrowserUI.unlockToolbar();
BrowserUI.updateStar();
// Note: the _editor will have already saved the data, if needed, by the time
// this method is called, since this method is called via the "close" event.
this._editor.parentNode.removeChild(this._editor);
this._editor = null;
- this._panel.hidden = true;
+ this.box.hidden = true;
BrowserUI.popPopup(this);
},
removeBookmarksForURI: function BH_removeBookmarksForURI(aURI) {
//XXX blargle xpconnect! might not matter, but a method on
// nsINavBookmarksService that takes an array of items to
// delete would be faster. better yet, a method that takes a URI!
let itemIds = PlacesUtils.getBookmarksForURI(aURI);
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1913,17 +1913,16 @@ IdentityHandler.prototype = {
// dismiss any dialog which hide the identity popup
BrowserUI.activePanel = null;
while (BrowserUI.activeDialog)
BrowserUI.activeDialog.close();
this._identityPopup.hidden = false;
this._identityPopup.top = BrowserUI.toolbarH - this._identityPopup.offset;
this._identityPopup.anchorTo(this._identityBox);
- this._identityPopup.focus();
this._identityBox.setAttribute("open", "true");
// Update the popup strings
this.setPopupMessages(this._identityBox.getAttribute("mode") || this.IDENTITY_MODE_UNKNOWN);
BrowserUI.pushPopup(this, [this._identityPopup, this._identityBox, Elements.toolbarContainer]);
BrowserUI.lockToolbar();
@@ -2812,17 +2811,17 @@ var ViewableAreaObserver = {
for (let i = Browser.tabs.length - 1; i >= 0; i--) {
let tab = Browser.tabs[i];
tab.updateViewportSize();
// If the viewport width is still the same, the page layout has not
// changed, so we can keep keep the same content on-screen.
if (tab.browser.contentWindowWidth == oldWidth)
- tab.restoreViewportPosition(oldWidth, w);
+ tab.restoreViewportPosition(oldWidth, newWidth);
}
// setTimeout(callback, 0) to ensure the resize event handler dispatch is finished
setTimeout(function() {
let event = document.createEvent("Events");
event.initEvent("SizeChanged", true, false);
Elements.browsers.dispatchEvent(event);
}, 0);
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -353,23 +353,27 @@
<separator class="thin"/>
<vbox>
<button id="bookmark-popup-edit" label="&bookmarkEdit.label;" oncommand="BookmarkHelper.edit();"/>
<spacer/>
<button id="bookmark-popup-remove" label="&bookmarkRemove.label;" oncommand="BookmarkPopup.hide(); BookmarkHelper.removeBookmarksForURI(getBrowser().currentURI);"/>
</vbox>
</arrowbox>
- <vbox id="bookmark-container" hidden="true" class="panel-dark window-width">
- <hbox id="bookmark-form" align="start">
- <image id="bookmark-image"/>
- </hbox>
- <hbox pack="center">
- <button label="&editBookmarkDone.label;" oncommand="BookmarkHelper.save();"/>
- </hbox>
+ <vbox id="bookmark-container" hidden="true" class="panel-dark window-width window-height">
+ <vbox id="bookmark-dialog" class="panel-dark">
+ <hbox id="bookmark-form-title">
+ <description>&editBookmarkDialog.title;</description>
+ </hbox>
+ <separator id="bookmark-form-line"/>
+ <scrollbox id="bookmark-form" align="start"/>
+ <hbox id="bookmark-form-buttons" pack="center">
+ <button label="&editBookmarkDone.label;" oncommand="BookmarkHelper.save();"/>
+ </hbox>
+ </vbox>
</vbox>
<vbox id="panel-container" class="panel-dark window-width window-height" style="-moz-stack-sizing: ignore" left="10000" hidden="true">
<hbox id="panel-controls" class="panel-row-header" oncommand="BrowserUI.switchPane(event.target.getAttribute('linkedpanel'));">
<toolbarbutton id="tool-preferences" class="panel-row-button" type="radio" group="1" checked="true" linkedpanel="prefs-container"/>
<toolbarbutton id="tool-downloads" class="panel-row-button" type="radio" group="1" linkedpanel="downloads-container"/>
<toolbarbutton id="tool-addons" class="panel-row-button" type="radio" group="1" linkedpanel="addons-container"/>
<toolbarbutton id="tool-console" class="panel-row-button" type="radio" group="1" hidden="true" linkedpanel="console-container"/>
@@ -510,60 +514,61 @@
<placelist id="bookmarks-items" type="bookmarks" onopen="BookmarkList.openLink(event);" onhide="BrowserUI.updateStar();" flex="1" hidden="true"/>
<historylist id="history-items" onopen="HistoryList.openLink(event);" flex="1" hidden="true"/>
#ifdef MOZ_SERVICES_SYNC
<remotetabslist id="remotetabs-items" onopen="RemoteTabsList.openLink(event)" flex="1" hidden="true"/>
#endif
</vbox>
#ifdef MOZ_SERVICES_SYNC
- <vbox id="syncsetup-container" class="panel-dark window-width window-height" hidden="true">
- <hbox class="syncsetup-title">
- <description>&sync.setup.title;</description>
-#ifndef ANDROID
- <spacer flex="1"/>
- <toolbarbutton id="tool-syncsetup-close" class="panel-close" oncommand="WeaveGlue.close();"/>
-#endif
- </hbox>
- <scrollbox id="syncsetup-scrollbox" orient="vertical" flex="1">
- <vbox id="syncsetup-jpake" class="syncsetup-page" flex="1">
- <description class="syncsetup-center" flex="1">&sync.setup.jpake;</description>
- <separator/>
- <vbox align="center" flex="1">
- <description id="syncsetup-code1" class="syncsetup-code">....</description>
- <description id="syncsetup-code2" class="syncsetup-code">....</description>
- <description id="syncsetup-code3" class="syncsetup-code">....</description>
- </vbox>
- <separator/>
- <description class="syncsetup-center syncsetup-link" flex="1" onclick="WeaveGlue.openManual();">&sync.fallback;</description>
- <separator flex="1"/>
- <hbox pack="center">
+ <vbox id="syncsetup-container" class="window-width window-height" hidden="true">
+ <vbox id="syncsetup-dialog" class="panel-dark" flex="1">
+ <hbox class="syncsetup-title">
+ <description>&sync.setup.title;</description>
+ </hbox>
+ <separator class="syncsetup-line"/>
+ <vbox id="syncsetup-simple" class="syncsetup-page" flex="1">
+ <scrollbox class="syncsetup-scrollbox" orient="vertical" flex="1">
+ <description class="syncsetup-desc syncsetup-center" flex="1">&sync.setup.jpake;</description>
+ <separator/>
+ <vbox align="center" flex="1">
+ <description id="syncsetup-code1" class="syncsetup-code">....</description>
+ <description id="syncsetup-code2" class="syncsetup-code">....</description>
+ <description id="syncsetup-code3" class="syncsetup-code">....</description>
+ </vbox>
+ <separator/>
+ <description class="syncsetup-center syncsetup-link" flex="1" onclick="WeaveGlue.openManual();">&sync.fallback;</description>
+ <separator flex="1"/>
+ </scrollbox>
+ <hbox class="syncsetup-buttons" pack="center">
<button oncommand="WeaveGlue.abortEasySetup(); WeaveGlue.close();">&sync.setup.cancel;</button>
</hbox>
</vbox>
- <vbox id="syncsetup-manual" class="syncsetup-page" flex="1" hidden="true">
- <description class="syncsetup-center" flex="1">&sync.setup.manual;</description>
- <separator/>
- <textbox id="syncsetup-account" class="syncsetup-edit" placeholder="&sync.account;"/>
- <textbox id="syncsetup-password" class="syncsetup-edit" placeholder="&sync.password;" type="password"/>
- <textbox id="syncsetup-synckey" class="syncsetup-edit" placeholder="&sync.syncKey;"/>
- <separator class="thin"/>
- <button id="syncsetup-usecustomserver" type="checkbox" class="button-checkbox" pack="start" oncommand="WeaveGlue.toggleCustomServer();">
- <image class="button-image-icon"/>
- <description class="syncsetup-label" flex="1">&sync.customServer;</description>
- </button>
- <textbox id="syncsetup-customserver" placeholder="&sync.serverURL;"/>
- <separator flex="1"/>
- <hbox pack="center">
+ <vbox id="syncsetup-fallback" class="syncsetup-page" flex="1" hidden="true">
+ <scrollbox class="syncsetup-scrollbox" orient="vertical" flex="1">
+ <description class="syncsetup-desc syncsetup-center" flex="1">&sync.setup.manual;</description>
+ <separator/>
+ <textbox id="syncsetup-account" class="syncsetup-edit" placeholder="&sync.account;"/>
+ <textbox id="syncsetup-password" class="syncsetup-edit" placeholder="&sync.password;" type="password"/>
+ <textbox id="syncsetup-synckey" class="syncsetup-edit" placeholder="&sync.syncKey;"/>
+ <separator class="thin"/>
+ <button id="syncsetup-usecustomserver" type="checkbox" class="button-checkbox" pack="start" oncommand="WeaveGlue.toggleCustomServer();">
+ <image class="button-image-icon"/>
+ <description class="syncsetup-label" flex="1">&sync.customServer;</description>
+ </button>
+ <textbox id="syncsetup-customserver" placeholder="&sync.serverURL;"/>
+ <separator flex="1"/>
+ </scrollbox>
+ <hbox class="syncsetup-buttons" pack="center">
<button oncommand="WeaveGlue.close();">&sync.setup.cancel;</button>
<separator/>
<button oncommand="WeaveGlue.close(); WeaveGlue.connect();">&sync.setup.connect;</button>
</hbox>
</vbox>
- </scrollbox>
+ </vbox>
</vbox>
#endif
<arrowbox id="search-engines-popup" hidden="true" offset="18" flex="1">
<hbox id="search-engines-list" class="prompt-buttons" flex="1"/>
</arrowbox>
<vbox id="newtab-popup" hidden="true" class="dialog-dark" onclick="NewTabPopup.selectTab()" align="center" left="21">
--- a/mobile/chrome/content/sync.js
+++ b/mobile/chrome/content/sync.js
@@ -76,28 +76,38 @@ let WeaveGlue = {
document.getElementById("syncsetup-code3").value = "....";
if (!this.jpake)
return;
this.jpake.abort();
this.jpake = null;
},
+ _resetScrollPosition: function _resetScrollPosition() {
+ let scrollboxes = document.getElementsByClassName("syncsetup-scrollbox");
+ for (let i = 0; i < scrollboxes.length; i++) {
+ let sbo = scrollboxes[i].boxObject.QueryInterface(Ci.nsIScrollBoxObject);
+ try {
+ sbo.scrollTo(0, 0);
+ } catch(e) {}
+ }
+ },
+
open: function open() {
let container = document.getElementById("syncsetup-container");
if (!container.hidden)
return;
// Clear up any previous JPAKE codes
this.abortEasySetup();
// Show the connect UI
container.hidden = false;
- document.getElementById("syncsetup-jpake").hidden = false;
- document.getElementById("syncsetup-manual").hidden = true;
+ document.getElementById("syncsetup-simple").hidden = false;
+ document.getElementById("syncsetup-fallback").hidden = true;
BrowserUI.pushDialog(this);
let self = this;
this.jpake = new Weave.JPAKEClient({
displayPIN: function displayPIN(aPin) {
document.getElementById("syncsetup-code1").value = aPin.slice(0, 4);
document.getElementById("syncsetup-code2").value = aPin.slice(4, 8);
@@ -129,21 +139,20 @@ let WeaveGlue = {
});
this.jpake.receiveNoPIN();
},
openManual: function openManual() {
this.abortEasySetup();
// Reset the scroll since the previous page might have been scrolled
- let scrollbox = document.getElementById("syncsetup-scrollbox").boxObject.QueryInterface(Ci.nsIScrollBoxObject);
- scrollbox.scrollTo(0, 0);
+ this._resetScrollPosition();
- document.getElementById("syncsetup-jpake").hidden = true;
- document.getElementById("syncsetup-manual").hidden = false;
+ document.getElementById("syncsetup-simple").hidden = true;
+ document.getElementById("syncsetup-fallback").hidden = false;
// Push the current setup data into the UI
if (this.setupData && "account" in this.setupData) {
this._elements.account.value = this.setupData.account;
this._elements.password.value = this.setupData.password;
let pp = this.setupData.synckey;
if (Weave.Utils.isPassphrase(pp))
pp = Weave.Utils.hyphenatePassphrase(pp);
@@ -156,18 +165,18 @@ let WeaveGlue = {
this._elements.usecustomserver.checked = false;
this._elements.customserver.disabled = true;
this._elements.customserver.value = "";
}
}
},
close: function close() {
- let scrollbox = document.getElementById("syncsetup-scrollbox").boxObject.QueryInterface(Ci.nsIScrollBoxObject);
- scrollbox.scrollTo(0, 0);
+ // Reset the scroll since the previous page might have been scrolled
+ this._resetScrollPosition();
// Save current setup data
this.setupData = {
account: this._elements.account.value.trim(),
password: this._elements.password.value.trim(),
synckey: Weave.Utils.normalizePassphrase(this._elements.synckey.value.trim()),
serverURL: this._validateServer(this._elements.customserver.value.trim())
};
--- a/mobile/locales/en-US/chrome/browser.dtd
+++ b/mobile/locales/en-US/chrome/browser.dtd
@@ -21,16 +21,17 @@
<!ENTITY addToDictionary.label "Add to Dictionary">
<!ENTITY inputMethod.label "Select Input Method">
<!ENTITY allPagesHeader.label "All Pages">
<!ENTITY bookmarksHeader.label "Bookmarks">
<!ENTITY historyHeader.label "History">
<!ENTITY desktopHeader.label "Desktop">
+<!ENTITY editBookmarkDialog.title "Edit Bookmark">
<!ENTITY editBookmarkDone.label "Done">
<!ENTITY editBookmarkTags.label "Add tags here">
<!ENTITY selectHelper.done "Done">
<!ENTITY addonsHeader.label "Add-ons">
<!ENTITY addonsLocal.label "Your Add-ons">
<!ENTITY addonsUpdate.label "Update">
--- a/mobile/themes/core/browser.css
+++ b/mobile/themes/core/browser.css
@@ -970,31 +970,52 @@ documenttab[reload="true"] > stack > .do
#newtab-button {
-moz-box-flex: 1;
list-style-image: url("images/newtab-default-hdpi.png");
height: @sidebar_button_height@;
}
/* bookmark editor ------------------------------------------------------- */
#bookmark-container {
- padding: @padding_normal@; /* core spacing */
- background: rgb(94,97,102);
+ -moz-box-align: center;
+ -moz-box-pack: center;
+ background-color: rgba(0,0,0,.6);
+ padding: 0;
+}
+
+#bookmark-dialog {
+ margin: @margin_xxxnormal@ !important;
+ border: @border_width_small@ solid white;
+ border-radius: @border_radius_normal@;
box-shadow: black 0 @shadow_width_small@ @shadow_width_small@;
}
#bookmark-form {
- padding: @padding_normal@; /* core spacing */
+ padding: @padding_xxxnormal@;
+}
+
+#bookmark-form-title {
+ font-size: @font_xnormal@;
+ padding-top: @padding_large@;
+ -moz-box-align: center;
+ -moz-box-pack: center;
+}
+
+#bookmark-form-line {
+ border-bottom: @border_width_small@ solid white;
+ margin: @margin_small@ 3em 0 3em;
+ height: @padding_normal@ !important;
}
#bookmark-form .bookmark-controls {
display: none;
}
-#bookmark-image {
- list-style-image: url("images/star-40.png");
+#bookmark-form-buttons {
+ background-color: lightgray;
}
/* Identity popup -------------------------------------------------------- */
#identity-popup-container {
padding: @padding_normal@; /* core spacing */
padding-bottom: @padding_xxxnormal@;
}
@@ -1553,17 +1574,17 @@ pageaction:not([image]) > hbox >.pageact
.appmenu-button:hover:active {
background-image: url("chrome://browser/skin/images/appmenu-active-hdpi.png");
background-size: 100% 100%;
}
#appmenu > .appmenu-button .toolbarbutton-text {
display: block !important;
- font-size: @appmenu_font@ !important;
+ font-size: @font_snormal@ !important;
}
#appmenu > .appmenu-button .toolbarbutton-icon {
margin-top: @margin_normal@ !important;
margin-bottom: @margin_small@ !important;
}
@media (@orientation@: portrait) {
@@ -1583,32 +1604,60 @@ pageaction:not([image]) > hbox >.pageact
#appmenu[count="5"] > .appmenu-button:nth-child(4),
#appmenu[count="5"] > .appmenu-button:nth-child(5),
#appmenu[count="6"] > .appmenu-button {
width: 33.33%;
}
}
/* Sync setup ------------------------------------------------------------- */
-.syncsetup-page {
- padding: @padding_large@;
- background-color: #000;
+#syncsetup-container {
+ background-color: rgba(0,0,0,.6);
+ padding: 0;
+}
+
+#syncsetup-dialog {
+ margin: @margin_xxxnormal@ !important;
+ border: @border_width_large@ solid white;
+ border-radius: @border_radius_normal@;
+ box-shadow: black 0 @shadow_width_small@ @shadow_width_small@;
+}
+
+.syncsetup-scrollbox {
+ padding: @padding_xxxnormal@;
}
.syncsetup-center {
text-align: center;
}
.syncsetup-title {
+ font-size: @font_xnormal@;
+ padding-top: @padding_large@;
-moz-box-align: center;
+ -moz-box-pack: center;
+}
+
+.syncsetup-line {
+ border-bottom: @border_width_small@ solid white;
+ margin: @margin_small@ 3em 0 3em;
+ height: @padding_normal@ !important;
+}
+
+.syncsetup-desc {
+ font-size: @font_snormal@;
+}
+
+.syncsetup-buttons {
+ background-color: lightgray;
}
.syncsetup-code {
- color: #fff;
- background-color: rgb(94,97,102);
+ color: #000;
+ background-color: #fff;
border-radius: @border_radius_normal@;
font-size: @font_xlarge@ !important;
padding: 0.2em 0.4em;
-moz-padding-end: 0.2em;
letter-spacing: 0.2em;
text-align: center;
min-width: 5.5em;
}
--- a/mobile/themes/core/defines.inc
+++ b/mobile/themes/core/defines.inc
@@ -1,13 +1,15 @@
%filter substitution
%ifdef ANDROID
%define font_xlarge 5.08mozmm
+%define font_xnormal 2.75mozmm
%define font_normal 2.54mozmm
+%define font_snormal 2.33mozmm
%define font_small 1.91mozmm
%define font_xsmall 1.69mozmm
%define font_tiny 1.48mozmm
%define font_xtiny 1.27mozmm
%define touch_row 7.41mozmm
%define touch_button_xlarge 7.62mozmm
%define touch_button_large 6.77mozmm
@@ -73,22 +75,23 @@
%define autocomplete_item_container_padding 5.08mozmm
%define autocomplete_item_subtitle_margin 2.75mozmm
%define autocomplete_item_label_margin 3.18mozmm
%define autocomplete_item_tags_margin 3.39mozmm
%define autocompleteresult_padding 0.53mozmm
-%define appmenu_font 2.33mozmm
%define appmenu_portrait_height 21.17mozmm
%define appmenu_button_height 10.48mozmm
%else
%define font_xlarge 48px
+%define font_xnormal 26px
%define font_normal 24px
+%define font_snormal 22px
%define font_small 18px
%define font_xsmall 16px
%define font_tiny 14px
%define font_xtiny 12px
%define touch_row 70px
%define touch_button_xlarge 72px
%define touch_button_large 64px
@@ -154,17 +157,16 @@
%define autocomplete_item_container_padding 48px
%define autocomplete_item_subtitle_margin 26px
%define autocomplete_item_label_margin 30px
%define autocomplete_item_tags_margin 32px
%define autocompleteresult_padding 5px
-%define appmenu_font 22px
%define appmenu_portrait_height 200px
%define appmenu_button_height 99px
%endif
%ifdef MOZ_PLATFORM_MAEMO
%define orientation -moz-device-orientation
%elifdef ANDROID
%define orientation -moz-device-orientation
deleted file mode 100644
index a597628043aab72421a09b115f818e78b30f3f1a..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/themes/core/jar.mn
+++ b/mobile/themes/core/jar.mn
@@ -39,17 +39,16 @@ chrome.jar:
skin/images/arrowbox-up.png (images/arrowbox-up.png)
skin/images/arrowbox-down.png (images/arrowbox-down.png)
skin/images/arrowbox-horiz.png (images/arrowbox-horiz.png)
skin/images/check-selected-30.png (images/check-selected-30.png)
skin/images/check-unselected-30.png (images/check-unselected-30.png)
skin/images/dropmarker-hdpi.png (images/dropmarker-hdpi.png)
skin/images/ratings-18.png (images/ratings-18.png)
skin/images/favicon-default-30.png (images/favicon-default-30.png)
- skin/images/star-40.png (images/star-40.png)
skin/images/endcap-default-bg.png (images/endcap-default-bg.png)
skin/images/endcap-active-bg.png (images/endcap-active-bg.png)
skin/images/endcap-ev-default-bg.png (images/endcap-ev-default-bg.png)
skin/images/endcap-ev-active-bg.png (images/endcap-ev-active-bg.png)
skin/images/endcap-ssl-default-bg.png (images/endcap-ssl-default-bg.png)
skin/images/endcap-ssl-active-bg.png (images/endcap-ssl-active-bg.png)
skin/images/throbber.png (images/throbber.png)
skin/images/navigation-magnifier-30.png (images/navigation-magnifier-30.png)