mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Apply suggestions from code review
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
This commit is contained in:
@@ -357,7 +357,7 @@ pub fn computeSpecificity(selector: Selector.Selector) u32 {
|
|||||||
|
|
||||||
// Pack into single u32: (ids << 20) | (classes << 10) | elements
|
// Pack into single u32: (ids << 20) | (classes << 10) | elements
|
||||||
// This gives us 10 bits each, supporting up to 1023 of each type
|
// This gives us 10 bits each, supporting up to 1023 of each type
|
||||||
return (ids << 20) | (classes << 10) | elements;
|
return (@min(ids, 1023) << 20) | (@min(classes, 1023) << 10) | @min(elements, 1023);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn countCompoundSpecificity(compound: Selector.Compound, ids: *u32, classes: *u32, elements: *u32) void {
|
fn countCompoundSpecificity(compound: Selector.Compound, ids: *u32, classes: *u32, elements: *u32) void {
|
||||||
@@ -379,6 +379,7 @@ fn countCompoundSpecificity(compound: Selector.Compound, ids: *u32, classes: *u3
|
|||||||
const spec = computeSpecificity(nested_sel);
|
const spec = computeSpecificity(nested_sel);
|
||||||
if (spec > max_nested) max_nested = spec;
|
if (spec > max_nested) max_nested = spec;
|
||||||
}
|
}
|
||||||
|
max_nested = @min(max_nested, 1023);
|
||||||
// Unpack and add to our counts
|
// Unpack and add to our counts
|
||||||
ids.* += (max_nested >> 20) & 0x3FF;
|
ids.* += (max_nested >> 20) & 0x3FF;
|
||||||
classes.* += (max_nested >> 10) & 0x3FF;
|
classes.* += (max_nested >> 10) & 0x3FF;
|
||||||
|
|||||||
Reference in New Issue
Block a user