Title: [206616] trunk/Source/WebCore
Revision
206616
Author
cdu...@apple.com
Date
2016-09-29 14:28:45 -0700 (Thu, 29 Sep 2016)

Log Message

Fix post-landing nits after r206561.
https://bugs.webkit.org/show_bug.cgi?id=162659

Reviewed by Alex Christensen.

Uses more StringViews and constness.

* dom/SecurityContext.cpp:
(WebCore::SecurityContext::isSupportedSandboxPolicy):
* dom/SecurityContext.h:
* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::DOMTokenList):
(WebCore::DOMTokenList::supports):
* html/DOMTokenList.h:
(WebCore::DOMTokenList::DOMTokenList):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::relList):
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::sandbox):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::relList):
* html/LinkRelAttribute.cpp:
(WebCore::LinkRelAttribute::isSupported):
* html/LinkRelAttribute.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206615 => 206616)


--- trunk/Source/WebCore/ChangeLog	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/ChangeLog	2016-09-29 21:28:45 UTC (rev 206616)
@@ -1,3 +1,30 @@
+2016-09-29  Chris Dumez  <cdu...@apple.com>
+
+        Fix post-landing nits after r206561.
+        https://bugs.webkit.org/show_bug.cgi?id=162659
+
+        Reviewed by Alex Christensen.
+
+        Uses more StringViews and constness.
+
+        * dom/SecurityContext.cpp:
+        (WebCore::SecurityContext::isSupportedSandboxPolicy):
+        * dom/SecurityContext.h:
+        * html/DOMTokenList.cpp:
+        (WebCore::DOMTokenList::DOMTokenList):
+        (WebCore::DOMTokenList::supports):
+        * html/DOMTokenList.h:
+        (WebCore::DOMTokenList::DOMTokenList):
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::relList):
+        * html/HTMLIFrameElement.cpp:
+        (WebCore::HTMLIFrameElement::sandbox):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::relList):
+        * html/LinkRelAttribute.cpp:
+        (WebCore::LinkRelAttribute::isSupported):
+        * html/LinkRelAttribute.h:
+
 2016-09-29  Alex Christensen  <achristen...@webkit.org>
 
         URLParser should correctly parse ports with leading 0's

Modified: trunk/Source/WebCore/dom/SecurityContext.cpp (206615 => 206616)


--- trunk/Source/WebCore/dom/SecurityContext.cpp	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/dom/SecurityContext.cpp	2016-09-29 21:28:45 UTC (rev 206616)
@@ -85,9 +85,9 @@
         setSecurityOriginPolicy(SecurityOriginPolicy::create(SecurityOrigin::createUnique()));
 }
 
-bool SecurityContext::isSupportedSandboxPolicy(const String& policy)
+bool SecurityContext::isSupportedSandboxPolicy(StringView policy)
 {
-    static const char* supportedPolicies[] = {
+    static const char* const supportedPolicies[] = {
         "allow-forms", "allow-same-origin", "allow-scripts", "allow-top-navigation", "allow-pointer-lock", "allow-popups"
     };
 

Modified: trunk/Source/WebCore/dom/SecurityContext.h (206615 => 206616)


--- trunk/Source/WebCore/dom/SecurityContext.h	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/dom/SecurityContext.h	2016-09-29 21:28:45 UTC (rev 206616)
@@ -75,7 +75,7 @@
     WEBCORE_EXPORT SecurityOrigin* securityOrigin() const;
 
     static SandboxFlags parseSandboxPolicy(const String& policy, String& invalidTokensErrorMessage);
-    static bool isSupportedSandboxPolicy(const String&);
+    static bool isSupportedSandboxPolicy(StringView);
 
     bool foundMixedContent() const { return m_foundMixedContent; }
     void setFoundMixedContent() { m_foundMixedContent = true; }

Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (206615 => 206616)


--- trunk/Source/WebCore/html/DOMTokenList.cpp	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp	2016-09-29 21:28:45 UTC (rev 206616)
@@ -36,7 +36,7 @@
 
 namespace WebCore {
 
-DOMTokenList::DOMTokenList(Element& element, const QualifiedName& attributeName, WTF::Function<bool(const String&)>&& isSupportedToken)
+DOMTokenList::DOMTokenList(Element& element, const QualifiedName& attributeName, WTF::Function<bool(StringView)>&& isSupportedToken)
     : m_element(element)
     , m_attributeName(attributeName)
     , m_isSupportedToken(WTFMove(isSupportedToken))
@@ -179,7 +179,7 @@
 }
 
 // https://dom.spec.whatwg.org/#concept-domtokenlist-validation
-bool DOMTokenList::supports(const String& token, ExceptionCode& ec)
+bool DOMTokenList::supports(StringView token, ExceptionCode& ec)
 {
     if (!m_isSupportedToken) {
         ec = TypeError;

Modified: trunk/Source/WebCore/html/DOMTokenList.h (206615 => 206616)


--- trunk/Source/WebCore/html/DOMTokenList.h	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/html/DOMTokenList.h	2016-09-29 21:28:45 UTC (rev 206616)
@@ -32,7 +32,7 @@
 class DOMTokenList {
     WTF_MAKE_NONCOPYABLE(DOMTokenList); WTF_MAKE_FAST_ALLOCATED;
 public:
-    DOMTokenList(Element&, const QualifiedName& attributeName, WTF::Function<bool(const String&)>&& isSupportedToken = { });
+    DOMTokenList(Element&, const QualifiedName& attributeName, WTF::Function<bool(StringView)>&& isSupportedToken = { });
 
     void associatedAttributeValueChanged(const AtomicString&);
 
@@ -49,7 +49,7 @@
     void remove(const AtomicString&, ExceptionCode&);
     WEBCORE_EXPORT bool toggle(const AtomicString&, Optional<bool> force, ExceptionCode&);
     void replace(const AtomicString& token, const AtomicString& newToken, ExceptionCode&);
-    bool supports(const String& token, ExceptionCode&);
+    bool supports(StringView token, ExceptionCode&);
 
     Element& element() const { return m_element; }
 
@@ -73,7 +73,7 @@
     bool m_inUpdateAssociatedAttributeFromTokens { false };
     bool m_tokensNeedUpdating { true };
     Vector<AtomicString> m_tokens;
-    WTF::Function<bool(const String&)> m_isSupportedToken;
+    WTF::Function<bool(StringView)> m_isSupportedToken;
 };
 
 inline unsigned DOMTokenList::length() const

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (206615 => 206616)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2016-09-29 21:28:45 UTC (rev 206616)
@@ -303,7 +303,7 @@
 DOMTokenList& HTMLAnchorElement::relList()
 {
     if (!m_relList) 
-        m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr, [](const String& token) {
+        m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr, [](StringView token) {
             return equalIgnoringASCIICase(token, "noreferrer");
         });
     return *m_relList;

Modified: trunk/Source/WebCore/html/HTMLIFrameElement.cpp (206615 => 206616)


--- trunk/Source/WebCore/html/HTMLIFrameElement.cpp	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/html/HTMLIFrameElement.cpp	2016-09-29 21:28:45 UTC (rev 206616)
@@ -51,7 +51,7 @@
 DOMTokenList& HTMLIFrameElement::sandbox()
 {
     if (!m_sandbox)
-        m_sandbox = std::make_unique<DOMTokenList>(*this, sandboxAttr, [](const String& token) {
+        m_sandbox = std::make_unique<DOMTokenList>(*this, sandboxAttr, [](StringView token) {
             return SecurityContext::isSupportedSandboxPolicy(token);
         });
     return *m_sandbox;

Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (206615 => 206616)


--- trunk/Source/WebCore/html/HTMLLinkElement.cpp	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp	2016-09-29 21:28:45 UTC (rev 206616)
@@ -444,7 +444,7 @@
 DOMTokenList& HTMLLinkElement::relList()
 {
     if (!m_relList) 
-        m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr, [](const String& token) {
+        m_relList = std::make_unique<DOMTokenList>(*this, HTMLNames::relAttr, [](StringView token) {
             return LinkRelAttribute::isSupported(token);
         });
     return *m_relList;

Modified: trunk/Source/WebCore/html/LinkRelAttribute.cpp (206615 => 206616)


--- trunk/Source/WebCore/html/LinkRelAttribute.cpp	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/html/LinkRelAttribute.cpp	2016-09-29 21:28:45 UTC (rev 206616)
@@ -88,9 +88,9 @@
 }
 
 // https://html.spec.whatwg.org/#linkTypes
-bool LinkRelAttribute::isSupported(const String& attribute)
+bool LinkRelAttribute::isSupported(StringView attribute)
 {
-    static const char* supportedAttributes[] = {
+    static const char* const supportedAttributes[] = {
         "alternate", "dns-prefetch", "icon", "stylesheet", "apple-touch-icon", "apple-touch-icon-precomposed",
 #if ENABLE(LINK_PREFETCH)
         "prefetch", "subresource",

Modified: trunk/Source/WebCore/html/LinkRelAttribute.h (206615 => 206616)


--- trunk/Source/WebCore/html/LinkRelAttribute.h	2016-09-29 21:25:14 UTC (rev 206615)
+++ trunk/Source/WebCore/html/LinkRelAttribute.h	2016-09-29 21:28:45 UTC (rev 206616)
@@ -53,7 +53,7 @@
     LinkRelAttribute();
     explicit LinkRelAttribute(const String&);
 
-    static bool isSupported(const String&);
+    static bool isSupported(StringView);
 };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to