Description
According to the latest published W3C specification about CSS Transforms:
translate() = translate( <length-percentage> [, <length-percentage> ]? ) specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter. If <ty> is not provided, ty has zero as a value.
, translate(tx) is equal to translate(tx, 0). In the previous version of Weex, we removed the array length check in method [WXTransform parseTranslate:]
- (void)parseTranslate:(NSArray *)value { [self parseTranslatex:@[value[0]]]; [self parseTranslatey:@[value[1]]]; }
so if the parser encounters a 'translate(0)', the array contains only one single value inside, parseTranslate will fetch the element at index 1 from the array, which causes a typical out-of-bounds exception, and lead to an app crash eventually.
As we known in many js packing procedures, 'translate(x, 0)' will be compressed/minified to the form 'translate(x)', Weex should avoid such inconsistent implementations and conforms the W3C specifications.
Attachments
Issue Links
- links to