Merge latest green birch changeset and mozilla-central

This commit is contained in:
Ed Morley 2013-07-15 13:01:56 +01:00
commit 1c0f321f75
155 changed files with 1597 additions and 1048 deletions

View File

@ -17,4 +17,4 @@
#
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 887463 - Remove webvtt parser.
Bug 870407 - move CMMSRCS to mozbuild

View File

@ -1035,14 +1035,10 @@ HyperTextAccessible::GetTextBeforeOffset(int32_t aOffset,
// If we are at last empty then home key and get the text (last empty line
// doesn't have own frame).
if (offset == CharacterCount()) {
nsAutoString lastChar;
GetText(offset -1, -1, lastChar);
if (lastChar.EqualsLiteral("\n")) {
*aStartOffset = FindLineBoundary(offset, eDirPrevious, eSelectBeginLine);
*aEndOffset = offset;
return GetText(*aStartOffset, *aEndOffset, aText);
}
if (IsEmptyLastLineOffset(offset)) {
*aStartOffset = FindLineBoundary(offset, eDirPrevious, eSelectBeginLine);
*aEndOffset = offset;
return GetText(*aStartOffset, *aEndOffset, aText);
}
// Home key, up arrow, home key.
@ -1053,7 +1049,35 @@ HyperTextAccessible::GetTextBeforeOffset(int32_t aOffset,
return GetText(*aStartOffset, *aEndOffset, aText);
}
case BOUNDARY_LINE_END:
case BOUNDARY_LINE_END: {
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
offset = AdjustCaretOffset(offset);
// Nothing if we are at first line.
int32_t tmpOffset = FindLineBoundary(offset, eDirPrevious, eSelectBeginLine);
if (tmpOffset == 0) {
*aStartOffset = *aEndOffset = 0;
return NS_OK;
}
// Up arrow, end key to find previous line endings.
if (IsEmptyLastLineOffset(offset)) { // no own frame for a last line
tmpOffset = FindLineBoundary(offset, eDirPrevious, eSelectLine);
*aStartOffset = FindLineBoundary(tmpOffset, eDirNext, eSelectEndLine);
*aEndOffset = offset - 1;
return GetText(*aStartOffset, *aEndOffset, aText);
}
tmpOffset = FindLineBoundary(offset, eDirPrevious, eSelectLine);
*aEndOffset = FindLineBoundary(tmpOffset, eDirNext, eSelectEndLine);
tmpOffset = FindLineBoundary(*aEndOffset, eDirPrevious, eSelectLine);
*aStartOffset = FindLineBoundary(tmpOffset, eDirNext, eSelectEndLine);
if (*aStartOffset == *aEndOffset) // we are at second line
*aStartOffset = 0;
return GetText(*aStartOffset, *aEndOffset, aText);
}
case BOUNDARY_ATTRIBUTE_RANGE:
return GetTextHelper(eGetBefore, aBoundaryType, aOffset,
aStartOffset, aEndOffset, aText);
@ -1098,13 +1122,9 @@ HyperTextAccessible::GetTextAtOffset(int32_t aOffset,
// Empty last line doesn't have own frame (a previous line contains '\n'
// character instead) thus we can't operate on last line separately
// from previous line.
if (offset == CharacterCount()) {
nsAutoString lastChar;
GetText(offset -1, -1, lastChar);
if (lastChar.EqualsLiteral("\n")) {
*aStartOffset = *aEndOffset = offset;
return NS_OK;
}
if (IsEmptyLastLineOffset(offset)) {
*aStartOffset = *aEndOffset = offset;
return NS_OK;
}
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
@ -1124,15 +1144,11 @@ HyperTextAccessible::GetTextAtOffset(int32_t aOffset,
// Empty last line doesn't have own frame (a previous line contains '\n'
// character instead) thus we can't operate on last line separately
// from the previous line.
if (offset == CharacterCount()) {
nsAutoString lastChar;
GetText(offset -1, -1, lastChar);
if (lastChar.EqualsLiteral("\n")) {
*aStartOffset = offset - 1;
*aEndOffset = offset;
aText = lastChar;
return NS_OK;
}
if (IsEmptyLastLineOffset(offset)) {
*aStartOffset = offset - 1;
*aEndOffset = offset;
aText.AssignLiteral("\n");
return NS_OK;
}
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)

View File

@ -283,6 +283,19 @@ protected:
return aOffset;
}
/**
* Return true if the given offset points to terminal empty line if any.
*/
bool IsEmptyLastLineOffset(int32_t aOffset)
{
if (aOffset != static_cast<int32_t>(CharacterCount()))
return false;
nsAutoString lastChar;
GetText(aOffset -1, -1, lastChar);
return lastChar.EqualsLiteral("\n");
}
/**
* Return an offset of the found word boundary.
*/

View File

@ -362,6 +362,8 @@ var Output = {
startOffset: 0,
endOffset: 0,
text: '',
selectionStart: 0,
selectionEnd: 0,
init: function init(aOutput) {
if (aOutput && 'output' in aOutput) {
@ -370,11 +372,20 @@ var Output = {
// We need to append a space at the end so that the routing key corresponding
// to the end of the output (i.e. the space) can be hit to move the caret there.
this.text = aOutput.output + ' ';
return this.text;
this.selectionStart = typeof aOutput.selectionStart === 'number' ?
aOutput.selectionStart : this.selectionStart;
this.selectionEnd = typeof aOutput.selectionEnd === 'number' ?
aOutput.selectionEnd : this.selectionEnd;
return { text: this.text,
selectionStart: this.selectionStart,
selectionEnd: this.selectionEnd };
}
return null;
},
update: function update(aText) {
adjustText: function adjustText(aText) {
let newBraille = [];
let braille = {};
@ -384,8 +395,7 @@ var Output = {
newBraille.push(prefix);
}
let newText = aText;
newBraille.push(newText);
newBraille.push(aText);
let suffix = this.text.substring(this.endOffset).trim();
if (suffix) {
@ -393,9 +403,23 @@ var Output = {
newBraille.push(suffix);
}
braille.startOffset = prefix.length;
braille.output = newBraille.join('');
braille.endOffset = braille.output.length - suffix.length;
this.startOffset = braille.startOffset = prefix.length;
this.text = braille.text = newBraille.join('') + ' ';
this.endOffset = braille.endOffset = braille.text.length - suffix.length;
braille.selectionStart = this.selectionStart;
braille.selectionEnd = this.selectionEnd;
return braille;
},
adjustSelection: function adjustSelection(aSelection) {
let braille = {};
braille.startOffset = this.startOffset;
braille.endOffset = this.endOffset;
braille.text = this.text;
this.selectionStart = braille.selectionStart = aSelection.selectionStart + this.startOffset;
this.selectionEnd = braille.selectionEnd = aSelection.selectionEnd + this.startOffset;
return braille;
}
@ -502,6 +526,7 @@ var Output = {
Android: function Android(aDetails, aBrowser) {
const ANDROID_VIEW_TEXT_CHANGED = 0x10;
const ANDROID_VIEW_TEXT_SELECTION_CHANGED = 0x2000;
if (!this._bridge)
this._bridge = Cc['@mozilla.org/android/bridge;1'].getService(Ci.nsIAndroidBridge);
@ -510,14 +535,18 @@ var Output = {
androidEvent.type = 'Accessibility:Event';
if (androidEvent.bounds)
androidEvent.bounds = this._adjustBounds(androidEvent.bounds, aBrowser, true);
if (androidEvent.eventType === ANDROID_VIEW_TEXT_CHANGED) {
androidEvent.brailleText = this.brailleState.update(androidEvent.text);
switch(androidEvent.eventType) {
case ANDROID_VIEW_TEXT_CHANGED:
androidEvent.brailleOutput = this.brailleState.adjustText(androidEvent.text);
break;
case ANDROID_VIEW_TEXT_SELECTION_CHANGED:
androidEvent.brailleOutput = this.brailleState.adjustSelection(androidEvent.brailleOutput);
break;
default:
androidEvent.brailleOutput = this.brailleState.init(androidEvent.brailleOutput);
break;
}
let (output = this.brailleState.init(androidEvent.brailleText)) {
if (typeof output === 'string') {
androidEvent.brailleText = output;
}
};
this._bridge.handleGeckoMessage(JSON.stringify(androidEvent));
}
},

View File

@ -212,6 +212,9 @@ this.EventManager.prototype = {
editState.atStart != this.editState.atStart)
this.sendMsgFunc("AccessFu:Input", editState);
this.present(Presentation.textSelectionChanged(acc.getText(0,-1),
caretOffset, caretOffset, 0, 0, aEvent.isFromUserInput));
this.editState = editState;
break;
}

View File

@ -61,7 +61,7 @@ Presenter.prototype = {
/**
* Text selection has changed. TODO.
*/
textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd) {},
textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd, aIsFromUser) {},
/**
* Selection has changed. TODO.
@ -234,12 +234,12 @@ AndroidPresenter.prototype = {
let state = Utils.getStates(aContext.accessible)[0];
let brailleText = '';
let brailleOutput = {};
if (Utils.AndroidSdkVersion >= 16) {
if (!this._braillePresenter) {
this._braillePresenter = new BraillePresenter();
}
brailleText = this._braillePresenter.pivotChanged(aContext, aReason).
brailleOutput = this._braillePresenter.pivotChanged(aContext, aReason).
details;
}
@ -252,7 +252,7 @@ AndroidPresenter.prototype = {
Ci.nsIAccessibleStates.STATE_CHECKABLE),
checked: !!(state &
Ci.nsIAccessibleStates.STATE_CHECKED),
brailleText: brailleText});
brailleOutput: brailleOutput});
return {
@ -310,20 +310,28 @@ AndroidPresenter.prototype = {
textSelectionChanged: function AndroidPresenter_textSelectionChanged(aText, aStart,
aEnd, aOldStart,
aOldEnd) {
aOldEnd, aIsFromUser) {
let androidEvents = [];
if (Utils.AndroidSdkVersion >= 14) {
if (Utils.AndroidSdkVersion >= 14 && !aIsFromUser) {
if (!this._braillePresenter) {
this._braillePresenter = new BraillePresenter();
}
let brailleOutput = this._braillePresenter.textSelectionChanged(aText, aStart, aEnd,
aOldStart, aOldEnd,
aIsFromUser).details;
androidEvents.push({
eventType: this.ANDROID_VIEW_TEXT_SELECTION_CHANGED,
text: [aText],
fromIndex: aStart,
toIndex: aEnd,
itemCount: aText.length
itemCount: aText.length,
brailleOutput: brailleOutput
});
}
if (Utils.AndroidSdkVersion >= 16) {
if (Utils.AndroidSdkVersion >= 16 && aIsFromUser) {
let [from, to] = aOldStart < aStart ? [aOldStart, aStart] : [aStart, aOldStart];
androidEvents.push({
eventType: this.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
@ -454,9 +462,20 @@ BraillePresenter.prototype = {
let brailleOutput = BrailleGenerator.genForContext(aContext);
brailleOutput.output = brailleOutput.output.join(' ');
brailleOutput.selectionStart = 0;
brailleOutput.selectionEnd = 0;
return { type: this.type, details: brailleOutput };
}
},
textSelectionChanged: function BraillePresenter_textSelectionChanged(aText, aStart,
aEnd, aOldStart,
aOldEnd, aIsFromUser) {
return { type: this.type,
details: { selectionStart: aStart,
selectionEnd: aEnd } };
},
};
@ -496,8 +515,11 @@ this.Presentation = {
for each (p in this.presenters)];
},
textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd) {
return [p.textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd)
textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd,
aOldStart, aOldEnd,
aIsFromUser) {
return [p.textSelectionChanged(aText, aStart, aEnd,
aOldStart, aOldEnd, aIsFromUser)
for each (p in this.presenters)];
},

View File

@ -243,7 +243,7 @@ function moveCaret(aMessage) {
function presentCaretChange(aText, aOldOffset, aNewOffset) {
if (aOldOffset !== aNewOffset) {
let msg = Presentation.textSelectionChanged(aText, aNewOffset, aNewOffset,
aOldOffset, aOldOffset);
aOldOffset, aOldOffset, true);
sendAsyncMessage('AccessFu:Present', msg);
}
}

View File

@ -56,7 +56,7 @@
[ "textarea" ]);
testTextBeforeOffset(kCaretOffset, BOUNDARY_LINE_END, "\ntwo ", 5, 10,
"textarea", kTodo, kTodo, kTodo);
"textarea", kTodo, kTodo, kOk);
}
this.getID = function moveToLastLineEnd_getID()
@ -119,7 +119,7 @@
[ "textarea" ]);
testTextBeforeOffset(kCaretOffset, BOUNDARY_LINE_END, "aword", 0, 5,
"textarea", kTodo, kTodo, kTodo);
[ "textarea" ]);
}
this.getID = function moveToMiddleLineStart_getID()
@ -150,7 +150,7 @@
[ "textarea" ]);
testTextBeforeOffset(kCaretOffset, BOUNDARY_LINE_END, "aword", 0, 5,
"textarea", kTodo, kTodo, kTodo);
[ "textarea" ]);
}
this.getID = function moveToMiddleLineEnd_getID()
@ -212,7 +212,7 @@
[ "textarea" ]);
testTextBeforeOffset(kCaretOffset, BOUNDARY_LINE_END, "", 0, 0,
"textarea", kTodo, kOk, kTodo);
[ "textarea" ]);
}
this.getID = function moveToFirstLineEnd_getID()
@ -224,7 +224,7 @@
var gQueue = null;
function doTest()
{
SimpleTest.expectAssertions(3);
SimpleTest.expectAssertions(1);
gQueue = new eventQueue();
gQueue.push(new moveToLastLineEnd());

View File

@ -16,7 +16,7 @@
function doTest()
{
SimpleTest.expectAssertions(20);
SimpleTest.expectAssertions(5);
// __o__n__e__w__o__r__d__\n
// 0 1 2 3 4 5 6 7
@ -114,42 +114,12 @@
testTextBeforeOffset(19, BOUNDARY_LINE_START, "two words\n", 9, 19, IDs);
// BOUNDARY_LINE_END
testTextBeforeOffset(0, BOUNDARY_LINE_END, "", 0, 0,
"div", kOk, kOk, kOk,
"divbr", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"editablebr", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextBeforeOffset(7, BOUNDARY_LINE_END, "", 0, 0,
"div", kOk, kTodo, kTodo,
"divbr", kOk, kTodo, kTodo,
"editable", kOk, kTodo, kTodo,
"editablebr", kOk, kTodo, kTodo,
"textarea", kOk, kTodo, kTodo);
testTextBeforeOffset(8, BOUNDARY_LINE_END, "oneword", 0, 7,
"div", kTodo, kTodo, kTodo,
"divbr", kTodo, kTodo, kTodo,
"editable", kTodo, kTodo, kTodo,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kTodo, kTodo, kTodo);
testTextBeforeOffset(9, BOUNDARY_LINE_END, "\n", 7, 8,
"div", kOk, kTodo, kTodo,
"divbr", kOk, kTodo, kTodo,
"editable", kOk, kTodo, kTodo,
"editablebr", kOk, kTodo, kTodo,
"textarea", kOk, kTodo, kTodo);
testTextBeforeOffset(18, BOUNDARY_LINE_END, "\n", 7, 8,
"div", kTodo, kTodo, kTodo,
"divbr", kTodo, kTodo, kTodo,
"editable", kTodo, kTodo, kTodo,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kTodo, kTodo, kTodo);
testTextBeforeOffset(19, BOUNDARY_LINE_END, "\ntwo words", 8, 18,
"div", kTodo, kTodo, kTodo,
"divbr", kTodo, kTodo, kTodo,
"editable", kTodo, kTodo, kTodo,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kTodo, kTodo, kTodo);
testTextBeforeOffset(0, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(7, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(8, BOUNDARY_LINE_END, "oneword", 0, 7, IDs);
testTextBeforeOffset(9, BOUNDARY_LINE_END, "\n", 7, 8, IDs);
testTextBeforeOffset(18, BOUNDARY_LINE_END, "\n", 7, 8, IDs);
testTextBeforeOffset(19, BOUNDARY_LINE_END, "\ntwo words", 8, 18, IDs);
////////////////////////////////////////////////////////////////////////
// getTextAtOffset

View File

@ -12,9 +12,9 @@
src="../text.js"></script>
<script type="application/javascript">
if (navigator.platform.startsWith("Mac")) {
SimpleTest.expectAssertions(0, 8);
SimpleTest.expectAssertions(0, 4);
} else {
SimpleTest.expectAssertions(8);
SimpleTest.expectAssertions(4);
}
function doTest()
@ -84,21 +84,9 @@
testTextBeforeOffset(15, BOUNDARY_LINE_START, "", 0, 0, IDs);
// BOUNDARY_LINE_END
testTextBeforeOffset(0, BOUNDARY_LINE_END, "", 0, 0,
"input", kOk, kOk, kOk,
"div", kOk, kOk, kOk,
"editable", kOk, kOk, kOk,
"textarea", kOk, kOk, kOk);
testTextBeforeOffset(1, BOUNDARY_LINE_END, "", 0, 0,
"input", kTodo, kOk, kTodo,
"div", kTodo, kOk, kTodo,
"editable", kTodo, kOk, kTodo,
"textarea", kTodo, kOk, kTodo);
testTextBeforeOffset(14, BOUNDARY_LINE_END, "", 0, 0,
"input", kTodo, kOk, kTodo,
"div", kTodo, kOk, kTodo,
"editable", kTodo, kOk, kTodo,
"textarea", kTodo, kOk, kTodo);
testTextBeforeOffset(0, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(1, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(14, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(15, BOUNDARY_LINE_END, "", 0, 0, IDs);
////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1372700880000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1373408730000">
<emItems>
<emItem blockID="i350" id="sqlmoz@facebook.com">
<versionRange minVersion="0" maxVersion="*" severity="3">
@ -219,10 +219,6 @@
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i386" id="7lffxtbr@CursorMania_7l.com">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i4" id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
<versionRange minVersion="1.2" maxVersion="1.2">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
@ -285,10 +281,6 @@
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i388" id="5mffxtbr@MyFunCards_5m.com">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i396" id="/@(ft|putlocker|clickmovie|m2k|sharerepo|smarter-?)downloader\.com$/">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
@ -391,6 +383,10 @@
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i426" id="addlyrics@addlyrics.net">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i404" id="{a9bb9fa0-4122-4c75-bd9a-bc27db3f9155}">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
@ -576,10 +572,6 @@
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i384" id="7lffxtbr@PopularScreensavers_7l.com">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
</emItem>
<emItem blockID="i165" id="{EEF73632-A085-4fd3-A778-ECD82C8CB297}">
<versionRange minVersion="0" maxVersion="*" severity="3">
</versionRange>

View File

@ -1,17 +1,17 @@
[
{
"clang_version": "r170890"
"clang_version": "r183744"
},
{
"filename": "setup.sh",
"algorithm": "sha512",
"size": 47,
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
"size": 47
"algorithm": "sha512",
"filename": "setup.sh"
},
{
"filename": "clang.tar.bz2",
"size": 70206124,
"digest": "a6b8046bd9485f9387dcb1c14b8d442822f02b1caa61b653e8b6cfd96906deadfb4b29809f2cd2b71f919b321d97dd2ebec6020c15f6d485f1641c0f710a762f",
"algorithm": "sha512",
"digest": "0bcfc19f05cc0f042befb3823c7ecce9ba411b152921aa29e97e7adc846e0258fd7da521b1620cb1e61a19d2fcac9b60e6d613c922b6c153e01b9b0766651d09",
"size": 62708281
"filename": "clang.tar.bz2"
}
]

View File

@ -1,17 +1,17 @@
[
{
"clang_version": "r170890"
},
"clang_version": "r183744"
},
{
"filename": "setup.sh",
"algorithm": "sha512",
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
"size": 47
},
"size": 47,
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
"algorithm": "sha512",
"filename": "setup.sh"
},
{
"filename": "clang.tar.bz2",
"algorithm": "sha512",
"digest": "e14ccefd965372a57c540647b2b99e21a4aa82f81a8b9a9e18dac7cba4c3436181bef0dfab8c51bcb5c343f504a693fdcfbe7d609f10291b5dd65ab059979d29",
"size": 63034761
"size": 70350828,
"digest": "6cd04e8ec44c6fef159349c22bd0476891e4a2d46479f9586283eaf3305e42f79c720d40dfec0e78d8899c1651189b12e285de60862ffd0612b0dac7a0c336c6",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}
]

View File

@ -1,17 +1,17 @@
[
{
"clang_version": "r170890"
},
"clang_version": "r183744"
},
{
"size": 47,
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
"algorithm": "sha512",
"size": 47,
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
"algorithm": "sha512",
"filename": "setup.sh"
},
},
{
"size": 56126352,
"digest": "e156e2a39abd5bf272ee30748a6825f22ddd27565b097c66662a2a6f2e9892bc5b4bf30a3552dffbe867dbfc39e7ee086e0b2cd7935f6ea216c0cf936178a88f",
"algorithm": "sha512",
"size": 59602619,
"digest": "86662ebc0ef650490559005948c4f0cb015dad72c7cac43732c2bf2995247081e30c139cf8008d19670a0009fc302c4eee2676981ee3f9ff4a15c01af22b783b",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}
]

View File

@ -5,7 +5,7 @@
/*
* ContentAreaObserver manages tracking the viewable area within the browser.
* It also handles certain tasks like positioning of input elements within
* content when the viewable area changes.
* content when the viewable area changes.
*
* ContentAreaObserver creates styles that content can apply and also fires
* events when things change. The 'width' and 'height' properties of the
@ -171,13 +171,10 @@ var ContentAreaObserver = {
updateAppBarPosition: function updateAppBarPosition(aForceDown) {
// Adjust the app and find bar position above the soft keyboard
let navBar = document.getElementById("navbar");
let contextAppBar = document.getElementById("contextappbar");
let findBar = document.getElementById("content-navigator");
let keyboardHeight = aForceDown ? 0 : MetroUtils.keyboardHeight;
navBar.style.bottom = keyboardHeight + "px";
contextAppBar.style.bottom = keyboardHeight + "px";
findBar.style.bottom = keyboardHeight + "px";
Elements.navbar.style.bottom = keyboardHeight + "px";
Elements.contextappbar.style.bottom = keyboardHeight + "px";
Elements.findbar.style.bottom = keyboardHeight + "px";
},
/*

View File

@ -293,13 +293,15 @@ TopSitesView.prototype = {
aTileNode.iconSrc = iconURLfromSiteURL.spec;
let faviconURL = (PlacesUtils.favicons.getFaviconLinkForIcon(iconURLfromSiteURL)).spec;
let xpFaviconURI = Util.makeURI(faviconURL.replace("moz-anno:favicon:",""));
ColorUtils.getForegroundAndBackgroundIconColors(xpFaviconURI, function(foreground, background) {
aTileNode.style.color = foreground; //color text
let successAction = function(foreground, background) {
aTileNode.style.color = foreground; //color text
aTileNode.setAttribute("customColor", background);
if (aTileNode.refresh) {
aTileNode.refresh();
}
});
};
let failureAction = function() {};
ColorUtils.getForegroundAndBackgroundIconColors(xpFaviconURI, successAction, failureAction);
});
if (this._useThumbs) {

View File

@ -757,6 +757,7 @@
<setter><![CDATA[
// Do not change displayport on local tabs!
this._active = val;
this.docShellIsActive = this._active;
]]></setter>
</property>

View File

@ -234,13 +234,15 @@ BookmarksView.prototype = {
if (!aIconUri) {
return;
}
ColorUtils.getForegroundAndBackgroundIconColors(aIconUri, function(foregroundColor, backgroundColor) {
let successAction = function(foregroundColor, backgroundColor) {
aItem.style.color = foregroundColor; //color text
aItem.setAttribute("customColor", backgroundColor); //set background
if (aItem.refresh) {
aItem.refresh();
}
});
};
let failureAction = function() {};
ColorUtils.getForegroundAndBackgroundIconColors(aIconUri, successAction, failureAction);
},
_sendNeedsRefresh: function bv__sendNeedsRefresh(){

View File

@ -43,10 +43,10 @@ let Elements = {};
["browsers", "browsers"],
["navbar", "navbar"],
["contextappbar", "contextappbar"],
["findbar", "findbar"],
["contentViewport", "content-viewport"],
["progress", "progress-control"],
["progressContainer", "progress-container"],
["contentNavigator", "content-navigator"],
].forEach(function (aElementGlobal) {
let [name, id] = aElementGlobal;
XPCOMUtils.defineLazyGetter(Elements, name, function() {

View File

@ -250,15 +250,6 @@
<html:div id="overlay-plus" class="overlay-button"
observes="cmd_back"></html:div>
<!-- popup for content navigator helper -->
<appbar id="content-navigator" class="window-width content-navigator-box" orient="horizontal" pack="start">
<textbox id="find-helper-textbox" class="search-bar content-navigator-item" oncommand="FindHelperUI.search(this.value)" oninput="FindHelperUI.updateCommands(this.value);" type="search"/>
<button class="content-navigator-item previous-button" command="cmd_findPrevious"/>
<button class="content-navigator-item next-button" command="cmd_findNext"/>
<spacer flex="1"/>
<button class="content-navigator-item close-button" command="cmd_findClose"/>
</appbar>
<!-- Navbar -->
<appbar id="navbar" mousethrough="never" observes="bcast_windowState">
<hbox id="progress-container" layer="true">
@ -356,6 +347,15 @@
</deck>
</vbox>
<!-- Find bar -->
<appbar id="findbar" class="window-width findbar-box" orient="horizontal" pack="start">
<textbox id="findbar-textbox" class="search-bar findbar-item" oncommand="FindHelperUI.search(this.value)" oninput="FindHelperUI.updateCommands(this.value);" type="search"/>
<button class="findbar-item previous-button" command="cmd_findPrevious"/>
<button class="findbar-item next-button" command="cmd_findNext"/>
<spacer flex="1"/>
<button class="findbar-item close-button" command="cmd_findClose"/>
</appbar>
<!-- Context button bar -->
<appbar id="contextappbar">
<toolbar id="contextualactions-tray" flex="1">

View File

@ -42,8 +42,8 @@ var FindHelperUI = {
},
init: function findHelperInit() {
this._textbox = document.getElementById("find-helper-textbox");
this._container = Elements.contentNavigator;
this._textbox = document.getElementById("findbar-textbox");
this._container = Elements.findbar;
this._cmdPrevious = document.getElementById(this.commands.previous);
this._cmdNext = document.getElementById(this.commands.next);

View File

@ -14,18 +14,20 @@ let ColorUtils = {
* & background color as is desired) The first argument to the callback is
* the foreground/contrast color, the second is the background/primary/dominant one
*/
getForegroundAndBackgroundIconColors: function getForegroundAndBackgroundIconColors(aIconURI, aSuccessCallback) {
getForegroundAndBackgroundIconColors: function getForegroundAndBackgroundIconColors(aIconURI, aSuccessCallback, aErrorCallback) {
if (!aIconURI) {
return;
}
let that = this;
let wrappedIcon = aIconURI;
ColorAnalyzer.findRepresentativeColor(wrappedIcon, function (success, color) {
let foregroundColor = that.bestTextColorForContrast(color);
let backgroundColor = that.convertDecimalToRgbColor(color);
// let the caller do whatever it is they need through the callback
aSuccessCallback(foregroundColor, backgroundColor);
if (!success) {
aErrorCallback();
} else {
let foregroundColor = that.bestTextColorForContrast(color);
let backgroundColor = that.convertDecimalToRgbColor(color);
aSuccessCallback(foregroundColor, backgroundColor);
}
}, this);
},
/** returns the best color for text readability on top of aColor

View File

@ -665,19 +665,19 @@ arrowbox {
/* Find bar ------------------------------------------------------------- */
#content-navigator {
#findbar {
background-color: @metro_orange@;
padding: 0;
pointer-events: none;
}
#content-navigator > toolbar {
#findbar > toolbar {
min-height: @findbar_height@ !important;
}
#content-navigator > .previous-button,
#content-navigator > .next-button,
#content-navigator > .close-button {
#findbar > .previous-button,
#findbar > .next-button,
#findbar > .close-button {
list-style-image: url(chrome://browser/skin/images/appbar-icons.png);
min-width: @touch_button_small@ !important; /* button size */
min-height: @touch_button_small@ !important; /* button size */
@ -689,46 +689,46 @@ arrowbox {
margin: 0 @margin_normal@ !important;
}
#content-navigator > .close-button {
#findbar > .close-button {
-moz-margin-start: 0;
-moz-image-region: rect(0px, 480px, 40px, 440px);
}
#content-navigator > .close-button:hover {
#findbar > .close-button:hover {
-moz-image-region: rect(40px, 480px, 80px, 440px);
}
#content-navigator > .close-button:active {
#findbar > .close-button:active {
-moz-image-region: rect(80px, 480px, 120px, 440px);
}
#content-navigator > .previous-button {
#findbar > .previous-button {
-moz-margin-end: 0;
-moz-image-region: rect(0px, 400px, 40px, 360px);
}
#content-navigator > .previous-button:hover {
#findbar > .previous-button:hover {
-moz-image-region: rect(40px, 400px, 80px, 360px);
}
#content-navigator > .previous-button:active{
#findbar > .previous-button:active{
-moz-image-region: rect(80px, 400px, 120px, 360px);
}
#content-navigator > .next-button {
#findbar > .next-button {
-moz-margin-start: 0;
-moz-image-region: rect(0px, 440px, 40px, 400px);
}
#content-navigator > .next-button:hover {
#findbar > .next-button:hover {
-moz-image-region: rect(40px, 440px, 80px, 400px);
}
#content-navigator > .next-button:active {
#findbar > .next-button:active {
-moz-image-region: rect(80px, 440px, 120px, 400px);
}
#find-helper-textbox {
#findbar-textbox {
pointer-events: auto;
-moz-margin-end: 0;
border: none !important;
@ -742,18 +742,18 @@ arrowbox {
/* Override the default box ordering and make the find textbox appear to the
right of the icon */
#find-helper-textbox input {
#findbar-textbox input {
-moz-box-ordinal-group: 2
}
#find-helper-textbox deck {
#findbar-textbox deck {
margin-right: @margin_normal@;
}
#find-helper-textbox[status="1"] { /* Ci.nsITypeAheadFind.FIND_NOTFOUND */
#findbar-textbox[status="1"] { /* Ci.nsITypeAheadFind.FIND_NOTFOUND */
background: rgb(255,200,200);
}
#find-helper-textbox:hover:active {
#findbar-textbox:hover:active {
background: #8db8d8;
}

