Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1216,9 +1216,9 @@ - (void)invalidateLayer
if (!_boxShadowLayers) {
_boxShadowLayers = [NSMutableArray new];
}
for (auto it = _props->boxShadow.rbegin(); it != _props->boxShadow.rend(); ++it) {
for (const auto &shadow : std::ranges::reverse_view(_props->boxShadow)) {
CALayer *shadowLayer = RCTGetBoxShadowLayer(
*it,
shadow,
RCTCornerRadiiFromBorderRadii(borderMetrics.borderRadii),
RCTUIEdgeInsetsFromEdgeInsets(borderMetrics.borderWidths),
self.layer.bounds.size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ProfileTreeNode.h"
#include "TraceEventSerializer.h"

#include <ranges>
#include <string_view>
#include <unordered_map>

Expand Down Expand Up @@ -192,8 +193,7 @@ void processCallStack(
}

ProfileTreeNode* previousNode = &rootNode;
for (auto it = callStack.rbegin(); it != callStack.rend(); ++it) {
const RuntimeSamplingProfile::SampleCallStackFrame& callFrame = *it;
for (const auto& callFrame : std::ranges::reverse_view(callStack)) {
bool isGarbageCollectorFrame = callFrame.kind ==
RuntimeSamplingProfile::SampleCallStackFrame::Kind::GarbageCollector;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "LayoutableShadowNode.h"

#include <ranges>

#include <react/renderer/core/LayoutConstraints.h>
#include <react/renderer/core/LayoutContext.h>
#include <react/renderer/core/LayoutMetrics.h>
Expand Down Expand Up @@ -106,8 +108,8 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics(
// root because we measure it from an outside tree perspective.
shadowNodeList.push_back(descendantNode);

for (auto it = ancestors.rbegin(); it != ancestors.rend(); it++) {
auto& shadowNode = it->first.get();
for (auto& ancestor : std::ranges::reverse_view(ancestors)) {
auto& shadowNode = ancestor.first.get();

shadowNodeList.push_back(&shadowNode);

Expand Down Expand Up @@ -334,8 +336,8 @@ std::shared_ptr<const ShadowNode> LayoutableShadowNode::findNodeAtPoint(
return lhs->getOrderIndex() < rhs->getOrderIndex();
});

for (auto it = sortedChildren.rbegin(); it != sortedChildren.rend(); it++) {
const auto& childShadowNode = *it;
for (const auto& childShadowNode :
std::ranges::reverse_view(sortedChildren)) {
auto hitView = findNodeAtPoint(childShadowNode, newPoint);
if (hitView) {
return hitView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <react/renderer/core/ShadowNodeFragment.h>
#include <react/renderer/debug/DebugStringConvertible.h>
#include <react/renderer/debug/debugStringConvertibleUtils.h>
#include <ranges>

#include <utility>

Expand Down Expand Up @@ -391,9 +392,8 @@ std::shared_ptr<ShadowNode> ShadowNode::cloneTree(

auto childNode = newShadowNode;

for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
auto& parentNode = it->first.get();
auto childIndex = it->second;
for (auto& [ancestorRef, childIndex] : std::ranges::reverse_view(ancestors)) {
auto& parentNode = ancestorRef.get();

auto children = parentNode.getChildren();
react_native_assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/core/ComponentDescriptor.h>
#include <react/renderer/core/State.h>
#include <ranges>

#include <utility>

Expand Down Expand Up @@ -116,8 +117,7 @@ AncestorList ShadowNodeFamily::getAncestors(

auto ancestors = AncestorList{};
auto parentNode = &ancestorShadowNode;
for (auto it = families.rbegin(); it != families.rend(); it++) {
auto childFamily = *it;
for (auto childFamily : std::ranges::reverse_view(families)) {
auto found = false;
auto childIndex = 0;
for (const auto& childNode : *parentNode->children_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <glog/logging.h>
#include <react/renderer/bridging/bridging.h>
#include <ranges>

namespace facebook::react {

Expand Down Expand Up @@ -79,8 +80,9 @@ static bool isAnyViewInPathToRootListeningToEvents(
auto ancestors = nodeFamily.getAncestors(*owningRootShadowNode);

// Check for listeners from the target's parent to the root
for (auto it = ancestors.rbegin(); it != ancestors.rend(); it++) {
auto& currentNode = it->first.get();
for (auto& [ancestorNode, childIndex] :
std::ranges::reverse_view(ancestors)) {
auto& currentNode = ancestorNode.get();
if (isViewListeningToEvents(currentNode, eventTypes)) {
return true;
}
Expand Down Expand Up @@ -488,11 +490,9 @@ void PointerEventsProcessor::handleIncomingPointerEventOnNode(
}

// Actually emit the leave events (in order from target to root)
for (auto it = targetsToEmitLeaveTo.rbegin();
it != targetsToEmitLeaveTo.rend();
it++) {
for (auto& target : std::ranges::reverse_view(targetsToEmitLeaveTo)) {
eventDispatcher(
*it, "topPointerLeave", ReactEventPriority::Discrete, event);
target, "topPointerLeave", ReactEventPriority::Discrete, event);
}

// Over
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "PointerHoverTracker.h"

#include <ranges>
#include <utility>

namespace facebook::react {
Expand Down Expand Up @@ -139,8 +140,8 @@ EventPath PointerHoverTracker::getEventPathTargets() const {
auto ancestors = target_->getFamily().getAncestors(*root_);

result.emplace_back(*target_);
for (auto it = ancestors.rbegin(); it != ancestors.rend(); it++) {
result.push_back(it->first);
for (auto& [ancestor, index] : std::ranges::reverse_view(ancestors)) {
result.push_back(ancestor);
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <deque>
#include <memory>
#include <optional>
#include <ranges>
#include <vector>

namespace facebook::react {
Expand Down Expand Up @@ -52,8 +53,8 @@ void addAncestorsToUpdateList(

int ancestorDepth = static_cast<int>(ancestors.size() - 1);
// iterate from current ShadowNode's parent to root ShadowNode
for (auto iter = ancestors.rbegin(); iter != ancestors.rend(); ++iter) {
auto& ancestorShadowNode = iter->first.get();
for (auto& [ancestorRef, childIdx] : std::ranges::reverse_view(ancestors)) {
auto& ancestorShadowNode = ancestorRef.get();
auto ancestorTag = ancestorShadowNode.getTag();
auto ancestorAddedToUpdateList = std::find_if(
shadowNodesToUpdate.begin(),
Expand All @@ -67,10 +68,10 @@ void addAncestorsToUpdateList(
.tag = ancestorShadowNode.getTag(),
.depth = ancestorDepth,
.node = ancestorShadowNodesShared[ancestorDepth],
.updatedChildrenIndices = {iter->second},
.updatedChildrenIndices = {childIdx},
});
} else {
ancestorAddedToUpdateList->updatedChildrenIndices.push_back(iter->second);
ancestorAddedToUpdateList->updatedChildrenIndices.push_back(childIdx);
}
ancestorDepth--;
}
Expand Down
Loading