@breakside/jskit 2022.22.2 → 2022.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/JS/XMLSerializer.js +9 -4
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/DOM.jsframework/sources.json +10 -3
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/sources.json +34 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSAttributedString.js +347 -25
- package/Frameworks/Foundation.jsframework/JS/JSFont.js +39 -15
- package/Frameworks/Foundation.jsframework/JS/JSFontDescriptor+HTML.js +8 -0
- package/Frameworks/Foundation.jsframework/JS/JSFontDescriptor.js +105 -27
- package/Frameworks/Foundation.jsframework/JS/JSParagraphStyle.js +71 -0
- package/Frameworks/Foundation.jsframework/JS/JSTextAttachment.js +1 -1
- package/Frameworks/Foundation.jsframework/JS/JSTextContainer.js +56 -29
- package/Frameworks/Foundation.jsframework/JS/JSTextFrame.js +2 -32
- package/Frameworks/Foundation.jsframework/JS/JSTextFramesetter.js +125 -22
- package/Frameworks/Foundation.jsframework/JS/JSTextLayoutManager.js +11 -3
- package/Frameworks/Foundation.jsframework/JS/JSTextLine.js +4 -3
- package/Frameworks/Foundation.jsframework/JS/JSTextRun.js +5 -3
- package/Frameworks/Foundation.jsframework/JS/JSTextTypesetter.js +41 -25
- package/Frameworks/Foundation.jsframework/JS/String+JS.js +69 -0
- package/Frameworks/Foundation.jsframework/JS/UnicodeChar.js +8 -0
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/sources.json +170 -8
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/sources.json +43 -2
- package/Info.json +2 -2
- package/Node/Builder.js +20 -9
- package/Node/FrameworkBuilder.js +22 -2
- package/Node/Project.js +22 -2
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Node/jskit +8 -7
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/CHAxis.js +5 -5
- package/Root/Frameworks/ChartKit/CHPieChart.js +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/DOM/XMLSerializer.js +9 -4
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSAttributedString.js +347 -25
- package/Root/Frameworks/Foundation/JSFont.js +39 -15
- package/Root/Frameworks/Foundation/JSFontDescriptor+HTML.js +8 -0
- package/Root/Frameworks/Foundation/JSFontDescriptor.js +105 -27
- package/Root/Frameworks/Foundation/JSParagraphStyle.js +71 -0
- package/Root/Frameworks/Foundation/JSTextAttachment.js +1 -1
- package/Root/Frameworks/Foundation/JSTextContainer.js +56 -29
- package/Root/Frameworks/Foundation/JSTextFrame.js +2 -32
- package/Root/Frameworks/Foundation/JSTextFramesetter.js +125 -22
- package/Root/Frameworks/Foundation/JSTextLayoutManager.js +11 -3
- package/Root/Frameworks/Foundation/JSTextLine.js +4 -3
- package/Root/Frameworks/Foundation/JSTextRun.js +5 -3
- package/Root/Frameworks/Foundation/JSTextTypesetter.js +41 -25
- package/Root/Frameworks/Foundation/String+JS.js +69 -0
- package/Root/Frameworks/Foundation/UnicodeChar.js +8 -0
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UIHTMLContentEditableTextInputManager.js +36 -0
- package/Root/Frameworks/UIKit/UIHTMLDisplayServer.js +1 -1
- package/Root/Frameworks/UIKit/UIHTMLTextField.js +1 -1
- package/Root/Frameworks/UIKit/UIHTMLTextFrame.js +19 -91
- package/Root/Frameworks/UIKit/UIHTMLTextFramesetter.js +52 -9
- package/Root/Frameworks/UIKit/UIHTMLTextLine.js +95 -30
- package/Root/Frameworks/UIKit/UIHTMLTextRun.js +22 -9
- package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +334 -459
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +16 -0
- package/Root/Frameworks/UIKit/UILabel.js +43 -10
- package/Root/Frameworks/UIKit/UIScrollView.js +12 -0
- package/Root/Frameworks/UIKit/UISegmentedControl.js +6 -6
- package/Root/Frameworks/UIKit/UITextAttachmentView.js +1 -1
- package/Root/Frameworks/UIKit/UITextEditor.js +210 -25
- package/Root/Frameworks/UIKit/UITextField.js +58 -31
- package/Root/Frameworks/UIKit/UITextInput.js +3 -1
- package/Root/Frameworks/UIKit/UITextInputManager.js +2 -2
- package/Root/Frameworks/UIKit/UITextLayer.js +39 -26
- package/Root/Frameworks/UIKit/UITokenField.js +4 -4
- package/Root/Frameworks/UIKit/UIView.js +3 -1
- package/Root/Frameworks/UIKit/UIWindow.js +16 -3
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -126,6 +126,7 @@ JSClass("UITextField", UIControl, {
|
|
|
126
126
|
this._textLayer.widthTracksText = true;
|
|
127
127
|
this._textLayer.heightTracksText = true;
|
|
128
128
|
this._textLayer.maximumNumberOfLines = 1;
|
|
129
|
+
this._textLayer.textContainer.framesetter.typesetter.delegate = this;
|
|
129
130
|
this._localEditor = UITextEditor.initWithTextLayer(this._textLayer);
|
|
130
131
|
this._localEditor.delegate = this;
|
|
131
132
|
this._clipView.layer.addSublayer(this._textLayer);
|
|
@@ -654,22 +655,6 @@ JSClass("UITextField", UIControl, {
|
|
|
654
655
|
layoutSubviews: function(){
|
|
655
656
|
UITextField.$super.layoutSubviews.call(this);
|
|
656
657
|
var textInsets = JSInsets(this._textInsets);
|
|
657
|
-
if (this._placeholderLabel !== null){
|
|
658
|
-
if (!this._multiline){
|
|
659
|
-
this._placeholderLabel.layoutIfNeeded();
|
|
660
|
-
}
|
|
661
|
-
var clipSize = this._clipView.bounds.size;
|
|
662
|
-
var placeholderSize = this._placeholderLabel.bounds.size;
|
|
663
|
-
if (this._multiline){
|
|
664
|
-
this._placeholderLabel.frame = JSRect(0, 0, clipSize.width, placeholderSize.height);
|
|
665
|
-
}else if (this._placeholderLabel.textAlignment == JSTextAlignment.center){
|
|
666
|
-
this._placeholderLabel.frame = JSRect((clipSize.width - placeholderSize.width) / 2, 0, placeholderSize.width, placeholderSize.height);
|
|
667
|
-
}else if (this._placeholderLabel.textAlignment == JSTextAlignment.right){
|
|
668
|
-
this._placeholderLabel.frame = JSRect(clipSize.width - placeholderSize.width, 0, placeholderSize.width, placeholderSize.height);
|
|
669
|
-
}else{
|
|
670
|
-
this._placeholderLabel.frame = JSRect(JSPoint.Zero, placeholderSize);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
658
|
if (this._leftAccessoryView !== null){
|
|
674
659
|
textInsets.left += this._leftAccessoryInsets.width + this._leftAccessorySize.width;
|
|
675
660
|
this._leftAccessoryView.frame = JSRect(
|
|
@@ -687,8 +672,24 @@ JSClass("UITextField", UIControl, {
|
|
|
687
672
|
this._rightAccessorySize.width,
|
|
688
673
|
this._rightAccessorySize.height
|
|
689
674
|
);
|
|
690
|
-
}
|
|
675
|
+
}
|
|
691
676
|
this._clipView.frame = this.bounds.rectWithInsets(textInsets);
|
|
677
|
+
if (this._placeholderLabel !== null){
|
|
678
|
+
if (!this._multiline){
|
|
679
|
+
this._placeholderLabel.layoutIfNeeded();
|
|
680
|
+
}
|
|
681
|
+
var clipSize = this._clipView.bounds.size;
|
|
682
|
+
var placeholderSize = this._placeholderLabel.bounds.size;
|
|
683
|
+
if (this._multiline){
|
|
684
|
+
this._placeholderLabel.frame = JSRect(0, 0, clipSize.width, placeholderSize.height);
|
|
685
|
+
}else if (this._placeholderLabel.textAlignment == JSTextAlignment.center){
|
|
686
|
+
this._placeholderLabel.frame = JSRect((clipSize.width - placeholderSize.width) / 2, 0, placeholderSize.width, placeholderSize.height);
|
|
687
|
+
}else if (this._placeholderLabel.textAlignment == JSTextAlignment.right){
|
|
688
|
+
this._placeholderLabel.frame = JSRect(clipSize.width - placeholderSize.width, 0, placeholderSize.width, placeholderSize.height);
|
|
689
|
+
}else{
|
|
690
|
+
this._placeholderLabel.frame = JSRect(JSPoint.Zero, placeholderSize);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
692
693
|
},
|
|
693
694
|
|
|
694
695
|
layerDidChangeSize: function(layer){
|
|
@@ -703,11 +704,19 @@ JSClass("UITextField", UIControl, {
|
|
|
703
704
|
},
|
|
704
705
|
|
|
705
706
|
sizeToFitText: function(maxSize){
|
|
706
|
-
|
|
707
|
-
var size = JSSize(this._textLayer.bounds.size);
|
|
707
|
+
var size;
|
|
708
708
|
if (this._isShowingPlaceholder){
|
|
709
|
+
if (this._multiline){
|
|
710
|
+
this._placeholderLabel.sizeToFitSize(maxSize);
|
|
711
|
+
}
|
|
709
712
|
this._placeholderLabel.layoutIfNeeded();
|
|
710
713
|
size = JSSize(this._placeholderLabel.bounds.size);
|
|
714
|
+
}else{
|
|
715
|
+
if (this._multiline){
|
|
716
|
+
this._textLayer.sizeToFitSize(maxSize);
|
|
717
|
+
}
|
|
718
|
+
this._textLayer.layoutIfNeeded();
|
|
719
|
+
size = JSSize(this._textLayer.bounds.size);
|
|
711
720
|
}
|
|
712
721
|
if (size.width > maxSize.width){
|
|
713
722
|
size.width = maxSize.width;
|
|
@@ -937,25 +946,32 @@ JSClass("UITextField", UIControl, {
|
|
|
937
946
|
UITextField.$super.mouseUp.call(this, event);
|
|
938
947
|
},
|
|
939
948
|
|
|
949
|
+
_touchOrigin: null,
|
|
950
|
+
|
|
940
951
|
touchesBegan: function(touches, event){
|
|
941
952
|
if (this.enabled){
|
|
942
|
-
// Always try to set window.firstResponder to force the keyboard
|
|
943
|
-
// open if it didn't open when we became first responder. Happens
|
|
944
|
-
// when mobile safari ignores focus() calls that aren't tied to
|
|
945
|
-
// user interaction
|
|
946
|
-
this.window.firstResponder = this;
|
|
947
953
|
var location = touches[0].locationInView(this);
|
|
948
|
-
this.
|
|
949
|
-
|
|
954
|
+
this._touchOrigin = this.convertPointToView(this.bounds.origin, this.window);
|
|
955
|
+
if (this.isFirstResponder()){
|
|
956
|
+
// Always try to set window.firstResponder to force the keyboard
|
|
957
|
+
// open if it didn't open when we became first responder. Happens
|
|
958
|
+
// when mobile safari ignores focus() calls that aren't tied to
|
|
959
|
+
// user interaction
|
|
960
|
+
this.window.firstResponder = this;
|
|
961
|
+
this._localEditor.handleTouchesBeganAtLocation(this.layer.convertPointToLayer(location, this._textLayer), touches, event);
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
950
964
|
}
|
|
951
965
|
UITextField.$super.touchesBegan.call(this, touches, event);
|
|
952
966
|
},
|
|
953
967
|
|
|
954
968
|
touchesMoved: function(touches, event){
|
|
955
969
|
if (this.enabled){
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
970
|
+
if (this.isFirstResponder()){
|
|
971
|
+
var location = touches[0].locationInView(this);
|
|
972
|
+
this._localEditor.handleTouchesMovedAtLocation(this.layer.convertPointToLayer(location, this._textLayer), touches, event);
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
959
975
|
}
|
|
960
976
|
UITextField.$super.touchesMoved.call(this, touches, event);
|
|
961
977
|
},
|
|
@@ -963,8 +979,15 @@ JSClass("UITextField", UIControl, {
|
|
|
963
979
|
touchesEnded: function(touches, event){
|
|
964
980
|
if (this.enabled){
|
|
965
981
|
var location = touches[0].locationInView(this);
|
|
966
|
-
this.
|
|
967
|
-
|
|
982
|
+
if (this.isFirstResponder()){
|
|
983
|
+
this._localEditor.handleTouchesEnded(touches, event);
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
var origin = this.convertPointToView(this.bounds.origin, this.window);
|
|
987
|
+
if (this.containsPoint(location) && this._touchOrigin.distanceToPoint(origin) < 2){
|
|
988
|
+
this.window.firstResponder = this;
|
|
989
|
+
this._localEditor.handleTouchesEndedAtLocation(this.layer.convertPointToLayer(location, this._textLayer), touches, event);
|
|
990
|
+
}
|
|
968
991
|
}
|
|
969
992
|
UITextField.$super.touchesEnded.call(this, touches, event);
|
|
970
993
|
},
|
|
@@ -1456,6 +1479,10 @@ JSClass("UITextFieldCustomStyler", UITextFieldStyler, {
|
|
|
1456
1479
|
return UITextFieldCustomStyler.$super.focusRingPathForControl.call(this, textField);
|
|
1457
1480
|
}
|
|
1458
1481
|
return null;
|
|
1482
|
+
},
|
|
1483
|
+
|
|
1484
|
+
updateSelectionWithAttributes: function(attributes){
|
|
1485
|
+
this._textEditor.updateSelectionWithAttributes(attributes);
|
|
1459
1486
|
}
|
|
1460
1487
|
|
|
1461
1488
|
});
|
|
@@ -86,7 +86,7 @@ UITextInput.SelectionAffinity = {
|
|
|
86
86
|
UITextInput.TextContentType = {
|
|
87
87
|
none: 0,
|
|
88
88
|
url: 1,
|
|
89
|
-
email:
|
|
89
|
+
email: 2,
|
|
90
90
|
phone: 3,
|
|
91
91
|
username: 4,
|
|
92
92
|
password: 5,
|
|
@@ -138,6 +138,7 @@ JSGlobalObject.UITextInputSelection = function(range, insertionPoint, affinity){
|
|
|
138
138
|
this.range = JSRange(range.range);
|
|
139
139
|
this.insertionPoint = range.insertionPoint;
|
|
140
140
|
this.affinity = range.affinity;
|
|
141
|
+
this.attributes = JSCopy(range.attributes);
|
|
141
142
|
}else{
|
|
142
143
|
if (insertionPoint === undefined){
|
|
143
144
|
insertionPoint = UITextInput.SelectionInsertionPoint.end;
|
|
@@ -157,6 +158,7 @@ UITextInputSelection.prototype = {
|
|
|
157
158
|
range: null,
|
|
158
159
|
insertionPoint: null,
|
|
159
160
|
affinity: null,
|
|
161
|
+
attributes: null,
|
|
160
162
|
|
|
161
163
|
containsIndex: function(index){
|
|
162
164
|
return this.range.length > 0 && this.range.contains(index);
|
|
@@ -110,7 +110,7 @@ keyBindingsByPlatform[UIPlatform.Identifier.mac] = [
|
|
|
110
110
|
{action: "moveForwardAndModifySelection", key: UIEvent.Key.right, modifiers: UIEvent.Modifier.shift},
|
|
111
111
|
{action: "moveWordForwardAndModifySelection", key: UIEvent.Key.right, modifiers: UIEvent.Modifier.shift | UIEvent.Modifier.option},
|
|
112
112
|
{action: "moveToEndOfLineAndModifySelection", key: UIEvent.Key.right, modifiers: UIEvent.Modifier.shift | UIEvent.Modifier.command},
|
|
113
|
-
{action: "
|
|
113
|
+
{action: "moveDownAndModifySelection", key: UIEvent.Key.down, modifiers: UIEvent.Modifier.shift},
|
|
114
114
|
{action: "moveToEndOfDocumentAndModifySelection", key: UIEvent.Key.down, modifiers: UIEvent.Modifier.shift | UIEvent.Modifier.command},
|
|
115
115
|
{action: "moveToEndOfDocumentAndModifySelection", key: UIEvent.Key.end, modifiers: UIEvent.Modifier.shift},
|
|
116
116
|
|
|
@@ -165,7 +165,7 @@ keyBindingsByPlatform[UIPlatform.Identifier.win] = [
|
|
|
165
165
|
{action: "moveForwardAndModifySelection", key: UIEvent.Key.right, modifiers: UIEvent.Modifier.shift},
|
|
166
166
|
{action: "moveWordForwardAndModifySelection", key: UIEvent.Key.right, modifiers: UIEvent.Modifier.shift | UIEvent.Modifier.control},
|
|
167
167
|
{action: "moveToEndOfLineAndModifySelection", key: UIEvent.Key.end, modifiers: UIEvent.Modifier.shift},
|
|
168
|
-
{action: "
|
|
168
|
+
{action: "moveDownAndModifySelection", key: UIEvent.Key.down, modifiers: UIEvent.Modifier.shift},
|
|
169
169
|
{action: "moveToEndOfDocumentAndModifySelection", key: UIEvent.Key.end, modifiers: UIEvent.Modifier.shift | UIEvent.Modifier.control},
|
|
170
170
|
|
|
171
171
|
{action: "selectAll", key: "a", modifiers: UIEvent.Modifier.control},
|
|
@@ -19,37 +19,16 @@
|
|
|
19
19
|
|
|
20
20
|
(function(){
|
|
21
21
|
|
|
22
|
-
var UITextLayerContainerProperty = function(){
|
|
23
|
-
if (this === undefined){
|
|
24
|
-
return new UITextLayerContainerProperty();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
UITextLayerContainerProperty.prototype = Object.create(JSCustomProperty.prototype);
|
|
29
|
-
|
|
30
|
-
UITextLayerContainerProperty.prototype.define = function(C, key, extensions){
|
|
31
|
-
Object.defineProperty(C.prototype, key, {
|
|
32
|
-
configurable: false,
|
|
33
|
-
enumerable: false,
|
|
34
|
-
set: function UITextLayer_setContainerProperty(value){
|
|
35
|
-
this.textContainer[key] = value;
|
|
36
|
-
},
|
|
37
|
-
get: function UITextLayer_getContainerProperty(){
|
|
38
|
-
return this.textContainer[key];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
22
|
JSClass("UITextLayer", UILayer, {
|
|
44
23
|
|
|
45
24
|
text: JSDynamicProperty(),
|
|
46
25
|
attributedText: JSDynamicProperty(),
|
|
47
26
|
font: JSDynamicProperty(),
|
|
48
27
|
textColor: UILayerAnimatedProperty(),
|
|
49
|
-
lineBreakMode:
|
|
50
|
-
textAlignment:
|
|
51
|
-
lineSpacing:
|
|
52
|
-
minimumLineHeight:
|
|
28
|
+
lineBreakMode: JSDynamicProperty(),
|
|
29
|
+
textAlignment: JSDynamicProperty(),
|
|
30
|
+
lineSpacing: JSDynamicProperty(),
|
|
31
|
+
minimumLineHeight: JSDynamicProperty(),
|
|
53
32
|
textInsets: JSDynamicProperty('_textInsets', JSInsets.Zero),
|
|
54
33
|
maximumNumberOfLines: JSDynamicProperty(),
|
|
55
34
|
widthTracksText: JSDynamicProperty('_widthTracksText', false),
|
|
@@ -129,6 +108,40 @@ JSClass("UITextLayer", UILayer, {
|
|
|
129
108
|
this._textContainer.size = this._availableTextSize();
|
|
130
109
|
},
|
|
131
110
|
|
|
111
|
+
// MARK: - Paragraph Styling
|
|
112
|
+
|
|
113
|
+
getLineBreakMode: function(){
|
|
114
|
+
return this._textLayoutManager.defaultParagraphStyle.lineBreakMode;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
setLineBreakMode: function(lineBreakMode){
|
|
118
|
+
this._textLayoutManager.defaultParagraphStyle = this._textLayoutManager.defaultParagraphStyle.styleWithAttributes({lineBreakMode: lineBreakMode});
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
getTextAlignment: function(){
|
|
122
|
+
return this._textLayoutManager.defaultParagraphStyle.textAlignment;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
setTextAlignment: function(textAlignment){
|
|
126
|
+
this._textLayoutManager.defaultParagraphStyle = this._textLayoutManager.defaultParagraphStyle.styleWithAttributes({textAlignment: textAlignment});
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
getLineSpacing: function(){
|
|
130
|
+
return this._textLayoutManager.defaultParagraphStyle.lineSpacing;
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
setLineSpacing: function(lineSpacing){
|
|
134
|
+
this._textLayoutManager.defaultParagraphStyle = this._textLayoutManager.defaultParagraphStyle.styleWithAttributes({lineSpacing: lineSpacing});
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
getMinimumLineHeight: function(){
|
|
138
|
+
return this._textLayoutManager.defaultParagraphStyle.minimumLineHeight;
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
setMinimumLineHeight: function(minimumLineHeight){
|
|
142
|
+
this._textLayoutManager.defaultParagraphStyle = this._textLayoutManager.defaultParagraphStyle.styleWithAttributes({minimumLineHeight: minimumLineHeight});
|
|
143
|
+
},
|
|
144
|
+
|
|
132
145
|
// MARK: - Fetching & Updating Text
|
|
133
146
|
|
|
134
147
|
hasText: function(){
|
|
@@ -203,7 +216,7 @@ JSClass("UITextLayer", UILayer, {
|
|
|
203
216
|
size.width += this._textInsets.width;
|
|
204
217
|
size.height += this._textInsets.height;
|
|
205
218
|
this.bounds = JSRect(JSPoint.Zero, size);
|
|
206
|
-
this._textContainer.size = this.
|
|
219
|
+
this._textContainer.size = this._availableTextSize();
|
|
207
220
|
}
|
|
208
221
|
},
|
|
209
222
|
|
|
@@ -40,25 +40,25 @@ JSClass("UITokenField", UITextField, {
|
|
|
40
40
|
UITokenField.$super.commonUIControlInit.call(this);
|
|
41
41
|
this.tokensView = UIView.initWithFrame(JSRect.Zero);
|
|
42
42
|
this._clipView.addSubview(this.tokensView);
|
|
43
|
-
this.
|
|
43
|
+
this._updateLineHeightMultiple();
|
|
44
44
|
this.setNeedsLayout();
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
setFont: function(font){
|
|
48
48
|
UITokenField.$super.setFont.call(this, font);
|
|
49
|
-
this.
|
|
49
|
+
this._updateLineHeightMultiple();
|
|
50
50
|
},
|
|
51
51
|
|
|
52
52
|
getFont: function(){
|
|
53
53
|
return this._textLayer.font;
|
|
54
54
|
},
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
_updateLineHeightMultiple: function(){
|
|
57
57
|
if (this.font === null){
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
var lineHeight = this.font.displayLineHeight;
|
|
61
|
-
this._textLayer.
|
|
61
|
+
this._textLayer.lineHeightMultiple = (lineHeight + 4) / lineHeight;
|
|
62
62
|
this.setNeedsLayout();
|
|
63
63
|
},
|
|
64
64
|
|
|
@@ -545,7 +545,9 @@ JSClass('UIView', UIResponder, {
|
|
|
545
545
|
},
|
|
546
546
|
|
|
547
547
|
layerDidChangeSize: function(layer){
|
|
548
|
-
this.
|
|
548
|
+
if (layer === this.layer){
|
|
549
|
+
this.invalidateFocusRingPath();
|
|
550
|
+
}
|
|
549
551
|
},
|
|
550
552
|
|
|
551
553
|
// -------------------------------------------------------------------------
|
|
@@ -283,14 +283,27 @@ JSClass('UIWindow', UIView, {
|
|
|
283
283
|
}
|
|
284
284
|
},
|
|
285
285
|
|
|
286
|
+
setNeedsLayout: function(){
|
|
287
|
+
UIWindow.$super.setNeedsLayout.call(this);
|
|
288
|
+
},
|
|
289
|
+
|
|
286
290
|
layoutSubviews: function(){
|
|
287
291
|
UIWindow.$super.layoutSubviews.call(this);
|
|
288
292
|
this._styler.layoutWindow(this);
|
|
289
|
-
this.
|
|
293
|
+
this._updatingFocusRing = true;
|
|
294
|
+
this._styler.updateFocusRingInWindow(this, this._focusRingAnimated);
|
|
295
|
+
this._updatingFocusRing = false;
|
|
296
|
+
this._focusRingAnimated = true;
|
|
290
297
|
},
|
|
291
298
|
|
|
299
|
+
_updatingFocusRing: false,
|
|
300
|
+
_focusRingAnimated: true,
|
|
301
|
+
|
|
292
302
|
invalidateFocusRing: function(animated){
|
|
293
|
-
this.
|
|
303
|
+
if (!this._updatingFocusRing){
|
|
304
|
+
this._focusRingAnimated = animated;
|
|
305
|
+
this.setNeedsLayout();
|
|
306
|
+
}
|
|
294
307
|
},
|
|
295
308
|
|
|
296
309
|
// -------------------------------------------------------------------------
|
|
@@ -1184,7 +1197,7 @@ JSClass("UIWindowStyler", JSObject, {
|
|
|
1184
1197
|
}
|
|
1185
1198
|
view = responder;
|
|
1186
1199
|
var i;
|
|
1187
|
-
for (i = views.length -
|
|
1200
|
+
for (i = views.length - 2; i >= 0; --i){
|
|
1188
1201
|
views[i].layoutIfNeeded();
|
|
1189
1202
|
}
|
|
1190
1203
|
var path = view.focusRingPath;
|