View File

@ -12,7 +12,7 @@ import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;
public final class RobocopUtils {
private static final int MAX_WAIT_MS = 3000;
private static final int MAX_WAIT_MS = 20000;
private RobocopUtils() {}

View File

@ -4289,7 +4289,6 @@ MOZ_PLACES=1
MOZ_SOCIAL=1
MOZ_PREF_EXTENSIONS=1
MOZ_PROFILELOCKING=1
MOZ_PSM=1
MOZ_REFLOW_PERF=
MOZ_SAFE_BROWSING=
MOZ_HELP_VIEWER=
@ -5284,14 +5283,6 @@ if test -n "$MOZ_ANDROID_BEAM"; then
AC_DEFINE(MOZ_ANDROID_BEAM)
fi
dnl ========================================================
dnl = Build Personal Security Manager
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(crypto,
[ --disable-crypto Disable crypto support (Personal Security Manager)],
MOZ_PSM=,
MOZ_PSM=1 )
dnl ========================================================
dnl = JS Debugger XPCOM component (js/jsd)
dnl ========================================================
@ -8146,7 +8137,14 @@ dnl Graphics checks.
dnl ========================================================
if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
MOZ_ENABLE_SKIA=1
case "${target_cpu}" in
i*86*|x86_64|arm)
MOZ_ENABLE_SKIA=1
;;
*)
MOZ_ENABLE_SKIA=
;;
esac
else
MOZ_ENABLE_SKIA=
fi
@ -8633,7 +8631,6 @@ AC_SUBST(MOZ_AUTH_EXTENSION)
AC_SUBST(MOZ_PERMISSIONS)
AC_SUBST(MOZ_PREF_EXTENSIONS)
AC_SUBST(MOZ_JS_LIBS)
AC_SUBST(MOZ_PSM)
AC_SUBST(MOZ_DEBUG)
AC_SUBST(MOZ_DEBUG_SYMBOLS)
AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)

