merge mozilla-inbound to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2013-10-09 10:09:07 +02:00
commit 0679b3bf04
344 changed files with 3698 additions and 2318 deletions

View File

@ -15,6 +15,7 @@
#include "nsLayoutUtils.h"
#include "HyperTextAccessible.h"
#include "mozilla/AppUnits.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -17,6 +17,7 @@
#include "nsLayoutUtils.h"
#include "gfxFont.h"
#include "nsIAccessibleTypes.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla::a11y;

View File

@ -1912,7 +1912,7 @@
// Prevent this tab from showing further dialogs, since we're closing it
var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
windowUtils.preventFurtherDialogs();
windowUtils.disableDialogs();
}
// Remove the tab's filter and progress listener.

View File

@ -282,3 +282,5 @@ support-files =
[browser_visibleTabs_tabPreview.js]
[browser_wyciwyg_urlbarCopying.js]
[browser_zbug569342.js]
[browser_registerProtocolHandler_notification.js]
[browser_registerProtocolHandler_notification.html]

View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Protocol registrar page</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
</head>
<body>
<script type="text/javascript">
navigator.registerProtocolHandler("testprotocol",
"https://example.com/foobar?uri=%s",
"Test Protocol");
</script>
</body>
</html>

View File

@ -0,0 +1,39 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
waitForExplicitFinish();
let notificationValue = "Protocol Registration: testprotocol";
let testURI = "http://example.com/browser/" +
"browser/base/content/test/general/browser_registerProtocolHandler_notification.html";
waitForCondition(function() {
// Do not start until the notification is up
let notificationBox = window.gBrowser.getNotificationBox();
let notification = notificationBox.getNotificationWithValue(notificationValue);
return notification;
},
function() {
let notificationBox = window.gBrowser.getNotificationBox();
let notification = notificationBox.getNotificationWithValue(notificationValue);
ok(notification, "Notification box should be displayed");
is(notification.type, "info", "We expect this notification to have the type of 'info'.");
isnot(notification.image, null, "We expect this notification to have an icon.");
let buttons = notification.getElementsByClassName("notification-button-default");
is(buttons.length, 1, "We expect see one default button.");
buttons = notification.getElementsByClassName("notification-button");
is(buttons.length, 1, "We expect see one button.");
let button = buttons[0];
isnot(button.label, null, "We expect the add button to have a label.");
todo_isnot(button.accesskey, null, "We expect the add button to have a accesskey.");
finish();
}, 100);
window.gBrowser.selectedBrowser.loadURI(testURI);
}

View File

