mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
Corresponding backend CL: https://crrev.com/c/3075106 Screenshot: https://imgur.com/a/64z9jhp Design doc: Design doc: https://docs.google.com/document/d/1FGwUsRC3UHXJjcJ5H2DhMi2E2bIFY2tmUBuL984UK-I/edit#heading=h.48af6be715km Bug: chromium:1146422 Change-Id: I04ca10c1f1cee5914c7a8c18f352bfc94843a7ba Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3080307 Commit-Queue: Changhao Han <changhaohan@chromium.org> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> Reviewed-by: Johan Bay <jobay@chromium.org>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
// Copyright 2021 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 type {PathCommands} from './common.js';
|
|
import type {LineStyle} from './highlight_common.js';
|
|
import {buildPath, drawPathWithLineStyle, emptyBounds} from './highlight_common.js';
|
|
|
|
interface QueryingDescendantData {
|
|
descendantBorder: PathCommands;
|
|
}
|
|
export interface ContainerQueryHighlight {
|
|
containerBorder: PathCommands;
|
|
queryingDescendants?: QueryingDescendantData[];
|
|
containerQueryContainerHighlightConfig: {
|
|
containerBorder?: LineStyle,
|
|
descendantBorder?: LineStyle,
|
|
};
|
|
}
|
|
|
|
export function drawContainerQueryHighlight(
|
|
highlight: ContainerQueryHighlight, context: CanvasRenderingContext2D, emulationScaleFactor: number) {
|
|
const config = highlight.containerQueryContainerHighlightConfig;
|
|
const bounds = emptyBounds();
|
|
const borderPath = buildPath(highlight.containerBorder, bounds, emulationScaleFactor);
|
|
drawPathWithLineStyle(context, borderPath, config.containerBorder, 2 /* thicker container outline */);
|
|
|
|
if (!highlight.queryingDescendants) {
|
|
return;
|
|
}
|
|
|
|
for (const descendant of highlight.queryingDescendants) {
|
|
const descendantBounds = emptyBounds();
|
|
const descendantBorderPath = buildPath(descendant.descendantBorder, descendantBounds, emulationScaleFactor);
|
|
drawPathWithLineStyle(context, descendantBorderPath, config.descendantBorder);
|
|
}
|
|
}
|