Bug 596485 - Provide visual indication of Switch to Tab override. r=gavin, a=blocking-betaN

This commit is contained in:
Drew Willcoxon 2010-12-10 18:32:14 -08:00
Родитель d221186c1c
Коммит 7171636b07
7 изменённых файлов: 108 добавлений и 23 удалений

Просмотреть файл

@ -255,10 +255,19 @@ html|*.urlbar-input {
/* For results that are actions, their description text is shown instead of
the URL - this needs to follow the locale's direction, unlike URLs. */
richlistitem[type~="action"]:-moz-locale-dir(rtl) > .ac-url-box {
panel:not([noactions]) > richlistbox > richlistitem[type~="action"]:-moz-locale-dir(rtl) > .ac-url-box {
direction: rtl;
}
panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .ac-url > .ac-action-text,
panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .ac-action-icon {
visibility: collapse;
}
panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .ac-url > .ac-url-text {
visibility: visible;
}
#urlbar:not([actiontype]) > #urlbar-display {
display: none;
}

Просмотреть файл

@ -235,7 +235,7 @@
var action = this._parseActionUrl(url);
if (action) {
url = action.param;
if (!(aTriggeringEvent && aTriggeringEvent.altKey)) {
if (this.hasAttribute("actiontype")) {
if (action.type == "switchtab") {
this.handleRevert();
let prevTab = gBrowser.selectedTab;
@ -277,6 +277,9 @@
if (aTriggeringEvent && aTriggeringEvent.altKey) {
this.handleRevert();
let prevTab = gBrowser.selectedTab;
if (isTabEmpty(prevTab))
gBrowser.removeTab(prevTab);
content.focus();
gBrowser.loadOneTab(url, {
postData: postData,
@ -779,9 +782,48 @@
this._originLabel.value = this.value;
]]></body>
</method>
<field name="_numNoActionsKeys"><![CDATA[
0
]]></field>
<method name="_clearNoActions">
<parameter name="aURL"/>
<body><![CDATA[
this._numNoActionsKeys = 0;
this.popup.removeAttribute("noactions");
let action = this._parseActionUrl(this._value);
if (action)
this.setAttribute("actiontype", action.type);
]]></body>
</method>
</implementation>
<handlers>
<handler event="keydown"><![CDATA[
if ((event.keyCode === KeyEvent.DOM_VK_ALT ||
event.keyCode === KeyEvent.DOM_VK_SHIFT) &&
this.popup.selectedIndex >= 0) {
this._numNoActionsKeys++;
this.popup.setAttribute("noactions", "true");
this.removeAttribute("actiontype");
}
]]></handler>
<handler event="keyup"><![CDATA[
if ((event.keyCode === KeyEvent.DOM_VK_ALT ||
event.keyCode === KeyEvent.DOM_VK_SHIFT) &&
this._numNoActionsKeys > 0) {
this._numNoActionsKeys--;
if (this._numNoActionsKeys == 0)
this._clearNoActions();
}
]]></handler>
<handler event="blur"><![CDATA[
this._clearNoActions();
]]></handler>
<handler event="draggesture" phase="capturing"><![CDATA[
// TODO: This should use dragstart but editor code is still using
// the old drag & drop APIs, so we have to handle draggesture.

Просмотреть файл

@ -1223,7 +1223,8 @@ toolbar[iconsize="small"] #feed-button {
font-size: inherit;
}
.ac-url-text {
.ac-url-text,
.ac-action-text {
color: -moz-nativehyperlinktext;
}
@ -1235,7 +1236,9 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
color: GrayText;
}
.ac-comment[selected="true"], .ac-url-text[selected="true"] {
.ac-comment[selected="true"],
.ac-url-text[selected="true"],
.ac-action-text[selected="true"] {
color: inherit !important;
}

Просмотреть файл

@ -922,7 +922,8 @@ richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
font-size: inherit;
}
.ac-url-text {
.ac-url-text,
.ac-action-text {
color: -moz-nativehyperlinktext;
font-size: 0.95em;
}
@ -935,7 +936,9 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
color: GrayText;
}
.ac-comment[selected="true"], .ac-url-text[selected="true"] {
.ac-comment[selected="true"],
.ac-url-text[selected="true"],
.ac-action-text[selected="true"] {
color: inherit !important;
}

Просмотреть файл

@ -1250,12 +1250,14 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
font-size: inherit;
}
.ac-url-text {
.ac-url-text,
.ac-action-text {
color: -moz-nativehyperlinktext;
}
%ifndef WINSTRIPE_AERO
.ac-url-text:-moz-system-metric(windows-default-theme) {
.ac-url-text:-moz-system-metric(windows-default-theme),
.ac-action-text:-moz-system-metric(windows-default-theme) {
color: #006600;
}
%endif
@ -1268,7 +1270,9 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
color: GrayText;
}
.ac-comment[selected="true"], .ac-url-text[selected="true"] {
.ac-comment[selected="true"],
.ac-url-text[selected="true"],
.ac-action-text[selected="true"] {
color: inherit !important;
}

Просмотреть файл

@ -27,6 +27,7 @@
# Masayuki Nakano (masayuki@d-toybox.com)
# Pamela Greene (pamg.bugs@gmail.com)
# Edward Lee (edward.lee@engineering.uiuc.edu)
# Drew Willcoxon (adw@mozilla.com)
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -1164,11 +1165,12 @@
<xul:hbox align="center" class="ac-title-box">
<xul:image xbl:inherits="src=image" class="ac-site-icon"/>
<xul:hbox anonid="title-box" class="ac-title" flex="1"
onunderflow="_doUnderflow('_title');">
onunderflow="_doUnderflow('_title');"
onoverflow="_doOverflow('_title');">
<xul:description anonid="title" class="ac-normal-text ac-comment" xbl:inherits="selected"/>
</xul:hbox>
<xul:label anonid="title-overflow-ellipsis" xbl:inherits="selected"
class="ac-ellipsis-after ac-comment" hidden="true"/>
class="ac-ellipsis-after ac-comment"/>
<xul:hbox anonid="extra-box" class="ac-extra" align="center" hidden="true">
<xul:image class="ac-result-type-tag"/>
<xul:label class="ac-normal-text ac-comment" xbl:inherits="selected" value=":"/>
@ -1180,11 +1182,15 @@
<xul:spacer class="ac-site-icon"/>
<xul:image class="ac-action-icon"/>
<xul:hbox anonid="url-box" class="ac-url" flex="1"
onunderflow="_doUnderflow('_url');">
<xul:description anonid="url" class="ac-normal-text ac-url-text" xbl:inherits="selected"/>
onunderflow="_doUnderflow('_url');"
onoverflow="_doOverflow('_url');">
<xul:description anonid="url" class="ac-normal-text ac-url-text"
xbl:inherits="selected type"/>
<xul:description anonid="action" class="ac-normal-text ac-action-text"
xbl:inherits="selected type"/>
</xul:hbox>
<xul:label anonid="url-overflow-ellipsis" xbl:inherits="selected"
class="ac-ellipsis-after ac-url-text" hidden="true"/>
class="ac-ellipsis-after ac-url-text"/>
<xul:spacer class="ac-type-icon"/>
</xul:hbox>
</content>
@ -1211,6 +1217,7 @@
this._urlBox = document.getAnonymousElementByAttribute(this, "anonid", "url-box");
this._url = document.getAnonymousElementByAttribute(this, "anonid", "url");
this._action = document.getAnonymousElementByAttribute(this, "anonid", "action");
this._titleBox = document.getAnonymousElementByAttribute(this, "anonid", "title-box");
this._title = document.getAnonymousElementByAttribute(this, "anonid", "title");
@ -1408,8 +1415,6 @@
this.removeAttribute("actiontype");
var setupUrl = true;
// If the type includes an action, set up the item appropriately.
var types = type.split(/\s+/);
var actionIndex = types.indexOf("action");
@ -1418,8 +1423,7 @@
this.setAttribute("actiontype", action);
url = param;
let desc = "]]>&action.switchToTab.label;<![CDATA[";
this._setUpDescription(this._url, desc, true);
setupUrl = false;
this._setUpDescription(this._action, desc, true);
// Remove the "action" substring so that the correct style, if any,
// is applied below.
@ -1484,8 +1488,7 @@
// Emphasize the matching search terms for the description
this._setUpDescription(this._title, title);
if (setupUrl)
this._setUpDescription(this._url, url);
this._setUpDescription(this._url, url);
// Set up overflow on a timeout because the contents of the box
// might not have a width yet even though we just changed them
@ -1501,7 +1504,7 @@
<body>
<![CDATA[
// Hide the ellipsis incase there's just enough to not underflow
aEllipsis.hidden = true;
aEllipsis.style.visibility = "hidden";
// Start with the parent's width and subtract off its children
let tooltip = [];
@ -1525,7 +1528,7 @@
// If the children take up more space than the parent.. overflow!
if (widthDiff < 0) {
// Re-show the ellipsis now that we know it's needed
aEllipsis.hidden = false;
aEllipsis.style.visibility = "visible";
// Separate text components with a ndash --
aParentBox.tooltipText = tooltip.join(" \u2013 ");
@ -1541,7 +1544,17 @@
// Hide the ellipsis right when we know we're underflowing instead of
// waiting for the timeout to trigger the _setUpOverflow calculations
this[aName + "Box"].tooltipText = "";
this[aName + "OverflowEllipsis"].hidden = true;
this[aName + "OverflowEllipsis"].style.visibility = "hidden";
]]>
</body>
</method>
<method name="_doOverflow">
<parameter name="aName"/>
<body>
<![CDATA[
this._setUpOverflow(this[aName + "Box"],
this[aName + "OverflowEllipsis"]);
]]>
</body>
</method>

Просмотреть файл

@ -789,6 +789,8 @@ panel[type="autocomplete-richlistbox"] {
-moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-rich-result-popup");
}
/* FIXME: bug 616258 */
.autocomplete-tree {
-moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-tree");
-moz-user-focus: ignore;
@ -826,6 +828,15 @@ panel[type="autocomplete-richlistbox"] {
-moz-binding: url("chrome://global/content/bindings/autocomplete.xml#history-dropmarker");
}
.ac-ellipsis-after {
visibility: hidden;
}
.ac-url-text[type~="action"],
.ac-action-text:not([type~="action"]) {
visibility: collapse;
}
%endif