Merge mozilla-inbound into mozilla-central

This commit is contained in:
Ehsan Akhgari 2011-06-09 18:30:11 -04:00
Родитель e6fbc35944 922a508a0e
Коммит bcc8136f6c
20 изменённых файлов: 123 добавлений и 33 удалений

Просмотреть файл

@ -49,6 +49,7 @@
#include "cairo-win32-refptr.h"
#include "cairo-d2d-private-fx.h"
#include "cairo-win32.h"
#include "cairo-list-private.h"
/* describes the type of the currently applied clip so that we can pop it */
struct d2d_clip;
@ -81,7 +82,11 @@ struct _cairo_d2d_surface {
textRenderingState(TEXT_RENDERING_UNINITIALIZED)
{
_cairo_clip_init (&this->clip);
cairo_list_init(&this->dependent_surfaces);
}
~_cairo_d2d_surface();
cairo_surface_t base;
/* Device used by this surface
@ -139,11 +144,23 @@ struct _cairo_d2d_surface {
RefPtr<ID3D10RenderTargetView> buffer_rt_view;
RefPtr<ID3D10ShaderResourceView> buffer_sr_view;
// Other d2d surfaces which depend on this one and need to be flushed if
// it is drawn to. This is required for situations where this surface is
// drawn to another surface, but may be modified before the other surface
// has flushed. When the flush of the other surface then happens and the
// drawing command is actually executed, the contents of this surface will
// no longer be what it was when the drawing command was issued.
cairo_list_t dependent_surfaces;
//cairo_surface_clipper_t clipper;
};
typedef struct _cairo_d2d_surface cairo_d2d_surface_t;
struct _cairo_d2d_surface_entry
{
cairo_list_t link;
cairo_d2d_surface_t *surface;
};
typedef HRESULT (WINAPI*D2D1CreateFactoryFunc)(
__in D2D1_FACTORY_TYPE factoryType,
__in REFIID iid,

Просмотреть файл

@ -1053,6 +1053,25 @@ _cairo_d2d_set_clip (cairo_d2d_surface_t *d2dsurf, cairo_clip_t *clip)
return CAIRO_STATUS_SUCCESS;
}
static void _cairo_d2d_add_dependent_surface(cairo_d2d_surface_t *surf, cairo_d2d_surface_t *user)
{
_cairo_d2d_surface_entry *entry = new _cairo_d2d_surface_entry;
entry->surface = user;
cairo_surface_reference(&user->base);
cairo_list_add(&entry->link, &surf->dependent_surfaces);
};
static void _cairo_d2d_flush_dependent_surfaces(cairo_d2d_surface_t *surf)
{
_cairo_d2d_surface_entry *entry, *next;
cairo_list_foreach_entry_safe(entry, next, _cairo_d2d_surface_entry, &surf->dependent_surfaces, link) {
_cairo_d2d_flush(entry->surface);
cairo_surface_destroy(&entry->surface->base);
delete entry;
}
cairo_list_init(&surf->dependent_surfaces);
}
/**
* Enter the state where the surface is ready for drawing. This will guarantee
* the surface is in the correct state, and the correct clipping area is pushed.
@ -1062,6 +1081,7 @@ _cairo_d2d_set_clip (cairo_d2d_surface_t *d2dsurf, cairo_clip_t *clip)
static void _begin_draw_state(cairo_d2d_surface_t* surface)
{
if (!surface->isDrawing) {
_cairo_d2d_flush_dependent_surfaces(surface);
surface->rt->BeginDraw();
surface->isDrawing = true;
}
@ -1778,6 +1798,9 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf,
_cairo_d2d_update_surface_bitmap(srcSurf);
_cairo_d2d_flush(srcSurf);
// Mark a dependency on the source surface.
_cairo_d2d_add_dependent_surface(srcSurf, d2dsurf);
if (pattern->extend == CAIRO_EXTEND_NONE) {
ID2D1Bitmap *srcSurfBitmap = srcSurf->surfaceBitmap;
d2dsurf->rt->CreateBitmap(
@ -2327,6 +2350,18 @@ _cairo_d2d_surface_init(cairo_d2d_surface_t *newSurf, cairo_d2d_device_t *d2d_de
cairo_addref_device(&d2d_device->base);
d2d_device->mVRAMUsage += _cairo_d2d_compute_surface_mem_size(newSurf);
}
_cairo_d2d_surface::~_cairo_d2d_surface()
{
_cairo_d2d_surface_entry *entry, *next;
cairo_list_foreach_entry_safe(entry, next, _cairo_d2d_surface_entry, &dependent_surfaces, link) {
// We do not need to flush, the contents of our texture has not changed,
// our users have their own reference and can just use it later.
cairo_surface_destroy(&entry->surface->base);
delete entry;
}
}
// Implementation
static cairo_surface_t*
@ -2793,6 +2828,8 @@ _cairo_d2d_blend_surface(cairo_d2d_surface_t *dst,
needsTransform = true;
}
_cairo_d2d_add_dependent_surface(src, dst);
D2D1_BITMAP_INTERPOLATION_MODE interpMode =
D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
@ -2986,6 +3023,8 @@ _cairo_d2d_get_temp_rt(cairo_d2d_surface_t *surf, cairo_clip_t *clip)
static cairo_int_status_t
_cairo_d2d_blend_temp_surface(cairo_d2d_surface_t *surf, cairo_operator_t op, ID2D1RenderTarget *rt, cairo_clip_t *clip, const cairo_rectangle_int_t *bounds = NULL)
{
_cairo_d2d_flush_dependent_surfaces(surf);
int numPaths = 0;
if (clip) {
cairo_clip_path_t *path = clip->path;
@ -3590,6 +3629,10 @@ _cairo_dwrite_manual_show_glyphs_on_d2d_surface(void *surface,
}
}
if (!dst->isDrawing) {
_cairo_d2d_flush_dependent_surfaces(dst);
}
_cairo_d2d_set_clip(dst, NULL);
dst->rt->Flush();

Просмотреть файл

@ -647,7 +647,7 @@ pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.goog
// True if this is the first time we are showing about:firstrun
pref("browser.firstrun.show.uidiscovery", true);
pref("browser.firstrun.show.localepicker", false);
pref("browser.firstrun.show.localepicker", true);
// initiated by a user
pref("content.ime.strict_policy", true);

Просмотреть файл

@ -162,7 +162,7 @@ let Util = {
},
isTablet: function isTablet() {
let dpi = Util.getWindowUtils(window).displayDPI;
let dpi = this.displayDPI;
if (dpi <= 96)
return (window.innerWidth > 1024);
@ -188,6 +188,12 @@ let Util = {
return ViewableAreaObserver.isKeyboardOpened;
return (sendSyncMessage("Content:IsKeyboardOpened", {}))[0];
},
// because this uses the global window, will only work in the parent process
get displayDPI() function() {
delete this.displayDPI;
return this.displayDPI = this.getWindowUtils(window).displayDPI;
}
};

Просмотреть файл

@ -364,7 +364,7 @@ var BrowserUI = {
return true;
case -1: {
let threshold = Services.prefs.getIntPref("widget.ime.android.fullscreen_threshold");
let dpi = Util.getWindowUtils(window).displayDPI;
let dpi = Util.displayDPI;
return (window.innerHeight * 100 < threshold * dpi);
}
}

Просмотреть файл

@ -1112,7 +1112,7 @@ var Browser = {
if (prefValue > 0)
return prefValue / 100;
let dpi = this.windowUtils.displayDPI;
let dpi = Utils.displayDPI;
if (dpi < 200) // Includes desktop displays, and LDPI and MDPI Android devices
return 1;
else if (dpi < 300) // Includes Nokia N900, and HDPI Android devices
@ -1809,7 +1809,7 @@ const ContentTouchHandler = {
panningPrevented: false,
updateCanCancel: function(aX, aY) {
let dpi = Browser.windowUtils.displayDPI;
let dpi = Utils.displayDPI;
const kSafetyX = Services.prefs.getIntPref("dom.w3c_touch_events.safetyX") / 240 * dpi;
const kSafetyY = Services.prefs.getIntPref("dom.w3c_touch_events.safetyY") / 240 * dpi;

Просмотреть файл

@ -68,7 +68,11 @@ const ElementTouchHelper = {
/* Retrieve the closest element to a point by looking at borders position */
getClosest: function getClosest(aWindowUtils, aX, aY) {
let dpiRatio = aWindowUtils.displayDPI / kReferenceDpi;
// cached for the child process, since Utils.displayDPI is only available in the parent
if (!this.dpiRatio)
this.dpiRatio = aWindowUtils.displayDPI / kReferenceDpi;
let dpiRatio = this.dpiRatio;
let target = aWindowUtils.elementFromPoint(aX, aY,
true, /* ignore root scroll frame*/

Просмотреть файл

@ -118,7 +118,7 @@ function MouseModule() {
this._mouseOverTimeout = new Util.Timeout(this._doMouseOver.bind(this));
this._longClickTimeout = new Util.Timeout(this._doLongClick.bind(this));
this._doubleClickRadius = Util.getWindowUtils(window).displayDPI * kDoubleClickRadius;
this._doubleClickRadius = Util.displayDPI * kDoubleClickRadius;
window.addEventListener("mousedown", this, true);
window.addEventListener("mouseup", this, true);
@ -570,7 +570,7 @@ MouseModule.prototype = {
var ScrollUtils = {
// threshold in pixels for sensing a tap as opposed to a pan
get tapRadius() {
let dpi = Util.getWindowUtils(window).displayDPI;
let dpi = Util.displayDPI;
delete this.tapRadius;
return this.tapRadius = Services.prefs.getIntPref("ui.dragThresholdX") / 240 * dpi;
@ -686,7 +686,7 @@ var ScrollUtils = {
*/
function DragData() {
this._domUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
this._lockRevertThreshold = Util.getWindowUtils(window).displayDPI * kAxisLockRevertThreshold;
this._lockRevertThreshold = Util.displayDPI * kAxisLockRevertThreshold;
this.reset();
};

Просмотреть файл

@ -148,7 +148,7 @@ function tab_on_undo() {
let undoBox = document.getElementById("tabs")._tabsUndo;
is(undoBox.firstChild, null, "It should be no tab in the undo box");
Browser.loadURI("about:firstrun");
Browser.loadURI("about:home");
is(undoBox.firstChild, null, "It should be no tab in the undo box when opening a new local page");
// loadURI will open a new tab so ensure new_tab_05 point to the newly opened tab

Просмотреть файл

@ -120,12 +120,6 @@ AboutEmpty.prototype = {
classID: Components.ID("{433d2d75-5923-49b0-854d-f37267b03dc7}")
}
function AboutFirstrun() {}
AboutFirstrun.prototype = {
__proto__: AboutGeneric.prototype,
classID: Components.ID("{077ea23e-0f22-4168-a744-8e444b560197}")
}
function AboutFennec() {}
AboutFennec.prototype = {
__proto__: AboutGeneric.prototype,
@ -162,6 +156,6 @@ AboutBlocked.prototype = {
classID: Components.ID("{88fd40b6-c5c2-4120-9238-f2cb9ff98928}")
}
const components = [AboutEmpty, AboutFirstrun, AboutFennec, AboutRights,
const components = [AboutEmpty, AboutFennec, AboutRights,
AboutCertError, AboutFirefox, AboutHome, AboutBlocked];
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);

Просмотреть файл

@ -1,8 +1,6 @@
# AboutRedirector.js
component {433d2d75-5923-49b0-854d-f37267b03dc7} AboutRedirector.js
contract @mozilla.org/network/protocol/about;1?what=empty {433d2d75-5923-49b0-854d-f37267b03dc7}
component {077ea23e-0f22-4168-a744-8e444b560197} AboutRedirector.js
contract @mozilla.org/network/protocol/about;1?what=firstrun {077ea23e-0f22-4168-a744-8e444b560197}
component {842a6d11-b369-4610-ba66-c3b5217e82be} AboutRedirector.js
contract @mozilla.org/network/protocol/about;1?what=fennec {842a6d11-b369-4610-ba66-c3b5217e82be}
component {dd40c467-d206-4f22-9215-8fcc74c74e38} AboutRedirector.js

Просмотреть файл

@ -11,10 +11,6 @@
# title for the folder that will contains the default bookmarks
#define bookmarks_title Mobile
# LOCALIZATION NOTE (bookmarks_welcome):
# link title for about:firstrun
#define bookmarks_welcome Firefox: Welcome
# LOCALIZATION NOTE (bookmarks_aboutBrowser):
# link title for about:fennec
#define bookmarks_aboutBrowser Firefox: About your browser

Просмотреть файл

@ -3,9 +3,6 @@
[{"type":"text/x-moz-place-container","title":"@bookmarks_title@","annos":[{"name":"mobile/bookmarksRoot","expires":4,"type":1,"value":1}],
"children":
[
{ "title":"@bookmarks_welcome@", "type":"text/x-moz-place", "uri":"about:firstrun",
"iconUri":"chrome://branding/content/favicon32.png"
},
{"index":1,"title":"@bookmarks_aboutBrowser@", "type":"text/x-moz-place", "uri":"about:firefox",
"iconUri":"chrome://branding/content/favicon32.png"
},

Просмотреть файл

@ -226,6 +226,8 @@ nsresult imgRequest::Init(nsIURI *aURI,
mKeyURI = aKeyURI;
mRequest = aRequest;
mChannel = aChannel;
mTimedChannel = do_QueryInterface(mChannel);
mChannel->GetNotificationCallbacks(getter_AddRefs(mPrevChannelSink));
NS_ASSERTION(mPrevChannelSink != this,
@ -956,6 +958,7 @@ NS_IMETHODIMP imgRequest::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt,
statusTracker.SendStopRequest(srIter.GetNext(), lastPart, status);
}
mTimedChannel = nsnull;
return NS_OK;
}
@ -1277,6 +1280,7 @@ imgRequest::OnRedirectVerifyCallback(nsresult result)
}
mChannel = mNewRedirectChannel;
mTimedChannel = do_QueryInterface(mChannel);
mNewRedirectChannel = nsnull;
// Don't make any cache changes if we're going to point to the same thing. We

Просмотреть файл

@ -51,6 +51,7 @@
#include "nsIStreamListener.h"
#include "nsIURI.h"
#include "nsIPrincipal.h"
#include "nsITimedChannel.h"
#include "nsCategoryCache.h"
#include "nsCOMPtr.h"
@ -219,6 +220,8 @@ private:
nsTObserverArray<imgRequestProxy*> mObservers;
nsCOMPtr<nsITimedChannel> mTimedChannel;
nsCString mContentType;
nsRefPtr<imgCacheEntry> mCacheEntry; /* we hold on to this to this so long as we have observers */

Просмотреть файл

@ -57,8 +57,17 @@
using namespace mozilla::imagelib;
NS_IMPL_ISUPPORTS4(imgRequestProxy, imgIRequest, nsIRequest,
nsISupportsPriority, nsISecurityInfoProvider)
NS_IMPL_ADDREF(imgRequestProxy)
NS_IMPL_RELEASE(imgRequestProxy)
NS_INTERFACE_MAP_BEGIN(imgRequestProxy)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, imgIRequest)
NS_INTERFACE_MAP_ENTRY(imgIRequest)
NS_INTERFACE_MAP_ENTRY(nsIRequest)
NS_INTERFACE_MAP_ENTRY(nsISupportsPriority)
NS_INTERFACE_MAP_ENTRY(nsISecurityInfoProvider)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsITimedChannel, TimedChannel() != nsnull)
NS_INTERFACE_MAP_END
imgRequestProxy::imgRequestProxy() :
mOwner(nsnull),

Просмотреть файл

@ -48,6 +48,7 @@
#include "nsIChannel.h"
#include "nsILoadGroup.h"
#include "nsISupportsPriority.h"
#include "nsITimedChannel.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
@ -71,7 +72,10 @@ class Image;
} // namespace imagelib
} // namespace mozilla
class imgRequestProxy : public imgIRequest, public nsISupportsPriority, public nsISecurityInfoProvider
class imgRequestProxy : public imgIRequest,
public nsISupportsPriority,
public nsISecurityInfoProvider,
public nsITimedChannel
{
public:
NS_DECL_ISUPPORTS
@ -79,6 +83,7 @@ public:
NS_DECL_NSIREQUEST
NS_DECL_NSISUPPORTSPRIORITY
NS_DECL_NSISECURITYINFOPROVIDER
// nsITimedChannel declared below
imgRequestProxy();
virtual ~imgRequestProxy();
@ -196,6 +201,16 @@ protected:
// (b) whether mOwner has instantiated its image yet
imgStatusTracker& GetStatusTracker();
nsITimedChannel* TimedChannel()
{
if (!mOwner)
return nsnull;
return mOwner->mTimedChannel;
}
public:
NS_FORWARD_SAFE_NSITIMEDCHANNEL(TimedChannel())
private:
friend class imgCacheValidator;

Просмотреть файл

@ -344,6 +344,9 @@ struct ParamTraits<PRNetAddr>
WriteParam(aMsg, aParam.ipv6.scope_id);
#if defined(XP_UNIX) || defined(XP_OS2)
} else if (aParam.raw.family == PR_AF_LOCAL) {
// Train's already off the rails: let's get a stack trace at least...
NS_RUNTIMEABORT("Error: please post stack trace to "
"https://bugzilla.mozilla.org/show_bug.cgi?id=661158");
aMsg->WriteBytes(aParam.local.path, sizeof(aParam.local.path));
#endif
}

Просмотреть файл

@ -87,6 +87,10 @@ HttpBaseChannel::HttpBaseChannel()
// grab a reference to the handler to ensure that it doesn't go away.
NS_ADDREF(gHttpHandler);
// Subfields of unions cannot be targeted in an initializer list
mSelfAddr.raw.family = PR_AF_UNSPEC;
mPeerAddr.raw.family = PR_AF_UNSPEC;
}
HttpBaseChannel::~HttpBaseChannel()

Просмотреть файл

@ -138,9 +138,6 @@ nsHttpChannel::nsHttpChannel()
LOG(("Creating nsHttpChannel [this=%p]\n", this));
mChannelCreationTime = PR_Now();
mChannelCreationTimestamp = mozilla::TimeStamp::Now();
// Subfields of unions cannot be targeted in an initializer list
mSelfAddr.raw.family = PR_AF_UNSPEC;
mPeerAddr.raw.family = PR_AF_UNSPEC;
}
nsHttpChannel::~nsHttpChannel()