зеркало из https://github.com/mozilla/gecko-dev.git
Bug 718157 - Fix dynamic changes of percentage text-indent when the parent's size changes and the element's size does not. r=jfkthame
This code needs to move out of PrepareResizeReflow() (and things that trigger code in it) because PrepareResizeReflow is conditioned on the block itself resizing. The reftest is based on a test by Jesse Ruderman <jruderman@gmail.com>. The reftest fails without the patch and passes with the patch. --HG-- extra : transplant_source : %E9%5E%97zE%A4%60n%8C%DD%F8K-%01%F3fF%E8%C9K
This commit is contained in:
Родитель
1feca4bc89
Коммит
bada98f01b
|
@ -1141,6 +1141,16 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
|||
PrepareResizeReflow(state);
|
||||
}
|
||||
|
||||
// The same for percentage text-indent, except conditioned on the
|
||||
// parent resizing.
|
||||
if (!(GetStateBits() & NS_FRAME_IS_DIRTY) &&
|
||||
reflowState->mCBReflowState &&
|
||||
reflowState->mCBReflowState->IsIResize() &&
|
||||
reflowState->mStyleText->mTextIndent.HasPercent() &&
|
||||
!mLines.empty()) {
|
||||
mLines.front()->MarkDirty();
|
||||
}
|
||||
|
||||
LazyMarkLinesDirty();
|
||||
|
||||
mState &= ~NS_FRAME_FIRST_REFLOW;
|
||||
|
|
|
@ -241,10 +241,6 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
|
|||
if (textIndent.HasPercent()) {
|
||||
pctBasis =
|
||||
nsHTMLReflowState::GetContainingBlockContentWidth(mBlockReflowState);
|
||||
|
||||
if (mGotLineBox) {
|
||||
mLineBox->DisableResizeReflowOptimization();
|
||||
}
|
||||
}
|
||||
nscoord indent = nsRuleNode::ComputeCoordPercentCalc(textIndent, pctBasis);
|
||||
|
||||
|
|
|
@ -16,3 +16,4 @@
|
|||
== text-indent-intrinsic-min.html text-indent-intrinsic-min-ref.html
|
||||
== text-indent-negative-intrinsic-pref.html text-indent-negative-intrinsic-pref-ref.html
|
||||
== text-indent-negative-intrinsic-min.html text-indent-negative-intrinsic-min-ref.html
|
||||
== text-indent-parent-dynamic.html text-indent-parent-dynamic-ref.html
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<div id="x" style="background: lightgreen; height: 3em; width: 500px; padding: 4px;">
|
||||
<div style="text-indent: 200px; width: 200px; background: yellow;">X</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<div id="x" style="background: lightgreen; height: 3em; width: 400px; padding: 4px;">
|
||||
<div style="text-indent: 40%; width: 200px; background: yellow;">X</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var x = document.getElementById('x');
|
||||
x.offsetWidth;
|
||||
x.style.width = '500px';
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче