Merge mozilla-central to services-central

This commit is contained in:
Philipp von Weitershausen 2011-05-16 10:08:13 -07:00
Родитель 7a62de171f b322549366
Коммит 7cb54bbcd1
299 изменённых файлов: 4049 добавлений и 2279 удалений

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

@ -57,7 +57,6 @@
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMNodeFilter.h"
@ -3220,16 +3219,15 @@ nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
if (accessible)
return accessible;
nsCOMPtr<nsIDOMDocumentTraversal> trav =
do_QueryInterface(aStartNode->GetOwnerDoc());
NS_ENSURE_TRUE(trav, nsnull);
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aStartNode->GetOwnerDoc());
NS_ENSURE_TRUE(domDoc, nsnull);
nsCOMPtr<nsIDOMNode> currentNode = do_QueryInterface(aStartNode);
nsCOMPtr<nsIDOMNode> rootNode(do_QueryInterface(GetNode()));
nsCOMPtr<nsIDOMNode> rootNode = do_QueryInterface(GetNode());
nsCOMPtr<nsIDOMTreeWalker> walker;
trav->CreateTreeWalker(rootNode,
nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_TEXT,
nsnull, PR_FALSE, getter_AddRefs(walker));
domDoc->CreateTreeWalker(rootNode,
nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_TEXT,
nsnull, PR_FALSE, getter_AddRefs(walker));
NS_ENSURE_TRUE(walker, nsnull);
walker->SetCurrentNode(currentNode);

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

@ -49,7 +49,6 @@
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMRange.h"
#include "nsISelection2.h"
#include "nsISelectionPrivate.h"

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

@ -50,8 +50,8 @@ _TEST_FILES = \
test_doc.html \
test_hypertext.html \
test_passwords.html \
test_singleline.html \
test_whitespaces.html \
$(warning test_singleline.html disabled due to bug 652459) \
$(warning test_whitespaces.html disabled due to bug 652459) \
test_words.html \
$(NULL)

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

@ -536,7 +536,7 @@
<menuseparator id="devToolsSeparator"/>
<menu id="webDeveloperMenu"
label="&webDeveloperMenu.label;"
accesskey="webDeveloperMenu.accesskey;">
accesskey="&webDeveloperMenu.accesskey;">
<menupopup id="menuWebDeveloperPopup">
<menuitem id="webConsole"
label="&webConsoleCmd.label;"

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

