Merge last PGO-green changeset from mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2011-12-22 11:28:36 +00:00
commit e76decb5af
178 changed files with 3686 additions and 786 deletions

View File

@ -337,7 +337,7 @@ var Scratchpad = {
let contentWindow = this.gBrowser.selectedBrowser.contentWindow;
let scriptError = Cc["@mozilla.org/scripterror;1"].
createInstance(Ci.nsIScriptError2);
createInstance(Ci.nsIScriptError);
scriptError.initWithWindowID(ex.message + "\n" + ex.stack, ex.fileName,
"", ex.lineNumber, 0, scriptError.errorFlag,

View File

@ -6527,7 +6527,6 @@ HUDConsoleObserver = {
}
if (!(aSubject instanceof Ci.nsIScriptError) ||
!(aSubject instanceof Ci.nsIScriptError2) ||
!aSubject.outerWindowID) {
return;
}

View File

@ -21,8 +21,7 @@ let TestObserver = {
observe: function test_observe(aSubject)
{
if (!(aSubject instanceof Ci.nsIScriptError) ||
!(aSubject instanceof Ci.nsIScriptError2)) {
if (!(aSubject instanceof Ci.nsIScriptError)) {
return;
}

View File

@ -40,7 +40,7 @@
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
else
ifeq ($(MOZ_BUILD_APP),mobile)
ifeq ($(MOZ_BUILD_APP),mobile/xul)
PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
else
PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)

View File

@ -531,6 +531,7 @@ nl_types.h
NodeInfo.h
nss.h
nssilock.h
nsswitch.h
objbase.h
objidl.h
Objsafe.h
@ -750,6 +751,7 @@ sys/sysctl.h
sys/sysinfo.h
sys/sysmp.h
sys/syssgi.h
sys/system_properties.h
sys/systeminfo.h
sys/timeb.h
sys/time.h

View File

@ -44,6 +44,8 @@
#ifndef nsAttrAndChildArray_h___
#define nsAttrAndChildArray_h___
#include "mozilla/Attributes.h"
#include "nscore.h"
#include "nsAttrName.h"
#include "nsAttrValue.h"
@ -136,8 +138,8 @@ public:
PRInt64 SizeOf() const;
private:
nsAttrAndChildArray(const nsAttrAndChildArray& aOther); // Not to be implemented
nsAttrAndChildArray& operator=(const nsAttrAndChildArray& aOther); // Not to be implemented
nsAttrAndChildArray(const nsAttrAndChildArray& aOther) MOZ_DELETE;
nsAttrAndChildArray& operator=(const nsAttrAndChildArray& aOther) MOZ_DELETE;
void Clear();

View File

@ -2831,7 +2831,7 @@ nsContentUtils::ReportToConsole(PRUint32 aErrorFlags,
if (aURI)
aURI->GetSpec(spec);
nsCOMPtr<nsIScriptError2> errorObject =
nsCOMPtr<nsIScriptError> errorObject =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@ -2843,8 +2843,7 @@ nsContentUtils::ReportToConsole(PRUint32 aErrorFlags,
innerWindowID);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(errorObject);
return sConsoleService->LogMessage(logError);
return sConsoleService->LogMessage(errorObject);
}
bool

View File

@ -1091,7 +1091,7 @@ nsEventSource::PrintErrorOnConsole(const char *aBundleURI,
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptError2> errObj(
nsCOMPtr<nsIScriptError> errObj(
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@ -1106,16 +1106,16 @@ nsEventSource::PrintErrorOnConsole(const char *aBundleURI,
}
NS_ENSURE_SUCCESS(rv, rv);
errObj->InitWithWindowID(message.get(),
mScriptFile.get(),
nsnull,
mScriptLine, 0,
nsIScriptError::errorFlag,
"Event Source", mInnerWindowID);
rv = errObj->InitWithWindowID(message.get(),
mScriptFile.get(),
nsnull,
mScriptLine, 0,
nsIScriptError::errorFlag,
"Event Source", mInnerWindowID);
NS_ENSURE_SUCCESS(rv, rv);
// print the error message directly to the JS console
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(errObj);
rv = console->LogMessage(logError);
rv = console->LogMessage(errObj);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

View File

@ -127,7 +127,7 @@ nsWebSocket::PrintErrorOnConsole(const char *aBundleURI,
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptError2> errorObject(
nsCOMPtr<nsIScriptError> errorObject(
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@ -142,15 +142,15 @@ nsWebSocket::PrintErrorOnConsole(const char *aBundleURI,
}
NS_ENSURE_SUCCESS(rv, rv);
errorObject->InitWithWindowID(message.get(),
NS_ConvertUTF8toUTF16(mScriptFile).get(),
nsnull, mScriptLine, 0,
nsIScriptError::errorFlag, "Web Socket",
mInnerWindowID);
rv = errorObject->InitWithWindowID(message.get(),
NS_ConvertUTF8toUTF16(mScriptFile).get(),
nsnull, mScriptLine, 0,
nsIScriptError::errorFlag, "Web Socket",
mInnerWindowID);
NS_ENSURE_SUCCESS(rv, rv);
// print the error message directly to the JS console
nsCOMPtr<nsIScriptError> logError(do_QueryInterface(errorObject));
rv = console->LogMessage(logError);
rv = console->LogMessage(errorObject);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

View File

@ -4508,6 +4508,31 @@ nsEventStateManager::UpdateAncestorState(nsIContent* aStartNode,
DoStateChange(labelTarget, aState, aAddState);
}
}
if (aAddState) {
// We might be in a situation where a node was in hover both
// because it was hovered and because the label for it was
// hovered, and while we stopped hovering the node the label is
// still hovered. Or we might have had two nested labels for the
// same node, and while one is no longer hovered the other still
// is. In that situation, the label that's still hovered will be
// aStopBefore or some ancestor of it, and the call we just made
// to UpdateAncestorState with aAddState = false would have
// removed the hover state from the node. But the node should
// still be in hover state. To handle this situation we need to
// keep walking up the tree and any time we find a label mark its
// corresponding node as still in our state.
for ( ; aStartNode; aStartNode = aStartNode->GetParent()) {
if (!aStartNode->IsElement()) {
continue;
}
Element* labelTarget = GetLabelTarget(aStartNode->AsElement());
if (labelTarget && !labelTarget->State().HasState(aState)) {
DoStateChange(labelTarget, aState, true);
}
}
}
}
bool

View File

@ -9,15 +9,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=656379
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
button:hover { color: green; }
input[type="button"]:hover { color: green; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=656379">Mozilla Bug 656379</a>
<p id="display">
<label for="button1" id="label1">Label 1</label>
<button id="button1">Button 1</button>
<label><span id="label2">Label 2</span><button id="button2">Button 2</button></label>
<input type="button" id="button1" value="Button 1">
<label>
<span id="label2">Label 2</span>
<input type="button" id="button2" value="Button 2">
</label>
</p>
<div id="content" style="display: none">
@ -31,15 +34,33 @@ function tests() {
synthesizeMouseAtCenter($("label1"), { type: "mousemove" });
yield;
is($("button1").mozMatchesSelector(":hover"), true,
"Button 1 should be hovered");
"Button 1 should be hovered after mousemove over label1");
is($("label1").mozMatchesSelector(":hover"), true,
"Label 1 should be hovered after mousemove over label1");
is($("button2").mozMatchesSelector(":hover"), false,
"Button 2 should not be hovered");
"Button 2 should not be hovered after mousemove over label1");
is($("label2").mozMatchesSelector(":hover"), false,
"Label 2 should not be hovered after mousemove over label1");
synthesizeMouseAtCenter($("button2"), { type: "mousemove" });
yield;
is($("button1").mozMatchesSelector(":hover"), false,
"Button 1 should not be hovered after mousemove over button2");
is($("label1").mozMatchesSelector(":hover"), false,
"Label 1 should not be hovered after mousemove over button2");
is($("button2").mozMatchesSelector(":hover"), true,
"Button 2 should be hovered after mousemove over button2");
is($("label2").mozMatchesSelector(":hover"), false,
"Label 2 should not be hovered after mousemove over label2");
synthesizeMouseAtCenter($("label2"), { type: "mousemove" });
yield;
is($("button1").mozMatchesSelector(":hover"), false,
"Button 1 should not be hovered");
"Button 1 should not be hovered after mousemove over label2");
is($("label1").mozMatchesSelector(":hover"), false,
"Label 1 should not be hovered after mousemove over label2");
is($("button2").mozMatchesSelector(":hover"), true,
"Button 2 should be hovered");
"Button 2 should be hovered after mousemove over label2");
is($("label2").mozMatchesSelector(":hover"), true,
"Label 2 should be hovered after mousemove over label2");
SimpleTest.finish();
}

View File

@ -355,6 +355,16 @@ public:
protected:
class MediaLoadListener;
/**
* Logs a warning message to the web console to report various failures.
* aMsg is the localized message identifier, aParams is the parameters to
* be substituted into the localized message, and aParamCount is the number
* of parameters in aParams.
*/
void ReportLoadError(const char* aMsg,
const PRUnichar** aParams = nsnull,
PRUint32 aParamCount = 0);
/**
* Changes mHasPlayedOrSeeked to aValue. If mHasPlayedOrSeeked changes
* we'll force a reflow so that the video frame gets reflowed to reflect

View File

@ -90,6 +90,8 @@
#include "nsIDOMNotifyAudioAvailableEvent.h"
#include "nsMediaFragmentURIParser.h"
#include "nsURIHashKey.h"
#include "nsContentUtils.h"
#include "nsIScriptError.h"
#ifdef MOZ_OGG
#include "nsOggDecoder.h"
@ -282,6 +284,20 @@ nsHTMLMediaElement::MediaLoadListener::Observe(nsISupports* aSubject,
return NS_OK;
}
void nsHTMLMediaElement::ReportLoadError(const char* aMsg,
const PRUnichar** aParams,
PRUint32 aParamCount)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"Media",
OwnerDoc(),
nsContentUtils::eDOM_PROPERTIES,
aMsg,
aParams,
aParamCount);
}
NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
{
nsContentUtils::UnregisterShutdownObserver(this);
@ -308,6 +324,21 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest*
return status;
}
nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(aRequest);
bool succeeded;
if (hc && NS_SUCCEEDED(hc->GetRequestSucceeded(&succeeded)) && !succeeded) {
element->NotifyLoadError();
PRUint32 responseStatus = 0;
hc->GetResponseStatus(&responseStatus);
nsAutoString code;
code.AppendInt(responseStatus);
nsAutoString src;
element->GetCurrentSrc(src);
const PRUnichar* params[] = { code.get(), src.get() };
element->ReportLoadError("MediaLoadHttpError", params, ArrayLength(params));
return NS_BINDING_ABORTED;
}
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
if (channel &&
element &&
@ -664,6 +695,9 @@ void nsHTMLMediaElement::SelectResource()
mIsRunningSelectResource = false;
return;
}
} else {
const PRUnichar* params[] = { src.get() };
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
}
NoSupportedMediaSourceError();
} else {
@ -722,12 +756,14 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
mLoadWaitStatus = WAITING_FOR_SOURCE;
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE;
ChangeDelayLoadStatus(false);
ReportLoadError("MediaLoadExhaustedCandidates");
return;
}
// Must have src attribute.
nsAutoString src;
if (!child->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
ReportLoadError("MediaLoadSourceMissingSrc");
DispatchAsyncSourceError(child);
continue;
}
@ -737,6 +773,8 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
GetCanPlay(type) == CANPLAY_NO) {
DispatchAsyncSourceError(child);
const PRUnichar* params[] = { type.get(), src.get() };
ReportLoadError("MediaLoadUnsupportedType", params, ArrayLength(params));
continue;
}
LOG(PR_LOG_DEBUG, ("%p Trying load from <source>=%s type=%s", this,
@ -746,6 +784,8 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
NewURIFromString(src, getter_AddRefs(uri));
if (!uri) {
DispatchAsyncSourceError(child);
const PRUnichar* params[] = { src.get() };
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
continue;
}
@ -1951,6 +1991,11 @@ nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel,
nsRefPtr<nsMediaDecoder> decoder = CreateDecoder(mimeType);
if (!decoder) {
nsAutoString src;
GetCurrentSrc(src);
NS_ConvertUTF8toUTF16 mimeUTF16(mimeType);
const PRUnichar* params[] = { mimeUTF16.get(), src.get() };
ReportLoadError("MediaLoadUnsupportedMimeType", params, ArrayLength(params));
return NS_ERROR_FAILURE;
}
@ -2120,6 +2165,11 @@ void nsHTMLMediaElement::NetworkError()
void nsHTMLMediaElement::DecodeError()
{
nsAutoString src;
GetCurrentSrc(src);
const PRUnichar* params[] = { src.get() };
ReportLoadError("MediaLoadDecodeError", params, ArrayLength(params));
if (mDecoder) {
RemoveMediaElementFromURITable();
mDecoder->Shutdown();

View File

@ -401,7 +401,7 @@ nsXMLDocument::Load(const nsAString& aUrl, bool *aReturn)
nsAutoString error;
error.AssignLiteral("Cross site loading using document.load is no "
"longer supported. Use XMLHttpRequest instead.");
nsCOMPtr<nsIScriptError2> errorObject =
nsCOMPtr<nsIScriptError> errorObject =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@ -416,9 +416,8 @@ nsXMLDocument::Load(const nsAString& aUrl, bool *aReturn)
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(errorObject);
if (consoleService && logError) {
consoleService->LogMessage(logError);
if (consoleService) {
consoleService->LogMessage(errorObject);
}
return NS_ERROR_DOM_SECURITY_ERR;

View File

@ -1728,7 +1728,7 @@ PrintWarningOnConsole(JSContext *cx, const char *stringBundleProperty)
return;
}
nsCOMPtr<nsIScriptError2> scriptError =
nsCOMPtr<nsIScriptError> scriptError =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
if (!scriptError) {
return;
@ -1761,9 +1761,8 @@ PrintWarningOnConsole(JSContext *cx, const char *stringBundleProperty)
"DOM:HTML",
nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx));
if (NS_SUCCEEDED(rv)){
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(scriptError);
consoleService->LogMessage(logError);
if (NS_SUCCEEDED(rv)) {
consoleService->LogMessage(scriptError);
}
}

View File

@ -371,18 +371,10 @@ public:
? "chrome javascript"
: "content javascript";
nsCOMPtr<nsIScriptError2> error2(do_QueryInterface(errorObject));
if (error2) {
rv = error2->InitWithWindowID(mErrorMsg.get(), mFileName.get(),
mSourceLine.get(),
mLineNr, mColumn, mFlags,
category, mInnerWindowID);
} else {
rv = errorObject->Init(mErrorMsg.get(), mFileName.get(),
mSourceLine.get(),
mLineNr, mColumn, mFlags,
category);
}
rv = errorObject->InitWithWindowID(mErrorMsg.get(), mFileName.get(),
mSourceLine.get(),
mLineNr, mColumn, mFlags,
category, mInnerWindowID);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIConsoleService> consoleService =

View File

@ -136,3 +136,15 @@ InvalidRedirectChannelWarning=Unable to redirect to %S because the channel doesn
ResponseTypeSyncXHRWarning=Use of XMLHttpRequest's responseType attribute is no longer supported in the synchronous mode in window context.
WithCredentialsSyncXHRWarning=Use of XMLHttpRequest's withCredentials attribute is no longer supported in the synchronous mode in window context.
JSONCharsetWarning=An attempt was made to declare a non-UTF-8 encoding for JSON retrieved using XMLHttpRequest. Only UTF-8 is supported for decoding JSON.
MediaLoadExhaustedCandidates=All candidate resources failed to load. Media load paused.
MediaLoadSourceMissingSrc=<source> element has no "src" attribute. Media resource load failed.
# LOCALIZATION NOTE: %1$S is the Http error code the server returned (e.g. 404, 500, etc), %2$S is the URL of the media resource which failed to load.
MediaLoadHttpError=HTTP load failed with status %1$S. Load of media resource %2$S failed.
# LOCALIZATION NOTE: %S is the URL of the media resource which failed to load.
MediaLoadInvalidURI=Invalid URI. Load of media resource %S failed.
# LOCALIZATION NOTE: %1$S is the media resource's format/codec type (basically equivalent to the file type, e.g. MP4,AVI,WMV,MOV etc), %2$S is the URL of the media resource which failed to load.
MediaLoadUnsupportedType=Specified "type" of "%1$S" is not supported. Load of media resource %2$S failed.
# LOCALIZATION NOTE: %1$S is the MIME type HTTP header being sent by the web server, %2$S is the URL of the media resource which failed to load.
MediaLoadUnsupportedMimeType=HTTP "Content-Type" of "%1$S" is not supported. Load of media resource %2$S failed.
# LOCALIZATION NOTE: %S is the URL of the media resource which failed to load because of error in decoding.
MediaLoadDecodeError=Media resource %S could not be decoded.

View File

@ -1109,36 +1109,31 @@ public:
}
// Otherwise log an error to the error console.
nsCOMPtr<nsIScriptError2> scriptError =
nsCOMPtr<nsIScriptError> scriptError =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
NS_WARN_IF_FALSE(scriptError, "Faild to create script error!");
nsCOMPtr<nsIConsoleMessage> consoleMessage;
NS_WARN_IF_FALSE(scriptError, "Failed to create script error!");
if (scriptError) {
if (NS_SUCCEEDED(scriptError->InitWithWindowID(aMessage.get(),
aFilename.get(),
aLine.get(), aLineNumber,
aColumnNumber, aFlags,
"Web Worker",
aInnerWindowId))) {
consoleMessage = do_QueryInterface(scriptError);
NS_ASSERTION(consoleMessage, "This should never fail!");
}
else {
if (NS_FAILED(scriptError->InitWithWindowID(aMessage.get(),
aFilename.get(),
aLine.get(), aLineNumber,
aColumnNumber, aFlags,
"Web Worker",
aInnerWindowId))) {
NS_WARNING("Failed to init script error!");
scriptError = nsnull;
}
}
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
NS_WARN_IF_FALSE(consoleService, "Faild to get console service!");
NS_WARN_IF_FALSE(consoleService, "Failed to get console service!");
bool logged = false;
if (consoleService) {
if (consoleMessage) {
if (NS_SUCCEEDED(consoleService->LogMessage(consoleMessage))) {
if (scriptError) {
if (NS_SUCCEEDED(consoleService->LogMessage(scriptError))) {
logged = true;
}
else {

View File

@ -620,6 +620,20 @@ nsPermissionManager::RemoveAll()
return rv;
}
void
nsPermissionManager::CloseDB()
{
// Null the statements, this will finalize them.
mStmtInsert = nsnull;
mStmtDelete = nsnull;
mStmtUpdate = nsnull;
if (mDBConn) {
mozilla::DebugOnly<nsresult> rv = mDBConn->Close();
MOZ_ASSERT(NS_SUCCEEDED(rv));
mDBConn = nsnull;
}
}
nsresult
nsPermissionManager::RemoveAllInternal()
{
@ -629,10 +643,7 @@ nsPermissionManager::RemoveAllInternal()
if (mDBConn) {
nsresult rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("DELETE FROM moz_hosts"));
if (NS_FAILED(rv)) {
mStmtInsert = nsnull;
mStmtDelete = nsnull;
mStmtUpdate = nsnull;
mDBConn = nsnull;
CloseDB();
rv = InitDB(true);
return rv;
}
@ -792,12 +803,7 @@ NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aT
} else {
RemoveAllFromMemory();
}
if (mDBConn) {
// Null the statements, this will finalize them.
mStmtInsert = nsnull;
mStmtDelete = nsnull;
mStmtUpdate = nsnull;
}
CloseDB();
}
else if (!nsCRT::strcmp(aTopic, "profile-do-change")) {
// the profile has already changed; init the db from the new location

View File

@ -222,6 +222,10 @@ private:
PRInt64 aExpireTime,
const PRUnichar *aData);
void NotifyObservers(nsIPermission *aPermission, const PRUnichar *aData);
// Finalize all statements, close the DB and null it.
void CloseDB();
nsresult RemoveAllInternal();
nsresult RemoveAllFromMemory();
nsresult NormalizeToACE(nsCString &aHost);

View File

@ -38,6 +38,8 @@
#ifndef _GFXQUARTZNATIVEDRAWING_H_
#define _GFXQUARTZNATIVEDRAWING_H_
#include "mozilla/Attributes.h"
#include "gfxContext.h"
#include "gfxQuartzSurface.h"
@ -71,8 +73,8 @@ public:
private:
// don't allow copying via construction or assignment
gfxQuartzNativeDrawing(const gfxQuartzNativeDrawing&);
const gfxQuartzNativeDrawing& operator=(const gfxQuartzNativeDrawing&);
gfxQuartzNativeDrawing(const gfxQuartzNativeDrawing&) MOZ_DELETE;
const gfxQuartzNativeDrawing& operator=(const gfxQuartzNativeDrawing&) MOZ_DELETE;
// Final destination context
nsRefPtr<gfxContext> mContext;

View File

@ -71,7 +71,7 @@ namespace hal {
class WindowIdentifier;
extern PRLogModuleInfo *sHalLog;
#define HAL_LOG(msg) PR_LOG(sHalLog, PR_LOG_DEBUG, msg)
#define HAL_LOG(msg) PR_LOG(mozilla::hal::sHalLog, PR_LOG_DEBUG, msg)
} // namespace hal

View File

@ -45,6 +45,15 @@
#include "mozilla/FileUtils.h"
#include "nsAlgorithm.h"
#include "nsThreadUtils.h"
#include "mozilla/Monitor.h"
#include "mozilla/Services.h"
#include "mozilla/FileUtils.h"
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#include "nsIThread.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "hardware_legacy/vibrator.h"
#include <stdio.h>
#include <math.h>
#include <fcntl.h>
@ -55,13 +64,146 @@ using mozilla::hal::WindowIdentifier;
namespace mozilla {
namespace hal_impl {
void
Vibrate(const nsTArray<uint32>& pattern, const WindowIdentifier &)
{}
namespace {
/**
* This runnable runs for the lifetime of the program, once started. It's
* responsible for "playing" vibration patterns.
*/
class VibratorRunnable
: public nsIRunnable
, public nsIObserver
{
public:
VibratorRunnable()
: mMonitor("VibratorRunnable")
, mIndex(0)
, mShuttingDown(false)
{
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (!os) {
NS_WARNING("Could not get observer service!");
return;
}
os->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, /* weak ref */ true);
}
NS_DECL_ISUPPORTS
NS_DECL_NSIRUNNABLE
NS_DECL_NSIOBSERVER
// Run on the main thread, not the vibrator thread.
void Vibrate(const nsTArray<uint32> &pattern);
void CancelVibrate();
private:
Monitor mMonitor;
// The currently-playing pattern.
nsTArray<uint32> mPattern;
// The index we're at in the currently-playing pattern. If mIndex >=
// mPattern.Length(), then we're not currently playing anything.
uint32 mIndex;
// Set to true in our shutdown observer. When this is true, we kill the
// vibrator thread.
bool mShuttingDown;
};
NS_IMPL_ISUPPORTS2(VibratorRunnable, nsIRunnable, nsIObserver);
NS_IMETHODIMP
VibratorRunnable::Run()
{
MonitorAutoLock lock(mMonitor);
// We currently assume that mMonitor.Wait(X) waits for X milliseconds. But in
// reality, the kernel might not switch to this thread for some time after the
// wait expires. So there's potential for some inaccuracy here.
//
// This doesn't worry me too much. Note that we don't even start vibrating
// immediately when VibratorRunnable::Vibrate is called -- we go through a
// condvar onto another thread. Better just to be chill about small errors in
// the timing here.
while (!mShuttingDown) {
if (mIndex < mPattern.Length()) {
uint32 duration = mPattern[mIndex];
if (mIndex % 2 == 0) {
vibrator_on(duration);
}
mIndex++;
mMonitor.Wait(PR_MillisecondsToInterval(duration));
}
else {
mMonitor.Wait();
}
}
return NS_OK;
}
NS_IMETHODIMP
VibratorRunnable::Observe(nsISupports *subject, const char *topic,
const PRUnichar *data)
{
MOZ_ASSERT(strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0);
MonitorAutoLock lock(mMonitor);
mShuttingDown = true;
mMonitor.Notify();
return NS_OK;
}
void
CancelVibrate(const WindowIdentifier &)
{}
VibratorRunnable::Vibrate(const nsTArray<uint32> &pattern)
{
MonitorAutoLock lock(mMonitor);
mPattern = pattern;
mIndex = 0;
mMonitor.Notify();
}
void
VibratorRunnable::CancelVibrate()
{
MonitorAutoLock lock(mMonitor);
mPattern.Clear();
mPattern.AppendElement(0);
mIndex = 0;
mMonitor.Notify();
}
VibratorRunnable *sVibratorRunnable = NULL;
void
EnsureVibratorThreadInitialized()
{
if (sVibratorRunnable) {
return;
}
nsRefPtr<VibratorRunnable> runnable = new VibratorRunnable();
sVibratorRunnable = runnable;
nsCOMPtr<nsIThread> thread;
NS_NewThread(getter_AddRefs(thread), sVibratorRunnable);
}
} // anonymous namespace
void
Vibrate(const nsTArray<uint32> &pattern, const hal::WindowIdentifier &)
{
EnsureVibratorThreadInitialized();
sVibratorRunnable->Vibrate(pattern);
}
void
CancelVibrate(const hal::WindowIdentifier &)
{
EnsureVibratorThreadInitialized();
sVibratorRunnable->CancelVibrate();
}
namespace {
@ -143,19 +285,21 @@ DisableBatteryNotifications()
}
void
GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
GetCurrentBatteryInformation(hal::BatteryInformation *aBatteryInfo)
{
FILE *capacityFile = fopen("/sys/class/power_supply/battery/capacity", "r");
double capacity = dom::battery::kDefaultLevel * 100;
if (capacityFile)
if (capacityFile) {
fscanf(capacityFile, "%lf", &capacity);
fclose(capacityFile);
fclose(capacityFile);
}
FILE *chargingFile = fopen("/sys/class/power_supply/battery/charging_source", "r");
int chargingSrc = 1;
if (chargingFile)
if (chargingFile) {
fscanf(chargingFile, "%d", &chargingSrc);
fclose(chargingFile);
fclose(chargingFile);
}
aBatteryInfo->level() = capacity / 100;
aBatteryInfo->charging() = chargingSrc == 1;

View File

@ -130,23 +130,21 @@ Decoder::Finish()
// Log data errors to the error console
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
nsCOMPtr<nsIScriptError2> errorObject =
nsCOMPtr<nsIScriptError> errorObject =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
if (consoleService && errorObject && !HasDecoderError()) {
nsAutoString msg(NS_LITERAL_STRING("Image corrupt or truncated: ") +
NS_ConvertASCIItoUTF16(mImage.GetURIString()));
errorObject->InitWithWindowID
(msg.get(),
NS_ConvertUTF8toUTF16(mImage.GetURIString()).get(),
nsnull,
0, 0, nsIScriptError::errorFlag,
"Image", mImage.InnerWindowID()
);
nsCOMPtr<nsIScriptError> error = do_QueryInterface(errorObject);
consoleService->LogMessage(error);
if (NS_SUCCEEDED(errorObject->InitWithWindowID(
msg.get(),
NS_ConvertUTF8toUTF16(mImage.GetURIString()).get(),
nsnull, 0, 0, nsIScriptError::errorFlag,
"Image", mImage.InnerWindowID()
))) {
consoleService->LogMessage(errorObject);
}
}
// If we only have a data error, see if things are worth salvaging

View File

@ -40,6 +40,8 @@
#ifndef js_utility_h__
#define js_utility_h__
#include "mozilla/Assertions.h"
#include <stdlib.h>
#include <string.h>
@ -71,57 +73,24 @@ JS_BEGIN_EXTERN_C
*/
#define JS_FREE_PATTERN 0xDA
/* JS_ASSERT */
#define JS_ASSERT(expr) MOZ_ASSERT(expr)
#define JS_ASSERT_IF(cond, expr) MOZ_ASSERT_IF((cond), (expr))
#define JS_NOT_REACHED(reason) MOZ_NOT_REACHED(reason)
#define JS_ALWAYS_TRUE(expr) MOZ_ALWAYS_TRUE(expr)
#define JS_ALWAYS_FALSE(expr) MOZ_ALWAYS_FALSE(expr)
#ifdef DEBUG
# define JS_ASSERT(expr) \
((expr) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__))
# define JS_ASSERT_IF(cond, expr) \
((!(cond) || (expr)) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__))
# define JS_NOT_REACHED(reason) \
JS_Assert(reason, __FILE__, __LINE__)
# define JS_ALWAYS_TRUE(expr) JS_ASSERT(expr)
# define JS_ALWAYS_FALSE(expr) JS_ASSERT(!(expr))
# ifdef JS_THREADSAFE
# define JS_THREADSAFE_ASSERT(expr) JS_ASSERT(expr)
# else
# define JS_THREADSAFE_ASSERT(expr) ((void) 0)
# endif
#else
# define JS_ASSERT(expr) ((void) 0)
# define JS_ASSERT_IF(cond,expr) ((void) 0)
# define JS_NOT_REACHED(reason)
# define JS_ALWAYS_TRUE(expr) ((void) (expr))
# define JS_ALWAYS_FALSE(expr) ((void) (expr))
# define JS_THREADSAFE_ASSERT(expr) ((void) 0)
#endif
/*
* JS_STATIC_ASSERT
*
* A compile-time assert. "cond" must be a constant expression. The macro can
* be used only in places where an "extern" declaration is allowed.
*/
#ifdef __SUNPRO_CC
/*
* Sun Studio C++ compiler has a bug
* "sizeof expression not accepted as size of array parameter"
* It happens when js_static_assert() function is declared inside functions.
* The bug number is 6688515. It is not public yet.
* Therefore, for Sun Studio, declare js_static_assert as an array instead.
*/
# define JS_STATIC_ASSERT(cond) extern char js_static_assert[(cond) ? 1 : -1]
#else
# ifdef __COUNTER__
# define JS_STATIC_ASSERT_GLUE1(x,y) x##y
# define JS_STATIC_ASSERT_GLUE(x,y) JS_STATIC_ASSERT_GLUE1(x,y)
# define JS_STATIC_ASSERT(cond) \
typedef int JS_STATIC_ASSERT_GLUE(js_static_assert, __COUNTER__)[(cond) ? 1 : -1]
# else
# define JS_STATIC_ASSERT(cond) extern void js_static_assert(int arg[(cond) ? 1 : -1])
# endif
#endif
#define JS_STATIC_ASSERT_IF(cond, expr) JS_STATIC_ASSERT(!(cond) || (expr))
#define JS_STATIC_ASSERT(cond) MOZ_STATIC_ASSERT(cond, "JS_STATIC_ASSERT")
#define JS_STATIC_ASSERT_IF(cond, expr) MOZ_STATIC_ASSERT_IF(cond, expr, "JS_STATIC_ASSERT_IF")
/*
* Abort the process in a non-graceful manner. This will cause a core file,

View File

@ -41,6 +41,8 @@
#ifndef jsvector_h_
#define jsvector_h_
#include "mozilla/Attributes.h"
#include "TemplateLib.h"
#include "Utility.h"
@ -274,8 +276,8 @@ class Vector : private AllocPolicy
bool entered;
#endif
Vector(const Vector &);
Vector &operator=(const Vector &);
Vector(const Vector &) MOZ_DELETE;
Vector &operator=(const Vector &) MOZ_DELETE;
/* private accessors */

View File

@ -531,6 +531,7 @@ nl_types.h
NodeInfo.h
nss.h
nssilock.h
nsswitch.h
objbase.h
objidl.h
Objsafe.h
@ -750,6 +751,7 @@ sys/sysctl.h
sys/sysinfo.h
sys/sysmp.h
sys/syssgi.h
sys/system_properties.h
sys/systeminfo.h
sys/timeb.h
sys/time.h

View File

@ -41,6 +41,8 @@
#ifndef LifoAlloc_h__
#define LifoAlloc_h__
#include "mozilla/Attributes.h"
/*
* This data structure supports stacky LIFO allocation (mark/release and
* LifoAllocScope). It does not maintain one contiguous segment; instead, it
@ -181,8 +183,8 @@ class LifoAlloc
size_t markCount;
size_t defaultChunkSize_;
void operator=(const LifoAlloc &);
LifoAlloc(const LifoAlloc &);
void operator=(const LifoAlloc &) MOZ_DELETE;
LifoAlloc(const LifoAlloc &) MOZ_DELETE;
/*
* Return a BumpChunk that can perform an allocation of at least size |n|

View File

@ -40,6 +40,8 @@
#ifndef jscompartment_h___
#define jscompartment_h___
#include "mozilla/Attributes.h"
#include "jsclist.h"
#include "jscntxt.h"
#include "jsfun.h"
@ -469,9 +471,8 @@ class AutoCompartment
void leave();
private:
// Prohibit copying.
AutoCompartment(const AutoCompartment &);
AutoCompartment & operator=(const AutoCompartment &);
AutoCompartment(const AutoCompartment &) MOZ_DELETE;
AutoCompartment & operator=(const AutoCompartment &) MOZ_DELETE;
};
/*

View File

@ -306,6 +306,7 @@ extern JS_FRIEND_DATA(js::Class) ObjectProxyClass;
extern JS_FRIEND_DATA(js::Class) QNameClass;
extern JS_FRIEND_DATA(js::Class) ScriptClass;
extern JS_FRIEND_DATA(js::Class) XMLClass;
extern JS_FRIEND_DATA(js::Class) ObjectClass;
inline js::Class *
GetObjectClass(const JSObject *obj)

View File

@ -2199,7 +2199,12 @@ js_CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
clone->nargs = fun->nargs;
clone->flags = fun->flags & ~JSFUN_EXTENDED;
clone->u = fun->toFunction()->u;
if (fun->isInterpreted()) {
clone->initScript(fun->script());
clone->initEnvironment(parent);
} else {
clone->u.n = fun->u.n;
}
clone->atom = fun->atom;
if (kind == JSFunction::ExtendedFinalizeKind) {
@ -2207,9 +2212,6 @@ js_CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
clone->initializeExtended();
}
if (clone->isInterpreted())
clone->setEnvironment(parent);
if (cx->compartment == fun->compartment()) {
/*
* We can use the same type as the original function provided that (a)

View File

@ -546,10 +546,6 @@ mjit::Compiler::performCompilation(JITScript **jitp)
JaegerSpew(JSpew_Scripts, "successfully compiled (code \"%p\") (size \"%u\")\n",
(*jitp)->code.m_code.executableAddress(), unsigned((*jitp)->code.m_size));
if (!*jitp)
return Compile_Abort;
return Compile_Okay;
}

View File

@ -2651,7 +2651,7 @@ ConvertArgs(JSContext *cx, uintN argc, jsval *vp)
strBytes.encode(cx, str);
JSString *tmpstr = JS_DecompileFunction(cx, fun, 4);
JSAutoByteString func;
if (!tmpstr || !func.encode(cx, tmpstr));
if (!tmpstr || !func.encode(cx, tmpstr))
ReportException(cx);
fprintf(gOutFile,
"d %g, I %g, S %s, W %s, obj %s, fun %s\n"

View File

@ -10,7 +10,7 @@ from tests import TestCase
def split_path_into_dirs(path):
dirs = [path]
while True:
path, tail = os.path.split(path)
if not tail:
@ -23,16 +23,19 @@ class XULInfo:
self.abi = abi
self.os = os
self.isdebug = isdebug
self.browserIsRemote = False
def as_js(self):
"""Return JS that when executed sets up variables so that JS expression
predicates on XUL build info evaluate properly."""
return 'var xulRuntime = { OS: "%s", XPCOMABI: "%s", shell: true }; var isDebugBuild=%s; var Android=%s;' % (
return ('var xulRuntime = { OS: "%s", XPCOMABI: "%s", shell: true };' +
'var isDebugBuild=%s; var Android=%s; var browserIsRemote=%s') % (
self.os,
self.abi,
str(self.isdebug).lower(),
str(self.os == "Android").lower())
str(self.os == "Android").lower(),
str(self.browserIsRemote).lower())
@classmethod
def create(cls, jsdir):

View File

@ -42,6 +42,8 @@
#ifndef Debugger_h__
#define Debugger_h__
#include "mozilla/Attributes.h"
#include "jsapi.h"
#include "jsclist.h"
#include "jscntxt.h"
@ -348,9 +350,8 @@ class Debugger {
JSObject *wrapScript(JSContext *cx, JSScript *script);
private:
/* Prohibit copying. */
Debugger(const Debugger &);
Debugger & operator=(const Debugger &);
Debugger(const Debugger &) MOZ_DELETE;
Debugger & operator=(const Debugger &) MOZ_DELETE;
};
class BreakpointSite {

View File

@ -43,7 +43,7 @@
#include "nsISupports.idl"
#include "nsIConsoleMessage.idl"
[scriptable, uuid(537ff844-c325-4047-92f5-e1c292d108bc)]
[scriptable, uuid(c6dd877a-87b6-47cc-968d-90f4514ec65f)]
interface nsIScriptError : nsIConsoleMessage
{
/** pseudo-flag for default case */
@ -90,23 +90,6 @@ interface nsIScriptError : nsIConsoleMessage
*/
readonly attribute long long timeStamp;
void init(in wstring message,
in wstring sourceName,
in wstring sourceLine,
in PRUint32 lineNumber,
in PRUint32 columnNumber,
in PRUint32 flags,
in string category);
AUTF8String toString();
};
/**
* An interface that nsIScriptError objects can implement to allow
* them to be initialized with a window id.
*/
[scriptable, uuid(444c5e66-a85d-4a3b-83ce-4c71882b09a3)]
interface nsIScriptError2 : nsISupports {
/* Get the window id this was initialized with. Zero will be
returned if init() was used instead of initWithWindowID(). */
readonly attribute unsigned long long outerWindowID;
@ -115,6 +98,14 @@ interface nsIScriptError2 : nsISupports {
returned if init() was used instead of initWithWindowID(). */
readonly attribute unsigned long long innerWindowID;
void init(in wstring message,
in wstring sourceName,
in wstring sourceLine,
in PRUint32 lineNumber,
in PRUint32 columnNumber,
in PRUint32 flags,
in string category);
/* This should be called instead of nsIScriptError.init to
initialize with a window id. The window id should be for the
inner window associated with this error. */
@ -126,6 +117,8 @@ interface nsIScriptError2 : nsISupports {
in PRUint32 flags,
in string category,
in unsigned long long innerWindowID);
AUTF8String toString();
};
%{ C++

View File

@ -41,6 +41,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Attributes.h"
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG
#endif
@ -319,8 +321,8 @@ private:
char* mBuf;
// prevent copying and assignment
JSCLContextHelper(const JSCLContextHelper &); // not implemented
const JSCLContextHelper& operator=(const JSCLContextHelper &); // not implemented
JSCLContextHelper(const JSCLContextHelper &) MOZ_DELETE;
const JSCLContextHelper& operator=(const JSCLContextHelper &) MOZ_DELETE;
};
@ -334,9 +336,9 @@ public:
private:
JSContext* mContext;
JSErrorReporter mOldReporter;
// prevent copying and assignment
JSCLAutoErrorReporterSetter(const JSCLAutoErrorReporterSetter &); // not implemented
const JSCLAutoErrorReporterSetter& operator=(const JSCLAutoErrorReporterSetter &); // not implemented
JSCLAutoErrorReporterSetter(const JSCLAutoErrorReporterSetter &) MOZ_DELETE;
const JSCLAutoErrorReporterSetter& operator=(const JSCLAutoErrorReporterSetter &) MOZ_DELETE;
};
static nsresult

View File

@ -2692,7 +2692,7 @@ nsXPCComponents_Utils::ReportError(const JS::Value &error, JSContext *cx)
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
nsCOMPtr<nsIScriptError2> scripterr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
nsCOMPtr<nsIScriptError> scripterr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
if (!scripterr || !console)
return NS_OK;
@ -2715,8 +2715,7 @@ nsXPCComponents_Utils::ReportError(const JS::Value &error, JSContext *cx)
column, err->flags, "XPConnect JavaScript", innerWindowID);
NS_ENSURE_SUCCESS(rv, NS_OK);
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(scripterr);
console->LogMessage(logError);
console->LogMessage(scripterr);
return NS_OK;
}
@ -2748,8 +2747,7 @@ nsXPCComponents_Utils::ReportError(const JS::Value &error, JSContext *cx)
nsnull, lineNo, 0, 0, "XPConnect JavaScript", innerWindowID);
NS_ENSURE_SUCCESS(rv, NS_OK);
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(scripterr);
console->LogMessage(logError);
console->LogMessage(scripterr);
return NS_OK;
}

