Merge mozilla-central into tracemonkey.

This commit is contained in:
Chris Leary 2011-01-12 00:07:40 -08:00
commit 887da71fad
317 changed files with 6291 additions and 2231 deletions

View File

@ -1737,7 +1737,8 @@ nsAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
if (nsAccUtils::MustPrune(this))
return nsnull;
return GetChildAt(aVarChild.lVal);
// Gecko child indices are 0-based in contrast to indices used in MSAA.
return GetChildAt(aVarChild.lVal - 1);
}
void nsAccessibleWrap::UpdateSystemCaret()

View File

@ -14,60 +14,8 @@
src="../common.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function designModeOn()
{
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
this.invoke = function designModeOn_invoke()
{
document.designMode = "on";
}
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, 0, EXT_STATE_EDITABLE);
testStates("p", 0, EXT_STATE_EDITABLE);
testStates("document", 0, EXT_STATE_EDITABLE);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
}
this.getID = function designModeOn_getID()
{
return "design mode on";
}
}
function designModeOff()
{
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
this.invoke = function designModeOn_invoke()
{
document.designMode = "off";
}
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, STATE_READONLY);
testStates("document", STATE_READONLY);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
}
this.getID = function designModeOn_getID()
{
return "design mode off";
}
}
var gQueue = null;
function doTest()
{
// Bug 566542: root accesible should expose active state when focused.
@ -88,11 +36,20 @@
testStates("document", STATE_READONLY);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
// Design mode on/off trigger document accessible subtree recreation.
gQueue = new eventQueue();
gQueue.push(new designModeOn());
gQueue.push(new designModeOff());
gQueue.invoke(); // Will call SimpleTest.finish();
document.designMode = "on";
testStates(document, 0, EXT_STATE_EDITABLE);
testStates("p", 0, EXT_STATE_EDITABLE);
testStates("document", 0, EXT_STATE_EDITABLE);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
document.designMode = "off";
testStates(document, STATE_READONLY);
testStates("document", STATE_READONLY);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();

View File

@ -14,77 +14,35 @@
src="../common.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function designModeOn()
function doTest()
{
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
var docAcc = getAccessible(document, [nsIAccessibleDocument]);
if (docAcc) {
testStates(docAcc, STATE_READONLY);
testStates("aria_article", STATE_READONLY);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", STATE_READONLY);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
this.invoke = function designModeOn_invoke()
{
document.designMode = "on";
}
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, 0, EXT_STATE_EDITABLE);
testStates(docAcc, 0, EXT_STATE_EDITABLE);
testStates("aria_article", 0, EXT_STATE_EDITABLE);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", 0, EXT_STATE_EDITABLE);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
}
this.getID = function designModeOn_getID()
{
return "design mode on";
}
}
function designModeOff()
{
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
this.invoke = function designModeOn_invoke()
{
document.designMode = "off";
}
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, STATE_READONLY);
testStates(docAcc, STATE_READONLY);
testStates("aria_article", STATE_READONLY);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", STATE_READONLY);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
}
this.getID = function designModeOn_getID()
{
return "design mode off";
}
}
var gQueue = null;
function doTest()
{
testStates(document, STATE_READONLY);
testStates("aria_article", STATE_READONLY);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", STATE_READONLY);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
// Design mode on/off trigger document accessible subtree recreation.
gQueue = new eventQueue();
gQueue.push(new designModeOn());
gQueue.push(new designModeOff());
gQueue.invoke(); // Will call SimpleTest.finish();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();

View File

@ -381,6 +381,7 @@ pref("browser.tabs.loadDivertedInBackground", false);
pref("browser.tabs.loadBookmarksInBackground", false);
pref("browser.tabs.tabClipWidth", 140);
pref("browser.tabs.animate", true);
pref("browser.tabs.drawInTitlebar", true);
// Where to show tab close buttons:
// 0 on active tab only
@ -477,8 +478,8 @@ pref("network.proxy.share_proxy_settings", false); // use the same proxy settin
// simple gestures support
pref("browser.gesture.swipe.left", "Browser:BackOrBackDuplicate");
pref("browser.gesture.swipe.right", "Browser:ForwardOrForwardDuplicate");
pref("browser.gesture.swipe.up", "Browser:HideTabView");
pref("browser.gesture.swipe.down", "Browser:ShowTabView");
pref("browser.gesture.swipe.up", "cmd_scrollTop");
pref("browser.gesture.swipe.down", "cmd_scrollBottom");
#ifdef XP_MACOSX
pref("browser.gesture.pinch.latched", true);
pref("browser.gesture.pinch.threshold", 150);
@ -486,10 +487,10 @@ pref("browser.gesture.pinch.threshold", 150);
pref("browser.gesture.pinch.latched", false);
pref("browser.gesture.pinch.threshold", 25);
#endif
pref("browser.gesture.pinch.out", "cmd_fullZoomEnlarge");
pref("browser.gesture.pinch.in", "cmd_fullZoomReduce");
pref("browser.gesture.pinch.out.shift", "cmd_fullZoomReset");
pref("browser.gesture.pinch.in.shift", "cmd_fullZoomReset");
pref("browser.gesture.pinch.out", "");
pref("browser.gesture.pinch.in", "");
pref("browser.gesture.pinch.out.shift", "");
pref("browser.gesture.pinch.in.shift", "");
pref("browser.gesture.twist.latched", false);
pref("browser.gesture.twist.threshold", 25);
pref("browser.gesture.twist.right", "");

View File

@ -87,13 +87,34 @@ toolbar[printpreview="true"] {
}
%ifdef CAN_DRAW_IN_TITLEBAR
#main-window[inFullscreen] > #titlebar {
#main-window[inFullscreen] > #titlebar,
#main-window[inFullscreen] .titlebar-placeholder,
#main-window:not([tabsintitlebar]) .titlebar-placeholder {
display: none;
}
#titlebar {
-moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
}
#main-window[tabsintitlebar] #TabsToolbar {
-moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-drag");
}
#titlebar-spacer,
#main-window[tabsintitlebar]:not([inFullscreen]) .tabbrowser-arrowscrollbox > scrollbox > .scrollbox-innerbox {
pointer-events: none;
}
.tabbrowser-tab,
.tabs-newtab-button {
pointer-events: auto;
}
#main-window[tabsintitlebar] #appmenu-button-container,
#main-window[tabsintitlebar] #titlebar-buttonbox {
position: relative;
}
%endif
toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {

View File

@ -719,6 +719,12 @@ const gXPInstallObserver = {
options.installs = installInfo.installs;
options.contentWindow = browser.contentWindow;
options.sourceURI = browser.currentURI;
options.eventCallback = function(aNotification, aEvent) {
if (aEvent != "removed")
return;
aNotification.options.contentWindow = null;
aNotification.options.sourceURI = null;
};
PopupNotifications.show(browser, notificationID, messageString, anchorID,
null, null, options);
break;
@ -1280,7 +1286,8 @@ function BrowserStartup() {
BookmarksMenuButton.init();
// initialize the private browsing UI
TabsInTitlebar.init();
gPrivateBrowsingUI.init();
setTimeout(delayedStartup, 0, isLoadingBlank, mustLoadSidebar);
@ -1671,6 +1678,7 @@ function BrowserShutdown()
gPrivateBrowsingUI.uninit();
IndexedDBPromptHelper.uninit();
AddonManager.removeAddonListener(AddonsMgrListener);
TabsInTitlebar.uninit();
var enumerator = Services.wm.getEnumerator(null);
enumerator.getNext();
@ -1843,7 +1851,7 @@ function gotoHistoryIndex(aEvent) {
}
// Modified click. Go there in a new tab/window.
duplicateTabIn(gBrowser.selectedTab, where, index);
duplicateTabIn(gBrowser.selectedTab, where, index - gBrowser.sessionHistory.index);
return true;
}
@ -1858,8 +1866,7 @@ function BrowserForward(aEvent) {
}
}
else {
let currentIndex = getWebNavigation().sessionHistory.index;
duplicateTabIn(gBrowser.selectedTab, where, currentIndex + 1);
duplicateTabIn(gBrowser.selectedTab, where, 1);
}
}
@ -1874,8 +1881,7 @@ function BrowserBack(aEvent) {
}
}
else {
let currentIndex = getWebNavigation().sessionHistory.index;
duplicateTabIn(gBrowser.selectedTab, where, currentIndex - 1);
duplicateTabIn(gBrowser.selectedTab, where, -1);
}
}
@ -2741,10 +2747,6 @@ var PrintPreviewListener = {
this._printPreviewTab = null;
},
_toggleAffectedChrome: function () {
#ifdef MENUBAR_CAN_AUTOHIDE
updateAppButtonDisplay();
#endif
gNavToolbox.hidden = gInPrintPreviewMode;
if (gInPrintPreviewMode)
@ -2754,6 +2756,10 @@ var PrintPreviewListener = {
if (this._chromeState.sidebarOpen)
toggleSidebar(this._sidebarCommand);
#ifdef MENUBAR_CAN_AUTOHIDE
updateAppButtonDisplay();
#endif
},
_hideChrome: function () {
this._chromeState = {};
@ -3453,6 +3459,8 @@ function BrowserCustomizeToolbar()
PlacesToolbarHelper.customizeStart();
BookmarksMenuButton.customizeStart();
TabsInTitlebar.allowedBy("customizing-toolbars", false);
var customizeURL = "chrome://global/content/customizeToolbar.xul";
gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
@ -3523,6 +3531,8 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
PlacesStarButton.updateState();
}
TabsInTitlebar.allowedBy("customizing-toolbars", true);
// Re-enable parts of the UI we disabled during the dialog
var menubar = document.getElementById("main-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
@ -3909,6 +3919,25 @@ var FullScreen = {
document.documentElement.setAttribute("inFullscreen", true);
}
// In tabs-on-top mode, move window controls to the tab bar,
// and in tabs-on-bottom mode, move them back to the navigation toolbar.
// When there is a chance the tab bar may be collapsed, put window
// controls on nav bar.
var fullscreenflex = document.getElementById("fullscreenflex");
var fullscreenctls = document.getElementById("window-controls");
var ctlsOnTabbar = TabsOnTop.enabled &&
!gPrefService.getBoolPref("browser.tabs.autoHide");
if (fullscreenctls.parentNode.id == "nav-bar" && ctlsOnTabbar) {
document.getElementById("TabsToolbar").appendChild(fullscreenctls);
// we don't need this space in tabs-on-top mode, so prevent it from
// being shown
fullscreenflex.removeAttribute("fullscreencontrol");
}
else if (fullscreenctls.parentNode.id == "TabsToolbar" && !ctlsOnTabbar) {
document.getElementById("nav-bar").appendChild(fullscreenctls);
fullscreenflex.setAttribute("fullscreencontrol", "true");
}
var controls = document.getElementsByAttribute("fullscreencontrol", "true");
for (var i = 0; i < controls.length; ++i)
controls[i].hidden = aShow;
@ -4755,6 +4784,7 @@ var TabsOnTop = {
document.documentElement.setAttribute("tabsontop", enabled);
document.getElementById("TabsToolbar").setAttribute("tabsontop", enabled);
gBrowser.tabContainer.setAttribute("tabsontop", enabled);
TabsInTitlebar.allowedBy("tabs-on-top", enabled);
},
get enabled () {
return gNavToolbox.getAttribute("tabsontop") == "true";
@ -4767,6 +4797,115 @@ var TabsOnTop = {
}
}
var TabsInTitlebar = {
init: function () {
#ifdef CAN_DRAW_IN_TITLEBAR
this._readPref();
Services.prefs.addObserver(this._prefName, this, false);
// Don't trust the initial value of the sizemode attribute; wait for the resize event.
this.allowedBy("sizemode", false);
window.addEventListener("resize", function (event) {
if (event.target != window)
return;
let sizemode = document.documentElement.getAttribute("sizemode");
TabsInTitlebar.allowedBy("sizemode",
sizemode == "maximized" || sizemode == "fullscreen");
}, false);
this._initialized = true;
#endif
},
allowedBy: function (condition, allow) {
#ifdef CAN_DRAW_IN_TITLEBAR
if (allow) {
if (condition in this._disallowed) {
delete this._disallowed[condition];
this._update();
}
} else {
if (!(condition in this._disallowed)) {
this._disallowed[condition] = null;
this._update();
}
}
#endif
},
#ifdef CAN_DRAW_IN_TITLEBAR
observe: function (subject, topic, data) {
if (topic == "nsPref:changed")
this._readPref();
},
_initialized: false,
_disallowed: {},
_prefName: "browser.tabs.drawInTitlebar",
_readPref: function () {
this.allowedBy("pref",
Services.prefs.getBoolPref(this._prefName));
},
_update: function () {
if (!this._initialized)
return;
let allowed = true;
for (let something in this._disallowed) {
allowed = false;
break;
}
let docElement = document.documentElement;
if (allowed == (docElement.getAttribute("tabsintitlebar") == "true"))
return;
function $(id) document.getElementById(id);
let titlebar = $("titlebar");
if (allowed) {
let availTop = screen.availTop;
function top(ele) ele.boxObject.screenY - availTop;
function bottom(ele) top(ele) + rect(ele).height;
function rect(ele) ele.getBoundingClientRect();
let tabsToolbar = $("TabsToolbar");
let appmenuButtonBox = $("appmenu-button-container");
let captionButtonsBox = $("titlebar-buttonbox");
this._sizePlaceholder("appmenu-button", rect(appmenuButtonBox).width);
this._sizePlaceholder("caption-buttons", rect(captionButtonsBox).width);
let maxMargin = top(gNavToolbox);
let tabsBottom = maxMargin + rect(tabsToolbar).height;
let titlebarBottom = Math.max(bottom(appmenuButtonBox), bottom(captionButtonsBox));
let distance = tabsBottom - titlebarBottom;
titlebar.style.marginBottom = - Math.min(distance, maxMargin) + "px";
docElement.setAttribute("tabsintitlebar", "true");
} else {
docElement.removeAttribute("tabsintitlebar");
titlebar.style.marginBottom = "";
}
},
_sizePlaceholder: function (type, width) {
Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='"+ type +"']"),
function (node) { node.width = width; });
},
#endif
uninit: function () {
#ifdef CAN_DRAW_IN_TITLEBAR
this._initialized = false;
Services.prefs.removeObserver(this._prefName, this);
#endif
}
};
#ifdef MENUBAR_CAN_AUTOHIDE
function updateAppButtonDisplay() {
var displayAppButton =
@ -4781,6 +4920,8 @@ function updateAppButtonDisplay() {
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
else
document.documentElement.removeAttribute("chromemargin");
TabsInTitlebar.allowedBy("drawing-in-titlebar", displayAppButton);
#else
document.getElementById("appmenu-toolbar-button").hidden =
!displayAppButton;
@ -8130,25 +8271,12 @@ function safeModeRestart()
* tabs, and vice versa
* "window" new window
*
* historyIndex is an index the page can navigate to after the new tab is
* created and loaded, it can for example be used to go back one page after the
* tab is duplicated.
* delta is the offset to the history entry that you want to load.
*/
function duplicateTabIn(aTab, where, historyIndex) {
let newTab = gBrowser.duplicateTab(aTab);
// Go to index if it's provided, fallback to loadURI if there's no history.
if (historyIndex != null) {
try {
gBrowser.getBrowserForTab(newTab).gotoIndex(historyIndex);
}
catch (ex) {
let sessionHistory = aTab.linkedBrowser.sessionHistory;
let entry = sessionHistory.getEntryAtIndex(historyIndex, false);
let fallbackUrl = entry.URI.spec;
gBrowser.getBrowserForTab(newTab).loadURI(fallbackUrl);
}
}
function duplicateTabIn(aTab, where, delta) {
let newTab = Cc['@mozilla.org/browser/sessionstore;1']
.getService(Ci.nsISessionStore)
.duplicateTab(window, aTab, delta);
var loadInBackground =
getBoolPref("browser.tabs.loadBookmarksInBackground", false);

View File

@ -373,7 +373,7 @@
class="identity-popup-description"/>
</hbox>
<!-- Footer button to open security page info -->
<hbox pack="end">
<hbox id="identity-popup-button-container" pack="end">
<button id="identity-popup-more-info-button"
label="&identity.moreInfoLinkText;"
onblur="gIdentityHandler.hideIdentityPopup();"
@ -485,6 +485,11 @@
# hiddenWindow.xul.
#include browser-menubar.inc
</toolbaritem>
#ifdef CAN_DRAW_IN_TITLEBAR
<hbox class="titlebar-placeholder" type="appmenu-button" ordinal="0"/>
<hbox class="titlebar-placeholder" type="caption-buttons" ordinal="1000"/>
#endif
</toolbar>
<toolbar id="nav-bar" class="toolbar-primary chromeclass-toolbar"
@ -850,6 +855,10 @@
label="&closeTab.label;"
tooltiptext="&closeTab.label;"/>
#ifdef CAN_DRAW_IN_TITLEBAR
<hbox class="titlebar-placeholder" type="appmenu-button" ordinal="0"/>
<hbox class="titlebar-placeholder" type="caption-buttons" ordinal="1000"/>
#endif
</toolbar>
<toolbarpalette id="BrowserToolbarPalette">

View File

@ -11,7 +11,7 @@
display: none;
}
.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons="closeatend"]) > * > * > * .tab-close-button:not([pinned])[selected="true"],
.tabbrowser-tabs[closebuttons="activetab"] > * > * > * > .tab-close-button:not([pinned])[selected="true"],
.tabbrowser-tabs[closebuttons="alltabs"] > * > * > * > .tab-close-button:not([pinned]) {
display: -moz-box;
}

View File

@ -1212,6 +1212,8 @@
}
this.tabContainer.appendChild(t);
if (this.tabContainer.getAttribute("pinnedonly") == "true")
this.tabContainer._positionPinnedTabs();
if (this.tabContainer.mTabstrip._isRTLScrollbox) {
/* In RTL UI, the tab is visually added to the left side of the
@ -1461,7 +1463,7 @@
NS_ASSERT(false, "Giving up waiting for the tab closing animation to finish (bug 608589)");
tabbrowser._endRemoveTab(tab);
}
}, 2000, aTab, this);
}, 3000, aTab, this);
]]>
</body>
</method>
@ -2636,6 +2638,9 @@
Services.prefs.addObserver("browser.tabs.", this._prefObserver, false);
window.addEventListener("resize", this, false);
if (window.TabsInTitlebar)
TabsInTitlebar.allowedBy("tabs-visible", this.visible);
]]>
</constructor>
@ -2698,6 +2703,9 @@
<property name="visible"
onget="return !this._container.collapsed;">
<setter><![CDATA[
if (val == this.visible)
return val;
this._container.collapsed = !val;
if (val)
@ -2707,6 +2715,9 @@
document.getElementById("menu_close").setAttribute("label",
this.tabbrowser.mStringBundle.getString(val ? "tabs.closeTab" : "tabs.close"));
if (window.TabsInTitlebar)
TabsInTitlebar.allowedBy("tabs-visible", val);
return val;
]]></setter>
</property>
@ -2724,21 +2735,21 @@
<method name="adjustTabstrip">
<body><![CDATA[
// modes for tabstrip
// 0 - activetab = close button on active tab only
// 1 - alltabs = close buttons on all tabs
// 2 - noclose = no close buttons at all
// 3 - closeatend = close button at the end of the tabstrip
// 0 - button on active tab only
// 1 - close buttons on all tabs
// 2 - no close buttons at all
// 3 - close button at the end of the tabstrip
switch (this.mCloseButtons) {
case 0:
if (this.childNodes.length == 1 && this._closeWindowWithLastTab)
this.setAttribute("closebuttons", "noclose");
this.setAttribute("closebuttons", "hidden");
else
this.setAttribute("closebuttons", "activetab");
break;
case 1:
if (this.childNodes.length == 1) {
if (this._closeWindowWithLastTab)
this.setAttribute("closebuttons", "noclose");
this.setAttribute("closebuttons", "hidden");
else
this.setAttribute("closebuttons", "alltabs");
} else {
@ -2751,7 +2762,7 @@
break;
case 2:
case 3:
this.setAttribute("closebuttons", "noclose");
this.setAttribute("closebuttons", "never");
break;
}
var tabstripClosebutton = document.getElementById("tabs-closebutton");
@ -2783,19 +2794,20 @@
<method name="_positionPinnedTabs">
<body><![CDATA[
var width = 0;
var pinnedOnly = (this.tabbrowser._numPinnedTabs == this.tabbrowser.visibleTabs.length);
var numPinned = this.tabbrowser._numPinnedTabs;
var pinnedOnly = (numPinned == this.tabbrowser.visibleTabs.length);
if (pinnedOnly)
this.tabbrowser.tabContainer.setAttribute("pinnedonly", "true");
this.setAttribute("pinnedonly", "true");
else
this.tabbrowser.tabContainer.removeAttribute("pinnedonly");
this.removeAttribute("pinnedonly");
var scrollButtonWidth = (this.getAttribute("overflow") != "true" || pinnedOnly) ? 0 :
this.mTabstrip._scrollButtonDown.scrollWidth;
var paddingStart = this.mTabstrip.scrollboxPaddingStart;
var width = 0;
for (var i = this.tabbrowser._numPinnedTabs - 1; i >= 0; i--) {
for (var i = numPinned - 1; i >= 0; i--) {
let tab = this.childNodes[i];
width += pinnedOnly ? 0 : tab.scrollWidth;
if (this.getAttribute("overflow") != "true")

View File

@ -223,6 +223,7 @@ html[dir=rtl] #search {
position: absolute;
right: 20px;
top: 20px;
pointer-events: auto;
}
html[dir=rtl] #searchbox {
@ -265,6 +266,7 @@ html[dir=rtl] #actions #searchbutton {
.inlineMatch{
display: inline-block;
pointer-events: auto;
}
.inlineMatch>span{

View File

@ -418,6 +418,7 @@ let UI = {
gTabViewFrame.style.marginTop = "";
#endif
gTabViewDeck.selectedIndex = 1;
gWindow.TabsInTitlebar.allowedBy("tabview-open", false);
gTabViewFrame.contentWindow.focus();
gBrowser.updateTitlebar();
@ -484,6 +485,7 @@ let UI = {
gTabViewFrame.style.marginTop = gBrowser.boxObject.y + "px";
#endif
gTabViewDeck.selectedIndex = 0;
gWindow.TabsInTitlebar.allowedBy("tabview-open", true);
gBrowser.contentWindow.focus();
gBrowser.updateTitlebar();
@ -1096,9 +1098,9 @@ let UI = {
iQ(window).unbind("mousemove", updateSize);
item.container.removeClass("dragRegion");
dragOutInfo.stop();
if (phantom.css("opacity") != 1)
collapse();
else {
box = item.getBounds();
if (box.width > minMinSize && box.height > minMinSize &&
(box.width > minSize || box.height > minSize)) {
var bounds = item.getBounds();
// Add all of the orphaned tabs that are contained inside the new groupItem
@ -1114,6 +1116,8 @@ let UI = {
GroupItems.setActiveGroupItem(groupItem);
phantom.remove();
dragOutInfo = null;
} else {
collapse();
}
}

View File

@ -146,6 +146,7 @@ _BROWSER_FILES = \
browser_bug562649.js \
browser_bug563588.js \
browser_bug565575.js \
browser_zbug569342.js \
browser_bug575561.js \
browser_bug577121.js \
browser_bug579872.js \
@ -165,6 +166,7 @@ _BROWSER_FILES = \
browser_bug599325.js \
browser_bug609700.js \
browser_bug616836.js \
browser_bug623893.js \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \
browser_disablechrome.js \

View File

@ -114,6 +114,7 @@ function test_blocked_install() {
EventUtils.synthesizeMouse(notification.button, 20, 10, {});
// Notification should have changed to progress notification
ok(PopupNotifications.isPanelOpen, "Notification should still be open");
notification = aPanel.childNodes[0];
is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
@ -681,6 +682,18 @@ function test_cancel_restart() {
wait_for_notification(function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
// Close the notification
let anchor = document.getElementById("addons-notification-icon");
EventUtils.synthesizeMouseAtCenter(anchor, {});
// Reopen the notification
EventUtils.synthesizeMouseAtCenter(anchor, {});
ok(PopupNotifications.isPanelOpen, "Notification should still be open");
is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
isnot(notification, aPanel.childNodes[0], "Should have reconstructed the notification UI");
notification = aPanel.childNodes[0];
is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
let button = document.getAnonymousElementByAttribute(notification, "anonid", "cancel");
// Cancel the download
@ -696,6 +709,8 @@ function test_cancel_restart() {
EventUtils.synthesizeMouse(notification.button, 20, 10, {});
// Should be back to a progress notification
ok(PopupNotifications.isPanelOpen, "Notification should still be open");
is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
notification = aPanel.childNodes[0];
is(notification.id, "addon-progress-notification", "Should have seen the progress notification");

View File

@ -0,0 +1,46 @@
function test() {
waitForExplicitFinish();
loadAndWait("data:text/plain,1", function () {
loadAndWait("data:text/plain,2", function () {
loadAndWait("data:text/plain,3", runTests);
});
});
}
function runTests() {
duplicate(0, "maintained the original index", function () {
gBrowser.removeCurrentTab();
duplicate(-1, "went back", function () {
duplicate(1, "went forward", function () {
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
gBrowser.addTab();
gBrowser.removeCurrentTab();
finish();
});
});
});
}
function duplicate(delta, msg, cb) {
var start = gBrowser.sessionHistory.index;
duplicateTabIn(gBrowser.selectedTab, "tab", delta);
gBrowser.selectedBrowser.addEventListener("pageshow", function () {
gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
is(gBrowser.sessionHistory.index, start + delta, msg);
executeSoon(cb);
}, false);
}
function loadAndWait(url, cb) {
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
executeSoon(cb);
}, true);
gBrowser.loadURI(url);
}

View File

@ -137,6 +137,54 @@ var gTestSteps = [
}, true);
tab.linkedBrowser.loadURI('about:robots');
},
function() {
info("Running step 9 - enter private browsing mode, without keeping session");
let ps = Services.prefs;
ps.setBoolPref("browser.privatebrowsing.keep_current_session", false);
ps.setBoolPref("browser.tabs.warnOnClose", false);
Services.obs.addObserver(function(aSubject, aTopic, aData) {
Services.obs.removeObserver(arguments.callee, "private-browsing-transition-complete");
for (let i = 0; i < gBrowser.tabs.length; i++)
waitForRestoredTab(gBrowser.tabs[i]);
}, "private-browsing-transition-complete", false);
gPrivateBrowsing.privateBrowsingEnabled = true;
},
function() {
info("Running step 10 - open tabs in private browsing mode");
for (let i = 0; i < 3; i++) {
let tab = gBrowser.addTab();
loadTab(tab, TEST_URL_BASES[0] + (++gTabCounter));
}
},
function() {
info("Running step 11 - close tabs in private browsing mode");
gBrowser.removeCurrentTab();
ensure_opentabs_match_db(nextStep);
},
function() {
info("Running step 12 - leave private browsing mode");
Services.obs.addObserver(function(aSubject, aTopic, aData) {
Services.obs.removeObserver(arguments.callee, "private-browsing-transition-complete");
let ps = Services.prefs;
try {
ps.clearUserPref("browser.privatebrowsing.keep_current_session");
} catch (ex) {}
try {
ps.clearUserPref("browser.tabs.warnOnClose");
} catch (ex) {}
for (let i = 1; i < gBrowser.tabs.length; i++)
waitForRestoredTab(gBrowser.tabs[i]);
}, "private-browsing-transition-complete", false);
gPrivateBrowsing.privateBrowsingEnabled = false;
}
];
@ -148,7 +196,7 @@ function test() {
function loadTab(tab, url) {
// Because adding visits is async, we will not be notified immediately.
let visited = false;
let visited = gPrivateBrowsing.privateBrowsingEnabled;
let loaded = false;
function maybeCheckResults() {
@ -163,22 +211,37 @@ function loadTab(tab, url) {
maybeCheckResults();
}, true);
Services.obs.addObserver(
function (aSubject, aTopic, aData) {
if (url != aSubject.QueryInterface(Ci.nsIURI).spec)
return;
Services.obs.removeObserver(arguments.callee, aTopic);
visited = true;
maybeCheckResults();
},
"uri-visit-saved",
false
);
if (!visited) {
Services.obs.addObserver(
function (aSubject, aTopic, aData) {
if (url != aSubject.QueryInterface(Ci.nsIURI).spec)
return;
Services.obs.removeObserver(arguments.callee, aTopic);
visited = true;
maybeCheckResults();
},
"uri-visit-saved",
false
);
}
gTabWaitCount++;
info("Loading page: " + url);
tab.linkedBrowser.loadURI(url);
}
function waitForRestoredTab(tab) {
gTabWaitCount++;
tab.linkedBrowser.addEventListener("load", function () {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
if (--gTabWaitCount == 0) {
ensure_opentabs_match_db(nextStep);
}
}, true);
}
function nextStep() {
if (gTestSteps.length == 0) {
while (gBrowser.tabs.length > 1) {

View File

@ -123,6 +123,22 @@ function test() {
browser1.contentWindow, null, true,
"focusedWindow after tab switch from no focus to no focus");
gURLBar.focus();
_browser_tabfocus_test_events = "";
_browser_tabfocus_test_lastfocus = gURLBar;
_browser_tabfocus_test_lastfocuswindow = window;
expectFocusShift(function () EventUtils.synthesizeKey("VK_F6", { }),
browser1.contentWindow, browser1.contentDocument.documentElement,
true, "switch document forward with f6");
EventUtils.synthesizeKey("VK_F6", { });
is(fm.focusedWindow, window, "switch document forward again with f6");
browser1.style.MozUserFocus = "ignore";
browser1.clientWidth;
EventUtils.synthesizeKey("VK_F6", { });
is(fm.focusedWindow, window, "switch document forward again with f6 when browser non-focusable");
window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
@ -207,7 +223,7 @@ function expectFocusShift(callback, expectedWindow, expectedElement, focusChange
"focus: " + windowid + "-window";
}
if (expectedElement) {
if (expectedElement && expectedElement != expectedElement.ownerDocument.documentElement) {
if (expectedEvents)
expectedEvents += " ";
expectedEvents += "focus: " + getId(expectedElement);

View File

@ -0,0 +1,48 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var gTab = null;
function cleanUp() {
gBrowser.removeTab(gTab);
finish();
}
// function borrowed from browser_bug386835.js
function load(tab, url, cb) {
tab.linkedBrowser.addEventListener("load", function (event) {
event.currentTarget.removeEventListener("load", arguments.callee, true);
cb();
}, true);
tab.linkedBrowser.loadURI(url);
}
function test() {
waitForExplicitFinish();
gTab = gBrowser.selectedTab = gBrowser.addTab();
ok(gFindBar.hidden, "Find bar should not be visible");
run_test_1();
}
function run_test_1() {
load(gTab, "about:config", function() {
ok(gFindBar.hidden, "Find bar should not be visible");
EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
ok(gFindBar.hidden, "Find bar should not be visible");
run_test_2();
});
}
function run_test_2() {
load(gTab, "about:addons", function() {
ok(gFindBar.hidden, "Find bar should not be visible");
EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
ok(gFindBar.hidden, "Find bar should not be visible");
cleanUp();
});
}

View File

@ -72,6 +72,8 @@ _BROWSER_FILES = \
browser_tabview_bug606905.js \
browser_tabview_bug608037.js \
browser_tabview_bug608158.js \
browser_tabview_bug618828.js \
browser_tabview_bug619937.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \
browser_tabview_group.js \

View File

@ -100,22 +100,30 @@ function setupTwo() {
restoredWin.removeEventListener(
"tabviewframeinitialized", onTabViewFrameInitialized, false);
/*
// bug 615954 happens too often so we disable this until we have a fix
let restoredContentWindow =
restoredWin.document.getElementById("tab-view").contentWindow;
// prevent TabItems._update being called before checking cached images
restoredContentWindow.TabItems._pauseUpdateForTest = true;
*/
restoredWin.close();
finish();
}
restoredWin.addEventListener(
"tabviewframeinitialized", onTabViewFrameInitialized, false);
restoredWin.addEventListener("tabviewshown", onTabViewShown, false);
is(restoredWin.gBrowser.tabs.length, 2, "The total number of tabs is 2");
/*
// bug 615954 happens too often so we disable this until we have a fix
restoredWin.addEventListener("tabviewshown", onTabViewShown, false);
// setup tab variables and listen to the load progress.
newTabOne = restoredWin.gBrowser.tabs[0];
newTabTwo = restoredWin.gBrowser.tabs[1];
restoredWin.gBrowser.addTabsProgressListener(gTabsProgressListener);
*/
}, false);
});
};

