Merge cedar with mozilla-central.

This commit is contained in:
Mounir Lamouri 2011-04-29 16:19:07 +00:00
commit 56051af077
131 changed files with 1039 additions and 3956 deletions

View File

@ -346,10 +346,6 @@ pref("browser.search.update.log", false);
// Check whether we need to perform engine updates every 6 hours
pref("browser.search.update.interval", 21600);
// Whether or not microsummary and generator updates are enabled
pref("browser.microsummary.enabled", true);
pref("browser.microsummary.updateGenerators", true);
// enable search suggestions by default
pref("browser.search.suggest.enabled", true);

View File

@ -1582,22 +1582,10 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
gPrefService.addObserver(ctrlTab.prefName, ctrlTab, false);
gPrefService.addObserver(allTabs.prefName, allTabs, false);
// Initialize the microsummary service by retrieving it, prompting its factory
// to create its singleton, whose constructor initializes the service.
// Started 4 seconds after delayedStartup (before the livemarks service below).
setTimeout(function() {
try {
Cc["@mozilla.org/microsummary/service;1"].getService(Ci.nsIMicrosummaryService);
} catch (ex) {
Components.utils.reportError("Failed to init microsummary service:\n" + ex);
}
}, 4000);
// Delayed initialization of the livemarks update timer.
// Livemark updates don't need to start until after bookmark UI
// such as the toolbar has initialized. Starting 5 seconds after
// delayedStartup in order to stagger this after the microsummary
// service (see above) and before the download manager starts (see below).
// delayedStartup in order to stagger this before the download manager starts.
setTimeout(function() PlacesUtils.livemarks.start(), 5000);
// Initialize the download manager some time after the app starts so that

View File

