You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ji...@apache.org on 2017/02/20 06:41:01 UTC

[12/50] [abbrv] incubator-weex git commit: V0.10.0 stable gitlab (#178)

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Component/WXTextAreaComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextAreaComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextAreaComponent.m
index 95e26b7..90a688c 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextAreaComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextAreaComponent.m
@@ -11,46 +11,11 @@
 #import "WXConvert.h"
 #import "WXComponent_internal.h"
 #import "WXView.h"
+#import "WXAssert.h"
 #import "WXSDKInstance.h"
+#import "WXComponent+PseudoClassManagement.h"
 
-@interface WXTextAreaView : UITextView
-@property (nonatomic, assign) UIEdgeInsets border;
-@property (nonatomic, assign) UIEdgeInsets padding;
-@end
-
-@implementation WXTextAreaView
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        _padding = UIEdgeInsetsZero;
-        _border = UIEdgeInsetsZero;
-    }
-    return self;
-}
-
-- (CGRect)textRectForBounds:(CGRect)bounds
-{
-    bounds.size.width -= self.padding.left + self.border.left;
-    bounds.origin.x += self.padding.left + self.border.left;
-    
-    bounds.size.height -= self.padding.top + self.border.top;
-    bounds.origin.y += self.padding.top + self.border.top;
-    
-    bounds.size.width -= self.padding.right + self.border.right;
-    
-    bounds.size.height -= self.padding.bottom + self.border.bottom;
-    
-    return bounds;
-}
-
-- (CGRect)editingRectForBounds:(CGRect)bounds
-{
-    return [self textRectForBounds:bounds];
-}
-
-@end
+typedef UITextView WXTextAreaView;
 
 @interface WXTextAreaComponent()
 @property (nonatomic, strong) WXTextAreaView *textView;
@@ -65,12 +30,14 @@
 @property (nonatomic, strong)NSString *textValue;
 @property (nonatomic) NSUInteger rows;
 //style
+
 @property (nonatomic) WXPixelType fontSize;
 @property (nonatomic) WXTextStyle fontStyle;
-@property (nonatomic) WXTextWeight fontWeight;
+@property (nonatomic) CGFloat fontWeight;
 @property (nonatomic, strong) NSString *fontFamily;
 @property (nonatomic, strong) UIColor *color;
 @property (nonatomic) NSTextAlignment textAlign;
+
 //event
 @property (nonatomic) BOOL inputEvent;
 @property (nonatomic) BOOL focusEvent;
@@ -79,7 +46,6 @@
 @property (nonatomic) BOOL clickEvent;
 @property (nonatomic, strong) NSString *changeEventString;
 @property (nonatomic, assign) CGSize keyboardSize;
-@property (nonatomic, assign) CGRect rootViewOriginFrame;
 
 @end
 
@@ -101,6 +67,8 @@ WX_EXPORT_METHOD(@selector(blur))
         _blurEvent = NO;
         _changeEvent = NO;
         _clickEvent = NO;
+        _padding = UIEdgeInsetsZero;
+        _border = UIEdgeInsetsZero;
         
         if (attributes[@"autofocus"]) {
             _autofocus = [attributes[@"autofocus"] boolValue];
@@ -140,7 +108,7 @@ WX_EXPORT_METHOD(@selector(blur))
             _color = [WXConvert UIColor:styles[@"color"]];
         }
         if (styles[@"fontSize"]) {
-            _fontSize = [WXConvert WXPixelType:styles[@"fontSize"]];
+            _fontSize = [WXConvert WXPixelType:styles[@"fontSize"] scaleFactor:self.weexInstance.pixelScaleFactor];
         }
         if (styles[@"fontWeight"]) {
             _fontWeight = [WXConvert WXTextWeight:styles[@"fontWeight"]];
@@ -154,18 +122,6 @@ WX_EXPORT_METHOD(@selector(blur))
         if (styles[@"textAlign"]) {
             _textAlign = [WXConvert NSTextAlignment:styles[@"textAlign"]] ;
         }
-        
-        _padding = UIEdgeInsetsZero;
-        _border = UIEdgeInsetsZero;
-        UIEdgeInsets padding = UIEdgeInsetsMake(self.cssNode->style.padding[CSS_TOP], self.cssNode->style.padding[CSS_LEFT], self.cssNode->style.padding[CSS_BOTTOM], self.cssNode->style.padding[CSS_RIGHT]);
-        if (!UIEdgeInsetsEqualToEdgeInsets(padding, _padding)) {
-            _padding = padding;
-        }
-        UIEdgeInsets border = UIEdgeInsetsMake(self.cssNode->style.border[CSS_TOP], self.cssNode->style.border[CSS_LEFT], self.cssNode->style.border[CSS_BOTTOM], self.cssNode->style.border[CSS_RIGHT]);
-        if (!UIEdgeInsetsEqualToEdgeInsets(border, _border)) {
-            _border = border;
-        }
-        _rootViewOriginFrame = CGRectNull;
     }
     
     return self;
@@ -195,7 +151,7 @@ WX_EXPORT_METHOD(@selector(blur))
 }
 - (UIView *)loadView
 {
-    return [[WXTextAreaView alloc] initWithFrame:[UIScreen mainScreen].bounds];
+    return [[WXTextAreaView alloc] init];
 }
 - (void)viewDidLoad
 {
@@ -228,42 +184,29 @@ WX_EXPORT_METHOD(@selector(blur))
     }
     [_textView setTextAlignment:_textAlign];
     [self setTextFont];
-    [_textView setBorder:_border];
-    [_textView setPadding:_padding];
+    _padding = UIEdgeInsetsZero;
+    _border = UIEdgeInsetsZero;
+    [self updatePattern];
     
     [_textView setNeedsDisplay];
     [_textView setClipsToBounds:YES];
+    [self handlePseudoClass];
 }
 
--(void)focus
+- (void)focus
 {
     if (self.textView) {
         [self.textView becomeFirstResponder];
     }
 }
 
--(void)blur
+- (void)blur
 {
     if (self.textView) {
         [self.textView resignFirstResponder];
     }
 }
 
-#pragma mark - private method
--(UIColor *)convertColor:(id)value
-{
-    UIColor *color = [WXConvert UIColor:value];
-    if(value) {
-        NSString *str = [WXConvert NSString:value];
-        if(str && [@"" isEqualToString:str]) {
-            color = [UIColor blackColor];
-        }
-    }else {
-        color = [UIColor blackColor];
-    }
-    return color;
-}
-
 #pragma mark - add-remove Event
 - (void)addEvent:(NSString *)eventName
 {
@@ -338,7 +281,7 @@ WX_EXPORT_METHOD(@selector(blur))
         [_textView setTextColor:_color];
     }
     if (styles[@"fontSize"]) {
-        _fontSize = [WXConvert WXPixelType:styles[@"fontSize"]];
+        _fontSize = [WXConvert WXPixelType:styles[@"fontSize"] scaleFactor:self.weexInstance.pixelScaleFactor];
     }
     if (styles[@"fontWeight"]) {
         _fontWeight = [WXConvert WXTextWeight:styles[@"fontWeight"]];
@@ -362,17 +305,38 @@ WX_EXPORT_METHOD(@selector(blur))
         _placeholderColor = [UIColor colorWithRed:0x99/255.0 green:0x99/255.0 blue:0x99/255.0 alpha:1.0];
     }
     [self setPlaceholderAttributedString];
-    
-    UIEdgeInsets padding = UIEdgeInsetsMake(self.cssNode->style.padding[CSS_TOP], self.cssNode->style.padding[CSS_LEFT], self.cssNode->style.padding[CSS_BOTTOM], self.cssNode->style.padding[CSS_RIGHT]);
-    if (!UIEdgeInsetsEqualToEdgeInsets(padding, _padding)) {
-        _padding = padding;
-    }
-    
-    UIEdgeInsets border = UIEdgeInsetsMake(self.cssNode->style.border[CSS_TOP], self.cssNode->style.border[CSS_LEFT], self.cssNode->style.border[CSS_BOTTOM], self.cssNode->style.border[CSS_RIGHT]);
-    if (!UIEdgeInsetsEqualToEdgeInsets(border, _border)) {
-        _border = border;
-        [_textView setBorder:_border];
-    }
+    [self updatePattern];
+}
+
+#pragma mark update touch styles
+- (void)handlePseudoClass
+{
+    NSMutableDictionary *styles = [NSMutableDictionary new];
+    NSMutableDictionary *recordStyles = [NSMutableDictionary new];
+    if(_disabled){
+        recordStyles = [self getPseudoClassStylesByKeys:@[@"disabled"]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }else {
+        recordStyles = [NSMutableDictionary new];
+        recordStyles = [self getPseudoClassStylesByKeys:@[@"enabled"]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }
+    if ([_textView isFirstResponder]){
+        recordStyles = [NSMutableDictionary new];
+        recordStyles = [self getPseudoClassStylesByKeys:@[@"focus"]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }
+    NSString *disabledStr = @"enabled";
+    if (_disabled){
+        disabledStr = @"disabled";
+    }
+    if ([_textView isFirstResponder]) {
+        NSString *focusStr = @"focus";
+        recordStyles = [NSMutableDictionary new];
+        recordStyles = [self getPseudoClassStylesByKeys:@[focusStr,disabledStr]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }
+    [self updatePseudoClassStyles:styles];
 }
 
 #pragma mark measure frame
@@ -393,11 +357,11 @@ WX_EXPORT_METHOD(@selector(blur))
         }
         
         if (!isnan(weakSelf.cssNode->style.minDimensions[CSS_HEIGHT])) {
-            computedSize.width = MAX(computedSize.height, weakSelf.cssNode->style.minDimensions[CSS_HEIGHT]);
+            computedSize.height = MAX(computedSize.height, weakSelf.cssNode->style.minDimensions[CSS_HEIGHT]);
         }
         
         if (!isnan(weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT])) {
-            computedSize.width = MIN(computedSize.height, weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT]);
+            computedSize.height = MIN(computedSize.height, weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT]);
         }
         
         return (CGSize) {
@@ -418,6 +382,7 @@ WX_EXPORT_METHOD(@selector(blur))
         [self fireEvent:@"click" params:nil];
     }
     [textView becomeFirstResponder];
+    [self handlePseudoClass];
 }
 
 - (void)textViewDidChange:(UITextView *)textView
@@ -427,10 +392,8 @@ WX_EXPORT_METHOD(@selector(blur))
     }else{
         [self setPlaceholderAttributedString];
     }
-    if (textView.markedTextRange == nil) {
-        if (_inputEvent) {
-            [self fireEvent:@"input" params:@{@"value":[textView text]} domChanges:@{@"attrs":@{@"value":[textView text]}}];
-        }
+    if (_inputEvent) {
+        [self fireEvent:@"input" params:@{@"value":[textView text]} domChanges:@{@"attrs":@{@"value":[textView text]}}];
     }
 }
 
@@ -447,13 +410,16 @@ WX_EXPORT_METHOD(@selector(blur))
     if (_blurEvent) {
         [self fireEvent:@"blur" params:nil];
     }
+    if(self.pseudoClassStyles && [self.pseudoClassStyles count]>0){
+        [self recoveryPseudoStyles:self.styles];
+    }
 }
 
-#pragma mark - set properties
+#pragma mark - private method
 - (void)setPlaceholderAttributedString
 {
     NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:_placeholderString];
-    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily];
+    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor];
     if (_placeholderColor) {
         [attributedString addAttribute:NSForegroundColorAttributeName value:_placeholderColor range:NSMakeRange(0, _placeholderString.length)];
         [attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, _placeholderString.length)];
@@ -467,11 +433,45 @@ WX_EXPORT_METHOD(@selector(blur))
     CGRect newFrame = _placeHolderLabel.frame;
     newFrame.size.height = ceil(expectedLabelSize.size.height);
     newFrame.size.width = _textView.frame.size.width;
-    newFrame.origin.y = 6;
+    newFrame.origin.x = 4; // the cursor origin.x
+    newFrame.origin.y = 7; // the cursor origin.y
     _placeHolderLabel.frame = newFrame;
     _placeHolderLabel.attributedText = attributedString;
 }
 
+- (void)updatePattern
+{
+    UIEdgeInsets padding = UIEdgeInsetsMake(self.cssNode->style.padding[CSS_TOP], self.cssNode->style.padding[CSS_LEFT], self.cssNode->style.padding[CSS_BOTTOM], self.cssNode->style.padding[CSS_RIGHT]);
+    if (!UIEdgeInsetsEqualToEdgeInsets(padding, _padding)) {
+        [self setPadding:padding];
+    }
+    
+    UIEdgeInsets border = UIEdgeInsetsMake(self.cssNode->style.border[CSS_TOP], self.cssNode->style.border[CSS_LEFT], self.cssNode->style.border[CSS_BOTTOM], self.cssNode->style.border[CSS_RIGHT]);
+    if (!UIEdgeInsetsEqualToEdgeInsets(border, _border)) {
+        [self setBorder:border];
+    }
+}
+
+- (void)setPadding:(UIEdgeInsets)padding
+{
+    _padding = padding;
+    [self _updateTextContentInset];
+}
+
+- (void)setBorder:(UIEdgeInsets)border
+{
+    _border = border;
+    [self _updateTextContentInset];
+}
+
+- (void)_updateTextContentInset
+{
+    [_textView setTextContainerInset:UIEdgeInsetsMake(_padding.top + _border.top,
+                                                      _padding.left + _border.left,
+                                                      _padding.bottom + _border.bottom,
+                                                      _border.right + _border.right)];
+}
+
 - (void)setAutofocus
 {
     if (_autofocus) {
@@ -483,7 +483,7 @@ WX_EXPORT_METHOD(@selector(blur))
 
 - (void)setTextFont
 {
-    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily];
+    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor];
     [_textView setFont:font];
 }
 
@@ -508,9 +508,6 @@ WX_EXPORT_METHOD(@selector(blur))
     _keyboardSize = end.size;
     UIView * rootView = self.weexInstance.rootView;
     CGRect screenRect = [[UIScreen mainScreen] bounds];
-    if (CGRectIsNull(_rootViewOriginFrame)) {
-        _rootViewOriginFrame = rootView.frame;
-    }
     CGRect keyboardRect = (CGRect){
         .origin.x = 0,
         .origin.y = CGRectGetMaxY(screenRect) - _keyboardSize.height - 54,
@@ -529,7 +526,7 @@ WX_EXPORT_METHOD(@selector(blur))
         return;
     }
     UIView * rootView = self.weexInstance.rootView;
-    if (rootView.frame.origin.y < 0) {
+    if (!CGRectEqualToRect(self.weexInstance.frame, rootView.frame)) {
         [self setViewMovedUp:NO];
         self.weexInstance.isRootViewFrozen = NO;
     }
@@ -544,11 +541,11 @@ WX_EXPORT_METHOD(@selector(blur))
 - (void)setViewMovedUp:(BOOL)movedUp
 {
     UIView *rootView = self.weexInstance.rootView;
-    CGRect rect = _rootViewOriginFrame;
+    CGRect rect = self.weexInstance.frame;
     CGRect rootViewFrame = rootView.frame;
     CGRect textAreaFrame = [_textView.superview convertRect:_textView.frame toView:rootView];
     if (movedUp) {
-        CGFloat offset =textAreaFrame.origin.y-(rootViewFrame.size.height-_keyboardSize.height-textAreaFrame.size.height);
+        CGFloat offset = textAreaFrame.origin.y-(rootViewFrame.size.height-_keyboardSize.height-textAreaFrame.size.height);
         if (offset > 0) {
             rect = (CGRect){
                 .origin.x = 0.f,
@@ -556,10 +553,6 @@ WX_EXPORT_METHOD(@selector(blur))
                 .size = rootViewFrame.size
             };
         }
-    }else {
-        // revert back to the origin state
-        rect = _rootViewOriginFrame;
-        _rootViewOriginFrame = CGRectNull;
     }
     self.weexInstance.rootView.frame = rect;
 }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/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 3896d04..256bda1 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -105,7 +105,7 @@
     UIColor *_color;
     NSString *_fontFamily;
     CGFloat _fontSize;
-    WXTextWeight _fontWeight;
+    CGFloat _fontWeight;
     WXTextStyle _fontStyle;
     NSUInteger _lines;
     NSTextAlignment _textAlign;
@@ -154,6 +154,8 @@ static BOOL _isUsingTextStorageLock = NO;
     }
 }
 
+
+
 #define WX_STYLE_FILL_TEXT(key, prop, type, needLayout)\
 do {\
     id value = styles[@#key];\
@@ -166,18 +168,30 @@ do {\
     }\
 } while(0);
 
+#define WX_STYLE_FILL_TEXT_PIXEL(key, prop, needLayout)\
+do {\
+    id value = styles[@#key];\
+    if (value) {\
+        _##prop = [WXConvert WXPixelType:value scaleFactor:self.weexInstance.pixelScaleFactor];\
+        [self setNeedsRepaint];\
+    if (needLayout) {\
+        [self setNeedsLayout];\
+    }\
+}\
+} while(0);
+
 - (void)fillCSSStyles:(NSDictionary *)styles
 {
     WX_STYLE_FILL_TEXT(color, color, UIColor, NO)
     WX_STYLE_FILL_TEXT(fontFamily, fontFamily, NSString, YES)
-    WX_STYLE_FILL_TEXT(fontSize, fontSize, WXPixelType, YES)
+    WX_STYLE_FILL_TEXT_PIXEL(fontSize, fontSize, YES)
     WX_STYLE_FILL_TEXT(fontWeight, fontWeight, WXTextWeight, YES)
     WX_STYLE_FILL_TEXT(fontStyle, fontStyle, WXTextStyle, YES)
     WX_STYLE_FILL_TEXT(lines, lines, NSUInteger, YES)
     WX_STYLE_FILL_TEXT(textAlign, textAlign, NSTextAlignment, NO)
     WX_STYLE_FILL_TEXT(textDecoration, textDecoration, WXTextDecoration, YES)
     WX_STYLE_FILL_TEXT(textOverflow, textOverflow, NSString, NO)
-    WX_STYLE_FILL_TEXT(lineHeight, lineHeight, WXPixelType, YES)
+    WX_STYLE_FILL_TEXT_PIXEL(lineHeight, lineHeight, YES)
     
     UIEdgeInsets padding = {
         WXFloorPixelValue(self.cssNode->style.padding[CSS_TOP] + self.cssNode->style.border[CSS_TOP]),
@@ -278,11 +292,11 @@ do {\
         }
         
         if (!isnan(weakSelf.cssNode->style.minDimensions[CSS_HEIGHT])) {
-            computedSize.width = MAX(computedSize.height, weakSelf.cssNode->style.minDimensions[CSS_HEIGHT]);
+            computedSize.height = MAX(computedSize.height, weakSelf.cssNode->style.minDimensions[CSS_HEIGHT]);
         }
         
         if (!isnan(weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT])) {
-            computedSize.width = MIN(computedSize.height, weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT]);
+            computedSize.height = MIN(computedSize.height, weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT]);
         }
         
         return (CGSize) {
@@ -310,7 +324,20 @@ do {\
     }
     
     // set font
-    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily];
+    if (!_fontFamily) {
+        NSString *regex = @".*[\\u4e00-\\u9faf].*";//Has Simplified Chinese char
+        NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
+        if ([pred evaluateWithObject:string]) {
+            if ([[UIDevice currentDevice].systemVersion floatValue] < 9.0) {
+                //\u201cHeiti SC\u201d font is "[UIFont systemFontOfSize:]" for Simplified Chinese before iOS 9.0.
+                _fontFamily = @"Heiti SC";
+            } else {
+                //\u201cPingFang SC\u201d font is "[UIFont systemFontOfSize:]" for Simplified Chinese from iOS 9.0.
+                _fontFamily = @"PingFang SC";
+            }
+        }
+    }
+    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor];
     if (font) {
         [attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, string.length)];
     }
@@ -396,6 +423,7 @@ do {\
             if (_isUsingTextStorageLock) {
                 pthread_mutex_unlock(&_textStorageMutex);
             }
+            [self readyToRender]; // notify super component
             [self setNeedsDisplay];
         }
     }];
@@ -407,9 +435,9 @@ do {\
     [self syncTextStorageForView];
 }
 
-- (void)_updateStylesOnComponentThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles
+- (void)_updateStylesOnComponentThread:(NSDictionary *)styles resetStyles:(NSMutableArray *)resetStyles isUpdateStyles:(BOOL)isUpdateStyles
 {
-    [super _updateStylesOnComponentThread:styles resetStyles:(NSMutableArray *)resetStyles];
+    [super _updateStylesOnComponentThread:styles resetStyles:(NSMutableArray *)resetStyles isUpdateStyles:isUpdateStyles];
     
     [self fillCSSStyles:styles];
     

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Component/WXTextInputComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextInputComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextInputComponent.m
index 8f26924..01d362a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextInputComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextInputComponent.m
@@ -10,7 +10,11 @@
 #import "WXConvert.h"
 #import "WXUtility.h"
 #import "WXSDKInstance.h"
+#import "WXSDKInstance_private.h"
 #import "WXDefine.h"
+#import "WXAssert.h"
+#import "WXComponent_internal.h"
+#import "WXComponent+PseudoClassManagement.h"
 
 @interface WXTextInputView : UITextField
 @property (nonatomic, assign) UIEdgeInsets border;
@@ -54,16 +58,22 @@
 
 @property (nonatomic, strong) WXTextInputView *inputView;
 @property (nonatomic, strong) WXDatePickerManager *datePickerManager;
+@property (nonatomic, strong) NSDictionary *attr;
 //attribute
 @property (nonatomic, strong) UIColor *placeholderColor;
-@property (nonatomic, strong) NSString *placeholder;
+@property (nonatomic, strong) NSString *placeholderString;
 @property (nonatomic) NSNumber *maxLength;
+@property (nonatomic) NSString * value;
+@property (nonatomic) BOOL autofocus;
+@property (nonatomic) BOOL disabled;
+@property (nonatomic, copy) NSString *inputType;
 //style
 @property (nonatomic) WXPixelType fontSize;
 @property (nonatomic) WXTextStyle fontStyle;
-@property (nonatomic) WXTextWeight fontWeight;
+@property (nonatomic) CGFloat fontWeight;
 @property (nonatomic, strong) NSString *fontFamily;
-@property (nonatomic, copy) NSString *inputType;
+@property (nonatomic, strong) UIColor *colorForStyle;
+@property (nonatomic)NSTextAlignment textAlignForStyle;
 
 //event
 @property (nonatomic) BOOL inputEvent;
@@ -72,7 +82,6 @@
 @property (nonatomic) BOOL changeEvent;
 @property (nonatomic, strong) NSString *changeEventString;
 @property (nonatomic, assign) CGSize keyboardSize;
-@property (nonatomic, assign) CGRect rootViewOriginFrame;
 
 @end
 
@@ -98,53 +107,25 @@ WX_EXPORT_METHOD(@selector(blur))
         _focusEvent = NO;
         _blurEvent = NO;
         _changeEvent = NO;
-        
-        _inputView = [[WXTextInputView alloc] init];
-        _datePickerManager = [[WXDatePickerManager alloc] init];
-        _datePickerManager.delegate = self;
-        if (attributes[@"type"]) {
-            NSString *type = [WXConvert NSString:attributes[@"type"]];
-            if (type) {
-                [self setType: type];
-            }
-        }
-        
-        if (attributes[@"autofocus"]) {
-            [self setAutofocus:[attributes[@"autofocus"] boolValue]];
-        }
-        if (attributes[@"disabled"]) {
-            [_inputView setEnabled:![attributes[@"disabled"] boolValue]];
-        }
-        if (attributes[@"value"]) {
-            NSString* value = [WXConvert NSString:attributes[@"value"]];
-            if (value) {
-                _inputView.text = value;
-            }
-        }
-        if([_inputType isEqualToString:@"date"] || [_inputType isEqualToString:@"time"])
-        {
-            [_datePickerManager configDatePicker:attributes];
+        // handle attributes
+        _autofocus = [attributes[@"autofocus"] boolValue];
+        _disabled = [attributes[@"disabled"] boolValue];
+        _value = [WXConvert NSString:attributes[@"value"]]?:@"";
+        _placeholderString = [WXConvert NSString:attributes[@"placeholder"]]?:@"";
+        if(attributes[@"type"]) {
+            _inputType = [WXConvert NSString:attributes[@"type"]];
+            _attr = attributes;
         }
-        if (attributes[@"placeholder"]) {
-            NSString *placeHolder = [WXConvert NSString:attributes[@"placeholder"]];
-            if (placeHolder) {
-                _placeholder = placeHolder;
-            }
-        }
-        if (!_placeholder) {
-            _placeholder = @"";
-        }
-        
         if (attributes[@"maxlength"]) {
             _maxLength = [NSNumber numberWithUnsignedInteger:[attributes[@"maxlength"] integerValue]];
         }
         
+        // handle styles
         if (styles[@"color"]) {
-            [_inputView setTextColor:[WXConvert UIColor:styles[@"color"]]];
+            _colorForStyle = [WXConvert UIColor:styles[@"color"]];
         }
-        
         if (styles[@"fontSize"]) {
-            _fontSize = [WXConvert WXPixelType:styles[@"fontSize"]];
+            _fontSize = [WXConvert WXPixelType:styles[@"fontSize"] scaleFactor:self.weexInstance.pixelScaleFactor];
         }
         if (styles[@"fontWeight"]) {
             _fontWeight = [WXConvert WXTextWeight:styles[@"fontWeight"]];
@@ -156,7 +137,7 @@ WX_EXPORT_METHOD(@selector(blur))
             _fontFamily = styles[@"fontFamily"];
         }
         if (styles[@"textAlign"]) {
-            [_inputView setTextAlignment:[WXConvert NSTextAlignment:styles[@"textAlign"]]] ;
+            _textAlignForStyle = [WXConvert NSTextAlignment:styles[@"textAlign"]];
         }
         
         if (styles[@"placeholderColor"]) {
@@ -164,25 +145,14 @@ WX_EXPORT_METHOD(@selector(blur))
         }else {
             _placeholderColor = [UIColor colorWithRed:0x99/255.0 green:0x99/255.0 blue:0x99/255.0 alpha:1.0];
         }
-        [self setPlaceholderAttributedString];
-        [self setTextFont];
-        UIEdgeInsets padding = UIEdgeInsetsMake(self.cssNode->style.padding[CSS_TOP], self.cssNode->style.padding[CSS_LEFT], self.cssNode->style.padding[CSS_BOTTOM], self.cssNode->style.padding[CSS_RIGHT]);
-        if (!UIEdgeInsetsEqualToEdgeInsets(padding, _padding)) {
-            [self setPadding:padding];
-        }
-        UIEdgeInsets border = UIEdgeInsetsMake(self.cssNode->style.border[CSS_TOP], self.cssNode->style.border[CSS_LEFT], self.cssNode->style.border[CSS_BOTTOM], self.cssNode->style.border[CSS_RIGHT]);
-        if (!UIEdgeInsetsEqualToEdgeInsets(border, _border)) {
-            [self setBorder:border];
-        }
-        
-        _rootViewOriginFrame = CGRectNull;
     }
     
     return self;
 }
 
--(UIView *)loadView
+- (UIView *)loadView
 {
+    _inputView = [[WXTextInputView alloc] init];
     return _inputView;
 }
 
@@ -197,6 +167,16 @@ WX_EXPORT_METHOD(@selector(blur))
     _border = UIEdgeInsetsZero;
     _inputView.delegate = self;
     _inputView.userInteractionEnabled = YES;
+    [self setType];
+    _inputView.text = _value;
+    [self setAutofocus:_autofocus];
+    [self setTextFont];
+    [self setPlaceholderAttributedString];
+    [_inputView setTextAlignment:_textAlignForStyle];
+    [_inputView setTextColor:_colorForStyle];
+    [_inputView setText:_value];
+    [_inputView setEnabled:!_disabled];
+    [self updatePattern];
     
     UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(closeKeyboard)];
     UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
@@ -204,6 +184,7 @@ WX_EXPORT_METHOD(@selector(blur))
     toolbar.items = [NSArray arrayWithObjects:space, barButton, nil];
     
     _inputView.inputAccessoryView = toolbar;
+    [self handlePseudoClass];
 }
 
 - (void)viewWillLoad
@@ -238,21 +219,6 @@ WX_EXPORT_METHOD(@selector(blur))
     }
 }
 
-#pragma mark - private method
--(UIColor *)convertColor:(id)value
-{
-    UIColor *color = [WXConvert UIColor:value];
-    if(value) {
-        NSString *str = [WXConvert NSString:value];
-        if(str && [@"" isEqualToString:str]) {
-            color = [UIColor blackColor];
-        }
-    }else {
-        color = [UIColor blackColor];
-    }
-    return color;
-}
-
 #pragma mark - Add Event
 - (void)addEvent:(NSString *)eventName
 {
@@ -292,40 +258,26 @@ WX_EXPORT_METHOD(@selector(blur))
 
 - (void)updateAttributes:(NSDictionary *)attributes
 {
+    _attr = attributes;
     if (attributes[@"type"]) {
-        NSString *type = [WXConvert NSString:attributes[@"type"]];
-        if (type) {
-            [self setType: type];
-        }
-    }
-    if (attributes[@"autofocus"]) {
-        [self setAutofocus:[attributes[@"autofocus"] boolValue]];
-    }
-    if (attributes[@"disabled"]) {
-        [_inputView setEnabled:![attributes[@"disabled"] boolValue]];
+        _inputType = [WXConvert NSString:attributes[@"type"]];
     }
+    [self setType];
+    _autofocus = [attributes[@"autofocus"] boolValue];
+    [self setAutofocus:_autofocus];
+    _disabled = [attributes[@"disabled"] boolValue];
+    [_inputView setEnabled:!_disabled];
     if (attributes[@"maxlength"]) {
         _maxLength = [NSNumber numberWithInteger:[attributes[@"maxlength"] integerValue]];
     }
     if (attributes[@"placeholder"]) {
-        NSString* placeholder = [WXConvert NSString:attributes[@"placeholder"]];
-        if (placeholder) {
-            _inputView.placeholder = _placeholder;
-            _placeholder = placeholder;
-        }
+        _placeholderString = [WXConvert NSString:attributes[@"placeholder"]]?:@"";
+        [self setPlaceholderAttributedString];
     }
     if (attributes[@"value"]) {
-        NSString* value = [WXConvert NSString:attributes[@"value"]];
-        if (value) {
-            _inputView.text = value;
-        }
+        _value = [WXConvert NSString:attributes[@"value"]]?:@"";
+        [_inputView setText:_value];
     }
-    if([_inputType isEqualToString:@"date"] || [_inputType isEqualToString:@"time"])
-    {
-        [_datePickerManager updateDatePicker:attributes];
-    }
-    
-    [self setPlaceholderAttributedString];
 }
 
 #pragma mark - upate styles
@@ -333,10 +285,11 @@ WX_EXPORT_METHOD(@selector(blur))
 - (void)updateStyles:(NSDictionary *)styles
 {
     if (styles[@"color"]) {
-       [_inputView setTextColor:[WXConvert UIColor:styles[@"color"]]];
+        _colorForStyle = [WXConvert UIColor:styles[@"color"]];
+       [_inputView setTextColor:_colorForStyle];
     }
     if (styles[@"fontSize"]) {
-        _fontSize = [WXConvert WXPixelType:styles[@"fontSize"]];
+        _fontSize = [WXConvert WXPixelType:styles[@"fontSize"] scaleFactor:self.weexInstance.pixelScaleFactor];
     }
     if (styles[@"fontWeight"]) {
         _fontWeight = [WXConvert WXTextWeight:styles[@"fontWeight"]];
@@ -347,8 +300,11 @@ WX_EXPORT_METHOD(@selector(blur))
     if (styles[@"fontFamily"]) {
         _fontFamily = [WXConvert NSString:styles[@"fontFamily"]];
     }
+    [self setTextFont];
+    
     if (styles[@"textAlign"]) {
-        [_inputView setTextAlignment:[WXConvert NSTextAlignment:styles[@"textAlign"]]] ;
+        _textAlignForStyle = [WXConvert NSTextAlignment:styles[@"textAlign"]];
+        [_inputView setTextAlignment:_textAlignForStyle] ;
     }
     if (styles[@"placeholderColor"]) {
         _placeholderColor = [WXConvert UIColor:styles[@"placeholderColor"]];
@@ -356,7 +312,12 @@ WX_EXPORT_METHOD(@selector(blur))
         _placeholderColor = [UIColor colorWithRed:0x99/255.0 green:0x99/255.0 blue:0x99/255.0 alpha:1.0];
     }
     [self setPlaceholderAttributedString];
+    [self updatePattern];
     
+}
+
+-(void)updatePattern
+{
     UIEdgeInsets padding = UIEdgeInsetsMake(self.cssNode->style.padding[CSS_TOP], self.cssNode->style.padding[CSS_LEFT], self.cssNode->style.padding[CSS_BOTTOM], self.cssNode->style.padding[CSS_RIGHT]);
     if (!UIEdgeInsetsEqualToEdgeInsets(padding, _padding)) {
         [self setPadding:padding];
@@ -366,8 +327,6 @@ WX_EXPORT_METHOD(@selector(blur))
     if (!UIEdgeInsetsEqualToEdgeInsets(border, _border)) {
         [self setBorder:border];
     }
-    
-    [self setTextFont];
 }
 
 - (CGSize (^)(CGSize))measureBlock
@@ -386,11 +345,11 @@ WX_EXPORT_METHOD(@selector(blur))
         }
         
         if (!isnan(weakSelf.cssNode->style.minDimensions[CSS_HEIGHT])) {
-            computedSize.width = MAX(computedSize.height, weakSelf.cssNode->style.minDimensions[CSS_HEIGHT]);
+            computedSize.height = MAX(computedSize.height, weakSelf.cssNode->style.minDimensions[CSS_HEIGHT]);
         }
         
         if (!isnan(weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT])) {
-            computedSize.width = MIN(computedSize.height, weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT]);
+            computedSize.height = MIN(computedSize.height, weakSelf.cssNode->style.maxDimensions[CSS_HEIGHT]);
         }
         
         return (CGSize) {
@@ -400,20 +359,8 @@ WX_EXPORT_METHOD(@selector(blur))
     };
 }
 
