Fix naming convetion:

- "Layout node" is changed to "layout spec".
- Update tests.
- Update Kittens sample.
This commit is contained in:
Huy Nguyen 2015-07-01 17:37:26 +07:00
parent eb5670032d
commit 2149d44990
140 changed files with 581 additions and 579 deletions

View File

@ -187,45 +187,45 @@
AC3C4A521A1139C100143C57 /* ASCollectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A501A1139C100143C57 /* ASCollectionView.mm */; };
AC3C4A541A113EEC00143C57 /* ASCollectionViewProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A531A113EEC00143C57 /* ASCollectionViewProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC47D9421B3B891B00AAEE9D /* ASCellNode.m in Sources */ = {isa = PBXBuildFile; fileRef = AC6456071B0A335000CF11B8 /* ASCellNode.m */; };
AC47D9451B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.h in Headers */ = {isa = PBXBuildFile; fileRef = AC47D9431B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC47D9461B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC47D9441B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.mm */; };
AC47D9451B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h in Headers */ = {isa = PBXBuildFile; fileRef = AC47D9431B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC47D9461B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC47D9441B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm */; };
AC6456091B0A335000CF11B8 /* ASCellNode.m in Sources */ = {isa = PBXBuildFile; fileRef = AC6456071B0A335000CF11B8 /* ASCellNode.m */; };
ACF6ED1A1B17843500DA7C62 /* ASBackgroundLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED1B1B17843500DA7C62 /* ASBackgroundLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutNode.mm */; };
ACF6ED1C1B17843500DA7C62 /* ASCenterLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED031B17843500DA7C62 /* ASCenterLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED1D1B17843500DA7C62 /* ASCenterLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED041B17843500DA7C62 /* ASCenterLayoutNode.mm */; };
ACF6ED1A1B17843500DA7C62 /* ASBackgroundLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED1B1B17843500DA7C62 /* ASBackgroundLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutSpec.mm */; };
ACF6ED1C1B17843500DA7C62 /* ASCenterLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED031B17843500DA7C62 /* ASCenterLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED1D1B17843500DA7C62 /* ASCenterLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED041B17843500DA7C62 /* ASCenterLayoutSpec.mm */; };
ACF6ED201B17843500DA7C62 /* ASDimension.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED071B17843500DA7C62 /* ASDimension.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED211B17843500DA7C62 /* ASDimension.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED081B17843500DA7C62 /* ASDimension.mm */; };
ACF6ED221B17843500DA7C62 /* ASInsetLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED091B17843500DA7C62 /* ASInsetLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED231B17843500DA7C62 /* ASInsetLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutNode.mm */; };
ACF6ED221B17843500DA7C62 /* ASInsetLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED231B17843500DA7C62 /* ASInsetLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */; };
ACF6ED241B17843500DA7C62 /* ASLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED0B1B17843500DA7C62 /* ASLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED251B17843500DA7C62 /* ASLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */; };
ACF6ED261B17843500DA7C62 /* ASLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED0D1B17843500DA7C62 /* ASLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED271B17843500DA7C62 /* ASLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0E1B17843500DA7C62 /* ASLayoutNode.mm */; };
ACF6ED261B17843500DA7C62 /* ASLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED271B17843500DA7C62 /* ASLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */; };
ACF6ED2A1B17843500DA7C62 /* ASLayoutable.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED111B17843500DA7C62 /* ASLayoutable.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED2B1B17843500DA7C62 /* ASOverlayLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED121B17843500DA7C62 /* ASOverlayLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED2C1B17843500DA7C62 /* ASOverlayLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED131B17843500DA7C62 /* ASOverlayLayoutNode.mm */; };
ACF6ED2D1B17843500DA7C62 /* ASRatioLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED141B17843500DA7C62 /* ASRatioLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED2E1B17843500DA7C62 /* ASRatioLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED151B17843500DA7C62 /* ASRatioLayoutNode.mm */; };
ACF6ED2F1B17843500DA7C62 /* ASStackLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED161B17843500DA7C62 /* ASStackLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED301B17843500DA7C62 /* ASStackLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED171B17843500DA7C62 /* ASStackLayoutNode.mm */; };
ACF6ED311B17843500DA7C62 /* ASStaticLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED181B17843500DA7C62 /* ASStaticLayoutNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED321B17843500DA7C62 /* ASStaticLayoutNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED191B17843500DA7C62 /* ASStaticLayoutNode.mm */; };
ACF6ED2B1B17843500DA7C62 /* ASOverlayLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED2C1B17843500DA7C62 /* ASOverlayLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED131B17843500DA7C62 /* ASOverlayLayoutSpec.mm */; };
ACF6ED2D1B17843500DA7C62 /* ASRatioLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED2E1B17843500DA7C62 /* ASRatioLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED151B17843500DA7C62 /* ASRatioLayoutSpec.mm */; };
ACF6ED2F1B17843500DA7C62 /* ASStackLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED161B17843500DA7C62 /* ASStackLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED301B17843500DA7C62 /* ASStackLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED171B17843500DA7C62 /* ASStackLayoutSpec.mm */; };
ACF6ED311B17843500DA7C62 /* ASStaticLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED181B17843500DA7C62 /* ASStaticLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED321B17843500DA7C62 /* ASStaticLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED191B17843500DA7C62 /* ASStaticLayoutSpec.mm */; };
ACF6ED4B1B17847A00DA7C62 /* ASInternalHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED431B17847A00DA7C62 /* ASInternalHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
ACF6ED4C1B17847A00DA7C62 /* ASInternalHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED441B17847A00DA7C62 /* ASInternalHelpers.mm */; };
ACF6ED4D1B17847A00DA7C62 /* ASLayoutNodeUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED451B17847A00DA7C62 /* ASLayoutNodeUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
ACF6ED4E1B17847A00DA7C62 /* ASStackLayoutNodeUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED461B17847A00DA7C62 /* ASStackLayoutNodeUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
ACF6ED4D1B17847A00DA7C62 /* ASLayoutSpecUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED451B17847A00DA7C62 /* ASLayoutSpecUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
ACF6ED4E1B17847A00DA7C62 /* ASStackLayoutSpecUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED461B17847A00DA7C62 /* ASStackLayoutSpecUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
ACF6ED4F1B17847A00DA7C62 /* ASStackPositionedLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED471B17847A00DA7C62 /* ASStackPositionedLayout.h */; settings = {ATTRIBUTES = (Private, ); }; };
ACF6ED501B17847A00DA7C62 /* ASStackPositionedLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED481B17847A00DA7C62 /* ASStackPositionedLayout.mm */; };
ACF6ED511B17847A00DA7C62 /* ASStackUnpositionedLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED491B17847A00DA7C62 /* ASStackUnpositionedLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED521B17847A00DA7C62 /* ASStackUnpositionedLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED4A1B17847A00DA7C62 /* ASStackUnpositionedLayout.mm */; };
ACF6ED5C1B178DC700DA7C62 /* ASCenterLayoutNodeSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED531B178DC700DA7C62 /* ASCenterLayoutNodeSnapshotTests.mm */; };
ACF6ED5C1B178DC700DA7C62 /* ASCenterLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED531B178DC700DA7C62 /* ASCenterLayoutSpecSnapshotTests.mm */; };
ACF6ED5D1B178DC700DA7C62 /* ASDimensionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED541B178DC700DA7C62 /* ASDimensionTests.mm */; };
ACF6ED5E1B178DC700DA7C62 /* ASInsetLayoutNodeSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED551B178DC700DA7C62 /* ASInsetLayoutNodeSnapshotTests.mm */; };
ACF6ED601B178DC700DA7C62 /* ASLayoutNodeSnapshotTestsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED581B178DC700DA7C62 /* ASLayoutNodeSnapshotTestsHelper.m */; };
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutNodeSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutNodeSnapshotTests.mm */; };
ACF6ED621B178DC700DA7C62 /* ASRatioLayoutNodeSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutNodeSnapshotTests.mm */; };
ACF6ED631B178DC700DA7C62 /* ASStackLayoutNodeSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutNodeSnapshotTests.mm */; };
ACF6ED5E1B178DC700DA7C62 /* ASInsetLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED551B178DC700DA7C62 /* ASInsetLayoutSpecSnapshotTests.mm */; };
ACF6ED601B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED581B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.m */; };
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */; };
ACF6ED621B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */; };
ACF6ED631B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */; };
B31A241E1B0114FD0016AE7A /* AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
B35061DF1B010EDF0018CF92 /* AsyncDisplayKit-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = B35061DE1B010EDF0018CF92 /* AsyncDisplayKit-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
B35061F31B010EFD0018CF92 /* ASCellNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 055F1A3A19ABD43F004DAFF1 /* ASCellNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -522,46 +522,46 @@
AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionView.h; sourceTree = "<group>"; };
AC3C4A501A1139C100143C57 /* ASCollectionView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASCollectionView.mm; sourceTree = "<group>"; };
AC3C4A531A113EEC00143C57 /* ASCollectionViewProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionViewProtocols.h; sourceTree = "<group>"; };
AC47D9431B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStaticLayoutNodeDimension.h; path = AsyncDisplayKit/Layout/ASStaticLayoutNodeDimension.h; sourceTree = "<group>"; };
AC47D9441B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASStaticLayoutNodeDimension.mm; path = AsyncDisplayKit/Layout/ASStaticLayoutNodeDimension.mm; sourceTree = "<group>"; };
AC47D9431B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStaticLayoutSpecDimension.h; path = AsyncDisplayKit/Layout/ASStaticLayoutSpecDimension.h; sourceTree = "<group>"; };
AC47D9441B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASStaticLayoutSpecDimension.mm; path = AsyncDisplayKit/Layout/ASStaticLayoutSpecDimension.mm; sourceTree = "<group>"; };
AC6456071B0A335000CF11B8 /* ASCellNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCellNode.m; sourceTree = "<group>"; };
ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASBackgroundLayoutNode.h; path = AsyncDisplayKit/Layout/ASBackgroundLayoutNode.h; sourceTree = "<group>"; };
ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASBackgroundLayoutNode.mm; path = AsyncDisplayKit/Layout/ASBackgroundLayoutNode.mm; sourceTree = "<group>"; };
ACF6ED031B17843500DA7C62 /* ASCenterLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASCenterLayoutNode.h; path = AsyncDisplayKit/Layout/ASCenterLayoutNode.h; sourceTree = "<group>"; };
ACF6ED041B17843500DA7C62 /* ASCenterLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASCenterLayoutNode.mm; path = AsyncDisplayKit/Layout/ASCenterLayoutNode.mm; sourceTree = "<group>"; };
ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASBackgroundLayoutSpec.h; path = AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h; sourceTree = "<group>"; };
ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASBackgroundLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm; sourceTree = "<group>"; };
ACF6ED031B17843500DA7C62 /* ASCenterLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASCenterLayoutSpec.h; path = AsyncDisplayKit/Layout/ASCenterLayoutSpec.h; sourceTree = "<group>"; };
ACF6ED041B17843500DA7C62 /* ASCenterLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASCenterLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASCenterLayoutSpec.mm; sourceTree = "<group>"; };
ACF6ED071B17843500DA7C62 /* ASDimension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASDimension.h; path = AsyncDisplayKit/Layout/ASDimension.h; sourceTree = "<group>"; };
ACF6ED081B17843500DA7C62 /* ASDimension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASDimension.mm; path = AsyncDisplayKit/Layout/ASDimension.mm; sourceTree = "<group>"; };
ACF6ED091B17843500DA7C62 /* ASInsetLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASInsetLayoutNode.h; path = AsyncDisplayKit/Layout/ASInsetLayoutNode.h; sourceTree = "<group>"; };
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASInsetLayoutNode.mm; path = AsyncDisplayKit/Layout/ASInsetLayoutNode.mm; sourceTree = "<group>"; };
ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASInsetLayoutSpec.h; path = AsyncDisplayKit/Layout/ASInsetLayoutSpec.h; sourceTree = "<group>"; };
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASInsetLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASInsetLayoutSpec.mm; sourceTree = "<group>"; };
ACF6ED0B1B17843500DA7C62 /* ASLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayout.h; path = AsyncDisplayKit/Layout/ASLayout.h; sourceTree = "<group>"; };
ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASLayout.mm; path = AsyncDisplayKit/Layout/ASLayout.mm; sourceTree = "<group>"; };
ACF6ED0D1B17843500DA7C62 /* ASLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutNode.h; path = AsyncDisplayKit/Layout/ASLayoutNode.h; sourceTree = "<group>"; };
ACF6ED0E1B17843500DA7C62 /* ASLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASLayoutNode.mm; path = AsyncDisplayKit/Layout/ASLayoutNode.mm; 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>"; };
ACF6ED111B17843500DA7C62 /* ASLayoutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutable.h; path = AsyncDisplayKit/Layout/ASLayoutable.h; sourceTree = "<group>"; };
ACF6ED121B17843500DA7C62 /* ASOverlayLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASOverlayLayoutNode.h; path = AsyncDisplayKit/Layout/ASOverlayLayoutNode.h; sourceTree = "<group>"; };
ACF6ED131B17843500DA7C62 /* ASOverlayLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASOverlayLayoutNode.mm; path = AsyncDisplayKit/Layout/ASOverlayLayoutNode.mm; sourceTree = "<group>"; };
ACF6ED141B17843500DA7C62 /* ASRatioLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASRatioLayoutNode.h; path = AsyncDisplayKit/Layout/ASRatioLayoutNode.h; sourceTree = "<group>"; };
ACF6ED151B17843500DA7C62 /* ASRatioLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASRatioLayoutNode.mm; path = AsyncDisplayKit/Layout/ASRatioLayoutNode.mm; sourceTree = "<group>"; };
ACF6ED161B17843500DA7C62 /* ASStackLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutNode.h; path = AsyncDisplayKit/Layout/ASStackLayoutNode.h; sourceTree = "<group>"; };
ACF6ED171B17843500DA7C62 /* ASStackLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASStackLayoutNode.mm; path = AsyncDisplayKit/Layout/ASStackLayoutNode.mm; sourceTree = "<group>"; };
ACF6ED181B17843500DA7C62 /* ASStaticLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStaticLayoutNode.h; path = AsyncDisplayKit/Layout/ASStaticLayoutNode.h; sourceTree = "<group>"; };
ACF6ED191B17843500DA7C62 /* ASStaticLayoutNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASStaticLayoutNode.mm; path = AsyncDisplayKit/Layout/ASStaticLayoutNode.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
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>"; };
ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASRatioLayoutSpec.h; path = AsyncDisplayKit/Layout/ASRatioLayoutSpec.h; sourceTree = "<group>"; };
ACF6ED151B17843500DA7C62 /* ASRatioLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASRatioLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASRatioLayoutSpec.mm; sourceTree = "<group>"; };
ACF6ED161B17843500DA7C62 /* ASStackLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutSpec.h; path = AsyncDisplayKit/Layout/ASStackLayoutSpec.h; sourceTree = "<group>"; };
ACF6ED171B17843500DA7C62 /* ASStackLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASStackLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASStackLayoutSpec.mm; sourceTree = "<group>"; };
ACF6ED181B17843500DA7C62 /* ASStaticLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStaticLayoutSpec.h; path = AsyncDisplayKit/Layout/ASStaticLayoutSpec.h; sourceTree = "<group>"; };
ACF6ED191B17843500DA7C62 /* ASStaticLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASStaticLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
ACF6ED431B17847A00DA7C62 /* ASInternalHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASInternalHelpers.h; sourceTree = "<group>"; };
ACF6ED441B17847A00DA7C62 /* ASInternalHelpers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASInternalHelpers.mm; sourceTree = "<group>"; };
ACF6ED451B17847A00DA7C62 /* ASLayoutNodeUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutNodeUtilities.h; sourceTree = "<group>"; };
ACF6ED461B17847A00DA7C62 /* ASStackLayoutNodeUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackLayoutNodeUtilities.h; sourceTree = "<group>"; };
ACF6ED451B17847A00DA7C62 /* ASLayoutSpecUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutSpecUtilities.h; sourceTree = "<group>"; };
ACF6ED461B17847A00DA7C62 /* ASStackLayoutSpecUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackLayoutSpecUtilities.h; sourceTree = "<group>"; };
ACF6ED471B17847A00DA7C62 /* ASStackPositionedLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackPositionedLayout.h; sourceTree = "<group>"; };
ACF6ED481B17847A00DA7C62 /* ASStackPositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackPositionedLayout.mm; sourceTree = "<group>"; };
ACF6ED491B17847A00DA7C62 /* ASStackUnpositionedLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASStackUnpositionedLayout.h; sourceTree = "<group>"; };
ACF6ED4A1B17847A00DA7C62 /* ASStackUnpositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = ASStackUnpositionedLayout.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
ACF6ED531B178DC700DA7C62 /* ASCenterLayoutNodeSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASCenterLayoutNodeSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED531B178DC700DA7C62 /* ASCenterLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASCenterLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED541B178DC700DA7C62 /* ASDimensionTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDimensionTests.mm; sourceTree = "<group>"; };
ACF6ED551B178DC700DA7C62 /* ASInsetLayoutNodeSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASInsetLayoutNodeSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED571B178DC700DA7C62 /* ASLayoutNodeSnapshotTestsHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutNodeSnapshotTestsHelper.h; sourceTree = "<group>"; };
ACF6ED581B178DC700DA7C62 /* ASLayoutNodeSnapshotTestsHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ASLayoutNodeSnapshotTestsHelper.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutNodeSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASOverlayLayoutNodeSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutNodeSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRatioLayoutNodeSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutNodeSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackLayoutNodeSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED551B178DC700DA7C62 /* ASInsetLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASInsetLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED571B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutSpecSnapshotTestsHelper.h; sourceTree = "<group>"; };
ACF6ED581B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ASLayoutSpecSnapshotTestsHelper.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASOverlayLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASRatioLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; };
B35061DA1B010EDF0018CF92 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B35061DD1B010EDF0018CF92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B35061DE1B010EDF0018CF92 /* AsyncDisplayKit-iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AsyncDisplayKit-iOS.h"; sourceTree = "<group>"; };
@ -730,13 +730,13 @@
056D21501ABCEDA1001107EF /* ASSnapshotTestCase.h */,
05EA6FE61AC0966E00E35788 /* ASSnapshotTestCase.mm */,
056D21541ABCEF50001107EF /* ASImageNodeSnapshotTests.m */,
ACF6ED531B178DC700DA7C62 /* ASCenterLayoutNodeSnapshotTests.mm */,
ACF6ED551B178DC700DA7C62 /* ASInsetLayoutNodeSnapshotTests.mm */,
ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutNodeSnapshotTests.mm */,
ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutNodeSnapshotTests.mm */,
ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutNodeSnapshotTests.mm */,
ACF6ED571B178DC700DA7C62 /* ASLayoutNodeSnapshotTestsHelper.h */,
ACF6ED581B178DC700DA7C62 /* ASLayoutNodeSnapshotTestsHelper.m */,
ACF6ED531B178DC700DA7C62 /* ASCenterLayoutSpecSnapshotTests.mm */,
ACF6ED551B178DC700DA7C62 /* ASInsetLayoutSpecSnapshotTests.mm */,
ACF6ED591B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm */,
ACF6ED5A1B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm */,
ACF6ED5B1B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm */,
ACF6ED571B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.h */,
ACF6ED581B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.m */,
242995D21B29743C00090100 /* ASBasicImageDownloaderTests.m */,
29CDC2E11AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m */,
296A0A341A951ABF005ACEAA /* ASBatchFetchingTests.m */,
@ -871,8 +871,8 @@
058D0A11195D050800B7D73C /* ASSentinel.m */,
ACF6ED431B17847A00DA7C62 /* ASInternalHelpers.h */,
ACF6ED441B17847A00DA7C62 /* ASInternalHelpers.mm */,
ACF6ED451B17847A00DA7C62 /* ASLayoutNodeUtilities.h */,
ACF6ED461B17847A00DA7C62 /* ASStackLayoutNodeUtilities.h */,
ACF6ED451B17847A00DA7C62 /* ASLayoutSpecUtilities.h */,
ACF6ED461B17847A00DA7C62 /* ASStackLayoutSpecUtilities.h */,
ACF6ED471B17847A00DA7C62 /* ASStackPositionedLayout.h */,
ACF6ED481B17847A00DA7C62 /* ASStackPositionedLayout.mm */,
ACF6ED491B17847A00DA7C62 /* ASStackUnpositionedLayout.h */,
@ -897,30 +897,30 @@
AC6456051B0A333200CF11B8 /* Layout */ = {
isa = PBXGroup;
children = (
ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutNode.h */,
ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutNode.mm */,
ACF6ED031B17843500DA7C62 /* ASCenterLayoutNode.h */,
ACF6ED041B17843500DA7C62 /* ASCenterLayoutNode.mm */,
ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutSpec.h */,
ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutSpec.mm */,
ACF6ED031B17843500DA7C62 /* ASCenterLayoutSpec.h */,
ACF6ED041B17843500DA7C62 /* ASCenterLayoutSpec.mm */,
ACF6ED071B17843500DA7C62 /* ASDimension.h */,
ACF6ED081B17843500DA7C62 /* ASDimension.mm */,
ACF6ED091B17843500DA7C62 /* ASInsetLayoutNode.h */,
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutNode.mm */,
ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */,
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */,
ACF6ED0B1B17843500DA7C62 /* ASLayout.h */,
ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */,
ACF6ED111B17843500DA7C62 /* ASLayoutable.h */,
ACF6ED0D1B17843500DA7C62 /* ASLayoutNode.h */,
ACF6ED0E1B17843500DA7C62 /* ASLayoutNode.mm */,
ACF6ED121B17843500DA7C62 /* ASOverlayLayoutNode.h */,
ACF6ED131B17843500DA7C62 /* ASOverlayLayoutNode.mm */,
ACF6ED141B17843500DA7C62 /* ASRatioLayoutNode.h */,
ACF6ED151B17843500DA7C62 /* ASRatioLayoutNode.mm */,
ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */,
ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */,
ACF6ED121B17843500DA7C62 /* ASOverlayLayoutSpec.h */,
ACF6ED131B17843500DA7C62 /* ASOverlayLayoutSpec.mm */,
ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */,
ACF6ED151B17843500DA7C62 /* ASRatioLayoutSpec.mm */,
AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutChild.h */,
ACF6ED161B17843500DA7C62 /* ASStackLayoutNode.h */,
ACF6ED171B17843500DA7C62 /* ASStackLayoutNode.mm */,
ACF6ED181B17843500DA7C62 /* ASStaticLayoutNode.h */,
ACF6ED191B17843500DA7C62 /* ASStaticLayoutNode.mm */,
AC47D9431B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.h */,
AC47D9441B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.mm */,
ACF6ED161B17843500DA7C62 /* ASStackLayoutSpec.h */,
ACF6ED171B17843500DA7C62 /* ASStackLayoutSpec.mm */,
ACF6ED181B17843500DA7C62 /* ASStaticLayoutSpec.h */,
ACF6ED191B17843500DA7C62 /* ASStaticLayoutSpec.mm */,
AC47D9431B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h */,
AC47D9441B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm */,
);
name = Layout;
path = ..;
@ -961,19 +961,19 @@
buildActionMask = 2147483647;
files = (
AC21EC101B3D0BF600C8B19A /* ASStackLayoutChild.h in Headers */,
AC47D9451B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.h in Headers */,
AC47D9451B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h in Headers */,
ACF6ED511B17847A00DA7C62 /* ASStackUnpositionedLayout.h in Headers */,
ACF6ED2D1B17843500DA7C62 /* ASRatioLayoutNode.h in Headers */,
ACF6ED261B17843500DA7C62 /* ASLayoutNode.h in Headers */,
ACF6ED221B17843500DA7C62 /* ASInsetLayoutNode.h in Headers */,
ACF6ED2D1B17843500DA7C62 /* ASRatioLayoutSpec.h in Headers */,
ACF6ED261B17843500DA7C62 /* ASLayoutSpec.h in Headers */,
ACF6ED221B17843500DA7C62 /* ASInsetLayoutSpec.h in Headers */,
ACF6ED201B17843500DA7C62 /* ASDimension.h in Headers */,
ACF6ED2B1B17843500DA7C62 /* ASOverlayLayoutNode.h in Headers */,
ACF6ED1C1B17843500DA7C62 /* ASCenterLayoutNode.h in Headers */,
ACF6ED2B1B17843500DA7C62 /* ASOverlayLayoutSpec.h in Headers */,
ACF6ED1C1B17843500DA7C62 /* ASCenterLayoutSpec.h in Headers */,
ACF6ED2A1B17843500DA7C62 /* ASLayoutable.h in Headers */,
ACF6ED311B17843500DA7C62 /* ASStaticLayoutNode.h in Headers */,
ACF6ED311B17843500DA7C62 /* ASStaticLayoutSpec.h in Headers */,
ACF6ED241B17843500DA7C62 /* ASLayout.h in Headers */,
ACF6ED2F1B17843500DA7C62 /* ASStackLayoutNode.h in Headers */,
ACF6ED1A1B17843500DA7C62 /* ASBackgroundLayoutNode.h in Headers */,
ACF6ED2F1B17843500DA7C62 /* ASStackLayoutSpec.h in Headers */,
ACF6ED1A1B17843500DA7C62 /* ASBackgroundLayoutSpec.h in Headers */,
291B63FB1AA53A7A000A71B3 /* ASScrollDirection.h in Headers */,
464052221A3F83C40061C0BA /* ASFlowLayoutController.h in Headers */,
464052241A3F83C40061C0BA /* ASLayoutController.h in Headers */,
@ -1045,8 +1045,8 @@
AC3C4A511A1139C100143C57 /* ASCollectionView.h in Headers */,
292C59A01A956527007E5DD6 /* ASRangeHandlerPreload.h in Headers */,
055B9FA81A1C154B00035D6D /* ASNetworkImageNode.h in Headers */,
ACF6ED4E1B17847A00DA7C62 /* ASStackLayoutNodeUtilities.h in Headers */,
ACF6ED4D1B17847A00DA7C62 /* ASLayoutNodeUtilities.h in Headers */,
ACF6ED4E1B17847A00DA7C62 /* ASStackLayoutSpecUtilities.h in Headers */,
ACF6ED4D1B17847A00DA7C62 /* ASLayoutSpecUtilities.h in Headers */,
ACF6ED4F1B17847A00DA7C62 /* ASStackPositionedLayout.h in Headers */,
054963491A1EA066000F8E56 /* ASBasicImageDownloader.h in Headers */,
AC3C4A541A113EEC00143C57 /* ASCollectionViewProtocols.h in Headers */,
@ -1345,10 +1345,10 @@
058D0A26195D050800B7D73C /* _ASCoreAnimationExtras.mm in Sources */,
058D0A23195D050800B7D73C /* _ASAsyncTransactionContainer.m in Sources */,
058D0A1E195D050800B7D73C /* ASTextNodeShadower.m in Sources */,
ACF6ED2E1B17843500DA7C62 /* ASRatioLayoutNode.mm in Sources */,
ACF6ED2E1B17843500DA7C62 /* ASRatioLayoutSpec.mm in Sources */,
058D0A18195D050800B7D73C /* _ASDisplayLayer.mm in Sources */,
ACF6ED321B17843500DA7C62 /* ASStaticLayoutNode.mm in Sources */,
ACF6ED2C1B17843500DA7C62 /* ASOverlayLayoutNode.mm in Sources */,
ACF6ED321B17843500DA7C62 /* ASStaticLayoutSpec.mm in Sources */,
ACF6ED2C1B17843500DA7C62 /* ASOverlayLayoutSpec.mm in Sources */,
058D0A2C195D050800B7D73C /* ASSentinel.m in Sources */,
205F0E221B376416007741D0 /* CGRect+ASConvenience.m in Sources */,
205F0E1A1B37339C007741D0 /* ASAbstractLayoutController.mm in Sources */,
@ -1357,16 +1357,16 @@
058D0A15195D050800B7D73C /* ASDisplayNodeExtras.mm in Sources */,
ACF6ED501B17847A00DA7C62 /* ASStackPositionedLayout.mm in Sources */,
058D0A1F195D050800B7D73C /* ASTextNodeTextKitHelpers.mm in Sources */,
ACF6ED1B1B17843500DA7C62 /* ASBackgroundLayoutNode.mm in Sources */,
ACF6ED1B1B17843500DA7C62 /* ASBackgroundLayoutSpec.mm in Sources */,
055F1A3519ABD3E3004DAFF1 /* ASTableView.mm in Sources */,
205F0E121B371BD7007741D0 /* ASScrollDirection.m in Sources */,
AC47D9461B3BB41900AAEE9D /* ASStaticLayoutNodeDimension.mm in Sources */,
ACF6ED271B17843500DA7C62 /* ASLayoutNode.mm in Sources */,
AC47D9461B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm in Sources */,
ACF6ED271B17843500DA7C62 /* ASLayoutSpec.mm in Sources */,
ACF6ED211B17843500DA7C62 /* ASDimension.mm in Sources */,
464052261A3F83C40061C0BA /* ASMultidimensionalArrayUtils.mm in Sources */,
055B9FA91A1C154B00035D6D /* ASNetworkImageNode.mm in Sources */,
ACF6ED521B17847A00DA7C62 /* ASStackUnpositionedLayout.mm in Sources */,
ACF6ED1D1B17843500DA7C62 /* ASCenterLayoutNode.mm in Sources */,
ACF6ED1D1B17843500DA7C62 /* ASCenterLayoutSpec.mm in Sources */,
058D0A1D195D050800B7D73C /* ASTextNodeRenderer.mm in Sources */,
292C59A41A956527007E5DD6 /* ASRangeHandlerRender.mm in Sources */,
058D0A2A195D050800B7D73C /* ASDisplayNode+UIViewBridge.mm in Sources */,
@ -1393,14 +1393,14 @@
05A6D05B19D0EB64002DD95E /* ASDealloc2MainObject.m in Sources */,
058D0A17195D050800B7D73C /* ASTextNode.mm in Sources */,
AC6456091B0A335000CF11B8 /* ASCellNode.m in Sources */,
ACF6ED231B17843500DA7C62 /* ASInsetLayoutNode.mm in Sources */,
ACF6ED231B17843500DA7C62 /* ASInsetLayoutSpec.mm in Sources */,
058D0A27195D050800B7D73C /* _ASPendingState.m in Sources */,
0516FA411A1563D200B4EBED /* ASMultiplexImageNode.mm in Sources */,
058D0A16195D050800B7D73C /* ASImageNode.mm in Sources */,
058D0A29195D050800B7D73C /* ASDisplayNode+DebugTiming.mm in Sources */,
205F0E1E1B373A2C007741D0 /* ASCollectionViewLayoutController.mm in Sources */,
058D0A22195D050800B7D73C /* _ASAsyncTransaction.m in Sources */,
ACF6ED301B17843500DA7C62 /* ASStackLayoutNode.mm in Sources */,
ACF6ED301B17843500DA7C62 /* ASStackLayoutSpec.mm in Sources */,
055F1A3919ABD413004DAFF1 /* ASRangeController.mm in Sources */,
296A0A2F1A9516B2005ACEAA /* ASBatchFetching.m in Sources */,
D785F6631A74327E00291744 /* ASScrollNode.m in Sources */,
@ -1411,8 +1411,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutNodeSnapshotTests.mm in Sources */,
ACF6ED621B178DC700DA7C62 /* ASRatioLayoutNodeSnapshotTests.mm in Sources */,
ACF6ED611B178DC700DA7C62 /* ASOverlayLayoutSpecSnapshotTests.mm in Sources */,
ACF6ED621B178DC700DA7C62 /* ASRatioLayoutSpecSnapshotTests.mm in Sources */,
2911485C1A77147A005D0878 /* ASControlNodeTests.m in Sources */,
296A0A351A951ABF005ACEAA /* ASBatchFetchingTests.m in Sources */,
058D0A3E195D057000B7D73C /* ASTextNodeRendererTests.m in Sources */,
@ -1420,19 +1420,19 @@
058D0A3C195D057000B7D73C /* ASMutableAttributedStringBuilderTests.m in Sources */,
242995D31B29743C00090100 /* ASBasicImageDownloaderTests.m in Sources */,
058D0A3F195D057000B7D73C /* ASTextNodeShadowerTests.m in Sources */,
ACF6ED631B178DC700DA7C62 /* ASStackLayoutNodeSnapshotTests.mm in Sources */,
ACF6ED631B178DC700DA7C62 /* ASStackLayoutSpecSnapshotTests.mm in Sources */,
29CDC2E21AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m in Sources */,
056D21551ABCEF50001107EF /* ASImageNodeSnapshotTests.m in Sources */,
05EA6FE71AC0966E00E35788 /* ASSnapshotTestCase.mm in Sources */,
ACF6ED5E1B178DC700DA7C62 /* ASInsetLayoutNodeSnapshotTests.mm in Sources */,
ACF6ED5E1B178DC700DA7C62 /* ASInsetLayoutSpecSnapshotTests.mm in Sources */,
058D0A3B195D057000B7D73C /* ASDisplayNodeTestsHelper.m in Sources */,
058D0A3A195D057000B7D73C /* ASDisplayNodeTests.m in Sources */,
ACF6ED601B178DC700DA7C62 /* ASLayoutNodeSnapshotTestsHelper.m in Sources */,
ACF6ED601B178DC700DA7C62 /* ASLayoutSpecSnapshotTestsHelper.m in Sources */,
052EE0661A159FEF002C6279 /* ASMultiplexImageNodeTests.m in Sources */,
ACF6ED5D1B178DC700DA7C62 /* ASDimensionTests.mm in Sources */,
058D0A39195D057000B7D73C /* ASDisplayNodeAppearanceTests.m in Sources */,
058D0A41195D057000B7D73C /* ASTextNodeWordKernerTests.mm in Sources */,
ACF6ED5C1B178DC700DA7C62 /* ASCenterLayoutNodeSnapshotTests.mm in Sources */,
ACF6ED5C1B178DC700DA7C62 /* ASCenterLayoutSpecSnapshotTests.mm in Sources */,
058D0A40195D057000B7D73C /* ASTextNodeTests.m in Sources */,
3C9C128519E616EF00E942A0 /* ASTableViewTests.m in Sources */,
058D0A38195D057000B7D73C /* ASDisplayLayerTests.m in Sources */,

View File

@ -12,7 +12,7 @@
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASTextNode.h>
#import "ASInsetLayoutNode.h"
#import "ASInsetLayoutSpec.h"
#pragma mark -
#pragma mark ASCellNode
@ -110,7 +110,7 @@ static const CGFloat kFontSize = 18.0f;
static const CGFloat kHorizontalPadding = 15.0f;
static const CGFloat kVerticalPadding = 11.0f;
UIEdgeInsets insets = UIEdgeInsetsMake(kVerticalPadding, kHorizontalPadding, kVerticalPadding, kHorizontalPadding);
return [ASInsetLayoutNode newWithInsets:insets child:_textNode];
return [ASInsetLayoutSpec newWithInsets:insets child:_textNode];
}
- (void)setText:(NSString *)text

View File

@ -16,7 +16,7 @@
#import "ASTextNodeWordKerner.h"
#import "ASThread.h"
#import "ASLayoutNode.h"
#import "ASLayoutSpec.h"
//! @abstract This subclass exists solely to ensure the text view's panGestureRecognizer never begins, because it's sporadically enabled by UITextView. It will be removed pending rdar://14729288.
@interface _ASDisabledPanUITextView : UITextView

View File

@ -19,7 +19,7 @@
#import "ASTextNodeRenderer.h"
#import "ASTextNodeShadower.h"
#import "ASLayoutNode.h"
#import "ASLayoutSpec.h"
static const NSTimeInterval ASTextNodeHighlightFadeOutDuration = 0.15;
static const NSTimeInterval ASTextNodeHighlightFadeInDuration = 0.1;

View File

@ -28,12 +28,12 @@
#import <AsyncDisplayKit/ASLayout.h>
#import <AsyncDisplayKit/ASDimension.h>
#import <AsyncDisplayKit/ASLayoutable.h>
#import <AsyncDisplayKit/ASLayoutNode.h>
#import <AsyncDisplayKit/ASBackgroundLayoutNode.h>
#import <AsyncDisplayKit/ASCenterLayoutNode.h>
#import <AsyncDisplayKit/ASInsetLayoutNode.h>
#import <AsyncDisplayKit/ASOverlayLayoutNode.h>
#import <AsyncDisplayKit/ASRatioLayoutNode.h>
#import <AsyncDisplayKit/ASStaticLayoutNode.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
#import <AsyncDisplayKit/ASBackgroundLayoutSpec.h>
#import <AsyncDisplayKit/ASCenterLayoutSpec.h>
#import <AsyncDisplayKit/ASInsetLayoutSpec.h>
#import <AsyncDisplayKit/ASOverlayLayoutSpec.h>
#import <AsyncDisplayKit/ASRatioLayoutSpec.h>
#import <AsyncDisplayKit/ASStaticLayoutSpec.h>
#import <AsyncDisplayKit/ASStackLayoutChild.h>
#import <AsyncDisplayKit/ASStackLayoutNode.h>
#import <AsyncDisplayKit/ASStackLayoutSpec.h>

View File

@ -8,15 +8,15 @@
*
*/
#import <AsyncDisplayKit/ASLayoutNode.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
/**
Lays out a single child node, then lays out a background node behind it stretched to its size.
Lays out a single layoutable child, then lays out a background layoutable instance behind it stretched to its size.
*/
@interface ASBackgroundLayoutNode : ASLayoutNode
@interface ASBackgroundLayoutSpec : ASLayoutSpec
/**
@param child A child that is laid out to determine the size of this node. If this is nil, then this method
@param child A child that is laid out to determine the size of this spec. If this is nil, then this method
returns nil.
@param background A layoutable object that is laid out behind the child. May be nil, in which case the background is omitted.
*/

View File

@ -8,29 +8,29 @@
*
*/
#import "ASBackgroundLayoutNode.h"
#import "ASBackgroundLayoutSpec.h"
#import "ASAssert.h"
#import "ASBaseDefines.h"
@interface ASBackgroundLayoutNode ()
@interface ASBackgroundLayoutSpec ()
{
id<ASLayoutable> _child;
id<ASLayoutable> _background;
}
@end
@implementation ASBackgroundLayoutNode
@implementation ASBackgroundLayoutSpec
+ (instancetype)newWithChild:(id<ASLayoutable>)child background:(id<ASLayoutable>)background
{
if (child == nil) {
return nil;
}
ASBackgroundLayoutNode *n = [super new];
n->_child = child;
n->_background = background;
return n;
ASBackgroundLayoutSpec *spec = [super new];
spec->_child = child;
spec->_background = background;
return spec;
}
+ (instancetype)new

View File

@ -1,46 +0,0 @@
/*
* 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 <AsyncDisplayKit/ASLayoutNode.h>
typedef NS_OPTIONS(NSUInteger, ASCenterLayoutNodeCenteringOptions) {
/** The child is positioned in {0,0} relatively to the layout bounds */
ASCenterLayoutNodeCenteringNone = 0,
/** The child is centered along the X axis */
ASCenterLayoutNodeCenteringX = 1 << 0,
/** The child is centered along the Y axis */
ASCenterLayoutNodeCenteringY = 1 << 1,
/** Convenience option to center both along the X and Y axis */
ASCenterLayoutNodeCenteringXY = ASCenterLayoutNodeCenteringX | ASCenterLayoutNodeCenteringY
};
typedef NS_OPTIONS(NSUInteger, ASCenterLayoutNodeSizingOptions) {
/** The node will take up the maximum size possible */
ASCenterLayoutNodeSizingOptionDefault,
/** The node will take up the minimum size possible along the X axis */
ASCenterLayoutNodeSizingOptionMinimumX = 1 << 0,
/** The node will take up the minimum size possible along the Y axis */
ASCenterLayoutNodeSizingOptionMinimumY = 1 << 1,
/** Convenience option to take up the minimum size along both the X and Y axis */
ASCenterLayoutNodeSizingOptionMinimumXY = ASCenterLayoutNodeSizingOptionMinimumX | ASCenterLayoutNodeSizingOptionMinimumY,
};
/** Lays out a single child layout node and position it so that it is centered into the layout bounds. */
@interface ASCenterLayoutNode : ASLayoutNode
/**
@param centeringOptions, see ASCenterLayoutNodeCenteringOptions.
@param child The child to center.
*/
+ (instancetype)newWithCenteringOptions:(ASCenterLayoutNodeCenteringOptions)centeringOptions
sizingOptions:(ASCenterLayoutNodeSizingOptions)sizingOptions
child:(id<ASLayoutable>)child;
@end

View File

@ -0,0 +1,46 @@
/*
* 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 <AsyncDisplayKit/ASLayoutSpec.h>
typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecCenteringOptions) {
/** The child is positioned in {0,0} relatively to the layout bounds */
ASCenterLayoutSpecCenteringNone = 0,
/** The child is centered along the X axis */
ASCenterLayoutSpecCenteringX = 1 << 0,
/** The child is centered along the Y axis */
ASCenterLayoutSpecCenteringY = 1 << 1,
/** Convenience option to center both along the X and Y axis */
ASCenterLayoutSpecCenteringXY = ASCenterLayoutSpecCenteringX | ASCenterLayoutSpecCenteringY
};
typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
/** The spec will take up the maximum size possible */
ASCenterLayoutSpecSizingOptionDefault,
/** The spec will take up the minimum size possible along the X axis */
ASCenterLayoutSpecSizingOptionMinimumX = 1 << 0,
/** The spec will take up the minimum size possible along the Y axis */
ASCenterLayoutSpecSizingOptionMinimumY = 1 << 1,
/** Convenience option to take up the minimum size along both the X and Y axis */
ASCenterLayoutSpecSizingOptionMinimumXY = ASCenterLayoutSpecSizingOptionMinimumX | ASCenterLayoutSpecSizingOptionMinimumY,
};
/** Lays out a single layoutable child and position it so that it is centered into the layout bounds. */
@interface ASCenterLayoutSpec : ASLayoutSpec
/**
@param centeringOptions, see ASCenterLayoutSpecCenteringOptions.
@param child The child to center.
*/
+ (instancetype)newWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
child:(id<ASLayoutable>)child;
@end

