diff --git a/ReactCommon/fabric/components/art/ARTBaseShadowNode.h b/ReactCommon/fabric/components/art/ARTBaseShadowNode.h index c105b608c0..e674551dc2 100644 --- a/ReactCommon/fabric/components/art/ARTBaseShadowNode.h +++ b/ReactCommon/fabric/components/art/ARTBaseShadowNode.h @@ -7,8 +7,8 @@ #pragma once +#include #include -#include #include namespace facebook { @@ -17,16 +17,16 @@ namespace react { class ARTBaseShadowNode { public: int test; - virtual Element::Shared getElement() const = 0; + virtual ARTElement::Shared getARTElement() const = 0; static void buildElements( ShadowNode const &parentNode, - Element::ListOfShared &outNodes) { + ARTElement::ListOfShared &outNodes) { for (auto const &child : parentNode.getChildren()) { auto baseShadowNode = std::dynamic_pointer_cast(child); if (baseShadowNode) { - outNodes.push_back(baseShadowNode->getElement()); + outNodes.push_back(baseShadowNode->getARTElement()); } } } diff --git a/ReactCommon/fabric/components/art/conversions.h b/ReactCommon/fabric/components/art/conversions.h index b16beaac0c..b234c6d0db 100644 --- a/ReactCommon/fabric/components/art/conversions.h +++ b/ReactCommon/fabric/components/art/conversions.h @@ -7,10 +7,10 @@ #include #include +#include +#include #include -#include -#include -#include +#include #include namespace facebook { @@ -18,10 +18,10 @@ namespace react { #ifdef ANDROID -inline folly::dynamic toDynamic(Group const &group); -inline folly::dynamic toDynamic(Shape const &shape); -inline folly::dynamic toDynamic(Text const &text); -inline folly::dynamic toDynamic(Element const &element); +inline folly::dynamic toDynamic(ARTGroup const &group); +inline folly::dynamic toDynamic(ARTShape const &shape); +inline folly::dynamic toDynamic(ARTText const &text); +inline folly::dynamic toDynamic(ARTElement const &element); inline folly::dynamic toDynamic(std::vector const &elements) { folly::dynamic result = folly::dynamic::array(); @@ -40,7 +40,7 @@ inline void addOptionalKey( } } -inline folly::dynamic toDynamic(Element::ListOfShared const &elements) { +inline folly::dynamic toDynamic(ARTElement::ListOfShared const &elements) { folly::dynamic children = folly::dynamic::array(); for (auto const &element : elements) { children.push_back(element->getDynamic()); @@ -48,7 +48,7 @@ inline folly::dynamic toDynamic(Element::ListOfShared const &elements) { return children; } -inline folly::dynamic toDynamic(Group const &group) { +inline folly::dynamic toDynamic(ARTGroup const &group) { folly::dynamic result = folly::dynamic::object(); result["opacity"] = group.opacity; result["type"] = 1; @@ -60,7 +60,7 @@ inline folly::dynamic toDynamic(Group const &group) { return result; } -inline folly::dynamic toDynamic(Shape const &shape) { +inline folly::dynamic toDynamic(ARTShape const &shape) { folly::dynamic result = folly::dynamic::object(); result["type"] = 2; result["opacity"] = shape.opacity; @@ -109,7 +109,7 @@ inline folly::dynamic toDynamic(ARTTextFrame const &frame) { return result; } -inline folly::dynamic toDynamic(Text const &text) { +inline folly::dynamic toDynamic(ARTText const &text) { folly::dynamic result = folly::dynamic::object(); result["type"] = 3; result["opacity"] = text.opacity; diff --git a/ReactCommon/fabric/components/art/group/ARTGroupProps.h b/ReactCommon/fabric/components/art/group/ARTGroupProps.h index bd4190c7db..2827288613 100644 --- a/ReactCommon/fabric/components/art/group/ARTGroupProps.h +++ b/ReactCommon/fabric/components/art/group/ARTGroupProps.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include #include diff --git a/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.cpp b/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.cpp index 0972a933e5..7d5301a53c 100644 --- a/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.cpp +++ b/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.cpp @@ -7,25 +7,25 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { extern const char ARTGroupComponentName[] = "ARTGroup"; -Element::Shared ARTGroupShadowNode::getElement() const { - auto elements = Element::ListOfShared{}; +ARTElement::Shared ARTGroupShadowNode::getARTElement() const { + auto elements = ARTElement::ListOfShared{}; for (auto const &child : getChildren()) { auto node = std::dynamic_pointer_cast(child); if (node) { - elements.push_back(node->getElement()); + elements.push_back(node->getARTElement()); } } auto props = getConcreteProps(); - return std::make_shared( + return std::make_shared( props.opacity, props.transform, elements, props.clipping); } } // namespace react diff --git a/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.h b/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.h index 7e0800ad94..dd85dffe66 100644 --- a/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.h +++ b/ReactCommon/fabric/components/art/group/ARTGroupShadowNode.h @@ -8,9 +8,9 @@ #pragma once #include +#include +#include #include -#include -#include #include namespace facebook { @@ -29,7 +29,7 @@ class ARTGroupShadowNode : public ConcreteShadowNode< public: using ConcreteShadowNode::ConcreteShadowNode; - virtual Element::Shared getElement() const override; + virtual ARTElement::Shared getARTElement() const override; }; } // namespace react diff --git a/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.cpp b/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.cpp index 50e2a40fd9..cb11199fd0 100644 --- a/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.cpp +++ b/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.cpp @@ -7,15 +7,15 @@ #include "ARTShapeShadowNode.h" #include -#include +#include namespace facebook { namespace react { extern const char ARTShapeComponentName[] = "ARTShape"; -Element::Shared ARTShapeShadowNode::getElement() const { +ARTElement::Shared ARTShapeShadowNode::getARTElement() const { auto props = getConcreteProps(); - return std::make_shared( + return std::make_shared( props.opacity, props.transform, props.d, diff --git a/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.h b/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.h index 5f75bf01d6..0373aef45c 100644 --- a/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.h +++ b/ReactCommon/fabric/components/art/shape/ARTShapeShadowNode.h @@ -8,8 +8,8 @@ #pragma once #include +#include #include -#include #include namespace facebook { @@ -28,7 +28,7 @@ class ARTShapeShadowNode : public ConcreteShadowNode< public: using ConcreteShadowNode::ConcreteShadowNode; - virtual Element::Shared getElement() const override; + virtual ARTElement::Shared getARTElement() const override; }; } // namespace react diff --git a/ReactCommon/fabric/components/art/state/Element.cpp b/ReactCommon/fabric/components/art/state/ARTElement.cpp similarity index 85% rename from ReactCommon/fabric/components/art/state/Element.cpp rename to ReactCommon/fabric/components/art/state/ARTElement.cpp index fd1891ed20..5b1ed74cb6 100644 --- a/ReactCommon/fabric/components/art/state/Element.cpp +++ b/ReactCommon/fabric/components/art/state/ARTElement.cpp @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react {} // namespace react diff --git a/ReactCommon/fabric/components/art/state/Element.h b/ReactCommon/fabric/components/art/state/ARTElement.h similarity index 73% rename from ReactCommon/fabric/components/art/state/Element.h rename to ReactCommon/fabric/components/art/state/ARTElement.h index 898eb82b87..51a29de1e6 100644 --- a/ReactCommon/fabric/components/art/state/Element.h +++ b/ReactCommon/fabric/components/art/state/ARTElement.h @@ -24,17 +24,20 @@ namespace react { /* * Simple, cross-platfrom, React-specific implementation of base ART Element */ -class Element { +class ARTElement { public: - using Shared = std::shared_ptr; - using ListOfShared = better::small_vector; + using Shared = std::shared_ptr; + using ListOfShared = better::small_vector; - Element() = default; - Element(ARTElement elementType, Float opacity, std::vector transform) + ARTElement() = default; + ARTElement( + ARTElementType elementType, + Float opacity, + std::vector transform) : elementType(elementType), opacity(opacity), transform(transform){}; - virtual ~Element(){}; + virtual ~ARTElement(){}; - ARTElement elementType; + ARTElementType elementType; Float opacity; std::vector transform; diff --git a/ReactCommon/fabric/components/art/state/Group.cpp b/ReactCommon/fabric/components/art/state/ARTGroup.cpp similarity index 73% rename from ReactCommon/fabric/components/art/state/Group.cpp rename to ReactCommon/fabric/components/art/state/ARTGroup.cpp index 428f41dfa1..99fc102683 100644 --- a/ReactCommon/fabric/components/art/state/Group.cpp +++ b/ReactCommon/fabric/components/art/state/ARTGroup.cpp @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include #include namespace facebook { namespace react { #ifdef ANDROID -folly::dynamic Group::getDynamic() const { +folly::dynamic ARTGroup::getDynamic() const { return toDynamic(*this); } #endif diff --git a/ReactCommon/fabric/components/art/state/Group.h b/ReactCommon/fabric/components/art/state/ARTGroup.h similarity index 69% rename from ReactCommon/fabric/components/art/state/Group.h rename to ReactCommon/fabric/components/art/state/ARTGroup.h index 1cee945c7c..11198f701e 100644 --- a/ReactCommon/fabric/components/art/state/Group.h +++ b/ReactCommon/fabric/components/art/state/ARTGroup.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -19,21 +19,21 @@ namespace react { /* * Simple, cross-platfrom, React-specific implementation of ART Group element */ -class Group : public Element { +class ARTGroup : public ARTElement { public: - using Shared = std::shared_ptr; - Group( + using Shared = std::shared_ptr; + ARTGroup( Float opacity, std::vector transform, - Element::ListOfShared elements, + ARTElement::ListOfShared elements, std::vector clipping) - : Element(ARTElement::Group, opacity, transform), + : ARTElement(ARTElementType::Group, opacity, transform), elements(elements), clipping(clipping){}; - Group() = default; - virtual ~Group(){}; + ARTGroup() = default; + virtual ~ARTGroup(){}; - Element::ListOfShared elements{}; + ARTElement::ListOfShared elements{}; std::vector clipping{}; diff --git a/ReactCommon/fabric/components/art/state/Text.cpp b/ReactCommon/fabric/components/art/state/ARTShape.cpp similarity index 73% rename from ReactCommon/fabric/components/art/state/Text.cpp rename to ReactCommon/fabric/components/art/state/ARTShape.cpp index d3e52e2aba..393be9a272 100644 --- a/ReactCommon/fabric/components/art/state/Text.cpp +++ b/ReactCommon/fabric/components/art/state/ARTShape.cpp @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include #include namespace facebook { namespace react { #ifdef ANDROID -folly::dynamic Text::getDynamic() const { +folly::dynamic ARTShape::getDynamic() const { return toDynamic(*this); } #endif diff --git a/ReactCommon/fabric/components/art/state/Shape.h b/ReactCommon/fabric/components/art/state/ARTShape.h similarity index 82% rename from ReactCommon/fabric/components/art/state/Shape.h rename to ReactCommon/fabric/components/art/state/ARTShape.h index 2c31376fa0..42438dd1a7 100644 --- a/ReactCommon/fabric/components/art/state/Shape.h +++ b/ReactCommon/fabric/components/art/state/ARTShape.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -19,10 +19,10 @@ namespace react { /* * Simple, cross-platfrom, React-specific implementation of ART Shape Element */ -class Shape : public Element { +class ARTShape : public ARTElement { public: - using Shared = std::shared_ptr; - Shape( + using Shared = std::shared_ptr; + ARTShape( Float opacity, std::vector transform, std::vector d, @@ -32,7 +32,7 @@ class Shape : public Element { Float strokeWidth, int strokeCap, int strokeJoin) - : Element(ARTElement::Shape, opacity, transform), + : ARTElement(ARTElementType::Shape, opacity, transform), d(d), stroke(stroke), strokeDash(strokeDash), @@ -40,8 +40,8 @@ class Shape : public Element { strokeWidth(strokeWidth), strokeCap(strokeCap), strokeJoin(strokeJoin){}; - Shape() = default; - virtual ~Shape(){}; + ARTShape() = default; + virtual ~ARTShape(){}; std::vector d{}; std::vector stroke{}; diff --git a/ReactCommon/fabric/components/art/state/Shape.cpp b/ReactCommon/fabric/components/art/state/ARTText.cpp similarity index 73% rename from ReactCommon/fabric/components/art/state/Shape.cpp rename to ReactCommon/fabric/components/art/state/ARTText.cpp index 7a1a17e69a..9ed21b0d10 100644 --- a/ReactCommon/fabric/components/art/state/Shape.cpp +++ b/ReactCommon/fabric/components/art/state/ARTText.cpp @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include #include namespace facebook { namespace react { #ifdef ANDROID -folly::dynamic Shape::getDynamic() const { +folly::dynamic ARTText::getDynamic() const { return toDynamic(*this); } #endif diff --git a/ReactCommon/fabric/components/art/state/Text.h b/ReactCommon/fabric/components/art/state/ARTText.h similarity index 78% rename from ReactCommon/fabric/components/art/state/Text.h rename to ReactCommon/fabric/components/art/state/ARTText.h index 44f61d5e5d..ddda979037 100644 --- a/ReactCommon/fabric/components/art/state/Text.h +++ b/ReactCommon/fabric/components/art/state/ARTText.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include #include @@ -21,10 +21,10 @@ namespace react { /* * Simple, cross-platfrom, React-specific implementation of ART Text Element */ -class Text : public Shape { +class ARTText : public ARTShape { public: - using Shared = std::shared_ptr; - Text( + using ARTShared = std::shared_ptr; + ARTText( Float opacity, std::vector transform, std::vector d, @@ -36,7 +36,7 @@ class Text : public Shape { int strokeJoin, ARTTextAlignment alignment, ARTTextFrame frame) - : Shape( + : ARTShape( opacity, transform, d, @@ -47,9 +47,11 @@ class Text : public Shape { strokeCap, strokeJoin), alignment(alignment), - frame(frame){}; - Text() = default; - virtual ~Text(){}; + frame(frame){ + // elementType = ARTElementType::Text; + }; + ARTText() = default; + virtual ~ARTText(){}; ARTTextAlignment alignment{ARTTextAlignment::Default}; ARTTextFrame frame{}; diff --git a/ReactCommon/fabric/components/art/state/primitives.h b/ReactCommon/fabric/components/art/state/primitives.h index 6af1d70297..88a039cbbb 100644 --- a/ReactCommon/fabric/components/art/state/primitives.h +++ b/ReactCommon/fabric/components/art/state/primitives.h @@ -15,7 +15,7 @@ namespace facebook { namespace react { -enum class ARTElement { Shape, Text, Group }; +enum class ARTElementType { Shape, Text, Group }; enum class ARTTextAlignment { Default, Right, Center }; diff --git a/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.cpp b/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.cpp index c5a2fdf31a..a83b506a12 100644 --- a/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.cpp +++ b/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.cpp @@ -28,7 +28,7 @@ Content const &ARTSurfaceViewShadowNode::getContent() const { return content_.value(); } ensureUnsealed(); - auto elements = Element::ListOfShared{}; + auto elements = ARTElement::ListOfShared{}; ARTBaseShadowNode::buildElements(*this, elements); content_ = Content{elements}; return content_.value(); diff --git a/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.h b/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.h index aceef35286..0bd2cdaa43 100644 --- a/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.h +++ b/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewShadowNode.h @@ -7,9 +7,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -42,7 +42,7 @@ class ARTSurfaceViewShadowNode : public ConcreteViewShadowNode< class Content final { public: - Element::ListOfShared elements{}; + ARTElement::ListOfShared elements{}; }; void layout(LayoutContext layoutContext) override; diff --git a/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewState.h b/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewState.h index 38183009dc..86eb3d0f5e 100644 --- a/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewState.h +++ b/ReactCommon/fabric/components/art/surfaceview/ARTSurfaceViewState.h @@ -6,7 +6,7 @@ */ #pragma once -#include +#include #ifdef ANDROID #include @@ -21,10 +21,10 @@ namespace react { */ class ARTSurfaceViewState final { public: - Element::ListOfShared elements{}; + ARTElement::ListOfShared elements{}; #ifdef ANDROID - ARTSurfaceViewState(Element::ListOfShared const &elements) + ARTSurfaceViewState(ARTElement::ListOfShared const &elements) : elements(elements) {} ARTSurfaceViewState() = default; ARTSurfaceViewState( diff --git a/ReactCommon/fabric/components/art/text/ARTTextShadowNode.cpp b/ReactCommon/fabric/components/art/text/ARTTextShadowNode.cpp index 953ba5ee20..aeb596e133 100644 --- a/ReactCommon/fabric/components/art/text/ARTTextShadowNode.cpp +++ b/ReactCommon/fabric/components/art/text/ARTTextShadowNode.cpp @@ -7,16 +7,16 @@ #include "ARTTextShadowNode.h" #include -#include +#include namespace facebook { namespace react { extern const char ARTTextComponentName[] = "ARTText"; -Element::Shared ARTTextShadowNode::getElement() const { +ARTElement::Shared ARTTextShadowNode::getARTElement() const { auto props = getConcreteProps(); - return std::make_shared( + return std::make_shared( props.opacity, props.transform, props.d, diff --git a/ReactCommon/fabric/components/art/text/ARTTextShadowNode.h b/ReactCommon/fabric/components/art/text/ARTTextShadowNode.h index a1a68da693..93d3d4a656 100644 --- a/ReactCommon/fabric/components/art/text/ARTTextShadowNode.h +++ b/ReactCommon/fabric/components/art/text/ARTTextShadowNode.h @@ -8,9 +8,9 @@ #pragma once #include +#include +#include #include -#include -#include #include namespace facebook { @@ -27,7 +27,7 @@ class ARTTextShadowNode public: using ConcreteShadowNode::ConcreteShadowNode; - virtual Element::Shared getElement() const override; + virtual ARTElement::Shared getARTElement() const override; }; } // namespace react