[Libreoffice-commits] online.git: 2 commits - loleaflet/js
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Sat Nov 16 18:28:20 UTC 2019
loleaflet/js/jquery.mCustomScrollbar.js | 44 +++++++++++++++++---------------
1 file changed, 24 insertions(+), 20 deletions(-)
New commits:
commit 59d3c2d20da32049b62293c01a5329e07bac0895
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Nov 15 10:14:25 2019 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Sat Nov 16 19:28:13 2019 +0100
mCustomScrollbar: remove unnecessary access to Window top property
When the frame is null, it is referring to a container frame window that
it is always not accessible.
Change-Id: Ie96a05327928b2b72ce5577409e368061b2afa1e
Reviewed-on: https://gerrit.libreoffice.org/82798
Reviewed-by: Henry Castro <hcastro at collabora.com>
Tested-by: Henry Castro <hcastro at collabora.com>
diff --git a/loleaflet/js/jquery.mCustomScrollbar.js b/loleaflet/js/jquery.mCustomScrollbar.js
index d91b86108..b2c91c88e 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1544,10 +1544,6 @@ and dependencies (minified).
_canAccessIFrame=function(iframe){
var html=null;
if(!iframe){
- try{
- var doc=top.document;
- html=doc.body.innerHTML;
- }catch(err){/* do nothing */}
return(html!==null);
}else{
try{
commit cb7813ef351fd44b265f96bdb646cb4cfe89fd65
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Nov 15 09:18:32 2019 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Sat Nov 16 19:28:01 2019 +0100
mCustomScrollbar: reduce the number of _coordinates function calls
The _coordinates function is called several times to compute
the same coordinate value.
Change-Id: I6e187b74709515ddde77d60649e564cb2b484fb4
Reviewed-on: https://gerrit.libreoffice.org/82797
Reviewed-by: Henry Castro <hcastro at collabora.com>
Tested-by: Henry Castro <hcastro at collabora.com>
diff --git a/loleaflet/js/jquery.mCustomScrollbar.js b/loleaflet/js/jquery.mCustomScrollbar.js
index 14bf9d9a2..d91b86108 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1218,7 +1218,8 @@ and dependencies (minified).
_iframe(false); /* enable scrollbar dragging over iframes by disabling their events */
_stop($this);
draggable=$(this);
- var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
+ var coordinates = _coordinates(e);
+ var offset=draggable.offset(),y=coordinates[0]-offset.top,x=coordinates[1]-offset.left,
h=draggable.height()+offset.top,w=draggable.width()+offset.left;
if(y<h && y>0 && x<w && x>0){
dragY=y;
@@ -1228,12 +1229,14 @@ and dependencies (minified).
}).bind("touchmove."+namespace,function(e){
e.stopImmediatePropagation();
e.preventDefault();
- var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
+ var coordinates = _coordinates(e);
+ var offset=draggable.offset(),y=coordinates[0]-offset.top,x=coordinates[1]-offset.left;
_drag(dragY,dragX,y,x);
});
$(document).add(eds).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
if(draggable){
- var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
+ var coordinates = _coordinates(e);
+ var offset=draggable.offset(),y=coordinates[0]-offset.top,x=coordinates[1]-offset.left;
if(dragY===y && dragX===x){return;} /* has it really moved? */
_drag(dragY,dragX,y,x);
}
@@ -1313,26 +1316,28 @@ and dependencies (minified).
});
}
function _onTouchstart(e){
- if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
+ var coordinates = _coordinates(e);
+ if(!_pointerTouch(e) || touchActive || coordinates[2]){touchable=0; return;}
touchable=1; touchDrag=0; docDrag=0; draggable=1;
$this.removeClass("mCS_touch_action");
var offset=mCSB_container.offset();
- dragY=_coordinates(e)[0]-offset.top;
- dragX=_coordinates(e)[1]-offset.left;
- touchIntent=[_coordinates(e)[0],_coordinates(e)[1]];
+ dragY=coordinates[0]-offset.top;
+ dragX=coordinates[1]-offset.left;
+ touchIntent=[coordinates[0],coordinates[1]];
}
function _onTouchmove(e){
- if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
+ var coordinates = _coordinates(e);
+ if(!_pointerTouch(e) || touchActive || coordinates[2]){return;}
if(!o.documentTouchScroll){e.preventDefault();}
e.stopImmediatePropagation();
if(docDrag && !touchDrag){return;}
if(draggable){
runningTime=_getTime();
- var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
+ var offset=mCustomScrollBox.offset(),y=coordinates[0]-offset.top,x=coordinates[1]-offset.left,
easing="mcsLinearOut";
touchMoveY.push(y);
touchMoveX.push(x);
- touchIntent[2]=Math.abs(_coordinates(e)[0]-touchIntent[0]); touchIntent[3]=Math.abs(_coordinates(e)[1]-touchIntent[1]);
+ touchIntent[2]=Math.abs(coordinates[0]-touchIntent[0]); touchIntent[3]=Math.abs(coordinates[1]-touchIntent[1]);
if(d.overflowed[0]){
var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y) && (touchIntent[3]*2<touchIntent[2] || o.axis==="yx"));
@@ -1356,23 +1361,25 @@ and dependencies (minified).
}
}
function _onTouchstart2(e){
- if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
+ var coordinates = _coordinates(e);
+ if(!_pointerTouch(e) || touchActive || coordinates[2]){touchable=0; return;}
touchable=1;
e.stopImmediatePropagation();
_stop($this);
startTime=_getTime();
var offset=mCustomScrollBox.offset();
- touchStartY=_coordinates(e)[0]-offset.top;
- touchStartX=_coordinates(e)[1]-offset.left;
+ touchStartY=coordinates[0]-offset.top;
+ touchStartX=coordinates[1]-offset.left;
touchMoveY=[]; touchMoveX=[];
}
function _onTouchend(e){
- if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
+ var coordinates = _coordinates(e);
+ if(!_pointerTouch(e) || touchActive || coordinates[2]){return;}
draggable=0;
e.stopImmediatePropagation();
touchDrag=0; docDrag=0;
endTime=_getTime();
- var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
+ var offset=mCustomScrollBox.offset(),y=coordinates[0]-offset.top,x=coordinates[1]-offset.left;
if((endTime-runningTime)>30){return;}
speed=1000/(endTime-startTime);
var easing="mcsEaseOut",slow=speed<2.5,
@@ -1427,8 +1434,9 @@ and dependencies (minified).
if(!action){action=1; touchActive=true;}
}).add(document).bind("mousemove."+namespace,function(e){
if(!touchable && action && _sel()){
+ var coordinates = _coordinates(e);
var offset=mCSB_container.offset(),
- y=_coordinates(e)[0]-offset.top+mCSB_container[0].offsetTop,x=_coordinates(e)[1]-offset.left+mCSB_container[0].offsetLeft;
+ y=coordinates[0]-offset.top+mCSB_container[0].offsetTop,x=coordinates[1]-offset.left+mCSB_container[0].offsetLeft;
if(y>0 && y<wrapper.height() && x>0 && x<wrapper.width()){
if(seq.step){_seq("off",null,"stepped");}
}else{
More information about the Libreoffice-commits
mailing list