This commit is contained in:
Ryan VanderMeulen 2013-11-19 13:21:57 -05:00
Родитель adb5a5be9d 4d640a0d2f
Коммит 6eb7c563bb
193 изменённых файлов: 2298 добавлений и 2411 удалений

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

@ -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)

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

@ -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;
}

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

@ -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

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

@ -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;

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

@ -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,

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

@ -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:

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

@ -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:

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

@ -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 = []

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

@ -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);],

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

@ -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

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

@ -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

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

@ -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,

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

@ -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,

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

@ -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,

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

@ -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)
{

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

@ -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]

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

@ -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>

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

@ -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

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

@ -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

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

@ -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);
}

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

@ -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

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

@ -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>

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

@ -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();

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

@ -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,

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

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

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

@ -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,

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

@ -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,

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

@ -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;
}

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

@ -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:

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

@ -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();
}

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

@ -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,

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

@ -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

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

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

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

@ -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);

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

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

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

@ -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]

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

@ -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>

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

@ -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!");

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

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

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

@ -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;
};

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

@ -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

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

@ -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()) {

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

@ -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;
}

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

@ -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]

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

@ -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',
]

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

@ -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)

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

@ -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',

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

@ -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

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

@ -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;
}

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

@ -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

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

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

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

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

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

@ -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;

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

@ -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',

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

@ -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"

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

@ -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'):

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

@ -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

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

@ -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 */

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

@ -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>

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

@ -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();
}
}
}
}

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

@ -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;
};

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

@ -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

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

@ -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
{

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

@ -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)

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

@ -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{

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

@ -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)
{

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

@ -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;

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

@ -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)

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

@ -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);

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

@ -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;

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

@ -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);
}
}

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

@ -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;

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

@ -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,

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

@ -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="",

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

@ -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

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

@ -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;

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

@ -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

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

@ -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="",

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

@ -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)

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

@ -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.

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

@ -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;

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

@ -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;
}

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

@ -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;

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

@ -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);
}
}

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

@ -56,10 +56,10 @@ struct NS_GFX nsFont {
// Variant subproperties
// (currently -moz- versions, will replace variant above eventually)
uint8_t variantCaps;
uint8_t variantLigatures;
uint8_t variantNumeric;
uint8_t variantPosition;
uint16_t variantLigatures;
uint16_t variantEastAsian;
// Some font-variant-alternates property values require

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -19,122 +19,144 @@
class nsIntRegion;
/**
* Implementation of regions.
* A region is represented as circular double-linked list of nsRegion::RgnRect structures.
* Rectangles in this list do not overlap and are sorted by (y, x) coordinates.
#include "pixman.h"
/* For information on the internal representation look at pixman-region.c
*
* nsRegions use nscoord coordinates and nsRects.
* This replaces an older homebrew implementation of nsRegion. The
* representation used here may use more rectangles than nsRegion however, the
* representation is canonical. This means that there's no need for an
* Optimize() method because for a paticular region there is only one
* representation. This means that nsIntRegion will have more predictable
* performance characteristics than the old nsRegion and should not become
* degenerate.
*
* The pixman region code originates from X11 which has spread to a variety of
* projects including Qt, Gtk, Wine. It should perform reasonably well.
*/
class NS_GFX nsRegion
class nsRegionRectIterator;
class nsRegion
{
friend class nsRegionRectIterator;
friend class RgnRectMemoryAllocator;
// Special version of nsRect structure for speed optimizations in nsRegion code.
// Most important functions could be made inline and be sure that passed rectangles
// will always be non-empty.
//
// Do not add any new member variables to this structure!
// Otherwise it will break casts from nsRect to nsRectFast, which expect data parts to be identical.
struct nsRectFast : public nsRect
{
nsRectFast () {} // No need to call parent constructor to set default values
nsRectFast (int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight) : nsRect (aX, aY, aWidth, aHeight) {}
nsRectFast (const nsRect& aRect) : nsRect (aRect) {}
// Override nsRect methods to make them inline. Do not check for emptiness.
inline bool Contains (const nsRect& aRect) const;
inline bool Intersects (const nsRect& aRect) const;
inline bool IntersectRect (const nsRect& aRect1, const nsRect& aRect2);
inline void UnionRect (const nsRect& aRect1, const nsRect& aRect2);
};
struct RgnRect : public nsRectFast
{
RgnRect* prev;
RgnRect* next;
RgnRect () {} // No need to call parent constructor to set default values
RgnRect (int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight) : nsRectFast (aX, aY, aWidth, aHeight) {}
RgnRect (const nsRectFast& aRect) : nsRectFast (aRect) {}
void* operator new (size_t) CPP_THROW_NEW;
void operator delete (void* aRect, size_t);
RgnRect& operator = (const RgnRect& aRect) // Do not overwrite prev/next pointers
{
x = aRect.x;
y = aRect.y;
width = aRect.width;
height = aRect.height;
return *this;
}
};
public:
nsRegion () { Init (); }
nsRegion (const nsRect& aRect) { Init (); Copy (aRect); }
nsRegion (const nsRegion& aRegion) { Init (); Copy (aRegion); }
~nsRegion () { SetToElements (0); }
nsRegion () { pixman_region32_init(&mImpl); }
nsRegion (const nsRect& aRect) { pixman_region32_init_rect(&mImpl,
aRect.x,
aRect.y,
aRect.width,
aRect.height); }
nsRegion (const nsRegion& aRegion) { pixman_region32_init(&mImpl); pixman_region32_copy(&mImpl,aRegion.Impl()); }
~nsRegion () { pixman_region32_fini(&mImpl); }
nsRegion& operator = (const nsRect& aRect) { Copy (aRect); return *this; }
nsRegion& operator = (const nsRegion& aRegion) { Copy (aRegion); return *this; }
nsRegion& And (const nsRegion& aRgn1, const nsRegion& aRgn2);
nsRegion& And (const nsRegion& aRegion, const nsRect& aRect);
nsRegion& And (const nsRect& aRect, const nsRegion& aRegion)
bool operator==(const nsRegion& aRgn) const
{
return And (aRegion, aRect);
return IsEqual(aRgn);
}
nsRegion& And (const nsRect& aRect1, const nsRect& aRect2)
static
nsresult InitStatic()
{
return NS_OK;
}
static
void ShutdownStatic() {}
nsRegion& And(const nsRegion& aRgn1, const nsRegion& aRgn2)
{
pixman_region32_intersect(&mImpl, aRgn1.Impl(), aRgn2.Impl());
return *this;
}
nsRegion& And(const nsRect& aRect, const nsRegion& aRegion)
{
return And(aRegion, aRect);
}
nsRegion& And(const nsRegion& aRegion, const nsRect& aRect)
{
pixman_region32_intersect_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.width, aRect.height);
return *this;
}
nsRegion& And(const nsRect& aRect1, const nsRect& aRect2)
{
nsRect TmpRect;
TmpRect.IntersectRect (aRect1, aRect2);
return Copy (TmpRect);
TmpRect.IntersectRect(aRect1, aRect2);
return Copy(TmpRect);
}
nsRegion& Or (const nsRegion& aRgn1, const nsRegion& aRgn2);
nsRegion& Or (const nsRegion& aRegion, const nsRect& aRect);
nsRegion& Or (const nsRect& aRect, const nsRegion& aRegion)
nsRegion& Or(const nsRegion& aRgn1, const nsRegion& aRgn2)
{
return Or (aRegion, aRect);
pixman_region32_union(&mImpl, aRgn1.Impl(), aRgn2.Impl());
return *this;
}
nsRegion& Or (const nsRect& aRect1, const nsRect& aRect2)
nsRegion& Or(const nsRegion& aRegion, const nsRect& aRect)
{
pixman_region32_union_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.width, aRect.height);
return *this;
}
nsRegion& Or(const nsRect& aRect, const nsRegion& aRegion)
{
return Or(aRegion, aRect);
}
nsRegion& Or(const nsRect& aRect1, const nsRect& aRect2)
{
Copy (aRect1);
return Or (*this, aRect2);
}
nsRegion& Xor (const nsRegion& aRgn1, const nsRegion& aRgn2);
nsRegion& Xor (const nsRegion& aRegion, const nsRect& aRect);
nsRegion& Xor (const nsRect& aRect, const nsRegion& aRegion)
nsRegion& Xor(const nsRegion& aRgn1, const nsRegion& aRgn2)
{
return Xor (aRegion, aRect);
// this could be implemented better if pixman had direct
// support for xoring regions.
nsRegion p;
p.Sub(aRgn1, aRgn2);
nsRegion q;
q.Sub(aRgn2, aRgn1);
return Or(p, q);
}
nsRegion& Xor (const nsRect& aRect1, const nsRect& aRect2)
nsRegion& Xor(const nsRegion& aRegion, const nsRect& aRect)
{
Copy (aRect1);
return Xor (*this, aRect2);
return Xor(aRegion, nsRegion(aRect));
}
nsRegion& Xor(const nsRect& aRect, const nsRegion& aRegion)
{
return Xor(nsRegion(aRect), aRegion);
}
nsRegion& Xor(const nsRect& aRect1, const nsRect& aRect2)
{
return Xor(nsRegion(aRect1), nsRegion(aRect2));
}
nsRegion& Sub (const nsRegion& aRgn1, const nsRegion& aRgn2);
nsRegion& Sub (const nsRegion& aRegion, const nsRect& aRect);
nsRegion& Sub (const nsRect& aRect, const nsRegion& aRegion)
nsRegion ToAppUnits (nscoord aAppUnitsPerPixel) const;
nsRegion& Sub(const nsRegion& aRgn1, const nsRegion& aRgn2)
{
return Sub (nsRegion (aRect), aRegion);
pixman_region32_subtract(&mImpl, aRgn1.Impl(), aRgn2.Impl());
return *this;
}
nsRegion& Sub (const nsRect& aRect1, const nsRect& aRect2)
nsRegion& Sub(const nsRegion& aRegion, const nsRect& aRect)
{
Copy (aRect1);
return Sub (*this, aRect2);
return Sub(aRegion, nsRegion(aRect));
}
nsRegion& Sub(const nsRect& aRect, const nsRegion& aRegion)
{
return Sub(nsRegion(aRect), aRegion);
}
nsRegion& Sub(const nsRect& aRect1, const nsRect& aRect2)
{
Copy(aRect1);
return Sub(*this, aRect2);
}
bool Contains (const nsRect& aRect) const;
bool Contains (const nsRect& aRect) const
{
pixman_box32_t box = RectToBox(aRect);
return pixman_region32_contains_rectangle(Impl(), &box) == PIXMAN_REGION_IN;
}
bool Contains (const nsRegion& aRgn) const;
bool Intersects (const nsRect& aRect) const;
@ -142,18 +164,20 @@ public:
{
MoveBy (nsPoint (aXOffset, aYOffset));
}
void MoveBy (nsPoint aPt);
void MoveBy (nsPoint aPt) { pixman_region32_translate(&mImpl, aPt.x, aPt.y); }
void SetEmpty ()
{
SetToElements (0);
mBoundRect.SetRect (0, 0, 0, 0);
pixman_region32_clear(&mImpl);
}
bool IsEmpty () const { return mRectCount == 0; }
bool IsComplex () const { return mRectCount > 1; }
bool IsEqual (const nsRegion& aRegion) const;
uint32_t GetNumRects () const { return mRectCount; }
const nsRect& GetBounds () const { return mBoundRect; }
bool IsEmpty () const { return !pixman_region32_not_empty(Impl()); }
bool IsComplex () const { return GetNumRects() > 1; }
bool IsEqual (const nsRegion& aRegion) const
{
return pixman_region32_equal(Impl(), aRegion.Impl());
}
uint32_t GetNumRects () const { return pixman_region32_n_rects(Impl()); }
const nsRect GetBounds () const { return BoxToRect(mImpl.extents); }
uint64_t Area () const;
// Converts this region from aFromAPP, an appunits per pixel ratio, to
// aToAPP. This applies nsRect::ConvertAppUnitsRoundOut/In to each rect of
@ -189,95 +213,91 @@ public:
* original region.
*/
void SimplifyInward (uint32_t aMaxRects);
/**
* Efficiently try to remove a rectangle from this region. The actual
* area removed could be some sub-area contained by the rectangle
* (even possibly nothing at all).
*
* We remove all rectangles that are contained by aRect.
*/
void SimpleSubtract (const nsRect& aRect);
/**
* Efficiently try to remove a region from this region. The actual
* area removed could be some sub-area contained by aRegion
* (even possibly nothing at all).
*
* We remove all rectangles of this region that are contained by
* a rectangle of aRegion.
*/
void SimpleSubtract (const nsRegion& aRegion);
nsCString ToString() const;
/**
* Initialize any static data associated with nsRegion.
*/
static nsresult InitStatic();
/**
* Deinitialize static data.
*/
static void ShutdownStatic();
private:
uint32_t mRectCount;
RgnRect* mCurRect;
RgnRect mRectListHead;
nsRectFast mBoundRect;
pixman_region32_t mImpl;
void Init ();
nsRegion& Copy (const nsRegion& aRegion);
nsRegion& Copy (const nsRect& aRect);
void InsertBefore (RgnRect* aNewRect, RgnRect* aRelativeRect);
void InsertAfter (RgnRect* aNewRect, RgnRect* aRelativeRect);
void SetToElements (uint32_t aCount);
RgnRect* Remove (RgnRect* aRect);
void InsertInPlace (RgnRect* aRect, bool aOptimizeOnFly = false);
inline void SaveLinkChain ();
inline void RestoreLinkChain ();
void Optimize ();
void SubRegion (const nsRegion& aRegion, nsRegion& aResult) const;
void SubRect (const nsRectFast& aRect, nsRegion& aResult, nsRegion& aCompleted) const;
void SubRect (const nsRectFast& aRect, nsRegion& aResult) const
{ SubRect (aRect, aResult, aResult); }
void Merge (const nsRegion& aRgn1, const nsRegion& aRgn2);
void MoveInto (nsRegion& aDestRegion, const RgnRect* aStartRect);
void MoveInto (nsRegion& aDestRegion)
{ MoveInto (aDestRegion, mRectListHead.next); }
nsIntRegion ToPixels(nscoord aAppUnitsPerPixel, bool aOutsidePixels) const;
nsRegion& Copy (const nsRegion& aRegion)
{
pixman_region32_copy(&mImpl, aRegion.Impl());
return *this;
}
nsRegion& Copy (const nsRect& aRect)
{
pixman_box32_t box = RectToBox(aRect);
pixman_region32_reset(&mImpl, &box);
return *this;
}
static inline pixman_box32_t RectToBox(const nsRect &aRect)
{
pixman_box32_t box = { aRect.x, aRect.y, aRect.XMost(), aRect.YMost() };
return box;
}
static inline pixman_box32_t RectToBox(const nsIntRect &aRect)
{
pixman_box32_t box = { aRect.x, aRect.y, aRect.XMost(), aRect.YMost() };
return box;
}
static inline nsRect BoxToRect(const pixman_box32_t &aBox)
{
return nsRect(aBox.x1, aBox.y1,
aBox.x2 - aBox.x1,
aBox.y2 - aBox.y1);
}
pixman_region32_t* Impl() const
{
return const_cast<pixman_region32_t*>(&mImpl);
}
};
// Allow read-only access to region rectangles by iterating the list
class NS_GFX nsRegionRectIterator
{
const nsRegion* mRegion;
const nsRegion::RgnRect* mCurPtr;
int i;
int n;
nsRect rect;
pixman_box32_t *boxes;
public:
nsRegionRectIterator (const nsRegion& aRegion)
{
mRegion = &aRegion;
mCurPtr = &aRegion.mRectListHead;
i = 0;
boxes = pixman_region32_rectangles(aRegion.Impl(), &n);
}
const nsRect* Next ()
{
mCurPtr = mCurPtr->next;
return (mCurPtr != &mRegion->mRectListHead) ? mCurPtr : nullptr;
if (i == n)
return nullptr;
rect = nsRegion::BoxToRect(boxes[i]);
i++;
return &rect;
}
const nsRect* Prev ()
{
mCurPtr = mCurPtr->prev;
return (mCurPtr != &mRegion->mRectListHead) ? mCurPtr : nullptr;
if (i == -1)
return nullptr;
rect = nsRegion::BoxToRect(boxes[i]);
i--;
return &rect;
}
void Reset ()
{
mCurPtr = &mRegion->mRectListHead;
i = 0;
}
};
@ -287,6 +307,7 @@ public:
class NS_GFX nsIntRegion
{
friend class nsIntRegionRectIterator;
friend class nsRegion;
public:
nsIntRegion () {}
@ -449,29 +470,6 @@ public:
{
mImpl.SimplifyInward (aMaxRects);
}
/**
* Efficiently try to remove a rectangle from this region. The actual
* area removed could be some sub-area contained by the rectangle
* (even possibly nothing at all).
*
* We remove all rectangles that are contained by aRect.
*/
void SimpleSubtract (const nsIntRect& aRect)
{
mImpl.SimpleSubtract (ToRect (aRect));
}
/**
* Efficiently try to remove a region from this region. The actual
* area removed could be some sub-area contained by aRegion
* (even possibly nothing at all).
*
* We remove all rectangles of this region that are contained by
* a rectangle of aRegion.
*/
void SimpleSubtract (const nsIntRegion& aRegion)
{
mImpl.SimpleSubtract (aRegion.mImpl);
}
nsCString ToString() const { return mImpl.ToString(); }
@ -519,5 +517,4 @@ public:
mImpl.Reset ();
}
};
#endif

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

