Commit fb292f93 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez Committed by Pier Angelo Vendrame
Browse files

Bug 2029699 - Simplify InlineBackgroundData handling. a=diannaS DONTBUILD

parent 323bc2a4
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -74,8 +74,6 @@ using namespace mozilla::image;
using mozilla::CSSSizeOrRatio;
using mozilla::dom::Document;

static int gFrameTreeLockCount = 0;

// To avoid storing this data on nsInlineFrame (bloat) and to avoid
// recalculating this for each frame in a continuation (perf), hold
// a cache of various coordinate information that we need in order
@@ -273,8 +271,6 @@ struct InlineBackgroundData {

  void SetFrame(nsIFrame* aFrame) {
    MOZ_ASSERT(aFrame, "Need a frame");
    NS_ASSERTION(gFrameTreeLockCount > 0,
                 "Can't call this when frame tree is not locked");

    if (aFrame == mFrame) {
      return;
@@ -1359,12 +1355,8 @@ ComputedStyle* nsCSSRendering::FindBackground(const nsIFrame* aForFrame) {
  return nullptr;
}

void nsCSSRendering::BeginFrameTreesLocked() { ++gFrameTreeLockCount; }

void nsCSSRendering::EndFrameTreesLocked() {
  NS_ASSERTION(gFrameTreeLockCount > 0, "Unbalanced EndFrameTreeLocked");
  --gFrameTreeLockCount;
  if (gFrameTreeLockCount == 0) {
void nsCSSRendering::PresShellChanged() {
  if (gInlineBGData) {
    gInlineBGData->Reset();
  }
}
+2 −11
Original line number Diff line number Diff line
@@ -512,17 +512,8 @@ struct nsCSSRendering {
                                       const nsStyleImageLayers::Layer& aLayer,
                                       uint32_t aFlags);

  /**
   * Called when we start creating a display list. The frame tree will not
   * change until a matching EndFrameTreeLocked is called.
   */
  static void BeginFrameTreesLocked();
  /**
   * Called when we've finished using a display list. When all
   * BeginFrameTreeLocked calls have been balanced by an EndFrameTreeLocked,
   * the frame tree may start changing again.
   */
  static void EndFrameTreesLocked();
  /** Called when we switch pres shells during painting. */
  static void PresShellChanged();

  // Draw a border segment in the table collapsing border model with beveling
  // corners.
+3 −3
Original line number Diff line number Diff line
@@ -754,8 +754,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
}

void nsDisplayListBuilder::BeginFrame() {
  nsCSSRendering::BeginFrameTreesLocked();

  mIsPaintingToWindow = false;
  mUseHighQualityScaling = false;
  mIgnoreSuppression = false;
@@ -771,7 +769,6 @@ void nsDisplayListBuilder::EndFrame() {
  mActiveScrolledRoots.Clear();
  FreeClipChains();
  FreeTemporaryItems();
  nsCSSRendering::EndFrameTreesLocked();
}

void nsDisplayListBuilder::MarkFrameForDisplay(nsIFrame* aFrame,
@@ -1042,6 +1039,8 @@ void nsDisplayListBuilder::IncrementPresShellPaintCount(PresShell* aPresShell) {

void nsDisplayListBuilder::EnterPresShell(const nsIFrame* aReferenceFrame,
                                          bool aPointerEventsNoneDoc) {
  nsCSSRendering::PresShellChanged();

  PresShellState* state = mPresShellStates.AppendElement();
  state->mPresShell = aReferenceFrame->PresShell();
  state->mFirstFrameMarkedForDisplay = mFramesMarkedForDisplay.Length();
@@ -1200,6 +1199,7 @@ void nsDisplayListBuilder::LeavePresShell(const nsIFrame* aReferenceFrame,
      CurrentPresShellState()->mPresShell == aReferenceFrame->PresShell(),
      "Presshell mismatch");

  nsCSSRendering::PresShellChanged();
  if (mIsPaintingToWindow && aPaintedContents) {
    nsPresContext* pc = aReferenceFrame->PresContext();
    if (!pc->HadNonBlankPaint()) {