View File

@ -1133,14 +1133,12 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
rv = location->GetFilename(getter_Copies(sourceName));
}
nsCOMPtr<nsIScriptError2> scriptError2 =
do_QueryInterface(scriptError);
rv = scriptError2->InitWithWindowID(newMessage.get(),
NS_ConvertASCIItoUTF16(sourceName).get(),
nsnull,
lineNumber, 0, 0,
"XPConnect JavaScript",
nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx));
rv = scriptError->InitWithWindowID(newMessage.get(),
NS_ConvertASCIItoUTF16(sourceName).get(),
nsnull,
lineNumber, 0, 0,
"XPConnect JavaScript",
nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx));
if (NS_FAILED(rv))
scriptError = nsnull;
}

View File

@ -46,8 +46,7 @@
#include "nsGlobalWindow.h"
#include "nsPIDOMWindow.h"
NS_IMPL_THREADSAFE_ISUPPORTS3(nsScriptError, nsIConsoleMessage, nsIScriptError,
nsIScriptError2)
NS_IMPL_THREADSAFE_ISUPPORTS2(nsScriptError, nsIConsoleMessage, nsIScriptError)
nsScriptError::nsScriptError()
: mMessage(),

View File

@ -46,6 +46,8 @@
#ifndef xpcprivate_h___
#define xpcprivate_h___
#include "mozilla/Attributes.h"
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
@ -3936,8 +3938,7 @@ xpc_InstallJSDebuggerKeywordHandler(JSRuntime* rt);
// Definition of nsScriptError, defined here because we lack a place to put
// XPCOM objects associated with the JavaScript engine.
class nsScriptError : public nsIScriptError,
public nsIScriptError2 {
class nsScriptError : public nsIScriptError {
public:
nsScriptError();
@ -3948,7 +3949,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONSOLEMESSAGE
NS_DECL_NSISCRIPTERROR
NS_DECL_NSISCRIPTERROR2
private:
nsString mMessage;
@ -4026,8 +4026,8 @@ private:
MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
// No copying or assignment allowed
AutoScriptEvaluate(const AutoScriptEvaluate &);
AutoScriptEvaluate & operator =(const AutoScriptEvaluate &);
AutoScriptEvaluate(const AutoScriptEvaluate &) MOZ_DELETE;
AutoScriptEvaluate & operator =(const AutoScriptEvaluate &) MOZ_DELETE;
};
/***************************************************************************/

View File

@ -3527,7 +3527,7 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
SIMPLE_TAG_CREATE(frameset, NS_NewHTMLFramesetFrame),
SIMPLE_TAG_CREATE(iframe, NS_NewSubDocumentFrame),
COMPLEX_TAG_CREATE(button, &nsCSSFrameConstructor::ConstructButtonFrame),
SIMPLE_TAG_CREATE(canvas, NS_NewHTMLCanvasFrame),
SIMPLE_TAG_CHAIN(canvas, nsCSSFrameConstructor::FindCanvasData),
#if defined(MOZ_MEDIA)
SIMPLE_TAG_CREATE(video, NS_NewHTMLVideoFrame),
SIMPLE_TAG_CREATE(audio, NS_NewHTMLVideoFrame),
@ -3638,6 +3638,20 @@ nsCSSFrameConstructor::FindObjectData(Element* aElement,
sObjectData, ArrayLength(sObjectData));
}
/* static */
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindCanvasData(Element* aElement,
nsStyleContext* aStyleContext)
{
if (!aElement->OwnerDoc()->IsScriptEnabled()) {
return nsnull;
}
static const FrameConstructionData sCanvasData =
SIMPLE_FCDATA(NS_NewHTMLCanvasFrame);
return &sCanvasData;
}
nsresult
nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aItem,
nsFrameConstructorState& aState,

