зеркало из https://github.com/mozilla/pjs.git
Merge mozilla-central and mozilla-inbound
This commit is contained in:
Коммит
48607ce5f2
|
@ -4,75 +4,20 @@
|
|||
* 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/. */
|
||||
|
||||
dump('======================= webapi+apps.js ======================= \n');
|
||||
|
||||
'use strict';
|
||||
|
||||
dump('======================= webapi+apps.js ======================= \n');
|
||||
|
||||
let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import('resource://gre/modules/Geometry.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'fm', function() {
|
||||
return Cc['@mozilla.org/focus-manager;1']
|
||||
.getService(Ci.nsIFocusManager);
|
||||
});
|
||||
|
||||
(function() {
|
||||
function generateAPI(window) {
|
||||
let navigator = window.navigator;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(navigator, 'mozKeyboard', function() {
|
||||
return new MozKeyboard();
|
||||
});
|
||||
};
|
||||
|
||||
let progressListener = {
|
||||
onStateChange: function onStateChange(progress, request,
|
||||
flags, status) {
|
||||
},
|
||||
|
||||
onProgressChange: function onProgressChange(progress, request,
|
||||
curSelf, maxSelf,
|
||||
curTotal, maxTotal) {
|
||||
},
|
||||
|
||||
onLocationChange: function onLocationChange(progress, request,
|
||||
locationURI, flags) {
|
||||
content.addEventListener('appwillopen', function(evt) {
|
||||
let appManager = content.wrappedJSObject.Gaia.AppManager;
|
||||
let topWindow = appManager.foregroundWindow.contentWindow;
|
||||
generateAPI(topWindow);
|
||||
});
|
||||
|
||||
generateAPI(content.wrappedJSObject);
|
||||
},
|
||||
|
||||
onStatusChange: function onStatusChange(progress, request,
|
||||
status, message) {
|
||||
},
|
||||
|
||||
onSecurityChange: function onSecurityChange(progress, request,
|
||||
state) {
|
||||
},
|
||||
|
||||
QueryInterface: function QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsIWebProgressListener) ||
|
||||
aIID.equals(Ci.nsISupportsWeakReference) ||
|
||||
aIID.equals(Ci.nsISupports)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
let flags = Ci.nsIWebProgress.NOTIFY_LOCATION;
|
||||
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
flags = Ci.nsIWebProgress.NOTIFY_ALL;
|
||||
webProgress.addProgressListener(progressListener, flags);
|
||||
})();
|
||||
|
||||
// MozKeyboard
|
||||
(function VirtualKeyboardManager() {
|
||||
let activeElement = null;
|
||||
|
@ -139,27 +84,6 @@ XPCOMUtils.defineLazyGetter(Services, 'fm', function() {
|
|||
});
|
||||
})();
|
||||
|
||||
|
||||
function MozKeyboard() {
|
||||
}
|
||||
|
||||
MozKeyboard.prototype = {
|
||||
sendKey: function mozKeyboardSendKey(keyCode, charCode) {
|
||||
charCode = (charCode == undefined) ? keyCode : charCode;
|
||||
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
['keydown', 'keypress', 'keyup'].forEach(function sendKey(type) {
|
||||
utils.sendKeyEvent(type, keyCode, charCode, null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import('resource://gre/modules/Geometry.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
const ContentPanning = {
|
||||
init: function cp_init() {
|
||||
['mousedown', 'mouseup', 'mousemove'].forEach(function(type) {
|
||||
|
@ -328,7 +252,6 @@ const ContentPanning = {
|
|||
|
||||
ContentPanning.init();
|
||||
|
||||
|
||||
// Min/max velocity of kinetic panning. This is in pixels/millisecond.
|
||||
const kMinVelocity = 0.4;
|
||||
const kMaxVelocity = 6;
|
||||
|
@ -497,4 +420,3 @@ const KineticPanning = {
|
|||
content.mozRequestAnimationFrame(callback);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -13,3 +13,8 @@ contract @mozilla.org/alerts-service;1 {5dce03b2-8faa-4b6e-9242-6ddb0411750c}
|
|||
# ContentPermissionPrompt.js
|
||||
component {8c719f03-afe0-4aac-91ff-6c215895d467} ContentPermissionPrompt.js
|
||||
contract @mozilla.org/content-permission/prompt;1 {8c719f03-afe0-4aac-91ff-6c215895d467}
|
||||
|
||||
# MozKeyboard.js
|
||||
component {397a7fdf-2254-47be-b74e-76625a1a66d5} MozKeyboard.js
|
||||
contract @mozilla.org/b2g-keyboard;1 {397a7fdf-2254-47be-b74e-76625a1a66d5}
|
||||
category JavaScript-navigator-property mozKeyboard @mozilla.org/b2g-keyboard;1
|
||||
|
|
|
@ -53,6 +53,7 @@ EXTRA_PP_COMPONENTS = \
|
|||
CameraContent.js \
|
||||
AlertsService.js \
|
||||
ContentPermissionPrompt.js \
|
||||
MozKeyboard.js \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* 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';
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// MozKeyboard
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
function MozKeyboard() { }
|
||||
|
||||
MozKeyboard.prototype = {
|
||||
classID: Components.ID("{397a7fdf-2254-47be-b74e-76625a1a66d5}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIB2GKeyboard, Ci.nsIDOMGlobalPropertyInitializer, Ci.nsIObserver]),
|
||||
classInfo: XPCOMUtils.generateCI({classID: Components.ID("{397a7fdf-2254-47be-b74e-76625a1a66d5}"),
|
||||
contractID: "@mozilla.org/b2g-keyboard;1",
|
||||
interfaces: [Ci.nsIB2GKeyboard],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "B2G Virtual Keyboard"}),
|
||||
|
||||
init: function(aWindow) {
|
||||
this._utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
Services.obs.addObserver(this, "inner-window-destroyed", false);
|
||||
this.innerWindowID = this._utils.currentInnerWindowID;
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "inner-window-destroyed") {
|
||||
let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
|
||||
if (wId == this.innerWindowID) {
|
||||
Services.obs.removeObserver(this, "inner-window-destroyed");
|
||||
this._utils = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
sendKey: function mozKeyboardSendKey(keyCode, charCode) {
|
||||
charCode = (charCode == undefined) ? keyCode : charCode;
|
||||
['keydown', 'keypress', 'keyup'].forEach((function sendKey(type) {
|
||||
this._utils.sendKeyEvent(type, keyCode, charCode, null);
|
||||
}).bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([MozKeyboard]);
|
|
@ -8,5 +8,11 @@
|
|||
interface nsIB2GCameraContent : nsISupports
|
||||
{
|
||||
/* temporary solution, waiting for getUserMedia */
|
||||
DOMString getCameraURI([optional] in jsval options);
|
||||
DOMString getCameraURI([optional] in jsval options);
|
||||
};
|
||||
|
||||
[scriptable, uuid(80ad05f8-e5f6-4a36-b25d-5d5a969b365d)]
|
||||
interface nsIB2GKeyboard : nsISupports
|
||||
{
|
||||
void sendKey(in long aKeyCode, in long aCharCode);
|
||||
};
|
||||
|
|
|
@ -619,3 +619,4 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
|||
@BINPATH@/components/CameraContent.js
|
||||
@BINPATH@/components/AlertsService.js
|
||||
@BINPATH@/components/ContentPermissionPrompt.js
|
||||
@BINPATH@/components/MozKeyboard.js
|
||||
|
|
|
@ -54,10 +54,6 @@ html {
|
|||
|
||||
body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#container {
|
||||
display: -moz-box;
|
||||
-moz-box-orient: vertical;
|
||||
width: 100%;
|
||||
|
|
|
@ -68,41 +68,39 @@
|
|||
</head>
|
||||
|
||||
<body dir="&locale.dir;" onload="onLoad(event)">
|
||||
<div id="container">
|
||||
<div class="spacer"/>
|
||||
<div id="topSection">
|
||||
<img id="brandLogo" src="chrome://branding/content/about-logo.png" alt=""/>
|
||||
<div class="spacer"/>
|
||||
<div id="topSection">
|
||||
<img id="brandLogo" src="chrome://branding/content/about-logo.png" alt=""/>
|
||||
|
||||
<div id="searchContainer">
|
||||
<form name="searchForm" id="searchForm" onsubmit="onSearchSubmit(event)">
|
||||
<div id="searchLogoContainer"><img id="searchEngineLogo"/></div>
|
||||
<input type="text" name="q" value="" id="searchText" maxlength="256"/>
|
||||
<input id="searchSubmit" type="submit" value="&abouthome.searchEngineButton.label;"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="snippetContainer">
|
||||
<div id="defaultSnippets" hidden="true">
|
||||
<span id="defaultSnippet1">&abouthome.defaultSnippet1.v1;</span>
|
||||
<span id="defaultSnippet2">&abouthome.defaultSnippet2.v1;</span>
|
||||
</div>
|
||||
<div id="snippets"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer"/>
|
||||
|
||||
<div id="launcher" session="true">
|
||||
<button class="launchButton" id="bookmarks">&abouthome.bookmarksButton.label;</button>
|
||||
<button class="launchButton" id="history">&abouthome.historyButton.label;</button>
|
||||
<button class="launchButton" id="settings">&abouthome.settingsButton.label;</button>
|
||||
<button class="launchButton" id="addons">&abouthome.addonsButton.label;</button>
|
||||
<button class="launchButton" id="downloads">&abouthome.downloadsButton.label;</button>
|
||||
<button class="launchButton" id="sync">&syncBrand.shortName.label;</button>
|
||||
<div id="restorePreviousSessionSeparator"/>
|
||||
<button class="launchButton" id="restorePreviousSession">&historyRestoreLastSession.label;</button>
|
||||
<div id="searchContainer">
|
||||
<form name="searchForm" id="searchForm" onsubmit="onSearchSubmit(event)">
|
||||
<div id="searchLogoContainer"><img id="searchEngineLogo"/></div>
|
||||
<input type="text" name="q" value="" id="searchText" maxlength="256"/>
|
||||
<input id="searchSubmit" type="submit" value="&abouthome.searchEngineButton.label;"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<a id="aboutMozilla" href="http://www.mozilla.com/about/"/>
|
||||
<div id="snippetContainer">
|
||||
<div id="defaultSnippets" hidden="true">
|
||||
<span id="defaultSnippet1">&abouthome.defaultSnippet1.v1;</span>
|
||||
<span id="defaultSnippet2">&abouthome.defaultSnippet2.v1;</span>
|
||||
</div>
|
||||
<div id="snippets"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer"/>
|
||||
|
||||
<div id="launcher" session="true">
|
||||
<button class="launchButton" id="bookmarks">&abouthome.bookmarksButton.label;</button>
|
||||
<button class="launchButton" id="history">&abouthome.historyButton.label;</button>
|
||||
<button class="launchButton" id="settings">&abouthome.settingsButton.label;</button>
|
||||
<button class="launchButton" id="addons">&abouthome.addonsButton.label;</button>
|
||||
<button class="launchButton" id="downloads">&abouthome.downloadsButton.label;</button>
|
||||
<button class="launchButton" id="sync">&syncBrand.shortName.label;</button>
|
||||
<div id="restorePreviousSessionSeparator"/>
|
||||
<button class="launchButton" id="restorePreviousSession">&historyRestoreLastSession.label;</button>
|
||||
</div>
|
||||
|
||||
<a id="aboutMozilla" href="http://www.mozilla.com/about/"/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1833,11 +1833,11 @@ var gApplicationsPane = {
|
|||
var uri = this._ioSvc.newURI(aWebAppURITemplate, null, null);
|
||||
|
||||
// Unfortunately we can't use the favicon service to get the favicon,
|
||||
// because the service looks in the annotations table for a record with
|
||||
// the exact URL we give it, and users won't have such records for URLs
|
||||
// they don't visit, and users won't visit the web app's URL template,
|
||||
// they'll only visit URLs derived from that template (i.e. with %s
|
||||
// in the template replaced by the URL of the content being handled).
|
||||
// because the service looks for a record with the exact URL we give it, and
|
||||
// users won't have such records for URLs they don't visit, and users won't
|
||||
// visit the handler's URL template, they'll only visit URLs derived from
|
||||
// that template (i.e. with %s in the template replaced by the URL of the
|
||||
// content being handled).
|
||||
|
||||
if (/^https?/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
|
||||
return uri.prePath + "/favicon.ico";
|
||||
|
|
|
@ -102,6 +102,10 @@ ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
|
|||
DEFINES += -DMOZ_SHARED_MOZGLUE=1
|
||||
endif
|
||||
|
||||
ifdef MOZ_JSDEBUGGER
|
||||
DEFINES += -DMOZ_JSDEBUGGER
|
||||
endif
|
||||
|
||||
ifdef MOZ_PKG_MANIFEST_P
|
||||
MOZ_PKG_MANIFEST = package-manifest
|
||||
|
||||
|
|
|
@ -201,7 +201,9 @@
|
|||
@BINPATH@/components/inspector.xpt
|
||||
@BINPATH@/components/intl.xpt
|
||||
@BINPATH@/components/jar.xpt
|
||||
#ifdef MOZ_JSDEBUGGER
|
||||
@BINPATH@/components/jsdservice.xpt
|
||||
#endif
|
||||
@BINPATH@/components/jsdebugger.xpt
|
||||
@BINPATH@/components/jsinspector.xpt
|
||||
@BINPATH@/components/layout_base.xpt
|
||||
|
|
|
@ -15,6 +15,7 @@ class DeviceManagerADB(DeviceManager):
|
|||
self._sock = None
|
||||
self.useRunAs = False
|
||||
self.haveRoot = False
|
||||
self.useDDCopy = False
|
||||
self.useZip = False
|
||||
self.packageName = None
|
||||
self.tempDir = None
|
||||
|
|
|
@ -154,7 +154,6 @@ MOZ_ANDROID_HISTORY = @MOZ_ANDROID_HISTORY@
|
|||
MOZ_WEBSMS_BACKEND = @MOZ_WEBSMS_BACKEND@
|
||||
MOZ_JAVA_COMPOSITOR = @MOZ_JAVA_COMPOSITOR@
|
||||
MOZ_ONLY_TOUCH_EVENTS = @MOZ_ONLY_TOUCH_EVENTS@
|
||||
MOZ_TOUCH = @MOZ_TOUCH@
|
||||
MOZ_PROFILELOCKING = @MOZ_PROFILELOCKING@
|
||||
MOZ_FEEDS = @MOZ_FEEDS@
|
||||
MOZ_TOOLKIT_SEARCH = @MOZ_TOOLKIT_SEARCH@
|
||||
|
|
|
@ -4851,7 +4851,6 @@ cairo-uikit)
|
|||
|
||||
cairo-android)
|
||||
AC_DEFINE(MOZ_WIDGET_ANDROID)
|
||||
AC_DEFINE(MOZ_TOUCH)
|
||||
MOZ_WIDGET_TOOLKIT=android
|
||||
TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
|
||||
TK_LIBS='$(MOZ_CAIRO_LIBS)'
|
||||
|
@ -4861,7 +4860,6 @@ cairo-android)
|
|||
if test "$MOZ_BUILD_APP" = "mobile/xul"; then
|
||||
MOZ_OLD_LINKER=1
|
||||
fi
|
||||
MOZ_TOUCH=1
|
||||
;;
|
||||
|
||||
cairo-gonk)
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsAsyncDOMEvent.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsImageFrame.h"
|
||||
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsEventStates.h"
|
||||
|
@ -300,10 +301,7 @@ nsImageLoadingContent::OnStopDecode(imgIRequest* aRequest,
|
|||
|
||||
// If the pending request is loaded, switch to it.
|
||||
if (aRequest == mPendingRequest) {
|
||||
PrepareCurrentRequest() = mPendingRequest;
|
||||
mPendingRequest = nsnull;
|
||||
mCurrentRequestNeedsResetAnimation = mPendingRequestNeedsResetAnimation;
|
||||
mPendingRequestNeedsResetAnimation = false;
|
||||
MakePendingRequestCurrent();
|
||||
}
|
||||
NS_ABORT_IF_FALSE(aRequest == mCurrentRequest,
|
||||
"One way or another, we should be current by now");
|
||||
|
@ -792,6 +790,26 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
|
|||
getter_AddRefs(req));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
TrackImage(req);
|
||||
|
||||
// Handle cases when we just ended up with a pending request but it's
|
||||
// already done. In that situation we have to synchronously switch that
|
||||
// request to being the current request, because websites depend on that
|
||||
// behavior.
|
||||
if (req == mPendingRequest) {
|
||||
PRUint32 pendingLoadStatus;
|
||||
rv = req->GetImageStatus(&pendingLoadStatus);
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(pendingLoadStatus & imgIRequest::STATUS_LOAD_COMPLETE)) {
|
||||
MakePendingRequestCurrent();
|
||||
MOZ_ASSERT(mCurrentRequest,
|
||||
"How could we not have a current request here?");
|
||||
|
||||
nsImageFrame *f = do_QueryFrame(GetOurPrimaryFrame());
|
||||
if (f) {
|
||||
f->NotifyNewCurrentRequest(mCurrentRequest, NS_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If we don't have a current URI, we might as well store this URI so people
|
||||
// know what we tried (and failed) to load.
|
||||
|
@ -1046,6 +1064,16 @@ nsImageLoadingContent::PreparePendingRequest()
|
|||
return mPendingRequest;
|
||||
}
|
||||
|
||||
void
|
||||
nsImageLoadingContent::MakePendingRequestCurrent()
|
||||
{
|
||||
MOZ_ASSERT(mPendingRequest);
|
||||
PrepareCurrentRequest() = mPendingRequest;
|
||||
mPendingRequest = nsnull;
|
||||
mCurrentRequestNeedsResetAnimation = mPendingRequestNeedsResetAnimation;
|
||||
mPendingRequestNeedsResetAnimation = false;
|
||||
}
|
||||
|
||||
void
|
||||
nsImageLoadingContent::ClearCurrentRequest(nsresult aReason)
|
||||
{
|
||||
|
|
|
@ -297,6 +297,12 @@ protected:
|
|||
nsCOMPtr<imgIRequest>& PrepareCurrentRequest();
|
||||
nsCOMPtr<imgIRequest>& PreparePendingRequest();
|
||||
|
||||
/**
|
||||
* Switch our pending request to be our current request.
|
||||
* mPendingRequest must be non-null!
|
||||
*/
|
||||
void MakePendingRequestCurrent();
|
||||
|
||||
/**
|
||||
* Cancels and nulls-out the "current" and "pending" requests if they exist.
|
||||
*/
|
||||
|
|
|
@ -1098,10 +1098,14 @@ nsTreeSanitizer::MustPrune(PRInt32 aNamespace,
|
|||
nsGkAtoms::datalist == aLocal)) {
|
||||
return true;
|
||||
}
|
||||
if (mDropMedia && (nsGkAtoms::img == aLocal ||
|
||||
if (mDropMedia && (nsGkAtoms::img == aLocal
|
||||
#ifdef MOZ_MEDIA
|
||||
||
|
||||
nsGkAtoms::video == aLocal ||
|
||||
nsGkAtoms::audio == aLocal ||
|
||||
nsGkAtoms::source == aLocal)) {
|
||||
nsGkAtoms::source == aLocal
|
||||
#endif
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
if (nsGkAtoms::meta == aLocal &&
|
||||
|
|
|
@ -236,13 +236,9 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
|
|||
NS_METHOD nsDOMMouseEvent::GetScreenX(PRInt32* aScreenX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aScreenX);
|
||||
#ifdef MOZ_TOUCH
|
||||
*aScreenX = nsDOMEvent::GetScreenCoords(mPresContext,
|
||||
mEvent,
|
||||
mEvent->refPoint).x;
|
||||
#else
|
||||
*aScreenX = GetScreenPoint().x;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -250,13 +246,9 @@ NS_IMETHODIMP
|
|||
nsDOMMouseEvent::GetScreenY(PRInt32* aScreenY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aScreenY);
|
||||
#ifdef MOZ_TOUCH
|
||||
*aScreenY = nsDOMEvent::GetScreenCoords(mPresContext,
|
||||
mEvent,
|
||||
mEvent->refPoint).y;
|
||||
#else
|
||||
*aScreenY = GetScreenPoint().y;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -264,14 +256,10 @@ nsDOMMouseEvent::GetScreenY(PRInt32* aScreenY)
|
|||
NS_METHOD nsDOMMouseEvent::GetClientX(PRInt32* aClientX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aClientX);
|
||||
#ifdef MOZ_TOUCH
|
||||
*aClientX = nsDOMEvent::GetClientCoords(mPresContext,
|
||||
mEvent,
|
||||
mEvent->refPoint,
|
||||
mClientPoint).x;
|
||||
#else
|
||||
*aClientX = GetClientPoint().x;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -279,14 +267,10 @@ NS_IMETHODIMP
|
|||
nsDOMMouseEvent::GetClientY(PRInt32* aClientY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aClientY);
|
||||
#ifdef MOZ_TOUCH
|
||||
*aClientY = nsDOMEvent::GetClientCoords(mPresContext,
|
||||
mEvent,
|
||||
mEvent->refPoint,
|
||||
mClientPoint).y;
|
||||
#else
|
||||
*aClientY = GetClientPoint().y;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,6 @@ NS_IMETHODIMP
|
|||
nsDOMUIEvent::GetPageX(PRInt32* aPageX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageX);
|
||||
#ifdef MOZ_TOUCH
|
||||
if (mPrivateDataDuplicated) {
|
||||
*aPageX = mPagePoint.x;
|
||||
} else {
|
||||
|
@ -253,9 +252,6 @@ nsDOMUIEvent::GetPageX(PRInt32* aPageX)
|
|||
mEvent->refPoint,
|
||||
mClientPoint).x;
|
||||
}
|
||||
#else
|
||||
*aPageX = GetPagePoint().x;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -263,7 +259,6 @@ NS_IMETHODIMP
|
|||
nsDOMUIEvent::GetPageY(PRInt32* aPageY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageY);
|
||||
#ifdef MOZ_TOUCH
|
||||
if (mPrivateDataDuplicated) {
|
||||
*aPageY = mPagePoint.y;
|
||||
} else {
|
||||
|
@ -272,9 +267,6 @@ nsDOMUIEvent::GetPageY(PRInt32* aPageY)
|
|||
mEvent->refPoint,
|
||||
mClientPoint).y;
|
||||
}
|
||||
#else
|
||||
*aPageY = GetPagePoint().y;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -413,7 +405,6 @@ nsDOMUIEvent::GetIsChar(bool* aIsChar)
|
|||
NS_METHOD
|
||||
nsDOMUIEvent::DuplicatePrivateData()
|
||||
{
|
||||
#ifdef MOZ_TOUCH
|
||||
mClientPoint = nsDOMEvent::GetClientCoords(mPresContext,
|
||||
mEvent,
|
||||
mEvent->refPoint,
|
||||
|
@ -427,13 +418,6 @@ nsDOMUIEvent::DuplicatePrivateData()
|
|||
nsIntPoint screenPoint = nsDOMEvent::GetScreenCoords(mPresContext,
|
||||
mEvent,
|
||||
mEvent->refPoint);
|
||||
#else
|
||||
mClientPoint = GetClientPoint();
|
||||
mLayerPoint = GetLayerPoint();
|
||||
mPagePoint = GetPagePoint();
|
||||
// GetScreenPoint converts mEvent->refPoint to right coordinates.
|
||||
nsIntPoint screenPoint = GetScreenPoint();
|
||||
#endif
|
||||
nsresult rv = nsDOMEvent::DuplicatePrivateData();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mEvent->refPoint = screenPoint;
|
||||
|
|
|
@ -113,6 +113,7 @@ EXPORTS_mozilla/dom = \
|
|||
DOMError.h \
|
||||
DOMRequest.h \
|
||||
StructuredCloneTags.h \
|
||||
ScreenOrientation.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_ScreenOrientation_h
|
||||
#define mozilla_dom_ScreenOrientation_h
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
enum ScreenOrientation {
|
||||
eScreenOrientation_Current = 0,
|
||||
eScreenOrientation_PortraitPrimary = 1, // 00000001
|
||||
eScreenOrientation_PortraitSecondary = 2, // 00000010
|
||||
eScreenOrientation_Portrait = 3, // 00000011
|
||||
eScreenOrientation_LandscapePrimary = 4, // 00000100
|
||||
eScreenOrientation_LandscapeSecondary = 8, // 00001000
|
||||
eScreenOrientation_Landscape = 12, // 00001100
|
||||
eScreenOrientation_EndGuard
|
||||
};
|
||||
|
||||
/**
|
||||
* ScreenOrientationWrapper is a class wrapping ScreenOrientation so it can be
|
||||
* used with Observer<T> which is taking a class, not an enum.
|
||||
* C++11 should make this useless.
|
||||
*/
|
||||
class ScreenOrientationWrapper {
|
||||
public:
|
||||
ScreenOrientationWrapper()
|
||||
: orientation(eScreenOrientation_Current)
|
||||
{}
|
||||
|
||||
ScreenOrientationWrapper(ScreenOrientation aOrientation)
|
||||
: orientation(aOrientation)
|
||||
{}
|
||||
|
||||
ScreenOrientation orientation;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
namespace IPC {
|
||||
|
||||
/**
|
||||
* Screen orientation serializer.
|
||||
* Note that technically, 5, 6, 7, 9, 10 and 11 are illegal values but will
|
||||
* not make the serializer to fail. We might want to write our own serializer.
|
||||
*/
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::ScreenOrientation>
|
||||
: public EnumSerializer<mozilla::dom::ScreenOrientation,
|
||||
mozilla::dom::eScreenOrientation_Current,
|
||||
mozilla::dom::eScreenOrientation_EndGuard>
|
||||
{};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // mozilla_dom_ScreenOrientation_h
|
|
@ -39,7 +39,8 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "SmsFilter.h" // On top because it includes basictypes.h.
|
||||
// On top because they include basictypes.h:
|
||||
#include "SmsFilter.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef GetClassName
|
||||
|
@ -2475,6 +2476,7 @@ nsDOMClassInfo::Init()
|
|||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMPrototype, nsIDOMDOMConstructor)
|
||||
|
@ -4068,6 +4070,7 @@ nsDOMClassInfo::Init()
|
|||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozConnection, nsIDOMMozConnection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozConnection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
|
||||
|
|
|
@ -64,6 +64,12 @@
|
|||
#include "nsDOMOfflineResourceList.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifdef GetClassName
|
||||
#undef GetClassName
|
||||
#endif // GetClassName
|
||||
#endif // XP_WIN
|
||||
|
||||
// Helper Classes
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
@ -1306,6 +1312,10 @@ nsGlobalWindow::FreeInnerObjects()
|
|||
mNavigator = nsnull;
|
||||
}
|
||||
|
||||
if (mScreen) {
|
||||
mScreen = nsnull;
|
||||
}
|
||||
|
||||
if (mDocument) {
|
||||
NS_ASSERTION(mDoc, "Why is mDoc null?");
|
||||
|
||||
|
@ -2448,8 +2458,6 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
|
|||
|
||||
if (mFrames)
|
||||
mFrames->SetDocShell(aDocShell);
|
||||
if (mScreen)
|
||||
mScreen->SetDocShell(aDocShell);
|
||||
|
||||
if (!mDocShell) {
|
||||
MaybeForgiveSpamCount();
|
||||
|
@ -2957,14 +2965,14 @@ nsGlobalWindow::GetNavigator(nsIDOMNavigator** aNavigator)
|
|||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetScreen(nsIDOMScreen** aScreen)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetScreen, (aScreen), NS_ERROR_NOT_INITIALIZED);
|
||||
FORWARD_TO_INNER(GetScreen, (aScreen), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
*aScreen = nsnull;
|
||||
|
||||
if (!mScreen && mDocShell) {
|
||||
mScreen = new nsScreen(mDocShell);
|
||||
if (!mScreen) {
|
||||
mScreen = nsScreen::Create(this);
|
||||
if (!mScreen) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,13 +47,32 @@
|
|||
#include "nsLayoutUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
/* static */ bool nsScreen::sInitialized = false;
|
||||
/* static */ bool nsScreen::sAllowScreenEnabledProperty = false;
|
||||
/* static */ bool nsScreen::sAllowScreenBrightnessProperty = false;
|
||||
|
||||
namespace {
|
||||
|
||||
bool
|
||||
IsChromeType(nsIDocShell *aDocShell)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell);
|
||||
if (!ds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PRInt32 itemType;
|
||||
ds->GetItemType(&itemType);
|
||||
return itemType == nsIDocShellTreeItem::typeChrome;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
/* static */ void
|
||||
nsScreen::Initialize()
|
||||
{
|
||||
|
@ -65,41 +84,86 @@ nsScreen::Initialize()
|
|||
"dom.screenBrightnessProperty.enabled");
|
||||
}
|
||||
|
||||
//
|
||||
// Screen class implementation
|
||||
//
|
||||
nsScreen::nsScreen(nsIDocShell* aDocShell)
|
||||
: mDocShell(aDocShell)
|
||||
/* static */ already_AddRefed<nsScreen>
|
||||
nsScreen::Create(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
if (!sInitialized) {
|
||||
Initialize();
|
||||
}
|
||||
|
||||
if (!aWindow->GetDocShell()) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aWindow);
|
||||
NS_ENSURE_TRUE(sgo, nsnull);
|
||||
|
||||
nsRefPtr<nsScreen> screen = new nsScreen();
|
||||
screen->BindToOwner(aWindow);
|
||||
screen->mIsChrome = IsChromeType(aWindow->GetDocShell());
|
||||
|
||||
hal::RegisterScreenOrientationObserver(screen);
|
||||
hal::GetCurrentScreenOrientation(&(screen->mOrientation));
|
||||
|
||||
return screen.forget();
|
||||
}
|
||||
|
||||
nsScreen::nsScreen()
|
||||
{
|
||||
}
|
||||
|
||||
nsScreen::~nsScreen()
|
||||
{
|
||||
hal::UnregisterScreenOrientationObserver(this);
|
||||
}
|
||||
|
||||
|
||||
DOMCI_DATA(Screen, nsScreen)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsScreen)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsScreen,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(mozorientationchange)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsScreen,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(mozorientationchange)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
// QueryInterface implementation for nsScreen
|
||||
NS_INTERFACE_MAP_BEGIN(nsScreen)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsScreen)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMScreen)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMScreen)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Screen)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsScreen, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(nsScreen, nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF(nsScreen)
|
||||
NS_IMPL_RELEASE(nsScreen)
|
||||
NS_IMPL_EVENT_HANDLER(nsScreen, mozorientationchange)
|
||||
|
||||
bool
|
||||
nsScreen::IsWhiteListed() {
|
||||
if (mIsChrome) {
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreen::SetDocShell(nsIDocShell* aDocShell)
|
||||
{
|
||||
mDocShell = aDocShell; // Weak Reference
|
||||
return NS_OK;
|
||||
if (!GetOwner()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_GetInterface(GetOwner()->GetDocShell());
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIPrincipal *principal = doc->NodePrincipal();
|
||||
nsCOMPtr<nsIURI> principalURI;
|
||||
principal->GetURI(getter_AddRefs(principalURI));
|
||||
return nsContentUtils::URIIsChromeOrInPref(principalURI,
|
||||
"dom.mozScreenWhitelist");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -220,7 +284,7 @@ nsScreen::GetAvailTop(PRInt32* aAvailTop)
|
|||
nsDeviceContext*
|
||||
nsScreen::GetDeviceContext()
|
||||
{
|
||||
return nsLayoutUtils::GetDeviceContextForScreenInfo(mDocShell);
|
||||
return nsLayoutUtils::GetDeviceContextForScreenInfo(GetOwner());
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -261,39 +325,10 @@ nsScreen::GetAvailRect(nsRect& aRect)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsWhiteListed(nsIDocShell *aDocShell) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell);
|
||||
if (!ds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PRInt32 itemType;
|
||||
ds->GetItemType(&itemType);
|
||||
if (itemType == nsIDocShellTreeItem::typeChrome) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_GetInterface(aDocShell);
|
||||
nsIPrincipal *principal = doc->NodePrincipal();
|
||||
|
||||
nsCOMPtr<nsIURI> principalURI;
|
||||
principal->GetURI(getter_AddRefs(principalURI));
|
||||
if (nsContentUtils::URIIsChromeOrInPref(principalURI,
|
||||
"dom.mozScreenWhitelist")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
nsresult
|
||||
nsScreen::GetMozEnabled(bool *aEnabled)
|
||||
{
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed(mDocShell)) {
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed()) {
|
||||
*aEnabled = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -305,7 +340,7 @@ nsScreen::GetMozEnabled(bool *aEnabled)
|
|||
nsresult
|
||||
nsScreen::SetMozEnabled(bool aEnabled)
|
||||
{
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed(mDocShell)) {
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -318,7 +353,7 @@ nsScreen::SetMozEnabled(bool aEnabled)
|
|||
nsresult
|
||||
nsScreen::GetMozBrightness(double *aBrightness)
|
||||
{
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed(mDocShell)) {
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed()) {
|
||||
*aBrightness = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -330,7 +365,7 @@ nsScreen::GetMozBrightness(double *aBrightness)
|
|||
nsresult
|
||||
nsScreen::SetMozBrightness(double aBrightness)
|
||||
{
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed(mDocShell)) {
|
||||
if (!sAllowScreenEnabledProperty || !IsWhiteListed()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -338,3 +373,63 @@ nsScreen::SetMozBrightness(double aBrightness)
|
|||
hal::SetScreenBrightness(aBrightness);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsScreen::Notify(const ScreenOrientationWrapper& aOrientation)
|
||||
{
|
||||
ScreenOrientation previousOrientation = mOrientation;
|
||||
mOrientation = aOrientation.orientation;
|
||||
|
||||
NS_ASSERTION(mOrientation != eScreenOrientation_Current &&
|
||||
mOrientation != eScreenOrientation_EndGuard &&
|
||||
mOrientation != eScreenOrientation_Portrait &&
|
||||
mOrientation != eScreenOrientation_Landscape,
|
||||
"Invalid orientation value passed to notify method!");
|
||||
|
||||
if (mOrientation != previousOrientation) {
|
||||
// TODO: use an helper method, see bug 720768.
|
||||
nsRefPtr<nsDOMEvent> event = new nsDOMEvent(nsnull, nsnull);
|
||||
nsresult rv = event->InitEvent(NS_LITERAL_STRING("mozorientationchange"), false, false);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
rv = event->SetTrusted(true);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool dummy;
|
||||
rv = DispatchEvent(event, &dummy);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScreen::GetMozOrientation(nsAString& aOrientation)
|
||||
{
|
||||
switch (mOrientation) {
|
||||
case eScreenOrientation_Current:
|
||||
case eScreenOrientation_EndGuard:
|
||||
case eScreenOrientation_Portrait:
|
||||
case eScreenOrientation_Landscape:
|
||||
NS_ASSERTION(false, "Shouldn't be used when getting value!");
|
||||
return NS_ERROR_FAILURE;
|
||||
case eScreenOrientation_PortraitPrimary:
|
||||
aOrientation.AssignLiteral("portrait-primary");
|
||||
break;
|
||||
case eScreenOrientation_PortraitSecondary:
|
||||
aOrientation.AssignLiteral("portrait-secondary");
|
||||
break;
|
||||
case eScreenOrientation_LandscapePrimary:
|
||||
aOrientation.AssignLiteral("landscape-primary");
|
||||
break;
|
||||
case eScreenOrientation_LandscapeSecondary:
|
||||
aOrientation.AssignLiteral("landscape-secondary");
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -37,40 +37,60 @@
|
|||
#ifndef nsScreen_h___
|
||||
#define nsScreen_h___
|
||||
|
||||
#include "mozilla/Hal.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "mozilla/Observer.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsDeviceContext;
|
||||
struct nsRect;
|
||||
|
||||
// Script "screen" object
|
||||
class nsScreen : public nsIDOMScreen
|
||||
class nsScreen : public nsDOMEventTargetHelper
|
||||
, public nsIDOMScreen
|
||||
, public mozilla::hal::ScreenOrientationObserver
|
||||
{
|
||||
public:
|
||||
nsScreen(nsIDocShell* aDocShell);
|
||||
virtual ~nsScreen();
|
||||
static already_AddRefed<nsScreen> Create(nsPIDOMWindow* aWindow);
|
||||
|
||||
NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
|
||||
void Invalidate();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMSCREEN
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsScreen,
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
void Notify(const mozilla::dom::ScreenOrientationWrapper& aOrientation);
|
||||
|
||||
protected:
|
||||
nsDeviceContext* GetDeviceContext();
|
||||
nsresult GetRect(nsRect& aRect);
|
||||
nsresult GetAvailRect(nsRect& aRect);
|
||||
|
||||
nsIDocShell* mDocShell; // Weak Reference
|
||||
bool mIsChrome;
|
||||
|
||||
mozilla::dom::ScreenOrientation mOrientation;
|
||||
|
||||
private:
|
||||
nsScreen();
|
||||
virtual ~nsScreen();
|
||||
|
||||
static bool sInitialized;
|
||||
static bool sAllowScreenEnabledProperty;
|
||||
static bool sAllowScreenBrightnessProperty;
|
||||
|
||||
static void Initialize();
|
||||
|
||||
bool IsWhiteListed();
|
||||
|
||||
NS_DECL_EVENT_HANDLER(mozorientationchange)
|
||||
};
|
||||
|
||||
#endif /* nsScreen_h___ */
|
||||
|
|
|
@ -516,8 +516,7 @@ JSClass gDummyPropClass = {
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub,
|
||||
JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -2476,7 +2475,7 @@ JSClass ThreadLocalJSRuntime::sGlobalClass = {
|
|||
"IndexedDBTransactionThreadGlobal",
|
||||
JSCLASS_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
CreateIndexHelper::CreateIndexHelper(IDBTransaction* aTransaction,
|
||||
|
|
|
@ -91,3 +91,5 @@ XPIDLSRCS = \
|
|||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
XPIDL_FLAGS += -I$(topsrcdir)/dom/interfaces/events/
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "domstubs.idl"
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
|
||||
[scriptable, uuid(4507e43f-097c-452a-bfc4-dbb99748f6fd)]
|
||||
interface nsIDOMScreen : nsISupports
|
||||
[scriptable, uuid(6366afc9-0072-4231-a4ec-98cd65f350ef)]
|
||||
interface nsIDOMScreen : nsIDOMEventTarget
|
||||
{
|
||||
readonly attribute long top;
|
||||
readonly attribute long left;
|
||||
|
@ -75,4 +75,13 @@ interface nsIDOMScreen : nsISupports
|
|||
* @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1].
|
||||
*/
|
||||
attribute double mozBrightness;
|
||||
|
||||
/**
|
||||
* Returns the current screen orientation.
|
||||
* Can be: landscape-primary, landscape-secondary,
|
||||
* portrait-primary or portrait-secondary.
|
||||
*/
|
||||
readonly attribute DOMString mozOrientation;
|
||||
|
||||
attribute nsIDOMEventListener onmozorientationchange;
|
||||
};
|
||||
|
|
|
@ -25,6 +25,8 @@ ok(navigator.mozConnection, "navigator.mozConnection returns an object");
|
|||
|
||||
ok(navigator.mozConnection instanceof MozConnection,
|
||||
"navigator.mozConnection is a MozConnection object");
|
||||
ok(navigator.mozConnection instanceof EventTarget,
|
||||
"navigator.mozConnection is a EventTarget object");
|
||||
|
||||
checkInterface("Connection");
|
||||
|
||||
|
|
|
@ -1804,7 +1804,7 @@ bool nsPluginInstanceOwner::AddPluginView(const gfxRect& aRect)
|
|||
|
||||
void nsPluginInstanceOwner::RemovePluginView()
|
||||
{
|
||||
if (!mInstance || !mObjectFrame)
|
||||
if (!mInstance)
|
||||
return;
|
||||
|
||||
void* surface = mInstance->GetJavaSurface();
|
||||
|
|
|
@ -59,8 +59,7 @@ namespace {
|
|||
JSClass _varname = { \
|
||||
_name, 0, \
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub, \
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub \
|
||||
};
|
||||
|
||||
DECL_EVENTTARGET_CLASS(gClass, "EventTarget")
|
||||
|
|
|
@ -365,8 +365,7 @@ private:
|
|||
_name, \
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, \
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize \
|
||||
};
|
||||
|
||||
DECL_EVENT_CLASS(Event::sClass, "Event")
|
||||
|
@ -618,8 +617,7 @@ private:
|
|||
_name, \
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, \
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize \
|
||||
};
|
||||
|
||||
DECL_MESSAGEEVENT_CLASS(MessageEvent::sClass, "MessageEvent")
|
||||
|
@ -804,8 +802,7 @@ private:
|
|||
_name, \
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, \
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS \
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize \
|
||||
};
|
||||
|
||||
DECL_ERROREVENT_CLASS(ErrorEvent::sClass, "ErrorEvent")
|
||||
|
@ -984,8 +981,7 @@ JSClass ProgressEvent::sClass = {
|
|||
"ProgressEvent",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec ProgressEvent::sProperties[] = {
|
||||
|
|
|
@ -186,8 +186,7 @@ JSClass DOMException::sClass = {
|
|||
"DOMException",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec DOMException::sProperties[] = {
|
||||
|
@ -358,8 +357,7 @@ JSClass FileException::sClass = {
|
|||
"FileException",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec FileException::sProperties[] = {
|
||||
|
|
|
@ -219,8 +219,7 @@ JSClass Blob::sClass = {
|
|||
"Blob",
|
||||
JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec Blob::sProperties[] = {
|
||||
|
@ -370,8 +369,7 @@ JSClass File::sClass = {
|
|||
"File",
|
||||
JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec File::sProperties[] = {
|
||||
|
|
|
@ -343,8 +343,7 @@ JSClass FileReaderSync::sClass = {
|
|||
"FileReaderSync",
|
||||
JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSFunctionSpec FileReaderSync::sFunctions[] = {
|
||||
|
|
|
@ -183,8 +183,7 @@ JSClass Location::sClass = {
|
|||
"WorkerLocation",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec Location::sProperties[] = {
|
||||
|
|
|
@ -172,8 +172,7 @@ JSClass Navigator::sClass = {
|
|||
"WorkerNavigator",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec Navigator::sProperties[] = {
|
||||
|
|
|
@ -592,8 +592,7 @@ JSClass WorkerGlobalScope::sClass = {
|
|||
"WorkerGlobalScope",
|
||||
0,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
JSPropertySpec WorkerGlobalScope::sProperties[] = {
|
||||
|
|
|
@ -341,6 +341,13 @@ nsEditor::PostCreate()
|
|||
if (target) {
|
||||
InitializeSelection(target);
|
||||
}
|
||||
|
||||
// If the text control gets reframed during focus, Focus() would not be
|
||||
// called, so take a chance here to see if we need to spell check the text
|
||||
// control.
|
||||
nsEditorEventListener* listener =
|
||||
reinterpret_cast<nsEditorEventListener*> (mEventListener.get());
|
||||
listener->SpellCheckIfNeeded();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -905,17 +905,9 @@ nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
|
|||
if (mEditor->IsDisabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the spell check skip flag is still enabled from creation time,
|
||||
// disable it because focused editors are allowed to spell check.
|
||||
PRUint32 currentFlags = 0;
|
||||
mEditor->GetFlags(¤tFlags);
|
||||
if(currentFlags & nsIPlaintextEditor::eEditorSkipSpellCheck)
|
||||
{
|
||||
currentFlags ^= nsIPlaintextEditor::eEditorSkipSpellCheck;
|
||||
mEditor->SetFlags(currentFlags);
|
||||
}
|
||||
|
||||
|
||||
// Spell check a textarea the first time that it is focused.
|
||||
SpellCheckIfNeeded();
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aEvent->GetTarget(getter_AddRefs(target));
|
||||
|
@ -1013,3 +1005,16 @@ nsEditorEventListener::Blur(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsEditorEventListener::SpellCheckIfNeeded() {
|
||||
// If the spell check skip flag is still enabled from creation time,
|
||||
// disable it because focused editors are allowed to spell check.
|
||||
PRUint32 currentFlags = 0;
|
||||
mEditor->GetFlags(¤tFlags);
|
||||
if(currentFlags & nsIPlaintextEditor::eEditorSkipSpellCheck)
|
||||
{
|
||||
currentFlags ^= nsIPlaintextEditor::eEditorSkipSpellCheck;
|
||||
mEditor->SetFlags(currentFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ public:
|
|||
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
|
||||
|
||||
void SpellCheckIfNeeded();
|
||||
|
||||
protected:
|
||||
nsresult InstallToEditor();
|
||||
void UninstallFromEditor();
|
||||
|
|
|
@ -1105,9 +1105,13 @@ public class GeckoAppShell
|
|||
GeckoApp.mAppContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
|
||||
}
|
||||
|
||||
public static String showFilePicker(String aFilters) {
|
||||
public static String showFilePickerForExtensions(String aExtensions) {
|
||||
return GeckoApp.mAppContext.
|
||||
showFilePicker(getMimeTypeFromExtensions(aFilters));
|
||||
showFilePicker(getMimeTypeFromExtensions(aExtensions));
|
||||
}
|
||||
|
||||
public static String showFilePickerForMimeType(String aMimeType) {
|
||||
return GeckoApp.mAppContext.showFilePicker(aMimeType);
|
||||
}
|
||||
|
||||
public static void performHapticFeedback(boolean aIsLongPress) {
|
||||
|
|
24
gfx/2d/2D.h
24
gfx/2d/2D.h
|
@ -55,6 +55,7 @@ typedef _cairo_scaled_font cairo_scaled_font_t;
|
|||
|
||||
struct ID3D10Device1;
|
||||
struct ID3D10Texture2D;
|
||||
struct IDWriteRenderingParams;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -488,6 +489,23 @@ protected:
|
|||
ScaledFont() {}
|
||||
};
|
||||
|
||||
/* This class is designed to allow passing additional glyph rendering
|
||||
* parameters to the glyph drawing functions. This is an empty wrapper class
|
||||
* merely used to allow holding on to and passing around platform specific
|
||||
* parameters. This is because different platforms have unique rendering
|
||||
* parameters.
|
||||
*/
|
||||
class GlyphRenderingOptions : public RefCounted<GlyphRenderingOptions>
|
||||
{
|
||||
public:
|
||||
virtual ~GlyphRenderingOptions() {}
|
||||
|
||||
virtual FontType GetType() const = 0;
|
||||
|
||||
protected:
|
||||
GlyphRenderingOptions() {}
|
||||
};
|
||||
|
||||
/* This is the main class used for all the drawing. It is created through the
|
||||
* factory and accepts drawing commands. The results of drawing to a target
|
||||
* may be used either through a Snapshot or by flushing the target and directly
|
||||
|
@ -640,7 +658,8 @@ public:
|
|||
virtual void FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions()) = 0;
|
||||
const DrawOptions &aOptions = DrawOptions(),
|
||||
const GlyphRenderingOptions *aRenderingOptions = NULL) = 0;
|
||||
|
||||
/*
|
||||
* This takes a source pattern and a mask, and composites the source pattern
|
||||
|
@ -806,6 +825,9 @@ public:
|
|||
static void SetDirect3D10Device(ID3D10Device1 *aDevice);
|
||||
static ID3D10Device1 *GetDirect3D10Device();
|
||||
|
||||
static TemporaryRef<GlyphRenderingOptions>
|
||||
CreateDWriteGlyphRenderingOptions(IDWriteRenderingParams *aParams);
|
||||
|
||||
private:
|
||||
static ID3D10Device1 *mD3D10Device;
|
||||
#endif
|
||||
|
|
|
@ -699,7 +699,8 @@ DrawTargetCG::Fill(const Path *aPath, const Pattern &aPattern, const DrawOptions
|
|||
|
||||
|
||||
void
|
||||
DrawTargetCG::FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, const Pattern &aPattern, const DrawOptions &aDrawOptions)
|
||||
DrawTargetCG::FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, const Pattern &aPattern, const DrawOptions &aDrawOptions,
|
||||
const GlyphRenderingOptions*)
|
||||
{
|
||||
MarkChanged();
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
virtual void StrokeLine(const Point &, const Point &, const Pattern &, const StrokeOptions &, const DrawOptions &);
|
||||
virtual void Stroke(const Path *, const Pattern &, const StrokeOptions &, const DrawOptions &);
|
||||
virtual void Fill(const Path *, const Pattern &, const DrawOptions &);
|
||||
virtual void FillGlyphs(ScaledFont *, const GlyphBuffer&, const Pattern &, const DrawOptions &);
|
||||
virtual void FillGlyphs(ScaledFont *, const GlyphBuffer&, const Pattern &, const DrawOptions &, const GlyphRenderingOptions *);
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
|
|
@ -587,7 +587,8 @@ void
|
|||
DrawTargetCairo::FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions)
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions*)
|
||||
{
|
||||
AutoPrepareForDrawing prep(this, mContext);
|
||||
|
||||
|
|
|
@ -125,7 +125,8 @@ public:
|
|||
virtual void FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions);
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions *aRenderingOptions = NULL);
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
|
|
@ -880,7 +880,8 @@ void
|
|||
DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions)
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions* aRenderOptions)
|
||||
{
|
||||
if (aFont->GetType() != FONT_DWRITE) {
|
||||
gfxDebug() << *this << ": Ignoring drawing call for incompatible font.";
|
||||
|
@ -893,6 +894,19 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
|
|||
|
||||
PrepareForDrawing(rt);
|
||||
|
||||
IDWriteRenderingParams *params = NULL;
|
||||
if (aRenderOptions) {
|
||||
if (aRenderOptions->GetType() != FONT_DWRITE) {
|
||||
gfxDebug() << *this << ": Ignoring incompatible GlyphRenderingOptions.";
|
||||
// This should never happen.
|
||||
MOZ_ASSERT(false);
|
||||
} else {
|
||||
params = static_cast<const GlyphRenderingOptionsDWrite*>(aRenderOptions)->mParams;
|
||||
}
|
||||
}
|
||||
|
||||
rt->SetTextRenderingParams(params);
|
||||
|
||||
RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aPattern, aOptions.mAlpha);
|
||||
|
||||
DWRITE_GLYPH_RUN glyphRun;
|
||||
|
|
|
@ -117,7 +117,8 @@ public:
|
|||
virtual void FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions(),
|
||||
const GlyphRenderingOptions *aRenderingOptions = NULL);
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
|
|
@ -543,7 +543,8 @@ void
|
|||
DrawTargetSkia::FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions)
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions*)
|
||||
{
|
||||
if (aFont->GetType() != FONT_MAC && aFont->GetType() != FONT_SKIA) {
|
||||
return;
|
||||
|
|
|
@ -98,7 +98,8 @@ public:
|
|||
virtual void FillGlyphs(ScaledFont *aFont,
|
||||
const GlyphBuffer &aBuffer,
|
||||
const Pattern &aPattern,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
const DrawOptions &aOptions = DrawOptions(),
|
||||
const GlyphRenderingOptions *aRenderingOptions = NULL);
|
||||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
|
|
@ -217,6 +217,15 @@ Factory::GetDirect3D10Device()
|
|||
return mD3D10Device;
|
||||
}
|
||||
|
||||
TemporaryRef<GlyphRenderingOptions>
|
||||
Factory::CreateDWriteGlyphRenderingOptions(IDWriteRenderingParams *aParams)
|
||||
{
|
||||
RefPtr<GlyphRenderingOptions> options =
|
||||
new GlyphRenderingOptionsDWrite(aParams);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
#endif // XP_WIN
|
||||
|
||||
#ifdef USE_CAIRO
|
||||
|
|
|
@ -63,6 +63,22 @@ private:
|
|||
Float mSize;
|
||||
};
|
||||
|
||||
class GlyphRenderingOptionsDWrite : public GlyphRenderingOptions
|
||||
{
|
||||
public:
|
||||
GlyphRenderingOptionsDWrite(IDWriteRenderingParams *aParams)
|
||||
: mParams(aParams)
|
||||
{
|
||||
}
|
||||
|
||||
virtual FontType GetType() const { return FONT_DWRITE; }
|
||||
|
||||
private:
|
||||
friend class DrawTargetD2D;
|
||||
|
||||
RefPtr<IDWriteRenderingParams> mParams;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2305,13 +2305,10 @@ BasicShadowableThebesLayer::SetBackBufferAndAttrs(const OptionalThebesBuffer& aB
|
|||
{
|
||||
if (OptionalThebesBuffer::Tnull_t == aBuffer.type()) {
|
||||
mBackBuffer = SurfaceDescriptor();
|
||||
} else if (!IsSurfaceDescriptorValid(mBackBuffer)) {
|
||||
} else {
|
||||
mBackBuffer = aBuffer.get_ThebesBuffer().buffer();
|
||||
mBackBufferRect = aBuffer.get_ThebesBuffer().rect();
|
||||
mBackBufferRectRotation = aBuffer.get_ThebesBuffer().rotation();
|
||||
} else {
|
||||
SurfaceDescriptor obsoleteBuffer = aBuffer.get_ThebesBuffer().buffer();
|
||||
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&obsoleteBuffer);
|
||||
}
|
||||
mFrontAndBackBufferDiffer = true;
|
||||
mROFrontBuffer = aReadOnlyFrontBuffer;
|
||||
|
@ -2414,8 +2411,6 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
|
|||
mBuffer.BufferRect(),
|
||||
mBuffer.BufferRotation(),
|
||||
mBackBuffer);
|
||||
mROFrontBuffer = ThebesBuffer(mBackBuffer, mBuffer.BufferRect(), mBuffer.BufferRotation());
|
||||
mBackBuffer = SurfaceDescriptor();
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
|
|
|
@ -1121,7 +1121,10 @@ ProgressiveUploadCallback(gl::TextureImage* aImage, int aTileNumber,
|
|||
void
|
||||
ShadowThebesLayerOGL::ProgressiveUpload()
|
||||
{
|
||||
if (mRegionPendingUpload.IsEmpty())
|
||||
// Mark the task as completed
|
||||
mUploadTask = nsnull;
|
||||
|
||||
if (mRegionPendingUpload.IsEmpty() || mBuffer == nsnull)
|
||||
return;
|
||||
|
||||
// Set a tile iteration callback so we can cancel the upload after a tile
|
||||
|
@ -1140,9 +1143,6 @@ ShadowThebesLayerOGL::ProgressiveUpload()
|
|||
// Remove the iteration callback
|
||||
tiledImage->SetIterationCallback(nsnull, nsnull);
|
||||
|
||||
// Mark the task as completed
|
||||
mUploadTask = nsnull;
|
||||
|
||||
if (!mRegionPendingUpload.IsEmpty()) {
|
||||
// Schedule another upload task
|
||||
mUploadTask = NewRunnableMethod(this, &ShadowThebesLayerOGL::ProgressiveUpload);
|
||||
|
@ -1240,6 +1240,12 @@ void
|
|||
ShadowThebesLayerOGL::DestroyFrontBuffer()
|
||||
{
|
||||
if (ShouldDoubleBuffer()) {
|
||||
// Cancel the progressive upload task, if it's running
|
||||
if (mUploadTask) {
|
||||
mUploadTask->Cancel();
|
||||
mUploadTask = nsnull;
|
||||
}
|
||||
|
||||
mFrontBuffer.Clear();
|
||||
mOldValidRegion.SetEmpty();
|
||||
|
||||
|
@ -1262,7 +1268,7 @@ ShadowThebesLayerOGL::Destroy()
|
|||
{
|
||||
if (!mDestroyed) {
|
||||
mDestroyed = true;
|
||||
mBuffer = nsnull;
|
||||
DestroyFrontBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
return mBufferRotation;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxASurface> Buffer() {
|
||||
gfxASurface* Buffer() {
|
||||
return mBuffer;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,11 @@ private:
|
|||
// still requires uploading.
|
||||
nsIntRegion mRegionPendingUpload;
|
||||
|
||||
// Task used for progressive texture upload.
|
||||
// Task used for progressive texture upload. When double-buffering, rather
|
||||
// than synchronously uploading texture data, we immediately return and
|
||||
// upload only what is necessary when rendering the layer. We also upload
|
||||
// other parts of the layer that aren't necessary to render progressively,
|
||||
// over time.
|
||||
CancelableTask* mUploadTask;
|
||||
|
||||
// Following used for double-buffering
|
||||
|
|
|
@ -155,7 +155,7 @@ JSClass global_class = {
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_PropertyStub,
|
||||
global_enumerate, (JSResolveOp) global_resolve,
|
||||
JS_ConvertStub, JS_FinalizeStub
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
SkJS::SkJS(void* hwnd) : SkOSWindow(hwnd) {
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
// Chosen this as to resemble DWrite's own oblique face style.
|
||||
#define OBLIQUE_SKEW_FACTOR 0.3
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
// This is also in gfxGDIFont.cpp. Would be nice to put it somewhere common,
|
||||
// but we can't declare it in the gfxFont.h or gfxFontUtils.h headers
|
||||
// because those are exported, and the cairo headers aren't.
|
||||
|
@ -709,6 +711,19 @@ gfxDWriteFont::GetGlyphWidth(gfxContext *aCtx, PRUint16 aGID)
|
|||
return width;
|
||||
}
|
||||
|
||||
TemporaryRef<GlyphRenderingOptions>
|
||||
gfxDWriteFont::GetGlyphRenderingOptions()
|
||||
{
|
||||
if (UsingClearType()) {
|
||||
return Factory::CreateDWriteGlyphRenderingOptions(
|
||||
gfxWindowsPlatform::GetPlatform()->GetRenderingParams(GetForceGDIClassic() ?
|
||||
gfxWindowsPlatform::TEXT_RENDERING_GDI_CLASSIC : gfxWindowsPlatform::TEXT_RENDERING_NORMAL));
|
||||
} else {
|
||||
return Factory::CreateDWriteGlyphRenderingOptions(gfxWindowsPlatform::GetPlatform()->
|
||||
GetRenderingParams(gfxWindowsPlatform::TEXT_RENDERING_NO_CLEARTYPE));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
gfxDWriteFont::GetForceGDIClassic()
|
||||
{
|
||||
|
|
|
@ -90,6 +90,8 @@ public:
|
|||
|
||||
virtual PRInt32 GetGlyphWidth(gfxContext *aCtx, PRUint16 aGID);
|
||||
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions> GetGlyphRenderingOptions();
|
||||
|
||||
protected:
|
||||
friend class gfxDWriteShaper;
|
||||
|
||||
|
|
|
@ -1318,7 +1318,8 @@ struct GlyphBufferAzure {
|
|||
}
|
||||
|
||||
void Flush(DrawTarget *aDT, Pattern &aPattern, ScaledFont *aFont,
|
||||
gfxFont::DrawMode aDrawMode, bool aReverse, bool aFinish = false)
|
||||
gfxFont::DrawMode aDrawMode, bool aReverse, const GlyphRenderingOptions *aOptions,
|
||||
bool aFinish = false)
|
||||
{
|
||||
// Ensure there's enough room for a glyph to be added to the buffer
|
||||
if (!aFinish && mNumGlyphs < GLYPH_BUFFER_SIZE || !mNumGlyphs) {
|
||||
|
@ -1337,7 +1338,7 @@ struct GlyphBufferAzure {
|
|||
buf.mGlyphs = mGlyphBuffer;
|
||||
buf.mNumGlyphs = mNumGlyphs;
|
||||
|
||||
aDT->FillGlyphs(aFont, buf, aPattern);
|
||||
aDT->FillGlyphs(aFont, buf, aPattern, DrawOptions(), aOptions);
|
||||
|
||||
mNumGlyphs = 0;
|
||||
}
|
||||
|
@ -1576,6 +1577,9 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
Matrix mat, matInv;
|
||||
Matrix oldMat = dt->GetTransform();
|
||||
|
||||
RefPtr<GlyphRenderingOptions> renderingOptions =
|
||||
GetGlyphRenderingOptions();
|
||||
|
||||
if (mScaledFont) {
|
||||
cairo_matrix_t matrix;
|
||||
cairo_scaled_font_get_font_matrix(mScaledFont, &matrix);
|
||||
|
@ -1623,7 +1627,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||
glyph->mPosition.y = ToDeviceUnits(y, devUnitsPerAppUnit);
|
||||
glyph->mPosition = matInv * glyph->mPosition;
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL);
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL, renderingOptions);
|
||||
|
||||
// synthetic bolding by multi-striking with 1-pixel offsets
|
||||
// at least once, more if there's room (large font sizes)
|
||||
|
@ -1640,7 +1644,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
doubleglyph->mPosition.y = glyph->mPosition.y;
|
||||
doubleglyph->mPosition = matInv * doubleglyph->mPosition;
|
||||
strikeOffset += synBoldOnePixelOffset;
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL);
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL, renderingOptions);
|
||||
} while (--strikeCount > 0);
|
||||
}
|
||||
} else {
|
||||
|
@ -1678,7 +1682,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||
glyph->mPosition.y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit);
|
||||
glyph->mPosition = matInv * glyph->mPosition;
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL);
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL, renderingOptions);
|
||||
|
||||
if (IsSyntheticBold()) {
|
||||
double strikeOffset = synBoldOnePixelOffset;
|
||||
|
@ -1694,7 +1698,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
doubleglyph->mPosition.y = glyph->mPosition.y;
|
||||
strikeOffset += synBoldOnePixelOffset;
|
||||
doubleglyph->mPosition = matInv * doubleglyph->mPosition;
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL);
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL, renderingOptions);
|
||||
} while (--strikeCount > 0);
|
||||
}
|
||||
}
|
||||
|
@ -1712,7 +1716,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
}
|
||||
}
|
||||
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL, true);
|
||||
glyphs.Flush(dt, colPat, scaledFont, aDrawMode, isRTL, renderingOptions, true);
|
||||
|
||||
dt->SetTransform(oldMat);
|
||||
}
|
||||
|
|
|
@ -1254,6 +1254,10 @@ public:
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Return Azure GlyphRenderingOptions for drawing this font.
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
|
||||
GetGlyphRenderingOptions() { return nsnull; }
|
||||
|
||||
gfxFloat SynthesizeSpaceWidth(PRUint32 aCh);
|
||||
|
||||
// Font metrics
|
||||
|
|
|
@ -107,7 +107,23 @@ BuildKeyNameFromFontName(nsAString &aName)
|
|||
// Implementation of gfxPlatformFontList for Win32 GDI,
|
||||
// using GDI font enumeration APIs to get the list of fonts
|
||||
|
||||
static HMODULE fontlib;
|
||||
typedef LONG
|
||||
(WINAPI *TTLoadEmbeddedFontProc)(HANDLE* phFontReference, ULONG ulFlags,
|
||||
ULONG* pulPrivStatus, ULONG ulPrivs,
|
||||
ULONG* pulStatus,
|
||||
READEMBEDPROC lpfnReadFromStream,
|
||||
LPVOID lpvReadStream,
|
||||
LPWSTR szWinFamilyName,
|
||||
LPSTR szMacFamilyName,
|
||||
TTLOADINFO* pTTLoadInfo);
|
||||
|
||||
typedef LONG
|
||||
(WINAPI *TTDeleteEmbeddedFontProc)(HANDLE hFontReference, ULONG ulFlags,
|
||||
ULONG* pulStatus);
|
||||
|
||||
|
||||
static TTLoadEmbeddedFontProc TTLoadEmbeddedFontPtr = nsnull;
|
||||
static TTDeleteEmbeddedFontProc TTDeleteEmbeddedFontPtr = nsnull;
|
||||
|
||||
class WinUserFontData : public gfxUserFontData {
|
||||
public:
|
||||
|
@ -120,7 +136,7 @@ public:
|
|||
if (mIsEmbedded) {
|
||||
ULONG pulStatus;
|
||||
LONG err;
|
||||
err = TTDeleteEmbeddedFont(mFontRef, 0, &pulStatus);
|
||||
err = TTDeleteEmbeddedFontPtr(mFontRef, 0, &pulStatus);
|
||||
#if DEBUG
|
||||
if (err != E_NONE) {
|
||||
char buf[256];
|
||||
|
@ -576,11 +592,7 @@ gfxGDIFontList::gfxGDIFontList()
|
|||
{
|
||||
mFontSubstitutes.Init(50);
|
||||
|
||||
// Make sure the t2embed library is available because it may be
|
||||
// disabled to work around security vulnerabilities.
|
||||
if (!fontlib) {
|
||||
fontlib = LoadLibraryW(L"t2embed.dll");
|
||||
}
|
||||
InitializeFontEmbeddingProcs();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -767,6 +779,17 @@ gfxGDIFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
|||
return fe;
|
||||
}
|
||||
|
||||
void gfxGDIFontList::InitializeFontEmbeddingProcs()
|
||||
{
|
||||
static HMODULE fontlib = LoadLibraryW(L"t2embed.dll");
|
||||
if (!fontlib)
|
||||
return;
|
||||
TTLoadEmbeddedFontPtr = (TTLoadEmbeddedFontProc)
|
||||
GetProcAddress(fontlib, "TTLoadEmbeddedFont");
|
||||
TTDeleteEmbeddedFontPtr = (TTDeleteEmbeddedFontProc)
|
||||
GetProcAddress(fontlib, "TTDeleteEmbeddedFont");
|
||||
}
|
||||
|
||||
// used to control stream read by Windows TTLoadEmbeddedFont API
|
||||
|
||||
class EOTFontStreamReader {
|
||||
|
@ -870,10 +893,6 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
|||
};
|
||||
FontDataDeleter autoDelete(aFontData);
|
||||
|
||||
// if the t2embed library isn't available, bail
|
||||
if (!fontlib)
|
||||
return nsnull;
|
||||
|
||||
bool hasVertical;
|
||||
bool isCFF = gfxFontUtils::IsCffFont(aFontData, hasVertical);
|
||||
|
||||
|
@ -886,8 +905,8 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
|||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
// for TTF fonts, first try using the t2embed library
|
||||
if (!isCFF) {
|
||||
// for TTF fonts, first try using the t2embed library if available
|
||||
if (!isCFF && TTLoadEmbeddedFontPtr && TTDeleteEmbeddedFontPtr) {
|
||||
// TrueType-style glyphs, use EOT library
|
||||
AutoFallibleTArray<PRUint8,2048> eotHeader;
|
||||
PRUint8 *buffer;
|
||||
|
@ -912,11 +931,11 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
|||
EOTFontStreamReader eotReader(aFontData, aLength, buffer, eotlen,
|
||||
&overlayNameData);
|
||||
|
||||
ret = TTLoadEmbeddedFont(&fontRef, TTLOAD_PRIVATE, &privStatus,
|
||||
LICENSE_PREVIEWPRINT, &pulStatus,
|
||||
EOTFontStreamReader::ReadEOTStream,
|
||||
&eotReader,
|
||||
(PRUnichar*)(fontName.get()), 0, 0);
|
||||
ret = TTLoadEmbeddedFontPtr(&fontRef, TTLOAD_PRIVATE, &privStatus,
|
||||
LICENSE_PREVIEWPRINT, &pulStatus,
|
||||
EOTFontStreamReader::ReadEOTStream,
|
||||
&eotReader,
|
||||
(PRUnichar*)(fontName.get()), 0, 0);
|
||||
if (ret != E_NONE) {
|
||||
fontRef = nsnull;
|
||||
char buf[256];
|
||||
|
|
|
@ -1347,6 +1347,9 @@ gfxWindowsPlatform::FontsPrefsChanged(const char *aPref)
|
|||
}
|
||||
}
|
||||
|
||||
#define ENHANCED_CONTRAST_REGISTRY_KEY \
|
||||
HKEY_CURRENT_USER, "Software\\Microsoft\\Avalon.Graphics\\DISPLAY1\\EnhancedContrastLevel"
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::SetupClearTypeParams()
|
||||
{
|
||||
|
@ -1404,6 +1407,59 @@ gfxWindowsPlatform::SetupClearTypeParams()
|
|||
mMeasuringMode = DWRITE_MEASURING_MODE_NATURAL;
|
||||
break;
|
||||
}
|
||||
|
||||
nsRefPtr<IDWriteRenderingParams> defaultRenderingParams;
|
||||
GetDWriteFactory()->CreateRenderingParams(getter_AddRefs(defaultRenderingParams));
|
||||
// For EnhancedContrast, we override the default if the user has not set it
|
||||
// in the registry (by using the ClearType Tuner).
|
||||
if (contrast >= 0.0 && contrast <= 10.0) {
|
||||
contrast = contrast;
|
||||
} else {
|
||||
HKEY hKey;
|
||||
if (RegOpenKeyExA(ENHANCED_CONTRAST_REGISTRY_KEY,
|
||||
0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
contrast = defaultRenderingParams->GetEnhancedContrast();
|
||||
RegCloseKey(hKey);
|
||||
} else {
|
||||
contrast = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// For parameters that have not been explicitly set,
|
||||
// we copy values from default params (or our overridden value for contrast)
|
||||
if (gamma < 1.0 || gamma > 2.2) {
|
||||
gamma = defaultRenderingParams->GetGamma();
|
||||
}
|
||||
|
||||
if (level < 0.0 || level > 1.0) {
|
||||
level = defaultRenderingParams->GetClearTypeLevel();
|
||||
}
|
||||
|
||||
DWRITE_PIXEL_GEOMETRY dwriteGeometry =
|
||||
static_cast<DWRITE_PIXEL_GEOMETRY>(geometry);
|
||||
DWRITE_RENDERING_MODE renderMode =
|
||||
static_cast<DWRITE_RENDERING_MODE>(mode);
|
||||
|
||||
if (dwriteGeometry < DWRITE_PIXEL_GEOMETRY_FLAT ||
|
||||
dwriteGeometry > DWRITE_PIXEL_GEOMETRY_BGR) {
|
||||
dwriteGeometry = defaultRenderingParams->GetPixelGeometry();
|
||||
}
|
||||
|
||||
if (renderMode < DWRITE_RENDERING_MODE_DEFAULT ||
|
||||
renderMode > DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC) {
|
||||
renderMode = defaultRenderingParams->GetRenderingMode();
|
||||
}
|
||||
|
||||
mRenderingParams[TEXT_RENDERING_NO_CLEARTYPE] = defaultRenderingParams;
|
||||
|
||||
GetDWriteFactory()->CreateCustomRenderingParams(gamma, contrast, level,
|
||||
dwriteGeometry, renderMode,
|
||||
getter_AddRefs(mRenderingParams[TEXT_RENDERING_NORMAL]));
|
||||
|
||||
GetDWriteFactory()->CreateCustomRenderingParams(gamma, contrast, level,
|
||||
dwriteGeometry, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
|
||||
getter_AddRefs(mRenderingParams[TEXT_RENDERING_GDI_CLASSIC]));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -119,6 +119,13 @@ struct ClearTypeParameterInfo {
|
|||
|
||||
class THEBES_API gfxWindowsPlatform : public gfxPlatform {
|
||||
public:
|
||||
enum TextRenderingMode {
|
||||
TEXT_RENDERING_NO_CLEARTYPE,
|
||||
TEXT_RENDERING_NORMAL,
|
||||
TEXT_RENDERING_GDI_CLASSIC,
|
||||
TEXT_RENDERING_COUNT
|
||||
};
|
||||
|
||||
gfxWindowsPlatform();
|
||||
virtual ~gfxWindowsPlatform();
|
||||
static gfxWindowsPlatform *GetPlatform() {
|
||||
|
@ -251,6 +258,9 @@ public:
|
|||
inline bool DWriteEnabled() { return mUseDirectWrite; }
|
||||
inline DWRITE_MEASURING_MODE DWriteMeasuringMode() { return mMeasuringMode; }
|
||||
IDWriteTextAnalyzer *GetDWriteAnalyzer() { return mDWriteAnalyzer; }
|
||||
|
||||
IDWriteRenderingParams *GetRenderingParams(TextRenderingMode aRenderMode)
|
||||
{ return mRenderingParams[aRenderMode]; }
|
||||
#else
|
||||
inline bool DWriteEnabled() { return false; }
|
||||
#endif
|
||||
|
@ -277,6 +287,7 @@ private:
|
|||
#ifdef CAIRO_HAS_DWRITE_FONT
|
||||
nsRefPtr<IDWriteFactory> mDWriteFactory;
|
||||
nsRefPtr<IDWriteTextAnalyzer> mDWriteAnalyzer;
|
||||
nsRefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
|
||||
DWRITE_MEASURING_MODE mMeasuringMode;
|
||||
#endif
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
|
|
63
hal/Hal.cpp
63
hal/Hal.cpp
|
@ -19,6 +19,7 @@
|
|||
#include "nsIDocShell.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "WindowIdentifier.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
|
||||
using namespace mozilla::services;
|
||||
|
||||
|
@ -178,8 +179,22 @@ public:
|
|||
}
|
||||
|
||||
void RemoveObserver(Observer<InfoType>* aObserver) {
|
||||
// If mObservers is null, that means there are no observers.
|
||||
// In addition, if RemoveObserver() returns false, that means we didn't
|
||||
// find the observer.
|
||||
// In both cases, that is a logical error we want to make sure the developer
|
||||
// notices.
|
||||
|
||||
MOZ_ASSERT(mObservers);
|
||||
mObservers->RemoveObserver(aObserver);
|
||||
|
||||
#ifndef DEBUG
|
||||
if (!mObservers) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
DebugOnly<bool> removed = mObservers->RemoveObserver(aObserver);
|
||||
MOZ_ASSERT(removed);
|
||||
|
||||
if (mObservers->Length() == 0) {
|
||||
DisableNotifications();
|
||||
|
@ -289,6 +304,24 @@ protected:
|
|||
|
||||
static WakeLockObserversManager sWakeLockObservers;
|
||||
|
||||
class ScreenOrientationObserversManager : public CachingObserversManager<dom::ScreenOrientationWrapper>
|
||||
{
|
||||
protected:
|
||||
void EnableNotifications() {
|
||||
PROXY_IF_SANDBOXED(EnableScreenOrientationNotifications());
|
||||
}
|
||||
|
||||
void DisableNotifications() {
|
||||
PROXY_IF_SANDBOXED(DisableScreenOrientationNotifications());
|
||||
}
|
||||
|
||||
void GetCurrentInformationInternal(dom::ScreenOrientationWrapper* aInfo) {
|
||||
PROXY_IF_SANDBOXED(GetCurrentScreenOrientation(&(aInfo->orientation)));
|
||||
}
|
||||
};
|
||||
|
||||
static ScreenOrientationObserversManager sScreenOrientationObservers;
|
||||
|
||||
void
|
||||
RegisterBatteryObserver(BatteryObserver* aObserver)
|
||||
{
|
||||
|
@ -503,5 +536,33 @@ NotifyWakeLockChange(const WakeLockInformation& aInfo)
|
|||
sWakeLockObservers.BroadcastInformation(aInfo);
|
||||
}
|
||||
|
||||
void
|
||||
RegisterScreenOrientationObserver(hal::ScreenOrientationObserver* aObserver)
|
||||
{
|
||||
AssertMainThread();
|
||||
sScreenOrientationObservers.AddObserver(aObserver);
|
||||
}
|
||||
|
||||
void
|
||||
UnregisterScreenOrientationObserver(hal::ScreenOrientationObserver* aObserver)
|
||||
{
|
||||
AssertMainThread();
|
||||
sScreenOrientationObservers.RemoveObserver(aObserver);
|
||||
}
|
||||
|
||||
void
|
||||
GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation)
|
||||
{
|
||||
AssertMainThread();
|
||||
*aScreenOrientation = sScreenOrientationObservers.GetCurrentInformation().orientation;
|
||||
}
|
||||
|
||||
void
|
||||
NotifyScreenOrientationChange(const dom::ScreenOrientation& aScreenOrientation)
|
||||
{
|
||||
sScreenOrientationObservers.CacheInformation(dom::ScreenOrientationWrapper(aScreenOrientation));
|
||||
sScreenOrientationObservers.BroadcastCachedInformation();
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
} // namespace mozilla
|
||||
|
|
33
hal/Hal.h
33
hal/Hal.h
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/dom/network/Types.h"
|
||||
#include "mozilla/dom/power/Types.h"
|
||||
#include "mozilla/hal_sandbox/PHal.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
|
||||
/*
|
||||
* Hal.h contains the public Hal API.
|
||||
|
@ -36,8 +37,17 @@ class nsIDOMWindow;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
template <class T>
|
||||
class Observer;
|
||||
|
||||
namespace dom {
|
||||
class ScreenOrientationWrapper;
|
||||
}
|
||||
|
||||
namespace hal {
|
||||
|
||||
typedef Observer<dom::ScreenOrientationWrapper> ScreenOrientationObserver;
|
||||
|
||||
class WindowIdentifier;
|
||||
|
||||
extern PRLogModuleInfo *sHalLog;
|
||||
|
@ -290,6 +300,29 @@ void GetWakeLockInfo(const nsAString &aTopic, hal::WakeLockInformation *aWakeLoc
|
|||
*/
|
||||
void NotifyWakeLockChange(const hal::WakeLockInformation& aWakeLockInfo);
|
||||
|
||||
/**
|
||||
* Inform the backend there is a new screen orientation observer.
|
||||
* @param aScreenOrientationObserver The observer that should be added.
|
||||
*/
|
||||
void RegisterScreenOrientationObserver(hal::ScreenOrientationObserver* aScreenOrientationObserver);
|
||||
|
||||
/**
|
||||
* Inform the backend a screen orientation observer unregistered.
|
||||
* @param aScreenOrientationObserver The observer that should be removed.
|
||||
*/
|
||||
void UnregisterScreenOrientationObserver(hal::ScreenOrientationObserver* aScreenOrientationObserver);
|
||||
|
||||
/**
|
||||
* Returns the current screen orientation.
|
||||
*/
|
||||
void GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation);
|
||||
|
||||
/**
|
||||
* Notify of a change in the screen orientation.
|
||||
* @param aScreenOrientation The new screen orientation.
|
||||
*/
|
||||
void NotifyScreenOrientationChange(const dom::ScreenOrientation& aScreenOrientation);
|
||||
|
||||
} // namespace MOZ_HAL_NAMESPACE
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -77,6 +77,16 @@ void EnableNetworkNotifications();
|
|||
*/
|
||||
void DisableNetworkNotifications();
|
||||
|
||||
/**
|
||||
* Enables screen orientation notifications from the backend.
|
||||
*/
|
||||
void EnableScreenOrientationNotifications();
|
||||
|
||||
/**
|
||||
* Disables screen orientation notifications from the backend.
|
||||
*/
|
||||
void DisableScreenOrientationNotifications();
|
||||
|
||||
} // namespace MOZ_HAL_NAMESPACE
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ CPPSRCS = \
|
|||
SandboxHal.cpp \
|
||||
WindowIdentifier.cpp \
|
||||
HalWakeLock.cpp \
|
||||
ScreenOrientationFallback.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/* 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/. */
|
||||
|
||||
#include "Hal.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
#include "nsIScreenManager.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace hal_impl {
|
||||
|
||||
void
|
||||
EnableScreenOrientationNotifications()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
DisableScreenOrientationNotifications()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation)
|
||||
{
|
||||
nsresult result;
|
||||
nsCOMPtr<nsIScreenManager> screenMgr =
|
||||
do_GetService("@mozilla.org/gfx/screenmanager;1", &result);
|
||||
if (NS_FAILED(result)) {
|
||||
NS_ERROR("Can't find nsIScreenManager!");
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32 screenLeft, screenTop, screenWidth, screenHeight;
|
||||
nsCOMPtr<nsIScreen> screen;
|
||||
|
||||
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
|
||||
screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight);
|
||||
|
||||
*aScreenOrientation = screenWidth >= screenHeight
|
||||
? dom::eScreenOrientation_LandscapePrimary
|
||||
: dom::eScreenOrientation_PortraitPrimary;
|
||||
}
|
||||
|
||||
} // hal_impl
|
||||
} // mozilla
|
|
@ -42,6 +42,7 @@ include protocol PBrowser;
|
|||
include "nspr/prtime.h";
|
||||
include "mozilla/HalSensor.h";
|
||||
include "mozilla/HalTypes.h";
|
||||
include "mozilla/dom/ScreenOrientation.h";
|
||||
|
||||
using PRTime;
|
||||
using mozilla::hal::FlashMode;
|
||||
|
@ -49,6 +50,7 @@ using mozilla::hal::LightType;
|
|||
using mozilla::hal::LightMode;
|
||||
using mozilla::hal::SensorType;
|
||||
using mozilla::hal::WakeLockControl;
|
||||
using mozilla::dom::ScreenOrientation;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -73,9 +75,7 @@ namespace hal {
|
|||
PRTime timestamp;
|
||||
float[] values;
|
||||
};
|
||||
}
|
||||
|
||||
namespace hal {
|
||||
struct NetworkInformation {
|
||||
double bandwidth;
|
||||
bool canBeMetered;
|
||||
|
@ -99,6 +99,7 @@ child:
|
|||
NotifyBatteryChange(BatteryInformation aBatteryInfo);
|
||||
NotifyNetworkChange(NetworkInformation aNetworkInfo);
|
||||
NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
|
||||
NotifyScreenOrientationChange(ScreenOrientation aScreenOrientation);
|
||||
|
||||
parent:
|
||||
Vibrate(uint32[] pattern, uint64[] id, PBrowser browser);
|
||||
|
@ -137,6 +138,11 @@ parent:
|
|||
sync GetWakeLockInfo(nsString aTopic)
|
||||
returns (WakeLockInformation aWakeLockInfo);
|
||||
|
||||
EnableScreenOrientationNotifications();
|
||||
DisableScreenOrientationNotifications();
|
||||
sync GetCurrentScreenOrientation()
|
||||
returns (ScreenOrientation aScreenOrientation);
|
||||
|
||||
child:
|
||||
NotifySensorChange(SensorData aSensorData);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/battery/Types.h"
|
||||
#include "mozilla/dom/network/Types.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "WindowIdentifier.h"
|
||||
|
@ -91,6 +92,24 @@ GetCurrentNetworkInformation(NetworkInformation* aNetworkInfo)
|
|||
Hal()->SendGetCurrentNetworkInformation(aNetworkInfo);
|
||||
}
|
||||
|
||||
void
|
||||
EnableScreenOrientationNotifications()
|
||||
{
|
||||
Hal()->SendEnableScreenOrientationNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
DisableScreenOrientationNotifications()
|
||||
{
|
||||
Hal()->SendDisableScreenOrientationNotifications();
|
||||
}
|
||||
|
||||
void
|
||||
GetCurrentScreenOrientation(ScreenOrientation* aScreenOrientation)
|
||||
{
|
||||
Hal()->SendGetCurrentScreenOrientation(aScreenOrientation);
|
||||
}
|
||||
|
||||
bool
|
||||
GetScreenEnabled()
|
||||
{
|
||||
|
@ -198,6 +217,7 @@ class HalParent : public PHalParent
|
|||
, public NetworkObserver
|
||||
, public ISensorObserver
|
||||
, public WakeLockObserver
|
||||
, public ScreenOrientationObserver
|
||||
{
|
||||
public:
|
||||
NS_OVERRIDE virtual bool
|
||||
|
@ -283,6 +303,28 @@ public:
|
|||
unused << SendNotifyNetworkChange(aNetworkInfo);
|
||||
}
|
||||
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvEnableScreenOrientationNotifications() {
|
||||
hal::RegisterScreenOrientationObserver(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvDisableScreenOrientationNotifications() {
|
||||
hal::UnregisterScreenOrientationObserver(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvGetCurrentScreenOrientation(ScreenOrientation* aScreenOrientation) {
|
||||
hal::GetCurrentScreenOrientation(aScreenOrientation);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Notify(const ScreenOrientationWrapper& aScreenOrientation) {
|
||||
unused << SendNotifyScreenOrientationChange(aScreenOrientation.orientation);
|
||||
}
|
||||
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvGetScreenEnabled(bool *enabled)
|
||||
{
|
||||
|
@ -427,6 +469,12 @@ public:
|
|||
hal::NotifyWakeLockChange(aWakeLockInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_OVERRIDE virtual bool
|
||||
RecvNotifyScreenOrientationChange(const ScreenOrientation& aScreenOrientation) {
|
||||
hal::NotifyScreenOrientationChange(aScreenOrientation);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
bool
|
||||
|
|
|
@ -430,8 +430,7 @@ static const JSClass sCPOW_NewEnumerateState_JSClass = {
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub,
|
||||
JS_ConvertStub, CPOW_NewEnumerateState_Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub, CPOW_NewEnumerateState_Finalize
|
||||
};
|
||||
|
||||
bool
|
||||
|
|
|
@ -72,8 +72,7 @@ void JSD_ASSERT_VALID_CONTEXT(JSDContext* jsdc)
|
|||
static JSClass global_class = {
|
||||
"JSDGlobal", JSCLASS_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
static JSBool
|
||||
|
|
|
@ -220,16 +220,14 @@ static JSClass sCTypesGlobalClass = {
|
|||
"ctypes",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(CTYPESGLOBAL_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
static JSClass sCABIClass = {
|
||||
"CABI",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(CABI_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
// Class representing ctypes.{C,Pointer,Array,Struct,Function}Type.prototype.
|
||||
|
@ -249,8 +247,7 @@ static JSClass sCDataProtoClass = {
|
|||
"CData",
|
||||
0,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
static JSClass sCTypeClass = {
|
||||
|
@ -393,32 +390,28 @@ static JSClass sInt64ProtoClass = {
|
|||
"Int64",
|
||||
0,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
static JSClass sUInt64ProtoClass = {
|
||||
"UInt64",
|
||||
0,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
static JSClass sInt64Class = {
|
||||
"Int64",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize
|
||||
};
|
||||
|
||||
static JSClass sUInt64Class = {
|
||||
"UInt64",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize
|
||||
};
|
||||
|
||||
static JSFunctionSpec sInt64StaticFunctions[] = {
|
||||
|
|
|
@ -67,8 +67,7 @@ static JSClass sLibraryClass = {
|
|||
"Library",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(LIBRARY_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub,JS_ResolveStub, JS_ConvertStub, Library::Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub,JS_ResolveStub, JS_ConvertStub, Library::Finalize
|
||||
};
|
||||
|
||||
#define CTYPESFN_FLAGS \
|
||||
|
|
|
@ -13,9 +13,7 @@ JSClass global_class = {
|
|||
JS_StrictPropertyStub,
|
||||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
JS::Anchor<JSObject *> trusted_glob, trusted_fun;
|
||||
|
|
|
@ -35,9 +35,7 @@ static JSClass ptestClass = {
|
|||
JS_StrictPropertyStub, // set
|
||||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
static JSBool test_fn(JSContext *cx, unsigned argc, jsval *vp)
|
||||
|
|
|
@ -59,8 +59,7 @@ document_resolve(JSContext *cx, JSObject *obj, jsid id, unsigned flags, JSObject
|
|||
static JSClass document_class = {
|
||||
"document", JSCLASS_NEW_RESOLVE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, (JSResolveOp) document_resolve, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, (JSResolveOp) document_resolve, JS_ConvertStub
|
||||
};
|
||||
|
||||
BEGIN_TEST(testLookup_bug570195)
|
||||
|
|
|
@ -18,8 +18,7 @@ static JSClass myClass = {
|
|||
"MyClass",
|
||||
0,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, my_convert, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, my_convert
|
||||
};
|
||||
|
||||
static JSBool
|
||||
|
|
|
@ -17,8 +17,7 @@ static JSClass CounterClass = {
|
|||
"Counter", /* name */
|
||||
0, /* flags */
|
||||
CounterAdd, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
BEGIN_TEST(testPropCache_bug505798)
|
||||
|
|
|
@ -21,9 +21,7 @@ BEGIN_TEST(testResolveRecursion)
|
|||
JS_StrictPropertyStub, // set
|
||||
JS_EnumerateStub,
|
||||
(JSResolveOp) my_resolve,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
obj1 = JS_NewObject(cx, &my_resolve_class, NULL, NULL);
|
||||
|
|
|
@ -305,8 +305,7 @@ class JSAPITest
|
|||
static JSClass c = {
|
||||
"global", JSCLASS_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
return &c;
|
||||
}
|
||||
|
|
|
@ -3087,10 +3087,6 @@ JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
|||
return DefaultValue(cx, obj, type, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_FinalizeStub(JSContext *cx, JSObject *obj)
|
||||
{}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
|
||||
JSClass *clasp, JSNative constructor, unsigned nargs,
|
||||
|
|
|
@ -3609,9 +3609,6 @@ JS_ResolveStub(JSContext *cx, JSObject *obj, jsid id);
|
|||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_FinalizeStub(JSContext *cx, JSObject *obj);
|
||||
|
||||
struct JSConstDoubleSpec {
|
||||
double dval;
|
||||
const char *name;
|
||||
|
|
|
@ -274,7 +274,11 @@ ArrayBuffer::create(JSContext *cx, int32_t nbytes, uint8_t *contents)
|
|||
JSObject *obj = NewBuiltinClassInstance(cx, &ArrayBuffer::slowClass);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
#ifdef JS_THREADSAFE
|
||||
JS_ASSERT(obj->getAllocKind() == gc::FINALIZE_OBJECT16_BACKGROUND);
|
||||
#else
|
||||
JS_ASSERT(obj->getAllocKind() == gc::FINALIZE_OBJECT16);
|
||||
#endif
|
||||
|
||||
if (nbytes < 0) {
|
||||
/*
|
||||
|
@ -1439,7 +1443,11 @@ class TypedArrayTemplate
|
|||
JSObject *obj = NewBuiltinClassInstance(cx, slowClass());
|
||||
if (!obj)
|
||||
return NULL;
|
||||
#ifdef JS_THREADSAFE
|
||||
JS_ASSERT(obj->getAllocKind() == gc::FINALIZE_OBJECT8_BACKGROUND);
|
||||
#else
|
||||
JS_ASSERT(obj->getAllocKind() == gc::FINALIZE_OBJECT8);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Specialize the type of the object on the current scripted location,
|
||||
|
@ -2176,8 +2184,7 @@ Class ArrayBuffer::slowClass = {
|
|||
JS_StrictPropertyStub, /* setProperty */
|
||||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
Class js::ArrayBufferClass = {
|
||||
|
@ -2292,8 +2299,7 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \
|
|||
JS_StrictPropertyStub, /* setProperty */ \
|
||||
JS_EnumerateStub, \
|
||||
JS_ResolveStub, \
|
||||
JS_ConvertStub, \
|
||||
JS_FinalizeStub \
|
||||
JS_ConvertStub \
|
||||
}
|
||||
|
||||
#define IMPL_TYPED_ARRAY_FAST_CLASS(_typedArray) \
|
||||
|
|
|
@ -232,12 +232,12 @@ JS_FRIEND_DATA(Class) js::NamespaceClass = {
|
|||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* mark */
|
||||
NULL, /* trace */
|
||||
{
|
||||
namespace_equality,
|
||||
NULL, /* outerObject */
|
||||
|
@ -346,12 +346,12 @@ JS_FRIEND_DATA(Class) js::QNameClass = {
|
|||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* mark */
|
||||
NULL, /* trace */
|
||||
{
|
||||
qname_equality,
|
||||
NULL, /* outerObject */
|
||||
|
@ -377,8 +377,7 @@ JS_FRIEND_DATA(Class) js::AttributeNameClass = {
|
|||
JS_StrictPropertyStub, /* setProperty */
|
||||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
JS_FRIEND_DATA(Class) js::AnyNameClass = {
|
||||
|
@ -391,8 +390,7 @@ JS_FRIEND_DATA(Class) js::AnyNameClass = {
|
|||
JS_StrictPropertyStub, /* setProperty */
|
||||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
#define QNAME_ATTRS (JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_SHARED)
|
||||
|
@ -4721,11 +4719,6 @@ HasProperty(JSContext *cx, JSObject *obj, jsval id, JSBool *found)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
xml_finalize(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* XML objects are native. Thus xml_lookupGeneric must return a valid
|
||||
* Shape pointer parameter via *propp to signify "property found". Since the
|
||||
|
@ -5376,10 +5369,10 @@ JS_FRIEND_DATA(Class) js::XMLClass = {
|
|||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
xml_convert,
|
||||
xml_finalize,
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* finalize */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
xml_hasInstance,
|
||||
xml_trace,
|
||||
JS_NULL_CLASS_EXT,
|
||||
|
|
|
@ -219,8 +219,7 @@ static const struct pm_const {
|
|||
static JSClass pm_class = {
|
||||
"PerfMeasurement", JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, pm_finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, pm_finalize
|
||||
};
|
||||
|
||||
// Helpers (declared above)
|
||||
|
|
|
@ -2594,8 +2594,7 @@ static JSClass sandbox_class = {
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
sandbox_enumerate, (JSResolveOp)sandbox_resolve,
|
||||
JS_ConvertStub, NULL,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
static JSObject *
|
||||
|
@ -2855,8 +2854,7 @@ static JSClass resolver_class = {
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
resolver_enumerate, (JSResolveOp)resolver_resolve,
|
||||
JS_ConvertStub, NULL,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
|
||||
|
@ -3280,8 +3278,7 @@ Compile(JSContext *cx, unsigned argc, jsval *vp)
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub,
|
||||
JS_ConvertStub, NULL,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
JSObject *fakeGlobal = JS_NewGlobalObject(cx, &dummy_class);
|
||||
|
@ -4112,8 +4109,7 @@ static JSClass its_class = {
|
|||
"It", JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE | JSCLASS_HAS_PRIVATE,
|
||||
its_addProperty, its_delProperty, its_getProperty, its_setProperty,
|
||||
(JSEnumerateOp)its_enumerate, (JSResolveOp)its_resolve,
|
||||
its_convert, its_finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
its_convert, its_finalize
|
||||
};
|
||||
|
||||
static JSBool
|
||||
|
@ -4406,8 +4402,7 @@ JSClass global_class = {
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
global_enumerate, (JSResolveOp) global_resolve,
|
||||
JS_ConvertStub, its_finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub, its_finalize
|
||||
};
|
||||
|
||||
static JSBool
|
||||
|
@ -4520,8 +4515,7 @@ static JSClass env_class = {
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, env_setProperty,
|
||||
env_enumerate, (JSResolveOp) env_resolve,
|
||||
JS_ConvertStub, NULL,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_ConvertStub
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -121,6 +121,10 @@ DEFINES += \
|
|||
-DNO_NSPR_10_SUPPORT \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_JSDEBUGGER
|
||||
DEFINES += -DMOZ_JSDEBUGGER
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifndef GNU_CXX
|
||||
ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
|
||||
|
|
|
@ -175,8 +175,7 @@ static JSClass
|
|||
PointerHolderClass = {
|
||||
"Pointer", JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, PointerFinalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, PointerFinalize
|
||||
};
|
||||
|
||||
template<typename Op>
|
||||
|
|
|
@ -452,10 +452,10 @@ listTemplate = (
|
|||
" JS_EnumerateStub,\n"
|
||||
" JS_ResolveStub,\n"
|
||||
" JS_ConvertStub,\n"
|
||||
" JS_FinalizeStub,\n"
|
||||
" NULL, /* finalize */\n"
|
||||
" NULL, /* checkAccess */\n"
|
||||
" NULL, /* call */\n"
|
||||
" NULL, /* construct */\n"
|
||||
" NULL, /* call */\n"
|
||||
" NULL, /* construct */\n"
|
||||
" interface_hasInstance\n"
|
||||
"};\n"
|
||||
"\n")
|
||||
|
|
|
@ -63,7 +63,9 @@
|
|||
#include "WrapperFactory.h"
|
||||
#include "AccessCheck.h"
|
||||
|
||||
#ifdef MOZ_JSDEBUGGER
|
||||
#include "jsdIDebuggerService.h"
|
||||
#endif
|
||||
|
||||
#include "XPCQuickStubs.h"
|
||||
#include "dombindings.h"
|
||||
|
@ -2443,8 +2445,10 @@ nsXPConnect::Peek(JSContext * *_retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_JSDEBUGGER
|
||||
void
|
||||
nsXPConnect::CheckForDebugMode(JSRuntime *rt) {
|
||||
nsXPConnect::CheckForDebugMode(JSRuntime *rt)
|
||||
{
|
||||
JSContext *cx = NULL;
|
||||
|
||||
if (gDebugMode == gDesiredDebugMode) {
|
||||
|
@ -2511,6 +2515,14 @@ fail:
|
|||
JS_SetRuntimeDebugMode(rt, false);
|
||||
gDesiredDebugMode = gDebugMode = false;
|
||||
}
|
||||
#else //MOZ_JSDEBUGGER not defined
|
||||
void
|
||||
nsXPConnect::CheckForDebugMode(JSRuntime *rt)
|
||||
{
|
||||
gDesiredDebugMode = gDebugMode = false;
|
||||
}
|
||||
#endif //#ifdef MOZ_JSDEBUGGER
|
||||
|
||||
|
||||
NS_EXPORT_(void)
|
||||
xpc_ActivateDebugMode()
|
||||
|
|
|
@ -109,8 +109,7 @@ JSClass HolderClass = {
|
|||
"NativePropertyHolder",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(3),
|
||||
JS_PropertyStub, JS_PropertyStub, holder_get, holder_set,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
|
||||
function boom()
|
||||
{
|
||||
var a = document.getElementById("a");
|
||||
var b = document.getElementById("b");
|
||||
a.insertBefore(b, a.firstChild);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="boom();"><span id="a"><div></div></span><span id="b"><span style="display: none;"></span><span style="display: none;"></span></span></body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<script>
|
||||
function boom()
|
||||
{
|
||||
var a = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
|
||||
var b = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
|
||||
var x = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
|
||||
var y = document.createElementNS("http://www.w3.org/1999/xhtml", "basefont");
|
||||
var z = document.createElementNS("http://www.w3.org/1999/xhtml", "body");
|
||||
z.setAttributeNS(null, "link", "#333333");
|
||||
|
||||
document.documentElement.appendChild(a);
|
||||
b.appendChild(x);
|
||||
b.appendChild(y);
|
||||
document.documentElement.offsetHeight;
|
||||
a.appendChild(b);
|
||||
document.documentElement.offsetHeight;
|
||||
document.createElementNS("http://www.w3.org/1999/xhtml", "div").appendChild(y);
|
||||
b.appendChild(z);
|
||||
}
|
||||
</script>
|
||||
<body onload="boom();"></body>
|
|
@ -299,6 +299,7 @@ load 536720.xul
|
|||
load 537059-1.xhtml
|
||||
load 537141-1.xhtml
|
||||
load 537562-1.xhtml
|
||||
load 537624-1.html
|
||||
load 537631-1.html
|
||||
load 538082-1.xul
|
||||
load 538207-1.xhtml
|
||||
|
@ -352,3 +353,4 @@ load 722137.html
|
|||
load 725535.html
|
||||
load 727601.html
|
||||
load 736389-1.xhtml
|
||||
load 736924-1.html
|
||||
|
|
|
@ -86,12 +86,14 @@ struct BidiParagraphData {
|
|||
nsAutoPtr<nsBidi> mBidiEngine;
|
||||
nsIFrame* mPrevFrame;
|
||||
nsAutoPtr<BidiParagraphData> mSubParagraph;
|
||||
PRUint8 mParagraphDepth;
|
||||
|
||||
void Init(nsBlockFrame *aBlockFrame)
|
||||
{
|
||||
mContentToFrameIndex.Init();
|
||||
mBidiEngine = new nsBidi();
|
||||
mPrevContent = nsnull;
|
||||
mParagraphDepth = 0;
|
||||
|
||||
bool styleDirectionIsRTL =
|
||||
(NS_STYLE_DIRECTION_RTL == aBlockFrame->GetStyleVisibility()->mDirection);
|
||||
|
@ -149,19 +151,10 @@ struct BidiParagraphData {
|
|||
mBidiEngine = new nsBidi();
|
||||
mPrevContent = nsnull;
|
||||
mIsVisual = aBpd->mIsVisual;
|
||||
mParaLevel = aBpd->mParaLevel;
|
||||
|
||||
// If the containing paragraph has a level of NSBIDI_DEFAULT_LTR, set
|
||||
// the sub-paragraph to NSBIDI_LTR (we can't use GetParaLevel to find the
|
||||
// resolved paragraph level, because the containing paragraph hasn't yet
|
||||
// been through bidi resolution
|
||||
if (mParaLevel == NSBIDI_DEFAULT_LTR) {
|
||||
mParaLevel = NSBIDI_LTR;
|
||||
}
|
||||
mReset = false;
|
||||
}
|
||||
|
||||
void Reset(nsIFrame* aFrame, BidiParagraphData *aBpd)
|
||||
void Reset(nsIFrame* aBDIFrame, BidiParagraphData *aBpd)
|
||||
{
|
||||
mReset = true;
|
||||
mLogicalFrames.Clear();
|
||||
|
@ -169,37 +162,15 @@ struct BidiParagraphData {
|
|||
mContentToFrameIndex.Clear();
|
||||
mBuffer.SetLength(0);
|
||||
mPrevFrame = aBpd->mPrevFrame;
|
||||
// We need to copy in embeddings (but not overrides!) from the containing
|
||||
// paragraph so that the line(s) including this sub-paragraph will be
|
||||
// correctly reordered.
|
||||
for (PRUint32 i = 0; i < aBpd->mEmbeddingStack.Length(); ++i) {
|
||||
switch(aBpd->mEmbeddingStack[i]) {
|
||||
case kRLE:
|
||||
case kRLO:
|
||||
mParaLevel = NextOddLevel(mParaLevel);
|
||||
break;
|
||||
mParagraphDepth = aBpd->mParagraphDepth + 1;
|
||||
|
||||
case kLRE:
|
||||
case kLRO:
|
||||
mParaLevel = NextEvenLevel(mParaLevel);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* container = aFrame->GetParent();
|
||||
bool isRTL = (NS_STYLE_DIRECTION_RTL ==
|
||||
container->GetStyleVisibility()->mDirection);
|
||||
if ((isRTL & 1) != (mParaLevel & 1)) {
|
||||
mParaLevel = isRTL ? NextOddLevel(mParaLevel) : NextEvenLevel(mParaLevel);
|
||||
}
|
||||
aBDIFrame->GetStyleVisibility()->mDirection);
|
||||
mParaLevel = mParagraphDepth * 2;
|
||||
if (isRTL) ++mParaLevel;
|
||||
|
||||
if (container->GetStyleTextReset()->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_OVERRIDE) {
|
||||
if (aBDIFrame->GetStyleTextReset()->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_OVERRIDE) {
|
||||
PushBidiControl(isRTL ? kRLO : kLRO);
|
||||
} else {
|
||||
PushBidiControl(isRTL ? kRLE : kLRE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,16 +304,6 @@ struct BidiParagraphData {
|
|||
}
|
||||
}
|
||||
|
||||
nsBidiLevel NextOddLevel(nsBidiLevel aLevel)
|
||||
{
|
||||
return (aLevel + 1) | 1;
|
||||
}
|
||||
|
||||
nsBidiLevel NextEvenLevel(nsBidiLevel aLevel)
|
||||
{
|
||||
return (aLevel + 2) & ~1;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsFrameInCurrentLine(nsBlockInFlowLineIterator* aLineIter,
|
||||
nsIFrame* aPrevFrame, nsIFrame* aFrame)
|
||||
|
@ -453,13 +414,23 @@ IsBidiSplittable(nsIFrame* aFrame) {
|
|||
&& frameType != nsGkAtoms::lineFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create non-fluid continuations for the ancestors of a given frame all the way
|
||||
* up the frame tree until we hit a non-splittable frame (a line or a block).
|
||||
*
|
||||
* @param aParent the first parent frame to be split
|
||||
* @param aFrame the child frames after this frame are reparented to the
|
||||
* newly-created continuation of aParent.
|
||||
* If aFrame is null, all the children of aParent are reparented.
|
||||
*/
|
||||
static nsresult
|
||||
SplitInlineAncestors(nsIFrame* aFrame)
|
||||
SplitInlineAncestors(nsIFrame* aParent,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
nsPresContext *presContext = aFrame->PresContext();
|
||||
nsPresContext *presContext = aParent->PresContext();
|
||||
nsIPresShell *presShell = presContext->PresShell();
|
||||
nsIFrame* frame = aFrame;
|
||||
nsIFrame* parent = aFrame->GetParent();
|
||||
nsIFrame* parent = aParent;
|
||||
nsIFrame* newParent;
|
||||
|
||||
while (IsBidiSplittable(parent)) {
|
||||
|
@ -472,21 +443,24 @@ SplitInlineAncestors(nsIFrame* aFrame)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// Split the child list after |frame|.
|
||||
nsContainerFrame* container = do_QueryFrame(parent);
|
||||
nsFrameList tail = container->StealFramesAfter(frame);
|
||||
// Split the child list after |frame|, unless it is the last child.
|
||||
if (!frame || frame->GetNextSibling()) {
|
||||
nsContainerFrame* container = do_QueryFrame(parent);
|
||||
nsFrameList tail = container->StealFramesAfter(frame);
|
||||
|
||||
// Reparent views as necessary
|
||||
rv = nsContainerFrame::ReparentFrameViewList(presContext, tail, parent, newParent);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
// Reparent views as necessary
|
||||
rv = nsContainerFrame::ReparentFrameViewList(presContext, tail, parent, newParent);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// The parent's continuation adopts the siblings after the split.
|
||||
rv = newParent->InsertFrames(nsIFrame::kNoReflowPrincipalList, nsnull, tail);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// The parent's continuation adopts the siblings after the split.
|
||||
rv = newParent->InsertFrames(nsIFrame::kNoReflowPrincipalList, nsnull, tail);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
// The list name kNoReflowPrincipalList would indicate we don't want reflow
|
||||
nsFrameList temp(newParent, newParent);
|
||||
rv = grandparent->InsertFrames(nsIFrame::kNoReflowPrincipalList, parent, temp);
|
||||
|
@ -525,7 +499,12 @@ JoinInlineAncestors(nsIFrame* aFrame)
|
|||
while (frame && IsBidiSplittable(frame)) {
|
||||
nsIFrame* next = frame->GetNextContinuation();
|
||||
if (next) {
|
||||
MakeContinuationFluid(frame, next);
|
||||
// Don't join frames if they come from different paragraph depths (i.e.
|
||||
// one is bidi isolated relative to the other
|
||||
if (nsBidiPresUtils::GetParagraphDepth(frame) ==
|
||||
nsBidiPresUtils::GetParagraphDepth(next)) {
|
||||
MakeContinuationFluid(frame, next);
|
||||
}
|
||||
}
|
||||
// Join the parent only as long as we're its last child.
|
||||
if (frame->GetNextSibling())
|
||||
|
@ -580,7 +559,7 @@ CreateContinuation(nsIFrame* aFrame,
|
|||
|
||||
if (!aIsFluid) {
|
||||
// Split inline ancestor frames
|
||||
rv = SplitInlineAncestors(aFrame);
|
||||
rv = SplitInlineAncestors(parent, aFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -705,6 +684,9 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
nsIFrame* firstFrame = nsnull;
|
||||
nsIFrame* lastFrame = nsnull;
|
||||
|
||||
for (; ;) {
|
||||
if (fragmentLength <= 0) {
|
||||
// Get the next frame from mLogicalFrames
|
||||
|
@ -722,6 +704,10 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||
fragmentLength = 1;
|
||||
}
|
||||
else {
|
||||
if (!firstFrame) {
|
||||
firstFrame = frame;
|
||||
}
|
||||
lastFrame = frame;
|
||||
currentLine = aBpd->GetLineForFrameAt(frameIndex);
|
||||
content = frame->GetContent();
|
||||
if (!content) {
|
||||
|
@ -737,6 +723,8 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||
NS_INT32_TO_PTR(embeddingLevel));
|
||||
propTable->Set(frame, nsIFrame::BaseLevelProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->GetParaLevel()));
|
||||
propTable->Set(frame, nsIFrame::ParagraphDepthProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->mParagraphDepth));
|
||||
continue;
|
||||
}
|
||||
PRInt32 start, end;
|
||||
|
@ -771,6 +759,8 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||
NS_INT32_TO_PTR(embeddingLevel));
|
||||
propTable->Set(frame, nsIFrame::BaseLevelProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->GetParaLevel()));
|
||||
propTable->Set(frame, nsIFrame::ParagraphDepthProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->mParagraphDepth));
|
||||
if (isTextFrame) {
|
||||
if ( (runLength > 0) && (runLength < fragmentLength) ) {
|
||||
/*
|
||||
|
@ -788,7 +778,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||
}
|
||||
nextBidi->AdjustOffsetsForBidi(runEnd,
|
||||
contentOffset + fragmentLength);
|
||||
frame = nextBidi;
|
||||
lastFrame = frame = nextBidi;
|
||||
contentOffset = runEnd;
|
||||
} // if (runLength < fragmentLength)
|
||||
else {
|
||||
|
@ -870,8 +860,9 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||
child = parent;
|
||||
parent = child->GetParent();
|
||||
}
|
||||
if (parent && IsBidiSplittable(parent))
|
||||
SplitInlineAncestors(child);
|
||||
if (parent && IsBidiSplittable(parent)) {
|
||||
SplitInlineAncestors(parent, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -883,6 +874,31 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
|||
}
|
||||
} // for
|
||||
|
||||
if (aBpd->mParagraphDepth > 1) {
|
||||
nsIFrame* child;
|
||||
nsIFrame* parent;
|
||||
if (firstFrame) {
|
||||
child = firstFrame->GetParent();
|
||||
if (child) {
|
||||
parent = child->GetParent();
|
||||
if (parent && IsBidiSplittable(parent)) {
|
||||
// no need to null-check the result of GetPrevSibling, because
|
||||
// SplitInlineAncestors accepts a null parameter
|
||||
SplitInlineAncestors(parent, child->GetPrevSibling());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lastFrame) {
|
||||
child = lastFrame->GetParent();
|
||||
if (child) {
|
||||
parent = child->GetParent();
|
||||
if (parent && IsBidiSplittable(parent)) {
|
||||
SplitInlineAncestors(parent, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef REALLY_NOISY_BIDI
|
||||
printf("---\nAfter Resolve(), frameTree =:\n");
|
||||
|
@ -1122,7 +1138,7 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
|||
*/
|
||||
bool isLastContinuation = !frame->GetNextContinuation();
|
||||
if (!frame->GetPrevContinuation() || !subParagraph->mReset) {
|
||||
subParagraph->Reset(kid, aBpd);
|
||||
subParagraph->Reset(frame, aBpd);
|
||||
}
|
||||
TraverseFrames(aBlockFrame, aLineIter, kid, subParagraph);
|
||||
if (isLastContinuation) {
|
||||
|
@ -1177,8 +1193,8 @@ nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
|
|||
RepositionInlineFrames(&bld, aFirstFrameOnLine);
|
||||
}
|
||||
|
||||
nsBidiLevel
|
||||
nsBidiPresUtils::GetFrameEmbeddingLevel(nsIFrame* aFrame)
|
||||
nsIFrame*
|
||||
nsBidiPresUtils::GetFirstLeaf(nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame* firstLeaf = aFrame;
|
||||
while (!IsBidiLeaf(firstLeaf)) {
|
||||
|
@ -1187,9 +1203,22 @@ nsBidiPresUtils::GetFrameEmbeddingLevel(nsIFrame* aFrame)
|
|||
firstLeaf = (realFrame->GetType() == nsGkAtoms::letterFrame) ?
|
||||
realFrame : firstChild;
|
||||
}
|
||||
return NS_GET_EMBEDDING_LEVEL(firstLeaf);
|
||||
return firstLeaf;
|
||||
}
|
||||
|
||||
nsBidiLevel
|
||||
nsBidiPresUtils::GetFrameEmbeddingLevel(nsIFrame* aFrame)
|
||||
{
|
||||
return NS_GET_EMBEDDING_LEVEL(nsBidiPresUtils::GetFirstLeaf(aFrame));
|
||||
}
|
||||
|
||||
PRUint8
|
||||
nsBidiPresUtils::GetParagraphDepth(nsIFrame* aFrame)
|
||||
{
|
||||
return NS_GET_PARAGRAPH_DEPTH(nsBidiPresUtils::GetFirstLeaf(aFrame));
|
||||
}
|
||||
|
||||
|
||||
nsBidiLevel
|
||||
nsBidiPresUtils::GetFrameBaseLevel(nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -1528,6 +1557,8 @@ nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData *aBpd,
|
|||
(nsBidiLevel)NS_PTR_TO_INT32(props.Get(nsIFrame::EmbeddingLevelProperty()));
|
||||
nsBidiLevel baseLevel =
|
||||
(nsBidiLevel)NS_PTR_TO_INT32(props.Get(nsIFrame::BaseLevelProperty()));
|
||||
PRUint8 paragraphDepth =
|
||||
NS_PTR_TO_INT32(props.Get(nsIFrame::ParagraphDepthProperty()));
|
||||
|
||||
for (PRInt32 index = aFirstIndex + 1; index <= aLastIndex; index++) {
|
||||
nsIFrame* frame = aBpd->FrameAt(index);
|
||||
|
@ -1542,6 +1573,8 @@ nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData *aBpd,
|
|||
NS_INT32_TO_PTR(embeddingLevel));
|
||||
frameProps.Set(nsIFrame::BaseLevelProperty(),
|
||||
NS_INT32_TO_PTR(baseLevel));
|
||||
frameProps.Set(nsIFrame::ParagraphDepthProperty(),
|
||||
NS_INT32_TO_PTR(paragraphDepth));
|
||||
frame->AddStateBits(NS_FRAME_IS_BIDI);
|
||||
while (frame) {
|
||||
nsIFrame* prev = frame->GetPrevContinuation();
|
||||
|
|
|
@ -283,11 +283,18 @@ public:
|
|||
static nsIFrame* GetFrameToLeftOf(const nsIFrame* aFrame,
|
||||
nsIFrame* aFirstFrameOnLine,
|
||||
PRInt32 aNumFramesOnLine);
|
||||
|
||||
static nsIFrame* GetFirstLeaf(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the bidi embedding level of the given (inline) frame.
|
||||
*/
|
||||
static nsBidiLevel GetFrameEmbeddingLevel(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the paragraph depth of the given (inline) frame.
|
||||
*/
|
||||
static PRUint8 GetParagraphDepth(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the bidi base level of the given (inline) frame.
|
||||
|
|
|
@ -4933,6 +4933,7 @@ nsCSSFrameConstructor::ConstructFrame(nsFrameConstructorState& aState,
|
|||
NS_PRECONDITION(nsnull != aParentFrame, "no parent frame");
|
||||
FrameConstructionItemList items;
|
||||
AddFrameConstructionItems(aState, aContent, true, aParentFrame, items);
|
||||
items.SetTriedConstructingFrames();
|
||||
|
||||
for (FCItemIterator iter(items); !iter.IsDone(); iter.Next()) {
|
||||
NS_ASSERTION(iter.item().DesiredParentType() == GetParentType(aParentFrame),
|
||||
|
@ -4995,16 +4996,11 @@ nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState
|
|||
aItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set aContent as undisplayed content with style context aStyleContext. This
|
||||
* method enforces the invariant that all style contexts in the undisplayed
|
||||
* content map must be non-pseudo contexts and also handles unbinding
|
||||
* undisplayed generated content as needed.
|
||||
*/
|
||||
static void
|
||||
SetAsUndisplayedContent(nsFrameManager* aFrameManager, nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
bool aIsGeneratedContent)
|
||||
/* static */ void
|
||||
nsCSSFrameConstructor::SetAsUndisplayedContent(FrameConstructionItemList& aList,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
bool aIsGeneratedContent)
|
||||
{
|
||||
if (aStyleContext->GetPseudo()) {
|
||||
if (aIsGeneratedContent) {
|
||||
|
@ -5014,7 +5010,7 @@ SetAsUndisplayedContent(nsFrameManager* aFrameManager, nsIContent* aContent,
|
|||
}
|
||||
|
||||
NS_ASSERTION(!aIsGeneratedContent, "Should have had pseudo type");
|
||||
aFrameManager->SetUndisplayedContent(aContent, aStyleContext);
|
||||
aList.AppendUndisplayedItem(aContent, aStyleContext);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5079,7 +5075,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
// Pre-check for display "none" - if we find that, don't create
|
||||
// any frame at all
|
||||
if (NS_STYLE_DISPLAY_NONE == display->mDisplay) {
|
||||
SetAsUndisplayedContent(this, aContent, styleContext, isGeneratedContent);
|
||||
SetAsUndisplayedContent(aItems, aContent, styleContext, isGeneratedContent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5103,7 +5099,8 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
!aContent->IsRootOfNativeAnonymousSubtree()) {
|
||||
// No frame for aContent
|
||||
if (!isText) {
|
||||
SetAsUndisplayedContent(this, aContent, styleContext, isGeneratedContent);
|
||||
SetAsUndisplayedContent(aItems, aContent, styleContext,
|
||||
isGeneratedContent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -5127,7 +5124,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
aParentFrame->IsFrameOfType(nsIFrame::eSVG) &&
|
||||
!aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
|
||||
) {
|
||||
SetAsUndisplayedContent(this, element, styleContext,
|
||||
SetAsUndisplayedContent(aItems, element, styleContext,
|
||||
isGeneratedContent);
|
||||
return;
|
||||
}
|
||||
|
@ -5158,7 +5155,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
NS_ASSERTION(data, "Should have frame construction data now");
|
||||
|
||||
if (data->mBits & FCDATA_SUPPRESS_FRAME) {
|
||||
SetAsUndisplayedContent(this, element, styleContext, isGeneratedContent);
|
||||
SetAsUndisplayedContent(aItems, element, styleContext, isGeneratedContent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5168,7 +5165,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
aParentFrame->GetType() != nsGkAtoms::menuFrame)) {
|
||||
if (!aState.mPopupItems.containingBlock &&
|
||||
!aState.mHavePendingPopupgroup) {
|
||||
SetAsUndisplayedContent(this, element, styleContext,
|
||||
SetAsUndisplayedContent(aItems, element, styleContext,
|
||||
isGeneratedContent);
|
||||
return;
|
||||
}
|
||||
|
@ -5185,7 +5182,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
aParentFrame->GetType() == nsGkAtoms::tableColGroupFrame &&
|
||||
(!(bits & FCDATA_IS_TABLE_PART) ||
|
||||
display->mDisplay != NS_STYLE_DISPLAY_TABLE_COLUMN)) {
|
||||
SetAsUndisplayedContent(this, aContent, styleContext, isGeneratedContent);
|
||||
SetAsUndisplayedContent(aItems, aContent, styleContext, isGeneratedContent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8717,6 +8714,7 @@ nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
|
|||
ITEM_ALLOW_XBL_BASE |
|
||||
ITEM_ALLOW_PAGE_BREAK,
|
||||
items);
|
||||
items.SetTriedConstructingFrames();
|
||||
for (FCItemIterator iter(items); !iter.IsDone(); iter.Next()) {
|
||||
NS_ASSERTION(iter.item().DesiredParentType() ==
|
||||
GetParentType(canvasFrame),
|
||||
|
@ -9442,6 +9440,8 @@ nsCSSFrameConstructor::ConstructFramesFromItemList(nsFrameConstructorState& aSta
|
|||
nsIFrame* aParentFrame,
|
||||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
aItems.SetTriedConstructingFrames();
|
||||
|
||||
nsresult rv = CreateNeededTablePseudos(aState, aItems, aParentFrame);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -11832,7 +11832,10 @@ Iterator::AppendItemsToList(const Iterator& aEnd,
|
|||
NS_ASSERTION(&aTargetList != &mList, "Unexpected call");
|
||||
NS_PRECONDITION(mEnd == aEnd.mEnd, "end iterator for some other list?");
|
||||
|
||||
if (!AtStart() || !aEnd.IsDone() || !aTargetList.IsEmpty()) {
|
||||
// We can't just move our guts to the other list if it already has
|
||||
// some information or if we're not moving our entire list.
|
||||
if (!AtStart() || !aEnd.IsDone() || !aTargetList.IsEmpty() ||
|
||||
!aTargetList.mUndisplayedItems.IsEmpty()) {
|
||||
do {
|
||||
AppendItemToList(aTargetList);
|
||||
} while (*this != aEnd);
|
||||
|
@ -11841,7 +11844,8 @@ Iterator::AppendItemsToList(const Iterator& aEnd,
|
|||
|
||||
// move over the list of items
|
||||
PR_INSERT_AFTER(&aTargetList.mItems, &mList.mItems);
|
||||
PR_REMOVE_LINK(&mList.mItems);
|
||||
// Need to init when we remove to makd ~FrameConstructionItemList work right.
|
||||
PR_REMOVE_AND_INIT_LINK(&mList.mItems);
|
||||
|
||||
// Copy over the various counters
|
||||
aTargetList.mInlineCount = mList.mInlineCount;
|
||||
|
@ -11851,7 +11855,11 @@ Iterator::AppendItemsToList(const Iterator& aEnd,
|
|||
memcpy(aTargetList.mDesiredParentCounts, mList.mDesiredParentCounts,
|
||||
sizeof(aTargetList.mDesiredParentCounts));
|
||||
|
||||
// Swap out undisplayed item arrays, before we nuke the array on our end
|
||||
aTargetList.mUndisplayedItems.SwapElements(mList.mUndisplayedItems);
|
||||
|
||||
// reset mList
|
||||
mList.~FrameConstructionItemList();
|
||||
new (&mList) FrameConstructionItemList();
|
||||
|
||||
// Point ourselves to aEnd, as advertised
|
||||
|
|
|
@ -816,7 +816,8 @@ private:
|
|||
mItemCount(0),
|
||||
mLineBoundaryAtStart(false),
|
||||
mLineBoundaryAtEnd(false),
|
||||
mParentHasNoXBLChildren(false)
|
||||
mParentHasNoXBLChildren(false),
|
||||
mTriedConstructingFrames(false)
|
||||
{
|
||||
PR_INIT_CLIST(&mItems);
|
||||
memset(mDesiredParentCounts, 0, sizeof(mDesiredParentCounts));
|
||||
|
@ -832,6 +833,20 @@ private:
|
|||
|
||||
// Leaves our mItems pointing to deleted memory in both directions,
|
||||
// but that's OK at this point.
|
||||
|
||||
// Create the undisplayed entries for our mUndisplayedItems, if any, but
|
||||
// only if we have tried constructing frames for this item list. If we
|
||||
// haven't, then we're just throwing it away and will probably try again.
|
||||
if (!mUndisplayedItems.IsEmpty() && mTriedConstructingFrames) {
|
||||
// We could store the frame manager in a member, but just
|
||||
// getting it off the style context is not too bad.
|
||||
nsFrameManager *mgr =
|
||||
mUndisplayedItems[0].mStyleContext->PresContext()->FrameManager();
|
||||
for (PRUint32 i = 0; i < mUndisplayedItems.Length(); ++i) {
|
||||
UndisplayedItem& item = mUndisplayedItems[i];
|
||||
mgr->SetUndisplayedContent(item.mContent, item.mStyleContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetLineBoundaryAtStart(bool aBoundary) { mLineBoundaryAtStart = aBoundary; }
|
||||
|
@ -839,6 +854,7 @@ private:
|
|||
void SetParentHasNoXBLChildren(bool aHasNoXBLChildren) {
|
||||
mParentHasNoXBLChildren = aHasNoXBLChildren;
|
||||
}
|
||||
void SetTriedConstructingFrames() { mTriedConstructingFrames = true; }
|
||||
bool HasLineBoundaryAtStart() { return mLineBoundaryAtStart; }
|
||||
bool HasLineBoundaryAtEnd() { return mLineBoundaryAtEnd; }
|
||||
bool ParentHasNoXBLChildren() { return mParentHasNoXBLChildren; }
|
||||
|
@ -871,6 +887,11 @@ private:
|
|||
return item;
|
||||
}
|
||||
|
||||
void AppendUndisplayedItem(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext) {
|
||||
mUndisplayedItems.AppendElement(UndisplayedItem(aContent, aStyleContext));
|
||||
}
|
||||
|
||||
void InlineItemAdded() { ++mInlineCount; }
|
||||
void BlockItemAdded() { ++mBlockCount; }
|
||||
void LineParticipantItemAdded() { ++mLineParticipantCount; }
|
||||
|
@ -977,6 +998,15 @@ private:
|
|||
return static_cast<FrameConstructionItem*>(item);
|
||||
}
|
||||
|
||||
struct UndisplayedItem {
|
||||
UndisplayedItem(nsIContent* aContent, nsStyleContext* aStyleContext) :
|
||||
mContent(aContent), mStyleContext(aStyleContext)
|
||||
{}
|
||||
|
||||
nsIContent * const mContent;
|
||||
nsRefPtr<nsStyleContext> mStyleContext;
|
||||
};
|
||||
|
||||
// Adjust our various counts for aItem being added or removed. aDelta
|
||||
// should be either +1 or -1 depending on which is happening.
|
||||
void AdjustCountsForItem(FrameConstructionItem* aItem, PRInt32 aDelta);
|
||||
|
@ -995,6 +1025,10 @@ private:
|
|||
bool mLineBoundaryAtEnd;
|
||||
// True if the parent is guaranteed to have no XBL anonymous children
|
||||
bool mParentHasNoXBLChildren;
|
||||
// True if we have tried constructing frames from this list
|
||||
bool mTriedConstructingFrames;
|
||||
|
||||
nsTArray<UndisplayedItem> mUndisplayedItems;
|
||||
};
|
||||
|
||||
typedef FrameConstructionItemList::Iterator FCItemIterator;
|
||||
|
@ -1097,7 +1131,7 @@ private:
|
|||
FrameConstructionItemList mChildItems;
|
||||
|
||||
private:
|
||||
FrameConstructionItem(const FrameConstructionItem& aOther); /* not implemented */
|
||||
FrameConstructionItem(const FrameConstructionItem& aOther) MOZ_DELETE; /* not implemented */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1779,6 +1813,18 @@ private:
|
|||
mDocument->SetNeedLayoutFlush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the pair (aContent, aStyleContext) to the undisplayed items
|
||||
* in aList as needed. This method enforces the invariant that all
|
||||
* style contexts in the undisplayed content map must be non-pseudo
|
||||
* contexts and also handles unbinding undisplayed generated content
|
||||
* as needed.
|
||||
*/
|
||||
static void SetAsUndisplayedContent(FrameConstructionItemList& aList,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
bool aIsGeneratedContent);
|
||||
|
||||
public:
|
||||
|
||||
friend class nsFrameConstructorState;
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче