mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
[Layout] Rename ASLayoutable to ASLayoutElement (#2290)
* [Layout API] Rename ASLayoutable to ASLayoutElement * arg * fix wrapperWithLayoutElement * [Layout API] Rename ASLayoutable to ASLayoutElement * arg * address Michael's comments * Remove ASLayoutValidation files that were deleted on master since this diff was created.
This commit is contained in:
@@ -141,7 +141,7 @@
|
|||||||
34EFC7661B701CD200AD841F /* ASRelativeSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */; };
|
34EFC7661B701CD200AD841F /* ASRelativeSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */; };
|
||||||
34EFC7671B701CD900AD841F /* ASLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED0B1B17843500DA7C62 /* ASLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
34EFC7671B701CD900AD841F /* ASLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED0B1B17843500DA7C62 /* ASLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
34EFC7681B701CDE00AD841F /* ASLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */; };
|
34EFC7681B701CDE00AD841F /* ASLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */; };
|
||||||
34EFC7691B701CE100AD841F /* ASLayoutable.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED111B17843500DA7C62 /* ASLayoutable.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
34EFC7691B701CE100AD841F /* ASLayoutElement.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED111B17843500DA7C62 /* ASLayoutElement.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
34EFC76A1B701CE600AD841F /* ASLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
34EFC76A1B701CE600AD841F /* ASLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
34EFC76B1B701CEB00AD841F /* ASLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */; };
|
34EFC76B1B701CEB00AD841F /* ASLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */; };
|
||||||
34EFC76C1B701CED00AD841F /* ASOverlayLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
34EFC76C1B701CED00AD841F /* ASOverlayLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
697796611D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */; };
|
697796611D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */; };
|
||||||
697B315A1CFE4B410049936F /* ASEditableTextNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 697B31591CFE4B410049936F /* ASEditableTextNodeTests.m */; };
|
697B315A1CFE4B410049936F /* ASEditableTextNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 697B31591CFE4B410049936F /* ASEditableTextNodeTests.m */; };
|
||||||
698548641CA9E025008A345F /* ASEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 698548611CA9E025008A345F /* ASEnvironment.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
698548641CA9E025008A345F /* ASEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 698548611CA9E025008A345F /* ASEnvironment.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
698C8B621CAB49FC0052DC3F /* ASLayoutableExtensibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
698C8B621CAB49FC0052DC3F /* ASLayoutElementExtensibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutElementExtensibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
69B225671D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */; };
|
69B225671D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */; };
|
||||||
69CB62AC1CB8165900024920 /* _ASDisplayViewAccessiblity.h in Headers */ = {isa = PBXBuildFile; fileRef = 69CB62A91CB8165900024920 /* _ASDisplayViewAccessiblity.h */; };
|
69CB62AC1CB8165900024920 /* _ASDisplayViewAccessiblity.h in Headers */ = {isa = PBXBuildFile; fileRef = 69CB62A91CB8165900024920 /* _ASDisplayViewAccessiblity.h */; };
|
||||||
69CB62AD1CB8165900024920 /* _ASDisplayViewAccessiblity.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69CB62AA1CB8165900024920 /* _ASDisplayViewAccessiblity.mm */; };
|
69CB62AD1CB8165900024920 /* _ASDisplayViewAccessiblity.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69CB62AA1CB8165900024920 /* _ASDisplayViewAccessiblity.mm */; };
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
69E100701CA89CB600D88C1B /* ASEnvironmentInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */; };
|
69E100701CA89CB600D88C1B /* ASEnvironmentInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */; };
|
||||||
69EEA0A11D9AB43900B46420 /* ASLayoutSpecPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 69EEA0A01D9AB43900B46420 /* ASLayoutSpecPrivate.h */; };
|
69EEA0A11D9AB43900B46420 /* ASLayoutSpecPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 69EEA0A01D9AB43900B46420 /* ASLayoutSpecPrivate.h */; };
|
||||||
69F10C871C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F10C851C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
69F10C871C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F10C851C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
69FEE53D1D95A9AF0086F066 /* ASLayoutableStyleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FEE53C1D95A9AF0086F066 /* ASLayoutableStyleTests.m */; };
|
69FEE53D1D95A9AF0086F066 /* ASLayoutElementStyleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FEE53C1D95A9AF0086F066 /* ASLayoutElementStyleTests.m */; };
|
||||||
7630FFA81C9E267E007A7C0E /* ASVideoNode.h in Headers */ = {isa = PBXBuildFile; fileRef = AEEC47DF1C20C2DD00EC1693 /* ASVideoNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
7630FFA81C9E267E007A7C0E /* ASVideoNode.h in Headers */ = {isa = PBXBuildFile; fileRef = AEEC47DF1C20C2DD00EC1693 /* ASVideoNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
764D83D51C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 764D83D21C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
764D83D51C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 764D83D21C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
764D83D61C8EA515009B4FB8 /* AsyncDisplayKit+Debug.m in Sources */ = {isa = PBXBuildFile; fileRef = 764D83D31C8EA515009B4FB8 /* AsyncDisplayKit+Debug.m */; };
|
764D83D61C8EA515009B4FB8 /* AsyncDisplayKit+Debug.m in Sources */ = {isa = PBXBuildFile; fileRef = 764D83D31C8EA515009B4FB8 /* AsyncDisplayKit+Debug.m */; };
|
||||||
@@ -283,7 +283,7 @@
|
|||||||
9C8898BC1C738BA800D6B02E /* ASTextKitFontSizeAdjuster.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9C8898BA1C738B9800D6B02E /* ASTextKitFontSizeAdjuster.mm */; };
|
9C8898BC1C738BA800D6B02E /* ASTextKitFontSizeAdjuster.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9C8898BA1C738B9800D6B02E /* ASTextKitFontSizeAdjuster.mm */; };
|
||||||
9C8898BD1C738BB800D6B02E /* ASTextKitFontSizeAdjuster.h in Headers */ = {isa = PBXBuildFile; fileRef = A32FEDD31C501B6A004F642A /* ASTextKitFontSizeAdjuster.h */; };
|
9C8898BD1C738BB800D6B02E /* ASTextKitFontSizeAdjuster.h in Headers */ = {isa = PBXBuildFile; fileRef = A32FEDD31C501B6A004F642A /* ASTextKitFontSizeAdjuster.h */; };
|
||||||
9CC606651D24DF9E006581A0 /* NSIndexSet+ASHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = CC4981BB1D1C7F65004E13CC /* NSIndexSet+ASHelpers.m */; };
|
9CC606651D24DF9E006581A0 /* NSIndexSet+ASHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = CC4981BB1D1C7F65004E13CC /* NSIndexSet+ASHelpers.m */; };
|
||||||
9CDC18CD1B910E12004965E2 /* ASLayoutablePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
9CDC18CD1B910E12004965E2 /* ASLayoutElementPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CDC18CB1B910E12004965E2 /* ASLayoutElementPrivate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
9CFFC6BE1CCAC52B006A6476 /* ASEnvironment.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CFFC6BD1CCAC52B006A6476 /* ASEnvironment.mm */; };
|
9CFFC6BE1CCAC52B006A6476 /* ASEnvironment.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CFFC6BD1CCAC52B006A6476 /* ASEnvironment.mm */; };
|
||||||
9CFFC6C01CCAC73C006A6476 /* ASViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CFFC6BF1CCAC73C006A6476 /* ASViewController.mm */; };
|
9CFFC6C01CCAC73C006A6476 /* ASViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CFFC6BF1CCAC73C006A6476 /* ASViewController.mm */; };
|
||||||
9CFFC6C21CCAC768006A6476 /* ASTableNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CFFC6C11CCAC768006A6476 /* ASTableNode.mm */; };
|
9CFFC6C21CCAC768006A6476 /* ASTableNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CFFC6C11CCAC768006A6476 /* ASTableNode.mm */; };
|
||||||
@@ -475,8 +475,8 @@
|
|||||||
DECBD6EA1BE56E1900CF4905 /* ASButtonNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */; };
|
DECBD6EA1BE56E1900CF4905 /* ASButtonNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */; };
|
||||||
DEFAD8131CC48914000527C4 /* ASVideoNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E01C20C2DD00EC1693 /* ASVideoNode.mm */; };
|
DEFAD8131CC48914000527C4 /* ASVideoNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E01C20C2DD00EC1693 /* ASVideoNode.mm */; };
|
||||||
E52405B31C8FEF03004DC8E7 /* ASLayoutTransition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */; };
|
E52405B31C8FEF03004DC8E7 /* ASLayoutTransition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */; };
|
||||||
E55D86321CA8A14000A0C26F /* ASLayoutable.mm in Sources */ = {isa = PBXBuildFile; fileRef = E55D86311CA8A14000A0C26F /* ASLayoutable.mm */; };
|
E55D86321CA8A14000A0C26F /* ASLayoutElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = E55D86311CA8A14000A0C26F /* ASLayoutElement.mm */; };
|
||||||
E55D86331CA8A14000A0C26F /* ASLayoutable.mm in Sources */ = {isa = PBXBuildFile; fileRef = E55D86311CA8A14000A0C26F /* ASLayoutable.mm */; };
|
E55D86331CA8A14000A0C26F /* ASLayoutElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = E55D86311CA8A14000A0C26F /* ASLayoutElement.mm */; };
|
||||||
E5711A2C1C840C81009619D4 /* ASIndexedNodeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E5711A2A1C840C81009619D4 /* ASIndexedNodeContext.h */; };
|
E5711A2C1C840C81009619D4 /* ASIndexedNodeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E5711A2A1C840C81009619D4 /* ASIndexedNodeContext.h */; };
|
||||||
E5711A2E1C840C96009619D4 /* ASIndexedNodeContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5711A2D1C840C96009619D4 /* ASIndexedNodeContext.mm */; };
|
E5711A2E1C840C96009619D4 /* ASIndexedNodeContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5711A2D1C840C96009619D4 /* ASIndexedNodeContext.mm */; };
|
||||||
E5711A301C840C96009619D4 /* ASIndexedNodeContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5711A2D1C840C96009619D4 /* ASIndexedNodeContext.mm */; };
|
E5711A301C840C96009619D4 /* ASIndexedNodeContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5711A2D1C840C96009619D4 /* ASIndexedNodeContext.mm */; };
|
||||||
@@ -558,8 +558,8 @@
|
|||||||
F7CE6C5E1D2CDB3E00BE4C15 /* ASDimension.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED071B17843500DA7C62 /* ASDimension.h */; };
|
F7CE6C5E1D2CDB3E00BE4C15 /* ASDimension.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED071B17843500DA7C62 /* ASDimension.h */; };
|
||||||
F7CE6C5F1D2CDB3E00BE4C15 /* ASInsetLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */; };
|
F7CE6C5F1D2CDB3E00BE4C15 /* ASInsetLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */; };
|
||||||
F7CE6C601D2CDB3E00BE4C15 /* ASLayout.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED0B1B17843500DA7C62 /* ASLayout.h */; };
|
F7CE6C601D2CDB3E00BE4C15 /* ASLayout.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED0B1B17843500DA7C62 /* ASLayout.h */; };
|
||||||
F7CE6C611D2CDB3E00BE4C15 /* ASLayoutable.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED111B17843500DA7C62 /* ASLayoutable.h */; };
|
F7CE6C611D2CDB3E00BE4C15 /* ASLayoutElement.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED111B17843500DA7C62 /* ASLayoutElement.h */; };
|
||||||
F7CE6C621D2CDB3E00BE4C15 /* ASLayoutablePrivate.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */; };
|
F7CE6C621D2CDB3E00BE4C15 /* ASLayoutElementPrivate.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9CDC18CB1B910E12004965E2 /* ASLayoutElementPrivate.h */; };
|
||||||
F7CE6C631D2CDB3E00BE4C15 /* ASLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */; };
|
F7CE6C631D2CDB3E00BE4C15 /* ASLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */; };
|
||||||
F7CE6C641D2CDB3E00BE4C15 /* ASOverlayLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */; };
|
F7CE6C641D2CDB3E00BE4C15 /* ASOverlayLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */; };
|
||||||
F7CE6C651D2CDB3E00BE4C15 /* ASRatioLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */; };
|
F7CE6C651D2CDB3E00BE4C15 /* ASRatioLayoutSpec.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */; };
|
||||||
@@ -617,7 +617,7 @@
|
|||||||
F7CE6CA11D2CDB5800BE4C15 /* ASWeakSet.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = CC3B20871C3F7A5400798563 /* ASWeakSet.h */; };
|
F7CE6CA11D2CDB5800BE4C15 /* ASWeakSet.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = CC3B20871C3F7A5400798563 /* ASWeakSet.h */; };
|
||||||
F7CE6CA21D2CDB5800BE4C15 /* ASDefaultPlaybackButton.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8B0768B11CE752EC002E1453 /* ASDefaultPlaybackButton.h */; };
|
F7CE6CA21D2CDB5800BE4C15 /* ASDefaultPlaybackButton.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8B0768B11CE752EC002E1453 /* ASDefaultPlaybackButton.h */; };
|
||||||
F7CE6CA41D2CDB5800BE4C15 /* ASLayoutManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B30BF6501C5964B0004FCD53 /* ASLayoutManager.h */; };
|
F7CE6CA41D2CDB5800BE4C15 /* ASLayoutManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B30BF6501C5964B0004FCD53 /* ASLayoutManager.h */; };
|
||||||
F7CE6CB71D2CE2D000BE4C15 /* ASLayoutableExtensibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */; };
|
F7CE6CB71D2CE2D000BE4C15 /* ASLayoutElementExtensibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutElementExtensibility.h */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -654,7 +654,7 @@
|
|||||||
CC4C2A7A1D8902350039ACAB /* ASTraceEvent.h in CopyFiles */,
|
CC4C2A7A1D8902350039ACAB /* ASTraceEvent.h in CopyFiles */,
|
||||||
CC88F7AE1D80AF5E000D6D4E /* ASObjectDescriptionHelpers.h in CopyFiles */,
|
CC88F7AE1D80AF5E000D6D4E /* ASObjectDescriptionHelpers.h in CopyFiles */,
|
||||||
F7CE6C981D2CDB5800BE4C15 /* ASInternalHelpers.h in CopyFiles */,
|
F7CE6C981D2CDB5800BE4C15 /* ASInternalHelpers.h in CopyFiles */,
|
||||||
F7CE6CB71D2CE2D000BE4C15 /* ASLayoutableExtensibility.h in CopyFiles */,
|
F7CE6CB71D2CE2D000BE4C15 /* ASLayoutElementExtensibility.h in CopyFiles */,
|
||||||
F7CE6C131D2CDB3E00BE4C15 /* ASPagerFlowLayout.h in CopyFiles */,
|
F7CE6C131D2CDB3E00BE4C15 /* ASPagerFlowLayout.h in CopyFiles */,
|
||||||
F7CE6C141D2CDB3E00BE4C15 /* ASMapNode.h in CopyFiles */,
|
F7CE6C141D2CDB3E00BE4C15 /* ASMapNode.h in CopyFiles */,
|
||||||
F7CE6C151D2CDB3E00BE4C15 /* ASVideoNode.h in CopyFiles */,
|
F7CE6C151D2CDB3E00BE4C15 /* ASVideoNode.h in CopyFiles */,
|
||||||
@@ -729,8 +729,8 @@
|
|||||||
F7CE6C5E1D2CDB3E00BE4C15 /* ASDimension.h in CopyFiles */,
|
F7CE6C5E1D2CDB3E00BE4C15 /* ASDimension.h in CopyFiles */,
|
||||||
F7CE6C5F1D2CDB3E00BE4C15 /* ASInsetLayoutSpec.h in CopyFiles */,
|
F7CE6C5F1D2CDB3E00BE4C15 /* ASInsetLayoutSpec.h in CopyFiles */,
|
||||||
F7CE6C601D2CDB3E00BE4C15 /* ASLayout.h in CopyFiles */,
|
F7CE6C601D2CDB3E00BE4C15 /* ASLayout.h in CopyFiles */,
|
||||||
F7CE6C611D2CDB3E00BE4C15 /* ASLayoutable.h in CopyFiles */,
|
F7CE6C611D2CDB3E00BE4C15 /* ASLayoutElement.h in CopyFiles */,
|
||||||
F7CE6C621D2CDB3E00BE4C15 /* ASLayoutablePrivate.h in CopyFiles */,
|
F7CE6C621D2CDB3E00BE4C15 /* ASLayoutElementPrivate.h in CopyFiles */,
|
||||||
F7CE6C631D2CDB3E00BE4C15 /* ASLayoutSpec.h in CopyFiles */,
|
F7CE6C631D2CDB3E00BE4C15 /* ASLayoutSpec.h in CopyFiles */,
|
||||||
F7CE6C641D2CDB3E00BE4C15 /* ASOverlayLayoutSpec.h in CopyFiles */,
|
F7CE6C641D2CDB3E00BE4C15 /* ASOverlayLayoutSpec.h in CopyFiles */,
|
||||||
F7CE6C651D2CDB3E00BE4C15 /* ASRatioLayoutSpec.h in CopyFiles */,
|
F7CE6C651D2CDB3E00BE4C15 /* ASRatioLayoutSpec.h in CopyFiles */,
|
||||||
@@ -988,7 +988,7 @@
|
|||||||
6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "ASLayoutSpec+Subclasses.mm"; path = "AsyncDisplayKit/Layout/ASLayoutSpec+Subclasses.mm"; sourceTree = "<group>"; };
|
6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "ASLayoutSpec+Subclasses.mm"; path = "AsyncDisplayKit/Layout/ASLayoutSpec+Subclasses.mm"; sourceTree = "<group>"; };
|
||||||
697B31591CFE4B410049936F /* ASEditableTextNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASEditableTextNodeTests.m; sourceTree = "<group>"; };
|
697B31591CFE4B410049936F /* ASEditableTextNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASEditableTextNodeTests.m; sourceTree = "<group>"; };
|
||||||
698548611CA9E025008A345F /* ASEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironment.h; sourceTree = "<group>"; };
|
698548611CA9E025008A345F /* ASEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironment.h; sourceTree = "<group>"; };
|
||||||
698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutableExtensibility.h; path = AsyncDisplayKit/Layout/ASLayoutableExtensibility.h; sourceTree = "<group>"; };
|
698C8B601CAB49FC0052DC3F /* ASLayoutElementExtensibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutElementExtensibility.h; path = AsyncDisplayKit/Layout/ASLayoutElementExtensibility.h; sourceTree = "<group>"; };
|
||||||
69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayNodeLayoutTests.mm; sourceTree = "<group>"; };
|
69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayNodeLayoutTests.mm; sourceTree = "<group>"; };
|
||||||
69B225681D7265DA00B25B22 /* ASXCTExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASXCTExtensions.h; sourceTree = "<group>"; };
|
69B225681D7265DA00B25B22 /* ASXCTExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASXCTExtensions.h; sourceTree = "<group>"; };
|
||||||
69CB62A91CB8165900024920 /* _ASDisplayViewAccessiblity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _ASDisplayViewAccessiblity.h; sourceTree = "<group>"; };
|
69CB62A91CB8165900024920 /* _ASDisplayViewAccessiblity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _ASDisplayViewAccessiblity.h; sourceTree = "<group>"; };
|
||||||
@@ -997,7 +997,7 @@
|
|||||||
69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEnvironmentInternal.mm; sourceTree = "<group>"; };
|
69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEnvironmentInternal.mm; sourceTree = "<group>"; };
|
||||||
69EEA0A01D9AB43900B46420 /* ASLayoutSpecPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutSpecPrivate.h; sourceTree = "<group>"; };
|
69EEA0A01D9AB43900B46420 /* ASLayoutSpecPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutSpecPrivate.h; sourceTree = "<group>"; };
|
||||||
69F10C851C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASRangeControllerUpdateRangeProtocol+Beta.h"; sourceTree = "<group>"; };
|
69F10C851C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASRangeControllerUpdateRangeProtocol+Beta.h"; sourceTree = "<group>"; };
|
||||||
69FEE53C1D95A9AF0086F066 /* ASLayoutableStyleTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLayoutableStyleTests.m; sourceTree = "<group>"; };
|
69FEE53C1D95A9AF0086F066 /* ASLayoutElementStyleTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLayoutElementStyleTests.m; sourceTree = "<group>"; };
|
||||||
6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = AsyncDisplayKit.h; sourceTree = "<group>"; };
|
6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = AsyncDisplayKit.h; sourceTree = "<group>"; };
|
||||||
764D83D21C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AsyncDisplayKit+Debug.h"; sourceTree = "<group>"; };
|
764D83D21C8EA515009B4FB8 /* AsyncDisplayKit+Debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AsyncDisplayKit+Debug.h"; sourceTree = "<group>"; };
|
||||||
764D83D31C8EA515009B4FB8 /* AsyncDisplayKit+Debug.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AsyncDisplayKit+Debug.m"; sourceTree = "<group>"; };
|
764D83D31C8EA515009B4FB8 /* AsyncDisplayKit+Debug.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AsyncDisplayKit+Debug.m"; sourceTree = "<group>"; };
|
||||||
@@ -1032,7 +1032,7 @@
|
|||||||
9C8221931BA237B80037F19A /* ASStackBaselinePositionedLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackBaselinePositionedLayout.h; sourceTree = "<group>"; };
|
9C8221931BA237B80037F19A /* ASStackBaselinePositionedLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackBaselinePositionedLayout.h; sourceTree = "<group>"; };
|
||||||
9C8221941BA237B80037F19A /* ASStackBaselinePositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackBaselinePositionedLayout.mm; sourceTree = "<group>"; };
|
9C8221941BA237B80037F19A /* ASStackBaselinePositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackBaselinePositionedLayout.mm; sourceTree = "<group>"; };
|
||||||
9C8898BA1C738B9800D6B02E /* ASTextKitFontSizeAdjuster.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASTextKitFontSizeAdjuster.mm; path = TextKit/ASTextKitFontSizeAdjuster.mm; sourceTree = "<group>"; };
|
9C8898BA1C738B9800D6B02E /* ASTextKitFontSizeAdjuster.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASTextKitFontSizeAdjuster.mm; path = TextKit/ASTextKitFontSizeAdjuster.mm; sourceTree = "<group>"; };
|
||||||
9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutablePrivate.h; path = AsyncDisplayKit/Layout/ASLayoutablePrivate.h; sourceTree = "<group>"; };
|
9CDC18CB1B910E12004965E2 /* ASLayoutElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutElementPrivate.h; path = AsyncDisplayKit/Layout/ASLayoutElementPrivate.h; sourceTree = "<group>"; };
|
||||||
9CFFC6BD1CCAC52B006A6476 /* ASEnvironment.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEnvironment.mm; sourceTree = "<group>"; };
|
9CFFC6BD1CCAC52B006A6476 /* ASEnvironment.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEnvironment.mm; sourceTree = "<group>"; };
|
||||||
9CFFC6BF1CCAC73C006A6476 /* ASViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASViewController.mm; sourceTree = "<group>"; };
|
9CFFC6BF1CCAC73C006A6476 /* ASViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASViewController.mm; sourceTree = "<group>"; };
|
||||||
9CFFC6C11CCAC768006A6476 /* ASTableNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASTableNode.mm; sourceTree = "<group>"; };
|
9CFFC6C11CCAC768006A6476 /* ASTableNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASTableNode.mm; sourceTree = "<group>"; };
|
||||||
@@ -1067,7 +1067,7 @@
|
|||||||
ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASLayout.mm; path = AsyncDisplayKit/Layout/ASLayout.mm; sourceTree = "<group>"; };
|
ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASLayout.mm; path = AsyncDisplayKit/Layout/ASLayout.mm; sourceTree = "<group>"; };
|
||||||
ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutSpec.h; path = AsyncDisplayKit/Layout/ASLayoutSpec.h; sourceTree = "<group>"; };
|
ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutSpec.h; path = AsyncDisplayKit/Layout/ASLayoutSpec.h; sourceTree = "<group>"; };
|
||||||
ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASLayoutSpec.mm; sourceTree = "<group>"; };
|
ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASLayoutSpec.mm; sourceTree = "<group>"; };
|
||||||
ACF6ED111B17843500DA7C62 /* ASLayoutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutable.h; path = AsyncDisplayKit/Layout/ASLayoutable.h; sourceTree = "<group>"; };
|
ACF6ED111B17843500DA7C62 /* ASLayoutElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutElement.h; path = AsyncDisplayKit/Layout/ASLayoutElement.h; sourceTree = "<group>"; };
|
||||||
ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASOverlayLayoutSpec.h; path = AsyncDisplayKit/Layout/ASOverlayLayoutSpec.h; sourceTree = "<group>"; };
|
ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASOverlayLayoutSpec.h; path = AsyncDisplayKit/Layout/ASOverlayLayoutSpec.h; sourceTree = "<group>"; };
|
||||||
ACF6ED131B17843500DA7C62 /* ASOverlayLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASOverlayLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm; sourceTree = "<group>"; };
|
ACF6ED131B17843500DA7C62 /* ASOverlayLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASOverlayLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASOverlayLayoutSpec.mm; sourceTree = "<group>"; };
|
||||||
ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASRatioLayoutSpec.h; path = AsyncDisplayKit/Layout/ASRatioLayoutSpec.h; sourceTree = "<group>"; };
|
ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASRatioLayoutSpec.h; path = AsyncDisplayKit/Layout/ASRatioLayoutSpec.h; sourceTree = "<group>"; };
|
||||||
@@ -1151,7 +1151,7 @@
|
|||||||
DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASButtonNode.mm; sourceTree = "<group>"; };
|
DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASButtonNode.mm; sourceTree = "<group>"; };
|
||||||
E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASLayoutTransition.mm; sourceTree = "<group>"; };
|
E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASLayoutTransition.mm; sourceTree = "<group>"; };
|
||||||
E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutTransition.h; sourceTree = "<group>"; };
|
E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutTransition.h; sourceTree = "<group>"; };
|
||||||
E55D86311CA8A14000A0C26F /* ASLayoutable.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASLayoutable.mm; path = AsyncDisplayKit/Layout/ASLayoutable.mm; sourceTree = "<group>"; };
|
E55D86311CA8A14000A0C26F /* ASLayoutElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASLayoutElement.mm; path = AsyncDisplayKit/Layout/ASLayoutElement.mm; sourceTree = "<group>"; };
|
||||||
E5711A2A1C840C81009619D4 /* ASIndexedNodeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIndexedNodeContext.h; sourceTree = "<group>"; };
|
E5711A2A1C840C81009619D4 /* ASIndexedNodeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIndexedNodeContext.h; sourceTree = "<group>"; };
|
||||||
E5711A2D1C840C96009619D4 /* ASIndexedNodeContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASIndexedNodeContext.mm; sourceTree = "<group>"; };
|
E5711A2D1C840C96009619D4 /* ASIndexedNodeContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASIndexedNodeContext.mm; sourceTree = "<group>"; };
|
||||||
EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AsyncDisplayKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AsyncDisplayKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -1421,7 +1421,7 @@
|
|||||||
058D09C6195D04C000B7D73C /* Supporting Files */,
|
058D09C6195D04C000B7D73C /* Supporting Files */,
|
||||||
052EE06A1A15A0D8002C6279 /* TestResources */,
|
052EE06A1A15A0D8002C6279 /* TestResources */,
|
||||||
2538B6F21BC5D2A2003CA0B4 /* ASCollectionViewFlowLayoutInspectorTests.m */,
|
2538B6F21BC5D2A2003CA0B4 /* ASCollectionViewFlowLayoutInspectorTests.m */,
|
||||||
69FEE53C1D95A9AF0086F066 /* ASLayoutableStyleTests.m */,
|
69FEE53C1D95A9AF0086F066 /* ASLayoutElementStyleTests.m */,
|
||||||
);
|
);
|
||||||
path = AsyncDisplayKitTests;
|
path = AsyncDisplayKitTests;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -1678,10 +1678,10 @@
|
|||||||
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */,
|
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */,
|
||||||
ACF6ED0B1B17843500DA7C62 /* ASLayout.h */,
|
ACF6ED0B1B17843500DA7C62 /* ASLayout.h */,
|
||||||
ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */,
|
ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */,
|
||||||
9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */,
|
ACF6ED111B17843500DA7C62 /* ASLayoutElement.h */,
|
||||||
ACF6ED111B17843500DA7C62 /* ASLayoutable.h */,
|
E55D86311CA8A14000A0C26F /* ASLayoutElement.mm */,
|
||||||
E55D86311CA8A14000A0C26F /* ASLayoutable.mm */,
|
698C8B601CAB49FC0052DC3F /* ASLayoutElementExtensibility.h */,
|
||||||
698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */,
|
9CDC18CB1B910E12004965E2 /* ASLayoutElementPrivate.h */,
|
||||||
ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */,
|
ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */,
|
||||||
ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */,
|
ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */,
|
||||||
6977965D1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.h */,
|
6977965D1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.h */,
|
||||||
@@ -1741,7 +1741,7 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
69E0E8A71D356C9400627613 /* ASEqualityHelpers.h in Headers */,
|
69E0E8A71D356C9400627613 /* ASEqualityHelpers.h in Headers */,
|
||||||
698C8B621CAB49FC0052DC3F /* ASLayoutableExtensibility.h in Headers */,
|
698C8B621CAB49FC0052DC3F /* ASLayoutElementExtensibility.h in Headers */,
|
||||||
698548641CA9E025008A345F /* ASEnvironment.h in Headers */,
|
698548641CA9E025008A345F /* ASEnvironment.h in Headers */,
|
||||||
AC026B6A1BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */,
|
AC026B6A1BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */,
|
||||||
B35062481B010EFD0018CF92 /* _AS-objc-internal.h in Headers */,
|
B35062481B010EFD0018CF92 /* _AS-objc-internal.h in Headers */,
|
||||||
@@ -1832,8 +1832,8 @@
|
|||||||
34EFC7671B701CD900AD841F /* ASLayout.h in Headers */,
|
34EFC7671B701CD900AD841F /* ASLayout.h in Headers */,
|
||||||
DEC146B71C37A16A004A0EE7 /* ASCollectionInternal.h in Headers */,
|
DEC146B71C37A16A004A0EE7 /* ASCollectionInternal.h in Headers */,
|
||||||
DBDB83951C6E879900D0098C /* ASPagerFlowLayout.h in Headers */,
|
DBDB83951C6E879900D0098C /* ASPagerFlowLayout.h in Headers */,
|
||||||
34EFC7691B701CE100AD841F /* ASLayoutable.h in Headers */,
|
34EFC7691B701CE100AD841F /* ASLayoutElement.h in Headers */,
|
||||||
9CDC18CD1B910E12004965E2 /* ASLayoutablePrivate.h in Headers */,
|
9CDC18CD1B910E12004965E2 /* ASLayoutElementPrivate.h in Headers */,
|
||||||
68B8A4E21CBDB958007E4543 /* ASWeakProxy.h in Headers */,
|
68B8A4E21CBDB958007E4543 /* ASWeakProxy.h in Headers */,
|
||||||
B35062201B010EFD0018CF92 /* ASLayoutController.h in Headers */,
|
B35062201B010EFD0018CF92 /* ASLayoutController.h in Headers */,
|
||||||
B35062211B010EFD0018CF92 /* ASLayoutRangeType.h in Headers */,
|
B35062211B010EFD0018CF92 /* ASLayoutRangeType.h in Headers */,
|
||||||
@@ -2114,7 +2114,7 @@
|
|||||||
files = (
|
files = (
|
||||||
058D0A22195D050800B7D73C /* _ASAsyncTransaction.mm in Sources */,
|
058D0A22195D050800B7D73C /* _ASAsyncTransaction.mm in Sources */,
|
||||||
8B0768B41CE752EC002E1453 /* ASDefaultPlaybackButton.m in Sources */,
|
8B0768B41CE752EC002E1453 /* ASDefaultPlaybackButton.m in Sources */,
|
||||||
E55D86321CA8A14000A0C26F /* ASLayoutable.mm in Sources */,
|
E55D86321CA8A14000A0C26F /* ASLayoutElement.mm in Sources */,
|
||||||
68FC85E41CE29B7E00EDD713 /* ASTabBarController.m in Sources */,
|
68FC85E41CE29B7E00EDD713 /* ASTabBarController.m in Sources */,
|
||||||
058D0A23195D050800B7D73C /* _ASAsyncTransactionContainer.m in Sources */,
|
058D0A23195D050800B7D73C /* _ASAsyncTransactionContainer.m in Sources */,
|
||||||
058D0A24195D050800B7D73C /* _ASAsyncTransactionGroup.m in Sources */,
|
058D0A24195D050800B7D73C /* _ASAsyncTransactionGroup.m in Sources */,
|
||||||
@@ -2256,7 +2256,7 @@
|
|||||||
CCB2F34D1D63CCC6004E6DE9 /* ASDisplayNodeSnapshotTests.m in Sources */,
|
CCB2F34D1D63CCC6004E6DE9 /* ASDisplayNodeSnapshotTests.m in Sources */,
|
||||||
058D0A3A195D057000B7D73C /* ASDisplayNodeTests.m in Sources */,
|
058D0A3A195D057000B7D73C /* ASDisplayNodeTests.m in Sources */,
|
||||||
696FCB311D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm in Sources */,
|
696FCB311D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm in Sources */,
|
||||||
69FEE53D1D95A9AF0086F066 /* ASLayoutableStyleTests.m in Sources */,
|
69FEE53D1D95A9AF0086F066 /* ASLayoutElementStyleTests.m in Sources */,
|
||||||
CC4981B31D1A02BE004E13CC /* ASTableViewThrashTests.m in Sources */,
|
CC4981B31D1A02BE004E13CC /* ASTableViewThrashTests.m in Sources */,
|
||||||
CC54A81E1D7008B300296A24 /* ASDispatchTests.m in Sources */,
|
CC54A81E1D7008B300296A24 /* ASDispatchTests.m in Sources */,
|
||||||
058D0A3B195D057000B7D73C /* ASDisplayNodeTestsHelper.m in Sources */,
|
058D0A3B195D057000B7D73C /* ASDisplayNodeTestsHelper.m in Sources */,
|
||||||
@@ -2328,7 +2328,7 @@
|
|||||||
AC47D9421B3B891B00AAEE9D /* ASCellNode.mm in Sources */,
|
AC47D9421B3B891B00AAEE9D /* ASCellNode.mm in Sources */,
|
||||||
34EFC7641B701CC600AD841F /* ASCenterLayoutSpec.mm in Sources */,
|
34EFC7641B701CC600AD841F /* ASCenterLayoutSpec.mm in Sources */,
|
||||||
18C2ED831B9B7DE800F627B3 /* ASCollectionNode.mm in Sources */,
|
18C2ED831B9B7DE800F627B3 /* ASCollectionNode.mm in Sources */,
|
||||||
E55D86331CA8A14000A0C26F /* ASLayoutable.mm in Sources */,
|
E55D86331CA8A14000A0C26F /* ASLayoutElement.mm in Sources */,
|
||||||
68FC85EC1CE29C7D00EDD713 /* ASVisibilityProtocols.m in Sources */,
|
68FC85EC1CE29C7D00EDD713 /* ASVisibilityProtocols.m in Sources */,
|
||||||
68B8A4E41CBDB958007E4543 /* ASWeakProxy.m in Sources */,
|
68B8A4E41CBDB958007E4543 /* ASWeakProxy.m in Sources */,
|
||||||
9C70F20A1CDBE949007D6C76 /* ASTableNode.mm in Sources */,
|
9C70F20A1CDBE949007D6C76 /* ASTableNode.mm in Sources */,
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
* @warning Overriding this method should be done VERY rarely.
|
* @warning Overriding this method should be done VERY rarely.
|
||||||
*/
|
*/
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
restrictedToSize:(ASLayoutableSize)size
|
restrictedToSize:(ASLayoutElementSize)size
|
||||||
relativeToParentSize:(CGSize)parentSize;
|
relativeToParentSize:(CGSize)parentSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#import <AsyncDisplayKit/ASDealloc2MainObject.h>
|
#import <AsyncDisplayKit/ASDealloc2MainObject.h>
|
||||||
#import <AsyncDisplayKit/ASDimension.h>
|
#import <AsyncDisplayKit/ASDimension.h>
|
||||||
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
|
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutElement.h>
|
||||||
#import <AsyncDisplayKit/ASContextTransitioning.h>
|
#import <AsyncDisplayKit/ASContextTransitioning.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@@ -104,8 +104,7 @@ extern NSInteger const ASDefaultDrawingPriority;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@interface ASDisplayNode : ASDealloc2MainObject <ASLayoutable>
|
@interface ASDisplayNode : ASDealloc2MainObject <ASLayoutElement>
|
||||||
|
|
||||||
|
|
||||||
/** @name Initializing a node object */
|
/** @name Initializing a node object */
|
||||||
|
|
||||||
@@ -608,7 +607,7 @@ extern NSInteger const ASDefaultDrawingPriority;
|
|||||||
/**
|
/**
|
||||||
* Convenience methods for debugging.
|
* Convenience methods for debugging.
|
||||||
*/
|
*/
|
||||||
@interface ASDisplayNode (Debugging) <ASLayoutableAsciiArtProtocol>
|
@interface ASDisplayNode (Debugging) <ASLayoutElementAsciiArtProtocol>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract Return a description of the node hierarchy.
|
* @abstract Return a description of the node hierarchy.
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp = @"AS
|
|||||||
|
|
||||||
@implementation ASDisplayNode
|
@implementation ASDisplayNode
|
||||||
|
|
||||||
@dynamic layoutableType;
|
@dynamic layoutElementType;
|
||||||
|
|
||||||
@synthesize name = _name;
|
@synthesize name = _name;
|
||||||
@synthesize isFinalLayoutable = _isFinalLayoutable;
|
@synthesize isFinalLayoutElement = _isFinalLayoutElement;
|
||||||
@synthesize threadSafeBounds = _threadSafeBounds;
|
@synthesize threadSafeBounds = _threadSafeBounds;
|
||||||
@synthesize layoutSpecBlock = _layoutSpecBlock;
|
@synthesize layoutSpecBlock = _layoutSpecBlock;
|
||||||
|
|
||||||
@@ -299,8 +299,8 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
_contentsScaleForDisplay = ASScreenScale();
|
_contentsScaleForDisplay = ASScreenScale();
|
||||||
_displaySentinel = [[ASSentinel alloc] init];
|
_displaySentinel = [[ASSentinel alloc] init];
|
||||||
|
|
||||||
_style = [[ASLayoutableStyle alloc] init];
|
// TODO: We should lazily initialize the style object.
|
||||||
_size = ASLayoutableSizeMake();
|
_style = [[ASLayoutElementStyle alloc] init];
|
||||||
_environmentState = ASEnvironmentStateMakeDefault();
|
_environmentState = ASEnvironmentStateMakeDefault();
|
||||||
|
|
||||||
_calculatedDisplayNodeLayout = std::make_shared<ASDisplayNodeLayout>();
|
_calculatedDisplayNodeLayout = std::make_shared<ASDisplayNodeLayout>();
|
||||||
@@ -722,7 +722,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
|
|
||||||
#pragma mark - Style
|
#pragma mark - Style
|
||||||
|
|
||||||
- (ASLayoutableStyle *)style
|
- (ASLayoutElementStyle *)style
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
return _style;
|
return _style;
|
||||||
@@ -744,7 +744,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
|
|
||||||
if ([self shouldCalculateLayoutWithConstrainedSize:constrainedSize parentSize:parentSize] == NO) {
|
if ([self shouldCalculateLayoutWithConstrainedSize:constrainedSize parentSize:parentSize] == NO) {
|
||||||
ASDisplayNodeAssertNotNil(_calculatedDisplayNodeLayout->layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _layout should not be nil! %@", self);
|
ASDisplayNodeAssertNotNil(_calculatedDisplayNodeLayout->layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _layout should not be nil! %@", self);
|
||||||
return _calculatedDisplayNodeLayout->layout ? : [ASLayout layoutWithLayoutable:self size:{0, 0}];
|
return _calculatedDisplayNodeLayout->layout ? : [ASLayout layoutWithLayoutElement:self size:{0, 0}];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self cancelLayoutTransition];
|
[self cancelLayoutTransition];
|
||||||
@@ -777,8 +777,8 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
|
|
||||||
// Don't remeasure if in layout pending state and a new transition already started
|
// Don't remeasure if in layout pending state and a new transition already started
|
||||||
if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) {
|
if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) {
|
||||||
ASLayoutableContext context = ASLayoutableGetCurrentContext();
|
ASLayoutElementContext context = ASLayoutElementGetCurrentContext();
|
||||||
if (ASLayoutableContextIsNull(context) || _pendingTransitionID != context.transitionID) {
|
if (ASLayoutElementContextIsNull(context) || _pendingTransitionID != context.transitionID) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -787,9 +787,9 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
return _calculatedDisplayNodeLayout->isValidForConstrainedSizeParentSize(constrainedSize, parentSize) == NO;
|
return _calculatedDisplayNodeLayout->isValidForConstrainedSizeParentSize(constrainedSize, parentSize) == NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASLayoutableType)layoutableType
|
- (ASLayoutElementType)layoutElementType
|
||||||
{
|
{
|
||||||
return ASLayoutableTypeDisplayNode;
|
return ASLayoutElementTypeDisplayNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)canLayoutAsynchronous
|
- (BOOL)canLayoutAsynchronous
|
||||||
@@ -863,7 +863,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
|
|
||||||
ASLayout *newLayout;
|
ASLayout *newLayout;
|
||||||
{
|
{
|
||||||
ASLayoutableSetCurrentContext(ASLayoutableContextMake(transitionID, NO));
|
ASLayoutElementSetCurrentContext(ASLayoutElementContextMake(transitionID, NO));
|
||||||
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
BOOL automaticallyManagesSubnodesDisabled = (self.automaticallyManagesSubnodes == NO);
|
BOOL automaticallyManagesSubnodesDisabled = (self.automaticallyManagesSubnodes == NO);
|
||||||
@@ -875,7 +875,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
self.automaticallyManagesSubnodes = NO; // Temporary flag for 1.9.x
|
self.automaticallyManagesSubnodes = NO; // Temporary flag for 1.9.x
|
||||||
}
|
}
|
||||||
|
|
||||||
ASLayoutableClearCurrentContext();
|
ASLayoutElementClearCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self _shouldAbortTransitionWithID:transitionID]) {
|
if ([self _shouldAbortTransitionWithID:transitionID]) {
|
||||||
@@ -1484,8 +1484,8 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
// Check if it's a subnode in a layout transition. In this case no measurement is needed as it's part of
|
// Check if it's a subnode in a layout transition. In this case no measurement is needed as it's part of
|
||||||
// the layout transition
|
// the layout transition
|
||||||
if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) {
|
if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) {
|
||||||
ASLayoutableContext context = ASLayoutableGetCurrentContext();
|
ASLayoutElementContext context = ASLayoutElementGetCurrentContext();
|
||||||
if (ASLayoutableContextIsNull(context) || _pendingTransitionID != context.transitionID) {
|
if (ASLayoutElementContextIsNull(context) || _pendingTransitionID != context.transitionID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2203,7 +2203,7 @@ static NSInteger incrementIfFound(NSInteger i) {
|
|||||||
// is in fly
|
// is in fly
|
||||||
if (ASHierarchyStateIncludesLayoutPending(stateToEnterOrExit)) {
|
if (ASHierarchyStateIncludesLayoutPending(stateToEnterOrExit)) {
|
||||||
int32_t pendingTransitionId = newSupernode.pendingTransitionID;
|
int32_t pendingTransitionId = newSupernode.pendingTransitionID;
|
||||||
if (pendingTransitionId != ASLayoutableContextInvalidTransitionID) {
|
if (pendingTransitionId != ASLayoutElementContextInvalidTransitionID) {
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
_pendingTransitionID = pendingTransitionId;
|
_pendingTransitionID = pendingTransitionId;
|
||||||
@@ -2397,10 +2397,10 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
#pragma mark - For Subclasses
|
#pragma mark - For Subclasses
|
||||||
|
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
restrictedToSize:(ASLayoutableSize)size
|
restrictedToSize:(ASLayoutElementSize)size
|
||||||
relativeToParentSize:(CGSize)parentSize
|
relativeToParentSize:(CGSize)parentSize
|
||||||
{
|
{
|
||||||
const ASSizeRange resolvedRange = ASSizeRangeIntersect(constrainedSize, ASLayoutableSizeResolve(_style.size, parentSize));
|
const ASSizeRange resolvedRange = ASSizeRangeIntersect(constrainedSize, ASLayoutElementSizeResolve(_style.size, parentSize));
|
||||||
return [self calculateLayoutThatFits:resolvedRange];
|
return [self calculateLayoutThatFits:resolvedRange];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2422,7 +2422,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
|
|
||||||
ASDisplayNodeAssert(layoutSpec.isMutable, @"Node %@ returned layout spec %@ that has already been used. Layout specs should always be regenerated.", self, layoutSpec);
|
ASDisplayNodeAssert(layoutSpec.isMutable, @"Node %@ returned layout spec %@ that has already been used. Layout specs should always be regenerated.", self, layoutSpec);
|
||||||
|
|
||||||
layoutSpec.parent = self; // This causes upward propogation of any non-default layoutable values.
|
layoutSpec.parent = self; // This causes upward propogation of any non-default layoutElement values.
|
||||||
|
|
||||||
// manually propagate the trait collection here so that any layoutSpec children of layoutSpec will get a traitCollection
|
// manually propagate the trait collection here so that any layoutSpec children of layoutSpec will get a traitCollection
|
||||||
{
|
{
|
||||||
@@ -2443,18 +2443,18 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
|
|
||||||
ASDisplayNodeAssertNotNil(layout, @"[ASLayoutSpec measureWithSizeRange:] should never return nil! %@, %@", self, layoutSpec);
|
ASDisplayNodeAssertNotNil(layout, @"[ASLayoutSpec measureWithSizeRange:] should never return nil! %@, %@", self, layoutSpec);
|
||||||
|
|
||||||
// Make sure layoutableObject of the root layout is `self`, so that the flattened layout will be structurally correct.
|
// Make sure layoutElementObject of the root layout is `self`, so that the flattened layout will be structurally correct.
|
||||||
BOOL isFinalLayoutable = (layout.layoutable != self);
|
BOOL isFinalLayoutElement = (layout.layoutElement != self);
|
||||||
if (isFinalLayoutable) {
|
if (isFinalLayoutElement) {
|
||||||
layout.position = CGPointZero;
|
layout.position = CGPointZero;
|
||||||
layout = [ASLayout layoutWithLayoutable:self size:layout.size sublayouts:@[layout]];
|
layout = [ASLayout layoutWithLayoutElement:self size:layout.size sublayouts:@[layout]];
|
||||||
}
|
}
|
||||||
ASDisplayNodeLogEvent(self, @"computedLayout: %@", layout);
|
ASDisplayNodeLogEvent(self, @"computedLayout: %@", layout);
|
||||||
return [layout filteredNodeLayoutTree];
|
return [layout filteredNodeLayoutTree];
|
||||||
} else {
|
} else {
|
||||||
CGSize size = [self calculateSizeThatFits:constrainedSize.max];
|
CGSize size = [self calculateSizeThatFits:constrainedSize.max];
|
||||||
ASDisplayNodeLogEvent(self, @"calculatedSize: %@", NSStringFromCGSize(size));
|
ASDisplayNodeLogEvent(self, @"calculatedSize: %@", NSStringFromCGSize(size));
|
||||||
return [ASLayout layoutWithLayoutable:self size:ASSizeRangeClamp(constrainedSize, size) sublayouts:nil];
|
return [ASLayout layoutWithLayoutElement:self size:ASSizeRangeClamp(constrainedSize, size) sublayouts:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2504,7 +2504,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
{
|
{
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
|
||||||
ASDisplayNodeAssertTrue(displayNodeLayout->layout.layoutable == self);
|
ASDisplayNodeAssertTrue(displayNodeLayout->layout.layoutElement == self);
|
||||||
ASDisplayNodeAssertTrue(displayNodeLayout->layout.size.width >= 0.0);
|
ASDisplayNodeAssertTrue(displayNodeLayout->layout.size.width >= 0.0);
|
||||||
ASDisplayNodeAssertTrue(displayNodeLayout->layout.size.height >= 0.0);
|
ASDisplayNodeAssertTrue(displayNodeLayout->layout.size.height >= 0.0);
|
||||||
|
|
||||||
@@ -2933,7 +2933,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
// Leaving layout pending state, reset related properties
|
// Leaving layout pending state, reset related properties
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
_pendingTransitionID = ASLayoutableContextInvalidTransitionID;
|
_pendingTransitionID = ASLayoutElementContextInvalidTransitionID;
|
||||||
_pendingLayoutTransition = nil;
|
_pendingLayoutTransition = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2977,7 +2977,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
- (void)__layoutSublayouts
|
- (void)__layoutSublayouts
|
||||||
{
|
{
|
||||||
for (ASLayout *subnodeLayout in _calculatedDisplayNodeLayout->layout.sublayouts) {
|
for (ASLayout *subnodeLayout in _calculatedDisplayNodeLayout->layout.sublayouts) {
|
||||||
((ASDisplayNode *)subnodeLayout.layoutable).frame = subnodeLayout.frame;
|
((ASDisplayNode *)subnodeLayout.layoutElement).frame = subnodeLayout.frame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3267,7 +3267,7 @@ static const char *ASDisplayNodeDrawingPriorityKey = "ASDrawingPriority";
|
|||||||
_flags.isInHierarchy = inHierarchy;
|
_flags.isInHierarchy = inHierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<ASLayoutable>)finalLayoutable
|
- (id<ASLayoutElement>)finalLayoutElement
|
||||||
{
|
{
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -3525,7 +3525,7 @@ ASEnvironmentLayoutExtensibilityForwarding
|
|||||||
return subtree;
|
return subtree;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - ASLayoutableAsciiArtProtocol
|
#pragma mark - ASLayoutElementAsciiArtProtocol
|
||||||
|
|
||||||
- (NSString *)asciiArtString
|
- (NSString *)asciiArtString
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -705,6 +705,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
|||||||
ASDisplayNodeAssert(NO, @"Infinite width or height in ASVideoPlayerNode");
|
ASDisplayNodeAssert(NO, @"Infinite width or height in ASVideoPlayerNode");
|
||||||
maxSize = CGSizeZero;
|
maxSize = CGSizeZero;
|
||||||
}
|
}
|
||||||
|
|
||||||
[_videoNode.style setSizeWithCGSize:maxSize];
|
[_videoNode.style setSizeWithCGSize:maxSize];
|
||||||
|
|
||||||
ASLayoutSpec *layoutSpec;
|
ASLayoutSpec *layoutSpec;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#import <AsyncDisplayKit/ASLayout.h>
|
#import <AsyncDisplayKit/ASLayout.h>
|
||||||
#import <AsyncDisplayKit/ASDimension.h>
|
#import <AsyncDisplayKit/ASDimension.h>
|
||||||
#import <AsyncDisplayKit/ASEnvironment.h>
|
#import <AsyncDisplayKit/ASEnvironment.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutElement.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
#import <AsyncDisplayKit/ASBackgroundLayoutSpec.h>
|
#import <AsyncDisplayKit/ASBackgroundLayoutSpec.h>
|
||||||
#import <AsyncDisplayKit/ASCenterLayoutSpec.h>
|
#import <AsyncDisplayKit/ASCenterLayoutSpec.h>
|
||||||
|
|||||||
@@ -38,21 +38,21 @@
|
|||||||
{
|
{
|
||||||
// TODO: layout: isValidForLayout() call should not be necessary if INFINITY is used
|
// TODO: layout: isValidForLayout() call should not be necessary if INFINITY is used
|
||||||
CGSize size = {
|
CGSize size = {
|
||||||
(isinf(constrainedSize.max.width) || !ASPointsAreValidForLayout(constrainedSize.max.width)) ? ASLayoutableParentDimensionUndefined : constrainedSize.max.width,
|
(isinf(constrainedSize.max.width) || !ASPointsAreValidForLayout(constrainedSize.max.width)) ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.width,
|
||||||
(isinf(constrainedSize.max.height) || !ASPointsAreValidForLayout(constrainedSize.max.height)) ? ASLayoutableParentDimensionUndefined : constrainedSize.max.height
|
(isinf(constrainedSize.max.height) || !ASPointsAreValidForLayout(constrainedSize.max.height)) ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.height
|
||||||
};
|
};
|
||||||
|
|
||||||
NSArray *children = self.children;
|
NSArray *children = self.children;
|
||||||
NSMutableArray *sublayouts = [NSMutableArray arrayWithCapacity:children.count];
|
NSMutableArray *sublayouts = [NSMutableArray arrayWithCapacity:children.count];
|
||||||
|
|
||||||
for (id<ASLayoutable> child in children) {
|
for (id<ASLayoutElement> child in children) {
|
||||||
CGPoint layoutPosition = child.style.layoutPosition;
|
CGPoint layoutPosition = child.style.layoutPosition;
|
||||||
CGSize autoMaxSize = {
|
CGSize autoMaxSize = {
|
||||||
constrainedSize.max.width - layoutPosition.x,
|
constrainedSize.max.width - layoutPosition.x,
|
||||||
constrainedSize.max.height - layoutPosition.y
|
constrainedSize.max.height - layoutPosition.y
|
||||||
};
|
};
|
||||||
|
|
||||||
const ASSizeRange childConstraint = ASLayoutableSizeResolveAutoSize(child.style.size, size, {{0,0}, autoMaxSize});
|
const ASSizeRange childConstraint = ASLayoutElementSizeResolveAutoSize(child.style.size, size, {{0,0}, autoMaxSize});
|
||||||
|
|
||||||
ASLayout *sublayout = [child layoutThatFits:childConstraint parentSize:size];
|
ASLayout *sublayout = [child layoutThatFits:childConstraint parentSize:size];
|
||||||
sublayout.position = layoutPosition;
|
sublayout.position = layoutPosition;
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [ASLayout layoutWithLayoutable:self size:ASSizeRangeClamp(constrainedSize, size) sublayouts:sublayouts];
|
return [ASLayout layoutWithLayoutElement:self size:ASSizeRangeClamp(constrainedSize, size) sublayouts:sublayouts];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
@implementation ASAbsoluteLayoutSpec (Debugging)
|
@implementation ASAbsoluteLayoutSpec (Debugging)
|
||||||
|
|
||||||
#pragma mark - ASLayoutableAsciiArtProtocol
|
#pragma mark - ASLayoutElementAsciiArtProtocol
|
||||||
|
|
||||||
- (NSString *)debugBoxString
|
- (NSString *)debugBoxString
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout options that can be defined for an ASLayoutable being added to a ASAbsoluteLayoutSpec.
|
* Layout options that can be defined for an ASLayoutElement being added to a ASAbsoluteLayoutSpec.
|
||||||
*/
|
*/
|
||||||
@protocol ASAbsoluteLayoutable
|
@protocol ASAbsoluteLayoutable
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@protocol ASLayoutableAsciiArtProtocol <NSObject>
|
@protocol ASLayoutElementAsciiArtProtocol <NSObject>
|
||||||
/**
|
/**
|
||||||
* Returns an ascii-art representation of this object and its children.
|
* Returns an ascii-art representation of this object and its children.
|
||||||
* For example, an ASInsetSpec may return something like this:
|
* For example, an ASInsetSpec may return something like this:
|
||||||
|
|||||||
@@ -13,22 +13,22 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Lays out a single layoutable child, then lays out a background layoutable instance behind it stretched to its size.
|
Lays out a single layoutElement child, then lays out a background layoutElement instance behind it stretched to its size.
|
||||||
*/
|
*/
|
||||||
@interface ASBackgroundLayoutSpec : ASLayoutSpec
|
@interface ASBackgroundLayoutSpec : ASLayoutSpec
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Background layoutable for this layout spec
|
* Background layoutable for this layout spec
|
||||||
*/
|
*/
|
||||||
@property (nullable, nonatomic, strong) id<ASLayoutable> background;
|
@property (nullable, nonatomic, strong) id<ASLayoutElement> background;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns an ASBackgroundLayoutSpec object
|
* Creates and returns an ASBackgroundLayoutSpec object
|
||||||
*
|
*
|
||||||
* @param child A child that is laid out to determine the size of this spec.
|
* @param child A child that is laid out to determine the size of this spec.
|
||||||
* @param background A layoutable object that is laid out behind the child. If this is nil, the background is omitted.
|
* @param background A layoutElement object that is laid out behind the child. If this is nil, the background is omitted.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutable>)child background:(nullable id<ASLayoutable>)background;
|
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutElement>)child background:(nullable id<ASLayoutElement>)background;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ static NSUInteger const kBackgroundChildIndex = 1;
|
|||||||
|
|
||||||
#pragma mark - Class
|
#pragma mark - Class
|
||||||
|
|
||||||
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutable>)child background:(id<ASLayoutable>)background;
|
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutElement>)child background:(id<ASLayoutElement>)background;
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithChild:child background:background];
|
return [[self alloc] initWithChild:child background:background];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
|
|
||||||
- (instancetype)initWithChild:(id<ASLayoutable>)child background:(id<ASLayoutable>)background
|
- (instancetype)initWithChild:(id<ASLayoutElement>)child background:(id<ASLayoutElement>)background
|
||||||
{
|
{
|
||||||
if (!(self = [super init])) {
|
if (!(self = [super init])) {
|
||||||
return nil;
|
return nil;
|
||||||
@@ -46,7 +46,7 @@ static NSUInteger const kBackgroundChildIndex = 1;
|
|||||||
* First layout the contents, then fit the background image.
|
* First layout the contents, then fit the background image.
|
||||||
*/
|
*/
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
restrictedToSize:(ASLayoutableSize)size
|
restrictedToSize:(ASLayoutElementSize)size
|
||||||
relativeToParentSize:(CGSize)parentSize
|
relativeToParentSize:(CGSize)parentSize
|
||||||
{
|
{
|
||||||
ASLayout *contentsLayout = [[super childAtIndex:kForegroundChildIndex] layoutThatFits:constrainedSize parentSize:parentSize];
|
ASLayout *contentsLayout = [[super childAtIndex:kForegroundChildIndex] layoutThatFits:constrainedSize parentSize:parentSize];
|
||||||
@@ -62,17 +62,17 @@ static NSUInteger const kBackgroundChildIndex = 1;
|
|||||||
contentsLayout.position = CGPointZero;
|
contentsLayout.position = CGPointZero;
|
||||||
[sublayouts addObject:contentsLayout];
|
[sublayouts addObject:contentsLayout];
|
||||||
|
|
||||||
return [ASLayout layoutWithLayoutable:self size:contentsLayout.size sublayouts:sublayouts];
|
return [ASLayout layoutWithLayoutElement:self size:contentsLayout.size sublayouts:sublayouts];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Background
|
#pragma mark - Background
|
||||||
|
|
||||||
- (void)setBackground:(id<ASLayoutable>)background
|
- (void)setBackground:(id<ASLayoutElement>)background
|
||||||
{
|
{
|
||||||
[super setChild:background atIndex:kBackgroundChildIndex];
|
[super setChild:background atIndex:kBackgroundChildIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<ASLayoutable>)background
|
- (id<ASLayoutElement>)background
|
||||||
{
|
{
|
||||||
return [super childAtIndex:kBackgroundChildIndex];
|
return [super childAtIndex:kBackgroundChildIndex];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/** Lays out a single layoutable child and position it so that it is centered into the layout bounds.
|
/** Lays out a single layoutElement child and position it so that it is centered into the layout bounds.
|
||||||
* NOTE: ASRelativeLayoutSpec offers all of the capabilities of Center, and more.
|
* NOTE: ASRelativeLayoutSpec offers all of the capabilities of Center, and more.
|
||||||
* Check it out if you would like to be able to position the child at any corner or the middle of an edge.
|
* Check it out if you would like to be able to position the child at any corner or the middle of an edge.
|
||||||
*/
|
*/
|
||||||
@@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*/
|
*/
|
||||||
+ (instancetype)centerLayoutSpecWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
|
+ (instancetype)centerLayoutSpecWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
|
||||||
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
|
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
|
||||||
child:(id<ASLayoutable>)child;
|
child:(id<ASLayoutElement>)child;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
- (instancetype)initWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
|
- (instancetype)initWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
|
||||||
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
|
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
|
||||||
child:(id<ASLayoutable>)child;
|
child:(id<ASLayoutElement>)child;
|
||||||
{
|
{
|
||||||
ASRelativeLayoutSpecPosition verticalPosition = [self verticalPositionFromCenteringOptions:centeringOptions];
|
ASRelativeLayoutSpecPosition verticalPosition = [self verticalPositionFromCenteringOptions:centeringOptions];
|
||||||
ASRelativeLayoutSpecPosition horizontalPosition = [self horizontalPositionFromCenteringOptions:centeringOptions];
|
ASRelativeLayoutSpecPosition horizontalPosition = [self horizontalPositionFromCenteringOptions:centeringOptions];
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
+ (instancetype)centerLayoutSpecWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
|
+ (instancetype)centerLayoutSpecWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
|
||||||
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
|
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
|
||||||
child:(id<ASLayoutable>)child
|
child:(id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithCenteringOptions:centeringOptions sizingOptions:sizingOptions child:child];
|
return [[self alloc] initWithCenteringOptions:centeringOptions sizingOptions:sizingOptions child:child];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,15 +56,15 @@ typedef struct {
|
|||||||
} ASSizeRange;
|
} ASSizeRange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A struct specifying a ASLayoutable's size. Example:
|
* A struct specifying a ASLayoutElement's size. Example:
|
||||||
*
|
*
|
||||||
* ASLayoutableSize size = (ASLayoutableSize){
|
* ASLayoutElementSize size = (ASLayoutElementSize){
|
||||||
* .width = ASDimensionMakeWithFraction(0.25),
|
* .width = ASDimensionMakeWithFraction(0.25),
|
||||||
* .maxWidth = ASDimensionMakeWithPoints(200),
|
* .maxWidth = ASDimensionMakeWithPoints(200),
|
||||||
* .minHeight = ASDimensionMakeWithFraction(0.50)
|
* .minHeight = ASDimensionMakeWithFraction(0.50)
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* Description: <ASLayoutableSize: exact={25%, Auto}, min={Auto, 50%}, max={200pt, Auto}>
|
* Description: <ASLayoutElementSize: exact={25%, Auto}, min={Auto, 50%}, max={200pt, Auto}>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -74,7 +74,7 @@ typedef struct {
|
|||||||
ASDimension maxWidth;
|
ASDimension maxWidth;
|
||||||
ASDimension minHeight;
|
ASDimension minHeight;
|
||||||
ASDimension maxHeight;
|
ASDimension maxHeight;
|
||||||
} ASLayoutableSize;
|
} ASLayoutElementSize;
|
||||||
|
|
||||||
extern ASDimension const ASDimensionAuto;
|
extern ASDimension const ASDimensionAuto;
|
||||||
|
|
||||||
@@ -230,14 +230,14 @@ ASDISPLAYNODE_INLINE BOOL ASSizeRangeEqualToSizeRange(ASSizeRange lhs, ASSizeRan
|
|||||||
extern NSString *NSStringFromASSizeRange(ASSizeRange sizeRange);
|
extern NSString *NSStringFromASSizeRange(ASSizeRange sizeRange);
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - ASLayoutableSize
|
#pragma mark - ASLayoutElementSize
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an ASLayoutableSize with default values.
|
* Returns an ASLayoutElementSize with default values.
|
||||||
*/
|
*/
|
||||||
ASDISPLAYNODE_INLINE ASLayoutableSize ASLayoutableSizeMake()
|
ASDISPLAYNODE_INLINE ASLayoutElementSize ASLayoutElementSizeMake()
|
||||||
{
|
{
|
||||||
return (ASLayoutableSize){
|
return (ASLayoutElementSize){
|
||||||
.width = ASDimensionAuto,
|
.width = ASDimensionAuto,
|
||||||
.height = ASDimensionAuto,
|
.height = ASDimensionAuto,
|
||||||
.minWidth = ASDimensionAuto,
|
.minWidth = ASDimensionAuto,
|
||||||
@@ -248,11 +248,11 @@ ASDISPLAYNODE_INLINE ASLayoutableSize ASLayoutableSizeMake()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an ASLayoutableSize with the specified CGSize values as width and height.
|
* Returns an ASLayoutElementSize with the specified CGSize values as width and height.
|
||||||
*/
|
*/
|
||||||
ASDISPLAYNODE_INLINE ASLayoutableSize ASLayoutableSizeMakeFromCGSize(CGSize size)
|
ASDISPLAYNODE_INLINE ASLayoutElementSize ASLayoutElementSizeMakeFromCGSize(CGSize size)
|
||||||
{
|
{
|
||||||
ASLayoutableSize s = ASLayoutableSizeMake();
|
ASLayoutElementSize s = ASLayoutElementSizeMake();
|
||||||
s.width = ASDimensionMakeWithPoints(size.width);
|
s.width = ASDimensionMakeWithPoints(size.width);
|
||||||
s.height = ASDimensionMakeWithPoints(size.height);
|
s.height = ASDimensionMakeWithPoints(size.height);
|
||||||
return s;
|
return s;
|
||||||
@@ -261,7 +261,7 @@ ASDISPLAYNODE_INLINE ASLayoutableSize ASLayoutableSizeMakeFromCGSize(CGSize size
|
|||||||
/**
|
/**
|
||||||
* Returns whether two sizes are equal.
|
* Returns whether two sizes are equal.
|
||||||
*/
|
*/
|
||||||
ASDISPLAYNODE_INLINE BOOL ASLayoutableSizeEqualToLayoutableSize(ASLayoutableSize lhs, ASLayoutableSize rhs)
|
ASDISPLAYNODE_INLINE BOOL ASLayoutElementSizeEqualToLayoutElementSize(ASLayoutElementSize lhs, ASLayoutElementSize rhs)
|
||||||
{
|
{
|
||||||
return (ASDimensionEqualToDimension(lhs.width, rhs.width)
|
return (ASDimensionEqualToDimension(lhs.width, rhs.width)
|
||||||
&& ASDimensionEqualToDimension(lhs.height, rhs.height)
|
&& ASDimensionEqualToDimension(lhs.height, rhs.height)
|
||||||
@@ -272,9 +272,9 @@ ASDISPLAYNODE_INLINE BOOL ASLayoutableSizeEqualToLayoutableSize(ASLayoutableSize
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string formatted to contain the data from an ASLayoutableSize.
|
* Returns a string formatted to contain the data from an ASLayoutElementSize.
|
||||||
*/
|
*/
|
||||||
extern NSString *NSStringFromASLayoutableSize(ASLayoutableSize size);
|
extern NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the given size relative to a parent size and an auto size.
|
* Resolve the given size relative to a parent size and an auto size.
|
||||||
@@ -283,15 +283,15 @@ extern NSString *NSStringFromASLayoutableSize(ASLayoutableSize size);
|
|||||||
* dimension with unit ASDimensionUnitAuto the given autoASSizeRange value will be used.
|
* dimension with unit ASDimensionUnitAuto the given autoASSizeRange value will be used.
|
||||||
* Based on the calculated exact, min and max size constraints the final size range will be calculated.
|
* Based on the calculated exact, min and max size constraints the final size range will be calculated.
|
||||||
*/
|
*/
|
||||||
extern ASSizeRange ASLayoutableSizeResolveAutoSize(ASLayoutableSize size, const CGSize parentSize, ASSizeRange autoASSizeRange);
|
extern ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the given size to a parent size. Uses internally ASLayoutableSizeResolveAutoSize with {INFINITY, INFINITY} as
|
* Resolve the given size to a parent size. Uses internally ASLayoutElementSizeResolveAutoSize with {INFINITY, INFINITY} as
|
||||||
* as autoASSizeRange. For more information look at ASLayoutableSizeResolveAutoSize.
|
* as autoASSizeRange. For more information look at ASLayoutElementSizeResolveAutoSize.
|
||||||
*/
|
*/
|
||||||
ASDISPLAYNODE_INLINE ASSizeRange ASLayoutableSizeResolve(ASLayoutableSize size, const CGSize parentSize)
|
ASDISPLAYNODE_INLINE ASSizeRange ASLayoutElementSizeResolve(ASLayoutElementSize size, const CGSize parentSize)
|
||||||
{
|
{
|
||||||
return ASLayoutableSizeResolveAutoSize(size, parentSize, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY)));
|
return ASLayoutElementSizeResolveAutoSize(size, parentSize, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -111,18 +111,18 @@ ASDISPLAYNODE_INLINE NSString *NSStringFromASRelativeSize(ASRelativeSize size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - ASLayoutableSize
|
#pragma mark - ASLayoutElementSize
|
||||||
|
|
||||||
NSString *NSStringFromASLayoutableSize(ASLayoutableSize size)
|
NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size)
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:
|
return [NSString stringWithFormat:
|
||||||
@"<ASLayoutableSize: exact=%@, min=%@, max=%@>",
|
@"<ASLayoutElementSize: exact=%@, min=%@, max=%@>",
|
||||||
NSStringFromASRelativeSize(ASRelativeSizeMake(size.width, size.height)),
|
NSStringFromASRelativeSize(ASRelativeSizeMake(size.width, size.height)),
|
||||||
NSStringFromASRelativeSize(ASRelativeSizeMake(size.minWidth, size.minHeight)),
|
NSStringFromASRelativeSize(ASRelativeSizeMake(size.minWidth, size.minHeight)),
|
||||||
NSStringFromASRelativeSize(ASRelativeSizeMake(size.maxWidth, size.maxHeight))];
|
NSStringFromASRelativeSize(ASRelativeSizeMake(size.maxWidth, size.maxHeight))];
|
||||||
}
|
}
|
||||||
|
|
||||||
ASDISPLAYNODE_INLINE void ASLayoutableSizeConstrain(CGFloat minVal, CGFloat exactVal, CGFloat maxVal, CGFloat *outMin, CGFloat *outMax)
|
ASDISPLAYNODE_INLINE void ASLayoutElementSizeConstrain(CGFloat minVal, CGFloat exactVal, CGFloat maxVal, CGFloat *outMin, CGFloat *outMax)
|
||||||
{
|
{
|
||||||
NSCAssert(!isnan(minVal), @"minVal must not be NaN");
|
NSCAssert(!isnan(minVal), @"minVal must not be NaN");
|
||||||
NSCAssert(!isnan(maxVal), @"maxVal must not be NaN");
|
NSCAssert(!isnan(maxVal), @"maxVal must not be NaN");
|
||||||
@@ -154,15 +154,15 @@ ASDISPLAYNODE_INLINE void ASLayoutableSizeConstrain(CGFloat minVal, CGFloat exac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSizeRange ASLayoutableSizeResolveAutoSize(ASLayoutableSize size, const CGSize parentSize, ASSizeRange autoASSizeRange)
|
ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange)
|
||||||
{
|
{
|
||||||
CGSize resolvedExact = ASRelativeSizeResolveSize(ASRelativeSizeMake(size.width, size.height), parentSize, {NAN, NAN});
|
CGSize resolvedExact = ASRelativeSizeResolveSize(ASRelativeSizeMake(size.width, size.height), parentSize, {NAN, NAN});
|
||||||
CGSize resolvedMin = ASRelativeSizeResolveSize(ASRelativeSizeMake(size.minWidth, size.minHeight), parentSize, autoASSizeRange.min);
|
CGSize resolvedMin = ASRelativeSizeResolveSize(ASRelativeSizeMake(size.minWidth, size.minHeight), parentSize, autoASSizeRange.min);
|
||||||
CGSize resolvedMax = ASRelativeSizeResolveSize(ASRelativeSizeMake(size.maxWidth, size.maxHeight), parentSize, autoASSizeRange.max);
|
CGSize resolvedMax = ASRelativeSizeResolveSize(ASRelativeSizeMake(size.maxWidth, size.maxHeight), parentSize, autoASSizeRange.max);
|
||||||
|
|
||||||
CGSize rangeMin, rangeMax;
|
CGSize rangeMin, rangeMax;
|
||||||
ASLayoutableSizeConstrain(resolvedMin.width, resolvedExact.width, resolvedMax.width, &rangeMin.width, &rangeMax.width);
|
ASLayoutElementSizeConstrain(resolvedMin.width, resolvedExact.width, resolvedMax.width, &rangeMin.width, &rangeMax.width);
|
||||||
ASLayoutableSizeConstrain(resolvedMin.height, resolvedExact.height, resolvedMax.height, &rangeMin.height, &rangeMax.height);
|
ASLayoutElementSizeConstrain(resolvedMin.height, resolvedExact.height, resolvedMax.height, &rangeMin.height, &rangeMax.height);
|
||||||
return {rangeMin, rangeMax};
|
return {rangeMin, rangeMax};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A layout spec that wraps another layoutable child, applying insets around it.
|
A layout spec that wraps another layoutElement child, applying insets around it.
|
||||||
|
|
||||||
If the child has a size specified as a fraction, the fraction is resolved against this spec's parent
|
If the child has a size specified as a fraction, the fraction is resolved against this spec's parent
|
||||||
size **after** applying insets.
|
size **after** applying insets.
|
||||||
@@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@param insets The amount of space to inset on each side.
|
@param insets The amount of space to inset on each side.
|
||||||
@param child The wrapped child to inset.
|
@param child The wrapped child to inset.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutable>)child;
|
+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutElement>)child;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner)
|
|||||||
|
|
||||||
@implementation ASInsetLayoutSpec
|
@implementation ASInsetLayoutSpec
|
||||||
|
|
||||||
- (instancetype)initWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutable>)child;
|
- (instancetype)initWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutElement>)child;
|
||||||
{
|
{
|
||||||
if (!(self = [super init])) {
|
if (!(self = [super init])) {
|
||||||
return nil;
|
return nil;
|
||||||
@@ -52,7 +52,7 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner)
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutable>)child
|
+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithInsets:insets child:child];
|
return [[self alloc] initWithInsets:insets child:child];
|
||||||
}
|
}
|
||||||
@@ -68,12 +68,12 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner)
|
|||||||
the child to respect the inset.
|
the child to respect the inset.
|
||||||
*/
|
*/
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
restrictedToSize:(ASLayoutableSize)size
|
restrictedToSize:(ASLayoutElementSize)size
|
||||||
relativeToParentSize:(CGSize)parentSize
|
relativeToParentSize:(CGSize)parentSize
|
||||||
{
|
{
|
||||||
if (self.child == nil) {
|
if (self.child == nil) {
|
||||||
ASDisplayNodeAssert(NO, @"Inset spec measured without a child. The spec will do nothing.");
|
ASDisplayNodeAssert(NO, @"Inset spec measured without a child. The spec will do nothing.");
|
||||||
return [ASLayout layoutWithLayoutable:self size:CGSizeZero];
|
return [ASLayout layoutWithLayoutElement:self size:CGSizeZero];
|
||||||
}
|
}
|
||||||
|
|
||||||
const CGFloat insetsX = (finiteOrZero(_insets.left) + finiteOrZero(_insets.right));
|
const CGFloat insetsX = (finiteOrZero(_insets.left) + finiteOrZero(_insets.right));
|
||||||
@@ -118,7 +118,7 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner)
|
|||||||
|
|
||||||
sublayout.position = CGPointMake(x, y);
|
sublayout.position = CGPointMake(x, y);
|
||||||
|
|
||||||
return [ASLayout layoutWithLayoutable:self size:computedSize sublayouts:@[sublayout]];
|
return [ASLayout layoutWithLayoutElement:self size:computedSize sublayouts:@[sublayout]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <AsyncDisplayKit/ASAssert.h>
|
#import <AsyncDisplayKit/ASAssert.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutElement.h>
|
||||||
#import <AsyncDisplayKit/ASDimension.h>
|
#import <AsyncDisplayKit/ASDimension.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@@ -24,11 +24,11 @@ extern CGPoint const CGPointNull;
|
|||||||
extern BOOL CGPointIsNull(CGPoint point);
|
extern BOOL CGPointIsNull(CGPoint point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Safely calculates the layout of the given root layoutable by guarding against nil nodes.
|
* Safely calculates the layout of the given root layoutElement by guarding against nil nodes.
|
||||||
* @param rootLayoutable The root node to calculate the layout for.
|
* @param rootLayoutElement The root node to calculate the layout for.
|
||||||
* @param sizeRange The size range to calculate the root layout within.
|
* @param sizeRange The size range to calculate the root layout within.
|
||||||
*/
|
*/
|
||||||
extern ASLayout *ASCalculateRootLayout(id<ASLayoutable> rootLayoutable, const ASSizeRange sizeRange);
|
extern ASLayout *ASCalculateRootLayout(id<ASLayoutElement> rootLayoutElement, const ASSizeRange sizeRange);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Safely computes the layout of the given node by guarding against nil nodes.
|
* Safely computes the layout of the given node by guarding against nil nodes.
|
||||||
@@ -36,24 +36,24 @@ extern ASLayout *ASCalculateRootLayout(id<ASLayoutable> rootLayoutable, const AS
|
|||||||
* @param sizeRange The size range to calculate the node layout within.
|
* @param sizeRange The size range to calculate the node layout within.
|
||||||
* @param parentSize The parent size of the node to calculate the layout for.
|
* @param parentSize The parent size of the node to calculate the layout for.
|
||||||
*/
|
*/
|
||||||
extern ASLayout *ASCalculateLayout(id<ASLayoutable> layoutable, const ASSizeRange sizeRange, const CGSize parentSize);
|
extern ASLayout *ASCalculateLayout(id<ASLayoutElement> layoutElement, const ASSizeRange sizeRange, const CGSize parentSize);
|
||||||
|
|
||||||
ASDISPLAYNODE_EXTERN_C_END
|
ASDISPLAYNODE_EXTERN_C_END
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A node in the layout tree that represents the size and position of the object that created it (ASLayoutable).
|
* A node in the layout tree that represents the size and position of the object that created it (ASLayoutElement).
|
||||||
*/
|
*/
|
||||||
@interface ASLayout : NSObject
|
@interface ASLayout : NSObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The underlying object described by this layout
|
* The underlying object described by this layout
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, weak, readonly) id<ASLayoutable> layoutable;
|
@property (nonatomic, weak, readonly) id<ASLayoutElement> layoutElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of ASLayoutable that created this layout
|
* The type of ASLayoutElement that created this layout
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readonly) ASLayoutableType type;
|
@property (nonatomic, assign, readonly) ASLayoutElementType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of the current layout
|
* Size of the current layout
|
||||||
@@ -81,7 +81,7 @@ ASDISPLAYNODE_EXTERN_C_END
|
|||||||
/**
|
/**
|
||||||
* Designated initializer
|
* Designated initializer
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithLayoutable:(id<ASLayoutable>)layoutable
|
- (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
position:(CGPoint)position
|
position:(CGPoint)position
|
||||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts NS_DESIGNATED_INITIALIZER;
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts NS_DESIGNATED_INITIALIZER;
|
||||||
@@ -89,12 +89,12 @@ ASDISPLAYNODE_EXTERN_C_END
|
|||||||
/**
|
/**
|
||||||
* Convenience class initializer for layout construction.
|
* Convenience class initializer for layout construction.
|
||||||
*
|
*
|
||||||
* @param layoutable The backing ASLayoutable object.
|
* @param layoutElement The backing ASLayoutElement object.
|
||||||
* @param size The size of this layout.
|
* @param size The size of this layout.
|
||||||
* @param position The position of this layout within its parent (if available).
|
* @param position The position of this layout within its parent (if available).
|
||||||
* @param sublayouts Sublayouts belong to the new layout.
|
* @param sublayouts Sublayouts belong to the new layout.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)layoutWithLayoutable:(id<ASLayoutable>)layoutable
|
+ (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
position:(CGPoint)position
|
position:(CGPoint)position
|
||||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
||||||
@@ -105,11 +105,11 @@ ASDISPLAYNODE_EXTERN_C_END
|
|||||||
* or for ASLayoutSpec subclasses that are referencing the "self" level in the layout tree,
|
* or for ASLayoutSpec subclasses that are referencing the "self" level in the layout tree,
|
||||||
* or for creating a sublayout of which the position is yet to be determined.
|
* or for creating a sublayout of which the position is yet to be determined.
|
||||||
*
|
*
|
||||||
* @param layoutable The backing ASLayoutable object.
|
* @param layoutElement The backing ASLayoutElement object.
|
||||||
* @param size The size of this layout.
|
* @param size The size of this layout.
|
||||||
* @param sublayouts Sublayouts belong to the new layout.
|
* @param sublayouts Sublayouts belong to the new layout.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)layoutWithLayoutable:(id<ASLayoutable>)layoutable
|
+ (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
||||||
|
|
||||||
@@ -118,10 +118,10 @@ ASDISPLAYNODE_EXTERN_C_END
|
|||||||
* Best used for creating a layout that has no sublayouts, and is either a root one
|
* Best used for creating a layout that has no sublayouts, and is either a root one
|
||||||
* or a sublayout of which the position is yet to be determined.
|
* or a sublayout of which the position is yet to be determined.
|
||||||
*
|
*
|
||||||
* @param layoutable The backing ASLayoutable object.
|
* @param layoutElement The backing ASLayoutElement object.
|
||||||
* @param size The size of this layout.
|
* @param size The size of this layout.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)layoutWithLayoutable:(id<ASLayoutable>)layoutable
|
+ (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
size:(CGSize)size;
|
size:(CGSize)size;
|
||||||
/**
|
/**
|
||||||
* Convenience initializer that creates a layout based on the values of the given layout, with a new position
|
* Convenience initializer that creates a layout based on the values of the given layout, with a new position
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
|
|
||||||
@dynamic frame, type;
|
@dynamic frame, type;
|
||||||
|
|
||||||
- (instancetype)initWithLayoutable:(id<ASLayoutable>)layoutable
|
- (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
position:(CGPoint)position
|
position:(CGPoint)position
|
||||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts
|
||||||
{
|
{
|
||||||
NSParameterAssert(layoutable);
|
NSParameterAssert(layoutElement);
|
||||||
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
@@ -67,10 +67,10 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_layoutable = layoutable;
|
_layoutElement = layoutElement;
|
||||||
|
|
||||||
if (!ASIsCGSizeValidForLayout(size)) {
|
if (!ASIsCGSizeValidForLayout(size)) {
|
||||||
ASDisplayNodeAssert(NO, @"layoutSize is invalid and unsafe to provide to Core Animation! Release configurations will force to 0, 0. Size = %@, node = %@", NSStringFromCGSize(size), layoutable);
|
ASDisplayNodeAssert(NO, @"layoutSize is invalid and unsafe to provide to Core Animation! Release configurations will force to 0, 0. Size = %@, node = %@", NSStringFromCGSize(size), layoutElement);
|
||||||
size = CGSizeZero;
|
size = CGSizeZero;
|
||||||
} else {
|
} else {
|
||||||
size = CGSizeMake(ASCeilPixelValue(size.width), ASCeilPixelValue(size.height));
|
size = CGSizeMake(ASCeilPixelValue(size.width), ASCeilPixelValue(size.height));
|
||||||
@@ -97,30 +97,30 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
|
|
||||||
#pragma mark - Class Constructors
|
#pragma mark - Class Constructors
|
||||||
|
|
||||||
+ (instancetype)layoutWithLayoutable:(id<ASLayoutable>)layoutable
|
+ (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
position:(CGPoint)position
|
position:(CGPoint)position
|
||||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithLayoutable:layoutable
|
return [[self alloc] initWithLayoutElement:layoutElement
|
||||||
size:size
|
size:size
|
||||||
position:position
|
position:position
|
||||||
sublayouts:sublayouts];
|
sublayouts:sublayouts];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)layoutWithLayoutable:(id<ASLayoutable>)layoutable
|
+ (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts
|
||||||
{
|
{
|
||||||
return [self layoutWithLayoutable:layoutable
|
return [self layoutWithLayoutElement:layoutElement
|
||||||
size:size
|
size:size
|
||||||
position:CGPointNull
|
position:CGPointNull
|
||||||
sublayouts:sublayouts];
|
sublayouts:sublayouts];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)layoutWithLayoutable:(id<ASLayoutable>)layoutable size:(CGSize)size
|
+ (instancetype)layoutWithLayoutElement:(id<ASLayoutElement>)layoutElement size:(CGSize)size
|
||||||
{
|
{
|
||||||
return [self layoutWithLayoutable:layoutable
|
return [self layoutWithLayoutElement:layoutElement
|
||||||
size:size
|
size:size
|
||||||
position:CGPointNull
|
position:CGPointNull
|
||||||
sublayouts:nil];
|
sublayouts:nil];
|
||||||
@@ -128,7 +128,7 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
|
|
||||||
+ (instancetype)layoutWithLayout:(ASLayout *)layout position:(CGPoint)position
|
+ (instancetype)layoutWithLayout:(ASLayout *)layout position:(CGPoint)position
|
||||||
{
|
{
|
||||||
return [self layoutWithLayoutable:layout.layoutable
|
return [self layoutWithLayoutElement:layout.layoutElement
|
||||||
size:layout.size
|
size:layout.size
|
||||||
position:position
|
position:position
|
||||||
sublayouts:layout.sublayouts];
|
sublayouts:layout.sublayouts];
|
||||||
@@ -153,7 +153,7 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
Context context = queue.front();
|
Context context = queue.front();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
|
|
||||||
if (self != context.layout && context.layout.type == ASLayoutableTypeDisplayNode) {
|
if (self != context.layout && context.layout.type == ASLayoutElementTypeDisplayNode) {
|
||||||
ASLayout *layout = [ASLayout layoutWithLayout:context.layout position:context.absolutePosition];
|
ASLayout *layout = [ASLayout layoutWithLayout:context.layout position:context.absolutePosition];
|
||||||
layout.flattened = YES;
|
layout.flattened = YES;
|
||||||
[flattenedSublayouts addObject:layout];
|
[flattenedSublayouts addObject:layout];
|
||||||
@@ -166,14 +166,14 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [ASLayout layoutWithLayoutable:_layoutable size:_size sublayouts:flattenedSublayouts];
|
return [ASLayout layoutWithLayoutElement:_layoutElement size:_size sublayouts:flattenedSublayouts];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Accessors
|
#pragma mark - Accessors
|
||||||
|
|
||||||
- (ASLayoutableType)type
|
- (ASLayoutElementType)type
|
||||||
{
|
{
|
||||||
return _layoutable.layoutableType;
|
return _layoutElement.layoutElementType;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGRect)frame
|
- (CGRect)frame
|
||||||
@@ -209,7 +209,7 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
- (NSMutableArray <NSDictionary *> *)propertiesForDescription
|
- (NSMutableArray <NSDictionary *> *)propertiesForDescription
|
||||||
{
|
{
|
||||||
NSMutableArray *result = [NSMutableArray array];
|
NSMutableArray *result = [NSMutableArray array];
|
||||||
[result addObject:@{ @"layoutable" : (self.layoutable ?: (id)kCFNull) }];
|
[result addObject:@{ @"layoutElement" : (self.layoutElement ?: (id)kCFNull) }];
|
||||||
[result addObject:@{ @"position" : [NSValue valueWithCGPoint:self.position] }];
|
[result addObject:@{ @"position" : [NSValue valueWithCGPoint:self.position] }];
|
||||||
[result addObject:@{ @"size" : [NSValue valueWithCGSize:self.size] }];
|
[result addObject:@{ @"size" : [NSValue valueWithCGSize:self.size] }];
|
||||||
return result;
|
return result;
|
||||||
@@ -239,16 +239,16 @@ static inline NSString * descriptionIndents(NSUInteger indents)
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
ASLayout *ASCalculateLayout(id<ASLayoutable> layoutable, const ASSizeRange sizeRange, const CGSize parentSize)
|
ASLayout *ASCalculateLayout(id<ASLayoutElement> layoutElement, const ASSizeRange sizeRange, const CGSize parentSize)
|
||||||
{
|
{
|
||||||
ASDisplayNodeCAssertNotNil(layoutable, @"Not valid layoutable passed in.");
|
ASDisplayNodeCAssertNotNil(layoutElement, @"Not valid layoutElement passed in.");
|
||||||
|
|
||||||
return [layoutable layoutThatFits:sizeRange parentSize:parentSize];
|
return [layoutElement layoutThatFits:sizeRange parentSize:parentSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
ASLayout *ASCalculateRootLayout(id<ASLayoutable> rootLayoutable, const ASSizeRange sizeRange)
|
ASLayout *ASCalculateRootLayout(id<ASLayoutElement> rootLayoutElement, const ASSizeRange sizeRange)
|
||||||
{
|
{
|
||||||
ASLayout *layout = ASCalculateLayout(rootLayoutable, sizeRange, sizeRange.max);
|
ASLayout *layout = ASCalculateLayout(rootLayoutElement, sizeRange, sizeRange.max);
|
||||||
// Here could specific verfication happen
|
// Here could specific verfication happen
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ASLayoutable.h
|
// ASLayoutElement.h
|
||||||
// AsyncDisplayKit
|
// AsyncDisplayKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||||
@@ -12,62 +12,61 @@
|
|||||||
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
||||||
#import <AsyncDisplayKit/ASStackLayoutable.h>
|
#import <AsyncDisplayKit/ASStackLayoutable.h>
|
||||||
#import <AsyncDisplayKit/ASAbsoluteLayoutable.h>
|
#import <AsyncDisplayKit/ASAbsoluteLayoutable.h>
|
||||||
|
#import <AsyncDisplayKit/ASLayoutElementPrivate.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutablePrivate.h>
|
|
||||||
#import <AsyncDisplayKit/ASEnvironment.h>
|
#import <AsyncDisplayKit/ASEnvironment.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutableExtensibility.h>
|
#import <AsyncDisplayKit/ASLayoutElementExtensibility.h>
|
||||||
|
|
||||||
@class ASLayout;
|
@class ASLayout;
|
||||||
@class ASLayoutSpec;
|
@class ASLayoutSpec;
|
||||||
|
|
||||||
/** A constant that indicates that the parent's size is not yet determined in a given dimension. */
|
/** A constant that indicates that the parent's size is not yet determined in a given dimension. */
|
||||||
extern CGFloat const ASLayoutableParentDimensionUndefined;
|
extern CGFloat const ASLayoutElementParentDimensionUndefined;
|
||||||
|
|
||||||
/** A constant that indicates that the parent's size is not yet determined in either dimension. */
|
/** A constant that indicates that the parent's size is not yet determined in either dimension. */
|
||||||
extern CGSize const ASLayoutableParentSizeUndefined;
|
extern CGSize const ASLayoutElementParentSizeUndefined;
|
||||||
|
|
||||||
/** Type of ASLayoutable */
|
/** Type of ASLayoutElement */
|
||||||
typedef NS_ENUM(NSUInteger, ASLayoutableType) {
|
typedef NS_ENUM(NSUInteger, ASLayoutElementType) {
|
||||||
ASLayoutableTypeLayoutSpec,
|
ASLayoutElementTypeLayoutSpec,
|
||||||
ASLayoutableTypeDisplayNode
|
ASLayoutElementTypeDisplayNode
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ASLayoutable protocol declares a method for measuring the layout of an object. A layout
|
* The ASLayoutElement protocol declares a method for measuring the layout of an object. A layout
|
||||||
* is defined by an ASLayout return value, and must specify 1) the size (but not position) of the
|
* is defined by an ASLayout return value, and must specify 1) the size (but not position) of the
|
||||||
* layoutable object, and 2) the size and position of all of its immediate child objects. The tree
|
* layoutElement object, and 2) the size and position of all of its immediate child objects. The tree
|
||||||
* recursion is driven by parents requesting layouts from their children in order to determine their
|
* recursion is driven by parents requesting layouts from their children in order to determine their
|
||||||
* size, followed by the parents setting the position of the children once the size is known
|
* size, followed by the parents setting the position of the children once the size is known
|
||||||
*
|
*
|
||||||
* The protocol also implements a "family" of Layoutable protocols. These protocols contain layout
|
* The protocol also implements a "family" of LayoutElement protocols. These protocols contain layout
|
||||||
* options that can be used for specific layout specs. For example, ASStackLayoutSpec has options
|
* options that can be used for specific layout specs. For example, ASStackLayoutSpec has options
|
||||||
* defining how a layoutable should shrink or grow based upon available space.
|
* defining how a layoutElement should shrink or grow based upon available space.
|
||||||
*
|
*
|
||||||
* These layout options are all stored in an ASLayoutOptions class (that is defined in ASLayoutablePrivate).
|
* These layout options are all stored in an ASLayoutOptions class (that is defined in ASLayoutElementPrivate).
|
||||||
* Generally you needn't worry about the layout options class, as the layoutable protocols allow all direct
|
* Generally you needn't worry about the layout options class, as the layoutElement protocols allow all direct
|
||||||
* access to the options via convenience properties. If you are creating custom layout spec, then you can
|
* access to the options via convenience properties. If you are creating custom layout spec, then you can
|
||||||
* extend the backing layout options class to accommodate any new layout options.
|
* extend the backing layout options class to accommodate any new layout options.
|
||||||
*/
|
*/
|
||||||
@protocol ASLayoutable <ASEnvironment, ASLayoutablePrivate, ASLayoutableExtensibility, NSFastEnumeration>
|
@protocol ASLayoutElement <ASEnvironment, ASLayoutElementPrivate, ASLayoutElementExtensibility, NSFastEnumeration>
|
||||||
|
|
||||||
#pragma mark - Getter
|
#pragma mark - Getter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract Returns type of layoutable
|
* @abstract Returns type of layoutElement
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readonly) ASLayoutableType layoutableType;
|
@property (nonatomic, assign, readonly) ASLayoutElementType layoutElementType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract Returns if the layoutable can be used to layout in an asynchronous way on a background thread.
|
* @abstract Returns if the layoutElement can be used to layout in an asynchronous way on a background thread.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readonly) BOOL canLayoutAsynchronous;
|
@property (nonatomic, assign, readonly) BOOL canLayoutAsynchronous;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract A size constraint that should apply to this ASLayoutable.
|
* @abstract A size constraint that should apply to this ASLayoutElement.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readonly) ASLayoutableStyle *style;
|
@property (nonatomic, assign, readonly) ASLayoutElementStyle *style;
|
||||||
|
|
||||||
#pragma mark - Calculate layout
|
#pragma mark - Calculate layout
|
||||||
|
|
||||||
@@ -89,14 +88,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize;
|
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this on children layoutables to compute their layouts within your implementation of -calculateLayoutThatFits:.
|
* Call this on children layoutElements to compute their layouts within your implementation of -calculateLayoutThatFits:.
|
||||||
*
|
*
|
||||||
* @warning You may not override this method. Override -calculateLayoutThatFits: instead.
|
* @warning You may not override this method. Override -calculateLayoutThatFits: instead.
|
||||||
* @warning In almost all cases, prefer the use of ASCalculateLayout in ASLayout
|
* @warning In almost all cases, prefer the use of ASCalculateLayout in ASLayout
|
||||||
*
|
*
|
||||||
* @param constrainedSize Specifies a minimum and maximum size. The receiver must choose a size that is in this range.
|
* @param constrainedSize Specifies a minimum and maximum size. The receiver must choose a size that is in this range.
|
||||||
* @param parentSize The parent node's size. If the parent component does not have a final size in a given dimension,
|
* @param parentSize The parent node's size. If the parent component does not have a final size in a given dimension,
|
||||||
* then it should be passed as ASLayoutableParentDimensionUndefined (for example, if the parent's width
|
* then it should be passed as ASLayoutElementParentDimensionUndefined (for example, if the parent's width
|
||||||
* depends on the child's size).
|
* depends on the child's size).
|
||||||
*
|
*
|
||||||
* @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the
|
* @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the
|
||||||
@@ -107,7 +106,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize;
|
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this method to compute your layoutable's layout.
|
* Override this method to compute your layoutElement's layout.
|
||||||
*
|
*
|
||||||
* @discussion Why do you need to override -calculateLayoutThatFits: instead of -layoutThatFits:parentSize:?
|
* @discussion Why do you need to override -calculateLayoutThatFits: instead of -layoutThatFits:parentSize:?
|
||||||
* The base implementation of -layoutThatFits:parentSize: does the following for you:
|
* The base implementation of -layoutThatFits:parentSize: does the following for you:
|
||||||
@@ -125,13 +124,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* In certain advanced cases, you may want to override this method. Overriding this method allows you to receive the
|
* In certain advanced cases, you may want to override this method. Overriding this method allows you to receive the
|
||||||
* layoutable's size, parentSize, and constrained size. With these values you could calculate the final constrained size
|
* layoutElement's size, parentSize, and constrained size. With these values you could calculate the final constrained size
|
||||||
* and call -calculateLayoutThatFits: with the result.
|
* and call -calculateLayoutThatFits: with the result.
|
||||||
*
|
*
|
||||||
* @warning Overriding this method should be done VERY rarely.
|
* @warning Overriding this method should be done VERY rarely.
|
||||||
*/
|
*/
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
restrictedToSize:(ASLayoutableSize)size
|
restrictedToSize:(ASLayoutElementSize)size
|
||||||
relativeToParentSize:(CGSize)parentSize;
|
relativeToParentSize:(CGSize)parentSize;
|
||||||
|
|
||||||
|
|
||||||
@@ -150,62 +149,61 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
extern NSString * const ASLayoutElementStyleWidthProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleMinWidthProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleMaxWidthProperty;
|
||||||
|
|
||||||
#pragma mark - ASLayoutableStyle
|
extern NSString * const ASLayoutElementStyleHeightProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleMinHeightProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleMaxHeightProperty;
|
||||||
|
|
||||||
extern NSString * const ASLayoutableStyleWidthProperty;
|
extern NSString * const ASLayoutElementStyleSpacingBeforeProperty;
|
||||||
extern NSString * const ASLayoutableStyleMinWidthProperty;
|
extern NSString * const ASLayoutElementStyleSpacingAfterProperty;
|
||||||
extern NSString * const ASLayoutableStyleMaxWidthProperty;
|
extern NSString * const ASLayoutElementStyleFlexGrowProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleFlexShrinkProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleFlexBasisProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleAlignSelfProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleAscenderProperty;
|
||||||
|
extern NSString * const ASLayoutElementStyleDescenderProperty;
|
||||||
|
|
||||||
extern NSString * const ASLayoutableStyleHeightProperty;
|
extern NSString * const ASLayoutElementStyleLayoutPositionProperty;
|
||||||
extern NSString * const ASLayoutableStyleMinHeightProperty;
|
|
||||||
extern NSString * const ASLayoutableStyleMaxHeightProperty;
|
|
||||||
|
|
||||||
extern NSString * const ASLayoutableStyleSpacingBeforeProperty;
|
#pragma mark - ASLayoutElementStyle
|
||||||
extern NSString * const ASLayoutableStyleSpacingAfterProperty;
|
|
||||||
extern NSString * const ASLayoutableStyleFlexGrowProperty;
|
|
||||||
extern NSString * const ASLayoutableStyleFlexShrinkProperty;
|
|
||||||
extern NSString * const ASLayoutableStyleFlexBasisProperty;
|
|
||||||
extern NSString * const ASLayoutableStyleAlignSelfProperty;
|
|
||||||
extern NSString * const ASLayoutableStyleAscenderProperty;
|
|
||||||
extern NSString * const ASLayoutableStyleDescenderProperty;
|
|
||||||
|
|
||||||
extern NSString * const ASLayoutableStyleLayoutPositionProperty;
|
@protocol ASLayoutElementStyleDelegate <NSObject>
|
||||||
|
- (void)style:(__kindof ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName;
|
||||||
@protocol ASLayoutableStyleDelegate <NSObject>
|
|
||||||
- (void)style:(__kindof ASLayoutableStyle *)style propertyDidChange:(NSString *)propertyName;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface ASLayoutableStyle : NSObject <ASStackLayoutable, ASAbsoluteLayoutable>
|
@interface ASLayoutElementStyle : NSObject <ASStackLayoutable, ASAbsoluteLayoutable>
|
||||||
|
|
||||||
#pragma mark - Delegate
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract Initializes the layoutable style with a specified delegate
|
* @abstract Initializes the layoutable style with a specified delegate
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithDelegate:(id<ASLayoutableStyleDelegate>)delegate;
|
- (instancetype)initWithDelegate:(id<ASLayoutElementStyleDelegate>)delegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract The object that acts as the delegate of the style.
|
* @abstract The object that acts as the delegate of the style.
|
||||||
*
|
*
|
||||||
* @discussion The delegate must adopt the ASLayoutableStyleDelegate protocol. The delegate is not retained.
|
* @discussion The delegate must adopt the ASLayoutElementStyleDelegate protocol. The delegate is not retained.
|
||||||
*/
|
*/
|
||||||
@property (nullable, nonatomic, weak, readonly) id<ASLayoutableStyleDelegate> delegate;
|
@property (nullable, nonatomic, weak, readonly) id<ASLayoutElementStyleDelegate> delegate;
|
||||||
|
|
||||||
|
#pragma mark - Sizing
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract A size constraint that should apply to this ASLayoutable.
|
* @abstract A size constraint that should apply to this ASLayoutElement.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readonly) ASLayoutableSize size;
|
@property (nonatomic, assign, readwrite) ASLayoutElementSize size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract The width property specifies the height of the content area of an ASLayoutable.
|
* @abstract The width property specifies the height of the content area of an ASLayoutElement.
|
||||||
* The minWidth and maxWidth properties override width.
|
* The minWidth and maxWidth properties override width.
|
||||||
* Defaults to ASRelativeDimensionTypeAuto
|
* Defaults to ASRelativeDimensionTypeAuto
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign, readwrite) ASDimension width;
|
@property (nonatomic, assign, readwrite) ASDimension width;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract The height property specifies the height of the content area of an ASLayoutable
|
* @abstract The height property specifies the height of the content area of an ASLayoutElement
|
||||||
* The minHeight and maxHeight properties override height.
|
* The minHeight and maxHeight properties override height.
|
||||||
* Defaults to ASDimensionTypeAuto
|
* Defaults to ASDimensionTypeAuto
|
||||||
*/
|
*/
|
||||||
@@ -305,7 +303,6 @@ extern NSString * const ASLayoutableStyleLayoutPositionProperty;
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) CGFloat descender;
|
@property (nonatomic, assign) CGFloat descender;
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - ASAbsoluteLayoutable
|
#pragma mark - ASAbsoluteLayoutable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
305
AsyncDisplayKit/Layout/ASLayoutElement.mm
Normal file
305
AsyncDisplayKit/Layout/ASLayoutElement.mm
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
//
|
||||||
|
// ASLayoutElement.mm
|
||||||
|
// AsyncDisplayKit
|
||||||
|
//
|
||||||
|
// Created by Huy Nguyen on 3/27/16.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||||
|
// This source code is licensed under the BSD-style license found in the
|
||||||
|
// LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
// of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "ASLayoutElementPrivate.h"
|
||||||
|
#import "ASEnvironmentInternal.h"
|
||||||
|
#import "ASDisplayNodeInternal.h"
|
||||||
|
#import "ASThread.h"
|
||||||
|
|
||||||
|
#import <map>
|
||||||
|
|
||||||
|
CGFloat const ASLayoutElementParentDimensionUndefined = NAN;
|
||||||
|
CGSize const ASLayoutElementParentSizeUndefined = {ASLayoutElementParentDimensionUndefined, ASLayoutElementParentDimensionUndefined};
|
||||||
|
|
||||||
|
int32_t const ASLayoutElementContextInvalidTransitionID = 0;
|
||||||
|
int32_t const ASLayoutElementContextDefaultTransitionID = ASLayoutElementContextInvalidTransitionID + 1;
|
||||||
|
|
||||||
|
static inline ASLayoutElementContext _ASLayoutElementContextMake(int32_t transitionID, BOOL needsVisualizeNode)
|
||||||
|
{
|
||||||
|
struct ASLayoutElementContext context;
|
||||||
|
context.transitionID = transitionID;
|
||||||
|
context.needsVisualizeNode = needsVisualizeNode;
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline BOOL _IsValidTransitionID(int32_t transitionID)
|
||||||
|
{
|
||||||
|
return transitionID > ASLayoutElementContextInvalidTransitionID;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ASLayoutElementContext const ASLayoutElementContextNull = _ASLayoutElementContextMake(ASLayoutElementContextInvalidTransitionID, NO);
|
||||||
|
|
||||||
|
BOOL ASLayoutElementContextIsNull(struct ASLayoutElementContext context)
|
||||||
|
{
|
||||||
|
return !_IsValidTransitionID(context.transitionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASLayoutElementContext ASLayoutElementContextMake(int32_t transitionID, BOOL needsVisualizeNode)
|
||||||
|
{
|
||||||
|
NSCAssert(_IsValidTransitionID(transitionID), @"Invalid transition ID");
|
||||||
|
return _ASLayoutElementContextMake(transitionID, needsVisualizeNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: This is a non-recursive static lock. If it needs to be recursive, use ASDISPLAYNODE_MUTEX_RECURSIVE_INITIALIZER
|
||||||
|
static ASDN::StaticMutex _layoutElementContextLock = ASDISPLAYNODE_MUTEX_INITIALIZER;
|
||||||
|
static std::map<mach_port_t, ASLayoutElementContext> layoutElementContextMap;
|
||||||
|
|
||||||
|
static inline mach_port_t ASLayoutElementGetCurrentContextKey()
|
||||||
|
{
|
||||||
|
return pthread_mach_thread_np(pthread_self());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASLayoutElementSetCurrentContext(struct ASLayoutElementContext context)
|
||||||
|
{
|
||||||
|
const mach_port_t key = ASLayoutElementGetCurrentContextKey();
|
||||||
|
ASDN::StaticMutexLocker l(_layoutElementContextLock);
|
||||||
|
layoutElementContextMap[key] = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ASLayoutElementContext ASLayoutElementGetCurrentContext()
|
||||||
|
{
|
||||||
|
const mach_port_t key = ASLayoutElementGetCurrentContextKey();
|
||||||
|
ASDN::StaticMutexLocker l(_layoutElementContextLock);
|
||||||
|
const auto it = layoutElementContextMap.find(key);
|
||||||
|
if (it != layoutElementContextMap.end()) {
|
||||||
|
// Found an interator with above key. "it->first" is the key itself, "it->second" is the context value.
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return ASLayoutElementContextNull;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASLayoutElementClearCurrentContext()
|
||||||
|
{
|
||||||
|
const mach_port_t key = ASLayoutElementGetCurrentContextKey();
|
||||||
|
ASDN::StaticMutexLocker l(_layoutElementContextLock);
|
||||||
|
layoutElementContextMap.erase(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - ASLayoutElementStyle
|
||||||
|
|
||||||
|
NSString * const ASLayoutElementStyleWidthProperty = @"ASLayoutElementStyleWidthProperty";
|
||||||
|
NSString * const ASLayoutElementStyleMinWidthProperty = @"ASLayoutElementStyleMinWidthProperty";
|
||||||
|
NSString * const ASLayoutElementStyleMaxWidthProperty = @"ASLayoutElementStyleMaxWidthProperty";
|
||||||
|
|
||||||
|
NSString * const ASLayoutElementStyleHeightProperty = @"ASLayoutElementStyleHeightProperty";
|
||||||
|
NSString * const ASLayoutElementStyleMinHeightProperty = @"ASLayoutElementStyleMinHeightProperty";
|
||||||
|
NSString * const ASLayoutElementStyleMaxHeightProperty = @"ASLayoutElementStyleMaxHeightProperty";
|
||||||
|
|
||||||
|
NSString * const ASLayoutElementStyleSpacingBeforeProperty = @"ASLayoutElementStyleSpacingBeforeProperty";
|
||||||
|
NSString * const ASLayoutElementStyleSpacingAfterProperty = @"ASLayoutElementStyleSpacingAfterProperty";
|
||||||
|
NSString * const ASLayoutElementStyleFlexGrowProperty = @"ASLayoutElementStyleFlexGrowProperty";
|
||||||
|
NSString * const ASLayoutElementStyleFlexShrinkProperty = @"ASLayoutElementStyleFlexShrinkProperty";
|
||||||
|
NSString * const ASLayoutElementStyleFlexBasisProperty = @"ASLayoutElementStyleFlexBasisProperty";
|
||||||
|
NSString * const ASLayoutElementStyleAlignSelfProperty = @"ASLayoutElementStyleAlignSelfProperty";
|
||||||
|
NSString * const ASLayoutElementStyleAscenderProperty = @"ASLayoutElementStyleAscenderProperty";
|
||||||
|
NSString * const ASLayoutElementStyleDescenderProperty = @"ASLayoutElementStyleDescenderProperty";
|
||||||
|
|
||||||
|
NSString * const ASLayoutElementStyleLayoutPositionProperty = @"ASLayoutElementStyleLayoutPositionProperty";
|
||||||
|
|
||||||
|
#define ASLayoutElementStyleCallDelegate(propertyName)\
|
||||||
|
do {\
|
||||||
|
[_delegate style:self propertyDidChange:propertyName];\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
@interface ASLayoutElementStyle ()
|
||||||
|
@property (nullable, nonatomic, weak) id<ASLayoutElementStyleDelegate> delegate;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation ASLayoutElementStyle {
|
||||||
|
ASDN::RecursiveMutex __instanceLock__;
|
||||||
|
ASLayoutElementSize _size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@dynamic width, height, minWidth, maxWidth, minHeight, maxHeight;
|
||||||
|
|
||||||
|
#pragma mark - Lifecycle
|
||||||
|
|
||||||
|
- (instancetype)initWithDelegate:(id<ASLayoutElementStyleDelegate>)delegate
|
||||||
|
{
|
||||||
|
self = [self init];
|
||||||
|
if (self) {
|
||||||
|
_delegate = delegate;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (instancetype)init
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self) {
|
||||||
|
_size = ASLayoutElementSizeMake();
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - ASLayoutElementSizeForwarding
|
||||||
|
|
||||||
|
- (ASDimension)width
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
return _size.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setWidth:(ASDimension)width
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_size.width = width;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (ASDimension)height
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
return _size.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setHeight:(ASDimension)height
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_size.height = height;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (ASDimension)minWidth
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
return _size.minWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setMinWidth:(ASDimension)minWidth
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_size.minWidth = minWidth;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (ASDimension)maxWidth
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
return _size.maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setMaxWidth:(ASDimension)maxWidth
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_size.maxWidth = maxWidth;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (ASDimension)minHeight
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
return _size.minHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setMinHeight:(ASDimension)minHeight
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_size.minHeight = minHeight;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (ASDimension)maxHeight
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
return _size.maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setMaxHeight:(ASDimension)maxHeight
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_size.maxHeight = maxHeight;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setSizeWithCGSize:(CGSize)size
|
||||||
|
{
|
||||||
|
self.width = ASDimensionMakeWithPoints(size.width);
|
||||||
|
self.height = ASDimensionMakeWithPoints(size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setExactSizeWithCGSize:(CGSize)size
|
||||||
|
{
|
||||||
|
self.minWidth = ASDimensionMakeWithPoints(size.width);
|
||||||
|
self.minHeight = ASDimensionMakeWithPoints(size.height);
|
||||||
|
self.maxWidth = ASDimensionMakeWithPoints(size.width);
|
||||||
|
self.maxHeight = ASDimensionMakeWithPoints(size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - ASStackLayoutable
|
||||||
|
|
||||||
|
- (void)setSpacingBefore:(CGFloat)spacingBefore
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_spacingBefore = spacingBefore;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingBeforeProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setSpacingAfter:(CGFloat)spacingAfter
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_spacingAfter = spacingAfter;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingAfterProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setFlexGrow:(CGFloat)flexGrow
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_flexGrow = flexGrow;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexGrowProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setFlexShrink:(CGFloat)flexShrink
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_flexShrink = flexShrink;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexShrinkProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setFlexBasis:(ASDimension)flexBasis
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_flexBasis = flexBasis;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexBasisProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setAlignSelf:(ASStackLayoutAlignSelf)alignSelf
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_alignSelf = alignSelf;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAlignSelfProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setAscender:(CGFloat)ascender
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_ascender = ascender;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAscenderProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setDescender:(CGFloat)descender
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_descender = descender;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleDescenderProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - ASStaticLayoutable
|
||||||
|
|
||||||
|
- (void)setLayoutPosition:(CGPoint)layoutPosition
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
_layoutPosition = layoutPosition;
|
||||||
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleLayoutPositionProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ASLayoutableExtensibility.h
|
// ASLayoutElementExtensibility.h
|
||||||
// AsyncDisplayKit
|
// AsyncDisplayKit
|
||||||
//
|
//
|
||||||
// Created by Michael Schneider on 3/29/16.
|
// Created by Michael Schneider on 3/29/16.
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#import <UIKit/UIGeometry.h>
|
#import <UIKit/UIGeometry.h>
|
||||||
|
|
||||||
@protocol ASLayoutableExtensibility <NSObject>
|
@protocol ASLayoutElementExtensibility <NSObject>
|
||||||
|
|
||||||
// The maximum number of extended values per type are defined in ASEnvironment.h above the ASEnvironmentStateExtensions
|
// The maximum number of extended values per type are defined in ASEnvironment.h above the ASEnvironmentStateExtensions
|
||||||
// struct definition. If you try to set a value at an index after the maximum it will throw an assertion.
|
// struct definition. If you try to set a value at an index after the maximum it will throw an assertion.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ASLayoutablePrivate.h
|
// ASLayoutElementPrivate.h
|
||||||
// AsyncDisplayKit
|
// AsyncDisplayKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||||
@@ -10,58 +10,58 @@
|
|||||||
|
|
||||||
#import "ASDimension.h"
|
#import "ASDimension.h"
|
||||||
|
|
||||||
@protocol ASLayoutable;
|
@protocol ASLayoutElement;
|
||||||
@class ASLayoutableStyle;
|
@class ASLayoutElementStyle;
|
||||||
|
|
||||||
struct ASLayoutableContext {
|
struct ASLayoutElementContext {
|
||||||
int32_t transitionID;
|
int32_t transitionID;
|
||||||
BOOL needsVisualizeNode;
|
BOOL needsVisualizeNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int32_t const ASLayoutableContextInvalidTransitionID;
|
extern int32_t const ASLayoutElementContextInvalidTransitionID;
|
||||||
|
|
||||||
extern int32_t const ASLayoutableContextDefaultTransitionID;
|
extern int32_t const ASLayoutElementContextDefaultTransitionID;
|
||||||
|
|
||||||
extern struct ASLayoutableContext const ASLayoutableContextNull;
|
extern struct ASLayoutElementContext const ASLayoutElementContextNull;
|
||||||
|
|
||||||
extern BOOL ASLayoutableContextIsNull(struct ASLayoutableContext context);
|
extern BOOL ASLayoutElementContextIsNull(struct ASLayoutElementContext context);
|
||||||
|
|
||||||
extern struct ASLayoutableContext ASLayoutableContextMake(int32_t transitionID, BOOL needsVisualizeNode);
|
extern struct ASLayoutElementContext ASLayoutElementContextMake(int32_t transitionID, BOOL needsVisualizeNode);
|
||||||
|
|
||||||
extern void ASLayoutableSetCurrentContext(struct ASLayoutableContext context);
|
extern void ASLayoutElementSetCurrentContext(struct ASLayoutElementContext context);
|
||||||
|
|
||||||
extern struct ASLayoutableContext ASLayoutableGetCurrentContext();
|
extern struct ASLayoutElementContext ASLayoutElementGetCurrentContext();
|
||||||
|
|
||||||
extern void ASLayoutableClearCurrentContext();
|
extern void ASLayoutElementClearCurrentContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base protocol for ASLayoutable. Generally the methods/properties in this class do not need to be
|
* The base protocol for ASLayoutElement. Generally the methods/properties in this class do not need to be
|
||||||
* called by the end user and are only called internally. However, there may be a case where the methods are useful.
|
* called by the end user and are only called internally. However, there may be a case where the methods are useful.
|
||||||
*/
|
*/
|
||||||
@protocol ASLayoutablePrivate <NSObject>
|
@protocol ASLayoutElementPrivate <NSObject>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract This method can be used to give the user a chance to wrap an ASLayoutable in an ASLayoutSpec
|
* @abstract This method can be used to give the user a chance to wrap an ASLayoutElement in an ASLayoutSpec
|
||||||
* just before it is added to a parent ASLayoutSpec. For example, if you wanted an ASTextNode that was always
|
* just before it is added to a parent ASLayoutSpec. For example, if you wanted an ASTextNode that was always
|
||||||
* inside of an ASInsetLayoutSpec, you could subclass ASTextNode and implement finalLayoutable so that it wraps
|
* inside of an ASInsetLayoutSpec, you could subclass ASTextNode and implement finalLayoutElement so that it wraps
|
||||||
* itself in an inset spec.
|
* itself in an inset spec.
|
||||||
*
|
*
|
||||||
* Note that any ASLayoutable other than self that is returned MUST set isFinalLayoutable to YES. Make sure
|
* Note that any ASLayoutElement other than self that is returned MUST set isFinalLayoutElement to YES. Make sure
|
||||||
* to do this BEFORE adding a child to the ASLayoutable.
|
* to do this BEFORE adding a child to the ASLayoutElement.
|
||||||
*
|
*
|
||||||
* @return The layoutable that will be added to the parent layout spec. Defaults to self.
|
* @return The layoutElement that will be added to the parent layout spec. Defaults to self.
|
||||||
*/
|
*/
|
||||||
- (id<ASLayoutable>)finalLayoutable;
|
- (id<ASLayoutElement>)finalLayoutElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag to indicate that this ASLayoutable was created in finalLayoutable. This MUST be set to YES
|
* A flag to indicate that this ASLayoutElement was created in finalLayoutElement. This MUST be set to YES
|
||||||
* before adding a child to this layoutable.
|
* before adding a child to this layoutElement.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) BOOL isFinalLayoutable;
|
@property (nonatomic, assign) BOOL isFinalLayoutElement;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma mark - ASLayoutableExtensibility
|
#pragma mark - ASLayoutElementExtensibility
|
||||||
|
|
||||||
#define ASEnvironmentLayoutExtensibilityForwarding \
|
#define ASEnvironmentLayoutExtensibilityForwarding \
|
||||||
- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx\
|
- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx\
|
||||||
@@ -17,10 +17,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*
|
*
|
||||||
* @warning If you are getting recursion crashes here after implementing finalLayoutable, make sure
|
* @warning If you are getting recursion crashes here after implementing finalLayoutable, make sure
|
||||||
* that you are setting isFinalLayoutable flag to YES. This must be one BEFORE adding a child
|
* that you are setting isFinalLayoutable flag to YES. This must be one BEFORE adding a child
|
||||||
* to the new ASLayoutable.
|
* to the new ASLayoutElement.
|
||||||
*
|
*
|
||||||
* For example:
|
* For example:
|
||||||
* - (id<ASLayoutable>)finalLayoutable
|
* - (id<ASLayoutElement>)finalLayoutable
|
||||||
* {
|
* {
|
||||||
* ASInsetLayoutSpec *insetSpec = [[ASInsetLayoutSpec alloc] init];
|
* ASInsetLayoutSpec *insetSpec = [[ASInsetLayoutSpec alloc] init];
|
||||||
* insetSpec.insets = UIEdgeInsetsMake(10,10,10,10);
|
* insetSpec.insets = UIEdgeInsetsMake(10,10,10,10);
|
||||||
@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*
|
*
|
||||||
* @see finalLayoutable
|
* @see finalLayoutable
|
||||||
*/
|
*/
|
||||||
- (id<ASLayoutable>)layoutableToAddFromLayoutable:(id<ASLayoutable>)child;
|
- (id<ASLayoutElement>)layoutableToAddFromLayoutable:(id<ASLayoutElement>)child;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a child with the given identifier to this layout spec.
|
* Adds a child with the given identifier to this layout spec.
|
||||||
@@ -50,14 +50,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
* setChild:forIndex: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild
|
* setChild:forIndex: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild
|
||||||
* property that behind the scenes is calling setChild:forIndex:.
|
* property that behind the scenes is calling setChild:forIndex:.
|
||||||
*/
|
*/
|
||||||
- (void)setChild:(id<ASLayoutable>)child atIndex:(NSUInteger)index;
|
- (void)setChild:(id<ASLayoutElement>)child atIndex:(NSUInteger)index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the child added to this layout spec using the given index.
|
* Returns the child added to this layout spec using the given index.
|
||||||
*
|
*
|
||||||
* @param index An identifier associated with the the child.
|
* @param index An identifier associated with the the child.
|
||||||
*/
|
*/
|
||||||
- (nullable id<ASLayoutable>)childAtIndex:(NSUInteger)index;
|
- (nullable id<ASLayoutElement>)childAtIndex:(NSUInteger)index;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
{
|
{
|
||||||
return [ASLayout layoutWithLayoutable:self size:CGSizeZero];
|
return [ASLayout layoutWithLayoutElement:self size:CGSizeZero];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -48,20 +48,20 @@
|
|||||||
|
|
||||||
#pragma mark - Final layoutable
|
#pragma mark - Final layoutable
|
||||||
|
|
||||||
- (id<ASLayoutable>)layoutableToAddFromLayoutable:(id<ASLayoutable>)child
|
- (id<ASLayoutElement>)layoutableToAddFromLayoutable:(id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
if (self.isFinalLayoutable == NO) {
|
if (self.isFinalLayoutElement == NO) {
|
||||||
id<ASLayoutable> finalLayoutable = [child finalLayoutable];
|
id<ASLayoutElement> finalLayoutElement = [child finalLayoutElement];
|
||||||
if (finalLayoutable != child) {
|
if (finalLayoutElement != child) {
|
||||||
if (ASEnvironmentStatePropagationEnabled()) {
|
if (ASEnvironmentStatePropagationEnabled()) {
|
||||||
ASEnvironmentStatePropagateUp(finalLayoutable, child.environmentState.layoutOptionsState);
|
ASEnvironmentStatePropagateUp(finalLayoutElement, child.environmentState.layoutOptionsState);
|
||||||
} else {
|
} else {
|
||||||
// If state propagation is not enabled the layout options state needs to be copied manually
|
// If state propagation is not enabled the layout options state needs to be copied manually
|
||||||
ASEnvironmentState finalLayoutableEnvironmentState = finalLayoutable.environmentState;
|
ASEnvironmentState finalLayoutElementEnvironmentState = finalLayoutElement.environmentState;
|
||||||
finalLayoutableEnvironmentState.layoutOptionsState = child.environmentState.layoutOptionsState;
|
finalLayoutElementEnvironmentState.layoutOptionsState = child.environmentState.layoutOptionsState;
|
||||||
finalLayoutable.environmentState = finalLayoutableEnvironmentState;
|
finalLayoutElement.environmentState = finalLayoutElementEnvironmentState;
|
||||||
}
|
}
|
||||||
return finalLayoutable;
|
return finalLayoutElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
@@ -69,11 +69,11 @@
|
|||||||
|
|
||||||
#pragma mark - Child with index
|
#pragma mark - Child with index
|
||||||
|
|
||||||
- (void)setChild:(id<ASLayoutable>)child atIndex:(NSUInteger)index
|
- (void)setChild:(id<ASLayoutElement>)child atIndex:(NSUInteger)index
|
||||||
{
|
{
|
||||||
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");
|
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");
|
||||||
|
|
||||||
id<ASLayoutable> layoutable = child ? [self layoutableToAddFromLayoutable:child] : [ASNullLayoutSpec null];
|
id<ASLayoutElement> layoutable = child ? [self layoutableToAddFromLayoutable:child] : [ASNullLayoutSpec null];
|
||||||
|
|
||||||
if (child) {
|
if (child) {
|
||||||
if (_childrenArray.count < index) {
|
if (_childrenArray.count < index) {
|
||||||
@@ -91,12 +91,12 @@
|
|||||||
|
|
||||||
// TODO: Should we propagate up the layoutable at it could happen that multiple children will propagated up their
|
// TODO: Should we propagate up the layoutable at it could happen that multiple children will propagated up their
|
||||||
// layout options and one child will overwrite values from another child
|
// layout options and one child will overwrite values from another child
|
||||||
// [self propagateUpLayoutable:finalLayoutable];
|
// [self propagateUpLayoutable:finalLayoutElement];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<ASLayoutable>)childAtIndex:(NSUInteger)index
|
- (id<ASLayoutElement>)childAtIndex:(NSUInteger)index
|
||||||
{
|
{
|
||||||
id<ASLayoutable> layoutable = nil;
|
id<ASLayoutElement> layoutable = nil;
|
||||||
if (index < _childrenArray.count) {
|
if (index < _childrenArray.count) {
|
||||||
layoutable = _childrenArray[index];
|
layoutable = _childrenArray[index];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// of patent rights can be found in the PATENTS file in the same directory.
|
// of patent rights can be found in the PATENTS file in the same directory.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutElement.h>
|
||||||
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
|
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
* A layout spec is an immutable object that describes a layout, loosely inspired by React.
|
* A layout spec is an immutable object that describes a layout, loosely inspired by React.
|
||||||
*/
|
*/
|
||||||
@interface ASLayoutSpec : NSObject <ASLayoutable>
|
@interface ASLayoutSpec : NSObject <ASLayoutElement>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creation of a layout spec should only happen by a user in layoutSpecThatFits:. During that method, a
|
* Creation of a layout spec should only happen by a user in layoutSpecThatFits:. During that method, a
|
||||||
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
* Parent of the layout spec
|
* Parent of the layout spec
|
||||||
*/
|
*/
|
||||||
@property (nullable, nonatomic, weak) id<ASLayoutable> parent;
|
@property (nullable, nonatomic, weak) id<ASLayoutElement> parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a child to this layout spec using a default identifier.
|
* Adds a child to this layout spec using a default identifier.
|
||||||
@@ -45,12 +45,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
* setChild:forIdentifier: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild
|
* setChild:forIdentifier: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild
|
||||||
* property that behind the scenes is calling setChild:forIdentifier:.
|
* property that behind the scenes is calling setChild:forIdentifier:.
|
||||||
*/
|
*/
|
||||||
@property (nullable, strong, nonatomic) id<ASLayoutable> child;
|
@property (nullable, strong, nonatomic) id<ASLayoutElement> child;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds childen to this layout spec.
|
* Adds childen to this layout spec.
|
||||||
*
|
*
|
||||||
* @param children An array of ASLayoutable children to be added.
|
* @param children An array of ASLayoutElement children to be added.
|
||||||
*
|
*
|
||||||
* @discussion Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the
|
* @discussion Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the
|
||||||
* reponsibility of holding on to the spec children. Some layout specs, like ASStackLayoutSpec,
|
* reponsibility of holding on to the spec children. Some layout specs, like ASStackLayoutSpec,
|
||||||
@@ -58,24 +58,24 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
* For good measure, in these layout specs it probably makes sense to define
|
* For good measure, in these layout specs it probably makes sense to define
|
||||||
* setChild: and setChild:forIdentifier: methods to do something appropriate or to assert.
|
* setChild: and setChild:forIdentifier: methods to do something appropriate or to assert.
|
||||||
*/
|
*/
|
||||||
@property (nullable, strong, nonatomic) NSArray<id<ASLayoutable>> *children;
|
@property (nullable, strong, nonatomic) NSArray<id<ASLayoutElement>> *children;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ASLayoutSpec subclass that can wrap a ASLayoutable and calculates the layout of the child.
|
* An ASLayoutSpec subclass that can wrap a ASLayoutElement and calculates the layout of the child.
|
||||||
*/
|
*/
|
||||||
@interface ASWrapperLayoutSpec : ASLayoutSpec
|
@interface ASWrapperLayoutSpec : ASLayoutSpec
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns an ASWrapperLayoutSpec object with the given layoutable as child
|
* Returns an ASWrapperLayoutSpec object with the given layoutElement as child
|
||||||
*/
|
*/
|
||||||
+ (instancetype)wrapperWithLayoutable:(id<ASLayoutable>)layoutable;
|
+ (instancetype)wrapperWithLayoutElement:(id<ASLayoutElement>)layoutElement;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns an ASWrapperLayoutSpec object initialized with the given layoutable as child
|
* Returns an ASWrapperLayoutSpec object initialized with the given layoutElement as child
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithLayoutable:(id<ASLayoutable>)layoutable NS_DESIGNATED_INITIALIZER;;
|
- (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement NS_DESIGNATED_INITIALIZER;;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init not available for ASWrapperLayoutSpec
|
* Init not available for ASWrapperLayoutSpec
|
||||||
@@ -84,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface ASLayoutSpec (Debugging) <ASLayoutableAsciiArtProtocol>
|
@interface ASLayoutSpec (Debugging) <ASLayoutElementAsciiArtProtocol>
|
||||||
/**
|
/**
|
||||||
* Used by other layout specs to create ascii art debug strings
|
* Used by other layout specs to create ascii art debug strings
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
@implementation ASLayoutSpec
|
@implementation ASLayoutSpec
|
||||||
|
|
||||||
// Dynamic properties for ASLayoutables
|
// Dynamic properties for ASLayoutElements
|
||||||
@dynamic layoutableType;
|
@dynamic layoutElementType;
|
||||||
@synthesize isFinalLayoutable = _isFinalLayoutable;
|
@synthesize isFinalLayoutElement = _isFinalLayoutElement;
|
||||||
|
|
||||||
#pragma mark - Class
|
#pragma mark - Class
|
||||||
|
|
||||||
@@ -39,15 +39,15 @@
|
|||||||
|
|
||||||
_isMutable = YES;
|
_isMutable = YES;
|
||||||
_environmentState = ASEnvironmentStateMakeDefault();
|
_environmentState = ASEnvironmentStateMakeDefault();
|
||||||
_style = [[ASLayoutableStyle alloc] init];
|
_style = [[ASLayoutElementStyle alloc] init];
|
||||||
_childrenArray = [[NSMutableArray alloc] init];
|
_childrenArray = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASLayoutableType)layoutableType
|
- (ASLayoutElementType)layoutElementType
|
||||||
{
|
{
|
||||||
return ASLayoutableTypeLayoutSpec;
|
return ASLayoutElementTypeLayoutSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)canLayoutAsynchronous
|
- (BOOL)canLayoutAsynchronous
|
||||||
@@ -57,14 +57,14 @@
|
|||||||
|
|
||||||
#pragma mark - Final Layoutable
|
#pragma mark - Final Layoutable
|
||||||
|
|
||||||
- (id<ASLayoutable>)finalLayoutable
|
- (id<ASLayoutElement>)finalLayoutElement
|
||||||
{
|
{
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Style
|
#pragma mark - Style
|
||||||
|
|
||||||
- (ASLayoutableStyle *)style
|
- (ASLayoutElementStyle *)style
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
return _style;
|
return _style;
|
||||||
@@ -89,22 +89,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
restrictedToSize:(ASLayoutableSize)size
|
restrictedToSize:(ASLayoutElementSize)size
|
||||||
relativeToParentSize:(CGSize)parentSize
|
relativeToParentSize:(CGSize)parentSize
|
||||||
{
|
{
|
||||||
const ASSizeRange resolvedRange = ASSizeRangeIntersect(constrainedSize, ASLayoutableSizeResolve(_style.size, parentSize));
|
const ASSizeRange resolvedRange = ASSizeRangeIntersect(constrainedSize, ASLayoutElementSizeResolve(_style.size, parentSize));
|
||||||
return [self calculateLayoutThatFits:resolvedRange];
|
return [self calculateLayoutThatFits:resolvedRange];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
{
|
{
|
||||||
return [ASLayout layoutWithLayoutable:self size:constrainedSize.min];
|
return [ASLayout layoutWithLayoutElement:self size:constrainedSize.min];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Parent
|
#pragma mark - Parent
|
||||||
|
|
||||||
- (void)setParent:(id<ASLayoutable>)parent
|
- (void)setParent:(id<ASLayoutElement>)parent
|
||||||
{
|
{
|
||||||
// FIXME: Locking should be evaluated here. _parent is not widely used yet, though.
|
// FIXME: Locking should be evaluated here. _parent is not widely used yet, though.
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
@@ -114,19 +114,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Child
|
#pragma mark - Child
|
||||||
|
|
||||||
- (void)setChild:(id<ASLayoutable>)child
|
- (void)setChild:(id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");;
|
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");;
|
||||||
ASDisplayNodeAssert(_childrenArray.count < 2, @"This layout spec does not support more than one child. Use the setChildren: or the setChild:AtIndex: API");
|
ASDisplayNodeAssert(_childrenArray.count < 2, @"This layout spec does not support more than one child. Use the setChildren: or the setChild:AtIndex: API");
|
||||||
|
|
||||||
if (child) {
|
if (child) {
|
||||||
id<ASLayoutable> finalLayoutable = [self layoutableToAddFromLayoutable:child];
|
id<ASLayoutElement> finalLayoutElement = [self layoutableToAddFromLayoutable:child];
|
||||||
if (finalLayoutable) {
|
if (finalLayoutElement) {
|
||||||
_childrenArray[0] = finalLayoutable;
|
_childrenArray[0] = finalLayoutElement;
|
||||||
[self propagateUpLayoutable:finalLayoutable];
|
[self propagateUpLayoutElement:finalLayoutElement];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_childrenArray.count) {
|
if (_childrenArray.count) {
|
||||||
@@ -135,7 +134,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<ASLayoutable>)child
|
- (id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
ASDisplayNodeAssert(_childrenArray.count < 2, @"This layout spec does not support more than one child. Use the setChildren: or the setChild:AtIndex: API");
|
ASDisplayNodeAssert(_childrenArray.count < 2, @"This layout spec does not support more than one child. Use the setChildren: or the setChild:AtIndex: API");
|
||||||
|
|
||||||
@@ -148,14 +147,15 @@
|
|||||||
|
|
||||||
#pragma mark - Children
|
#pragma mark - Children
|
||||||
|
|
||||||
- (void)setChildren:(NSArray<id<ASLayoutable>> *)children
|
- (void)setChildren:(NSArray<id<ASLayoutElement>> *)children
|
||||||
{
|
{
|
||||||
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");
|
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");
|
||||||
|
|
||||||
[_childrenArray removeAllObjects];
|
[_childrenArray removeAllObjects];
|
||||||
|
|
||||||
NSUInteger i = 0;
|
NSUInteger i = 0;
|
||||||
for (id<ASLayoutable> child in children) {
|
for (id<ASLayoutElement> child in children) {
|
||||||
|
ASDisplayNodeAssert([child conformsToProtocol:NSProtocolFromString(@"ASLayoutElement")], @"Child %@ of spec %@ is not an ASLayoutElement!", child, self);
|
||||||
_childrenArray[i] = [self layoutableToAddFromLayoutable:child];
|
_childrenArray[i] = [self layoutableToAddFromLayoutable:child];
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
@@ -198,12 +198,12 @@
|
|||||||
return ASEnvironmentStateTraitCollectionPropagationEnabled();
|
return ASEnvironmentStateTraitCollectionPropagationEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)propagateUpLayoutable:(id<ASLayoutable>)layoutable
|
- (void)propagateUpLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
{
|
{
|
||||||
if ([layoutable isKindOfClass:[ASLayoutSpec class]]) {
|
if ([layoutElement isKindOfClass:[ASLayoutSpec class]]) {
|
||||||
[(ASLayoutSpec *)layoutable setParent:self]; // This will trigger upward propogation if needed.
|
[(ASLayoutSpec *)layoutElement setParent:self]; // This will trigger upward propogation if needed.
|
||||||
} else if ([self supportsUpwardPropagation]) {
|
} else if ([self supportsUpwardPropagation]) {
|
||||||
ASEnvironmentStatePropagateUp(self, layoutable.environmentState.layoutOptionsState); // Probably an ASDisplayNode
|
ASEnvironmentStatePropagateUp(self, layoutElement.environmentState.layoutOptionsState); // Probably an ASDisplayNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,16 +231,16 @@ ASEnvironmentLayoutExtensibilityForwarding
|
|||||||
|
|
||||||
@implementation ASWrapperLayoutSpec
|
@implementation ASWrapperLayoutSpec
|
||||||
|
|
||||||
+ (instancetype)wrapperWithLayoutable:(id<ASLayoutable>)layoutable
|
+ (instancetype)wrapperWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithLayoutable:layoutable];
|
return [[self alloc] initWithLayoutElement:layoutElement];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithLayoutable:(id<ASLayoutable>)layoutable
|
- (instancetype)initWithLayoutElement:(id<ASLayoutElement>)layoutElement
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
self.child = layoutable;
|
self.child = layoutElement;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,7 @@ ASEnvironmentLayoutExtensibilityForwarding
|
|||||||
{
|
{
|
||||||
ASLayout *sublayout = [self.child layoutThatFits:constrainedSize parentSize:constrainedSize.max];
|
ASLayout *sublayout = [self.child layoutThatFits:constrainedSize parentSize:constrainedSize.max];
|
||||||
sublayout.position = CGPointZero;
|
sublayout.position = CGPointZero;
|
||||||
return [ASLayout layoutWithLayoutable:self size:sublayout.size sublayouts:@[sublayout]];
|
return [ASLayout layoutWithLayoutElement:self size:sublayout.size sublayouts:@[sublayout]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -259,12 +259,12 @@ ASEnvironmentLayoutExtensibilityForwarding
|
|||||||
|
|
||||||
@implementation ASLayoutSpec (Debugging)
|
@implementation ASLayoutSpec (Debugging)
|
||||||
|
|
||||||
#pragma mark - ASLayoutableAsciiArtProtocol
|
#pragma mark - ASLayoutElementAsciiArtProtocol
|
||||||
|
|
||||||
+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction
|
+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction
|
||||||
{
|
{
|
||||||
NSMutableArray *childStrings = [NSMutableArray array];
|
NSMutableArray *childStrings = [NSMutableArray array];
|
||||||
for (id<ASLayoutableAsciiArtProtocol> layoutChild in children) {
|
for (id<ASLayoutElementAsciiArtProtocol> layoutChild in children) {
|
||||||
NSString *childString = [layoutChild asciiArtString];
|
NSString *childString = [layoutChild asciiArtString];
|
||||||
if (childString) {
|
if (childString) {
|
||||||
[childStrings addObject:childString];
|
[childStrings addObject:childString];
|
||||||
|
|||||||
@@ -1,305 +0,0 @@
|
|||||||
//
|
|
||||||
// ASLayoutable.mm
|
|
||||||
// AsyncDisplayKit
|
|
||||||
//
|
|
||||||
// Created by Huy Nguyen on 3/27/16.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
||||||
// This source code is licensed under the BSD-style license found in the
|
|
||||||
// LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
// of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "ASLayoutablePrivate.h"
|
|
||||||
#import "ASEnvironmentInternal.h"
|
|
||||||
#import "ASDisplayNodeInternal.h"
|
|
||||||
#import "ASThread.h"
|
|
||||||
|
|
||||||
#import <map>
|
|
||||||
|
|
||||||
CGFloat const ASLayoutableParentDimensionUndefined = NAN;
|
|
||||||
CGSize const ASLayoutableParentSizeUndefined = {ASLayoutableParentDimensionUndefined, ASLayoutableParentDimensionUndefined};
|
|
||||||
|
|
||||||
int32_t const ASLayoutableContextInvalidTransitionID = 0;
|
|
||||||
int32_t const ASLayoutableContextDefaultTransitionID = ASLayoutableContextInvalidTransitionID + 1;
|
|
||||||
|
|
||||||
static inline ASLayoutableContext _ASLayoutableContextMake(int32_t transitionID, BOOL needsVisualizeNode)
|
|
||||||
{
|
|
||||||
struct ASLayoutableContext context;
|
|
||||||
context.transitionID = transitionID;
|
|
||||||
context.needsVisualizeNode = needsVisualizeNode;
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline BOOL _IsValidTransitionID(int32_t transitionID)
|
|
||||||
{
|
|
||||||
return transitionID > ASLayoutableContextInvalidTransitionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ASLayoutableContext const ASLayoutableContextNull = _ASLayoutableContextMake(ASLayoutableContextInvalidTransitionID, NO);
|
|
||||||
|
|
||||||
BOOL ASLayoutableContextIsNull(struct ASLayoutableContext context)
|
|
||||||
{
|
|
||||||
return !_IsValidTransitionID(context.transitionID);
|
|
||||||
}
|
|
||||||
|
|
||||||
ASLayoutableContext ASLayoutableContextMake(int32_t transitionID, BOOL needsVisualizeNode)
|
|
||||||
{
|
|
||||||
NSCAssert(_IsValidTransitionID(transitionID), @"Invalid transition ID");
|
|
||||||
return _ASLayoutableContextMake(transitionID, needsVisualizeNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: This is a non-recursive static lock. If it needs to be recursive, use ASDISPLAYNODE_MUTEX_RECURSIVE_INITIALIZER
|
|
||||||
static ASDN::StaticMutex _layoutableContextLock = ASDISPLAYNODE_MUTEX_INITIALIZER;
|
|
||||||
static std::map<mach_port_t, ASLayoutableContext> layoutableContextMap;
|
|
||||||
|
|
||||||
static inline mach_port_t ASLayoutableGetCurrentContextKey()
|
|
||||||
{
|
|
||||||
return pthread_mach_thread_np(pthread_self());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASLayoutableSetCurrentContext(struct ASLayoutableContext context)
|
|
||||||
{
|
|
||||||
const mach_port_t key = ASLayoutableGetCurrentContextKey();
|
|
||||||
ASDN::StaticMutexLocker l(_layoutableContextLock);
|
|
||||||
layoutableContextMap[key] = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ASLayoutableContext ASLayoutableGetCurrentContext()
|
|
||||||
{
|
|
||||||
const mach_port_t key = ASLayoutableGetCurrentContextKey();
|
|
||||||
ASDN::StaticMutexLocker l(_layoutableContextLock);
|
|
||||||
const auto it = layoutableContextMap.find(key);
|
|
||||||
if (it != layoutableContextMap.end()) {
|
|
||||||
// Found an interator with above key. "it->first" is the key itself, "it->second" is the context value.
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
return ASLayoutableContextNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASLayoutableClearCurrentContext()
|
|
||||||
{
|
|
||||||
const mach_port_t key = ASLayoutableGetCurrentContextKey();
|
|
||||||
ASDN::StaticMutexLocker l(_layoutableContextLock);
|
|
||||||
layoutableContextMap.erase(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - ASLayoutableStyle
|
|
||||||
|
|
||||||
NSString * const ASLayoutableStyleWidthProperty = @"ASLayoutableStyleWidthProperty";
|
|
||||||
NSString * const ASLayoutableStyleMinWidthProperty = @"ASLayoutableStyleMinWidthProperty";
|
|
||||||
NSString * const ASLayoutableStyleMaxWidthProperty = @"ASLayoutableStyleMaxWidthProperty";
|
|
||||||
|
|
||||||
NSString * const ASLayoutableStyleHeightProperty = @"ASLayoutableStyleHeightProperty";
|
|
||||||
NSString * const ASLayoutableStyleMinHeightProperty = @"ASLayoutableStyleMinHeightProperty";
|
|
||||||
NSString * const ASLayoutableStyleMaxHeightProperty = @"ASLayoutableStyleMaxHeightProperty";
|
|
||||||
|
|
||||||
NSString * const ASLayoutableStyleSpacingBeforeProperty = @"ASLayoutableStyleSpacingBeforeProperty";
|
|
||||||
NSString * const ASLayoutableStyleSpacingAfterProperty = @"ASLayoutableStyleSpacingAfterProperty";
|
|
||||||
NSString * const ASLayoutableStyleFlexGrowProperty = @"ASLayoutableStyleFlexGrowProperty";
|
|
||||||
NSString * const ASLayoutableStyleFlexShrinkProperty = @"ASLayoutableStyleFlexShrinkProperty";
|
|
||||||
NSString * const ASLayoutableStyleFlexBasisProperty = @"ASLayoutableStyleFlexBasisProperty";
|
|
||||||
NSString * const ASLayoutableStyleAlignSelfProperty = @"ASLayoutableStyleAlignSelfProperty";
|
|
||||||
NSString * const ASLayoutableStyleAscenderProperty = @"ASLayoutableStyleAscenderProperty";
|
|
||||||
NSString * const ASLayoutableStyleDescenderProperty = @"ASLayoutableStyleDescenderProperty";
|
|
||||||
|
|
||||||
NSString * const ASLayoutableStyleLayoutPositionProperty = @"ASLayoutableStyleLayoutPositionProperty";
|
|
||||||
|
|
||||||
#define ASLayoutableStyleCallDelegate(propertyName)\
|
|
||||||
do {\
|
|
||||||
[_delegate style:self propertyDidChange:propertyName];\
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
@interface ASLayoutableStyle ()
|
|
||||||
@property (nullable, nonatomic, weak) id<ASLayoutableStyleDelegate> delegate;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation ASLayoutableStyle {
|
|
||||||
ASDN::RecursiveMutex __instanceLock__;
|
|
||||||
ASLayoutableSize _size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@dynamic width, height, minWidth, maxWidth, minHeight, maxHeight;
|
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
|
||||||
|
|
||||||
- (instancetype)initWithDelegate:(id<ASLayoutableStyleDelegate>)delegate
|
|
||||||
{
|
|
||||||
self = [self init];
|
|
||||||
if (self) {
|
|
||||||
_delegate = delegate;
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)init
|
|
||||||
{
|
|
||||||
self = [super init];
|
|
||||||
if (self) {
|
|
||||||
_size = ASLayoutableSizeMake();
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - ASLayoutableSizeForwarding
|
|
||||||
|
|
||||||
- (ASDimension)width
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
return _size.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setWidth:(ASDimension)width
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_size.width = width;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleWidthProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (ASDimension)height
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
return _size.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setHeight:(ASDimension)height
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_size.height = height;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleHeightProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (ASDimension)minWidth
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
return _size.minWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setMinWidth:(ASDimension)minWidth
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_size.minWidth = minWidth;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleMinWidthProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (ASDimension)maxWidth
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
return _size.maxWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setMaxWidth:(ASDimension)maxWidth
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_size.maxWidth = maxWidth;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleMaxWidthProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (ASDimension)minHeight
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
return _size.minHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setMinHeight:(ASDimension)minHeight
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_size.minHeight = minHeight;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleMinHeightProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (ASDimension)maxHeight
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
return _size.maxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setMaxHeight:(ASDimension)maxHeight
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_size.maxHeight = maxHeight;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleMaxHeightProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setSizeWithCGSize:(CGSize)size
|
|
||||||
{
|
|
||||||
self.width = ASDimensionMakeWithPoints(size.width);
|
|
||||||
self.height = ASDimensionMakeWithPoints(size.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setExactSizeWithCGSize:(CGSize)size
|
|
||||||
{
|
|
||||||
self.minWidth = ASDimensionMakeWithPoints(size.width);
|
|
||||||
self.minHeight = ASDimensionMakeWithPoints(size.height);
|
|
||||||
self.maxWidth = ASDimensionMakeWithPoints(size.width);
|
|
||||||
self.maxHeight = ASDimensionMakeWithPoints(size.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - ASStackLayoutable
|
|
||||||
|
|
||||||
- (void)setSpacingBefore:(CGFloat)spacingBefore
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_spacingBefore = spacingBefore;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleSpacingBeforeProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setSpacingAfter:(CGFloat)spacingAfter
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_spacingAfter = spacingAfter;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleSpacingAfterProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setFlexGrow:(CGFloat)flexGrow
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_flexGrow = flexGrow;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleFlexGrowProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setFlexShrink:(CGFloat)flexShrink
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_flexShrink = flexShrink;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleFlexShrinkProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setFlexBasis:(ASDimension)flexBasis
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_flexBasis = flexBasis;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleFlexBasisProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setAlignSelf:(ASStackLayoutAlignSelf)alignSelf
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_alignSelf = alignSelf;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleAlignSelfProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setAscender:(CGFloat)ascender
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_ascender = ascender;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleAscenderProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setDescender:(CGFloat)descender
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_descender = descender;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleDescenderProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - ASStaticLayoutable
|
|
||||||
|
|
||||||
- (void)setLayoutPosition:(CGPoint)layoutPosition
|
|
||||||
{
|
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
|
||||||
_layoutPosition = layoutPosition;
|
|
||||||
ASLayoutableStyleCallDelegate(ASLayoutableStyleLayoutPositionProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This layout spec lays out a single layoutable child and then overlays a layoutable object on top of it streched to its size
|
This layout spec lays out a single layoutElement child and then overlays a layoutElement object on top of it streched to its size
|
||||||
*/
|
*/
|
||||||
@interface ASOverlayLayoutSpec : ASLayoutSpec
|
@interface ASOverlayLayoutSpec : ASLayoutSpec
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlay layoutable of this layout spec
|
* Overlay layoutable of this layout spec
|
||||||
*/
|
*/
|
||||||
@property (nullable, nonatomic, strong) id<ASLayoutable> overlay;
|
@property (nullable, nonatomic, strong) id<ASLayoutElement> overlay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns an ASOverlayLayoutSpec object with a given child and an layoutable that act as overlay.
|
* Creates and returns an ASOverlayLayoutSpec object with a given child and an layoutable that act as overlay.
|
||||||
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
* @param child A child that is laid out to determine the size of this spec.
|
* @param child A child that is laid out to determine the size of this spec.
|
||||||
* @param overlay A layoutable object that is laid out over the child. If this is nil, the overlay is omitted.
|
* @param overlay A layoutable object that is laid out over the child. If this is nil, the overlay is omitted.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)overlayLayoutSpecWithChild:(id<ASLayoutable>)child overlay:(nullable id<ASLayoutable>)overlay;
|
+ (instancetype)overlayLayoutSpecWithChild:(id<ASLayoutElement>)child overlay:(nullable id<ASLayoutElement>)overlay;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ static NSUInteger const kOverlayChildIndex = 1;
|
|||||||
|
|
||||||
#pragma mark - Class
|
#pragma mark - Class
|
||||||
|
|
||||||
+ (instancetype)overlayLayoutSpecWithChild:(id<ASLayoutable>)child overlay:(id<ASLayoutable>)overlay
|
+ (instancetype)overlayLayoutSpecWithChild:(id<ASLayoutElement>)child overlay:(id<ASLayoutElement>)overlay
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithChild:child overlay:overlay];
|
return [[self alloc] initWithChild:child overlay:overlay];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
|
|
||||||
- (instancetype)initWithChild:(id<ASLayoutable>)child overlay:(id<ASLayoutable>)overlay
|
- (instancetype)initWithChild:(id<ASLayoutElement>)child overlay:(id<ASLayoutElement>)overlay
|
||||||
{
|
{
|
||||||
if (!(self = [super init])) {
|
if (!(self = [super init])) {
|
||||||
return nil;
|
return nil;
|
||||||
@@ -41,12 +41,12 @@ static NSUInteger const kOverlayChildIndex = 1;
|
|||||||
|
|
||||||
#pragma mark - Setter / Getter
|
#pragma mark - Setter / Getter
|
||||||
|
|
||||||
- (void)setOverlay:(id<ASLayoutable>)overlay
|
- (void)setOverlay:(id<ASLayoutElement>)overlay
|
||||||
{
|
{
|
||||||
[super setChild:overlay atIndex:kOverlayChildIndex];
|
[super setChild:overlay atIndex:kOverlayChildIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<ASLayoutable>)overlay
|
- (id<ASLayoutElement>)overlay
|
||||||
{
|
{
|
||||||
return [super childAtIndex:kOverlayChildIndex];
|
return [super childAtIndex:kOverlayChildIndex];
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ static NSUInteger const kOverlayChildIndex = 1;
|
|||||||
First layout the contents, then fit the overlay on top of it.
|
First layout the contents, then fit the overlay on top of it.
|
||||||
*/
|
*/
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
restrictedToSize:(ASLayoutableSize)size
|
restrictedToSize:(ASLayoutElementSize)size
|
||||||
relativeToParentSize:(CGSize)parentSize
|
relativeToParentSize:(CGSize)parentSize
|
||||||
{
|
{
|
||||||
ASLayout *contentsLayout = [[super childAtIndex:kUnderlayChildIndex] layoutThatFits:constrainedSize parentSize:parentSize];
|
ASLayout *contentsLayout = [[super childAtIndex:kUnderlayChildIndex] layoutThatFits:constrainedSize parentSize:parentSize];
|
||||||
@@ -70,14 +70,14 @@ static NSUInteger const kOverlayChildIndex = 1;
|
|||||||
[sublayouts addObject:overlayLayout];
|
[sublayouts addObject:overlayLayout];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [ASLayout layoutWithLayoutable:self size:contentsLayout.size sublayouts:sublayouts];
|
return [ASLayout layoutWithLayoutElement:self size:contentsLayout.size sublayouts:sublayouts];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ASOverlayLayoutSpec (Debugging)
|
@implementation ASOverlayLayoutSpec (Debugging)
|
||||||
|
|
||||||
#pragma mark - ASLayoutableAsciiArtProtocol
|
#pragma mark - ASLayoutElementAsciiArtProtocol
|
||||||
|
|
||||||
- (NSString *)debugBoxString
|
- (NSString *)debugBoxString
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutElement.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@property (nonatomic, assign) CGFloat ratio;
|
@property (nonatomic, assign) CGFloat ratio;
|
||||||
|
|
||||||
+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id<ASLayoutable>)child;
|
+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id<ASLayoutElement>)child;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
CGFloat _ratio;
|
CGFloat _ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id<ASLayoutable>)child
|
+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithRatio:ratio child:child];
|
return [[self alloc] initWithRatio:ratio child:child];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithRatio:(CGFloat)ratio child:(id<ASLayoutable>)child;
|
- (instancetype)initWithRatio:(CGFloat)ratio child:(id<ASLayoutElement>)child;
|
||||||
{
|
{
|
||||||
if (!(self = [super init])) {
|
if (!(self = [super init])) {
|
||||||
return nil;
|
return nil;
|
||||||
@@ -72,17 +72,17 @@
|
|||||||
|
|
||||||
// If there is no max size in *either* dimension, we can't apply the ratio, so just pass our size range through.
|
// If there is no max size in *either* dimension, we can't apply the ratio, so just pass our size range through.
|
||||||
const ASSizeRange childRange = (bestSize == sizeOptions.end()) ? constrainedSize : ASSizeRangeMake(*bestSize, *bestSize);
|
const ASSizeRange childRange = (bestSize == sizeOptions.end()) ? constrainedSize : ASSizeRangeMake(*bestSize, *bestSize);
|
||||||
const CGSize parentSize = (bestSize == sizeOptions.end()) ? ASLayoutableParentSizeUndefined : *bestSize;
|
const CGSize parentSize = (bestSize == sizeOptions.end()) ? ASLayoutElementParentSizeUndefined : *bestSize;
|
||||||
ASLayout *sublayout = [self.child layoutThatFits:childRange parentSize:parentSize];
|
ASLayout *sublayout = [self.child layoutThatFits:childRange parentSize:parentSize];
|
||||||
sublayout.position = CGPointZero;
|
sublayout.position = CGPointZero;
|
||||||
return [ASLayout layoutWithLayoutable:self size:sublayout.size sublayouts:@[sublayout]];
|
return [ASLayout layoutWithLayoutElement:self size:sublayout.size sublayouts:@[sublayout]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ASRatioLayoutSpec (Debugging)
|
@implementation ASRatioLayoutSpec (Debugging)
|
||||||
|
|
||||||
#pragma mark - ASLayoutableAsciiArtProtocol
|
#pragma mark - ASLayoutElementAsciiArtProtocol
|
||||||
|
|
||||||
- (NSString *)asciiArtName
|
- (NSString *)asciiArtName
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ typedef NS_OPTIONS(NSUInteger, ASRelativeLayoutSpecSizingOption) {
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/** Lays out a single layoutable child and positions it within the layout bounds according to vertical and horizontal positional specifiers.
|
/** Lays out a single layoutElement child and positions it within the layout bounds according to vertical and horizontal positional specifiers.
|
||||||
* Can position the child at any of the 4 corners, or the middle of any of the 4 edges, as well as the center - similar to "9-part" image areas.
|
* Can position the child at any of the 4 corners, or the middle of any of the 4 edges, as well as the center - similar to "9-part" image areas.
|
||||||
*/
|
*/
|
||||||
@interface ASRelativeLayoutSpec : ASLayoutSpec
|
@interface ASRelativeLayoutSpec : ASLayoutSpec
|
||||||
@@ -57,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
+ (instancetype)relativePositionLayoutSpecWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition
|
+ (instancetype)relativePositionLayoutSpecWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition
|
||||||
verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition
|
verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition
|
||||||
sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption
|
sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption
|
||||||
child:(id<ASLayoutable>)child;
|
child:(id<ASLayoutElement>)child;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @discussion convenience initializer for a ASRelativeLayoutSpec
|
* @discussion convenience initializer for a ASRelativeLayoutSpec
|
||||||
@@ -70,7 +70,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (instancetype)initWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition
|
- (instancetype)initWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition
|
||||||
verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition
|
verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition
|
||||||
sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption
|
sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption
|
||||||
child:(id<ASLayoutable>)child;
|
child:(id<ASLayoutElement>)child;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
@implementation ASRelativeLayoutSpec
|
@implementation ASRelativeLayoutSpec
|
||||||
|
|
||||||
- (instancetype)initWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id<ASLayoutable>)child
|
- (instancetype)initWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
if (!(self = [super init])) {
|
if (!(self = [super init])) {
|
||||||
return nil;
|
return nil;
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)relativePositionLayoutSpecWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id<ASLayoutable>)child
|
+ (instancetype)relativePositionLayoutSpecWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id<ASLayoutElement>)child
|
||||||
{
|
{
|
||||||
return [[self alloc] initWithHorizontalPosition:horizontalPosition verticalPosition:verticalPosition sizingOption:sizingOption child:child];
|
return [[self alloc] initWithHorizontalPosition:horizontalPosition verticalPosition:verticalPosition sizingOption:sizingOption child:child];
|
||||||
}
|
}
|
||||||
@@ -55,12 +55,12 @@
|
|||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
{
|
{
|
||||||
// If we have a finite size in any direction, pass this so that the child can
|
// If we have a finite size in any direction, pass this so that the child can
|
||||||
// resolve percentages against it. Otherwise pass ASLayoutableParentDimensionUndefined
|
// resolve percentages against it. Otherwise pass ASLayoutElementParentDimensionUndefined
|
||||||
// as the size will depend on the content
|
// as the size will depend on the content
|
||||||
// TODO: layout: isValidForLayout() call should not be necessary if INFINITY is used
|
// TODO: layout: isValidForLayout() call should not be necessary if INFINITY is used
|
||||||
CGSize size = {
|
CGSize size = {
|
||||||
isinf(constrainedSize.max.width) || !ASPointsAreValidForLayout(constrainedSize.max.width) ? ASLayoutableParentDimensionUndefined : constrainedSize.max.width,
|
isinf(constrainedSize.max.width) || !ASPointsAreValidForLayout(constrainedSize.max.width) ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.width,
|
||||||
isinf(constrainedSize.max.height) || !ASPointsAreValidForLayout(constrainedSize.max.height) ? ASLayoutableParentDimensionUndefined : constrainedSize.max.height
|
isinf(constrainedSize.max.height) || !ASPointsAreValidForLayout(constrainedSize.max.height) ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.height
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOL reduceWidth = (_horizontalPosition & ASRelativeLayoutSpecPositionCenter) != 0 ||
|
BOOL reduceWidth = (_horizontalPosition & ASRelativeLayoutSpecPositionCenter) != 0 ||
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
ASRoundPixelValue((size.height - sublayout.size.height) * yPosition)
|
ASRoundPixelValue((size.height - sublayout.size.height) * yPosition)
|
||||||
};
|
};
|
||||||
|
|
||||||
return [ASLayout layoutWithLayoutable:self size:size sublayouts:@[sublayout]];
|
return [ASLayout layoutWithLayoutElement:self size:size sublayouts:@[sublayout]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)proportionOfAxisForAxisPosition:(ASRelativeLayoutSpecPosition)position
|
- (CGFloat)proportionOfAxisForAxisPosition:(ASRelativeLayoutSpecPosition)position
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@param spacing The spacing between the children
|
@param spacing The spacing between the children
|
||||||
@param justifyContent If no children are flexible, this describes how to fill any extra space
|
@param justifyContent If no children are flexible, this describes how to fill any extra space
|
||||||
@param alignItems Orientation of the children along the cross axis
|
@param alignItems Orientation of the children along the cross axis
|
||||||
@param children ASLayoutable children to be positioned.
|
@param children ASLayoutElement children to be positioned.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems children:(NSArray<id<ASLayoutable>> *)children;
|
+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems children:(NSArray<id<ASLayoutElement>> *)children;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A stack layout spec with direction of ASStackLayoutDirectionVertical
|
* @return A stack layout spec with direction of ASStackLayoutDirectionVertical
|
||||||
|
|||||||
@@ -120,13 +120,13 @@
|
|||||||
|
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
{
|
{
|
||||||
std::vector<id<ASLayoutable>> stackChildren;
|
std::vector<id<ASLayoutElement>> stackChildren;
|
||||||
for (id<ASLayoutable> child in self.children) {
|
for (id<ASLayoutElement> child in self.children) {
|
||||||
stackChildren.push_back(child);
|
stackChildren.push_back(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stackChildren.empty()) {
|
if (stackChildren.empty()) {
|
||||||
return [ASLayout layoutWithLayoutable:self size:constrainedSize.min];
|
return [ASLayout layoutWithLayoutElement:self size:constrainedSize.min];
|
||||||
}
|
}
|
||||||
|
|
||||||
ASStackLayoutSpecStyle style = {.direction = _direction, .spacing = _spacing, .justifyContent = _justifyContent, .alignItems = _alignItems, .baselineRelativeArrangement = _baselineRelativeArrangement};
|
ASStackLayoutSpecStyle style = {.direction = _direction, .spacing = _spacing, .justifyContent = _justifyContent, .alignItems = _alignItems, .baselineRelativeArrangement = _baselineRelativeArrangement};
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
sublayouts = [NSArray arrayWithObjects:&positionedLayout.sublayouts[0] count:positionedLayout.sublayouts.size()];
|
sublayouts = [NSArray arrayWithObjects:&positionedLayout.sublayouts[0] count:positionedLayout.sublayouts.size()];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [ASLayout layoutWithLayoutable:self size:ASSizeRangeClamp(constrainedSize, finalSize) sublayouts:sublayouts];
|
return [ASLayout layoutWithLayoutElement:self size:ASSizeRangeClamp(constrainedSize, finalSize) sublayouts:sublayouts];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resolveHorizontalAlignment
|
- (void)resolveHorizontalAlignment
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
|
|
||||||
@implementation ASStackLayoutSpec (Debugging)
|
@implementation ASStackLayoutSpec (Debugging)
|
||||||
|
|
||||||
#pragma mark - ASLayoutableAsciiArtProtocol
|
#pragma mark - ASLayoutElementAsciiArtProtocol
|
||||||
|
|
||||||
- (NSString *)asciiArtString
|
- (NSString *)asciiArtString
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout options that can be defined for an ASLayoutable being added to a ASStackLayoutSpec.
|
* Layout options that can be defined for an ASLayoutElement being added to a ASStackLayoutSpec.
|
||||||
*/
|
*/
|
||||||
@protocol ASStackLayoutable <NSObject>
|
@protocol ASStackLayoutable <NSObject>
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
|
|||||||
@protected
|
@protected
|
||||||
ASDisplayNode * __weak _supernode;
|
ASDisplayNode * __weak _supernode;
|
||||||
|
|
||||||
ASLayoutableStyle *_style;
|
ASLayoutElementStyle *_style;
|
||||||
ASLayoutableSize _size;
|
|
||||||
|
|
||||||
ASSentinel *_displaySentinel;
|
ASSentinel *_displaySentinel;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
@interface ASLayoutSpec() {
|
@interface ASLayoutSpec() {
|
||||||
ASDN::RecursiveMutex __instanceLock__;
|
ASDN::RecursiveMutex __instanceLock__;
|
||||||
ASEnvironmentState _environmentState;
|
ASEnvironmentState _environmentState;
|
||||||
ASLayoutableStyle *_style;
|
ASLayoutElementStyle *_style;
|
||||||
NSMutableArray *_childrenArray;
|
NSMutableArray *_childrenArray;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#import "ASEqualityHelpers.h"
|
#import "ASEqualityHelpers.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search the whole layout stack if at least one layout has a layoutable object that can not be layed out asynchronous.
|
* Search the whole layout stack if at least one layout has a layoutElement object that can not be layed out asynchronous.
|
||||||
* This can be the case for example if a node was already loaded
|
* This can be the case for example if a node was already loaded
|
||||||
*/
|
*/
|
||||||
static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
||||||
@@ -34,7 +34,7 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
|||||||
layout = queue.front();
|
layout = queue.front();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
|
|
||||||
if (layout.layoutable.canLayoutAsynchronous == NO) {
|
if (layout.layoutElement.canLayoutAsynchronous == NO) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
|||||||
insertions:&insertions
|
insertions:&insertions
|
||||||
deletions:&deletions
|
deletions:&deletions
|
||||||
compareBlock:^BOOL(ASLayout *lhs, ASLayout *rhs) {
|
compareBlock:^BOOL(ASLayout *lhs, ASLayout *rhs) {
|
||||||
return ASObjectIsEqual(lhs.layoutable, rhs.layoutable);
|
return ASObjectIsEqual(lhs.layoutElement, rhs.layoutElement);
|
||||||
}];
|
}];
|
||||||
_insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, insertions, &_insertedSubnodes);
|
_insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, insertions, &_insertedSubnodes);
|
||||||
_removedSubnodePositions = findNodesInLayoutAtIndexesWithFilteredNodes(previousLayout,
|
_removedSubnodePositions = findNodesInLayoutAtIndexesWithFilteredNodes(previousLayout,
|
||||||
@@ -221,7 +221,7 @@ static inline std::vector<NSUInteger> findNodesInLayoutAtIndexesWithFilteredNode
|
|||||||
for (ASLayout *sublayout in layout.sublayouts) {
|
for (ASLayout *sublayout in layout.sublayouts) {
|
||||||
if (idx > lastIndex) { break; }
|
if (idx > lastIndex) { break; }
|
||||||
if (idx >= firstIndex && [indexes containsIndex:idx]) {
|
if (idx >= firstIndex && [indexes containsIndex:idx]) {
|
||||||
ASDisplayNode *node = (ASDisplayNode *)sublayout.layoutable;
|
ASDisplayNode *node = (ASDisplayNode *)sublayout.layoutElement;
|
||||||
ASDisplayNodeCAssert(node, @"A flattened layout must consist exclusively of node sublayouts");
|
ASDisplayNodeCAssert(node, @"A flattened layout must consist exclusively of node sublayouts");
|
||||||
// Ignore the odd case in which a non-node sublayout is accessed and the type cast fails
|
// Ignore the odd case in which a non-node sublayout is accessed and the type cast fails
|
||||||
if (node != nil) {
|
if (node != nil) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
static CGFloat baselineForItem(const ASStackLayoutSpecStyle &style,
|
static CGFloat baselineForItem(const ASStackLayoutSpecStyle &style,
|
||||||
const ASLayout *layout) {
|
const ASLayout *layout) {
|
||||||
|
|
||||||
__weak id<ASLayoutable> child = layout.layoutable;
|
__weak id<ASLayoutElement> child = layout.layoutElement;
|
||||||
switch (style.alignItems) {
|
switch (style.alignItems) {
|
||||||
case ASStackLayoutAlignItemsBaselineFirst:
|
case ASStackLayoutAlignItemsBaselineFirst:
|
||||||
return child.style.ascender;
|
return child.style.ascender;
|
||||||
@@ -33,7 +33,7 @@ static CGFloat baselineOffset(const ASStackLayoutSpecStyle &style,
|
|||||||
const CGFloat maxBaseline)
|
const CGFloat maxBaseline)
|
||||||
{
|
{
|
||||||
if (style.direction == ASStackLayoutDirectionHorizontal) {
|
if (style.direction == ASStackLayoutDirectionHorizontal) {
|
||||||
__weak id<ASLayoutable> child = l.layoutable;
|
__weak id<ASLayoutElement> child = l.layoutElement;
|
||||||
switch (style.alignItems) {
|
switch (style.alignItems) {
|
||||||
case ASStackLayoutAlignItemsBaselineFirst:
|
case ASStackLayoutAlignItemsBaselineFirst:
|
||||||
return maxAscender - child.style.ascender;
|
return maxAscender - child.style.ascender;
|
||||||
@@ -89,9 +89,9 @@ ASStackBaselinePositionedLayout ASStackBaselinePositionedLayout::compute(const A
|
|||||||
our layoutSpec to have it so that it can be baseline aligned with another text node or baseline layout spec.
|
our layoutSpec to have it so that it can be baseline aligned with another text node or baseline layout spec.
|
||||||
*/
|
*/
|
||||||
const auto ascenderIt = std::max_element(positionedLayout.sublayouts.begin(), positionedLayout.sublayouts.end(), [&](const ASLayout *a, const ASLayout *b){
|
const auto ascenderIt = std::max_element(positionedLayout.sublayouts.begin(), positionedLayout.sublayouts.end(), [&](const ASLayout *a, const ASLayout *b){
|
||||||
return a.layoutable.style.ascender < b.layoutable.style.ascender;
|
return a.layoutElement.style.ascender < b.layoutElement.style.ascender;
|
||||||
});
|
});
|
||||||
const CGFloat maxAscender = ascenderIt == positionedLayout.sublayouts.end() ? 0 : (*ascenderIt).layoutable.style.ascender;
|
const CGFloat maxAscender = ascenderIt == positionedLayout.sublayouts.end() ? 0 : (*ascenderIt).layoutElement.style.ascender;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Step 3: Take each child and update its layout position based on the baseline offset.
|
Step 3: Take each child and update its layout position based on the baseline offset.
|
||||||
@@ -108,7 +108,7 @@ ASStackBaselinePositionedLayout ASStackBaselinePositionedLayout::compute(const A
|
|||||||
CGPoint p = CGPointZero;
|
CGPoint p = CGPointZero;
|
||||||
BOOL first = YES;
|
BOOL first = YES;
|
||||||
stackedChildren = AS::map(positionedLayout.sublayouts, [&](ASLayout *l) -> ASLayout *{
|
stackedChildren = AS::map(positionedLayout.sublayouts, [&](ASLayout *l) -> ASLayout *{
|
||||||
__weak id<ASLayoutable> child = l.layoutable;
|
__weak id<ASLayoutElement> child = l.layoutElement;
|
||||||
p = p + directionPoint(style.direction, child.style.spacingBefore, 0);
|
p = p + directionPoint(style.direction, child.style.spacingBefore, 0);
|
||||||
if (first) {
|
if (first) {
|
||||||
// if this is the first item use the previously computed start point
|
// if this is the first item use the previously computed start point
|
||||||
@@ -156,12 +156,12 @@ ASStackBaselinePositionedLayout ASStackBaselinePositionedLayout::compute(const A
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Step 5: finally, we must find the smallest descender (descender is negative). This is since ASBaselineLayoutSpec implements
|
Step 5: finally, we must find the smallest descender (descender is negative). This is since ASBaselineLayoutSpec implements
|
||||||
ASLayoutable and needs an ascender and descender to lay itself out properly.
|
ASLayoutElement and needs an ascender and descender to lay itself out properly.
|
||||||
*/
|
*/
|
||||||
const auto descenderIt = std::max_element(stackedChildren.begin(), stackedChildren.end(), [&](const ASLayout *a, const ASLayout *b){
|
const auto descenderIt = std::max_element(stackedChildren.begin(), stackedChildren.end(), [&](const ASLayout *a, const ASLayout *b){
|
||||||
return a.position.y + a.size.height < b.position.y + b.size.height;
|
return a.position.y + a.size.height < b.position.y + b.size.height;
|
||||||
});
|
});
|
||||||
const CGFloat minDescender = descenderIt == stackedChildren.end() ? 0 : (*descenderIt).layoutable.style.descender;
|
const CGFloat minDescender = descenderIt == stackedChildren.end() ? 0 : (*descenderIt).layoutElement.style.descender;
|
||||||
|
|
||||||
return {stackedChildren, crossSize, maxAscender, minDescender};
|
return {stackedChildren, crossSize, maxAscender, minDescender};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
struct ASStackUnpositionedItem {
|
struct ASStackUnpositionedItem {
|
||||||
/** The original source child. */
|
/** The original source child. */
|
||||||
id<ASLayoutable> child;
|
id<ASLayoutElement> child;
|
||||||
/** The proposed layout. */
|
/** The proposed layout. */
|
||||||
ASLayout *layout;
|
ASLayout *layout;
|
||||||
};
|
};
|
||||||
@@ -31,7 +31,7 @@ struct ASStackUnpositionedLayout {
|
|||||||
const CGFloat violation;
|
const CGFloat violation;
|
||||||
|
|
||||||
/** Given a set of children, computes the unpositioned layouts for those children. */
|
/** Given a set of children, computes the unpositioned layouts for those children. */
|
||||||
static ASStackUnpositionedLayout compute(const std::vector<id<ASLayoutable>> &children,
|
static ASStackUnpositionedLayout compute(const std::vector<id<ASLayoutElement>> &children,
|
||||||
const ASStackLayoutSpecStyle &style,
|
const ASStackLayoutSpecStyle &style,
|
||||||
const ASSizeRange &sizeRange);
|
const ASSizeRange &sizeRange);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,34 +16,34 @@
|
|||||||
#import "ASLayoutSpecUtilities.h"
|
#import "ASLayoutSpecUtilities.h"
|
||||||
|
|
||||||
static CGFloat resolveCrossDimensionMaxForStretchChild(const ASStackLayoutSpecStyle &style,
|
static CGFloat resolveCrossDimensionMaxForStretchChild(const ASStackLayoutSpecStyle &style,
|
||||||
const id<ASLayoutable>child,
|
const id<ASLayoutElement>child,
|
||||||
const CGFloat stackMax,
|
const CGFloat stackMax,
|
||||||
const CGFloat crossMax)
|
const CGFloat crossMax)
|
||||||
{
|
{
|
||||||
// stretched children may have a cross direction max that is smaller than the minimum size constraint of the parent.
|
// stretched children may have a cross direction max that is smaller than the minimum size constraint of the parent.
|
||||||
|
|
||||||
const CGFloat computedMax = (style.direction == ASStackLayoutDirectionVertical ?
|
const CGFloat computedMax = (style.direction == ASStackLayoutDirectionVertical ?
|
||||||
ASLayoutableSizeResolve(child.style.size, ASLayoutableParentSizeUndefined).max.width :
|
ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).max.width :
|
||||||
ASLayoutableSizeResolve(child.style.size, ASLayoutableParentSizeUndefined).max.height);
|
ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).max.height);
|
||||||
return computedMax == INFINITY ? crossMax : computedMax;
|
return computedMax == INFINITY ? crossMax : computedMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CGFloat resolveCrossDimensionMinForStretchChild(const ASStackLayoutSpecStyle &style,
|
static CGFloat resolveCrossDimensionMinForStretchChild(const ASStackLayoutSpecStyle &style,
|
||||||
const id<ASLayoutable>child,
|
const id<ASLayoutElement>child,
|
||||||
const CGFloat stackMax,
|
const CGFloat stackMax,
|
||||||
const CGFloat crossMin)
|
const CGFloat crossMin)
|
||||||
{
|
{
|
||||||
// stretched children will have a cross dimension of at least crossMin, unless they explicitly define a child size
|
// stretched children will have a cross dimension of at least crossMin, unless they explicitly define a child size
|
||||||
// that is smaller than the constraint of the parent.
|
// that is smaller than the constraint of the parent.
|
||||||
return (style.direction == ASStackLayoutDirectionVertical ?
|
return (style.direction == ASStackLayoutDirectionVertical ?
|
||||||
ASLayoutableSizeResolve(child.style.size, ASLayoutableParentSizeUndefined).min.width :
|
ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).min.width :
|
||||||
ASLayoutableSizeResolve(child.style.size, ASLayoutableParentSizeUndefined).min.height) ?: crossMin;
|
ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).min.height) ?: crossMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sizes the child given the parameters specified, and returns the computed layout.
|
Sizes the child given the parameters specified, and returns the computed layout.
|
||||||
*/
|
*/
|
||||||
static ASLayout *crossChildLayout(const id<ASLayoutable> child,
|
static ASLayout *crossChildLayout(const id<ASLayoutElement> child,
|
||||||
const ASStackLayoutSpecStyle style,
|
const ASStackLayoutSpecStyle style,
|
||||||
const CGFloat stackMin,
|
const CGFloat stackMin,
|
||||||
const CGFloat stackMax,
|
const CGFloat stackMax,
|
||||||
@@ -60,7 +60,7 @@ static ASLayout *crossChildLayout(const id<ASLayoutable> child,
|
|||||||
const ASSizeRange childSizeRange = directionSizeRange(style.direction, stackMin, stackMax, childCrossMin, childCrossMax);
|
const ASSizeRange childSizeRange = directionSizeRange(style.direction, stackMin, stackMax, childCrossMin, childCrossMax);
|
||||||
ASLayout *layout = [child layoutThatFits:childSizeRange parentSize:size];
|
ASLayout *layout = [child layoutThatFits:childSizeRange parentSize:size];
|
||||||
ASDisplayNodeCAssertNotNil(layout, @"ASLayout returned from measureWithSizeRange: must not be nil: %@", child);
|
ASDisplayNodeCAssertNotNil(layout, @"ASLayout returned from measureWithSizeRange: must not be nil: %@", child);
|
||||||
return layout ? : [ASLayout layoutWithLayoutable:child size:{0, 0}];
|
return layout ? : [ASLayout layoutWithLayoutElement:child size:{0, 0}];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,7 +207,7 @@ static std::function<CGFloat(const ASStackUnpositionedItem &, BOOL)> flexAdjustm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASDISPLAYNODE_INLINE BOOL isFlexibleInBothDirections(id<ASLayoutable> child)
|
ASDISPLAYNODE_INLINE BOOL isFlexibleInBothDirections(id<ASLayoutElement> child)
|
||||||
{
|
{
|
||||||
return child.style.flexGrow > 0 && child.style.flexShrink > 0;
|
return child.style.flexGrow > 0 && child.style.flexShrink > 0;
|
||||||
}
|
}
|
||||||
@@ -222,7 +222,7 @@ static void layoutFlexibleChildrenAtZeroSize(std::vector<ASStackUnpositionedItem
|
|||||||
const CGSize size)
|
const CGSize size)
|
||||||
{
|
{
|
||||||
for (ASStackUnpositionedItem &item : items) {
|
for (ASStackUnpositionedItem &item : items) {
|
||||||
const id<ASLayoutable> child = item.child;
|
const id<ASLayoutElement> child = item.child;
|
||||||
if (isFlexibleInBothDirections(child)) {
|
if (isFlexibleInBothDirections(child)) {
|
||||||
item.layout = crossChildLayout(child,
|
item.layout = crossChildLayout(child,
|
||||||
style,
|
style,
|
||||||
@@ -257,7 +257,7 @@ static CGFloat computeStackDimensionSum(const std::vector<ASStackUnpositionedIte
|
|||||||
// Start from default spacing between each child:
|
// Start from default spacing between each child:
|
||||||
children.empty() ? 0 : style.spacing * (children.size() - 1),
|
children.empty() ? 0 : style.spacing * (children.size() - 1),
|
||||||
[&](CGFloat x, const ASStackUnpositionedItem &l) {
|
[&](CGFloat x, const ASStackUnpositionedItem &l) {
|
||||||
const id<ASLayoutable> child = l.child;
|
const id<ASLayoutElement> child = l.child;
|
||||||
return x + child.style.spacingBefore + child.style.spacingAfter;
|
return x + child.style.spacingBefore + child.style.spacingAfter;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ static CGFloat computeViolation(const CGFloat stackDimensionSum,
|
|||||||
If we have a single flexible (both shrinkable and growable) child, and our allowed size range is set to a specific
|
If we have a single flexible (both shrinkable and growable) child, and our allowed size range is set to a specific
|
||||||
number then we may avoid the first "intrinsic" size calculation.
|
number then we may avoid the first "intrinsic" size calculation.
|
||||||
*/
|
*/
|
||||||
ASDISPLAYNODE_INLINE BOOL useOptimizedFlexing(const std::vector<id<ASLayoutable>> &children,
|
ASDISPLAYNODE_INLINE BOOL useOptimizedFlexing(const std::vector<id<ASLayoutElement>> &children,
|
||||||
const ASStackLayoutSpecStyle &style,
|
const ASStackLayoutSpecStyle &style,
|
||||||
const ASSizeRange &sizeRange)
|
const ASSizeRange &sizeRange)
|
||||||
{
|
{
|
||||||
@@ -389,7 +389,7 @@ static void flexChildrenAlongStackDimension(std::vector<ASStackUnpositionedItem>
|
|||||||
Performs the first unconstrained layout of the children, generating the unpositioned items that are then flexed and
|
Performs the first unconstrained layout of the children, generating the unpositioned items that are then flexed and
|
||||||
stretched.
|
stretched.
|
||||||
*/
|
*/
|
||||||
static std::vector<ASStackUnpositionedItem> layoutChildrenAlongUnconstrainedStackDimension(const std::vector<id<ASLayoutable>> &children,
|
static std::vector<ASStackUnpositionedItem> layoutChildrenAlongUnconstrainedStackDimension(const std::vector<id<ASLayoutElement>> &children,
|
||||||
const ASStackLayoutSpecStyle &style,
|
const ASStackLayoutSpecStyle &style,
|
||||||
const ASSizeRange &sizeRange,
|
const ASSizeRange &sizeRange,
|
||||||
const CGSize size,
|
const CGSize size,
|
||||||
@@ -397,9 +397,9 @@ static std::vector<ASStackUnpositionedItem> layoutChildrenAlongUnconstrainedStac
|
|||||||
{
|
{
|
||||||
const CGFloat minCrossDimension = crossDimension(style.direction, sizeRange.min);
|
const CGFloat minCrossDimension = crossDimension(style.direction, sizeRange.min);
|
||||||
const CGFloat maxCrossDimension = crossDimension(style.direction, sizeRange.max);
|
const CGFloat maxCrossDimension = crossDimension(style.direction, sizeRange.max);
|
||||||
return AS::map(children, [&](id<ASLayoutable> child) -> ASStackUnpositionedItem {
|
return AS::map(children, [&](id<ASLayoutElement> child) -> ASStackUnpositionedItem {
|
||||||
if (useOptimizedFlexing && isFlexibleInBothDirections(child)) {
|
if (useOptimizedFlexing && isFlexibleInBothDirections(child)) {
|
||||||
return { child, [ASLayout layoutWithLayoutable:child size:{0, 0}] };
|
return { child, [ASLayout layoutWithLayoutElement:child size:{0, 0}] };
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
child,
|
child,
|
||||||
@@ -415,15 +415,15 @@ static std::vector<ASStackUnpositionedItem> layoutChildrenAlongUnconstrainedStac
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ASStackUnpositionedLayout ASStackUnpositionedLayout::compute(const std::vector<id<ASLayoutable>> &children,
|
ASStackUnpositionedLayout ASStackUnpositionedLayout::compute(const std::vector<id<ASLayoutElement>> &children,
|
||||||
const ASStackLayoutSpecStyle &style,
|
const ASStackLayoutSpecStyle &style,
|
||||||
const ASSizeRange &sizeRange)
|
const ASSizeRange &sizeRange)
|
||||||
{
|
{
|
||||||
// If we have a fixed size in either dimension, pass it to children so they can resolve percentages against it.
|
// If we have a fixed size in either dimension, pass it to children so they can resolve percentages against it.
|
||||||
// Otherwise, we pass ASLayoutableParentDimensionUndefined since it will depend on the content.
|
// Otherwise, we pass ASLayoutElementParentDimensionUndefined since it will depend on the content.
|
||||||
const CGSize size = {
|
const CGSize size = {
|
||||||
(sizeRange.min.width == sizeRange.max.width) ? sizeRange.min.width : ASLayoutableParentDimensionUndefined,
|
(sizeRange.min.width == sizeRange.max.width) ? sizeRange.min.width : ASLayoutElementParentDimensionUndefined,
|
||||||
(sizeRange.min.height == sizeRange.max.height) ? sizeRange.min.height : ASLayoutableParentDimensionUndefined,
|
(sizeRange.min.height == sizeRange.max.height) ? sizeRange.min.height : ASLayoutElementParentDimensionUndefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
// We may be able to avoid some redundant layout passes
|
// We may be able to avoid some redundant layout passes
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ NSString * const ASTransitionContextToLayoutKey = @"org.asyncdisplaykit.ASTransi
|
|||||||
- (CGRect)finalFrameForNode:(ASDisplayNode *)node
|
- (CGRect)finalFrameForNode:(ASDisplayNode *)node
|
||||||
{
|
{
|
||||||
for (ASLayout *layout in [self layoutForKey:ASTransitionContextToLayoutKey].sublayouts) {
|
for (ASLayout *layout in [self layoutForKey:ASTransitionContextToLayoutKey].sublayouts) {
|
||||||
if (layout.layoutable == node) {
|
if (layout.layoutElement == node) {
|
||||||
return [layout frame];
|
return [layout frame];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ NSString * const ASTransitionContextToLayoutKey = @"org.asyncdisplaykit.ASTransi
|
|||||||
{
|
{
|
||||||
NSMutableArray<ASDisplayNode *> *subnodes = [NSMutableArray array];
|
NSMutableArray<ASDisplayNode *> *subnodes = [NSMutableArray array];
|
||||||
for (ASLayout *sublayout in [self layoutForKey:key].sublayouts) {
|
for (ASLayout *sublayout in [self layoutForKey:key].sublayouts) {
|
||||||
[subnodes addObject:(ASDisplayNode *)sublayout.layoutable];
|
[subnodes addObject:(ASDisplayNode *)sublayout.layoutElement];
|
||||||
}
|
}
|
||||||
return subnodes;
|
return subnodes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ASLayoutableStyleTests.mm
|
// ASLayoutElementStyleTests.mm
|
||||||
// AsyncDisplayKit
|
// AsyncDisplayKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||||
@@ -9,15 +9,15 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <XCTest/XCTest.h>
|
#import <XCTest/XCTest.h>
|
||||||
#import "ASLayoutable.h"
|
#import "ASLayoutElement.h"
|
||||||
|
|
||||||
#pragma mark - ASLayoutableStyleTestsDelegate
|
#pragma mark - ASLayoutElementStyleTestsDelegate
|
||||||
|
|
||||||
@interface ASLayoutableStyleTestsDelegate : NSObject<ASLayoutableStyleDelegate>
|
@interface ASLayoutElementStyleTestsDelegate : NSObject<ASLayoutElementStyleDelegate>
|
||||||
@property (copy, nonatomic) NSString *propertyNameChanged;
|
@property (copy, nonatomic) NSString *propertyNameChanged;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ASLayoutableStyleTestsDelegate
|
@implementation ASLayoutElementStyleTestsDelegate
|
||||||
|
|
||||||
- (void)style:(id)style propertyDidChange:(NSString *)propertyName
|
- (void)style:(id)style propertyDidChange:(NSString *)propertyName
|
||||||
{
|
{
|
||||||
@@ -26,17 +26,17 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma mark - ASLayoutableStyleTests
|
#pragma mark - ASLayoutElementStyleTests
|
||||||
|
|
||||||
@interface ASLayoutableStyleTests : XCTestCase
|
@interface ASLayoutElementStyleTests : XCTestCase
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ASLayoutableStyleTests
|
@implementation ASLayoutElementStyleTests
|
||||||
|
|
||||||
- (void)testSettingSizeProperties
|
- (void)testSettingSizeProperties
|
||||||
{
|
{
|
||||||
ASLayoutableStyle *style = [ASLayoutableStyle new];
|
ASLayoutElementStyle *style = [ASLayoutElementStyle new];
|
||||||
style.width = ASDimensionMake(100);
|
style.width = ASDimensionMake(100);
|
||||||
style.height = ASDimensionMake(100);
|
style.height = ASDimensionMake(100);
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
- (void)testSettingSizeViaHelper
|
- (void)testSettingSizeViaHelper
|
||||||
{
|
{
|
||||||
ASLayoutableStyle *style = [ASLayoutableStyle new];
|
ASLayoutElementStyle *style = [ASLayoutElementStyle new];
|
||||||
[style setSizeWithCGSize:CGSizeMake(100, 100)];
|
[style setSizeWithCGSize:CGSizeMake(100, 100)];
|
||||||
|
|
||||||
XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100)));
|
XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100)));
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
- (void)testSettingExactSize
|
- (void)testSettingExactSize
|
||||||
{
|
{
|
||||||
ASLayoutableStyle *style = [ASLayoutableStyle new];
|
ASLayoutElementStyle *style = [ASLayoutElementStyle new];
|
||||||
[style setExactSizeWithCGSize:CGSizeMake(100, 100)];
|
[style setExactSizeWithCGSize:CGSizeMake(100, 100)];
|
||||||
|
|
||||||
XCTAssertTrue(ASDimensionEqualToDimension(style.minWidth, ASDimensionMake(100)));
|
XCTAssertTrue(ASDimensionEqualToDimension(style.minWidth, ASDimensionMake(100)));
|
||||||
@@ -66,12 +66,12 @@
|
|||||||
|
|
||||||
- (void)testSettingPropertiesWillCallDelegate
|
- (void)testSettingPropertiesWillCallDelegate
|
||||||
{
|
{
|
||||||
ASLayoutableStyleTestsDelegate *delegate = [ASLayoutableStyleTestsDelegate new];
|
ASLayoutElementStyleTestsDelegate *delegate = [ASLayoutElementStyleTestsDelegate new];
|
||||||
ASLayoutableStyle *style = [[ASLayoutableStyle alloc] initWithDelegate:delegate];
|
ASLayoutElementStyle *style = [[ASLayoutElementStyle alloc] initWithDelegate:delegate];
|
||||||
XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionAuto));
|
XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionAuto));
|
||||||
style.width = ASDimensionMake(100);
|
style.width = ASDimensionMake(100);
|
||||||
XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100)));
|
XCTAssertTrue(ASDimensionEqualToDimension(style.width, ASDimensionMake(100)));
|
||||||
XCTAssertTrue([delegate.propertyNameChanged isEqualToString:ASLayoutableStyleWidthProperty]);
|
XCTAssertTrue([delegate.propertyNameChanged isEqualToString:ASLayoutElementStyleWidthProperty]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -48,7 +48,7 @@ static void setCGSizeToNode(CGSize size, ASDisplayNode *node)
|
|||||||
node.style.height = ASDimensionMakeWithPoints(size.height);
|
node.style.height = ASDimensionMakeWithPoints(size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testDefaultStackLayoutableFlexProperties
|
- (void)testDefaultStackLayoutElementFlexProperties
|
||||||
{
|
{
|
||||||
ASDisplayNode *displayNode = [[ASDisplayNode alloc] init];
|
ASDisplayNode *displayNode = [[ASDisplayNode alloc] init];
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
// 100% of container
|
// 100% of container
|
||||||
_node.style.width = ASDimensionMakeWithFraction(1.0);
|
_node.style.width = ASDimensionMakeWithFraction(1.0);
|
||||||
_node.style.height = ASDimensionMakeWithFraction(1.0);
|
_node.style.height = ASDimensionMakeWithFraction(1.0);
|
||||||
return [ASWrapperLayoutSpec wrapperWithLayoutable:_node];
|
return [ASWrapperLayoutSpec wrapperWithLayoutElement:_node];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - <ASCollectionDataSource, ASCollectionDelegate>
|
#pragma mark - <ASCollectionDataSource, ASCollectionDelegate>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ static UIColor *OverViewASPagerNodeRandomColor() {
|
|||||||
|
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
{
|
{
|
||||||
return [ASLayout layoutWithLayoutable:self size:constrainedSize.max];
|
return [ASLayout layoutWithLayoutElement:self size:constrainedSize.max];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -70,7 +70,7 @@ static UIColor *OverViewASPagerNodeRandomColor() {
|
|||||||
// 100% of container
|
// 100% of container
|
||||||
_node.style.width = ASDimensionMakeWithFraction(1.0);
|
_node.style.width = ASDimensionMakeWithFraction(1.0);
|
||||||
_node.style.height = ASDimensionMakeWithFraction(1.0);
|
_node.style.height = ASDimensionMakeWithFraction(1.0);
|
||||||
return [ASWrapperLayoutSpec wrapperWithLayoutable:_node];
|
return [ASWrapperLayoutSpec wrapperWithLayoutElement:_node];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode
|
- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
// 100% of container
|
// 100% of container
|
||||||
_node.style.width = ASDimensionMakeWithFraction(1.0);
|
_node.style.width = ASDimensionMakeWithFraction(1.0);
|
||||||
_node.style.height = ASDimensionMakeWithFraction(1.0);
|
_node.style.height = ASDimensionMakeWithFraction(1.0);
|
||||||
return [ASWrapperLayoutSpec wrapperWithLayoutable:_node];
|
return [ASWrapperLayoutSpec wrapperWithLayoutElement:_node];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
|
||||||
{
|
{
|
||||||
return [ASLayout layoutWithLayoutable:self size:constrainedSize.max];
|
return [ASLayout layoutWithLayoutElement:self size:constrainedSize.max];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)fetchData
|
- (void)fetchData
|
||||||
|
|||||||
Reference in New Issue
Block a user