You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/04/13 11:20:51 UTC

[01/23] incubator-weex git commit: * [ios] refactor text draw

Repository: incubator-weex
Updated Branches:
  refs/heads/0.12-dev 8a7a1ad29 -> d71820ac8


* [ios] refactor text draw


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/be4eb0e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/be4eb0e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/be4eb0e7

Branch: refs/heads/0.12-dev
Commit: be4eb0e7a8e8bd41c893678c60ce6f40d42039e0
Parents: c18fc98
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 6 19:37:03 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 6 19:37:03 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.m | 142 ++++++++++++++++---
 1 file changed, 126 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/be4eb0e7/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index f18ac94..d226b9a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -15,10 +15,12 @@
 #import "WXRuleManager.h"
 #import "WXDefine.h"
 #import <pthread/pthread.h>
+#import <CoreText/CoreText.h>
 
 @interface WXText : UIView
 
 @property (nonatomic, strong) NSTextStorage *textStorage;
+@property (nonatomic, strong) NSMutableAttributedString * attributedString;
 
 @end
 
@@ -57,20 +59,46 @@
             [self.wx_component _resetNativeBorderRadius];
         });
     }
-    NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject;
-    NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
-    
-    CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
-    NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
-    
-    [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:textFrame.origin];
-    [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:textFrame.origin];
-    
-    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
-    
-    UIGraphicsEndImageContext();
-    
-    return image;
+    if (![[self.wx_component valueForKey:@"coretext"] boolValue]) {
+        NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject;
+        NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
+        
+        CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
+        NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
+        
+        [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:textFrame.origin];
+        [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:textFrame.origin];
+        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
+        UIGraphicsEndImageContext();
+        return image;
+    }else {
+        CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
+        // sufficient height for text to draw, or frame lines will be empty
+        textFrame.size.height = bounds.size.height*2;
+        
+        //flip the coordinate system
+        CGContextRetain(context);
+        CGContextSetTextMatrix(context, CGAffineTransformIdentity);
+        CGContextTranslateCTM(context, 0, textFrame.size.height);
+        CGContextScaleCTM(context, 1.0, -1.0);
+        
+        //add path
+        CGMutablePathRef path = CGPathCreateMutable();
+        CGPathAddRect(path, NULL, textFrame);
+        NSMutableAttributedString * attributedStringCopy = [_attributedString mutableCopy];
+        CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge  CFAttributedStringRef)attributedStringCopy);
+        CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
+        CTFrameDraw(frame, context);
+        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
+        UIGraphicsEndImageContext();
+        
+        CFRelease(frame);
+        CFRelease(framesetter);
+        CGPathRelease(path);
+        CGContextRelease(context);
+        
+        return image;
+    }
 }
 
 - (void)setTextStorage:(NSTextStorage *)textStorage
@@ -81,6 +109,13 @@
     }
 }
 
+- (void)setAttributedString:(NSMutableAttributedString *)attributedString {
+    if (_attributedString != attributedString) {
+        _attributedString = attributedString;
+        [self.wx_component setNeedsDisplay];
+    }
+}
+
 - (NSString *)description
 {
     NSString *superDescription = super.description;
@@ -101,6 +136,10 @@
 
 @end
 
+@interface WXTextComponent()
+@property (nonatomic, assign)BOOL coretext;
+@end
+
 @implementation WXTextComponent
 {
     UIEdgeInsets _border;
@@ -119,7 +158,6 @@
     WXTextDecoration _textDecoration;
     NSString *_textOverflow;
     CGFloat _lineHeight;
-    
    
     pthread_mutex_t _textStorageMutex;
     pthread_mutexattr_t _textStorageMutexAttr;
@@ -145,7 +183,11 @@ static BOOL _isUsingTextStorageLock = NO;
             pthread_mutexattr_settype(&_textStorageMutexAttr, PTHREAD_MUTEX_RECURSIVE);
             pthread_mutex_init(&_textStorageMutex, &_textStorageMutexAttr);
         }
-        
+        if (attributes[@"coretext"]) {
+            _coretext = [WXConvert BOOL:attributes[@"coretext"]];
+        } else {
+            _coretext = YES;
+        }
         [self fillCSSStyles:styles];
         [self fillAttributes:attributes];
     }
@@ -248,6 +290,7 @@ do {\
         pthread_mutex_lock(&_textStorageMutex);
     }
     ((WXText *)self.view).textStorage = _textStorage;
+    ((WXText *)self.view).attributedString = [self buildCTAttributeString];
     if (_isUsingTextStorageLock) {
         pthread_mutex_unlock(&_textStorageMutex);
     }
@@ -339,6 +382,71 @@ do {\
     });
 }
 
+- (NSMutableAttributedString *)buildCTAttributeString {
+    
+    NSString *string = [self text] ?: @"";
+    
+    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string];
+    
+    if (_color) {
+        [attributedString addAttribute:(id)kCTForegroundColorAttributeName value:_color range:NSMakeRange(0, string.length)];
+    }
+    
+    if (_fontFamily) {
+        NSString * keyPath = [NSString stringWithFormat:@"%@.tempSrc", _fontFamily];
+        NSString * fontSrc = [[[WXRuleManager sharedInstance] getRule:@"fontFace"] valueForKeyPath:keyPath];
+        keyPath = [NSString stringWithFormat:@"%@.localSrc", _fontFamily];
+        NSString * fontLocalSrc = [[[WXRuleManager sharedInstance] getRule:@"fontFace"] valueForKeyPath:keyPath];
+        //custom localSrc is cached
+        if (!fontLocalSrc && fontSrc) {
+            // if use custom font, when the custom font download finish, refresh text.
+            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(repaintText:) name:WX_ICONFONT_DOWNLOAD_NOTIFICATION object:nil];
+        }
+    }
+    
+    // set font
+    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor];
+    CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName,
+                                           font.pointSize,
+                                           NULL);
+    if (ctFont) {
+        [attributedString addAttribute:(id)kCTFontAttributeName value:(__bridge id)(ctFont) range:NSMakeRange(0, string.length)];
+    }
+    
+    if(_textDecoration == WXTextDecorationUnderline){
+        [attributedString addAttribute:(id)kCTUnderlineStyleAttributeName value:@(kCTUnderlinePatternSolid | kCTUnderlineStyleSingle) range:NSMakeRange(0, string.length)];
+    } else if(_textDecoration == WXTextDecorationLineThrough){
+        [attributedString addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, string.length)];
+    }
+    
+    NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
+    
+    if (_textAlign) {
+        paragraphStyle.alignment = _textAlign;
+    }
+    
+    if (_lineHeight) {
+        paragraphStyle.maximumLineHeight = _lineHeight;
+        paragraphStyle.minimumLineHeight = _lineHeight;
+    }
+    if (_lineHeight || _textAlign) {
+        [attributedString addAttribute:(id)kCTParagraphStyleAttributeName
+                                 value:paragraphStyle
+                                 range:(NSRange){0, attributedString.length}];
+    }
+    
+    if ([self adjustLineHeight]) {
+        if (_lineHeight > font.lineHeight) {
+            [attributedString addAttribute:(id)kCTBaselineReferenceFont
+                                     value:@((_lineHeight - font.lineHeight)/ 2)
+                                     range:(NSRange){0, attributedString.length}];
+        }
+    }
+    
+    
+    return attributedString;
+}
+
 - (NSAttributedString *)buildAttributeString
 {
     NSString *string = [self text] ?: @"";
@@ -451,6 +559,7 @@ do {\
 {
     CGFloat width = self.calculatedFrame.size.width - (_padding.left + _padding.right);
     NSTextStorage *textStorage = [self textStorageWithWidth:width];
+    NSMutableAttributedString * attributedString = [self buildCTAttributeString];
     
     [self.weexInstance.componentManager  _addUITask:^{
         if ([self isViewLoaded]) {
@@ -458,6 +567,7 @@ do {\
                 pthread_mutex_lock(&_textStorageMutex);
             }
             ((WXText *)self.view).textStorage = textStorage;
+            ((WXText *)self.view).attributedString = attributedString;
             if (_isUsingTextStorageLock) {
                 pthread_mutex_unlock(&_textStorageMutex);
             }


[09/23] incubator-weex git commit: * [ios] config replacement

Posted by cx...@apache.org.
* [ios] config replacement


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/09d8869e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/09d8869e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/09d8869e

Branch: refs/heads/0.12-dev
Commit: 09d8869e2d1124591ec33cfcf0a776d3a13642d2
Parents: 7eefcfb
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 11 16:09:16 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 11 16:09:16 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.m | 25 ++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/09d8869e/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index e9cc83f..2a81b9e 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -90,6 +90,8 @@
 
 @end
 
+static BOOL textRenderUsingCoreText;
+
 @interface WXTextComponent()
 @property (nonatomic, assign)BOOL coretext;
 @end
@@ -114,6 +116,16 @@
     CGFloat _lineHeight;
 }
 
++ (void)setRenderUsingCoreText:(BOOL)usingCoreText
+{
+    textRenderUsingCoreText = usingCoreText;
+}
+
++ (BOOL)textRenderUsingCoreText
+{
+    return textRenderUsingCoreText;
+}
+
 - (instancetype)initWithRef:(NSString *)ref
                        type:(NSString *)type
                      styles:(NSDictionary *)styles
@@ -123,11 +135,18 @@
 {
     self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
     if (self) {
+        // just for coretext and textkit render replacement
         if (attributes[@"coretext"]) {
             _coretext = [WXConvert BOOL:attributes[@"coretext"]];
         } else {
             _coretext = YES;
         }
+        BOOL renderUsingCoreText = YES;
+        if (weexInstance.userInfo[@"renderUsingCoreText"]) {
+            renderUsingCoreText = [weexInstance.userInfo[@"renderUsingCoreText"] boolValue];
+        }
+        [WXTextComponent setRenderUsingCoreText:renderUsingCoreText];
+        
         [self fillCSSStyles:styles];
         [self fillAttributes:attributes];
     }
@@ -333,6 +352,8 @@ do {\
         [attributedString addAttribute:(id)kCTFontAttributeName value:(__bridge id)(ctFont) range:NSMakeRange(0, string.length)];
     }
     
+    CFRelease(ctFont);
+    
     if(_textDecoration == WXTextDecorationUnderline){
         [attributedString addAttribute:(id)kCTUnderlineStyleAttributeName value:@(kCTUnderlinePatternSolid | kCTUnderlineStyleSingle) range:NSMakeRange(0, string.length)];
     } else if(_textDecoration == WXTextDecorationLineThrough){
@@ -438,7 +459,7 @@ do {\
 
 - (BOOL)adjustLineHeight
 {
-    return !_coretext;
+    return !(_coretext && [WXTextComponent textRenderUsingCoreText]);
 }
 
 - (NSTextStorage *)textStorageWithWidth:(CGFloat)width
@@ -528,7 +549,7 @@ do {\
             [self _resetNativeBorderRadius];
         });
     }
-    if (!self.coretext) {
+    if (![WXTextComponent textRenderUsingCoreText] || !self.coretext) {
         NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject;
         NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
         


[15/23] incubator-weex git commit: * [ios] default use textkit

Posted by cx...@apache.org.
* [ios] default use textkit


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/dc3e708b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/dc3e708b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/dc3e708b

Branch: refs/heads/0.12-dev
Commit: dc3e708b97bd763d8ee40706ed09cbc7402f3199
Parents: 6cca6f8
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 14:48:50 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 14:48:50 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dc3e708b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index 9df7fef..a379c87 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -131,7 +131,7 @@ static BOOL textRenderUsingCoreText;
         if ([attributes objectForKey:@"coretext"]) {
             _coretext = [WXConvert BOOL:attributes[@"coretext"]];
         } else {
-            _coretext = YES;
+            _coretext = NO;
         }
         BOOL renderUsingCoreText = YES;
         if (weexInstance.userInfo[@"renderUsingCoreText"]) {
@@ -265,8 +265,9 @@ do {\
     __weak typeof(self) weakSelf = self;
     return ^CGSize (CGSize constrainedSize) {
         CGSize computedSize = CGSizeZero;
-        NSTextStorage *textStorage = [weakSelf textStorageWithWidth:constrainedSize.width];
+        NSTextStorage *textStorage = nil;
         if (!(weakSelf.coretext && [WXTextComponent textRenderUsingCoreText]) ) {
+            textStorage = [weakSelf textStorageWithWidth:constrainedSize.width];
             NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
             NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
             computedSize = [layoutManager usedRectForTextContainer:textContainer].size;
@@ -290,7 +291,7 @@ do {\
         if (!isnan(weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT])) {
             computedSize.height = MIN(computedSize.height, weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT]);
         }
-        if ([WXUtility isBlankString:textStorage.string]) {
+        if (textStorage && [WXUtility isBlankString:textStorage.string]) {
             //  if the text value is empty or nil, then set the height is 0.
             computedSize.height = 0;
         }
@@ -549,7 +550,7 @@ do {\
             [self _resetNativeBorderRadius];
         });
     }
-    if (![WXTextComponent textRenderUsingCoreText] || !self.coretext) {
+    if (![self useCoreText]) {
         NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject;
         NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
         
@@ -629,7 +630,8 @@ do {\
     CGSize suggestSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetterRef, CFRangeMake(0, attributedStringCpy.length), NULL, CGSizeMake(aWidth, MAXFLOAT), NULL);
     
     CGMutablePathRef path = CGPathCreateMutable();
-    CGPathAddRect(path, NULL, CGRectMake(0, 0, aWidth, suggestSize.height*10));
+    // sufficient height to draw text
+    CGPathAddRect(path, NULL, CGRectMake(0, 0, aWidth, suggestSize.height * 10));
     
     CTFrameRef frameRef = CTFramesetterCreateFrame(framesetterRef, CFRangeMake(0, attributedStringCpy.length), path, NULL);
     


[19/23] incubator-weex git commit: * [ios] iconfont accord config draw

Posted by cx...@apache.org.
* [ios] iconfont accord config draw


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e2205bf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e2205bf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e2205bf2

Branch: refs/heads/0.12-dev
Commit: e2205bf270b9115b023ce7124ce62fea89888e5b
Parents: 155b4e0
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 17:38:25 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 17:38:25 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e2205bf2/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
index d9a1269..800a909 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
@@ -21,4 +21,7 @@
 
 @interface WXTextComponent : WXComponent
 
++ (void)setRenderUsingCoreText:(BOOL)usingCoreText;
++ (BOOL)textRenderUsingCoreText;
+
 @end


[23/23] incubator-weex git commit: Merge branch 'iOS-0.12-dev-text-refactor' of https://github.com/acton393/incubator-weex into 0.12-dev

Posted by cx...@apache.org.
Merge branch 'iOS-0.12-dev-text-refactor' of https://github.com/acton393/incubator-weex into 0.12-dev


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d71820ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d71820ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d71820ac

Branch: refs/heads/0.12-dev
Commit: d71820ac8ca27566701bd008b9627336f2c938e1
Parents: 8a7a1ad 41f524f
Author: cxfeng <cx...@apache.org>
Authored: Thu Apr 13 19:16:07 2017 +0800
Committer: cxfeng <cx...@apache.org>
Committed: Thu Apr 13 19:16:07 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.h |   1 +
 .../WeexSDK/Sources/Component/WXTextComponent.m | 307 +++++++++++++++++--
 .../Sources/Display/WXComponent+Display.m       |   2 +-
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.h     |   2 +
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m     |  55 +++-
 5 files changed, 330 insertions(+), 37 deletions(-)
----------------------------------------------------------------------



[07/23] incubator-weex git commit: * [ios] protect crash

Posted by cx...@apache.org.
* [ios] protect crash


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/395ffc6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/395ffc6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/395ffc6e

Branch: refs/heads/0.12-dev
Commit: 395ffc6e4f0de825219eba2276c48fc1b0320696
Parents: 01117b5
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 11 12:45:13 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 11 12:45:13 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/395ffc6e/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index eb6eb82..e9cc83f 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -235,7 +235,7 @@ do {\
     if (_isCompositingChild) {
         [self drawTextWithContext:context bounds:rect padding:_padding view:nil];
     } else {
-        WXText *textView = ((WXText *)self.view);
+        WXText *textView = (WXText *)_view;
         [self drawTextWithContext:context bounds:rect padding:_padding view:textView];
     }
     


[16/23] incubator-weex git commit: Revert "* [ios] iconfont refactor"

Posted by cx...@apache.org.
Revert "* [ios] iconfont refactor"

This reverts commit 6cca6f8a8d7e852830299cf183d91701a159a3d3.


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e443027c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e443027c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e443027c

Branch: refs/heads/0.12-dev
Commit: e443027c1caaf3042995303f412168033b9378f8
Parents: dc3e708
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 17:05:13 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 17:05:13 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 30 ++++++++++--------------
 1 file changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e443027c/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 466a563..6cb5334 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -455,24 +455,20 @@ static BOOL WXNotStat;
             // if the font file is not the correct font file. it will crash by singal 9
             CFURLRef fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)fpath, kCFURLPOSIXPathStyle, false);
             if (fontURL) {
-                CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL(fontURL);
-                if (fontDataProvider) {
-                    CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider);
-                    CFErrorRef error = nil;
-                    CTFontManagerRegisterGraphicsFont(newFont, &error);
-                    // the same font family, remove it and register new one.
-                    if (error) {
-                        CTFontManagerUnregisterGraphicsFont(newFont, NULL);
-                        CTFontManagerRegisterGraphicsFont(newFont, NULL);
-                        CFRelease(error);
-                        error = nil;
-                    }
-                    fontFamily = (__bridge_transfer  NSString*)CGFontCopyPostScriptName(newFont);
-                    CGFontRelease(newFont);
-                    CFRelease(fontURL);
-                    CFRelease(fontDataProvider);
+                CFErrorRef error = nil;
+                CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error);
+                if (error) {
+                    CFRelease(error);
+                    error = nil;
+                    CTFontManagerUnregisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
+                    CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
                 }
-                
+                NSArray *descriptors = (__bridge_transfer NSArray *)CTFontManagerCreateFontDescriptorsFromURL(fontURL);
+                // length of descriptors here will be only one.
+                for (UIFontDescriptor *desc in descriptors) {
+                    font = [UIFont fontWithDescriptor:desc size:fontSize];
+                }
+                CFRelease(fontURL);
             }
         }else {
             [[WXRuleManager sharedInstance] removeRule:@"fontFace" rule:@{@"fontFamily": fontFamily}];


[05/23] incubator-weex git commit: * [ios] remove unused code

Posted by cx...@apache.org.
* [ios] remove unused code


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ae6edeeb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ae6edeeb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ae6edeeb

Branch: refs/heads/0.12-dev
Commit: ae6edeebcd9fa549f599b840e9cfc88f52aa64dc
Parents: 1e34a1f
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 11 11:37:15 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 11 11:37:15 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.m    | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ae6edeeb/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index 5c501a9..eb6eb82 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -140,8 +140,6 @@
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 }
 
-
-
 #define WX_STYLE_FILL_TEXT(key, prop, type, needLayout)\
 do {\
     id value = styles[@#key];\
@@ -545,7 +543,6 @@ do {\
         textFrame.size.height = bounds.size.height*2;
         
         //flip the coordinate system
-        CGContextRetain(context);
         CGContextSetTextMatrix(context, CGAffineTransformIdentity);
         CGContextTranslateCTM(context, 0, textFrame.size.height);
         CGContextScaleCTM(context, 1.0, -1.0);
@@ -554,6 +551,7 @@ do {\
         CGMutablePathRef path = CGPathCreateMutable();
         CGPathAddRect(path, NULL, textFrame);
         NSMutableAttributedString * attributedStringCopy = [self buildCTAttributeString];
+        
         CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge  CFAttributedStringRef)attributedStringCopy);
         CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
         
@@ -562,7 +560,6 @@ do {\
         CGPoint lineOrigins[lineCount];
         CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), lineOrigins);
         
-        CGFloat frameY = 0;
         for (CFIndex index = 0; index < lineCount; index ++) {
             CTLineRef lineRef = CFArrayGetValueAtIndex(lines, index);
             CGFloat lineAscent;
@@ -571,19 +568,8 @@ do {\
             
             CTLineGetTypographicBounds(lineRef, &lineAscent, &lineDescent, &lineLeading);
             CGPoint lineOrigin = lineOrigins[index];
-            
-            NSLog(@"lineAscent = %f",lineAscent);
-            NSLog(@"lineDescent = %f",lineDescent);
-            NSLog(@"lineLeading = %f",lineLeading);
-            
-            if (index > 0) {
-                frameY = frameY - lineAscent;
-            }else {
-                frameY = lineOrigin.y;
-            }
             lineOrigin.x += padding.left;
             lineOrigin.y -= padding.top;
-            NSLog(@"lines: %ld origin: %@",index, NSStringFromCGPoint(lineOrigin));
             CGContextSetTextPosition(context, lineOrigin.x, lineOrigin.y);
             //            CTLineDraw(lineRef, context);
             CFArrayRef runs = CTLineGetGlyphRuns(lineRef);
@@ -591,7 +577,6 @@ do {\
                 CTRunRef run = CFArrayGetValueAtIndex(runs, runIndex);
                 CTRunDraw(run, context, CFRangeMake(0, 0));
             }
-            frameY = frameY - lineDescent;
         }
         
         CFRelease(frame);


[17/23] incubator-weex git commit: Revert "Revert "* [ios] iconfont refactor""

Posted by cx...@apache.org.
Revert "Revert "* [ios] iconfont refactor""

This reverts commit e443027c1caaf3042995303f412168033b9378f8.


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/57b37bd4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/57b37bd4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/57b37bd4

Branch: refs/heads/0.12-dev
Commit: 57b37bd45f3fd2238d7f7cb03d5e339f6a584486
Parents: e443027
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 17:08:46 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 17:08:46 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 30 ++++++++++++++----------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/57b37bd4/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 6cb5334..466a563 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -455,20 +455,24 @@ static BOOL WXNotStat;
             // if the font file is not the correct font file. it will crash by singal 9
             CFURLRef fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)fpath, kCFURLPOSIXPathStyle, false);
             if (fontURL) {
-                CFErrorRef error = nil;
-                CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error);
-                if (error) {
-                    CFRelease(error);
-                    error = nil;
-                    CTFontManagerUnregisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
-                    CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
+                CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL(fontURL);
+                if (fontDataProvider) {
+                    CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider);
+                    CFErrorRef error = nil;
+                    CTFontManagerRegisterGraphicsFont(newFont, &error);
+                    // the same font family, remove it and register new one.
+                    if (error) {
+                        CTFontManagerUnregisterGraphicsFont(newFont, NULL);
+                        CTFontManagerRegisterGraphicsFont(newFont, NULL);
+                        CFRelease(error);
+                        error = nil;
+                    }
+                    fontFamily = (__bridge_transfer  NSString*)CGFontCopyPostScriptName(newFont);
+                    CGFontRelease(newFont);
+                    CFRelease(fontURL);
+                    CFRelease(fontDataProvider);
                 }
-                NSArray *descriptors = (__bridge_transfer NSArray *)CTFontManagerCreateFontDescriptorsFromURL(fontURL);
-                // length of descriptors here will be only one.
-                for (UIFontDescriptor *desc in descriptors) {
-                    font = [UIFont fontWithDescriptor:desc size:fontSize];
-                }
-                CFRelease(fontURL);
+                
             }
         }else {
             [[WXRuleManager sharedInstance] removeRule:@"fontFace" rule:@{@"fontFamily": fontFamily}];


[21/23] incubator-weex git commit: * [ios] adjust configuation

Posted by cx...@apache.org.
* [ios] adjust configuation


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/efd56009
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/efd56009
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/efd56009

Branch: refs/heads/0.12-dev
Commit: efd56009158bca5fac3fea41c2c4c80a775d53cd
Parents: e100f8a
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 18:18:46 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 18:18:46 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.h |  2 +-
 .../WeexSDK/Sources/Component/WXTextComponent.m | 26 ++++++-------
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m     | 40 ++++++++++++++------
 3 files changed, 43 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/efd56009/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
index 800a909..7fb8f34 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
@@ -22,6 +22,6 @@
 @interface WXTextComponent : WXComponent
 
 + (void)setRenderUsingCoreText:(BOOL)usingCoreText;
-+ (BOOL)textRenderUsingCoreText;
++ (BOOL)useCoreText;
 
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/efd56009/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index 29f0b24..a6d24d9 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -81,10 +81,7 @@
 @end
 
 static BOOL textRenderUsingCoreText = NO;
-
-@interface WXTextComponent()
-@property (nonatomic, assign)BOOL coretext;
-@end
+static BOOL useCoreTextAttr = NO;
 
 @implementation WXTextComponent
 {
@@ -127,9 +124,9 @@ static BOOL textRenderUsingCoreText = NO;
     if (self) {
         // just for coretext and textkit render replacement
         if ([attributes objectForKey:@"coretext"]) {
-            _coretext = [WXConvert BOOL:attributes[@"coretext"]];
+            useCoreTextAttr = [WXConvert BOOL:attributes[@"coretext"]];
         } else {
-            _coretext = NO;
+            _useCoreTextAttr = NO;
         }
         
         [self fillCSSStyles:styles];
@@ -139,9 +136,15 @@ static BOOL textRenderUsingCoreText = NO;
     return self;
 }
 
-- (BOOL)useCoreText
++ (BOOL)useCoreText
 {
-    return (_coretext || [WXTextComponent textRenderUsingCoreText]);
+    if (useCoreTextAttr) {
+        return YES;
+    }
+    if ([WXTextComponent textRenderUsingCoreText]) {
+        return YES;
+    }
+    return NO;
 }
 
 - (void)dealloc
@@ -256,7 +259,7 @@ do {\
     return ^CGSize (CGSize constrainedSize) {
         CGSize computedSize = CGSizeZero;
         NSTextStorage *textStorage = nil;
-        if (!(weakSelf.coretext && [WXTextComponent textRenderUsingCoreText]) ) {
+        if (![self useCoreText]) {
             textStorage = [weakSelf textStorageWithWidth:constrainedSize.width];
             NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
             NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
@@ -318,9 +321,7 @@ do {\
 - (NSMutableAttributedString *)buildCTAttributeString {
     
     NSString *string = [self text] ?: @"";
-    
     NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string];
-    
     if (_color) {
         [attributedString addAttribute:NSForegroundColorAttributeName value:_color range:NSMakeRange(0, string.length)];
     }
@@ -552,7 +553,7 @@ do {\
     }else {
         CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
         // sufficient height for text to draw, or frame lines will be empty
-        textFrame.size.height = bounds.size.height*2;
+        textFrame.size.height = bounds.size.height * 2;
         CGContextSaveGState(context);
         //flip the coordinate system
         CGContextSetTextMatrix(context, CGAffineTransformIdentity);
@@ -676,7 +677,6 @@ static void WXTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *u
         if (attrs) {
             CTFontRef font = CFDictionaryGetValue(attrs, kCTFontAttributeName);
             if (font) {
-                
                 CGFloat xHeight = CTFontGetXHeight(font);
                 if (xHeight > maxXHeight) {
                     maxXHeight = xHeight;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/efd56009/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 466a563..22faf05 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -33,6 +33,8 @@
 #import <CommonCrypto/CommonCrypto.h>
 #import <coreText/CoreText.h>
 
+#import "WXTextComponent.h"
+
 #define KEY_PASSWORD  @"com.taobao.Weex.123456"
 #define KEY_USERNAME_PASSWORD  @"com.taobao.Weex.weex123456"
 
@@ -455,24 +457,40 @@ static BOOL WXNotStat;
             // if the font file is not the correct font file. it will crash by singal 9
             CFURLRef fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)fpath, kCFURLPOSIXPathStyle, false);
             if (fontURL) {
-                CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL(fontURL);
-                if (fontDataProvider) {
-                    CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider);
+                if ([WXTextComponent useCoreText]) {
+                    CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL(fontURL);
+                    if (fontDataProvider) {
+                        CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider);
+                        CFErrorRef error = nil;
+                        CTFontManagerRegisterGraphicsFont(newFont, &error);
+                        // the same font family, remove it and register new one.
+                        if (error) {
+                            CTFontManagerUnregisterGraphicsFont(newFont, NULL);
+                            CTFontManagerRegisterGraphicsFont(newFont, NULL);
+                            CFRelease(error);
+                            error = nil;
+                        }
+                        fontFamily = (__bridge_transfer  NSString*)CGFontCopyPostScriptName(newFont);
+                        CGFontRelease(newFont);
+                        CFRelease(fontURL);
+                        CFRelease(fontDataProvider);
+                    }
+                } else {
                     CFErrorRef error = nil;
-                    CTFontManagerRegisterGraphicsFont(newFont, &error);
-                    // the same font family, remove it and register new one.
+                    CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error);
                     if (error) {
-                        CTFontManagerUnregisterGraphicsFont(newFont, NULL);
-                        CTFontManagerRegisterGraphicsFont(newFont, NULL);
                         CFRelease(error);
                         error = nil;
+                        CTFontManagerUnregisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
+                        CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
+                    }
+                    NSArray *descriptors = (__bridge_transfer NSArray *)CTFontManagerCreateFontDescriptorsFromURL(fontURL);
+                    // length of descriptors here will be only one.
+                    for (UIFontDescriptor *desc in descriptors) {
+                        font = [UIFont fontWithDescriptor:desc size:fontSize];
                     }
-                    fontFamily = (__bridge_transfer  NSString*)CGFontCopyPostScriptName(newFont);
-                    CGFontRelease(newFont);
                     CFRelease(fontURL);
-                    CFRelease(fontDataProvider);
                 }
-                
             }
         }else {
             [[WXRuleManager sharedInstance] removeRule:@"fontFace" rule:@{@"fontFamily": fontFamily}];


[18/23] incubator-weex git commit: * [ios] memory leak about coretext

Posted by cx...@apache.org.
* [ios] memory leak about coretext


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/155b4e0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/155b4e0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/155b4e0c

Branch: refs/heads/0.12-dev
Commit: 155b4e0cf56bb788269f42eba56dcf5d916271c6
Parents: 57b37bd
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 17:33:49 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 17:33:49 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.m | 88 +++++++++++---------
 1 file changed, 49 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/155b4e0c/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index a379c87..29f0b24 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -80,7 +80,7 @@
 
 @end
 
-static BOOL textRenderUsingCoreText;
+static BOOL textRenderUsingCoreText = NO;
 
 @interface WXTextComponent()
 @property (nonatomic, assign)BOOL coretext;
@@ -104,8 +104,6 @@ static BOOL textRenderUsingCoreText;
     WXTextDecoration _textDecoration;
     NSString *_textOverflow;
     CGFloat _lineHeight;
-    
-    CTFrameRef coretextFrameRef;
 }
 
 + (void)setRenderUsingCoreText:(BOOL)usingCoreText
@@ -133,11 +131,6 @@ static BOOL textRenderUsingCoreText;
         } else {
             _coretext = NO;
         }
-        BOOL renderUsingCoreText = YES;
-        if (weexInstance.userInfo[@"renderUsingCoreText"]) {
-            renderUsingCoreText = [weexInstance.userInfo[@"renderUsingCoreText"] boolValue];
-        }
-        [WXTextComponent setRenderUsingCoreText:renderUsingCoreText];
         
         [self fillCSSStyles:styles];
         [self fillAttributes:attributes];
@@ -154,9 +147,6 @@ static BOOL textRenderUsingCoreText;
 - (void)dealloc
 {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
-    if (coretextFrameRef && CFGetRetainCount(coretextFrameRef)) {
-        CFRelease(coretextFrameRef);
-    }
 }
 
 #define WX_STYLE_FILL_TEXT(key, prop, type, needLayout)\
@@ -332,7 +322,7 @@ do {\
     NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string];
     
     if (_color) {
-        [attributedString addAttribute:(id)kCTForegroundColorAttributeName value:_color range:NSMakeRange(0, string.length)];
+        [attributedString addAttribute:NSForegroundColorAttributeName value:_color range:NSMakeRange(0, string.length)];
     }
     
     if (_fontFamily) {
@@ -381,14 +371,14 @@ do {\
         paragraphStyle.minimumLineHeight = _lineHeight;
     }
     if (_lineHeight || _textAlign || [_textOverflow length] > 0) {
-        [attributedString addAttribute:(id)kCTParagraphStyleAttributeName
+        [attributedString addAttribute:NSParagraphStyleAttributeName
                                  value:paragraphStyle
                                  range:(NSRange){0, attributedString.length}];
     }
     
     if ([self adjustLineHeight]) {
         if (_lineHeight > font.lineHeight) {
-            [attributedString addAttribute:(id)kCTBaselineReferenceFont
+            [attributedString addAttribute:NSBaselineOffsetAttributeName
                                      value:@((_lineHeight - font.lineHeight)/ 2)
                                      range:(NSRange){0, attributedString.length}];
         }
@@ -539,7 +529,7 @@ do {\
 
 - (void)drawTextWithContext:(CGContextRef)context bounds:(CGRect)bounds padding:(UIEdgeInsets)padding view:(WXText *)view
 {
-    if (bounds.size.width <=0 || bounds.size.height <= 0) {
+    if (bounds.size.width <= 0 || bounds.size.height <= 0) {
         return;
     }
     
@@ -571,18 +561,24 @@ do {\
         
         NSMutableAttributedString * attributedStringCopy = [self buildCTAttributeString];
         //add path
-        CGMutablePathRef path = CGPathCreateMutable();
-        CGPathAddRect(path, NULL, textFrame);
-        CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge  CFAttributedStringRef)attributedStringCopy);
-         coretextFrameRef = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
-        
-        CFArrayRef lines = CTFrameGetLines(coretextFrameRef);
+        CGPathRef path = NULL;
+        path = CGPathCreateWithRect(textFrame, NULL);
+        CTFramesetterRef framesetter = NULL;
+        framesetter = CTFramesetterCreateWithAttributedString((CFTypeRef)attributedStringCopy);
+        CTFrameRef coretextFrameRef = NULL;
+        coretextFrameRef = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
+        CGPathRelease(path);
+        path = NULL;
+        CFRelease(framesetter);
+        framesetter = NULL;
+        CFArrayRef lines = NULL;
+        lines = CTFrameGetLines(coretextFrameRef);
         CFIndex lineCount = CFArrayGetCount(lines);
         CGPoint lineOrigins[lineCount];
         CTFrameGetLineOrigins(coretextFrameRef, CFRangeMake(0, 0), lineOrigins);
         for (CFIndex lineIndex = 0;(!_lines || _lines > lineIndex) && lineIndex < lineCount; lineIndex ++) {
-            
-            CTLineRef lineRef = CFArrayGetValueAtIndex(lines, lineIndex);
+            CTLineRef lineRef = NULL;
+            lineRef = CFArrayGetValueAtIndex(lines, lineIndex);
             CGPoint lineOrigin = lineOrigins[lineIndex];
             lineOrigin.x += padding.left;
             lineOrigin.y -= padding.top;
@@ -594,9 +590,11 @@ do {\
             strikethroughStart.x =  lineOrigin.x - underLinePosition;
             strikethroughStart.y = lineOrigin.y + xHeight/2;
             for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runs); runIndex ++) {
-                CTRunRef run = CFArrayGetValueAtIndex(runs, runIndex);
+                CTRunRef run = NULL;
+                run = CFArrayGetValueAtIndex(runs, runIndex);
                 CTRunDraw(run, context, CFRangeMake(0, 0));
-                CFDictionaryRef attr = CTRunGetAttributes(run);
+                CFDictionaryRef attr = NULL;
+                attr = CTRunGetAttributes(run);
                 NSUnderlineStyle strikethrough = (NSUnderlineStyle)CFDictionaryGetValue(attr, NSStrikethroughStyleAttributeName);
                 
                 if (strikethrough) {
@@ -610,11 +608,9 @@ do {\
                     CGContextAddLineToPoint(context, strikethroughStart.x + length, strikethroughStart.y);
                     CGContextStrokePath(context);
                 }
-                
             }
         }
-        CFRelease(framesetter);
-        CGPathRelease(path);
+        CFRelease(coretextFrameRef);
         CGContextRestoreGState(context);
     }
 }
@@ -624,35 +620,49 @@ do {\
     if (isnan(aWidth)) {
         aWidth = CGFLOAT_MAX;
     }
-    NSAttributedString * attributedStringCpy = [self buildCTAttributeString];
-    CTFramesetterRef framesetterRef = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedStringCpy);
     
-    CGSize suggestSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetterRef, CFRangeMake(0, attributedStringCpy.length), NULL, CGSizeMake(aWidth, MAXFLOAT), NULL);
-    
-    CGMutablePathRef path = CGPathCreateMutable();
-    // sufficient height to draw text
+    CGFloat totalHeight = 0;
+    CGSize suggestSize = CGSizeZero;
+    NSAttributedString * attributedStringCpy = [self buildCTAttributeString];
+    CTFramesetterRef framesetterRef = NULL;
+    framesetterRef = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedStringCpy);
+        
+    suggestSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetterRef, CFRangeMake(0, attributedStringCpy.length), NULL, CGSizeMake(aWidth, MAXFLOAT), NULL);
+        
+    CGMutablePathRef path = NULL;
+    path = CGPathCreateMutable();
+        // sufficient height to draw text
     CGPathAddRect(path, NULL, CGRectMake(0, 0, aWidth, suggestSize.height * 10));
+        
+    CTFrameRef frameRef = NULL;
+    frameRef = CTFramesetterCreateFrame(framesetterRef, CFRangeMake(0, attributedStringCpy.length), path, NULL);
+        
+    CFRelease(framesetterRef);
+    CGPathRelease(path);
+    framesetterRef = NULL;
     
-    CTFrameRef frameRef = CTFramesetterCreateFrame(framesetterRef, CFRangeMake(0, attributedStringCpy.length), path, NULL);
-    
-    CFArrayRef lines = CTFrameGetLines(frameRef);
+    CFArrayRef lines = NULL;
+    lines = CTFrameGetLines(frameRef);
     CFIndex lineCount = CFArrayGetCount(lines);
     CGFloat ascent = 0;
     CGFloat descent = 0;
     CGFloat leading = 0;
-    CGFloat totalHeight = 0;
+    
     // height = ascent + descent + lineCount*leading
     // ignore linespaing
     NSUInteger actualLineCount = 0;
     for (CFIndex lineIndex = 0; (!_lines|| lineIndex < _lines) && lineIndex < lineCount; lineIndex ++)
     {
-        CTLineRef lineRef = CFArrayGetValueAtIndex(lines, lineIndex);
+        CTLineRef lineRef = NULL;
+        lineRef = CFArrayGetValueAtIndex(lines, lineIndex);
         CTLineGetTypographicBounds(lineRef, &ascent, &descent, &leading);
         totalHeight += ascent + descent;
         actualLineCount ++;
     }
     
     totalHeight = totalHeight + actualLineCount*leading;
+    CFRelease(frameRef);
+    
     return CGSizeMake(suggestSize.width, totalHeight);
 }
 


[03/23] incubator-weex git commit: Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor

Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor

# Conflicts:
#	ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/24f3a30f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/24f3a30f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/24f3a30f

Branch: refs/heads/0.12-dev
Commit: 24f3a30fc633cf37428c2af0198aa1c24e4017ca
Parents: c94e48b b22d7b5
Author: acton393 <zh...@gmail.com>
Authored: Mon Apr 10 15:01:20 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Apr 10 15:01:20 2017 +0800

----------------------------------------------------------------------
 .../main/java/com/taobao/weex/WXSDKManager.java |  10 +-
 .../weex/appfram/pickers/WXPickersModule.java   | 172 +++++-
 .../com/taobao/weex/bridge/WXBridgeManager.java |   3 +
 .../java/com/taobao/weex/common/Constants.java  |   2 +
 .../taobao/weex/dom/DOMActionContextImpl.java   |   2 +-
 .../ui/component/AbstractEditComponent.java     |  48 ++
 .../taobao/weex/ui/component/WXComponent.java   |  23 +-
 .../com/taobao/weex/ui/component/WXSlider.java  |  81 ++-
 .../component/helper/SoftKeyboardDetector.java  | 334 +++++++++++
 .../taobao/weex/ui/view/WXCircleViewPager.java  |  21 +-
 .../taobao/weex/ui/view/gesture/WXGesture.java  |  14 +
 .../java/com/taobao/weex/utils/ATagUtil.java    |   8 +-
 examples/component/list/list-basic.we           |  72 +--
 examples/component/scroller-demo.we             |  64 +-
 examples/vue/index.vue                          |  10 +-
 examples/vue/showcase/compositing.vue           |  89 +++
 ios/sdk/WeexSDK.xcodeproj/project.pbxproj       |   8 +
 .../WeexSDK/Sources/Bridge/WXBridgeContext.m    |   4 +
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m |  77 +++
 .../Component/Recycler/WXRecyclerComponent.m    |   1 +
 .../WeexSDK/Sources/Component/WXCellComponent.m |  10 +-
 .../Sources/Component/WXComponent_internal.h    |   8 +-
 .../Sources/Component/WXCycleSliderComponent.h  |  18 +
 .../Sources/Component/WXCycleSliderComponent.m  | 594 +++++++++++++++++++
 .../Sources/Component/WXImageComponent.m        |  90 ++-
 .../Sources/Component/WXIndicatorComponent.h    |   8 +
 .../Sources/Component/WXIndicatorComponent.m    |  16 +-
 .../WeexSDK/Sources/Component/WXListComponent.m |   2 +
 .../Sources/Component/WXSliderComponent.m       |   5 +-
 .../Component/WXSliderNeighborComponent.h       |   3 +
 .../Component/WXSliderNeighborComponent.m       |   5 +-
 .../WeexSDK/Sources/Component/WXTextComponent.m | 254 ++++----
 .../Sources/Display/WXComponent+Display.m       | 219 ++++---
 ios/sdk/WeexSDK/Sources/Display/WXRoundedRect.h |   4 +
 .../WeexSDK/Sources/Display/WXRoundedRect.mm    |  10 +
 ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m    |   1 +
 .../Sources/Manager/WXComponentManager.h        |   4 +
 .../Sources/Manager/WXComponentManager.m        |   5 +
 ios/sdk/WeexSDK/Sources/Model/WXComponent.h     |  74 ++-
 ios/sdk/WeexSDK/Sources/Model/WXComponent.m     |  12 +-
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m   |   3 +
 .../WeexSDK/Sources/Protocol/WXBridgeProtocol.h |   4 +
 ios/sdk/WeexSDK/Sources/Utility/WXDefine.h      |  11 +
 ios/sdk/WeexSDK/Sources/Utility/WXType.h        |   5 +
 .../Sources/View/WXComponent+ViewManagement.m   |   3 +
 test/pages/components/recycler.vue              |  29 +-
 test/pages/slider-infinite.vue                  |  49 ++
 test/scripts/components/recycler.test.js        | 162 ++---
 test/scripts/components/slider-infinite.test.js |  38 ++
 49 files changed, 2178 insertions(+), 511 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/24f3a30f/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --cc ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index 9f8315f,42fccfb..b9d4760
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@@ -215,16 -99,6 +112,11 @@@
  {
      self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
      if (self) {
-         if (_isUsingTextStorageLock) {
-             pthread_mutexattr_init(&_textStorageMutexAttr);
-             pthread_mutexattr_settype(&_textStorageMutexAttr, PTHREAD_MUTEX_RECURSIVE);
-             pthread_mutex_init(&_textStorageMutex, &_textStorageMutexAttr);
-         }
 +        if (attributes[@"coretext"]) {
 +            _coretext = [WXConvert BOOL:attributes[@"coretext"]];
 +        } else {
 +            _coretext = YES;
 +        }
          [self fillCSSStyles:styles];
          [self fillAttributes:attributes];
      }
@@@ -323,14 -187,7 +205,8 @@@ do {
  
  - (void)viewDidLoad
  {
-     if (_isUsingTextStorageLock) {
-         pthread_mutex_lock(&_textStorageMutex);
-     }
      ((WXText *)self.view).textStorage = _textStorage;
 +    ((WXText *)self.view).attributedString = [self buildCTAttributeString];
-     if (_isUsingTextStorageLock) {
-         pthread_mutex_unlock(&_textStorageMutex);
-     }
      [self setNeedsDisplay];
  }
  
@@@ -607,14 -382,8 +474,8 @@@
      
      [self.weexInstance.componentManager  _addUITask:^{
          if ([self isViewLoaded]) {
-             if (_isUsingTextStorageLock) {
-                 pthread_mutex_lock(&_textStorageMutex);
-             }
              ((WXText *)self.view).textStorage = textStorage;
 -            
 +            ((WXText *)self.view).attributedString = attributedString;
-             if (_isUsingTextStorageLock) {
-                 pthread_mutex_unlock(&_textStorageMutex);
-             }
              [self readyToRender]; // notify super component
              [self setNeedsDisplay];
          }
@@@ -645,6 -414,29 +506,89 @@@
      [self syncTextStorageForView];
  }
  
+ - (void)drawTextWithContext:(CGContextRef)context bounds:(CGRect)bounds padding:(UIEdgeInsets)padding view:(WXText *)view
+ {
+     if (bounds.size.width <=0 || bounds.size.height <= 0) {
+         return;
+     }
+     
+     if ([self _needsDrawBorder]) {
+         [self _drawBorderWithContext:context size:bounds.size];
+     } else {
+         WXPerformBlockOnMainThread(^{
+             [self _resetNativeBorderRadius];
+         });
+     }
 -    NSLayoutManager *layoutManager = (view ? view.textStorage : _textStorage).layoutManagers.firstObject;
 -    NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
 -    
 -    CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
 -    NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
 -    
 -    [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:textFrame.origin];
 -    [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:textFrame.origin];
++    if (!self.coretext) {
++        NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject;
++        NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
++        
++        CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
++        NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
++        
++        [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:textFrame.origin];
++        [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:textFrame.origin];
++    }else {
++        CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
++        // sufficient height for text to draw, or frame lines will be empty
++        textFrame.size.height = bounds.size.height*2;
++        
++        //flip the coordinate system
++        CGContextRetain(context);
++        CGContextSetTextMatrix(context, CGAffineTransformIdentity);
++        CGContextTranslateCTM(context, 0, textFrame.size.height);
++        CGContextScaleCTM(context, 1.0, -1.0);
++        
++        //add path
++        CGMutablePathRef path = CGPathCreateMutable();
++        CGPathAddRect(path, NULL, textFrame);
++        NSMutableAttributedString * attributedStringCopy = [self buildCTAttributeString];
++        CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge  CFAttributedStringRef)attributedStringCopy);
++        CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
++        
++        CFArrayRef lines = CTFrameGetLines(frame);
++        CFIndex lineCount = CFArrayGetCount(lines);
++        CGPoint lineOrigins[lineCount];
++        CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), lineOrigins);
++        
++        CGFloat frameY = 0;
++        for (CFIndex index = 0; index < lineCount; index ++) {
++            CTLineRef lineRef = CFArrayGetValueAtIndex(lines, index);
++            CGFloat lineAscent;
++            CGFloat lineDescent;
++            CGFloat lineLeading;
++            
++            CTLineGetTypographicBounds(lineRef, &lineAscent, &lineDescent, &lineLeading);
++            CGPoint lineOrigin = lineOrigins[index];
++            
++            NSLog(@"lineAscent = %f",lineAscent);
++            NSLog(@"lineDescent = %f",lineDescent);
++            NSLog(@"lineLeading = %f",lineLeading);
++            
++            if (index > 0) {
++                frameY = frameY - lineAscent;
++            }else {
++                frameY = lineOrigin.y;
++            }
++            lineOrigin.x += padding.left;
++            lineOrigin.y -= padding.top;
++            NSLog(@"lines: %ld origin: %@",index, NSStringFromCGPoint(lineOrigin));
++            CGContextSetTextPosition(context, lineOrigin.x, lineOrigin.y);
++            //            CTLineDraw(lineRef, context);
++            CFArrayRef runs = CTLineGetGlyphRuns(lineRef);
++            for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runs); runIndex ++) {
++                CTRunRef run = CFArrayGetValueAtIndex(runs, runIndex);
++                CTRunDraw(run, context, CFRangeMake(0, 0));
++            }
++            frameY = frameY - lineDescent;
++        }
++        
++        CFRelease(frame);
++        CFRelease(framesetter);
++        CGPathRelease(path);
++    }
+ }
+ 
  #ifdef UITEST
  - (NSString *)description
  {


[11/23] incubator-weex git commit: * [ios] draw line-through

Posted by cx...@apache.org.
* [ios] draw line-through


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a95a0623
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a95a0623
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a95a0623

Branch: refs/heads/0.12-dev
Commit: a95a0623f1fb185009b55da27326d3c056bf8b70
Parents: 2b548d4
Author: acton393 <zh...@gmail.com>
Authored: Wed Apr 12 01:57:22 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Wed Apr 12 01:57:22 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.m | 82 ++++++++++++++++++--
 1 file changed, 74 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a95a0623/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index 2a81b9e..09e61e1 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -136,7 +136,7 @@ static BOOL textRenderUsingCoreText;
     self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
     if (self) {
         // just for coretext and textkit render replacement
-        if (attributes[@"coretext"]) {
+        if ([attributes objectForKey:@"coretext"]) {
             _coretext = [WXConvert BOOL:attributes[@"coretext"]];
         } else {
             _coretext = YES;
@@ -265,11 +265,15 @@ do {\
 {
     __weak typeof(self) weakSelf = self;
     return ^CGSize (CGSize constrainedSize) {
+        CGSize computedSize = CGSizeZero;
         NSTextStorage *textStorage = [weakSelf textStorageWithWidth:constrainedSize.width];
-        
-        NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
-        NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
-        CGSize computedSize = [layoutManager usedRectForTextContainer:textContainer].size;
+        if (!(weakSelf.coretext && [WXTextComponent textRenderUsingCoreText]) ) {
+            NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
+            NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
+            computedSize = [layoutManager usedRectForTextContainer:textContainer].size;
+        } else {
+            computedSize = [[weakSelf buildCTAttributeString] boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
+        }
         
         //TODO:more elegant way to use max and min constrained size
         if (!isnan(weakSelf.cssNode->style.minDimensions[CSS_WIDTH])) {
@@ -562,7 +566,7 @@ do {\
         CGRect textFrame = UIEdgeInsetsInsetRect(bounds, padding);
         // sufficient height for text to draw, or frame lines will be empty
         textFrame.size.height = bounds.size.height*2;
-        
+        CGContextSaveGState(context);
         //flip the coordinate system
         CGContextSetTextMatrix(context, CGAffineTransformIdentity);
         CGContextTranslateCTM(context, 0, textFrame.size.height);
@@ -580,7 +584,6 @@ do {\
         CFIndex lineCount = CFArrayGetCount(lines);
         CGPoint lineOrigins[lineCount];
         CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), lineOrigins);
-        
         for (CFIndex index = 0; index < lineCount; index ++) {
             CTLineRef lineRef = CFArrayGetValueAtIndex(lines, index);
             CGFloat lineAscent;
@@ -592,17 +595,80 @@ do {\
             lineOrigin.x += padding.left;
             lineOrigin.y -= padding.top;
             CGContextSetTextPosition(context, lineOrigin.x, lineOrigin.y);
-            //            CTLineDraw(lineRef, context);
             CFArrayRef runs = CTLineGetGlyphRuns(lineRef);
+            CGFloat xHeight = 0, underLinePosition = 0, lineThickness = 0 ;
+            WXTextGetRunsMaxMetric(runs, &xHeight, &underLinePosition, &lineThickness);
+            CGPoint strikethroughStart;
+            strikethroughStart.x =  lineOrigin.x - underLinePosition;
+            strikethroughStart.y = lineOrigin.y + xHeight/2;
             for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runs); runIndex ++) {
                 CTRunRef run = CFArrayGetValueAtIndex(runs, runIndex);
                 CTRunDraw(run, context, CFRangeMake(0, 0));
+                CFDictionaryRef attr = CTRunGetAttributes(run);
+                NSUnderlineStyle strikethrough = (NSUnderlineStyle)CFDictionaryGetValue(attr, NSStrikethroughStyleAttributeName);
+                
+                if (strikethrough) {
+                    // currently draw strikethrough
+                    CGPoint runPosition = CGPointZero;
+                    CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition);
+                    strikethroughStart.x = lineOrigin.x + runPosition.x;
+                    CGContextSetLineWidth(context, 1.5);
+                    double length = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL);
+                    CGContextMoveToPoint(context, strikethroughStart.x, strikethroughStart.y);
+                    CGContextAddLineToPoint(context, strikethroughStart.x + length, strikethroughStart.y);
+                    CGContextStrokePath(context);
+                }
+                
             }
         }
         
         CFRelease(frame);
         CFRelease(framesetter);
         CGPathRelease(path);
+        
+        CGContextRestoreGState(context);
+    }
+}
+
+static void WXTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *underlinePosition, CGFloat *lineThickness) {
+    CGFloat maxXHeight = 0;
+    CGFloat maxUnderlinePos = 0;
+    CGFloat maxLineThickness = 0;
+    for (NSUInteger index = 0, runsCount = CFArrayGetCount(runs); index < runsCount; index ++) {
+        CTRunRef run = CFArrayGetValueAtIndex(runs, index);
+        CFDictionaryRef attrs = CTRunGetAttributes(run);
+        if (attrs) {
+            CTFontRef font = CFDictionaryGetValue(attrs, kCTFontAttributeName);
+            if (font) {
+                
+                CGFloat xHeight = CTFontGetXHeight(font);
+                if (xHeight > maxXHeight) {
+                    maxXHeight = xHeight;
+                }
+                
+                CGFloat underlinePos = CTFontGetUnderlinePosition(font);
+                if (underlinePos < maxUnderlinePos) {
+                    maxUnderlinePos = underlinePos;
+                }
+                
+                CGFloat lineThickness = CTFontGetUnderlineThickness(font);
+                if (lineThickness > maxLineThickness) {
+                    maxLineThickness = lineThickness;
+                }
+            }
+        }
+    }
+    
+    if (xHeight) {
+        *xHeight = maxXHeight;
+    }
+    
+    if (underlinePosition) {
+        *underlinePosition = maxUnderlinePos;
+    }
+    
+    if (lineThickness) {
+        *lineThickness = maxLineThickness;
     }
 }
 


[14/23] incubator-weex git commit: * [ios] iconfont refactor

Posted by cx...@apache.org.
* [ios] iconfont refactor


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6cca6f8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6cca6f8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6cca6f8a

Branch: refs/heads/0.12-dev
Commit: 6cca6f8a8d7e852830299cf183d91701a159a3d3
Parents: ade22d6
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 14:47:57 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 14:47:57 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 30 ++++++++++++++----------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6cca6f8a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 6cb5334..466a563 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -455,20 +455,24 @@ static BOOL WXNotStat;
             // if the font file is not the correct font file. it will crash by singal 9
             CFURLRef fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)fpath, kCFURLPOSIXPathStyle, false);
             if (fontURL) {
-                CFErrorRef error = nil;
-                CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error);
-                if (error) {
-                    CFRelease(error);
-                    error = nil;
-                    CTFontManagerUnregisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
-                    CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
+                CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL(fontURL);
+                if (fontDataProvider) {
+                    CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider);
+                    CFErrorRef error = nil;
+                    CTFontManagerRegisterGraphicsFont(newFont, &error);
+                    // the same font family, remove it and register new one.
+                    if (error) {
+                        CTFontManagerUnregisterGraphicsFont(newFont, NULL);
+                        CTFontManagerRegisterGraphicsFont(newFont, NULL);
+                        CFRelease(error);
+                        error = nil;
+                    }
+                    fontFamily = (__bridge_transfer  NSString*)CGFontCopyPostScriptName(newFont);
+                    CGFontRelease(newFont);
+                    CFRelease(fontURL);
+                    CFRelease(fontDataProvider);
                 }
-                NSArray *descriptors = (__bridge_transfer NSArray *)CTFontManagerCreateFontDescriptorsFromURL(fontURL);
-                // length of descriptors here will be only one.
-                for (UIFontDescriptor *desc in descriptors) {
-                    font = [UIFont fontWithDescriptor:desc size:fontSize];
-                }
-                CFRelease(fontURL);
+                
             }
         }else {
             [[WXRuleManager sharedInstance] removeRule:@"fontFace" rule:@{@"fontFamily": fontFamily}];


[20/23] incubator-weex git commit: Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor

Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e100f8ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e100f8ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e100f8ae

Branch: refs/heads/0.12-dev
Commit: e100f8ae87a50e56adc6eb095328e35be119e458
Parents: e2205bf 3774b1b
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 17:49:50 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 17:49:50 2017 +0800

----------------------------------------------------------------------
 .eslintignore                                   |   1 +
 .gitignore                                      |   2 +-
 .travis.yml                                     |   2 +-
 NOTICE                                          |   8 +-
 android/sdk/assets/main.js                      |  15 +-
 android/sdk/libs/armeabi/libweexv8.so           | Bin 3563544 -> 3571752 bytes
 android/sdk/libs/x86/libweexv8.so               | Bin 4545544 -> 4566088 bytes
 .../main/java/com/taobao/weex/WXSDKEngine.java  |   3 +
 .../java/com/taobao/weex/WXSDKInstance.java     |  10 +-
 .../weex/appfram/pickers/WXPickersModule.java   |   2 +
 .../java/com/taobao/weex/bridge/WXBridge.java   |   8 +
 .../com/taobao/weex/bridge/WXBridgeManager.java |   8 +-
 .../java/com/taobao/weex/common/IWXBridge.java  |   2 +
 .../com/taobao/weex/dom/WXCellDomObject.java    |  57 ++
 .../taobao/weex/dom/WXRecyclerDomObject.java    |  29 +-
 .../taobao/weex/ui/component/WXComponent.java   |  13 +-
 .../com/taobao/weex/ui/component/WXDiv.java     |   4 +-
 .../com/taobao/weex/ui/view/IRenderResult.java  |  26 +
 .../com/taobao/weex/ui/view/WXFrameLayout.java  |  19 +-
 .../com/taobao/weex/ui/view/WXImageView.java    |   9 +-
 .../com/taobao/weex/ui/view/WXTextView.java     |   9 +-
 .../taobao/weex/ui/component/WXTextTest.java    |   5 +-
 .../taobao/weex/bridge/WXWebsocketBridge.java   |   3 +
 build/karma.vue.conf.js                         |   7 +-
 build/webpack.examples.web.config.js            |  31 +-
 build/webpack.test.web.config.js                |  81 +++
 dangerfile.js                                   |  11 +-
 examples/vue/showcase/itemlist.vue              |  11 +-
 examples/vue/style/index.vue                    |   2 +-
 .../npm/karma-rollup-preprocessor_vx.x.x.js     |  53 ++
 flow-typed/npm/karma-sinon-chai_vx.x.x.js       |  38 ++
 html5/render/browser/base/component/lazyload.js |   1 -
 html5/render/browser/extend/api/webSocket.js    |   1 -
 .../browser/extend/components/image/index.js    |   1 -
 .../extend/components/scrollable/motion.js      |   1 -
 .../extend/components/scrollable/scrollable.js  |   1 -
 html5/render/browser/utils/index.js             |   1 -
 html5/render/vue/README.md                      |  24 +-
 html5/render/vue/components/a.js                |  18 +-
 html5/render/vue/components/div.js              |  18 +-
 html5/render/vue/components/image.js            |  25 +-
 html5/render/vue/components/input.js            |  18 +-
 .../render/vue/components/scrollable/header.js  |   6 +-
 .../vue/components/scrollable/list/cell.js      |   7 +-
 .../vue/components/scrollable/list/index.js     |   6 +-
 .../vue/components/scrollable/list/style.js     |  16 +
 .../components/scrollable/loading-indicator.js  |  43 +-
 .../render/vue/components/scrollable/loading.js |   6 +-
 .../render/vue/components/scrollable/refresh.js |   6 +-
 .../vue/components/scrollable/scroller.js       |   8 +-
 html5/render/vue/components/slider/index.js     |  37 +-
 html5/render/vue/components/slider/indicator.js |  58 +-
 html5/render/vue/components/switch.js           |  67 ++-
 html5/render/vue/components/text.js             |  27 +-
 html5/render/vue/components/textarea.js         |  19 +-
 html5/render/vue/components/video.js            |   7 +-
 html5/render/vue/components/web.js              |  19 +-
 html5/render/vue/core/index.js                  |   2 +
 html5/render/vue/core/node.js                   |  28 +
 html5/render/vue/core/style.js                  | 212 ++++++++
 html5/render/vue/env/global.js                  |  11 +
 html5/render/vue/env/index.js                   |  11 +-
 html5/render/vue/env/viewport.js                | 160 ++++--
 html5/render/vue/env/weex.js                    |   9 +-
 html5/render/vue/env/wx-env.js                  |  76 +--
 html5/render/vue/index.js                       |  13 +-
 html5/render/vue/mixins/base.js                 |  43 --
 html5/render/vue/mixins/style.js                | 142 +----
 html5/render/vue/modules/animation.js           |   7 +-
 html5/render/vue/modules/dom.js                 |   5 +-
 html5/render/vue/modules/index.js               |   2 +-
 html5/render/vue/modules/modal/index.js         |  10 +-
 html5/render/vue/modules/modal/style.js         | 146 ++++++
 html5/render/vue/styles/base.css                | 194 +++++++
 html5/render/vue/styles/components.css          | 513 ------------------
 html5/render/vue/utils/index.js                 |  36 +-
 html5/render/vue/utils/style.js                 | 110 ++++
 html5/test/render/vue/components/image.js       |   4 +-
 html5/test/render/vue/components/switch.js      |   4 -
 html5/test/render/vue/components/text.js        |   4 -
 html5/test/render/vue/components/web.js         |   4 -
 html5/test/render/vue/core/scope-style-map.js   |  76 +++
 html5/test/render/vue/core/style.js             |  65 +++
 .../vue/data/build/dotvue/scoped-style.js       | 525 +++++++++++++++++++
 html5/test/render/vue/data/css/head1.css        |  38 ++
 html5/test/render/vue/data/css/head10.css       |  14 +
 html5/test/render/vue/data/css/head11.css       |   2 +
 html5/test/render/vue/data/css/head12.css       |   2 +
 html5/test/render/vue/data/css/head13.css       |  25 +
 html5/test/render/vue/data/css/head2.css        |  11 +
 html5/test/render/vue/data/css/head3.css        |  25 +
 html5/test/render/vue/data/css/head4.css        |  56 ++
 html5/test/render/vue/data/css/head5.css        | 153 ++++++
 html5/test/render/vue/data/css/head6.css        |   4 +
 html5/test/render/vue/data/css/head7.css        |  61 +++
 html5/test/render/vue/data/css/head8.css        | 507 ++++++++++++++++++
 html5/test/render/vue/data/css/head9.css        | 173 ++++++
 .../render/vue/data/dotvue/scoped-style.vue     |  13 +
 html5/test/render/vue/data/head-css.js          |  13 +
 html5/test/render/vue/data/head-map.js          | 275 ++++++++++
 html5/test/render/vue/helper.js                 | 140 -----
 html5/test/render/vue/helper/env.js             |  20 +
 html5/test/render/vue/helper/index.js           |  73 +++
 html5/test/render/vue/helper/runtime.js         |  74 +++
 html5/test/render/vue/helper/utils.js           |   8 +
 html5/test/render/vue/utils.js                  |  47 --
 html5/test/render/vue/utils/func.js             |  49 ++
 html5/test/render/vue/utils/style.js            |  68 +++
 ios/sdk/WeexSDK/Resources/main.js               |  15 +-
 .../Sources/Component/WXImageComponent.m        |   6 +-
 .../Sources/Display/WXComponent+Display.m       |   2 +-
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m |  32 +-
 package.json                                    |   6 +-
 packages/weex-vue-render/README.md              |  24 +-
 packages/weex-vue-render/package.json           |   2 +-
 test/ci-funcs.sh                                |   3 +-
 test/pages/components/recycler.vue              |  19 +-
 test/pages/slider-infinite.vue                  |  11 +-
 test/scripts/components/recycler.test.js        |  56 +-
 test/scripts/components/slider-infinite.test.js |  15 +-
 120 files changed, 4100 insertions(+), 1264 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e100f8ae/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
----------------------------------------------------------------------


[10/23] incubator-weex git commit: * [ios] bugfix use opaque canvas according to whether needs draw border

Posted by cx...@apache.org.
* [ios] bugfix use opaque canvas  according to  whether needs draw border


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2b548d49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2b548d49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2b548d49

Branch: refs/heads/0.12-dev
Commit: 2b548d496d93cae0e2c8e3ca7cd0314b2138a9c0
Parents: 09d8869
Author: acton393 <zh...@gmail.com>
Authored: Wed Apr 12 01:55:48 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Wed Apr 12 01:55:48 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2b548d49/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
index 918f313..dac3c4c 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
@@ -564,7 +564,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(_backgroundColor.CGColor) == 1.0;
+    return (!hasBorderRadius) && _opacity == 1.0 && CGColorGetAlpha(_backgroundColor.CGColor) == 1.0 && [self _needsDrawBorder];
 }
 
 #pragma mark - Deprecated


[22/23] incubator-weex git commit: * [ios] adjust configuration

Posted by cx...@apache.org.
* [ios] adjust configuration


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/41f524f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/41f524f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/41f524f4

Branch: refs/heads/0.12-dev
Commit: 41f524f474f7fc17d637c46166ed57910aa1683e
Parents: efd5600
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 18:44:38 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 18:44:38 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h |  2 --
 ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m | 13 ++++++++-----
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.h         |  2 ++
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m         |  9 +++++++--
 4 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/41f524f4/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
index 7fb8f34..8b616f4 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
@@ -22,6 +22,4 @@
 @interface WXTextComponent : WXComponent
 
 + (void)setRenderUsingCoreText:(BOOL)usingCoreText;
-+ (BOOL)useCoreText;
-
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/41f524f4/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index a6d24d9..d47e3f0 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -81,7 +81,10 @@
 @end
 
 static BOOL textRenderUsingCoreText = NO;
-static BOOL useCoreTextAttr = NO;
+
+@interface WXTextComponent()
+@property (nonatomic, assign)BOOL useCoreTextAttr;
+@end
 
 @implementation WXTextComponent
 {
@@ -124,7 +127,7 @@ static BOOL useCoreTextAttr = NO;
     if (self) {
         // just for coretext and textkit render replacement
         if ([attributes objectForKey:@"coretext"]) {
-            useCoreTextAttr = [WXConvert BOOL:attributes[@"coretext"]];
+            _useCoreTextAttr = [WXConvert BOOL:attributes[@"coretext"]];
         } else {
             _useCoreTextAttr = NO;
         }
@@ -136,9 +139,9 @@ static BOOL useCoreTextAttr = NO;
     return self;
 }
 
-+ (BOOL)useCoreText
+- (BOOL)useCoreText
 {
-    if (useCoreTextAttr) {
+    if (_useCoreTextAttr) {
         return YES;
     }
     if ([WXTextComponent textRenderUsingCoreText]) {
@@ -339,7 +342,7 @@ do {\
     }
     
     // set font
-    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor];
+    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor useCoreText:[self useCoreText]];
     CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName,
                                            font.pointSize,
                                            NULL);

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/41f524f4/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
index b265b23..39c4034 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
@@ -226,6 +226,8 @@ extern _Nonnull SEL WXSwizzledSelectorForSelector(_Nonnull SEL selector);
  */
 + (UIFont *_Nonnull)fontWithSize:(CGFloat)size textWeight:(CGFloat)textWeight textStyle:(WXTextStyle)textStyle fontFamily:(NSString *_Nullable)fontFamily scaleFactor:(CGFloat)scaleFactor;
 
++ (UIFont *_Nonnull)fontWithSize:(CGFloat)size textWeight:(CGFloat)textWeight textStyle:(WXTextStyle)textStyle fontFamily:(NSString *_Nullable)fontFamily scaleFactor:(CGFloat)scaleFactor useCoreText:(BOOL)useCoreText;
+
 /**
  * @abstract download remote font from specified url
  * @param fontURL for remote font

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/41f524f4/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 22faf05..048e7bc 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -444,7 +444,7 @@ static BOOL WXNotStat;
     return [self fontWithSize:size textWeight:textWeight textStyle:textStyle fontFamily:fontFamily scaleFactor:[self defaultPixelScaleFactor]];
 }
 
-+ (UIFont *)fontWithSize:(CGFloat)size textWeight:(CGFloat)textWeight textStyle:(WXTextStyle)textStyle fontFamily:(NSString *)fontFamily scaleFactor:(CGFloat)scaleFactor
++ (UIFont *)fontWithSize:(CGFloat)size textWeight:(CGFloat)textWeight textStyle:(WXTextStyle)textStyle fontFamily:(NSString *)fontFamily scaleFactor:(CGFloat)scaleFactor useCoreText:(BOOL)useCoreText
 {
     CGFloat fontSize = (isnan(size) || size == 0) ?  32 * scaleFactor : size;
     UIFont *font = nil;
@@ -457,7 +457,7 @@ static BOOL WXNotStat;
             // if the font file is not the correct font file. it will crash by singal 9
             CFURLRef fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)fpath, kCFURLPOSIXPathStyle, false);
             if (fontURL) {
-                if ([WXTextComponent useCoreText]) {
+                if (useCoreText) {
                     CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL(fontURL);
                     if (fontDataProvider) {
                         CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider);
@@ -531,6 +531,11 @@ static BOOL WXNotStat;
     return font;
 }
 
++ (UIFont *)fontWithSize:(CGFloat)size textWeight:(CGFloat)textWeight textStyle:(WXTextStyle)textStyle fontFamily:(NSString *)fontFamily scaleFactor:(CGFloat)scaleFactor
+{
+    return [self fontWithSize:size textWeight:textWeight textStyle:textStyle fontFamily:fontFamily scaleFactor:scaleFactor useCoreText:NO];
+}
+
 + (void)getIconfont:(NSURL *)url completion:(void(^)(NSURL *url, NSError *error))completionBlock
 {
     dispatch_async(dispatch_get_global_queue(0, 0), ^{


[02/23] incubator-weex git commit: * [ios] line by line to draw

Posted by cx...@apache.org.
* [ios] line  by line to draw


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c94e48b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c94e48b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c94e48b6

Branch: refs/heads/0.12-dev
Commit: c94e48b6d1ed5bbe1f9b42bd93c5c226b5008be2
Parents: be4eb0e
Author: acton393 <zh...@gmail.com>
Authored: Mon Apr 10 12:17:03 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Apr 10 12:17:03 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.m | 50 ++++++++++++++++++--
 1 file changed, 47 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c94e48b6/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index d226b9a..9f8315f 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -88,7 +88,44 @@
         NSMutableAttributedString * attributedStringCopy = [_attributedString mutableCopy];
         CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge  CFAttributedStringRef)attributedStringCopy);
         CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
-        CTFrameDraw(frame, context);
+        
+        CFArrayRef lines = CTFrameGetLines(frame);
+        CFIndex lineCount = CFArrayGetCount(lines);
+        CGPoint lineOrigins[lineCount];
+        CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), lineOrigins);
+        
+        CGFloat frameY = 0;
+        for (CFIndex index = 0; index < lineCount; index ++) {
+            CTLineRef lineRef = CFArrayGetValueAtIndex(lines, index);
+            CGFloat lineAscent;
+            CGFloat lineDescent;
+            CGFloat lineLeading;
+            
+            CTLineGetTypographicBounds(lineRef, &lineAscent, &lineDescent, &lineLeading);
+            CGPoint lineOrigin = lineOrigins[index];
+            
+            NSLog(@"lineAscent = %f",lineAscent);
+            NSLog(@"lineDescent = %f",lineDescent);
+            NSLog(@"lineLeading = %f",lineLeading);
+            
+            if (index > 0) {
+                frameY = frameY - lineAscent;
+            }else {
+                frameY = lineOrigin.y;
+            }
+            lineOrigin.x += padding.left;
+            lineOrigin.y -= padding.top;
+            NSLog(@"lines: %ld origin: %@",index, NSStringFromCGPoint(lineOrigin));
+            CGContextSetTextPosition(context, lineOrigin.x, lineOrigin.y);
+//            CTLineDraw(lineRef, context);
+            CFArrayRef runs = CTLineGetGlyphRuns(lineRef);
+            for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runs); runIndex ++) {
+                CTRunRef run = CFArrayGetValueAtIndex(runs, runIndex);
+                CTRunDraw(run, context, CFRangeMake(0, 0));
+            }
+            frameY = frameY - lineDescent;
+        }
+        
         UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
         UIGraphicsEndImageContext();
         
@@ -425,11 +462,18 @@ do {\
         paragraphStyle.alignment = _textAlign;
     }
     
+    // set default lineBreakMode
+    paragraphStyle.lineBreakMode = NSLineBreakByClipping;
+    if (_textOverflow && [_textOverflow length] > 0) {
+        if ([_textOverflow isEqualToString:@"ellipsis"])
+            paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
+    }
+    
     if (_lineHeight) {
         paragraphStyle.maximumLineHeight = _lineHeight;
         paragraphStyle.minimumLineHeight = _lineHeight;
     }
-    if (_lineHeight || _textAlign) {
+    if (_lineHeight || _textAlign || [_textOverflow length] > 0) {
         [attributedString addAttribute:(id)kCTParagraphStyleAttributeName
                                  value:paragraphStyle
                                  range:(NSRange){0, attributedString.length}];
@@ -511,7 +555,7 @@ do {\
 
 - (BOOL)adjustLineHeight
 {
-    return YES;
+    return !_coretext;
 }
 
 - (NSTextStorage *)textStorageWithWidth:(CGFloat)width


[08/23] incubator-weex git commit: Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor

Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7eefcfb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7eefcfb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7eefcfb4

Branch: refs/heads/0.12-dev
Commit: 7eefcfb45db827ce34f3ad0480f99b9eb28a5f91
Parents: 395ffc6 7be4686
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 11 15:13:43 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 11 15:13:43 2017 +0800

----------------------------------------------------------------------
 .travis.yml                                     |  2 +-
 .../java/com/taobao/weex/WXSDKInstance.java     |  4 +-
 .../appfram/navigator/WXNavigatorModule.java    |  4 +-
 .../taobao/weex/ui/component/WXComponent.java   |  3 ++
 .../com/taobao/weex/ui/component/WXEmbed.java   | 40 +++++++++++++++++
 .../com/taobao/weex/ui/component/WXImage.java   |  5 ++-
 examples/vue/components/sliderinfinite.vue      | 46 ++++++++++++++++++++
 html5/frameworks/index.js                       |  4 +-
 html5/frameworks/legacy/api/methods.js          |  4 +-
 html5/frameworks/legacy/api/modules.js          |  4 +-
 html5/frameworks/legacy/app/bundle/bootstrap.js |  4 +-
 html5/frameworks/legacy/app/bundle/define.js    |  4 +-
 html5/frameworks/legacy/app/bundle/index.js     |  4 +-
 html5/frameworks/legacy/app/ctrl/index.js       |  4 +-
 html5/frameworks/legacy/app/ctrl/init.js        |  4 +-
 html5/frameworks/legacy/app/ctrl/misc.js        |  4 +-
 html5/frameworks/legacy/app/differ.js           |  4 +-
 html5/frameworks/legacy/app/downgrade.js        |  4 +-
 html5/frameworks/legacy/app/index.js            |  4 +-
 html5/frameworks/legacy/app/instance.js         |  4 +-
 html5/frameworks/legacy/app/register.js         |  4 +-
 html5/frameworks/legacy/app/viewport.js         |  4 +-
 html5/frameworks/legacy/config.js               |  4 +-
 html5/frameworks/legacy/core/array.js           |  4 +-
 html5/frameworks/legacy/core/dep.js             |  4 +-
 html5/frameworks/legacy/core/object.js          |  4 +-
 html5/frameworks/legacy/core/observer.js        |  4 +-
 html5/frameworks/legacy/core/state.js           |  4 +-
 html5/frameworks/legacy/core/watcher.js         |  4 +-
 html5/frameworks/legacy/index.js                |  4 +-
 html5/frameworks/legacy/static/bridge.js        |  4 +-
 html5/frameworks/legacy/static/create.js        |  4 +-
 html5/frameworks/legacy/static/life.js          |  4 +-
 html5/frameworks/legacy/static/map.js           |  4 +-
 html5/frameworks/legacy/static/misc.js          |  4 +-
 html5/frameworks/legacy/static/register.js      |  4 +-
 html5/frameworks/legacy/util/index.js           |  4 +-
 html5/frameworks/legacy/util/shared.js          |  4 +-
 html5/frameworks/legacy/vm/compiler.js          |  4 +-
 html5/frameworks/legacy/vm/directive.js         |  4 +-
 html5/frameworks/legacy/vm/dom-helper.js        |  4 +-
 html5/frameworks/legacy/vm/events.js            |  4 +-
 html5/frameworks/legacy/vm/index.js             |  4 +-
 html5/frameworks/vanilla/index.js               |  4 +-
 html5/render/browser/base/atomic.js             |  4 +-
 html5/render/browser/base/component/flexbox.js  |  4 +-
 html5/render/browser/base/component/index.js    |  4 +-
 html5/render/browser/base/component/lazyload.js |  4 +-
 html5/render/browser/base/component/operate.js  |  4 +-
 html5/render/browser/base/component/position.js |  4 +-
 html5/render/browser/base/component/sticky.js   |  4 +-
 .../browser/base/component/valueFilter.js       |  4 +-
 html5/render/browser/base/div.js                |  4 +-
 html5/render/browser/base/droot.js              |  4 +-
 html5/render/browser/base/moduleEvent.js        |  4 +-
 html5/render/browser/base/root.js               |  4 +-
 html5/render/browser/bridge/index.js            |  4 +-
 html5/render/browser/bridge/protocol.js         |  4 +-
 html5/render/browser/bridge/receiver.js         |  4 +-
 html5/render/browser/bridge/sender.js           |  4 +-
 html5/render/browser/dom/appearWatcher.js       |  4 +-
 html5/render/browser/dom/componentManager.js    |  4 +-
 html5/render/browser/dom/index.js               |  4 +-
 .../browser/extend/api/animation/index.js       |  4 +-
 .../render/browser/extend/api/animation/lib.js  |  4 +-
 html5/render/browser/extend/api/clipboard.js    |  4 +-
 html5/render/browser/extend/api/dom.js          |  4 +-
 html5/render/browser/extend/api/event.js        |  4 +-
 html5/render/browser/extend/api/geolocation.js  |  4 +-
 html5/render/browser/extend/api/globalEvent.js  |  4 +-
 html5/render/browser/extend/api/meta.js         |  4 +-
 html5/render/browser/extend/api/modal.js        |  4 +-
 html5/render/browser/extend/api/navigator.js    |  4 +-
 html5/render/browser/extend/api/pageInfo.js     |  4 +-
 html5/render/browser/extend/api/storage.js      |  4 +-
 html5/render/browser/extend/api/stream.js       |  4 +-
 html5/render/browser/extend/api/timer.js        |  4 +-
 html5/render/browser/extend/api/webSocket.js    |  4 +-
 html5/render/browser/extend/api/webview.js      |  4 +-
 html5/render/browser/extend/components/a.js     |  4 +-
 .../browser/extend/components/countdown.js      |  4 +-
 .../browser/extend/components/datepicker.js     |  4 +-
 html5/render/browser/extend/components/embed.js |  4 +-
 .../browser/extend/components/image/index.js    |  4 +-
 .../extend/components/indicator/index.js        |  4 +-
 html5/render/browser/extend/components/input.js |  4 +-
 .../render/browser/extend/components/marquee.js |  4 +-
 .../browser/extend/components/neighbor/index.js |  4 +-
 .../browser/extend/components/richtext.js       |  4 +-
 .../extend/components/scrollable/index.js       |  4 +-
 .../extend/components/scrollable/list/hlist.js  |  4 +-
 .../extend/components/scrollable/list/index.js  |  4 +-
 .../extend/components/scrollable/list/list.js   |  4 +-
 .../extend/components/scrollable/list/vlist.js  |  4 +-
 .../components/scrollable/loading/index.js      |  4 +-
 .../extend/components/scrollable/motion.js      |  4 +-
 .../components/scrollable/refresh/index.js      |  4 +-
 .../extend/components/scrollable/scroll.js      |  4 +-
 .../extend/components/scrollable/scrollable.js  |  4 +-
 .../components/scrollable/scroller/index.js     |  4 +-
 .../render/browser/extend/components/select.js  |  4 +-
 .../extend/components/slider/carrousel.js       |  4 +-
 .../browser/extend/components/slider/index.js   |  4 +-
 .../browser/extend/components/slider/timer.js   |  4 +-
 .../browser/extend/components/spinner/index.js  |  4 +-
 .../browser/extend/components/switch/index.js   |  4 +-
 .../extend/components/tabheader/index.js        |  4 +-
 html5/render/browser/extend/components/text.js  |  4 +-
 .../browser/extend/components/textarea.js       |  4 +-
 .../browser/extend/components/timepicker.js     |  4 +-
 .../browser/extend/components/video/index.js    |  4 +-
 html5/render/browser/extend/components/web.js   |  4 +-
 html5/render/browser/extend/index.js            |  4 +-
 html5/render/browser/index.js                   |  4 +-
 html5/render/browser/render/config.js           |  4 +-
 html5/render/browser/render/gesture.js          |  4 +-
 html5/render/browser/render/index.js            |  4 +-
 html5/render/browser/render/loader.js           |  4 +-
 html5/render/browser/render/register.js         |  4 +-
 html5/render/browser/utils/array.js             |  4 +-
 html5/render/browser/utils/index.js             |  4 +-
 html5/render/browser/utils/logger.js            |  4 +-
 html5/render/native/index.js                    |  4 +-
 html5/render/vue/components/a.js                |  4 +-
 html5/render/vue/components/div.js              |  4 +-
 html5/render/vue/components/image.js            |  4 +-
 html5/render/vue/components/index.js            |  4 +-
 html5/render/vue/components/input.js            |  4 +-
 .../render/vue/components/scrollable/header.js  |  4 +-
 .../vue/components/scrollable/list/cell.js      |  4 +-
 .../vue/components/scrollable/list/index.js     |  4 +-
 .../vue/components/scrollable/list/listMixin.js |  4 +-
 .../components/scrollable/loading-indicator.js  |  4 +-
 .../render/vue/components/scrollable/loading.js |  4 +-
 .../render/vue/components/scrollable/refresh.js |  4 +-
 .../vue/components/scrollable/scroller.js       |  4 +-
 html5/render/vue/components/slider/index.js     | 10 +++--
 html5/render/vue/components/slider/indicator.js |  4 +-
 .../render/vue/components/slider/slideMixin.js  | 28 ++++++++++--
 html5/render/vue/components/switch.js           |  4 +-
 html5/render/vue/components/text.js             |  4 +-
 html5/render/vue/components/textarea.js         |  4 +-
 html5/render/vue/components/video.js            |  4 +-
 html5/render/vue/components/warning.js          |  4 +-
 html5/render/vue/components/web.js              |  4 +-
 html5/render/vue/env/index.js                   |  4 +-
 html5/render/vue/env/viewport.js                |  4 +-
 html5/render/vue/env/weex.js                    |  4 +-
 html5/render/vue/env/wx-env.js                  |  4 +-
 html5/render/vue/index.js                       |  4 +-
 html5/render/vue/mixins/base.js                 |  4 +-
 html5/render/vue/mixins/index.js                |  4 +-
 html5/render/vue/mixins/input-common.js         |  4 +-
 html5/render/vue/mixins/scrollable.js           |  4 +-
 html5/render/vue/mixins/style.js                |  4 +-
 html5/render/vue/modules/animation.js           |  4 +-
 html5/render/vue/modules/dom.js                 |  8 +++-
 html5/render/vue/modules/index.js               |  4 +-
 html5/render/vue/modules/modal/alert.js         |  4 +-
 html5/render/vue/modules/modal/confirm.js       |  4 +-
 html5/render/vue/modules/modal/index.js         |  4 +-
 html5/render/vue/modules/modal/modal.js         |  4 +-
 html5/render/vue/modules/modal/prompt.js        |  4 +-
 html5/render/vue/modules/modal/toast.js         |  4 +-
 html5/render/vue/modules/navigator.js           |  4 +-
 html5/render/vue/modules/webview.js             |  4 +-
 html5/render/vue/utils/component.js             |  4 +-
 html5/render/vue/utils/event.js                 |  4 +-
 html5/render/vue/utils/func.js                  |  4 +-
 html5/render/vue/utils/index.js                 |  4 +-
 html5/render/vue/utils/lazyload.js              |  4 +-
 html5/render/vue/utils/perf.js                  |  4 +-
 html5/render/vue/utils/style.js                 |  4 +-
 html5/render/vue/utils/type.js                  |  4 +-
 html5/render/vue/validator/check.js             |  4 +-
 html5/render/vue/validator/index.js             |  4 +-
 html5/render/vue/validator/prop.js              |  4 +-
 html5/render/vue/validator/style.js             |  4 +-
 html5/runtime/callback-manager.js               |  4 +-
 html5/runtime/config.js                         |  4 +-
 html5/runtime/handler.js                        |  4 +-
 html5/runtime/index.js                          |  4 +-
 html5/runtime/init.js                           |  4 +-
 html5/runtime/listener.js                       |  4 +-
 html5/runtime/service.js                        |  4 +-
 html5/runtime/task-center.js                    |  4 +-
 html5/runtime/vdom/comment.js                   |  4 +-
 html5/runtime/vdom/document.js                  |  4 +-
 html5/runtime/vdom/element-types.js             |  4 +-
 html5/runtime/vdom/element.js                   |  4 +-
 html5/runtime/vdom/index.js                     |  4 +-
 html5/runtime/vdom/node.js                      |  4 +-
 html5/runtime/vdom/operation.js                 |  4 +-
 html5/services/amd/index.js                     |  4 +-
 html5/services/broadcast-channel/index.js       |  4 +-
 .../services/broadcast-channel/message-event.js |  4 +-
 html5/services/index.js                         |  4 +-
 html5/shared/arrayFrom.js                       |  4 +-
 html5/shared/console.js                         |  4 +-
 html5/shared/freeze.js                          |  4 +-
 html5/shared/index.js                           |  4 +-
 html5/shared/objectAssign.js                    |  4 +-
 html5/shared/objectSetPrototypeOf.js            |  4 +-
 html5/shared/promise.js                         |  4 +-
 html5/shared/setTimeout.js                      |  4 +-
 ios/sdk/WeexSDK.xcodeproj/project.pbxproj       |  2 +
 .../WeexSDK/Sources/Component/WXEditComponent.m |  8 ++--
 .../Sources/Controller/WXBaseViewController.m   |  5 ++-
 scripts/rh/header.template                      |  4 +-
 test/pages/image-onload.vue                     |  2 +-
 test/scripts/components/image-onload.test.js    |  4 +-
 vue.html                                        | 10 ++---
 212 files changed, 543 insertions(+), 422 deletions(-)
----------------------------------------------------------------------



[04/23] incubator-weex git commit: Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor

Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1e34a1fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1e34a1fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1e34a1fe

Branch: refs/heads/0.12-dev
Commit: 1e34a1fefe080e02396c6fe50beefec8f4a58ac9
Parents: 24f3a30 c7948a7
Author: acton393 <zh...@gmail.com>
Authored: Mon Apr 10 21:41:06 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Apr 10 21:41:06 2017 +0800

----------------------------------------------------------------------
 .rat-excludes                                   |  11 +
 .../alibaba/weex/commons/ApplicationTest.java   | 222 +-----
 .../weex/commons/AbstractWeexActivity.java      | 222 +-----
 .../weex/commons/SimpleWeexActivity.java        | 220 +-----
 .../weex/commons/WXAnalyzerDelegate.java        | 220 +-----
 .../alibaba/weex/commons/adapter/BlurTool.java  | 220 +-----
 .../commons/adapter/BlurTransformation.java     | 222 +-----
 .../adapter/DefaultWebSocketAdapter.java        | 220 +-----
 .../adapter/DefaultWebSocketAdapterFactory.java | 220 +-----
 .../commons/adapter/FrescoImageAdapter.java     | 220 +-----
 .../commons/adapter/FrescoImageComponent.java   | 220 +-----
 .../weex/commons/adapter/FrescoImageView.java   | 220 +-----
 .../weex/commons/adapter/ImageAdapter.java      | 220 +-----
 .../commons/adapter/JSExceptionAdapter.java     | 220 +-----
 .../alibaba/weex/commons/util/AssertUtil.java   | 220 +-----
 .../alibaba/weex/commons/util/ScreenUtil.java   | 220 +-----
 .../java/com/alibaba/weex/ApplicationTest.java  |  20 +-
 .../com/alibaba/weex/WeappJsBaseTestCase.java   |  18 +
 .../benchmark/BenchmarkActivityTestRule.java    | 218 +-----
 .../alibaba/weex/benchmark/BenchmarkTest.java   | 218 +-----
 .../com/alibaba/weex/benchmark/BoxPlot.java     | 218 +-----
 .../java/com/alibaba/weex/benchmark/Repeat.java | 218 +-----
 .../com/alibaba/weex/benchmark/RepeatRule.java  | 218 +-----
 .../weex/benchmark/WeexNativeCompareTest.java   | 218 +-----
 .../java/com/alibaba/weex/util/Falcon.java      |  18 +
 .../java/com/alibaba/weex/util/ScreenShot.java  |  18 +
 .../com/alibaba/weex/util/SdCardHelper.java     |  18 +
 .../java/com/alibaba/weex/util/TestFlow.java    |  18 +
 .../java/com/alibaba/weex/util/ViewUtil.java    |  18 +
 .../com/alibaba/weex/BenchmarkActivity.java     | 218 +-----
 .../java/com/alibaba/weex/IndexActivity.java    | 220 +-----
 .../java/com/alibaba/weex/SplashActivity.java   | 220 +-----
 .../src/main/java/com/alibaba/weex/Utility.java | 220 +-----
 .../java/com/alibaba/weex/WXApplication.java    | 220 +-----
 .../java/com/alibaba/weex/WXBaseActivity.java   | 220 +-----
 .../java/com/alibaba/weex/WXDebugActivity.java  | 220 +-----
 .../java/com/alibaba/weex/WXPageActivity.java   | 220 +-----
 .../com/alibaba/weex/constants/Constants.java   | 220 +-----
 .../alibaba/weex/extend/PlayDebugAdapter.java   | 220 +-----
 .../extend/WXInstanceStatisticsListener.java    | 220 +-----
 .../extend/adapter/InterceptWXHttpAdapter.java  | 220 +-----
 .../alibaba/weex/extend/component/RichText.java | 220 +-----
 .../extend/component/WXComponentSyncTest.java   | 220 +-----
 .../alibaba/weex/extend/component/WXMask.java   | 126 +---
 .../extend/component/dom/WXMaskDomObject.java   | 220 +-----
 .../weex/extend/module/GeolocationModule.java   | 220 +-----
 .../alibaba/weex/extend/module/MyModule.java    | 220 +-----
 .../weex/extend/module/RenderModule.java        | 220 +-----
 .../weex/extend/module/SyncTestModule.java      | 220 +-----
 .../weex/extend/module/WXEventModule.java       | 220 +-----
 .../extend/module/location/DefaultLocation.java | 222 +-----
 .../weex/extend/module/location/ILocatable.java | 220 +-----
 .../extend/module/location/LocationFactory.java | 220 +-----
 .../alibaba/weex/extend/view/WXMaskView.java    | 220 +-----
 .../alibaba/weex/https/HotRefreshManager.java   | 220 +-----
 .../com/alibaba/weex/https/WXHttpManager.java   | 220 +-----
 .../com/alibaba/weex/https/WXHttpResponse.java  | 220 +-----
 .../java/com/alibaba/weex/https/WXHttpTask.java | 220 +-----
 .../alibaba/weex/https/WXOkHttpDispatcher.java  | 220 +-----
 .../alibaba/weex/https/WXRequestListener.java   | 220 +-----
 android/sdk/license/LICENSE                     | 218 +-----
 .../taobao/weex/IWXActivityStateListener.java   | 220 +-----
 .../java/com/taobao/weex/IWXRenderListener.java | 220 +-----
 .../com/taobao/weex/IWXStatisticsListener.java  | 220 +-----
 .../main/java/com/taobao/weex/InitConfig.java   | 220 +-----
 .../java/com/taobao/weex/RenderContainer.java   | 220 +-----
 .../java/com/taobao/weex/WXEnvironment.java     | 220 +-----
 .../com/taobao/weex/WXGlobalEventModule.java    | 126 +---
 .../com/taobao/weex/WXGlobalEventReceiver.java  | 220 +-----
 .../java/com/taobao/weex/WXRenderErrorCode.java | 220 +-----
 .../main/java/com/taobao/weex/WXSDKEngine.java  | 129 +---
 .../java/com/taobao/weex/WXSDKInstance.java     | 220 +-----
 .../main/java/com/taobao/weex/WXSDKManager.java | 143 +---
 .../taobao/weex/adapter/DefaultUriAdapter.java  | 220 +-----
 .../weex/adapter/DefaultWXHttpAdapter.java      | 220 +-----
 .../taobao/weex/adapter/DrawableStrategy.java   | 218 +-----
 .../taobao/weex/adapter/IDrawableLoader.java    | 218 +-----
 .../taobao/weex/adapter/IWXDebugAdapter.java    | 220 +-----
 .../com/taobao/weex/adapter/IWXHttpAdapter.java | 220 +-----
 .../weex/adapter/IWXImgLoaderAdapter.java       | 220 +-----
 .../weex/adapter/IWXJSExceptionAdapter.java     | 220 +-----
 .../taobao/weex/adapter/IWXSoLoaderAdapter.java | 220 +-----
 .../weex/adapter/IWXUserTrackAdapter.java       | 220 +-----
 .../com/taobao/weex/adapter/URIAdapter.java     | 220 +-----
 .../com/taobao/weex/annotation/Component.java   | 220 +-----
 .../com/taobao/weex/annotation/JSMethod.java    | 220 +-----
 .../weex/appfram/clipboard/IWXClipboard.java    | 220 +-----
 .../appfram/clipboard/WXClipboardModule.java    | 220 +-----
 .../navigator/IActivityNavBarSetter.java        | 220 +-----
 .../appfram/navigator/WXNavigatorModule.java    | 126 +---
 .../weex/appfram/pickers/DatePickerImpl.java    | 220 +-----
 .../weex/appfram/pickers/WXPickersModule.java   | 220 +-----
 .../weex/appfram/storage/DefaultWXStorage.java  | 220 +-----
 .../taobao/weex/appfram/storage/IWXStorage.java | 220 +-----
 .../weex/appfram/storage/IWXStorageAdapter.java | 220 +-----
 .../appfram/storage/StorageResultHandler.java   | 220 +-----
 .../appfram/storage/WXSQLiteOpenHelper.java     | 220 +-----
 .../weex/appfram/storage/WXStorageModule.java   | 220 +-----
 .../appfram/websocket/IWebSocketAdapter.java    | 220 +-----
 .../websocket/IWebSocketAdapterFactory.java     | 220 +-----
 .../appfram/websocket/WebSocketCloseCodes.java  | 220 +-----
 .../weex/appfram/websocket/WebSocketModule.java | 220 +-----
 .../java/com/taobao/weex/bridge/Invoker.java    | 220 +-----
 .../java/com/taobao/weex/bridge/JSCallback.java | 220 +-----
 .../taobao/weex/bridge/JavascriptInvokable.java | 220 +-----
 .../com/taobao/weex/bridge/MethodInvoker.java   | 220 +-----
 .../com/taobao/weex/bridge/ModuleFactory.java   | 220 +-----
 .../taobao/weex/bridge/NativeInvokeHelper.java  | 220 +-----
 .../taobao/weex/bridge/SimpleJSCallback.java    | 220 +-----
 .../java/com/taobao/weex/bridge/WXBridge.java   | 220 +-----
 .../com/taobao/weex/bridge/WXBridgeManager.java | 220 +-----
 .../java/com/taobao/weex/bridge/WXHashMap.java  | 220 +-----
 .../java/com/taobao/weex/bridge/WXJSObject.java | 220 +-----
 .../com/taobao/weex/bridge/WXModuleManager.java | 220 +-----
 .../java/com/taobao/weex/bridge/WXParams.java   | 143 +---
 .../taobao/weex/bridge/WXServiceManager.java    | 220 +-----
 .../java/com/taobao/weex/bridge/WXTask.java     | 220 +-----
 .../taobao/weex/bridge/WXValidateProcessor.java | 220 +-----
 .../java/com/taobao/weex/common/Constants.java  | 220 +-----
 .../com/taobao/weex/common/Destroyable.java     | 220 +-----
 .../java/com/taobao/weex/common/IWXBridge.java  | 220 +-----
 .../com/taobao/weex/common/IWXDebugProxy.java   | 220 +-----
 .../java/com/taobao/weex/common/IWXObject.java  | 220 +-----
 .../java/com/taobao/weex/common/IWXTask.java    | 220 +-----
 .../taobao/weex/common/OnWXScrollListener.java  | 143 +---
 .../taobao/weex/common/TypeModuleFactory.java   | 220 +-----
 .../com/taobao/weex/common/WXCompatModule.java  | 220 +-----
 .../java/com/taobao/weex/common/WXConfig.java   | 220 +-----
 .../com/taobao/weex/common/WXErrorCode.java     | 220 +-----
 .../com/taobao/weex/common/WXException.java     | 220 +-----
 .../com/taobao/weex/common/WXImageSharpen.java  | 220 +-----
 .../com/taobao/weex/common/WXImageStrategy.java | 222 +-----
 .../com/taobao/weex/common/WXInstanceWrap.java  | 220 +-----
 .../taobao/weex/common/WXJSBridgeMsgType.java   | 220 +-----
 .../taobao/weex/common/WXJSEngineListener.java  | 220 +-----
 .../taobao/weex/common/WXJSExceptionInfo.java   | 220 +-----
 .../com/taobao/weex/common/WXJSService.java     | 220 +-----
 .../java/com/taobao/weex/common/WXModule.java   | 220 +-----
 .../com/taobao/weex/common/WXModuleAnno.java    | 222 +-----
 .../com/taobao/weex/common/WXPerformance.java   | 222 +-----
 .../com/taobao/weex/common/WXRefreshData.java   | 220 +-----
 .../taobao/weex/common/WXRenderStrategy.java    | 223 +-----
 .../java/com/taobao/weex/common/WXRequest.java  | 220 +-----
 .../taobao/weex/common/WXRequestListener.java   | 220 +-----
 .../java/com/taobao/weex/common/WXResponse.java | 220 +-----
 .../taobao/weex/common/WXRuntimeException.java  | 220 +-----
 .../java/com/taobao/weex/common/WXThread.java   | 220 +-----
 .../com/taobao/weex/dom/ApplyStyleConsumer.java | 220 +-----
 .../taobao/weex/dom/BasicEditTextDomObject.java | 220 +-----
 .../com/taobao/weex/dom/CSSAlignConvert.java    | 220 +-----
 .../weex/dom/CSSFlexDirectionConvert.java       | 220 +-----
 .../com/taobao/weex/dom/CSSJustifyConvert.java  | 220 +-----
 .../taobao/weex/dom/CSSPositionTypeConvert.java | 220 +-----
 .../com/taobao/weex/dom/CSSWrapConvert.java     | 220 +-----
 .../java/com/taobao/weex/dom/DOMAction.java     | 220 +-----
 .../com/taobao/weex/dom/DOMActionContext.java   | 220 +-----
 .../taobao/weex/dom/DOMActionContextImpl.java   | 220 +-----
 .../java/com/taobao/weex/dom/DomContext.java    | 220 +-----
 .../com/taobao/weex/dom/ImmutableDomObject.java | 220 +-----
 .../java/com/taobao/weex/dom/RenderAction.java  | 220 +-----
 .../taobao/weex/dom/RenderActionContext.java    | 220 +-----
 .../com/taobao/weex/dom/RenderActionTask.java   | 220 +-----
 .../weex/dom/SafePutConcurrentHashMap.java      | 220 +-----
 .../weex/dom/TextAreaEditTextDomObject.java     | 220 +-----
 .../main/java/com/taobao/weex/dom/WXAttr.java   | 220 +-----
 .../com/taobao/weex/dom/WXCustomStyleSpan.java  | 220 +-----
 .../java/com/taobao/weex/dom/WXDomHandler.java  | 220 +-----
 .../java/com/taobao/weex/dom/WXDomManager.java  | 220 +-----
 .../java/com/taobao/weex/dom/WXDomModule.java   | 220 +-----
 .../java/com/taobao/weex/dom/WXDomObject.java   | 220 +-----
 .../com/taobao/weex/dom/WXDomObjectFactory.java | 220 +-----
 .../java/com/taobao/weex/dom/WXDomRegistry.java | 220 +-----
 .../java/com/taobao/weex/dom/WXDomTask.java     | 220 +-----
 .../main/java/com/taobao/weex/dom/WXEvent.java  | 220 +-----
 .../com/taobao/weex/dom/WXImageQuality.java     | 222 +-----
 .../com/taobao/weex/dom/WXLineHeightSpan.java   | 220 +-----
 .../com/taobao/weex/dom/WXListDomObject.java    | 220 +-----
 .../taobao/weex/dom/WXRecyclerDomObject.java    | 220 +-----
 .../taobao/weex/dom/WXScrollerDomObject.java    | 220 +-----
 .../main/java/com/taobao/weex/dom/WXStyle.java  | 220 +-----
 .../com/taobao/weex/dom/WXSwitchDomObject.java  | 220 +-----
 .../com/taobao/weex/dom/WXTextDomObject.java    | 220 +-----
 .../dom/action/AbstractAddElementAction.java    | 220 +-----
 .../dom/action/AbstractLayoutFinishAction.java  | 220 +-----
 .../java/com/taobao/weex/dom/action/Action.java | 220 +-----
 .../com/taobao/weex/dom/action/Actions.java     | 220 +-----
 .../weex/dom/action/AddElementAction.java       | 220 +-----
 .../taobao/weex/dom/action/AddEventAction.java  | 220 +-----
 .../taobao/weex/dom/action/AddRuleAction.java   | 220 +-----
 .../taobao/weex/dom/action/AnimationAction.java | 218 +-----
 .../weex/dom/action/CreateBodyAction.java       | 220 +-----
 .../weex/dom/action/CreateFinishAction.java     | 220 +-----
 .../weex/dom/action/GetComponentRectAction.java | 220 +-----
 .../weex/dom/action/InvokeMethodAction.java     | 220 +-----
 .../weex/dom/action/MoveElementAction.java      | 220 +-----
 .../weex/dom/action/RefreshFinishAction.java    | 220 +-----
 .../weex/dom/action/RemoveElementAction.java    | 220 +-----
 .../weex/dom/action/RemoveEventAction.java      | 220 +-----
 .../weex/dom/action/ScrollToElementAction.java  | 220 +-----
 .../weex/dom/action/UpdateAttributeAction.java  | 220 +-----
 .../weex/dom/action/UpdateFinishAction.java     | 220 +-----
 .../weex/dom/action/UpdateStyleAction.java      | 220 +-----
 .../main/java/com/taobao/weex/http/Options.java | 220 +-----
 .../main/java/com/taobao/weex/http/Status.java  | 220 +-----
 .../java/com/taobao/weex/http/WXHttpUtil.java   | 220 +-----
 .../com/taobao/weex/http/WXStreamModule.java    | 220 +-----
 .../com/taobao/weex/ui/ComponentCreator.java    | 220 +-----
 .../weex/ui/ExternalLoaderComponentHolder.java  | 220 +-----
 .../weex/ui/IExternalComponentGetter.java       | 220 +-----
 .../taobao/weex/ui/IExternalMoudleGetter.java   | 220 +-----
 .../com/taobao/weex/ui/IFComponentHolder.java   | 220 +-----
 .../java/com/taobao/weex/ui/IWXRenderTask.java  | 220 +-----
 .../taobao/weex/ui/RenderActionContextImpl.java | 220 +-----
 .../taobao/weex/ui/SimpleComponentHolder.java   | 220 +-----
 .../com/taobao/weex/ui/WXComponentRegistry.java | 220 +-----
 .../com/taobao/weex/ui/WXRenderHandler.java     | 220 +-----
 .../com/taobao/weex/ui/WXRenderManager.java     | 220 +-----
 .../ui/animation/BackgroundColorProperty.java   | 218 +-----
 .../ui/animation/DimensionUpdateListener.java   | 218 +-----
 .../weex/ui/animation/WXAnimationBean.java      | 220 +-----
 .../weex/ui/animation/WXAnimationModule.java    | 220 +-----
 .../ui/component/AbstractEditComponent.java     | 222 +-----
 .../weex/ui/component/AppearanceHelper.java     | 220 +-----
 .../weex/ui/component/NestedContainer.java      | 220 +-----
 .../taobao/weex/ui/component/Scrollable.java    | 220 +-----
 .../com/taobao/weex/ui/component/Textarea.java  | 220 +-----
 .../java/com/taobao/weex/ui/component/WXA.java  | 220 +-----
 .../taobao/weex/ui/component/WXBaseRefresh.java | 220 +-----
 .../weex/ui/component/WXBasicComponentType.java | 221 +-----
 .../taobao/weex/ui/component/WXComponent.java   | 145 +---
 .../weex/ui/component/WXComponentFactory.java   | 220 +-----
 .../weex/ui/component/WXComponentProp.java      | 220 +-----
 .../com/taobao/weex/ui/component/WXDiv.java     | 220 +-----
 .../com/taobao/weex/ui/component/WXEmbed.java   | 222 +-----
 .../com/taobao/weex/ui/component/WXHeader.java  | 220 +-----
 .../com/taobao/weex/ui/component/WXImage.java   | 220 +-----
 .../taobao/weex/ui/component/WXIndicator.java   | 220 +-----
 .../com/taobao/weex/ui/component/WXInput.java   | 220 +-----
 .../com/taobao/weex/ui/component/WXLoading.java | 220 +-----
 .../weex/ui/component/WXLoadingIndicator.java   | 220 +-----
 .../com/taobao/weex/ui/component/WXRefresh.java | 220 +-----
 .../taobao/weex/ui/component/WXScroller.java    | 220 +-----
 .../com/taobao/weex/ui/component/WXSlider.java  | 220 +-----
 .../weex/ui/component/WXSliderNeighbor.java     | 220 +-----
 .../com/taobao/weex/ui/component/WXSwitch.java  | 220 +-----
 .../com/taobao/weex/ui/component/WXText.java    | 220 +-----
 .../weex/ui/component/WXTextDecoration.java     | 220 +-----
 .../taobao/weex/ui/component/WXVContainer.java  | 220 +-----
 .../com/taobao/weex/ui/component/WXVideo.java   | 220 +-----
 .../com/taobao/weex/ui/component/WXWeb.java     | 220 +-----
 .../component/helper/SoftKeyboardDetector.java  | 218 +-----
 .../ui/component/helper/WXStickyHelper.java     | 220 +-----
 .../ui/component/helper/WXTimeInputHelper.java  | 222 +-----
 .../ui/component/list/BasicListComponent.java   | 220 +-----
 .../component/list/HorizontalListComponent.java | 220 +-----
 .../ui/component/list/ListComponentView.java    | 220 +-----
 .../ui/component/list/SimpleListComponent.java  | 220 +-----
 .../ui/component/list/SimpleRecyclerView.java   | 220 +-----
 .../ui/component/list/StickyHeaderHelper.java   | 220 +-----
 .../taobao/weex/ui/component/list/WXCell.java   | 220 +-----
 .../weex/ui/component/list/WXListComponent.java | 220 +-----
 .../component/pesudo/OnActivePseudoListner.java | 220 +-----
 .../weex/ui/component/pesudo/PesudoStatus.java  | 220 +-----
 .../pesudo/TouchActivePseudoListener.java       | 220 +-----
 .../com/taobao/weex/ui/module/WXMetaModule.java | 220 +-----
 .../taobao/weex/ui/module/WXModalUIModule.java  | 222 +-----
 .../taobao/weex/ui/module/WXTimerModule.java    | 222 +-----
 .../taobao/weex/ui/module/WXWebViewModule.java  | 220 +-----
 .../com/taobao/weex/ui/view/IRenderStatus.java  | 218 +-----
 .../com/taobao/weex/ui/view/IWXScroller.java    | 220 +-----
 .../com/taobao/weex/ui/view/IWXTextView.java    | 220 +-----
 .../java/com/taobao/weex/ui/view/IWebView.java  | 220 +-----
 .../weex/ui/view/WXBaseCircleIndicator.java     | 222 +-----
 .../weex/ui/view/WXBaseRefreshLayout.java       | 220 +-----
 .../taobao/weex/ui/view/WXCircleIndicator.java  | 220 +-----
 .../weex/ui/view/WXCirclePageAdapter.java       | 220 +-----
 .../taobao/weex/ui/view/WXCircleViewPager.java  | 220 +-----
 .../com/taobao/weex/ui/view/WXEditText.java     | 220 +-----
 .../com/taobao/weex/ui/view/WXFrameLayout.java  | 220 +-----
 .../weex/ui/view/WXHorizontalScrollView.java    | 220 +-----
 .../com/taobao/weex/ui/view/WXImageView.java    | 220 +-----
 .../taobao/weex/ui/view/WXLoadingLayout.java    | 220 +-----
 .../taobao/weex/ui/view/WXRefreshLayout.java    | 220 +-----
 .../com/taobao/weex/ui/view/WXScrollView.java   | 220 +-----
 .../taobao/weex/ui/view/WXSmoothScroller.java   | 220 +-----
 .../com/taobao/weex/ui/view/WXSwitchView.java   | 220 +-----
 .../com/taobao/weex/ui/view/WXTextView.java     | 220 +-----
 .../com/taobao/weex/ui/view/WXVideoView.java    | 220 +-----
 .../java/com/taobao/weex/ui/view/WXWebView.java | 220 +-----
 .../weex/ui/view/border/BorderCorner.java       | 220 +-----
 .../weex/ui/view/border/BorderDrawable.java     | 222 +-----
 .../taobao/weex/ui/view/border/BorderEdge.java  | 220 +-----
 .../weex/ui/view/border/BorderRadiusType.java   | 218 +-----
 .../taobao/weex/ui/view/border/BorderStyle.java | 220 +-----
 .../taobao/weex/ui/view/border/BorderUtil.java  | 220 +-----
 .../view/border/BorderWidthStyleColorType.java  | 218 +-----
 .../weex/ui/view/border/BottomLeftCorner.java   | 220 +-----
 .../weex/ui/view/border/BottomRightCorner.java  | 220 +-----
 .../weex/ui/view/border/TopLeftCorner.java      | 220 +-----
 .../weex/ui/view/border/TopRightCorner.java     | 220 +-----
 .../taobao/weex/ui/view/gesture/WXGesture.java  | 229 +------
 .../ui/view/gesture/WXGestureObservable.java    | 220 +-----
 .../weex/ui/view/gesture/WXGestureType.java     | 220 +-----
 .../listview/ExtendedLinearLayoutManager.java   | 220 +-----
 .../weex/ui/view/listview/WXRecyclerView.java   | 220 +-----
 .../listview/adapter/IOnLoadMoreListener.java   | 220 +-----
 .../adapter/IRecyclerAdapterListener.java       | 220 +-----
 .../listview/adapter/ListBaseViewHolder.java    | 220 +-----
 .../adapter/RecyclerViewBaseAdapter.java        | 222 +-----
 .../adapter/TransformItemDecoration.java        | 220 +-----
 .../adapter/WXRecyclerViewOnScrollListener.java | 220 +-----
 .../refresh/circlebar/CircleProgressBar.java    | 222 +-----
 .../circlebar/MaterialProgressDrawable.java     | 222 +-----
 .../ui/view/refresh/core/WXRefreshView.java     | 220 +-----
 .../ui/view/refresh/core/WXSwipeLayout.java     | 220 +-----
 .../ui/view/refresh/wrapper/BaseBounceView.java | 220 +-----
 .../refresh/wrapper/BounceRecyclerView.java     | 220 +-----
 .../refresh/wrapper/BounceScrollerView.java     | 220 +-----
 .../java/com/taobao/weex/utils/ATagUtil.java    | 218 +-----
 .../main/java/com/taobao/weex/utils/FontDO.java | 222 +-----
 .../com/taobao/weex/utils/FunctionParser.java   | 220 +-----
 .../com/taobao/weex/utils/ImageDrawable.java    | 218 +-----
 .../java/com/taobao/weex/utils/ImgURIUtil.java  | 218 +-----
 .../java/com/taobao/weex/utils/LogLevel.java    | 220 +-----
 .../java/com/taobao/weex/utils/OsVersion.java   | 220 +-----
 .../taobao/weex/utils/SingleFunctionParser.java | 218 +-----
 .../main/java/com/taobao/weex/utils/Trace.java  | 220 +-----
 .../com/taobao/weex/utils/TypefaceUtil.java     | 220 +-----
 .../taobao/weex/utils/WXDataStructureUtil.java  | 220 +-----
 .../java/com/taobao/weex/utils/WXDomUtils.java  | 218 +-----
 .../java/com/taobao/weex/utils/WXFileUtils.java | 220 +-----
 .../com/taobao/weex/utils/WXInterception.java   | 220 +-----
 .../java/com/taobao/weex/utils/WXJsonUtils.java | 220 +-----
 .../java/com/taobao/weex/utils/WXLogUtils.java  | 126 +---
 .../taobao/weex/utils/WXReflectionUtils.java    | 220 +-----
 .../com/taobao/weex/utils/WXResourceUtils.java  | 220 +-----
 .../taobao/weex/utils/WXSoInstallMgrSdk.java    | 220 +-----
 .../java/com/taobao/weex/utils/WXUtils.java     | 220 +-----
 .../java/com/taobao/weex/utils/WXViewUtils.java | 220 +-----
 .../taobao/weex/utils/batch/BactchExecutor.java | 220 +-----
 .../weex/utils/batch/BatchOperationHelper.java  | 220 +-----
 .../taobao/weex/utils/batch/Interceptor.java    | 220 +-----
 .../test/java/com/taobao/weex/TestActivity.java | 220 +-----
 .../java/com/taobao/weex/TestApplication.java   | 220 +-----
 .../java/com/taobao/weex/WXSDKEngineTest.java   | 222 +-----
 .../java/com/taobao/weex/WXSDKInstanceTest.java | 222 +-----
 .../java/com/taobao/weex/WXSDKManagerTest.java  | 222 +-----
 .../weex/adapter/DefaultUriAdapterTest.java     | 222 +-----
 .../clipboard/WXClipboardModuleTest.java        | 222 +-----
 .../navigator/WXNavigatorModuleTest.java        | 222 +-----
 .../appfram/storage/DefaultWXStorageTest.java   | 222 +-----
 .../appfram/storage/WXStorageModuleTest.java    | 222 +-----
 .../taobao/weex/bridge/WXBridgeManagerTest.java | 222 +-----
 .../com/taobao/weex/bridge/WXBridgeTest.java    | 222 +-----
 .../com/taobao/weex/bridge/WXHashMapTest.java   | 220 +-----
 .../taobao/weex/bridge/WXModuleManagerTest.java | 222 +-----
 .../java/com/taobao/weex/common/TestModule.java | 220 +-----
 .../taobao/weex/common/TestModuleFactory.java   | 220 +-----
 .../com/taobao/weex/common/WXModuleTest.java    | 222 +-----
 .../java/com/taobao/weex/dom/TestDomObject.java | 220 +-----
 .../java/com/taobao/weex/dom/WXAttrTest.java    | 222 +-----
 .../com/taobao/weex/dom/WXDomManagerTest.java   | 222 +-----
 .../com/taobao/weex/dom/WXDomModuleTest.java    | 222 +-----
 .../com/taobao/weex/dom/WXDomObjectTest.java    | 222 +-----
 .../com/taobao/weex/dom/WXDomStatementTest.java | 222 +-----
 .../java/com/taobao/weex/dom/WXStyleTest.java   | 220 +-----
 .../taobao/weex/dom/WXTextDomObjectTest.java    | 222 +-----
 .../com/taobao/weex/dom/action/TestActions.java |  18 +
 .../taobao/weex/http/WXStreamModuleTest.java    | 220 +-----
 .../com/taobao/weex/ui/ComponentHolderTest.java | 222 +-----
 .../taobao/weex/ui/WXRenderStatementTest.java   | 222 +-----
 .../ui/animation/WXAnimationModuleTest.java     | 222 +-----
 .../taobao/weex/ui/component/ComponentTest.java | 220 +-----
 .../weex/ui/component/EditComponentTest.java    | 222 +-----
 .../taobao/weex/ui/component/TestComponent.java | 220 +-----
 .../taobao/weex/ui/component/TestConstants.java | 220 +-----
 .../taobao/weex/ui/component/TextareaTest.java  | 222 +-----
 .../weex/ui/component/WXComponentTest.java      | 222 +-----
 .../com/taobao/weex/ui/component/WXDivTest.java | 222 +-----
 .../taobao/weex/ui/component/WXEmbedTest.java   | 222 +-----
 .../taobao/weex/ui/component/WXHeaderTest.java  | 222 +-----
 .../taobao/weex/ui/component/WXImageTest.java   | 128 +---
 .../taobao/weex/ui/component/WXLoadingTest.java | 222 +-----
 .../taobao/weex/ui/component/WXRefreshTest.java | 222 +-----
 .../weex/ui/component/WXScrollerTest.java       | 222 +-----
 .../weex/ui/component/WXSliderNeighborTest.java | 222 +-----
 .../taobao/weex/ui/component/WXSliderTest.java  | 222 +-----
 .../taobao/weex/ui/component/WXSwitchTest.java  | 222 +-----
 .../taobao/weex/ui/component/WXTextTest.java    | 222 +-----
 .../taobao/weex/ui/component/WXVideoTest.java   | 222 +-----
 .../com/taobao/weex/ui/component/WXWebTest.java | 222 +-----
 .../component/helper/WXTimeInputHelperTest.java | 220 +-----
 .../ui/component/list/WXListComponentTest.java  | 222 +-----
 .../taobao/weex/ui/module/WXMetaModuleTest.java | 222 +-----
 .../weex/ui/module/WXModalUIModuleTest.java     | 222 +-----
 .../weex/ui/module/WXTimerModuleTest.java       | 222 +-----
 .../weex/ui/module/WXWebViewModuleTest.java     | 222 +-----
 .../weex/ui/view/WXCirclePageAdapterTest.java   | 222 +-----
 .../taobao/weex/ui/view/WXScrollViewTest.java   | 222 +-----
 .../com/taobao/weex/ui/view/WXWebViewTest.java  | 222 +-----
 .../weex/ui/view/border/BorderCornerTest.java   | 220 +-----
 .../weex/ui/view/border/BorderDrawableTest.java | 220 +-----
 .../weex/ui/view/gesture/WXGestureTest.java     | 222 +-----
 .../taobao/weex/utils/FunctionParserTest.java   | 222 +-----
 .../com/taobao/weex/utils/TypefaceUtilTest.java | 222 +-----
 .../com/taobao/weex/utils/WXFileUtilsTest.java  | 222 +-----
 .../com/taobao/weex/utils/WXJsonUtilsTest.java  | 222 +-----
 .../com/taobao/weex/utils/WXLogUtilsTest.java   | 222 +-----
 .../weex/utils/WXReflectionUtilsTest.java       | 222 +-----
 .../taobao/weex/utils/WXResourceUtilsTest.java  | 220 +-----
 .../java/com/taobao/weex/utils/WXUtilsTest.java | 222 +-----
 .../configuration/MockitoConfiguration.java     | 220 +-----
 .../java/com/taobao/weex/ApplicationTest.java   |  20 +-
 .../main/java/com/taobao/weex/WXDebugTool.java  |  18 +
 .../java/com/taobao/weex/WXPFComponent.java     |  18 +
 .../main/java/com/taobao/weex/WXPrettyFish.java |  18 +
 .../taobao/weex/adapter/DefautDebugAdapter.java |  18 +
 .../taobao/weex/bridge/WXWebsocketBridge.java   | 220 +-----
 .../taobao/weex/scalpel/ScalpelFrameLayout.java |  18 +
 .../weex/websocket/WXWebSocketManager.java      | 126 +---
 .../java/com/taobao/weex/ExampleUnitTest.java   |  20 +-
 dangerfile.js                                   |  21 +-
 html5/frameworks/index.js                       |  18 +
 html5/frameworks/legacy/api/methods.js          |  18 +
 html5/frameworks/legacy/api/modules.js          |  18 +
 html5/frameworks/legacy/app/bundle/bootstrap.js |  18 +
 html5/frameworks/legacy/app/bundle/define.js    |  18 +
 html5/frameworks/legacy/app/bundle/index.js     |  18 +
 html5/frameworks/legacy/app/ctrl/index.js       |  18 +
 html5/frameworks/legacy/app/ctrl/init.js        |  18 +
 html5/frameworks/legacy/app/ctrl/misc.js        |  18 +
 html5/frameworks/legacy/app/differ.js           |  18 +
 html5/frameworks/legacy/app/downgrade.js        |  18 +
 html5/frameworks/legacy/app/index.js            |  18 +
 html5/frameworks/legacy/app/instance.js         |  18 +
 html5/frameworks/legacy/app/register.js         |  18 +
 html5/frameworks/legacy/app/viewport.js         |  18 +
 html5/frameworks/legacy/config.js               |  19 +
 html5/frameworks/legacy/core/array.js           |  19 +
 html5/frameworks/legacy/core/dep.js             |  19 +
 html5/frameworks/legacy/core/object.js          |  19 +
 html5/frameworks/legacy/core/observer.js        |  19 +
 html5/frameworks/legacy/core/state.js           |  19 +
 html5/frameworks/legacy/core/watcher.js         |  19 +
 html5/frameworks/legacy/index.js                |  18 +
 html5/frameworks/legacy/static/bridge.js        |  18 +
 html5/frameworks/legacy/static/create.js        |  18 +
 html5/frameworks/legacy/static/life.js          |  18 +
 html5/frameworks/legacy/static/map.js           |  18 +
 html5/frameworks/legacy/static/misc.js          |  18 +
 html5/frameworks/legacy/static/register.js      |  18 +
 html5/frameworks/legacy/util/index.js           |  18 +
 html5/frameworks/legacy/util/shared.js          |  18 +
 html5/frameworks/legacy/vm/compiler.js          |  18 +
 html5/frameworks/legacy/vm/directive.js         |  18 +
 html5/frameworks/legacy/vm/dom-helper.js        |  18 +
 html5/frameworks/legacy/vm/events.js            |  18 +
 html5/frameworks/legacy/vm/index.js             |  18 +
 html5/frameworks/vanilla/index.js               |  18 +
 html5/render/browser/base/atomic.js             |  18 +
 html5/render/browser/base/component/flexbox.js  |  18 +
 html5/render/browser/base/component/index.js    |  18 +
 html5/render/browser/base/component/lazyload.js |  19 +
 html5/render/browser/base/component/operate.js  |  18 +
 html5/render/browser/base/component/position.js |  18 +
 html5/render/browser/base/component/sticky.js   |  18 +
 .../browser/base/component/valueFilter.js       |  18 +
 html5/render/browser/base/div.js                |  18 +
 html5/render/browser/base/droot.js              |  18 +
 html5/render/browser/base/moduleEvent.js        |  18 +
 html5/render/browser/base/root.js               |  18 +
 html5/render/browser/bridge/index.js            |  18 +
 html5/render/browser/bridge/protocol.js         |  18 +
 html5/render/browser/bridge/receiver.js         |  18 +
 html5/render/browser/bridge/sender.js           |  18 +
 html5/render/browser/dom/appearWatcher.js       |  18 +
 html5/render/browser/dom/componentManager.js    |  18 +
 html5/render/browser/dom/index.js               |  18 +
 .../browser/extend/api/animation/index.js       |  18 +
 .../render/browser/extend/api/animation/lib.js  |  18 +
 html5/render/browser/extend/api/clipboard.js    |  18 +
 html5/render/browser/extend/api/dom.js          |  18 +
 html5/render/browser/extend/api/event.js        |  18 +
 html5/render/browser/extend/api/geolocation.js  |  18 +
 html5/render/browser/extend/api/globalEvent.js  |  18 +
 html5/render/browser/extend/api/meta.js         |  18 +
 html5/render/browser/extend/api/modal.js        |  18 +
 html5/render/browser/extend/api/navigator.js    |  18 +
 html5/render/browser/extend/api/pageInfo.js     |  18 +
 html5/render/browser/extend/api/storage.js      |  19 +
 html5/render/browser/extend/api/stream.js       |  18 +
 html5/render/browser/extend/api/timer.js        |  19 +-
 html5/render/browser/extend/api/webSocket.js    |  20 +
 html5/render/browser/extend/api/webview.js      |  18 +
 html5/render/browser/extend/components/a.js     |  18 +
 .../browser/extend/components/countdown.js      |  18 +
 .../browser/extend/components/datepicker.js     |  18 +
 html5/render/browser/extend/components/embed.js |  18 +
 .../browser/extend/components/image/index.js    |  19 +
 .../extend/components/indicator/index.js        |  18 +
 html5/render/browser/extend/components/input.js |  18 +
 .../render/browser/extend/components/marquee.js |  18 +
 .../browser/extend/components/neighbor/index.js |  18 +
 .../browser/extend/components/richtext.js       |  18 +
 .../extend/components/scrollable/index.js       |  18 +
 .../extend/components/scrollable/list/hlist.js  |  18 +
 .../extend/components/scrollable/list/index.js  |  18 +
 .../extend/components/scrollable/list/list.js   |  18 +
 .../extend/components/scrollable/list/vlist.js  |  18 +
 .../components/scrollable/loading/index.js      |  18 +
 .../extend/components/scrollable/motion.js      |  19 +
 .../components/scrollable/refresh/index.js      |  18 +
 .../extend/components/scrollable/scroll.js      |  19 +
 .../extend/components/scrollable/scrollable.js  |  19 +
 .../components/scrollable/scroller/index.js     |  18 +
 .../render/browser/extend/components/select.js  |  18 +
 .../extend/components/slider/carrousel.js       |  19 +
 .../browser/extend/components/slider/index.js   |  18 +
 .../browser/extend/components/slider/timer.js   |  19 +
 .../browser/extend/components/spinner/index.js  |  18 +
 .../browser/extend/components/switch/index.js   |  18 +
 .../extend/components/tabheader/index.js        |  18 +
 html5/render/browser/extend/components/text.js  |  18 +
 .../browser/extend/components/textarea.js       |  18 +
 .../browser/extend/components/timepicker.js     |  18 +
 .../browser/extend/components/video/index.js    |  18 +
 html5/render/browser/extend/components/web.js   |  18 +
 html5/render/browser/extend/index.js            |  18 +
 html5/render/browser/index.js                   |  18 +
 html5/render/browser/render/config.js           |  18 +
 html5/render/browser/render/gesture.js          |  18 +
 html5/render/browser/render/index.js            |  19 +
 html5/render/browser/render/loader.js           |  19 +
 html5/render/browser/render/register.js         |  18 +
 html5/render/browser/utils/array.js             |  18 +
 html5/render/browser/utils/index.js             |  20 +
 html5/render/browser/utils/logger.js            |  20 +-
 html5/render/native/index.js                    |  18 +
 html5/render/vue/components/a.js                |  19 +-
 html5/render/vue/components/div.js              |  19 +-
 html5/render/vue/components/image.js            |  19 +
 html5/render/vue/components/index.js            |  18 +
 html5/render/vue/components/input.js            |  19 +
 .../render/vue/components/scrollable/header.js  |  19 +-
 .../vue/components/scrollable/list/cell.js      |  19 +-
 .../vue/components/scrollable/list/index.js     |  18 +
 .../vue/components/scrollable/list/listMixin.js |  18 +
 .../components/scrollable/loading-indicator.js  |  18 +
 .../render/vue/components/scrollable/loading.js |  18 +
 .../render/vue/components/scrollable/refresh.js |  18 +
 .../vue/components/scrollable/scroller.js       |  18 +
 html5/render/vue/components/slider/index.js     |  19 +-
 html5/render/vue/components/slider/indicator.js |  18 +
 .../render/vue/components/slider/slideMixin.js  |  18 +
 html5/render/vue/components/switch.js           |  19 +-
 html5/render/vue/components/text.js             |  19 +
 html5/render/vue/components/textarea.js         |  18 +
 html5/render/vue/components/video.js            |  19 +-
 html5/render/vue/components/warning.js          |  18 +
 html5/render/vue/components/web.js              |  18 +
 html5/render/vue/env/index.js                   |  18 +
 html5/render/vue/env/viewport.js                |  20 +
 html5/render/vue/env/weex.js                    |  19 +
 html5/render/vue/env/wx-env.js                  |  18 +
 html5/render/vue/index.js                       |  19 +-
 html5/render/vue/mixins/base.js                 |  18 +
 html5/render/vue/mixins/index.js                |  18 +
 html5/render/vue/mixins/input-common.js         |  19 +
 html5/render/vue/mixins/scrollable.js           |  18 +
 html5/render/vue/mixins/style.js                |  18 +
 html5/render/vue/modules/animation.js           |  18 +
 html5/render/vue/modules/dom.js                 |  18 +
 html5/render/vue/modules/index.js               |  20 +
 html5/render/vue/modules/modal/alert.js         |  18 +
 html5/render/vue/modules/modal/confirm.js       |  18 +
 html5/render/vue/modules/modal/index.js         |  18 +
 html5/render/vue/modules/modal/modal.js         |  18 +
 html5/render/vue/modules/modal/prompt.js        |  18 +
 html5/render/vue/modules/modal/toast.js         |  18 +
 html5/render/vue/modules/navigator.js           |  19 +
 html5/render/vue/modules/webview.js             |  19 +
 html5/render/vue/utils/component.js             |  18 +
 html5/render/vue/utils/event.js                 |  19 +-
 html5/render/vue/utils/func.js                  |  19 +
 html5/render/vue/utils/index.js                 |  18 +
 html5/render/vue/utils/lazyload.js              |  19 +
 html5/render/vue/utils/perf.js                  |  19 +
 html5/render/vue/utils/style.js                 |  19 +
 html5/render/vue/utils/type.js                  |  19 +
 html5/render/vue/validator/check.js             |  18 +
 html5/render/vue/validator/index.js             |  18 +
 html5/render/vue/validator/prop.js              |  18 +
 html5/render/vue/validator/style.js             |  18 +
 html5/runtime/callback-manager.js               |  19 +
 html5/runtime/config.js                         |  18 +
 html5/runtime/handler.js                        |  19 +
 html5/runtime/index.js                          |  19 +
 html5/runtime/init.js                           |  18 +
 html5/runtime/listener.js                       |  19 +
 html5/runtime/service.js                        |  19 +
 html5/runtime/task-center.js                    |  18 +
 html5/runtime/vdom/comment.js                   |  19 +
 html5/runtime/vdom/document.js                  |  19 +
 html5/runtime/vdom/element-types.js             |  18 +
 html5/runtime/vdom/element.js                   |  19 +
 html5/runtime/vdom/index.js                     |  18 +
 html5/runtime/vdom/node.js                      |  19 +
 html5/runtime/vdom/operation.js                 |  18 +
 html5/services/amd/index.js                     |  19 +
 html5/services/broadcast-channel/index.js       |  19 +
 .../services/broadcast-channel/message-event.js |  19 +
 html5/services/index.js                         |  18 +
 html5/shared/arrayFrom.js                       |  19 +
 html5/shared/console.js                         |  19 +
 html5/shared/freeze.js                          |  18 +
 html5/shared/index.js                           |  18 +
 html5/shared/objectAssign.js                    |  18 +
 html5/shared/objectSetPrototypeOf.js            |  19 +
 html5/shared/promise.js                         |  20 +
 html5/shared/setTimeout.js                      |  19 +
 ios/playground/WeexDemo/AppDelegate.h           |  23 +-
 ios/playground/WeexDemo/AppDelegate.m           |  23 +-
 .../WeexDemo/DemoBaseViewController.h           |  23 +-
 .../WeexDemo/DemoBaseViewController.m           |  23 +-
 ios/playground/WeexDemo/DemoDefine.h            |  23 +-
 ios/playground/WeexDemo/Scanner/WXScannerVC.h   |  25 +-
 ios/playground/WeexDemo/Scanner/WXScannerVC.m   |  23 +-
 ios/playground/WeexDemo/UIView+UIThreadCheck.h  |  23 +-
 ios/playground/WeexDemo/UIView+UIThreadCheck.m  |  23 +-
 .../WeexDemo/UIViewController+WXDemoNaviBar.h   |  23 +-
 .../WeexDemo/UIViewController+WXDemoNaviBar.m   |  23 +-
 ios/playground/WeexDemo/WXDemoViewController.h  |  23 +-
 ios/playground/WeexDemo/WXDemoViewController.m  |  23 +-
 ios/playground/WeexDemo/WXSyncTestModule.h      |  23 +-
 ios/playground/WeexDemo/WXSyncTestModule.m      |  23 +-
 .../WeexDemo/debug/WXATLoggerPlugin.h           |  23 +-
 .../WeexDemo/debug/WXATLoggerPlugin.m           |  23 +-
 .../WeexDemo/debug/WXATViewHierarchyPlugin.h    |  23 +-
 .../WeexDemo/debug/WXATViewHierarchyPlugin.m    |  23 +-
 .../extend/component/WXSelectComponent.h        |  23 +-
 .../extend/component/WXSelectComponent.m        |  23 +-
 .../extend/handler/WXImgLoaderDefaultImpl.h     |  23 +-
 .../extend/handler/WXImgLoaderDefaultImpl.m     |  23 +-
 .../WeexDemo/extend/module/WXEventModule.h      |  23 +-
 .../WeexDemo/extend/module/WXEventModule.m      |  23 +-
 ios/playground/WeexDemo/main.m                  |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/JSValue+Weex.h   |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/JSValue+Weex.m   |  23 +-
 .../WeexSDK/Sources/Bridge/WXBridgeContext.h    |  23 +-
 .../WeexSDK/Sources/Bridge/WXBridgeContext.m    |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.h |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXCallJSMethod.h |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXCallJSMethod.m |  23 +-
 .../WeexSDK/Sources/Bridge/WXComponentMethod.h  |  23 +-
 .../WeexSDK/Sources/Bridge/WXComponentMethod.m  |  23 +-
 .../Sources/Bridge/WXDebugLoggerBridge.h        |  23 +-
 .../Sources/Bridge/WXDebugLoggerBridge.m        |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.h |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.h |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXModuleMethod.m |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXPolyfillSet.h  |  23 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXPolyfillSet.m  |  23 +-
 .../Component/Recycler/WXMultiColumnLayout.h    |  23 +-
 .../Component/Recycler/WXMultiColumnLayout.m    |  23 +-
 .../Component/Recycler/WXRecyclerComponent.h    |  23 +-
 .../Component/Recycler/WXRecyclerComponent.m    |  23 +-
 .../Recycler/WXRecyclerDataController.h         |  23 +-
 .../Recycler/WXRecyclerDataController.m         |  23 +-
 .../Recycler/WXRecyclerUpdateController.h       |  23 +-
 .../Recycler/WXRecyclerUpdateController.m       |  23 +-
 .../Recycler/WXSectionDataController.h          |  23 +-
 .../Recycler/WXSectionDataController.m          |  23 +-
 .../WeexSDK/Sources/Component/WXAComponent.h    |  23 +-
 .../WeexSDK/Sources/Component/WXAComponent.m    |  23 +-
 .../Sources/Component/WXCanvasComponent.h       |  23 +-
 .../Sources/Component/WXCanvasComponent.m       |  23 +-
 .../WeexSDK/Sources/Component/WXCellComponent.h |  23 +-
 .../WeexSDK/Sources/Component/WXCellComponent.m |  23 +-
 .../Sources/Component/WXComponent_internal.h    |  23 +-
 .../WeexSDK/Sources/Component/WXDivComponent.h  |  23 +-
 .../WeexSDK/Sources/Component/WXDivComponent.m  |  23 +-
 .../WeexSDK/Sources/Component/WXEditComponent.h |  23 +-
 .../WeexSDK/Sources/Component/WXEditComponent.m |  23 +-
 .../Sources/Component/WXEmbedComponent.h        |  23 +-
 .../Sources/Component/WXEmbedComponent.m        |  23 +-
 .../Sources/Component/WXFooterComponent.h       |  23 +-
 .../Sources/Component/WXFooterComponent.m       |  23 +-
 .../Sources/Component/WXHeaderComponent.h       |  23 +-
 .../Sources/Component/WXHeaderComponent.m       |  23 +-
 .../Sources/Component/WXImageComponent.h        |  25 +-
 .../Sources/Component/WXImageComponent.m        |  23 +-
 .../Sources/Component/WXIndicatorComponent.h    |  23 +-
 .../Sources/Component/WXIndicatorComponent.m    |  23 +-
 .../WeexSDK/Sources/Component/WXListComponent.h |  23 +-
 .../WeexSDK/Sources/Component/WXListComponent.m |  23 +-
 .../Sources/Component/WXLoadingComponent.h      |  25 +-
 .../Sources/Component/WXLoadingComponent.m      |  18 +
 .../Sources/Component/WXLoadingIndicator.h      |  23 +-
 .../Sources/Component/WXLoadingIndicator.m      |  23 +-
 .../Sources/Component/WXRefreshComponent.h      |  23 +-
 .../Sources/Component/WXRefreshComponent.m      |  23 +-
 .../Sources/Component/WXScrollerComponent.h     |  23 +-
 .../Sources/Component/WXScrollerComponent.m     |  23 +-
 .../Sources/Component/WXSliderComponent.h       |  23 +-
 .../Sources/Component/WXSliderComponent.m       |  23 +-
 .../Component/WXSliderNeighborComponent.h       |  23 +-
 .../Component/WXSliderNeighborComponent.m       |  23 +-
 .../Sources/Component/WXSwitchComponent.h       |  23 +-
 .../Sources/Component/WXSwitchComponent.m       |  23 +-
 .../Sources/Component/WXTextAreaComponent.h     |  23 +-
 .../Sources/Component/WXTextAreaComponent.m     |  23 +-
 .../WeexSDK/Sources/Component/WXTextComponent.h |  23 +-
 .../WeexSDK/Sources/Component/WXTextComponent.m |  23 +-
 .../Sources/Component/WXTextInputComponent.h    |  23 +-
 .../Sources/Component/WXTextInputComponent.m    |  23 +-
 ios/sdk/WeexSDK/Sources/Component/WXTransform.h |  23 +-
 ios/sdk/WeexSDK/Sources/Component/WXTransform.m |  23 +-
 .../Sources/Component/WXVideoComponent.h        |  23 +-
 .../Sources/Component/WXVideoComponent.m        |  23 +-
 .../WeexSDK/Sources/Component/WXWebComponent.h  |  23 +-
 .../WeexSDK/Sources/Component/WXWebComponent.m  |  23 +-
 .../Sources/Controller/WXBaseViewController.h   |  23 +-
 .../Sources/Controller/WXBaseViewController.m   |  23 +-
 .../Sources/Controller/WXRootViewController.h   |  23 +-
 .../Sources/Controller/WXRootViewController.m   |  23 +-
 ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.h     |  23 +-
 ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.m     |  23 +-
 .../WeexSDK/Sources/Display/UIBezierPath+Weex.h |  23 +-
 .../WeexSDK/Sources/Display/UIBezierPath+Weex.m |  23 +-
 .../Sources/Display/WXComponent+BoxShadow.h     |  23 +-
 .../Sources/Display/WXComponent+BoxShadow.m     |  23 +-
 .../Sources/Display/WXComponent+Display.h       |  23 +-
 .../Sources/Display/WXComponent+Display.m       |  23 +-
 .../WeexSDK/Sources/Display/WXDisplayQueue.h    |  23 +-
 .../WeexSDK/Sources/Display/WXDisplayQueue.m    |  23 +-
 ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.h  |  23 +-
 ios/sdk/WeexSDK/Sources/Display/WXInnerLayer.m  |  23 +-
 ios/sdk/WeexSDK/Sources/Display/WXLayer.h       |  23 +-
 ios/sdk/WeexSDK/Sources/Display/WXLayer.m       |  23 +-
 ios/sdk/WeexSDK/Sources/Display/WXRoundedRect.h |  23 +-
 .../WeexSDK/Sources/Display/WXRoundedRect.mm    |  23 +-
 ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h    |  23 +-
 ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m    |  23 +-
 ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h     |  23 +-
 .../WeexSDK/Sources/Events/WXComponent+Events.h |  23 +-
 .../WeexSDK/Sources/Events/WXComponent+Events.m |  23 +-
 .../Sources/Handler/WXNavigationDefaultImpl.h   |  23 +-
 .../Sources/Handler/WXNavigationDefaultImpl.m   |  23 +-
 .../Sources/Handler/WXURLRewriteDefaultImpl.h   |  23 +-
 .../Sources/Handler/WXURLRewriteDefaultImpl.m   |  23 +-
 .../WeexSDK/Sources/Loader/WXResourceLoader.h   |  23 +-
 .../WeexSDK/Sources/Loader/WXResourceLoader.m   |  23 +-
 .../WeexSDK/Sources/Loader/WXWebSocketLoader.h  |  23 +-
 .../WeexSDK/Sources/Loader/WXWebSocketLoader.m  |  23 +-
 .../WeexSDK/Sources/Manager/WXBridgeManager.h   |  23 +-
 .../WeexSDK/Sources/Manager/WXBridgeManager.m   |  23 +-
 .../Sources/Manager/WXComponentFactory.h        |  23 +-
 .../Sources/Manager/WXComponentFactory.m        |  23 +-
 .../Sources/Manager/WXComponentManager.h        |  23 +-
 .../Sources/Manager/WXComponentManager.m        |  23 +-
 .../Sources/Manager/WXDatePickerManager.h       |  23 +-
 .../Sources/Manager/WXDatePickerManager.m       |  23 +-
 .../WeexSDK/Sources/Manager/WXHandlerFactory.h  |  23 +-
 .../WeexSDK/Sources/Manager/WXHandlerFactory.m  |  23 +-
 .../Sources/Manager/WXInvocationConfig.h        |  23 +-
 .../Sources/Manager/WXInvocationConfig.m        |  23 +-
 .../WeexSDK/Sources/Manager/WXModuleFactory.h   |  23 +-
 .../WeexSDK/Sources/Manager/WXModuleFactory.m   |  23 +-
 ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.h |  23 +-
 ios/sdk/WeexSDK/Sources/Manager/WXRuleManager.m |  23 +-
 ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h  |  23 +-
 ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.m  |  23 +-
 .../WeexSDK/Sources/Manager/WXServiceFactory.h  |  23 +-
 .../WeexSDK/Sources/Manager/WXServiceFactory.m  |  23 +-
 .../Sources/Model/WXComponent+Navigation.h      |  23 +-
 .../Sources/Model/WXComponent+Navigation.m      |  23 +-
 ios/sdk/WeexSDK/Sources/Model/WXComponent.h     |  23 +-
 ios/sdk/WeexSDK/Sources/Model/WXComponent.m     |  23 +-
 .../WeexSDK/Sources/Model/WXJSExceptionInfo.h   |  23 +-
 .../WeexSDK/Sources/Model/WXJSExceptionInfo.m   |  25 +-
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h   |  23 +-
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m   |  23 +-
 .../Sources/Model/WXSDKInstance_private.h       |  23 +-
 .../WeexSDK/Sources/Module/WXAnimationModule.h  |  23 +-
 .../WeexSDK/Sources/Module/WXAnimationModule.m  |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXCanvasModule.h |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXCanvasModule.m |  23 +-
 .../WeexSDK/Sources/Module/WXClipboardModule.h  |  23 +-
 .../WeexSDK/Sources/Module/WXClipboardModule.m  |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXDomModule.h    |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXDomModule.m    |  23 +-
 .../Sources/Module/WXGlobalEventModule.h        |  23 +-
 .../Sources/Module/WXGlobalEventModule.m        |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXInstanceWrap.h |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXInstanceWrap.m |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXMetaModule.h   |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXMetaModule.m   |  23 +-
 .../WeexSDK/Sources/Module/WXModalUIModule.h    |  23 +-
 .../WeexSDK/Sources/Module/WXModalUIModule.m    |  23 +-
 .../WeexSDK/Sources/Module/WXNavigatorModule.h  |  23 +-
 .../WeexSDK/Sources/Module/WXNavigatorModule.m  |  18 +
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.h |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m |  23 +-
 .../WeexSDK/Sources/Module/WXStorageModule.h    |  23 +-
 .../WeexSDK/Sources/Module/WXStorageModule.m    |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXStreamModule.h |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXTimerModule.h  |  23 +-
 ios/sdk/WeexSDK/Sources/Module/WXTimerModule.m  |  23 +-
 .../WeexSDK/Sources/Module/WXWebSocketModule.h  |  23 +-
 .../WeexSDK/Sources/Module/WXWebSocketModule.m  |  23 +-
 .../WeexSDK/Sources/Module/WXWebViewModule.h    |  23 +-
 .../WeexSDK/Sources/Module/WXWebViewModule.m    |  23 +-
 ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.h     |  23 +-
 ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m     |  23 +-
 .../WeexSDK/Sources/Network/WXResourceRequest.h |  23 +-
 .../WeexSDK/Sources/Network/WXResourceRequest.m |  23 +-
 .../Sources/Network/WXResourceRequestHandler.h  |  23 +-
 .../WXResourceRequestHandlerDefaultImpl.h       |  23 +-
 .../WXResourceRequestHandlerDefaultImpl.m       |  23 +-
 .../Sources/Network/WXResourceResponse.h        |  23 +-
 .../Sources/Network/WXResourceResponse.m        |  23 +-
 .../Sources/Protocol/WXAppMonitorProtocol.h     |  23 +-
 .../WeexSDK/Sources/Protocol/WXBridgeProtocol.h |  23 +-
 .../Sources/Protocol/WXDestroyProtocol.h        |  23 +-
 .../Sources/Protocol/WXEventModuleProtocol.h    |  23 +-
 .../Sources/Protocol/WXImgLoaderProtocol.h      |  23 +-
 .../Sources/Protocol/WXJSExceptionProtocol.h    |  23 +-
 .../WeexSDK/Sources/Protocol/WXModuleProtocol.h |  23 +-
 .../Sources/Protocol/WXNavigationProtocol.h     |  23 +-
 .../Sources/Protocol/WXNetworkProtocol.h        |  23 +-
 .../Sources/Protocol/WXScrollerProtocol.h       |  23 +-
 .../Sources/Protocol/WXTextComponentProtocol.h  |  23 +-
 .../Sources/Protocol/WXURLRewriteProtocol.h     |  23 +-
 .../Sources/Protocol/WXValidateProtocol.h       |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/NSArray+Weex.h  |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/NSArray+Weex.m  |  23 +-
 .../Sources/Utility/NSObject+WXSwizzle.h        |  23 +-
 .../Sources/Utility/NSObject+WXSwizzle.m        |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/NSTimer+Weex.h  |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/NSTimer+Weex.m  |  23 +-
 .../Sources/Utility/WXAppConfiguration.h        |  23 +-
 .../Sources/Utility/WXAppConfiguration.m        |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXAssert.h      |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXAssert.m      |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.h   |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXBoxShadow.m   |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.h     |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.m     |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXDefine.h      |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.h    |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXDiffUtil.m    |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXLength.h      |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXLength.m      |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXLog.h         |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXLog.m         |  23 +-
 .../Utility/WXSimulatorShortcutManager.h        |  23 +-
 .../Utility/WXSimulatorShortcutManager.m        |  23 +-
 .../Sources/Utility/WXThreadSafeCounter.h       |  23 +-
 .../Sources/Utility/WXThreadSafeCounter.m       |  23 +-
 .../Sources/Utility/WXThreadSafeMutableArray.h  |  23 +-
 .../Sources/Utility/WXThreadSafeMutableArray.m  |  23 +-
 .../Utility/WXThreadSafeMutableDictionary.h     |  23 +-
 .../Utility/WXThreadSafeMutableDictionary.m     |  25 +-
 ios/sdk/WeexSDK/Sources/Utility/WXType.h        |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.h     |  23 +-
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m     |  23 +-
 .../Sources/Utility/WXWeakObjectWrapper.h       |  23 +-
 .../Sources/Utility/WXWeakObjectWrapper.m       |  23 +-
 .../View/WXComponent+PseudoClassManagement.h    |  23 +-
 .../View/WXComponent+PseudoClassManagement.m    |  23 +-
 .../Sources/View/WXComponent+ViewManagement.h   |  23 +-
 .../Sources/View/WXComponent+ViewManagement.m   |  23 +-
 ios/sdk/WeexSDK/Sources/View/WXErrorView.h      |  23 +-
 ios/sdk/WeexSDK/Sources/View/WXErrorView.m      |  23 +-
 ios/sdk/WeexSDK/Sources/View/WXRootView.h       |  23 +-
 ios/sdk/WeexSDK/Sources/View/WXRootView.m       |  23 +-
 ios/sdk/WeexSDK/Sources/View/WXView.h           |  23 +-
 ios/sdk/WeexSDK/Sources/View/WXView.m           |  23 +-
 .../Sources/WebSocket/SRWebSocket+Weex.h        |  23 +-
 .../Sources/WebSocket/SRWebSocket+Weex.m        |  23 +-
 .../Sources/WebSocket/WXWebSocketDefaultImpl.h  |  23 +-
 .../Sources/WebSocket/WXWebSocketDefaultImpl.m  |  23 +-
 .../Sources/WebSocket/WXWebSocketHandler.h      |  23 +-
 ios/sdk/WeexSDK/Sources/WeexSDK.h               |  21 +-
 ios/sdk/WeexSDK_MTL/WeexSDK_MTL.h               |  23 +-
 ios/sdk/WeexSDK_MTL/WeexSDK_MTL.m               |  23 +-
 scripts/apache-rat-0.12.jar                     | Bin 0 -> 1592593 bytes
 scripts/rat-ant-build.xml                       |   8 +
 scripts/rat-scan.sh                             |   3 +
 scripts/replace-header.sh                       |   4 +
 scripts/rh/LICENSE                              | 674 +++++++++++++++++++
 scripts/rh/README                               |  46 ++
 scripts/rh/header.template                      |  18 +
 scripts/rh/remove_header.awk                    |  48 ++
 scripts/rh/replace_header.sh                    |  11 +
 898 files changed, 16251 insertions(+), 82937 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1e34a1fe/ios/playground/WeexDemo/AppDelegate.m
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1e34a1fe/ios/playground/WeexDemo/DemoDefine.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1e34a1fe/ios/playground/WeexDemo/Scanner/WXScannerVC.m
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1e34a1fe/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.m
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1e34a1fe/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------


[13/23] incubator-weex git commit: * [ios] fix text refactor mutli line bug

Posted by cx...@apache.org.
* [ios] fix text  refactor mutli line bug


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ade22d61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ade22d61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ade22d61

Branch: refs/heads/0.12-dev
Commit: ade22d61b6db98e1690e0c0b31349bfbae55febf
Parents: 60460c6
Author: acton393 <zh...@gmail.com>
Authored: Thu Apr 13 02:45:51 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Apr 13 02:45:51 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.m | 96 ++++++++++++--------
 1 file changed, 60 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ade22d61/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index 09e61e1..9df7fef 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -29,10 +29,7 @@
 #import <CoreText/CoreText.h>
 
 @interface WXText : UIView
-
 @property (nonatomic, strong) NSTextStorage *textStorage;
-@property (nonatomic, strong) NSMutableAttributedString * attributedString;
-
 @end
 
 @implementation WXText
@@ -63,13 +60,6 @@
     }
 }
 
-- (void)setAttributedString:(NSMutableAttributedString *)attributedString {
-    if (_attributedString != attributedString) {
-        _attributedString = attributedString;
-        [self.wx_component setNeedsDisplay];
-    }
-}
-
 - (NSString *)description
 {
     NSString *superDescription = super.description;
@@ -114,6 +104,8 @@ static BOOL textRenderUsingCoreText;
     WXTextDecoration _textDecoration;
     NSString *_textOverflow;
     CGFloat _lineHeight;
+    
+    CTFrameRef coretextFrameRef;
 }
 
 + (void)setRenderUsingCoreText:(BOOL)usingCoreText
@@ -154,9 +146,17 @@ static BOOL textRenderUsingCoreText;
     return self;
 }
 
+- (BOOL)useCoreText
+{
+    return (_coretext || [WXTextComponent textRenderUsingCoreText]);
+}
+
 - (void)dealloc
 {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
+    if (coretextFrameRef && CFGetRetainCount(coretextFrameRef)) {
+        CFRelease(coretextFrameRef);
+    }
 }
 
 #define WX_STYLE_FILL_TEXT(key, prop, type, needLayout)\
@@ -234,7 +234,6 @@ do {\
 - (void)viewDidLoad
 {
     ((WXText *)self.view).textStorage = _textStorage;
-    ((WXText *)self.view).attributedString = [self buildCTAttributeString];
     [self setNeedsDisplay];
 }
 
@@ -272,9 +271,9 @@ do {\
             NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
             computedSize = [layoutManager usedRectForTextContainer:textContainer].size;
         } else {
-            computedSize = [[weakSelf buildCTAttributeString] boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
+            computedSize = [weakSelf calculateTextHeightWithWidth:constrainedSize.width];
         }
-        
+    
         //TODO:more elegant way to use max and min constrained size
         if (!isnan(weakSelf.cssNode->style.minDimensions[CSS_WIDTH])) {
             computedSize.width = MAX(computedSize.width, weakSelf.cssNode->style.minDimensions[CSS_WIDTH]);
@@ -356,8 +355,6 @@ do {\
         [attributedString addAttribute:(id)kCTFontAttributeName value:(__bridge id)(ctFont) range:NSMakeRange(0, string.length)];
     }
     
-    CFRelease(ctFont);
-    
     if(_textDecoration == WXTextDecorationUnderline){
         [attributedString addAttribute:(id)kCTUnderlineStyleAttributeName value:@(kCTUnderlinePatternSolid | kCTUnderlineStyleSingle) range:NSMakeRange(0, string.length)];
     } else if(_textDecoration == WXTextDecorationLineThrough){
@@ -371,9 +368,10 @@ do {\
     }
     
     // set default lineBreakMode
-    paragraphStyle.lineBreakMode = NSLineBreakByClipping;
+    // TODO:default clip
+    paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
     if (_textOverflow && [_textOverflow length] > 0) {
-        if ([_textOverflow isEqualToString:@"ellipsis"])
+        if (_lines && [_textOverflow isEqualToString:@"ellipsis"])
             paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
     }
     
@@ -395,6 +393,7 @@ do {\
         }
     }
     
+    CFRelease(ctFont);
     
     return attributedString;
 }
@@ -463,7 +462,7 @@ do {\
 
 - (BOOL)adjustLineHeight
 {
-    return !(_coretext && [WXTextComponent textRenderUsingCoreText]);
+    return ![self useCoreText];
 }
 
 - (NSTextStorage *)textStorageWithWidth:(CGFloat)width
@@ -504,12 +503,9 @@ do {\
 {
     CGFloat width = self.calculatedFrame.size.width - (_padding.left + _padding.right);
     NSTextStorage *textStorage = [self textStorageWithWidth:width];
-    NSMutableAttributedString * attributedString = [self buildCTAttributeString];
-    
     [self.weexInstance.componentManager  _addUITask:^{
         if ([self isViewLoaded]) {
             ((WXText *)self.view).textStorage = textStorage;
-            ((WXText *)self.view).attributedString = attributedString;
             [self readyToRender]; // notify super component
             [self setNeedsDisplay];
         }
@@ -572,26 +568,21 @@ do {\
         CGContextTranslateCTM(context, 0, textFrame.size.height);
         CGContextScaleCTM(context, 1.0, -1.0);
         
+        NSMutableAttributedString * attributedStringCopy = [self buildCTAttributeString];
         //add path
         CGMutablePathRef path = CGPathCreateMutable();
         CGPathAddRect(path, NULL, textFrame);
-        NSMutableAttributedString * attributedStringCopy = [self buildCTAttributeString];
-        
         CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge  CFAttributedStringRef)attributedStringCopy);
-        CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
+         coretextFrameRef = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
         
-        CFArrayRef lines = CTFrameGetLines(frame);
+        CFArrayRef lines = CTFrameGetLines(coretextFrameRef);
         CFIndex lineCount = CFArrayGetCount(lines);
         CGPoint lineOrigins[lineCount];
-        CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), lineOrigins);
-        for (CFIndex index = 0; index < lineCount; index ++) {
-            CTLineRef lineRef = CFArrayGetValueAtIndex(lines, index);
-            CGFloat lineAscent;
-            CGFloat lineDescent;
-            CGFloat lineLeading;
+        CTFrameGetLineOrigins(coretextFrameRef, CFRangeMake(0, 0), lineOrigins);
+        for (CFIndex lineIndex = 0;(!_lines || _lines > lineIndex) && lineIndex < lineCount; lineIndex ++) {
             
-            CTLineGetTypographicBounds(lineRef, &lineAscent, &lineDescent, &lineLeading);
-            CGPoint lineOrigin = lineOrigins[index];
+            CTLineRef lineRef = CFArrayGetValueAtIndex(lines, lineIndex);
+            CGPoint lineOrigin = lineOrigins[lineIndex];
             lineOrigin.x += padding.left;
             lineOrigin.y -= padding.top;
             CGContextSetTextPosition(context, lineOrigin.x, lineOrigin.y);
@@ -621,15 +612,48 @@ do {\
                 
             }
         }
-        
-        CFRelease(frame);
         CFRelease(framesetter);
         CGPathRelease(path);
-        
         CGContextRestoreGState(context);
     }
 }
 
+- (CGSize)calculateTextHeightWithWidth:(CGFloat)aWidth
+{
+    if (isnan(aWidth)) {
+        aWidth = CGFLOAT_MAX;
+    }
+    NSAttributedString * attributedStringCpy = [self buildCTAttributeString];
+    CTFramesetterRef framesetterRef = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedStringCpy);
+    
+    CGSize suggestSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetterRef, CFRangeMake(0, attributedStringCpy.length), NULL, CGSizeMake(aWidth, MAXFLOAT), NULL);
+    
+    CGMutablePathRef path = CGPathCreateMutable();
+    CGPathAddRect(path, NULL, CGRectMake(0, 0, aWidth, suggestSize.height*10));
+    
+    CTFrameRef frameRef = CTFramesetterCreateFrame(framesetterRef, CFRangeMake(0, attributedStringCpy.length), path, NULL);
+    
+    CFArrayRef lines = CTFrameGetLines(frameRef);
+    CFIndex lineCount = CFArrayGetCount(lines);
+    CGFloat ascent = 0;
+    CGFloat descent = 0;
+    CGFloat leading = 0;
+    CGFloat totalHeight = 0;
+    // height = ascent + descent + lineCount*leading
+    // ignore linespaing
+    NSUInteger actualLineCount = 0;
+    for (CFIndex lineIndex = 0; (!_lines|| lineIndex < _lines) && lineIndex < lineCount; lineIndex ++)
+    {
+        CTLineRef lineRef = CFArrayGetValueAtIndex(lines, lineIndex);
+        CTLineGetTypographicBounds(lineRef, &ascent, &descent, &leading);
+        totalHeight += ascent + descent;
+        actualLineCount ++;
+    }
+    
+    totalHeight = totalHeight + actualLineCount*leading;
+    return CGSizeMake(suggestSize.width, totalHeight);
+}
+
 static void WXTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *underlinePosition, CGFloat *lineThickness) {
     CGFloat maxXHeight = 0;
     CGFloat maxUnderlinePos = 0;


[12/23] incubator-weex git commit: Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor

Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/60460c62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/60460c62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/60460c62

Branch: refs/heads/0.12-dev
Commit: 60460c62a69a0c329d96e4c94ff838df558cfbbe
Parents: a95a062 4c9e195
Author: acton393 <zh...@gmail.com>
Authored: Wed Apr 12 12:07:28 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Wed Apr 12 12:07:28 2017 +0800

----------------------------------------------------------------------
 DISCLAIMER                                      |   1 +
 LICENSE                                         |   2 +-
 .../java/com/taobao/weex/WXSDKInstance.java     |  25 ++++
 .../taobao/weex/dom/action/AnimationAction.java |   3 +-
 .../taobao/weex/ui/component/WXComponent.java   |  14 ++-
 .../com/taobao/weex/utils/WXResourceUtils.java  | 105 +++++++---------
 .../taobao/weex/utils/WXResourceUtilsTest.java  |  13 +-
 doc/source/cn/references/modules/modal.md       |   2 +
 doc/source/references/modules/modal.md          |   2 +
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m | 122 ++++++++++++++++++-
 ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m     |   6 +-
 test/run.sh                                     |   9 +-
 test/scripts/components/recycler.test.js        |   2 +-
 13 files changed, 222 insertions(+), 84 deletions(-)
----------------------------------------------------------------------



[06/23] incubator-weex git commit: Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor

Posted by cx...@apache.org.
Merge remote-tracking branch 'upstream/0.12-dev' into iOS-0.12-dev-text-refactor


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/01117b58
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/01117b58
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/01117b58

Branch: refs/heads/0.12-dev
Commit: 01117b58e258004f41764fbce7719c936748d9d3
Parents: ae6edee 2697555
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 11 11:38:05 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 11 11:38:05 2017 +0800

----------------------------------------------------------------------
 NOTICE                                            |  7 ++++---
 .../main/java/com/taobao/weex/WXEnvironment.java  | 18 +++++++++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------