diff --git a/accessible/src/atk/AccessibleWrap.cpp b/accessible/src/atk/AccessibleWrap.cpp index 3ee028cb8b5..da124020e0e 100644 --- a/accessible/src/atk/AccessibleWrap.cpp +++ b/accessible/src/atk/AccessibleWrap.cpp @@ -954,6 +954,11 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent) Accessible* accessible = aEvent->GetAccessible(); NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE); + // The accessible can become defunct if we have an xpcom event listener + // which decides it would be fun to change the DOM and flush layout. + if (accessible->IsDefunct()) + return NS_OK; + uint32_t type = aEvent->GetEventType(); AtkObject* atkObj = AccessibleWrap::GetAtkObject(accessible); diff --git a/accessible/src/base/NotificationController.cpp b/accessible/src/base/NotificationController.cpp index dbea1939fc6..f805b0454e6 100644 --- a/accessible/src/base/NotificationController.cpp +++ b/accessible/src/base/NotificationController.cpp @@ -151,6 +151,10 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime) if (!mDocument) return; + if (mObservingState == eRefreshProcessing || + mObservingState == eRefreshProcessingForUpdate) + return; + // Any generic notifications should be queued if we're processing content // insertions or generic notifications. mObservingState = eRefreshProcessingForUpdate; @@ -265,18 +269,20 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime) mDocument->ProcessInvalidationList(); // If a generic notification occurs after this point then we may be allowed to - // process it synchronously. - mObservingState = eRefreshObserving; + // process it synchronously. However we do not want to reenter if fireing + // events causes script to run. + mObservingState = eRefreshProcessing; ProcessEventQueue(); + mObservingState = eRefreshObserving; if (!mDocument) return; // Stop further processing if there are no new notifications of any kind or // events and document load is processed. - if (mContentInsertions.Length() == 0 && mNotifications.Length() == 0 && - mEvents.Length() == 0 && mTextHash.Count() == 0 && - mHangingChildDocuments.Length() == 0 && + if (mContentInsertions.IsEmpty() && mNotifications.IsEmpty() && + mEvents.IsEmpty() && mTextHash.Count() == 0 && + mHangingChildDocuments.IsEmpty() && mDocument->HasLoadState(DocAccessible::eCompletelyLoaded) && mPresShell->RemoveRefreshObserver(this, Flush_Display)) { mObservingState = eNotObservingRefresh; diff --git a/accessible/src/base/NotificationController.h b/accessible/src/base/NotificationController.h index 5e1b812c524..4b7dfbb7fb9 100644 --- a/accessible/src/base/NotificationController.h +++ b/accessible/src/base/NotificationController.h @@ -212,6 +212,7 @@ private: enum eObservingState { eNotObservingRefresh, eRefreshObserving, + eRefreshProcessing, eRefreshProcessingForUpdate }; eObservingState mObservingState; diff --git a/accessible/tests/mochitest/actions/test_link.html b/accessible/tests/mochitest/actions/test_link.html index 0c46c57789b..49fc7d911b2 100644 --- a/accessible/tests/mochitest/actions/test_link.html +++ b/accessible/tests/mochitest/actions/test_link.html @@ -17,10 +17,6 @@ src="../actions.js"> diff --git a/content/media/test/crashtests/876207.html b/content/media/test/crashtests/876207.html new file mode 100644 index 00000000000..ed44d1a11d7 --- /dev/null +++ b/content/media/test/crashtests/876207.html @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/content/media/test/crashtests/876215.html b/content/media/test/crashtests/876215.html new file mode 100644 index 00000000000..3ead4ae7287 --- /dev/null +++ b/content/media/test/crashtests/876215.html @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/content/media/test/crashtests/crashtests.list b/content/media/test/crashtests/crashtests.list index 03830dfea2f..733e0ab602b 100644 --- a/content/media/test/crashtests/crashtests.list +++ b/content/media/test/crashtests/crashtests.list @@ -22,6 +22,9 @@ load 874952.html load 875144.html load 875596.html load 875911.html +load 876118.html +load 876207.html +load 876215.html load 876249.html load 876252.html load 876834.html diff --git a/content/media/webaudio/AudioContext.cpp b/content/media/webaudio/AudioContext.cpp index c4d8b131648..0d4ac1055d2 100644 --- a/content/media/webaudio/AudioContext.cpp +++ b/content/media/webaudio/AudioContext.cpp @@ -28,12 +28,6 @@ #include "WaveTable.h" #include "nsNetUtil.h" -// Note that this number is an arbitrary large value to protect against OOM -// attacks. -const unsigned MAX_SCRIPT_PROCESSOR_CHANNELS = 10000; -const unsigned MAX_CHANNEL_SPLITTER_OUTPUTS = UINT16_MAX; -const unsigned MAX_CHANNEL_MERGER_INPUTS = UINT16_MAX; - namespace mozilla { namespace dom { @@ -109,9 +103,13 @@ AudioContext::Constructor(const GlobalObject& aGlobal, return nullptr; } - if (aSampleRate <= 0.0f || aSampleRate >= TRACK_RATE_MAX) { + if (aNumberOfChannels == 0 || + aNumberOfChannels > WebAudioUtils::MaxChannelCount || + aLength == 0 || + aSampleRate <= 0.0f || + aSampleRate >= TRACK_RATE_MAX) { // The DOM binding protects us against infinity and NaN - aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR); + aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); return nullptr; } @@ -211,8 +209,8 @@ AudioContext::CreateScriptProcessor(uint32_t aBufferSize, ErrorResult& aRv) { if ((aNumberOfInputChannels == 0 && aNumberOfOutputChannels == 0) || - aNumberOfInputChannels > MAX_SCRIPT_PROCESSOR_CHANNELS || - aNumberOfOutputChannels > MAX_SCRIPT_PROCESSOR_CHANNELS || + aNumberOfInputChannels > WebAudioUtils::MaxChannelCount || + aNumberOfOutputChannels > WebAudioUtils::MaxChannelCount || !IsValidBufferSize(aBufferSize)) { aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); return nullptr; @@ -269,7 +267,7 @@ already_AddRefed AudioContext::CreateChannelSplitter(uint32_t aNumberOfOutputs, ErrorResult& aRv) { if (aNumberOfOutputs == 0 || - aNumberOfOutputs > MAX_CHANNEL_SPLITTER_OUTPUTS) { + aNumberOfOutputs > WebAudioUtils::MaxChannelCount) { aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); return nullptr; } @@ -283,7 +281,7 @@ already_AddRefed AudioContext::CreateChannelMerger(uint32_t aNumberOfInputs, ErrorResult& aRv) { if (aNumberOfInputs == 0 || - aNumberOfInputs > MAX_CHANNEL_MERGER_INPUTS) { + aNumberOfInputs > WebAudioUtils::MaxChannelCount) { aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); return nullptr; } diff --git a/content/media/webaudio/AudioDestinationNode.cpp b/content/media/webaudio/AudioDestinationNode.cpp index b8124331e70..0f61de55a4f 100644 --- a/content/media/webaudio/AudioDestinationNode.cpp +++ b/content/media/webaudio/AudioDestinationNode.cpp @@ -60,7 +60,10 @@ public: // Record our input buffer MOZ_ASSERT(mWriteIndex < mLength, "How did this happen?"); const uint32_t duration = std::min(WEBAUDIO_BLOCK_SIZE, mLength - mWriteIndex); - for (uint32_t i = 0; i < mInputChannels.Length(); ++i) { + const uint32_t commonChannelCount = std::min(mInputChannels.Length(), + aInput.mChannelData.Length()); + // First, copy as many channels in the input as we have + for (uint32_t i = 0; i < commonChannelCount; ++i) { if (aInput.IsNull()) { PodZero(mInputChannels[i] + mWriteIndex, duration); } else { @@ -80,6 +83,10 @@ public: } } } + // Then, silence all of the remaining channels + for (uint32_t i = commonChannelCount; i < mInputChannels.Length(); ++i) { + PodZero(mInputChannels[i] + mWriteIndex, duration); + } mWriteIndex += duration; if (mWriteIndex == mLength) { diff --git a/content/media/webaudio/AudioNode.h b/content/media/webaudio/AudioNode.h index 1bf200eab98..723550c99e9 100644 --- a/content/media/webaudio/AudioNode.h +++ b/content/media/webaudio/AudioNode.h @@ -17,6 +17,7 @@ #include "AudioContext.h" #include "AudioParamTimeline.h" #include "MediaStreamGraph.h" +#include "WebAudioUtils.h" struct JSContext; @@ -161,7 +162,8 @@ public: uint32_t ChannelCount() const { return mChannelCount; } void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) { - if (aChannelCount == 0) { + if (aChannelCount == 0 || + aChannelCount > WebAudioUtils::MaxChannelCount) { aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); return; } diff --git a/content/media/webaudio/ReportDecodeResultTask.h b/content/media/webaudio/ReportDecodeResultTask.h index 30d1d4795ec..40e58fef209 100644 --- a/content/media/webaudio/ReportDecodeResultTask.h +++ b/content/media/webaudio/ReportDecodeResultTask.h @@ -7,6 +7,7 @@ #ifndef ReportDecodeResultTask_h_ #define ReportDecodeResultTask_h_ +#include "mozilla/Attributes.h" #include "MediaBufferDecoder.h" namespace mozilla { @@ -22,7 +23,7 @@ public: MOZ_ASSERT(aFunction); } - NS_IMETHOD Run() + NS_IMETHOD Run() MOZ_OVERRIDE { MOZ_ASSERT(NS_IsMainThread()); diff --git a/content/media/webaudio/WebAudioUtils.h b/content/media/webaudio/WebAudioUtils.h index 76c0a2c7d2a..7ca51d1aedd 100644 --- a/content/media/webaudio/WebAudioUtils.h +++ b/content/media/webaudio/WebAudioUtils.h @@ -21,6 +21,10 @@ class AudioNodeStream; namespace dom { struct WebAudioUtils { + // This is an arbitrary large number used to protect against OOMs. + // We can adjust it later if needed. + static const uint32_t MaxChannelCount = 10000; + static bool FuzzyEqual(float v1, float v2) { using namespace std; diff --git a/content/media/webaudio/test/Makefile.in b/content/media/webaudio/test/Makefile.in index 55dcb32549c..a21b1a6e890 100644 --- a/content/media/webaudio/test/Makefile.in +++ b/content/media/webaudio/test/Makefile.in @@ -23,6 +23,7 @@ MOCHITEST_FILES := \ test_bug867104.html \ test_bug867174.html \ test_bug867203.html \ + test_bug875221.html \ test_bug875402.html \ test_analyserNode.html \ test_AudioBuffer.html \ @@ -61,6 +62,8 @@ MOCHITEST_FILES := \ test_mixingRules.html \ test_nodeToParamConnection.html \ test_OfflineAudioContext.html \ + test_offlineDestinationChannelCountLess.html \ + test_offlineDestinationChannelCountMore.html \ test_pannerNode.html \ test_scriptProcessorNode.html \ test_scriptProcessorNodeChannelCount.html \ diff --git a/content/media/webaudio/test/test_OfflineAudioContext.html b/content/media/webaudio/test/test_OfflineAudioContext.html index e6c723506ff..d01f7ada4b9 100644 --- a/content/media/webaudio/test/test_OfflineAudioContext.html +++ b/content/media/webaudio/test/test_OfflineAudioContext.html @@ -25,10 +25,20 @@ addLoadEvent(function() { expectException(function() { new OfflineAudioContext(2, 100, 0); - }, DOMException.SYNTAX_ERR); + }, DOMException.NOT_SUPPORTED_ERR); expectException(function() { new OfflineAudioContext(2, 100, -1); - }, DOMException.SYNTAX_ERR); + }, DOMException.NOT_SUPPORTED_ERR); + expectException(function() { + new OfflineAudioContext(0, 100, 44100); + }, DOMException.NOT_SUPPORTED_ERR); + new OfflineAudioContext(10000, 100, 44100); + expectException(function() { + new OfflineAudioContext(10001, 100, 44100); + }, DOMException.NOT_SUPPORTED_ERR); + expectException(function() { + new OfflineAudioContext(2, 0, 44100); + }, DOMException.NOT_SUPPORTED_ERR); var src = ctx.createBufferSource(); src.buffer = buf; diff --git a/content/media/webaudio/test/test_bug875221.html b/content/media/webaudio/test/test_bug875221.html new file mode 100644 index 00000000000..3f5d8557ad5 --- /dev/null +++ b/content/media/webaudio/test/test_bug875221.html @@ -0,0 +1,240 @@ + + + + Crashtest for bug 875221 + + + + +
+
+
+ + diff --git a/content/media/webaudio/test/test_offlineDestinationChannelCountLess.html b/content/media/webaudio/test/test_offlineDestinationChannelCountLess.html new file mode 100644 index 00000000000..fbf64c128d8 --- /dev/null +++ b/content/media/webaudio/test/test_offlineDestinationChannelCountLess.html @@ -0,0 +1,44 @@ + + + + Test OfflineAudioContext with a channel count less than the specified number + + + + + +
+
+
+ + diff --git a/content/media/webaudio/test/test_offlineDestinationChannelCountMore.html b/content/media/webaudio/test/test_offlineDestinationChannelCountMore.html new file mode 100644 index 00000000000..19ae8bd734a --- /dev/null +++ b/content/media/webaudio/test/test_offlineDestinationChannelCountMore.html @@ -0,0 +1,48 @@ + + + + Test OfflineAudioContext with a channel count less than the specified number + + + + + +
+
+
+ + diff --git a/content/media/webspeech/recognition/SpeechRecognition.h b/content/media/webspeech/recognition/SpeechRecognition.h index e9b3f692e54..5d46c7886e1 100644 --- a/content/media/webspeech/recognition/SpeechRecognition.h +++ b/content/media/webspeech/recognition/SpeechRecognition.h @@ -6,6 +6,7 @@ #pragma once +#include "mozilla/Attributes.h" #include "nsCOMPtr.h" #include "nsDOMEventTargetHelper.h" #include "nsString.h" @@ -280,7 +281,7 @@ public: ~SpeechEvent(); - NS_IMETHOD Run(); + NS_IMETHOD Run() MOZ_OVERRIDE; AudioSegment* mAudioSegment; nsRefPtr mRecognitionResultList; // TODO: make this a session being passed which also has index and stuff nsCOMPtr mError; diff --git a/content/media/webspeech/recognition/SpeechStreamListener.h b/content/media/webspeech/recognition/SpeechStreamListener.h index 428d9d24e89..8966615a5d0 100644 --- a/content/media/webspeech/recognition/SpeechStreamListener.h +++ b/content/media/webspeech/recognition/SpeechStreamListener.h @@ -27,9 +27,9 @@ public: TrackRate aTrackRate, TrackTicks aTrackOffset, uint32_t aTrackEvents, - const MediaSegment& aQueuedMedia); + const MediaSegment& aQueuedMedia) MOZ_OVERRIDE; - void NotifyFinished(MediaStreamGraph* aGraph); + void NotifyFinished(MediaStreamGraph* aGraph) MOZ_OVERRIDE; private: template void ConvertAndDispatchAudioChunk(AudioChunk& aChunk); diff --git a/content/media/webspeech/synth/ipc/SpeechSynthesisChild.h b/content/media/webspeech/synth/ipc/SpeechSynthesisChild.h index a92f64151c1..c934797e7e6 100644 --- a/content/media/webspeech/synth/ipc/SpeechSynthesisChild.h +++ b/content/media/webspeech/synth/ipc/SpeechSynthesisChild.h @@ -4,6 +4,7 @@ #pragma once +#include "mozilla/Attributes.h" #include "mozilla/dom/PSpeechSynthesisChild.h" #include "mozilla/dom/PSpeechSynthesisRequestChild.h" #include "nsSpeechTask.h" @@ -75,10 +76,10 @@ public: SpeechTaskChild(SpeechSynthesisUtterance* aUtterance); NS_IMETHOD Setup(nsISpeechTaskCallback* aCallback, - uint32_t aChannels, uint32_t aRate, uint8_t argc); + uint32_t aChannels, uint32_t aRate, uint8_t argc) MOZ_OVERRIDE; NS_IMETHOD SendAudio (const JS::Value& aData, const JS::Value& aLandmarks, - JSContext* aCx); + JSContext* aCx) MOZ_OVERRIDE; virtual void Pause(); diff --git a/content/smil/SMILBoolType.h b/content/smil/SMILBoolType.h index 93dd6c67748..d67d4556107 100644 --- a/content/smil/SMILBoolType.h +++ b/content/smil/SMILBoolType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SMILBOOLTYPE_H_ #define MOZILLA_SMILBOOLTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" namespace mozilla { @@ -19,20 +20,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/smil/SMILEnumType.h b/content/smil/SMILEnumType.h index f39a8202a9a..384646406bb 100644 --- a/content/smil/SMILEnumType.h +++ b/content/smil/SMILEnumType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SMILENUMTYPE_H_ #define MOZILLA_SMILENUMTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" namespace mozilla { @@ -19,20 +20,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/smil/SMILIntegerType.h b/content/smil/SMILIntegerType.h index e196b052f25..4d342f5ef75 100644 --- a/content/smil/SMILIntegerType.h +++ b/content/smil/SMILIntegerType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SMILINTEGERTYPE_H_ #define MOZILLA_SMILINTEGERTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" namespace mozilla { @@ -13,20 +14,20 @@ namespace mozilla { class SMILIntegerType : public nsISMILType { public: - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; static SMILIntegerType sSingleton; diff --git a/content/smil/SMILStringType.h b/content/smil/SMILStringType.h index 77b217b7d0e..ebcbce09fd0 100644 --- a/content/smil/SMILStringType.h +++ b/content/smil/SMILStringType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SMILSTRINGTYPE_H_ #define MOZILLA_SMILSTRINGTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" namespace mozilla { @@ -19,20 +20,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/smil/nsSMILAnimationController.h b/content/smil/nsSMILAnimationController.h index 647b9c309e4..ab98cd6a013 100644 --- a/content/smil/nsSMILAnimationController.h +++ b/content/smil/nsSMILAnimationController.h @@ -6,6 +6,7 @@ #ifndef NS_SMILANIMATIONCONTROLLER_H_ #define NS_SMILANIMATIONCONTROLLER_H_ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsTArray.h" @@ -50,15 +51,15 @@ public: void Disconnect(); // nsSMILContainer - virtual void Pause(uint32_t aType); - virtual void Resume(uint32_t aType); - virtual nsSMILTime GetParentTime() const; + virtual void Pause(uint32_t aType) MOZ_OVERRIDE; + virtual void Resume(uint32_t aType) MOZ_OVERRIDE; + virtual nsSMILTime GetParentTime() const MOZ_OVERRIDE; // nsARefreshObserver - NS_IMETHOD_(nsrefcnt) AddRef(); - NS_IMETHOD_(nsrefcnt) Release(); + NS_IMETHOD_(nsrefcnt) AddRef() MOZ_OVERRIDE; + NS_IMETHOD_(nsrefcnt) Release() MOZ_OVERRIDE; - virtual void WillRefresh(mozilla::TimeStamp aTime); + virtual void WillRefresh(mozilla::TimeStamp aTime) MOZ_OVERRIDE; // Methods for registering and enumerating animation elements void RegisterAnimationElement(mozilla::dom::SVGAnimationElement* aAnimationElement); @@ -145,7 +146,7 @@ protected: void MaybeStartSampling(nsRefreshDriver* aRefreshDriver); // Sample-related callbacks and implementation helpers - virtual void DoSample(); + virtual void DoSample() MOZ_OVERRIDE; void DoSample(bool aSkipUnchangedContainers); void RewindElements(); @@ -174,8 +175,8 @@ protected: mozilla::dom::SVGAnimationElement* aAnimElem, nsSMILTargetIdentifier& aResult); // Methods for adding/removing time containers - virtual nsresult AddChild(nsSMILTimeContainer& aChild); - virtual void RemoveChild(nsSMILTimeContainer& aChild); + virtual nsresult AddChild(nsSMILTimeContainer& aChild) MOZ_OVERRIDE; + virtual void RemoveChild(nsSMILTimeContainer& aChild) MOZ_OVERRIDE; void FlagDocumentNeedsFlush(); diff --git a/content/smil/nsSMILCSSProperty.h b/content/smil/nsSMILCSSProperty.h index 0c7d5f2599c..8098e51f9a8 100644 --- a/content/smil/nsSMILCSSProperty.h +++ b/content/smil/nsSMILCSSProperty.h @@ -8,6 +8,7 @@ #ifndef NS_SMILCSSPROPERTY_H_ #define NS_SMILCSSPROPERTY_H_ +#include "mozilla/Attributes.h" #include "nsISMILAttr.h" #include "nsIAtom.h" #include "nsCSSProperty.h" @@ -38,10 +39,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual nsresult SetAnimValue(const nsSMILValue& aValue); - virtual void ClearAnimValue(); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; /** * Utility method - returns true if the given property is supported for diff --git a/content/smil/nsSMILFloatType.h b/content/smil/nsSMILFloatType.h index f3a093bfe8a..0f21f2e6857 100644 --- a/content/smil/nsSMILFloatType.h +++ b/content/smil/nsSMILFloatType.h @@ -6,6 +6,7 @@ #ifndef NS_SMILFLOATTYPE_H_ #define NS_SMILFLOATTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILFloatType : public nsISMILType @@ -17,20 +18,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/smil/nsSMILMappedAttribute.h b/content/smil/nsSMILMappedAttribute.h index d1d17e62789..12fba29db0f 100644 --- a/content/smil/nsSMILMappedAttribute.h +++ b/content/smil/nsSMILMappedAttribute.h @@ -8,6 +8,7 @@ #ifndef NS_SMILMAPPEDATTRIBUTE_H_ #define NS_SMILMAPPEDATTRIBUTE_H_ +#include "mozilla/Attributes.h" #include "nsSMILCSSProperty.h" /* We'll use the empty-string atom |nsGkAtoms::_empty| as the key for storing @@ -41,10 +42,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual nsresult SetAnimValue(const nsSMILValue& aValue); - virtual void ClearAnimValue(); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; protected: // Helper Methods diff --git a/content/smil/nsSMILNullType.h b/content/smil/nsSMILNullType.h index 62d8c0e56e5..8e4ca7e055b 100644 --- a/content/smil/nsSMILNullType.h +++ b/content/smil/nsSMILNullType.h @@ -6,6 +6,7 @@ #ifndef NS_SMILNULLTYPE_H_ #define NS_SMILNULLTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILNullType : public nsISMILType @@ -17,23 +18,23 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const {} - virtual void Destroy(nsSMILValue& aValue) const {} - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE {} + virtual void Destroy(nsSMILValue& aValue) const MOZ_OVERRIDE {} + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; // The remaining methods should never be called, so although they're very // simple they don't need to be inline. virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/smil/nsSMILSetAnimationFunction.h b/content/smil/nsSMILSetAnimationFunction.h index 75e4bd1e45f..bf367ba4257 100644 --- a/content/smil/nsSMILSetAnimationFunction.h +++ b/content/smil/nsSMILSetAnimationFunction.h @@ -6,6 +6,7 @@ #ifndef NS_SMILSETANIMATIONFUNCTION_H_ #define NS_SMILSETANIMATIONFUNCTION_H_ +#include "mozilla/Attributes.h" #include "nsSMILAnimationFunction.h" //---------------------------------------------------------------------- @@ -31,7 +32,7 @@ public: * attribute; false otherwise. */ virtual bool SetAttr(nsIAtom* aAttribute, const nsAString& aValue, - nsAttrValue& aResult, nsresult* aParseResult = nullptr); + nsAttrValue& aResult, nsresult* aParseResult = nullptr) MOZ_OVERRIDE; /* * Unsets the given attribute. diff --git a/content/smil/nsSMILTimeValueSpec.h b/content/smil/nsSMILTimeValueSpec.h index 43c28814441..b420d7a6bd8 100644 --- a/content/smil/nsSMILTimeValueSpec.h +++ b/content/smil/nsSMILTimeValueSpec.h @@ -6,6 +6,7 @@ #ifndef NS_SMILTIMEVALUESPEC_H_ #define NS_SMILTIMEVALUESPEC_H_ +#include "mozilla/Attributes.h" #include "nsSMILTimeValueSpecParams.h" #include "nsReferencedElement.h" #include "nsAutoPtr.h" @@ -92,12 +93,12 @@ protected: } protected: - virtual void ElementChanged(Element* aFrom, Element* aTo) + virtual void ElementChanged(Element* aFrom, Element* aTo) MOZ_OVERRIDE { nsReferencedElement::ElementChanged(aFrom, aTo); mSpec->UpdateReferencedElement(aFrom, aTo); } - virtual bool IsPersistent() { return true; } + virtual bool IsPersistent() MOZ_OVERRIDE { return true; } private: nsSMILTimeValueSpec* mSpec; }; diff --git a/content/svg/content/src/SVGAnimateElement.h b/content/svg/content/src/SVGAnimateElement.h index f871cb1c58c..cd5aba4abbd 100644 --- a/content/svg/content/src/SVGAnimateElement.h +++ b/content/svg/content/src/SVGAnimateElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGAnimateElement_h #define mozilla_dom_SVGAnimateElement_h +#include "mozilla/Attributes.h" #include "mozilla/dom/SVGAnimationElement.h" #include "nsSMILAnimationFunction.h" @@ -30,7 +31,7 @@ protected: public: // nsIDOMNode - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; // SVGAnimationElement virtual nsSMILAnimationFunction& AnimationFunction(); diff --git a/content/svg/content/src/SVGAnimateMotionElement.h b/content/svg/content/src/SVGAnimateMotionElement.h index 26abf6715bb..f099065ce5e 100644 --- a/content/svg/content/src/SVGAnimateMotionElement.h +++ b/content/svg/content/src/SVGAnimateMotionElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGAnimateMotionElement_h #define mozilla_dom_SVGAnimateMotionElement_h +#include "mozilla/Attributes.h" #include "mozilla/dom/SVGAnimationElement.h" #include "SVGMotionSMILAnimationFunction.h" @@ -30,7 +31,7 @@ protected: public: // nsIDOMNode specializations - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; // SVGAnimationElement virtual nsSMILAnimationFunction& AnimationFunction(); @@ -39,7 +40,7 @@ public: virtual nsSMILTargetAttrType GetTargetAttributeType() const; // nsSVGElement - virtual nsIAtom* GetPathDataAttrName() const { + virtual nsIAtom* GetPathDataAttrName() const MOZ_OVERRIDE { return nsGkAtoms::path; } diff --git a/content/svg/content/src/SVGAnimateTransformElement.h b/content/svg/content/src/SVGAnimateTransformElement.h index 9440dbc6868..609a6b6675a 100644 --- a/content/svg/content/src/SVGAnimateTransformElement.h +++ b/content/svg/content/src/SVGAnimateTransformElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGAnimateTransformElement_h #define mozilla_dom_SVGAnimateTransformElement_h +#include "mozilla/Attributes.h" #include "mozilla/dom/SVGAnimationElement.h" #include "nsSMILAnimationFunction.h" @@ -30,13 +31,13 @@ protected: public: // nsIDOMNode specializations - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; // Element specializations bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, - nsAttrValue& aResult); + nsAttrValue& aResult) MOZ_OVERRIDE; // SVGAnimationElement virtual nsSMILAnimationFunction& AnimationFunction(); diff --git a/content/svg/content/src/SVGAnimatedLength.h b/content/svg/content/src/SVGAnimatedLength.h index aa7aa9f6fa1..54a92f6e521 100644 --- a/content/svg/content/src/SVGAnimatedLength.h +++ b/content/svg/content/src/SVGAnimatedLength.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGAnimatedLength_h #define mozilla_dom_SVGAnimatedLength_h +#include "mozilla/Attributes.h" #include "nsSVGElement.h" #include "nsIDOMSVGAnimatedLength.h" @@ -28,10 +29,10 @@ public: ~SVGAnimatedLength(); - NS_IMETHOD GetBaseVal(nsIDOMSVGLength **aBaseVal) + NS_IMETHOD GetBaseVal(nsIDOMSVGLength **aBaseVal) MOZ_OVERRIDE { *aBaseVal = BaseVal().get(); return NS_OK; } - NS_IMETHOD GetAnimVal(nsIDOMSVGLength **aAnimVal) + NS_IMETHOD GetAnimVal(nsIDOMSVGLength **aAnimVal) MOZ_OVERRIDE { *aAnimVal = AnimVal().get(); return NS_OK; } // WebIDL diff --git a/content/svg/content/src/SVGAnimatedLengthList.h b/content/svg/content/src/SVGAnimatedLengthList.h index a6733284418..863b38a9204 100644 --- a/content/svg/content/src/SVGAnimatedLengthList.h +++ b/content/svg/content/src/SVGAnimatedLengthList.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGANIMATEDLENGTHLIST_H__ #define MOZILLA_SVGANIMATEDLENGTHLIST_H__ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsISMILAttr.h" #include "SVGLengthList.h" @@ -114,10 +115,10 @@ private: virtual nsresult ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/SVGAnimatedNumberList.h b/content/svg/content/src/SVGAnimatedNumberList.h index 72ff037903e..09d72214b98 100644 --- a/content/svg/content/src/SVGAnimatedNumberList.h +++ b/content/svg/content/src/SVGAnimatedNumberList.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGANIMATEDNUMBERLIST_H__ #define MOZILLA_SVGANIMATEDNUMBERLIST_H__ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsISMILAttr.h" #include "SVGNumberList.h" @@ -116,10 +117,10 @@ private: virtual nsresult ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/SVGAnimatedPathSegList.h b/content/svg/content/src/SVGAnimatedPathSegList.h index e9f01e0c232..003f9777ca8 100644 --- a/content/svg/content/src/SVGAnimatedPathSegList.h +++ b/content/svg/content/src/SVGAnimatedPathSegList.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGANIMATEDPATHSEGLIST_H__ #define MOZILLA_SVGANIMATEDPATHSEGLIST_H__ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsISMILAttr.h" #include "SVGPathData.h" @@ -116,10 +117,10 @@ private: virtual nsresult ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/SVGAnimatedPointList.h b/content/svg/content/src/SVGAnimatedPointList.h index ba089de6378..74469887d4e 100644 --- a/content/svg/content/src/SVGAnimatedPointList.h +++ b/content/svg/content/src/SVGAnimatedPointList.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGANIMATEDPOINTLIST_H__ #define MOZILLA_SVGANIMATEDPOINTLIST_H__ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsISMILAttr.h" #include "SVGPointList.h" @@ -116,10 +117,10 @@ private: virtual nsresult ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h b/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h index ca082917280..24b39b610af 100644 --- a/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h +++ b/content/svg/content/src/SVGAnimatedPreserveAspectRatio.h @@ -104,10 +104,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/SVGAnimationElement.h b/content/svg/content/src/SVGAnimationElement.h index 4018cfbe1ae..bb276d3b7bb 100644 --- a/content/svg/content/src/SVGAnimationElement.h +++ b/content/svg/content/src/SVGAnimationElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGAnimationElement_h #define mozilla_dom_SVGAnimationElement_h +#include "mozilla/Attributes.h" #include "mozilla/dom/SVGTests.h" #include "nsReferencedElement.h" #include "nsSMILTimedElement.h" @@ -41,21 +42,21 @@ public: // nsIContent specializations virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, - bool aCompileEventHandlers); - virtual void UnbindFromTree(bool aDeep, bool aNullParent); + bool aCompileEventHandlers) MOZ_OVERRIDE; + virtual void UnbindFromTree(bool aDeep, bool aNullParent) MOZ_OVERRIDE; virtual nsresult UnsetAttr(int32_t aNamespaceID, nsIAtom* aAttribute, - bool aNotify); + bool aNotify) MOZ_OVERRIDE; - virtual bool IsNodeOfType(uint32_t aFlags) const; + virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE; // Element specializations virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, - nsAttrValue& aResult); + nsAttrValue& aResult) MOZ_OVERRIDE; virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, - const nsAttrValue* aValue, bool aNotify); + const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE; bool PassesConditionalProcessingTests(); const nsAttrValue* GetAnimAttr(nsIAtom* aName) const; @@ -99,14 +100,14 @@ public: // We need to be notified when target changes, in order to request a // sample (which will clear animation effects from old target and apply // them to the new target) and update any event registrations. - virtual void ElementChanged(Element* aFrom, Element* aTo) { + virtual void ElementChanged(Element* aFrom, Element* aTo) MOZ_OVERRIDE { nsReferencedElement::ElementChanged(aFrom, aTo); mAnimationElement->AnimationTargetChanged(); } // We need to override IsPersistent to get persistent tracking (beyond the // first time the target changes) - virtual bool IsPersistent() { return true; } + virtual bool IsPersistent() MOZ_OVERRIDE { return true; } private: SVGAnimationElement* const mAnimationElement; }; diff --git a/content/svg/content/src/SVGDescElement.h b/content/svg/content/src/SVGDescElement.h index 09f7564481d..b01426127df 100644 --- a/content/svg/content/src/SVGDescElement.h +++ b/content/svg/content/src/SVGDescElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGDescElement_h #define mozilla_dom_SVGDescElement_h +#include "mozilla/Attributes.h" #include "nsSVGElement.h" nsresult NS_NewSVGDescElement(nsIContent **aResult, @@ -27,7 +28,7 @@ protected: JS::Handle aScope) MOZ_OVERRIDE; public: - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; }; } // namespace dom diff --git a/content/svg/content/src/SVGIRect.h b/content/svg/content/src/SVGIRect.h index fa330e52347..3c4ec6740f3 100644 --- a/content/svg/content/src/SVGIRect.h +++ b/content/svg/content/src/SVGIRect.h @@ -32,7 +32,7 @@ public: { } - JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) + JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE { return SVGRectBinding::Wrap(aCx, aScope, this); } diff --git a/content/svg/content/src/SVGIntegerPairSMILType.h b/content/svg/content/src/SVGIntegerPairSMILType.h index 77108f95620..21591dbef03 100644 --- a/content/svg/content/src/SVGIntegerPairSMILType.h +++ b/content/svg/content/src/SVGIntegerPairSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGINTEGERPAIRSMILTYPE_H_ #define MOZILLA_SVGINTEGERPAIRSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -21,20 +22,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/SVGLengthList.h b/content/svg/content/src/SVGLengthList.h index 578b50c26dc..a187b8a2956 100644 --- a/content/svg/content/src/SVGLengthList.h +++ b/content/svg/content/src/SVGLengthList.h @@ -321,6 +321,11 @@ public: return (*mList)[aIndex].GetValueInUserUnits(mElement, mAxis); } + bool HasPercentageValueAt(uint32_t aIndex) const { + const SVGLength& length = (*mList)[aIndex]; + return length.GetUnit() == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE; + } + private: const SVGLengthList *mList; nsSVGElement *mElement; diff --git a/content/svg/content/src/SVGLengthListSMILType.h b/content/svg/content/src/SVGLengthListSMILType.h index bb277d81c38..956d0cab0b8 100644 --- a/content/svg/content/src/SVGLengthListSMILType.h +++ b/content/svg/content/src/SVGLengthListSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGLENGTHLISTSMILTYPE_H_ #define MOZILLA_SVGLENGTHLISTSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -73,21 +74,21 @@ protected: * from each sandwich layer are composited together, we could end up allowing * animation between lists of different length when we should not!) */ - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; - virtual void Destroy(nsSMILValue& aValue) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual void Destroy(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/SVGMetadataElement.h b/content/svg/content/src/SVGMetadataElement.h index a5d7d80118c..30593fd18f7 100644 --- a/content/svg/content/src/SVGMetadataElement.h +++ b/content/svg/content/src/SVGMetadataElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGMetadataElement_h #define mozilla_dom_SVGMetadataElement_h +#include "mozilla/Attributes.h" #include "nsSVGElement.h" nsresult NS_NewSVGMetadataElement(nsIContent **aResult, @@ -28,7 +29,7 @@ protected: nsresult Init(); public: - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; }; } // namespace dom diff --git a/content/svg/content/src/SVGMotionSMILAttr.h b/content/svg/content/src/SVGMotionSMILAttr.h index 2cf1797586a..e4d98773d47 100644 --- a/content/svg/content/src/SVGMotionSMILAttr.h +++ b/content/svg/content/src/SVGMotionSMILAttr.h @@ -8,6 +8,7 @@ #ifndef MOZILLA_SVGMOTIONSMILATTR_H_ #define MOZILLA_SVGMOTIONSMILATTR_H_ +#include "mozilla/Attributes.h" #include "nsISMILAttr.h" class nsIContent; @@ -37,11 +38,11 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual nsresult SetAnimValue(const nsSMILValue& aValue); - virtual void ClearAnimValue(); - virtual const nsIContent* GetTargetNode() const; + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual const nsIContent* GetTargetNode() const MOZ_OVERRIDE; protected: // Raw pointers are OK here because this SVGMotionSMILAttr is both diff --git a/content/svg/content/src/SVGMotionSMILPathUtils.h b/content/svg/content/src/SVGMotionSMILPathUtils.h index ef86f77c042..2735019452e 100644 --- a/content/svg/content/src/SVGMotionSMILPathUtils.h +++ b/content/svg/content/src/SVGMotionSMILPathUtils.h @@ -9,6 +9,7 @@ #ifndef MOZILLA_SVGMOTIONSMILPATHUTILS_H_ #define MOZILLA_SVGMOTIONSMILPATHUTILS_H_ +#include "mozilla/Attributes.h" #include "gfxContext.h" #include "gfxPlatform.h" #include "nsCOMPtr.h" @@ -78,7 +79,7 @@ public: } // nsSMILParserUtils::GenericValueParser interface - virtual nsresult Parse(const nsAString& aValueStr); + virtual nsresult Parse(const nsAString& aValueStr) MOZ_OVERRIDE; protected: PathGenerator* mPathGenerator; diff --git a/content/svg/content/src/SVGMotionSMILType.h b/content/svg/content/src/SVGMotionSMILType.h index 0f15b010b37..561e8e017ae 100644 --- a/content/svg/content/src/SVGMotionSMILType.h +++ b/content/svg/content/src/SVGMotionSMILType.h @@ -8,6 +8,7 @@ #ifndef MOZILLA_SVGMOTIONSMILTYPE_H_ #define MOZILLA_SVGMOTIONSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "nsISMILType.h" @@ -41,23 +42,23 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; - virtual void Destroy(nsSMILValue& aValue) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual void Destroy(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult SandwichAdd(nsSMILValue& aDest, - const nsSMILValue& aValueToAdd) const; + const nsSMILValue& aValueToAdd) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; public: // Used to generate a transform matrix from an nsSMILValue. static gfxMatrix CreateMatrix(const nsSMILValue& aSMILVal); diff --git a/content/svg/content/src/SVGNumberListSMILType.h b/content/svg/content/src/SVGNumberListSMILType.h index 4d72e15891c..702da074521 100644 --- a/content/svg/content/src/SVGNumberListSMILType.h +++ b/content/svg/content/src/SVGNumberListSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGNUMBERLISTSMILTYPE_H_ #define MOZILLA_SVGNUMBERLISTSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -27,21 +28,21 @@ protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; - virtual void Destroy(nsSMILValue& aValue) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual void Destroy(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/SVGNumberPairSMILType.h b/content/svg/content/src/SVGNumberPairSMILType.h index 474d715f114..49ad774f74e 100644 --- a/content/svg/content/src/SVGNumberPairSMILType.h +++ b/content/svg/content/src/SVGNumberPairSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGNUMBERPAIRSMILTYPE_H_ #define MOZILLA_SVGNUMBERPAIRSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -21,20 +22,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/SVGOrientSMILType.h b/content/svg/content/src/SVGOrientSMILType.h index 646a2f6c0b2..c011d52f848 100644 --- a/content/svg/content/src/SVGOrientSMILType.h +++ b/content/svg/content/src/SVGOrientSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGORIENTSMILTYPE_H_ #define MOZILLA_SVGORIENTSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -35,20 +36,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/SVGPathSegListSMILType.h b/content/svg/content/src/SVGPathSegListSMILType.h index 653e22ee349..0085c0d2d11 100644 --- a/content/svg/content/src/SVGPathSegListSMILType.h +++ b/content/svg/content/src/SVGPathSegListSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGPATHSEGLISTSMILTYPE_H_ #define MOZILLA_SVGPATHSEGLISTSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -27,21 +28,21 @@ protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; - virtual void Destroy(nsSMILValue& aValue) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual void Destroy(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/SVGPointListSMILType.h b/content/svg/content/src/SVGPointListSMILType.h index a0768b6cc7c..36e3c053bab 100644 --- a/content/svg/content/src/SVGPointListSMILType.h +++ b/content/svg/content/src/SVGPointListSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGPOINTLISTSMILTYPE_H_ #define MOZILLA_SVGPOINTLISTSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -27,21 +28,21 @@ protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; - virtual void Destroy(nsSMILValue& aValue) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual void Destroy(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/SVGPolygonElement.h b/content/svg/content/src/SVGPolygonElement.h index a9f56741560..95652b02811 100644 --- a/content/svg/content/src/SVGPolygonElement.h +++ b/content/svg/content/src/SVGPolygonElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGPolygonElement_h #define mozilla_dom_SVGPolygonElement_h +#include "mozilla/Attributes.h" #include "nsSVGPolyElement.h" nsresult NS_NewSVGPolygonElement(nsIContent **aResult, @@ -27,8 +28,8 @@ protected: public: // nsSVGPathGeometryElement methods: - virtual void GetMarkPoints(nsTArray *aMarks); - virtual void ConstructPath(gfxContext *aCtx); + virtual void GetMarkPoints(nsTArray *aMarks) MOZ_OVERRIDE; + virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; }; diff --git a/content/svg/content/src/SVGSetElement.h b/content/svg/content/src/SVGSetElement.h index 1bf76029f58..fd8a049844f 100644 --- a/content/svg/content/src/SVGSetElement.h +++ b/content/svg/content/src/SVGSetElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGSetElement_h #define mozilla_dom_SVGSetElement_h +#include "mozilla/Attributes.h" #include "mozilla/dom/SVGAnimationElement.h" #include "nsSMILSetAnimationFunction.h" @@ -30,7 +31,7 @@ protected: public: // nsIDOMNode - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; // SVGAnimationElement virtual nsSMILAnimationFunction& AnimationFunction(); diff --git a/content/svg/content/src/SVGStyleElement.h b/content/svg/content/src/SVGStyleElement.h index 2e8af9f6327..5124c3909c5 100644 --- a/content/svg/content/src/SVGStyleElement.h +++ b/content/svg/content/src/SVGStyleElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGStyleElement_h #define mozilla_dom_SVGStyleElement_h +#include "mozilla/Attributes.h" #include "nsSVGElement.h" #include "nsStyleLinkElement.h" #include "nsStubMutationObserver.h" @@ -87,13 +88,13 @@ protected: } // nsStyleLinkElement overrides - already_AddRefed GetStyleSheetURL(bool* aIsInline); + already_AddRefed GetStyleSheetURL(bool* aIsInline) MOZ_OVERRIDE; void GetStyleSheetInfo(nsAString& aTitle, nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate); + bool* aIsAlternate) MOZ_OVERRIDE; virtual CORSMode GetCORSMode() const MOZ_OVERRIDE; /** diff --git a/content/svg/content/src/SVGTitleElement.h b/content/svg/content/src/SVGTitleElement.h index a383fa99f9c..df4a5dce6b9 100644 --- a/content/svg/content/src/SVGTitleElement.h +++ b/content/svg/content/src/SVGTitleElement.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGTitleElement_h #define mozilla_dom_SVGTitleElement_h +#include "mozilla/Attributes.h" #include "nsSVGElement.h" #include "nsStubMutationObserver.h" @@ -38,16 +39,16 @@ public: NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent, nsIContent *aBindingParent, - bool aCompileEventHandlers); + bool aCompileEventHandlers) MOZ_OVERRIDE; virtual void UnbindFromTree(bool aDeep = true, - bool aNullParent = true); + bool aNullParent = true) MOZ_OVERRIDE; - virtual void DoneAddingChildren(bool aHaveNotified); + virtual void DoneAddingChildren(bool aHaveNotified) MOZ_OVERRIDE; private: void SendTitleChangeEvent(bool aBound); }; diff --git a/content/svg/content/src/SVGTransformListParser.h b/content/svg/content/src/SVGTransformListParser.h index 0e7c6a2bac1..3537653161b 100644 --- a/content/svg/content/src/SVGTransformListParser.h +++ b/content/svg/content/src/SVGTransformListParser.h @@ -7,6 +7,7 @@ #ifndef MOZILLA_SVGTRANSFORMLISTPARSER_H__ #define MOZILLA_SVGTRANSFORMLISTPARSER_H__ +#include "mozilla/Attributes.h" #include "nsSVGDataParser.h" #include "nsTArray.h" @@ -34,7 +35,7 @@ private: nsTArray mTransforms; // helpers - virtual nsresult Match(); + virtual nsresult Match() MOZ_OVERRIDE; nsresult MatchNumberArguments(float *aResult, uint32_t aMaxNum, diff --git a/content/svg/content/src/SVGTransformListSMILType.h b/content/svg/content/src/SVGTransformListSMILType.h index 7c6f31a33d9..280db7c2be9 100644 --- a/content/svg/content/src/SVGTransformListSMILType.h +++ b/content/svg/content/src/SVGTransformListSMILType.h @@ -6,6 +6,7 @@ #ifndef SVGTRANSFORMLISTSMILTYPE_H_ #define SVGTRANSFORMLISTSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" #include "nsTArray.h" @@ -85,23 +86,23 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; - virtual void Destroy(nsSMILValue& aValue) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual void Destroy(nsSMILValue& aValue) const MOZ_OVERRIDE; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult SandwichAdd(nsSMILValue& aDest, - const nsSMILValue& aValueToAdd) const; + const nsSMILValue& aValueToAdd) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; public: // Transform array accessors diff --git a/content/svg/content/src/SVGTransformableElement.h b/content/svg/content/src/SVGTransformableElement.h index dc51b9527ed..1842ce459bd 100644 --- a/content/svg/content/src/SVGTransformableElement.h +++ b/content/svg/content/src/SVGTransformableElement.h @@ -6,6 +6,7 @@ #ifndef SVGTransformableElement_h #define SVGTransformableElement_h +#include "mozilla/Attributes.h" #include "nsSVGAnimatedTransformList.h" #include "nsSVGElement.h" #include "gfxMatrix.h" @@ -38,27 +39,27 @@ public: ErrorResult& rv); // nsIContent interface - NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const; + NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute, - int32_t aModType) const; + int32_t aModType) const MOZ_OVERRIDE; virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, - TransformTypes aWhich = eAllTransforms) const; - virtual const gfxMatrix* GetAnimateMotionTransform() const; - virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix); + TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE; + virtual const gfxMatrix* GetAnimateMotionTransform() const MOZ_OVERRIDE; + virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix) MOZ_OVERRIDE; virtual nsSVGAnimatedTransformList* - GetAnimatedTransformList(uint32_t aFlags = 0); - virtual nsIAtom* GetTransformListAttrName() const { + GetAnimatedTransformList(uint32_t aFlags = 0) MOZ_OVERRIDE; + virtual nsIAtom* GetTransformListAttrName() const MOZ_OVERRIDE { return nsGkAtoms::transform; } - virtual bool IsTransformable() { return true; } + virtual bool IsTransformable() MOZ_OVERRIDE { return true; } protected: // nsSVGElement overrides diff --git a/content/svg/content/src/SVGViewBoxSMILType.h b/content/svg/content/src/SVGViewBoxSMILType.h index 1861eab7505..53d6229366b 100644 --- a/content/svg/content/src/SVGViewBoxSMILType.h +++ b/content/svg/content/src/SVGViewBoxSMILType.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_SVGVIEWBOXSMILTYPE_H_ #define MOZILLA_SVGVIEWBOXSMILTYPE_H_ +#include "mozilla/Attributes.h" #include "nsISMILType.h" class nsSMILValue; @@ -21,20 +22,20 @@ public: protected: // nsISMILType Methods // ------------------- - virtual void Init(nsSMILValue& aValue) const; + virtual void Init(nsSMILValue& aValue) const MOZ_OVERRIDE; virtual void Destroy(nsSMILValue&) const; - virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const; + virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE; virtual bool IsEqual(const nsSMILValue& aLeft, - const nsSMILValue& aRight) const; + const nsSMILValue& aRight) const MOZ_OVERRIDE; virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, - uint32_t aCount) const; + uint32_t aCount) const MOZ_OVERRIDE; virtual nsresult ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, - double& aDistance) const; + double& aDistance) const MOZ_OVERRIDE; virtual nsresult Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, - nsSMILValue& aResult) const; + nsSMILValue& aResult) const MOZ_OVERRIDE; private: // Private constructor & destructor: prevent instances beyond my singleton, diff --git a/content/svg/content/src/nsSVGAngle.h b/content/svg/content/src/nsSVGAngle.h index 29a928a296f..b68fa8c623e 100644 --- a/content/svg/content/src/nsSVGAngle.h +++ b/content/svg/content/src/nsSVGAngle.h @@ -118,10 +118,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/nsSVGAnimatedTransformList.h b/content/svg/content/src/nsSVGAnimatedTransformList.h index d3818e442ed..d1737e2317f 100644 --- a/content/svg/content/src/nsSVGAnimatedTransformList.h +++ b/content/svg/content/src/nsSVGAnimatedTransformList.h @@ -7,6 +7,7 @@ #ifndef MOZILLA_SVGANIMATEDTRANSFORMLIST_H__ #define MOZILLA_SVGANIMATEDTRANSFORMLIST_H__ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsISMILAttr.h" #include "SVGTransformList.h" @@ -118,10 +119,10 @@ private: virtual nsresult ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; protected: static void ParseValue(const nsAString& aSpec, diff --git a/content/svg/content/src/nsSVGBoolean.h b/content/svg/content/src/nsSVGBoolean.h index 504a79ca0ea..7cb140dbbe3 100644 --- a/content/svg/content/src/nsSVGBoolean.h +++ b/content/svg/content/src/nsSVGBoolean.h @@ -73,10 +73,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; #endif //__NS_SVGBOOLEAN_H__ diff --git a/content/svg/content/src/nsSVGClass.h b/content/svg/content/src/nsSVGClass.h index 408c8d19421..91d0e31cb8f 100644 --- a/content/svg/content/src/nsSVGClass.h +++ b/content/svg/content/src/nsSVGClass.h @@ -66,12 +66,12 @@ public: nsSVGClass* mVal; // kept alive because it belongs to content nsRefPtr mSVGElement; - NS_IMETHOD GetBaseVal(nsAString& aResult) + NS_IMETHOD GetBaseVal(nsAString& aResult) MOZ_OVERRIDE { mVal->GetBaseValue(aResult, mSVGElement); return NS_OK; } - NS_IMETHOD SetBaseVal(const nsAString& aValue) + NS_IMETHOD SetBaseVal(const nsAString& aValue) MOZ_OVERRIDE { mVal->SetBaseValue(aValue, mSVGElement, true); return NS_OK; } - NS_IMETHOD GetAnimVal(nsAString& aResult); + NS_IMETHOD GetAnimVal(nsAString& aResult) MOZ_OVERRIDE; }; struct SMILString : public nsISMILAttr { @@ -89,10 +89,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement *aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; #endif //__NS_SVGCLASS_H__ diff --git a/content/svg/content/src/nsSVGElement.h b/content/svg/content/src/nsSVGElement.h index 60f07578797..f6ddcf9de17 100644 --- a/content/svg/content/src/nsSVGElement.h +++ b/content/svg/content/src/nsSVGElement.h @@ -11,6 +11,7 @@ It implements all the common DOM interfaces and handles attributes. */ +#include "mozilla/Attributes.h" #include "mozilla/css/StyleRule.h" #include "nsAutoPtr.h" #include "nsChangeHint.h" @@ -74,7 +75,7 @@ protected: public: - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_MUST_OVERRIDE; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE; typedef mozilla::SVGNumberList SVGNumberList; typedef mozilla::SVGAnimatedNumberList SVGAnimatedNumberList; @@ -280,11 +281,11 @@ public: return nullptr; } - virtual nsISMILAttr* GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName); + virtual nsISMILAttr* GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName) MOZ_OVERRIDE; void AnimationNeedsResample(); void FlushAnimations(); - virtual void RecompileScriptEventListeners(); + virtual void RecompileScriptEventListeners() MOZ_OVERRIDE; void GetStringBaseValue(uint8_t aAttrEnum, nsAString& aResult) const; void SetStringBaseValue(uint8_t aAttrEnum, const nsAString& aValue); @@ -299,7 +300,7 @@ public: return nullptr; } - virtual nsIDOMNode* AsDOMNode() MOZ_FINAL { return this; } + virtual nsIDOMNode* AsDOMNode() MOZ_FINAL MOZ_OVERRIDE { return this; } virtual bool IsTransformable() { return false; } // WebIDL diff --git a/content/svg/content/src/nsSVGEnum.h b/content/svg/content/src/nsSVGEnum.h index 3fb16ebc469..a7c369014a6 100644 --- a/content/svg/content/src/nsSVGEnum.h +++ b/content/svg/content/src/nsSVGEnum.h @@ -84,14 +84,14 @@ public: nsSVGEnum *mVal; // kept alive because it belongs to content nsRefPtr mSVGElement; - NS_IMETHOD GetBaseVal(uint16_t* aResult) + NS_IMETHOD GetBaseVal(uint16_t* aResult) MOZ_OVERRIDE { *aResult = mVal->GetBaseValue(); return NS_OK; } - NS_IMETHOD SetBaseVal(uint16_t aValue) + NS_IMETHOD SetBaseVal(uint16_t aValue) MOZ_OVERRIDE { return mVal->SetBaseValue(aValue, mSVGElement); } // Script may have modified animation parameters or timeline -- DOM getters // need to flush any resample requests to reflect these modifications. - NS_IMETHOD GetAnimVal(uint16_t* aResult) + NS_IMETHOD GetAnimVal(uint16_t* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->GetAnimValue(); @@ -115,10 +115,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/nsSVGFilters.h b/content/svg/content/src/nsSVGFilters.h index 235fc65dc74..03cf27ffc11 100644 --- a/content/svg/content/src/nsSVGFilters.h +++ b/content/svg/content/src/nsSVGFilters.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGFILTERSELEMENT_H__ #define __NS_SVGFILTERSELEMENT_H__ +#include "mozilla/Attributes.h" #include "gfxImageSurface.h" #include "gfxRect.h" #include "nsIFrame.h" @@ -134,14 +135,14 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIContent interface - NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const; + NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; // nsSVGElement interface virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE = 0; - virtual bool HasValidDimensions() const; + virtual bool HasValidDimensions() const MOZ_OVERRIDE; - bool IsNodeOfType(uint32_t aFlags) const + bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE { return !(aFlags & ~(eCONTENT | eFILTER)); } virtual nsSVGString& GetResultImageName() = 0; diff --git a/content/svg/content/src/nsSVGInteger.h b/content/svg/content/src/nsSVGInteger.h index 2fc44ae98e0..5fb8b6661a7 100644 --- a/content/svg/content/src/nsSVGInteger.h +++ b/content/svg/content/src/nsSVGInteger.h @@ -81,14 +81,14 @@ public: nsSVGInteger* mVal; // kept alive because it belongs to content nsRefPtr mSVGElement; - NS_IMETHOD GetBaseVal(int32_t* aResult) + NS_IMETHOD GetBaseVal(int32_t* aResult) MOZ_OVERRIDE { *aResult = mVal->GetBaseValue(); return NS_OK; } - NS_IMETHOD SetBaseVal(int32_t aValue) + NS_IMETHOD SetBaseVal(int32_t aValue) MOZ_OVERRIDE { mVal->SetBaseValue(aValue, mSVGElement); return NS_OK; } // Script may have modified animation parameters or timeline -- DOM getters // need to flush any resample requests to reflect these modifications. - NS_IMETHOD GetAnimVal(int32_t* aResult) + NS_IMETHOD GetAnimVal(int32_t* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->GetAnimValue(); @@ -112,10 +112,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/nsSVGIntegerPair.h b/content/svg/content/src/nsSVGIntegerPair.h index f78e1fdcd24..e4c7d5fae8a 100644 --- a/content/svg/content/src/nsSVGIntegerPair.h +++ b/content/svg/content/src/nsSVGIntegerPair.h @@ -90,9 +90,9 @@ public: nsRefPtr mSVGElement; PairIndex mIndex; // are we the first or second integer - NS_IMETHOD GetBaseVal(int32_t* aResult) + NS_IMETHOD GetBaseVal(int32_t* aResult) MOZ_OVERRIDE { *aResult = mVal->GetBaseValue(mIndex); return NS_OK; } - NS_IMETHOD SetBaseVal(int32_t aValue) + NS_IMETHOD SetBaseVal(int32_t aValue) MOZ_OVERRIDE { mVal->SetBaseValue(aValue, mIndex, mSVGElement); return NS_OK; @@ -100,7 +100,7 @@ public: // Script may have modified animation parameters or timeline -- DOM getters // need to flush any resample requests to reflect these modifications. - NS_IMETHOD GetAnimVal(int32_t* aResult) + NS_IMETHOD GetAnimVal(int32_t* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->GetAnimValue(mIndex); @@ -124,10 +124,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/nsSVGLength2.h b/content/svg/content/src/nsSVGLength2.h index 11737fc3841..5c9f182da99 100644 --- a/content/svg/content/src/nsSVGLength2.h +++ b/content/svg/content/src/nsSVGLength2.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGLENGTH2_H__ #define __NS_SVGLENGTH2_H__ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsCoord.h" #include "nsCycleCollectionParticipant.h" @@ -150,12 +151,12 @@ public: nsSVGLength2* mVal; // kept alive because it belongs to mSVGElement nsRefPtr mSVGElement; - NS_IMETHOD GetUnitType(uint16_t* aResult) + NS_IMETHOD GetUnitType(uint16_t* aResult) MOZ_OVERRIDE { *aResult = mVal->mSpecifiedUnitType; return NS_OK; } - NS_IMETHOD GetValue(float* aResult) + NS_IMETHOD GetValue(float* aResult) MOZ_OVERRIDE { *aResult = mVal->GetBaseValue(mSVGElement); return NS_OK; } - NS_IMETHOD SetValue(float aValue) + NS_IMETHOD SetValue(float aValue) MOZ_OVERRIDE { if (!NS_finite(aValue)) { return NS_ERROR_ILLEGAL_VALUE; @@ -164,9 +165,9 @@ public: return NS_OK; } - NS_IMETHOD GetValueInSpecifiedUnits(float* aResult) + NS_IMETHOD GetValueInSpecifiedUnits(float* aResult) MOZ_OVERRIDE { *aResult = mVal->mBaseVal; return NS_OK; } - NS_IMETHOD SetValueInSpecifiedUnits(float aValue) + NS_IMETHOD SetValueInSpecifiedUnits(float aValue) MOZ_OVERRIDE { if (!NS_finite(aValue)) { return NS_ERROR_ILLEGAL_VALUE; @@ -175,18 +176,18 @@ public: return NS_OK; } - NS_IMETHOD SetValueAsString(const nsAString& aValue) + NS_IMETHOD SetValueAsString(const nsAString& aValue) MOZ_OVERRIDE { return mVal->SetBaseValueString(aValue, mSVGElement, true); } - NS_IMETHOD GetValueAsString(nsAString& aValue) + NS_IMETHOD GetValueAsString(nsAString& aValue) MOZ_OVERRIDE { mVal->GetBaseValueString(aValue); return NS_OK; } NS_IMETHOD NewValueSpecifiedUnits(uint16_t unitType, - float valueInSpecifiedUnits) + float valueInSpecifiedUnits) MOZ_OVERRIDE { return mVal->NewValueSpecifiedUnits(unitType, valueInSpecifiedUnits, mSVGElement); } - NS_IMETHOD ConvertToSpecifiedUnits(uint16_t unitType) + NS_IMETHOD ConvertToSpecifiedUnits(uint16_t unitType) MOZ_OVERRIDE { return mVal->ConvertToSpecifiedUnits(unitType, mSVGElement); } }; @@ -204,34 +205,34 @@ public: // Script may have modified animation parameters or timeline -- DOM getters // need to flush any resample requests to reflect these modifications. - NS_IMETHOD GetUnitType(uint16_t* aResult) + NS_IMETHOD GetUnitType(uint16_t* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->mSpecifiedUnitType; return NS_OK; } - NS_IMETHOD GetValue(float* aResult) + NS_IMETHOD GetValue(float* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->GetAnimValue(mSVGElement); return NS_OK; } - NS_IMETHOD SetValue(float aValue) + NS_IMETHOD SetValue(float aValue) MOZ_OVERRIDE { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } - NS_IMETHOD GetValueInSpecifiedUnits(float* aResult) + NS_IMETHOD GetValueInSpecifiedUnits(float* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->mAnimVal; return NS_OK; } - NS_IMETHOD SetValueInSpecifiedUnits(float aValue) + NS_IMETHOD SetValueInSpecifiedUnits(float aValue) MOZ_OVERRIDE { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } - NS_IMETHOD SetValueAsString(const nsAString& aValue) + NS_IMETHOD SetValueAsString(const nsAString& aValue) MOZ_OVERRIDE { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } - NS_IMETHOD GetValueAsString(nsAString& aValue) + NS_IMETHOD GetValueAsString(nsAString& aValue) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); mVal->GetAnimValueString(aValue); @@ -239,10 +240,10 @@ public: } NS_IMETHOD NewValueSpecifiedUnits(uint16_t unitType, - float valueInSpecifiedUnits) + float valueInSpecifiedUnits) MOZ_OVERRIDE { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } - NS_IMETHOD ConvertToSpecifiedUnits(uint16_t unitType) + NS_IMETHOD ConvertToSpecifiedUnits(uint16_t unitType) MOZ_OVERRIDE { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } }; @@ -262,10 +263,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue &aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/nsSVGNumber2.h b/content/svg/content/src/nsSVGNumber2.h index 310479f5772..36494956f6a 100644 --- a/content/svg/content/src/nsSVGNumber2.h +++ b/content/svg/content/src/nsSVGNumber2.h @@ -81,9 +81,9 @@ public: nsSVGNumber2* mVal; // kept alive because it belongs to content nsRefPtr mSVGElement; - NS_IMETHOD GetBaseVal(float* aResult) + NS_IMETHOD GetBaseVal(float* aResult) MOZ_OVERRIDE { *aResult = mVal->GetBaseValue(); return NS_OK; } - NS_IMETHOD SetBaseVal(float aValue) + NS_IMETHOD SetBaseVal(float aValue) MOZ_OVERRIDE { if (!NS_finite(aValue)) { return NS_ERROR_ILLEGAL_VALUE; @@ -94,7 +94,7 @@ public: // Script may have modified animation parameters or timeline -- DOM getters // need to flush any resample requests to reflect these modifications. - NS_IMETHOD GetAnimVal(float* aResult) + NS_IMETHOD GetAnimVal(float* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->GetAnimValue(); @@ -118,10 +118,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/nsSVGNumberPair.h b/content/svg/content/src/nsSVGNumberPair.h index b1bd60edfc5..81be0df1400 100644 --- a/content/svg/content/src/nsSVGNumberPair.h +++ b/content/svg/content/src/nsSVGNumberPair.h @@ -91,9 +91,9 @@ public: nsRefPtr mSVGElement; PairIndex mIndex; // are we the first or second number - NS_IMETHOD GetBaseVal(float* aResult) + NS_IMETHOD GetBaseVal(float* aResult) MOZ_OVERRIDE { *aResult = mVal->GetBaseValue(mIndex); return NS_OK; } - NS_IMETHOD SetBaseVal(float aValue) + NS_IMETHOD SetBaseVal(float aValue) MOZ_OVERRIDE { if (!NS_finite(aValue)) { return NS_ERROR_ILLEGAL_VALUE; @@ -104,7 +104,7 @@ public: // Script may have modified animation parameters or timeline -- DOM getters // need to flush any resample requests to reflect these modifications. - NS_IMETHOD GetAnimVal(float* aResult) + NS_IMETHOD GetAnimVal(float* aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); *aResult = mVal->GetAnimValue(mIndex); @@ -128,10 +128,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; diff --git a/content/svg/content/src/nsSVGPathDataParser.h b/content/svg/content/src/nsSVGPathDataParser.h index d334e9958a0..3e8363ce328 100644 --- a/content/svg/content/src/nsSVGPathDataParser.h +++ b/content/svg/content/src/nsSVGPathDataParser.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGPATHDATAPARSER_H__ #define __NS_SVGPATHDATAPARSER_H__ +#include "mozilla/Attributes.h" #include "gfxPoint.h" #include "nsSVGDataParser.h" @@ -38,7 +39,7 @@ protected: virtual nsresult StoreEllipticalArc(bool absCoords, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) = 0; - virtual nsresult Match(); + virtual nsresult Match() MOZ_OVERRIDE; nsresult MatchCoordPair(float* aX, float* aY); bool IsTokenCoordPairStarter(); @@ -133,22 +134,22 @@ public: nsresult Parse(const nsAString &aValue); protected: - virtual nsresult StoreMoveTo(bool absCoords, float x, float y); - virtual nsresult StoreClosePath(); - virtual nsresult StoreLineTo(bool absCoords, float x, float y); - virtual nsresult StoreHLineTo(bool absCoords, float x); - virtual nsresult StoreVLineTo(bool absCoords, float y); + virtual nsresult StoreMoveTo(bool absCoords, float x, float y) MOZ_OVERRIDE; + virtual nsresult StoreClosePath() MOZ_OVERRIDE; + virtual nsresult StoreLineTo(bool absCoords, float x, float y) MOZ_OVERRIDE; + virtual nsresult StoreHLineTo(bool absCoords, float x) MOZ_OVERRIDE; + virtual nsresult StoreVLineTo(bool absCoords, float y) MOZ_OVERRIDE; virtual nsresult StoreCurveTo(bool absCoords, float x, float y, - float x1, float y1, float x2, float y2); + float x1, float y1, float x2, float y2) MOZ_OVERRIDE; virtual nsresult StoreSmoothCurveTo(bool absCoords, float x, float y, - float x2, float y2); + float x2, float y2) MOZ_OVERRIDE; virtual nsresult StoreQuadCurveTo(bool absCoords, float x, float y, - float x1, float y1); + float x1, float y1) MOZ_OVERRIDE; virtual nsresult StoreSmoothQuadCurveTo(bool absCoords, - float x, float y); + float x, float y) MOZ_OVERRIDE; virtual nsresult StoreEllipticalArc(bool absCoords, float x, float y, float r1, float r2, float angle, - bool largeArcFlag, bool sweepFlag); + bool largeArcFlag, bool sweepFlag) MOZ_OVERRIDE; private: mozilla::SVGPathData *mPathSegList; diff --git a/content/svg/content/src/nsSVGPolyElement.h b/content/svg/content/src/nsSVGPolyElement.h index c1af280d3df..baee9063d14 100644 --- a/content/svg/content/src/nsSVGPolyElement.h +++ b/content/svg/content/src/nsSVGPolyElement.h @@ -6,6 +6,7 @@ #ifndef NS_SVGPOLYELEMENT_H_ #define NS_SVGPOLYELEMENT_H_ +#include "mozilla/Attributes.h" #include "nsSVGPathGeometryElement.h" #include "SVGAnimatedPointList.h" @@ -38,10 +39,10 @@ public: } // nsSVGPathGeometryElement methods: - virtual bool AttributeDefinesGeometry(const nsIAtom *aName); - virtual bool IsMarkable() { return true; } - virtual void GetMarkPoints(nsTArray *aMarks); - virtual void ConstructPath(gfxContext *aCtx); + virtual bool AttributeDefinesGeometry(const nsIAtom *aName) MOZ_OVERRIDE; + virtual bool IsMarkable() MOZ_OVERRIDE { return true; } + virtual void GetMarkPoints(nsTArray *aMarks) MOZ_OVERRIDE; + virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE; // WebIDL already_AddRefed Points(); diff --git a/content/svg/content/src/nsSVGString.h b/content/svg/content/src/nsSVGString.h index 849ecb4acfc..f5feabca031 100644 --- a/content/svg/content/src/nsSVGString.h +++ b/content/svg/content/src/nsSVGString.h @@ -65,12 +65,12 @@ public: nsSVGString* mVal; // kept alive because it belongs to content nsRefPtr mSVGElement; - NS_IMETHOD GetBaseVal(nsAString & aResult) + NS_IMETHOD GetBaseVal(nsAString & aResult) MOZ_OVERRIDE { mVal->GetBaseValue(aResult, mSVGElement); return NS_OK; } - NS_IMETHOD SetBaseVal(const nsAString & aValue) + NS_IMETHOD SetBaseVal(const nsAString & aValue) MOZ_OVERRIDE { mVal->SetBaseValue(aValue, mSVGElement, true); return NS_OK; } - NS_IMETHOD GetAnimVal(nsAString & aResult) + NS_IMETHOD GetAnimVal(nsAString & aResult) MOZ_OVERRIDE { mSVGElement->FlushAnimations(); mVal->GetAnimValue(aResult, mSVGElement); return NS_OK; @@ -93,10 +93,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement *aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; }; #endif //__NS_SVGSTRING_H__ diff --git a/content/svg/content/src/nsSVGViewBox.h b/content/svg/content/src/nsSVGViewBox.h index 6ddc6dd822c..ed44090821f 100644 --- a/content/svg/content/src/nsSVGViewBox.h +++ b/content/svg/content/src/nsSVGViewBox.h @@ -134,12 +134,12 @@ public: return mVal->GetBaseValue().height; } - void SetX(float aX, mozilla::ErrorResult& aRv) MOZ_FINAL; - void SetY(float aY, mozilla::ErrorResult& aRv) MOZ_FINAL; - void SetWidth(float aWidth, mozilla::ErrorResult& aRv) MOZ_FINAL; - void SetHeight(float aHeight, mozilla::ErrorResult& aRv) MOZ_FINAL; + void SetX(float aX, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE; + void SetY(float aY, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE; + void SetWidth(float aWidth, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE; + void SetHeight(float aHeight, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE; - virtual nsIContent* GetParentObject() const + virtual nsIContent* GetParentObject() const MOZ_OVERRIDE { return mSVGElement; } @@ -186,27 +186,27 @@ public: return mVal->GetAnimValue().height; } - void SetX(float aX, mozilla::ErrorResult& aRv) MOZ_FINAL + void SetX(float aX, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE { aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR); } - void SetY(float aY, mozilla::ErrorResult& aRv) MOZ_FINAL + void SetY(float aY, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE { aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR); } - void SetWidth(float aWidth, mozilla::ErrorResult& aRv) MOZ_FINAL + void SetWidth(float aWidth, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE { aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR); } - void SetHeight(float aHeight, mozilla::ErrorResult& aRv) MOZ_FINAL + void SetHeight(float aHeight, mozilla::ErrorResult& aRv) MOZ_FINAL MOZ_OVERRIDE { aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR); } - virtual nsIContent* GetParentObject() const + virtual nsIContent* GetParentObject() const MOZ_OVERRIDE { return mSVGElement; } @@ -228,10 +228,10 @@ public: virtual nsresult ValueFromString(const nsAString& aStr, const mozilla::dom::SVGAnimationElement* aSrcElement, nsSMILValue& aValue, - bool& aPreventCachingOfSandwich) const; - virtual nsSMILValue GetBaseValue() const; - virtual void ClearAnimValue(); - virtual nsresult SetAnimValue(const nsSMILValue& aValue); + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; + virtual void ClearAnimValue() MOZ_OVERRIDE; + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; }; static nsSVGAttrTearoffTable diff --git a/content/svg/document/src/SVGDocument.h b/content/svg/document/src/SVGDocument.h index 6b71bb91acc..6e02cbeb577 100644 --- a/content/svg/document/src/SVGDocument.h +++ b/content/svg/document/src/SVGDocument.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_SVGDocument_h #define mozilla_dom_SVGDocument_h +#include "mozilla/Attributes.h" #include "mozilla/dom/XMLDocument.h" #include "nsIDOMSVGDocument.h" @@ -36,7 +37,7 @@ public: NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_DECL_ISUPPORTS_INHERITED - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; // WebIDL API void GetDomain(nsAString& aDomain, ErrorResult& aRv); diff --git a/content/xbl/src/nsXBLContentSink.h b/content/xbl/src/nsXBLContentSink.h index 8b06ddfefcc..75cd6dd851d 100644 --- a/content/xbl/src/nsXBLContentSink.h +++ b/content/xbl/src/nsXBLContentSink.h @@ -6,6 +6,7 @@ #ifndef nsXBLContentSink_h__ #define nsXBLContentSink_h__ +#include "mozilla/Attributes.h" #include "nsXMLContentSink.h" #include "nsXBLDocumentInfo.h" #include "nsXBLPrototypeHandler.h" @@ -69,32 +70,32 @@ public: const PRUnichar **aAtts, uint32_t aAttsCount, int32_t aIndex, - uint32_t aLineNumber); + uint32_t aLineNumber) MOZ_OVERRIDE; - NS_IMETHOD HandleEndElement(const PRUnichar *aName); + NS_IMETHOD HandleEndElement(const PRUnichar *aName) MOZ_OVERRIDE; NS_IMETHOD HandleCDataSection(const PRUnichar *aData, - uint32_t aLength); + uint32_t aLength) MOZ_OVERRIDE; protected: // nsXMLContentSink overrides - virtual void MaybeStartLayout(bool aIgnorePendingSheets); + virtual void MaybeStartLayout(bool aIgnorePendingSheets) MOZ_OVERRIDE; bool OnOpenContainer(const PRUnichar **aAtts, uint32_t aAttsCount, int32_t aNameSpaceID, nsIAtom* aTagName, - uint32_t aLineNumber); + uint32_t aLineNumber) MOZ_OVERRIDE; - bool NotifyForDocElement() { return false; } + bool NotifyForDocElement() MOZ_OVERRIDE { return false; } nsresult CreateElement(const PRUnichar** aAtts, uint32_t aAttsCount, nsINodeInfo* aNodeInfo, uint32_t aLineNumber, nsIContent** aResult, bool* aAppendContent, - mozilla::dom::FromParser aFromParser); + mozilla::dom::FromParser aFromParser) MOZ_OVERRIDE; nsresult AddAttributes(const PRUnichar** aAtts, - nsIContent* aContent); + nsIContent* aContent) MOZ_OVERRIDE; #ifdef MOZ_XUL nsresult AddAttributesToXULPrototype(const PRUnichar **aAtts, @@ -114,13 +115,13 @@ protected: // nsXMLContentSink overrides - nsresult FlushText(bool aReleaseTextNode = true); + nsresult FlushText(bool aReleaseTextNode = true) MOZ_OVERRIDE; // nsIExpatSink overrides NS_IMETHOD ReportError(const PRUnichar* aErrorText, const PRUnichar* aSourceText, nsIScriptError *aError, - bool *_retval); + bool *_retval) MOZ_OVERRIDE; protected: nsresult ReportUnexpectedElement(nsIAtom* aElementName, uint32_t aLineNumber); diff --git a/content/xbl/src/nsXBLDocumentInfo.h b/content/xbl/src/nsXBLDocumentInfo.h index f3bc35b3e2f..1f3507bff83 100644 --- a/content/xbl/src/nsXBLDocumentInfo.h +++ b/content/xbl/src/nsXBLDocumentInfo.h @@ -5,6 +5,7 @@ #ifndef nsXBLDocumentInfo_h__ #define nsXBLDocumentInfo_h__ +#include "mozilla/Attributes.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "nsIScriptGlobalObjectOwner.h" @@ -48,7 +49,7 @@ public: bool IsChrome() { return mIsChrome; } // nsIScriptGlobalObjectOwner methods - virtual nsIScriptGlobalObject* GetScriptGlobalObject(); + virtual nsIScriptGlobalObject* GetScriptGlobalObject() MOZ_OVERRIDE; void MarkInCCGeneration(uint32_t aGeneration); diff --git a/content/xbl/src/nsXBLEventHandler.h b/content/xbl/src/nsXBLEventHandler.h index 3f8d1cec744..83671b04737 100644 --- a/content/xbl/src/nsXBLEventHandler.h +++ b/content/xbl/src/nsXBLEventHandler.h @@ -6,6 +6,7 @@ #ifndef nsXBLEventHandler_h__ #define nsXBLEventHandler_h__ +#include "mozilla/Attributes.h" #include "nsCOMPtr.h" #include "nsIDOMEventListener.h" #include "nsTArray.h" @@ -42,7 +43,7 @@ public: virtual ~nsXBLMouseEventHandler(); private: - bool EventMatched(nsIDOMEvent* aEvent); + bool EventMatched(nsIDOMEvent* aEvent) MOZ_OVERRIDE; }; class nsXBLKeyEventHandler : public nsIDOMEventListener diff --git a/content/xbl/src/nsXBLProtoImplMethod.h b/content/xbl/src/nsXBLProtoImplMethod.h index 59e745bd211..d2cde87bb64 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.h +++ b/content/xbl/src/nsXBLProtoImplMethod.h @@ -6,6 +6,7 @@ #ifndef nsXBLProtoImplMethod_h__ #define nsXBLProtoImplMethod_h__ +#include "mozilla/Attributes.h" #include "nsIAtom.h" #include "nsString.h" #include "jsapi.h" @@ -89,15 +90,15 @@ public: void SetLineNumber(uint32_t aLineNumber); virtual nsresult InstallMember(JSContext* aCx, - JS::Handle aTargetClassObject); + JS::Handle aTargetClassObject) MOZ_OVERRIDE; virtual nsresult CompileMember(nsIScriptContext* aContext, const nsCString& aClassStr, - JS::Handle aClassObject); + JS::Handle aClassObject) MOZ_OVERRIDE; - virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure); + virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure) MOZ_OVERRIDE; nsresult Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream); - virtual nsresult Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream); + virtual nsresult Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream) MOZ_OVERRIDE; bool IsCompiled() const { @@ -138,7 +139,7 @@ public: // binding instantiations (though they may hang out in mMembers on the // prototype implementation). virtual nsresult InstallMember(JSContext* aCx, - JS::Handle aTargetClassObject) { + JS::Handle aTargetClassObject) MOZ_OVERRIDE { return NS_OK; } diff --git a/content/xbl/src/nsXBLProtoImplProperty.h b/content/xbl/src/nsXBLProtoImplProperty.h index 087b2d1cddb..7d6ec03d961 100644 --- a/content/xbl/src/nsXBLProtoImplProperty.h +++ b/content/xbl/src/nsXBLProtoImplProperty.h @@ -6,6 +6,7 @@ #ifndef nsXBLProtoImplProperty_h__ #define nsXBLProtoImplProperty_h__ +#include "mozilla/Attributes.h" #include "nsIAtom.h" #include "nsString.h" #include "jsapi.h" @@ -33,18 +34,18 @@ public: void SetSetterLineNumber(uint32_t aLineNumber); virtual nsresult InstallMember(JSContext* aCx, - JS::Handle aTargetClassObject); + JS::Handle aTargetClassObject) MOZ_OVERRIDE; virtual nsresult CompileMember(nsIScriptContext* aContext, const nsCString& aClassStr, - JS::Handle aClassObject); + JS::Handle aClassObject) MOZ_OVERRIDE; - virtual void Trace(const TraceCallbacks& aCallback, void *aClosure); + virtual void Trace(const TraceCallbacks& aCallback, void *aClosure) MOZ_OVERRIDE; nsresult Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream, XBLBindingSerializeDetails aType); virtual nsresult Write(nsIScriptContext* aContext, - nsIObjectOutputStream* aStream); + nsIObjectOutputStream* aStream) MOZ_OVERRIDE; protected: union { diff --git a/content/xbl/src/nsXBLResourceLoader.h b/content/xbl/src/nsXBLResourceLoader.h index 05098d8c914..d1af534f428 100644 --- a/content/xbl/src/nsXBLResourceLoader.h +++ b/content/xbl/src/nsXBLResourceLoader.h @@ -3,6 +3,7 @@ * 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/Attributes.h" #include "nsCOMPtr.h" #include "nsICSSLoaderObserver.h" #include "nsCOMArray.h" @@ -27,7 +28,7 @@ public: // nsICSSLoaderObserver NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, - nsresult aStatus); + nsresult aStatus) MOZ_OVERRIDE; void LoadResources(bool* aResult); void AddResource(nsIAtom* aResourceType, const nsAString& aSrc); diff --git a/content/xml/content/src/CDATASection.h b/content/xml/content/src/CDATASection.h index ab789040032..6d6ab82a2b1 100644 --- a/content/xml/content/src/CDATASection.h +++ b/content/xml/content/src/CDATASection.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_CDATASection_h #define mozilla_dom_CDATASection_h +#include "mozilla/Attributes.h" #include "nsIDOMCDATASection.h" #include "mozilla/dom/Text.h" @@ -59,12 +60,12 @@ public: virtual bool IsNodeOfType(uint32_t aFlags) const; virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, - bool aCloneText) const; + bool aCloneText) const MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() { return this; } + virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } #ifdef DEBUG - virtual void List(FILE* out, int32_t aIndent) const; - virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const; + virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; + virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const MOZ_OVERRIDE; #endif protected: diff --git a/content/xml/content/src/ProcessingInstruction.h b/content/xml/content/src/ProcessingInstruction.h index 1ca1e120eb7..04fc8d383df 100644 --- a/content/xml/content/src/ProcessingInstruction.h +++ b/content/xml/content/src/ProcessingInstruction.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_ProcessingInstruction_h #define mozilla_dom_ProcessingInstruction_h +#include "mozilla/Attributes.h" #include "nsIDOMProcessingInstruction.h" #include "nsGenericDOMDataNode.h" #include "nsAString.h" @@ -37,14 +38,14 @@ public: virtual bool IsNodeOfType(uint32_t aFlags) const; virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, - bool aCloneText) const; + bool aCloneText) const MOZ_OVERRIDE; #ifdef DEBUG - virtual void List(FILE* out, int32_t aIndent) const; - virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const; + virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; + virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const MOZ_OVERRIDE; #endif - virtual nsIDOMNode* AsDOMNode() { return this; } + virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } // WebIDL API void GetTarget(nsString& aTarget) diff --git a/content/xml/content/src/XMLStylesheetProcessingInstruction.h b/content/xml/content/src/XMLStylesheetProcessingInstruction.h index 05e832fb124..42c675c7b9b 100644 --- a/content/xml/content/src/XMLStylesheetProcessingInstruction.h +++ b/content/xml/content/src/XMLStylesheetProcessingInstruction.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_XMLStylesheetProcessingInstruction_h #define mozilla_dom_XMLStylesheetProcessingInstruction_h +#include "mozilla/Attributes.h" #include "mozilla/dom/ProcessingInstruction.h" #include "nsStyleLinkElement.h" @@ -46,32 +47,32 @@ public: // nsIDOMNode virtual void SetNodeValueInternal(const nsAString& aNodeValue, - mozilla::ErrorResult& aError); + mozilla::ErrorResult& aError) MOZ_OVERRIDE; // nsIContent virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, - bool aCompileEventHandlers); + bool aCompileEventHandlers) MOZ_OVERRIDE; virtual void UnbindFromTree(bool aDeep = true, - bool aNullParent = true); + bool aNullParent = true) MOZ_OVERRIDE; // nsIStyleSheetLinkingElement - virtual void OverrideBaseURI(nsIURI* aNewBaseURI); + virtual void OverrideBaseURI(nsIURI* aNewBaseURI) MOZ_OVERRIDE; // nsStyleLinkElement - NS_IMETHOD GetCharset(nsAString& aCharset); + NS_IMETHOD GetCharset(nsAString& aCharset) MOZ_OVERRIDE; protected: nsCOMPtr mOverriddenBaseURI; - already_AddRefed GetStyleSheetURL(bool* aIsInline); + already_AddRefed GetStyleSheetURL(bool* aIsInline) MOZ_OVERRIDE; void GetStyleSheetInfo(nsAString& aTitle, nsAString& aType, nsAString& aMedia, bool* aIsScoped, - bool* aIsAlternate); + bool* aIsAlternate) MOZ_OVERRIDE; virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, - bool aCloneText) const; + bool aCloneText) const MOZ_OVERRIDE; }; } // namespace dom diff --git a/content/xml/content/src/nsXMLElement.h b/content/xml/content/src/nsXMLElement.h index b91174725ee..352aa2dae73 100644 --- a/content/xml/content/src/nsXMLElement.h +++ b/content/xml/content/src/nsXMLElement.h @@ -6,6 +6,7 @@ #ifndef nsXMLElement_h___ #define nsXMLElement_h___ +#include "mozilla/Attributes.h" #include "nsIDOMElement.h" #include "mozilla/dom/Element.h" @@ -29,28 +30,28 @@ public: NS_FORWARD_NSIDOMELEMENT_TO_GENERIC // nsINode interface methods - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual nsXPCClassInfo* GetClassInfo(); + virtual nsXPCClassInfo* GetClassInfo() MOZ_OVERRIDE; - virtual nsIDOMNode* AsDOMNode() { return this; } + virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } // nsIContent interface methods - virtual nsIAtom *GetIDAttributeName() const; - virtual nsIAtom* DoGetID() const; + virtual nsIAtom *GetIDAttributeName() const MOZ_OVERRIDE; + virtual nsIAtom* DoGetID() const MOZ_OVERRIDE; virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, - bool aCompileEventHandlers); - virtual void UnbindFromTree(bool aDeep, bool aNullParent); + bool aCompileEventHandlers) MOZ_OVERRIDE; + virtual void UnbindFromTree(bool aDeep, bool aNullParent) MOZ_OVERRIDE; virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute, - bool aNotify); + bool aNotify) MOZ_OVERRIDE; virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, - nsAttrValue& aResult); + nsAttrValue& aResult) MOZ_OVERRIDE; // Element overrides - virtual void NodeInfoChanged(nsINodeInfo* aOldNodeInfo); + virtual void NodeInfoChanged(nsINodeInfo* aOldNodeInfo) MOZ_OVERRIDE; protected: virtual JSObject* WrapNode(JSContext *aCx, diff --git a/content/xml/document/src/XMLDocument.h b/content/xml/document/src/XMLDocument.h index b4683e15eba..e58c10c38e4 100644 --- a/content/xml/document/src/XMLDocument.h +++ b/content/xml/document/src/XMLDocument.h @@ -6,6 +6,7 @@ #ifndef mozilla_dom_XMLDocument_h #define mozilla_dom_XMLDocument_h +#include "mozilla/Attributes.h" #include "nsDocument.h" #include "nsIDOMXMLDocument.h" #include "nsIScriptContext.h" @@ -26,27 +27,27 @@ public: NS_DECL_ISUPPORTS_INHERITED - virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); + virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) MOZ_OVERRIDE; virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup, - nsIPrincipal* aPrincipal); + nsIPrincipal* aPrincipal) MOZ_OVERRIDE; virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel, nsILoadGroup* aLoadGroup, nsISupports* aContainer, nsIStreamListener **aDocListener, bool aReset = true, - nsIContentSink* aSink = nullptr); + nsIContentSink* aSink = nullptr) MOZ_OVERRIDE; - virtual void EndLoad(); + virtual void EndLoad() MOZ_OVERRIDE; // nsIDOMXMLDocument NS_DECL_NSIDOMXMLDOCUMENT - virtual nsresult Init(); + virtual nsresult Init() MOZ_OVERRIDE; - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const; + virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const MOZ_OVERRIDE; // DocSizeOfIncludingThis is inherited from nsIDocument. diff --git a/content/xml/document/src/nsXMLContentSink.h b/content/xml/document/src/nsXMLContentSink.h index 140fb66be03..3b26f42e84b 100644 --- a/content/xml/document/src/nsXMLContentSink.h +++ b/content/xml/document/src/nsXMLContentSink.h @@ -6,6 +6,7 @@ #ifndef nsXMLContentSink_h__ #define nsXMLContentSink_h__ +#include "mozilla/Attributes.h" #include "nsContentSink.h" #include "nsIXMLContentSink.h" #include "nsIExpatSink.h" @@ -60,25 +61,25 @@ public: NS_DECL_NSIEXPATSINK // nsIContentSink - NS_IMETHOD WillParse(void); - NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode); - NS_IMETHOD DidBuildModel(bool aTerminated); - NS_IMETHOD WillInterrupt(void); - NS_IMETHOD WillResume(void); - NS_IMETHOD SetParser(nsParserBase* aParser); - virtual void FlushPendingNotifications(mozFlushType aType); - NS_IMETHOD SetDocumentCharset(nsACString& aCharset); - virtual nsISupports *GetTarget(); - virtual bool IsScriptExecuting(); - virtual void ContinueInterruptedParsingAsync(); + NS_IMETHOD WillParse(void) MOZ_OVERRIDE; + NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) MOZ_OVERRIDE; + NS_IMETHOD DidBuildModel(bool aTerminated) MOZ_OVERRIDE; + NS_IMETHOD WillInterrupt(void) MOZ_OVERRIDE; + NS_IMETHOD WillResume(void) MOZ_OVERRIDE; + NS_IMETHOD SetParser(nsParserBase* aParser) MOZ_OVERRIDE; + virtual void FlushPendingNotifications(mozFlushType aType) MOZ_OVERRIDE; + NS_IMETHOD SetDocumentCharset(nsACString& aCharset) MOZ_OVERRIDE; + virtual nsISupports *GetTarget() MOZ_OVERRIDE; + virtual bool IsScriptExecuting() MOZ_OVERRIDE; + virtual void ContinueInterruptedParsingAsync() MOZ_OVERRIDE; // nsITransformObserver - NS_IMETHOD OnDocumentCreated(nsIDocument *aResultDocument); - NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument); + NS_IMETHOD OnDocumentCreated(nsIDocument *aResultDocument) MOZ_OVERRIDE; + NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument) MOZ_OVERRIDE; // nsICSSLoaderObserver NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, - nsresult aStatus); + nsresult aStatus) MOZ_OVERRIDE; static bool ParsePIData(const nsString &aData, nsString &aHref, nsString &aTitle, nsString &aMedia, bool &aIsAlternate); @@ -128,9 +129,9 @@ protected: void PopContent(); bool HaveNotifiedForCurrentContent() const; - nsresult FlushTags(); + nsresult FlushTags() MOZ_OVERRIDE; - void UpdateChildCounts(); + void UpdateChildCounts() MOZ_OVERRIDE; void DidAddContent() { @@ -145,7 +146,7 @@ protected: bool aAlternate, const nsSubstring& aTitle, const nsSubstring& aType, - const nsSubstring& aMedia); + const nsSubstring& aMedia) MOZ_OVERRIDE; nsresult LoadXSLStyleSheet(nsIURI* aUrl); diff --git a/content/xslt/src/xpath/nsXPathEvaluator.h b/content/xslt/src/xpath/nsXPathEvaluator.h index 23bc407cf41..47a82ba0390 100644 --- a/content/xslt/src/xpath/nsXPathEvaluator.h +++ b/content/xslt/src/xpath/nsXPathEvaluator.h @@ -42,13 +42,13 @@ public: NS_DECL_NSIDOMXPATHEVALUATOR // nsIXPathEvaluatorInternal interface - NS_IMETHOD SetDocument(nsIDOMDocument* aDocument); + NS_IMETHOD SetDocument(nsIDOMDocument* aDocument) MOZ_OVERRIDE; NS_IMETHOD CreateExpression(const nsAString &aExpression, nsIDOMXPathNSResolver *aResolver, nsTArray *aNamespaceURIs, nsTArray *aContractIDs, nsCOMArray *aState, - nsIDOMXPathExpression **aResult); + nsIDOMXPathExpression **aResult) MOZ_OVERRIDE; // WebIDL API JSObject* WrapObject(JSContext* aCx, JS::Handle aScope); diff --git a/content/xslt/src/xpath/nsXPathResult.h b/content/xslt/src/xpath/nsXPathResult.h index 9a4cbda7d69..9992580385e 100644 --- a/content/xslt/src/xpath/nsXPathResult.h +++ b/content/xslt/src/xpath/nsXPathResult.h @@ -63,9 +63,9 @@ public: // nsIXPathResult interface nsresult SetExprResult(txAExprResult *aExprResult, uint16_t aResultType, - nsINode* aContextNode); - nsresult GetExprResult(txAExprResult **aExprResult); - nsresult Clone(nsIXPathResult **aResult); + nsINode* aContextNode) MOZ_OVERRIDE; + nsresult GetExprResult(txAExprResult **aExprResult) MOZ_OVERRIDE; + nsresult Clone(nsIXPathResult **aResult) MOZ_OVERRIDE; void RemoveObserver(); private: static bool isSnapshot(uint16_t aResultType) diff --git a/content/xslt/src/xpath/txExpr.h b/content/xslt/src/xpath/txExpr.h index c02662582ed..0dc8900af98 100644 --- a/content/xslt/src/xpath/txExpr.h +++ b/content/xslt/src/xpath/txExpr.h @@ -6,6 +6,7 @@ #ifndef TRANSFRMX_EXPR_H #define TRANSFRMX_EXPR_H +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "txExprResult.h" #include "txCore.h" @@ -285,8 +286,8 @@ public: txIEvalContext* aContext); TX_DECL_TOSTRING - Expr* getSubExprAt(uint32_t aPos); - void setSubExprAt(uint32_t aPos, Expr* aExpr); + Expr* getSubExprAt(uint32_t aPos) MOZ_OVERRIDE; + void setSubExprAt(uint32_t aPos, Expr* aExpr) MOZ_OVERRIDE; protected: @@ -442,7 +443,7 @@ public: txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, int32_t aNSID, uint16_t aNodeType); - NodeTestType getType(); + NodeTestType getType() MOZ_OVERRIDE; TX_DECL_NODE_TEST @@ -487,7 +488,7 @@ public: return mNodeType; } - NodeTestType getType(); + NodeTestType getType() MOZ_OVERRIDE; TX_DECL_NODE_TEST diff --git a/content/xslt/src/xpath/txSingleNodeContext.h b/content/xslt/src/xpath/txSingleNodeContext.h index 3c668dd6111..ed8c9d0af36 100644 --- a/content/xslt/src/xpath/txSingleNodeContext.h +++ b/content/xslt/src/xpath/txSingleNodeContext.h @@ -6,6 +6,7 @@ #ifndef __TX_XPATH_SINGLENODE_CONTEXT #define __TX_XPATH_SINGLENODE_CONTEXT +#include "mozilla/Attributes.h" #include "txIXPathContext.h" class txSingleNodeContext : public txIEvalContext @@ -20,31 +21,31 @@ public: } nsresult getVariable(int32_t aNamespace, nsIAtom* aLName, - txAExprResult*& aResult) + txAExprResult*& aResult) MOZ_OVERRIDE { NS_ASSERTION(mInner, "mInner is null!!!"); return mInner->getVariable(aNamespace, aLName, aResult); } - bool isStripSpaceAllowed(const txXPathNode& aNode) + bool isStripSpaceAllowed(const txXPathNode& aNode) MOZ_OVERRIDE { NS_ASSERTION(mInner, "mInner is null!!!"); return mInner->isStripSpaceAllowed(aNode); } - void* getPrivateContext() + void* getPrivateContext() MOZ_OVERRIDE { NS_ASSERTION(mInner, "mInner is null!!!"); return mInner->getPrivateContext(); } - txResultRecycler* recycler() + txResultRecycler* recycler() MOZ_OVERRIDE { NS_ASSERTION(mInner, "mInner is null!!!"); return mInner->recycler(); } - void receiveError(const nsAString& aMsg, nsresult aRes) + void receiveError(const nsAString& aMsg, nsresult aRes) MOZ_OVERRIDE { NS_ASSERTION(mInner, "mInner is null!!!"); #ifdef DEBUG @@ -56,17 +57,17 @@ public: #endif } - const txXPathNode& getContextNode() + const txXPathNode& getContextNode() MOZ_OVERRIDE { return mNode; } - uint32_t size() + uint32_t size() MOZ_OVERRIDE { return 1; } - uint32_t position() + uint32_t position() MOZ_OVERRIDE { return 1; } diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.h b/content/xslt/src/xslt/txMozillaXMLOutput.h index fb37da46957..0d35fbde154 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.h +++ b/content/xslt/src/xslt/txMozillaXMLOutput.h @@ -39,7 +39,7 @@ public: // nsICSSLoaderObserver NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, - nsresult aStatus); + nsresult aStatus) MOZ_OVERRIDE; void Init(nsITransformObserver* aObserver); nsresult AddScriptElement(nsIScriptElement* aElement); diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.h b/content/xslt/src/xslt/txMozillaXSLTProcessor.h index ec1b9080ff4..e7536578866 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.h +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.h @@ -66,18 +66,18 @@ public: NS_DECL_NSIXSLTPROCESSORPRIVATE // nsIDocumentTransformer interface - NS_IMETHOD Init(nsIPrincipal* aPrincipal); - NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver); - NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsILoadGroup* aLoadGroup); - NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource); - NS_IMETHOD CancelLoads() {return NS_OK;} + NS_IMETHOD Init(nsIPrincipal* aPrincipal) MOZ_OVERRIDE; + NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver) MOZ_OVERRIDE; + NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsILoadGroup* aLoadGroup) MOZ_OVERRIDE; + NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource) MOZ_OVERRIDE; + NS_IMETHOD CancelLoads() MOZ_OVERRIDE {return NS_OK;} NS_IMETHOD AddXSLTParamNamespace(const nsString& aPrefix, - const nsString& aNamespace); + const nsString& aNamespace) MOZ_OVERRIDE; NS_IMETHOD AddXSLTParam(const nsString& aName, const nsString& aNamespace, const nsString& aSelect, const nsString& aValue, - nsIDOMNode* aContext); + nsIDOMNode* aContext) MOZ_OVERRIDE; // nsIMutationObserver interface NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED diff --git a/content/xslt/src/xslt/txRtfHandler.h b/content/xslt/src/xslt/txRtfHandler.h index 3a3bb0c4c31..ec5bf0f6fa0 100644 --- a/content/xslt/src/xslt/txRtfHandler.h +++ b/content/xslt/src/xslt/txRtfHandler.h @@ -6,6 +6,7 @@ #ifndef txRtfHandler_h___ #define txRtfHandler_h___ +#include "mozilla/Attributes.h" #include "txBufferingHandler.h" #include "txExprResult.h" #include "txXPathNode.h" @@ -40,8 +41,8 @@ class txRtfHandler : public txBufferingHandler public: nsresult getAsRTF(txAExprResult** aResult); - nsresult endDocument(nsresult aResult); - nsresult startDocument(); + nsresult endDocument(nsresult aResult) MOZ_OVERRIDE; + nsresult startDocument() MOZ_OVERRIDE; }; #endif /* txRtfHandler_h___ */ diff --git a/content/xslt/src/xslt/txStylesheetCompiler.h b/content/xslt/src/xslt/txStylesheetCompiler.h index f5a59282486..68eb39ebb2f 100644 --- a/content/xslt/src/xslt/txStylesheetCompiler.h +++ b/content/xslt/src/xslt/txStylesheetCompiler.h @@ -6,6 +6,7 @@ #ifndef TRANSFRMX_TXSTYLESHEETCOMPILER_H #define TRANSFRMX_TXSTYLESHEETCOMPILER_H +#include "mozilla/Attributes.h" #include "txStack.h" #include "txXSLTPatterns.h" #include "txExpr.h" @@ -120,10 +121,10 @@ public: nsresult addVariable(const txExpandedName& aName); // txIParseContext - nsresult resolveNamespacePrefix(nsIAtom* aPrefix, int32_t& aID); + nsresult resolveNamespacePrefix(nsIAtom* aPrefix, int32_t& aID) MOZ_OVERRIDE; nsresult resolveFunctionCall(nsIAtom* aName, int32_t aID, - FunctionCall** aFunction); - bool caseInsensitiveNameTests(); + FunctionCall** aFunction) MOZ_OVERRIDE; + bool caseInsensitiveNameTests() MOZ_OVERRIDE; /** * Should the stylesheet be parsed in forwards compatible parsing mode. @@ -133,7 +134,7 @@ public: return mElementContext->mForwardsCompatibleParsing; } - void SetErrorOffset(uint32_t aOffset); + void SetErrorOffset(uint32_t aOffset) MOZ_OVERRIDE; static void shutdown(); diff --git a/content/xslt/src/xslt/txXPathResultComparator.h b/content/xslt/src/xslt/txXPathResultComparator.h index 7adcacf8ba3..8c7d8a5a8da 100644 --- a/content/xslt/src/xslt/txXPathResultComparator.h +++ b/content/xslt/src/xslt/txXPathResultComparator.h @@ -6,6 +6,7 @@ #ifndef TRANSFRMX_XPATHRESULTCOMPARATOR_H #define TRANSFRMX_XPATHRESULTCOMPARATOR_H +#include "mozilla/Attributes.h" #include "txCore.h" #include "nsCOMPtr.h" #include "nsICollation.h" @@ -46,9 +47,9 @@ public: txResultStringComparator(bool aAscending, bool aUpperFirst, const nsAFlatString& aLanguage); - int compareValues(txObject* aVal1, txObject* aVal2); + int compareValues(txObject* aVal1, txObject* aVal2) MOZ_OVERRIDE; nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext, - txObject *&aResult); + txObject *&aResult) MOZ_OVERRIDE; private: nsCOMPtr mCollation; nsresult init(const nsAFlatString& aLanguage); @@ -78,9 +79,9 @@ class txResultNumberComparator : public txXPathResultComparator public: txResultNumberComparator(bool aAscending); - int compareValues(txObject* aVal1, txObject* aVal2); + int compareValues(txObject* aVal1, txObject* aVal2) MOZ_OVERRIDE; nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext, - txObject *&aResult); + txObject *&aResult) MOZ_OVERRIDE; private: int mAscending; diff --git a/content/xslt/src/xslt/txXSLTPatterns.h b/content/xslt/src/xslt/txXSLTPatterns.h index e7f0da9402c..b34e3e8a51c 100644 --- a/content/xslt/src/xslt/txXSLTPatterns.h +++ b/content/xslt/src/xslt/txXSLTPatterns.h @@ -6,6 +6,7 @@ #ifndef TX_XSLT_PATTERNS_H #define TX_XSLT_PATTERNS_H +#include "mozilla/Attributes.h" #include "txExpr.h" #include "txXMLUtils.h" @@ -135,7 +136,7 @@ public: } TX_DECL_PATTERN; - Type getType(); + Type getType() MOZ_OVERRIDE; private: txOwningArray mLocPathPatterns; @@ -227,7 +228,7 @@ public: } TX_DECL_PATTERN; - Type getType(); + Type getType() MOZ_OVERRIDE; txNodeTest* getNodeTest() { diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 73c6d07e631..f952a67851c 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2387,7 +2387,8 @@ nsXULPrototypeScript::Serialize(nsIObjectOutputStream* aStream, rv = aStream->Write32(mLangVersion); if (NS_FAILED(rv)) return rv; // And delegate the writing to the nsIScriptContext - rv = context->Serialize(aStream, mScriptObject); + rv = context->Serialize(aStream, + JS::Handle::fromMarkedLocation(&mScriptObject)); if (NS_FAILED(rv)) return rv; return NS_OK; diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 89ea4c7f56f..5efa8c812d7 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -13,6 +13,7 @@ #define nsXULElement_h__ // XXX because nsEventListenerManager has broken includes +#include "mozilla/Attributes.h" #include "nsIDOMEvent.h" #include "nsIServiceManager.h" #include "nsIAtom.h" @@ -158,11 +159,11 @@ public: } #ifdef NS_BUILD_REFCNT_LOGGING - virtual const char* ClassName() { return "nsXULPrototypeElement"; } - virtual uint32_t ClassSize() { return sizeof(*this); } + virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypeElement"; } + virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); } #endif - virtual void ReleaseSubtree() + virtual void ReleaseSubtree() MOZ_OVERRIDE { for (int32_t i = mChildren.Length() - 1; i >= 0; i--) { if (mChildren[i].get()) @@ -174,11 +175,11 @@ public: virtual nsresult Serialize(nsIObjectOutputStream* aStream, nsIScriptGlobalObject* aGlobal, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; virtual nsresult Deserialize(nsIObjectInputStream* aStream, nsIScriptGlobalObject* aGlobal, nsIURI* aDocumentURI, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; nsresult SetAttrAt(uint32_t aPos, const nsAString& aValue, nsIURI* aDocumentURI); @@ -211,19 +212,19 @@ public: virtual ~nsXULPrototypeScript(); #ifdef NS_BUILD_REFCNT_LOGGING - virtual const char* ClassName() { return "nsXULPrototypeScript"; } - virtual uint32_t ClassSize() { return sizeof(*this); } + virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypeScript"; } + virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); } #endif virtual nsresult Serialize(nsIObjectOutputStream* aStream, nsIScriptGlobalObject* aGlobal, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; nsresult SerializeOutOfLine(nsIObjectOutputStream* aStream, nsIScriptGlobalObject* aGlobal); virtual nsresult Deserialize(nsIObjectInputStream* aStream, nsIScriptGlobalObject* aGlobal, nsIURI* aDocumentURI, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; nsresult DeserializeOutOfLine(nsIObjectInputStream* aInput, nsIScriptGlobalObject* aGlobal); @@ -282,17 +283,17 @@ public: } #ifdef NS_BUILD_REFCNT_LOGGING - virtual const char* ClassName() { return "nsXULPrototypeText"; } - virtual uint32_t ClassSize() { return sizeof(*this); } + virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypeText"; } + virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); } #endif virtual nsresult Serialize(nsIObjectOutputStream* aStream, nsIScriptGlobalObject* aGlobal, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; virtual nsresult Deserialize(nsIObjectInputStream* aStream, nsIScriptGlobalObject* aGlobal, nsIURI* aDocumentURI, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; nsString mValue; }; @@ -310,17 +311,17 @@ public: } #ifdef NS_BUILD_REFCNT_LOGGING - virtual const char* ClassName() { return "nsXULPrototypePI"; } - virtual uint32_t ClassSize() { return sizeof(*this); } + virtual const char* ClassName() MOZ_OVERRIDE { return "nsXULPrototypePI"; } + virtual uint32_t ClassSize() MOZ_OVERRIDE { return sizeof(*this); } #endif virtual nsresult Serialize(nsIObjectOutputStream* aStream, nsIScriptGlobalObject* aGlobal, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; virtual nsresult Deserialize(nsIObjectInputStream* aStream, nsIScriptGlobalObject* aGlobal, nsIURI* aDocumentURI, - const nsCOMArray *aNodeInfos); + const nsCOMArray *aNodeInfos) MOZ_OVERRIDE; nsString mTarget; nsString mData; @@ -373,30 +374,30 @@ public: // nsIContent virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, - bool aCompileEventHandlers); - virtual void UnbindFromTree(bool aDeep, bool aNullParent); - virtual void RemoveChildAt(uint32_t aIndex, bool aNotify); - virtual void DestroyContent(); + bool aCompileEventHandlers) MOZ_OVERRIDE; + virtual void UnbindFromTree(bool aDeep, bool aNullParent) MOZ_OVERRIDE; + virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) MOZ_OVERRIDE; + virtual void DestroyContent() MOZ_OVERRIDE; #ifdef DEBUG - virtual void List(FILE* out, int32_t aIndent) const; - virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const + virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; + virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const MOZ_OVERRIDE { } #endif virtual void PerformAccesskey(bool aKeyCausesActivation, - bool aIsTrustedEvent); + bool aIsTrustedEvent) MOZ_OVERRIDE; nsresult ClickWithInputSource(uint16_t aInputSource); - virtual nsIContent *GetBindingParent() const; - virtual bool IsNodeOfType(uint32_t aFlags) const; - virtual bool IsFocusable(int32_t *aTabIndex = nullptr, bool aWithMouse = false); + virtual nsIContent *GetBindingParent() const MOZ_OVERRIDE; + virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE; + virtual bool IsFocusable(int32_t *aTabIndex = nullptr, bool aWithMouse = false) MOZ_OVERRIDE; - NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); + NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE; virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute, - int32_t aModType) const; - NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const; + int32_t aModType) const MOZ_OVERRIDE; + NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; // XUL element methods /** @@ -419,13 +420,13 @@ public: // nsIDOMXULElement NS_DECL_NSIDOMXULELEMENT - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; - virtual nsEventStates IntrinsicState() const; + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; + virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE; nsresult GetFrameLoader(nsIFrameLoader** aFrameLoader); nsresult SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner); - virtual void RecompileScriptEventListeners(); + virtual void RecompileScriptEventListeners() MOZ_OVERRIDE; // This function should ONLY be used by BindToTree implementations. // The function exists solely because XUL elements store the binding @@ -435,7 +436,7 @@ public: mBindingParent = aBindingParent; } - virtual nsIDOMNode* AsDOMNode() { return this; } + virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; @@ -628,7 +629,7 @@ protected: nsRefPtr mFrameLoader; }; - virtual nsINode::nsSlots* CreateSlots(); + virtual nsINode::nsSlots* CreateSlots() MOZ_OVERRIDE; nsresult LoadSrc(); @@ -645,19 +646,19 @@ protected: virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName, const nsAttrValueOrString* aValue, - bool aNotify); + bool aNotify) MOZ_OVERRIDE; virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, - const nsAttrValue* aValue, bool aNotify); + const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE; - virtual void UpdateEditableState(bool aNotify); + virtual void UpdateEditableState(bool aNotify) MOZ_OVERRIDE; virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, - nsAttrValue& aResult); + nsAttrValue& aResult) MOZ_OVERRIDE; virtual nsEventListenerManager* - GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer); + GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer) MOZ_OVERRIDE; /** * Add a listener for the specified attribute, if appropriate. diff --git a/content/xul/document/src/XULDocument.h b/content/xul/document/src/XULDocument.h index 1ec16af835c..5e11d04916b 100644 --- a/content/xul/document/src/XULDocument.h +++ b/content/xul/document/src/XULDocument.h @@ -99,9 +99,9 @@ public: NS_DECL_NSISTREAMLOADEROBSERVER // nsIDocument interface - virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); + virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) MOZ_OVERRIDE; virtual void ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup, - nsIPrincipal* aPrincipal); + nsIPrincipal* aPrincipal) MOZ_OVERRIDE; virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel *channel, @@ -109,11 +109,11 @@ public: nsISupports* aContainer, nsIStreamListener **aDocListener, bool aReset = true, - nsIContentSink* aSink = nullptr); + nsIContentSink* aSink = nullptr) MOZ_OVERRIDE; - virtual void SetContentType(const nsAString& aContentType); + virtual void SetContentType(const nsAString& aContentType) MOZ_OVERRIDE; - virtual void EndLoad(); + virtual void EndLoad() MOZ_OVERRIDE; // nsIMutationObserver interface NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED @@ -124,17 +124,17 @@ public: // nsIXULDocument interface virtual void GetElementsForID(const nsAString& aID, - nsCOMArray& aElements); + nsCOMArray& aElements) MOZ_OVERRIDE; - NS_IMETHOD GetScriptGlobalObjectOwner(nsIScriptGlobalObjectOwner** aGlobalOwner); - NS_IMETHOD AddSubtreeToDocument(nsIContent* aContent); - NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aContent); + NS_IMETHOD GetScriptGlobalObjectOwner(nsIScriptGlobalObjectOwner** aGlobalOwner) MOZ_OVERRIDE; + NS_IMETHOD AddSubtreeToDocument(nsIContent* aContent) MOZ_OVERRIDE; + NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aContent) MOZ_OVERRIDE; NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, - nsIXULTemplateBuilder* aBuilder); + nsIXULTemplateBuilder* aBuilder) MOZ_OVERRIDE; NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, - nsIXULTemplateBuilder** aResult); - NS_IMETHOD OnPrototypeLoadDone(bool aResumeWalk); - bool OnDocumentParserError(); + nsIXULTemplateBuilder** aResult) MOZ_OVERRIDE; + NS_IMETHOD OnPrototypeLoadDone(bool aResumeWalk) MOZ_OVERRIDE; + bool OnDocumentParserError() MOZ_OVERRIDE; // nsINode interface overrides virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; @@ -154,7 +154,7 @@ public: using nsIDocument::GetLocation; // nsDocument interface overrides - virtual Element* GetElementById(const nsAString & elementId); + virtual Element* GetElementById(const nsAString & elementId) MOZ_OVERRIDE; // nsIDOMXULDocument interface NS_DECL_NSIDOMXULDOCUMENT @@ -162,17 +162,17 @@ public: // nsICSSLoaderObserver NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, - nsresult aStatus); + nsresult aStatus) MOZ_OVERRIDE; - virtual void EndUpdate(nsUpdateType aUpdateType); + virtual void EndUpdate(nsUpdateType aUpdateType) MOZ_OVERRIDE; - virtual bool IsDocumentRightToLeft(); + virtual bool IsDocumentRightToLeft() MOZ_OVERRIDE; - virtual void ResetDocumentDirection(); + virtual void ResetDocumentDirection() MOZ_OVERRIDE; - virtual int GetDocumentLWTheme(); + virtual int GetDocumentLWTheme() MOZ_OVERRIDE; - virtual void ResetDocumentLWTheme() { mDocLWTheme = Doc_Theme_Uninitialized; } + virtual void ResetDocumentLWTheme() MOZ_OVERRIDE { mDocLWTheme = Doc_Theme_Uninitialized; } static bool MatchAttribute(nsIContent* aContent, @@ -225,7 +225,7 @@ protected: friend nsresult (::NS_NewXULDocument(nsIXULDocument** aResult)); - nsresult Init(void); + nsresult Init(void) MOZ_OVERRIDE; nsresult StartLayout(void); nsresult @@ -508,8 +508,8 @@ protected: virtual ~BroadcasterHookup(); - virtual Phase GetPhase() { return eHookup; } - virtual Result Resolve(); + virtual Phase GetPhase() MOZ_OVERRIDE { return eHookup; } + virtual Result Resolve() MOZ_OVERRIDE; }; friend class BroadcasterHookup; @@ -533,8 +533,8 @@ protected: virtual ~OverlayForwardReference(); - virtual Phase GetPhase() { return eConstruction; } - virtual Result Resolve(); + virtual Phase GetPhase() MOZ_OVERRIDE { return eConstruction; } + virtual Result Resolve() MOZ_OVERRIDE; }; friend class OverlayForwardReference; @@ -548,8 +548,8 @@ protected: TemplateBuilderHookup(nsIContent* aElement) : mElement(aElement) {} - virtual Phase GetPhase() { return eHookup; } - virtual Result Resolve(); + virtual Phase GetPhase() MOZ_OVERRIDE { return eHookup; } + virtual Result Resolve() MOZ_OVERRIDE; }; friend class TemplateBuilderHookup; diff --git a/content/xul/document/src/nsXULContentSink.h b/content/xul/document/src/nsXULContentSink.h index f023c2acb89..d16768f329f 100644 --- a/content/xul/document/src/nsXULContentSink.h +++ b/content/xul/document/src/nsXULContentSink.h @@ -6,6 +6,7 @@ #ifndef nsXULContentSink_h__ #define nsXULContentSink_h__ +#include "mozilla/Attributes.h" #include "nsIExpatSink.h" #include "nsIXMLContentSink.h" #include "nsAutoPtr.h" @@ -35,15 +36,15 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(XULContentSinkImpl, nsIXMLContentSink) // nsIContentSink - NS_IMETHOD WillParse(void) { return NS_OK; } - NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode); - NS_IMETHOD DidBuildModel(bool aTerminated); - NS_IMETHOD WillInterrupt(void); - NS_IMETHOD WillResume(void); - NS_IMETHOD SetParser(nsParserBase* aParser); - virtual void FlushPendingNotifications(mozFlushType aType) { } - NS_IMETHOD SetDocumentCharset(nsACString& aCharset); - virtual nsISupports *GetTarget(); + NS_IMETHOD WillParse(void) MOZ_OVERRIDE { return NS_OK; } + NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) MOZ_OVERRIDE; + NS_IMETHOD DidBuildModel(bool aTerminated) MOZ_OVERRIDE; + NS_IMETHOD WillInterrupt(void) MOZ_OVERRIDE; + NS_IMETHOD WillResume(void) MOZ_OVERRIDE; + NS_IMETHOD SetParser(nsParserBase* aParser) MOZ_OVERRIDE; + virtual void FlushPendingNotifications(mozFlushType aType) MOZ_OVERRIDE { } + NS_IMETHOD SetDocumentCharset(nsACString& aCharset) MOZ_OVERRIDE; + virtual nsISupports *GetTarget() MOZ_OVERRIDE; /** * Initialize the content sink, giving it an nsIDocument object diff --git a/content/xul/document/src/nsXULPrototypeDocument.h b/content/xul/document/src/nsXULPrototypeDocument.h index 54f2a2700db..6fe090507e9 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.h +++ b/content/xul/document/src/nsXULPrototypeDocument.h @@ -6,6 +6,7 @@ #ifndef nsXULPrototypeDocument_h__ #define nsXULPrototypeDocument_h__ +#include "mozilla/Attributes.h" #include "nsAutoPtr.h" #include "nsCOMArray.h" #include "nsCOMPtr.h" @@ -114,7 +115,7 @@ public: nsNodeInfoManager *GetNodeInfoManager(); // nsIScriptGlobalObjectOwner methods - virtual nsIScriptGlobalObject* GetScriptGlobalObject(); + virtual nsIScriptGlobalObject* GetScriptGlobalObject() MOZ_OVERRIDE; void MarkInCCGeneration(uint32_t aCCGeneration) { diff --git a/content/xul/templates/src/nsContentTestNode.h b/content/xul/templates/src/nsContentTestNode.h index 7d50686839e..bd94bcc8d22 100644 --- a/content/xul/templates/src/nsContentTestNode.h +++ b/content/xul/templates/src/nsContentTestNode.h @@ -6,6 +6,7 @@ #ifndef nsContentTestNode_h__ #define nsContentTestNode_h__ +#include "mozilla/Attributes.h" #include "nscore.h" #include "nsRuleNetwork.h" #include "nsIAtom.h" @@ -25,10 +26,10 @@ public: nsIAtom* aContentVariable); virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations, - bool* aCantHandleYet) const; + bool* aCantHandleYet) const MOZ_OVERRIDE; nsresult - Constrain(InstantiationSet& aInstantiations); + Constrain(InstantiationSet& aInstantiations) MOZ_OVERRIDE; void SetTag(nsIAtom* aTag, nsIDOMDocument* aDocument) { diff --git a/content/xul/templates/src/nsInstantiationNode.h b/content/xul/templates/src/nsInstantiationNode.h index 8de4d96aa6e..e3a2f656c54 100644 --- a/content/xul/templates/src/nsInstantiationNode.h +++ b/content/xul/templates/src/nsInstantiationNode.h @@ -6,6 +6,7 @@ #ifndef nsInstantiationNode_h__ #define nsInstantiationNode_h__ +#include "mozilla/Attributes.h" #include "nsRuleNetwork.h" #include "nsRDFQuery.h" @@ -25,7 +26,7 @@ public: // "downward" propagations virtual nsresult Propagate(InstantiationSet& aInstantiations, - bool aIsUpdate, bool& aMatched); + bool aIsUpdate, bool& aMatched) MOZ_OVERRIDE; protected: diff --git a/content/xul/templates/src/nsRDFConInstanceTestNode.h b/content/xul/templates/src/nsRDFConInstanceTestNode.h index 5be69498151..e3c7c3d5d05 100644 --- a/content/xul/templates/src/nsRDFConInstanceTestNode.h +++ b/content/xul/templates/src/nsRDFConInstanceTestNode.h @@ -6,6 +6,7 @@ #ifndef nsRDFConInstanceTestNode_h__ #define nsRDFConInstanceTestNode_h__ +#include "mozilla/Attributes.h" #include "nscore.h" #include "nsRDFTestNode.h" #include "nsIRDFResource.h" @@ -28,18 +29,18 @@ public: Test aEmpty); virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations, - bool* aCantHandleYet) const; + bool* aCantHandleYet) const MOZ_OVERRIDE; virtual bool CanPropagate(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aTarget, - Instantiation& aInitialBindings) const; + Instantiation& aInitialBindings) const MOZ_OVERRIDE; virtual void Retract(nsIRDFResource* aSource, nsIRDFResource* aProperty, - nsIRDFNode* aTarget) const; + nsIRDFNode* aTarget) const MOZ_OVERRIDE; class Element : public MemoryElement { @@ -54,14 +55,14 @@ public: virtual ~Element() { MOZ_COUNT_DTOR(nsRDFConInstanceTestNode::Element); } - virtual const char* Type() const { + virtual const char* Type() const MOZ_OVERRIDE { return "nsRDFConInstanceTestNode::Element"; } - virtual PLHashNumber Hash() const { + virtual PLHashNumber Hash() const MOZ_OVERRIDE { return mozilla::HashGeneric(mContainerTest, mEmptyTest, mContainer.get()); } - virtual bool Equals(const MemoryElement& aElement) const { + virtual bool Equals(const MemoryElement& aElement) const MOZ_OVERRIDE { if (aElement.Type() == Type()) { const Element& element = static_cast(aElement); return mContainer == element.mContainer diff --git a/content/xul/templates/src/nsRDFConMemberTestNode.h b/content/xul/templates/src/nsRDFConMemberTestNode.h index 5e7c95a56de..3b306935a06 100644 --- a/content/xul/templates/src/nsRDFConMemberTestNode.h +++ b/content/xul/templates/src/nsRDFConMemberTestNode.h @@ -6,6 +6,7 @@ #ifndef nsRDFConMemberTestNode_h__ #define nsRDFConMemberTestNode_h__ +#include "mozilla/Attributes.h" #include "nscore.h" #include "nsRDFTestNode.h" #include "nsIRDFDataSource.h" @@ -25,18 +26,18 @@ public: nsIAtom* aMemberVariable); virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations, - bool* aCantHandleYet) const; + bool* aCantHandleYet) const MOZ_OVERRIDE; virtual bool CanPropagate(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aTarget, - Instantiation& aInitialBindings) const; + Instantiation& aInitialBindings) const MOZ_OVERRIDE; virtual void Retract(nsIRDFResource* aSource, nsIRDFResource* aProperty, - nsIRDFNode* aTarget) const; + nsIRDFNode* aTarget) const MOZ_OVERRIDE; class Element : public MemoryElement { public: @@ -48,14 +49,14 @@ public: virtual ~Element() { MOZ_COUNT_DTOR(nsRDFConMemberTestNode::Element); } - virtual const char* Type() const { + virtual const char* Type() const MOZ_OVERRIDE { return "nsRDFConMemberTestNode::Element"; } - virtual PLHashNumber Hash() const { + virtual PLHashNumber Hash() const MOZ_OVERRIDE { return PLHashNumber(NS_PTR_TO_INT32(mContainer.get())) ^ (PLHashNumber(NS_PTR_TO_INT32(mMember.get())) >> 12); } - virtual bool Equals(const MemoryElement& aElement) const { + virtual bool Equals(const MemoryElement& aElement) const MOZ_OVERRIDE { if (aElement.Type() == Type()) { const Element& element = static_cast(aElement); return mContainer == element.mContainer && mMember == element.mMember; diff --git a/content/xul/templates/src/nsRDFPropertyTestNode.h b/content/xul/templates/src/nsRDFPropertyTestNode.h index bfacdc93213..600a039751e 100644 --- a/content/xul/templates/src/nsRDFPropertyTestNode.h +++ b/content/xul/templates/src/nsRDFPropertyTestNode.h @@ -6,6 +6,7 @@ #ifndef nsRDFPropertyTestNode_h__ #define nsRDFPropertyTestNode_h__ +#include "mozilla/Attributes.h" #include "nscore.h" #include "nsRDFTestNode.h" #include "nsIRDFDataSource.h" @@ -43,18 +44,18 @@ public: nsIRDFNode* aTarget); virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations, - bool* aCantHandleYet) const; + bool* aCantHandleYet) const MOZ_OVERRIDE; virtual bool CanPropagate(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aTarget, - Instantiation& aInitialBindings) const; + Instantiation& aInitialBindings) const MOZ_OVERRIDE; virtual void Retract(nsIRDFResource* aSource, nsIRDFResource* aProperty, - nsIRDFNode* aTarget) const; + nsIRDFNode* aTarget) const MOZ_OVERRIDE; class Element : public MemoryElement { @@ -69,14 +70,14 @@ public: virtual ~Element() { MOZ_COUNT_DTOR(nsRDFPropertyTestNode::Element); } - virtual const char* Type() const { + virtual const char* Type() const MOZ_OVERRIDE { return "nsRDFPropertyTestNode::Element"; } - virtual PLHashNumber Hash() const { + virtual PLHashNumber Hash() const MOZ_OVERRIDE { return mozilla::HashGeneric(mSource.get(), mProperty.get(), mTarget.get()); } - virtual bool Equals(const MemoryElement& aElement) const { + virtual bool Equals(const MemoryElement& aElement) const MOZ_OVERRIDE { if (aElement.Type() == Type()) { const Element& element = static_cast(aElement); return mSource == element.mSource diff --git a/content/xul/templates/src/nsRDFQuery.h b/content/xul/templates/src/nsRDFQuery.h index d59c77b784b..68ba948db58 100644 --- a/content/xul/templates/src/nsRDFQuery.h +++ b/content/xul/templates/src/nsRDFQuery.h @@ -61,7 +61,7 @@ public: void SetRoot(TestNode* aRoot) { mRoot = aRoot; } - void GetQueryNode(nsIDOMNode** aQueryNode) + void GetQueryNode(nsIDOMNode** aQueryNode) MOZ_OVERRIDE { *aQueryNode = mQueryNode; NS_IF_ADDREF(*aQueryNode); @@ -86,14 +86,14 @@ public: void UseCachedResults(nsISimpleEnumerator** aResults); // clear the cached results - void ClearCachedResults() + void ClearCachedResults() MOZ_OVERRIDE { mCachedResults = nullptr; } - nsXULTemplateQueryProcessorRDF* Processor() { return mProcessor; } + nsXULTemplateQueryProcessorRDF* Processor() MOZ_OVERRIDE { return mProcessor; } - nsIAtom* GetMemberVariable() { return mMemberVariable; } + nsIAtom* GetMemberVariable() MOZ_OVERRIDE { return mMemberVariable; } bool IsSimple() { return mSimple; } diff --git a/content/xul/templates/src/nsRuleNetwork.h b/content/xul/templates/src/nsRuleNetwork.h index 619fc2d0d96..80d804b3af3 100644 --- a/content/xul/templates/src/nsRuleNetwork.h +++ b/content/xul/templates/src/nsRuleNetwork.h @@ -28,6 +28,7 @@ #ifndef nsRuleNetwork_h__ #define nsRuleNetwork_h__ +#include "mozilla/Attributes.h" #include "nsCOMPtr.h" #include "nsCOMArray.h" #include "nsIAtom.h" @@ -797,7 +798,7 @@ public: * aTakenInstantiations will be set properly even if an error occurs. */ virtual nsresult Propagate(InstantiationSet& aInstantiations, - bool aIsUpdate, bool& aTakenInstantiations); + bool aIsUpdate, bool& aTakenInstantiations) MOZ_OVERRIDE; /** * This is called by a child node on its parent to allow the diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 12cb3c102b6..c04bb4410e2 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1969,35 +1969,33 @@ nsDocShell::SetCharset(const char* aCharset) } // set the charset override - nsCOMPtr csAtom = do_GetAtom(aCharset); - SetForcedCharset(csAtom); + nsCString charset(aCharset); + SetForcedCharset(charset); return NS_OK; -} +} -NS_IMETHODIMP nsDocShell::SetForcedCharset(nsIAtom * aCharset) +NS_IMETHODIMP nsDocShell::SetForcedCharset(const nsACString& aCharset) { mForcedCharset = aCharset; return NS_OK; } -NS_IMETHODIMP nsDocShell::GetForcedCharset(nsIAtom ** aResult) +NS_IMETHODIMP nsDocShell::GetForcedCharset(nsACString& aResult) { - *aResult = mForcedCharset; - if (mForcedCharset) NS_ADDREF(*aResult); + aResult = mForcedCharset; return NS_OK; } -NS_IMETHODIMP nsDocShell::SetParentCharset(nsIAtom * aCharset) +NS_IMETHODIMP nsDocShell::SetParentCharset(const nsACString& aCharset) { mParentCharset = aCharset; return NS_OK; } -NS_IMETHODIMP nsDocShell::GetParentCharset(nsIAtom ** aResult) +NS_IMETHODIMP nsDocShell::GetParentCharset(nsACString& aResult) { - *aResult = mParentCharset; - if (mParentCharset) NS_ADDREF(*aResult); + aResult = mParentCharset; return NS_OK; } @@ -3497,8 +3495,7 @@ nsDocShell::AddChild(nsIDocShellTreeItem * aChild) // expose here. // set the child's parentCharset - nsCOMPtr parentCSAtom(do_GetAtom(parentCS)); - res = childAsDocShell->SetParentCharset(parentCSAtom); + res = childAsDocShell->SetParentCharset(parentCS); if (NS_FAILED(res)) return NS_OK; diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index bd030815d88..55f0c3d8fa0 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -869,8 +869,8 @@ protected: uint32_t mOwnOrContainingAppId; private: - nsCOMPtr mForcedCharset; - nsCOMPtr mParentCharset; + nsCString mForcedCharset; + nsCString mParentCharset; nsTObserverArray mPrivacyObservers; int32_t mParentCharsetSource; nsCString mOriginalUriString; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index d2faf3443ac..29b5f858e0e 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -597,12 +597,12 @@ interface nsIDocShell : nsIDocShellTreeItem * * XXX Could this be replaced by a boolean? */ - attribute nsIAtom forcedCharset; + attribute ACString forcedCharset; /** * In a child docshell, this is the charset of the parent docshell */ - attribute nsIAtom parentCharset; + attribute ACString parentCharset; /* * In a child docshell, this is the source of parentCharset diff --git a/docshell/test/unit/test_bug442584.js b/docshell/test/unit/test_bug442584.js index 2e487201495..75df23ab4fc 100644 --- a/docshell/test/unit/test_bug442584.js +++ b/docshell/test/unit/test_bug442584.js @@ -14,12 +14,12 @@ function run_test() { } // Make sure the queue has items in it... - var queue = prefetch.enumerateQueue(true, false); + var queue = prefetch.enumerateQueue(); do_check_true(queue.hasMoreElements()); // Now disable the pref to force the queue to empty... prefs.setBoolPref("network.prefetch-next", false); - queue = prefetch.enumerateQueue(true, false); + queue = prefetch.enumerateQueue(); do_check_false(queue.hasMoreElements()); // Now reenable the pref, and add more items to the queue. @@ -28,7 +28,7 @@ function run_test() { var uri = ios.newURI("http://localhost/" + i, null, null); prefetch.prefetchURI(uri, uri, null, true); } - queue = prefetch.enumerateQueue(true, false); + queue = prefetch.enumerateQueue(); do_check_true(queue.hasMoreElements()); } diff --git a/dom/base/DOMError.h b/dom/base/DOMError.h index bcd6d012d8a..ab32772ff87 100644 --- a/dom/base/DOMError.h +++ b/dom/base/DOMError.h @@ -11,10 +11,9 @@ #include "mozilla/ErrorResult.h" #include "mozilla/dom/BindingUtils.h" #include "nsCycleCollectionParticipant.h" +#include "nsPIDOMWindow.h" #include "nsWrapperCache.h" -class nsPIDOMWindow; - namespace mozilla { namespace dom { diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index c4ac39ebb23..f3070a5809a 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -1437,8 +1437,9 @@ Navigator::EnsureMessagesManager() NS_ENSURE_TRUE(gpi, NS_ERROR_FAILURE); // We don't do anything with the return value. - JS::Value prop_val = JSVAL_VOID; - rv = gpi->Init(window, &prop_val); + AutoJSContext cx; + JS::Rooted prop_val(cx); + rv = gpi->Init(window, prop_val.address()); NS_ENSURE_SUCCESS(rv, rv); mMessagesManager = messageManager.forget(); diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index cebdfeac6d9..55e1e338118 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1081,9 +1081,9 @@ WrapNativeParent(JSContext *cx, JS::Handle scope, nsISupports *native JS::Rooted obj(cx, nativeWrapperCache->GetWrapper()); if (obj) { #ifdef DEBUG - jsval debugVal; + JS::Rooted debugVal(cx); nsresult rv = WrapNative(cx, scope, native, nativeWrapperCache, false, - &debugVal); + debugVal.address()); NS_ASSERTION(NS_SUCCEEDED(rv) && JSVAL_TO_OBJECT(debugVal) == obj, "Unexpected object in nsWrapperCache"); #endif @@ -2534,8 +2534,8 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto) } #ifdef DEBUG - JSObject *proto2; - JS_GetPrototype(cx, proto, &proto2); + JS::Rooted proto2(cx); + JS_GetPrototype(cx, proto, proto2.address()); NS_ASSERTION(proto2 && JS_GetClass(proto2) == sObjectClass, "Hmm, somebody did something evil?"); #endif @@ -3002,7 +3002,7 @@ nsWindowSH::InstallGlobalScopePolluter(JSContext *cx, JS::Handle obj) struct ResolveGlobalNameClosure { JSContext* cx; - JSObject* obj; + JS::Handle obj; bool* retval; }; @@ -3011,10 +3011,10 @@ ResolveGlobalName(const nsAString& aName, void* aClosure) { ResolveGlobalNameClosure* closure = static_cast(aClosure); - JS::Value dummy; + JS::Rooted dummy(closure->cx); bool ok = JS_LookupUCProperty(closure->cx, closure->obj, aName.BeginReading(), aName.Length(), - &dummy); + dummy.address()); if (!ok) { *closure->retval = false; return PL_DHASH_STOP; @@ -3152,8 +3152,9 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner, rooter.changeLength(i + 1); } - JS::Value frval; - bool ret = JS_CallFunctionValue(cx, thisObject, funval, argc, argv, &frval); + JS::Rooted frval(cx); + bool ret = JS_CallFunctionValue(cx, thisObject, funval, argc, argv, + frval.address()); if (!ret) { return NS_ERROR_FAILURE; @@ -4813,10 +4814,10 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, } if (proto) { JS::Rooted pobj(cx); - jsval val; + JS::Rooted val(cx); if (!::JS_LookupPropertyWithFlagsById(cx, proto, id, flags, - pobj.address(), &val)) { + pobj.address(), val.address())) { *_retval = JS_FALSE; return NS_OK; diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index ed6f29cd6d4..6ee5eb55fe5 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/layers/CompositorParent.h" +#include "mozilla/layers/PLayerTransactionChild.h" #include "nsIDocShell.h" #include "nsPresContext.h" #include "nsDOMClassInfoID.h" @@ -75,6 +76,9 @@ #include "nsIScriptError.h" #include "nsIAppShell.h" #include "nsWidgetsCID.h" +#include "FrameLayerBuilder.h" +#include "nsDisplayList.h" +#include "nsROCSSPrimitiveValue.h" #ifdef XP_WIN #undef GetClassName @@ -3364,3 +3368,58 @@ nsDOMWindowUtils::RunBeforeNextEvent(nsIRunnable *runnable) return appShell->RunBeforeNextEvent(runnable); } +NS_IMETHODIMP +nsDOMWindowUtils::GetOMTAOrComputedStyle(nsIDOMNode* aNode, + const nsAString& aProperty, + nsAString& aResult) +{ + aResult.Truncate(); + ErrorResult rv; + nsCOMPtr element = do_QueryInterface(aNode); + if (!element) { + return NS_ERROR_INVALID_ARG; + } + + nsRefPtr cssValue = nullptr; + nsIFrame* frame = element->GetPrimaryFrame(); + if (frame) { + if (aProperty.EqualsLiteral("opacity")) { + Layer* layer = FrameLayerBuilder::GetDedicatedLayer(frame, nsDisplayItem::TYPE_OPACITY); + if (layer) { + float value; + ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder(); + if (forwarder) { + forwarder->GetShadowManager()->SendGetOpacity(layer->AsShadowableLayer()->GetShadow(), &value); + cssValue = new nsROCSSPrimitiveValue; + cssValue->SetNumber(value); + } + } + } else if (aProperty.EqualsLiteral("transform")) { + Layer* layer = FrameLayerBuilder::GetDedicatedLayer(frame, nsDisplayItem::TYPE_TRANSFORM); + if (layer) { + gfx3DMatrix matrix; + ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder(); + if (forwarder) { + forwarder->GetShadowManager()->SendGetTransform(layer->AsShadowableLayer()->GetShadow(), &matrix); + cssValue = nsComputedDOMStyle::MatrixToCSSValue(matrix); + } + } + } + } + + if (cssValue) { + nsString text; + cssValue->GetCssText(text, rv); + aResult.Assign(text); + return rv.ErrorCode(); + } + + nsCOMPtr elem = do_QueryInterface(element); + nsCOMPtr style; + nsresult res = element->GetCurrentDoc()->GetWindow()-> + GetComputedStyle(elem, aProperty, getter_AddRefs(style)); + NS_ENSURE_SUCCESS(res, res); + + return style->GetPropertyValue(aProperty, aResult); +} + diff --git a/dom/base/nsIScriptContext.h b/dom/base/nsIScriptContext.h index 2de1386c838..279d1a76869 100644 --- a/dom/base/nsIScriptContext.h +++ b/dom/base/nsIScriptContext.h @@ -186,7 +186,7 @@ public: virtual void ScriptEvaluated(bool aTerminated) = 0; virtual nsresult Serialize(nsIObjectOutputStream* aStream, - JSScript* aScriptObject) = 0; + JS::Handle aScriptObject) = 0; /* Deserialize a script from a stream. */ diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 784be19a1aa..945637557c8 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1395,8 +1395,8 @@ nsJSContext::ExecuteScript(JSScript* aScriptObject_, // The result of evaluation, used only if there were no errors. This need // not be a GC root currently, provided we run the GC only from the // operation callback or from ScriptEvaluated. - JS::Value val; - if (!JS_ExecuteScript(mContext, aScopeObject, aScriptObject, &val)) { + JS::Rooted val(mContext); + if (!JS_ExecuteScript(mContext, aScopeObject, aScriptObject, val.address())) { ReportPendingException(); } --mExecuteDepth; @@ -1517,7 +1517,8 @@ nsJSContext::BindCompiledEventHandler(nsISupports* aTarget, // serialization nsresult -nsJSContext::Serialize(nsIObjectOutputStream* aStream, JSScript* aScriptObject) +nsJSContext::Serialize(nsIObjectOutputStream* aStream, + JS::Handle aScriptObject) { if (!aScriptObject) return NS_ERROR_FAILURE; diff --git a/dom/base/nsJSEnvironment.h b/dom/base/nsJSEnvironment.h index b5da238b07d..d4679b9af63 100644 --- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -90,7 +90,8 @@ public: virtual void WillInitializeContext(); virtual void DidInitializeContext(); - virtual nsresult Serialize(nsIObjectOutputStream* aStream, JSScript* aScriptObject); + virtual nsresult Serialize(nsIObjectOutputStream* aStream, + JS::Handle aScriptObject); virtual nsresult Deserialize(nsIObjectInputStream* aStream, JS::MutableHandle aResult); diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index a0dc4b68c53..21c65a81d57 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -698,7 +698,7 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp) } nsIJSID* iid; - xpc_qsSelfRef iidRef; + SelfRef iidRef; if (NS_FAILED(xpc_qsUnwrapArg(cx, argv[0], &iid, &iidRef.ptr, &argv[0]))) { return Throw(cx, NS_ERROR_XPC_BAD_CONVERT_JS); @@ -1322,7 +1322,7 @@ MainThreadDictionaryBase::ParseJSON(JSContext *aCx, } return JS_ParseJSON(aCx, static_cast(PromiseFlatString(aJSON).get()), - aJSON.Length(), aVal.address()); + aJSON.Length(), aVal); } static JSString* @@ -1635,14 +1635,13 @@ GlobalObject::GlobalObject(JSContext* aCx, JSObject* aObject) return; } - JS::Value val; - val.setObject(*mGlobalJSObject); + JS::Rooted val(aCx, JS::ObjectValue(*mGlobalJSObject)); // Switch this to UnwrapDOMObjectToISupports once our global objects are // using new bindings. nsresult rv = xpc_qsUnwrapArg(aCx, val, &mGlobalObject, static_cast(getter_AddRefs(mGlobalObjectRef)), - &val); + val.address()); if (NS_FAILED(rv)) { mGlobalObject = nullptr; Throw(aCx, NS_ERROR_XPC_BAD_CONVERT_JS); @@ -1732,6 +1731,17 @@ ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle obj) return true; } +bool +RegisterForDeferredFinalization(DeferredFinalizeStartFunction start, + DeferredFinalizeFunction run) +{ + XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance(); + NS_ENSURE_TRUE(rt, false); + + rt->RegisterDeferredFinalize(start, run); + return true; +} + // Date implementation methods Date::Date() : mMsecSinceEpoch(UnspecifiedNaN()) diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 511c2ee605f..8ee7cee3a42 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -27,9 +27,36 @@ class nsPIDOMWindow; +extern nsresult +xpc_qsUnwrapArgImpl(JSContext* cx, jsval v, const nsIID& iid, void** ppArg, + nsISupports** ppArgRef, jsval* vp); + namespace mozilla { namespace dom { +struct SelfRef +{ + SelfRef() : ptr(nullptr) {} + explicit SelfRef(nsISupports *p) : ptr(p) {} + ~SelfRef() { NS_IF_RELEASE(ptr); } + + nsISupports* ptr; +}; + +/** Convert a jsval to an XPCOM pointer. */ +template +inline nsresult +UnwrapArg(JSContext* cx, jsval v, Interface** ppArg, + StrongRefType** ppArgRef, jsval* vp) +{ + nsISupports* argRef = *ppArgRef; + nsresult rv = xpc_qsUnwrapArgImpl(cx, v, NS_GET_TEMPLATE_IID(Interface), + reinterpret_cast(ppArg), &argRef, + vp); + *ppArgRef = static_cast(argRef); + return rv; +} + bool ThrowErrorMessage(JSContext* aCx, const ErrNum aErrorNumber, ...); @@ -2001,6 +2028,10 @@ bool GetWindowForJSImplementedObject(JSContext* cx, JS::Handle obj, nsPIDOMWindow** window); +bool +RegisterForDeferredFinalization(DeferredFinalizeStartFunction start, + DeferredFinalizeFunction run); + } // namespace dom } // namespace mozilla diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 89aae18b085..45d2777c4eb 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -403,6 +403,8 @@ DOMInterfaces = { 'HTMLCollection': { 'nativeType': 'nsIHTMLCollection', + # nsContentList.h pulls in nsIHTMLCollection.h + 'headerFile': 'nsContentList.h', 'resultNotAddRefed': [ 'item' ] }, diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index c725a0bd3d4..4acdb938c9b 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1006,23 +1006,17 @@ def finalizeHook(descriptor, hookName, context): if descriptor.workers: finalize += "self->Release();" elif descriptor.nativeOwnership == 'nsisupports': - finalize += """XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance(); -if (rt) { - rt->DeferredRelease(reinterpret_cast(self)); -} else { - NS_RELEASE(self); -}""" + finalize += "xpc::DeferredRelease(reinterpret_cast(self));" else: smartPtr = DeferredFinalizeSmartPtr(descriptor) finalize += """static bool registered = false; if (!registered) { - XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance(); - if (!rt) { + if (!RegisterForDeferredFinalization(GetDeferredFinalizePointers, + DeferredFinalize)) { %(smartPtr)s dying; Take(dying, self); return; } - rt->RegisterDeferredFinalize(GetDeferredFinalizePointers, DeferredFinalize); registered = true; } if (!sDeferredFinalizePointers) { @@ -2312,9 +2306,9 @@ class CastableObjectUnwrapper(): # not. self.substitution["codeOnFailure"] = CGIndenter(CGGeneric(string.Template( "${type} *objPtr;\n" - "xpc_qsSelfRef objRef;\n" + "SelfRef objRef;\n" "JS::Rooted val(cx, JS::ObjectValue(*${source}));\n" - "nsresult rv = xpc_qsUnwrapArg<${type}>(cx, val, &objPtr, &objRef.ptr, val.address());\n" + "nsresult rv = UnwrapArg<${type}>(cx, val, &objPtr, &objRef.ptr, val.address());\n" "if (NS_FAILED(rv)) {\n" "${codeOnFailure}\n" "}\n" @@ -3115,7 +3109,7 @@ for (uint32_t i = 0; i < length; ++i) { templateBody += ( "JS::Rooted tmpVal(cx, ${val});\n" + typePtr + " tmp;\n" - "if (NS_FAILED(xpc_qsUnwrapArg<" + typeName + ">(cx, ${val}, &tmp, static_cast<" + typeName + "**>(getter_AddRefs(${holderName})), tmpVal.address()))) {\n") + "if (NS_FAILED(UnwrapArg<" + typeName + ">(cx, ${val}, &tmp, static_cast<" + typeName + "**>(getter_AddRefs(${holderName})), tmpVal.address()))) {\n") templateBody += CGIndenter(onFailureBadType(failureCode, descriptor.interface.identifier.name)).define() templateBody += ("}\n" @@ -3524,7 +3518,7 @@ for (uint32_t i = 0; i < length; ++i) { template = ( "if (%s) {\n" " ${declName}.SetNull();\n" - "} else if (!ValueToPrimitive<%s, %s>(cx, ${val}, &%s)) {\n" + "} else if (!ValueToPrimitive<%s, %s>(cx, ${valHandle}, &%s)) {\n" "%s\n" "}" % (nullCondition, typeName, conversionBehavior, writeLoc, exceptionCodeIndented.define())) @@ -3534,7 +3528,7 @@ for (uint32_t i = 0; i < length; ++i) { writeLoc = "${declName}" readLoc = writeLoc template = ( - "if (!ValueToPrimitive<%s, %s>(cx, ${val}, &%s)) {\n" + "if (!ValueToPrimitive<%s, %s>(cx, ${valHandle}, &%s)) {\n" "%s\n" "}" % (typeName, conversionBehavior, writeLoc, exceptionCodeIndented.define())) @@ -5377,9 +5371,9 @@ class CGStaticSetter(CGAbstractStaticBindingMethod): nativeName = CGSpecializedSetter.makeNativeName(self.descriptor, self.attr) argv = CGGeneric("""JS::Value* argv = JS_ARGV(cx, vp); -JS::Value undef = JS::UndefinedValue(); +JS::Rooted undef(cx, JS::UndefinedValue()); if (argc == 0) { - argv = &undef; + argv = undef.address(); }""") call = CGSetterCall(self.attr.type, nativeName, self.descriptor, self.attr) @@ -8213,6 +8207,8 @@ class CGBindingRoot(CGThing): def descriptorHasChromeOnlyMembers(desc): return any(isChromeOnly(a) for a in desc.interface.members) hasChromeOnlyMembers = any(descriptorHasChromeOnlyMembers(d) for d in descriptors) + # XXXkhuey ugly hack but this is going away soon. + isEventTarget = webIDLFile.endswith("EventTarget.webidl") hasWorkerStuff = len(config.getDescriptors(webIDLFile=webIDLFile, workers=True)) != 0 mainDictionaries = config.getDictionaries(webIDLFile=webIDLFile, @@ -8317,10 +8313,7 @@ class CGBindingRoot(CGThing): ['mozilla/dom/BindingUtils.h', 'mozilla/dom/Nullable.h', 'PrimitiveConversions.h', - 'XPCQuickStubs.h', - 'XPCWrapper.h', 'WrapperFactory.h', - 'nsDOMQS.h', # Have to include nsDOMQS.h to get fast arg unwrapping # for old-binding things with castability. 'nsDOMQS.h' @@ -8330,7 +8323,8 @@ class CGBindingRoot(CGThing): + (['mozilla/dom/NonRefcountedDOMObject.h'] if hasOwnedDescriptors else []) + (['nsContentUtils.h'] if requiresContentUtils else []) + (['nsCxPusher.h'] if requiresContentUtils else []) - + (['AccessCheck.h'] if hasChromeOnlyMembers else []), + + (['AccessCheck.h'] if hasChromeOnlyMembers else []) + + (['xpcprivate.h'] if isEventTarget else []), curr, config, jsImplemented) diff --git a/dom/bindings/PrimitiveConversions.h b/dom/bindings/PrimitiveConversions.h index 3104b5b96db..9ce36d0d1da 100644 --- a/dom/bindings/PrimitiveConversions.h +++ b/dom/bindings/PrimitiveConversions.h @@ -91,7 +91,8 @@ struct DisallowedConversion { typedef int intermediateType; private: - static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) { + static inline bool converter(JSContext* cx, JS::Handle v, + jstype* retval) { MOZ_NOT_REACHED("This should never be instantiated!"); return false; } @@ -128,7 +129,8 @@ struct PrimitiveConversionTraits_smallInt { // corresponding unsigned type. typedef int32_t jstype; typedef int32_t intermediateType; - static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) { + static inline bool converter(JSContext* cx, JS::Handle v, + jstype* retval) { return JS::ToInt32(cx, v, retval); } }; @@ -157,7 +159,8 @@ template<> struct PrimitiveConversionTraits { typedef int64_t jstype; typedef int64_t intermediateType; - static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) { + static inline bool converter(JSContext* cx, JS::Handle v, + jstype* retval) { return JS::ToInt64(cx, v, retval); } }; @@ -166,7 +169,8 @@ template<> struct PrimitiveConversionTraits { typedef uint64_t jstype; typedef uint64_t intermediateType; - static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) { + static inline bool converter(JSContext* cx, JS::Handle v, + jstype* retval) { return JS::ToUint64(cx, v, retval); } }; @@ -206,7 +210,8 @@ struct PrimitiveConversionTraits_ToCheckedIntHelper { typedef T jstype; typedef T intermediateType; - static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) { + static inline bool converter(JSContext* cx, JS::Handle v, + jstype* retval) { double intermediate; if (!JS::ToNumber(cx, v, &intermediate)) { return false; @@ -303,7 +308,8 @@ template<> struct PrimitiveConversionTraits { typedef JSBool jstype; typedef bool intermediateType; - static inline bool converter(JSContext* /* unused */, JS::Value v, jstype* retval) { + static inline bool converter(JSContext* /* unused */, JS::Handle v, + jstype* retval) { *retval = JS::ToBoolean(v); return true; } @@ -319,7 +325,8 @@ struct PrimitiveConversionTraits : public DisallowedConversion v, + jstype* retval) { return JS::ToNumber(cx, v, retval); } }; @@ -333,7 +340,7 @@ struct PrimitiveConversionTraits : PrimitiveConversionTraits_f template -bool ValueToPrimitive(JSContext* cx, JS::Value v, T* retval) +bool ValueToPrimitive(JSContext* cx, JS::Handle v, T* retval) { typename PrimitiveConversionTraits::jstype t; if (!PrimitiveConversionTraits::converter(cx, v, &t)) diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index 2ae70796010..dfac773e1b3 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -538,7 +538,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) return NS_OK; } - JS::Value val; + JS::Rooted val(cx); if (!JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val)) { return JS_ReportPendingException(cx) ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } diff --git a/dom/bluetooth/BluetoothOppManager.cpp b/dom/bluetooth/BluetoothOppManager.cpp index dc2dcc23fc5..6bd237b697d 100644 --- a/dom/bluetooth/BluetoothOppManager.cpp +++ b/dom/bluetooth/BluetoothOppManager.cpp @@ -461,6 +461,7 @@ BluetoothOppManager::AfterOppDisconnected() mConnected = false; mLastCommand = 0; mPacketLeftLength = 0; + mDsFile = nullptr; ClearQueue(); @@ -494,6 +495,7 @@ BluetoothOppManager::DeleteReceivedFile() if (mDsFile && mDsFile->mFile) { mDsFile->mFile->Remove(false); + mDsFile = nullptr; } } diff --git a/dom/bluetooth/BluetoothService.cpp b/dom/bluetooth/BluetoothService.cpp index ce79f47c4b8..64bc3284a64 100644 --- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -555,7 +555,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData) return NS_OK; } - JS::Value val; + JS::Rooted val(cx); if (!JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val)) { return JS_ReportPendingException(cx) ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } diff --git a/dom/browser-element/BrowserElementParent.h b/dom/browser-element/BrowserElementParent.h index 8e50a127bd0..61e26dc2d7e 100644 --- a/dom/browser-element/BrowserElementParent.h +++ b/dom/browser-element/BrowserElementParent.h @@ -6,6 +6,8 @@ #define mozilla_BrowserElementHelpers_h #include "nsAString.h" +#include "mozilla/gfx/Point.h" +#include "mozilla/gfx/Rect.h" class nsIDOMWindow; class nsIURI; @@ -16,11 +18,6 @@ namespace dom { class TabParent; } -namespace gfx{ -struct Rect; -struct Size; -} - /** * BrowserElementParent implements a portion of the parent-process side of * diff --git a/layout/reftests/svg/text/multiple-x-percentages-2.html b/layout/reftests/svg/text/multiple-x-percentages-2.html new file mode 100644 index 00000000000..707d1237826 --- /dev/null +++ b/layout/reftests/svg/text/multiple-x-percentages-2.html @@ -0,0 +1,18 @@ + + + + + diff --git a/layout/reftests/svg/text/multiple-x-percentages-3-iframe-ref.svg b/layout/reftests/svg/text/multiple-x-percentages-3-iframe-ref.svg new file mode 100644 index 00000000000..0e148f42570 --- /dev/null +++ b/layout/reftests/svg/text/multiple-x-percentages-3-iframe-ref.svg @@ -0,0 +1,8 @@ + + + hello! + there! + diff --git a/layout/reftests/svg/text/multiple-x-percentages-3-iframe.svg b/layout/reftests/svg/text/multiple-x-percentages-3-iframe.svg new file mode 100644 index 00000000000..a8d7e937c3a --- /dev/null +++ b/layout/reftests/svg/text/multiple-x-percentages-3-iframe.svg @@ -0,0 +1,8 @@ + + + hello + there + diff --git a/layout/reftests/svg/text/multiple-x-percentages-3-ref.html b/layout/reftests/svg/text/multiple-x-percentages-3-ref.html new file mode 100644 index 00000000000..fdf7ad890f3 --- /dev/null +++ b/layout/reftests/svg/text/multiple-x-percentages-3-ref.html @@ -0,0 +1,6 @@ + + + diff --git a/layout/reftests/svg/text/multiple-x-percentages-3.html b/layout/reftests/svg/text/multiple-x-percentages-3.html new file mode 100644 index 00000000000..3f7c6091acd --- /dev/null +++ b/layout/reftests/svg/text/multiple-x-percentages-3.html @@ -0,0 +1,30 @@ + + + + + diff --git a/layout/reftests/svg/text/multiple-x-percentages-ref.svg b/layout/reftests/svg/text/multiple-x-percentages-ref.svg new file mode 100644 index 00000000000..78f6ab92239 --- /dev/null +++ b/layout/reftests/svg/text/multiple-x-percentages-ref.svg @@ -0,0 +1,8 @@ + + + hello + there + diff --git a/layout/reftests/svg/text/multiple-x-percentages.svg b/layout/reftests/svg/text/multiple-x-percentages.svg new file mode 100644 index 00000000000..faf7a64ced6 --- /dev/null +++ b/layout/reftests/svg/text/multiple-x-percentages.svg @@ -0,0 +1,15 @@ + + + hello + there + + diff --git a/layout/reftests/svg/text/reftest.list b/layout/reftests/svg/text/reftest.list index ad1c34aa599..48038ef3308 100644 --- a/layout/reftests/svg/text/reftest.list +++ b/layout/reftests/svg/text/reftest.list @@ -73,6 +73,10 @@ HTTP(../..) == simple-transform-rotate.svg simple-transform-rotate-ref.svg == multiple-x-multiple-dx-anchor-end-rtl.svg multiple-x-multiple-dx-anchor-end-rtl-ref.svg == multiple-x-multiple-dx-anchor-end.svg multiple-x-multiple-dx-anchor-end-ref.svg +== multiple-x-percentages.svg multiple-x-percentages-ref.svg +== multiple-x-percentages-2.html multiple-x-percentages-2-ref.html +== multiple-x-percentages-3.html multiple-x-percentages-3-ref.html + == multiple-x-white-space.svg multiple-x-white-space-ref.svg == multiple-chunks-bidi.svg multiple-chunks-bidi-ref.svg diff --git a/layout/reftests/text/auto-hyphenation-xmllang-1.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-1.xhtml new file mode 100644 index 00000000000..e075a015096 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-1.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-10.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-10.xhtml new file mode 100644 index 00000000000..456d894739f --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-10.xhtml @@ -0,0 +1,12 @@ + + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-11a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-11a.xhtml new file mode 100644 index 00000000000..01c3e1ca828 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-11a.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-11b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-11b.xhtml new file mode 100644 index 00000000000..97c6ff9b0bb --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-11b.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-12a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-12a.xhtml new file mode 100644 index 00000000000..2751dd93f2e --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-12a.xhtml @@ -0,0 +1,12 @@ + + +Hyphenation test + + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-12b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-12b.xhtml new file mode 100644 index 00000000000..c6b62249fc1 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-12b.xhtml @@ -0,0 +1,12 @@ + + +Hyphenation test + + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-13a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-13a.xhtml new file mode 100644 index 00000000000..ee75d43158d --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-13a.xhtml @@ -0,0 +1,13 @@ + + +Hyphenation test + + +
+
+supercalifragilisticexpialidocious +
+
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-13b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-13b.xhtml new file mode 100644 index 00000000000..b90cfae8db9 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-13b.xhtml @@ -0,0 +1,13 @@ + + +Hyphenation test + + +
+
+supercalifragilisticexpialidocious +
+
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-14a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-14a.xhtml new file mode 100644 index 00000000000..e6aa85573fd --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-14a.xhtml @@ -0,0 +1,14 @@ + + +Hyphenation test + + + +
+
+supercalifragilisticexpialidocious +
+
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-14b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-14b.xhtml new file mode 100644 index 00000000000..4811a34f9d0 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-14b.xhtml @@ -0,0 +1,14 @@ + + +Hyphenation test + + + +
+
+supercalifragilisticexpialidocious +
+
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-1a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-1a.xhtml new file mode 100644 index 00000000000..a5761a11c0b --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-1a.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-2.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-2.xhtml new file mode 100644 index 00000000000..47fe750ed53 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-2.xhtml @@ -0,0 +1,13 @@ + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +supercalifragilisticexpialidocious +supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-3.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-3.xhtml new file mode 100644 index 00000000000..ff4b3667df7 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-3.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+su­per­cal­ifrag­ilis­tic­ex­pi­ali­do­cious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-4.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-4.xhtml new file mode 100644 index 00000000000..cde29e6e655 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-4.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-5.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-5.xhtml new file mode 100644 index 00000000000..ec0495b891e --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-5.xhtml @@ -0,0 +1,28 @@ + + + + + + + +
+photo +
+
+photograph +
+
+photographer +
+
+photographical +
+ + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-6.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-6.xhtml new file mode 100644 index 00000000000..f5637ea7689 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-6.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+hyphenation +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-7.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-7.xhtml new file mode 100644 index 00000000000..c621c7984e0 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-7.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+hyphenation +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-8.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-8.xhtml new file mode 100644 index 00000000000..17b26c5b5cf --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-8.xhtml @@ -0,0 +1,11 @@ + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/auto-hyphenation-xmllang-9.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-9.xhtml new file mode 100644 index 00000000000..c0367bea366 --- /dev/null +++ b/layout/reftests/text/auto-hyphenation-xmllang-9.xhtml @@ -0,0 +1,12 @@ + + + +Hyphenation test + + +
+supercalifragilisticexpialidocious +
+ + + diff --git a/layout/reftests/text/reftest.list b/layout/reftests/text/reftest.list index cca53a6e015..cdc52ed8da8 100644 --- a/layout/reftests/text/reftest.list +++ b/layout/reftests/text/reftest.list @@ -219,6 +219,26 @@ pref(gfx.font_rendering.graphite.enabled,true) HTTP(..) == glyph-decomposition-g == auto-hyphenation-8.html auto-hyphenation-8-ref.html == auto-hyphenation-9.html auto-hyphenation-9-ref.html == auto-hyphenation-10.html auto-hyphenation-10-ref.html +== auto-hyphenation-xmllang-1.xhtml auto-hyphenation-1-ref.html +!= auto-hyphenation-xmllang-1.xhtml auto-hyphenation-1-notref.html +== auto-hyphenation-xmllang-1a.xhtml auto-hyphenation-1-ref.html +== auto-hyphenation-xmllang-2.xhtml auto-hyphenation-2-ref.html +== auto-hyphenation-xmllang-3.xhtml auto-hyphenation-3-ref.html +== auto-hyphenation-xmllang-4.xhtml auto-hyphenation-4-ref.html +== auto-hyphenation-xmllang-5.xhtml auto-hyphenation-5-ref.html +== auto-hyphenation-xmllang-6.xhtml auto-hyphenation-6-ref.html +== auto-hyphenation-xmllang-7.xhtml auto-hyphenation-7-ref.html +== auto-hyphenation-xmllang-8.xhtml auto-hyphenation-8-ref.html +== auto-hyphenation-xmllang-9.xhtml auto-hyphenation-9-ref.html +== auto-hyphenation-xmllang-10.xhtml auto-hyphenation-10-ref.html +== auto-hyphenation-xmllang-11a.xhtml auto-hyphenation-1-ref.html +== auto-hyphenation-xmllang-11b.xhtml auto-hyphenation-1-ref.html +== auto-hyphenation-xmllang-12a.xhtml auto-hyphenation-4-ref.html +== auto-hyphenation-xmllang-12b.xhtml auto-hyphenation-4-ref.html +== auto-hyphenation-xmllang-13a.xhtml auto-hyphenation-1-ref.html +== auto-hyphenation-xmllang-13b.xhtml auto-hyphenation-1-ref.html +== auto-hyphenation-xmllang-14a.xhtml auto-hyphenation-4-ref.html +== auto-hyphenation-xmllang-14b.xhtml auto-hyphenation-4-ref.html == auto-hyphenation-af-1.html auto-hyphenation-af-1-ref.html == auto-hyphenation-bg-1.html auto-hyphenation-bg-1-ref.html == auto-hyphenation-ca-1.html auto-hyphenation-ca-1-ref.html diff --git a/layout/style/html.css b/layout/style/html.css index 9775ebaf084..063c6fac435 100644 --- a/layout/style/html.css +++ b/layout/style/html.css @@ -726,14 +726,14 @@ audio:not([controls]) { -moz-transform: translate(0) !important; } -video > div { +video > .caption-box { text-align: center; font-weight: bold; font-size: 24px; pointer-events: none; } -video > div p { +video > div .caption-text { color: gold; background-color: rgba(105,105,105,0.4); pointer-events: auto; diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 92f5b674b39..3ffd9375abf 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -9005,19 +9005,16 @@ CSSParserImpl::ParseOneFamily(nsAString& aFamily, bool& aOneKeyword) if (eCSSToken_Ident == tk->mType) { aOneKeyword = false; + // We had at least another keyword before. + // "If a sequence of identifiers is given as a font family name, + // the computed value is the name converted to a string by joining + // all the identifiers in the sequence by single spaces." + // -- CSS 2.1, section 15.3 + // Whitespace tokens do not actually matter, + // identifier tokens can be separated by comments. + aFamily.Append(PRUnichar(' ')); aFamily.Append(tk->mIdent); - } else if (eCSSToken_Whitespace == tk->mType) { - // Lookahead one token and drop whitespace if we are ending the - // font name. - if (!GetToken(true)) - break; - - UngetToken(); - if (eCSSToken_Ident == tk->mType) - aFamily.Append(PRUnichar(' ')); - else - break; - } else { + } else if (eCSSToken_Whitespace != tk->mType) { UngetToken(); break; } diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index b3e87294a08..883f2f7768c 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -330,7 +330,7 @@ public: return mFeatureValues; } - virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; + virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE; static bool PrefEnabled() { @@ -373,8 +373,8 @@ public: NS_DECL_NSIDOMCSSRULE // nsIDOMCSSCharsetRule methods - NS_IMETHOD GetEncoding(nsAString& aEncoding); - NS_IMETHOD SetEncoding(const nsAString& aEncoding); + NS_IMETHOD GetEncoding(nsAString& aEncoding) MOZ_OVERRIDE; + NS_IMETHOD SetEncoding(const nsAString& aEncoding) MOZ_OVERRIDE; virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; @@ -501,7 +501,7 @@ public: // rest of GroupRule virtual bool UseForPresentation(nsPresContext* aPresContext, - nsMediaQueryResultCacheKey& aKey); + nsMediaQueryResultCacheKey& aKey) MOZ_OVERRIDE; const nsString& GetName() { return mName; } diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 095279530e3..2633ec6b4d1 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1099,7 +1099,7 @@ nsComputedDOMStyle::DoGetTransform() return MatrixToCSSValue(matrix); } -/* static */ CSSValue* +/* static */ nsROCSSPrimitiveValue* nsComputedDOMStyle::MatrixToCSSValue(gfx3DMatrix& matrix) { bool is3D = !matrix.Is2D(); diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 8dfefd772b3..e2ae1876746 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -93,7 +93,7 @@ public: virtual nsIDocument* DocToUpdate() MOZ_OVERRIDE; virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) MOZ_OVERRIDE; - static mozilla::dom::CSSValue* MatrixToCSSValue(gfx3DMatrix& aMatrix); + static nsROCSSPrimitiveValue* MatrixToCSSValue(gfx3DMatrix& aMatrix); private: void AssertFlushedPendingReflows() { diff --git a/layout/style/nsDOMCSSDeclaration.h b/layout/style/nsDOMCSSDeclaration.h index 9357a7d1448..63940880439 100644 --- a/layout/style/nsDOMCSSDeclaration.h +++ b/layout/style/nsDOMCSSDeclaration.h @@ -29,13 +29,13 @@ class nsDOMCSSDeclaration : public nsICSSDeclaration public: // Only implement QueryInterface; subclasses have the responsibility // of implementing AddRef/Release. - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE; // Declare addref and release so they can be called on us, but don't // implement them. Our subclasses must handle their own // refcounting. - NS_IMETHOD_(nsrefcnt) AddRef() = 0; - NS_IMETHOD_(nsrefcnt) Release() = 0; + NS_IMETHOD_(nsrefcnt) AddRef() MOZ_OVERRIDE = 0; + NS_IMETHOD_(nsrefcnt) Release() MOZ_OVERRIDE = 0; NS_DECL_NSICSSDECLARATION using nsICSSDeclaration::GetLength; diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index de610795b56..d1ef8c23347 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -32,7 +32,9 @@ #include "nsCSSRuleProcessor.h" #include "mozilla/dom/Element.h" #include "nsCSSFrameConstructor.h" +#include "nsHashKeys.h" +using namespace mozilla; using namespace mozilla::dom; NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::HTMLColorRule, nsIStyleRule) @@ -94,6 +96,31 @@ nsHTMLStyleSheet::TableQuirkColorRule::MapRuleInfoInto(nsRuleData* aRuleData) } } + +NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::LangRule, nsIStyleRule) + +/* virtual */ void +nsHTMLStyleSheet::LangRule::MapRuleInfoInto(nsRuleData* aRuleData) +{ + if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) { + nsCSSValue* lang = aRuleData->ValueForLang(); + if (lang->GetUnit() == eCSSUnit_Null) { + lang->SetStringValue(mLang, eCSSUnit_Ident); + } + } +} + +#ifdef DEBUG +/* virtual */ void +nsHTMLStyleSheet::LangRule::List(FILE* out, int32_t aIndent) const +{ + for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out); + fputs("[lang rule] { language: \"", out); + fputs(NS_ConvertUTF16toUTF8(mLang).get(), out); + fputs("\" }\n", out); +} +#endif + // ----------------------------------------------------------- struct MappedAttrTableEntry : public PLDHashEntryHdr { @@ -138,7 +165,64 @@ static PLDHashTableOps MappedAttrTable_Ops = { PL_DHashMoveEntryStub, MappedAttrTable_ClearEntry, PL_DHashFinalizeStub, - NULL + nullptr +}; + +// ----------------------------------------------------------- + +struct LangRuleTableEntry : public PLDHashEntryHdr { + nsRefPtr mRule; +}; + +static PLDHashNumber +LangRuleTable_HashKey(PLDHashTable *table, const void *key) +{ + const nsString *lang = static_cast(key); + return HashString(*lang); +} + +static void +LangRuleTable_ClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr) +{ + LangRuleTableEntry *entry = static_cast(hdr); + + entry->~LangRuleTableEntry(); + memset(entry, 0, sizeof(LangRuleTableEntry)); +} + +static bool +LangRuleTable_MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, + const void *key) +{ + const nsString *lang = static_cast(key); + const LangRuleTableEntry *entry = static_cast(hdr); + + return entry->mRule->mLang == *lang; +} + +static bool +LangRuleTable_InitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr, + const void *key) +{ + const nsString *lang = static_cast(key); + + LangRuleTableEntry *entry = new (hdr) LangRuleTableEntry(); + + // Create the unique rule for this language + entry->mRule = new nsHTMLStyleSheet::LangRule(*lang); + + return true; +} + +static PLDHashTableOps LangRuleTable_Ops = { + PL_DHashAllocTable, + PL_DHashFreeTable, + LangRuleTable_HashKey, + LangRuleTable_MatchEntry, + PL_DHashMoveEntryStub, + LangRuleTable_ClearEntry, + PL_DHashFinalizeStub, + LangRuleTable_InitEntry }; // ----------------------------------------------------------- @@ -152,10 +236,13 @@ nsHTMLStyleSheet::nsHTMLStyleSheet(nsIURI* aURL, nsIDocument* aDocument) MOZ_ASSERT(aURL); MOZ_ASSERT(aDocument); mMappedAttrTable.ops = nullptr; + mLangRuleTable.ops = nullptr; } nsHTMLStyleSheet::~nsHTMLStyleSheet() { + if (mLangRuleTable.ops) + PL_DHashTableFinish(&mLangRuleTable); if (mMappedAttrTable.ops) PL_DHashTableFinish(&mMappedAttrTable); } @@ -212,6 +299,14 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData) if (!ruleWalker->AuthorStyleDisabled() || aData->mElement->IsSVG()) { aData->mElement->WalkContentStyleRules(ruleWalker); } + + // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#language + // says that the xml:lang attribute overrides HTML's lang attribute, + // so we need to do this after WalkContentStyleRules. + nsString lang; + if (aData->mElement->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang, lang)) { + ruleWalker->Forward(LangRuleFor(lang)); + } } // Test if style is dependent on content state @@ -387,6 +482,10 @@ nsHTMLStyleSheet::Reset(nsIURI* aURL) mVisitedRule = nullptr; mActiveRule = nullptr; + if (mLangRuleTable.ops) { + PL_DHashTableFinish(&mLangRuleTable); + mLangRuleTable.ops = nullptr; + } if (mMappedAttrTable.ops) { PL_DHashTableFinish(&mMappedAttrTable); mMappedAttrTable.ops = nullptr; @@ -474,6 +573,27 @@ nsHTMLStyleSheet::DropMappedAttributes(nsMappedAttributes* aMapped) NS_ASSERTION(entryCount == mMappedAttrTable.entryCount, "not removed"); } +nsIStyleRule* +nsHTMLStyleSheet::LangRuleFor(const nsString& aLanguage) +{ + if (!mLangRuleTable.ops) { + bool res = PL_DHashTableInit(&mLangRuleTable, &LangRuleTable_Ops, + nullptr, sizeof(LangRuleTableEntry), 16); + if (!res) { + NS_ASSERTION(false, "out of memory"); + mLangRuleTable.ops = nullptr; + return nullptr; + } + } + LangRuleTableEntry *entry = static_cast + (PL_DHashTableOperate(&mLangRuleTable, &aLanguage, PL_DHASH_ADD)); + if (!entry) { + NS_ASSERTION(false, "out of memory"); + return nullptr; + } + return entry->mRule; +} + #ifdef DEBUG /* virtual */ void nsHTMLStyleSheet::List(FILE* out, int32_t aIndent) const @@ -522,6 +642,7 @@ nsHTMLStyleSheet::DOMSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const // - mActiveRule // - mTableQuirkColorRule // - mTableTHRule + // - mLangRuleTable // // The following members are not measured: // - mDocument, because it's non-owning diff --git a/layout/style/nsHTMLStyleSheet.h b/layout/style/nsHTMLStyleSheet.h index 6b6dfa29950..c56b4bfa4cf 100644 --- a/layout/style/nsHTMLStyleSheet.h +++ b/layout/style/nsHTMLStyleSheet.h @@ -20,6 +20,7 @@ #include "nsIStyleSheet.h" #include "pldhash.h" #include "mozilla/Attributes.h" +#include "nsString.h" class nsMappedAttributes; @@ -76,6 +77,8 @@ public: UniqueMappedAttributes(nsMappedAttributes* aMapped); void DropMappedAttributes(nsMappedAttributes* aMapped); + nsIStyleRule* LangRuleFor(const nsString& aLanguage); + private: nsHTMLStyleSheet(const nsHTMLStyleSheet& aCopy) MOZ_DELETE; nsHTMLStyleSheet& operator=(const nsHTMLStyleSheet& aCopy) MOZ_DELETE; @@ -136,6 +139,26 @@ private: virtual void MapRuleInfoInto(nsRuleData* aRuleData) MOZ_OVERRIDE; }; +public: // for mLangRuleTable structures only + + // Rule to handle xml:lang attributes, of which we have exactly one + // per language string, maintained in mLangRuleTable. + class LangRule MOZ_FINAL : public nsIStyleRule { + public: + LangRule(const nsSubstring& aLang) : mLang(aLang) {} + + NS_DECL_ISUPPORTS + + // nsIStyleRule interface + virtual void MapRuleInfoInto(nsRuleData* aRuleData) MOZ_OVERRIDE; + #ifdef DEBUG + virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE; + #endif + + nsString mLang; + }; + +private: nsCOMPtr mURL; nsIDocument* mDocument; nsRefPtr mLinkRule; @@ -145,6 +168,7 @@ private: nsRefPtr mTableTHRule; PLDHashTable mMappedAttrTable; + PLDHashTable mLangRuleTable; }; #endif /* !defined(nsHTMLStyleSheet_h_) */ diff --git a/layout/style/nsICSSDeclaration.h b/layout/style/nsICSSDeclaration.h index cf6d66f1aff..48cccec8fc1 100644 --- a/layout/style/nsICSSDeclaration.h +++ b/layout/style/nsICSSDeclaration.h @@ -19,6 +19,7 @@ * consumers should continue to use nsIDOMCSSStyleDeclaration. */ +#include "mozilla/Attributes.h" #include "nsIDOMCSSStyleDeclaration.h" #include "nsCSSProperty.h" #include "CSSValue.h" @@ -61,14 +62,14 @@ public: // Also have to declare all the nsIDOMCSSStyleDeclaration methods, // since we want to be able to call them from the WebIDL versions. - NS_IMETHOD GetCssText(nsAString& aCssText) = 0; - NS_IMETHOD SetCssText(const nsAString& aCssText) = 0; + NS_IMETHOD GetCssText(nsAString& aCssText) MOZ_OVERRIDE = 0; + NS_IMETHOD SetCssText(const nsAString& aCssText) MOZ_OVERRIDE = 0; NS_IMETHOD GetPropertyValue(const nsAString& aPropName, - nsAString& aValue) = 0; + nsAString& aValue) MOZ_OVERRIDE = 0; virtual already_AddRefed GetPropertyCSSValue(const nsAString& aPropertyName, mozilla::ErrorResult& aRv) = 0; - NS_IMETHOD GetPropertyCSSValue(const nsAString& aProp, nsIDOMCSSValue** aVal) + NS_IMETHOD GetPropertyCSSValue(const nsAString& aProp, nsIDOMCSSValue** aVal) MOZ_OVERRIDE { mozilla::ErrorResult error; nsRefPtr val = GetPropertyCSSValue(aProp, error); @@ -81,14 +82,14 @@ public: return NS_OK; } NS_IMETHOD RemoveProperty(const nsAString& aPropertyName, - nsAString& aReturn) = 0; + nsAString& aReturn) MOZ_OVERRIDE = 0; NS_IMETHOD GetPropertyPriority(const nsAString& aPropertyName, - nsAString& aReturn) = 0; + nsAString& aReturn) MOZ_OVERRIDE = 0; NS_IMETHOD SetProperty(const nsAString& aPropertyName, const nsAString& aValue, - const nsAString& aPriority) = 0; - NS_IMETHOD GetLength(uint32_t* aLength) = 0; - NS_IMETHOD Item(uint32_t aIndex, nsAString& aReturn) + const nsAString& aPriority) MOZ_OVERRIDE = 0; + NS_IMETHOD GetLength(uint32_t* aLength) MOZ_OVERRIDE = 0; + NS_IMETHOD Item(uint32_t aIndex, nsAString& aReturn) MOZ_OVERRIDE { bool found; IndexedGetter(aIndex, found, aReturn); @@ -97,7 +98,7 @@ public: } return NS_OK; } - NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) = 0; + NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) MOZ_OVERRIDE = 0; // WebIDL interface for CSSStyleDeclaration void SetCssText(const nsAString& aString, mozilla::ErrorResult& rv) { @@ -127,15 +128,9 @@ public: void GetPropertyPriority(const nsAString& aPropName, nsString& aPriority) { GetPropertyPriority(aPropName, static_cast(aPriority)); } - // XXXbz we should nix the Optional thing once bug 759622 is fixed. void SetProperty(const nsAString& aPropName, const nsAString& aValue, - const mozilla::dom::Optional& aPriority, - mozilla::ErrorResult& rv) { - if (aPriority.WasPassed()) { - rv = SetProperty(aPropName, aValue, aPriority.Value()); - } else { - rv = SetProperty(aPropName, aValue, EmptyString()); - } + const nsAString& aPriority, mozilla::ErrorResult& rv) { + rv = SetProperty(aPropName, aValue, aPriority); } void RemoveProperty(const nsAString& aPropName, nsString& aRetval, mozilla::ErrorResult& rv) { diff --git a/layout/svg/crashtests/877029-1.svg b/layout/svg/crashtests/877029-1.svg new file mode 100644 index 00000000000..1a7bad0f1bd --- /dev/null +++ b/layout/svg/crashtests/877029-1.svg @@ -0,0 +1,10 @@ + + + a + + diff --git a/layout/svg/crashtests/crashtests.list b/layout/svg/crashtests/crashtests.list index ec2a9913f85..e6cd2d856d3 100644 --- a/layout/svg/crashtests/crashtests.list +++ b/layout/svg/crashtests/crashtests.list @@ -163,3 +163,4 @@ load 849688-1.svg load 849688-2.svg load 860378-1.svg load 868904-1.svg +load 877029-1.svg diff --git a/layout/svg/nsSVGClipPathFrame.h b/layout/svg/nsSVGClipPathFrame.h index b52b15221e6..9c0d33a1996 100644 --- a/layout/svg/nsSVGClipPathFrame.h +++ b/layout/svg/nsSVGClipPathFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGCLIPPATHFRAME_H__ #define __NS_SVGCLIPPATHFRAME_H__ +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "nsSVGContainerFrame.h" #include "nsSVGUtils.h" @@ -54,7 +55,7 @@ public: // nsIFrame interface: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; virtual void Init(nsIContent* aContent, nsIFrame* aParent, @@ -65,10 +66,10 @@ public: * * @see nsGkAtoms::svgClipPathFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGClipPath"), aResult); } @@ -100,7 +101,7 @@ public: bool mInUse; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; }; #endif diff --git a/layout/svg/nsSVGEffects.h b/layout/svg/nsSVGEffects.h index afb207601bd..b3aa48020f9 100644 --- a/layout/svg/nsSVGEffects.h +++ b/layout/svg/nsSVGEffects.h @@ -124,7 +124,7 @@ protected: public: SourceReference(nsSVGIDRenderingObserver* aContainer) : mContainer(aContainer) {} protected: - virtual void ElementChanged(Element* aFrom, Element* aTo) { + virtual void ElementChanged(Element* aFrom, Element* aTo) MOZ_OVERRIDE { mContainer->StopListening(); nsReferencedElement::ElementChanged(aFrom, aTo); mContainer->StartListening(); @@ -134,7 +134,7 @@ protected: * Override IsPersistent because we want to keep tracking the element * for the ID even when it changes. */ - virtual bool IsPersistent() { return true; } + virtual bool IsPersistent() MOZ_OVERRIDE { return true; } private: nsSVGIDRenderingObserver* mContainer; }; diff --git a/layout/svg/nsSVGFilterFrame.h b/layout/svg/nsSVGFilterFrame.h index c5b9b03e9a0..3c028a03d04 100644 --- a/layout/svg/nsSVGFilterFrame.h +++ b/layout/svg/nsSVGFilterFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGFILTERFRAME_H__ #define __NS_SVGFILTERFRAME_H__ +#include "mozilla/Attributes.h" #include "nsFrame.h" #include "nsQueryFrame.h" #include "nsRect.h" @@ -53,7 +54,7 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; /** * Paint the given filtered frame. @@ -107,7 +108,7 @@ public: * * @see nsGkAtoms::svgFilterFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; private: // Parse our xlink:href and set up our nsSVGPaintingProperty if we diff --git a/layout/svg/nsSVGForeignObjectFrame.h b/layout/svg/nsSVGForeignObjectFrame.h index 04696cfd22b..148367f2664 100644 --- a/layout/svg/nsSVGForeignObjectFrame.h +++ b/layout/svg/nsSVGForeignObjectFrame.h @@ -34,19 +34,19 @@ public: virtual void Init(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aPrevInFlow) MOZ_OVERRIDE; - virtual void DestroyFrom(nsIFrame* aDestructRoot); + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; - virtual nsIFrame* GetContentInsertionFrame() { + virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE { return GetFirstPrincipalChild()->GetContentInsertionFrame(); } NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus); + nsReflowStatus& aStatus) MOZ_OVERRIDE; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, @@ -57,19 +57,19 @@ public: * * @see nsGkAtoms::svgForeignObjectFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; - virtual bool IsFrameOfType(uint32_t aFlags) const + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE { return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject)); } virtual bool IsSVGTransformed(gfxMatrix *aOwnTransform, - gfxMatrix *aFromParentTransform) const; + gfxMatrix *aFromParentTransform) const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult); } diff --git a/layout/svg/nsSVGGFrame.h b/layout/svg/nsSVGGFrame.h index eabb4310792..6059d63354b 100644 --- a/layout/svg/nsSVGGFrame.h +++ b/layout/svg/nsSVGGFrame.h @@ -6,6 +6,7 @@ #ifndef NSSVGGFRAME_H #define NSSVGGFRAME_H +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "nsSVGContainerFrame.h" @@ -33,10 +34,10 @@ public: * * @see nsGkAtoms::svgGFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGG"), aResult); } @@ -45,13 +46,13 @@ public: // nsIFrame interface: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; // nsISVGChildFrame interface: - virtual void NotifySVGChanged(uint32_t aFlags); + virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; nsAutoPtr mCanvasTM; }; diff --git a/layout/svg/nsSVGGenericContainerFrame.h b/layout/svg/nsSVGGenericContainerFrame.h index 218394f1749..1b6e82d2ca9 100644 --- a/layout/svg/nsSVGGenericContainerFrame.h +++ b/layout/svg/nsSVGGenericContainerFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGGENERICCONTAINERFRAME_H__ #define __NS_SVGGENERICCONTAINERFRAME_H__ +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "nsFrame.h" #include "nsLiteralString.h" @@ -32,23 +33,23 @@ public: // nsIFrame: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; /** * Get the "type" of the frame * * @see nsGkAtoms::svgGenericContainerFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGGenericContainer"), aResult); } #endif // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; }; #endif // __NS_SVGGENERICCONTAINERFRAME_H__ diff --git a/layout/svg/nsSVGGeometryFrame.h b/layout/svg/nsSVGGeometryFrame.h index 587d80d67eb..e6ea647e383 100644 --- a/layout/svg/nsSVGGeometryFrame.h +++ b/layout/svg/nsSVGGeometryFrame.h @@ -7,6 +7,7 @@ #ifndef __NS_SVGGEOMETRYFRAME_H__ #define __NS_SVGGEOMETRYFRAME_H__ +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "gfxTypes.h" #include "nsFrame.h" @@ -46,7 +47,7 @@ public: nsIFrame* aParent, nsIFrame* aPrevInFlow) MOZ_OVERRIDE; - virtual bool IsFrameOfType(uint32_t aFlags) const + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE { return nsSVGGeometryFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry)); } diff --git a/layout/svg/nsSVGGlyphFrame.h b/layout/svg/nsSVGGlyphFrame.h index 9fbd26ba9cd..982d18b29df 100644 --- a/layout/svg/nsSVGGlyphFrame.h +++ b/layout/svg/nsSVGGlyphFrame.h @@ -35,15 +35,15 @@ class SVGIRect; // Slightly horrible callback for deferring application of opacity struct SVGTextObjectPaint : public gfxTextObjectPaint { already_AddRefed GetFillPattern(float aOpacity, - const gfxMatrix& aCTM); + const gfxMatrix& aCTM) MOZ_OVERRIDE; already_AddRefed GetStrokePattern(float aOpacity, - const gfxMatrix& aCTM); + const gfxMatrix& aCTM) MOZ_OVERRIDE; void SetFillOpacity(float aOpacity) { mFillOpacity = aOpacity; } - float GetFillOpacity() { return mFillOpacity; } + float GetFillOpacity() MOZ_OVERRIDE { return mFillOpacity; } void SetStrokeOpacity(float aOpacity) { mStrokeOpacity = aOpacity; } - float GetStrokeOpacity() { return mStrokeOpacity; } + float GetStrokeOpacity() MOZ_OVERRIDE { return mStrokeOpacity; } struct Paint { Paint() { @@ -192,9 +192,9 @@ public: bool IsAllWhitespace() const; // nsIFrame interface: - NS_IMETHOD CharacterDataChanged(CharacterDataChangeInfo* aInfo); + NS_IMETHOD CharacterDataChanged(CharacterDataChangeInfo* aInfo) MOZ_OVERRIDE; - virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext); + virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE; virtual void Init(nsIContent* aContent, nsIFrame* aParent, @@ -205,9 +205,9 @@ public: * * @see nsGkAtoms::svgGlyphFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; - virtual bool IsFrameOfType(uint32_t aFlags) const + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE { // Set the frame state bit for text frames to mark them as replaced. // XXX kipp: temporary @@ -216,7 +216,7 @@ public: } #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGGlyph"), aResult); } @@ -240,7 +240,7 @@ public: NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { return false; } // nsSVGGeometryFrame methods - gfxMatrix GetCanvasTM(uint32_t aFor); + gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; // nsISVGGlyphFragmentNode interface: // These do not use the global transform if NS_STATE_NONDISPLAY_CHILD diff --git a/layout/svg/nsSVGGradientFrame.h b/layout/svg/nsSVGGradientFrame.h index efae068d551..7ada78a5395 100644 --- a/layout/svg/nsSVGGradientFrame.h +++ b/layout/svg/nsSVGGradientFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGGRADIENTFRAME_H__ #define __NS_SVGGRADIENTFRAME_H__ +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "nsCOMPtr.h" #include "nsFrame.h" @@ -50,15 +51,15 @@ public: const gfxMatrix& aContextMatrix, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, float aGraphicOpacity, - const gfxRect *aOverrideBounds); + const gfxRect *aOverrideBounds) MOZ_OVERRIDE; // nsIFrame interface: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGGradient"), aResult); } @@ -142,14 +143,14 @@ public: nsIFrame* aPrevInFlow) MOZ_OVERRIDE; #endif - virtual nsIAtom* GetType() const; // frame type: nsGkAtoms::svgLinearGradientFrame + virtual nsIAtom* GetType() const MOZ_OVERRIDE; // frame type: nsGkAtoms::svgLinearGradientFrame NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGLinearGradient"), aResult); } @@ -158,9 +159,9 @@ public: protected: float GetLengthValue(uint32_t aIndex); virtual mozilla::dom::SVGLinearGradientElement* GetLinearGradientWithLength( - uint32_t aIndex, mozilla::dom::SVGLinearGradientElement* aDefault); - virtual bool GradientVectorLengthIsZero(); - virtual already_AddRefed CreateGradient(); + uint32_t aIndex, mozilla::dom::SVGLinearGradientElement* aDefault) MOZ_OVERRIDE; + virtual bool GradientVectorLengthIsZero() MOZ_OVERRIDE; + virtual already_AddRefed CreateGradient() MOZ_OVERRIDE; }; // ------------------------------------------------------------------------- @@ -187,14 +188,14 @@ public: nsIFrame* aPrevInFlow) MOZ_OVERRIDE; #endif - virtual nsIAtom* GetType() const; // frame type: nsGkAtoms::svgRadialGradientFrame + virtual nsIAtom* GetType() const MOZ_OVERRIDE; // frame type: nsGkAtoms::svgRadialGradientFrame NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGRadialGradient"), aResult); } @@ -206,9 +207,9 @@ protected: float GetLengthValueFromElement(uint32_t aIndex, mozilla::dom::SVGRadialGradientElement& aElement); virtual mozilla::dom::SVGRadialGradientElement* GetRadialGradientWithLength( - uint32_t aIndex, mozilla::dom::SVGRadialGradientElement* aDefault); - virtual bool GradientVectorLengthIsZero(); - virtual already_AddRefed CreateGradient(); + uint32_t aIndex, mozilla::dom::SVGRadialGradientElement* aDefault) MOZ_OVERRIDE; + virtual bool GradientVectorLengthIsZero() MOZ_OVERRIDE; + virtual already_AddRefed CreateGradient() MOZ_OVERRIDE; }; #endif // __NS_SVGGRADIENTFRAME_H__ diff --git a/layout/svg/nsSVGInnerSVGFrame.h b/layout/svg/nsSVGInnerSVGFrame.h index abf3aa321c1..ee69e878742 100644 --- a/layout/svg/nsSVGInnerSVGFrame.h +++ b/layout/svg/nsSVGInnerSVGFrame.h @@ -37,10 +37,10 @@ public: * * @see nsGkAtoms::svgInnerSVGFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGInnerSVG"), aResult); } @@ -48,18 +48,18 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; // nsISVGChildFrame interface: - NS_IMETHOD PaintSVG(nsRenderingContext *aContext, const nsIntRect *aDirtyRect); - virtual void ReflowSVG(); - virtual void NotifySVGChanged(uint32_t aFlags); - NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint); + NS_IMETHOD PaintSVG(nsRenderingContext *aContext, const nsIntRect *aDirtyRect) MOZ_OVERRIDE; + virtual void ReflowSVG() MOZ_OVERRIDE; + virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE; + NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; - virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const; + virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const MOZ_OVERRIDE; // nsISVGSVGFrame interface: virtual void NotifyViewportOrTransformChanged(uint32_t aFlags) MOZ_OVERRIDE; diff --git a/layout/svg/nsSVGMarkerFrame.h b/layout/svg/nsSVGMarkerFrame.h index 614d7ac1633..4f10e30cc14 100644 --- a/layout/svg/nsSVGMarkerFrame.h +++ b/layout/svg/nsSVGMarkerFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGMARKERFRAME_H__ #define __NS_SVGMARKERFRAME_H__ +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "gfxRect.h" #include "nsFrame.h" @@ -62,16 +63,16 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; /** * Get the "type" of the frame * * @see nsGkAtoms::svgMarkerFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGMarker"), aResult); } @@ -95,7 +96,7 @@ private: float mStrokeWidth, mX, mY, mAutoAngle; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; // A helper class to allow us to paint markers safely. The helper // automatically sets and clears the mInUse flag on the marker frame (to diff --git a/layout/svg/nsSVGMaskFrame.h b/layout/svg/nsSVGMaskFrame.h index 53d103b83c0..668626e0562 100644 --- a/layout/svg/nsSVGMaskFrame.h +++ b/layout/svg/nsSVGMaskFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGMASKFRAME_H__ #define __NS_SVGMASKFRAME_H__ +#include "mozilla/Attributes.h" #include "gfxPattern.h" #include "gfxMatrix.h" #include "nsSVGContainerFrame.h" @@ -39,7 +40,7 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; #ifdef DEBUG virtual void Init(nsIContent* aContent, @@ -56,10 +57,10 @@ public: * * @see nsGkAtoms::svgMaskFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGMask"), aResult); } @@ -91,7 +92,7 @@ private: bool mInUse; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; }; #endif diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index 482505ed9e6..b6a188a8caf 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -38,11 +38,11 @@ public: #endif // nsIFrame: - virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext); - virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext); + virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; + virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; - virtual IntrinsicSize GetIntrinsicSize(); - virtual nsSize GetIntrinsicRatio(); + virtual IntrinsicSize GetIntrinsicSize() MOZ_OVERRIDE; + virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE; virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext, nsSize aCBSize, nscoord aAvailableWidth, @@ -52,11 +52,11 @@ public: NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus); + nsReflowStatus& aStatus) MOZ_OVERRIDE; NS_IMETHOD DidReflow(nsPresContext* aPresContext, const nsHTMLReflowState* aReflowState, - nsDidReflowStatus aStatus); + nsDidReflowStatus aStatus) MOZ_OVERRIDE; virtual bool UpdateOverflow() MOZ_OVERRIDE; @@ -68,17 +68,17 @@ public: nsIFrame* aParent, nsIFrame* aPrevInFlow) MOZ_OVERRIDE; - virtual nsSplittableType GetSplittableType() const; + virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE; /** * Get the "type" of the frame * * @see nsGkAtoms::svgOuterSVGFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGOuterSVG"), aResult); } @@ -86,9 +86,9 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; - virtual nsIFrame* GetContentInsertionFrame() { + virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE { // Any children must be added to our single anonymous inner frame kid. NS_ABORT_IF_FALSE(GetFirstPrincipalChild() && GetFirstPrincipalChild()->GetType() == @@ -98,7 +98,7 @@ public: } virtual bool IsSVGTransformed(gfxMatrix *aOwnTransform, - gfxMatrix *aFromParentTransform) const { + gfxMatrix *aFromParentTransform) const MOZ_OVERRIDE { // Our anonymous wrapper performs the transforms. We simply // return whether we are transformed here but don't apply the transforms // themselves. @@ -110,13 +110,13 @@ public: // nsISVGChildFrame methods: NS_IMETHOD PaintSVG(nsRenderingContext* aContext, - const nsIntRect *aDirtyRect); + const nsIntRect *aDirtyRect) MOZ_OVERRIDE; virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, - uint32_t aFlags); + uint32_t aFlags) MOZ_OVERRIDE; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; /* Methods to allow descendant nsSVGForeignObjectFrame frames to register and * unregister themselves with their nearest nsSVGOuterSVGFrame ancestor. This @@ -130,7 +130,7 @@ public: void RegisterForeignObject(nsSVGForeignObjectFrame* aFrame); void UnregisterForeignObject(nsSVGForeignObjectFrame* aFrame); - virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const { + virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const MOZ_OVERRIDE { // Our anonymous wrapper child must claim our children-only transforms as // its own so that our real children (the frames it wraps) are transformed // by them, and we must pretend we don't have any children-only transforms @@ -247,7 +247,7 @@ public: nsIFrame* aParent, nsIFrame* aPrevInFlow) MOZ_OVERRIDE; - NS_IMETHOD GetFrameName(nsAString& aResult) const { + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGOuterSVGAnonChild"), aResult); } #endif @@ -257,17 +257,17 @@ public: * * @see nsGkAtoms::svgOuterSVGAnonChildFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor) { + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE { // GetCanvasTM returns the transform from an SVG frame to the frame's // nsSVGOuterSVGFrame's content box, so we do not include any x/y offset // set on us for any CSS border or padding on our nsSVGOuterSVGFrame. return static_cast(mParent)->GetCanvasTM(aFor); } - virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const; + virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const MOZ_OVERRIDE; }; #endif diff --git a/layout/svg/nsSVGPaintServerFrame.h b/layout/svg/nsSVGPaintServerFrame.h index 01962964d22..67951c7b0be 100644 --- a/layout/svg/nsSVGPaintServerFrame.h +++ b/layout/svg/nsSVGPaintServerFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGPAINTSERVERFRAME_H__ #define __NS_SVGPAINTSERVERFRAME_H__ +#include "mozilla/Attributes.h" #include "nsCOMPtr.h" #include "nsFrame.h" #include "nsIFrame.h" @@ -63,7 +64,7 @@ public: const nsRect& aDirtyRect, const nsDisplayListSet& aLists) MOZ_OVERRIDE {} - virtual bool IsFrameOfType(uint32_t aFlags) const + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE { return nsSVGPaintServerFrameBase::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer); } diff --git a/layout/svg/nsSVGPathGeometryFrame.h b/layout/svg/nsSVGPathGeometryFrame.h index c7618f2b366..ad710a665a7 100644 --- a/layout/svg/nsSVGPathGeometryFrame.h +++ b/layout/svg/nsSVGPathGeometryFrame.h @@ -54,20 +54,20 @@ public: // nsIFrame interface: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; /** * Get the "type" of the frame * * @see nsGkAtoms::svgPathGeometryFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; virtual bool IsSVGTransformed(gfxMatrix *aOwnTransforms = nullptr, - gfxMatrix *aFromParentTransforms = nullptr) const; + gfxMatrix *aFromParentTransforms = nullptr) const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult); } @@ -78,7 +78,7 @@ public: const nsDisplayListSet& aLists) MOZ_OVERRIDE; // nsSVGGeometryFrame methods - gfxMatrix GetCanvasTM(uint32_t aFor); + gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; protected: // nsISVGChildFrame interface: diff --git a/layout/svg/nsSVGPatternFrame.h b/layout/svg/nsSVGPatternFrame.h index a1b276b750b..11400368d95 100644 --- a/layout/svg/nsSVGPatternFrame.h +++ b/layout/svg/nsSVGPatternFrame.h @@ -6,6 +6,7 @@ #ifndef __NS_SVGPATTERNFRAME_H__ #define __NS_SVGPATTERNFRAME_H__ +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "nsSVGPaintServerFrame.h" @@ -43,18 +44,18 @@ public: const gfxMatrix& aContextMatrix, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, float aOpacity, - const gfxRect *aOverrideBounds); + const gfxRect *aOverrideBounds) MOZ_OVERRIDE; public: typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; // nsIFrame interface: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; #ifdef DEBUG virtual void Init(nsIContent* aContent, @@ -67,10 +68,10 @@ public: * * @see nsGkAtoms::svgPatternFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGPattern"), aResult); } diff --git a/layout/svg/nsSVGTSpanFrame.h b/layout/svg/nsSVGTSpanFrame.h index bbd0ac095f4..5473cea9917 100644 --- a/layout/svg/nsSVGTSpanFrame.h +++ b/layout/svg/nsSVGTSpanFrame.h @@ -49,23 +49,23 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; /** * Get the "type" of the frame * * @see nsGkAtoms::svgTSpanFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGTSpan"), aResult); } #endif // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; // nsISVGGlyphFragmentNode interface: virtual uint32_t GetNumberOfChars() MOZ_OVERRIDE; diff --git a/layout/svg/nsSVGTextFrame.h b/layout/svg/nsSVGTextFrame.h index 26e35792cb4..0f7a749383e 100644 --- a/layout/svg/nsSVGTextFrame.h +++ b/layout/svg/nsSVGTextFrame.h @@ -6,6 +6,7 @@ #ifndef NS_SVGTEXTFRAME_H #define NS_SVGTEXTFRAME_H +#include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "gfxRect.h" #include "nsSVGTextContainerFrame.h" @@ -41,17 +42,17 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; /** * Get the "type" of the frame * * @see nsGkAtoms::svgTextFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGText"), aResult); } @@ -62,29 +63,29 @@ public: const nsDisplayListSet& aLists) MOZ_OVERRIDE; // nsISVGChildFrame interface: - virtual void NotifySVGChanged(uint32_t aFlags); + virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE; // Override these four to ensure that UpdateGlyphPositioning is called // to bring glyph positions up to date NS_IMETHOD PaintSVG(nsRenderingContext* aContext, - const nsIntRect *aDirtyRect); - NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint & aPoint); - virtual void ReflowSVG(); + const nsIntRect *aDirtyRect) MOZ_OVERRIDE; + NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint & aPoint) MOZ_OVERRIDE; + virtual void ReflowSVG() MOZ_OVERRIDE; virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, - uint32_t aFlags); + uint32_t aFlags) MOZ_OVERRIDE; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; // nsSVGTextContainerFrame methods: - virtual uint32_t GetNumberOfChars(); - virtual float GetComputedTextLength(); - virtual float GetSubStringLength(uint32_t charnum, uint32_t nchars); - virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point); + virtual uint32_t GetNumberOfChars() MOZ_OVERRIDE; + virtual float GetComputedTextLength() MOZ_OVERRIDE; + virtual float GetSubStringLength(uint32_t charnum, uint32_t nchars) MOZ_OVERRIDE; + virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point) MOZ_OVERRIDE; - NS_IMETHOD GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval); - NS_IMETHOD GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval); - NS_IMETHOD GetExtentOfChar(uint32_t charnum, mozilla::dom::SVGIRect **_retval); - NS_IMETHOD GetRotationOfChar(uint32_t charnum, float *_retval); + NS_IMETHOD GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval) MOZ_OVERRIDE; + NS_IMETHOD GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval) MOZ_OVERRIDE; + NS_IMETHOD GetExtentOfChar(uint32_t charnum, mozilla::dom::SVGIRect **_retval) MOZ_OVERRIDE; + NS_IMETHOD GetRotationOfChar(uint32_t charnum, float *_retval) MOZ_OVERRIDE; // nsSVGTextFrame void NotifyGlyphMetricsChange(); diff --git a/layout/svg/nsSVGTextFrame2.cpp b/layout/svg/nsSVGTextFrame2.cpp index f74ef1e6a46..ee71b3fe093 100644 --- a/layout/svg/nsSVGTextFrame2.cpp +++ b/layout/svg/nsSVGTextFrame2.cpp @@ -3141,7 +3141,7 @@ nsSVGTextFrame2::Reflow(nsPresContext* aPresContext, "reflow roots should be reflowed at existing size and " "svg.css should ensure we have no padding/border/margin"); - DoReflow(false); + DoReflow(); aDesiredSize.width = aReflowState.ComputedWidth(); aDesiredSize.height = aReflowState.ComputedHeight(); @@ -3159,7 +3159,7 @@ nsSVGTextFrame2::FindCloserFrameForSelection( if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) { return; } - UpdateGlyphPositioning(true); + UpdateGlyphPositioning(); nsPresContext* presContext = PresContext(); @@ -3196,7 +3196,7 @@ nsSVGTextFrame2::NotifySVGChanged(uint32_t aFlags) bool needGlyphMetricsUpdate = false; bool needNewCanvasTM = false; - if (aFlags & COORD_CONTEXT_CHANGED) { + if ((aFlags & COORD_CONTEXT_CHANGED) && mPositioningMayUsePercentages) { needGlyphMetricsUpdate = true; } @@ -3292,7 +3292,7 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext, if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { // Text frames inside , , etc. will never have had // ReflowSVG called on them, so call UpdateGlyphPositioning to do this now. - UpdateGlyphPositioning(true); + UpdateGlyphPositioning(); } else if (NS_SUBTREE_DIRTY(this)) { // If we are asked to paint before reflow has recomputed mPositions etc. // directly via PaintSVG, rather than via a display list, then we need @@ -3411,7 +3411,7 @@ nsSVGTextFrame2::GetFrameForPoint(const nsPoint& aPoint) // them, so call UpdateGlyphPositioning to do this now. (Text frames // inside and other non-display containers will never need to // be hit tested.) - UpdateGlyphPositioning(true); + UpdateGlyphPositioning(); } else { NS_ASSERTION(!NS_SUBTREE_DIRTY(this), "reflow should have happened"); } @@ -3466,13 +3466,8 @@ nsSVGTextFrame2::ReflowSVG() return; } - // UpdateGlyphPositioning may have been called under DOM calls and set - // mPositioningDirty to false. We may now have better positioning, though, so - // set it to true so that UpdateGlyphPositioning will do its work. - mPositioningDirty = true; - // UpdateGlyphPositioning will call DoReflow if necessary. - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); nsPresContext* presContext = PresContext(); @@ -3548,7 +3543,7 @@ nsSVGTextFrame2::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, { NS_ASSERTION(GetFirstPrincipalChild(), "must have a child frame"); - UpdateGlyphPositioning(true); + UpdateGlyphPositioning(); gfxRect bbox; nsPresContext* presContext = PresContext(); @@ -3661,7 +3656,7 @@ nsSVGTextFrame2::ConvertTextElementCharIndexToAddressableIndex( uint32_t nsSVGTextFrame2::GetNumberOfChars(nsIContent* aContent) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); uint32_t n = 0; CharIterator it(this, CharIterator::eAddressable, aContent); @@ -3681,7 +3676,7 @@ nsSVGTextFrame2::GetNumberOfChars(nsIContent* aContent) float nsSVGTextFrame2::GetComputedTextLength(nsIContent* aContent) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); float cssPxPerDevPx = PresContext()-> AppUnitsToFloatCSSPixels(PresContext()->AppUnitsPerDevPixel()); @@ -3705,7 +3700,7 @@ nsresult nsSVGTextFrame2::SelectSubString(nsIContent* aContent, uint32_t charnum, uint32_t nchars) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); // Convert charnum/nchars from addressable characters relative to // aContent to global character indices. @@ -3738,7 +3733,7 @@ nsSVGTextFrame2::GetSubStringLength(nsIContent* aContent, uint32_t charnum, uint32_t nchars, float* aResult) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); // Convert charnum/nchars from addressable characters relative to // aContent to global character indices. @@ -3811,7 +3806,7 @@ int32_t nsSVGTextFrame2::GetCharNumAtPosition(nsIContent* aContent, mozilla::nsISVGPoint* aPoint) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); nsPresContext* context = PresContext(); @@ -3844,7 +3839,7 @@ nsSVGTextFrame2::GetStartPositionOfChar(nsIContent* aContent, uint32_t aCharNum, mozilla::nsISVGPoint** aResult) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); CharIterator it(this, CharIterator::eAddressable, aContent); if (!it.AdvanceToSubtree() || @@ -3868,7 +3863,7 @@ nsSVGTextFrame2::GetEndPositionOfChar(nsIContent* aContent, uint32_t aCharNum, mozilla::nsISVGPoint** aResult) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); CharIterator it(this, CharIterator::eAddressable, aContent); if (!it.AdvanceToSubtree() || @@ -3905,7 +3900,7 @@ nsSVGTextFrame2::GetExtentOfChar(nsIContent* aContent, uint32_t aCharNum, dom::SVGIRect** aResult) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); CharIterator it(this, CharIterator::eAddressable, aContent); if (!it.AdvanceToSubtree() || @@ -3956,7 +3951,7 @@ nsSVGTextFrame2::GetRotationOfChar(nsIContent* aContent, uint32_t aCharNum, float* aResult) { - UpdateGlyphPositioning(false); + UpdateGlyphPositioning(); CharIterator it(this, CharIterator::eAddressable, aContent); if (!it.AdvanceToSubtree() || @@ -4078,6 +4073,7 @@ nsSVGTextFrame2::ResolvePositions(nsIContent* aContent, } uint32_t count = GetTextContentLength(aContent); + bool& percentages = mPositioningMayUsePercentages; // New text anchoring chunks start at each character assigned a position // with x="" or y="", or if we forced one with aForceStartOfChunk due to @@ -4100,12 +4096,14 @@ nsSVGTextFrame2::ResolvePositions(nsIContent* aContent, for (uint32_t i = 0, j = 0; i < dx.Length() && j < count; j++) { if (!mPositions[aIndex + j].mUnaddressable) { aDeltas[aIndex + j].x = dx[i]; + percentages = percentages || dx.HasPercentageValueAt(i); i++; } } for (uint32_t i = 0, j = 0; i < dy.Length() && j < count; j++) { if (!mPositions[aIndex + j].mUnaddressable) { aDeltas[aIndex + j].y = dy[i]; + percentages = percentages || dy.HasPercentageValueAt(i); i++; } } @@ -4115,12 +4113,14 @@ nsSVGTextFrame2::ResolvePositions(nsIContent* aContent, for (uint32_t i = 0, j = 0; i < x.Length() && j < count; j++) { if (!mPositions[aIndex + j].mUnaddressable) { mPositions[aIndex + j].mPosition.x = x[i]; + percentages = percentages || x.HasPercentageValueAt(i); i++; } } for (uint32_t i = 0, j = 0; i < y.Length() && j < count; j++) { if (!mPositions[aIndex + j].mUnaddressable) { mPositions[aIndex + j].mPosition.y = y[i]; + percentages = percentages || y.HasPercentageValueAt(i); i++; } } @@ -4164,6 +4164,7 @@ bool nsSVGTextFrame2::ResolvePositions(nsTArray& aDeltas) { NS_ASSERTION(mPositions.IsEmpty(), "expected mPositions to be empty"); + mPositioningMayUsePercentages = false; CharIterator it(this, CharIterator::eOriginal); if (it.AtEnd()) { @@ -4768,7 +4769,7 @@ nsSVGTextFrame2::NotifyGlyphMetricsChange(uint32_t aFlags) } void -nsSVGTextFrame2::UpdateGlyphPositioning(bool aForceGlobalTransform) +nsSVGTextFrame2::UpdateGlyphPositioning() { nsIFrame* kid = GetFirstPrincipalChild(); if (!kid) @@ -4786,7 +4787,7 @@ nsSVGTextFrame2::UpdateGlyphPositioning(bool aForceGlobalTransform) kid->AddStateBits(NS_FRAME_IS_DIRTY); } nsPresContext::InterruptPreventer noInterrupts(PresContext()); - DoReflow(aForceGlobalTransform); + DoReflow(); } if (mPositioningDirty) { @@ -4795,7 +4796,7 @@ nsSVGTextFrame2::UpdateGlyphPositioning(bool aForceGlobalTransform) } void -nsSVGTextFrame2::DoReflow(bool aForceGlobalTransform) +nsSVGTextFrame2::DoReflow() { // Since we are going to reflow the anonymous block frame, we will // need to update mPositions. @@ -4826,7 +4827,7 @@ nsSVGTextFrame2::DoReflow(bool aForceGlobalTransform) if (!renderingContext) return; - UpdateFontSizeScaleFactor(aForceGlobalTransform); + UpdateFontSizeScaleFactor(); nscoord width = kid->GetPrefWidth(renderingContext); nsHTMLReflowState reflowState(presContext, kid, @@ -4854,7 +4855,7 @@ nsSVGTextFrame2::DoReflow(bool aForceGlobalTransform) #define PRECISE_SIZE 200.0 void -nsSVGTextFrame2::UpdateFontSizeScaleFactor(bool aForceGlobalTransform) +nsSVGTextFrame2::UpdateFontSizeScaleFactor() { nsPresContext* presContext = PresContext(); @@ -4888,8 +4889,8 @@ nsSVGTextFrame2::UpdateFontSizeScaleFactor(bool aForceGlobalTransform) } gfxMatrix m; - if (aForceGlobalTransform || - !(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) || + mGetCanvasTMForFlag != FOR_OUTERSVG_TM) { m = GetCanvasTM(mGetCanvasTMForFlag); if (m.IsSingular()) { mFontSizeScaleFactor = 1.0; @@ -4969,7 +4970,7 @@ nsSVGTextFrame2::TransformFramePointToTextChild(const gfxPoint& aPoint, (aChildFrame->GetParent(), nsGkAtoms::svgTextFrame2) == this, "aChildFrame must be a descendant of this frame"); - UpdateGlyphPositioning(true); + UpdateGlyphPositioning(); nsPresContext* presContext = PresContext(); @@ -5046,7 +5047,7 @@ nsSVGTextFrame2::TransformFrameRectToTextChild(const gfxRect& aRect, (aChildFrame->GetParent(), nsGkAtoms::svgTextFrame2) == this, "aChildFrame must be a descendant of this frame"); - UpdateGlyphPositioning(true); + UpdateGlyphPositioning(); nsPresContext* presContext = PresContext(); @@ -5120,7 +5121,7 @@ nsSVGTextFrame2::TransformFrameRectFromTextChild(const nsRect& aRect, (aChildFrame->GetParent(), nsGkAtoms::svgTextFrame2) == this, "aChildFrame must be a descendant of this frame"); - UpdateGlyphPositioning(true); + UpdateGlyphPositioning(); nsPresContext* presContext = PresContext(); diff --git a/layout/svg/nsSVGTextFrame2.h b/layout/svg/nsSVGTextFrame2.h index d4f02c79479..e13b5b24bfb 100644 --- a/layout/svg/nsSVGTextFrame2.h +++ b/layout/svg/nsSVGTextFrame2.h @@ -6,6 +6,7 @@ #ifndef NS_SVGTEXTFRAME2_H #define NS_SVGTEXTFRAME2_H +#include "mozilla/Attributes.h" #include "gfxFont.h" #include "gfxMatrix.h" #include "gfxRect.h" @@ -188,7 +189,8 @@ protected: : nsSVGTextFrame2Base(aContext), mFontSizeScaleFactor(1.0f), mGetCanvasTMForFlag(FOR_OUTERSVG_TM), - mPositioningDirty(true) + mPositioningDirty(true), + mPositioningMayUsePercentages(false) { } @@ -206,9 +208,9 @@ public: NS_IMETHOD AttributeChanged(int32_t aNamespaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; - virtual nsIFrame* GetContentInsertionFrame() + virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE { return GetFirstPrincipalChild()->GetContentInsertionFrame(); } @@ -216,7 +218,7 @@ public: NS_IMETHOD Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus); + nsReflowStatus& aStatus) MOZ_OVERRIDE; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, @@ -227,10 +229,10 @@ public: * * @see nsGkAtoms::svgTextFrame2 */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGText2"), aResult); } @@ -240,21 +242,21 @@ public: * Finds the nsTextFrame for the closest rendered run to the specified point. */ virtual void FindCloserFrameForSelection(nsPoint aPoint, - FrameWithDistance* aCurrentBestFrame); + FrameWithDistance* aCurrentBestFrame) MOZ_OVERRIDE; // nsISVGChildFrame interface: - virtual void NotifySVGChanged(uint32_t aFlags); + virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE; NS_IMETHOD PaintSVG(nsRenderingContext* aContext, - const nsIntRect* aDirtyRect); - NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint& aPoint); - virtual void ReflowSVG(); - NS_IMETHOD_(nsRect) GetCoveredRegion(); + const nsIntRect* aDirtyRect) MOZ_OVERRIDE; + NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint& aPoint) MOZ_OVERRIDE; + virtual void ReflowSVG() MOZ_OVERRIDE; + NS_IMETHOD_(nsRect) GetCoveredRegion() MOZ_OVERRIDE; virtual SVGBBox GetBBoxContribution(const gfxMatrix& aToBBoxUserspace, - uint32_t aFlags); + uint32_t aFlags) MOZ_OVERRIDE; // nsSVGContainerFrame methods: - virtual gfxMatrix GetCanvasTM(uint32_t aFor); + virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; // SVG DOM text methods: uint32_t GetNumberOfChars(nsIContent* aContent); @@ -292,7 +294,7 @@ public: * Updates the mFontSizeScaleFactor value by looking at the range of * font-sizes used within the . */ - void UpdateFontSizeScaleFactor(bool aForceGlobalTransform); + void UpdateFontSizeScaleFactor(); double GetFontSizeScaleFactor() const; @@ -387,7 +389,7 @@ private: /** * Reflows the anonymous block child. */ - void DoReflow(bool aForceGlobalTransform); + void DoReflow(); /** * Calls FrameNeedsReflow on the anonymous block child. @@ -396,12 +398,8 @@ private: /** * Reflows the anonymous block child and recomputes mPositions if needed. - * - * @param aForceGlobalTransform passed down to UpdateFontSizeScaleFactor to - * control whether it should use the global transform even when - * NS_STATE_NONDISPLAY_CHILD */ - void UpdateGlyphPositioning(bool aForceGlobalTransform); + void UpdateGlyphPositioning(); /** * Populates mPositions with positioning information for each character @@ -624,6 +622,13 @@ private: * The flag to pass to GetCanvasTM from UpdateFontSizeScaleFactor. This is * normally FOR_OUTERSVG_TM, but while painting or hit testing a pattern or * marker, we set it to FOR_PAINTING or FOR_HIT_TESTING appropriately. + * + * This flag is also used to determine whether in UpdateFontSizeScaleFactor + * GetCanvasTM should be called at all. When the nsSVGTextFrame2 is a + * non-display child, and we are not painting or hit testing, there is + * no sensible CTM stack to use. Additionally, when inside a , + * calling GetCanvasTM on the nsSVGMarkerFrame would crash due to not + * having a current mMarkedFrame. */ uint32_t mGetCanvasTMForFlag; @@ -638,6 +643,30 @@ private: * necessary. */ bool mPositioningDirty; + + /** + * Whether the values from x/y/dx/dy attributes have any percentage values + * that are used in determining the positions of glyphs. The value will + * be true even if a positioning value is overridden by a descendant element's + * attribute with a non-percentage length. For example, + * mPositioningMayUsePercentages would be true for: + * + * abc + * + * Percentage values beyond the number of addressable characters, however, do + * not influence mPositioningMayUsePercentages. For example, + * mPositioningMayUsePercentages would be false for: + * + * abc + * + * mPositioningMayUsePercentages is used to determine whether to recompute + * mPositions when the viewport size changes. So although the first example + * above shows that mPositioningMayUsePercentages can be true even if a viewport + * size change will not affect mPositions, determining a completley accurate + * value for mPositioningMayUsePercentages would require extra work that is + * probably not worth it. + */ + bool mPositioningMayUsePercentages; }; #endif diff --git a/layout/svg/nsSVGTextPathFrame.h b/layout/svg/nsSVGTextPathFrame.h index fd116a9c1f6..9f5e4b65f4e 100644 --- a/layout/svg/nsSVGTextPathFrame.h +++ b/layout/svg/nsSVGTextPathFrame.h @@ -6,6 +6,7 @@ #ifndef NSSVGTEXTPATHFRAME_H #define NSSVGTEXTPATHFRAME_H +#include "mozilla/Attributes.h" #include "gfxTypes.h" #include "nsCOMPtr.h" #include "nsFrame.h" @@ -48,16 +49,16 @@ public: NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; /** * Get the "type" of the frame * * @see nsGkAtoms::svgGFrame */ - virtual nsIAtom* GetType() const; + virtual nsIAtom* GetType() const MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { return MakeFrameName(NS_LITERAL_STRING("SVGTextPath"), aResult); } @@ -83,9 +84,9 @@ public: protected: - virtual void GetXY(SVGUserUnitList *aX, SVGUserUnitList *aY); - virtual void GetDxDy(SVGUserUnitList *aDx, SVGUserUnitList *aDy); - virtual const SVGNumberList *GetRotate(); + virtual void GetXY(SVGUserUnitList *aX, SVGUserUnitList *aY) MOZ_OVERRIDE; + virtual void GetDxDy(SVGUserUnitList *aDx, SVGUserUnitList *aDy) MOZ_OVERRIDE; + virtual const SVGNumberList *GetRotate() MOZ_OVERRIDE; }; #endif diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index e296df7aa93..5d24ff7bc8f 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -451,120 +451,6 @@ nsSVGUtils::OuterSVGIsCallingReflowSVG(nsIFrame *aFrame) return GetOuterSVGFrame(aFrame)->IsCallingReflowSVG(); } -void -nsSVGUtils::InvalidateBounds(nsIFrame *aFrame, bool aDuringUpdate, - const nsRect *aBoundsSubArea, uint32_t aFlags) -{ - NS_ABORT_IF_FALSE(aFrame->IsFrameOfType(nsIFrame::eSVG) && - !(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG), - "Passed bad frame!"); - - NS_ASSERTION(aDuringUpdate == OuterSVGIsCallingReflowSVG(aFrame), - "aDuringUpdate lies!"); - - // Rendering observers must be notified about changes to the frames that they - // are observing _before_ ReflowSVG is called on the SVG frame tree, so we - // only need to notify observers if we're not under an ReflowSVG call. - // In fact, it would actually be wrong to notify observers while under - // ReflowSVG because the observers will try to mark themselves as dirty - // and, since ReflowSVG would be in the process of _removeing_ dirty bits - // from frames, that would mess things up. - if (!aDuringUpdate) { - NS_ASSERTION(!OuterSVGIsCallingReflowSVG(aFrame), - "Must not InvalidateRenderingObservers() under " - "nsISVGChildFrame::ReflowSVG!"); - - nsSVGEffects::InvalidateRenderingObservers(aFrame); - } - - // Must come after InvalidateRenderingObservers - if (aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) { - return; - } - - // XXXjwatt: can this come before InvalidateRenderingObservers? - if (aFrame->GetStateBits() & - (NS_FRAME_IS_DIRTY | NS_FRAME_FIRST_REFLOW)) { - // Nothing to do if we're already dirty, or if the outer- - // hasn't yet had its initial reflow. - return; - } - - aFrame->InvalidateFrameSubtree(); - - if ((aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame || - aFrame->GetType() == nsGkAtoms::svgGlyphFrame) && - NS_SVGDisplayListPaintingEnabled()) { - return; - } - - // Okay, so now we pass the area that needs to be invalidated up our parent - // chain, accounting for filter effects and transforms as we go, until we - // reach our nsSVGOuterSVGFrame where we can invalidate: - - nsRect invalidArea; - if (aBoundsSubArea) { - invalidArea = *aBoundsSubArea; - } else { - invalidArea = aFrame->GetVisualOverflowRect(); - // GetVisualOverflowRect() already includes filter effects and transforms, - // so advance to our parent before the loop below: - invalidArea += aFrame->GetPosition(); - aFrame = aFrame->GetParent(); - } - - int32_t appUnitsPerCSSPx = aFrame->PresContext()->AppUnitsPerCSSPixel(); - - while (aFrame) { - if ((aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)) { - // This ancestor frame has already been invalidated, so nothing to do. - return; - } - if (aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG) { - break; - } - if (aFrame->GetType() == nsGkAtoms::svgInnerSVGFrame && - aFrame->StyleDisplay()->IsScrollableOverflow()) { - // Clip rect to the viewport established by this inner-: - float x, y, width, height; - static_cast(aFrame->GetContent())-> - GetAnimatedLengthValues(&x, &y, &width, &height, nullptr); - if (width <= 0.0f || height <= 0.0f) { - return; // Nothing to invalidate - } - nsRect viewportRect = - nsLayoutUtils::RoundGfxRectToAppRect(gfxRect(0.0, 0.0, width, height), - appUnitsPerCSSPx); - invalidArea = invalidArea.Intersect(viewportRect); - if (invalidArea.IsEmpty()) { - return; // Nothing to invalidate - } - } - nsSVGFilterFrame *filterFrame = nsSVGEffects::GetFilterFrame(aFrame); - if (filterFrame) { - invalidArea = - filterFrame->GetPostFilterDirtyArea(aFrame, invalidArea); - } - if (aFrame->IsTransformed()) { - invalidArea = - nsDisplayTransform::TransformRect(invalidArea, aFrame, nsPoint(0, 0)); - } - invalidArea += aFrame->GetPosition(); - aFrame = aFrame->GetParent(); - } - - if (!aFrame) { - // We seem to be able to get here, even though SVG frames are never created - // without an ancestor nsSVGOuterSVGFrame. See bug 767996. - return; - } - - NS_ASSERTION(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG, - "SVG frames must always have an nsSVGOuterSVGFrame ancestor!"); - - static_cast(aFrame)->InvalidateSVG(invalidArea); -} - void nsSVGUtils::ScheduleReflowSVG(nsIFrame *aFrame) { diff --git a/layout/svg/nsSVGUtils.h b/layout/svg/nsSVGUtils.h index 74ba1f4d1fb..5c0243ab759 100644 --- a/layout/svg/nsSVGUtils.h +++ b/layout/svg/nsSVGUtils.h @@ -278,21 +278,6 @@ public: static nsRect GetPostFilterVisualOverflowRect(nsIFrame *aFrame, const nsRect &aUnfilteredRect); - /** - * Invalidates the area that is painted by the frame without updating its - * bounds. - * - * This is similar to InvalidateOverflowRect(). It will go away when we - * support display list based invalidation of SVG. - * - * @param aBoundsSubArea If non-null, a sub-area of aFrame's pre-filter - * visual overflow rect that should be invalidated instead of aFrame's - * entire visual overflow rect. - */ - static void InvalidateBounds(nsIFrame *aFrame, bool aDuringUpdate = false, - const nsRect *aBoundsSubArea = nullptr, - uint32_t aFlags = 0); - /** * Schedules an update of the frame's bounds (which will in turn invalidate * the new area that the frame should paint to). @@ -402,12 +387,6 @@ public: /** * Notify the descendants of aFrame of a change to one of their ancestors * that might affect them. - * - * If the changed ancestor renders and needs to be invalidated, it should - * call nsSVGUtils::InvalidateAndScheduleBoundsUpdate or - * nsSVGUtils::InvalidateBounds _before_ calling this method. That makes it - * cheaper when descendants schedule their own bounds update because the code - * that walks up the parent chain marking dirty bits can stop earlier. */ static void NotifyChildrenOfSVGChange(nsIFrame *aFrame, uint32_t aFlags); diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 8363e0d0f43..0ef752eb6d2 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1325,6 +1325,15 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext, return rv; } +bool +nsTableRowGroupFrame::UpdateOverflow() +{ + // Row cursor invariants depend on the visual overflow area of the rows, + // which may have changed, so we need to clear the cursor now. + ClearRowCursor(); + return nsContainerFrame::UpdateOverflow(); +} + /* virtual */ void nsTableRowGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) { diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index 7d46c9fe7c3..c2a9125b902 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -111,6 +111,8 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) MOZ_OVERRIDE; + virtual bool UpdateOverflow() MOZ_OVERRIDE; + /** * Get the "type" of the frame * diff --git a/layout/tools/reftest/reftest-content.js b/layout/tools/reftest/reftest-content.js index 376685a3551..63e429d862d 100644 --- a/layout/tools/reftest/reftest-content.js +++ b/layout/tools/reftest/reftest-content.js @@ -13,6 +13,7 @@ const XHTML_NS = "http://www.w3.org/1999/xhtml"; const DEBUG_CONTRACTID = "@mozilla.org/xpcom/debug;1"; const PRINTSETTINGS_CONTRACTID = "@mozilla.org/gfx/printsettings-service;1"; +const ENVIRONMENT_CONTRACTID = "@mozilla.org/process/environment;1"; // "" const BLANK_URL_FOR_CLEARING = "data:text/html;charset=UTF-8,%3C%21%2D%2DCLEAR%2D%2D%3E"; @@ -38,6 +39,7 @@ var gFailureReason; var gAssertionCount = 0; var gDebug; +var gVerbose = false; var gCurrentTestStartTime; var gClearingForAssertionCheck = false; @@ -95,6 +97,8 @@ function OnInitialLoad() #endif gDebug = CC[DEBUG_CONTRACTID].getService(CI.nsIDebug2); + var env = CC[ENVIRONMENT_CONTRACTID].getService(CI.nsIEnvironment); + gVerbose = !!env.get("MOZ_REFTEST_VERBOSE"); RegisterMessageListeners(); @@ -628,12 +632,20 @@ function LoadURI(uri) function LogWarning(str) { - sendAsyncMessage("reftest:Log", { type: "warning", msg: str }); + if (gVerbose) { + sendSyncMessage("reftest:Log", { type: "warning", msg: str }); + } else { + sendAsyncMessage("reftest:Log", { type: "warning", msg: str }); + } } function LogInfo(str) { - sendAsyncMessage("reftest:Log", { type: "info", msg: str }); + if (gVerbose) { + sendSyncMessage("reftest:Log", { type: "info", msg: str }); + } else { + sendAsyncMessage("reftest:Log", { type: "info", msg: str }); + } } const SYNC_DEFAULT = 0x0; diff --git a/layout/xul/base/public/nsXULPopupManager.h b/layout/xul/base/public/nsXULPopupManager.h index 1782dc1b0fe..ee3fd1036a1 100644 --- a/layout/xul/base/public/nsXULPopupManager.h +++ b/layout/xul/base/public/nsXULPopupManager.h @@ -191,7 +191,7 @@ public: NS_ASSERTION(aPopup, "null popup supplied to nsXULPopupShowingEvent constructor"); } - NS_IMETHOD Run(); + NS_IMETHOD Run() MOZ_OVERRIDE; private: nsCOMPtr mPopup; @@ -218,7 +218,7 @@ public: // aNextPopup and aLastPopup may be null } - NS_IMETHOD Run(); + NS_IMETHOD Run() MOZ_OVERRIDE; private: nsCOMPtr mPopup; @@ -253,7 +253,7 @@ public: NS_ASSERTION(aMenu, "null menu supplied to nsXULMenuCommandEvent constructor"); } - NS_IMETHOD Run(); + NS_IMETHOD Run() MOZ_OVERRIDE; void SetCloseMenuMode(CloseMenuMode aCloseMenuMode) { mCloseMenuMode = aCloseMenuMode; } @@ -286,13 +286,13 @@ public: NS_DECL_NSIDOMEVENTLISTENER // nsIRollupListener - virtual bool Rollup(uint32_t aCount, nsIContent** aLastRolledUp); - virtual bool ShouldRollupOnMouseWheelEvent(); - virtual bool ShouldConsumeOnMouseWheelEvent(); - virtual bool ShouldRollupOnMouseActivate(); - virtual uint32_t GetSubmenuWidgetChain(nsTArray *aWidgetChain); - virtual void NotifyGeometryChange() {} - virtual nsIWidget* GetRollupWidget(); + virtual bool Rollup(uint32_t aCount, nsIContent** aLastRolledUp) MOZ_OVERRIDE; + virtual bool ShouldRollupOnMouseWheelEvent() MOZ_OVERRIDE; + virtual bool ShouldConsumeOnMouseWheelEvent() MOZ_OVERRIDE; + virtual bool ShouldRollupOnMouseActivate() MOZ_OVERRIDE; + virtual uint32_t GetSubmenuWidgetChain(nsTArray *aWidgetChain) MOZ_OVERRIDE; + virtual void NotifyGeometryChange() MOZ_OVERRIDE {} + virtual nsIWidget* GetRollupWidget() MOZ_OVERRIDE; static nsXULPopupManager* sInstance; diff --git a/layout/xul/base/src/nsListBoxBodyFrame.h b/layout/xul/base/src/nsListBoxBodyFrame.h index 06dfa14ff2f..85f965667c5 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.h +++ b/layout/xul/base/src/nsListBoxBodyFrame.h @@ -135,7 +135,7 @@ protected: mFrame(aFrame), mUp(aUp), mDelta(aDelta) {} - NS_IMETHOD Run() + NS_IMETHOD Run() MOZ_OVERRIDE { if (!mFrame) { return NS_OK; diff --git a/layout/xul/base/src/nsMenuBarListener.h b/layout/xul/base/src/nsMenuBarListener.h index c3c3bf797bd..7cda4b65e77 100644 --- a/layout/xul/base/src/nsMenuBarListener.h +++ b/layout/xul/base/src/nsMenuBarListener.h @@ -5,6 +5,7 @@ #ifndef nsMenuBarListener_h__ #define nsMenuBarListener_h__ +#include "mozilla/Attributes.h" #include "nsIDOMEventListener.h" // X.h defines KeyPress @@ -27,7 +28,7 @@ public: */ virtual ~nsMenuBarListener(); - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); + NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE; nsresult KeyUp(nsIDOMEvent* aMouseEvent); nsresult KeyDown(nsIDOMEvent* aMouseEvent); diff --git a/layout/xul/base/src/nsSliderFrame.h b/layout/xul/base/src/nsSliderFrame.h index 9ee95cb423d..66226a6ce5c 100644 --- a/layout/xul/base/src/nsSliderFrame.h +++ b/layout/xul/base/src/nsSliderFrame.h @@ -33,7 +33,7 @@ public: virtual void SetSlider(nsSliderFrame* aSlider) { mSlider = aSlider; } - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); + NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE; }; class nsSliderFrame : public nsBoxFrame diff --git a/layout/xul/base/src/nsTextBoxFrame.h b/layout/xul/base/src/nsTextBoxFrame.h index 9e6afd011dc..d0286bcb72b 100644 --- a/layout/xul/base/src/nsTextBoxFrame.h +++ b/layout/xul/base/src/nsTextBoxFrame.h @@ -5,6 +5,7 @@ #ifndef nsTextBoxFrame_h___ #define nsTextBoxFrame_h___ +#include "mozilla/Attributes.h" #include "nsLeafBoxFrame.h" class nsAccessKeyInfo; @@ -18,11 +19,11 @@ public: NS_DECL_QUERYFRAME NS_DECL_FRAMEARENA_HELPERS - virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState); - virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState); - virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState); - NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); - virtual void MarkIntrinsicWidthsDirty(); + virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; + virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; + virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; + NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; + virtual void MarkIntrinsicWidthsDirty() MOZ_OVERRIDE; enum CroppingStyle { CropNone, CropLeft, CropRight, CropCenter }; @@ -32,14 +33,14 @@ public: nsIFrame* aParent, nsIFrame* asPrevInFlow) MOZ_OVERRIDE; - virtual void DestroyFrom(nsIFrame* aDestructRoot); + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, - int32_t aModType); + int32_t aModType) MOZ_OVERRIDE; #ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const; + NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; #endif void UpdateAttributes(nsIAtom* aAttribute, @@ -59,7 +60,7 @@ public: nsRect GetComponentAlphaBounds(); - virtual bool ComputesOwnOverflowArea(); + virtual bool ComputesOwnOverflowArea() MOZ_OVERRIDE; void GetCroppedTitle(nsString& aTitle) const { aTitle = mCroppedTitle; } diff --git a/layout/xul/tree/nsTreeContentView.h b/layout/xul/tree/nsTreeContentView.h index 70b7139565e..2430a3b5eca 100644 --- a/layout/xul/tree/nsTreeContentView.h +++ b/layout/xul/tree/nsTreeContentView.h @@ -37,7 +37,7 @@ class nsTreeContentView MOZ_FINAL : public nsINativeTreeView, NS_DECL_NSITREEVIEW // nsINativeTreeView: Untrusted code can use us - NS_IMETHOD EnsureNative() { return NS_OK; } + NS_IMETHOD EnsureNative() MOZ_OVERRIDE { return NS_OK; } NS_DECL_NSITREECONTENTVIEW diff --git a/layout/xul/tree/nsTreeSelection.h b/layout/xul/tree/nsTreeSelection.h index 3fb8b694582..83425c77b2a 100644 --- a/layout/xul/tree/nsTreeSelection.h +++ b/layout/xul/tree/nsTreeSelection.h @@ -27,7 +27,7 @@ public: NS_DECL_NSITREESELECTION // nsINativeTreeSelection: Untrusted code can use us - NS_IMETHOD EnsureNative() { return NS_OK; } + NS_IMETHOD EnsureNative() MOZ_OVERRIDE { return NS_OK; } friend struct nsTreeRange; diff --git a/layout/xul/tree/nsTreeStyleCache.h b/layout/xul/tree/nsTreeStyleCache.h index 9494ec41e11..68923c1bd53 100644 --- a/layout/xul/tree/nsTreeStyleCache.h +++ b/layout/xul/tree/nsTreeStyleCache.h @@ -6,6 +6,7 @@ #ifndef nsTreeStyleCache_h__ #define nsTreeStyleCache_h__ +#include "mozilla/Attributes.h" #include "nsHashtable.h" #include "nsIAtom.h" #include "nsCOMArray.h" @@ -23,16 +24,16 @@ public: uint32_t GetStateID() { return mStateID; } - uint32_t HashCode(void) const { + uint32_t HashCode(void) const MOZ_OVERRIDE { return mStateID; } - bool Equals(const nsHashKey *aKey) const { + bool Equals(const nsHashKey *aKey) const MOZ_OVERRIDE { nsDFAState* key = (nsDFAState*)aKey; return key->mStateID == mStateID; } - nsHashKey *Clone(void) const { + nsHashKey *Clone(void) const MOZ_OVERRIDE { return new nsDFAState(mStateID); } }; @@ -45,19 +46,19 @@ public: nsTransitionKey(uint32_t aState, nsIAtom* aSymbol) :mState(aState), mInputSymbol(aSymbol) {} - uint32_t HashCode(void) const { + uint32_t HashCode(void) const MOZ_OVERRIDE { // Make a 32-bit integer that combines the low-order 16 bits of the state and the input symbol. int32_t hb = mState << 16; int32_t lb = (NS_PTR_TO_INT32(mInputSymbol.get()) << 16) >> 16; return hb+lb; } - bool Equals(const nsHashKey *aKey) const { + bool Equals(const nsHashKey *aKey) const MOZ_OVERRIDE { nsTransitionKey* key = (nsTransitionKey*)aKey; return key->mState == mState && key->mInputSymbol == mInputSymbol; } - nsHashKey *Clone(void) const { + nsHashKey *Clone(void) const MOZ_OVERRIDE { return new nsTransitionKey(mState, mInputSymbol); } }; diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index db7b31b080d..26ba34a11aa 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -784,12 +784,44 @@ void MediaPipelineTransmit::PipelineListener::ProcessAudioChunk( } #ifdef MOZILLA_INTERNAL_API +static void FillBlackYCbCr420PixelData(uint8_t* aBuffer, const gfxIntSize& aSize) +{ + // Fill Y plane +} + void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk( VideoSessionConduit* conduit, TrackRate rate, VideoChunk& chunk) { - // We now need to send the video frame to the other side layers::Image *img = chunk.mFrame.GetImage(); + gfxIntSize size = img ? img->GetSize() : chunk.mFrame.GetIntrinsicSize(); + if ((size.width & 1) != 0 || (size.height & 1) != 0) { + MOZ_ASSERT(false, "Can't handle odd-sized images"); + return; + } + + if (chunk.mFrame.GetForceBlack()) { + uint32_t yPlaneLen = size.width*size.height; + uint32_t cbcrPlaneLen = yPlaneLen/2; + uint32_t length = yPlaneLen + cbcrPlaneLen; + + // Send a black image. + nsAutoArrayPtr pixelData; + static const fallible_t fallible = fallible_t(); + pixelData = new (fallible) uint8_t[length]; + if (pixelData) { + memset(pixelData, 0x10, yPlaneLen); + // Fill Cb/Cr planes + memset(pixelData + yPlaneLen, 0x80, cbcrPlaneLen); + + MOZ_MTLOG(PR_LOG_DEBUG, "Sending a black video frame"); + conduit->SendVideoFrame(pixelData, length, size.width, size.height, + mozilla::kVideoI420, 0); + } + return; + } + + // We now need to send the video frame to the other side if (!img) { // segment.AppendFrame() allows null images, which show up here as null return; @@ -1055,7 +1087,11 @@ void MediaPipelineReceiveVideo::PipelineListener::RenderVideoFrame( ReentrantMonitorAutoEnter enter(monitor_); // Create a video frame and append it to the track. +#ifdef MOZ_WIDGET_GONK + ImageFormat format = GRALLOC_PLANAR_YCBCR; +#else ImageFormat format = PLANAR_YCBCR; +#endif nsRefPtr image = image_container_->CreateImage(&format, 1); layers::PlanarYCbCrImage* videoImage = static_cast(image.get()); diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 478164dccef..1bf11649fea 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -435,6 +435,9 @@ pref("browser.ui.touch.top", 48); pref("browser.ui.touch.bottom", 16); pref("browser.ui.touch.weight.visited", 120); // percentage +// The percentage of the screen that needs to be scrolled before margins are exposed. +pref("browser.ui.show-margins-threshold", 20); + // plugins pref("plugin.disable", false); pref("dom.ipc.plugins.enabled", false); diff --git a/mobile/android/base/ActivityHandlerHelper.java b/mobile/android/base/ActivityHandlerHelper.java index 5d356601b53..dd0124fa8ba 100644 --- a/mobile/android/base/ActivityHandlerHelper.java +++ b/mobile/android/base/ActivityHandlerHelper.java @@ -7,6 +7,7 @@ package org.mozilla.gecko; import org.mozilla.gecko.util.ActivityResultHandler; import org.mozilla.gecko.util.ActivityResultHandlerMap; import org.mozilla.gecko.util.ThreadUtils; +import org.mozilla.gecko.util.GeckoEventListener; import org.json.JSONException; import org.json.JSONObject; @@ -28,7 +29,7 @@ import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.TimeUnit; -public class ActivityHandlerHelper { +public class ActivityHandlerHelper implements GeckoEventListener { private static final String LOGTAG = "GeckoActivityHandlerHelper"; private final ConcurrentLinkedQueue mFilePickerResult; @@ -39,6 +40,10 @@ public class ActivityHandlerHelper { private final CameraImageResultHandler mCameraImageResultHandler; private final CameraVideoResultHandler mCameraVideoResultHandler; + public interface FileResultHandler { + public void gotFile(String filename); + } + @SuppressWarnings("serial") public ActivityHandlerHelper() { mFilePickerResult = new ConcurrentLinkedQueue() { @@ -56,6 +61,34 @@ public class ActivityHandlerHelper { mAwesomebarResultHandler = new AwesomebarResultHandler(); mCameraImageResultHandler = new CameraImageResultHandler(mFilePickerResult); mCameraVideoResultHandler = new CameraVideoResultHandler(mFilePickerResult); + GeckoAppShell.getEventDispatcher().registerEventListener("FilePicker:Show", this); + } + + @Override + public void handleMessage(String event, final JSONObject message) { + if (event.equals("FilePicker:Show")) { + String mimeType = "*/*"; + String mode = message.optString("mode"); + + if ("mimeType".equals(mode)) + mimeType = message.optString("mimeType"); + else if ("extension".equals(mode)) + mimeType = GeckoAppShell.getMimeTypeFromExtensions(message.optString("extensions")); + + Log.i(LOGTAG, "Mime: " + mimeType); + + showFilePickerAsync(GeckoAppShell.getGeckoInterface().getActivity(), mimeType, new FileResultHandler() { + public void gotFile(String filename) { + try { + message.put("file", filename); + } catch (JSONException ex) { + Log.i(LOGTAG, "Can't add filename to message " + filename); + } + GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent( + "FilePicker:Result", message.toString())); + } + }); + } } public int makeRequestCodeForAwesomebar() { @@ -149,6 +182,57 @@ public class ActivityHandlerHelper { } } + private interface IntentHandler { + public void gotIntent(Intent intent); + } + + private void getFilePickerIntentAsync(final Context context, String aMimeType, final IntentHandler handler) { + final ArrayList intents = new ArrayList(); + final Prompt.PromptListItem[] items = + getItemsAndIntentsForFilePicker(context, aMimeType, intents); + + if (intents.size() == 0) { + Log.i(LOGTAG, "no activities for the file picker!"); + handler.gotIntent(null); + return; + } + + if (intents.size() == 1) { + handler.gotIntent(intents.get(0)); + return; + } + + final Prompt prompt = new Prompt(context, new Prompt.PromptCallback() { + public void onPromptFinished(String promptServiceResult) { + int itemId = -1; + try { + itemId = new JSONObject(promptServiceResult).getInt("button"); + + if (itemId == -1) { + handler.gotIntent(null); + return; + } + } catch (JSONException e) { + Log.e(LOGTAG, "result from promptservice was invalid: ", e); + handler.gotIntent(null); + return; + } + + if (handler != null) + handler.gotIntent(intents.get(itemId)); + } + }); + + final String title = getFilePickerTitle(context, aMimeType); + // Runnable has to be called to show an intent-like + // context menu UI using the PromptService. + ThreadUtils.postToUiThread(new Runnable() { + @Override public void run() { + prompt.show(title, "", items, false); + } + }); + } + private Intent getFilePickerIntent(Context context, String aMimeType) { ArrayList intents = new ArrayList(); final Prompt.PromptListItem[] items = @@ -225,6 +309,31 @@ public class ActivityHandlerHelper { return filePickerResult; } + public void showFilePickerAsync(final Activity parentActivity, String aMimeType, final FileResultHandler handler) { + getFilePickerIntentAsync(parentActivity, aMimeType, new IntentHandler() { + public void gotIntent(Intent intent) { + if (intent == null) { + handler.gotFile(""); + } + + if (intent.getAction().equals(MediaStore.ACTION_IMAGE_CAPTURE)) { + CameraImageResultHandler cam = new CameraImageResultHandler(handler); + parentActivity.startActivityForResult(intent, mActivityResultHandlerMap.put(cam)); + } else if (intent.getAction().equals(MediaStore.ACTION_VIDEO_CAPTURE)) { + CameraVideoResultHandler vid = new CameraVideoResultHandler(handler); + parentActivity.startActivityForResult(intent, mActivityResultHandlerMap.put(vid)); + } else if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { + FilePickerResultHandlerSync file = new FilePickerResultHandlerSync(handler); + parentActivity.startActivityForResult(intent, mActivityResultHandlerMap.put(file)); + } else { + Log.e(LOGTAG, "We should not get an intent with another action!"); + handler.gotFile(""); + return; + } + } + }); + } + boolean handleActivityResult(int requestCode, int resultCode, Intent data) { ActivityResultHandler handler = mActivityResultHandlerMap.getAndRemove(requestCode); if (handler != null) { diff --git a/mobile/android/base/BrowserToolbar.java b/mobile/android/base/BrowserToolbar.java index 704cc56260d..a2b066cf7ae 100644 --- a/mobile/android/base/BrowserToolbar.java +++ b/mobile/android/base/BrowserToolbar.java @@ -347,6 +347,10 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener, } }); + if (Build.VERSION.SDK_INT >= 16) { + mShadow.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); + } + mHandler = new Handler(); float slideWidth = mActivity.getResources().getDimension(R.dimen.browser_toolbar_lock_width); diff --git a/mobile/android/base/CameraImageResultHandler.java b/mobile/android/base/CameraImageResultHandler.java index d57d70c41d6..d2d5b45b435 100644 --- a/mobile/android/base/CameraImageResultHandler.java +++ b/mobile/android/base/CameraImageResultHandler.java @@ -19,9 +19,17 @@ class CameraImageResultHandler implements ActivityResultHandler { private static final String LOGTAG = "GeckoCameraImageResultHandler"; private final Queue mFilePickerResult; + private final ActivityHandlerHelper.FileResultHandler mHandler; CameraImageResultHandler(Queue resultQueue) { mFilePickerResult = resultQueue; + mHandler = null; + } + + /* Use this constructor to asynchronously listen for results */ + public CameraImageResultHandler(ActivityHandlerHelper.FileResultHandler handler) { + mHandler = handler; + mFilePickerResult = null; } @Override @@ -33,7 +41,12 @@ class CameraImageResultHandler implements ActivityResultHandler { File file = new File(Environment.getExternalStorageDirectory(), sImageName); sImageName = ""; - mFilePickerResult.offer(file.getAbsolutePath()); + + if (mFilePickerResult != null) + mFilePickerResult.offer(file.getAbsolutePath()); + + if (mHandler != null) + mHandler.gotFile(file.getAbsolutePath()); } // this code is really hacky and doesn't belong anywhere so I'm putting it here for now diff --git a/mobile/android/base/CameraVideoResultHandler.java b/mobile/android/base/CameraVideoResultHandler.java index bf99e2cd5cc..4aa1895d57c 100644 --- a/mobile/android/base/CameraVideoResultHandler.java +++ b/mobile/android/base/CameraVideoResultHandler.java @@ -18,15 +18,31 @@ class CameraVideoResultHandler implements ActivityResultHandler { private static final String LOGTAG = "GeckoCameraVideoResultHandler"; private final Queue mFilePickerResult; + private final ActivityHandlerHelper.FileResultHandler mHandler; CameraVideoResultHandler(Queue resultQueue) { mFilePickerResult = resultQueue; + mHandler = null; + } + + /* Use this constructor to asynchronously listen for results */ + public CameraVideoResultHandler(ActivityHandlerHelper.FileResultHandler handler) { + mFilePickerResult = null; + mHandler = handler; + } + + private void sendResult(String res) { + if (mFilePickerResult != null) + mFilePickerResult.offer(res); + + if (mHandler != null) + mHandler.gotFile(res); } @Override public void onActivityResult(int resultCode, Intent data) { if (data == null || resultCode != Activity.RESULT_OK) { - mFilePickerResult.offer(""); + sendResult(""); return; } @@ -36,7 +52,7 @@ class CameraVideoResultHandler implements ActivityResultHandler { null, null); cursor.moveToFirst(); - mFilePickerResult.offer(cursor.getString( - cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA))); + + sendResult(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA))); } } diff --git a/mobile/android/base/FilePickerResultHandler.java b/mobile/android/base/FilePickerResultHandler.java index e515929a49f..d1b9f9d9b50 100644 --- a/mobile/android/base/FilePickerResultHandler.java +++ b/mobile/android/base/FilePickerResultHandler.java @@ -24,9 +24,11 @@ abstract class FilePickerResultHandler implements ActivityResultHandler { private static final String LOGTAG = "GeckoFilePickerResultHandler"; protected final Queue mFilePickerResult; + protected final ActivityHandlerHelper.FileResultHandler mHandler; - protected FilePickerResultHandler(Queue resultQueue) { + protected FilePickerResultHandler(Queue resultQueue, ActivityHandlerHelper.FileResultHandler handler) { mFilePickerResult = resultQueue; + mHandler = handler; } protected String handleActivityResult(int resultCode, Intent data) { @@ -53,6 +55,8 @@ abstract class FilePickerResultHandler implements ActivityResultHandler { cursor.close(); } } + + // tmp filenames must be at least 3 characters long. Add a prefix to make sure that happens String fileName = "tmp_"; String fileExt = null; int period; @@ -61,8 +65,9 @@ abstract class FilePickerResultHandler implements ActivityResultHandler { fileExt = "." + GeckoAppShell.getExtensionFromMimeType(mimeType); } else { fileExt = name.substring(period); - fileName = name.substring(0, period); + fileName += name.substring(0, period); } + Log.i(LOGTAG, "Filename: " + fileName + " . " + fileExt); File file = File.createTempFile(fileName, fileExt, GeckoLoader.getGREDir(GeckoAppShell.getContext())); FileOutputStream fos = new FileOutputStream(file); InputStream is = cr.openInputStream(uri); diff --git a/mobile/android/base/FilePickerResultHandlerSync.java b/mobile/android/base/FilePickerResultHandlerSync.java index 9b9a2ab983e..0ab5a8c71d3 100644 --- a/mobile/android/base/FilePickerResultHandlerSync.java +++ b/mobile/android/base/FilePickerResultHandlerSync.java @@ -13,11 +13,20 @@ class FilePickerResultHandlerSync extends FilePickerResultHandler { private static final String LOGTAG = "GeckoFilePickerResultHandlerSync"; FilePickerResultHandlerSync(Queue resultQueue) { - super(resultQueue); + super(resultQueue, null); + } + + /* Use this constructor to asynchronously listen for results */ + public FilePickerResultHandlerSync(ActivityHandlerHelper.FileResultHandler handler) { + super(null, handler); } @Override public void onActivityResult(int resultCode, Intent data) { - mFilePickerResult.offer(handleActivityResult(resultCode, data)); + if (mFilePickerResult != null) + mFilePickerResult.offer(handleActivityResult(resultCode, data)); + + if (mHandler != null) + mHandler.gotFile(handleActivityResult(resultCode, data)); } } diff --git a/mobile/android/base/FormAssistPopup.java b/mobile/android/base/FormAssistPopup.java index 69712533125..3c6718ff307 100644 --- a/mobile/android/base/FormAssistPopup.java +++ b/mobile/android/base/FormAssistPopup.java @@ -16,6 +16,7 @@ import org.json.JSONObject; import android.content.Context; import android.content.res.Resources; +import android.graphics.PointF; import android.util.AttributeSet; import android.util.Log; import android.util.Pair; @@ -216,8 +217,9 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene int height = 0; try { - left = (int) (rect.getDouble("x") * zoom - viewportMetrics.viewportRectLeft); - top = (int) (rect.getDouble("y") * zoom - viewportMetrics.viewportRectTop); + PointF offset = viewportMetrics.getMarginOffset(); + left = (int) (rect.getDouble("x") * zoom - viewportMetrics.viewportRectLeft + offset.x); + top = (int) (rect.getDouble("y") * zoom - viewportMetrics.viewportRectTop + offset.y); width = (int) (rect.getDouble("w") * zoom); height = (int) (rect.getDouble("h") * zoom); } catch (JSONException e) { diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 118f00eb7a3..37994e25f43 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -11,9 +11,7 @@ import org.mozilla.gecko.db.BrowserDB; import org.mozilla.gecko.gfx.BitmapUtils; import org.mozilla.gecko.gfx.Layer; import org.mozilla.gecko.gfx.LayerView; -import org.mozilla.gecko.gfx.PanZoomController; import org.mozilla.gecko.gfx.PluginLayer; -import org.mozilla.gecko.gfx.PointUtils; import org.mozilla.gecko.menu.GeckoMenu; import org.mozilla.gecko.menu.GeckoMenuInflater; import org.mozilla.gecko.menu.MenuPanel; @@ -45,7 +43,6 @@ import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Point; -import android.graphics.PointF; import android.graphics.Rect; import android.hardware.Sensor; import android.hardware.SensorEvent; @@ -108,7 +105,7 @@ abstract public class GeckoApp implements GeckoEventListener, SensorEventListener, LocationListener, Tabs.OnTabsChangedListener, GeckoEventResponder, GeckoMenu.Callback, GeckoMenu.MenuPresenter, - TouchEventInterceptor, ContextGetter, GeckoAppShell.GeckoInterface + ContextGetter, GeckoAppShell.GeckoInterface { private static final String LOGTAG = "GeckoApp"; @@ -172,7 +169,6 @@ abstract public class GeckoApp private String mPrivateBrowsingSession; - private PointF mInitialTouchPoint = null; private volatile BrowserHealthRecorder mHealthRecorder = null; abstract public int getLayout(); @@ -408,8 +404,8 @@ abstract public class GeckoApp @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - // Custom Menu should be opened when hardware menu key is pressed. - if (Build.VERSION.SDK_INT >= 11 && keyCode == KeyEvent.KEYCODE_MENU) { + // Handle hardware menu key presses separately so that we can show a custom menu in some cases. + if (keyCode == KeyEvent.KEYCODE_MENU) { openOptionsMenu(); return true; } @@ -500,7 +496,7 @@ abstract public class GeckoApp showReadingList(); } else if (event.equals("Gecko:Ready")) { mGeckoReadyStartupTimer.stop(); - connectGeckoLayerClient(); + geckoConnected(); } else if (event.equals("ToggleChrome:Hide")) { toggleChrome(false); } else if (event.equals("ToggleChrome:Show")) { @@ -1458,7 +1454,7 @@ abstract public class GeckoApp Tab selectedTab = Tabs.getInstance().getSelectedTab(); if (selectedTab != null) Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED); - connectGeckoLayerClient(); + geckoConnected(); GeckoAppShell.setLayerClient(mLayerView.getLayerClient()); GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Viewport:Flush", null)); } @@ -2190,46 +2186,13 @@ abstract public class GeckoApp GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Update:CheckResult", result)); } - protected void connectGeckoLayerClient() { - mLayerView.getLayerClient().notifyGeckoReady(); - - mLayerView.addTouchInterceptor(this); + protected void geckoConnected() { + mLayerView.geckoConnected(); } public void setAccessibilityEnabled(boolean enabled) { } - @Override - public boolean onInterceptTouchEvent(View view, MotionEvent event) { - return false; - } - - @Override - public boolean onTouch(View view, MotionEvent event) { - if (event == null) - return true; - - int action = event.getActionMasked(); - PointF point = new PointF(event.getX(), event.getY()); - if (action == MotionEvent.ACTION_DOWN) { - mInitialTouchPoint = point; - } - - if (mInitialTouchPoint != null && action == MotionEvent.ACTION_MOVE) { - if (PointUtils.subtract(point, mInitialTouchPoint).length() < - PanZoomController.PAN_THRESHOLD) { - // Don't send the touchmove event if if the users finger hasn't moved far. - // Necessary for Google Maps to work correctly. See bug 771099. - return true; - } else { - mInitialTouchPoint = null; - } - } - - GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event, false)); - return true; - } - public static class MainLayout extends RelativeLayout { private TouchEventInterceptor mTouchEventInterceptor; private MotionEventInterceptor mMotionEventInterceptor; diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index a29fb1424fc..e348a8d3b26 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -2467,28 +2467,14 @@ public class GeckoAppShell return true; } - static class AsyncResultHandler extends FilePickerResultHandler { - private long mId; - AsyncResultHandler(long id) { - super(null); - mId = id; - } - - @Override - public void onActivityResult(int resultCode, Intent data) { - GeckoAppShell.notifyFilePickerResult(handleActivityResult(resultCode, data), mId); - } - - } - static native void notifyFilePickerResult(String filePath, long id); - /* Called by JNI from AndroidBridge */ - public static void showFilePickerAsync(String aMimeType, long id) { - if (getGeckoInterface() != null) - if (!sActivityHelper.showFilePicker(getGeckoInterface().getActivity(), aMimeType, new AsyncResultHandler(id))) { - GeckoAppShell.notifyFilePickerResult("", id); + public static void showFilePickerAsync(String aMimeType, final long id) { + sActivityHelper.showFilePickerAsync(getGeckoInterface().getActivity(), aMimeType, new ActivityHandlerHelper.FileResultHandler() { + public void gotFile(String filename) { + GeckoAppShell.notifyFilePickerResult(filename, id); } + }); } public static void notifyWakeLockChanged(String topic, String state) { diff --git a/mobile/android/base/GeckoView.java b/mobile/android/base/GeckoView.java new file mode 100644 index 00000000000..414e85369e6 --- /dev/null +++ b/mobile/android/base/GeckoView.java @@ -0,0 +1,96 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * 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/. */ + +package org.mozilla.gecko; + +import org.mozilla.gecko.db.BrowserDB; +import org.mozilla.gecko.gfx.LayerView; +import org.mozilla.gecko.util.GeckoEventListener; +import org.mozilla.gecko.util.ThreadUtils; + +import org.json.JSONObject; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.net.Uri; +import android.os.Bundle; +import android.util.AttributeSet; +import android.util.Log; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.os.Handler; + +public class GeckoView extends LayerView + implements GeckoEventListener, ContextGetter { + static GeckoThread sGeckoThread; + + public GeckoView(Context context, AttributeSet attrs) { + super(context, attrs); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GeckoView); + String url = a.getString(R.styleable.GeckoView_url); + a.recycle(); + + Intent intent; + if (url == null) { + intent = new Intent(Intent.ACTION_MAIN); + } else { + intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(url)); + } + GeckoAppShell.setContextGetter(this); + if (context instanceof Activity) { + Tabs tabs = Tabs.getInstance(); + tabs.attachToActivity((Activity) context); + } + GeckoProfile profile = GeckoProfile.get(context); + BrowserDB.initialize(profile.getName()); + GeckoAppShell.registerEventListener("Gecko:Ready", this); + + sGeckoThread = new GeckoThread(intent, url); + ThreadUtils.setGeckoThread(sGeckoThread); + ThreadUtils.setUiThread(Thread.currentThread(), new Handler()); + initializeView(GeckoAppShell.getEventDispatcher()); + if (GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) { + GeckoAppShell.setLayerView(this); + sGeckoThread.start(); + } + } + + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + + if (hasFocus) { + setBackgroundDrawable(null); + } + } + + public void loadUrl(String uri) { + Tabs.getInstance().loadUrl(uri); + } + + public void handleMessage(String event, JSONObject message) { + if (event.equals("Gecko:Ready")) { + GeckoThread.setLaunchState(GeckoThread.LaunchState.GeckoRunning); + Tab selectedTab = Tabs.getInstance().getSelectedTab(); + if (selectedTab != null) + Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED); + geckoConnected(); + GeckoAppShell.setLayerClient(getLayerClient()); + GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Viewport:Flush", null)); + show(); + requestRender(); + } + } + + public static void setGeckoInterface(GeckoAppShell.GeckoInterface aGeckoInterface) { + GeckoAppShell.setGeckoInterface(aGeckoInterface); + } +} diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index 722f3d958f5..460235f1595 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -110,6 +110,7 @@ FENNEC_JAVA_FILES = \ GeckoJavaSampler.java \ GlobalHistory.java \ GeckoViewsFactory.java \ + GeckoView.java \ health/BrowserHealthRecorder.java \ InputMethods.java \ JavaAddonManager.java \ diff --git a/mobile/android/base/SiteIdentityPopup.java b/mobile/android/base/SiteIdentityPopup.java index c401e87f14a..ed6b4d51a3c 100644 --- a/mobile/android/base/SiteIdentityPopup.java +++ b/mobile/android/base/SiteIdentityPopup.java @@ -70,6 +70,11 @@ public class SiteIdentityPopup extends PopupWindow { private void init() { setBackgroundDrawable(new BitmapDrawable()); setOutsideTouchable(true); + + // Make the popup focusable so it doesn't inadvertently trigger click events elsewhere + // which may reshow the popup (see bug 785156) + setFocusable(true); + setWindowLayoutMode(HardwareUtils.isTablet() ? LayoutParams.WRAP_CONTENT : LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); diff --git a/mobile/android/base/WebAppImpl.java b/mobile/android/base/WebAppImpl.java index bb9d9e68f8d..25bcc348e29 100644 --- a/mobile/android/base/WebAppImpl.java +++ b/mobile/android/base/WebAppImpl.java @@ -215,8 +215,8 @@ public class WebAppImpl extends GeckoApp { } @Override - protected void connectGeckoLayerClient() { - super.connectGeckoLayerClient(); + protected void geckoConnected() { + super.geckoConnected(); getLayerView().setOverScrollMode(View.OVER_SCROLL_NEVER); } }; diff --git a/mobile/android/base/gfx/GeckoLayerClient.java b/mobile/android/base/gfx/GeckoLayerClient.java index d4c68546f2f..79ad45815e2 100644 --- a/mobile/android/base/gfx/GeckoLayerClient.java +++ b/mobile/android/base/gfx/GeckoLayerClient.java @@ -148,6 +148,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget public void destroy() { mPanZoomController.destroy(); + mMarginsAnimator.destroy(); } /** diff --git a/mobile/android/base/gfx/LayerMarginsAnimator.java b/mobile/android/base/gfx/LayerMarginsAnimator.java index 44300971293..ad3f5acf899 100644 --- a/mobile/android/base/gfx/LayerMarginsAnimator.java +++ b/mobile/android/base/gfx/LayerMarginsAnimator.java @@ -7,6 +7,7 @@ package org.mozilla.gecko.gfx; import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoEvent; +import org.mozilla.gecko.PrefsHelper; import org.mozilla.gecko.TouchEventInterceptor; import org.mozilla.gecko.util.FloatUtils; @@ -25,12 +26,12 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { private static final String LOGTAG = "GeckoLayerMarginsAnimator"; private static final float MS_PER_FRAME = 1000.0f / 60.0f; private static final long MARGIN_ANIMATION_DURATION = 250; + private static final String PREF_SHOW_MARGINS_THRESHOLD = "browser.ui.show-margins-threshold"; /* This is the proportion of the viewport rect, minus maximum margins, - * that should be used to be able to expose margins. This does not apply - * for hiding margins. + * that needs to be travelled before margins will be exposed. */ - private static final float SHOW_MARGINS_AREA = 0.25f; + private float SHOW_MARGINS_THRESHOLD = 0.20f; /* This rect stores the maximum value margins can grow to when scrolling */ private final RectF mMaxMargins; @@ -42,8 +43,11 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { private final DecelerateInterpolator mInterpolator; /* The GeckoLayerClient whose margins will be animated */ private final GeckoLayerClient mTarget; - /* The position of the first touch event */ - private final PointF mTouchStartPosition; + /* The distance that has been scrolled since either the first touch event, + * or since the margins were last fully hidden */ + private final PointF mTouchTravelDistance; + /* The ID of the prefs listener for the show-marginss threshold */ + private Integer mPrefObserverId; public LayerMarginsAnimator(GeckoLayerClient aTarget, LayerView aView) { // Assign member variables from parameters @@ -52,12 +56,32 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { // Create other member variables mMaxMargins = new RectF(); mInterpolator = new DecelerateInterpolator(); - mTouchStartPosition = new PointF(); + mTouchTravelDistance = new PointF(); + + // Listen to the dynamic toolbar pref + mPrefObserverId = PrefsHelper.getPref(PREF_SHOW_MARGINS_THRESHOLD, new PrefsHelper.PrefHandlerBase() { + @Override + public void prefValue(String pref, int value) { + SHOW_MARGINS_THRESHOLD = (float)value / 100.0f; + } + + @Override + public boolean isObserver() { + return true; + } + }); // Listen to touch events, for auto-pinning aView.addTouchInterceptor(this); } + public void destroy() { + if (mPrefObserverId != null) { + PrefsHelper.removeObserver(mPrefObserverId); + mPrefObserverId = null; + } + } + /** * Sets the maximum values for margins to grow to, in pixels. */ @@ -154,17 +178,16 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { * aMargins are in/out parameters. In specifies the current margin size, * and out specifies the modified margin size. They are specified in the * order of start-margin, then end-margin. - * This function will also take into account what touch initiated this - * scroll and react accordingly. If a scroll was initiated from a point - * outisde of the active area of the viewport, margins can only be hidden - * and not shown. + * This function will also take into account how far the touch point has + * moved and react accordingly. If a touch point hasn't moved beyond a + * certain threshold, margins can only be hidden and not shown. * aNegativeOffset can be used if the remaining delta should be determined * by the end-margin instead of the start-margin (for example, in rtl * pages). */ private float scrollMargin(float[] aMargins, float aDelta, float aOverscrollStart, float aOverscrollEnd, - float aTouchCoordinate, + float aTouchTravelDistance, float aViewportStart, float aViewportEnd, float aPageStart, float aPageEnd, float aMaxMarginStart, float aMaxMarginEnd, @@ -172,23 +195,21 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { float marginStart = aMargins[0]; float marginEnd = aMargins[1]; float viewportSize = aViewportEnd - aViewportStart; - float activeArea = viewportSize * SHOW_MARGINS_AREA; + float exposeThreshold = viewportSize * SHOW_MARGINS_THRESHOLD; if (aDelta >= 0) { float marginDelta = Math.max(0, aDelta - aOverscrollStart); aMargins[0] = marginStart - Math.min(marginDelta, marginStart); - if (aTouchCoordinate < viewportSize - activeArea) { - // In the situation that the touch started outside of the - // active area for exposing this margin, we only want the - // margin to be exposed when reaching the extremity of the - // page. + if (aTouchTravelDistance < exposeThreshold && marginEnd == 0) { + // We only want the margin to be newly exposed after the touch + // has moved a certain distance. marginDelta = Math.max(0, marginDelta - (aPageEnd - aViewportEnd)); } aMargins[1] = marginEnd + Math.min(marginDelta, aMaxMarginEnd - marginEnd); } else { float marginDelta = Math.max(0, -aDelta - aOverscrollEnd); aMargins[1] = marginEnd - Math.min(marginDelta, marginEnd); - if (aTouchCoordinate > activeArea) { + if (-aTouchTravelDistance < exposeThreshold && marginStart == 0) { marginDelta = Math.max(0, marginDelta - (aViewportStart - aPageStart)); } aMargins[0] = marginStart + Math.min(marginDelta, aMaxMarginStart - marginStart); @@ -216,12 +237,22 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { // Only alter margins if the toolbar isn't pinned if (!mMarginsPinned) { + // Reset the touch travel when changing direction + if ((aDx >= 0) != (mTouchTravelDistance.x >= 0)) { + mTouchTravelDistance.x = 0; + } + if ((aDy >= 0) != (mTouchTravelDistance.y >= 0)) { + mTouchTravelDistance.y = 0; + } + + mTouchTravelDistance.offset(aDx, aDy); RectF overscroll = aMetrics.getOverscroll(); + // Only allow margins to scroll if the page can fill the viewport. if (aMetrics.getPageWidth() >= aMetrics.getWidth()) { aDx = scrollMargin(newMarginsX, aDx, overscroll.left, overscroll.right, - mTouchStartPosition.x, + mTouchTravelDistance.x, aMetrics.viewportRectLeft, aMetrics.viewportRectRight, aMetrics.pageRectLeft, aMetrics.pageRectRight, mMaxMargins.left, mMaxMargins.right, @@ -230,7 +261,7 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { if (aMetrics.getPageHeight() >= aMetrics.getHeight()) { aDy = scrollMargin(newMarginsY, aDy, overscroll.top, overscroll.bottom, - mTouchStartPosition.y, + mTouchTravelDistance.y, aMetrics.viewportRectTop, aMetrics.viewportRectBottom, aMetrics.pageRectTop, aMetrics.pageRectBottom, mMaxMargins.top, mMaxMargins.bottom, @@ -252,7 +283,7 @@ public class LayerMarginsAnimator implements TouchEventInterceptor { public boolean onInterceptTouchEvent(View view, MotionEvent event) { int action = event.getActionMasked(); if (action == MotionEvent.ACTION_DOWN && event.getPointerCount() == 1) { - mTouchStartPosition.set(event.getX(), event.getY()); + mTouchTravelDistance.set(0.0f, 0.0f); } return false; diff --git a/mobile/android/base/gfx/LayerView.java b/mobile/android/base/gfx/LayerView.java index a880b1677ac..bd8622741ea 100644 --- a/mobile/android/base/gfx/LayerView.java +++ b/mobile/android/base/gfx/LayerView.java @@ -7,6 +7,7 @@ package org.mozilla.gecko.gfx; import org.mozilla.gecko.GeckoAccessibility; import org.mozilla.gecko.GeckoAppShell; +import org.mozilla.gecko.GeckoEvent; import org.mozilla.gecko.R; import org.mozilla.gecko.TouchEventInterceptor; import org.mozilla.gecko.ZoomConstraints; @@ -117,6 +118,45 @@ public class LayerView extends FrameLayout { GeckoAccessibility.setDelegate(this); } + public void geckoConnected() { + mLayerClient.notifyGeckoReady(); + addTouchInterceptor(new TouchEventInterceptor() { + private PointF mInitialTouchPoint = null; + + @Override + public boolean onInterceptTouchEvent(View view, MotionEvent event) { + return false; + } + + @Override + public boolean onTouch(View view, MotionEvent event) { + if (event == null) { + return true; + } + + int action = event.getActionMasked(); + PointF point = new PointF(event.getX(), event.getY()); + if (action == MotionEvent.ACTION_DOWN) { + mInitialTouchPoint = point; + } + + if (mInitialTouchPoint != null && action == MotionEvent.ACTION_MOVE) { + if (PointUtils.subtract(point, mInitialTouchPoint).length() < + PanZoomController.PAN_THRESHOLD) { + // Don't send the touchmove event if if the users finger hasn't moved far. + // Necessary for Google Maps to work correctly. See bug 771099. + return true; + } else { + mInitialTouchPoint = null; + } + } + + GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event, false)); + return true; + } + }); + } + public void show() { // Fix this if TextureView support is turned back on above mSurfaceView.setVisibility(View.VISIBLE); diff --git a/mobile/android/base/locales/en-US/android_strings.dtd b/mobile/android/base/locales/en-US/android_strings.dtd index 570fa4462fe..1d326027fdb 100644 --- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -16,11 +16,11 @@ - + - + diff --git a/mobile/android/base/mozglue/GeckoLoader.java.in b/mobile/android/base/mozglue/GeckoLoader.java.in index 575faea7655..93b7ced2f4c 100644 --- a/mobile/android/base/mozglue/GeckoLoader.java.in +++ b/mobile/android/base/mozglue/GeckoLoader.java.in @@ -205,6 +205,13 @@ public final class GeckoLoader { putenv("MOZ_LINKER_CACHE=" + linkerCache); } + // Disable on-demand decompression of the linker on devices where it + // is known to cause crashes. + if ("samsung".equals(android.os.Build.MANUFACTURER) && + "GT-I9505".equals(android.os.Build.MODEL)) { + putenv("MOZ_LINKER_ONDEMAND=0"); + } + #ifdef MOZ_LINKER_EXTRACT putenv("MOZ_LINKER_EXTRACT=1"); // Ensure that the cache dir is world-writable diff --git a/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml b/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml index b5c9d9d23ea..f3f194bf4d1 100644 --- a/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml +++ b/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml @@ -150,6 +150,7 @@ android:layout_height="2dp" android:layout_alignParentBottom="true" android:background="@drawable/address_bar_bg_shadow_repeat" + android:contentDescription="@null" android:visibility="gone"/> diff --git a/mobile/android/base/resources/layout/browser_toolbar.xml b/mobile/android/base/resources/layout/browser_toolbar.xml index 44c316e560a..bc67ab4fff6 100644 --- a/mobile/android/base/resources/layout/browser_toolbar.xml +++ b/mobile/android/base/resources/layout/browser_toolbar.xml @@ -155,6 +155,7 @@ android:layout_height="2dp" android:layout_alignParentBottom="true" android:background="@drawable/address_bar_bg_shadow_repeat" + android:contentDescription="@null" android:visibility="gone"/> diff --git a/mobile/android/base/resources/layout/crash_reporter.xml b/mobile/android/base/resources/layout/crash_reporter.xml index bf2b0d7f63c..1b4aa65e9ab 100644 --- a/mobile/android/base/resources/layout/crash_reporter.xml +++ b/mobile/android/base/resources/layout/crash_reporter.xml @@ -40,7 +40,7 @@ android:checked="true" android:textColor="@color/primary_text" android:layout_marginBottom="10dp" - android:text="@string/crash_send_report_message2"/> + android:text="@string/crash_send_report_message3"/> + android:text="@string/crash_allow_contact2"/> &aboutPage.checkForUpdates.checking; &aboutPage.checkForUpdates.none; - &aboutPage.checkForUpdates.available; + &aboutPage.checkForUpdates.available2; &aboutPage.checkForUpdates.downloading; - &aboutPage.checkForUpdates.downloaded; + &aboutPage.checkForUpdates.downloaded2; #endif diff --git a/mobile/android/chrome/content/downloads.js b/mobile/android/chrome/content/downloads.js index ac980b5b8f1..0b9a5a09f43 100644 --- a/mobile/android/chrome/content/downloads.js +++ b/mobile/android/chrome/content/downloads.js @@ -16,6 +16,7 @@ var Downloads = { _dlmgr: null, _progressAlert: null, _privateDownloads: [], + isForeground : true, _getLocalFile: function dl__getLocalFile(aFileURI) { // if this is a URL, get the file from that @@ -33,8 +34,9 @@ var Downloads = { this._dlmgr = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager); this._progressAlert = new AlertDownloadProgressListener(); this._dlmgr.addPrivacyAwareListener(this._progressAlert); - Services.obs.addObserver(this, "xpcom-shutdown", true); Services.obs.addObserver(this, "last-pb-context-exited", true); + Services.obs.addObserver(this, "application-background", false); + Services.obs.addObserver(this, "application-foreground", false); }, openDownload: function dl_openDownload(aDownload) { @@ -105,16 +107,29 @@ var Downloads = { // observer for last-pb-context-exited observe: function dl_observe(aSubject, aTopic, aData) { - let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService); - let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener); - let download; - while ((download = this._privateDownloads.pop())) { - try { - let notificationName = download.target.spec.replace("file:", "download:"); - progressListener.onCancel(notificationName); - } catch (e) { - dump("Error removing private download: " + e); + switch (aTopic) { + case "last-pb-context-exited": { + let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService); + let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener); + let download; + while ((download = this._privateDownloads.pop())) { + try { + let notificationName = download.target.spec.replace("file:", "download:"); + progressListener.onCancel(notificationName); + } catch (e) { + dump("Error removing private download: " + e); + } + } + break; } + + case "application-foreground": + this.isForeground = true; + break; + + case "application-background": + this.isForeground = false; + break; } }, @@ -183,7 +198,10 @@ AlertDownloadProgressListener.prototype = { } } - if (state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED) { + // We want to show the download finished notification only if it is not automatically opened. + // A download is automatically opened if it has a default handler and fennec is in foreground. + if (state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED && + !(aDownload.MIMEInfo.hasDefaultHandler && Downloads.isForeground)) { Downloads.showAlert(aDownload, Strings.browser.GetStringFromName("alertDownloadsDone2"), aDownload.displayName); } diff --git a/mobile/android/components/FilePicker.js b/mobile/android/components/FilePicker.js new file mode 100644 index 00000000000..24b0b60ef09 --- /dev/null +++ b/mobile/android/components/FilePicker.js @@ -0,0 +1,247 @@ +/* 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/. */ + +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cc = Components.classes; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/FileUtils.jsm"); + +function FilePicker() { +} + +FilePicker.prototype = { + _mimeTypeFilter: 0, + _extensionsFilter: "", + _defaultString: "", + _domWin: null, + _defaultExtension: null, + _displayDirectory: null, + _filePath: null, + _promptActive: false, + _filterIndex: 0, + + init: function(aParent, aTitle, aMode) { + this._domWin = aParent; + Services.obs.addObserver(this, "FilePicker:Result", false); + + let idService = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator); + this.guid = idService.generateUUID().toString(); + + if (aMode != Ci.nsIFilePicker.modeOpen && aMode != Ci.nsIFilePicker.modeOpenMultiple) + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + appendFilters: function(aFilterMask) { + if (aFilterMask & Ci.nsIFilePicker.filterAudio) { + this._mimeTypeFilter = "audio/*"; + return; + } + + if (aFilterMask & Ci.nsIFilePicker.filterImages) { + this._mimeTypeFilter = "image/*"; + return; + } + + if (aFilterMask & Ci.nsIFilePicker.filterVideo) { + this._mimeTypeFilter = "video/*"; + return; + } + + if (aFilterMask & Ci.nsIFilePicker.filterAll) { + this._mimeTypeFilter = "*/*"; + return; + } + + /* From BaseFilePicker.cpp */ + if (aFilterMask & Ci.nsIFilePicker.filterHTML) { + this.appendFilter("*.html; *.htm; *.shtml; *.xhtml"); + } + if (aFilterMask & Ci.nsIFilePicker.filterText) { + this.appendFilter("*.txt; *.text"); + } + + if (aFilterMask & Ci.nsIFilePicker.filterXML) { + this.appendFilter("*.xml"); + } + + if (aFilterMask & Ci.nsIFilePicker.xulFilter) { + this.appendFilter("*.xul"); + } + + if (aFilterMask & Ci.nsIFilePicker.xulFilter) { + this.appendFilter("..apps"); + } + }, + + appendFilter: function(title, filter) { + if (this._extensionsFilter) + this._extensionsFilter += ", "; + this._extensionsFilter += filter; + }, + + get defaultString() { + return this._defaultString; + }, + + set defaultString(defaultString) { + this._defaultString = defaultString; + }, + + get defaultExtension() { + return this._defaultExtension; + }, + + set defaultExtension(defaultExtension) { + this._defaultExtension = defaultExtension; + }, + + get filterIndex() { + return this._filterIndex; + }, + + set filterIndex(val) { + this._filterIndex = val; + }, + + get displayDirectory() { + return this._displayDirectory; + }, + + set displayDirectory(dir) { + this._displayDirectory = dir; + }, + + get file() { + if (!this._filePath) { + return null; + } + + return new FileUtils.File(this._filePath); + }, + + get fileURL() { + let file = this.getFile(); + return Services.io.newFileURI(file); + }, + + get files() { + return this.getEnumerator([this.file], function(file) { + return file; + }); + }, + + get domfile() { + let f = this.file; + if (!f) { + return null; + } + return File(f); + }, + + get domfiles() { + return this.getEnumerator([this.file], function(file) { + return File(file); + }); + }, + + get addToRecentDocs() { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + set addToRecentDocs(val) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + + show: function() { + if (this._domWin) { + PromptUtils.fireDialogEvent(this._domWin, "DOMWillOpenModalDialog"); + let winUtils = this._domWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); + callerWin = winUtils.enterModalStateWithWindow(); + } + + this._promptActive = true; + this._sendMessage(); + + let thread = Services.tm.currentThread; + while (this._promptActive) + thread.processNextEvent(true); + delete this._promptActive; + + if (this._filePath) + return Ci.nsIFilePicker.returnOK; + + return Ci.nsIFilePicker.returnCancel; + }, + + open: function(callback) { + this._callback = callback; + this._sendMessage(); + }, + + _sendMessage: function() { + let msg = { + type: "FilePicker:Show", + guid: this.guid + }; + if (!this._extensionsFilter && !this._mimeTypeFilter) { + // If neither filters is set show anything we can. + msg.mode = "mimeType"; + msg.mimeType = "*/*"; + } else if (this._extensionsFilter) { + msg.mode = "extension"; + msg.extensions = this._extensionsFilter; + } else { + msg.mode = "mimeType"; + msg.mimeType = this._mimeTypeFilter; + } + + this.sendMessageToJava(msg); + }, + + sendMessageToJava: function(aMsg) { + Cc["@mozilla.org/android/bridge;1"].getService(Ci.nsIAndroidBridge).handleGeckoMessage(JSON.stringify(aMsg)); + }, + + observe: function(aSubject, aTopic, aData) { + let data = JSON.parse(aData); + if (data.guid != this.guid) + return; + + this._filePath = null; + if (data.file) + this._filePath = data.file; + + this._promptActive = false; + + if (this._callback) { + this._callback.done(this._filePath ? Ci.nsIFilePicker.returnOK : Ci.nsIFilePicker.returnCancel); + } + delete this._callback; + }, + + getEnumerator: function(files, mapFunction) { + return { + QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator]), + mFiles: files, + mIndex: 0, + hasMoreElements: function() { + return (this.mIndex < this.mFiles.length); + }, + getNext: function() { + if (this.mIndex >= this.mFiles.length) { + throw Components.results.NS_ERROR_FAILURE; + } + return map(this.mFiles[this.mIndex++]); + } + }; + }, + + classID: Components.ID("{18a4e042-7c7c-424b-a583-354e68553a7f}"), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIFilePicker, Ci.nsIObserver]) +}; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FilePicker]); diff --git a/mobile/android/components/Makefile.in b/mobile/android/components/Makefile.in index 0920b030175..b6644a6d890 100644 --- a/mobile/android/components/Makefile.in +++ b/mobile/android/components/Makefile.in @@ -32,6 +32,7 @@ EXTRA_COMPONENTS = \ NSSDialogService.js \ SiteSpecificUserAgent.js \ PaymentsUI.js \ + FilePicker.js \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mobile/android/components/MobileComponents.manifest b/mobile/android/components/MobileComponents.manifest index 92f680f36ae..b25c1c70d6d 100644 --- a/mobile/android/components/MobileComponents.manifest +++ b/mobile/android/components/MobileComponents.manifest @@ -102,3 +102,6 @@ contract @mozilla.org/dom/site-specific-user-agent;1 {d5234c9d-0ee2-4b3c-9da3-18 component {3c6c9575-f57e-427b-a8aa-57bc3cbff48f} PaymentsUI.js contract @mozilla.org/payment/ui-glue;1 {3c6c9575-f57e-427b-a8aa-57bc3cbff48f} +# FilePicker.js +component {18a4e042-7c7c-424b-a583-354e68553a7f} FilePicker.js +contract @mozilla.org/filepicker;1 {18a4e042-7c7c-424b-a583-354e68553a7f} diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index adcd4ca33dc..5f14d29d43c 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -156,9 +156,6 @@ @BINPATH@/components/exthelper.xpt @BINPATH@/components/fastfind.xpt @BINPATH@/components/feeds.xpt -#ifdef MOZ_GTK2 -@BINPATH@/components/filepicker.xpt -#endif @BINPATH@/components/find.xpt @BINPATH@/components/fuel.xpt @BINPATH@/components/gfx.xpt @@ -296,10 +293,6 @@ @BINPATH@/components/crypto-SDR.js @BINPATH@/components/jsconsole-clhandler.manifest @BINPATH@/components/jsconsole-clhandler.js -#ifdef MOZ_GTK2 -@BINPATH@/components/nsFilePicker.manifest -@BINPATH@/components/nsFilePicker.js -#endif @BINPATH@/components/nsHelperAppDlg.manifest @BINPATH@/components/nsHelperAppDlg.js @BINPATH@/components/nsDownloadManagerUI.manifest @@ -351,8 +344,6 @@ @BINPATH@/components/contentAreaDropListener.js @BINPATH@/components/messageWakeupService.js @BINPATH@/components/messageWakeupService.manifest -@BINPATH@/components/nsFilePicker.js -@BINPATH@/components/nsFilePicker.manifest #ifdef MOZ_ENABLE_DBUS @BINPATH@/components/@DLL_PREFIX@dbusservice@DLL_SUFFIX@ #endif @@ -559,6 +550,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@ @BINPATH@/components/ContentPermissionPrompt.js @BINPATH@/components/DirectoryProvider.js @BINPATH@/components/DownloadManagerUI.js +@BINPATH@/components/FilePicker.js @BINPATH@/components/HelperAppDialog.js @BINPATH@/components/LoginManagerPrompter.js @BINPATH@/components/MobileComponents.manifest diff --git a/mobile/android/locales/en-US/chrome/about.dtd b/mobile/android/locales/en-US/chrome/about.dtd index ac0fd7b13d2..6deed8c24ab 100644 --- a/mobile/android/locales/en-US/chrome/about.dtd +++ b/mobile/android/locales/en-US/chrome/about.dtd @@ -9,9 +9,9 @@ - + - + diff --git a/mobile/android/themes/core/aboutReader.css b/mobile/android/themes/core/aboutReader.css index 80315382ddc..9a1234ca16e 100644 --- a/mobile/android/themes/core/aboutReader.css +++ b/mobile/android/themes/core/aboutReader.css @@ -9,8 +9,8 @@ html { body { margin-top: 20px; margin-bottom: 20px; - -moz-transition-property: background-color, color; - -moz-transition-duration: 0.7s; + transition-property: background-color, color; + transition-duration: 0.4s; } .light { @@ -109,25 +109,25 @@ body { } .font-size1 > .header > h1 { - font-size: 25px; -} - -.font-size2 > .header > h1 { font-size: 27px; } -.font-size3 > .header > h1 { +.font-size2 > .header > h1 { font-size: 29px; } -.font-size4 > .header > h1 { +.font-size3 > .header > h1 { font-size: 31px; } -.font-size5 > .header > h1 { +.font-size4 > .header > h1 { font-size: 33px; } +.font-size5 > .header > h1 { + font-size: 35px; +} + /* This covers caption, domain, and credits texts in the reader UI */ @@ -135,35 +135,35 @@ body { .font-size1 > .content figcaption, .font-size1 > .header > .domain, .font-size1 > .header > .credits { - font-size: 8px; + font-size: 10px; } .font-size2 > .content .wp-caption-text, .font-size2 > .content figcaption, .font-size2 > .header > .domain, .font-size2 > .header > .credits { - font-size: 11px; + font-size: 13px; } .font-size3 > .content .wp-caption-text, .font-size3 > .content figcaption, .font-size3 > .header > .domain, .font-size3 > .header > .credits { - font-size: 13px; + font-size: 15px; } .font-size4 > .content .wp-caption-text, .font-size4 > .content figcaption, .font-size4 > .header > .domain, .font-size4 > .header > .credits { - font-size: 15px; + font-size: 17px; } .font-size5 > .content .wp-caption-text, .font-size5 > .content figcaption, .font-size5 > .header > .domain, .font-size5 > .header > .credits { - font-size: 17px; + font-size: 19px; } .content { @@ -298,33 +298,33 @@ body { .font-size1-sample, .font-size1 > .content { - font-size: 12px !important; + font-size: 14px !important; } .font-size2-sample, .font-size2 > .content { - font-size: 14px !important; + font-size: 16px !important; } .font-size3-sample, .font-size3 > .content { - font-size: 16px !important; + font-size: 18px !important; } .font-size4-sample, .font-size4 > .content { - font-size: 18px !important; + font-size: 20px !important; } .font-size5-sample, .font-size5 > .content { - font-size: 20px !important; + font-size: 22px !important; } .toolbar { font-family: "Droid Sans",helvetica,arial,clean,sans-serif; - -moz-transition-property: visibility, opacity; - -moz-transition-duration: 0.7s; + transition-property: visibility, opacity; + transition-duration: 0.7s; visibility: visible; opacity: 1.0; position: fixed; @@ -338,8 +338,8 @@ body { } .toolbar-hidden { - -moz-transition-property: visibility, opacity; - -moz-transition-duration: 0.7s; + transition-property: visibility, opacity; + transition-duration: 0.7s; visibility: hidden; opacity: 0.0; } diff --git a/mobile/android/themes/core/touchcontrols.css b/mobile/android/themes/core/touchcontrols.css index cbe21c828f1..49a4fd2af47 100644 --- a/mobile/android/themes/core/touchcontrols.css +++ b/mobile/android/themes/core/touchcontrols.css @@ -149,8 +149,8 @@ /* CSS Transitions */ .controlBar:not([immediate]) { - -moz-transition-property: opacity; - -moz-transition-duration: 200ms; + transition-property: opacity; + transition-duration: 200ms; } .controlBar[fadeout] { @@ -158,9 +158,9 @@ } .statusOverlay:not([immediate]) { - -moz-transition-property: opacity; - -moz-transition-duration: 300ms; - -moz-transition-delay: 750ms; + transition-property: opacity; + transition-duration: 300ms; + transition-delay: 750ms; } .statusOverlay[fadeout] { diff --git a/mobile/locales/en-US/chrome/region.properties b/mobile/locales/en-US/chrome/region.properties index dcec7a0deb8..8be4999ace0 100644 --- a/mobile/locales/en-US/chrome/region.properties +++ b/mobile/locales/en-US/chrome/region.properties @@ -21,7 +21,7 @@ gecko.handlerService.schemes.webcal.0.uriTemplate=http://30boxes.com/external/wi # The default set of protocol handlers for mailto: gecko.handlerService.schemes.mailto.0.name=Yahoo! Mail -gecko.handlerService.schemes.mailto.0.uriTemplate=http://compose.mail.yahoo.com/?To=%s +gecko.handlerService.schemes.mailto.0.uriTemplate=https://compose.mail.yahoo.com/?To=%s gecko.handlerService.schemes.mailto.1.name=Gmail gecko.handlerService.schemes.mailto.1.uriTemplate=https://mail.google.com/mail/?extsrc=mailto&url=%s diff --git a/mozglue/linker/CustomElf.cpp b/mozglue/linker/CustomElf.cpp index 158d9f9d740..763739dce52 100644 --- a/mozglue/linker/CustomElf.cpp +++ b/mozglue/linker/CustomElf.cpp @@ -428,6 +428,14 @@ CustomElf::LoadSegment(const Phdr *pt_load) const return false; } + /* Ensure the availability of all pages within the mapping if on-demand + * decompression is disabled (MOZ_LINKER_ONDEMAND=0). */ + const char *ondemand = getenv("MOZ_LINKER_ONDEMAND"); + if (ondemand && !strncmp(ondemand, "0", 2 /* Including '\0' */)) { + for (Addr off = 0; off < pt_load->p_filesz; off += PAGE_SIZE) { + mappable->ensure(reinterpret_cast(mapped) + off); + } + } /* When p_memsz is greater than p_filesz, we need to have nulled out memory * after p_filesz and before p_memsz. * Mappable::mmap already guarantees that after p_filesz and up to the end diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index dfe9cdb0584..42d2e8d0ec7 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -77,6 +77,21 @@ static const char kHttpOnlyPrefix[] = "#HttpOnly_"; #define COOKIES_FILE "cookies.sqlite" #define COOKIES_SCHEMA_VERSION 5 +// parameter indexes; see EnsureReadDomain, EnsureReadComplete and +// ReadCookieDBListener::HandleResult +#define IDX_NAME 0 +#define IDX_VALUE 1 +#define IDX_HOST 2 +#define IDX_PATH 3 +#define IDX_EXPIRY 4 +#define IDX_LAST_ACCESSED 5 +#define IDX_CREATION_TIME 6 +#define IDX_SECURE 7 +#define IDX_HTTPONLY 8 +#define IDX_BASE_DOMAIN 9 +#define IDX_APP_ID 10 +#define IDX_BROWSER_ELEM 11 + static const int64_t kCookieStaleThreshold = 60 * PR_USEC_PER_SEC; // 1 minute in microseconds static const int64_t kCookiePurgeAge = int64_t(30 * 24 * 60 * 60) * PR_USEC_PER_SEC; // 30 days in microseconds @@ -486,9 +501,9 @@ public: break; CookieDomainTuple *tuple = mDBState->hostArray.AppendElement(); - row->GetUTF8String(9, tuple->key.mBaseDomain); - tuple->key.mAppId = static_cast(row->AsInt32(10)); - tuple->key.mInBrowserElement = static_cast(row->AsInt32(11)); + row->GetUTF8String(IDX_BASE_DOMAIN, tuple->key.mBaseDomain); + tuple->key.mAppId = static_cast(row->AsInt32(IDX_APP_ID)); + tuple->key.mInBrowserElement = static_cast(row->AsInt32(IDX_BROWSER_ELEM)); tuple->cookie = gCookieService->GetCookieFromRow(row); } @@ -846,6 +861,8 @@ nsCookieService::TryInitDB(bool aRecreateDB) // Compute the baseDomains for the table. This must be done eagerly // otherwise we won't be able to synchronously read in individual // domains on demand. + const int64_t SCHEMA2_IDX_ID = 0; + const int64_t SCHEMA2_IDX_HOST = 1; nsCOMPtr select; rv = mDefaultDBState->dbConn->CreateStatement(NS_LITERAL_CSTRING( "SELECT id, host FROM moz_cookies"), getter_AddRefs(select)); @@ -866,8 +883,8 @@ nsCookieService::TryInitDB(bool aRecreateDB) if (!hasResult) break; - int64_t id = select->AsInt64(0); - select->GetUTF8String(1, host); + int64_t id = select->AsInt64(SCHEMA2_IDX_ID); + select->GetUTF8String(SCHEMA2_IDX_HOST, host); rv = GetBaseDomainFromHost(host, baseDomain); NS_ENSURE_SUCCESS(rv, RESULT_RETRY); @@ -905,6 +922,10 @@ nsCookieService::TryInitDB(bool aRecreateDB) // Select the whole table, and order by the fields we're interested in. // This means we can simply do a linear traversal of the results and // check for duplicates as we go. + const int64_t SCHEMA3_IDX_ID = 0; + const int64_t SCHEMA3_IDX_NAME = 1; + const int64_t SCHEMA3_IDX_HOST = 2; + const int64_t SCHEMA3_IDX_PATH = 3; nsCOMPtr select; rv = mDefaultDBState->dbConn->CreateStatement(NS_LITERAL_CSTRING( "SELECT id, name, host, path FROM moz_cookies " @@ -925,10 +946,10 @@ nsCookieService::TryInitDB(bool aRecreateDB) if (hasResult) { nsCString name1, host1, path1; - int64_t id1 = select->AsInt64(0); - select->GetUTF8String(1, name1); - select->GetUTF8String(2, host1); - select->GetUTF8String(3, path1); + int64_t id1 = select->AsInt64(SCHEMA3_IDX_ID); + select->GetUTF8String(SCHEMA3_IDX_NAME, name1); + select->GetUTF8String(SCHEMA3_IDX_HOST, host1); + select->GetUTF8String(SCHEMA3_IDX_PATH, path1); nsCString name2, host2, path2; while (1) { @@ -939,10 +960,10 @@ nsCookieService::TryInitDB(bool aRecreateDB) if (!hasResult) break; - int64_t id2 = select->AsInt64(0); - select->GetUTF8String(1, name2); - select->GetUTF8String(2, host2); - select->GetUTF8String(3, path2); + int64_t id2 = select->AsInt64(SCHEMA3_IDX_ID); + select->GetUTF8String(SCHEMA3_IDX_NAME, name2); + select->GetUTF8String(SCHEMA3_IDX_HOST, host2); + select->GetUTF8String(SCHEMA3_IDX_PATH, path2); // If the two rows match in (name, host, path), we know the earlier // row has an earlier expiry time. Delete it. @@ -1978,20 +1999,20 @@ nsCookieService::GetCookieFromRow(T &aRow) { // Skip reading 'baseDomain' -- up to the caller. nsCString name, value, host, path; - DebugOnly rv = aRow->GetUTF8String(0, name); + DebugOnly rv = aRow->GetUTF8String(IDX_NAME, name); NS_ASSERT_SUCCESS(rv); - rv = aRow->GetUTF8String(1, value); + rv = aRow->GetUTF8String(IDX_VALUE, value); NS_ASSERT_SUCCESS(rv); - rv = aRow->GetUTF8String(2, host); + rv = aRow->GetUTF8String(IDX_HOST, host); NS_ASSERT_SUCCESS(rv); - rv = aRow->GetUTF8String(3, path); + rv = aRow->GetUTF8String(IDX_PATH, path); NS_ASSERT_SUCCESS(rv); - int64_t expiry = aRow->AsInt64(4); - int64_t lastAccessed = aRow->AsInt64(5); - int64_t creationTime = aRow->AsInt64(6); - bool isSecure = 0 != aRow->AsInt32(7); - bool isHttpOnly = 0 != aRow->AsInt32(8); + int64_t expiry = aRow->AsInt64(IDX_EXPIRY); + int64_t lastAccessed = aRow->AsInt64(IDX_LAST_ACCESSED); + int64_t creationTime = aRow->AsInt64(IDX_CREATION_TIME); + bool isSecure = 0 != aRow->AsInt32(IDX_SECURE); + bool isHttpOnly = 0 != aRow->AsInt32(IDX_HTTPONLY); // Create a new nsCookie and assign the data. return nsCookie::Create(name, value, host, path, @@ -2083,6 +2104,7 @@ nsCookieService::EnsureReadDomain(const nsCookieKey &aKey) return; // Read in the data synchronously. + // see IDX_NAME, etc. for parameter indexes nsresult rv; if (!mDefaultDBState->stmtReadDomain) { // Cache the statement, since it's likely to be used again. @@ -2177,6 +2199,7 @@ nsCookieService::EnsureReadComplete() CancelAsyncRead(false); // Read in the data synchronously. + // see IDX_NAME, etc. for parameter indexes nsCOMPtr stmt; nsresult rv = mDefaultDBState->syncConn->CreateStatement(NS_LITERAL_CSTRING( "SELECT " @@ -2223,9 +2246,9 @@ nsCookieService::EnsureReadComplete() break; // Make sure we haven't already read the data. - stmt->GetUTF8String(9, baseDomain); - appId = static_cast(stmt->AsInt32(10)); - inBrowserElement = static_cast(stmt->AsInt32(11)); + stmt->GetUTF8String(IDX_BASE_DOMAIN, baseDomain); + appId = static_cast(stmt->AsInt32(IDX_APP_ID)); + inBrowserElement = static_cast(stmt->AsInt32(IDX_BROWSER_ELEM)); nsCookieKey key(baseDomain, appId, inBrowserElement); if (mDefaultDBState->readSet.GetEntry(key)) continue; diff --git a/security/build/Makefile.in b/security/build/Makefile.in index b692ff79507..81b1e2a6ddb 100644 --- a/security/build/Makefile.in +++ b/security/build/Makefile.in @@ -141,6 +141,9 @@ DEFAULT_GMAKE_FLAGS += NSINSTALL="$(NSINSTALL)" ifeq ($(OS_ARCH),WINNT) DEFAULT_GMAKE_FLAGS += INSTALL="$(NSINSTALL) -t" endif +ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1) +DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS="-static-libgcc" +endif ifndef MOZ_NATIVE_SQLITE ifdef MOZ_FOLD_LIBS DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=nss3 diff --git a/security/manager/locales/en-US/chrome/pippki/pippki.dtd b/security/manager/locales/en-US/chrome/pippki/pippki.dtd index e6d42b34b2b..5ae9da79b01 100644 --- a/security/manager/locales/en-US/chrome/pippki/pippki.dtd +++ b/security/manager/locales/en-US/chrome/pippki/pippki.dtd @@ -46,10 +46,6 @@ - - - - diff --git a/security/manager/locales/en-US/chrome/pippki/pippki.properties b/security/manager/locales/en-US/chrome/pippki/pippki.properties index 0088d65b620..4d8445d2e66 100644 --- a/security/manager/locales/en-US/chrome/pippki/pippki.properties +++ b/security/manager/locales/en-US/chrome/pippki/pippki.properties @@ -190,3 +190,7 @@ addExceptionCheckingLong=Attempting to identify the site… addExceptionNoCertShort=No Information Available addExceptionNoCertLong=Unable to obtain identification status for the given site. addExceptionConnectionFailed=Connection Failed + +#Certificate Exists in database +caCertExistsTitle=Certificate Exists +caCertExistsMessage=The Certificate already exists. diff --git a/security/manager/pki/resources/content/cacertexists.xul b/security/manager/pki/resources/content/cacertexists.xul deleted file mode 100644 index d9ade61535e..00000000000 --- a/security/manager/pki/resources/content/cacertexists.xul +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - &caCertExists.message; - - - diff --git a/security/manager/pki/resources/jar.mn b/security/manager/pki/resources/jar.mn index 85c49af9fa0..488f9f776ac 100644 --- a/security/manager/pki/resources/jar.mn +++ b/security/manager/pki/resources/jar.mn @@ -13,7 +13,6 @@ pippki.jar: * content/pippki/certerror.xul (content/certerror.xul) content/pippki/downloadcert.js (content/downloadcert.js) content/pippki/downloadcert.xul (content/downloadcert.xul) - content/pippki/cacertexists.xul (content/cacertexists.xul) content/pippki/certManager.js (content/certManager.js) content/pippki/certManager.xul (content/certManager.xul) content/pippki/CAOverlay.xul (content/CAOverlay.xul) diff --git a/security/manager/pki/src/nsNSSDialogs.cpp b/security/manager/pki/src/nsNSSDialogs.cpp index 3a7e15ca812..4e5ff2792e7 100644 --- a/security/manager/pki/src/nsNSSDialogs.cpp +++ b/security/manager/pki/src/nsNSSDialogs.cpp @@ -33,6 +33,9 @@ #include "nsIX509CertValidity.h" #include "nsICRLInfo.h" +#include "nsEmbedCID.h" +#include "nsIPromptService.h" + #define PIPSTRING_BUNDLE_URL "chrome://pippki/locale/pippki.properties" /* ==== */ @@ -214,17 +217,24 @@ nsNSSDialogs::NotifyCACertExists(nsIInterfaceRequestor *ctx) { nsresult rv; + nsCOMPtr promptSvc(do_GetService(NS_PROMPTSERVICE_CONTRACTID)); + if (!promptSvc) + return NS_ERROR_FAILURE; + // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block = - do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID); - if (!block) return NS_ERROR_FAILURE; + nsAutoString title; + rv = mPIPStringBundle->GetStringFromName(NS_LITERAL_STRING("caCertExistsTitle").get(), + getter_Copies(title)); + NS_ENSURE_SUCCESS(rv, rv); - - rv = nsNSSDialogHelper::openDialog(parent, - "chrome://pippki/content/cacertexists.xul", - block); + nsAutoString msg; + rv = mPIPStringBundle->GetStringFromName(NS_LITERAL_STRING("caCertExistsMessage").get(), + getter_Copies(msg)); + NS_ENSURE_SUCCESS(rv, rv); + + rv = promptSvc->Alert(parent, title.get(), msg.get()); return rv; } diff --git a/testing/profiles/prefs_general.js b/testing/profiles/prefs_general.js index d44b5851f6d..8ab8865fefa 100644 --- a/testing/profiles/prefs_general.js +++ b/testing/profiles/prefs_general.js @@ -123,3 +123,6 @@ user_pref("dom.global-constructor.disable.mozContact", false); // Enable mozSettings user_pref("dom.mozSettings.enabled", true); user_pref("dom.navigator-property.disable.mozSettings", false); + +// Make sure the disk cache doesn't get auto disabled +user_pref("network.http.bypass-cachelock-threshold", 200000); diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index 83a05cae031..53e2b2c0722 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -3365,10 +3365,6 @@ nsDownload::Cancel() if (IsFinished()) return NS_OK; - // if the download is fake-paused, we have to resume it so we can cancel it - if (IsPaused() && !IsResumable()) - (void)Resume(); - // Have the download cancel its connection (void)CancelTransfer(); diff --git a/toolkit/components/jsdownloads/src/DownloadCore.jsm b/toolkit/components/jsdownloads/src/DownloadCore.jsm index 6bca0140b3f..c98e9184603 100644 --- a/toolkit/components/jsdownloads/src/DownloadCore.jsm +++ b/toolkit/components/jsdownloads/src/DownloadCore.jsm @@ -434,6 +434,12 @@ DownloadSource.prototype = { * resource. */ isPrivate: false, + + /** + * The nsIURI for the referrer of the download source, or null if no referrer + * should be sent or the download source is not HTTP. + */ + referrer: null, }; //////////////////////////////////////////////////////////////////////////////// @@ -607,6 +613,9 @@ DownloadCopySaver.prototype = { if (channel instanceof Ci.nsIPrivateBrowsingChannel) { channel.setPrivate(download.source.isPrivate); } + if (channel instanceof Ci.nsIHttpChannel) { + channel.referrer = download.source.referrer; + } channel.notificationCallbacks = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIInterfaceRequestor]), diff --git a/toolkit/components/jsdownloads/src/Downloads.jsm b/toolkit/components/jsdownloads/src/Downloads.jsm index 8161ec48d79..0b8430ba6dc 100644 --- a/toolkit/components/jsdownloads/src/Downloads.jsm +++ b/toolkit/components/jsdownloads/src/Downloads.jsm @@ -79,7 +79,12 @@ this.Downloads = { download.source = new DownloadSource(); download.source.uri = aProperties.source.uri; - download.source.isPrivate = aProperties.source.isPrivate; + if ("isPrivate" in aProperties.source) { + download.source.isPrivate = aProperties.source.isPrivate; + } + if ("referrer" in aProperties.source) { + download.source.referrer = aProperties.source.referrer; + } download.target = new DownloadTarget(); download.target.file = aProperties.target.file; diff --git a/toolkit/components/jsdownloads/test/unit/head.js b/toolkit/components/jsdownloads/test/unit/head.js index 89afc61d3ba..da5a7059b90 100644 --- a/toolkit/components/jsdownloads/test/unit/head.js +++ b/toolkit/components/jsdownloads/test/unit/head.js @@ -47,6 +47,7 @@ const HTTP_BASE = "http://localhost:" + HTTP_SERVER_PORT; const FAKE_SERVER_PORT = 4445; const FAKE_BASE = "http://localhost:" + FAKE_SERVER_PORT; +const TEST_REFERRER_URI = NetUtil.newURI(HTTP_BASE + "/referrer.html"); const TEST_SOURCE_URI = NetUtil.newURI(HTTP_BASE + "/source.txt"); const TEST_EMPTY_URI = NetUtil.newURI(HTTP_BASE + "/empty.txt"); const TEST_FAKE_SOURCE_URI = NetUtil.newURI(FAKE_BASE + "/source.txt"); diff --git a/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js b/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js index e2f52e4fa9d..b619463e495 100644 --- a/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js +++ b/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js @@ -28,6 +28,7 @@ add_task(function test_download_construction() // Checks the generated DownloadSource and DownloadTarget properties. do_check_true(download.source.uri.equals(TEST_SOURCE_URI)); do_check_eq(download.target.file, targetFile); + do_check_true(download.source.referrer === null); // Starts the download and waits for completion. yield download.start(); @@ -35,6 +36,56 @@ add_task(function test_download_construction() yield promiseVerifyContents(targetFile, TEST_DATA_SHORT); }); +/** + * Checks the referrer for downloads. + */ +add_task(function test_download_referrer() +{ + let source_path = "/test_download_referrer.txt"; + let source_uri = NetUtil.newURI(HTTP_BASE + source_path); + let target_uri = getTempFile(TEST_TARGET_FILE_NAME); + + function cleanup() { + gHttpServer.registerPathHandler(source_path, null); + } + + do_register_cleanup(cleanup); + + gHttpServer.registerPathHandler(source_path, function (aRequest, aResponse) { + aResponse.setHeader("Content-Type", "text/plain", false); + + do_check_true(aRequest.hasHeader("Referer")); + do_check_eq(aRequest.getHeader("Referer"), TEST_REFERRER_URI.spec); + }); + let download = yield Downloads.createDownload({ + source: { uri: source_uri, referrer: TEST_REFERRER_URI }, + target: { file: target_uri }, + saver: { type: "copy" }, + }); + do_check_true(download.source.referrer.equals(TEST_REFERRER_URI)); + yield download.start(); + + download = yield Downloads.createDownload({ + source: { uri: source_uri, referrer: TEST_REFERRER_URI, isPrivate: true }, + target: { file: target_uri }, + saver: { type: "copy" }, + }); + do_check_true(download.source.referrer.equals(TEST_REFERRER_URI)); + yield download.start(); + + // Test the download still works for non-HTTP channel with referrer. + source_uri = NetUtil.newURI("data:text/html,"); + download = yield Downloads.createDownload({ + source: { uri: source_uri, referrer: TEST_REFERRER_URI }, + target: { file: target_uri }, + saver: { type: "copy" }, + }); + do_check_true(download.source.referrer.equals(TEST_REFERRER_URI)); + yield download.start(); + + cleanup(); +}); + /** * Checks initial and final state and progress for a successful download. */ @@ -750,3 +801,4 @@ add_task(function test_download_cancel_immediately_restart_and_check_startTime() yield download.start(); do_check_true(download.startTime.getTime() > startTime.getTime()); }); + diff --git a/toolkit/components/osfile/osfile_async_worker.js b/toolkit/components/osfile/osfile_async_worker.js index c2075381f85..2265cbb934f 100644 --- a/toolkit/components/osfile/osfile_async_worker.js +++ b/toolkit/components/osfile/osfile_async_worker.js @@ -271,7 +271,7 @@ if (this.Components) { path: filePath }); }, - read: function read(path, bytes) { + read: function read(path, bytes, options) { let data = File.read(Type.path.fromMsg(path), bytes); return new Transfer({buffer: data.buffer, byteOffset: data.byteOffset, byteLength: data.byteLength}, [data.buffer]); }, diff --git a/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js b/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js index 8f468e36170..b1ca557cf37 100644 --- a/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js +++ b/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js @@ -896,12 +896,12 @@ let test_system_shutdown = maketest("system_shutdown", function system_shutdown( Services.console.registerListener(listener); logStart = Date.now(); f(); - // If listener does not resolve webObservation in timely manner (100MS), + // If listener does not resolve webObservation in timely manner (1000MS), // reject it. setTimeout(function() { test.info("waitObservation timeout exceeded."); waitObservation.reject(); - }, 500); + }, 1000); yield waitObservation.promise; }); } @@ -965,17 +965,19 @@ let test_duration = maketest("duration", function duration(test) { let currentDir = yield OS.File.getCurrentDirectory(); let pathSource = OS.Path.join(currentDir, EXISTING_FILE); let copyFile = pathSource + ".bak"; - let testOptions = function testOptions(options) { - test.info("Gathered method duration time: " + - options.outExecutionDuration + " MS"); + let testOptions = function testOptions(options, name) { + test.info("Checking outExecutionDuration for operation: " + name); + test.info(name + ": Gathered method duration time: " + + options.outExecutionDuration + "ms"); // Making sure that duration was updated. - test.ok(typeof options.outExecutionDuration === "number" && - options.outExecutionDuration >= 0, - "Operation duration time was updated correctly with a numeric value."); + test.ok(typeof options.outExecutionDuration === "number", + name + ": Operation duration is a number"); + test.ok(options.outExecutionDuration >= 0, + name + ": Operation duration time is non-negative."); }; // Testing duration of OS.File.copy. yield OS.File.copy(pathSource, copyFile, copyOptions); - testOptions(copyOptions); + testOptions(copyOptions, "OS.File.copy"); yield OS.File.remove(copyFile); // Trying an operation where options are cloned. @@ -986,7 +988,7 @@ let test_duration = maketest("duration", function duration(test) { outExecutionDuration: null }; let contents = yield OS.File.read(pathSource, undefined, readOptions); - testOptions(readOptions); + testOptions(readOptions, "OS.File.read"); // Options structure passed to a OS.File writeAtomic method. let writeAtomicOptions = { // This field should be first initialized with the actual @@ -995,7 +997,7 @@ let test_duration = maketest("duration", function duration(test) { tmpPath: tmpPath }; yield OS.File.writeAtomic(pathDest, contents, writeAtomicOptions); - testOptions(writeAtomicOptions); + testOptions(writeAtomicOptions, "OS.File.writeAtomic"); yield OS.File.remove(pathDest); test.info("Ensuring that we can use outExecutionDuration to accumulate durations"); diff --git a/toolkit/components/places/BookmarkJSONUtils.jsm b/toolkit/components/places/BookmarkJSONUtils.jsm index d6936c9ad0f..842e84dfb15 100644 --- a/toolkit/components/places/BookmarkJSONUtils.jsm +++ b/toolkit/components/places/BookmarkJSONUtils.jsm @@ -528,8 +528,8 @@ BookmarkExporter.prototype = { false).root; // Serialize to JSON and write to stream. - BookmarkNode.serializeAsJSONToOutputStream(root, streamProxy, false, false, - excludeItems); + yield BookmarkNode.serializeAsJSONToOutputStream(root, streamProxy, false, false, + excludeItems); root.containerOpen = false; } } @@ -552,75 +552,80 @@ let BookmarkNode = { * Converts folder shortcuts into actual folders. * @param aExcludeItems * An array of item ids that should not be written to the backup. + * @returns Task promise */ serializeAsJSONToOutputStream: function BN_serializeAsJSONToOutputStream( aNode, aStream, aIsUICommand, aResolveShortcuts, aExcludeItems) { - // Serialize to stream - let array = []; - if (this._appendConvertedNode(aNode, null, array, aIsUICommand, - aResolveShortcuts, aExcludeItems)) { - let json = JSON.stringify(array[0]); - aStream.write(json, json.length); - } else { - throw Cr.NS_ERROR_UNEXPECTED; - } + return Task.spawn(function() { + // Serialize to stream + let array = []; + if (yield this._appendConvertedNode(aNode, null, array, aIsUICommand, + aResolveShortcuts, aExcludeItems)) { + let json = JSON.stringify(array[0]); + aStream.write(json, json.length); + } else { + throw Cr.NS_ERROR_UNEXPECTED; + } + }.bind(this)); }, _appendConvertedNode: function BN__appendConvertedNode( bNode, aIndex, aArray, aIsUICommand, aResolveShortcuts, aExcludeItems) { - let node = {}; + return Task.spawn(function() { + let node = {}; - // Set index in order received - // XXX handy shortcut, but are there cases where we don't want - // to export using the sorting provided by the query? - if (aIndex) - node.index = aIndex; + // Set index in order received + // XXX handy shortcut, but are there cases where we don't want + // to export using the sorting provided by the query? + if (aIndex) + node.index = aIndex; - this._addGenericProperties(bNode, node, aResolveShortcuts); + this._addGenericProperties(bNode, node, aResolveShortcuts); - let parent = bNode.parent; - let grandParent = parent ? parent.parent : null; + let parent = bNode.parent; + let grandParent = parent ? parent.parent : null; - if (PlacesUtils.nodeIsURI(bNode)) { - // Tag root accept only folder nodes - if (parent && parent.itemId == PlacesUtils.tagsFolderId) - return false; + if (PlacesUtils.nodeIsURI(bNode)) { + // Tag root accept only folder nodes + if (parent && parent.itemId == PlacesUtils.tagsFolderId) + throw new Task.Result(false); - // Check for url validity, since we can't halt while writing a backup. - // This will throw if we try to serialize an invalid url and it does - // not make sense saving a wrong or corrupt uri node. - try { - NetUtil.newURI(bNode.uri); - } catch (ex) { - return false; + // Check for url validity, since we can't halt while writing a backup. + // This will throw if we try to serialize an invalid url and it does + // not make sense saving a wrong or corrupt uri node. + try { + NetUtil.newURI(bNode.uri); + } catch (ex) { + throw new Task.Result(false); + } + + yield this._addURIProperties(bNode, node, aIsUICommand); + } else if (PlacesUtils.nodeIsContainer(bNode)) { + // Tag containers accept only uri nodes + if (grandParent && grandParent.itemId == PlacesUtils.tagsFolderId) + throw new Task.Result(false); + + this._addContainerProperties(bNode, node, aIsUICommand, + aResolveShortcuts); + } else if (PlacesUtils.nodeIsSeparator(bNode)) { + // Tag root accept only folder nodes + // Tag containers accept only uri nodes + if ((parent && parent.itemId == PlacesUtils.tagsFolderId) || + (grandParent && grandParent.itemId == PlacesUtils.tagsFolderId)) + throw new Task.Result(false); + + this._addSeparatorProperties(bNode, node); } - this._addURIProperties(bNode, node, aIsUICommand); - } else if (PlacesUtils.nodeIsContainer(bNode)) { - // Tag containers accept only uri nodes - if (grandParent && grandParent.itemId == PlacesUtils.tagsFolderId) - return false; + if (!node.feedURI && node.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER) { + throw new Task.Result(yield this._appendConvertedComplexNode(node, bNode, aArray, aIsUICommand, + aResolveShortcuts, aExcludeItems)); + } - this._addContainerProperties(bNode, node, aIsUICommand, - aResolveShortcuts); - } else if (PlacesUtils.nodeIsSeparator(bNode)) { - // Tag root accept only folder nodes - // Tag containers accept only uri nodes - if ((parent && parent.itemId == PlacesUtils.tagsFolderId) || - (grandParent && grandParent.itemId == PlacesUtils.tagsFolderId)) - return false; - - this._addSeparatorProperties(bNode, node); - } - - if (!node.feedURI && node.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER) { - return this._appendConvertedComplexNode(node, bNode, aArray, aIsUICommand, - aResolveShortcuts, aExcludeItems); - } - - aArray.push(node); - return true; + aArray.push(node); + throw new Task.Result(true); + }.bind(this)); }, _addGenericProperties: function BN__addGenericProperties( @@ -664,24 +669,26 @@ let BookmarkNode = { _addURIProperties: function BN__addURIProperties( aPlacesNode, aJSNode, aIsUICommand) { - aJSNode.type = PlacesUtils.TYPE_X_MOZ_PLACE; - aJSNode.uri = aPlacesNode.uri; - if (aJSNode.id && aJSNode.id != -1) { - // Harvest bookmark-specific properties - let keyword = PlacesUtils.bookmarks.getKeywordForBookmark(aJSNode.id); - if (keyword) - aJSNode.keyword = keyword; - } + return Task.spawn(function() { + aJSNode.type = PlacesUtils.TYPE_X_MOZ_PLACE; + aJSNode.uri = aPlacesNode.uri; + if (aJSNode.id && aJSNode.id != -1) { + // Harvest bookmark-specific properties + let keyword = PlacesUtils.bookmarks.getKeywordForBookmark(aJSNode.id); + if (keyword) + aJSNode.keyword = keyword; + } - let tags = aIsUICommand ? aPlacesNode.tags : null; - if (tags) - aJSNode.tags = tags; + let tags = aIsUICommand ? aPlacesNode.tags : null; + if (tags) + aJSNode.tags = tags; - // Last character-set - let uri = NetUtil.newURI(aPlacesNode.uri); - let lastCharset = PlacesUtils.history.getCharsetForURI(uri); - if (lastCharset) - aJSNode.charset = lastCharset; + // Last character-set + let uri = NetUtil.newURI(aPlacesNode.uri); + let lastCharset = yield PlacesUtils.getCharsetForURI(uri) + if (lastCharset) + aJSNode.charset = lastCharset; + }); }, _addSeparatorProperties: function BN__addSeparatorProperties( @@ -727,32 +734,34 @@ let BookmarkNode = { _appendConvertedComplexNode: function BN__appendConvertedComplexNode( aNode, aSourceNode, aArray, aIsUICommand, aResolveShortcuts, aExcludeItems) { - let repr = {}; + return Task.spawn(function() { + let repr = {}; - for (let [name, value] in Iterator(aNode)) - repr[name] = value; + for (let [name, value] in Iterator(aNode)) + repr[name] = value; - // Write child nodes - let children = repr.children = []; - if (!aNode.livemark) { - PlacesUtils.asContainer(aSourceNode); - let wasOpen = aSourceNode.containerOpen; - if (!wasOpen) - aSourceNode.containerOpen = true; - let cc = aSourceNode.childCount; - for (let i = 0; i < cc; ++i) { - let childNode = aSourceNode.getChild(i); - if (aExcludeItems && aExcludeItems.indexOf(childNode.itemId) != -1) - continue; - this._appendConvertedNode(aSourceNode.getChild(i), i, children, - aIsUICommand, aResolveShortcuts, - aExcludeItems); + // Write child nodes + let children = repr.children = []; + if (!aNode.livemark) { + PlacesUtils.asContainer(aSourceNode); + let wasOpen = aSourceNode.containerOpen; + if (!wasOpen) + aSourceNode.containerOpen = true; + let cc = aSourceNode.childCount; + for (let i = 0; i < cc; ++i) { + let childNode = aSourceNode.getChild(i); + if (aExcludeItems && aExcludeItems.indexOf(childNode.itemId) != -1) + continue; + yield this._appendConvertedNode(aSourceNode.getChild(i), i, children, + aIsUICommand, aResolveShortcuts, + aExcludeItems); + } + if (!wasOpen) + aSourceNode.containerOpen = false; } - if (!wasOpen) - aSourceNode.containerOpen = false; - } - aArray.push(repr); - return true; + aArray.push(repr); + throw new Task.Result(true); + }.bind(this)); } -} +} \ No newline at end of file diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml index 4c49c9377d8..4d78f324039 100644 --- a/toolkit/content/widgets/browser.xml +++ b/toolkit/content/widgets/browser.xml @@ -143,7 +143,7 @@ if (aCharset) { try { - this.docShell.parentCharset = this.mAtomService.getAtom(aCharset); + this.docShell.parentCharset = aCharset; } catch (e) { } diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index b89a70ff7de..cdc678400b3 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -1084,6 +1084,7 @@ if (this._overlayPlayButtonHeight * animationScale > (videoHeight - this._controlBarHeight)|| this._overlayPlayButtonWidth * animationScale > videoWidth) { this.clickToPlay.setAttribute("immediate", "true"); + this.clickToPlay.hidden = true; } else { this.clickToPlay.removeAttribute("immediate"); } diff --git a/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties b/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties index 2bd5fc9efbe..4abc9f9017c 100644 --- a/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties +++ b/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties @@ -44,11 +44,20 @@ dontLeavePrivateBrowsingButton=Stay in Private Browsing Mode downloadsCompleteTitle=Downloads Complete downloadsCompleteMsg=All files have finished downloading. +# LOCALIZATION NOTE (infiniteRate): +# If download speed is a JavaScript Infinity value, this phrase is used +infiniteRate=Really fast + # LOCALIZATION NOTE (statusFormat3): — is the "em dash" (long dash) # %1$S transfer progress; %2$S rate number; %3$S rate unit; %4$S time left # example: 4 minutes left — 1.1 of 11.1 GB (2.2 MB/sec) statusFormat3=%4$S — %1$S (%2$S %3$S/sec) +# LOCALIZATION NOTE (statusFormatInfiniteRate): — is the "em dash" (long dash) +# %1$S transfer progress; %2$S substitute phrase for Infinity speed; %3$S time left +# example: 4 minutes left — 1.1 of 11.1 GB (Really fast) +statusFormatInfiniteRate=%3$S — %1$S (%2$S) + # LOCALIZATION NOTE (statusFormatNoRate): — is the "em dash" (long dash) # %1$S transfer progress; %2$S time left # example: 4 minutes left — 1.1 of 11.1 GB diff --git a/toolkit/modules/PopupNotifications.jsm b/toolkit/modules/PopupNotifications.jsm index 0abc95bbe8b..8264c46c479 100644 --- a/toolkit/modules/PopupNotifications.jsm +++ b/toolkit/modules/PopupNotifications.jsm @@ -260,6 +260,13 @@ PopupNotifications.prototype = { // Otherwise, update() will display the notification the next time the // relevant tab/window is selected. + // If the tab is selected but the window is in the background, let the OS + // tell the user that there's a notification waiting in that window. + // At some point we might want to do something about background tabs here + // too. + if (browser == this.tabbrowser.selectedBrowser) + this.window.getAttention(); + // Notify observers that we're not showing the popup (useful for testing) this._notify("backgroundShow"); } diff --git a/toolkit/mozapps/downloads/DownloadUtils.jsm b/toolkit/mozapps/downloads/DownloadUtils.jsm index 2748d385629..8f470c3e474 100644 --- a/toolkit/mozapps/downloads/DownloadUtils.jsm +++ b/toolkit/mozapps/downloads/DownloadUtils.jsm @@ -55,6 +55,7 @@ const kDownloadProperties = let gStr = { statusFormat: "statusFormat3", + statusFormatInfiniteRate: "statusFormatInfiniteRate", statusFormatNoRate: "statusFormatNoRate", transferSameUnits: "transferSameUnits2", transferDiffUnits: "transferDiffUnits2", @@ -71,6 +72,7 @@ let gStr = { units: ["bytes", "kilobyte", "megabyte", "gigabyte"], // Update timeSize in convertTimeUnits if changing the length of this array timeUnits: ["seconds", "minutes", "hours", "days"], + infiniteRate: "infiniteRate", }; // This lazily initializes the string bundle upon first use. @@ -108,9 +110,19 @@ this.DownloadUtils = { = this._deriveTransferRate(aCurrBytes, aMaxBytes, aSpeed, aLastSec); let [rate, unit] = DownloadUtils.convertByteUnits(normalizedSpeed); - let params = [transfer, rate, unit, timeLeft]; - let status = gBundle.formatStringFromName(gStr.statusFormat, params, - params.length); + + let status; + if (rate === "Infinity") { + // Infinity download speed doesn't make sense. Show a localized phrase instead. + let params = [transfer, gBundle.GetStringFromName(gStr.infiniteRate), timeLeft]; + status = gBundle.formatStringFromName(gStr.statusFormatInfiniteRate, params, + params.length); + } + else { + let params = [transfer, rate, unit, timeLeft]; + status = gBundle.formatStringFromName(gStr.statusFormat, params, + params.length); + } return [status, newLast]; }, diff --git a/toolkit/mozapps/downloads/tests/unit/test_DownloadUtils.js b/toolkit/mozapps/downloads/tests/unit/test_DownloadUtils.js index 98b7f40ac2b..62150cb7cc5 100644 --- a/toolkit/mozapps/downloads/tests/unit/test_DownloadUtils.js +++ b/toolkit/mozapps/downloads/tests/unit/test_DownloadUtils.js @@ -26,7 +26,7 @@ function testTransferTotal(aCurrBytes, aMaxBytes, aTransfer) // Get the em-dash character because typing it directly here doesn't work :( let gDash = DownloadUtils.getDownloadStatus(0)[0].match(/remaining (.) 0 bytes/)[1]; -let gVals = [0, 100, 2345, 55555, 982341, 23194134, 1482, 58, 9921949201, 13498132]; +let gVals = [0, 100, 2345, 55555, 982341, 23194134, 1482, 58, 9921949201, 13498132, Infinity]; function testStatus(aFunc, aCurr, aMore, aRate, aTest) { @@ -167,6 +167,9 @@ function run_test() testStatus(statusFunc, 6, 6, 0, ["Unknown time remaining -- 1.4 of 2.9 KB (0 bytes/sec)", Infinity]); testStatus(statusFunc, 8, 5, 0, ["Unknown time remaining -- 9.2 of 9.3 GB (0 bytes/sec)", Infinity]); + // With rate equal to Infinity + testStatus(statusFunc, 0, 0, 10, ["Unknown time remaining -- 0 of 0 bytes (Really fast)", Infinity]); + testStatus(statusFunc, 1, 2, 10, ["A few seconds remaining -- 100 bytes of 2.4 KB (Really fast)", 0]); // Now test without rates, via getDownloadStatusNoRate. statusFunc = DownloadUtils.getDownloadStatusNoRate.bind(DownloadUtils); diff --git a/toolkit/mozapps/extensions/PluginProvider.jsm b/toolkit/mozapps/extensions/PluginProvider.jsm index cccabd067ab..f122f67d27f 100644 --- a/toolkit/mozapps/extensions/PluginProvider.jsm +++ b/toolkit/mozapps/extensions/PluginProvider.jsm @@ -422,18 +422,23 @@ function PluginWrapper(aId, aName, aDescription, aTags) { let path = aTags[0].fullpath; // Plugins inside the application directory are in the application scope let dir = Services.dirsvc.get("APlugns", Ci.nsIFile); - if (path.substring(0, dir.path.length) == dir.path) + if (path.startsWith(dir.path)) return AddonManager.SCOPE_APPLICATION; // Plugins inside the profile directory are in the profile scope dir = Services.dirsvc.get("ProfD", Ci.nsIFile); - if (path.substring(0, dir.path.length) == dir.path) + if (path.startsWith(dir.path)) return AddonManager.SCOPE_PROFILE; - // Plugins anywhere else in the user's home are in the user scope - dir = Services.dirsvc.get("Home", Ci.nsIFile); - if (path.substring(0, dir.path.length) == dir.path) - return AddonManager.SCOPE_USER; + // Plugins anywhere else in the user's home are in the user scope, + // but not all platforms have a home directory. + try { + dir = Services.dirsvc.get("Home", Ci.nsIFile); + if (path.startsWith(dir.path)) + return AddonManager.SCOPE_USER; + } catch (e if (e.result && e.result == Components.results.NS_ERROR_FAILURE)) { + // Do nothing: missing "Home". + } // Any other locations are system scope return AddonManager.SCOPE_SYSTEM; diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 3ba46ce54df..49acfdbac8b 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -2610,73 +2610,52 @@ static void MOZ_gdk_display_close(GdkDisplay *display) g_free(theme_name); } - // gdk_display_close was broken prior to gtk+-2.10.0. - // (http://bugzilla.gnome.org/show_bug.cgi?id=85715) - // gdk_display_manager_set_default_display (gdk_display_manager_get(), NULL) - // was also broken. - if (gtk_check_version(2,10,0) != NULL) { -#ifdef MOZ_X11 - // Version check failed - broken gdk_display_close. - // - // Let the gdk structures leak but at least close the Display, - // assuming that gdk will not use it again. - Display* dpy = GDK_DISPLAY_XDISPLAY(display); - if (!theme_is_qt) - XCloseDisplay(dpy); -#else - gdk_display_close(display); -#endif /* MOZ_X11 */ - } - else { #if CLEANUP_MEMORY - // Get a (new) Pango context that holds a reference to the fontmap that - // GTK has been using. gdk_pango_context_get() must be called while GTK - // has a default display. - PangoContext *pangoContext = gdk_pango_context_get(); + // Get a (new) Pango context that holds a reference to the fontmap that + // GTK has been using. gdk_pango_context_get() must be called while GTK + // has a default display. + PangoContext *pangoContext = gdk_pango_context_get(); #endif - bool buggyCairoShutdown = cairo_version() < CAIRO_VERSION_ENCODE(1, 4, 0); + bool buggyCairoShutdown = cairo_version() < CAIRO_VERSION_ENCODE(1, 4, 0); - if (!buggyCairoShutdown) { - // We should shut down GDK before we shut down libraries it depends on - // like Pango and cairo. But if cairo shutdown is buggy, we should - // shut down cairo first otherwise it may crash because of dangling - // references to Display objects (see bug 469831). - if (!theme_is_qt) - gdk_display_close(display); - } + if (!buggyCairoShutdown) { + // We should shut down GDK before we shut down libraries it depends on + // like Pango and cairo. But if cairo shutdown is buggy, we should + // shut down cairo first otherwise it may crash because of dangling + // references to Display objects (see bug 469831). + if (!theme_is_qt) + gdk_display_close(display); + } #if CLEANUP_MEMORY - // This doesn't take a reference. - PangoFontMap *fontmap = pango_context_get_font_map(pangoContext); - // Do some shutdown of the fontmap, which releases the fonts, clearing a - // bunch of circular references from the fontmap through the fonts back to - // itself. The shutdown that this does is much less than what's done by - // the fontmap's finalize, though. - if (PANGO_IS_FC_FONT_MAP(fontmap)) - pango_fc_font_map_shutdown(PANGO_FC_FONT_MAP(fontmap)); - g_object_unref(pangoContext); - // PangoCairo still holds a reference to the fontmap. - // Now that we have finished with GTK and Pango, we could unref fontmap, - // which would allow us to call FcFini, but removing what is really - // Pango's ref feels a bit evil. Pango-1.22 will have support for - // pango_cairo_font_map_set_default(NULL), which would release the - // reference on the old fontmap. + // This doesn't take a reference. + PangoFontMap *fontmap = pango_context_get_font_map(pangoContext); + // Do some shutdown of the fontmap, which releases the fonts, clearing a + // bunch of circular references from the fontmap through the fonts back to + // itself. The shutdown that this does is much less than what's done by + // the fontmap's finalize, though. + if (PANGO_IS_FC_FONT_MAP(fontmap)) + pango_fc_font_map_shutdown(PANGO_FC_FONT_MAP(fontmap)); + g_object_unref(pangoContext); + // PangoCairo still holds a reference to the fontmap. + // Now that we have finished with GTK and Pango, we could unref fontmap, + // which would allow us to call FcFini, but removing what is really + // Pango's ref feels a bit evil. Pango-1.22 will have support for + // pango_cairo_font_map_set_default(NULL), which would release the + // reference on the old fontmap. -#if GTK_CHECK_VERSION(2,8,0) - // cairo_debug_reset_static_data() is prototyped through cairo.h included - // by gtk.h. + // cairo_debug_reset_static_data() is prototyped through cairo.h included + // by gtk.h. #ifdef cairo_debug_reset_static_data #error "Looks like we're including Mozilla's cairo instead of system cairo" #endif - cairo_debug_reset_static_data(); -#endif // 2.8.0 + cairo_debug_reset_static_data(); #endif // CLEANUP_MEMORY - if (buggyCairoShutdown) { - if (!theme_is_qt) - gdk_display_close(display); - } + if (buggyCairoShutdown) { + if (!theme_is_qt) + gdk_display_close(display); } } #endif // MOZ_WIDGET_GTK2 diff --git a/uriloader/prefetch/nsIPrefetchService.idl b/uriloader/prefetch/nsIPrefetchService.idl index e4ab07cca39..10d806ecdc3 100644 --- a/uriloader/prefetch/nsIPrefetchService.idl +++ b/uriloader/prefetch/nsIPrefetchService.idl @@ -8,7 +8,7 @@ interface nsIURI; interface nsIDOMNode; interface nsISimpleEnumerator; -[scriptable, uuid(cba513eb-c457-4b93-832c-1a979e66edd1)] +[scriptable, uuid(bc4dbb34-b148-11e2-b82c-08002734a811)] interface nsIPrefetchService : nsISupports { /** @@ -25,28 +25,11 @@ interface nsIPrefetchService : nsISupports in nsIDOMNode aSource, in boolean aExplicit); - /** - * @status DEPRECATED This method is no longer used, and will throw - * NS_ERROR_NOT_IMPLEMENTED. - */ - void prefetchURIForOfflineUse(in nsIURI aURI, - in nsIURI aReferrerURI, - in nsIDOMNode aSource, - in boolean aExplicit); - /** * Enumerate the items in the prefetch queue. Each element in the * enumeration is an nsIDOMLoadStatus. - * - * @param aIncludeNormalItems include normal prefetch items in the - * list. This parameter is deprecated and must be TRUE, - * or NS_ERROR_INT_IMPLEMENTED will be thrown. - * @param aIncludeOfflineItems include items being fetched for offline - * use. This parameter is deprecated and must be FALSE, - * or NS_ERROR_NOT_IMPLEMENTED will be thrown. */ - nsISimpleEnumerator enumerateQueue(in boolean aIncludeNormalItems, - in boolean aIncludeOfflineItems); + nsISimpleEnumerator enumerateQueue(); // XXX do we need a way to cancel prefetch requests? }; diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index 2dc69c5f3b4..a3f0550f2a5 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -751,22 +751,8 @@ nsPrefetchService::PrefetchURI(nsIURI *aURI, } NS_IMETHODIMP -nsPrefetchService::PrefetchURIForOfflineUse(nsIURI *aURI, - nsIURI *aReferrerURI, - nsIDOMNode *aSource, - bool aExplicit) +nsPrefetchService::EnumerateQueue(nsISimpleEnumerator **aEnumerator) { - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsPrefetchService::EnumerateQueue(bool aIncludeNormalItems, - bool aIncludeOfflineItems, - nsISimpleEnumerator **aEnumerator) -{ - NS_ENSURE_TRUE(aIncludeNormalItems && !aIncludeOfflineItems, - NS_ERROR_NOT_IMPLEMENTED); - *aEnumerator = new nsPrefetchQueueEnumerator(this); if (!*aEnumerator) return NS_ERROR_OUT_OF_MEMORY; diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index 20308a7bbdb..4a8b5b74384 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -100,8 +100,11 @@ AndroidBridge::Init(JNIEnv *jEnv, mGeckoAppShellClass = (jclass) jEnv->NewGlobalRef(jGeckoAppShellClass); +#ifdef MOZ_WEBSMS_BACKEND jclass jAndroidSmsMessageClass = jEnv->FindClass("android/telephony/SmsMessage"); mAndroidSmsMessageClass = (jclass) jEnv->NewGlobalRef(jAndroidSmsMessageClass); + jCalculateLength = (jmethodID) jEnv->GetStaticMethodID(jAndroidSmsMessageClass, "calculateLength", "(Ljava/lang/CharSequence;Z)[I"); +#endif jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(I)V"); jNotifyIMEContext = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEContext", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); @@ -160,7 +163,6 @@ AndroidBridge::Init(JNIEnv *jEnv, jMarkUriVisited = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "markUriVisited", "(Ljava/lang/String;)V"); jSetUriTitle = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "setUriTitle", "(Ljava/lang/String;Ljava/lang/String;)V"); - jCalculateLength = (jmethodID) jEnv->GetStaticMethodID(jAndroidSmsMessageClass, "calculateLength", "(Ljava/lang/CharSequence;Z)[I"); jSendMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "sendMessage", "(Ljava/lang/String;Ljava/lang/String;I)V"); jGetMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getMessage", "(II)V"); jDeleteMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "deleteMessage", "(II)V"); @@ -1630,6 +1632,9 @@ nsresult AndroidBridge::GetSegmentInfoForText(const nsAString& aText, dom::mobilemessage::SmsSegmentInfoData* aData) { +#ifndef MOZ_WEBSMS_BACKEND + return NS_ERROR_FAILURE; +#else ALOG_BRIDGE("AndroidBridge::GetSegmentInfoForText"); aData->segments() = 0; @@ -1660,6 +1665,7 @@ AndroidBridge::GetSegmentInfoForText(const nsAString& aText, env->ReleaseIntArrayElements(arr, info, JNI_ABORT); return NS_OK; +#endif } void diff --git a/widget/android/moz.build b/widget/android/moz.build index 4424d0f8f5a..51640c2b618 100644 --- a/widget/android/moz.build +++ b/widget/android/moz.build @@ -29,7 +29,6 @@ CPP_SOURCES += [ 'nsAppShell.cpp', 'nsClipboard.cpp', 'nsDeviceContextAndroid.cpp', - 'nsFilePicker.cpp', 'nsIMEPicker.cpp', 'nsIdleServiceAndroid.cpp', 'nsLookAndFeel.cpp', diff --git a/widget/android/nsFilePicker.cpp b/widget/android/nsFilePicker.cpp deleted file mode 100644 index db6e48a33cb..00000000000 --- a/widget/android/nsFilePicker.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsFilePicker.h" -#include "AndroidBridge.h" -#include "nsNetUtil.h" -#include "nsIURI.h" - -NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker) - -NS_IMETHODIMP nsFilePicker::Init(nsIDOMWindow *parent, const nsAString& title, - int16_t mode) -{ - return (mode == nsIFilePicker::modeOpen || - mode == nsIFilePicker::modeOpenMultiple) - ? NS_OK - : NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP nsFilePicker::AppendFilters(int32_t aFilterMask) -{ - if (aFilterMask & filterAudio) { - mMimeTypeFilter.AssignLiteral("audio/*"); - return NS_OK; - } - - if (aFilterMask & filterImages) { - mMimeTypeFilter.AssignLiteral("image/*"); - return NS_OK; - } - - if (aFilterMask & filterVideo) { - mMimeTypeFilter.AssignLiteral("video/*"); - return NS_OK; - } - - if (aFilterMask & filterAll) { - mMimeTypeFilter.AssignLiteral("*/*"); - return NS_OK; - } - - return nsBaseFilePicker::AppendFilters(aFilterMask); -} - -NS_IMETHODIMP nsFilePicker::AppendFilter(const nsAString& /*title*/, - const nsAString& filter) -{ - if (!mExtensionsFilter.IsEmpty()) - mExtensionsFilter.AppendLiteral(", "); - mExtensionsFilter.Append(filter); - return NS_OK; -} - -NS_IMETHODIMP nsFilePicker::GetDefaultString(nsAString & aDefaultString) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} -NS_IMETHODIMP nsFilePicker::SetDefaultString(const nsAString & aDefaultString) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP nsFilePicker::GetDefaultExtension(nsAString & aDefaultExtension) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} -NS_IMETHODIMP nsFilePicker::SetDefaultExtension(const nsAString & aDefaultExtension) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP nsFilePicker::GetDisplayDirectory(nsIFile **aDisplayDirectory) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} -NS_IMETHODIMP nsFilePicker::SetDisplayDirectory(nsIFile *aDisplayDirectory) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP nsFilePicker::GetFile(nsIFile **aFile) -{ - NS_ENSURE_ARG_POINTER(aFile); - - *aFile = nullptr; - if (mFilePath.IsEmpty()) { - return NS_OK; - } - - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); - NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); - - file->InitWithPath(mFilePath); - - NS_ADDREF(*aFile = file); - - nsCString path; - (*aFile)->GetNativePath(path); - return NS_OK; -} - -NS_IMETHODIMP nsFilePicker::GetFileURL(nsIURI **aFileURL) -{ - nsCOMPtr file; - GetFile(getter_AddRefs(file)); - - nsCOMPtr uri; - NS_NewFileURI(getter_AddRefs(uri), file); - NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE); - - return CallQueryInterface(uri, aFileURL); -} - -NS_IMETHODIMP nsFilePicker::Show(int16_t *_retval) -{ - if (!mozilla::AndroidBridge::Bridge()) - return NS_ERROR_NOT_IMPLEMENTED; - nsAutoString filePath; - - if (mExtensionsFilter.IsEmpty() && mMimeTypeFilter.IsEmpty()) { - // If neither filters is set show anything we can. - mozilla::AndroidBridge::Bridge()->ShowFilePickerForMimeType(filePath, NS_LITERAL_STRING("*/*")); - } else if (!mExtensionsFilter.IsEmpty()) { - mozilla::AndroidBridge::Bridge()->ShowFilePickerForExtensions(filePath, mExtensionsFilter); - } else { - mozilla::AndroidBridge::Bridge()->ShowFilePickerForMimeType(filePath, mMimeTypeFilter); - } - - *_retval = EmptyString().Equals(filePath) ? - nsIFilePicker::returnCancel : nsIFilePicker::returnOK; - if (*_retval == nsIFilePicker::returnOK) - mFilePath.Assign(filePath); - return NS_OK; -} diff --git a/widget/android/nsFilePicker.h b/widget/android/nsFilePicker.h deleted file mode 100644 index 783c55a1e8d..00000000000 --- a/widget/android/nsFilePicker.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef NSFILEPICKER_H -#define NSFILEPICKER_H - -#include "nsBaseFilePicker.h" -#include "nsString.h" - -class nsFilePicker : public nsBaseFilePicker -{ -public: - NS_DECL_ISUPPORTS - - NS_IMETHODIMP Init(nsIDOMWindow *parent, const nsAString& title, - int16_t mode); - NS_IMETHOD AppendFilters(int32_t aFilterMask); - NS_IMETHOD AppendFilter(const nsAString & aTitle, - const nsAString & aFilter); - NS_IMETHOD GetDefaultString(nsAString & aDefaultString); - NS_IMETHOD SetDefaultString(const nsAString & aDefaultString); - NS_IMETHOD GetDefaultExtension(nsAString & aDefaultExtension); - NS_IMETHOD SetDefaultExtension(const nsAString & aDefaultExtension); - NS_IMETHOD GetFile(nsIFile * *aFile); - NS_IMETHOD GetFileURL(nsIURI * *aFileURL); - NS_IMETHOD SetDisplayDirectory(nsIFile *aDisplayDirectory); - NS_IMETHOD GetDisplayDirectory(nsIFile **aDisplayDirectory); - NS_IMETHOD Show(int16_t *aReturn); -private: - void InitNative(nsIWidget*, const nsAString&, int16_t) {}; - nsString mFilePath; - nsString mExtensionsFilter; - nsString mMimeTypeFilter; -}; -#endif diff --git a/widget/android/nsWidgetFactory.cpp b/widget/android/nsWidgetFactory.cpp index de7acad1f86..132be57b8e2 100644 --- a/widget/android/nsWidgetFactory.cpp +++ b/widget/android/nsWidgetFactory.cpp @@ -22,10 +22,8 @@ #include "nsPrintOptionsAndroid.h" #include "nsPrintSession.h" #include "nsDeviceContextAndroid.h" -#include "nsFilePicker.h" #include "nsHTMLFormatConverter.h" #include "nsIMEPicker.h" -#include "nsFilePickerProxy.h" #include "nsXULAppAPI.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) @@ -49,24 +47,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) } } -static nsresult -nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult) -{ - *aResult = nullptr; - if (aOuter != nullptr) { - return NS_ERROR_NO_AGGREGATION; - } - nsCOMPtr picker; - - if (XRE_GetProcessType() == GeckoProcessType_Content) - picker = new nsFilePickerProxy(); - else - picker = new nsFilePicker; - - return picker->QueryInterface(aIID, aResult); -} - NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); NS_DEFINE_NAMED_CID(NS_WINDOW_CID); NS_DEFINE_NAMED_CID(NS_CHILD_CID); @@ -78,7 +58,6 @@ NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID); NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); -NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID); NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); NS_DEFINE_NAMED_CID(NS_IMEPICKER_CID); NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); @@ -96,7 +75,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsAndroidConstructor }, { &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor }, { &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecAndroidConstructor }, - { &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor }, { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, { &kNS_IMEPICKER_CID, false, NULL, nsIMEPickerConstructor }, { &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor }, @@ -116,7 +94,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID }, { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID }, - { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID }, { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, { "@mozilla.org/imepicker;1", &kNS_IMEPICKER_CID }, { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 6b6098e68b4..3a4dbc3e266 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -2846,11 +2846,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, aResult->SizeTo(16, 16); break; } - // Intentional fallthrough to next case. - } - case NS_THEME_SCROLLBAR_NON_DISAPPEARING: - { // yeah, i know i'm cheating a little here, but i figure that it // really doesn't matter if the scrollbar is vertical or horizontal // and the width metric is a really good metric for every piece @@ -2868,6 +2864,29 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, break; } + case NS_THEME_SCROLLBAR_NON_DISAPPEARING: + { + int32_t themeMetric = kThemeMetricScrollBarWidth; + + if (aFrame) { + nsIFrame* scrollbarFrame = GetParentScrollbarFrame(aFrame); + if (scrollbarFrame && + scrollbarFrame->StyleDisplay()->mAppearance == + NS_THEME_SCROLLBAR_SMALL) { + // XXX We're interested in the width of non-disappearing scrollbars + // to leave enough space for a dropmarker in non-native styled + // comboboxes (bug 869314). It isn't clear to me if comboboxes can + // ever have small scrollbars. + themeMetric = kThemeMetricSmallScrollBarWidth; + } + } + + SInt32 scrollbarWidth = 0; + ::GetThemeMetric(themeMetric, &scrollbarWidth); + aResult->SizeTo(scrollbarWidth, scrollbarWidth); + break; + } + case NS_THEME_SCROLLBAR_BUTTON_UP: case NS_THEME_SCROLLBAR_BUTTON_DOWN: case NS_THEME_SCROLLBAR_BUTTON_LEFT: diff --git a/widget/gonk/nsIdleServiceGonk.h b/widget/gonk/nsIdleServiceGonk.h index a79b08b8df1..e00a73cf8aa 100644 --- a/widget/gonk/nsIdleServiceGonk.h +++ b/widget/gonk/nsIdleServiceGonk.h @@ -29,14 +29,13 @@ public: static already_AddRefed GetInstance() { - nsIdleServiceGonk* idleService = - static_cast(nsIdleService::GetInstance().get()); + nsRefPtr idleService = + nsIdleService::GetInstance().downcast(); if (!idleService) { idleService = new nsIdleServiceGonk(); - NS_ADDREF(idleService); } - return idleService; + return idleService.forget(); } protected: diff --git a/widget/gtk2/gtk3drawing.c b/widget/gtk2/gtk3drawing.c index edc94fac09e..3303452df52 100644 --- a/widget/gtk2/gtk3drawing.c +++ b/widget/gtk2/gtk3drawing.c @@ -985,9 +985,8 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect, if (isradio) { gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO); - if (selected) { - gtk_style_context_set_state(style, GTK_STATE_FLAG_ACTIVE); - } + gtk_style_context_set_state(style, selected ? GTK_STATE_FLAG_ACTIVE : + GTK_STATE_FLAG_NORMAL); gtk_render_option(style, cr, x, y, width, height); if (state->focused) { gtk_render_focus(style, cr, focus_x, focus_y, diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp index 7e22e7d9c8e..b1b6c4ff33b 100644 --- a/widget/gtk2/nsFilePicker.cpp +++ b/widget/gtk2/nsFilePicker.cpp @@ -119,6 +119,12 @@ UpdateFilePreviewWidget(GtkFileChooser *file_chooser, return; } +#if GTK_CHECK_VERSION(2,12,0) + GdkPixbuf *preview_pixbuf_temp = preview_pixbuf; + preview_pixbuf = gdk_pixbuf_apply_embedded_orientation(preview_pixbuf_temp); + g_object_unref(preview_pixbuf_temp); +#endif + // This is the easiest way to do center alignment without worrying about containers // Minimum 3px padding each side (hence the 6) just to make things nice gint x_padding = (MAX_PREVIEW_SIZE + 6 - gdk_pixbuf_get_width(preview_pixbuf)) / 2; diff --git a/widget/gtk2/nsLookAndFeel.cpp b/widget/gtk2/nsLookAndFeel.cpp index a4ae0238e73..381c509a17d 100644 --- a/widget/gtk2/nsLookAndFeel.cpp +++ b/widget/gtk2/nsLookAndFeel.cpp @@ -34,57 +34,49 @@ using mozilla::LookAndFeel; #define GDK_COLOR_TO_NS_RGB(c) \ ((nscolor) NS_RGB(c.red>>8, c.green>>8, c.blue>>8)) - -nscolor nsLookAndFeel::sInfoText = 0; -nscolor nsLookAndFeel::sInfoBackground = 0; -nscolor nsLookAndFeel::sMenuBarText = 0; -nscolor nsLookAndFeel::sMenuBarHoverText = 0; -nscolor nsLookAndFeel::sMenuText = 0; -nscolor nsLookAndFeel::sMenuHover = 0; -nscolor nsLookAndFeel::sMenuHoverText = 0; -nscolor nsLookAndFeel::sMenuBackground = 0; -nscolor nsLookAndFeel::sButtonBackground = 0; -nscolor nsLookAndFeel::sButtonText = 0; -nscolor nsLookAndFeel::sButtonOuterLightBorder = 0; -nscolor nsLookAndFeel::sButtonInnerDarkBorder = 0; -nscolor nsLookAndFeel::sOddCellBackground = 0; -nscolor nsLookAndFeel::sNativeHyperLinkText = 0; -nscolor nsLookAndFeel::sComboBoxText = 0; -nscolor nsLookAndFeel::sComboBoxBackground = 0; -PRUnichar nsLookAndFeel::sInvisibleCharacter = PRUnichar('*'); -float nsLookAndFeel::sCaretRatio = 0; -bool nsLookAndFeel::sMenuSupportsDrag = false; +#define GDK_RGBA_TO_NS_RGBA(c) \ + ((nscolor) NS_RGBA((int)((c).red*255), (int)((c).green*255), \ + (int)((c).blue*255), (int)((c).alpha*255))) nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel(), +#if (MOZ_WIDGET_GTK == 2) mStyle(nullptr), +#else + mBackgroundStyle(nullptr), + mViewStyle(nullptr), + mButtonStyle(nullptr), +#endif mDefaultFontCached(false), mButtonFontCached(false), mFieldFontCached(false), mMenuFontCached(false) { - InitWidget(); - - static bool sInitialized = false; - - if (!sInitialized) { - sInitialized = true; - InitLookAndFeel(); - } + Init(); } nsLookAndFeel::~nsLookAndFeel() { +#if (MOZ_WIDGET_GTK == 2) g_object_unref(mStyle); +#else + g_object_unref(mBackgroundStyle); + g_object_unref(mViewStyle); + g_object_unref(mButtonStyle); +#endif } nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) { +#if (MOZ_WIDGET_GTK == 3) + GdkRGBA gdk_color; +#endif nsresult res = NS_OK; switch (aID) { // These colors don't seem to be used for anything anymore in Mozilla // (except here at least TextSelectBackground and TextSelectForeground) // The CSS2 colors below are used. +#if (MOZ_WIDGET_GTK == 2) case eColorID_WindowBackground: aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]); break; @@ -103,12 +95,47 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) case eColorID_WidgetSelectForeground: aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_SELECTED]); break; +#else + case eColorID_WindowBackground: + case eColorID_WidgetBackground: + case eColorID_TextBackground: + case eColorID_activecaption: // active window caption background + case eColorID_appworkspace: // MDI background color + case eColorID_background: // desktop background + case eColorID_window: + case eColorID_windowframe: + case eColorID__moz_dialog: + aColor = sMozWindowBackground; + break; + case eColorID_WindowForeground: + case eColorID_WidgetForeground: + case eColorID_TextForeground: + case eColorID_captiontext: // text in active window caption, size box, and scrollbar arrow box (!) + case eColorID_windowtext: + case eColorID__moz_dialogtext: + aColor = sMozWindowText; + break; + case eColorID_WidgetSelectBackground: + case eColorID_TextSelectBackground: + case eColorID_IMESelectedRawTextBackground: + case eColorID_IMESelectedConvertedTextBackground: + case eColorID__moz_dragtargetzone: + aColor = sMozWindowSelectedBackground; + break; + case eColorID_WidgetSelectForeground: + case eColorID_TextSelectForeground: + case eColorID_IMESelectedRawTextForeground: + case eColorID_IMESelectedConvertedTextForeground: + aColor = sMozWindowSelectedText; + break; +#endif case eColorID_Widget3DHighlight: aColor = NS_RGB(0xa0,0xa0,0xa0); break; case eColorID_Widget3DShadow: aColor = NS_RGB(0x40,0x40,0x40); break; +#if (MOZ_WIDGET_GTK == 2) case eColorID_TextBackground: // not used? aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]); @@ -129,6 +156,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) // still used aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_SELECTED]); break; +#endif case eColorID_IMERawInputBackground: case eColorID_IMEConvertedTextBackground: aColor = NS_TRANSPARENT; @@ -149,6 +177,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) aColor = NS_RGB(0xff, 0, 0); break; +#if (MOZ_WIDGET_GTK == 2) // css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors case eColorID_activeborder: // active window border @@ -194,6 +223,48 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) // text in inactive window caption aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_INSENSITIVE]); break; +#else + // css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors + case eColorID_activeborder: + // active window border + gtk_style_context_get_border_color(mBackgroundStyle, + GTK_STATE_FLAG_NORMAL, &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID_inactiveborder: + // inactive window border + gtk_style_context_get_border_color(mBackgroundStyle, + GTK_STATE_FLAG_INSENSITIVE, + &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID_graytext: // disabled text in windows, menus, etc. + case eColorID_inactivecaptiontext: // text in inactive window caption + gtk_style_context_get_color(mBackgroundStyle, + GTK_STATE_FLAG_INSENSITIVE, &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID_highlight: // preference selected item, + // background of selected item + gtk_style_context_get_background_color(mViewStyle, + GTK_STATE_FLAG_SELECTED, + &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID_highlighttext: + // text of selected item + gtk_style_context_get_color(mViewStyle, + GTK_STATE_FLAG_SELECTED, &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID_inactivecaption: + // inactive window caption + gtk_style_context_get_background_color(mBackgroundStyle, + GTK_STATE_FLAG_INSENSITIVE, + &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; +#endif case eColorID_infobackground: // tooltip background color aColor = sInfoBackground; @@ -212,7 +283,11 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) break; case eColorID_scrollbar: // scrollbar gray area +#if (MOZ_WIDGET_GTK == 2) aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_ACTIVE]); +#else + aColor = sMozScrollbar; +#endif break; case eColorID_threedface: @@ -245,6 +320,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) aColor = sButtonInnerDarkBorder; break; +#if (MOZ_WIDGET_GTK == 2) case eColorID_threeddarkshadow: // 3-D shadow outer edge color aColor = GDK_COLOR_TO_NS_RGB(mStyle->black); @@ -293,6 +369,50 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) case eColorID__moz_html_cellhighlighttext: aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_ACTIVE]); break; +#else + case eColorID_threeddarkshadow: + // Hardcode to black + aColor = NS_RGB(0x00,0x00,0x00);; + break; + + case eColorID__moz_eventreerow: + case eColorID__moz_field: + aColor = sMozFieldBackground; + break; + case eColorID__moz_fieldtext: + aColor = sMozFieldText; + break; + case eColorID__moz_buttondefault: + // default button border color + gtk_style_context_get_border_color(mButtonStyle, + GTK_STATE_FLAG_NORMAL, &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID__moz_buttonhoverface: + gtk_style_context_get_background_color(mButtonStyle, + GTK_STATE_FLAG_PRELIGHT, + &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID__moz_buttonhovertext: + gtk_style_context_get_color(mButtonStyle, + GTK_STATE_FLAG_PRELIGHT, &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID__moz_cellhighlight: + case eColorID__moz_html_cellhighlight: + gtk_style_context_get_background_color(mViewStyle, + GTK_STATE_FLAG_SELECTED, + &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; + case eColorID__moz_cellhighlighttext: + case eColorID__moz_html_cellhighlighttext: + gtk_style_context_get_color(mViewStyle, + GTK_STATE_FLAG_SELECTED, &gdk_color); + aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); + break; +#endif case eColorID__moz_menuhover: aColor = sMenuHover; break; @@ -327,6 +447,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) return res; } +#if (MOZ_WIDGET_GTK == 2) static void darken_gdk_color(GdkColor *src, GdkColor *dest) { gdouble red; @@ -345,6 +466,7 @@ static void darken_gdk_color(GdkColor *src, GdkColor *dest) dest->green = green * 65535.0; dest->blue = blue * 65535.0; } +#endif static int32_t CheckWidgetStyle(GtkWidget* aWidget, const char* aStyle, int32_t aResult) { gboolean value = FALSE; @@ -696,7 +818,7 @@ GetSystemFontInfo(LookAndFeel::FontID aID, GtkWidget *accel_label = gtk_accel_label_new("M"); GtkWidget *menuitem = gtk_menu_item_new(); GtkWidget *menu = gtk_menu_new(); - g_object_ref_sink(GTK_OBJECT(menu)); + g_object_ref_sink(menu); gtk_container_add(GTK_CONTAINER(menuitem), accel_label); gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(menu), menuitem); @@ -787,15 +909,48 @@ nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName, return true; } -void -nsLookAndFeel::InitLookAndFeel() +#if (MOZ_WIDGET_GTK == 3) +static GtkStyleContext* +create_context(GtkWidgetPath *path) { - GtkStyle *style; + GtkStyleContext *style = gtk_style_context_new(); + gtk_style_context_set_path(style, path); + return(style); +} +#endif +void +nsLookAndFeel::Init() +{ + GdkColor colorValue; + GdkColor *colorValuePtr; + +#if (MOZ_WIDGET_GTK == 2) + NS_ASSERTION(!mStyle, "already initialized"); + // GtkInvisibles come with a refcount that is not floating + // (since their initialization code calls g_object_ref_sink) and + // their destroy code releases that reference (which means they + // have to be explicitly destroyed, since calling unref enough + // to cause destruction would lead to *another* unref). + // However, this combination means that it's actually still ok + // to use the normal pattern, which is to g_object_ref_sink + // after construction, and then destroy *and* unref when we're + // done. (Though we could skip the g_object_ref_sink and the + // corresponding g_object_unref, but that's particular to + // GtkInvisibles and GtkWindows.) + GtkWidget *widget = gtk_invisible_new(); + g_object_ref_sink(widget); // effectively g_object_ref (see above) + + gtk_widget_ensure_style(widget); + mStyle = gtk_style_copy(gtk_widget_get_style(widget)); + + gtk_widget_destroy(widget); + g_object_unref(widget); + // tooltip foreground and background - style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), - "gtk-tooltips", "GtkWindow", - GTK_TYPE_WINDOW); + GtkStyle *style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), + "gtk-tooltips", "GtkWindow", + GTK_TYPE_WINDOW); if (style) { sInfoBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]); sInfoText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]); @@ -833,7 +988,89 @@ nsLookAndFeel::InitLookAndFeel() } g_object_unref(menu); +#else + GdkRGBA color; + GtkStyleContext *style + GtkWidgetPath *path = gtk_widget_path_new(); + gtk_widget_path_append_type(path, GTK_TYPE_WINDOW); + + mBackgroundStyle = create_context(path); + gtk_style_context_add_class(mBackgroundStyle, GTK_STYLE_CLASS_BACKGROUND); + + mViewStyle = create_context(path); + gtk_style_context_add_class(mViewStyle, GTK_STYLE_CLASS_VIEW); + + mButtonStyle = create_context(path); + gtk_style_context_add_class(mButtonStyle, GTK_STYLE_CLASS_BUTTON); + + // Scrollbar colors + style = create_context(path); + gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR); + gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color); + g_object_unref(style); + + // Text colors + GtkWidget *textView = gtk_text_view_new(); + style = gtk_widget_get_style_context(textView); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMozFieldBackground = GDK_RGBA_TO_NS_RGB(color); + gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMozFieldText = GDK_RGBA_TO_NS_RGBA(color); + gtk_widget_destroy(textView); + + // Window colors + style = create_context(path); + gtk_style_context_save(style); + gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMozWindowText = GDK_RGBA_TO_NS_RGBA(color); + + // Selected text and background + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_SELECTED, &color); + sMozWindowSelectedBackground = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_get_color(style, GTK_STATE_FLAG_SELECTED, &color); + sMozWindowSelectedText = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_restore(style); + + // tooltip foreground and background + gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sInfoBackground = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); + sInfoText = GDK_RGBA_TO_NS_RGBA(color); + g_object_unref(style); + + // menu foreground & menu background + GtkWidget *accel_label = gtk_accel_label_new("M"); + GtkWidget *menuitem = gtk_menu_item_new(); + GtkWidget *menu = gtk_menu_new(); + + g_object_ref_sink(menu); + + gtk_container_add(GTK_CONTAINER(menuitem), accel_label); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + + style = gtk_widget_get_style_context(accel_label); + gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMenuText = GDK_RGBA_TO_NS_RGBA(color); + + style = gtk_widget_get_style_context(menu); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMenuBackground = GDK_RGBA_TO_NS_RGBA(color); + + style = gtk_widget_get_style_context(menuitem); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color); + sMenuHover = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color); + sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color); + + g_object_unref(menu); +#endif // button styles GtkWidget *parent = gtk_fixed_new(); @@ -856,7 +1093,8 @@ nsLookAndFeel::InitLookAndFeel() gtk_container_add(GTK_CONTAINER(parent), menuBar); gtk_container_add(GTK_CONTAINER(window), parent); gtk_container_add(GTK_CONTAINER(parent), entry); - + +#if (MOZ_WIDGET_GTK == 2) gtk_widget_set_style(button, NULL); gtk_widget_set_style(label, NULL); gtk_widget_set_style(treeView, NULL); @@ -895,28 +1133,13 @@ nsLookAndFeel::InitLookAndFeel() sMenuBarHoverText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_SELECTED]); } - // Some themes have a unified menu bar, and support window dragging on it - gboolean supports_menubar_drag = FALSE; - GParamSpec *param_spec = - gtk_widget_class_find_style_property(GTK_WIDGET_GET_CLASS(menuBar), - "window-dragging"); - if (param_spec) { - if (g_type_is_a(G_PARAM_SPEC_VALUE_TYPE(param_spec), G_TYPE_BOOLEAN)) { - gtk_widget_style_get(menuBar, - "window-dragging", &supports_menubar_drag, - NULL); - } - } - sMenuSupportsDrag = supports_menubar_drag; - // GTK's guide to fancy odd row background colors: // 1) Check if a theme explicitly defines an odd row color // 2) If not, check if it defines an even row color, and darken it // slightly by a hardcoded value (gtkstyle.c) // 3) If neither are defined, take the base background color and // darken that by a hardcoded value - GdkColor colorValue; - GdkColor *colorValuePtr = NULL; + colorValuePtr = NULL; gtk_widget_style_get(treeView, "odd-row-color", &colorValuePtr, NULL); @@ -945,6 +1168,65 @@ nsLookAndFeel::InitLookAndFeel() sButtonInnerDarkBorder = GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]); } +#else + // Button text, background, border + style = gtk_widget_get_style_context(label); + gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); + sButtonText = GDK_RGBA_TO_NS_RGBA(color); + + // Combobox label and background colors + style = gtk_widget_get_style_context(comboboxLabel); + gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); + sComboBoxText = GDK_RGBA_TO_NS_RGBA(color); + + style = gtk_widget_get_style_context(combobox); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sComboBoxBackground = GDK_RGBA_TO_NS_RGBA(color); + + // Menubar text and hover text colors + style = gtk_widget_get_style_context(menuBar); + gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); + sMenuBarText = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color); + sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color); + + // GTK's guide to fancy odd row background colors: + // 1) Check if a theme explicitly defines an odd row color + // 2) If not, check if it defines an even row color, and darken it + // slightly by a hardcoded value (gtkstyle.c) + // 3) If neither are defined, take the base background color and + // darken that by a hardcoded value + style = gtk_widget_get_style_context(treeView); + + // Get odd row background color + gtk_style_context_save(style); + gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_restore(style); + + style = gtk_widget_get_style_context(button); + gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color); + sButtonBackground = GDK_RGBA_TO_NS_RGBA(color); + + gtk_style_context_get_border_color(style, GTK_STATE_FLAG_PRELIGHT, &color); + sButtonInnerDarkBorder = GDK_RGBA_TO_NS_RGBA(color); + gtk_style_context_get_border_color(style, GTK_STATE_FLAG_NORMAL, &color); + sButtonOuterLightBorder = GDK_RGBA_TO_NS_RGBA(color); +#endif + // Some themes have a unified menu bar, and support window dragging on it + gboolean supports_menubar_drag = FALSE; + GParamSpec *param_spec = + gtk_widget_class_find_style_property(GTK_WIDGET_GET_CLASS(menuBar), + "window-dragging"); + if (param_spec) { + if (g_type_is_a(G_PARAM_SPEC_VALUE_TYPE(param_spec), G_TYPE_BOOLEAN)) { + gtk_widget_style_get(menuBar, + "window-dragging", &supports_menubar_drag, + NULL); + } + } + sMenuSupportsDrag = supports_menubar_drag; colorValuePtr = NULL; gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, NULL); @@ -969,31 +1251,6 @@ nsLookAndFeel::InitLookAndFeel() gtk_widget_destroy(window); } -void -nsLookAndFeel::InitWidget() -{ - NS_ASSERTION(!mStyle, "already initialized"); - // GtkInvisibles come with a refcount that is not floating - // (since their initialization code calls g_object_ref_sink) and - // their destroy code releases that reference (which means they - // have to be explicitly destroyed, since calling unref enough - // to cause destruction would lead to *another* unref). - // However, this combination means that it's actually still ok - // to use the normal pattern, which is to g_object_ref_sink - // after construction, and then destroy *and* unref when we're - // done. (Though we could skip the g_object_ref_sink and the - // corresponding g_object_unref, but that's particular to - // GtkInvisibles and GtkWindows.) - GtkWidget *widget = gtk_invisible_new(); - g_object_ref_sink(widget); // effectively g_object_ref (see above) - - gtk_widget_ensure_style(widget); - mStyle = gtk_style_copy(gtk_widget_get_style(widget)); - - gtk_widget_destroy(widget); - g_object_unref(widget); -} - // virtual PRUnichar nsLookAndFeel::GetPasswordCharacterImpl() @@ -1011,11 +1268,20 @@ nsLookAndFeel::RefreshImpl() mFieldFontCached = false; mMenuFontCached = false; +#if (MOZ_WIDGET_GTK == 2) g_object_unref(mStyle); mStyle = nullptr; +#else + g_object_unref(mBackgroundStyle); + g_object_unref(mViewStyle); + g_object_unref(mButtonStyle); - InitWidget(); - InitLookAndFeel(); + mBackgroundStyle = nullptr; + mViewStyle = nullptr; + mButtonStyle = nullptr; +#endif + + Init(); } bool diff --git a/widget/gtk2/nsLookAndFeel.h b/widget/gtk2/nsLookAndFeel.h index f6d158abd07..804e9742112 100644 --- a/widget/gtk2/nsLookAndFeel.h +++ b/widget/gtk2/nsLookAndFeel.h @@ -31,7 +31,13 @@ public: virtual bool GetEchoPasswordImpl(); protected: +#if (MOZ_WIDGET_GTK == 2) struct _GtkStyle *mStyle; +#else + struct _GtkStyleContext *mBackgroundStyle; + struct _GtkStyleContext *mViewStyle; + struct _GtkStyleContext *mButtonStyle; +#endif // Cached fonts bool mDefaultFontCached; @@ -47,31 +53,35 @@ protected: gfxFontStyle mFieldFontStyle; gfxFontStyle mMenuFontStyle; - // Cached colors, we have to create a dummy widget to actually - // get the style + // Cached colors + nscolor sInfoBackground; + nscolor sInfoText; + nscolor sMenuBackground; + nscolor sMenuBarText; + nscolor sMenuBarHoverText; + nscolor sMenuText; + nscolor sMenuHover; + nscolor sMenuHoverText; + nscolor sButtonBackground; + nscolor sButtonText; + nscolor sButtonOuterLightBorder; + nscolor sButtonInnerDarkBorder; + nscolor sOddCellBackground; + nscolor sNativeHyperLinkText; + nscolor sComboBoxText; + nscolor sComboBoxBackground; + nscolor sMozFieldText; + nscolor sMozFieldBackground; + nscolor sMozWindowText; + nscolor sMozWindowBackground; + nscolor sMozWindowSelectedText; + nscolor sMozWindowSelectedBackground; + nscolor sMozScrollbar; + PRUnichar sInvisibleCharacter; + float sCaretRatio; + bool sMenuSupportsDrag; - static nscolor sInfoBackground; - static nscolor sInfoText; - static nscolor sMenuBackground; - static nscolor sMenuBarText; - static nscolor sMenuBarHoverText; - static nscolor sMenuText; - static nscolor sMenuHover; - static nscolor sMenuHoverText; - static nscolor sButtonBackground; - static nscolor sButtonText; - static nscolor sButtonOuterLightBorder; - static nscolor sButtonInnerDarkBorder; - static nscolor sOddCellBackground; - static nscolor sNativeHyperLinkText; - static nscolor sComboBoxText; - static nscolor sComboBoxBackground; - static PRUnichar sInvisibleCharacter; - static float sCaretRatio; - static bool sMenuSupportsDrag; - - static void InitLookAndFeel(); - void InitWidget(); + void Init(); }; #endif diff --git a/widget/gtk2/nsNativeThemeGTK.cpp b/widget/gtk2/nsNativeThemeGTK.cpp index 6c8e8de76f8..a22741a97e1 100644 --- a/widget/gtk2/nsNativeThemeGTK.cpp +++ b/widget/gtk2/nsNativeThemeGTK.cpp @@ -470,15 +470,10 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame, break; case eTreeSortDirection_Natural: default: - /* GTK_ARROW_NONE is implemented since GTK 2.10 - * This prevents the treecolums from getting smaller + /* This prevents the treecolums from getting smaller * and wider when switching sort direction off and on * */ -#if GTK_CHECK_VERSION(2,10,0) *aWidgetFlags = GTK_ARROW_NONE; -#else - return false; // Don't draw when we shouldn't -#endif // GTK_CHECK_VERSION(2,10,0) break; } } @@ -1474,7 +1469,9 @@ nsNativeThemeGTK::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType) case NS_THEME_SCROLLBAR_TRACK_VERTICAL: case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: case NS_THEME_TOOLBAR: +#if (MOZ_WIDGET_GTK == 2) case NS_THEME_MENUBAR: +#endif case NS_THEME_MENUPOPUP: case NS_THEME_WINDOW: case NS_THEME_DIALOG: diff --git a/widget/gtk2/nsScreenGtk.cpp b/widget/gtk2/nsScreenGtk.cpp index 9332b2f1671..7840c9b7414 100644 --- a/widget/gtk2/nsScreenGtk.cpp +++ b/widget/gtk2/nsScreenGtk.cpp @@ -93,11 +93,7 @@ nsScreenGtk :: Init (GdkWindow *aRootWindow) int format_returned; int length_returned; -#if GTK_CHECK_VERSION(2,0,0) GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL); -#else - GdkAtom cardinal_atom = (GdkAtom) XA_CARDINAL; -#endif gdk_error_trap_push(); diff --git a/widget/gtk2/nsScreenManagerGtk.cpp b/widget/gtk2/nsScreenManagerGtk.cpp index a8d5d27e535..7c134cc00b6 100644 --- a/widget/gtk2/nsScreenManagerGtk.cpp +++ b/widget/gtk2/nsScreenManagerGtk.cpp @@ -89,11 +89,7 @@ nsScreenManagerGtk :: EnsureInit() if (mCachedScreenArray.Count() > 0) return NS_OK; -#if GTK_CHECK_VERSION(2,2,0) mRootWindow = gdk_get_default_root_window(); -#else - mRootWindow = GDK_ROOT_PARENT(); -#endif // GTK_CHECK_VERSION(2,2,0) g_object_ref(mRootWindow); // GDK_STRUCTURE_MASK ==> StructureNotifyMask, for ConfigureNotify diff --git a/widget/gtk2/nsWidgetFactory.cpp b/widget/gtk2/nsWidgetFactory.cpp index 88cabcba789..dc1c3afcd1a 100644 --- a/widget/gtk2/nsWidgetFactory.cpp +++ b/widget/gtk2/nsWidgetFactory.cpp @@ -139,7 +139,7 @@ nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID, Preferences::GetBool("ui.allow_platform_file_picker", true); nsCOMPtr picker; - if (allowPlatformPicker && gtk_check_version(2,6,3) == NULL) { + if (allowPlatformPicker) { picker = new nsFilePicker; } else { picker = do_CreateInstance(kXULFilePickerCID); diff --git a/widget/qt/nsIdleServiceQt.h b/widget/qt/nsIdleServiceQt.h index 03ccfe8fa4f..c4fed02e683 100644 --- a/widget/qt/nsIdleServiceQt.h +++ b/widget/qt/nsIdleServiceQt.h @@ -33,14 +33,13 @@ public: static already_AddRefed GetInstance() { - nsIdleServiceQt* idleService = - static_cast(nsIdleService::GetInstance().get()); + nsRefPtr idleService = + nsIdleService::GetInstance().downcast(); if (!idleService) { idleService = new nsIdleServiceQt(); - NS_ADDREF(idleService); } - return idleService; + return idleService.forget(); } private: diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 1d049f2bee3..f49fd0967e5 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -1011,14 +1011,13 @@ nsWindow::GetAttention(int32_t aCycleCount) static already_AddRefed GetSurfaceForQWidget(QWidget* aDrawable) { - gfxASurface* result = + nsRefPtr result = new gfxXlibSurface(gfxQtPlatform::GetXDisplay(aDrawable), aDrawable->winId(), DefaultVisualOfScreen(gfxQtPlatform::GetXScreen(aDrawable)), gfxIntSize(aDrawable->size().width(), aDrawable->size().height())); - NS_IF_ADDREF(result); - return result; + return result.forget(); } #endif diff --git a/widget/windows/KeyboardLayout.h b/widget/windows/KeyboardLayout.h index bd29933ebe3..07472bd638b 100644 --- a/widget/windows/KeyboardLayout.h +++ b/widget/windows/KeyboardLayout.h @@ -11,7 +11,7 @@ #include "nsEvent.h" #include "nsString.h" #include "nsWindowBase.h" -#include "nsWindowDefs.h " +#include "nsWindowDefs.h" #include #define NS_NUM_OF_KEYS 68 diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index db3ce6bab5e..10247de43c0 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -37,6 +37,7 @@ using namespace mozilla; +using namespace mozilla::widget; #define DEFAULT_THREAD_TIMEOUT_MS 30000 @@ -1114,7 +1115,8 @@ nsDataObj :: GetFileContentsInternetShortcut ( FORMATETC& aFE, STGMEDIUM& aSTG ) const char *shortcutFormatStr; int totalLen; nsCString path; - if (!Preferences::GetBool(kShellIconPref, true)) { + if (!Preferences::GetBool(kShellIconPref, true) || + WinUtils::GetWindowsVersion() < WinUtils::VISTA_VERSION) { shortcutFormatStr = "[InternetShortcut]\r\nURL=%s\r\n"; const int formatLen = strlen(shortcutFormatStr) - 2; // don't include %s totalLen = formatLen + asciiUrl.Length(); // don't include null character diff --git a/xpcom/reflect/xptcall/src/md/win32/moz.build b/xpcom/reflect/xptcall/src/md/win32/moz.build index a2e00af0e95..86962784fd0 100644 --- a/xpcom/reflect/xptcall/src/md/win32/moz.build +++ b/xpcom/reflect/xptcall/src/md/win32/moz.build @@ -12,11 +12,18 @@ if CONFIG['TARGET_CPU'] == 'x86_64': 'xptcinvoke_x86_64.cpp', 'xptcstubs_x86_64_gnu.cpp', ] + ASFILES += [ + 'xptcinvoke_asm_x86_64_gnu.s' + ] else: CPP_SOURCES += [ 'xptcinvoke_x86_64.cpp', 'xptcstubs_x86_64.cpp' ] + ASFILES += [ + 'xptcinvoke_asm_x86_64.asm', + 'xptcstubs_asm_x86_64.asm' + ] else: if CONFIG['GNU_CXX']: CPP_SOURCES += [ diff --git a/xpcom/tests/TestSettingsAPI.cpp b/xpcom/tests/TestSettingsAPI.cpp index 0cc3ac9c24a..06c3f8094b5 100644 --- a/xpcom/tests/TestSettingsAPI.cpp +++ b/xpcom/tests/TestSettingsAPI.cpp @@ -162,7 +162,7 @@ TestSettingsObserver::Observe(nsISupports *aSubject, // Parse the JSON data. nsDependentString dataStr(aData); - JS::Value data; + JS::Rooted data(cx); if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &data) || !data.isObject()) { CHECK_MSG(false, "Failed to get the data");