зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1607080 - Avoid a silly UTF16 -> UTF8 round-trip in DOMMatrix. r=smaug,boris
Depends on D58710 Differential Revision: https://phabricator.services.mozilla.com/D58711 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
795502e5b8
Коммит
8e79d673bb
|
@ -219,7 +219,8 @@ already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromFloat64Array(
|
|||
|
||||
already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::Constructor(
|
||||
const GlobalObject& aGlobal,
|
||||
const Optional<StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>& aArg,
|
||||
const Optional<UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>&
|
||||
aArg,
|
||||
ErrorResult& aRv) {
|
||||
if (!aArg.WasPassed()) {
|
||||
RefPtr<DOMMatrixReadOnly> rval =
|
||||
|
@ -228,7 +229,7 @@ already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::Constructor(
|
|||
}
|
||||
|
||||
const auto& arg = aArg.Value();
|
||||
if (arg.IsString()) {
|
||||
if (arg.IsUTF8String()) {
|
||||
nsCOMPtr<nsPIDOMWindowInner> win =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!win) {
|
||||
|
@ -237,7 +238,7 @@ already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::Constructor(
|
|||
}
|
||||
RefPtr<DOMMatrixReadOnly> rval =
|
||||
new DOMMatrixReadOnly(aGlobal.GetAsSupports());
|
||||
rval->SetMatrixValue(arg.GetAsString(), aRv);
|
||||
rval->SetMatrixValue(arg.GetAsUTF8String(), aRv);
|
||||
return rval.forget();
|
||||
}
|
||||
if (arg.IsDOMMatrixReadOnly()) {
|
||||
|
@ -664,7 +665,8 @@ already_AddRefed<DOMMatrix> DOMMatrix::FromFloat64Array(
|
|||
|
||||
already_AddRefed<DOMMatrix> DOMMatrix::Constructor(
|
||||
const GlobalObject& aGlobal,
|
||||
const Optional<StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>& aArg,
|
||||
const Optional<UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>&
|
||||
aArg,
|
||||
ErrorResult& aRv) {
|
||||
if (!aArg.WasPassed()) {
|
||||
RefPtr<DOMMatrix> rval = new DOMMatrix(aGlobal.GetAsSupports());
|
||||
|
@ -672,7 +674,7 @@ already_AddRefed<DOMMatrix> DOMMatrix::Constructor(
|
|||
}
|
||||
|
||||
const auto& arg = aArg.Value();
|
||||
if (arg.IsString()) {
|
||||
if (arg.IsUTF8String()) {
|
||||
nsCOMPtr<nsPIDOMWindowInner> win =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!win) {
|
||||
|
@ -680,7 +682,7 @@ already_AddRefed<DOMMatrix> DOMMatrix::Constructor(
|
|||
return nullptr;
|
||||
}
|
||||
RefPtr<DOMMatrix> rval = new DOMMatrix(aGlobal.GetAsSupports());
|
||||
rval->SetMatrixValue(arg.GetAsString(), aRv);
|
||||
rval->SetMatrixValue(arg.GetAsUTF8String(), aRv);
|
||||
return rval.forget();
|
||||
}
|
||||
if (arg.IsDOMMatrixReadOnly()) {
|
||||
|
@ -967,7 +969,7 @@ DOMMatrix* DOMMatrix::InvertSelf() {
|
|||
}
|
||||
|
||||
DOMMatrixReadOnly* DOMMatrixReadOnly::SetMatrixValue(
|
||||
const nsAString& aTransformList, ErrorResult& aRv) {
|
||||
const nsACString& aTransformList, ErrorResult& aRv) {
|
||||
// An empty string is a no-op.
|
||||
if (aTransformList.IsEmpty()) {
|
||||
return this;
|
||||
|
@ -1001,7 +1003,7 @@ DOMMatrixReadOnly* DOMMatrixReadOnly::SetMatrixValue(
|
|||
return this;
|
||||
}
|
||||
|
||||
DOMMatrix* DOMMatrix::SetMatrixValue(const nsAString& aTransformList,
|
||||
DOMMatrix* DOMMatrix::SetMatrixValue(const nsACString& aTransformList,
|
||||
ErrorResult& aRv) {
|
||||
DOMMatrixReadOnly::SetMatrixValue(aTransformList, aRv);
|
||||
return this;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace dom {
|
|||
class GlobalObject;
|
||||
class DOMMatrix;
|
||||
class DOMPoint;
|
||||
class StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly;
|
||||
class UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly;
|
||||
struct DOMPointInit;
|
||||
struct DOMMatrixInit;
|
||||
struct DOMMatrix2DInit;
|
||||
|
@ -83,7 +83,7 @@ class DOMMatrixReadOnly : public nsWrapperCache {
|
|||
|
||||
static already_AddRefed<DOMMatrixReadOnly> Constructor(
|
||||
const GlobalObject& aGlobal,
|
||||
const Optional<StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>&
|
||||
const Optional<UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>&
|
||||
aArg,
|
||||
ErrorResult& aRv);
|
||||
|
||||
|
@ -240,8 +240,7 @@ class DOMMatrixReadOnly : public nsWrapperCache {
|
|||
void SetDataFromMatrix2DInit(const DOMMatrix2DInit& aMatrixInit);
|
||||
void SetDataFromMatrixInit(const DOMMatrixInit& aMatrixInit);
|
||||
|
||||
DOMMatrixReadOnly* SetMatrixValue(const nsAString& aTransformList,
|
||||
ErrorResult& aRv);
|
||||
DOMMatrixReadOnly* SetMatrixValue(const nsACString&, ErrorResult&);
|
||||
void Ensure3DMatrix();
|
||||
|
||||
DOMMatrixReadOnly(nsISupports* aParent, bool is2D) : mParent(aParent) {
|
||||
|
@ -291,7 +290,7 @@ class DOMMatrix : public DOMMatrixReadOnly {
|
|||
|
||||
static already_AddRefed<DOMMatrix> Constructor(
|
||||
const GlobalObject& aGlobal,
|
||||
const Optional<StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>&
|
||||
const Optional<UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly>&
|
||||
aArg,
|
||||
ErrorResult& aRv);
|
||||
|
||||
|
@ -318,7 +317,7 @@ class DOMMatrix : public DOMMatrixReadOnly {
|
|||
DOMMatrix* SkewXSelf(double aSx);
|
||||
DOMMatrix* SkewYSelf(double aSy);
|
||||
DOMMatrix* InvertSelf();
|
||||
DOMMatrix* SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv);
|
||||
DOMMatrix* SetMatrixValue(const nsACString&, ErrorResult&);
|
||||
|
||||
virtual ~DOMMatrix() {}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
Serializable]
|
||||
interface DOMMatrixReadOnly {
|
||||
[Throws]
|
||||
constructor(optional (DOMString or sequence<unrestricted double> or DOMMatrixReadOnly) init);
|
||||
constructor(optional (UTF8String or sequence<unrestricted double> or DOMMatrixReadOnly) init);
|
||||
|
||||
[NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {});
|
||||
[NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
|
||||
|
@ -95,7 +95,7 @@ interface DOMMatrixReadOnly {
|
|||
LegacyWindowAlias=WebKitCSSMatrix]
|
||||
interface DOMMatrix : DOMMatrixReadOnly {
|
||||
[Throws]
|
||||
constructor(optional (DOMString or sequence<unrestricted double> or DOMMatrixReadOnly) init);
|
||||
constructor(optional (UTF8String or sequence<unrestricted double> or DOMMatrixReadOnly) init);
|
||||
|
||||
[NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {});
|
||||
[NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32);
|
||||
|
@ -155,7 +155,7 @@ interface DOMMatrix : DOMMatrixReadOnly {
|
|||
DOMMatrix skewXSelf(optional unrestricted double sx = 0);
|
||||
DOMMatrix skewYSelf(optional unrestricted double sy = 0);
|
||||
DOMMatrix invertSelf();
|
||||
[Exposed=Window, Throws] DOMMatrix setMatrixValue(DOMString transformList);
|
||||
[Exposed=Window, Throws] DOMMatrix setMatrixValue(UTF8String transformList);
|
||||
};
|
||||
|
||||
dictionary DOMMatrix2DInit {
|
||||
|
|
|
@ -49,7 +49,7 @@ bool ServoCSSParser::ParseEasing(const nsAString& aValue, URLExtraData* aUrl,
|
|||
}
|
||||
|
||||
/* static */
|
||||
bool ServoCSSParser::ParseTransformIntoMatrix(const nsAString& aValue,
|
||||
bool ServoCSSParser::ParseTransformIntoMatrix(const nsACString& aValue,
|
||||
bool& aContains3DTransform,
|
||||
gfx::Matrix4x4& aResult) {
|
||||
return Servo_ParseTransformIntoMatrix(&aValue, &aContains3DTransform,
|
||||
|
|
|
@ -105,7 +105,7 @@ class ServoCSSParser {
|
|||
* @param aResult The output matrix. (output)
|
||||
* @return Whether the value was successfully parsed.
|
||||
*/
|
||||
static bool ParseTransformIntoMatrix(const nsAString& aValue,
|
||||
static bool ParseTransformIntoMatrix(const nsACString& aValue,
|
||||
bool& aContains3DTransform,
|
||||
gfx::Matrix4x4& aResult);
|
||||
|
||||
|
|
|
@ -6514,13 +6514,13 @@ pub extern "C" fn Servo_IntersectionObserverRootMargin_ToString(
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ParseTransformIntoMatrix(
|
||||
value: &nsAString,
|
||||
value: &nsACString,
|
||||
contain_3d: &mut bool,
|
||||
result: &mut structs::Matrix4x4Components,
|
||||
) -> bool {
|
||||
use style::properties::longhands::transform;
|
||||
|
||||
let string = value.to_string();
|
||||
let string = unsafe { value.as_str_unchecked() };
|
||||
let mut input = ParserInput::new(&string);
|
||||
let mut parser = Parser::new(&mut input);
|
||||
let context = ParserContext::new(
|
||||
|
|
Загрузка…
Ссылка в новой задаче