Bug 1402203 - Add a new layout phase for displaylist building. r=mstange

This commit is contained in:
Timothy Nikkel 2017-09-26 15:57:57 +13:00
Родитель 5fa5f70015
Коммит 9b61794af5
5 изменённых файлов: 25 добавлений и 0 удалений

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

@ -37,6 +37,7 @@ EXPORTS += [
'FrameProperties.h',
'LayoutLogging.h',
'MobileViewportManager.h',
'nsAutoLayoutPhase.h',
'nsBidi.h',
'nsBidiPresUtils.h',
'nsCaret.h',

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

@ -33,14 +33,27 @@ nsAutoLayoutPhase::Enter()
case eLayoutPhase_Paint:
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_Paint] == 0,
"recurring into paint");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_DisplayListBuilding] == 0,
"recurring into paint from display list building");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_Reflow] == 0,
"painting in the middle of reflow");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0,
"painting in the middle of frame construction");
break;
case eLayoutPhase_DisplayListBuilding:
// It's fine and expected to be in a paint here.
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_DisplayListBuilding] == 0,
"recurring into display list building");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_Reflow] == 0,
"display list building in the middle of reflow");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0,
"display list building in the middle of frame construction");
break;
case eLayoutPhase_Reflow:
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_Paint] == 0,
"reflowing in the middle of a paint");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_DisplayListBuilding] == 0,
"reflowing in the middle of a display list building");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_Reflow] == 0,
"recurring into reflow");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0,
@ -49,6 +62,8 @@ nsAutoLayoutPhase::Enter()
case eLayoutPhase_FrameC:
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_Paint] == 0,
"constructing frames in the middle of a paint");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_DisplayListBuilding] == 0,
"constructing frames in the middle of a display list building");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_Reflow] == 0,
"constructing frames in the middle of reflow");
MOZ_ASSERT(mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0,

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

@ -108,6 +108,7 @@ struct nsAutoLayoutPhase;
enum nsLayoutPhase {
eLayoutPhase_Paint,
eLayoutPhase_DisplayListBuilding, // sometimes a subset of the paint phase
eLayoutPhase_Reflow,
eLayoutPhase_FrameC,
eLayoutPhase_COUNT

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

@ -1218,6 +1218,10 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
state->mCaretFrame = nullptr;
state->mFirstFrameMarkedForDisplay = mFramesMarkedForDisplay.Length();
#ifdef DEBUG
state->mAutoLayoutPhase.emplace(aReferenceFrame->PresContext(), eLayoutPhase_DisplayListBuilding);
#endif
state->mPresShell->UpdateCanvasBackground();
if (mIsPaintingToWindow) {

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

@ -37,6 +37,7 @@
#include "mozilla/gfx/UserData.h"
#include "mozilla/layers/LayerAttributes.h"
#include "nsCSSRenderingBorders.h"
#include "nsAutoLayoutPhase.h"
#include "nsDisplayItemTypes.h"
#include <stdint.h>
@ -1474,6 +1475,9 @@ private:
struct PresShellState {
nsIPresShell* mPresShell;
#ifdef DEBUG
mozilla::Maybe<nsAutoLayoutPhase> mAutoLayoutPhase;
#endif
nsIFrame* mCaretFrame;
nsRect mCaretRect;
mozilla::Maybe<OutOfFlowDisplayData> mFixedBackgroundDisplayData;