@ -1,134 +1,73 @@
function notify(event)
{
if (event.target.location == "about:blank")
return;
var eventname = event.type;
if (eventname == "pagehide")
details.pagehides++;
else if (eventname == "beforeunload")
details.beforeunloads++;
else if (eventname == "unload")
details.unloads++;
}
var details;
var gUseFrame = false;
const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
const TEST_BASE_URL = "data:text/html,<script>" +
"function note(event) { try { alert(event.type); } catch(ex) { return; } throw 'alert appeared'; }" +
"</script>" +
"<body onpagehide='note(event)' onbeforeunload='alert(event.type);' onunload='note(event)'>";
const TEST_URL = TEST_BASE_URL + "Test</body>";
const TEST_FRAME_URL = TEST_BASE_URL + "Frames</body>";
var testUrls =
[
"data:text/html,<script>" +
"function handle(evt) {" +
"evt.target.removeEventListener(evt.type, handle, true);" +
"try { alert('This should NOT appear'); } catch(e) { }" +
"}" +
"window.addEventListener('pagehide', handle, true);" +
"window.addEventListener('beforeunload', handle, true);" +
"window.addEventListener('unload', handle, true);" +
"</script><body>Testing alert during pagehide/beforeunload/unload</body>",
"data:text/html,<script>" +
"function handle(evt) {" +
"evt.target.removeEventListener(evt.type, handle, true);" +
"try { prompt('This should NOT appear'); } catch(e) { }" +
"}" +
"window.addEventListener('pagehide', handle, true);" +
"window.addEventListener('beforeunload', handle, true);" +
"window.addEventListener('unload', handle, true);" +
"</script><body>Testing prompt during pagehide/beforeunload/unload</body>",
"data:text/html,<script>" +
"function handle(evt) {" +
"evt.target.removeEventListener(evt.type, handle, true);" +
"try { confirm('This should NOT appear'); } catch(e) { }" +
"}" +
"window.addEventListener('pagehide', handle, true);" +
"window.addEventListener('beforeunload', handle, true);" +
"window.addEventListener('unload', handle, true);" +
"</script><body>Testing confirm during pagehide/beforeunload/unload</body>",
];
var testsDone = 0;
function test()
{
waitForExplicitFinish();
windowMediator.addListener(promptListener);
runTest();
}
function runTest()
{
details = {
testNumber : 0,
beforeunloads : 0,
pagehides : 0,
unloads : 0,
prompts : 0
};
var tab = gBrowser.addTab(TEST_URL);
gBrowser.selectedTab = tab;
tab.linkedBrowser.addEventListener("pageshow", shown, true);
tab.linkedBrowser.addEventListener("pagehide", notify, true);
tab.linkedBrowser.addEventListener("beforeunload", notify, true);
tab.linkedBrowser.addEventListener("unload", notify, true);
whenNewTabLoaded(window, function() {
gBrowser.selectedBrowser.addEventListener("load", onLoad, true);
executeSoon(function() {
info("Loading page with pagehide, beforeunload, and unload handlers that attempt to create dialogs");
gBrowser.selectedBrowser.loadURI(testUrls[testsDone]);
});
});
}
function shown(event)
function onLoad(event)
{
if (details.testNumber == 0) {
var browser;
var iframe;
if (gUseFrame) {
iframe = event.target.createElement("iframe");
iframe.src = TEST_FRAME_URL;
event.target.documentElement.appendChild(iframe);
browser = iframe.contentWindow;
}
else {
browser = gBrowser.selectedTab.linkedBrowser;
details.testNumber = 1; // Move onto to the next step immediately
}
}
info("Page loaded");
if (details.testNumber == 1) {
// Test going to another page
executeSoon(function () {
const urlToLoad = "data:text/html,<body>Another Page</body>";
if (gUseFrame) {
event.target.location = urlToLoad;
}
else {
gBrowser.selectedBrowser.loadURI(urlToLoad);
}
});
}
else if (details.testNumber == 2) {
is(details.pagehides, 1, "pagehides after next page")
is(details.beforeunloads, 1, "beforeunloads after next page")
is(details.unloads, 1, "unloads after next page")
is(details.prompts, 1, "prompts after next page")
event.target.removeEventListener("load", onLoad, true);
gBrowser.selectedBrowser.addEventListener("unload", done, true);
executeSoon(function () gUseFrame ? gBrowser.goBack() : event.target.defaultView.back());
}
else if (details.testNumber == 3) {
is(details.pagehides, 2, "pagehides after back")
is(details.beforeunloads, 2, "beforeunloads after back")
// No cache, so frame is unloaded
is(details.unloads, gUseFrame ? 2 : 1, "unloads after back")
is(details.prompts, 1, "prompts after back")
executeSoon(function () {
info("Closing page");
gBrowser.removeCurrentTab();
});
}
// Test closing the tab
gBrowser.selectedBrowser.removeEventListener("pageshow", shown, true);
gBrowser.removeTab(gBrowser.selectedTab);
// When the frame is present, there is are two beforeunload and prompts,
// one for the frame and the other for the parent.
is(details.pagehides, 3, "pagehides after close")
is(details.beforeunloads, gUseFrame ? 4 : 3, "beforeunloads after close")
is(details.unloads, gUseFrame ? 3 : 2, "unloads after close")
is(details.prompts, gUseFrame ? 3 : 2, "prompts after close")
// Now run the test again using a child frame.
if (gUseFrame) {
windowMediator.removeListener(promptListener);
finish();
}
else {
gUseFrame = true;
runTest();
}
function done() {
ok(true, "Page closed (hopefully) without timeout");
testsDone++;
if (testsDone == testUrls.length) {
finish();
return;
}
details.testNumber++;
executeSoon(runTest);
}
var promptListener = {
onWindowTitleChange: function () {},
onOpenWindow: function (win) {
details.prompts++;
let domWin = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
executeSoon(function () { domWin.close() });
},
onCloseWindow: function () {},
};

View File

@ -451,14 +451,13 @@ WebContentConverterRegistrar.prototype = {
hs.store(handlerInfo);
}
};
var buttons;
var browserElement = this._getBrowserForContentWindow(browserWindow, aContentWindow);
var notificationBox = browserWindow.getBrowser().getNotificationBox(browserElement);
notificationBox.appendNotification(message,
notificationValue,
notificationIcon,
notificationBox.PRIORITY_INFO_LOW,
buttons);
[addButton]);
},
/**

View File

@ -1560,6 +1560,11 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
NS_ENSURE_SUCCESS(rv, rv);
rv = CheckLoadURIWithPrincipal(aPrincipal, target, aFlags);
if (rv == NS_ERROR_DOM_BAD_URI) {
// Don't warn because NS_ERROR_DOM_BAD_URI is one of the expected
// return values.
return rv;
}
NS_ENSURE_SUCCESS(rv, rv);
// Now start testing fixup -- since aTargetURIStr is a string, not
@ -1584,6 +1589,11 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
NS_ENSURE_SUCCESS(rv, rv);
rv = CheckLoadURIWithPrincipal(aPrincipal, target, aFlags);
if (rv == NS_ERROR_DOM_BAD_URI) {
// Don't warn because NS_ERROR_DOM_BAD_URI is one of the expected
// return values.
return rv;
}
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -9207,14 +9207,11 @@ MOZ_ARG_WITH_STRING(intl-api,
WITH_INTL="--with-intl-api=$withval"
])
if test -z "$WITH_INTL"; then
if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser" -a -z "$DEVELOPER_OPTIONS"; then
# In desktop nightlies the Internationalization API is disabled, but all
# code for it is still built. Bug 853301 will remove this so that it's
# built and the API is enabled.
WITH_INTL="--with-intl-api=build"
if test "$MOZ_BUILD_APP" = "browser"; then
WITH_INTL="--with-intl-api"
else
# Internationalization isn't built or exposed by default in non-desktop and
# non-nightly builds. Bugs to enable:
# Internationalization isn't built or exposed by default in non-desktop
# builds. Bugs to enable:
#
# Android: bug 864843
# B2G: bug 866301

View File

@ -725,9 +725,9 @@ public:
{
}
virtual void GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError);
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
virtual void SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError);
void GetOuterHTML(nsAString& aOuterHTML, ErrorResult& aError);
void GetOuterHTML(nsAString& aOuterHTML);
void SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError);
void InsertAdjacentHTML(const nsAString& aPosition, const nsAString& aText,
ErrorResult& aError);
@ -1124,7 +1124,7 @@ private:
nsIScrollableFrame* GetScrollFrame(nsIFrame **aStyledFrame = nullptr,
bool aFlushLayout = true);
nsresult GetMarkup(bool aIncludeSelf, nsAString& aMarkup);
void GetMarkup(bool aIncludeSelf, nsAString& aMarkup);
// Data members
nsEventStates mState;

View File

@ -3107,14 +3107,15 @@ Serialize(Element* aRoot, bool aDescendentsOnly, nsAString& aOut)
}
}
nsresult
void
Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
{
aMarkup.Truncate();
nsIDocument* doc = OwnerDoc();
if (IsInHTMLDocument()) {
return Serialize(this, !aIncludeSelf, aMarkup) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
Serialize(this, !aIncludeSelf, aMarkup);
return;
}
nsAutoString contentType;
@ -3135,7 +3136,7 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
docEncoder = do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "application/xml");
}
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
NS_ENSURE_TRUE_VOID(docEncoder);
uint32_t flags = nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines
@ -3153,8 +3154,8 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
}
}
nsresult rv = docEncoder->NativeInit(doc, contentType, flags);
NS_ENSURE_SUCCESS(rv, rv);
DebugOnly<nsresult> rv = docEncoder->NativeInit(doc, contentType, flags);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (aIncludeSelf) {
docEncoder->SetNativeNode(this);
@ -3162,10 +3163,10 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
docEncoder->SetNativeContainerNode(this);
}
rv = docEncoder->EncodeToString(aMarkup);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!aIncludeSelf) {
doc->SetCachedEncoder(docEncoder.forget());
}
return rv;
}
/**
@ -3197,10 +3198,11 @@ FireMutationEventsForDirectParsing(nsIDocument* aDoc, nsIContent* aDest,
}
}
void
Element::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
Element::GetInnerHTML(nsAString& aInnerHTML)
{
aError = GetMarkup(false, aInnerHTML);
GetMarkup(false, aInnerHTML);
return NS_OK;
}
void
@ -3266,9 +3268,9 @@ Element::SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError)
}
void
Element::GetOuterHTML(nsAString& aOuterHTML, ErrorResult& aError)
Element::GetOuterHTML(nsAString& aOuterHTML)
{
aError = GetMarkup(true, aOuterHTML);
GetMarkup(true, aOuterHTML);
}
void

View File

@ -641,11 +641,15 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
if (!nsContentUtils::IsSafeToRunScript())
return false;
int32_t type = -1;
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(piWindow);
bool chromeShell = (docShell && NS_SUCCEEDED(docShell->GetItemType(&type)) &&
type == nsIDocShellTreeItem::typeChrome);
// next, fire the cut, copy or paste event
// XXXndeakin Bug 844941 - why was a preference added here without a running-in-chrome check?
bool doDefault = true;
nsRefPtr<nsDOMDataTransfer> clipboardData;
if (Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
if (chromeShell || Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
clipboardData = new nsDOMDataTransfer(aType, aType == NS_PASTE, aClipboardType);
nsEventStatus status = nsEventStatus_eIgnore;

View File

@ -9,6 +9,7 @@
#include "gfxFont.h" // for the gfxTextRun::CompressedGlyph::FLAG_BREAK_TYPE_* values
#include "nsHyphenationManager.h"
#include "nsHyphenator.h"
#include "mozilla/gfx/2D.h"
nsLineBreaker::nsLineBreaker()
: mCurrentWordLanguage(nullptr),

View File

@ -20,6 +20,8 @@
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
#include "mozilla/dom/CanvasPattern.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/gfx/2D.h"
#include "gfx2DGlue.h"
class nsXULElement;

View File

@ -1593,7 +1593,7 @@ nsEventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext,
nsIFrame* inDownFrame,
WidgetGUIEvent* inMouseDownEvent)
{
if (!inMouseDownEvent->mFlags.mIsTrusted)
if (!inMouseDownEvent->mFlags.mIsTrusted || IsRemoteTarget(mGestureDownContent))
return;
// just to be anal (er, safe)

View File

@ -16,9 +16,7 @@ public:
HTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLElement();
using nsGenericHTMLElement::GetInnerHTML;
virtual void GetInnerHTML(nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo* aNodeInfo,
nsINode** aResult) const MOZ_OVERRIDE;
@ -39,8 +37,8 @@ HTMLElement::~HTMLElement()
NS_IMPL_ELEMENT_CLONE(HTMLElement)
void
HTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
HTMLElement::GetInnerHTML(nsAString& aInnerHTML)
{
/**
* nsGenericHTMLElement::GetInnerHTML escapes < and > characters (at least).
@ -52,10 +50,10 @@ HTMLElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
if (mNodeInfo->Equals(nsGkAtoms::xmp) ||
mNodeInfo->Equals(nsGkAtoms::plaintext)) {
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
return;
return NS_OK;
}
nsGenericHTMLElement::GetInnerHTML(aInnerHTML, aError);
return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
}
JSObject*

View File

@ -226,10 +226,11 @@ HTMLScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
aNotify);
}
void
HTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
HTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML)
{
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
return NS_OK;
}
void

View File

@ -30,9 +30,7 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
using nsGenericHTMLElement::GetInnerHTML;
virtual void GetInnerHTML(nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE;
using nsGenericHTMLElement::SetInnerHTML;
virtual void SetInnerHTML(const nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;

View File

@ -201,10 +201,11 @@ HTMLStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
return rv;
}
void
HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML, ErrorResult& aError)
NS_IMETHODIMP
HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML)
{
nsContentUtils::GetNodeTextContent(this, false, aInnerHTML);
return NS_OK;
}
void

View File

@ -33,9 +33,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLStyleElement,
nsGenericHTMLElement)
using nsGenericHTMLElement::GetInnerHTML;
virtual void GetInnerHTML(nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE;
using nsGenericHTMLElement::SetInnerHTML;
virtual void SetInnerHTML(const nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;

View File

@ -464,9 +464,8 @@ public:
return rv.ErrorCode();
}
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) MOZ_FINAL {
mozilla::ErrorResult rv;
mozilla::dom::Element::GetOuterHTML(aOuterHTML, rv);
return rv.ErrorCode();
mozilla::dom::Element::GetOuterHTML(aOuterHTML);
return NS_OK;
}
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) MOZ_FINAL {
mozilla::ErrorResult rv;
@ -528,11 +527,8 @@ public:
*aDraggable = Draggable();
return NS_OK;
}
using mozilla::dom::Element::GetInnerHTML;
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_FINAL {
mozilla::ErrorResult rv;
GetInnerHTML(aInnerHTML, rv);
return rv.ErrorCode();
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) MOZ_OVERRIDE {
return mozilla::dom::Element::GetInnerHTML(aInnerHTML);
}
using mozilla::dom::Element::SetInnerHTML;
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) MOZ_FINAL {

View File

@ -17,13 +17,12 @@ namespace mozilla {
/**
* An AudioNodeStream produces a single audio track with ID
* AUDIO_NODE_STREAM_TRACK_ID. This track has rate AudioContext::sIdealAudioRate
* AUDIO_TRACK. This track has rate AudioContext::sIdealAudioRate
* for regular audio contexts, and the rate requested by the web content
* for offline audio contexts.
* Each chunk in the track is a single block of WEBAUDIO_BLOCK_SIZE samples.
* Note: This must be a different value than MEDIA_STREAM_DEST_TRACK_ID
*/
static const int AUDIO_NODE_STREAM_TRACK_ID = 1;
AudioNodeStream::~AudioNodeStream()
{
@ -409,7 +408,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
FinishOutput();
}
EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
EnsureTrack(AUDIO_TRACK, mSampleRate);
uint16_t outputCount = std::max(uint16_t(1), mEngine->OutputCount());
mLastChunks.SetLength(outputCount);
@ -441,7 +440,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
}
}
if (mDisabledTrackIDs.Contains(AUDIO_NODE_STREAM_TRACK_ID)) {
if (mDisabledTrackIDs.Contains(static_cast<TrackID>(AUDIO_TRACK))) {
for (uint32_t i = 0; i < mLastChunks.Length(); ++i) {
mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
}
@ -453,7 +452,7 @@ AudioNodeStream::ProduceOutput(GraphTime aFrom, GraphTime aTo)
void
AudioNodeStream::AdvanceOutputSegment()
{
StreamBuffer::Track* track = EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK, mSampleRate);
AudioSegment* segment = track->Get<AudioSegment>();
if (mKind == MediaStreamGraph::EXTERNAL_STREAM) {
@ -467,7 +466,7 @@ AudioNodeStream::AdvanceOutputSegment()
AudioChunk copyChunk = mLastChunks[0];
AudioSegment tmpSegment;
tmpSegment.AppendAndConsumeChunk(&copyChunk);
l->NotifyQueuedTrackChanges(Graph(), AUDIO_NODE_STREAM_TRACK_ID,
l->NotifyQueuedTrackChanges(Graph(), AUDIO_TRACK,
mSampleRate, segment->GetDuration(), 0,
tmpSegment);
}
@ -476,7 +475,7 @@ AudioNodeStream::AdvanceOutputSegment()
TrackTicks
AudioNodeStream::GetCurrentPosition()
{
return EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate)->Get<AudioSegment>()->GetDuration();
return EnsureTrack(AUDIO_TRACK, mSampleRate)->Get<AudioSegment>()->GetDuration();
}
void
@ -486,14 +485,14 @@ AudioNodeStream::FinishOutput()
return;
}
StreamBuffer::Track* track = EnsureTrack(AUDIO_NODE_STREAM_TRACK_ID, mSampleRate);
StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK, mSampleRate);
track->SetEnded();
FinishOnGraphThread();
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
MediaStreamListener* l = mListeners[j];
AudioSegment emptySegment;
l->NotifyQueuedTrackChanges(Graph(), AUDIO_NODE_STREAM_TRACK_ID,
l->NotifyQueuedTrackChanges(Graph(), AUDIO_TRACK,
mSampleRate,
track->GetSegment()->GetDuration(),
MediaStreamListener::TRACK_EVENT_ENDED, emptySegment);

View File

@ -117,7 +117,7 @@ AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannel
CheckedInt<uint32_t> end = aStartInChannel;
end += length;
if (aChannelNumber >= NumberOfChannels() ||
!end.isValid() || end.value() >= mLength) {
!end.isValid() || end.value() > mLength) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}
@ -143,7 +143,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
CheckedInt<uint32_t> end = aStartInChannel;
end += length;
if (aChannelNumber >= NumberOfChannels() ||
!end.isValid() || end.value() >= mLength) {
!end.isValid() || end.value() > mLength) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}

