Bug 1430869 - use mVisibleRect instead of GetRect. r?jrmuizel draft
authorAlexis Beingessner <a.beingessner@gmail.com>
Mon, 23 Apr 2018 15:08:04 -0400
changeset 786665 ad05835e090a65836b02514d97614a8644e4b985
parent 783746 5ded36cb383d3ccafd9b6c231c5120dcdae196a2
child 787910 fcff95e6a9a031f7f2de5dddbf396050acc06f89
push id107557
push userbmo:a.beingessner@gmail.com
push dateMon, 23 Apr 2018 19:15:38 +0000
reviewersjrmuizel
bugs1430869
milestone61.0a1
Bug 1430869 - use mVisibleRect instead of GetRect. r?jrmuizel An ancient comment from 1998 assures us that GetRect is wrong if there are captions. The painting code instead uses mVisibleRect which appears to be correct. MozReview-Commit-ID: 6Lax4sjInJu
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1290,16 +1290,17 @@ bool
 nsDisplayTableBorderCollapse::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
                                                       wr::IpcResourceUpdateQueue& aResources,
                                                       const StackingContextHelper& aSc,
                                                       mozilla::layers::WebRenderLayerManager* aManager,
                                                       nsDisplayListBuilder* aDisplayListBuilder)
 {
   static_cast<nsTableFrame *>(mFrame)->CreateWebRenderCommandsForBCBorders(aBuilder,
                                                                           aSc,
+                                                                          mVisibleRect,
                                                                           ToReferenceFrame());
   return true;
 }
 
 /* static */ void
 nsTableFrame::GenericTraversal(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
                                const nsDisplayListSet& aLists)
 {
@@ -8024,22 +8025,23 @@ nsTableFrame::PaintBCBorders(DrawTarget&
 {
   BCPaintBorderAction action(aDrawTarget);
   IterateBCBorders(action, aDirtyRect);
 }
 
 void
 nsTableFrame::CreateWebRenderCommandsForBCBorders(wr::DisplayListBuilder& aBuilder,
                                                   const mozilla::layers::StackingContextHelper& aSc,
+                                                  const nsRect& aVisibleRect,
                                                   const nsPoint& aOffsetToReferenceFrame)
 {
   BCPaintBorderAction action(aBuilder, aSc, aOffsetToReferenceFrame);
-  // We always draw whole table border for webrender. Passing the table rect as
+  // We always draw whole table border for webrender. Passing the visible rect
   // dirty rect.
-  IterateBCBorders(action, GetRect());
+  IterateBCBorders(action, aVisibleRect - aOffsetToReferenceFrame);
 
   LayoutDeviceRect allBorderRect;
   wr::BorderSide wrSide[4];
   wr::BorderWidths wrWidths;
   wr::BorderRadius borderRadii = wr::EmptyBorderRadius();
   bool backfaceIsVisible = false;
   NS_FOR_CSS_SIDES(side) {
     auto param = action.mCreateWebRenderCommandsData.mBevelBorders[side];
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -296,17 +296,18 @@ public:
   friend class nsDelayedCalcBCBorders;
 
   void AddBCDamageArea(const mozilla::TableArea& aValue);
   bool BCRecalcNeeded(ComputedStyle* aOldComputedStyle,
                         ComputedStyle* aNewComputedStyle);
   void PaintBCBorders(DrawTarget& aDrawTarget, const nsRect& aDirtyRect);
   void CreateWebRenderCommandsForBCBorders(mozilla::wr::DisplayListBuilder& aBuilder,
                                            const mozilla::layers::StackingContextHelper& aSc,
-                                           const nsPoint& aPt);
+                                           const nsRect& aVisibleRect,
+                                           const nsPoint& aOffsetToReferenceFrame);
 
   virtual void MarkIntrinsicISizesDirty() override;
   // For border-collapse tables, the caller must not add padding and
   // border to the results of these functions.
   virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
   virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
   IntrinsicISizeOffsetData IntrinsicISizeOffsets(nscoord aPercentageBasis =
                                                  NS_UNCONSTRAINEDSIZE) override;