The default bug view has changed. See this FAQ.

Clean up character lookup in nsCSSScanner

RESOLVED FIXED

Status

()

Core
CSS Parsing and Computation
RESOLVED FIXED
10 years ago
9 years ago

People

(Reporter: Eli Friedman, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
Created attachment 278002 [details] [diff] [review]
Patch
(Reporter)

Comment 1

10 years ago
Comment on attachment 278002 [details] [diff] [review]
Patch

This patch cleans up all the scattered checks for character types by adding a centralized set of inline helpers.  I think this makes the code a lot more readable compared to the scattered checks against 255/256 and various bit comparisons.  

Also a couple minor bug fixes to correctly classify \v as non-whitespace and make dimensions with a unit starting with a hyphen work correctly.  I'll make sure to update my parser tests to test those fixes.
Attachment #278002 - Attachment is patch: true
Attachment #278002 - Flags: review?(bzbarsky)
(Reporter)

Comment 2

10 years ago
You can ignore the change to the "// From this point on, 0 <= ch < 256." comment.  That was part of some changes I subsequently realized were incorrect.
Comment on attachment 278002 [details] [diff] [review]
Patch

>Index: nsCSSScanner.cpp

>-  // From this point on, 0 <= ch < 256.

The point of that comment was that the bounds checks need not be performed when accessing the lextable.  But since the new code always performs them, is the comment relevant at all now?

r=bzbarsky, but please have dbaron sr.  He might have had reasons for the local vars, etc.
Attachment #278002 - Flags: review?(bzbarsky) → review+
(Reporter)

Updated

10 years ago
Attachment #278002 - Flags: superreview?(dbaron)
Comment on attachment 278002 [details] [diff] [review]
Patch

sr+a1.9=dbaron.  I'd say remove the comment;   Compilers should be able to optimize global variable access properly, so I don't think the local variables are needed.  I'm a little more worried about them optimizing the bitfield stuff (and the bounds checks), but there's only one occurrence of that (the bitfield combination, anyway).
Attachment #278002 - Flags: superreview?(dbaron)
Attachment #278002 - Flags: superreview+
Attachment #278002 - Flags: approval1.9+
(Reporter)

Comment 5

10 years ago
Checked in.
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.