merge mozilla-inbound to mozilla-central. r=merge a=merge

MozReview-Commit-ID: DEsdO0kjfDL
This commit is contained in:
Sebastian Hengst 2017-11-04 22:55:41 +01:00
commit 1ce13be34a
23 changed files with 58 additions and 126 deletions

View File

@ -8172,6 +8172,8 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
nsViewportInfo
nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
{
MOZ_ASSERT(mPresShell);
// Compute the CSS-to-LayoutDevice pixel scale as the product of the
// widget scale and the full zoom.
nsPresContext* context = mPresShell->GetPresContext();

View File

@ -16,7 +16,6 @@
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "mozilla/mozalloc.h" // for operator delete
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsRegion.h" // for nsIntRegion
#include "LayersTypes.h"

View File

@ -11,7 +11,6 @@
#include "Layers.h" // for PaintedLayer, etc
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/TiledContentClient.h"
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRegion.h" // for nsIntRegion
namespace mozilla {

View File

@ -12,7 +12,6 @@
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nscore.h" // for nsACString

View File

@ -29,7 +29,6 @@
#include "mozilla/mozalloc.h" // for operator delete
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for mozilla::gfx::IntRect

View File

@ -49,7 +49,7 @@
#include "nsAppRunner.h"
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_WARNING, NS_RUNTIMEABORT, etc
#include "nsDebug.h" // for NS_WARNING, etc
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for mozilla::gfx::IntRect

View File

@ -13,11 +13,9 @@
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRegion.h" // for nsIntRegion
#include "nscore.h" // for nsACString
namespace mozilla {
namespace layers {

View File

@ -26,7 +26,7 @@
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "mozilla/webrender/WebRenderTypes.h"
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsDebug.h" // for NS_WARNING
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsRegion.h" // for nsIntRegion
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc

View File

@ -31,7 +31,7 @@
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/Telemetry.h"
#include "nsAutoPtr.h"
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsDebug.h" // for NS_WARNING
#include "nsIObserver.h" // for nsIObserver
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsTArray.h" // for nsTArray, nsTArray_Impl

View File

@ -19,7 +19,6 @@
#include "mozilla/layers/PImageBridgeChild.h"
#include "mozilla/Mutex.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsIObserver.h"
#include "nsRegion.h" // for nsIntRegion
#include "nsRefPtrHashtable.h"

View File

@ -27,7 +27,7 @@
#include "mozilla/Monitor.h"
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/Unused.h"
#include "nsDebug.h" // for NS_RUNTIMEABORT, etc
#include "nsDebug.h" // for NS_ASSERTION, etc
#include "nsISupportsImpl.h" // for ImageBridgeParent::Release, etc
#include "nsTArray.h" // for nsTArray, nsTArray_Impl
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray

View File

@ -8,14 +8,12 @@
#include "mozilla/gfx/Logging.h"
#include "mozilla/layers/ShadowLayers.h" // for ShadowLayerForwarder
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsDebug.h" // for NS_RUNTIMEABORT, etc
#include "nsTArray.h" // for nsTArray
#include "mozilla/layers/TextureClient.h"
namespace mozilla {
namespace layers {
void
LayerTransactionChild::Destroy()
{

View File

@ -29,7 +29,6 @@
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "mozilla/Unused.h"
#include "nsCoord.h" // for NSAppUnitsToFloatPixels
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsISupportsImpl.h" // for Layer::Release, etc
#include "nsLayoutUtils.h" // for nsLayoutUtils
#include "nsMathUtils.h" // for NS_round

View File

@ -13,7 +13,6 @@
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/LayerManagerMLGPU.h" // for LayerComposite, etc
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nscore.h" // for nsACString

View File

@ -316,8 +316,7 @@ LogicError(const char* aMsg)
void
ActorIdReadError(const char* aActorDescription)
{
nsPrintfCString message("Error deserializing id for %s", aActorDescription);
NS_RUNTIMEABORT(message.get());
MOZ_CRASH_UNSAFE_PRINTF("Error deserializing id for %s", aActorDescription);
}
void
@ -345,22 +344,19 @@ MismatchedActorTypeError(const char* aActorDescription)
void
UnionTypeReadError(const char* aUnionName)
{
nsPrintfCString message("error deserializing type of union %s", aUnionName);
NS_RUNTIMEABORT(message.get());
MOZ_CRASH_UNSAFE_PRINTF("error deserializing type of union %s", aUnionName);
}
void
ArrayLengthReadError(const char* aElementName)
{
nsPrintfCString message("error deserializing length of %s[]", aElementName);
NS_RUNTIMEABORT(message.get());
MOZ_CRASH_UNSAFE_PRINTF("error deserializing length of %s[]", aElementName);
}
void
SentinelReadError(const char* aClassName)
{
nsPrintfCString message("incorrect sentinel when reading %s", aClassName);
NS_RUNTIMEABORT(message.get());
MOZ_CRASH_UNSAFE_PRINTF("incorrect sentinel when reading %s", aClassName);
}
void

View File

@ -765,7 +765,6 @@ nsIPresShell::nsIPresShell()
, mFontSizeInflationForceEnabled(false)
, mFontSizeInflationDisabledInMasterProcess(false)
, mFontSizeInflationEnabled(false)
, mFontSizeInflationEnabledIsDirty(false)
, mPaintingIsFrozen(false)
, mIsNeverPainting(false)
, mInFlush(false)
@ -1010,7 +1009,13 @@ PresShell::Init(nsIDocument* aDocument,
QueryIsActive();
// Setup our font inflation preferences.
SetupFontInflation();
mFontSizeInflationEmPerLine = nsLayoutUtils::FontSizeInflationEmPerLine();
mFontSizeInflationMinTwips = nsLayoutUtils::FontSizeInflationMinTwips();
mFontSizeInflationLineThreshold = nsLayoutUtils::FontSizeInflationLineThreshold();
mFontSizeInflationForceEnabled = nsLayoutUtils::FontSizeInflationForceEnabled();
mFontSizeInflationDisabledInMasterProcess = nsLayoutUtils::FontSizeInflationDisabledInMasterProcess();
// We'll compute the font size inflation state in Initialize(), when we know
// the document type.
mTouchManager.Init(this, mDocument);
@ -1700,6 +1705,10 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
NS_ASSERTION(!mDidInitialize, "Why are we being called?");
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
RecomputeFontSizeInflationEnabled();
MOZ_DIAGNOSTIC_ASSERT(!mIsDestroying);
mDidInitialize = true;
#ifdef DEBUG
@ -1725,6 +1734,7 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
// time we do this!
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
NS_ASSERTION(!rootFrame, "How did that happen, exactly?");
if (!rootFrame) {
nsAutoScriptBlocker scriptBlocker;
mFrameConstructor->BeginUpdate();
@ -4456,11 +4466,6 @@ PresShell::ContentInserted(nsIDocument* aDocument,
nullptr,
nsCSSFrameConstructor::InsertionKind::Async);
if (aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
MOZ_ASSERT(container == aDocument);
NotifyFontSizeInflationEnabledIsDirty();
}
VERIFY_STYLE_TREE;
}
@ -4505,11 +4510,6 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
mFrameConstructor->ContentRemoved(aMaybeContainer, aChild, oldNextSibling,
nsCSSFrameConstructor::REMOVE_CONTENT);
if (aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
MOZ_ASSERT(container == aDocument);
NotifyFontSizeInflationEnabledIsDirty();
}
VERIFY_STYLE_TREE;
}
@ -10701,33 +10701,34 @@ nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aH
}
}
void
PresShell::SetupFontInflation()
{
mFontSizeInflationEmPerLine = nsLayoutUtils::FontSizeInflationEmPerLine();
mFontSizeInflationMinTwips = nsLayoutUtils::FontSizeInflationMinTwips();
mFontSizeInflationLineThreshold = nsLayoutUtils::FontSizeInflationLineThreshold();
mFontSizeInflationForceEnabled = nsLayoutUtils::FontSizeInflationForceEnabled();
mFontSizeInflationDisabledInMasterProcess = nsLayoutUtils::FontSizeInflationDisabledInMasterProcess();
NotifyFontSizeInflationEnabledIsDirty();
}
void
nsIPresShell::RecomputeFontSizeInflationEnabled()
{
mFontSizeInflationEnabledIsDirty = false;
mFontSizeInflationEnabled = DetermineFontSizeInflationState();
HandleSystemFontScale();
float fontScale = nsLayoutUtils::SystemFontScale();
if (fontScale == 0.0f) {
return;
}
MOZ_ASSERT(mDocument);
MOZ_ASSERT(mPresContext);
if (mFontSizeInflationEnabled || mDocument->IsSyntheticDocument()) {
mPresContext->SetSystemFontScale(1.0f);
} else {
mPresContext->SetSystemFontScale(fontScale);
}
}
bool
nsIPresShell::DetermineFontSizeInflationState()
{
MOZ_ASSERT(mPresContext, "our pres context should not be null");
if ((FontSizeInflationEmPerLine() == 0 &&
FontSizeInflationMinTwips() == 0) || mPresContext->IsChrome()) {
if (mPresContext->IsChrome()) {
return false;
}
if (FontSizeInflationEmPerLine() == 0 && FontSizeInflationMinTwips() == 0) {
return false;
}
@ -10788,33 +10789,6 @@ nsIPresShell::DetermineFontSizeInflationState()
return true;
}
bool
nsIPresShell::FontSizeInflationEnabled()
{
if (mFontSizeInflationEnabledIsDirty) {
RecomputeFontSizeInflationEnabled();
}
return mFontSizeInflationEnabled;
}
void
nsIPresShell::HandleSystemFontScale()
{
float fontScale = nsLayoutUtils::SystemFontScale();
if (fontScale == 0.0f) {
return;
}
MOZ_ASSERT(mDocument && mPresContext, "our document and pres context should not be null");
if (!mFontSizeInflationEnabled && !mDocument->IsSyntheticDocument()) {
mPresContext->SetSystemFontScale(fontScale);
} else {
mPresContext->SetSystemFontScale(1.0f);
}
}
void
PresShell::PausePainting()
{

View File

@ -1507,24 +1507,14 @@ public:
return mFontSizeInflationDisabledInMasterProcess;
}
/**
* Determine if font size inflation is enabled. This value is cached until
* it becomes dirty.
*
* @returns true, if font size inflation is enabled; false otherwise.
*/
bool FontSizeInflationEnabled();
bool FontSizeInflationEnabled() const {
return mFontSizeInflationEnabled;
}
/**
* Notify the pres shell that an event occurred making the current value of
* mFontSizeInflationEnabled invalid. This will schedule a recomputation of
* whether font size inflation is enabled on the next call to
* FontSizeInflationEnabled().
* Recomputes whether font-size inflation is enabled.
*/
void NotifyFontSizeInflationEnabledIsDirty()
{
mFontSizeInflationEnabledIsDirty = true;
}
void RecomputeFontSizeInflationEnabled();
/**
* Return true if the most recent interruptible reflow was interrupted.
@ -1590,23 +1580,11 @@ protected:
void DoObserveLayoutFlushes();
/**
* Do computations necessary to determine if font size inflation is enabled.
* This value is cached after computation, as the computation is somewhat
* expensive.
*/
void RecomputeFontSizeInflationEnabled();
/**
* Does the actual work of figuring out the current state of font size inflation.
* Does the actual work of figuring out the current state of font size
* inflation.
*/
bool DetermineFontSizeInflationState();
/**
* Apply the system font scale from the corresponding pref to the PresContext,
* taking into account the current state of font size inflation.
*/
void HandleSystemFontScale();
void RecordAlloc(void* aPtr) {
#ifdef DEBUG
MOZ_ASSERT(!mAllocatedPointers.Contains(aPtr));

View File

@ -9103,16 +9103,16 @@ MaybeReflowForInflationScreenSizeChange(nsPresContext *aPresContext)
{
if (aPresContext) {
nsIPresShell* presShell = aPresContext->GetPresShell();
bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
presShell->NotifyFontSizeInflationEnabledIsDirty();
const bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
presShell->RecomputeFontSizeInflationEnabled();
bool changed = false;
if (presShell && presShell->FontSizeInflationEnabled() &&
if (presShell->FontSizeInflationEnabled() &&
presShell->FontSizeInflationMinTwips() != 0) {
aPresContext->ScreenSizeInchesForFontInflation(&changed);
}
changed = changed ||
(fontInflationWasEnabled != presShell->FontSizeInflationEnabled());
fontInflationWasEnabled != presShell->FontSizeInflationEnabled();
if (changed) {
nsCOMPtr<nsIDocShell> docShell = aPresContext->GetDocShell();
if (docShell) {

View File

@ -2123,6 +2123,10 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
mPendingViewportChange = false;
if (!mShell || !mShell->DidInitialize()) {
return;
}
if (mDocument->IsBeingUsedAsImage()) {
MOZ_ASSERT(mDocument->MediaQueryLists().isEmpty());
return;
@ -2130,7 +2134,7 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
mDocument->NotifyMediaFeatureValuesChanged();
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
MOZ_DIAGNOSTIC_ASSERT(nsContentUtils::IsSafeToRunScript());
// Media query list listeners should be notified from a queued task
// (in HTML5 terms), although we also want to notify them on certain

View File

@ -2047,4 +2047,4 @@ needs-focus != 1377447-1.html 1377447-2.html
!= 1404057.html 1404057-noref.html
== 1406183-1.html 1406183-1-ref.html
== 1410028.html 1410028-ref.html
test-pref(font.size.systemFontScale,200) skip-if(isDebugBuild) == 1412743.html 1412743-ref.html # bug 1413143
test-pref(font.size.systemFontScale,200) == 1412743.html 1412743-ref.html

View File

@ -52,8 +52,6 @@ MOZ_ReportCrash(const char* aStr, const char* aFilename, int aLine)
#define NS_PRECONDITION(expr, msg) assert(!!(expr))
#define NS_RUNTIMEABORT(msg) __coverity_panic__()
// Kills Structurally dead code (UNREACHABLE)
#define NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(_class) \
NS_IMETHODIMP_(bool) \

View File

@ -165,7 +165,7 @@ inline void MOZ_PretendNoReturn()
/**
* Trigger an debug-only abort.
*
* @see NS_RUNTIMEABORT for release-mode asserts.
* @see MOZ_RELEASE_ASSERT or MOZ_CRASH for release-mode asserts.
*/
#ifdef DEBUG
#define NS_ABORT() \
@ -247,15 +247,6 @@ inline void MOZ_PretendNoReturn()
** reached. These need to be compiled regardless of the DEBUG flag.
******************************************************************************/
/**
* Terminate execution <i>immediately</i>, and if possible on the current
* platform, in such a way that execution can't be continued by other
* code (e.g., by intercepting a signal).
*/
#define NS_RUNTIMEABORT(msg) \
NS_DebugBreak(NS_DEBUG_ABORT, msg, nullptr, __FILE__, __LINE__)
/* Macros for checking the trueness of an expression passed in within an
* interface implementation. These need to be compiled regardless of the
* DEBUG flag. New code should use NS_WARN_IF(condition) instead!

View File

@ -41,7 +41,7 @@
#define CHECK_STRING_BUFFER_CANARY(c) \
do { \
if ((c) != CANARY_OK) { \
NS_RUNTIMEABORT(nsPrintfCString("Bad canary value %d", c).get()); \
MOZ_CRASH_UNSAFE_PRINTF("Bad canary value %d", c); \
} \
} while(0)
#else