7 Commits

Author SHA1 Message Date
Adlai Holler
0d439a43b6 [ASTextNode] Add Fast-Paths For Text Measurement and Drawing (#2392)
* Add test case for TextKit truncation style

* Add fast path for text node measurement with default truncation

* Use fast path more often

* Reverse options order

* Simplify implementation – no functional change

* Share "isScaled" variable

* Intersect with constrained rect

* Add a failing test case for fast-path truncation

* Add some more truncation tests, using slow path as reference image

* Update the tests

* In ASTextKitRenderer, intersect bounds with constrained rect

* Add test case for TextKit truncation style

* Add fast path for text node measurement with default truncation

* Use fast path more often

* Reverse options order

* Simplify implementation – no functional change

* Share "isScaled" variable

* Intersect with constrained rect

* Add a failing test case for fast-path truncation

* Add some more truncation tests, using slow path as reference image

* Update the tests

* In ASTextKitRenderer, intersect bounds with constrained rect

* Use maximumNumberOfLines property in text kit fast path

Add reference images

Disable fast-path for max-one-line case

* Remove unneeded snapshot files
2016-10-24 17:05:59 -07:00
Michael Schneider
6f2c7caac3 [Layout] Improve ASDimensionMake via NSString (#2351)
* Improve ASDimensionMake via NSString

- ASXCTAssertEqualDimensions
- Add support for "auto"
- Assert if given an empty or invalid string

* Address comments

* Add ASCGFloatFromString and ASCGFloatFromNumber

* Rename CGRect+ASConvenience to CoreGraphics+ASConvenience
2016-10-06 16:29:33 -07:00
Michael Schneider
8897614f0e [Layout] Layout API based on content area (#2110)
* Initial commit for adding a size constraint to ASLayoutable's

* Some more commits

* Fix sample projects in extra/

* Remove preferredFrameSize test of ASEditableTextNode

* Remove preferredFrameSize from examples_extra

* Add deprecation warning to -[ASDisplayNode preferredFrameSize]

* Add deprecation warning to -[ASDisplayNode measureWithSizeRange:]

* Commit

* Commit

* Remove ASRelativeSizeRange

* Make ASRelativeSize private

* Adjust examples

* Improve setting of -[ASLayoutable size] with points or fractions

* Add ASWrapperLayoutSpec

* Improve creation of ASRelativeDimension

* Add `preferredFrameSize` back and add deprecated logging

* Add `layoutSpecBlock` setter and getter and add locking for it

* Add better documentation and fix macros to create ASRelativeDimension

* Create new ASSizeRangeMake with just a CGSize as parameter

* Update Kitten and Social App Layout example

* Add layoutThatFits: and deprecate measure:

* Rename ASRelativeDimension to ASDimension

* Fix examples for ASDimension renaming

* Remove fancy height and width setter

* Fix ASDimension helper

* Rename -[ASLayout layoutableObject] to -[ASLayout layoutable]

* Update layout related methods and more clearer documentation around how to use it

* Deprecate old ASLayout class constructors

* Don't unnecessary recalculate layout if constrained or parent size did not change

* Use shared pointer for ASDisplayNodeLayout

* Fix rebase conflicts

* Add documentation and move implementation in mm file of ASDisplayNodeLayout

* Fix test errors

* Rename ASSize to ASLayoutableSize

* Address comments

* Rename setSizeFromCGSize to setSizeWithCGSize

* Improve inline functions in ASDimension

* Fix rebase conflicts
2016-09-07 08:44:48 -07:00
Adlai Holler
e233a1cccc [Unit Testing] Add Realistic Text Data Set (#2188)
* Add a mechanism to save attributed strings given to text nodes

* Setup performance tests to have an iteration variable

* Use realistic data in new text node performance test case

* Revert temporary changes
2016-09-05 12:30:06 -07:00
Adlai Holler
ea4d88e053 Skip ASTextNodePerformanceTests in Test Action (#2173) 2016-08-31 16:10:27 -07:00
Adlai Holler
8d86bb6db3 Relax performance test for Travis 2016-08-29 11:55:40 -07:00
Adlai Holler
578ac4c48d [Unit Tests] Add Text Layout Performance Tests (#2161)
* Add single-threaded text node performance testing

* Relax test a bit
2016-08-28 16:47:03 -07:00