Title: [260951] trunk/Source/WebCore
- Revision
- 260951
- Author
- ctur...@igalia.com
- Date
- 2020-04-30 08:12:36 -0700 (Thu, 30 Apr 2020)
Log Message
[clang 11] fix build errors due to -WWc++11-narrowing
https://bugs.webkit.org/show_bug.cgi?id=211193
Reviewed by Adrian Perez de Castro.
Fixes the following errors,
Source/WebCore/html/MediaElementSession.cpp:1059:9: error: type 'WebCore::RenderMedia *' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing]
m_element.renderer(),
^~~~~~~~~~~~~~~~~~~~
Source/WebCore/style/StyleResolver.cpp:106:55: error: type 'const char [4]' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing]
m_mediaQueryEvaluator = MediaQueryEvaluator { "all" };
^~~~~
Source/WebCore/style/StyleResolver.cpp:106:55: note: insert an explicit cast to silence this issue
m_mediaQueryEvaluator = MediaQueryEvaluator { "all" };
^~~~~
static_cast<bool>( )
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::hasRenderer const):
MediaElementSession was implicitly casting a pointer to a bool,
which is not allowed with modern Clang checks. Add a helper method
to encapsulate the now required static_cast<bool>.
* html/MediaElementSession.cpp: Use the new helper method to see
if the HTMLMediaElement has an associated renderer.
(WebCore::MediaElementSession::updateMediaUsageIfChanged):
* style/StyleResolver.cpp: This was calling MediaQueryEvaluator {
"all" }; and seemingly expecting to cast a const char[] to a bool,
or maybe String? It's confusing because of the MediaQueryEvaluator
API. If it was implicitly converting to bool then that could be
unintentional. Such casts are not allowed either now. The
MediaQueryEvaluator's default constructor says it returns true for
"all", which appears to be the original intent of this call, so I
replaced it with that.
(WebCore::Style::Resolver::Resolver):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260950 => 260951)
--- trunk/Source/WebCore/ChangeLog 2020-04-30 14:39:02 UTC (rev 260950)
+++ trunk/Source/WebCore/ChangeLog 2020-04-30 15:12:36 UTC (rev 260951)
@@ -1,3 +1,42 @@
+2020-04-30 Charlie Turner <ctur...@igalia.com>
+
+ [clang 11] fix build errors due to -WWc++11-narrowing
+ https://bugs.webkit.org/show_bug.cgi?id=211193
+
+ Reviewed by Adrian Perez de Castro.
+
+ Fixes the following errors,
+
+ Source/WebCore/html/MediaElementSession.cpp:1059:9: error: type 'WebCore::RenderMedia *' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing]
+ m_element.renderer(),
+ ^~~~~~~~~~~~~~~~~~~~
+
+ Source/WebCore/style/StyleResolver.cpp:106:55: error: type 'const char [4]' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing]
+ m_mediaQueryEvaluator = MediaQueryEvaluator { "all" };
+ ^~~~~
+ Source/WebCore/style/StyleResolver.cpp:106:55: note: insert an explicit cast to silence this issue
+ m_mediaQueryEvaluator = MediaQueryEvaluator { "all" };
+ ^~~~~
+ static_cast<bool>( )
+
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::hasRenderer const):
+ MediaElementSession was implicitly casting a pointer to a bool,
+ which is not allowed with modern Clang checks. Add a helper method
+ to encapsulate the now required static_cast<bool>.
+ * html/MediaElementSession.cpp: Use the new helper method to see
+ if the HTMLMediaElement has an associated renderer.
+ (WebCore::MediaElementSession::updateMediaUsageIfChanged):
+ * style/StyleResolver.cpp: This was calling MediaQueryEvaluator {
+ "all" }; and seemingly expecting to cast a const char[] to a bool,
+ or maybe String? It's confusing because of the MediaQueryEvaluator
+ API. If it was implicitly converting to bool then that could be
+ unintentional. Such casts are not allowed either now. The
+ MediaQueryEvaluator's default constructor says it returns true for
+ "all", which appears to be the original intent of this call, so I
+ replaced it with that.
+ (WebCore::Style::Resolver::Resolver):
+
2020-04-30 Simon Fraser <simon.fra...@apple.com>
border-radius fails to clip iframe contents
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (260950 => 260951)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2020-04-30 14:39:02 UTC (rev 260950)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2020-04-30 15:12:36 UTC (rev 260951)
@@ -155,6 +155,7 @@
virtual bool isVideo() const { return false; }
bool hasVideo() const override { return false; }
bool hasAudio() const override;
+ bool hasRenderer() const { return static_cast<bool>(renderer()); }
static HashSet<HTMLMediaElement*>& allMediaElements();
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (260950 => 260951)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2020-04-30 14:39:02 UTC (rev 260950)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2020-04-30 15:12:36 UTC (rev 260951)
@@ -1056,7 +1056,7 @@
isAudio,
m_element.hasVideo(),
m_element.hasAudio(),
- m_element.renderer(),
+ m_element.hasRenderer(),
isAudio && hasBehaviorRestriction(RequireUserGestureToControlControlsManager) && !processingUserGesture,
m_element.hasAudio() && isPlaying && allowsPlaybackControlsForAutoplayingAudio(), // userHasPlayedAudioBefore
isElementRectMostlyInMainFrame(m_element),
Modified: trunk/Source/WebCore/style/StyleResolver.cpp (260950 => 260951)
--- trunk/Source/WebCore/style/StyleResolver.cpp 2020-04-30 14:39:02 UTC (rev 260950)
+++ trunk/Source/WebCore/style/StyleResolver.cpp 2020-04-30 15:12:36 UTC (rev 260951)
@@ -103,7 +103,7 @@
if (view)
m_mediaQueryEvaluator = MediaQueryEvaluator { view->mediaType() };
else
- m_mediaQueryEvaluator = MediaQueryEvaluator { "all" };
+ m_mediaQueryEvaluator = MediaQueryEvaluator { };
if (root) {
m_rootDefaultStyle = styleForElement(*root, m_document.renderStyle(), nullptr, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes