зеркало из https://github.com/mozilla/pjs.git
Merge mozilla-central to mozilla-inbound
This commit is contained in:
Коммит
df7e8d0963
|
@ -263,6 +263,9 @@
|
|||
#ifdef XP_MACOSX
|
||||
@BINPATH@/components/widget_cocoa.xpt
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
@BINPATH@/components/widget_android.xpt
|
||||
#endif
|
||||
@BINPATH@/components/windowds.xpt
|
||||
@BINPATH@/components/windowwatcher.xpt
|
||||
@BINPATH@/components/xpcom_base.xpt
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
|
||||
|
||||
<application android:label="@MOZ_APP_DISPLAYNAME@"
|
||||
android:icon="@drawable/icon"
|
||||
android:icon="@drawable/icon"
|
||||
#if MOZILLA_OFFICIAL
|
||||
android:debuggable="false">
|
||||
android:debuggable="false">
|
||||
#else
|
||||
android:debuggable="true">
|
||||
android:debuggable="true">
|
||||
#endif
|
||||
|
||||
<activity android:name="App"
|
||||
|
@ -113,7 +113,7 @@
|
|||
<intent-filter>
|
||||
<action android:name="org.mozilla.gecko.reportCrash" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</activity>
|
||||
#endif
|
||||
|
||||
<activity android:name="LauncherShortcuts"
|
||||
|
@ -125,5 +125,13 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="org.mozilla.gecko.VideoPlayer"
|
||||
android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation"
|
||||
android:theme="@android:style/Theme.NoTitleBar" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -73,6 +73,9 @@ import android.net.NetworkInfo;
|
|||
import android.graphics.drawable.*;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class GeckoAppShell
|
||||
{
|
||||
private static final String LOG_FILE_NAME = "GeckoAppShell";
|
||||
|
@ -808,6 +811,18 @@ public class GeckoAppShell
|
|||
intent.setDataAndType(Uri.parse(aUriSpec), aMimeType);
|
||||
} else {
|
||||
Uri uri = Uri.parse(aUriSpec);
|
||||
if ("vnd.youtube".equals(uri.getScheme())) {
|
||||
// Special case youtube to fallback to our own player
|
||||
String[] handlers = getHandlersForURL(aUriSpec, aAction);
|
||||
if (handlers.length == 0) {
|
||||
intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.setClassName(GeckoApp.mAppContext.getPackageName(),
|
||||
"org.mozilla.gecko.VideoPlayer");
|
||||
intent.setData(uri);
|
||||
GeckoApp.mAppContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ("sms".equals(uri.getScheme())) {
|
||||
// Have a apecial handling for the SMS, as the message body
|
||||
// is not extracted from the URI automatically
|
||||
|
@ -1629,10 +1644,6 @@ public class GeckoAppShell
|
|||
}
|
||||
}
|
||||
|
||||
// unused
|
||||
public static String handleGeckoMessage(String message) {
|
||||
return "";
|
||||
}
|
||||
// unused
|
||||
static void checkUriVisited(String uri) {}
|
||||
// unused
|
||||
|
@ -1645,6 +1656,27 @@ public class GeckoAppShell
|
|||
GeckoBatteryManager.enableNotifications();
|
||||
}
|
||||
|
||||
public static String handleGeckoMessage(String message) {
|
||||
//
|
||||
// {"gecko": {
|
||||
// "type": "value",
|
||||
// "event_specific": "value",
|
||||
// ....
|
||||
try {
|
||||
JSONObject json = new JSONObject(message);
|
||||
final JSONObject geckoObject = json.getJSONObject("gecko");
|
||||
String type = geckoObject.getString("type");
|
||||
|
||||
if (type.equals("Gecko:Ready")) {
|
||||
onAppShellReady();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.i(LOG_FILE_NAME, "handleGeckoMessage throws " + e);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void disableBatteryNotifications() {
|
||||
GeckoBatteryManager.disableNotifications();
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ JAVAFILES = \
|
|||
SurfaceInfo.java \
|
||||
GeckoBatteryManager.java \
|
||||
GeckoSmsManager.java \
|
||||
VideoPlayer.java \
|
||||
$(NULL)
|
||||
|
||||
PROCESSEDJAVAFILES = \
|
||||
|
@ -127,6 +128,7 @@ RES_LAYOUT = \
|
|||
res/layout/notification_icon_text.xml \
|
||||
res/layout/launch_app_list.xml \
|
||||
res/layout/launch_app_listitem.xml \
|
||||
res/layout/videoplayer.xml \
|
||||
$(NULL)
|
||||
|
||||
RES_VALUES = res/values/colors.xml res/values/themes.xml
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Android code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brad Lassey <blassey@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import android.util.*;
|
||||
import android.widget.*;
|
||||
import android.net.*;
|
||||
import android.content.Intent;
|
||||
|
||||
public class VideoPlayer extends Activity
|
||||
{
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.videoplayer);
|
||||
mVideoView = (VideoView) findViewById(R.id.VideoView);
|
||||
MediaController mediaController = new MediaController(this);
|
||||
mediaController.setAnchorView(mVideoView);
|
||||
Intent intent = getIntent();
|
||||
Uri data = intent.getData();
|
||||
String spec = null;
|
||||
if ("vnd.youtube".equals(data.getScheme())) {
|
||||
String ssp = data.getSchemeSpecificPart();
|
||||
String id = ssp.substring(0, ssp.indexOf('?'));
|
||||
spec = getSpecFromYouTubeVideoID(id);
|
||||
}
|
||||
if (spec == null)
|
||||
return;
|
||||
Uri video = Uri.parse(spec);
|
||||
mVideoView.setMediaController(mediaController);
|
||||
mVideoView.setVideoURI(video);
|
||||
mVideoView.start();
|
||||
}
|
||||
|
||||
VideoView mVideoView;
|
||||
|
||||
String getSpecFromYouTubeVideoID(String id) {
|
||||
String spec = null;
|
||||
try {
|
||||
String info_uri = "http://www.youtube.com/get_video_info?&video_id=" + id;
|
||||
URL info_url = new URL(info_uri);
|
||||
URLConnection urlConnection = info_url.openConnection();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null)
|
||||
sb.append(line);
|
||||
android.net.Uri fakeUri = android.net.Uri.parse("fake:/fake?" + sb);
|
||||
String stream_map = fakeUri.getQueryParameter("url_encoded_fmt_stream_map");
|
||||
if (stream_map == null)
|
||||
return null;
|
||||
String[] streams = stream_map.split(",");
|
||||
for (int i = 0; i < streams.length; i++) {
|
||||
fakeUri = android.net.Uri.parse("fake:/fake?" + streams[i]);
|
||||
String url = fakeUri.getQueryParameter("url");
|
||||
String type = fakeUri.getQueryParameter("type");
|
||||
if (type != null && url != null &&
|
||||
(type.startsWith("video/mp4") || type.startsWith("video/webm"))) {
|
||||
spec = url;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
br.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("VideoPlayer", "exception", e);
|
||||
}
|
||||
return spec;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<VideoView
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/VideoView" />
|
||||
</LinearLayout>
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Tiny ugly fonts</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
margin: 50px;
|
||||
}
|
||||
|
||||
p, div {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#test {
|
||||
font-size: 1px;
|
||||
}
|
||||
|
||||
#test p {
|
||||
font-size: 8.3%;
|
||||
}
|
||||
|
||||
#f1 { font-family: Terminal; }
|
||||
#f2 { font-family: FixedSys; }
|
||||
#f3 { font-family: Script; }
|
||||
#f4 { font-family: Roman; }
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h4>No text should show below this line</h4>
|
||||
<div id="test">
|
||||
<p id="f1">ugly font</p>
|
||||
<p id="f2">ugly font</p>
|
||||
<p id="f3">ugly font</p>
|
||||
<p id="f4">ugly font</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -85,3 +85,5 @@ load 595727-1.html
|
|||
load 633453-1.html
|
||||
load 633322-1.html
|
||||
load 686190-1.html
|
||||
load 693143-1.html
|
||||
|
||||
|
|
|
@ -1832,7 +1832,7 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont)
|
|||
{
|
||||
// Even if this font size is zero, this font is created with non-zero size.
|
||||
// However, for layout and others, we should return the metrics of zero size font.
|
||||
if (mStyle.size == 0) {
|
||||
if (mStyle.size == 0.0) {
|
||||
memset(aMetrics, 0, sizeof(gfxFont::Metrics));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -327,6 +327,7 @@ gfxGDIFont::Initialize()
|
|||
}
|
||||
}
|
||||
|
||||
// this may end up being zero
|
||||
mAdjustedSize = ROUND(mAdjustedSize);
|
||||
FillLogFont(logFont, mAdjustedSize);
|
||||
mFont = ::CreateFontIndirectW(&logFont);
|
||||
|
@ -338,102 +339,105 @@ gfxGDIFont::Initialize()
|
|||
SetGraphicsMode(dc.GetDC(), GM_ADVANCED);
|
||||
AutoSelectFont selectFont(dc.GetDC(), mFont);
|
||||
|
||||
// Get font metrics
|
||||
OUTLINETEXTMETRIC oMetrics;
|
||||
TEXTMETRIC& metrics = oMetrics.otmTextMetrics;
|
||||
// Get font metrics if size > 0
|
||||
if (mAdjustedSize > 0.0) {
|
||||
|
||||
if (0 < GetOutlineTextMetrics(dc.GetDC(), sizeof(oMetrics), &oMetrics)) {
|
||||
mMetrics->superscriptOffset = (double)oMetrics.otmptSuperscriptOffset.y;
|
||||
// Some fonts have wrong sign on their subscript offset, bug 410917.
|
||||
mMetrics->subscriptOffset = fabs((double)oMetrics.otmptSubscriptOffset.y);
|
||||
mMetrics->strikeoutSize = (double)oMetrics.otmsStrikeoutSize;
|
||||
mMetrics->strikeoutOffset = (double)oMetrics.otmsStrikeoutPosition;
|
||||
mMetrics->underlineSize = (double)oMetrics.otmsUnderscoreSize;
|
||||
mMetrics->underlineOffset = (double)oMetrics.otmsUnderscorePosition;
|
||||
OUTLINETEXTMETRIC oMetrics;
|
||||
TEXTMETRIC& metrics = oMetrics.otmTextMetrics;
|
||||
|
||||
const MAT2 kIdentityMatrix = { {0, 1}, {0, 0}, {0, 0}, {0, 1} };
|
||||
GLYPHMETRICS gm;
|
||||
DWORD len = GetGlyphOutlineW(dc.GetDC(), PRUnichar('x'), GGO_METRICS, &gm, 0, nsnull, &kIdentityMatrix);
|
||||
if (len == GDI_ERROR || gm.gmptGlyphOrigin.y <= 0) {
|
||||
// 56% of ascent, best guess for true type
|
||||
mMetrics->xHeight =
|
||||
ROUND((double)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR);
|
||||
if (0 < GetOutlineTextMetrics(dc.GetDC(), sizeof(oMetrics), &oMetrics)) {
|
||||
mMetrics->superscriptOffset = (double)oMetrics.otmptSuperscriptOffset.y;
|
||||
// Some fonts have wrong sign on their subscript offset, bug 410917.
|
||||
mMetrics->subscriptOffset = fabs((double)oMetrics.otmptSubscriptOffset.y);
|
||||
mMetrics->strikeoutSize = (double)oMetrics.otmsStrikeoutSize;
|
||||
mMetrics->strikeoutOffset = (double)oMetrics.otmsStrikeoutPosition;
|
||||
mMetrics->underlineSize = (double)oMetrics.otmsUnderscoreSize;
|
||||
mMetrics->underlineOffset = (double)oMetrics.otmsUnderscorePosition;
|
||||
|
||||
const MAT2 kIdentityMatrix = { {0, 1}, {0, 0}, {0, 0}, {0, 1} };
|
||||
GLYPHMETRICS gm;
|
||||
DWORD len = GetGlyphOutlineW(dc.GetDC(), PRUnichar('x'), GGO_METRICS, &gm, 0, nsnull, &kIdentityMatrix);
|
||||
if (len == GDI_ERROR || gm.gmptGlyphOrigin.y <= 0) {
|
||||
// 56% of ascent, best guess for true type
|
||||
mMetrics->xHeight =
|
||||
ROUND((double)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR);
|
||||
} else {
|
||||
mMetrics->xHeight = gm.gmptGlyphOrigin.y;
|
||||
}
|
||||
mMetrics->emHeight = metrics.tmHeight - metrics.tmInternalLeading;
|
||||
gfxFloat typEmHeight = (double)oMetrics.otmAscent - (double)oMetrics.otmDescent;
|
||||
mMetrics->emAscent = ROUND(mMetrics->emHeight * (double)oMetrics.otmAscent / typEmHeight);
|
||||
mMetrics->emDescent = mMetrics->emHeight - mMetrics->emAscent;
|
||||
if (oMetrics.otmEMSquare > 0) {
|
||||
mFUnitsConvFactor = float(mAdjustedSize / oMetrics.otmEMSquare);
|
||||
}
|
||||
} else {
|
||||
mMetrics->xHeight = gm.gmptGlyphOrigin.y;
|
||||
}
|
||||
mMetrics->emHeight = metrics.tmHeight - metrics.tmInternalLeading;
|
||||
gfxFloat typEmHeight = (double)oMetrics.otmAscent - (double)oMetrics.otmDescent;
|
||||
mMetrics->emAscent = ROUND(mMetrics->emHeight * (double)oMetrics.otmAscent / typEmHeight);
|
||||
mMetrics->emDescent = mMetrics->emHeight - mMetrics->emAscent;
|
||||
if (oMetrics.otmEMSquare > 0) {
|
||||
mFUnitsConvFactor = float(mAdjustedSize / oMetrics.otmEMSquare);
|
||||
}
|
||||
} else {
|
||||
// Make a best-effort guess at extended metrics
|
||||
// this is based on general typographic guidelines
|
||||
|
||||
// GetTextMetrics can fail if the font file has been removed
|
||||
// or corrupted recently.
|
||||
BOOL result = GetTextMetrics(dc.GetDC(), &metrics);
|
||||
if (!result) {
|
||||
NS_WARNING("Missing or corrupt font data, fasten your seatbelt");
|
||||
mIsValid = false;
|
||||
memset(mMetrics, 0, sizeof(*mMetrics));
|
||||
return;
|
||||
// Make a best-effort guess at extended metrics
|
||||
// this is based on general typographic guidelines
|
||||
|
||||
// GetTextMetrics can fail if the font file has been removed
|
||||
// or corrupted recently.
|
||||
BOOL result = GetTextMetrics(dc.GetDC(), &metrics);
|
||||
if (!result) {
|
||||
NS_WARNING("Missing or corrupt font data, fasten your seatbelt");
|
||||
mIsValid = false;
|
||||
memset(mMetrics, 0, sizeof(*mMetrics));
|
||||
return;
|
||||
}
|
||||
|
||||
mMetrics->xHeight =
|
||||
ROUND((float)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR);
|
||||
mMetrics->superscriptOffset = mMetrics->xHeight;
|
||||
mMetrics->subscriptOffset = mMetrics->xHeight;
|
||||
mMetrics->strikeoutSize = 1;
|
||||
mMetrics->strikeoutOffset = ROUND(mMetrics->xHeight * 0.5f); // 50% of xHeight
|
||||
mMetrics->underlineSize = 1;
|
||||
mMetrics->underlineOffset = -ROUND((float)metrics.tmDescent * 0.30f); // 30% of descent
|
||||
mMetrics->emHeight = metrics.tmHeight - metrics.tmInternalLeading;
|
||||
mMetrics->emAscent = metrics.tmAscent - metrics.tmInternalLeading;
|
||||
mMetrics->emDescent = metrics.tmDescent;
|
||||
}
|
||||
|
||||
mMetrics->xHeight =
|
||||
ROUND((float)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR);
|
||||
mMetrics->superscriptOffset = mMetrics->xHeight;
|
||||
mMetrics->subscriptOffset = mMetrics->xHeight;
|
||||
mMetrics->strikeoutSize = 1;
|
||||
mMetrics->strikeoutOffset = ROUND(mMetrics->xHeight * 0.5f); // 50% of xHeight
|
||||
mMetrics->underlineSize = 1;
|
||||
mMetrics->underlineOffset = -ROUND((float)metrics.tmDescent * 0.30f); // 30% of descent
|
||||
mMetrics->emHeight = metrics.tmHeight - metrics.tmInternalLeading;
|
||||
mMetrics->emAscent = metrics.tmAscent - metrics.tmInternalLeading;
|
||||
mMetrics->emDescent = metrics.tmDescent;
|
||||
}
|
||||
|
||||
mMetrics->internalLeading = metrics.tmInternalLeading;
|
||||
mMetrics->externalLeading = metrics.tmExternalLeading;
|
||||
mMetrics->maxHeight = metrics.tmHeight;
|
||||
mMetrics->maxAscent = metrics.tmAscent;
|
||||
mMetrics->maxDescent = metrics.tmDescent;
|
||||
mMetrics->maxAdvance = metrics.tmMaxCharWidth;
|
||||
mMetrics->aveCharWidth = NS_MAX<gfxFloat>(1, metrics.tmAveCharWidth);
|
||||
// The font is monospace when TMPF_FIXED_PITCH is *not* set!
|
||||
// See http://msdn2.microsoft.com/en-us/library/ms534202(VS.85).aspx
|
||||
if (!(metrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) {
|
||||
mMetrics->maxAdvance = mMetrics->aveCharWidth;
|
||||
}
|
||||
|
||||
// Cache the width of a single space.
|
||||
SIZE size;
|
||||
GetTextExtentPoint32W(dc.GetDC(), L" ", 1, &size);
|
||||
mMetrics->spaceWidth = ROUND(size.cx);
|
||||
|
||||
// Cache the width of digit zero.
|
||||
// XXX MSDN (http://msdn.microsoft.com/en-us/library/ms534223.aspx)
|
||||
// does not say what the failure modes for GetTextExtentPoint32 are -
|
||||
// is it safe to assume it will fail iff the font has no '0'?
|
||||
if (GetTextExtentPoint32W(dc.GetDC(), L"0", 1, &size)) {
|
||||
mMetrics->zeroOrAveCharWidth = ROUND(size.cx);
|
||||
} else {
|
||||
mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
|
||||
}
|
||||
|
||||
mSpaceGlyph = 0;
|
||||
if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) {
|
||||
WORD glyph;
|
||||
DWORD ret = GetGlyphIndicesW(dc.GetDC(), L" ", 1, &glyph,
|
||||
GGI_MARK_NONEXISTING_GLYPHS);
|
||||
if (ret != GDI_ERROR && glyph != 0xFFFF) {
|
||||
mSpaceGlyph = glyph;
|
||||
mMetrics->internalLeading = metrics.tmInternalLeading;
|
||||
mMetrics->externalLeading = metrics.tmExternalLeading;
|
||||
mMetrics->maxHeight = metrics.tmHeight;
|
||||
mMetrics->maxAscent = metrics.tmAscent;
|
||||
mMetrics->maxDescent = metrics.tmDescent;
|
||||
mMetrics->maxAdvance = metrics.tmMaxCharWidth;
|
||||
mMetrics->aveCharWidth = NS_MAX<gfxFloat>(1, metrics.tmAveCharWidth);
|
||||
// The font is monospace when TMPF_FIXED_PITCH is *not* set!
|
||||
// See http://msdn2.microsoft.com/en-us/library/ms534202(VS.85).aspx
|
||||
if (!(metrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) {
|
||||
mMetrics->maxAdvance = mMetrics->aveCharWidth;
|
||||
}
|
||||
}
|
||||
|
||||
SanitizeMetrics(mMetrics, GetFontEntry()->mIsBadUnderlineFont);
|
||||
// Cache the width of a single space.
|
||||
SIZE size;
|
||||
GetTextExtentPoint32W(dc.GetDC(), L" ", 1, &size);
|
||||
mMetrics->spaceWidth = ROUND(size.cx);
|
||||
|
||||
// Cache the width of digit zero.
|
||||
// XXX MSDN (http://msdn.microsoft.com/en-us/library/ms534223.aspx)
|
||||
// does not say what the failure modes for GetTextExtentPoint32 are -
|
||||
// is it safe to assume it will fail iff the font has no '0'?
|
||||
if (GetTextExtentPoint32W(dc.GetDC(), L"0", 1, &size)) {
|
||||
mMetrics->zeroOrAveCharWidth = ROUND(size.cx);
|
||||
} else {
|
||||
mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
|
||||
}
|
||||
|
||||
mSpaceGlyph = 0;
|
||||
if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) {
|
||||
WORD glyph;
|
||||
DWORD ret = GetGlyphIndicesW(dc.GetDC(), L" ", 1, &glyph,
|
||||
GGI_MARK_NONEXISTING_GLYPHS);
|
||||
if (ret != GDI_ERROR && glyph != 0xFFFF) {
|
||||
mSpaceGlyph = glyph;
|
||||
}
|
||||
}
|
||||
|
||||
SanitizeMetrics(mMetrics, GetFontEntry()->mIsBadUnderlineFont);
|
||||
}
|
||||
|
||||
mFontFace = cairo_win32_font_face_create_for_logfontw_hfont(&logFont,
|
||||
mFont);
|
||||
|
@ -460,20 +464,21 @@ gfxGDIFont::Initialize()
|
|||
mScaledFont ? cairo_scaled_font_status(mScaledFont) : 0);
|
||||
NS_WARNING(warnBuf);
|
||||
#endif
|
||||
mIsValid = false;
|
||||
} else {
|
||||
mIsValid = true;
|
||||
}
|
||||
|
||||
mIsValid = true;
|
||||
|
||||
#if 0
|
||||
printf("Font: %p (%s) size: %f\n", this,
|
||||
NS_ConvertUTF16toUTF8(GetName()).get(), mStyle.size);
|
||||
printf(" emHeight: %f emAscent: %f emDescent: %f\n", mMetrics.emHeight, mMetrics.emAscent, mMetrics.emDescent);
|
||||
printf(" maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics.maxAscent, mMetrics.maxDescent, mMetrics.maxAdvance);
|
||||
printf(" internalLeading: %f externalLeading: %f\n", mMetrics.internalLeading, mMetrics.externalLeading);
|
||||
printf(" spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics.spaceWidth, mMetrics.aveCharWidth, mMetrics.xHeight);
|
||||
printf("Font: %p (%s) size: %f adjusted size: %f valid: %s\n", this,
|
||||
NS_ConvertUTF16toUTF8(GetName()).get(), mStyle.size, mAdjustedSize, (mIsValid ? "yes" : "no"));
|
||||
printf(" emHeight: %f emAscent: %f emDescent: %f\n", mMetrics->emHeight, mMetrics->emAscent, mMetrics->emDescent);
|
||||
printf(" maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics->maxAscent, mMetrics->maxDescent, mMetrics->maxAdvance);
|
||||
printf(" internalLeading: %f externalLeading: %f\n", mMetrics->internalLeading, mMetrics->externalLeading);
|
||||
printf(" spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics->spaceWidth, mMetrics->aveCharWidth, mMetrics->xHeight);
|
||||
printf(" uOff: %f uSize: %f stOff: %f stSize: %f supOff: %f subOff: %f\n",
|
||||
mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize,
|
||||
mMetrics.superscriptOffset, mMetrics.subscriptOffset);
|
||||
mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize,
|
||||
mMetrics->superscriptOffset, mMetrics->subscriptOffset);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,16 @@ let Ci = Components.interfaces;
|
|||
let Cu = Components.utils;
|
||||
let Cr = Components.results;
|
||||
|
||||
|
||||
function getBridge() {
|
||||
return Cc["@mozilla.org/android/bridge;1"].getService(Ci.nsIAndroidBridge);
|
||||
}
|
||||
|
||||
function sendMessageToJava(aMessage) {
|
||||
return getBridge().handleGeckoMessage(JSON.stringify(aMessage));
|
||||
}
|
||||
|
||||
|
||||
function getBrowser() {
|
||||
return Browser.selectedBrowser;
|
||||
}
|
||||
|
@ -166,6 +176,12 @@ var Browser = {
|
|||
|
||||
startup: function startup() {
|
||||
var self = this;
|
||||
|
||||
sendMessageToJava({
|
||||
gecko: {
|
||||
type: "Gecko:Ready"
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
messageManager.loadFrameScript("chrome://browser/content/Util.js", true);
|
||||
|
|
|
@ -267,6 +267,9 @@
|
|||
#ifdef XP_MACOSX
|
||||
@BINPATH@/components/widget_cocoa.xpt
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
@BINPATH@/components/widget_android.xpt
|
||||
#endif
|
||||
@BINPATH@/components/windowds.xpt
|
||||
@BINPATH@/components/windowwatcher.xpt
|
||||
@BINPATH@/components/xpcom_base.xpt
|
||||
|
|
|
@ -63,7 +63,7 @@ nsFastStartup::symbolsLoadingFinished(bool preloaded)
|
|||
{
|
||||
mSymbolsLoaded = preloaded;
|
||||
if (mWidgetPainted && mSymbolsLoaded) {
|
||||
qApp->quit();
|
||||
mLoop.quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ void nsFastStartup::painted()
|
|||
{
|
||||
mWidgetPainted = true;
|
||||
if (mWidgetPainted && mSymbolsLoaded) {
|
||||
qApp->quit();
|
||||
mLoop.quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ nsFastStartup::CreateFastStartup(int& argc, char ** argv,
|
|||
// Start native loop in order to get view opened and painted once
|
||||
// Will block CreateFastStartup function and
|
||||
// exit when symbols are loaded and Static UI shown
|
||||
qApp->exec();
|
||||
mLoop.exec();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <QObject>
|
||||
#include "nscore.h"
|
||||
#include <QThread>
|
||||
#include <QEventLoop>
|
||||
#include <sys/time.h>
|
||||
|
||||
class QGraphicsView;
|
||||
|
@ -106,6 +107,7 @@ private:
|
|||
bool mSymbolsLoaded;
|
||||
bool mWidgetPainted;
|
||||
GeckoThread* mThread;
|
||||
QEventLoop mLoop;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче