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

gitolite role git at cupani.torproject.org
Tue Apr 26 15:30:37 UTC 2022


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

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit de9aa1748bb6c5d95d6c63a44430064875864a2d
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=dmeehan
    
    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 c1a1876e2032e..26ed40dbd07c5 100644
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -1093,6 +1093,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 132255318a92c..8701302103509 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -7528,6 +7528,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 7e83bb2b79c24..28e611d5cde16 100644
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -95,6 +95,12 @@ class nsDisplayTableBackgroundSet {
 
   const nsRect& GetDirtyRect() { return mDirtyRect; }
 
+  const DisplayItemClipChain* GetTableClipChain() {
+    return mCombinedTableClipChain;
+  }
+
+  const 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!
@@ -110,6 +116,9 @@ class nsDisplayTableBackgroundSet {
   nsTArray<nsTableColFrame*> mColumns;
   nsPoint mToReferenceFrame;
   nsRect mDirtyRect;
+
+  const DisplayItemClipChain* mCombinedTableClipChain;
+  const ActiveScrolledRoot* mTableASR;
 };
 
 }  // namespace mozilla

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


More information about the tor-commits mailing list