Merge pull request #2492 from didierkorthoudt/cpview-updateTA-recursive-bug

Fixed: CPView setFrameSize was calling _updateTrackingAreas too often + empty overlappingTA test
This commit is contained in:
Martin Carlberg authored and GitHub committed 2016-10-13 16:07:10 +02:00
commit 969d1dff2a
2 files changed
+19 -16

No files matched your search

+16 -16
View File
@@ -1030,7 +1030,7 @@ var CPViewHighDPIDrawingEnabled = YES;
[[self superview] viewFrameChanged:[[CPNotification alloc] initWithName:CPViewFrameDidChangeNotification object:self userInfo:nil]];
if (!_inhibitUpdateTrackingAreas)
[self _updateTrackingAreas];
[self _updateTrackingAreasWithRecursion:YES];
}
/*!
@@ -1103,7 +1103,7 @@ var CPViewHighDPIDrawingEnabled = YES;
#endif
if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
[self _updateTrackingAreas];
[self _updateTrackingAreasWithRecursion:YES];
}
/*!
@@ -1257,7 +1257,7 @@ var CPViewHighDPIDrawingEnabled = YES;
[[self superview] viewFrameChanged:[[CPNotification alloc] initWithName:CPViewFrameDidChangeNotification object:self userInfo:nil]];
if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
[self _updateTrackingAreas];
[self _updateTrackingAreasWithRecursion:!_autoresizesSubviews];
}
/*!
@@ -1306,7 +1306,7 @@ var CPViewHighDPIDrawingEnabled = YES;
[[self superview] viewBoundsChanged:[[CPNotification alloc] initWithName:CPViewBoundsDidChangeNotification object:self userInfo:nil]];
if (!_inhibitUpdateTrackingAreas)
[self _updateTrackingAreas];
[self _updateTrackingAreasWithRecursion:YES];
}
/*!
@@ -1374,7 +1374,7 @@ var CPViewHighDPIDrawingEnabled = YES;
[[self superview] viewBoundsChanged:[[CPNotification alloc] initWithName:CPViewBoundsDidChangeNotification object:self userInfo:nil]];
if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
[self _updateTrackingAreas];
[self _updateTrackingAreasWithRecursion:YES];
}
/*!
@@ -1418,7 +1418,7 @@ var CPViewHighDPIDrawingEnabled = YES;
[[self superview] viewBoundsChanged:[[CPNotification alloc] initWithName:CPViewBoundsDidChangeNotification object:self userInfo:nil]];
if (!_inhibitUpdateTrackingAreas && !_inhibitFrameAndBoundsChangedNotifications)
[self _updateTrackingAreas];
[self _updateTrackingAreasWithRecursion:YES];
}
@@ -3590,21 +3590,21 @@ setBoundsOrigin:
[_trackingAreas removeObjectIdenticalTo:trackingArea];
}
- (void)_updateTrackingAreas
- (void)_updateTrackingAreasWithRecursion:(BOOL)shouldCallRecursively
{
_inhibitUpdateTrackingAreas = YES;
[self _recursivelyUpdateTrackingAreas];
_inhibitUpdateTrackingAreas = NO;
}
- (void)_recursivelyUpdateTrackingAreas
{
[self _updateTrackingAreasForOwners:[self _calcTrackingAreaOwners]];
for (var i = 0; i < _subviews.length; i++)
[_subviews[i] _recursivelyUpdateTrackingAreas];
if (shouldCallRecursively)
{
// Now, call _updateTrackingAreasWithRecursion on subviews
for (var i = 0; i < _subviews.length; i++)
[_subviews[i] _updateTrackingAreasWithRecursion:YES];
}
_inhibitUpdateTrackingAreas = NO;
}
- (CPArray)_calcTrackingAreaOwners
+3
View File
@@ -4098,6 +4098,9 @@ var interpolate = function(fromValue, toValue, progress)
[overlappingTrackingAreas addObject:aTrackingArea];
}
if (overlappingTrackingAreas.length === 0)
return;
var frontmostTrackingArea = overlappingTrackingAreas[0],
frontmostView = [frontmostTrackingArea view];