@breakside/jskit 2022.22.0 → 2022.22.3
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/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 +69 -20
- package/Frameworks/Foundation.jsframework/JS/JSTextAttachment.js +6 -1
- package/Frameworks/Foundation.jsframework/JS/JSTextRun.js +3 -0
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/sources.json +159 -1
- 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/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/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/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 +69 -20
- package/Root/Frameworks/Foundation/JSTextAttachment.js +6 -1
- package/Root/Frameworks/Foundation/JSTextRun.js +3 -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/UICollectionView.js +11 -7
- package/Root/Frameworks/UIKit/UIContainerView.js +1 -1
- package/Root/Frameworks/UIKit/UIHTMLTextFrame.js +3 -0
- package/Root/Frameworks/UIKit/UIHTMLTextRun.js +3 -1
- package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +14 -0
- package/Root/Frameworks/UIKit/UIImageView.js +4 -0
- package/Root/Frameworks/UIKit/UILabel.js +43 -10
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
package/Node/Builder.js
CHANGED
|
@@ -174,20 +174,31 @@ JSClass("Builder", JSObject, {
|
|
|
174
174
|
if (!seen.has(name)){
|
|
175
175
|
seen.add(name);
|
|
176
176
|
// If the framework was pre-built, then it can only have
|
|
177
|
-
// dependencies on
|
|
178
|
-
//
|
|
179
|
-
//
|
|
177
|
+
// dependencies on other pre-built frameworks, which
|
|
178
|
+
// are other .jsframework bundles or JSKit frameworks
|
|
179
|
+
//
|
|
180
180
|
// If we built the framework, then we already added its
|
|
181
181
|
// dependencies based on its build reuslts and won't get here.
|
|
182
|
-
let
|
|
183
|
-
let
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
let includeDirectoryURLs = this.project.includeDirectoryURLs;
|
|
183
|
+
let url = null;
|
|
184
|
+
for (let i = 0, l = includeDirectoryURLs.length; i < l && url === null; ++i){
|
|
185
|
+
let directoryURL = includeDirectoryURLs[i];
|
|
186
|
+
let candidateURL = directoryURL.appendingPathComponent(name + '.jsframework', true);
|
|
187
|
+
let found = await this.fileManager.itemExistsAtURL(candidateURL);
|
|
188
|
+
if (found){
|
|
189
|
+
url = candidateURL;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (url === null){
|
|
193
|
+
url = this.fileManager.urlForPath(JSKitRootDirectoryPath).appendingPathComponents(["Frameworks", name], true);
|
|
194
|
+
let found = await this.fileManager.itemExistsAtURL(url);
|
|
195
|
+
if (!found){
|
|
196
|
+
throw new Error("Cannot find framework %s, (required by %s)".sprintf(name, url.lastPathComponent));
|
|
197
|
+
}
|
|
186
198
|
}
|
|
187
|
-
this.printer.print("\nAdding dependency %s\n".sprintf(name));
|
|
188
199
|
imports.push({
|
|
189
200
|
name: name,
|
|
190
|
-
url:
|
|
201
|
+
url: url
|
|
191
202
|
});
|
|
192
203
|
}
|
|
193
204
|
}
|
package/Node/FrameworkBuilder.js
CHANGED
|
@@ -138,9 +138,10 @@ JSClass("FrameworkBuilder", Builder, {
|
|
|
138
138
|
var genericFrameworks = new Set();
|
|
139
139
|
var genericFiles = new Set();
|
|
140
140
|
var genericFeatures = new Set();
|
|
141
|
+
var genericGlobals = new Set();
|
|
141
142
|
var sources = {};
|
|
142
143
|
for (let env in this.bundleEnvironments){
|
|
143
|
-
sources[env] = {frameworks: [], files: [], features: []};
|
|
144
|
+
sources[env] = {frameworks: [], files: [], features: [], globals: []};
|
|
144
145
|
let imports = this.importsByEnvironment[env];
|
|
145
146
|
for (let i = 0, l = imports.frameworks.length; i < l; ++i){
|
|
146
147
|
let framework = imports.frameworks[i];
|
|
@@ -176,6 +177,15 @@ JSClass("FrameworkBuilder", Builder, {
|
|
|
176
177
|
sources[env].features.push(feature);
|
|
177
178
|
}
|
|
178
179
|
}
|
|
180
|
+
for (let i = 0, l = imports.globals.length; i < l; ++i){
|
|
181
|
+
let name = imports.globals[i];
|
|
182
|
+
if (env == 'generic'){
|
|
183
|
+
genericGlobals.add(name);
|
|
184
|
+
}
|
|
185
|
+
if (env == 'generic' || !genericGlobals.has(name)){
|
|
186
|
+
sources[env].globals.push(name);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
179
189
|
}
|
|
180
190
|
return sources;
|
|
181
191
|
},
|
|
@@ -185,6 +195,7 @@ JSClass("FrameworkBuilder", Builder, {
|
|
|
185
195
|
var genericFrameworks = new Set();
|
|
186
196
|
var genericFiles = new Set();
|
|
187
197
|
var genericFeatures = new Set();
|
|
198
|
+
var genericGlobals = new Set();
|
|
188
199
|
var sources = {};
|
|
189
200
|
var copyright = this.project.getInfoString("JSCopyright", this.resources);
|
|
190
201
|
var licenseString = await this.project.licenseNoticeString();
|
|
@@ -195,7 +206,7 @@ JSClass("FrameworkBuilder", Builder, {
|
|
|
195
206
|
}
|
|
196
207
|
var header = "%s (%s)\n----\n%s%s".sprintf(this.project.info.JSBundleIdentifier, this.project.info.JSBundleVersion, copyright, licenseString);
|
|
197
208
|
for (let env in this.bundleEnvironments){
|
|
198
|
-
sources[env] = {frameworks: [], files: [], features: []};
|
|
209
|
+
sources[env] = {frameworks: [], files: [], features: [], globals: []};
|
|
199
210
|
let filename = this.bundleEnvironments[env];
|
|
200
211
|
let compilation = JavascriptCompilation.initWithName(filename, this.sourcesURL, this.fileManager);
|
|
201
212
|
var fullSourcesURL = this.sourcesURL.appendingPathComponent("_debug", true);
|
|
@@ -238,6 +249,15 @@ JSClass("FrameworkBuilder", Builder, {
|
|
|
238
249
|
sources[env].features.push(feature);
|
|
239
250
|
}
|
|
240
251
|
}
|
|
252
|
+
for (let i = 0, l = imports.globals.length; i < l; ++i){
|
|
253
|
+
let name = imports.globals[i];
|
|
254
|
+
if (env == 'generic'){
|
|
255
|
+
genericGlobals.add(name);
|
|
256
|
+
}
|
|
257
|
+
if (env == 'generic' || !genericGlobals.has(name)){
|
|
258
|
+
sources[env].globals.push(name);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
241
261
|
}
|
|
242
262
|
return sources;
|
|
243
263
|
},
|
package/Node/Project.js
CHANGED
|
@@ -310,7 +310,8 @@ JSClass("Project", JSObject, {
|
|
|
310
310
|
var result = {
|
|
311
311
|
files: [],
|
|
312
312
|
frameworks: [],
|
|
313
|
-
features: []
|
|
313
|
+
features: [],
|
|
314
|
+
globals: []
|
|
314
315
|
};
|
|
315
316
|
var visited = {
|
|
316
317
|
paths: new Set(),
|
|
@@ -359,6 +360,11 @@ JSClass("Project", JSObject, {
|
|
|
359
360
|
result.features.push(feature);
|
|
360
361
|
}
|
|
361
362
|
}
|
|
363
|
+
let globals = js.globals();
|
|
364
|
+
for (let i = 0, l = globals.length; i < l; ++i){
|
|
365
|
+
let name = globals[i];
|
|
366
|
+
result.globals.push(name);
|
|
367
|
+
}
|
|
362
368
|
}
|
|
363
369
|
};
|
|
364
370
|
|
|
@@ -443,7 +449,21 @@ JSClass("Project", JSObject, {
|
|
|
443
449
|
let url = await this.urlForFrameworkName(name, includeDirectoryURLs);
|
|
444
450
|
if (url !== null){
|
|
445
451
|
if (url.fileExtension === '.jsframework'){
|
|
446
|
-
|
|
452
|
+
let sourcesURL = url.appendingPathComponent("sources.json");
|
|
453
|
+
let data = await this.fileManager.contentsAtURL(sourcesURL);
|
|
454
|
+
let sources = JSON.parse(data.stringByDecodingUTF8());
|
|
455
|
+
if (sources.generic.globals){
|
|
456
|
+
for (let name of sources.generic.globals){
|
|
457
|
+
globals.push(name);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
for (let env of envs){
|
|
461
|
+
if ((env in sources) && sources[env].globals){
|
|
462
|
+
for (let name of sources[env].globals){
|
|
463
|
+
globals.push(name);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
447
467
|
}else{
|
|
448
468
|
let frameworkProject = Project.initWithURL(url);
|
|
449
469
|
try{
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.jskit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "node",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
6
|
-
"JSBundleVersion": "2022.22.
|
|
6
|
+
"JSBundleVersion": "2022.22.3",
|
|
7
7
|
"JSExecutableName": "jskit",
|
|
8
8
|
"NPMOrganization": "breakside",
|
|
9
9
|
"JSResources": [
|
|
10
10
|
"Tests/HTMLTestRunner.js",
|
|
11
11
|
"Tests/NodeTestRunner.js"
|
|
12
12
|
],
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "6f0b376edf61fbea02fd94b92f86de9e17d3b716"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -294,6 +294,44 @@ JSClass("JSAttributedString", JSObject, {
|
|
|
294
294
|
return new JSAttributedStringRunIterator(this, index);
|
|
295
295
|
},
|
|
296
296
|
|
|
297
|
+
longestRangeOfAttributeAtIndex: function(attributeName, index){
|
|
298
|
+
return this.longestRangeOfAttributesAtIndex([attributeName], index);
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
longestRangeOfAttributesAtIndex: function(attributeNames, index){
|
|
302
|
+
var runIndex = this._runIndexForStringIndex(index);
|
|
303
|
+
var run = this._runs[runIndex];
|
|
304
|
+
var range = JSRange(run.range);
|
|
305
|
+
var attributes = {};
|
|
306
|
+
var i, l;
|
|
307
|
+
for (i = 0, l = attributeNames.length; i < l; ++i){
|
|
308
|
+
attributes[attributeNames[i]] = run.attributes[attributeNames[i]];
|
|
309
|
+
}
|
|
310
|
+
i = runIndex - 1;
|
|
311
|
+
while (i >= 0){
|
|
312
|
+
run = this._runs[i];
|
|
313
|
+
if (run.containsEqualAttributes(attributes)){
|
|
314
|
+
range.length = range.end - run.range.location;
|
|
315
|
+
range.location = run.range.location;
|
|
316
|
+
}else{
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
--i;
|
|
320
|
+
}
|
|
321
|
+
i = runIndex + 1;
|
|
322
|
+
l = this._runs.length;
|
|
323
|
+
while (i < l){
|
|
324
|
+
run = this._runs[i];
|
|
325
|
+
if (run.containsEqualAttributes(attributes)){
|
|
326
|
+
range.length = run.range.end - range.location;
|
|
327
|
+
}else{
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
++i;
|
|
331
|
+
}
|
|
332
|
+
return range;
|
|
333
|
+
},
|
|
334
|
+
|
|
297
335
|
// MARK: - Formatting
|
|
298
336
|
|
|
299
337
|
replaceFormat: function(){
|
|
@@ -339,7 +377,7 @@ JSClass("JSAttributedString", JSObject, {
|
|
|
339
377
|
var runA;
|
|
340
378
|
for (var runIndex = lastRunIndex - 1; runIndex >= expandedRunRange.location; --runIndex){
|
|
341
379
|
runA = this._runs[runIndex];
|
|
342
|
-
if (runA.
|
|
380
|
+
if (runA.onlyContainsEqualAttributes(runB.attributes)){
|
|
343
381
|
this._runs.splice(runIndex, 1);
|
|
344
382
|
runB.range.location = runA.range.location;
|
|
345
383
|
runB.range.length += runA.range.length;
|
|
@@ -358,7 +396,7 @@ JSClass("JSAttributedString", JSObject, {
|
|
|
358
396
|
}
|
|
359
397
|
var runA = this._runs[runIndex - 1];
|
|
360
398
|
var runB = this._runs[runIndex];
|
|
361
|
-
if (runA.
|
|
399
|
+
if (runA.onlyContainsEqualAttributes(runB.attributes)){
|
|
362
400
|
this._runs.splice(runIndex, 1);
|
|
363
401
|
runA.range.length += runB.range.length;
|
|
364
402
|
}
|
|
@@ -471,35 +509,46 @@ function JSAttributedStringRun(range, attributes){
|
|
|
471
509
|
|
|
472
510
|
JSAttributedStringRun.prototype = {
|
|
473
511
|
|
|
474
|
-
|
|
512
|
+
containsEqualAttributes: function(attributes){
|
|
475
513
|
var attribute;
|
|
476
514
|
var a, b;
|
|
477
|
-
for (attribute in
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
if (
|
|
482
|
-
if (!a.isEqual(b)){
|
|
483
|
-
return false;
|
|
484
|
-
}
|
|
485
|
-
}else if (b.isEqual){
|
|
486
|
-
if (!b.isEqual(a)){
|
|
487
|
-
return false;
|
|
488
|
-
}
|
|
489
|
-
}else if (a != b){
|
|
515
|
+
for (attribute in attributes){
|
|
516
|
+
a = attributes[attribute];
|
|
517
|
+
b = this.attributes[attribute];
|
|
518
|
+
if (a === undefined){
|
|
519
|
+
if (!!b){
|
|
490
520
|
return false;
|
|
491
521
|
}
|
|
492
|
-
}else{
|
|
522
|
+
}else if (a === null){
|
|
523
|
+
if (b !== null && b !== undefined){
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
}else if (a.isEqual){
|
|
527
|
+
if (b === null || b === undefined){
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
if (!a.isEqual(b)){
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
}else if (a != b){
|
|
493
534
|
return false;
|
|
494
535
|
}
|
|
495
536
|
}
|
|
496
|
-
|
|
497
|
-
|
|
537
|
+
return true;
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
onlyContainsEqualAttributes: function(attributes){
|
|
541
|
+
if (!this.containsEqualAttributes(attributes)){
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
var attribute;
|
|
545
|
+
for (attribute in this.attributes){
|
|
546
|
+
if (!(attribute in attributes)){
|
|
498
547
|
return false;
|
|
499
548
|
}
|
|
500
549
|
}
|
|
501
550
|
return true;
|
|
502
|
-
}
|
|
551
|
+
},
|
|
503
552
|
|
|
504
553
|
};
|
|
505
554
|
|
|
@@ -55,7 +55,12 @@ JSClass("JSTextAttachment", JSObject, {
|
|
|
55
55
|
},
|
|
56
56
|
|
|
57
57
|
drawInContextAtPoint: function(context, point){
|
|
58
|
-
|
|
58
|
+
var rect = JSRect(point, this._size);
|
|
59
|
+
if (this._image.renderMode === JSImage.RenderMode.template){
|
|
60
|
+
context.fillMaskedRect(rect, this._image);
|
|
61
|
+
}else{
|
|
62
|
+
context.drawImage(this._image, rect);
|
|
63
|
+
}
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
});
|
|
@@ -61,7 +61,10 @@ JSClass("JSTextRun", JSObject, {
|
|
|
61
61
|
// context.fillEllipseInRect(JSRect(this.origin.x - 2.5, this.origin.y - 2.5, 5, 5));
|
|
62
62
|
// context.restore();
|
|
63
63
|
if (this.attachment){
|
|
64
|
+
context.save();
|
|
65
|
+
context.setFillColor(this.attributes.textColor);
|
|
64
66
|
this.attachment.drawInContextAtPoint(context, point);
|
|
67
|
+
context.restore();
|
|
65
68
|
}else{
|
|
66
69
|
context.save();
|
|
67
70
|
context.translateBy(point.x, point.y + this.font.ascender);
|
|
@@ -37,13 +37,13 @@ JSProtocol("UICollectionViewDelegate", JSProtocol, {
|
|
|
37
37
|
// Dragging cells
|
|
38
38
|
collectionViewShouldDragCellAtIndexPath: function(collectionView, indexPath){},
|
|
39
39
|
pasteboardItemsForCollectionViewAtIndexPath: function(collectionView, indexPath){},
|
|
40
|
-
collectionViewWillBeginDraggingSession: function(collectionView, session){},
|
|
40
|
+
collectionViewWillBeginDraggingSession: function(collectionView, session, indexPath, location){},
|
|
41
41
|
|
|
42
42
|
// Dragging destination
|
|
43
|
-
collectionViewDraggingSessionDidEnter: function(collectionView,
|
|
44
|
-
collectionViewDraggingSessionDidUpdate: function(collectionView,
|
|
45
|
-
collectionViewDraggingSessionDidExit: function(collectionView,
|
|
46
|
-
collectionViewPerformDragOperation: function(collectionView,
|
|
43
|
+
collectionViewDraggingSessionDidEnter: function(collectionView, session){},
|
|
44
|
+
collectionViewDraggingSessionDidUpdate: function(collectionView, session, indexPath){},
|
|
45
|
+
collectionViewDraggingSessionDidExit: function(collectionView, session){},
|
|
46
|
+
collectionViewPerformDragOperation: function(collectionView, session, operation, indexPath){}
|
|
47
47
|
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -1091,9 +1091,13 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
1091
1091
|
performDragOperation: function(session, operation){
|
|
1092
1092
|
var location = this.convertPointFromScreen(session.screenLocation);
|
|
1093
1093
|
var cell = this._cellHitTest(location);
|
|
1094
|
+
var indexPath = null;
|
|
1095
|
+
if (cell !== null){
|
|
1096
|
+
indexPath = cell.indexPath;
|
|
1097
|
+
}
|
|
1094
1098
|
this._updateDropTarget(null);
|
|
1095
|
-
if (
|
|
1096
|
-
this.delegate.collectionViewPerformDragOperation(this, session, operation,
|
|
1099
|
+
if (this.delegate && this.delegate.collectionViewPerformDragOperation){
|
|
1100
|
+
this.delegate.collectionViewPerformDragOperation(this, session, operation, indexPath);
|
|
1097
1101
|
}
|
|
1098
1102
|
},
|
|
1099
1103
|
|
|
@@ -104,7 +104,7 @@ JSClass("UIContainerView", UIView, {
|
|
|
104
104
|
maxSize.height < Number.MAX_VALUE ? maxSize.height - this._contentInsets.height : Number.MAX_VALUE
|
|
105
105
|
);
|
|
106
106
|
this._contentView.sizeToFitSize(maxContentSize);
|
|
107
|
-
this.bounds = JSRect(0, 0, this._contentView.bounds.size.width + this._contentInsets.width, this._contentView.bounds.size.height
|
|
107
|
+
this.bounds = JSRect(0, 0, this._contentView.bounds.size.width + this._contentInsets.width, this._contentView.bounds.size.height + this._contentInsets.height);
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
|
|
@@ -151,7 +151,10 @@ JSClass("UIHTMLTextFrame", JSTextFrame, {
|
|
|
151
151
|
if (attachmentInfo.context.element.parentNode !== attachmentInfo.run.element){
|
|
152
152
|
attachmentInfo.run.element.appendChild(attachmentInfo.context.element);
|
|
153
153
|
}
|
|
154
|
+
attachmentInfo.context.save();
|
|
155
|
+
attachmentInfo.context.setFillColor(attachmentInfo.run.attributes.textColor);
|
|
154
156
|
attachmentInfo.attachment.drawInContextAtPoint(attachmentInfo.context, JSPoint.Zero);
|
|
157
|
+
attachmentInfo.context.restore();
|
|
155
158
|
}
|
|
156
159
|
}else{
|
|
157
160
|
UIHTMLTextFrame.$super.drawInContextAtPoint.call(this, context, point);
|
|
@@ -37,7 +37,9 @@ JSClass("UIHTMLTextRun", JSTextRun, {
|
|
|
37
37
|
// not enough room for a line even when there really is.
|
|
38
38
|
// NOTE: we do NOT want to measure the html element here and cause an expensive layout.
|
|
39
39
|
// Only the UIHTMLTextFrame does the final measuring.
|
|
40
|
-
this.
|
|
40
|
+
if (!this.attachment){
|
|
41
|
+
this._size.height = font.displayLineHeight;
|
|
42
|
+
}
|
|
41
43
|
if (element.childNodes.length > 0 && element.firstChild.nodeType === element.TEXT_NODE){
|
|
42
44
|
this.textNode = element.firstChild;
|
|
43
45
|
}
|
|
@@ -434,6 +434,20 @@ UIHTMLTextTypesetterRunDescriptor.prototype = {
|
|
|
434
434
|
this.span.style.color = '';
|
|
435
435
|
this.span.style.backgroundColor = '';
|
|
436
436
|
this.span.style.pointerEvents = 'all';
|
|
437
|
+
|
|
438
|
+
// Cursor
|
|
439
|
+
var cursor = this.attributes[JSAttributedString.Attribute.cursor];
|
|
440
|
+
if (cursor){
|
|
441
|
+
var cssCursorStrings = cursor.cssStrings();
|
|
442
|
+
for (var i = 0, l = cssCursorStrings.length; i < l; ++i){
|
|
443
|
+
this.span.style.cursor = cssCursorStrings[i];
|
|
444
|
+
if (this.span.style.cursor !== ''){
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}else{
|
|
449
|
+
this.span.style.cursor = '';
|
|
450
|
+
}
|
|
437
451
|
}else{
|
|
438
452
|
this.span.style.display = '';
|
|
439
453
|
this.span.style.width = '';
|
|
@@ -155,6 +155,10 @@ JSClass("UIImageView", UIView, {
|
|
|
155
155
|
return JSSize(UIView.noIntrinsicSize, UIView.noIntrinsicSize);
|
|
156
156
|
},
|
|
157
157
|
|
|
158
|
+
sizeToFit: function(){
|
|
159
|
+
this.layer.sizeToFit();
|
|
160
|
+
},
|
|
161
|
+
|
|
158
162
|
// -------------------------------------------------------------------------
|
|
159
163
|
// MARK: - Accessibility
|
|
160
164
|
|