@breakside/jskit 2022.25.1 → 2022.26.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/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -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/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/UICursor.js +19 -4
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerCanvasContext.js +2 -48
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerContext.js +0 -6
- package/Root/Frameworks/UIKit/UIHTMLDisplayServerSVGContext.js +6 -77
- package/Root/Frameworks/UIKit/UIHTMLTextField.js +9 -3
- package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +2 -29
- package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +6 -79
- package/Root/Frameworks/UIKit/UILabel.js +72 -1
- package/Root/Frameworks/UIKit/UIMouseTrackingArea.js +55 -0
- package/Root/Frameworks/UIKit/UIState.js +16 -0
- package/Root/Frameworks/UIKit/UITextEditor.js +277 -76
- package/Root/Frameworks/UIKit/UITextEditorDelegate.js +3 -1
- package/Root/Frameworks/UIKit/UITextLayer.js +1 -1
- package/Root/Frameworks/UIKit/UIView.js +118 -46
- package/Root/Frameworks/UIKit/UIViewController.js +6 -0
- package/Root/Frameworks/UIKit/UIWindow.js +89 -0
- package/Root/Frameworks/UIKit/UIWindowServer.js +20 -79
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
JSProtocol("UITextEditorDelegate", JSProtocol, {
|
|
20
20
|
|
|
21
21
|
textEditorDidReplaceCharactersInRange: function(textEditor, range, insertedText){},
|
|
22
|
-
textEditorDidPositionCursors: function(textEditor){}
|
|
22
|
+
textEditorDidPositionCursors: function(textEditor){},
|
|
23
|
+
textEditorPrepareInsertAttributes: function(textEditor, attributes){},
|
|
24
|
+
atomicRangeForTextEditorIndex: function(textEditor, index){}
|
|
23
25
|
|
|
24
26
|
});
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
// #import "UITraitCollection.js"
|
|
23
23
|
// #import "UICursor.js"
|
|
24
24
|
// #import "UIAccessibility.js"
|
|
25
|
+
// #import "UIMouseTrackingArea.js"
|
|
25
26
|
'use strict';
|
|
26
27
|
|
|
27
28
|
JSGlobalObject.UIViewLayerProperty = function(){
|
|
@@ -183,7 +184,7 @@ JSClass('UIView', UIResponder, {
|
|
|
183
184
|
shadowColor: UIViewLayerProperty(),
|
|
184
185
|
shadowOffset: UIViewLayerProperty(),
|
|
185
186
|
shadowRadius: UIViewLayerProperty(),
|
|
186
|
-
cursor: JSDynamicProperty(
|
|
187
|
+
cursor: JSDynamicProperty(),
|
|
187
188
|
tooltip: null,
|
|
188
189
|
|
|
189
190
|
// -------------------------------------------------------------------------
|
|
@@ -329,11 +330,21 @@ JSClass('UIView', UIResponder, {
|
|
|
329
330
|
|
|
330
331
|
setWindow: function(window){
|
|
331
332
|
if (window != this._window){
|
|
332
|
-
if (this._window
|
|
333
|
-
this._window.firstResponder
|
|
333
|
+
if (this._window){
|
|
334
|
+
if (this._window.firstResponder === this){
|
|
335
|
+
this._window.firstResponder = null;
|
|
336
|
+
}
|
|
337
|
+
if (this._mouseTrackingAreas !== null && this._mouseTrackingAreas.length > 0){
|
|
338
|
+
this._window.removeMouseTrackingView(this);
|
|
339
|
+
}
|
|
334
340
|
}
|
|
335
341
|
this._setWindowServer(window ? window.windowServer : null);
|
|
336
342
|
this._window = window;
|
|
343
|
+
if (this._window){
|
|
344
|
+
if (this._mouseTrackingAreas !== null && this._mouseTrackingAreas.length > 0){
|
|
345
|
+
this._window.addMouseTrackingView(this);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
337
348
|
for (var i = 0, l = this.subviews.length; i < l; ++i){
|
|
338
349
|
this.subviews[i].window = window;
|
|
339
350
|
}
|
|
@@ -348,22 +359,6 @@ JSClass('UIView', UIResponder, {
|
|
|
348
359
|
|
|
349
360
|
_setWindowServer: function(windowServer, includeSubviews){
|
|
350
361
|
if (this._windowServer !== windowServer){
|
|
351
|
-
if (this.cursor !== null){
|
|
352
|
-
if (this._windowServer !== null){
|
|
353
|
-
this._windowServer.viewDidChangeCursor(this, null);
|
|
354
|
-
}
|
|
355
|
-
if (windowServer !== null){
|
|
356
|
-
windowServer.viewDidChangeCursor(this, this.cursor);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
if (this.mouseTrackingType !== UIView.MouseTracking.none){
|
|
360
|
-
if (this._windowServer !== null){
|
|
361
|
-
this._windowServer.viewDidChangeMouseTracking(this, UIView.MouseTracking.none);
|
|
362
|
-
}
|
|
363
|
-
if (windowServer !== null){
|
|
364
|
-
windowServer.viewDidChangeMouseTracking(this, this.mouseTrackingType);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
362
|
if (this.isAccessibilityElement){
|
|
368
363
|
if (this._windowServer !== null){
|
|
369
364
|
this._windowServer.postNotificationsForAccessibilityElementDestroyed(this);
|
|
@@ -381,13 +376,6 @@ JSClass('UIView', UIResponder, {
|
|
|
381
376
|
}
|
|
382
377
|
},
|
|
383
378
|
|
|
384
|
-
setCursor: function(cursor){
|
|
385
|
-
this._cursor = cursor;
|
|
386
|
-
if (this._windowServer !== null){
|
|
387
|
-
this._windowServer.viewDidChangeCursor(this, this.cursor);
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
|
|
391
379
|
windowDidChangeKeyStatus: function(){
|
|
392
380
|
for (var i = 0, l = this.subviews.length; i < l; ++i){
|
|
393
381
|
this.subviews[i].windowDidChangeKeyStatus();
|
|
@@ -547,6 +535,7 @@ JSClass('UIView', UIResponder, {
|
|
|
547
535
|
layerDidChangeSize: function(layer){
|
|
548
536
|
if (layer === this.layer){
|
|
549
537
|
this.invalidateFocusRingPath();
|
|
538
|
+
this.updateMouseTrackingAreas();
|
|
550
539
|
}
|
|
551
540
|
},
|
|
552
541
|
|
|
@@ -680,9 +669,8 @@ JSClass('UIView', UIResponder, {
|
|
|
680
669
|
},
|
|
681
670
|
|
|
682
671
|
// -------------------------------------------------------------------------
|
|
683
|
-
// MARK: - Responder
|
|
684
|
-
|
|
685
|
-
mouseTrackingType: 0,
|
|
672
|
+
// MARK: - Responder
|
|
673
|
+
|
|
686
674
|
isMultipleTouchEnabled: false,
|
|
687
675
|
|
|
688
676
|
isFirstResponder: function(){
|
|
@@ -696,24 +684,113 @@ JSClass('UIView', UIResponder, {
|
|
|
696
684
|
return this.superview;
|
|
697
685
|
},
|
|
698
686
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
687
|
+
keyActive: JSReadOnlyProperty(undefined, undefined, 'isKeyActive'),
|
|
688
|
+
|
|
689
|
+
isKeyActive: function(){
|
|
690
|
+
return this.window !== null && this.window.isKeyWindow && this.window.firstResponder === this;
|
|
691
|
+
},
|
|
692
|
+
|
|
693
|
+
// -------------------------------------------------------------------------
|
|
694
|
+
// MARK: - Mouse Tracking
|
|
695
|
+
|
|
696
|
+
_mouseTrackingAreas: null,
|
|
697
|
+
|
|
698
|
+
addMouseTrackingArea: function(trackingArea){
|
|
699
|
+
if (this._mouseTrackingAreas === null){
|
|
700
|
+
this._mouseTrackingAreas = [];
|
|
701
|
+
}
|
|
702
|
+
var index = this._mouseTrackingAreas.indexOf(trackingArea);
|
|
703
|
+
if (index < 0){
|
|
704
|
+
trackingArea.view = this;
|
|
705
|
+
this._mouseTrackingAreas.push(trackingArea);
|
|
706
|
+
if (this._mouseTrackingAreas.length === 1 && this._window !== null){
|
|
707
|
+
this._window.addMouseTrackingView(this);
|
|
708
|
+
}
|
|
703
709
|
}
|
|
704
710
|
},
|
|
705
711
|
|
|
706
|
-
|
|
707
|
-
this.
|
|
708
|
-
|
|
709
|
-
|
|
712
|
+
removeMouseTrackingArea: function(trackingArea){
|
|
713
|
+
if (this._mouseTrackingAreas !== null){
|
|
714
|
+
var index = this._mouseTrackingAreas.indexOf(trackingArea);
|
|
715
|
+
if (index >= 0){
|
|
716
|
+
if (trackingArea._entered && trackingArea.cursor !== null){
|
|
717
|
+
trackingArea.cursor.unset();
|
|
718
|
+
}
|
|
719
|
+
trackingArea._entered = false;
|
|
720
|
+
trackingArea.view = null;
|
|
721
|
+
this._mouseTrackingAreas.splice(index, 1);
|
|
722
|
+
if (this._window !== null && this._mouseTrackingAreas.length === 0){
|
|
723
|
+
this._window.removeMouseTrackingView(this);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
710
726
|
}
|
|
711
727
|
},
|
|
712
728
|
|
|
713
|
-
|
|
729
|
+
updateMouseTrackingAreas: function(){
|
|
730
|
+
if (this._startStopMouseTrackingArea !== null){
|
|
731
|
+
this._startStopMouseTrackingArea.rect = this.bounds;
|
|
732
|
+
}
|
|
733
|
+
if (this._cursorMouseTrackingArea !== null){
|
|
734
|
+
this._cursorMouseTrackingArea.rect = this.bounds;
|
|
735
|
+
}
|
|
736
|
+
},
|
|
714
737
|
|
|
715
|
-
|
|
716
|
-
|
|
738
|
+
_cursorMouseTrackingArea: null,
|
|
739
|
+
|
|
740
|
+
setCursor: function(cursor){
|
|
741
|
+
if (this._cursorMouseTrackingArea === null){
|
|
742
|
+
if (cursor !== null){
|
|
743
|
+
this._cursorMouseTrackingArea = UIMouseTrackingArea.initWithResponder(this, this.bounds, UIMouseTrackingArea.TrackingType.enterAndExit);
|
|
744
|
+
this._cursorMouseTrackingArea.cursor = cursor;
|
|
745
|
+
this.addMouseTrackingArea(this._cursorMouseTrackingArea);
|
|
746
|
+
}
|
|
747
|
+
}else{
|
|
748
|
+
if (cursor !== null){
|
|
749
|
+
this._cursorMouseTrackingArea.cursor = cursor;
|
|
750
|
+
if (this._cursorMouseTrackingArea._entered){
|
|
751
|
+
cursor.set();
|
|
752
|
+
}
|
|
753
|
+
}else{
|
|
754
|
+
this.removeMouseTrackingArea(this._cursorMouseTrackingArea);
|
|
755
|
+
this._cursorMouseTrackingArea = null;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
|
|
760
|
+
getCursor: function(){
|
|
761
|
+
if (this._cursorMouseTrackingArea !== null){
|
|
762
|
+
return this._cursorMouseTrackingArea.cursor;
|
|
763
|
+
}
|
|
764
|
+
return null;
|
|
765
|
+
},
|
|
766
|
+
|
|
767
|
+
// legacy/deprecated
|
|
768
|
+
|
|
769
|
+
mouseTrackingType: JSReadOnlyProperty(),
|
|
770
|
+
|
|
771
|
+
getMouseTrackingType: function(){
|
|
772
|
+
if (this._startStopMouseTrackingArea !== null){
|
|
773
|
+
return this._startStopMouseTrackingArea.trackingType;
|
|
774
|
+
}
|
|
775
|
+
return UIView.MouseTracking.none;
|
|
776
|
+
},
|
|
777
|
+
|
|
778
|
+
_startStopMouseTrackingArea: null,
|
|
779
|
+
|
|
780
|
+
startMouseTracking: function(trackingType){
|
|
781
|
+
if (this._startStopMouseTrackingArea === null){
|
|
782
|
+
this._startStopMouseTrackingArea = UIMouseTrackingArea.initWithResponder(this, this.bounds, trackingType);
|
|
783
|
+
this.addMouseTrackingArea(this._startStopMouseTrackingArea);
|
|
784
|
+
}else{
|
|
785
|
+
this._startStopMouseTrackingArea.trackingType = trackingType;
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
|
|
789
|
+
stopMouseTracking: function(){
|
|
790
|
+
if (this._startStopMouseTrackingArea !== null){
|
|
791
|
+
this.removeMouseTrackingArea(this._startStopMouseTrackingArea);
|
|
792
|
+
this._startStopMouseTrackingArea = null;
|
|
793
|
+
}
|
|
717
794
|
},
|
|
718
795
|
|
|
719
796
|
// -------------------------------------------------------------------------
|
|
@@ -1047,12 +1124,7 @@ JSClass('UIView', UIResponder, {
|
|
|
1047
1124
|
|
|
1048
1125
|
});
|
|
1049
1126
|
|
|
1050
|
-
UIView.MouseTracking =
|
|
1051
|
-
none: 0,
|
|
1052
|
-
move: 1,
|
|
1053
|
-
enterAndExit: 2,
|
|
1054
|
-
all: 3
|
|
1055
|
-
};
|
|
1127
|
+
UIView.MouseTracking = UIMouseTrackingArea.TrackingType;
|
|
1056
1128
|
|
|
1057
1129
|
UIView.layerClass = UILayer;
|
|
1058
1130
|
|
|
@@ -307,9 +307,15 @@ JSClass("UIViewController", UIResponder, {
|
|
|
307
307
|
}
|
|
308
308
|
}else{
|
|
309
309
|
if (previousChildViewController !== null){
|
|
310
|
+
if (previousChildViewController._lifecycleState === UIViewController.LifecycleState.appearing){
|
|
311
|
+
previousChildViewController.scheduleDisappearance();
|
|
312
|
+
}
|
|
310
313
|
previousChildViewController.removeFromParentViewController();
|
|
311
314
|
}
|
|
312
315
|
if (childViewController !== null){
|
|
316
|
+
if (this._lifecycleState === UIViewController.LifecycleState.appearing){
|
|
317
|
+
childViewController.beginAppearance(this._appearanceTransitionAnimated);
|
|
318
|
+
}
|
|
313
319
|
this.addChildViewController(childViewController);
|
|
314
320
|
}
|
|
315
321
|
}
|
|
@@ -752,6 +752,95 @@ JSClass('UIWindow', UIView, {
|
|
|
752
752
|
return JSRect(this.convertPointToScreen(rect.origin), rect.size);
|
|
753
753
|
},
|
|
754
754
|
|
|
755
|
+
// -------------------------------------------------------------------------
|
|
756
|
+
// MARK: - Mouse Tracking
|
|
757
|
+
|
|
758
|
+
mouseTrackingViews: null,
|
|
759
|
+
|
|
760
|
+
addMouseTrackingView: function(view){
|
|
761
|
+
if (this.mouseTrackingViews === null){
|
|
762
|
+
this.mouseTrackingViews = [];
|
|
763
|
+
}
|
|
764
|
+
var index = this.mouseTrackingViews.indexOf(view);
|
|
765
|
+
if (index < 0){
|
|
766
|
+
this.mouseTrackingViews.push(view);
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
|
|
770
|
+
removeMouseTrackingView: function(view){
|
|
771
|
+
if (this.mouseTrackingViews === null){
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
var index = this.mouseTrackingViews.indexOf(view);
|
|
775
|
+
if (index >= 0){
|
|
776
|
+
this.mouseTrackingViews.splice(index, 1);
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
|
|
780
|
+
sendMouseTrackingEvents: function(locationInWindow, timestamp, modifiers, isExiting){
|
|
781
|
+
if (this.mouseTrackingViews === null || this.mouseTrackingViews.length === 0){
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
var view;
|
|
785
|
+
var area;
|
|
786
|
+
var viewIndex, viewCount;
|
|
787
|
+
var areaIndex, areaCount;
|
|
788
|
+
var location;
|
|
789
|
+
var enters = [];
|
|
790
|
+
var exits = [];
|
|
791
|
+
var moves = [];
|
|
792
|
+
for (viewIndex = 0, viewCount = this.mouseTrackingViews.length; viewIndex < viewCount; ++viewIndex){
|
|
793
|
+
view = this.mouseTrackingViews[viewIndex];
|
|
794
|
+
location = this.convertPointToView(locationInWindow, view);
|
|
795
|
+
for (areaIndex = 0, areaCount = view._mouseTrackingAreas.length; areaIndex < areaCount; ++areaIndex){
|
|
796
|
+
area = view._mouseTrackingAreas[areaIndex];
|
|
797
|
+
if (!isExiting && !view.hidden && view.userInteractionEnabled && area.containsPoint(location)){
|
|
798
|
+
if (!area._entered){
|
|
799
|
+
area._entered = true;
|
|
800
|
+
if ((area.trackingType & UIMouseTrackingArea.TrackingType.enterAndExit) !== 0){
|
|
801
|
+
enters.push(area);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
if ((area.trackingType & UIMouseTrackingArea.TrackingType.move) !== 0){
|
|
805
|
+
moves.push(area);
|
|
806
|
+
}
|
|
807
|
+
}else{
|
|
808
|
+
if (area._entered){
|
|
809
|
+
area._entered = false;
|
|
810
|
+
if ((area.trackingType & UIMouseTrackingArea.TrackingType.enterAndExit) !== 0){
|
|
811
|
+
exits.push(area);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
// FIXME: the order could be important here for views that overlap and
|
|
818
|
+
// set cursors. We'd want the topmost one to be called last for enters
|
|
819
|
+
// and first for exits
|
|
820
|
+
var event;
|
|
821
|
+
if (exits.length > 0){
|
|
822
|
+
event = UIEvent.initMouseEventWithType(UIEvent.Type.mouseExited, timestamp, this, locationInWindow, modifiers, 0);
|
|
823
|
+
for (areaIndex = 0, areaCount = exits.length; areaIndex < areaCount; ++areaIndex){
|
|
824
|
+
area = exits[areaIndex];
|
|
825
|
+
area.mouseExited(event);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
if (enters.length > 0){
|
|
829
|
+
event = UIEvent.initMouseEventWithType(UIEvent.Type.mouseEntered, timestamp, this, locationInWindow, modifiers, 0);
|
|
830
|
+
for (areaIndex = 0, areaCount = enters.length; areaIndex < areaCount; ++areaIndex){
|
|
831
|
+
area = enters[areaIndex];
|
|
832
|
+
area.mouseEntered(event);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
if (moves.length > 0){
|
|
836
|
+
event = UIEvent.initMouseEventWithType(UIEvent.Type.mouseMoved, timestamp, this, locationInWindow, modifiers, 0);
|
|
837
|
+
for (areaIndex = 0, areaCount = moves.length; areaIndex < areaCount; ++areaIndex){
|
|
838
|
+
area = moves[areaIndex];
|
|
839
|
+
area.mouseMoved(event);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
|
|
755
844
|
// -------------------------------------------------------------------------
|
|
756
845
|
// MARK: - Event Dispatch
|
|
757
846
|
|
|
@@ -209,6 +209,9 @@ JSClass("UIWindowServer", JSObject, {
|
|
|
209
209
|
this.windowStack.splice(i, 1);
|
|
210
210
|
this.displayServer.windowRemoved(window);
|
|
211
211
|
window._screen = null;
|
|
212
|
+
if (window === this._mouseTrackingWindow){
|
|
213
|
+
this._mouseTrackingWindow = null;
|
|
214
|
+
}
|
|
212
215
|
break;
|
|
213
216
|
}
|
|
214
217
|
this.windowStack[i].subviewIndex = this.windowStack[i].layer.sublayerIndex = i - 1;
|
|
@@ -252,23 +255,10 @@ JSClass("UIWindowServer", JSObject, {
|
|
|
252
255
|
this._endWindowOrderChange();
|
|
253
256
|
},
|
|
254
257
|
|
|
255
|
-
_previousEventWindow: null,
|
|
256
|
-
|
|
257
258
|
_beginWindowOrderChange: function(){
|
|
258
|
-
if (this._previousEventWindow !== null){
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
this._previousEventWindow = this.windowForEventAtLocation(this.mouseLocation);
|
|
262
259
|
},
|
|
263
260
|
|
|
264
261
|
_endWindowOrderChange: function(){
|
|
265
|
-
if (this._previousEventWindow === null){
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
var previousEventWindow = this._previousEventWindow;
|
|
269
|
-
var currentEventWindow = this.windowForEventAtLocation(this.mouseLocation);
|
|
270
|
-
this._previousEventWindow = null;
|
|
271
|
-
this._createTrackingEventsForWindowLevelChangeAtLocation(this.mouseLocation, previousEventWindow, currentEventWindow);
|
|
272
262
|
},
|
|
273
263
|
|
|
274
264
|
// -----------------------------------------------------------------------
|
|
@@ -325,10 +315,6 @@ JSClass("UIWindowServer", JSObject, {
|
|
|
325
315
|
// -----------------------------------------------------------------------
|
|
326
316
|
// MARK: - Cursor Managment
|
|
327
317
|
|
|
328
|
-
viewDidChangeCursor: function(view, cursor){
|
|
329
|
-
// subclasses should override
|
|
330
|
-
},
|
|
331
|
-
|
|
332
318
|
hideCursor: function(){
|
|
333
319
|
// subclasses should override
|
|
334
320
|
},
|
|
@@ -696,6 +682,7 @@ JSClass("UIWindowServer", JSObject, {
|
|
|
696
682
|
this.draggingSessionDidChangeLocation();
|
|
697
683
|
}else{
|
|
698
684
|
if (this.mouseDownCount === 0){
|
|
685
|
+
this.sendMouseTrackingEvents(timestamp, modifiers);
|
|
699
686
|
if (this._tooltipWindow === null){
|
|
700
687
|
this._mouseIdleTimer.schedule();
|
|
701
688
|
}else{
|
|
@@ -728,74 +715,28 @@ JSClass("UIWindowServer", JSObject, {
|
|
|
728
715
|
// -----------------------------------------------------------------------
|
|
729
716
|
// MARK: - Mouse Tracking
|
|
730
717
|
|
|
731
|
-
|
|
732
|
-
// subclasses should override
|
|
733
|
-
},
|
|
734
|
-
|
|
735
|
-
createMouseTrackingEvent: function(type, timestamp, location, modifiers, view, force){
|
|
736
|
-
if (!force && !this._shouldCreateTrackingEventForView(view)){
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
var event = UIEvent.initMouseEventWithType(type, timestamp, view.window, view.window.convertPointFromScreen(location), modifiers, 0);
|
|
740
|
-
event.trackingView = view;
|
|
741
|
-
this._sendEventToApplication(event, view.window.application);
|
|
742
|
-
},
|
|
743
|
-
|
|
744
|
-
_shouldCreateTrackingEventForView: function(view){
|
|
745
|
-
if (this.mouseEventWindow !== null){
|
|
746
|
-
// no tracking events if the mouse is down
|
|
747
|
-
return false;
|
|
748
|
-
}
|
|
749
|
-
var window = view.window;
|
|
750
|
-
if (window === null){
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
753
|
-
if (window.shouldReceiveTrackingInBack){
|
|
754
|
-
return true;
|
|
755
|
-
}
|
|
756
|
-
if (window.receivesAllEvents){
|
|
757
|
-
return true;
|
|
758
|
-
}
|
|
759
|
-
if (window === this.mainWindow){
|
|
760
|
-
return true;
|
|
761
|
-
}
|
|
762
|
-
if (window === this.keyWindow){
|
|
763
|
-
return true;
|
|
764
|
-
}
|
|
765
|
-
return true;
|
|
766
|
-
},
|
|
718
|
+
_mouseTrackingWindow: null,
|
|
767
719
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
if (
|
|
776
|
-
|
|
720
|
+
sendMouseTrackingEvents: function(timestamp, modifiers){
|
|
721
|
+
var window = null;
|
|
722
|
+
var windowIndex;
|
|
723
|
+
var location;
|
|
724
|
+
var event;
|
|
725
|
+
for (windowIndex = this.windowStack.length - 1; windowIndex >= 0 && window === null; --windowIndex){
|
|
726
|
+
location = this.windowStack[windowIndex].convertPointFromScreen(this.mouseLocation);
|
|
727
|
+
if (this.windowStack[windowIndex].userInteractionEnabled && this.windowStack[windowIndex].containsPoint(location)){
|
|
728
|
+
window = this.windowStack[windowIndex];
|
|
777
729
|
}
|
|
778
730
|
}
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
this.createMouseTrackingEvent(UIEvent.Type.mouseEntered, -1, location, UIEvent.Modifier.none, view, true);
|
|
731
|
+
if (this._mouseTrackingWindow !== null){
|
|
732
|
+
if (window !== this._mouseTrackingWindow){
|
|
733
|
+
this._mouseTrackingWindow.sendMouseTrackingEvents(this._mouseTrackingWindow.convertPointFromScreen(this.mouseLocation), timestamp, modifiers, true);
|
|
783
734
|
}
|
|
784
735
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
var view = window.hitTest(window.convertPointFromScreen(location));
|
|
789
|
-
if (view === null){
|
|
790
|
-
return null;
|
|
791
|
-
}
|
|
792
|
-
while (view.superview !== null && ((view.mouseTrackingType & UIView.MouseTracking.enterAndExit) === 0)){
|
|
793
|
-
view = view.superview;
|
|
736
|
+
this._mouseTrackingWindow = window;
|
|
737
|
+
if (this._mouseTrackingWindow !== null){
|
|
738
|
+
this._mouseTrackingWindow.sendMouseTrackingEvents(this._mouseTrackingWindow.convertPointFromScreen(this.mouseLocation), timestamp, modifiers, false);
|
|
794
739
|
}
|
|
795
|
-
if ((view.mouseTrackingType & UIView.MouseTracking.enterAndExit) !== 0){
|
|
796
|
-
return view;
|
|
797
|
-
}
|
|
798
|
-
return null;
|
|
799
740
|
},
|
|
800
741
|
|
|
801
742
|
// -----------------------------------------------------------------------
|