View File

@ -0,0 +1,128 @@
/* ***** 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 a test for bug 618828.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tim Taubert <tim.taubert@gmx.de>
*
* 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 ***** */
function test() {
waitForExplicitFinish();
ok(!TabView.isVisible(), 'TabView is hidden');
let tab = gBrowser.loadOneTab('about:blank#other', {inBackground: true});
TabView._initFrame(function () {
newWindowWithTabView(function (win) {
onTabViewWindowLoaded(win, tab);
});
});
}
function onTabViewWindowLoaded(win, tab) {
let contentWindow = win.TabView.getContentWindow();
let search = contentWindow.document.getElementById('search');
let searchbox = contentWindow.document.getElementById('searchbox');
let searchButton = contentWindow.document.getElementById('searchbutton');
let results = contentWindow.document.getElementById('results');
let isSearchEnabled = function () {
return 'none' != search.style.display;
}
let assertSearchIsEnabled = function () {
ok(isSearchEnabled(), 'search is enabled');
}
let assertSearchIsDisabled = function () {
ok(!isSearchEnabled(), 'search is disabled');
}
let enableSearch = function () {
assertSearchIsDisabled();
EventUtils.sendMouseEvent({type: 'mousedown'}, searchButton, contentWindow);
}
let finishTest = function () {
win.close();
gBrowser.removeTab(tab);
finish();
}
let testClickOnSearchBox = function () {
EventUtils.synthesizeMouseAtCenter(searchbox, {}, contentWindow);
assertSearchIsEnabled();
}
let testClickOnOtherSearchResult = function () {
// search for the tab from our main window
searchbox.setAttribute('value', 'other');
contentWindow.performSearch();
// prepare to finish when the main window gets focus back
window.addEventListener('focus', function () {
window.removeEventListener('focus', arguments.callee, true);
assertSearchIsDisabled();
// check that the right tab is active
is(gBrowser.selectedTab, tab, 'search result is the active tab');
finishTest();
}, true);
// click the first result
ok(results.firstChild, 'search returns one result');
EventUtils.synthesizeMouseAtCenter(results.firstChild, {}, contentWindow);
}
enableSearch();
assertSearchIsEnabled();
testClickOnSearchBox();
testClickOnOtherSearchResult();
}
// ---------
function newWindowWithTabView(callback) {
let win = window.openDialog(getBrowserURL(), "_blank",
"chrome,all,dialog=no,height=800,width=800");
let onLoad = function() {
win.removeEventListener("load", onLoad, false);
let onShown = function() {
win.removeEventListener("tabviewshown", onShown, false);
callback(win);
};
win.addEventListener("tabviewshown", onShown, false);
win.TabView.toggle();
}
win.addEventListener("load", onLoad, false);
}

View File

@ -0,0 +1,73 @@
/* ***** 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 Panorama bug 619937 (clicking the background) test.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Michael Yoshitaka Erlewine <mitcho@mitcho.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 ***** */
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
TabView.toggle();
}
function endGame() {
window.removeEventListener("tabviewhidden", endGame, false);
ok(!TabView.isVisible(), "Tab View is hidden");
finish();
};
function onTabViewWindowLoaded() {
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
ok(TabView.isVisible(), "Tab View is visible");
let contentWindow = document.getElementById("tab-view").contentWindow;
// establish initial state
is(contentWindow.GroupItems.groupItems.length, 1,
"we start with one group (the default)");
is(gBrowser.tabs.length, 1, "we start with one tab");
let originalTab = gBrowser.tabs[0];
let bg = contentWindow.document.getElementById("bg");
EventUtils.sendMouseEvent({ type: "click" }, bg, contentWindow);
is(contentWindow.GroupItems.groupItems.length, 1,
"we should still only have one group");
window.addEventListener("tabviewhidden", endGame, false);
TabView.toggle();
}

View File

@ -1075,31 +1075,6 @@
</implementation>
</binding>
<binding id="splitmenu">
<content>
<xul:menuitem anonid="item" flex="1"
class="menuitem-tooltip split-menuitem-item"
xbl:inherits="label,key"/>
<xul:menu anonid="menu" class="split-menuitem-menu"
oncommand="event.stopPropagation();">
<children includes="menupopup"/>
</xul:menu>
</content>
<implementation>
<constructor><![CDATA[
if (this.getAttribute("iconic") == "true") {
this.item.classList.remove("menuitem-tooltip");
this.item.classList.add("menuitem-iconic-tooltip");
this.item.classList.add("menuitem-iconic");
}
]]></constructor>
<field name="item" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "item");
</field>
</implementation>
</binding>
<binding id="addon-progress-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
<content align="start">
<xul:image class="popup-notification-icon"
@ -1165,9 +1140,6 @@
<method name="destroy">
<body><![CDATA[
this.notification.options.browser = null;
this.notification.options.contentWindow = null;
this.notification.options.sourceURI = null;
this.notification.options.installs.forEach(function(aInstall) {
aInstall.removeListener(this);
}, this);
@ -1218,7 +1190,7 @@
<method name="cancel">
<body><![CDATA[
// Cache these as cancelling the installs will remove this
// notification and call destroy
// notification which will drop these references
let browser = this.notification.browser;
let contentWindow = this.notification.options.contentWindow;
let sourceURI = this.notification.options.sourceURI;
@ -1312,6 +1284,31 @@
</implementation>
</binding>
<binding id="splitmenu">
<content>
<xul:menuitem anonid="item" flex="1"
class="menuitem-tooltip split-menuitem-item"
xbl:inherits="label,key"/>
<xul:menu anonid="menu" class="split-menuitem-menu"
oncommand="event.stopPropagation();">
<children includes="menupopup"/>
</xul:menu>
</content>
<implementation>
<constructor><![CDATA[
if (this.getAttribute("iconic") == "true") {
this.item.classList.remove("menuitem-tooltip");
this.item.classList.add("menuitem-iconic-tooltip");
this.item.classList.add("menuitem-iconic");
}
]]></constructor>
<field name="item" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "item");
</field>
</implementation>
</binding>
<binding id="menuitem-tooltip" extends="chrome://global/content/bindings/menu.xml#menuitem">
<implementation>
<constructor><![CDATA[

View File

@ -173,13 +173,13 @@ var gAdvancedPane = {
},
/**
* When the user toggles the layers.accelerate-none pref,
* When the user toggles the layers.acceleration.disabled pref,
* sync its new value to the gfx.direct2d.disabled pref too.
*/
updateHardwareAcceleration: function()
{
#ifdef XP_WIN
var pref = document.getElementById("layers.accelerate-none");
var pref = document.getElementById("layers.acceleration.disabled");
Services.prefs.setBoolPref("gfx.direct2d.disabled", !pref.value);
#endif
},

View File

@ -68,7 +68,7 @@
<preference id="general.autoScroll" name="general.autoScroll" type="bool"/>
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
<preference id="layers.accelerate-none" name="layers.accelerate-none" type="bool" inverted="true"
<preference id="layers.acceleration.disabled" name="layers.acceleration.disabled" type="bool" inverted="true"
onchange="gAdvancedPane.updateHardwareAcceleration()"/>
<preference id="layout.spellcheckDefault" name="layout.spellcheckDefault" type="int"/>
@ -184,7 +184,7 @@
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.accelerate-none"/>
preference="layers.acceleration.disabled"/>
<checkbox id="checkSpelling"
label="&checkSpelling.label;"
accesskey="&checkSpelling.accesskey;"

View File

@ -724,6 +724,21 @@ PrivateBrowsingService.prototype = {
}
}
// Indexed DB
let (idbm = Cc["@mozilla.org/dom/indexeddb/manager;1"].
getService(Ci.nsIIndexedDatabaseManager)) {
// delete data from both HTTP and HTTPS sites
let caUtils = {};
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://global/content/contentAreaUtils.js",
caUtils);
let httpURI = caUtils.makeURI("http://" + aDomain);
let httpsURI = caUtils.makeURI("https://" + aDomain);
idbm.clearDatabasesForURI(httpURI);
idbm.clearDatabasesForURI(httpsURI);
}
// Everybody else (including extensions)
this._obs.notifyObservers(null, "browser:purge-domain-data", aDomain);
}

View File

@ -133,9 +133,11 @@ interface nsISessionStore : nsISupports
*
* @param aWindow is the browser window into which the tab will be duplicated.
* @param aTab is the tabbrowser tab to duplicate (can be from a different window).
* @param aDelta is the offset to the history entry to load in the duplicated tab.
* @returns a reference to the newly created tab.
*/
nsIDOMNode duplicateTab(in nsIDOMWindow aWindow, in nsIDOMNode aTab);
nsIDOMNode duplicateTab(in nsIDOMWindow aWindow, in nsIDOMNode aTab,
[optional] in long aDelta);
/**
* Get the number of restore-able tabs for a browser window

View File

@ -1162,7 +1162,7 @@ SessionStoreService.prototype = {
this.restoreHistoryPrecursor(window, [aTab], [tabState], 0, 0, 0);
},
duplicateTab: function sss_duplicateTab(aWindow, aTab) {
duplicateTab: function sss_duplicateTab(aWindow, aTab, aDelta) {
if (!aTab.ownerDocument || !aTab.ownerDocument.defaultView.__SSi ||
!aWindow.getBrowser)
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
@ -1170,6 +1170,8 @@ SessionStoreService.prototype = {
var tabState = this._collectTabData(aTab, true);
var sourceWindow = aTab.ownerDocument.defaultView;
this._updateTextAndScrollDataForTab(sourceWindow, aTab.linkedBrowser, tabState, true);
tabState.index += aDelta;
tabState.index = Math.max(1, Math.min(tabState.index, tabState.entries.length));
this._sendWindowStateEvent(aWindow, "Busy");
let newTab = aTab == aWindow.gBrowser.selectedTab ?

View File

@ -214,30 +214,31 @@ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
#endif
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
nsCAutoString appKeyValue(mAppPath);
appKeyValue.Append(" \"%s\"");
unsigned int i;
for (i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
appKeyValue);
if (gconf) {
nsCAutoString appKeyValue(mAppPath);
appKeyValue.Append(" \"%s\"");
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
appKeyValue);
}
}
}
// set handler for .html and xhtml files and MIME types:
if (aClaimAllTypes) {
nsresult rv;
nsCOMPtr<nsIGIOService> giovfs =
do_GetService(NS_GIOSERVICE_CONTRACTID);
do_GetService(NS_GIOSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
NS_ENSURE_TRUE(bundleService, NS_ERROR_OUT_OF_MEMORY);
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringBundle> brandBundle;
bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
NS_ENSURE_TRUE(brandBundle, NS_ERROR_FAILURE);
rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
NS_ENSURE_SUCCESS(rv, rv);
nsString brandShortName, brandFullName;
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
@ -247,17 +248,16 @@ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
// use brandShortName as the application id.
NS_ConvertUTF16toUTF8 id(brandShortName);
if (giovfs) {
nsCOMPtr<nsIGIOMimeApp> appInfo;
giovfs->CreateAppFromCommand(mAppPath,
id,
getter_AddRefs(appInfo));
nsCOMPtr<nsIGIOMimeApp> appInfo;
rv = giovfs->CreateAppFromCommand(mAppPath,
id,
getter_AddRefs(appInfo));
NS_ENSURE_SUCCESS(rv, rv);
// Add mime types for html, xhtml extension and set app to just created appinfo.
for (i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
}
// Add mime types for html, xhtml extension and set app to just created appinfo.
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
}
}

View File

@ -1 +1 @@
4.0b9pre
4.0b10pre

View File

@ -84,6 +84,7 @@
[browser]
; [Base Browser Files]
@BINPATH@/jsloader/
#ifndef XP_UNIX
@BINPATH@/@MOZ_APP_NAME@.exe
#else

View File

@ -0,0 +1,149 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** 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 mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Taras Glek <tglek@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* 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 ***** */
// see http://mxr.mozilla.org/mozilla-central/source/services/sync/Weave.js#76
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
function setenv(name, val) {
try {
var environment = Components.classes["@mozilla.org/process/environment;1"].
getService(Components.interfaces.nsIEnvironment);
environment.set(name, val);
}
catch(e) {
displayError("setenv", e);
}
}
function load(url) {
print(url)
try {
Cu.import(url, null)
} catch(e) {
dump("Failed to import "+url + ":"+e+"\n");
}
}
function load_entries(entries, prefix) {
while(entries.hasMore()) {
var c = entries.getNext();
load(prefix + c);
}
}
function getGreDir() {
return Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("GreD", Ci.nsIFile);
}
function openJar(file) {
var zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(Ci.nsIZipReader);
zipreader.open(file);
return zipreader;
}
// Check that files can be read from after closing zipreader
function populate_omnijar() {
var file = getGreDir();
file.append("omni.jar");
setenv("MOZ_STARTUP_CACHE", file.path);
zipreader = openJar(file);
load_entries(zipreader.findEntries("components/*js"), "resource://gre/");
load_entries(zipreader.findEntries("modules/*jsm"), "resource://gre/");
// the sync part below doesn't work as smoothly
let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
let uri = ioService.newURI("resource:///modules/services-sync/",
null, null);
let resProt = ioService.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("services-sync", uri);
var entries = zipreader.findEntries("modules/services-sync/*js");
while(entries.hasMore()) {
var c = entries.getNext();
load("resource://services-sync/" + c.replace("modules/services-sync/", ""));
}
zipreader.close();
}
function extract_files(jar, pattern, dest) {
var entries = jar.findEntries(pattern);
while(entries.hasMore()) {
var c = entries.getNext();
var file = dest.clone();
for each(name in c.split("/"))
file.append(name);
if (!file.parent.exists()) {
file.parent.create(1 /* Ci.nsIFile.DIRECTORY doesn't work*/, 0700);
print("Created " + file.parent.path)
}
if (jar.getEntry(c).isDirectory)
continue;
try {
jar.extract(c, file);
print("extracted "+file.path+":"+file.fileSize);
}catch(e) {
// This shouldn't happen, but if it does it means the cache entry will be generated at runtime
// instead of at package-time.
print("Failed to extract " + file.path);
print(e)
}
}
}
function extract_jsloader_to_dist_bin() {
var dist_bin = getGreDir().parent;
dist_bin.append("bin");
var file = getGreDir();
file.append("omni.jar");
var zipReader = openJar(file);
// this should really be zipReader.extract(...), but that method is too broken
extract_files(zipReader, "jsloader/*", dist_bin);
zipReader.close();
}

View File

@ -13,5 +13,5 @@
<Param name="rls" value="{moz:distributionID}:{moz:locale}:{moz:official}"/>
<MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/>
</Url>
<SearchForm>http://www.google.com/firefox</SearchForm>
<SearchForm>http://www.google.com/</SearchForm>
</SearchPlugin>

View File

@ -27,6 +27,7 @@ ga-IE
gd
gu-IN
he
hi-IN
hr
hu
hy-AM
@ -35,12 +36,14 @@ is
it
ja linux win32
ja-JP-mac osx
kk
kn
ko
ku
lg
lt
lv
mai
mk
ml
mr
@ -61,7 +64,9 @@ sk
sl
son
sq
sr
sv-SE
ta
ta-LK
te
th

View File

@ -1520,6 +1520,11 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
pointer-events: auto;
}
.tabbrowser-tabs[closebuttons="hidden"] > * > * > * > .tab-close-button:not([pinned]) {
display: -moz-box;
visibility: hidden;
}
.tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox {
-moz-padding-start: 5px;
-moz-padding-end: 4px;

View File

@ -74,6 +74,31 @@
background-color: -moz-Dialog;
}
%ifdef WINSTRIPE_AERO
@media not all and (-moz-windows-compositor) {
%endif
#main-window[tabsintitlebar] #titlebar-content:not(:-moz-lwtheme),
#main-window[tabsintitlebar]:not([inFullscreen]) #TabsToolbar:not(:-moz-lwtheme) {
background-color: ActiveCaption;
color: CaptionText;
}
#main-window[tabsintitlebar] #titlebar-content:not(:-moz-lwtheme):-moz-window-inactive,
#main-window[tabsintitlebar]:not([inFullscreen]) #TabsToolbar:not(:-moz-lwtheme):-moz-window-inactive {
background-color: InactiveCaption;
color: InactiveCaptionText;
}
#main-window[tabsintitlebar] #titlebar:-moz-lwtheme {
visibility: hidden;
}
#main-window[tabsintitlebar] #titlebar-content:-moz-lwtheme {
-moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
visibility: visible;
}
%ifdef WINSTRIPE_AERO
}
%endif
#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar)[iconsize="small"],
#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar)[defaulticonsize="small"]:not([iconsize]) {
padding-top: 1px;
@ -376,6 +401,14 @@
-moz-appearance: -moz-window-button-box-maximized;
}
.titlebar-placeholder[type="appmenu-button"] {
margin-left: 4px;
}
.titlebar-placeholder[type="caption-buttons"] {
margin-left: 10px;
}
/* titlebar command buttons */
#titlebar-min {
@ -937,6 +970,10 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru
/* ::::: fullscreen window controls ::::: */
#TabsToolbar > #window-controls {
-moz-margin-start: 4px;
}
#minimize-button,
#restore-button,
#close-button {

View File

@ -509,7 +509,8 @@ nsChromeRegistryChrome::SendRegisteredChrome(
mOverrideTable.EnumerateRead(&EnumerateOverride, &overrides);
bool success = aParent->SendRegisterChrome(packages, resources, overrides);
bool success = aParent->SendRegisterChrome(packages, resources, overrides,
mSelectedLocale);
NS_ENSURE_TRUE(success, );
}

View File

@ -52,8 +52,12 @@ void
nsChromeRegistryContent::RegisterRemoteChrome(
const nsTArray<ChromePackage>& aPackages,
const nsTArray<ResourceMapping>& aResources,
const nsTArray<OverrideMapping>& aOverrides)
const nsTArray<OverrideMapping>& aOverrides,
const nsACString& aLocale)
{
NS_ABORT_IF_FALSE(mLocale == nsDependentCString(""),
"RegisterChrome twice?");
for (PRUint32 i = aPackages.Length(); i > 0; ) {
--i;
RegisterPackage(aPackages[i]);
@ -68,6 +72,8 @@ nsChromeRegistryContent::RegisterRemoteChrome(
--i;
RegisterOverride(aOverrides[i]);
}
mLocale = aLocale;
}
void
@ -243,7 +249,12 @@ NS_IMETHODIMP
nsChromeRegistryContent::GetSelectedLocale(const nsACString& aPackage,
nsACString& aLocale)
{
CONTENT_NOT_IMPLEMENTED();
if (aPackage != nsDependentCString("global")) {
NS_ERROR("Uh-oh, caller wanted something other than 'some local'");
return NS_ERROR_NOT_AVAILABLE;
}
aLocale = mLocale;
return NS_OK;
}
NS_IMETHODIMP

View File

@ -55,7 +55,8 @@ class nsChromeRegistryContent : public nsChromeRegistry
void RegisterRemoteChrome(const nsTArray<ChromePackage>& aPackages,
const nsTArray<ResourceMapping>& aResources,
const nsTArray<OverrideMapping>& aOverrides);
const nsTArray<OverrideMapping>& aOverrides,
const nsACString& aLocale);
NS_OVERRIDE NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
nsIUTF8StringEnumerator* *aResult);
@ -95,6 +96,7 @@ class nsChromeRegistryContent : public nsChromeRegistry
NS_OVERRIDE nsresult GetFlagsFromPackage(const nsCString& aPackage, PRUint32* aFlags);
nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
nsCString mLocale;
virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
char *const * argv, bool platform,

View File

@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
2.0b9pre
2.0b10pre

View File

@ -1042,7 +1042,7 @@ proxy.h
#if MOZ_PLATFORM_MAEMO==6
contentaction/contentaction.h
#endif
#ifndef MOZ_TREE_PIXMAN
#if MOZ_TREE_PIXMAN!=1
pixman.h
#endif
#if MOZ_ENABLE_MEEGOTOUCHSHARE

View File

