mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge fx-team to mozilla-central
This commit is contained in:
commit
94733cdce0
@ -975,7 +975,8 @@
|
||||
<sidebarheader id="social-sidebar-header" class="sidebar-header" align="center">
|
||||
<image id="social-sidebar-favico"/>
|
||||
<label id="social-sidebar-title" class="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
|
||||
<button id="social-sidebar-button"
|
||||
<toolbarbutton id="social-sidebar-button"
|
||||
class="toolbarbutton-1"
|
||||
type="menu">
|
||||
<menupopup id="social-statusarea-popup" position="after_end">
|
||||
<menuitem class="social-toggle-sidebar-menuitem"
|
||||
@ -999,7 +1000,7 @@
|
||||
accesskey="&social.learnMore.accesskey;"
|
||||
oncommand="SocialUI.showLearnMore();"/>
|
||||
</menupopup>
|
||||
</button>
|
||||
</toolbarbutton>
|
||||
</sidebarheader>
|
||||
|
||||
<browser id="social-sidebar-browser"
|
||||
@ -1007,7 +1008,7 @@
|
||||
context="contentAreaContextMenu"
|
||||
disableglobalhistory="true"
|
||||
tooltip="aHTMLTooltip"
|
||||
popupnotificationanchor="social-notification-icon"
|
||||
popupnotificationanchor="social-sidebar-favico"
|
||||
flex="1"
|
||||
style="min-width: 14em; width: 18em; max-width: 36em;"/>
|
||||
</vbox>
|
||||
|
@ -2792,7 +2792,15 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
|
||||
let line = lineResultsItem.instance.line;
|
||||
|
||||
DebuggerView.setEditorLocation(url, line + 1, { noDebug: true });
|
||||
DebuggerView.editor.extendSelection(lineResultsItem.lineData.range);
|
||||
|
||||
let range = lineResultsItem.lineData.range;
|
||||
let cursor = DebuggerView.editor.getOffset({ line: line, ch: 0 });
|
||||
let [ anchor, head ] = DebuggerView.editor.getPosition(
|
||||
cursor + range.start,
|
||||
cursor + range.start + range.length
|
||||
);
|
||||
|
||||
DebuggerView.editor.setSelection(anchor, head);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -73,3 +73,11 @@ selector in floating-scrollbar-light.css across all platforms. */
|
||||
.CodeMirror-dialog input {
|
||||
font: message-box;
|
||||
}
|
||||
|
||||
.CodeMirror-code > div > div:first-child {
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.CodeMirror-gutter-elt {
|
||||
transform: translate(0,-50%);
|
||||
}
|
@ -73,6 +73,7 @@ const CM_MAPPING = [
|
||||
"setSelection",
|
||||
"getSelection",
|
||||
"replaceSelection",
|
||||
"extendSelection",
|
||||
"undo",
|
||||
"redo",
|
||||
"clearHistory",
|
||||
@ -366,18 +367,6 @@ Editor.prototype = {
|
||||
this.setCursor(this.getCursor());
|
||||
},
|
||||
|
||||
/**
|
||||
* Extends the current selection to the position specified
|
||||
* by the provided {line, ch} object.
|
||||
*/
|
||||
extendSelection: function (pos) {
|
||||
let cm = editors.get(this);
|
||||
let cursor = cm.indexFromPos(cm.getCursor());
|
||||
let anchor = cm.posFromIndex(cursor + pos.start);
|
||||
let head = cm.posFromIndex(cursor + pos.start + pos.length);
|
||||
cm.setSelection(anchor, head);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the first visible line number in the editor.
|
||||
*/
|
||||
|
@ -25,9 +25,6 @@ function test() {
|
||||
ed.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 5 });
|
||||
is(ed.getSelection(), "Hello", "setSelection");
|
||||
|
||||
ed.extendSelection({ start: 0, length: 5 });
|
||||
is(ed.getSelection(), ".\nHow", "extendSelection");
|
||||
|
||||
ed.dropSelection();
|
||||
is(ed.getSelection(), "", "dropSelection");
|
||||
|
||||
|
@ -11,10 +11,14 @@
|
||||
#social-sidebar-button {
|
||||
-moz-appearance: none;
|
||||
list-style-image: url(chrome://browser/skin/social/gear_default.png);
|
||||
min-width: 16px;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 2px;
|
||||
}
|
||||
#social-sidebar-button > .toolbarbutton-icon {
|
||||
min-height: 16px;
|
||||
min-width: 16px;
|
||||
}
|
||||
#social-sidebar-button:hover,
|
||||
#social-sidebar-button:hover:active {
|
||||
list-style-image: url(chrome://browser/skin/social/gear_clicked.png);
|
||||
|
@ -19,6 +19,7 @@ import org.mozilla.gecko.mozglue.RobocopTarget;
|
||||
import org.mozilla.gecko.util.EventDispatcher;
|
||||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
import org.mozilla.gecko.util.ProxySelector;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
@ -97,7 +98,6 @@ import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.net.Proxy;
|
||||
import java.net.ProxySelector;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -2663,78 +2663,11 @@ public class GeckoAppShell
|
||||
return false;
|
||||
}
|
||||
|
||||
// Holds mappings from hostnames to URIs.
|
||||
// We only use this for HTTP and HTTPS on default ports (-1), because it's
|
||||
// simpler to do so while addressing most uses.
|
||||
private static LruCache<String, URI> httpURIs = new LruCache<String, URI>(10);
|
||||
private static LruCache<String, URI> httpsURIs = new LruCache<String, URI>(10);
|
||||
|
||||
private static URI getAndCacheURIByParts(String scheme, String host, LruCache<String, URI> cache) {
|
||||
URI uri = cache.get(host);
|
||||
if (uri != null) {
|
||||
return uri;
|
||||
}
|
||||
|
||||
try {
|
||||
uri = new URI(scheme, null, host, -1, null, null, null);
|
||||
} catch (java.net.URISyntaxException uriEx) {
|
||||
Log.d("GeckoProxy", "Failed to create URI from parts.", uriEx);
|
||||
return null;
|
||||
}
|
||||
|
||||
cache.put(host, uri);
|
||||
return uri;
|
||||
}
|
||||
|
||||
private static URI getURIByParts(String scheme, String host, int port) {
|
||||
if (port == -1) {
|
||||
if (scheme.equals("http")) {
|
||||
return getAndCacheURIByParts("http", host, httpURIs);
|
||||
} else if (scheme.equals("https")) {
|
||||
return getAndCacheURIByParts("https", host, httpsURIs);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return new URI(scheme, null, host, port, null, null, null);
|
||||
} catch (java.net.URISyntaxException uriEx) {
|
||||
Log.d("GeckoProxy", "Failed to create URI from parts.", uriEx);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@WrapElementForJNI(stubName = "GetProxyForURIWrapper")
|
||||
public static String getProxyForURI(String spec, String scheme, String host, int port) {
|
||||
final ProxySelector ps;
|
||||
try {
|
||||
// This is cheap -- just a SecurityManager check and a static
|
||||
// access inside ProxySelector.
|
||||
ps = ProxySelector.getDefault();
|
||||
} catch (SecurityException ex) {
|
||||
Log.w(LOGTAG, "Not allowed to use default ProxySelector.");
|
||||
return "DIRECT";
|
||||
}
|
||||
final ProxySelector ps = new ProxySelector();
|
||||
|
||||
if (ps == null) {
|
||||
return "DIRECT";
|
||||
}
|
||||
|
||||
// We don't use the whole spec because parsing a URI from a string
|
||||
// is expensive, and the stock Android proxy behavior looks only at
|
||||
// the scheme and host.
|
||||
URI uri = getURIByParts(scheme, host, port);
|
||||
|
||||
if (uri == null) {
|
||||
return "DIRECT";
|
||||
}
|
||||
|
||||
List<Proxy> proxies = ps.select(uri);
|
||||
if (proxies == null || proxies.isEmpty()) {
|
||||
return "DIRECT";
|
||||
}
|
||||
|
||||
Proxy proxy = proxies.get(0);
|
||||
Proxy proxy = ps.select(scheme, host);
|
||||
if (Proxy.NO_PROXY.equals(proxy)) {
|
||||
return "DIRECT";
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class Tab {
|
||||
public void run() {
|
||||
if (b != null) {
|
||||
try {
|
||||
mThumbnail = new BitmapDrawable(b);
|
||||
mThumbnail = new BitmapDrawable(mAppContext.getResources(), b);
|
||||
if (mState == Tab.STATE_SUCCESS)
|
||||
saveThumbnailToDB();
|
||||
} catch (OutOfMemoryError oom) {
|
||||
|
@ -47,7 +47,7 @@ public final class BitmapUtils {
|
||||
}
|
||||
|
||||
if (data.startsWith("data")) {
|
||||
BitmapDrawable d = new BitmapDrawable(getBitmapFromDataURI(data));
|
||||
BitmapDrawable d = new BitmapDrawable(context.getResources(), getBitmapFromDataURI(data));
|
||||
loader.onBitmapFound(d);
|
||||
return;
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ gujar.sources += [
|
||||
'util/INISection.java',
|
||||
'util/JSONUtils.java',
|
||||
'util/NonEvictingLruCache.java',
|
||||
'util/ProxySelector.java',
|
||||
'util/StringUtils.java',
|
||||
'util/ThreadUtils.java',
|
||||
'util/UiAsyncTask.java',
|
||||
|
@ -193,7 +193,7 @@ public class SearchEnginePreference extends Preference implements View.OnLongCli
|
||||
// Copy the icon from this object to the prompt we produce. We lazily create the drawable,
|
||||
// as the user may not ever actually tap this object.
|
||||
if (mPromptIcon == null && mIconBitmap != null) {
|
||||
mPromptIcon = new BitmapDrawable(mFaviconView.getBitmap());
|
||||
mPromptIcon = new BitmapDrawable(getContext().getResources(), mFaviconView.getBitmap());
|
||||
}
|
||||
|
||||
// Icons are hidden until Bug 926711 is fixed.
|
||||
|
@ -586,7 +586,7 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
|
||||
// We want the icon to be of a specific size. Some do not
|
||||
// follow this rule so we have to resize them.
|
||||
Bitmap bitmap = ((BitmapDrawable) item.icon).getBitmap();
|
||||
d = new BitmapDrawable(Bitmap.createScaledBitmap(bitmap, mIconSize, mIconSize, true));
|
||||
d = new BitmapDrawable(res, Bitmap.createScaledBitmap(bitmap, mIconSize, mIconSize, true));
|
||||
} else if (item.inGroup) {
|
||||
// We don't currently support "indenting" items with icons
|
||||
d = getBlankDrawable(res);
|
||||
|
@ -25,7 +25,7 @@ public final class WaitHelper {
|
||||
// assertion from waitFor)?
|
||||
private static final int DEFAULT_MAX_WAIT_MS = 5000;
|
||||
private static final int PAGE_LOAD_WAIT_MS = 10000;
|
||||
private static final int CHANGE_WAIT_MS = 5000;
|
||||
private static final int CHANGE_WAIT_MS = 10000;
|
||||
|
||||
// TODO: via lucasr - Add ThrobberVisibilityChangeVerifier?
|
||||
private static final ChangeVerifier[] PAGE_LOAD_VERIFIERS = new ChangeVerifier[] {
|
||||
|
130
mobile/android/base/util/ProxySelector.java
Normal file
130
mobile/android/base/util/ProxySelector.java
Normal file
@ -0,0 +1,130 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// This code is based on AOSP /libcore/luni/src/main/java/java/net/ProxySelectorImpl.java
|
||||
|
||||
package org.mozilla.gecko.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
|
||||
public class ProxySelector {
|
||||
public ProxySelector() {
|
||||
}
|
||||
|
||||
public Proxy select(String scheme, String host) {
|
||||
int port = -1;
|
||||
Proxy proxy = null;
|
||||
String nonProxyHostsKey = null;
|
||||
boolean httpProxyOkay = true;
|
||||
if ("http".equalsIgnoreCase(scheme)) {
|
||||
port = 80;
|
||||
nonProxyHostsKey = "http.nonProxyHosts";
|
||||
proxy = lookupProxy("http.proxyHost", "http.proxyPort", Proxy.Type.HTTP, port);
|
||||
} else if ("https".equalsIgnoreCase(scheme)) {
|
||||
port = 443;
|
||||
nonProxyHostsKey = "https.nonProxyHosts"; // RI doesn't support this
|
||||
proxy = lookupProxy("https.proxyHost", "https.proxyPort", Proxy.Type.HTTP, port);
|
||||
} else if ("ftp".equalsIgnoreCase(scheme)) {
|
||||
port = 80; // not 21 as you might guess
|
||||
nonProxyHostsKey = "ftp.nonProxyHosts";
|
||||
proxy = lookupProxy("ftp.proxyHost", "ftp.proxyPort", Proxy.Type.HTTP, port);
|
||||
} else if ("socket".equalsIgnoreCase(scheme)) {
|
||||
httpProxyOkay = false;
|
||||
} else {
|
||||
return Proxy.NO_PROXY;
|
||||
}
|
||||
|
||||
if (nonProxyHostsKey != null
|
||||
&& isNonProxyHost(host, System.getProperty(nonProxyHostsKey))) {
|
||||
return Proxy.NO_PROXY;
|
||||
}
|
||||
|
||||
if (proxy != null) {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
if (httpProxyOkay) {
|
||||
proxy = lookupProxy("proxyHost", "proxyPort", Proxy.Type.HTTP, port);
|
||||
if (proxy != null) {
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
|
||||
proxy = lookupProxy("socksProxyHost", "socksProxyPort", Proxy.Type.SOCKS, 1080);
|
||||
if (proxy != null) {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
return Proxy.NO_PROXY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the proxy identified by the {@code hostKey} system property, or
|
||||
* null.
|
||||
*/
|
||||
private Proxy lookupProxy(String hostKey, String portKey, Proxy.Type type, int defaultPort) {
|
||||
String host = System.getProperty(hostKey);
|
||||
if (host == null || host.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int port = getSystemPropertyInt(portKey, defaultPort);
|
||||
return new Proxy(type, InetSocketAddress.createUnresolved(host, port));
|
||||
}
|
||||
|
||||
private int getSystemPropertyInt(String key, int defaultValue) {
|
||||
String string = System.getProperty(key);
|
||||
if (string != null) {
|
||||
try {
|
||||
return Integer.parseInt(string);
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the {@code nonProxyHosts} system property pattern exists
|
||||
* and matches {@code host}.
|
||||
*/
|
||||
private boolean isNonProxyHost(String host, String nonProxyHosts) {
|
||||
if (host == null || nonProxyHosts == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// construct pattern
|
||||
StringBuilder patternBuilder = new StringBuilder();
|
||||
for (int i = 0; i < nonProxyHosts.length(); i++) {
|
||||
char c = nonProxyHosts.charAt(i);
|
||||
switch (c) {
|
||||
case '.':
|
||||
patternBuilder.append("\\.");
|
||||
break;
|
||||
case '*':
|
||||
patternBuilder.append(".*");
|
||||
break;
|
||||
default:
|
||||
patternBuilder.append(c);
|
||||
}
|
||||
}
|
||||
// check whether the host is the nonProxyHosts.
|
||||
String pattern = patternBuilder.toString();
|
||||
return host.matches(pattern);
|
||||
}
|
||||
}
|
||||
|
@ -541,6 +541,10 @@ var SelectionHandler = {
|
||||
// in editable targets. We should factor out the logic that's currently in _sendMouseEvents.
|
||||
let viewOffset = this._getViewOffset();
|
||||
let caretPos = this._contentWindow.document.caretPositionFromPoint(aX - viewOffset.x, aY - viewOffset.y);
|
||||
if (!caretPos) {
|
||||
// User moves handle offscreen while positioning
|
||||
return;
|
||||
}
|
||||
|
||||
// Constrain text selection within editable elements.
|
||||
let targetIsEditable = this._targetElement instanceof Ci.nsIDOMNSEditableElement;
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user