WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
78140
Add toText and isTextNode helpers in Text class
https://bugs.webkit.org/show_bug.cgi?id=78140
Summary
Add toText and isTextNode helpers in Text class
Abhishek Arya
Reported
2012-02-08 12:28:45 PST
in WebKit/Source/WebCore/dom/Text.h, toText is needed to shorten static_cast<Text>* and also detect bad cast using isTextNode
Attachments
ProposedPatch
(47.92 KB, patch)
2012-02-11 01:05 PST
,
Joe Thomas
no flags
Details
Formatted Diff
Diff
Patch-with-StyleChecker
(49.54 KB, patch)
2012-02-11 21:29 PST
,
Joe Thomas
no flags
Details
Formatted Diff
Diff
UnitTestCase-StyleChecker
(1.65 KB, patch)
2012-02-12 17:35 PST
,
Joe Thomas
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Joe Thomas
Comment 1
2012-02-11 01:05:00 PST
Created
attachment 126623
[details]
ProposedPatch
Adam Barth
Comment 2
2012-02-11 10:16:00 PST
Comment on
attachment 126623
[details]
ProposedPatch Consider adding a style checker rule to remind folks to use toText rather than static_cast<Text*>
Joe Thomas
Comment 3
2012-02-11 12:02:04 PST
(In reply to
comment #2
)
> (From update of
attachment 126623
[details]
) > Consider adding a style checker rule to remind folks to use toText rather than static_cast<Text*>
Checked Tools/Scripts/webkitpy/style/, but did not get much idea how to do this. :(
Joe Thomas
Comment 4
2012-02-11 21:28:21 PST
(In reply to
comment #3
)
> (In reply to
comment #2
) > > (From update of
attachment 126623
[details]
[details]) > > Consider adding a style checker rule to remind folks to use toText rather than static_cast<Text*> > > Checked Tools/Scripts/webkitpy/style/, but did not get much idea how to do this. :(
I was trying to report the style check error with one of the error category mentioned in BASE_FILTER_RULES in Tools/Scripts/webkitpy/style/checker.py. As far as I understand, errors reported with this list is ignored.
Joe Thomas
Comment 5
2012-02-11 21:29:14 PST
Created
attachment 126670
[details]
Patch-with-StyleChecker Added style checker.
WebKit Review Bot
Comment 6
2012-02-11 21:31:21 PST
Attachment 126670
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/dom/Text.h:76: Consider using toText helper function in WebCore/dom/Text.h instead of static_cast<Text*> [readability/check] [4] Total errors found: 1 in 37 files If any of these errors are false positives, please file a bug against check-webkit-style.
Joe Thomas
Comment 7
2012-02-11 22:53:11 PST
(In reply to
comment #6
)
>
Attachment 126670
[details]
did not pass style-queue: > > Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 > > Source/WebCore/dom/Text.h:76: Consider using toText helper function in WebCore/dom/Text.h instead of static_cast<Text*> [readability/check] [4] > Total errors found: 1 in 37 files
This error is expected as it is caused by the new style-checker added in this patch.
Adam Barth
Comment 8
2012-02-12 01:36:38 PST
Comment on
attachment 126670
[details]
Patch-with-StyleChecker Oh, I meant to make the style checker change in a separate patch, but this seems fine too.
WebKit Review Bot
Comment 9
2012-02-12 03:28:13 PST
Comment on
attachment 126670
[details]
Patch-with-StyleChecker Clearing flags on attachment: 126670 Committed
r107509
: <
http://trac.webkit.org/changeset/107509
>
David Levin
Comment 10
2012-02-12 13:45:02 PST
It looks like there wasn't a unit test for the style checker change. Please add one -- otherwise it may break at anytime due to people changing the code and no one will know!
Joe Thomas
Comment 11
2012-02-12 14:13:14 PST
(In reply to
comment #10
)
> It looks like there wasn't a unit test for the style checker change. > > Please add one -- otherwise it may break at anytime due to people changing the code and no one will know!
Sure I will add the unit test case. I did not know that there is a unit test suite for style checker. What is the script used for running the unit test?
David Levin
Comment 12
2012-02-12 14:14:57 PST
(In reply to
comment #11
)
> (In reply to
comment #10
) > > It looks like there wasn't a unit test for the style checker change. > > > > Please add one -- otherwise it may break at anytime due to people changing the code and no one will know! > > Sure I will add the unit test case. I did not know that there is a unit test suite for style checker. What is the script used for running the unit test?
Here's a sample change:
http://trac.webkit.org/changeset/105652
Joe Thomas
Comment 13
2012-02-12 17:35:29 PST
Created
attachment 126692
[details]
UnitTestCase-StyleChecker Added the unit test case for the style checker introduced in the previous commit for this bug
Adam Barth
Comment 14
2012-02-12 17:49:25 PST
Comment on
attachment 126692
[details]
UnitTestCase-StyleChecker View in context:
https://bugs.webkit.org/attachment.cgi?id=126692&action=review
> Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:762 > + # Test for static_cast readability.
This comment doesn't seem to be adding any value. It's redundant with the function name.
WebKit Review Bot
Comment 15
2012-02-12 19:18:08 PST
Comment on
attachment 126692
[details]
UnitTestCase-StyleChecker Clearing flags on attachment: 126692 Committed
r107522
: <
http://trac.webkit.org/changeset/107522
>
WebKit Review Bot
Comment 16
2012-02-12 19:18:15 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug