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
9 changes: 5 additions & 4 deletions packages/react-native/React/Base/RCTUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import <objc/runtime.h>
#import <zlib.h>
#import <atomic>
#import <cmath>
#import <vector>

#import <UIKit/UIKit.h>
Expand Down Expand Up @@ -437,20 +438,20 @@ CGSize RCTSwitchSize(void)
CGFloat RCTRoundPixelValue(CGFloat value)
{
CGFloat scale = RCTScreenScale();
return round(value * scale) / scale;
return std::round(value * scale) / scale;
}

CGFloat RCTCeilPixelValue(CGFloat value)
{
CGFloat scale = RCTScreenScale();
return ceil(value * scale) / scale;
return std::ceil(value * scale) / scale;
}

CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale)
{
return (CGSize){
ceil(pointSize.width * scale),
ceil(pointSize.height * scale),
std::ceil(pointSize.width * scale),
std::ceil(pointSize.height * scale),
};
}

Expand Down
4 changes: 4 additions & 0 deletions packages/react-native/ReactCommon/React-Fabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ Pod::Spec.new do |s|
end

s.subspec "attributedstring" do |ss|
ss.dependency "React-Fabric/coreUmbrella"
ss.dependency "React-Fabric/components/viewUmbrella"
ss.dependency "React-renderercss"
ss.source_files = podspec_sources("react/renderer/attributedstring/**/*.{m,mm,cpp,h}", "react/renderer/attributedstring/**/*.{h}")
ss.exclude_files = "react/renderer/attributedstring/tests"
ss.header_dir = "react/renderer/attributedstring"
Expand Down Expand Up @@ -209,6 +212,7 @@ Pod::Spec.new do |s|
end

s.subspec "mounting" do |ss|
ss.dependency "React-Fabric/coreUmbrella"
ss.dependency "React-jsinspectortracing"
ss.source_files = podspec_sources("react/renderer/mounting/**/*.{m,mm,cpp,h}", "react/renderer/mounting/**/*.h")
ss.exclude_files = "react/renderer/mounting/tests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@

#include <react/cxxstableapi/FrameworksGuard.h>

#include <React/RendererCore.h>
#include <React/Utils.h>
#include <react/renderer/attributedstring/TextAttributes.h>
#include <react/renderer/core/Sealable.h>
#include <react/renderer/debug/DebugStringConvertible.h>
#include <react/renderer/mounting/ShadowView.h>
#include <react/utils/hash_combine.h>

namespace facebook::react {

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

#include <memory>

#include <React/Debug.h>
#include <react/renderer/attributedstring/AttributedString.h>

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

#include <limits>

#include <React/Graphics.h>
#include <React/RendererCore.h>
#include <React/Utils.h>
#include <react/renderer/attributedstring/primitives.h>
#include <react/renderer/debug/DebugStringConvertible.h>
#include <react/renderer/graphics/Float.h>
#include <react/utils/hash_combine.h>

namespace facebook::react {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@
#include <optional>
#include <vector>

#include <React/Graphics.h>
#include <React/RendererCore.h>
#include <React/Utils.h>
#include <React/View.h>
#include <folly/dynamic.h>
#include <react/renderer/attributedstring/primitives.h>
#include <react/renderer/components/view/AccessibilityPrimitives.h>
#include <react/renderer/core/LayoutPrimitives.h>
#include <react/renderer/core/ReactPrimitives.h>
#include <react/renderer/debug/DebugStringConvertible.h>
#include <react/renderer/graphics/Color.h>
#include <react/renderer/graphics/Float.h>
#include <react/renderer/graphics/Size.h>
#include <react/utils/hash_combine.h>

namespace facebook::react {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,20 @@

#include <react/cxxstableapi/FrameworksGuard.h>

#include <react/debug/react_native_expect.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <React/CSS.h>
#include <React/Debug.h>
#include <React/FeatureFlags.h>
#include <React/RendererCore.h>
#include <React/View.h>
#include <react/renderer/attributedstring/AttributedString.h>
#include <react/renderer/attributedstring/ParagraphAttributes.h>
#include <react/renderer/attributedstring/TextAttributes.h>
#include <react/renderer/attributedstring/conversions.h>
#include <react/renderer/attributedstring/primitives.h>
#include <react/renderer/components/view/accessibilityPropsConversions.h>
#include <react/renderer/core/LayoutableShadowNode.h>
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/core/conversions.h>
#include <react/renderer/core/graphicsConversions.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/css/CSSFontVariant.h>
#include <react/renderer/css/CSSValueParser.h>
#include <unordered_map>

#ifdef RN_SERIALIZABLE_STATE
#include <React/MapBuffer.h>
#include <folly/json.h>
#include <react/renderer/mapbuffer/MapBuffer.h>
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
#endif

#include <glog/logging.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import <objc/runtime.h>
#import <react/renderer/graphics/RCTPlatformColorUtils.h>
#import <react/utils/ManagedObjectWrapper.h>
#import <cmath>
#import <string>

using namespace facebook::react;
Expand Down Expand Up @@ -86,9 +87,10 @@ bool UIColorIsP3ColorSpace(const std::shared_ptr<void> &uiColor)
int32_t ColorFromColorComponents(const facebook::react::ColorComponents &components)
{
float ratio = 255;
auto color = ((int32_t)round((float)components.alpha * ratio) & 0xff) << 24 |
((int)round((float)components.red * ratio) & 0xff) << 16 |
((int)round((float)components.green * ratio) & 0xff) << 8 | ((int)round((float)components.blue * ratio) & 0xff);
auto color = ((int32_t)std::round((float)components.alpha * ratio) & 0xff) << 24 |
((int)std::round((float)components.red * ratio) & 0xff) << 16 |
((int)std::round((float)components.green * ratio) & 0xff) << 8 |
((int)std::round((float)components.blue * ratio) & 0xff);
return color;
}

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

#include <react/cxxstableapi/FrameworksGuard.h>

#include <react/renderer/core/ShadowNode.h>
#include <React/RendererCore.h>
#include <react/renderer/mounting/ShadowViewMutation.h>

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <condition_variable>
#include <optional>

#include <react/renderer/debug/flags.h>
#include <React/RendererCore.h>
#include <react/renderer/mounting/Differentiator.h>
#include <react/renderer/mounting/MountingOverrideDelegate.h>
#include <react/renderer/mounting/MountingTransaction.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
#include <mutex>
#include <shared_mutex>

#include <React/RendererCore.h>
#include <React/Utils.h>
#include <react/renderer/components/root/RootShadowNode.h>
#include <react/renderer/core/LayoutConstraints.h>
#include <react/renderer/core/ReactPrimitives.h>
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/mounting/MountingCoordinator.h>
#include <react/renderer/mounting/ShadowTreeDelegate.h>
#include <react/renderer/mounting/ShadowTreeRevision.h>
#include <react/utils/ContextContainer.h>
#include "MountingOverrideDelegate.h"

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <shared_mutex>
#include <unordered_map>

#include <react/renderer/core/ReactPrimitives.h>
#include <React/RendererCore.h>
#include <react/renderer/mounting/ShadowTree.h>

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@

#include <react/cxxstableapi/FrameworksGuard.h>

#include <react/renderer/core/EventEmitter.h>
#include <react/renderer/core/LayoutMetrics.h>
#include <react/renderer/core/Props.h>
#include <react/renderer/core/ReactPrimitives.h>
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/debug/flags.h>
#include <react/utils/hash_combine.h>
#include <React/RendererCore.h>
#include <React/Utils.h>

namespace facebook::react {

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

#include <react/cxxstableapi/FrameworksGuard.h>

#include <react/renderer/graphics/Rect.h>
#include <react/renderer/graphics/Transform.h>
#include <React/Graphics.h>

namespace facebook::react {

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

#include <react/cxxstableapi/FrameworksGuard.h>

#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/graphics/Point.h>
#include <React/Graphics.h>
#include <React/RendererCore.h>
#include <react/renderer/mounting/ShadowView.h>

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#include <memory>
#include <vector>

#include <react/renderer/core/LayoutMetrics.h>
#include <react/renderer/core/State.h>
#include <react/renderer/debug/debugStringConvertibleUtils.h>
#include <React/RendererCore.h>
#include <react/renderer/mounting/ShadowView.h>

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <react/cxxstableapi/FrameworksGuard.h>

#include <react/renderer/core/ShadowNode.h>
#include <React/RendererCore.h>
#include <react/renderer/mounting/stubs/StubView.h>
#include <react/renderer/mounting/stubs/StubViewTree.h>

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

#include <react/cxxstableapi/FrameworksGuard.h>

#include <react/renderer/core/ShadowNode.h>
#include <React/RendererCore.h>
#include <react/renderer/mounting/ShadowTree.h>

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import "RCTTextLayoutManager.h"

#import <array>
#import <cmath>

#import "RCTAttributedTextUtils.h"

Expand Down Expand Up @@ -186,8 +187,8 @@ - (void)drawAttributedString:(AttributedString)attributedString
// remains visible at small sizes and proportionate at
// large ones. ~`fontSize / 12` plus a 1.5pt floor.
CGFloat thickness = MAX(fontSize / 12.0f, 1.5f);
CGFloat wavyWavelength = 1.0f + 2.0f * round(2.0f * thickness + 0.5f);
CGFloat wavyCpDistance = 0.5f + round(3.0f * thickness + 0.5f);
CGFloat wavyWavelength = 1.0f + 2.0f * std::round(2.0f * thickness + 0.5f);
CGFloat wavyCpDistance = 0.5f + std::round(3.0f * thickness + 0.5f);

NSRange targetGlyphRange = [layoutManager glyphRangeForCharacterRange:attrRange
actualCharacterRange:nullptr];
Expand Down
Loading