diff options
Diffstat (limited to 'layout')
-rw-r--r-- | layout/base/nsCSSFrameConstructor.cpp | 16 | ||||
-rw-r--r-- | layout/base/nsDisplayList.cpp | 99 | ||||
-rw-r--r-- | layout/base/nsDisplayList.h | 39 | ||||
-rw-r--r-- | layout/base/nsLayoutUtils.cpp | 3 | ||||
-rw-r--r-- | layout/base/nsPresShell.cpp | 4 | ||||
-rw-r--r-- | layout/base/nsRefreshDriver.cpp | 38 | ||||
-rw-r--r-- | layout/build/nsLayoutCID.h | 3 | ||||
-rw-r--r-- | layout/build/nsLayoutModule.cpp | 6 | ||||
-rw-r--r-- | layout/build/nsLayoutStatics.cpp | 9 | ||||
-rw-r--r-- | layout/forms/nsComboboxControlFrame.cpp | 3 | ||||
-rw-r--r-- | layout/reftests/css-display/display-contents-dyn-insert-text-ref.html | 7 | ||||
-rw-r--r-- | layout/reftests/css-display/display-contents-dyn-insert-text.html | 16 | ||||
-rw-r--r-- | layout/reftests/css-display/reftest.list | 1 | ||||
-rw-r--r-- | layout/style/ImageLoader.cpp | 3 | ||||
-rw-r--r-- | layout/style/nsCSSParser.cpp | 9 |
15 files changed, 46 insertions, 210 deletions
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index c63374541..07a5b80e7 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -7021,8 +7021,11 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation, nsIContent* aContainer, nsIContent* aChild) { + // XXXmats no lazy frames for display:contents direct descendants yet + // (Mozilla bug 979782). if (mPresShell->GetPresContext()->IsChrome() || !aContainer || - aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXULElement()) { + aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXULElement() || + GetDisplayContentsStyleFor(aContainer)) { return false; } @@ -7056,6 +7059,10 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation, // ignore anonymous children (eg framesets) make this complicated. So we set // these two booleans if we encounter these situations and unset them if we // hit a node with a leaf frame. + // + // Also, it's fine if one of the nodes without primary frame is a display: + // contents node except if it's the direct ancestor of the children we're + // recreating frames for. bool noPrimaryFrame = false; bool needsFrameBitSet = false; #endif @@ -7065,17 +7072,14 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation, if (content->GetPrimaryFrame() && content->GetPrimaryFrame()->IsLeaf()) { noPrimaryFrame = needsFrameBitSet = false; } - if (!noPrimaryFrame && !content->GetPrimaryFrame()) { + if (!noPrimaryFrame && !content->GetPrimaryFrame() && + !GetDisplayContentsStyleFor(content)) { noPrimaryFrame = true; } if (!needsFrameBitSet && content->HasFlag(NODE_NEEDS_FRAME)) { needsFrameBitSet = true; } #endif - // XXXmats no lazy frames for display:contents descendants yet (bug 979782). - if (GetDisplayContentsStyleFor(content)) { - return false; - } content->SetFlags(NODE_DESCENDANTS_NEED_FRAMES); content = content->GetFlattenedTreeParent(); } diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 2bf20144a..2b9ad7ff8 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -61,7 +61,6 @@ #include "mozilla/OperatorNewExtensions.h" #include "mozilla/PendingAnimationTracker.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "mozilla/UniquePtr.h" #include "mozilla/Unused.h" #include "mozilla/gfx/gfxVars.h" @@ -1857,7 +1856,6 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB RefPtr<ContainerLayer> root; { - PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Layerization); root = layerBuilder-> BuildContainerLayerFor(aBuilder, layerManager, frame, nullptr, this, containerParameters, nullptr); @@ -7453,100 +7451,3 @@ nsDisplayFilter::PrintEffects(nsACString& aTo) aTo += ")"; } #endif - -namespace mozilla { - -uint32_t PaintTelemetry::sPaintLevel = 0; -uint32_t PaintTelemetry::sMetricLevel = 0; -EnumeratedArray<PaintTelemetry::Metric, - PaintTelemetry::Metric::COUNT, - double> PaintTelemetry::sMetrics; - -PaintTelemetry::AutoRecordPaint::AutoRecordPaint() -{ - // Don't record nested paints. - if (sPaintLevel++ > 0) { - return; - } - - // Reset metrics for a new paint. - for (auto& metric : sMetrics) { - metric = 0.0; - } - mStart = TimeStamp::Now(); -} - -PaintTelemetry::AutoRecordPaint::~AutoRecordPaint() -{ - MOZ_ASSERT(sPaintLevel != 0); - if (--sPaintLevel > 0) { - return; - } - - // If we're in multi-process mode, don't include paint times for the parent - // process. - if (gfxVars::BrowserTabsRemoteAutostart() && XRE_IsParentProcess()) { - return; - } - - double totalMs = (TimeStamp::Now() - mStart).ToMilliseconds(); - - // If the total time was >= 16ms, then it's likely we missed a frame due to - // painting. In this case we'll gather some detailed metrics below. - if (totalMs <= 16.0) { - return; - } - - auto record = [=](const char* aKey, double aDurationMs) -> void { - MOZ_ASSERT(aDurationMs <= totalMs); - - uint32_t amount = static_cast<int32_t>((aDurationMs / totalMs) * 100.0); - }; - - double dlMs = sMetrics[Metric::DisplayList]; - double flbMs = sMetrics[Metric::Layerization]; - double rMs = sMetrics[Metric::Rasterization]; - - // Record all permutations since aggregation makes it difficult to - // correlate. For example we can't derive "flb+r" from "dl" because we - // don't know the total time associated with a bucket entry. So we just - // play it safe and include everything. We can however derive "other" time - // from the final permutation. - record("dl", dlMs); - record("flb", flbMs); - record("r", rMs); - record("dl,flb", dlMs + flbMs); - record("dl,r", dlMs + rMs); - record("flb,r", flbMs + rMs); - record("dl,flb,r", dlMs + flbMs + rMs); -} - -PaintTelemetry::AutoRecord::AutoRecord(Metric aMetric) - : mMetric(aMetric) -{ - // Don't double-record anything nested. - if (sMetricLevel++ > 0) { - return; - } - - // Don't record inside nested paints, or outside of paints. - if (sPaintLevel != 1) { - return; - } - - mStart = TimeStamp::Now(); -} - -PaintTelemetry::AutoRecord::~AutoRecord() -{ - MOZ_ASSERT(sMetricLevel != 0); - - sMetricLevel--; - if (mStart.IsNull()) { - return; - } - - sMetrics[mMetric] += (TimeStamp::Now() - mStart).ToMilliseconds(); -} - -} // namespace mozilla diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index df584b489..9603a95b8 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -4508,43 +4508,4 @@ public: mutable mozilla::Maybe<bool> mIsFrameSelected; }; -namespace mozilla { - -class PaintTelemetry -{ - public: - enum class Metric { - DisplayList, - Layerization, - Rasterization, - COUNT, - }; - - class AutoRecord - { - public: - explicit AutoRecord(Metric aMetric); - ~AutoRecord(); - private: - Metric mMetric; - mozilla::TimeStamp mStart; - }; - - class AutoRecordPaint - { - public: - AutoRecordPaint(); - ~AutoRecordPaint(); - private: - mozilla::TimeStamp mStart; - }; - - private: - static uint32_t sPaintLevel; - static uint32_t sMetricLevel; - static mozilla::EnumeratedArray<Metric, Metric::COUNT, double> sMetrics; -}; - -} // namespace mozilla - #endif /*NSDISPLAYLIST_H_*/ diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index c1f4ad372..19200d5a7 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -111,7 +111,6 @@ #include "FrameLayerBuilder.h" #include "mozilla/layers/APZCTreeManager.h" #include "mozilla/layers/CompositorBridgeChild.h" -#include "mozilla/Telemetry.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventStateManager.h" #include "mozilla/RuleNodeCacheConditions.h" @@ -3534,8 +3533,6 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram PROFILER_LABEL("nsLayoutUtils", "PaintFrame::BuildDisplayList", js::ProfileEntry::Category::GRAPHICS); - - PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::DisplayList); aFrame->BuildDisplayListForStackingContext(&builder, dirtyRect, &list); } diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 340042b46..969ebc962 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -170,7 +170,6 @@ #include "mozilla/css/ImageLoader.h" #include "mozilla/dom/DocumentTimeline.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "nsCanvasFrame.h" #include "nsIImageLoadingContent.h" #include "nsImageFrame.h" @@ -9394,9 +9393,6 @@ PresShell::DoVerifyReflow() } #endif -// used with Telemetry metrics -#define NS_LONG_REFLOW_TIME_MS 5000 - bool PresShell::ProcessReflowCommands(bool aInterruptible) { diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index b975a69dd..5ea7a0188 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -55,7 +55,6 @@ #include "nsDocShell.h" #include "nsISimpleEnumerator.h" #include "nsJSEnvironment.h" -#include "mozilla/Telemetry.h" #include "gfxPrefs.h" #include "BackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h" @@ -524,46 +523,10 @@ private: private: ~RefreshDriverVsyncObserver() = default; - void RecordTelemetryProbes(TimeStamp aVsyncTimestamp) - { - MOZ_ASSERT(NS_IsMainThread()); - #ifndef ANDROID /* bug 1142079 */ - if (XRE_IsParentProcess()) { - TimeDuration vsyncLatency = TimeStamp::Now() - aVsyncTimestamp; - uint32_t sample = (uint32_t)vsyncLatency.ToMilliseconds(); - RecordJank(sample); - } else if (mVsyncRate != TimeDuration::Forever()) { - TimeDuration contentDelay = (TimeStamp::Now() - mLastChildTick) - mVsyncRate; - if (contentDelay.ToMilliseconds() < 0 ){ - // Vsyncs are noisy and some can come at a rate quicker than - // the reported hardware rate. In those cases, consider that we have 0 delay. - contentDelay = TimeDuration::FromMilliseconds(0); - } - uint32_t sample = (uint32_t)contentDelay.ToMilliseconds(); - RecordJank(sample); - } else { - // Request the vsync rate from the parent process. Might be a few vsyncs - // until the parent responds. - mVsyncRate = mVsyncRefreshDriverTimer->mVsyncChild->GetVsyncRate(); - } - #endif - } - - void RecordJank(uint32_t aJankMS) - { - uint32_t duration = 1 /* ms */; - for (size_t i = 0; - i < mozilla::ArrayLength(sJankLevels) && duration < aJankMS; - ++i, duration *= 2) { - sJankLevels[i]++; - } - } - void TickRefreshDriver(TimeStamp aVsyncTimestamp) { MOZ_ASSERT(NS_IsMainThread()); - RecordTelemetryProbes(aVsyncTimestamp); if (XRE_IsParentProcess()) { MonitorAutoLock lock(mRefreshTickLock); aVsyncTimestamp = mRecentVsync; @@ -2006,7 +1969,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime) mViewManagerFlushIsPending = false; RefPtr<nsViewManager> vm = mPresContext->GetPresShell()->GetViewManager(); { - PaintTelemetry::AutoRecordPaint record; vm->ProcessPendingUpdates(); } diff --git a/layout/build/nsLayoutCID.h b/layout/build/nsLayoutCID.h index 47a90d7d8..1b43c7592 100644 --- a/layout/build/nsLayoutCID.h +++ b/layout/build/nsLayoutCID.h @@ -82,7 +82,4 @@ #define SERVICEWORKERMANAGER_CID \ { 0xc74bde32, 0xbcc7, 0x4840, { 0x84, 0x30, 0xc7, 0x33, 0x35, 0x1b, 0x21, 0x2a } } -#define NOTIFICATIONTELEMETRYSERVICE_CID \ -{ 0x5995b782, 0x6a0e, 0x4066, { 0xaa, 0xc5, 0x27, 0x6f, 0x0a, 0x9a, 0xd8, 0xcf } } - #endif /* nsLayoutCID_h__ */ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 748bc11d8..8bb70f85c 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -204,7 +204,6 @@ using mozilla::dom::UDPSocketChild; using mozilla::dom::time::TimeService; using mozilla::net::StreamingProtocolControllerService; using mozilla::gmp::GeckoMediaPluginService; -using mozilla::dom::NotificationTelemetryService; #define NS_EDITORCOMMANDTABLE_CID \ { 0x4f5e62b8, 0xd659, 0x4156, \ @@ -292,7 +291,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(TextInputProcessor) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService, NS_CreatePresentationService) NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationTCPSessionTransport) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NotificationTelemetryService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(PushNotifier) //----------------------------------------------------------------------------- @@ -657,7 +655,6 @@ NS_DEFINE_NAMED_CID(NS_TEXTEDITOR_CID); NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID); NS_DEFINE_NAMED_CID(QUOTAMANAGER_SERVICE_CID); NS_DEFINE_NAMED_CID(SERVICEWORKERMANAGER_CID); -NS_DEFINE_NAMED_CID(NOTIFICATIONTELEMETRYSERVICE_CID); NS_DEFINE_NAMED_CID(PUSHNOTIFIER_CID); NS_DEFINE_NAMED_CID(WORKERDEBUGGERMANAGER_CID); @@ -925,7 +922,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kDOMREQUEST_SERVICE_CID, false, nullptr, DOMRequestServiceConstructor }, { &kQUOTAMANAGER_SERVICE_CID, false, nullptr, QuotaManagerServiceConstructor }, { &kSERVICEWORKERMANAGER_CID, false, nullptr, ServiceWorkerManagerConstructor }, - { &kNOTIFICATIONTELEMETRYSERVICE_CID, false, nullptr, NotificationTelemetryServiceConstructor }, { &kPUSHNOTIFIER_CID, false, nullptr, PushNotifierConstructor }, { &kWORKERDEBUGGERMANAGER_CID, true, nullptr, WorkerDebuggerManagerConstructor }, { &kNS_AUDIOCHANNELAGENT_CID, true, nullptr, AudioChannelAgentConstructor }, @@ -1057,7 +1053,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID }, { QUOTAMANAGER_SERVICE_CONTRACTID, &kQUOTAMANAGER_SERVICE_CID }, { SERVICEWORKERMANAGER_CONTRACTID, &kSERVICEWORKERMANAGER_CID }, - { NOTIFICATIONTELEMETRYSERVICE_CONTRACTID, &kNOTIFICATIONTELEMETRYSERVICE_CID }, { PUSHNOTIFIER_CONTRACTID, &kPUSHNOTIFIER_CID }, { WORKERDEBUGGERMANAGER_CONTRACTID, &kWORKERDEBUGGERMANAGER_CID }, { NS_AUDIOCHANNELAGENT_CONTRACTID, &kNS_AUDIOCHANNELAGENT_CID }, @@ -1132,7 +1127,6 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = { CONTENTDLF_CATEGORIES { "profile-after-change", "PresentationDeviceManager", PRESENTATION_DEVICE_MANAGER_CONTRACTID }, { "profile-after-change", "PresentationService", PRESENTATION_SERVICE_CONTRACTID }, - { "profile-after-change", "Notification Telemetry Service", NOTIFICATIONTELEMETRYSERVICE_CONTRACTID }, { nullptr } }; diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 0306626c4..0f4560afe 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -92,10 +92,6 @@ #include "nsSynthVoiceRegistry.h" #endif -#ifdef MOZ_ANDROID_OMX -#include "AndroidMediaPluginHost.h" -#endif - #include "CubebUtils.h" #include "Latency.h" #include "WebAudioUtils.h" @@ -381,11 +377,6 @@ nsLayoutStatics::Shutdown() nsAutoCopyListener::Shutdown(); FrameLayerBuilder::Shutdown(); - -#ifdef MOZ_ANDROID_OMX - AndroidMediaPluginHost::Shutdown(); -#endif - CubebUtils::ShutdownLibrary(); AsyncLatencyLogger::ShutdownLogger(); WebAudioUtils::Shutdown(); diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index f69198cc7..5a9438939 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -1040,6 +1040,9 @@ nsComboboxControlFrame::HandleRedisplayTextEvent() mRedisplayTextEvent.Forget(); ActuallyDisplayText(true); + if (!weakThis.IsAlive()) + return; + // XXXbz This should perhaps be eResize. Check. PresContext()->PresShell()->FrameNeedsReflow(mDisplayFrame, nsIPresShell::eStyleChange, diff --git a/layout/reftests/css-display/display-contents-dyn-insert-text-ref.html b/layout/reftests/css-display/display-contents-dyn-insert-text-ref.html new file mode 100644 index 000000000..a212e025e --- /dev/null +++ b/layout/reftests/css-display/display-contents-dyn-insert-text-ref.html @@ -0,0 +1,7 @@ +<!doctype html> +<meta charset="utf-8"> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<title>CSS Test reference - Bug 1338678</title> +<div style="display: contents"> + <div id="element">PASS</div> +</div> diff --git a/layout/reftests/css-display/display-contents-dyn-insert-text.html b/layout/reftests/css-display/display-contents-dyn-insert-text.html new file mode 100644 index 000000000..f3b0c0c95 --- /dev/null +++ b/layout/reftests/css-display/display-contents-dyn-insert-text.html @@ -0,0 +1,16 @@ +<!doctype html> +<meta charset="utf-8"> +<link rel="author" title="Markus Stange" href="mailto:mstange@themasta.com"> +<link rel="help" href="https://drafts.csswg.org/css-display/#box-generation"> +<title>Bug 1338678 - display:contents makes textContent disappear</title> +<div style="display: contents"> + <div id="element"></div> +</div> +<script> +window.onload = function() { + document.body.offsetTop; + var element = document.getElementById('element'); + element.textContent = "FAIL"; + element.textContent = "PASS"; +} +</script> diff --git a/layout/reftests/css-display/reftest.list b/layout/reftests/css-display/reftest.list index d310422bb..00f46a80b 100644 --- a/layout/reftests/css-display/reftest.list +++ b/layout/reftests/css-display/reftest.list @@ -24,5 +24,6 @@ skip pref(layout.css.display-contents.enabled,true) == display-contents-xbl-4.xu asserts(0-1) fuzzy-if(Android,8,3216) pref(layout.css.display-contents.enabled,true) == display-contents-fieldset.html display-contents-fieldset-ref.html # bug 1089223 asserts(1) pref(layout.css.display-contents.enabled,true) == display-contents-xbl-5.xul display-contents-xbl-3-ref.xul # bug 1089223 pref(layout.css.display-contents.enabled,true) == display-contents-list-item-child.html display-contents-list-item-child-ref.html +pref(layout.css.display-contents.enabled,true) == display-contents-dyn-insert-text.html display-contents-dyn-insert-text-ref.html pref(layout.css.display-contents.enabled,true) == display-contents-writing-mode-1.html display-contents-writing-mode-1-ref.html pref(layout.css.display-contents.enabled,true) == display-contents-writing-mode-2.html display-contents-writing-mode-2-ref.html diff --git a/layout/style/ImageLoader.cpp b/layout/style/ImageLoader.cpp index 0a605abc9..a26a1741a 100644 --- a/layout/style/ImageLoader.cpp +++ b/layout/style/ImageLoader.cpp @@ -519,9 +519,6 @@ ImageLoader::FlushUseCounters() nsCOMPtr<imgIContainer> container; request->GetImage(getter_AddRefs(container)); - if (container) { - static_cast<image::Image*>(container.get())->ReportUseCounters(); - } } } diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index b361cf0c2..736c66f87 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1549,6 +1549,9 @@ protected: // All data from successfully parsed properties are placed into |mData|. nsCSSExpandedDataBlock mData; + + // Value to make sure our resolved variable results stay within sane limits. + const uint32_t MAX_CSS_VAR_LENGTH = 10240; public: // Used from nsCSSParser constructors and destructors @@ -2802,6 +2805,12 @@ CSSParserImpl::ResolveValueWithVariableReferencesRec( // Invalid variable with no fallback. return false; } + // Make sure we are still using sane sizes for value and + // variableValue, and abort if OOB. + if (value.Length() > MAX_CSS_VAR_LENGTH || + variableValue.Length() > MAX_CSS_VAR_LENGTH) { + return false; + } // Valid variable with no fallback. AppendTokens(value, valueFirstToken, valueLastToken, varFirstToken, varLastToken, variableValue); |