1 /* 2 * Copyright (c) 2021-2022 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_COMMON_DECLARATION_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DECLARATION_COMMON_DECLARATION_H 18 19 #include <functional> 20 #include <string> 21 #include <unordered_map> 22 #include <vector> 23 24 #include "base/json/json_util.h" 25 #include "base/memory/ace_type.h" 26 #include "core/components/declaration/common/attribute.h" 27 #include "core/components/declaration/common/event.h" 28 #include "core/components/declaration/common/method.h" 29 #include "core/components/declaration/common/style.h" 30 #include "core/components/scroll/scroll_position_controller.h" 31 #include "core/pipeline/pipeline_context.h" 32 #include "frameworks/core/components/transform/click_spring_effect.h" 33 #include "base/geometry/calc_dimension.h" 34 35 namespace OHOS::Ace { 36 37 using OnSetAttributeFunc = std::function<void()>; 38 using OnSetStyleFinishedFunc = std::function<void()>; 39 using CachePseudoClassStyleFunc = std::function<void(std::pair<std::string, std::string>)>; 40 41 class ACE_EXPORT Declaration : public virtual AceType { 42 DECLARE_ACE_TYPE(Declaration, AceType); 43 44 public: 45 Declaration(); 46 ~Declaration() override; 47 48 virtual void SetAttr(const std::vector<std::pair<std::string, std::string>>& attrs); 49 virtual void SetStyle(const std::vector<std::pair<std::string, std::string>>& styles); 50 virtual void AddEvent(int32_t pageId, const std::string& eventId, const std::vector<std::string>& events); 51 virtual void CallMethod(const std::string& method, const std::string& args); 52 virtual void OnRequestFocus(bool shouldFocus); 53 virtual void OnScrollBy(double dx, double dy, bool isSmooth); 54 virtual void SetShowAttr(const std::string& showValue); 55 // Initialize declaration theme style when created. InitializeStyle()56 virtual void InitializeStyle() {} Clear()57 virtual void Clear() {} 58 59 Attribute& GetAttribute(AttributeTag tag) const; 60 Style& GetStyle(StyleTag tag) const; 61 Event& GetEvent(EventTag tag) const; 62 Method& GetMethod(MethodTag tag) const; 63 64 template<class T> MaybeResetAttribute(AttributeTag tag)65 T& MaybeResetAttribute(AttributeTag tag) 66 { 67 auto& attr = static_cast<T&>(GetAttribute(tag)); 68 if (!attr.IsValid() || !attr.IsShared()) { 69 return attr; 70 } 71 auto newAttr = std::make_shared<T>(attr); 72 newAttr->isShared = false; 73 attributes_[tag] = newAttr; 74 return *newAttr; 75 } 76 77 template<class T> MaybeResetStyle(StyleTag tag)78 T& MaybeResetStyle(StyleTag tag) 79 { 80 auto& style = static_cast<T&>(GetStyle(tag)); 81 if (!style.IsValid() || !style.IsShared()) { 82 return style; 83 } 84 auto newStyle = std::make_shared<T>(style); 85 newStyle->isShared = false; 86 styles_[tag] = newStyle; 87 return *newStyle; 88 } 89 90 template<class T> MaybeResetEvent(EventTag tag)91 T& MaybeResetEvent(EventTag tag) 92 { 93 auto& event = static_cast<T&>(GetEvent(tag)); 94 if (!event.IsValid() || !event.IsShared()) { 95 return event; 96 } 97 auto newEvent = std::make_shared<T>(event); 98 newEvent->isShared = false; 99 events_[tag] = newEvent; 100 return *newEvent; 101 } 102 103 template<class T> MaybeResetMethod(MethodTag tag)104 T& MaybeResetMethod(MethodTag tag) 105 { 106 auto& method = static_cast<T&>(GetMethod(tag)); 107 if (!method.IsValid() || !method.IsShared()) { 108 return method; 109 } 110 auto newMethod = std::make_shared<T>(method); 111 newMethod->isShared = false; 112 methods_[tag] = newMethod; 113 return *newMethod; 114 } 115 116 void Init(); 117 void SetCurrentStyle(const std::pair<std::string, std::string>& style); 118 void BindPipelineContext(const WeakPtr<PipelineContext>& pipelineContext); 119 void ResetDefaultStyles(); 120 void SetClickEvent(const EventMarker& onClick); 121 void SetRemoteMessageEvent(const EventMarker& remoteMessage); 122 SetOnSetAttribute(const OnSetAttributeFunc & onSetAttribute)123 void SetOnSetAttribute(const OnSetAttributeFunc& onSetAttribute) 124 { 125 onSetAttribute_ = onSetAttribute; 126 } 127 SetOnSetStyleFinished(const OnSetStyleFinishedFunc & onSetStyleFinished)128 void SetOnSetStyleFinished(const OnSetStyleFinishedFunc& onSetStyleFinished) 129 { 130 onSetStyleFinished_ = onSetStyleFinished; 131 } 132 SetCachePseudoClassStyle(const CachePseudoClassStyleFunc & cachePseudoClassStyle)133 void SetCachePseudoClassStyle(const CachePseudoClassStyleFunc& cachePseudoClassStyle) 134 { 135 cachePseudoClassStyle_ = cachePseudoClassStyle; 136 } 137 SetFocusableController(const RefPtr<FocusableController> & focusableController)138 void SetFocusableController(const RefPtr<FocusableController>& focusableController) 139 { 140 focusableController_ = focusableController; 141 } 142 SetPositionController(const RefPtr<ScrollPositionController> & positionController)143 void SetPositionController(const RefPtr<ScrollPositionController>& positionController) 144 { 145 positionController_ = positionController; 146 } 147 GetBackDecoration()148 const RefPtr<Decoration>& GetBackDecoration() const 149 { 150 return backDecoration_; 151 } 152 SetBackDecoration(const RefPtr<Decoration> & backDecoration)153 void SetBackDecoration(const RefPtr<Decoration>& backDecoration) 154 { 155 backDecoration_ = backDecoration; 156 } 157 GetFrontDecoration()158 const RefPtr<Decoration>& GetFrontDecoration() const 159 { 160 return frontDecoration_; 161 } 162 SetShareId(const std::string & shareId)163 void SetShareId(const std::string& shareId) 164 { 165 shareId_ = shareId; 166 } 167 GetShareId()168 const std::string& GetShareId() const 169 { 170 return shareId_; 171 } 172 SetIsSubscriptEnable(bool isSubscriptEnable)173 void SetIsSubscriptEnable(bool isSubscriptEnable) 174 { 175 isSubscriptEnable_ = isSubscriptEnable; 176 } 177 IsDisabled()178 bool IsDisabled() const 179 { 180 return isDisabled_; 181 } 182 IsWaiting()183 bool IsWaiting() const 184 { 185 return isWaiting_; 186 } 187 IsChecked()188 bool IsChecked() const 189 { 190 return isChecked_; 191 } 192 SetIsChecked(bool isChecked)193 void SetIsChecked(bool isChecked) 194 { 195 isChecked_ = isChecked; 196 } 197 IsHover()198 bool IsHover() const 199 { 200 return isHover_; 201 } 202 SetIsHover(bool isHover)203 void SetIsHover(bool isHover) 204 { 205 isHover_ = isHover; 206 } 207 HasTransformStyle()208 bool HasTransformStyle() const 209 { 210 return hasTransformStyle_; 211 } 212 HasBackGroundColor()213 bool HasBackGroundColor() const 214 { 215 return hasBackGroundColor_; 216 } SetHasBackGroundColor(bool hasBackGroundColor)217 void SetHasBackGroundColor(bool hasBackGroundColor) 218 { 219 hasBackGroundColor_ = hasBackGroundColor; 220 } 221 HasDecorationStyle()222 bool HasDecorationStyle() const 223 { 224 return hasDecorationStyle_; 225 } SetHasDecorationStyle(bool hasDecorationStyle)226 void SetHasDecorationStyle(bool hasDecorationStyle) 227 { 228 hasDecorationStyle_ = hasDecorationStyle; 229 } 230 HasPositionProcessed()231 bool HasPositionProcessed() const 232 { 233 return hasPositionProcessed_; 234 } SetHasPositionProcessed(bool hasPositionProcessed)235 void SetHasPositionProcessed(bool hasPositionProcessed) 236 { 237 hasPositionProcessed_ = hasPositionProcessed; 238 } 239 HasBoxStyle()240 bool HasBoxStyle() const 241 { 242 return hasBoxStyle_; 243 } SetHasBoxStyle(bool hasBoxStyle)244 void SetHasBoxStyle(bool hasBoxStyle) 245 { 246 hasBoxStyle_ = hasBoxStyle; 247 } 248 HasShadowStyle()249 bool HasShadowStyle() const 250 { 251 return hasShadowStyle_; 252 } SetHasShadowStyle(bool hasShadowStyle)253 void SetHasShadowStyle(bool hasShadowStyle) 254 { 255 hasShadowStyle_ = hasShadowStyle; 256 } 257 HasFrontDecorationStyle()258 bool HasFrontDecorationStyle() const 259 { 260 return hasFrontDecorationStyle_; 261 } SetHasFrontDecorationStyle(bool hasFrontDecorationStyle)262 void SetHasFrontDecorationStyle(bool hasFrontDecorationStyle) 263 { 264 hasFrontDecorationStyle_ = hasFrontDecorationStyle; 265 } 266 HasBorderStyle()267 bool HasBorderStyle() const 268 { 269 return hasBorderStyle_; 270 } SetHasBorderStyle(bool hasBorderStyle)271 void SetHasBorderStyle(bool hasBorderStyle) 272 { 273 hasBorderStyle_ = hasBorderStyle; 274 } 275 HasBorderRadiusStyle()276 bool HasBorderRadiusStyle() const 277 { 278 return hasBorderRadiusStyle_; 279 } SetHasBorderRadiusStyle(bool hasBorderRadiusStyle)280 void SetHasBorderRadiusStyle(bool hasBorderRadiusStyle) 281 { 282 hasBorderRadiusStyle_ = hasBorderRadiusStyle; 283 } 284 HasClickEffect()285 bool HasClickEffect() const 286 { 287 return hasClickEffect_; 288 } SetHasClickEffect(bool hasClickEffect)289 void SetHasClickEffect(bool hasClickEffect) 290 { 291 hasClickEffect_ = hasClickEffect; 292 } 293 HasTransitionAnimation()294 bool HasTransitionAnimation() const 295 { 296 return hasTransitionAnimation_; 297 } SetHasTransitionAnimation(bool hasTransitionAnimation)298 void SetHasTransitionAnimation(bool hasTransitionAnimation) 299 { 300 hasTransitionAnimation_ = hasTransitionAnimation; 301 } 302 HasOverflowStyle()303 bool HasOverflowStyle() const 304 { 305 return hasOverflowStyle_; 306 } SetHasOverflowStyle(bool hasOverflowStyle)307 void SetHasOverflowStyle(bool hasOverflowStyle) 308 { 309 hasOverflowStyle_ = hasOverflowStyle; 310 } 311 HasTransformOriginStyle()312 bool HasTransformOriginStyle() const 313 { 314 return hasTransformOriginStyle_; 315 } SetHasTransformOriginStyle(bool hasTransformOriginStyle)316 void SetHasTransformOriginStyle(bool hasTransformOriginStyle) 317 { 318 hasTransformOriginStyle_ = hasTransformOriginStyle; 319 } 320 HasDisplayStyle()321 bool HasDisplayStyle() const 322 { 323 return hasDisplayStyle_; 324 } SetHasDisplayStyle(bool hasDisplayStyle)325 void SetHasDisplayStyle(bool hasDisplayStyle) 326 { 327 hasDisplayStyle_ = hasDisplayStyle; 328 } 329 HasIdAttr()330 bool HasIdAttr() const 331 { 332 return hasIdAttr_; 333 } SetHasIdAttr(bool hasIdAttr)334 void SetHasIdAttr(bool hasIdAttr) 335 { 336 hasIdAttr_ = hasIdAttr; 337 } 338 HasLeft()339 bool HasLeft() const 340 { 341 return hasLeft_; 342 } SetHasLeft(bool hasLeft)343 void SetHasLeft(bool hasLeft) 344 { 345 hasLeft_ = hasLeft; 346 } 347 HasTop()348 bool HasTop() const 349 { 350 return hasTop_; 351 } SetHasTop(bool hasTop)352 void SetHasTop(bool hasTop) 353 { 354 hasTop_ = hasTop; 355 } 356 HasRight()357 bool HasRight() const 358 { 359 return hasRight_; 360 } SetHasRight(bool hasRight)361 void SetHasRight(bool hasRight) 362 { 363 hasRight_ = hasRight; 364 } 365 HasBottom()366 bool HasBottom() const 367 { 368 return hasBottom_; 369 } SetHasBottom(bool hasBottom)370 void SetHasBottom(bool hasBottom) 371 { 372 hasBottom_ = hasBottom; 373 } 374 HasPositionStyle()375 bool HasPositionStyle() const 376 { 377 return hasPositionStyle_; 378 } SetHasPositionStyle(bool hasPositionStyle)379 void SetHasPositionStyle(bool hasPositionStyle) 380 { 381 hasPositionStyle_ = hasPositionStyle; 382 } 383 GetUseLiteStyle()384 bool GetUseLiteStyle() const 385 { 386 return useLiteStyle_; 387 } SetUseLiteStyle(bool useLiteStyle)388 void SetUseLiteStyle(bool useLiteStyle) 389 { 390 useLiteStyle_ = useLiteStyle; 391 } 392 SetFlexShrink(double flexShrink)393 void SetFlexShrink(double flexShrink) 394 { 395 auto& flexStyle = MaybeResetStyle<CommonFlexStyle>(StyleTag::COMMON_FLEX_STYLE); 396 flexStyle.flexShrink = flexShrink; 397 } 398 399 bool IsRightToLeft() const; 400 401 static void SetMaskGradient(const std::string& value, Declaration& declaration); 402 403 protected: 404 virtual void InitCommonAttribute(); 405 virtual void InitCommonStyle(); 406 virtual void InitCommonEvent(); 407 virtual void InitCommonMethod(); InitSpecialized()408 virtual void InitSpecialized() {} 409 410 // Each subclass needs to override this function to obtain the properties. If it returns true, it means that the 411 // property has been consumed. If it returns false, it means it is handed over to the parent class. SetSpecializedAttr(const std::pair<std::string,std::string> & attr)412 virtual bool SetSpecializedAttr(const std::pair<std::string, std::string>& attr) 413 { 414 return false; 415 } 416 417 // Each subclass needs to override this function to obtain the style. If it returns true, it means that the 418 // style has been consumed. If it returns false, it means it is handed over to the parent class. SetSpecializedStyle(const std::pair<std::string,std::string> & style)419 virtual bool SetSpecializedStyle(const std::pair<std::string, std::string>& style) 420 { 421 return false; 422 } 423 424 // Each subclass needs to override this function to obtain the event. If it returns true, it means that the 425 // event has been consumed. If it returns false, it means it is handed over to the parent class. SetSpecializedEvent(int32_t pageId,const std::string & eventId,const std::string & event)426 virtual bool SetSpecializedEvent(int32_t pageId, const std::string& eventId, const std::string& event) 427 { 428 return false; 429 } 430 CallSpecializedMethod(const std::string & method,const std::string & args)431 virtual void CallSpecializedMethod(const std::string& method, const std::string& args) {} 432 433 // When the multi-mode input subscript is set to auto, need to determine whether the current component has the 434 // ability to support the subscript. IsSubscriptEnable()435 virtual bool IsSubscriptEnable() const 436 { 437 return isSubscriptEnable_; 438 } 439 440 void AddCommonAttribute(AttributeTag tag); 441 void AddCommonStyle(StyleTag tag); 442 void AddCommonEvent(EventTag tag); 443 void AddCommonMethod(MethodTag tag); 444 445 void AddSpecializedAttribute(std::shared_ptr<Attribute>&& specializedAttribute); 446 void AddSpecializedStyle(std::shared_ptr<Style>&& specializedStyle); 447 void AddSpecializedEvent(std::shared_ptr<Event>&& specializedEvent); 448 void AddSpecializedRemoteMessageEvent(std::shared_ptr<Event>&& specializedEvent); 449 void AddSpecializedMethod(std::shared_ptr<Method>&& specializedMethod); 450 451 static void SetBackgroundImagePosition(const std::string& value, Declaration& declaration); 452 static void SetBackgroundImageSize(const std::string& value, Declaration& declaration); 453 static void SetPaddingOverall(const std::string& value, Declaration& declaration); 454 static void SetMarginOverall(const std::string& value, Declaration& declaration); 455 static void SetBorderOverall(const std::string& value, Declaration& declaration); 456 static void SetBorderWidthForFourEdges(const std::string& value, Declaration& declaration); 457 static void SetBorderColorForFourEdges(const std::string& value, Declaration& declaration); 458 static void SetBorderStyleForFourEdges(const std::string& value, Declaration& declaration); 459 static void SetBackground(const std::string& value, Declaration& declaration); 460 static void SetGradientType(const std::string& gradientType, Declaration& declaration); 461 static void SetGradientDirections(const std::unique_ptr<JsonValue>& gradientDirections, Declaration& declaration); 462 static void SetGradientColor(const std::unique_ptr<JsonValue>& gradientColorValues, Declaration& declaration); 463 static void SetGradientShape(const std::string& gradientShape, Declaration& declaration); 464 static void SetGradientSize(const std::string& gradientSize, Declaration& declaration); 465 static void SetGradientPosition(const std::string& gradientPosition, Declaration& declaration); 466 static void SetGradientAngle(const std::string& gradientPosition, Declaration& declaration); 467 static void SetGradientRotation(const std::string& gradientRotation, Declaration& declaration); 468 static void SetTransform(const std::string& value, Declaration& declaration); 469 static void SetBorderImage(const std::string& value, Declaration& declaration); 470 static void SetBorderImageUrl(const std::unique_ptr<JsonValue>& values, Declaration& declaration); 471 static void SetBorderImageGradient(const std::unique_ptr<JsonValue>& values, Declaration& declaration); 472 473 static void SetBorderImageWidthForFourEdges(const std::string& value, Declaration& declaration); 474 static void SetBorderImageSliceForFourEdges(const std::string& value, Declaration& declaration); 475 static void SetBorderImageOutSetForFourEdges(const std::string& value, Declaration& declaration); 476 static void SetBorderImageRepeatForFourEdges(const std::string& value, Declaration& declaration); 477 static void SetBorderImageGradientType(const std::string& gradientType, Declaration& declaration); 478 static void SetBorderImageGradientDirections( 479 const std::unique_ptr<JsonValue>& gradientDirections, Declaration& declaration); 480 static void SetBorderImageGradientColor(const std::unique_ptr<JsonValue>& gradientColorValues, 481 Declaration& declaration); 482 static void SetBorderImageFindUrl(const std::string& value, Declaration& declaration); 483 484 std::string GetTransformJsonValue(const std::string& value); 485 std::string GetTransformType(const std::unique_ptr<JsonValue>& transformJson); 486 std::string GetTransformTypeValue(const std::unique_ptr<JsonValue>& transformJson); 487 488 RefPtr<ThemeManager> GetThemeManager() const; 489 RefPtr<ThemeConstants> GetThemeConstants() const; 490 491 template<typename T> GetTheme()492 RefPtr<T> GetTheme() const 493 { 494 auto context = pipelineContext_.Upgrade(); 495 if (!context) { 496 return nullptr; 497 } 498 auto themeManager = context->GetThemeManager(); 499 if (!themeManager) { 500 return nullptr; 501 } 502 return themeManager->GetTheme<T>(); 503 } 504 505 template<typename T> ParseThemeReference(const std::string & value,std::function<T ()> && noRefFunc,std::function<T (uint32_t refId)> && idRefFunc,const T & errorValue)506 T ParseThemeReference(const std::string& value, std::function<T()>&& noRefFunc, 507 std::function<T(uint32_t refId)>&& idRefFunc, const T& errorValue) const 508 { 509 const auto& parseResult = ThemeUtils::ParseThemeIdReference(value, GetThemeConstants()); 510 if (!parseResult.parseSuccess) { 511 return noRefFunc(); 512 } 513 auto themeConstants = GetThemeConstants(); 514 if (!themeConstants) { 515 return errorValue; 516 } 517 // Refer to a theme id resource. 518 if (parseResult.isIdRef) { 519 return idRefFunc(parseResult.id); 520 } 521 // Refer to a theme attribute. 522 auto themeStyle = themeConstants->GetThemeStyle(); 523 if (!themeStyle) { 524 return errorValue; 525 } 526 return themeStyle->GetAttr<T>(parseResult.refAttr, errorValue); 527 } 528 529 /* 530 * Parse color from string content and reference for id/attr, including format: 531 * #rrggbb, #aarrggbb, "@id001", "@attr_sys_color". 532 */ 533 Color ParseColor(const std::string& value, uint32_t maskAlpha = COLOR_ALPHA_MASK) const; 534 535 /* 536 * Parse double from string content and reference for id/attr, including format: 537 * 100.01, "@id001", "@attr_sys_alpha". 538 */ 539 double ParseDouble(const std::string& value) const; 540 541 /* 542 * Parse dimension from string content and reference for id/attr, including format: 543 * 10px, "@id001", "@attr_sys_dimension". 544 */ 545 Dimension ParseDimension(const std::string& value, bool useVp = false) const; 546 547 /* 548 * Parse calcdimension from string content and reference for id/attr, including format: 549 * calc(100% - 10px), 10px, "@id001", "@attr_sys_dimension". 550 */ 551 CalcDimension ParseCalcDimension(const std::string& value, bool useVp = false) const; 552 553 /* 554 * Parse line height from string content and reference for id/attr, including format: 555 * 1.5, "@id001", "@attr_sys_line_height". 556 */ 557 Dimension ParseLineHeight(const std::string& value) const; 558 559 /* 560 * Parse font family list from string content and reference for id/attr, including format: 561 * sans-serif, "@id001", "@attr_sys_font_family". 562 */ 563 std::vector<std::string> ParseFontFamilies(const std::string& value) const; 564 565 /* 566 * Parse dimension list from string content and reference for id/attr, including format: 567 * 10px, "@id001", "@attr_sys_dimension". 568 */ 569 std::vector<Dimension> ParsePreferFontSizes(const std::string& value) const; 570 571 /* 572 * Parse image src from string content and reference for id/attr, including format: 573 * "@app.media.customized_image", "@sys.media.123". 574 */ 575 std::string ParseImageSrc(const std::string& imgSrc) const; 576 577 WeakPtr<PipelineContext> pipelineContext_; 578 579 private: 580 std::unordered_map<AttributeTag, std::shared_ptr<Attribute>> attributes_; 581 std::unordered_map<StyleTag, std::shared_ptr<Style>> styles_; 582 std::unordered_map<EventTag, std::shared_ptr<Event>> events_; 583 std::unordered_map<MethodTag, std::shared_ptr<Method>> methods_; 584 585 RefPtr<Decoration> backDecoration_; 586 RefPtr<Decoration> frontDecoration_; 587 RefPtr<FocusableController> focusableController_; 588 RefPtr<ScrollPositionController> positionController_; 589 590 OnSetAttributeFunc onSetAttribute_; 591 OnSetStyleFinishedFunc onSetStyleFinished_; 592 CachePseudoClassStyleFunc cachePseudoClassStyle_; 593 594 std::string shareId_; 595 596 bool isSubscriptEnable_ = false; 597 bool isDisabled_ = false; 598 bool isWaiting_ = false; 599 bool isChecked_ = false; 600 bool isHover_ = false; 601 bool hasTransformStyle_ = false; 602 bool hasBackGroundColor_ = false; 603 bool hasPositionProcessed_ = false; 604 bool hasBoxStyle_ = false; 605 bool hasShadowStyle_ = false; 606 bool hasDecorationStyle_ = false; 607 bool hasFrontDecorationStyle_ = false; 608 bool hasBorderStyle_ = false; 609 bool hasBorderRadiusStyle_ = false; 610 bool hasClickEffect_ = false; 611 bool hasTransitionAnimation_ = false; 612 bool hasOverflowStyle_ = false; 613 bool hasTransformOriginStyle_ = false; 614 bool hasDisplayStyle_ = false; 615 bool hasPositionStyle_ = false; 616 bool hasLeft_ = false; 617 bool hasTop_ = false; 618 bool hasRight_ = false; 619 bool hasBottom_ = false; 620 bool useLiteStyle_ = false; 621 // The target node (with id attribute) for popup should be added gesture event handler, 622 // it's ok to take 'id' as a flag, even not all dom nodes with id attribute should do this. 623 bool hasIdAttr_ = false; 624 }; 625 626 }; // namespace OHOS::Ace 627 628 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DECLARATION_COMMON_DECLARATION_H