--(UIColor *)covertColor:(id)value
-{
-    UIColor *color = [WXConvert UIColor:value];
-    if(value) {
-        NSString *str = [WXConvert NSString:value];
-        if(str && [@"" isEqualToString:str]) {
-            color = [UIColor blackColor];
-        }
-    }
-    return color;
-}
-
-#pragma mark -
 #pragma mark WXDatePickerManagerDelegate
+
 -(void)fetchDatePickerValue:(NSString *)value
 {
     _inputView.text = value;
@@ -445,6 +392,7 @@ WX_EXPORT_METHOD(@selector(blur))
     if (_focusEvent) {
         [self fireEvent:@"focus" params:nil];
     }
+    [self handlePseudoClass];
 }
 
 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
@@ -471,6 +419,9 @@ WX_EXPORT_METHOD(@selector(blur))
     if (_blurEvent) {
         [self fireEvent:@"blur" params:nil];
     }
+    if(self.pseudoClassStyles && [self.pseudoClassStyles count]>0){
+        [self recoveryPseudoStyles:self.styles];
+    }
 }
 
 - (void)textFiledEditChanged:(NSNotification *)notifi
@@ -485,11 +436,11 @@ WX_EXPORT_METHOD(@selector(blur))
 - (void)setViewMovedUp:(BOOL)movedUp
 {
     UIView *rootView = self.weexInstance.rootView;
-    CGRect rect = _rootViewOriginFrame;
+    CGRect rect = self.weexInstance.frame;
     CGRect rootViewFrame = rootView.frame;
     CGRect inputFrame = [_inputView.superview convertRect:_inputView.frame toView:rootView];
     if (movedUp) {
-        CGFloat offset =inputFrame.origin.y-(rootViewFrame.size.height-_keyboardSize.height-inputFrame.size.height);
+        CGFloat offset = inputFrame.origin.y-(rootViewFrame.size.height-_keyboardSize.height-inputFrame.size.height);
         if (offset > 0) {
             rect = (CGRect){
                 .origin.x = 0.f,
@@ -497,18 +448,14 @@ WX_EXPORT_METHOD(@selector(blur))
                 .size = rootViewFrame.size
             };
         }
-    }else {
-        // revert back to the origin state
-        rect = _rootViewOriginFrame;
-        _rootViewOriginFrame = CGRectNull;
     }
     self.weexInstance.rootView.frame = rect;
 }
 
 
-#pragma mark
+#pragma mark private method
 
--(BOOL)isDateType
+- (BOOL)isDateType
 {
     if([_inputType isEqualToString:@"date"] || [_inputType isEqualToString:@"time"])
         return YES;
@@ -517,16 +464,14 @@ WX_EXPORT_METHOD(@selector(blur))
 
 - (void)setPlaceholderAttributedString
 {
-    if (_placeholderColor) {
-        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:_placeholder];
-        [attributedString addAttribute:NSForegroundColorAttributeName value:_placeholderColor range:NSMakeRange(0, _placeholder.length)];
-        [_inputView setAttributedPlaceholder:attributedString];
-    }
+    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:_placeholderString];
+    [attributedString addAttribute:NSForegroundColorAttributeName value:_placeholderColor range:NSMakeRange(0, _placeholderString.length)];
+    [_inputView setAttributedPlaceholder:attributedString];
 }
 
 - (void)setTextFont
 {
-    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily];
+    UIFont *font = [WXUtility fontWithSize:_fontSize textWeight:_fontWeight textStyle:_fontStyle fontFamily:_fontFamily scaleFactor:self.weexInstance.pixelScaleFactor];
     [_inputView setFont:font];
 }
 
@@ -551,26 +496,27 @@ WX_EXPORT_METHOD(@selector(blur))
     }
 }
 
-- (void)setType:(NSString*)type
+- (void)setType
 {
     [_inputView setKeyboardType:UIKeyboardTypeDefault];
     [_inputView setSecureTextEntry:NO];
-    _inputType = type;
     
-    if ([type isEqualToString:@"text"]) {
+    if ([_inputType isEqualToString:@"text"]) {
         [_inputView setKeyboardType:UIKeyboardTypeDefault];
-    }
-    else if ([type isEqualToString:@"password"]) {
+    }else if ([_inputType isEqualToString:@"password"]) {
         [_inputView setSecureTextEntry:YES];
-    }
-    else if ([type isEqualToString:@"tel"]) {
+    }else if ([_inputType isEqualToString:@"tel"]) {
         [_inputView setKeyboardType:UIKeyboardTypePhonePad];
-    }
-    else if ([type isEqualToString:@"email"]) {
+    }else if ([_inputType isEqualToString:@"email"]) {
         [_inputView setKeyboardType:UIKeyboardTypeEmailAddress];
-    }
-    else if ([type isEqualToString:@"url"]) {
+    }else if ([_inputType isEqualToString:@"url"]) {
         [_inputView setKeyboardType:UIKeyboardTypeURL];
+    }else if ([self isDateType]) {
+        if (!_datePickerManager) {
+            _datePickerManager = [[WXDatePickerManager alloc] init];
+            _datePickerManager.delegate = self;
+        }
+        [_datePickerManager updateDatePicker:_attr];
     }
 }
 
@@ -586,6 +532,37 @@ WX_EXPORT_METHOD(@selector(blur))
     [_inputView setBorder:border];
 }
 
+#pragma mark update touch styles
+-(void)handlePseudoClass
+{
+    NSMutableDictionary *styles = [NSMutableDictionary new];
+    NSMutableDictionary *recordStyles = [NSMutableDictionary new];
+    if(_disabled){
+        recordStyles = [self getPseudoClassStylesByKeys:@[@"disabled"]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }else {
+        recordStyles = [NSMutableDictionary new];
+        recordStyles = [self getPseudoClassStylesByKeys:@[@"enabled"]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }
+    if ([_inputView isFirstResponder]){
+        recordStyles = [NSMutableDictionary new];
+        recordStyles = [self getPseudoClassStylesByKeys:@[@"focus"]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }
+    NSString *disabledStr = @"enabled";
+    if (_disabled){
+        disabledStr = @"disabled";
+    }
+    if ([_inputView isFirstResponder]) {
+        NSString *focusStr = @"focus";
+        recordStyles = [NSMutableDictionary new];
+        recordStyles = [self getPseudoClassStylesByKeys:@[focusStr,disabledStr]];
+        [styles addEntriesFromDictionary:recordStyles];
+    }
+    [self updatePseudoClassStyles:styles];
+}
+
 #pragma mark keyboard
 - (void)keyboardWasShown:(NSNotification*)notification
 {
@@ -601,9 +578,6 @@ WX_EXPORT_METHOD(@selector(blur))
     _keyboardSize = end.size;
     UIView * rootView = self.weexInstance.rootView;
     CGRect screenRect = [[UIScreen mainScreen] bounds];
-    if (CGRectIsNull(_rootViewOriginFrame)) {
-        _rootViewOriginFrame = rootView.frame;
-    }
     CGRect keyboardRect = (CGRect){
         .origin.x = 0,
         .origin.y = CGRectGetMaxY(screenRect) - _keyboardSize.height - 54,
@@ -622,7 +596,7 @@ WX_EXPORT_METHOD(@selector(blur))
         return;
     }
     UIView * rootView = self.weexInstance.rootView;
-    if (rootView.frame.origin.y < 0) {
+    if (!CGRectEqualToRect(self.weexInstance.frame, rootView.frame)) {
         [self setViewMovedUp:NO];
         self.weexInstance.isRootViewFrozen = NO;
     }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Component/WXTransform.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTransform.h b/ios/sdk/WeexSDK/Sources/Component/WXTransform.h
index aab6d59..1fed421 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTransform.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTransform.h
@@ -8,11 +8,14 @@
 
 #import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
+@class WXSDKInstance;
 
 @interface WXTransform : NSObject
 
 @property CGAffineTransform transform;
 
+- (instancetype)initWithInstance:(WXSDKInstance *)instance NS_DESIGNATED_INITIALIZER;
+
 - (CATransform3D)getTransform:(NSString *)cssValue;
 - (CATransform3D)getTransform:(NSString *)cssValue withView:(UIView *)view;
 - (CATransform3D)getTransform:(NSString *)cssValue withView:(UIView *)view withOrigin:(NSString *)origin;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
index b10dbd5..e25bd5c 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
@@ -9,12 +9,14 @@
 #import "WXTransform.h"
 #import "math.h"
 #import "WXUtility.h"
+#import "WXSDKInstance.h"
 
 @interface WXTransform()
 
 @property (nonatomic, weak) UIView *view;
 @property (nonatomic, assign) float rotateAngle;
 @property (nonatomic, assign) BOOL isTransformRotate;
+@property (nonatomic, weak) WXSDKInstance *weexInstance;
 
 @end
 
@@ -22,9 +24,15 @@
 
 - (instancetype)init
 {
+    return [self initWithInstance:nil];
+}
+
+- (instancetype)initWithInstance:(WXSDKInstance *)weexInstance;
+{
     if (self = [super init]) {
         _isTransformRotate = YES;
         _rotateAngle = 0.0;
+        _weexInstance = weexInstance;
     }
     
     return self;
@@ -124,14 +132,14 @@
                 if ([value hasSuffix:@"%"]) {
                     val *= width / 100;
                 } else {
-                    val = WXPixelResize(val);
+                    val = WXPixelScale(val, self.weexInstance.pixelScaleFactor);
                 }
                 x = val;
             } else {
                 if ([value hasSuffix:@"%"]) {
                     val *= height / 100;
                 } else {
-                    val = WXPixelResize(val);
+                    val = WXPixelScale(val, self.weexInstance.pixelScaleFactor);
                 }
                 y = val;
             }
@@ -139,7 +147,9 @@
     }
     x -= width / 2.0;
     y -= height / 2.0;
-    return CGPointMake(round(x / WXScreenResizeRadio()), round(y / WXScreenResizeRadio()));
+    
+    CGFloat scaleFactor = self.weexInstance.pixelScaleFactor;
+    return CGPointMake(round(x / scaleFactor), round(y / scaleFactor));
 }
 
 // Angle in radians
@@ -159,7 +169,7 @@
     if ([value[0] hasSuffix:@"%"] && _view) {
         x *= _view.bounds.size.width / 100;
     } else {
-        x = WXPixelResize(x);
+        x = WXPixelScale(x, self.weexInstance.pixelScaleFactor);
     }
 
     double y = 0;
@@ -169,7 +179,7 @@
         if ([value[1] hasSuffix:@"%"] && _view) {
             y *= _view.bounds.size.height / 100;
         } else {
-            y = WXPixelResize(y);
+            y = WXPixelScale(y, self.weexInstance.pixelScaleFactor);
         }
     }
     _transform = CGAffineTransformTranslate(_transform, x, y);
@@ -188,8 +198,9 @@
 - (void)doRotate:(NSArray *)value
 {
     float rotateAngle = [self getAngle:value[0]];
-    
-    if (_isTransformRotate || rotateAngle <= M_PI+0.0001) {
+    CGAffineTransform cgTransform = CATransform3DGetAffineTransform(_view.layer.transform);
+    float originAngle = atan2f(cgTransform.b, cgTransform.a) * (180 / M_PI);
+    if (_isTransformRotate || fabs(rotateAngle - originAngle) <= M_PI+0.0001){
         _transform = CGAffineTransformRotate(_transform, rotateAngle);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
index 4b8cad2..135ba96 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
@@ -140,7 +140,7 @@
 - (void)setURL:(NSURL *)URL
 {
     NSMutableString *urlStr = nil;
-    WX_REWRITE_URL(URL.absoluteString, WXResourceTypeLink, self.weexSDKInstance, &urlStr)
+    WX_REWRITE_URL(URL.absoluteString, WXResourceTypeVideo, self.weexSDKInstance, &urlStr)
     
     if (!urlStr) {
         return;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Controller/WXBaseViewController.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Controller/WXBaseViewController.m b/ios/sdk/WeexSDK/Sources/Controller/WXBaseViewController.m
index fe8fff9..47ce11a 100644
--- a/ios/sdk/WeexSDK/Sources/Controller/WXBaseViewController.m
+++ b/ios/sdk/WeexSDK/Sources/Controller/WXBaseViewController.m
@@ -76,32 +76,15 @@
     }
 }
 
-- (void)addEdgePop
-{
-    UIScreenEdgePanGestureRecognizer *edgePanGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(edgePanGesture:)];
-    edgePanGestureRecognizer.delegate = self;
-    edgePanGestureRecognizer.edges = UIRectEdgeLeft;
-    [self.view addGestureRecognizer:edgePanGestureRecognizer];
-}
-
-- (void)edgePanGesture:(UIScreenEdgePanGestureRecognizer*)edgePanGestureRecognizer
-{
-    [self.navigationController popViewControllerAnimated:YES];
-}
-
-#pragma mark- UIGestureRecognizerDelegate
-
-- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
+- (void)viewWillDisappear:(BOOL)animated
 {
-    if (!self.navigationController || [self.navigationController.viewControllers count] == 1) {
-        return NO;
-    }
-    return YES;
+    [_instance fireGlobalEvent:WX_APPLICATION_WILL_RESIGN_ACTIVE params:nil];
 }
 
 - (void)viewDidAppear:(BOOL)animated
 {
     [super viewDidAppear:animated];
+    [_instance fireGlobalEvent:WX_APPLICATION_DID_BECOME_ACTIVE params:nil];
     [self _updateInstanceState:WeexInstanceAppear];
 }
 
@@ -123,6 +106,29 @@
     [self _renderWithURL:_sourceURL];
 }
 
+- (void)addEdgePop
+{
+    UIScreenEdgePanGestureRecognizer *edgePanGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(edgePanGesture:)];
+    edgePanGestureRecognizer.delegate = self;
+    edgePanGestureRecognizer.edges = UIRectEdgeLeft;
+    [self.view addGestureRecognizer:edgePanGestureRecognizer];
+}
+
+- (void)edgePanGesture:(UIScreenEdgePanGestureRecognizer*)edgePanGestureRecognizer
+{
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
+#pragma mark- UIGestureRecognizerDelegate
+
+- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
+{
+    if (!self.navigationController || [self.navigationController.viewControllers count] == 1) {
+        return NO;
+    }
+    return YES;
+}
+
 - (void)_renderWithURL:(NSURL *)sourceURL
 {
     if (!sourceURL) {
@@ -143,7 +149,7 @@
     } else {
         newURL = [NSString stringWithFormat:@"%@?random=%d", sourceURL.absoluteString, arc4random()];
     }
-    [_instance renderWithURL:[NSURL URLWithString:newURL] options:@{@"bundleUrl":sourceURL} data:nil];
+    [_instance renderWithURL:[NSURL URLWithString:newURL] options:@{@"bundleUrl":sourceURL.absoluteString} data:nil];
     
     __weak typeof(self) weakSelf = self;
     _instance.onCreate = ^(UIView *view) {

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.m b/ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.m
index 99cef47..1d9d649 100644
--- a/ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.m
+++ b/ios/sdk/WeexSDK/Sources/Debug/WXDebugTool.m
@@ -13,6 +13,9 @@
 #import "WXUtility.h"
 #import "WXSDKManager.h"
 #import "WXSDKEngine.h"
+#import "WXResourceRequest.h"
+#import "WXResourceResponse.h"
+#import "WXResourceLoader.h"
 
 static BOOL WXIsDebug;
 static BOOL WXIsDevToolDebug;
@@ -69,7 +72,7 @@ static NSString* WXDebugrepJSFramework;
         if ([key isEqualToString:@"jsframework"]) {
             WXDebugrepJSFramework = script;
             [WXSDKManager unload];
-            [WXSDKEngine initSDKEnviroment:script];
+            [WXSDKEngine initSDKEnvironment:script];
         }else {
             WXDebugrepBundleJS = script;
         }
@@ -88,33 +91,24 @@ static NSString* WXDebugrepJSFramework;
         });
     } else {
         // HTTP/HTTPS URL
-        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
-        [request setValue:[WXUtility userAgent] forHTTPHeaderField:@"User-Agent"];
+        WXResourceRequest *request = [WXResourceRequest requestWithURL:url resourceType:WXResourceTypeMainBundle referrer:nil cachePolicy:NSURLRequestUseProtocolCachePolicy];
+        request.userAgent = [WXUtility userAgent];
+        WXResourceLoader *loader = [[WXResourceLoader alloc] initWithRequest:request];
         
-        id<WXNetworkProtocol> networkHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXNetworkProtocol)];
+        loader.onFinished = ^(const WXResourceResponse * response, NSData *data) {
+            if ([response isKindOfClass:[NSHTTPURLResponse class]] && ((NSHTTPURLResponse *)response).statusCode != 200) {
+                __unused NSError *error = [NSError errorWithDomain:WX_ERROR_DOMAIN
+                                                              code:((NSHTTPURLResponse *)response).statusCode
+                                                          userInfo:@{@"message":@"status code error."}];
+                
+                return ;
+            }
+            
+            NSString * script = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+            scriptLoadFinish(key, script);
+        };
         
-        __block NSURLResponse *urlResponse;
-        [networkHandler sendRequest:request
-                    withSendingData:^(int64_t bytesSent, int64_t totalBytes) {}
-                       withResponse:^(NSURLResponse *response) {
-                           urlResponse = response;
-                       }
-                    withReceiveData:^(NSData *data) {}
-                    withCompeletion:^(NSData *totalData, NSError *error) {
-                        if (error) {
-                            
-                        } else {
-                            if ([urlResponse isKindOfClass:[NSHTTPURLResponse class]] && ((NSHTTPURLResponse *)urlResponse).statusCode != 200) {
-                                __unused NSError *error = [NSError errorWithDomain:WX_ERROR_DOMAIN
-                                                                     code:((NSHTTPURLResponse *)urlResponse).statusCode
-                                                                 userInfo:@{@"message":@"status code error."}];
-                                
-                                return ;
-                            }
-                            NSString * script = [[NSString alloc] initWithData:totalData encoding:NSUTF8StringEncoding];
-                            scriptLoadFinish(key, script);
-                        }
-                    }];
+        [loader start];
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/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 59d65f0..b2fcb54 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
@@ -16,6 +16,7 @@
 #import "WXThreadSafeCounter.h"
 #import "UIBezierPath+Weex.h"
 #import "WXRoundedRect.h"
+#import "WXSDKInstance.h"
 
 #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
 
@@ -435,10 +436,45 @@ do {\
     }\
 } while (0);
     
+// TODO: refactor this hopefully
+#define WX_CHECK_BORDER_PROP_PIXEL(prop, direction1, direction2, direction3, direction4)\
+do {\
+    BOOL needsDisplay = NO; \
+    NSString *styleProp= WX_NSSTRING(WX_CONCAT(border, prop));\
+    if (styles[styleProp]) {\
+        _border##direction1##prop = _border##direction2##prop = _border##direction3##prop = _border##direction4##prop = [WXConvert WXPixelType:styles[styleProp] scaleFactor:self.weexInstance.pixelScaleFactor];\
+    needsDisplay = YES;\
+    }\
+    NSString *styleDirection1Prop = WX_NSSTRING(WX_CONCAT_TRIPLE(border, direction1, prop));\
+    if (styles[styleDirection1Prop]) {\
+        _border##direction1##prop = [WXConvert WXPixelType:styles[styleDirection1Prop] scaleFactor:self.weexInstance.pixelScaleFactor];\
+        needsDisplay = YES;\
+    }\
+    NSString *styleDirection2Prop = WX_NSSTRING(WX_CONCAT_TRIPLE(border, direction2, prop));\
+    if (styles[styleDirection2Prop]) {\
+        _border##direction2##prop = [WXConvert WXPixelType:styles[styleDirection2Prop] scaleFactor:self.weexInstance.pixelScaleFactor];\
+        needsDisplay = YES;\
+    }\
+    NSString *styleDirection3Prop = WX_NSSTRING(WX_CONCAT_TRIPLE(border, direction3, prop));\
+    if (styles[styleDirection3Prop]) {\
+        _border##direction3##prop = [WXConvert WXPixelType:styles[styleDirection3Prop] scaleFactor:self.weexInstance.pixelScaleFactor];\
+        needsDisplay = YES;\
+    }\
+    NSString *styleDirection4Prop = WX_NSSTRING(WX_CONCAT_TRIPLE(border, direction4, prop));\
+    if (styles[styleDirection4Prop]) {\
+        _border##direction4##prop = [WXConvert WXPixelType:styles[styleDirection4Prop] scaleFactor:self.weexInstance.pixelScaleFactor];\
+        needsDisplay = YES;\
+    }\
+    if (needsDisplay && updating) {\
+        [self setNeedsDisplay];\
+    }\
+} while (0);
+    
+    
     WX_CHECK_BORDER_PROP(Style, Top, Left, Bottom, Right, WXBorderStyle)
     WX_CHECK_BORDER_PROP(Color, Top, Left, Bottom, Right, UIColor)
-    WX_CHECK_BORDER_PROP(Width, Top, Left, Bottom, Right, WXPixelType)
-    WX_CHECK_BORDER_PROP(Radius, TopLeft, TopRight, BottomLeft, BottomRight, WXPixelType)
+    WX_CHECK_BORDER_PROP_PIXEL(Width, Top, Left, Bottom, Right)
+    WX_CHECK_BORDER_PROP_PIXEL(Radius, TopLeft, TopRight, BottomLeft, BottomRight)
 
     if (updating) {
         BOOL nowNeedsDrawBorder = [self _needsDrawBorder];

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h
index eaceaee..ad2f742 100644
--- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h
+++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.h
@@ -13,7 +13,12 @@
 @interface WXSDKEngine : NSObject
 
 /**
- *  @abstract Registers a module for a given name
+ *  @abstract Register default modules/components/handlers, they will be reigstered only once.
+ **/
++ (void)registerDefaults;
+
+/**
+ *  @abstract Register a module for a given name
  *
  *  @param name The module name to register
  *
@@ -45,6 +50,38 @@
 + (void)registerComponent:(NSString *)name withClass:(Class)clazz withProperties:(NSDictionary *)properties;
 
 /**
+ * @abstract Registers a component for a given name, options and js code
+ *
+ * @param name The service name to register
+ *
+ * @param options The service options to register
+ *
+ * @param code service js code to invoke
+ *
+ */
++ (void)registerService:(NSString *)name withScript:(NSString *)serviceScript withOptions:(NSDictionary *)options;
+
+/**
+ * @abstract Registers a component for a given name, options and js url
+ *
+ * @param name The service name to register
+ *
+ * @param options The service options to register
+ *
+ * @param url The service url to register
+ *
+ */
++ (void)registerService:(NSString *)name withScriptUrl:(NSURL *)serviceScriptUrl WithOptions:(NSDictionary *)options;
+
+/**
+ * @abstract Registers a component for a given name, options and js code
+ *
+ * @param name The name of register service
+ *
+ */
++ (void)unregisterService:(NSString *)name;
+
+/**
  * @abstract Registers a handler for a given handler instance and specific protocol
  *
  * @param handler The handler instance to register
@@ -54,6 +91,7 @@
  */
 + (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol;
 
+
 /**
  * @abstract Returns a given handler instance for specific protocol
  *
@@ -68,13 +106,13 @@
  * @discussion Injects main.js in app bundle as default JSFramework script.
  *
  **/
-+ (void)initSDKEnviroment;
++ (void)initSDKEnvironment;
 
 /**
  * @abstract Initializes the enviroment with a given JSFramework script.
  *
  **/
-+ (void)initSDKEnviroment:(NSString *)script;
++ (void)initSDKEnvironment:(NSString *)script;
 
 /**
  * @abstract Unloads the bridge context
@@ -124,3 +162,10 @@
 + (void)connectDevToolServer:(NSString *)URL;
 
 @end
+
+@interface WXSDKEngine (Deprecated)
+
++ (void)initSDKEnviroment DEPRECATED_MSG_ATTRIBUTE("To fix typo, use initSDKEnvironment method instead.");
++ (void)initSDKEnviroment:(NSString *)script DEPRECATED_MSG_ATTRIBUTE("To fix typo,  use initSDKEnvironment: method instead.");
+
+@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
index 43489de..a23e03e 100644
--- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
+++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
@@ -10,11 +10,14 @@
 #import "WXModuleFactory.h"
 #import "WXHandlerFactory.h"
 #import "WXComponentFactory.h"
+#import "WXBridgeManager.h"
 
 #import "WXAppConfiguration.h"
-#import "WXNetworkDefaultImpl.h"
+#import "WXResourceRequestHandlerDefaultImpl.h"
 #import "WXNavigationDefaultImpl.h"
 #import "WXURLRewriteDefaultImpl.h"
+#import "WXWebSocketDefaultImpl.h"
+
 #import "WXSDKManager.h"
 #import "WXSDKError.h"
 #import "WXMonitor.h"
@@ -43,6 +46,8 @@
     [self registerModule:@"globalEvent" withClass:NSClassFromString(@"WXGlobalEventModule")];
     [self registerModule:@"canvas" withClass:NSClassFromString(@"WXCanvasModule")];
     [self registerModule:@"picker" withClass:NSClassFromString(@"WXPickerModule")];
+    [self registerModule:@"meta" withClass:NSClassFromString(@"WXMetaModule")];
+    [self registerModule:@"webSocket" withClass:NSClassFromString(@"WXWebSocketModule")];
 }
 
 + (void)registerModule:(NSString *)name withClass:(Class)clazz
@@ -114,14 +119,33 @@
     }
 }
 
+
+# pragma mark Service Register
++ (void)registerService:(NSString *)name withScript:(NSString *)serviceScript withOptions:(NSDictionary *)options
+{
+    [[WXSDKManager bridgeMgr] registerService:name withService:serviceScript withOptions:options];
+}
+
++ (void)registerService:(NSString *)name withScriptUrl:(NSURL *)serviceScriptUrl WithOptions:(NSDictionary *)options
+{
+    [[WXSDKManager bridgeMgr] registerService:name withServiceUrl:serviceScriptUrl withOptions:options];
+}
+
++ (void)unregisterService:(NSString *)name
+{
+    [[WXSDKManager bridgeMgr] unregisterService:name];
+}
+
 # pragma mark Handler Register
 
 // register some default handlers when the engine initializes.
 + (void)_registerDefaultHandlers
 {
-    [self registerHandler:[WXNetworkDefaultImpl new] withProtocol:@protocol(WXNetworkProtocol)];
+    [self registerHandler:[WXResourceRequestHandlerDefaultImpl new] withProtocol:@protocol(WXResourceRequestHandler)];
     [self registerHandler:[WXNavigationDefaultImpl new] withProtocol:@protocol(WXNavigationProtocol)];
     [self registerHandler:[WXURLRewriteDefaultImpl new] withProtocol:@protocol(WXURLRewriteProtocol)];
+    [self registerHandler:[WXWebSocketDefaultImpl new] withProtocol:@protocol(WXWebSocketHandler)];
+
 }
 
 + (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol
@@ -140,14 +164,14 @@
 
 # pragma mark SDK Initialize
 
-+ (void)initSDKEnviroment
++ (void)initSDKEnvironment
 {
     WX_MONITOR_PERF_START(WXPTInitalize)
     WX_MONITOR_PERF_START(WXPTInitalizeSync)
     
     NSString *filePath = [[NSBundle mainBundle] pathForResource:@"main" ofType:@"js"];
     NSString *script = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
-    [WXSDKEngine initSDKEnviroment:script];
+    [WXSDKEngine initSDKEnvironment:script];
     
     WX_MONITOR_PERF_END(WXPTInitalizeSync)
     
@@ -177,20 +201,28 @@
 #endif
 }
 
-+ (void)initSDKEnviroment:(NSString *)script
++ (void)initSDKEnvironment:(NSString *)script
 {
     if (!script || script.length <= 0) {
         WX_MONITOR_FAIL(WXMTJSFramework, WX_ERR_JSFRAMEWORK_LOAD, @"framework loading is failure!");
         return;
     }
     
-    [self _registerDefaultComponents];
-    [self _registerDefaultModules];
-    [self _registerDefaultHandlers];
+    [self registerDefaults];
     
     [[WXSDKManager bridgeMgr] executeJsFramework:script];
 }
 
++ (void)registerDefaults
+{
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        [self _registerDefaultComponents];
+        [self _registerDefaultModules];
+        [self _registerDefaultHandlers];
+    });
+}
+
 + (NSString*)SDKEngineVersion
 {
     return WX_SDK_VERSION;
@@ -279,3 +311,17 @@ static NSDictionary *_customEnvironment;
 }
 
 @end
+
+@implementation WXSDKEngine (Deprecated)
+
++ (void)initSDKEnviroment
+{
+    [self initSDKEnvironment];
+}
+
++ (void)initSDKEnviroment:(NSString *)script
+{
+    [self initSDKEnvironment:script];
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h b/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
index 160a222..a0d69c7 100644
--- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
+++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
@@ -34,9 +34,10 @@ typedef NS_ENUM(int, WXSDKErrCode)
     WX_ERR_RENDER_SCROLLTOELEMENT = -2110,
     WX_ERR_RENDER_END = -2199,
     
-    WX_ERR_JSDOWNLOAD_START = -2201,
+    WX_ERR_DOWNLOAD_START = -2201,
     WX_ERR_JSBUNDLE_DOWNLOAD = -2202,
     WX_ERR_JSBUNDLE_STRING_CONVERT = -2203,
-    WX_ERR_JSDOWNLOAD_END = -2299,
+    WX_ERR_CANCEL = -2204,
+    WX_ERR_DOWNLOAD_END = -2299,
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
index 501d7e0..c29ab4c 100644
--- a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
+++ b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
@@ -10,11 +10,14 @@
 #import "WXComponent.h"
 #import "WXComponent_internal.h"
 #import "WXSDKInstance.h"
+#import "WXComponentManager.h"
 #import "WXAssert.h"
 #import "WXUtility.h"
 #import "WXSDKManager.h"
+#import "WXSDKInstance_private.h"
 #import <objc/runtime.h>
 #import <UIKit/UIGestureRecognizerSubclass.h>
+#import "WXComponent+PseudoClassManagement.h"
 
 #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
 
@@ -71,6 +74,7 @@
 @property (nonatomic, assign) BOOL listenTouchMove;
 @property (nonatomic, assign) BOOL listenTouchEnd;
 @property (nonatomic, assign) BOOL listenTouchCancel;
+@property (nonatomic, assign) BOOL listenPseudoTouch;
 
 - (instancetype)initWithComponent:(WXComponent *)component NS_DESIGNATED_INITIALIZER;
 
@@ -122,12 +126,18 @@ if ([removeEventName isEqualToString:@#eventName]) {\
 
 - (void)_initEvents:(NSArray *)events
 {
-    NSArray *eventsCopy = [events copy];
-    for (NSString *addEventName in eventsCopy) {
+    for (NSString *addEventName in events) {
         [self _addEventOnMainThread:addEventName];
     }
 }
 
+- (void)_initPseudoEvents:(BOOL)isListenPseudoTouch
+{
+    if(isListenPseudoTouch) {
+        self.touchGesture.listenPseudoTouch = YES;
+    }
+}
+
 - (void)_addEventOnMainThread:(NSString *)addEventName
 {
     WX_ADD_EVENT(appear, addAppearEvent)
@@ -141,6 +151,9 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     WX_ADD_EVENT(panmove, addPanMoveEvent)
     WX_ADD_EVENT(panend, addPanEndEvent)
     
+    WX_ADD_EVENT(horizontalpan, addHorizontalPanEvent)
+    WX_ADD_EVENT(verticalpan, addVerticalPanEvent)
+    
     WX_ADD_EVENT(touchstart, addTouchStartEvent)
     WX_ADD_EVENT(touchmove, addTouchMoveEvent)
     WX_ADD_EVENT(touchend, addTouchEndEvent)
@@ -162,11 +175,18 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     WX_REMOVE_EVENT(panmove, removePanMoveEvent)
     WX_REMOVE_EVENT(panend, removePanEndEvent)
     
+    WX_REMOVE_EVENT(horizontalpan, removeHorizontalPanEvent)
+    WX_REMOVE_EVENT(verticalpan, removeVerticalPanEvent)
+    
     WX_REMOVE_EVENT(touchstart, removeTouchStartEvent)
     WX_REMOVE_EVENT(touchmove, removeTouchMoveEvent)
     WX_REMOVE_EVENT(touchend, removeTouchEndEvent)
     WX_REMOVE_EVENT(touchcancel, removeTouchCancelEvent)
     
+    if(_isListenPseudoTouch) {
+        self.touchGesture.listenPseudoTouch = NO;
+    }
+
     [self removeEvent:removeEventName];
 }
 
@@ -177,11 +197,16 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     [self removePanStartEvent];
     [self removePanMoveEvent];
     [self removePanEndEvent];
+    [self removeHorizontalPanEvent];
+    [self removeVerticalPanEvent];
+    
     [self removeTouchStartEvent];
     [self removeTouchMoveEvent];
     [self removeTouchEndEvent];
     [self removeTouchCancelEvent];
     [self removeSwipeEvent];
+    [self removePseudoTouchEvent];
+
 }
 
 #pragma mark - Appear & Disappear
@@ -210,6 +235,12 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     [self.ancestorScroller removeScrollToListener:self];
 }
 
+- (void)removePseudoTouchEvent
+{
+    _touchGesture.listenPseudoTouch = NO;
+    [self checkRemoveTouchGesture];
+}
+
 #pragma mark - Click Event
 
 - (void)addClickEvent
@@ -232,13 +263,14 @@ if ([removeEventName isEqualToString:@#eventName]) {\
 - (void)onClick:(__unused UITapGestureRecognizer *)recognizer
 {
     NSMutableDictionary *position = [[NSMutableDictionary alloc] initWithCapacity:4];
+    CGFloat scaleFactor = self.weexInstance.pixelScaleFactor;
     
     if (!CGRectEqualToRect(self.calculatedFrame, CGRectZero)) {
         CGRect frame = [self.view.superview convertRect:self.calculatedFrame toView:self.view.window];
-        position[@"x"] = @(frame.origin.x/WXScreenResizeRadio());
-        position[@"y"] = @(frame.origin.y/WXScreenResizeRadio());
-        position[@"width"] = @(frame.size.width/WXScreenResizeRadio());
-        position[@"height"] = @(frame.size.height/WXScreenResizeRadio());
+        position[@"x"] = @(frame.origin.x/scaleFactor);
+        position[@"y"] = @(frame.origin.y/scaleFactor);
+        position[@"width"] = @(frame.size.width/scaleFactor);
+        position[@"height"] = @(frame.size.height/scaleFactor);
     }
 
     [self fireEvent:@"click" params:@{@"position":position}];
@@ -357,7 +389,7 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     }
 }
 
-#pragma makr - Pan
+#pragma mark - Pan
 
 - (void)addPanGesture
 {
@@ -386,22 +418,56 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     [self addPanGesture];
 }
 
+- (void)addHorizontalPanEvent
+{
+    _listenHorizontalPan = YES;
+    [self addPanGesture];
+}
+
+- (void)addVerticalPanEvent
+{
+    _listenVerticalPan = YES;
+    [self addPanGesture];
+}
+
+
 - (void)onPan:(UIPanGestureRecognizer *)gesture
 {
     CGPoint screenLocation = [gesture locationInView:self.view.window];
     CGPoint pageLoacation = [gesture locationInView:self.weexInstance.rootView];
     NSString *eventName;
+    NSString *state = @"";
     NSDictionary *resultTouch = [self touchResultWithScreenLocation:screenLocation pageLocation:pageLoacation identifier:gesture.wx_identifier];
     
     if (gesture.state == UIGestureRecognizerStateBegan) {
-        eventName = @"panstart";
+        if (_listenPanStart) {
+            eventName = @"panstart";
+        }
+        state = @"start";
     } else if (gesture.state == UIGestureRecognizerStateEnded) {
-        eventName = @"panend";
+        if (_listenPanEnd) {
+            eventName = @"panend";
+        }
+        state = @"end";
         gesture.wx_identifier = nil;
     } else if (gesture.state == UIGestureRecognizerStateChanged) {
-        eventName = @"panmove";
+        if (_listenPanMove) {
+             eventName = @"panmove";
+        }
+        state = @"move";
     }
     
+    
+    CGPoint translation = [_panGesture translationInView:self.view];
+    
+    if (_listenHorizontalPan && fabs(translation.y) <= fabs(translation.x)) {
+        [self fireEvent:@"horizontalpan" params:@{@"state":state, @"changedTouches":resultTouch ? @[resultTouch] : @[]}];
+    }
+        
+    if (_listenVerticalPan && fabs(translation.y) > fabs(translation.x)) {
+        [self fireEvent:@"verticalpan" params:@{@"state":state, @"changedTouches":resultTouch ? @[resultTouch] : @[]}];
+    }
+        
     if (eventName) {
         [self fireEvent:eventName params:@{@"changedTouches":resultTouch ? @[resultTouch] : @[]}];
     }
@@ -425,9 +491,24 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     [self checkRemovePanGesture];
 }
 
+- (void)removeHorizontalPanEvent
+{
+    _listenHorizontalPan = NO;
+    [self checkRemovePanGesture];
+}
+
+- (void)removeVerticalPanEvent
+{
+    _listenVerticalPan = NO;
+    [self checkRemovePanGesture];
+}
+
 - (void)checkRemovePanGesture
 {
-    if (_panGesture && !_listenPanStart && !_listenPanMove && !_listenPanEnd) {
+    if (_panGesture
+        && !_listenPanStart && !_listenPanMove && !_listenPanEnd
+        && !_listenHorizontalPan && !_listenVerticalPan
+        ) {
         _panGesture.delegate = nil;
         _panGesture = nil;
     }
@@ -492,7 +573,7 @@ if ([removeEventName isEqualToString:@#eventName]) {\
 
 - (void)checkRemoveTouchGesture
 {
-    if (_touchGesture && !_touchGesture.listenTouchStart && !_touchGesture.listenTouchMove && !_touchGesture.listenTouchEnd && !_touchGesture.listenTouchCancel) {
+    if (_touchGesture && !_touchGesture.listenTouchStart && !_touchGesture.listenTouchMove && !_touchGesture.listenTouchEnd && !_touchGesture.listenTouchCancel && !_touchGesture.listenPseudoTouch) {
         _touchGesture.delegate = nil;
         _touchGesture = nil;
     }
@@ -507,6 +588,12 @@ if ([removeEventName isEqualToString:@#eventName]) {\
 
 - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
 {
+    if (gestureRecognizer == _panGesture) {
+        CGPoint translation = [_panGesture translationInView:self.view];
+        if (_listenHorizontalPan && !_listenVerticalPan && fabs(translation.y) > fabs(translation.x)) {
+            return NO;
+        }
+    }
     return YES;
 }
 
@@ -525,13 +612,6 @@ if ([removeEventName isEqualToString:@#eventName]) {\
         return YES;
     }
     
-//#ifdef DEBUG
-//    if ([gestureRecognizer isKindOfClass:[WXDebugLongPressGestureRecognizer class]]
-//        || [otherGestureRecognizer isKindOfClass:[WXDebugLongPressGestureRecognizer class]]) {
-//        return YES;
-//    }
-//#endif
-    
     return NO;
 }
 
@@ -540,10 +620,11 @@ if ([removeEventName isEqualToString:@#eventName]) {\
 - (NSDictionary *)touchResultWithScreenLocation:(CGPoint)screenLocation pageLocation:(CGPoint)pageLocation identifier:(NSNumber *)identifier
 {
     NSMutableDictionary *resultTouch = [[NSMutableDictionary alloc] initWithCapacity:5];
-    resultTouch[@"screenX"] = @(screenLocation.x/WXScreenResizeRadio());
-    resultTouch[@"screenY"] = @(screenLocation.y/WXScreenResizeRadio());
-    resultTouch[@"pageX"] = @(pageLocation.x/WXScreenResizeRadio());
-    resultTouch[@"pageY"] = @(pageLocation.y/WXScreenResizeRadio());
+    CGFloat scaleFactor = self.weexInstance.pixelScaleFactor;
+    resultTouch[@"screenX"] = @(screenLocation.x/scaleFactor);
+    resultTouch[@"screenY"] = @(screenLocation.y/scaleFactor);
+    resultTouch[@"pageX"] = @(pageLocation.x/scaleFactor);
+    resultTouch[@"pageY"] = @(pageLocation.y/scaleFactor);
     resultTouch[@"identifier"] = identifier;
     
     return resultTouch;
@@ -585,6 +666,11 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     if (_listenTouchStart) {
         [self fireTouchEvent:@"touchstart" withTouches:touches];
     }
+    if(_listenPseudoTouch) {
+        NSMutableDictionary *styles = [_component getPseudoClassStyles:@"active"];
+        [_component updatePseudoClassStyles:styles];
+    }
+
 }
 
 - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
@@ -604,6 +690,10 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     if (_listenTouchEnd) {
         [self fireTouchEvent:@"touchend" withTouches:touches];
     }
+    if(_listenPseudoTouch) {
+        [self recoveryPseudoStyles:_component.styles];
+    }
+
 }
 
 - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
@@ -613,6 +703,9 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     if (_listenTouchCancel) {
         [self fireTouchEvent:@"touchcancel" withTouches:touches];
     }
+    if(_listenPseudoTouch) {
+        [self recoveryPseudoStyles:_component.styles];
+    }
 }
 
 - (void)fireTouchEvent:(NSString *)eventName withTouches:(NSSet<UITouch *> *)touches
@@ -632,6 +725,11 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     [_component fireEvent:eventName params:@{@"changedTouches":resultTouches ?: @[]}];
 }
 
+- (void)recoveryPseudoStyles:(NSDictionary *)styles
+{
+    [_component recoveryPseudoStyles:styles];
+}
+
 - (void)touchResponse:(UIGestureRecognizer *)gesture
 {
     

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.h b/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.h
deleted file mode 100644
index 3578dd5..0000000
--- a/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Created by Weex.
- * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
- *
- * This source code is licensed under the Apache Licence 2.0.
- * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
- */
-
-#import <Foundation/Foundation.h>
-#import "WXNetworkProtocol.h"
-
-@interface WXNetworkDefaultImpl : NSObject <WXNetworkProtocol, NSURLSessionDelegate>
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.m b/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.m
deleted file mode 100644
index 55f9af5..0000000
--- a/ios/sdk/WeexSDK/Sources/Handler/WXNetworkDefaultImpl.m
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Created by Weex.
- * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
- *
- * This source code is licensed under the Apache Licence 2.0.
- * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
- */
-
-#import "WXNetworkDefaultImpl.h"
-#import "WXAppConfiguration.h"
-
-@interface WXNetworkCallbackInfo : NSObject
-
-@property (nonatomic, copy) void(^sendDataCallback)(int64_t, int64_t);
-@property (nonatomic, copy) void(^responseCallback)(NSURLResponse *);
-@property (nonatomic, copy) void(^receiveDataCallback)(NSData *);
-@property (nonatomic, strong) NSMutableData *data;
-@property (nonatomic, copy) void(^compeletionCallback)(NSData *, NSError *);
-
-@end
-
-@implementation WXNetworkCallbackInfo
-
-@end
-
-@implementation WXNetworkDefaultImpl
-{
-    NSMutableDictionary *_callbacks;
-    NSURLSession *_session;
-}
-
-- (id)sendRequest:(NSURLRequest *)request withSendingData:(void (^)(int64_t, int64_t))sendDataCallback
-                                             withResponse:(void (^)(NSURLResponse *))responseCallback
-                                          withReceiveData:(void (^)(NSData *))receiveDataCallback
-                                          withCompeletion:(void (^)(NSData *, NSError *))compeletionCallback
-{
-    WXNetworkCallbackInfo *info = [WXNetworkCallbackInfo new];
-    info.sendDataCallback = sendDataCallback;
-    info.responseCallback = responseCallback;
-    info.receiveDataCallback = receiveDataCallback;
-    info.compeletionCallback = compeletionCallback;
-    
-    if (!_session) {
-        NSURLSessionConfiguration *urlSessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
-        if ([WXAppConfiguration customizeProtocolClasses] && [WXAppConfiguration customizeProtocolClasses].count > 0) {
-            NSArray *defaultProtocols = urlSessionConfig.protocolClasses;
-            urlSessionConfig.protocolClasses = [[WXAppConfiguration customizeProtocolClasses] arrayByAddingObjectsFromArray:defaultProtocols];
-        }
-        _session = [NSURLSession sessionWithConfiguration:urlSessionConfig
-                                                 delegate:self
-                                            delegateQueue:[NSOperationQueue mainQueue]];
-    }
-    
-    NSURLSessionDataTask *task = [_session dataTaskWithRequest:request];
-    if (!_callbacks) {
-        _callbacks = [NSMutableDictionary dictionary];
-    }
-    [_callbacks setObject:info forKey:task];
-    [task resume];
-    
-    return task;
-}
-
-- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
-                                didSendBodyData:(int64_t)bytesSent
-                                 totalBytesSent:(int64_t)totalBytesSent
-                       totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
-{
-    WXNetworkCallbackInfo *info = [_callbacks objectForKey:task];
-    if (info.sendDataCallback) {
-        info.sendDataCallback(totalBytesSent, totalBytesExpectedToSend);
-    }
-}
-
-- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)task
-                                 didReceiveResponse:(NSURLResponse *)response
-                                  completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler
-{
-    WXNetworkCallbackInfo *info = [_callbacks objectForKey:task];
-    if (info.responseCallback) {
-        info.responseCallback(response);
-    }
-    completionHandler(NSURLSessionResponseAllow);
-}
-
-- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)task didReceiveData:(NSData *)data
-{
-    WXNetworkCallbackInfo *info = [_callbacks objectForKey:task];
-    if (info.receiveDataCallback) {
-        info.receiveDataCallback(data);
-    }
-    
-    NSMutableData *mutableData = info.data;
-    if (!mutableData) {
-        mutableData = [NSMutableData new];
-        info.data = mutableData;
-    }
-    
-    [mutableData appendData:data];
-}
-
-- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
-{
-    WXNetworkCallbackInfo *info = [_callbacks objectForKey:task];
-    if (info.compeletionCallback) {
-        info.compeletionCallback(info.data, error);
-    }
-    [_callbacks removeObjectForKey:task];
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
index 63542b2..e6cfaba 100644
--- a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
+++ b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
@@ -119,7 +119,8 @@
             strongSelf.view.frame = strongSelf.calculatedFrame;
             
             if (strongSelf->_transform) {
-                strongSelf.layer.transform = [[WXTransform new] getTransform:strongSelf->_transform withView:strongSelf.view withOrigin:strongSelf->_transformOrigin];
+                WXTransform *transform = [[WXTransform alloc] initWithInstance:strongSelf.weexInstance];
+                strongSelf.layer.transform = [transform getTransform:strongSelf->_transform withView:strongSelf.view withOrigin:strongSelf->_transformOrigin];
             }
             
             [strongSelf setNeedsDisplay];
@@ -199,23 +200,39 @@ do {\
     id value = styles[@#key];\
     if (value) {\
         typeof(_cssNode->style.cssProp) convertedValue = (typeof(_cssNode->style.cssProp))[WXConvert type:value];\
-        if([@"WXPixelType" isEqualToString:@#type] && isnan(convertedValue)) {\
+        _cssNode->style.cssProp = convertedValue;\
+        [self setNeedsLayout];\
+    }\
+} while(0);
+
+#define WX_STYLE_FILL_CSS_NODE_PIXEL(key, cssProp)\
+do {\
+    id value = styles[@#key];\
+    if (value) {\
+        CGFloat pixel = [self WXPixelType:value];\
+        if (isnan(pixel)) {\
             WXLogError(@"Invalid NaN value for style:%@, ref:%@", @#key, self.ref);\
-        } else { \
-            _cssNode->style.cssProp = convertedValue;\
+        } else {\
+            _cssNode->style.cssProp = pixel;\
             [self setNeedsLayout];\
-        } \
+        }\
     }\
 } while(0);
 
-#define WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(key, cssProp, type) \
+#define WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(key, cssProp)\
 do {\
-    WX_STYLE_FILL_CSS_NODE(key, cssProp[CSS_TOP], type)\
-    WX_STYLE_FILL_CSS_NODE(key, cssProp[CSS_LEFT], type)\
-    WX_STYLE_FILL_CSS_NODE(key, cssProp[CSS_RIGHT], type)\
-    WX_STYLE_FILL_CSS_NODE(key, cssProp[CSS_BOTTOM], type)\
+    WX_STYLE_FILL_CSS_NODE_PIXEL(key, cssProp[CSS_TOP])\
+    WX_STYLE_FILL_CSS_NODE_PIXEL(key, cssProp[CSS_LEFT])\
+    WX_STYLE_FILL_CSS_NODE_PIXEL(key, cssProp[CSS_RIGHT])\
+    WX_STYLE_FILL_CSS_NODE_PIXEL(key, cssProp[CSS_BOTTOM])\
 } while(0);
 
+
+- (CGFloat)WXPixelType:(id)value
+{
+    return [WXConvert WXPixelType:value scaleFactor:self.weexInstance.pixelScaleFactor];
+}
+
 - (void)_fillCSSNode:(NSDictionary *)styles;
 {
     // flex
@@ -228,39 +245,39 @@ do {\
     
     // position
     WX_STYLE_FILL_CSS_NODE(position, position_type, css_position_type_t)
-    WX_STYLE_FILL_CSS_NODE(top, position[CSS_TOP], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(left, position[CSS_LEFT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(right, position[CSS_RIGHT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(bottom, position[CSS_BOTTOM], WXPixelType)
+    WX_STYLE_FILL_CSS_NODE_PIXEL(top, position[CSS_TOP])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(left, position[CSS_LEFT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(right, position[CSS_RIGHT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(bottom, position[CSS_BOTTOM])
     
     // dimension
-    WX_STYLE_FILL_CSS_NODE(width, dimensions[CSS_WIDTH], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(height, dimensions[CSS_HEIGHT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(minWidth, minDimensions[CSS_WIDTH], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(minHeight, minDimensions[CSS_HEIGHT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(maxWidth, maxDimensions[CSS_WIDTH], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(maxHeight, maxDimensions[CSS_HEIGHT], WXPixelType)
+    WX_STYLE_FILL_CSS_NODE_PIXEL(width, dimensions[CSS_WIDTH])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(height, dimensions[CSS_HEIGHT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(minWidth, minDimensions[CSS_WIDTH])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(minHeight, minDimensions[CSS_HEIGHT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(maxWidth, maxDimensions[CSS_WIDTH])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(maxHeight, maxDimensions[CSS_HEIGHT])
     
     // margin
-    WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(margin, margin, WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(marginTop, margin[CSS_TOP], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(marginLeft, margin[CSS_LEFT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(marginRight, margin[CSS_RIGHT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(marginBottom, margin[CSS_BOTTOM], WXPixelType)
+    WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(margin, margin)
+    WX_STYLE_FILL_CSS_NODE_PIXEL(marginTop, margin[CSS_TOP])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(marginLeft, margin[CSS_LEFT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(marginRight, margin[CSS_RIGHT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(marginBottom, margin[CSS_BOTTOM])
     
     // border
-    WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(borderWidth, border, WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(borderTopWidth, border[CSS_TOP], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(borderLeftWidth, border[CSS_LEFT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(borderRightWidth, border[CSS_RIGHT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(borderBottomWidth, border[CSS_BOTTOM], WXPixelType)
+    WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(borderWidth, border)
+    WX_STYLE_FILL_CSS_NODE_PIXEL(borderTopWidth, border[CSS_TOP])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(borderLeftWidth, border[CSS_LEFT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(borderRightWidth, border[CSS_RIGHT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(borderBottomWidth, border[CSS_BOTTOM])
     
     // padding
-    WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(padding, padding, WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(paddingTop, padding[CSS_TOP], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(paddingLeft, padding[CSS_LEFT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(paddingRight, padding[CSS_RIGHT], WXPixelType)
-    WX_STYLE_FILL_CSS_NODE(paddingBottom, padding[CSS_BOTTOM], WXPixelType)
+    WX_STYLE_FILL_CSS_NODE_ALL_DIRECTION(padding, padding)
+    WX_STYLE_FILL_CSS_NODE_PIXEL(paddingTop, padding[CSS_TOP])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(paddingLeft, padding[CSS_LEFT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(paddingRight, padding[CSS_RIGHT])
+    WX_STYLE_FILL_CSS_NODE_PIXEL(paddingBottom, padding[CSS_BOTTOM])
 }
 
 #define WX_STYLE_RESET_CSS_NODE(key, cssProp, defaultValue)\

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b5123119/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.h b/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.h
new file mode 100644
index 0000000..8b77a2c
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.h
@@ -0,0 +1,30 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+#import "WXResourceRequest.h"
+#import "WXResourceResponse.h"
+
+
+@interface WXResourceLoader : NSObject
+
+@property (nonatomic, strong) WXResourceRequest *request;
+
+@property (nonatomic, copy) void (^onDataSent)(unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */);
+@property (nonatomic, copy) void (^onResponseReceived)(const WXResourceResponse *);
+@property (nonatomic, copy) void (^onDataReceived)(NSData *);
+@property (nonatomic, copy) void (^onFinished)(const WXResourceResponse *, NSData *);
+@property (nonatomic, copy) void (^onFailed)(NSError *);
+
+- (instancetype)initWithRequest:(WXResourceRequest *)request;
+
+- (void)start;
+
+- (void)cancel:(NSError **)error;
+
+@end