mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
c0011dadb2
- Bug 1160013 CachePushStreamChild should hold the parent DOM object alive. r=baku (07626c5e44) - Bug 1179772 Make Cache API honor devtools SW testing flag in SW itself. r=ehsan (4d915be43c) - Bug 1181577 Delay creation of QuotaInitRunnable until Cache Context actually started. r=ehsan (9991aafa07) - Bug 1210128 Ensure Cache API context internal state is consistent when shutdown during initialization. r=janv (25fbcf3136) - Bug 1138916 Fix Cache::MatchAll() assertion in WorkerFeature handling. r=baku (73fe25803b) - Bug 1186312 - Cache API should not accept system principals for child processes. r=bkelly (c140f627f8) - align (acb75b3a8d) - Bug 1215290 Cache API should store unfiltered Response URL. r=ehsan (55238dd04a) - Bug 1217501 P4 Fill headers before setting guard when reading response from Cache. r=ehsan (787cb31d84) - bits of Bug 1202902 (82e2e451cc) - Bug 1147329 - Handle in-process case for Cut/Copy/Paste feature. r=kanru (66cabbf705) - Bug 1199161 - Add selectedTextContent to CaretStateChangedEvent. r=kanru, sr=smaug (5eb99e303b) - Bug 1217515 - Clean up the way touch event support is configured. r=roc (24a7db4a42) - Bug 1216937 - Assign default URL for mozbrowseropenwindow event. r=smaug (fc7aaa533b) - Bug 1101115, implement nsChromeRegistryContent::IsLocaleRTL so that file directory view works in e10s rtl mode, r=bsmedberg (c0eb12391f) - Bug 1186787 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj. (2508253415) - Bug 1186787 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj. (193c37c478) - Bug 1170207 - allow overrides of chrome://../skin/ URIs with other chrome://../skin/ URIs within skin manifests, r=bsmedberg (3c24e2006c) - Bug 1210463 - part 3 - Remove the very obsolete NS_IMPL_MOZILLA192_NSGETMODULE. r=froydnj (c7300c145b) - Bug 1210463 - part 1 - Remove some unneeded null checks on new in ModuleUtils. r=froydnj (73affb8e34) - Bug 1210463 - part 2 - Use some smart pointers in ModuleUtils.h. r=froydnj (f5eeb12cb3) - Bug 1210463 - part 2 - Use some smart pointers in ModuleUtils.h. r=froydnj (788f944a41) - Bug 1215143 - FF Android VR returns orientation that is 90deg off on x-axis. r=vlad (fc0d86c800) - Bug 1166667 - Remove LangGroupFromUnicodeRange due to unused. r=jfkthame (e3bb039e41) - Bug 1119062 - enable unicode-range in release builds. r=dbaron (8d48c7ab14) - bits of 1117227 in headers (ad920e2094) - Bug 1220020. Recompute the current animated geometry root when a child scroll frame forces us to be layerized, and therefore turns us into an animated geometry root. r=mstange (4cfb015eb7) - Bug 1220114. Part 1. Change ScrollFrameHelper::DecideScrollableLayer to recompute the current animated geometry root any time mWillBuildScrollableLayer changes in addition to when usingDisplayPort changes. r=mstange (9e8512babe) - Bug 1220114. Part 2. If a scroll frame is forced to layerize because of an active descendant scroll frame then set a displayport on the ancestor scroll frame so that next paint we don't have to force layerization after the fact and we can do a fully proper paint. r=mstange (a3d7734f75) - Bug 1228357 - When saving/restoring a scrollframe's state, only save/restore resolution for the root scrollframe. r=roc (7018d5bcae) - Bug 1224307 - Fix page scrolling for non-full-width fixed headers/footers [r=tn] Please enter the commit message for your changes. Lines starting (55eebe3d49) - Bug 1081272 - Include position and transform when computing header/footer size [r=tn] (c91104a099) - Bug 1145546: take auto-direction into account in GetScrolledRect, r=jfkthame (a5bf400639) - spaces (4a2918cb4c) - Bug 1225376 part 1 - [css-align] Don't compute left/right to start in the style system anymore (due to pending spec change). Map the used value instead (in layout). r=dholbert (677b9eba16) - Bug 1225376 part 2 - [css-align] Add mochitests for align/justify-items/self/content computed values. (580ef62eb6) - Bug 1225376 part 3 - [css-grid] Crashtest. (3e5b06dce4) - Bug 1148515 - Do the scrollbar thumb layer wrapping in nsSliderFrameso that the thumb's event region is wrapped, too. r=tn (0ff596193e) - Bug 1133732. Header include got missed in rebase. on CLOSED TREE (b870504066) - Bug 1133732. Make button box frames listen for blurs so they de-activate on blur. r=smaug (5c6274f99d) - Bug 1170052 part 1: Refactor nsImageBoxFrame::PaintImage() so its final failure case is an early return. r=seth (7308f3f32e) - Bug 1170052 part 2: Support object-fit & object-position on XUL <image src=""> elements. r=seth (74ab4c8813) - Bug 1170052 part 3: Add scripts to generate reftests for object-fit/object-position applied to XUL <image>. (NPOTB) (5b1e1b6b90) - Bug 1170052 part 4: Add reftests for object-fit/object-position on XUL <image> element (as modified copies of existing <img> tests). (test-only) (7f678646e8) - Bug 1170052 part 5: Mark new reftests as "skip-if(Mulet)" to avoid impacting reftest chunking on that platform in a way that makes SVG reftests fail mysteriously. (d6c7e5ff05) - Bug 1170052 part 6: Skip new XUL reftests on B2G Emulator as well, since XUL reftests trigger error pages on that platform. (3f4ddeddcd) - Bug 1194493 - Ensure the 'mVertical' flag is set appropriately on the nsFontMetrics we use to draw text for an nsTextBoxFrame. r=smontagu (a6eed3f9b8) - Bug 1155359 - Set NS_FRAME_IS_BIDI on nsTextBoxFrame if text direction is set to RTL r=roc (2715d47271) - crash reporter (015ee49944)
222 lines
7.8 KiB
JavaScript
222 lines
7.8 KiB
JavaScript
/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
/* vim: set ts=2 sw=2 sts=2 et: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
dump("############################### browserElementPanning.js loaded\n");
|
|
|
|
var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
Cu.import("resource://gre/modules/Geometry.jsm");
|
|
|
|
const kObservedEvents = [
|
|
"BEC:ShownModalPrompt",
|
|
"Activity:Success",
|
|
"Activity:Error"
|
|
];
|
|
|
|
const ContentPanning = {
|
|
init: function cp_init() {
|
|
addEventListener("unload",
|
|
this._unloadHandler.bind(this),
|
|
/* useCapture = */ false,
|
|
/* wantsUntrusted = */ false);
|
|
|
|
addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
|
|
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
|
|
addEventListener("visibilitychange", this._handleVisibilityChange.bind(this));
|
|
kObservedEvents.forEach((topic) => {
|
|
Services.obs.addObserver(this, topic, false);
|
|
});
|
|
},
|
|
|
|
observe: function cp_observe(subject, topic, data) {
|
|
this._resetHover();
|
|
},
|
|
|
|
get _domUtils() {
|
|
delete this._domUtils;
|
|
return this._domUtils = Cc['@mozilla.org/inspector/dom-utils;1']
|
|
.getService(Ci.inIDOMUtils);
|
|
},
|
|
|
|
_resetHover: function cp_resetHover() {
|
|
const kStateHover = 0x00000004;
|
|
try {
|
|
let element = content.document.createElement('foo');
|
|
this._domUtils.setContentState(element, kStateHover);
|
|
} catch(e) {}
|
|
},
|
|
|
|
_recvViewportChange: function(data) {
|
|
let metrics = data.json;
|
|
this._viewport = new Rect(metrics.x, metrics.y,
|
|
metrics.viewport.width,
|
|
metrics.viewport.height);
|
|
this._cssCompositedRect = new Rect(metrics.x, metrics.y,
|
|
metrics.cssCompositedRect.width,
|
|
metrics.cssCompositedRect.height);
|
|
this._cssPageRect = new Rect(metrics.cssPageRect.x,
|
|
metrics.cssPageRect.y,
|
|
metrics.cssPageRect.width,
|
|
metrics.cssPageRect.height);
|
|
},
|
|
|
|
_recvDoubleTap: function(data) {
|
|
data = data.json;
|
|
|
|
// We haven't received a metrics update yet; don't do anything.
|
|
if (this._viewport == null) {
|
|
return;
|
|
}
|
|
|
|
let win = content;
|
|
|
|
let element = ElementTouchHelper.anyElementFromPoint(win, data.x, data.y);
|
|
if (!element) {
|
|
this._zoomOut();
|
|
return;
|
|
}
|
|
|
|
while (element && !this._shouldZoomToElement(element))
|
|
element = element.parentNode;
|
|
|
|
if (!element) {
|
|
this._zoomOut();
|
|
} else {
|
|
const margin = 15;
|
|
let rect = ElementTouchHelper.getBoundingContentRect(element);
|
|
|
|
let cssPageRect = this._cssPageRect;
|
|
let viewport = this._viewport;
|
|
let bRect = new Rect(Math.max(cssPageRect.x, rect.x - margin),
|
|
rect.y,
|
|
rect.w + 2 * margin,
|
|
rect.h);
|
|
// constrict the rect to the screen's right edge
|
|
bRect.width = Math.min(bRect.width, cssPageRect.right - bRect.x);
|
|
|
|
// if the rect is already taking up most of the visible area and is stretching the
|
|
// width of the page, then we want to zoom out instead.
|
|
if (this._isRectZoomedIn(bRect, this._cssCompositedRect)) {
|
|
this._zoomOut();
|
|
return;
|
|
}
|
|
|
|
rect.x = Math.round(bRect.x);
|
|
rect.y = Math.round(bRect.y);
|
|
rect.w = Math.round(bRect.width);
|
|
rect.h = Math.round(bRect.height);
|
|
|
|
// if the block we're zooming to is really tall, and the user double-tapped
|
|
// more than a screenful of height from the top of it, then adjust the y-coordinate
|
|
// so that we center the actual point the user double-tapped upon. this prevents
|
|
// flying to the top of a page when double-tapping to zoom in (bug 761721).
|
|
// the 1.2 multiplier is just a little fuzz to compensate for bRect including horizontal
|
|
// margins but not vertical ones.
|
|
let cssTapY = viewport.y + data.y;
|
|
if ((bRect.height > rect.h) && (cssTapY > rect.y + (rect.h * 1.2))) {
|
|
rect.y = cssTapY - (rect.h / 2);
|
|
}
|
|
|
|
Services.obs.notifyObservers(docShell, 'browser-zoom-to-rect', JSON.stringify(rect));
|
|
}
|
|
},
|
|
|
|
_handleVisibilityChange: function(evt) {
|
|
if (!evt.target.hidden)
|
|
return;
|
|
|
|
this._resetHover();
|
|
},
|
|
|
|
_shouldZoomToElement: function(aElement) {
|
|
let win = aElement.ownerDocument.defaultView;
|
|
if (win.getComputedStyle(aElement, null).display == "inline")
|
|
return false;
|
|
if (aElement instanceof Ci.nsIDOMHTMLLIElement)
|
|
return false;
|
|
if (aElement instanceof Ci.nsIDOMHTMLQuoteElement)
|
|
return false;
|
|
return true;
|
|
},
|
|
|
|
_zoomOut: function() {
|
|
let rect = new Rect(0, 0, 0, 0);
|
|
Services.obs.notifyObservers(docShell, 'browser-zoom-to-rect', JSON.stringify(rect));
|
|
},
|
|
|
|
_isRectZoomedIn: function(aRect, aViewport) {
|
|
// This function checks to see if the area of the rect visible in the
|
|
// viewport (i.e. the "overlapArea" variable below) is approximately
|
|
// the max area of the rect we can show.
|
|
let vRect = new Rect(aViewport.x, aViewport.y, aViewport.width, aViewport.height);
|
|
let overlap = vRect.intersect(aRect);
|
|
let overlapArea = overlap.width * overlap.height;
|
|
let availHeight = Math.min(aRect.width * vRect.height / vRect.width, aRect.height);
|
|
let showing = overlapArea / (aRect.width * availHeight);
|
|
let ratioW = (aRect.width / vRect.width);
|
|
let ratioH = (aRect.height / vRect.height);
|
|
|
|
return (showing > 0.9 && (ratioW > 0.9 || ratioH > 0.9));
|
|
},
|
|
|
|
_unloadHandler: function() {
|
|
kObservedEvents.forEach((topic) => {
|
|
Services.obs.removeObserver(this, topic);
|
|
});
|
|
}
|
|
};
|
|
|
|
const ElementTouchHelper = {
|
|
anyElementFromPoint: function(aWindow, aX, aY) {
|
|
let cwu = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
|
let elem = cwu.elementFromPoint(aX, aY, true, true);
|
|
|
|
let HTMLIFrameElement = Ci.nsIDOMHTMLIFrameElement;
|
|
let HTMLFrameElement = Ci.nsIDOMHTMLFrameElement;
|
|
while (elem && (elem instanceof HTMLIFrameElement || elem instanceof HTMLFrameElement)) {
|
|
let rect = elem.getBoundingClientRect();
|
|
aX -= rect.left;
|
|
aY -= rect.top;
|
|
cwu = elem.contentDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
|
elem = cwu.elementFromPoint(aX, aY, true, true);
|
|
}
|
|
|
|
return elem;
|
|
},
|
|
|
|
getBoundingContentRect: function(aElement) {
|
|
if (!aElement)
|
|
return {x: 0, y: 0, w: 0, h: 0};
|
|
|
|
let document = aElement.ownerDocument;
|
|
while (document.defaultView.frameElement)
|
|
document = document.defaultView.frameElement.ownerDocument;
|
|
|
|
let cwu = document.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
|
let scrollX = {}, scrollY = {};
|
|
cwu.getScrollXY(false, scrollX, scrollY);
|
|
|
|
let r = aElement.getBoundingClientRect();
|
|
|
|
// step out of iframes and frames, offsetting scroll values
|
|
for (let frame = aElement.ownerDocument.defaultView; frame.frameElement && frame != content; frame = frame.parent) {
|
|
// adjust client coordinates' origin to be top left of iframe viewport
|
|
let rect = frame.frameElement.getBoundingClientRect();
|
|
let left = frame.getComputedStyle(frame.frameElement, "").borderLeftWidth;
|
|
let top = frame.getComputedStyle(frame.frameElement, "").borderTopWidth;
|
|
scrollX.value += rect.left + parseInt(left);
|
|
scrollY.value += rect.top + parseInt(top);
|
|
}
|
|
|
|
return {x: r.left + scrollX.value,
|
|
y: r.top + scrollY.value,
|
|
w: r.width,
|
|
h: r.height };
|
|
}
|
|
};
|