Title: [232001] trunk/Source/WebCore
- Revision
- 232001
- Author
- [email protected]
- Date
- 2018-05-19 16:07:38 -0700 (Sat, 19 May 2018)
Log Message
Improve NowPlaying "title"
https://bugs.webkit.org/show_bug.cgi?id=185680
<rdar://problem/40296700>
Reviewed by Dean Jackson.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaSessionTitle const): Use decodeHostName and
topPrivatelyControlledDomain when possible to make the host name more readable.
* platform/PublicSuffix.h:
* platform/mac/PublicSuffixMac.mm:
(WebCore::decodeHostName): Expose topPrivatelyControlledDomain method to .cpp functions.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (232000 => 232001)
--- trunk/Source/WebCore/ChangeLog 2018-05-19 22:00:21 UTC (rev 232000)
+++ trunk/Source/WebCore/ChangeLog 2018-05-19 23:07:38 UTC (rev 232001)
@@ -1,3 +1,19 @@
+2018-05-19 Eric Carlson <[email protected]>
+
+ Improve NowPlaying "title"
+ https://bugs.webkit.org/show_bug.cgi?id=185680
+ <rdar://problem/40296700>
+
+ Reviewed by Dean Jackson.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaSessionTitle const): Use decodeHostName and
+ topPrivatelyControlledDomain when possible to make the host name more readable.
+
+ * platform/PublicSuffix.h:
+ * platform/mac/PublicSuffixMac.mm:
+ (WebCore::decodeHostName): Expose topPrivatelyControlledDomain method to .cpp functions.
+
2018-05-19 Commit Queue <[email protected]>
Unreviewed, rolling out r231996.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (232000 => 232001)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2018-05-19 22:00:21 UTC (rev 232000)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2018-05-19 23:07:38 UTC (rev 232001)
@@ -72,6 +72,7 @@
#include "PageGroup.h"
#include "PlatformMediaSessionManager.h"
#include "ProgressTracker.h"
+#include "PublicSuffix.h"
#include "RenderLayerCompositor.h"
#include "RenderTheme.h"
#include "RenderVideo.h"
@@ -7452,17 +7453,28 @@
if (!document().page() || document().page()->usesEphemeralSession())
return emptyString();
- if (hasAttributeWithoutSynchronization(titleAttr)) {
- auto title = attributeWithoutSynchronization(titleAttr);
- if (!title.isEmpty())
- return title;
- }
+ auto title = String(attributeWithoutSynchronization(titleAttr)).stripWhiteSpace().simplifyWhiteSpace();
+ if (!title.isEmpty())
+ return title;
- auto title = document().title();
+ title = document().title().stripWhiteSpace().simplifyWhiteSpace();
if (!title.isEmpty())
return title;
- return m_currentSrc.host();
+ title = m_currentSrc.host();
+#if PLATFORM(MAC) || PLATFORM(IOS)
+ if (!title.isEmpty())
+ title = decodeHostName(title);
+#endif
+#if ENABLE(PUBLIC_SUFFIX_LIST)
+ if (!title.isEmpty()) {
+ auto domain = topPrivatelyControlledDomain(title);
+ if (!domain.isEmpty())
+ title = domain;
+ }
+#endif
+
+ return title;
}
uint64_t HTMLMediaElement::mediaSessionUniqueIdentifier() const
Modified: trunk/Source/WebCore/platform/PublicSuffix.h (232000 => 232001)
--- trunk/Source/WebCore/platform/PublicSuffix.h 2018-05-19 22:00:21 UTC (rev 232000)
+++ trunk/Source/WebCore/platform/PublicSuffix.h 2018-05-19 23:07:38 UTC (rev 232001)
@@ -34,6 +34,7 @@
WEBCORE_EXPORT bool isPublicSuffix(const String& domain);
WEBCORE_EXPORT String topPrivatelyControlledDomain(const String& domain);
+String decodeHostName(const String& domain);
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mac/PublicSuffixMac.mm (232000 => 232001)
--- trunk/Source/WebCore/platform/mac/PublicSuffixMac.mm 2018-05-19 22:00:21 UTC (rev 232000)
+++ trunk/Source/WebCore/platform/mac/PublicSuffixMac.mm 2018-05-19 23:07:38 UTC (rev 232001)
@@ -60,6 +60,11 @@
return String();
}
+String decodeHostName(const String& domain)
+{
+ return decodeHostName(static_cast<NSString*>(domain));
}
+}
+
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes