Bug 1671726 Part 1 - Fix a writing-mode mismatch in ViewportFrame::Reflow(). r=jfkthame

After applying the next part, 1161752.html's runTest2() can trigger the
following assertion without this patch.

```
ASSERTION: writing-mode mismatch: 'aWritingMode.IgnoreSideways() == GetWritingMode().IgnoreSideways()'
```

`kidDesiredSize` is initialized by ViewportFrame's reflow input, so it
stores the ViewportFrame's writing mode. But after calling
`ReflowChild`, the old code is accessing the kid's block-size by using
`kidDesiredSize.BSize(wm)`, where `wm` is being shadowed within the
inner if and becomes the kid's writing mode. This patch fixed it by
changing the inner `wm` to `kidWM` for the clarity and avoiding the
variable shadowing.

In the next part, ReflowOutput's documentation is updated, hoping to
prevent the writing mode misusages in the future.

Differential Revision: https://phabricator.services.mozilla.com/D93868
This commit is contained in:
Ting-Yu Lin 2020-10-28 20:42:26 +00:00
Родитель 3d18cd113c
Коммит afa8ddf934
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -329,8 +329,8 @@ void ViewportFrame::Reflow(nsPresContext* aPresContext,
// Reflow our one-and-only principal child frame
nsIFrame* kidFrame = mFrames.FirstChild();
ReflowOutput kidDesiredSize(aReflowInput);
WritingMode wm = kidFrame->GetWritingMode();
LogicalSize availableSpace = aReflowInput.AvailableSize(wm);
const WritingMode kidWM = kidFrame->GetWritingMode();
LogicalSize availableSpace = aReflowInput.AvailableSize(kidWM);
ReflowInput kidReflowInput(aPresContext, aReflowInput, kidFrame,
availableSpace);