Remove view.isHidden optimization from sizing/layout.

Summary:
Originally, we thought that skipping the measurement of views that were hidden would be a nice optimiatzion. Upon further review, we saw that according to Apple's `UIView` documentation:

> A hidden view disappears from its window and does not receive input events. It remains in its superview’s list of subviews, however, and participates in autoresizing as usual.

So, to keep parity with common iOS layout APIs, we are going to size and layout views, even if they are hidden.

Reviewed By: emilsjolander

Differential Revision: D4051225

fbshipit-source-id: 0794cbad293a7de83d109dad2b3983d83845d145
This commit is contained in:
Dustin Shahidehpour
2016-10-20 09:27:49 -07:00
committed by Facebook Github Bot
parent 2e090cb1c8
commit 26bcc1e072
2 changed files with 0 additions and 28 deletions

View File

@@ -46,24 +46,4 @@
XCTAssertEqual(0, CSSNodeGetInstanceCount());
}
- (void)testHiddenViewsAreNotMeasured
{
const CGSize firstSize = CGSizeMake(100, 100);
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
[view css_setUsesFlexbox:YES];
[view css_setWidth:firstSize.width];
[view css_setHeight:firstSize.height];
[view css_applyLayout];
XCTAssertTrue(CGSizeEqualToSize(firstSize, view.frame.size));
const CGSize newSize = CGSizeMake(200, 200);
[view css_setWidth:newSize.width];
[view css_setHeight:newSize.height];
view.hidden = YES;
[view css_applyLayout];
XCTAssertFalse(CGSizeEqualToSize(newSize, view.frame.size));
}
@end

View File

@@ -237,10 +237,6 @@ static CSSSize _measure(
@end
static void _attachNodesRecursive(UIView *view) {
if (view.isHidden) {
return;
}
CSSNodeRef node = [view cssNode];
const BOOL usesFlexbox = [view css_usesFlexbox];
const BOOL isLeaf = !usesFlexbox || view.subviews.count == 0;
@@ -273,10 +269,6 @@ static void _attachNodesRecursive(UIView *view) {
}
static void _updateFrameRecursive(UIView *view) {
if (view.isHidden) {
return;
}
CSSNodeRef node = [view cssNode];
const BOOL usesFlexbox = [view css_usesFlexbox];
const BOOL isLeaf = !usesFlexbox || view.subviews.count == 0;