View File

@ -6,10 +6,15 @@
#include "AudioDestinationNode.h"
#include "mozilla/dom/AudioDestinationNodeBinding.h"
#include "mozilla/Preferences.h"
#include "AudioChannelAgent.h"
#include "AudioNodeEngine.h"
#include "AudioNodeStream.h"
#include "MediaStreamGraph.h"
#include "OfflineAudioCompletionEvent.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
namespace mozilla {
namespace dom {
@ -213,7 +218,21 @@ private:
float mVolume;
};
NS_IMPL_ISUPPORTS_INHERITED0(AudioDestinationNode, AudioNode)
static bool UseAudioChannelService()
{
return Preferences::GetBool("media.useAudioChannelService");
}
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(AudioDestinationNode, AudioNode,
mAudioChannelAgent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AudioDestinationNode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback)
NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(AudioDestinationNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(AudioDestinationNode, AudioNode)
AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
bool aIsOffline,
@ -235,11 +254,46 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
static_cast<AudioNodeEngine*>(new DestinationNodeEngine(this));
mStream = graph->CreateAudioNodeStream(engine, MediaStreamGraph::EXTERNAL_STREAM);
if (!aIsOffline && UseAudioChannelService()) {
mAudioChannelAgent = new AudioChannelAgent();
mAudioChannelAgent->InitWithWeakCallback(nsIAudioChannelAgent::AUDIO_AGENT_CHANNEL_NORMAL,
this);
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
if (target) {
target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"), this,
/* useCapture = */ true,
/* wantsUntrusted = */ false);
}
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
if (docshell) {
bool isActive = false;
docshell->GetIsActive(&isActive);
mAudioChannelAgent->SetVisibilityState(isActive);
}
int32_t state = 0;
mAudioChannelAgent->StartPlaying(&state);
SetCanPlay(state == AudioChannelState::AUDIO_CHANNEL_STATE_NORMAL);
}
}
void
AudioDestinationNode::DestroyMediaStream()
{
if (mAudioChannelAgent && !Context()->IsOffline()) {
mAudioChannelAgent->StopPlaying();
mAudioChannelAgent = nullptr;
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
NS_ENSURE_TRUE_VOID(target);
target->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"), this,
/* useCapture = */ true);
}
if (!mStream)
return;
@ -304,5 +358,38 @@ AudioDestinationNode::StartRendering()
mStream->Graph()->StartNonRealtimeProcessing(mFramesToProduce);
}
void
AudioDestinationNode::SetCanPlay(bool aCanPlay)
{
mStream->SetTrackEnabled(AudioNodeStream::AUDIO_TRACK, aCanPlay);
}
NS_IMETHODIMP
AudioDestinationNode::HandleEvent(nsIDOMEvent* aEvent)
{
nsAutoString type;
aEvent->GetType(type);
if (!type.EqualsLiteral("visibilitychange")) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
NS_ENSURE_TRUE(docshell, NS_ERROR_FAILURE);
bool isActive = false;
docshell->GetIsActive(&isActive);
mAudioChannelAgent->SetVisibilityState(isActive);
return NS_OK;
}
NS_IMETHODIMP
AudioDestinationNode::CanPlayChanged(int32_t aCanPlay)
{
SetCanPlay(aCanPlay == AudioChannelState::AUDIO_CHANNEL_STATE_NORMAL);
return NS_OK;
}
}
}

View File

