Closed
Bug 398962
Opened 17 years ago
Closed 14 years ago
Add regular expression function for -moz-document rules
Categories
(Core :: CSS Parsing and Computation, enhancement, P4)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla6
People
(Reporter: jason.barnabe, Assigned: dbaron)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files)
19.15 KB,
patch
|
bzbarsky
:
review+
mounir
:
feedback+
|
Details | Diff | Splinter Review |
764 bytes,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
While domain, url, and url-prefix cover the majority of the cases you'd want to use -moz-document rules for, there are situations they can't cover adequately. For example, affecting URLs that end with a certain string ("/Special:RecentChanges") or URLs that have a changeable middle part ("http://example.com/users/1234/profile").
A regular expression function would cover these remaining cases.
Assignee | ||
Comment 1•17 years ago
|
||
(See also discussion in bug 423985, although nothing particularly relevant, I suppose.)
Reporter | ||
Comment 2•16 years ago
|
||
I will send $100 Canadian to anyone who can get this in for Firefox 3.1.
The problem is that Firefox doesn't have a direct regexp implementation, only a JSRegExp, but I can't find any way to access it from C++...
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → dbaron
Priority: -- → P4
Target Milestone: --- → mozilla6
Assignee | ||
Comment 4•14 years ago
|
||
http://hg.mozilla.org/users/dbaron_mozilla.com/patches/raw-file/44bf5536e765/moz-document-regexp is a patch for this that compiles, but I haven't yet tested it at all.
Assignee | ||
Comment 5•14 years ago
|
||
Attachment #528008 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 6•14 years ago
|
||
Comment on attachment 528008 [details] [diff] [review]
patch
And requesting feedback from Mounir to make sure he's ok with this method moving (unchanged) from nsHTMLInputElement to nsContentUtils.
Attachment #528008 -
Flags: feedback?(mounir.lamouri)
Assignee | ||
Updated•14 years ago
|
Keywords: dev-doc-needed
Comment 7•14 years ago
|
||
Comment on attachment 528008 [details] [diff] [review]
patch
>+ // copy before we know it's valid
Please document why (ExpectSymbol messing with mToken, I assume), and r=me.
Attachment #528008 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 8•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 9•14 years ago
|
||
I am SO excited to see this get implemented. It's going to bring so much extra power to userstyles! Thank you Mozilla.
Comment 10•14 years ago
|
||
Documentation updated:
https://developer.mozilla.org/index.php?title=en/CSS/%40-moz-document
And mentioned on Firefox 6 for developers.
Keywords: dev-doc-needed → dev-doc-complete
Comment 11•14 years ago
|
||
Comment on attachment 528008 [details] [diff] [review]
patch
I'm happy to see this code moving to nsContentUtils.
And I'm sorry that the feedback took so long. I'm abroad for the week for a community event and it's hard to get a good internet connectivity. Though I see the patch has been landed so it didn't block anything ;)
Attachment #528008 -
Flags: feedback?(mounir.lamouri) → feedback+
Assignee | ||
Comment 12•14 years ago
|
||
Added one additional test:
https://hg.mozilla.org/mozilla-central/rev/278fd4966ed0
Reporter | ||
Comment 13•13 years ago
|
||
It looks to me like you need to enclose the regexp in a single or double quote (unlike url, url-prefix, and domain). Just want to make sure that that was intended.
Also, missing a "break;" here?
diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -942,16 +942,18 @@ DocumentRule::List(FILE* out, PRInt32 aI
case eURL:
str.AppendLiteral("url(\"");
break;
case eURLPrefix:
str.AppendLiteral("url-prefix(\"");
break;
case eDomain:
str.AppendLiteral("domain(\"");
+ case eRegExp:
+ str.AppendLiteral("regexp(\"");
break;
}
Assignee | ||
Comment 14•13 years ago
|
||
I should add a general test for rule parse+serialize idempotence that would catch this...
Attachment #537322 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 15•13 years ago
|
||
Yes, requiring quotes was intended.
Comment 16•13 years ago
|
||
Comment on attachment 537322 [details] [diff] [review]
add missing break
r=me
Attachment #537322 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 17•13 years ago
|
||
Added missing break:
https://hg.mozilla.org/mozilla-central/rev/ddc73a8ae402
and added a test that would have caught if that were in the non-DEBUG function:
https://hg.mozilla.org/mozilla-central/rev/6772105ec426
You need to log in
before you can comment on or make changes to this bug.
Description
•