cxfeng1 closed pull request #1585: Merge 0927 bugfixes
URL: https://github.com/apache/incubator-weex/pull/1585
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
index 5008423e86..06f01eb691 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
@@ -467,50 +467,65 @@ - (void)createInstance:(NSString *)instanceIdString
}
}
- JSContextRef contextRef =
instanceContextEnvironment.context.JSGlobalContextRef;
- WXAssert([instanceContextEnvironment isObject], @"Invalid
instance context.");
- JSObjectRef instanceContextObjectRef =
JSValueToObject(contextRef, instanceContextEnvironment.JSValueRef, NULL);
- JSPropertyNameArrayRef allKeyRefs =
JSObjectCopyPropertyNames(contextRef, instanceContextObjectRef);
- size_t keyCount = JSPropertyNameArrayGetCount(allKeyRefs);
+ NSMutableArray* allKeys = nil;
- BOOL somethingWrong = NO;
- NSMutableArray* allKeys = [[NSMutableArray alloc]
initWithCapacity:keyCount];
- for (size_t i = 0; i < keyCount; i ++) {
- JSStringRef nameRef =
JSPropertyNameArrayGetNameAtIndex(allKeyRefs, i);
- size_t len = JSStringGetMaximumUTF8CStringSize(nameRef);
- if (len > 1024) {
- somethingWrong = YES;
- break;
- }
- char* buf = (char*)malloc(len + 5);
- if (buf == NULL) {
- somethingWrong = YES;
- break;
+ if ([WXUtility useJSCApiForCreateInstance]) {
+ JSContextRef contextRef =
instanceContextEnvironment.context.JSGlobalContextRef;
+ WXAssert([instanceContextEnvironment isObject], @"Invalid
instance context.");
+ JSValueRef jsException = NULL;
+ JSObjectRef instanceContextObjectRef =
JSValueToObject(contextRef, instanceContextEnvironment.JSValueRef,
&jsException);
+ if (jsException != NULL) {
+ WXLogError(@"JSValueToObject Exception during create
instance.");
}
- bzero(buf, len + 5);
- if (JSStringGetUTF8CString(nameRef, buf, len + 5) > 0) {
- NSString* keyString = [NSString
stringWithUTF8String:buf];
- if ([keyString length] == 0) {
- somethingWrong = YES;
+ BOOL somethingWrong = NO;
+ if (instanceContextObjectRef != NULL) {
+ JSPropertyNameArrayRef allKeyRefs =
JSObjectCopyPropertyNames(contextRef, instanceContextObjectRef);
+ size_t keyCount =
JSPropertyNameArrayGetCount(allKeyRefs);
+
+ allKeys = [[NSMutableArray alloc]
initWithCapacity:keyCount];
+ for (size_t i = 0; i < keyCount; i ++) {
+ JSStringRef nameRef =
JSPropertyNameArrayGetNameAtIndex(allKeyRefs, i);
+ size_t len =
JSStringGetMaximumUTF8CStringSize(nameRef);
+ if (len > 1024) {
+ somethingWrong = YES;
+ break;
+ }
+ char* buf = (char*)malloc(len + 5);
+ if (buf == NULL) {
+ somethingWrong = YES;
+ break;
+ }
+ bzero(buf, len + 5);
+ if (JSStringGetUTF8CString(nameRef, buf, len + 5)
> 0) {
+ NSString* keyString = [NSString
stringWithUTF8String:buf];
+ if ([keyString length] == 0) {
+ somethingWrong = YES;
+ free(buf);
+ break;
+ }
+ [allKeys addObject:keyString];
+ }
+ else {
+ somethingWrong = YES;
+ free(buf);
+ break;
+ }
free(buf);
- break;
}
- [allKeys addObject:keyString];
- }
- else {
+ JSPropertyNameArrayRelease(allKeyRefs);
+ } else {
somethingWrong = YES;
- free(buf);
- break;
}
- free(buf);
+
+ if (somethingWrong) {
+ // [instanceContextEnvironment toDictionary] may
contain retain-cycle.
+ allKeys =
(NSMutableArray*)[[instanceContextEnvironment toDictionary] allKeys];
+ }
}
- JSPropertyNameArrayRelease(allKeyRefs);
-
- if (somethingWrong) {
- // [instanceContextEnvironment toDictionary] may contain
retain-cycle.
+ else {
allKeys = (NSMutableArray*)[[instanceContextEnvironment
toDictionary] allKeys];
}
-
+
sdkInstance.createInstanceContextResult = [NSString
stringWithFormat:@"%@", allKeys];
JSGlobalContextRef instanceContextRef =
sdkInstance.instanceJavaScriptContext.javaScriptContext.JSGlobalContextRef;
JSObjectRef instanceGlobalObject =
JSContextGetGlobalObject(instanceContextRef);
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
b/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
index d6066921e2..e7bd173cba 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
@@ -917,7 +917,7 @@ + (void)closePage:(NSString*)pageId
}
}
-static void _traverseTree(WeexCore::RenderObject *render, int index, const
char* pageId)
++ (void)_traverseTree:(WeexCore::RenderObject *)render index:(int)index
pageId:(const char *)pageId
{
using namespace WeexCore;
if (render == nullptr) return;
@@ -948,7 +948,7 @@ static void _traverseTree(WeexCore::RenderObject *render,
int index, const char*
for (auto it = render->ChildListIterBegin(); it !=
render->ChildListIterEnd(); it ++) {
WeexCore::RenderObject *child = static_cast<WeexCore::RenderObject
*>(*it);
if (child != nullptr) {
- _traverseTree(child, (int)(it - render->ChildListIterBegin()),
pageId);
+ [self _traverseTree:child index:(int)(it -
render->ChildListIterBegin()) pageId:pageId];
}
}
}
@@ -960,7 +960,7 @@ + (void)layoutRenderObject:(void*)object size:(CGSize)size
page:(NSString*)pageI
std::pair<float, float> renderPageSize(size.width, size.height);
render->calculateLayout(renderPageSize);
- _traverseTree(render, 0, [pageId UTF8String] ?: "");
+ [self _traverseTree:render index:0 pageId:[pageId UTF8String] ?: ""];
}
+ (void*)copyRenderObject:(void*)source replacedRef:(NSString*)ref
@@ -1003,45 +1003,7 @@ static void _convertToCString(id _Nonnull obj, void
(^callback)(const char*))
callback([obj UTF8String]);
}
else if ([obj isKindOfClass:[NSNumber class]]) {
- NSNumber* num = (NSNumber*)obj;
- char objcType = [num objCType][0];
- char buffer[128];
- switch (objcType) {
- case _C_DBL:
- case _C_FLT:
- snprintf(buffer, sizeof(buffer), "%f", [num doubleValue]);
- callback(buffer);
- break;
- case _C_INT:
- case _C_CHR:
- case _C_SHT:
- snprintf(buffer, sizeof(buffer), "%d", [num intValue]);
- callback(buffer);
- break;
- case _C_USHT:
- case _C_UINT:
- case _C_UCHR:
- snprintf(buffer, sizeof(buffer), "%u", [num unsignedIntValue]);
- callback(buffer);
- break;
- case _C_LNG:
- case _C_LNG_LNG:
- snprintf(buffer, sizeof(buffer), "%lld", [num longLongValue]);
- callback(buffer);
- break;
- case _C_ULNG:
- case _C_ULNG_LNG:
- snprintf(buffer, sizeof(buffer), "%llu", [num
unsignedLongLongValue]);
- callback(buffer);
- break;
- case _C_BFLD:
- case _C_BOOL:
- callback([num boolValue] ? "true" : "false");
- break;
- default:
- callback([[num stringValue] UTF8String]);
- break;
- }
+ callback([[(NSNumber*)obj stringValue] UTF8String]);
}
else if ([obj isKindOfClass:[NSNull class]]) {
callback([JSONSTRING_SUFFIX UTF8String]);
@@ -1054,7 +1016,7 @@ static void _convertToCString(id _Nonnull obj, void
(^callback)(const char*))
}
}
-static void _parseStyleBeforehand(NSDictionary* styles, NSString* key,
WeexCore::RenderObject* render)
++ (void)_parseStyleBeforehand:(NSDictionary *)styles key:(NSString *)key
render:(WeexCore::RenderObject*)render
{
id data = styles[key];
if (data) {
@@ -1066,8 +1028,7 @@ static void _parseStyleBeforehand(NSDictionary* styles,
NSString* key, WeexCore:
}
}
-static WeexCore::RenderObject* _parseRenderObject(NSDictionary* data,
WeexCore::RenderObject* parent,
- int index, const
std::string& pageId)
++ (WeexCore::RenderObject*)_parseRenderObject:(NSDictionary *)data
parent:(WeexCore::RenderObject *)parent index:(int)index pageId:(const
std::string&)pageId
{
using namespace WeexCore;
@@ -1090,9 +1051,9 @@ static void _parseStyleBeforehand(NSDictionary* styles,
NSString* key, WeexCore:
// margin/padding/borderWidth should be handled beforehand. Because
maringLeft should override margin.
NSDictionary* styles = data[@"style"];
- _parseStyleBeforehand(styles, @"margin", render);
- _parseStyleBeforehand(styles, @"padding", render);
- _parseStyleBeforehand(styles, @"borderWidth", render);
+ [self _parseStyleBeforehand:styles key:@"margin" render:render];
+ [self _parseStyleBeforehand:styles key:@"padding" render:render];
+ [self _parseStyleBeforehand:styles key:@"borderWidth" render:render];
[styles enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id
_Nonnull obj, BOOL * _Nonnull stop) {
if ([key isEqualToString:@"margin"] || [key
isEqualToString:@"padding"] || [key isEqualToString:@"borderWidth"]) {
return;
@@ -1114,7 +1075,7 @@ static void _parseStyleBeforehand(NSDictionary* styles,
NSString* key, WeexCore:
int childIndex = 0;
for (NSDictionary* obj in data[@"children"]) {
- _parseRenderObject(obj, render, childIndex ++, pageId);
+ [self _parseRenderObject:obj parent:render index:childIndex ++
pageId:pageId];
}
render->ApplyDefaultStyle();
@@ -1125,7 +1086,7 @@ static void _parseStyleBeforehand(NSDictionary* styles,
NSString* key, WeexCore:
return nullptr;
}
-static std::vector<std::pair<std::string, std::string>>*
_parseMapValuePairs(NSDictionary* data)
++ (std::vector<std::pair<std::string,
std::string>>*)_parseMapValuePairs:(NSDictionary *)data
{
std::vector<std::pair<std::string, std::string>>* result = new
std::vector<std::pair<std::string, std::string>>();
[data enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull
obj, BOOL * _Nonnull stop) {
@@ -1142,7 +1103,7 @@ + (void)callAddElement:(NSString*)pageId
parentRef:(NSString*)parentRef data:(NS
{
using namespace WeexCore;
const std::string page([pageId UTF8String] ?: "");
- RenderObject* child = _parseRenderObject(data, nullptr, 0, page);
+ RenderObject* child = [self _parseRenderObject:data parent:nullptr index:0
pageId:page];
RenderManager::GetInstance()->AddRenderObject(page, [parentRef UTF8String]
?: "", index, child);
}
@@ -1154,7 +1115,7 @@ + (void)callCreateBody:(NSString*)pageId
data:(NSDictionary*)data
pageInstance->set_before_layout_needed(false); // we do not need
before and after layout
pageInstance->set_after_layout_needed(false);
pageInstance->set_platform_layout_needed(true);
- return _parseRenderObject(data, nullptr, 0, page);
+ return [self _parseRenderObject:data parent:nullptr index:0
pageId:page];
});
}
@@ -1170,12 +1131,12 @@ + (void)callMoveElement:(NSString*)pageId
ref:(NSString*)ref parentRef:(NSString
+ (void)callUpdateAttrs:(NSString*)pageId ref:(NSString*)ref
data:(NSDictionary*)data
{
- WeexCore::RenderManager::GetInstance()->UpdateAttr([pageId UTF8String] ?:
"", [ref UTF8String] ?: "", _parseMapValuePairs(data));
+ WeexCore::RenderManager::GetInstance()->UpdateAttr([pageId UTF8String] ?:
"", [ref UTF8String] ?: "", [self _parseMapValuePairs:data]);
}
+ (void)callUpdateStyle:(NSString*)pageId ref:(NSString*)ref
data:(NSDictionary*)data
{
- WeexCore::RenderManager::GetInstance()->UpdateStyle([pageId UTF8String] ?:
"", [ref UTF8String] ?: "", _parseMapValuePairs(data));
+ WeexCore::RenderManager::GetInstance()->UpdateStyle([pageId UTF8String] ?:
"", [ref UTF8String] ?: "", [self _parseMapValuePairs:data]);
}
+ (void)callAddEvent:(NSString*)pageId ref:(NSString*)ref
event:(NSString*)event
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
index 0d26ec27a8..393d26149e 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
@@ -113,7 +113,7 @@ - (void)_moveToSupercomponent:(WXComponent
*)newSupercomponent atIndex:(NSUInteg
{
if (self.delegate == (id<WXCellRenderDelegate>)newSupercomponent) {
[self.delegate cell:self didMoveToIndex:index];
- [super _removeFromSupercomponent];
+ [super _removeFromSupercomponent:NO]; // no remove underlayer render
object
[newSupercomponent _insertSubcomponent:self atIndex:index];
} else {
[super _moveToSupercomponent:newSupercomponent atIndex:index];
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
index f4ef004ccb..161eb2bf06 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
@@ -187,6 +187,7 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL
*needUpdate);
- (BOOL)_insertSubcomponent:(WXComponent *)subcomponent
atIndex:(NSInteger)index;
- (void)_removeFromSupercomponent;
+- (void)_removeFromSupercomponent:(BOOL)remove;
- (void)_moveToSupercomponent:(WXComponent *)newSupercomponent
atIndex:(NSUInteger)index;
- (BOOL)_isTransitionNone;
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
index 801dd75bb5..8da19684ec 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
@@ -328,12 +328,6 @@ - (void)moveComponent:(NSString *)ref toSuper:(NSString
*)superRef atIndex:(NSIn
WXAssertComponentExist(component);
WXAssertComponentExist(newSupercomponent);
- if (component.supercomponent == newSupercomponent &&
[newSupercomponent.subcomponents indexOfObject:component] < index) {
- // if the supercomponent moved to is the same as original
supercomponent,
- // unify it into the index after removing.
- index--;
- }
-
[component _moveToSupercomponent:newSupercomponent atIndex:index];
__weak typeof(self) weakSelf = self;
[self _addUITask:^{
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
index 0317f880bd..02d937e6be 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
@@ -606,31 +606,38 @@ - (BOOL)_insertSubcomponent:(WXComponent *)subcomponent
atIndex:(NSInteger)index
return YES;
}
-- (void)_removeSubcomponent:(WXComponent *)subcomponent
+- (void)_removeSubcomponent:(WXComponent *)subcomponent
removeCssNode:(BOOL)removeCssNode
{
pthread_mutex_lock(&_propertyMutex);
[_subcomponents removeObject:subcomponent];
- [self removeSubcomponentCssNode:subcomponent];
+ if (removeCssNode) {
+ [self removeSubcomponentCssNode:subcomponent];
+ }
pthread_mutex_unlock(&_propertyMutex);
}
- (void)_removeFromSupercomponent
{
- [self.supercomponent _removeSubcomponent:self];
+ [self _removeFromSupercomponent:YES]; // really do remove
+}
+
+- (void)_removeFromSupercomponent:(BOOL)remove
+{
+ [self.supercomponent _removeSubcomponent:self removeCssNode:remove];
[self.supercomponent setNeedsLayout];
if (_positionType == WXPositionTypeFixed) {
[self.weexInstance.componentManager removeFixedComponent:self];
self->_isNeedJoinLayoutSystem = YES;
}
- if (_positionType == WXPositionTypeSticky) {
- [self.ancestorScroller removeStickyComponent:self];
- }
+ if (_positionType == WXPositionTypeSticky) {
+ [self.ancestorScroller removeStickyComponent:self];
+ }
}
- (void)_moveToSupercomponent:(WXComponent *)newSupercomponent
atIndex:(NSUInteger)index
{
- [self _removeFromSupercomponent];
+ [self _removeFromSupercomponent:NO]; // no remove underlayer render object
[newSupercomponent _insertSubcomponent:self atIndex:index];
}
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 6bbdbef158..4afbb13fa5 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -444,6 +444,9 @@ - (BOOL)_handleConfigCenter
BOOL listSectionRowThreadSafe = [[configCenter
configForKey:@"iOS_weex_ext_config.listSectionRowThreadSafe"
defaultValue:@(YES) isDefault:NULL] boolValue];
[WXUtility
setListSectionRowThreadSafe:listSectionRowThreadSafe];
+
+ BOOL useJSCApiForCreateInstance = [[configCenter
configForKey:@"iOS_weex_ext_config.useJSCApiForCreateInstance"
defaultValue:@(YES) isDefault:NULL] boolValue];
+ [WXUtility setUseJSCApiForCreateInstance:useJSCApiForCreateInstance];
//Reading config from orange for Release instance in Main Thread or not
_bReleaseInstanceInMainThread = [[configCenter
configForKey:@"iOS_weex_ext_config.releaseInstanceInMainThread"
defaultValue:@(YES) isDefault:nil] boolValue];
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
b/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
index 62554714d0..70ec131236 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
@@ -46,10 +46,10 @@ typedef NS_OPTIONS(NSUInteger, WXTransitionOptions) {
@end
@interface WXTransition : NSObject
-@property(nonatomic,strong) NSMutableDictionary *oldFilterStyles;
-@property(nonatomic,strong) NSMutableDictionary *filterStyles;
-@property(nonatomic,strong) NSMutableArray *propertyArray;
-@property(nonatomic,assign) WXTransitionOptions transitionOptions;
+@property (nonatomic,strong) NSMutableDictionary *oldFilterStyles;
+@property (nonatomic,strong) NSMutableDictionary *filterStyles;
+@property (nonatomic,strong) NSMutableArray *propertyArray;
+@property (nonatomic,assign) WXTransitionOptions transitionOptions;
- (instancetype) initWithStyles:(NSDictionary *)styles;
- (void)_handleTransitionWithStyles:(NSDictionary *)styles
resetStyles:(NSMutableArray *)resetStyles target:(WXComponent
*)targetComponent;
- (BOOL)_hasTransitionOptionInStyles:(NSDictionary *)styles;
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.mm
b/ios/sdk/WeexSDK/Sources/Module/WXTransition.mm
index 53b6b31d3c..78c88e66e9 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.mm
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.mm
@@ -36,7 +36,6 @@ @implementation WXTransitionInfo
@interface WXTransition()
{
- WXComponent *_targetComponent;
double ax;
double bx;
double cx;
@@ -55,7 +54,7 @@ @interface WXTransition()
NSMutableDictionary *_filterStyles;
NSMutableDictionary *_oldFilterStyles;
}
-
+@property (nonatomic,weak) WXComponent *targetComponent;
@end
@implementation WXTransition
@@ -100,6 +99,10 @@ - (void)_handleTransitionWithStyles:(NSDictionary *)styles
resetStyles:(NSMutabl
[self _suspendTransitionDisplayLink];
}
+ if (!targetComponent) {
+ return;
+ }
+
_filterStyles = _filterStyles ?:[NSMutableDictionary new];
_oldFilterStyles = _oldFilterStyles ?: [NSMutableDictionary new];
NSMutableDictionary *futileStyles = [NSMutableDictionary new];
@@ -162,6 +165,9 @@ - (BOOL)_hasTransitionOptionInStyles:(NSDictionary *)styles
- (void)updateFutileStyles:(NSDictionary *)styles resetStyles:(NSMutableArray
*)resetStyles target:(WXComponent *)targetComponent
{
+ if (!targetComponent) {
+ return;
+ }
[targetComponent _updateCSSNodeStyles:styles];
[targetComponent _resetCSSNodeStyles:resetStyles];
WXPerformBlockOnMainThread(^{
@@ -204,7 +210,7 @@ - (void)_dealTransitionWithProperty:(NSString
*)singleProperty
else if ([singleProperty isEqualToString:@"transform"]) {
NSString *transformOrigin = _filterStyles[@"transformOrigin"];
WXTransform *wxTransform = [[WXTransform alloc]
initWithCSSValue:_filterStyles[singleProperty] origin:transformOrigin
instance:_targetComponent.weexInstance];
- WXTransform *oldTransform = _targetComponent->_transform;
+ WXTransform *oldTransform =
_targetComponent?_targetComponent->_transform:wxTransform;
if (wxTransform.rotateAngle != oldTransform.rotateAngle) {
WXTransitionInfo *info = [WXTransitionInfo new];
info.propertyName = @"transform.rotation";
@@ -304,6 +310,10 @@ - (NSArray *)_calculatePerColorRGB1:(NSArray *)RGB1
RGB2:(NSArray *)RGB2
- (void)_calculatetransitionProcessingStyle
{
+ if (_targetComponent == nil) {
+ return;
+ }
+
if (_propertyArray.count == 0) {
return;
}
@@ -356,11 +366,11 @@ - (void)_calculatetransitionProcessingStyle
transformString = [transformString stringByAppendingFormat:@"
%@",newString];
}
if ([info.propertyName
isEqualToString:@"transform.translation.x"]) {
- newString = [NSString
stringWithFormat:@"translateX(%lfpx)",currentValue /
_targetComponent.weexInstance.pixelScaleFactor];
+ newString = [NSString
stringWithFormat:@"translateX(%lfpx)",currentValue /
(_targetComponent.weexInstance.pixelScaleFactor?_targetComponent.weexInstance.pixelScaleFactor:[WXUtility
defaultPixelScaleFactor])];
transformString = [transformString stringByAppendingFormat:@"
%@",newString];
}
if ([info.propertyName
isEqualToString:@"transform.translation.y"]) {
- newString = [NSString
stringWithFormat:@"translateY(%lfpx)",currentValue /
_targetComponent.weexInstance.pixelScaleFactor];
+ newString = [NSString
stringWithFormat:@"translateY(%lfpx)",currentValue /
(_targetComponent.weexInstance.pixelScaleFactor?_targetComponent.weexInstance.pixelScaleFactor:[WXUtility
defaultPixelScaleFactor])];
transformString = [transformString stringByAppendingFormat:@"
%@",newString];
}
[_oldFilterStyles setObject:transformString forKey:@"transform"];
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
index 796e400c9e..702a43826f 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
@@ -491,6 +491,10 @@ BOOL WXFloatGreaterThanWithPrecision(CGFloat a,CGFloat
b,double precision);
+ (void)setListSectionRowThreadSafe:(BOOL)value;
++ (void)setUseJSCApiForCreateInstance:(BOOL)value;
+
++ (BOOL)useJSCApiForCreateInstance;
+
+ (BOOL)listSectionRowThreadSafe;
+ (long) getUnixFixTimeMillis;
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 34767b0146..7927f00f9a 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -44,6 +44,7 @@
static BOOL threadSafeCollectionUsingLock = YES;
static BOOL unregisterFontWhenCollision = NO;
static BOOL listSectionRowThreadSafe = YES;
+static BOOL useJSCApiForCreateInstance = YES;
void WXPerformBlockOnMainThread(void (^ _Nonnull block)(void))
{
@@ -164,6 +165,16 @@ + (BOOL)listSectionRowThreadSafe
return listSectionRowThreadSafe;
}
++ (void)setUseJSCApiForCreateInstance:(BOOL)value
+{
+ useJSCApiForCreateInstance = value;
+}
+
++ (BOOL)useJSCApiForCreateInstance
+{
+ return useJSCApiForCreateInstance;
+}
+
+ (void)performBlock:(void (^)(void))block onThread:(NSThread *)thread
{
if (!thread || !block) return;
diff --git a/weex_core/Source/core/render/node/render_mask.cpp
b/weex_core/Source/core/render/node/render_mask.cpp
index 7cb5238fb7..a84ce9fbf8 100644
--- a/weex_core/Source/core/render/node/render_mask.cpp
+++ b/weex_core/Source/core/render/node/render_mask.cpp
@@ -46,12 +46,16 @@ std::map<std::string, std::string>
*RenderMask::GetDefaultStyle() {
.c_str());
}
+#if OS_IOS
+ // iOS height includes status bar
+#else
if (WXCoreEnvironment::getInstance()->GetOption("status_bar_height") != "") {
int status_bar_height = atoi(WXCoreEnvironment::getInstance()
->GetOption("status_bar_height")
.c_str());
height -= status_bar_height;
}
+#endif
style->insert(std::pair<std::string, std::string>(POSITION, "absolute"));
style->insert(std::pair<std::string, std::string>(
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services