@ -8488,7 +8488,7 @@ var TabContextMenu = {
updateContextMenu: function updateContextMenu(aPopupMenu) {
this.contextTab = document.popupNode.localName == "tab" ?
document.popupNode : gBrowser.selectedTab;
let disabled = gBrowser.visibleTabs.length == 1;
let disabled = gBrowser.tabs.length == 1;
// Enable the "Close Tab" menuitem when the window doesn't close with the last tab.
document.getElementById("context_closeTab").disabled =
@ -8498,6 +8498,11 @@ var TabContextMenu = {
for (var i = 0; i < menuItems.length; i++)
menuItems[i].disabled = disabled;
disabled = gBrowser.visibleTabs.length == 1;
menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple-visible");
for (var i = 0; i < menuItems.length; i++)
menuItems[i].disabled = disabled;
// Session store
document.getElementById("context_undoCloseTab").disabled =
Cc["@mozilla.org/browser/sessionstore;1"].

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

@ -139,7 +139,7 @@
oncommand="gBrowser.replaceTabWithWindow(TabContextMenu.contextTab);"/>
<menuseparator/>
<menuitem id="context_reloadAllTabs" label="&reloadAllTabs.label;" accesskey="&reloadAllTabs.accesskey;"
tbattr="tabbrowser-multiple"
tbattr="tabbrowser-multiple-visible"
oncommand="gBrowser.reloadAllTabs();"/>
<menuitem id="context_bookmarkAllTabs"
label="&bookmarkAllTabs.label;"
@ -844,9 +844,8 @@
key="key_tabview"
label="&viewTabGroups.label;"
command="Browser:ToggleTabView"
observes="tabviewGroupsNumber"
keepme="true"/>
<menuseparator id="alltabs-popup-separator" keepme="true"/>
observes="tabviewGroupsNumber"/>
<menuseparator id="alltabs-popup-separator"/>
</menupopup>
</toolbarbutton>

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

@ -3142,12 +3142,15 @@
<method name="_handleNewTab">
<parameter name="tab"/>
<body><![CDATA[
if (tab.parentNode != this || tab._fullyOpen)
if (tab.parentNode != this)
return;
tab._fullyOpen = true;
this.adjustTabstrip();
if (tab._fullyOpen)
return;
tab._fullyOpen = true;
if (tab.getAttribute("selected") == "true") {
this._fillTrailingGap();
this._handleTabSelect();
@ -3735,7 +3738,12 @@
var tabstripBO = tabContainer.mTabstrip.scrollBoxObject;
for (var i = 0; i < this.childNodes.length; i++) {
var curTabBO = this.childNodes[i].tab.boxObject;
let curTab = this.childNodes[i].tab;
if (!curTab) // "Tab Groups" menuitem and its menuseparator
continue;
let curTabBO = curTab.boxObject;
if (!curTabBO) // "Tabs From Other Computers" menuitem
continue;
if (curTabBO.screenX >= tabstripBO.screenX &&
curTabBO.screenX + curTabBO.width <= tabstripBO.screenX + tabstripBO.width)
this.childNodes[i].setAttribute("tabIsVisible", "true");
@ -3812,7 +3820,7 @@
// clear out the menu popup and remove the listeners
for (let i = this.childNodes.length - 1; i > 0; i--) {
let menuItem = this.childNodes[i];
if (!menuItem.hasAttribute("keepme")) {
if (menuItem.tab) {
menuItem.removeEventListener("command", this, false);
menuItem.tab.mCorrespondingMenuitem = null;
this.removeChild(menuItem);

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

@ -739,8 +739,6 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
this.droppable(true);
this.setTrenches(this.bounds);
UI.setActive(this);
iQ(this.container).show().animate({
"-moz-transform": "scale(1)",
"opacity": 1
@ -750,11 +748,13 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
self._children.forEach(function(child) {
iQ(child.container).show();
});
UI.setActive(self);
self._sendToSubscribers("groupShown", { groupItemId: self.id });
}
});
GroupItems.updateGroupCloseButtons();
self._sendToSubscribers("groupShown", { groupItemId: self.id });
},
// ----------
@ -1913,7 +1913,7 @@ let GroupItems = {
// ----------
// Function: uninit
uninit : function GroupItems_uninit () {
uninit: function GroupItems_uninit() {
// call our cleanup functions
this._cleanupFunctions.forEach(function(func) {
func();
@ -1928,7 +1928,7 @@ let GroupItems = {
// ----------
// Function: newGroup
// Creates a new empty group.
newGroup: function () {
newGroup: function GroupItems_newGroup() {
let bounds = new Rect(20, 20, 250, 200);
return new GroupItem([], {bounds: bounds, immediately: true});
},

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

@ -56,7 +56,7 @@ function test() {
// Check the context menu with one tab.
popup(testTab);
is(TabContextMenu.contextTab, testTab, "TabContextMenu context is the test tab");
is(document.getElementById("context_closeTab").disabled, true, "Close Tab is disabled");
is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
// Add a tab that will get pinned

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

@ -100,10 +100,12 @@ _BROWSER_FILES = \
browser_tabview_bug622872.js \
browser_tabview_bug623768.js \
browser_tabview_bug624265.js \
browser_tabview_bug624931.js \
browser_tabview_bug624692.js \
browser_tabview_bug624727.js \
browser_tabview_bug624847.js \
browser_tabview_bug624931.js \
browser_tabview_bug624953.js \
browser_tabview_bug625195.js \
browser_tabview_bug625269.js \
browser_tabview_bug625424.js \
browser_tabview_bug625666.js \
@ -135,6 +137,7 @@ _BROWSER_FILES = \
browser_tabview_bug649006.js \
browser_tabview_bug649307.js \
browser_tabview_bug651311.js \
browser_tabview_bug654941.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \
browser_tabview_expander.js \

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

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
newWindowWithTabView(function (win) {
registerCleanupFunction(function () win.close());
let cw = win.TabView.getContentWindow();
let groupItem = cw.GroupItems.groupItems[0];
let tabItem = groupItem.getChild(0);
hideGroupItem(groupItem, function () {
unhideGroupItem(groupItem, function () {
let bounds = tabItem.getBounds();
groupItem.arrange({immediately: true});
ok(bounds.equals(tabItem.getBounds()),
"tabItem bounds were correct after unhiding the groupItem");
finish();
});
});
});
}

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

@ -0,0 +1,55 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
is(gBrowser.tabs.length, 1, "Only one tab exist");
let originalTab = gBrowser.tabs[0];
popup(originalTab);
ok(document.getElementById("context_closeTab").disabled, "The 'Close tab' menu item is disabled");
ok(document.getElementById("context_openTabInWindow").disabled, "The 'Move to New Window' menu item is disabled");
let newTabOne = gBrowser.addTab("about:blank", {skipAnimation: true});
waitForExplicitFinish();
showTabView(function() {
registerCleanupFunction(function () {
if (gBrowser.tabs[1])
gBrowser.removeTab(gBrowser.tabs[1]);
if (gBrowser.tabs[2])
gBrowser.removeTab(gBrowser.tabs[2]);
TabView.hide();
});
let contentWindow = TabView.getContentWindow();
is(contentWindow.GroupItems.groupItems.length, 1, "Has one group only");
let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
ok(tabItems.length, 2, "There are two tabItems in this group");
whenTabViewIsHidden(function() {
popup(gBrowser.tabs[0]);
ok(!document.getElementById("context_closeTab").disabled, "The 'Close tab' menu item is enabled");
ok(!document.getElementById("context_openTabInWindow").disabled, "The 'Move to New Window' menu item is enabled");
let newTabTwo = gBrowser.selectedTab;
gBrowser.selected = originalTab;
gBrowser.removeTab(newTabOne);
gBrowser.removeTab(newTabTwo);
finish();
});
let newGroup = contentWindow.GroupItems.newGroup();
newGroup.newTab();
});
}
function popup(tab) {
document.popupNode = tab;
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
}

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

@ -0,0 +1,33 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
let compareCanvasSize = function (prefix, width, height, tabItem) {
let canvas = tabItem.$canvas[0];
is(canvas.width, width, prefix + ": canvas widths are equal (" + width + "px)");
is(canvas.height, height, prefix + ": canvas heights are equal (" + height + "px)");
};
newWindowWithTabView(function (win) {
registerCleanupFunction(function () win.close());
let cw = win.TabView.getContentWindow();
let groupItem = cw.GroupItems.groupItems[0];
let tabItem = groupItem.getChild(0);
afterAllTabItemsUpdated(function () {
let {width, height} = tabItem.$canvas[0];
hideGroupItem(groupItem, function () {
compareCanvasSize("hidden", width, height, tabItem);
unhideGroupItem(groupItem, function () {
compareCanvasSize("unhidden", width, height, tabItem);
finish();
});
});
}, win);
});
}

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

@ -910,5 +910,10 @@ var gCookiesWindow = {
var filter = document.getElementById("filter");
filter.focus();
filter.select();
},
onWindowKeyPress: function (aEvent) {
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
window.close();
}
};

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

@ -49,7 +49,8 @@
style="width: &window.width;;"
onload="gCookiesWindow.init();"
onunload="gCookiesWindow.uninit();"
persist="screenX screenY width height">
persist="screenX screenY width height"
onkeypress="gCookiesWindow.onWindowKeyPress(event);">
<script src="chrome://browser/content/preferences/permissionsutils.js"/>
<script src="chrome://browser/content/preferences/cookies.js"/>

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

@ -159,6 +159,12 @@ var gPermissionManager = {
document.getElementById("btnAllow").disabled = !aSiteField.value;
},
onWindowKeyPress: function (aEvent)
{
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
window.close();
},
onHostKeyPress: function (aEvent)
{
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)

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

@ -51,7 +51,8 @@
style="width: &window.width;;"
onload="gPermissionManager.onLoad();"
onunload="gPermissionManager.uninit();"
persist="screenX screenY width height">
persist="screenX screenY width height"
onkeypress="gPermissionManager.onWindowKeyPress(event);">
<script src="chrome://browser/content/preferences/permissionsutils.js"/>
<script src="chrome://browser/content/preferences/permissions.js"/>

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

@ -182,8 +182,10 @@ function onListClick(aEvent) {
#endif
if ((aEvent.button == 1 || aEvent.button == 0 && aEvent.detail == 2 || accelKey) &&
col.value.id == "title" &&
!treeView.isContainer(row.value))
!treeView.isContainer(row.value)) {
restoreSingleTab(row.value, aEvent.shiftKey);
aEvent.stopPropagation();
}
else if (col.value.id == "restore")
toggleRowChecked(row.value);
}

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

@ -771,36 +771,41 @@ SessionStoreService.prototype = {
if (closedWindowState) {
let newWindowState;
#ifdef XP_MACOSX
// We want to split the window up into pinned tabs and unpinned tabs.
// Pinned tabs should be restored. If there are any remaining tabs,
// they should be added back to _closedWindows.
// We'll cheat a little bit and reuse _prepDataForDeferredRestore
// even though it wasn't built exactly for this.
let [appTabsState, normalTabsState] =
this._prepDataForDeferredRestore(JSON.stringify({ windows: [closedWindowState] }));
#ifndef XP_MACOSX
if (!this._doResumeSession()) {
#endif
// We want to split the window up into pinned tabs and unpinned tabs.
// Pinned tabs should be restored. If there are any remaining tabs,
// they should be added back to _closedWindows.
// We'll cheat a little bit and reuse _prepDataForDeferredRestore
// even though it wasn't built exactly for this.
let [appTabsState, normalTabsState] =
this._prepDataForDeferredRestore(JSON.stringify({ windows: [closedWindowState] }));
// These are our pinned tabs, which we should restore
if (appTabsState.windows.length) {
newWindowState = appTabsState.windows[0];
delete newWindowState.__lastSessionWindowID;
}
// These are our pinned tabs, which we should restore
if (appTabsState.windows.length) {
newWindowState = appTabsState.windows[0];
delete newWindowState.__lastSessionWindowID;
}
// In case there were no unpinned tabs, remove the window from _closedWindows
if (!normalTabsState.windows.length) {
this._closedWindows.splice(closedWindowIndex, 1);
// In case there were no unpinned tabs, remove the window from _closedWindows
if (!normalTabsState.windows.length) {
this._closedWindows.splice(closedWindowIndex, 1);
}
// Or update _closedWindows with the modified state
else {
delete normalTabsState.windows[0].__lastSessionWindowID;
this._closedWindows[closedWindowIndex] = normalTabsState.windows[0];
}
#ifndef XP_MACOSX
}
// Or update _closedWindows with the modified state
else {
delete normalTabsState.windows[0].__lastSessionWindowID;
this._closedWindows[closedWindowIndex] = normalTabsState.windows[0];
// If we're just restoring the window, make sure it gets removed from
// _closedWindows.
this._closedWindows.splice(closedWindowIndex, 1);
newWindowState = closedWindowState;
delete newWindowState.hidden;
}
#else
// If we're just restoring the window, make sure it gets removed from
// _closedWindows.
this._closedWindows.splice(closedWindowIndex, 1);
newWindowState = closedWindowState;
delete newWindowState.hidden;
#endif
if (newWindowState) {
// Ensure that the window state isn't hidden

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

@ -21,14 +21,7 @@ function closeFirstWin(win) {
win.BrowserTryToCloseWindow();
ok(win.closed, "window closed");
// The second check will be platform dependent. After bug 592833, Win/Linux
// will restore all tabs from the last close window while OSX will just
// reopen pinned tabs.
let expectedURIs = URIS_PINNED.concat(URIS_NORMAL_B);
if (!navigator.platform.match(/Mac/))
expectedURIs = expectedURIs.concat(URIS_NORMAL_A);
openWinWithCb(checkSecondWin, URIS_NORMAL_B, expectedURIs);
openWinWithCb(checkSecondWin, URIS_NORMAL_B, URIS_PINNED.concat(URIS_NORMAL_B));
}
function checkSecondWin(win) {

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

@ -161,7 +161,6 @@
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_threads.xpt
@BINPATH@/components/dom_traversal.xpt
@BINPATH@/components/dom_views.xpt
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
@ -226,9 +225,6 @@
@BINPATH@/components/satchel.xpt
@BINPATH@/components/saxparser.xpt
@BINPATH@/components/sessionstore.xpt
#ifdef MOZ_SERVICES_SYNC
@BINPATH@/components/services-crypto.xpt
#endif
@BINPATH@/components/services-crypto-component.xpt
@BINPATH@/components/shellservice.xpt
@BINPATH@/components/shistory.xpt
@ -247,7 +243,6 @@
@BINPATH@/components/urlformatter.xpt
@BINPATH@/components/webBrowser_core.xpt
@BINPATH@/components/webbrowserpersist.xpt
@BINPATH@/components/webshell_idls.xpt
@BINPATH@/components/widget.xpt
#ifdef XP_MACOSX
@BINPATH@/components/widget_cocoa.xpt
@ -283,7 +278,6 @@
@BINPATH@/components/nsBrowserGlue.js
@BINPATH@/components/nsSetDefaultBrowser.manifest
@BINPATH@/components/nsSetDefaultBrowser.js
@BINPATH@/components/nsMicrosummaryService.js
@BINPATH@/components/BrowserPlaces.manifest
@BINPATH@/components/nsPrivateBrowsingService.manifest
@BINPATH@/components/nsPrivateBrowsingService.js

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

@ -237,7 +237,7 @@ toolbarbutton.bookmark-item > menupopup {
}
.bookmark-item[livemark] .menuitem-iconic {
list-style-image: url("chrome://browser/skin/places/livemarkItem.png");
list-style-image: url("chrome://browser/skin/livemark-item.png");
}
.bookmark-item menuitem[openInTabs],

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

@ -63,7 +63,6 @@ browser.jar:
* skin/classic/browser/places/places.css (places/places.css)
* skin/classic/browser/places/organizer.css (places/organizer.css)
skin/classic/browser/places/query.png (places/query.png)
skin/classic/browser/places/livemarkItem.png (places/livemarkItem.png)
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
skin/classic/browser/places/history.png (places/history.png)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.7 KiB

После

Ширина:  |  Высота:  |  Размер: 634 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 634 B

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

@ -103,7 +103,7 @@ treechildren::-moz-tree-image(title) {
}
treechildren::-moz-tree-image(title, livemarkItem) {
list-style-image: url("chrome://browser/skin/places/livemarkItem.png");
list-style-image: url("chrome://browser/skin/livemark-item.png");
}
treechildren::-moz-tree-image(title, container),

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

@ -88,6 +88,10 @@
background: transparent;
}
#appcontent {
-moz-appearance: -moz-win-exclude-glass;
}
#main-window[chromemargin^="0,"][sizemode=normal] #navigator-toolbox {
margin-top: -7px;
}

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

@ -1698,16 +1698,6 @@ public:
*/
static nsresult CreateStructuredClone(JSContext* cx, jsval val, jsval* rval);
/**
* Reparents the given object and all subobjects to the given scope. Also
* fixes all the prototypes. Assumes obj is properly rooted, that obj has no
* getter functions that can cause side effects, and that the only types of
* objects nested within obj are the types that are cloneable via the
* CreateStructuredClone function above.
*/
static nsresult ReparentClonedObjectToScope(JSContext* cx, JSObject* obj,
JSObject* scope);
/**
* Strip all \n, \r and nulls from the given string
* @param aString the string to remove newlines from [in/out]

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

@ -56,7 +56,6 @@
#include "nsIDOMDragEvent.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMRange.h"
#include "nsIFormControl.h"
#include "nsIDOMHTMLAreaElement.h"
@ -399,10 +398,9 @@ DragDataProducer::GetNodeString(nsIContent* inNode,
// use a range to get the text-equivalent of the node
nsCOMPtr<nsIDOMDocument> doc;
node->GetOwnerDocument(getter_AddRefs(doc));
nsCOMPtr<nsIDOMDocumentRange> docRange(do_QueryInterface(doc));
if (docRange) {
if (doc) {
nsCOMPtr<nsIDOMRange> range;
docRange->CreateRange(getter_AddRefs(range));
doc->CreateRange(getter_AddRefs(range));
if (range) {
range->SelectNode(node);
range->ToString(outNodeString);

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

@ -254,6 +254,8 @@ public:
// of the above defined methods to select the document's application
// cache, let it be associated with the document and eventually
// schedule the cache update process.
// This method MUST be called with the empty string as the argument
// when there is no manifest attribute!
void ProcessOfflineManifest(const nsAString& aManifestSpec);
// Extracts the manifest attribute from the element if it is the root

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

@ -695,8 +695,10 @@ nsContentUtils::InitializeEventTable() {
,
{ nsGkAtoms::onanimationstart, NS_ANIMATION_START, EventNameType_None, NS_ANIMATION_EVENT },
{ nsGkAtoms::onanimationend, NS_ANIMATION_END, EventNameType_None, NS_ANIMATION_EVENT },
{ nsGkAtoms::onanimationiteration, NS_ANIMATION_ITERATION, EventNameType_None, NS_ANIMATION_EVENT }
{ nsGkAtoms::onanimationiteration, NS_ANIMATION_ITERATION, EventNameType_None, NS_ANIMATION_EVENT },
#endif
{ nsGkAtoms::onbeforeprint, NS_BEFOREPRINT, EventNameType_HTMLXUL, NS_EVENT },
{ nsGkAtoms::onafterprint, NS_AFTERPRINT, EventNameType_HTMLXUL, NS_EVENT }
};
sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>;
@ -6100,89 +6102,6 @@ nsContentUtils::CreateStructuredClone(JSContext* cx,
*rval = output;
return NS_OK;
}
// static
nsresult
nsContentUtils::ReparentClonedObjectToScope(JSContext* cx,
JSObject* obj,
JSObject* scope)
{
JSAutoRequest ar(cx);
scope = JS_GetGlobalForObject(cx, scope);
nsAutoTArray<ReparentObjectData, 20> objectData;
objectData.AppendElement(ReparentObjectData(cx, obj));
while (!objectData.IsEmpty()) {
ReparentObjectData& data = objectData[objectData.Length() - 1];
if (!data.ids) {
NS_ASSERTION(!data.index, "Shouldn't have index here");
// Typed arrays are special and don't need to be enumerated.
if (js_IsTypedArray(data.obj)) {
if (!js_ReparentTypedArrayToScope(cx, data.obj, scope)) {
return NS_ERROR_FAILURE;
}
// No need to enumerate anything here.
objectData.RemoveElementAt(objectData.Length() - 1);
continue;
}
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(JS_GET_CLASS(cx, data.obj));
if (!key) {
// We should never be reparenting an object that doesn't have a standard
// proto key.
return NS_ERROR_FAILURE;
}
// Fix the prototype and parent first.
JSObject* proto;
if (!js_GetClassPrototype(cx, scope, key, &proto) ||
!JS_SetPrototype(cx, data.obj, proto) ||
!JS_SetParent(cx, data.obj, scope)) {
return NS_ERROR_FAILURE;
}
// Primitive arrays don't need to be enumerated either but the proto and
// parent needed to be fixed above. Now we can just move on.
if (js_IsDensePrimitiveArray(data.obj)) {
objectData.RemoveElementAt(objectData.Length() - 1);
continue;
}
// And now enumerate the object's properties.
if (!(data.ids = JS_Enumerate(cx, data.obj))) {
return NS_ERROR_FAILURE;
}
}
// If we've gone through all the object's properties then we're done with
// this frame.
if (data.index == data.ids->length) {
objectData.RemoveElementAt(objectData.Length() - 1);
continue;
}
// Get the id and increment!
jsid id = data.ids->vector[data.index++];
jsval prop;
if (!JS_GetPropertyById(cx, data.obj, id, &prop)) {
return NS_ERROR_FAILURE;
}
// Push a new frame if this property is an object.
if (!JSVAL_IS_PRIMITIVE(prop)) {
objectData.AppendElement(ReparentObjectData(cx, JSVAL_TO_OBJECT(prop)));
}
}
return NS_OK;
}
struct ClassMatchingInfo {
nsAttrValue::AtomArray mClasses;
nsCaseTreatment mCaseTreatment;

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

@ -324,17 +324,18 @@ nsDOMFile::MozSlice(PRInt64 aStart, PRInt64 aEnd,
return NS_OK;
}
const PRUint32 sFileStreamFlags =
nsIFileInputStream::CLOSE_ON_EOF |
nsIFileInputStream::REOPEN_ON_REWIND |
nsIFileInputStream::DEFER_OPEN;
NS_IMETHODIMP
nsDOMFile::GetInternalStream(nsIInputStream **aStream)
{
return mIsFullFile ?
NS_NewLocalFileInputStream(aStream, mFile, -1, -1,
nsIFileInputStream::CLOSE_ON_EOF |
nsIFileInputStream::REOPEN_ON_REWIND) :
NS_NewLocalFileInputStream(aStream, mFile, -1, -1, sFileStreamFlags) :
NS_NewPartialLocalFileInputStream(aStream, mFile, mStart, mLength,
-1, -1,
nsIFileInputStream::CLOSE_ON_EOF |
nsIFileInputStream::REOPEN_ON_REWIND);
-1, -1, sFileStreamFlags);
}
NS_IMETHODIMP
@ -628,32 +629,50 @@ nsDOMFile::Initialize(nsISupports* aOwner,
PRUint32 aArgc,
jsval* aArgv)
{
nsresult rv;
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR; // Real short trip
}
NS_ENSURE_TRUE(aArgc > 0, NS_ERROR_UNEXPECTED);
// We expect to get a path to represent as a File object
if (!JSVAL_IS_STRING(aArgv[0]))
return NS_ERROR_UNEXPECTED;
// We expect to get a path to represent as a File object,
// or an nsIFile
nsCOMPtr<nsIFile> file;
if (!JSVAL_IS_STRING(aArgv[0])) {
// Lets see if it's an nsIFile
if (!JSVAL_IS_OBJECT(aArgv[0])) {
return NS_ERROR_UNEXPECTED; // We're not interested
}
JSString* str = JS_ValueToString(aCx, aArgv[0]);
NS_ENSURE_TRUE(str, NS_ERROR_XPC_BAD_CONVERT_JS);
JSObject* obj = JSVAL_TO_OBJECT(aArgv[0]);
NS_ASSERTION(obj, "This is a bit odd");
nsDependentJSString xpcomStr;
if (!xpcomStr.init(aCx, str)) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
// Is it an nsIFile
file = do_QueryInterface(
nsContentUtils::XPConnect()->
GetNativeOfWrapper(aCx, obj));
if (!file)
return NS_ERROR_UNEXPECTED;
} else {
// It's a string
JSString* str = JS_ValueToString(aCx, aArgv[0]);
NS_ENSURE_TRUE(str, NS_ERROR_XPC_BAD_CONVERT_JS);
nsDependentJSString xpcomStr;
if (!xpcomStr.init(aCx, str)) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
nsCOMPtr<nsILocalFile> localFile;
rv = NS_NewLocalFile(xpcomStr, PR_FALSE, getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv, rv);
file = do_QueryInterface(localFile);
NS_ASSERTION(file, "This should never happen");
}
nsCOMPtr<nsILocalFile> localFile;
nsresult rv = NS_NewLocalFile(xpcomStr,
PR_FALSE, getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> file = do_QueryInterface(localFile, &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRBool exists;
rv = file->Exists(&exists);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -1695,7 +1695,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3DocumentEvent)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentRange)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentXBL)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIScriptObjectPrincipal)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3EventTarget)

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

@ -55,8 +55,6 @@
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSDocumentStyle.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
@ -498,8 +496,6 @@ class nsDocument : public nsIDocument,
public nsIDOMDocumentEvent,
public nsIDOM3DocumentEvent,
public nsIDOMNSDocumentStyle,
public nsIDOMDocumentRange,
public nsIDOMDocumentTraversal,
public nsIDOMDocumentXBL,
public nsSupportsWeakReference,
public nsIDOMEventTarget,
@ -814,12 +810,6 @@ public:
// nsIDOMNSDocumentStyle
NS_DECL_NSIDOMNSDOCUMENTSTYLE
// nsIDOMDocumentRange
NS_DECL_NSIDOMDOCUMENTRANGE
// nsIDOMDocumentTraversal
NS_DECL_NSIDOMDOCUMENTTRAVERSAL
// nsIDOMDocumentXBL
NS_DECL_NSIDOMDOCUMENTXBL
@ -1263,8 +1253,6 @@ protected:
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocument, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNSDocument, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentEvent, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentTraversal, \
nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMEventTarget, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNode, nsDocument)

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

@ -862,6 +862,31 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
return PR_TRUE;
}
void
nsFrameLoader::MarginsChanged(PRUint32 aMarginWidth,
PRUint32 aMarginHeight)
{
// We assume that the margins are always zero for remote frames.
if (mRemoteFrame)
return;
// If there's no docshell, we're probably not up and running yet.
// nsFrameLoader::Show() will take care of setting the right
// margins.
if (!mDocShell)
return;
// Set the margins
mDocShell->SetMarginWidth(aMarginWidth);
mDocShell->SetMarginHeight(aMarginHeight);
// Trigger a restyle if there's a prescontext
nsRefPtr<nsPresContext> presContext;
mDocShell->GetPresContext(getter_AddRefs(presContext));
if (presContext)
presContext->RebuildAllStyleData(nsChangeHint(0));
}
bool
nsFrameLoader::ShowRemoteFrame(const nsIntSize& size)
{

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

@ -207,6 +207,11 @@ public:
PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
nsSubDocumentFrame* frame);
/**
* Called when the margin properties of the containing frame are changed.
*/
void MarginsChanged(PRUint32 aMarginWidth, PRUint32 aMarginHeight);
/**
* Called from the layout frame associated with this frame loader, when
* the frame is being torn down; this notifies us that out widget and view

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

@ -49,6 +49,8 @@
#include "nsScriptLoader.h"
#include "nsIJSContextStack.h"
#include "nsIXULRuntime.h"
#include "nsIScriptError.h"
#include "nsIConsoleService.h"
static PRBool
IsChromeProcess()
@ -533,6 +535,53 @@ NS_NewGlobalMessageManager(nsIChromeFrameMessageManager** aResult)
return CallQueryInterface(mm, aResult);
}
void
ContentScriptErrorReporter(JSContext* aCx,
const char* aMessage,
JSErrorReport* aReport)
{
nsresult rv;
nsCOMPtr<nsIScriptError> scriptError =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
return;
}
nsAutoString message, filename, line;
PRUint32 lineNumber, columnNumber, flags, errorNumber;
if (aReport) {
if (aReport->ucmessage) {
message.Assign(reinterpret_cast<const PRUnichar*>(aReport->ucmessage));
}
filename.AssignWithConversion(aReport->filename);
line.Assign(reinterpret_cast<const PRUnichar*>(aReport->uclinebuf));
lineNumber = aReport->lineno;
columnNumber = aReport->uctokenptr - aReport->uclinebuf;
flags = aReport->flags;
errorNumber = aReport->errorNumber;
} else {
lineNumber = columnNumber = errorNumber = 0;
flags = nsIScriptError::errorFlag | nsIScriptError::exceptionFlag;
}
if (message.IsEmpty()) {
message.AssignWithConversion(aMessage);
}
rv = scriptError->Init(message.get(), filename.get(), line.get(),
lineNumber, columnNumber, flags,
"Message manager content script");
if (NS_FAILED(rv)) {
return;
}
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (consoleService) {
(void) consoleService->LogMessage(scriptError);
}
}
nsDataHashtable<nsStringHashKey, nsFrameScriptExecutorJSObjectHolder*>*
nsFrameScriptExecutor::sCachedScripts = nsnull;
nsRefPtr<nsScriptCacheCleaner> nsFrameScriptExecutor::sScriptCacheCleaner;
@ -616,7 +665,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
JSObject* global = nsnull;
mGlobal->GetJSObject(&global);
if (global) {
JS_ExecuteScript(mCx, global, holder->mObject, nsnull);
(void) JS_ExecuteScript(mCx, global, holder->mObject, nsnull);
}
}
JSContext* unused;
@ -684,7 +733,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
"Cached message manager script");
sCachedScripts->Put(aURL, holder);
}
JS_ExecuteScript(mCx, global, scriptObj, nsnull);
(void) JS_ExecuteScript(mCx, global, scriptObj, nsnull);
}
//XXX Argh, JSPrincipals are manually refcounted!
JSPRINCIPALS_DROP(mCx, jsprin);

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

@ -180,6 +180,11 @@ public:
static nsFrameMessageManager* sChildProcessManager;
};
void
ContentScriptErrorReporter(JSContext* aCx,
const char* aMessage,
JSErrorReport* aReport);
class nsScriptCacheCleaner;
struct nsFrameScriptExecutorJSObjectHolder

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

@ -631,6 +631,7 @@ GK_ATOM(OFF, "OFF")
GK_ATOM(ol, "ol")
GK_ATOM(omitXmlDeclaration, "omit-xml-declaration")
GK_ATOM(onabort, "onabort")
GK_ATOM(onafterprint, "onafterprint")
GK_ATOM(onafterscriptexecute, "onafterscriptexecute")
#ifdef MOZ_CSS_ANIMATIONS
GK_ATOM(onanimationend, "onanimationend")
@ -640,6 +641,7 @@ GK_ATOM(onanimationstart, "onanimationstart")
GK_ATOM(onbeforecopy, "onbeforecopy")
GK_ATOM(onbeforecut, "onbeforecut")
GK_ATOM(onbeforepaste, "onbeforepaste")
GK_ATOM(onbeforeprint, "onbeforeprint")
GK_ATOM(onbeforescriptexecute, "onbeforescriptexecute")
GK_ATOM(onbeforeunload, "onbeforeunload")
GK_ATOM(onblur, "onblur")

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

@ -299,6 +299,7 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_ANONFUNFIX | JSOPTION_PRIVATE_IS_NSISUPPORTS);
JS_SetVersion(cx, JSVERSION_LATEST);
JS_SetErrorReporter(cx, ContentScriptErrorReporter);
xpc_LocalizeContext(cx);

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

@ -45,10 +45,13 @@ file.append("test");
file.append("chrome");
file.append("fileconstructor_file.png");
var domfile = new File(file.path);
ok(domfile instanceof File, "File() should return a File");
is(domfile.type, "image/png", "File should be a PNG");
is(domfile.size, 95, "File has size 95 (and more importantly we can read it)");
doTest(new File(file.path));
doTest(new File(file));
function doTest(domfile) {
ok(domfile instanceof File, "File() should return a File");
is(domfile.type, "image/png", "File should be a PNG");
is(domfile.size, 95, "File has size 95 (and more importantly we can read it)");
}
try {
var boomfile = new File();

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

@ -1390,6 +1390,12 @@ nsDOMEvent::GetPreventDefault(PRBool* aReturn)
return NS_OK;
}
NS_IMETHODIMP
nsDOMEvent::GetDefaultPrevented(PRBool* aReturn)
{
return GetPreventDefault(aReturn);
}
void
nsDOMEvent::Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType)
{

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

@ -113,7 +113,6 @@
#include "nsIObserverService.h"
#include "nsIDocShell.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMDragEvent.h"

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

@ -82,7 +82,6 @@ _TEST_FILES = \
bug457672.html \
test_draggableprop.html \
test_bug489671.html \
test_bug493251.html \
test_bug502818.html \
test_bug508479.html \
test_bug508906.html \
@ -105,6 +104,7 @@ _TEST_FILES = \
test_bug641477.html \
test_bug648573.html \
test_bug615597.html \
test_bug656954.html \
$(NULL)
#bug 585630
@ -114,6 +114,13 @@ _TEST_FILES += \
$(NULL)
endif
# bug 565245
ifneq (Linux,$(OS_ARCH))
_TEST_FILES += \
test_bug493251.html \
$(NULL)
endif
_CHROME_FILES = \
test_bug415498.xul \
bug415498-doc1.html \

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

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=656954
-->
<head>
<title>Test for Bug 656954</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=656954">Mozilla Bug 656954</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 656954 **/
var e = document.createEvent("Event");
is(e.defaultPrevented, false,
"After creating event defaultPrevented should be false");
e.initEvent("foo", true, true);
var el = document.createElement("div");
el.addEventListener("foo",
function(evt) {
evt.preventDefault();
}, false);
el.dispatchEvent(e);
is(e.defaultPrevented, true, "preventDefault() should have been called!");
e = document.createEvent("Event");
e.initEvent("foo", true, false);
el.dispatchEvent(e);
is(e.defaultPrevented, false, "preventDefault() should not have any effect!");
</script>
</pre>
</body>
</html>

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

@ -226,6 +226,27 @@ class AudioSetVolumeEvent : public nsRunnable
double mVolume;
};
class AudioMinWriteSampleEvent : public nsRunnable
{
public:
AudioMinWriteSampleEvent(AudioChild* aChild)
{
mAudioChild = aChild;
}
NS_IMETHOD Run()
{
if (!mAudioChild->IsIPCOpen())
return NS_OK;
mAudioChild->SendMinWriteSample();
return NS_OK;
}
nsRefPtr<AudioChild> mAudioChild;
};
class AudioDrainEvent : public nsRunnable
{
public:
@ -670,9 +691,11 @@ nsAudioStreamRemote::Available()
PRInt32 nsAudioStreamRemote::GetMinWriteSamples()
{
/** TODO: Implement this function for remoting. We could potentially remote
to a backend which has a start threshold... */
return 1;
if (!mAudioChild)
return -1;
nsCOMPtr<nsIRunnable> event = new AudioMinWriteSampleEvent(mAudioChild);
NS_DispatchToMainThread(event);
return mAudioChild->WaitForMinWriteSample();
}
void

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

@ -94,6 +94,8 @@ nsSMILAnimationController::Disconnect()
NS_ABORT_IF_FALSE(mDocument, "disconnecting when we weren't connected...?");
NS_ABORT_IF_FALSE(mRefCnt.get() == 1,
"Expecting to disconnect when doc is sole remaining owner");
NS_ABORT_IF_FALSE(mPauseState & nsSMILTimeContainer::PAUSE_PAGEHIDE,
"Expecting to be paused for pagehide before disconnect");
StopSampling(GetRefreshDriver());

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

@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<body onload="run()">
<script class="testbody" type="text/javascript">
<![CDATA[
@ -18,16 +18,21 @@ function run()
{
var svgDoc = document.getElementById('svg');
var div = document.getElementById("div");
var x = div.offsetLeft;
var y = div.offsetTop;
var good = document.getElementById('good');
var fo = document.getElementById('fo');
var elementFromPoint = document.elementFromPoint(55 + x, 55 + y);
is(good, elementFromPoint, 'pointer-events="all"');
elementFromPoint = document.elementFromPoint(205 + x, 55 + y);
is(good, elementFromPoint, 'foreignObject with clip-path');
elementFromPoint = document.elementFromPoint(205 + x + 20, 55 + y + 20);
is(fo, elementFromPoint, 'foreignObject with clip-path');
// Get the coords of the origin of the SVG canvas:
var originX = div.offsetLeft;
var originY = div.offsetTop;
var circle = document.getElementById('circle');
var path = document.getElementById('path');
var elementFromPoint = document.elementFromPoint(originX + 55, originY + 55);
is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"');
elementFromPoint = document.elementFromPoint(originX + 205, originY + 55);
is(elementFromPoint, circle, 'Over foreignObject, outside clip path');
elementFromPoint = document.elementFromPoint(originX + 225, originY + 75);
// XXX disabled. See See https://bugzilla.mozilla.org/show_bug.cgi?id=580983#c116
//is(elementFromPoint, path, 'Over foreignObject, inside clip path');
SimpleTest.finish();
}
@ -43,14 +48,14 @@ function run()
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" id="svg">
<defs>
<clipPath id="clip">
<rect x="20" y="20" width="50" height="50"/>
<rect x="20" y="20" width="30" height="30"/>
</clipPath>
</defs>
<rect id="bad" width="100%" height="100%" fill="green"/>
<circle id="good" cx="50%" cy="50%" r="1" stroke-width="1000" fill="black" pointer-events="all"/>
<foreignObject id="fo" x="200" y="50" width="50" height="50" clip-path="url(#clip)">
<svg onload="run()">
<rect width="100%" height="100%" fill="green"/>
<rect id="bad" width="100%" height="100%" fill="blue"/>
<circle id="circle" cx="50%" cy="50%" r="1" stroke-width="1000" fill="black" pointer-events="all"/>
<foreignObject id="fo" x="200" y="50" width="50" height="50" clip-path="url(#clip)">
<svg>
<path id="path" d="M0,0 H50 V50 H0 Z" fill="green"/>
</svg>
</foreignObject>
</svg>

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

@ -217,9 +217,8 @@ function getRange(aSourceNode, aFragment) {
function getParsedDocument(aPath) {
var doc = do_parse_document(aPath, "application/xml");
do_check_true(doc.documentElement.localName != "parsererror");
do_check_true(doc instanceof C_i.nsIDOMDocumentTraversal);
do_check_true(doc instanceof C_i.nsIDOMXPathEvaluator);
do_check_true(doc instanceof C_i.nsIDOMDocumentRange);
do_check_true(doc instanceof C_i.nsIDOMDocument);
// Clean out whitespace.
var walker = doc.createTreeWalker(doc,
@ -517,7 +516,7 @@ function run_miscellaneous_tests() {
// Requested by smaug: A range involving a comment as a document child.
doc = parser.parseFromString("<!-- foo --><foo/>", "application/xml");
do_check_true(doc instanceof C_i.nsIDOMDocumentRange);
do_check_true(doc instanceof C_i.nsIDOMDocument);
do_check_eq(doc.childNodes.length, 2);
baseRange = doc.createRange();
baseRange.setStart(doc.firstChild, 1);

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

@ -135,6 +135,11 @@ DEFINES += -DOS2_HIGH_MEMORY
endif
endif
ifeq ($(OS_TARGET),Android)
# default to user readable only to fit Android security model
DEFINES += -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600
endif
include $(topsrcdir)/config/rules.mk
# next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others

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

@ -6475,6 +6475,10 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
// from inside this pagehide.
mLoadingURI = nsnull;
// Stop any in-progress loading, so that we don't accidentally trigger any
// PageShow notifications from Embed() interrupting our loading below.
Stop();
// Notify the current document that it is about to be unloaded!!
//
// It is important to fire the unload() notification *before* any state
@ -9692,6 +9696,18 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
document->SetDocumentURI(newURI);
AddURIVisit(newURI, oldURI, oldURI, 0);
// AddURIVisit doesn't set the title for the new URI in global history,
// so do that here.
if (mUseGlobalHistory) {
nsCOMPtr<IHistory> history = services::GetHistoryService();
if (history) {
history->SetURITitle(newURI, mTitle);
}
else if (mGlobalHistory) {
mGlobalHistory->SetPageTitle(newURI, mTitle);
}
}
}
else {
FireDummyOnLocationChange();

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

@ -71,7 +71,7 @@
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "xpcpublic.h"
#include "xpcprivate.h"
// General helper includes
#include "nsGlobalWindow.h"
@ -248,8 +248,6 @@
#include "nsIDOMAnimationEvent.h"
#endif
#include "nsIDOMNSDocumentStyle.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMLinkStyle.h"
@ -1687,6 +1685,8 @@ jsid nsDOMClassInfo::sOntouchmove_id = JSID_VOID;
jsid nsDOMClassInfo::sOntouchenter_id = JSID_VOID;
jsid nsDOMClassInfo::sOntouchleave_id = JSID_VOID;
jsid nsDOMClassInfo::sOntouchcancel_id = JSID_VOID;
jsid nsDOMClassInfo::sOnbeforeprint_id = JSID_VOID;
jsid nsDOMClassInfo::sOnafterprint_id = JSID_VOID;
static const JSClass *sObjectClass = nsnull;
@ -2023,6 +2023,8 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
SET_JSID_TO_STRING(sOntouchenter_id, cx, "ontouchenter");
SET_JSID_TO_STRING(sOntouchleave_id, cx, "ontouchleave");
SET_JSID_TO_STRING(sOntouchcancel_id, cx, "ontouchcancel");
SET_JSID_TO_STRING(sOnbeforeprint_id, cx, "onbeforeprint");
SET_JSID_TO_STRING(sOnafterprint_id, cx, "onafterprint");
return NS_OK;
}
@ -2302,8 +2304,6 @@ nsDOMClassInfo::RegisterExternalClasses()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \
@ -5145,6 +5145,8 @@ nsDOMClassInfo::ShutDown()
sOntouchenter_id = JSID_VOID;
sOntouchleave_id = JSID_VOID;
sOntouchcancel_id = JSID_VOID;
sOnbeforeprint_id = JSID_VOID;
sOnafterprint_id = JSID_VOID;
NS_IF_RELEASE(sXPConnect);
NS_IF_RELEASE(sSecMan);
@ -7618,11 +7620,13 @@ nsEventReceiverSH::ReallyIsEventName(jsid id, jschar aFirstChar)
switch (aFirstChar) {
case 'a' :
return (id == sOnabort_id ||
id == sOnafterscriptexecute_id);
id == sOnafterscriptexecute_id ||
id == sOnafterprint_id);
case 'b' :
return (id == sOnbeforeunload_id ||
id == sOnbeforescriptexecute_id ||
id == sOnblur_id);
id == sOnblur_id ||
id == sOnbeforeprint_id);
case 'c' :
return (id == sOnchange_id ||
id == sOnclick_id ||
@ -10201,12 +10205,11 @@ nsStringArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSAutoRequest ar(cx);
JSString *str =
::JS_NewUCStringCopyN(cx, reinterpret_cast<const jschar *>(val.get()),
val.Length());
NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
*vp = STRING_TO_JSVAL(str);
nsStringBuffer* sharedBuffer = nsnull;
*vp = XPCStringConvert::ReadableToJSVal(cx, val, &sharedBuffer);
if (sharedBuffer) {
val.ForgetSharedBuffer();
}
return NS_SUCCESS_I_DID_SOMETHING;
}

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

@ -365,6 +365,8 @@ public:
static jsid sOntouchenter_id;
static jsid sOntouchleave_id;
static jsid sOntouchcancel_id;
static jsid sOnbeforeprint_id;
static jsid sOnafterprint_id;
protected:
static JSPropertyOp sXPCNativeWrapperGetPropertyOp;

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

@ -53,7 +53,7 @@
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIDOMHTMLLegendElement.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocument.h"
#include "nsIDOMRange.h"
#include "nsIHTMLDocument.h"
#include "nsIFormControlFrame.h"
@ -2009,9 +2009,9 @@ nsFocusManager::UpdateCaret(PRBool aMoveCaretToFocus,
void
nsFocusManager::MoveCaretToFocus(nsIPresShell* aPresShell, nsIContent* aContent)
{
// rangeDoc is a document interface we can create a range with
nsCOMPtr<nsIDOMDocumentRange> rangeDoc(do_QueryInterface(aPresShell->GetDocument()));
if (rangeDoc) {
// domDoc is a document interface we can create a range with
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aPresShell->GetDocument());
if (domDoc) {
nsCOMPtr<nsFrameSelection> frameSelection = aPresShell->FrameSelection();
nsCOMPtr<nsISelection> domSelection = frameSelection->
GetSelection(nsISelectionController::SELECTION_NORMAL);
@ -2022,7 +2022,7 @@ nsFocusManager::MoveCaretToFocus(nsIPresShell* aPresShell, nsIContent* aContent)
domSelection->RemoveAllRanges();
if (currentFocusNode) {
nsCOMPtr<nsIDOMRange> newRange;
nsresult rv = rangeDoc->CreateRange(getter_AddRefs(newRange));
nsresult rv = domDoc->CreateRange(getter_AddRefs(newRange));
if (NS_SUCCEEDED(rv)) {
// Set the range to the start of the currently focused node
// Make sure it's collapsed

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

@ -8447,8 +8447,6 @@ nsGlobalWindow::FireDelayedDOMEvents()
if (mPendingStorageEventsObsolete) {
// Fire pending storage events.
mPendingStorageEventsObsolete->EnumerateRead(FirePendingStorageEvents, this);
delete mPendingStorageEventsObsolete;
mPendingStorageEventsObsolete = nsnull;
}

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

@ -3646,14 +3646,6 @@ SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
return 0;
}
static int
SetMemoryGCFrequencyPrefChangedCallback(const char* aPrefName, void* aClosure)
{
PRInt32 triggerFactor = nsContentUtils::GetIntPref(aPrefName, 300);
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_TRIGGER_FACTOR, triggerFactor);
return 0;
}
static int
SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
{
@ -3796,12 +3788,6 @@ nsJSRuntime::Init()
SetMemoryMaxPrefChangedCallback("javascript.options.mem.max",
nsnull);
nsContentUtils::RegisterPrefCallback("javascript.options.mem.gc_frequency",
SetMemoryGCFrequencyPrefChangedCallback,
nsnull);
SetMemoryGCFrequencyPrefChangedCallback("javascript.options.mem.gc_frequency",
nsnull);
nsContentUtils::RegisterPrefCallback("javascript.options.mem.gc_per_compartment",
SetMemoryGCModePrefChangedCallback,
nsnull);

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

@ -97,6 +97,7 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
if (!mData) {
mSize = 0;
mVersion = 0;
free(jsBytes);
return NS_ERROR_FAILURE;
}
else {
@ -104,6 +105,7 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
}
memcpy(mData, jsBytes, mSize);
free(jsBytes);
return NS_OK;
}

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

@ -22,6 +22,8 @@
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
* Jonas Sicking <sicking@bigfoot.com>
* Ms2ger <ms2ger@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"),
@ -39,6 +41,10 @@
#include "nsIDOMNode.idl"
interface nsIDOMNodeIterator;
interface nsIDOMNodeFilter;
interface nsIDOMTreeWalker;
/**
* The nsIDOMDocument interface represents the entire HTML or XML document.
* Conceptually, it is the root of the document tree, and provides the
@ -52,7 +58,7 @@
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(d12f0ecf-434a-4b5c-81ad-354e3b9037b9)]
[scriptable, uuid(e286fcde-873d-4902-874b-49255737ee7d)]
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDocumentType doctype;
@ -115,4 +121,22 @@ interface nsIDOMDocument : nsIDOMNode
* @see http://www.whatwg.org/html/#dom-document-defaultview
*/
readonly attribute nsIDOMWindow defaultView;
/**
* Create a range
*
* @see http://html5.org/specs/dom-range.html#dom-document-createrange
*/
nsIDOMRange createRange();
nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root,
in unsigned long whatToShow,
in nsIDOMNodeFilter filter,
in boolean entityReferenceExpansion)
raises(DOMException);
nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root,
in unsigned long whatToShow,
in nsIDOMNodeFilter filter,
in boolean entityReferenceExpansion)
raises(DOMException);
};

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

@ -38,7 +38,7 @@
#include "nsIDOMDocument.idl"
[scriptable, uuid(68e4448c-eb64-48ea-801a-0c83008d2607)]
[scriptable, uuid(305a78cc-da33-402c-bcd5-44eb993ab391)]
interface nsIDOMXMLDocument : nsIDOMDocument
{
// DOM Level 3 Load & Save, DocumentLS

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

@ -49,7 +49,7 @@ interface nsIDOMEventTarget;
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, uuid(a66b7b80-ff46-bd97-0080-5f8ae38add32)]
[scriptable, uuid(548137e8-fd2c-48c4-8635-3033f7db79e0)]
interface nsIDOMEvent : nsISupports
{
// PhaseType
@ -169,4 +169,9 @@ interface nsIDOMEvent : nsISupports
void initEvent(in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg);
/**
* Used to indicate whether preventDefault() has been called for this event.
*/
readonly attribute boolean defaultPrevented;
};

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

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(42bb545e-be46-4f4f-8c0a-6c948ea0c1d4)]
[scriptable, uuid(4b21c9f8-68bc-4bce-b452-0f844c532dfc)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
attribute DOMString title;

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

@ -48,7 +48,6 @@ GRE_MODULE = 1
SDK_XPIDLSRCS = \
nsIDOMRange.idl \
nsIDOMDocumentRange.idl \
$(NULL)
XPIDLSRCS = \

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

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(907f1ada-5ace-4789-8c25-0c79f251044d)]
[scriptable, uuid(32f1cd80-9328-4f55-938a-0734217a7944)]
interface nsIDOMSVGDocument : nsIDOMDocument
/* , nsIDOMDocumentEvent */
{

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

@ -48,7 +48,6 @@ XPIDL_MODULE = dom_traversal
GRE_MODULE = 1
XPIDLSRCS = \
nsIDOMDocumentTraversal.idl \
nsIDOMNodeFilter.idl \
nsIDOMNodeIterator.idl \
nsIDOMTreeWalker.idl \

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

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* vim: set sw=2 ts=2 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -41,13 +41,13 @@
namespace mozilla {
namespace dom {
NS_IMPL_THREADSAFE_ADDREF(AudioChild);
NS_IMPL_THREADSAFE_RELEASE(AudioChild);
AudioChild::AudioChild()
: mLastSampleOffset(-1),
mLastSampleOffsetTime(0),
mMinWriteSample(-2),// Initial value, -2, error on -1
mAudioReentrantMonitor("AudioChild.mReentrantMonitor"),
mIPCOpen(PR_TRUE),
mDrained(PR_FALSE)
@ -84,6 +84,25 @@ AudioChild::RecvDrainDone()
return true;
}
PRInt32
AudioChild::WaitForMinWriteSample()
{
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
// -2 : initial value
while (mMinWriteSample == -2 && mIPCOpen)
mAudioReentrantMonitor.Wait();
return mMinWriteSample;
}
bool
AudioChild::RecvMinWriteSampleDone(const PRInt32& minSamples)
{
ReentrantMonitorAutoEnter mon(mAudioReentrantMonitor);
mMinWriteSample = minSamples;
mAudioReentrantMonitor.NotifyAll();
return true;
}
void
AudioChild::WaitForDrain()
{

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

@ -56,9 +56,11 @@ class AudioChild : public PAudioChild
virtual ~AudioChild();
virtual bool RecvSampleOffsetUpdate(const PRInt64&, const PRInt64&);
virtual bool RecvDrainDone();
virtual PRInt32 WaitForMinWriteSample();
virtual bool RecvMinWriteSampleDone(const PRInt32& sampleCount);
virtual void WaitForDrain();
virtual void ActorDestroy(ActorDestroyReason);
PRInt64 GetLastKnownSampleOffset();
PRInt64 GetLastKnownSampleOffsetTime();
@ -67,6 +69,7 @@ class AudioChild : public PAudioChild
nsAutoRefCnt mRefCnt;
NS_DECL_OWNINGTHREAD
PRInt64 mLastSampleOffset, mLastSampleOffsetTime;
PRInt32 mMinWriteSample;
mozilla::ReentrantMonitor mAudioReentrantMonitor;
PRPackedBool mIPCOpen;
PRPackedBool mDrained;

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

@ -108,6 +108,49 @@ class AudioStreamShutdownEvent : public nsRunnable
nsRefPtr<nsAudioStream> mOwner;
};
class AudioMinWriteSampleDone : public nsRunnable
{
public:
AudioMinWriteSampleDone(AudioParent* owner, PRInt32 minSamples)
{
mOwner = owner;
mMinSamples = minSamples;
}
NS_IMETHOD Run()
{
mOwner->SendMinWriteSampleDone(mMinSamples);
return NS_OK;
}
private:
nsRefPtr<AudioParent> mOwner;
PRInt32 mMinSamples;
};
class AudioMinWriteSampleEvent : public nsRunnable
{
public:
AudioMinWriteSampleEvent(AudioParent* parent, nsAudioStream* owner)
{
mParent = parent;
mOwner = owner;
}
NS_IMETHOD Run()
{
PRInt32 minSamples = mOwner->GetMinWriteSamples();
nsCOMPtr<nsIRunnable> event = new AudioMinWriteSampleDone(mParent, minSamples);
NS_DispatchToMainThread(event);
return NS_OK;
}
private:
nsRefPtr<nsAudioStream> mOwner;
nsRefPtr<AudioParent> mParent;
};
class AudioDrainDoneEvent : public nsRunnable
{
public:
@ -186,6 +229,17 @@ AudioParent::RecvSetVolume(const float& aVolume)
return true;
}
bool
AudioParent::RecvMinWriteSample()
{
if (!mStream)
return false;
nsCOMPtr<nsIRunnable> event = new AudioMinWriteSampleEvent(this, mStream);
nsCOMPtr<nsIThread> thread = mStream->GetThread();
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
return true;
}
bool
AudioParent::RecvDrain()
{
@ -227,6 +281,14 @@ AudioParent::RecvShutdown()
return true;
}
bool
AudioParent::SendMinWriteSampleDone(PRInt32 minSamples)
{
if (mIPCOpen)
return PAudioParent::SendMinWriteSampleDone(minSamples);
return true;
}
bool
AudioParent::SendDrainDone()
{

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

@ -61,6 +61,9 @@ class AudioParent : public PAudioParent, public nsITimerCallback
virtual bool
RecvSetVolume(const float& aVolume);
virtual bool
RecvMinWriteSample();
virtual bool
RecvDrain();
@ -73,6 +76,9 @@ class AudioParent : public PAudioParent, public nsITimerCallback
virtual bool
RecvShutdown();
virtual bool
SendMinWriteSampleDone(PRInt32 minSamples);
virtual bool
SendDrainDone();

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

@ -52,6 +52,7 @@ parent:
SetVolume(float aVolume);
MinWriteSample();
Drain();
Pause();
@ -63,6 +64,7 @@ parent:
__delete__();
SampleOffsetUpdate(PRInt64 offset, PRInt64 time);
MinWriteSampleDone(PRInt32 sampleCount);
DrainDone();
};

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

@ -848,6 +848,7 @@ TabChild::InitTabChildGlobal()
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_ANONFUNFIX | JSOPTION_PRIVATE_IS_NSISUPPORTS);
JS_SetVersion(cx, JSVERSION_LATEST);
JS_SetErrorReporter(cx, ContentScriptErrorReporter);
xpc_LocalizeContext(cx);

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

@ -1982,8 +1982,12 @@ PluginInstanceChild::AnswerSetPluginFocus()
PR_LOG(gPluginLog, PR_LOG_DEBUG, ("%s", FULLFUNCTION));
#if defined(OS_WIN)
// Parent is letting us know something set focus to the plugin.
if (::GetFocus() == mPluginWindowHWND)
// Parent is letting us know the dom set focus to the plugin. Note,
// focus can change during transit in certain edge cases, for example
// when a button click brings up a full screen window. Since we send
// this in response to a WM_SETFOCUS event on our parent, the parent
// should have focus when we receive this. If not, ignore the call.
if (::GetFocus() == mPluginWindowHWND || ::GetFocus() != mPluginParentHWND)
return true;
::SetFocus(mPluginWindowHWND);
return true;

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

@ -105,6 +105,13 @@ nsDOMWorkerPrivateEvent::PreventDefault()
return mEvent->PreventDefault();
}
NS_IMETHODIMP
nsDOMWorkerPrivateEvent::GetDefaultPrevented(PRBool* aRetVal)
{
*aRetVal = mPreventDefaultCalled;
return NS_OK;
}
NS_IMETHODIMP
nsDOMWorkerPrivateEvent::InitEvent(const nsAString& aEventType,
PRBool aCanBubble,
@ -242,6 +249,13 @@ nsDOMWorkerEvent::PreventDefault()
return NS_OK;
}
NS_IMETHODIMP
nsDOMWorkerEvent::GetDefaultPrevented(PRBool* aRetVal)
{
*aRetVal = mPreventDefaultCalled;
return NS_OK;
}
NS_IMETHODIMP
nsDOMWorkerEvent::InitEvent(const nsAString& aEventTypeArg,
PRBool aCanBubbleArg,

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

@ -160,6 +160,8 @@ public:
const nsAString& aFilenameArg,
PRUint32 aLinenoArg);
NS_IMETHOD GetDefaultPrevented(PRBool* aRetVal);
virtual PRBool PreventDefaultCalled();
private:

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

@ -552,14 +552,10 @@ nsEditorEventListener::DragEnter(nsIDOMDragEvent* aDragEvent)
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
NS_ENSURE_TRUE(presShell, NS_OK);
if (!mCaret)
{
NS_NewCaret(getter_AddRefs(mCaret));
if (mCaret)
{
mCaret->Init(presShell);
mCaret->SetCaretReadOnly(PR_TRUE);
}
if (!mCaret) {
mCaret = new nsCaret();
mCaret->Init(presShell);
mCaret->SetCaretReadOnly(PR_TRUE);
}
presShell->SetCaret(mCaret);

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

@ -21,6 +21,7 @@
*
* Contributor(s):
* Original Author: Daniel Glazman <glazman@netscape.com>
* Ms2ger <ms2ger@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"),
@ -296,31 +297,23 @@ const nsHTMLCSSUtils::CSSEquivTable hrAlignEquivTable[] = {
{ nsHTMLCSSUtils::eCSSEditableProperty_NONE, 0 }
};
nsHTMLCSSUtils::nsHTMLCSSUtils()
: mIsCSSPrefChecked(PR_FALSE)
nsHTMLCSSUtils::nsHTMLCSSUtils(nsHTMLEditor* aEditor)
: mHTMLEditor(aEditor)
, mIsCSSPrefChecked(PR_FALSE)
{
// let's retrieve the value of the "CSS editing" pref
nsresult result = NS_OK;
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID, &result);
if (NS_SUCCEEDED(result) && prefBranch) {
prefBranch->GetBoolPref("editor.use_css", &mIsCSSPrefChecked);
}
}
nsHTMLCSSUtils::~nsHTMLCSSUtils()
{
}
nsresult
nsHTMLCSSUtils::Init(nsHTMLEditor *aEditor)
{
nsresult result = NS_OK;
mHTMLEditor = static_cast<nsHTMLEditor*>(aEditor);
// let's retrieve the value of the "CSS editing" pref
nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID, &result);
if (NS_SUCCEEDED(result) && prefBranch) {
result = prefBranch->GetBoolPref("editor.use_css", &mIsCSSPrefChecked);
NS_ENSURE_SUCCESS(result, result);
}
return result;
}
// Answers true if we have some CSS equivalence for the HTML style defined
// by aProperty and/or aAttribute for the node aNode
PRBool
@ -617,19 +610,6 @@ nsHTMLCSSUtils::GetDefaultViewCSS(nsIDOMNode *aNode, nsIDOMWindow **aViewCSS)
return NS_OK;
}
nsresult
NS_NewHTMLCSSUtils(nsHTMLCSSUtils** aInstancePtrResult)
{
nsHTMLCSSUtils * rules = new nsHTMLCSSUtils();
if (rules) {
*aInstancePtrResult = rules;
return NS_OK;
}
*aInstancePtrResult = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
// remove the CSS style "aProperty : aPropertyValue" and possibly remove the whole node
// if it is a span and if its only attribute is _moz_dirty
nsresult

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

@ -21,6 +21,7 @@
*
* Contributor(s):
* Original Author: Daniel Glazman <glazman@netscape.com>
* Ms2ger <ms2ger@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"),
@ -62,7 +63,7 @@ typedef void (*nsProcessValueFunc)(const nsAString * aInputString, nsAString & a
class nsHTMLCSSUtils
{
public:
nsHTMLCSSUtils();
explicit nsHTMLCSSUtils(nsHTMLEditor* aEditor);
~nsHTMLCSSUtils();
enum nsCSSEditableProperty {
@ -99,9 +100,6 @@ public:
PRBool caseSensitiveValue;
};
public:
nsresult Init(nsHTMLEditor * aEditor);
/** answers true if the given combination element_name/attribute_name
* has a CSS equivalence in this implementation
*
@ -401,11 +399,8 @@ private:
private:
nsHTMLEditor *mHTMLEditor;
PRBool mIsCSSPrefChecked;
};
nsresult NS_NewHTMLCSSUtils(nsHTMLCSSUtils** aInstancePtrResult);
#define NS_EDITOR_INDENT_INCREMENT_IN 0.4134f
#define NS_EDITOR_INDENT_INCREMENT_CM 1.05f
#define NS_EDITOR_INDENT_INCREMENT_MM 10.5f

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

@ -103,7 +103,6 @@
// for relativization
#include "nsUnicharUtils.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDOMTreeWalker.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMNamedNodeMap.h"
@ -949,16 +948,14 @@ nsHTMLEditor::RelativizeURIInFragmentList(const nsCOMArray<nsIDOMNode> &aNodeLis
// determine destination URL
nsCOMPtr<nsIDOMDocument> domDoc;
GetDocument(getter_AddRefs(domDoc));
NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> destDoc = do_QueryInterface(domDoc);
NS_ENSURE_TRUE(destDoc, NS_ERROR_FAILURE);
nsCOMPtr<nsIURL> destURL = do_QueryInterface(destDoc->GetDocBaseURI());
NS_ENSURE_TRUE(destURL, NS_ERROR_FAILURE);
nsresult rv;
nsCOMPtr<nsIDOMDocumentTraversal> trav = do_QueryInterface(domDoc, &rv);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
PRInt32 listCount = aNodeList.Count();
PRInt32 j;
for (j = 0; j < listCount; j++)
@ -966,8 +963,10 @@ nsHTMLEditor::RelativizeURIInFragmentList(const nsCOMArray<nsIDOMNode> &aNodeLis
nsIDOMNode* somenode = aNodeList[j];
nsCOMPtr<nsIDOMTreeWalker> walker;
rv = trav->CreateTreeWalker(somenode, nsIDOMNodeFilter::SHOW_ELEMENT,
nsnull, PR_TRUE, getter_AddRefs(walker));
nsresult rv = domDoc->CreateTreeWalker(somenode,
nsIDOMNodeFilter::SHOW_ELEMENT,
nsnull, PR_TRUE,
getter_AddRefs(walker));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> currentNode;

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

@ -170,19 +170,6 @@ class nsEditableTextFunctor : public nsBoolDomIterFunctor
};
/********************************************************
* routine for making new rules instance
********************************************************/
nsresult
NS_NewHTMLEditRules(nsIEditRules** aInstancePtrResult)
{
nsHTMLEditRules * rules = new nsHTMLEditRules();
if (rules)
return rules->QueryInterface(NS_GET_IID(nsIEditRules), (void**) aInstancePtrResult);
return NS_ERROR_OUT_OF_MEMORY;
}
/********************************************************
* Constructor/Destructor
********************************************************/

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

@ -318,7 +318,5 @@ protected:
StyleCache mCachedStyles[SIZE_STYLE_TABLE];
};
nsresult NS_NewHTMLEditRules(nsIEditRules** aInstancePtrResult);
#endif //nsHTMLEditRules_h__

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

@ -22,6 +22,7 @@
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Daniel Glazman <glazman@netscape.com>
* Ms2ger <ms2ger@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"),
@ -106,10 +107,6 @@ static char namedanchorText[] = "namedanchor";
nsIRangeUtils* nsHTMLEditor::sRangeHelper;
// some prototypes for rules creation shortcuts
nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
nsresult NS_NewHTMLEditRules(nsIEditRules** aInstancePtrResult);
#define IsLinkTag(s) (s.EqualsIgnoreCase(hrefText))
#define IsNamedAnchorTag(s) (s.EqualsIgnoreCase(anchorTxt) || s.EqualsIgnoreCase(namedanchorText))
@ -305,9 +302,7 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc,
}
// Init the HTML-CSS utils
result = NS_NewHTMLCSSUtils(getter_Transfers(mHTMLCSSUtils));
if (NS_FAILED(result)) { return result; }
mHTMLCSSUtils->Init(this);
mHTMLCSSUtils = new nsHTMLCSSUtils(this);
// disable links
nsCOMPtr<nsIPresShell> presShell;
@ -323,11 +318,9 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc,
// init the type-in state
mTypeInState = new TypeInState();
if (!mTypeInState) {return NS_ERROR_NULL_POINTER;}
// init the selection listener for image resizing
mSelectionListenerP = new ResizerSelectionListener(this);
if (!mSelectionListenerP) {return NS_ERROR_NULL_POINTER;}
if (!IsInteractionAllowed()) {
// ignore any errors from this in case the file is missing
@ -536,12 +529,8 @@ NS_IMETHODIMP
nsHTMLEditor::InitRules()
{
// instantiate the rules for the html editor
nsresult res = NS_NewHTMLEditRules(getter_AddRefs(mRules));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(mRules, NS_ERROR_UNEXPECTED);
res = mRules->Init(static_cast<nsPlaintextEditor*>(this));
return res;
mRules = new nsHTMLEditRules();
return mRules->Init(static_cast<nsPlaintextEditor*>(this));
}
NS_IMETHODIMP

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

@ -87,9 +87,6 @@
#include "mozilla/FunctionTimer.h"
// prototype for rules creation shortcut
nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
nsPlaintextEditor::nsPlaintextEditor()
: nsEditor()
, mIgnoreSpuriousDragEvent(PR_FALSE)
@ -329,9 +326,7 @@ nsPlaintextEditor::SetDocumentCharacterSet(const nsACString & characterSet)
NS_IMETHODIMP nsPlaintextEditor::InitRules()
{
// instantiate the rules for this text editor
nsresult res = NS_NewTextEditRules(getter_AddRefs(mRules));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(mRules, NS_ERROR_UNEXPECTED);
mRules = new nsTextEditRules();
return mRules->Init(this);
}

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

@ -80,16 +80,6 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
};
nsresult
NS_NewTextEditRules(nsIEditRules** aInstancePtrResult)
{
nsTextEditRules * rules = new nsTextEditRules();
if (rules)
return rules->QueryInterface(NS_GET_IID(nsIEditRules), (void**) aInstancePtrResult);
return NS_ERROR_OUT_OF_MEMORY;
}
/********************************************************
* Constructor/Destructor
********************************************************/

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

@ -373,8 +373,4 @@ class nsAutoLockListener
PRPackedBool mOldState;
};
nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
#endif //nsTextEditRules_h__

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

@ -44,8 +44,6 @@
#include "nsIEnumerator.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsISelection.h"
#include "nsISelectionController.h"
#include "nsIFrame.h"

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

@ -72,7 +72,6 @@
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXMLDocument.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDOMTreeWalker.h"
#include "nsIDOMNode.h"
#include "nsIDOMComment.h"
@ -1644,10 +1643,8 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal(
mDocList.AppendElement(docData);
// Walk the DOM gathering a list of externally referenced URIs in the uri map
nsCOMPtr<nsIDOMDocumentTraversal> trav = do_QueryInterface(docData->mDocument, &rv);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMTreeWalker> walker;
rv = trav->CreateTreeWalker(docAsNode,
rv = aDocument->CreateTreeWalker(docAsNode,
nsIDOMNodeFilter::SHOW_ELEMENT |
nsIDOMNodeFilter::SHOW_DOCUMENT |
nsIDOMNodeFilter::SHOW_PROCESSING_INSTRUCTION,

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

@ -66,7 +66,7 @@ const tests = [
["checkcompounddup", "iso-8859-1"],
["checkcompoundtriple", "iso-8859-1"],
["simplifiedtriple", "iso-8859-1"],
["checkcompoundrep", "iso-8859-1", null, {2: "todo"}],
["checkcompoundrep", "iso-8859-1"],
["checkcompoundcase2", "iso-8859-1"],
["checkcompoundcaseutf", "UTF-8"],
["checkcompoundpattern", "iso-8859-1"],
@ -111,16 +111,16 @@ const tests = [
["korean", "UTF-8"],
["opentaal_forbiddenword1", "UTF-8"],
["opentaal_forbiddenword2", "UTF-8"],
["opentaal_keepcase", "UTF-8", null, {7: "todo"}],
["opentaal_keepcase", "UTF-8"],
["arabic", "UTF-8"],
["2970240", "iso-8859-1"],
["2970242", "iso-8859-1"],
["breakoff", "iso-8859-1"],
["opentaal_cpdpat", "iso-8859-1"],
["opentaal_cpdpat2", "iso-8859-1"],
["2999225", "iso-8859-1", {1: "todo"}],
["onlyincompound2", "iso-8859-1", null, {2: "todo"}],
["forceucase", "iso-8859-1", null, {1: "todo"}],
["2999225", "iso-8859-1"],
["onlyincompound2", "iso-8859-1"],
["forceucase", "iso-8859-1"],
["warn", "iso-8859-1"]
];

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

@ -295,6 +295,11 @@ NS_IMETHODIMP mozOSXSpell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggest
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP mozOSXSpell::LoadDictionariesFromDir(nsIFile* aFile)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#pragma mark -
//

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

@ -71,7 +71,6 @@
#include "nsCRT.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventTarget.h"
#include "nsPIDOMEventTarget.h"
@ -145,12 +144,12 @@ mozInlineSpellStatus::InitForEditorChange(
{
nsresult rv;
nsCOMPtr<nsIDOMDocumentRange> docRange;
rv = GetDocumentRange(getter_AddRefs(docRange));
nsCOMPtr<nsIDOMDocument> doc;
rv = GetDocument(getter_AddRefs(doc));
NS_ENSURE_SUCCESS(rv, rv);
// save the anchor point as a range so we can find the current word later
rv = PositionToCollapsedRange(docRange, aAnchorNode, aAnchorOffset,
rv = PositionToCollapsedRange(doc, aAnchorNode, aAnchorOffset,
getter_AddRefs(mAnchorRange));
NS_ENSURE_SUCCESS(rv, rv);
@ -166,7 +165,7 @@ mozInlineSpellStatus::InitForEditorChange(
mOp = eOpChange;
// range to check
rv = docRange->CreateRange(getter_AddRefs(mRange));
rv = doc->CreateRange(getter_AddRefs(mRange));
NS_ENSURE_SUCCESS(rv, rv);
// ...we need to put the start and end in the correct order
@ -253,14 +252,14 @@ mozInlineSpellStatus::InitForNavigation(
return NS_OK;
}
nsCOMPtr<nsIDOMDocumentRange> docRange;
rv = GetDocumentRange(getter_AddRefs(docRange));
nsCOMPtr<nsIDOMDocument> doc;
rv = GetDocument(getter_AddRefs(doc));
NS_ENSURE_SUCCESS(rv, rv);
rv = PositionToCollapsedRange(docRange, aOldAnchorNode, aOldAnchorOffset,
rv = PositionToCollapsedRange(doc, aOldAnchorNode, aOldAnchorOffset,
getter_AddRefs(mOldNavigationAnchorRange));
NS_ENSURE_SUCCESS(rv, rv);
rv = PositionToCollapsedRange(docRange, aNewAnchorNode, aNewAnchorOffset,
rv = PositionToCollapsedRange(doc, aNewAnchorNode, aNewAnchorOffset,
getter_AddRefs(mAnchorRange));
NS_ENSURE_SUCCESS(rv, rv);
@ -441,16 +440,16 @@ mozInlineSpellStatus::FillNoCheckRangeFromAnchor(
getter_AddRefs(mNoCheckRange));
}
// mozInlineSpellStatus::GetDocumentRange
// mozInlineSpellStatus::GetDocument
//
// Returns the nsIDOMDocumentRange object for the document for the
// Returns the nsIDOMDocument object for the document for the
// current spellchecker.
nsresult
mozInlineSpellStatus::GetDocumentRange(nsIDOMDocumentRange** aDocRange)
mozInlineSpellStatus::GetDocument(nsIDOMDocument** aDocument)
{
nsresult rv;
*aDocRange = nsnull;
*aDocument = nsnull;
if (! mSpellChecker->mEditor)
return NS_ERROR_UNEXPECTED;
@ -460,11 +459,8 @@ mozInlineSpellStatus::GetDocumentRange(nsIDOMDocumentRange** aDocRange)
nsCOMPtr<nsIDOMDocument> domDoc;
rv = editor->GetDocument(getter_AddRefs(domDoc));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMDocumentRange> docRange = do_QueryInterface(domDoc, &rv);
NS_ENSURE_SUCCESS(rv, rv);
docRange.swap(*aDocRange);
NS_ENSURE_TRUE(domDoc, NS_ERROR_NULL_POINTER);
domDoc.forget(aDocument);
return NS_OK;
}
@ -475,12 +471,12 @@ mozInlineSpellStatus::GetDocumentRange(nsIDOMDocumentRange** aDocRange)
// updated as the DOM is changed.
nsresult
mozInlineSpellStatus::PositionToCollapsedRange(nsIDOMDocumentRange* aDocRange,
mozInlineSpellStatus::PositionToCollapsedRange(nsIDOMDocument* aDocument,
nsIDOMNode* aNode, PRInt32 aOffset, nsIDOMRange** aRange)
{
*aRange = nsnull;
nsCOMPtr<nsIDOMRange> range;
nsresult rv = aDocRange->CreateRange(getter_AddRefs(range));
nsresult rv = aDocument->CreateRange(getter_AddRefs(range));
NS_ENSURE_SUCCESS(rv, rv);
rv = range->SetStart(aNode, aOffset);
@ -1032,12 +1028,10 @@ mozInlineSpellChecker::MakeSpellCheckRange(
nsCOMPtr<nsIDOMDocument> doc;
rv = editor->GetDocument(getter_AddRefs(doc));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMDocumentRange> docrange = do_QueryInterface(doc);
NS_ENSURE_TRUE(docrange, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMRange> range;
rv = docrange->CreateRange(getter_AddRefs(range));
rv = doc->CreateRange(getter_AddRefs(range));
NS_ENSURE_SUCCESS(rv, rv);
// possibly use full range of the editor

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

@ -55,7 +55,6 @@
#include "mozISpellI18NUtil.h"
#include "nsCycleCollectionParticipant.h"
class nsIDOMDocumentRange;
class nsIDOMMouseEventListener;
class mozInlineSpellWordUtil;
class mozInlineSpellChecker;
@ -134,8 +133,8 @@ protected:
nsresult FillNoCheckRangeFromAnchor(mozInlineSpellWordUtil& aWordUtil);
nsresult GetDocumentRange(nsIDOMDocumentRange** aDocRange);
nsresult PositionToCollapsedRange(nsIDOMDocumentRange* aDocRange,
nsresult GetDocument(nsIDOMDocument** aDocument);
nsresult PositionToCollapsedRange(nsIDOMDocument* aDocument,
nsIDOMNode* aNode, PRInt32 aOffset,
nsIDOMRange** aRange);
};

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -95,12 +95,10 @@ mozInlineSpellWordUtil::Init(nsWeakPtr aWeakEditor)
nsCOMPtr<nsIDOMDocument> domDoc;
rv = editor->GetDocument(getter_AddRefs(domDoc));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(domDoc, NS_ERROR_NULL_POINTER);
mDocument = do_QueryInterface(domDoc, &rv);
NS_ENSURE_SUCCESS(rv, rv);
mDOMDocumentRange = do_QueryInterface(domDoc, &rv);
NS_ENSURE_SUCCESS(rv, rv);
mDOMDocument = domDoc;
mDocument = do_QueryInterface(domDoc);
// Window
nsCOMPtr<nsIDOMWindow> window;
@ -375,10 +373,10 @@ nsresult
mozInlineSpellWordUtil::MakeRange(NodeOffset aBegin, NodeOffset aEnd,
nsIDOMRange** aRange)
{
if (! mDOMDocumentRange)
if (!mDOMDocument)
return NS_ERROR_NOT_INITIALIZED;
nsresult rv = mDOMDocumentRange->CreateRange(aRange);
nsresult rv = mDOMDocument->CreateRange(aRange);
NS_ENSURE_SUCCESS(rv, rv);
rv = (*aRange)->SetStart(aBegin.mNode, aBegin.mOffset);

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

@ -37,7 +37,6 @@
#include "nsCOMPtr.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDocument.h"
#include "nsString.h"
#include "nsTArray.h"
@ -115,7 +114,7 @@ public:
// so we can access characters directly.
static void NormalizeWord(nsSubstring& aWord);
nsIDOMDocumentRange* GetDocumentRange() const { return mDOMDocumentRange; }
nsIDOMDocument* GetDOMDocument() const { return mDOMDocument; }
nsIDocument* GetDocument() const { return mDocument; }
nsIDOMNode* GetRootNode() { return mRootNode; }
nsIUGenCategory* GetCategories() { return mCategories; }
@ -123,7 +122,7 @@ public:
private:
// cached stuff for the editor, set by Init
nsCOMPtr<nsIDOMDocumentRange> mDOMDocumentRange;
nsCOMPtr<nsIDOMDocument> mDOMDocument;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsIDOMWindow> mCSSView;
nsCOMPtr<nsIUGenCategory> mCategories;

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

@ -290,7 +290,10 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
layer->SetTransform(common.transform());
layer->SetTileSourceRect(common.useTileSourceRect() ? &common.tileSourceRect() : NULL);
layer->SetIsFixedPosition(common.isFixedPosition());
static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
if (fixedPositionLayersEnabled) {
layer->SetIsFixedPosition(common.isFixedPosition());
}
typedef SpecificLayerAttributes Specific;
const SpecificLayerAttributes& specific = attrs.specific();

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

@ -168,6 +168,8 @@ ContainerRender(Container* aContainer,
nsIntPoint childOffset(aOffset);
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfxMatrix worldTransform = aManager->GetWorldTransform();
nsIntRect cachedScissor = aContainer->gl()->ScissorRect();
aContainer->gl()->PushScissorRect();
aContainer->mSupportsComponentAlphaChildren = PR_FALSE;
@ -235,7 +237,7 @@ ContainerRender(Container* aContainer,
layerToRender->GetLayer()->CalculateScissorRect(needsFramebuffer,
visibleRect,
cachedScissor,
contTransform);
contTransform * worldTransform);
if (scissorRect.IsEmpty()) {
continue;

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

@ -1363,18 +1363,32 @@ nsRegion nsRegion::ConvertAppUnitsRoundIn (PRInt32 aFromAPP, PRInt32 aToAPP) con
return region;
}
nsIntRegion nsRegion::ToOutsidePixels (nscoord aAppUnitsPerPixel) const
nsIntRegion nsRegion::ToPixels (nscoord aAppUnitsPerPixel, bool aOutsidePixels) const
{
nsIntRegion result;
nsRegionRectIterator rgnIter(*this);
const nsRect* currentRect;
while ((currentRect = rgnIter.Next())) {
nsIntRect deviceRect = currentRect->ToOutsidePixels(aAppUnitsPerPixel);
nsIntRect deviceRect;
if (aOutsidePixels)
deviceRect = currentRect->ToOutsidePixels(aAppUnitsPerPixel);
else
deviceRect = currentRect->ToNearestPixels(aAppUnitsPerPixel);
result.Or(result, deviceRect);
}
return result;
}
nsIntRegion nsRegion::ToOutsidePixels (nscoord aAppUnitsPerPixel) const
{
return ToPixels(aAppUnitsPerPixel, true);
}
nsIntRegion nsRegion::ToNearestPixels (nscoord aAppUnitsPerPixel) const
{
return ToPixels(aAppUnitsPerPixel, false);
}
// A cell's "value" is a pair consisting of
// a) the area of the subrectangle it corresponds to, if it's in
// aContainingRect and in the region, 0 otherwise

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

@ -186,6 +186,7 @@ public:
nsRegion ConvertAppUnitsRoundIn (PRInt32 aFromAPP, PRInt32 aToAPP) const;
nsRegion& ScaleRoundOut(float aXScale, float aYScale);
nsIntRegion ToOutsidePixels (nscoord aAppUnitsPerPixel) const;
nsIntRegion ToNearestPixels (nscoord aAppUnitsPerPixel) const;
nsRegion& ExtendForScaling (float aXMult, float aYMult);
/**
@ -262,6 +263,7 @@ private:
void MoveInto (nsRegion& aDestRegion, const RgnRect* aStartRect);
void MoveInto (nsRegion& aDestRegion)
{ MoveInto (aDestRegion, mRectListHead.next); }
nsIntRegion ToPixels(nscoord aAppUnitsPerPixel, bool aOutsidePixels) const;
};

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

@ -251,3 +251,7 @@
#define NS_THEME_WINDOW_BUTTON_RESTORE 239
#define NS_THEME_WINDOW_BUTTON_BOX 240
#define NS_THEME_WINDOW_BUTTON_BOX_MAXIMIZED 241
// moz-apperance style used in setting proper glass margins
#define NS_THEME_WIN_EXCLUDE_GLASS 242

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

@ -277,6 +277,7 @@ VPATH += \
EXPORTS_NAMESPACES = vm
EXPORTS_vm = \
ArgumentsObject.h \
GlobalObject.h \
Stack.h \
StringObject.h \
@ -415,7 +416,7 @@ CPPSRCS += checks.cc \
# END enclude sources for V8 dtoa
#############################################
ifeq (,$(filter arm% %86 x86_64,$(TARGET_CPU)))
ifeq (,$(filter arm% sparc %86 x86_64,$(TARGET_CPU)))
VPATH += $(srcdir)/assembler \
$(srcdir)/assembler/wtf \

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

@ -236,8 +236,6 @@ AUTOCONF = @AUTOCONF@
PERL = @PERL@
PYTHON = @PYTHON@
RANLIB = @RANLIB@
UNZIP = @UNZIP@
ZIP = @ZIP@
XARGS = @XARGS@
STRIP = @STRIP@
DOXYGEN = @DOXYGEN@

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

@ -974,11 +974,6 @@ AC_SUBST(NSINSTALL_BIN)
MOZ_PATH_PROG(DOXYGEN, doxygen, :)
MOZ_PATH_PROG(AUTOCONF, autoconf, :)
MOZ_PATH_PROG(UNZIP, unzip, :)
MOZ_PATH_PROGS(ZIP, zip)
if test -z "$ZIP" -o "$ZIP" = ":"; then
AC_MSG_ERROR([zip not found in \$PATH])
fi
MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
MOZ_PATH_PROG(XARGS, xargs)
if test -z "$XARGS" -o "$XARGS" = ":"; then
@ -2199,8 +2194,6 @@ ia64*-hpux*)
STRIP='echo not_strip'
PKG_SKIP_STRIP=1
XARGS=xargs
ZIP=zip
UNZIP=unzip
DOXYGEN=:
GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
ASM_SUFFIX=asm

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