@ -683,6 +683,7 @@ case "$target" in
_MOZ_RTTI_FLAGS_OFF='-GR-'
_MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
_MOZ_EXCEPTIONS_FLAGS_OFF=''
AC_DEFINE(HAVE_SEH_EXCEPTIONS)
if test -n "$WIN32_REDIST_DIR"; then
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`

View File

@ -176,3 +176,25 @@ interface nsIFrameLoaderOwner : nsISupports
*/
void swapFrameLoaders(in nsIFrameLoaderOwner aOtherOwner);
};
/** Please merge me into something else after 2.0 branches. */
[scriptable, uuid(e3e2d3f8-1397-4984-abb3-435c29a1ca55)]
interface nsIFrameLoader_MOZILLA_2_0_BRANCH : nsISupports
{
/**
* The default rendering mode is synchronous scrolling. In this
* mode, it's an error to try to set a target viewport.
*/
const unsigned long RENDER_MODE_DEFAULT = 0x00000000;
/**
* When asynchronous scrolling is enabled, a target viewport can be
* set to transform content pixels wrt its CSS viewport.
*
* NB: when async scrolling is enabled, it's the *user's*
* responsibility to update the target scroll offset. In effect,
* the platform hands over control of scroll offset to the user.
*/
const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001;
attribute unsigned long renderMode;
};

View File

@ -171,12 +171,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameLoader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChildMessageManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameLoader)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader_MOZILLA_2_0_BRANCH)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
NS_INTERFACE_MAP_END
nsFrameLoader*
@ -1544,12 +1545,34 @@ nsFrameLoader::GetViewportScrollY(float* aViewportScrollY)
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::GetRenderMode(PRUint32* aRenderMode)
{
*aRenderMode = mViewportConfig.mRenderMode;
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::SetRenderMode(PRUint32 aRenderMode)
{
ViewportConfig config(mViewportConfig);
config.mRenderMode = aRenderMode;
return UpdateViewportConfig(config);
}
nsresult
nsFrameLoader::UpdateViewportConfig(const ViewportConfig& aNewConfig)
{
if (aNewConfig == mViewportConfig) {
return NS_OK;
} else if (!mViewportConfig.AsyncScrollEnabled() &&
!aNewConfig.AsyncScrollEnabled()) {
// The target viewport can't be set in synchronous mode
return NS_ERROR_NOT_AVAILABLE;
}
// XXX if we go from disabled->enabled, should we clear out the old
// config? Or what?
mViewportConfig = aNewConfig;
// Viewport changed. Try to locate our subdoc frame and invalidate

View File

@ -80,7 +80,8 @@ class QX11EmbedContainer;
#endif
#endif
class nsFrameLoader : public nsIFrameLoader
class nsFrameLoader : public nsIFrameLoader,
public nsIFrameLoader_MOZILLA_2_0_BRANCH
{
friend class AutoResetInShow;
#ifdef MOZ_IPC
@ -121,7 +122,8 @@ public:
*/
struct ViewportConfig {
ViewportConfig()
: mScrollOffset(0, 0)
: mRenderMode(nsIFrameLoader_MOZILLA_2_0_BRANCH::RENDER_MODE_DEFAULT)
, mScrollOffset(0, 0)
, mXScale(1.0)
, mYScale(1.0)
{}
@ -130,11 +132,21 @@ public:
PRBool operator==(const ViewportConfig& aOther) const
{
return (mScrollOffset == aOther.mScrollOffset &&
return (mRenderMode == aOther.mRenderMode &&
mScrollOffset == aOther.mScrollOffset &&
mXScale == aOther.mXScale &&
mYScale == aOther.mYScale);
}
PRBool AsyncScrollEnabled() const
{
return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL);
}
// See nsIFrameLoader.idl. Short story, if !(mRenderMode &
// RENDER_MODE_ASYNC_SCROLL), all the fields below are ignored in
// favor of what content tells.
PRUint32 mRenderMode;
// This is the scroll offset the <browser> user wishes or expects
// its enclosed content document to have. "Scroll offset" here
// means the document pixel at pixel (0,0) within the CSS
@ -162,8 +174,9 @@ public:
static nsFrameLoader* Create(nsIContent* aOwner, PRBool aNetworkCreated);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsFrameLoader)
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_DECL_NSIFRAMELOADER
NS_DECL_NSIFRAMELOADER_MOZILLA_2_0_BRANCH
NS_HIDDEN_(nsresult) CheckForRecursiveLoad(nsIURI* aURI);
nsresult ReallyStartLoading();
void Finalize();

View File

@ -225,6 +225,13 @@ private:
void CancelImageRequests(nsresult aReason, PRBool aEvenIfSizeAvailable,
PRInt16 aNewImageStatus);
/**
* Method to fire an event once we know what's going on with the image load.
*
* @param aEventType "load" or "error" depending on how things went
*/
nsresult FireEvent(const nsAString& aEventType);
protected:
/**
* Method to create an nsIURI object from the given string (will
* handle getting the right charset, base, etc). You MUST pass in a
@ -237,13 +244,6 @@ private:
nsresult StringToURI(const nsAString& aSpec, nsIDocument* aDocument,
nsIURI** aURI);
/**
* Method to fire an event once we know what's going on with the image load.
*
* @param aEventType "load" or "error" depending on how things went
*/
nsresult FireEvent(const nsAString& aEventType);
protected:
void CreateStaticImageClone(nsImageLoadingContent* aDest) const;
/**

View File

@ -1524,7 +1524,7 @@ nsObjectLoadingContent::RemovedFromDocument()
void
nsObjectLoadingContent::Traverse(nsCycleCollectionTraversalCallback &cb)
{
cb.NoteXPCOMChild(mFrameLoader);
cb.NoteXPCOMChild(static_cast<nsIFrameLoader*>(mFrameLoader));
}
// <private>

View File

@ -15,6 +15,44 @@
<iframe style="width:100%;height:300px;" id="harness"></iframe>
<script class="testbody" type="text/javascript">
function examiner() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var obsvc = Components.classes['@mozilla.org/observer-service;1']
.getService(Components.interfaces.nsIObserverService);
obsvc.addObserver(this, "http-on-examine-response", false);
}
examiner.prototype = {
observe: function(subject, topic, data) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if(!subject.QueryInterface)
return;
if (topic == "http-on-examine-response") {
var chan = subject.QueryInterface(Components.interfaces.nsIHttpChannel);
var uri = chan.URI
if (!uri.path.match(/^\/tests\/content\/base\/test\/file_x-frame-options_page\.sjs/))
return;
dump(">>>> PATH: "+uri.path+"\n");
dump(">>> REQUEST:\n>>> "+chan.requestMethod+" "+uri.asciiSpec+"\n");
dump(">>> RESPONSE HEADERS:\n");
chan.visitResponseHeaders({
visitHeader: function(header, value) {
dump(">>> "+header+": "+value+"\n");
}
});
}
},
remove: function() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var obsvc = Components.classes['@mozilla.org/observer-service;1']
.getService(Components.interfaces.nsIObserverService);
obsvc.removeObserver(this, "http-on-examine-response");
}
}
window.examiner = new examiner();
var path = "/tests/content/base/test/";
var testFramesLoaded = function() {
@ -81,6 +119,7 @@ var testFrameInDataURI = function() {
win.close();
// finalize test
window.examiner.remove();
SimpleTest.finish();
}
win.location.href = "data:text/html,"+html;

View File

@ -1238,9 +1238,6 @@ nsCanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter a
if (mOpaque)
ctx->SetOperator(op);
mIsEntireFrameInvalid = PR_FALSE;
mInvalidateCount = 0;
return rv;
}
@ -2576,7 +2573,6 @@ struct NS_STACK_CLASS nsCanvasBidiProcessor : public nsBidiPresUtils::BidiProces
0,
mTextRun->GetLength(),
nsnull,
nsnull,
nsnull);
}
@ -2924,7 +2920,6 @@ nsCanvasRenderingContext2D::MozDrawText(const nsAString& textToDraw)
/* offset = */ 0,
textToDraw.Length(),
nsnull,
nsnull,
nsnull);
return Redraw();
@ -3061,7 +3056,7 @@ nsCanvasRenderingContext2D::MozTextAlongPath(const nsAString& textToDraw, PRBool
if(stroke) {
textRun->DrawToPath(mThebes, pt, i, 1, nsnull, nsnull);
} else {
textRun->Draw(mThebes, pt, i, 1, nsnull, nsnull, nsnull);
textRun->Draw(mThebes, pt, i, 1, nsnull, nsnull);
}
mThebes->SetMatrix(matrix);
}
@ -3694,7 +3689,7 @@ nsCanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* aElem, float a
if (!loaderOwner)
return NS_ERROR_FAILURE;
nsCOMPtr<nsFrameLoader> frameloader = loaderOwner->GetFrameLoader();
nsRefPtr<nsFrameLoader> frameloader = loaderOwner->GetFrameLoader();
if (!frameloader)
return NS_ERROR_FAILURE;
@ -4063,8 +4058,13 @@ nsCanvasRenderingContext2D::GetCanvasLayer(CanvasLayer *aOldLayer,
if (!mResetLayer && aOldLayer &&
aOldLayer->HasUserData(&g2DContextLayerUserData)) {
NS_ADDREF(aOldLayer);
// XXX Need to just update the changed area here
aOldLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
if (mIsEntireFrameInvalid || mInvalidateCount > 0) {
// XXX Need to just update the changed area here; we should keep track
// of the rectangle based on Redraw args.
aOldLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
MarkContextClean();
}
return aOldLayer;
}
@ -4086,6 +4086,9 @@ nsCanvasRenderingContext2D::GetCanvasLayer(CanvasLayer *aOldLayer,
canvasLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
mResetLayer = PR_FALSE;
MarkContextClean();
return canvasLayer.forget().get();
}
@ -4093,5 +4096,6 @@ void
nsCanvasRenderingContext2D::MarkContextClean()
{
mIsEntireFrameInvalid = PR_FALSE;
mInvalidateCount = 0;
}

View File

@ -3052,7 +3052,7 @@ nsGenericHTMLFrameElement::~nsGenericHTMLFrameElement()
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericHTMLFrameElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFrameElement,
nsGenericHTMLElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFrameLoader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mFrameLoader, nsIFrameLoader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_TABLE_HEAD(nsGenericHTMLFrameElement)

View File

@ -3377,12 +3377,6 @@ nsHTMLDocument::EditingStateChanged()
NS_ENSURE_SUCCESS(rv, rv);
presShell->ReconstructStyleData();
if (designMode) {
// We need to flush styles here because we're setting an XBL binding in
// designmode.css.
FlushPendingNotifications(Flush_Style);
}
}
mEditingState = newState;

View File

@ -0,0 +1,9 @@
<svg xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'
width='16' height='16'>
<image id='i' xlink:href='a.png' width='16' height='16'/>
<filter id="f" x="0%" y="0%" width="100%" height="100%">
<feImage xlink:href="#image1" />
</filter>
<rect filter="url(#f)" x="0" y="0" width="16" height="16"/>
</svg>

After

Width:  |  Height:  |  Size: 351 B

View File

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<set/>
<filter id="disp">
<feImage xlink:href="#THIS_SVG_FILE_AS_AN_IMAGE"/>
</filter>
</svg>

After

Width:  |  Height:  |  Size: 193 B

View File

@ -55,4 +55,6 @@ load 595608-1.svg
load 601251-1.html
load 601406-1.svg
load 603145-1.svg
load zero-size-image.svg
load 613899-1.svg
load 613899-2.svg
load zero-size-image.svg

View File

@ -5405,6 +5405,19 @@ nsSVGFEImageElement::LoadSVGImage(PRBool aForce, PRBool aNotify)
if (baseURI && !href.IsEmpty())
NS_MakeAbsoluteURI(href, href, baseURI);
// Make sure we don't get in a recursive death-spiral
nsIDocument* doc = GetOurDocument();
if (doc) {
nsCOMPtr<nsIURI> hrefAsURI;
if (NS_SUCCEEDED(StringToURI(href, doc, getter_AddRefs(hrefAsURI)))) {
PRBool isEqual;
if (NS_SUCCEEDED(hrefAsURI->Equals(baseURI, &isEqual)) && isEqual) {
// Image URI matches our URI exactly! Bail out.
return NS_OK;
}
}
}
return LoadImage(href, aForce, aNotify);
}

View File

@ -68,6 +68,9 @@ _TEST_FILES = \
test_pointer-events.xhtml \
test_scientific.html \
scientific-helper.svg \
test_SVGAnimatedImageSMILDisabled.html \
animated-svg-image-helper.html \
animated-svg-image-helper.svg \
test_SVGLengthList.xhtml \
test_SVGPathSegList.xhtml \
test_SVGStyleElement.xhtml \

View File

@ -0,0 +1,3 @@
<html>
<img src="animated-svg-image-helper.svg">
</html>

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg">
<set attributeName="font-size" to="50"/>
</svg>

After

Width:  |  Height:  |  Size: 91 B

View File

@ -0,0 +1,58 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=623945
-->
<head>
<title>Test for Bug 623945</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=623945">Mozilla Bug 623945</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 623945 **/
/* This test makes sure we don't crash when using an animated SVG image with
* the 'svg.smil.enabled' pref turned off. */
SimpleTest.waitForExplicitFinish();
function setSMILEnabled(enabled) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("svg.smil.enabled", enabled);
}
function iframeLoaded() {
// Woo-hoo, we didn't crash! Declare success!
ok(true, "got through the test without crashing");
// Re-enable SMIL pref for future tests.
setSMILEnabled(true);
SimpleTest.finish();
}
function main() {
// First, we turn off the SMIL pref:
setSMILEnabled(false);
// Then, we load an HTML document with an animated SVG image.
var iframe = document.createElement("iframe");
iframe.onload = iframeLoaded;
iframe.src = "animated-svg-image-helper.html";
document.getElementById("content").appendChild(iframe);
}
main();
</script>
</pre>
</body>
</html>

View File

@ -670,10 +670,12 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
DOM_BASE_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE |
nsIXPCScriptable::WANT_HASINSTANCE |
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
NS_DEFINE_CLASSINFO_DATA(DOMConstructor, nsDOMConstructorSH,
DOM_BASE_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE |
nsIXPCScriptable::WANT_HASINSTANCE |
nsIXPCScriptable::WANT_CALL |
nsIXPCScriptable::WANT_CONSTRUCT |
@ -5735,6 +5737,8 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOMCONSTRUCTOR
nsresult PreCreate(JSContext *cx, JSObject *globalObj, JSObject **parentObj);
nsresult Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, PRUint32 argc, jsval *argv,
jsval *vp, PRBool *_retval);
@ -5745,7 +5749,7 @@ public:
nsresult Install(JSContext *cx, JSObject *target, jsval thisAsVal)
{
JSBool ok =
JSBool ok = JS_WrapValue(cx, &thisAsVal) &&
::JS_DefineUCProperty(cx, target,
reinterpret_cast<const jschar *>(mClassName),
nsCRT::strlen(mClassName), thisAsVal, nsnull,
@ -5875,6 +5879,20 @@ NS_INTERFACE_MAP_BEGIN(nsDOMConstructor)
} else
NS_INTERFACE_MAP_END
nsresult
nsDOMConstructor::PreCreate(JSContext *cx, JSObject *globalObj, JSObject **parentObj)
{
nsCOMPtr<nsPIDOMWindow> owner(do_QueryReferent(mWeakOwner));
if (!owner) {
// Can't do anything.
return NS_OK;
}
nsGlobalWindow *win = static_cast<nsGlobalWindow *>(owner.get());
*parentObj = win->FastGetGlobalJSObject();
return NS_OK;
}
nsresult
nsDOMConstructor::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
JSObject * obj, PRUint32 argc, jsval * argv,
@ -6155,6 +6173,12 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
const char *class_parent_name = nsnull;
if (!primary_iid->Equals(NS_GET_IID(nsISupports))) {
JSAutoEnterCompartment ac;
if (!ac.enter(cx, class_obj)) {
return NS_ERROR_FAILURE;
}
rv = DefineInterfaceConstants(cx, class_obj, primary_iid);
NS_ENSURE_SUCCESS(rv, rv);
@ -6280,6 +6304,11 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
v = OBJECT_TO_JSVAL(dot_prototype);
JSAutoEnterCompartment ac;
if (!ac.enter(cx, class_obj)) {
return NS_ERROR_UNEXPECTED;
}
// Per ECMA, the prototype property is {DontEnum, DontDelete, ReadOnly}
if (!JS_WrapValue(cx, &v) ||
!JS_DefineProperty(cx, class_obj, "prototype", v, nsnull, nsnull,
@ -10606,6 +10635,23 @@ nsEventListenerThisTranslator::TranslateThis(nsISupports *aInitialThis,
return NS_OK;
}
NS_IMETHODIMP
nsDOMConstructorSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj)
{
nsDOMConstructor *wrapped = static_cast<nsDOMConstructor *>(nativeObj);
#ifdef DEBUG
{
nsCOMPtr<nsIDOMDOMConstructor> is_constructor =
do_QueryInterface(nativeObj);
NS_ASSERTION(is_constructor, "How did we not get a constructor?");
}
#endif
return wrapped->PreCreate(cx, globalObj, parentObj);
}
NS_IMETHODIMP
nsDOMConstructorSH::Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp,

View File

@ -1702,6 +1702,8 @@ protected:
}
public:
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj);
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto)
{
return NS_OK;

View File

@ -2878,8 +2878,15 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindow* aWindow,
if (aIsForDocNavigation) {
nsCOMPtr<nsIContent> docContent =
do_QueryInterface(aWindow->GetFrameElementInternal());
if (docContent && docContent->Tag() == nsGkAtoms::iframe)
return nsnull;
// document navigation skips iframes and frames that are specifically non-focusable
if (docContent) {
if (docContent->Tag() == nsGkAtoms::iframe)
return nsnull;
nsIFrame* frame = docContent->GetPrimaryFrame();
if (!frame || !frame->IsFocusable(nsnull, 0))
return nsnull;
}
}
else {
PRInt32 itemType;

View File

@ -184,6 +184,7 @@
#include "nsFocusManager.h"
#include "nsIJSON.h"
#include "nsIXULWindow.h"
#include "nsEventStateManager.h"
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
#include "nsIDOMXULControlElement.h"
@ -6266,6 +6267,19 @@ nsGlobalWindow::EnterModalState()
return;
}
// If there is an active ESM in this window, clear it. Otherwise, this can
// cause a problem if a modal state is entered during a mouseup event.
nsEventStateManager* activeESM =
static_cast<nsEventStateManager*>(nsEventStateManager::GetActiveEventStateManager());
if (activeESM && activeESM->GetPresContext()) {
nsIPresShell* activeShell = activeESM->GetPresContext()->GetPresShell();
if (activeShell && (
nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(), mDoc) ||
nsContentUtils::ContentIsCrossDocDescendantOf(mDoc, activeShell->GetDocument()))) {
nsEventStateManager::ClearGlobalActiveContent(activeESM);
}
}
if (topWin->mModalStateDepth == 0) {
NS_ASSERTION(!mSuspendedDoc, "Shouldn't have mSuspendedDoc here!");

View File

@ -325,6 +325,9 @@ NS_IMETHODIMP
nsHistory::Item(PRUint32 aIndex, nsAString& aReturn)
{
aReturn.Truncate();
if (!nsContentUtils::IsCallerTrustedForRead()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsresult rv = NS_OK;
nsCOMPtr<nsISHistory> session_history;
@ -332,8 +335,8 @@ nsHistory::Item(PRUint32 aIndex, nsAString& aReturn)
GetSessionHistoryFromDocShell(mDocShell, getter_AddRefs(session_history));
NS_ENSURE_TRUE(session_history, NS_ERROR_FAILURE);
nsCOMPtr<nsIHistoryEntry> sh_entry;
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIHistoryEntry> sh_entry;
nsCOMPtr<nsIURI> uri;
rv = session_history->GetEntryAtIndex(aIndex, PR_FALSE,
getter_AddRefs(sh_entry));

View File

@ -843,14 +843,15 @@ IndexedDatabaseManager::OriginClearRunnable::Run()
mFirstCallback = false;
nsCOMPtr<nsIThread> thread;
mThread.swap(thread);
// Dispatch to the IO thread.
if (NS_FAILED(mThread->Dispatch(this, NS_DISPATCH_NORMAL))) {
if (NS_FAILED(thread->Dispatch(this, NS_DISPATCH_NORMAL))) {
NS_WARNING("Failed to dispatch to IO thread!");
return NS_ERROR_FAILURE;
}
// Don't need this any longer.
mThread = nsnull;
return NS_OK;
}

View File

@ -100,6 +100,9 @@ TEST_FILES = \
ifeq (browser,$(MOZ_BUILD_APP))
BROWSER_TEST_FILES = \
browser_forgetThisSite.js \
browser_forgetThisSiteAdd.html \
browser_forgetThisSiteGet.html \
browserHelpers.js \
browser_permissionsPrompt.html \
browser_permissionsPromptAllow.js \

View File

@ -22,7 +22,7 @@ function finishTestNow()
{
if (testGenerator) {
testGenerator.close();
delete testGenerator;
testGenerator = undefined;
}
}

View File

@ -0,0 +1,108 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const domains = [
"mochi.test:8888",
"www.example.com"
];
const addPath = "/browser/dom/indexedDB/test/browser_forgetThisSiteAdd.html";
const getPath = "/browser/dom/indexedDB/test/browser_forgetThisSiteGet.html";
const testPageURL1 = "http://" + domains[0] + addPath;
const testPageURL2 = "http://" + domains[1] + addPath;
const testPageURL3 = "http://" + domains[0] + getPath;
const testPageURL4 = "http://" + domains[1] + getPath;
function test()
{
waitForExplicitFinish();
// Avoids the prompt
setPermission(testPageURL1, "indexedDB");
setPermission(testPageURL2, "indexedDB");
executeSoon(test1);
}
function test1()
{
// Set database version for domain 1
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == "11", "Set version on database in " + testPageURL1);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(test2);
});
}, true);
content.location = testPageURL1;
}
function test2()
{
// Set database version for domain 2
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == "11", "Set version on database in " + testPageURL2);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(test3);
});
}, true);
content.location = testPageURL2;
}
function test3()
{
// Remove database from domain 2
Components.classes["@mozilla.org/privatebrowsing;1"]
.getService(Components.interfaces.nsIPrivateBrowsingService)
.removeDataFromDomain(domains[1]);
setPermission(testPageURL4, "indexedDB");
executeSoon(test4);
}
function test4()
{
// Get database version for domain 1
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == "11", "Got correct version on database in " + testPageURL3);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(test5);
});
}, true);
content.location = testPageURL3;
}
function test5()
{
// Get database version for domain 2
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == "", "Got correct version on database in " + testPageURL4);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(finish);
});
}, true);
content.location = testPageURL4;
}

View File

@ -0,0 +1,49 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Indexed Database Test</title>
<script type="text/javascript;version=1.7">
function testSteps()
{
let request = mozIndexedDB.open("browser_forgetThisSite.js");
request.onerror = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
let event = yield;
if (event.type == "error") {
testException = event.target.errorCode;
}
else {
let db = event.target.result;
request = db.setVersion("11");
request.onerror = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield;
if (event.type == "error") {
testException = event.target.errorCode;
}
else {
testResult = db.version;
}
event.target.transaction.oncomplete = finishTest;
yield;
}
yield;
}
</script>
<script type="text/javascript;version=1.7" src="browserHelpers.js"></script>
</head>
<body onload="runTest();" onunload="finishTestNow();"></body>
</html>

View File

@ -0,0 +1,36 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Indexed Database Test</title>
<script type="text/javascript;version=1.7">
function testSteps()
{
let request = mozIndexedDB.open("browser_forgetThisSite.js");
request.onerror = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
let event = yield;
if (event.type == "error") {
testException = event.target.errorCode;
}
else {
let db = event.target.result;
testResult = db.version;
}
finishTest()
yield;
}
</script>
<script type="text/javascript;version=1.7" src="browserHelpers.js"></script>
</head>
<body onload="runTest();" onunload="finishTestNow();"></body>
</html>

View File

@ -12,7 +12,7 @@ function test()
waitForExplicitFinish();
// Avoids the actual prompt
setPermission(testPageURL, "indexedDB");
executeSoon(test2);
executeSoon(test1);
}
function test1()

View File

@ -398,12 +398,13 @@ ContentChild::DeallocPStorage(PStorageChild* aActor)
bool
ContentChild::RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
const InfallibleTArray<ResourceMapping>& resources,
const InfallibleTArray<OverrideMapping>& overrides)
const InfallibleTArray<OverrideMapping>& overrides,
const nsCString& locale)
{
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
nsChromeRegistryContent* chromeRegistry =
static_cast<nsChromeRegistryContent*>(registrySvc.get());
chromeRegistry->RegisterRemoteChrome(packages, resources, overrides);
chromeRegistry->RegisterRemoteChrome(packages, resources, overrides, locale);
return true;
}

View File

@ -109,7 +109,8 @@ public:
virtual bool RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
const InfallibleTArray<ResourceMapping>& resources,
const InfallibleTArray<OverrideMapping>& overrides);
const InfallibleTArray<OverrideMapping>& overrides,
const nsCString& locale);
virtual bool RecvSetOffline(const PRBool& offline);

View File

@ -97,7 +97,7 @@ child:
PTestShell();
RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources,
OverrideMapping[] overrides);
OverrideMapping[] overrides, nsCString locale);
async SetOffline(PRBool offline);

View File

@ -89,6 +89,7 @@ NS_IMPL_ISUPPORTS3(TabParent, nsITabParent, nsIAuthPromptProvider, nsISecureBrow
TabParent::TabParent()
: mIMEComposing(PR_FALSE)
, mIMECompositionEnding(PR_FALSE)
, mIMESeqno(0)
, mDPI(0)
{
}

View File

@ -624,6 +624,9 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
return true;
#endif
// XXX A previous call to mPluginIface->event might block, e.g. right click
// for context menu. Still, we might get here again, calling into the plugin
// a second time while it's in the previous call.
if (!mPluginIface->event)
*handled = false;
else

View File

@ -2519,7 +2519,7 @@ nsresult nsEditor::InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert,
// savvy to having multiple ime txns inside them.
// delete empty ime text node if there is one
if (isIMETransaction)
if (isIMETransaction && mIMETextNode)
{
PRUint32 len;
mIMETextNode->GetLength(&len);

View File

@ -1264,7 +1264,7 @@ nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnic
nsLinebreakConverter::eLinebreakAny,
nsLinebreakConverter::eLinebreakContent,
oldLengthInChars, &newLengthInChars);
if (!aStuffToPaste)
if (!*aStuffToPaste)
{
return NS_ERROR_FAILURE;
}

View File

@ -69,6 +69,7 @@ _TEST_FILES = \
test_bug607584.html \
test_bug611182.html \
test_bug612447.html \
test_bug620906.html \
test_CF_HTML_clipboard.html \
test_contenteditable_focus.html \
test_contenteditable_text_input_handling.html \

View File

@ -0,0 +1,49 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=620906
-->
<head>
<title>Test for Bug 620906</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=620906">Mozilla Bug 620906</a>
<p id="display"></p>
<div id="content">
<iframe src="data:text/html,
<body contenteditable
onmousedown='
document.designMode=&quot;on&quot;;
document.designMode=&quot;off&quot;;
'
>
<div style='height: 1000px;'></div>
</body>">
</iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 620906 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var iframe = document.querySelector("iframe");
is(iframe.contentWindow.scrollY, 0, "Sanity check");
var rect = iframe.getBoundingClientRect();
setTimeout(function() {
synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {});
setTimeout(function() {
isnot(iframe.contentWindow.scrollY, 0, "The scrollbar should work");
SimpleTest.finish();
}, 0);
}, 0);
});
</script>
</pre>
</body>
</html>

View File

@ -170,11 +170,11 @@ function runTests()
reset("");
synthesizeKey("VK_BACK_SPACE", { ctrlKey: true });
check(aDescription + "Ctrl+Backspace", true, true, kIsWin || aIsReadonly);
check(aDescription + "Ctrl+Backspace", true, true, aIsReadonly);
reset("");
synthesizeKey("VK_BACK_SPACE", { altKey: true });
check(aDescription + "Alt+Backspace", true, true, kIsLinux ? aIsReadonly : true);
check(aDescription + "Alt+Backspace", true, true, aIsReadonly);
reset("");
synthesizeKey("VK_BACK_SPACE", { metaKey: true });
@ -190,15 +190,15 @@ function runTests()
reset("");
synthesizeKey("VK_DELETE", { shiftKey: true });
check(aDescription + "Shift+Delete", true, true, !kIsLinux);
check(aDescription + "Shift+Delete", true, true, false);
reset("");
synthesizeKey("VK_DELETE", { ctrlKey: true });
check(aDescription + "Ctrl+Delete", true, true, kIsWin);
check(aDescription + "Ctrl+Delete", true, true, false);
reset("");
synthesizeKey("VK_DELETE", { altKey: true });
check(aDescription + "Alt+Delete", true, true, kIsMac);
check(aDescription + "Alt+Delete", true, true, false);
reset("");
synthesizeKey("VK_DELETE", { metaKey: true });

View File

@ -26,7 +26,7 @@
android:configChanges="keyboard|keyboardHidden|mcc|mnc"
android:windowSoftInputMode="stateUnspecified|adjustResize"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Light.NoTitleBar">
android:theme="@style/GreyTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -76,7 +76,7 @@
</receiver>
<activity android:name="Restarter"
android:theme="@android:style/Theme.Light.NoTitleBar">
android:theme="@style/GreyTheme">
<intent-filter>
<action android:name="org.mozilla.gecko.restart"
android:process="@MOZ_APP_NAME@Restarter"/>

View File

@ -69,6 +69,7 @@ abstract public class GeckoApp
public static GeckoSurfaceView surfaceView;
public static GeckoApp mAppContext;
public static boolean mFullscreen = false;
static Thread mLibLoadThread = null;
enum LaunchState {PreLaunch, Launching, WaitButton,
Launched, GeckoRunning, GeckoExiting};
@ -114,35 +115,51 @@ abstract public class GeckoApp
}
// Returns true when the intent is going to be handled by gecko launch
boolean launch(Intent i)
boolean launch(Intent intent)
{
if (!checkAndSetLaunchState(LaunchState.Launching, LaunchState.Launched))
return false;
// unpack files in the components directory
try {
unpackComponents();
} catch (FileNotFoundException fnfe) {
Log.e("GeckoApp", "error unpacking components", fnfe);
showErrorDialog(getString(R.string.error_loading_file));
return false;
} catch (IOException ie) {
Log.e("GeckoApp", "error unpacking components", ie);
String msg = ie.getMessage();
if (msg.equalsIgnoreCase("No space left on device"))
showErrorDialog(getString(R.string.no_space_to_start_error));
else
showErrorDialog(getString(R.string.error_loading_file));
return false;
}
// and then fire us up
if (i == null)
i = getIntent();
String env = i.getStringExtra("env0");
GeckoAppShell.runGecko(getApplication().getPackageResourcePath(),
i.getStringExtra("args"),
i.getDataString());
if (intent == null)
intent = getIntent();
final Intent i = intent;
new Thread() {
public void run() {
try {
if (mLibLoadThread != null)
mLibLoadThread.join();
} catch (InterruptedException ie) {}
surfaceView.mSplashStatusMsg =
getResources().getString(R.string.splash_screen_label);
surfaceView.drawSplashScreen();
// unpack files in the components directory
try {
unpackComponents();
} catch (FileNotFoundException fnfe) {
Log.e("GeckoApp", "error unpacking components", fnfe);
Looper.prepare();
showErrorDialog(getString(R.string.error_loading_file));
Looper.loop();
return;
} catch (IOException ie) {
Log.e("GeckoApp", "error unpacking components", ie);
String msg = ie.getMessage();
Looper.prepare();
if (msg.equalsIgnoreCase("No space left on device"))
showErrorDialog(getString(R.string.no_space_to_start_error));
else
showErrorDialog(getString(R.string.error_loading_file));
Looper.loop();
return;
}
// and then fire us up
String env = i.getStringExtra("env0");
GeckoAppShell.runGecko(getApplication().getPackageResourcePath(),
i.getStringExtra("args"),
i.getDataString());
}
}.start();
return true;
}
@ -178,9 +195,21 @@ abstract public class GeckoApp
return;
checkAndLaunchUpdate();
// Load our JNI libs
GeckoAppShell.loadGeckoLibs(getApplication().getPackageResourcePath());
mLibLoadThread = new Thread(new Runnable() {
public void run() {
GeckoAppShell.loadGeckoLibs(
getApplication().getPackageResourcePath());
}});
File libxulFile = new File(getCacheDir(), "libxul.so");
if (!libxulFile.exists() ||
libxulFile.lastModified() <
new File(getApplication().getPackageResourcePath()).lastModified())
surfaceView.mSplashStatusMsg =
getResources().getString(R.string.splash_screen_installing);
else
surfaceView.mSplashStatusMsg =
getResources().getString(R.string.splash_screen_label);
mLibLoadThread.start();
}
@Override

View File

@ -78,9 +78,12 @@ class GeckoSurfaceView
inputConnection = new GeckoInputConnection(this);
setFocusable(true);
setFocusableInTouchMode(true);
mWidth = 0;
mHeight = 0;
DisplayMetrics metrics = new DisplayMetrics();
GeckoApp.mAppContext.getWindowManager().
getDefaultDisplay().getMetrics(metrics);
mWidth = metrics.widthPixels;
mHeight = metrics.heightPixels;
mBufferWidth = 0;
mBufferHeight = 0;
@ -97,6 +100,10 @@ class GeckoSurfaceView
super.finalize();
}
void drawSplashScreen() {
this.drawSplashScreen(getHolder(), mWidth, mHeight);
}
void drawSplashScreen(SurfaceHolder holder, int width, int height) {
Canvas c = holder.lockCanvas();
if (c == null) {
@ -109,7 +116,7 @@ class GeckoSurfaceView
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
int x = (width - w)/2;
int y = (height - h)/2;
int y = (height - h)/2 - 16;
drawable.setBounds(x, y, x + w, y + h);
drawable.draw(c);
Paint p = new Paint();
@ -117,7 +124,7 @@ class GeckoSurfaceView
p.setTextSize(32f);
p.setAntiAlias(true);
p.setColor(res.getColor(R.color.splash_font));
c.drawText(res.getString(R.string.splash_screen_label), width/2, y + h + 32, p);
c.drawText(GeckoSurfaceView.mSplashStatusMsg, width/2, y + h + 16, p);
holder.unlockCanvasAndPost(c);
}
@ -190,6 +197,8 @@ class GeckoSurfaceView
Log.i("GeckoAppJava", "surface created");
GeckoEvent e = new GeckoEvent(GeckoEvent.SURFACE_CREATED);
GeckoAppShell.sendEventToGecko(e);
if (mShowingSplashScreen)
drawSplashScreen();
}
public void surfaceDestroyed(SurfaceHolder holder) {
@ -540,6 +549,7 @@ class GeckoSurfaceView
int mDrawMode;
static boolean mShowingSplashScreen = true;
static String mSplashStatusMsg = "";
// let's not change stuff around while we're in the middle of
// starting drawing, ending drawing, or changing surface

View File

@ -107,7 +107,7 @@ RES_LAYOUT = \
res/layout/notification_progress_text.xml \
$(NULL)
RES_VALUES = res/values/colors.xml
RES_VALUES = res/values/colors.xml res/values/themes.xml
AB_rCD = $(shell echo $(AB_CD) | sed -e s/-/-r/)

View File

@ -91,7 +91,10 @@ public class NotificationHandler
Intent appIntent = new Intent(Intent.ACTION_MAIN);
appIntent.setClassName(context, "@ANDROID_PACKAGE_NAME@.App");
appIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
appIntent.putExtra("args", "-alert " + alertName + (alertCookie.length() > 0 ? "#" + alertCookie : ""));
try {
Log.i("GeckoAppJava", "startActivity with intent: Action='" + appIntent.getAction() + "'" +
", args='" + appIntent.getStringExtra("args") + "'" );
context.startActivity(appIntent);
} catch (ActivityNotFoundException e) {
Log.e("GeckoAppJava", "NotificationHandler Exception: ", e);

View File

@ -1,4 +1,5 @@
<!ENTITY splash_screen_label "loading">
<!ENTITY splash_screen_installing "installing libraries\u2026">
<!ENTITY incompatable_cpu_error "This device does not meet the minimum system requirements for &brandShortName;.">
<!ENTITY no_space_to_start_error "There is not enough space available for &brandShortName; to start.">
<!ENTITY error_loading_file "An error occurred when trying to load files required to run &brandShortName;">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="splash_background">#3a3a3a</color>
<color name="splash_background">#000000</color>
<color name="splash_font">#ffffff</color>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="GreyTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">@color/splash_background</item>
</style>
</resources>

View File

@ -6,6 +6,7 @@
]>
<resources>
<string name="splash_screen_label">&splash_screen_label;</string>
<string name="splash_screen_installing">&splash_screen_installing;</string>
<string name="no_space_to_start_error">&no_space_to_start_error;</string>
<string name="error_loading_file">&error_loading_file;</string>

View File

@ -91,6 +91,7 @@
#define cairo_image_surface_get_height _moz_cairo_image_surface_get_height
#define cairo_image_surface_get_stride _moz_cairo_image_surface_get_stride
#define cairo_image_surface_get_width _moz_cairo_image_surface_get_width
#define cairo_in_clip _moz_cairo_in_clip
#define cairo_in_fill _moz_cairo_in_fill
#define cairo_in_stroke _moz_cairo_in_stroke
#define cairo_line_to _moz_cairo_line_to
@ -115,13 +116,13 @@
#define cairo_os2_init _moz_cairo_os2_init
#define cairo_os2_surface_create _moz_cairo_os2_surface_create
#define cairo_os2_surface_create_for_window _moz_cairo_os2_surface_create_for_window
#define cairo_os2_surface_get_hps _moz_cairo_os2_surface_get_hps
#define cairo_os2_surface_get_manual_window_refresh _moz_cairo_os2_surface_get_manual_window_refresh
#define cairo_os2_surface_refresh_window _moz_cairo_os2_surface_refresh_window
#define cairo_os2_surface_set_hps _moz_cairo_os2_surface_set_hps
#define cairo_os2_surface_set_hwnd _moz_cairo_os2_surface_set_hwnd
#define cairo_os2_surface_set_manual_window_refresh _moz_cairo_os2_surface_set_manual_window_refresh
#define cairo_os2_surface_set_size _moz_cairo_os2_surface_set_size
#define cairo_os2_surface_get_hps _moz_cairo_os2_surface_get_hps
#define cairo_os2_surface_set_hps _moz_cairo_os2_surface_set_hps
#define cairo_paint _moz_cairo_paint
#define cairo_paint_with_alpha _moz_cairo_paint_with_alpha
#define cairo_path_destroy _moz_cairo_path_destroy
@ -152,9 +153,12 @@
#define cairo_pattern_set_matrix _moz_cairo_pattern_set_matrix
#define cairo_pattern_set_user_data _moz_cairo_pattern_set_user_data
#define cairo_pattern_status _moz_cairo_pattern_status
#define cairo_pdf_get_versions _moz_cairo_pdf_get_versions
#define cairo_pdf_surface_create _moz_cairo_pdf_surface_create
#define cairo_pdf_surface_create_for_stream _moz_cairo_pdf_surface_create_for_stream
#define cairo_pdf_surface_restrict_to_version _moz_cairo_pdf_surface_restrict_to_version
#define cairo_pdf_surface_set_size _moz_cairo_pdf_surface_set_size
#define cairo_pdf_version_to_string _moz_cairo_pdf_version_to_string
#define cairo_pop_group _moz_cairo_pop_group
#define cairo_pop_group_to_source _moz_cairo_pop_group_to_source
#define cairo_ps_get_levels _moz_cairo_ps_get_levels
@ -181,13 +185,36 @@
#define cairo_quartz_image_surface_create _moz_cairo_quartz_image_surface_create
#define cairo_quartz_image_surface_get_image _moz_cairo_quartz_image_surface_get_image
#define cairo_quartz_surface_create _moz_cairo_quartz_surface_create
#define cairo_quartz_surface_create_for_data _moz_cairo_quartz_surface_create_for_data
#define cairo_quartz_surface_create_for_cg_context _moz_cairo_quartz_surface_create_for_cg_context
#define cairo_quartz_surface_create_for_data _moz_cairo_quartz_surface_create_for_data
#define cairo_quartz_surface_get_cg_context _moz_cairo_quartz_surface_get_cg_context
#define cairo_quartz_surface_get_image _moz_cairo_quartz_surface_get_image
#define cairo_recording_surface_create _moz_cairo_recording_surface_create
#define cairo_recording_surface_ink_extents _moz_cairo_recording_surface_ink_extents
#define cairo_rectangle _moz_cairo_rectangle
#define cairo_rectangle_list_destroy _moz_cairo_rectangle_list_destroy
#define cairo_reference _moz_cairo_reference
#define cairo_region_contains_point _moz_cairo_region_contains_point
#define cairo_region_contains_rectangle _moz_cairo_region_contains_rectangle
#define cairo_region_copy _moz_cairo_region_copy
#define cairo_region_create _moz_cairo_region_create
#define cairo_region_create_rectangle _moz_cairo_region_create_rectangle
#define cairo_region_create_rectangles _moz_cairo_region_create_rectangles
#define cairo_region_destroy _moz_cairo_region_destroy
#define cairo_region_equal _moz_cairo_region_equal
#define cairo_region_get_extents _moz_cairo_region_get_extents
#define cairo_region_get_rectangle _moz_cairo_region_get_rectangle
#define cairo_region_intersect _moz_cairo_region_intersect
#define cairo_region_intersect_rectangle _moz_cairo_region_intersect_rectangle
#define cairo_region_is_empty _moz_cairo_region_is_empty
#define cairo_region_num_rectangles _moz_cairo_region_num_rectangles
#define cairo_region_reference _moz_cairo_region_reference
#define cairo_region_status _moz_cairo_region_status
#define cairo_region_subtract _moz_cairo_region_subtract
#define cairo_region_subtract_rectangle _moz_cairo_region_subtract_rectangle
#define cairo_region_translate _moz_cairo_region_translate
#define cairo_region_union _moz_cairo_region_union
#define cairo_region_union_rectangle _moz_cairo_region_union_rectangle
#define cairo_rel_curve_to _moz_cairo_rel_curve_to
#define cairo_rel_line_to _moz_cairo_rel_line_to
#define cairo_rel_move_to _moz_cairo_rel_move_to
@ -253,7 +280,9 @@
#define cairo_surface_get_device_offset _moz_cairo_surface_get_device_offset
#define cairo_surface_get_fallback_resolution _moz_cairo_surface_get_fallback_resolution
#define cairo_surface_get_font_options _moz_cairo_surface_get_font_options
#define cairo_surface_get_mime_data _moz_cairo_surface_get_mime_data
#define cairo_surface_get_reference_count _moz_cairo_surface_get_reference_count
#define cairo_surface_get_subpixel_antialiasing _moz_cairo_surface_get_subpixel_antialiasing
#define cairo_surface_get_type _moz_cairo_surface_get_type
#define cairo_surface_get_user_data _moz_cairo_surface_get_user_data
#define cairo_surface_has_show_text_glyphs _moz_cairo_surface_has_show_text_glyphs
@ -262,6 +291,8 @@
#define cairo_surface_reference _moz_cairo_surface_reference
#define cairo_surface_set_device_offset _moz_cairo_surface_set_device_offset
#define cairo_surface_set_fallback_resolution _moz_cairo_surface_set_fallback_resolution
#define cairo_surface_set_mime_data _moz_cairo_surface_set_mime_data
#define cairo_surface_set_subpixel_antialiasing _moz_cairo_surface_set_subpixel_antialiasing
#define cairo_surface_set_user_data _moz_cairo_surface_set_user_data
#define cairo_surface_show_page _moz_cairo_surface_show_page
#define cairo_surface_status _moz_cairo_surface_status
@ -272,6 +303,10 @@
#define cairo_svg_surface_create_for_stream _moz_cairo_svg_surface_create_for_stream
#define cairo_svg_surface_restrict_to_version _moz_cairo_svg_surface_restrict_to_version
#define cairo_svg_version_to_string _moz_cairo_svg_version_to_string
#define cairo_tee_surface_add _moz_cairo_tee_surface_add
#define cairo_tee_surface_create _moz_cairo_tee_surface_create
#define cairo_tee_surface_index _moz_cairo_tee_surface_index
#define cairo_tee_surface_remove _moz_cairo_tee_surface_remove
#define cairo_text_cluster_allocate _moz_cairo_text_cluster_allocate
#define cairo_text_cluster_free _moz_cairo_text_cluster_free
#define cairo_text_extents _moz_cairo_text_extents

View File

@ -468,8 +468,13 @@ nsACString&
ContainerLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
Layer::PrintInfo(aTo, aPrefix);
return mFrameMetrics.IsDefault() ?
aTo : AppendToString(aTo, mFrameMetrics, " [metrics=", "]");
if (!mFrameMetrics.IsDefault()) {
AppendToString(aTo, mFrameMetrics, " [metrics=", "]");
}
if (UseIntermediateSurface()) {
aTo += " [usesTmpSurf]";
}
return aTo;
}
nsACString&

View File

@ -313,7 +313,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
result.mContext = GetContextForQuadrantUpdate(drawBounds,
aXResolution, aYResolution);
gfxUtils::ClipToRegion(result.mContext, result.mRegionToDraw);
gfxUtils::ClipToRegionSnapped(result.mContext, result.mRegionToDraw);
if (aContentType == gfxASurface::CONTENT_COLOR_ALPHA && !isClear) {
result.mContext->SetOperator(gfxContext::OPERATOR_CLEAR);
result.mContext->Paint();

View File

@ -87,7 +87,10 @@ SurfaceToTexture(ID3D10Device *aDevice,
data.SysMemPitch = imageSurface->Stride();
nsRefPtr<ID3D10Texture2D> texture;
aDevice->CreateTexture2D(&desc, &data, getter_AddRefs(texture));
HRESULT hr = aDevice->CreateTexture2D(&desc, &data, getter_AddRefs(texture));
LayerManagerD3D10::ReportFailure(NS_LITERAL_CSTRING("Failed to create texture for image surface"),
hr);
return texture.forget();
}
@ -218,6 +221,11 @@ ImageLayerD3D10::RenderLayer()
nsRefPtr<gfxASurface> surf = GetContainer()->GetCurrentAsSurface(&size);
nsRefPtr<ID3D10Texture2D> texture = SurfaceToTexture(device(), surf, size);
if (!texture) {
NS_WARNING("Failed to create texture for surface.");
return;
}
hasAlpha = surf->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA;
@ -225,6 +233,7 @@ ImageLayerD3D10::RenderLayer()
} else {
ImageContainerD3D10 *container =
static_cast<ImageContainerD3D10*>(GetContainer());
if (container->device() != device()) {
container->SetDevice(device());
}
@ -232,6 +241,13 @@ ImageLayerD3D10::RenderLayer()
// image->GetFormat() == Image::CAIRO_SURFACE
CairoImageD3D10 *cairoImage =
static_cast<CairoImageD3D10*>(image.get());
if (cairoImage->mDevice != device()) {
// This shader resource view was for an old device! Can't draw that
// now.
return;
}
srView = cairoImage->mSRView;
hasAlpha = cairoImage->mHasAlpha;
size = cairoImage->mSize;
@ -270,6 +286,12 @@ ImageLayerD3D10::RenderLayer()
return;
}
if (yuvImage->mDevice != device()) {
// These shader resources were created for an old device! Can't draw
// that here.
return;
}
// TODO: At some point we should try to deal with mFilter here, you don't
// really want to use point filtering in the case of NEAREST, since that
// would also use point filtering for Chroma upsampling. Where most likely
@ -445,6 +467,11 @@ CairoImageD3D10::SetData(const CairoImage::Data &aData)
mTexture = SurfaceToTexture(mDevice, aData.mSurface, mSize);
if (!mTexture) {
NS_WARNING("Failed to create texture for CairoImage.");
return;
}
if (aData.mSurface->GetContentType() == gfxASurface::CONTENT_COLOR) {
mHasAlpha = false;
} else {

View File

@ -87,6 +87,12 @@ LayerManagerD3D10::~LayerManagerD3D10()
Destroy();
}
static bool
IsOptimus()
{
return GetModuleHandleA("nvumdshim.dll");
}
bool
LayerManagerD3D10::Initialize()
{
@ -182,8 +188,15 @@ LayerManagerD3D10::Initialize()
swapDesc.BufferCount = 1;
// We don't really need this flag, however it seems on some NVidia hardware
// smaller area windows do not present properly without this flag. This flag
// should have no negative consequences by itself. See bug 613790.
swapDesc.Flags = DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE;
// should have no negative consequences by itself. See bug 613790. This flag
// is broken on optimus devices. As a temporary solution we don't set it
// there, the only way of reliably detecting we're on optimus is looking for
// the DLL. See Bug 623807.
if (IsOptimus()) {
swapDesc.Flags = 0;
} else {
swapDesc.Flags = DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE;
}
swapDesc.OutputWindow = (HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW);
swapDesc.Windowed = TRUE;
@ -434,9 +447,15 @@ LayerManagerD3D10::VerifyBufferSize()
}
mRTView = nsnull;
mSwapChain->ResizeBuffers(1, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE);
if (IsOptimus()) {
mSwapChain->ResizeBuffers(1, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
0);
} else {
mSwapChain->ResizeBuffers(1, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE);
}
}
@ -518,6 +537,17 @@ LayerManagerD3D10::PaintToTarget()
readTexture->Unmap(0);
}
void
LayerManagerD3D10::ReportFailure(const nsACString &aMsg, HRESULT aCode)
{
// We could choose to abort here when hr == E_OUTOFMEMORY.
nsCString msg;
msg.Append(aMsg);
msg.AppendLiteral(" Error code: ");
msg.AppendInt(PRUint32(aCode));
NS_WARNING(msg.BeginReading());
}
LayerD3D10::LayerD3D10(LayerManagerD3D10 *aManager)
: mD3DManager(aManager)
{

View File

@ -141,6 +141,8 @@ public:
void SetViewport(const nsIntSize &aViewport);
const nsIntSize &GetViewport() { return mViewport; }
static void LayerManagerD3D10::ReportFailure(const nsACString &aMsg, HRESULT aCode);
private:
void SetupPipeline();
void UpdateRenderTarget();

View File

@ -45,6 +45,8 @@
#include "gfxWindowsPlatform.h"
#include "nsIGfxInfo.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
namespace mozilla {
namespace layers {
@ -66,11 +68,20 @@ LayerManagerD3D9::~LayerManagerD3D9()
PRBool
LayerManagerD3D9::Initialize()
{
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
PRBool forceAccelerate = PR_FALSE;
if (prefs) {
// we should use AddBoolPrefVarCache
prefs->GetBoolPref("layers.acceleration.force-enabled",
&forceAccelerate);
}
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, &status))) {
if (status != nsIGfxInfo::FEATURE_NO_INFO)
if (status != nsIGfxInfo::FEATURE_NO_INFO && !forceAccelerate)
{
NS_WARNING("Direct3D 9-accelerated layers are not supported on this system.");
return PR_FALSE;

View File

@ -319,6 +319,7 @@ class OpaqueRenderer {
public:
OpaqueRenderer(const nsIntRegion& aUpdateRegion) :
mUpdateRegion(aUpdateRegion), mDC(NULL) {}
~OpaqueRenderer() { End(); }
already_AddRefed<gfxWindowsSurface> Begin(LayerD3D9* aLayer);
void End();
IDirect3DTexture9* GetTexture() { return mTmpTexture; }
@ -365,7 +366,11 @@ OpaqueRenderer::Begin(LayerD3D9* aLayer)
void
OpaqueRenderer::End()
{
mSurface->ReleaseDC(mDC);
if (mSurface && mDC) {
mSurface->ReleaseDC(mDC);
mSurface = NULL;
mDC = NULL;
}
}
static void
@ -384,7 +389,6 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion, SurfaceMode aMode)
{
HRESULT hr;
nsIntRect visibleRect = mVisibleRegion.GetBounds();
nsRefPtr<gfxContext> context;
nsRefPtr<gfxASurface> destinationSurface;
nsIntRect bounds = aRegion.GetBounds();
@ -424,19 +428,24 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion, SurfaceMode aMode)
case SURFACE_COMPONENT_ALPHA: {
nsRefPtr<gfxWindowsSurface> onBlack = opaqueRenderer.Begin(this);
nsRefPtr<gfxWindowsSurface> onWhite = opaqueRendererOnWhite.Begin(this);
FillSurface(onBlack, aRegion, bounds.TopLeft(), gfxRGBA(0.0, 0.0, 0.0, 1.0));
FillSurface(onWhite, aRegion, bounds.TopLeft(), gfxRGBA(1.0, 1.0, 1.0, 1.0));
gfxASurface* surfaces[2] = { onBlack.get(), onWhite.get() };
destinationSurface = new gfxTeeSurface(surfaces, NS_ARRAY_LENGTH(surfaces));
// Using this surface as a source will likely go horribly wrong, since
// only the onBlack surface will really be used, so alpha information will
// be incorrect.
destinationSurface->SetAllowUseAsSource(PR_FALSE);
if (onBlack && onWhite) {
FillSurface(onBlack, aRegion, bounds.TopLeft(), gfxRGBA(0.0, 0.0, 0.0, 1.0));
FillSurface(onWhite, aRegion, bounds.TopLeft(), gfxRGBA(1.0, 1.0, 1.0, 1.0));
gfxASurface* surfaces[2] = { onBlack.get(), onWhite.get() };
destinationSurface = new gfxTeeSurface(surfaces, NS_ARRAY_LENGTH(surfaces));
// Using this surface as a source will likely go horribly wrong, since
// only the onBlack surface will really be used, so alpha information will
// be incorrect.
destinationSurface->SetAllowUseAsSource(PR_FALSE);
}
break;
}
}
context = new gfxContext(destinationSurface);
if (!destinationSurface)
return;
nsRefPtr<gfxContext> context = new gfxContext(destinationSurface);
context->Translate(gfxPoint(-bounds.x, -bounds.y));
LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
cbInfo.Callback(this, context, aRegion, nsIntRegion(), cbInfo.CallbackData);
@ -462,10 +471,12 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion, SurfaceMode aMode)
r.Pitch,
gfxASurface::ImageFormatARGB32);
context = new gfxContext(imgSurface);
context->SetSource(destinationSurface);
context->SetOperator(gfxContext::OPERATOR_SOURCE);
context->Paint();
if (destinationSurface) {
nsRefPtr<gfxContext> context = new gfxContext(imgSurface);
context->SetSource(destinationSurface);
context->SetOperator(gfxContext::OPERATOR_SOURCE);
context->Paint();
}
imgSurface = NULL;

View File

@ -415,6 +415,10 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
nsRefPtr<gfxSharedImageSurface> newFront =
gfxSharedImageSurface::Open(op.newFrontBuffer());
nsRefPtr<gfxSharedImageSurface> newBack = canvas->Swap(newFront);
if (newFront == newBack) {
newFront.forget();
}
canvas->Updated(op.updated());
replyv.push_back(OpBufferSwap(shadow, NULL,
@ -433,6 +437,9 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
nsRefPtr<gfxSharedImageSurface> newFront =
gfxSharedImageSurface::Open(op.newFrontBuffer());
nsRefPtr<gfxSharedImageSurface> newBack = image->Swap(newFront);
if (newFront == newBack) {
newFront.forget();
}
replyv.push_back(OpBufferSwap(shadow, NULL,
newBack->GetShmem()));

View File

@ -58,6 +58,8 @@
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIGfxInfo.h"
@ -66,7 +68,9 @@ namespace layers {
using namespace mozilla::gl;
#ifdef CHECK_CURRENT_PROGRAM
int LayerManagerOGLProgram::sCurrentProgramKey = 0;
#endif
/**
* LayerManagerOGL
@ -155,11 +159,20 @@ LayerManagerOGL::Initialize(GLContext *aExistingContext)
if (mGLContext)
CleanupResources();
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
PRBool forceAccelerate = PR_FALSE;
if (prefs) {
// we should use AddBoolPrefVarCache
prefs->GetBoolPref("layers.acceleration.force-enabled",
&forceAccelerate);
}
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
if (status != nsIGfxInfo::FEATURE_NO_INFO) {
if (status != nsIGfxInfo::FEATURE_NO_INFO && !forceAccelerate) {
NS_WARNING("OpenGL-accelerated layers are not supported on this system.");
return PR_FALSE;
}
@ -598,6 +611,8 @@ LayerManagerOGL::Render()
// Render our layers.
RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() && !mTarget ? 0 : mBackBufferFBO,
nsIntPoint(0, 0));
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(mWidget)->DrawOver(this, rect);
DEBUG_GL_ERROR_CHECK(mGLContext);

View File

@ -48,11 +48,16 @@
namespace mozilla {
namespace layers {
#if defined(DEBUG) && defined(MOZ_ENABLE_LIBXUL)
#define CHECK_CURRENT_PROGRAM 1
#define ASSERT_THIS_PROGRAM \
do { \
NS_ASSERTION(mGL->GetUserData(&sCurrentProgramKey) == this, \
"SetUniform with wrong program active!"); \
} while (0)
#else
#define ASSERT_THIS_PROGRAM
#endif
struct UniformValue {
UniformValue() {
@ -105,7 +110,9 @@ struct UniformValue {
class LayerManagerOGLProgram {
protected:
#ifdef CHECK_CURRENT_PROGRAM
static int sCurrentProgramKey;
#endif
public:
typedef mozilla::gl::GLContext GLContext;
@ -132,7 +139,9 @@ public:
void Activate() {
NS_ASSERTION(mProgram != 0, "Attempting to activate a program that's not in use!");
mGL->fUseProgram(mProgram);
#if CHECK_CURRENT_PROGRAM
mGL->SetUserData(&sCurrentProgramKey, this);
#endif
}
void SetUniform(GLuint aUniform, float aFloatValue) {

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