diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-03 17:25:37 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-03 17:25:37 +0100 |
commit | ee663e2930650d181be1f7792952dfc32baf0bf0 (patch) | |
tree | abdd19afea50c19264680e566dcb6ef46810fcdf /layout/base/nsDisplayList.h | |
parent | db98e3efff6087b690805358e6f4fda118ec9627 (diff) | |
download | UXP-ee663e2930650d181be1f7792952dfc32baf0bf0.tar UXP-ee663e2930650d181be1f7792952dfc32baf0bf0.tar.gz UXP-ee663e2930650d181be1f7792952dfc32baf0bf0.tar.lz UXP-ee663e2930650d181be1f7792952dfc32baf0bf0.tar.xz UXP-ee663e2930650d181be1f7792952dfc32baf0bf0.zip |
Issue #146 - Part 3: Create nsDisplayTableBackgroundImage to avoid
display list collisions when processing the background image of a table.
Diffstat (limited to 'layout/base/nsDisplayList.h')
-rw-r--r-- | layout/base/nsDisplayList.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 69d13ded9..e9047b113 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -2814,6 +2814,8 @@ protected: void PaintInternal(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx, const nsRect& aBounds, nsRect* aClipRect); + virtual nsIFrame* StyleFrame() { return mFrame; } + // Determine whether we want to be separated into our own layer, independent // of whether this item can actually be layerized. enum ImageLayerization { @@ -2860,6 +2862,41 @@ static_assert( TableType GetTableTypeFromFrame(nsIFrame* aFrame); /** + * A display item to paint background image for table. For table parts, such + * as row, row group, col, col group, when drawing its background, we'll + * create separate background image display item for its containning cell. + * Those background image display items will reference to same DisplayItemData + * if we keep the mFrame point to cell's ancestor frame. We don't want to this + * happened bacause share same DisplatItemData will cause many bugs. So that + * we let mFrame point to cell frame and store the table type of the ancestor + * frame. And use mFrame and table type as key to generate DisplayItemData to + * avoid sharing DisplayItemData. + * + * Also store ancestor frame as mStyleFrame for all rendering informations. + */ +class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage { +public: + nsDisplayTableBackgroundImage(nsDisplayListBuilder* aBuilder, + nsIFrame* aFrame, + uint32_t aLayer, + const nsRect& aBackgroundRect, + const nsStyleBackground* aBackgroundStyle, + nsIFrame* aCellFrame); + + virtual uint32_t GetPerFrameKey() override { + return (static_cast<uint8_t>(mTableType) << nsDisplayItem::TYPE_BITS) | + nsDisplayItem::GetPerFrameKey(); + } + + virtual bool IsInvalid(nsRect& aRect) override; +protected: + virtual nsIFrame* StyleFrame() override { return mStyleFrame; } + + nsIFrame* mStyleFrame; + TableType mTableType; +}; + +/** * A display item to paint the native theme background for a frame. */ class nsDisplayThemedBackground : public nsDisplayItem { |