[tor-commits] [tor-browser] 69/76: Bug 1735265 - Part 1: Set clip on background items for table cols and colgroups, when the table cell has captured clip. r=mstange, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Mar 30 20:40:37 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.8.0esr-11.0-1
in repository tor-browser.

commit 3b7ec4026f7744f83e9acd4ff6dd668b2d7ae5a7
Author: Miko Mynttinen <mikokm at gmail.com>
AuthorDate: Tue Mar 22 18:40:51 2022 +0000

    Bug 1735265 - Part 1: Set clip on background items for table cols and colgroups, when the table cell has captured clip. r=mstange, a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D129681
---
 layout/tables/nsTableCellFrame.cpp | 19 +++++++++++++++++++
 layout/tables/nsTableFrame.cpp     |  3 +++
 layout/tables/nsTableFrame.h       |  9 +++++++++
 3 files changed, 31 insertions(+)

diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp
index 6c7423b3cc95f..163de5ac03a2b 100644
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -510,6 +510,25 @@ void nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
 
       bgRect += backgrounds->TableToReferenceFrame();
 
+      DisplayListClipState::AutoSaveRestore clipState(aBuilder);
+      nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter asrSetter(
+          aBuilder);
+      if (IsStackingContext()) {
+        // The col/colgroup items we create below will be inserted directly into the
+        // BorderBackgrounds list of the table frame. That means that they'll be moved
+        // *outside* of any wrapper items from this table cell, and will not participate in
+        // this table cell's opacity / transform / filter / mask effects.
+        // If this cell is a stacking context, then we may have one or more of those
+        // wrapper items, and one of them may have captured a clip. In order to ensure
+        // correct clipping and scrolling of the col/colgroup items, restore the clip and ASR
+        // that we observed when we entered the table frame.
+        // If this cell is a stacking context but doesn't have any clip capturing wrapper items,
+        // then we'll double-apply the clip. That's ok.
+        clipState.SetClipChainForContainingBlockDescendants(
+            backgrounds->GetTableClipChain());
+        asrSetter.SetCurrentActiveScrolledRoot(backgrounds->GetTableASR());
+      }
+
       // Create backgrounds items as needed for the column and column
       // group that this cell occupies.
       nsTableColFrame* col = backgrounds->GetColForIndex(ColIndex());
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index ad7d079833c04..c86a73f23bf90 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1179,6 +1179,9 @@ nsDisplayTableBackgroundSet::nsDisplayTableBackgroundSet(
       mBuilder->FindReferenceFrameFor(aTable, &mToReferenceFrame);
   MOZ_ASSERT(nsLayoutUtils::FindNearestCommonAncestorFrame(reference, aTable));
   mDirtyRect = mBuilder->GetDirtyRect();
+  mCombinedTableClipChain =
+      mBuilder->ClipState().GetCurrentCombinedClipChain(aBuilder);
+  mTableASR = mBuilder->CurrentActiveScrolledRoot();
 }
 
 // A display item that draws all collapsed borders for a table.
diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h
index dd59611dcb177..2e08fa67a9458 100644
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -94,6 +94,12 @@ class nsDisplayTableBackgroundSet {
 
   const nsRect& GetDirtyRect() { return mDirtyRect; }
 
+  const mozilla::DisplayItemClipChain* GetTableClipChain() {
+    return mCombinedTableClipChain;
+  }
+
+  const mozilla::ActiveScrolledRoot* GetTableASR() { return mTableASR; }
+
  private:
   // This class is only used on stack, so we don't have to worry about leaking
   // it.  Don't let us be heap-allocated!
@@ -109,6 +115,9 @@ class nsDisplayTableBackgroundSet {
   nsTArray<nsTableColFrame*> mColumns;
   nsPoint mToReferenceFrame;
   nsRect mDirtyRect;
+
+  const mozilla::DisplayItemClipChain* mCombinedTableClipChain;
+  const mozilla::ActiveScrolledRoot* mTableASR;
 };
 
 /* ========================================================================== */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list