View File

@ -43,6 +43,8 @@
#ifndef nsCSSFrameConstructor_h___
#define nsCSSFrameConstructor_h___
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsILayoutHistoryState.h"
#include "nsIXBLService.h"
@ -102,10 +104,9 @@ public:
nsIAtom* aTag, // content object's tag
nsXPIDLString& aAltText);
private:
// These are not supported and are not implemented!
nsCSSFrameConstructor(const nsCSSFrameConstructor& aCopy);
nsCSSFrameConstructor& operator=(const nsCSSFrameConstructor& aCopy);
private:
nsCSSFrameConstructor(const nsCSSFrameConstructor& aCopy) MOZ_DELETE;
nsCSSFrameConstructor& operator=(const nsCSSFrameConstructor& aCopy) MOZ_DELETE;
public:
// XXXbz this method needs to actually return errors!
@ -1201,6 +1202,8 @@ private:
FindInputData(Element* aElement, nsStyleContext* aStyleContext);
static const FrameConstructionData*
FindObjectData(Element* aElement, nsStyleContext* aStyleContext);
static const FrameConstructionData*
FindCanvasData(Element* aElement, nsStyleContext* aStyleContext);
/* Construct a frame from the given FrameConstructionItem. This function
will handle adding the frame to frame lists, processing children, setting

View File

@ -43,6 +43,8 @@
#ifndef nsStyleChangeList_h___
#define nsStyleChangeList_h___
#include "mozilla/Attributes.h"
#include "nsError.h"
#include "nsChangeHint.h"
@ -95,7 +97,7 @@ protected:
nsStyleChangeData mBuffer[kStyleChangeBufferSize];
private:
nsStyleChangeList(const nsStyleChangeList&); // not implemented
nsStyleChangeList(const nsStyleChangeList&) MOZ_DELETE;
};

View File

@ -42,6 +42,7 @@
/* base class of all rendering objects */
#include "mozilla/Attributes.h"
#include "mozilla/Util.h"
#include "nsCOMPtr.h"
@ -8074,7 +8075,7 @@ struct DR_FrameTypeInfo
char mName[32];
nsTArray<DR_Rule*> mRules;
private:
DR_FrameTypeInfo& operator=(const DR_FrameTypeInfo&); // NOT USED
DR_FrameTypeInfo& operator=(const DR_FrameTypeInfo&) MOZ_DELETE;
};
DR_FrameTypeInfo::DR_FrameTypeInfo(nsIAtom* aFrameType,

View File

@ -38,6 +38,8 @@
#ifndef nsFrameSelection_h___
#define nsFrameSelection_h___
#include "mozilla/Attributes.h"
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsISelectionController.h"
@ -210,7 +212,7 @@ class nsIScrollableFrame;
* or they may cause other objects to be deleted.
*/
class nsFrameSelection : public nsISupports {
class nsFrameSelection MOZ_FINAL : public nsISupports {
public:
enum HINT { HINTLEFT = 0, HINTRIGHT = 1}; //end of this line or beginning of next
/*interfaces for addref and release and queryinterface*/

View File

@ -119,8 +119,8 @@ operator.\u0025.infix = lspace:3 rspace:3 # percent sign
operator.\u0026.postfix = lspace:0 rspace:0 # &amp;
operator.\u0026\u0026.infix = lspace:4 rspace:4 # &amp;&amp;
operator.\u0027.postfix = lspace:0 rspace:0 accent # '
operator.\u0028.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # (
operator.\u0029.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # )
operator.\u0028.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical mirrorable # (
operator.\u0029.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical mirrorable # )
operator.\u002A.infix = lspace:3 rspace:3 # *
operator.\u002A\u002A.infix = lspace:1 rspace:1 # **
operator.\u002A\u003D.infix = lspace:4 rspace:4 # *=
@ -152,15 +152,15 @@ operator.\u003E.infix = lspace:5 rspace:5 # >
operator.\u003E\u003D.infix = lspace:5 rspace:5 # >=
operator.\u003F.infix = lspace:1 rspace:1 # ?
operator.\u0040.infix = lspace:1 rspace:1 # @
operator.\u005B.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # [
operator.\u005B.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical mirrorable # [
operator.\u005C.infix = lspace:0 rspace:0 # reverse solidus
operator.\u005D.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # ]
operator.\u005D.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical mirrorable # ]
operator.\u005E.postfix = lspace:0 rspace:0 stretchy accent direction:horizontal # &Hat; circumflex accent
operator.\u005E.infix = lspace:1 rspace:1 direction:horizontal # ^
operator.\u005F.postfix = lspace:0 rspace:0 stretchy accent direction:horizontal # _ low line
operator.\u005F.infix = lspace:1 rspace:1 stretchy direction:horizontal # _ low line
operator.\u0060.postfix = lspace:0 rspace:0 accent # &DiacriticalGrave;
operator.\u007B.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # {
operator.\u007B.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical mirrorable # {
operator.\u007C.infix = lspace:2 rspace:2 stretchy fence symmetric direction:vertical # &VerticalLine; |
operator.\u007C.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # |
operator.\u007C.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # |
@ -170,7 +170,7 @@ operator.\u007C\u007C.postfix = lspace:0 rspace:0 stretchy fence symmetric direc
operator.\u007C\u007C\u007C.infix = lspace:2 rspace:2 stretchy fence symmetric direction:vertical # multiple character operator: |||
operator.\u007C\u007C\u007C.prefix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # multiple character operator: |||
operator.\u007C\u007C\u007C.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # multiple character operator: |||
operator.\u007D.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical # }
operator.\u007D.postfix = lspace:0 rspace:0 stretchy fence symmetric direction:vertical mirrorable # }
operator.\u007E.postfix = lspace:0 rspace:0 stretchy accent direction:horizontal # ~ tilde
operator.\u00A8.postfix = lspace:0 rspace:0 accent # &DoubleDot;
operator.\u00AC.prefix = lspace:2 rspace:1 # not sign
@ -341,7 +341,7 @@ operator.\u220D.infix = lspace:5 rspace:5 # small contains as member
operator.\u220E.infix = lspace:3 rspace:3 # end of proof
operator.\u220F.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical # &Product;
operator.\u2210.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical # &Coproduct;
operator.\u2211.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical # &Sum;
operator.\u2211.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical mirrorable # &Sum;
operator.\u2212.infix = lspace:4 rspace:4 # official Unicode minus sign
operator.\u2212.prefix = lspace:0 rspace:1 # official Unicode minus sign
operator.\u2213.infix = lspace:4 rspace:4 # &MinusPlus;
@ -352,7 +352,7 @@ operator.\u2216.infix = lspace:4 rspace:4 direction:vertical # set minus
operator.\u2217.infix = lspace:4 rspace:4 # asterisk operator
operator.\u2218.infix = lspace:4 rspace:4 # &SmallCircle;
operator.\u2219.infix = lspace:4 rspace:4 # bullet operator
operator.\u221A.prefix = lspace:1 rspace:1 stretchy direction:vertical # &Sqrt;
operator.\u221A.prefix = lspace:1 rspace:1 stretchy direction:vertical mirrorable # &Sqrt;
operator.\u221B.prefix = lspace:1 rspace:1 # cube root
operator.\u221C.prefix = lspace:1 rspace:1 # fourth root
operator.\u221D.infix = lspace:5 rspace:5 # &Proportional;
@ -368,12 +368,12 @@ operator.\u2227.infix = lspace:4 rspace:4 # &wedge;
operator.\u2228.infix = lspace:4 rspace:4 # &vee;
operator.\u2229.infix = lspace:4 rspace:4 # &cap;
operator.\u222A.infix = lspace:4 rspace:4 # &cup;
operator.\u222B.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # &Integral;
operator.\u222C.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # double integral
operator.\u222D.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # triple integral
operator.\u222E.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # &ContourIntegral;
operator.\u222F.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # &DoubleContourIntegral;
operator.\u2230.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # volume integral
operator.\u222B.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral mirrorable # &Integral;
operator.\u222C.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral mirrorable # double integral
operator.\u222D.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral mirrorable # triple integral
operator.\u222E.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral mirrorable # &ContourIntegral;
operator.\u222F.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral mirrorable # &DoubleContourIntegral;
operator.\u2230.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral mirrorable # volume integral
operator.\u2231.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # clockwise integral
operator.\u2232.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # &ClockwiseContourIntegral;
operator.\u2233.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # &CounterClockwiseContourIntegral;
@ -938,24 +938,24 @@ operator.\u2A07.prefix = lspace:1 rspace:2 largeop movablelimits symmetric # two
operator.\u2A08.prefix = lspace:1 rspace:2 largeop movablelimits symmetric # two logical or operator
operator.\u2A09.prefix = lspace:1 rspace:2 largeop movablelimits symmetric # n-ary times operator
operator.\u2A0A.prefix = lspace:1 rspace:2 largeop movablelimits symmetric # modulo two sum
operator.\u2A0B.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # summation with integral
operator.\u2A0C.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral # quadruple integral operator
operator.\u2A0D.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # finite part integral
operator.\u2A0E.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral with double stroke
operator.\u2A0F.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral average with slash
operator.\u2A10.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral # circulation function
operator.\u2A0B.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # summation with integral
operator.\u2A0C.prefix = lspace:0 rspace:1 largeop symmetric direction:vertical integral mirrorable # quadruple integral operator
operator.\u2A0D.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # finite part integral
operator.\u2A0E.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral with double stroke
operator.\u2A0F.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral average with slash
operator.\u2A10.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral mirrorable # circulation function
operator.\u2A11.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral # anticlockwise integration
operator.\u2A12.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral # line integration with rectangular path around pole
operator.\u2A13.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral # line integration with semicircular path around pole
operator.\u2A14.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral # line integration not including the pole
operator.\u2A15.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral around a point operator
operator.\u2A16.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # quaternion integral operator
operator.\u2A12.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral mirrorable # line integration with rectangular path around pole
operator.\u2A13.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral mirrorable # line integration with semicircular path around pole
operator.\u2A14.prefix = lspace:1 rspace:2 largeop movablelimits symmetric direction:vertical integral mirrorable # line integration not including the pole
operator.\u2A15.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral around a point operator
operator.\u2A16.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # quaternion integral operator
operator.\u2A17.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral with leftwards arrow with hook
operator.\u2A18.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral with times sign
operator.\u2A19.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral with intersection
operator.\u2A1A.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral with union
operator.\u2A1B.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral with overbar
operator.\u2A1C.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral # integral with underbar
operator.\u2A18.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral with times sign
operator.\u2A19.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral with intersection
operator.\u2A1A.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral with union
operator.\u2A1B.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral with overbar
operator.\u2A1C.prefix = lspace:1 rspace:2 largeop symmetric direction:vertical integral mirrorable # integral with underbar
operator.\u2A1D.infix = lspace:3 rspace:3 # join
operator.\u2A1E.infix = lspace:3 rspace:3 # large left triangle operator
operator.\u2A1F.infix = lspace:3 rspace:3 # z notation schema composition

View File

@ -467,3 +467,17 @@ msub > :not(:first-child),
msup > :not(:first-child),
msubsup > :not(:first-child),
mmultiscripts > :not(:first-child) { -moz-script-level:+1; }
/*****************************************/
/* Controlling directionality */
/*****************************************/
math[dir="rtl"], mstyle[dir="rtl"], mrow[dir="rtl"],
mi[dir="rtl"], mn[dir="rtl"], mo[dir="rtl"], mtext[dir="rtl"], ms[dir="rtl"] {
direction: rtl;
}
math[dir="ltr"], mstyle[dir="ltr"], mrow[dir="ltr"],
mi[dir="ltr"], mn[dir="ltr"], mo[dir="ltr"], mtext[dir="ltr"], ms[dir="ltr"] {
direction: ltr;
}

View File

@ -255,15 +255,15 @@ struct nsEmbellishData {
// the 'form' may also depend on the position of the outermost
// embellished ancestor, the set up of these values may require
// looking up the position of our ancestors.
nscoord leftSpace;
nscoord rightSpace;
nscoord leadingSpace;
nscoord trailingSpace;
nsEmbellishData() {
flags = 0;
coreFrame = nsnull;
direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
leftSpace = 0;
rightSpace = 0;
leadingSpace = 0;
trailingSpace = 0;
}
};
@ -330,6 +330,9 @@ struct nsPresentationData {
// This bit is set if the frame is "space-like", as defined by the spec.
#define NS_MATHML_SPACE_LIKE 0x00000040U
// This bit is set if the directionality of the frame is right-to-left
#define NS_MATHML_RTL 0x00000080U
// This bit is set when the frame cannot be formatted due to an
// error (e.g., invalid markup such as a <msup> without an overscript).
// When set, a visual feedback will be provided to the user.
@ -364,6 +367,9 @@ struct nsPresentationData {
#define NS_MATHML_IS_SPACE_LIKE(_flags) \
(NS_MATHML_SPACE_LIKE == ((_flags) & NS_MATHML_SPACE_LIKE))
#define NS_MATHML_IS_RTL(_flags) \
(NS_MATHML_RTL == ((_flags) & NS_MATHML_RTL))
#define NS_MATHML_HAS_ERROR(_flags) \
(NS_MATHML_ERROR == ((_flags) & NS_MATHML_ERROR))

View File

@ -1703,7 +1703,8 @@ nsMathMLChar::Stretch(nsPresContext* aPresContext,
nsStretchDirection aStretchDirection,
const nsBoundingMetrics& aContainerSize,
nsBoundingMetrics& aDesiredStretchSize,
PRUint32 aStretchHint)
PRUint32 aStretchHint,
bool aRTL)
{
NS_ASSERTION(!(aStretchHint &
~(NS_STRETCH_VARIABLE_MASK | NS_STRETCH_LARGEOP |
@ -1711,6 +1712,7 @@ nsMathMLChar::Stretch(nsPresContext* aPresContext,
"Unexpected stretch flags");
mDrawNormal = true;
mMirrored = aRTL && nsMathMLOperators::IsMirrorableOperator(mData);
mScaleY = mScaleX = 1.0;
mDirection = aStretchDirection;
nsresult rv =
@ -1796,10 +1798,11 @@ nsMathMLChar::ComposeChildren(nsPresContext* aPresContext,
child->mDirection = mDirection;
child->mStyleContext = mStyleContext;
child->mGlyphTable = aGlyphTable; // the child is associated to this table
child->mMirrored = mMirrored;
// there goes the Stretch() ...
nsBoundingMetrics childSize;
nsresult rv = child->Stretch(aPresContext, aRenderingContext, mDirection,
splitSize, childSize, aStretchHint);
splitSize, childSize, aStretchHint, mMirrored);
// check if something went wrong or the child couldn't fit in the alloted space
if (NS_FAILED(rv) || (NS_STRETCH_DIRECTION_UNSUPPORTED == child->mDirection)) {
delete mSibling; // don't leave a dangling list behind ...
@ -2028,8 +2031,13 @@ void
nsMathMLChar::ApplyTransforms(nsRenderingContext& aRenderingContext, nsRect &r)
{
// apply the transforms
aRenderingContext.Translate(r.TopLeft());
aRenderingContext.Scale(mScaleX, mScaleY);
if (mMirrored) {
aRenderingContext.Translate(r.TopRight());
aRenderingContext.Scale(-mScaleX, mScaleY);
} else {
aRenderingContext.Translate(r.TopLeft());
aRenderingContext.Scale(mScaleX, mScaleY);
}
// update the bounding rectangle.
r.x = r.y = 0;

View File

@ -112,6 +112,7 @@ public:
mUnscaledAscent = 0;
mScaleX = mScaleY = 1.0;
mDrawNormal = true;
mMirrored = false;
}
~nsMathMLChar() { // not a virtual destructor: this class is not intended to be subclassed
@ -146,7 +147,8 @@ public:
nsStretchDirection aStretchDirection,
const nsBoundingMetrics& aContainerSize,
nsBoundingMetrics& aDesiredStretchSize,
PRUint32 aStretchHint = NS_STRETCH_NORMAL);
PRUint32 aStretchHint,
bool aRTL);
void
SetData(nsPresContext* aPresContext,
@ -258,6 +260,8 @@ private:
float mScaleX, mScaleY;
// mDrawNormal indicates whether we use special glyphs or not.
bool mDrawNormal;
// mMirrored indicates whether the character is mirrored.
bool mMirrored;
class StretchEnumContext;
friend class StretchEnumContext;

View File

@ -445,11 +445,13 @@ nsMathMLContainerFrame::Stretch(nsRenderingContext& aRenderingContext,
nsEmbellishData coreData;
GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
mBoundingMetrics.width += coreData.leftSpace + coreData.rightSpace;
mBoundingMetrics.width +=
coreData.leadingSpace + coreData.trailingSpace;
aDesiredStretchSize.width = mBoundingMetrics.width;
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
nscoord dx = coreData.leftSpace;
nscoord dx = (NS_MATHML_IS_RTL(mPresentationData.flags) ?
coreData.trailingSpace : coreData.leadingSpace);
if (dx != 0) {
mBoundingMetrics.leftBearing += dx;
mBoundingMetrics.rightBearing += dx;
@ -1193,20 +1195,21 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
public:
explicit RowChildFrameIterator(nsMathMLContainerFrame* aParentFrame) :
mParentFrame(aParentFrame),
mChildFrame(aParentFrame->mFrames.FirstChild()),
mX(0),
mCarrySpace(0),
mFromFrameType(eMathMLFrameType_UNKNOWN)
mFromFrameType(eMathMLFrameType_UNKNOWN),
mRTL(NS_MATHML_IS_RTL(aParentFrame->mPresentationData.flags))
{
if (!mRTL) {
mChildFrame = aParentFrame->mFrames.FirstChild();
} else {
mChildFrame = aParentFrame->mFrames.LastChild();
}
if (!mChildFrame)
return;
InitMetricsForChild();
// Remove left correction in <msqrt> because the sqrt glyph itself is
// there first.
if (mParentFrame->GetContent()->Tag() == nsGkAtoms::msqrt_) {
mX = 0;
}
}
RowChildFrameIterator& operator++()
@ -1214,7 +1217,12 @@ public:
// add child size + italic correction
mX += mSize.mBoundingMetrics.width + mItalicCorrection;
mChildFrame = mChildFrame->GetNextSibling();
if (!mRTL) {
mChildFrame = mChildFrame->GetNextSibling();
} else {
mChildFrame = mChildFrame->GetPrevSibling();
}
if (!mChildFrame)
return *this;
@ -1251,16 +1259,29 @@ private:
PRInt32 mCarrySpace;
eMathMLFrameType mFromFrameType;
bool mRTL;
void InitMetricsForChild()
{
GetReflowAndBoundingMetricsFor(mChildFrame, mSize, mSize.mBoundingMetrics,
&mChildFrameType);
nscoord leftCorrection;
GetItalicCorrection(mSize.mBoundingMetrics, leftCorrection,
mItalicCorrection);
nscoord leftCorrection, rightCorrection;
GetItalicCorrection(mSize.mBoundingMetrics,
leftCorrection, rightCorrection);
if (!mChildFrame->GetPrevSibling() &&
mParentFrame->GetContent()->Tag() == nsGkAtoms::msqrt_) {
// Remove leading correction in <msqrt> because the sqrt glyph itself is
// there first.
if (!mRTL) {
leftCorrection = 0;
} else {
rightCorrection = 0;
}
}
// add left correction -- this fixes the problem of the italic 'f'
// e.g., <mo>q</mo> <mi>f</mi> <mo>I</mo>
mX += leftCorrection;
mItalicCorrection = rightCorrection;
}
};
@ -1509,8 +1530,8 @@ nsMathMLContainerFrame::TransmitAutomaticDataForMrowLikeElement()
mEmbellishData.flags = 0;
mEmbellishData.coreFrame = nsnull;
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
mEmbellishData.leftSpace = 0;
mEmbellishData.rightSpace = 0;
mEmbellishData.leadingSpace = 0;
mEmbellishData.trailingSpace = 0;
}
if (childFrame || embellishedOpFound) {

View File

@ -193,6 +193,14 @@ public:
nsIAtom* aAttribute,
PRInt32 aModType);
// helper function to apply mirroring to a horizontal coordinate, if needed.
nscoord
MirrorIfRTL(nscoord aParentWidth, nscoord aChildWidth, nscoord aChildLeading)
{
return (NS_MATHML_IS_RTL(mPresentationData.flags) ?
aParentWidth - aChildWidth - aChildLeading : aChildLeading);
}
// --------------------------------------------------------------------------
// Additional methods

View File

@ -21,6 +21,7 @@
*
* Contributor(s):
* Roger B. Sidje <rbs@maths.uq.edu.au>
* Frederic Wang <fred.wang@free.fr>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -88,14 +89,45 @@ nsMathMLFrame::FindAttrDisplaystyle(nsIContent* aContent,
// no reset if the attr isn't found. so be sure to call it on inherited flags
}
// snippet of code used by the tags where the dir attribute is allowed.
/* static */ void
nsMathMLFrame::FindAttrDirectionality(nsIContent* aContent,
nsPresentationData& aPresentationData)
{
NS_ASSERTION(aContent->Tag() == nsGkAtoms::math ||
aContent->Tag() == nsGkAtoms::mrow_ ||
aContent->Tag() == nsGkAtoms::mstyle_ ||
aContent->Tag() == nsGkAtoms::mi_ ||
aContent->Tag() == nsGkAtoms::mn_ ||
aContent->Tag() == nsGkAtoms::mo_ ||
aContent->Tag() == nsGkAtoms::mtext_ ||
aContent->Tag() == nsGkAtoms::ms_, "bad caller");
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::ltr, &nsGkAtoms::rtl, nsnull};
// see if the explicit dir attribute is there
switch (aContent->FindAttrValueIn(kNameSpaceID_None,
nsGkAtoms::dir, strings, eCaseMatters))
{
case 0:
aPresentationData.flags &= ~NS_MATHML_RTL;
break;
case 1:
aPresentationData.flags |= NS_MATHML_RTL;
break;
}
// no reset if the attr isn't found. so be sure to call it on inherited flags
}
NS_IMETHODIMP
nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent)
{
mEmbellishData.flags = 0;
mEmbellishData.coreFrame = nsnull;
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
mEmbellishData.leftSpace = 0;
mEmbellishData.rightSpace = 0;
mEmbellishData.leadingSpace = 0;
mEmbellishData.trailingSpace = 0;
mPresentationData.flags = 0;
mPresentationData.baseFrame = nsnull;
@ -108,6 +140,9 @@ nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent)
if (NS_MATHML_IS_DISPLAYSTYLE(parentData.flags)) {
mPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
}
if (NS_MATHML_IS_RTL(parentData.flags)) {
mPresentationData.flags |= NS_MATHML_RTL;
}
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
@ -120,6 +155,10 @@ NS_IMETHODIMP
nsMathMLFrame::UpdatePresentationData(PRUint32 aFlagsValues,
PRUint32 aWhichFlags)
{
NS_ASSERTION(NS_MATHML_IS_DISPLAYSTYLE(aWhichFlags) ||
NS_MATHML_IS_COMPRESSED(aWhichFlags),
"aWhichFlags should only be displaystyle or compression flag");
// update flags that are relevant to this call
if (NS_MATHML_IS_DISPLAYSTYLE(aWhichFlags)) {
// updating the displaystyle flag is allowed
@ -172,8 +211,8 @@ nsMathMLFrame::GetEmbellishDataFrom(nsIFrame* aFrame,
aEmbellishData.flags = 0;
aEmbellishData.coreFrame = nsnull;
aEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
aEmbellishData.leftSpace = 0;
aEmbellishData.rightSpace = 0;
aEmbellishData.leadingSpace = 0;
aEmbellishData.trailingSpace = 0;
if (aFrame && aFrame->IsFrameOfType(nsIFrame::eMathML)) {
nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame);
@ -221,6 +260,7 @@ nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame,
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
}
FindAttrDisplaystyle(content, aPresentationData);
FindAttrDirectionality(content, aPresentationData);
aPresentationData.mstyle = frame->GetFirstContinuation();
break;
}

View File

@ -21,6 +21,7 @@
*
* Contributor(s):
* Roger B. Sidje <rbs@maths.uq.edu.au>
* Frederic Wang <fred.wang@free.fr>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -168,6 +169,11 @@ public:
FindAttrDisplaystyle(nsIContent* aContent,
nsPresentationData& aPresentationData);
// helper used to see if an element has a dir attribute
static void
FindAttrDirectionality(nsIContent* aContent,
nsPresentationData& aPresentationData);
// helper to check if a content has an attribute. If content is nsnull or if
// the attribute is not there, check if the attribute is on the mstyle hierarchy
// @return true --if attribute exists

View File

@ -54,16 +54,16 @@
struct OperatorData {
OperatorData(void)
: mFlags(0),
mLeftSpace(0.0f),
mRightSpace(0.0f)
mLeadingSpace(0.0f),
mTrailingSpace(0.0f)
{
}
// member data
nsString mStr;
nsOperatorFlags mFlags;
float mLeftSpace; // unit is em
float mRightSpace; // unit is em
float mLeadingSpace; // unit is em
float mTrailingSpace; // unit is em
};
static PRInt32 gTableRefCount = 0;
@ -117,6 +117,8 @@ SetBooleanProperty(OperatorData* aOperatorData,
aOperatorData->mFlags |= NS_MATHML_OPERATOR_SYMMETRIC;
else if (aName.EqualsLiteral("integral"))
aOperatorData->mFlags |= NS_MATHML_OPERATOR_INTEGRAL;
else if (aName.EqualsLiteral("mirrorable"))
aOperatorData->mFlags |= NS_MATHML_OPERATOR_MIRRORABLE;
}
static void
@ -139,11 +141,11 @@ SetProperty(OperatorData* aOperatorData,
aOperatorData->mFlags |= NS_MATHML_OPERATOR_DIRECTION_HORIZONTAL;
else return; // invalid value
} else {
bool isLeftSpace;
bool isLeadingSpace;
if (aName.EqualsLiteral("lspace"))
isLeftSpace = true;
isLeadingSpace = true;
else if (aName.EqualsLiteral("rspace"))
isLeftSpace = false;
isLeadingSpace = false;
else return; // input is not applicable
// aValue is assumed to be a digit from 0 to 7
@ -151,10 +153,10 @@ SetProperty(OperatorData* aOperatorData,
float space = aValue.ToFloat(&error) / 18.0;
if (error) return;
if (isLeftSpace)
aOperatorData->mLeftSpace = space;
if (isLeadingSpace)
aOperatorData->mLeadingSpace = space;
else
aOperatorData->mRightSpace = space;
aOperatorData->mTrailingSpace = space;
}
}
@ -409,14 +411,14 @@ bool
nsMathMLOperators::LookupOperator(const nsString& aOperator,
const nsOperatorFlags aForm,
nsOperatorFlags* aFlags,
float* aLeftSpace,
float* aRightSpace)
float* aLeadingSpace,
float* aTrailingSpace)
{
if (!gInitialized) {
InitGlobals();
}
if (gOperatorTable) {
NS_ASSERTION(aFlags && aLeftSpace && aRightSpace, "bad usage");
NS_ASSERTION(aFlags && aLeadingSpace && aTrailingSpace, "bad usage");
NS_ASSERTION(aForm > 0 && aForm < 4, "*** invalid call ***");
// The MathML REC says:
@ -441,8 +443,8 @@ nsMathMLOperators::LookupOperator(const nsString& aOperator,
}
if (found) {
NS_ASSERTION(found->mStr.Equals(aOperator), "bad setup");
*aLeftSpace = found->mLeftSpace;
*aRightSpace = found->mRightSpace;
*aLeadingSpace = found->mLeadingSpace;
*aTrailingSpace = found->mTrailingSpace;
*aFlags &= ~NS_MATHML_OPERATOR_FORM; // clear the form bits
*aFlags |= found->mFlags; // just add bits without overwriting
return true;
@ -454,44 +456,44 @@ nsMathMLOperators::LookupOperator(const nsString& aOperator,
void
nsMathMLOperators::LookupOperators(const nsString& aOperator,
nsOperatorFlags* aFlags,
float* aLeftSpace,
float* aRightSpace)
float* aLeadingSpace,
float* aTrailingSpace)
{
if (!gInitialized) {
InitGlobals();
}
aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = 0;
aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
aLeadingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
aTrailingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0;
aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
aLeadingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
aTrailingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = 0;
aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
aLeadingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
aTrailingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
if (gOperatorTable) {
OperatorData* found;
found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_INFIX);
if (found) {
aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = found->mFlags;
aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mLeftSpace;
aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mRightSpace;
aLeadingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mLeadingSpace;
aTrailingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mTrailingSpace;
}
found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_POSTFIX);
if (found) {
aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mFlags;
aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mLeftSpace;
aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mRightSpace;
aLeadingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mLeadingSpace;
aTrailingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mTrailingSpace;
}
found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_PREFIX);
if (found) {
aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mFlags;
aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mLeftSpace;
aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mRightSpace;
aLeadingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mLeadingSpace;
aTrailingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mTrailingSpace;
}
}
}
@ -515,6 +517,20 @@ nsMathMLOperators::IsMutableOperator(const nsString& aOperator)
NS_MATHML_OPERATOR_IS_LARGEOP(allFlags);
}
/* static */ bool
nsMathMLOperators::IsMirrorableOperator(const nsString& aOperator)
{
// LookupOperator will search infix, postfix and prefix forms of aOperator and
// return the first form found. It is assumed that all these forms have same
// mirrorability.
nsOperatorFlags flags = 0;
float dummy;
nsMathMLOperators::LookupOperator(aOperator,
NS_MATHML_OPERATOR_FORM_INFIX,
&flags, &dummy, &dummy);
return NS_MATHML_OPERATOR_IS_MIRRORABLE(flags);
}
/* static */ nsStretchDirection
nsMathMLOperators::GetStretchyDirection(const nsString& aOperator)
{

View File

@ -81,12 +81,13 @@ enum {
NS_MATHML_OPERATOR_MOVABLELIMITS = 1<<9,
NS_MATHML_OPERATOR_SYMMETRIC = 1<<10,
NS_MATHML_OPERATOR_INTEGRAL = 1<<11,
NS_MATHML_OPERATOR_MIRRORABLE = 1<<12,
// Additional bits not stored in the dictionary
NS_MATHML_OPERATOR_MINSIZE_ABSOLUTE = 1<<12,
NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE = 1<<13,
NS_MATHML_OPERATOR_LEFTSPACE_ATTR = 1<<14,
NS_MATHML_OPERATOR_RIGHTSPACE_ATTR = 1<<15
NS_MATHML_OPERATOR_MINSIZE_ABSOLUTE = 1<<13,
NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE = 1<<14,
NS_MATHML_OPERATOR_LSPACE_ATTR = 1<<15,
NS_MATHML_OPERATOR_RSPACE_ATTR = 1<<16
};
#define NS_MATHML_OPERATOR_SIZE_INFINITY NS_IEEEPositiveInfinity()
@ -129,26 +130,31 @@ public:
LookupOperator(const nsString& aOperator,
const nsOperatorFlags aForm,
nsOperatorFlags* aFlags,
float* aLeftSpace,
float* aRightSpace);
float* aLeadingSpace,
float* aTrailingSpace);
// LookupOperators:
// Helper to return all the forms under which an operator is listed in the
// Operator Dictionary. The caller must pass arrays of size 4, and use
// aFlags[NS_MATHML_OPERATOR_FORM_{INFIX|POSTFIX|PREFIX}], aLeftSpace[], etc,
// to access the attributes of the operator under a particular form. If the
// operator wasn't found under a form, its entry aFlags[form] is set to zero.
// aFlags[NS_MATHML_OPERATOR_FORM_{INFIX|POSTFIX|PREFIX}],
// aLeadingSpace[], etc, to access the attributes of the operator under a
// particular form. If the operator wasn't found under a form, its entry
// aFlags[form] is set to zero.
static void
LookupOperators(const nsString& aOperator,
nsOperatorFlags* aFlags,
float* aLeftSpace,
float* aRightSpace);
float* aLeadingSpace,
float* aTrailingSpace);
// IsMutableOperator:
// Return true if the operator exists and is stretchy or largeop
static bool
IsMutableOperator(const nsString& aOperator);
// Helper functions used by the nsMathMLChar class.
static bool
IsMirrorableOperator(const nsString& aOperator);
// Helper function used by the nsMathMLChar class.
static nsStretchDirection GetStretchyDirection(const nsString& aOperator);
@ -229,16 +235,19 @@ public:
#define NS_MATHML_OPERATOR_IS_INTEGRAL(_flags) \
(NS_MATHML_OPERATOR_INTEGRAL == ((_flags) & NS_MATHML_OPERATOR_INTEGRAL))
#define NS_MATHML_OPERATOR_IS_MIRRORABLE(_flags) \
(NS_MATHML_OPERATOR_MIRRORABLE == ((_flags) & NS_MATHML_OPERATOR_MIRRORABLE))
#define NS_MATHML_OPERATOR_MINSIZE_IS_ABSOLUTE(_flags) \
(NS_MATHML_OPERATOR_MINSIZE_ABSOLUTE == ((_flags) & NS_MATHML_OPERATOR_MINSIZE_ABSOLUTE))
#define NS_MATHML_OPERATOR_MAXSIZE_IS_ABSOLUTE(_flags) \
(NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE == ((_flags) & NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE))
#define NS_MATHML_OPERATOR_HAS_LEFTSPACE_ATTR(_flags) \
(NS_MATHML_OPERATOR_LEFTSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_LEFTSPACE_ATTR))
#define NS_MATHML_OPERATOR_HAS_LSPACE_ATTR(_flags) \
(NS_MATHML_OPERATOR_LSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_LSPACE_ATTR))
#define NS_MATHML_OPERATOR_HAS_RIGHTSPACE_ATTR(_flags) \
(NS_MATHML_OPERATOR_RIGHTSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_RIGHTSPACE_ATTR))
#define NS_MATHML_OPERATOR_HAS_RSPACE_ATTR(_flags) \
(NS_MATHML_OPERATOR_RSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_RSPACE_ATTR))
#endif /* nsMathMLOperators_h___ */

View File

@ -22,6 +22,7 @@
* Contributor(s):
* Roger B. Sidje <rbs@maths.uq.edu.au>
* Karl Tomlinson <karlt+@karlt.net>, Mozilla Corporation
* Frederic Wang <fred.wang@free.fr>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -64,6 +65,11 @@ nsMathMLTokenFrame::InheritAutomaticData(nsIFrame* aParent)
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aParent);
if (mContent->Tag() != nsGkAtoms::mspace_) {
// see if the directionality attribute is there
nsMathMLFrame::FindAttrDirectionality(mContent, mPresentationData);
}
ProcessTextData();
return NS_OK;

View File

@ -241,7 +241,8 @@ nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsRect rect;
mMathMLChar[mRadicalCharIndex].GetRect(rect);
rect.MoveBy(rect.width, 0);
rect.MoveBy(NS_MATHML_IS_RTL(mPresentationData.flags) ?
-mContentWidth : rect.width, 0);
rect.SizeTo(mContentWidth, mRuleThickness);
rv = DisplayBar(aBuilder, this, rect, aLists);
NS_ENSURE_SUCCESS(rv, rv);
@ -496,7 +497,7 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
mMathMLChar[mLongDivCharIndex].Stretch(PresContext(), aRenderingContext,
NS_STRETCH_DIRECTION_VERTICAL,
contSize, bmLongdivChar,
NS_STRETCH_LARGER);
NS_STRETCH_LARGER, false);
mMathMLChar[mLongDivCharIndex].GetBoundingMetrics(bmLongdivChar);
// Update horizontal parameters
@ -518,12 +519,15 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
///////////////
// radical notation:
if (IsToDraw(NOTATION_RADICAL)) {
nscoord *dx_leading =
NS_MATHML_IS_RTL(mPresentationData.flags) ? &dx_right : &dx_left;
if (aWidthOnly) {
nscoord radical_width = mMathMLChar[mRadicalCharIndex].
GetMaxWidth(PresContext(), aRenderingContext);
// Update horizontal parameters
dx_left = NS_MAX(dx_left, radical_width);
*dx_leading = NS_MAX(*dx_leading, radical_width);
} else {
// Stretch the radical symbol to the appropriate height if it is not
// big enough.
@ -535,11 +539,12 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
mMathMLChar[mRadicalCharIndex].Stretch(PresContext(), aRenderingContext,
NS_STRETCH_DIRECTION_VERTICAL,
contSize, bmRadicalChar,
NS_STRETCH_LARGER);
NS_STRETCH_LARGER,
NS_MATHML_IS_RTL(mPresentationData.flags));
mMathMLChar[mRadicalCharIndex].GetBoundingMetrics(bmRadicalChar);
// Update horizontal parameters
dx_left = NS_MAX(dx_left, bmRadicalChar.width);
*dx_leading = NS_MAX(*dx_leading, bmRadicalChar.width);
// Update vertical parameters
radicalAscent = bmBase.ascent + psi + mRuleThickness;
@ -653,14 +658,17 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
bmLongdivChar.ascent +
bmLongdivChar.descent));
if (IsToDraw(NOTATION_RADICAL))
mMathMLChar[mRadicalCharIndex].SetRect(nsRect(dx_left -
bmRadicalChar.width,
if (IsToDraw(NOTATION_RADICAL)) {
nscoord dx = NS_MATHML_IS_RTL(mPresentationData.flags) ?
dx_left + bmBase.width : dx_left - bmRadicalChar.width;
mMathMLChar[mRadicalCharIndex].SetRect(nsRect(dx,
aDesiredSize.ascent -
radicalAscent,
bmRadicalChar.width,
bmRadicalChar.ascent +
bmRadicalChar.descent));
}
mContentWidth = bmBase.width;

View File

@ -357,23 +357,25 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
containerSize.ascent = delta + axisHeight;
containerSize.descent = delta - axisHeight;
bool isRTL = NS_MATHML_IS_RTL(mPresentationData.flags);
/////////////////
// opening fence ...
ReflowChar(aPresContext, *aReflowState.rendContext, mOpenChar,
NS_MATHML_OPERATOR_FORM_PREFIX, font->mScriptLevel,
axisHeight, leading, em, containerSize, ascent, descent);
axisHeight, leading, em, containerSize, ascent, descent, isRTL);
/////////////////
// separators ...
for (i = 0; i < mSeparatorsCount; i++) {
ReflowChar(aPresContext, *aReflowState.rendContext, &mSeparatorsChar[i],
NS_MATHML_OPERATOR_FORM_INFIX, font->mScriptLevel,
axisHeight, leading, em, containerSize, ascent, descent);
axisHeight, leading, em, containerSize, ascent, descent, isRTL);
}
/////////////////
// closing fence ...
ReflowChar(aPresContext, *aReflowState.rendContext, mCloseChar,
NS_MATHML_OPERATOR_FORM_POSTFIX, font->mScriptLevel,
axisHeight, leading, em, containerSize, ascent, descent);
axisHeight, leading, em, containerSize, ascent, descent, isRTL);
//////////////////
// Adjust the origins of each child.
@ -383,13 +385,26 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
nscoord dx = 0;
nsBoundingMetrics bm;
bool firstTime = true;
if (mOpenChar) {
PlaceChar(mOpenChar, ascent, bm, dx);
nsMathMLChar *leftChar, *rightChar;
if (isRTL) {
leftChar = mCloseChar;
rightChar = mOpenChar;
} else {
leftChar = mOpenChar;
rightChar = mCloseChar;
}
if (leftChar) {
PlaceChar(leftChar, ascent, bm, dx);
aDesiredSize.mBoundingMetrics = bm;
firstTime = false;
}
childFrame = firstChild;
if (isRTL) {
childFrame = this->GetLastChild(nsIFrame::kPrincipalList);
} else {
childFrame = firstChild;
}
while (childFrame) {
nsHTMLReflowMetrics childSize;
GetReflowAndBoundingMetricsFor(childFrame, childSize, bm);
@ -405,16 +420,21 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
dx += childSize.width;
if (i < mSeparatorsCount) {
PlaceChar(&mSeparatorsChar[i], ascent, bm, dx);
PlaceChar(&mSeparatorsChar[isRTL ? mSeparatorsCount - 1 - i : i],
ascent, bm, dx);
aDesiredSize.mBoundingMetrics += bm;
}
i++;
childFrame = childFrame->GetNextSibling();
if (isRTL) {
childFrame = childFrame->GetPrevSibling();
} else {
childFrame = childFrame->GetNextSibling();
}
}
if (mCloseChar) {
PlaceChar(mCloseChar, ascent, bm, dx);
if (rightChar) {
PlaceChar(rightChar, ascent, bm, dx);
if (firstTime)
aDesiredSize.mBoundingMetrics = bm;
else
@ -480,7 +500,8 @@ nsMathMLmfencedFrame::ReflowChar(nsPresContext* aPresContext,
nscoord em,
nsBoundingMetrics& aContainerSize,
nscoord& aAscent,
nscoord& aDescent)
nscoord& aDescent,
bool aRTL)
{
if (aMathMLChar && 0 < aMathMLChar->Length()) {
nscoord leftSpace;
@ -491,7 +512,8 @@ nsMathMLmfencedFrame::ReflowChar(nsPresContext* aPresContext,
nsBoundingMetrics charSize;
nsresult res = aMathMLChar->Stretch(aPresContext, aRenderingContext,
NS_STRETCH_DIRECTION_VERTICAL,
aContainerSize, charSize);
aContainerSize, charSize,
NS_STRETCH_NORMAL, aRTL);
if (NS_STRETCH_DIRECTION_UNSUPPORTED != aMathMLChar->GetStretchDirection()) {
// has changed... so center the char around the axis

View File

@ -105,7 +105,8 @@ public:
nscoord em,
nsBoundingMetrics& aContainerSize,
nscoord& aAscent,
nscoord& aDescent);
nscoord& aDescent,
bool aRTL);
static void
PlaceChar(nsMathMLChar* aMathMLChar,

View File

@ -272,8 +272,12 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
// container (we fetch values from the core since they may use units that
// depend on style data, and style changes could have occurred in the
// core since our last visit there)
nscoord leftSpace = NS_MAX(onePixel, coreData.leftSpace);
nscoord rightSpace = NS_MAX(onePixel, coreData.rightSpace);
nscoord leftSpace = NS_MAX(onePixel,
NS_MATHML_IS_RTL(mPresentationData.flags) ?
coreData.trailingSpace : coreData.leadingSpace);
nscoord rightSpace = NS_MAX(onePixel,
NS_MATHML_IS_RTL(mPresentationData.flags) ?
coreData.leadingSpace : coreData.trailingSpace);
//////////////////
// Get shifts
@ -422,8 +426,8 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
nscoord slashMinHeight = slashRatio *
NS_MIN(2 * mLineThickness, slashMaxWidthConstant);
nscoord leftSpace = NS_MAX(padding, coreData.leftSpace);
nscoord rightSpace = NS_MAX(padding, coreData.rightSpace);
nscoord leadingSpace = NS_MAX(padding, coreData.leadingSpace);
nscoord trailingSpace = NS_MAX(padding, coreData.trailingSpace);
nscoord delta;
// ___________
@ -484,11 +488,16 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
}
// Set horizontal bounding metrics
mBoundingMetrics.leftBearing = leftSpace + bmNum.leftBearing;
mBoundingMetrics.rightBearing =
leftSpace + bmNum.width + mLineRect.width + bmDen.rightBearing;
if (NS_MATHML_IS_RTL(mPresentationData.flags)) {
mBoundingMetrics.leftBearing = trailingSpace + bmDen.leftBearing;
mBoundingMetrics.rightBearing = trailingSpace + bmDen.width + mLineRect.width + bmNum.rightBearing;
} else {
mBoundingMetrics.leftBearing = leadingSpace + bmNum.leftBearing;
mBoundingMetrics.rightBearing = leadingSpace + bmNum.width + mLineRect.width + bmDen.rightBearing;
}
mBoundingMetrics.width =
leftSpace + bmNum.width + mLineRect.width + bmDen.width + rightSpace;
leadingSpace + bmNum.width + mLineRect.width + bmDen.width +
trailingSpace;
// Set aDesiredSize
aDesiredSize.ascent = mBoundingMetrics.ascent + padding;
@ -501,18 +510,26 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
mReference.y = aDesiredSize.ascent;
if (aPlaceOrigin) {
FinishReflowChild(frameNum, presContext, nsnull, sizeNum,
leftSpace,
aDesiredSize.ascent - numShift - sizeNum.ascent, 0);
nscoord dx, dy;
mLineRect.SetRect(leftSpace + bmNum.width,
aDesiredSize.ascent - mBoundingMetrics.ascent,
mLineRect.width,
aDesiredSize.height - 2 * padding);
// place numerator
dx = MirrorIfRTL(aDesiredSize.width, sizeNum.width,
leadingSpace);
dy = aDesiredSize.ascent - numShift - sizeNum.ascent;
FinishReflowChild(frameNum, presContext, nsnull, sizeNum, dx, dy, 0);
FinishReflowChild(frameDen, presContext, nsnull, sizeDen,
leftSpace + bmNum.width + mLineRect.width,
aDesiredSize.ascent + denShift - sizeDen.ascent, 0);
// place the fraction bar
dx = MirrorIfRTL(aDesiredSize.width, mLineRect.width,
leadingSpace + bmNum.width);
dy = aDesiredSize.ascent - mBoundingMetrics.ascent;
mLineRect.SetRect(dx, dy,
mLineRect.width, aDesiredSize.height - 2 * padding);
// place denominator
dx = MirrorIfRTL(aDesiredSize.width, sizeDen.width,
leadingSpace + bmNum.width + mLineRect.width);
dy = aDesiredSize.ascent + denShift - sizeDen.ascent;
FinishReflowChild(frameDen, presContext, nsnull, sizeDen, dx, dy, 0);
}
}
@ -549,8 +566,9 @@ class nsDisplayMathMLSlash : public nsDisplayItem {
public:
nsDisplayMathMLSlash(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, const nsRect& aRect,
nscoord aThickness)
: nsDisplayItem(aBuilder, aFrame), mRect(aRect), mThickness(aThickness) {
nscoord aThickness, bool aRTL)
: nsDisplayItem(aBuilder, aFrame), mRect(aRect), mThickness(aThickness),
mRTL(aRTL) {
MOZ_COUNT_CTOR(nsDisplayMathMLSlash);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -565,6 +583,7 @@ public:
private:
nsRect mRect;
nscoord mThickness;
bool mRTL;
};
void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
@ -581,10 +600,19 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
gfxContext *gfxCtx = aCtx->ThebesContext();
gfxPoint delta = gfxPoint(presContext->AppUnitsToGfxUnits(mThickness), 0);
gfxCtx->NewPath();
gfxCtx->MoveTo(rect.BottomLeft());
gfxCtx->LineTo(rect.BottomLeft() + delta);
gfxCtx->LineTo(rect.TopRight());
gfxCtx->LineTo(rect.TopRight() - delta);
if (mRTL) {
gfxCtx->MoveTo(rect.TopLeft());
gfxCtx->LineTo(rect.TopLeft() + delta);
gfxCtx->LineTo(rect.BottomRight());
gfxCtx->LineTo(rect.BottomRight() - delta);
} else {
gfxCtx->MoveTo(rect.BottomLeft());
gfxCtx->LineTo(rect.BottomLeft() + delta);
gfxCtx->LineTo(rect.TopRight());
gfxCtx->LineTo(rect.TopRight() - delta);
}
gfxCtx->ClosePath();
gfxCtx->Fill();
}
@ -596,7 +624,8 @@ nsMathMLmfracFrame::DisplaySlash(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
if (!aFrame->GetStyleVisibility()->IsVisible() || aRect.IsEmpty())
return NS_OK;
return aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayMathMLSlash(aBuilder, aFrame, aRect, aThickness));
nsDisplayMathMLSlash(aBuilder, aFrame, aRect, aThickness,
NS_MATHML_IS_RTL(mPresentationData.flags)));
}