@ -124,3 +124,50 @@ TEST(Gfx, RegionTestContainsSpecifiedOverflowingRect) {
TestLargestRegion::TestContainsSpecifiedOverflowingRect();
}
TEST(Gfx, RegionScaleToInside) {
{ // no rectangles
nsRegion r;
nsIntRegion scaled = r.ScaleToInsidePixels(1, 1, 60);
nsIntRegion result;
EXPECT_TRUE(result.IsEqual(scaled)) <<
"scaled result incorrect";
}
{ // one rectangle
nsRegion r(nsRect(0,44760,19096,264));
nsIntRegion scaled = r.ScaleToInsidePixels(1, 1, 60);
nsIntRegion result(nsIntRect(0,746,318,4));
EXPECT_TRUE(result.IsEqual(scaled)) <<
"scaled result incorrect";
}
{ // the first rectangle gets adjusted
nsRegion r(nsRect(0,44760,19096,264));
r.Or(r, nsRect(0,45024,19360,1056));
nsIntRegion scaled = r.ScaleToInsidePixels(1, 1, 60);
nsIntRegion result(nsIntRect(0,746,318,5));
result.Or(result, nsIntRect(0,751,322,17));
EXPECT_TRUE(result.IsEqual(scaled)) <<
"scaled result incorrect";
}
{ // the second rectangle gets adjusted
nsRegion r(nsRect(0,44760,19360,264));
r.Or(r, nsRect(0,45024,19096,1056));
nsIntRegion scaled = r.ScaleToInsidePixels(1, 1, 60);
nsIntRegion result(nsIntRect(0,746,322,4));
result.Or(result, nsIntRect(0,750,318,18));
EXPECT_TRUE(result.IsEqual(scaled)) <<
"scaled result incorrect";
}
}

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

