Skip to content

Commit

Permalink
Revert "Merge pull request #654 from cortex-engine/master"
Browse files Browse the repository at this point in the history
This reverts commit 5039134, reversing
changes made to db51e28.
  • Loading branch information
ianharrigan committed Nov 22, 2024
1 parent 6477808 commit c95480d
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions haxe/ui/styles/elements/RuleElement.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,7 @@ class RuleElement {
}

public function match(d:Component):Bool {
var res = 0;
for (s in selector.parts) {
res += ruleMatch(s, d) ? 1 : 0;
if (s.parent != null && d.parentComponent != null)
if (s.direct == true)
res += ruleMatch(s.parent, d.parentComponent) ? 1 : 0;
else {
var p = d.parentComponent;
while (p != null) {
if (ruleMatch(s.parent, p)) {
res++;
break;
}
p = p.parentComponent;
}
}
}
return res == selector.parts.length;
return ruleMatch(selector.parts[selector.parts.length - 1], d);
}

private static function ruleMatch( c : SelectorPart, d : Component ):Bool {
Expand Down Expand Up @@ -76,6 +59,29 @@ class RuleElement {
}
}

if (c.parent != null) {
if (c.direct == true) {
var p = d.parentComponent;
if (p == null) {
return false;
}
if (!ruleMatch(c.parent, p)) {
return false;
}
} else {
var p = d.parentComponent;
while (p != null) {
if (ruleMatch(c.parent, p)) {
break;
}
p = p.parentComponent;
}
if (p == null) {
return false;
}
}
}

return true;
}

Expand Down

0 comments on commit c95480d

Please sign in to comment.