зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1552714 - Remove dom::l10n namespace and unify class naming. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D33739 --HG-- rename : dom/chrome-webidl/DOMOverlays.webidl => dom/chrome-webidl/L10nOverlays.webidl rename : dom/l10n/Mutations.cpp => dom/l10n/L10nMutations.cpp rename : dom/l10n/Mutations.h => dom/l10n/L10nMutations.h rename : dom/l10n/DOMOverlays.cpp => dom/l10n/L10nOverlays.cpp rename : dom/l10n/DOMOverlays.h => dom/l10n/L10nOverlays.h rename : dom/l10n/tests/gtest/TestDOMOverlays.cpp => dom/l10n/tests/gtest/TestL10nOverlays.cpp rename : dom/l10n/tests/mochitest/dom_localization/test_mutations.html => dom/l10n/tests/mochitest/dom_localization/test_l10n_mutations.html rename : dom/l10n/tests/mochitest/mutations/test_append_content_post_dcl.html => dom/l10n/tests/mochitest/l10n_mutations/test_append_content_post_dcl.html rename : dom/l10n/tests/mochitest/mutations/test_append_content_pre_dcl.html => dom/l10n/tests/mochitest/l10n_mutations/test_append_content_pre_dcl.html rename : dom/l10n/tests/mochitest/mutations/test_append_fragment_post_dcl.html => dom/l10n/tests/mochitest/l10n_mutations/test_append_fragment_post_dcl.html rename : dom/l10n/tests/mochitest/mutations/test_pause_observing.html => dom/l10n/tests/mochitest/l10n_mutations/test_pause_observing.html rename : dom/l10n/tests/mochitest/mutations/test_set_attributes.html => dom/l10n/tests/mochitest/l10n_mutations/test_set_attributes.html rename : dom/l10n/tests/mochitest/domoverlays/test_attributes.html => dom/l10n/tests/mochitest/l10n_overlays/test_attributes.html rename : dom/l10n/tests/mochitest/domoverlays/test_extra_text_markup.html => dom/l10n/tests/mochitest/l10n_overlays/test_extra_text_markup.html rename : dom/l10n/tests/mochitest/domoverlays/test_functional_children.html => dom/l10n/tests/mochitest/l10n_overlays/test_functional_children.html rename : dom/l10n/tests/mochitest/domoverlays/test_domoverlays.xul => dom/l10n/tests/mochitest/l10n_overlays/test_l10n_overlays.xul rename : dom/l10n/tests/mochitest/domoverlays/test_same_id.html => dom/l10n/tests/mochitest/l10n_overlays/test_same_id.html rename : dom/l10n/tests/mochitest/domoverlays/test_same_id_args.html => dom/l10n/tests/mochitest/l10n_overlays/test_same_id_args.html rename : dom/l10n/tests/mochitest/domoverlays/test_text_children.html => dom/l10n/tests/mochitest/l10n_overlays/test_text_children.html extra : moz-landing-system : lando
This commit is contained in:
Родитель
0075d6e610
Коммит
307d0160a7
|
@ -258,7 +258,7 @@
|
|||
#include "mozilla/dom/CustomElementRegistry.h"
|
||||
#include "mozilla/dom/ServiceWorkerDescriptor.h"
|
||||
#include "mozilla/dom/TimeoutManager.h"
|
||||
#include "mozilla/dom/l10n/DocumentL10n.h"
|
||||
#include "mozilla/dom/DocumentL10n.h"
|
||||
#include "mozilla/ExtensionPolicyService.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsDOMCaretPosition.h"
|
||||
|
@ -3457,7 +3457,7 @@ bool Document::GetAllowPlugins() {
|
|||
void Document::InitializeLocalization(nsTArray<nsString>& aResourceIds) {
|
||||
MOZ_ASSERT(!mDocumentL10n, "mDocumentL10n should not be initialized yet");
|
||||
|
||||
RefPtr<l10n::DocumentL10n> l10n = new l10n::DocumentL10n(this);
|
||||
RefPtr<DocumentL10n> l10n = new DocumentL10n(this);
|
||||
ErrorResult rv;
|
||||
l10n->Init(aResourceIds, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
|
@ -3466,7 +3466,7 @@ void Document::InitializeLocalization(nsTArray<nsString>& aResourceIds) {
|
|||
mDocumentL10n = l10n;
|
||||
}
|
||||
|
||||
l10n::DocumentL10n* Document::GetL10n() { return mDocumentL10n; }
|
||||
DocumentL10n* Document::GetL10n() { return mDocumentL10n; }
|
||||
|
||||
bool Document::DocumentSupportsL10n(JSContext* aCx, JSObject* aObject) {
|
||||
nsCOMPtr<nsIPrincipal> callerPrincipal =
|
||||
|
|
|
@ -168,9 +168,7 @@ class CDATASection;
|
|||
class Comment;
|
||||
struct CustomElementDefinition;
|
||||
class DocGroup;
|
||||
namespace l10n {
|
||||
class DocumentL10n;
|
||||
}
|
||||
class DocumentFragment;
|
||||
class DocumentTimeline;
|
||||
class DocumentType;
|
||||
|
@ -3813,7 +3811,7 @@ class Document : public nsINode,
|
|||
* This is a public method exposed on Document WebIDL
|
||||
* to chrome only documents.
|
||||
*/
|
||||
l10n::DocumentL10n* GetL10n();
|
||||
DocumentL10n* GetL10n();
|
||||
|
||||
/**
|
||||
* This method should be called when the container
|
||||
|
@ -3866,7 +3864,7 @@ class Document : public nsINode,
|
|||
virtual void InitialDocumentTranslationCompleted();
|
||||
|
||||
protected:
|
||||
RefPtr<l10n::DocumentL10n> mDocumentL10n;
|
||||
RefPtr<DocumentL10n> mDocumentL10n;
|
||||
|
||||
/**
|
||||
* Return true when you want a document without explicitly specified viewport
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/dom/SVGUseElement.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/l10n/DOMOverlays.h"
|
||||
#include "mozilla/dom/L10nOverlays.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
#include "nsBindingManager.h"
|
||||
|
|
|
@ -213,10 +213,6 @@ DOMInterfaces = {
|
|||
'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
|
||||
},
|
||||
|
||||
'DocumentL10n': {
|
||||
'nativeType': 'mozilla::dom::l10n::DocumentL10n',
|
||||
},
|
||||
|
||||
'DominatorTree': {
|
||||
'nativeType': 'mozilla::devtools::DominatorTree'
|
||||
},
|
||||
|
@ -232,14 +228,6 @@ DOMInterfaces = {
|
|||
'headerFile': 'mozilla/dom/DOMMatrix.h',
|
||||
},
|
||||
|
||||
'DOMLocalization': {
|
||||
'nativeType': 'mozilla::dom::l10n::DOMLocalization',
|
||||
},
|
||||
|
||||
'DOMOverlays': {
|
||||
'nativeType': 'mozilla::dom::l10n::DOMOverlays',
|
||||
},
|
||||
|
||||
'DOMPointReadOnly': {
|
||||
'headerFile': 'mozilla/dom/DOMPoint.h',
|
||||
},
|
||||
|
|
|
@ -13,7 +13,7 @@ dictionary L10nValue {
|
|||
sequence<AttributeNameValue>? attributes = null;
|
||||
};
|
||||
|
||||
dictionary DOMOverlaysError {
|
||||
dictionary L10nOverlaysError {
|
||||
short code;
|
||||
DOMString translatedElementName;
|
||||
DOMString sourceElementName;
|
||||
|
@ -21,11 +21,11 @@ dictionary DOMOverlaysError {
|
|||
};
|
||||
|
||||
[ChromeOnly]
|
||||
namespace DOMOverlays {
|
||||
namespace L10nOverlays {
|
||||
const unsigned short ERROR_FORBIDDEN_TYPE = 1;
|
||||
const unsigned short ERROR_NAMED_ELEMENT_MISSING = 2;
|
||||
const unsigned short ERROR_NAMED_ELEMENT_TYPE_MISMATCH = 3;
|
||||
const unsigned short ERROR_UNKNOWN = 4;
|
||||
|
||||
sequence<DOMOverlaysError>? translateElement(Element element, optional L10nValue translation);
|
||||
sequence<L10nOverlaysError>? translateElement(Element element, optional L10nValue translation);
|
||||
};
|
|
@ -38,12 +38,12 @@ WEBIDL_FILES = [
|
|||
'DocumentL10n.webidl',
|
||||
'DominatorTree.webidl',
|
||||
'DOMLocalization.webidl',
|
||||
'DOMOverlays.webidl',
|
||||
'Flex.webidl',
|
||||
'HeapSnapshot.webidl',
|
||||
'InspectorUtils.webidl',
|
||||
'IteratorResult.webidl',
|
||||
'JSWindowActor.webidl',
|
||||
'L10nOverlays.webidl',
|
||||
'MatchGlob.webidl',
|
||||
'MatchPattern.webidl',
|
||||
'MessageManager.webidl',
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "DOMLocalization.h"
|
||||
#include "mozilla/intl/LocaleService.h"
|
||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
#include "mozilla/dom/l10n/DOMOverlays.h"
|
||||
#include "mozilla/dom/L10nOverlays.h"
|
||||
|
||||
#define INTL_APP_LOCALES_CHANGED "intl:app-locales-changed"
|
||||
|
||||
|
@ -18,7 +18,6 @@ static const char* kObservedPrefs[] = {L10N_PSEUDO_PREF, INTL_UI_DIRECTION_PREF,
|
|||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::l10n;
|
||||
using namespace mozilla::intl;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMLocalization)
|
||||
|
@ -48,7 +47,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMLocalization)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
DOMLocalization::DOMLocalization(nsIGlobalObject* aGlobal) : mGlobal(aGlobal) {
|
||||
mMutations = new mozilla::dom::l10n::Mutations(this);
|
||||
mMutations = new L10nMutations(this);
|
||||
}
|
||||
|
||||
void DOMLocalization::Init(nsTArray<nsString>& aResourceIds, ErrorResult& aRv) {
|
||||
|
@ -62,9 +61,11 @@ void DOMLocalization::Init(nsTArray<nsString>& aResourceIds, ErrorResult& aRv) {
|
|||
RegisterObservers();
|
||||
}
|
||||
|
||||
void DOMLocalization::Init(nsTArray<nsString>& aResourceIds, JS::Handle<JS::Value> aGenerateMessages, ErrorResult& aRv) {
|
||||
void DOMLocalization::Init(nsTArray<nsString>& aResourceIds,
|
||||
JS::Handle<JS::Value> aGenerateMessages,
|
||||
ErrorResult& aRv) {
|
||||
nsCOMPtr<mozILocalizationJSM> jsm =
|
||||
do_ImportModule("resource://gre/modules/Localization.jsm");
|
||||
do_ImportModule("resource://gre/modules/Localization.jsm");
|
||||
MOZ_RELEASE_ASSERT(jsm);
|
||||
|
||||
Unused << jsm->GetLocalizationWithCustomGenerateMessages(
|
||||
|
@ -584,11 +585,10 @@ void DOMLocalization::ApplyTranslations(nsTArray<nsCOMPtr<Element>>& aElements,
|
|||
return;
|
||||
}
|
||||
|
||||
nsTArray<DOMOverlaysError> errors;
|
||||
nsTArray<L10nOverlaysError> errors;
|
||||
for (size_t i = 0; i < aTranslations.Length(); ++i) {
|
||||
Element* elem = aElements[i];
|
||||
mozilla::dom::l10n::DOMOverlays::TranslateElement(*elem, aTranslations[i],
|
||||
errors, aRv);
|
||||
L10nOverlays::TranslateElement(*elem, aTranslations[i], errors, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
|
@ -601,7 +601,7 @@ void DOMLocalization::ApplyTranslations(nsTArray<nsCOMPtr<Element>>& aElements,
|
|||
return;
|
||||
}
|
||||
|
||||
ReportDOMOverlaysErrors(errors);
|
||||
ReportL10nOverlaysErrors(errors);
|
||||
}
|
||||
|
||||
/* Protected */
|
||||
|
@ -726,27 +726,27 @@ already_AddRefed<Promise> DOMLocalization::MaybeWrapPromise(
|
|||
return docPromise.forget();
|
||||
}
|
||||
|
||||
void DOMLocalization::ReportDOMOverlaysErrors(
|
||||
nsTArray<mozilla::dom::DOMOverlaysError>& aErrors) {
|
||||
void DOMLocalization::ReportL10nOverlaysErrors(
|
||||
nsTArray<L10nOverlaysError>& aErrors) {
|
||||
nsAutoString msg;
|
||||
|
||||
for (auto& error : aErrors) {
|
||||
if (error.mCode.WasPassed()) {
|
||||
msg = NS_LITERAL_STRING("[fluent-dom] ");
|
||||
switch (error.mCode.Value()) {
|
||||
case DOMOverlays_Binding::ERROR_FORBIDDEN_TYPE:
|
||||
case L10nOverlays_Binding::ERROR_FORBIDDEN_TYPE:
|
||||
msg += NS_LITERAL_STRING("An element of forbidden type \"") +
|
||||
error.mTranslatedElementName.Value() +
|
||||
NS_LITERAL_STRING(
|
||||
"\" was found in the translation. Only safe text-level "
|
||||
"elements and elements with data-l10n-name are allowed.");
|
||||
break;
|
||||
case DOMOverlays_Binding::ERROR_NAMED_ELEMENT_MISSING:
|
||||
case L10nOverlays_Binding::ERROR_NAMED_ELEMENT_MISSING:
|
||||
msg += NS_LITERAL_STRING("An element named \"") +
|
||||
error.mL10nName.Value() +
|
||||
NS_LITERAL_STRING("\" wasn't found in the source.");
|
||||
break;
|
||||
case DOMOverlays_Binding::ERROR_NAMED_ELEMENT_TYPE_MISMATCH:
|
||||
case L10nOverlays_Binding::ERROR_NAMED_ELEMENT_TYPE_MISMATCH:
|
||||
msg += NS_LITERAL_STRING("An element named \"") +
|
||||
error.mL10nName.Value() +
|
||||
NS_LITERAL_STRING(
|
||||
|
@ -756,7 +756,7 @@ void DOMLocalization::ReportDOMOverlaysErrors(
|
|||
" didn't match the element found in the source ") +
|
||||
error.mSourceElementName.Value() + NS_LITERAL_STRING(".");
|
||||
break;
|
||||
case DOMOverlays_Binding::ERROR_UNKNOWN:
|
||||
case L10nOverlays_Binding::ERROR_UNKNOWN:
|
||||
default:
|
||||
msg += NS_LITERAL_STRING(
|
||||
"Unknown error happened while translation of an element.");
|
||||
|
|
|
@ -9,14 +9,13 @@
|
|||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/DOMLocalizationBinding.h"
|
||||
#include "mozilla/dom/DocumentL10nBinding.h"
|
||||
#include "mozilla/dom/DOMOverlaysBinding.h"
|
||||
#include "mozilla/dom/l10n/Mutations.h"
|
||||
#include "mozilla/dom/L10nOverlaysBinding.h"
|
||||
#include "mozilla/dom/L10nMutations.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace l10n {
|
||||
|
||||
class DOMLocalization : public nsIObserver,
|
||||
public nsSupportsWeakReference,
|
||||
|
@ -29,7 +28,8 @@ class DOMLocalization : public nsIObserver,
|
|||
|
||||
explicit DOMLocalization(nsIGlobalObject* aGlobal);
|
||||
void Init(nsTArray<nsString>& aResourceIds, ErrorResult& aRv);
|
||||
void Init(nsTArray<nsString>& aResourceIds, JS::Handle<JS::Value> aGenerateMessages, ErrorResult& aRv);
|
||||
void Init(nsTArray<nsString>& aResourceIds,
|
||||
JS::Handle<JS::Value> aGenerateMessages, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<DOMLocalization> Constructor(
|
||||
const GlobalObject& aGlobal,
|
||||
|
@ -119,16 +119,14 @@ class DOMLocalization : public nsIObserver,
|
|||
void DisconnectMutations();
|
||||
void DisconnectRoots();
|
||||
already_AddRefed<Promise> MaybeWrapPromise(Promise* aPromise);
|
||||
void ReportDOMOverlaysErrors(
|
||||
nsTArray<mozilla::dom::DOMOverlaysError>& aErrors);
|
||||
void ReportL10nOverlaysErrors(nsTArray<L10nOverlaysError>& aErrors);
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mGlobal;
|
||||
RefPtr<Mutations> mMutations;
|
||||
RefPtr<L10nMutations> mMutations;
|
||||
nsCOMPtr<mozILocalization> mLocalization;
|
||||
nsTHashtable<nsRefPtrHashKey<Element>> mRoots;
|
||||
};
|
||||
|
||||
} // namespace l10n
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla::dom::l10n;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DocumentL10n)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DocumentL10n, DOMLocalization)
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
#include "mozilla/dom/l10n/DOMLocalization.h"
|
||||
#include "mozilla/dom/DOMLocalization.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace l10n {
|
||||
|
||||
enum class DocumentL10nState {
|
||||
Initialized = 0,
|
||||
|
@ -40,16 +39,16 @@ enum class DocumentL10nState {
|
|||
* instance of mozILocalization and maintains a single promise
|
||||
* which gets resolved the first time the document gets translated.
|
||||
*/
|
||||
class DocumentL10n final : public l10n::DOMLocalization {
|
||||
class DocumentL10n final : public DOMLocalization {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DocumentL10n, l10n::DOMLocalization)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DocumentL10n, DOMLocalization)
|
||||
|
||||
public:
|
||||
explicit DocumentL10n(Document* aDocument);
|
||||
void Init(nsTArray<nsString>& aResourceIds, ErrorResult& aRv);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual ~DocumentL10n() = default;
|
||||
|
||||
RefPtr<Document> mDocument;
|
||||
|
@ -71,7 +70,6 @@ class DocumentL10n final : public l10n::DOMLocalization {
|
|||
void OnCreatePresShell();
|
||||
};
|
||||
|
||||
} // namespace l10n
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -1,38 +1,36 @@
|
|||
#include "Mutations.h"
|
||||
#include "L10nMutations.h"
|
||||
#include "mozilla/dom/DocumentInlines.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace l10n {
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(Mutations)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(L10nMutations)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Mutations)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(L10nMutations)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPendingElements)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPendingElementsHash)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Mutations)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(L10nMutations)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPendingElements)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPendingElementsHash)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Mutations)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(L10nMutations)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Mutations)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Mutations)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(L10nMutations)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(L10nMutations)
|
||||
|
||||
Mutations::Mutations(DOMLocalization* aDOMLocalization)
|
||||
L10nMutations::L10nMutations(DOMLocalization* aDOMLocalization)
|
||||
: mDOMLocalization(aDOMLocalization) {
|
||||
mObserving = true;
|
||||
}
|
||||
|
||||
void Mutations::AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute, int32_t aModType,
|
||||
const nsAttrValue* aOldValue) {
|
||||
void L10nMutations::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute, int32_t aModType,
|
||||
const nsAttrValue* aOldValue) {
|
||||
if (!mObserving) {
|
||||
return;
|
||||
}
|
||||
|
@ -46,7 +44,7 @@ void Mutations::AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
|
|||
}
|
||||
}
|
||||
|
||||
void Mutations::ContentAppended(nsIContent* aChild) {
|
||||
void L10nMutations::ContentAppended(nsIContent* aChild) {
|
||||
if (!mObserving) {
|
||||
return;
|
||||
}
|
||||
|
@ -72,7 +70,7 @@ void Mutations::ContentAppended(nsIContent* aChild) {
|
|||
}
|
||||
}
|
||||
|
||||
void Mutations::ContentInserted(nsIContent* aChild) {
|
||||
void L10nMutations::ContentInserted(nsIContent* aChild) {
|
||||
if (!mObserving) {
|
||||
return;
|
||||
}
|
||||
|
@ -95,7 +93,7 @@ void Mutations::ContentInserted(nsIContent* aChild) {
|
|||
}
|
||||
}
|
||||
|
||||
void Mutations::L10nElementChanged(Element* aElement) {
|
||||
void L10nMutations::L10nElementChanged(Element* aElement) {
|
||||
if (!mPendingElementsHash.Contains(aElement)) {
|
||||
mPendingElements.AppendElement(aElement);
|
||||
mPendingElementsHash.PutEntry(aElement);
|
||||
|
@ -106,16 +104,16 @@ void Mutations::L10nElementChanged(Element* aElement) {
|
|||
}
|
||||
}
|
||||
|
||||
void Mutations::PauseObserving() { mObserving = false; }
|
||||
void L10nMutations::PauseObserving() { mObserving = false; }
|
||||
|
||||
void Mutations::ResumeObserving() { mObserving = true; }
|
||||
void L10nMutations::ResumeObserving() { mObserving = true; }
|
||||
|
||||
void Mutations::WillRefresh(mozilla::TimeStamp aTime) {
|
||||
void L10nMutations::WillRefresh(mozilla::TimeStamp aTime) {
|
||||
StopRefreshObserver();
|
||||
FlushPendingTranslations();
|
||||
}
|
||||
|
||||
void Mutations::FlushPendingTranslations() {
|
||||
void L10nMutations::FlushPendingTranslations() {
|
||||
if (!mDOMLocalization) {
|
||||
return;
|
||||
}
|
||||
|
@ -138,12 +136,12 @@ void Mutations::FlushPendingTranslations() {
|
|||
RefPtr<Promise> promise = mDOMLocalization->TranslateElements(elements, rv);
|
||||
}
|
||||
|
||||
void Mutations::Disconnect() {
|
||||
void L10nMutations::Disconnect() {
|
||||
StopRefreshObserver();
|
||||
mDOMLocalization = nullptr;
|
||||
}
|
||||
|
||||
void Mutations::StartRefreshObserver() {
|
||||
void L10nMutations::StartRefreshObserver() {
|
||||
if (!mDOMLocalization || mRefreshObserver) {
|
||||
return;
|
||||
}
|
||||
|
@ -172,7 +170,7 @@ void Mutations::StartRefreshObserver() {
|
|||
}
|
||||
}
|
||||
|
||||
void Mutations::StopRefreshObserver() {
|
||||
void L10nMutations::StopRefreshObserver() {
|
||||
if (!mDOMLocalization) {
|
||||
return;
|
||||
}
|
||||
|
@ -183,12 +181,8 @@ void Mutations::StopRefreshObserver() {
|
|||
}
|
||||
}
|
||||
|
||||
void Mutations::OnCreatePresShell() {
|
||||
void L10nMutations::OnCreatePresShell() {
|
||||
if (!mPendingElements.IsEmpty()) {
|
||||
StartRefreshObserver();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace l10n
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -1,30 +1,29 @@
|
|||
#ifndef mozilla_dom_l10n_Mutations_h__
|
||||
#define mozilla_dom_l10n_Mutations_h__
|
||||
#ifndef mozilla_dom_l10n_L10nMutations_h__
|
||||
#define mozilla_dom_l10n_L10nMutations_h__
|
||||
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "mozilla/dom/l10n/DOMLocalization.h"
|
||||
#include "mozilla/dom/DOMLocalization.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace l10n {
|
||||
|
||||
/**
|
||||
* Mutations manage observing roots for localization
|
||||
* L10nMutations manage observing roots for localization
|
||||
* changes and coalescing pending translations into
|
||||
* batches - one per animation frame.
|
||||
*/
|
||||
class Mutations final : public nsStubMutationObserver,
|
||||
public nsARefreshObserver {
|
||||
class L10nMutations final : public nsStubMutationObserver,
|
||||
public nsARefreshObserver {
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(Mutations, nsIMutationObserver)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(L10nMutations, nsIMutationObserver)
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
|
||||
explicit Mutations(DOMLocalization* aDOMLocalization);
|
||||
explicit L10nMutations(DOMLocalization* aDOMLocalization);
|
||||
|
||||
/**
|
||||
* Pause root observation.
|
||||
|
@ -71,15 +70,14 @@ class Mutations final : public nsStubMutationObserver,
|
|||
void FlushPendingTranslations();
|
||||
|
||||
private:
|
||||
~Mutations() {
|
||||
~L10nMutations() {
|
||||
StopRefreshObserver();
|
||||
MOZ_ASSERT(!mDOMLocalization,
|
||||
"DOMLocalization<-->Mutations cycle should be broken.");
|
||||
"DOMLocalization<-->L10nMutations cycle should be broken.");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace l10n
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_l10n_Mutations_h__
|
||||
#endif // mozilla_dom_l10n_L10nMutations_h__
|
|
@ -1,15 +1,14 @@
|
|||
#include "DOMOverlays.h"
|
||||
#include "L10nOverlays.h"
|
||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
#include "mozilla/dom/HTMLInputElement.h"
|
||||
#include "HTMLSplitOnSpacesTokenizer.h"
|
||||
#include "nsHtml5StringParser.h"
|
||||
#include "nsTextNode.h"
|
||||
|
||||
using namespace mozilla::dom::l10n;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla;
|
||||
|
||||
bool DOMOverlays::IsAttrNameLocalizable(
|
||||
bool L10nOverlays::IsAttrNameLocalizable(
|
||||
const nsAtom* nameAtom, Element* aElement,
|
||||
nsTArray<nsString>* aExplicitlyAllowed) {
|
||||
nsAutoString name;
|
||||
|
@ -102,7 +101,7 @@ bool DOMOverlays::IsAttrNameLocalizable(
|
|||
return false;
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode> DOMOverlays::CreateTextNodeFromTextContent(
|
||||
already_AddRefed<nsINode> L10nOverlays::CreateTextNodeFromTextContent(
|
||||
Element* aElement, ErrorResult& aRv) {
|
||||
nsAutoString content;
|
||||
aElement->GetTextContent(content, aRv);
|
||||
|
@ -122,7 +121,7 @@ class AttributeNameValueComparator {
|
|||
}
|
||||
};
|
||||
|
||||
void DOMOverlays::OverlayAttributes(
|
||||
void L10nOverlays::OverlayAttributes(
|
||||
const Nullable<Sequence<AttributeNameValue>>& aTranslation,
|
||||
Element* aToElement, ErrorResult& aRv) {
|
||||
nsTArray<nsString> explicitlyAllowed;
|
||||
|
@ -177,8 +176,8 @@ void DOMOverlays::OverlayAttributes(
|
|||
}
|
||||
}
|
||||
|
||||
void DOMOverlays::OverlayAttributes(Element* aFromElement, Element* aToElement,
|
||||
ErrorResult& aRv) {
|
||||
void L10nOverlays::OverlayAttributes(Element* aFromElement, Element* aToElement,
|
||||
ErrorResult& aRv) {
|
||||
Nullable<Sequence<AttributeNameValue>> attributes;
|
||||
uint32_t attrCount = aFromElement->GetAttrCount();
|
||||
|
||||
|
@ -202,8 +201,8 @@ void DOMOverlays::OverlayAttributes(Element* aFromElement, Element* aToElement,
|
|||
return OverlayAttributes(attributes, aToElement, aRv);
|
||||
}
|
||||
|
||||
void DOMOverlays::ShallowPopulateUsing(Element* aFromElement,
|
||||
Element* aToElement, ErrorResult& aRv) {
|
||||
void L10nOverlays::ShallowPopulateUsing(Element* aFromElement,
|
||||
Element* aToElement, ErrorResult& aRv) {
|
||||
nsAutoString content;
|
||||
aFromElement->GetTextContent(content, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
|
@ -221,9 +220,9 @@ void DOMOverlays::ShallowPopulateUsing(Element* aFromElement,
|
|||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode> DOMOverlays::GetNodeForNamedElement(
|
||||
already_AddRefed<nsINode> L10nOverlays::GetNodeForNamedElement(
|
||||
Element* aSourceElement, Element* aTranslatedChild,
|
||||
nsTArray<DOMOverlaysError>& aErrors, ErrorResult& aRv) {
|
||||
nsTArray<L10nOverlaysError>& aErrors, ErrorResult& aRv) {
|
||||
nsAutoString childName;
|
||||
aTranslatedChild->GetAttr(kNameSpaceID_None, nsGkAtoms::datal10nname,
|
||||
childName);
|
||||
|
@ -246,8 +245,8 @@ already_AddRefed<nsINode> DOMOverlays::GetNodeForNamedElement(
|
|||
}
|
||||
|
||||
if (!sourceChild) {
|
||||
DOMOverlaysError error;
|
||||
error.mCode.Construct(DOMOverlays_Binding::ERROR_NAMED_ELEMENT_MISSING);
|
||||
L10nOverlaysError error;
|
||||
error.mCode.Construct(L10nOverlays_Binding::ERROR_NAMED_ELEMENT_MISSING);
|
||||
error.mL10nName.Construct(childName);
|
||||
aErrors.AppendElement(error);
|
||||
return CreateTextNodeFromTextContent(aTranslatedChild, aRv);
|
||||
|
@ -260,9 +259,9 @@ already_AddRefed<nsINode> DOMOverlays::GetNodeForNamedElement(
|
|||
// see bug 1543493
|
||||
!(translatedChildName == nsGkAtoms::img &&
|
||||
sourceChildName == nsGkAtoms::image)) {
|
||||
DOMOverlaysError error;
|
||||
L10nOverlaysError error;
|
||||
error.mCode.Construct(
|
||||
DOMOverlays_Binding::ERROR_NAMED_ELEMENT_TYPE_MISMATCH);
|
||||
L10nOverlays_Binding::ERROR_NAMED_ELEMENT_TYPE_MISMATCH);
|
||||
error.mL10nName.Construct(childName);
|
||||
error.mTranslatedElementName.Construct(
|
||||
aTranslatedChild->NodeInfo()->LocalName());
|
||||
|
@ -286,7 +285,7 @@ already_AddRefed<nsINode> DOMOverlays::GetNodeForNamedElement(
|
|||
return clone.forget();
|
||||
}
|
||||
|
||||
bool DOMOverlays::IsElementAllowed(Element* aElement) {
|
||||
bool L10nOverlays::IsElementAllowed(Element* aElement) {
|
||||
uint32_t nameSpace = aElement->NodeInfo()->NamespaceID();
|
||||
if (nameSpace != kNameSpaceID_XHTML) {
|
||||
return false;
|
||||
|
@ -309,7 +308,7 @@ bool DOMOverlays::IsElementAllowed(Element* aElement) {
|
|||
nameAtom == nsGkAtoms::wbr;
|
||||
}
|
||||
|
||||
already_AddRefed<Element> DOMOverlays::CreateSanitizedElement(
|
||||
already_AddRefed<Element> L10nOverlays::CreateSanitizedElement(
|
||||
Element* aElement, ErrorResult& aRv) {
|
||||
// Start with an empty element of the same type to remove nested children
|
||||
// and non-localizable attributes defined by the translation.
|
||||
|
@ -330,10 +329,10 @@ already_AddRefed<Element> DOMOverlays::CreateSanitizedElement(
|
|||
return clone.forget();
|
||||
}
|
||||
|
||||
void DOMOverlays::OverlayChildNodes(DocumentFragment* aFromFragment,
|
||||
Element* aToElement,
|
||||
nsTArray<DOMOverlaysError>& aErrors,
|
||||
ErrorResult& aRv) {
|
||||
void L10nOverlays::OverlayChildNodes(DocumentFragment* aFromFragment,
|
||||
Element* aToElement,
|
||||
nsTArray<L10nOverlaysError>& aErrors,
|
||||
ErrorResult& aRv) {
|
||||
nsINodeList* childNodes = aFromFragment->ChildNodes();
|
||||
for (uint32_t i = 0; i < childNodes->Length(); i++) {
|
||||
nsINode* childNode = childNodes->Item(i);
|
||||
|
@ -370,8 +369,8 @@ void DOMOverlays::OverlayChildNodes(DocumentFragment* aFromFragment,
|
|||
continue;
|
||||
}
|
||||
|
||||
DOMOverlaysError error;
|
||||
error.mCode.Construct(DOMOverlays_Binding::ERROR_FORBIDDEN_TYPE);
|
||||
L10nOverlaysError error;
|
||||
error.mCode.Construct(L10nOverlays_Binding::ERROR_FORBIDDEN_TYPE);
|
||||
error.mTranslatedElementName.Construct(
|
||||
childElement->NodeInfo()->LocalName());
|
||||
aErrors.AppendElement(error);
|
||||
|
@ -397,18 +396,18 @@ void DOMOverlays::OverlayChildNodes(DocumentFragment* aFromFragment,
|
|||
}
|
||||
}
|
||||
|
||||
void DOMOverlays::TranslateElement(
|
||||
void L10nOverlays::TranslateElement(
|
||||
const GlobalObject& aGlobal, Element& aElement,
|
||||
const L10nValue& aTranslation,
|
||||
Nullable<nsTArray<DOMOverlaysError>>& aErrors) {
|
||||
nsTArray<DOMOverlaysError> errors;
|
||||
Nullable<nsTArray<L10nOverlaysError>>& aErrors) {
|
||||
nsTArray<L10nOverlaysError> errors;
|
||||
|
||||
ErrorResult rv;
|
||||
|
||||
TranslateElement(aElement, aTranslation, errors, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
DOMOverlaysError error;
|
||||
error.mCode.Construct(DOMOverlays_Binding::ERROR_UNKNOWN);
|
||||
L10nOverlaysError error;
|
||||
error.mCode.Construct(L10nOverlays_Binding::ERROR_UNKNOWN);
|
||||
errors.AppendElement(error);
|
||||
}
|
||||
if (!errors.IsEmpty()) {
|
||||
|
@ -416,7 +415,7 @@ void DOMOverlays::TranslateElement(
|
|||
}
|
||||
}
|
||||
|
||||
bool DOMOverlays::ContainsMarkup(const nsAString& aStr) {
|
||||
bool L10nOverlays::ContainsMarkup(const nsAString& aStr) {
|
||||
// We use our custom ContainsMarkup rather than the
|
||||
// one from FragmentOrElement.cpp, because we don't
|
||||
// want to trigger HTML parsing on every `Preferences & Options`
|
||||
|
@ -445,10 +444,10 @@ bool DOMOverlays::ContainsMarkup(const nsAString& aStr) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void DOMOverlays::TranslateElement(Element& aElement,
|
||||
const L10nValue& aTranslation,
|
||||
nsTArray<DOMOverlaysError>& aErrors,
|
||||
ErrorResult& aRv) {
|
||||
void L10nOverlays::TranslateElement(Element& aElement,
|
||||
const L10nValue& aTranslation,
|
||||
nsTArray<L10nOverlaysError>& aErrors,
|
||||
ErrorResult& aRv) {
|
||||
if (!aTranslation.mValue.IsVoid()) {
|
||||
if (!ContainsMarkup(aTranslation.mValue)) {
|
||||
// If the translation doesn't contain any markup skip the overlay logic.
|
|
@ -1,14 +1,13 @@
|
|||
#ifndef mozilla_dom_l10n_DOMOverlays_h__
|
||||
#define mozilla_dom_l10n_DOMOverlays_h__
|
||||
#ifndef mozilla_dom_l10n_L10nOverlays_h__
|
||||
#define mozilla_dom_l10n_L10nOverlays_h__
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/DOMOverlaysBinding.h"
|
||||
#include "mozilla/dom/L10nOverlaysBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace l10n {
|
||||
|
||||
class DOMOverlays {
|
||||
class L10nOverlays {
|
||||
public:
|
||||
/**
|
||||
* Translate an element.
|
||||
|
@ -19,13 +18,12 @@ class DOMOverlays {
|
|||
* translation defines the same children, their attributes and text contents
|
||||
* will be used for translating the matching source child.
|
||||
*/
|
||||
static void TranslateElement(
|
||||
const GlobalObject& aGlobal, Element& aElement,
|
||||
const L10nValue& aTranslation,
|
||||
Nullable<nsTArray<mozilla::dom::DOMOverlaysError>>& aErrors);
|
||||
static void TranslateElement(
|
||||
Element& aElement, const L10nValue& aTranslation,
|
||||
nsTArray<mozilla::dom::DOMOverlaysError>& aErrors, ErrorResult& aRv);
|
||||
static void TranslateElement(const GlobalObject& aGlobal, Element& aElement,
|
||||
const L10nValue& aTranslation,
|
||||
Nullable<nsTArray<L10nOverlaysError>>& aErrors);
|
||||
static void TranslateElement(Element& aElement, const L10nValue& aTranslation,
|
||||
nsTArray<L10nOverlaysError>& aErrors,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -74,7 +72,7 @@ class DOMOverlays {
|
|||
*/
|
||||
static already_AddRefed<nsINode> GetNodeForNamedElement(
|
||||
Element* aSourceElement, Element* aTranslatedChild,
|
||||
nsTArray<DOMOverlaysError>& aErrors, ErrorResult& aRv);
|
||||
nsTArray<L10nOverlaysError>& aErrors, ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Check if element is allowed in the translation.
|
||||
|
@ -101,7 +99,7 @@ class DOMOverlays {
|
|||
*/
|
||||
static void OverlayChildNodes(DocumentFragment* aFromFragment,
|
||||
Element* aToElement,
|
||||
nsTArray<DOMOverlaysError>& aErrors,
|
||||
nsTArray<L10nOverlaysError>& aErrors,
|
||||
ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
|
@ -110,7 +108,6 @@ class DOMOverlays {
|
|||
static bool ContainsMarkup(const nsAString& aStr);
|
||||
};
|
||||
|
||||
} // namespace l10n
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
Classes = [
|
||||
{
|
||||
'cid': '{a2017fd2-7d8d-11e9-b492-ab187f765b54}',
|
||||
'contract_ids': ['@mozilla.org/dom/l10n/domlocalization;1'],
|
||||
'type': 'mozilla::dom::l10n::DOMLocalization',
|
||||
'contract_ids': ['@mozilla.org/dom/l10n/localization;1'],
|
||||
'type': 'mozilla::dom::DOMLocalization',
|
||||
'headers': ['/dom/l10n/DOMLocalization.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{8d85597c-3a92-11e9-9ffc-73d225b2d53f}',
|
||||
'contract_ids': ['@mozilla.org/dom/l10n/domoverlays;1'],
|
||||
'type': 'mozilla::dom::l10n::DOMOverlays',
|
||||
'headers': ['/dom/l10n/DOMOverlays.h'],
|
||||
'contract_ids': ['@mozilla.org/dom/l10n/overlays;1'],
|
||||
'type': 'mozilla::dom::L10nOverlays',
|
||||
'headers': ['/dom/l10n/L10nOverlays.h'],
|
||||
},
|
||||
]
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "Internationalization")
|
||||
|
||||
EXPORTS.mozilla.dom.l10n += [
|
||||
EXPORTS.mozilla.dom += [
|
||||
'DocumentL10n.h',
|
||||
'DOMLocalization.h',
|
||||
'DOMOverlays.h',
|
||||
'Mutations.h',
|
||||
'L10nMutations.h',
|
||||
'L10nOverlays.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'DocumentL10n.cpp',
|
||||
'DOMLocalization.cpp',
|
||||
'DOMOverlays.cpp',
|
||||
'Mutations.cpp',
|
||||
'L10nMutations.cpp',
|
||||
'L10nOverlays.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
|
|
@ -4,16 +4,15 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "mozilla/dom/l10n/DOMOverlays.h"
|
||||
#include "mozilla/dom/L10nOverlays.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/DOMOverlaysBinding.h"
|
||||
#include "mozilla/dom/L10nOverlaysBinding.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/NullPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
using mozilla::NullPrincipal;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::l10n;
|
||||
|
||||
static already_AddRefed<Document> SetUpDocument() {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -37,10 +36,10 @@ static already_AddRefed<Document> SetUpDocument() {
|
|||
}
|
||||
|
||||
/**
|
||||
* This test verifies that the basic C++ DOMOverlays API
|
||||
* This test verifies that the basic C++ DOM L10nOverlays API
|
||||
* works correctly.
|
||||
*/
|
||||
TEST(DOM_L10n_DOMOverlays, Initial)
|
||||
TEST(DOM_L10n_Overlays, Initial)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
|
||||
|
@ -67,8 +66,8 @@ TEST(DOM_L10n_DOMOverlays, Initial)
|
|||
"Hello <a data-l10n-name=\"link\">World</a>.");
|
||||
|
||||
// 4. Translate the element.
|
||||
nsTArray<DOMOverlaysError> errors;
|
||||
DOMOverlays::TranslateElement(*elem, translation, errors, rv);
|
||||
nsTArray<L10nOverlaysError> errors;
|
||||
L10nOverlays::TranslateElement(*elem, translation, errors, rv);
|
||||
|
||||
nsAutoString textContent;
|
||||
elem->GetInnerHTML(textContent, rv);
|
|
@ -5,7 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'TestDOMOverlays.cpp',
|
||||
'TestL10nOverlays.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul-gtest'
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
[domoverlays/test_attributes.html]
|
||||
[domoverlays/test_functional_children.html]
|
||||
[domoverlays/test_text_children.html]
|
||||
[domoverlays/test_extra_text_markup.html]
|
||||
[domoverlays/test_domoverlays.xul]
|
||||
[domoverlays/test_same_id.html]
|
||||
[domoverlays/test_same_id_args.html]
|
||||
[l10n_overlays/test_attributes.html]
|
||||
[l10n_overlays/test_functional_children.html]
|
||||
[l10n_overlays/test_text_children.html]
|
||||
[l10n_overlays/test_extra_text_markup.html]
|
||||
[l10n_overlays/test_l10n_overlays.xul]
|
||||
[l10n_overlays/test_same_id.html]
|
||||
[l10n_overlays/test_same_id_args.html]
|
||||
|
||||
[mutations/test_append_content_post_dcl.html]
|
||||
[mutations/test_append_content_pre_dcl.html]
|
||||
[mutations/test_append_fragment_post_dcl.html]
|
||||
[mutations/test_set_attributes.html]
|
||||
[mutations/test_pause_observing.html]
|
||||
[l10n_mutations/test_append_content_post_dcl.html]
|
||||
[l10n_mutations/test_append_content_pre_dcl.html]
|
||||
[l10n_mutations/test_append_fragment_post_dcl.html]
|
||||
[l10n_mutations/test_set_attributes.html]
|
||||
[l10n_mutations/test_pause_observing.html]
|
||||
|
||||
[dom_localization/test_attr_sanitized.html]
|
||||
[dom_localization/test_getAttributes.html]
|
||||
|
@ -21,7 +21,7 @@
|
|||
[dom_localization/test_disconnectRoot.html]
|
||||
[dom_localization/test_repeated_l10nid.html]
|
||||
[dom_localization/test_translateRoots.html]
|
||||
[dom_localization/test_mutations.html]
|
||||
[dom_localization/test_l10n_mutations.html]
|
||||
[dom_localization/test_overlay.html]
|
||||
[dom_localization/test_overlay_repeated.html]
|
||||
[dom_localization/test_overlay_missing_all.html]
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test DOMOverlays Top-level attributes</title>
|
||||
<title>Test L10nOverlays Top-level attributes</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript">
|
||||
/* global DOMOverlays */
|
||||
/* global L10nOverlays */
|
||||
"use strict";
|
||||
|
||||
function elem(name) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
const { translateElement } = DOMOverlays;
|
||||
const { translateElement } = L10nOverlays;
|
||||
|
||||
{
|
||||
// Allowed attribute
|
|
@ -2,11 +2,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test DOMOverlays Localized text markup</title>
|
||||
<title>Test L10nOverlays Localized text markup</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript">
|
||||
/* global DOMOverlays */
|
||||
/* global L10nOverlays */
|
||||
"use strict";
|
||||
|
||||
function elem(name) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
const { translateElement } = DOMOverlays;
|
||||
const { translateElement } = L10nOverlays;
|
||||
|
||||
// Localized text markup
|
||||
{
|
|
@ -2,11 +2,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test DOMOverlays functional children test</title>
|
||||
<title>Test L10nOverlays functional children test</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript">
|
||||
/* global DOMOverlays */
|
||||
/* global L10nOverlays */
|
||||
"use strict";
|
||||
|
||||
function elem(name) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
const { translateElement } = DOMOverlays;
|
||||
const { translateElement } = L10nOverlays;
|
||||
|
||||
// Child without name
|
||||
{
|
|
@ -16,7 +16,7 @@
|
|||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/* global DOMOverlays */
|
||||
/* global L10nOverlays */
|
||||
|
||||
function elem(name) {
|
||||
return function(str) {
|
||||
|
@ -27,7 +27,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
const { translateElement } = DOMOverlays;
|
||||
const { translateElement } = L10nOverlays;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
{
|
||||
// Don't handle XUL translation
|
||||
//
|
||||
// Current iteration of DOMOverlays will replace
|
||||
// Current iteration of L10nOverlays will replace
|
||||
// XUL elements from translation with text.
|
||||
//
|
||||
// See bug 1545704 for details.
|
|
@ -2,11 +2,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test DOMOverlays Text-semantic argument elements</title>
|
||||
<title>Test L10nOverlays Text-semantic argument elements</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
<script type="application/javascript">
|
||||
/* global DOMOverlays */
|
||||
/* global L10nOverlays */
|
||||
"use strict";
|
||||
|
||||
function elem(name) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
const { translateElement } = DOMOverlays;
|
||||
const { translateElement } = L10nOverlays;
|
||||
|
||||
{
|
||||
// without data-l10n-name
|
Загрузка…
Ссылка в новой задаче