You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by mo...@apache.org on 2019/10/04 09:54:01 UTC
[incubator-weex] 01/01: [iOS] Rename the backgroundColor property
name.
This is an automated email from the ASF dual-hosted git repository.
moshen pushed a commit to branch fix-background-color-name-collision
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
commit 3fa4382b54e33273f41fbeb533610be4b3e1c711
Author: qianyuan.wqy <qi...@taobao.com>
AuthorDate: Fri Oct 4 17:53:45 2019 +0800
[iOS] Rename the backgroundColor property name.
---
ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h | 4 ++--
ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m | 10 +++++-----
ios/sdk/WeexSDK/Sources/Model/WXComponent.mm | 8 ++++----
ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm | 8 ++++----
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
index 93f896d..a97dfcb 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
@@ -49,7 +49,7 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL *needUpdate);
/**
* View
*/
- UIColor *_backgroundColor;
+ UIColor *_styleBackgroundColor;
NSString *_backgroundImage;
NSString *_clipRadius;
WXClipType _clipToBounds;
@@ -178,7 +178,7 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL *needUpdate);
/**
DO NOT use "_backgroundColor" directly. The same reason as '_transform'.
*/
-@property (atomic, strong) UIColor* backgroundColor;
+@property (atomic, strong) UIColor* styleBackgroundColor;
///--------------------------------------
/// @name Package Internal Methods
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
index 2a74f62..d209068 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
@@ -289,7 +289,7 @@ typedef NS_ENUM(NSInteger, WXComponentBorderRecord) {
- (void)_collectCompositingDisplayBlocks:(NSMutableArray *)displayBlocks context:(CGContextRef)context isCancelled:(BOOL(^)(void))isCancelled
{
// TODO: compositingChild has no chance to applyPropertiesToView, need update here?
- UIColor *backgroundColor = self.backgroundColor;
+ UIColor *backgroundColor = self.styleBackgroundColor;
BOOL clipsToBounds = _clipToBounds;
CGRect frame = self.calculatedFrame;
CGRect bounds = CGRectMake(0, 0, frame.size.width, frame.size.height);
@@ -349,8 +349,8 @@ typedef NS_ENUM(NSInteger, WXComponentBorderRecord) {
CGContextSetAlpha(context, _opacity);
// fill background color
- if (self.backgroundColor && CGColorGetAlpha(self.backgroundColor.CGColor) > 0) {
- CGContextSetFillColorWithColor(context, self.backgroundColor.CGColor);
+ if (self.styleBackgroundColor && CGColorGetAlpha(self.styleBackgroundColor.CGColor) > 0) {
+ CGContextSetFillColorWithColor(context, self.styleBackgroundColor.CGColor);
UIBezierPath *bezierPath = [UIBezierPath wx_bezierPathWithRoundedRect:rect topLeft:topLeft topRight:topRight bottomLeft:bottomLeft bottomRight:bottomRight];
[bezierPath fill];
WXPerformBlockOnMainThread(^{
@@ -594,7 +594,7 @@ do {\
_layer.borderWidth = _borderTopWidth;
_layer.borderColor = _borderTopColor.CGColor;
if ((_transition.transitionOptions & WXTransitionOptionsBackgroundColor) != WXTransitionOptionsBackgroundColor ) {
- _layer.backgroundColor = self.backgroundColor.CGColor;
+ _layer.backgroundColor = self.styleBackgroundColor.CGColor;
}
}
}
@@ -606,7 +606,7 @@ do {\
WXRoundedRect *borderRect = [[WXRoundedRect alloc] initWithRect:rect topLeft:_borderTopLeftRadius topRight:_borderTopRightRadius bottomLeft:_borderBottomLeftRadius bottomRight:_borderBottomRightRadius];
WXRadii *radii = borderRect.radii;
BOOL hasBorderRadius = [radii hasBorderRadius];
- return (!hasBorderRadius) && _opacity == 1.0 && CGColorGetAlpha(self.backgroundColor.CGColor) == 1.0 && [self _needsDrawBorder];
+ return (!hasBorderRadius) && _opacity == 1.0 && CGColorGetAlpha(self.styleBackgroundColor.CGColor) == 1.0 && [self _needsDrawBorder];
}
- (CAShapeLayer *)drawBorderRadiusMaskLayer:(CGRect)rect
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
index ebb5c00..3235dbd 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
@@ -70,7 +70,7 @@ static BOOL bNeedRemoveEvents = YES;
}
@synthesize transform = _transform;
-@synthesize backgroundColor = _backgroundColor;
+@synthesize styleBackgroundColor = _styleBackgroundColor;
#pragma mark Life Cycle
@@ -392,7 +392,7 @@ static BOOL bNeedRemoveEvents = YES;
_layer.borderWidth = _borderTopWidth;
[self _resetNativeBorderRadius];
_layer.opacity = _opacity;
- _view.backgroundColor = self.backgroundColor;
+ _view.backgroundColor = self.styleBackgroundColor;
}
if (_backgroundImage) {
@@ -858,8 +858,8 @@ static BOOL bNeedRemoveEvents = YES;
UIColor * endColor = (UIColor*)linearGradient[@"endColor"];
CAGradientLayer * gradientLayer = [WXUtility gradientLayerFromColors:@[startColor, endColor] locations:nil frame:strongSelf.view.bounds gradientType:(WXGradientType)[linearGradient[@"gradientType"] integerValue]];
if (gradientLayer) {
- strongSelf.backgroundColor = [UIColor colorWithPatternImage:[strongSelf imageFromLayer:gradientLayer]];
- strongSelf.view.backgroundColor = strongSelf.backgroundColor;
+ strongSelf.styleBackgroundColor = [UIColor colorWithPatternImage:[strongSelf imageFromLayer:gradientLayer]];
+ strongSelf.view.backgroundColor = strongSelf.styleBackgroundColor;
[strongSelf setNeedsDisplay];
}
}
diff --git a/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm b/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm
index db4b3ac..ce252d0 100644
--- a/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm
+++ b/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm
@@ -174,7 +174,7 @@ do {\
- (void)_initViewPropertyWithStyles:(NSDictionary *)styles
{
- self.backgroundColor = styles[@"backgroundColor"] ? [WXConvert UIColor:styles[@"backgroundColor"]] : [UIColor clearColor];
+ self.styleBackgroundColor = styles[@"backgroundColor"] ? [WXConvert UIColor:styles[@"backgroundColor"]] : [UIColor clearColor];
_backgroundImage = styles[@"backgroundImage"] ? [WXConvert NSString:styles[@"backgroundImage"]]: nil;
_opacity = styles[@"opacity"] ? [WXConvert CGFloat:styles[@"opacity"]] : 1.0;
_clipToBounds = styles[@"overflow"] ? [WXConvert WXClipType:styles[@"overflow"]] : NO;
@@ -193,7 +193,7 @@ do {\
{
WX_CHECK_COMPONENT_TYPE(self.componentType)
if (styles[@"backgroundColor"]) {
- self.backgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
+ self.styleBackgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
}
if (styles[@"opacity"]) {
_opacity = [WXConvert CGFloat:styles[@"opacity"]];
@@ -211,7 +211,7 @@ do {\
}
if (styles[@"backgroundColor"]) {
- self.backgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
+ self.styleBackgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
[self setNeedsDisplay];
}
@@ -307,7 +307,7 @@ do {\
- (void)_resetStyles:(NSArray *)styles
{
if (styles && [styles containsObject:@"backgroundColor"]) {
- self.backgroundColor = [UIColor clearColor];
+ self.styleBackgroundColor = [UIColor clearColor];
[self setNeedsDisplay];
}
if (styles && [styles containsObject:@"boxShadow"]) {