View File

@ -417,7 +417,11 @@ nsMathMLmmultiscriptsFrame::Place(nsRenderingContext& aRenderingContext,
// place the base ...
childFrame = baseFrame;
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, PresContext(), nsnull, baseSize, dx, dy, 0);
FinishReflowChild (baseFrame, PresContext(), nsnull, baseSize,
MirrorIfRTL(aDesiredSize.width,
baseSize.width,
dx),
dy, 0);
dx += bmBase.width + italicCorrection;
}
else if (mprescriptsFrame != childFrame) {
@ -440,13 +444,21 @@ nsMathMLmmultiscriptsFrame::Place(nsRenderingContext& aRenderingContext,
dy = aDesiredSize.ascent - subScriptSize.ascent +
maxSubScriptShift;
FinishReflowChild (subScriptFrame, PresContext(), nsnull, subScriptSize,
dx + (width-subScriptSize.width)/2, dy, 0);
FinishReflowChild (subScriptFrame, PresContext(), nsnull,
subScriptSize,
MirrorIfRTL(aDesiredSize.width,
subScriptSize.width,
dx + (width-subScriptSize.width)/2),
dy, 0);
dy = aDesiredSize.ascent - supScriptSize.ascent -
maxSupScriptShift;
FinishReflowChild (supScriptFrame, PresContext(), nsnull, supScriptSize,
dx + (width-supScriptSize.width)/2, dy, 0);
FinishReflowChild (supScriptFrame, PresContext(), nsnull,
supScriptSize,
MirrorIfRTL(aDesiredSize.width,
supScriptSize.width,
dx + (width-supScriptSize.width)/2),
dy, 0);
dx += width + scriptSpace;
}

View File

@ -266,8 +266,8 @@ nsMathMLmoFrame::ProcessOperatorData()
// in case of dynamic changes
mEmbellishData.flags = 0;
mEmbellishData.coreFrame = nsnull;
mEmbellishData.leftSpace = 0;
mEmbellishData.rightSpace = 0;
mEmbellishData.leadingSpace = 0;
mEmbellishData.trailingSpace = 0;
if (mMathMLChar.Length() != 1)
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
// else... retain the native direction obtained in ProcessTextData()
@ -390,8 +390,8 @@ nsMathMLmoFrame::ProcessOperatorData()
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
GetEmHeight(fm, em);
mEmbellishData.leftSpace = NSToCoordRound(lspace * em);
mEmbellishData.rightSpace = NSToCoordRound(rspace * em);
mEmbellishData.leadingSpace = NSToCoordRound(lspace * em);
mEmbellishData.trailingSpace = NSToCoordRound(rspace * em);
// tuning if we don't want too much extra space when we are a script.
// (with its fonts, TeX sets lspace=0 & rspace=0 as soon as scriptlevel>0.
@ -399,22 +399,22 @@ nsMathMLmoFrame::ProcessOperatorData()
if (GetStyleFont()->mScriptLevel > 0) {
if (NS_MATHML_OPERATOR_EMBELLISH_IS_ISOLATED(mFlags)) {
// could be an isolated accent or script, e.g., x^{+}, just zero out
mEmbellishData.leftSpace = 0;
mEmbellishData.rightSpace = 0;
mEmbellishData.leadingSpace = 0;
mEmbellishData.trailingSpace = 0;
}
else if (!NS_MATHML_OPERATOR_HAS_EMBELLISH_ANCESTOR(mFlags)) {
mEmbellishData.leftSpace /= 2;
mEmbellishData.rightSpace /= 2;
mEmbellishData.leadingSpace /= 2;
mEmbellishData.trailingSpace /= 2;
}
}
}
}
// If we are an accent without explicit lspace="." or rspace=".",
// we will ignore our default left/right space
// we will ignore our default leading/trailing space
// lspace = number h-unit | namedspace
nscoord leftSpace = mEmbellishData.leftSpace;
nscoord leadingSpace = mEmbellishData.leadingSpace;
GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::lspace_,
value);
if (!value.IsEmpty()) {
@ -423,15 +423,15 @@ nsMathMLmoFrame::ProcessOperatorData()
ParseNamedSpaceValue(mPresentationData.mstyle, value, cssValue))
{
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
leftSpace = 0;
leadingSpace = 0;
else if (cssValue.IsLengthUnit())
leftSpace = CalcLength(presContext, mStyleContext, cssValue);
mFlags |= NS_MATHML_OPERATOR_LEFTSPACE_ATTR;
leadingSpace = CalcLength(presContext, mStyleContext, cssValue);
mFlags |= NS_MATHML_OPERATOR_LSPACE_ATTR;
}
}
// rspace = number h-unit | namedspace
nscoord rightSpace = mEmbellishData.rightSpace;
nscoord trailingSpace = mEmbellishData.trailingSpace;
GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::rspace_,
value);
if (!value.IsEmpty()) {
@ -440,26 +440,26 @@ nsMathMLmoFrame::ProcessOperatorData()
ParseNamedSpaceValue(mPresentationData.mstyle, value, cssValue))
{
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
rightSpace = 0;
trailingSpace = 0;
else if (cssValue.IsLengthUnit())
rightSpace = CalcLength(presContext, mStyleContext, cssValue);
mFlags |= NS_MATHML_OPERATOR_RIGHTSPACE_ATTR;
trailingSpace = CalcLength(presContext, mStyleContext, cssValue);
mFlags |= NS_MATHML_OPERATOR_RSPACE_ATTR;
}
}
// little extra tuning to round lspace & rspace to at least a pixel so that
// operators don't look as if they are colliding with their operands
if (leftSpace || rightSpace) {
if (leadingSpace || trailingSpace) {
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
if (leftSpace && leftSpace < onePixel)
leftSpace = onePixel;
if (rightSpace && rightSpace < onePixel)
rightSpace = onePixel;
if (leadingSpace && leadingSpace < onePixel)
leadingSpace = onePixel;
if (trailingSpace && trailingSpace < onePixel)
trailingSpace = onePixel;
}
// the values that we get from our attributes override the dictionary
mEmbellishData.leftSpace = leftSpace;
mEmbellishData.rightSpace = rightSpace;
mEmbellishData.leadingSpace = leadingSpace;
mEmbellishData.trailingSpace = trailingSpace;
// Now see if there are user-defined attributes that override the dictionary.
// XXX If an attribute can be forced to be true when it is false in the
@ -760,7 +760,10 @@ nsMathMLmoFrame::Stretch(nsRenderingContext& aRenderingContext,
// let the MathMLChar stretch itself...
nsresult res = mMathMLChar.Stretch(PresContext(), aRenderingContext,
aStretchDirection, container, charSize, stretchHint);
aStretchDirection, container, charSize,
stretchHint,
NS_MATHML_IS_RTL(mPresentationData.
flags));
if (NS_FAILED(res)) {
// gracefully handle cases where stretching the char failed (i.e., GetBoundingMetrics failed)
// clear our 'form' to behave as if the operator wasn't in the dictionary
@ -871,36 +874,39 @@ nsMathMLmoFrame::Stretch(nsRenderingContext& aRenderingContext,
if (!NS_MATHML_OPERATOR_HAS_EMBELLISH_ANCESTOR(mFlags)) {
// Account the spacing if we are not an accent with explicit attributes
nscoord leftSpace = mEmbellishData.leftSpace;
if (isAccent && !NS_MATHML_OPERATOR_HAS_LEFTSPACE_ATTR(mFlags)) {
leftSpace = 0;
nscoord leadingSpace = mEmbellishData.leadingSpace;
if (isAccent && !NS_MATHML_OPERATOR_HAS_LSPACE_ATTR(mFlags)) {
leadingSpace = 0;
}
nscoord rightSpace = mEmbellishData.rightSpace;
if (isAccent && !NS_MATHML_OPERATOR_HAS_RIGHTSPACE_ATTR(mFlags)) {
rightSpace = 0;
nscoord trailingSpace = mEmbellishData.trailingSpace;
if (isAccent && !NS_MATHML_OPERATOR_HAS_RSPACE_ATTR(mFlags)) {
trailingSpace = 0;
}
mBoundingMetrics.width += leftSpace + rightSpace;
mBoundingMetrics.width += leadingSpace + trailingSpace;
aDesiredStretchSize.width = mBoundingMetrics.width;
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
if (leftSpace) {
nscoord dx = (NS_MATHML_IS_RTL(mPresentationData.flags) ?
trailingSpace : leadingSpace);
if (dx) {
// adjust the offsets
mBoundingMetrics.leftBearing += leftSpace;
mBoundingMetrics.rightBearing += leftSpace;
aDesiredStretchSize.mBoundingMetrics.leftBearing += leftSpace;
aDesiredStretchSize.mBoundingMetrics.rightBearing += leftSpace;
mBoundingMetrics.leftBearing += dx;
mBoundingMetrics.rightBearing += dx;
aDesiredStretchSize.mBoundingMetrics.leftBearing += dx;
aDesiredStretchSize.mBoundingMetrics.rightBearing += dx;
if (useMathMLChar) {
nsRect rect;
mMathMLChar.GetRect(rect);
mMathMLChar.SetRect(nsRect(rect.x + leftSpace, rect.y, rect.width, rect.height));
mMathMLChar.SetRect(nsRect(rect.x + dx, rect.y,
rect.width, rect.height));
}
else {
nsIFrame* childFrame = firstChild;
while (childFrame) {
childFrame->SetPosition(childFrame->GetPosition()
+ nsPoint(leftSpace, 0));
childFrame->SetPosition(childFrame->GetPosition() +
nsPoint(dx, 0));
childFrame = childFrame->GetNextSibling();
}
}
@ -1011,10 +1017,10 @@ nsMathMLmoFrame::GetIntrinsicWidth(nsRenderingContext *aRenderingContext)
width = nsMathMLTokenFrame::GetIntrinsicWidth(aRenderingContext);
}
// leftSpace and rightSpace are actually applied to the outermost
// leadingSpace and trailingSpace are actually applied to the outermost
// embellished container but for determining total intrinsic width it should
// be safe to include it for the core here instead.
width += mEmbellishData.leftSpace + mEmbellishData.rightSpace;
width += mEmbellishData.leadingSpace + mEmbellishData.trailingSpace;
return width;
}

View File

@ -133,10 +133,11 @@ nsMathMLmpaddedFrame::ProcessAttributes()
}
// lspace
mLeftSpaceSign = NS_MATHML_SIGN_INVALID;
mLeadingSpaceSign = NS_MATHML_SIGN_INVALID;
GetAttribute(mContent, nsnull, nsGkAtoms::lspace_, value);
if (!value.IsEmpty()) {
ParseAttribute(value, mLeftSpaceSign, mLeftSpace, mLeftSpacePseudoUnit);
ParseAttribute(value, mLeadingSpaceSign, mLeadingSpace,
mLeadingSpacePseudoUnit);
}
// voffset
@ -380,23 +381,28 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
nscoord height = mBoundingMetrics.ascent;
nscoord depth = mBoundingMetrics.descent;
// In MathML2 (http://www.w3.org/TR/MathML2/chapter3.html#presm.mpadded),
// lspace is "the amount of space between the left edge of a bounding box
// and the start of the rendering of its contents' bounding box" and the
// default is zero.
// The REC says:
//
// In MathML3 draft
// http://www.w3.org/TR/2007/WD-MathML3-20070427/chapter3.html#id.3.3.6.2,
// lspace is "the amount of space between the left edge of the bounding box
// and the positioning poin [sic] of the mpadded element" and the default is
// "same as content".
// "The lspace attribute ('leading' space) specifies the horizontal location
// of the positioning point of the child content with respect to the
// positioning point of the mpadded element. By default they coincide, and
// therefore absolute values for lspace have the same effect as relative
// values."
//
// In both cases, "MathML renderers should ensure that, except for the
// effects of the attributes, relative spacing between the contents of
// mpadded and surrounding MathML elements is not modified by replacing an
// mpadded element with an mrow element with the same content."
// "MathML renderers should ensure that, except for the effects of the
// attributes, the relative spacing between the contents of the mpadded
// element and surrounding MathML elements would not be modified by replacing
// an mpadded element with an mrow element with the same content, even if
// linebreaking occurs within the mpadded element."
//
// (http://www.w3.org/TR/MathML/chapter3.html#presm.mpadded)
//
// "In those discussions, the terms leading and trailing are used to specify
// a side of an object when which side to use depends on the directionality;
// ie. leading means left in LTR but right in RTL."
// (http://www.w3.org/TR/MathML/chapter3.html#presm.bidi.math)
nscoord lspace = 0;
// In MATHML3, "width" will be the bounding box width and "advancewidth" will
// In MathML3, "width" will be the bounding box width and "advancewidth" will
// refer "to the horizontal distance between the positioning point of the
// mpadded and the positioning point for the following content". MathML2
// doesn't make the distinction.
@ -404,6 +410,7 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
nscoord voffset = 0;
PRInt32 pseudoUnit;
nscoord initialWidth = width;
// update width
pseudoUnit = (mWidthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
@ -427,9 +434,9 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
depth = NS_MAX(0, depth);
// update lspace
if (mLeftSpacePseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
pseudoUnit = mLeftSpacePseudoUnit;
UpdateValue(mLeftSpaceSign, pseudoUnit, mLeftSpace,
if (mLeadingSpacePseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
pseudoUnit = mLeadingSpacePseudoUnit;
UpdateValue(mLeadingSpaceSign, pseudoUnit, mLeadingSpace,
mBoundingMetrics, lspace);
}
@ -445,20 +452,25 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
// attributes, tweak our metrics and move children to achieve the desired visual
// effects.
if (mLeftSpaceSign != NS_MATHML_SIGN_INVALID) { // there was padding on the left
// dismiss the left italic correction now (so that our parent won't correct us)
if ((NS_MATHML_IS_RTL(mPresentationData.flags) ?
mWidthSign : mLeadingSpaceSign) != NS_MATHML_SIGN_INVALID) {
// there was padding on the left. dismiss the left italic correction now
// (so that our parent won't correct us)
mBoundingMetrics.leftBearing = 0;
}
if (mWidthSign != NS_MATHML_SIGN_INVALID) { // there was padding on the right
// dismiss the right italic correction now (so that our parent won't correct us)
if ((NS_MATHML_IS_RTL(mPresentationData.flags) ?
mLeadingSpaceSign : mWidthSign) != NS_MATHML_SIGN_INVALID) {
// there was padding on the right. dismiss the right italic correction now
// (so that our parent won't correct us)
mBoundingMetrics.width = width;
mBoundingMetrics.rightBearing = mBoundingMetrics.width;
}
nscoord dy = height - mBoundingMetrics.ascent;
nscoord dx = lspace;
nscoord dx = NS_MATHML_IS_RTL(mPresentationData.flags) ?
width - initialWidth - lspace : lspace;
aDesiredSize.ascent += dy;
aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.height += dy + depth - mBoundingMetrics.descent;

View File

@ -83,19 +83,19 @@ private:
nsCSSValue mWidth;
nsCSSValue mHeight;
nsCSSValue mDepth;
nsCSSValue mLeftSpace;
nsCSSValue mLeadingSpace;
nsCSSValue mVerticalOffset;
PRInt32 mWidthSign;
PRInt32 mHeightSign;
PRInt32 mDepthSign;
PRInt32 mLeftSpaceSign;
PRInt32 mLeadingSpaceSign;
PRInt32 mVerticalOffsetSign;
PRInt32 mWidthPseudoUnit;
PRInt32 mHeightPseudoUnit;
PRInt32 mDepthPseudoUnit;
PRInt32 mLeftSpacePseudoUnit;
PRInt32 mLeadingSpacePseudoUnit;
PRInt32 mVerticalOffsetPseudoUnit;
// helpers to process the attributes

View File

@ -311,7 +311,8 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
mSqrChar.Stretch(aPresContext, renderingContext,
NS_STRETCH_DIRECTION_VERTICAL,
contSize, radicalSize,
NS_STRETCH_LARGER);
NS_STRETCH_LARGER,
NS_MATHML_IS_RTL(mPresentationData.flags));
// radicalSize have changed at this point, and should match with
// the bounding metrics of the char
mSqrChar.GetBoundingMetrics(bmSqr);
@ -356,35 +357,41 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
nscoord dxIndex, dxSqr;
GetRadicalXOffsets(bmIndex.width, bmSqr.width, fm, &dxIndex, &dxSqr);
// place the index
nscoord dx = dxIndex;
nscoord dy = aDesiredSize.ascent - (indexRaisedAscent + indexSize.ascent - bmIndex.ascent);
FinishReflowChild(indexFrame, aPresContext, nsnull, indexSize, dx, dy, 0);
// place the radical symbol and the radical bar
dx = dxSqr;
dy = indexClearance + leading; // leave a leading at the top
mSqrChar.SetRect(nsRect(dx, dy, bmSqr.width, bmSqr.ascent + bmSqr.descent));
dx += bmSqr.width;
mBarRect.SetRect(dx, dy, bmBase.width, ruleThickness);
// place the base
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
mReference.x = 0;
mReference.y = aDesiredSize.ascent;
mBoundingMetrics.width = dx + bmBase.width;
mBoundingMetrics.width = dxSqr + bmSqr.width + bmBase.width;
mBoundingMetrics.leftBearing =
NS_MIN(dxIndex + bmIndex.leftBearing, dxSqr + bmSqr.leftBearing);
mBoundingMetrics.rightBearing = dx +
mBoundingMetrics.rightBearing = dxSqr + bmSqr.width +
NS_MAX(bmBase.width, bmBase.rightBearing);
aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
GatherAndStoreOverflow(&aDesiredSize);
// place the index
nscoord dx = dxIndex;
nscoord dy = aDesiredSize.ascent - (indexRaisedAscent + indexSize.ascent - bmIndex.ascent);
FinishReflowChild(indexFrame, aPresContext, nsnull, indexSize,
MirrorIfRTL(aDesiredSize.width, indexSize.width, dx),
dy, 0);
// place the radical symbol and the radical bar
dx = dxSqr;
dy = indexClearance + leading; // leave a leading at the top
mSqrChar.SetRect(nsRect(MirrorIfRTL(aDesiredSize.width, bmSqr.width, dx),
dy, bmSqr.width, bmSqr.ascent + bmSqr.descent));
dx += bmSqr.width;
mBarRect.SetRect(MirrorIfRTL(aDesiredSize.width, bmBase.width, dx),
dy, bmBase.width, ruleThickness);
// place the base
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize,
MirrorIfRTL(aDesiredSize.width, baseSize.width, dx),
dy, 0);
mReference.x = 0;
mReference.y = aDesiredSize.ascent;
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;

View File

@ -22,6 +22,7 @@
* Contributor(s):
* Roger B. Sidje <rbs@maths.uq.edu.au>
* David J. Fiddes <D.J.Fiddes@hw.ac.uk>
* Frederic Wang <fred.wang@free.fr>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -69,6 +70,11 @@ nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent)
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
if (mContent->Tag() == nsGkAtoms::mrow_) {
// see if the directionality attribute is there
nsMathMLFrame::FindAttrDirectionality(mContent, mPresentationData);
}
return NS_OK;
}

View File

@ -22,6 +22,7 @@
* Contributor(s):
* Roger B. Sidje <rbs@maths.uq.edu.au>
* David J. Fiddes <D.J.Fiddes@hw.ac.uk>
* Frederic Wang <fred.wang@free.fr>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -76,6 +77,9 @@ nsMathMLmstyleFrame::InheritAutomaticData(nsIFrame* aParent)
// see if the displaystyle attribute is there
nsMathMLFrame::FindAttrDisplaystyle(mContent, mPresentationData);
// see if the directionality attribute is there
nsMathMLFrame::FindAttrDirectionality(mContent, mPresentationData);
return NS_OK;
}

View File

@ -203,10 +203,12 @@ nsMathMLmsubFrame::PlaceSubScript (nsPresContext* aPresContext,
if (aPlaceOrigin) {
nscoord dx, dy;
// now place the base ...
dx = 0; dy = aDesiredSize.ascent - baseSize.ascent;
dx = aFrame->MirrorIfRTL(aDesiredSize.width, baseSize.width, 0);
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
// ... and subscript
dx = bmBase.width;
dx = aFrame->MirrorIfRTL(aDesiredSize.width, subScriptSize.width,
bmBase.width);
dy = aDesiredSize.ascent - (subScriptSize.ascent - actualSubScriptShift);
FinishReflowChild (subScriptFrame, aPresContext, nsnull, subScriptSize, dx, dy, 0);
}

View File

@ -336,16 +336,19 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
if (aPlaceOrigin) {
nscoord dx, dy;
// now place the base ...
dx = 0; dy = aDesiredSize.ascent - baseSize.ascent;
dx = aFrame->MirrorIfRTL(aDesiredSize.width, baseSize.width, 0);
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild(baseFrame, aPresContext, nsnull,
baseSize, dx, dy, 0);
// ... and subscript
dx = bmBase.width;
dx = aFrame->MirrorIfRTL(aDesiredSize.width, subScriptSize.width,
bmBase.width);
dy = aDesiredSize.ascent - (subScriptSize.ascent - subScriptShift);
FinishReflowChild(subScriptFrame, aPresContext, nsnull,
subScriptSize, dx, dy, 0);
// ... and the superscript
dx = bmBase.width + italicCorrection;
dx = aFrame->MirrorIfRTL(aDesiredSize.width, supScriptSize.width,
bmBase.width + italicCorrection);
dy = aDesiredSize.ascent - (supScriptSize.ascent + supScriptShift);
FinishReflowChild(supScriptFrame, aPresContext, nsnull,
supScriptSize, dx, dy, 0);

View File

@ -241,10 +241,12 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
if (aPlaceOrigin) {
nscoord dx, dy;
// now place the base ...
dx = 0; dy = aDesiredSize.ascent - baseSize.ascent;
dx = aFrame->MirrorIfRTL(aDesiredSize.width, baseSize.width, 0);
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
// ... and supscript
dx = bmBase.width + italicCorrection;
dx = aFrame->MirrorIfRTL(aDesiredSize.width, supScriptSize.width,
bmBase.width + italicCorrection);
dy = aDesiredSize.ascent - (supScriptSize.ascent + actualSupScriptShift);
FinishReflowChild (supScriptFrame, aPresContext, nsnull, supScriptSize, dx, dy, 0);
}

View File

@ -34,9 +34,12 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsPrintData_h___
#define nsPrintData_h___
#include "mozilla/Attributes.h"
// Interfaces
#include "nsIDOMWindow.h"
#include "nsDeviceContext.h"
@ -123,8 +126,8 @@ public:
PRUnichar* mBrandName; // needed as a substitute name for a document
private:
nsPrintData(); //not implemented
nsPrintData& operator=(const nsPrintData& aOther); // not implemented
nsPrintData() MOZ_DELETE;
nsPrintData& operator=(const nsPrintData& aOther) MOZ_DELETE;
};

View File

@ -37,6 +37,8 @@
#ifndef nsPrintEngine_h___
#define nsPrintEngine_h___
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsPrintObject.h"
@ -298,8 +300,7 @@ protected:
FILE* mDebugFile;
private:
nsPrintEngine& operator=(const nsPrintEngine& aOther); // not implemented
nsPrintEngine& operator=(const nsPrintEngine& aOther) MOZ_DELETE;
};
#endif /* nsPrintEngine_h___ */

View File

@ -37,6 +37,8 @@
#ifndef nsPrintObject_h___
#define nsPrintObject_h___
#include "mozilla/Attributes.h"
// Interfaces
#include "nsCOMPtr.h"
#include "nsIContent.h"
@ -94,8 +96,7 @@ public:
float mZoomRatio;
private:
nsPrintObject& operator=(const nsPrintObject& aOther); // not implemented
nsPrintObject& operator=(const nsPrintObject& aOther) MOZ_DELETE;
};

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
math:
<math>
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</math>
</p>
<p>
mrow:
<math>
<mrow>
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</mrow>
</math>
</p>
<p>
mstyle:
<math>
<mstyle>
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</mstyle>
</math>
</p>
<p>
mpadded lspace="25px" width="150px":
<math>
<mspace width="1px" height="25px" mathbackground="black"/>
<mpadded lspace="50px" width="150px">
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</mpadded>
<mspace width="1px" height="25px" mathbackground="black"/>
</math>
</p>
<p>
mfenced open="A" close="D" separators="BC":
<math>
<mfenced open="D" close="A" separators="CB">
<mtext>c</mtext>
<mtext>b</mtext>
<mtext>a</mtext>
</mfenced>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
math:
<math dir="rtl">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</math>
</p>
<p>
mrow:
<math>
<mrow dir="rtl">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</mrow>
</math>
</p>
<p>
mstyle:
<math>
<mstyle dir="rtl">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</mstyle>
</math>
</p>
<p>
mpadded lspace="25px" width="150px":
<math dir="rtl">
<mspace width="1px" height="25px" mathbackground="black"/>
<mpadded lspace="25px" width="150px">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</mpadded>
<mspace width="1px" height="25px" mathbackground="black"/>
</math>
</p>
<p>
mfenced open="A" close="D" separators="BC":
<math dir="rtl">
<mfenced open="A" close="D" separators="BC">
<mtext>a</mtext>
<mtext>b</mtext>
<mtext>c</mtext>
</mfenced>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
mfrac (numalign=left):
<math>
<mfrac numalign="left">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="75px" height="25px" mathbackground="green"/>
</mfrac>
</math>
</p>
<p>
mfrac (numalign=right):
<math>
<mfrac numalign="right">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="75px" height="25px" mathbackground="green"/>
</mfrac>
</math>
</p>
<p>
menclose:
<math>
<menclose>
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</menclose>
</math>
</p>
<p>
menclose notation="left":
<math>
<menclose notation="left">
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</menclose>
</math>
</p>
<p>
menclose notation="right":
<math>
<menclose notation="right">
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</menclose>
</math>
</p>
<p>
menclose notation="updiagonalstrike":
<math>
<menclose notation="updiagonalstrike">
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</menclose>
</math>
</p>
<p>
menclose notation="downdiagonalstrike":
<math>
<menclose notation="downdiagonalstrike">
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</menclose>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
mfrac (numalign=left):
<math dir="rtl">
<mfrac numalign="left">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="75px" height="25px" mathbackground="green"/>
</mfrac>
</math>
</p>
<p>
mfrac (numalign=right):
<math dir="rtl">
<mfrac numalign="right">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="75px" height="25px" mathbackground="green"/>
</mfrac>
</math>
</p>
<p>
menclose:
<math dir="rtl">
<menclose>
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</menclose>
</math>
</p>
<p>
menclose notation="left":
<math dir="rtl">
<menclose notation="left">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</menclose>
</math>
</p>
<p>
menclose notation="right":
<math dir="rtl">
<menclose notation="right">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</menclose>
</math>
</p>
<p>
menclose notation="updiagonalstrike":
<math dir="rtl">
<menclose notation="updiagonalstrike">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</menclose>
</math>
</p>
<p>
menclose notation="downdiagonalstrike":
<math dir="rtl">
<menclose notation="downdiagonalstrike">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</menclose>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body style="background: white;">
<div style="position: absolute; top: 5px; left: 5px;">
<div style="width: 30px; height: 500px; background: black;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body style="background: white;">
<!-- The visible part of the formulas below should be covered by the
black rectangle when dir=rtl -->
<div style="position: absolute; top: 5px; left: 5px;">
<!-- msup -->
<math dir="rtl">
<msup>
<mspace width="20px" height="20px"/>
<mspace width="20px" height="20px" mathbackground="red"/>
</msup>
</math><br/>
<!-- msub -->
<math dir="rtl">
<msub>
<mspace width="20px" height="20px"/>
<mspace width="20px" height="20px" mathbackground="orange"/>
</msub>
</math><br/>
<!-- msubsup -->
<math dir="rtl">
<msubsup>
<mspace width="20px" height="20px"/>
<mspace width="20px" height="20px" mathbackground="green"/>
<mspace width="20px" height="20px" mathbackground="blue"/>
</msubsup>
</math><br/>
<!-- mmultiscripts -->
<math dir="rtl">
<mmultiscripts>
<mspace/>
<mspace width="20px" height="20px" mathbackground="cyan"/>
<mspace width="20px" height="20px" mathbackground="yellow"/>
<mprescripts/>
<mspace width="20px" height="20px"/>
<mspace width="20px" height="20px"/>
</mmultiscripts>
</math><br/>
<!-- munder (mo with movablelimits=true and displaystyle=false) -->
<math dir="rtl">
<munder>
<mpadded width="20px">
<mphantom>
<mo movablelimits="true" displaystyle="false">|</mo>
</mphantom>
</mpadded>
<mspace width="20px" height="20px" mathbackground="magenta"/>
</munder>
</math><br/>
<!-- mover (mo with movablelimits=true and displaystyle=false) -->
<math dir="rtl">
<mover>
<mpadded width="20px">
<mphantom>
<mo movablelimits="true" displaystyle="false">|</mo>
</mphantom>
</mpadded>
<mspace width="20px" height="20px" mathbackground="cyan"/>
</mover>
</math><br/>
<!-- munderover (mo with movablelimits=true and displaystyle=false) -->
<math dir="rtl">
<munderover>
<mpadded width="20px">
<mphantom>
<mo movablelimits="true" displaystyle="false">|</mo>
</mphantom>
</mpadded>
<mspace width="20px" height="20px" mathbackground="yellow"/>
<mspace width="20px" height="20px" mathbackground="grey"/>
</munderover>
</math>
<!-- mfrac (bevelled=true) -->
<math dir="rtl">
<mstyle mathcolor="white">
<mfrac bevelled="true">
<mspace width="20px" height="20px"/>
<mspace width="20px" height="20px" mathbackground="red"/>
</mfrac>
</mstyle>
</math><br/>
<!-- mroot -->
<math dir="rtl">
<mstyle mathcolor="white">
<mroot>
<mspace width="20px" height="20px" mathbackground="orange"/>
<mspace width="20px" height="20px"/>
</mroot>
</mstyle>
</math>
<!-- msqrt -->
<math dir="rtl">
<mstyle mathcolor="white">
<msqrt>
<!-- Here, we assume that (width of radical + width of mspace)
is greater than the width of the black rectangle (i.e.
width of radical > 30 - 25 = 5px), so the test fails if the
radical is placed on the left. -->
<mspace width="25px" height="20px" mathbackground="grey"/>
</msqrt>
</mstyle>
</math>
</div>
<div style="position: absolute; top: 5px; left: 5px;">
<div style="width: 30px; height: 500px; background: black;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body style="background: white;">
<div style="position: absolute;
top: 5px; left: 5px; width: 100px; height: 100px;
text-align: center; background: black;">
<div style="position: absolute;
width: 35px; height: 100px; background: red;"></div>
<div style="position: absolute; left: 40px;
width: 20px; height: 100px; background: blue;"></div>
<div style="position: absolute; left: 60px; width: 40px; height: 100px;
background: green;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body style="background: white;">
<!-- menclose notation=radical -->
<div style="position: absolute;
top: 5px; left: 5px; width: 100px; height: 100px;
text-align: center; background: black;">
<math dir="rtl">
<mstyle mathcolor="yellow">
<!-- left and right notation make the menclose symmetric -->
<menclose notation="radical left right">
<mspace width="20px" height="20px"/>
</menclose>
</mstyle>
</math>
</div>
<div style="position: absolute;
top: 5px; left: 5px; width: 100px; height: 100px;">
<!-- hide the left part of the menclose. A 5px band is not covered, where
the radical may be seen if it is wrongly placed on the left instead.
-->
<div style="position: absolute;
width: 35px; height: 100px; background: red;"></div>
<!-- hide the middle part of the menclose -->
<div style="position: absolute; left: 40px;
width: 20px; height: 100px; background: blue;"></div>
<!-- hide the right part of the menclose -->
<div style="position: absolute; left: 60px; width: 40px; height: 100px;
background: green;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<div style="position: absolute;
top: 5px; left: 5px; width: 200px; height: 200px;">
<div style="position: absolute; width: 40px; height: 200px;
left: 0px; background: red;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 40px; background: green;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 80px; background: magenta;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 120px; background: blue;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 160px; background: yellow;"></div>
</div>
<div style="position: absolute;
top: 5px; left: 5px; width: 200px; height: 200px;">
<div style="position: absolute; width: 10px; height: 200px;
left: -5px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 35px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 75px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 115px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 155px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 195px; background: black;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<!-- mmultiscripts. The formulas
1 3 3 1
X in dir=ltr and X in dir=rtl
2 4 4 2
do not match perfectly, so we use an alternative == reftest here
which is less strict. -->
<!-- five vertical bands: red, green, magenta, blue and yellow -->
<div style="position: absolute;
top: 5px; left: 5px; width: 200px; height: 200px;">
<div style="position: absolute; width: 40px; height: 200px;
left: 0px; background: red;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 40px; background: green;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 80px; background: magenta;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 120px; background: blue;"></div>
<div style="position: absolute; width: 40px; height: 200px;
left: 160px; background: yellow;"></div>
</div>
<!-- a mmultiscripts element whose children are squares of different
colors. In dir=rtl, the color of each square should match the one of
the band over which the square is positioned. Hence, this
mmultiscripts should not be visible. -->
<div style="position: absolute;
top: 5px; left: 5px; width: 200px; height: 200px;">
<math dir="rtl">
<mmultiscripts>
<mspace width="40px" height="40px" mathbackground="magenta"/>
<mspace width="40px" height="40px" mathbackground="green"/>
<mspace width="40px" height="40px" mathbackground="green"/>
<mspace width="40px" height="40px" mathbackground="red"/>
<mspace width="40px" height="40px" mathbackground="red"/>
<mprescripts/>
<mspace width="40px" height="40px" mathbackground="yellow"/>
<mspace width="40px" height="40px" mathbackground="yellow"/>
<mspace width="40px" height="40px" mathbackground="blue"/>
<mspace width="40px" height="40px" mathbackground="blue"/>
</mmultiscripts>
</math>
</div>
<!-- We add black vertical bands to cover spaces between the children of
mmultiscripts. -->
<div style="position: absolute;
top: 5px; left: 5px; width: 200px; height: 200px;">
<div style="position: absolute; width: 10px; height: 200px;
left: -5px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 35px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 75px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 115px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 155px; background: black;"></div>
<div style="position: absolute; width: 10px; height: 200px;
left: 195px; background: black;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
mtable:
<math>
<mtable>
<mtr>
<mtd>
<mtext>c</mtext>
</mtd>
<mtd>
<mtext>b</mtext>
</mtd>
<mtd>
<mtext>a</mtext>
</mtd>
</mtr>
<mtr>
<mtd>
<mtext>f</mtext>
</mtd>
<mtd>
<mtext>e</mtext>
</mtd>
<mtd>
<mtext>d</mtext>
</mtd>
</mtr>
</mtable>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
mtable:
<math dir="rtl">
<mtable>
<mtr>
<mtd>
<mtext>a</mtext>
</mtd>
<mtd>
<mtext>b</mtext>
</mtd>
<mtd>
<mtext>c</mtext>
</mtd>
</mtr>
<mtr>
<mtd>
<mtext>d</mtext>
</mtd>
<mtd>
<mtext>e</mtext>
</mtd>
<mtd>
<mtext>f</mtext>
</mtd>
</mtr>
</mtable>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
mo (lspace=1em rspace=2em):
<math>
<mtext>_</mtext><mo lspace="2em" rspace="1em">+</mo><mtext>_</mtext>
</math>
</p>
<p>
embellished mrow (lspace=1em rspace=2em):
<math>
<mtext>_</mtext>
<mrow><mo lspace="2em" rspace="1em">+</mo></mrow>
<mtext>_</mtext>
</math>
</p>
<p>
embellished munderover (lspace=1em rspace=2em):
<math>
<mtext>_</mtext>
<munderover>
<mo lspace="2em" rspace="1em">+</mo>
<mtext>|</mtext>
<mtext>|</mtext>
</munderover>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
mo (lspace=1em rspace=2em):
<math dir="rtl">
<mtext>_</mtext><mo lspace="1em" rspace="2em">+</mo><mtext>_</mtext>
</math>
</p>
<p>
embellished mrow (lspace=1em rspace=2em):
<math dir="rtl">
<mtext>_</mtext>
<mrow><mo lspace="1em" rspace="2em">+</mo></mrow>
<mtext>_</mtext>
</math>
</p>
<p>
embellished munderover (lspace=1em rspace=2em):
<math dir="rtl">
<mtext>_</mtext>
<munderover>
<mo lspace="1em" rspace="2em">+</mo>
<mtext>|</mtext>
<mtext>|</mtext>
</munderover>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
embellished mfrac (lspace=1em rspace=2em):
<math
<mtext>_</mtext>
<mfrac>
<mo lspace="2em" rspace="1em">+</mo>
<mtext>|</mtext>
</mfrac>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head><title>Test dir=rtl</title></head>
<body>
<p>
embellished mfrac (lspace=1em rspace=2em):
<math dir="rtl">
<mtext>_</mtext>
<mfrac>
<mo lspace="1em" rspace="2em">+</mo>
<mtext>|</mtext>
</mfrac>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<style type="text/css">
mo {
-moz-transform: scaleX(-1.0);
}
</style>
<body>
<p><math><mo>(</mo></math></p>
<p><math><mo>)</mo></math></p>
<p><math><mo>[</mo></math></p>
<p><math><mo>]</mo></math></p>
<p><math><mo>{</mo></math></p>
<p><math><mo>}</mo></math></p>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<body>
<p><math dir="rtl"><mo>(</mo></math></p>
<p><math dir="rtl"><mo>)</mo></math></p>
<p><math dir="rtl"><mo>[</mo></math></p>
<p><math dir="rtl"><mo>]</mo></math></p>
<p><math dir="rtl"><mo>{</mo></math></p>
<p><math dir="rtl"><mo>}</mo></math></p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<body>
<p><math display="block"><mo>&#x2211;</mo></math></p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<body>
<p><math display="block" dir="rtl"><mo>&#x2211;</mo></math></p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<body>
<p><math display="block"><mo>&#x221A;</mo></math></p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<body>
<p><math display="block" dir="rtl"><mo>&#x221A;</mo></math></p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<body>
<p><math display="block"><mo>&#x222B;</mo></math></p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head><title>Test mirror op</title></head>
<body>
<p><math display="block" dir="rtl"><mo>&#x222B;</mo></math></p>
</body>
</html>

View File

@ -1,3 +1,15 @@
== dir-1.html dir-1-ref.html
== dir-2.html dir-2-ref.html
== dir-3.html dir-3-ref.html
== dir-4.html dir-4-ref.html
== dir-5.html dir-5-ref.html
fails == dir-6.html dir-6-ref.html
== dir-7.html dir-7-ref.html
fails == dir-8.html dir-8-ref.html
== mirror-op-1.html mirror-op-1-ref.html
!= mirror-op-2.html mirror-op-2-ref.html
!= mirror-op-3.html mirror-op-3-ref.html
!= mirror-op-4.html mirror-op-4-ref.html
== dynamic-mi.xhtml dynamic-mi-ref.xhtml
== mfenced-1.xhtml mfenced-1-ref.xhtml
== mfenced-2a.xhtml mfenced-2-ref.xhtml

Some files were not shown because too many files have changed in this diff Show More