Skip to content
Merged
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 @@ -38,12 +38,14 @@ - (UIEdgeInsets)_safeAreaInsets
return UIEdgeInsetsZero;
}

#if !TARGET_OS_OSX // TODO(macOS GH#774)
- (void)safeAreaInsetsDidChange
{
[super safeAreaInsetsDidChange];

[self _updateStateIfNecessary];
}
#endif // TODO(macOS GH#774)

- (void)_updateStateIfNecessary
{
Expand All @@ -52,10 +54,18 @@ - (void)_updateStateIfNecessary
}

UIEdgeInsets insets = [self _safeAreaInsets];
#if !TARGET_OS_OSX // TODO(macOS GH#774)
insets.left = RCTRoundPixelValue(insets.left);
insets.top = RCTRoundPixelValue(insets.top);
insets.right = RCTRoundPixelValue(insets.right);
insets.bottom = RCTRoundPixelValue(insets.bottom);
#else // [TODO(macOS GH#774)
CGFloat scale = [[NSScreen mainScreen] backingScaleFactor];;
insets.left = RCTRoundPixelValue(insets.left, scale);
insets.top = RCTRoundPixelValue(insets.top, scale);
insets.right = RCTRoundPixelValue(insets.right, scale);
insets.bottom = RCTRoundPixelValue(insets.bottom, scale);
#endif // ]TODO(macOS GH#774)

auto newPadding = RCTEdgeInsetsFromUIEdgeInsets(insets);
auto threshold = 1.0 / RCTScreenScale() + 0.01; // Size of a pixel plus some small threshold.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ - (TextMeasurement)measureNSAttributedString:(NSAttributedString *)attributedStr

CGSize size = [layoutManager usedRectForTextContainer:textContainer].size;

#if !TARGET_OS_OSX // TODO(macOS GH#774)
size = (CGSize){RCTCeilPixelValue(size.width), RCTCeilPixelValue(size.height)};
#else // [TODO(macOS GH#774)
CGFloat scale = [[NSScreen mainScreen] backingScaleFactor];
size = (CGSize){RCTCeilPixelValue(size.width, scale), RCTCeilPixelValue(size.height, scale)};
#endif // ]TODO(macOS GH#774)

__block auto attachments = TextMeasurement::Attachments{};

Expand Down