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