1 /*
2  * Copyright (c) 2021 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DECLARATION_DIV_DIV_DECLARATION_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DECLARATION_DIV_DIV_DECLARATION_H
18 
19 #include "core/components/declaration/common/declaration.h"
20 #include "frameworks/bridge/common/dom/dom_type.h"
21 #include "frameworks/core/components/scroll/scroll_position_controller.h"
22 
23 namespace OHOS::Ace {
24 
25 struct DivAttribute : Attribute {
26     bool isCard = false;
27     bool isCardBlur = false;
28 };
29 
30 struct DivStyle : Style {
31     FlexDirection flexDirection = FlexDirection::ROW;
32     bool isFlexWrap = false;
33     std::string justifyContent = DOM_JUSTIFY_CONTENT_START;
34     std::string alignItems = DOM_ALIGN_ITEMS_STRETCH;
35     std::string alignContent = DOM_ALIGN_CONTENT_START;
36     std::string columnsArgs;
37     std::string rowsArgs;
38     double columnGap = 0.0;
39     double rowGap = 0.0;
40     int32_t rowStart = -1;
41     int32_t rowEnd = -1;
42     int32_t columnStart = -1;
43     int32_t columnEnd = -1;
44     std::string direction = DOM_FLEX_ROW;
45     std::pair<bool, Color> scrollBarColor;
46     std::pair<bool, Dimension> scrollBarWidth;
47     EdgeEffect edgeEffect = EdgeEffect::NONE;
48 };
49 
50 class DivDeclaration : public Declaration {
51     DECLARE_ACE_TYPE(DivDeclaration, Declaration);
52 
53 public:
54     DivDeclaration() = default;
55     ~DivDeclaration() override = default;
56 
57 protected:
58     void InitSpecialized() override;
59     bool SetSpecializedAttr(const std::pair<std::string, std::string>& attr) override;
60     bool SetSpecializedStyle(const std::pair<std::string, std::string>& style) override;
61 };
62 
63 } // namespace OHOS::Ace
64 
65 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DECLARATION_DIV_DIV_DECLARATION_H
66