@@ -19,57 +19,6 @@ namespace facebook::react {
1919template <class T >
2020using LayoutableSmallVector = std::vector<T>;
2121
22- static LayoutableSmallVector<Rect> calculateTransformedFrames (
23- const LayoutableSmallVector<const ShadowNode*>& shadowNodeList,
24- LayoutableShadowNode::LayoutInspectingPolicy policy) {
25- auto size = shadowNodeList.size ();
26- auto transformedFrames = LayoutableSmallVector<Rect>{size};
27- auto transformation = Transform::Identity ();
28-
29- for (auto i = size; i > 0 ; --i) {
30- auto currentShadowNode =
31- dynamic_cast <const LayoutableShadowNode*>(shadowNodeList.at (i - 1 ));
32- auto currentFrame = currentShadowNode->getLayoutMetrics ().frame ;
33-
34- if (policy.includeTransform ) {
35- if (Transform::isVerticalInversion (transformation)) {
36- auto parentShadowNode =
37- dynamic_cast <const LayoutableShadowNode*>(shadowNodeList.at (i));
38- currentFrame.origin .y =
39- parentShadowNode->getLayoutMetrics ().frame .size .height -
40- currentFrame.size .height - currentFrame.origin .y ;
41- }
42-
43- if (Transform::isHorizontalInversion (transformation)) {
44- auto parentShadowNode =
45- dynamic_cast <const LayoutableShadowNode*>(shadowNodeList.at (i));
46- currentFrame.origin .x =
47- parentShadowNode->getLayoutMetrics ().frame .size .width -
48- currentFrame.size .width - currentFrame.origin .x ;
49- }
50-
51- if (i != size) {
52- auto parentShadowNode =
53- dynamic_cast <const LayoutableShadowNode*>(shadowNodeList.at (i));
54- auto contentOriginOffset = parentShadowNode->getContentOriginOffset ();
55- if (Transform::isVerticalInversion (transformation)) {
56- contentOriginOffset.y = -contentOriginOffset.y ;
57- }
58- if (Transform::isHorizontalInversion (transformation)) {
59- contentOriginOffset.x = -contentOriginOffset.x ;
60- }
61- currentFrame.origin += contentOriginOffset;
62- }
63-
64- transformation = transformation * currentShadowNode->getTransform ();
65- }
66-
67- transformedFrames[i - 1 ] = currentFrame;
68- }
69-
70- return transformedFrames;
71- }
72-
7322LayoutableShadowNode::LayoutableShadowNode (
7423 const ShadowNodeFragment& fragment,
7524 const ShadowNodeFamily::Shared& family,
@@ -157,22 +106,6 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics(
157106 return EmptyLayoutMetrics;
158107 }
159108
160- // ------------------------------
161- // TODO: T127619309 remove after validating that T127619309 is fixed
162- auto optionalCalculateTransformedFrames =
163- descendantNode->getContextContainer ()
164- ? descendantNode->getContextContainer ()->find <bool >(
165- " CalculateTransformedFramesEnabled" )
166- : std::optional<bool >(false );
167-
168- bool shouldCalculateTransformedFrames =
169- optionalCalculateTransformedFrames.has_value ()
170- ? optionalCalculateTransformedFrames.value ()
171- : false ;
172-
173- auto transformedFrames = shouldCalculateTransformedFrames
174- ? calculateTransformedFrames (shadowNodeList, policy)
175- : LayoutableSmallVector<Rect>();
176109 auto layoutMetrics = descendantLayoutableNode->getLayoutMetrics ();
177110 auto & resultFrame = layoutMetrics.frame ;
178111 resultFrame.origin = {0 , 0 };
@@ -194,9 +127,7 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics(
194127 return EmptyLayoutMetrics;
195128 }
196129
197- auto currentFrame = shouldCalculateTransformedFrames
198- ? transformedFrames[i]
199- : currentShadowNode->getLayoutMetrics ().frame ;
130+ auto currentFrame = currentShadowNode->getLayoutMetrics ().frame ;
200131 if (i == size - 1 ) {
201132 // If it's the last element, its origin is irrelevant.
202133 currentFrame.origin = {0 , 0 };
@@ -219,9 +150,8 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics(
219150 resultFrame, currentFrame.getCenter ());
220151 }
221152
222- if (!shouldCalculateTransformedFrames && i != 0 &&
223- policy.includeTransform ) {
224- resultFrame.origin += currentShadowNode->getContentOriginOffset () * currentShadowNode->getTransform ();
153+ if (i != 0 && policy.includeTransform ) {
154+ resultFrame.origin += currentShadowNode->getContentOriginOffset ();
225155 }
226156
227157 if (policy.enableOverflowClipping ) {
0 commit comments