This commit is contained in:
Robert Sayre 2010-10-28 21:26:36 -04:00
Родитель 9123b2392c 1ace32573c
Коммит 3c95414f0e
245 изменённых файлов: 5531 добавлений и 4425 удалений

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

@ -91,14 +91,6 @@ nsAccDocManager::FindAccessibleInCache(nsINode* aNode) const
return arg.mAccessible;
}
void
nsAccDocManager::ShutdownDocAccessiblesInTree(nsIDocument *aDocument)
{
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(container);
ShutdownDocAccessiblesInTree(treeItem, aDocument);
}
////////////////////////////////////////////////////////////////////////////////
// nsAccDocManager protected
@ -132,21 +124,6 @@ nsAccDocManager::Shutdown()
ClearDocCache();
}
void
nsAccDocManager::ShutdownDocAccessible(nsIDocument *aDocument)
{
nsDocAccessible* docAccessible = mDocAccessibleCache.GetWeak(aDocument);
if (!docAccessible)
return;
// We're allowed to not remove listeners when accessible document is shutdown
// since we don't keep strong reference on chrome event target and listeners
// are removed automatically when chrome event target goes away.
docAccessible->Shutdown();
mDocAccessibleCache.Remove(aDocument);
}
////////////////////////////////////////////////////////////////////////////////
// nsISupports
@ -316,7 +293,14 @@ nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent)
return NS_OK;
// Shutdown this one and sub document accessibles.
ShutdownDocAccessiblesInTree(document);
// We're allowed to not remove listeners when accessible document is
// shutdown since we don't keep strong reference on chrome event target and
// listeners are removed automatically when chrome event target goes away.
nsDocAccessible* docAccessible = mDocAccessibleCache.GetWeak(document);
if (docAccessible)
docAccessible->Shutdown();
return NS_OK;
}
@ -500,35 +484,6 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
return docAcc;
}
void
nsAccDocManager::ShutdownDocAccessiblesInTree(nsIDocShellTreeItem *aTreeItem,
nsIDocument *aDocument)
{
nsCOMPtr<nsIDocShellTreeNode> treeNode(do_QueryInterface(aTreeItem));
if (treeNode) {
PRInt32 subDocumentsCount = 0;
treeNode->GetChildCount(&subDocumentsCount);
for (PRInt32 idx = 0; idx < subDocumentsCount; idx++) {
nsCOMPtr<nsIDocShellTreeItem> treeItemChild;
treeNode->GetChildAt(idx, getter_AddRefs(treeItemChild));
NS_ASSERTION(treeItemChild, "No tree item when there should be");
if (!treeItemChild)
continue;
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(treeItemChild));
nsCOMPtr<nsIContentViewer> contentViewer;
docShell->GetContentViewer(getter_AddRefs(contentViewer));
if (!contentViewer)
continue;
ShutdownDocAccessiblesInTree(treeItemChild, contentViewer->GetDocument());
}
}
ShutdownDocAccessible(aDocument);
}
////////////////////////////////////////////////////////////////////////////////
// nsAccDocManager static

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

@ -75,13 +75,6 @@ public:
*/
nsAccessible* FindAccessibleInCache(nsINode* aNode) const;
/**
* Shutdown document accessibles in the tree starting from the given one.
*
* @param aDocument [in] the DOM document of start document accessible
*/
void ShutdownDocAccessiblesInTree(nsIDocument *aDocument);
/**
* Return document accessible from the cache. Convenient method for testing.
*/
@ -90,6 +83,14 @@ public:
return mDocAccessibleCache.GetWeak(aDocument);
}
/**
* Called by document accessible when it gets shutdown.
*/
inline void NotifyOfDocumentShutdown(nsIDocument* aDocument)
{
mDocAccessibleCache.Remove(aDocument);
}
protected:
nsAccDocManager() { };
@ -103,11 +104,6 @@ protected:
*/
void Shutdown();
/**
* Shutdown the document accessible.
*/
void ShutdownDocAccessible(nsIDocument* aDocument);
private:
nsAccDocManager(const nsAccDocManager&);
nsAccDocManager& operator =(const nsAccDocManager&);
@ -156,12 +152,6 @@ private:
*/
nsDocAccessible *CreateDocOrRootAccessible(nsIDocument *aDocument);
/**
* Shutdown document accessibles in the tree starting from given tree item.
*/
void ShutdownDocAccessiblesInTree(nsIDocShellTreeItem *aTreeItem,
nsIDocument *aDocument);
typedef nsRefPtrHashtable<nsPtrHashKey<const nsIDocument>, nsDocAccessible>
nsDocAccessibleHashtable;

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

@ -382,7 +382,8 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType)
PRInt16 vPercent, hPercent;
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
return shell->ScrollContentIntoView(content, vPercent, hPercent);
return shell->ScrollContentIntoView(content, vPercent, hPercent,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
NS_IMETHODIMP

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

@ -543,7 +543,10 @@ nsAccessibilityService::PresShellDestroyed(nsIPresShell *aPresShell)
return;
NS_LOG_ACCDOCDESTROY("presshell destroyed", doc)
ShutdownDocAccessible(doc);
nsDocAccessible* docAccessible = GetDocAccessibleFromCache(doc);
if (docAccessible)
docAccessible->Shutdown();
}
void

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

@ -2368,7 +2368,8 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
// Scroll into view.
presShell->ScrollContentIntoView(aContent, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE);
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
// Fire mouse down and mouse up events.
PRBool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,

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

@ -675,6 +675,10 @@ nsDocAccessible::Shutdown()
mParent->RemoveChild(this);
}
PRUint32 childDocCount = mChildDocuments.Length();
for (PRUint32 idx = 0; idx < childDocCount; idx++)
mChildDocuments[idx]->Shutdown();
mChildDocuments.Clear();
mWeakShell = nsnull; // Avoid reentrancy
@ -686,6 +690,8 @@ nsDocAccessible::Shutdown()
mDocument = nsnull;
nsHyperTextAccessibleWrap::Shutdown();
GetAccService()->NotifyOfDocumentShutdown(kungFuDeathGripDoc);
}
nsIFrame*

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

@ -169,7 +169,7 @@ nsOuterDocAccessible::Shutdown()
if (childAcc) {
NS_LOG_ACCDOCDESTROY("outerdoc's child document shutdown",
childAcc->GetDocumentNode())
GetAccService()->ShutdownDocAccessiblesInTree(childAcc->GetDocumentNode());
childAcc->Shutdown();
}
nsAccessibleWrap::Shutdown();

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

