Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2022-10-27 09:04:51 +08:00
commit 5f18cf3bed
41 changed files with 234 additions and 485 deletions

View file

@ -26,16 +26,19 @@
key="&closeCmd.key;"
command="toolbox-cmd-close"
modifiers="accel"/>
<key id="toolbox-key-toggle"
key="&toggleToolbox.key;"
command="toolbox-cmd-close"
modifiers="accel,shift"
disabled="true"/>
#ifdef XP_MACOSX
<key id="toolbox-key-toggle-osx"
key="&toggleToolbox.key;"
command="toolbox-cmd-close"
modifiers="accel,alt"
disabled="true"/>
#else
<key id="toolbox-key-toggle"
key="&toggleToolbox.key;"
command="toolbox-cmd-close"
modifiers="accel,shift"
disabled="true"/>
#endif
<key id="toolbox-key-toggle-F12"
keycode="&toggleToolboxF12.keycode;"
keytext="&toggleToolboxF12.keytext;"

View file

@ -104,7 +104,7 @@ devtools.jar:
content/commandline/commandline.css (commandline/commandline.css)
content/commandline/commandlineoutput.xhtml (commandline/commandlineoutput.xhtml)
content/commandline/commandlinetooltip.xhtml (commandline/commandlinetooltip.xhtml)
content/framework/toolbox-window.xul (framework/toolbox-window.xul)
* content/framework/toolbox-window.xul (framework/toolbox-window.xul)
content/framework/toolbox-options.xhtml (framework/toolbox-options.xhtml)
content/framework/toolbox.xul (framework/toolbox.xul)
content/framework/toolbox-init.js (framework/toolbox-init.js)

View file