View File

@ -8,28 +8,28 @@
*
*/
#import "ASCenterLayoutNode.h"
#import "ASCenterLayoutSpec.h"
#import "ASInternalHelpers.h"
@implementation ASCenterLayoutNode
@implementation ASCenterLayoutSpec
{
ASCenterLayoutNodeCenteringOptions _centeringOptions;
ASCenterLayoutNodeSizingOptions _sizingOptions;
ASCenterLayoutSpecCenteringOptions _centeringOptions;
ASCenterLayoutSpecSizingOptions _sizingOptions;
id<ASLayoutable> _child;
}
+ (instancetype)newWithCenteringOptions:(ASCenterLayoutNodeCenteringOptions)centeringOptions
sizingOptions:(ASCenterLayoutNodeSizingOptions)sizingOptions
+ (instancetype)newWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
child:(id<ASLayoutable>)child
{
ASCenterLayoutNode *n = [super new];
if (n) {
n->_centeringOptions = centeringOptions;
n->_sizingOptions = sizingOptions;
n->_child = child;
ASCenterLayoutSpec *spec = [super new];
if (spec) {
spec->_centeringOptions = centeringOptions;
spec->_sizingOptions = sizingOptions;
spec->_child = child;
}
return n;
return spec;
}
+ (instancetype)new
@ -46,8 +46,8 @@
// Layout the child
const CGSize minChildSize = {
(_centeringOptions & ASCenterLayoutNodeCenteringX) != 0 ? 0 : constrainedSize.min.width,
(_centeringOptions & ASCenterLayoutNodeCenteringY) != 0 ? 0 : constrainedSize.min.height,
(_centeringOptions & ASCenterLayoutSpecCenteringX) != 0 ? 0 : constrainedSize.min.width,
(_centeringOptions & ASCenterLayoutSpecCenteringY) != 0 ? 0 : constrainedSize.min.height,
};
ASLayout *childLayout = [_child calculateLayoutThatFits:ASSizeRangeMake(minChildSize, constrainedSize.max)];
@ -60,13 +60,13 @@
// If minimum size options are set, attempt to shrink the size to the size of the child
size = ASSizeRangeClamp(constrainedSize, {
MIN(size.width, (_sizingOptions & ASCenterLayoutNodeSizingOptionMinimumX) != 0 ? childLayout.size.width : size.width),
MIN(size.height, (_sizingOptions & ASCenterLayoutNodeSizingOptionMinimumY) != 0 ? childLayout.size.height : size.height)
MIN(size.width, (_sizingOptions & ASCenterLayoutSpecSizingOptionMinimumX) != 0 ? childLayout.size.width : size.width),
MIN(size.height, (_sizingOptions & ASCenterLayoutSpecSizingOptionMinimumY) != 0 ? childLayout.size.height : size.height)
});
// Compute the centered postion for the child
BOOL shouldCenterAlongX = (_centeringOptions & ASCenterLayoutNodeCenteringX);
BOOL shouldCenterAlongY = (_centeringOptions & ASCenterLayoutNodeCenteringY);
BOOL shouldCenterAlongX = (_centeringOptions & ASCenterLayoutSpecCenteringX);
BOOL shouldCenterAlongY = (_centeringOptions & ASCenterLayoutSpecCenteringY);
childLayout.position = {
ASRoundPixelValue(shouldCenterAlongX ? (size.width - childLayout.size.width) * 0.5f : 0),
ASRoundPixelValue(shouldCenterAlongY ? (size.height - childLayout.size.height) * 0.5f : 0)

View File

@ -71,6 +71,6 @@ extern ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange other
extern BOOL ASSizeRangeEqualToSizeRange(ASSizeRange lhs, ASSizeRange rhs);
extern NSString * NSStringFromASSizeRange(ASSizeRange sizeRange);
extern NSString *NSStringFromASSizeRange(ASSizeRange sizeRange);
ASDISPLAYNODE_EXTERN_C_END

View File

@ -8,26 +8,26 @@
*
*/
#import <AsyncDisplayKit/ASLayoutNode.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
/**
A layout node that wraps another node, applying insets around it.
A layout spec that wraps another layoutable child, applying insets around it.
If the child node has a size specified as a percentage, the percentage is resolved against this node's parent
If the child has a size specified as a percentage, the percentage is resolved against this spec's parent
size **after** applying insets.
@example ASOuterLayoutNode contains an ASInsetLayoutNode with an ASInnerLayoutNode. Suppose that:
- ASOuterLayoutNode is 200pt wide.
- ASInnerLayoutNode specifies its width as 100%.
- The ASInsetLayoutNode has insets of 10pt on every side.
ASInnerLayoutNode will have size 180pt, not 200pt, because it receives a parent size that has been adjusted for insets.
@example ASOuterLayoutSpec contains an ASInsetLayoutSpec with an ASInnerLayoutSpec. Suppose that:
- ASOuterLayoutSpec is 200pt wide.
- ASInnerLayoutSpec specifies its width as 100%.
- The ASInsetLayoutSpec has insets of 10pt on every side.
ASInnerLayoutSpec will have size 180pt, not 200pt, because it receives a parent size that has been adjusted for insets.
If you're familiar with CSS: ASInsetLayoutNode's child behaves similarly to "box-sizing: border-box".
If you're familiar with CSS: ASInsetLayoutSpec's child behaves similarly to "box-sizing: border-box".
An infinite inset is resolved as an inset equal to all remaining space after applying the other insets and child size.
@example An ASInsetLayoutNode with an infinite left inset and 10px for all other edges will position it's child 10px from the right edge.
@example An ASInsetLayoutSpec with an infinite left inset and 10px for all other edges will position it's child 10px from the right edge.
*/
@interface ASInsetLayoutNode : ASLayoutNode
@interface ASInsetLayoutSpec : ASLayoutSpec
/**
@param insets The amount of space to inset on each side.

View File

@ -8,14 +8,14 @@
*
*/
#import "ASInsetLayoutNode.h"
#import "ASInsetLayoutSpec.h"
#import "ASAssert.h"
#import "ASBaseDefines.h"
#import "ASInternalHelpers.h"
@interface ASInsetLayoutNode ()
@interface ASInsetLayoutSpec ()
{
UIEdgeInsets _insets;
id<ASLayoutable> _child;
@ -40,19 +40,19 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner)
return ASRoundPixelValue((outer - inner) / 2);
}
@implementation ASInsetLayoutNode
@implementation ASInsetLayoutSpec
+ (instancetype)newWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutable>)child
{
if (child == nil) {
return nil;
}
ASInsetLayoutNode *n = [super new];
if (n) {
n->_insets = insets;
n->_child = child;
ASInsetLayoutSpec *spec = [super new];
if (spec) {
spec->_insets = insets;
spec->_child = child;
}
return n;
return spec;
}
+ (instancetype)new

View File

@ -22,7 +22,7 @@ extern BOOL CGPointIsNull(CGPoint point);
@property (nonatomic, readonly) id<ASLayoutable> layoutableObject;
@property (nonatomic, readonly) CGSize size;
/**
* Position parent (if any). Default to CGPointNull.
* Position in parent. Default to CGPointNull.
*
* @discussion Before being used as a child layout, this property must be set and no longer equal CGPointNull.
*

View File

@ -10,7 +10,7 @@
#import "ASLayout.h"
#import "ASAssert.h"
#import "ASLayoutNodeUtilities.h"
#import "ASLayoutSpecUtilities.h"
#import <stack>
CGPoint const CGPointNull = {NAN, NAN};
@ -71,7 +71,7 @@ extern BOOL CGPointIsNull(CGPoint point)
BOOL visited;
};
// Stack of Contexts, used to keep track of sub layouts while traversing the calculated layout in a DFS fashion.
// Stack of Contexts, used to keep track of sublayouts while traversing this layout in a DFS fashion.
std::stack<Context> stack;
stack.push({self, CGPointMake(0, 0), NO});

View File

@ -11,7 +11,7 @@
#import <AsyncDisplayKit/ASLayoutable.h>
#import <AsyncDisplayKit/ASLayout.h>
/** A layout node is an immutable object that describes a layout, loosely inspired by React. */
@interface ASLayoutNode : NSObject <ASLayoutable>
/** A layout spec is an immutable object that describes a layout, loosely inspired by React. */
@interface ASLayoutSpec : NSObject <ASLayoutable>
@end

View File

@ -8,7 +8,7 @@
*
*/
#import "ASLayoutNode.h"
#import "ASLayoutSpec.h"
#import "ASAssert.h"
#import "ASBaseDefines.h"
@ -16,7 +16,7 @@
#import "ASInternalHelpers.h"
#import "ASLayout.h"
@implementation ASLayoutNode
@implementation ASLayoutSpec
@synthesize spacingBefore = _spacingBefore;
@synthesize spacingAfter = _spacingAfter;
@ -27,11 +27,11 @@
+ (instancetype)new
{
ASLayoutNode *n = [super new];
if (n) {
n->_flexBasis = ASRelativeDimensionUnconstrained;
ASLayoutSpec *spec = [super new];
if (spec) {
spec->_flexBasis = ASRelativeDimensionUnconstrained;
}
return n;
return spec;
}
#pragma mark - Layout

View File

@ -8,12 +8,12 @@
*
*/
#import <AsyncDisplayKit/ASLayoutNode.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
/**
This node 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 layoutable child and then overlays a layoutable object on top of it streched to its size
*/
@interface ASOverlayLayoutNode : ASLayoutNode
@interface ASOverlayLayoutSpec : ASLayoutSpec
+ (instancetype)newWithChild:(id<ASLayoutable>)child overlay:(id<ASLayoutable>)overlay;

View File

@ -8,12 +8,12 @@
*
*/
#import "ASOverlayLayoutNode.h"
#import "ASOverlayLayoutSpec.h"
#import "ASAssert.h"
#import "ASBaseDefines.h"
@implementation ASOverlayLayoutNode
@implementation ASOverlayLayoutSpec
{
id<ASLayoutable> _overlay;
id<ASLayoutable> _child;
@ -21,13 +21,13 @@
+ (instancetype)newWithChild:(id<ASLayoutable>)child overlay:(id<ASLayoutable>)overlay
{
ASOverlayLayoutNode *n = [super new];
if (n) {
ASOverlayLayoutSpec *spec = [super new];
if (spec) {
ASDisplayNodeAssertNotNil(child, @"Child that will be overlayed on shouldn't be nil");
n->_overlay = overlay;
n->_child = child;
spec->_overlay = overlay;
spec->_child = child;
}
return n;
return spec;
}
+ (instancetype)new

View File

@ -8,20 +8,20 @@
*
*/
#import <AsyncDisplayKit/ASLayoutNode.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
#import <AsyncDisplayKit/ASLayoutable.h>
/**
Ratio layout node
Ratio layout spec
For when the content should respect a certain inherent ratio but can be scaled (think photos or videos)
The ratio passed is the ratio of height / width you expect
For a ratio 0.5, the node will have a flat rectangle shape
For a ratio 0.5, the spec will have a flat rectangle shape
_ _ _ _
| |
|_ _ _ _|
For a ratio 2.0, the node will be twice as tall as it is wide
For a ratio 2.0, the spec will be twice as tall as it is wide
_ _
| |
| |
@ -29,7 +29,7 @@
|_ _|
**/
@interface ASRatioLayoutNode : ASLayoutNode
@interface ASRatioLayoutSpec : ASLayoutSpec
+ (instancetype)newWithRatio:(CGFloat)ratio child:(id<ASLayoutable>)child;

View File

@ -8,7 +8,7 @@
*
*/
#import "ASRatioLayoutNode.h"
#import "ASRatioLayoutSpec.h"
#import <algorithm>
#import <vector>
@ -18,7 +18,7 @@
#import "ASInternalHelpers.h"
@implementation ASRatioLayoutNode
@implementation ASRatioLayoutSpec
{
CGFloat _ratio;
id<ASLayoutable> _child;
@ -31,12 +31,12 @@
return nil;
}
ASRatioLayoutNode *n = [super new];
if (n) {
n->_ratio = ratio;
n->_child = child;
ASRatioLayoutSpec *spec = [super new];
if (spec) {
spec->_ratio = ratio;
spec->_child = child;
}
return n;
return spec;
}
+ (instancetype)new

View File

@ -10,7 +10,7 @@
/**
Each child may override their parent stack's cross axis alignment.
@see ASStackLayoutNodeAlignItems
@see ASStackLayoutAlignItems
*/
typedef NS_ENUM(NSUInteger, ASStackLayoutAlignSelf) {
/** Inherit alignment value from containing stack. */

View File

@ -8,28 +8,28 @@
*
*/
#import <AsyncDisplayKit/ASLayoutNode.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
typedef NS_ENUM(NSUInteger, ASStackLayoutDirection) {
ASStackLayoutDirectionVertical,
ASStackLayoutDirectionHorizontal,
};
/** If no children are flexible, how should this node justify its children in the available space? */
/** If no children are flexible, how should this spec justify its children in the available space? */
typedef NS_ENUM(NSUInteger, ASStackLayoutJustifyContent) {
/**
On overflow, children overflow out of this node's bounds on the right/bottom side.
On underflow, children are left/top-aligned within this node's bounds.
On overflow, children overflow out of this spec's bounds on the right/bottom side.
On underflow, children are left/top-aligned within this spec's bounds.
*/
ASStackLayoutJustifyContentStart,
/**
On overflow, children are centered and overflow on both sides.
On underflow, children are centered within this node's bounds in the stacking direction.
On underflow, children are centered within this spec's bounds in the stacking direction.
*/
ASStackLayoutJustifyContentCenter,
/**
On overflow, children overflow out of this node's bounds on the left/top side.
On underflow, children are right/bottom-aligned within this node's bounds.
On overflow, children overflow out of this spec's bounds on the left/top side.
On underflow, children are right/bottom-aligned within this spec's bounds.
*/
ASStackLayoutJustifyContentEnd,
};
@ -54,34 +54,34 @@ typedef struct {
ASStackLayoutJustifyContent justifyContent;
/** Orientation of children along cross axis */
ASStackLayoutAlignItems alignItems;
} ASStackLayoutNodeStyle;
} ASStackLayoutSpecStyle;
/**
A simple layout node that stacks a list of children vertically or horizontally.
A simple layout spec that stacks a list of children vertically or horizontally.
- All children are initially laid out with the an infinite available size in the stacking direction.
- In the other direction, this node's constraint is passed.
- In the other direction, this spec's constraint is passed.
- The children's sizes are summed in the stacking direction.
- If this sum is less than this node's minimum size in stacking direction, children with flexGrow are flexed.
- If it is greater than this node's maximum size in the stacking direction, children with flexShrink are flexed.
- If, even after flexing, the sum is still greater than this node's maximum size in the stacking direction,
- If this sum is less than this spec's minimum size in stacking direction, children with flexGrow are flexed.
- If it is greater than this spec's maximum size in the stacking direction, children with flexShrink are flexed.
- If, even after flexing, the sum is still greater than this spec's maximum size in the stacking direction,
justifyContent determines how children are laid out.
For example:
- Suppose stacking direction is Vertical, min-width=100, max-width=300, min-height=200, max-height=500.
- All children are laid out with min-width=100, max-width=300, min-height=0, max-height=INFINITY.
- If the sum of the childrens' heights is less than 200, nodes with flexGrow are flexed larger.
- If the sum of the childrens' heights is greater than 500, nodes with flexShrink are flexed smaller.
Each node is shrunk by `((sum of heights) - 500)/(number of nodes)`.
- If the sum of the childrens' heights is greater than 500 even after flexShrink-able nodes are flexed,
- If the sum of the childrens' heights is less than 200, children with flexGrow are flexed larger.
- If the sum of the childrens' heights is greater than 500, children with flexShrink are flexed smaller.
Each child is shrunk by `((sum of heights) - 500)/(number of flexShrink-able children)`.
- If the sum of the childrens' heights is greater than 500 even after flexShrink-able children are flexed,
justifyContent determines how children are laid out.
*/
@interface ASStackLayoutNode : ASLayoutNode
@interface ASStackLayoutSpec : ASLayoutSpec
/**
@param style Specifies how children are laid out.
@param children Children to be positioned, each is an object conforms to ASLayoutable protocol.
@param children ASLayoutable children to be positioned.
*/
+ (instancetype)newWithStyle:(ASStackLayoutNodeStyle)style children:(NSArray *)children;
+ (instancetype)newWithStyle:(ASStackLayoutSpecStyle)style children:(NSArray *)children;
@end

View File

@ -8,7 +8,7 @@
*
*/
#import "ASStackLayoutNode.h"
#import "ASStackLayoutSpec.h"
#import <numeric>
#import <vector>
@ -16,28 +16,28 @@
#import "ASBaseDefines.h"
#import "ASInternalHelpers.h"
#import "ASLayoutNodeUtilities.h"
#import "ASStackLayoutNodeUtilities.h"
#import "ASLayoutSpecUtilities.h"
#import "ASStackLayoutSpecUtilities.h"
#import "ASStackPositionedLayout.h"
#import "ASStackUnpositionedLayout.h"
@implementation ASStackLayoutNode
@implementation ASStackLayoutSpec
{
ASStackLayoutNodeStyle _style;
ASStackLayoutSpecStyle _style;
std::vector<id<ASLayoutable>> _children;
}
+ (instancetype)newWithStyle:(ASStackLayoutNodeStyle)style children:(NSArray *)children
+ (instancetype)newWithStyle:(ASStackLayoutSpecStyle)style children:(NSArray *)children
{
ASStackLayoutNode *n = [super new];
if (n) {
n->_style = style;
n->_children = std::vector<id<ASLayoutable>>();
ASStackLayoutSpec *spec = [super new];
if (spec) {
spec->_style = style;
spec->_children = std::vector<id<ASLayoutable>>();
for (id<ASLayoutable> child in children) {
n->_children.push_back(child);
spec->_children.push_back(child);
}
}
return n;
return spec;
}
+ (instancetype)new

View File

@ -8,39 +8,38 @@
*
*/
#import <AsyncDisplayKit/ASLayoutNode.h>
#import <AsyncDisplayKit/ASStaticLayoutNodeDimension.h>
#import <AsyncDisplayKit/ASLayoutSpec.h>
#import <AsyncDisplayKit/ASStaticLayoutSpecDimension.h>
@interface ASStaticLayoutNodeChild : NSObject
@interface ASStaticLayoutSpecChild : NSObject
@property (nonatomic, readonly) CGPoint position;
@property (nonatomic, readonly) ASLayoutNode *node;
@property (nonatomic, readonly) id<ASLayoutable> layoutableObject;
/**
If specified, the node's size is restricted according to this size. Percentages are resolved relative to the
static layout node.
If specified, the child's size is restricted according to this size. Percentages are resolved relative to the static layout spec.
*/
@property (nonatomic, readonly) ASRelativeSizeRange size;
+ (instancetype)newWithPosition:(CGPoint)position node:(ASLayoutNode *)node size:(ASRelativeSizeRange)size;
+ (instancetype)newWithPosition:(CGPoint)position layoutableObject:(id<ASLayoutable>)layoutableObject size:(ASRelativeSizeRange)size;
/**
Convenience with default size is Unconstrained in both dimensions, which sets the child's min size to zero
and max size to the maximum available space it can consume without overflowing the node's bounds.
and max size to the maximum available space it can consume without overflowing the spec's bounds.
*/
+ (instancetype)newWithPosition:(CGPoint)position node:(ASLayoutNode *)node;
+ (instancetype)newWithPosition:(CGPoint)position layoutableObject:(id<ASLayoutable>)layoutableObject;
@end
/*
A layout node that positions children at fixed positions.
A layout spec that positions children at fixed positions.
Computes a size that is the union of all childrens' frames.
*/
@interface ASStaticLayoutNode : ASLayoutNode
@interface ASStaticLayoutSpec : ASLayoutSpec
/**
@param children Children to be positioned at fixed positions, each is of type ASStaticLayoutNodeChild.
@param children Children to be positioned at fixed positions, each is of type ASStaticLayoutSpecChild.
*/
+ (instancetype)newWithChildren:(NSArray *)children;

View File

@ -8,43 +8,43 @@
*
*/
#import "ASStaticLayoutNode.h"
#import "ASStaticLayoutSpec.h"
#import "ASLayoutNodeUtilities.h"
#import "ASLayoutSpecUtilities.h"
#import "ASInternalHelpers.h"
@implementation ASStaticLayoutNodeChild
@implementation ASStaticLayoutSpecChild
+ (instancetype)newWithPosition:(CGPoint)position node:(ASLayoutNode *)node size:(ASRelativeSizeRange)size
+ (instancetype)newWithPosition:(CGPoint)position layoutableObject:(id<ASLayoutable>)layoutableObject size:(ASRelativeSizeRange)size
{
ASStaticLayoutNodeChild *c = [super new];
ASStaticLayoutSpecChild *c = [super new];
if (c) {
c->_position = position;
c->_node = node;
c->_layoutableObject = layoutableObject;
c->_size = size;
}
return c;
}
+ (instancetype)newWithPosition:(CGPoint)position node:(ASLayoutNode *)node
+ (instancetype)newWithPosition:(CGPoint)position layoutableObject:(id<ASLayoutable>)layoutableObject
{
return [self newWithPosition:position node:node size:ASRelativeSizeRangeUnconstrained];
return [self newWithPosition:position layoutableObject:layoutableObject size:ASRelativeSizeRangeUnconstrained];
}
@end
@implementation ASStaticLayoutNode
@implementation ASStaticLayoutSpec
{
NSArray *_children;
}
+ (instancetype)newWithChildren:(NSArray *)children
{
ASStaticLayoutNode *n = [super new];
if (n) {
n->_children = children;
ASStaticLayoutSpec *spec = [super new];
if (spec) {
spec->_children = children;
}
return n;
return spec;
}
+ (instancetype)new
@ -60,7 +60,7 @@
};
NSMutableArray *layoutChildren = [NSMutableArray arrayWithCapacity:_children.count];
for (ASStaticLayoutNodeChild *child in _children) {
for (ASStaticLayoutSpecChild *child in _children) {
CGSize autoMaxSize = {
constrainedSize.max.width - child.position.x,
constrainedSize.max.height - child.position.y
@ -68,7 +68,7 @@
ASSizeRange childConstraint = ASRelativeSizeRangeEqualToRelativeSizeRange(ASRelativeSizeRangeUnconstrained, child.size)
? ASSizeRangeMake({0, 0}, autoMaxSize)
: ASRelativeSizeRangeResolve(child.size, size);
ASLayout *childLayout = [child.node calculateLayoutThatFits:childConstraint];
ASLayout *childLayout = [child.layoutableObject calculateLayoutThatFits:childConstraint];
childLayout.position = child.position;
[layoutChildren addObject:childLayout];
}

View File

@ -14,7 +14,7 @@
/**
Expresses a size with relative dimensions.
Used by ASStaticLayoutNode.
Used by ASStaticLayoutSpec.
*/
typedef struct {
ASRelativeDimension width;
@ -23,7 +23,7 @@ typedef struct {
/**
Expresses an inclusive range of relative sizes. Used to provide additional constraint to layout.
Used by ASStaticLayoutNode.
Used by ASStaticLayoutSpec.
*/
typedef struct {
ASRelativeSize min;

View File

@ -8,7 +8,7 @@
*
*/
#import "ASStaticLayoutNodeDimension.h"
#import "ASStaticLayoutSpecDimension.h"
#import "ASAssert.h"
ASRelativeSizeRange const ASRelativeSizeRangeUnconstrained = {};

View File

@ -8,7 +8,7 @@
*
*/
#import "ASStackLayoutNode.h"
#import "ASStackLayoutSpec.h"
inline CGFloat stackDimension(const ASStackLayoutDirection direction, const CGSize size)
{

View File

@ -10,7 +10,7 @@
#import "ASLayout.h"
#import "ASDimension.h"
#import "ASStackLayoutNode.h"
#import "ASStackLayoutSpec.h"
#import "ASStackUnpositionedLayout.h"
/** Represents a set of laid out and positioned stack layout children. */
@ -20,6 +20,6 @@ struct ASStackPositionedLayout {
/** Given an unpositioned layout, computes the positions each child should be placed at. */
static ASStackPositionedLayout compute(const ASStackUnpositionedLayout &unpositionedLayout,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &constrainedSize);
};

View File

@ -11,11 +11,11 @@
#import "ASStackPositionedLayout.h"
#import "ASInternalHelpers.h"
#import "ASLayoutNodeUtilities.h"
#import "ASStackLayoutNodeUtilities.h"
#import "ASLayoutSpecUtilities.h"
#import "ASStackLayoutSpecUtilities.h"
#import "ASLayoutable.h"
static CGFloat crossOffset(const ASStackLayoutNodeStyle &style,
static CGFloat crossOffset(const ASStackLayoutSpecStyle &style,
const ASStackUnpositionedItem &l,
const CGFloat crossSize)
{
@ -30,7 +30,7 @@ static CGFloat crossOffset(const ASStackLayoutNodeStyle &style,
}
}
static ASStackPositionedLayout stackedLayout(const ASStackLayoutNodeStyle &style,
static ASStackPositionedLayout stackedLayout(const ASStackLayoutSpecStyle &style,
const CGFloat offset,
const ASStackUnpositionedLayout &unpositionedLayout,
const ASSizeRange &constrainedSize)
@ -61,7 +61,7 @@ static ASStackPositionedLayout stackedLayout(const ASStackLayoutNodeStyle &style
}
ASStackPositionedLayout ASStackPositionedLayout::compute(const ASStackUnpositionedLayout &unpositionedLayout,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &constrainedSize)
{
switch (style.justifyContent) {

View File

@ -11,7 +11,7 @@
#import <vector>
#import "ASLayout.h"
#import "ASStackLayoutNode.h"
#import "ASStackLayoutSpec.h"
struct ASStackUnpositionedItem {
/** The original source child. */
@ -31,6 +31,6 @@ struct ASStackUnpositionedLayout {
/** Given a set of children, computes the unpositioned layouts for those children. */
static ASStackUnpositionedLayout compute(const std::vector<id<ASLayoutable>> &children,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &sizeRange);
};

View File

@ -12,14 +12,14 @@
#import <numeric>
#import "ASLayoutNodeUtilities.h"
#import "ASStackLayoutNodeUtilities.h"
#import "ASLayoutSpecUtilities.h"
#import "ASStackLayoutSpecUtilities.h"
/**
Sizes the child given the parameters specified, and returns the computed layout.
*/
static ASLayout *crossChildLayout(const id<ASLayoutable> child,
const ASStackLayoutNodeStyle style,
const ASStackLayoutSpecStyle style,
const CGFloat stackMin,
const CGFloat stackMax,
const CGFloat crossMin,
@ -65,7 +65,7 @@ static ASLayout *crossChildLayout(const id<ASLayoutable> child,
@param style the layout style of the overall stack layout
*/
static void stretchChildrenAlongCrossDimension(std::vector<ASStackUnpositionedItem> &layouts,
const ASStackLayoutNodeStyle &style)
const ASStackLayoutSpecStyle &style)
{
// Find the maximum cross dimension size among child layouts
const auto it = std::max_element(layouts.begin(), layouts.end(),
@ -82,7 +82,7 @@ static void stretchChildrenAlongCrossDimension(std::vector<ASStackUnpositionedIt
// restretch all stretchable children along the cross axis using the new min. set their max size to childCrossMax,
// not crossMax, so that if any of them would choose a larger size just because the min size increased (weird!)
// they are forced to choose the same width as all the other nodes.
// they are forced to choose the same width as all the other children.
if (alignItems == ASStackLayoutAlignItemsStretch && fabs(cross - childCrossMax) > 0.01) {
l.layout = crossChildLayout(l.child, style, stack, stack, childCrossMax, childCrossMax);
}
@ -100,11 +100,11 @@ static void stretchChildrenAlongCrossDimension(std::vector<ASStackUnpositionedIt
+-----+ | | +---+
+-------+
@param children unpositioned layouts for the child nodes of the stack node
@param children unpositioned layouts for the children of the stack spec
@param style the layout style of the overall stack layout
*/
static CGFloat computeStackDimensionSum(const std::vector<ASStackUnpositionedItem> &children,
const ASStackLayoutNodeStyle &style)
const ASStackLayoutSpecStyle &style)
{
// Sum up the childrens' spacing
const CGFloat childSpacingSum = std::accumulate(children.begin(), children.end(),
@ -125,7 +125,7 @@ static CGFloat computeStackDimensionSum(const std::vector<ASStackUnpositionedIte
/**
Computes the violation by comparing a stack dimension sum with the overall allowable size range for the stack.
Violation is the distance you would have to add to the unbounded stack-direction length of the stack node's
Violation is the distance you would have to add to the unbounded stack-direction length of the stack spec's
children in order to bring the stack within its allowed sizeRange. The diagram below shows 3 horizontal stacks with
the different types of violation.
@ -151,10 +151,10 @@ static CGFloat computeStackDimensionSum(const std::vector<ASStackUnpositionedIte
@param stackDimensionSum the consumed length of the children in the stack along the stack dimension
@param style layout style to be applied to all children
@param sizeRange the range of allowable sizes for the stack layout node
@param sizeRange the range of allowable sizes for the stack layout spec
*/
static CGFloat computeViolation(const CGFloat stackDimensionSum,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &sizeRange)
{
const CGFloat minStackDimension = stackDimension(style.direction, sizeRange.min);
@ -196,7 +196,7 @@ ASDISPLAYNODE_INLINE BOOL isFlexibleInBothDirections(id<ASLayoutable> child)
number then we may avoid the first "intrinsic" size calculation.
*/
ASDISPLAYNODE_INLINE BOOL useOptimizedFlexing(const std::vector<id<ASLayoutable>> &children,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &sizeRange)
{
const NSUInteger flexibleChildren = std::count_if(children.begin(), children.end(), isFlexibleInBothDirections);
@ -210,7 +210,7 @@ ASDISPLAYNODE_INLINE BOOL useOptimizedFlexing(const std::vector<id<ASLayoutable>
these children at zero size so that the children layouts are at least present.
*/
static void layoutFlexibleChildrenAtZeroSize(std::vector<ASStackUnpositionedItem> &items,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &sizeRange)
{
for (ASStackUnpositionedItem &item : items) {
@ -235,10 +235,10 @@ static void layoutFlexibleChildrenAtZeroSize(std::vector<ASStackUnpositionedItem
@param items Reference to unpositioned items from the original, unconstrained layout pass; modified in-place
@param style layout style to be applied to all children
@param sizeRange the range of allowable sizes for the stack layout node
@param sizeRange the range of allowable sizes for the stack layout spec
*/
static void flexChildrenAlongStackDimension(std::vector<ASStackUnpositionedItem> &items,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &sizeRange,
const BOOL useOptimizedFlexing)
{
@ -284,7 +284,7 @@ static void flexChildrenAlongStackDimension(std::vector<ASStackUnpositionedItem>
stretched.
*/
static std::vector<ASStackUnpositionedItem> layoutChildrenAlongUnconstrainedStackDimension(const std::vector<id<ASLayoutable>> &children,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &sizeRange,
const CGSize size,
const BOOL useOptimizedFlexing)
@ -313,7 +313,7 @@ static std::vector<ASStackUnpositionedItem> layoutChildrenAlongUnconstrainedStac
}
ASStackUnpositionedLayout ASStackUnpositionedLayout::compute(const std::vector<id<ASLayoutable>> &children,
const ASStackLayoutNodeStyle &style,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &sizeRange)
{
const CGSize size = {

View File

@ -8,18 +8,18 @@
*
*/
#import "ASLayoutNodeSnapshotTestsHelper.h"
#import "ASLayoutSpecSnapshotTestsHelper.h"
#import "ASBackgroundLayoutNode.h"
#import "ASCenterLayoutNode.h"
#import "ASStackLayoutNode.h"
#import "ASBackgroundLayoutSpec.h"
#import "ASCenterLayoutSpec.h"
#import "ASStackLayoutSpec.h"
static const ASSizeRange kSize = {{100, 120}, {320, 160}};
@interface ASCenterLayoutNodeSnapshotTests : ASLayoutNodeSnapshotTestCase
@interface ASCenterLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase
@end
@implementation ASCenterLayoutNodeSnapshotTests
@implementation ASCenterLayoutSpecSnapshotTests
- (void)setUp
{
@ -29,61 +29,60 @@ static const ASSizeRange kSize = {{100, 120}, {320, 160}};
- (void)testWithOptions
{
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringNone sizingOptions:{}];
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringXY sizingOptions:{}];
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringX sizingOptions:{}];
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringY sizingOptions:{}];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone sizingOptions:{}];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringXY sizingOptions:{}];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringX sizingOptions:{}];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringY sizingOptions:{}];
}
- (void)testWithSizingOptions
{
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringNone sizingOptions:ASCenterLayoutNodeSizingOptionDefault];
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringNone sizingOptions:ASCenterLayoutNodeSizingOptionMinimumX];
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringNone sizingOptions:ASCenterLayoutNodeSizingOptionMinimumY];
[self testWithCenteringOptions:ASCenterLayoutNodeCenteringNone sizingOptions:ASCenterLayoutNodeSizingOptionMinimumXY];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone sizingOptions:ASCenterLayoutSpecSizingOptionDefault];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone sizingOptions:ASCenterLayoutSpecSizingOptionMinimumX];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone sizingOptions:ASCenterLayoutSpecSizingOptionMinimumY];
[self testWithCenteringOptions:ASCenterLayoutSpecCenteringNone sizingOptions:ASCenterLayoutSpecSizingOptionMinimumXY];
}
- (void)testWithCenteringOptions:(ASCenterLayoutNodeCenteringOptions)options
sizingOptions:(ASCenterLayoutNodeSizingOptions)sizingOptions
- (void)testWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)options
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions
{
ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor redColor]);
ASStaticSizeDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor]);
foregroundNode.staticSize = {70, 100};
ASLayoutNode *layoutNode =
[ASBackgroundLayoutNode
ASLayoutSpec *layoutSpec =
[ASBackgroundLayoutSpec
newWithChild:
[ASCenterLayoutNode
[ASCenterLayoutSpec
newWithCenteringOptions:options
sizingOptions:sizingOptions
child:foregroundNode]
background:backgroundNode];
[self testLayoutNode:layoutNode
[self testLayoutSpec:layoutSpec
sizeRange:kSize
subnodes:@[backgroundNode, foregroundNode]
identifier:suffixForCenteringOptions(options, sizingOptions)];
}
static NSString *suffixForCenteringOptions(ASCenterLayoutNodeCenteringOptions centeringOptions,
ASCenterLayoutNodeSizingOptions sizingOptinos)
static NSString *suffixForCenteringOptions(ASCenterLayoutSpecCenteringOptions centeringOptions,
ASCenterLayoutSpecSizingOptions sizingOptinos)
{
NSMutableString *suffix = [NSMutableString string];
if ((centeringOptions & ASCenterLayoutNodeCenteringX) != 0) {
if ((centeringOptions & ASCenterLayoutSpecCenteringX) != 0) {
[suffix appendString:@"CenteringX"];
}
if ((centeringOptions & ASCenterLayoutNodeCenteringY) != 0) {
if ((centeringOptions & ASCenterLayoutSpecCenteringY) != 0) {
[suffix appendString:@"CenteringY"];
}
if ((sizingOptinos & ASCenterLayoutNodeSizingOptionMinimumX) != 0) {
if ((sizingOptinos & ASCenterLayoutSpecSizingOptionMinimumX) != 0) {
[suffix appendString:@"SizingMinimumX"];
}
if ((sizingOptinos & ASCenterLayoutNodeSizingOptionMinimumY) != 0) {
if ((sizingOptinos & ASCenterLayoutSpecSizingOptionMinimumY) != 0) {
[suffix appendString:@"SizingMinimumY"];
}
@ -97,16 +96,16 @@ static NSString *suffixForCenteringOptions(ASCenterLayoutNodeCenteringOptions ce
foregroundNode.staticSize = {10, 10};
foregroundNode.flexGrow = YES;
ASCenterLayoutNode *layoutNode =
[ASCenterLayoutNode
newWithCenteringOptions:ASCenterLayoutNodeCenteringNone
ASCenterLayoutSpec *layoutSpec =
[ASCenterLayoutSpec
newWithCenteringOptions:ASCenterLayoutSpecCenteringNone
sizingOptions:{}
child:
[ASBackgroundLayoutNode
newWithChild:[ASStackLayoutNode newWithStyle:{} children:@[foregroundNode]]
[ASBackgroundLayoutSpec
newWithChild:[ASStackLayoutSpec newWithStyle:{} children:@[foregroundNode]]
background:backgroundNode]];
[self testLayoutNode:layoutNode sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier:nil];
[self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier:nil];
}
@end

View File

@ -8,21 +8,21 @@
*
*/
#import "ASLayoutNodeSnapshotTestsHelper.h"
#import "ASLayoutSpecSnapshotTestsHelper.h"
#import "ASBackgroundLayoutNode.h"
#import "ASInsetLayoutNode.h"
#import "ASStaticLayoutNode.h"
#import "ASBackgroundLayoutSpec.h"
#import "ASInsetLayoutSpec.h"
#import "ASStaticLayoutSpec.h"
typedef NS_OPTIONS(NSUInteger, ASInsetLayoutNodeTestEdge) {
ASInsetLayoutNodeTestEdgeTop = 1 << 0,
ASInsetLayoutNodeTestEdgeLeft = 1 << 1,
ASInsetLayoutNodeTestEdgeBottom = 1 << 2,
ASInsetLayoutNodeTestEdgeRight = 1 << 3,
typedef NS_OPTIONS(NSUInteger, ASInsetLayoutSpecTestEdge) {
ASInsetLayoutSpecTestEdgeTop = 1 << 0,
ASInsetLayoutSpecTestEdgeLeft = 1 << 1,
ASInsetLayoutSpecTestEdgeBottom = 1 << 2,
ASInsetLayoutSpecTestEdgeRight = 1 << 3,
};
static CGFloat insetForEdge(NSUInteger combination, ASInsetLayoutNodeTestEdge edge, CGFloat insetValue)
static CGFloat insetForEdge(NSUInteger combination, ASInsetLayoutSpecTestEdge edge, CGFloat insetValue)
{
return combination & edge ? INFINITY : insetValue;
}
@ -30,10 +30,10 @@ static CGFloat insetForEdge(NSUInteger combination, ASInsetLayoutNodeTestEdge ed
static UIEdgeInsets insetsForCombination(NSUInteger combination, CGFloat insetValue)
{
return {
.top = insetForEdge(combination, ASInsetLayoutNodeTestEdgeTop, insetValue),
.left = insetForEdge(combination, ASInsetLayoutNodeTestEdgeLeft, insetValue),
.bottom = insetForEdge(combination, ASInsetLayoutNodeTestEdgeBottom, insetValue),
.right = insetForEdge(combination, ASInsetLayoutNodeTestEdgeRight, insetValue),
.top = insetForEdge(combination, ASInsetLayoutSpecTestEdgeTop, insetValue),
.left = insetForEdge(combination, ASInsetLayoutSpecTestEdgeLeft, insetValue),
.bottom = insetForEdge(combination, ASInsetLayoutSpecTestEdgeBottom, insetValue),
.right = insetForEdge(combination, ASInsetLayoutSpecTestEdgeRight, insetValue),
};
}
@ -42,10 +42,10 @@ static NSString *nameForInsets(UIEdgeInsets insets)
return [NSString stringWithFormat:@"%.f-%.f-%.f-%.f", insets.top, insets.left, insets.bottom, insets.right];
}
@interface ASInsetLayoutNodeSnapshotTests : ASLayoutNodeSnapshotTestCase
@interface ASInsetLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase
@end
@implementation ASInsetLayoutNodeSnapshotTests
@implementation ASInsetLayoutSpecSnapshotTests
- (void)setUp
{
@ -61,13 +61,13 @@ static NSString *nameForInsets(UIEdgeInsets insets)
ASStaticSizeDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor]);
foregroundNode.staticSize = {10, 10};
ASLayoutNode *layoutNode =
[ASBackgroundLayoutNode
newWithChild:[ASInsetLayoutNode newWithInsets:insets child:foregroundNode]
ASLayoutSpec *layoutSpec =
[ASBackgroundLayoutSpec
newWithChild:[ASInsetLayoutSpec newWithInsets:insets child:foregroundNode]
background:backgroundNode];
static ASSizeRange kVariableSize = {{0, 0}, {300, 300}};
[self testLayoutNode:layoutNode
[self testLayoutSpec:layoutSpec
sizeRange:kVariableSize
subnodes:@[backgroundNode, foregroundNode]
identifier:nameForInsets(insets)];
@ -82,13 +82,13 @@ static NSString *nameForInsets(UIEdgeInsets insets)
ASStaticSizeDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor]);
foregroundNode.staticSize = {10, 10};
ASLayoutNode *layoutNode =
[ASBackgroundLayoutNode
newWithChild:[ASInsetLayoutNode newWithInsets:insets child:foregroundNode]
ASLayoutSpec *layoutSpec =
[ASBackgroundLayoutSpec
newWithChild:[ASInsetLayoutSpec newWithInsets:insets child:foregroundNode]
background:backgroundNode];
static ASSizeRange kFixedSize = {{300, 300}, {300, 300}};
[self testLayoutNode:layoutNode
[self testLayoutSpec:layoutSpec
sizeRange:kFixedSize
subnodes:@[backgroundNode, foregroundNode]
identifier:nameForInsets(insets)];
@ -104,13 +104,13 @@ static NSString *nameForInsets(UIEdgeInsets insets)
ASStaticSizeDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor greenColor]);
foregroundNode.staticSize = {10, 10};
ASLayoutNode *layoutNode =
[ASBackgroundLayoutNode
newWithChild:[ASInsetLayoutNode newWithInsets:insets child:foregroundNode]
ASLayoutSpec *layoutSpec =
[ASBackgroundLayoutSpec
newWithChild:[ASInsetLayoutSpec newWithInsets:insets child:foregroundNode]
background:backgroundNode];
static ASSizeRange kFixedSize = {{300, 300}, {300, 300}};
[self testLayoutNode:layoutNode
[self testLayoutSpec:layoutSpec
sizeRange:kFixedSize
subnodes:@[backgroundNode, foregroundNode]
identifier:nameForInsets(insets)];

View File

@ -1,29 +1,31 @@
//
// ASLayoutNodeTestsHelper.h
// AsyncDisplayKit
//
// Created by Huy Nguyen on 28/05/15.
// Copyright (c) 2015 Facebook. All rights reserved.
//
/*
* Copyright (c) 2015-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 "ASSnapshotTestCase.h"
#import "ASDisplayNode+Subclasses.h"
@class ASLayoutNode;
@class ASLayoutSpec;
@interface ASLayoutNodeSnapshotTestCase: ASSnapshotTestCase
@interface ASLayoutSpecSnapshotTestCase: ASSnapshotTestCase
/**
Test the layout node or records a snapshot if recordMode is YES.
@param layoutNode The layout node under test or to snapshot
@param sizeRange The size range used to calculate layout of the given layout node.
@param subnodes An array of ASDisplayNodes used within the layout node.
Test the layout spec or records a snapshot if recordMode is YES.
@param layoutSpec The layout spec under test or to snapshot
@param sizeRange The size range used to calculate layout of the given layout spec.
@param subnodes An array of ASDisplayNodes used within the layout spec.
@param identifier An optional identifier, used to identify this snapshot test.
@discussion In order to make the layout node visible, it is embeded to a ASDisplayNode host.
Any display nodes used within the layout must be provided.
They will be added to the host in the same order as the subnodes array.
@discussion In order to make the layout spec visible, it is embeded to a ASDisplayNode host.
Any subnodes used within the layout spec must be provided.
They will be added to the host in the same order as the array.
*/
- (void)testLayoutNode:(ASLayoutNode *)layoutNode
- (void)testLayoutSpec:(ASLayoutSpec *)layoutSpec
sizeRange:(ASSizeRange)sizeRange
subnodes:(NSArray *)subnodes
identifier:(NSString *)identifier;

View File

@ -1,23 +1,25 @@
//
// ASLayoutNodeTestsHelper.m
// AsyncDisplayKit
//
// Created by Huy Nguyen on 28/05/15.
// Copyright (c) 2015 Facebook. All rights reserved.
//
/*
* Copyright (c) 2015-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 "ASLayoutNodeSnapshotTestsHelper.h"
#import "ASLayoutSpecSnapshotTestsHelper.h"
#import "ASDisplayNode.h"
#import "ASLayoutNode.h"
#import "ASLayoutSpec.h"
@interface ASTestNode : ASDisplayNode
- (void)setLayoutNodeUnderTest:(ASLayoutNode *)layoutNodeUnderTest sizeRange:(ASSizeRange)sizeRange;
- (void)setLayoutSpecUnderTest:(ASLayoutSpec *)layoutSpecUnderTest sizeRange:(ASSizeRange)sizeRange;
@end
@implementation ASLayoutNodeSnapshotTestCase
@implementation ASLayoutSpecSnapshotTestCase
- (void)testLayoutNode:(ASLayoutNode *)layoutNode
- (void)testLayoutSpec:(ASLayoutSpec *)layoutSpec
sizeRange:(ASSizeRange)sizeRange
subnodes:(NSArray *)subnodes
identifier:(NSString *)identifier
@ -28,7 +30,7 @@
[node addSubnode:subnode];
}
[node setLayoutNodeUnderTest:layoutNode sizeRange:sizeRange];
[node setLayoutSpecUnderTest:layoutSpec sizeRange:sizeRange];
ASSnapshotVerifyNode(node, identifier);
}
@ -48,9 +50,9 @@
return self;
}
- (void)setLayoutNodeUnderTest:(ASLayoutNode *)layoutNodeUnderTest sizeRange:(ASSizeRange)sizeRange
- (void)setLayoutSpecUnderTest:(ASLayoutSpec *)layoutSpecUnderTest sizeRange:(ASSizeRange)sizeRange
{
_layoutUnderTest = [[layoutNodeUnderTest calculateLayoutThatFits:sizeRange] flattenedLayoutUsingPredicateBlock:^BOOL(ASLayout *evaluatedLayout) {
_layoutUnderTest = [[layoutSpecUnderTest calculateLayoutThatFits:sizeRange] flattenedLayoutUsingPredicateBlock:^BOOL(ASLayout *evaluatedLayout) {
return [self.subnodes containsObject:evaluatedLayout.layoutableObject];
}];
self.frame = CGRectMake(0, 0, _layoutUnderTest.size.width, _layoutUnderTest.size.height);

View File

@ -8,17 +8,17 @@
*
*/
#import "ASLayoutNodeSnapshotTestsHelper.h"
#import "ASLayoutSpecSnapshotTestsHelper.h"
#import "ASOverlayLayoutNode.h"
#import "ASCenterLayoutNode.h"
#import "ASOverlayLayoutSpec.h"
#import "ASCenterLayoutSpec.h"
static const ASSizeRange kSize = {{320, 320}, {320, 320}};
@interface ASOverlayLayoutNodeSnapshotTests : ASLayoutNodeSnapshotTestCase
@interface ASOverlayLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase
@end
@implementation ASOverlayLayoutNodeSnapshotTests
@implementation ASOverlayLayoutSpecSnapshotTests
- (void)setUp
{
@ -32,16 +32,16 @@ static const ASSizeRange kSize = {{320, 320}, {320, 320}};
ASStaticSizeDisplayNode *foregroundNode = ASDisplayNodeWithBackgroundColor([UIColor blackColor]);
foregroundNode.staticSize = {20, 20};
ASLayoutNode *layoutNode =
[ASOverlayLayoutNode
ASLayoutSpec *layoutSpec =
[ASOverlayLayoutSpec
newWithChild:backgroundNode
overlay:
[ASCenterLayoutNode
newWithCenteringOptions:ASCenterLayoutNodeCenteringXY
[ASCenterLayoutSpec
newWithCenteringOptions:ASCenterLayoutSpecCenteringXY
sizingOptions:{}
child:foregroundNode]];
[self testLayoutNode:layoutNode sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier: nil];
[self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:@[backgroundNode, foregroundNode] identifier: nil];
}
@end

View File

@ -1,46 +0,0 @@
/*
* 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 "ASLayoutNodeSnapshotTestsHelper.h"
#import "ASRatioLayoutNode.h"
static const ASSizeRange kFixedSize = {{0, 0}, {100, 100}};
@interface ASRatioLayoutNodeSnapshotTests : ASLayoutNodeSnapshotTestCase
@end
@implementation ASRatioLayoutNodeSnapshotTests
- (void)setUp
{
[super setUp];
self.recordMode = NO;
}
- (void)testRatioLayoutNodeWithRatio:(CGFloat)ratio childNodeSize:(CGSize)childNodeSize identifier:(NSString *)identifier
{
ASStaticSizeDisplayNode *subnode = ASDisplayNodeWithBackgroundColor([UIColor greenColor]);
subnode.staticSize = childNodeSize;
ASLayoutNode *layoutNode = [ASRatioLayoutNode newWithRatio:ratio child:subnode];
[self testLayoutNode:layoutNode sizeRange:kFixedSize subnodes:@[subnode] identifier:identifier];
}
- (void)testRatioLayout
{
[self testRatioLayoutNodeWithRatio:0.5 childNodeSize:CGSizeMake(100, 100) identifier:@"HalfRatio"];
[self testRatioLayoutNodeWithRatio:2.0 childNodeSize:CGSizeMake(100, 100) identifier:@"DoubleRatio"];
[self testRatioLayoutNodeWithRatio:7.0 childNodeSize:CGSizeMake(100, 100) identifier:@"SevenTimesRatio"];
[self testRatioLayoutNodeWithRatio:10.0 childNodeSize:CGSizeMake(20, 200) identifier:@"TenTimesRatioWithItemTooBig"];
}
@end

View File

@ -0,0 +1,46 @@
/*
* 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 "ASLayoutSpecSnapshotTestsHelper.h"
#import "ASRatioLayoutSpec.h"
static const ASSizeRange kFixedSize = {{0, 0}, {100, 100}};
@interface ASRatioLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase
@end
@implementation ASRatioLayoutSpecSnapshotTests
- (void)setUp
{
[super setUp];
self.recordMode = NO;
}
- (void)testRatioLayoutSpecWithRatio:(CGFloat)ratio childSize:(CGSize)childSize identifier:(NSString *)identifier
{
ASStaticSizeDisplayNode *subnode = ASDisplayNodeWithBackgroundColor([UIColor greenColor]);
subnode.staticSize = childSize;
ASLayoutSpec *layoutSpec = [ASRatioLayoutSpec newWithRatio:ratio child:subnode];
[self testLayoutSpec:layoutSpec sizeRange:kFixedSize subnodes:@[subnode] identifier:identifier];
}
- (void)testRatioLayout
{
[self testRatioLayoutSpecWithRatio:0.5 childSize:CGSizeMake(100, 100) identifier:@"HalfRatio"];
[self testRatioLayoutSpecWithRatio:2.0 childSize:CGSizeMake(100, 100) identifier:@"DoubleRatio"];
[self testRatioLayoutSpecWithRatio:7.0 childSize:CGSizeMake(100, 100) identifier:@"SevenTimesRatio"];
[self testRatioLayoutSpecWithRatio:10.0 childSize:CGSizeMake(20, 200) identifier:@"TenTimesRatioWithItemTooBig"];
}
@end

View File

@ -8,17 +8,17 @@
*
*/
#import "ASLayoutNodeSnapshotTestsHelper.h"
#import "ASLayoutSpecSnapshotTestsHelper.h"
#import "ASStackLayoutNode.h"
#import "ASBackgroundLayoutNode.h"
#import "ASRatioLayoutNode.h"
#import "ASInsetLayoutNode.h"
#import "ASStackLayoutSpec.h"
#import "ASBackgroundLayoutSpec.h"
#import "ASRatioLayoutSpec.h"
#import "ASInsetLayoutSpec.h"
@interface ASStackLayoutNodeSnapshotTests : ASLayoutNodeSnapshotTestCase
@interface ASStackLayoutSpecSnapshotTests : ASLayoutSpecSnapshotTestCase
@end
@implementation ASStackLayoutNodeSnapshotTests
@implementation ASStackLayoutSpecSnapshotTests
- (void)setUp
{
@ -46,30 +46,30 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
return subnodes;
}
- (void)testStackLayoutNodeWithJustify:(ASStackLayoutJustifyContent)justify
- (void)testStackLayoutSpecWithJustify:(ASStackLayoutJustifyContent)justify
flex:(BOOL)flex
sizeRange:(ASSizeRange)sizeRange
identifier:(NSString *)identifier
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionHorizontal,
.justifyContent = justify
};
NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, flex);
[self testStackLayoutNodeWithStyle:style sizeRange:sizeRange subnodes:subnodes identifier:identifier];
[self testStackLayoutSpecWithStyle:style sizeRange:sizeRange subnodes:subnodes identifier:identifier];
}
- (void)testStackLayoutNodeWithStyle:(ASStackLayoutNodeStyle)style
- (void)testStackLayoutSpecWithStyle:(ASStackLayoutSpecStyle)style
sizeRange:(ASSizeRange)sizeRange
subnodes:(NSArray *)subnodes
identifier:(NSString *)identifier
{
[self testStackLayoutNodeWithStyle:style children:subnodes sizeRange:sizeRange subnodes:subnodes identifier:identifier];
[self testStackLayoutSpecWithStyle:style children:subnodes sizeRange:sizeRange subnodes:subnodes identifier:identifier];
}
- (void)testStackLayoutNodeWithStyle:(ASStackLayoutNodeStyle)style
- (void)testStackLayoutSpecWithStyle:(ASStackLayoutSpecStyle)style
children:(NSArray *)children
sizeRange:(ASSizeRange)sizeRange
subnodes:(NSArray *)subnodes
@ -77,68 +77,68 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
{
ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor whiteColor]);
ASLayoutNode *layoutNode =
[ASBackgroundLayoutNode
newWithChild:[ASStackLayoutNode newWithStyle:style children:children]
ASLayoutSpec *layoutSpec =
[ASBackgroundLayoutSpec
newWithChild:[ASStackLayoutSpec newWithStyle:style children:children]
background:backgroundNode];
NSMutableArray *newSubnodes = [NSMutableArray arrayWithObject:backgroundNode];
[newSubnodes addObjectsFromArray:subnodes];
[self testLayoutNode:layoutNode sizeRange:sizeRange subnodes:newSubnodes identifier:identifier];
[self testLayoutSpec:layoutSpec sizeRange:sizeRange subnodes:newSubnodes identifier:identifier];
}
- (void)testUnderflowBehaviors
{
// width 300px; height 0-300px
static ASSizeRange kSize = {{300, 0}, {300, 300}};
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentStart flex:NO sizeRange:kSize identifier:@"justifyStart"];
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentCenter flex:NO sizeRange:kSize identifier:@"justifyCenter"];
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentEnd flex:NO sizeRange:kSize identifier:@"justifyEnd"];
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentStart flex:YES sizeRange:kSize identifier:@"flex"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flex:NO sizeRange:kSize identifier:@"justifyStart"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentCenter flex:NO sizeRange:kSize identifier:@"justifyCenter"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentEnd flex:NO sizeRange:kSize identifier:@"justifyEnd"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flex:YES sizeRange:kSize identifier:@"flex"];
}
- (void)testOverflowBehaviors
{
// width 110px; height 0-300px
static ASSizeRange kSize = {{110, 0}, {110, 300}};
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentStart flex:NO sizeRange:kSize identifier:@"justifyStart"];
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentCenter flex:NO sizeRange:kSize identifier:@"justifyCenter"];
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentEnd flex:NO sizeRange:kSize identifier:@"justifyEnd"];
[self testStackLayoutNodeWithJustify:ASStackLayoutJustifyContentStart flex:YES sizeRange:kSize identifier:@"flex"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flex:NO sizeRange:kSize identifier:@"justifyStart"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentCenter flex:NO sizeRange:kSize identifier:@"justifyCenter"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentEnd flex:NO sizeRange:kSize identifier:@"justifyEnd"];
[self testStackLayoutSpecWithJustify:ASStackLayoutJustifyContentStart flex:YES sizeRange:kSize identifier:@"flex"];
}
- (void)testOverflowBehaviorsWhenAllFlexShrinkNodesHaveBeenClampedToZeroButViolationStillExists
- (void)testOverflowBehaviorsWhenAllFlexShrinkChildrenHaveBeenClampedToZeroButViolationStillExists
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, NO);
((ASDisplayNode *)subnodes[1]).flexShrink = YES;
// Width is 75px--that's less than the sum of the widths of the child nodes, which is 100px.
// Width is 75px--that's less than the sum of the widths of the children, which is 100px.
static ASSizeRange kSize = {{75, 0}, {75, 150}};
[self testStackLayoutNodeWithStyle: style sizeRange:kSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil];
}
- (void)testFlexWithUnequalIntrinsicSizes
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, YES);
((ASStaticSizeDisplayNode *)subnodes[1]).staticSize = {150, 150};
// width 300px; height 0-150px.
static ASSizeRange kUnderflowSize = {{300, 0}, {300, 150}};
[self testStackLayoutNodeWithStyle:style sizeRange:kUnderflowSize subnodes:subnodes identifier:@"underflow"];
[self testStackLayoutSpecWithStyle:style sizeRange:kUnderflowSize subnodes:subnodes identifier:@"underflow"];
// width 200px; height 0-150px.
static ASSizeRange kOverflowSize = {{200, 0}, {200, 150}};
[self testStackLayoutNodeWithStyle:style sizeRange:kOverflowSize subnodes:subnodes identifier:@"overflow"];
[self testStackLayoutSpecWithStyle:style sizeRange:kOverflowSize subnodes:subnodes identifier:@"overflow"];
}
- (void)testCrossAxisSizeBehaviors
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionVertical};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical};
NSArray *subnodes = defaultSubnodes();
((ASStaticSizeDisplayNode *)subnodes[0]).staticSize = {50, 50};
@ -147,16 +147,16 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
// width 0-300px; height 300px
static ASSizeRange kVariableHeight = {{0, 300}, {300, 300}};
[self testStackLayoutNodeWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"];
[self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"];
// width 300px; height 300px
static ASSizeRange kFixedHeight = {{300, 300}, {300, 300}};
[self testStackLayoutNodeWithStyle:style sizeRange:kFixedHeight subnodes:subnodes identifier:@"fixedHeight"];
[self testStackLayoutSpecWithStyle:style sizeRange:kFixedHeight subnodes:subnodes identifier:@"fixedHeight"];
}
- (void)testStackSpacing
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.spacing = 10
};
@ -168,22 +168,22 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
// width 0-300px; height 300px
static ASSizeRange kVariableHeight = {{0, 300}, {300, 300}};
[self testStackLayoutNodeWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"];
[self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"];
}
- (void)testStackSpacingWithChildrenHavingNilNodes
- (void)testStackSpacingWithChildrenHavingNilObjects
{
// This should take a zero height since all children have a nil node. If it takes a height > 0, a blue background
// will show up, hence failing the test.
ASDisplayNode *backgroundNode = ASDisplayNodeWithBackgroundColor([UIColor blueColor]);
ASLayoutNode *layoutNode =
[ASInsetLayoutNode
ASLayoutSpec *layoutSpec =
[ASInsetLayoutSpec
newWithInsets:{10, 10, 10 ,10}
child:
[ASBackgroundLayoutNode
[ASBackgroundLayoutSpec
newWithChild:
[ASStackLayoutNode
[ASStackLayoutSpec
newWithStyle:{
.direction = ASStackLayoutDirectionVertical,
.spacing = 10,
@ -194,14 +194,14 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
// width 300px; height 0-300px
static ASSizeRange kVariableHeight = {{300, 0}, {300, 300}};
[self testLayoutNode:layoutNode sizeRange:kVariableHeight subnodes:@[backgroundNode] identifier:@"variableHeight"];
[self testLayoutSpec:layoutSpec sizeRange:kVariableHeight subnodes:@[backgroundNode] identifier:@"variableHeight"];
}
- (void)testNodeSpacing
- (void)testChildSpacing
{
// width 0-INF; height 0-INF
static ASSizeRange kAnySize = {{0, 0}, {INFINITY, INFINITY}};
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionVertical};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionVertical};
NSArray *subnodes = defaultSubnodes();
((ASStaticSizeDisplayNode *)subnodes[0]).staticSize = {50, 50};
@ -210,14 +210,14 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
((ASStaticSizeDisplayNode *)subnodes[1]).spacingBefore = 10;
((ASStaticSizeDisplayNode *)subnodes[2]).spacingBefore = 20;
[self testStackLayoutNodeWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingBefore"];
[self testStackLayoutSpecWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingBefore"];
// Reset above spacing values
((ASStaticSizeDisplayNode *)subnodes[1]).spacingBefore = 0;
((ASStaticSizeDisplayNode *)subnodes[2]).spacingBefore = 0;
((ASStaticSizeDisplayNode *)subnodes[1]).spacingAfter = 10;
((ASStaticSizeDisplayNode *)subnodes[2]).spacingAfter = 20;
[self testStackLayoutNodeWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingAfter"];
[self testStackLayoutSpecWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingAfter"];
// Reset above spacing values
((ASStaticSizeDisplayNode *)subnodes[1]).spacingAfter = 0;
((ASStaticSizeDisplayNode *)subnodes[2]).spacingAfter = 0;
@ -225,12 +225,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
style.spacing = 10;
((ASStaticSizeDisplayNode *)subnodes[1]).spacingBefore = -10;
((ASStaticSizeDisplayNode *)subnodes[1]).spacingAfter = -10;
[self testStackLayoutNodeWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingBalancedOut"];
[self testStackLayoutSpecWithStyle:style sizeRange:kAnySize subnodes:subnodes identifier:@"spacingBalancedOut"];
}
- (void)testJustifiedCenterWithNodeSpacing
- (void)testJustifiedCenterWithChildSpacing
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.justifyContent = ASStackLayoutJustifyContentCenter
};
@ -246,29 +246,29 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
// width 0-300px; height 300px
static ASSizeRange kVariableHeight = {{0, 300}, {300, 300}};
[self testStackLayoutNodeWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"];
[self testStackLayoutSpecWithStyle:style sizeRange:kVariableHeight subnodes:subnodes identifier:@"variableHeight"];
}
- (void)testNodeThatChangesCrossSizeWhenMainSizeIsFlexed
- (void)testChildThatChangesCrossSizeWhenMainSizeIsFlexed
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStaticSizeDisplayNode * subnode1 = ASDisplayNodeWithBackgroundColor([UIColor blueColor]);
ASStaticSizeDisplayNode * subnode2 = ASDisplayNodeWithBackgroundColor([UIColor redColor]);
subnode2.staticSize = {50, 50};
ASRatioLayoutNode *child1 = [ASRatioLayoutNode newWithRatio:1.5 child:subnode1];
ASRatioLayoutSpec *child1 = [ASRatioLayoutSpec newWithRatio:1.5 child:subnode1];
child1.flexBasis = ASRelativeDimensionMakeWithPercent(1);
child1.flexGrow = YES;
child1.flexShrink = YES;
static ASSizeRange kFixedWidth = {{150, 0}, {150, INFINITY}};
[self testStackLayoutNodeWithStyle:style children:@[child1, subnode2] sizeRange:kFixedWidth subnodes:@[subnode1, subnode2] identifier:nil];
[self testStackLayoutSpecWithStyle:style children:@[child1, subnode2] sizeRange:kFixedWidth subnodes:@[subnode1, subnode2] identifier:nil];
}
- (void)testAlignCenterWithFlexedMainDimension
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.alignItems = ASStackLayoutAlignItemsCenter
};
@ -283,12 +283,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
NSArray *subnodes = @[subnode1, subnode2];
static ASSizeRange kFixedWidth = {{150, 0}, {150, 100}};
[self testStackLayoutNodeWithStyle:style sizeRange:kFixedWidth subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kFixedWidth subnodes:subnodes identifier:nil];
}
- (void)testAlignCenterWithIndefiniteCrossDimension
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStaticSizeDisplayNode *subnode1 = ASDisplayNodeWithBackgroundColor([UIColor redColor]);
subnode1.staticSize = {100, 100};
@ -299,12 +299,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
NSArray *subnodes = @[subnode1, subnode2];
static ASSizeRange kFixedWidth = {{150, 0}, {150, INFINITY}};
[self testStackLayoutNodeWithStyle:style sizeRange:kFixedWidth subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kFixedWidth subnodes:subnodes identifier:nil];
}
- (void)testAlignedStart
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.justifyContent = ASStackLayoutJustifyContentCenter,
.alignItems = ASStackLayoutAlignItemsStart
@ -320,12 +320,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
((ASStaticSizeDisplayNode *)subnodes[2]).spacingBefore = 30;
static ASSizeRange kExactSize = {{300, 300}, {300, 300}};
[self testStackLayoutNodeWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil];
}
- (void)testAlignedEnd
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.justifyContent = ASStackLayoutJustifyContentCenter,
.alignItems = ASStackLayoutAlignItemsEnd
@ -341,12 +341,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
((ASStaticSizeDisplayNode *)subnodes[2]).spacingBefore = 30;
static ASSizeRange kExactSize = {{300, 300}, {300, 300}};
[self testStackLayoutNodeWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil];
}
- (void)testAlignedCenter
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.justifyContent = ASStackLayoutJustifyContentCenter,
.alignItems = ASStackLayoutAlignItemsCenter
@ -362,12 +362,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
((ASStaticSizeDisplayNode *)subnodes[2]).spacingBefore = 30;
static ASSizeRange kExactSize = {{300, 300}, {300, 300}};
[self testStackLayoutNodeWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kExactSize subnodes:subnodes identifier:nil];
}
- (void)testAlignedStretchNoChildExceedsMin
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.justifyContent = ASStackLayoutJustifyContentCenter,
.alignItems = ASStackLayoutAlignItemsStretch
@ -384,12 +384,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
static ASSizeRange kVariableSize = {{200, 200}, {300, 300}};
// all children should be 200px wide
[self testStackLayoutNodeWithStyle:style sizeRange:kVariableSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kVariableSize subnodes:subnodes identifier:nil];
}
- (void)testAlignedStretchOneChildExceedsMin
{
ASStackLayoutNodeStyle style = {
ASStackLayoutSpecStyle style = {
.direction = ASStackLayoutDirectionVertical,
.justifyContent = ASStackLayoutJustifyContentCenter,
.alignItems = ASStackLayoutAlignItemsStretch
@ -406,18 +406,18 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
static ASSizeRange kVariableSize = {{50, 50}, {300, 300}};
// all children should be 150px wide
[self testStackLayoutNodeWithStyle:style sizeRange:kVariableSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kVariableSize subnodes:subnodes identifier:nil];
}
- (void)testEmptyStack
{
static ASSizeRange kVariableSize = {{50, 50}, {300, 300}};
[self testStackLayoutNodeWithStyle:{} sizeRange:kVariableSize subnodes:@[] identifier:nil];
[self testStackLayoutSpecWithStyle:{} sizeRange:kVariableSize subnodes:@[] identifier:nil];
}
- (void)testFixedFlexBasisAppliedWhenFlexingItems
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, NO);
((ASStaticSizeDisplayNode *)subnodes[1]).staticSize = {150, 150};
@ -429,16 +429,16 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
// width 300px; height 0-150px.
static ASSizeRange kUnderflowSize = {{300, 0}, {300, 150}};
[self testStackLayoutNodeWithStyle:style sizeRange:kUnderflowSize subnodes:subnodes identifier:@"underflow"];
[self testStackLayoutSpecWithStyle:style sizeRange:kUnderflowSize subnodes:subnodes identifier:@"underflow"];
// width 200px; height 0-150px.
static ASSizeRange kOverflowSize = {{200, 0}, {200, 150}};
[self testStackLayoutNodeWithStyle:style sizeRange:kOverflowSize subnodes:subnodes identifier:@"overflow"];
[self testStackLayoutSpecWithStyle:style sizeRange:kOverflowSize subnodes:subnodes identifier:@"overflow"];
}
- (void)testPercentageFlexBasisResolvesAgainstParentSize
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
NSArray *subnodes = defaultSubnodesWithSameSize({50, 50}, NO);
@ -451,12 +451,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
((ASStaticSizeDisplayNode *)subnodes[0]).flexBasis = ASRelativeDimensionMakeWithPercent(0.5);
static ASSizeRange kSize = {{200, 0}, {200, INFINITY}};
[self testStackLayoutNodeWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil];
}
- (void)testFixedFlexBasisOverridesIntrinsicSizeForNonFlexingChildren
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
NSArray *subnodes = defaultSubnodes();
((ASStaticSizeDisplayNode *)subnodes[0]).staticSize = {50, 50};
@ -468,7 +468,7 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
}
static ASSizeRange kSize = {{300, 0}, {300, 150}};
[self testStackLayoutNodeWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil];
}
- (void)testCrossAxisStretchingOccursAfterStackAxisFlexing
@ -481,19 +481,19 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
((ASStaticSizeDisplayNode *)subnodes[1]).staticSize = {10, 0};
((ASStaticSizeDisplayNode *)subnodes[2]).staticSize = {3000, 3000};
ASRatioLayoutNode *child2 = [ASRatioLayoutNode newWithRatio:1.0 child:subnodes[2]];
ASRatioLayoutSpec *child2 = [ASRatioLayoutSpec newWithRatio:1.0 child:subnodes[2]];
child2.flexGrow = YES;
child2.flexShrink = YES;
// If cross axis stretching occurred *before* flexing, then the blue child would be stretched to 3000 points tall.
// Instead it should be stretched to 300 points tall, matching the red child and not overlapping the green inset.
ASLayoutNode *layoutNode =
[ASBackgroundLayoutNode
ASLayoutSpec *layoutSpec =
[ASBackgroundLayoutSpec
newWithChild:
[ASInsetLayoutNode
[ASInsetLayoutSpec
newWithInsets:UIEdgeInsetsMake(10, 10, 10, 10)
child:
[ASStackLayoutNode
[ASStackLayoutSpec
newWithStyle:{
.direction = ASStackLayoutDirectionHorizontal,
.alignItems = ASStackLayoutAlignItemsStretch,
@ -502,12 +502,12 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
background:subnodes[0]];
static ASSizeRange kSize = {{300, 0}, {300, INFINITY}};
[self testLayoutNode:layoutNode sizeRange:kSize subnodes:subnodes identifier:nil];
[self testLayoutSpec:layoutSpec sizeRange:kSize subnodes:subnodes identifier:nil];
}
- (void)testViolationIsDistributedEquallyAmongFlexibleChildNodes
- (void)testViolationIsDistributedEquallyAmongFlexibleChildren
{
ASStackLayoutNodeStyle style = {.direction = ASStackLayoutDirectionHorizontal};
ASStackLayoutSpecStyle style = {.direction = ASStackLayoutDirectionHorizontal};
NSArray *subnodes = defaultSubnodes();
@ -520,13 +520,13 @@ static NSArray *defaultSubnodesWithSameSize(CGSize subnodeSize, BOOL flex)
((ASStaticSizeDisplayNode *)subnodes[2]).staticSize = {200, 50};
((ASStaticSizeDisplayNode *)subnodes[2]).flexShrink = YES;
// A width of 400px results in a violation of 200px. This is distributed equally among each flexible node,
// A width of 400px results in a violation of 200px. This is distributed equally among each flexible child,
// causing both of them to be shrunk by 100px, resulting in widths of 300px, 100px, and 50px.
// In the W3 flexbox standard, flexible nodes are shrunk proportionate to their original sizes,
// In the W3 flexbox standard, flexible children are shrunk proportionate to their original sizes,
// resulting in widths of 180px, 100px, and 120px.
// This test verifies the current behavior--the snapshot contains widths 300px, 100px, and 50px.
static ASSizeRange kSize = {{400, 0}, {400, 150}};
[self testStackLayoutNodeWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil];
[self testStackLayoutSpecWithStyle:style sizeRange:kSize subnodes:subnodes identifier:nil];
}
@end

Some files were not shown because too many files have changed in this diff Show More