зеркало из https://github.com/mozilla/pjs.git
165955 - turning on satchel in phoenix
This commit is contained in:
Родитель
45a798ab90
Коммит
f231c9ea08
|
@ -0,0 +1,20 @@
|
|||
|
||||
/* ::::::::::
|
||||
:: Rules for 'hiding' portions of the chrome for special
|
||||
:: kinds of browser-specific window toolbars. Other global
|
||||
:: window rules are in xul.css
|
||||
::::: */
|
||||
|
||||
window[chromehidden~="toolbar"] #nav-bar-buttons,
|
||||
window[chromehidden~="toolbar"] #print-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
window[chromehidden~="toolbar"] #navigator-throbber {
|
||||
margin: 0 5px 0 0 !important;
|
||||
list-style-image: url("chrome://communicator/skin/brand/throbber16-single.gif") !important;
|
||||
}
|
||||
|
||||
window[chromehidden~="toolbar"] #navigator-throbber[busy="true"] {
|
||||
list-style-image: url("chrome://communicator/skin/brand/throbber16-anim.gif") !important;
|
||||
}
|
|
@ -1060,7 +1060,7 @@ function handleURLBarRevert()
|
|||
var url = getWebNavigation().currentURI.spec;
|
||||
var throbberElement = document.getElementById("navigator-throbber");
|
||||
|
||||
var isScrolling = gURLBar.userAction == "scrolling";
|
||||
var isScrolling = gURLBar.popupOpen;
|
||||
|
||||
// don't revert to last valid url unless page is NOT loading
|
||||
// and user is NOT key-scrolling through autocomplete list
|
||||
|
@ -1076,10 +1076,10 @@ function handleURLBarRevert()
|
|||
|
||||
// tell widget to revert to last typed text only if the user
|
||||
// was scrolling when they hit escape
|
||||
return isScrolling;
|
||||
return !isScrolling;
|
||||
}
|
||||
|
||||
function handleURLBarCommand(aUserAction, aTriggeringEvent)
|
||||
function handleURLBarCommand(aTriggeringEvent)
|
||||
{
|
||||
try {
|
||||
addToUrlbarHistory();
|
||||
|
@ -2257,67 +2257,6 @@ function FillHistoryMenu(aParent, aMenu)
|
|||
return true;
|
||||
}
|
||||
|
||||
function executeUrlBarHistoryCommand( aTarget )
|
||||
{
|
||||
var index = aTarget.getAttribute("index");
|
||||
var label = aTarget.getAttribute("label");
|
||||
if (index != "nothing_available" && label)
|
||||
{
|
||||
var uri = getShortcutOrURI(label);
|
||||
if (gURLBar) {
|
||||
gURLBar.value = uri;
|
||||
addToUrlbarHistory();
|
||||
BrowserLoadURL();
|
||||
}
|
||||
else
|
||||
loadURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
function createUBHistoryMenu( aParent )
|
||||
{
|
||||
if (!gRDF)
|
||||
gRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
if (!gLocalStore)
|
||||
gLocalStore = gRDF.GetDataSource("rdf:local-store");
|
||||
|
||||
if (gLocalStore) {
|
||||
if (!gRDFC)
|
||||
gRDFC = Components.classes["@mozilla.org/rdf/container-utils;1"]
|
||||
.getService(Components.interfaces.nsIRDFContainerUtils);
|
||||
|
||||
var entries = gRDFC.MakeSeq(gLocalStore, gRDF.GetResource("nc:urlbar-history")).GetElements();
|
||||
var i= MAX_HISTORY_MENU_ITEMS;
|
||||
|
||||
// Delete any old menu items only if there are legitimate
|
||||
// urls to display, otherwise we want to display the
|
||||
// '(Nothing Available)' item.
|
||||
deleteHistoryItems(aParent);
|
||||
if (!entries.hasMoreElements()) {
|
||||
//Create the "Nothing Available" Menu item and disable it.
|
||||
var na = gNavigatorBundle.getString("nothingAvailable");
|
||||
createMenuItem(aParent, "nothing_available", na);
|
||||
aParent.firstChild.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
while (entries.hasMoreElements() && (i-- > 0)) {
|
||||
var entry = entries.getNext();
|
||||
if (entry) {
|
||||
try {
|
||||
entry = entry.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
} catch(ex) {
|
||||
// XXXbar not an nsIRDFLiteral for some reason. see 90337.
|
||||
continue;
|
||||
}
|
||||
var url = entry.Value;
|
||||
createMenuItem(aParent, i, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addToUrlbarHistory()
|
||||
{
|
||||
var urlToAdd = gURLBar.value;
|
||||
|
|
|
@ -24,7 +24,7 @@ Contributor(s):
|
|||
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://navigator/content/navigator.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/bookmarks/bookmarks.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://navigator/content/platformNavigationBindings.xul"?>
|
||||
|
@ -228,6 +228,8 @@ Contributor(s):
|
|||
<popup id="forwardMenu" position="after_start" onpopupshowing="return BrowserForwardMenu(event);" oncommand="gotoHistoryIndex(event);"/>
|
||||
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
|
||||
|
||||
<popup type="autocomplete" id="PopupAutoComplete"/>
|
||||
|
||||
<popup id="toolbar-context-menu">
|
||||
<menuitem command="cmd_CustomizeToolbars"
|
||||
label="&viewCustomizeToolbar.label;"
|
||||
|
@ -683,7 +685,7 @@ Contributor(s):
|
|||
</menu>
|
||||
</menubar>
|
||||
|
||||
<toolbarpalette>
|
||||
<toolbarpalette id="BrowserToolbarPalette">
|
||||
<toolbarbutton id="back-button" type="menu-button" class="toolbarbutton-1"
|
||||
label="&backCmd.label;"
|
||||
command="Browser:Back"
|
||||
|
@ -722,15 +724,16 @@ Contributor(s):
|
|||
<toolbaritem id="urlbar-container" align="center" flex="1"
|
||||
class="chromeclass-location">
|
||||
<textbox id="urlbar" flex="1"
|
||||
type="autocomplete" searchSessions="history"
|
||||
timeout="50" maxrows="6" alwaysopenpopup="true"
|
||||
disablehistory="false"
|
||||
defaultSearchEngine="true" tabScrolling="true"
|
||||
showCommentColumn="true"
|
||||
type="autocomplete"
|
||||
autocompletesearch="history"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
tabscrolling="true"
|
||||
showcommentcolumn="true"
|
||||
enablehistory="true"
|
||||
inputtooltiptext="&locationBar.tooltip;"
|
||||
oninput="window.XULBrowserWindow.userTyped.value=true;"
|
||||
ontextcommand="return handleURLBarCommand(eventParam, domEvent);"
|
||||
ontextrevert="return handleURLBarRevert();"
|
||||
ontextentered="return handleURLBarCommand(param);"
|
||||
ontextreverted="return handleURLBarRevert();"
|
||||
onfocus="URLBarFocusHandler(event);"
|
||||
onmousedown="URLBarMouseDownHandler(event);"
|
||||
onclick="URLBarClickHandler(event);">
|
||||
|
@ -747,11 +750,6 @@ Contributor(s):
|
|||
onerror="gBrowser.addToMissedIconCache(this.src); HandleBookmarkIcon(this.src, false);"
|
||||
tooltiptext="&proxyIcon.tooltip;"/>
|
||||
</deck>
|
||||
|
||||
<menupopup class="autocomplete-history-popup"
|
||||
popupalign="topleft" popupanchor="bottomleft"
|
||||
onpopupshowing="createUBHistoryMenu(event.target);"
|
||||
oncommand="executeUrlBarHistoryCommand(event.target);"/>
|
||||
</textbox>
|
||||
</toolbaritem>
|
||||
|
||||
|
@ -816,6 +814,7 @@ Contributor(s):
|
|||
<tabbrowser id="content"
|
||||
flex="1" contenttooltip="aHTMLTooltip"
|
||||
contentcontextmenu="contentAreaContextMenu"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
onnewtab="BrowserOpenTab();"
|
||||
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
|
||||
onclick="return contentAreaClick(event);"/>
|
||||
|
|
|
@ -2,6 +2,7 @@ browser.jar:
|
|||
content/browser/contents.rdf (content/contents.rdf)
|
||||
content/browser/browser.xul (content/browser.xul)
|
||||
content/browser/browser.js (content/browser.js)
|
||||
content/browser/browser.css (content/browser.css)
|
||||
content/browser/utilityOverlay.js (content/utilityOverlay.js)
|
||||
content/browser/about.gif (content/about.gif)
|
||||
content/browser/aboutDialog.xul (content/aboutDialog.xul)
|
||||
|
|
|
@ -518,7 +518,7 @@ toolbar[iconsize="small"] #print-button[disabled="true"] {
|
|||
|
||||
/* ::::: autocomplete ::::: */
|
||||
|
||||
.autocomplete-treebody:-moz-outliner-cell-text(treecolAutoCompleteComment) {
|
||||
.autocomplete-treebody:-moz-tree-cell-text(treecolAutoCompleteComment) {
|
||||
color: #555566;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = xre skin/win
|
||||
DIRS = xre components skin/win
|
||||
|
||||
ifeq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
DIRS += skin/unix
|
||||
|
|
|
@ -62,6 +62,11 @@ interface nsIAutoCompleteController : nsISupports
|
|||
const unsigned short KEY_HOME = 7;
|
||||
const unsigned short KEY_END = 8;
|
||||
|
||||
/*
|
||||
* The input widget that is currently being controlled.
|
||||
*/
|
||||
attribute nsIAutoCompleteInput input;
|
||||
|
||||
/*
|
||||
* State which indicates the status of possible ongoing searches
|
||||
*/
|
||||
|
@ -73,17 +78,9 @@ interface nsIAutoCompleteController : nsISupports
|
|||
readonly attribute unsigned long matchCount;
|
||||
|
||||
/*
|
||||
* Begin conducting autocomplete behavior on a given input object
|
||||
*
|
||||
* @param input - the input object to coordinate searching with
|
||||
* @param searchString - an optional default string to search for immediately
|
||||
* Start a search on a string, assuming the input property is already set.
|
||||
*/
|
||||
void attachToInput(in nsIAutoCompleteInput input, in AString searchString);
|
||||
|
||||
/*
|
||||
* Detach conductor from the widget it is currently attached to
|
||||
*/
|
||||
void detachFromInput();
|
||||
void startSearch(in AString searchString);
|
||||
|
||||
/*
|
||||
* Notify the controller that the user has changed text in the textbox. This includes all
|
||||
|
|
|
@ -67,7 +67,7 @@ nsAutoCompleteController::nsAutoCompleteController() :
|
|||
|
||||
nsAutoCompleteController::~nsAutoCompleteController()
|
||||
{
|
||||
DetachFromInput();
|
||||
SetInput(nsnull);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -88,18 +88,35 @@ nsAutoCompleteController::GetMatchCount(PRUint32 *aMatchCount)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAutoCompleteController::AttachToInput(nsIAutoCompleteInput *aInput, const nsAString &aSearchString)
|
||||
nsAutoCompleteController::GetInput(nsIAutoCompleteInput **aInput)
|
||||
{
|
||||
if (!aInput)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
*aInput = mInput;
|
||||
NS_IF_ADDREF(*aInput);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mInput)
|
||||
DetachFromInput();
|
||||
NS_IMETHODIMP
|
||||
nsAutoCompleteController::SetInput(nsIAutoCompleteInput *aInput)
|
||||
{
|
||||
// Don't do anything if the input isn't changing.
|
||||
if (mInput == aInput)
|
||||
return NS_OK;
|
||||
|
||||
// Clear out the current search context
|
||||
if (mInput) {
|
||||
ClearSearchTimer();
|
||||
ClearResults();
|
||||
ClosePopup();
|
||||
mSearches->Clear();
|
||||
}
|
||||
|
||||
mInput = aInput;
|
||||
mSearchString = aSearchString;
|
||||
|
||||
// reset all search state members to default values
|
||||
// Nothing more to do if the input was just being set to null.
|
||||
if (!aInput)
|
||||
return NS_OK;
|
||||
|
||||
// Reset all search state members to default values
|
||||
mSearchString.Truncate(0);
|
||||
mEnterAfterSearch = PR_FALSE;
|
||||
mNeedToComplete = PR_FALSE;
|
||||
|
@ -109,7 +126,7 @@ nsAutoCompleteController::AttachToInput(nsIAutoCompleteInput *aInput, const nsAS
|
|||
mRowCount = 0;
|
||||
mSearchesOngoing = 0;
|
||||
|
||||
// initialize our list of search objects
|
||||
// Initialize our list of search objects
|
||||
PRUint32 searchCount;
|
||||
mInput->GetSearchCount(&searchCount);
|
||||
mResults->SizeTo(searchCount);
|
||||
|
@ -131,25 +148,14 @@ nsAutoCompleteController::AttachToInput(nsIAutoCompleteInput *aInput, const nsAS
|
|||
mSearches->AppendElement(search);
|
||||
}
|
||||
|
||||
if (!mSearchString.IsEmpty())
|
||||
StartSearchTimer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAutoCompleteController::DetachFromInput()
|
||||
nsAutoCompleteController::StartSearch(const nsAString &aSearchString)
|
||||
{
|
||||
if (mInput) {
|
||||
ClearSearchTimer();
|
||||
ClearResults();
|
||||
ClosePopup();
|
||||
|
||||
// release refcounted and allocated members
|
||||
mInput = nsnull;
|
||||
mSearches->Clear();
|
||||
mSearchString.Truncate(0);
|
||||
}
|
||||
mSearchString = aSearchString;
|
||||
StartSearchTimer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -614,7 +614,7 @@ nsFormFillController::StartControllingInput(nsIDOMHTMLInputElement *aInput)
|
|||
AddKeyListener(aInput);
|
||||
|
||||
// Now we are the autocomplete controller's bitch
|
||||
mController->AttachToInput(this, NS_LITERAL_STRING(""));
|
||||
mController->SetInput(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -622,7 +622,13 @@ nsFormFillController::StopControllingInput()
|
|||
{
|
||||
RemoveKeyListener();
|
||||
|
||||
mController->DetachFromInput();
|
||||
// Reset the controller's input, but not if it has been switched
|
||||
// to another input already, which might happen if the user switches
|
||||
// focus by clicking another autocomplete textbox
|
||||
nsCOMPtr<nsIAutoCompleteInput> input;
|
||||
mController->GetInput(getter_AddRefs(input));
|
||||
if (input == this)
|
||||
mController->SetInput(nsnull);
|
||||
|
||||
mFocusedInput = nsnull;
|
||||
mFocusedPopup = nsnull;
|
||||
|
|
|
@ -0,0 +1,692 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="autocompleteBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="autocomplete"
|
||||
extends="chrome://global/content/bindings/textbox.xml#textbox">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/autocomplete.css"/>
|
||||
</resources>
|
||||
|
||||
<content sizetopopup="pref">
|
||||
<xul:hbox class="autocomplete-textbox-container" flex="1">
|
||||
<children includes="image|deck">
|
||||
<xul:image class="autocomplete-icon" allowevents="true"/>
|
||||
</children>
|
||||
|
||||
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="tooltiptext=inputtooltiptext">
|
||||
<children/>
|
||||
<html:input anonid="input" class="autocomplete-textbox textbox-input"
|
||||
flex="1" allowevents="true"
|
||||
xbl:inherits="tooltiptext=inputtooltiptext,onfocus,onblur,value,type,maxlength,disabled,size,readonly,userAction"/>
|
||||
</xul:hbox>
|
||||
</xul:hbox>
|
||||
|
||||
<xul:dropmarker anonid="historydropmarker" class="autocomplete-history-dropmarker"
|
||||
allowevents="true"
|
||||
xbl:inherits="open,enablehistory"/>
|
||||
|
||||
<xul:popupset anonid="popupset" class="autocomplete-result-popupset"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider, nsIAutoCompleteInput, nsIDOMXULMenuListElement">
|
||||
<field name="mController">null</field>
|
||||
<field name="mSearchNames">null</field>
|
||||
<field name="mIgnoreInput">false</field>
|
||||
<field name="mEnterEvent">null</field>
|
||||
|
||||
<field name="mInputElt">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "input");
|
||||
</field>
|
||||
|
||||
<constructor><![CDATA[
|
||||
// set default property values
|
||||
this.ifSetAttribute("disablehistory", true);
|
||||
|
||||
mController = Components.classes["@mozilla.org/autocomplete/controller;1"].
|
||||
getService(Components.interfaces.nsIAutoCompleteController);
|
||||
]]></constructor>
|
||||
|
||||
<!-- =================== nsIAccessibleProvider =================== -->
|
||||
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].
|
||||
getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULComboboxAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<!-- =================== nsIAutoCompleteInput =================== -->
|
||||
|
||||
<field name="popup"><![CDATA[
|
||||
var popup = null;
|
||||
var popupId = this.getAttribute("autocompletepopup");
|
||||
if (popupId)
|
||||
popup = document.getElementById(popupId);
|
||||
if (!popup) {
|
||||
popup = document.createElement("popup");
|
||||
popup.setAttribute("type", "autocomplete");
|
||||
popup.setAttribute("hidden", "true");
|
||||
|
||||
var popupset = document.getAnonymousElementByAttribute(this, "anonid", "popupset");
|
||||
popupset.appendChild(popup);
|
||||
}
|
||||
popup.mParentTextbox = this;
|
||||
popup;
|
||||
]]></field>
|
||||
|
||||
<property name="popupOpen"
|
||||
onget="return this.popup.popupOpen;"
|
||||
onset="if (val) this.openPopup(); else this.closePopup();"/>
|
||||
|
||||
<property name="disableAutoComplete"
|
||||
onset="this.setAttribute('disableautocomplete', val); return val;"
|
||||
onget="return this.getAttribute('disableautocomplete') == 'true';"/>
|
||||
|
||||
<property name="completeDefaultIndex"
|
||||
onset="this.setAttribute('completedefaultindex', val); return val;"
|
||||
onget="return this.getAttribute('completedefaultindex') == 'true';"/>
|
||||
|
||||
<property name="forceComplete"
|
||||
onset="this.setAttribute('forcecomplete', val); return val;"
|
||||
onget="return this.getAttribute('forcecomplete') == 'true';"/>
|
||||
|
||||
<property name="minResultsForPopup"
|
||||
onset="this.setAttribute('minresultsforpopup', val); return val;"
|
||||
onget="var t = parseInt(this.getAttribute('minresultsforpopup')); return t ? t : 0;"/>
|
||||
|
||||
<property name="showCommentColumn"
|
||||
onset="this.setAttribute('showcommentcolumn', val); return val;"
|
||||
onget="return this.getAttribute('showcommentcolumn') == 'true';"/>
|
||||
|
||||
<property name="timeout"
|
||||
onset="this.setAttribute('timeout', val); return val;"
|
||||
onget="var t = parseInt(this.getAttribute('timeout')); return t ? t : 50;"/>
|
||||
|
||||
<property name="searchParam"
|
||||
onget="return this.getAttribute('searchparam');"
|
||||
onset="this.setAttribute('searchparam', val); return val;"/>
|
||||
|
||||
<property name="searchCount" readonly="true"
|
||||
onget="this.initSearchNames(); return this.mSearchNames.length;"/>
|
||||
|
||||
<method name="getSearchAt">
|
||||
<parameter name="aIndex"/>
|
||||
<body><![CDATA[
|
||||
this.initSearchNames();
|
||||
return this.mSearchNames[aIndex];
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="textValue"
|
||||
onget="return this.value;"
|
||||
onset="return this.value = val;"/>
|
||||
|
||||
<property name="selectionStart"
|
||||
onget="return this.mInputElt.selectionStart;"/>
|
||||
|
||||
<property name="selectionEnd"
|
||||
onget="return this.mInputElt.selectionEnd;"/>
|
||||
|
||||
<method name="selectTextRange">
|
||||
<parameter name="aStartIndex"/>
|
||||
<parameter name="aEndIndex"/>
|
||||
<body><![CDATA[
|
||||
this.mInputElt.setSelectionRange(aStartIndex, aEndIndex);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onSearchComplete">
|
||||
<body><![CDATA[
|
||||
if (this.mController.matchCount == 0)
|
||||
this.popup.setAttribute("nomatch", "true");
|
||||
else
|
||||
this.popup.removeAttribute("nomatch");
|
||||
|
||||
this.fireEvent("searchcomplete");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onTextEntered">
|
||||
<body><![CDATA[
|
||||
return this.fireEvent("textentered", this.mEnterEvent);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onTextReverted">
|
||||
<body><![CDATA[
|
||||
return this.fireEvent("textreverted");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- =================== nsIDOMXULMenuListElement =================== -->
|
||||
|
||||
<property name="editable" readonly="true"
|
||||
onget="return true;" />
|
||||
|
||||
<property name="crop"
|
||||
onset="this.setAttribute('crop',val); return val;"
|
||||
onget="return this.getAttribute('crop');"/>
|
||||
|
||||
<property name="label"
|
||||
onset="this.setAttribute('label',val); return val;"
|
||||
onget="return this.getAttribute('label');"/>
|
||||
|
||||
<property name="open"
|
||||
onget="return this.getAttribute('open') == 'true';">
|
||||
<setter><![CDATA[
|
||||
var historyPopup = document.getAnonymousElementByAttribute(this, "anonid", "historydropmarker");
|
||||
if (val) {
|
||||
this.setAttribute("open", "true");
|
||||
historyPopup.showPopup();
|
||||
}
|
||||
else {
|
||||
this.removeAttribute("open");
|
||||
historyPopup.hidePopup();
|
||||
}
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- =================== PUBLIC MEMBERS =================== -->
|
||||
|
||||
<property name="value"
|
||||
onget="return this.mInputElt.value;"
|
||||
onset="this.mIgnoreInput = true; this.mInputElt.value = val; this.mIgnoreInput = false; return val;"/>
|
||||
|
||||
<property name="focused" readonly="true"
|
||||
onget="return this.getAttribute('focused') == 'true';"/>
|
||||
|
||||
<!-- maximum number of rows to display at a time -->
|
||||
<property name="maxRows"
|
||||
onset="this.setAttribute('maxrows', val); return val;"
|
||||
onget="var t = parseInt(this.getAttribute('maxrows')); return t ? t : 0;"/>
|
||||
|
||||
<!-- option to allow scrolling through the list via the tab key, rather than
|
||||
tab moving focus out of the textbox -->
|
||||
<property name="tabScrolling"
|
||||
onset="return this.setAttribute('tabscrolling', val); return val;"
|
||||
onget="return this.getAttribute('tabscrolling') == 'true';"/>
|
||||
|
||||
<!-- disable key navigation handling in the popup results -->
|
||||
<property name="disableKeyNavigation"
|
||||
onset="this.setAttribute('disablekeynavigation', val); return val;"
|
||||
onget="return this.getAttribute('disablekeynavigation') == 'true';"/>
|
||||
|
||||
<!-- option to completely ignore any blur events while
|
||||
searches are still going on. This is useful so that nothing
|
||||
gets autopicked if the window is required to lose focus for
|
||||
some reason (eg in LDAP autocomplete, another window may be
|
||||
brought up so that the user can enter a password to authenticate
|
||||
to an LDAP server). -->
|
||||
<property name="ignoreBlurWhileSearching"
|
||||
onset="this.setAttribute('ignoreblurwhilesearching', val); return val;"
|
||||
onget="return this.getAttribute('ignoreblurwhilesearching') == 'true';"/>
|
||||
|
||||
<!-- =================== PRIVATE MEMBERS =================== -->
|
||||
|
||||
<!-- ::::::::::::: autocomplete controller ::::::::::::: -->
|
||||
|
||||
<method name="attachController">
|
||||
<body><![CDATA[
|
||||
if (this.mController.input != this)
|
||||
this.mController.input = this;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="detachController">
|
||||
<body><![CDATA[
|
||||
if (this.mController.input == this)
|
||||
this.mController.input = null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- ::::::::::::: popup opening ::::::::::::: -->
|
||||
|
||||
<method name="openPopup">
|
||||
<body><![CDATA[
|
||||
this.popup.openPopup(this, this.boxObject.screenX, this.boxObject.screenY+this.boxObject.height, this.boxObject.width);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="closePopup">
|
||||
<body><![CDATA[
|
||||
this.popup.closePopup();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="showHistoryPopup">
|
||||
<body><![CDATA[
|
||||
this.attachController();
|
||||
this.mController.startSearch("");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- ::::::::::::: event dispatching ::::::::::::: -->
|
||||
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body><![CDATA[
|
||||
var cancel = false;
|
||||
// handle any xml attribute event handlers
|
||||
var handler = this.getAttribute("on"+aEventType);
|
||||
if (handler) {
|
||||
var fn = new Function("eventType", "param", handler);
|
||||
cancel = fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
return cancel;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- ::::::::::::: key handling ::::::::::::: -->
|
||||
|
||||
<method name="onKeyPress">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
var cancel = false;
|
||||
|
||||
const IController = Components.interfaces.nsIAutoCompleteController;
|
||||
|
||||
if (!this.disableKeyNavigation) {
|
||||
switch (aEvent.keyCode) {
|
||||
case KeyEvent.DOM_VK_TAB:
|
||||
if (this.tabScrolling && this.mPopupOpen)
|
||||
cancel = this.mController.handleKeyNavigation(aEvent.shiftKey ? IController.KEY_UP : IController.KEY_DOWN);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_UP:
|
||||
cancel = this.mController.handleKeyNavigation(IController.KEY_UP);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_DOWN:
|
||||
cancel = this.mController.handleKeyNavigation(IController.KEY_DOWN);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_LEFT:
|
||||
cancel = this.mController.handleKeyNavigation(IController.KEY_LEFT);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_RIGHT:
|
||||
cancel = this.mController.handleKeyNavigation(IController.KEY_RIGHT);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_PAGE_UP:
|
||||
cancel = this.mController.handleKeyNavigation(IController.KEY_PAGE_UP);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_PAGE_DOWN:
|
||||
cancel = this.mController.handleKeyNavigation(IController.KEY_PAGE_DOWN);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (aEvent.keyCode) {
|
||||
case KeyEvent.DOM_VK_ESCAPE:
|
||||
cancel = this.mController.handleEscape();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_RETURN:
|
||||
this.mEnterEvent = aEvent;
|
||||
cancel = this.mController.handleEnter();
|
||||
break;
|
||||
}
|
||||
|
||||
if (cancel) {
|
||||
aEvent.stopPropagation();
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
|
||||
return true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- ::::::::::::: miscellaneous ::::::::::::: -->
|
||||
|
||||
<method name="initSearchNames">
|
||||
<body><![CDATA[
|
||||
if (!this.mSearchNames) {
|
||||
var names = this.getAttribute("autocompletesearch");
|
||||
if (!names)
|
||||
this.mSearchNames = [];
|
||||
else
|
||||
this.mSearchNames = names.split(" ");
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="ifSetAttribute">
|
||||
<parameter name="aAttr"/>
|
||||
<parameter name="aVal"/>
|
||||
<body><![CDATA[
|
||||
if (!this.hasAttribute(aAttr))
|
||||
this.setAttribute(aAttr, aVal);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="input"
|
||||
action="if (!this.mIgnoreInput) this.mController.handleText();"/>
|
||||
|
||||
<handler event="keypress" phase="capturing"
|
||||
action="return this.onKeyPress(event);"/>
|
||||
|
||||
<handler event="focus" phase="capturing"
|
||||
action="this.attachController();"/>
|
||||
|
||||
<handler event="blur" phase="capturing"
|
||||
action="this.detachController();"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="autocomplete-result-popup" extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/autocomplete.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:tree anonid="tree" class="autocomplete-tree plain" hidecolumnpicker="true" flex="1">
|
||||
<xul:treecols anonid="treecols">
|
||||
<xul:treecol id="treecolAutoCompleteValue" class="autocomplete-treecol" flex="1"/>
|
||||
</xul:treecols>
|
||||
<xul:treechildren class="autocomplete-treebody"/>
|
||||
</xul:tree>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAutoCompletePopup">
|
||||
<field name="mInput">null</field>
|
||||
<field name="mPopupOpen">false</field>
|
||||
<field name="mShowCommentCol">false</field>
|
||||
|
||||
<constructor><![CDATA[
|
||||
this.setAttribute("ignorekeys", "true");
|
||||
|
||||
this.view = Components.classes["@mozilla.org/autocomplete/controller;1"].
|
||||
getService(Components.interfaces.nsITreeView);
|
||||
]]></constructor>
|
||||
|
||||
<!-- =================== nsIAutoCompletePopup =================== -->
|
||||
|
||||
<property name="input"
|
||||
onget="return this.mInput"/>
|
||||
|
||||
<property name="overrideValue" readonly="true"
|
||||
onget="return null;"/>
|
||||
|
||||
<property name="selectedIndex"
|
||||
onget="return this.tree.currentIndex;">
|
||||
<setter><![CDATA[
|
||||
this.tree.currentIndex = val;
|
||||
this.tree.treeBoxObject.ensureRowIsVisible(val < 0 ? 0 : val);
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="popupOpen" readonly="true"
|
||||
onget="return this.mPopupOpen;"/>
|
||||
|
||||
<method name="openPopup">
|
||||
<parameter name="aInput"/>
|
||||
<parameter name="aX"/>
|
||||
<parameter name="aY"/>
|
||||
<parameter name="aWidth"/>
|
||||
<body><![CDATA[
|
||||
if (!this.mPopupOpen) {
|
||||
this.mInput = aInput;
|
||||
|
||||
this.showCommentColumn = this.mInput.showCommentColumn;
|
||||
|
||||
this.removeAttribute("hidden");
|
||||
this.setAttribute("width", aWidth < 100 ? 100 : aWidth);
|
||||
|
||||
document.popupNode = null;
|
||||
this.showPopup(document.documentElement, aX, aY, "popup", null, null);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="closePopup">
|
||||
<body><![CDATA[
|
||||
if (this.mPopupOpen) {
|
||||
this.hidePopup();
|
||||
document.popupNode = null;
|
||||
|
||||
this.setAttribute("hidden", "true");
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="invalidate">
|
||||
<body><![CDATA[
|
||||
this.adjustHeight();
|
||||
this.tree.treeBoxObject.invalidate();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="selectBy">
|
||||
<parameter name="aReverse"/>
|
||||
<parameter name="aPage"/>
|
||||
<body><![CDATA[
|
||||
try {
|
||||
var amount = aPage ? 5 : 1;
|
||||
this.selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this.tree.view.rowCount-1);
|
||||
} catch (ex) {
|
||||
// do nothing - occasionally timer-related js errors happen here
|
||||
// e.g. "this.selectedIndex has no properties", when you type fast and hit a
|
||||
// navigation key before this popup has opened
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- =================== PUBLIC MEMBERS =================== -->
|
||||
|
||||
<field name="tree">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "tree");
|
||||
</field>
|
||||
|
||||
<field name="treecols">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "treecols");
|
||||
</field>
|
||||
|
||||
<property name="view"
|
||||
onget="return this.mView;">
|
||||
<setter><![CDATA[
|
||||
// We must do this by hand because the tree binding may not be ready yet
|
||||
this.mView = val;
|
||||
var bx = this.tree.boxObject;
|
||||
bx = bx.QueryInterface(Components.interfaces.nsITreeBoxObject);
|
||||
bx.view = val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="maxRows" readonly="true"
|
||||
onget="var t = parseInt(this.getAttribute('maxrows')); return t ? t : 6;"/>
|
||||
|
||||
<property name="showCommentColumn"
|
||||
onget="return this.mShowCommentColumn;">
|
||||
<setter><![CDATA[
|
||||
if (!val && this.mShowCommentColumn) {
|
||||
// reset the flex on the value column and add the comment column
|
||||
document.getElementById("treecolAutoCompleteValue").setAttribute("flex", 1);
|
||||
this.removeColumn("treecolAutoCompleteComment");
|
||||
} else if (val && !this.mShowCommentColumn) {
|
||||
// reset the flex on the value column and add the comment column
|
||||
document.getElementById("treecolAutoCompleteValue").setAttribute("flex", 2);
|
||||
this.addColumn({id: "treecolAutoCompleteComment", flex: 1});
|
||||
}
|
||||
this.mShowCommentColumn = val;
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="addColumn">
|
||||
<parameter name="aAttrs"/>
|
||||
<body><![CDATA[
|
||||
var col = document.createElement("treecol");
|
||||
col.setAttribute("class", "autocomplete-treecol");
|
||||
for (var name in aAttrs)
|
||||
col.setAttribute(name, aAttrs[name]);
|
||||
this.treecols.appendChild(col);
|
||||
return col;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="removeColumn">
|
||||
<parameter name="aColId"/>
|
||||
<body><![CDATA[
|
||||
return this.treecols.removeChild(document.getElementById(aColId));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="adjustHeight">
|
||||
<body><![CDATA[
|
||||
// detect the desired height of the tree
|
||||
var bx = this.tree.treeBoxObject;
|
||||
var view = this.tree.view;
|
||||
var rows = this.maxRows;
|
||||
if (!view.rowCount || (rows && view.rowCount < rows))
|
||||
rows = view.rowCount;
|
||||
|
||||
var height = rows * bx.rowHeight;
|
||||
|
||||
if (height == 0)
|
||||
this.tree.setAttribute("collapsed", "true");
|
||||
else {
|
||||
if (this.tree.hasAttribute("collapsed"))
|
||||
this.tree.removeAttribute("collapsed");
|
||||
this.tree.setAttribute("height", height);
|
||||
}
|
||||
this.tree.setAttribute("hidescrollbar", view.rowCount <= rows);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="getNextIndex">
|
||||
<parameter name="aReverse"/>
|
||||
<parameter name="aAmount"/>
|
||||
<parameter name="aIndex"/>
|
||||
<parameter name="aMaxRow"/>
|
||||
<body><![CDATA[
|
||||
if (aMaxRow < 0)
|
||||
return -1;
|
||||
|
||||
var newIdx = aIndex + (aReverse?-1:1)*aAmount;
|
||||
if (aReverse && aIndex == -1 || newIdx > aMaxRow && aIndex != aMaxRow)
|
||||
newIdx = aMaxRow;
|
||||
else if (!aReverse && aIndex == -1 || newIdx < 0 && aIndex != 0)
|
||||
newIdx = 0;
|
||||
|
||||
if (newIdx < 0 && aIndex == 0 || newIdx > aMaxRow && aIndex == aMaxRow)
|
||||
aIndex = -1;
|
||||
else
|
||||
aIndex = newIdx;
|
||||
|
||||
return aIndex;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onPopupClick">
|
||||
<body><![CDATA[
|
||||
var controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
|
||||
getService(Components.interfaces.nsIAutoCompleteController);
|
||||
controller.handleEnter();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="popupshowing">
|
||||
this.mPopupOpen = true;
|
||||
</handler>
|
||||
|
||||
<handler event="popuphiding">
|
||||
this.mPopupOpen = false;
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="autocomplete-tree" extends="chrome://global/content/bindings/tree.xml#tree">
|
||||
<content>
|
||||
<children includes="treecols"/>
|
||||
<xul:treerows class="autocomplete-treerows tree-rows" xbl:inherits="hidescrollbar" flex="1">
|
||||
<children/>
|
||||
</xul:treerows>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="autocomplete-treebody">
|
||||
<implementation>
|
||||
<field name="mLastMoveTime">new Date()</field>
|
||||
|
||||
<method name="getHoverCell">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
var row = {}; var col = {}; var obj = {};
|
||||
var x = aEvent.screenX - this.boxObject.screenX + this.boxObject.x;
|
||||
var y = aEvent.screenY - this.boxObject.screenY + this.boxObject.y;
|
||||
this.parentNode.treeBoxObject.getCellAt(x, y, row, col, obj);
|
||||
if (row.value >= 0)
|
||||
return {row: row.value, column: col.value};
|
||||
else
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mouseout" action="this.parentNode.currentIndex = -1;"/>
|
||||
<handler event="mouseup" action="this.parentNode.parentNode.onPopupClick();"/>
|
||||
|
||||
<handler event="mousemove"><![CDATA[
|
||||
if (new Date() - this.mLastMoveTime > 30) {
|
||||
var rc = this.getHoverCell(event);
|
||||
if (rc && rc.row != this.parentNode.currentIndex)
|
||||
this.parentNode.currentIndex = rc.row;
|
||||
this.mLastMoveTime = new Date();
|
||||
}
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="autocomplete-treerows">
|
||||
<content onmousedown="event.preventDefault()">
|
||||
<xul:hbox flex="1" class="tree-bodybox">
|
||||
<children/>
|
||||
</xul:hbox>
|
||||
<xul:scrollbar xbl:inherits="collapsed=hidescrollbar" orient="vertical" class="tree-scrollbar"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="history-dropmarker" extends="xul:button">
|
||||
<content>
|
||||
<xul:image class="dropmarker-image"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createXULDropmarkerAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="showPopup">
|
||||
<body><![CDATA[
|
||||
var textbox = document.getBindingParent(this);
|
||||
textbox.showHistoryPopup();
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mousedown"><![CDATA[
|
||||
this.showPopup();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,444 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
- The contents of this file are subject to the Mozilla Public
|
||||
- License Version 1.1 (the "License"); you may not use this file
|
||||
- except in compliance with the License. You may obtain a copy of
|
||||
- the License at http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS
|
||||
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
- implied. See the License for the specific language governing
|
||||
- rights and limitations under the License.
|
||||
-
|
||||
- The Original Code is this file as it was released on
|
||||
- March 28, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is Peter Annema.
|
||||
- Portions created by Peter Annema are Copyright (C) 2001
|
||||
- Peter Annema. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Peter Annema <disttsc@bart.nl> (Original Author of <browser>)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the
|
||||
- terms of the GNU General Public License Version 2 or later (the
|
||||
- "GPL"), in which case the provisions of the GPL are applicable
|
||||
- instead of those above. If you wish to allow use of your
|
||||
- version of this file only under the terms of the GPL and not to
|
||||
- allow others to use your version of this file under the MPL,
|
||||
- indicate your decision by deleting the provisions above and
|
||||
- replace them with the notice and other provisions required by
|
||||
- the GPL. If you do not delete the provisions above, a recipient
|
||||
- may use your version of this file under either the MPL or the
|
||||
- GPL.
|
||||
-->
|
||||
|
||||
<bindings id="browserBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="browser" extends="xul:browser">
|
||||
<implementation type="application/x-javascript" implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createIFrameAccessible(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="canGoBack"
|
||||
onget="return this.webNavigation.canGoBack;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="canGoForward"
|
||||
onget="return this.webNavigation.canGoForward;"
|
||||
readonly="true"/>
|
||||
|
||||
<method name="goBack">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var webNavigation = this.webNavigation;
|
||||
if (webNavigation.canGoBack)
|
||||
webNavigation.goBack();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="goForward">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var webNavigation = this.webNavigation;
|
||||
if (webNavigation.canGoForward)
|
||||
webNavigation.goForward();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="reload">
|
||||
<body>
|
||||
<![CDATA[
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
this.reloadWithFlags(flags);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="reloadWithFlags">
|
||||
<parameter name="aFlags"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.webNavigation.reload(aFlags);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="stop">
|
||||
<body>
|
||||
<![CDATA[
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const flags = nsIWebNavigation.STOP_ALL;
|
||||
this.webNavigation.stop(flags);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- throws exception for unknown schemes -->
|
||||
<method name="loadURI">
|
||||
<parameter name="aURI"/>
|
||||
<parameter name="aReferrerURI"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
this.loadURIWithFlags(aURI, flags, aReferrerURI);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- throws exception for unknown schemes -->
|
||||
<method name="loadURIWithFlags">
|
||||
<parameter name="aURI"/>
|
||||
<parameter name="aFlags"/>
|
||||
<parameter name="aReferrerURI"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!aURI)
|
||||
aURI = "about:blank";
|
||||
|
||||
this.webNavigation.loadURI(aURI, aFlags, aReferrerURI, null, null);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="goHome">
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
this.loadURI(this.homePage);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="homePage">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var uri;
|
||||
|
||||
if (this.hasAttribute("homepage"))
|
||||
uri = this.getAttribute("homepage");
|
||||
else
|
||||
uri = "http://www.mozilla.org/"; // widget pride
|
||||
|
||||
return uri;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.setAttribute("homepage", val);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="gotoIndex">
|
||||
<parameter name="aIndex"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.webNavigation.gotoIndex(aIndex);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="currentURI"
|
||||
onget="return this.webNavigation.currentURI;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="preferences"
|
||||
onget="return Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="docShell"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).docShell;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="webNavigation"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="webBrowserFind"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
|
||||
|
||||
<property name="webProgress"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress);"/>
|
||||
|
||||
<property name="contentWindow"
|
||||
readonly="true"
|
||||
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
|
||||
|
||||
<property name="sessionHistory"
|
||||
onget="return this.webNavigation.sessionHistory;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="markupDocumentViewer"
|
||||
onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentViewerEdit"
|
||||
onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerEdit);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentViewerFile"
|
||||
onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerFile);"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="documentCharsetInfo"
|
||||
onget="return this.docShell.documentCharsetInfo;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentDocument"
|
||||
onget="return this.webNavigation.document;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentTitle"
|
||||
onget="return Components.lookupMethod(this.contentDocument, 'title').call(this.contentDocument);"
|
||||
readonly="true"/>
|
||||
|
||||
<field name="mPrefs" readonly="true">
|
||||
Components.classes['@mozilla.org/preferences-service;1']
|
||||
.getService(Components.interfaces.nsIPrefService)
|
||||
.getBranch(null);
|
||||
</field>
|
||||
|
||||
<field name="_mStrBundle">null</field>
|
||||
|
||||
<property name="mStrBundle">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (!this._mStrBundle) {
|
||||
// need to create string bundle manually instead of using <xul:stringbundle/>
|
||||
// see bug 63370 for details
|
||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||
.getService(Components.interfaces.nsILocaleService);
|
||||
var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundleURL = "chrome://global/locale/tabbrowser.properties";
|
||||
this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.GetApplicationLocale());
|
||||
}
|
||||
return this._mStrBundle;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="addProgressListener">
|
||||
<parameter name="aListener"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.webProgress.addProgressListener(aListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeProgressListener">
|
||||
<parameter name="aListener"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.webProgress.removeProgressListener(aListener);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="attachFormFill">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.mFormFillAttached && this.hasAttribute("autocompletepopup")) {
|
||||
// hoop up the form fill autocomplete controller
|
||||
var controller = Components.classes["@mozilla.org/satchel/form-fill-controller;1"].
|
||||
getService(Components.interfaces.nsIFormFillController);
|
||||
|
||||
var popup = document.getElementById(this.getAttribute("autocompletepopup"));
|
||||
if (popup)
|
||||
controller.attachToBrowser(this.docShell, popup.QueryInterface(Components.interfaces.nsIAutoCompletePopup));
|
||||
|
||||
this.mFormFillAttached = true;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="detachFormFill">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mFormFillAttached) {
|
||||
// hoop up the form fill autocomplete controller
|
||||
var controller = Components.classes["@mozilla.org/satchel/form-fill-controller;1"].
|
||||
getService(Components.interfaces.nsIFormFillController);
|
||||
controller.detachFromBrowser(this.docShell);
|
||||
|
||||
this.mFormFillAttached = false;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="onLoad">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.removeEventListener("load", this.handleEvent, true);
|
||||
this.attachFormFill();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="mDragDropHandler">
|
||||
null
|
||||
</field>
|
||||
|
||||
<field name="securityUI">
|
||||
null
|
||||
</field>
|
||||
|
||||
<field name="mFormFillAttached">
|
||||
false
|
||||
</field>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
try {
|
||||
if (!this.hasAttribute("disablehistory")) {
|
||||
// wire up session history
|
||||
this.webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"].createInstance(Components.interfaces.nsISHistory);
|
||||
|
||||
// wire up global history
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIGlobalHistory);
|
||||
|
||||
this.docShell.QueryInterface(Components.interfaces.nsIDocShellHistory).globalHistory = globalHistory;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
try {
|
||||
this.mDragDropHandler = Components.classes["@mozilla.org:/content/content-area-dragdrop;1"].createInstance(Components.interfaces.nsIDragDropHandler);
|
||||
this.mDragDropHandler.hookupTo(this, null, null, null);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
try {
|
||||
const SECUREBROWSERUI_CONTRACTID = "@mozilla.org/secure_browser_ui;1";
|
||||
if (!this.hasAttribute("disablesecurity") &&
|
||||
SECUREBROWSERUI_CONTRACTID in Components.classes) {
|
||||
this.securityUI = Components.classes[SECUREBROWSERUI_CONTRACTID].createInstance(Components.interfaces.nsISecureBrowserUI);
|
||||
this.securityUI.init(this.contentWindow);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
// Listen for first load for lazy attachment to form fill controller
|
||||
this.addEventListener("load", this.onLoad, true);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<destructor>
|
||||
<![CDATA[
|
||||
this.destroy();
|
||||
]]>
|
||||
</destructor>
|
||||
|
||||
<!-- This is necessary because the destructor doesn't always get called when
|
||||
we are removed from a tabbrowser. This will be explicitly called by tabbrowser -->
|
||||
<method name="destroy">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mDragDropHandler)
|
||||
this.mDragDropHandler.detach();
|
||||
|
||||
this.detachFormFill();
|
||||
|
||||
this.securityUI = null;
|
||||
this.mDragDropHandler = null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_F7">
|
||||
<![CDATA[
|
||||
// Toggle browse with caret mode
|
||||
var browseWithCaretOn = false;
|
||||
var warn = true;
|
||||
|
||||
try {
|
||||
warn = this.mPrefs.getBoolPref("accessibility.warn_on_browsewithcaret");
|
||||
} catch (ex) {
|
||||
}
|
||||
|
||||
try {
|
||||
browseWithCaretOn = this.mPrefs.getBoolPref("accessibility.browsewithcaret");
|
||||
} catch (ex) {
|
||||
}
|
||||
if (warn && !browseWithCaretOn) {
|
||||
var checkValue = {value:false};
|
||||
promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var buttonPressed = promptService.confirmEx(window,
|
||||
this.mStrBundle.GetStringFromName('browsewithcaret.checkWindowTitle'),
|
||||
this.mStrBundle.GetStringFromName('browsewithcaret.checkLabel'),
|
||||
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
|
||||
(promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
|
||||
this.mStrBundle.GetStringFromName('browsewithcaret.checkButtonLabel'),
|
||||
null, null,
|
||||
this.mStrBundle.GetStringFromName('browsewithcaret.checkMsg'),
|
||||
checkValue);
|
||||
if (buttonPressed != 0)
|
||||
return;
|
||||
if (checkValue.value) {
|
||||
try {
|
||||
this.mPrefs.setBoolPref("accessibility.warn_on_browsewithcaret", false);
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle the pref
|
||||
try {
|
||||
this.mPrefs.setBoolPref("accessibility.browsewithcaret",!browseWithCaretOn);
|
||||
} catch (ex) {
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -97,7 +97,7 @@
|
|||
</xul:tabs>
|
||||
</xul:hbox>
|
||||
<xul:tabpanels flex="1" class="plain">
|
||||
<xul:browser type="content-primary" xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu"/>
|
||||
<xul:browser type="content-primary" xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup"/>
|
||||
</xul:tabpanels>
|
||||
</xul:tabbox>
|
||||
<children/>
|
||||
|
@ -789,6 +789,9 @@
|
|||
// clean up the before/afterselected attributes before removing the tab
|
||||
oldTab.selected = false;
|
||||
|
||||
// XXX browser's destructor isn't always called, so we force a cleanup ourselves
|
||||
oldBrowser.destroy();
|
||||
|
||||
this.mTabContainer.removeChild(oldTab);
|
||||
this.mPanelContainer.removeChild(oldBrowser);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
<content>
|
||||
<xul:hbox class="textbox-input-box" flex="1">
|
||||
<children/>
|
||||
<html:input class="textbox-input" flex="1" anonid="input"
|
||||
xbl:inherits="onfocus,onblur,value,type,maxlength,disabled,size,readonly,tabindex"/>
|
||||
</xul:hbox>
|
||||
|
|
|
@ -196,6 +196,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!newItem)
|
||||
return;
|
||||
|
||||
var insertItem = newItem;
|
||||
|
||||
// Wrap the item in another node if so inclined.
|
||||
|
|
|
@ -137,7 +137,7 @@ iframe {
|
|||
}
|
||||
|
||||
browser {
|
||||
-moz-binding: url("chrome://global/content/bindings/browser.xml#browser");
|
||||
-moz-binding: url("chrome://global/content/widgets/browser.xml#browser");
|
||||
}
|
||||
|
||||
tabbrowser {
|
||||
|
@ -623,32 +623,51 @@ textbox[type="timed"] {
|
|||
|
||||
/********** autocomplete textbox **********/
|
||||
|
||||
|
||||
textbox[type="autocomplete"] {
|
||||
-moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete");
|
||||
-moz-binding: url("chrome://global/content/widgets/autocomplete.xml#autocomplete");
|
||||
}
|
||||
|
||||
.autocomplete-result-popup {
|
||||
-moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-result-popup");
|
||||
}
|
||||
|
||||
.autocomplete-history-popup {
|
||||
-moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-history-popup");
|
||||
popup[type="autocomplete"] {
|
||||
-moz-binding: url("chrome://global/content/widgets/autocomplete.xml#autocomplete-result-popup");
|
||||
display: -moz-popup !important;
|
||||
}
|
||||
|
||||
.autocomplete-tree {
|
||||
-moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-tree");
|
||||
-moz-binding: url("chrome://global/content/widgets/autocomplete.xml#autocomplete-tree");
|
||||
}
|
||||
|
||||
.autocomplete-treebody {
|
||||
-moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-treebody");
|
||||
-moz-binding: url("chrome://global/content/widgets/autocomplete.xml#autocomplete-treebody");
|
||||
}
|
||||
|
||||
.autocomplete-treerows {
|
||||
-moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-treerows");
|
||||
-moz-binding: url("chrome://global/content/widgets/autocomplete.xml#autocomplete-treerows");
|
||||
}
|
||||
|
||||
.autocomplete-history-dropmarker {
|
||||
-moz-binding: url("chrome://global/content/autocomplete.xml#history-dropmarker");
|
||||
display: none;
|
||||
}
|
||||
|
||||
.autocomplete-history-dropmarker[enablehistory="true"] {
|
||||
display: -moz-box;
|
||||
-moz-binding: url("chrome://global/content/widgets/autocomplete.xml#history-dropmarker");
|
||||
}
|
||||
|
||||
/* the C++ implementation of widgets is too eager to make popups visible.
|
||||
this causes problems (bug 120155 and others), thus this workaround: */
|
||||
popup[type="autocomplete"][hidden="true"] {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* The following rule is here to fix bug 96899 (and now 117952).
|
||||
Somehow trees create a situation
|
||||
in which a popupset flows itself as if its popup child is directly within it
|
||||
instead of the placeholder child that should actually be inside the popupset.
|
||||
This is a stopgap measure, and it does not address the real bug. */
|
||||
.autocomplete-result-popupset {
|
||||
max-width: 0px;
|
||||
width: 0 !important;
|
||||
}
|
||||
|
||||
/********** colorpicker **********/
|
||||
|
|
|
@ -10,6 +10,8 @@ toolkit.jar:
|
|||
content/global/customizeToolbar.js (content/customizeToolbar.js)
|
||||
content/global/customizeToolbar.css (content/customizeToolbar.css)
|
||||
+ content/global/viewZoomOverlay.js (content/viewZoomOverlay.js)
|
||||
+ content/global/widgets/autocomplete.xml (content/widgets/autocomplete.xml)
|
||||
+ content/global/widgets/browser.xml (content/widgets/browser.xml)
|
||||
+ content/global/widgets/tabbrowser.xml (content/widgets/tabbrowser.xml)
|
||||
+ content/global/widgets/tabbox.xml (content/widgets/tabbox.xml)
|
||||
+ content/global/widgets/textbox.xml (content/widgets/textbox.xml)
|
||||
|
|
|
@ -67,7 +67,7 @@ textbox {
|
|||
|
||||
/* ::::: autocomplete popups ::::: */
|
||||
|
||||
.autocomplete-result-popup,
|
||||
popup[type="autocomplete"],
|
||||
.autocomplete-history-popup {
|
||||
border-width: 1px;
|
||||
-moz-border-top-colors: ThreeDDarkShadow;
|
||||
|
|
Загрузка…
Ссылка в новой задаче