зеркало из https://github.com/mozilla/pjs.git
Merge from mozilla-inbound to mozilla-central
This commit is contained in:
Коммит
c7688439bc
|
@ -7,6 +7,10 @@
|
|||
(^|/)ID$
|
||||
(^|/)\.DS_Store$
|
||||
|
||||
# Vim swap files.
|
||||
^\.sw.$
|
||||
.[^/]*\.sw.$
|
||||
|
||||
# User files that may appear at the root
|
||||
^\.mozconfig
|
||||
^mozconfig$
|
||||
|
|
|
@ -1612,7 +1612,7 @@ nsHTMLEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> listItem = IsInListItem(blockParent);
|
||||
if (listItem)
|
||||
if (listItem && listItem != hostNode)
|
||||
{
|
||||
res = ReturnInListItem(aSelection, listItem, node, offset);
|
||||
*aHandled = PR_TRUE;
|
||||
|
@ -6507,6 +6507,7 @@ nsHTMLEditRules::MakeTransitionList(nsCOMArray<nsIDOMNode>& inArrayOfNodes,
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// IsInListItem: if aNode is the descendant of a listitem, return that li.
|
||||
// But table element boundaries are stoppers on the search.
|
||||
// Also stops on the active editor host (contenteditable).
|
||||
// Also test if aNode is an li itself.
|
||||
//
|
||||
nsCOMPtr<nsIDOMNode>
|
||||
|
@ -6520,6 +6521,7 @@ nsHTMLEditRules::IsInListItem(nsIDOMNode *aNode)
|
|||
|
||||
while (parent)
|
||||
{
|
||||
if (!mHTMLEditor->IsNodeInActiveEditor(parent)) return nsnull;
|
||||
if (nsHTMLEditUtils::IsTableElement(parent)) return nsnull;
|
||||
if (nsHTMLEditUtils::IsListItem(parent)) return parent;
|
||||
tmp=parent; tmp->GetParentNode(getter_AddRefs(parent));
|
||||
|
|
|
@ -73,6 +73,7 @@ _TEST_FILES = \
|
|||
file_bug549262.html \
|
||||
test_bug550434.html \
|
||||
test_bug551704.html \
|
||||
test_bug570144.html \
|
||||
test_bug592592.html \
|
||||
test_bug597784.html \
|
||||
test_bug599322.html \
|
||||
|
|
|
@ -84,8 +84,8 @@ function split(element, caretPos) {
|
|||
// put the caret on the requested position
|
||||
var range = document.createRange();
|
||||
var sel = window.getSelection();
|
||||
range.setStart(element.firstChild, len);
|
||||
range.setEnd(element.firstChild, len);
|
||||
range.setStart(element.firstChild, pos);
|
||||
range.setEnd(element.firstChild, pos);
|
||||
sel.addRange(range);
|
||||
|
||||
// simulates a [Return] keypress
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=570144
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 570144</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.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=570144">Mozilla Bug 570144</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<!-- editable paragraphs in list item -->
|
||||
<section id="test1">
|
||||
<ol>
|
||||
<li><p contenteditable>foo</p></li>
|
||||
</ol>
|
||||
<ul>
|
||||
<li><p contenteditable>foo</p></li>
|
||||
</ul>
|
||||
<dl>
|
||||
<dt>foo</dt>
|
||||
<dd><p contenteditable>bar</p></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<!-- paragraphs in editable list item -->
|
||||
<section id="test2">
|
||||
<ol>
|
||||
<li contenteditable><p>foo</p></li>
|
||||
</ol>
|
||||
<ul>
|
||||
<li contenteditable><p>foo</p></li>
|
||||
</ul>
|
||||
<dl>
|
||||
<dt>foo</dt>
|
||||
<dd contenteditable><p>bar</p></dd>
|
||||
</dl>
|
||||
</section>
|
||||
<!-- paragraphs in editable list -->
|
||||
<section id="test3">
|
||||
<ol contenteditable>
|
||||
<li><p>foo</p></li>
|
||||
</ol>
|
||||
<ul contenteditable>
|
||||
<li><p>foo</p></li>
|
||||
</ul>
|
||||
<dl contenteditable>
|
||||
<dt>foo</dt>
|
||||
<dd><p>bar</p></dd>
|
||||
</dl>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 570144 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
|
||||
function try2split(list) {
|
||||
var editor = list.hasAttribute("contenteditable")
|
||||
? list : list.querySelector("*[contenteditable]");
|
||||
editor.focus();
|
||||
// put the caret at the end of the paragraph
|
||||
var selection = window.getSelection();
|
||||
if (editor.nodeName.toLowerCase() == "p")
|
||||
selection.selectAllChildren(editor);
|
||||
else
|
||||
selection.selectAllChildren(editor.querySelector("p"));
|
||||
selection.collapseToEnd();
|
||||
// simulate a [Return] keypress
|
||||
synthesizeKey("VK_RETURN", {});
|
||||
}
|
||||
|
||||
function testSection(element, context, shouldCreateLI, shouldCreateP) {
|
||||
var nbLI = shouldCreateLI ? 2 : 1; // number of expected list items
|
||||
var nbP = shouldCreateP ? 2 : 1; // number of expected paragraphs
|
||||
|
||||
function message(nodeName, dup) {
|
||||
return context + ":[Return] should " + (dup ? "" : "not ")
|
||||
+ "create another <" + nodeName + ">."
|
||||
}
|
||||
var msgP = message("p", shouldCreateP);
|
||||
var msgLI = message("li", shouldCreateLI);
|
||||
var msgDT = message("dt", shouldCreateLI);
|
||||
var msgDD = message("dd", false);
|
||||
|
||||
const ol = element.querySelector("ol");
|
||||
try2split(ol);
|
||||
is(ol.querySelectorAll("li").length, nbLI, msgLI);
|
||||
is(ol.querySelectorAll("p").length, nbP, msgP);
|
||||
|
||||
const ul = element.querySelector("ul");
|
||||
try2split(ul);
|
||||
is(ul.querySelectorAll("li").length, nbLI, msgLI);
|
||||
is(ul.querySelectorAll("p").length, nbP, msgP);
|
||||
|
||||
const dl = element.querySelector("dl");
|
||||
try2split(dl);
|
||||
is(dl.querySelectorAll("dt").length, nbLI, msgDT);
|
||||
is(dl.querySelectorAll("dd").length, 1, msgDD);
|
||||
is(dl.querySelectorAll("p").length, nbP, msgP);
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
testSection(document.getElementById("test1"), "editable paragraph in list item", false, false);
|
||||
testSection(document.getElementById("test2"), "paragraph in editable list item", false, true);
|
||||
testSection(document.getElementById("test3"), "paragraph in editable list", true, false);
|
||||
/* Note: concerning #test3, it would be preferrable that [Return] creates
|
||||
* another paragraph in another list item (i.e. last argument = 'true').
|
||||
* Currently it just creates an empty list item, which is acceptable.
|
||||
*/
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: foo;
|
||||
src: url(Prototype.ttf);
|
||||
}
|
||||
body {
|
||||
font-family: foo;
|
||||
font-size: 2000px;
|
||||
font-weight: 900;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
xyzzy
|
||||
</body>
|
||||
</html>
|
Двоичный файл не отображается.
|
@ -84,3 +84,4 @@ load 594654-1.xhtml
|
|||
load 595727-1.html
|
||||
load 633453-1.html
|
||||
load 633322-1.html
|
||||
load 686190-1.html
|
||||
|
|
|
@ -1111,10 +1111,10 @@ struct GlyphBuffer {
|
|||
|
||||
void Flush(cairo_t *aCR, PRBool aDrawToPath, PRBool aReverse,
|
||||
PRBool aFinish = PR_FALSE) {
|
||||
// Ensure there's enough room for at least two glyphs in the
|
||||
// buffer (because we may allocate two glyphs between flushes)
|
||||
if (!aFinish && mNumGlyphs + 2 <= GLYPH_BUFFER_SIZE)
|
||||
// Ensure there's enough room for a glyph to be added to the buffer
|
||||
if (!aFinish && mNumGlyphs < GLYPH_BUFFER_SIZE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aReverse) {
|
||||
for (PRUint32 i = 0; i < mNumGlyphs/2; ++i) {
|
||||
|
@ -1222,6 +1222,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
}
|
||||
glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||
glyph->y = ToDeviceUnits(y, devUnitsPerAppUnit);
|
||||
glyphs.Flush(cr, aDrawToPath, isRTL);
|
||||
|
||||
// synthetic bolding by multi-striking with 1-pixel offsets
|
||||
// at least once, more if there's room (large font sizes)
|
||||
|
@ -1237,10 +1238,9 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
devUnitsPerAppUnit);
|
||||
doubleglyph->y = glyph->y;
|
||||
strikeOffset += synBoldOnePixelOffset;
|
||||
glyphs.Flush(cr, aDrawToPath, isRTL);
|
||||
} while (--strikeCount > 0);
|
||||
}
|
||||
|
||||
glyphs.Flush(cr, aDrawToPath, isRTL);
|
||||
} else {
|
||||
PRUint32 glyphCount = glyphData->GetGlyphCount();
|
||||
if (glyphCount > 0) {
|
||||
|
@ -1275,6 +1275,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
}
|
||||
glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||
glyph->y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit);
|
||||
glyphs.Flush(cr, aDrawToPath, isRTL);
|
||||
|
||||
if (IsSyntheticBold()) {
|
||||
double strikeOffset = synBoldOnePixelOffset;
|
||||
|
@ -1289,10 +1290,9 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
devUnitsPerAppUnit);
|
||||
doubleglyph->y = glyph->y;
|
||||
strikeOffset += synBoldOnePixelOffset;
|
||||
glyphs.Flush(cr, aDrawToPath, isRTL);
|
||||
} while (--strikeCount > 0);
|
||||
}
|
||||
|
||||
glyphs.Flush(cr, aDrawToPath, isRTL);
|
||||
}
|
||||
x += direction*advance;
|
||||
}
|
||||
|
|
|
@ -989,7 +989,9 @@ public:
|
|||
|
||||
void imull_i32r(RegisterID src, int32_t value, RegisterID dst)
|
||||
{
|
||||
FIXME_INSN_PRINTING;
|
||||
js::JaegerSpew(js::JSpew_Insns,
|
||||
IPFX "imull %d, %s, %s\n",
|
||||
MAYBE_PAD, value, nameIReg(4, src), nameIReg(4, dst));
|
||||
m_formatter.oneByteOp(OP_IMUL_GvEvIz, dst, src);
|
||||
m_formatter.immediate32(value);
|
||||
}
|
||||
|
|
|
@ -4353,7 +4353,7 @@ static JSBool
|
|||
EmitVariables(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn,
|
||||
JSBool inLetHead, ptrdiff_t *headNoteIndex)
|
||||
{
|
||||
bool let, forInVar, first;
|
||||
bool forInVar, first;
|
||||
ptrdiff_t off, noteIndex, tmp;
|
||||
JSParseNode *pn2, *pn3, *next;
|
||||
JSOp op;
|
||||
|
@ -4375,7 +4375,7 @@ EmitVariables(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn,
|
|||
* to the start of the block, a 'for (let x = i...) ...' loop evaluates i
|
||||
* in the containing scope, and puts x in the loop body's scope.
|
||||
*/
|
||||
let = (pn->pn_op == JSOP_NOP);
|
||||
DebugOnly<bool> let = (pn->pn_op == JSOP_NOP);
|
||||
forInVar = (pn->pn_xflags & PNX_FORINVAR) != 0;
|
||||
|
||||
off = noteIndex = -1;
|
||||
|
@ -5954,7 +5954,6 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
case TOK_CATCH:
|
||||
{
|
||||
ptrdiff_t catchStart, guardJump;
|
||||
JSObject *blockObj;
|
||||
|
||||
/*
|
||||
* Morph STMT_BLOCK to STMT_CATCH, note the block entry code offset,
|
||||
|
@ -5964,7 +5963,6 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
JS_ASSERT(stmt->type == STMT_BLOCK && (stmt->flags & SIF_SCOPE));
|
||||
stmt->type = STMT_CATCH;
|
||||
catchStart = stmt->update;
|
||||
blockObj = stmt->blockBox->object;
|
||||
|
||||
/* Go up one statement info record to the TRY or FINALLY record. */
|
||||
stmt = stmt->down;
|
||||
|
|
|
@ -592,8 +592,6 @@ static int
|
|||
js_SuspendThread(JSThinLock *tl)
|
||||
{
|
||||
JSFatLock *fl;
|
||||
PRStatus stat;
|
||||
|
||||
if (tl->fat == NULL)
|
||||
fl = tl->fat = GetFatlock(tl);
|
||||
else
|
||||
|
@ -602,7 +600,7 @@ js_SuspendThread(JSThinLock *tl)
|
|||
fl->susp++;
|
||||
PR_Lock(fl->slock);
|
||||
js_UnlockGlobal(tl);
|
||||
stat = PR_WaitCondVar(fl->svar, PR_INTERVAL_NO_TIMEOUT);
|
||||
DebugOnly<PRStatus> stat = PR_WaitCondVar(fl->svar, PR_INTERVAL_NO_TIMEOUT);
|
||||
JS_ASSERT(stat != PR_FAILURE);
|
||||
PR_Unlock(fl->slock);
|
||||
js_LockGlobal(tl);
|
||||
|
@ -622,13 +620,11 @@ static void
|
|||
js_ResumeThread(JSThinLock *tl)
|
||||
{
|
||||
JSFatLock *fl = tl->fat;
|
||||
PRStatus stat;
|
||||
|
||||
JS_ASSERT(fl != NULL);
|
||||
JS_ASSERT(fl->susp > 0);
|
||||
PR_Lock(fl->slock);
|
||||
js_UnlockGlobal(tl);
|
||||
stat = PR_NotifyCondVar(fl->svar);
|
||||
DebugOnly<PRStatus> stat = PR_NotifyCondVar(fl->svar);
|
||||
JS_ASSERT(stat != PR_FAILURE);
|
||||
PR_Unlock(fl->slock);
|
||||
}
|
||||
|
|
|
@ -1675,7 +1675,7 @@ DecompileDestructuring(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc)
|
|||
ptrdiff_t head;
|
||||
JSContext *cx;
|
||||
JSPrinter *jp;
|
||||
JSOp op, saveop;
|
||||
JSOp op;
|
||||
const JSCodeSpec *cs;
|
||||
uintN oplen;
|
||||
jsint i, lasti;
|
||||
|
@ -1710,7 +1710,6 @@ DecompileDestructuring(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc)
|
|||
#endif
|
||||
|
||||
LOAD_OP_DATA(pc);
|
||||
saveop = op;
|
||||
|
||||
switch (op) {
|
||||
case JSOP_POP:
|
||||
|
|
|
@ -662,8 +662,6 @@ mjit::Compiler::jsop_binary_full(FrameEntry *lhs, FrameEntry *rhs, JSOp op,
|
|||
|
||||
case JSOP_MUL:
|
||||
{
|
||||
JS_ASSERT(reg.isSet());
|
||||
|
||||
MaybeJump storeNegZero;
|
||||
bool maybeNegZero = !ignoreOverflow;
|
||||
bool hasConstant = (lhs->isConstant() || rhs->isConstant());
|
||||
|
@ -680,10 +678,19 @@ mjit::Compiler::jsop_binary_full(FrameEntry *lhs, FrameEntry *rhs, JSOp op,
|
|||
storeNegZero = masm.branch32(Assembler::LessThan, nonConstReg, Imm32(0));
|
||||
}
|
||||
|
||||
if (cannotOverflow)
|
||||
masm.mul32(reg.reg(), regs.result);
|
||||
else
|
||||
overflow = masm.branchMul32(Assembler::Overflow, reg.reg(), regs.result);
|
||||
if (cannotOverflow) {
|
||||
if (reg.isSet())
|
||||
masm.mul32(reg.reg(), regs.result);
|
||||
else
|
||||
masm.mul32(Imm32(value), regs.result, regs.result);
|
||||
} else {
|
||||
if (reg.isSet()) {
|
||||
overflow = masm.branchMul32(Assembler::Overflow, reg.reg(), regs.result);
|
||||
} else {
|
||||
overflow = masm.branchMul32(Assembler::Overflow, Imm32(value), regs.result,
|
||||
regs.result);
|
||||
}
|
||||
}
|
||||
|
||||
if (maybeNegZero) {
|
||||
if (hasConstant) {
|
||||
|
|
|
@ -2653,9 +2653,8 @@ FrameState::allocForBinary(FrameEntry *lhs, FrameEntry *rhs, JSOp op, BinaryAllo
|
|||
}
|
||||
|
||||
/*
|
||||
* Data is a little more complicated. If the op is MUL, not all CPUs
|
||||
* have multiplication on immediates, so a register is needed. Also,
|
||||
* if the op is not commutative, the LHS _must_ be in a register.
|
||||
* Allocate data registers. If the op is not commutative, the LHS
|
||||
* _must_ be in a register.
|
||||
*/
|
||||
JS_ASSERT_IF(lhs->isConstant(), !rhs->isConstant());
|
||||
JS_ASSERT_IF(rhs->isConstant(), !lhs->isConstant());
|
||||
|
@ -2664,23 +2663,16 @@ FrameState::allocForBinary(FrameEntry *lhs, FrameEntry *rhs, JSOp op, BinaryAllo
|
|||
if (backingLeft->data.inMemory()) {
|
||||
alloc.lhsData = tempRegForData(lhs);
|
||||
pinReg(alloc.lhsData.reg());
|
||||
} else if (op == JSOP_MUL || !commu) {
|
||||
} else if (!commu) {
|
||||
JS_ASSERT(lhs->isConstant());
|
||||
alloc.lhsData = allocReg();
|
||||
alloc.extraFree = alloc.lhsData;
|
||||
masm.move(Imm32(lhs->getValue().toInt32()), alloc.lhsData.reg());
|
||||
}
|
||||
}
|
||||
if (!alloc.rhsData.isSet()) {
|
||||
if (backingRight->data.inMemory()) {
|
||||
alloc.rhsData = tempRegForData(rhs);
|
||||
pinReg(alloc.rhsData.reg());
|
||||
} else if (op == JSOP_MUL) {
|
||||
JS_ASSERT(rhs->isConstant());
|
||||
alloc.rhsData = allocReg();
|
||||
alloc.extraFree = alloc.rhsData;
|
||||
masm.move(Imm32(rhs->getValue().toInt32()), alloc.rhsData.reg());
|
||||
}
|
||||
if (!alloc.rhsData.isSet() && backingRight->data.inMemory()) {
|
||||
alloc.rhsData = tempRegForData(rhs);
|
||||
pinReg(alloc.rhsData.reg());
|
||||
}
|
||||
|
||||
alloc.lhsNeedsRemat = false;
|
||||
|
|
|
@ -175,6 +175,7 @@ XPC_MSG_DEF(NS_ERROR_IN_PROGRESS , "The requested action coul
|
|||
XPC_MSG_DEF(NS_ERROR_ALREADY_OPENED , "Channel is already open")
|
||||
XPC_MSG_DEF(NS_ERROR_INVALID_CONTENT_ENCODING , "The content encoding of the source document is incorrect")
|
||||
XPC_MSG_DEF(NS_ERROR_CORRUPTED_CONTENT , "Corrupted content was received from server")
|
||||
XPC_MSG_DEF(NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY, "Couldn't extract first component from potentially corrupted header field")
|
||||
XPC_MSG_DEF(NS_ERROR_ALREADY_CONNECTED , "The connection is already established")
|
||||
XPC_MSG_DEF(NS_ERROR_NOT_CONNECTED , "The connection does not exist")
|
||||
XPC_MSG_DEF(NS_ERROR_CONNECTION_REFUSED , "The connection was refused")
|
||||
|
|
|
@ -1909,7 +1909,12 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
|
|||
innerFrame = NS_NewMathMLmtableFrame(mPresShell, styleContext);
|
||||
else
|
||||
innerFrame = NS_NewTableFrame(mPresShell, styleContext);
|
||||
|
||||
|
||||
if (!innerFrame) {
|
||||
newFrame->Destroy();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
InitAndRestoreFrame(aState, content, newFrame, nsnull, innerFrame);
|
||||
|
||||
// Put the newly created frames into the right child list
|
||||
|
@ -2479,9 +2484,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
|||
// Figure out which frame has the main style for the document element,
|
||||
// assigning it to mRootElementStyleFrame.
|
||||
// Backgrounds should be propagated from that frame to the viewport.
|
||||
PRBool isChild;
|
||||
contentFrame->GetParentStyleContextFrame(state.mPresContext,
|
||||
&mRootElementStyleFrame, &isChild);
|
||||
mRootElementStyleFrame = contentFrame->GetParentStyleContextFrame();
|
||||
bool isChild = mRootElementStyleFrame &&
|
||||
mRootElementStyleFrame->GetParent() == contentFrame;
|
||||
if (!isChild) {
|
||||
mRootElementStyleFrame = mRootElementFrame;
|
||||
}
|
||||
|
@ -5788,13 +5793,8 @@ nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling,
|
|||
// if we haven't already, construct a style context to find the display type of aContent
|
||||
if (UNSET_DISPLAY == aDisplay) {
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
nsIFrame* styleParent;
|
||||
PRBool providerIsChild;
|
||||
if (NS_FAILED(aSibling->
|
||||
GetParentStyleContextFrame(aSibling->PresContext(),
|
||||
&styleParent,
|
||||
&providerIsChild)) ||
|
||||
!styleParent) {
|
||||
nsIFrame* styleParent = aSibling->GetParentStyleContextFrame();
|
||||
if (!styleParent) {
|
||||
NS_NOTREACHED("Shouldn't happen");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -6680,10 +6680,8 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
|||
if (captionItems.NotEmpty()) { // append the caption to the outer table
|
||||
NS_ASSERTION(nsGkAtoms::tableFrame == frameType, "how did that happen?");
|
||||
nsIFrame* outerTable = parentFrame->GetParent();
|
||||
if (outerTable) {
|
||||
state.mFrameManager->AppendFrames(outerTable, nsIFrame::kCaptionList,
|
||||
captionItems);
|
||||
}
|
||||
state.mFrameManager->AppendFrames(outerTable, nsIFrame::kCaptionList,
|
||||
captionItems);
|
||||
}
|
||||
|
||||
if (frameItems.NotEmpty()) { // append the in-flow kids
|
||||
|
|
|
@ -268,7 +268,7 @@ nsFrameManager::Destroy()
|
|||
|
||||
// Placeholder frame functions
|
||||
nsPlaceholderFrame*
|
||||
nsFrameManager::GetPlaceholderFrameFor(nsIFrame* aFrame)
|
||||
nsFrameManager::GetPlaceholderFrameFor(nsIFrame* aFrame)
|
||||
{
|
||||
NS_PRECONDITION(aFrame, "null param unexpected");
|
||||
|
||||
|
@ -587,10 +587,7 @@ VerifyContextParent(nsPresContext* aPresContext, nsIFrame* aFrame,
|
|||
// as the parent context instead of asking the frame
|
||||
|
||||
// get the parent context from the frame (indirectly)
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
PRBool providerIsChild;
|
||||
aFrame->GetParentStyleContextFrame(aPresContext,
|
||||
&providerFrame, &providerIsChild);
|
||||
nsIFrame* providerFrame = aFrame->GetParentStyleContextFrame();
|
||||
if (providerFrame)
|
||||
aParentContext = providerFrame->GetStyleContext();
|
||||
// aParentContext could still be null
|
||||
|
@ -808,13 +805,11 @@ nsFrameManager::ReparentStyleContext(nsIFrame* aFrame)
|
|||
// XXXbz can oldContext really ever be null?
|
||||
if (oldContext) {
|
||||
nsRefPtr<nsStyleContext> newContext;
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
PRBool providerIsChild = PR_FALSE;
|
||||
nsIFrame* providerChild = nsnull;
|
||||
aFrame->GetParentStyleContextFrame(GetPresContext(), &providerFrame,
|
||||
&providerIsChild);
|
||||
nsIFrame* providerFrame = aFrame->GetParentStyleContextFrame();
|
||||
bool isChild = providerFrame && providerFrame->GetParent() == aFrame;
|
||||
nsStyleContext* newParentContext = nsnull;
|
||||
if (providerIsChild) {
|
||||
nsIFrame* providerChild = nsnull;
|
||||
if (isChild) {
|
||||
ReparentStyleContext(providerFrame);
|
||||
newParentContext = providerFrame->GetStyleContext();
|
||||
providerChild = providerFrame;
|
||||
|
@ -1107,11 +1102,9 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
|
|||
nsIFrame* resolvedChild = nsnull;
|
||||
// Get the frame providing the parent style context. If it is a
|
||||
// child, then resolve the provider first.
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
PRBool providerIsChild = PR_FALSE;
|
||||
aFrame->GetParentStyleContextFrame(aPresContext,
|
||||
&providerFrame, &providerIsChild);
|
||||
if (!providerIsChild) {
|
||||
nsIFrame* providerFrame = aFrame->GetParentStyleContextFrame();
|
||||
bool isChild = providerFrame && providerFrame->GetParent() == aFrame;
|
||||
if (!isChild) {
|
||||
if (providerFrame)
|
||||
parentContext = providerFrame->GetStyleContext();
|
||||
else
|
||||
|
|
|
@ -6520,15 +6520,6 @@ nsFrame::ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild)
|
||||
{
|
||||
return DoGetParentStyleContextFrame(aPresContext, aProviderFrame, aIsChild);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function takes a "special" frame and _if_ that frame is an anonymous
|
||||
* block created by an ib split it returns the block's preceding inline. This
|
||||
|
@ -6575,26 +6566,22 @@ GetIBSpecialSiblingForAnonymousBlock(nsIFrame* aFrame)
|
|||
* Also skip anonymous scrolled-content parents; inherit directly from the
|
||||
* outer scroll frame.
|
||||
*/
|
||||
static nsresult
|
||||
GetCorrectedParent(nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||
nsIFrame** aSpecialParent)
|
||||
static nsIFrame*
|
||||
GetCorrectedParent(const nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame *parent = aFrame->GetParent();
|
||||
if (!parent) {
|
||||
*aSpecialParent = nsnull;
|
||||
} else {
|
||||
nsIAtom* pseudo = aFrame->GetStyleContext()->GetPseudo();
|
||||
// Outer tables are always anon boxes; if we're in here for an outer
|
||||
// table, that actually means its the _inner_ table that wants to
|
||||
// know its parent. So get the pseudo of the inner in that case.
|
||||
if (pseudo == nsCSSAnonBoxes::tableOuter) {
|
||||
pseudo = aFrame->GetFirstPrincipalChild()
|
||||
->GetStyleContext()->GetPseudo();
|
||||
}
|
||||
*aSpecialParent = nsFrame::CorrectStyleParentFrame(parent, pseudo);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
// Outer tables are always anon boxes; if we're in here for an outer
|
||||
// table, that actually means its the _inner_ table that wants to
|
||||
// know its parent. So get the pseudo of the inner in that case.
|
||||
nsIAtom* pseudo = aFrame->GetStyleContext()->GetPseudo();
|
||||
if (pseudo == nsCSSAnonBoxes::tableOuter) {
|
||||
pseudo = aFrame->GetFirstPrincipalChild()->GetStyleContext()->GetPseudo();
|
||||
}
|
||||
return nsFrame::CorrectStyleParentFrame(parent, pseudo);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -6659,17 +6646,13 @@ nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrame::DoGetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild)
|
||||
nsIFrame*
|
||||
nsFrame::DoGetParentStyleContextFrame()
|
||||
{
|
||||
*aIsChild = PR_FALSE;
|
||||
*aProviderFrame = nsnull;
|
||||
if (mContent && !mContent->GetParent() &&
|
||||
!GetStyleContext()->GetPseudo()) {
|
||||
// we're a frame for the root. We have no style context parent.
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (!(mState & NS_FRAME_OUT_OF_FLOW)) {
|
||||
|
@ -6679,17 +6662,16 @@ nsFrame::DoGetParentStyleContextFrame(nsPresContext* aPresContext,
|
|||
* inline. We can get to it using GetIBSpecialSiblingForAnonymousBlock.
|
||||
*/
|
||||
if (mState & NS_FRAME_IS_SPECIAL) {
|
||||
*aProviderFrame = GetIBSpecialSiblingForAnonymousBlock(this);
|
||||
|
||||
if (*aProviderFrame) {
|
||||
return NS_OK;
|
||||
nsIFrame* specialSibling = GetIBSpecialSiblingForAnonymousBlock(this);
|
||||
if (specialSibling) {
|
||||
return specialSibling;
|
||||
}
|
||||
}
|
||||
|
||||
// If this frame is one of the blocks that split an inline, we must
|
||||
// return the "special" inline parent, i.e., the parent that this
|
||||
// frame would have if we didn't mangle the frame structure.
|
||||
return GetCorrectedParent(aPresContext, this, aProviderFrame);
|
||||
return GetCorrectedParent(this);
|
||||
}
|
||||
|
||||
// For out-of-flow frames, we must resolve underneath the
|
||||
|
@ -6701,22 +6683,15 @@ nsFrame::DoGetParentStyleContextFrame(nsPresContext* aPresContext,
|
|||
// have placeholders. Use their first-in-flow's placeholder.
|
||||
oofFrame = oofFrame->GetFirstInFlow();
|
||||
}
|
||||
nsIFrame *placeholder =
|
||||
aPresContext->FrameManager()->GetPlaceholderFrameFor(oofFrame);
|
||||
nsIFrame* placeholder = oofFrame->PresContext()->FrameManager()->
|
||||
GetPlaceholderFrameFor(oofFrame);
|
||||
if (!placeholder) {
|
||||
NS_NOTREACHED("no placeholder frame for out-of-flow frame");
|
||||
GetCorrectedParent(aPresContext, this, aProviderFrame);
|
||||
return NS_ERROR_FAILURE;
|
||||
return GetCorrectedParent(this);
|
||||
}
|
||||
return static_cast<nsFrame*>(placeholder)->
|
||||
GetParentStyleContextFrame(aPresContext, aProviderFrame, aIsChild);
|
||||
return placeholder->GetParentStyleContextFrame();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
nsFrame::GetLastLeaf(nsPresContext* aPresContext, nsIFrame **aFrame)
|
||||
{
|
||||
|
|
|
@ -268,9 +268,18 @@ public:
|
|||
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
||||
#endif
|
||||
|
||||
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild);
|
||||
virtual nsIFrame* GetParentStyleContextFrame() {
|
||||
return DoGetParentStyleContextFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the work for getting the parent style context frame so that
|
||||
* other frame's |GetParentStyleContextFrame| methods can call this
|
||||
* method on *another* frame. (This function handles out-of-flow
|
||||
* frames by using the frame manager's placeholder map and it also
|
||||
* handles block-within-inline and generated content wrappers.)
|
||||
*/
|
||||
nsIFrame* DoGetParentStyleContextFrame();
|
||||
|
||||
virtual PRBool IsEmpty();
|
||||
virtual PRBool IsSelfEmpty();
|
||||
|
@ -399,15 +408,6 @@ public:
|
|||
nsHTMLReflowMetrics& aMetrics,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
// Do the work for getting the parent style context frame so that
|
||||
// other frame's |GetParentStyleContextFrame| methods can call this
|
||||
// method on *another* frame. (This function handles out-of-flow
|
||||
// frames by using the frame manager's placeholder map and it also
|
||||
// handles block-within-inline and generated content wrappers.)
|
||||
nsresult DoGetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild);
|
||||
|
||||
// Incorporate the child overflow areas into aOverflowAreas.
|
||||
// If the child does not have a overflow, use the child area.
|
||||
void ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
|
||||
|
|
|
@ -2396,19 +2396,11 @@ public:
|
|||
* this frame returns a child frame, then the child frame must be sure
|
||||
* to return a grandparent or higher!
|
||||
*
|
||||
* @param aPresContext: PresContext
|
||||
* @param aProviderFrame: The frame whose style context should be the
|
||||
* parent of this frame's style context. Null
|
||||
* is permitted, and means that this frame's
|
||||
* style context should be the root of the
|
||||
* style context tree.
|
||||
* @param aIsChild: True if |aProviderFrame| is set to a child
|
||||
* of this frame; false if it is an ancestor or
|
||||
* null.
|
||||
* @return The frame whose style context should be the parent of this frame's
|
||||
* style context. Null is permitted, and means that this frame's
|
||||
* style context should be the root of the style context tree.
|
||||
*/
|
||||
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild) = 0;
|
||||
virtual nsIFrame* GetParentStyleContextFrame() = 0;
|
||||
|
||||
/**
|
||||
* Determines whether a frame is visible for painting;
|
||||
|
|
|
@ -191,20 +191,15 @@ nsPlaceholderFrame::CanContinueTextRun() const
|
|||
return mOutOfFlowFrame->CanContinueTextRun();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild)
|
||||
nsIFrame*
|
||||
nsPlaceholderFrame::GetParentStyleContextFrame()
|
||||
{
|
||||
NS_PRECONDITION(GetParent(), "How can we not have a parent here?");
|
||||
*aIsChild = PR_FALSE;
|
||||
|
||||
// Lie about our pseudo so we can step out of all anon boxes and
|
||||
// pseudo-elements. The other option would be to reimplement the
|
||||
// {ib} split gunk here.
|
||||
*aProviderFrame =
|
||||
CorrectStyleParentFrame(GetParent(), nsGkAtoms::placeholderFrame);
|
||||
return NS_OK;
|
||||
return CorrectStyleParentFrame(GetParent(), nsGkAtoms::placeholderFrame);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -174,9 +174,8 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild);
|
||||
virtual nsIFrame* GetParentStyleContextFrame();
|
||||
|
||||
/**
|
||||
* @return the out-of-flow for aFrame if aFrame is a placeholder; otherwise
|
||||
* aFrame
|
||||
|
|
|
@ -198,8 +198,7 @@ function openSubmenu()
|
|||
synthesizeKey("5", {});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
SimpleTest.waitForFocus(doTest);
|
||||
|
||||
]]></script>
|
||||
</window>
|
||||
|
|
|
@ -458,8 +458,8 @@ nsMathMLmtableOuterFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||
|
||||
// mtable is simple and only has one (pseudo) row-group inside our inner-table
|
||||
nsIFrame* tableFrame = mFrames.FirstChild();
|
||||
if (!tableFrame || tableFrame->GetType() != nsGkAtoms::tableFrame)
|
||||
return NS_OK;
|
||||
NS_ASSERTION(tableFrame && tableFrame->GetType() == nsGkAtoms::tableFrame,
|
||||
"should always have an inner table frame");
|
||||
nsIFrame* rgFrame = tableFrame->GetFirstPrincipalChild();
|
||||
if (!rgFrame || rgFrame->GetType() != nsGkAtoms::tableRowGroupFrame)
|
||||
return NS_OK;
|
||||
|
@ -548,8 +548,8 @@ nsMathMLmtableOuterFrame::GetRowFrameAt(nsPresContext* aPresContext,
|
|||
// if our inner table says that the index is valid, find the row now
|
||||
if (0 <= aRowIndex && aRowIndex <= rowCount) {
|
||||
nsIFrame* tableFrame = mFrames.FirstChild();
|
||||
if (!tableFrame || tableFrame->GetType() != nsGkAtoms::tableFrame)
|
||||
return nsnull;
|
||||
NS_ASSERTION(tableFrame && tableFrame->GetType() == nsGkAtoms::tableFrame,
|
||||
"should always have an inner table frame");
|
||||
nsIFrame* rgFrame = tableFrame->GetFirstPrincipalChild();
|
||||
if (!rgFrame || rgFrame->GetType() != nsGkAtoms::tableRowGroupFrame)
|
||||
return nsnull;
|
||||
|
|
|
@ -336,10 +336,7 @@ nsTableColGroupFrame::RemoveFrame(ChildListID aListID,
|
|||
nsTableColFrame* nextCol;
|
||||
while (col && col->GetColType() == eColAnonymousCol) {
|
||||
#ifdef DEBUG
|
||||
nsIFrame* providerFrame;
|
||||
PRBool isChild;
|
||||
colFrame->GetParentStyleContextFrame(PresContext(), &providerFrame,
|
||||
&isChild);
|
||||
nsIFrame* providerFrame = colFrame->GetParentStyleContextFrame();
|
||||
if (colFrame->GetStyleContext()->GetParent() ==
|
||||
providerFrame->GetStyleContext()) {
|
||||
NS_ASSERTION(col->GetStyleContext() == colFrame->GetStyleContext() &&
|
||||
|
|
|
@ -161,10 +161,8 @@ struct BCPropertyData
|
|||
BCPixelSize mRightCellBorderWidth;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild)
|
||||
nsIFrame*
|
||||
nsTableFrame::GetParentStyleContextFrame()
|
||||
{
|
||||
// Since our parent, the table outer frame, returned this frame, we
|
||||
// must return whatever our parent would normally have returned.
|
||||
|
@ -172,13 +170,10 @@ nsTableFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
|||
NS_PRECONDITION(mParent, "table constructed without outer table");
|
||||
if (!mContent->GetParent() && !GetStyleContext()->GetPseudo()) {
|
||||
// We're the root. We have no style context parent.
|
||||
*aIsChild = PR_FALSE;
|
||||
*aProviderFrame = nsnull;
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return static_cast<nsFrame*>(mParent)->
|
||||
DoGetParentStyleContextFrame(aPresContext, aProviderFrame, aIsChild);
|
||||
return static_cast<nsFrame*>(GetParent())->DoGetParentStyleContextFrame();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -349,9 +349,7 @@ public:
|
|||
|
||||
nsFrameList& GetColGroups();
|
||||
|
||||
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild);
|
||||
virtual nsIFrame* GetParentStyleContextFrame();
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
|
|
|
@ -117,10 +117,8 @@ nsTableCaptionFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableCaptionFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild)
|
||||
nsIFrame*
|
||||
nsTableCaptionFrame::GetParentStyleContextFrame()
|
||||
{
|
||||
NS_PRECONDITION(mContent->GetParent(),
|
||||
"How could we not have a parent here?");
|
||||
|
@ -131,17 +129,13 @@ nsTableCaptionFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
|||
if (outerFrame && outerFrame->GetType() == nsGkAtoms::tableOuterFrame) {
|
||||
nsIFrame* innerFrame = outerFrame->GetFirstPrincipalChild();
|
||||
if (innerFrame) {
|
||||
*aProviderFrame =
|
||||
nsFrame::CorrectStyleParentFrame(innerFrame,
|
||||
GetStyleContext()->GetPseudo());
|
||||
*aIsChild = PR_FALSE;
|
||||
return NS_OK;
|
||||
return nsFrame::CorrectStyleParentFrame(innerFrame,
|
||||
GetStyleContext()->GetPseudo());
|
||||
}
|
||||
}
|
||||
|
||||
NS_NOTREACHED("Where is our inner table frame?");
|
||||
return nsBlockFrame::GetParentStyleContextFrame(aPresContext, aProviderFrame,
|
||||
aIsChild);
|
||||
return nsBlockFrame::GetParentStyleContextFrame();
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
|
@ -245,22 +239,14 @@ nsTableOuterFrame::SetInitialChildList(ChildListID aListID,
|
|||
if (kCaptionList == aListID) {
|
||||
// the frame constructor already checked for table-caption display type
|
||||
mCaptionFrames.SetFrames(aChildList);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(aListID == kPrincipalList, "wrong childlist");
|
||||
NS_ASSERTION(mFrames.IsEmpty(), "Frame leak!");
|
||||
mInnerTableFrame = nsnull;
|
||||
if (aChildList.NotEmpty()) {
|
||||
if (nsGkAtoms::tableFrame == aChildList.FirstChild()->GetType()) {
|
||||
mInnerTableFrame = (nsTableFrame*)aChildList.FirstChild();
|
||||
mFrames.SetFrames(aChildList);
|
||||
}
|
||||
else {
|
||||
NS_ERROR("expected a table frame");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(aChildList.FirstChild() &&
|
||||
nsGkAtoms::tableFrame == aChildList.FirstChild()->GetType(),
|
||||
"expected a table frame");
|
||||
mFrames.SetFrames(aChildList);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -279,7 +265,6 @@ nsTableOuterFrame::AppendFrames(ChildListID aListID,
|
|||
aFrameList.FirstChild()->GetType() == nsGkAtoms::tableCaptionFrame,
|
||||
"appending non-caption frame to captionList");
|
||||
mCaptionFrames.AppendFrames(this, aFrameList);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
rv = NS_OK;
|
||||
|
||||
// Reflow the new caption frame. It's already marked dirty, so
|
||||
|
@ -308,7 +293,6 @@ nsTableOuterFrame::InsertFrames(ChildListID aListID,
|
|||
aFrameList.FirstChild()->GetType() == nsGkAtoms::tableCaptionFrame,
|
||||
"inserting non-caption frame into captionList");
|
||||
mCaptionFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
|
||||
// Reflow the new caption frame. It's already marked dirty, so
|
||||
// just tell the pres shell.
|
||||
|
@ -334,12 +318,11 @@ nsTableOuterFrame::RemoveFrame(ChildListID aListID,
|
|||
if (HasSideCaption()) {
|
||||
// The old caption width had an effect on the inner table width so
|
||||
// we're going to need to reflow it. Mark it dirty
|
||||
mInnerTableFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
InnerTableFrame()->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
// Remove the frame and destroy it
|
||||
mCaptionFrames.DestroyFrame(aOldFrame);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
|
||||
PresContext()->PresShell()->
|
||||
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
||||
|
@ -360,7 +343,7 @@ nsTableOuterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
// If there's no caption, take a short cut to avoid having to create
|
||||
// the special display list set and then sort it.
|
||||
if (!mCaptionFrame)
|
||||
if (mCaptionFrames.IsEmpty())
|
||||
return BuildDisplayListForInnerTable(aBuilder, aDirtyRect, aLists);
|
||||
|
||||
nsDisplayListCollection set;
|
||||
|
@ -368,7 +351,8 @@ nsTableOuterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsDisplayListSet captionSet(set, set.BlockBorderBackgrounds());
|
||||
rv = BuildDisplayListForChild(aBuilder, mCaptionFrame, aDirtyRect, captionSet);
|
||||
rv = BuildDisplayListForChild(aBuilder, mCaptionFrames.FirstChild(),
|
||||
aDirtyRect, captionSet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Now we have to sort everything by content order, since the caption
|
||||
|
@ -400,15 +384,11 @@ nsTableOuterFrame::SetSelected(PRBool aSelected,
|
|||
SelectionType aType)
|
||||
{
|
||||
nsFrame::SetSelected(aSelected, aType);
|
||||
if (mInnerTableFrame) {
|
||||
mInnerTableFrame->SetSelected(aSelected, aType);
|
||||
}
|
||||
InnerTableFrame()->SetSelected(aSelected, aType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild)
|
||||
nsIFrame*
|
||||
nsTableOuterFrame::GetParentStyleContextFrame()
|
||||
{
|
||||
// The table outer frame and the (inner) table frame split the style
|
||||
// data by giving the table frame the style context associated with
|
||||
|
@ -420,14 +400,7 @@ nsTableOuterFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
|||
// children of the table inherit directly from the inner table, and
|
||||
// the outer table's style context is a leaf.
|
||||
|
||||
if (!mInnerTableFrame) {
|
||||
*aProviderFrame = this;
|
||||
*aIsChild = PR_FALSE;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*aProviderFrame = mInnerTableFrame;
|
||||
*aIsChild = PR_TRUE;
|
||||
return NS_OK;
|
||||
return InnerTableFrame();
|
||||
}
|
||||
|
||||
// INCREMENTAL REFLOW HELPER FUNCTIONS
|
||||
|
@ -441,8 +414,9 @@ nsTableOuterFrame::InitChildReflowState(nsPresContext& aPresContext,
|
|||
nsMargin collapsePadding(0,0,0,0);
|
||||
nsMargin* pCollapseBorder = nsnull;
|
||||
nsMargin* pCollapsePadding = nsnull;
|
||||
if ((aReflowState.frame == mInnerTableFrame) && (mInnerTableFrame->IsBorderCollapse())) {
|
||||
collapseBorder = mInnerTableFrame->GetIncludedOuterBCBorder();
|
||||
if (aReflowState.frame == InnerTableFrame() &&
|
||||
InnerTableFrame()->IsBorderCollapse()) {
|
||||
collapseBorder = InnerTableFrame()->GetIncludedOuterBCBorder();
|
||||
pCollapseBorder = &collapseBorder;
|
||||
pCollapsePadding = &collapsePadding;
|
||||
}
|
||||
|
@ -495,11 +469,12 @@ GetContainingBlockSize(const nsHTMLReflowState& aOuterRS)
|
|||
nsTableOuterFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
||||
{
|
||||
nscoord width = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mInnerTableFrame, nsLayoutUtils::MIN_WIDTH);
|
||||
InnerTableFrame(), nsLayoutUtils::MIN_WIDTH);
|
||||
DISPLAY_MIN_WIDTH(this, width);
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nscoord capWidth =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
nsLayoutUtils::MIN_WIDTH);
|
||||
if (HasSideCaption()) {
|
||||
width += capWidth;
|
||||
|
@ -519,15 +494,16 @@ nsTableOuterFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
|||
DISPLAY_PREF_WIDTH(this, maxWidth);
|
||||
|
||||
maxWidth = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mInnerTableFrame, nsLayoutUtils::PREF_WIDTH);
|
||||
if (mCaptionFrame) {
|
||||
InnerTableFrame(), nsLayoutUtils::PREF_WIDTH);
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
PRUint8 captionSide = GetCaptionSide();
|
||||
switch(captionSide) {
|
||||
case NS_STYLE_CAPTION_SIDE_LEFT:
|
||||
case NS_STYLE_CAPTION_SIDE_RIGHT:
|
||||
{
|
||||
nscoord capMin =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
nsLayoutUtils::MIN_WIDTH);
|
||||
maxWidth += capMin;
|
||||
}
|
||||
|
@ -547,7 +523,8 @@ nsTableOuterFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
|||
iwt = nsLayoutUtils::PREF_WIDTH;
|
||||
}
|
||||
nscoord capPref =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
iwt);
|
||||
maxWidth = NS_MAX(maxWidth, capPref);
|
||||
}
|
||||
|
@ -604,22 +581,23 @@ nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
PRUint8 captionSide = GetCaptionSide();
|
||||
nscoord width;
|
||||
if (captionSide == NO_SIDE) {
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, InnerTableFrame(),
|
||||
aCBSize, aAvailableWidth);
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext, mCaptionFrame,
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
aCBSize, aAvailableWidth);
|
||||
width = capWidth + ChildShrinkWrapWidth(aRenderingContext,
|
||||
mInnerTableFrame, aCBSize,
|
||||
InnerTableFrame(), aCBSize,
|
||||
aAvailableWidth - capWidth);
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
||||
nscoord margin;
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, InnerTableFrame(),
|
||||
aCBSize, aAvailableWidth, &margin);
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
||||
mCaptionFrame, aCBSize,
|
||||
mCaptionFrames.FirstChild(), aCBSize,
|
||||
width - margin);
|
||||
if (capWidth > width)
|
||||
width = capWidth;
|
||||
|
@ -627,11 +605,11 @@ nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
||||
"unexpected caption-side");
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, InnerTableFrame(),
|
||||
aCBSize, aAvailableWidth);
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
||||
mCaptionFrame, aCBSize,
|
||||
aAvailableWidth);
|
||||
mCaptionFrames.FirstChild(),
|
||||
aCBSize, aAvailableWidth);
|
||||
if (capWidth > width)
|
||||
width = capWidth;
|
||||
}
|
||||
|
@ -642,8 +620,8 @@ nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
PRUint8
|
||||
nsTableOuterFrame::GetCaptionSide()
|
||||
{
|
||||
if (mCaptionFrame) {
|
||||
return mCaptionFrame->GetStyleTableBorder()->mCaptionSide;
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
return mCaptionFrames.FirstChild()->GetStyleTableBorder()->mCaptionSide;
|
||||
}
|
||||
else {
|
||||
return NO_SIDE; // no caption
|
||||
|
@ -653,7 +631,8 @@ nsTableOuterFrame::GetCaptionSide()
|
|||
PRUint8
|
||||
nsTableOuterFrame::GetCaptionVerticalAlign()
|
||||
{
|
||||
const nsStyleCoord& va = mCaptionFrame->GetStyleTextReset()->mVerticalAlign;
|
||||
const nsStyleCoord& va =
|
||||
mCaptionFrames.FirstChild()->GetStyleTextReset()->mVerticalAlign;
|
||||
return (va.GetUnit() == eStyleUnit_Enumerated)
|
||||
? va.GetIntValue()
|
||||
: NS_STYLE_VERTICAL_ALIGN_TOP;
|
||||
|
@ -668,13 +647,13 @@ nsTableOuterFrame::SetDesiredSize(PRUint8 aCaptionSide,
|
|||
{
|
||||
aWidth = aHeight = 0;
|
||||
|
||||
nsRect innerRect = mInnerTableFrame->GetRect();
|
||||
nsRect innerRect = InnerTableFrame()->GetRect();
|
||||
nscoord innerWidth = innerRect.width;
|
||||
|
||||
nsRect captionRect(0,0,0,0);
|
||||
nscoord captionWidth = 0;
|
||||
if (mCaptionFrame) {
|
||||
captionRect = mCaptionFrame->GetRect();
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
captionRect = mCaptionFrames.FirstChild()->GetRect();
|
||||
captionWidth = captionRect.width;
|
||||
}
|
||||
switch(aCaptionSide) {
|
||||
|
@ -715,7 +694,7 @@ nsTableOuterFrame::GetCaptionOrigin(PRUint32 aCaptionSide,
|
|||
(NS_UNCONSTRAINEDSIZE == aCaptionSize.width) || (NS_UNCONSTRAINEDSIZE == aCaptionSize.height)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!mCaptionFrame) return NS_OK;
|
||||
if (mCaptionFrames.IsEmpty()) return NS_OK;
|
||||
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.left, "The computed caption margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.top, "The computed caption margin is auto?");
|
||||
|
@ -894,7 +873,7 @@ nsTableOuterFrame::OuterBeginReflowChild(nsPresContext* aPresContext,
|
|||
// work around pixel rounding errors, round down to ensure we don't exceed the avail height in
|
||||
nscoord availHeight = aOuterRS.availableHeight;
|
||||
if (NS_UNCONSTRAINEDSIZE != availHeight) {
|
||||
if (mCaptionFrame == aChildFrame) {
|
||||
if (mCaptionFrames.FirstChild() == aChildFrame) {
|
||||
availHeight = NS_UNCONSTRAINEDSIZE;
|
||||
} else {
|
||||
nsMargin margin;
|
||||
|
@ -918,14 +897,14 @@ nsTableOuterFrame::OuterBeginReflowChild(nsPresContext* aPresContext,
|
|||
InitChildReflowState(*aPresContext, childRS);
|
||||
|
||||
// see if we need to reset top of page due to a caption
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
PRUint8 captionSide = GetCaptionSide();
|
||||
if (((captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE) &&
|
||||
mCaptionFrame == aChildFrame) ||
|
||||
mCaptionFrames.FirstChild() == aChildFrame) ||
|
||||
((captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE) &&
|
||||
mInnerTableFrame == aChildFrame)) {
|
||||
InnerTableFrame() == aChildFrame)) {
|
||||
childRS.mFlags.mIsTopOfPage = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -955,9 +934,9 @@ nsTableOuterFrame::UpdateReflowMetrics(PRUint8 aCaptionSide,
|
|||
aMet.width, aMet.height);
|
||||
|
||||
aMet.SetOverflowAreasToDesiredBounds();
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, mInnerTableFrame);
|
||||
if (mCaptionFrame) {
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrame);
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, InnerTableFrame());
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrames.FirstChild());
|
||||
}
|
||||
FinishAndStoreOverflow(&aMet);
|
||||
}
|
||||
|
@ -970,12 +949,6 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aOuterRS, aDesiredSize, aStatus);
|
||||
|
||||
// We desperately need an inner table frame,
|
||||
// if this fails fix the frame constructor
|
||||
if (mFrames.IsEmpty() || !mInnerTableFrame) {
|
||||
NS_ERROR("incomplete children");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = NS_OK;
|
||||
PRUint8 captionSide = GetCaptionSide();
|
||||
|
||||
|
@ -999,36 +972,37 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsHTMLReflowState *innerRS =
|
||||
static_cast<nsHTMLReflowState*>((void*) innerRSSpace);
|
||||
|
||||
nsRect origInnerRect = mInnerTableFrame->GetRect();
|
||||
nsRect origInnerVisualOverflow = mInnerTableFrame->GetVisualOverflowRect();
|
||||
nsRect origInnerRect = InnerTableFrame()->GetRect();
|
||||
nsRect origInnerVisualOverflow = InnerTableFrame()->GetVisualOverflowRect();
|
||||
PRBool innerFirstReflow =
|
||||
(mInnerTableFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
(InnerTableFrame()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
nsRect origCaptionRect;
|
||||
nsRect origCaptionVisualOverflow;
|
||||
PRBool captionFirstReflow;
|
||||
if (mCaptionFrame) {
|
||||
origCaptionRect = mCaptionFrame->GetRect();
|
||||
origCaptionVisualOverflow = mCaptionFrame->GetVisualOverflowRect();
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
origCaptionRect = mCaptionFrames.FirstChild()->GetRect();
|
||||
origCaptionVisualOverflow =
|
||||
mCaptionFrames.FirstChild()->GetVisualOverflowRect();
|
||||
captionFirstReflow =
|
||||
(mCaptionFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
(mCaptionFrames.FirstChild()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
}
|
||||
|
||||
// ComputeAutoSize has to match this logic.
|
||||
if (captionSide == NO_SIDE) {
|
||||
// We don't have a caption.
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
||||
// nsTableCaptionFrame::ComputeAutoSize takes care of making side
|
||||
// captions small. Compute the caption's size first, and tell the
|
||||
// table to fit in what's left.
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, aOuterRS.ComputedWidth());
|
||||
nscoord innerAvailWidth = aOuterRS.ComputedWidth() -
|
||||
(captionRS->ComputedWidth() + captionRS->mComputedMargin.LeftRight() +
|
||||
captionRS->mComputedBorderPadding.LeftRight());
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, innerAvailWidth);
|
||||
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
|
@ -1041,7 +1015,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// table box inside it
|
||||
// We don't actually make our anonymous box that width (if we did,
|
||||
// it would break 'auto' margins), but this effectively does that.
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
// It's good that CSS 2.1 says not to include margins, since we
|
||||
// can't, since they already been converted so they exactly
|
||||
|
@ -1050,16 +1024,16 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// GetCaptionOrigin, though.)
|
||||
nscoord innerBorderWidth = innerRS->ComputedWidth() +
|
||||
innerRS->mComputedBorderPadding.LeftRight();
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, innerBorderWidth);
|
||||
} else {
|
||||
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
||||
"unexpected caption-side");
|
||||
// Size the table and the caption independently.
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, aOuterRS.ComputedWidth());
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
}
|
||||
|
||||
|
@ -1067,10 +1041,10 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsHTMLReflowMetrics captionMet;
|
||||
nsSize captionSize;
|
||||
nsMargin captionMargin;
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nsReflowStatus capStatus; // don't let the caption cause incomplete
|
||||
rv = OuterDoReflowChild(aPresContext, mCaptionFrame, *captionRS,
|
||||
captionMet, capStatus);
|
||||
rv = OuterDoReflowChild(aPresContext, mCaptionFrames.FirstChild(),
|
||||
*captionRS, captionMet, capStatus);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
captionSize.width = captionMet.width;
|
||||
captionSize.height = captionMet.height;
|
||||
|
@ -1114,7 +1088,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// Then, now that we know how much to reduce the width of the inner
|
||||
// table to account for side captions, reflow the inner table.
|
||||
nsHTMLReflowMetrics innerMet;
|
||||
rv = OuterDoReflowChild(aPresContext, mInnerTableFrame, *innerRS,
|
||||
rv = OuterDoReflowChild(aPresContext, InnerTableFrame(), *innerRS,
|
||||
innerMet, aStatus);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsSize innerSize;
|
||||
|
@ -1130,12 +1104,12 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// XXX Need to recompute inner table's auto margins for the case of side
|
||||
// captions. (Caption's are broken too, but that should be fixed earlier.)
|
||||
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nsPoint captionOrigin;
|
||||
GetCaptionOrigin(captionSide, containSize, innerSize,
|
||||
innerMargin, captionSize, captionMargin, captionOrigin);
|
||||
FinishReflowChild(mCaptionFrame, aPresContext, captionRS, captionMet,
|
||||
captionOrigin.x, captionOrigin.y, 0);
|
||||
FinishReflowChild(mCaptionFrames.FirstChild(), aPresContext, captionRS,
|
||||
captionMet, captionOrigin.x, captionOrigin.y, 0);
|
||||
captionRS->~nsHTMLReflowState();
|
||||
}
|
||||
// XXX If the height is constrained then we need to check whether
|
||||
|
@ -1144,14 +1118,14 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsPoint innerOrigin;
|
||||
GetInnerOrigin(captionSide, containSize, captionSize,
|
||||
captionMargin, innerSize, innerMargin, innerOrigin);
|
||||
FinishReflowChild(mInnerTableFrame, aPresContext, innerRS, innerMet,
|
||||
FinishReflowChild(InnerTableFrame(), aPresContext, innerRS, innerMet,
|
||||
innerOrigin.x, innerOrigin.y, 0);
|
||||
innerRS->~nsHTMLReflowState();
|
||||
|
||||
nsTableFrame::InvalidateFrame(mInnerTableFrame, origInnerRect,
|
||||
nsTableFrame::InvalidateFrame(InnerTableFrame(), origInnerRect,
|
||||
origInnerVisualOverflow, innerFirstReflow);
|
||||
if (mCaptionFrame) {
|
||||
nsTableFrame::InvalidateFrame(mCaptionFrame, origCaptionRect,
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nsTableFrame::InvalidateFrame(mCaptionFrames.FirstChild(), origCaptionRect,
|
||||
origCaptionVisualOverflow,
|
||||
captionFirstReflow);
|
||||
}
|
||||
|
@ -1181,20 +1155,16 @@ nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
|
|||
PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
|
||||
PRBool& aIsSelected)
|
||||
{
|
||||
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
||||
|
||||
return mInnerTableFrame->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
aStartRowIndex, aStartColIndex,
|
||||
aRowSpan, aColSpan, aActualRowSpan,
|
||||
aActualColSpan, aIsSelected);
|
||||
return InnerTableFrame()->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
aStartRowIndex, aStartColIndex,
|
||||
aRowSpan, aColSpan, aActualRowSpan,
|
||||
aActualColSpan, aIsSelected);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)
|
||||
{
|
||||
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
||||
|
||||
return mInnerTableFrame->GetTableSize(aRowCount, aColCount);
|
||||
return InnerTableFrame()->GetTableSize(aRowCount, aColCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1202,9 +1172,7 @@ nsTableOuterFrame::GetIndexByRowAndColumn(PRInt32 aRow, PRInt32 aColumn,
|
|||
PRInt32 *aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIndex);
|
||||
|
||||
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
||||
return mInnerTableFrame->GetIndexByRowAndColumn(aRow, aColumn, aIndex);
|
||||
return InnerTableFrame()->GetIndexByRowAndColumn(aRow, aColumn, aIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1213,9 +1181,7 @@ nsTableOuterFrame::GetRowAndColumnByIndex(PRInt32 aIndex,
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aRow);
|
||||
NS_ENSURE_ARG_POINTER(aColumn);
|
||||
|
||||
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
||||
return mInnerTableFrame->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
|
||||
return InnerTableFrame()->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
|
||||
}
|
||||
|
||||
/*---------------- end of nsITableLayout implementation ------------------*/
|
||||
|
|
|
@ -41,9 +41,7 @@
|
|||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsITableLayout.h"
|
||||
|
||||
struct nsStyleTable;
|
||||
class nsTableFrame;
|
||||
#include "nsTableFrame.h"
|
||||
|
||||
class nsTableCaptionFrame : public nsBlockFrame
|
||||
{
|
||||
|
@ -59,9 +57,8 @@ public:
|
|||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap);
|
||||
|
||||
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild);
|
||||
virtual nsIFrame* GetParentStyleContextFrame();
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
||||
#endif
|
||||
|
@ -169,9 +166,7 @@ public:
|
|||
void SetSelected(PRBool aSelected,
|
||||
SelectionType aType);
|
||||
|
||||
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild);
|
||||
virtual nsIFrame* GetParentStyleContextFrame();
|
||||
|
||||
/*---------------- nsITableLayout methods ------------------------*/
|
||||
|
||||
|
@ -262,17 +257,15 @@ protected:
|
|||
nscoord aAvailableWidth,
|
||||
nsMargin& aMargin);
|
||||
|
||||
nsTableFrame* InnerTableFrame() {
|
||||
return static_cast<nsTableFrame*>(mFrames.FirstChild());
|
||||
}
|
||||
|
||||
private:
|
||||
// used to keep track of this frame's children. They are redundant with mFrames, but more convient
|
||||
nsTableFrame* mInnerTableFrame;
|
||||
nsFrameList mCaptionFrames;
|
||||
nsIFrame* mCaptionFrame;
|
||||
};
|
||||
|
||||
inline PRIntn nsTableOuterFrame::GetSkipSides() const
|
||||
{ return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -141,6 +141,11 @@ nsMenuBarListener::ToggleMenuActiveState()
|
|||
nsresult
|
||||
nsMenuBarListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
if (!keyEvent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
InitAccessKey();
|
||||
|
||||
//handlers shouldn't be triggered by non-trusted events.
|
||||
|
@ -159,7 +164,6 @@ nsMenuBarListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
|||
// On a press of the ALT key by itself, we toggle the menu's
|
||||
// active/inactive state.
|
||||
// Get the ascii key code.
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
PRUint32 theChar;
|
||||
keyEvent->GetKeyCode(&theChar);
|
||||
|
||||
|
|
|
@ -1110,6 +1110,7 @@ pref("font.language.group", "chrome://global/locale/intl.propert
|
|||
pref("intl.uidirection.ar", "rtl");
|
||||
pref("intl.uidirection.he", "rtl");
|
||||
pref("intl.uidirection.fa", "rtl");
|
||||
pref("intl.uidirection.ur", "rtl");
|
||||
|
||||
// use en-US hyphenation by default for content tagged with plain lang="en"
|
||||
pref("intl.hyphenation-alias.en", "en-us");
|
||||
|
|
|
@ -152,6 +152,17 @@
|
|||
#define NS_ERROR_CORRUPTED_CONTENT \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 29)
|
||||
|
||||
/**
|
||||
* While parsing for the first component of a header field using
|
||||
* syntax as in Content-Disposition or Content-Type, the first component
|
||||
* was found to be empty, such as in:
|
||||
*
|
||||
* Content-Disposition: ; filename=foo
|
||||
*/
|
||||
#define NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 34)
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Connectivity error codes:
|
||||
*/
|
||||
|
|
|
@ -1943,8 +1943,13 @@ NS_GetContentDispositionFromHeader(const nsACString& aHeader, nsIChannel *aChan
|
|||
nsAutoString dispToken;
|
||||
rv = mimehdrpar->GetParameter(aHeader, "", fallbackCharset, PR_TRUE, nsnull,
|
||||
dispToken);
|
||||
if (NS_FAILED(rv))
|
||||
return nsIChannel::DISPOSITION_ATTACHMENT;
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// special case (see bug 272541): empty disposition type handled as "inline"
|
||||
return rv == NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY
|
||||
? nsIChannel::DISPOSITION_INLINE
|
||||
: nsIChannel::DISPOSITION_ATTACHMENT;
|
||||
}
|
||||
|
||||
return NS_GetContentDispositionFromToken(dispToken);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "nsMIMEHeaderParamImpl.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsNetError.h"
|
||||
|
||||
// static functions declared below are moved from mailnews/mime/src/comi18n.cpp
|
||||
|
||||
|
@ -181,7 +182,8 @@ nsMIMEHeaderParamImpl::GetParameterInternal(const char *aHeaderValue,
|
|||
for (; *str && *str != ';' && !nsCRT::IsAsciiSpace(*str); ++str)
|
||||
;
|
||||
if (str == start)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
return NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY;
|
||||
|
||||
*aResult = (char *) nsMemory::Clone(start, (str - start) + 1);
|
||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
(*aResult)[str - start] = '\0'; // null-terminate
|
||||
|
|
|
@ -776,7 +776,7 @@ HttpBaseChannel::nsContentEncodings::PrepareForNext(void)
|
|||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetRequestMethod(nsACString& aMethod)
|
||||
{
|
||||
aMethod = mRequestHead.Method();
|
||||
mRequestHead.Method()->ToUTF8String(aMethod);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -785,16 +785,27 @@ HttpBaseChannel::SetRequestMethod(const nsACString& aMethod)
|
|||
{
|
||||
ENSURE_CALLED_BEFORE_ASYNC_OPEN();
|
||||
|
||||
const nsCString& flatMethod = PromiseFlatCString(aMethod);
|
||||
nsCAutoString upperCaseMethod;
|
||||
ToUpperCase(aMethod, upperCaseMethod);
|
||||
|
||||
// Method names are restricted to valid HTTP tokens.
|
||||
if (!nsHttp::IsValidToken(flatMethod))
|
||||
if (!nsHttp::IsValidToken(upperCaseMethod))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsHttpAtom atom = nsHttp::ResolveAtom(flatMethod.get());
|
||||
if (!atom)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(upperCaseMethod);
|
||||
|
||||
// We've changed method names to case sensitive in bug 477578. Some
|
||||
// methods are kept case insensitive to keep backward compatibility and
|
||||
// to satisfy XMLHttpRequest specification which demands it.
|
||||
#define HTTP_METHOD_ATOM(name_, value_)
|
||||
#define HTTP_CASE_INSENSITIVE_METHOD_ATOM(name_, value_) \
|
||||
if (nsHttp::name_ == atom) {} else
|
||||
#include "nsHttpAtomList.h"
|
||||
#undef HTTP_CASE_INSENSITIVE_METHOD_ATOM
|
||||
#undef HTTP_METHOD_ATOM
|
||||
{ // upper case atom doesn't match any case insensitive atom
|
||||
atom = do_GetAtom(aMethod);
|
||||
}
|
||||
mRequestHead.SetMethod(atom);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1543,7 +1554,7 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
|
|||
PRInt64 len = clen ? nsCRT::atoll(clen) : -1;
|
||||
uploadChannel2->ExplicitSetUploadStream(
|
||||
mUploadStream, nsDependentCString(ctype), len,
|
||||
nsDependentCString(mRequestHead.Method()),
|
||||
nsAtomCString(mRequestHead.Method()),
|
||||
mUploadStreamHasHeaders);
|
||||
} else {
|
||||
if (mUploadStreamHasHeaders) {
|
||||
|
@ -1570,7 +1581,7 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
|
|||
// we set the upload stream above. This means SetRequestMethod() will
|
||||
// be called twice if ExplicitSetUploadStream() gets called above.
|
||||
|
||||
httpChannel->SetRequestMethod(nsDependentCString(mRequestHead.Method()));
|
||||
httpChannel->SetRequestMethod(nsAtomCString(mRequestHead.Method()));
|
||||
}
|
||||
// convey the referrer if one was used for this channel to the next one
|
||||
if (mReferrer)
|
||||
|
|
|
@ -1072,7 +1072,7 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
|
|||
|
||||
SendAsyncOpen(IPC::URI(mURI), IPC::URI(mOriginalURI),
|
||||
IPC::URI(mDocumentURI), IPC::URI(mReferrer), mLoadFlags,
|
||||
mRequestHeaders, mRequestHead.Method(),
|
||||
mRequestHeaders, nsAtomCString(mRequestHead.Method()),
|
||||
IPC::InputStream(mUploadStream), mUploadStreamHasHeaders,
|
||||
mPriority, mRedirectionLimit, mAllowPipelining,
|
||||
mForceAllowThirdPartyCookie, mSendResumeAt,
|
||||
|
|
|
@ -132,7 +132,7 @@ HttpChannelParent::RecvAsyncOpen(const IPC::URI& aURI,
|
|||
const IPC::URI& aReferrerURI,
|
||||
const PRUint32& loadFlags,
|
||||
const RequestHeaderTuples& requestHeaders,
|
||||
const nsHttpAtom& requestMethod,
|
||||
const nsCString& requestMethod,
|
||||
const IPC::InputStream& uploadStream,
|
||||
const PRBool& uploadStreamHasHeaders,
|
||||
const PRUint16& priority,
|
||||
|
@ -190,7 +190,7 @@ HttpChannelParent::RecvAsyncOpen(const IPC::URI& aURI,
|
|||
|
||||
httpChan->SetNotificationCallbacks(channelListener);
|
||||
|
||||
httpChan->SetRequestMethod(nsDependentCString(requestMethod.get()));
|
||||
httpChan->SetRequestMethod(requestMethod);
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream(uploadStream);
|
||||
if (stream) {
|
||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
|||
const IPC::URI& referrerUri,
|
||||
const PRUint32& loadFlags,
|
||||
const RequestHeaderTuples& requestHeaders,
|
||||
const nsHttpAtom& requestMethod,
|
||||
const nsCString& requestMethod,
|
||||
const IPC::InputStream& uploadStream,
|
||||
const PRBool& uploadStreamHasHeaders,
|
||||
const PRUint16& priority,
|
||||
|
|
|
@ -47,7 +47,6 @@ include "prio.h";
|
|||
|
||||
using RequestHeaderTuples;
|
||||
using nsHttpResponseHead;
|
||||
using nsHttpAtom;
|
||||
using IPC::URI;
|
||||
using IPC::InputStream;
|
||||
using PRNetAddr;
|
||||
|
@ -70,7 +69,7 @@ parent:
|
|||
URI referrer,
|
||||
PRUint32 loadFlags,
|
||||
RequestHeaderTuples requestHeaders,
|
||||
nsHttpAtom requestMethod,
|
||||
nsCString requestMethod,
|
||||
InputStream uploadStream,
|
||||
PRBool uploadStreamHasHeaders,
|
||||
PRUint16 priority,
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "mozilla/Mutex.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prbit.h"
|
||||
#include "nsStaticAtom.h"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
PRLogModuleInfo *gHttpLog = nsnull;
|
||||
|
@ -60,6 +61,23 @@ enum {
|
|||
};
|
||||
#undef HTTP_ATOM
|
||||
|
||||
// define all method atoms
|
||||
#define HTTP_METHOD_ATOM(name_, value_) nsIAtom* nsHttp::name_;
|
||||
#include "nsHttpAtomList.h"
|
||||
#undef HTTP_METHOD_ATOM
|
||||
|
||||
#define HTTP_METHOD_ATOM(name_, value_) \
|
||||
NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
|
||||
#include "nsHttpAtomList.h"
|
||||
#undef HTTP_METHOD_ATOM
|
||||
|
||||
static const nsStaticAtom methodAtomsInfo[] = {
|
||||
#define HTTP_METHOD_ATOM(name_, value_) \
|
||||
NS_STATIC_ATOM(name_##_buffer, &nsHttp::name_),
|
||||
#include "nsHttpAtomList.h"
|
||||
#undef HTTP_METHOD_ATOM
|
||||
};
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
// we keep a linked list of atoms allocated on the heap for easy clean up when
|
||||
|
@ -184,6 +202,12 @@ nsHttp::DestroyAtomTable()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHttp::CreateMethodAtoms()
|
||||
{
|
||||
NS_RegisterStaticAtoms(methodAtomsInfo, NS_ARRAY_LENGTH(methodAtomsInfo));
|
||||
}
|
||||
|
||||
// this function may be called from multiple threads
|
||||
nsHttpAtom
|
||||
nsHttp::ResolveAtom(const char *str)
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "nsPromiseFlatString.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "netCore.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
|
@ -164,6 +165,8 @@ struct nsHttp
|
|||
static nsresult CreateAtomTable();
|
||||
static void DestroyAtomTable();
|
||||
|
||||
static void CreateMethodAtoms();
|
||||
|
||||
// will dynamically add atoms to the table if they don't already exist
|
||||
static nsHttpAtom ResolveAtom(const char *);
|
||||
static nsHttpAtom ResolveAtom(const nsACString &s)
|
||||
|
@ -215,6 +218,10 @@ struct nsHttp
|
|||
#define HTTP_ATOM(_name, _value) static nsHttpAtom _name;
|
||||
#include "nsHttpAtomList.h"
|
||||
#undef HTTP_ATOM
|
||||
|
||||
#define HTTP_METHOD_ATOM(_name, _value) static nsIAtom* _name;
|
||||
#include "nsHttpAtomList.h"
|
||||
#undef HTTP_METHOD_ATOM
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
The second argument to HTTP_ATOM is the string value of the atom.
|
||||
******/
|
||||
|
||||
#if defined(HTTP_ATOM)
|
||||
HTTP_ATOM(Accept, "Accept")
|
||||
HTTP_ATOM(Accept_Encoding, "Accept-Encoding")
|
||||
HTTP_ATOM(Accept_Language, "Accept-Language")
|
||||
|
@ -123,26 +124,40 @@ HTTP_ATOM(Vary, "Vary")
|
|||
HTTP_ATOM(Version, "Version")
|
||||
HTTP_ATOM(WWW_Authenticate, "WWW-Authenticate")
|
||||
HTTP_ATOM(Warning, "Warning")
|
||||
#endif
|
||||
|
||||
// methods are atoms too.
|
||||
//
|
||||
// Note: winnt.h defines DELETE macro, so we'll just keep the methods mixedcase
|
||||
// even though they're normally written all uppercase. -- darin
|
||||
|
||||
HTTP_ATOM(Connect, "CONNECT")
|
||||
HTTP_ATOM(Copy, "COPY")
|
||||
HTTP_ATOM(Delete, "DELETE")
|
||||
HTTP_ATOM(Get, "GET")
|
||||
HTTP_ATOM(Head, "HEAD")
|
||||
HTTP_ATOM(Index, "INDEX")
|
||||
HTTP_ATOM(Lock, "LOCK")
|
||||
HTTP_ATOM(M_Post, "M-POST")
|
||||
HTTP_ATOM(Mkcol, "MKCOL")
|
||||
HTTP_ATOM(Move, "MOVE")
|
||||
HTTP_ATOM(Options, "OPTIONS")
|
||||
HTTP_ATOM(Post, "POST")
|
||||
HTTP_ATOM(Propfind, "PROPFIND")
|
||||
HTTP_ATOM(Proppatch, "PROPPATCH")
|
||||
HTTP_ATOM(Put, "PUT")
|
||||
HTTP_ATOM(Trace, "TRACE")
|
||||
HTTP_ATOM(Unlock, "UNLOCK")
|
||||
#if defined(HTTP_METHOD_ATOM)
|
||||
|
||||
#if !defined(HTTP_CASE_INSENSITIVE_METHOD_ATOM)
|
||||
#define HTTP_CASE_INSENSITIVE_METHOD_ATOM HTTP_METHOD_ATOM
|
||||
#define UNDEF_HTTP_CASE_INSENSITIVE_METHOD_ATOM
|
||||
#endif
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Connect, "CONNECT")
|
||||
HTTP_METHOD_ATOM (Copy, "COPY")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Delete, "DELETE")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Get, "GET")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Head, "HEAD")
|
||||
HTTP_METHOD_ATOM (Index, "INDEX")
|
||||
HTTP_METHOD_ATOM (Lock, "LOCK")
|
||||
HTTP_METHOD_ATOM (M_Post, "M-POST")
|
||||
HTTP_METHOD_ATOM (Mkcol, "MKCOL")
|
||||
HTTP_METHOD_ATOM (Move, "MOVE")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Options, "OPTIONS")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Post, "POST")
|
||||
HTTP_METHOD_ATOM (Propfind, "PROPFIND")
|
||||
HTTP_METHOD_ATOM (Proppatch, "PROPPATCH")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Put, "PUT")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Trace, "TRACE")
|
||||
HTTP_CASE_INSENSITIVE_METHOD_ATOM(Track, "TRACK")
|
||||
HTTP_METHOD_ATOM (Unlock, "UNLOCK")
|
||||
#if defined(UNDEF_HTTP_CASE_INSENSITIVE_METHOD_ATOM)
|
||||
#undef UNDEF_HTTP_CASE_INSENSITIVE_METHOD_ATOM
|
||||
#undef HTTP_CASE_INSENSITIVE_METHOD_ATOM
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2412,7 +2412,9 @@ nsHttpChannel::CheckCache()
|
|||
rv = mCacheEntry->GetMetaDataElement("request-method", getter_Copies(buf));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsHttpAtom method = nsHttp::ResolveAtom(buf);
|
||||
nsCOMPtr<nsIAtom> method = do_GetAtom(buf);
|
||||
NS_ENSURE_TRUE(method, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (method == nsHttp::Head) {
|
||||
// The cached response does not contain an entity. We can only reuse
|
||||
// the response if the current request is also HEAD.
|
||||
|
@ -2981,7 +2983,7 @@ nsHttpChannel::AddCacheEntryHeaders(nsICacheEntryDescriptor *entry)
|
|||
// Store the HTTP request method with the cache entry so we can distinguish
|
||||
// for example GET and HEAD responses.
|
||||
rv = entry->SetMetaDataElement("request-method",
|
||||
mRequestHead.Method().get());
|
||||
nsAtomCString(mRequestHead.Method()).get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Store the HTTP authorization scheme used if any...
|
||||
|
|
|
@ -238,6 +238,8 @@ nsHttpHandler::Init()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsHttp::CreateMethodAtoms();
|
||||
|
||||
mIOService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("unable to continue without io service");
|
||||
|
|
|
@ -47,7 +47,7 @@ nsHttpRequestHead::Flatten(nsACString &buf, PRBool pruneProxyHeaders)
|
|||
{
|
||||
// note: the first append is intentional.
|
||||
|
||||
buf.Append(mMethod.get());
|
||||
buf.Append(nsAtomCString(mMethod));
|
||||
buf.Append(' ');
|
||||
buf.Append(mRequestURI);
|
||||
buf.AppendLiteral(" HTTP/");
|
||||
|
|
|
@ -55,12 +55,12 @@ public:
|
|||
nsHttpRequestHead() : mMethod(nsHttp::Get), mVersion(NS_HTTP_VERSION_1_1) {}
|
||||
~nsHttpRequestHead() {}
|
||||
|
||||
void SetMethod(nsHttpAtom method) { mMethod = method; }
|
||||
void SetMethod(nsIAtom *method) { mMethod = method; }
|
||||
void SetVersion(nsHttpVersion version) { mVersion = version; }
|
||||
void SetRequestURI(const nsCSubstring &s) { mRequestURI = s; }
|
||||
|
||||
nsHttpHeaderArray &Headers() { return mHeaders; }
|
||||
nsHttpAtom Method() { return mMethod; }
|
||||
nsIAtom *Method() { return mMethod; }
|
||||
nsHttpVersion Version() { return mVersion; }
|
||||
const nsCSubstring &RequestURI() { return mRequestURI; }
|
||||
|
||||
|
@ -77,7 +77,7 @@ public:
|
|||
|
||||
private:
|
||||
nsHttpHeaderArray mHeaders;
|
||||
nsHttpAtom mMethod;
|
||||
nsCOMPtr<nsIAtom> mMethod;
|
||||
nsHttpVersion mVersion;
|
||||
nsCString mRequestURI;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* Test for bug 272541: - Empty disposition type treated as "attachment"
|
||||
*/
|
||||
|
||||
const Cr = Components.results
|
||||
|
||||
var tests = [
|
||||
[ /* the actual bug */
|
||||
"; filename=foo.html",
|
||||
Cr.NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY],
|
||||
[ /* regression check, but see bug 671204 */
|
||||
"filename=foo.html",
|
||||
"filename=foo.html"],
|
||||
[ /* sanity check */
|
||||
"attachment; filename=foo.html",
|
||||
"attachment"],
|
||||
];
|
||||
|
||||
function run_test() {
|
||||
|
||||
var mhp = Components.classes["@mozilla.org/network/mime-hdrparam;1"]
|
||||
.getService(Components.interfaces.nsIMIMEHeaderParam);
|
||||
|
||||
var unused = { value : null };
|
||||
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
dump("Testing " + tests[i] + "\n");
|
||||
try {
|
||||
do_check_eq(mhp.getParameter(tests[i][0], "", "UTF-8", true, unused),
|
||||
tests[i][1]);
|
||||
}
|
||||
catch (e) {
|
||||
do_check_eq(e.result, tests[i][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const testMethods = [
|
||||
["get", "GET"],
|
||||
["post", "POST"],
|
||||
["head", "HEAD"],
|
||||
["put", "PUT"],
|
||||
["delete", "DELETE"],
|
||||
["connect", "CONNECT"],
|
||||
["options", "OPTIONS"],
|
||||
["trace", "TRACE"],
|
||||
["track", "TRACK"],
|
||||
["copy", "copy"],
|
||||
["index", "index"],
|
||||
["lock", "lock"],
|
||||
["m-post", "m-post"],
|
||||
["mkcol", "mkcol"],
|
||||
["move", "move"],
|
||||
["propfind", "propfind"],
|
||||
["proppatch", "proppatch"],
|
||||
["unlock", "unlock"],
|
||||
["link", "link"],
|
||||
["foo", "foo"],
|
||||
["foO", "foO"],
|
||||
["fOo", "fOo"],
|
||||
["Foo", "Foo"]
|
||||
]
|
||||
|
||||
function run_test() {
|
||||
var ios =
|
||||
Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
var chan = ios.newChannel("http://localhost/", null, null)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
for (var i = 0; i < testMethods.length; i++) {
|
||||
chan.requestMethod = testMethods[i][0];
|
||||
do_check_eq(chan.requestMethod, testMethods[i][1]);
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ skip-if = os == "android"
|
|||
[test_bug248970_cookie.js]
|
||||
[test_bug261425.js]
|
||||
[test_bug263127.js]
|
||||
[test_bug272541.js]
|
||||
[test_bug321706.js]
|
||||
[test_bug331825.js]
|
||||
[test_bug336501.js]
|
||||
|
@ -44,6 +45,7 @@ skip-if = os == "android"
|
|||
skip-if = os == "android"
|
||||
[test_bug468594.js]
|
||||
[test_bug470716.js]
|
||||
[test_bug477578.js]
|
||||
[test_bug479413.js]
|
||||
[test_bug479485.js]
|
||||
[test_bug482601.js]
|
||||
|
|
|
@ -50,8 +50,8 @@ selectDownloadDir=Select Download Folder
|
|||
unknownAccept.label=Save File
|
||||
unknownCancel.label=Cancel
|
||||
fileType=%S file
|
||||
# LOCALIZATION NOTE (fileSizeWithType): first %S is type, second %S is size, and third %S is unit
|
||||
fileSizeWithType=%1S (%2S %3S)
|
||||
# LOCALIZATION NOTE (orderedFileSizeWithType): first %S is type, second %S is size, and third %S is unit
|
||||
orderedFileSizeWithType=%1$S (%2$S %3$S)
|
||||
|
||||
# LOCALIZATION NOTE (wpsDefaultOS2): OS/2 only, WPS refers to the Workplace Shell and should probably not be translated
|
||||
wpsDefaultOS2=WPS Default
|
||||
|
|
|
@ -616,7 +616,7 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
let [size, unit] = DownloadUtils.
|
||||
convertByteUnits(this.mLauncher.contentLength);
|
||||
type.value = this.dialogElement("strings")
|
||||
.getFormattedString("fileSizeWithType",
|
||||
.getFormattedString("orderedFileSizeWithType",
|
||||
[typeString, size, unit]);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -280,6 +280,8 @@ nsNativeDragTarget::DragEnter(LPDATAOBJECT pIDataSource,
|
|||
|
||||
// Mask effect coming from function call with effect preferred by the source.
|
||||
mMovePreferred = (preferredEffect & DROPEFFECT_MOVE) != 0;
|
||||
|
||||
nsMemory::Free(tempOutData);
|
||||
} else {
|
||||
mMovePreferred = PR_FALSE;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче