Changeset 242792 in webkit
- Timestamp:
- Mar 12, 2019, 4:38:49 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
Modules/fetch/FetchRequest.cpp (modified) (3 diffs)
-
html/HTMLFormControlElement.cpp (modified) (2 diffs)
-
html/HTMLMediaElement.cpp (modified) (3 diffs)
-
html/MediaElementSession.cpp (modified) (3 diffs)
-
page/Quirks.cpp (modified) (4 diffs)
-
page/Quirks.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242791 r242792 1 2019-03-12 Ryosuke Niwa <rniwa@webkit.org> 2 3 Move the remaining code to decide whether site specific quirks are needed to Quirks class 4 https://bugs.webkit.org/show_bug.cgi?id=195610 5 6 Reviewed by Antti Koivisto. 7 8 Moved the remaining code scattered across WebCore to decide whether a site specific quirk 9 is needed or not to Quirks class introduced in r236818. 10 11 * Modules/fetch/FetchRequest.cpp: 12 (WebCore::needsSignalQuirk): Deleted. 13 (WebCore::processInvalidSignal): 14 * html/HTMLFormControlElement.cpp: 15 (WebCore::HTMLFormControlElement::needsMouseFocusableQuirk const): 16 * html/HTMLMediaElement.cpp: 17 (WebCore::needsAutoplayPlayPauseEventsQuirk): Deleted. 18 (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks): 19 (WebCore::needsSeekingSupportQuirk): Deleted. 20 (WebCore::HTMLMediaElement::supportsSeeking const): 21 * html/MediaElementSession.cpp: 22 (WebCore::needsArbitraryUserGestureAutoplayQuirk): Deleted. 23 (WebCore::needsPerDocumentAutoplayBehaviorQuirk): Deleted. 24 (WebCore::MediaElementSession::playbackPermitted const): 25 * page/Quirks.cpp: 26 (WebCore::allowedAutoplayQuirks): Added. 27 (WebCore::Quirks::needsQuirks const): Added. 28 (WebCore::Quirks::shouldIgnoreInvalidSignal const): Added. 29 (WebCore::Quirks::needsFormControlToBeMouseFocusable const): Added. 30 (WebCore::Quirks::needsAutoplayPlayPauseEvents const): Added. 31 (WebCore::Quirks::needsSeekingSupportDisabled const): Addd. 32 (WebCore::Quirks::needsPerDocumentAutoplayBehavior const): Added. 33 (WebCore::Quirks::shouldAutoplayForArbitraryUserGesture const): Added. 34 (WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const): Added. 35 (WebCore::Quirks::hasWebSQLSupportQuirk const): Fixed the coding style. 36 * page/Quirks.h: 37 1 38 2019-03-12 Enrique Ocaña González <eocanha@igalia.com> 2 39 -
trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp
r242145 r242792 34 34 #include "JSAbortSignal.h" 35 35 #include "Logging.h" 36 #include "Quirks.h" 36 37 #include "ScriptExecutionContext.h" 37 38 #include "SecurityOrigin.h" … … 145 146 } 146 147 147 static inline bool needsSignalQuirk(ScriptExecutionContext& context)148 {149 if (!is<Document>(context))150 return false;151 152 auto& document = downcast<Document>(context);153 if (!document.settings().needsSiteSpecificQuirks())154 return false;155 156 auto host = document.topDocument().url().host();157 return equalLettersIgnoringASCIICase(host, "www.thrivepatientportal.com");158 }159 160 148 static inline Optional<Exception> processInvalidSignal(ScriptExecutionContext& context) 161 149 { … … 163 151 context.addConsoleMessage(MessageSource::JS, MessageLevel::Warning, message); 164 152 165 if ( needsSignalQuirk(context))153 if (is<Document>(context) && downcast<Document>(context).quirks().shouldIgnoreInvalidSignal()) 166 154 return { }; 167 155 -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r242309 r242792 39 39 #include "HTMLLegendElement.h" 40 40 #include "HTMLTextAreaElement.h" 41 #include "Quirks.h" 41 42 #include "RenderBox.h" 42 43 #include "RenderTheme.h" … … 673 674 bool HTMLFormControlElement::needsMouseFocusableQuirk() const 674 675 { 675 #if PLATFORM(MAC) 676 if (!document().settings().needsSiteSpecificQuirks()) 677 return false; 678 679 auto host = document().url().host(); 680 return equalLettersIgnoringASCIICase(host, "ceac.state.gov") || host.endsWithIgnoringASCIICase(".ceac.state.gov"); 681 #else 682 return false; 683 #endif 676 return document().quirks().needsFormControlToBeMouseFocusable(); 684 677 } 685 678 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r242791 r242792 662 662 schedulePlaybackControlsManagerUpdate(); 663 663 } 664 665 static bool needsAutoplayPlayPauseEventsQuirk(const Document& document)666 {667 auto* page = document.page();668 if (!page || !page->settings().needsSiteSpecificQuirks())669 return false;670 671 auto loader = makeRefPtr(document.loader());672 return loader && loader->allowedAutoplayQuirks().contains(AutoplayQuirk::SynthesizedPauseEvents);673 }674 675 664 RefPtr<HTMLMediaElement> HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager(MediaElementSession::PlaybackControlsPurpose purpose) 676 665 { … … 2451 2440 void HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks() 2452 2441 { 2453 auto& document = this->document(); 2454 if (!needsAutoplayPlayPauseEventsQuirk(document) && !needsAutoplayPlayPauseEventsQuirk(document.topDocument())) 2442 if (!document().quirks().needsAutoplayPlayPauseEvents()) 2455 2443 return; 2456 2444 … … 7719 7707 } 7720 7708 7721 static bool needsSeekingSupportQuirk(Document& document)7722 {7723 if (!document.settings().needsSiteSpecificQuirks())7724 return false;7725 7726 auto host = document.topDocument().url().host();7727 return equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com");7728 }7729 7730 7709 bool HTMLMediaElement::supportsSeeking() const 7731 7710 { 7732 return ! needsSeekingSupportQuirk(document()) && !isLiveStream();7711 return !document().quirks().needsSeekingSupportDisabled() && !isLiveStream(); 7733 7712 } 7734 7713 -
trunk/Source/WebCore/html/MediaElementSession.cpp
r242355 r242792 42 42 #include "Page.h" 43 43 #include "PlatformMediaSessionManager.h" 44 #include "Quirks.h" 44 45 #include "RenderMedia.h" 45 46 #include "RenderView.h" … … 245 246 } 246 247 247 #if PLATFORM(MAC)248 static bool needsArbitraryUserGestureAutoplayQuirk(const Document& document)249 {250 if (!document.settings().needsSiteSpecificQuirks())251 return false;252 253 auto loader = makeRefPtr(document.loader());254 return loader && loader->allowedAutoplayQuirks().contains(AutoplayQuirk::ArbitraryUserGestures);255 }256 #endif // PLATFORM(MAC)257 258 static bool needsPerDocumentAutoplayBehaviorQuirk(const Document& document)259 {260 if (!document.settings().needsSiteSpecificQuirks())261 return false;262 263 auto loader = makeRefPtr(document.loader());264 return loader && loader->allowedAutoplayQuirks().contains(AutoplayQuirk::PerDocumentAutoplayBehavior);265 }266 267 248 SuccessOr<MediaPlaybackDenialReason> MediaElementSession::playbackPermitted() const 268 249 { … … 302 283 #endif 303 284 285 // FIXME: Why are we checking top-level document only for PerDocumentAutoplayBehavior? 304 286 const auto& topDocument = document.topDocument(); 305 if (topDocument.mediaState() & MediaProducer::HasUserInteractedWithMediaElement && needsPerDocumentAutoplayBehaviorQuirk(topDocument))287 if (topDocument.mediaState() & MediaProducer::HasUserInteractedWithMediaElement && topDocument.quirks().needsPerDocumentAutoplayBehavior()) 306 288 return { }; 307 289 308 #if PLATFORM(MAC) 309 if (document.hasHadUserInteraction() && needsArbitraryUserGestureAutoplayQuirk(document)) 290 if (document.hasHadUserInteraction() && document.quirks().shouldAutoplayForArbitraryUserGesture()) 310 291 return { }; 311 #endif312 292 313 293 if (m_restrictions & RequireUserGestureForVideoRateChange && m_element.isVideo() && !document.processingUserGestureForMedia()) { -
trunk/Source/WebCore/page/Quirks.cpp
r242770 r242792 28 28 29 29 #include "Document.h" 30 #include "DocumentLoader.h" 31 #include "HTMLMetaElement.h" 32 #include "HTMLObjectElement.h" 30 33 #include "Settings.h" 31 34 32 35 namespace WebCore { 36 37 static inline OptionSet<AutoplayQuirk> allowedAutoplayQuirks(Document& document) 38 { 39 auto* loader = document.loader(); 40 if (!loader) 41 return { }; 42 43 return loader->allowedAutoplayQuirks(); 44 } 33 45 34 46 Quirks::Quirks(Document& document) … … 39 51 Quirks::~Quirks() = default; 40 52 53 inline bool Quirks::needsQuirks() const 54 { 55 return m_document && m_document->settings().needsSiteSpecificQuirks(); 56 } 57 58 bool Quirks::shouldIgnoreInvalidSignal() const 59 { 60 if (!needsQuirks()) 61 return false; 62 63 auto host = m_document->topDocument().url().host(); 64 return equalLettersIgnoringASCIICase(host, "www.thrivepatientportal.com"); 65 } 66 67 bool Quirks::needsFormControlToBeMouseFocusable() const 68 { 69 #if PLATFORM(MAC) 70 if (!needsQuirks()) 71 return false; 72 73 auto host = m_document->url().host(); 74 return equalLettersIgnoringASCIICase(host, "ceac.state.gov") || host.endsWithIgnoringASCIICase(".ceac.state.gov"); 75 #else 76 return false; 77 #endif 78 } 79 80 bool Quirks::needsAutoplayPlayPauseEvents() const 81 { 82 if (!needsQuirks()) 83 return false; 84 85 if (allowedAutoplayQuirks(*m_document).contains(AutoplayQuirk::SynthesizedPauseEvents)) 86 return true; 87 88 return allowedAutoplayQuirks(m_document->topDocument()).contains(AutoplayQuirk::SynthesizedPauseEvents); 89 } 90 91 bool Quirks::needsSeekingSupportDisabled() const 92 { 93 if (!needsQuirks()) 94 return false; 95 96 auto host = m_document->topDocument().url().host(); 97 return equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com"); 98 } 99 100 bool Quirks::needsPerDocumentAutoplayBehavior() const 101 { 102 #if PLATFORM(MAC) 103 ASSERT(m_document == &m_document->topDocument()); 104 return needsQuirks() && allowedAutoplayQuirks(*m_document).contains(AutoplayQuirk::PerDocumentAutoplayBehavior); 105 #else 106 return false; 107 #endif 108 } 109 110 bool Quirks::shouldAutoplayForArbitraryUserGesture() const 111 { 112 #if PLATFORM(MAC) 113 return needsQuirks() && allowedAutoplayQuirks(*m_document).contains(AutoplayQuirk::ArbitraryUserGestures); 114 #else 115 return false; 116 #endif 117 } 118 41 119 bool Quirks::hasBrokenEncryptedMediaAPISupportQuirk() const 42 120 { 43 if (! m_document || !m_document->settings().needsSiteSpecificQuirks())121 if (!needsQuirks()) 44 122 return false; 45 123 … … 61 139 bool Quirks::hasWebSQLSupportQuirk() const 62 140 { 63 if (! m_document || !m_document->settings().needsSiteSpecificQuirks())141 if (!needsQuirks()) 64 142 return false; 65 143 … … 70 148 71 149 m_hasWebSQLSupportQuirk = domain == "bostonglobe.com" 72 || domain.endsWith(".bostonglobe.com")73 || domain == "latimes.com"74 || domain.endsWith(".latimes.com");150 || domain.endsWith(".bostonglobe.com") 151 || domain == "latimes.com" 152 || domain.endsWith(".latimes.com"); 75 153 76 154 return m_hasWebSQLSupportQuirk.value(); -
trunk/Source/WebCore/page/Quirks.h
r242278 r242792 38 38 ~Quirks(); 39 39 40 bool shouldIgnoreInvalidSignal() const; 41 bool needsFormControlToBeMouseFocusable() const; 42 bool needsAutoplayPlayPauseEvents() const; 43 bool needsSeekingSupportDisabled() const; 44 bool needsPerDocumentAutoplayBehavior() const; 45 bool shouldAutoplayForArbitraryUserGesture() const; 40 46 bool hasBrokenEncryptedMediaAPISupportQuirk() const; 41 47 bool hasWebSQLSupportQuirk() const; 42 48 43 49 private: 50 bool needsQuirks() const; 51 44 52 WeakPtr<Document> m_document; 45 53
Note:
See TracChangeset
for help on using the changeset viewer.