* [ASTextNode] Fix highlighting when textContainerInsets are set.
* Add ASTextNodeSnapshotTests to xcodeproj.
* Add snapshot test for container inset and highlighting.
* [Optimization] Convert to type-generic math
* add std:: prefix in obj-c++ files
* more cleanup
* revert test changes
* convert min and max back to fmin/fmax
Using Objective-C attributes, in this case `unavailable`, we can hide
unsupported APIs at compile time instead of detecting and warn about it
at runtime with a set of asserts.
* Fix ASTextNode's ascender to also include the line height specified by paragraph style in the attributed string.
* Merge conflict (original patch is for an old version)
I have a subclass of `ASTextNode` that uses `pointSizeScaleFactors`. Currently I have to recompute the scale factors any time the font size changes. If `_rendererAttributes` used the property accesor for the scale factors I would only have to create them when asked. I hope this little change can make it in :)
Throw away the all subcomponents to create them with the new constrained size new as well as let the truncater do it's job again for the new constrained size. This is necessary as after a truncation did happen the context would use the truncated string and not the original string to truncate based on the new constrained size
* [ASTextNode, ASVideoNode] Use ASDisplayNode base class lock for subclass property synchronization
* fix headers to match master
* address @appleguy, @maicki comments
* import header
* Swap lock in ASNetworkImageNode as well
* remove invalid comment
* more cleanup of locks
Update drawing on demand if properties change and not on every drawing cycle. This should reduce the overhead to access properties from the view / layer for the drawing parameters.
- Add locking to _linkAttributeValueAtPoint:attributeName:range:inAdditionalTruncationMessage:forHighlighting: as we access the attributed text in there
- Add locking to touchesBegan:withEvent: as we are accessing the [ASTextKitRenderer firstVisibleRange]
- Add locking for highlightStyle
- Move accessing delegate property access to instance variable access
The crash happens in the placeholderImage of ASTextNode. The node is not visible in the time it try to get the `placeholderImage` and so the `visibleRange` has count 0 and a crash happens while accessing the first object of an empty array.
- Deprecate attributedString in ASTextNode in favor of attributedText to be aligned with UILabel
- Deprecate truncationAttributedString in ASTextNode in favor of truncationAttributedText to be aligned with attributedText
- Refactor naming of ASEnvironmentCollection to ASEnvironmentState
- Remove struct pointers
- Move ASEnvironmentStatePropagation to a enum class
- Move merge functions to pure functions
- Move ASLayoutOptionsForwarding and ASLayoutableExtensibility into ASLayoutSpec and ASDisplayNode
- Remove ASLayoutableSetValuesForLayoutable and move into explicit classes (ASDisplayNode, ASTextNode)
1) cache the scale in the font adjuster. The adjuster will be dealloc'ed when the renderer that owns it is dealloc'ed (or invalidated). Until that time we can trust the scale that the adjuster has computed.
2) When measuring line count, make sure that we are not bounding the height of the container's size. This will cause the wrong number of lines to be returned.
3) Instead of setting the ascender/descender on an ASTextNode when an attributed string is added, wait until after the renderer calculates size. This way, if there is any need to scale the font to fit we can apply that scale to the ascender/descender.
A text node's renderer is often invalidated. Save the renderer's constrained size locally so we can use it when creating a new renderer after invalidation.
Was running into issues where the scale factor would get cleared when setting a new atributedString on a textNode.
I was clearing out the currentScaleFactor when setting an attributedString into a textNode. It appears that `_calculateSize` isn't always called when setting a new string into a ASTextNode. It can be the case that only `drawInContext:bounds:` is called. With _currentScaleFactor cleared out the renderer that calls`drawInContext...` was being called with a scaleFactor of 0.
It could be the case that the fix could be to remove the clearing of `currentScaleFactor` from `setAttributedString`, but this seems like a safer fix to me. It does, however, require an extra run through the font adjuster when enabled.