Bug 77697 - Simplify SelectorChecker::checkSelector and checkOneSelector
Summary: Simplify SelectorChecker::checkSelector and checkOneSelector
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Roland Steiner
Depends on:
Reported: 2012-02-02 17:52 PST by Roland Steiner
Modified: 2012-02-02 21:29 PST (History)
6 users (show)

See Also:

Patch (15.29 KB, patch)
2012-02-02 18:04 PST, Roland Steiner
kling: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Steiner 2012-02-02 17:52:58 PST
These 2 methods go back and forth between element siblings a lot. Their implementation could be simplified by using Element::previous/nextElementSibling, which would also improve readability.
Comment 1 Roland Steiner 2012-02-02 18:00:16 PST
Incidentally, while looking at those functions: there are several places in the pseudo-class implementation code, where the code is allowed to break out, fall all the way through and return the default 'true' if some initial criterion is not met. Some of those cases seem questionable to me, such as with "if (!sel->parseNth())" (?).
Comment 2 Roland Steiner 2012-02-02 18:04:16 PST
Created attachment 125222 [details]
Comment 3 Andreas Kling 2012-02-02 18:14:19 PST
Comment on attachment 125222 [details]

Looks great!
Comment 4 WebKit Review Bot 2012-02-02 20:38:28 PST
Comment on attachment 125222 [details]

Rejecting attachment 125222 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
Hunk #1 succeeded at 1 with fuzz 3.
patching file Source/WebCore/css/SelectorChecker.cpp
patching file Source/WebCore/dom/Element.cpp
Hunk #1 succeeded at 1740 (offset 6 lines).
patching file Source/WebCore/dom/Element.h
Hunk #1 FAILED at 499.
1 out of 1 hunk FAILED -- saving rejects to file Source/WebCore/dom/Element.h.rej

Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--force', u'--reviewer', u'Andreas Kl..." exit_code: 1 cwd: /mnt/git/webkit-commit-queue/

Full output: http://queues.webkit.org/results/11420113
Comment 5 Roland Steiner 2012-02-02 21:29:47 PST
Committed r106626: <http://trac.webkit.org/changeset/106626>