Skip to content

Commit

Permalink
refactor: DOMMatrixReadonly to DOMMatrixReadOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
jwxbond committed Nov 6, 2024
1 parent a9351e0 commit 027ab87
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 119 deletions.
4 changes: 2 additions & 2 deletions bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
core/html/canvas/canvas_pattern.cc
core/html/canvas/path_2d.cc
core/geometry/dom_matrix.cc
core/geometry/dom_matrix_readonly.cc
core/geometry/dom_matrix_read_only.cc
core/geometry/dom_point.cc
core/geometry/dom_point_readonly.cc
core/html/forms/html_button_element.cc
Expand Down Expand Up @@ -507,7 +507,7 @@ if ($ENV{WEBF_JS_ENGINE} MATCHES "quickjs")
out/qjs_canvas_pattern.cc
out/qjs_path_2d.cc
out/qjs_dom_matrix.cc
out/qjs_dom_matrix_readonly.cc
out/qjs_dom_matrix_read_only.cc
out/qjs_dom_point.cc
out/qjs_dom_point_readonly.cc
out/qjs_union_double_sequencedouble.cc
Expand Down
4 changes: 2 additions & 2 deletions bridge/bindings/qjs/binding_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "qjs_document.h"
#include "qjs_document_fragment.h"
#include "qjs_dom_matrix.h"
#include "qjs_dom_matrix_readonly.h"
#include "qjs_dom_matrix_read_only.h"
#include "qjs_dom_point.h"
#include "qjs_dom_point_readonly.h"
#include "qjs_dom_string_map.h"
Expand Down Expand Up @@ -166,7 +166,7 @@ void InstallBindings(ExecutingContext* context) {
QJSCanvasPattern::Install(context);
QJSCanvasGradient::Install(context);
QJSPath2D::Install(context);
QJSDOMMatrixReadonly::Install(context);
QJSDOMMatrixReadOnly::Install(context);
QJSDOMMatrix::Install(context);
QJSDOMPointReadonly::Install(context);
QJSDOMPoint::Install(context);
Expand Down
2 changes: 1 addition & 1 deletion bridge/bindings/qjs/wrapper_type_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ enum {
JS_CLASS_CANVAS_PATTERN,
JS_CLASS_PATH_2_D,
JS_CLASS_DOM_MATRIX,
JS_CLASS_DOM_MATRIX_READONLY,
JS_CLASS_DOM_MATRIX_READ_ONLY,
JS_CLASS_DOM_POINT,
JS_CLASS_DOM_POINT_READONLY,
JS_CLASS_HTML_TEMPLATE_ELEMENT,
Expand Down
8 changes: 4 additions & 4 deletions bridge/core/geometry/dom_matrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ DOMMatrix* DOMMatrix::Create(webf::ExecutingContext* context, webf::ExceptionSta
DOMMatrix* DOMMatrix::fromMatrix(ExecutingContext* context,
DOMMatrix *matrix,
ExceptionState& exception_state) {
return DOMMatrixReadonly::fromMatrix(context, matrix ,exception_state);
return DOMMatrixReadOnly::fromMatrix(context, matrix ,exception_state);
}

DOMMatrix::DOMMatrix(webf::ExecutingContext* context, webf::ExceptionState& exception_state):
DOMMatrixReadonly(context, exception_state) {}
DOMMatrixReadOnly(context, exception_state) {}

DOMMatrix::DOMMatrix(ExecutingContext* context,
const std::vector<double>& init,
ExceptionState& exception_state)
: DOMMatrixReadonly(context, init, exception_state) {}
: DOMMatrixReadOnly(context, init, exception_state) {}

DOMMatrix::DOMMatrix(webf::ExecutingContext* context, webf::NativeBindingObject* native_binding_object): DOMMatrixReadonly(context, native_binding_object) {
DOMMatrix::DOMMatrix(webf::ExecutingContext* context, webf::NativeBindingObject* native_binding_object): DOMMatrixReadOnly(context, native_binding_object) {

}

Expand Down
2 changes: 1 addition & 1 deletion bridge/core/geometry/dom_matrix.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
interface DOMMatrix extends DOMMatrixReadonly {
interface DOMMatrix extends DOMMatrixReadOnly {
new(init?: double[]): DOMMatrix;
}
6 changes: 3 additions & 3 deletions bridge/core/geometry/dom_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#ifndef WEBF_CORE_HTML_CANVAS_DOM_MATRIX_H_
#define WEBF_CORE_HTML_CANVAS_DOM_MATRIX_H_

#include "dom_matrix_readonly.h"
#include "dom_matrix_read_only.h"

namespace webf {

class DOMMatrix : public DOMMatrixReadonly {
class DOMMatrix : public DOMMatrixReadOnly {
DEFINE_WRAPPERTYPEINFO();

public:
Expand Down Expand Up @@ -39,7 +39,7 @@ class DOMMatrix : public DOMMatrixReadonly {
};
template <>
struct DowncastTraits<DOMMatrix> {
static bool AllowFrom(const DOMMatrixReadonly& matrix) { return matrix.IsDOMMatrix(); }
static bool AllowFrom(const DOMMatrixReadOnly& matrix) { return matrix.IsDOMMatrix(); }
};

} // namespace webf
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface DOMMatrixReadonly {
interface DOMMatrixReadOnly {
readonly is2D: DartImpl<boolean>;
readonly isIdentity: DartImpl<boolean>;
m11: number;
Expand Down Expand Up @@ -45,5 +45,5 @@ interface DOMMatrixReadonly {
// fromFloat32Array(): StaticMethod<DOMMatrix>;
// fromFloat64Array(): StaticMethod<DOMMatrix>;
fromMatrix(matrix: DOMMatrix): StaticMethod<DOMMatrix>;
new(init?: number[]): DOMMatrixReadonly;
new(init?: number[]): DOMMatrixReadOnly;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ namespace webf {
class DOMMatrix;
class DOMPoint;

class DOMMatrixReadonly : public BindingObject {
class DOMMatrixReadOnly : public BindingObject {
DEFINE_WRAPPERTYPEINFO();

public:
using ImplType = DOMMatrixReadonly*;
static DOMMatrixReadonly* Create(ExecutingContext* context,
using ImplType = DOMMatrixReadOnly*;
static DOMMatrixReadOnly* Create(ExecutingContext* context,
const std::vector<double>& init,
ExceptionState& exception_state);
static DOMMatrixReadonly* Create(ExecutingContext* context,
static DOMMatrixReadOnly* Create(ExecutingContext* context,
ExceptionState& exception_state);
static DOMMatrix* fromMatrix(ExecutingContext* context, DOMMatrixReadonly* matrix, ExceptionState& exception_state);
static DOMMatrix* fromMatrix(ExecutingContext* context, DOMMatrixReadOnly* matrix, ExceptionState& exception_state);

DOMMatrixReadonly() = delete;
explicit DOMMatrixReadonly(ExecutingContext* context,
DOMMatrixReadOnly() = delete;
explicit DOMMatrixReadOnly(ExecutingContext* context,
const std::vector<double>& init,
ExceptionState& exception_state);
explicit DOMMatrixReadonly(ExecutingContext* context, ExceptionState& exception_state);
explicit DOMMatrixReadOnly(ExecutingContext* context, ExceptionState& exception_state);

virtual bool IsDOMMatrix() const { return false; }
double m11() const;
Expand Down Expand Up @@ -126,7 +126,7 @@ class DOMMatrixReadonly : public BindingObject {
const NativeValue* argv,
Dart_Handle dart_object) override;
protected:
explicit DOMMatrixReadonly(ExecutingContext* context, NativeBindingObject* native_binding_object);
explicit DOMMatrixReadOnly(ExecutingContext* context, NativeBindingObject* native_binding_object);

private:
[[nodiscard]] double getMatrixProperty(const AtomicString& prop) const;
Expand Down
4 changes: 2 additions & 2 deletions bridge/core/html/canvas/path_2d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ Path2D::Path2D(ExecutingContext* context,
CreateBindingObjectType::kCreatePath2D, arguments, 1);
}

void Path2D::addPath(Path2D* path, DOMMatrixReadonly* dom_matrix, ExceptionState& exception_state) {
void Path2D::addPath(Path2D* path, DOMMatrixReadOnly* dom_matrix, ExceptionState& exception_state) {
NativeValue arguments[] = {NativeValueConverter<NativeTypePointer<Path2D>>::ToNativeValue(path),
NativeValueConverter<NativeTypePointer<DOMMatrixReadonly>>::ToNativeValue(dom_matrix)};
NativeValueConverter<NativeTypePointer<DOMMatrixReadOnly>>::ToNativeValue(dom_matrix)};
InvokeBindingMethod(binding_call_methods::kaddPath, 2, arguments, FlushUICommandReason::kDependentsOnElement,
exception_state);
}
Expand Down
2 changes: 1 addition & 1 deletion bridge/core/html/canvas/path_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Path2D : public BindingObject {
const std::shared_ptr<QJSUnionPath2DDomString>& init,
ExceptionState& exception_state);

void addPath(Path2D* path, DOMMatrixReadonly* dom_matrix, ExceptionState& exception_state);
void addPath(Path2D* path, DOMMatrixReadOnly* dom_matrix, ExceptionState& exception_state);
void addPath(Path2D* path, ExceptionState& exception_state);

void roundRect(double x,
Expand Down
6 changes: 6 additions & 0 deletions bridge/scripts/code_generator/src/idl/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export function addIndent(str: String, space: number) {
export function getClassName(blob: IDLBlob) {
let raw = camelCase(blob.filename[4].toUpperCase() + blob.filename.slice(5));
if (raw.slice(0, 3) == 'dom') {
console.log("className:" + raw)
if (raw === 'domMatrixReadonly') {
return `DOMMatrixReadOnly`;
} else if (raw === 'domPointReadonly') {
return `DOMPointReadonly`;
}
return 'DOM' + raw.slice(3);
}
if (raw.slice(0, 4) == 'html') {
Expand Down

0 comments on commit 027ab87

Please sign in to comment.