mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1194466. Use the table-outer frame's margin when requesting the margin for table element with getBoxQuads. r=mats
This commit is contained in:
parent
853b0ea8bc
commit
e343f3d400
@ -175,11 +175,22 @@ public:
|
||||
, mRelativeToBoxTopLeft(aRelativeToBoxTopLeft)
|
||||
, mBoxType(aBoxType)
|
||||
{
|
||||
if (mBoxType == CSSBoxType::Margin) {
|
||||
// Don't include the caption margin when computing margins for a
|
||||
// table
|
||||
mIncludeCaptionBoxForTable = false;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void AddBox(nsIFrame* aFrame) override
|
||||
{
|
||||
nsIFrame* f = aFrame;
|
||||
if (mBoxType == CSSBoxType::Margin &&
|
||||
f->GetType() == nsGkAtoms::tableFrame) {
|
||||
// Margin boxes for table frames should be taken from the outer table
|
||||
// frame, since that has the margin.
|
||||
f = f->GetParent();
|
||||
}
|
||||
nsRect box = GetBoxRectForFrame(&f, mBoxType);
|
||||
nsPoint appUnits[4] =
|
||||
{ box.TopLeft(), box.TopRight(), box.BottomRight(), box.BottomLeft() };
|
||||
|
@ -3638,9 +3638,11 @@ AddBoxesForFrame(nsIFrame* aFrame,
|
||||
|
||||
if (pseudoType == nsCSSAnonBoxes::tableOuter) {
|
||||
AddBoxesForFrame(aFrame->PrincipalChildList().FirstChild(), aCallback);
|
||||
nsIFrame* kid = aFrame->GetChildList(nsIFrame::kCaptionList).FirstChild();
|
||||
if (kid) {
|
||||
AddBoxesForFrame(kid, aCallback);
|
||||
if (aCallback->mIncludeCaptionBoxForTable) {
|
||||
nsIFrame* kid = aFrame->GetChildList(nsIFrame::kCaptionList).FirstChild();
|
||||
if (kid) {
|
||||
AddBoxesForFrame(kid, aCallback);
|
||||
}
|
||||
}
|
||||
} else if (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock ||
|
||||
pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock ||
|
||||
|
@ -1091,7 +1091,9 @@ public:
|
||||
|
||||
class BoxCallback {
|
||||
public:
|
||||
BoxCallback() : mIncludeCaptionBoxForTable(true) {}
|
||||
virtual void AddBox(nsIFrame* aFrame) = 0;
|
||||
bool mIncludeCaptionBoxForTable;
|
||||
};
|
||||
/**
|
||||
* Collect all CSS boxes associated with aFrame and its
|
||||
|
@ -245,7 +245,7 @@ That ensures the first quad's X position is not equal to the anonymous block's X
|
||||
><div style="width:110px; height:20px; background:black"></div
|
||||
><em style="width:130px;"></em></span>
|
||||
|
||||
<table cellspacing="0" id="table" style="border:0; margin:0; padding:0; background:orange">
|
||||
<table cellspacing="0" id="table" style="border:0; margin:8px; padding:0; background:orange">
|
||||
<tbody style="padding:0; margin:0; border:0; background:blue">
|
||||
<tr style="height:50px; padding:0; margin:0; border:0">
|
||||
<td style="border:0; margin:0; padding:0">Cell</td>
|
||||
@ -508,6 +508,10 @@ function runTest() {
|
||||
isEval("text.getBoxQuads({box:'margin'})[0].bounds.left", textX);
|
||||
isEval("text.getBoxQuads({box:'margin'})[1].bounds.left", textX - 150);
|
||||
|
||||
// Test table margins
|
||||
isEval("table.getBoxQuads({box:'margin'}).length", 1);
|
||||
isEval("table.getBoxQuads({box:'margin'})[0].bounds.height", 106);
|
||||
|
||||
// Check that a text node whose layout might have been optimized away gives
|
||||
// correct results.
|
||||
var suppressedTextContainerX = suppressedTextContainer.getBoundingClientRect().left;
|
||||
|
Loading…
Reference in New Issue
Block a user