@ -1921,7 +1921,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
}
nsAutoCString orphan;
if (!tmp->IsInUncomposedDoc() &&
if (!tmp->IsInComposedDoc() &&
// Ignore xbl:content, which is never in the document and hence always
// appears to be orphaned.
!tmp->NodeInfo()->Equals(nsGkAtoms::content, kNameSpaceID_XBL)) {

View file

@ -2367,75 +2367,6 @@ nsDOMWindowUtils::GetCurrentAudioBackend(nsAString& aBackend)
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::StartFrameTimeRecording(uint32_t *startIndex)
{
NS_ENSURE_ARG_POINTER(startIndex);
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget)
return NS_ERROR_FAILURE;
LayerManager *mgr = widget->GetLayerManager();
if (!mgr)
return NS_ERROR_FAILURE;
const uint32_t kRecordingMinSize = 60 * 10; // 10 seconds @60 fps.
const uint32_t kRecordingMaxSize = 60 * 60 * 60; // One hour
uint32_t bufferSize = Preferences::GetUint("toolkit.framesRecording.bufferSize", uint32_t(0));
bufferSize = std::min(bufferSize, kRecordingMaxSize);
bufferSize = std::max(bufferSize, kRecordingMinSize);
*startIndex = mgr->StartFrameTimeRecording(bufferSize);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::StopFrameTimeRecording(uint32_t startIndex,
uint32_t *frameCount,
float **frameIntervals)
{
NS_ENSURE_ARG_POINTER(frameCount);
NS_ENSURE_ARG_POINTER(frameIntervals);
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget)
return NS_ERROR_FAILURE;
LayerManager *mgr = widget->GetLayerManager();
if (!mgr)
return NS_ERROR_FAILURE;
nsTArray<float> tmpFrameIntervals;
mgr->StopFrameTimeRecording(startIndex, tmpFrameIntervals);
*frameCount = tmpFrameIntervals.Length();
*frameIntervals = (float*)moz_xmalloc(*frameCount * sizeof(float));
/* copy over the frame intervals and paint times into the arrays we just allocated */
for (uint32_t i = 0; i < *frameCount; i++) {
(*frameIntervals)[i] = tmpFrameIntervals[i];
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::BeginTabSwitch()
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget)
return NS_ERROR_FAILURE;
LayerManager *mgr = widget->GetLayerManager();
if (!mgr)
return NS_ERROR_FAILURE;
mgr->BeginTabSwitch();
return NS_OK;
}
static bool
ComputeAnimationValue(nsCSSPropertyID aProperty,
Element* aElement,
@ -2478,7 +2409,7 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
nsPresContext* presContext = GetPresContext();
if (presContext) {
nsRefreshDriver* driver = presContext->RefreshDriver();
RefPtr<nsRefreshDriver> driver = presContext->RefreshDriver();
driver->AdvanceTimeAndRefresh(aMilliseconds);
RefPtr<LayerTransactionChild> transaction = GetLayerTransaction();

View file

@ -303,13 +303,13 @@ WebGLContext::FromDomElem(const char* funcName, TexImageTarget target, uint32_t
uint32_t height, uint32_t depth, const dom::Element& elem,
ErrorResult* const out_error)
{
if (elem.IsHTMLElement(nsGkAtoms::canvas)) {
const dom::HTMLCanvasElement* canvas = static_cast<const dom::HTMLCanvasElement*>(&elem);
if (canvas->IsWriteOnly()) {
out_error->Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
}
if (elem.IsHTMLElement(nsGkAtoms::canvas)) {
const dom::HTMLCanvasElement* canvas = static_cast<const dom::HTMLCanvasElement*>(&elem);
if (canvas->IsWriteOnly()) {
out_error->Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
}
uint32_t flags = nsLayoutUtils::SFE_WANT_IMAGE_SURFACE |
nsLayoutUtils::SFE_USE_ELEMENT_SIZE_IF_VECTOR;
@ -1032,9 +1032,27 @@ ValidateCompressedTexImageRestrictions(const char* funcName, WebGLContext* webgl
}
static bool
ValidateTargetForFormat(const char* funcName, WebGLContext* webgl, TexImageTarget target,
const webgl::FormatInfo* format)
{
ValidateFormatAndSize(const char* funcName,
WebGLContext* webgl,
TexImageTarget target,
const webgl::FormatInfo* format,
const uint32_t width,
const uint32_t height,
const uint32_t depth) {
// Check if texture size will likely be rejected by the driver and give a more
// meaningful error message.
auto baseImageSize = CheckedInt<uint64_t>(format->estimatedBytesPerPixel) *
width * height * depth;
if (target == LOCAL_GL_TEXTURE_CUBE_MAP) {
baseImageSize *= 6;
}
if (!baseImageSize.isValid() ||
baseImageSize.value() > (uint64_t)gfxPrefs::WebGLMaxSizePerTextureMB * (1024 * 1024)) {
webgl->ErrorOutOfMemory("Texture size too large; base image MB > webgl.max-size-per-texture-mb");
return false;
}
// GLES 3.0.4 p127:
// "Textures with a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL are
// supported by texture image specification commands only if `target` is TEXTURE_2D,
@ -1137,7 +1155,8 @@ WebGLTexture::TexStorage(const char* funcName, TexTarget target, GLsizei levels,
}
auto dstFormat = dstUsage->format;
if (!ValidateTargetForFormat(funcName, mContext, testTarget, dstFormat))
if (!ValidateFormatAndSize(funcName, mContext, testTarget, dstFormat,
width, height, depth))
return;
if (dstFormat->compression) {
@ -1264,7 +1283,8 @@ WebGLTexture::TexImage(const char* funcName, TexImageTarget target, GLint level,
// Check that source and dest info are compatible
auto dstFormat = dstUsage->format;
if (!ValidateTargetForFormat(funcName, mContext, target, dstFormat))
if (!ValidateFormatAndSize(funcName, mContext, target, dstFormat,
blob->mWidth, blob->mHeight, blob->mDepth))
return;
if (!mContext->IsWebGL2() && dstFormat->d) {
@ -1484,7 +1504,8 @@ WebGLTexture::CompressedTexImage(const char* funcName, TexImageTarget target, GL
return;
}
if (!ValidateTargetForFormat(funcName, mContext, target, format))
if (!ValidateFormatAndSize(funcName, mContext, target, format,
blob->mWidth, blob->mHeight, blob->mDepth))
return;
////////////////////////////////////
@ -2143,7 +2164,8 @@ WebGLTexture::CopyTexImage2D(TexImageTarget target, GLint level, GLenum internal
return;
const auto& dstFormat = dstUsage->format;
if (!ValidateTargetForFormat(funcName, mContext, target, dstFormat))
if (!ValidateFormatAndSize(funcName, mContext, target, dstFormat,
width, height, depth))
return;
if (!mContext->IsWebGL2() && dstFormat->d) {

View file

@ -49,7 +49,7 @@ interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest;
interface nsIObserver;
[scriptable, uuid(7fcc7958-77d9-45ff-8c81-277bde5f0dc8)]
[scriptable, uuid(58e97ce9-1d9e-4576-aabf-89480fdeb16d)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -1425,38 +1425,6 @@ interface nsIDOMWindowUtils : nsISupports {
*/
readonly attribute AString currentAudioBackend;
/**
* Record (and return) frame-intervals for frames which were presented
* between calling StartFrameTimeRecording and StopFrameTimeRecording.
*
* - Uses a cyclic buffer and serves concurrent consumers, so if Stop is called too late
* (elements were overwritten since Start), result is considered invalid and hence empty.
* - Buffer is capable of holding 10 seconds @ 60fps (or more if frames were less frequent).
* Can be changed (up to 1 hour) via pref: toolkit.framesRecording.bufferSize.
* - Note: the first frame-interval may be longer than expected because last frame
* might have been presented some time before calling StartFrameTimeRecording.
*/
/**
* Returns a handle which represents current recording start position.
*/
void startFrameTimeRecording([retval] out unsigned long startIndex);
/**
* Returns number of recorded frames since startIndex was issued,
* and allocates+populates 2 arraye with the recorded data.
* - Allocation is infallible. Should be released even if size is 0.
*/
void stopFrameTimeRecording(in unsigned long startIndex,
[optional] out unsigned long frameCount,
[retval, array, size_is(frameCount)] out float frameIntervals);
/**
* Signals that we're begining to tab switch. This is used by painting code to
* determine total tab switch time.
*/
void beginTabSwitch();
/**
* The DPI of the display
*/

View file

@ -664,8 +664,7 @@ HTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return TypedText(NS_LITERAL_STRING("\t"), eTypedText);
}
case NS_VK_RETURN:
if (nativeKeyEvent->IsControl() || nativeKeyEvent->IsAlt() ||
nativeKeyEvent->IsMeta() || nativeKeyEvent->IsOS()) {
if (!nativeKeyEvent->IsInputtingLineBreak()) {
return NS_OK;
}
aKeyEvent->AsEvent()->PreventDefault(); // consumed
@ -677,11 +676,7 @@ HTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return TypedText(EmptyString(), eTypedBreak);
}
// NOTE: On some keyboard layout, some characters are inputted with Control
// key or Alt key, but at that time, widget sets FALSE to these keys.
if (!nativeKeyEvent->mCharCode || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() ||
nativeKeyEvent->IsOS()) {
if (!nativeKeyEvent->IsInputtingText()) {
// we don't PreventDefault() here or keybindings like control-x won't work
return NS_OK;
}

View file

@ -397,20 +397,14 @@ TextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return TypedText(NS_LITERAL_STRING("\t"), eTypedText);
}
case NS_VK_RETURN:
if (IsSingleLineEditor() || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() ||
nativeKeyEvent->IsOS()) {
if (IsSingleLineEditor() || !nativeKeyEvent->IsInputtingLineBreak()) {
return NS_OK;
}
aKeyEvent->AsEvent()->PreventDefault();
return TypedText(EmptyString(), eTypedBreak);
}
// NOTE: On some keyboard layout, some characters are inputted with Control
// key or Alt key, but at that time, widget sets FALSE to these keys.
if (!nativeKeyEvent->mCharCode || nativeKeyEvent->IsControl() ||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() ||
nativeKeyEvent->IsOS()) {
if (!nativeKeyEvent->IsInputtingText()) {
// we don't PreventDefault() here or keybindings like control-x won't work
return NS_OK;
}

View file

@ -714,7 +714,7 @@ mozInlineSpellChecker::RegisterEventListeners()
true, false);
piTarget->AddEventListener(NS_LITERAL_STRING("click"), this,
false, false);
piTarget->AddEventListener(NS_LITERAL_STRING("keypress"), this,
piTarget->AddEventListener(NS_LITERAL_STRING("keydown"), this,
false, false);
return NS_OK;
}
@ -738,7 +738,7 @@ mozInlineSpellChecker::UnregisterEventListeners()
piTarget->RemoveEventListener(NS_LITERAL_STRING("blur"), this, true);
piTarget->RemoveEventListener(NS_LITERAL_STRING("click"), this, false);
piTarget->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, false);
piTarget->RemoveEventListener(NS_LITERAL_STRING("keydown"), this, false);
return NS_OK;
}
@ -1916,8 +1916,8 @@ NS_IMETHODIMP mozInlineSpellChecker::HandleEvent(nsIDOMEvent* aEvent)
if (eventType.EqualsLiteral("click")) {
return MouseClick(aEvent);
}
if (eventType.EqualsLiteral("keypress")) {
return KeyPress(aEvent);
if (eventType.EqualsLiteral("keydown")) {
return KeyDown(aEvent);
}
return NS_OK;
@ -1943,7 +1943,7 @@ nsresult mozInlineSpellChecker::MouseClick(nsIDOMEvent *aMouseEvent)
return NS_OK;
}
nsresult mozInlineSpellChecker::KeyPress(nsIDOMEvent* aKeyEvent)
nsresult mozInlineSpellChecker::KeyDown(nsIDOMEvent* aKeyEvent)
{
nsCOMPtr<nsIDOMKeyEvent>keyEvent = do_QueryInterface(aKeyEvent);
NS_ENSURE_TRUE(keyEvent, NS_OK);

View file

@ -197,7 +197,7 @@ public:
nsresult Blur(nsIDOMEvent* aEvent);
nsresult MouseClick(nsIDOMEvent* aMouseEvent);
nsresult KeyPress(nsIDOMEvent* aKeyEvent);
nsresult KeyDown(nsIDOMEvent* aKeyEvent);
mozInlineSpellChecker();

View file

@ -1545,115 +1545,6 @@ RefLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
aAttrs = RefLayerAttributes(GetReferentId(), mEventRegionsOverride);
}
/**
* StartFrameTimeRecording, together with StopFrameTimeRecording
* enable recording of frame intervals.
*
* To allow concurrent consumers, a cyclic array is used which serves all
* consumers, practically stateless with regard to consumers.
*
* To save resources, the buffer is allocated on first call to StartFrameTimeRecording
* and recording is paused if no consumer which called StartFrameTimeRecording is able
* to get valid results (because the cyclic buffer was overwritten since that call).
*
* To determine availability of the data upon StopFrameTimeRecording:
* - mRecording.mNextIndex increases on each PostPresent, and never resets.
* - Cyclic buffer position is realized as mNextIndex % bufferSize.
* - StartFrameTimeRecording returns mNextIndex. When StopFrameTimeRecording is called,
* the required start index is passed as an arg, and we're able to calculate the required
* length. If this length is bigger than bufferSize, it means data was overwritten.
* otherwise, we can return the entire sequence.
* - To determine if we need to pause, mLatestStartIndex is updated to mNextIndex
* on each call to StartFrameTimeRecording. If this index gets overwritten,
* it means that all earlier start indices obtained via StartFrameTimeRecording
* were also overwritten, hence, no point in recording, so pause.
* - mCurrentRunStartIndex indicates the oldest index of the recording after which
* the recording was not paused. If StopFrameTimeRecording is invoked with a start index
* older than this, it means that some frames were not recorded, so data is invalid.
*/
uint32_t
LayerManager::StartFrameTimeRecording(int32_t aBufferSize)
{
if (mRecording.mIsPaused) {
mRecording.mIsPaused = false;
if (!mRecording.mIntervals.Length()) { // Initialize recording buffers
mRecording.mIntervals.SetLength(aBufferSize);
}
// After being paused, recent values got invalid. Update them to now.
mRecording.mLastFrameTime = TimeStamp::Now();
// Any recording which started before this is invalid, since we were paused.
mRecording.mCurrentRunStartIndex = mRecording.mNextIndex;
}
// If we'll overwrite this index, there are no more consumers with aStartIndex
// for which we're able to provide the full recording, so no point in keep recording.
mRecording.mLatestStartIndex = mRecording.mNextIndex;
return mRecording.mNextIndex;
}
void
LayerManager::RecordFrame()
{
if (!mRecording.mIsPaused) {
TimeStamp now = TimeStamp::Now();
uint32_t i = mRecording.mNextIndex % mRecording.mIntervals.Length();
mRecording.mIntervals[i] = static_cast<float>((now - mRecording.mLastFrameTime)
.ToMilliseconds());
mRecording.mNextIndex++;
mRecording.mLastFrameTime = now;
if (mRecording.mNextIndex > (mRecording.mLatestStartIndex + mRecording.mIntervals.Length())) {
// We've just overwritten the most recent recording start -> pause.
mRecording.mIsPaused = true;
}
}
}
void
LayerManager::PostPresent()
{
if (!mTabSwitchStart.IsNull()) {
mTabSwitchStart = TimeStamp();
}
}
void
LayerManager::StopFrameTimeRecording(uint32_t aStartIndex,
nsTArray<float>& aFrameIntervals)
{
uint32_t bufferSize = mRecording.mIntervals.Length();
uint32_t length = mRecording.mNextIndex - aStartIndex;
if (mRecording.mIsPaused || length > bufferSize || aStartIndex < mRecording.mCurrentRunStartIndex) {
// aStartIndex is too old. Also if aStartIndex was issued before mRecordingNextIndex overflowed (uint32_t)
// and stopped after the overflow (would happen once every 828 days of constant 60fps).
length = 0;
}
if (!length) {
aFrameIntervals.Clear();
return; // empty recording, return empty arrays.
}
// Set length in advance to avoid possibly repeated reallocations
aFrameIntervals.SetLength(length);
uint32_t cyclicPos = aStartIndex % bufferSize;
for (uint32_t i = 0; i < length; i++, cyclicPos++) {
if (cyclicPos == bufferSize) {
cyclicPos = 0;
}
aFrameIntervals[i] = mRecording.mIntervals[cyclicPos];
}
}
void
LayerManager::BeginTabSwitch()
{
mTabSwitchStart = TimeStamp::Now();
}
static void PrintInfo(std::stringstream& aStream, LayerComposite* aLayerComposite);
#ifdef MOZ_DUMP_PAINTING

View file

@ -586,36 +586,6 @@ public:
*/
void LogSelf(const char* aPrefix="");
/**
* Record (and return) frame-intervals and paint-times for frames which were presented
* between calling StartFrameTimeRecording and StopFrameTimeRecording.
*
* - Uses a cyclic buffer and serves concurrent consumers, so if Stop is called too late
* (elements were overwritten since Start), result is considered invalid and hence empty.
* - Buffer is capable of holding 10 seconds @ 60fps (or more if frames were less frequent).
* Can be changed (up to 1 hour) via pref: toolkit.framesRecording.bufferSize.
* - Note: the first frame-interval may be longer than expected because last frame
* might have been presented some time before calling StartFrameTimeRecording.
*/
/**
* Returns a handle which represents current recording start position.
*/
virtual uint32_t StartFrameTimeRecording(int32_t aBufferSize);
/**
* Clears, then populates aFrameIntervals with the recorded frame timing
* data. The array will be empty if data was overwritten since
* aStartIndex was obtained.
*/
virtual void StopFrameTimeRecording(uint32_t aStartIndex,
nsTArray<float>& aFrameIntervals);
void RecordFrame();
void PostPresent();
void BeginTabSwitch();
static bool IsLogEnabled();
static mozilla::LogModule* GetLog();
@ -686,27 +656,6 @@ protected:
TimeStamp mAnimationReadyTime;
// The count of pixels that were painted in the current transaction.
uint32_t mPaintedPixelCount;
private:
struct FramesTimingRecording
{
// Stores state and data for frame intervals and paint times recording.
// see LayerManager::StartFrameTimeRecording() at Layers.cpp for more details.
FramesTimingRecording()
: mNextIndex(0)
, mLatestStartIndex(0)
, mCurrentRunStartIndex(0)
, mIsPaused(true)
{}
nsTArray<float> mIntervals;
TimeStamp mLastFrameTime;
uint32_t mNextIndex;
uint32_t mLatestStartIndex;
uint32_t mCurrentRunStartIndex;
bool mIsPaused;
};
FramesTimingRecording mRecording;
TimeStamp mTabSwitchStart;
public:
/*

View file

@ -629,8 +629,6 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
if (mWidget) {
FlashWidgetUpdateArea(mTarget);
}
RecordFrame();
PostPresent();
if (!mTransactionIncomplete) {
// Clear out target if we have a complete transaction.

View file

@ -617,28 +617,6 @@ ClientLayerManager::SendInvalidRegion(const nsIntRegion& aRegion)
}
}
uint32_t
ClientLayerManager::StartFrameTimeRecording(int32_t aBufferSize)
{
CompositorBridgeChild* renderer = GetRemoteRenderer();
if (renderer) {
uint32_t startIndex;
renderer->SendStartFrameTimeRecording(aBufferSize, &startIndex);
return startIndex;
}
return -1;
}
void
ClientLayerManager::StopFrameTimeRecording(uint32_t aStartIndex,
nsTArray<float>& aFrameIntervals)
{
CompositorBridgeChild* renderer = GetRemoteRenderer();
if (renderer) {
renderer->SendStopFrameTimeRecording(aStartIndex, &aFrameIntervals);
}
}
void
ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
{

View file

@ -98,11 +98,6 @@ public:
virtual void FlushRendering() override;
void SendInvalidRegion(const nsIntRegion& aRegion);
virtual uint32_t StartFrameTimeRecording(int32_t aBufferSize) override;
virtual void StopFrameTimeRecording(uint32_t aStartIndex,
nsTArray<float>& aFrameIntervals) override;
virtual bool NeedsWidgetInvalidation() override { return false; }
ShadowableLayer* Hold(Layer* aLayer);

View file

@ -966,8 +966,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
}
mCompositor->GetWidget()->PostRender(&widgetContext);
RecordFrame();
}
already_AddRefed<PaintedLayerComposite>

View file

@ -802,24 +802,6 @@ CompositorBridgeChild::SendFlushRendering()
return PCompositorBridgeChild::SendFlushRendering();
}
bool
CompositorBridgeChild::SendStartFrameTimeRecording(const int32_t& bufferSize, uint32_t* startIndex)
{
if (!mCanSend) {
return false;
}
return PCompositorBridgeChild::SendStartFrameTimeRecording(bufferSize, startIndex);
}
bool
CompositorBridgeChild::SendStopFrameTimeRecording(const uint32_t& startIndex, nsTArray<float>* intervals)
{
if (!mCanSend) {
return false;
}
return PCompositorBridgeChild::SendStopFrameTimeRecording(startIndex, intervals);
}
bool
CompositorBridgeChild::SendNotifyRegionInvalidated(const nsIntRegion& region)
{

View file

@ -159,8 +159,6 @@ public:
bool SendMakeSnapshot(const SurfaceDescriptor& inSnapshot, const gfx::IntRect& dirtyRect);
bool SendFlushRendering();
bool SendGetTileSize(int32_t* tileWidth, int32_t* tileHeight);
bool SendStartFrameTimeRecording(const int32_t& bufferSize, uint32_t* startIndex);
bool SendStopFrameTimeRecording(const uint32_t& startIndex, nsTArray<float>* intervals);
bool SendNotifyRegionInvalidated(const nsIntRegion& region);
bool SendRequestNotifyAfterRemotePaint();
bool SendClearApproximatelyVisibleRegions(uint64_t aLayersId, uint32_t aPresShellId);

View file

@ -817,27 +817,6 @@ CompositorBridgeParent::Invalidate()
}
}
bool
CompositorBridgeParent::RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex)
{
if (mLayerManager) {
*aOutStartIndex = mLayerManager->StartFrameTimeRecording(aBufferSize);
} else {
*aOutStartIndex = 0;
}
return true;
}
bool
CompositorBridgeParent::RecvStopFrameTimeRecording(const uint32_t& aStartIndex,
InfallibleTArray<float>* intervals)
{
if (mLayerManager) {
mLayerManager->StopFrameTimeRecording(aStartIndex, *intervals);
}
return true;
}
bool
CompositorBridgeParent::RecvClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId)

View file

@ -281,8 +281,6 @@ public:
}
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override;
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) override;
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) override;
// Unused for chrome <-> compositor communication (which this class does).
// @see CrossProcessCompositorBridgeParent::RecvRequestNotifyAfterRemotePaint

View file

@ -56,8 +56,6 @@ public:
virtual bool RecvFlushRendering() override { return true; }
virtual bool RecvForcePresent() override { return true; }
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override { return true; }
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) override { return true; }
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) override { return true; }
virtual bool RecvClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId) override;

View file

@ -184,12 +184,6 @@ parent:
// work around a windows presentation bug (See Bug 1232042)
async ForcePresent();
sync StartFrameTimeRecording(int32_t bufferSize)
returns (uint32_t startIndex);
sync StopFrameTimeRecording(uint32_t startIndex)
returns (float[] intervals);
// layersBackendHints is an ordered list of preffered backends where
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
// that hint is ignored.

View file

@ -593,6 +593,7 @@ private:
DECL_GFX_PREF(Once, "webgl.force-layers-readback", WebGLForceLayersReadback, bool, false);
DECL_GFX_PREF(Live, "webgl.lose-context-on-memory-pressure", WebGLLoseContextOnMemoryPressure, bool, false);
DECL_GFX_PREF(Live, "webgl.max-warnings-per-context", WebGLMaxWarningsPerContext, uint32_t, 32);
DECL_GFX_PREF(Live, "webgl.max-size-per-texture-mb", WebGLMaxSizePerTextureMB, uint32_t, 1024);
DECL_GFX_PREF(Live, "webgl.min_capability_mode", WebGLMinCapabilityMode, bool, false);
DECL_GFX_PREF(Live, "webgl.msaa-force", WebGLForceMSAA, bool, false);
DECL_GFX_PREF(Live, "webgl.prefer-16bpp", WebGLPrefer16bpp, bool, false);

View file

@ -212,9 +212,12 @@ SVGDocumentWrapper::TickRefreshDriver()
nsCOMPtr<nsIPresShell> presShell;
mViewer->GetPresShell(getter_AddRefs(presShell));
if (presShell) {
nsPresContext* presContext = presShell->GetPresContext();
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
if (presContext) {
presContext->RefreshDriver()->DoTick();
RefPtr<nsRefreshDriver> driver = presContext->RefreshDriver();
if (driver) {
driver->DoTick();
}
}
}
}

View file

@ -1,53 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use std::env;
use std::process::{Command, Stdio};
fn main() {
let out_dir = env::var("OUT_DIR").expect("Should have env var OUT_DIR");
let target = env::var("TARGET").expect("Should have env var TARGET");
let js_src = env::var("CARGO_MANIFEST_DIR").expect("Should have env var CARGO_MANIFEST_DIR");
env::set_current_dir(&js_src).unwrap();
let variant = if cfg!(feature = "debugmozjs") {
"plaindebug"
} else {
"plain"
};
let python = env::var("PYTHON").unwrap_or("python2.7".into());
let mut cmd = Command::new(&python);
cmd.args(&["./devtools/automation/autospider.py",
"--build-only",
"--objdir", &out_dir,
variant])
.env("SOURCE", &js_src)
.env("PWD", &js_src)
.env("AUTOMATION", "1")
.stdout(Stdio::inherit())
.stderr(Stdio::inherit());
println!("Running command: {:?}", cmd);
let result = cmd
.status()
.expect("Should spawn autospider OK");
assert!(result.success(), "autospider should exit OK");
println!("cargo:rustc-link-search=native={}/js/src", out_dir);
if target.contains("windows") {
println!("cargo:rustc-link-lib=winmm");
println!("cargo:rustc-link-lib=psapi");
if target.contains("gnu") {
println!("cargo:rustc-link-lib=stdc++");
}
} else {
println!("cargo:rustc-link-lib=stdc++");
}
println!("cargo:rustc-link-lib=static=js_static");
println!("cargo:outdir={}", out_dir);
}

View file

@ -1,2 +0,0 @@
extern crate libz_sys;

View file

@ -231,6 +231,10 @@ pref("dom.keyboardevent.code.enabled", true);
// even if this is true).
pref("dom.keyboardevent.dispatch_during_composition", false);
// If this is true, TextEventDispatcher dispatches keypress events
// for the input of non-printable characters (content only).
pref("dom.keyboardevent.keypress.dispatch_non_printable_in_content", false);
// Whether URL,Location,Link::GetHash should be percent encoded
// in setter and percent decoded in getter (old behaviour = true)
pref("dom.url.encode_decode_hash", true);
@ -4284,6 +4288,7 @@ pref("webgl.lose-context-on-memory-pressure", false);
pref("webgl.can-lose-context-in-foreground", true);
pref("webgl.restore-context-when-visible", true);
pref("webgl.max-warnings-per-context", 32);
pref("webgl.max-size-per-texture-mb", 1024);
pref("webgl.enable-draft-extensions", false);
pref("webgl.enable-privileged-extensions", false);
pref("webgl.bypass-shader-validation", false);

View file

@ -5,6 +5,7 @@
#include "nsFormFillController.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "nsIFormAutoComplete.h"
@ -40,6 +41,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsFocusManager.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_CYCLE_COLLECTION(nsFormFillController,
@ -1188,23 +1190,29 @@ nsFormFillController::AddWindowListeners(nsPIDOMWindowOuter* aWindow)
if (!target)
return;
target->AddEventListener(NS_LITERAL_STRING("focus"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("blur"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("pagehide"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("mousedown"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("input"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("keypress"), this, true, false);
target->AddEventListener(NS_LITERAL_STRING("compositionstart"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("compositionend"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("contextmenu"), this,
true, false);
EventListenerManager* elm = target->GetOrCreateListenerManager();
if (NS_WARN_IF(!elm)) {
return;
}
elm->AddEventListenerByType(this, NS_LITERAL_STRING("focus"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("blur"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("mousedown"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("input"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("keypress"),
TrustedEventsAtSystemGroupCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("compositionstart"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("compositionend"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("contextmenu"),
TrustedEventsAtCapture());
// Note that any additional listeners added should ensure that they ignore
// untrusted events, which might be sent by content that's up to no good.
@ -1226,17 +1234,29 @@ nsFormFillController::RemoveWindowListeners(nsPIDOMWindowOuter* aWindow)
if (!target)
return;
target->RemoveEventListener(NS_LITERAL_STRING("focus"), this, true);
target->RemoveEventListener(NS_LITERAL_STRING("blur"), this, true);
target->RemoveEventListener(NS_LITERAL_STRING("pagehide"), this, true);
target->RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, true);
target->RemoveEventListener(NS_LITERAL_STRING("input"), this, true);
target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, true);
target->RemoveEventListener(NS_LITERAL_STRING("compositionstart"), this,
true);
target->RemoveEventListener(NS_LITERAL_STRING("compositionend"), this,
true);
target->RemoveEventListener(NS_LITERAL_STRING("contextmenu"), this, true);
EventListenerManager* elm = target->GetOrCreateListenerManager();
if (NS_WARN_IF(!elm)) {
return;
}
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("focus"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("blur"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("mousedown"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("input"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("keypress"),
TrustedEventsAtSystemGroupCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("compositionstart"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("compositionend"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("contextmenu"),
TrustedEventsAtCapture());
}
void

View file

@ -648,7 +648,7 @@
this.onInput(event);
]]></handler>
<handler event="keypress" phase="capturing"
<handler event="keypress" phase="capturing" group="system"
action="return this.onKeyPress(event);"/>
<handler event="compositionstart" phase="capturing"

View file

@ -253,7 +253,6 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
if CONFIG['OS_ARCH'] == 'SunOS':
OS_LIBS += [
'elf',
'demangle',
'sendfile',
]

View file

@ -208,7 +208,7 @@ toolbar#ToolbarMode .toolbarbutton-text {
}
%ifdef XP_WIN
@media not (-moz-os-version: windows-win10) {
@media not all and (-moz-os-version: windows-win10) {
#ToolbarMode {
-moz-appearance: -moz-win-browsertabbar-toolbox;
}

View file

@ -49,6 +49,23 @@ enum class OperatingSystem {
Windows8_1,
Windows10,
Linux,
OSX,
OSX10_5,
OSX10_6,
OSX10_7,
OSX10_8,
OSX10_9,
OSX10_10,
OSX10_11,
OSX10_12,
OSX10_13,
OSX10_14,
OSX10_15,
OSX10_16,
OSX11_0,
OSX12_0,
OSX13_0,
Ios
};
enum VersionComparisonOp {

View file

@ -264,6 +264,34 @@ BlacklistOSToOperatingSystem(const nsAString& os)
return OperatingSystem::Windows10;
else if (os.EqualsLiteral("Linux"))
return OperatingSystem::Linux;
else if (os.EqualsLiteral("Darwin 9"))
return OperatingSystem::OSX10_5;
else if (os.EqualsLiteral("Darwin 10"))
return OperatingSystem::OSX10_6;
else if (os.EqualsLiteral("Darwin 11"))
return OperatingSystem::OSX10_7;
else if (os.EqualsLiteral("Darwin 12"))
return OperatingSystem::OSX10_8;
else if (os.EqualsLiteral("Darwin 13"))
return OperatingSystem::OSX10_9;
else if (os.EqualsLiteral("Darwin 14"))
return OperatingSystem::OSX10_10;
else if (os.EqualsLiteral("Darwin 15"))
return OperatingSystem::OSX10_11;
else if (os.EqualsLiteral("Darwin 16"))
return OperatingSystem::OSX10_12;
else if (os.EqualsLiteral("Darwin 17"))
return OperatingSystem::OSX10_13;
else if (os.EqualsLiteral("Darwin 18"))
return OperatingSystem::OSX10_14;
else if (os.EqualsLiteral("Darwin 19"))
return OperatingSystem::OSX10_15;
else if (os.EqualsLiteral("Darwin 20"))
return OperatingSystem::OSX11_0;
else if (os.EqualsLiteral("Darwin 21"))
return OperatingSystem::OSX12_0;
else if (os.EqualsLiteral("Darwin 22"))
return OperatingSystem::OSX13_0;
// For historical reasons, "All" in blocklist means "All Windows"
else if (os.EqualsLiteral("All"))
return OperatingSystem::Windows;

View file

@ -21,6 +21,7 @@ namespace widget {
*****************************************************************************/
bool TextEventDispatcher::sDispatchKeyEventsDuringComposition = false;
bool TextEventDispatcher::sDispatchKeyPressEventNonPrintableInContent = false;
TextEventDispatcher::TextEventDispatcher(nsIWidget* aWidget)
: mWidget(aWidget)
@ -36,6 +37,10 @@ TextEventDispatcher::TextEventDispatcher(nsIWidget* aWidget)
&sDispatchKeyEventsDuringComposition,
"dom.keyboardevent.dispatch_during_composition",
false);
Preferences::AddBoolVarCache(
&sDispatchKeyPressEventNonPrintableInContent,
"dom.keyboardevent.keypress.dispatch_non_printable_in_content",
false);
sInitialized = true;
}
}
@ -531,6 +536,13 @@ TextEventDispatcher::DispatchKeyboardEventInternal(
}
}
if (!sDispatchKeyPressEventNonPrintableInContent &&
keyEvent.mMessage == eKeyPress &&
!keyEvent.IsInputtingText() &&
!keyEvent.IsInputtingLineBreak()) {
keyEvent.mFlags.mOnlySystemGroupDispatchInContent = true;
}
DispatchInputEvent(mWidget, keyEvent, aStatus);
return true;
}

View file

@ -399,6 +399,10 @@ private:
// is a composition.
static bool sDispatchKeyEventsDuringComposition;
// If this is true, keypress events for non-printable keys are dispatched to
// event listeners of the system event group in web content.
static bool sDispatchKeyPressEventNonPrintableInContent;
nsresult BeginInputTransactionInternal(
TextEventDispatcherListener* aListener,
InputTransactionType aType);

View file

@ -183,6 +183,30 @@ public:
return IsKeyEventOnPlugin(mMessage);
}
bool IsInputtingText() const
{
// NOTE: On some keyboard layouts, some characters are put in with Control
// or Alt keys, but at that time, widget unsets the modifier flag
// from the eKeyPress event, so it does not count as a modifier in
// this check.
return mMessage == eKeyPress &&
mCharCode &&
!(mModifiers & (MODIFIER_ALT |
MODIFIER_CONTROL |
MODIFIER_META |
MODIFIER_OS));
}
bool IsInputtingLineBreak() const
{
return mMessage == eKeyPress &&
mKeyNameIndex == KEY_NAME_INDEX_Enter &&
!(mModifiers & (MODIFIER_ALT |
MODIFIER_CONTROL |
MODIFIER_META |
MODIFIER_OS));
}
virtual WidgetEvent* Duplicate() const override
{
MOZ_ASSERT(mClass == eKeyboardEventClass,

View file

@ -63,12 +63,12 @@ OSXVersionToOperatingSystem(uint32_t aOSXVersion) {
}
break;
case 11:
switch (nsCocoaFeatures::ExtractMinorVersion(aOSXVersion)) {
case 0:
return OperatingSystem::OSX11_0;
default:
break;
}
return OperatingSystem::OSX11_0;
case 12:
return OperatingSystem::OSX12_0;
case 13:
return OperatingSystem::OSX13_0;
default:
break;
}

View file

@ -26,6 +26,7 @@ public:
static bool OnCatalinaOrLater();
static bool OnBigSurOrLater();
static bool OnMontereyOrLater();
static bool OnVenturaOrLater();
static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);

View file

@ -27,6 +27,7 @@
#define MACOS_VERSION_10_16_HEX 0x000A1000
#define MACOS_VERSION_11_0_HEX 0x000B0000
#define MACOS_VERSION_12_0_HEX 0x000C0000
#define MACOS_VERSION_13_0_HEX 0x000D0000
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
@ -212,7 +213,8 @@ nsCocoaFeatures::OnBigSurOrLater()
(macOSVersion() >= MACOS_VERSION_11_0_HEX));
}
/* static */ bool nsCocoaFeatures::OnMontereyOrLater()
/* static */ bool
nsCocoaFeatures::OnMontereyOrLater()
{
// Monterey pretends to be 10.16 and is indistinguishable from Big Sur.
// In practice, this means that an Intel build can return false
@ -221,6 +223,12 @@ nsCocoaFeatures::OnBigSurOrLater()
return (macOSVersion() >= MACOS_VERSION_12_0_HEX);
}
/* static */ bool
nsCocoaFeatures::OnVenturaOrLater()
{
return (macOSVersion() >= MACOS_VERSION_13_0_HEX);
}
/* static */ bool
nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix)
{
@ -234,7 +242,8 @@ nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFi
* for this purpose. Note: using this in a sandboxed process requires allowing
* the sysctl in the sandbox policy.
*/
/* static */ bool nsCocoaFeatures::ProcessIsRosettaTranslated()
/* static */ bool
nsCocoaFeatures::ProcessIsRosettaTranslated()
{
int ret = 0;
size_t size = sizeof(ret);

View file

@ -2903,6 +2903,10 @@ static NSMutableSet *gSwizzledFrameViewClasses = nil;
{
mDrawsIntoWindowFrame = NO;
[super initWithContentRect:aContentRect styleMask:aStyle backing:aBufferingType defer:aFlag];
// MacOS 13 Ventura, doesn't seem to create the contentView... so create it ourselves
if(![super contentView]) {
[super setContentView:[[NSView alloc] initWithFrame:aContentRect]];
}
mState = nil;
mActiveTitlebarColor = nil;
mInactiveTitlebarColor = nil;

View file

@ -246,6 +246,7 @@ EncodeInputStream(nsIInputStream* aInputStream,
static const char kBase64URLAlphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
static_assert(mozilla::ArrayLength(kBase64URLAlphabet) == 0x41);
// Maps an encoded character to a value in the Base64 URL alphabet, per
// RFC 4648, Table 2. Invalid input characters map to UINT8_MAX.
@ -267,14 +268,19 @@ static const uint8_t kBase64URLDecodeTable[] = {
255,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* a - z */
255, 255, 255, 255,
255, 255, 255, 255, 255
};
static_assert(mozilla::ArrayLength(kBase64URLDecodeTable) == 0x80);
bool
Base64URLCharToValue(char aChar, uint8_t* aValue) {
uint8_t index = static_cast<uint8_t>(aChar);
*aValue = kBase64URLDecodeTable[index & 0x7f];
return (*aValue != 255) && !(index & ~0x7f);
if (index >= mozilla::ArrayLength(kBase64URLDecodeTable)) {
*aValue = 255;
return false;
}
*aValue = kBase64URLDecodeTable[index];
return *aValue != 255;
}
} // namespace