commit 36d547da710414dfe95936277ce13252f4803dea
parent e552e7599f7a19ff234390c32b52f8a64f38cc5f
Author: Botond Ballo <botond@mozilla.com>
Date: Thu, 13 Nov 2025 04:59:02 +0000
Bug 1730749 - Add a static version of nsDisplayItem::GetPerFrameKey() for use without a display item instance. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D254143
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h
@@ -2266,15 +2266,19 @@ class nsDisplayItem {
* Pairing this with the Frame() pointer gives a key that
* uniquely identifies this display item in the display item tree.
*/
- uint32_t GetPerFrameKey() const {
+ static uint32_t GetPerFrameKey(uint8_t aPageNum, uint16_t aPerFrameIndex,
+ DisplayItemType aType) {
// The top 8 bits are the page index
// The middle 16 bits of the per frame key uniquely identify the display
// item when there are more than one item of the same type for a frame.
// The low 8 bits are the display item type.
- return (static_cast<uint32_t>(mPageNum)
- << (TYPE_BITS + (sizeof(mPerFrameIndex) * 8))) |
- (static_cast<uint32_t>(mPerFrameIndex) << TYPE_BITS) |
- static_cast<uint32_t>(mType);
+ return (static_cast<uint32_t>(aPageNum)
+ << (TYPE_BITS + (sizeof(aPerFrameIndex) * 8))) |
+ (static_cast<uint32_t>(aPerFrameIndex) << TYPE_BITS) |
+ static_cast<uint32_t>(aType);
+ }
+ uint32_t GetPerFrameKey() const {
+ return GetPerFrameKey(mPageNum, mPerFrameIndex, mType);
}
/**