[Webkit-unassigned] [Bug 6248] CSS3: implement nth-* selectors (Acid3 bug)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jan 11 18:43:04 PST 2008
http://bugs.webkit.org/show_bug.cgi?id=6248
------- Comment #26 from darin at apple.com 2008-01-11 18:43 PDT -------
(From update of attachment 18347)
There's a double ChangeLog in this patch.
+// a helper function for checking nth-arguments
+static bool matchNth(int count, int a, int b)
+{
+ if (!a)
+ return count == b;
+ else if (a > 0) {
+ if (count < b)
+ return false;
+ return (count - b) % a == 0;
+ } else {
+ if (count > b)
+ return false;
+ return (b - count) % (-a) == 0;
+ }
+}
We normally don't do else after return.
+ Node* n = e->previousSibling();
+ while (n) {
+ if (n->isElementNode())
+ count++;
+ n = n->previousSibling();
+ }
This would be easier to read as a for loop.
+ Node* n = e->previousSibling();
+ while (n) {
+ if (n->isElementNode() &&
static_cast<Element*>(n)->tagName() == type)
+ count++;
+ n = n->previousSibling();
+ }
And this too.
But why is it good to have a static-only version of these? Can't we implement
the real thing?
--
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list