mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-12 17:45:49 +08:00
Pending on roll: https://crrev.com/c/3535880 Bug: 1222574, 1222573, 1298025 Change-Id: Ic0e55115adb2d7354fc5961db68f5dcda4c8cb5a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3535881 Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> Commit-Queue: Changhao Han <changhaohan@chromium.org>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
// Copyright 2022 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
import type * as Protocol from '../../generated/protocol.js';
|
|
|
|
import type {CSSModel} from './CSSModel.js';
|
|
import {CSSQuery} from './CSSQuery.js';
|
|
|
|
export class CSSSupports extends CSSQuery {
|
|
static parseSupportsPayload(cssModel: CSSModel, payload: Protocol.CSS.CSSSupports[]): CSSSupports[] {
|
|
return payload.map(supports => new CSSSupports(cssModel, supports));
|
|
}
|
|
|
|
#active: boolean = true;
|
|
|
|
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSSupports) {
|
|
super(cssModel);
|
|
this.reinitialize(payload);
|
|
}
|
|
|
|
reinitialize(payload: Protocol.CSS.CSSSupports): void {
|
|
this.text = payload.text;
|
|
this.range = payload.range ? TextUtils.TextRange.TextRange.fromObject(payload.range) : null;
|
|
this.styleSheetId = payload.styleSheetId;
|
|
this.#active = payload.active;
|
|
}
|
|
|
|
active(): boolean {
|
|
return this.#active;
|
|
}
|
|
}
|