Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2011-12-07 09:39:26 +00:00
commit a2b9f740f0
14 changed files with 353 additions and 111 deletions

View File

@ -263,6 +263,9 @@
#ifdef XP_MACOSX #ifdef XP_MACOSX
@BINPATH@/components/widget_cocoa.xpt @BINPATH@/components/widget_cocoa.xpt
#endif #endif
#ifdef ANDROID
@BINPATH@/components/widget_android.xpt
#endif
@BINPATH@/components/windowds.xpt @BINPATH@/components/windowds.xpt
@BINPATH@/components/windowwatcher.xpt @BINPATH@/components/windowwatcher.xpt
@BINPATH@/components/xpcom_base.xpt @BINPATH@/components/xpcom_base.xpt

View File

@ -34,11 +34,11 @@
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<application android:label="@MOZ_APP_DISPLAYNAME@" <application android:label="@MOZ_APP_DISPLAYNAME@"
android:icon="@drawable/icon" android:icon="@drawable/icon"
#if MOZILLA_OFFICIAL #if MOZILLA_OFFICIAL
android:debuggable="false"> android:debuggable="false">
#else #else
android:debuggable="true"> android:debuggable="true">
#endif #endif
<activity android:name="App" <activity android:name="App"
@ -113,7 +113,7 @@
<intent-filter> <intent-filter>
<action android:name="org.mozilla.gecko.reportCrash" /> <action android:name="org.mozilla.gecko.reportCrash" />
</intent-filter> </intent-filter>
</activity> </activity>
#endif #endif
<activity android:name="LauncherShortcuts" <activity android:name="LauncherShortcuts"
@ -125,5 +125,13 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </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> </application>
</manifest> </manifest>

View File

@ -73,6 +73,9 @@ import android.net.NetworkInfo;
import android.graphics.drawable.*; import android.graphics.drawable.*;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import org.json.JSONArray;
import org.json.JSONObject;
public class GeckoAppShell public class GeckoAppShell
{ {
private static final String LOG_FILE_NAME = "GeckoAppShell"; private static final String LOG_FILE_NAME = "GeckoAppShell";
@ -808,6 +811,18 @@ public class GeckoAppShell
intent.setDataAndType(Uri.parse(aUriSpec), aMimeType); intent.setDataAndType(Uri.parse(aUriSpec), aMimeType);
} else { } else {
Uri uri = Uri.parse(aUriSpec); 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())) { if ("sms".equals(uri.getScheme())) {
// Have a apecial handling for the SMS, as the message body // Have a apecial handling for the SMS, as the message body
// is not extracted from the URI automatically // is not extracted from the URI automatically
@ -1629,10 +1644,6 @@ public class GeckoAppShell
} }
} }
// unused
public static String handleGeckoMessage(String message) {
return "";
}
// unused // unused
static void checkUriVisited(String uri) {} static void checkUriVisited(String uri) {}
// unused // unused
@ -1645,6 +1656,27 @@ public class GeckoAppShell
GeckoBatteryManager.enableNotifications(); 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() { public static void disableBatteryNotifications() {
GeckoBatteryManager.disableNotifications(); GeckoBatteryManager.disableNotifications();
} }

View File

@ -56,6 +56,7 @@ JAVAFILES = \
SurfaceInfo.java \ SurfaceInfo.java \
GeckoBatteryManager.java \ GeckoBatteryManager.java \
GeckoSmsManager.java \ GeckoSmsManager.java \
VideoPlayer.java \
$(NULL) $(NULL)
PROCESSEDJAVAFILES = \ PROCESSEDJAVAFILES = \
@ -127,6 +128,7 @@ RES_LAYOUT = \
res/layout/notification_icon_text.xml \ res/layout/notification_icon_text.xml \
res/layout/launch_app_list.xml \ res/layout/launch_app_list.xml \
res/layout/launch_app_listitem.xml \ res/layout/launch_app_listitem.xml \
res/layout/videoplayer.xml \
$(NULL) $(NULL)
RES_VALUES = res/values/colors.xml res/values/themes.xml RES_VALUES = res/values/colors.xml res/values/themes.xml

View File

@ -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;
}
}

View File

@ -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>

View File

@ -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>

View File

@ -85,3 +85,5 @@ load 595727-1.html
load 633453-1.html load 633453-1.html
load 633322-1.html load 633322-1.html
load 686190-1.html load 686190-1.html
load 693143-1.html

View File

@ -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. // 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. // 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)); memset(aMetrics, 0, sizeof(gfxFont::Metrics));
return; return;
} }

View File

