You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by bo...@apache.org on 2017/04/18 10:50:53 UTC

[1/5] incubator-weex git commit: * [ios] draw ellipse and support letter-spacing

Repository: incubator-weex
Updated Branches:
  refs/heads/0.12-dev 24ef3af94 -> 90c358303


* [ios] draw ellipse  and support letter-spacing


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

Branch: refs/heads/0.12-dev
Commit: 242b1ec04c0153dffc472635a5ea507b98a133fc
Parents: 5ea9966
Author: acton393 <zh...@gmail.com>
Authored: Mon Apr 17 20:46:42 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Apr 17 20:46:42 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXTextComponent.h |   1 +
 .../WeexSDK/Sources/Component/WXTextComponent.m | 259 +++++++++++++++----
 2 files changed, 212 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/242b1ec0/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 627b774..e993366 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.h
@@ -22,4 +22,5 @@
 @interface WXTextComponent : WXComponent
 
 + (void)setRenderUsingCoreText:(BOOL)usingCoreText;
+- (BOOL)useCoreText;
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/242b1ec0/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 f9906ad..c4c8cd3 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -80,10 +80,13 @@
 
 @end
 
-static BOOL textRenderUsingCoreText = NO;
+static BOOL textRenderUsingCoreText = YES;
+
+NSString *const WXTextTruncationToken = @"\u2026";
+CGFloat WXTextDefaultLineThroughWidth = 1.2;
 
 @interface WXTextComponent()
-@property (nonatomic, assign)BOOL useCoreTextAttr;
+@property (nonatomic, assign) NSString *useCoreTextAttr;
 @end
 
 @implementation WXTextComponent
@@ -104,6 +107,8 @@ static BOOL textRenderUsingCoreText = NO;
     WXTextDecoration _textDecoration;
     NSString *_textOverflow;
     CGFloat _lineHeight;
+    CGFloat _letterSpacing;
+    BOOL _truncationLine; // support trunk tail
 }
 
 + (void)setRenderUsingCoreText:(BOOL)usingCoreText
@@ -127,9 +132,9 @@ static BOOL textRenderUsingCoreText = NO;
     if (self) {
         // just for coretext and textkit render replacement
         if ([attributes objectForKey:@"coretext"]) {
-            _useCoreTextAttr = [WXConvert BOOL:attributes[@"coretext"]];
+            _useCoreTextAttr = [WXConvert NSString:attributes[@"coretext"]];
         } else {
-            _useCoreTextAttr = NO;
+            _useCoreTextAttr = nil;
         }
         
         [self fillCSSStyles:styles];
@@ -141,9 +146,12 @@ static BOOL textRenderUsingCoreText = NO;
 
 - (BOOL)useCoreText
 {
-    if (_useCoreTextAttr) {
+    if ([_useCoreTextAttr isEqualToString:@"yes"]) {
         return YES;
     }
+    if ([_useCoreTextAttr isEqualToString:@"false"]) {
+        return NO;
+    }
     if ([WXTextComponent textRenderUsingCoreText]) {
         return YES;
     }
@@ -191,6 +199,7 @@ do {\
     WX_STYLE_FILL_TEXT(textDecoration, textDecoration, WXTextDecoration, YES)
     WX_STYLE_FILL_TEXT(textOverflow, textOverflow, NSString, NO)
     WX_STYLE_FILL_TEXT_PIXEL(lineHeight, lineHeight, YES)
+    WX_STYLE_FILL_TEXT_PIXEL(letterSpacing, letterSpacing, YES)
     
     UIEdgeInsets padding = {
         WXFloorPixelValue(self.cssNode->style.padding[CSS_TOP] + self.cssNode->style.border[CSS_TOP]),
@@ -229,7 +238,13 @@ do {\
 
 - (void)viewDidLoad
 {
-    ((WXText *)self.view).textStorage = _textStorage;
+    BOOL useCoreText = NO;
+    if ([self.view.wx_component isKindOfClass:NSClassFromString(@"WXTextComponent")] && [self.view.wx_component respondsToSelector:@selector(useCoreText)]) {
+        useCoreText = [(WXTextComponent*)self.view.wx_component useCoreText];
+    }
+    if (!useCoreText) {
+        ((WXText *)self.view).textStorage = _textStorage;
+    }
     [self setNeedsDisplay];
 }
 
@@ -363,11 +378,11 @@ do {\
     }
     
     // set default lineBreakMode
-    // TODO:default clip
     paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
+    _truncationLine = NO;
     if (_textOverflow && [_textOverflow length] > 0) {
         if (_lines && [_textOverflow isEqualToString:@"ellipsis"])
-            paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
+            _truncationLine = YES;
     }
     
     if (_lineHeight) {
@@ -380,6 +395,10 @@ do {\
                                  range:(NSRange){0, attributedString.length}];
     }
     
+    if (_letterSpacing) {
+        [attributedString addAttribute:NSKernAttributeName value:@(_letterSpacing) range:(NSRange){0, attributedString.length}];
+    }
+    
     if ([self adjustLineHeight]) {
         if (_lineHeight > font.lineHeight) {
             [attributedString addAttribute:NSBaselineOffsetAttributeName
@@ -497,10 +516,15 @@ do {\
 - (void)syncTextStorageForView
 {
     CGFloat width = self.calculatedFrame.size.width - (_padding.left + _padding.right);
-    NSTextStorage *textStorage = [self textStorageWithWidth:width];
+    NSTextStorage *textStorage = nil;
+    if (![self useCoreText]) {
+        textStorage = [self textStorageWithWidth:width];
+    }
     [self.weexInstance.componentManager  _addUITask:^{
         if ([self isViewLoaded]) {
-            ((WXText *)self.view).textStorage = textStorage;
+            if (![self useCoreText]) {
+                ((WXText *)self.view).textStorage = textStorage;
+            }
             [self readyToRender]; // notify super component
             [self setNeedsDisplay];
         }
@@ -553,7 +577,7 @@ do {\
         
         [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:textFrame.origin];
         [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:textFrame.origin];
-    }else {
+    } 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;
@@ -565,60 +589,191 @@ do {\
         
         NSMutableAttributedString * attributedStringCopy = [self buildCTAttributeString];
         //add path
-        CGPathRef path = NULL;
-        path = CGPathCreateWithRect(textFrame, NULL);
+        CGPathRef cgPath = NULL;
+        cgPath = 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;
+        CTFrameRef _coreTextFrameRef = NULL;
+        if (_coreTextFrameRef) {
+            CFRelease(_coreTextFrameRef);
+        }
+        _coreTextFrameRef = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), cgPath, NULL);
         CFRelease(framesetter);
         framesetter = NULL;
-        CFArrayRef lines = NULL;
-        lines = CTFrameGetLines(coretextFrameRef);
-        CFIndex lineCount = CFArrayGetCount(lines);
+        CFArrayRef ctLines = NULL;
+        ctLines = CTFrameGetLines(_coreTextFrameRef);
+        CFIndex lineCount = CFArrayGetCount(ctLines);
+        NSMutableArray * mutableLines = [NSMutableArray new];
         CGPoint lineOrigins[lineCount];
-        CTFrameGetLineOrigins(coretextFrameRef, CFRangeMake(0, 0), lineOrigins);
-        for (CFIndex lineIndex = 0;(!_lines || _lines > lineIndex) && lineIndex < lineCount; lineIndex ++) {
+        NSUInteger rowCount = 0;
+        BOOL needTruncation = NO;
+        CTLineRef ctTruncatedLine = NULL;
+        CTFrameGetLineOrigins(_coreTextFrameRef, CFRangeMake(0, 0), lineOrigins);
+        for (CFIndex lineIndex = 0;(!_lines || _lines >= lineIndex) && lineIndex < lineCount; lineIndex ++) {
             CTLineRef lineRef = NULL;
-            lineRef = CFArrayGetValueAtIndex(lines, lineIndex);
+            lineRef = CFArrayGetValueAtIndex(ctLines, lineIndex);
+            if (!lineRef) {
+                break;
+            }
             CGPoint lineOrigin = lineOrigins[lineIndex];
             lineOrigin.x += padding.left;
             lineOrigin.y -= padding.top;
             CGContextSetTextPosition(context, lineOrigin.x, lineOrigin.y);
             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 = NULL;
-                run = CFArrayGetValueAtIndex(runs, runIndex);
-                CTRunDraw(run, context, CFRangeMake(0, 0));
-                CFDictionaryRef attr = NULL;
-                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);
+            [mutableLines addObject:(__bridge id _Nonnull)(lineRef)];
+            // lineIndex base 0
+            rowCount = lineIndex + 1;
+            if (_lines > 0 && _truncationLine) {
+                if (_truncationLine && rowCount > _lines) {
+                    needTruncation = YES;
+                    do {
+                        NSUInteger lastRow = [mutableLines count];
+                        if (lastRow < rowCount) {
+                           break;
+                        }
+                        [mutableLines removeLastObject];
+                    } while (1);
+
+                }
+            }
+            if (_lines > 0 && _truncationLine) {
+                if (rowCount >= _lines &&!needTruncation && (CTLineGetStringRange(lineRef).length + CTLineGetStringRange(lineRef).location) < attributedStringCopy.length) {
+                    needTruncation = YES;
+                }
+            }
+            
+            if (needTruncation) {
+                ctTruncatedLine = [self buildTruncatedLineWithRuns:runs lines:mutableLines path:cgPath];
+                if (ctTruncatedLine) {
+                    CFArrayRef truncatedRuns = CTLineGetGlyphRuns(ctTruncatedLine);
+                    [self drawTextWithRuns:truncatedRuns context:context lineOrigin:lineOrigin];
+                    CFRelease(ctTruncatedLine);
+                    ctTruncatedLine = NULL;
+                    continue;
                 }
+            }else {
+                [self drawTextWithRuns:runs context:context lineOrigin:lineOrigin];
             }
         }
-        CFRelease(coretextFrameRef);
+        
+        [mutableLines removeAllObjects];
+        CGPathRelease(cgPath);
+        CFRelease(_coreTextFrameRef);
+        _coreTextFrameRef = NULL;
+        cgPath = NULL;
         CGContextRestoreGState(context);
     }
 }
 
+- (void)drawTextWithRuns:(CFArrayRef)runs context:(CGContextRef)context lineOrigin:(CGPoint)lineOrigin
+{
+    for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runs); runIndex ++) {
+        CTRunRef run = NULL;
+        run = CFArrayGetValueAtIndex(runs, runIndex);
+        CTRunDraw(run, context, CFRangeMake(0, 0));
+        CFDictionaryRef attr = NULL;
+        attr = CTRunGetAttributes(run);
+        CFIndex glyphCount = CTRunGetGlyphCount(run);
+        if (glyphCount <= 0) continue;
+        
+        NSUnderlineStyle strikethrough = (NSUnderlineStyle)CFDictionaryGetValue(attr, NSStrikethroughStyleAttributeName);
+        
+        if (strikethrough) {
+            // draw strikethrough
+            [self drawLineThroughWithRun:runs context:context index:runIndex origin:lineOrigin];
+        }
+    }
+}
+
+- (CTLineRef)buildTruncatedLineWithRuns:(CFArrayRef)runs lines:(NSMutableArray*)mutableLines path:(CGPathRef)cgPath
+{
+    NSAttributedString * truncationToken = nil;
+    CTLineRef ctTruncatedLine = NULL;
+    CTLineRef lastLine = (__bridge CTLineRef)(mutableLines.lastObject);
+   
+    CFArrayRef lastLineRuns = CTLineGetGlyphRuns(lastLine);
+    NSUInteger lastLineRunCount = CFArrayGetCount(lastLineRuns);
+    
+    CTLineRef truncationTokenLine = NULL;
+    NSMutableDictionary *attrs = nil;
+    if (lastLineRunCount > 0) {
+        CTRunRef run = CFArrayGetValueAtIndex(runs, lastLineRunCount - 1);
+        attrs = (id)CTRunGetAttributes(run);
+        attrs = attrs ? attrs.mutableCopy : [NSMutableDictionary new];
+        CTFontRef font = (__bridge CTFontRef)(attrs[(id)kCTFontAttributeName]);
+        CGFloat fontSize = font ? CTFontGetSize(font):32 * self.weexInstance.pixelScaleFactor;
+        UIFont * uiFont = [UIFont systemFontOfSize:fontSize];
+        if (uiFont) {
+            font = CTFontCreateWithName((__bridge CFStringRef)uiFont.fontName, uiFont.pointSize, NULL);
+        }
+        if (font) {
+            attrs[(id)kCTFontAttributeName] = (__bridge id)(font);
+            uiFont = nil;
+            CFRelease(font);
+        }
+        CGColorRef color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]);
+        if (color && CFGetTypeID(color) == CGColorGetTypeID() && CGColorGetAlpha(color) == 0) {
+            [attrs removeObjectForKey:(id)kCTForegroundColorAttributeName];
+        }
+        
+        attrs = attrs?:[NSMutableDictionary new];
+        truncationToken = [[NSAttributedString alloc] initWithString:WXTextTruncationToken attributes:attrs];
+        truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)truncationToken);
+    }
+    
+    if (truncationTokenLine) {
+        // default truncationType is kCTLineTruncationEnd
+        CTLineTruncationType truncationType = kCTLineTruncationEnd;
+        NSAttributedString *attributedString = [self buildCTAttributeString];
+        NSAttributedString * lastLineText = [attributedString attributedSubstringFromRange: WXNSRangeFromCFRange(CTLineGetStringRange(lastLine))];
+//        NSMutableAttributedString *.mutableCopy;
+        NSMutableAttributedString *mutableLastLineText = lastLineText.mutableCopy;
+        [mutableLastLineText appendAttributedString:truncationToken];
+        CTLineRef ctLastLineExtend = CTLineCreateWithAttributedString((__bridge CFAttributedStringRef)mutableLastLineText);
+        if (ctLastLineExtend) {
+            CGRect cgPathRect = CGRectZero;
+            CGFloat truncatedWidth = 0;
+            if (CGPathIsRect(cgPath, &cgPathRect)) {
+                truncatedWidth = cgPathRect.size.width;
+            }
+            ctTruncatedLine = CTLineCreateTruncatedLine(ctLastLineExtend, truncatedWidth, truncationType, truncationTokenLine);
+            CFRelease(ctLastLineExtend);
+            ctLastLineExtend = NULL;
+            CFRelease(truncationTokenLine);
+            truncationTokenLine = NULL;
+        }
+    }
+    
+    return ctTruncatedLine;
+}
+
+- (void)drawLineThroughWithRun:(CFArrayRef)runs context:(CGContextRef)context index:(CFIndex)runIndex origin:(CGPoint)lineOrigin
+{
+    CFRetain(runs);
+    CGContextRetain(context);
+    
+    CGContextSaveGState(context);
+    CGFloat xHeight = 0, underLinePosition = 0, lineThickness = 0;
+    CTRunRef run = CFArrayGetValueAtIndex(runs, runIndex);
+    WXTextGetRunsMaxMetric(runs, &xHeight, &underLinePosition, &lineThickness);
+    
+    CGPoint strikethroughStart;
+    strikethroughStart.x =  lineOrigin.x - underLinePosition;
+    strikethroughStart.y = lineOrigin.y + xHeight/2;
+    CGPoint runPosition = CGPointZero;
+    CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition);
+    strikethroughStart.x = lineOrigin.x + runPosition.x;
+    CGContextSetLineWidth(context, WXTextDefaultLineThroughWidth);
+    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);
+    
+    CGContextRestoreGState(context);
+    CFRelease(runs);
+    CGContextRelease(context);
+}
+
 - (CGSize)calculateTextHeightWithWidth:(CGFloat)aWidth
 {
     if (isnan(aWidth)) {
@@ -670,7 +825,9 @@ do {\
     return CGSizeMake(suggestSize.width, totalHeight);
 }
 
-static void WXTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *underlinePosition, CGFloat *lineThickness) {
+static void WXTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *underlinePosition, CGFloat *lineThickness)
+{
+    CFRetain(runs);
     CGFloat maxXHeight = 0;
     CGFloat maxUnderlinePos = 0;
     CGFloat maxLineThickness = 0;
@@ -709,6 +866,12 @@ static void WXTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *u
     if (lineThickness) {
         *lineThickness = maxLineThickness;
     }
+    
+    CFRelease(runs);
+}
+                                                                                                                                       
+NS_INLINE NSRange WXNSRangeFromCFRange(CFRange range) {
+    return NSMakeRange(range.location, range.length);
 }
 
 #ifdef UITEST


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

Posted by bo...@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/1fd7c08f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1fd7c08f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1fd7c08f

Branch: refs/heads/0.12-dev
Commit: 1fd7c08f61e6932f3641d1adcfaab5257be2d90d
Parents: 5985968 24ef3af
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 18 17:58:28 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 18 17:58:28 2017 +0800

----------------------------------------------------------------------
 .travis.yml                                     | 42 +++++++++--
 NOTICE                                          | 75 ++++++++++++++++++++
 WeexSDK.podspec                                 | 45 ++++++++++++
 android/run-ci.sh                               |  2 +-
 .../com/taobao/weex/ui/component/WXEmbed.java   |  2 +-
 examples/component/input-demo.we                | 14 ++--
 examples/index.we                               |  5 +-
 examples/vue/components/input.vue               | 14 ++--
 examples/vue/index.vue                          |  3 +
 examples/vue/market/gcanvas.vue                 | 40 +++++++++++
 ios/playground/Podfile                          |  5 +-
 .../WeexDemo.xcodeproj/project.pbxproj          |  4 +-
 ios/sdk/WeexSDK.podspec                         | 47 ------------
 .../WeexSDK/Sources/Bridge/WXBridgeContext.m    |  2 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m |  2 +-
 .../Sources/Component/WXSliderComponent.m       | 53 +++-----------
 .../Sources/Controller/WXBaseViewController.h   |  2 +-
 .../Sources/Controller/WXBaseViewController.m   | 16 -----
 .../Sources/Controller/WXRootViewController.m   | 17 ++++-
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m     |  1 +
 .../Sources/View/WXComponent+ViewManagement.m   |  4 +-
 ios/sdk/WeexSDK/Sources/WeexSDK.h               | 33 ++++-----
 ios/sdk/WeexSDKTests/WXRootViewTests.m          |  4 +-
 ios/sdk/buildScripts.sh                         | 25 +++++--
 package.json                                    |  4 +-
 test/ci-funcs.sh                                | 75 +++-----------------
 test/run.sh                                     | 41 ++++++-----
 test/scripts/components/image-onload.test.js    |  2 +-
 test/scripts/components/recycler.test.js        |  2 +-
 29 files changed, 333 insertions(+), 248 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1fd7c08f/WeexSDK.podspec
----------------------------------------------------------------------
diff --cc WeexSDK.podspec
index 0000000,8279ec3..ae1b6a9
mode 000000,100644..100644
--- a/WeexSDK.podspec
+++ b/WeexSDK.podspec
@@@ -1,0 -1,45 +1,45 @@@
+ # coding: utf-8
+ Pod::Spec.new do |s|
+ 
+   s.name         = "WeexSDK"
+ 
 -  s.version      = "0.11.0"
++  s.version      = "0.12.0"
+ 
+   s.summary      = "WeexSDK Source ."
+ 
+   s.description  = <<-DESC
+                    A framework for building Mobile cross-platform UI
+                    DESC
+ 
+   s.homepage     = "https://github.com/alibaba/weex"
+   s.license = {
+     :type => 'Copyright',
+     :text => <<-LICENSE
+            Alibaba-INC copyright
+     LICENSE
+   }
+   s.authors      = { "cxfeng1"      => "cxfeng1@gmail.com",
+                      "boboning"     => "ningli928@163.com",
+                      "yangshengtao" => "yangshengtao1314@163.com",
+                      "kfeagle"      => "sunjjbobo@163.com",
+                      "acton393"     => "zhangxing610321@gmail.com"
+                    }
+   s.platform     = :ios
+   s.ios.deployment_target = '7.0'
+   s.source =  { :path => '.' }
+   s.source_files = 'ios/sdk/WeexSDK/Sources/**/*.{h,m,mm,c}'
+   s.resources = 'ios/sdk/WeexSDK/Resources/main.js', 'ios/sdk/WeexSDK/Resources/wx_load_error@3x.png'
+ 
+   s.requires_arc = true
+   s.prefix_header_file = 'ios/sdk/WeexSDK/Sources/Supporting Files/WeexSDK-Prefix.pch'
+ 
+ #  s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) DEBUG=1' }
+ 
+   s.xcconfig = { "OTHER_LINK_FLAG" => '$(inherited) -ObjC'}
+ 
+   s.frameworks = 'CoreMedia','MediaPlayer','AVFoundation','AVKit','JavaScriptCore', 'GLKit'
+ 
+   s.dependency 'SocketRocket'
+   s.libraries = "stdc++"
+ 
+ end


[2/5] incubator-weex git commit: * [ios] update sdk version

Posted by bo...@apache.org.
* [ios] update sdk version


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

Branch: refs/heads/0.12-dev
Commit: bc2d964facc7e8e7a454b403b58ce22df8120c1f
Parents: 242b1ec
Author: acton393 <zh...@gmail.com>
Authored: Mon Apr 17 20:47:56 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Apr 17 20:47:56 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK.podspec                    | 2 +-
 ios/sdk/WeexSDK/Sources/Utility/WXDefine.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/bc2d964f/ios/sdk/WeexSDK.podspec
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK.podspec b/ios/sdk/WeexSDK.podspec
index 5cc5805..d319be6 100644
--- a/ios/sdk/WeexSDK.podspec
+++ b/ios/sdk/WeexSDK.podspec
@@ -3,7 +3,7 @@ Pod::Spec.new do |s|
 
   s.name         = "WeexSDK"
 
-  s.version      = "0.11.0"
+  s.version      = "0.12.0"
 
   s.summary      = "WeexSDK Source ."
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/bc2d964f/ios/sdk/WeexSDK/Sources/Utility/WXDefine.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXDefine.h b/ios/sdk/WeexSDK/Sources/Utility/WXDefine.h
index 8cca636..f2947ab 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXDefine.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXDefine.h
@@ -20,7 +20,7 @@
 #ifndef __WX_DEFINE_H__
 #define __WX_DEFINE_H__
 
-#define WX_SDK_VERSION @"0.11.0"
+#define WX_SDK_VERSION @"0.12.0"
 
 #if defined(__cplusplus)
 #define WX_EXTERN extern "C" __attribute__((visibility("default")))


[5/5] incubator-weex git commit: * [ios] update lineIndex

Posted by bo...@apache.org.
* [ios] update lineIndex


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

Branch: refs/heads/0.12-dev
Commit: 90c358303096baac16b95b81bdad68c805e8630d
Parents: 1fd7c08
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 18 18:00:08 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 18 18:00:08 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/90c35830/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 fed8dd5..005ca1a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -609,7 +609,7 @@ do {\
         BOOL needTruncation = NO;
         CTLineRef ctTruncatedLine = NULL;
         CTFrameGetLineOrigins(_coreTextFrameRef, CFRangeMake(0, 0), lineOrigins);
-        for (CFIndex lineIndex = 0;(!_lines || _lines >= lineIndex) && lineIndex < lineCount; lineIndex ++) {
+        for (CFIndex lineIndex = 0;(!_lines || _lines > lineIndex) && lineIndex < lineCount; lineIndex ++) {
             CTLineRef lineRef = NULL;
             lineRef = CFArrayGetValueAtIndex(ctLines, lineIndex);
             if (!lineRef) {


[3/5] incubator-weex git commit: * [ios] remove unused line

Posted by bo...@apache.org.
* [ios] remove unused line


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

Branch: refs/heads/0.12-dev
Commit: 5985968fb4392f8a469da732343dea1d41400a6a
Parents: bc2d964
Author: acton393 <zh...@gmail.com>
Authored: Tue Apr 18 10:12:36 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Apr 18 10:12:36 2017 +0800

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


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5985968f/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 c4c8cd3..fed8dd5 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -726,7 +726,6 @@ do {\
         CTLineTruncationType truncationType = kCTLineTruncationEnd;
         NSAttributedString *attributedString = [self buildCTAttributeString];
         NSAttributedString * lastLineText = [attributedString attributedSubstringFromRange: WXNSRangeFromCFRange(CTLineGetStringRange(lastLine))];
-//        NSMutableAttributedString *.mutableCopy;
         NSMutableAttributedString *mutableLastLineText = lastLineText.mutableCopy;
         [mutableLastLineText appendAttributedString:truncationToken];
         CTLineRef ctLastLineExtend = CTLineCreateWithAttributedString((__bridge CFAttributedStringRef)mutableLastLineText);
@@ -819,7 +818,7 @@ do {\
         actualLineCount ++;
     }
     
-    totalHeight = totalHeight + actualLineCount*leading;
+    totalHeight = totalHeight + actualLineCount * leading;
     CFRelease(frameRef);
     
     return CGSizeMake(suggestSize.width, totalHeight);