1 /* 2 * Copyright (c) 2020-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 OHOS_ACELITE_COMPONENT_H 17 #define OHOS_ACELITE_COMPONENT_H 18 19 #include "ace_log.h" 20 #include "ace_mem_base.h" 21 #include "component_utils.h" 22 #include "event_listener.h" 23 #include "memory_heap.h" 24 #include "non_copyable.h" 25 #include "stylemgr/app_style_manager.h" 26 #include "transition_impl.h" 27 28 namespace OHOS { 29 namespace ACELite { 30 enum DimensionType : uint8_t { 31 TYPE_UNKNOWN = 0, 32 TYPE_PIXEL, 33 TYPE_PERCENT, 34 }; 35 36 union DimensionValue { 37 float percentage; 38 int16_t pixel; 39 }; 40 41 struct Dimension : public MemoryHeap { DimensionDimension42 Dimension() : type(DimensionType::TYPE_UNKNOWN) 43 { 44 value.percentage = -1; 45 } DimensionDimension46 Dimension(float dValue, DimensionType dType) 47 { 48 value.percentage = dValue; 49 type = dType; 50 } 51 DimensionValue value; 52 DimensionType type; 53 }; 54 55 /** 56 * @brief The ConstrainedParameter struct record the content rang limitation 57 */ 58 struct ConstrainedParameter : public MemoryHeap { ConstrainedParameterConstrainedParameter59 ConstrainedParameter() : maxWidth(0), maxHeight(0) {} ConstrainedParameterConstrainedParameter60 ConstrainedParameter(int16_t width, int16_t height) : maxWidth(width), maxHeight(height) {} 61 int16_t maxWidth; 62 int16_t maxHeight; 63 }; 64 65 class Component : public MemoryHeap { 66 public: 67 ACE_DISALLOW_COPY_AND_MOVE(Component); 68 Component() = delete; 69 Component(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager); ~Component()70 virtual ~Component() 71 { 72 if (trans_ != nullptr) { 73 delete (trans_); 74 trans_ = nullptr; 75 } 76 } 77 78 /** 79 * @brief After construct a specific component, call this function to setup this component's native view 80 * and process attribute/events/style/children properly before binding it on an JS object. 81 * It generally calls a series of functions to complete the render work, some of which are needed to be 82 * implemented by child class. See step1~step6 function notes. 83 * 84 * @return true if success, false if any error occurs 85 */ 86 bool Render(); 87 /** 88 * @brief Call this function to release all the resource related to this component, includes the native views, 89 * JS objects and any event listeners. 90 */ 91 void Release(); 92 /** 93 * @brief This method is called to change/update the attribute/style values on native view. 94 * It mainly is used by watcher callbacks to do the view updating. 95 * 96 * NOTE: currently, we don't support style data binding. 97 * 98 * @return true if any attribute/style matches and update successfully, otherwise false 99 */ 100 bool UpdateView(uint16_t attrKeyId, jerry_value_t attrValue); 101 /** 102 * @brief Child class must implement this method to return its own native view, if it only creates one 103 * native view, just return it simaply, if it creates multiple views out, it should return the root of 104 * those views, it's child class's responsibility to organize their hierarchy. 105 * 106 * @return the root of the component's native view 107 */ 108 virtual UIView *GetComponentRootView() const = 0; 109 110 /** 111 * @brief This is the entry to set all combined styles into one specific component, one default 112 * implementation is provided, which calls ApplyPrivateStyle() to try the component's private special 113 * style first, if one gets matched, the appling process ends, if not, common styles will be 114 * tried by calling ApplyCommonStyle() method. 115 * 116 * NOTE: The default implementation just apply styles into the ui view returned by GetComponentRootView(), 117 * if this doesn't meet your requirement, go ahead to override this whole function as you want. 118 * 119 * @return true if the given style gets matched and is set properly, false for otherwise. 120 */ 121 virtual bool ApplyStyle(const AppStyleItem *style); 122 /** 123 * Call this to invalidate the views this component is holding, the default implementation is just to 124 * invalidate the root view of the component, if the child class has special requirement, override this 125 * method to do that. 126 */ 127 virtual void Invalidate(); GetNativeElement()128 jerry_value_t GetNativeElement() const 129 { 130 return nativeElement_; 131 } 132 GetComponentName()133 uint16_t GetComponentName() const 134 { 135 return componentName_; 136 } 137 IsFreeze()138 bool IsFreeze() const 139 { 140 return freeze_; 141 } 142 GetViewModel()143 JSValue GetViewModel() const 144 { 145 return viewModel_; 146 } 147 148 // update this view binded by for instruction when watch triggered. UpdateForView()149 virtual bool UpdateForView() 150 { 151 return false; 152 } 153 GetChildren()154 jerry_value_t GetChildren() const 155 { 156 return children_; 157 } 158 GetDescriptors()159 jerry_value_t GetDescriptors() const 160 { 161 return descriptors_; 162 } 163 164 jerry_value_t AddWatcherItem(const jerry_value_t attrKey, const jerry_value_t attrValue, 165 bool isLazyLoading = false); 166 167 void HandleChildrenChange(jerry_value_t descriptor); 168 169 /** 170 * @brief AttachView call this function to link native views together to the tree 171 */ AttachView(const Component * child)172 virtual void AttachView(const Component *child) 173 { 174 UNUSED(child); 175 } 176 /** 177 * @brief OnVisibleChanged the component can be notified if the visibility status is changed 178 */ OnVisibilityChanged(bool isVisible)179 virtual void OnVisibilityChanged(bool isVisible) {} 180 /** 181 * @brief OnViewAttached called when the native view is attached to the tree 182 */ OnViewAttached()183 virtual void OnViewAttached() {} LayoutChildren()184 virtual void LayoutChildren() {} 185 static void BuildViewTree(Component *currComponent, Component *parent, const ConstrainedParameter &parentParameter); 186 GetParent()187 Component *GetParent() const 188 { 189 return parent_; 190 } 191 GetChildHead()192 Component *GetChildHead() const 193 { 194 return childHead_; 195 } 196 GetNextSibling()197 Component *GetNextSibling() const 198 { 199 return nextSibling_; 200 } 201 struct AnimationsNode : public MemoryHeap { 202 TransitionImpl *transitionImpl; 203 AnimationsNode *next; 204 AnimationsNodeAnimationsNode205 AnimationsNode() : transitionImpl(nullptr), next(nullptr) {} 206 }; 207 208 static void HandlerAnimations(); 209 static void ReleaseAnimations(); 210 /** 211 * @brief GetDimension return the dimension data, only width, height, margin, top and left are supported 212 * @param keyNameId the key ID for representing which dimension data is wanted 213 * @return the requested dimension data 214 */ 215 const Dimension &GetDimension(uint16_t keyNameId) const; 216 SetWidth(const int16_t width)217 void SetWidth(const int16_t width) 218 { 219 width_.type = DimensionType::TYPE_PIXEL; 220 width_.value.pixel = width; 221 } 222 SetHeight(const int16_t height)223 void SetHeight(const int16_t height) 224 { 225 height_.type = DimensionType::TYPE_PIXEL; 226 height_.value.pixel = height; 227 } 228 void GetConstrainedParam(ConstrainedParameter ¶m) const; 229 /** 230 * @brief This function will be called after the ApplyCommonStyle, make padding style work. 231 */ 232 bool AdaptBoxSizing(uint16_t attrKeyId = K_UNKNOWN) const; 233 void AlignDimensions(const ConstrainedParameter ¶m); 234 void EnableTransmitSwipe(); 235 236 protected: SetComponentName(uint16_t name)237 void SetComponentName(uint16_t name) 238 { 239 componentName_ = name; 240 } 241 242 void RegisterNamedFunction(const char * const name, jerry_external_handler_t handler) const; 243 244 /** 245 * @brief The child class can implement this function to do some initialization before the whole render process 246 * beginning. See PostRender() also. The default implementation just does nothing. 247 */ PreRender()248 virtual void PreRender() {} 249 /** 250 * @brief This function will be called after the whole render process is done for current component. 251 * The child class can implement this function to do some tail work. 252 * See PreRender() also. The default implementation just does nothing. 253 */ PostRender()254 virtual void PostRender() {} 255 /** 256 * @brief This function will be called when UpdateView begin to execute (attribute change which bind with data 257 * will trigger UpdateView to execute), you can override this function to do some customise actions. 258 * The default implementation just does nothing. 259 */ PreUpdate()260 virtual void PreUpdate() {} 261 /** 262 * @brief This function will be called when UpdateView execute finished. See PreUpdate() also. 263 * The default implementation just does nothing. 264 */ PostUpdate(uint16_t attrKeyId)265 virtual void PostUpdate(uint16_t attrKeyId) {} 266 /** 267 * @brief step1: inherited class must override this method to create the native views, it's the child class's 268 * responsibility to record the native views it creates out, and they should be released properly in release 269 * method. 270 * 271 * NOTE: child class must check if the native views are not null after new xxx call, return true if it is 272 * not nullptr, otherwise return false, so framework know this component's rendering is failing and it can 273 * do the recycling action accordingly. 274 * 275 * @return true for success, false for failure 276 */ CreateNativeViews()277 virtual bool CreateNativeViews() 278 { 279 return true; 280 } 281 /** 282 * @brief This function must be implemented by child classes. Should release all the native views it 283 * creates out in CreateNativeViews() function. 284 */ ReleaseNativeViews()285 virtual void ReleaseNativeViews() {} 286 /** 287 * @brief Mapping native view with DOM element. 288 */ 289 virtual void SetViewExtraMsg(); 290 virtual void ReleaseViewExtraMsg(); 291 /** 292 * @brief This is the entry to set all attributes into one specific component, one default 293 * implementation is provided, which calls SetPrivateAttribute() to try the component's private special 294 * attribute first, if one gets matched, the setting process ends, if not, common attributes will be 295 * tried by calling SetCommonAttribute() method. 296 * 297 * NOTE: The default implementation just apply attribute into the ui view returned by GetComponentRootView(), 298 * if this doesn't meet your requirement, go ahead to override this whole function as you want. 299 * 300 * @return true if the given attribute gets matched and is set properly, false for otherwise. 301 */ 302 virtual bool SetAttribute(uint16_t attrKeyId, jerry_value_t attrValue); 303 /** 304 * @brief Child class should call this to set common attribute to a given native view. 305 * 306 * @return true if any common attribute key matches successfully, false if no match at all 307 */ 308 bool SetCommonAttribute(UIView& view, const uint16_t attrKeyId, const jerry_value_t attrValue); 309 /** 310 * @brief Child class should call this to set own special attribute setting/update actions 311 * 312 * @return true if any common attribute key matches successfully, false if no match at all 313 */ SetPrivateAttribute(uint16_t attrKeyId,jerry_value_t attrValue)314 virtual bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) 315 { 316 return false; 317 } 318 319 /** 320 * @brief This is the entry to register all event listener into one specific component, one default 321 * implementation is provided, which calls RegisterPrivateEventListener() to try the component's private 322 * special event type first, if one gets matched, the registering process ends, if not, common attributes 323 * will be tried by calling RegisterCommonEventListener() method. 324 * 325 * NOTE: The default implementation just apply attribute into the ui view returned by GetComponentRootView(), 326 * if this doesn't meet your requirement, go ahead to override this whole function as you want. 327 * 328 * @return true if the given event gets matched and is set properly, false for otherwise. 329 */ 330 virtual bool RegisterEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation); 331 /** 332 * @brief Child class should call this to set common event listener to a given native view. 333 * 334 * @return true if any common event type matches successfully, false if no match at all 335 */ 336 bool RegisterCommonEventListener(UIView& view, 337 const uint16_t eventTypeId, 338 const jerry_value_t funcValue, 339 bool isStopPropagation); 340 /** 341 * @brief Child class should call this to set own special event setting/update actions. 342 * 343 * @return true if any common event type matches successfully, false if no match at all 344 */ RegisterPrivateEventListener(uint16_t eventTypeId,jerry_value_t funcValue,bool isStopPropagation)345 virtual bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) 346 { 347 return false; 348 } 349 350 /** 351 * @brief Used to set all common styles for all kinds of component. 352 * 353 * @return true if any common attribute key matches successfully, false if no match at all 354 */ 355 bool ApplyCommonStyle(UIView& view, const AppStyleItem *style); 356 /** 357 * @brief Child class should call this to set own special attribute setting/update actions 358 * 359 * @return true if any common attribute key matches successfully, false if no match at all 360 */ ApplyPrivateStyle(const AppStyleItem * style)361 virtual bool ApplyPrivateStyle(const AppStyleItem *style) 362 { 363 return false; 364 } 365 366 /** 367 * @brief If a child component is a container, it should implement this method to add children into itself. 368 * This function returns true as default if child doesn't override it. 369 */ ProcessChildren()370 virtual bool ProcessChildren() 371 { 372 return true; 373 } 374 GetStyleManager()375 AppStyleManager *GetStyleManager() const 376 { 377 return styleManager_; 378 } 379 GetOptions()380 jerry_value_t GetOptions() const 381 { 382 return options_; 383 } 384 385 /** 386 * @brief combine RGB color by red, green, blue from int color value, 387 * 388 * @param [in] colorIntValue. 389 */ GetRGBColor(uint32_t colorIntValue)390 ColorType GetRGBColor(uint32_t colorIntValue) const 391 { 392 uint32_t colorUintValue = colorIntValue; 393 uint8_t red8 = uint8_t((colorUintValue & TEXT_RED_COLOR_MASK) >> RED_COLOR_START_BIT); 394 uint8_t green8 = uint8_t((colorUintValue & TEXT_GREEN_COLOR_MASK) >> GREEN_COLOR_START_BIT); 395 uint8_t blue8 = uint8_t((colorUintValue & TEXT_BLUE_COLOR_MASK)); 396 return Color::GetColorFromRGB(red8, green8, blue8); 397 } 398 399 jerry_value_t SetListForWatcher(jerry_value_t getter, jerry_value_t children); 400 void HandleListForDireactive(); 401 void AppendChildren(Component *parent); 402 bool AppendDescriptorOrElement(Component *parent, const jerry_value_t descriptorOrElement); 403 void AppendIfDescriptor(Component *parent, const jerry_value_t descriptor); 404 void AppendForDescriptor(Component *parent, const jerry_value_t descriptor); 405 void AppendElement(Component *parent, const jerry_value_t element); 406 void CreateDirectiveWatcher(jerry_value_t descriptor); 407 void UpdateDescriptor(Component *parent, const jerry_value_t descriptor); 408 void ReappendDescriptorOrElement(Component *parent, const jerry_value_t descriptor); GetStyleNumValue(const AppStyleItem * style)409 int32_t GetStyleNumValue(const AppStyleItem *style) const 410 { 411 return style->GetNumValue(); 412 } GetStylePropNameId(const AppStyleItem * style)413 uint16_t GetStylePropNameId(const AppStyleItem *style) const 414 { 415 return style->GetPropNameId(); 416 } GetStyleStrValue(const AppStyleItem * style)417 const char *GetStyleStrValue(const AppStyleItem *style) const 418 { 419 return style->GetStrValue(); 420 } GetStyleStrValueLen(const AppStyleItem * style)421 uint8_t GetStyleStrValueLen(const AppStyleItem *style) const 422 { 423 return style->GetStrValueLen(); 424 } IsStyleValueTypeNum(const AppStyleItem * styleItem)425 bool IsStyleValueTypeNum(const AppStyleItem *styleItem) const 426 { 427 return styleItem->GetValueType() == STYLE_PROP_VALUE_TYPE_NUMBER; 428 } IsStyleValueTypeString(const AppStyleItem * styleItem)429 bool IsStyleValueTypeString(const AppStyleItem *styleItem) const 430 { 431 return styleItem->GetValueType() == STYLE_PROP_VALUE_TYPE_STRING; 432 } GetHeight()433 int16_t GetHeight() const 434 { 435 return (height_.type == TYPE_PIXEL) ? height_.value.pixel : INVALID_PIXEL_VALUE; 436 } GetWidth()437 int16_t GetWidth() const 438 { 439 return (width_.type == TYPE_PIXEL) ? width_.value.pixel : INVALID_PIXEL_VALUE; 440 } 441 GetDomElementPointer()442 jerry_value_t *GetDomElementPointer() 443 { 444 return &nativeElement_; 445 } 446 447 int32_t GetStylePixelValue(const AppStyleItem *style, int32_t defaultValue = 0) const; 448 int16_t GetStyleDegValue(const AppStyleItem *style, int16_t defaultValue = 0) const; 449 bool GetStyleColorValue(const AppStyleItem *style, uint32_t &color, uint8_t &alpha) const; 450 void SetPadding(UIView &view, const AppStyleItem& styleItem) const; 451 void SetLeftPadding(UIView &view, const AppStyleItem& styleItem) const; 452 void SetTopPadding(UIView &view, const AppStyleItem& styleItem) const; 453 void SetRightPadding(UIView &view, const AppStyleItem& styleItem) const; 454 void SetBottomPadding(UIView &view, const AppStyleItem& styleItem) const; 455 void SetBorderWidth(UIView &view, const AppStyleItem& styleItem) const; 456 void SetBorderColor(UIView &view, const AppStyleItem& styleItem) const; 457 void SetBorderRadius(UIView &view, const AppStyleItem& styleItem) const; 458 void SetBackgroundColor(UIView &view, const AppStyleItem& styleItem) const; 459 void SetOpacity(UIView &view, const AppStyleItem &styleItem) const; 460 void SetLeftMargin(UIView &view) const; 461 void SetTopMargin(UIView &view) const; 462 void SetRightMargin(UIView &view) const; 463 void SetBottomMargin(UIView &view) const; 464 void SetMargin(UIView &view) const; 465 virtual void ApplyAlignedMargin(UIView &uiView) const; 466 467 /** 468 * @brief get the pressedImage url and the normal image url 469 * @param styleItem the style item which contains image info 470 * @param pressedImage the pseudo value in style item 471 * @param normalImage the normal image url 472 * @return if get the image url success return true, else false 473 */ 474 bool HandleBackgroundImg(const AppStyleItem &styleItem, char *&pressedImage, char *&normalImage) const; 475 476 #if (FEATURE_ROTATION_API == 1) 477 /** 478 * @brief the rotation API handling function, the child component can register it for rotation API supporting 479 * @param func function object 480 * @param dom the context of function execution 481 * @param args the list of arguments 482 * @param size the length of arguments list 483 * @return the handling result to caller 484 */ 485 static jerry_value_t HandleRotationRequest(const jerry_value_t func, 486 const jerry_value_t dom, 487 const jerry_value_t args[], 488 const jerry_length_t size); 489 #endif // FEATURE_ROTATION_API 490 private: 491 /** 492 * @brief Used to set animation keyframes, such as transform, background-color, height etc. 493 * it is set as attribute, and support binding to data, so it can be changed dynamically. 494 * 495 * the following three functions will called in order 496 */ 497 void SetAnimationKeyFrames(const UIView& view, const AppStyleItem *styleItem); 498 void SetAnimationKeyFrames(const AppStyleItem *item); 499 void SetAnimationKeyFrames(int16_t keyId, int32_t valueFrom, int32_t valueTo); 500 /** 501 * @brief Used to set animation style, such as animation during, delay, iteration count etc. 502 * it is set as style, now it not support binding to data, so it can not be changed dynamiclly. 503 */ 504 void SetAnimationStyle(const UIView& view, const AppStyleItem *styleItem, const int16_t keyId); 505 /** 506 * @brief Record current component`s animation. All animations of components will be called when the whole page 507 * render complete. 508 */ 509 void RecordAnimation(); 510 /** 511 * @brief In updateView progress, the current component`s animation will be called immediately. 512 */ 513 void StartAnimation(); 514 void ReleaseTransitionParam(); 515 /** 516 * @brief Used to get animation item value. 517 * for example: tranformX from 100px to 200px, index = 1 to get from value, index = 2 to get to value. 518 * 519 * @return animation value, such as 100px 520 */ 521 int32_t GetAnimatorValue(char *animatorValue, const int8_t index, bool isOpacity = false) const; 522 523 void ParseOptions(); 524 void ParseAttrs(); 525 void ParseEvents(); 526 void BindEvents(const char *type, bool isStopPropagation); 527 /** 528 * @brief Apply combined styles into native view. 529 */ 530 void ApplyStyles(const jerry_value_t options, Component& currentComponent) const; 531 bool IsLayoutRelatedAttrs(uint16_t attrKeyId) const; 532 void ApplyAlignedPosition(UIView &uiView) const; 533 void AdapteBoxRectArea(UIView &uiView) const; 534 void SetVisible(UIView& view, const AppStyleItem *styleItem) const; 535 void SetClickEventListener(UIView& view, const jerry_value_t eventFunc, bool isStopPropagation); 536 void SetLongPressEventListener(UIView& view, const jerry_value_t eventFunc, bool isStopPropagation); 537 void SetSwipeEventListener(UIView& view, jerry_value_t eventFunc, bool isStopPropagation); 538 void SetTouchStartEventListener(UIView& view, jerry_value_t eventFunc, bool isStopPropagation); 539 void SetTouchMoveEventListener(UIView& view, jerry_value_t eventFunc, bool isStopPropagation); 540 void SetTouchEndEventListener(UIView& view, jerry_value_t eventFunc, bool isStopPropagation); 541 #ifdef JS_EXTRA_EVENT_SUPPORT 542 void SetTouchCancelEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation); 543 void SetKeyBoardEventListener(jerry_value_t eventFunc, bool isStopPropagation); 544 #endif 545 /** 546 * @brief release common event listeners if any is set 547 */ 548 void ReleaseCommonEventListeners(); 549 void AppendDescriptorOrElements(Component *parent, const JSValue descriptorOrElements); 550 /** 551 * @brief For some situations, if the component's rect(position, width, height and so on) area is changed, need 552 * to force the parent container to relayout all children, and need to invalided self before the changes are 553 * applied. 554 * 555 * @param attrKeyId which attribute or style is being changing 556 * @param invalidateSelf true for just invaliding self, false for to relayout parent, default is false. 557 */ 558 void InvalidateIfNeeded(uint16_t attrKeyId, bool invalidateSelf = false) const; 559 void AddAnimationToList(const TransitionImpl *transitionImpl) const; 560 561 void GetDimensionFromStyle(Dimension &dimension, const AppStyleItem &styleItem) const; 562 void CalculateDimensionPixel(Dimension &dimension, int16_t base) const; OnDimensionsAligned()563 virtual void OnDimensionsAligned() {} 564 bool IsAttached() const; 565 566 /** 567 * @brief SetParent assign parent node 568 * @param parent current component's parent 569 */ SetParent(Component * parent)570 void SetParent(Component *parent) 571 { 572 parent_ = parent; 573 } SetNextSibling(Component * next)574 void SetNextSibling(Component *next) 575 { 576 nextSibling_ = next; 577 } 578 /** 579 * @brief AddChild insert one child 580 * @param childNode child component 581 * 582 * NOTE: add one child will not attach the native view immediately, but 583 * when removing one child, the child native view will be detached immediately 584 */ 585 void AddChild(Component *childNode); 586 /** 587 * @brief RemoveChild cut off the specific child from current component 588 * @param childNode the child component 589 */ 590 void RemoveChild(Component *childNode); 591 /** 592 * @brief RemoveAllChildren clean all children 593 */ 594 void RemoveAllChildren(); 595 596 /** 597 * @brief childHead_ the child list 598 */ 599 Component *childHead_; 600 /** 601 * @brief nextSibling_ next neighbor 602 */ 603 Component *nextSibling_; 604 /** 605 * @brief parent_ parent component node 606 */ 607 Component *parent_; 608 609 AppStyleManager *styleManager_; 610 jerry_value_t nativeElement_; 611 jerry_value_t viewModel_; 612 jerry_value_t options_; 613 jerry_value_t children_; 614 ViewOnClickListener *onClickListener_; 615 ViewOnLongPressListener *onLongPressListener_; 616 ViewOnTouchListener *onTouchListener_; 617 #ifdef JS_EXTRA_EVENT_SUPPORT 618 ViewOnTouchCancelListener *onTouchCancelListener_; 619 KeyBoardEventListener *keyBoardEventListener_; 620 #endif 621 /** 622 * record view id, need to be released when this component get released 623 */ 624 char *viewId_; 625 uint16_t componentName_; 626 bool rendered_; 627 bool isAnimationKeyFramesSet_; 628 bool freeze_; 629 TransitionImpl *curTransitionImpl_; 630 TransitionParams *trans_; 631 jerry_value_t descriptors_; 632 Watcher *watchersHead_; 633 Dimension height_; 634 Dimension width_; 635 Dimension top_; 636 Dimension left_; 637 Dimension marginTop_; 638 Dimension marginLeft_; 639 Dimension marginRight_; 640 Dimension marginBottom_; 641 }; 642 } // namespace ACELite 643 } // namespace OHOS 644 645 #endif // OHOS_ACELITE_COMPONENT_H 646