• 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 
16 #ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_TEXT_LAYOUT_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_TEXT_LAYOUT_H
18 
19 #include "base/geometry/dimension.h"
20 #include "base/memory/ace_type.h"
21 #include "base/memory/referenced.h"
22 #include "bridge/declarative_frontend/engine/bindings_defines.h"
23 #include "bridge/declarative_frontend/engine/js_types.h"
24 #include "bridge/declarative_frontend/jsview/js_container_base.h"
25 #include "bridge/declarative_frontend/style_string/js_span_object.h"
26 #include "core/components_ng/pattern/text/span/mutable_span_string.h"
27 #include "core/components_ng/pattern/text/span/span_string.h"
28 #include "core/pipeline/pipeline_base.h"
29 
30 namespace OHOS::Ace::Framework {
31 
32 class JSTextLayout : public Referenced {
33 public:
34     JSTextLayout() = default;
35     ~JSTextLayout() override = default;
36 
37     static void JSBind(BindingTarget globalObj);
38 
Constructor(const JSCallbackInfo & args)39     static void Constructor(const JSCallbackInfo& args)
40     {
41         auto jsTextlayout = Referenced::MakeRefPtr<JSTextLayout>();
42         jsTextlayout->IncRefCount();
43         args.SetReturnValue(Referenced::RawPtr(jsTextlayout));
44     }
45 
Destructor(JSTextLayout * jsTextlayout)46     static void Destructor(JSTextLayout* jsTextlayout)
47     {
48         if (jsTextlayout) {
49             jsTextlayout->DecRefCount();
50         }
51     }
52 
53     static CalcDimension ParseLengthMetrics(const JSRef<JSObject>& obj);
54     static void GetParagraphs(const JSCallbackInfo& info);
55 };
56 
57 } // namespace OHOS::Ace::Framework
58 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_STYLE_STRING_JS_TEXT_LAYOUT_H