Files
palemoon27/layout/build/nsLayoutStatics.cpp
T
roytam1 729a46113b import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1159056. Don't store a value in CSS pixels in a variable with type nscoord in ScrollFrameHelper::SetCoordAttribute. r=dholbert (432f06158)
- Bug 1138442 - Disable reftests on Mulet in parity with B2G/B2G Desktop. r=ahal (8b5c55da7)
- Don't clip in ComputeFrameMetrics if the scrollframe won't be layerized. (bug 1148582 part 2, r=tn) (088b6ef29)
- Bug 1157579 - Make sure the visual scroll port size includes the area of scrollbars when used in TryLayout. r=tn (c35244374)
- Bug 1139306: Fix margin sides for right-to-left scrollbars depending on the actual position of the scrollbar as determined by layout.scrollbar.side, r=tn (34328312d)
- Fix some full zoom FrameMetrics changes not propagating to APZ. (bug 1147648, r=botond) (91f009ac4)
- Bug 1159405 - Fix "Found a non-root APZ with no handoff parent". r=botond (09b0ddf07)
- Bug 1161040 - Don't set a scrollparent on the root content document in the child process that points to itself. r=tn (d0dfbffb0)
- Bug 1161040 - Add some assertions to guard against infinite loops in the handoff chains. r=botond (e6bae82e8)
- Bug 1153539 patch 1 - Improve comments for nsLayoutUtils::ComputeSuitableScaleForAnimation. r=roc (1b2bc00cd)
- Bug 1153539 patch 2 - Compute scale for rasterizing off-main-thread transform animations based on ratio to display size in addition to maximum and minimum scale. r=roc (97d632d0f)
- Bug 1160250 - Extract a helper method from the triplicated comp-bounds function to determine if we need to deflate the scrollbars. r=botond,tn (8d79c845f)
- Bug 1160250 - Extract a helper function from the triplicated composition-bounds-updating code. r=botond,tn (5b3f71329)
- Bug 1160250 - Collapse the code from CalculateRootCompositionSize into UpdateCompositionBounds. r=botond,tn (db0f081d6)
- Bug 1160250 - Put in a missing transfomToAncestor scaling factor. r=botond,tn (14837aa3a)
- Bug 1160250 - Fix up the rect being used for the composition size calculation. r=tn (0ba58021f)
- Bug 1139575 - Reset velocity on axes when going from a pan to a pinch. r=botond (2e03d04ab)
- Bug 1136971 - Draw layer borders correctly in the presence of multi-FrameMetrics. r=kats (e72f5b171)
- Bug 1148871 - Only apply checkerboarding background color to opaque layers. r=botond (20e070b84)
- Bug 1157327 - Don't cull out container layers, because their prepared data might be null and cause crashes. r=nical (3d06c925f)
- Bug 1157327 follow-up to add a comment. r=me and DONTBUILD (4cd74c0a1)
- Bug 1160566 - Make FrameMetrics.mCompositionBounds private and add a getter/setter for it. r=botond (277dd9afd)
- Bug 1160566 - Change some return values to be reference-to-const. r=botond (2ce17b63f)
- Bug 1158933 - Prevent scrollbars from jumping while zoomed in the B2G browser. r=botond (eca8aae7d)
- Bug 1158933 - Replace the compositedHeight/scrollableHeight (and width) term with the adjusted scrollThumbRatio. r=botond (236af4c4a)
- Bug 1156401 - Fix painting when building fennec with apzc. r=kats, r=botond (be18764b9)
- Bug 1159305 - patch 1 - Provide logical accessors for nsStylePosition and nsStyleSides fields. r=dbaron (7a90c519d)
- Bug 1159305 - patch 2 - Clean up layout code by using the new accessors. r=smontagu (926eb7dd5)
- Bug 1164406 - Expose scrollbar-area deflation in nsLayoutUtils. r=kats (42e5e8784)
- Bug 1139895 - Add fuzz for 1062792-1.html. r=tn (e38d0ac73)
- Bug 1139893 - Disable reftest bugs/1062108-1.html on mulet. r=jfkthame (930590d73)
- Move the APZ scroll frame clip onto FrameMetrics. (bug 1148582 part 3, r=mstange,tn) (c8e05f8d7)
- Fix PostprocessRetainedLayers to not test occlusion with asynchronous clips. (bug 1148582 part 5, r=tn) (cc71cafe2)
- Bug 1146626 - Refresh the reftest snapshot after adjusting the async scroll offsets. r=roc (1f041955d)
- Bug 1160642. Add reftest-async-zoom to apply an async zoom before taking snapshot. r=dbaron (1e8e54d8d)
- Bug 1160285 - Add a staticruntime version of mfbt and link some stuff against it. r=glandium (c733c49c7)
- Bug 786520 - Install things to $(DIST)/branding from moz.build instead of manual rules in Makefile.ins. r=mshal (42d38eb26)
- Bug 1155776 - move USE_EXTENSION_MANIFEST to moz.build; r=mshal (a87ecc2ca)
- Bug 1155816 - part 0 - remove NO_JS_MANIFEST from testing/mochitest/Makefile.in; r=mshal (af90a362c)
- Bug 1155816 - part 1 - move NO_JS_MANIFEST to moz.build; r=mshal (3a55e99a0)
- Bug 978591 - Remove per-directory uses of MOZ_CHROME_FILE_FORMAT. r=glandium (5084d62b5)
- Bug 991983 - Set GARBAGE for GeneratedSources in the recursivemake backend. r=gps (b8ae57c14)
- Bug 991983 - Emit absolute paths for UnifiedSources. r=gps (4100640d0)
- Bug 991983 - Emit absolute paths for other sources. r=gps (f30ddd773)
- Bug 991983 - Remove commented code in gyp_reader.py. r=gps (0685eca6a)
- Bug 1167474 - Remove ELFHACK_BUILD hack. r=mshal (b9d56c0b2)
- Bug 1097804 - Part 1 - Create a library containing nsISocketTransportService and nsIDNS that can be used to support standalone WebRTC. r=mcmanus (d2f83eb1c)
- Bug 1097804 - Part 2 - Added xpcomrt build of library containing unicode util functions. r=gps (fa9306f34)
- Bug 1162852 - Remove EXTRA_COMPILE_FLAGS. r=gps (340312bc6)
- Bug 1162852 - Remove EXTRA_ASSEMBLER_FLAGS. r=gps (f124c902c)
- Bug 1162852 - Remove the VARIABLES method of GypContext now it is doing nothing. r=gps (b6c1c0246)
- accidental commit (a1bbb1ada)
- Bug 991983 - Define SOURCES as SourcePath. r=gps (678065bce)
- Bug 991983 - Use objdir-relative SOURCES instead of GENERATED_SOURCES. r=gps (b54db0304)
- Bug 991983 - Make TEST_HARNESS_FILES use the *Path classes instead of a separate set of methods to resolve paths. r=gps (025fe1ca9)
- Bug 991983 - Add a deprecation hint for GENERATED_SOURCES. r=gps (67c75f4ab)
- Bug 1172800 - Fixup after bug 991983. r=gps (ce6e8c7a3)
- Bug 1164218 - Allow running individual mochitests and reftests in chaos mode. r=roc,froydnj (f2ec1d9d8)
- Bug 1154231 - Part 1. Use LRU to manage remote layers. r=mattwoodrow (1fe47e64f)
- Bug 1128037 - Minimalist support for wildcards in jar manifests. r=gps (1b07a6ffc)
- Bug 1162569 - default engine files should be in the omni.ja file, r=markh,glandium. (b07e54881)
- Bug 1157279. Escaping CSS identifiers should use lowercase letters for hex digits, not uppercase ones. r=dbaron (6f220936e)
2020-12-07 11:03:05 +08:00

449 lines
10 KiB
C++

/* 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 "base/basictypes.h"
#include "nsLayoutStatics.h"
#include "nscore.h"
#include "nsAttrValue.h"
#include "nsAutoCopyListener.h"
#include "nsColorNames.h"
#include "nsComputedDOMStyle.h"
#include "nsContentDLF.h"
#include "nsContentUtils.h"
#include "nsCSSAnonBoxes.h"
#include "mozilla/css/ErrorReporter.h"
#include "nsCSSKeywords.h"
#include "nsCSSParser.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoClasses.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRendering.h"
#include "mozilla/dom/Attr.h"
#include "nsDOMClassInfo.h"
#include "nsEditorEventListener.h"
#include "mozilla/EventListenerManager.h"
#include "nsFrame.h"
#include "nsGlobalWindow.h"
#include "nsGkAtoms.h"
#include "nsImageFrame.h"
#include "nsLayoutStylesheetCache.h"
#include "nsPrincipal.h"
#include "nsRange.h"
#include "nsRegion.h"
#include "nsRepeatService.h"
#include "nsFloatManager.h"
#include "nsSprocketLayout.h"
#include "nsStackLayout.h"
#include "nsStyleSet.h"
#include "nsTextControlFrame.h"
#include "nsXBLService.h"
#include "txMozillaXSLTProcessor.h"
#include "nsTreeSanitizer.h"
#include "nsCellMap.h"
#include "nsTextFrame.h"
#include "nsCCUncollectableMarker.h"
#include "nsTextFragment.h"
#include "nsCSSRuleProcessor.h"
#include "nsCORSListenerProxy.h"
#include "nsHTMLDNSPrefetch.h"
#include "nsHtml5Module.h"
#include "mozilla/dom/FallbackEncoding.h"
#include "nsFocusManager.h"
#include "nsListControlFrame.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "SVGElementFactory.h"
#include "nsSVGUtils.h"
#include "nsMathMLAtoms.h"
#include "nsMathMLOperators.h"
#include "Navigator.h"
#include "DOMStorageObserver.h"
#include "CacheObserver.h"
#include "DisplayItemClip.h"
#include "ActiveLayerTracker.h"
#include "CounterStyleManager.h"
#include "FrameLayerBuilder.h"
#include "mozilla/dom/RequestSyncWifiService.h"
#include "AnimationCommon.h"
#include "AudioChannelService.h"
#include "mozilla/dom/DataStoreService.h"
#include "mozilla/dom/PromiseDebugging.h"
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
#include "nsXULContentUtils.h"
#include "nsXULPrototypeCache.h"
#include "nsXULTooltipListener.h"
#include "inDOMView.h"
#include "nsMenuBarListener.h"
#endif
#include "nsHTMLEditor.h"
#include "nsTextServicesDocument.h"
#ifdef MOZ_WEBSPEECH
#include "nsSynthVoiceRegistry.h"
#endif
#ifdef MOZ_ANDROID_OMX
#include "AndroidMediaPluginHost.h"
#endif
#ifdef MOZ_WMF
#include "WMFDecoder.h"
#endif
#ifdef MOZ_FFMPEG
#include "FFmpegRuntimeLinker.h"
#endif
#include "CubebUtils.h"
#include "Latency.h"
#include "WebAudioUtils.h"
#ifdef MOZ_WIDGET_GONK
#include "nsVolumeService.h"
#include "SpeakerManagerService.h"
using namespace mozilla::system;
#endif
#include "nsError.h"
#include "nsJSEnvironment.h"
#include "nsContentSink.h"
#include "nsFrameMessageManager.h"
#include "nsRefreshDriver.h"
#include "nsDOMMutationObserver.h"
#include "nsHyphenationManager.h"
#include "nsEditorSpellCheck.h"
#include "nsWindowMemoryReporter.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/ProcessPriorityManager.h"
#include "nsPermissionManager.h"
#include "nsCookieService.h"
#include "nsApplicationCacheService.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/IMEStateManager.h"
#include "nsDocument.h"
#include "mozilla/dom/HTMLVideoElement.h"
#include "CameraPreferences.h"
#include "TouchManager.h"
#include "MediaDecoder.h"
#include "mozilla/layers/CompositorLRU.h"
using namespace mozilla;
using namespace mozilla::net;
using namespace mozilla::dom;
using namespace mozilla::dom::ipc;
nsrefcnt nsLayoutStatics::sLayoutStaticRefcnt = 0;
nsresult
nsLayoutStatics::Initialize()
{
NS_ASSERTION(sLayoutStaticRefcnt == 0,
"nsLayoutStatics isn't zero!");
sLayoutStaticRefcnt = 1;
NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt,
"nsLayoutStatics", 1);
nsresult rv;
ContentParent::StartUp();
// Register all of our atoms once
nsCSSAnonBoxes::AddRefAtoms();
nsCSSPseudoClasses::AddRefAtoms();
nsCSSPseudoElements::AddRefAtoms();
nsCSSKeywords::AddRefTable();
nsCSSProps::AddRefTable();
nsColorNames::AddRefTable();
nsGkAtoms::AddRefAtoms();
StartupJSEnvironment();
rv = nsRegion::InitStatic();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsRegion");
return rv;
}
nsGlobalWindow::Init();
Navigator::Init();
nsXBLService::Init();
rv = nsContentUtils::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsContentUtils");
return rv;
}
rv = nsAttrValue::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsAttrValue");
return rv;
}
rv = nsTextFragment::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsTextFragment");
return rv;
}
nsCellMap::Init();
nsCSSRendering::Init();
nsTextFrameTextRunCache::Init();
rv = nsHTMLDNSPrefetch::Initialize();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize HTML DNS prefetch");
return rv;
}
#ifdef MOZ_XUL
rv = nsXULContentUtils::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsXULContentUtils");
return rv;
}
#endif
nsMathMLOperators::AddRefTable();
nsTextServicesDocument::RegisterAtoms();
#ifdef DEBUG
nsFrame::DisplayReflowStartup();
#endif
Attr::Initialize();
rv = txMozillaXSLTProcessor::Startup();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize txMozillaXSLTProcessor");
return rv;
}
rv = DOMStorageObserver::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize DOMStorageObserver");
return rv;
}
rv = nsCCUncollectableMarker::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsCCUncollectableMarker");
return rv;
}
nsCSSParser::Startup();
nsCSSRuleProcessor::Startup();
#ifdef MOZ_XUL
rv = nsXULPopupManager::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsXULPopupManager");
return rv;
}
#endif
rv = nsFocusManager::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsFocusManager");
return rv;
}
AsyncLatencyLogger::InitializeStatics();
CubebUtils::InitLibrary();
nsContentSink::InitializeStatics();
nsHtml5Module::InitializeStatics();
mozilla::dom::FallbackEncoding::Initialize();
nsLayoutUtils::Initialize();
nsIPresShell::InitializeStatics();
TouchManager::InitializeStatics();
nsRefreshDriver::InitializeStatics();
nsPrincipal::InitializeStatics();
nsCORSListenerProxy::Startup();
NS_SealStaticAtomTable();
nsWindowMemoryReporter::Init();
SVGElementFactory::Init();
nsSVGUtils::Init();
ProcessPriorityManager::Init();
nsPermissionManager::AppClearDataObserverInit();
nsCookieService::AppClearDataObserverInit();
nsApplicationCacheService::AppClearDataObserverInit();
HTMLVideoElement::Init();
#ifdef MOZ_XUL
nsMenuBarListener::InitializeStatics();
#endif
CacheObserver::Init();
CounterStyleManager::InitializeBuiltinCounterStyles();
CameraPreferences::Initialize();
IMEStateManager::Init();
ServiceWorkerRegistrar::Initialize();
#ifdef MOZ_B2G
RequestSyncWifiService::Init();
#endif
MediaDecoder::InitStatics();
PromiseDebugging::Init();
layers::CompositorLRU::Init();
return NS_OK;
}
void
nsLayoutStatics::Shutdown()
{
// Don't need to shutdown nsWindowMemoryReporter, that will be done by the
// memory reporter manager.
nsMessageManagerScriptExecutor::Shutdown();
nsFocusManager::Shutdown();
#ifdef MOZ_XUL
nsXULPopupManager::Shutdown();
#endif
DOMStorageObserver::Shutdown();
txMozillaXSLTProcessor::Shutdown();
Attr::Shutdown();
EventListenerManager::Shutdown();
IMEStateManager::Shutdown();
nsCSSParser::Shutdown();
nsCSSRuleProcessor::Shutdown();
nsTextFrameTextRunCache::Shutdown();
nsHTMLDNSPrefetch::Shutdown();
nsCSSRendering::Shutdown();
#ifdef DEBUG
nsFrame::DisplayReflowShutdown();
#endif
nsCellMap::Shutdown();
ActiveLayerTracker::Shutdown();
// Release all of our atoms
nsColorNames::ReleaseTable();
nsCSSProps::ReleaseTable();
nsCSSKeywords::ReleaseTable();
nsRepeatService::Shutdown();
nsStackLayout::Shutdown();
nsBox::Shutdown();
#ifdef MOZ_XUL
nsXULContentUtils::Finish();
nsXULPrototypeCache::ReleaseGlobals();
nsSprocketLayout::Shutdown();
#endif
SVGElementFactory::Shutdown();
nsMathMLOperators::ReleaseTable();
nsFloatManager::Shutdown();
nsImageFrame::ReleaseGlobals();
mozilla::css::ErrorReporter::ReleaseGlobals();
nsTextFragment::Shutdown();
nsAttrValue::Shutdown();
nsContentUtils::Shutdown();
nsLayoutStylesheetCache::Shutdown();
ShutdownJSEnvironment();
nsGlobalWindow::ShutDown();
nsDOMClassInfo::ShutDown();
nsListControlFrame::Shutdown();
nsXBLService::Shutdown();
nsAutoCopyListener::Shutdown();
FrameLayerBuilder::Shutdown();
#ifdef MOZ_ANDROID_OMX
AndroidMediaPluginHost::Shutdown();
#endif
#ifdef MOZ_FFMPEG
FFmpegRuntimeLinker::Unlink();
#endif
CubebUtils::ShutdownLibrary();
AsyncLatencyLogger::ShutdownLogger();
WebAudioUtils::Shutdown();
#ifdef MOZ_WMF
WMFDecoder::UnloadDLLs();
#endif
#ifdef MOZ_WIDGET_GONK
nsVolumeService::Shutdown();
SpeakerManagerService::Shutdown();
#endif
#ifdef MOZ_WEBSPEECH
nsSynthVoiceRegistry::Shutdown();
#endif
nsCORSListenerProxy::Shutdown();
nsIPresShell::ReleaseStatics();
TouchManager::ReleaseStatics();
nsTreeSanitizer::ReleaseStatics();
nsHtml5Module::ReleaseStatics();
mozilla::dom::FallbackEncoding::Shutdown();
nsRegion::ShutdownStatic();
mozilla::EventDispatcher::Shutdown();
HTMLInputElement::DestroyUploadLastDir();
nsLayoutUtils::Shutdown();
nsHyphenationManager::Shutdown();
nsDOMMutationObserver::Shutdown();
AudioChannelService::Shutdown();
DataStoreService::Shutdown();
ContentParent::ShutDown();
nsRefreshDriver::Shutdown();
DisplayItemClip::Shutdown();
nsDocument::XPCOMShutdown();
CacheObserver::Shutdown();
CameraPreferences::Shutdown();
PromiseDebugging::Shutdown();
}