@ -972,8 +972,9 @@ var PlacesStarButton = {
this.updateState();
this._batching = false;
},
onItemAdded: function PSB_onItemAdded(aItemId, aFolder, aIndex, aItemType) {
onItemAdded: function PSB_onItemAdded(aItemId, aFolder, aIndex, aItemType,
aURI) {
if (!this._batching && !this._starred)
this.updateState();
},

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

@ -3985,6 +3985,27 @@ var XULBrowserWindow = {
encodeURIComponent);
gURLBar.setOverLink(link);
},
// Called before links are navigated to to allow us to retarget them if needed.
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
// Don't modify non-default targets or targets that aren't in top-level app
// tab docshells (isAppTab will be false for app tab subframes).
if (originalTarget != "" || !isAppTab)
return originalTarget;
let docURI = linkNode.ownerDocument.documentURIObject;
try {
let docURIDomain = Services.eTLD.getBaseDomain(docURI, 0);
let linkURIDomain = Services.eTLD.getBaseDomain(linkURI, 0);
// External links from within app tabs should always open in new tabs
// instead of replacing the app tab's page (Bug 575561)
if (docURIDomain != linkURIDomain)
return "_blank";
} catch(e) {
// If getBaseDomain fails, we return originalTarget below.
}
return originalTarget;
},
onLinkIconAvailable: function (aIconURL) {
if (gProxyFavIcon && gBrowser.userTypedValue === null)
@ -7486,6 +7507,7 @@ let gPrivateBrowsingUI = {
// temporary fix until bug 463607 is fixed
document.getElementById("Tools:Sanitize").setAttribute("disabled", "true");
let docElement = document.documentElement;
if (this._privateBrowsingService.autoStarted) {
// Disable the menu item in auto-start mode
document.getElementById("privateBrowsingItem")
@ -7496,15 +7518,16 @@ let gPrivateBrowsingUI = {
#endif
document.getElementById("Tools:PrivateBrowsing")
.setAttribute("disabled", "true");
if (window.location.href == getBrowserURL())
docElement.setAttribute("privatebrowsingmode", "permanent");
}
else if (window.location.href == getBrowserURL()) {
// Adjust the window's title
let docElement = document.documentElement;
docElement.setAttribute("title",
docElement.getAttribute("title_privatebrowsing"));
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_privatebrowsing"));
docElement.setAttribute("browsingmode", "private");
docElement.setAttribute("privatebrowsingmode", "temporary");
gBrowser.updateTitlebar();
}
@ -7551,7 +7574,7 @@ let gPrivateBrowsingUI = {
docElement.getAttribute("title_normal"));
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_normal"));
docElement.setAttribute("browsingmode", "normal");
docElement.removeAttribute("privatebrowsingmode");
}
// Enable the menu item in after exiting the auto-start mode

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

@ -826,12 +826,7 @@
#ifdef WINCE
defaulticonsize="small" iconsize="small"
#endif
#ifdef XP_WIN
tabsontop="true"
#endif
#ifdef XP_MACOSX
tabsontop="true"
#endif
persist="tabsontop">
<!-- Menu -->
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
@ -1014,7 +1009,9 @@
key="manBookmarkKb"/>
<menuseparator/>
<menuitem id="BMB_bookmarkThisPage"
#ifndef XP_MACOSX
class="menuitem-iconic"
#endif
label="&bookmarkThisPageCmd.label;"
command="Browser:AddBookmarkAs"
key="addBookmarkAsKb"/>

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

@ -191,6 +191,8 @@
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
this.getBrowserForTab(aTab).docShell.isAppTab = true;
let event = document.createEvent("Events");
event.initEvent("TabPinned", true, false);
aTab.dispatchEvent(event);
@ -210,6 +212,8 @@
this.tabContainer._positionPinnedTabs();
this.tabContainer.adjustTabstrip();
this.getBrowserForTab(aTab).docShell.isAppTab = false;
let event = document.createEvent("Events");
event.initEvent("TabUnpinned", true, false);
aTab.dispatchEvent(event);

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

@ -145,6 +145,7 @@ _BROWSER_FILES = \
browser_bug561636.js \
browser_bug562649.js \
browser_bug563588.js \
browser_bug575561.js \
browser_bug577121.js \
browser_bug579872.js \
browser_bug580956.js \
@ -218,6 +219,8 @@ _BROWSER_FILES = \
file_bug550565_favicon.ico \
browser_overLinkInLocationBar.js \
browser_aboutHome.js \
app_bug575561.html \
app_subframe_bug575561.html \
$(NULL)
# compartment-disabled

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

@ -0,0 +1,16 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=575561
-->
<head>
<title>Test for links in app tabs</title>
</head>
<body>
<a href="http://example.com/browser/browser/base/content/test/dummy_page.html">same domain</a>
<a href="http://test1.example.com/browser/browser/base/content/test/dummy_page.html">same domain (different subdomain)</a>
<a href="http://example.org/browser/browser/base/content/test/dummy_page.html">different domain</a>
<a href="http://example.org/browser/browser/base/content/test/dummy_page.html" target="foo">different domain (with target)</a>
<iframe src="app_subframe_bug575561.html"></iframe>
</body>
</html>

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=575561
-->
<head>
<title>Test for links in app tab subframes</title>
</head>
<body>
<a href="http://example.org/browser/browser/base/content/test/dummy_page.html">different domain</a>
</body>
</html>

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

@ -608,6 +608,15 @@ function test() {
Services.obs.addObserver(XPInstallObserver, "addon-install-complete", false);
registerCleanupFunction(function() {
// Make sure no more test parts run in case we were timed out
TESTS = [];
AddonManager.getAllInstalls(function(aInstalls) {
aInstalls.forEach(function(aInstall) {
aInstall.cancel();
});
});
Services.prefs.clearUserPref("extensions.logging.enabled");
Services.obs.removeObserver(XPInstallObserver, "addon-install-started");

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

@ -0,0 +1,73 @@
function test() {
waitForExplicitFinish();
// Pinned: Link to the same domain should not open a new tab
// Tests link to http://example.com/browser/browser/base/content/test/dummy_page.html
testLink(0, true, false, function() {
// Pinned: Link to the same domain should not open a new tab
// Tests link to http://test1.example.com/browser/browser/base/content/test/dummy_page.html
testLink(1, true, false, function() {
// Pinned: Link to a different domain should open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html
testLink(2, true, true, function() {
// Not Pinned: Link to a different domain should not open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html
testLink(2, false, false, function() {
// Pinned: Targetted link should open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html with target="foo"
testLink(3, true, true, function() {
// Pinned: Link in a subframe should not open a new tab
// Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html in subframe
testLink(0, true, false, finish, true);
});
});
});
});
});
}
function testLink(aLinkIndex, pinTab, expectNewTab, nextTest, testSubFrame) {
let appTab = gBrowser.addTab("http://example.com/browser/browser/base/content/test/app_bug575561.html", {skipAnimation: true});
if (pinTab)
gBrowser.pinTab(appTab);
gBrowser.selectedTab = appTab;
appTab.linkedBrowser.addEventListener("load", onLoad, true);
let loadCount = 0;
function onLoad() {
loadCount++;
if (loadCount < 2)
return;
appTab.linkedBrowser.removeEventListener("load", onLoad, true);
let browser = gBrowser.getBrowserForTab(appTab);
if (testSubFrame)
browser = browser.contentDocument.getElementsByTagName("iframe")[0];
let links = browser.contentDocument.getElementsByTagName("a");
if (expectNewTab)
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
else
browser.addEventListener("load", onPageLoad, true);
info("Clicking " + links[aLinkIndex].textContent);
EventUtils.sendMouseEvent({type:"click"}, links[aLinkIndex], browser.contentWindow);
function onPageLoad() {
browser.removeEventListener("load", onPageLoad, true);
is(browser.contentDocument.location.href, links[aLinkIndex].href, "Link should not open in a new tab");
gBrowser.removeTab(appTab);
nextTest();
}
function onTabOpen(event) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
ok(true, "Link should open a new tab");
gBrowser.removeTab(appTab);
gBrowser.removeCurrentTab();
nextTest();
}
}
}

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

@ -68,6 +68,7 @@ _BROWSER_FILES = \
browser_tabview_startup_transitions.js \
browser_tabview_undo_group.js \
browser_tabview_firstrun_pref.js \
head.js \
search1.html \
search2.html \
$(NULL)

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

@ -59,7 +59,7 @@ function test() {
"The currently selected tab should be the first tab in the groupItemOne");
// create another group with a tab.
let groupItemTwo = createEmptyGroupItem(contentWindow, 200);
let groupItemTwo = createEmptyGroupItem(contentWindow, 300, 300, 200);
let onTabViewHidden = function() {
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
@ -111,16 +111,3 @@ function testGroupSwitch(contentWindow, groupItemOne, groupItemTwo) {
finish();
}
function createEmptyGroupItem(contentWindow, padding) {
let pageBounds = contentWindow.Items.getPageBounds();
pageBounds.inset(padding, padding);
let box = new contentWindow.Rect(pageBounds);
box.width = 300;
box.height = 300;
let emptyGroupItem = new contentWindow.GroupItem([], { bounds: box });
return emptyGroupItem;
}

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

@ -95,10 +95,8 @@ function addTest(contentWindow, groupOneId, groupTwoId, originalTab) {
ok(tabItem, "The tab item exists");
// calculate the offsets
let groupTwoRect = groupTwo.getBounds();
let groupTwoRectCenter = groupTwoRect.center();
let tabItemRect = tabItem.getBounds();
let tabItemRectCenter = tabItemRect.center();
let groupTwoRectCenter = groupTwo.getBounds().center();
let tabItemRectCenter = tabItem.getBounds().center();
let offsetX =
Math.round(groupTwoRectCenter.x - tabItemRectCenter.x);
let offsetY =
@ -132,41 +130,23 @@ function addTest(contentWindow, groupOneId, groupTwoId, originalTab) {
simulateDragDrop(tabItem.container, offsetX, offsetY, contentWindow);
}
function simulateDragDrop(tabItem, offsetX, offsetY, contentWindow) {
// enter drag mode
let dataTransfer;
function simulateDragDrop(element, offsetX, offsetY, contentWindow) {
let rect = element.getBoundingClientRect();
let startX = (rect.right - rect.left)/2;
let startY = (rect.bottom - rect.top)/2;
let incrementX = offsetX / 2;
let incrementY = offsetY / 2;
EventUtils.synthesizeMouse(
tabItem, 1, 1, { type: "mousedown" }, contentWindow);
event = contentWindow.document.createEvent("DragEvents");
event.initDragEvent(
"dragenter", true, true, contentWindow, 0, 0, 0, 0, 0,
false, false, false, false, 1, null, dataTransfer);
tabItem.dispatchEvent(event);
// drag over
if (offsetX || offsetY) {
let Ci = Components.interfaces;
let utils = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
let rect = tabItem.getBoundingClientRect();
for (let i = 1; i <= 5; i++) {
let left = rect.left + Math.round(i * offsetX / 5);
let top = rect.top + Math.round(i * offsetY / 5);
utils.sendMouseEvent("mousemove", left, top, 0, 1, 0);
}
event = contentWindow.document.createEvent("DragEvents");
event.initDragEvent(
"dragover", true, true, contentWindow, 0, 0, 0, 0, 0,
false, false, false, false, 0, null, dataTransfer);
tabItem.dispatchEvent(event);
}
element, startX, startY, { type: "mousedown" });
// drop
EventUtils.synthesizeMouse(tabItem, 0, 0, { type: "mouseup" }, contentWindow);
event = contentWindow.document.createEvent("DragEvents");
event.initDragEvent(
"drop", true, true, contentWindow, 0, 0, 0, 0, 0,
false, false, false, false, 0, null, dataTransfer);
tabItem.dispatchEvent(event);
for (let i = 1; i <= 2; i++) {
EventUtils.synthesizeMouse(
element, (startX + incrementX * i), (startY + incrementY * i),
{ type: "mousemove" });
}
EventUtils.synthesizeMouse(
element, (startX + incrementX * 2), (startY + incrementY * 2),
{ type: "mouseup" });
}

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

@ -65,7 +65,7 @@ function testEmptyGroupItem(contentWindow) {
let groupItemCount = contentWindow.GroupItems.groupItems.length;
// create empty group item
let emptyGroupItem = createEmptyGroupItem(contentWindow, 100);
let emptyGroupItem = createEmptyGroupItem(contentWindow, 300, 300, 100, true);
ok(emptyGroupItem.isEmpty(), "This group is empty");
is(contentWindow.GroupItems.groupItems.length, ++groupItemCount,
@ -89,7 +89,7 @@ function testEmptyGroupItem(contentWindow) {
}
function testGroupItemWithTabItem(contentWindow) {
let groupItem = createEmptyGroupItem(contentWindow, 200);
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200, true);
let tabItemCount = 0;
let onTabViewHidden = function() {
@ -161,17 +161,3 @@ function testGroupItemWithTabItem(contentWindow) {
EventUtils.synthesizeMouse(newTabButton[0], 1, 1, {}, contentWindow);
}
function createEmptyGroupItem(contentWindow, padding) {
let pageBounds = contentWindow.Items.getPageBounds();
pageBounds.inset(padding, padding);
let box = new contentWindow.Rect(pageBounds);
box.width = 300;
box.height = 300;
let emptyGroupItem = new contentWindow.GroupItem([], { bounds: box,
immediately: true });
return emptyGroupItem;
}

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

@ -67,7 +67,7 @@ function onTabViewWindowLoaded() {
is(contentWindow.GroupItems.getOrphanedTabs().length, 0, "No orphaned tabs");
// 2) create a group, add a blank tab
let groupItem = createEmptyGroupItem(contentWindow, 200);
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200);
let onTabViewHidden = function() {
newWin.removeEventListener("tabviewhidden", onTabViewHidden, false);
@ -110,19 +110,6 @@ function onTabViewWindowLoaded() {
EventUtils.sendMouseEvent({ type: "click" }, newTabButton[0], contentWindow);
}
function createEmptyGroupItem(contentWindow, padding) {
let pageBounds = contentWindow.Items.getPageBounds();
pageBounds.inset(padding, padding);
let box = new contentWindow.Rect(pageBounds);
box.width = 300;
box.height = 300;
let emptyGroupItem = new contentWindow.GroupItem([], { bounds: box });
return emptyGroupItem;
}
function whenWindowObservesOnce(win, topic, callback) {
let windowWatcher =
Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);

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

@ -1,4 +1,3 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -12,14 +11,15 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Fenntrolysis.
* The Original Code is the utilities for tabview.
*
* The Initial Developer of the Original Code is
* Nokia.
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Raymond Lee <raymond@appcoast.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
@ -35,20 +35,17 @@
*
* ***** END LICENSE BLOCK ***** */
include protocol PBrowser;
function createEmptyGroupItem(contentWindow, width, height, padding, noAnimation) {
let pageBounds = contentWindow.Items.getPageBounds();
pageBounds.inset(padding, padding);
namespace mozilla {
namespace ipc {
let box = new contentWindow.Rect(pageBounds);
box.width = width;
box.height = height;
let immediately = noAnimation ? true: false;
let emptyGroupItem =
new contentWindow.GroupItem([], { bounds: box, immediately: immediately });
protocol PDocumentRendererNativeID
{
manager PBrowser;
parent:
// Returns the offset, width and height, in pixels, of the area in the
// buffer that was drawn.
__delete__(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, PRUint32 nativeID);
};
} // namespace ipc
} // namespace mozilla
return emptyGroupItem;
}

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

@ -130,11 +130,24 @@
if (!pasteAndGo)
return;
var controller = document.commandDispatcher.getControllerForCommand("cmd_paste");
var enabled = controller.isCommandEnabled("cmd_paste");
if (enabled)
pasteAndGo.removeAttribute("disabled");
else
pasteAndGo.setAttribute("disabled", "true");
var couldBeURL = controller.isCommandEnabled("cmd_paste");
if (couldBeURL) {
let cbSvc = Cc["@mozilla.org/widget/clipboard;1"].
getService(Ci.nsIClipboard);
let xferable = Cc["@mozilla.org/widget/transferable;1"].
createInstance(Ci.nsITransferable);
xferable.addDataFlavor("text/unicode");
cbSvc.getData(xferable, cbSvc.kGlobalClipboard);
let data = {};
xferable.getTransferData("text/unicode", data, {});
data = data.value.QueryInterface(Ci.nsISupportsString).data;
try {
makeURI(data);
} catch (ex) { // clipboard data is not a URL
couldBeURL = false;
}
}
pasteAndGo.hidden = !couldBeURL;
}, false);
var insertLocation = cxmenu.firstChild;
@ -147,7 +160,8 @@
GetStringFromName("pasteAndGo.label");
pasteAndGo.setAttribute("label", label);
pasteAndGo.setAttribute("anonid", "paste-and-go");
pasteAndGo.setAttribute("oncommand", "goDoCommand('cmd_paste'); gURLBar.handleCommand();");
pasteAndGo.setAttribute("oncommand",
"gURLBar.value = ''; goDoCommand('cmd_paste'); gURLBar.handleCommand();");
cxmenu.insertBefore(pasteAndGo, insertLocation.nextSibling);
}
]]></constructor>

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

@ -1161,7 +1161,8 @@ var gEditItemOverlay = {
this._folderMenuList.selectedItem = folderItem;
},
onItemAdded: function EIO_onItemAdded(aItemId, aFolder, aIndex, aItemType) {
onItemAdded: function EIO_onItemAdded(aItemId, aFolder, aIndex, aItemType,
aURI) {
this._lastNewItem = aItemId;
},

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

@ -46,8 +46,6 @@
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
<!DOCTYPE page [
<!ENTITY % historyDTD SYSTEM "chrome://browser/locale/history/history.dtd">
%historyDTD;
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;
]>

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

@ -391,7 +391,7 @@
<vbox id="defaultView" flex="1">
<vbox id="searchModifiers" hidden="true">
<toolbar id="organizerScopeBar" class="chromeclass-toolbar" align="center">
<label id="scopeBarTitle" value="&search.label;"/>
<label id="scopeBarTitle" value="&search.in.label;"/>
<toolbarbutton id="scopeBarAll" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeBookmarks.label;"

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

@ -204,7 +204,7 @@ var bookmarksObserver = {
},
// nsINavBookmarkObserver
onItemAdded: function PSB_onItemAdded(aItemId, aFolderId, aIndex) {
onItemAdded: function PSB_onItemAdded(aItemId, aFolderId, aIndex, aURI) {
var node = null;
var index = null;
[node, index] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places);

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

@ -223,7 +223,7 @@ var bookmarksObserver = {
// nsINavBookmarkObserver
onItemAdded: function PSB_onItemAdded(aItemId, aFolderId, aIndex,
aItemType) {
aItemType, aURI) {
var views = getViewsForFolder(aFolderId);
ok(views.length > 0, "Found affected views (" + views.length + "): " + views);

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

@ -53,7 +53,7 @@ var observer = {
onEndUpdateBatch: function() {
this._endUpdateBatch = true;
},
onItemAdded: function(id, folder, index, itemType) {
onItemAdded: function(id, folder, index, itemType, uri) {
this._itemAddedId = id;
this._itemAddedParent = folder;
this._itemAddedIndex = index;

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

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
// This test makes sure that browsingmode attribute of the window is correctly
// This test makes sure that privatebrowsingmode attribute of the window is correctly
// switched with private browsing mode changes.
function test() {
@ -45,20 +45,20 @@ function test() {
getService(Ci.nsIPrivateBrowsingService);
let docRoot = document.documentElement;
is(docRoot.getAttribute("browsingmode"), "normal",
"browsingmode should be \"normal\" initially");
ok(!docRoot.hasAttribute("privatebrowsingmode"),
"privatebrowsingmode should not be present in normal mode");
// enter private browsing mode
pb.privateBrowsingEnabled = true;
is(docRoot.getAttribute("browsingmode"), "private",
"browsingmode should be \"private\" inside the private browsing mode");
is(docRoot.getAttribute("privatebrowsingmode"), "temporary",
"privatebrowsingmode should be \"temporary\" inside the private browsing mode");
// leave private browsing mode
pb.privateBrowsingEnabled = false;
is(docRoot.getAttribute("browsingmode"), "normal",
"browsingmode should be \"normal\" outside the private browsing mode");
ok(!docRoot.hasAttribute("privatebrowsingmode"),
"privatebrowsingmode should not be present in normal mode");
// cleanup
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");

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

@ -604,7 +604,8 @@
label = this._stringBundle.getString("cmd_pasteAndSearch");
element.setAttribute("label", label);
element.setAttribute("anonid", "paste-and-search");
element.setAttribute("oncommand", "goDoCommand('cmd_paste'); document.getElementById('searchbar').handleSearchCommand();");
element.setAttribute("oncommand",
"BrowserSearch.searchBar.value = ''; goDoCommand('cmd_paste'); BrowserSearch.searchBar.handleSearchCommand();");
cxmenu.insertBefore(element, insertLocation.nextSibling);
pasteAndSearch = element;
}

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

@ -36,6 +36,7 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
var gStateObject;
var gTreeData;
@ -54,13 +55,26 @@ window.onload = function() {
return;
}
}
// remove unneeded braces (added for compatibility with Firefox 2.0 and 3.0)
if (sessionData.value.charAt(0) == '(')
sessionData.value = sessionData.value.slice(1, -1);
try {
gStateObject = JSON.parse(sessionData.value);
}
catch (exJSON) {
var s = new Cu.Sandbox("about:blank");
gStateObject = Cu.evalInSandbox("(" + sessionData.value + ")", s);
// If we couldn't parse the string with JSON.parse originally, make sure
// that the value in the textbox will be parsable.
sessionData.value = JSON.stringify(gStateObject);
}
// make sure the data is tracked to be restored in case of a subsequent crash
var event = document.createEvent("UIEvents");
event.initUIEvent("input", true, true, window, 0);
sessionData.dispatchEvent(event);
gStateObject = JSON.parse(sessionData.value);
initTreeView();
document.getElementById("errorTryAgain").focus();

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

@ -1268,15 +1268,32 @@ SessionStoreService.prototype = {
},
getTabValue: function sss_getTabValue(aTab, aKey) {
var data = aTab.__SS_extdata || {};
let data = {};
if (aTab.__SS_extdata) {
data = aTab.__SS_extdata;
}
else if (aTab.linkedBrowser.__SS_data && aTab.linkedBrowser.__SS_data.extData) {
// If the tab hasn't been fully restored, get the data from the to-be-restored data
data = aTab.linkedBrowser.__SS_data.extData;
}
return data[aKey] || "";
},
setTabValue: function sss_setTabValue(aTab, aKey, aStringValue) {
if (!aTab.__SS_extdata) {
aTab.__SS_extdata = {};
// If the tab hasn't been restored, then set the data there, otherwise we
// could lose newly added data.
let saveTo;
if (aTab.__SS_extdata) {
saveTo = aTab.__SS_extdata;
}
aTab.__SS_extdata[aKey] = aStringValue;
else if (aTab.linkedBrowser.__SS_data && aTab.linkedBrowser.__SS_data.extData) {
saveTo = aTab.linkedBrowser.__SS_data.extData;
}
else {
aTab.__SS_extdata = {};
saveTo = aTab.__SS_extdata;
}
saveTo[aKey] = aStringValue;
this.saveStateDelayed(aTab.ownerDocument.defaultView);
},

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

@ -117,8 +117,10 @@ _BROWSER_TEST_FILES = \
browser_579868.js \
browser_579879.js \
browser_580512.js \
browser_581593.js \
browser_586147.js \
browser_586068-cascaded_restore.js \
browser_590268.js \
browser_600545.js \
$(NULL)

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

@ -0,0 +1,90 @@
/* ***** 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 sessionstore test 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):
* Paul OShannessy <paul@oshannessy.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 ***** */
Cu.import("resource://gre/modules/Services.jsm");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
let stateBackup = ss.getBrowserState();
function test() {
/** Test for bug 581593 **/
waitForExplicitFinish();
let oldState = { windows: [{ tabs: [{ entries: [{ url: "example.com" }] }] }]};
let pageData = {
url: "about:sessionrestore",
formdata: { "#sessionData": "(" + JSON.stringify(oldState) + ")" }
};
let state = { windows: [{ tabs: [{ entries: [pageData] }] }] };
// The form data will be restored before SSTabRestored, so we want to listen
// for that on the currently selected tab (it will be reused)
gBrowser.selectedTab.addEventListener("SSTabRestored", onSSTabRestored, true);
ss.setBrowserState(JSON.stringify(state));
}
function onSSTabRestored(aEvent) {
info("SSTabRestored event");
gBrowser.selectedTab.removeEventListener("SSTabRestored", onSSTabRestored, true);
gBrowser.selectedBrowser.addEventListener("input", onInput, true);
}
function onInput(aEvent) {
info("input event");
gBrowser.selectedBrowser.removeEventListener("input", onInput, true);
// This is an ok way to check this because we will make sure that the text
// field is parsable.
let val = gBrowser.selectedBrowser.contentDocument.getElementById("sessionData").value;
try {
JSON.parse(val);
ok(true, "JSON.parse succeeded");
}
catch (e) {
ok(false, "JSON.parse failed");
}
cleanup();
}
function cleanup() {
ss.setBrowserState(stateBackup);
executeSoon(finish);
}

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

@ -0,0 +1,148 @@
/* ***** 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 sessionstore test 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):
* Paul OShannessy <paul@oshannessy.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 ***** */
const NUM_TABS = 12;
Cu.import("resource://gre/modules/Services.jsm");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
let stateBackup = ss.getBrowserState();
function test() {
/** Test for Bug 590268 - Provide access to sessionstore tab data sooner **/
waitForExplicitFinish();
let startedTest = false;
// wasLoaded will be used to keep track of tabs that have already had SSTabRestoring
// fired for them.
let wasLoaded = { };
let restoringTabsCount = 0;
let uniq2 = { };
let uniq2Count = 0;
let state = { windows: [{ tabs: [] }] };
// We're going to put a bunch of tabs into this state
for (let i = 0; i < NUM_TABS; i++) {
let uniq = r();
let tabData = {
entries: [{ url: "http://example.com/#" + i }],
extData: { "uniq": uniq }
};
state.windows[0].tabs.push(tabData);
wasLoaded[uniq] = false;
}
function onSSTabRestoring(aEvent) {
restoringTabsCount++;
let uniq = ss.getTabValue(aEvent.originalTarget, "uniq");
wasLoaded[uniq] = true;
// On the first SSTabRestoring we're going to run the the real test.
// We'll keep this listener around so we can keep marking tabs as restored.
if (restoringTabsCount == 1)
onFirstSSTabRestoring();
else if (restoringTabsCount == NUM_TABS)
onLastSSTabRestoring();
}
// This does the actual testing. SSTabRestoring should be firing on tabs from
// left to right, so we're going to start with the rightmost tab.
function onFirstSSTabRestoring() {
info("onFirstSSTabRestoring...");
for (let i = gBrowser.tabs.length - 1; i >= 0; i--) {
let tab = gBrowser.tabs[i];
let actualUniq = ss.getTabValue(tab, "uniq");
let expectedUniq = state.windows[0].tabs[i].extData["uniq"];
if (wasLoaded[actualUniq]) {
info("tab " + i + ": already restored");
continue;
}
is(actualUniq, expectedUniq, "tab " + i + ": extData was correct");
// Now we're going to set a piece of data back on the tab so it can be read
// to test setting a value "early".
uniq2[actualUniq] = r();
ss.setTabValue(tab, "uniq2", uniq2[actualUniq]);
// This will be used in the final comparison to make sure we checked the
// same number as we set.
uniq2Count++;
}
}
function onLastSSTabRestoring() {
let checked = 0;
for (let i = 0; i < gBrowser.tabs.length; i++) {
let tab = gBrowser.tabs[i];
let uniq = ss.getTabValue(tab, "uniq");
// Look to see if we set a uniq2 value for this uniq value
if (uniq in uniq2) {
is(ss.getTabValue(tab, "uniq2"), uniq2[uniq], "tab " + i + " has correct uniq2 value");
checked++;
}
}
is(checked, uniq2Count, "checked the same number of uniq2 as we set");
cleanup();
}
function cleanup() {
// remove the event listener and clean up before finishing
gBrowser.tabContainer.removeEventListener("SSTabRestoring", onSSTabRestoring, false);
// Put this in an executeSoon because we still haven't called restoreNextTab
// in sessionstore for the last tab (we'll call it after this). We end up
// trying to restore the tab (since we then add a closed tab to the array).
executeSoon(function() {
ss.setBrowserState(stateBackup);
executeSoon(finish);
});
}
// Add the event listener
gBrowser.tabContainer.addEventListener("SSTabRestoring", onSSTabRestoring, false);
// Restore state
ss.setBrowserState(JSON.stringify(state));
}
// Helper function to create a random value
function r() {
return "" + Date.now() + Math.random();
}

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

@ -394,7 +394,7 @@ Bookmark.prototype = {
onEndUpdateBatch : function bm_oeub() {
},
onItemAdded : function bm_oia(aId, aFolder, aIndex) {
onItemAdded : function bm_oia(aId, aFolder, aIndex, aItemType, aURI) {
// bookmark object doesn't exist at this point
},
@ -547,7 +547,7 @@ BookmarkFolder.prototype = {
onEndUpdateBatch : function bmf_oeub() {
},
onItemAdded : function bmf_oia(aId, aFolder, aIndex) {
onItemAdded : function bmf_oia(aId, aFolder, aIndex, aItemType, aURI) {
// handle root folder events
if (!this._parent)
this._events.dispatch("add", aId);

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

@ -1,26 +0,0 @@
<!ENTITY find.label "Search:">
<!ENTITY find.accesskey "S">
<!ENTITY expand.label "Expand">
<!ENTITY expand.accesskey "E">
<!ENTITY collapse.label "Collapse">
<!ENTITY collapse.accesskey "C">
<!ENTITY byDate.label "By Date">
<!ENTITY byDate.accesskey "D">
<!ENTITY bySite.label "By Site">
<!ENTITY bySite.accesskey "S">
<!ENTITY view.label "View">
<!ENTITY view.accesskey "w">
<!ENTITY byMostVisited.label "By Most Visited">
<!ENTITY byMostVisited.accesskey "V">
<!ENTITY byLastVisited.label "By Last Visited">
<!ENTITY byLastVisited.accesskey "L">
<!ENTITY byDayAndSite.label "By Date and Site">
<!ENTITY byDayAndSite.accesskey "t">
<!ENTITY openLinkInWindow.label "Open">
<!ENTITY openLinkInWindow.accesskey "O">
<!ENTITY openInNewTab.label "Open in New Tab">
<!ENTITY openInNewTab.accesskey "T">
<!ENTITY openInNewWindow.label "Open in New Window">
<!ENTITY openInNewWindow.accesskey "W">
<!ENTITY copyLink.label "Copy Link Location">
<!ENTITY copyLink.accesskey "C">

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

@ -94,6 +94,8 @@
<!ENTITY search.label "Search:">
<!ENTITY search.accesskey "S">
<!ENTITY search.in.label "Search in:">
<!ENTITY search.scopeFolder.label "Selected Folder">
<!ENTITY search.scopeFolder.accesskey "r">
<!ENTITY search.scopeBookmarks.label "Bookmarks">
@ -123,3 +125,18 @@
<!ENTITY detailsPane.less.accesskey "e">
<!ENTITY detailsPane.noPreviewAvailable.label "Preview">
<!ENTITY detailsPane.selectAnItemText.description "Select an item to view and edit its properties">
<!ENTITY find.label "Search:">
<!ENTITY find.accesskey "S">
<!ENTITY view.label "View">
<!ENTITY view.accesskey "w">
<!ENTITY byDate.label "By Date">
<!ENTITY byDate.accesskey "D">
<!ENTITY bySite.label "By Site">
<!ENTITY bySite.accesskey "S">
<!ENTITY byMostVisited.label "By Most Visited">
<!ENTITY byMostVisited.accesskey "V">
<!ENTITY byLastVisited.label "By Last Visited">
<!ENTITY byLastVisited.accesskey "L">
<!ENTITY byDayAndSite.label "By Date and Site">
<!ENTITY byDayAndSite.accesskey "t">

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

@ -45,7 +45,6 @@
#endif
locale/browser/feeds/subscribe.dtd (%chrome/browser/feeds/subscribe.dtd)
locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties)
locale/browser/history/history.dtd (%chrome/browser/history/history.dtd)
locale/browser/migration/migration.dtd (%chrome/browser/migration/migration.dtd)
locale/browser/migration/migration.properties (%chrome/browser/migration/migration.properties)
locale/browser/preferences/advanced.dtd (%chrome/browser/preferences/advanced.dtd)

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

@ -474,11 +474,15 @@ menuitem:not([type]) {
#bookmarksToolbarFolderMenu,
#BMB_bookmarksToolbar {
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
}
#BMB_bookmarkThisPage {
list-style-image: url("chrome://browser/skin/places/starPage.png");
}
#BMB_unsortedBookmarks {
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
list-style-image: url("chrome://browser/skin/places/unsortedBookmarks.png");
}
#menu_openDownloads {

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

@ -4,6 +4,8 @@
%define customToolbarColor hsl(214,44%,87%)
%define glassToolbarBorderColor rgb(40%,40%,40%)
%define glassActiveBorderColor rgb(37, 44, 51)
%define glassInactiveBorderColor rgb(102, 102, 102)
@media all and (-moz-windows-default-theme) {
#navigator-toolbox > toolbar:not(:-moz-lwtheme) {
@ -31,6 +33,12 @@
0 0 2px 1px rgba(255,255,255,.25) inset;
}
#main-window[privatebrowsingmode=temporary] #appmenu-button:not(:-moz-window-inactive) {
-moz-border-left-colors: rgba(255,255,255,.5) rgba(43,8,65,.9);
-moz-border-bottom-colors: rgba(255,255,255,.5) rgba(43,8,65,.9);
-moz-border-right-colors: rgba(255,255,255,.5) rgba(43,8,65,.9);
}
#appmenu-button:-moz-window-inactive {
-moz-border-left-colors: rgba(255,255,255,.4) rgba(0,0,0,.5);
-moz-border-bottom-colors: rgba(255,255,255,.4) rgba(0,0,0,.5);
@ -85,6 +93,24 @@
margin-top: -7px;
}
/* Artificially draw window borders that are covered by lwtheme, see bug 591930. */
#main-window[sizemode="normal"] > #titlebar > #titlebar-content:-moz-lwtheme {
border-top: 2px solid;
-moz-border-top-colors: @glassActiveBorderColor@ rgba(255,255,255,.6);
}
#main-window[sizemode="normal"] > #titlebar > #titlebar-content:-moz-lwtheme:-moz-window-inactive {
-moz-border-top-colors: @glassInactiveBorderColor@ rgba(255,255,255,.6);
}
#main-window[sizemode="normal"] > #titlebar > #titlebar-content > #appmenu-button-container:-moz-lwtheme {
margin-top: -1px;
}
#main-window[sizemode="normal"] > #titlebar > #titlebar-content > #titlebar-buttonbox:-moz-lwtheme {
margin-top: -2px;
}
#main-window:not(:-moz-lwtheme)[inFullscreen="true"] {
-moz-appearance: none;
background-color: #556;

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

@ -126,6 +126,11 @@
margin: 0;
}
#main-window[privatebrowsingmode=temporary] #appmenu-button:not(:-moz-window-inactive) {
background-image: -moz-linear-gradient(rgb(153,38,211), rgb(105,19,163) 95%);
border-color: rgba(43,8,65,.9);
}
#appmenu-button:-moz-window-inactive {
background-image: none;
border-color: rgba(0,0,0,.4);
@ -141,6 +146,16 @@
0 -1px 0 rgba(250,234,169,.5) inset;
}
#main-window[privatebrowsingmode=temporary] #appmenu-button:hover:not(:active):not([open]) {
background-image: -moz-radial-gradient(center bottom, farthest-side, rgba(240,193,255,.5) 10%, rgba(240,193,255,0) 70%),
-moz-radial-gradient(center bottom, farthest-side, rgb(192,81,247), rgba(236,172,255,0)),
-moz-linear-gradient(rgb(144,20,207), rgb(95,0,158) 95%);
border-color: rgba(43,8,65,.9);
box-shadow: 0 1px 0 rgba(255,255,255,.1) inset,
0 0 2px 1px rgba(240,193,255,.7) inset,
0 -1px 0 rgba(240,193,255,.5) inset;
}
#appmenu-button:hover:active,
#appmenu-button[open] {
background-image: -moz-linear-gradient(rgb(246,170,69), rgb(209,74,0) 95%);
@ -149,6 +164,11 @@
0 1px 1px rgba(0,0,0,.2) inset;
}
#main-window[privatebrowsingmode=temporary] #appmenu-button:hover:active,
#main-window[privatebrowsingmode=temporary] #appmenu-button[open] {
background-image: -moz-linear-gradient(rgb(144,20,207), rgb(95,0,158) 95%);
}
#appmenu-button > .button-box {
border-style: none;
padding: 0;

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

@ -380,8 +380,7 @@ CSPRep.prototype = {
},
/**
* Generates string representation of the policy. Should be fairly similar
* to the original.
* Generates canonical string representation of the policy.
*/
toString:
function csp_toString() {
@ -607,8 +606,7 @@ CSPSourceList.prototype = {
},
/**
* Generates string representation of the Source List.
* Should be fairly similar to the original.
* Generates canonical string representation of the Source List.
*/
toString:
function() {
@ -639,7 +637,7 @@ CSPSourceList.prototype = {
},
/**
* Makes a new instance that resembles this object.
* Makes a new deep copy of this object.
* @returns
* a new CSPSourceList
*/
@ -951,7 +949,7 @@ CSPSource.fromString = function(aStr, self, enforceSelfChecks) {
// Allow scheme-only sources! These default to wildcard host/port,
// especially since host and port don't always matter.
// Example: "javascript:" and "data:"
if (!sObj._host) sObj._host = "*";
if (!sObj._host) sObj._host = CSPHost.fromString("*");
if (!sObj._port) sObj._port = "*";
} else {
// some host was defined.
@ -1050,8 +1048,7 @@ CSPSource.prototype = {
},
/**
* Generates string representation of the Source.
* Should be fairly similar to the original.
* Generates canonical string representation of the Source.
*/
toString:
function() {
@ -1069,7 +1066,7 @@ CSPSource.prototype = {
},
/**
* Makes a new instance that resembles this object.
* Makes a new deep copy of this object.
* @returns
* a new CSPSource
*/
@ -1172,13 +1169,28 @@ CSPSource.prototype = {
return null;
}
// NOTE: Both sources must have a host, if they don't, something funny is
// going on. The fromString() factory method should have set the host to
// * if there's no host specified in the input. Regardless, if a host is
// not present either the scheme is hostless or any host should be allowed.
// This means we can use the other source's host as the more restrictive
// host expression, or if neither are present, we can use "*", but the
// error should still be reported.
// host
if (!this._host)
newSource._host = that._host;
else if (!that._host)
newSource._host = this._host;
else // both this and that have hosts
if (this._host && that._host) {
newSource._host = this._host.intersectWith(that._host);
} else if (this._host) {
CSPError("intersecting source with undefined host: " + that.toString());
newSource._host = this._host.clone();
} else if (that._host) {
CSPError("intersecting source with undefined host: " + this.toString());
newSource._host = that._host.clone();
} else {
CSPError("intersecting two sources with undefined hosts: " +
this.toString() + " and " + that.toString());
newSource._host = CSPHost.fromString("*");
}
return newSource;
},
@ -1266,8 +1278,7 @@ CSPHost.fromString = function(aStr) {
CSPHost.prototype = {
/**
* Generates string representation of the Source.
* Should be fairly similar to the original.
* Generates canonical string representation of the Host.
*/
toString:
function() {
@ -1275,7 +1286,7 @@ CSPHost.prototype = {
},
/**
* Makes a new instance that resembles this object.
* Makes a new deep copy of this object.
* @returns
* a new CSPHost
*/
@ -1297,7 +1308,7 @@ CSPHost.prototype = {
*/
permits:
function(aHost) {
if (!aHost) return false;
if (!aHost) aHost = CSPHost.fromString("*");
if (!(aHost instanceof CSPHost)) {
// -- compare CSPHost to String

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

@ -3568,18 +3568,18 @@ nsINode::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
}
}
PRUint32 childCount = aChildArray.ChildCount();
NS_ENSURE_TRUE(aIndex <= childCount, NS_ERROR_ILLEGAL_VALUE);
// The id-handling code, and in the future possibly other code, need to
// react to unexpected attribute changes.
nsMutationGuard::DidMutate();
PRBool isAppend = (aIndex == childCount);
// Do this before checking the child-count since this could cause mutations
nsIDocument* doc = GetCurrentDoc();
mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, aNotify);
PRUint32 childCount = aChildArray.ChildCount();
NS_ENSURE_TRUE(aIndex <= childCount, NS_ERROR_ILLEGAL_VALUE);
PRBool isAppend = (aIndex == childCount);
rv = aChildArray.InsertChildAt(aKid, aIndex);
NS_ENSURE_SUCCESS(rv, rv);
if (aIndex == 0) {
@ -4019,6 +4019,8 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
nsresult res = NS_OK;
PRInt32 insPos;
mozAutoDocConditionalContentUpdateBatch batch(GetCurrentDoc(), PR_TRUE);
// Figure out which index to insert at
if (aRefChild) {
insPos = IndexOf(aRefChild);
@ -4080,11 +4082,6 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
}
}
// We want an update batch when we expect several mutations to be performed,
// which is when we're replacing a node, or when we're inserting a fragment.
mozAutoDocConditionalContentUpdateBatch batch(GetCurrentDoc(),
aReplace || nodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE);
// If we're replacing
if (aReplace) {
refContent = GetChildAt(insPos + 1);
@ -5328,7 +5325,7 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
nsIEventStateManager* esm =
aVisitor.mPresContext->EventStateManager();
nsEventStateManager::SetGlobalActiveContent(
nsEventStateManager::SetActiveManager(
static_cast<nsEventStateManager*>(esm), this);
}
}

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

@ -35,6 +35,7 @@
//load('CSPUtils.jsm');
Components.utils.import('resource://gre/modules/CSPUtils.jsm');
Components.utils.import('resource://gre/modules/NetUtil.jsm');
// load the HTTP server
do_load_httpd_js();
@ -190,6 +191,7 @@ test(
//"funny characters (#) should not work for host.");
do_check_eq(null, CSPSource.fromString("a#2-c.com"));
//print(" --- Stop ignoring errors that print ---\n");
//"failed to parse host with port.");
@ -229,6 +231,16 @@ test(
do_check_true(src.permits("https://foobar.com"));
//"src should reject other hosts"
do_check_false(src.permits("https://a.com"));
src = CSPSource.create("javascript:", "https://foobar.com:443");
//"hostless schemes should be parseable."
var aUri = NetUtil.newURI("javascript:alert('foo');");
do_check_true(src.permits(aUri));
//"src should reject other hosts"
do_check_false(src.permits("https://a.com"));
//"nothing else should be allowed"
do_check_false(src.permits("https://foobar.com"));
});
///////////////////// Test the source list //////////////////////

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

@ -53,9 +53,11 @@ public:
DocumentRendererChild();
virtual ~DocumentRendererChild();
bool RenderDocument(nsIDOMWindow *window, const PRInt32& x, const PRInt32& y, const PRInt32& w, const PRInt32& h,
const nsString& bgcolor, const PRUint32& flags, const PRBool& flush,
PRUint32& _width, PRUint32& _height, nsCString& data);
bool RenderDocument(nsIDOMWindow *window,
const nsRect& documentRect, const gfxMatrix& transform,
const nsString& bgcolor,
PRUint32 renderFlags, PRBool flushLayout,
const nsIntSize& renderSize, nsCString& data);
private:

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

@ -54,10 +54,10 @@ public:
void SetCanvasContext(nsICanvasRenderingContextInternal* aCanvas,
gfxContext* ctx);
void DrawToCanvas(PRUint32 aWidth, PRUint32 aHeight,
void DrawToCanvas(const nsIntSize& renderedSize,
const nsCString& aData);
virtual bool Recv__delete__(const PRUint32& w, const PRUint32& h,
virtual bool Recv__delete__(const nsIntSize& renderedSize,
const nsCString& data);
private:

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

@ -120,16 +120,6 @@ public:
// anything into this canvas before changing the shmem state, it will be
// lost.
NS_IMETHOD SetIsIPC(PRBool isIPC) = 0;
// Swap this back buffer with the front, and copy its contents to the new
// back. x, y, w, and h specify the area of |back| that is dirty.
NS_IMETHOD Swap(mozilla::ipc::Shmem& back,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) = 0;
// Sync back and front buffer, move ownership of back buffer to parent
NS_IMETHOD Swap(PRUint32 nativeID,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsICanvasRenderingContextInternal,

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

@ -99,11 +99,16 @@ FlushLayoutForTree(nsIDOMWindow* aWindow)
}
bool
DocumentRendererChild::RenderDocument(nsIDOMWindow *window, const PRInt32& x, const PRInt32& y, const PRInt32& w, const PRInt32& h,
const nsString& aBGColor, const PRUint32& flags, const PRBool& flush,
PRUint32& _width, PRUint32& _height, nsCString& data)
DocumentRendererChild::RenderDocument(nsIDOMWindow *window,
const nsRect& documentRect,
const gfxMatrix& transform,
const nsString& bgcolor,
PRUint32 renderFlags,
PRBool flushLayout,
const nsIntSize& renderSize,
nsCString& data)
{
if (flush)
if (flushLayout)
FlushLayoutForTree(window);
nsCOMPtr<nsPresContext> presContext;
@ -119,26 +124,25 @@ DocumentRendererChild::RenderDocument(nsIDOMWindow *window, const PRInt32& x, co
nscolor bgColor;
nsCSSParser parser;
nsresult rv = parser.ParseColorString(PromiseFlatString(aBGColor),
nsresult rv = parser.ParseColorString(PromiseFlatString(bgcolor),
nsnull, 0, &bgColor);
if (NS_FAILED(rv))
return false;
nsIPresShell* presShell = presContext->PresShell();
nsRect r(x, y, w, h);
_width = nsPresContext::AppUnitsToIntCSSPixels(w);
_height = nsPresContext::AppUnitsToIntCSSPixels(h);
// Draw directly into the output array.
data.SetLength(_width * _height * 4);
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(reinterpret_cast<PRUint8*>(const_cast<char*>(data.get())),
gfxIntSize(_width, _height),
4 * _width, gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
data.SetLength(renderSize.width * renderSize.height * 4);
presShell->RenderDocument(r, flags, bgColor, ctx);
nsRefPtr<gfxImageSurface> surf =
new gfxImageSurface(reinterpret_cast<uint8*>(data.BeginWriting()),
gfxIntSize(renderSize.width, renderSize.height),
4 * renderSize.width,
gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
ctx->SetMatrix(transform);
presShell->RenderDocument(documentRect, renderFlags, bgColor, ctx);
return true;
}

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

@ -1,185 +0,0 @@
/* ***** 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 Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* Nokia.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 ***** */
#ifdef MOZ_WIDGET_QT
#include <QX11Info>
#define DISPLAY QX11Info::display
#endif
#ifdef MOZ_WIDGET_GTK2
#include <gdk/gdkx.h>
#define DISPLAY GDK_DISPLAY
#endif
#include "base/basictypes.h"
#include "gfxImageSurface.h"
#include "gfxPattern.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsCSSParser.h"
#include "nsPresContext.h"
#include "nsCOMPtr.h"
#include "nsColor.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "nsLayoutUtils.h"
#include "mozilla/ipc/DocumentRendererNativeIDChild.h"
#ifdef MOZ_X11
#include "gfxXlibSurface.h"
#endif
using namespace mozilla::ipc;
DocumentRendererNativeIDChild::DocumentRendererNativeIDChild()
{}
DocumentRendererNativeIDChild::~DocumentRendererNativeIDChild()
{}
static void
FlushLayoutForTree(nsIDOMWindow* aWindow)
{
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
if (!piWin)
return;
// Note that because FlushPendingNotifications flushes parents, this
// is O(N^2) in docshell tree depth. However, the docshell tree is
// usually pretty shallow.
nsCOMPtr<nsIDOMDocument> domDoc;
aWindow->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
doc->FlushPendingNotifications(Flush_Layout);
}
nsCOMPtr<nsIDocShellTreeNode> node =
do_QueryInterface(piWin->GetDocShell());
if (node) {
PRInt32 i = 0, i_end;
node->GetChildCount(&i_end);
for (; i < i_end; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
node->GetChildAt(i, getter_AddRefs(item));
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
if (win) {
FlushLayoutForTree(win);
}
}
}
}
bool
DocumentRendererNativeIDChild::RenderDocument(nsIDOMWindow* window, const PRInt32& x,
const PRInt32& y, const PRInt32& w,
const PRInt32& h, const nsString& aBGColor,
const PRUint32& flags, const PRBool& flush,
const gfxMatrix& aMatrix,
const PRInt32& nativeID)
{
if (!nativeID)
return false;
if (flush)
FlushLayoutForTree(window);
nsCOMPtr<nsPresContext> presContext;
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(window);
if (win) {
nsIDocShell* docshell = win->GetDocShell();
if (docshell) {
docshell->GetPresContext(getter_AddRefs(presContext));
}
}
if (!presContext)
return false;
nscolor bgColor;
nsCSSParser parser;
nsresult rv = parser.ParseColorString(PromiseFlatString(aBGColor), nsnull, 0, &bgColor);
if (NS_FAILED(rv))
return false;
nsIPresShell* presShell = presContext->PresShell();
nsRect r(x, y, w, h);
// Draw directly into the output array.
nsRefPtr<gfxASurface> surf;
#ifdef MOZ_X11
// Initialize gfxXlibSurface from native XID by using toolkit functionality
// Would be nice to have gfxXlibSurface(nativeID) implementation
Display* dpy = DISPLAY();
int depth = DefaultDepth(dpy, DefaultScreen(dpy));
XVisualInfo vinfo;
int foundVisual = XMatchVisualInfo(dpy,
DefaultScreen(dpy),
depth,
TrueColor,
&vinfo);
if (!foundVisual)
return false;
surf = new gfxXlibSurface(dpy, nativeID, vinfo.visual);
#else
NS_ERROR("NativeID handler not implemented for your platform");
#endif
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
ctx->SetMatrix(aMatrix);
presShell->RenderDocument(r, flags, bgColor, ctx);
#ifdef MOZ_X11
// We are about to pass this buffer across process boundaries, and when we
// try to read from the surface in the other process, we're not guaranteed
// the drawing has actually happened, as the drawing commands might still
// be queued. By syncing with X, we guarantee the drawing has finished
// before we pass the buffer back.
XSync(dpy, False);
#endif
return true;
}

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

@ -53,33 +53,36 @@ void DocumentRendererParent::SetCanvasContext(nsICanvasRenderingContextInternal*
mCanvasContext = ctx;
}
void DocumentRendererParent::DrawToCanvas(PRUint32 aWidth, PRUint32 aHeight,
void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
const nsCString& aData)
{
if (!mCanvas || !mCanvasContext)
return;
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(reinterpret_cast<PRUint8*>(const_cast<char*>(aData.Data())),
gfxIntSize(aWidth, aHeight),
aWidth * 4,
gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxImageSurface> surf =
new gfxImageSurface(reinterpret_cast<uint8*>(const_cast<nsCString&>(aData).BeginWriting()),
gfxIntSize(aSize.width, aSize.height),
aSize.width * 4,
gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxPattern> pat = new gfxPattern(surf);
gfxRect rect(gfxPoint(0, 0), gfxSize(aSize.width, aSize.height));
mCanvasContext->NewPath();
mCanvasContext->PixelSnappedRectangleAndSetPattern(gfxRect(0, 0, aWidth, aHeight), pat);
mCanvasContext->PixelSnappedRectangleAndSetPattern(rect, pat);
mCanvasContext->Fill();
// get rid of the pattern surface ref, because aData is very likely to go away shortly
// get rid of the pattern surface ref, because aData is very
// likely to go away shortly
mCanvasContext->SetColor(gfxRGBA(1,1,1,1));
gfxRect damageRect = mCanvasContext->UserToDevice(gfxRect(0, 0, aWidth, aHeight));
gfxRect damageRect = mCanvasContext->UserToDevice(rect);
mCanvas->Redraw(damageRect);
}
bool
DocumentRendererParent::Recv__delete__(const PRUint32& w, const PRUint32& h,
DocumentRendererParent::Recv__delete__(const nsIntSize& renderedSize,
const nsCString& data)
{
DrawToCanvas(w, h, data);
DrawToCanvas(renderedSize, data);
return true;
}

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

@ -1,144 +0,0 @@
/* ***** 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 Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "base/basictypes.h"
#include "gfxImageSurface.h"
#include "gfxPattern.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsCSSParser.h"
#include "nsPresContext.h"
#include "nsCOMPtr.h"
#include "nsColor.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "nsLayoutUtils.h"
#ifdef MOZ_IPC
#include "gfxSharedImageSurface.h"
#endif
#include "mozilla/ipc/DocumentRendererShmemChild.h"
using namespace mozilla::ipc;
DocumentRendererShmemChild::DocumentRendererShmemChild()
{}
DocumentRendererShmemChild::~DocumentRendererShmemChild()
{}
static void
FlushLayoutForTree(nsIDOMWindow* aWindow)
{
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
if (!piWin)
return;
// Note that because FlushPendingNotifications flushes parents, this
// is O(N^2) in docshell tree depth. However, the docshell tree is
// usually pretty shallow.
nsCOMPtr<nsIDOMDocument> domDoc;
aWindow->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
doc->FlushPendingNotifications(Flush_Layout);
}
nsCOMPtr<nsIDocShellTreeNode> node =
do_QueryInterface(piWin->GetDocShell());
if (node) {
PRInt32 i = 0, i_end;
node->GetChildCount(&i_end);
for (; i < i_end; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
node->GetChildAt(i, getter_AddRefs(item));
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
if (win) {
FlushLayoutForTree(win);
}
}
}
}
bool
DocumentRendererShmemChild::RenderDocument(nsIDOMWindow *window, const PRInt32& x,
const PRInt32& y, const PRInt32& w,
const PRInt32& h, const nsString& aBGColor,
const PRUint32& flags, const PRBool& flush,
const gfxMatrix& aMatrix,
Shmem& data)
{
if (flush)
FlushLayoutForTree(window);
nsCOMPtr<nsPresContext> presContext;
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(window);
if (win) {
nsIDocShell* docshell = win->GetDocShell();
if (docshell) {
docshell->GetPresContext(getter_AddRefs(presContext));
}
}
if (!presContext)
return false;
nscolor bgColor;
nsCSSParser parser;
nsresult rv = parser.ParseColorString(PromiseFlatString(aBGColor), nsnull, 0, &bgColor);
if (NS_FAILED(rv))
return false;
nsIPresShell* presShell = presContext->PresShell();
nsRect r(x, y, w, h);
// Draw directly into the output array.
nsRefPtr<gfxASurface> surf = new gfxSharedImageSurface(data);
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
ctx->SetMatrix(aMatrix);
presShell->RenderDocument(r, flags, bgColor, ctx);
return true;
}

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

@ -1,60 +0,0 @@
/* ***** 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 Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/ipc/DocumentRendererShmemParent.h"
using namespace mozilla::ipc;
DocumentRendererShmemParent::DocumentRendererShmemParent()
{}
DocumentRendererShmemParent::~DocumentRendererShmemParent()
{}
void
DocumentRendererShmemParent::SetCanvas(nsICanvasRenderingContextInternal* aCanvas)
{
mCanvas = aCanvas;
}
bool
DocumentRendererShmemParent::Recv__delete__(const PRInt32& x, const PRInt32& y,
const PRInt32& w, const PRInt32& h,
Shmem& data)
{
mCanvas->Swap(data, x, y, w, h);
return true;
}

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

@ -60,10 +60,6 @@ ifdef MOZ_IPC
CPPSRCS += \
DocumentRendererParent.cpp \
DocumentRendererChild.cpp \
DocumentRendererNativeIDParent.cpp \
DocumentRendererNativeIDChild.cpp \
DocumentRendererShmemParent.cpp \
DocumentRendererShmemChild.cpp \
$(NULL)
endif

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

@ -103,9 +103,6 @@
#include "gfxContext.h"
#include "gfxASurface.h"
#include "gfxImageSurface.h"
#ifdef MOZ_IPC
#include "gfxSharedImageSurface.h"
#endif
#include "gfxPlatform.h"
#include "gfxFont.h"
#include "gfxTextRunCache.h"
@ -130,13 +127,8 @@
# include <algorithm>
# include "mozilla/dom/ContentParent.h"
# include "mozilla/ipc/PDocumentRendererParent.h"
# include "mozilla/ipc/PDocumentRendererShmemParent.h"
# include "mozilla/ipc/PDocumentRendererNativeIDParent.h"
# include "mozilla/dom/PBrowserParent.h"
# include "mozilla/ipc/DocumentRendererParent.h"
# include "mozilla/ipc/DocumentRendererShmemParent.h"
# include "mozilla/ipc/DocumentRendererNativeIDParent.h"
# include "mozilla/ipc/SharedMemorySysV.h"
// windows.h (included by chromium code) defines this, in its infinite wisdom
# undef DrawText
@ -144,10 +136,6 @@
using namespace mozilla::ipc;
#endif
#ifdef MOZ_X11
#include "gfxXlibSurface.h"
#endif
#ifdef MOZ_SVG
#include "nsSVGEffects.h"
#endif
@ -429,13 +417,6 @@ public:
NS_IMETHOD SetIsIPC(PRBool isIPC);
// this rect is in CSS pixels
NS_IMETHOD Redraw(const gfxRect &r);
// Swap this back buffer with the front, and copy its contents to the new back.
// x, y, w, and h specify the area of |back| that is dirty.
NS_IMETHOD Swap(mozilla::ipc::Shmem& back, PRInt32 x, PRInt32 y,
PRInt32 w, PRInt32 h);
NS_IMETHOD Swap(PRUint32 nativeID, PRInt32 x, PRInt32 y,
PRInt32 w, PRInt32 h);
// nsISupports interface + CC
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -500,30 +481,13 @@ protected:
*/
gfxASurface::gfxImageFormat GetImageFormat() const;
#ifdef MOZ_IPC
/**
* Sync data from mBackSurface to mSurface.
*/
nsresult Swap(const gfxRect& aRect);
#endif
// Member vars
PRInt32 mWidth, mHeight;
PRPackedBool mValid;
PRPackedBool mOpaque;
PRPackedBool mResetLayer;
#ifdef MOZ_IPC
PRPackedBool mIPC;
// for rendering with NativeID protocol, we should track backbuffer ownership
PRPackedBool mIsBackSurfaceReadable;
// We always have a front buffer. We hand the mBackSurface to the other
// process to render to,
// and then sync data from mBackSurface to mSurface when it finishes.
nsRefPtr<gfxASurface> mBackSurface;
#endif
// the canvas element we're a context of
nsCOMPtr<nsIDOMHTMLCanvasElement> mCanvasElement;
nsHTMLCanvasElement *HTMLCanvasElement() {
@ -814,18 +778,6 @@ protected:
}
friend struct nsCanvasBidiProcessor;
private:
#ifdef MOZ_IPC
void DeallocShmemIfShared(nsRefPtr<gfxASurface> &aSurface) {
ContentParent* allocator = ContentParent::GetSingleton(PR_FALSE);
if (allocator && gfxSharedImageSurface::IsSharedImage(aSurface)) {
Shmem mem = static_cast<gfxSharedImageSurface*>(aSurface.get())->GetShmem();
allocator->DeallocShmem(mem);
}
}
#endif
};
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsCanvasRenderingContext2D, nsIDOMCanvasRenderingContext2D)
@ -871,9 +823,7 @@ NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult)
nsCanvasRenderingContext2D::nsCanvasRenderingContext2D()
: mValid(PR_FALSE), mOpaque(PR_FALSE), mResetLayer(PR_TRUE)
#ifdef MOZ_IPC
, mIPC(PR_FALSE)
#endif
, mCanvasElement(nsnull)
, mSaveCount(0), mIsEntireFrameInvalid(PR_FALSE), mInvalidateCount(0)
, mLastStyle(STYLE_MAX), mStyleStack(20)
@ -884,12 +834,6 @@ nsCanvasRenderingContext2D::nsCanvasRenderingContext2D()
nsCanvasRenderingContext2D::~nsCanvasRenderingContext2D()
{
Reset();
#ifdef MOZ_IPC
DeallocShmemIfShared(mBackSurface);
mBackSurface = nsnull;
#endif
sNumLivingContexts--;
if (!sNumLivingContexts) {
delete[] sUnpremultiplyTable;
@ -902,10 +846,6 @@ nsCanvasRenderingContext2D::~nsCanvasRenderingContext2D()
nsresult
nsCanvasRenderingContext2D::Reset()
{
#ifdef MOZ_IPC
DeallocShmemIfShared(mSurface);
#endif
// only do this for non-docshell created contexts,
// since those are the ones that we created a surface for
if (mValid && !mDocShell)
@ -1152,33 +1092,6 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
if (surface && surface->CairoStatus() != 0)
surface = NULL;
#ifdef MOZ_IPC
if (mIPC && surface) {
#ifdef MOZ_X11
if (surface->GetType() == gfxASurface::SurfaceTypeXlib) {
mBackSurface =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(size, gfxASurface::ContentFromFormat(format));
NS_ABORT_IF_FALSE(mBackSurface->GetType() ==
gfxASurface::SurfaceTypeXlib, "need xlib surface");
mIsBackSurfaceReadable = PR_TRUE;
// Make sure that our XSurface created and synced properly
XSync(static_cast<gfxXlibSurface*>(mBackSurface.get())->XDisplay(), False);
} else
#endif
{
if (surface->GetType() == gfxASurface::SurfaceTypeImage)
format = static_cast<gfxImageSurface*>(surface.get())->Format();
SharedMemory::SharedMemoryType shmtype = SharedMemory::TYPE_BASIC;
#ifdef MOZ_HAVE_SHAREDMEMORYSYSV
shmtype = SharedMemory::TYPE_SYSV;
#endif
ContentParent* allocator = ContentParent::GetSingleton();
mBackSurface = new gfxSharedImageSurface();
static_cast<gfxSharedImageSurface*>(mBackSurface.get())->Init(allocator, size, format, shmtype);
}
}
#endif
}
if (surface) {
if (gCanvasMemoryReporter == nsnull) {
@ -1288,84 +1201,6 @@ nsCanvasRenderingContext2D::SetIsIPC(PRBool isIPC)
#endif
}
#ifdef MOZ_IPC
nsresult
nsCanvasRenderingContext2D::Swap(const gfxRect& aRect)
{
gfxContextPathAutoSaveRestore pathSR(mThebes);
gfxContextAutoSaveRestore autoSR(mThebes);
mThebes->SetOperator(gfxContext::OPERATOR_SOURCE);
mThebes->NewPath();
mThebes->SetSource(mBackSurface);
mThebes->Rectangle(aRect, PR_TRUE);
mThebes->Clip();
mThebes->Paint();
Redraw(aRect);
// Notify listeners that we've finished drawing
nsCOMPtr<nsIContent> content =
do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
nsIDocument* ownerDoc = nsnull;
if (content)
ownerDoc = content->GetOwnerDoc();
if (ownerDoc && mCanvasElement) {
nsContentUtils::DispatchTrustedEvent(ownerDoc,
static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement),
NS_LITERAL_STRING("MozAsyncCanvasRender"),
/* aCanBubble = */ PR_TRUE,
/* aCancelable = */ PR_TRUE);
}
return NS_OK;
}
#endif
NS_IMETHODIMP
nsCanvasRenderingContext2D::Swap(mozilla::ipc::Shmem& aBack,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{
#ifdef MOZ_IPC
if (!gfxSharedImageSurface::IsSharedImage(mBackSurface))
return NS_ERROR_FAILURE;
nsRefPtr<gfxSharedImageSurface> aBackImage = new gfxSharedImageSurface(aBack);
if (aBackImage->Data() != static_cast<gfxImageSurface*>(mBackSurface.get())->Data()) {
NS_ERROR("Incoming back surface is not equal to our back surface");
// Delete orphaned memory and return
ContentParent* allocator = ContentParent::GetSingleton(PR_FALSE);
if (allocator)
allocator->DeallocShmem(aBack);
return NS_ERROR_FAILURE;
}
Shmem& mem = static_cast<gfxSharedImageSurface*>(mBackSurface.get())->GetShmem();
if (mem.IsReadable())
NS_ERROR("Back surface readable before swap, this must not happen");
// Take mBackSurface shared memory ownership
mem = aBack;
return Swap(gfxRect(x, y, w, h));
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::Swap(PRUint32 nativeID,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{
#ifdef MOZ_IPC
if (mIsBackSurfaceReadable)
NS_ERROR("Back surface readable before swap, this must not happen");
mIsBackSurfaceReadable = PR_TRUE;
return Swap(gfxRect(x, y, w, h));
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter)
{
@ -3904,62 +3739,17 @@ nsCanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* aElem, float a
renderDocFlags &= ~nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
}
PRInt32 x = nsPresContext::CSSPixelsToAppUnits(aX),
y = nsPresContext::CSSPixelsToAppUnits(aY),
w = nsPresContext::CSSPixelsToAppUnits(aW),
h = nsPresContext::CSSPixelsToAppUnits(aH);
nsRect rect(nsPresContext::CSSPixelsToAppUnits(aX),
nsPresContext::CSSPixelsToAppUnits(aY),
nsPresContext::CSSPixelsToAppUnits(aW),
nsPresContext::CSSPixelsToAppUnits(aH));
if (mIPC) {
#ifdef MOZ_X11
if (mBackSurface &&
mBackSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
if (!mIsBackSurfaceReadable)
return NS_ERROR_FAILURE;
PRInt32 nativeID = static_cast<gfxXlibSurface*>(mBackSurface.get())->XDrawable();
mIsBackSurfaceReadable = PR_FALSE;
PDocumentRendererNativeIDParent* pdocrender =
child->SendPDocumentRendererNativeIDConstructor(x, y, w, h,
nsString(aBGColor),
renderDocFlags, flush,
mThebes->CurrentMatrix(),
nativeID);
if (!pdocrender)
return NS_ERROR_FAILURE;
DocumentRendererNativeIDParent* docrender =
static_cast<DocumentRendererNativeIDParent *>(pdocrender);
docrender->SetCanvas(this);
}
else
#endif
if (gfxSharedImageSurface::IsSharedImage(mBackSurface)) {
Shmem& backmem = static_cast<gfxSharedImageSurface*>(mBackSurface.get())->GetShmem();
if (!backmem.IsWritable())
return NS_ERROR_FAILURE;
PDocumentRendererShmemParent* pdocrender =
child->SendPDocumentRendererShmemConstructor(x, y, w, h,
nsString(aBGColor),
renderDocFlags, flush,
mThebes->CurrentMatrix(),
backmem);
if (!pdocrender)
return NS_ERROR_FAILURE;
DocumentRendererShmemParent* docrender =
static_cast<DocumentRendererShmemParent*>(pdocrender);
docrender->SetCanvas(this);
} else
return NS_ERROR_FAILURE;
} else {
PDocumentRendererParent *pdocrender =
child->SendPDocumentRendererConstructor(x, y, w, h,
child->SendPDocumentRendererConstructor(rect,
mThebes->CurrentMatrix(),
nsString(aBGColor),
renderDocFlags, flush);
renderDocFlags, flush,
nsIntSize(mWidth, mHeight));
if (!pdocrender)
return NS_ERROR_FAILURE;

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

@ -2074,6 +2074,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
PRBool dragStarted = DoDefaultDragStart(aPresContext, event, dataTransfer,
targetContent, isSelection);
if (dragStarted) {
sActiveESM = nsnull;
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
}
}
@ -2935,7 +2936,6 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (par)
activeContent = par;
}
SetGlobalActiveContent(this, activeContent);
}
}
else {
@ -2943,11 +2943,12 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// any of our own processing of a drag. Workaround for bug 43258.
StopTrackingDragGesture();
}
SetActiveManager(this, activeContent);
}
break;
case NS_MOUSE_BUTTON_UP:
{
ClearGlobalActiveContent();
ClearGlobalActiveContent(this);
if (IsMouseEventReal(aEvent)) {
if (!mCurrentTarget) {
nsIFrame* targ;
@ -3206,6 +3207,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
targetContent, &status);
}
}
ClearGlobalActiveContent(this);
break;
}
case NS_DRAGDROP_EXIT:
@ -4706,22 +4708,25 @@ nsEventStateManager::DoContentCommandScrollEvent(nsContentCommandEvent* aEvent)
}
void
nsEventStateManager::SetGlobalActiveContent(nsEventStateManager* aNewESM,
nsIContent* aContent)
nsEventStateManager::SetActiveManager(nsEventStateManager* aNewESM,
nsIContent* aContent)
{
if (sActiveESM && aNewESM != sActiveESM) {
sActiveESM->SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
}
sActiveESM = aNewESM;
if (sActiveESM) {
if (sActiveESM && aContent) {
sActiveESM->SetContentState(aContent, NS_EVENT_STATE_ACTIVE);
}
}
void
nsEventStateManager::ClearGlobalActiveContent()
nsEventStateManager::ClearGlobalActiveContent(nsEventStateManager* aClearer)
{
if (sActiveESM) {
if (aClearer) {
aClearer->SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
}
if (sActiveESM && aClearer != sActiveESM) {
sActiveESM->SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
}
sActiveESM = nsnull;

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

@ -159,8 +159,10 @@ public:
static nsIEventStateManager* GetActiveEventStateManager() { return sActiveESM; }
static void SetGlobalActiveContent(nsEventStateManager* aNewESM,
nsIContent* aContent);
// Sets aNewESM to be the active event state manager, and
// if aContent is non-null, marks the object as active.
static void SetActiveManager(nsEventStateManager* aNewESM,
nsIContent* aContent);
protected:
void UpdateCursor(nsPresContext* aPresContext, nsEvent* aEvent, nsIFrame* aTargetFrame, nsEventStatus* aStatus);
/**
@ -415,7 +417,7 @@ protected:
static nsEventStateManager* sActiveESM;
static void ClearGlobalActiveContent();
static void ClearGlobalActiveContent(nsEventStateManager* aClearer);
// Functions used for click hold context menus
PRBool mClickHoldContextMenu;

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

@ -808,7 +808,8 @@ nsGenericHTMLElement::ScrollIntoView(PRBool aTop, PRUint8 optional_argc)
NS_PRESSHELL_SCROLL_BOTTOM;
presShell->ScrollContentIntoView(this, vpercent,
NS_PRESSHELL_SCROLL_ANYWHERE);
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
return NS_OK;
}

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

@ -439,7 +439,7 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (NS_IS_TRUSTED_EVENT(aVisitor.mEvent)) {
nsIEventStateManager* esm =
aVisitor.mPresContext->EventStateManager();
nsEventStateManager::SetGlobalActiveContent(
nsEventStateManager::SetActiveManager(
static_cast<nsEventStateManager*>(esm), this);
}
nsIFocusManager* fm = nsFocusManager::GetFocusManager();

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

@ -236,6 +236,8 @@ _TEST_FILES = \
test_bug600155.html \
test_bug556007.html \
test_bug606817.html \
test_bug297761.html \
file_bug297761.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<base href="http://www.mozilla.org/">
</head>
<body>
<form action="">
<input type='submit' formaction="">
<button type='submit' formaction=""></button>
<input id='i' type='image' formaction="">
</form>
</body>
</html>

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

@ -0,0 +1,78 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=297761
-->
<head>
<title>Test for Bug 297761</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=297761">Mozilla Bug 297761</a>
<p id="display"></p>
<div id="content">
<iframe src="file_bug297761.html"></iframe>
<iframe src="file_bug297761.html"></iframe>
<iframe src="file_bug297761.html"></iframe>
<iframe src="file_bug297761.html"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 297761 **/
SimpleTest.waitForExplicitFinish();
var nbTests = 4;
var curTest = 0;
function nextTest()
{
if (curTest == 3) {
frames[curTest].document.forms[0].submit();
} else {
var el = null;
if (curTest == 2) {
el = frames[curTest].document.getElementById('i');
} else {
el = frames[curTest].document.forms[0].elements[curTest];
}
el.focus();
el.click();
}
}
function frameLoaded(aFrame)
{
var documentLocation = location.href.replace(/\.html.*/, "\.html");
is(aFrame.contentWindow.location.href.replace(/\?x=0&y=0/, ""),
documentLocation.replace(/test_bug/, "file_bug"),
"form should have been submitted to the document location");
if (++curTest == nbTests) {
SimpleTest.finish();
} else {
nextTest();
}
}
function runTest()
{
// Initialize event handlers.
var frames = document.getElementsByTagName('iframe');
for (var i=0; i<nbTests; ++i) {
frames[i].setAttribute('onload', "frameLoaded(this);");
}
nextTest();
}
addLoadEvent(runTest);
</script>
</pre>
</body>
</html>

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

@ -22,57 +22,68 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=392567
/** Test for Bug 392567 **/
var dataUrl = "http://mochi.test:8888/tests/content/html/content/test/bug392567.jar";
var jarUrl = "jar:" + dataUrl + "!/index.html";
var httpUrl = location.href.replace(/\.html.*/, "_404");
var previousDir = location.href.replace(/test\/[^\/]*$/, "");
SimpleTest.waitForExplicitFinish();
var form = document.forms.testForm;
var frame = frames.testFrame;
document.getElementById("testFrame").onload = processTestResult;
// List of tests to run, each test consists of form action URL and expected result URL
var tests = [
[jarUrl, jarUrl + "?$PARAMS", null],
[jarUrl + "?jarTest1=jarTest2", jarUrl + "?$PARAMS", null],
[jarUrl + "?jarTest3=jarTest4#jarTest5", jarUrl + "?$PARAMS#jarTest5", null],
["data:text/html,<html></html>", "data:text/html,<html></html>?$PARAMS", null],
["data:text/html,<html>How%20about%20this?</html>", "data:text/html,<html>How%20about%20this?$PARAMS", null],
[httpUrl, httpUrl + "?$PARAMS", null],
[httpUrl + "?httpTest1=httpTest2", httpUrl + "?$PARAMS", null ],
[httpUrl + "?httpTest3=httpTest4#httpTest5", httpUrl + "?$PARAMS#httpTest5", null],
["", jarUrl + "?key=value0", null],
[" ", jarUrl + "?key=value0", document.location],
["../", previousDir + "?$PARAMS", previousDir],
];
var currentTest = -1;
SimpleTest.waitForExplicitFinish();
runNextTest();
function runNextTest() {
currentTest++;
if (currentTest >= tests.length) {
SimpleTest.finish();
function runTests()
{
if (window.location.search.match(/\?key=value/)) {
return;
}
form.setAttribute("action", tests[currentTest][0]);
is(form.action, tests[currentTest][0],
"action IDL attribute should reflect the action content attribute");
is(form.mozActionUri, tests[currentTest][2] ? tests[currentTest][2] : tests[currentTest][0],
"mozActionUri IDL attribute should resolve the action URI");
form.key.value = "value" + currentTest;
form.submit();
var dataUrl = "http://mochi.test:8888/tests/content/html/content/test/bug392567.jar";
var jarUrl = "jar:" + dataUrl + "!/index.html";
var httpUrl = location.href.replace(/\.html.*/, "_404");
var previousDir = location.href.replace(/test\/[^\/]*$/, "");
var documentURL = location.href.replace(/\.html.*/, "\.html");
var form = document.forms.testForm;
var frame = frames.testFrame;
document.getElementById("testFrame").onload = processTestResult;
// List of tests to run, each test consists of form action URL and expected result URL
var tests = [
[jarUrl, jarUrl + "?$PARAMS", null],
[jarUrl + "?jarTest1=jarTest2", jarUrl + "?$PARAMS", null],
[jarUrl + "?jarTest3=jarTest4#jarTest5", jarUrl + "?$PARAMS#jarTest5", null],
["data:text/html,<html></html>", "data:text/html,<html></html>?$PARAMS", null],
["data:text/html,<html>How%20about%20this?</html>", "data:text/html,<html>How%20about%20this?$PARAMS", null],
[httpUrl, httpUrl + "?$PARAMS", null],
[httpUrl + "?httpTest1=httpTest2", httpUrl + "?$PARAMS", null ],
[httpUrl + "?httpTest3=httpTest4#httpTest5", httpUrl + "?$PARAMS#httpTest5", null],
["", documentURL + "?$PARAMS", null],
[" ", documentURL + "?$PARAMS", document.location],
["../", previousDir + "?$PARAMS", previousDir],
];
var currentTest = -1;
runNextTest();
function runNextTest() {
currentTest++;
if (currentTest >= tests.length) {
SimpleTest.finish();
return;
}
form.setAttribute("action", tests[currentTest][0]);
is(form.action, tests[currentTest][0],
"action IDL attribute should reflect the action content attribute");
is(form.mozActionUri, tests[currentTest][2] ? tests[currentTest][2] : tests[currentTest][0],
"mozActionUri IDL attribute should resolve the action URI");
form.key.value = "value" + currentTest;
form.submit();
}
function processTestResult() {
var expected = tests[currentTest][1].replace(/\$PARAMS/, "key=value" + currentTest);
is(frame.location.href, expected, "Submitting to " + tests[currentTest][0]);
setTimeout(runNextTest, 0);
}
}
function processTestResult() {
var expected = tests[currentTest][1].replace(/\$PARAMS/, "key=value" + currentTest);
is(frame.location.href, expected, "Submitting to " + tests[currentTest][0]);
setTimeout(runNextTest, 0);
}
addLoadEvent(runTests);
</script>
</pre>

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

@ -145,6 +145,7 @@ NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult)
nsXULPrototypeCache *p = result;
obsSvc->AddObserver(p, "chrome-flush-skin-caches", PR_FALSE);
obsSvc->AddObserver(p, "chrome-flush-caches", PR_FALSE);
obsSvc->AddObserver(p, "startupcache-invalidate", PR_FALSE);
}
return rv;
@ -410,10 +411,6 @@ nsXULPrototypeCache::AbortFastLoads()
NS_BREAK();
#endif
// Save a strong ref to the FastLoad file, so we can remove it after we
// close open streams to it.
nsCOMPtr<nsIFile> file = gFastLoadFile;
// Flush the XUL cache for good measure, in case we cached a bogus/downrev
// script, somehow.
Flush();
@ -421,29 +418,42 @@ nsXULPrototypeCache::AbortFastLoads()
// Clear the FastLoad set
mFastLoadURITable.Clear();
if (! gFastLoadService)
return;
nsCOMPtr<nsIFastLoadService> fastLoadService = gFastLoadService;
nsCOMPtr<nsIFile> file = gFastLoadFile;
nsresult rv;
if (! fastLoadService) {
fastLoadService = do_GetFastLoadService();
if (! fastLoadService)
return;
rv = fastLoadService->NewFastLoadFile(XUL_FASTLOAD_FILE_BASENAME,
getter_AddRefs(file));
if (NS_FAILED(rv))
return;
}
// Fetch the current input (if FastLoad file existed) or output (if we're
// creating the FastLoad file during this app startup) stream.
nsCOMPtr<nsIObjectInputStream> objectInput;
nsCOMPtr<nsIObjectOutputStream> objectOutput;
gFastLoadService->GetInputStream(getter_AddRefs(objectInput));
gFastLoadService->GetOutputStream(getter_AddRefs(objectOutput));
fastLoadService->GetInputStream(getter_AddRefs(objectInput));
fastLoadService->GetOutputStream(getter_AddRefs(objectOutput));
if (objectOutput) {
gFastLoadService->SetOutputStream(nsnull);
fastLoadService->SetOutputStream(nsnull);
if (NS_SUCCEEDED(objectOutput->Close()) && gChecksumXULFastLoadFile)
gFastLoadService->CacheChecksum(gFastLoadFile,
objectOutput);
fastLoadService->CacheChecksum(file,
objectOutput);
}
if (objectInput) {
// If this is the last of one or more XUL master documents loaded
// together at app startup, close the FastLoad service's singleton
// input stream now.
gFastLoadService->SetInputStream(nsnull);
fastLoadService->SetInputStream(nsnull);
objectInput->Close();
}
@ -462,13 +472,15 @@ nsXULPrototypeCache::AbortFastLoads()
}
file->MoveToNative(nsnull, NS_LITERAL_CSTRING("Aborted.mfasl"));
#else
file->Remove(PR_FALSE);
rv = file->Remove(PR_FALSE);
if (NS_FAILED(rv))
NS_WARNING("Failed to remove fastload file, fastload data may be outdated");
#endif
}
// If the list is empty now, the FastLoad process is done.
NS_RELEASE(gFastLoadService);
NS_RELEASE(gFastLoadFile);
NS_IF_RELEASE(gFastLoadService);
NS_IF_RELEASE(gFastLoadFile);
}

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

@ -159,7 +159,7 @@
#include "nsIController.h"
#include "nsPICommandUpdater.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIWebBrowserChrome2.h"
#include "nsIWebBrowserChrome3.h"
#include "nsITabChild.h"
#include "nsIStrictTransportSecurityService.h"
@ -711,6 +711,7 @@ nsDocShell::nsDocShell():
mAllowKeywordFixup(PR_FALSE),
mIsOffScreenBrowser(PR_FALSE),
mIsActive(PR_TRUE),
mIsAppTab(PR_FALSE),
mFiredUnloadEvent(PR_FALSE),
mEODForCurrentDocument(PR_FALSE),
mURIResultedInDocument(PR_FALSE),
@ -4802,6 +4803,20 @@ nsDocShell::GetIsActive(PRBool *aIsActive)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetIsAppTab(PRBool aIsAppTab)
{
mIsAppTab = aIsAppTab;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetIsAppTab(PRBool *aIsAppTab)
{
*aIsAppTab = mIsAppTab;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetVisibility(PRBool aVisibility)
{
@ -11311,8 +11326,22 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
return NS_OK;
}
nsresult rv = NS_ERROR_FAILURE;
nsAutoString target;
nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner);
if (browserChrome3) {
nsCOMPtr<nsIDOMNode> linkNode = do_QueryInterface(aContent);
nsAutoString oldTarget(aTargetSpec);
rv = browserChrome3->OnBeforeLinkTraversal(oldTarget, aURI,
linkNode, mIsAppTab, target);
}
if (NS_FAILED(rv))
target = aTargetSpec;
nsCOMPtr<nsIRunnable> ev =
new OnLinkClickEvent(this, aContent, aURI, aTargetSpec,
new OnLinkClickEvent(this, aContent, aURI, target.get(),
aPostDataStream, aHeadersDataStream);
return NS_DispatchToCurrentThread(ev);
}

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

@ -790,6 +790,7 @@ protected:
PRPackedBool mAllowKeywordFixup;
PRPackedBool mIsOffScreenBrowser;
PRPackedBool mIsActive;
PRPackedBool mIsAppTab;
// This boolean is set to true right before we fire pagehide and generally
// unset when we embed a new content viewer. While it's true no navigation

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

@ -71,7 +71,7 @@ interface nsIPrincipal;
interface nsIWebBrowserPrint;
interface nsIVariant;
[scriptable, uuid(74470127-87eb-4f79-8293-1616fe9cb689)]
[scriptable, uuid(98cdbcc4-2d81-4191-a63f-b6c52085edbc)]
interface nsIDocShell : nsISupports
{
/**
@ -529,11 +529,17 @@ interface nsIDocShell : nsISupports
*/
attribute boolean isActive;
/**
* The ID of the docshell in the session history.
*/
readonly attribute unsigned long long historyID;
/**
* Sets whether a docshell is an app tab. An app tab docshell may behave
* differently than a non-app tab docshell in some cases, such as when
* handling link clicks. Docshells are not app tabs unless told otherwise.
*/
attribute boolean isAppTab;
};
[uuid(5f7a2184-31b6-4d67-9c75-0c17477766e2)]

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

@ -1800,7 +1800,8 @@ nsFocusManager::ScrollIntoView(nsIPresShell* aPresShell,
if (!(aFlags & FLAG_NOSCROLL))
aPresShell->ScrollContentIntoView(aContent,
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE);
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}

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

@ -1238,9 +1238,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
}
}
if (!chromeWindow)
newDefaultJSOptions |= JSOPTION_ROPES;
if (useTraceJIT)
newDefaultJSOptions |= JSOPTION_JIT;
else

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

@ -40,8 +40,6 @@
include protocol PContent;
include protocol PContentDialog;
include protocol PDocumentRenderer;
include protocol PDocumentRendererShmem;
include protocol PDocumentRendererNativeID;
include protocol PContentPermissionRequest;
include protocol PRenderFrame;
include protocol POfflineCacheUpdate;
@ -53,13 +51,14 @@ include "IPC/nsGUIEventIPC.h";
using gfxMatrix;
using IPC::URI;
using nsIntSize;
using nsCompositionEvent;
using nsTextEvent;
using nsQueryContentEvent;
using nsSelectionEvent;
using RemoteDOMEvent;
using nsIMEUpdatePreference;
using nsIntSize;
using nsQueryContentEvent;
using nsRect;
using nsSelectionEvent;
using nsTextEvent;
using RemoteDOMEvent;
namespace mozilla {
namespace dom {
@ -70,8 +69,6 @@ rpc protocol PBrowser
manages PContentDialog;
manages PDocumentRenderer;
manages PDocumentRendererShmem;
manages PDocumentRendererNativeID;
manages PContentPermissionRequest;
manages PRenderFrame;
manages POfflineCacheUpdate;
@ -272,15 +269,23 @@ child:
LoadRemoteScript(nsString aURL);
PDocumentRenderer(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, nsString bgcolor, PRUint32 flags, bool flush);
// @param matrix the transformation matrix the context we're going to draw into should have.
PDocumentRendererShmem(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, nsString bgcolor, PRUint32 flags, bool flush,
gfxMatrix matrix, Shmem buf);
// @param matrix the transformation matrix the context we're going to draw into should have.
PDocumentRendererNativeID(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, nsString bgcolor, PRUint32 flags, bool flush,
gfxMatrix matrix, PRUint32 nativeID);
/**
* Create a asynchronous request to render whatever document is
* loaded in the child when this message arrives. When the
* request finishes, PDocumentRenderer:__delete__ is sent back to
* this side to notify completion.
*
* |documentRect| is the area of the remote document to draw,
* transformed by |transform|. The rendered area will have the
* default background color |bgcolor|. |renderFlags| are the
* nsIPresShell::RenderDocument() flags to use on the remote side,
* and if true, |flushLayout| will do just that before rendering
* the document. The rendered image will be of size |renderSize|.
*/
PDocumentRenderer(nsRect documentRect, gfxMatrix transform,
nsString bgcolor,
PRUint32 renderFlags, bool flushLayout,
nsIntSize renderSize);
/**
* Sent by the chrome process when it no longer wants this remote

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

@ -37,6 +37,8 @@
include protocol PBrowser;
using nsIntSize;
namespace mozilla {
namespace ipc {
@ -46,7 +48,7 @@ protocol PDocumentRenderer
parent:
// Returns the width and height, in pixels, of the returned ARGB32 data.
__delete__(PRUint32 w, PRUint32 h, nsCString data);
__delete__(nsIntSize renderedSize, nsCString data);
};
} // namespace ipc

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

@ -56,8 +56,6 @@
#include "nsThreadUtils.h"
#include "nsIInterfaceRequestorUtils.h"
#include "mozilla/ipc/DocumentRendererChild.h"
#include "mozilla/ipc/DocumentRendererShmemChild.h"
#include "mozilla/ipc/DocumentRendererNativeIDChild.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindowUtils.h"
@ -93,6 +91,7 @@
#include "PCOMContentPermissionRequestChild.h"
using namespace mozilla::dom;
using namespace mozilla::ipc;
using namespace mozilla::layers;
using namespace mozilla::layout;
using namespace mozilla::docshell;
@ -593,16 +592,15 @@ TabChild::DispatchWidgetEvent(nsGUIEvent& event)
return true;
}
mozilla::ipc::PDocumentRendererChild*
TabChild::AllocPDocumentRenderer(const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
PDocumentRendererChild*
TabChild::AllocPDocumentRenderer(const nsRect& documentRect,
const gfxMatrix& transform,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush)
const PRUint32& renderFlags,
const bool& flushLayout,
const nsIntSize& renderSize)
{
return new mozilla::ipc::DocumentRendererChild();
return new DocumentRendererChild();
}
bool
@ -613,18 +611,15 @@ TabChild::DeallocPDocumentRenderer(PDocumentRendererChild* actor)
}
bool
TabChild::RecvPDocumentRendererConstructor(
mozilla::ipc::PDocumentRendererChild *__a,
const PRInt32& aX,
const PRInt32& aY,
const PRInt32& aW,
const PRInt32& aH,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush)
TabChild::RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
const nsRect& documentRect,
const gfxMatrix& transform,
const nsString& bgcolor,
const PRUint32& renderFlags,
const bool& flushLayout,
const nsIntSize& renderSize)
{
mozilla::ipc::DocumentRendererChild *render =
static_cast<mozilla::ipc::DocumentRendererChild *>(__a);
DocumentRendererChild *render = static_cast<DocumentRendererChild *>(actor);
nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(mWebNav);
if (!browser)
@ -636,134 +631,16 @@ TabChild::RecvPDocumentRendererConstructor(
return true; // silently ignore
}
PRUint32 width, height;
nsCString data;
bool ret = render->RenderDocument(window, aX, aY, aW, aH, bgcolor, flags, flush,
width, height, data);
bool ret = render->RenderDocument(window,
documentRect, transform,
bgcolor,
renderFlags, flushLayout,
renderSize, data);
if (!ret)
return true; // silently ignore
return PDocumentRendererChild::Send__delete__(__a, width, height, data);
}
mozilla::ipc::PDocumentRendererShmemChild*
TabChild::AllocPDocumentRendererShmem(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
Shmem& buf)
{
return new mozilla::ipc::DocumentRendererShmemChild();
}
bool
TabChild::DeallocPDocumentRendererShmem(PDocumentRendererShmemChild* actor)
{
delete actor;
return true;
}
bool
TabChild::RecvPDocumentRendererShmemConstructor(
PDocumentRendererShmemChild *__a,
const PRInt32& aX,
const PRInt32& aY,
const PRInt32& aW,
const PRInt32& aH,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
Shmem& aBuf)
{
mozilla::ipc::DocumentRendererShmemChild *render =
static_cast<mozilla::ipc::DocumentRendererShmemChild *>(__a);
nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(mWebNav);
if (!browser)
return true; // silently ignore
nsCOMPtr<nsIDOMWindow> window;
if (NS_FAILED(browser->GetContentDOMWindow(getter_AddRefs(window))) ||
!window)
return true; // silently ignore
render->RenderDocument(window, aX, aY, aW, aH, bgcolor, flags, flush,
aMatrix, aBuf);
gfxRect dirtyArea(0, 0, nsPresContext::AppUnitsToIntCSSPixels(aW),
nsPresContext::AppUnitsToIntCSSPixels(aH));
dirtyArea = aMatrix.Transform(dirtyArea);
return PDocumentRendererShmemChild::Send__delete__(__a, dirtyArea.X(), dirtyArea.Y(),
dirtyArea.Width(), dirtyArea.Height(),
aBuf);
}
mozilla::ipc::PDocumentRendererNativeIDChild*
TabChild::AllocPDocumentRendererNativeID(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRUint32& nativeID)
{
return new mozilla::ipc::DocumentRendererNativeIDChild();
}
bool
TabChild::DeallocPDocumentRendererNativeID(PDocumentRendererNativeIDChild* actor)
{
delete actor;
return true;
}
bool
TabChild::RecvPDocumentRendererNativeIDConstructor(
PDocumentRendererNativeIDChild *__a,
const PRInt32& aX,
const PRInt32& aY,
const PRInt32& aW,
const PRInt32& aH,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRUint32& aNativeID)
{
mozilla::ipc::DocumentRendererNativeIDChild* render =
static_cast<mozilla::ipc::DocumentRendererNativeIDChild*>(__a);
nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(mWebNav);
if (!browser)
return true; // silently ignore
nsCOMPtr<nsIDOMWindow> window;
if (NS_FAILED(browser->GetContentDOMWindow(getter_AddRefs(window))) ||
!window)
return true; // silently ignore
render->RenderDocument(window, aX, aY, aW, aH, bgcolor, flags, flush,
aMatrix, aNativeID);
gfxRect dirtyArea(0, 0, nsPresContext::AppUnitsToIntCSSPixels(aW),
nsPresContext::AppUnitsToIntCSSPixels(aH));
dirtyArea = aMatrix.Transform(dirtyArea);
return PDocumentRendererNativeIDChild::Send__delete__(__a, dirtyArea.X(), dirtyArea.Y(),
dirtyArea.Width(), dirtyArea.Height(),
aNativeID);
return PDocumentRendererChild::Send__delete__(actor, renderSize, data);
}
PContentDialogChild*

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

@ -197,24 +197,21 @@ public:
virtual bool RecvLoadRemoteScript(const nsString& aURL);
virtual bool RecvAsyncMessage(const nsString& aMessage,
const nsString& aJSON);
virtual mozilla::ipc::PDocumentRendererChild* AllocPDocumentRenderer(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush);
virtual PDocumentRendererChild*
AllocPDocumentRenderer(const nsRect& documentRect, const gfxMatrix& transform,
const nsString& bgcolor,
const PRUint32& renderFlags, const bool& flushLayout,
const nsIntSize& renderSize);
virtual bool DeallocPDocumentRenderer(PDocumentRendererChild* actor);
virtual bool RecvPDocumentRendererConstructor(
mozilla::ipc::PDocumentRendererChild *__a,
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush);
virtual bool RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
const nsRect& documentRect,
const gfxMatrix& transform,
const nsString& bgcolor,
const PRUint32& renderFlags,
const bool& flushLayout,
const nsIntSize& renderSize);
virtual PContentDialogChild* AllocPContentDialog(const PRUint32&,
const nsCString&,
const nsCString&,
@ -228,52 +225,6 @@ public:
const nsTArray<nsString>& aStringParams,
nsIDialogParamBlock* aParams);
virtual PDocumentRendererShmemChild* AllocPDocumentRendererShmem(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
Shmem& buf);
virtual bool DeallocPDocumentRendererShmem(PDocumentRendererShmemChild* actor);
virtual bool RecvPDocumentRendererShmemConstructor(
PDocumentRendererShmemChild *__a,
const PRInt32& aX,
const PRInt32& aY,
const PRInt32& aW,
const PRInt32& aH,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
Shmem& aBuf);
virtual PDocumentRendererNativeIDChild* AllocPDocumentRendererNativeID(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRUint32& nativeID);
virtual bool DeallocPDocumentRendererNativeID(PDocumentRendererNativeIDChild* actor);
virtual bool RecvPDocumentRendererNativeIDConstructor(
PDocumentRendererNativeIDChild *__a,
const PRInt32& aX,
const PRInt32& aY,
const PRInt32& aW,
const PRInt32& aH,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRUint32& aNativeID);
virtual PContentPermissionRequestChild* AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI& uri);
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestChild* actor);

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

@ -40,8 +40,6 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/ipc/DocumentRendererParent.h"
#include "mozilla/ipc/DocumentRendererShmemParent.h"
#include "mozilla/ipc/DocumentRendererNativeIDParent.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
@ -220,10 +218,13 @@ TabParent::GetSSLStatus(nsISupports ** aStatus)
}
mozilla::ipc::PDocumentRendererParent*
TabParent::AllocPDocumentRenderer(const PRInt32& x,
const PRInt32& y, const PRInt32& w, const PRInt32& h, const nsString& bgcolor,
const PRUint32& flags, const bool& flush)
PDocumentRendererParent*
TabParent::AllocPDocumentRenderer(const nsRect& documentRect,
const gfxMatrix& transform,
const nsString& bgcolor,
const PRUint32& renderFlags,
const bool& flushLayout,
const nsIntSize& renderSize)
{
return new DocumentRendererParent();
}
@ -235,38 +236,6 @@ TabParent::DeallocPDocumentRenderer(PDocumentRendererParent* actor)
return true;
}
mozilla::ipc::PDocumentRendererShmemParent*
TabParent::AllocPDocumentRendererShmem(const PRInt32& x,
const PRInt32& y, const PRInt32& w, const PRInt32& h, const nsString& bgcolor,
const PRUint32& flags, const bool& flush, const gfxMatrix& aMatrix,
Shmem& buf)
{
return new DocumentRendererShmemParent();
}
bool
TabParent::DeallocPDocumentRendererShmem(PDocumentRendererShmemParent* actor)
{
delete actor;
return true;
}
mozilla::ipc::PDocumentRendererNativeIDParent*
TabParent::AllocPDocumentRendererNativeID(const PRInt32& x,
const PRInt32& y, const PRInt32& w, const PRInt32& h, const nsString& bgcolor,
const PRUint32& flags, const bool& flush, const gfxMatrix& aMatrix,
const PRUint32& nativeID)
{
return new DocumentRendererNativeIDParent();
}
bool
TabParent::DeallocPDocumentRendererNativeID(PDocumentRendererNativeIDParent* actor)
{
delete actor;
return true;
}
PContentPermissionRequestParent*
TabParent::AllocPContentPermissionRequest(const nsCString& type, const IPC::URI& uri)
{
@ -694,7 +663,8 @@ PRenderFrameParent*
TabParent::AllocPRenderFrame()
{
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
return new RenderFrameParent(frameLoader);
NS_WARN_IF_FALSE(frameLoader, "'message sent to unknown actor ID' coming up");
return frameLoader ? new RenderFrameParent(frameLoader) : nsnull;
}
bool

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

@ -132,41 +132,13 @@ public:
PRInt32 aCharCode, PRInt32 aModifiers,
PRBool aPreventDefault);
virtual mozilla::ipc::PDocumentRendererParent* AllocPDocumentRenderer(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush);
virtual PDocumentRendererParent*
AllocPDocumentRenderer(const nsRect& documentRect, const gfxMatrix& transform,
const nsString& bgcolor,
const PRUint32& renderFlags, const bool& flushLayout,
const nsIntSize& renderSize);
virtual bool DeallocPDocumentRenderer(PDocumentRendererParent* actor);
virtual mozilla::ipc::PDocumentRendererShmemParent* AllocPDocumentRendererShmem(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
Shmem& buf);
virtual bool DeallocPDocumentRendererShmem(PDocumentRendererShmemParent* actor);
virtual mozilla::ipc::PDocumentRendererNativeIDParent* AllocPDocumentRendererNativeID(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRUint32& nativeID);
virtual bool DeallocPDocumentRendererNativeID(PDocumentRendererNativeIDParent* actor);
virtual PContentPermissionRequestParent* AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI& uri);
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestParent* actor);

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

@ -39,7 +39,5 @@ IPDLSRCS = \
PContent.ipdl \
PContentDialog.ipdl \
PDocumentRenderer.ipdl \
PDocumentRendererNativeID.ipdl \
PDocumentRendererShmem.ipdl \
PContentPermissionRequest.ipdl \
$(NULL)

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

@ -1052,7 +1052,6 @@ PluginInstanceChild::CreatePluginWindow()
return false;
// Apparently some plugins require an ASCII WndProc.
printf("setting DefWindowProcA\n");
SetWindowLongPtrA(mPluginWindowHWND, GWLP_WNDPROC,
reinterpret_cast<LONG_PTR>(DefWindowProcA));

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

@ -72,11 +72,12 @@
</intent-filter>
</activity>
<receiver android:enabled="true" android:name="Restarter">
<activity android:enabled="true" android:name="Restarter">
<intent-filter>
<action android:name="org.mozilla.gecko.restart@MOZ_APP_NAME@" />
<action android:name="org.mozilla.gecko.restart@MOZ_APP_NAME@"
android:process="@MOZ_APP_NAME@Restarter"/>
</intent-filter>
</receiver>
</activity>
#if MOZ_CRASHREPORTER
<activity android:name="CrashReporter"
android:label="@MOZ_APP_DISPLAYNAME@ Crash Reporter"

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

@ -57,6 +57,7 @@ public class CrashReporter extends Activity
{
static final String kMiniDumpPathKey = "upload_file_minidump";
static final String kPageURLKey = "URL";
static final String kNotesKey = "Notes";
ProgressDialog mProgressDialog;
File mPendingMinidumpFile;
File mPendingExtrasFile;
@ -230,10 +231,35 @@ public class CrashReporter extends Activity
if (key.equals(kPageURLKey)) {
if (includeURLCheckbox.isChecked())
sendPart(os, boundary, key, extras.get(key));
} else if (!key.equals("ServerURL")){
} else if (!key.equals("ServerURL") && !key.equals(kNotesKey)) {
sendPart(os, boundary, key, extras.get(key));
}
}
// Add some extra information to notes so its displayed by
// crash-stats.mozilla.org. Remove this when bug 607942 is fixed.
String notes = extras.containsKey(kNotesKey) ? extras.get(kNotesKey) +
"\n" : "";
if (@MOZ_MIN_CPU_VERSION@ < 7)
notes += "nothumb Build\n";
notes += Build.MANUFACTURER + " ";
notes += Build.MODEL + "\n";
notes += Build.FINGERPRINT;
sendPart(os, boundary, kNotesKey, notes);
sendPart(os, boundary, "Min_ARM_Version", "@MOZ_MIN_CPU_VERSION@");
sendPart(os, boundary, "Android_Manufacturer", Build.MANUFACTURER);
sendPart(os, boundary, "Android_Model", Build.MODEL);
sendPart(os, boundary, "Android_Board", Build.BOARD);
sendPart(os, boundary, "Android_Brand", Build.BRAND);
sendPart(os, boundary, "Android_CPU_ABI", Build.CPU_ABI);
sendPart(os, boundary, "Android_CPU_ABI2", Build.CPU_ABI2);
sendPart(os, boundary, "Android_Device", Build.DEVICE);
sendPart(os, boundary, "Android_Display", Build.DISPLAY);
sendPart(os, boundary, "Android_Fingerprint", Build.FINGERPRINT);
sendPart(os, boundary, "Android_Hardware", Build.HARDWARE);
sendPart(os, boundary, "Android_Version", Build.VERSION.SDK_INT + " (" + Build.VERSION.CODENAME + ")");
sendFile(os, boundary, kMiniDumpPathKey, minidumpFile);
os.write(("\r\n--" + boundary + "--\r\n").getBytes());
os.flush();

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

@ -447,8 +447,9 @@ abstract public class GeckoApp
intent.setClassName("org.mozilla." + getAppName(),
"org.mozilla." + getAppName() + ".Restarter");
addEnvToIntent(intent);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.i("GeckoAppJava", intent.toString());
sendBroadcast(intent);
startActivity(intent);
} catch (Exception e) {
Log.i("GeckoAppJava", e.toString());
}

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

@ -38,17 +38,19 @@
#filter substitution
package org.mozilla.@MOZ_APP_NAME@;
import android.app.*;
import android.content.*;
import android.util.*;
import android.os.*;
import java.io.*;
public class Restarter extends BroadcastReceiver {
public class Restarter extends Activity {
@Override
public void onReceive(Context aContext, Intent aIntent) {
public void onCreate(Bundle savedInstanceState) {
Log.i("Restarter", "trying to restart @MOZ_APP_NAME@");
try {
boolean stillRunning;
int spinCountdown = 8;
do {
stillRunning = false;
java.lang.Process p = Runtime.getRuntime().exec("/system/bin/ps");
@ -68,7 +70,11 @@ public class Restarter extends BroadcastReceiver {
}
}
}
} while(stillRunning);
if (stillRunning)
spinCountdown--;
else
spinCountdown = 0;
} while(spinCountdown != 0);
} catch (Exception e) {
Log.i("Restarter", e.toString());
}
@ -77,12 +83,12 @@ public class Restarter extends BroadcastReceiver {
Intent intent = new Intent(action);
intent.setClassName("org.mozilla.@MOZ_APP_NAME@",
"org.mozilla.@MOZ_APP_NAME@.App");
Bundle b = aIntent.getExtras();
Bundle b = getIntent().getExtras();
if (b != null)
intent.putExtras(b);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.i("GeckoAppJava", intent.toString());
aContext.startActivity(intent);
startActivity(intent);
} catch (Exception e) {
Log.i("Restarter", e.toString());
}

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

@ -78,6 +78,7 @@ XPIDLSRCS = \
nsIEmbeddingSiteWindow2.idl \
nsIContextMenuListener2.idl \
nsIWebBrowserChrome2.idl \
nsIWebBrowserChrome3.idl \
$(NULL)
CPPSRCS = \

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

@ -1,60 +1,65 @@
/* ***** 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 Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* Nokia.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/ipc/DocumentRendererNativeIDParent.h"
using namespace mozilla::ipc;
DocumentRendererNativeIDParent::DocumentRendererNativeIDParent()
{}
DocumentRendererNativeIDParent::~DocumentRendererNativeIDParent()
{}
void
DocumentRendererNativeIDParent::SetCanvas(nsICanvasRenderingContextInternal* aCanvas)
{
mCanvas = aCanvas;
}
bool
DocumentRendererNativeIDParent::Recv__delete__(const PRInt32& x, const PRInt32& y,
const PRInt32& w, const PRInt32& h,
const PRUint32& nativeID)
{
mCanvas->Swap(nativeID, x, y, w, h);
return true;
}
/* ***** 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):
* Margaret Leibovic <margaret.leibovic@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIWebBrowserChrome2.idl"
#include "nsIURI.idl"
#include "nsIDOMNode.idl"
/**
* nsIWebBrowserChrome3 is an extension to nsIWebBrowserChrome2.
*/
[scriptable, uuid(7f2aa813-b250-4e46-afeb-97b1e91bc9a5)]
interface nsIWebBrowserChrome3 : nsIWebBrowserChrome2
{
/**
* Determines the appropriate target for a link.
*
* @param originalTarget
* The original link target.
* @param linkURI
* Link destination URI.
* @param aDOMNode
* Link DOM node.
* @param isAppTab
* Whether or not the link is in an app tab.
* @returns A new link target, if appropriate.
* Otherwise returns originalTarget.
*/
AString onBeforeLinkTraversal(in AString originalTarget,
in nsIURI linkURI,
in nsIDOMNode linkNode,
in PRBool isAppTab);
};

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

@ -1151,6 +1151,9 @@ struct cached_bitmap {
_cairo_d2d_release_factory();
}
/* Device this cached bitmap was created with, we should really have a per
* device cache, see bug 607408 */
cairo_d2d_device_t *device;
/** The cached bitmap */
RefPtr<ID2D1Bitmap> bitmap;
/** The cached bitmap is dirty and needs its data refreshed */
@ -1717,6 +1720,13 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf,
*/
return NULL;
}
if (srcSurf->device != d2dsurf->device) {
/* This code does not work if the source surface does not use
* the same device. Some work could be done to do something
* fairly efficient here, for now, fallback.
*/
return NULL;
}
_cairo_d2d_update_surface_bitmap(srcSurf);
_cairo_d2d_flush(srcSurf);
@ -1857,6 +1867,9 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf,
(cached_bitmap*)cairo_surface_get_user_data(
surfacePattern->surface,
key);
if (cachebitmap && cachebitmap->device != d2dsurf->device) {
cachebitmap = NULL;
}
}
if (cachebitmap) {
@ -1926,6 +1939,7 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf,
/* We can cache it if it isn't a partial bitmap */
cachebitmap->dirty = false;
cachebitmap->bitmap = sourceBitmap;
cachebitmap->device = d2dsurf->device;
/*
* This will start out with two references, one on the snapshot
* and one more in the user data structure.

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

@ -81,7 +81,11 @@
// Because the QPainter backend has some problems with glyphs rendering
// it is better to use image or xlib cairo backends by default
#if (MOZ_PLATFORM_MAEMO == 6)
#define DEFAULT_RENDER_MODE RENDER_BUFFERED
#else
#define DEFAULT_RENDER_MODE RENDER_DIRECT
#endif
static QPaintEngine::Type sDefaultQtPaintEngineType = QPaintEngine::X11;
gfxFontconfigUtils *gfxQtPlatform::sFontconfigUtils = nsnull;
@ -146,6 +150,9 @@ gfxQtPlatform::gfxQtPlatform()
case 1:
mRenderMode = RENDER_BUFFERED;
break;
case 2:
mRenderMode = RENDER_DIRECT;
break;
default:
mRenderMode = RENDER_QPAINTER;
}
@ -207,7 +214,7 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
}
#endif
if (mRenderMode == RENDER_BUFFERED &&
if ((mRenderMode == RENDER_BUFFERED || mRenderMode == RENDER_DIRECT) &&
sDefaultQtPaintEngineType != QPaintEngine::X11) {
newSurface = new gfxImageSurface(size, imageFormat);
return newSurface.forget();

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

@ -60,6 +60,8 @@ public:
RENDER_QPAINTER = 0,
/* Use offscreen buffer for rendering with image or xlib gfx backend */
RENDER_BUFFERED,
/* Direct rendering to Widget surface */
RENDER_DIRECT,
/* max */
RENDER_MODE_MAX
};

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

@ -586,6 +586,28 @@ struct ParamTraits<nsIntSize>
}
};
template<>
struct ParamTraits<nsRect>
{
typedef nsRect paramType;
static void Write(Message* msg, const paramType& param)
{
WriteParam(msg, param.x);
WriteParam(msg, param.y);
WriteParam(msg, param.width);
WriteParam(msg, param.height);
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
return (ReadParam(msg, iter, &result->x) &&
ReadParam(msg, iter, &result->y) &&
ReadParam(msg, iter, &result->width) &&
ReadParam(msg, iter, &result->height));
}
};
template<>
struct ParamTraits<gfxIntSize>
{

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

@ -240,12 +240,6 @@ ProcessOrDeferMessage(HWND hwnd,
deferred = new DeferredRedrawMessage(hwnd, flags);
break;
}
case WM_NCPAINT: {
UINT flags = RDW_INVALIDATE | RDW_FRAME | RDW_NOINTERNALPAINT |
RDW_NOERASE | RDW_NOCHILDREN | RDW_ERASENOW;
deferred = new DeferredRedrawMessage(hwnd, flags);
break;
}
// This message will generate a WM_PAINT message if there are invalid
// areas.
@ -289,6 +283,7 @@ ProcessOrDeferMessage(HWND hwnd,
// Messages that are safe to pass to DefWindowProc go here.
case WM_ENTERIDLE:
case WM_GETICON:
case WM_NCPAINT: // (never trap nc paint events)
case WM_GETMINMAXINFO:
case WM_GETTEXT:
case WM_NCHITTEST:

9
ipc/ipdl/msgtype-components Executable file
Просмотреть файл

@ -0,0 +1,9 @@
#!/usr/bin/python
import sys
msgid = int(sys.argv[1])
protocol = (msgid >> 16)
msg = (msgid - (protocol << 16))
print 'protocol', protocol, 'message', msg

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

@ -916,8 +916,6 @@ JS_StringToVersion(const char *string);
#define JSOPTION_METHODJIT JS_BIT(14) /* Whole-method JIT. */
#define JSOPTION_PROFILING JS_BIT(15) /* Profiler to make tracer/methodjit choices. */
#define JSOPTION_ROPES JS_BIT(16) /* Enable rope optimization for
* string concat. */
extern JS_PUBLIC_API(uint32)
JS_GetOptions(JSContext *cx);

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

@ -269,8 +269,6 @@ FinishConcat(JSContext *cx, bool usingLeft, bool usingRight,
left->convertToInteriorNode(res);
if (usingRight)
right->convertToInteriorNode(res);
if (!JS_HAS_OPTION(cx, JSOPTION_ROPES))
res->flatten();
return res;
}

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

@ -255,7 +255,7 @@ JSWrapper::obj_toString(JSContext *cx, JSObject *wrapper)
JSString *str;
if (!enter(cx, wrapper, JSID_VOID, GET))
return NULL;
str = JSProxyHandler::obj_toString(cx, wrapper);
str = obj_toStringHelper(cx, wrappedObject(wrapper));
leave(cx, wrapper);
return str;
}

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

@ -5436,7 +5436,7 @@ main(int argc, char **argv, char **envp)
if (!cx)
return 1;
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_ANONFUNFIX | JSOPTION_ROPES);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_ANONFUNFIX);
JS_SetGCParameterForThread(cx, JSGC_MAX_CODE_CACHE_BYTES, 16 * 1024 * 1024);
result = Shell(cx, argc, argv, envp);

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

@ -420,18 +420,28 @@ typedef enum {
SIDE_CLIP_RECTANGLE
} SideClipType;
// Given three points, p0, p1, and midPoint, if p0 and p1 do not form
// a horizontal or vertical line move p1 to the point nearest the
// midpoint, while maintaing the slope of the line.
// Given three points, p0, p1, and midPoint, move p1 to the point
// nearest the midpoint, while maintaing the slope of the line. p0 and
// p1 must be distinct.
static void
MaybeMoveToMidPoint(gfxPoint& aP0, gfxPoint& aP1, const gfxPoint& aMidPoint)
{
gfxPoint ps = aP1 - aP0;
if (ps.x != 0.0 && ps.y != 0.0) {
gfxFloat k = NS_MIN((aMidPoint.x - aP0.x) / ps.x,
(aMidPoint.y - aP1.y) / ps.y);
aP1 = aP0 + ps * k;
if (ps.x == 0.0) {
if (ps.y == 0.0) {
NS_NOTREACHED("points should be different");
} else {
aP1.y = aMidPoint.y;
}
} else {
if (ps.y == 0.0) {
aP1.x = aMidPoint.x;
} else {
gfxFloat k = NS_MIN((aMidPoint.x - aP0.x) / ps.x,
(aMidPoint.y - aP1.y) / ps.y);
aP1 = aP0 + ps * k;
}
}
}

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

@ -1624,6 +1624,8 @@ DocumentViewerImpl::Destroy()
mPresContext = nsnull;
}
mWindow = nsnull;
mViewManager = nsnull;
mContainer = nsnull;
return NS_OK;
@ -2679,7 +2681,8 @@ NS_IMETHODIMP DocumentViewerImpl::ScrollToNode(nsIDOMNode* aNode)
// Tell the PresShell to scroll to the primary frame of the content.
NS_ENSURE_SUCCESS(presShell->ScrollContentIntoView(content,
NS_PRESSHELL_SCROLL_TOP,
NS_PRESSHELL_SCROLL_ANYWHERE),
NS_PRESSHELL_SCROLL_ANYWHERE,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN),
NS_ERROR_FAILURE);
return NS_OK;
}

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

@ -22,6 +22,7 @@
* Contributor(s):
* Steve Clark <buster@netscape.com>
* Dan Rosen <dr@netscape.com>
* Mihai Șucan <mihai.sucan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -139,8 +140,8 @@ typedef struct CapturingContentInfo {
} CapturingContentInfo;
#define NS_IPRESSHELL_IID \
{ 0xb79574cd, 0x2555, 0x4b57, \
{ 0xb3, 0xf8, 0x27, 0x57, 0x3e, 0x60, 0x74, 0x01 } }
{ 0xd1978bee, 0x43b9, 0x40de, \
{ 0x95, 0x47, 0x85, 0x06, 0x5e, 0x02, 0xec, 0xb4 } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -544,10 +545,18 @@ public:
* horizontally . A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
* the frame the minimum amount necessary in order for the entire
* frame to be visible horizontally (if possible)
* @param aFlags If SCROLL_FIRST_ANCESTOR_ONLY is set, only the nearest
* scrollable ancestor is scrolled, otherwise all
* scrollable ancestors may be scrolled if necessary.
* If SCROLL_OVERFLOW_HIDDEN is set then we may scroll in a
* direction even if overflow:hidden is specified in that
* direction; otherwise we will not scroll in that direction
* when overflow:hidden is set for that direction.
*/
virtual NS_HIDDEN_(nsresult) ScrollContentIntoView(nsIContent* aContent,
PRIntn aVPercent,
PRIntn aHPercent) = 0;
PRIntn aHPercent,
PRUint32 aFlags) = 0;
enum {
SCROLL_FIRST_ANCESTOR_ONLY = 0x01,
@ -804,6 +813,7 @@ public:
* XXX this should include image animations
*/
virtual void Freeze() = 0;
PRBool IsFrozen() { return mFrozen; }
/**
* Restarts active elements (plugins) in this presentation and in the

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

@ -26,6 +26,7 @@
* Dan Rosen <dr@netscape.com>
* Daniel Glazman <glazman@netscape.com>
* Mats Palmgren <matspal@gmail.com>
* Mihai Șucan <mihai.sucan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -773,7 +774,8 @@ public:
virtual NS_HIDDEN_(nsresult) ScrollContentIntoView(nsIContent* aContent,
PRIntn aVPercent,
PRIntn aHPercent);
PRIntn aHPercent,
PRUint32 aFlags);
virtual PRBool ScrollFrameRectIntoView(nsIFrame* aFrame,
const nsRect& aRect,
PRIntn aVPercent,
@ -1005,7 +1007,8 @@ protected:
// Helper for ScrollContentIntoView
void DoScrollContentIntoView(nsIContent* aContent,
PRIntn aVPercent,
PRIntn aHPercent);
PRIntn aHPercent,
PRUint32 aFlags);
friend struct AutoRenderingStateSaveRestore;
friend struct RenderingState;
@ -3906,7 +3909,8 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
if (content) {
if (aScroll) {
rv = ScrollContentIntoView(content, NS_PRESSHELL_SCROLL_TOP,
NS_PRESSHELL_SCROLL_ANYWHERE);
NS_PRESSHELL_SCROLL_ANYWHERE,
SCROLL_OVERFLOW_HIDDEN);
NS_ENSURE_SUCCESS(rv, rv);
nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable();
@ -4013,7 +4017,8 @@ PresShell::ScrollToAnchor()
return NS_OK;
nsresult rv = ScrollContentIntoView(mLastAnchorScrolledTo, NS_PRESSHELL_SCROLL_TOP,
NS_PRESSHELL_SCROLL_ANYWHERE);
NS_PRESSHELL_SCROLL_ANYWHERE,
SCROLL_OVERFLOW_HIDDEN);
mLastAnchorScrolledTo = nsnull;
return rv;
}
@ -4196,7 +4201,8 @@ static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
nsresult
PresShell::ScrollContentIntoView(nsIContent* aContent,
PRIntn aVPercent,
PRIntn aHPercent)
PRIntn aHPercent,
PRUint32 aFlags)
{
nsCOMPtr<nsIContent> content = aContent; // Keep content alive while flushing.
NS_ENSURE_TRUE(content, NS_ERROR_NULL_POINTER);
@ -4221,7 +4227,7 @@ PresShell::ScrollContentIntoView(nsIContent* aContent,
// than a single best-effort scroll followed by one final scroll on the first
// completed reflow.
if (mContentToScrollTo) {
DoScrollContentIntoView(content, aVPercent, aHPercent);
DoScrollContentIntoView(content, aVPercent, aHPercent, aFlags);
}
return NS_OK;
}
@ -4229,7 +4235,8 @@ PresShell::ScrollContentIntoView(nsIContent* aContent,
void
PresShell::DoScrollContentIntoView(nsIContent* aContent,
PRIntn aVPercent,
PRIntn aHPercent)
PRIntn aHPercent,
PRUint32 aFlags)
{
NS_ASSERTION(mDidInitialReflow, "should have done initial reflow by now");
@ -4272,7 +4279,7 @@ PresShell::DoScrollContentIntoView(nsIContent* aContent,
} while ((frame = frame->GetNextContinuation()));
ScrollFrameRectIntoView(container, frameBounds, aVPercent, aHPercent,
SCROLL_OVERFLOW_HIDDEN);
aFlags);
}
PRBool
@ -4873,7 +4880,8 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
if (ProcessReflowCommands(aType < Flush_Layout) && mContentToScrollTo) {
// We didn't get interrupted. Go ahead and scroll to our content
DoScrollContentIntoView(mContentToScrollTo, mContentScrollVPosition,
mContentScrollHPosition);
mContentScrollHPosition,
SCROLL_OVERFLOW_HIDDEN);
mContentToScrollTo = nsnull;
}
}
@ -7161,7 +7169,8 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTarge
// an edit box below the current view, you'll get the edit box aligned with
// the top of the window. This is arguably better behavior anyway.
rv = ScrollContentIntoView(content, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE);
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
SCROLL_OVERFLOW_HIDDEN);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
frame = content->GetPrimaryFrame();
NS_WARN_IF_FALSE(frame, "No frame for focused content?");
@ -7224,7 +7233,8 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
{
nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(aCurrentEl));
ScrollContentIntoView(focusedContent, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE);
NS_PRESSHELL_SCROLL_ANYWHERE,
SCROLL_OVERFLOW_HIDDEN);
nsPresContext* presContext = GetPresContext();

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

@ -54,6 +54,33 @@ function sendMouseUp(el) {
utils.sendMouseEvent('mouseup', rect.left + 5, rect.top + 5, 0, 1, 0);
}
function fireEvent(target, event) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var utils =
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.dispatchDOMEventViaPresShell(target, event, true);
}
function fireDrop(element) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var ds = Components.classes["@mozilla.org/widget/dragservice;1"].
getService(Components.interfaces.nsIDragService);
ds.startDragSession();
var event = document.createEvent("DragEvents");
event.initDragEvent("dragover", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null, null);
fireEvent(element, event);
event = document.createEvent("DragEvents");
event.initDragEvent("drop", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null, null);
fireEvent(element, event);
ds.endDragSession(false);
ok(!ds.getCurrentSession(), "There shouldn't be a drag session anymore!");
}
function runTest() {
var d1 = document.getElementById("d1");
var didGetMouseMove = false;
@ -65,7 +92,27 @@ function runTest() {
true);
sendMouseMoveFaraway(d1);
ok(didGetMouseMove, "Should have got mousemove!");
sendMouseUp(d1)
sendMouseUp(d1);
didGetMouseMove = false;
document.addEventListener("mousedown",
function (e) {
e.preventDefault();
},
true);
sendMouseDown(d1);
sendMouseMoveFaraway(d1);
ok(didGetMouseMove, "Should have got mousemove! (2)");
sendMouseUp(d1);
didGetMouseMove = false;
sendMouseDown(d1);
fireDrop(d1);
sendMouseMoveFaraway(d1);
ok(!didGetMouseMove, "Shouldn't have got mousemove!");
SimpleTest.finish();
}

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

@ -365,6 +365,7 @@ public:
static void RemoveFromCARefreshTimer(nsPluginInstanceOwner *aPluginInstance);
void SetupCARefresh();
void* FixUpPluginWindow(PRInt32 inPaintState);
void HidePluginWindow();
// Set a flag that (if true) indicates the plugin port info has changed and
// SetWindow() needs to be called.
void SetPluginPortChanged(PRBool aState) { mPluginPortChanged = aState; }
@ -1102,8 +1103,6 @@ nsObjectFrame::CallSetWindow()
if (IsHidden())
return;
PRBool windowless = (window->type == NPWindowTypeDrawable);
// refresh the plugin port as well
window->window = mInstanceOwner->GetPluginPortFromWidget();
@ -2463,7 +2462,11 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
if (DoDelayedStop(aInstanceOwner, aDelayedStop))
return;
#if defined(XP_MACOSX)
aInstanceOwner->HidePluginWindow();
#endif
inst->Stop();
nsCOMPtr<nsIPluginHost> pluginHost = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
@ -2544,17 +2547,21 @@ nsObjectFrame::StopPluginInternal(PRBool aDelayedStop)
if (mWidget) {
nsRootPresContext* rootPC = PresContext()->GetRootPresContext();
NS_ASSERTION(rootPC, "unable to unregister the plugin frame");
rootPC->UnregisterPluginForGeometryUpdates(this);
if (rootPC) {
rootPC->UnregisterPluginForGeometryUpdates(this);
// Make sure the plugin is hidden in case an update of plugin geometry
// hasn't happened since this plugin became hidden.
nsIWidget* parent = mWidget->GetParent();
if (parent) {
nsTArray<nsIWidget::Configuration> configurations;
GetEmptyClipConfiguration(&configurations);
parent->ConfigureChildren(configurations);
DidSetWidgetGeometry();
// Make sure the plugin is hidden in case an update of plugin geometry
// hasn't happened since this plugin became hidden.
nsIWidget* parent = mWidget->GetParent();
if (parent) {
nsTArray<nsIWidget::Configuration> configurations;
GetEmptyClipConfiguration(&configurations);
parent->ConfigureChildren(configurations);
}
}
else {
NS_ASSERTION(PresContext()->PresShell()->IsFrozen(),
"unable to unregister the plugin frame");
}
}
@ -6424,6 +6431,19 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
return nsnull;
}
void
nsPluginInstanceOwner::HidePluginWindow()
{
if (!mPluginWindow || !mInstance) {
return;
}
mPluginWindow->clipRect.bottom = mPluginWindow->clipRect.top;
mPluginWindow->clipRect.right = mPluginWindow->clipRect.left;
mWidgetVisible = PR_FALSE;
mInstance->SetWindow(mPluginWindow);
}
#endif // XP_MACOSX
// Little helper function to resolve relative URL in

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше