Bug 1963464 - Initial implementation of PaintTimingMixin for the PaintTiming and LCP entries r=sefeng,webidl
This patch implements PaintTimingMixin with only the `paintTime`, without the `presentationTime`. The presentationTime property is nullable in the spec and the browsers might choose to not implement it. We would like to implement it in the future, but we will do that as a follow-up. Differential Revision: https://phabricator.services.mozilla.com/D247305
This commit is contained in:
committed by
canaltinova@gmail.com
parent
e57af4a3ae
commit
f6513849ba
@@ -90,6 +90,8 @@ class LargestContentfulPaint final : public PerformanceEntry {
|
|||||||
DOMHighResTimeStamp RenderTime() const;
|
DOMHighResTimeStamp RenderTime() const;
|
||||||
DOMHighResTimeStamp LoadTime() const;
|
DOMHighResTimeStamp LoadTime() const;
|
||||||
DOMHighResTimeStamp StartTime() const override;
|
DOMHighResTimeStamp StartTime() const override;
|
||||||
|
DOMHighResTimeStamp PaintTime() const { return RenderTime(); }
|
||||||
|
Nullable<DOMHighResTimeStamp> GetPresentationTime() const { return nullptr; }
|
||||||
|
|
||||||
unsigned long Size() const { return mSize; }
|
unsigned long Size() const { return mSize; }
|
||||||
void GetId(nsAString& aId) const {
|
void GetId(nsAString& aId) const {
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ class PerformancePaintTiming final : public PerformanceEntry {
|
|||||||
JS::Handle<JSObject*> aGivenProto) override;
|
JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
DOMHighResTimeStamp StartTime() const override;
|
DOMHighResTimeStamp StartTime() const override;
|
||||||
|
DOMHighResTimeStamp PaintTime() const { return StartTime(); }
|
||||||
|
Nullable<DOMHighResTimeStamp> GetPresentationTime() const { return nullptr; }
|
||||||
|
|
||||||
size_t SizeOfIncludingThis(
|
size_t SizeOfIncludingThis(
|
||||||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||||
|
|||||||
16
dom/webidl/PaintTimingMixin.webidl
Normal file
16
dom/webidl/PaintTimingMixin.webidl
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* https://w3c.github.io/paint-timing/#sec-PaintTimingMixin
|
||||||
|
*
|
||||||
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||||
|
* liability, trademark and document use rules apply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface mixin PaintTimingMixin {
|
||||||
|
readonly attribute DOMHighResTimeStamp paintTime;
|
||||||
|
readonly attribute DOMHighResTimeStamp? presentationTime;
|
||||||
|
};
|
||||||
@@ -21,3 +21,5 @@ interface LargestContentfulPaint : PerformanceEntry {
|
|||||||
readonly attribute Element? element;
|
readonly attribute Element? element;
|
||||||
[Default] object toJSON();
|
[Default] object toJSON();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LargestContentfulPaint includes PaintTimingMixin;
|
||||||
|
|||||||
@@ -14,3 +14,5 @@
|
|||||||
interface PerformancePaintTiming : PerformanceEntry
|
interface PerformancePaintTiming : PerformanceEntry
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PerformancePaintTiming includes PaintTimingMixin;
|
||||||
|
|||||||
@@ -801,6 +801,7 @@ WEBIDL_FILES = [
|
|||||||
"OscillatorNode.webidl",
|
"OscillatorNode.webidl",
|
||||||
"PaintRequest.webidl",
|
"PaintRequest.webidl",
|
||||||
"PaintRequestList.webidl",
|
"PaintRequestList.webidl",
|
||||||
|
"PaintTimingMixin.webidl",
|
||||||
"PaintWorkletGlobalScope.webidl",
|
"PaintWorkletGlobalScope.webidl",
|
||||||
"PannerNode.webidl",
|
"PannerNode.webidl",
|
||||||
"ParentNode.webidl",
|
"ParentNode.webidl",
|
||||||
|
|||||||
Reference in New Issue
Block a user