@ -119,6 +119,7 @@ enum {
NS_FONT_VARIANT_EAST_ASIAN_PROP_WIDTH )
enum {
eFeatureLigatures_none,
eFeatureLigatures_common,
eFeatureLigatures_no_common,
eFeatureLigatures_discretionary,
@ -131,6 +132,7 @@ enum {
eFeatureLigatures_numFeatures
};
#define NS_FONT_VARIANT_LIGATURES_NONE (1 << eFeatureLigatures_none)
#define NS_FONT_VARIANT_LIGATURES_COMMON (1 << eFeatureLigatures_common)
#define NS_FONT_VARIANT_LIGATURES_NO_COMMON (1 << eFeatureLigatures_no_common)
#define NS_FONT_VARIANT_LIGATURES_DISCRETIONARY (1 << eFeatureLigatures_discretionary)

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

@ -23,7 +23,7 @@ if toolkit == 'cocoa':
elif toolkit == 'android':
DIRS += ['icon/android', 'icon']
SOURCES += [
UNIFIED_SOURCES += [
'EXIF.cpp',
'nsBMPDecoder.cpp',
'nsGIFDecoder2.cpp',

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

@ -35,7 +35,7 @@ else:
else:
os_linux = 1
SOURCES += [
UNIFIED_SOURCES += [
'src/base/at_exit.cc',
'src/base/base_paths.cc',
'src/base/base_switches.cc',
@ -179,7 +179,7 @@ if os_posix:
]
if os_macosx:
SOURCES += [
UNIFIED_SOURCES += [
'src/base/debug_util_mac.cc',
'src/base/hmac_mac.cc',
'src/base/idle_timer.cc',
@ -204,7 +204,7 @@ if os_macosx:
'src/chrome/common/mach_ipc_mac.mm',
]
if not CONFIG['MOZ_NATIVE_LIBEVENT']:
SOURCES += [
UNIFIED_SOURCES += [
'src/third_party/libevent/kqueue.c',
]

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

@ -373,9 +373,10 @@ XPCShellEnvironment::ProcessFile(JSContext *cx,
/* Clear any pending exception from previous failed compiles. */
JS_ClearPendingException(cx);
script =
JS_CompileScriptForPrincipals(cx, obj, env->GetPrincipal(), buffer,
strlen(buffer), "typein", startline);
JS::CompileOptions options(cx);
options.setFileAndLine("typein", startline)
.setPrincipals(env->GetPrincipal());
script = JS_CompileScript(cx, obj, buffer, strlen(buffer), options);
if (script) {
JSErrorReporter older;
@ -583,10 +584,11 @@ XPCShellEnvironment::EvaluateString(const nsString& aString,
JS::Rooted<JSObject*> global(cx, GetGlobalObject());
JSAutoCompartment ac(cx, global);
JSScript* script =
JS_CompileUCScriptForPrincipals(cx, global, GetPrincipal(),
aString.get(), aString.Length(),
"typein", 0);
JS::CompileOptions options(cx);
options.setFileAndLine("typein", 0)
.setPrincipals(GetPrincipal());
JSScript* script = JS_CompileUCScript(cx, global, aString.get(),
aString.Length(), options);
if (!script) {
return false;
}

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

@ -1009,8 +1009,10 @@ jsdScript::CreatePPLineMap()
"arg5", "arg6", "arg7", "arg8",
"arg9", "arg10", "arg11", "arg12"
};
JS::CompileOptions options(cx);
options.setFileAndLine("x-jsd:ppbuffer?type=function", 3);
fun = JS_CompileUCFunction (cx, obj, "ppfun", nargs, argnames, chars,
length, "x-jsd:ppbuffer?type=function", 3);
length, options);
if (!fun || !(script = JS_GetFunctionScript(cx, fun)))
return nullptr;
baseLine = 3;
@ -1030,7 +1032,9 @@ jsdScript::CreatePPLineMap()
}
JS::Anchor<JSString *> kungFuDeathGrip(jsstr);
script = JS_CompileUCScript (cx, obj, chars, length, "x-jsd:ppbuffer?type=script", 1);
JS::CompileOptions options(cx);
options.setFileAndLine("x-jsd:ppbuffer?type=script", 1);
script = JS_CompileUCScript(cx, obj, chars, length, options);
if (!script)
return nullptr;
baseLine = 1;
@ -1647,7 +1651,6 @@ jsdContext::GetJSContext(JSContext **_rval)
#define JSOPTION_WERROR JS_BIT(1)
#define JSOPTION_VAROBJFIX JS_BIT(2)
#define JSOPTION_PRIVATE_IS_NSISUPPORTS JS_BIT(3)
#define JSOPTION_COMPILE_N_GO JS_BIT(4)
#define JSOPTION_DONT_REPORT_UNCAUGHT JS_BIT(8)
#define JSOPTION_NO_DEFAULT_COMPARTMENT_OBJECT JS_BIT(11)
#define JSOPTION_NO_SCRIPT_RVAL JS_BIT(12)
@ -1666,7 +1669,6 @@ jsdContext::GetOptions(uint32_t *_rval)
| (JS::ContextOptionsRef(mJSCx).werror() ? JSOPTION_WERROR : 0)
| (JS::ContextOptionsRef(mJSCx).varObjFix() ? JSOPTION_VAROBJFIX : 0)
| (JS::ContextOptionsRef(mJSCx).privateIsNSISupports() ? JSOPTION_PRIVATE_IS_NSISUPPORTS : 0)
| (JS::ContextOptionsRef(mJSCx).compileAndGo() ? JSOPTION_COMPILE_N_GO : 0)
| (JS::ContextOptionsRef(mJSCx).dontReportUncaught() ? JSOPTION_DONT_REPORT_UNCAUGHT : 0)
| (JS::ContextOptionsRef(mJSCx).noDefaultCompartmentObject() ? JSOPTION_NO_DEFAULT_COMPARTMENT_OBJECT : 0)
| (JS::ContextOptionsRef(mJSCx).noScriptRval() ? JSOPTION_NO_SCRIPT_RVAL : 0)
@ -1692,7 +1694,6 @@ jsdContext::SetOptions(uint32_t options)
JS::ContextOptionsRef(mJSCx).setExtraWarnings(options & JSOPTION_EXTRA_WARNINGS)
.setWerror(options & JSOPTION_WERROR)
.setVarObjFix(options & JSOPTION_VAROBJFIX)
.setCompileAndGo(options & JSOPTION_COMPILE_N_GO)
.setDontReportUncaught(options & JSOPTION_DONT_REPORT_UNCAUGHT)
.setNoDefaultCompartmentObject(options & JSOPTION_NO_DEFAULT_COMPARTMENT_OBJECT)
.setNoScriptRval(options & JSOPTION_NO_SCRIPT_RVAL)

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

@ -285,7 +285,7 @@ GCParameter(JSContext *cx, unsigned argc, Value *vp)
for (;; paramIndex++) {
if (paramIndex == ArrayLength(paramMap)) {
JS_ReportError(cx,
"the first argument argument must be maxBytes, "
"the first argument must be maxBytes, "
"maxMallocBytes, gcStackpoolLifespan, gcBytes or "
"gcNumber");
return false;
@ -363,8 +363,8 @@ InternalConst(JSContext *cx, unsigned argc, jsval *vp)
if (!flat)
return false;
if (JS_FlatStringEqualsAscii(flat, "MARK_STACK_LENGTH")) {
vp[0] = UINT_TO_JSVAL(js::MARK_STACK_LENGTH);
if (JS_FlatStringEqualsAscii(flat, "INCREMENTAL_MARK_STACK_BASE_CAPACITY")) {
vp[0] = UINT_TO_JSVAL(js::INCREMENTAL_MARK_STACK_BASE_CAPACITY);
} else {
JS_ReportError(cx, "unknown const name");
return false;

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

@ -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 = []

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

@ -2554,6 +2554,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);],

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

@ -1270,7 +1270,7 @@ struct SlotArrayLayout
void
GCMarker::saveValueRanges()
{
for (uintptr_t *p = stack.tos; p > stack.stack; ) {
for (uintptr_t *p = stack.tos_; p > stack.stack_; ) {
uintptr_t tag = *--p & StackTagMask;
if (tag == ValueArrayTag) {
*p &= ~StackTagMask;
@ -1474,7 +1474,7 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
/* Call the trace hook if necessary. */
const Class *clasp = type->clasp;
if (clasp->trace) {
JS_ASSERT_IF(runtime->gcMode == JSGC_MODE_INCREMENTAL &&
JS_ASSERT_IF(runtime->gcMode() == JSGC_MODE_INCREMENTAL &&
runtime->gcIncrementalEnabled,
clasp->flags & JSCLASS_IMPLEMENTS_BARRIERS);
clasp->trace(this, obj);

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

@ -5,7 +5,7 @@ function build_getter(i) {
function test()
{
var N = internalConst("MARK_STACK_LENGTH") + 2;
var N = internalConst("INCREMENTAL_MARK_STACK_BASE_CAPACITY") + 2;
var o = {};
var descriptor = { enumerable: true};
for (var i = 0; i != N; ++i) {

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

@ -8,9 +8,11 @@ dbg.onDebuggerStatement = function (frame) {
assertEq(typeof frame.script.url, 'string');
};
function test(f) {
function test(f, manualCount) {
start = count = g.first = g.last = undefined;
f();
if (manualCount)
g.last = g.first + manualCount - 1;
assertEq(start, g.first);
assertEq(count, g.last + 1 - g.first);
print(start, count);
@ -41,3 +43,19 @@ g.eval("function f2() {\n" +
"}\n");
test(g.f2);
test(g.f2);
// Having a last = Error().lineNumber forces a setline srcnote, so test a
// function that ends with newline srcnotes.
g.eval("/* Any copyright is dedicated to the Public Domain.\n" +
" http://creativecommons.org/publicdomain/zero/1.0/ */\n" +
"\n" +
"function secondCall() { first = Error().lineNumber;\n" +
" debugger;\n" +
" // Comment\n" +
" eval(\"42;\");\n" +
" function foo() {}\n" +
" if (true) {\n" +
" foo();\n" + // <- this is +6 and must be within the extent
" }\n" +
"}");
test(g.secondCall, 7);

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

@ -64,9 +64,11 @@ BEGIN_TEST(testChromeBuffer)
const char *paramName = "x";
const char *bytes = "return x ? 1 + trusted(x-1) : 0";
JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&trusted_glob);
CHECK(fun = JS_CompileFunctionForPrincipals(cx, global, &system_principals,
"trusted", 1, &paramName, bytes, strlen(bytes),
"", 0));
JS::CompileOptions options(cx);
options.setFileAndLine("", 0)
.setPrincipals(&system_principals);
CHECK(fun = JS_CompileFunction(cx, global, "trusted", 1, &paramName,
bytes, strlen(bytes), options));
trusted_fun = JS_GetFunctionObject(fun);
if (!JS_AddNamedObjectRoot(cx, &trusted_fun, "trusted-function"))
return false;
@ -85,8 +87,10 @@ BEGIN_TEST(testChromeBuffer)
" return -1; "
" } "
"} ";
JS::CompileOptions options(cx);
options.setFileAndLine("", 0);
CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, &paramName,
bytes, strlen(bytes), "", 0));
bytes, strlen(bytes), options));
JS::RootedValue rval(cx);
CHECK(JS_CallFunction(cx, nullptr, fun, 1, v.address(), rval.address()));
@ -107,9 +111,11 @@ BEGIN_TEST(testChromeBuffer)
" return 'From trusted: ' + e; "
"} ";
JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&trusted_glob);
CHECK(fun = JS_CompileFunctionForPrincipals(cx, global, &system_principals,
"trusted", 1, &paramName, bytes, strlen(bytes),
"", 0));
JS::CompileOptions options(cx);
options.setFileAndLine("", 0)
.setPrincipals(&system_principals);
CHECK(fun = JS_CompileFunction(cx, global, "trusted", 1, &paramName,
bytes, strlen(bytes), options));
trusted_fun = JS_GetFunctionObject(fun);
}
@ -122,8 +128,10 @@ BEGIN_TEST(testChromeBuffer)
"} catch (e) { "
" return trusted(untrusted); "
"} ";
JS::CompileOptions options(cx);
options.setFileAndLine("", 0);
CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, &paramName,
bytes, strlen(bytes), "", 0));
bytes, strlen(bytes), options));
JS::RootedValue rval(cx);
CHECK(JS_CallFunction(cx, nullptr, fun, 1, v.address(), rval.address()));
@ -141,9 +149,11 @@ BEGIN_TEST(testChromeBuffer)
JSAutoCompartment ac(cx, trusted_glob);
const char *bytes = "return 42";
JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&trusted_glob);
CHECK(fun = JS_CompileFunctionForPrincipals(cx, global, &system_principals,
"trusted", 0, nullptr,
bytes, strlen(bytes), "", 0));
JS::CompileOptions options(cx);
options.setFileAndLine("", 0)
.setPrincipals(&system_principals);
CHECK(fun = JS_CompileFunction(cx, global, "trusted", 0, nullptr,
bytes, strlen(bytes), options));
trusted_fun = JS_GetFunctionObject(fun);
}
@ -156,8 +166,10 @@ BEGIN_TEST(testChromeBuffer)
"} catch (e) { "
" return f(); "
"} ";
JS::CompileOptions options(cx);
options.setFileAndLine("", 0);
CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, &paramName,
bytes, strlen(bytes), "", 0));
bytes, strlen(bytes), options));
JS::RootedValue arg(cx, JS::ObjectValue(*callTrusted));
JS::RootedValue rval(cx);

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