Prevent further uses of old downcast helpers
Type casting related functions like IsHTMLXXXXElement,
ToHTMLXXXXElement, and ToHTMLXXXXElementOrNull are being phased out in
favor of new downcast helpers in t_p/blink/renderer/platform/casting.h.
There is still a long run to fully remove old type casting mechanism,
but this CL aims at preventing new uses to take place.
Bug: 891908
Change-Id: I6a079b9524d2e94805528bdcf17baaa66fe091da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879628
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Abhijeet Kandalkar <[email protected]>
Cr-Commit-Position: refs/heads/master@{#710345}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index a2e82e32..217e266 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1075,6 +1075,33 @@
),
),
(
+ r'/\bIsHTML.+Element\(\b',
+ (
+ 'Function IsHTMLXXXXElement is deprecated. Instead, use downcast ',
+ ' helpers IsA<HTMLXXXXElement> from ',
+ '//third_party/blink/renderer/platform/casting.h.'
+ ),
+ False,
+ (
+ r'^third_party/blink/renderer/.*\.(cc|h)$',
+ ),
+ ),
+ (
+ r'/\bToHTML.+Element(|OrNull)\(\b',
+ (
+ 'Function ToHTMLXXXXElement and ToHTMLXXXXElementOrNull are '
+ 'deprecated. Instead, use downcast helpers To<HTMLXXXXElement> '
+ 'and DynamicTo<HTMLXXXXElement> from ',
+ '//third_party/blink/renderer/platform/casting.h.'
+ 'auto* html_xxxx_ele = To<HTMLXXXXElement>(n)'
+ 'auto* html_xxxx_ele_or_null = DynamicTo<HTMLXXXXElement>(n)'
+ ),
+ False,
+ (
+ r'^third_party/blink/renderer/.*\.(cc|h)$',
+ ),
+ ),
+ (
r'/\bmojo::DataPipe\b',
(
'mojo::DataPipe is deprecated. Use mojo::CreateDataPipe instead.',