@ -327,6 +327,7 @@ gfxGDIFont::Initialize()
} }
} }
// this may end up being zero
mAdjustedSize = ROUND(mAdjustedSize); mAdjustedSize = ROUND(mAdjustedSize);
FillLogFont(logFont, mAdjustedSize); FillLogFont(logFont, mAdjustedSize);
mFont = ::CreateFontIndirectW(&logFont); mFont = ::CreateFontIndirectW(&logFont);
@ -338,102 +339,105 @@ gfxGDIFont::Initialize()
SetGraphicsMode(dc.GetDC(), GM_ADVANCED); SetGraphicsMode(dc.GetDC(), GM_ADVANCED);
AutoSelectFont selectFont(dc.GetDC(), mFont); AutoSelectFont selectFont(dc.GetDC(), mFont);
// Get font metrics // Get font metrics if size > 0
OUTLINETEXTMETRIC oMetrics; if (mAdjustedSize > 0.0) {
TEXTMETRIC& metrics = oMetrics.otmTextMetrics;
if (0 < GetOutlineTextMetrics(dc.GetDC(), sizeof(oMetrics), &oMetrics)) { OUTLINETEXTMETRIC oMetrics;
mMetrics->superscriptOffset = (double)oMetrics.otmptSuperscriptOffset.y; TEXTMETRIC& metrics = oMetrics.otmTextMetrics;
// 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} }; if (0 < GetOutlineTextMetrics(dc.GetDC(), sizeof(oMetrics), &oMetrics)) {
GLYPHMETRICS gm; mMetrics->superscriptOffset = (double)oMetrics.otmptSuperscriptOffset.y;
DWORD len = GetGlyphOutlineW(dc.GetDC(), PRUnichar('x'), GGO_METRICS, &gm, 0, nsnull, &kIdentityMatrix); // Some fonts have wrong sign on their subscript offset, bug 410917.
if (len == GDI_ERROR || gm.gmptGlyphOrigin.y <= 0) { mMetrics->subscriptOffset = fabs((double)oMetrics.otmptSubscriptOffset.y);
// 56% of ascent, best guess for true type mMetrics->strikeoutSize = (double)oMetrics.otmsStrikeoutSize;
mMetrics->xHeight = mMetrics->strikeoutOffset = (double)oMetrics.otmsStrikeoutPosition;
ROUND((double)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR); 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 { } else {
mMetrics->xHeight = gm.gmptGlyphOrigin.y; // Make a best-effort guess at extended metrics
} // this is based on general typographic guidelines
mMetrics->emHeight = metrics.tmHeight - metrics.tmInternalLeading;
gfxFloat typEmHeight = (double)oMetrics.otmAscent - (double)oMetrics.otmDescent; // GetTextMetrics can fail if the font file has been removed
mMetrics->emAscent = ROUND(mMetrics->emHeight * (double)oMetrics.otmAscent / typEmHeight); // or corrupted recently.
mMetrics->emDescent = mMetrics->emHeight - mMetrics->emAscent; BOOL result = GetTextMetrics(dc.GetDC(), &metrics);
if (oMetrics.otmEMSquare > 0) { if (!result) {
mFUnitsConvFactor = float(mAdjustedSize / oMetrics.otmEMSquare); NS_WARNING("Missing or corrupt font data, fasten your seatbelt");
} mIsValid = false;
} else { memset(mMetrics, 0, sizeof(*mMetrics));
// Make a best-effort guess at extended metrics return;
// this is based on general typographic guidelines }
// GetTextMetrics can fail if the font file has been removed mMetrics->xHeight =
// or corrupted recently. ROUND((float)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR);
BOOL result = GetTextMetrics(dc.GetDC(), &metrics); mMetrics->superscriptOffset = mMetrics->xHeight;
if (!result) { mMetrics->subscriptOffset = mMetrics->xHeight;
NS_WARNING("Missing or corrupt font data, fasten your seatbelt"); mMetrics->strikeoutSize = 1;
mIsValid = false; mMetrics->strikeoutOffset = ROUND(mMetrics->xHeight * 0.5f); // 50% of xHeight
memset(mMetrics, 0, sizeof(*mMetrics)); mMetrics->underlineSize = 1;
return; 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 = mMetrics->internalLeading = metrics.tmInternalLeading;
ROUND((float)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR); mMetrics->externalLeading = metrics.tmExternalLeading;
mMetrics->superscriptOffset = mMetrics->xHeight; mMetrics->maxHeight = metrics.tmHeight;
mMetrics->subscriptOffset = mMetrics->xHeight; mMetrics->maxAscent = metrics.tmAscent;
mMetrics->strikeoutSize = 1; mMetrics->maxDescent = metrics.tmDescent;
mMetrics->strikeoutOffset = ROUND(mMetrics->xHeight * 0.5f); // 50% of xHeight mMetrics->maxAdvance = metrics.tmMaxCharWidth;
mMetrics->underlineSize = 1; mMetrics->aveCharWidth = NS_MAX<gfxFloat>(1, metrics.tmAveCharWidth);
mMetrics->underlineOffset = -ROUND((float)metrics.tmDescent * 0.30f); // 30% of descent // The font is monospace when TMPF_FIXED_PITCH is *not* set!
mMetrics->emHeight = metrics.tmHeight - metrics.tmInternalLeading; // See http://msdn2.microsoft.com/en-us/library/ms534202(VS.85).aspx
mMetrics->emAscent = metrics.tmAscent - metrics.tmInternalLeading; if (!(metrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) {
mMetrics->emDescent = metrics.tmDescent; mMetrics->maxAdvance = mMetrics->aveCharWidth;
}
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;
} }
}
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, mFontFace = cairo_win32_font_face_create_for_logfontw_hfont(&logFont,
mFont); mFont);
@ -460,20 +464,21 @@ gfxGDIFont::Initialize()
mScaledFont ? cairo_scaled_font_status(mScaledFont) : 0); mScaledFont ? cairo_scaled_font_status(mScaledFont) : 0);
NS_WARNING(warnBuf); NS_WARNING(warnBuf);
#endif #endif
mIsValid = false;
} else {
mIsValid = true;
} }
mIsValid = true;
#if 0 #if 0
printf("Font: %p (%s) size: %f\n", this, printf("Font: %p (%s) size: %f adjusted size: %f valid: %s\n", this,
NS_ConvertUTF16toUTF8(GetName()).get(), mStyle.size); 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(" 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(" maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics->maxAscent, mMetrics->maxDescent, mMetrics->maxAdvance);
printf(" internalLeading: %f externalLeading: %f\n", mMetrics.internalLeading, mMetrics.externalLeading); 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(" 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", printf(" uOff: %f uSize: %f stOff: %f stSize: %f supOff: %f subOff: %f\n",
mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize, mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize,
mMetrics.superscriptOffset, mMetrics.subscriptOffset); mMetrics->superscriptOffset, mMetrics->subscriptOffset);
#endif #endif
} }

View File

@ -53,6 +53,16 @@ let Ci = Components.interfaces;
let Cu = Components.utils; let Cu = Components.utils;
let Cr = Components.results; 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() { function getBrowser() {
return Browser.selectedBrowser; return Browser.selectedBrowser;
} }
@ -166,6 +176,12 @@ var Browser = {
startup: function startup() { startup: function startup() {
var self = this; var self = this;
sendMessageToJava({
gecko: {
type: "Gecko:Ready"
}
});
try { try {
messageManager.loadFrameScript("chrome://browser/content/Util.js", true); messageManager.loadFrameScript("chrome://browser/content/Util.js", true);

View File

@ -267,6 +267,9 @@
#ifdef XP_MACOSX #ifdef XP_MACOSX
@BINPATH@/components/widget_cocoa.xpt @BINPATH@/components/widget_cocoa.xpt
#endif #endif
#ifdef ANDROID
@BINPATH@/components/widget_android.xpt
#endif
@BINPATH@/components/windowds.xpt @BINPATH@/components/windowds.xpt
@BINPATH@/components/windowwatcher.xpt @BINPATH@/components/windowwatcher.xpt
@BINPATH@/components/xpcom_base.xpt @BINPATH@/components/xpcom_base.xpt

View File

@ -63,7 +63,7 @@ nsFastStartup::symbolsLoadingFinished(bool preloaded)
{ {
mSymbolsLoaded = preloaded; mSymbolsLoaded = preloaded;
if (mWidgetPainted && mSymbolsLoaded) { if (mWidgetPainted && mSymbolsLoaded) {
qApp->quit(); mLoop.quit();
} }
} }
@ -71,7 +71,7 @@ void nsFastStartup::painted()
{ {
mWidgetPainted = true; mWidgetPainted = true;
if (mWidgetPainted && mSymbolsLoaded) { 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 // Start native loop in order to get view opened and painted once
// Will block CreateFastStartup function and // Will block CreateFastStartup function and
// exit when symbols are loaded and Static UI shown // exit when symbols are loaded and Static UI shown
qApp->exec(); mLoop.exec();
return true; return true;
} }

View File

@ -42,6 +42,7 @@
#include <QObject> #include <QObject>
#include "nscore.h" #include "nscore.h"
#include <QThread> #include <QThread>
#include <QEventLoop>
#include <sys/time.h> #include <sys/time.h>
class QGraphicsView; class QGraphicsView;
@ -106,6 +107,7 @@ private:
bool mSymbolsLoaded; bool mSymbolsLoaded;
bool mWidgetPainted; bool mWidgetPainted;
GeckoThread* mThread; GeckoThread* mThread;
QEventLoop mLoop;
}; };
#endif #endif