@ -203,10 +203,6 @@ PlacesController.prototype = {
!PlacesUtils.nodeIsLivemarkItem(selectedNode))
return true;
return false;
case "placesCmd_reloadMicrosummary":
var selectedNode = this._view.selectedNode;
return selectedNode && PlacesUtils.nodeIsBookmark(selectedNode) &&
PlacesUtils.microsummaries.hasMicrosummary(selectedNode.itemId);
case "placesCmd_reload":
// Livemark containers
var selectedNode = this._view.selectedNode;
@ -293,9 +289,6 @@ PlacesController.prototype = {
case "placesCmd_reload":
this.reloadSelectedLivemark();
break;
case "placesCmd_reloadMicrosummary":
this.reloadSelectedMicrosummary();
break;
case "placesCmd_sortBy:name":
this.sortFolderByName();
break;
@ -505,9 +498,6 @@ PlacesController.prototype = {
if (PlacesUtils.nodeIsBookmark(node)) {
nodeData["bookmark"] = true;
PlacesUtils.nodeIsTagQuery(node.parent)
var mss = PlacesUtils.microsummaries;
if (mss.hasMicrosummary(node.itemId))
nodeData["microsummary"] = true;
var parentNode = node.parent;
if (parentNode) {
@ -741,16 +731,6 @@ PlacesController.prototype = {
PlacesUtils.livemarks.reloadLivemarkFolder(selectedNode.itemId);
},
/**
* Reload the microsummary associated with the selection
*/
reloadSelectedMicrosummary: function PC_reloadSelectedMicrosummary() {
var selectedNode = this._view.selectedNode;
var mss = PlacesUtils.microsummaries;
if (mss.hasMicrosummary(selectedNode.itemId))
mss.refreshMicrosummary(selectedNode.itemId);
},
/**
* Opens the links in the selected folder, or the selected links in new tabs.
*/
@ -1574,7 +1554,6 @@ function goUpdatePlacesCommands() {
updatePlacesCommand("placesCmd_show:info");
updatePlacesCommand("placesCmd_moveBookmarks");
updatePlacesCommand("placesCmd_reload");
updatePlacesCommand("placesCmd_reloadMicrosummary");
updatePlacesCommand("placesCmd_sortBy:name");
updatePlacesCommand("placesCmd_cut");
updatePlacesCommand("placesCmd_copy");

View File

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
const LAST_USED_ANNO = "bookmarkPropertiesDialog/folderLastUsed";
const STATIC_TITLE_ANNO = "bookmarks/staticTitle";
const MAX_FOLDER_ITEM_IN_MENU_LIST = 5;
var gEditItemOverlay = {
@ -49,7 +48,6 @@ var gEditItemOverlay = {
_multiEdit: false,
_itemType: -1,
_readOnly: false,
_microsummaries: null,
_hiddenRows: [],
_observersAdded: false,
_staticFoldersListBuilt: false,
@ -367,8 +365,7 @@ var gEditItemOverlay = {
},
QueryInterface: function EIO_QueryInterface(aIID) {
if (aIID.equals(Ci.nsIMicrosummaryObserver) ||
aIID.equals(Ci.nsIDOMEventListener) ||
if (aIID.equals(Ci.nsIDOMEventListener) ||
aIID.equals(Ci.nsINavBookmarkObserver) ||
aIID.equals(Ci.nsISupports))
return this;
@ -380,108 +377,16 @@ var gEditItemOverlay = {
return document.getElementById("editBMPanel_" + aID);
},
_createMicrosummaryMenuItem:
function EIO__createMicrosummaryMenuItem(aMicrosummary) {
var menuItem = document.createElement("menuitem");
// Store a reference to the microsummary in the menu item, so we know
// which microsummary this menu item represents when it's time to
// save changes or load its content.
menuItem.microsummary = aMicrosummary;
// Content may have to be generated asynchronously; we don't necessarily
// have it now. If we do, great; otherwise, fall back to the generator
// name, then the URI, and we trigger a microsummary content update. Once
// the update completes, the microsummary will notify our observer to
// update the corresponding menu-item.
// XXX Instead of just showing the generator name or (heaven forbid)
// its URI when we don't have content, we should tell the user that
// we're loading the microsummary, perhaps with some throbbing to let
// her know it is in progress.
if (aMicrosummary.content)
menuItem.setAttribute("label", aMicrosummary.content);
else {
menuItem.setAttribute("label", aMicrosummary.generator.name ||
aMicrosummary.generator.uri.spec);
aMicrosummary.update();
}
return menuItem;
},
_getItemStaticTitle: function EIO__getItemStaticTitle() {
if (this._itemId == -1)
return PlacesUtils.history.getPageTitle(this._uri);
const annos = PlacesUtils.annotations;
if (annos.itemHasAnnotation(this._itemId, STATIC_TITLE_ANNO))
return annos.getItemAnnotation(this._itemId, STATIC_TITLE_ANNO);
return PlacesUtils.bookmarks.getItemTitle(this._itemId);
},
_initNamePicker: function EIO_initNamePicker() {
var userEnteredNameField = this._element("userEnteredName");
var namePicker = this._element("namePicker");
var droppable = false;
userEnteredNameField.label = this._getItemStaticTitle();
// clean up old entries
var menupopup = namePicker.menupopup;
while (menupopup.childNodes.length > 2)
menupopup.removeChild(menupopup.lastChild);
if (this._microsummaries) {
this._microsummaries.removeObserver(this);
this._microsummaries = null;
}
var itemToSelect = userEnteredNameField;
try {
if (this._itemId != -1 &&
this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK &&
!this._readOnly)
this._microsummaries = PlacesUtils.microsummaries
.getMicrosummaries(this._uri, -1);
}
catch(ex) {
// getMicrosummaries will throw an exception in at least two cases:
// 1. the bookmarked URI contains a scheme that the service won't
// download for security reasons (currently it only handles http,
// https, and file);
// 2. the page to which the URI refers isn't HTML or XML (the only two
// content types the service knows how to summarize).
this._microsummaries = null;
}
if (this._microsummaries) {
var enumerator = this._microsummaries.Enumerate();
if (enumerator.hasMoreElements()) {
// Show the drop marker if there are microsummaries
droppable = true;
while (enumerator.hasMoreElements()) {
var microsummary = enumerator.getNext()
.QueryInterface(Ci.nsIMicrosummary);
var menuItem = this._createMicrosummaryMenuItem(microsummary);
if (PlacesUtils.microsummaries
.isMicrosummary(this._itemId, microsummary))
itemToSelect = menuItem;
menupopup.appendChild(menuItem);
}
}
this._microsummaries.addObserver(this);
}
if (namePicker.selectedItem == itemToSelect)
namePicker.value = itemToSelect.label;
else
namePicker.selectedItem = itemToSelect;
namePicker.setAttribute("droppable", droppable);
namePicker.value = this._getItemStaticTitle();
namePicker.readOnly = this._readOnly;
// clear the undo stack
@ -490,40 +395,6 @@ var gEditItemOverlay = {
editor.transactionManager.clear();
},
// nsIMicrosummaryObserver
onContentLoaded: function EIO_onContentLoaded(aMicrosummary) {
var namePicker = this._element("namePicker");
var childNodes = namePicker.menupopup.childNodes;
// 0: user-entered item; 1: separator
for (var i = 2; i < childNodes.length; i++) {
if (childNodes[i].microsummary == aMicrosummary) {
var newLabel = aMicrosummary.content;
// XXXmano: non-editable menulist would do this for us, see bug 360220
// We should fix editable-menulists to set the DOMAttrModified handler
// as well.
//
// Also note the order importance: if the label of the menu-item is
// set to something different than the menulist's current value,
// the menulist no longer has selectedItem set
if (namePicker.selectedItem == childNodes[i])
namePicker.value = newLabel;
childNodes[i].label = newLabel;
return;
}
}
},
onElementAppended: function EIO_onElementAppended(aMicrosummary) {
var namePicker = this._element("namePicker");
namePicker.menupopup
.appendChild(this._createMicrosummaryMenuItem(aMicrosummary));
// Make sure the drop-marker is shown
namePicker.setAttribute("droppable", "true");
},
uninitPanel: function EIO_uninitPanel(aHideCollapsibleElements) {
if (aHideCollapsibleElements) {
// hide the folder tree if it was previously visible
@ -543,10 +414,7 @@ var gEditItemOverlay = {
this._observersAdded = false;
}
if (this._microsummaries) {
this._microsummaries.removeObserver(this);
this._microsummaries = null;
}
this._itemId = -1;
this._uri = null;
this._uris = [];
@ -673,11 +541,6 @@ var gEditItemOverlay = {
return false;
},
onNamePickerInput: function EIO_onNamePickerInput() {
var title = this._element("namePicker").value;
this._element("userEnteredName").label = title;
},
onNamePickerChange: function EIO_onNamePickerChange() {
if (this._itemId == -1)
return;
@ -687,7 +550,7 @@ var gEditItemOverlay = {
const ptm = PlacesUIUtils.ptm;
// Here we update either the item title or its cached static title
var newTitle = this._element("userEnteredName").label;
var newTitle = namePicker.value;
if (!newTitle &&
PlacesUtils.bookmarks.getFolderIdForItem(this._itemId) == PlacesUtils.tagsFolderId) {
// We don't allow setting an empty title for a tag, restore the old one.
@ -695,32 +558,7 @@ var gEditItemOverlay = {
}
else if (this._getItemStaticTitle() != newTitle) {
this._mayUpdateFirstEditField("namePicker");
if (PlacesUtils.microsummaries.hasMicrosummary(this._itemId)) {
// Note: this implicitly also takes care of the microsummary->static
// title case, the removeMicorosummary method in the service will set
// the item-title to the value of this annotation.
//
// XXXmano: use a transaction
PlacesUtils.setAnnotationsForItem(this._itemId,
[{name: STATIC_TITLE_ANNO,
value: newTitle}]);
}
else
txns.push(ptm.editItemTitle(this._itemId, newTitle));
}
var newMicrosummary = namePicker.selectedItem.microsummary;
// Only add a microsummary update to the transaction if the microsummary
// has actually changed, i.e. the user selected no microsummary, but the
// bookmark previously had one, or the user selected a microsummary which
// is not the one the bookmark previously had
if ((newMicrosummary == null &&
PlacesUtils.microsummaries.hasMicrosummary(this._itemId)) ||
(newMicrosummary != null &&
!PlacesUtils.microsummaries
.isMicrosummary(this._itemId, newMicrosummary))) {
txns.push(ptm.editBookmarkMicrosummary(this._itemId, newMicrosummary));
txns.push(ptm.editItemTitle(this._itemId, newTitle));
}
var aggregate = ptm.aggregateTransactions("Edit Item Title", txns);
@ -1121,20 +959,11 @@ var gEditItemOverlay = {
switch (aProperty) {
case "title":
if (PlacesUtils.annotations.itemHasAnnotation(this._itemId,
STATIC_TITLE_ANNO))
return; // onContentLoaded updates microsummary-items
var userEnteredNameField = this._element("userEnteredName");
if (userEnteredNameField.value != aValue) {
userEnteredNameField.value = aValue;
var namePicker = this._element("namePicker");
if (namePicker.selectedItem == userEnteredNameField) {
namePicker.label = aValue;
// clear undo stack
namePicker.editor.transactionManager.clear();
}
var namePicker = this._element("namePicker");
if (namePicker.value != aValue) {
namePicker.value = aValue;
// clear undo stack
namePicker.editor.transactionManager.clear();
}
break;
case "uri":
@ -1144,7 +973,7 @@ var gEditItemOverlay = {
getService(Ci.nsIIOService).
newURI(aValue, null, null);
this._initTextField("locationField", this._uri.spec);
this._initNamePicker(); // for microsummaries
this._initNamePicker();
this._initTextField("tagsField",
PlacesUtils.tagging
.getTagsForURI(this._uri).join(", "),

View File

@ -65,22 +65,9 @@
accesskey="&editBookmarkOverlay.name.accesskey;"
control="editBMPanel_namePicker"
observes="paneElementsBroadcaster"/>
<menulist id="editBMPanel_namePicker"
flex="1"
editable="true"
droppable="false"
oninput="gEditItemOverlay.onNamePickerInput();"
onblur="gEditItemOverlay.onNamePickerChange();"
oncommand="gEditItemOverlay.onNamePickerChange();"
observes="paneElementsBroadcaster">
<menupopup>
<menuitem id="editBMPanel_userEnteredName"/>
<menuitem disabled="true">
<menuseparator flex="1"/>
<label value="&editBookmarkOverlay.liveTitlesSeparator.label;"/>
</menuitem>
</menupopup>
</menulist>
<textbox id="editBMPanel_namePicker"
onblur="gEditItemOverlay.onNamePickerChange();"
observes="paneElementsBroadcaster"/>
</row>
<row align="center" id="editBMPanel_locationRow">

View File

@ -101,8 +101,6 @@
observes="placesCmd_show:info"/>
<command id="placesCmd_reload"
oncommand="goDoPlacesCommand('placesCmd_reload');"/>
<command id="placesCmd_reloadMicrosummary"
oncommand="goDoPlacesCommand('placesCmd_reloadMicrosummary');"/>
<command id="placesCmd_sortBy:name"
oncommand="goDoPlacesCommand('placesCmd_sortBy:name');"/>
<command id="placesCmd_moveBookmarks"
@ -239,12 +237,6 @@
accesskey="&cmd.reloadLivebookmark.accesskey;"
closemenu="single"
selection="livemark/feedURI"/>
<menuitem id="placesContext_reloadMicrosummary"
command="placesCmd_reloadMicrosummary"
label="&cmd.reloadMicrosummary.label;"
accesskey="&cmd.reloadMicrosummary.accesskey;"
closemenu="single"
selection="microsummary"/>
<menuitem id="placesContext_sortBy:name"
command="placesCmd_sortBy:name"
label="&cmd.sortby_name.label;"

View File

@ -1324,9 +1324,6 @@ XPCOMUtils.defineLazyGetter(PlacesUIUtils, "ptm", function() {
editLivemarkFeedURI: function(aLivemarkId, aFeedURI)
new PlacesEditLivemarkFeedURITransaction(aLivemarkId, aFeedURI),
editBookmarkMicrosummary: function(aItemId, aNewMicrosummary)
new PlacesEditBookmarkMicrosummaryTransaction(aItemId, aNewMicrosummary),
editItemDateAdded: function(aItemId, aNewDateAdded)
new PlacesEditItemDateAddedTransaction(aItemId, aNewDateAdded),

View File

@ -313,7 +313,6 @@ gTests.push({
this._itemId = this.window.gEditItemOverlay._itemId;
// Change folder name
var namePicker = this.window.document.getElementById("editBMPanel_namePicker");
var userEnteredName = this.window.document.getElementById("editBMPanel_userEnteredName");
var self = this;
this.window.addEventListener("unload", function(event) {
@ -324,7 +323,6 @@ gTests.push({
}, false);
namePicker.value = "n";
userEnteredName.label = "n";
info("About to focus the namePicker field");
namePicker.focus();
EventUtils.synthesizeKey("VK_RETURN", {}, this.window);

View File

@ -19,10 +19,6 @@
<DL><p>
<DT><A HREF="http://test/post" ADD_DATE="1177375336" LAST_MODIFIED="1177375423" SHORTCUTURL="test" WEB_PANEL="true" POST_DATA="hidden1%3Dbar&amp;text1%3D%25s" LAST_CHARSET="ISO-8859-1" ID="rdf:#$pYFe7">test post keyword</A>
<DD>item description
<!-- XXX Bug 380468
<DT><A HREF="http://test/micsum" ADD_DATE="1177375377" LAST_MODIFIED="1177541023" LAST_CHARSET="ISO-8859-1" MICSUM_GEN_URI="urn:source:http://dietrich.ganx4.com/mozilla/test-microsummary.xml" MICSUM_EXPIRATION="1177542823620" GENERATED_TITLE="id:462fd9a2e5b66" ID="rdf:#$qYFe7">test microsummary</A>
<DD>test microsummary
-->
</DL>
<DT><H3 UNFILED_BOOKMARKS_FOLDER="true">Unsorted Bookmarks</H3>
<DL><p>

View File

@ -223,24 +223,6 @@ function testCanonicalBookmarks() {
PlacesUtils.annotations.getItemAnnotation(testBookmark1.itemId,
DESCRIPTION_ANNO));
/*
// XXX Bug 380468
// test bookmark 2
var testBookmark2 = testFolder.getChild(1);
// url
do_check_eq("http://test/micsum", testBookmark2.uri);
// title
do_check_eq("test microsummary", testBookmark2.title);
// check that it's a microsummary
var micsum = mssvc.getMicrosummary(testBookmark2.itemId);
if (!micsum)
do_throw("Could not import microsummary");
// check generator uri
var generator = micsum.generator;
do_check_eq("urn:source:http://dietrich.ganx4.com/mozilla/test-microsummary.xml", generator.uri.spec);
// expiration and generated title can change, so don't test them
*/
// clean up
testFolder.containerOpen = false;
rootNode.containerOpen = false;

View File

@ -71,13 +71,6 @@ try {
do_throw("Could not get favicon service\n");
}
// Get microsummary service
try {
var mssvc = Cc["@mozilla.org/microsummary/service;1"].getService(Ci.nsIMicrosummaryService);
} catch(ex) {
do_throw("Could not get microsummary service\n");
}
// Get io service
try {
var iosvc = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
@ -266,23 +259,6 @@ function testCanonicalBookmarks(aFolder) {
annosvc.getItemAnnotation(testBookmark1.itemId,
DESCRIPTION_ANNO));
/*
// XXX Bug 380468
// test bookmark 2
var testBookmark2 = testFolder.getChild(1);
// url
do_check_eq("http://test/micsum", testBookmark2.uri);
// title
do_check_eq("test microsummary", testBookmark2.title);
// check that it's a microsummary
var micsum = mssvc.getMicrosummary(testBookmark2.itemId);
if (!micsum)
do_throw("Could not import microsummary");
// check generator uri
var generator = micsum.generator;
do_check_eq("urn:source:http://dietrich.ganx4.com/mozilla/test-microsummary.xml", generator.uri.spec);
// expiration and generated title can change, so don't test them
*/
// clean up
testFolder.containerOpen = false;
rootNode.containerOpen = false;

View File

@ -40,7 +40,6 @@
var bmsvc = PlacesUtils.bookmarks;
var lmsvc = PlacesUtils.livemarks;
var mss = PlacesUtils.microsummaries;
var ptSvc = PlacesUIUtils.ptm;
var tagssvc = PlacesUtils.tagging;
var annosvc = PlacesUtils.annotations;
@ -580,22 +579,6 @@ function run_test() {
do_check_eq(1, bmsvc.getItemIndex(b2));
do_check_eq(2, bmsvc.getItemIndex(b3));
// editBookmarkMicrosummary
var tmpMs = mss.createMicrosummary(uri("http://testmicro.com"),
uri("http://dietrich.ganx4.com/mozilla/test-microsummary.xml"));
ptSvc.doTransaction(
ptSvc.createItem(uri("http://dietrich.ganx4.com/mozilla/test-microsummary-content.php"),
root, -1, "micro test", null, null, null));
var bId = (bmsvc.getBookmarkIdsForURI(uri("http://dietrich.ganx4.com/mozilla/test-microsummary-content.php")))[0];
do_check_true(!mss.hasMicrosummary(bId));
var txn18 = ptSvc.editBookmarkMicrosummary(bId, tmpMs);
txn18.doTransaction();
do_check_eq(observer._itemChangedId, bId);
do_check_true(mss.hasMicrosummary(bId));
txn18.undoTransaction();
do_check_eq(observer._itemChangedId, bId);
do_check_true(!mss.hasMicrosummary(bId));
// Testing edit Post Data
const POST_DATA_ANNO = "bookmarkProperties/POSTData";
var postData = "foo";

View File

@ -231,31 +231,6 @@ function (aSearchURL)
return 0;
}
nsSidebar.prototype.addMicrosummaryGenerator =
function (generatorURL)
{
debug("addMicrosummaryGenerator(" + generatorURL + ")");
if (!/^https?:/i.test(generatorURL))
return;
var stringBundle = srGetStrBundle("chrome://browser/locale/sidebar/sidebar.properties");
var titleMessage = stringBundle.GetStringFromName("addMicsumGenConfirmTitle");
var dialogMessage = stringBundle.formatStringFromName("addMicsumGenConfirmText", [generatorURL], 1);
if (!this.promptService.confirm(null, titleMessage, dialogMessage))
return;
var ioService = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var generatorURI = ioService.newURI(generatorURL, null, null);
var microsummaryService = Components.classes["@mozilla.org/microsummary/service;1"].
getService(Components.interfaces.nsIMicrosummaryService);
if (microsummaryService)
microsummaryService.addGenerator(generatorURI);
}
// property of nsIClassInfo
nsSidebar.prototype.flags = nsIClassInfo.DOM_OBJECT;

View File

@ -77,6 +77,7 @@ components/xmlextras.xpt
components/xpcom.xpt
components/xpti.dat
components/xptitemp.dat
components/nsMicrosummaryService.js
defaults/pref/all.js
defaults/pref/bug259708.js
defaults/pref/bug307259.js
@ -875,7 +876,6 @@ xpicleanup@BIN_SUFFIX@
components/nsLoginInfo.js
components/nsLoginManager.js
components/nsLoginManagerPrompter.js
components/nsMicrosummaryService.js
components/nsPlacesAutoComplete.js
components/nsPlacesDBFlush.js
components/nsPlacesExpiration.js

View File

@ -6,7 +6,6 @@
<!ENTITY editBookmarkOverlay.feedLocation.accesskey "F">
<!ENTITY editBookmarkOverlay.siteLocation.label "Site Location:">
<!ENTITY editBookmarkOverlay.siteLocation.accesskey "S">
<!ENTITY editBookmarkOverlay.liveTitlesSeparator.label "Live Titles">
<!ENTITY editBookmarkOverlay.folder.label "Folder:">
<!ENTITY editBookmarkOverlay.foldersExpanderDown.tooltip "Show all the bookmarks folders">
<!ENTITY editBookmarkOverlay.expanderUp.tooltip "Hide">

View File

@ -76,8 +76,6 @@
<!ENTITY cmd.reloadLivebookmark.label "Reload Live Bookmark">
<!ENTITY cmd.reloadLivebookmark.accesskey "R">
<!ENTITY cmd.reloadMicrosummary.label "Reload Live Title">
<!ENTITY cmd.reloadMicrosummary.accesskey "R">
<!ENTITY cmd.moveBookmarks.label "Move…">
<!ENTITY cmd.moveBookmarks.accesskey "M">

View File

@ -1,2 +0,0 @@
addMicsumGenConfirmTitle=Add Microsummary Generator
addMicsumGenConfirmText=Add the following microsummary generator?\n\nSource: %S

View File

@ -67,7 +67,6 @@
locale/browser/preferences/sync.dtd (%chrome/browser/preferences/sync.dtd)
#endif
locale/browser/preferences/tabs.dtd (%chrome/browser/preferences/tabs.dtd)
locale/browser/sidebar/sidebar.properties (%chrome/browser/sidebar/sidebar.properties)
#ifdef MOZ_SERVICES_SYNC
locale/browser/syncBrand.dtd (%chrome/browser/syncBrand.dtd)
locale/browser/syncSetup.dtd (%chrome/browser/syncSetup.dtd)

View File

@ -405,7 +405,6 @@ menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
#menu_reload,
#placesContext_reload,
#placesContext_reloadMicrosummary,
#context-reload,
#context-reloadframe {
list-style-image: url("moz-icon://stock/gtk-refresh?size=menu");

View File

@ -77,36 +77,6 @@
margin-bottom: 2px;
}
/**** name picker ****/
/* Make the microsummary picker look like a regular textbox instead of
* an editable menulist when no microsummaries are available.
*/
#editBMPanel_namePicker[droppable="false"] {
/* These rules come from the textbox element in textbox.css. */
-moz-appearance: textfield; /* Normal editable menulists set this to "none". */
cursor: text;
border: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
padding: 2px 2px 3px;
-moz-padding-start: 4px;
background-color: -moz-Field;
color: -moz-FieldText;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-editable-box {
-moz-appearance: none; /* Normal editable menulists set this to "menulist-textfield". */
padding: 0;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-dropmarker,
#editBMPanel_namePicker[droppable="false"] > menupopup {
display: none;
}
/* Hide the value column of the tag autocomplete popup
* leaving only the comment column visible. This is
* so that only the tag being edited is shown in the

View File

@ -198,7 +198,6 @@ menuitem[command="placesCmd_show:info"] {
list-style-image: url("moz-icon://stock/gtk-properties?size=menu");
}
#placesContext_reload,
#placesContext_reloadMicrosummary {
#placesContext_reload {
list-style-image: url("moz-icon://stock/gtk-refresh?size=menu");
}

View File

@ -1367,10 +1367,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
list-style-image: url("chrome://browser/skin/hud-style-expander-closed.png");
}
/**** name picker ****/
#editBMPanel_tagsField,
#editBMPanel_namePicker[droppable="false"] > .menulist-editable-box {
#editBMPanel_tagsField {
-moz-appearance: none !important;
-moz-padding-start: 3px !important;
margin: 2px !important;
@ -1383,25 +1380,16 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
min-height: 20px;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-editable-box > html|*.menulist-editable-input {
color: inherit;
}
#editBMPanel_tagsField > .autocomplete-textbox-container > .textbox-input-box > html|*.textbox-input:-moz-placeholder {
color: #bbb;
}
#editBMPanel_tagsField[focused="true"],
#editBMPanel_namePicker[droppable="false"][focused="true"] > .menulist-editable-box {
#editBMPanel_tagsField[focused="true"] {
@hudButtonFocused@
background-color: #eee !important;
color: #000 !important;
}
#editBMPanel_namePicker[droppable="false"][disabled="true"] > .menulist-editable-box {
color: #fff !important;
}
.editBMPanel_rowLabel {
text-align: end;
}

View File

@ -92,70 +92,6 @@
margin: 6px 4px 0 4px;
}
/**** name picker ****/
/* Make the microsummary picker look like a regular textbox instead of
* an editable menulist when no microsummaries are available.
*/
#editBMPanel_namePicker[droppable="false"] {
-moz-appearance: none;
margin: 0px;
border: none;
padding: 0px;
height: auto !important;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-dropmarker {
display: none;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-editable-box {
/* These rules are duplicates of the rules for the textbox element
* in textbox.css and should track changes in that file.
*/
-moz-appearance: textfield;
cursor: text;
margin: 4px 4px;
border: 3px solid;
-moz-border-top-colors: transparent #888888 #000000;
-moz-border-right-colors: transparent #FFFFFF #000000;
-moz-border-bottom-colors: transparent #FFFFFF #000000;
-moz-border-left-colors: transparent #888888 #000000;
border-top-right-radius: 2px;
border-bottom-left-radius: 2px;
padding: 0;
background-color: -moz-Field;
color: -moz-FieldText;
}
#editBMPanel_namePicker[droppable="false"][disabled="true"] > .menulist-editable-box {
cursor: default;
-moz-border-top-colors: transparent ThreeDShadow -moz-Dialog;
-moz-border-right-colors: transparent ThreeDShadow -moz-Dialog;
-moz-border-bottom-colors: transparent ThreeDShadow -moz-Dialog;
-moz-border-left-colors: transparent ThreeDShadow -moz-Dialog;
color: GrayText;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-editable-box > html|*.textbox-input {
margin: 0px !important;
border: none !important;
padding: 0px !important;
background-color: inherit;
color: inherit;
font: inherit;
}
/* Hide the drop marker and the popup. */
#editBMPanel_namePicker[droppable="false"] > .menulist-dropmarker {
display: none;
}
#editBMPanel_namePicker[droppable="false"] > menupopup {
display: none;
}
/* Hide the value column of the tag autocomplete popup
* leaving only the comment column visible. This is
* so that only the tag being edited is shown in the

View File

@ -82,35 +82,6 @@
margin-bottom: 2px;
}
/**** name picker ****/
/* Make the microsummary picker look like a regular textbox instead of
* an editable menulist when no microsummaries are available.
*/
#editBMPanel_namePicker[droppable="false"] {
/* These rules come from the textbox element in textbox.css. */
-moz-appearance: textfield; /* Normal editable menulists set this to "menulist". */
cursor: text;
border: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
padding: 2px 2px 3px;
-moz-padding-start: 4px;
background-color: -moz-Field;
color: -moz-FieldText;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-editable-box {
padding: 0;
}
#editBMPanel_namePicker[droppable="false"] > .menulist-dropmarker,
#editBMPanel_namePicker[droppable="false"] > menupopup {
display: none;
}
/* Hide the value column of the tag autocomplete popup
* leaving only the comment column visible. This is
* so that only the tag being edited is shown in the

View File

@ -371,11 +371,13 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLMediaElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSourcePointer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLoadBlockedDoc)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSourceLoadCandidate)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSourcePointer)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mLoadBlockedDoc)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSourceLoadCandidate)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsHTMLMediaElement)
@ -685,10 +687,11 @@ void nsHTMLMediaElement::NotifyLoadError()
if (!mIsLoadingFromSourceChildren) {
LOG(PR_LOG_DEBUG, ("NotifyLoadError(), no supported media error"));
NoSupportedMediaSourceError();
} else {
NS_ASSERTION(mSourceLoadCandidate, "Must know the source we were loading from!");
} else if (mSourceLoadCandidate) {
DispatchAsyncSourceError(mSourceLoadCandidate);
QueueLoadFromSourceTask();
} else {
NS_WARNING("Should know the source we were loading from!");
}
}
@ -1977,14 +1980,17 @@ void nsHTMLMediaElement::NetworkError()
void nsHTMLMediaElement::DecodeError()
{
if (mIsLoadingFromSourceChildren) {
NS_ASSERTION(mSourceLoadCandidate, "Must know the source we were loading from!");
if (mDecoder) {
mDecoder->Shutdown();
mDecoder = nsnull;
}
mError = nsnull;
DispatchAsyncSourceError(mSourceLoadCandidate);
QueueLoadFromSourceTask();
if (mSourceLoadCandidate) {
DispatchAsyncSourceError(mSourceLoadCandidate);
QueueLoadFromSourceTask();
} else {
NS_WARNING("Should know the source we were loading from!");
}
} else {
Error(nsIDOMMediaError::MEDIA_ERR_DECODE);
}

View File

@ -40,6 +40,7 @@
#include "SVGLength.h"
#include "nsTArray.h"
#include "nsSVGElement.h"
#include "nsIWeakReferenceUtils.h"
namespace mozilla {
@ -206,19 +207,20 @@ public:
{}
SVGLengthListAndInfo(nsSVGElement *aElement, PRUint8 aAxis, PRBool aCanZeroPadList)
: mElement(aElement)
: mElement(do_GetWeakReference(static_cast<nsINode*>(aElement)))
, mAxis(aAxis)
, mCanZeroPadList(aCanZeroPadList)
{}
void SetInfo(nsSVGElement *aElement, PRUint8 aAxis, PRBool aCanZeroPadList) {
mElement = aElement;
mElement = do_GetWeakReference(static_cast<nsINode*>(aElement));
mAxis = aAxis;
mCanZeroPadList = aCanZeroPadList;
}
nsSVGElement* Element() const {
return mElement; // .get();
nsCOMPtr<nsIContent> e = do_QueryReferent(mElement);
return static_cast<nsSVGElement*>(e.get());
}
PRUint8 Axis() const {
@ -291,10 +293,11 @@ public:
}
private:
// We must keep a strong reference to our element because we may belong to a
// We must keep a weak reference to our element because we may belong to a
// cached baseVal nsSMILValue. See the comments starting at:
// https://bugzilla.mozilla.org/show_bug.cgi?id=515116#c15
nsRefPtr<nsSVGElement> mElement;
// See also https://bugzilla.mozilla.org/show_bug.cgi?id=653497
nsWeakPtr mElement;
PRUint8 mAxis;
PRPackedBool mCanZeroPadList;
};

View File

@ -40,6 +40,7 @@
#include "SVGPathSegUtils.h"
#include "nsTArray.h"
#include "nsSVGElement.h"
#include "nsIWeakReferenceUtils.h"
class gfxContext;
struct gfxMatrix;
@ -245,15 +246,16 @@ class SVGPathDataAndOwner : public SVGPathData
{
public:
SVGPathDataAndOwner(nsSVGElement *aElement = nsnull)
: mElement(aElement)
: mElement(do_GetWeakReference(static_cast<nsINode*>(aElement)))
{}
void SetElement(nsSVGElement *aElement) {
mElement = aElement;
mElement = do_GetWeakReference(static_cast<nsINode*>(aElement));
}
nsSVGElement* Element() const {
return mElement;
nsCOMPtr<nsIContent> e = do_QueryReferent(mElement);
return static_cast<nsSVGElement*>(e.get());
}
nsresult CopyFrom(const SVGPathDataAndOwner& rhs) {
@ -284,10 +286,11 @@ public:
using SVGPathData::end;
private:
// We must keep a strong reference to our element because we may belong to a
// We must keep a weak reference to our element because we may belong to a
// cached baseVal nsSMILValue. See the comments starting at:
// https://bugzilla.mozilla.org/show_bug.cgi?id=515116#c15
nsRefPtr<nsSVGElement> mElement;
// See also https://bugzilla.mozilla.org/show_bug.cgi?id=653497
nsWeakPtr mElement;
};
} // namespace mozilla

View File

@ -40,6 +40,7 @@
#include "SVGPoint.h"
#include "nsTArray.h"
#include "nsSVGElement.h"
#include "nsIWeakReferenceUtils.h"
namespace mozilla {
@ -184,15 +185,16 @@ class SVGPointListAndInfo : public SVGPointList
public:
SVGPointListAndInfo(nsSVGElement *aElement = nsnull)
: mElement(aElement)
: mElement(do_GetWeakReference(static_cast<nsINode*>(aElement)))
{}
void SetInfo(nsSVGElement *aElement) {
mElement = aElement;
mElement = do_GetWeakReference(static_cast<nsINode*>(aElement));
}
nsSVGElement* Element() const {
return mElement;
nsCOMPtr<nsIContent> e = do_QueryReferent(mElement);
return static_cast<nsSVGElement*>(e.get());
}
nsresult CopyFrom(const SVGPointListAndInfo& rhs) {
@ -219,10 +221,11 @@ public:
}
private:
// We must keep a strong reference to our element because we may belong to a
// We must keep a weak reference to our element because we may belong to a
// cached baseVal nsSMILValue. See the comments starting at:
// https://bugzilla.mozilla.org/show_bug.cgi?id=515116#c15
nsRefPtr<nsSVGElement> mElement;
// See also https://bugzilla.mozilla.org/show_bug.cgi?id=653497
nsWeakPtr mElement;
};
} // namespace mozilla

View File

@ -80,6 +80,7 @@ DIRS += \
base \
src \
locales \
plugins/base \
plugins/ipc \
indexedDB \
system \

View File

@ -123,11 +123,9 @@ static PRLogModuleInfo* gJSDiagnostics;
#endif
// Thank you Microsoft!
#ifndef WINCE
#ifdef CompareString
#undef CompareString
#endif
#endif // WINCE
// The amount of time we wait between a request to GC (due to leaving
// a page) and doing the actual GC.

View File

@ -44,7 +44,7 @@
#include "nsISupports.idl"
[scriptable, uuid(67cf6231-c303-4f7e-b9b1-a0e87772ecfd)]
[scriptable, uuid(41a22fb6-39e2-45e1-95c5-7e8cea36575d)]
interface nsISidebar : nsISupports
{
void addPanel(in wstring aTitle, in string aContentURL,
@ -53,7 +53,6 @@ interface nsISidebar : nsISupports
in string aCustomizeURL);
void addSearchEngine(in string engineURL, in string iconURL,
in wstring suggestedTitle, in wstring suggestedCategory);
void addMicrosummaryGenerator(in string generatorURL);
};
[scriptable, uuid(4350fb73-9305-41df-a669-11d26222d420)]

View File

@ -35,7 +35,7 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
@ -43,7 +43,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = plugin
XPIDL_MODULE = layout
LIBRARY_NAME = gkplugin
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
@ -53,6 +52,32 @@ LIBXUL_LIBRARY = 1
EXPORTS_NAMESPACES = mozilla
XPIDLSRCS = \
nsIHTTPHeaderListener.idl \
nsIPlugin.idl \
nsIPluginDocument.idl \
nsIPluginHost.idl \
nsIPluginInputStream.idl \
nsIPluginInstance.idl \
nsIPluginInstanceOwner.idl \
nsIPluginStreamInfo.idl \
nsIPluginStreamListener.idl \
nsIPluginTag.idl \
nsIPluginTagInfo.idl \
nspluginroot.idl \
$(NULL)
EXPORTS = \
npapi.h \
npfunctions.h \
nptypes.h \
npruntime.h \
nsPluginLogging.h \
nsPluginError.h \
nsPluginNativeWindow.h \
nsPluginsCID.h \
$(NULL)
EXPORTS_mozilla = \
PluginPRLibrary.h \
$(NULL)

View File

@ -142,8 +142,7 @@ CMMSRCS += \
endif
LOCAL_INCLUDES = \
-I$(topsrcdir)/modules/plugin/base/public/ \
-I$(topsrcdir)/modules/plugin/base/src/ \
-I$(srcdir)/../base \
-I$(topsrcdir)/xpcom/base/ \
$(NULL)

View File

@ -67,11 +67,6 @@ LOCAL_INCLUDES = \
EXPORTS = nsGeoPosition.h
ifdef WINCE_WINDOWS_MOBILE
LOCAL_INCLUDES += -I$(topsrcdir)/dom/system/windows \
$(NULL)
endif
ifdef MOZ_MAEMO_LIBLOCATION
LOCAL_INCLUDES += $(MOZ_PLATFORM_MAEMO_CFLAGS) \
-I$(topsrcdir)/dom/system/unix \

View File

@ -75,10 +75,6 @@
#include <math.h>
#ifdef WINCE_WINDOWS_MOBILE
#include "WinMobileLocationProvider.h"
#endif
#ifdef MOZ_MAEMO_LIBLOCATION
#include "MaemoLocationProvider.h"
#endif
@ -577,12 +573,6 @@ nsresult nsGeolocationService::Init()
// we should move these providers outside of this file! dft
#ifdef WINCE_WINDOWS_MOBILE
provider = new WinMobileLocationProvider();
if (provider)
mProviders.AppendObject(provider);
#endif
#ifdef MOZ_MAEMO_LIBLOCATION
provider = new MaemoLocationProvider();
if (provider)

View File

@ -55,11 +55,4 @@ CPPSRCS = \
nsAccelerometerSystem.cpp \
$(NULL)
ifdef WINCE_WINDOWS_MOBILE
CPPSRCS += WinMobileLocationProvider.cpp
LOCAL_INCLUDES += -I$(topsrcdir)/dom/src/geolocation \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,179 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Geolocation.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@meer.net> (Original Author)
* Nino D'Aversa <ninodaversa@gmail.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
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGeoPosition.h"
#include "WinMobileLocationProvider.h"
#include "nsGeolocation.h"
#include "nsIClassInfo.h"
#include "nsDOMClassInfoID.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIServiceManager.h"
NS_IMPL_ISUPPORTS2(WinMobileLocationProvider, nsIGeolocationProvider, nsITimerCallback)
WinMobileLocationProvider::WinMobileLocationProvider() :
mGPSDevice(nsnull),
mOpenDevice(nsnull),
mCloseDevice(nsnull),
mGetPosition(nsnull),
mGetDeviceState(nsnull),
mHasSeenLocation(PR_FALSE),
mHasGPS(PR_TRUE) /* think positively */
{
}
WinMobileLocationProvider::~WinMobileLocationProvider()
{
}
NS_IMETHODIMP
WinMobileLocationProvider::Notify(nsITimer* aTimer)
{
if (!mGPSDevice || !mGetPosition)
return NS_ERROR_FAILURE;
GPS_POSITION pos;
memset(&pos, 0, sizeof(GPS_POSITION));
pos.dwVersion = GPS_VERSION_1;
pos.dwSize = sizeof(GPS_POSITION);
//TODO: add ability to control maximum age with the PositionOptions
//100ms is maximum age of GPS data
mGetPosition(mGPSDevice, &pos, 100, 0);
if ((!(pos.dwValidFields & GPS_VALID_LATITUDE) &&
!(pos.dwValidFields & GPS_VALID_LONGITUDE) ) ||
pos.dwFlags == GPS_DATA_FLAGS_HARDWARE_OFF ||
pos.FixQuality == GPS_FIX_QUALITY_UNKNOWN)
return NS_OK;
nsRefPtr<nsGeoPosition> somewhere =
new nsGeoPosition(pos.dblLatitude,
pos.dblLongitude,
(double)pos.flAltitudeWRTSeaLevel,
(double)pos.flHorizontalDilutionOfPrecision,
(double)pos.flVerticalDilutionOfPrecision,
(double)pos.flHeading,
(double)pos.flSpeed,
PR_Now());
Update(somewhere);
return NS_OK;
}
NS_IMETHODIMP WinMobileLocationProvider::Startup()
{
if (mHasGPS && !mGPSInst) {
mGPSInst = LoadLibraryW(L"gpsapi.dll");
if(!mGPSInst) {
mHasGPS = PR_FALSE;
NS_ASSERTION(mGPSInst, "failed to load library gpsapi.dll");
return NS_ERROR_FAILURE;
}
mOpenDevice = (OpenDeviceProc) GetProcAddress(mGPSInst,"GPSOpenDevice");
mCloseDevice = (CloseDeviceProc) GetProcAddress(mGPSInst,"GPSCloseDevice");
mGetPosition = (GetPositionProc) GetProcAddress(mGPSInst,"GPSGetPosition");
mGetDeviceState = (GetDeviceStateProc) GetProcAddress(mGPSInst,"GPSGetDeviceState");
if (!mOpenDevice || !mCloseDevice || !mGetPosition || !mGetDeviceState)
return NS_ERROR_FAILURE;
mGPSDevice = mOpenDevice(NULL, NULL, NULL, 0);
if (!mGPSDevice) {
NS_ASSERTION(mGPSDevice, "GPS Device not found");
return NS_ERROR_FAILURE;
}
nsresult rv;
mUpdateTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
PRInt32 update = 3000; //3 second default timer
if (prefs)
prefs->GetIntPref("geo.default.update", &update);
mUpdateTimer->InitWithCallback(this, update, nsITimer::TYPE_REPEATING_SLACK);
}
return NS_OK;
}
NS_IMETHODIMP WinMobileLocationProvider::Watch(nsIGeolocationUpdate *callback)
{
if (mCallback)
return NS_OK;
mCallback = callback;
return NS_OK;
}
NS_IMETHODIMP WinMobileLocationProvider::Shutdown()
{
if (mUpdateTimer)
mUpdateTimer->Cancel();
if (mGPSDevice)
mCloseDevice(mGPSDevice);
mGPSDevice = nsnull;
mHasSeenLocation = PR_FALSE;
mCallback = nsnull;
FreeLibrary(mGPSInst);
mGPSInst = nsnull;
mOpenDevice = nsnull;
mCloseDevice = nsnull;
mGetPosition = nsnull;
mGetDeviceState = nsnull;
return NS_OK;
}
void WinMobileLocationProvider::Update(nsIDOMGeoPosition* aPosition)
{
mHasSeenLocation = PR_TRUE;
if (mCallback)
mCallback->Update(aPosition);
}

View File

@ -1,81 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Geolocation.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@meer.net> (Original Author)
* Nino D'Aversa <ninodaversa@gmail.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
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <windows.h>
#undef GetMessage //prevent collision with nsDOMGeoPositionError::GetMessage(nsAString & aMessage)
#include <gpsapi.h>
#include "nsIGeolocationProvider.h"
#include "nsCOMPtr.h"
#include "nsITimer.h"
typedef HANDLE (*OpenDeviceProc)(HANDLE hNewLocationData, HANDLE hDeviceStateChange, const WCHAR *szDeviceName, DWORD dwFlags);
typedef DWORD (*CloseDeviceProc)(HANDLE hGPSDevice);
typedef DWORD (*GetPositionProc)(HANDLE hGPSDevice, GPS_POSITION *pGPSPosition, DWORD dwMaximumAge, DWORD dwFlags);
typedef DWORD (*GetDeviceStateProc)(GPS_DEVICE *pGPSDevice);
class WinMobileLocationProvider : public nsIGeolocationProvider,
public nsITimerCallback
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGEOLOCATIONPROVIDER
NS_DECL_NSITIMERCALLBACK
WinMobileLocationProvider();
void Update(nsIDOMGeoPosition* aPosition);
private:
~WinMobileLocationProvider();
nsCOMPtr<nsIGeolocationUpdate> mCallback;
PRPackedBool mHasSeenLocation;
PRPackedBool mHasGPS;
nsCOMPtr<nsITimer> mUpdateTimer;
HINSTANCE mGPSInst;
HANDLE mGPSDevice;
OpenDeviceProc mOpenDevice;
CloseDeviceProc mCloseDevice;
GetPositionProc mGetPosition;
GetDeviceStateProc mGetDeviceState;
};

View File

@ -547,7 +547,15 @@ nsWindowWatcher::OpenWindowJSInternal(nsIDOMWindow *aParent,
// no extant window? make a new one.
nsCOMPtr<nsIDOMChromeWindow> chromeParent(do_QueryInterface(aParent));
// If no parent, consider it chrome.
PRBool hasChromeParent = PR_TRUE;
if (aParent) {
// Check if the parent document has chrome privileges.
nsCOMPtr<nsIDOMDocument> domdoc;
aParent->GetDocument(getter_AddRefs(domdoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
hasChromeParent = doc && nsContentUtils::IsChromeDoc(doc);
}
// Make sure we call CalculateChromeFlags() *before* we push the
// callee context onto the context stack so that
@ -555,7 +563,7 @@ nsWindowWatcher::OpenWindowJSInternal(nsIDOMWindow *aParent,
// security checks.
chromeFlags = CalculateChromeFlags(features.get(), featuresSpecified,
aDialog, uriToLoadIsChrome,
!aParent || chromeParent);
hasChromeParent);
// If we're not called through our JS version of the API, and we got
// our internal modal option, treat the window we're opening as a
@ -590,7 +598,7 @@ nsWindowWatcher::OpenWindowJSInternal(nsIDOMWindow *aParent,
JSContext *cx = GetJSContextFromWindow(aParent);
if (isCallerChrome && !chromeParent && cx) {
if (isCallerChrome && !hasChromeParent && cx) {
// open() is called from chrome on a non-chrome window, push
// the context of the callee onto the context stack to
// prevent the caller's priveleges from leaking into code
@ -666,7 +674,7 @@ nsWindowWatcher::OpenWindowJSInternal(nsIDOMWindow *aParent,
// isn't a chrome window. Otherwise we can end up in a bizarre situation
// where we can't shut down because an invisible window is open. If
// someone tries to do this, throw.
if (!chromeParent && (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)) {
if (!hasChromeParent && (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)) {
PRBool parentVisible = PR_TRUE;
nsCOMPtr<nsIBaseWindow> parentWindow(do_GetInterface(parentTreeOwner));
nsCOMPtr<nsIWidget> parentWidget;

View File

@ -1903,10 +1903,8 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
aState.GetGeometricParent(outerStyleContext->GetStyleDisplay(),
aParentFrame);
// Init the table outer frame and see if we need to create a view, e.g.
// the frame is absolutely positioned
// Init the table outer frame
InitAndRestoreFrame(aState, content, geometricParent, nsnull, newFrame);
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Create the inner table frame
nsIFrame* innerFrame;
@ -1986,7 +1984,6 @@ nsCSSFrameConstructor::ConstructTableRow(nsFrameConstructorState& aState,
return NS_ERROR_OUT_OF_MEMORY;
}
InitAndRestoreFrame(aState, content, aParentFrame, nsnull, newFrame);
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
nsFrameItems childItems;
nsresult rv;
@ -2087,7 +2084,6 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
// Initialize the table cell frame
InitAndRestoreFrame(aState, content, aParentFrame, nsnull, newFrame);
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Resolve pseudo style and initialize the body cell frame
nsRefPtr<nsStyleContext> innerPseudoStyle;
@ -2435,9 +2431,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
}
*aNewFrame = frameItems.FirstChild();
processChildren = PR_TRUE;
// See if we need to create a view
nsContainerFrame::CreateViewForFrame(contentFrame, PR_FALSE);
} else {
return NS_ERROR_FAILURE;
}
@ -2955,8 +2948,6 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState,
buttonFrame->Destroy();
return rv;
}
// See if we need to create a view
nsContainerFrame::CreateViewForFrame(buttonFrame, PR_FALSE);
nsRefPtr<nsStyleContext> innerBlockContext;
innerBlockContext =
@ -3084,17 +3075,12 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
aState.GetGeometricParent(aStyleDisplay, aParentFrame),
nsnull, comboboxFrame);
nsContainerFrame::CreateViewForFrame(comboboxFrame, PR_FALSE);
rv = aState.AddChild(comboboxFrame, aFrameItems, content, styleContext,
aParentFrame);
if (NS_FAILED(rv)) {
return rv;
}
///////////////////////////////////////////////////////////////////
// Combobox - Old Native Implementation
///////////////////////////////////////////////////////////////////
nsIComboboxControlFrame* comboBox = do_QueryFrame(comboboxFrame);
NS_ASSERTION(comboBox, "NS_NewComboboxControlFrame returned frame that "
"doesn't implement nsIComboboxControlFrame");
@ -3128,11 +3114,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
comboboxFrame, listStyle, PR_TRUE,
aItem.mPendingBinding, aFrameItems);
// Set flag so the events go to the listFrame not child frames.
// XXX: We should replace this with a real widget manager similar
// to how the nsFormControlFrame works. Re-directing events is a temporary Kludge.
NS_ASSERTION(listFrame->GetView(), "ListFrame's view is nsnull");
//listFrame->GetView()->SetViewFlags(NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN);
// Create display and button frames from the combobox's anonymous content.
// The anonymous content is appended to existing anonymous content for this
@ -3159,9 +3141,6 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
aState.mFrameState);
}
} else {
///////////////////////////////////////////////////////////////////
// ListBox - Old Native Implementation
///////////////////////////////////////////////////////////////////
nsIFrame* listFrame = NS_NewListControlFrame(mPresShell, styleContext);
if (listFrame) {
rv = NS_OK;
@ -3223,7 +3202,9 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsFrameConstructorState& aState,
}
}
nsContainerFrame::CreateViewForFrame(scrollFrame, aBuildCombobox);
if (aBuildCombobox) {
nsContainerFrame::CreateViewForFrame(scrollFrame, PR_TRUE);
}
BuildScrollFrame(aState, aContent, aStyleContext, scrolledFrame,
geometricParent, scrollFrame);
@ -3272,10 +3253,6 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
aState.GetGeometricParent(aStyleDisplay, aParentFrame),
nsnull, newFrame);
// See if we need to create a view, e.g. the frame is absolutely
// positioned
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Resolve style and initialize the frame
nsRefPtr<nsStyleContext> fieldsetContentStyle;
fieldsetContentStyle = mPresShell->StyleSet()->
@ -4229,9 +4206,6 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsFrameConstructorState& aState,
}
InitAndRestoreFrame(aState, aContent, aParentFrame, nsnull, gfxScrollFrame);
// Create a view
nsContainerFrame::CreateViewForFrame(gfxScrollFrame, PR_FALSE);
}
// if there are any anonymous children for the scroll frame, create
@ -4912,7 +4886,6 @@ nsCSSFrameConstructor::ConstructSVGForeignObjectFrame(nsFrameConstructorState& a
// We don't allow this frame to be out of flow
InitAndRestoreFrame(aState, content, aParentFrame, nsnull, newFrame);
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
nsresult rv = aState.AddChild(newFrame, aFrameItems, content, styleContext,
aParentFrame, PR_FALSE, PR_FALSE);
@ -8374,7 +8347,6 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShe
if (newFrame) {
newFrame->Init(aContent, aParentFrame, aFrame);
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Create a continuing inner table frame, and if there's a caption then
// replicate the caption
@ -8420,7 +8392,6 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
if (newFrame) {
newFrame->Init(aContent, aParentFrame, aFrame);
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Replicate any header/footer frames
nsFrameItems childFrames;
@ -8500,7 +8471,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else if (nsGkAtoms::inlineFrame == frameType) {
@ -8508,7 +8478,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else if (nsGkAtoms::blockFrame == frameType) {
@ -8516,7 +8485,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
#ifdef MOZ_XUL
@ -8525,7 +8493,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
#endif
} else if (nsGkAtoms::columnSetFrame == frameType) {
@ -8533,7 +8500,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else if (nsGkAtoms::positionedInlineFrame == frameType) {
@ -8541,7 +8507,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else if (nsGkAtoms::pageFrame == frameType) {
@ -8561,7 +8526,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else if (nsGkAtoms::tableRowFrame == frameType) {
@ -8569,7 +8533,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Create a continuing frame for each table cell frame
nsFrameItems newChildList;
@ -8603,7 +8566,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Create a continuing area frame
nsIFrame* continuingBlockFrame;
@ -8625,7 +8587,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else if (nsGkAtoms::letterFrame == frameType) {
@ -8633,7 +8594,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else if (nsGkAtoms::imageFrame == frameType) {
@ -8673,8 +8633,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
// Create a continuing area frame
// XXXbz we really shouldn't have to do this by hand!
nsIFrame* continuingBlockFrame;
@ -8694,7 +8652,6 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
if (newFrame) {
newFrame->Init(content, aParentFrame, aFrame);
nsHTMLContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
}
} else {
NS_NOTREACHED("unexpected frame type");
@ -10625,6 +10582,7 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
{
// Create column wrapper if necessary
nsIFrame* blockFrame = *aNewFrame;
NS_ASSERTION(blockFrame->GetType() == nsGkAtoms::blockFrame, "not a block frame?");
nsIFrame* parent = aParentFrame;
nsRefPtr<nsStyleContext> blockStyle = aStyleContext;
const nsStyleColumn* columns = aStyleContext->GetStyleColumn();
@ -10638,8 +10596,6 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
}
InitAndRestoreFrame(aState, aContent, aParentFrame, nsnull, columnSetFrame);
// See if we need to create a view
nsContainerFrame::CreateViewForFrame(columnSetFrame, PR_FALSE);
blockStyle = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::columnContent, aStyleContext);
parent = columnSetFrame;
@ -10659,9 +10615,6 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
return rv;
}
// See if we need to create a view, e.g. the frame is absolutely positioned
nsHTMLContainerFrame::CreateViewForFrame(blockFrame, PR_FALSE);
if (!mRootElementFrame) {
// The frame we're constructing will be the root element frame.
// Set mRootElementFrame before processing children.
@ -10778,9 +10731,6 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
// because the object's destructor is significant
// this is part of the fix for bug 42372
// Any inline frame might need a view (because of opacity, or fixed background)
nsContainerFrame::CreateViewForFrame(newFrame, PR_FALSE);
if (positioned) {
// Relatively positioned frames becomes a container for child
// frames that are positioned
@ -10867,9 +10817,6 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
InitAndRestoreFrame(aState, content, parentFrame, nsnull, blockFrame,
PR_FALSE);
// Any frame could have a view
nsContainerFrame::CreateViewForFrame(blockFrame, PR_FALSE);
// Find the first non-block child which defines the end of our block kids
// and the start of our next inline's kids
nsFrameList::FrameLinkEnumerator firstNonBlock =
@ -10894,9 +10841,6 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
InitAndRestoreFrame(aState, content, parentFrame, nsnull, inlineFrame,
PR_FALSE);
// Any frame might need a view
nsHTMLContainerFrame::CreateViewForFrame(inlineFrame, PR_FALSE);
if (aChildItems.NotEmpty()) {
nsFrameList::FrameLinkEnumerator firstBlock(aChildItems);
FindFirstBlock(firstBlock);

View File

@ -1451,6 +1451,8 @@ private:
nsIFrame* aScrolledFrame);
// InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
// aBuildCombobox indicates if we are building a combobox that has a dropdown
// popup widget or not.
nsresult
InitializeSelectFrame(nsFrameConstructorState& aState,
nsIFrame* scrollFrame,

View File

@ -159,7 +159,7 @@ LOCAL_INCLUDES += \
-I$(srcdir)/../../content/base/src \
-I$(srcdir)/../../content/html/content/src \
-I$(srcdir)/../../dom/base \
-I$(srcdir)/../../modules/plugin/base/src \
-I$(srcdir)/../../dom/plugins/base \
$(MOZ_CAIRO_CFLAGS) \
$(NULL)

View File

@ -1842,63 +1842,6 @@ nsBoxFrame::GetFrameSizeWithMargin(nsIBox* aBox, nsSize& aSize)
}
#endif
/**
* Boxed don't support fixed positionioning of their children.
* KEEP THIS IN SYNC WITH nsContainerFrame::CreateViewForFrame
* as much as possible. Until we get rid of views finally...
*/
nsresult
nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext,
nsIFrame* aFrame,
nsStyleContext* aStyleContext,
PRBool aForce,
PRBool aIsPopup)
{
NS_ASSERTION(aForce, "We only get called to force view creation now");
// If we don't yet have a view, see if we need a view
if (!aFrame->HasView()) {
nsViewVisibility visibility = nsViewVisibility_kShow;
PRInt32 zIndex = 0;
PRBool autoZIndex = PR_FALSE;
if (aForce) {
nsIView* parentView;
nsIViewManager* viewManager = aPresContext->GetPresShell()->GetViewManager();
NS_ASSERTION(nsnull != viewManager, "null view manager");
// Create a view
if (aIsPopup) {
parentView = viewManager->GetRootView();
visibility = nsViewVisibility_kHide;
zIndex = PR_INT32_MAX;
}
else {
parentView = aFrame->GetParent()->GetClosestView();
}
NS_ASSERTION(parentView, "no parent view");
// Create a view
nsIView *view = viewManager->CreateView(aFrame->GetRect(), parentView, visibility);
if (view) {
viewManager->SetViewZIndex(view, autoZIndex, zIndex);
// XXX put view last in document order until we can do better
viewManager->InsertChild(parentView, view, nsnull, PR_TRUE);
}
// Remember our view
aFrame->SetView(view);
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsBoxFrame::CreateViewForFrame: frame=%p view=%p",
aFrame));
if (!view)
return NS_ERROR_OUT_OF_MEMORY;
}
}
return NS_OK;
}
// If you make changes to this function, check its counterparts
// in nsTextBoxFrame and nsXULLabelFrame
nsresult

View File

@ -180,14 +180,6 @@ public:
nsBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot = PR_FALSE, nsIBoxLayout* aLayoutManager = nsnull);
// if aIsPopup is true, then the view is for a popup. In this case,
// the view is added a child of the root view, and is initially hidden
static nsresult CreateViewForFrame(nsPresContext* aPresContext,
nsIFrame* aChild,
nsStyleContext* aStyleContext,
PRBool aForce,
PRBool aIsPopup = PR_FALSE);
// virtual so nsStackFrame, nsButtonBoxFrame, nsSliderFrame and nsMenuFrame
// can override it
NS_IMETHOD BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,

View File

@ -151,7 +151,7 @@ nsMenuPopupFrame::Init(nsIContent* aContent,
GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar, tempBool);
mMenuCanOverlapOSBar = tempBool;
rv = CreateViewForFrame(presContext, this, GetStyleContext(), PR_TRUE, PR_TRUE);
rv = CreatePopupViewForFrame();
NS_ENSURE_SUCCESS(rv, rv);
// XXX Hack. The popup's view should float above all other views,
@ -1872,3 +1872,49 @@ nsMenuPopupFrame::SetConsumeRollupEvent(PRUint32 aConsumeMode)
{
mConsumeRollupEvent = aConsumeMode;
}
/**
* KEEP THIS IN SYNC WITH nsContainerFrame::CreateViewForFrame
* as much as possible. Until we get rid of views finally...
*/
nsresult
nsMenuPopupFrame::CreatePopupViewForFrame()
{
if (HasView()) {
return NS_OK;
}
nsViewVisibility visibility = nsViewVisibility_kShow;
PRInt32 zIndex = 0;
PRBool autoZIndex = PR_FALSE;
nsIView* parentView;
nsIViewManager* viewManager = PresContext()->GetPresShell()->GetViewManager();
NS_ASSERTION(nsnull != viewManager, "null view manager");
// Create a view
parentView = viewManager->GetRootView();
visibility = nsViewVisibility_kHide;
zIndex = PR_INT32_MAX;
NS_ASSERTION(parentView, "no parent view");
// Create a view
nsIView *view = viewManager->CreateView(GetRect(), parentView, visibility);
if (view) {
viewManager->SetViewZIndex(view, autoZIndex, zIndex);
// XXX put view last in document order until we can do better
viewManager->InsertChild(parentView, view, nsnull, PR_TRUE);
}
// Remember our view
SetView(view);
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("nsMenuPopupFrame::CreatePopupViewForFrame: frame=%p view=%p", this, view));
if (!view)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}

View File

@ -400,6 +400,10 @@ protected:
: GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
}
// Create a popup view for this frame. The view is added a child of the root
// view, and is initially hidden.
nsresult CreatePopupViewForFrame();
nsString mIncrementalString; // for incremental typing navigation
// the content that the popup is anchored to, if any, which may be in a

View File

@ -183,10 +183,6 @@ pref("findhelper.autozoom", true);
/* autocomplete */
pref("browser.formfill.enable", true);
/* microsummaries */
pref("browser.microsummary.enabled", false);
pref("browser.microsummary.updateGenerators", false);
/* spellcheck */
pref("layout.spellcheckDefault", 0);
@ -588,6 +584,9 @@ pref("image.mem.decodeondraw", true);
pref("content.image.allow_locking", false);
pref("image.mem.min_discard_timeout_ms", 20000);
// enable touch events interfaces
pref("dom.w3c_touch_events.enabled", true);
#ifdef MOZ_SAFE_BROWSING
// Safe browsing does nothing unless this pref is set
pref("browser.safebrowsing.enabled", true);
@ -637,4 +636,5 @@ pref("urlclassifier.updatecachemax", 4194304);
// URL for checking the reason for a malware warning.
pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site=");
#endif
#endif

View File

@ -61,6 +61,10 @@ const kBrowserViewZoomLevelPrecision = 10000;
const kDefaultBrowserWidth = 800;
const kFallbackBrowserWidth = 980;
// allow panning after this timeout on pages with registered touch listeners
const kTouchTimeout = 300;
const kDefaultMetadata = { autoSize: false, allowZoom: true, autoScale: true };
// Override sizeToContent in the main window. It breaks things (bug 565887)
@ -335,6 +339,19 @@ var Browser = {
// Should we restore the previous session (crash or some other event)
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
if (ss.shouldRestore()) {
// Initial window resizes call functions that assume a tab is in the tab list
// and restored tabs are added too late. We add a dummy to to satisfy the resize
// code and then remove the dummy after the session has been restored.
let dummy = this.addTab("about:blank");
let dummyCleanup = {
observe: function() {
Services.obs.removeObserver(dummyCleanup, "sessionstore-windows-restored");
dummy.chromeTab.ignoreUndo = true;
Browser.closeTab(dummy, { forceClose: true });
}
};
Services.obs.addObserver(dummyCleanup, "sessionstore-windows-restored", false);
ss.restoreLastSession();
// Also open any commandline URLs, except the homepage
@ -417,9 +434,9 @@ var Browser = {
return true;
// Let everyone know we are closing the last browser window
let closingCanceled = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(closingCanceled, "browser-lastwindow-close-requested", null);
if (closingCanceled.data)
let closingCancelled = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(closingCancelled, "browser-lastwindow-close-requested", null);
if (closingCancelled.data)
return false;
Services.obs.notifyObservers(null, "browser-lastwindow-close-granted", null);
@ -679,7 +696,7 @@ var Browser = {
tab.browser.messageManager.sendAsyncMessage("Browser:CanUnload", {});
},
_doCloseTab: function _docloseTab(aTab) {
_doCloseTab: function _doCloseTab(aTab) {
let nextTab = this._getNextTab(aTab);
if (!nextTab)
return;
@ -1184,6 +1201,10 @@ Browser.MainDragger = function MainDragger() {
Elements.browsers.addEventListener("PanBegin", this, false);
Elements.browsers.addEventListener("PanFinished", this, false);
// allow pages to to override panning, but should
// still allow the sidebars to be panned out of view
this.contentMouseCapture = false;
};
Browser.MainDragger.prototype = {
@ -1214,48 +1235,42 @@ Browser.MainDragger.prototype = {
dragMove: function dragMove(dx, dy, scroller, aIsKinetic) {
let doffset = new Point(dx, dy);
// First calculate any panning to take sidebars out of view
let panOffset = this._panControlsAwayOffset(doffset);
// If the sidebars are showing, we pan them out of the way before panning the content.
// The panning distance that should be used for the sidebars in is stored in sidebarOffset,
// and subtracted from doffset
let sidebarOffset = this._getSidebarOffset(doffset);
// If we started at one sidebar, stop when we get to the other.
if (panOffset.x != 0 && !this._stopAtSidebar) {
this._stopAtSidebar = panOffset.x; // negative: stop at left; positive: stop at right
// If we started with one sidebar open, stop when we get to the other.
if (sidebarOffset.x != 0)
this._blockSidebars(sidebarOffset);
if (!this.contentMouseCapture)
this._panContent(doffset);
if (this._hitSidebar && aIsKinetic)
return false; // No kinetic panning after we've stopped at the sidebar.
// allow panning the sidebars if the page hasn't prevented it, or if any of the sidebars are showing
// (i.e. we always allow panning sidebars off screen but not necessarily panning them back on)
if (!this.contentMouseCapture || sidebarOffset.x != 0 || sidebarOffset.y > 0)
this._panChrome(doffset, sidebarOffset);
this._updateScrollbars();
return !doffset.equals(dx, dy);
},
_blockSidebars: function md_blockSidebars(aSidebarOffset) {
// only call this code once
if (!this._stopAtSidebar) {
this._stopAtSidebar = aSidebarOffset.x; // negative: stop at left; positive: stop at right
// after a timeout, we allow showing the sidebar, to give the appearance of some "friction" at the edge
this._sidebarTimeout = setTimeout(function(self) {
self._stopAtSidebar = 0;
self._sidebarTimeout = null;
}, 350, this);
}
if (this._contentView && !this._contentView.isRoot()) {
this._panContentView(this._contentView, doffset);
// XXX we may need to have "escape borders" for iframe panning
// XXX does not deal with scrollables within scrollables
}
// Do content panning
this._panContentView(getBrowser().getRootView(), doffset);
if (this._hitSidebar && aIsKinetic)
return; // No kinetic panning after we've stopped at the sidebar.
// Any leftover panning in doffset would bring controls into view. Add to sidebar
// away panning for the total scroll offset.
let offsetX = doffset.x;
if ((this._stopAtSidebar > 0 && offsetX > 0) ||
(this._stopAtSidebar < 0 && offsetX < 0)) {
if (offsetX != panOffset.x)
this._hitSidebar = true;
doffset.x = panOffset.x;
} else {
doffset.add(panOffset);
}
Browser.tryFloatToolbar(doffset.x, 0);
this._panScroller(Browser.controlsScrollboxScroller, doffset);
this._panScroller(Browser.pageScrollboxScroller, doffset);
this._updateScrollbars();
return !doffset.equals(dx, dy);
},
handleEvent: function handleEvent(aEvent) {
@ -1286,8 +1301,38 @@ Browser.MainDragger.prototype = {
}
},
_panContent: function md_panContent(aOffset) {
if (this._contentView && !this._contentView.isRoot()) {
this._panContentView(this._contentView, aOffset);
// XXX we may need to have "escape borders" for iframe panning
// XXX does not deal with scrollables within scrollables
}
// Do content panning
this._panContentView(getBrowser().getRootView(), aOffset);
},
_panChrome: function md_panSidebars(aOffset, aSidebarOffset) {
// Any panning aOffset would bring controls into view. Add to aSidebarOffset
let offsetX = aOffset.x;
if ((this._stopAtSidebar > 0 && offsetX > 0) ||
(this._stopAtSidebar < 0 && offsetX < 0)) {
if (offsetX != aSidebarOffset.x)
this._hitSidebar = true;
aOffset.x = aSidebarOffset.x;
} else {
aOffset.add(aSidebarOffset);
}
Browser.tryFloatToolbar(aOffset.x, 0);
// pan the sidebars
this._panScroller(Browser.controlsScrollboxScroller, aOffset);
// pan the urlbar
this._panScroller(Browser.pageScrollboxScroller, aOffset);
},
/** Return offset that pans controls away from screen. Updates doffset with leftovers. */
_panControlsAwayOffset: function(doffset) {
_getSidebarOffset: function(doffset) {
let x = 0, y = 0, rect;
rect = Rect.fromRect(Browser.pageScrollbox.getBoundingClientRect()).map(Math.round);
@ -1494,6 +1539,7 @@ Browser.WebProgress.prototype = {
aTab.updateThumbnail();
browser.messageManager.addMessageListener("MozScrolledAreaChanged", aTab.scrolledAreaChanged);
ContentTouchHandler.updateContentCapture();
});
}
};
@ -1582,6 +1628,7 @@ const ContentTouchHandler = {
// Use lightweight transactions so that old context menus and tap
// highlights don't ever see the light of day.
_messageId: 0,
contentCanCaptureMouse: false,
init: function init() {
document.addEventListener("TapDown", this, true);
@ -1590,6 +1637,7 @@ const ContentTouchHandler = {
document.addEventListener("TapSingle", this, false);
document.addEventListener("TapDouble", this, false);
document.addEventListener("TapLong", this, false);
document.addEventListener("TapMove", this, false);
document.addEventListener("PanBegin", this, false);
document.addEventListener("PopupChanged", this, false);
@ -1606,8 +1654,9 @@ const ContentTouchHandler = {
// a long tap, without waiting for child process.
//
messageManager.addMessageListener("Browser:ContextMenu", this);
messageManager.addMessageListener("Browser:Highlight", this);
messageManager.addMessageListener("Browser:CaptureEvents", this);
messageManager.addMessageListener("Browser:CanCaptureMouse:Return", this);
},
handleEvent: function handleEvent(aEvent) {
@ -1648,12 +1697,12 @@ const ContentTouchHandler = {
this.tapSingle(aEvent.clientX, aEvent.clientY, aEvent.modifiers);
aEvent.preventDefault();
}
} else {
this.tapUp(aEvent.clientX, aEvent.clientY);
}
this._dispatchMouseEvent("Browser:MouseUp", aEvent.clientX, aEvent.clientY);
break;
case "TapSingle":
this.tapSingle(aEvent.clientX, aEvent.clientY, aEvent.modifiers);
this._dispatchMouseEvent("Browser:MouseUp", aEvent.clientX, aEvent.clientY);
break;
case "TapDouble":
this.tapDouble(aEvent.clientX, aEvent.clientY, aEvent.modifiers);
@ -1661,11 +1710,19 @@ const ContentTouchHandler = {
case "TapLong":
this.tapLong(aEvent.clientX, aEvent.clientY);
break;
case "TapMove":
this.tapMove(aEvent.clientX, aEvent.clientY);
break;
}
}
}
},
updateContentCapture: function() {
this._messageId++;
messageManager.sendAsyncMessage("Browser:CanCaptureMouse", { messageId: this._messageId });
},
receiveMessage: function receiveMessage(aMessage) {
if (aMessage.json.messageId != this._messageId)
return;
@ -1681,6 +1738,17 @@ const ContentTouchHandler = {
document.dispatchEvent(event);
}
break;
case "Browser:CaptureEvents":
this.contentCanCaptureMouse = true;
if (this.touchTimeout) {
clearTimeout(this.touchTimeout);
this.touchTimeout = null;
}
Elements.browsers.customDragger.contentMouseCapture = aMessage.json.panning;
break;
case "Browser:CanCaptureMouse:Return":
ContentTouchHandler.contentCanCaptureMouse = aMessage.json.contentCanCaptureMouse;
break;
}
},
@ -1714,6 +1782,8 @@ const ContentTouchHandler = {
browser.messageManager.sendAsyncMessage(aName, json);
},
touchTimeout: null,
tapDown: function tapDown(aX, aY) {
// Ensure that the content process has gets an activate event
let browser = getBrowser();
@ -1722,6 +1792,20 @@ const ContentTouchHandler = {
try {
fl.activateRemoteFrame();
} catch (e) {}
// if the page might capture touch events, we give it the option
Elements.browsers.customDragger.contentMouseCapture = this.contentCanCaptureMouse;
if (this.touchTimeout) {
clearTimeout(this.touchTimeout);
this.touchTimeout = null;
}
if (this.contentCanCaptureMouse) {
this.touchTimeout = setTimeout(function() {
Elements.browsers.customDragger.contentMouseCapture = false;
}, kTouchTimeout)
}
this._dispatchMouseEvent("Browser:MouseDown", aX, aY);
},
@ -1737,7 +1821,11 @@ const ContentTouchHandler = {
tapSingle: function tapSingle(aX, aY, aModifiers) {
// Cancel the mouse click if we are showing a context menu
if (!ContextHelper.popupState)
this._dispatchMouseEvent("Browser:MouseUp", aX, aY, { modifiers: aModifiers });
this._dispatchMouseEvent("Browser:MouseClick", aX, aY, { modifiers: aModifiers });
},
tapMove: function tapMove(aX, aY) {
this._dispatchMouseEvent("Browser:MouseMove", aX, aY);
},
tapDouble: function tapDouble(aX, aY, aModifiers) {
@ -2720,7 +2808,7 @@ Tab.prototype = {
// If the scale level has not changed we want to be sure the content
// render correctly since the page refresh process could have been
// stalled during page load. In this case if the page has the exact
// same width (like the same page, so by doing 'refresh') and the
// same width (like the same page, so by doing 'refresh') and the
// page was scrolled the content is just checkerboard at this point
// and this call ensure we render it correctly.
browser.getRootView()._updateCacheViewport();
@ -2804,6 +2892,8 @@ Tab.prototype = {
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
fl.activateRemoteFrame();
} catch (e) {}
ContentTouchHandler.updateContentCapture();
} else {
browser.messageManager.sendAsyncMessage("Browser:Blur", { });
browser.setAttribute("type", "content");

Some files were not shown because too many files have changed in this diff Show More