Closed Bug 393499 Opened 17 years ago Closed 17 years ago

Clean up character lookup in nsCSSScanner

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sharparrow1, Unassigned)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
      No description provided.
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)
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+
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+
Checked in.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: