Skip to content

Commit 9d1eb33

Browse files
committed
feat: revert bridge style attribute
1 parent 7a293fc commit 9d1eb33

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

bridge/bindings/qjs/dom/element.cc

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -427,17 +427,6 @@ IMPL_PROPERTY_SETTER(Element, className)(JSContext* ctx, JSValue this_val, int a
427427
return JS_DupValue(ctx, value);
428428
}
429429

430-
IMPL_PROPERTY_GETTER(Element, style)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
431-
getDartMethod()->flushUICommand();
432-
return getAttribute(ctx, this_val, argc, argv);
433-
}
434-
435-
IMPL_PROPERTY_SETTER(Element, style)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
436-
JSValue value = argv[0];
437-
JSValue args[] = {JS_NewString(ctx, "style"), value};
438-
return setAttribute(ctx, this_val, 2, args);
439-
}
440-
441430
IMPL_PROPERTY_GETTER(Element, offsetLeft)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) {
442431
auto* element = static_cast<ElementInstance*>(JS_GetOpaque(this_val, Element::classId()));
443432
return element->getBindingProperty("offsetLeft");
@@ -855,7 +844,7 @@ ElementInstance::ElementInstance(Element* element, std::string tagName, bool sho
855844
JSValue style = JS_CallConstructor(m_ctx, CSSStyleDeclaration::instance(m_context)->jsObject, 1, arguments);
856845
m_style = static_cast<StyleDeclarationInstance*>(JS_GetOpaque(style, CSSStyleDeclaration::kCSSStyleDeclarationClassId));
857846

858-
JS_DefinePropertyValueStr(m_ctx, jsObject, "styleDeclaration", m_style->jsObject, JS_PROP_C_W_E);
847+
JS_DefinePropertyValueStr(m_ctx, jsObject, "style", m_style->jsObject, JS_PROP_C_W_E);
859848

860849
if (shouldAddUICommand) {
861850
std::unique_ptr<NativeString> args_01 = stringToNativeString(tagName);
@@ -865,7 +854,7 @@ ElementInstance::ElementInstance(Element* element, std::string tagName, bool sho
865854

866855
JSClassExoticMethods ElementInstance::exoticMethods{nullptr, nullptr, nullptr, nullptr, hasProperty, getProperty, setProperty};
867856

868-
StyleDeclarationInstance* ElementInstance::styleDeclaration() {
857+
StyleDeclarationInstance* ElementInstance::style() {
869858
return m_style;
870859
}
871860

bridge/bindings/qjs/dom/element.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ class Element : public Node {
112112
DEFINE_PROTOTYPE_READONLY_PROPERTY(children);
113113
DEFINE_PROTOTYPE_READONLY_PROPERTY(attributes);
114114

115-
DEFINE_PROTOTYPE_PROPERTY(style);
116115
DEFINE_PROTOTYPE_PROPERTY(className);
117116
DEFINE_PROTOTYPE_PROPERTY(innerHTML);
118117
DEFINE_PROTOTYPE_PROPERTY(outerHTML);
@@ -150,7 +149,7 @@ class ElementInstance : public NodeInstance {
150149
std::string getRegisteredTagName();
151150
std::string outerHTML();
152151
std::string innerHTML();
153-
StyleDeclarationInstance* styleDeclaration();
152+
StyleDeclarationInstance* style();
154153

155154
static inline JSClassID classID();
156155

bridge/bindings/qjs/html_parser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void HTMLParser::parseProperty(ElementInstance* element, GumboElement* gumboElem
154154
}
155155
arrStyles.push_back(strStyles.substr(prev_pos, pos - prev_pos));
156156

157-
auto* style = element->styleDeclaration();
157+
auto* style = element->style();
158158

159159
for (auto& s : arrStyles) {
160160
std::string::size_type position = s.find(':');

0 commit comments

Comments
 (0)