• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16const pip = requireNapi('pip');
17
18const TAG = 'WebPiPContent';
19class WebPiPContent extends ViewPU {
20    constructor(r, s, i1, j1 = -1, v1 = undefined, w1) {
21        super(r, i1, j1, w1);
22        if (typeof v1 === 'function') {
23            this.paramsGenerator_ = v1;
24        }
25        this.xComponentController = new XComponentController();
26        this.xComponentId = 'webPipContent';
27        this.xComponentType = XComponentType.SURFACE;
28        this.setInitiallyProvidedValue(s);
29    }
30    setInitiallyProvidedValue(q) {
31        if (q.xComponentController !== undefined) {
32            this.xComponentController = q.xComponentController;
33        }
34        if (q.xComponentId !== undefined) {
35            this.xComponentId = q.xComponentId;
36        }
37        if (q.xComponentType !== undefined) {
38            this.xComponentType = q.xComponentType;
39        }
40    }
41    updateStateVars(p) {
42    }
43    purgeVariableDependenciesOnElmtId(o) {
44    }
45    aboutToBeDeleted() {
46        SubscriberManager.Get().delete(this.id__());
47        this.aboutToBeDeletedInternal();
48    }
49    initialRender() {
50        this.observeComponentCreation2((m, n) => {
51            Stack.create();
52            Stack.size({ width: '100%', height: '100%' });
53        }, Stack);
54        this.buildXComponent.bind(this)();
55        Stack.pop();
56    }
57    buildXComponent(j = null) {
58        this.observeComponentCreation2((k, l) => {
59            XComponent.create({
60                id: this.xComponentId,
61                type: this.xComponentType,
62                controller: this.xComponentController
63            }, 'webPipContent_XComponent');
64            XComponent.onLoad(() => {
65                pip.initWebXComponentController(this.xComponentController, this.xComponentController.getXComponentSurfaceId());
66                console.debug(TAG, 'WebXComponent onLoad done');
67            });
68            XComponent.size({ width: '100%', height: '100%' });
69            XComponent.backgroundColor(Color.Transparent);
70        }, XComponent);
71    }
72    rerender() {
73        this.updateDirtyElements();
74    }
75    static getEntryName() {
76        return 'WebPiPContent';
77    }
78}
79
80ViewStackProcessor.StartGetAccessRecordingFor(ViewStackProcessor.AllocateNewElmetIdForNextComponent());
81loadDocument(new WebPiPContent(void 0, {}));
82ViewStackProcessor.StopGetAccessRecording();