Bug 1552714 - Move DocumentL10n to dom/l10n. r=smaug
authorZibi Braniecki <zbraniecki@mozilla.com>
Thu, 06 Jun 2019 16:31:44 +0000
changeset 477625 5f5924f91943dfdd120944ef83bc3ebe67e23234
parent 477624 bb1d8fcccda57b97e73dfc0d5a4e7e8c3748d823
child 477626 cf6ce31cd14b48843a355dc12be2d5656cc685a1
push id36119
push userncsoregi@mozilla.com
push dateThu, 06 Jun 2019 21:52:09 +0000
treeherdermozilla-central@6a81efd823db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1552714
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1552714 - Move DocumentL10n to dom/l10n. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D32957
dom/base/Document.cpp
dom/base/Document.h
dom/bindings/Bindings.conf
dom/chrome-webidl/DocumentL10n.webidl
dom/chrome-webidl/moz.build
dom/l10n/DocumentL10n.cpp
dom/l10n/DocumentL10n.h
dom/l10n/moz.build
dom/webidl/DocumentL10n.webidl
dom/webidl/moz.build
dom/xul/XULDocument.cpp
intl/l10n/DocumentL10n.cpp
intl/l10n/DocumentL10n.h
intl/l10n/moz.build
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -239,31 +239,31 @@
 #include "nsWrapperCacheInlines.h"
 #include "nsSandboxFlags.h"
 #include "mozilla/dom/AnimatableBinding.h"
 #include "mozilla/dom/AnonymousContent.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/ClientInfo.h"
 #include "mozilla/dom/ClientState.h"
 #include "mozilla/dom/DocumentFragment.h"
-#include "mozilla/dom/DocumentL10n.h"
 #include "mozilla/dom/DocumentTimeline.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/HTMLBodyElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/ImageTracker.h"
 #include "mozilla/dom/MediaQueryList.h"
 #include "mozilla/dom/NodeFilterBinding.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/dom/BrowserChild.h"
 #include "mozilla/dom/WebComponentsBinding.h"
 #include "mozilla/dom/CustomElementRegistryBinding.h"
 #include "mozilla/dom/CustomElementRegistry.h"
 #include "mozilla/dom/ServiceWorkerDescriptor.h"
 #include "mozilla/dom/TimeoutManager.h"
+#include "mozilla/dom/l10n/DocumentL10n.h"
 #include "mozilla/ExtensionPolicyService.h"
 #include "nsFrame.h"
 #include "nsDOMCaretPosition.h"
 #include "nsViewportInfo.h"
 #include "mozilla/StaticPtr.h"
 #include "nsITextControlElement.h"
 #include "nsIHttpChannelInternal.h"
 #include "nsISecurityConsoleMessage.h"
@@ -3452,26 +3452,26 @@ bool Document::GetAllowPlugins() {
   }
 
   return true;
 }
 
 void Document::InitializeLocalization(nsTArray<nsString>& aResourceIds) {
   MOZ_ASSERT(!mDocumentL10n, "mDocumentL10n should not be initialized yet");
 
-  RefPtr<DocumentL10n> l10n = new DocumentL10n(this);
+  RefPtr<l10n::DocumentL10n> l10n = new l10n::DocumentL10n(this);
   ErrorResult rv;
   l10n->Init(aResourceIds, rv);
   if (NS_WARN_IF(rv.Failed())) {
     return;
   }
   mDocumentL10n = l10n;
 }
 
-DocumentL10n* Document::GetL10n() { return mDocumentL10n; }
+l10n::DocumentL10n* Document::GetL10n() { return mDocumentL10n; }
 
 bool Document::DocumentSupportsL10n(JSContext* aCx, JSObject* aObject) {
   nsCOMPtr<nsIPrincipal> callerPrincipal =
       nsContentUtils::SubjectPrincipal(aCx);
   return PrincipalAllowsL10n(callerPrincipal);
 }
 
 void Document::LocalizationLinkAdded(Element* aLinkElement) {
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -163,17 +163,19 @@ class Attr;
 class XULBroadcastManager;
 class XULPersist;
 class ClientInfo;
 class ClientState;
 class CDATASection;
 class Comment;
 struct CustomElementDefinition;
 class DocGroup;
+namespace l10n {
 class DocumentL10n;
+}
 class DocumentFragment;
 class DocumentTimeline;
 class DocumentType;
 class DOMImplementation;
 class DOMIntersectionObserver;
 class DOMStringList;
 class Element;
 struct ElementCreationOptions;
@@ -3806,17 +3808,17 @@ class Document : public nsINode,
    * intl/l10n/docs/fluent_tutorial.rst
    */
 
  public:
   /**
    * This is a public method exposed on Document WebIDL
    * to chrome only documents.
    */
-  DocumentL10n* GetL10n();
+  l10n::DocumentL10n* GetL10n();
 
   /**
    * This method should be called when the container
    * of l10n resources parsing is completed.
    *
    * It triggers initial async fetch of the resources
    * as early as possible.
    *
@@ -3859,17 +3861,17 @@ class Document : public nsINode,
    * It unblocks the layout.
    *
    * This method is virtual so that XULDocument can
    * override it.
    */
   virtual void InitialDocumentTranslationCompleted();
 
  protected:
-  RefPtr<DocumentL10n> mDocumentL10n;
+  RefPtr<l10n::DocumentL10n> mDocumentL10n;
 
   /**
    * Return true when you want a document without explicitly specified viewport
    * dimensions/scale to be treated as if "width=device-width" had in fact been
    * specified.
    */
   virtual bool UseWidthDeviceWidthFallbackViewport() const;
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -208,16 +208,20 @@ DOMInterfaces = {
 'DeviceAcceleration': {
     'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
 },
 
 'DeviceRotationRate': {
     'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
 },
 
+'DocumentL10n': {
+    'nativeType': 'mozilla::dom::l10n::DocumentL10n',
+},
+
 'DominatorTree': {
     'nativeType': 'mozilla::devtools::DominatorTree'
 },
 
 'DOMException': {
     'binaryNames': {
         'message': 'messageMoz',
     },
rename from dom/webidl/DocumentL10n.webidl
rename to dom/chrome-webidl/DocumentL10n.webidl
--- a/dom/chrome-webidl/moz.build
+++ b/dom/chrome-webidl/moz.build
@@ -30,16 +30,17 @@ with Files("WebExtension*.webidl"):
 
 PREPROCESSED_WEBIDL_FILES = [
     'ChromeUtils.webidl',
 ]
 
 WEBIDL_FILES = [
     'BrowsingContext.webidl',
     'ChannelWrapper.webidl',
+    'DocumentL10n.webidl',
     'DominatorTree.webidl',
     'DOMLocalization.webidl',
     'DOMOverlays.webidl',
     'Flex.webidl',
     'HeapSnapshot.webidl',
     'InspectorUtils.webidl',
     'IteratorResult.webidl',
     'JSWindowActor.webidl',
rename from intl/l10n/DocumentL10n.cpp
rename to dom/l10n/DocumentL10n.cpp
--- a/intl/l10n/DocumentL10n.cpp
+++ b/dom/l10n/DocumentL10n.cpp
@@ -1,27 +1,24 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "mozilla/dom/DocumentL10n.h"
+#include "DocumentL10n.h"
 #include "mozilla/dom/DocumentL10nBinding.h"
 #include "mozilla/dom/L10nUtilsBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "nsQueryObject.h"
 #include "nsISupports.h"
 #include "nsContentUtils.h"
 
-using namespace mozilla::intl;
-
-namespace mozilla {
-namespace dom {
+using namespace mozilla::dom::l10n;
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(DocumentL10n)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DocumentL10n, DOMLocalization)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mReady)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mContentSink)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@@ -144,11 +141,8 @@ void DocumentL10n::InitialDocumentTransl
   if (mContentSink) {
     mContentSink->InitialDocumentTranslationCompleted();
   }
 }
 
 Promise* DocumentL10n::Ready() { return mReady; }
 
 void DocumentL10n::OnCreatePresShell() { mMutations->OnCreatePresShell(); }
-
-}  // namespace dom
-}  // namespace mozilla
rename from intl/l10n/DocumentL10n.h
rename to dom/l10n/DocumentL10n.h
--- a/intl/l10n/DocumentL10n.h
+++ b/dom/l10n/DocumentL10n.h
@@ -1,32 +1,33 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 mozilla_dom_DocumentL10n_h
-#define mozilla_dom_DocumentL10n_h
+#ifndef mozilla_dom_l10n_DocumentL10n_h
+#define mozilla_dom_l10n_DocumentL10n_h
 
 #include "nsCycleCollectionParticipant.h"
 #include "nsIContentSink.h"
 #include "nsINode.h"
 #include "nsWrapperCache.h"
 #include "js/TypeDecls.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/Document.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/l10n/DOMLocalization.h"
 
 namespace mozilla {
 namespace dom {
+namespace l10n {
 
 enum class DocumentL10nState {
   Initialized = 0,
   InitialTranslationTriggered,
   InitialTranslationCompleted
 };
 
 /**
@@ -65,12 +66,13 @@ class DocumentL10n final : public l10n::
   void TriggerInitialDocumentTranslation();
 
   void InitialDocumentTranslationCompleted();
 
   Document* GetDocument() { return mDocument; };
   void OnCreatePresShell();
 };
 
+}  // namespace l10n
 }  // namespace dom
 }  // namespace mozilla
 
-#endif  // mozilla_dom_DocumentL10n_h
+#endif  // mozilla_dom_l10n_DocumentL10n_h
--- a/dom/l10n/moz.build
+++ b/dom/l10n/moz.build
@@ -3,22 +3,24 @@
 # 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/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "Internationalization")
 
 EXPORTS.mozilla.dom.l10n += [
+    'DocumentL10n.h',
     'DOMLocalization.h',
     'DOMOverlays.h',
     'Mutations.h',
 ]
 
 UNIFIED_SOURCES += [
+    'DocumentL10n.cpp',
     'DOMLocalization.cpp',
     'DOMOverlays.cpp',
     'Mutations.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '/dom/base',
 ]
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -461,17 +461,16 @@ WEBIDL_FILES = [
     'DataTransferItemList.webidl',
     'DecoderDoctorNotification.webidl',
     'DedicatedWorkerGlobalScope.webidl',
     'DelayNode.webidl',
     'DeviceMotionEvent.webidl',
     'Directory.webidl',
     'Document.webidl',
     'DocumentFragment.webidl',
-    'DocumentL10n.webidl',
     'DocumentOrShadowRoot.webidl',
     'DocumentTimeline.webidl',
     'DocumentType.webidl',
     'DOMError.webidl',
     'DOMException.webidl',
     'DOMImplementation.webidl',
     'DOMMatrix.webidl',
     'DOMParser.webidl',
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -70,17 +70,16 @@
 #include "nsIObserverService.h"
 #include "nsNodeUtils.h"
 #include "nsIXULWindow.h"
 #include "nsXULPopupManager.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsURILoader.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/CycleCollectedJSContext.h"
-#include "mozilla/dom/DocumentL10n.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/NodeInfoInlines.h"
 #include "mozilla/dom/ProcessingInstruction.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/XULDocumentBinding.h"
 #include "mozilla/dom/XULPersist.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/LoadInfo.h"
--- a/intl/l10n/moz.build
+++ b/intl/l10n/moz.build
@@ -17,24 +17,16 @@ TESTING_JS_MODULES += [
 
 XPIDL_SOURCES += [
     'mozIDOMLocalization.idl',
     'mozILocalization.idl',
 ]
 
 XPIDL_MODULE = 'locale'
 
-EXPORTS.mozilla.dom += [
-    'DocumentL10n.h',
-]
-
-UNIFIED_SOURCES += [
-    'DocumentL10n.cpp',
-]
-
 LOCAL_INCLUDES += [
     '/dom/base',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini']
 
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']