@ -8,6 +8,8 @@
#define AudioDestinationNode_h_
#include "AudioNode.h"
#include "nsIDOMEventListener.h"
#include "nsIAudioChannelAgent.h"
namespace mozilla {
namespace dom {
@ -15,6 +17,8 @@ namespace dom {
class AudioContext;
class AudioDestinationNode : public AudioNode
, public nsIDOMEventListener
, public nsIAudioChannelAgentCallback
{
public:
// This node type knows what MediaStreamGraph to use based on
@ -28,6 +32,7 @@ public:
virtual void DestroyMediaStream() MOZ_OVERRIDE;
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioDestinationNode, AudioNode)
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
@ -48,9 +53,19 @@ public:
void OfflineShutdown();
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
// nsIAudioChannelAgentCallback
NS_IMETHOD CanPlayChanged(int32_t aCanPlay);
private:
void SetCanPlay(bool aCanPlay);
SelfReference<AudioDestinationNode> mOfflineRenderingRef;
uint32_t mFramesToProduce;
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
};
}

View File

@ -25,13 +25,14 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(BiquadFilterNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(BiquadFilterNode, AudioNode)
void SetParamsOnBiquad(WebCore::Biquad& aBiquad,
float aSampleRate,
BiquadFilterType aType,
double aFrequency,
double aQ,
double aGain,
double aDetune)
static void
SetParamsOnBiquad(WebCore::Biquad& aBiquad,
float aSampleRate,
BiquadFilterType aType,
double aFrequency,
double aQ,
double aGain,
double aDetune)
{
const double nyquist = aSampleRate * 0.5;
double normalizedFrequency = aFrequency / nyquist;
@ -158,10 +159,16 @@ public:
double gain = mGain.GetValueAtTime(pos);
double detune = mDetune.GetValueAtTime(pos);
float inputBuffer[WEBAUDIO_BLOCK_SIZE];
for (uint32_t i = 0; i < numberOfChannels; ++i) {
auto input = static_cast<const float*>(aInput.mChannelData[i]);
if (aInput.mVolume != 1.0) {
AudioBlockCopyChannelWithScale(input, aInput.mVolume, inputBuffer);
input = inputBuffer;
}
SetParamsOnBiquad(mBiquads[i], aStream->SampleRate(), mType, freq, q, gain, detune);
mBiquads[i].process(static_cast<const float*>(aInput.mChannelData[i]),
mBiquads[i].process(input,
static_cast<float*>(const_cast<void*>(aOutput->mChannelData[i])),
aInput.GetDuration());
}

View File

@ -81,12 +81,6 @@ void Biquad::process(const float* sourceP, float* destP, size_t framesToProcess)
m_x2 = DenormalDisabler::flushDenormalFloatToZero(x2);
m_y1 = DenormalDisabler::flushDenormalFloatToZero(y1);
m_y2 = DenormalDisabler::flushDenormalFloatToZero(y2);
m_b0 = b0;
m_b1 = b1;
m_b2 = b2;
m_a1 = a1;
m_a2 = a2;
}
void Biquad::reset()

View File

@ -19,6 +19,7 @@
#include "SVGAnimationElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "nsContentUtils.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/SVGFEFloodElement.h"
#include "mozilla/dom/SVGFEFloodElementBinding.h"
#include "gfxContext.h"
#include "gfxColor.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEFlood)

View File

@ -12,6 +12,7 @@
#include <stdarg.h>
#include "SVGContentUtils.h"
#include "SVGPathSegUtils.h"
#include "gfxContext.h"
#include <algorithm>
using namespace mozilla;

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom()
{
var z = document.createElement("legend");
document.documentElement.appendChild(z);
z.style.display = "table-column-group";
window.find("?");
z.focus();
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -41,3 +41,4 @@ load 708405-1.html
load 745495.html
load 886213.html
load 898906.html
load 852381.html

View File

@ -2680,10 +2680,8 @@ nsDOMWindowUtils::CheckAndClearPaintedState(nsIDOMElement* aElement, bool* aResu
}
NS_IMETHODIMP
nsDOMWindowUtils::PreventFurtherDialogs()
nsDOMWindowUtils::EnableDialogs()
{
// Permanently disable further dialogs for this window.
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2691,7 +2689,35 @@ nsDOMWindowUtils::PreventFurtherDialogs()
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
static_cast<nsGlobalWindow*>(window.get())->PreventFurtherDialogs(true);
static_cast<nsGlobalWindow*>(window.get())->EnableDialogs();
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::DisableDialogs()
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
static_cast<nsGlobalWindow*>(window.get())->DisableDialogs();
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::AreDialogsEnabled(bool* aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
*aResult = static_cast<nsGlobalWindow*>(window.get())->AreDialogsEnabled();
return NS_OK;
}

View File

@ -2544,6 +2544,9 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
ignoreTabIndex = false;
if (aNoParentTraversal) {
if (startContent == rootContent)
return NS_OK;
startContent = rootContent;
tabIndex = forward ? 1 : 0;
continue;

View File

@ -1030,8 +1030,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
#endif
mCleanedUp(false),
mDialogAbuseCount(0),
mStopAbuseDialogs(false),
mDialogsPermanentlyDisabled(false)
mAreDialogsEnabled(true)
{
nsLayoutStatics::AddRef();
@ -2883,13 +2882,11 @@ nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
}
bool
nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
nsGlobalWindow::ShouldPromptToBlockDialogs()
{
*aBeingAbused = false;
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ASSERTION(!mDocShell, "DialogsAreBlocked() called without a top window?");
NS_ASSERTION(!mDocShell, "ShouldPromptToBlockDialogs() called without a top window?");
return true;
}
@ -2898,8 +2895,22 @@ nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
return true;
}
if (topWindow->mDialogsPermanentlyDisabled) {
return true;
return topWindow->DialogsAreBeingAbused();
}
bool
nsGlobalWindow::AreDialogsEnabled()
{
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ERROR("AreDialogsEnabled() called without a top window?");
return false;
}
// TODO: Warn if no top window?
topWindow = topWindow->GetCurrentInnerWindowInternal();
if (!topWindow) {
return false;
}
// Dialogs are blocked if the content viewer is hidden
@ -2910,13 +2921,11 @@ nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
bool isHidden;
cv->GetIsHidden(&isHidden);
if (isHidden) {
return true;
return false;
}
}
*aBeingAbused = topWindow->DialogsAreBeingAbused();
return topWindow->mStopAbuseDialogs && *aBeingAbused;
return topWindow->mAreDialogsEnabled;
}
bool
@ -2973,7 +2982,7 @@ nsGlobalWindow::ConfirmDialogIfNeeded()
"ScriptDialogPreventTitle", title);
promptSvc->Confirm(this, title.get(), label.get(), &disableDialog);
if (disableDialog) {
PreventFurtherDialogs(false);
DisableDialogs();
return false;
}
@ -2981,20 +2990,34 @@ nsGlobalWindow::ConfirmDialogIfNeeded()
}
void
nsGlobalWindow::PreventFurtherDialogs(bool aPermanent)
nsGlobalWindow::DisableDialogs()
{
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ERROR("PreventFurtherDialogs() called without a top window?");
NS_ERROR("DisableDialogs() called without a top window?");
return;
}
topWindow = topWindow->GetCurrentInnerWindowInternal();
// TODO: Warn if no top window?
if (topWindow) {
topWindow->mStopAbuseDialogs = true;
if (aPermanent) {
topWindow->mDialogsPermanentlyDisabled = true;
}
topWindow->mAreDialogsEnabled = false;
}
}
void
nsGlobalWindow::EnableDialogs()
{
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ERROR("EnableDialogs() called without a top window?");
return;
}
// TODO: Warn if no top window?
topWindow = topWindow->GetCurrentInnerWindowInternal();
if (topWindow) {
topWindow->mAreDialogsEnabled = true;
}
}
@ -5417,8 +5440,7 @@ nsGlobalWindow::Alert(const nsAString& aString)
{
FORWARD_TO_OUTER(Alert, (aString), NS_ERROR_NOT_INITIALIZED);
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -5460,7 +5482,7 @@ nsGlobalWindow::Alert(const nsAString& aString)
nsAutoSyncOperation sync(GetCurrentInnerWindowInternal() ?
GetCurrentInnerWindowInternal()->mDoc :
nullptr);
if (needToPromptForAbuse) {
if (ShouldPromptToBlockDialogs()) {
bool disallowDialog = false;
nsXPIDLString label;
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
@ -5469,7 +5491,7 @@ nsGlobalWindow::Alert(const nsAString& aString)
rv = prompt->AlertCheck(title.get(), final.get(), label.get(),
&disallowDialog);
if (disallowDialog)
PreventFurtherDialogs(false);
DisableDialogs();
} else {
rv = prompt->Alert(title.get(), final.get());
}
@ -5482,8 +5504,7 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
{
FORWARD_TO_OUTER(Confirm, (aString, aReturn), NS_ERROR_NOT_INITIALIZED);
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -5527,7 +5548,7 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
nsAutoSyncOperation sync(GetCurrentInnerWindowInternal() ?
GetCurrentInnerWindowInternal()->mDoc :
nullptr);
if (needToPromptForAbuse) {
if (ShouldPromptToBlockDialogs()) {
bool disallowDialog = false;
nsXPIDLString label;
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
@ -5536,7 +5557,7 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
rv = prompt->ConfirmCheck(title.get(), final.get(), label.get(),
&disallowDialog, aReturn);
if (disallowDialog)
PreventFurtherDialogs(false);
DisableDialogs();
} else {
rv = prompt->Confirm(title.get(), final.get(), aReturn);
}
@ -5553,8 +5574,7 @@ nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
SetDOMStringToNull(aReturn);
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -5599,7 +5619,7 @@ nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
bool disallowDialog = false;
nsXPIDLString label;
if (needToPromptForAbuse) {
if (ShouldPromptToBlockDialogs()) {
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
"ScriptDialogLabel", label);
}
@ -5612,7 +5632,7 @@ nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
&inoutValue, label.get(), &disallowDialog, &ok);
if (disallowDialog) {
PreventFurtherDialogs(false);
DisableDialogs();
}
NS_ENSURE_SUCCESS(rv, rv);
@ -5862,12 +5882,11 @@ nsGlobalWindow::Print()
if (Preferences::GetBool("dom.disable_window_print", false))
return NS_ERROR_NOT_AVAILABLE;
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
if (needToPromptForAbuse && !ConfirmDialogIfNeeded()) {
if (ShouldPromptToBlockDialogs() && !ConfirmDialogIfNeeded()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -7847,12 +7866,11 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aURI, nsIVariant *aArgs_,
// pending reflows.
EnsureReflowFlushAndPaint();
bool needToPromptForAbuse;
if (DialogsAreBlocked(&needToPromptForAbuse)) {
if (!AreDialogsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
if (needToPromptForAbuse && !ConfirmDialogIfNeeded()) {
if (ShouldPromptToBlockDialogs() && !ConfirmDialogIfNeeded()) {
return NS_ERROR_NOT_AVAILABLE;
}

View File

@ -503,13 +503,15 @@ public:
already_AddRefed<nsIDOMWindow> GetChildWindow(const nsAString& aName);
// Returns true if dialogs need to be prevented from appearings for this
// window. beingAbused returns whether dialogs are being abused.
bool DialogsAreBlocked(bool *aBeingAbused);
// Returns true if we've reached the state in this top level window where we
// ask the user if further dialogs should be blocked. This method must only
// be called on the scriptable top inner window.
// These return true if we've reached the state in this top level window
// where we ask the user if further dialogs should be blocked.
//
// DialogsAreBeingAbused must be called on the scriptable top inner window.
//
// ShouldPromptToBlockDialogs is implemented in terms of
// DialogsAreBeingAbused, and will get the scriptable top inner window
// automatically.
bool ShouldPromptToBlockDialogs();
bool DialogsAreBeingAbused();
// Ask the user if further dialogs should be blocked, if dialogs are currently
@ -517,8 +519,11 @@ public:
// show, in that case we show a separate dialog to ask this question.
bool ConfirmDialogIfNeeded();
// Prevent further dialogs in this (top level) window
void PreventFurtherDialogs(bool aPermanent);
// These functions are used for controlling and determining whether dialogs
// (alert, prompt, confirm) are currently allowed in this window.
void EnableDialogs();
void DisableDialogs();
bool AreDialogsEnabled();
virtual void SetHasAudioAvailableEventListeners();
@ -1250,15 +1255,9 @@ protected:
// to allow disabling of further dialogs from this window.
TimeStamp mLastDialogQuitTime;
// This is set to true once the user has opted-in to preventing further
// dialogs for this window. Subsequent dialogs may still open if
// mDialogAbuseCount gets reset.
bool mStopAbuseDialogs;
// This flag gets set when dialogs should be permanently disabled for this
// window (e.g. when we are closing the tab and therefore are guaranteed to be
// destroying this window).
bool mDialogsPermanentlyDisabled;
// This flag keeps track of whether dialogs are
// currently enabled on this window.
bool mAreDialogsEnabled;
nsTHashtable<nsPtrHashKey<nsDOMEventTargetHelper> > mEventTargetObjects;

View File

@ -43,7 +43,7 @@ interface nsIDOMEventTarget;
interface nsIRunnable;
interface nsICompositionStringSynthesizer;
[scriptable, uuid(750a47b6-8bdb-4cad-ba2c-b7d3e66d8021)]
[scriptable, uuid(928356ff-26b2-434e-a7ce-c1a660162d81)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -1303,10 +1303,12 @@ interface nsIDOMWindowUtils : nsISupports {
in float aBottom, in float aLeft);
/**
* Prevent this window (and any child windows) from displaying any further
* dialogs (e.g. window.alert()).
* These are used to control whether dialogs (alert, prompt, confirm) are
* allowed.
*/
void preventFurtherDialogs();
void disableDialogs();
void enableDialogs();
bool areDialogsEnabled();
const unsigned long AGENT_SHEET = 0;
const unsigned long USER_SHEET = 1;

View File

@ -454,15 +454,11 @@ nsGeolocationRequest::Allow()
}
// check to see if we can use a cached value
//
// either:
// a) the user has specified a maximumAge which allows us to return a cached value,
// -or-
// b) the cached position time is some reasonable value to return to the user (<30s)
// if the user has specified a maximumAge, return a cached value.
uint32_t maximumAge = 30 * PR_MSEC_PER_SEC;
uint32_t maximumAge = 0;
if (mOptions) {
if (mOptions->mMaximumAge >= 0) {
if (mOptions->mMaximumAge > 0) {
maximumAge = mOptions->mMaximumAge;
}
}
@ -1125,8 +1121,6 @@ Geolocation::RemoveRequest(nsGeolocationRequest* aRequest)
(mPendingCallbacks.RemoveElement(aRequest) !=
mWatchingCallbacks.RemoveElement(aRequest));
// request must have been in one of the lists
MOZ_ASSERT(requestWasKnown);
unused << requestWasKnown;
}

View File

@ -51,3 +51,4 @@ support-files =
[test_selectAtPoint.html]
[test_subscript_bindings.xul]
[test_xray_event_constructor.xul]
[test_clipboard_events_chrome.html]

View File

@ -0,0 +1,62 @@
<html>
<body onload="runTest()">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script>
// This test checks that the dom.event.clipboardevents.enabled does not apply to chrome shells.
SimpleTest.waitForExplicitFinish();
function runTest()
{
SpecialPowers.setBoolPref("dom.event.clipboardevents.enabled", false);
window.open("data:text/html,<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>",
"_blank", "chrome,width=200,height=200");
}
var event_fired = false;
function doChecks(win)
{
var windowFocused = function() {
var textbox = win.document.getElementById("i");
textbox.value = "Sample Text";
textbox.oncut = function() { event_fired = true; };
textbox.oncopy = function() { event_fired = true; };
textbox.onpaste = function() { event_fired = true; };
textbox.select();
textbox.focus();
textbox.setSelectionRange(1, 4);
synthesizeKey("x", {accelKey: 1}, win);
is(textbox.value, "Sle Text", "cut changed text when preference is disabled");
ok(event_fired, "cut event fired when preference is disabled")
event_fired = false;
textbox.setSelectionRange(4, 6);
synthesizeKey("c", {accelKey: 1}, win);
is(textbox.value, "Sle Text", "cut changed text when preference is disabled");
ok(event_fired, "copy event fired when preference is disabled")
event_fired = false;
textbox.setSelectionRange(1, 4);
synthesizeKey("v", {accelKey: 1}, win);
is(textbox.value, "STeText", "paste changed text when preference is disabled");
ok(event_fired, "paste event fired when preference is disabled")
SpecialPowers.clearUserPref("dom.event.clipboardevents.enabled");
SimpleTest.finish();
}
SimpleTest.waitForFocus(windowFocused, win);
}
</script>
<p id="display"></p>
</body></html>

View File

@ -43,6 +43,7 @@ var ecmaGlobals =
"Int32Array",
"Int8Array",
"InternalError",
{name: "Intl", desktop: true},
"Iterator",
"JSON",
"Map",
@ -610,36 +611,38 @@ function createInterfaceMap(isXBLScope) {
var isRelease = !version.contains("a");
var isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
var isB2G = !isDesktop && !navigator.userAgent.contains("Android");
var interfaceMap = {};
for (var entry of ecmaGlobals) {
if (typeof(entry) === "string") {
// Standard ECMAScript global objects are not defined on the XBL scope.
interfaceMap[entry] = !isXBLScope;
} else if (entry.nightly === isNightly) {
interfaceMap[entry.name] = !isXBLScope;
} else {
interfaceMap[entry.name] = false;
}
}
for (var entry of interfaceNamesInGlobalScope) {
if (typeof(entry) === "string") {
interfaceMap[entry] = true;
} else if (entry.xbl === !isXBLScope ||
entry.desktop === !isDesktop ||
entry.b2g === !isB2G ||
entry.release === !isRelease) {
interfaceMap[entry.name] = false;
} else {
interfaceMap[entry.name] = true;
function addInterfaces(interfaces, shouldExpect)
{
for (var entry of interfaces) {
if (typeof(entry) === "string") {
interfaceMap[entry] = shouldExpect;
} else if ((entry.nightly === !isNightly) ||
(entry.xbl === !isXBLScope) ||
(entry.desktop === !isDesktop) ||
(entry.b2g === !isB2G) ||
(entry.release === !isRelease)) {
interfaceMap[entry.name] = false;
} else {
interfaceMap[entry.name] = shouldExpect;
}
}
}
// Standard ECMAScript global objects are not defined on the XBL scope, but
// everything else exists everywhere.
addInterfaces(ecmaGlobals, !isXBLScope);
addInterfaces(interfaceNamesInGlobalScope, true);
return interfaceMap;
}
function runTest(isXBLScope) {
var interfaceMap = createInterfaceMap(isXBLScope);
for (var name of Object.getOwnPropertyNames(window)) {
// An interfae name should start with an upper case character.
// An interface name should start with an upper case character.
if (!/^(moz)?[A-Z]/.test(name)) {
continue;
}

View File

@ -175,9 +175,9 @@ partial interface Element {
// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
partial interface Element {
[Throws,TreatNullAs=EmptyString]
[Pure,SetterThrows,TreatNullAs=EmptyString]
attribute DOMString innerHTML;
[Throws,TreatNullAs=EmptyString]
[Pure,SetterThrows,TreatNullAs=EmptyString]
attribute DOMString outerHTML;
[Throws]
void insertAdjacentHTML(DOMString position, DOMString text);

View File

@ -13,7 +13,7 @@
dictionary PositionOptions {
boolean enableHighAccuracy = false;
long timeout = 0x7fffffff;
long maximumAge = 30000; /* non-conformant, should be 0 */
long maximumAge = 0;
};
[NoInterfaceObject]

View File

@ -131,11 +131,6 @@ RemoveGLDrawTarget(DrawTargetSkia* target)
DrawTargetSkia::DrawTargetSkia()
: mSnapshot(nullptr)
{
#ifdef ANDROID
mSoftClipping = false;
#else
mSoftClipping = true;
#endif
}
DrawTargetSkia::~DrawTargetSkia()
@ -707,9 +702,6 @@ DrawTargetSkia::InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLCont
mSize = aSize;
mFormat = aFormat;
// Always use soft clipping when we're using GL
mSoftClipping = true;
mGrGLInterface = aGrGLInterface;
mGrGLInterface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
@ -791,7 +783,7 @@ DrawTargetSkia::ClearRect(const Rect &aRect)
MarkChanged();
SkPaint paint;
mCanvas->save();
mCanvas->clipRect(RectToSkRect(aRect), SkRegion::kIntersect_Op, mSoftClipping);
mCanvas->clipRect(RectToSkRect(aRect), SkRegion::kIntersect_Op, true);
paint.setColor(SkColorSetARGB(0, 0, 0, 0));
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
mCanvas->drawPaint(paint);
@ -807,7 +799,7 @@ DrawTargetSkia::PushClip(const Path *aPath)
const PathSkia *skiaPath = static_cast<const PathSkia*>(aPath);
mCanvas->save(SkCanvas::kClip_SaveFlag);
mCanvas->clipPath(skiaPath->GetPath(), SkRegion::kIntersect_Op, mSoftClipping);
mCanvas->clipPath(skiaPath->GetPath(), SkRegion::kIntersect_Op, true);
}
void
@ -816,7 +808,7 @@ DrawTargetSkia::PushClipRect(const Rect& aRect)
SkRect rect = RectToSkRect(aRect);
mCanvas->save(SkCanvas::kClip_SaveFlag);
mCanvas->clipRect(rect, SkRegion::kIntersect_Op, mSoftClipping);
mCanvas->clipRect(rect, SkRegion::kIntersect_Op, true);
}
void

View File

@ -135,7 +135,6 @@ private:
IntSize mSize;
SkRefPtr<SkCanvas> mCanvas;
SourceSurfaceSkia* mSnapshot;
bool mSoftClipping;
};
}

View File

@ -23,12 +23,14 @@
#include "SurfaceStream.h"
#include "GfxTexturesReporter.h"
#include "TextureGarbageBin.h"
#include "gfx2DGlue.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Preferences.h"
#ifdef XP_MACOSX
#include <CoreServices/CoreServices.h>
#include "gfxColor.h"
#endif
#if defined(MOZ_WIDGET_COCOA)
@ -114,6 +116,7 @@ static const char *sExtensionNames[] = {
"GL_EXT_transform_feedback",
"GL_NV_transform_feedback",
"GL_ANGLE_depth_texture",
"GL_KHR_debug",
nullptr
};
@ -972,6 +975,39 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
}
if (IsExtensionSupported(KHR_debug)) {
SymLoadStruct extSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fDebugMessageControl, { "DebugMessageControl", "DebugMessageControlKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDebugMessageInsert, { "DebugMessageInsert", "DebugMessageInsertKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDebugMessageCallback, { "DebugMessageCallback", "DebugMessageCallbackKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetDebugMessageLog, { "GetDebugMessageLog", "GetDebugMessageLogKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetPointerv, { "GetPointerv", "GetPointervKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPushDebugGroup, { "PushDebugGroup", "PushDebugGroupKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPopDebugGroup, { "PopDebugGroup", "PopDebugGroupKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fObjectLabel, { "ObjectLabel", "ObjectLabelKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetObjectLabel, { "GetObjectLabel", "GetObjectLabelKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fObjectPtrLabel, { "ObjectPtrLabel", "ObjectPtrLabelKHR", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetObjectPtrLabel, { "GetObjectPtrLabel", "GetObjectPtrLabelKHR", nullptr } },
{ nullptr, { nullptr } },
};
if (!LoadSymbols(&extSymbols[0], trygl, prefix)) {
NS_ERROR("GL supports KHR_debug without supplying its functions.");
MarkExtensionUnsupported(KHR_debug);
mSymbols.fDebugMessageControl = nullptr;
mSymbols.fDebugMessageInsert = nullptr;
mSymbols.fDebugMessageCallback = nullptr;
mSymbols.fGetDebugMessageLog = nullptr;
mSymbols.fGetPointerv = nullptr;
mSymbols.fPushDebugGroup = nullptr;
mSymbols.fPopDebugGroup = nullptr;
mSymbols.fObjectLabel = nullptr;
mSymbols.fGetObjectLabel = nullptr;
mSymbols.fObjectPtrLabel = nullptr;
mSymbols.fGetObjectPtrLabel = nullptr;
}
}
// Load developer symbols, don't fail if we can't find them.
SymLoadStruct auxSymbols[] = {

View File

@ -395,6 +395,7 @@ public:
EXT_transform_feedback,
NV_transform_feedback,
ANGLE_depth_texture,
KHR_debug,
Extensions_Max,
Extensions_End
};
@ -896,6 +897,27 @@ public:
AFTER_GL_CALL;
}
void fDebugMessageCallback(GLDEBUGPROC callback, const GLvoid* userParam) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDebugMessageCallback);
mSymbols.fDebugMessageCallback(callback, userParam);
AFTER_GL_CALL;
}
void fDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, realGLboolean enabled) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDebugMessageControl);
mSymbols.fDebugMessageControl(source, type, severity, count, ids, enabled);
AFTER_GL_CALL;
}
void fDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDebugMessageInsert);
mSymbols.fDebugMessageInsert(source, type, id, severity, length, buf);
AFTER_GL_CALL;
}
void fDetachShader(GLuint program, GLuint shader) {
BEFORE_GL_CALL;
mSymbols.fDetachShader(program, shader);
@ -1094,6 +1116,35 @@ public:
AFTER_GL_CALL;
}
GLuint fGetDebugMessageLog(GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetDebugMessageLog);
GLuint ret = mSymbols.fGetDebugMessageLog(count, bufsize, sources, types, ids, severities, lengths, messageLog);
AFTER_GL_CALL;
return ret;
}
void fGetPointerv(GLenum pname, GLvoid** params) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetPointerv);
mSymbols.fGetPointerv(pname, params);
AFTER_GL_CALL;
}
void fGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar* label) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetObjectLabel);
mSymbols.fGetObjectLabel(identifier, name, bufSize, length, label);
AFTER_GL_CALL;
}
void fGetObjectPtrLabel(GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetObjectPtrLabel);
mSymbols.fGetObjectPtrLabel(ptr, bufSize, length, label);
AFTER_GL_CALL;
}
void fGenerateMipmap(GLenum target) {
BEFORE_GL_CALL;
mSymbols.fGenerateMipmap(target);
@ -1254,6 +1305,20 @@ public:
AFTER_GL_CALL;
}
void fObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar* label) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fObjectLabel);
mSymbols.fObjectLabel(identifier, name, length, label);
AFTER_GL_CALL;
}
void fObjectPtrLabel(GLvoid* ptr, GLsizei length, const GLchar* label) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fObjectPtrLabel);
mSymbols.fObjectPtrLabel(ptr, length, label);
AFTER_GL_CALL;
}
void fPixelStorei(GLenum pname, GLint param) {
BEFORE_GL_CALL;
mSymbols.fPixelStorei(pname, param);
@ -1272,6 +1337,20 @@ public:
AFTER_GL_CALL;
}
void fPopDebugGroup() {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fPopDebugGroup);
mSymbols.fPopDebugGroup();
AFTER_GL_CALL;
}
void fPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar* message) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fPushDebugGroup);
mSymbols.fPushDebugGroup(source, id, length, message);
AFTER_GL_CALL;
}
void fReadBuffer(GLenum mode) {
BEFORE_GL_CALL;
mSymbols.fReadBuffer(mode);

View File

@ -442,6 +442,30 @@ struct GLContextSymbols
// EXT_transform_feedback only
typedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSET) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
PFNGLBINDBUFFEROFFSET fBindBufferOffset;
// KHR_debug
typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROL) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, realGLboolean enabled);
PFNGLDEBUGMESSAGECONTROL fDebugMessageControl;
typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERT) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);
PFNGLDEBUGMESSAGEINSERT fDebugMessageInsert;
typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACK) (GLDEBUGPROC callback, const GLvoid* userParam);
PFNGLDEBUGMESSAGECALLBACK fDebugMessageCallback;
typedef GLuint (GLAPIENTRY * PFNGLDEBUGMESSAGELOG) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog);
PFNGLDEBUGMESSAGELOG fGetDebugMessageLog;
typedef void (GLAPIENTRY * PFNGLGETPOINTERV) (GLenum pname, GLvoid** params);
PFNGLGETPOINTERV fGetPointerv;
typedef void (GLAPIENTRY * PFNGLPUSHDEBUGGROUP) (GLenum source, GLuint id, GLsizei length, const GLchar* message);
PFNGLPUSHDEBUGGROUP fPushDebugGroup;
typedef void (GLAPIENTRY * PFNGLPOPDEBUGGROUP) (void);
PFNGLPOPDEBUGGROUP fPopDebugGroup;
typedef void (GLAPIENTRY * PFNGLOBJECTLABEL) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label);
PFNGLOBJECTLABEL fObjectLabel;
typedef void (GLAPIENTRY * PFNGLGETOBJECTLABEL) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar* label);
PFNGLGETOBJECTLABEL fGetObjectLabel;
typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABEL) (GLvoid* ptr, GLsizei length, const GLchar* label);
PFNGLOBJECTPTRLABEL fObjectPtrLabel;
typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABEL) (GLvoid* ptr, GLsizei bufSize, GLsizei* length, GLchar* label);
PFNGLGETOBJECTPTRLABEL fGetObjectPtrLabel;
};
}

