зеркало из https://github.com/mozilla/gecko-dev.git
Bug 10209 - Part 5: Allow table elements to act as absolute positioning containers; r=roc
This commit is contained in:
Родитель
01fc147551
Коммит
59e7e67254
|
@ -32,7 +32,7 @@ load 234851-2.html
|
|||
load 241300-1.html
|
||||
load 243159-1.html
|
||||
load 243159-2.xhtml
|
||||
asserts(1) load 243519-1.html # bug 536692
|
||||
load 243519-1.html
|
||||
load 244490-1.html
|
||||
load 254367-1.html
|
||||
load 263359-1.html
|
||||
|
|
|
@ -1754,7 +1754,6 @@ IsTableRelated(nsIAtom* aParentType)
|
|||
{
|
||||
return
|
||||
nsGkAtoms::tableOuterFrame == aParentType ||
|
||||
nsGkAtoms::tableFrame == aParentType ||
|
||||
nsGkAtoms::tableRowGroupFrame == aParentType ||
|
||||
nsGkAtoms::tableRowFrame == aParentType ||
|
||||
nsGkAtoms::tableCaptionFrame == aParentType ||
|
||||
|
@ -1944,6 +1943,15 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
|
|||
}
|
||||
|
||||
nsFrameItems childItems;
|
||||
|
||||
// Process children
|
||||
nsFrameConstructorSaveState absoluteSaveState;
|
||||
const nsStyleDisplay* display = outerStyleContext->GetStyleDisplay();
|
||||
|
||||
// Mark the table frame as an absolute container if needed
|
||||
if (display->IsPositioned()) {
|
||||
aState.PushAbsoluteContainingBlock(newFrame, absoluteSaveState);
|
||||
}
|
||||
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
|
||||
rv = ConstructFramesFromItemList(aState, aItem.mChildItems,
|
||||
innerFrame, childItems);
|
||||
|
@ -5534,7 +5542,15 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame)
|
|||
// positioned child frames.
|
||||
const nsStyleDisplay* disp = frame->GetStyleDisplay();
|
||||
|
||||
if (disp->IsPositioned() && !IsTableRelated(frame->GetType())) {
|
||||
if (disp->IsPositioned()) {
|
||||
// For tables, return the outer frame table
|
||||
if (frame->GetType() == nsGkAtoms::tableFrame) {
|
||||
containingBlock = frame->GetParent();
|
||||
break;
|
||||
} else if (IsTableRelated(frame->GetType())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find the outermost wrapped block under this frame
|
||||
for (nsIFrame* wrappedFrame = aFrame; wrappedFrame != frame->GetParent();
|
||||
wrappedFrame = wrappedFrame->GetParent()) {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body onload="document.removeChild(document.documentElement);">
|
||||
<table style="position: fixed;"><tr style="position: absolute;"></tr></table>
|
||||
</body>
|
||||
</html>
|
|
@ -317,6 +317,7 @@ load 533379-2.html
|
|||
load 534082-1.html
|
||||
load 534366-1.html
|
||||
load 534366-2.html
|
||||
load 536692-1.xhtml
|
||||
load 541277-1.html
|
||||
load 541277-2.html
|
||||
load 541714-1.html
|
||||
|
|
|
@ -518,22 +518,25 @@ nsHTMLReflowState::InitFrameType()
|
|||
|
||||
// just assume what the style says, because we might not have had a
|
||||
// useful float/absolute containing block
|
||||
nsIFrame* frameToTest =
|
||||
frame->GetType() == nsGkAtoms::tableFrame ? frame->GetParent() : frame;
|
||||
|
||||
DISPLAY_INIT_TYPE(frameToTest, this);
|
||||
DISPLAY_INIT_TYPE(frame, this);
|
||||
|
||||
NS_ASSERTION(frameToTest->GetStyleDisplay()->IsAbsolutelyPositioned() ==
|
||||
if (frame->GetType() == nsGkAtoms::tableFrame) {
|
||||
mFrameType = NS_CSS_FRAME_TYPE_BLOCK;
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ASSERTION(frame->GetStyleDisplay()->IsAbsolutelyPositioned() ==
|
||||
disp->IsAbsolutelyPositioned(),
|
||||
"Unexpected position style");
|
||||
NS_ASSERTION(frameToTest->GetStyleDisplay()->IsFloating() ==
|
||||
NS_ASSERTION(frame->GetStyleDisplay()->IsFloating() ==
|
||||
disp->IsFloating(), "Unexpected float style");
|
||||
if (frameToTest->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
|
||||
if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
|
||||
if (disp->IsAbsolutelyPositioned()) {
|
||||
frameType = NS_CSS_FRAME_TYPE_ABSOLUTE;
|
||||
//XXXfr hack for making frames behave properly when in overflow container lists
|
||||
// see bug 154892; need to revisit later
|
||||
if (frameToTest->GetPrevInFlow())
|
||||
if (frame->GetPrevInFlow())
|
||||
frameType = NS_CSS_FRAME_TYPE_BLOCK;
|
||||
}
|
||||
else if (disp->IsFloating()) {
|
||||
|
@ -1132,15 +1135,15 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
|||
NS_PRECONDITION(containingBlockHeight != NS_AUTOHEIGHT,
|
||||
"containing block height must be constrained");
|
||||
|
||||
nsIFrame* outOfFlow =
|
||||
frame->GetType() == nsGkAtoms::tableFrame ? frame->GetParent() : frame;
|
||||
NS_ASSERTION(outOfFlow->GetStateBits() & NS_FRAME_OUT_OF_FLOW,
|
||||
NS_ASSERTION(frame->GetType() != nsGkAtoms::tableFrame,
|
||||
"InitAbsoluteConstraints should not be called on table frames");
|
||||
NS_ASSERTION(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW,
|
||||
"Why are we here?");
|
||||
|
||||
// Get the placeholder frame
|
||||
nsIFrame* placeholderFrame;
|
||||
|
||||
placeholderFrame = aPresContext->PresShell()->GetPlaceholderFrameFor(outOfFlow);
|
||||
placeholderFrame = aPresContext->PresShell()->GetPlaceholderFrameFor(frame);
|
||||
NS_ASSERTION(nsnull != placeholderFrame, "no placeholder frame");
|
||||
|
||||
// If both 'left' and 'right' are 'auto' or both 'top' and 'bottom' are
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
== font-size-wrap.html font-size-wrap-ref.html
|
||||
== abs-pos-auto-margin-1.html abs-pos-auto-margin-1-ref.html
|
||||
== auto-offset-inline-block-1.html auto-offset-inline-block-1-ref.html
|
||||
== table-1.html table-1-ref.html
|
||||
== table-2.html table-2-ref.html
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="margin: 0">
|
||||
<table style="position: relative; top: 100px; left: 50px; border: 1px solid red; width: 90px; height: 100px; border-spacing: 0">
|
||||
<tr>
|
||||
<td style="padding: 0">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="position: absolute; top: 110px; left: 70px; border: 1px solid green; width: 50px; height: 60px;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="margin: 0">
|
||||
<table style="position: relative; top: 100px; left: 50px; border: 1px solid red; width: 90px; height: 100px; border-spacing: 0">
|
||||
<tr>
|
||||
<td style="padding: 0">
|
||||
<div style="position: absolute; top: 10px; left: 20px; border: 1px solid green; width: 50px; height: 60px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="margin: 0">
|
||||
<table style="position: relative; top: 100px; left: 50px; border: 1px solid red; width: 90px; height: 100px; border-spacing: 0">
|
||||
<caption>foo</caption>
|
||||
<tr>
|
||||
<td style="padding: 0">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="position: absolute; top: 110px; left: 70px; border: 1px solid green; width: 50px; height: 60px;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="margin: 0">
|
||||
<table style="position: relative; top: 100px; left: 50px; border: 1px solid red; width: 90px; height: 100px; border-spacing: 0">
|
||||
<caption>foo</caption>
|
||||
<tr>
|
||||
<td style="padding: 0">
|
||||
<div style="position: absolute; top: 10px; left: 20px; border: 1px solid green; width: 50px; height: 60px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -1437,7 +1437,7 @@ random-if(d2d) == 523468-1.html 523468-1-ref.html
|
|||
== 528038-1d.html 528038-1-ref.html
|
||||
== 528038-1e.html 528038-1-ref.html
|
||||
== 528038-1f.html 528038-1-ref.html
|
||||
asserts(5) == 528038-2.html 528038-2-ref.html # bug 512749
|
||||
== 528038-2.html 528038-2-ref.html
|
||||
== 528096-1.html 528096-1-ref.html
|
||||
== 530686-1.html 530686-1-ref.html
|
||||
== 531098-1.html 531098-1-ref.html
|
||||
|
|
|
@ -16,7 +16,7 @@ fails == out-of-flow-1d.html out-of-flow-1-ref.html # bug 396645
|
|||
load stress-1.html # assertion test
|
||||
== stress-2.html stress-2-ref.html # assertion + rendering test
|
||||
load stress-3.html # assertion test
|
||||
asserts(2) load stress-4.html # assertion/crash test. existing assertions are bug 512749.
|
||||
load stress-4.html # assertion/crash test.
|
||||
load stress-5.html # assertion/crash test
|
||||
load stress-6.html # assertion/crash test
|
||||
load stress-7.html # assertion/crash test
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<html style="position:fixed"><table style="position:absolute"></table></html>
|
|
@ -80,7 +80,7 @@ load 399209-1.xhtml
|
|||
load 403249-1.html
|
||||
load 403579-1.html
|
||||
load 404301-1.xhtml
|
||||
asserts(1-2) load 408753-1.xhtml # Bug 512749
|
||||
load 408753-1.xhtml
|
||||
load 410426-1.html
|
||||
load 411582.xhtml
|
||||
load 413091.xhtml
|
||||
|
@ -98,6 +98,7 @@ load 456041.html
|
|||
load 457115.html
|
||||
load 467141-1.html
|
||||
load 488388-1.html
|
||||
load 512749-1.html
|
||||
load 513732-1.html
|
||||
asserts(0-1) load 533380-1.xhtml # Bug 614457
|
||||
load 534716-1.html
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
/* ----------- nsTableCaptionFrame ---------- */
|
||||
|
||||
#define NS_TABLE_FRAME_CAPTION_LIST_INDEX 0
|
||||
#define NS_TABLE_FRAME_CAPTION_LIST_INDEX 1
|
||||
#define NO_SIDE 100
|
||||
|
||||
// caption frame
|
||||
|
@ -208,6 +208,7 @@ nsTableOuterFrame::IsContainingBlock() const
|
|||
void
|
||||
nsTableOuterFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
{
|
||||
DestroyAbsoluteFrames(aDestructRoot);
|
||||
mCaptionFrames.DestroyFramesFrom(aDestructRoot);
|
||||
nsHTMLContainerFrame::DestroyFrom(aDestructRoot);
|
||||
}
|
||||
|
@ -936,7 +937,6 @@ nsTableOuterFrame::UpdateReflowMetrics(PRUint8 aCaptionSide,
|
|||
if (mCaptionFrames.NotEmpty()) {
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrames.FirstChild());
|
||||
}
|
||||
FinishAndStoreOverflow(&aMet);
|
||||
}
|
||||
|
||||
NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
@ -1129,7 +1129,8 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, captionMargin);
|
||||
|
||||
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aOuterRS, aStatus);
|
||||
|
||||
// Return our desired rect
|
||||
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aOuterRS, aDesiredSize);
|
||||
|
|
Загрузка…
Ссылка в новой задаче