Merge m-c to b2g-inbound.

This commit is contained in:
Ryan VanderMeulen 2013-11-19 13:55:16 -05:00
commit 86453e21b8
246 changed files with 3450 additions and 2574 deletions

View File

@ -963,6 +963,9 @@ var gPluginHandler = {
return;
}
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_SHOWN").
add(true);
let message;
// Icons set directly cannot be manipulated using moz-image-region, so
// we use CSS classes instead.
@ -1001,21 +1004,26 @@ var gPluginHandler = {
}
}
// These strings are temporary no-string-change for branch uplift
let buttons = [
{
label: gNavigatorBundle.getString("pluginBlockNow.label"),
accessKey: gNavigatorBundle.getString("pluginBlockNow.accesskey"),
label: gNavigatorBundle.getString("pluginContinueBlocking.label"),
accessKey: gNavigatorBundle.getString("pluginContinueBlocking.accesskey"),
callback: function() {
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_BLOCK").
add(true);
Services.perms.addFromPrincipal(aBrowser.contentDocument.nodePrincipal,
"plugin-hidden-notification",
Services.perms.DENY_ACTION);
}
},
{
label: gNavigatorBundle.getString("offlineApps.allow"),
accessKey: gNavigatorBundle.getString("offlineApps.allowAccessKey"),
label: gNavigatorBundle.getString("pluginActivateTrigger.label"),
accessKey: gNavigatorBundle.getString("pluginActivateTrigger.accesskey"),
callback: function() {
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_ALLOW").
add(true);
let curNotification =
PopupNotifications.getNotification("click-to-play-plugins",
aBrowser);

View File

@ -20,8 +20,7 @@ OS_LIBS += $(call EXPAND_LIBNAME,version)
endif
EXTRA_DSO_LDOPTS += \
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
$(XPCOM_STATICRUNTIME_GLUE_LDOPTS) \
$(XPCOM_GLUE_LDOPTS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)

View File

@ -2071,6 +2071,12 @@ this.CustomizableUI = {
onWidgetDrag: function(aWidgetId, aArea) {
CustomizableUIInternal.notifyListeners("onWidgetDrag", aWidgetId, aArea);
},
notifyStartCustomizing: function(aWindow) {
CustomizableUIInternal.notifyListeners("onCustomizeStart", aWindow);
},
notifyEndCustomizing: function(aWindow) {
CustomizableUIInternal.notifyListeners("onCustomizeEnd", aWindow);
},
isAreaOverflowable: function(aAreaId) {
let area = gAreas.get(aAreaId);
return area ? area.get("type") == this.TYPE_TOOLBAR && area.get("overflowable")

View File

@ -111,6 +111,7 @@ CustomizeMode.prototype = {
this.document.documentElement._lightweightTheme.disable();
this.dispatchToolboxEvent("beforecustomization");
CustomizableUI.notifyStartCustomizing(this.window);
let window = this.window;
let document = this.document;
@ -285,6 +286,7 @@ CustomizeMode.prototype = {
this._changed = false;
this._transitioning = false;
this.dispatchToolboxEvent("aftercustomization");
CustomizableUI.notifyEndCustomizing(this.window);
}.bind(this)).then(null, ERROR);
},

View File

@ -460,13 +460,13 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
// Close the key that was opened.
::RegCloseKey(theKey);
if (REG_FAILED(res) ||
!valueData.Equals(currValue, CaseInsensitiveCompare)) {
_wcsicmp(valueData.get(), currValue)) {
// Key wasn't set or was set to something other than our registry entry.
NS_ConvertUTF8toUTF16 oldValueData(settings->oldValueData);
offset = oldValueData.Find("%APPPATH%");
oldValueData.Replace(offset, 9, appLongPath);
// The current registry value doesn't match the current or the old format.
if (!oldValueData.Equals(currValue, CaseInsensitiveCompare)) {
if (_wcsicmp(oldValueData.get(), currValue)) {
*aIsDefaultBrowser = false;
return NS_OK;
}
@ -579,7 +579,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
// Don't update the FTP protocol handler's shell open command when the
// current registry value doesn't exist or matches the old format.
if (REG_FAILED(res) ||
!oldValueOpen.Equals(currValue, CaseInsensitiveCompare)) {
_wcsicmp(oldValueOpen.get(), currValue)) {
::RegCloseKey(theKey);
return NS_OK;
}

View File

@ -178,6 +178,7 @@ body {
pointer-events: none;
}
body.dim > #header > #element-position,
body.dim > #main > p,
body.dim > #main > .tooltip {
visibility: hidden;

View File

@ -46,6 +46,9 @@ LayoutView.prototype = {
// 'property' is what we are measuring;
// 'value' is the computed dimension, computed in update().
this.map = {
position: {selector: "#element-position",
property: "position",
value: undefined},
marginTop: {selector: ".margin.top > span",
property: "margin-top",
value: undefined},
@ -201,7 +204,19 @@ LayoutView.prototype = {
for (let i in this.map) {
let property = this.map[i].property;
this.map[i].value = parseInt(layout[property]);
if (!(property in layout)) {
// Depending on the actor version, some properties
// might be missing.
continue;
}
let parsedValue = parseInt(layout[property]);
if (Number.isNaN(parsedValue)) {
// Not a number. We use the raw string.
// Useful for "position" for example.
this.map[i].value = layout[property];
} else {
this.map[i].value = parsedValue;
}
}
let margins = layout.autoMargins;

View File

@ -74,7 +74,7 @@
<body class="theme-body devtools-monospace">
<p id="header">
<span id="element-size"></span>
<span id="element-size"></span><span id="element-position"></span>
</p>
<div id="main">

View File

@ -229,7 +229,7 @@ CssHtmlTree.processTemplate = function CssHtmlTree_processTemplate(aTemplate,
};
XPCOMUtils.defineLazyGetter(CssHtmlTree, "_strings", function() Services.strings
.createBundle("chrome://browser/locale/devtools/styleinspector.properties"));
.createBundle("chrome://global/locale/devtools/styleinspector.properties"));
XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
return Cc["@mozilla.org/widget/clipboardhelper;1"].

View File

@ -2446,7 +2446,7 @@ XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
XPCOMUtils.defineLazyGetter(this, "_strings", function() {
return Services.strings.createBundle(
"chrome://browser/locale/devtools/styleinspector.properties");
"chrome://global/locale/devtools/styleinspector.properties");
});
XPCOMUtils.defineLazyGetter(this, "domUtils", function() {

View File

@ -14,7 +14,7 @@ loader.lazyGetter(this, "gDevTools", () => Cu.import("resource:///modules/devtoo
loader.lazyGetter(this, "RuleView", () => require("devtools/styleinspector/rule-view"));
loader.lazyGetter(this, "ComputedView", () => require("devtools/styleinspector/computed-view"));
loader.lazyGetter(this, "_strings", () => Services.strings
.createBundle("chrome://browser/locale/devtools/styleinspector.properties"));
.createBundle("chrome://global/locale/devtools/styleinspector.properties"));
// This module doesn't currently export any symbols directly, it only
// registers inspector tools.

View File

@ -47,7 +47,7 @@ function checkCssLogic()
cssLogic.processMatchedSelectors();
let _strings = Services.strings
.createBundle("chrome://browser/locale/devtools/styleinspector.properties");
.createBundle("chrome://global/locale/devtools/styleinspector.properties");
let inline = _strings.GetStringFromName("rule.sourceInline");

View File

@ -41,7 +41,7 @@ function checkSheets()
let elementStyle = ruleView()._elementStyle;
let _strings = Services.strings
.createBundle("chrome://browser/locale/devtools/styleinspector.properties");
.createBundle("chrome://global/locale/devtools/styleinspector.properties");
let inline = _strings.GetStringFromName("rule.sourceInline");

View File

@ -163,6 +163,14 @@ PluginClickToActivate=Activate %S.
PluginVulnerableUpdatable=This plugin is vulnerable and should be updated.
PluginVulnerableNoUpdate=This plugin has security vulnerabilities.
# infobar UI
pluginContinueBlocking.label=Continue Blocking
pluginContinueBlocking.accesskey=B
# LOCALIZATION NOTE (pluginActivateTrigger): Use the unicode ellipsis char, \u2026,
# or use "..." if \u2026 doesn't suit traditions in your locale.
pluginActivateTrigger.label=Allow…
pluginActivateTrigger.accesskey=A
# Sanitize
# LOCALIZATION NOTE (sanitizeDialog2.everything.title): When "Time range to
# clear" is set to "Everything", the Clear Recent History dialog's title is

View File

@ -39,7 +39,6 @@
locale/browser/devtools/scratchpad.dtd (%chrome/browser/devtools/scratchpad.dtd)
locale/browser/devtools/styleeditor.properties (%chrome/browser/devtools/styleeditor.properties)
locale/browser/devtools/styleeditor.dtd (%chrome/browser/devtools/styleeditor.dtd)
locale/browser/devtools/styleinspector.properties (%chrome/browser/devtools/styleinspector.properties)
locale/browser/devtools/styleinspector.dtd (%chrome/browser/devtools/styleinspector.dtd)
locale/browser/devtools/webConsole.dtd (%chrome/browser/devtools/webConsole.dtd)
locale/browser/devtools/VariablesView.dtd (%chrome/browser/devtools/VariablesView.dtd)

View File

@ -39,30 +39,52 @@ var APZCObserver = {
handleEvent: function APZC_handleEvent(aEvent) {
switch (aEvent.type) {
case 'pageshow':
if (aEvent.target != Browser.selectedBrowser.contentDocument)
break;
// fall through to TabSelect:
case 'TabSelect':
// ROOT_ID doesn't really identify the view we want. When we call
// this on a content document (tab), findElementWithViewId will
// always return the root content document associated with the
// scrollable frame.
const ROOT_ID = 1;
let windowUtils = Browser.selectedBrowser.contentWindow.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
// findElementWithViewId will throw if it can't find it
let element;
try {
element = windowUtils.findElementWithViewId(ROOT_ID);
} catch (e) {
// Not present; nothing to do here
if (aEvent.target != Browser.selectedBrowser.contentDocument) {
break;
}
windowUtils.setDisplayPortForElement(0, 0, ContentAreaObserver.width,
ContentAreaObserver.height,
element);
// intentional fall through
case 'TabSelect': {
// Start off with something reasonable. The apzc will handle these
// calculations once scrolling starts.
let doc = Browser.selectedBrowser.contentDocument.documentElement;
// While running tests, sometimes this can be null. If we don't have a
// root document, there's no point in setting a scrollable display port.
if (!doc) {
break;
}
let win = Browser.selectedBrowser.contentWindow;
let factor = 0.2;
let portX = 0;
let portY = 0;
let portWidth = ContentAreaObserver.width;
let portHeight = ContentAreaObserver.height;
if (portWidth < doc.scrollWidth) {
portWidth += ContentAreaObserver.width * factor;
if (portWidth > doc.scrollWidth) {
portWidth = doc.scrollWidth;
}
}
if (portHeight < doc.scrollHeight) {
portHeight += ContentAreaObserver.height * factor;
if (portHeight > doc.scrollHeight) {
portHeight = doc.scrollHeight;
}
}
if (win.scrollX > 0) {
portX -= ContentAreaObserver.width * factor;
}
if (win.scrollY > 0) {
portY -= ContentAreaObserver.height * factor;
}
let cwu = Browser.selectedBrowser.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
cwu.setDisplayPortForElement(portX, portY,
portWidth, portHeight,
Browser.selectedBrowser.contentDocument.documentElement);
break;
}
case 'TabOpen': {
let browser = aEvent.originalTarget.linkedBrowser;
browser.addEventListener("pageshow", this, true);

View File

@ -114,6 +114,7 @@ function getOverflowContentBoundingRect(aElement) {
*/
let Content = {
_debugEvents: false,
_isZoomedIn: false,
get formAssistant() {
delete this.formAssistant;
@ -133,6 +134,7 @@ let Content = {
addEventListener("touchstart", this, false);
addEventListener("click", this, true);
addEventListener("dblclick", this, true);
addEventListener("keydown", this);
addEventListener("keyup", this);
@ -180,6 +182,15 @@ let Content = {
this.formAssistant.open(aEvent.target, aEvent);
break;
case "dblclick":
// XXX Once gesture listners are used(Bug 933236), apzc will notify us
if (aEvent.mozInputSource == Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH) {
let selection = content.getSelection();
selection.removeAllRanges();
this._onZoomToTappedContent(aEvent.target);
}
break;
case "click":
// Workaround for bug 925457: we sometimes don't recognize the
// correct tap target or are unable to identify if it's editable.
@ -363,6 +374,75 @@ let Content = {
}
},
_onZoomToTappedContent: function (aElement) {
if (!aElement || this._isZoomedIn) {
this._zoomOut();
return;
}
while (aElement && !this._shouldZoomToElement(aElement)) {
aElement = aElement.parentNode;
}
if (!aElement) {
this._zoomOut();
} else {
this._zoomToElement(aElement);
}
},
/******************************************************
* Zoom utilities
*/
_zoomOut: function() {
let rect = getBoundingContentRect(content.document.documentElement);
let utils = Util.getWindowUtils(content);
let viewId = utils.getViewId(content.document.documentElement);
let presShellId = {};
utils.getPresShellId(presShellId);
let zoomData = [rect.x,
rect.y,
rect.width,
rect.height,
presShellId.value,
viewId].join(",");
Services.obs.notifyObservers(null, "Metro:ZoomToRect", zoomData);
this._isZoomedIn = false;
},
_zoomToElement: function(aElement) {
let rect = getBoundingContentRect(aElement);
let utils = Util.getWindowUtils(content);
let viewId = utils.getViewId(content.document.documentElement);
let presShellId = {};
utils.getPresShellId(presShellId);
let zoomData = [rect.x,
rect.y,
rect.width,
rect.height,
presShellId.value,
viewId].join(",");
Services.obs.notifyObservers(null, "Metro:ZoomToRect", zoomData);
this._isZoomedIn = true;
},
_shouldZoomToElement: function(aElement) {
let win = aElement.ownerDocument.defaultView;
if (win.getComputedStyle(aElement, null).display == "inline") {
return false;
}
else if (aElement instanceof Ci.nsIDOMHTMLLIElement) {
return false;
}
else if (aElement instanceof Ci.nsIDOMHTMLQuoteElement) {
return false;
}
else {
return true;
}
},
/******************************************************
* General utilities

View File

@ -253,6 +253,7 @@ var SelectionHelperUI = {
_endMark: null,
_caretMark: null,
_target: null,
_showAfterUpdate: false,
_movement: { active: false, x:0, y: 0 },
_activeSelectionRect: null,
_selectionMarkIds: [],
@ -350,13 +351,29 @@ var SelectionHelperUI = {
*/
observe: function (aSubject, aTopic, aData) {
switch (aTopic) {
case "attach_edit_session_to_content":
let event = aSubject;
SelectionHelperUI.attachEditSession(Browser.selectedTab.browser,
event.clientX, event.clientY);
break;
}
switch (aTopic) {
case "attach_edit_session_to_content":
let event = aSubject;
this.attachEditSession(Browser.selectedTab.browser,
event.clientX, event.clientY);
break;
case "apzc-handle-pan-begin":
if (this.isActive && this.layerMode == kContentLayer) {
this._hideMonocles();
}
break;
case "apzc-handle-pan-end":
// The selection range callback will check to see if the new
// position is off the screen, in which case it shuts down and
// clears the selection.
if (this.isActive && this.layerMode == kContentLayer) {
this._showAfterUpdate = true;
this._sendAsyncMessage("Browser:SelectionUpdate", {});
}
break;
}
},
/*
@ -530,7 +547,10 @@ var SelectionHelperUI = {
*/
init: function () {
Services.obs.addObserver(this, "attach_edit_session_to_content", false);
let os = Services.obs;
os.addObserver(this, "attach_edit_session_to_content", false);
os.addObserver(this, "apzc-handle-pan-begin", false);
os.addObserver(this, "apzc-handle-pan-end", false);
},
_init: function _init(aMsgTarget) {
@ -908,6 +928,16 @@ var SelectionHelperUI = {
this._shutdown();
},
_checkMonocleVisibility: function(aX, aY) {
if (aX < 0 || aY < 0 ||
aX > ContentAreaObserver.viewableWidth ||
aY > ContentAreaObserver.viewableHeight) {
this.closeEditSession(true);
return false;
}
return true;
},
/*
* Message handlers
*/
@ -920,26 +950,43 @@ var SelectionHelperUI = {
let haveSelectionRect = true;
if (json.updateStart) {
this.startMark.position(this._msgTarget.btocx(json.start.xPos, true),
this._msgTarget.btocy(json.start.yPos, true));
let x = this._msgTarget.btocx(json.start.xPos, true);
let y = this._msgTarget.btocx(json.start.yPos, true);
if (!this._checkMonocleVisibility(x, y)) {
return;
}
this.startMark.position(x, y);
}
if (json.updateEnd) {
this.endMark.position(this._msgTarget.btocx(json.end.xPos, true),
this._msgTarget.btocy(json.end.yPos, true));
let x = this._msgTarget.btocx(json.end.xPos, true);
let y = this._msgTarget.btocx(json.end.yPos, true);
if (!this._checkMonocleVisibility(x, y)) {
return;
}
this.endMark.position(x, y);
}
if (json.updateCaret) {
let x = this._msgTarget.btocx(json.caret.xPos, true);
let y = this._msgTarget.btocx(json.caret.yPos, true);
if (!this._checkMonocleVisibility(x, y)) {
return;
}
// If selectionRangeFound is set SelectionHelper found a range we can
// attach to. If not, there's no text in the control, and hence no caret
// position information we can use.
haveSelectionRect = json.selectionRangeFound;
if (json.selectionRangeFound) {
this.caretMark.position(this._msgTarget.btocx(json.caret.xPos, true),
this._msgTarget.btocy(json.caret.yPos, true));
this.caretMark.position(x, y);
this.caretMark.show();
}
}
if (this._showAfterUpdate) {
this._showAfterUpdate = false;
this._showMonocles(!json.updateCaret);
}
this._targetIsEditable = json.targetIsEditable;
this._activeSelectionRect = haveSelectionRect ?
this._msgTarget.rectBrowserToClient(json.selection, true) :

View File

@ -93,7 +93,6 @@ var TouchModule = {
// capture phase events
window.addEventListener("CancelTouchSequence", this, true);
window.addEventListener("dblclick", this, true);
window.addEventListener("keydown", this, true);
window.addEventListener("MozMouseHittest", this, true);
@ -144,20 +143,6 @@ var TouchModule = {
case "touchend":
this._onTouchEnd(aEvent);
break;
case "dblclick":
// XXX This will get picked up somewhere below us for "double tap to zoom"
// once we get omtc and the apzc. Currently though dblclick is delivered to
// content and triggers selection of text, so fire up the SelectionHelperUI
// once selection is present.
if (!InputSourceHelper.isPrecise &&
!SelectionHelperUI.isActive &&
!FindHelperUI.isActive) {
setTimeout(function () {
SelectionHelperUI.attachEditSession(Browser.selectedTab.browser,
aEvent.clientX, aEvent.clientY);
}, 50);
}
break;
case "keydown":
this._handleKeyDown(aEvent);
break;

View File

@ -62,21 +62,6 @@ gTests.push({
},
});
gTests.push({
desc: "double-tap to select",
setUp: setUpAndTearDown,
tearDown: setUpAndTearDown,
run: function test() {
sendDoubleTap(gWindow, 30, 20);
yield waitForCondition(function () {
return SelectionHelperUI.isSelectionUIVisible;
}, kCommonWaitMs, kCommonPollMs);
is(getTrimmedSelection(gWindow).toString(), "There", "selection test");
},
});
gTests.push({
desc: "appbar interactions",
setUp: setUpAndTearDown,

View File

@ -38,7 +38,7 @@
background-color: -moz-Dialog;
}
#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar) {
#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar) {
padding-top: 1px;
padding-bottom: 1px;
}

View File

@ -521,19 +521,12 @@ class Automation(object):
try:
totalMemory = int(os.popen("free").readlines()[1].split()[1])
# Only 2 GB RAM or less available? Use custom ASan options to reduce
# Only 4 GB RAM or less available? Use custom ASan options to reduce
# the amount of resources required to do the tests. Standard options
# will otherwise lead to OOM conditions on the current test slaves.
#
# If we have more than 2 GB or RAM but still less than 4 GB, we need
# another set of options to prevent OOM in some memory-intensive
# tests.
if totalMemory <= 1024 * 1024 * 2:
if totalMemory <= 1024 * 1024 * 4:
self.log.info("INFO | automation.py | ASan running in low-memory configuration")
env["ASAN_OPTIONS"] = "quarantine_size=50331648:redzone=64"
elif totalMemory <= 1024 * 1024 * 4:
self.log.info("INFO | automation.py | ASan running in mid-memory configuration")
env["ASAN_OPTIONS"] = "quarantine_size=100663296:redzone=64"
env["ASAN_OPTIONS"] = "quarantine_size=50331648"
else:
self.log.info("INFO | automation.py | ASan running in default memory configuration")
except OSError,err:

View File

@ -457,20 +457,13 @@ def environment(xrePath, env=None, crashreporter=True):
totalMemory = systemMemory()
# Only 2 GB RAM or less available? Use custom ASan options to reduce
# Only 4 GB RAM or less available? Use custom ASan options to reduce
# the amount of resources required to do the tests. Standard options
# will otherwise lead to OOM conditions on the current test slaves.
#
# If we have more than 2 GB or RAM but still less than 4 GB, we need
# another set of options to prevent OOM in some memory-intensive
# tests.
message = "INFO | runtests.py | ASan running in %s configuration"
if totalMemory <= 1024 * 1024 * 2:
if totalMemory <= 1024 * 1024 * 4:
message = message % 'low-memory'
env["ASAN_OPTIONS"] = "quarantine_size=50331648:redzone=64"
elif totalMemory <= 1024 * 1024 * 4:
message = message % 'mid-memory'
env["ASAN_OPTIONS"] = "quarantine_size=80530636:redzone=64"
env["ASAN_OPTIONS"] = "quarantine_size=50331648"
else:
message = message % 'default memory'
except OSError,err:

View File

@ -84,8 +84,14 @@ class ExpandArgsMore(ExpandArgs):
self.tmp.append(tmp)
if conf.AR == 'lib':
out = subprocess.check_output([conf.AR, '-NOLOGO', '-LIST', arg])
for l in out.splitlines():
subprocess.call([conf.AR, '-NOLOGO', '-EXTRACT:%s' % l, os.path.abspath(arg)], cwd=tmp)
files = out.splitlines()
# If lib -list returns a list full of dlls, it's an
# import lib.
if all(isDynamicLib(f) for f in files):
newlist += [arg]
continue
for f in files:
subprocess.call([conf.AR, '-NOLOGO', '-EXTRACT:%s' % f, os.path.abspath(arg)], cwd=tmp)
else:
subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
objs = []

View File

@ -3105,6 +3105,9 @@ AC_CACHE_CHECK(
#ifdef linux
#define _BSD_SOURCE 1
#endif
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
],
[int foo = res_ninit(&_res);],

View File

@ -1078,6 +1078,12 @@ public:
nsresult QuerySelector(const nsAString& aSelector, nsIDOMElement **aReturn);
nsresult QuerySelectorAll(const nsAString& aSelector, nsIDOMNodeList **aReturn);
protected:
// nsIDocument overrides this with its own (faster) version. This
// should really only be called for elements and document fragments.
mozilla::dom::Element* GetElementById(const nsAString& aId);
public:
/**
* Associate an object aData to aKey on this node. If aData is null any
* previously registered object and UserDataHandler associated to aKey on

View File

@ -40,6 +40,8 @@ public:
using FragmentOrElement::GetFirstChild;
using nsINode::QuerySelector;
using nsINode::QuerySelectorAll;
// Make sure bindings can see our superclass' protected GetElementById method.
using nsINode::GetElementById;
// nsISupports
NS_DECL_ISUPPORTS_INHERITED

View File

@ -205,7 +205,7 @@ NS_GetContentList(nsINode* aRootNode,
return list.forget();
}
static PLDHashTableOps hash_table_ops =
static const PLDHashTableOps hash_table_ops =
{
PL_DHashAllocTable,
PL_DHashFreeTable,
@ -326,7 +326,7 @@ GetFuncStringContentList(nsINode* aRootNode,
nsRefPtr<nsCacheableFuncStringContentList> list;
static PLDHashTableOps hash_table_ops =
static const PLDHashTableOps hash_table_ops =
{
PL_DHashAllocTable,
PL_DHashFreeTable,

View File

@ -395,7 +395,7 @@ nsContentUtils::Init()
return NS_ERROR_FAILURE;
if (!sEventListenerManagersHash.ops) {
static PLDHashTableOps hash_table_ops =
static const PLDHashTableOps hash_table_ops =
{
PL_DHashAllocTable,
PL_DHashFreeTable,

View File

@ -3592,7 +3592,7 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
if (!mSubDocuments) {
// Create a new hashtable
static PLDHashTableOps hash_table_ops =
static const PLDHashTableOps hash_table_ops =
{
PL_DHashAllocTable,
PL_DHashFreeTable,

View File

@ -2319,6 +2319,59 @@ AddScopeElements(TreeMatchContext& aMatchContext,
}
}
namespace {
struct SelectorMatchInfo {
nsCSSSelectorList* const mSelectorList;
TreeMatchContext& mMatchContext;
};
}
// Given an id, find elements with that id under aRoot that match aMatchInfo if
// any is provided. If no SelectorMatchInfo is provided, just find the ones
// with the given id. aRoot must be in the document.
template<bool onlyFirstMatch, class T>
inline static void
FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
SelectorMatchInfo* aMatchInfo,
T& aList)
{
MOZ_ASSERT(aRoot->IsInDoc(),
"Don't call me if the root is not in the document");
MOZ_ASSERT(aRoot->IsElement() || aRoot->IsNodeOfType(nsINode::eDOCUMENT),
"The optimization below to check ContentIsDescendantOf only for "
"elements depends on aRoot being either an element or a "
"document if it's in the document. Note that document fragments "
"can't be IsInDoc(), so should never show up here.");
const nsSmallVoidArray* elements = aRoot->OwnerDoc()->GetAllElementsForId(aId);
if (!elements) {
// Nothing to do; we're done
return;
}
// XXXbz: Should we fall back to the tree walk if aRoot is not the
// document and |elements| is long, for some value of "long"?
for (int32_t i = 0; i < elements->Count(); ++i) {
Element *element = static_cast<Element*>(elements->ElementAt(i));
if (!aRoot->IsElement() ||
(element != aRoot &&
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
// We have an element with the right id and it's a strict descendant
// of aRoot. Make sure it really matches the selector.
if (!aMatchInfo ||
nsCSSRuleProcessor::SelectorListMatches(element,
aMatchInfo->mMatchContext,
aMatchInfo->mSelectorList)) {
aList.AppendElement(element);
if (onlyFirstMatch) {
return;
}
}
}
}
}
// Actually find elements matching aSelectorList (which must not be
// null) and which are descendants of aRoot and put them in aList. If
// onlyFirstMatch, then stop once the first one is found.
@ -2326,7 +2379,6 @@ template<bool onlyFirstMatch, class Collector, class T>
MOZ_ALWAYS_INLINE static nsresult
FindMatchingElements(nsINode* aRoot, const nsAString& aSelector, T &aList)
{
nsIDocument* doc = aRoot->OwnerDoc();
nsIDocument::SelectorCache& cache = doc->GetSelectorCache();
nsCSSSelectorList* selectorList = nullptr;
@ -2380,32 +2432,9 @@ FindMatchingElements(nsINode* aRoot, const nsAString& aSelector, T &aList)
!selectorList->mNext &&
selectorList->mSelectors->mIDList) {
nsIAtom* id = selectorList->mSelectors->mIDList->mAtom;
const nsSmallVoidArray* elements =
doc->GetAllElementsForId(nsDependentAtomString(id));
// XXXbz: Should we fall back to the tree walk if aRoot is not the
// document and |elements| is long, for some value of "long"?
if (elements) {
for (int32_t i = 0; i < elements->Count(); ++i) {
Element *element = static_cast<Element*>(elements->ElementAt(i));
if (!aRoot->IsElement() ||
(element != aRoot &&
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
// We have an element with the right id and it's a strict descendant
// of aRoot. Make sure it really matches the selector.
if (nsCSSRuleProcessor::SelectorListMatches(element, matchingContext,
selectorList)) {
aList.AppendElement(element);
if (onlyFirstMatch) {
return NS_OK;
}
}
}
}
}
// No elements with this id, or none of them are our descendants,
// or none of them match. We're done here.
SelectorMatchInfo info = { selectorList, matchingContext };
FindMatchingElementsWithId<onlyFirstMatch, T>(nsDependentAtomString(id),
aRoot, &info, aList);
return NS_OK;
}
@ -2492,6 +2521,29 @@ nsINode::QuerySelectorAll(const nsAString& aSelector, nsIDOMNodeList **aReturn)
return rv.ErrorCode();
}
Element*
nsINode::GetElementById(const nsAString& aId)
{
MOZ_ASSERT(IsElement() || IsNodeOfType(eDOCUMENT_FRAGMENT),
"Bogus this object for GetElementById call");
if (IsInDoc()) {
ElementHolder holder;
FindMatchingElementsWithId<true>(aId, this, nullptr, holder);
return holder.mElement;
}
for (nsIContent* kid = GetFirstChild(); kid; kid = kid->GetNextNode(this)) {
if (!kid->IsElement()) {
continue;
}
nsIAtom* id = kid->AsElement()->GetID();
if (id && id->Equals(aId)) {
return kid->AsElement();
}
}
return nullptr;
}
JSObject*
nsINode::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
{

View File

@ -532,6 +532,7 @@ support-files =
[test_elementTraversal.html]
[test_fileapi.html]
[test_fileapi_slice.html]
[test_getElementById.html]
[test_html_colors_quirks.html]
[test_html_colors_standards.html]
[test_html_in_xhr.html]

View File

@ -0,0 +1,58 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=933193
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 933193</title>
<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=933193">Mozilla Bug 933193</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
<script type="application/javascript">
/** Test for Bug 933193 **/
var kid = document.createElement("span");
kid.id = "test";
var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg.appendChild(kid);
is(svg.getElementById("test"), kid,
"Should find the right node when not in the DOM");
var newKid = document.createElement("span");
newKid.id = "test";
var newKidParent = document.createElement("span");
newKidParent.appendChild(newKid);
svg.insertBefore(newKidParent, kid);
is(svg.getElementById("test"), newKid,
"Should find the first right node when not in the DOM");
newKid.remove();
is(svg.getElementById("test"), kid,
"Should find the right node again when not in the DOM");
document.body.appendChild(svg);
is(svg.getElementById("test"), kid,
"Should find the right node when in the DOM");
is(document.getElementById("test").localName, "pre",
"document.getElementById should find the first element in the " +
"document with that id");
var frag = document.createDocumentFragment();
is(frag.getElementById("test"), null, "Shouldn't find what does not exist");
frag.appendChild(kid);
is(frag.getElementById("test"), kid,
"Should find the right node in the document fragment");
is(svg.getElementById("test"), null,
"Shouldn't find the kid since it's gone now");
</script>
</body>
</html>

View File

@ -20,7 +20,7 @@ EXPORTS.mozilla.dom += [
if CONFIG['MOZ_WEBSPEECH']:
EXPORTS.mozilla.dom += ['SpeechRecognitionError.h']
SOURCES += [
UNIFIED_SOURCES += [
'DOMWheelEvent.cpp',
'EventTarget.cpp',
'nsAsyncDOMEvent.cpp',
@ -54,7 +54,6 @@ SOURCES += [
'nsEventDispatcher.cpp',
'nsEventListenerManager.cpp',
'nsEventListenerService.cpp',
'nsEventStateManager.cpp',
'nsIMEStateManager.cpp',
'nsPaintRequest.cpp',
'nsPrivateTextRange.cpp',
@ -62,8 +61,13 @@ SOURCES += [
'Touch.cpp',
]
# nsEventStateManager.cpp should be built separately because of Mac OS X headers.
SOURCES += [
'nsEventStateManager.cpp',
]
if CONFIG['MOZ_WEBSPEECH']:
SOURCES += ['SpeechRecognitionError.cpp']
UNIFIED_SOURCES += ['SpeechRecognitionError.cpp']
FAIL_ON_WARNINGS = True

View File

@ -126,36 +126,45 @@ AudioSegment::WriteTo(uint64_t aID, AudioStream* aOutput)
NS_ERROR("Buffer overflow");
return;
}
uint32_t duration = uint32_t(durationTicks);
buf.SetLength(outputChannels*duration);
if (c.mBuffer) {
channelData.SetLength(c.mChannelData.Length());
for (uint32_t i = 0; i < channelData.Length(); ++i) {
channelData[i] =
AddAudioSampleOffset(c.mChannelData[i], c.mBufferFormat, int32_t(offset));
}
if (channelData.Length() < outputChannels) {
// Up-mix. Note that this might actually make channelData have more
// than outputChannels temporarily.
AudioChannelsUpMix(&channelData, outputChannels, gZeroChannel);
}
// If we have written data in the past, or we have real (non-silent) data
// to write, we can proceed. Otherwise, it means we just started the
// AudioStream, and we don't have real data to write to it (just silence).
// To avoid overbuffering in the AudioStream, we simply drop the silence,
// here. The stream will underrun and output silence anyways.
if (c.mBuffer || aOutput->GetWritten()) {
buf.SetLength(outputChannels*duration);
if (c.mBuffer) {
channelData.SetLength(c.mChannelData.Length());
for (uint32_t i = 0; i < channelData.Length(); ++i) {
channelData[i] =
AddAudioSampleOffset(c.mChannelData[i], c.mBufferFormat, int32_t(offset));
}
if (channelData.Length() > outputChannels) {
// Down-mix.
DownmixAndInterleave(channelData, c.mBufferFormat, duration,
c.mVolume, outputChannels, buf.Elements());
if (channelData.Length() < outputChannels) {
// Up-mix. Note that this might actually make channelData have more
// than outputChannels temporarily.
AudioChannelsUpMix(&channelData, outputChannels, gZeroChannel);
}
if (channelData.Length() > outputChannels) {
// Down-mix.
DownmixAndInterleave(channelData, c.mBufferFormat, duration,
c.mVolume, outputChannels, buf.Elements());
} else {
InterleaveAndConvertBuffer(channelData.Elements(), c.mBufferFormat,
duration, c.mVolume,
outputChannels,
buf.Elements());
}
} else {
InterleaveAndConvertBuffer(channelData.Elements(), c.mBufferFormat,
duration, c.mVolume,
outputChannels,
buf.Elements());
// Assumes that a bit pattern of zeroes == 0.0f
memset(buf.Elements(), 0, buf.Length()*sizeof(AudioDataValue));
}
} else {
// Assumes that a bit pattern of zeroes == 0.0f
memset(buf.Elements(), 0, buf.Length()*sizeof(AudioDataValue));
aOutput->Write(buf.Elements(), int32_t(duration), &(c.mTimeStamp));
}
aOutput->Write(buf.Elements(), int32_t(duration), &(c.mTimeStamp));
if(!c.mTimeStamp.IsNull()) {
TimeStamp now = TimeStamp::Now();
// would be more efficient to c.mTimeStamp to ms on create time then pass here

View File

@ -144,6 +144,7 @@ AudioStream::AudioStream()
mChannels(0),
mWritten(0),
mAudioClock(MOZ_THIS_IN_INITIALIZER_LIST()),
mLatencyRequest(HighLatency),
mReadPoint(0)
{}
@ -364,6 +365,7 @@ private:
// aTime is the time in ms the samples were inserted into MediaStreamGraph
long GetUnprocessed(void* aBuffer, long aFrames, int64_t &aTime);
long GetTimeStretched(void* aBuffer, long aFrames, int64_t &aTime);
long GetUnprocessedWithSilencePadding(void* aBuffer, long aFrames, int64_t &aTime);
// Shared implementation of underflow adjusted position calculation.
// Caller must own the monitor.
@ -577,6 +579,7 @@ BufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
("%s channels: %d, rate: %d", __FUNCTION__, aNumChannels, aRate));
mInRate = mOutRate = aRate;
mChannels = aNumChannels;
mLatencyRequest = aLatencyRequest;
mDumpFile = OpenDumpFile(this);
@ -634,6 +637,13 @@ BufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
NS_ABORT_IF_FALSE(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames");
mBuffer.SetCapacity(bufferLimit);
// Start the stream right away when low latency has been requested. This means
// that the DataCallback will feed silence to cubeb, until the first frames
// are writtent to this BufferedAudioStream.
if (mLatencyRequest == AudioStream::LowLatency) {
Start();
}
return NS_OK;
}
@ -912,6 +922,32 @@ BufferedAudioStream::GetUnprocessed(void* aBuffer, long aFrames, int64_t &aTimeM
return BytesToFrames(available) + flushedFrames;
}
// Get unprocessed samples, and pad the beginning of the buffer with silence if
// there is not enough data.
long
BufferedAudioStream::GetUnprocessedWithSilencePadding(void* aBuffer, long aFrames, int64_t& aTimeMs)
{
uint32_t toPopBytes = FramesToBytes(aFrames);
uint32_t available = std::min(toPopBytes, mBuffer.Length());
uint32_t silenceOffset = toPopBytes - available;
uint8_t* wpos = reinterpret_cast<uint8_t*>(aBuffer);
memset(wpos, 0, silenceOffset);
wpos += silenceOffset;
void* input[2];
uint32_t input_size[2];
mBuffer.PopElements(available, &input[0], &input_size[0], &input[1], &input_size[1]);
memcpy(wpos, input[0], input_size[0]);
wpos += input_size[0];
memcpy(wpos, input[1], input_size[1]);
GetBufferInsertTime(aTimeMs);
return aFrames;
}
long
BufferedAudioStream::GetTimeStretched(void* aBuffer, long aFrames, int64_t &aTimeMs)
{
@ -965,8 +1001,16 @@ BufferedAudioStream::DataCallback(void* aBuffer, long aFrames)
int64_t insertTime;
if (available) {
// When we are playing a low latency stream, and it is the first time we are
// getting data from the buffer, we prefer to add the silence for an
// underrun at the beginning of the buffer, so the first buffer is not cut
// in half by the silence inserted to compensate for the underrun.
if (mInRate == mOutRate) {
servicedFrames = GetUnprocessed(output, aFrames, insertTime);
if (mLatencyRequest == AudioStream::LowLatency && !mWritten) {
servicedFrames = GetUnprocessedWithSilencePadding(output, aFrames, insertTime);
} else {
servicedFrames = GetUnprocessed(output, aFrames, insertTime);
}
} else {
servicedFrames = GetTimeStretched(output, aFrames, insertTime);
}

View File

@ -207,6 +207,8 @@ protected:
// copy of Latency logger's starting time for offset calculations
TimeStamp mStartTime;
// Whether we are playing a low latency stream, or a normal stream.
LatencyRequest mLatencyRequest;
// Where in the current mInserts[0] block cubeb has read to
int64_t mReadPoint;
// Keep track of each inserted block of samples and the time it was inserted

View File

@ -435,18 +435,6 @@ SVGSVGElement::CreateSVGTransformFromMatrix(SVGMatrix& matrix)
return transform.forget();
}
Element*
SVGSVGElement::GetElementById(const nsAString& elementId, ErrorResult& rv)
{
nsAutoString selector(NS_LITERAL_STRING("#"));
nsStyleUtil::AppendEscapedCSSIdent(PromiseFlatString(elementId), selector);
nsIContent* element = QuerySelector(selector, rv);
if (!rv.Failed() && element) {
return element->AsElement();
}
return nullptr;
}
//----------------------------------------------------------------------
already_AddRefed<SVGAnimatedRect>

View File

@ -246,7 +246,7 @@ public:
already_AddRefed<SVGIRect> CreateSVGRect();
already_AddRefed<SVGTransform> CreateSVGTransform();
already_AddRefed<SVGTransform> CreateSVGTransformFromMatrix(SVGMatrix& matrix);
Element* GetElementById(const nsAString& elementId, ErrorResult& rv);
using nsINode::GetElementById; // This does what we want
already_AddRefed<SVGAnimatedRect> ViewBox();
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
uint16_t ZoomAndPan();

View File

@ -92,7 +92,7 @@ InitObjectEntry(PLDHashTable* table, PLDHashEntryHdr* entry, const void* key)
static PLDHashTableOps ObjectTableOps = {
static const PLDHashTableOps ObjectTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub,

View File

@ -780,7 +780,7 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
return;
}
static PLDHashTableOps gOps = {
static const PLDHashTableOps gOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub,

View File

@ -337,7 +337,7 @@ nsScriptNameSpaceManager::RegisterInterface(const char* aIfName,
nsresult
nsScriptNameSpaceManager::Init()
{
static PLDHashTableOps hash_table_ops =
static const PLDHashTableOps hash_table_ops =
{
PL_DHashAllocTable,
PL_DHashFreeTable,

View File

@ -2167,6 +2167,13 @@ TraceGlobal(JSTracer* aTrc, JSObject* aObj)
mozilla::dom::TraceProtoAndIfaceCache(aTrc, aObj);
}
void
FinalizeGlobal(JSFreeOp* aFreeOp, JSObject* aObj)
{
MOZ_ASSERT(js::GetObjectClass(aObj)->flags & JSCLASS_DOM_GLOBAL);
mozilla::dom::DestroyProtoAndIfaceCache(aObj);
}
bool
ResolveGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::MutableHandle<jsid> aId, unsigned aFlags,

View File

@ -20,6 +20,7 @@
#include "mozilla/dom/RootedDictionary.h"
#include "mozilla/dom/workers/Workers.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/Likely.h"
#include "mozilla/Util.h"
#include "nsCycleCollector.h"
@ -289,6 +290,11 @@ AllocateProtoAndIfaceCache(JSObject* obj)
js::SetReservedSlot(obj, DOM_PROTOTYPE_SLOT,
JS::PrivateValue(protoAndIfaceArray));
#ifdef NS_BUILD_REFCNT_LOGGING
NS_LogCtor((void*)protoAndIfaceArray, "ProtoAndIfaceArray",
sizeof(JS::Heap<JSObject*>) * kProtoAndIfaceCacheCount);
#endif
}
inline void
@ -313,6 +319,11 @@ DestroyProtoAndIfaceCache(JSObject* obj)
JS::Heap<JSObject*>* protoAndIfaceArray = GetProtoAndIfaceArray(obj);
#ifdef NS_BUILD_REFCNT_LOGGING
NS_LogDtor((void*)protoAndIfaceArray, "ProtoAndIfaceArray",
sizeof(JS::Heap<JSObject*>) * kProtoAndIfaceCacheCount);
#endif
delete [] protoAndIfaceArray;
}
@ -2273,6 +2284,9 @@ ThreadsafeCheckIsChrome(JSContext* aCx, JSObject* aObj);
void
TraceGlobal(JSTracer* aTrc, JSObject* aObj);
void
FinalizeGlobal(JSFreeOp* aFop, JSObject* aObj);
bool
ResolveGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::MutableHandle<jsid> aId, unsigned aFlags,
@ -2323,6 +2337,8 @@ CreateGlobal(JSContext* aCx, T* aObject, nsWrapperCache* aCache,
return nullptr;
}
mozilla::HoldJSObjects(aObject);
return global;
}

View File

@ -1084,6 +1084,8 @@ def finalizeHook(descriptor, hookName, context):
finalize += "ClearWrapper(self, self);\n"
if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
finalize += "self->mExpandoAndGeneration.expando = JS::UndefinedValue();\n"
if descriptor.interface.getExtendedAttribute("Global"):
finalize += "mozilla::dom::FinalizeGlobal(fop, obj);\n"
if descriptor.nativeOwnership == 'worker':
finalize += "self->Release();"
else:

View File

@ -26,6 +26,7 @@ static ANPNativeWindow anp_native_window_acquireNativeWindow(NPP instance) {
static void anp_native_window_invertPluginContent(NPP instance, bool isContentInverted) {
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
pinst->SetInverted(isContentInverted);
pinst->RedrawPlugin();
}

View File

@ -993,7 +993,7 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
if (!sJSObjWrappers.ops) {
// No hash yet (or any more), initialize it.
static PLDHashTableOps ops =
static const PLDHashTableOps ops =
{
PL_DHashAllocTable,
PL_DHashFreeTable,

View File

@ -13,13 +13,7 @@
[Constructor]
interface DocumentFragment : Node {
// NEW
/*
FIXME: not implemented yet
void prepend((Node or DOMString)... nodes);
void append((Node or DOMString)... nodes);
*/
Element? getElementById(DOMString elementId);
};
// http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions

View File

@ -59,7 +59,6 @@ interface SVGSVGElement : SVGGraphicsElement {
SVGTransform createSVGTransform();
[NewObject]
SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
[Throws]
Element? getElementById(DOMString elementId);
};

View File

@ -4240,6 +4240,11 @@ WorkerPrivate::TraceTimeouts(const TraceCallbacks& aCallbacks,
for (uint32_t index = 0; index < mTimeouts.Length(); index++) {
TimeoutInfo* info = mTimeouts[index];
if (info->mTimeoutCallable.isUndefined()) {
continue;
}
aCallbacks.Trace(&info->mTimeoutCallable, "mTimeoutCallable", aClosure);
for (uint32_t index2 = 0; index2 < info->mExtraArgVals.Length(); index2++) {
aCallbacks.Trace(&info->mExtraArgVals[index2], "mExtraArgVals[i]", aClosure);

View File

@ -41,6 +41,8 @@ WorkerGlobalScope::WorkerGlobalScope(WorkerPrivate* aWorkerPrivate)
WorkerGlobalScope::~WorkerGlobalScope()
{
// Matches the HoldJSObjects in CreateGlobal.
mozilla::DropJSObjects(this);
}
NS_IMPL_CYCLE_COLLECTION_CLASS(WorkerGlobalScope)

View File

@ -45,6 +45,7 @@ support-files =
threadErrors_worker4.js
threadTimeouts_worker.js
throwingOnerror_worker.js
timeoutTracing_worker.js
transferable_worker.js
urlApi_worker.js
url_worker.js
@ -96,6 +97,7 @@ support-files =
[test_threadErrors.html]
[test_threadTimeouts.html]
[test_throwingOnerror.html]
[test_timeoutTracing.html]
[test_transferable.html]
[test_url.html]
[test_urlApi.html]

View File

@ -0,0 +1,47 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<!--
Tests of DOM Worker Threads
-->
<head>
<title>Test for DOM Worker Threads</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var worker = new Worker("timeoutTracing_worker.js");
worker.onmessage = function(event) {
// begin
worker.onmessage = null;
// 1 second should be enough to crash.
window.setTimeout(function(event) {
ok(true, "Didn't crash!");
SimpleTest.finish();
}, 1000);
var os = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
.getService(SpecialPowers.Ci.nsIObserverService);
os.notifyObservers(null, "memory-pressure", "heap-minimize");
}
worker.onerror = function(event) {
ok(false, "I was expecting a crash, not an error");
SimpleTest.finish();
};
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,13 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
onmessage = function(event) {
throw "No messages should reach me!";
}
setInterval(function() { postMessage("Still alive!"); }, 20);
setInterval(";", 20);
postMessage("Begin!");

View File

@ -13,7 +13,7 @@
using namespace mozilla;
PLDHashTableOps nsCommandParams::sHashOps =
const PLDHashTableOps nsCommandParams::sHashOps =
{
PL_DHashAllocTable,
PL_DHashFreeTable,

View File

@ -147,7 +147,7 @@ protected:
int32_t mCurEntry;
int32_t mNumEntries; // number of entries at start of enumeration (-1 indicates not known)
static PLDHashTableOps sHashOps;
static const PLDHashTableOps sHashOps;
};

View File

@ -40,6 +40,9 @@ typedef KLStatus (*KLCacheHasValidTickets_type)(
#endif
#if defined(HAVE_RES_NINIT)
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#endif

View File

@ -132,6 +132,20 @@ GetHostForPrincipal(nsIPrincipal* aPrincipal, nsACString& aHost)
return NS_OK;
}
// For the mailto scheme, we use the path of the URI. We have to chop off the
// query part if one exists, so we eliminate everything after a ?.
bool isMailTo = false;
if (NS_SUCCEEDED(uri->SchemeIs("mailto", &isMailTo)) && isMailTo) {
rv = uri->GetPath(aHost);
NS_ENSURE_SUCCESS(rv, rv);
int32_t spart = aHost.FindChar('?', 0);
if (spart >= 0) {
aHost.Cut(spart, aHost.Length() - spart);
}
return NS_OK;
}
// Some entries like "file://" uses the origin.
rv = aPrincipal->GetOrigin(getter_Copies(aHost));
if (NS_SUCCEEDED(rv) && !aHost.IsEmpty()) {

View File

@ -0,0 +1,38 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function run_test() {
// initialize the permission manager service
const kTestAddr = "test@example.org";
const kType = "test-mailto";
const kCapability = 1;
// make a mailto: URI with parameters
let uri = Services.io.newURI("mailto:" + kTestAddr + "?subject=test", null,
null);
// add a permission entry for that URI
Services.permissions.add(uri, kType, kCapability);
do_check_true(permission_exists(kTestAddr, kType, kCapability));
Services.permissions.removeAll();
uri = Services.io.newURI("mailto:" + kTestAddr, null, null);
Services.permissions.add(uri, kType, kCapability);
do_check_true(permission_exists(kTestAddr, kType, kCapability));
Services.permissions.removeAll();
}
function permission_exists(aHost, aType, aCapability) {
let e = Services.permissions.enumerator;
while (e.hasMoreElements()) {
let perm = e.getNext().QueryInterface(Ci.nsIPermission);
if (perm.host == aHost &&
perm.type == aType &&
perm.capability == aCapability) {
return true;
}
}
return false;
}

View File

@ -27,6 +27,7 @@ skip-if = debug == true
[test_permmanager_idn.js]
[test_permmanager_subdomains.js]
[test_permmanager_local_files.js]
[test_permmanager_mailto.js]
[test_permmanager_cleardata.js]
[test_schema_2_migration.js]
[test_schema_3_migration.js]

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [
UNIFIED_SOURCES += [
'mozHunspell.cpp',
'mozHunspellDirProvider.cpp',
]

View File

@ -78,7 +78,6 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
static NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID);
NS_IMPL_CYCLE_COLLECTING_ADDREF(mozHunspell)

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [
UNIFIED_SOURCES += [
'mozEnglishWordUtils.cpp',
'mozGenericWordUtils.cpp',
'mozInlineSpellChecker.cpp',

View File

@ -3,6 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozInlineSpellWordUtil_h
#define mozInlineSpellWordUtil_h
#include "nsCOMPtr.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
@ -159,3 +162,5 @@ private:
nsresult MakeRange(NodeOffset aBegin, NodeOffset aEnd, nsRange** aRange);
nsresult MakeRangeForWord(const RealWord& aWord, nsRange** aRange);
};
#endif

View File

@ -153,7 +153,7 @@ NS_IMETHODIMP mozPersonalDictionary::Save()
if(NS_FAILED(res)) return res;
nsCOMPtr<nsIOutputStream> outStream;
NS_NewLocalFileOutputStream(getter_AddRefs(outStream), theFile, PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE ,0664);
NS_NewSafeLocalFileOutputStream(getter_AddRefs(outStream), theFile, PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE ,0664);
// get a buffered output stream 4096 bytes big, to optimize writes
nsCOMPtr<nsIOutputStream> bufferedOutputStream;
@ -171,6 +171,14 @@ NS_IMETHODIMP mozPersonalDictionary::Save()
bufferedOutputStream->Write(utf8Key.get(), utf8Key.Length(), &bytesWritten);
bufferedOutputStream->Write("\n", 1, &bytesWritten);
}
nsCOMPtr<nsISafeOutputStream> safeStream = do_QueryInterface(bufferedOutputStream);
NS_ASSERTION(safeStream, "expected a safe output stream!");
if (safeStream) {
res = safeStream->Finish();
if (NS_FAILED(res)) {
NS_WARNING("failed to save personal dictionary file! possible data loss");
}
}
return res;
}

View File

@ -3,6 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_gfx_DrawTargetCG_h
#define mozilla_gfx_DrawTargetCG_h
#include <ApplicationServices/ApplicationServices.h>
#include "2D.h"
@ -176,3 +179,6 @@ private:
}
}
#endif

View File

@ -95,7 +95,6 @@ private:
friend class DrawTargetCG;
CGMutablePathRef mPath;
bool mEndedActive;
Point mEndPoint;
FillRule mFillRule;
};

View File

@ -277,7 +277,7 @@ RecordedDrawingEvent::RecordToStream(ostream &aStream) const
}
ReferencePtr
RecordedDrawingEvent::GetObject() const
RecordedDrawingEvent::GetObjectRef() const
{
return mDT;
}

View File

@ -178,7 +178,7 @@ public:
virtual std::string GetName() const = 0;
virtual ReferencePtr GetObject() const = 0;
virtual ReferencePtr GetObjectRef() const = 0;
virtual ReferencePtr GetDestinedDT() { return nullptr; }
@ -211,7 +211,7 @@ protected:
RecordedDrawingEvent(EventType aType, std::istream &aStream);
virtual void RecordToStream(std::ostream &aStream) const;
virtual ReferencePtr GetObject() const;
virtual ReferencePtr GetObjectRef() const;
ReferencePtr mDT;
};
@ -228,7 +228,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "DrawTarget Creation"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
ReferencePtr mRefPtr;
BackendType mBackendType;
@ -253,7 +253,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "DrawTarget Destruction"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
ReferencePtr mRefPtr;
@ -646,7 +646,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "Path Creation"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;
@ -670,7 +670,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "Path Destruction"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;
@ -696,7 +696,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "SourceSurface Creation"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;
@ -723,7 +723,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "SourceSurface Destruction"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;
@ -749,7 +749,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "GradientStops Creation"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;
@ -775,7 +775,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "GradientStops Destruction"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;
@ -797,7 +797,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "Snapshot"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;
@ -828,7 +828,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "ScaledFont Creation"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
void SetFontData(const uint8_t *aData, uint32_t aSize, uint32_t aIndex, Float aGlyphSize);
@ -857,7 +857,7 @@ public:
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
virtual std::string GetName() const { return "ScaledFont Destruction"; }
virtual ReferencePtr GetObject() const { return mRefPtr; }
virtual ReferencePtr GetObjectRef() const { return mRefPtr; }
private:
friend class RecordedEvent;

View File

@ -36,7 +36,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
'MacIOSurface.h',
'QuartzSupport.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'DrawTargetCG.cpp',
'PathCG.cpp',
'ScaledFontMac.cpp',
@ -62,13 +62,15 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
]
if CONFIG['MOZ_ENABLE_SKIA']:
SOURCES += [
UNIFIED_SOURCES += [
'convolver.cpp',
'DrawTargetSkia.cpp',
'image_operations.cpp',
'PathSkia.cpp',
'SourceSurfaceSkia.cpp',
]
SOURCES += [
'image_operations.cpp', # Uses _USE_MATH_DEFINES
]
# Are we targeting x86 or x64? If so, build SSE2 files.
if CONFIG['INTEL_ARCHITECTURE']:
@ -79,7 +81,7 @@ if CONFIG['INTEL_ARCHITECTURE']:
'ImageScalingSSE2.cpp',
]
SOURCES += [
UNIFIED_SOURCES += [
'Blur.cpp',
'DrawEventRecorder.cpp',
'DrawTargetCairo.cpp',

View File

@ -362,130 +362,4 @@
#define cairo_xlib_surface_get_xrender_format _moz_cairo_xlib_surface_get_xrender_format
#define cairo_xlib_surface_set_drawable _moz_cairo_xlib_surface_set_drawable
#define cairo_xlib_surface_set_size _moz_cairo_xlib_surface_set_size
#ifdef MOZ_TREE_PIXMAN
#define pixman_region_set_static_pointers _moz_pixman_region_set_static_pointers
#define pixman_region_init _moz_pixman_region_init
#define pixman_region_init_rect _moz_pixman_region_init_rect
#define pixman_region_init_rects _moz_pixman_region_init_rects
#define pixman_region_init_with_extents _moz_pixman_region_init_with_extents
#define pixman_region_fini _moz_pixman_region_fini
#define pixman_region_translate _moz_pixman_region_translate
#define pixman_region_copy _moz_pixman_region_copy
#define pixman_region_intersect _moz_pixman_region_intersect
#define pixman_region_union _moz_pixman_region_union
#define pixman_region_union_rect _moz_pixman_region_union_rect
#define pixman_region_subtract _moz_pixman_region_subtract
#define pixman_region_inverse _moz_pixman_region_inverse
#define pixman_region_contains_point _moz_pixman_region_contains_point
#define pixman_region_contains_rectangle _moz_pixman_region_contains_rectangle
#define pixman_region_not_empty _moz_pixman_region_not_empty
#define pixman_region_extents _moz_pixman_region_extents
#define pixman_region_n_rects _moz_pixman_region_n_rects
#define pixman_region_rectangles _moz_pixman_region_rectangles
#define pixman_region_equal _moz_pixman_region_equal
#define pixman_region_selfcheck _moz_pixman_region_selfcheck
#define pixman_region_reset _moz_pixman_region_reset
#define pixman_region32_init _moz_pixman_region32_init
#define pixman_region32_init_rect _moz_pixman_region32_init_rect
#define pixman_region32_init_rects _moz_pixman_region32_init_rects
#define pixman_region32_init_with_extents _moz_pixman_region32_init_with_extents
#define pixman_region32_fini _moz_pixman_region32_fini
#define pixman_region32_translate _moz_pixman_region32_translate
#define pixman_region32_copy _moz_pixman_region32_copy
#define pixman_region32_intersect _moz_pixman_region32_intersect
#define pixman_region32_union _moz_pixman_region32_union
#define pixman_region32_union_rect _moz_pixman_region32_union_rect
#define pixman_region32_subtract _moz_pixman_region32_subtract
#define pixman_region32_inverse _moz_pixman_region32_inverse
#define pixman_region32_contains_point _moz_pixman_region32_contains_point
#define pixman_region32_contains_rectangle _moz_pixman_region32_contains_rectangle
#define pixman_region32_not_empty _moz_pixman_region32_not_empty
#define pixman_region32_extents _moz_pixman_region32_extents
#define pixman_region32_n_rects _moz_pixman_region32_n_rects
#define pixman_region32_rectangles _moz_pixman_region32_rectangles
#define pixman_region32_equal _moz_pixman_region32_equal
#define pixman_region32_selfcheck _moz_pixman_region32_selfcheck
#define pixman_region32_reset _moz_pixman_region32_reset
#define pixman_blt _moz_pixman_blt
#define pixman_fill _moz_pixman_fill
#define pixman_transform_point_3d _moz_pixman_transform_point_3d
#define pixman_version _moz_pixman_version
#define pixman_version_string _moz_pixman_version_string
#define pixman_format_supported_destination _moz_pixman_format_supported_destination
#define pixman_format_supported_source _moz_pixman_format_supported_source
#define pixman_image_create_solid_fill _moz_pixman_image_create_solid_fill
#define pixman_image_create_linear_gradient _moz_pixman_image_create_linear_gradient
#define pixman_image_create_radial_gradient _moz_pixman_image_create_radial_gradient
#define pixman_image_create_conical_gradient _moz_pixman_image_create_conical_gradient
#define pixman_image_create_bits _moz_pixman_image_create_bits
#define pixman_image_ref _moz_pixman_image_ref
#define pixman_image_unref _moz_pixman_image_unref
#define pixman_image_set_clip_region _moz_pixman_image_set_clip_region
#define pixman_image_set_clip_region32 _moz_pixman_image_set_clip_region32
#define pixman_image_set_has_client_clip _moz_pixman_image_set_has_client_clip
#define pixman_image_set_transform _moz_pixman_image_set_transform
#define pixman_image_set_repeat _moz_pixman_image_set_repeat
#define pixman_image_set_filter _moz_pixman_image_set_filter
#define pixman_image_set_source_clipping _moz_pixman_image_set_source_clipping
#define pixman_image_set_alpha_map _moz_pixman_image_set_alpha_map
#define pixman_image_set_component_alpha _moz_pixman_image_set_component_alpha
#define pixman_image_set_accessors _moz_pixman_image_set_accessors
#define pixman_image_set_indexed _moz_pixman_image_set_indexed
#define pixman_image_get_data _moz_pixman_image_get_data
#define pixman_image_get_width _moz_pixman_image_get_width
#define pixman_image_get_height _moz_pixman_image_get_height
#define pixman_image_get_stride _moz_pixman_image_get_stride
#define pixman_image_get_depth _moz_pixman_image_get_depth
#define pixman_image_fill_rectangles _moz_pixman_image_fill_rectangles
#define pixman_compute_composite_region _moz_pixman_compute_composite_region
#define pixman_image_composite _moz_pixman_image_composite
#define pixman_sample_ceil_y _moz_pixman_sample_ceil_y
#define pixman_sample_floor_y _moz_pixman_sample_floor_y
#define pixman_edge_step _moz_pixman_edge_step
#define pixman_edge_init _moz_pixman_edge_init
#define pixman_line_fixed_edge_init _moz_pixman_line_fixed_edge_init
#define pixman_rasterize_edges _moz_pixman_rasterize_edges
#define pixman_add_traps _moz_pixman_add_traps
#define pixman_add_trapezoids _moz_pixman_add_trapezoids
#define pixman_rasterize_trapezoid _moz_pixman_rasterize_trapezoid
#define pixman_disable_out_of_bounds_workaround _moz_pixman_disable_out_of_bounds_workaround
#define pixman_f_transform_bounds _moz_pixman_f_transform_bounds
#define pixman_f_transform_from_pixman_transform _moz_pixman_f_transform_from_pixman_transform
#define pixman_f_transform_init_identity _moz_pixman_f_transform_init_identity
#define pixman_f_transform_init_rotate _moz_pixman_f_transform_init_rotate
#define pixman_f_transform_init_scale _moz_pixman_f_transform_init_scale
#define pixman_f_transform_init_translate _moz_pixman_f_transform_init_translate
#define pixman_f_transform_invert _moz_pixman_f_transform_invert
#define pixman_f_transform_multiply _moz_pixman_f_transform_multiply
#define pixman_f_transform_point _moz_pixman_f_transform_point
#define pixman_f_transform_point_3d _moz_pixman_f_transform_point_3d
#define pixman_f_transform_rotate _moz_pixman_f_transform_rotate
#define pixman_f_transform_scale _moz_pixman_f_transform_scale
#define pixman_f_transform_translate _moz_pixman_f_transform_translate
#define pixman_image_composite32 _moz_pixman_image_composite32
#define pixman_image_fill_boxes _moz_pixman_image_fill_boxes
#define pixman_image_get_component_alpha _moz_pixman_image_get_component_alpha
#define pixman_image_get_destroy_data _moz_pixman_image_get_destroy_data
#define pixman_image_get_format _moz_pixman_image_get_format
#define pixman_image_set_destroy_function _moz_pixman_image_set_destroy_function
#define pixman_region_init_from_image _moz_pixman_region_init_from_image
#define pixman_region_intersect_rect _moz_pixman_region_intersect_rect
#define pixman_region32_init_from_image _moz_pixman_region32_init_from_image
#define pixman_region32_intersect_rect _moz_pixman_region32_intersect_rect
#define pixman_transform_bounds _moz_pixman_transform_bounds
#define pixman_transform_from_pixman_f_transform _moz_pixman_transform_from_pixman_f_transform
#define pixman_transform_init_identity _moz_pixman_transform_init_identity
#define pixman_transform_init_rotate _moz_pixman_transform_init_rotate
#define pixman_transform_init_scale _moz_pixman_transform_init_scale
#define pixman_transform_init_translate _moz_pixman_transform_init_translate
#define pixman_transform_invert _moz_pixman_transform_invert
#define pixman_transform_is_identity _moz_pixman_transform_is_identity
#define pixman_transform_is_int_translate _moz_pixman_transform_is_int_translate
#define pixman_transform_is_inverse _moz_pixman_transform_is_inverse
#define pixman_transform_is_scale _moz_pixman_transform_is_scale
#define pixman_transform_multiply _moz_pixman_transform_multiply
#define pixman_transform_point _moz_pixman_transform_point
#define pixman_transform_rotate _moz_pixman_transform_rotate
#define pixman_transform_scale _moz_pixman_transform_scale
#define pixman_transform_translate _moz_pixman_transform_translate
#endif
#include "pixman-rename.h"

View File

@ -13,6 +13,7 @@ EXPORTS.cairo += [
'cairo-tee.h',
'cairo-version.h',
'cairo.h',
'pixman-rename.h',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('cocoa', 'uikit'):

View File

@ -0,0 +1,128 @@
#ifdef MOZ_TREE_PIXMAN
#define pixman_region_set_static_pointers _moz_pixman_region_set_static_pointers
#define pixman_region_init _moz_pixman_region_init
#define pixman_region_init_rect _moz_pixman_region_init_rect
#define pixman_region_init_rects _moz_pixman_region_init_rects
#define pixman_region_init_with_extents _moz_pixman_region_init_with_extents
#define pixman_region_fini _moz_pixman_region_fini
#define pixman_region_translate _moz_pixman_region_translate
#define pixman_region_copy _moz_pixman_region_copy
#define pixman_region_intersect _moz_pixman_region_intersect
#define pixman_region_union _moz_pixman_region_union
#define pixman_region_union_rect _moz_pixman_region_union_rect
#define pixman_region_subtract _moz_pixman_region_subtract
#define pixman_region_inverse _moz_pixman_region_inverse
#define pixman_region_contains_point _moz_pixman_region_contains_point
#define pixman_region_contains_rectangle _moz_pixman_region_contains_rectangle
#define pixman_region_not_empty _moz_pixman_region_not_empty
#define pixman_region_extents _moz_pixman_region_extents
#define pixman_region_n_rects _moz_pixman_region_n_rects
#define pixman_region_rectangles _moz_pixman_region_rectangles
#define pixman_region_equal _moz_pixman_region_equal
#define pixman_region_selfcheck _moz_pixman_region_selfcheck
#define pixman_region_reset _moz_pixman_region_reset
#define pixman_region32_init _moz_pixman_region32_init
#define pixman_region32_init_rect _moz_pixman_region32_init_rect
#define pixman_region32_init_rects _moz_pixman_region32_init_rects
#define pixman_region32_init_with_extents _moz_pixman_region32_init_with_extents
#define pixman_region32_init_from_image _moz_pixman_region32_init_from_image
#define pixman_region32_fini _moz_pixman_region32_fini
#define pixman_region32_translate _moz_pixman_region32_translate
#define pixman_region32_copy _moz_pixman_region32_copy
#define pixman_region32_intersect _moz_pixman_region32_intersect
#define pixman_region32_intersect_rect _moz_pixman_region32_intersect_rect
#define pixman_region32_union _moz_pixman_region32_union
#define pixman_region32_union_rect _moz_pixman_region32_union_rect
#define pixman_region32_subtract _moz_pixman_region32_subtract
#define pixman_region32_inverse _moz_pixman_region32_inverse
#define pixman_region32_contains_point _moz_pixman_region32_contains_point
#define pixman_region32_contains_rectangle _moz_pixman_region32_contains_rectangle
#define pixman_region32_not_empty _moz_pixman_region32_not_empty
#define pixman_region32_extents _moz_pixman_region32_extents
#define pixman_region32_n_rects _moz_pixman_region32_n_rects
#define pixman_region32_rectangles _moz_pixman_region32_rectangles
#define pixman_region32_equal _moz_pixman_region32_equal
#define pixman_region32_selfcheck _moz_pixman_region32_selfcheck
#define pixman_region32_reset _moz_pixman_region32_reset
#define pixman_region32_clear _moz_pixman_region32_clear
#define pixman_blt _moz_pixman_blt
#define pixman_fill _moz_pixman_fill
#define pixman_transform_point_3d _moz_pixman_transform_point_3d
#define pixman_version _moz_pixman_version
#define pixman_version_string _moz_pixman_version_string
#define pixman_format_supported_destination _moz_pixman_format_supported_destination
#define pixman_format_supported_source _moz_pixman_format_supported_source
#define pixman_image_create_solid_fill _moz_pixman_image_create_solid_fill
#define pixman_image_create_linear_gradient _moz_pixman_image_create_linear_gradient
#define pixman_image_create_radial_gradient _moz_pixman_image_create_radial_gradient
#define pixman_image_create_conical_gradient _moz_pixman_image_create_conical_gradient
#define pixman_image_create_bits _moz_pixman_image_create_bits
#define pixman_image_ref _moz_pixman_image_ref
#define pixman_image_unref _moz_pixman_image_unref
#define pixman_image_set_clip_region _moz_pixman_image_set_clip_region
#define pixman_image_set_clip_region32 _moz_pixman_image_set_clip_region32
#define pixman_image_set_has_client_clip _moz_pixman_image_set_has_client_clip
#define pixman_image_set_transform _moz_pixman_image_set_transform
#define pixman_image_set_repeat _moz_pixman_image_set_repeat
#define pixman_image_set_filter _moz_pixman_image_set_filter
#define pixman_image_set_source_clipping _moz_pixman_image_set_source_clipping
#define pixman_image_set_alpha_map _moz_pixman_image_set_alpha_map
#define pixman_image_set_component_alpha _moz_pixman_image_set_component_alpha
#define pixman_image_set_accessors _moz_pixman_image_set_accessors
#define pixman_image_set_indexed _moz_pixman_image_set_indexed
#define pixman_image_get_data _moz_pixman_image_get_data
#define pixman_image_get_width _moz_pixman_image_get_width
#define pixman_image_get_height _moz_pixman_image_get_height
#define pixman_image_get_stride _moz_pixman_image_get_stride
#define pixman_image_get_depth _moz_pixman_image_get_depth
#define pixman_image_fill_rectangles _moz_pixman_image_fill_rectangles
#define pixman_compute_composite_region _moz_pixman_compute_composite_region
#define pixman_image_composite _moz_pixman_image_composite
#define pixman_sample_ceil_y _moz_pixman_sample_ceil_y
#define pixman_sample_floor_y _moz_pixman_sample_floor_y
#define pixman_edge_step _moz_pixman_edge_step
#define pixman_edge_init _moz_pixman_edge_init
#define pixman_line_fixed_edge_init _moz_pixman_line_fixed_edge_init
#define pixman_rasterize_edges _moz_pixman_rasterize_edges
#define pixman_add_traps _moz_pixman_add_traps
#define pixman_add_trapezoids _moz_pixman_add_trapezoids
#define pixman_rasterize_trapezoid _moz_pixman_rasterize_trapezoid
#define pixman_disable_out_of_bounds_workaround _moz_pixman_disable_out_of_bounds_workaround
#define pixman_f_transform_bounds _moz_pixman_f_transform_bounds
#define pixman_f_transform_from_pixman_transform _moz_pixman_f_transform_from_pixman_transform
#define pixman_f_transform_init_identity _moz_pixman_f_transform_init_identity
#define pixman_f_transform_init_rotate _moz_pixman_f_transform_init_rotate
#define pixman_f_transform_init_scale _moz_pixman_f_transform_init_scale
#define pixman_f_transform_init_translate _moz_pixman_f_transform_init_translate
#define pixman_f_transform_invert _moz_pixman_f_transform_invert
#define pixman_f_transform_multiply _moz_pixman_f_transform_multiply
#define pixman_f_transform_point _moz_pixman_f_transform_point
#define pixman_f_transform_point_3d _moz_pixman_f_transform_point_3d
#define pixman_f_transform_rotate _moz_pixman_f_transform_rotate
#define pixman_f_transform_scale _moz_pixman_f_transform_scale
#define pixman_f_transform_translate _moz_pixman_f_transform_translate
#define pixman_image_composite32 _moz_pixman_image_composite32
#define pixman_image_fill_boxes _moz_pixman_image_fill_boxes
#define pixman_image_get_component_alpha _moz_pixman_image_get_component_alpha
#define pixman_image_get_destroy_data _moz_pixman_image_get_destroy_data
#define pixman_image_get_format _moz_pixman_image_get_format
#define pixman_image_set_destroy_function _moz_pixman_image_set_destroy_function
#define pixman_region_init_from_image _moz_pixman_region_init_from_image
#define pixman_region_intersect_rect _moz_pixman_region_intersect_rect
#define pixman_transform_bounds _moz_pixman_transform_bounds
#define pixman_transform_from_pixman_f_transform _moz_pixman_transform_from_pixman_f_transform
#define pixman_transform_init_identity _moz_pixman_transform_init_identity
#define pixman_transform_init_rotate _moz_pixman_transform_init_rotate
#define pixman_transform_init_scale _moz_pixman_transform_init_scale
#define pixman_transform_init_translate _moz_pixman_transform_init_translate
#define pixman_transform_invert _moz_pixman_transform_invert
#define pixman_transform_is_identity _moz_pixman_transform_is_identity
#define pixman_transform_is_int_translate _moz_pixman_transform_is_int_translate
#define pixman_transform_is_inverse _moz_pixman_transform_is_inverse
#define pixman_transform_is_scale _moz_pixman_transform_is_scale
#define pixman_transform_multiply _moz_pixman_transform_multiply
#define pixman_transform_point _moz_pixman_transform_point
#define pixman_transform_rotate _moz_pixman_transform_rotate
#define pixman_transform_scale _moz_pixman_transform_scale
#define pixman_transform_translate _moz_pixman_transform_translate
#endif

View File

@ -85,7 +85,19 @@
/* In libxul builds we don't ever want to export pixman symbols */
#if 1
# define PIXMAN_EXPORT cairo_public
#include "prcpucfg.h"
#ifdef HAVE_VISIBILITY_HIDDEN_ATTRIBUTE
#define CVISIBILITY_HIDDEN __attribute__((visibility("hidden")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define CVISIBILITY_HIDDEN __hidden
#else
#define CVISIBILITY_HIDDEN
#endif
/* In libxul builds we don't ever want to export cairo symbols */
#define PIXMAN_EXPORT extern CVISIBILITY_HIDDEN
#else
/* GCC visibility */

View File

@ -69,7 +69,10 @@ SOFTWARE.
#ifndef PIXMAN_H__
#define PIXMAN_H__
#include "cairo-platform.h"
#ifdef MOZILLA_VERSION
#include "cairo/pixman-rename.h"
#endif
#include <pixman-version.h>

View File

@ -105,6 +105,14 @@ CanvasClient2D::CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFla
mTextureInfo.mTextureFlags | aFlags);
}
void
CanvasClient2D::OnActorDestroy()
{
if (mBuffer) {
mBuffer->OnActorDestroy();
}
}
void
DeprecatedCanvasClient2D::Updated()
{
@ -156,6 +164,14 @@ DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
mDeprecatedTextureClient->Unlock();
}
void
DeprecatedCanvasClient2D::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
}
void
DeprecatedCanvasClientSurfaceStream::Updated()
{
@ -224,5 +240,13 @@ DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLaye
aLayer->Painted();
}
void
DeprecatedCanvasClientSurfaceStream::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
}
}
}

View File

@ -91,9 +91,12 @@ public:
mBuffer = nullptr;
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<TextureClient> mBuffer;
};
class DeprecatedCanvasClient2D : public CanvasClient
{
public:
@ -114,6 +117,8 @@ public:
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
};
@ -140,6 +145,8 @@ public:
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
};

View File

@ -35,7 +35,6 @@ CompositableClient::~CompositableClient()
Destroy();
FlushTexturesToRemoveCallbacks();
MOZ_ASSERT(mTexturesToRemove.Length() == 0, "would leak textures pending for deletion");
}
@ -87,6 +86,7 @@ CompositableClient::Destroy()
if (!mCompositableChild) {
return;
}
mCompositableChild->SetClient(nullptr);
mCompositableChild->Destroy();
mCompositableChild = nullptr;
}
@ -257,5 +257,13 @@ CompositableClient::OnTransaction()
mTexturesToRemove.Clear();
}
void
CompositableChild::ActorDestroy(ActorDestroyReason why)
{
if (mCompositableClient && why == AbnormalShutdown) {
mCompositableClient->OnActorDestroy();
}
}
} // namespace layers
} // namespace mozilla

View File

@ -161,6 +161,12 @@ public:
* Only call this if you know what you are doing.
*/
void FlushTexturesToRemoveCallbacks();
/**
* Our IPDL actor is being destroyed, get rid of any shmem resources now.
*/
virtual void OnActorDestroy() = 0;
protected:
struct TextureIDAndFlags {
TextureIDAndFlags(uint64_t aID, TextureFlags aFlags)
@ -207,6 +213,8 @@ public:
return mCompositableClient;
}
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
void SetAsyncID(uint64_t aID) { mID = aID; }
uint64_t GetAsyncID() const
{

View File

@ -327,6 +327,21 @@ ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
}
}
void
ContentClientRemoteBuffer::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
if (mDeprecatedTextureClientOnWhite) {
mDeprecatedTextureClientOnWhite->OnActorDestroy();
}
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
mOldTextures[i]->OnActorDestroy();
}
}
ContentClientDoubleBuffered::~ContentClientDoubleBuffered()
{
if (mDeprecatedTextureClient) {
@ -427,6 +442,26 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
ContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
}
void
ContentClientDoubleBuffered::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
if (mDeprecatedTextureClientOnWhite) {
mDeprecatedTextureClientOnWhite->OnActorDestroy();
}
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
mOldTextures[i]->OnActorDestroy();
}
if (mFrontClient) {
mFrontClient->OnActorDestroy();
}
if (mFrontClientOnWhite) {
mFrontClientOnWhite->OnActorDestroy();
}
}
struct AutoDeprecatedTextureClient {
AutoDeprecatedTextureClient()
: mTexture(nullptr)

View File

@ -163,6 +163,8 @@ public:
MOZ_CRASH("Should not be called on non-remote ContentClient");
}
virtual void OnActorDestroy() MOZ_OVERRIDE {}
private:
BasicLayerManager* mManager;
};
@ -247,6 +249,8 @@ public:
return mTextureInfo;
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
const nsIntRegion& aVisibleRegion,
@ -310,6 +314,8 @@ protected:
virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
virtual void LockFrontBuffer() MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
void UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion);
@ -395,6 +401,8 @@ public:
}
}
virtual void OnActorDestroy() MOZ_OVERRIDE {}
private:
enum BufferType{

View File

@ -280,6 +280,25 @@ ImageClientBuffered::UpdateImage(ImageContainer* aContainer,
return ImageClientSingle::UpdateImage(aContainer, aContentFlags);
}
void
ImageClientSingle::OnActorDestroy()
{
if (mFrontBuffer) {
mFrontBuffer->OnActorDestroy();
}
}
void
ImageClientBuffered::OnActorDestroy()
{
if (mFrontBuffer) {
mFrontBuffer->OnActorDestroy();
}
if (mBackBuffer) {
mBackBuffer->OnActorDestroy();
}
}
bool
ImageClientSingle::AddTextureClient(TextureClient* aTexture)
{
@ -465,6 +484,14 @@ ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
{
}
void
DeprecatedImageClientSingle::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
}
bool
ImageClientBridge::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags)
{

View File

@ -102,6 +102,8 @@ public:
virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
RefPtr<TextureClient> mFrontBuffer;
// Some layers may want to enforce some flags to all their textures
@ -125,6 +127,8 @@ public:
virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
RefPtr<TextureClient> mBackBuffer;
};
@ -169,6 +173,8 @@ public:
virtual already_AddRefed<Image> CreateImage(const uint32_t *aFormats,
uint32_t aNumFormats) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
TextureInfo mTextureInfo;
@ -210,6 +216,8 @@ public:
return nullptr;
}
virtual void OnActorDestroy() MOZ_OVERRIDE {}
protected:
uint64_t mAsyncContainerID;
ShadowableLayer* mLayer;

View File

@ -390,6 +390,15 @@ DeprecatedTextureClient::~DeprecatedTextureClient()
MOZ_ASSERT(mDescriptor.type() == SurfaceDescriptor::T__None, "Need to release surface!");
}
void
DeprecatedTextureClient::OnActorDestroy()
{
if (ISurfaceAllocator::IsShmem(&mDescriptor)) {
mDescriptor = SurfaceDescriptor();
}
}
DeprecatedTextureClientShmem::DeprecatedTextureClientShmem(CompositableForwarder* aForwarder,
const TextureInfo& aTextureInfo)
: DeprecatedTextureClient(aForwarder, aTextureInfo)

View File

@ -216,6 +216,10 @@ public:
*/
void MarkInvalid() { mValid = false; }
// If a texture client holds a reference to shmem, it should override this
// method to forget about the shmem _without_ releasing it.
virtual void OnActorDestroy() {}
protected:
void AddFlags(TextureFlags aFlags)
{
@ -316,6 +320,11 @@ public:
ipc::Shmem& GetShmem() { return mShmem; }
virtual void OnActorDestroy() MOZ_OVERRIDE
{
mShmem = ipc::Shmem();
}
protected:
ipc::Shmem mShmem;
ISurfaceAllocator* mAllocator;
@ -492,6 +501,8 @@ public:
virtual gfxContentType GetContentType() = 0;
void OnActorDestroy();
protected:
DeprecatedTextureClient(CompositableForwarder* aForwarder,
const TextureInfo& aTextureInfo);

View File

@ -201,6 +201,14 @@ public:
static BasicTiledLayerBuffer OpenDescriptor(ISurfaceAllocator* aAllocator,
const SurfaceDescriptorTiles& aDescriptor);
void OnActorDestroy()
{
for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
if (mRetainedTiles[i].IsPlaceholderTile()) continue;
mRetainedTiles[i].mDeprecatedTextureClient->OnActorDestroy();
}
}
protected:
BasicTiledLayerTile ValidateTile(BasicTiledLayerTile aTile,
const nsIntPoint& aTileRect,
@ -290,6 +298,12 @@ public:
};
void LockCopyAndWrite(TiledBufferType aType);
virtual void OnActorDestroy() MOZ_OVERRIDE
{
mTiledBuffer.OnActorDestroy();
mLowPrecisionTiledBuffer.OnActorDestroy();
}
private:
BasicTiledLayerBuffer mTiledBuffer;
BasicTiledLayerBuffer mLowPrecisionTiledBuffer;

View File

@ -237,7 +237,14 @@ void
CompositableParent::ActorDestroy(ActorDestroyReason why)
{
if (mHost) {
mHost->Detach();
// XXX: sadness warning. We should be able to do this whenever we get ActorDestroy,
// not just for abnormal shutdowns (which is the only case we _need_ to - so that
// we don't double release our shmems). But, for some reason, that causes a
// crash, we don't know why. (Bug 925773).
if (why == AbnormalShutdown) {
mHost->OnActorDestroy();
}
mHost->Detach(nullptr, CompositableHost::FORCE_DETACH);
}
}

View File

@ -107,6 +107,12 @@ public:
mBackendData = aBackendData;
}
/**
* Our IPDL actor is being destroyed, get rid of any shmem resources now and
* don't worry about compositing anymore.
*/
virtual void OnActorDestroy() = 0;
// If base class overrides, it should still call the parent implementation
virtual void SetCompositor(Compositor* aCompositor);
@ -237,6 +243,7 @@ public:
static const AttachFlags NO_FLAGS = 0;
static const AttachFlags ALLOW_REATTACH = 1;
static const AttachFlags KEEP_ATTACHED = 2;
static const AttachFlags FORCE_DETACH = 2;
virtual void Attach(Layer* aLayer,
Compositor* aCompositor,
@ -257,10 +264,12 @@ public:
// attached to that layer. If we are part of a normal layer, then we will be
// detached in any case. if aLayer is null, then we will only detach if we are
// not async.
void Detach(Layer* aLayer = nullptr)
// Only force detach if the IPDL tree is being shutdown.
void Detach(Layer* aLayer = nullptr, AttachFlags aFlags = NO_FLAGS)
{
if (!mKeepAttached ||
aLayer == mLayer) {
aLayer == mLayer ||
aFlags & FORCE_DETACH) {
SetLayer(nullptr);
SetCompositor(nullptr);
mAttached = false;

View File

@ -52,6 +52,23 @@ ContentHostBase::DestroyFrontHost()
mDeprecatedTextureHostOnWhite = nullptr;
}
void
ContentHostBase::OnActorDestroy()
{
if (mDeprecatedTextureHost) {
mDeprecatedTextureHost->OnActorDestroy();
}
if (mDeprecatedTextureHostOnWhite) {
mDeprecatedTextureHostOnWhite->OnActorDestroy();
}
if (mNewFrontHost) {
mNewFrontHost->OnActorDestroy();
}
if (mNewFrontHostOnWhite) {
mNewFrontHostOnWhite->OnActorDestroy();
}
}
void
ContentHostBase::Composite(EffectChain& aEffectChain,
float aOpacity,
@ -409,19 +426,16 @@ ContentHostDoubleBuffered::DestroyTextures()
"We won't be able to destroy our SurfaceDescriptor");
mNewFrontHost = nullptr;
}
if (mNewFrontHostOnWhite) {
MOZ_ASSERT(mNewFrontHostOnWhite->GetDeAllocator(),
"We won't be able to destroy our SurfaceDescriptor");
mNewFrontHostOnWhite = nullptr;
}
if (mBackHost) {
MOZ_ASSERT(mBackHost->GetDeAllocator(),
"We won't be able to destroy our SurfaceDescriptor");
mBackHost = nullptr;
}
if (mBackHostOnWhite) {
MOZ_ASSERT(mBackHostOnWhite->GetDeAllocator(),
"We won't be able to destroy our SurfaceDescriptor");
@ -431,6 +445,29 @@ ContentHostDoubleBuffered::DestroyTextures()
// don't touch mDeprecatedTextureHost, we might need it for compositing
}
void
ContentHostDoubleBuffered::OnActorDestroy()
{
if (mDeprecatedTextureHost) {
mDeprecatedTextureHost->OnActorDestroy();
}
if (mDeprecatedTextureHostOnWhite) {
mDeprecatedTextureHostOnWhite->OnActorDestroy();
}
if (mNewFrontHost) {
mNewFrontHost->OnActorDestroy();
}
if (mNewFrontHostOnWhite) {
mNewFrontHostOnWhite->OnActorDestroy();
}
if (mBackHost) {
mBackHost->OnActorDestroy();
}
if (mBackHostOnWhite) {
mBackHostOnWhite->OnActorDestroy();
}
}
void
ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,

View File

@ -127,6 +127,8 @@ public:
// destroy our front buffer so that we can continue to composite.
virtual void DestroyTextures() = 0;
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
virtual nsIntPoint GetOriginOffset()
{
@ -177,6 +179,8 @@ public:
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
virtual void DestroyTextures() MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
#ifdef MOZ_DUMP_PAINTING
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",

View File

@ -68,6 +68,13 @@ public:
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE
{
if (mFrontBuffer) {
mFrontBuffer->OnActorDestroy();
}
}
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#ifdef MOZ_DUMP_PAINTING
@ -128,6 +135,13 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE
{
if (mDeprecatedTextureHost) {
mDeprecatedTextureHost->OnActorDestroy();
}
}
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#ifdef MOZ_DUMP_PAINTING

View File

@ -242,6 +242,15 @@ DeprecatedTextureHost::SwapTextures(const SurfaceDescriptor& aImage,
SetBuffer(mBuffer, mDeAllocator);
}
void
DeprecatedTextureHost::OnActorDestroy()
{
if (ISurfaceAllocator::IsShmem(mBuffer)) {
*mBuffer = SurfaceDescriptor();
mBuffer = nullptr;
}
}
void
DeprecatedTextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
{
@ -506,6 +515,13 @@ ShmemTextureHost::DeallocateSharedData()
}
}
void
ShmemTextureHost::OnActorDestroy()
{
delete mShmem;
mShmem = nullptr;
}
uint8_t* ShmemTextureHost::GetBuffer()
{
return mShmem ? mShmem->get<uint8_t>() : nullptr;

View File

@ -384,6 +384,10 @@ public:
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
// If a texture host holds a reference to shmem, it should override this method
// to forget about the shmem _without_ releasing it.
virtual void OnActorDestroy() {}
virtual const char *Name() { return "TextureHost"; }
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
@ -480,6 +484,8 @@ public:
virtual const char *Name() MOZ_OVERRIDE { return "ShmemTextureHost"; }
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
mozilla::ipc::Shmem* mShmem;
ISurfaceAllocator* mDeallocator;
@ -710,6 +716,8 @@ public:
// see bug 865908 about fixing this.
virtual void ForgetBuffer() {}
void OnActorDestroy();
protected:
/**
* Should be implemented by the backend-specific DeprecatedTextureHost classes

View File

@ -119,6 +119,16 @@ public:
mCompositor = aCompositor;
}
void OnActorDestroy()
{
Iterator end = TilesEnd();
for (Iterator it = TilesBegin(); it != end; ++it) {
if (it->mDeprecatedTextureHost) {
it->mDeprecatedTextureHost->OnActorDestroy();
}
}
}
protected:
TiledTexture ValidateTile(TiledTexture aTile,
const nsIntPoint& aTileRect,
@ -239,6 +249,12 @@ public:
Compositor* aCompositor,
AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE
{
mVideoMemoryTiledBuffer.OnActorDestroy();
mLowPrecisionVideoMemoryTiledBuffer.OnActorDestroy();
}
#ifdef MOZ_DUMP_PAINTING
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",

View File

@ -112,6 +112,13 @@ ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfxIntSize& aSize,
return true;
}
/* static */ bool
ISurfaceAllocator::IsShmem(SurfaceDescriptor* aSurface)
{
return aSurface && (aSurface->type() == SurfaceDescriptor::TShmem ||
aSurface->type() == SurfaceDescriptor::TYCbCrImage ||
aSurface->type() == SurfaceDescriptor::TRGBImage);
}
void
ISurfaceAllocator::DestroySharedSurface(SurfaceDescriptor* aSurface)

View File

@ -123,6 +123,10 @@ ISurfaceAllocator() {}
{
return nullptr;
}
// Returns true if aSurface wraps a Shmem.
static bool IsShmem(SurfaceDescriptor* aSurface);
protected:
// this method is needed for a temporary fix, will be removed after
// DeprecatedTextureClient/Host rework.

View File

@ -386,9 +386,6 @@ ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfxIntSize& aSize,
if (strcmp("crespo",propValue) == 0) {
NS_WARNING("Nexus S has issues with gralloc, falling back to shmem");
disableGralloc = true;
} else if (strcmp("peak", propValue) == 0) {
NS_WARNING("Geeksphone Peak has issues with gralloc, falling back to shmem");
disableGralloc = true;
}
checkedDevice = true;

View File

@ -300,10 +300,8 @@ SharedTextureSourceOGL::SharedTextureSourceOGL(CompositorOGL* aCompositor,
GLenum aTarget,
GLenum aWrapMode,
SharedTextureShareType aShareType,
gfx::IntSize aSize,
const gfx3DMatrix& aTexTransform)
: mTextureTransform(aTexTransform)
, mSize(aSize)
gfx::IntSize aSize)
: mSize(aSize)
, mCompositor(aCompositor)
, mSharedHandle(aHandle)
, mFormat(aFormat)
@ -357,6 +355,18 @@ SharedTextureSourceOGL::gl() const
return mCompositor ? mCompositor->gl() : nullptr;
}
gfx3DMatrix
SharedTextureSourceOGL::GetTextureTransform()
{
GLContext::SharedHandleDetails handleDetails;
if (!gl()->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
NS_WARNING("Could not get shared handle details");
return gfx3DMatrix();
}
return handleDetails.mTextureTransform;
}
SharedTextureHostOGL::SharedTextureHostOGL(uint64_t aID,
TextureFlags aFlags,
gl::SharedTextureShareType aShareType,
@ -406,8 +416,7 @@ SharedTextureHostOGL::Lock()
handleDetails.mTarget,
wrapMode,
mShareType,
mSize,
handleDetails.mTextureTransform);
mSize);
}
return true;
}

View File

@ -251,8 +251,7 @@ public:
GLenum aTarget,
GLenum aWrapMode,
SharedTextureShareType aShareType,
gfx::IntSize aSize,
const gfx3DMatrix& aTexTransform);
gfx::IntSize aSize);
virtual TextureSourceOGL* AsSourceOGL() { return this; }
@ -264,7 +263,7 @@ public:
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
virtual gfx3DMatrix GetTextureTransform() MOZ_OVERRIDE { return mTextureTransform; }
virtual gfx3DMatrix GetTextureTransform() MOZ_OVERRIDE;
virtual GLenum GetTextureTarget() const { return mTextureTarget; }
@ -282,7 +281,6 @@ public:
gl::GLContext* gl() const;
protected:
gfx3DMatrix mTextureTransform;
gfx::IntSize mSize;
CompositorOGL* mCompositor;
gl::SharedTextureHandle mSharedHandle;

View File

@ -260,6 +260,7 @@ static_assert(NS_ARRAY_LENGTH(eastAsianDefaults) ==
// NS_FONT_VARIANT_LIGATURES_xxx values
const gfxFontFeature ligDefaults[] = {
{ TRUETYPE_TAG('l','i','g','a'), 0 }, // none value means all off
{ TRUETYPE_TAG('l','i','g','a'), 1 },
{ TRUETYPE_TAG('l','i','g','a'), 0 },
{ TRUETYPE_TAG('d','l','i','g'), 1 },
@ -386,19 +387,31 @@ void nsFont::AddFontFeaturesToStyle(gfxFontStyle *aStyle) const
// -- ligatures
if (variantLigatures) {
AddFontFeaturesBitmask(variantLigatures,
NS_FONT_VARIANT_LIGATURES_COMMON,
NS_FONT_VARIANT_LIGATURES_NONE,
NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL,
ligDefaults, aStyle->featureSettings);
// special case common ligs, which also enable/disable clig
if (variantLigatures & NS_FONT_VARIANT_LIGATURES_COMMON) {
// liga already enabled, need to enable clig also
setting.mTag = TRUETYPE_TAG('c','l','i','g');
setting.mValue = 1;
aStyle->featureSettings.AppendElement(setting);
} else if (variantLigatures & NS_FONT_VARIANT_LIGATURES_NO_COMMON) {
// liga already disabled, need to disable clig also
setting.mTag = TRUETYPE_TAG('c','l','i','g');
setting.mValue = 0;
aStyle->featureSettings.AppendElement(setting);
} else if (variantLigatures & NS_FONT_VARIANT_LIGATURES_NONE) {
// liga already disabled, need to disable dlig, hlig, calt, clig
setting.mValue = 0;
setting.mTag = TRUETYPE_TAG('d','l','i','g');
aStyle->featureSettings.AppendElement(setting);
setting.mTag = TRUETYPE_TAG('h','l','i','g');
aStyle->featureSettings.AppendElement(setting);
setting.mTag = TRUETYPE_TAG('c','a','l','t');
aStyle->featureSettings.AppendElement(setting);
setting.mTag = TRUETYPE_TAG('c','l','i','g');
aStyle->featureSettings.AppendElement(setting);
}
}

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