View File

@ -8,6 +8,17 @@
#include <stddef.h>
#include <stdint.h>
#ifndef GLAPIENTRY
# ifdef WIN32
# include <windef.h>
# define GLAPIENTRY APIENTRY
# define GLAPI
# else
# define GLAPIENTRY
# define GLAPI
# endif
#endif
typedef int8_t realGLboolean;
#if !defined(__gltypes_h_) && !defined(__gl_h_)
@ -49,6 +60,15 @@ typedef uint64_t GLuint64;
// OES_EGL_image (GLES)
typedef void* GLeglImage;
// KHR_debug
typedef void (GLAPIENTRY *GLDEBUGPROC)(GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
const GLvoid* userParam);
// EGL types
typedef void* EGLImage;
typedef int EGLint;
@ -71,14 +91,4 @@ typedef uint64_t EGLTime;
#define EGL_NO_SYNC ((EGLSync)0)
#define EGL_NO_IMAGE ((EGLImage)0)
#ifndef GLAPIENTRY
# ifdef WIN32
# define GLAPIENTRY APIENTRY
# define GLAPI
# else
# define GLAPIENTRY
# define GLAPI
# endif
#endif
#endif

View File

@ -30,6 +30,7 @@
#include "mozilla/layers/ShadowLayers.h" // for ShadowableLayer
#include "mozilla/layers/TextureClient.h" // for DeprecatedTextureClient
#include "nsSize.h" // for nsIntSize
#include "gfx2DGlue.h"
namespace mozilla {

View File

@ -30,6 +30,7 @@
#ifdef XP_WIN
#include "gfxWindowsPlatform.h"
#endif
#include "gfx2DGlue.h"
namespace mozilla {

View File

@ -21,6 +21,7 @@
#include "nsSize.h" // for nsIntSize
#include "gfxReusableSharedImageSurfaceWrapper.h"
#include "nsMathUtils.h" // for NS_roundf
#include "gfx2DGlue.h"
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
#include "cairo.h"

View File

@ -15,6 +15,7 @@
#include "nsUnicharUtils.h"
#include "nscore.h" // for PRUnichar
#include "prtypes.h" // for PR_STATIC_ASSERT
#include "mozilla/gfx/2D.h"
nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant,
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,

View File

@ -14,6 +14,7 @@
#include "mozilla/gfx/Matrix.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/gfx/2D.h"
#include "gfxColor.h"
namespace mozilla {
namespace gfx {

View File

@ -47,7 +47,6 @@
#include "nsComponentManagerUtils.h"
#include "nsISupportsUtils.h"
#include "nsCOMPtr.h"
#include "nsIConsoleService.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsIClipboardHelper.h"

View File

@ -6,11 +6,12 @@
#ifndef _GFXALPHARECOVERY_H_
#define _GFXALPHARECOVERY_H_
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "mozilla/SSE.h"
#include "gfxTypes.h"
#include "nsRect.h"
struct nsIntRect;
class gfxImageSurface;
class gfxAlphaRecovery {
public:

View File

@ -3,8 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/SSE.h"
#include "gfxAlphaRecovery.h"
#include "gfxImageSurface.h"
#include "nsRect.h"
#include <emmintrin.h>
// This file should only be compiled on x86 and x64 systems. Additionally,

View File

@ -17,6 +17,7 @@
#include "nsIScreen.h"
#include "nsIScreenManager.h"
#include "nsILocaleService.h"
#include "nsServiceManagerUtils.h"
#include "cairo.h"

View File

@ -4,7 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxSharedImageSurface.h"
#include "gfxBaseSharedMemorySurface.h"
#include "cairo.h"
const cairo_user_data_key_t SHM_KEY = {0};

View File

@ -9,12 +9,13 @@
#include "mozilla/ipc/Shmem.h"
#include "mozilla/ipc/SharedMemory.h"
#include "cairo.h"
#include "gfxASurface.h"
#include "gfxImageSurface.h"
#include "pratom.h"
typedef struct _cairo_user_data_key cairo_user_data_key_t;
struct SharedImageInfo {
int32_t width;
int32_t height;

View File

@ -4,6 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxBlur.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "mozilla/gfx/Blur.h"

View File

@ -6,9 +6,14 @@
#ifndef GFX_BLUR_H
#define GFX_BLUR_H
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxTypes.h"
#include "nsSize.h"
#include "nsAutoPtr.h"
#include "gfxPoint.h"
class gfxContext;
class gfxImageSurface;
struct gfxRect;
namespace mozilla {
namespace gfx {

View File

@ -9,7 +9,6 @@
#include <math.h>
#include "mozilla/Alignment.h"
#include "mozilla/Constants.h"
#include "cairo.h"
@ -22,6 +21,7 @@
#include "gfxPlatform.h"
#include "gfxTeeSurface.h"
#include "GeckoProfiler.h"
#include "gfx2DGlue.h"
#include <algorithm>
#if CAIRO_HAS_DWRITE_FONT

View File

@ -9,14 +9,13 @@
#include "gfxTypes.h"
#include "gfxASurface.h"
#include "gfxColor.h"
#include "gfxPoint.h"
#include "gfxRect.h"
#include "gfxMatrix.h"
#include "gfxPattern.h"
#include "gfxPath.h"
#include "nsISupportsImpl.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "mozilla/gfx/2D.h"

View File

@ -4,29 +4,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Util.h"
#include "nsAlgorithm.h"
#include "nsString.h"
#include "nsBidiUtils.h"
#include "gfxTypes.h"
#include "nsPromiseFlatString.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "gfxPlatformMac.h"
#include "gfxCoreTextShaper.h"
#include "gfxMacFont.h"
#include "gfxFontTest.h"
#include "gfxFontUtils.h"
#include "mozilla/gfx/2D.h"
#include "gfxQuartzSurface.h"
#include "gfxMacPlatformFontList.h"
#include "gfxUserFontSet.h"
#include "nsUnicodeRange.h"
#include <algorithm>
using namespace mozilla;

View File

@ -6,13 +6,9 @@
#ifndef GFX_CORETEXTSHAPER_H
#define GFX_CORETEXTSHAPER_H
#include "gfxTypes.h"
#include "gfxFont.h"
#include "gfxFontUtils.h"
#include "gfxPlatform.h"
#include "gfxMacPlatformFontList.h"
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>
class gfxMacFont;

View File

@ -7,7 +7,6 @@
#include "gfxASurface.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "mozilla/arm.h"
#ifdef MOZ_X11
#include "cairo.h"
#include "gfxXlibSurface.h"
@ -79,7 +78,7 @@ PreparePatternForUntiledDrawing(gfxPattern* aPattern,
aDeviceToImage.xy == 0.0 && aDeviceToImage.yx == 0.0;
GraphicsFilter filter =
isDownscale ? aDefaultFilter : GraphicsFilter::FILTER_FAST;
isDownscale ? aDefaultFilter : (const GraphicsFilter)GraphicsFilter::FILTER_FAST;
aPattern->SetFilter(filter);
// Use the default EXTEND_NONE

View File

@ -6,11 +6,8 @@
#ifndef GFX_DRAWABLE_H
#define GFX_DRAWABLE_H
#include "nsISupportsImpl.h"
#include "nsAutoPtr.h"
#include "gfxTypes.h"
#include "gfxRect.h"
#include "gfxColor.h"
#include "gfxMatrix.h"
#include "GraphicsFilter.h"

View File

@ -7,6 +7,7 @@
#include "gfxFT2Utils.h"
#include "harfbuzz/hb.h"
#include "mozilla/Likely.h"
#include "gfxFontConstants.h"
using namespace mozilla::gfx;

View File

@ -52,6 +52,7 @@
#include "nsAppDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
#include "nsIMemory.h"
#include "gfxFontConstants.h"
#include "mozilla/Preferences.h"
#include "mozilla/scache/StartupCache.h"

View File

@ -12,7 +12,6 @@
#include "prlog.h"
#include "nsServiceManagerUtils.h"
#include "nsReadableUtils.h"
#include "nsExpirationTracker.h"
#include "nsILanguageAtomService.h"
#include "nsITimer.h"
@ -22,7 +21,6 @@
#include "nsGkAtoms.h"
#include "gfxTypes.h"
#include "nsAlgorithm.h"
#include "gfxContext.h"
#include "gfxFontMissingGlyphs.h"
#include "gfxUserFontSet.h"
@ -40,6 +38,7 @@
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "gfxSVGGlyphs.h"
#include "gfx2DGlue.h"
#include "cairo.h"
#include "gfxFontTest.h"
@ -50,6 +49,7 @@
#include "nsCRT.h"
#include "GeckoProfiler.h"
#include "gfxFontConstants.h"
#include <algorithm>

View File

@ -6,7 +6,6 @@
#ifndef GFX_FONT_H
#define GFX_FONT_H
#include "nsAlgorithm.h"
#include "gfxTypes.h"
#include "nsString.h"
#include "gfxPoint.h"
@ -17,22 +16,19 @@
#include "gfxSkipChars.h"
#include "gfxRect.h"
#include "nsExpirationTracker.h"
#include "gfxFontConstants.h"
#include "gfxPlatform.h"
#include "nsIAtom.h"
#include "nsISupportsImpl.h"
#include "gfxPattern.h"
#include "mozilla/HashFunctions.h"
#include "nsIMemoryReporter.h"
#include "nsIObserver.h"
#include "gfxFontFeatures.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/Attributes.h"
#include <algorithm>
#include "nsUnicodeProperties.h"
#include "harfbuzz/hb.h"
#include "DrawMode.h"
#include "nsUnicodeScriptCodes.h"
#include "nsDataHashtable.h"
#include "harfbuzz/hb.h"
typedef struct _cairo_scaled_font cairo_scaled_font_t;
typedef struct gr_face gr_face;
@ -62,6 +58,12 @@ class nsILanguageAtomService;
struct FontListSizes;
struct gfxTextRunDrawCallbacks;
namespace mozilla {
namespace gfx {
class GlyphRenderingOptions;
}
}
struct gfxFontStyle {
gfxFontStyle();
gfxFontStyle(uint8_t aStyle, uint16_t aWeight, int16_t aStretch,

View File

@ -7,7 +7,6 @@
#ifndef GFX_FONT_FEATURES_H
#define GFX_FONT_FEATURES_H
#include "gfxTypes.h"
#include "nsTHashtable.h"
#include "nsTArray.h"
#include "nsString.h"

View File

@ -5,6 +5,8 @@
#include "gfxFontMissingGlyphs.h"
#include "nsDeviceContext.h"
#include "gfxContext.h"
#include "gfxColor.h"
#define CHAR_BITS(b00, b01, b02, b10, b11, b12, b20, b21, b22, b30, b31, b32, b40, b41, b42) \
((b00 << 0) | (b01 << 1) | (b02 << 2) | (b10 << 3) | (b11 << 4) | (b12 << 5) | \

View File

@ -7,9 +7,10 @@
#define GFX_FONTMISSINGGLYPHS_H
#include "gfxTypes.h"
#include "gfxContext.h"
#include "gfxRect.h"
class gfxContext;
/**
* This class should not be instantiated. It's just a container
* for some helper functions.

View File

@ -11,9 +11,6 @@
#include "cairo/cairo.h"
#include "gfxFont.h"
#include "gfxUserFontSet.h"
struct gfxFontTestItem {
gfxFontTestItem(const nsCString& fontName,
cairo_glyph_t *cglyphs, int nglyphs)

View File

@ -5,8 +5,8 @@
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#endif
#include "mozilla/Util.h"
@ -17,7 +17,6 @@
#include "mozilla/Preferences.h"
#include "nsIUUIDGenerator.h"
#include "nsMemory.h"
#include "nsICharsetConverterManager.h"
#include "harfbuzz/hb.h"
@ -25,10 +24,6 @@
#include "plbase64.h"
#include "prlog.h"
#ifdef XP_MACOSX
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifdef PR_LOGGING
#define LOG(log, args) PR_LOG(gfxPlatform::GetLog(log), \
@ -1429,4 +1424,4 @@ gfxFontUtils::IsCffFont(const uint8_t* aFontData)
return (sfntHeader->sfntVersion == TRUETYPE_TAG('O','T','T','O'));
}
#endif
#endif

View File

@ -6,14 +6,7 @@
#ifndef GFX_FONT_UTILS_H
#define GFX_FONT_UTILS_H
#include "gfxTypes.h"
#include "gfxPlatform.h"
#include "nsAlgorithm.h"
#include "prcpucfg.h"
#include "nsDataHashtable.h"
#include "nsITimer.h"
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"

View File

@ -19,6 +19,8 @@
#include "nsIAtom.h"
#include "nsCRT.h"
#include "gfxFontConstants.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla;

View File

@ -16,6 +16,7 @@
#include "gfxContext.h"
#include "mozilla/Preferences.h"
#include "nsUnicodeProperties.h"
#include "gfxFontConstants.h"
#include "cairo-win32.h"

View File

@ -26,6 +26,7 @@
#include "nsAppDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
#include "nsIWindowsRegKey.h"
#include "gfxFontConstants.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Telemetry.h"

View File

@ -3,27 +3,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsString.h"
#include "nsBidiUtils.h"
#include "nsMathUtils.h"
#include "gfxTypes.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "gfxGraphiteShaper.h"
#include "gfxFontUtils.h"
#include "nsString.h"
#include "gfxContext.h"
#include "graphite2/Font.h"
#include "graphite2/Segment.h"
#include "harfbuzz/hb.h"
#include "cairo.h"
#include "nsUnicodeRange.h"
#include "nsCRT.h"
#define FloatToFixed(f) (65536 * (f))
#define FixedToFloat(f) ((f) * (1.0 / 65536.0))
// Right shifts of negative (signed) integers are undefined, as are overflows

View File

@ -6,10 +6,7 @@
#ifndef GFX_GRAPHITESHAPER_H
#define GFX_GRAPHITESHAPER_H
#include "gfxTypes.h"
#include "gfxFont.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
struct gr_face;
struct gr_font;

View File

@ -3,15 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsAlgorithm.h"
#include "nsString.h"
#include "nsBidiUtils.h"
#include "nsMathUtils.h"
#include "gfxTypes.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "gfxHarfBuzzShaper.h"
#include "gfxFontUtils.h"
#include "nsUnicodeProperties.h"
@ -21,9 +14,6 @@
#include "harfbuzz/hb.h"
#include "harfbuzz/hb-ot.h"
#include "cairo.h"
#include "nsCRT.h"
#include <algorithm>
#define FloatToFixed(f) (65536 * (f))

View File

@ -6,10 +6,7 @@
#ifndef GFX_HARFBUZZSHAPER_H
#define GFX_HARFBUZZSHAPER_H
#include "gfxTypes.h"
#include "gfxFont.h"
#include "nsDataHashtable.h"
#include "nsPoint.h"
#include "harfbuzz/hb.h"

View File

@ -5,7 +5,9 @@
#include "mozilla/MemoryReporting.h"
#if defined(HAVE_POSIX_MEMALIGN)
#include "gfxAlphaRecovery.h"
#endif
#include "gfxImageSurface.h"
#include "cairo.h"

View File

@ -9,7 +9,7 @@
#include "mozilla/MemoryReporting.h"
#include "gfxASurface.h"
#include "nsAutoPtr.h"
#include "gfxPoint.h"
#include "nsSize.h"
// ARGB -- raw buffer.. wont be changed.. good for storing data.

View File

@ -14,6 +14,8 @@
#include "gfxPlatformMac.h"
#include "gfxContext.h"
#include "gfxFontUtils.h"
#include "gfxMacPlatformFontList.h"
#include "gfxFontConstants.h"
#include "cairo-quartz.h"

View File

@ -8,10 +8,10 @@
#include "mozilla/MemoryReporting.h"
#include "gfxFont.h"
#include "gfxMacPlatformFontList.h"
#include "mozilla/gfx/2D.h"
#include "cairo.h"
#include <ApplicationServices/ApplicationServices.h>
class MacOSFontEntry;
class gfxMacFont : public gfxFont
{

View File

@ -62,10 +62,12 @@
#include "nsDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
#include "nsCharTraits.h"
#include "gfxFontConstants.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/gfx/2D.h"
#include <unistd.h>
#include <time.h>

View File

@ -9,7 +9,6 @@
#include "gfxPoint.h"
#include "gfxTypes.h"
#include "gfxRect.h"
#include "nsMathUtils.h"
// XX - I don't think this class should use gfxFloat at all,
// but should use 'double' and be called gfxDoubleMatrix;

View File

@ -29,6 +29,7 @@
#include "nsUnicodeScriptCodes.h"
#include "gfxFontconfigUtils.h"
#include "gfxUserFontSet.h"
#include "gfxFontConstants.h"
#include <cairo.h>
#include <cairo-ft.h>

View File

@ -7,6 +7,7 @@
#include "gfxPattern.h"
#include "gfxASurface.h"
#include "gfxPlatform.h"
#include "gfx2DGlue.h"
#include "cairo.h"

View File

@ -8,16 +8,16 @@
#include "gfxTypes.h"
#include "gfxColor.h"
#include "gfxMatrix.h"
#include "nsISupportsImpl.h"
#include "nsAutoPtr.h"
#include "mozilla/Alignment.h"
#include "mozilla/gfx/2D.h"
#include "GraphicsFilter.h"
#include "nsISupportsImpl.h"
#include "nsAutoPtr.h"
class gfxContext;
class gfxASurface;
struct gfxRGBA;
typedef struct _cairo_pattern cairo_pattern_t;

View File

@ -12,7 +12,6 @@
#include "mozilla/layers/ImageBridgeChild.h"
#include "prlog.h"
#include "prenv.h"
#include "gfxPlatform.h"
@ -38,17 +37,15 @@
#include "gfxPlatformFontList.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxUserFontSet.h"
#include "nsUnicodeProperties.h"
#include "harfbuzz/hb.h"
#include "gfxGraphiteShaper.h"
#include "gfx2DGlue.h"
#include "nsUnicodeRange.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
#include "nsUnicharUtilCIID.h"
#include "nsILocaleService.h"
#include "nsReadableUtils.h"
#include "nsWeakReference.h"
@ -68,12 +65,6 @@
#include "skia/SkGraphics.h"
#endif
#ifdef USE_SKIA_GPU
#include "skia/GrContext.h"
#include "skia/GrGLInterface.h"
#include "GLContextSkia.h"
#endif
#include "mozilla/Preferences.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"

View File

@ -9,18 +9,14 @@
#include "prlog.h"
#include "nsTArray.h"
#include "nsString.h"
#include "nsIObserver.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "gfxTypes.h"
#include "gfxColor.h"
#include "nsRect.h"
#include "qcms.h"
#include "mozilla/gfx/2D.h"
#include "gfx2DGlue.h"
#include "mozilla/RefPtr.h"
#include "GfxInfoCollector.h"
@ -42,11 +38,19 @@ class gfxPlatformFontList;
class gfxTextRun;
class nsIURI;
class nsIAtom;
class nsIObserver;
struct gfxRGBA;
namespace mozilla {
namespace gl {
class GLContext;
}
namespace gfx {
class DrawTarget;
class SourceSurface;
class ScaledFont;
class DrawEventRecorder;
}
}
extern cairo_user_data_key_t kDrawTarget;

View File

@ -20,6 +20,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/gfx/2D.h"
using namespace mozilla;

View File

@ -9,20 +9,16 @@
#include "gfxQuartzSurface.h"
#include "gfxQuartzImageSurface.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/QuartzSupport.h"
#include "gfxMacPlatformFontList.h"
#include "gfxMacFont.h"
#include "gfxCoreTextShaper.h"
#include "gfxUserFontSet.h"
#include "nsCRT.h"
#include "nsTArray.h"
#include "nsUnicodeRange.h"
#include "mozilla/Preferences.h"
#include "qcms.h"
#include "gfx2DGlue.h"
#include <dlfcn.h>

View File

@ -6,7 +6,7 @@
#ifndef GFX_PLATFORM_MAC_H
#define GFX_PLATFORM_MAC_H
#include "nsTArray.h"
#include "nsTArrayForwardDeclare.h"
#include "gfxPlatform.h"
#define MAC_OS_X_VERSION_10_6_HEX 0x00001060
@ -14,9 +14,6 @@
#define MAC_OS_X_MAJOR_VERSION_MASK 0xFFFFFFF0U
class gfxTextRun;
class gfxFontFamily;
namespace mozilla { namespace gfx { class DrawTarget; }}
class gfxPlatformMac : public gfxPlatform {

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