зеркало из https://github.com/mozilla/gecko-dev.git
Bug 931460. Part 2: Call ApplyRelativePositioning on fieldset legends so that sticky and relative positioning works on them. r=mats
--HG-- extra : rebase_source : c8f0d927ee2dcc87d0385b8f2d77475274b68e5f
This commit is contained in:
Родитель
154278f277
Коммит
b8dc0c3c25
|
@ -17,6 +17,7 @@
|
|||
#include "nsRenderingContext.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layout;
|
||||
|
@ -475,13 +476,14 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
|||
// get the legend's margin
|
||||
nsMargin legendMargin(0,0,0,0);
|
||||
// reflow the legend only if needed
|
||||
Maybe<nsHTMLReflowState> legendReflowState;
|
||||
if (legend) {
|
||||
legendReflowState.construct(aPresContext, aReflowState, legend, availSize);
|
||||
}
|
||||
if (reflowLegend) {
|
||||
nsHTMLReflowState legendReflowState(aPresContext, aReflowState,
|
||||
legend, availSize);
|
||||
|
||||
nsHTMLReflowMetrics legendDesiredSize;
|
||||
|
||||
ReflowChild(legend, aPresContext, legendDesiredSize, legendReflowState,
|
||||
ReflowChild(legend, aPresContext, legendDesiredSize, legendReflowState.ref(),
|
||||
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
||||
#ifdef NOISY_REFLOW
|
||||
printf(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height);
|
||||
|
@ -508,7 +510,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
|||
reflowInner = true;
|
||||
}
|
||||
|
||||
FinishReflowChild(legend, aPresContext, &legendReflowState,
|
||||
FinishReflowChild(legend, aPresContext, &legendReflowState.ref(),
|
||||
legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
|
||||
} else if (!legend) {
|
||||
mLegendRect.SetEmpty();
|
||||
|
@ -597,21 +599,15 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
|||
innerContentRect.width = mLegendRect.width;
|
||||
contentRect.width = mLegendRect.width + aReflowState.mComputedPadding.LeftRight();
|
||||
}
|
||||
|
||||
// place the legend
|
||||
nsRect actualLegendRect(mLegendRect);
|
||||
actualLegendRect.Deflate(legendMargin);
|
||||
|
||||
nsPoint curOrigin = legend->GetPosition();
|
||||
|
||||
// only if the origin changed
|
||||
if ((curOrigin.x != actualLegendRect.x) || (curOrigin.y != actualLegendRect.y)) {
|
||||
legend->SetPosition(nsPoint(actualLegendRect.x , actualLegendRect.y));
|
||||
nsContainerFrame::PositionFrameView(legend);
|
||||
|
||||
// We need to recursively process the legend frame's
|
||||
// children since we're moving the frame after Reflow.
|
||||
nsContainerFrame::PositionChildViews(legend);
|
||||
}
|
||||
nsPoint actualLegendPos(actualLegendRect.TopLeft());
|
||||
legendReflowState.ref().ApplyRelativePositioning(&actualLegendPos);
|
||||
legend->SetPosition(actualLegendPos);
|
||||
nsContainerFrame::PositionFrameView(legend);
|
||||
nsContainerFrame::PositionChildViews(legend);
|
||||
}
|
||||
|
||||
// Return our size and our result
|
||||
|
|
|
@ -6,3 +6,6 @@
|
|||
== fieldset-scrolled-1.html fieldset-scrolled-1-ref.html
|
||||
random-if(B2G) == fieldset-overflow-auto-1.html fieldset-overflow-auto-1-ref.html
|
||||
== positioned-container-1.html positioned-container-1-ref.html
|
||||
== relpos-legend-1.html relpos-legend-1-ref.html
|
||||
== relpos-legend-2.html relpos-legend-2-ref.html
|
||||
== sticky-legend-1.html sticky-legend-1-ref.html
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<fieldset>
|
||||
<legend><div style="position:relative; top:20px">Legend</div></legend>
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<fieldset>
|
||||
<legend style="position:relative; top:20px">Legend</legend>
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<fieldset>
|
||||
<legend><span style="position:relative; top:20px">Legend</span></legend>
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<fieldset>
|
||||
<legend style="display:inline; position:relative; top:20px">Legend</legend>
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<fieldset style="overflow:hidden; height:300px;">
|
||||
<legend style="position:fixed; top:0"><div style="width:200px; height:50px; background:yellow;"></div></legend>
|
||||
</fieldset>
|
||||
<div style="height:5000px;"></div>
|
||||
<script>
|
||||
window.scrollTo(0,100);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<fieldset style="overflow:hidden; height:300px;">
|
||||
<legend style="position:sticky; top:0;"><div style="width:200px; height:50px; background:yellow;"></div></legend>
|
||||
</fieldset>
|
||||
<div style="height:5000px;"></div>
|
||||
<script>
|
||||
window.scrollTo(0,100);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче