Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2b50887
feat: support interactive pseudo-classes with dart & add unit tests
jwxbond Feb 7, 2026
f8cb38b
fix(css-selector): pseudo class, checkbox align center
jwxbond Feb 7, 2026
f12ed8b
feat: support pseduo class
jwxbond Feb 8, 2026
3dbba1c
feat: set enableBlink false as default
jwxbond Feb 11, 2026
6e18919
fix: input checked style and checked in IFC
jwxbond Feb 13, 2026
73c6c2a
fix: inline background painting to honor border-radius for inline spans
jwxbond Feb 13, 2026
a4394f7
fix: update border-radius snapshots
jwxbond Feb 13, 2026
57ebd11
fix: input placeholder color
jwxbond Feb 13, 2026
8bf6419
feat: support focusable of element
jwxbond Feb 14, 2026
9a2d7a2
fix: div focus and blur
jwxbond Feb 14, 2026
4f87863
fix: set FontSize and LineHeight default style
jwxbond Feb 23, 2026
0f6354e
feat: update pseudo-focus-visible snapshot
jwxbond Mar 1, 2026
4ef338e
feat: support Select element
jwxbond Mar 1, 2026
6862eac
feat: update select snapshot
jwxbond Mar 1, 2026
0fed00f
feat: update focus snapshot
jwxbond Mar 1, 2026
d816938
fix: element hover style
jwxbond Mar 1, 2026
6901f66
fix: disabled:invalid style
jwxbond Mar 1, 2026
39bb623
fix: pseudo-vaild-invalid.ts
jwxbond Mar 1, 2026
43f6ccd
feat: update required-optionsal snapshot
jwxbond Mar 1, 2026
8fc4f7a
fix: support select group label
jwxbond Mar 1, 2026
14f2c9c
feat: update snapshots
jwxbond Mar 1, 2026
dfb2b35
fix: pseudo-enabled-disabled snapshots
jwxbond Mar 1, 2026
1572e3b
feat: update polyfill
jwxbond Mar 6, 2026
fb56833
feat: update element default style snapshot
jwxbond Mar 6, 2026
e4f2db3
feat: update text snapshot
jwxbond Mar 6, 2026
0f224e9
fix: button default layout sytle
jwxbond Mar 7, 2026
9082eee
fix: button enable and disable default style
jwxbond Mar 7, 2026
26c4caa
fix: select layout
jwxbond Mar 7, 2026
5887ecd
fix: accept integer tags by converting them to double
jwxbond Mar 7, 2026
7b59a22
feat: update text-comprehensive snapshots
jwxbond Mar 7, 2026
33511b8
fix: select width
jwxbond Mar 7, 2026
aa71d9e
feat: select default styles and update button & select snapshots
jwxbond Mar 7, 2026
09afdef
fix: update text snpashots
jwxbond Mar 7, 2026
614b999
fix: comply with specification
jwxbond Mar 7, 2026
cfc7181
fix: recover snapshot dealy
jwxbond Mar 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bridge/core/binding_call_methods.json5
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"required",
"readonly",
"placeholder",
"tabIndex",
"inputMode",
"cols",
"rows",
Expand Down
33,194 changes: 16,604 additions & 16,590 deletions bridge/core/bridge_polyfill.c

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions bridge/core/dom/element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,42 @@ bool Element::IsDisabledFormControl() const {
return false;
}

bool Element::IsCheckedState() const {
// When Blink CSS is enabled, checked_state_ only tracks attribute mutations.
// For widget-backed inputs, checkedness can change from Dart-side interaction
// without attribute changes. Pull the current property from Dart to keep
// :checked matching aligned with the actual checkedness.
if (GetExecutingContext()->isBlinkEnabled() && IsWidgetElement()) {
ExceptionState exception_state;
NativeValue result =
GetBindingProperty(CheckedAttrName(), FlushUICommandReason::kDependentsOnElement, exception_state);
if (!exception_state.HasException()) {
bool checked = NativeValueConverter<NativeTypeBool>::FromNativeValue(result);
const_cast<Element*>(this)->checked_state_ = checked;
return checked;
}
}
return checked_state_;
}

void Element::SetCheckedStateFromDart(bool checked) {
if (checked_state_ == checked) {
return;
}
checked_state_ = checked;
if (!GetExecutingContext()->isBlinkEnabled()) {
return;
}

// Trigger style invalidation for :checked dependent selectors in Blink mode.
GetDocument().EnsureStyleEngine().SetNeedsHasPseudoStateRecalc();
if (Element* root = GetDocument().documentElement()) {
root->SetNeedsStyleRecalc(kSubtreeStyleChange,
StyleChangeReasonForTracing::FromAttribute(QualifiedName(CheckedAttrName())));
}
GetDocument().UpdateStyleForThisDocument();
}

bool Element::MatchesValidityPseudoClasses() const {
const AtomicString tag_name = localName();
if (tag_name.IsNull()) {
Expand Down
16 changes: 9 additions & 7 deletions bridge/core/dom/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ class Element : public ContainerNode {
bool MatchesReadWritePseudoClass() const { return false; }
bool IsOptionalFormControl() const;
bool IsRequiredFormControl() const;
bool MatchesValidityPseudoClasses() const;
bool IsValidElement() const;
bool IsCheckedState() const { return checked_state_; }
bool MatchesValidityPseudoClasses() const;
bool IsValidElement() const;
bool IsCheckedState() const;

// Additional methods for selector matching
bool ContainsPersistentVideo() const { return false; }
Expand All @@ -375,10 +375,12 @@ class Element : public ContainerNode {

// add for invalidation end
protected:
void SetAttributeInternal(const AtomicString&,
const AtomicString& value,
AttributeModificationReason reason,
ExceptionState& exception_state);
void SetAttributeInternal(const AtomicString&,
const AtomicString& value,
AttributeModificationReason reason,
ExceptionState& exception_state);

void SetCheckedStateFromDart(bool checked);

void DetachAllAttrNodesFromElement();

Expand Down
24 changes: 24 additions & 0 deletions bridge/core/html/forms/html_input_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,35 @@
* Copyright (C) 2022-present The WebF authors. All rights reserved.
*/
#include "html_input_element.h"
#include "bindings/qjs/cppgc/mutation_scope.h"
#include "foundation/native_value_converter.h"
#include "html_names.h"
#include "qjs_html_input_element.h"

namespace webf {

HTMLInputElement::HTMLInputElement(Document& document) : WidgetElement(html_names::kInput, &document) {}

NativeValue HTMLInputElement::HandleCallFromDartSide(const AtomicString& method,
int32_t argc,
const NativeValue* argv,
Dart_Handle dart_object) {
if (!isContextValid(contextId())) {
return Native_NewNull();
}
MemberMutationScope mutation_scope{GetExecutingContext()};

static const AtomicString kSyncChecked = AtomicString::CreateFromUTF8("__syncCheckedState");
if (method == kSyncChecked) {
if (argc < 1) {
return Native_NewNull();
}
const bool checked = NativeValueConverter<NativeTypeBool>::FromNativeValue(argv[0]);
SetCheckedStateFromDart(checked);
return Native_NewNull();
}

return WidgetElement::HandleCallFromDartSide(method, argc, argv, dart_object);
}

} // namespace webf
6 changes: 5 additions & 1 deletion bridge/core/html/forms/html_input_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
namespace webf {

class HTMLInputElement : public WidgetElement {
DEFINE_WRAPPERTYPEINFO();
DEFINE_WRAPPERTYPEINFO();

public:
explicit HTMLInputElement(Document&);
NativeValue HandleCallFromDartSide(const AtomicString& method,
int32_t argc,
const NativeValue* argv,
Dart_Handle dart_object) override;
};

} // namespace webf
Expand Down
5 changes: 5 additions & 0 deletions bridge/core/html/html_element.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export interface HTMLElement extends Element, GlobalEventHandlers {
readonly offsetWidth: SupportAsync<DartImpl<DependentsOnLayout<double>>>;
readonly offsetHeight: SupportAsync<DartImpl<DependentsOnLayout<double>>>;

tabIndex: DartImpl<number>;

focus(): DartImpl<void>;
blur(): DartImpl<void>;

click(): DartImpl<DependentsOnLayout<void>>;

new(): void;
Expand Down
4 changes: 3 additions & 1 deletion bridge/foundation/native_value_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ struct NativeValueConverter<NativeTypeDouble> : public NativeValueConverterBase<
if (value.tag == NativeTag::TAG_NULL) {
return 0.0;
}

if (value.tag == NativeTag::TAG_INT) {
return static_cast<double>(value.u.int64);
}
assert(value.tag == NativeTag::TAG_FLOAT64);
double result;
memcpy(&result, reinterpret_cast<void*>(&value.u.int64), sizeof(double));
Expand Down
12 changes: 8 additions & 4 deletions bridge/polyfill/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ document.hasFocus = function () {
return true;
}

globalThis.HTMLElement.prototype.focus = function () {
// No-op for now.
if (typeof globalThis.HTMLElement.prototype.focus !== 'function') {
globalThis.HTMLElement.prototype.focus = function () {
// No-op for now.
}
}

globalThis.HTMLElement.prototype.blur = function () {
// No-op for now.
if (typeof globalThis.HTMLElement.prototype.blur !== 'function') {
globalThis.HTMLElement.prototype.blur = function () {
// No-op for now.
}
}

class ShadowRoot {
Expand Down
Loading
Loading