Merge mozilla-central to tracemonkey.

This commit is contained in:
Robert Sayre 2010-08-10 17:03:08 -07:00
commit 6e8101a770
7 changed files with 81 additions and 19 deletions

View File

@ -107,7 +107,7 @@ static JSContext *autoconfig_cx = nsnull;
static JSObject *autoconfig_glob;
static JSClass global_class = {
"autoconfig_global", 0,
"autoconfig_global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nsnull
};

View File

@ -7611,13 +7611,14 @@ UpdateViewsForTree(nsIFrame* aFrame, nsIViewManager* aViewManager,
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
|| (child->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)) {
// only do frames that don't have placeholders
if (nsGkAtoms::placeholderFrame == child->GetType()) { // placeholder
// get out of flow frame and start over there
if (nsGkAtoms::placeholderFrame == child->GetType()) {
// do the out-of-flow frame and its continuations
nsIFrame* outOfFlowFrame =
nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
DoApplyRenderingChangeToTree(outOfFlowFrame, aViewManager,
aFrameManager, aChange);
do {
DoApplyRenderingChangeToTree(outOfFlowFrame, aViewManager,
aFrameManager, aChange);
} while (outOfFlowFrame = outOfFlowFrame->GetNextContinuation());
} else if (childList == nsGkAtoms::popupList) {
DoApplyRenderingChangeToTree(child, aViewManager,
aFrameManager, aChange);

View File

@ -22,6 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mats Palmgren <matspal@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -771,12 +772,13 @@ nsresult
nsFrameManager::ReparentStyleContext(nsIFrame* aFrame)
{
if (nsGkAtoms::placeholderFrame == aFrame->GetType()) {
// Also reparent the out-of-flow
// Also reparent the out-of-flow and all its continuations.
nsIFrame* outOfFlow =
nsPlaceholderFrame::GetRealFrameForPlaceholder(aFrame);
NS_ASSERTION(outOfFlow, "no out-of-flow frame");
ReparentStyleContext(outOfFlow);
do {
ReparentStyleContext(outOfFlow);
} while (outOfFlow = outOfFlow->GetNextContinuation());
}
// DO NOT verify the style tree before reparenting. The frame
@ -1470,13 +1472,15 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// |nsFrame::GetParentStyleContextFrame| checks being out
// of flow so that this works correctly.
ReResolveStyleContext(aPresContext, outOfFlowFrame,
content, aChangeList,
NS_SubtractHint(aMinChange,
nsChangeHint_ReflowFrame),
childRestyleHint,
fireAccessibilityEvents,
aRestyleTracker);
do {
ReResolveStyleContext(aPresContext, outOfFlowFrame,
content, aChangeList,
NS_SubtractHint(aMinChange,
nsChangeHint_ReflowFrame),
childRestyleHint,
fireAccessibilityEvents,
aRestyleTracker);
} while (outOfFlowFrame = outOfFlowFrame->GetNextContinuation());
// reresolve placeholder's context under the same parent
// as the out-of-flow frame

View File

@ -2485,8 +2485,10 @@ JSTerm.prototype = {
this.createSandbox();
this.inputNode = this.mixins.inputNode;
this.scrollToNode = this.mixins.scrollToNode;
let eventHandler = this.keyDown();
this.inputNode.addEventListener('keypress', eventHandler, false);
let eventHandlerKeyDown = this.keyDown();
this.inputNode.addEventListener('keypress', eventHandlerKeyDown, false);
let eventHandlerInput = this.inputEventHandler();
this.inputNode.addEventListener('input', eventHandlerInput, false);
this.outputNode = this.mixins.outputNode;
if (this.mixins.cssClassOverride) {
this.cssClassOverride = this.mixins.cssClassOverride;
@ -2614,6 +2616,16 @@ JSTerm.prototype = {
outputNode.lastTimestamp = 0;
},
inputEventHandler: function JSTF_inputEventHandler()
{
var self = this;
function handleInputEvent(aEvent) {
self.inputNode.setAttribute("rows",
Math.min(8, self.inputNode.value.split("\n").length));
}
return handleInputEvent;
},
keyDown: function JSTF_keyDown(aEvent)
{
var self = this;
@ -2657,6 +2669,7 @@ JSTerm.prototype = {
case 13:
// return
self.execute();
aEvent.preventDefault();
break;
case 38:
// up arrow: history previous
@ -2771,7 +2784,7 @@ JSTerm.prototype = {
{
var firstLineBreak = this.codeInputString.indexOf("\n");
return ((firstLineBreak == -1) ||
(this.codeInputString.selectionStart <= firstLineBreak));
(this.inputNode.selectionStart <= firstLineBreak));
},
caretInLastLine: function JSTF_caretInLastLine()
@ -2951,6 +2964,8 @@ JSTermFirefoxMixin.prototype = {
{
let inputNode = this.xulElementFactory("textbox");
inputNode.setAttribute("class", "jsterm-input-node");
inputNode.setAttribute("multiline", "true");
inputNode.setAttribute("rows", "1");
if (this.existingConsoleNode == undefined) {
// create elements

View File

@ -573,6 +573,39 @@ function testCompletion()
is(input.selectionEnd, 23, "end selection is alright");
}
function testJSInputExpand()
{
let HUD = HUDService.hudWeakReferences[hudId].get();
let jsterm = HUD.jsterm;
let input = jsterm.inputNode;
input.focus();
is(input.getAttribute("multiline"), "true", "multiline is enabled");
// Tests if the inputNode expands.
input.value = "hello\nworld\n";
let length = input.value.length;
input.selectionEnd = length;
input.selectionStart = length;
// Performs an "d". This will trigger/test for the input event that should
// change the "row" attribute of the inputNode.
EventUtils.synthesizeKey("d", {});
is(input.getAttribute("rows"), "3", "got 3 rows");
// Add some more rows. Tests for the 8 row limit.
input.value = "row1\nrow2\nrow3\nrow4\nrow5\nrow6\nrow7\nrow8\nrow9\nrow10\n";
length = input.value.length;
input.selectionEnd = length;
input.selectionStart = length;
EventUtils.synthesizeKey("d", {});
is(input.getAttribute("rows"), "8", "got 8 rows");
// Test if the inputNode shrinks again.
input.value = "";
EventUtils.synthesizeKey("d", {});
is(input.getAttribute("rows"), "1", "got 1 row");
}
function testExecutionScope()
{
content.location.href = TEST_URI;
@ -844,6 +877,7 @@ function test() {
testExecutionScope();
testCompletion();
testPropertyProvider();
testJSInputExpand();
testNet();
});
}, false);

View File

@ -157,6 +157,10 @@
-moz-appearance: none !important;
}
.jsterm-input-node textarea {
overflow-x: hidden;
}
.jsterm-output-line {
font-size: 1.2em;
}

View File

@ -156,6 +156,10 @@
-moz-appearance: none !important;
}
.jsterm-input-node textarea {
overflow-x: hidden;
}
.jsterm-output-line {
font-size: 1.2em;
}