View File

@ -1574,9 +1574,9 @@ WebGLContext::DrawArrays(GLenum mode, WebGLint first, WebGLsizei count)
return ErrorInvalidFramebufferOperation("drawArrays: incomplete framebuffer");
}
BindFakeBlackTextures();
if (!DoFakeVertexAttrib0(checked_firstPlusCount.value()))
return;
BindFakeBlackTextures();
SetupContextLossTimer();
gl->fDrawArrays(mode, first, count);
@ -1684,9 +1684,9 @@ WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type,
return ErrorInvalidFramebufferOperation("drawElements: incomplete framebuffer");
}
BindFakeBlackTextures();
if (!DoFakeVertexAttrib0(maxAllowedCount))
return;
BindFakeBlackTextures();
SetupContextLossTimer();
gl->fDrawElements(mode, count, type, reinterpret_cast<GLvoid*>(byteOffset));

View File

@ -68,8 +68,6 @@ MOCHITEST_FILES = \
test_audio1.html \
test_audio2.html \
test_autoplay.html \
test_bug465498.html \
test_bug493187.html \
test_bug495145.html \
test_bug495300.html \
test_bug654550.html \
@ -184,6 +182,12 @@ endif
# Disabled since we don't play Wave files standalone, for now
# test_audioDocumentTitle.html
# The below tests are disabled due to frequent timeouts.
# Bug 832768 and Bug 864682:
# test_bug465498.html
# Bug 707777:
# test_bug493187.html
# sample files
MOCHITEST_FILES += \
320x240.ogv \

View File

@ -354,7 +354,6 @@ public:
uint32_t finalSampleRate = ComputeFinalOutSampleRate(aStream->SampleRate());
if (currentOutSampleRate != finalSampleRate) {
speex_resampler_set_rate(resampler, currentInSampleRate, finalSampleRate);
speex_resampler_skip_zeros(mResampler);
}
}
}

View File

@ -9123,8 +9123,8 @@ class CGExampleRoot(CGThing):
"mozilla/dom/%sBinding.h" % interfaceName,
"nsContentUtils.h" ], "", self.root);
# In the header, #pragma once before everything
self.root = CGWrapper(self.root, declarePre="#pragma once\n\n")
# And now some include guards
self.root = CGIncludeGuard(interfaceName, self.root)
# And our license block comes before everything else
self.root = CGWrapper(self.root, pre="""/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */

View File

@ -1893,7 +1893,9 @@ public:
return NS_OK;
}
nsCOMPtr<PostResultEvent> event = new PostResultEvent(mRequest.forget(), mFile->mPath);
nsString compositePath;
mFile->GetCompositePath(compositePath);
nsCOMPtr<PostResultEvent> event = new PostResultEvent(mRequest.forget(), compositePath);
NS_DispatchToMainThread(event);
return NS_OK;
}
@ -1972,7 +1974,9 @@ public:
r = new PostErrorEvent(mRequest.forget(), POST_ERROR_EVENT_FILE_DOES_NOT_EXIST);
}
else {
r = new PostResultEvent(mRequest.forget(), mFile->mPath);
nsString compositePath;
mFile->GetCompositePath(compositePath);
r = new PostResultEvent(mRequest.forget(), compositePath);
}
NS_DispatchToMainThread(r);
return NS_OK;

View File

@ -78,14 +78,26 @@ function simulateIncoming() {
is(telephony.calls.length, 1);
is(telephony.calls[0], incomingCall);
runEmulatorCmd("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "inbound from " + inNumber + " : incoming");
is(result[1], "OK");
answerIncoming();
// Wait for emulator to catch up before continuing
waitFor(verifyCallList,function() {
return(rcvdEmulatorCallback);
});
};
runEmulatorCmd("gsm call " + inNumber);
let rcvdEmulatorCallback = false;
runEmulatorCmd("gsm call " + inNumber, function(result) {
is(result[0], "OK", "emulator callback");
rcvdEmulatorCallback = true;
});
}
function verifyCallList(){
runEmulatorCmd("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "inbound from " + inNumber + " : incoming");
is(result[1], "OK");
answerIncoming();
});
}
function answerIncoming() {
@ -190,15 +202,27 @@ function answerOutgoing() {
is(outgoingCall, telephony.active);
runEmulatorCmd("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "inbound from " + inNumber + " : held");
is(result[1], "outbound to " + outNumber + " : active");
is(result[2], "OK");
hangUpIncoming();
// Wait for emulator to catch up before continuing
waitFor(checkCallList,function() {
return(rcvdEmulatorCallback);
});
};
runEmulatorCmd("gsm accept " + outNumber);
let rcvdEmulatorCallback = false;
runEmulatorCmd("gsm accept " + outNumber, function(result) {
is(result[0], "OK", "emulator callback");
rcvdEmulatorCallback = true;
});
}
function checkCallList(){
runEmulatorCmd("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "inbound from " + inNumber + " : held");
is(result[1], "outbound to " + outNumber + " : active");
is(result[2], "OK");
hangUpIncoming();
});
}
// Hang-up the original incoming call, which is now held

View File

@ -101,15 +101,27 @@ function reject() {
is(telephony.active, null);
is(telephony.calls.length, 0);
runEmulatorCmd("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "OK");
cleanUp();
// Wait for emulator to catch up before continuing
waitFor(verifyCallList,function() {
return(rcvdEmulatorCallback);
});
};
runEmulatorCmd("gsm cancel " + number);
let rcvdEmulatorCallback = false;
runEmulatorCmd("gsm cancel " + number, function(result) {
is(result[0], "OK", "emulator callback");
rcvdEmulatorCallback = true;
});
};
function verifyCallList(){
runEmulatorCmd("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "OK");
cleanUp();
});
}
function cleanUp() {
SpecialPowers.removePermission("telephony", document);
finish();

View File

@ -839,6 +839,8 @@ public:
*/
virtual void *GetNativeSurface(NativeSurfaceType aType) { return NULL; }
virtual bool IsDualDrawTarget() { return false; }
void AddUserData(UserDataKey *key, void *userData, void (*destroy)(void*)) {
mUserData.Add(key, userData, destroy);
}
@ -1012,11 +1014,28 @@ private:
class BorrowedCGContext
{
public:
BorrowedCGContext(DrawTarget *aDT) : mDT(aDT)
BorrowedCGContext()
: cg(nullptr)
, mDT(nullptr)
{ }
BorrowedCGContext(DrawTarget *aDT)
: mDT(aDT)
{
cg = BorrowCGContextFromDrawTarget(aDT);
}
// We can optionally Init after construction in
// case we don't know what the DT will be at construction
// time.
CGContextRef Init(DrawTarget *aDT)
{
MOZ_ASSERT(!mDT, "Can't initialize twice!");
mDT = aDT;
cg = BorrowCGContextFromDrawTarget(aDT);
return cg;
}
// The caller needs to call Finish if cg is non-null when
// they are done with the context. This is currently explicit
// instead of happening implicitly in the destructor to make

View File

@ -287,9 +287,10 @@ DrawTargetCG::DrawSurface(SourceSurface *aSurface,
CGRect flippedRect = CGRectMake(aDest.x, -(aDest.y + aDest.height),
aDest.width, aDest.height);
//XXX: we should implement this for patterns too
if (aSurfOptions.mFilter == FILTER_POINT)
CGContextSetInterpolationQuality(cg, kCGInterpolationNone);
else
CGContextSetInterpolationQuality(cg, kCGInterpolationLow);
CGContextDrawImage(cg, flippedRect, image);
@ -300,40 +301,6 @@ DrawTargetCG::DrawSurface(SourceSurface *aSurface,
CGImageRelease(subimage);
}
void
DrawTargetCG::MaskSurface(const Pattern &aSource,
SourceSurface *aMask,
Point aOffset,
const DrawOptions &aDrawOptions)
{
MarkChanged();
CGImageRef image;
CGContextSaveGState(mCg);
CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(cg, aDrawOptions.mAlpha);
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
image = GetImageFromSourceSurface(aMask);
CGContextScaleCTM(cg, 1, -1);
IntSize size = aMask->GetSize();
CGContextClipToMask(cg, CGRectMake(aOffset.x, -(aOffset.y + size.height), size.width, size.height), image);
CGContextScaleCTM(cg, 1, -1);
FillRect(Rect(aOffset.x, aOffset.y, size.width, size.height), aSource, aDrawOptions);
fixer.Fix(mCg);
CGContextRestoreGState(mCg);
}
static CGColorRef ColorToCGColor(CGColorSpaceRef aColorSpace, const Color& aColor)
{
CGFloat components[4] = {aColor.r, aColor.g, aColor.b, aColor.a};
@ -517,6 +484,11 @@ SetFillFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern &
CGColorSpaceRelease(patternSpace);
CGPatternRef pattern = CreateCGPattern(aPattern, CGContextGetCTM(cg));
const SurfacePattern& pat = static_cast<const SurfacePattern&>(aPattern);
if (pat.mFilter == FILTER_POINT)
CGContextSetInterpolationQuality(cg, kCGInterpolationNone);
else
CGContextSetInterpolationQuality(cg, kCGInterpolationLow);
CGFloat alpha = 1.;
CGContextSetFillPattern(cg, pattern, &alpha);
CGPatternRelease(pattern);
@ -540,6 +512,11 @@ SetStrokeFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern
CGColorSpaceRelease(patternSpace);
CGPatternRef pattern = CreateCGPattern(aPattern, CGContextGetCTM(cg));
const SurfacePattern& pat = static_cast<const SurfacePattern&>(aPattern);
if (pat.mFilter == FILTER_POINT)
CGContextSetInterpolationQuality(cg, kCGInterpolationNone);
else
CGContextSetInterpolationQuality(cg, kCGInterpolationLow);
CGFloat alpha = 1.;
CGContextSetStrokePattern(cg, pattern, &alpha);
CGPatternRelease(pattern);
@ -547,6 +524,48 @@ SetStrokeFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern
}
void
DrawTargetCG::MaskSurface(const Pattern &aSource,
SourceSurface *aMask,
Point aOffset,
const DrawOptions &aDrawOptions)
{
MarkChanged();
CGImageRef image;
CGContextSaveGState(mCg);
CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(cg, aDrawOptions.mAlpha);
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
image = GetImageFromSourceSurface(aMask);
// use a negative-y so that the mask image draws right ways up
CGContextScaleCTM(cg, 1, -1);
IntSize size = aMask->GetSize();
CGContextClipToMask(cg, CGRectMake(aOffset.x, -(aOffset.y + size.height), size.width, size.height), image);
CGContextScaleCTM(cg, 1, -1);
if (isGradient(aSource)) {
// we shouldn't need to clip to an additional rectangle
// as the cliping to the mask should be sufficient.
DrawGradient(cg, aSource);
} else {
SetFillFromPattern(cg, mColorSpace, aSource);
CGContextFillRect(cg, CGRectMake(aOffset.x, aOffset.y, size.width, size.height));
}
fixer.Fix(mCg);
CGContextRestoreGState(mCg);
}
void
DrawTargetCG::FillRect(const Rect &aRect,
@ -627,22 +646,7 @@ DrawTargetCG::StrokeRect(const Rect &aRect,
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
// we don't need to set all of the stroke state because
// it doesn't apply when stroking rects
switch (aStrokeOptions.mLineJoin)
{
case JOIN_BEVEL:
CGContextSetLineJoin(cg, kCGLineJoinBevel);
break;
case JOIN_ROUND:
CGContextSetLineJoin(cg, kCGLineJoinRound);
break;
case JOIN_MITER:
case JOIN_MITER_OR_BEVEL:
CGContextSetLineJoin(cg, kCGLineJoinMiter);
break;
}
CGContextSetLineWidth(cg, aStrokeOptions.mLineWidth);
SetStrokeOptions(cg, aStrokeOptions);
if (isGradient(aPattern)) {
// There's no CGContextClipStrokeRect so we do it by hand
@ -1026,6 +1030,7 @@ DrawTargetCG::Init(CGContextRef cgContext, const IntSize &aSize)
mSize = aSize;
mCg = cgContext;
CGContextRetain(mCg);
mData = nullptr;
@ -1190,6 +1195,8 @@ BorrowedCGContext::BorrowCGContextFromDrawTarget(DrawTarget *aDT)
// save the state to make it easier for callers to avoid mucking with things
CGContextSaveGState(cg);
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(cgDT->mTransform));
return cg;
}
return nullptr;

View File

@ -131,6 +131,11 @@ public:
{
return nullptr;
}
virtual bool IsDualDrawTarget()
{
return true;
}
private:
RefPtr<DrawTarget> mA;

View File

@ -638,9 +638,17 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (err1 != noErr || err2 != noErr ||
major < 10 || (major == 10 && minor < 8)) {
// See bug 877949.
mMaxTextureSize = std::min(mMaxTextureSize, 4096);
mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 4096);
mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 4096);
}
else {
// See bug 879656. 8192 fails, 8191 works.
mMaxTextureSize = std::min(mMaxTextureSize, 8191);
mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 8191);
}
// Part of the bug 879656, but it also doesn't hurt the 877949
mNeedsTextureSizeChecks = true;
}
}
#endif

View File

@ -13,6 +13,7 @@
#include "gfxASurface.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxPlatform.h"
#include "nsRect.h"
@ -243,6 +244,7 @@ gfxASurface::Flush() const
if (!mSurfaceValid)
return;
cairo_surface_flush(mSurface);
gfxPlatform::ClearSourceSurfaceForSurface(const_cast<gfxASurface*>(this));
}
void
@ -251,6 +253,7 @@ gfxASurface::MarkDirty()
if (!mSurfaceValid)
return;
cairo_surface_mark_dirty(mSurface);
gfxPlatform::ClearSourceSurfaceForSurface(this);
}
void
@ -261,6 +264,7 @@ gfxASurface::MarkDirty(const gfxRect& r)
cairo_surface_mark_dirty_rectangle(mSurface,
(int) r.X(), (int) r.Y(),
(int) r.Width(), (int) r.Height());
gfxPlatform::ClearSourceSurfaceForSurface(this);
}
void

View File

@ -601,6 +601,12 @@ void SourceSnapshotDetached(void *nullSurf)
}
#endif
void
gfxPlatform::ClearSourceSurfaceForSurface(gfxASurface *aSurface)
{
aSurface->SetData(&kSourceSurface, nullptr, nullptr);
}
RefPtr<SourceSurface>
gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface)
{

View File

@ -194,6 +194,8 @@ public:
virtual mozilla::RefPtr<mozilla::gfx::SourceSurface>
GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface);
static void ClearSourceSurfaceForSurface(gfxASurface *aSurface);
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);

View File

@ -71,7 +71,7 @@ gfxPlatformMac::gfxPlatformMac()
mFontAntiAliasingThreshold = ReadAntiAliasingThreshold();
uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA) | (1 << BACKEND_COREGRAPHICS);
uint32_t contentMask = 0;
uint32_t contentMask = (1 << BACKEND_COREGRAPHICS);
InitBackendPrefs(canvasMask, contentMask);
}

View File

@ -8,11 +8,15 @@
#include "gfxQuartzNativeDrawing.h"
#include "gfxQuartzSurface.h"
#include "cairo-quartz.h"
#include "mozilla/gfx/2D.h"
// see cairo-quartz-surface.c for the complete list of these
enum {
kPrivateCGCompositeSourceOver = 2
};
using namespace mozilla::gfx;
using namespace mozilla;
// private Quartz routine needed here
extern "C" {
CG_EXTERN void CGContextSetCompositeOperation(CGContextRef, int);
@ -21,7 +25,9 @@ extern "C" {
gfxQuartzNativeDrawing::gfxQuartzNativeDrawing(gfxContext* ctx,
const gfxRect& nativeRect,
gfxFloat aBackingScale)
: mContext(ctx), mNativeRect(nativeRect), mBackingScale(aBackingScale)
: mContext(ctx)
, mNativeRect(nativeRect)
, mBackingScale(aBackingScale)
{
mNativeRect.RoundOut();
}
@ -31,6 +37,26 @@ gfxQuartzNativeDrawing::BeginNativeDrawing()
{
NS_ASSERTION(!mQuartzSurface, "BeginNativeDrawing called when drawing already in progress");
if (!mContext->IsCairo()) {
DrawTarget *dt = mContext->GetDrawTarget();
if (mContext->GetDrawTarget()->IsDualDrawTarget()) {
IntSize backingSize(NSToIntFloor(mNativeRect.width * mBackingScale),
NSToIntFloor(mNativeRect.height * mBackingScale));
mDrawTarget = Factory::CreateDrawTarget(BACKEND_COREGRAPHICS, backingSize, FORMAT_B8G8R8A8);
Matrix transform;
transform.Scale(mBackingScale, mBackingScale);
transform.Translate(-mNativeRect.x, -mNativeRect.y);
mDrawTarget->SetTransform(transform);
dt = mDrawTarget;
}
mCGContext = mBorrowedContext.Init(dt);
MOZ_ASSERT(mCGContext);
return mCGContext;
}
gfxPoint deviceOffset;
nsRefPtr<gfxASurface> surf = mContext->CurrentSurface(&deviceOffset.x, &deviceOffset.y);
if (!surf || surf->CairoStatus())
@ -96,7 +122,34 @@ gfxQuartzNativeDrawing::BeginNativeDrawing()
void
gfxQuartzNativeDrawing::EndNativeDrawing()
{
NS_ASSERTION(mQuartzSurface, "EndNativeDrawing called without BeginNativeDrawing");
NS_ASSERTION(mCGContext, "EndNativeDrawing called without BeginNativeDrawing");
if (mBorrowedContext.cg) {
MOZ_ASSERT(!mContext->IsCairo());
mBorrowedContext.Finish();
if (mDrawTarget) {
DrawTarget *dest = mContext->GetDrawTarget();
RefPtr<SourceSurface> source = mDrawTarget->Snapshot();
IntSize backingSize(NSToIntFloor(mNativeRect.width * mBackingScale),
NSToIntFloor(mNativeRect.height * mBackingScale));
Matrix oldTransform = dest->GetTransform();
Matrix newTransform = oldTransform;
newTransform.Translate(mNativeRect.x, mNativeRect.y);
newTransform.Scale(1.0f / mBackingScale, 1.0f / mBackingScale);
dest->SetTransform(newTransform);
dest->DrawSurface(source,
gfx::Rect(0, 0, backingSize.width, backingSize.height),
gfx::Rect(0, 0, backingSize.width, backingSize.height));
dest->SetTransform(oldTransform);
}
return;
}
cairo_quartz_finish_cg_context_with_clip(mSurfaceContext->GetCairo());
mQuartzSurface->MarkDirty();

View File

@ -56,8 +56,11 @@ private:
gfxQuartzNativeDrawing(const gfxQuartzNativeDrawing&) MOZ_DELETE;
const gfxQuartzNativeDrawing& operator=(const gfxQuartzNativeDrawing&) MOZ_DELETE;
// Final destination context
nsRefPtr<gfxContext> mContext;
mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
mozilla::gfx::BorrowedCGContext mBorrowedContext;
// context that draws to mQuartzSurface; can be different from mContext
// if mContext is not drawing to Quartz
nsRefPtr<gfxContext> mSurfaceContext;

View File

@ -21,10 +21,6 @@
#include "jscntxtinlines.h"
#ifdef JSGC_GENERATIONAL
#include "vm/Shape-inl.h"
#endif
using namespace js;
using mozilla::ArrayLength;

View File

@ -10,6 +10,7 @@
#include "frontend/BytecodeEmitter.h"
#include "frontend/FoldConstants.h"
#include "frontend/NameFunctions.h"
#include "frontend/Parser.h"
#include "ion/AsmJS.h"
#include "vm/GlobalObject.h"
@ -17,8 +18,6 @@
#include "jsscriptinlines.h"
#include "frontend/ParseMaps-inl.h"
#include "frontend/SharedContext-inl.h"
#include "vm/ScopeObject-inl.h"
using namespace js;
using namespace js::frontend;
@ -402,6 +401,8 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
const AutoNameVector &formals, const jschar *chars, size_t length,
bool isAsmJSRecompile)
{
// FIXME: make Function pass in two strings and parse them as arguments and
// ProgramElements respectively.
SkipRoot skip(cx, &chars);
if (!CheckLength(cx, length))
@ -443,41 +444,17 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
fun->setArgCount(formals.length());
/* FIXME: make Function format the source for a function definition. */
ParseNode *fn = CodeNode::create(PNK_FUNCTION, &parser.handler);
if (!fn)
return false;
fn->pn_body = NULL;
fn->pn_funbox = NULL;
fn->pn_cookie.makeFree();
ParseNode *argsbody = ListNode::create(PNK_ARGSBODY, &parser.handler);
if (!argsbody)
return false;
argsbody->setOp(JSOP_NOP);
argsbody->makeEmpty();
fn->pn_body = argsbody;
Rooted<JSScript*> script(cx, JSScript::Create(cx, NullPtr(), false, options,
/* staticLevel = */ 0, sourceObject,
/* sourceStart = */ 0, length));
if (!script)
return false;
// If the context is strict, immediately parse the body in strict
// mode. Otherwise, we parse it normally. If we see a "use strict"
// directive, we backup and reparse it as strict.
ParseNode *fn;
TokenStream::Position start(parser.keepAtoms);
parser.tokenStream.tell(&start);
bool strict = options.strictOption;
bool becameStrict;
FunctionBox *funbox;
ParseNode *pn;
while (true) {
pn = parser.standaloneFunctionBody(fun, formals, script, fn, &funbox,
strict, &becameStrict);
if (pn)
fn = parser.standaloneFunctionBody(fun, formals, strict, &becameStrict);
if (fn)
break;
if (parser.hadAbortedSyntaxParse()) {
@ -495,16 +472,9 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
parser.tokenStream.seek(start);
}
if (!NameFunctions(cx, pn))
if (!NameFunctions(cx, fn))
return false;
if (fn->pn_body) {
JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY));
fn->pn_body->append(pn);
fn->pn_body->pn_pos = pn->pn_pos;
pn = fn->pn_body;
}
bool generateBytecode = true;
#ifdef JS_ION
JS_ASSERT_IF(isAsmJSRecompile, fn->pn_funbox->useAsm);
@ -516,13 +486,20 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
return false;
if (moduleFun) {
funbox->object = moduleFun;
fn->pn_funbox->object = moduleFun;
fun.set(moduleFun); // replace the existing function with the LinkAsmJS native
generateBytecode = false;
}
}
#endif
Rooted<JSScript*> script(cx, JSScript::Create(cx, NullPtr(), false, options,
/* staticLevel = */ 0, sourceObject,
/* sourceStart = */ 0, length));
if (!script)
return false;
script->bindings = fn->pn_funbox->bindings;
if (generateBytecode) {
/*
* The reason for checking fun->environment() below is that certain
@ -531,14 +508,14 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
* NULL environment. This compiled function is never used, but instead
* is cloned immediately onto the right scope chain.
*/
BytecodeEmitter funbce(/* parent = */ NULL, &parser, funbox, script,
BytecodeEmitter funbce(/* parent = */ NULL, &parser, fn->pn_funbox, script,
/* insideEval = */ false, /* evalCaller = */ NullPtr(),
fun->environment() && fun->environment()->is<GlobalObject>(),
options.lineno);
if (!funbce.init())
return false;
if (!EmitFunctionScript(cx, &funbce, pn))
if (!EmitFunctionScript(cx, &funbce, fn->pn_body))
return false;
}

View File

@ -38,7 +38,6 @@
#include "frontend/ParseMaps-inl.h"
#include "frontend/ParseNode-inl.h"
#include "frontend/SharedContext-inl.h"
using namespace js;
using namespace js::gc;

View File

@ -384,6 +384,10 @@ class FullParseHandler
pn->append(kid);
}
bool isUnparenthesizedYield(ParseNode *pn) {
return pn->isKind(PNK_YIELD) && !pn->isInParens();
}
void setOp(ParseNode *pn, JSOp op) {
pn->setOp(op);
}

View File

@ -8,9 +8,6 @@
#include "frontend/FullParseHandler.h"
#include "frontend/SyntaxParseHandler.h"
#include "frontend/ParseMaps-inl.h"
#include "vm/String-inl.h"
using namespace js;
using namespace js::frontend;

View File

@ -213,20 +213,17 @@ enum ParseNodeKind
* object containing arg and var properties. We
* create the function object at parse (not emit)
* time to specialize arg and var bytecodes early.
* pn_body: PNK_ARGSBODY if formal parameters,
* PNK_STATEMENTLIST node for function body
* statements,
* PNK_RETURN for expression closure, or
* PNK_SEQ for expression closure with
* destructured formal parameters
* PNK_LEXICALSCOPE for implicit function
* in generator-expression
* pn_body: PNK_ARGSBODY, ordinarily;
* PNK_LEXICALSCOPE for implicit function in genexpr
* pn_cookie: static level and var index for function
* pn_dflags: PND_* definition/use flags (see below)
* pn_blockid: block id number
* PNK_ARGSBODY list list of formal parameters followed by
* PNK_STATEMENTLIST node for function body
* statements as final element
* PNK_ARGSBODY list list of formal parameters followed by:
* PNK_STATEMENTLIST node for function body
* statements,
* PNK_RETURN for expression closure, or
* PNK_SEQ for expression closure with
* destructured formal parameters
* pn_count: 1 + number of formal parameters
* pn_tree: PNK_ARGSBODY or PNK_STATEMENTLIST node
* PNK_SPREAD unary pn_kid: expression being spread

View File

@ -43,7 +43,6 @@
#include "frontend/ParseMaps-inl.h"
#include "frontend/ParseNode-inl.h"
#include "frontend/SharedContext-inl.h"
#include "vm/NumericConversions.h"
@ -836,18 +835,28 @@ Parser<ParseHandler>::checkStrictBinding(HandlePropertyName name, Node pn)
template <>
ParseNode *
Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals,
HandleScript script, Node fn, FunctionBox **funbox,
bool strict, bool *becameStrict)
{
if (becameStrict)
*becameStrict = false;
*funbox = newFunctionBox(fun, /* outerpc = */ NULL, strict);
Node fn = handler.newFunctionDefinition();
if (!fn)
return null();
ParseNode *argsbody = ListNode::create(PNK_ARGSBODY, &handler);
if (!argsbody)
return null();
argsbody->setOp(JSOP_NOP);
argsbody->makeEmpty();
fn->pn_body = argsbody;
FunctionBox *funbox = newFunctionBox(fun, /* outerpc = */ NULL, strict);
if (!funbox)
return null();
handler.setFunctionBox(fn, *funbox);
handler.setFunctionBox(fn, funbox);
ParseContext<FullParseHandler> funpc(this, pc, *funbox, /* staticLevel = */ 0, /* bodyid = */ 0);
ParseContext<FullParseHandler> funpc(this, pc, funbox, /* staticLevel = */ 0, /* bodyid = */ 0);
if (!funpc.init())
return null();
@ -871,18 +880,15 @@ Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoN
if (!FoldConstants(context, &pn, this))
return null();
InternalHandle<Bindings*> scriptBindings(script, &script->bindings);
if (!funpc.generateFunctionBindings(context, alloc, scriptBindings))
return null();
// Also populate the internal bindings of the function box, so that
// heavyweight tests while emitting bytecode work.
InternalHandle<Bindings*> funboxBindings =
InternalHandle<Bindings*>::fromMarkedLocation(&(*funbox)->bindings);
InternalHandle<Bindings*>::fromMarkedLocation(&funbox->bindings);
if (!funpc.generateFunctionBindings(context, alloc, funboxBindings))
return null();
return pn;
JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY));
fn->pn_body->append(pn);
fn->pn_body->pn_pos = pn->pn_pos;
return fn;
}
template <>
@ -1925,7 +1931,6 @@ Parser<ParseHandler>::functionDef(HandlePropertyName funName, const TokenStream:
// If the outer scope is strict, immediately parse the function in strict
// mode. Otherwise, we parse it normally. If we see a "use strict"
// directive, we backup and reparse it as strict.
handler.setFunctionBody(pn, null());
bool initiallyStrict = pc->sc->strict;
bool becameStrict;
if (!functionArgsAndBody(pn, fun, funName, startOffset, type, kind, initiallyStrict,
@ -4478,6 +4483,8 @@ template <>
ParseNode *
Parser<FullParseHandler>::withStatement()
{
// test262/ch12/12.10/12.10-0-1.js fails if we try to parse with-statements
// in syntax-parse mode. See bug 892583.
if (handler.syntaxParser) {
handler.disableSyntaxParser();
abortedSyntaxParse = true;
@ -4775,34 +4782,28 @@ template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::statement(bool canHaveDirectives)
{
Node pn;
JS_CHECK_RECURSION(context, return null());
switch (tokenStream.getToken(TSF_OPERAND)) {
switch (TokenKind tt = tokenStream.getToken(TSF_OPERAND)) {
case TOK_LC:
return blockStatement();
case TOK_VAR:
pn = variables(PNK_VAR);
if (!pn)
return null();
/* Tell js_EmitTree to generate a final POP. */
handler.setListFlag(pn, PNX_POPVAR);
break;
case TOK_CONST:
if (!abortIfSyntaxParser())
return null();
pn = variables(PNK_CONST);
// FALL THROUGH
case TOK_VAR: {
Node pn = variables(tt == TOK_CONST ? PNK_CONST : PNK_VAR);
if (!pn)
return null();
/* Tell js_EmitTree to generate a final POP. */
// Tell js_EmitTree to generate a final POP.
handler.setListFlag(pn, PNX_POPVAR);
break;
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return pn;
}
#if JS_HAS_BLOCK_SCOPE
case TOK_LET:
@ -4870,50 +4871,29 @@ Parser<ParseHandler>::statement(bool canHaveDirectives)
default:
return expressionStatement();
}
/* Check termination of this primitive statement. */
return MatchOrInsertSemicolon(tokenStream) ? pn : null();
}
template <>
ParseNode *
Parser<FullParseHandler>::expr()
{
ParseNode *pn = assignExpr();
if (pn && tokenStream.matchToken(TOK_COMMA)) {
ParseNode *pn2 = ListNode::create(PNK_COMMA, &handler);
if (!pn2)
return null();
pn2->pn_pos.begin = pn->pn_pos.begin;
pn2->initList(pn);
pn = pn2;
do {
pn2 = pn->last();
if (pn2->isKind(PNK_YIELD) && !pn2->isInParens()) {
report(ParseError, false, pn2, JSMSG_BAD_GENERATOR_SYNTAX, js_yield_str);
return null();
}
pn2 = assignExpr();
if (!pn2)
return null();
pn->append(pn2);
} while (tokenStream.matchToken(TOK_COMMA));
pn->pn_pos.end = pn->last()->pn_pos.end;
}
return pn;
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::expr()
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::expr()
{
Node pn = assignExpr();
if (pn && tokenStream.matchToken(TOK_COMMA)) {
Node seq = handler.newList(PNK_COMMA, pn);
if (!seq)
return null();
do {
if (!assignExpr())
if (handler.isUnparenthesizedYield(pn)) {
report(ParseError, false, pn, JSMSG_BAD_GENERATOR_SYNTAX, js_yield_str);
return null();
}
pn = assignExpr();
if (!pn)
return null();
handler.addList(seq, pn);
} while (tokenStream.matchToken(TOK_COMMA));
return SyntaxParseHandler::NodeGeneric;
return seq;
}
return pn;
}

View File

@ -402,9 +402,8 @@ class Parser : private AutoGCRooter, public StrictModeGetter
bool maybeParseDirective(Node pn, bool *cont);
// Parse a function, given only its body. Used for the Function constructor.
Node standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals, HandleScript script,
Node fn, FunctionBox **funbox, bool strict,
bool *becameStrict = NULL);
Node standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals,
bool strict, bool *becameStrict);
// Parse a function, given only its arguments and body. Used for lazily
// parsed functions.
@ -582,14 +581,6 @@ class Parser : private AutoGCRooter, public StrictModeGetter
/* Declare some required template specializations. */
template <>
ParseNode *
Parser<FullParseHandler>::expr();
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::expr();
template <>
bool
Parser<FullParseHandler>::setAssignmentLhsOps(ParseNode *pn, bool isPlainAssignment);

View File

@ -1,25 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* 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 frontend_SharedContext_inl_h
#define frontend_SharedContext_inl_h
#include "frontend/Parser.h"
#include "frontend/SharedContext.h"
namespace js {
namespace frontend {
inline bool
SharedContext::needStrictChecks()
{
return strict || extraWarnings;
}
} /* namespace frontend */
} // namespace js
#endif /* frontend_SharedContext_inl_h */

View File

@ -180,7 +180,9 @@ class SharedContext
void setHasDebuggerStatement() { anyCxFlags.hasDebuggerStatement = true; }
// JSOPTION_EXTRA_WARNINGS warnings or strict mode errors.
inline bool needStrictChecks();
bool needStrictChecks() {
return strict || extraWarnings;
}
};
class GlobalSharedContext : public SharedContext

View File

@ -174,6 +174,7 @@ class SyntaxParseHandler
return NodeGeneric;
}
void addList(Node pn, Node kid) {}
bool isUnparenthesizedYield(Node pn) { return false; }
void setOp(Node pn, JSOp op) {}
void setBlockId(Node pn, unsigned blockid) {}

View File

@ -17,7 +17,6 @@
#include "vm/Debugger.h"
#include "vm/TypedArrayObject.h"
#include "gc/Barrier-inl.h"
#include "gc/Nursery-inl.h"
#include "vm/ObjectImpl-inl.h"

View File

@ -12,7 +12,6 @@
#include "vm/ForkJoin.h"
#include "gc/Barrier-inl.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;

View File

@ -377,7 +377,7 @@ class StoreBuffer
/* TODO: profile to find the ideal size for these. */
static const size_t ValueBufferSize = 1 * 1024 * sizeof(ValueEdge);
static const size_t CellBufferSize = 2 * 1024 * sizeof(CellPtrEdge);
static const size_t CellBufferSize = 8 * 1024 * sizeof(CellPtrEdge);
static const size_t SlotBufferSize = 2 * 1024 * sizeof(SlotEdge);
static const size_t WholeCellBufferSize = 2 * 1024 * sizeof(WholeCellEdges);
static const size_t RelocValueBufferSize = 1 * 1024 * sizeof(ValueEdge);

View File

@ -10,7 +10,6 @@
#include "ion/AsmJSModule.h"
#include "assembler/assembler/MacroAssembler.h"
#include "gc/Barrier-inl.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;

View File

@ -17,7 +17,6 @@
#include "vm/Interpreter.h"
#include "ion/BaselineJIT.h"
#include "ion/IonFrames-inl.h"
#include "vm/Stack-inl.h"
using namespace js;

View File

@ -11,8 +11,6 @@
#include "ion/IonSpewer.h"
#include "ion/IonFrames-inl.h"
#include "vm/Stack-inl.h"
#include "jsfuninlines.h"
using namespace js;

View File

@ -12,7 +12,6 @@
#include "ion/IonLinker.h"
#include "ion/IonSpewer.h"
#include "ion/VMFunctions.h"
#include "ion/IonFrames-inl.h"
#include "vm/Interpreter-inl.h"

View File

@ -10,8 +10,6 @@
#include "jsanalyze.h"
#include "vm/Shape-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -14,8 +14,6 @@
#include "ion/IonSpewer.h"
#include "ion/VMFunctions.h"
#include "builtin/Iterator-inl.h"
#include "ion/IonFrames-inl.h"
#include "vm/Interpreter-inl.h"
namespace js {

View File

@ -7,8 +7,6 @@
#include "ion/BaselineIC.h"
#include "ion/BaselineInspector.h"
#include "vm/Shape-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -26,7 +26,6 @@
#include "ion/ParallelSafetyAnalysis.h"
#include "vm/Interpreter-inl.h"
#include "vm/StringObject-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -47,9 +47,7 @@
#include "jsgcinlines.h"
#include "jsinferinlines.h"
#include "gc/Barrier-inl.h"
#include "vm/Stack-inl.h"
#include "ion/IonFrames-inl.h"
#include "ion/CompilerRoot.h"
#include "ion/ExecutionModeInlines.h"
#include "ion/AsmJS.h"
@ -172,6 +170,7 @@ ion::InitializeIon()
IonRuntime::IonRuntime()
: execAlloc_(NULL),
exceptionTail_(NULL),
enterJIT_(NULL),
bailoutHandler_(NULL),
argumentsRectifier_(NULL),
@ -210,6 +209,10 @@ IonRuntime::initialize(JSContext *cx)
if (!functionWrappers_ || !functionWrappers_->init())
return false;
exceptionTail_ = generateExceptionTailStub(cx);
if (!exceptionTail_)
return false;
if (cx->runtime()->jitSupportsFloatingPoint) {
// Initialize some Ion-only stubs that require floating-point support.
if (!bailoutTables_.reserve(FrameSizeClass::ClassLimit().classId()))

View File

@ -19,11 +19,12 @@
#include "ion/Lowering.h"
#include "ion/MIRGraph.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "ion/CompileInfo-inl.h"
#include "ion/ExecutionModeInlines.h"
#include "vm/ScopeObject-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -16,8 +16,6 @@
#include "vm/Shape.h"
#include "ion/IonFrames-inl.h"
#include "vm/Interpreter-inl.h"
using namespace js;

View File

@ -126,6 +126,9 @@ class IonRuntime
// Executable allocator.
JSC::ExecutableAllocator *execAlloc_;
// Shared post-exception-handler tail
IonCode *exceptionTail_;
// Trampoline for entering JIT code. Contains OSR prologue.
IonCode *enterJIT_;
@ -169,6 +172,7 @@ class IonRuntime
AutoFlushCache *flusher_;
private:
IonCode *generateExceptionTailStub(JSContext *cx);
IonCode *generateEnterJIT(JSContext *cx, EnterJitType type);
IonCode *generateArgumentsRectifier(JSContext *cx, ExecutionMode mode, void **returnAddrOut);
IonCode *generateBailoutTable(JSContext *cx, uint32_t frameClass);
@ -284,6 +288,10 @@ class IonCompartment
return rt->bailoutHandler_;
}
IonCode *getExceptionTail() {
return rt->exceptionTail_;
}
IonCode *getBailoutTable(const FrameSizeClass &frameClass);
IonCode *getArgumentsRectifier(ExecutionMode mode) {

View File

@ -7,9 +7,12 @@
#include "ion/ParallelFunctions.h"
#include "ion/IonSpewer.h"
#include "vm/ArrayObject.h"
#include "vm/Interpreter.h"
#include "vm/Interpreter-inl.h"
#include "jsfuninlines.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"
using namespace js;
using namespace ion;

View File

@ -94,57 +94,107 @@ UnreachableCodeElimination::removeUnmarkedBlocksAndCleanup()
return true;
}
bool
UnreachableCodeElimination::enqueue(MBasicBlock *block, BlockList &list)
{
if (block->isMarked())
return true;
block->mark();
marked_++;
return list.append(block);
}
MBasicBlock *
UnreachableCodeElimination::optimizableSuccessor(MBasicBlock *block)
{
// If the last instruction in `block` is a test instruction of a
// constant value, returns the successor that the branch will
// always branch to at runtime. Otherwise, returns NULL.
MControlInstruction *ins = block->lastIns();
if (!ins->isTest())
return NULL;
MTest *testIns = ins->toTest();
MDefinition *v = testIns->getOperand(0);
if (!v->isConstant())
return NULL;
const Value &val = v->toConstant()->value();
BranchDirection bdir = ToBoolean(val) ? TRUE_BRANCH : FALSE_BRANCH;
return testIns->branchSuccessor(bdir);
}
bool
UnreachableCodeElimination::prunePointlessBranchesAndMarkReachableBlocks()
{
Vector<MBasicBlock *, 16, SystemAllocPolicy> worklist;
BlockList worklist, optimizableBlocks;
// Seed with the two entry points.
MBasicBlock *entries[] = { graph_.entryBlock(), graph_.osrBlock() };
for (size_t i = 0; i < sizeof(entries) / sizeof(entries[0]); i++) {
if (entries[i]) {
entries[i]->mark();
marked_++;
if (!worklist.append(entries[i]))
return false;
}
}
// Process everything reachable from there.
// Process everything reachable from the start block, ignoring any
// OSR block.
if (!enqueue(graph_.entryBlock(), worklist))
return false;
while (!worklist.empty()) {
if (mir_->shouldCancel("Eliminate Unreachable Code"))
return false;
MBasicBlock *block = worklist.popCopy();
MControlInstruction *ins = block->lastIns();
// Rewrite test false or test true to goto.
if (ins->isTest()) {
MTest *testIns = ins->toTest();
MDefinition *v = testIns->getOperand(0);
if (v->isConstant()) {
const Value &val = v->toConstant()->value();
BranchDirection bdir = ToBoolean(val) ? TRUE_BRANCH : FALSE_BRANCH;
MBasicBlock *succ = testIns->branchSuccessor(bdir);
MGoto *gotoIns = MGoto::New(succ);
block->discardLastIns();
block->end(gotoIns);
MBasicBlock *successorWithPhis = block->successorWithPhis();
if (successorWithPhis && successorWithPhis != succ)
block->setSuccessorWithPhis(NULL, 0);
}
}
for (size_t i = 0; i < block->numSuccessors(); i++) {
MBasicBlock *succ = block->getSuccessor(i);
if (!succ->isMarked()) {
succ->mark();
marked_++;
if (!worklist.append(succ))
// If this block is a test on a constant operand, only enqueue
// the relevant successor. Also, remember the block for later.
if (MBasicBlock *succ = optimizableSuccessor(block)) {
if (!optimizableBlocks.append(block))
return false;
if (!enqueue(succ, worklist))
return false;
} else {
// Otherwise just visit all successors.
for (size_t i = 0; i < block->numSuccessors(); i++) {
MBasicBlock *succ = block->getSuccessor(i);
if (!enqueue(succ, worklist))
return false;
}
}
}
// Now, if there is an OSR block, check that all of its successors
// were reachable (bug 880377). If not, we are in danger of
// creating a CFG with two disjoint parts, so simply mark all
// blocks as reachable. This generally occurs when the TI info for
// stack types is incorrect or incomplete, due to operations that
// have not yet executed in baseline.
if (graph_.osrBlock()) {
MBasicBlock *osrBlock = graph_.osrBlock();
JS_ASSERT(!osrBlock->isMarked());
if (!enqueue(osrBlock, worklist))
return false;
for (size_t i = 0; i < osrBlock->numSuccessors(); i++) {
if (!osrBlock->getSuccessor(i)->isMarked()) {
// OSR block has an otherwise unreachable successor, abort.
for (MBasicBlockIterator iter(graph_.begin()); iter != graph_.end(); iter++)
iter->mark();
marked_ = graph_.numBlocks();
return true;
}
}
}
// Now that we know we will not abort due to OSR, go back and
// transform any tests on constant operands into gotos.
for (uint32_t i = 0; i < optimizableBlocks.length(); i++) {
MBasicBlock *block = optimizableBlocks[i];
MBasicBlock *succ = optimizableSuccessor(block);
JS_ASSERT(succ);
MGoto *gotoIns = MGoto::New(succ);
block->discardLastIns();
block->end(gotoIns);
MBasicBlock *successorWithPhis = block->successorWithPhis();
if (successorWithPhis && successorWithPhis != succ)
block->setSuccessorWithPhis(NULL, 0);
}
return true;
}

View File

@ -17,6 +17,8 @@ class MIRGraph;
class UnreachableCodeElimination
{
typedef Vector<MBasicBlock *, 16, SystemAllocPolicy> BlockList;
MIRGenerator *mir_;
MIRGraph &graph_;
uint32_t marked_;
@ -28,6 +30,9 @@ class UnreachableCodeElimination
bool removeUnmarkedBlocksAndClearDominators();
bool removeUnmarkedBlocksAndCleanup();
bool enqueue(MBasicBlock *block, BlockList &list);
MBasicBlock *optimizableSuccessor(MBasicBlock *block);
public:
UnreachableCodeElimination(MIRGenerator *mir, MIRGraph &graph)
: mir_(mir),

View File

@ -21,10 +21,7 @@
#include "jsboolinlines.h"
#include "ion/IonFrames-inl.h" // for GetTopIonJSScript
#include "vm/Interpreter-inl.h"
#include "vm/StringObject-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -8,7 +8,6 @@
#include "jscompartment.h"
#include "ion/Bailouts.h"
#include "ion/IonCompartment.h"
#include "ion/IonFrames-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -3243,6 +3243,13 @@ MacroAssemblerARMCompat::handleFailureWithHandler(void *handler)
passABIArg(r0);
callWithABI(handler);
IonCode *excTail = GetIonContext()->compartment->ionCompartment()->getExceptionTail();
branch(excTail);
}
void
MacroAssemblerARMCompat::handleFailureWithHandlerTail()
{
Label entryFrame;
Label catch_;
Label finally;

View File

@ -1021,6 +1021,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
void linkExitFrame();
void linkParallelExitFrame(const Register &pt);
void handleFailureWithHandler(void *handler);
void handleFailureWithHandlerTail();
/////////////////////////////////////////////////////////////////
// Common interface.

View File

@ -824,3 +824,14 @@ IonRuntime::generateDebugTrapHandler(JSContext *cx)
Linker linker(masm);
return linker.newCode(cx, JSC::OTHER_CODE);
}
IonCode *
IonRuntime::generateExceptionTailStub(JSContext *cx)
{
MacroAssembler masm;
masm.handleFailureWithHandlerTail();
Linker linker(masm);
return linker.newCode(cx, JSC::OTHER_CODE);
}

View File

@ -8,7 +8,6 @@
#include "jscompartment.h"
#include "ion/Bailouts.h"
#include "ion/IonCompartment.h"
#include "ion/IonFrames-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -14,7 +14,6 @@
#include "jsscriptinlines.h"
#include "ion/shared/CodeGenerator-shared-inl.h"
#include "vm/Shape-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -240,6 +240,13 @@ MacroAssemblerX64::handleFailureWithHandler(void *handler)
passABIArg(rax);
callWithABI(handler);
IonCode *excTail = GetIonContext()->compartment->ionCompartment()->getExceptionTail();
jmp(excTail);
}
void
MacroAssemblerX64::handleFailureWithHandlerTail()
{
Label entryFrame;
Label catch_;
Label finally;

View File

@ -1077,6 +1077,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
void callWithABI(Address fun, Result result = GENERAL);
void handleFailureWithHandler(void *handler);
void handleFailureWithHandlerTail();
void makeFrameDescriptor(Register frameSizeReg, FrameType type) {
shlq(Imm32(FRAMESIZE_SHIFT), frameSizeReg);

View File

@ -715,3 +715,14 @@ IonRuntime::generateDebugTrapHandler(JSContext *cx)
Linker linker(masm);
return linker.newCode(cx, JSC::OTHER_CODE);
}
IonCode *
IonRuntime::generateExceptionTailStub(JSContext *cx)
{
MacroAssembler masm;
masm.handleFailureWithHandlerTail();
Linker linker(masm);
return linker.newCode(cx, JSC::OTHER_CODE);
}

View File

@ -8,7 +8,6 @@
#include "jscompartment.h"
#include "ion/Bailouts.h"
#include "ion/IonCompartment.h"
#include "ion/IonFrames-inl.h"
using namespace js;
using namespace js::ion;

View File

@ -212,6 +212,13 @@ MacroAssemblerX86::handleFailureWithHandler(void *handler)
passABIArg(eax);
callWithABI(handler);
IonCode *excTail = GetIonContext()->compartment->ionCompartment()->getExceptionTail();
jmp(excTail);
}
void
MacroAssemblerX86::handleFailureWithHandlerTail()
{
Label entryFrame;
Label catch_;
Label finally;

View File

@ -940,6 +940,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
// Used from within an Exit frame to handle a pending exception.
void handleFailureWithHandler(void *handler);
void handleFailureWithHandlerTail();
void makeFrameDescriptor(Register frameSizeReg, FrameType type) {
shll(Imm32(FRAMESIZE_SHIFT), frameSizeReg);

View File

@ -741,3 +741,14 @@ IonRuntime::generateDebugTrapHandler(JSContext *cx)
Linker linker(masm);
return linker.newCode(cx, JSC::OTHER_CODE);
}
IonCode *
IonRuntime::generateExceptionTailStub(JSContext *cx)
{
MacroAssembler masm;
masm.handleFailureWithHandlerTail();
Linker linker(masm);
return linker.newCode(cx, JSC::OTHER_CODE);
}

View File

@ -0,0 +1,10 @@
var actual = '';
var obj0 = {}
obj2 = {};
obj2['b'+1] = 1;
if (actual[0] != 0[0])
throw new i();
for (var k in obj2) {
for (var apply in obj0)
++count;
}

View File

@ -82,7 +82,6 @@
#include "vm/Interpreter-inl.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/RegExpObject-inl.h"
#include "vm/RegExpStatics-inl.h"
#include "vm/Shape-inl.h"
#include "vm/String-inl.h"

View File

@ -24,9 +24,6 @@
#include "jscompartmentinlines.h"
#ifdef JSGC_GENERATIONAL
#include "vm/Shape-inl.h"
#endif
#include "vm/String-inl.h"
using namespace js;

View File

@ -23,7 +23,6 @@
#include "jsboolinlines.h"
#include "vm/BooleanObject-inl.h"
#include "vm/GlobalObject-inl.h"
using namespace js;
using namespace js::types;

View File

@ -36,8 +36,8 @@
#include "vm/TypedArrayObject.h"
#include "vm/BooleanObject-inl.h"
#include "vm/RegExpObject-inl.h"
#include "jscntxtinlines.h"
#include "jsobjinlines.h"
using namespace js;

View File

@ -42,7 +42,6 @@
#ifdef JS_ION
#include "ion/Ion.h"
#include "ion/IonFrameIterator.h"
#include "ion/IonFrameIterator-inl.h"
#endif
using namespace js;

View File

@ -37,8 +37,6 @@
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "vm/Stack-inl.h"
#ifdef __SUNPRO_CC
#include <alloca.h>
#endif

View File

@ -990,6 +990,9 @@ static const JSFunctionSpec number_static_methods[] = {
JS_FN("isInteger", Number_isInteger, 1, 0),
JS_FN("isNaN", Number_isNaN, 1, 0),
JS_FN("toInteger", Number_toInteger, 1, 0),
/* ES6 additions. */
JS_FN("parseFloat", num_parseFloat, 1, 0),
JS_FN("parseInt", num_parseInt, 2, 0),
JS_FS_END
};
@ -1001,6 +1004,7 @@ enum nc_slot {
NC_NEGATIVE_INFINITY,
NC_MAX_VALUE,
NC_MIN_VALUE,
NC_EPSILON,
NC_LIMIT
};
@ -1015,6 +1019,8 @@ static JSConstDoubleSpec number_constants[] = {
{0, "NEGATIVE_INFINITY", 0,{0,0,0}},
{1.7976931348623157E+308, "MAX_VALUE", 0,{0,0,0}},
{0, "MIN_VALUE", 0,{0,0,0}},
/* ES6 (May 2013 draft) 15.7.3.7 */
{2.2204460492503130808472633361816e-16, "EPSILON", 0,{0,0,0}},
{0,0,0,{0,0,0}}
};

View File

@ -45,9 +45,8 @@
#include "jsboolinlines.h"
#include "jscntxtinlines.h"
#include "jscompartmentinlines.h"
#include "builtin/Iterator-inl.h"
#include "vm/ArrayObject-inl.h"
#include "vm/ArgumentsObject-inl.h"
#include "vm/BooleanObject-inl.h"
#include "vm/NumberObject-inl.h"
#include "vm/Runtime-inl.h"

View File

@ -34,17 +34,17 @@
#include "frontend/SourceNotes.h"
#include "js/CharacterEncoding.h"
#include "vm/Shape.h"
#include "vm/ScopeObject.h"
#include "vm/StringBuffer.h"
#include "jscntxtinlines.h"
#include "jscompartmentinlines.h"
#include "jsinferinlines.h"
#include "jsopcodeinlines.h"
#include "jsscriptinlines.h"
#include "jsautooplen.h"
#include "vm/RegExpObject-inl.h"
#include "vm/ScopeObject-inl.h"
using namespace js;
using namespace js::gc;

View File

@ -20,8 +20,6 @@
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "vm/RegExpObject-inl.h"
using namespace js;
using namespace js::gc;
using mozilla::ArrayLength;

View File

@ -34,12 +34,12 @@
#include "vm/Shape.h"
#include "vm/Xdr.h"
#include "jsfuninlines.h"
#include "jsinferinlines.h"
#include "jsscriptinlines.h"
#include "vm/Interpreter-inl.h"
#include "vm/RegExpObject-inl.h"
#include "vm/ScopeObject-inl.h"
#include "vm/Stack-inl.h"
using namespace js;
using namespace js::gc;

View File

@ -53,7 +53,6 @@
#include "jsautooplen.h" // generated headers last
#include "vm/Interpreter-inl.h"
#include "vm/RegExpObject-inl.h"
#include "vm/StringObject-inl.h"
#include "vm/String-inl.h"

View File

@ -17,8 +17,6 @@
#include "jsobjinlines.h"
#include "builtin/Iterator-inl.h"
using namespace js;
using namespace js::gc;

View File

@ -8,8 +8,6 @@
#include "jscntxt.h" /* for error messages */
#include "jsobj.h" /* for unwrapping without a context */
#include "vm/ObjectImpl-inl.h"
using JS::PerfMeasurement;
// You cannot forward-declare a static object in C++, so instead

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