2018-08-16 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r234890. rdar://problem/43385599 Remove failing assertion introduced in r234873 https://bugs.webkit.org/show_bug.cgi?id=188581 * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): The assertion is correct but failing because VectorTraits<String> is incorrect. I'll re-add it and fix VectorTraits<String> in a separate patch. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234890 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-15 Alex Christensen <achristensen@webkit.org> Remove failing assertion introduced in r234873 https://bugs.webkit.org/show_bug.cgi?id=188581 * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): The assertion is correct but failing because VectorTraits<String> is incorrect. I'll re-add it and fix VectorTraits<String> in a separate patch. 2018-08-16 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r234873. rdar://problem/43385599 isValidCSSSelector is unsafe to be called from a non-main thread https://bugs.webkit.org/show_bug.cgi?id=188581 <rdar://problem/40517358> Reviewed by Sam Weinig. Source/WebCore: Parsing and determining whether the css selectors are valid is fast enough to do before hopping to the background thread for the slow NFA/DFA operations and writing to disk. Doing it on the main thread avoids the thread safety issues in the CSSParser's use of strings. * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionCompiler.h: * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): (WebCore::ContentExtensions::loadEncodedRules): (WebCore::ContentExtensions::parseRuleList): * contentextensions/ContentExtensionParser.h: * contentextensions/ContentExtensionRule.cpp: (WebCore::ContentExtensions::Trigger::isolatedCopy const): (WebCore::ContentExtensions::Action::isolatedCopy const): * contentextensions/ContentExtensionRule.h: (WebCore::ContentExtensions::Trigger::isEmpty const): (WebCore::ContentExtensions::Trigger::operator== const): (WebCore::ContentExtensions::Action::Action): (WebCore::ContentExtensions::ContentExtensionRule::isolatedCopy const): (WebCore::ContentExtensions::ContentExtensionRule::operator== const): (WebCore::ContentExtensions::vectorIsolatedCopy): Source/WebKit: * UIProcess/API/APIContentRuleListStore.cpp: (API::compiledToFile): (API::ContentRuleListStore::lookupContentRuleList): (API::ContentRuleListStore::getAvailableContentRuleListIdentifiers): (API::ContentRuleListStore::compileContentRuleList): (API::ContentRuleListStore::removeContentRuleList): (API::ContentRuleListStore::getContentRuleListSource): * UIProcess/API/APIContentRuleListStore.h: * UIProcess/API/Cocoa/WKContentRuleListStore.mm: Source/WTF: * wtf/Vector.h: (WTF::minCapacity>::isolatedCopy): Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: (TestWebKitAPI::InMemoryCompiledContentExtension::create): (TestWebKitAPI::checkCompilerError): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234873 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-14 Alex Christensen <achristensen@webkit.org> isValidCSSSelector is unsafe to be called from a non-main thread https://bugs.webkit.org/show_bug.cgi?id=188581 <rdar://problem/40517358> Reviewed by Sam Weinig. Parsing and determining whether the css selectors are valid is fast enough to do before hopping to the background thread for the slow NFA/DFA operations and writing to disk. Doing it on the main thread avoids the thread safety issues in the CSSParser's use of strings. * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionCompiler.h: * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): (WebCore::ContentExtensions::loadEncodedRules): (WebCore::ContentExtensions::parseRuleList): * contentextensions/ContentExtensionParser.h: * contentextensions/ContentExtensionRule.cpp: (WebCore::ContentExtensions::Trigger::isolatedCopy const): (WebCore::ContentExtensions::Action::isolatedCopy const): * contentextensions/ContentExtensionRule.h: (WebCore::ContentExtensions::Trigger::isEmpty const): (WebCore::ContentExtensions::Trigger::operator== const): (WebCore::ContentExtensions::Action::Action): (WebCore::ContentExtensions::ContentExtensionRule::isolatedCopy const): (WebCore::ContentExtensions::ContentExtensionRule::operator== const): (WebCore::ContentExtensions::vectorIsolatedCopy): 2018-08-15 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234905. rdar://problem/43347925 Can't share an app on AppStore to WeChat due to a release assert https://bugs.webkit.org/show_bug.cgi?id=188621 <rdar://problem/43343976> Reviewed by Geoffrey Garen. Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert is getting hit by third party applications on iOS in UI process. Source/WebCore: * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Added a SDK check. Source/WebKit: * UIProcess/Cocoa/VersionChecks.h: (WebKit::SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy): Added. It's iOS 12 or macOS 10.14 Mojave. * UIProcess/WebProcessProxy.cpp: (WebKit::isMainThreadOrCheckDisabled): Added. Returns true whether when we're in the main thread or if the app is not linked on or after iOS 12 or macOS 10.14 Mojave. (WebKit::globalPageMap): (WebKit::m_isInPrewarmedPool): (WebKit::WebProcessProxy::~WebProcessProxy): (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData): (WebKit::WebProcessProxy::didFinishLaunching): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234905 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-15 Ryosuke Niwa <rniwa@webkit.org> Can't share an app on AppStore to WeChat due to a release assert https://bugs.webkit.org/show_bug.cgi?id=188621 <rdar://problem/43343976> Reviewed by Geoffrey Garen. Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert is getting hit by third party applications on iOS in UI process. * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Added a SDK check. 2018-08-13 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r234766. rdar://problem/43240328 CrashTracer: com.apple.WebKit.Storage at WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose https://bugs.webkit.org/show_bug.cgi?id=188461 <rdar://problem/33555052> Reviewed by Chris Dumez. When we try to schedule shutdown for database, we should cancel the timer so no scheduleShutdownForClose will be running after this. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234766 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-10 Sihui Liu <sihui_liu@apple.com> CrashTracer: com.apple.WebKit.Storage at WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose https://bugs.webkit.org/show_bug.cgi?id=188461 <rdar://problem/33555052> Reviewed by Chris Dumez. When we try to schedule shutdown for database, we should cancel the timer so no scheduleShutdownForClose will be running after this. * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): 2018-08-13 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r234778. rdar://problem/43240324 [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime https://bugs.webkit.org/show_bug.cgi?id=188480 Reviewed by Simon Fraser. Source/WebCore: Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms). In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1 or WebKit2 APIs in non-main threads. * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime. (WebCore::TimerBase::~TimerBase): (WebCore::TimerBase::setNextFireTime): Source/WTF: Added the SDK version for macOS Mojave. * wtf/spi/darwin/dyldSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234778 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-10 Ryosuke Niwa <rniwa@webkit.org> [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime https://bugs.webkit.org/show_bug.cgi?id=188480 Reviewed by Simon Fraser. Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms). In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1 or WebKit2 APIs in non-main threads. * platform/Timer.cpp: (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime. (WebCore::TimerBase::~TimerBase): (WebCore::TimerBase::setNextFireTime): 2018-08-09 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r234718. rdar://problem/43102434 REGRESSION (r228260): Events handled by input method invoke default event handler https://bugs.webkit.org/show_bug.cgi?id=188370 Reviewed by Wenson Hsieh. Source/WebCore: The bug was caused by the default event handler being invoked for the "virtual" keydown events generated for input methods. Namely, when Japanese or Chinese input methods swallows TAB key, WebKit should not invoke the default event handler and move the focus during input composition. Fixed the bug by adding a new boolean on Event indicating whether the default event handler should be invoked, and restoring the behavior prior to r228260 for these virtual keydown events. Test: editing/input/press-tab-during-ime-composition.html * dom/Event.h: (WebCore::Event::isDefaultEventHandlerIgnored const): Added. (WebCore::Event::setIsDefaultEventHandlerIgnored): Added. * dom/EventDispatcher.cpp: (WebCore::EventDispatcher::dispatchEvent): Don't invoke the default event handler if isDefaultEventHandlerIgnored is set. * page/EventHandler.cpp: (WebCore::EventHandler::internalKeyEvent): Set isDefaultEventHandlerIgnored. This restores WebKit's behavior prior to r228260. LayoutTests: Added a regression test. Due to the lack of adequate support of textInputController in WebKitTestRunner, the test is only enabled in WebKit1. The WTR fix is tracked by https://webkit.org/b/188428. * editing/input/press-tab-during-ime-composition-expected.txt: Added. * editing/input/press-tab-during-ime-composition.html: Added. * platform/ios/TestExpectations: * platform/wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234718 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-08 Ryosuke Niwa <rniwa@webkit.org> REGRESSION (r228260): Events handled by input method invoke default event handler https://bugs.webkit.org/show_bug.cgi?id=188370 Reviewed by Wenson Hsieh. The bug was caused by the default event handler being invoked for the "virtual" keydown events generated for input methods. Namely, when Japanese or Chinese input methods swallows TAB key, WebKit should not invoke the default event handler and move the focus during input composition. Fixed the bug by adding a new boolean on Event indicating whether the default event handler should be invoked, and restoring the behavior prior to r228260 for these virtual keydown events. Test: editing/input/press-tab-during-ime-composition.html * dom/Event.h: (WebCore::Event::isDefaultEventHandlerIgnored const): Added. (WebCore::Event::setIsDefaultEventHandlerIgnored): Added. * dom/EventDispatcher.cpp: (WebCore::EventDispatcher::dispatchEvent): Don't invoke the default event handler if isDefaultEventHandlerIgnored is set. * page/EventHandler.cpp: (WebCore::EventHandler::internalKeyEvent): Set isDefaultEventHandlerIgnored. This restores WebKit's behavior prior to r228260. 2018-08-03 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234534. rdar://problem/42902608 Control center controls disappear when pausing, locking device. https://bugs.webkit.org/show_bug.cgi?id=188282 <rdar://problem/42497809> Reviewed by Eric Carlson. Source/WebCore: Test: platform/mac/media/audio-session-category-video-paused.html MediaRemote will set any app whose audio session category changes from MediaPlayback to Ambient as not eligable for being the "now playing" app. Previously, due to the ordering of events, we never moved from MediaPlayback to Ambient when pausing <video>, even though that was the intention. Now that that bug is fixed, it exposed this new issue with MediaRemote. To solve the new issue, make our audio session category policy more explicit: once we are in MediaPlayback category, we will remain so as long as the media element in queston stays loaded, has played, and is never interrupted by the system. Make MediaSessionManagerCocoa a proper subclass of PlatformMediaSessionManager, and make MediaSessionManageriOS and -Mac subclasses of the -Cocoa class. Add a new m_hasPlayedSinceLastInterruption ivar to PlatformMediaSession, set when the state() changes to Playing, and cleared during an interruption. Check this flag when deciding what audio sessino category to set in MediaSessionManagerCocoa. * WebCore.xcodeproj/project.pbxproj: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::setState): * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::hasPlayedSinceLastInterruption const): (WebCore::PlatformMediaSession::clearHasPlayedSinceLastInterruption): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::audioHardwareListener): (WebCore::PlatformMediaSessionManager::updateSessionState): * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::beginInterruption): (PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/cocoa/MediaSessionManagerCocoa.h: Added. * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::MediaSessionManageriOS): * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::MediaSessionManagerMac): LayoutTests: * platform/mac/media/audio-session-category-video-paused-expected.txt: Added. * platform/mac/media/audio-session-category-video-paused.html: Added. * platform/ios/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234534 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-02 Jer Noble <jer.noble@apple.com> Control center controls disappear when pausing, locking device. https://bugs.webkit.org/show_bug.cgi?id=188282 <rdar://problem/42497809> Reviewed by Eric Carlson. Test: platform/mac/media/audio-session-category-video-paused.html MediaRemote will set any app whose audio session category changes from MediaPlayback to Ambient as not eligable for being the "now playing" app. Previously, due to the ordering of events, we never moved from MediaPlayback to Ambient when pausing <video>, even though that was the intention. Now that that bug is fixed, it exposed this new issue with MediaRemote. To solve the new issue, make our audio session category policy more explicit: once we are in MediaPlayback category, we will remain so as long as the media element in queston stays loaded, has played, and is never interrupted by the system. Make MediaSessionManagerCocoa a proper subclass of PlatformMediaSessionManager, and make MediaSessionManageriOS and -Mac subclasses of the -Cocoa class. Add a new m_hasPlayedSinceLastInterruption ivar to PlatformMediaSession, set when the state() changes to Playing, and cleared during an interruption. Check this flag when deciding what audio sessino category to set in MediaSessionManagerCocoa. * WebCore.xcodeproj/project.pbxproj: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::setState): * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::hasPlayedSinceLastInterruption const): (WebCore::PlatformMediaSession::clearHasPlayedSinceLastInterruption): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::audioHardwareListener): (WebCore::PlatformMediaSessionManager::updateSessionState): * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::beginInterruption): (PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/cocoa/MediaSessionManagerCocoa.h: Added. * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::MediaSessionManageriOS): * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::MediaSessionManagerMac): 2018-08-03 Babak Shafiei <bshafiei@apple.com> Revert r234534. rdar://problem/42902608 2018-08-03 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r234534. rdar://problem/42902608 Control center controls disappear when pausing, locking device. https://bugs.webkit.org/show_bug.cgi?id=188282 <rdar://problem/42497809> Reviewed by Eric Carlson. Source/WebCore: Test: platform/mac/media/audio-session-category-video-paused.html MediaRemote will set any app whose audio session category changes from MediaPlayback to Ambient as not eligable for being the "now playing" app. Previously, due to the ordering of events, we never moved from MediaPlayback to Ambient when pausing <video>, even though that was the intention. Now that that bug is fixed, it exposed this new issue with MediaRemote. To solve the new issue, make our audio session category policy more explicit: once we are in MediaPlayback category, we will remain so as long as the media element in queston stays loaded, has played, and is never interrupted by the system. Make MediaSessionManagerCocoa a proper subclass of PlatformMediaSessionManager, and make MediaSessionManageriOS and -Mac subclasses of the -Cocoa class. Add a new m_hasPlayedSinceLastInterruption ivar to PlatformMediaSession, set when the state() changes to Playing, and cleared during an interruption. Check this flag when deciding what audio sessino category to set in MediaSessionManagerCocoa. * WebCore.xcodeproj/project.pbxproj: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::setState): * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::hasPlayedSinceLastInterruption const): (WebCore::PlatformMediaSession::clearHasPlayedSinceLastInterruption): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::audioHardwareListener): (WebCore::PlatformMediaSessionManager::updateSessionState): * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::beginInterruption): (PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/cocoa/MediaSessionManagerCocoa.h: Added. * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::MediaSessionManageriOS): * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::MediaSessionManagerMac): LayoutTests: * platform/mac/media/audio-session-category-video-paused-expected.txt: Added. * platform/mac/media/audio-session-category-video-paused.html: Added. * platform/ios/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234534 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-02 Jer Noble <jer.noble@apple.com> Control center controls disappear when pausing, locking device. https://bugs.webkit.org/show_bug.cgi?id=188282 <rdar://problem/42497809> Reviewed by Eric Carlson. Test: platform/mac/media/audio-session-category-video-paused.html MediaRemote will set any app whose audio session category changes from MediaPlayback to Ambient as not eligable for being the "now playing" app. Previously, due to the ordering of events, we never moved from MediaPlayback to Ambient when pausing <video>, even though that was the intention. Now that that bug is fixed, it exposed this new issue with MediaRemote. To solve the new issue, make our audio session category policy more explicit: once we are in MediaPlayback category, we will remain so as long as the media element in queston stays loaded, has played, and is never interrupted by the system. Make MediaSessionManagerCocoa a proper subclass of PlatformMediaSessionManager, and make MediaSessionManageriOS and -Mac subclasses of the -Cocoa class. Add a new m_hasPlayedSinceLastInterruption ivar to PlatformMediaSession, set when the state() changes to Playing, and cleared during an interruption. Check this flag when deciding what audio sessino category to set in MediaSessionManagerCocoa. * WebCore.xcodeproj/project.pbxproj: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::setState): * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::hasPlayedSinceLastInterruption const): (WebCore::PlatformMediaSession::clearHasPlayedSinceLastInterruption): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::audioHardwareListener): (WebCore::PlatformMediaSessionManager::updateSessionState): * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::beginInterruption): (PlatformMediaSessionManager::updateSessionState): Deleted. * platform/audio/cocoa/MediaSessionManagerCocoa.h: Added. * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::MediaSessionManageriOS): * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::MediaSessionManagerMac): 2018-08-02 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234512. rdar://problem/42882298 Text selection color is hard to see in dark mode web views. https://bugs.webkit.org/show_bug.cgi?id=188260 rdar://problem/42721294 Reviewed by Simon Fraser. Stop using blendWithWhite() to transform the AppKit selection color in dark mode. Using an alpha of 80% gives good contrast, and still works good for selections over images. * platform/graphics/Color.cpp: (WebCore::Color::blendWithWhite const): Mark new colors as semantic if the original is. (WebCore::Color::colorWithAlpha const): Ditto. * rendering/RenderElement.cpp: (WebCore::RenderElement::selectionBackgroundColor const): Use transformSelectionBackgroundColor. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::activeSelectionBackgroundColor const): Use transformSelectionBackgroundColor. (WebCore::RenderTheme::inactiveSelectionBackgroundColor const): Ditto. (WebCore::RenderTheme::transformSelectionBackgroundColor const): Added. Just blend with white. * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::transformSelectionBackgroundColor const): Added. Use an alpha with the color in dark mode, otherwise fallback to RenderTheme. (WebCore::RenderThemeMac::systemColor const): Use activeListBoxSelectionBackgroundColor() and activeSelectionBackgroundColor() instead of caching the colors again. Update hardcoded color. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234512 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-02 Timothy Hatcher <timothy@apple.com> Text selection color is hard to see in dark mode web views. https://bugs.webkit.org/show_bug.cgi?id=188260 rdar://problem/42721294 Reviewed by Simon Fraser. Stop using blendWithWhite() to transform the AppKit selection color in dark mode. Using an alpha of 80% gives good contrast, and still works good for selections over images. * platform/graphics/Color.cpp: (WebCore::Color::blendWithWhite const): Mark new colors as semantic if the original is. (WebCore::Color::colorWithAlpha const): Ditto. * rendering/RenderElement.cpp: (WebCore::RenderElement::selectionBackgroundColor const): Use transformSelectionBackgroundColor. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::activeSelectionBackgroundColor const): Use transformSelectionBackgroundColor. (WebCore::RenderTheme::inactiveSelectionBackgroundColor const): Ditto. (WebCore::RenderTheme::transformSelectionBackgroundColor const): Added. Just blend with white. * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::transformSelectionBackgroundColor const): Added. Use an alpha with the color in dark mode, otherwise fallback to RenderTheme. (WebCore::RenderThemeMac::systemColor const): Use activeListBoxSelectionBackgroundColor() and activeSelectionBackgroundColor() instead of caching the colors again. Update hardcoded color. 2018-08-02 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234469. rdar://problem/42882308 Always use MediaPlayback audio category when playing to AppleTV https://bugs.webkit.org/show_bug.cgi?id=188230 <rdar://problem/42497809> Reviewed by Jer Noble. * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): Check session.isPlayingToWirelessPlaybackTarget(). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234469 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-01 Eric Carlson <eric.carlson@apple.com> Always use MediaPlayback audio category when playing to AppleTV https://bugs.webkit.org/show_bug.cgi?id=188230 <rdar://problem/42497809> Reviewed by Jer Noble. * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): Check session.isPlayingToWirelessPlaybackTarget(). 2018-08-02 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234463. rdar://problem/42882308 [iOS] Remove the delay before setting audio session category added in r233535 https://bugs.webkit.org/show_bug.cgi?id=188225 Reviewed by Jer Noble. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::beginInterruption): scheduleUpdateSessionState -> updateSessionState. (WebCore::PlatformMediaSessionManager::addSession): Ditto. (WebCore::PlatformMediaSessionManager::removeSession): Ditto. (WebCore::PlatformMediaSessionManager::sessionStateChanged): Ditto. (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto. (WebCore::PlatformMediaSessionManager::updateSessionState): Ditto. (WebCore::PlatformMediaSessionManager::audioOutputDeviceChanged): Ditto. (WebCore::PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted. * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): (PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateClipRects): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234463 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-01 Eric Carlson <eric.carlson@apple.com> [iOS] Remove the delay before setting audio session category added in r233535 https://bugs.webkit.org/show_bug.cgi?id=188225 Reviewed by Jer Noble. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::beginInterruption): scheduleUpdateSessionState -> updateSessionState. (WebCore::PlatformMediaSessionManager::addSession): Ditto. (WebCore::PlatformMediaSessionManager::removeSession): Ditto. (WebCore::PlatformMediaSessionManager::sessionStateChanged): Ditto. (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto. (WebCore::PlatformMediaSessionManager::updateSessionState): Ditto. (WebCore::PlatformMediaSessionManager::audioOutputDeviceChanged): Ditto. (WebCore::PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted. * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): (PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateClipRects): 2018-08-01 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234466. rdar://problem/42843690 Hardcode some system colors to avoid fingerprinting exposure. https://bugs.webkit.org/show_bug.cgi?id=188203 rdar://problem/42781630 Reviewed by Tim Horton. Source/WebCore: Passes existing tests with the hardcoded blue system appearance. * rendering/RenderTheme.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): Adds special handling for some system colors. Fixes -apple-system-selected-text-background to match the real selection color by using blendWithWhite(). LayoutTests: * fast/css/apple-system-control-colors-expected.txt: Updated. * fast/css/test-setting-canvas-color.html: Fixed for colors with alpha. * platform/mac-highsierra/fast/css/apple-system-control-colors-expected.txt: * platform/mac-sierra/fast/css/apple-system-control-colors-expected.txt: Updated. * platform/mac/TestExpectations: Removed fast/css/test-setting-canvas-color.html. * platform/mac/fast/css/apple-system-control-colors-expected.txt: Updated. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234466 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-08-01 Timothy Hatcher <timothy@apple.com> Hardcode some system colors to avoid fingerprinting exposure. https://bugs.webkit.org/show_bug.cgi?id=188203 rdar://problem/42781630 Reviewed by Tim Horton. Passes existing tests with the hardcoded blue system appearance. * rendering/RenderTheme.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): Adds special handling for some system colors. Fixes -apple-system-selected-text-background to match the real selection color by using blendWithWhite(). 2018-07-31 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234447. rdar://problem/42802126 REGRESSION (r231107): MoviStar+ launches to a blank black screen https://bugs.webkit.org/show_bug.cgi?id=188139 Reviewed by Brent Fulgham. Source/WebCore: For this app, revert behavior to how it was before r231107 with a linked-on-or-before check. r231107 increased our fetch spec conformance, which we intend to keep. This makes a low-risk targeted fix that will fix the affected app until they update. I manually verified this fixes the app. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest): * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::applicationSDKVersionOverride): (WebCore::setApplicationSDKVersion): (WebCore::applicationSDKVersion): (WebCore::IOSApplication::isMoviStarPlus): Source/WebKit: Add infrastructure to check UIProcess SDK from the WebProcess and NetworkProcess for linked-on-or-after checks. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::WebProcessPool::platformInitializeNetworkProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234447 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-31 Alex Christensen <achristensen@webkit.org> REGRESSION (r231107): MoviStar+ launches to a blank black screen https://bugs.webkit.org/show_bug.cgi?id=188139 Reviewed by Brent Fulgham. For this app, revert behavior to how it was before r231107 with a linked-on-or-before check. r231107 increased our fetch spec conformance, which we intend to keep. This makes a low-risk targeted fix that will fix the affected app until they update. I manually verified this fixes the app. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest): * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::applicationSDKVersionOverride): (WebCore::setApplicationSDKVersion): (WebCore::applicationSDKVersion): (WebCore::IOSApplication::isMoviStarPlus): 2018-07-31 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234432. rdar://problem/42802123 Don't call RenderTheme::platformColorsDidChange() during printing. https://bugs.webkit.org/show_bug.cgi?id=188181 rdar://problem/42360070 Reviewed by Tim Horton. * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::setEmulatedMedia): Call m_page.updateStyleAfterChangeInEnvironment() instead of going to styleStope() and remove call to RenderTheme::platformColorsDidChange(). * page/FrameView.cpp: (WebCore::FrameView::adjustMediaTypeForPrinting): Remove call RenderTheme::platformColorsDidChange(). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234432 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-31 Timothy Hatcher <timothy@apple.com> Don't call RenderTheme::platformColorsDidChange() during printing. https://bugs.webkit.org/show_bug.cgi?id=188181 rdar://problem/42360070 Reviewed by Tim Horton. * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::setEmulatedMedia): Call m_page.updateStyleAfterChangeInEnvironment() instead of going to styleStope() and remove call to RenderTheme::platformColorsDidChange(). * page/FrameView.cpp: (WebCore::FrameView::adjustMediaTypeForPrinting): Remove call RenderTheme::platformColorsDidChange(). 2018-07-31 Ryosuke Niwa <rniwa@webkit.org> <rdar://problem/40844658> Crash in WebCore::EventTarget::dispatchEvent Reviewed by Chris Dumez. Like https://trac.webkit.org/r233496. The null pointer crash was caused by some GenericEventQueue dispatching an event in a stopped document, which does not have a valid script execution context because some uses of GenericEventQueue in media code was not closing the queue upon stopping of all active DOM objects. Fixed close GenericEventQueue when the script execution context is destoryed in WebKitMediaKeySession, SourceBuffer, SourceBufferList, and TrackListBase. No new tests since r233496 relied on a debug assertion for testing but we can't add the same assertion here since we'll continue to enqueue events after the document had stopped but not yet destroyed. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: (WebCore::WebKitMediaKeySession::stop): * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::stop): * Modules/mediasource/SourceBufferList.cpp: (WebCore::SourceBufferList::contextDestroyed): * Modules/mediasource/SourceBufferList.h: * html/track/TrackListBase.cpp: (TrackListBase::contextDestroyed): * html/track/TrackListBase.h: 2018-07-30 Babak Shafiei <bshafiei@apple.com> Revert r233926. rdar://problem/42354941 2018-07-30 Kocsen Chung <kocsen_chung@apple.com> Revert r233930. rdar://problem/42354941 2018-07-30 Kocsen Chung <kocsen_chung@apple.com> Revert r234044. rdar://problem/42433225 2018-07-30 Kocsen Chung <kocsen_chung@apple.com> Revert r234051. rdar://problem/42451584 2018-07-30 Babak Shafiei <bshafiei@apple.com> Revert r234078. rdar://problem/42490088 2018-07-30 Babak Shafiei <bshafiei@apple.com> Revert r234264. rdar://problem/42650373 2018-07-30 Babak Shafiei <bshafiei@apple.com> Revert r234298. rdar://problem/42354941 2018-07-30 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234339. rdar://problem/42736275 [iOS] Don't deactivate audio session https://bugs.webkit.org/show_bug.cgi?id=188127 <rdar://problem/42544143> Reviewed by Jon Lee. r233435 includes a change that deactivates the shared audio session when there are no more active media sessions. This is a good in WK2 because it allows other applications to resume playing audio when WebKit stops playing, but it is potentially bad in WK1 where the host app may also be playing audio. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::removeSession): Don't deactivate the audio session. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234339 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-27 Eric Carlson <eric.carlson@apple.com> [iOS] Don't deactivate audio session https://bugs.webkit.org/show_bug.cgi?id=188127 <rdar://problem/42544143> Reviewed by Jon Lee. r233435 includes a change that deactivates the shared audio session when there are no more active media sessions. This is a good in WK2 because it allows other applications to resume playing audio when WebKit stops playing, but it is potentially bad in WK1 where the host app may also be playing audio. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::removeSession): Don't deactivate the audio session. 2018-07-29 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234345. rdar://problem/42721217 Reset CompositingPolicyOverride between tests https://bugs.webkit.org/show_bug.cgi?id=188138 Reviewed by Zalan Bujtas. WK1 tests were failing after r234330 because the compositing policy override optional was left set on the Page (WK1 has injected bundle SPI to clear it). Fix by having Internals::resetToConsistentState clear this state. * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234345 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-28 Simon Fraser <simon.fraser@apple.com> Reset CompositingPolicyOverride between tests https://bugs.webkit.org/show_bug.cgi?id=188138 Reviewed by Zalan Bujtas. WK1 tests were failing after r234330 because the compositing policy override optional was left set on the Page (WK1 has injected bundle SPI to clear it). Fix by having Internals::resetToConsistentState clear this state. * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): 2018-07-29 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234340. rdar://problem/42721208 Adjust the color matrix for the inverse apple-invert-lightness() transformation https://bugs.webkit.org/show_bug.cgi?id=188131 rdar://problem/42673070 Reviewed by Zalan Bujtas. Source/WebCore: Use the correct inverse matrix values. Test: editing/style/inverse-color-filter.html * platform/graphics/filters/FilterOperation.cpp: (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): LayoutTests: Rebaseline tests that use the filter inversion. Add a new test that does inversion for a whole range of colors, to get good coverage of the inversion matrix. * editing/style/inverse-color-filter-expected.txt: Added. * editing/style/inverse-color-filter.html: Added. * editing/style/set-backColor-with-color-filter-expected.txt: * editing/style/set-foreColor-with-color-filter-expected.txt: * platform/win/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234340 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-27 Simon Fraser <simon.fraser@apple.com> Adjust the color matrix for the inverse apple-invert-lightness() transformation https://bugs.webkit.org/show_bug.cgi?id=188131 rdar://problem/42673070 Reviewed by Zalan Bujtas. Use the correct inverse matrix values. Test: editing/style/inverse-color-filter.html * platform/graphics/filters/FilterOperation.cpp: (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): 2018-07-29 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234330. rdar://problem/42721217 Be more conservative with compositing layer creation when memory is low https://bugs.webkit.org/show_bug.cgi?id=187866 rdar://problem/42366345 Reviewed by Zalan Bujtas. Source/WebCore: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. Test: compositing/layer-creation/compositing-policy.html * page/Page.h: (WebCore::Page::compositingPolicyOverride const): (WebCore::Page::setCompositingPolicyOverride): * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::Matrix3DTransformOperation::isRepresentableIn2D const): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isRepresentableIn2D const): * platform/graphics/transforms/TransformOperations.h: (WebCore::TransformOperations::has3DOperation const): (WebCore::TransformOperations::isRepresentableIn2D const): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags): (WebCore::RenderLayerCompositor::updateCompositingPolicy): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::requiresCompositingForTransform const): (WebCore::RenderLayerCompositor::requiresCompositingForVideo const): (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const): (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const): (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const): (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const): (WebCore::operator<<): * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::Internals::setCompositingPolicyOverride): (WebCore::Internals::compositingPolicyOverride const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetCompositingPolicyOverride): * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: Source/WTF: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. * wtf/MemoryPressureHandler.cpp: (WTF::thresholdForPolicy): (WTF::MemoryPressureHandler::currentMemoryUsagePolicy): * wtf/MemoryPressureHandler.h: Tools: When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::prepare): LayoutTests: * compositing/layer-creation/compositing-policy-expected.txt: Added. * compositing/layer-creation/compositing-policy.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234330 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-27 Simon Fraser <simon.fraser@apple.com> Be more conservative with compositing layer creation when memory is low https://bugs.webkit.org/show_bug.cgi?id=187866 rdar://problem/42366345 Reviewed by Zalan Bujtas. When process physical footprint is above a fraction of the jetsam limit, be more conservative in making compositing layers. We avoid compositing for these situations: 1. Layers with 3D transforms which are affine (like translateZ(0)). 2. Layers with will-change 3. Layers for canvases (other than WebGL/WebGPU) We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS, falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%. Compositing chooses to be more conservative in either "conservative" or "strict" memory modes. Plumb through a "compositingPolicyOverride" both so that on-device testing isn't flakily falling into a different mode, and so that we can impose the conservative mode for testing. Test: compositing/layer-creation/compositing-policy.html * page/Page.h: (WebCore::Page::compositingPolicyOverride const): (WebCore::Page::setCompositingPolicyOverride): * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::Matrix3DTransformOperation::isRepresentableIn2D const): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: (WebCore::TransformOperation::isRepresentableIn2D const): * platform/graphics/transforms/TransformOperations.h: (WebCore::TransformOperations::has3DOperation const): (WebCore::TransformOperations::isRepresentableIn2D const): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags): (WebCore::RenderLayerCompositor::updateCompositingPolicy): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::requiresCompositingForTransform const): (WebCore::RenderLayerCompositor::requiresCompositingForVideo const): (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const): (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const): (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const): (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const): (WebCore::operator<<): * rendering/RenderLayerCompositor.h: * testing/Internals.cpp: (WebCore::Internals::setCompositingPolicyOverride): (WebCore::Internals::compositingPolicyOverride const): * testing/Internals.h: * testing/Internals.idl: 2018-07-29 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234329. rdar://problem/42721126 [WK1] ASSERTION FAILED: renderer().repaintLayoutRects().m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint()) in WebCore::RenderLayer::updateLayerPositionsAfterScroll https://bugs.webkit.org/show_bug.cgi?id=188122 <rdar://problem/42584790> Reviewed by Simon Fraser. Source/WebCore: When ScrollView's m_paintsEntireContents flag flips due to layer backing changes, the repaint area transitions from visual to layout overflow. When this happens the cached repaint rects become invalid and they need to be recomputed. Currently there's no mechanism to trigger repaint cache invalidation from ScrollView. Skip assertion for now on WK1 (see webkit.org/b/188121) * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateLayerPositionsAfterScroll): LayoutTests: * platform/mac-wk1/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234329 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-27 Zalan Bujtas <zalan@apple.com> [WK1] ASSERTION FAILED: renderer().repaintLayoutRects().m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint()) in WebCore::RenderLayer::updateLayerPositionsAfterScroll https://bugs.webkit.org/show_bug.cgi?id=188122 <rdar://problem/42584790> Reviewed by Simon Fraser. When ScrollView's m_paintsEntireContents flag flips due to layer backing changes, the repaint area transitions from visual to layout overflow. When this happens the cached repaint rects become invalid and they need to be recomputed. Currently there's no mechanism to trigger repaint cache invalidation from ScrollView. Skip assertion for now on WK1 (see webkit.org/b/188121) * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateLayerPositionsAfterScroll): 2018-07-29 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234125. rdar://problem/42721214 CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey https://bugs.webkit.org/show_bug.cgi?id=187927 LayoutTests/imported/w3c: <rdar://problem/42516426> Reviewed by Chris Dumez. * web-platform-tests/IndexedDB/key-conversion-exceptions-expected.txt: Source/WebCore: Reviewed by Chris Dumez. IDBKeyData is valid only when each key of it is valid. Test: LayoutTests/storage/indexeddb/index-multientry.html * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::isValid const): * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyData::isValid const): Deleted. LayoutTests: <rdar://problem/42516426> Reviewed by Chris Dumez. Add a new test case in existing test file to cover the crash case and update the expecation accordingly. * storage/indexeddb/index-multientry-expected.txt: * storage/indexeddb/index-multientry-private-expected.txt: * storage/indexeddb/resources/index-multientry.js: (addData): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234125 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-23 Sihui Liu <sihui_liu@apple.com> CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey https://bugs.webkit.org/show_bug.cgi?id=187927 Reviewed by Chris Dumez. IDBKeyData is valid only when each key of it is valid. Test: LayoutTests/storage/indexeddb/index-multientry.html * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::isValid const): * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyData::isValid const): Deleted. 2018-07-27 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234318. rdar://problem/42467016 [WIN] Crash when trying to access store pages https://bugs.webkit.org/show_bug.cgi?id=188032 <rdar://problem/42467016> Reviewed by Brent Fulgham. The Windows implementation of GlyphBuffer has an additional member, m_offsets, which represents an additional offset to the position to paint each glyph. It also has two add() functions, one which appends to this vector, and one which doesn't. The one that doesn't append to the vector should never be called on Windows (because Windows requires this vector to be full). There were two situations where it was getting called: 1) Inside ComplexTextController 2) Inside display list playback Windows shouldn't be using ComplexTextController because the Windows implementation of this class isn't ready yet; instead it should be using UniscribeController. The display list playback code should be used on Windows. Rather than fix the function to append an offset, we actually don't need the m_offsets vector in the first place. Instead, we can do it the same way that the Cocoa ports do it, which is to bake the offsets into the glyph advances. This is possible because the GlyphBuffer doesn't need to distinguish between layout advances and paint advances, so we can bake them together and just put paint advances in the GlyphBuffer. This should be a small (probably within-the-noise) performance and memory improvement. * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::ComplexTextController): Make sure that ComplexTextController isn't used on Windows. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthOfTextRange const): Switch from ComplexTextController to UniscribeController on Windows. (WebCore::FontCascade::drawGlyphBuffer const): After deleting the m_offsets vector, there's no reason to consult it when drawing. * platform/graphics/GlyphBuffer.h: Remove m_offsets (WebCore::GlyphBuffer::clear): (WebCore::GlyphBuffer::advanceAt const): (WebCore::GlyphBuffer::add): (WebCore::GlyphBuffer::expandLastAdvance): (WebCore::GlyphBuffer::shrink): (WebCore::GlyphBuffer::swap): (WebCore::GlyphBuffer::offsetAt const): Deleted. * platform/graphics/win/FontCGWin.cpp: (WebCore::FontCascade::drawGlyphs): After deleting the m_offsets vector, there's no reason to consult it when drawing. * platform/graphics/win/FontCascadeDirect2D.cpp: (WebCore::FontCascade::drawGlyphs): Ditto. * platform/graphics/win/UniscribeController.cpp: (WebCore::UniscribeController::shapeAndPlaceItem): Bake in the offsets into the glyph advances. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234318 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-27 Myles C. Maxfield <mmaxfield@apple.com> [WIN] Crash when trying to access store pages https://bugs.webkit.org/show_bug.cgi?id=188032 <rdar://problem/42467016> Reviewed by Brent Fulgham. The Windows implementation of GlyphBuffer has an additional member, m_offsets, which represents an additional offset to the position to paint each glyph. It also has two add() functions, one which appends to this vector, and one which doesn't. The one that doesn't append to the vector should never be called on Windows (because Windows requires this vector to be full). There were two situations where it was getting called: 1) Inside ComplexTextController 2) Inside display list playback Windows shouldn't be using ComplexTextController because the Windows implementation of this class isn't ready yet; instead it should be using UniscribeController. The display list playback code should be used on Windows. Rather than fix the function to append an offset, we actually don't need the m_offsets vector in the first place. Instead, we can do it the same way that the Cocoa ports do it, which is to bake the offsets into the glyph advances. This is possible because the GlyphBuffer doesn't need to distinguish between layout advances and paint advances, so we can bake them together and just put paint advances in the GlyphBuffer. This should be a small (probably within-the-noise) performance and memory improvement. * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::ComplexTextController): Make sure that ComplexTextController isn't used on Windows. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::widthOfTextRange const): Switch from ComplexTextController to UniscribeController on Windows. (WebCore::FontCascade::drawGlyphBuffer const): After deleting the m_offsets vector, there's no reason to consult it when drawing. * platform/graphics/GlyphBuffer.h: Remove m_offsets (WebCore::GlyphBuffer::clear): (WebCore::GlyphBuffer::advanceAt const): (WebCore::GlyphBuffer::add): (WebCore::GlyphBuffer::expandLastAdvance): (WebCore::GlyphBuffer::shrink): (WebCore::GlyphBuffer::swap): (WebCore::GlyphBuffer::offsetAt const): Deleted. * platform/graphics/win/FontCGWin.cpp: (WebCore::FontCascade::drawGlyphs): After deleting the m_offsets vector, there's no reason to consult it when drawing. * platform/graphics/win/FontCascadeDirect2D.cpp: (WebCore::FontCascade::drawGlyphs): Ditto. * platform/graphics/win/UniscribeController.cpp: (WebCore::UniscribeController::shapeAndPlaceItem): Bake in the offsets into the glyph advances. 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234291. rdar://problem/42650439 [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree. https://bugs.webkit.org/show_bug.cgi?id=188087 <rdar://problem/42632124> Reviewed by Simon Fraser. Source/WebCore: Sibling composited layers prevent battery lifetime optimizations when in fullscreen. Test: compositing/no-compositing-when-fulll-screen-is-present.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::isDescendantOf const): * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::isDescendantOfFullScreenLayer): (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const): (WebCore::RenderLayerCompositor::requiresCompositingForPosition const): LayoutTests: * compositing/no-compositing-when-fulll-screen-is-present-expected.txt: Added. * compositing/no-compositing-when-fulll-screen-is-present.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234291 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-26 Zalan Bujtas <zalan@apple.com> [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree. https://bugs.webkit.org/show_bug.cgi?id=188087 <rdar://problem/42632124> Reviewed by Simon Fraser. Sibling composited layers prevent battery lifetime optimizations when in fullscreen. Test: compositing/no-compositing-when-fulll-screen-is-present.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::isDescendantOf const): * rendering/RenderLayer.h: * rendering/RenderLayerCompositor.cpp: (WebCore::isDescendantOfFullScreenLayer): (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const): (WebCore::RenderLayerCompositor::requiresCompositingForPosition const): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234275. rdar://problem/42650440 AX: nothing returned for various previous text marker APIs from one div/p node to another https://bugs.webkit.org/show_bug.cgi?id=188071 Reviewed by Chris Fleizach. Source/WebCore: TextIterator is emitting an extra '\n' at the end of the <p> node and there's no corresponding text node in the DOM tree, so we are not able to handle that for text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to the previous child text node. Test: accessibility/mac/text-marker-p-tags.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::traverseToOffsetInRange): LayoutTests: * accessibility/mac/text-marker-p-tags-expected.txt: Added. * accessibility/mac/text-marker-p-tags.html: Added. * accessibility/mac/text-marker-string-for-document-range-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234275 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-26 Nan Wang <n_wang@apple.com> AX: nothing returned for various previous text marker APIs from one div/p node to another https://bugs.webkit.org/show_bug.cgi?id=188071 Reviewed by Chris Fleizach. TextIterator is emitting an extra '\n' at the end of the <p> node and there's no corresponding text node in the DOM tree, so we are not able to handle that for text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to the previous child text node. Test: accessibility/mac/text-marker-p-tags.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::traverseToOffsetInRange): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234264. rdar://problem/42650373 Switching tabs should not close PiP window https://bugs.webkit.org/show_bug.cgi?id=188054 <rdar://problem/41212379> Reviewed by Jon Lee. No new tests, fixes an existing test. Prior to r233926, calling VideoFullscreenInterfaceMac::requestHideAndExitFullscreen was a noop. In r233926 it was updated to close the PiP window and was called from the PIPViewControllerDelegate selectors to close the PiP window. requestHideAndExitFullscreen is also called from WebPageProxy::viewDidLeaveWindow when the web view is removed from it window, so switching tabs also closed the PiP window. Revert the changes to requestHideAndExitFullscreen, and add a new method that is only used by the delegate to exit PiP. * platform/mac/VideoFullscreenInterfaceMac.h: (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Make this an empty, do-nothing method. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): Call requestHideAndExitPiP. (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): Ditto. (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP): Renamed from requestHideAndExitFullscreen. (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234264 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-26 Eric Carlson <eric.carlson@apple.com> Switching tabs should not close PiP window https://bugs.webkit.org/show_bug.cgi?id=188054 <rdar://problem/41212379> Reviewed by Jon Lee. No new tests, fixes an existing test. Prior to r233926, calling VideoFullscreenInterfaceMac::requestHideAndExitFullscreen was a noop. In r233926 it was updated to close the PiP window and was called from the PIPViewControllerDelegate selectors to close the PiP window. requestHideAndExitFullscreen is also called from WebPageProxy::viewDidLeaveWindow when the web view is removed from it window, so switching tabs also closed the PiP window. Revert the changes to requestHideAndExitFullscreen, and add a new method that is only used by the delegate to exit PiP. * platform/mac/VideoFullscreenInterfaceMac.h: (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Make this an empty, do-nothing method. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): Call requestHideAndExitPiP. (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): Ditto. (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP): Renamed from requestHideAndExitFullscreen. (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted. 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234078. rdar://problem/42490088 REGRESSION (r233974): Cannot close pip'd video; pops back into PiP. https://bugs.webkit.org/show_bug.cgi?id=187873 Reviewed by Jon Lee. When the PIP machinery on Mac wants to close the PIP window (due to the close button being clicked), it does not consult our -shouldClosePiP handler; it just tells us that we're going to close. So we never setup the necessary state on the WebProcess side and still think that our "targetIsFullscreen". When we get the "stop" action, just request exit fullscreen, but set up the _pipState to think we're already exiting (because we are). * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234078 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-20 Jer Noble <jer.noble@apple.com> REGRESSION (r233974): Cannot close pip'd video; pops back into PiP. https://bugs.webkit.org/show_bug.cgi?id=187873 Reviewed by Jon Lee. When the PIP machinery on Mac wants to close the PIP window (due to the close button being clicked), it does not consult our -shouldClosePiP handler; it just tells us that we're going to close. So we never setup the necessary state on the WebProcess side and still think that our "targetIsFullscreen". When we get the "stop" action, just request exit fullscreen, but set up the _pipState to think we're already exiting (because we are). * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234051. rdar://problem/42451584 First Auto-PiP from Fullscreen too small & animation blocks https://bugs.webkit.org/show_bug.cgi?id=187745 <rdar://problem/42316583> Reviewed by Jon Lee. 1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state ahead of time; we get notified that PiP has already started. The area of the code which does this just-in-time setup needs to set the video layer's frame so that the transform within the PiP window is correct. 2) We generate a placeholder image when going into fullscreen, but we need to do so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation time wherever AVPIVO is available. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::doSetup): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234051 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-20 Jer Noble <jer.noble@apple.com> First Auto-PiP from Fullscreen too small & animation blocks https://bugs.webkit.org/show_bug.cgi?id=187745 <rdar://problem/42316583> Reviewed by Jon Lee. 1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state ahead of time; we get notified that PiP has already started. The area of the code which does this just-in-time setup needs to set the video layer's frame so that the transform within the PiP window is correct. 2) We generate a placeholder image when going into fullscreen, but we need to do so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation time wherever AVPIVO is available. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::doSetup): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234044. rdar://problem/42433225 REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:] https://bugs.webkit.org/show_bug.cgi?id=187814 <rdar://problem/42391869> Reviewed by Eric Carlson. After r233969 caused models to disassociate themselves from interfaces, it is now possible that an VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the assertion no longer holds true. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234044 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-20 Jer Noble <jer.noble@apple.com> REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:] https://bugs.webkit.org/show_bug.cgi?id=187814 <rdar://problem/42391869> Reviewed by Eric Carlson. After r233969 caused models to disassociate themselves from interfaces, it is now possible that an VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the assertion no longer holds true. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233936. rdar://problem/42354941 Unreviewed API Test fix; restored a line inadventantly removed in r233926. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233936 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Jer Noble <jer.noble@apple.com> Unreviewed API Test fix; restored a line inadventantly removed in r233926. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233930. rdar://problem/42354941 Unreviewed build fix after r233926; BOOL !== bool. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233930 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Jer Noble <jer.noble@apple.com> Unreviewed build fix after r233926; BOOL !== bool. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233926. rdar://problem/42354941 PiP from Element Fullscreen should match AVKit's behavior https://bugs.webkit.org/show_bug.cgi?id=187623 Source/WebCore: Reviewed by Jon Lee. PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): Add an accessor for pictureInPictureWasStartedWhenEnteringBackground(): * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): Add VideoFullscreenModelClient virutal methods for PiP change notifications: * platform/cocoa/VideoFullscreenModel.h: (WebCore::VideoFullscreenModelClient::hasVideoChanged): (WebCore::VideoFullscreenModelClient::videoDimensionsChanged): (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::willExitPictureInPicture): (WebCore::VideoFullscreenModelClient::didExitPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture): * platform/cocoa/VideoFullscreenModelVideoElement.h: * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenModelVideoElement::willEnterPictureInPicture): (VideoFullscreenModelVideoElement::didEnterPictureInPicture): (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): (VideoFullscreenModelVideoElement::willExitPictureInPicture): (VideoFullscreenModelVideoElement::didExitPictureInPicture): (VideoFullscreenModelVideoElement::failedToExitPictureInPicture): * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::presentingViewController): (VideoFullscreenInterfaceAVKit::willStartPictureInPicture): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture): (VideoFullscreenInterfaceAVKit::willStopPictureInPicture): (VideoFullscreenInterfaceAVKit::didStopPictureInPicture): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): (VideoFullscreenInterfaceAVKit::doSetup): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::willEnterPictureInPicture): (VideoFullscreenControllerContext::didEnterPictureInPicture): (VideoFullscreenControllerContext::failedToEnterPictureInPicture): (VideoFullscreenControllerContext::willExitPictureInPicture): (VideoFullscreenControllerContext::didExitPictureInPicture): (VideoFullscreenControllerContext::failedToExitPictureInPicture): * platform/mac/VideoFullscreenInterfaceMac.h: (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]): (-[WebVideoFullscreenInterfaceMacObjC exitPIP]): (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]): (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): (WebCore::VideoFullscreenInterfaceMac::enterFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Source/WebCore/PAL: Reviewed by Jon Lee. * pal/spi/mac/PIPSPI.h: Source/WebKit: Reviewed by Jon Lee. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: (WebKit::PlaybackSessionManagerProxy::controlsManagerContextId const): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::willExitPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenModelContext::failedToExitPictureInPicture): (WebKit::VideoFullscreenManagerProxy::controlsManagerInterface): * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (WKFullScreenViewControllerVideoFullscreenModelClient::setParent): (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface): (WKFullScreenViewControllerVideoFullscreenModelClient::interface const): (-[WKFullScreenViewController initWithWebView:]): (-[WKFullScreenViewController dealloc]): (-[WKFullScreenViewController videoControlsManagerDidChange]): (-[WKFullScreenViewController ensurePiPAnimator]): (-[WKFullScreenViewController willEnterPictureInPicture]): (-[WKFullScreenViewController didEnterPictureInPicture]): (-[WKFullScreenViewController failedToEnterPictureInPicture]): (-[WKFullScreenViewController loadView]): (-[WKFullScreenViewController viewWillAppear:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::videoControlsManagerDidChange): * UIProcess/mac/WKFullScreenWindowController.h: * UIProcess/mac/WKFullScreenWindowController.mm: (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setParent): (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const): (-[WKFullScreenWindowController initWithWindow:webView:page:]): (-[WKFullScreenWindowController dealloc]): (-[WKFullScreenWindowController videoControlsManagerDidChange]): (-[WKFullScreenWindowController willEnterPictureInPicture]): Tools: <rdar://problem/41212379> Reviewed by Jon Lee. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.mm: Added. (-[ExitFullscreenOnEnterPiPUIDelegate _webView:hasVideoInPictureInPictureDidChange:]): (-[ExitFullscreenOnEnterPiPUIDelegate _webViewDidEnterFullscreen:]): (-[ExitFullscreenOnEnterPiPUIDelegate _webViewDidExitFullscreen:]): (TestWebKitAPI::TEST): LayoutTests: Reviewed by Jon Lee. * TestExpectations: * media/fullscreen-video-going-into-pip-expected.txt: Removed. * media/fullscreen-video-going-into-pip.html: Removed. * media/video-contained-in-fullscreen-element-going-into-pip-expected.txt: Removed. * media/video-contained-in-fullscreen-element-going-into-pip.html: Removed. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233926 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Jer Noble <jer.noble@apple.com> PiP from Element Fullscreen should match AVKit's behavior https://bugs.webkit.org/show_bug.cgi?id=187623 Reviewed by Jon Lee. PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): Add an accessor for pictureInPictureWasStartedWhenEnteringBackground(): * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): Add VideoFullscreenModelClient virutal methods for PiP change notifications: * platform/cocoa/VideoFullscreenModel.h: (WebCore::VideoFullscreenModelClient::hasVideoChanged): (WebCore::VideoFullscreenModelClient::videoDimensionsChanged): (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::willExitPictureInPicture): (WebCore::VideoFullscreenModelClient::didExitPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture): * platform/cocoa/VideoFullscreenModelVideoElement.h: * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenModelVideoElement::willEnterPictureInPicture): (VideoFullscreenModelVideoElement::didEnterPictureInPicture): (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): (VideoFullscreenModelVideoElement::willExitPictureInPicture): (VideoFullscreenModelVideoElement::didExitPictureInPicture): (VideoFullscreenModelVideoElement::failedToExitPictureInPicture): * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::presentingViewController): (VideoFullscreenInterfaceAVKit::willStartPictureInPicture): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture): (VideoFullscreenInterfaceAVKit::willStopPictureInPicture): (VideoFullscreenInterfaceAVKit::didStopPictureInPicture): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): (VideoFullscreenInterfaceAVKit::doSetup): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::willEnterPictureInPicture): (VideoFullscreenControllerContext::didEnterPictureInPicture): (VideoFullscreenControllerContext::failedToEnterPictureInPicture): (VideoFullscreenControllerContext::willExitPictureInPicture): (VideoFullscreenControllerContext::didExitPictureInPicture): (VideoFullscreenControllerContext::failedToExitPictureInPicture): * platform/mac/VideoFullscreenInterfaceMac.h: (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]): (-[WebVideoFullscreenInterfaceMacObjC exitPIP]): (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]): (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): (WebCore::VideoFullscreenInterfaceMac::enterFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): 2018-07-26 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234272. rdar://problem/42645434 Unreviewed, rolling out r234181 and r234189. https://bugs.webkit.org/show_bug.cgi?id=188075 These are not needed right now (Requested by thorton on #webkit). Reverted changesets: "Enable Web Content Filtering on watchOS" https://bugs.webkit.org/show_bug.cgi?id=187979 https://trac.webkit.org/changeset/234181 "HAVE(PARENTAL_CONTROLS) should be true on watchOS" https://bugs.webkit.org/show_bug.cgi?id=187985 https://trac.webkit.org/changeset/234189 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234272 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-26 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r234181 and r234189. https://bugs.webkit.org/show_bug.cgi?id=188075 These are not needed right now (Requested by thorton on #webkit). Reverted changesets: "Enable Web Content Filtering on watchOS" https://bugs.webkit.org/show_bug.cgi?id=187979 https://trac.webkit.org/changeset/234181 "HAVE(PARENTAL_CONTROLS) should be true on watchOS" https://bugs.webkit.org/show_bug.cgi?id=187985 https://trac.webkit.org/changeset/234189 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234222. rdar://problem/42612113 Build fix after r234215. Unreviewed. * rendering/RenderTheme.cpp: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234222 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-25 Zalan Bujtas <zalan@apple.com> Build fix after r234215. Unreviewed. * rendering/RenderTheme.cpp: 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234215. rdar://problem/42604541 REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes https://bugs.webkit.org/show_bug.cgi?id=188018 <rdar://problem/42517520> Reviewed by Dean Jackson. Source/WebCore: Manual rollout of r227577. Test: fast/overflow/line-clamp-with-text-shadow.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSProperties.json: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp): Deleted. * css/parser/CSSParserContext.cpp: (WebCore::CSSParserContext::CSSParserContext): * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::consumeLinesClamp): Deleted. * page/Settings.yaml: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willCreateColumns const): (WebCore::getHeightForLineCount): (WebCore::RenderBlockFlow::heightForLineCount): (WebCore::RenderBlockFlow::layoutExcludedChildren): (WebCore::RenderBlockFlow::logicalHeightForLineCount): Deleted. (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount): Deleted. * rendering/RenderBlockFlow.h: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): * rendering/RenderFragmentContainer.cpp: (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const): Deleted. * rendering/RenderFragmentContainer.h: * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::validateFragments): (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const): (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const): * rendering/RenderFragmentedFlow.h: * rendering/RenderLinesClampFlow.cpp: Removed. * rendering/RenderLinesClampFlow.h: Removed. * rendering/RenderLinesClampSet.cpp: Removed. * rendering/RenderLinesClampSet.h: Removed. * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): Deleted. (WebCore::RenderMultiColumnFlow::createMultiColumnSet): Deleted. * rendering/RenderMultiColumnFlow.h: (WebCore::RenderMultiColumnFlow::multiColumnBlockFlow const): Deleted. (WebCore::RenderMultiColumnFlow::hasColumnSpanner const): Deleted. (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const): Deleted. (WebCore::RenderMultiColumnFlow::columnCount const): Deleted. (WebCore::RenderMultiColumnFlow::columnWidth const): Deleted. (WebCore::RenderMultiColumnFlow::columnHeightAvailable const): Deleted. (WebCore::RenderMultiColumnFlow::setColumnHeightAvailable): Deleted. (WebCore::RenderMultiColumnFlow::inBalancingPass const): Deleted. (WebCore::RenderMultiColumnFlow::setInBalancingPass): Deleted. (WebCore::RenderMultiColumnFlow::needsHeightsRecalculation const): Deleted. (WebCore::RenderMultiColumnFlow::setNeedsHeightsRecalculation): Deleted. (WebCore::RenderMultiColumnFlow::shouldRelayoutForPagination const): Deleted. (WebCore::RenderMultiColumnFlow::setColumnCountAndWidth): Deleted. (WebCore::RenderMultiColumnFlow::progressionIsInline const): Deleted. (WebCore::RenderMultiColumnFlow::setProgressionIsInline): Deleted. (WebCore::RenderMultiColumnFlow::progressionIsReversed const): Deleted. (WebCore::RenderMultiColumnFlow::setProgressionIsReversed): Deleted. (WebCore::RenderMultiColumnFlow::spannerMap): Deleted. * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::collectLayerFragments): (WebCore::RenderMultiColumnSet::columnTranslationForOffset const): * rendering/RenderMultiColumnSet.h: (WebCore::RenderMultiColumnSet::multiColumnBlockFlow const): Deleted. (WebCore::RenderMultiColumnSet::multiColumnFlow const): Deleted. (WebCore::RenderMultiColumnSet::logicalTopInFragmentedFlow const): Deleted. (WebCore::RenderMultiColumnSet::logicalBottomInFragmentedFlow const): Deleted. (WebCore::RenderMultiColumnSet::logicalHeightInFragmentedFlow const): Deleted. (WebCore::RenderMultiColumnSet::computedColumnCount const): Deleted. (WebCore::RenderMultiColumnSet::computedColumnWidth const): Deleted. (WebCore::RenderMultiColumnSet::computedColumnHeight const): Deleted. (WebCore::RenderMultiColumnSet::columnHeightComputed const): Deleted. (WebCore::RenderMultiColumnSet::setComputedColumnWidthAndCount): Deleted. (WebCore::RenderMultiColumnSet::updateMinimumColumnHeight): Deleted. (WebCore::RenderMultiColumnSet::minimumColumnHeight const): Deleted. (WebCore::RenderMultiColumnSet::forcedBreaksCount const): Deleted. (WebCore::RenderMultiColumnSet::hasBeenFlowed const): Deleted. (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const): Deleted. (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::ContentRun): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::assumedImplicitBreaks const): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::assumeAnotherImplicitBreak): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::breakOffset const): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::columnLogicalHeight const): Deleted. * rendering/RenderObject.h: (WebCore::RenderObject::isRenderLinesClampFlow const): Deleted. (WebCore::RenderObject::isRenderLinesClampSet const): Deleted. * rendering/style/LineClampValue.h: (WebCore::LinesClampValue::LinesClampValue): Deleted. (WebCore::LinesClampValue::isNone const): Deleted. (WebCore::LinesClampValue::operator== const): Deleted. (WebCore::LinesClampValue::operator!= const): Deleted. (WebCore::LinesClampValue::start const): Deleted. (WebCore::LinesClampValue::end const): Deleted. (WebCore::LinesClampValue::center const): Deleted. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::lineClamp const): (WebCore::RenderStyle::setLineClamp): (WebCore::RenderStyle::initialLineClamp): (WebCore::RenderStyle::hasInlineColumnAxis const): (WebCore::RenderStyle::linesClamp const): Deleted. (WebCore::RenderStyle::hasLinesClamp const): Deleted. (WebCore::RenderStyle::setLinesClamp): Deleted. (WebCore::RenderStyle::initialLinesClamp): Deleted. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::isValidColumnSpanner): (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant): Source/WebKit: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_credentialsMessenger): LayoutTests: * fast/block/lines-clamp-advanced-expected.html: Removed. * fast/block/lines-clamp-advanced-rl-expected.html: Removed. * fast/block/lines-clamp-advanced-rl.html: Removed. * fast/block/lines-clamp-advanced.html: Removed. * fast/block/lines-clamp-basic-expected.html: Removed. * fast/block/lines-clamp-basic-rl-expected.html: Removed. * fast/block/lines-clamp-basic-rl.html: Removed. * fast/block/lines-clamp-basic.html: Removed. * fast/css/lines-clamp-parsing-expected.txt: Removed. * fast/css/lines-clamp-parsing.html: Removed. * fast/overflow/line-clamp-with-text-shadow-expected.html: Added. * fast/overflow/line-clamp-with-text-shadow.html: Added. * platform/ios-simulator-wk2/fast/overflow/line-clamp-expected.txt: Removed. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234215 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-25 Zalan Bujtas <zalan@apple.com> REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes https://bugs.webkit.org/show_bug.cgi?id=188018 <rdar://problem/42517520> Reviewed by Dean Jackson. Manual rollout of r227577. Test: fast/overflow/line-clamp-with-text-shadow.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSProperties.json: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp): Deleted. * css/parser/CSSParserContext.cpp: (WebCore::CSSParserContext::CSSParserContext): * css/parser/CSSParserContext.h: (WebCore::CSSParserContextHash::hash): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::consumeLinesClamp): Deleted. * page/Settings.yaml: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willCreateColumns const): (WebCore::getHeightForLineCount): (WebCore::RenderBlockFlow::heightForLineCount): (WebCore::RenderBlockFlow::layoutExcludedChildren): (WebCore::RenderBlockFlow::logicalHeightForLineCount): Deleted. (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount): Deleted. * rendering/RenderBlockFlow.h: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): * rendering/RenderFragmentContainer.cpp: (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const): Deleted. * rendering/RenderFragmentContainer.h: * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::validateFragments): (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const): (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const): * rendering/RenderFragmentedFlow.h: * rendering/RenderLinesClampFlow.cpp: Removed. * rendering/RenderLinesClampFlow.h: Removed. * rendering/RenderLinesClampSet.cpp: Removed. * rendering/RenderLinesClampSet.h: Removed. * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): Deleted. (WebCore::RenderMultiColumnFlow::createMultiColumnSet): Deleted. * rendering/RenderMultiColumnFlow.h: (WebCore::RenderMultiColumnFlow::multiColumnBlockFlow const): Deleted. (WebCore::RenderMultiColumnFlow::hasColumnSpanner const): Deleted. (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const): Deleted. (WebCore::RenderMultiColumnFlow::columnCount const): Deleted. (WebCore::RenderMultiColumnFlow::columnWidth const): Deleted. (WebCore::RenderMultiColumnFlow::columnHeightAvailable const): Deleted. (WebCore::RenderMultiColumnFlow::setColumnHeightAvailable): Deleted. (WebCore::RenderMultiColumnFlow::inBalancingPass const): Deleted. (WebCore::RenderMultiColumnFlow::setInBalancingPass): Deleted. (WebCore::RenderMultiColumnFlow::needsHeightsRecalculation const): Deleted. (WebCore::RenderMultiColumnFlow::setNeedsHeightsRecalculation): Deleted. (WebCore::RenderMultiColumnFlow::shouldRelayoutForPagination const): Deleted. (WebCore::RenderMultiColumnFlow::setColumnCountAndWidth): Deleted. (WebCore::RenderMultiColumnFlow::progressionIsInline const): Deleted. (WebCore::RenderMultiColumnFlow::setProgressionIsInline): Deleted. (WebCore::RenderMultiColumnFlow::progressionIsReversed const): Deleted. (WebCore::RenderMultiColumnFlow::setProgressionIsReversed): Deleted. (WebCore::RenderMultiColumnFlow::spannerMap): Deleted. * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::collectLayerFragments): (WebCore::RenderMultiColumnSet::columnTranslationForOffset const): * rendering/RenderMultiColumnSet.h: (WebCore::RenderMultiColumnSet::multiColumnBlockFlow const): Deleted. (WebCore::RenderMultiColumnSet::multiColumnFlow const): Deleted. (WebCore::RenderMultiColumnSet::logicalTopInFragmentedFlow const): Deleted. (WebCore::RenderMultiColumnSet::logicalBottomInFragmentedFlow const): Deleted. (WebCore::RenderMultiColumnSet::logicalHeightInFragmentedFlow const): Deleted. (WebCore::RenderMultiColumnSet::computedColumnCount const): Deleted. (WebCore::RenderMultiColumnSet::computedColumnWidth const): Deleted. (WebCore::RenderMultiColumnSet::computedColumnHeight const): Deleted. (WebCore::RenderMultiColumnSet::columnHeightComputed const): Deleted. (WebCore::RenderMultiColumnSet::setComputedColumnWidthAndCount): Deleted. (WebCore::RenderMultiColumnSet::updateMinimumColumnHeight): Deleted. (WebCore::RenderMultiColumnSet::minimumColumnHeight const): Deleted. (WebCore::RenderMultiColumnSet::forcedBreaksCount const): Deleted. (WebCore::RenderMultiColumnSet::hasBeenFlowed const): Deleted. (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const): Deleted. (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::ContentRun): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::assumedImplicitBreaks const): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::assumeAnotherImplicitBreak): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::breakOffset const): Deleted. (WebCore::RenderMultiColumnSet::ContentRun::columnLogicalHeight const): Deleted. * rendering/RenderObject.h: (WebCore::RenderObject::isRenderLinesClampFlow const): Deleted. (WebCore::RenderObject::isRenderLinesClampSet const): Deleted. * rendering/style/LineClampValue.h: (WebCore::LinesClampValue::LinesClampValue): Deleted. (WebCore::LinesClampValue::isNone const): Deleted. (WebCore::LinesClampValue::operator== const): Deleted. (WebCore::LinesClampValue::operator!= const): Deleted. (WebCore::LinesClampValue::start const): Deleted. (WebCore::LinesClampValue::end const): Deleted. (WebCore::LinesClampValue::center const): Deleted. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::lineClamp const): (WebCore::RenderStyle::setLineClamp): (WebCore::RenderStyle::initialLineClamp): (WebCore::RenderStyle::hasInlineColumnAxis const): (WebCore::RenderStyle::linesClamp const): Deleted. (WebCore::RenderStyle::hasLinesClamp const): Deleted. (WebCore::RenderStyle::setLinesClamp): Deleted. (WebCore::RenderStyle::initialLinesClamp): Deleted. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::isValidColumnSpanner): (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant): 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234181. rdar://problem/42604524 Enable Web Content Filtering on watchOS https://bugs.webkit.org/show_bug.cgi?id=187979 <rdar://problem/42559346> Reviewed by Wenson Hsieh. Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Source/WebKit: * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234181 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-24 Tim Horton <timothy_horton@apple.com> Enable Web Content Filtering on watchOS https://bugs.webkit.org/show_bug.cgi?id=187979 <rdar://problem/42559346> Reviewed by Wenson Hsieh. * Configurations/FeatureDefines.xcconfig: 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234149. rdar://problem/42604679 Cannot view PDF's on my.gov.au: "Refused to load https://my.gov.au/attachment/viewAttachment because it appears in neither the object-src directive nor the default-src directive of the Content Security Policy" https://bugs.webkit.org/show_bug.cgi?id=187870 <rdar://problem/41190880> Reviewed by Dean Jackson. Source/WebCore: Fixes an issue where opening attachments on my.gov.au would show a "Blocked Plug-in" message. Opening an attachment on my.gov.au opens a same-origin plugin document in a child window. Currently same-origin plugin documents inherit their CSP policy from their opener. If the opener's CSP policy disallows embedding plugins then the plugin document would be blocked from loading a plugin. For now we relax the inheritance model such that we only inherit the plugin-types and report-uri directives from the opener. Developers that want to block plugin content from being loaded in a same-origin child window must now serve such plugin content with a CSP policy that includes "object-src 'none'". This matches the behavior described in the second Note in section object-src of the CSP 3 spec: <https://w3c.github.io/webappsec-csp/#directive-object-src> (Editor's Draft, 10 July 2018). It also makes the behavior in WebKit more closely aligned with the behavior of Chrome and Firefox. Tests: http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window.html http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report.php http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window.html * dom/Document.cpp: (WebCore::Document::initContentSecurityPolicy): For plugin documents that have an opener call ContentSecurityPolicy::createPolicyForPluginDocumentFrom() to only inherit the plugin-types and report-uri directives from its opener's CSP policy. Otherwise, call ContentSecurityPolicy::copyStateFrom() to inherit all directives from the owner frame as we do now. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::createPolicyForPluginDocumentFrom): Create a new policy from the specified policy inheriting only the plugin-types and report-uri directives. * page/csp/ContentSecurityPolicy.h: Define a new PolicyFrom enumerator, InheritedForPluginDocument, for plugin documents loaded in a child window. * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::parse): When policyFrom is InheritedForPluginDocument then only recognize the plugin-types and report-uri directives when parsing the policy. LayoutTests: Add new tests and fix up the existing test http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window.html so that still tests a scenario where a same-origin plugin document loaded in a child window is blocked from loading its plugin now that that "object-src: 'none'" is no longer inherited by the plugin document. * http/tests/plugins/resources/plugin-document-alert-and-notify-done.pl: * http/tests/security/contentSecurityPolicy/resources/checkDidSameOriginChildWindowLoad.js: Added. (checkDidSameOriginChildWindowLoadAndNotifyDone): (checkDidLoad): * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window-expected.txt: Added. * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window.html: Added. * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-expected.txt: * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report-expected.txt: Added. * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report.php: Added. * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window.html: * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window-expected.txt: Added. * http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window.html: Added. * platform/ios/TestExpectations: Skip the included tests as we do not support plugins on iOS. * platform/win/TestExpectations: Skip the included tests as plugins do not seem to work on Windows. We currently skip many (if not all) plugin tests on Windows despite <rdar://problem/5074411> being marked as Closed (why?). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234149 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-24 Daniel Bates <dabates@apple.com> Cannot view PDF's on my.gov.au: "Refused to load https://my.gov.au/attachment/viewAttachment because it appears in neither the object-src directive nor the default-src directive of the Content Security Policy" https://bugs.webkit.org/show_bug.cgi?id=187870 <rdar://problem/41190880> Reviewed by Dean Jackson. Fixes an issue where opening attachments on my.gov.au would show a "Blocked Plug-in" message. Opening an attachment on my.gov.au opens a same-origin plugin document in a child window. Currently same-origin plugin documents inherit their CSP policy from their opener. If the opener's CSP policy disallows embedding plugins then the plugin document would be blocked from loading a plugin. For now we relax the inheritance model such that we only inherit the plugin-types and report-uri directives from the opener. Developers that want to block plugin content from being loaded in a same-origin child window must now serve such plugin content with a CSP policy that includes "object-src 'none'". This matches the behavior described in the second Note in section object-src of the CSP 3 spec: <https://w3c.github.io/webappsec-csp/#directive-object-src> (Editor's Draft, 10 July 2018). It also makes the behavior in WebKit more closely aligned with the behavior of Chrome and Firefox. Tests: http/tests/security/contentSecurityPolicy/same-origin-plugin-document-allowed-in-child-window.html http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window-report.php http/tests/security/contentSecurityPolicy/same-origin-plugin-document-with-csp-blocked-in-child-window.html * dom/Document.cpp: (WebCore::Document::initContentSecurityPolicy): For plugin documents that have an opener call ContentSecurityPolicy::createPolicyForPluginDocumentFrom() to only inherit the plugin-types and report-uri directives from its opener's CSP policy. Otherwise, call ContentSecurityPolicy::copyStateFrom() to inherit all directives from the owner frame as we do now. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::createPolicyForPluginDocumentFrom): Create a new policy from the specified policy inheriting only the plugin-types and report-uri directives. * page/csp/ContentSecurityPolicy.h: Define a new PolicyFrom enumerator, InheritedForPluginDocument, for plugin documents loaded in a child window. * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::parse): When policyFrom is InheritedForPluginDocument then only recognize the plugin-types and report-uri directives when parsing the policy. 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234140. rdar://problem/42606763 REGRESSION(r234055): inverted return values in MediaPlayer::wouldTaintOrigin() https://bugs.webkit.org/show_bug.cgi?id=187944 Reviewed by Carlos Garcia Campos. The MediaPlayer::wouldTaintOrigin(), as introduced in r234055, should return false when the URL protocol is `data:`, and should return true when the given SecurityOrigin cannot access the media URL. This matches behavior of CanvasRenderingContext::wouldTaintOrigin() which the new method falls back to when the MediaPlayerPrivate implementation doesn't or can't determine the would-taint result. This fixes a bunch of failing and timing-out WebGL test cases on ports using GStreamer (on which the MediaPlayerPrivate derivate doesn't implement the wouldTaintOrigin() method). * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::wouldTaintOrigin const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234140 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-24 Zan Dobersek <zdobersek@igalia.com> REGRESSION(r234055): inverted return values in MediaPlayer::wouldTaintOrigin() https://bugs.webkit.org/show_bug.cgi?id=187944 Reviewed by Carlos Garcia Campos. The MediaPlayer::wouldTaintOrigin(), as introduced in r234055, should return false when the URL protocol is `data:`, and should return true when the given SecurityOrigin cannot access the media URL. This matches behavior of CanvasRenderingContext::wouldTaintOrigin() which the new method falls back to when the MediaPlayerPrivate implementation doesn't or can't determine the would-taint result. This fixes a bunch of failing and timing-out WebGL test cases on ports using GStreamer (on which the MediaPlayerPrivate derivate doesn't implement the wouldTaintOrigin() method). * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::wouldTaintOrigin const): 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234113. rdar://problem/42604546 WebCore::primaryScreenDisplayID() always return 0 https://bugs.webkit.org/show_bug.cgi?id=187922 <rdar://problem/42286933> Reviewed by Geoffrey Garen. This function should return a valid display ID. No new tests. Testing this requires a dual monitor setup. * platform/mac/PlatformScreenMac.mm: (WebCore::primaryScreenDisplayID): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234113 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-23 Per Arne Vollan <pvollan@apple.com> WebCore::primaryScreenDisplayID() always return 0 https://bugs.webkit.org/show_bug.cgi?id=187922 <rdar://problem/42286933> Reviewed by Geoffrey Garen. This function should return a valid display ID. No new tests. Testing this requires a dual monitor setup. * platform/mac/PlatformScreenMac.mm: (WebCore::primaryScreenDisplayID): 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234112. rdar://problem/42604514 AX: Press tab to highlight items on a webpage is not working with voiceover enabled https://bugs.webkit.org/show_bug.cgi?id=187824 Reviewed by Zalan Bujtas. Source/WebCore: We are deferring posting focused element change notification when the document needs a style recalculation. However, we only perform the cache update after a layout is completed. Added a timer to perform the cache update in the next runloop when non-layout type of mutation happens. Test: accessibility/mac/tab-focus-post-notification.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::~AXObjectCache): (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded): (WebCore::AXObjectCache::performCacheUpdateTimerFired): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::performCacheUpdateTimerFired): LayoutTests: * accessibility/mac/tab-focus-post-notification-expected.txt: Added. * accessibility/mac/tab-focus-post-notification.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234112 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-23 Nan Wang <n_wang@apple.com> AX: Press tab to highlight items on a webpage is not working with voiceover enabled https://bugs.webkit.org/show_bug.cgi?id=187824 Reviewed by Zalan Bujtas. We are deferring posting focused element change notification when the document needs a style recalculation. However, we only perform the cache update after a layout is completed. Added a timer to perform the cache update in the next runloop when non-layout type of mutation happens. Test: accessibility/mac/tab-focus-post-notification.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::~AXObjectCache): (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded): (WebCore::AXObjectCache::performCacheUpdateTimerFired): * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::AXObjectCache): (WebCore::AXObjectCache::performCacheUpdateTimerFired): 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234111. rdar://problem/42604691 WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor https://bugs.webkit.org/show_bug.cgi?id=187910 <rdar://problem/42356526> Reviewed by Brent Fulgham. Source/WebCore: Add internals API that causes the ResourceLoadObserver to notify its observer, and avoid waiting for the 5 second delay. * testing/Internals.cpp: (WebCore::Internals::notifyResourceLoadObserver): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: The WebResourceLoadStatisticsStore was only removing itself as a MessageReceiver from the WebProcessProxy and that WebProcessProxy's connection was getting closed. However, it is possible for the WebResourceLoadStatisticsStore to get destroyed before this happens. This would lead to crashes such as the one in <rdar://problem/42356526>. To address the issue, we let the WebsiteDataStore take care of registering / unregistering the WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy. This is more reliable since the WebsiteDataStore is the one that subclasses WebProcessLifetimeObserver. Make sure the WebResourceLoadStatisticsStore is removed as a MessageReceiver whenever the WebsiteDataStore is destroyed or WebsiteDataStore::m_resourceLoadStatistics gets cleared. * UIProcess/WebResourceLoadStatisticsStore.cpp: * UIProcess/WebResourceLoadStatisticsStore.h: Drop logic to add / remove the WebResourceLoadStatisticsStore as a receiver now that the WebsiteDataStore takes care of it. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::~WebsiteDataStore): Make sure the WebResourceLoadStatisticsStore gets unregistered as a MessageReceiver from all associated WebProcessProxy objects when the WebsiteDataStore gets destroyed. (WebKit::WebsiteDataStore::webProcessWillOpenConnection): (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Register / Unregister the WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy. (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): Make sure we unregister the WebResourceLoadStatisticsStore as a MessageReceiver with all associated WebProcessProxy objects before we clear m_resourceLoadStatistics as this will causes the WebResourceLoadStatisticsStore to get destroyed. (WebKit::WebsiteDataStore::unregisterWebResourceLoadStatisticsStoreAsMessageReceiver): (WebKit::WebsiteDataStore::registerWebResourceLoadStatisticsStoreAsMessageReceiver): Add utility functions to register / unregister WebResourceLoadStatisticsStore as a MessageReceiver with all associated WebProcessProxy objects. (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): Register the new WebResourceLoadStatisticsStore as a MessageReceiver with all associated WebProcessProxy objects in case setResourceLoadStatisticsEnabled(true) gets called *after* we've already started WebProcesses. * UIProcess/WebsiteData/WebsiteDataStore.h: Tools: Add API test coverage. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm: (-[DisableITPDuringNavigationDelegate webView:didCommitNavigation:]): (-[DisableITPDuringNavigationDelegate webView:didFinishNavigation:]): (TEST): * TestWebKitAPI/Tests/WebKitCocoa/notify-resourceLoadObserver.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234111 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-23 Chris Dumez <cdumez@apple.com> WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor https://bugs.webkit.org/show_bug.cgi?id=187910 <rdar://problem/42356526> Reviewed by Brent Fulgham. Add internals API that causes the ResourceLoadObserver to notify its observer, and avoid waiting for the 5 second delay. * testing/Internals.cpp: (WebCore::Internals::notifyResourceLoadObserver): * testing/Internals.h: * testing/Internals.idl: 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234098. rdar://problem/42507862 fullscreen env() variables should have initial values https://bugs.webkit.org/show_bug.cgi?id=187897 <rdar://problem/42485682> Reviewed by Sam Weinig. Source/WebCore: The env() values for fullscreen properties need to be initialized, rather than wait for values to be set from WebKit. Without this, feature detection doesn't work, and properties won't parse correctly. Test: fullscreen/fullscreen-env-initial.html * dom/ConstantPropertyMap.cpp: (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values. (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it also updates the duration value. (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name. (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted. * dom/ConstantPropertyMap.h: * page/Page.cpp: (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it. * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable. (WebCore::Page::fullscreenAutoHideDuration const): LayoutTests: * fullscreen/fullscreen-env-initial-expected.html: Added. * fullscreen/fullscreen-env-initial.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234098 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-22 Dean Jackson <dino@apple.com> fullscreen env() variables should have initial values https://bugs.webkit.org/show_bug.cgi?id=187897 <rdar://problem/42485682> Reviewed by Sam Weinig. The env() values for fullscreen properties need to be initialized, rather than wait for values to be set from WebKit. Without this, feature detection doesn't work, and properties won't parse correctly. Test: fullscreen/fullscreen-env-initial.html * dom/ConstantPropertyMap.cpp: (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values. (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it also updates the duration value. (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name. (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted. * dom/ConstantPropertyMap.h: * page/Page.cpp: (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it. * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable. (WebCore::Page::fullscreenAutoHideDuration const): 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234064. rdar://problem/42451634 Picking a color from the color panel for typing attributes needs to inverse transform through color-filter https://bugs.webkit.org/show_bug.cgi?id=187846 Patch by Ryosuke Niwa <rniwa@apple.com> on 2018-07-20 Reviewed by Simon Fraser. Source/WebCore: This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders can get and set inverted colors using attributed strings for a selected text in an editable region. More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting into DOM so that the color visible to the user matches that's given to WebKit. Conversely, [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user. Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be applied of the same color filter before being presented to the user). Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html editing/execCommand/set-foreColor-with-color-filter-from-scripts.html editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html editing/style/set-backColor-with-color-filter.html editing/style/set-foreColor-with-color-filter.html * editing/EditingStyle.cpp: (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added. (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand which is not desirable, and won't work for background color. (WebCore::StyleChange::extractTextStyles): Ditto. * editing/EditingStyle.h: * editing/Editor.cpp: (WebCore::Editor::applyStyle): (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is set to InvertColor. * editing/Editor.h: * editing/EditorCommand.cpp: (WebCore::applyCommandToFrame): Added the aforementioned testing hook. * editing/cocoa/HTMLConverter.mm: (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this function to compute the font color in the selected text. Note that this function is mostly used for input methods so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter. Source/WebKitLegacy/mac: Invert the filtered font and background colors when using font panels, font pasteboard, and other Objective-C APIs. * WebView/WebHTMLView.mm: (-[WebHTMLView _applyStyleToSelection:withUndoAction:]): Share code with _applyEditingStyleToSelection. (-[WebHTMLView _applyEditingStyleToSelection:withUndoAction:]): Tools: Fixed the bug that testRunner.execCommand was using the second argument as the value. The second argument, aShowDefaultUI, should always be ignored in testRunner.execCommand, and the third argument should be used as the value. DumpRenderTree's implementation does this already. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::execCommand): * WebKitTestRunner/InjectedBundle/TestRunner.h: LayoutTests: Added tests to make sure foreground or background colors specified in execCommand don't get inverted. Fixed the test which was asserting that textInputController.attributedSubstringFromRange doesn't invert the color since that's exactly what WebKit embedders uses to compute the style for color pickers. Added new tests for copy & paste case using textInputController.legacyAttributedString. * editing/execCommand/set-backColor-with-color-filter-from-scripts-expected.txt: Added. * editing/execCommand/set-backColor-with-color-filter-from-scripts.html: Added. * editing/execCommand/set-foreColor-with-color-filter-from-scripts-expected.txt: Added. * editing/execCommand/set-foreColor-with-color-filter-from-scripts.html: Added. * editing/mac/attributed-string/attrib-string-range-with-color-filter-expected.txt: * editing/mac/attributed-string/attrib-string-range-with-color-filter.html: This test uses attributedSubstringFromRange, which implemented using editingAttributedStringFromRange in WebCore. Since this is exactly what WebKit embedders uses to compute the current style of the selected text, we need to invert the color here. This API's main clinet is input methods so this shouldn't affect other editing operations, in particular, copy and paste, which uses HTMLConverter. * editing/mac/attributed-string/attribute-string-for-copy-with-color-filter-expected.txt: Added. * editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html: Added. Make sure the attributed string generated for copy & paste does not invert foreground or background colors via textInputController.legacyAttributedString. This is testing HTMLConverter, not editingAttributedStringFromRange, used by WebKit embedders and input methods. * editing/mac/attributed-string/attributed-string-for-typing-with-color-filter-expected.txt: * editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html: Added background color in the test. * editing/style/set-backColor-with-color-filter-expected.txt: Added. * editing/style/set-backColor-with-color-filter.html: Added. * editing/style/set-foreColor-with-color-filter-expected.txt: Renamed from exec-command-foreColor-with-color-filter-expected.txt. * editing/style/set-foreColor-with-color-filter.html: Renamed from exec-command-foreColor-with-color-filter.html. Updated the test to use testRunner.execCommand which uses CommandFromMenuOrKeyBinding in applyCommandToFrame since we're trying to test the code path taken by WebKit embedders and font panel here. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234064 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-20 Ryosuke Niwa <rniwa@apple.com> Picking a color from the color panel for typing attributes needs to inverse transform through color-filter https://bugs.webkit.org/show_bug.cgi?id=187846 Reviewed by Simon Fraser. This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders can get and set inverted colors using attributed strings for a selected text in an editable region. More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting into DOM so that the color visible to the user matches that's given to WebKit. Conversely, [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user. Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be applied of the same color filter before being presented to the user). Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html editing/execCommand/set-foreColor-with-color-filter-from-scripts.html editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html editing/style/set-backColor-with-color-filter.html editing/style/set-foreColor-with-color-filter.html * editing/EditingStyle.cpp: (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added. (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand which is not desirable, and won't work for background color. (WebCore::StyleChange::extractTextStyles): Ditto. * editing/EditingStyle.h: * editing/Editor.cpp: (WebCore::Editor::applyStyle): (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is set to InvertColor. * editing/Editor.h: * editing/EditorCommand.cpp: (WebCore::applyCommandToFrame): Added the aforementioned testing hook. * editing/cocoa/HTMLConverter.mm: (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this function to compute the font color in the selected text. Note that this function is mostly used for input methods so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter. 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234055. rdar://problem/42451567 HLS resources with remote subresources will not taint canvasses. https://bugs.webkit.org/show_bug.cgi?id=187731 <rdar://problem/42290703> Reviewed by Brady Eidson. Source/WebCore: Test: http/tests/security/canvas-remote-read-remote-video-hls.html Most media sources are single-resource; they are accessed from a single origin. HLS manifests can contain many subresources from arbitrary origins, and canvases should be tainted when painted from media elements whose subresources were retrieved from tainting origins. Add a new method to HTMLMediaElement, wouldTaintOrigin(), taking a SecurityOrigin, and returning whether the media element would taint that origin. This gets piped all the way down to MediaPlayerPrivateAVFoundationObjC which uses WebCoreNSURLSession to track all the origins of all the responses which resulted from the media element's load. Drive-by fix: also fix this issue for media elements which render to an AudioContext. Drive-by fix #2: CanvasRenderingContext2DBase::createPattern() needs to check the return value of ImageBuffer::create() before using it. * Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didAttachRenderers): (WebCore::HTMLMediaElement::didDetachRenderers): (WebCore::HTMLMediaElement::scheduleUpdateShouldAutoplay): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::wouldTaintOrigin const): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::wouldTaintOrigin): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::createPattern): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::wouldTaintOrigin const): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::hasSingleSecurityOrigin const): (WebCore::MediaPlayerPrivateInterface::wouldTaintOrigin const): * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::update): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin const): * platform/network/cocoa/WebCoreNSURLSession.h: * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSession task:didReceiveResponseFromOrigin:]): (-[WebCoreNSURLSession wouldTaintOrigin:]): (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): LayoutTests: * http/tests/media/resources/hls/test-vod-localhost.m3u8: Added. * http/tests/security/canvas-remote-read-remote-video-hls-expected.txt: Added. * http/tests/security/canvas-remote-read-remote-video-hls.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234055 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Jer Noble <jer.noble@apple.com> HLS resources with remote subresources will not taint canvasses. https://bugs.webkit.org/show_bug.cgi?id=187731 <rdar://problem/42290703> Reviewed by Brady Eidson. Test: http/tests/security/canvas-remote-read-remote-video-hls.html Most media sources are single-resource; they are accessed from a single origin. HLS manifests can contain many subresources from arbitrary origins, and canvases should be tainted when painted from media elements whose subresources were retrieved from tainting origins. Add a new method to HTMLMediaElement, wouldTaintOrigin(), taking a SecurityOrigin, and returning whether the media element would taint that origin. This gets piped all the way down to MediaPlayerPrivateAVFoundationObjC which uses WebCoreNSURLSession to track all the origins of all the responses which resulted from the media element's load. Drive-by fix: also fix this issue for media elements which render to an AudioContext. Drive-by fix #2: CanvasRenderingContext2DBase::createPattern() needs to check the return value of ImageBuffer::create() before using it. * Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didAttachRenderers): (WebCore::HTMLMediaElement::didDetachRenderers): (WebCore::HTMLMediaElement::scheduleUpdateShouldAutoplay): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::wouldTaintOrigin const): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::wouldTaintOrigin): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::createPattern): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::wouldTaintOrigin const): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::hasSingleSecurityOrigin const): (WebCore::MediaPlayerPrivateInterface::wouldTaintOrigin const): * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::update): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin const): * platform/network/cocoa/WebCoreNSURLSession.h: * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSession task:didReceiveResponseFromOrigin:]): (-[WebCoreNSURLSession wouldTaintOrigin:]): (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]): 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234053. rdar://problem/42451651 Update FrameView::paintContents to use release logging. https://bugs.webkit.org/show_bug.cgi?id=187854 <rdar://problem/42432371> Reviewed by Simon Fraser. Adding release logging helps identifying blank content cases. * page/FrameView.cpp: (WebCore::FrameView::paintContents): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234053 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-20 Zalan Bujtas <zalan@apple.com> Update FrameView::paintContents to use release logging. https://bugs.webkit.org/show_bug.cgi?id=187854 <rdar://problem/42432371> Reviewed by Simon Fraser. Adding release logging helps identifying blank content cases. * page/FrameView.cpp: (WebCore::FrameView::paintContents): 2018-07-25 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234177. rdar://problem/42586717 Unreviewed, rolling out r233496 and r233571. Likely cause of <rdar://problem/42160890> and <rdar://problem/42329658> as ActiveDOMObjects can now be constructed / destroyed while we are iterating over them. Reverted changesets: "Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()" https://bugs.webkit.org/show_bug.cgi?id=187284 https://trac.webkit.org/changeset/233496 "REGRESSION(r233496): macOS Sierra hits debug assertions in TrackListBase::suspend" https://bugs.webkit.org/show_bug.cgi?id=187378 https://trac.webkit.org/changeset/233571 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234177 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-24 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r233496 and r233571. Likely cause of <rdar://problem/42160890> and <rdar://problem/42329658> as ActiveDOMObjects can now be constructed / destroyed while we are iterating over them. Reverted changesets: "Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()" https://bugs.webkit.org/show_bug.cgi?id=187284 https://trac.webkit.org/changeset/233496 "REGRESSION(r233496): macOS Sierra hits debug assertions in TrackListBase::suspend" https://bugs.webkit.org/show_bug.cgi?id=187378 https://trac.webkit.org/changeset/233571 2018-07-24 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234158. rdar://problem/42551556 [Cocoa] Stop crashing in lastResortFallbackFont() https://bugs.webkit.org/show_bug.cgi?id=187936 Reviewed by Jon Lee. CoreText can get into a state where both Times and Lucida Grande are inaccessible. Instead of crashing, we should use the real LastResort, which is backed by a section in the .rodata of the CoreText dylib, and as such should always exist. * platform/graphics/FontCache.cpp: (WebCore::FontCache::fontForFamily): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::lastResortFallbackFont): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234158 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-24 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Stop crashing in lastResortFallbackFont() https://bugs.webkit.org/show_bug.cgi?id=187936 Reviewed by Jon Lee. CoreText can get into a state where both Times and Lucida Grande are inaccessible. Instead of crashing, we should use the real LastResort, which is backed by a section in the .rodata of the CoreText dylib, and as such should always exist. * platform/graphics/FontCache.cpp: (WebCore::FontCache::fontForFamily): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::lastResortFallbackFont): 2018-07-23 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234073. rdar://problem/42451644 Remove completed animations from GraphicsLayer, thus avoiding excessive backing store allocation https://bugs.webkit.org/show_bug.cgi?id=187844 rdar://problem/40387294 Reviewed by Dean Jackson. Source/WebCore: A keyframe animation which animates 3D transforms, and is fill-forwards, currently leaves the GraphicsLayer in a state where it has a "running" animation. However, the logic that computes animation extent in RenderLayerBacking::updateGeometry() only does so for running or paused animations. GraphicsLayer then thinks that it has an active transform animation with unknown extent, and refuses to detach its backing store. This triggers excessive layer creation on some sites (e.g. https://www.kqed.org). Fix by always removing animations from the GraphicsLayer when they finish, whether or not they fill forwards. This is done by having KeyframeAnimation::onAnimationEnd() always call endAnimation(). This change only fixes the non-Web Animation code path. webkit.org/b/187845 exists to fix the other code path. Also improve some logging that would have revealed this problem sooner. Test: compositing/backing/backing-store-attachment-fill-forwards-animation.html * page/animation/AnimationBase.h: (WebCore::AnimationBase::endAnimation): * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::endAnimation): * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::endAnimation): (WebCore::KeyframeAnimation::onAnimationEnd): * page/animation/KeyframeAnimation.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::addAnimation): (WebCore::GraphicsLayerCA::updateCoverage): LayoutTests: * compositing/backing/backing-store-attachment-fill-forwards-animation-expected.txt: Added. * compositing/backing/backing-store-attachment-fill-forwards-animation.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234073 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Simon Fraser <simon.fraser@apple.com> Remove completed animations from GraphicsLayer, thus avoiding excessive backing store allocation https://bugs.webkit.org/show_bug.cgi?id=187844 rdar://problem/40387294 Reviewed by Dean Jackson. A keyframe animation which animates 3D transforms, and is fill-forwards, currently leaves the GraphicsLayer in a state where it has a "running" animation. However, the logic that computes animation extent in RenderLayerBacking::updateGeometry() only does so for running or paused animations. GraphicsLayer then thinks that it has an active transform animation with unknown extent, and refuses to detach its backing store. This triggers excessive layer creation on some sites (e.g. https://www.kqed.org). Fix by always removing animations from the GraphicsLayer when they finish, whether or not they fill forwards. This is done by having KeyframeAnimation::onAnimationEnd() always call endAnimation(). This change only fixes the non-Web Animation code path. webkit.org/b/187845 exists to fix the other code path. Also improve some logging that would have revealed this problem sooner. Test: compositing/backing/backing-store-attachment-fill-forwards-animation.html * page/animation/AnimationBase.h: (WebCore::AnimationBase::endAnimation): * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::endAnimation): * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::endAnimation): (WebCore::KeyframeAnimation::onAnimationEnd): * page/animation/KeyframeAnimation.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::addAnimation): (WebCore::GraphicsLayerCA::updateCoverage): 2018-07-20 Babak Shafiei <bshafiei@apple.com> Revert r233926. rdar://problem/42446531 2018-07-20 Babak Shafiei <bshafiei@apple.com> Revert r233930. rdar://problem/42446531 2018-07-20 Babak Shafiei <bshafiei@apple.com> Revert r233936. rdar://problem/42446531 2018-07-20 Babak Shafiei <bshafiei@apple.com> Revert r234044. rdar://problem/42433225 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234045. rdar://problem/42434024 FetchResponse should close its stream when loading finishes https://bugs.webkit.org/show_bug.cgi?id=187790 Reviewed by Chris Dumez. It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time. Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source. Did a minor refactoring to expose the error description when loading fails as part of the rejected promise. This is consistent to errors sent back through callbacks. Covered by existing tests. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::~FetchBodyOwner): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::FetchBodySource): (WebCore::FetchBodySource::setActive): (WebCore::FetchBodySource::setInactive): (WebCore::FetchBodySource::doStart): (WebCore::FetchBodySource::doPull): (WebCore::FetchBodySource::doCancel): (WebCore::FetchBodySource::cleanBodyOwner): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234045 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-20 Youenn Fablet <youenn@apple.com> FetchResponse should close its stream when loading finishes https://bugs.webkit.org/show_bug.cgi?id=187790 Reviewed by Chris Dumez. It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time. Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source. Did a minor refactoring to expose the error description when loading fails as part of the rejected promise. This is consistent to errors sent back through callbacks. Covered by existing tests. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::~FetchBodyOwner): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::FetchBodySource): (WebCore::FetchBodySource::setActive): (WebCore::FetchBodySource::setInactive): (WebCore::FetchBodySource::doStart): (WebCore::FetchBodySource::doPull): (WebCore::FetchBodySource::doCancel): (WebCore::FetchBodySource::cleanBodyOwner): * Modules/fetch/FetchBodySource.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didFail): 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234044. rdar://problem/42433225 REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:] https://bugs.webkit.org/show_bug.cgi?id=187814 <rdar://problem/42391869> Reviewed by Eric Carlson. After r233969 caused models to disassociate themselves from interfaces, it is now possible that an VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the assertion no longer holds true. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234044 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-20 Jer Noble <jer.noble@apple.com> REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:] https://bugs.webkit.org/show_bug.cgi?id=187814 <rdar://problem/42391869> Reviewed by Eric Carlson. After r233969 caused models to disassociate themselves from interfaces, it is now possible that an VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the assertion no longer holds true. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234002. rdar://problem/42432954 REGRESSION(r233926): media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html is a TIMEOUT failure https://bugs.webkit.org/show_bug.cgi?id=187813 Reviewed by Jon Lee. In r233926, we changed the behavior of entering PiP to exit fullscreen only after entering PiP completes. The test in question will immediately request "inline" presentation mode once the PiP animation begins, and thus it's asking to "exit fullscreen" when both in standard fullscreen and also in PiP. The fix is not to bail out early if we're in standard (element) fullscreen, but to allow the remaining steps to complete and exit PiP as well. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::exitFullscreen): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234002 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Jer Noble <jer.noble@apple.com> REGRESSION(r233926): media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html is a TIMEOUT failure https://bugs.webkit.org/show_bug.cgi?id=187813 Reviewed by Jon Lee. In r233926, we changed the behavior of entering PiP to exit fullscreen only after entering PiP completes. The test in question will immediately request "inline" presentation mode once the PiP animation begins, and thus it's asking to "exit fullscreen" when both in standard fullscreen and also in PiP. The fix is not to bail out early if we're in standard (element) fullscreen, but to allow the remaining steps to complete and exit PiP as well. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::exitFullscreen): 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234013. rdar://problem/42417130 Crash under WebCore::DocumentWriter::addData() https://bugs.webkit.org/show_bug.cgi?id=187819 <rdar://problem/41328743> Reviewed by Brady Eidson. When AppCache is used a DocumentLoader may start a NetworkLoad even though it has substitute data. In DocumentLoader::continueAfterContentPolicy(), if we have substitute data we commit this data and call finishLoad(). However, if the case where there was a NetworkLoad started, we'll send the ContinueDidReceiveResponse IPC back to the network process and it will start sending us data for the load. This could lead to crashes such as <rdar://problem/41328743> since the DocumentLoader has already committed data and finished loading when it gets the data from the network process. To address the issue, we now call clearMainResource() in continueAfterContentPolicy(), after we've decided to commit the substitute data. This effectively removes the DocumentLoader as a client of the CachedResource so that its will not be notified of following load progress. We do not cancel the load as other CachedResourceClients may be interested in the load (ApplicationCacheResourceLoader in particular, in order to update its cached data). * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234013 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Chris Dumez <cdumez@apple.com> Crash under WebCore::DocumentWriter::addData() https://bugs.webkit.org/show_bug.cgi?id=187819 <rdar://problem/41328743> Reviewed by Brady Eidson. When AppCache is used a DocumentLoader may start a NetworkLoad even though it has substitute data. In DocumentLoader::continueAfterContentPolicy(), if we have substitute data we commit this data and call finishLoad(). However, if the case where there was a NetworkLoad started, we'll send the ContinueDidReceiveResponse IPC back to the network process and it will start sending us data for the load. This could lead to crashes such as <rdar://problem/41328743> since the DocumentLoader has already committed data and finished loading when it gets the data from the network process. To address the issue, we now call clearMainResource() in continueAfterContentPolicy(), after we've decided to commit the substitute data. This effectively removes the DocumentLoader as a client of the CachedResource so that its will not be notified of following load progress. We do not cancel the load as other CachedResourceClients may be interested in the load (ApplicationCacheResourceLoader in particular, in order to update its cached data). * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234007. rdar://problem/42417134 Ensure DocumentTimeline is kept alive until the VM::whenIdle callback is called https://bugs.webkit.org/show_bug.cgi?id=187692 Reviewed by Ryosuke Niwa. Ensure we keep the DocumentTimeline alive until the VM::whenIdle callback is called. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::currentTime): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234007 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Antoine Quint <graouts@apple.com> Ensure DocumentTimeline is kept alive until the VM::whenIdle callback is called https://bugs.webkit.org/show_bug.cgi?id=187692 Reviewed by Ryosuke Niwa. Ensure we keep the DocumentTimeline alive until the VM::whenIdle callback is called. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::currentTime): 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r234005. rdar://problem/42417113 Setting foreground color when editing should take color-filter into account, and report the correct foreground color for collapsed selections https://bugs.webkit.org/show_bug.cgi?id=187778 Reviewed by Ryosuke Niwa. Source/WebCore: Fix two aspects of editing with color-filter: 1. When setting foreground color, inverse-transform the color through -apple-color-filter so that the user gets the color they chose when in Dark Mode. Tested by editing/style/exec-command-foreColor-with-color-filter.html. 2. When retrieving the style of the collapsed selection, take color filter into account so that color picker reflects the color the users sees, instead of the content color. Tested by editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html Add two additional tests that ensure that -apple-color-filter does not impact the NSAttributedString code path, since -apple-color-filter should not affect the behavior of Copy. Tests: editing/mac/attributed-string/attrib-string-colors-with-color-filter.html editing/mac/attributed-string/attrib-string-range-with-color-filter.html editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html editing/style/exec-command-foreColor-with-color-filter.html * editing/EditingStyle.cpp: (WebCore::StyleChange::StyleChange): (WebCore::StyleChange::extractTextStyles): * editing/EditingStyle.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::fontAttributesForSelectionStart const): * platform/graphics/filters/FilterOperation.cpp: (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): * platform/graphics/filters/FilterOperations.h: LayoutTests: * editing/mac/attributed-string/attrib-string-colors-with-color-filter-expected.txt: Added. * editing/mac/attributed-string/attrib-string-colors-with-color-filter.html: Added. * editing/mac/attributed-string/attrib-string-range-with-color-filter-expected.txt: Added. * editing/mac/attributed-string/attrib-string-range-with-color-filter.html: Added. * editing/mac/attributed-string/attributed-string-for-typing-with-color-filter-expected.txt: Added. * editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html: Added. * editing/style/exec-command-foreColor-with-color-filter-expected.txt: Added. * editing/style/exec-command-foreColor-with-color-filter.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234005 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Simon Fraser <simon.fraser@apple.com> Setting foreground color when editing should take color-filter into account, and report the correct foreground color for collapsed selections https://bugs.webkit.org/show_bug.cgi?id=187778 Reviewed by Ryosuke Niwa. Fix two aspects of editing with color-filter: 1. When setting foreground color, inverse-transform the color through -apple-color-filter so that the user gets the color they chose when in Dark Mode. Tested by editing/style/exec-command-foreColor-with-color-filter.html. 2. When retrieving the style of the collapsed selection, take color filter into account so that color picker reflects the color the users sees, instead of the content color. Tested by editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html Add two additional tests that ensure that -apple-color-filter does not impact the NSAttributedString code path, since -apple-color-filter should not affect the behavior of Copy. Tests: editing/mac/attributed-string/attrib-string-colors-with-color-filter.html editing/mac/attributed-string/attrib-string-range-with-color-filter.html editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html editing/style/exec-command-foreColor-with-color-filter.html * editing/EditingStyle.cpp: (WebCore::StyleChange::StyleChange): (WebCore::StyleChange::extractTextStyles): * editing/EditingStyle.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::fontAttributesForSelectionStart const): * platform/graphics/filters/FilterOperation.cpp: (WebCore::InvertLightnessFilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::inverseTransformColor const): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): (WebCore::FilterOperations::inverseTransformColor const): * platform/graphics/filters/FilterOperations.h: 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233992. rdar://problem/42417109 Update iOS fullscreen alert text again https://bugs.webkit.org/show_bug.cgi?id=187797 rdar://problem/42373783 Reviewed by Jer Noble. Source/WebCore: * English.lproj/Localizable.strings: Source/WebKit: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController _showPhishingAlert]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233992 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Jon Lee <jonlee@apple.com> Update iOS fullscreen alert text again https://bugs.webkit.org/show_bug.cgi?id=187797 rdar://problem/42373783 Reviewed by Jer Noble. * English.lproj/Localizable.strings: 2018-07-20 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233982. rdar://problem/42389208 Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume() https://bugs.webkit.org/show_bug.cgi?id=187793 <rdar://problem/42308469> Patch by Antoine Quint <graouts@apple.com> on 2018-07-19 Reviewed by Chris Dumez. Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad(). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::contextDestroyed): (WebCore::HTMLMediaElement::stop): (WebCore::HTMLMediaElement::suspend): (WebCore::HTMLMediaElement::resume): * html/HTMLMediaElement.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233982 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Antoine Quint <graouts@apple.com> Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume() https://bugs.webkit.org/show_bug.cgi?id=187793 <rdar://problem/42308469> Reviewed by Chris Dumez. Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad(). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::contextDestroyed): (WebCore::HTMLMediaElement::stop): (WebCore::HTMLMediaElement::suspend): (WebCore::HTMLMediaElement::resume): * html/HTMLMediaElement.h: 2018-07-19 Babak Shafiei <bshafiei@apple.com> Revert r233982. rdar://problem/42389208 2018-07-19 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233982. rdar://problem/42389208 Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume() https://bugs.webkit.org/show_bug.cgi?id=187793 <rdar://problem/42308469> Patch by Antoine Quint <graouts@apple.com> on 2018-07-19 Reviewed by Chris Dumez. Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad(). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::contextDestroyed): (WebCore::HTMLMediaElement::stop): (WebCore::HTMLMediaElement::suspend): (WebCore::HTMLMediaElement::resume): * html/HTMLMediaElement.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233982 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-19 Antoine Quint <graouts@apple.com> Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume() https://bugs.webkit.org/show_bug.cgi?id=187793 <rdar://problem/42308469> Reviewed by Chris Dumez. Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad(). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::contextDestroyed): (WebCore::HTMLMediaElement::stop): (WebCore::HTMLMediaElement::suspend): (WebCore::HTMLMediaElement::resume): * html/HTMLMediaElement.h: 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233915. rdar://problem/42345407 Add SPI to defer running async script until after document load https://bugs.webkit.org/show_bug.cgi?id=187748 <rdar://problem/42317378> Reviewed by Ryosuke Niwa and Tim Horton. Source/WebCore: On watchOS, we currently observe that time-consuming async scripts can block the first paint of Reader, leaving the user with a blank screen for tens of seconds. One way to mitigate this is to defer async script execution until after document load (i.e. the same timing as DOMContentLoaded). This patch introduces an SPI configuration allowing internal clients to defer execution of asynchronous script until after document load; this, in combination with the parser yielding token introduced in r233891, allows Safari on watchOS to avoid being blocked on slow script execution before the first paint of the Reader page on most article-like pages. See below for more details. Test: RunScriptAfterDocumentLoad.ExecutionOrderOfScriptsInDocument * dom/Document.cpp: (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const): (WebCore::Document::finishedParsing): Notify ScriptRunner when the Document has finished parsing, and is about to fire DOMContentLoaded. * dom/Document.h: * dom/ScriptRunner.cpp: (WebCore::ScriptRunner::documentFinishedParsing): When the document is finished parsing, kick off the script execution timer if needed to run any async script that has been deferred. (WebCore::ScriptRunner::notifyFinished): (WebCore::ScriptRunner::timerFired): Instead of always taking from the list of async scripts to execute, check our document to see whether we should defer this until after document load. If so, ignore `m_scriptsToExecuteSoon`. * dom/ScriptRunner.h: * page/Settings.yaml: Add a WebCore setting for this behavior. Source/WebKit: Add plumbing for a new ShouldDeferAsynchronousScriptsUntilAfterDocumentLoad configuration that determines whether async script execution should be deferred until document load (i.e. DOMContentLoaded). This configuration defaults to NO on all platforms. See WebCore ChangeLog for more detail. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad]): (-[WKWebViewConfiguration _setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Tools: Add an API test to verify that when the deferred async script configuration is set, async scripts will be executed after the DOMContentLoaded event. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/RunScriptAfterDocumentLoad.mm: Added. (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233915 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Wenson Hsieh <wenson_hsieh@apple.com> Add SPI to defer running async script until after document load https://bugs.webkit.org/show_bug.cgi?id=187748 <rdar://problem/42317378> Reviewed by Ryosuke Niwa and Tim Horton. On watchOS, we currently observe that time-consuming async scripts can block the first paint of Reader, leaving the user with a blank screen for tens of seconds. One way to mitigate this is to defer async script execution until after document load (i.e. the same timing as DOMContentLoaded). This patch introduces an SPI configuration allowing internal clients to defer execution of asynchronous script until after document load; this, in combination with the parser yielding token introduced in r233891, allows Safari on watchOS to avoid being blocked on slow script execution before the first paint of the Reader page on most article-like pages. See below for more details. Test: RunScriptAfterDocumentLoad.ExecutionOrderOfScriptsInDocument * dom/Document.cpp: (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const): (WebCore::Document::finishedParsing): Notify ScriptRunner when the Document has finished parsing, and is about to fire DOMContentLoaded. * dom/Document.h: * dom/ScriptRunner.cpp: (WebCore::ScriptRunner::documentFinishedParsing): When the document is finished parsing, kick off the script execution timer if needed to run any async script that has been deferred. (WebCore::ScriptRunner::notifyFinished): (WebCore::ScriptRunner::timerFired): Instead of always taking from the list of async scripts to execute, check our document to see whether we should defer this until after document load. If so, ignore `m_scriptsToExecuteSoon`. * dom/ScriptRunner.h: * page/Settings.yaml: Add a WebCore setting for this behavior. 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233891. rdar://problem/42345327 Add an SPI hook to allow clients to yield document parsing and script execution https://bugs.webkit.org/show_bug.cgi?id=187682 <rdar://problem/42207453> Reviewed by Ryosuke Niwa. Source/WebCore: Using a single web process for both the Reader page and original web page on watchOS has multiple benefits, including: (1) allowing the user to bail out of Reader and view the original web page without having to load it again, and (2) improving the bringup time of the Reader page, since subresources are already cached in process and we don't eat the additional cost of a web process launch if prewarming fails. However, this has some drawbacks as well, one of which is that main thread work being done on behalf of the original page may contend with work being done to load and render the Reader page. This is especially bad when the page is in the middle of executing heavy script after Safari has already detected that the Reader version of the page is available, but before it has finished loading the Reader page. The result is that script on the original page may block the first paint of the Reader page (on New York Times articles, this often leads to an apparent page load time of 25-35 seconds before the user sees anything besides a blank screen). To mitigate this, we introduce a way for injected bundle clients to yield parsing and async script execution on a document. This capability is surfaced in the form of an opaque token which clients may request from a WKDOMDocument. Construction of the token causes the document to begin yielding and defer execution of previously scheduled scripts, only if there were no active tokens on the document already. Similarly, destruction of all active tokens on the document causes it to stop yielding and resume execution of scripts if needed. Tests: ParserYieldTokenTests.PreventDocumentLoadByTakingParserYieldToken ParserYieldTokenTests.TakeMultipleParserYieldTokens ParserYieldTokenTests.DeferredScriptExecutesBeforeDocumentLoadWhenTakingParserYieldToken ParserYieldTokenTests.AsyncScriptRunsWhenFetched * dom/Document.cpp: (WebCore::Document::implicitOpen): If the parser yield token was taken before the document's parser was created, tell the parser's scheduler to start yielding immediately after creation. (WebCore::DocumentParserYieldToken::DocumentParserYieldToken): (WebCore::DocumentParserYieldToken::~DocumentParserYieldToken): * dom/Document.h: Introduce a parser yield count to Document; as long as this count is greater than 0, we consider the Document to have active yield tokens. When constructing or destroying a ParserYieldToken, we increment and decrement the parser yield count (respectively). (WebCore::Document::createParserYieldToken): (WebCore::Document::hasActiveParserYieldToken const): * dom/DocumentParser.h: (WebCore::DocumentParser::didBeginYieldingParser): (WebCore::DocumentParser::didEndYieldingParser): Hooks for Document to tell its parser that we've started or finished yielding. This updates a flag on the parser's scheduler which is consulted when we determine whether to yield before a pumping token or executing script. * dom/ScriptRunner.cpp: (WebCore::ScriptRunner::resume): (WebCore::ScriptRunner::notifyFinished): * dom/ScriptRunner.h: (WebCore::ScriptRunner::didBeginYieldingParser): (WebCore::ScriptRunner::didEndYieldingParser): Hooks for Document to tell its ScriptRunner that we've started or finished yielding. These wrap calls to suspend and resume. * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::didBeginYieldingParser): (WebCore::HTMLDocumentParser::didEndYieldingParser): Plumb to didBegin/didEnd calls to the HTMLParserScheduler. * html/parser/HTMLDocumentParser.h: * html/parser/HTMLParserScheduler.cpp: (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript): * html/parser/HTMLParserScheduler.h: (WebCore::HTMLParserScheduler::shouldYieldBeforeToken): Consult a flag when determining whether to yield. This flag is set to true only while the document has an active parser yield token. (WebCore::HTMLParserScheduler::isScheduledForResume const): Consider the parser scheduler to be scheduled for resume if there are active tokens. Without this change, we incorrectly consider the document to be finished loading when we have yield tokens, since it appears that the parser is no longer scheduled to pump its tokenizer. (WebCore::HTMLParserScheduler::didBeginYieldingParser): (WebCore::HTMLParserScheduler::didEndYieldingParser): When the Document begins yielding due to the documet having active tokens or ends yielding after the document loses all of its yield tokens, update a flag on the parser scheduler. After we finish yielding, additionally reschedule the parser if needed to ensure that we continue parsing the document; without this additional change to resume, we'll never get the document load or load events after relinquishing the yield token. Source/WebKit: Add hooks to WKDOMDocument to create and return an internal WKDOMDocumentParserYieldToken object, whose lifetime is tied to a document parser yield token. See WebCore ChangeLog for more detail. * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm: (-[WKDOMDocumentParserYieldToken initWithDocument:]): (-[WKDOMDocument parserYieldToken]): Tools: Add a few tests to exercise the new document yield token SPI, verifying that clients can use the SPI to defer document load, and that doing so doesn't cause deferred `script` to execute in the wrong order (i.e. before synchronous script, or after "DOMContentLoaded"). * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenPlugIn.mm: Added. (-[ParserYieldTokenPlugIn takeDocumentParserTokenAfterCommittingLoad]): (-[ParserYieldTokenPlugIn releaseDocumentParserToken]): (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:didCommitLoadForFrame:]): (-[ParserYieldTokenPlugIn webProcessPlugIn:didCreateBrowserContextController:]): (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:didFinishDocumentLoadForFrame:]): (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:didFinishLoadForFrame:]): Add an injected bundle object that knows how to take and release multiple document parser yield tokens. * TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenTests.h: Added. * TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenTests.mm: Added. (+[ParserYieldTokenTestWebView webView]): (-[ParserYieldTokenTestWebView bundle]): (-[ParserYieldTokenTestWebView schemeHandler]): (-[ParserYieldTokenTestWebView didFinishDocumentLoad]): (-[ParserYieldTokenTestWebView didFinishLoad]): (waitForDelay): (TEST): * TestWebKitAPI/Tests/WebKitCocoa/TestURLSchemeHandler.h: Added. * TestWebKitAPI/Tests/WebKitCocoa/TestURLSchemeHandler.mm: Added. (-[TestURLSchemeHandler webView:startURLSchemeTask:]): (-[TestURLSchemeHandler webView:stopURLSchemeTask:]): (-[TestURLSchemeHandler setStartURLSchemeTaskHandler:]): (-[TestURLSchemeHandler startURLSchemeTaskHandler]): (-[TestURLSchemeHandler setStopURLSchemeTaskHandler:]): (-[TestURLSchemeHandler stopURLSchemeTaskHandler]): Add a new test helper class to handle custom schemes via a block-based API. * TestWebKitAPI/Tests/WebKitCocoa/text-with-async-script.html: Added. New test HTML page that contains a deferred script element, a synchronous script element, another deferred script element, and then some text, images, and links. * TestWebKitAPI/Tests/WebKitCocoa/text-with-deferred-script.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233891 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-17 Wenson Hsieh <wenson_hsieh@apple.com> Add an SPI hook to allow clients to yield document parsing and script execution https://bugs.webkit.org/show_bug.cgi?id=187682 <rdar://problem/42207453> Reviewed by Ryosuke Niwa. Using a single web process for both the Reader page and original web page on watchOS has multiple benefits, including: (1) allowing the user to bail out of Reader and view the original web page without having to load it again, and (2) improving the bringup time of the Reader page, since subresources are already cached in process and we don't eat the additional cost of a web process launch if prewarming fails. However, this has some drawbacks as well, one of which is that main thread work being done on behalf of the original page may contend with work being done to load and render the Reader page. This is especially bad when the page is in the middle of executing heavy script after Safari has already detected that the Reader version of the page is available, but before it has finished loading the Reader page. The result is that script on the original page may block the first paint of the Reader page (on New York Times articles, this often leads to an apparent page load time of 25-35 seconds before the user sees anything besides a blank screen). To mitigate this, we introduce a way for injected bundle clients to yield parsing and async script execution on a document. This capability is surfaced in the form of an opaque token which clients may request from a WKDOMDocument. Construction of the token causes the document to begin yielding and defer execution of previously scheduled scripts, only if there were no active tokens on the document already. Similarly, destruction of all active tokens on the document causes it to stop yielding and resume execution of scripts if needed. Tests: ParserYieldTokenTests.PreventDocumentLoadByTakingParserYieldToken ParserYieldTokenTests.TakeMultipleParserYieldTokens ParserYieldTokenTests.DeferredScriptExecutesBeforeDocumentLoadWhenTakingParserYieldToken ParserYieldTokenTests.AsyncScriptRunsWhenFetched * dom/Document.cpp: (WebCore::Document::implicitOpen): If the parser yield token was taken before the document's parser was created, tell the parser's scheduler to start yielding immediately after creation. (WebCore::DocumentParserYieldToken::DocumentParserYieldToken): (WebCore::DocumentParserYieldToken::~DocumentParserYieldToken): * dom/Document.h: Introduce a parser yield count to Document; as long as this count is greater than 0, we consider the Document to have active yield tokens. When constructing or destroying a ParserYieldToken, we increment and decrement the parser yield count (respectively). (WebCore::Document::createParserYieldToken): (WebCore::Document::hasActiveParserYieldToken const): * dom/DocumentParser.h: (WebCore::DocumentParser::didBeginYieldingParser): (WebCore::DocumentParser::didEndYieldingParser): Hooks for Document to tell its parser that we've started or finished yielding. This updates a flag on the parser's scheduler which is consulted when we determine whether to yield before a pumping token or executing script. * dom/ScriptRunner.cpp: (WebCore::ScriptRunner::resume): (WebCore::ScriptRunner::notifyFinished): * dom/ScriptRunner.h: (WebCore::ScriptRunner::didBeginYieldingParser): (WebCore::ScriptRunner::didEndYieldingParser): Hooks for Document to tell its ScriptRunner that we've started or finished yielding. These wrap calls to suspend and resume. * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::didBeginYieldingParser): (WebCore::HTMLDocumentParser::didEndYieldingParser): Plumb to didBegin/didEnd calls to the HTMLParserScheduler. * html/parser/HTMLDocumentParser.h: * html/parser/HTMLParserScheduler.cpp: (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript): * html/parser/HTMLParserScheduler.h: (WebCore::HTMLParserScheduler::shouldYieldBeforeToken): Consult a flag when determining whether to yield. This flag is set to true only while the document has an active parser yield token. (WebCore::HTMLParserScheduler::isScheduledForResume const): Consider the parser scheduler to be scheduled for resume if there are active tokens. Without this change, we incorrectly consider the document to be finished loading when we have yield tokens, since it appears that the parser is no longer scheduled to pump its tokenizer. (WebCore::HTMLParserScheduler::didBeginYieldingParser): (WebCore::HTMLParserScheduler::didEndYieldingParser): When the Document begins yielding due to the documet having active tokens or ends yielding after the document loses all of its yield tokens, update a flag on the parser scheduler. After we finish yielding, additionally reschedule the parser if needed to ensure that we continue parsing the document; without this additional change to resume, we'll never get the document load or load events after relinquishing the yield token. 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233936. rdar://problem/42354941 Unreviewed API Test fix; restored a line inadventantly removed in r233926. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233936 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Jer Noble <jer.noble@apple.com> Unreviewed API Test fix; restored a line inadventantly removed in r233926. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233930. rdar://problem/42354941 Unreviewed build fix after r233926; BOOL !== bool. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233930 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Jer Noble <jer.noble@apple.com> Unreviewed build fix after r233926; BOOL !== bool. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233926. rdar://problem/42354941 PiP from Element Fullscreen should match AVKit's behavior https://bugs.webkit.org/show_bug.cgi?id=187623 Source/WebCore: Reviewed by Jon Lee. PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): Add an accessor for pictureInPictureWasStartedWhenEnteringBackground(): * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): Add VideoFullscreenModelClient virutal methods for PiP change notifications: * platform/cocoa/VideoFullscreenModel.h: (WebCore::VideoFullscreenModelClient::hasVideoChanged): (WebCore::VideoFullscreenModelClient::videoDimensionsChanged): (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::willExitPictureInPicture): (WebCore::VideoFullscreenModelClient::didExitPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture): * platform/cocoa/VideoFullscreenModelVideoElement.h: * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenModelVideoElement::willEnterPictureInPicture): (VideoFullscreenModelVideoElement::didEnterPictureInPicture): (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): (VideoFullscreenModelVideoElement::willExitPictureInPicture): (VideoFullscreenModelVideoElement::didExitPictureInPicture): (VideoFullscreenModelVideoElement::failedToExitPictureInPicture): * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::presentingViewController): (VideoFullscreenInterfaceAVKit::willStartPictureInPicture): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture): (VideoFullscreenInterfaceAVKit::willStopPictureInPicture): (VideoFullscreenInterfaceAVKit::didStopPictureInPicture): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): (VideoFullscreenInterfaceAVKit::doSetup): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::willEnterPictureInPicture): (VideoFullscreenControllerContext::didEnterPictureInPicture): (VideoFullscreenControllerContext::failedToEnterPictureInPicture): (VideoFullscreenControllerContext::willExitPictureInPicture): (VideoFullscreenControllerContext::didExitPictureInPicture): (VideoFullscreenControllerContext::failedToExitPictureInPicture): * platform/mac/VideoFullscreenInterfaceMac.h: (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]): (-[WebVideoFullscreenInterfaceMacObjC exitPIP]): (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]): (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): (WebCore::VideoFullscreenInterfaceMac::enterFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Source/WebCore/PAL: Reviewed by Jon Lee. * pal/spi/mac/PIPSPI.h: Source/WebKit: Reviewed by Jon Lee. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: (WebKit::PlaybackSessionManagerProxy::controlsManagerContextId const): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::willExitPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenModelContext::failedToExitPictureInPicture): (WebKit::VideoFullscreenManagerProxy::controlsManagerInterface): * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (WKFullScreenViewControllerVideoFullscreenModelClient::setParent): (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface): (WKFullScreenViewControllerVideoFullscreenModelClient::interface const): (-[WKFullScreenViewController initWithWebView:]): (-[WKFullScreenViewController dealloc]): (-[WKFullScreenViewController videoControlsManagerDidChange]): (-[WKFullScreenViewController ensurePiPAnimator]): (-[WKFullScreenViewController willEnterPictureInPicture]): (-[WKFullScreenViewController didEnterPictureInPicture]): (-[WKFullScreenViewController failedToEnterPictureInPicture]): (-[WKFullScreenViewController loadView]): (-[WKFullScreenViewController viewWillAppear:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::videoControlsManagerDidChange): * UIProcess/mac/WKFullScreenWindowController.h: * UIProcess/mac/WKFullScreenWindowController.mm: (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setParent): (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const): (-[WKFullScreenWindowController initWithWindow:webView:page:]): (-[WKFullScreenWindowController dealloc]): (-[WKFullScreenWindowController videoControlsManagerDidChange]): (-[WKFullScreenWindowController willEnterPictureInPicture]): Tools: <rdar://problem/41212379> Reviewed by Jon Lee. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.html: Added. * TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.mm: Added. (-[ExitFullscreenOnEnterPiPUIDelegate _webView:hasVideoInPictureInPictureDidChange:]): (-[ExitFullscreenOnEnterPiPUIDelegate _webViewDidEnterFullscreen:]): (-[ExitFullscreenOnEnterPiPUIDelegate _webViewDidExitFullscreen:]): (TestWebKitAPI::TEST): LayoutTests: Reviewed by Jon Lee. * TestExpectations: * media/fullscreen-video-going-into-pip-expected.txt: Removed. * media/fullscreen-video-going-into-pip.html: Removed. * media/video-contained-in-fullscreen-element-going-into-pip-expected.txt: Removed. * media/video-contained-in-fullscreen-element-going-into-pip.html: Removed. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233926 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-18 Jer Noble <jer.noble@apple.com> PiP from Element Fullscreen should match AVKit's behavior https://bugs.webkit.org/show_bug.cgi?id=187623 Reviewed by Jon Lee. PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): Add an accessor for pictureInPictureWasStartedWhenEnteringBackground(): * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const): Add VideoFullscreenModelClient virutal methods for PiP change notifications: * platform/cocoa/VideoFullscreenModel.h: (WebCore::VideoFullscreenModelClient::hasVideoChanged): (WebCore::VideoFullscreenModelClient::videoDimensionsChanged): (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture): (WebCore::VideoFullscreenModelClient::willExitPictureInPicture): (WebCore::VideoFullscreenModelClient::didExitPictureInPicture): (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture): * platform/cocoa/VideoFullscreenModelVideoElement.h: * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenModelVideoElement::willEnterPictureInPicture): (VideoFullscreenModelVideoElement::didEnterPictureInPicture): (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): (VideoFullscreenModelVideoElement::willExitPictureInPicture): (VideoFullscreenModelVideoElement::didExitPictureInPicture): (VideoFullscreenModelVideoElement::failedToExitPictureInPicture): * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerLayer layoutSublayers]): (-[WebAVPlayerLayer resolveBounds]): (-[WebAVPlayerLayer setVideoGravity:]): (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::presentingViewController): (VideoFullscreenInterfaceAVKit::willStartPictureInPicture): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture): (VideoFullscreenInterfaceAVKit::willStopPictureInPicture): (VideoFullscreenInterfaceAVKit::didStopPictureInPicture): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): (VideoFullscreenInterfaceAVKit::doSetup): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::willEnterPictureInPicture): (VideoFullscreenControllerContext::didEnterPictureInPicture): (VideoFullscreenControllerContext::failedToEnterPictureInPicture): (VideoFullscreenControllerContext::willExitPictureInPicture): (VideoFullscreenControllerContext::didExitPictureInPicture): (VideoFullscreenControllerContext::failedToExitPictureInPicture): * platform/mac/VideoFullscreenInterfaceMac.h: (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted. * platform/mac/VideoFullscreenInterfaceMac.mm: (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]): (-[WebVideoFullscreenInterfaceMacObjC exitPIP]): (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]): (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]): (WebCore::VideoFullscreenInterfaceMac::enterFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreen): (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233903. rdar://problem/42345392 Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInStyle(). https://bugs.webkit.org/show_bug.cgi?id=187637 <rdar://problem/42157915> Reviewed by Dean Jackson. Source/WebCore: Test: webanimations/empty-keyframes-crash.html Unlike what we assumed, it is possible to have a non-declarative animation without any parsed keyframes. This can happen as a result of calling `Element.animate({}, …)`. In this case, we want to return a null value in timingFunctionForKeyframeAtIndex() so we update the call site in setAnimatedPropertiesInStyle() which is the only place where we didn't check for a null value and didn't know for sure that there would be parsed keyframes to rely on in the case of a WebAnimation instance. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex): LayoutTests: Add a new test that would crash prior to this change. * webanimations/empty-keyframes-crash-expected.txt: Added. * webanimations/empty-keyframes-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233903 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-17 Antoine Quint <graouts@apple.com> Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInStyle(). https://bugs.webkit.org/show_bug.cgi?id=187637 <rdar://problem/42157915> Reviewed by Dean Jackson. Test: webanimations/empty-keyframes-crash.html Unlike what we assumed, it is possible to have a non-declarative animation without any parsed keyframes. This can happen as a result of calling `Element.animate({}, …)`. In this case, we want to return a null value in timingFunctionForKeyframeAtIndex() so we update the call site in setAnimatedPropertiesInStyle() which is the only place where we didn't check for a null value and didn't know for sure that there would be parsed keyframes to rely on in the case of a WebAnimation instance. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex): 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233883. rdar://problem/42345112 Correctly adjust scroll offsets when a page is zoomed https://bugs.webkit.org/show_bug.cgi?id=187673 <rdar://problem/41712829> Reviewed by Wenson Hsieh. Will add test later. Make sure that distance is scaled by the pageScaleFactor, to make sure that we scroll correctly when we are zoomed in. * page/ios/EventHandlerIOS.mm: (WebCore::autoscrollAdjustmentFactorForScreenBoundaries): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233883 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Megan Gardner <megan_gardner@apple.com> Correctly adjust scroll offsets when a page is zoomed https://bugs.webkit.org/show_bug.cgi?id=187673 <rdar://problem/41712829> Reviewed by Wenson Hsieh. Will add test later. Make sure that distance is scaled by the pageScaleFactor, to make sure that we scroll correctly when we are zoomed in. * page/ios/EventHandlerIOS.mm: (WebCore::autoscrollAdjustmentFactorForScreenBoundaries): 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233879. rdar://problem/42345389 Release assert in ~TimerBase is getting hit in WK1 apps which uses JSC API directly https://bugs.webkit.org/show_bug.cgi?id=187713 <rdar://problem/41759548> Reviewed by Simon Fraser. Turn this into a debug assertion in WebKit1 on iOS since JSC API doesn't grab the web thread lock, which means that Timer can get destroyed without the web thread lock in the main thread. * platform/Timer.cpp: (WebCore::TimerBase::~TimerBase): (WebCore::TimerBase::setNextFireTime): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233879 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Ryosuke Niwa <rniwa@webkit.org> Release assert in ~TimerBase is getting hit in WK1 apps which uses JSC API directly https://bugs.webkit.org/show_bug.cgi?id=187713 <rdar://problem/41759548> Reviewed by Simon Fraser. Turn this into a debug assertion in WebKit1 on iOS since JSC API doesn't grab the web thread lock, which means that Timer can get destroyed without the web thread lock in the main thread. * platform/Timer.cpp: (WebCore::TimerBase::~TimerBase): (WebCore::TimerBase::setNextFireTime): 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233877. rdar://problem/42344047 Add color filter for transforming colors in Dark Mode https://bugs.webkit.org/show_bug.cgi?id=187717 Source/WebCore: rdar://problem/41146650 Reviewed by Dean Jackson. Add a new filter function for use in -apple-color-filter for transforming colors when in Dark Mode. The filter is called apple-invert-lightness(), and takes no parameters. It's based on a lightness invert in HSL space, with some adjustments to improve the contrast of some colors on dark backgrounds, so does a much better job that using invert() with hue-rotate(). Test: css3/color-filters/color-filter-apple-invert-lightness.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForFilter): * css/CSSValueKeywords.in: * css/StyleResolver.cpp: (WebCore::filterOperationForType): (WebCore::StyleResolver::createFilterOperations): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeFilterImage): (WebCore::CSSPropertyParserHelpers::isPixelFilterFunction): (WebCore::CSSPropertyParserHelpers::isColorFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilter): (WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction): Deleted. * css/parser/CSSPropertyParserHelpers.h: * page/FrameView.cpp: (WebCore::FrameView::paintContents): * platform/graphics/Color.cpp: * platform/graphics/ColorUtilities.cpp: (WebCore::sRGBToLinearComponents): (WebCore::linearToSRGBComponents): (WebCore::sRGBToLinearColorComponentForLuminance): (WebCore::luminance): (WebCore::sRGBToHSL): (WebCore::calcHue): (WebCore::HSLToSRGB): (WebCore::ColorMatrix::ColorMatrix): * platform/graphics/ColorUtilities.h: * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (PlatformCAFilters::filterValueForOperation): (PlatformCAFilters::colorMatrixValueForFilter): * platform/graphics/filters/FEColorMatrix.cpp: * platform/graphics/filters/FilterOperation.cpp: (WebCore::InvertLightnessFilterOperation::operator== const): (WebCore::InvertLightnessFilterOperation::blend): (WebCore::InvertLightnessFilterOperation::transformColor const): (WebCore::operator<<): * platform/graphics/filters/FilterOperation.h: * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::build): Source/WebKit: Reviewed by Dean Jackson. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<FilterOperation>::encode): (IPC::decodeFilterOperation): LayoutTests: rdar://problem/41146650 Reviewed by Dean Jackson. * css3/color-filters/color-filter-apple-invert-lightness-expected.html: Added. * css3/color-filters/color-filter-apple-invert-lightness.html: Added. * css3/color-filters/color-filter-parsing-expected.txt: * css3/color-filters/color-filter-parsing.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233877 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Simon Fraser <simon.fraser@apple.com> Add color filter for transforming colors in Dark Mode https://bugs.webkit.org/show_bug.cgi?id=187717 rdar://problem/41146650 Reviewed by Dean Jackson. Add a new filter function for use in -apple-color-filter for transforming colors when in Dark Mode. The filter is called apple-invert-lightness(), and takes no parameters. It's based on a lightness invert in HSL space, with some adjustments to improve the contrast of some colors on dark backgrounds, so does a much better job that using invert() with hue-rotate(). Test: css3/color-filters/color-filter-apple-invert-lightness.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForFilter): * css/CSSValueKeywords.in: * css/StyleResolver.cpp: (WebCore::filterOperationForType): (WebCore::StyleResolver::createFilterOperations): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeFilterImage): (WebCore::CSSPropertyParserHelpers::isPixelFilterFunction): (WebCore::CSSPropertyParserHelpers::isColorFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilter): (WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction): Deleted. * css/parser/CSSPropertyParserHelpers.h: * page/FrameView.cpp: (WebCore::FrameView::paintContents): * platform/graphics/Color.cpp: * platform/graphics/ColorUtilities.cpp: (WebCore::sRGBToLinearComponents): (WebCore::linearToSRGBComponents): (WebCore::sRGBToLinearColorComponentForLuminance): (WebCore::luminance): (WebCore::sRGBToHSL): (WebCore::calcHue): (WebCore::HSLToSRGB): (WebCore::ColorMatrix::ColorMatrix): * platform/graphics/ColorUtilities.h: * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (PlatformCAFilters::filterValueForOperation): (PlatformCAFilters::colorMatrixValueForFilter): * platform/graphics/filters/FEColorMatrix.cpp: * platform/graphics/filters/FilterOperation.cpp: (WebCore::InvertLightnessFilterOperation::operator== const): (WebCore::InvertLightnessFilterOperation::blend): (WebCore::InvertLightnessFilterOperation::transformColor const): (WebCore::operator<<): * platform/graphics/filters/FilterOperation.h: * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::build): 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233872. rdar://problem/42345272 Source/WebCore: [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction https://bugs.webkit.org/show_bug.cgi?id=187375 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-07-16 Reviewed by Simon Fraser. An immediate-paint transaction should force all the images which are pending decoding to be repainted. To do that, FrameView::paintControlTints() will be re-factored to a new generic function such that it takes PaintInvalidationReasons. The new function which is named 'traverseForPaintInvalidation' will traverse the render tree for a specific PaintInvalidationReasons. invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for the underlying image and repaint all the clients which are waiting for the decoding to finish. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::didRemoveClient): (WebCore::CachedImage::isClientWaitingForAsyncDecoding const): (WebCore::CachedImage::addClientWaitingForAsyncDecoding): (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding): (WebCore::CachedImage::allClientsRemoved): (WebCore::CachedImage::clear): (WebCore::CachedImage::createImage): (WebCore::CachedImage::imageFrameAvailable): (WebCore::CachedImage::addPendingImageDrawingClient): Deleted. * loader/cache/CachedImage.h: * page/FrameView.cpp: (WebCore::FrameView::paintScrollCorner): (WebCore::FrameView::updateControlTints): (WebCore::FrameView::traverseForPaintInvalidation): (WebCore::FrameView::adjustPageHeightDeprecated): (WebCore::FrameView::paintControlTints): Deleted. * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::paint): * platform/Scrollbar.cpp: (WebCore::Scrollbar::paint): * platform/graphics/BitmapImage.h: * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::GraphicsContext): * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::performingPaintInvalidation const): (WebCore::GraphicsContext::invalidatingControlTints const): (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const): (WebCore::GraphicsContext::updatingControlTints const): Deleted. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintReplaced): (WebCore::RenderImage::paintAreaElementFocusRing): (WebCore::RenderImage::paintIntoRect): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintScrollCorner): (WebCore::RenderLayer::paintResizer): (WebCore::RenderLayer::paintLayer): * rendering/RenderScrollbar.cpp: (WebCore::RenderScrollbar::paint): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): * testing/Internals.cpp: (WebCore::Internals::invalidateControlTints): (WebCore::Internals::paintControlTints): Deleted. * testing/Internals.h: * testing/Internals.idl: Source/WebKit: [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction https://bugs.webkit.org/show_bug.cgi?id=187375 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-07-16 Reviewed by Simon Fraser. For immediate-paint transaction, we should force all the images which are pending decoding to be repainted before building this transaction. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::updateControlTints): * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::paint): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::flushLayers): LayoutTests: [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction https://bugs.webkit.org/show_bug.cgi?id=187375 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-07-16 Reviewed by Simon Fraser. The Internals API paintControlTints() is now renamed to invalidateControlTints() to be consistent with the new enum values and with the new name of the C++ function. * fast/css/webkit-mask-crash-fieldset-legend.html: * fast/css/webkit-mask-crash-figure.html: * fast/css/webkit-mask-crash-table.html: * fast/css/webkit-mask-crash-td-2.html: * fast/css/webkit-mask-crash-td.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233872 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Said Abou-Hallawa <sabouhallawa@apple.com> [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction https://bugs.webkit.org/show_bug.cgi?id=187375 Reviewed by Simon Fraser. An immediate-paint transaction should force all the images which are pending decoding to be repainted. To do that, FrameView::paintControlTints() will be re-factored to a new generic function such that it takes PaintInvalidationReasons. The new function which is named 'traverseForPaintInvalidation' will traverse the render tree for a specific PaintInvalidationReasons. invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for the underlying image and repaint all the clients which are waiting for the decoding to finish. * loader/cache/CachedImage.cpp: (WebCore::CachedImage::didRemoveClient): (WebCore::CachedImage::isClientWaitingForAsyncDecoding const): (WebCore::CachedImage::addClientWaitingForAsyncDecoding): (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding): (WebCore::CachedImage::allClientsRemoved): (WebCore::CachedImage::clear): (WebCore::CachedImage::createImage): (WebCore::CachedImage::imageFrameAvailable): (WebCore::CachedImage::addPendingImageDrawingClient): Deleted. * loader/cache/CachedImage.h: * page/FrameView.cpp: (WebCore::FrameView::paintScrollCorner): (WebCore::FrameView::updateControlTints): (WebCore::FrameView::traverseForPaintInvalidation): (WebCore::FrameView::adjustPageHeightDeprecated): (WebCore::FrameView::paintControlTints): Deleted. * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::paint): * platform/Scrollbar.cpp: (WebCore::Scrollbar::paint): * platform/graphics/BitmapImage.h: * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::GraphicsContext): * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::performingPaintInvalidation const): (WebCore::GraphicsContext::invalidatingControlTints const): (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const): (WebCore::GraphicsContext::updatingControlTints const): Deleted. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintReplaced): (WebCore::RenderImage::paintAreaElementFocusRing): (WebCore::RenderImage::paintIntoRect): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintScrollCorner): (WebCore::RenderLayer::paintResizer): (WebCore::RenderLayer::paintLayer): * rendering/RenderScrollbar.cpp: (WebCore::RenderScrollbar::paint): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): * testing/Internals.cpp: (WebCore::Internals::invalidateControlTints): (WebCore::Internals::paintControlTints): Deleted. * testing/Internals.h: * testing/Internals.idl: 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233870. rdar://problem/42344023 Unreviewed attempt to fix the build. * rendering/RenderThemeMac.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233870 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Ryan Haddad <ryanhaddad@apple.com> Unreviewed attempt to fix the build. * rendering/RenderThemeMac.mm: 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233869. rdar://problem/42344023 Allow removal of white backgrounds https://bugs.webkit.org/show_bug.cgi?id=187574 <rdar://problem/41146792> Reviewed by Simon Fraser. Source/WebCore: Add a drawing mode that turns white backgrounds into transparent regions, such that a hosting app can see through to its window. Test: css3/color-filters/punch-out-white-backgrounds.html * page/Settings.yaml: New Setting. * rendering/InlineFlowBox.cpp: Draw with a destination out blend mode if the background is white and we are punching out backgrounds, which means that it will erase the destination. (WebCore::InlineFlowBox::paintBoxDecorations): * rendering/RenderBox.cpp: (WebCore::RenderBox::paintBackground): Ditto. * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): Save and restore the composition mode if necessary. Source/WebKit: Add a new WebPreference for punching out white backgrounds. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode): (WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _punchOutWhiteBackgroundsInDarkMode]): (-[WKWebViewConfiguration _setPunchOutWhiteBackgroundsInDarkMode:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Source/WebKitLegacy/mac: Add a new WebPreference for punching out white backgrounds. * WebView/WebPreferenceKeysPrivate.h: * WebView/WebPreferences.mm: (+[WebPreferences initialize]): (-[WebPreferences punchOutWhiteBackgroundsInDarkMode]): (-[WebPreferences setPunchOutWhiteBackgroundsInDarkMode:]): * WebView/WebPreferencesPrivate.h: * WebView/WebView.mm: (-[WebView _preferencesChanged:]): Tools: Add a new menu item for punching out white backgrounds in MiniBrowser. In WebKitTestRunner, expose the new setting and hook that up to drawing a background in the WebView. * MiniBrowser/mac/AppDelegate.m: (defaultConfiguration): Add _punchOutWhiteBackgroundsInDarkMode. * MiniBrowser/mac/SettingsController.h: Ditto. * MiniBrowser/mac/SettingsController.m: (-[SettingsController _populateMenu]): (-[SettingsController validateMenuItem:]): (-[SettingsController togglePunchOutWhiteBackgroundsInDarkMode:]): (-[SettingsController punchOutWhiteBackgroundsInDarkMode]): * MiniBrowser/mac/WK1BrowserWindowController.m: (-[WK1BrowserWindowController didChangeSettings]): Set the new preference. * WebKitTestRunner/PlatformWebView.h: Expose a drawsBackground property. * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp: Null implementation. (WTR::PlatformWebView::drawsBackground const): (WTR::PlatformWebView::setDrawsBackground): * WebKitTestRunner/wpe/PlatformWebViewWPE.cpp: Ditto. (WTR::PlatformWebView::drawsBackground const): (WTR::PlatformWebView::setDrawsBackground): * WebKitTestRunner/ios/PlatformWebViewIOS.mm: Call into the WKWebView and set its SPI. (WTR::PlatformWebView::drawsBackground const): (WTR::PlatformWebView::setDrawsBackground): * WebKitTestRunner/mac/PlatformWebViewMac.mm: Ditto. (WTR::PlatformWebView::drawsBackground const): (WTR::PlatformWebView::setDrawsBackground): * WebKitTestRunner/TestController.cpp: Reset and copy the new preference. (WTR::TestController::resetPreferencesToConsistentValues): (WTR::updateTestOptionsFromTestHeader): * WebKitTestRunner/TestOptions.h: (WTR::TestOptions::hasSameInitializationOptions const): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::platformCreateWebView): If the option for punching out the background was set, tell the WebView to not draw its background. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233869 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-11 Dean Jackson <dino@apple.com> Allow removal of white backgrounds https://bugs.webkit.org/show_bug.cgi?id=187574 <rdar://problem/41146792> Reviewed by Simon Fraser. Add a drawing mode that turns white backgrounds into transparent regions, such that a hosting app can see through to its window. Test: css3/color-filters/punch-out-white-backgrounds.html * page/Settings.yaml: New Setting. * rendering/InlineFlowBox.cpp: Draw with a destination out blend mode if the background is white and we are punching out backgrounds, which means that it will erase the destination. (WebCore::InlineFlowBox::paintBoxDecorations): * rendering/RenderBox.cpp: (WebCore::RenderBox::paintBackground): Ditto. * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): Save and restore the composition mode if necessary. 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233865. rdar://problem/42343023 Fullscreen requires active document. https://bugs.webkit.org/show_bug.cgi?id=186226 rdar://problem/36187413 Patch by Jeremy Jones <jeremyj@apple.com> on 2018-07-16 Reviewed by Jer Noble. Source/WebCore: Test: media/no-fullscreen-when-hidden.html This change guarantees the document to be visible for both element fullscreen and video fullscreen. User gesture is not enough to guarantee that the document is visible when fullscreen is initiated because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might be hidden. Document::hidden() can't be relied upon because it won't update while JavaScript spins. This change adds a sync call to the UI process to get the current UI visibility state. * dom/Document.cpp: (WebCore::Document::requestFullScreenForElement): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * page/ChromeClient.h: Source/WebKit: This change guarantees the document to be visible for both element fullscreen and video fullscreen. User gesture is not enough to guarantee that the document is visible when fullscreen is initiated because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might be hidden. Document::hidden() can't be relied upon because it won't update while JavaScript spins. This change adds a sync call to the UI process to get the current UI visibility state. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getIsViewVisible): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::isViewVisible): * WebProcess/WebCoreSupport/WebChromeClient.h: LayoutTests: This change guarantees the document to be visible for both element fullscreen and video fullscreen. User gesture is not enough to guarantee that the document is visible when fullscreen is initiated because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might be hidden. Document::hidden() can't be relied upon because it won't update while JavaScript spins. This change adds a sync call to the UI process to get the current UI visibility state. * media/no-fullscreen-when-hidden.html: Added. * media/video-test.js: (eventName.string_appeared_here.thunk): (runWithKeyDown): * platform/ios-wk1/TestExpectations: * platform/mac-wk1/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233865 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Jeremy Jones <jeremyj@apple.com> Fullscreen requires active document. https://bugs.webkit.org/show_bug.cgi?id=186226 rdar://problem/36187413 Reviewed by Jer Noble. Test: media/no-fullscreen-when-hidden.html This change guarantees the document to be visible for both element fullscreen and video fullscreen. User gesture is not enough to guarantee that the document is visible when fullscreen is initiated because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might be hidden. Document::hidden() can't be relied upon because it won't update while JavaScript spins. This change adds a sync call to the UI process to get the current UI visibility state. * dom/Document.cpp: (WebCore::Document::requestFullScreenForElement): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): * page/ChromeClient.h: 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233857. rdar://problem/42345036 Make sure LibWebRTCMediaEndpoint is always destroyed on the main thread https://bugs.webkit.org/show_bug.cgi?id=187702 Reviewed by Youenn Fablet. Make sure LibWebRTCMediaEndpoint is always constructed and destructed on the main thread since it has a Timer data member and it would not be safe otherwise. LibWebRTCMediaEndpoint is ThreadSafeRefCounted and frequently passed to other threads. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233857 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Chris Dumez <cdumez@apple.com> Make sure LibWebRTCMediaEndpoint is always destroyed on the main thread https://bugs.webkit.org/show_bug.cgi?id=187702 Reviewed by Youenn Fablet. Make sure LibWebRTCMediaEndpoint is always constructed and destructed on the main thread since it has a Timer data member and it would not be safe otherwise. LibWebRTCMediaEndpoint is ThreadSafeRefCounted and frequently passed to other threads. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: 2018-07-18 Babak Shafiei <bshafiei@apple.com> Cherry-pick r233853. rdar://problem/42344991 IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins https://bugs.webkit.org/show_bug.cgi?id=187631 <rdar://problem/42164227> Reviewed by Brady Eidson. Source/WebCore: When asked to delete database for an origin, we deleted the databases whose mainFrameOrigin is that origin. Given that the origin may create IndexedDB from subframes, we should delete databases whose openingOrigin is that origin too. Covered by modified API test: WebKit.WebsiteDataStoreCustomPaths. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins): Source/WebKit: We need to return all origins, both openingOrigin and mainFrameOrigin, of IndexedDB so users could be better aware of which origins are using databases and decide what they want to remove. * StorageProcess/StorageProcess.cpp: (WebKit::StorageProcess::indexedDatabaseOrigins): * StorageProcess/StorageProcess.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm: (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233853 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2018-07-16 Sihui Liu <sihui_liu@apple.com> IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins https://bugs.webkit.org/show_bug.cgi?id=187631 <rdar://problem/42164227> Reviewed by Brady Eidson. When asked to delete database for an origin, we deleted the databases whose mainFrameOrigin is that origin. Given that the origin may create IndexedDB from subframes, we should delete databases whose openingOrigin is that origin too. Covered by modified API test: WebKit.WebsiteDataStoreCustomPaths. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins): 2018-07-16 Simon Fraser <simon.fraser@apple.com> Shrink some font-related classes and enums https://bugs.webkit.org/show_bug.cgi?id=187686 Reviewed by Myles Maxfield. Use enum class for enums in TextFlags.h and make them one byte big. Re-order members of Font to shrink it from 360 to 328 bytes. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator FontSmoothingMode const): (WebCore::CSSPrimitiveValue::operator FontSmallCaps const): (WebCore::CSSPrimitiveValue::operator TextRenderingMode const): * platform/graphics/Font.cpp: (WebCore::Font::Font): (WebCore::Font::verticalRightOrientationFont const): * platform/graphics/Font.h: * platform/graphics/FontCascade.cpp: (WebCore::offsetToMiddleOfGlyph): * platform/graphics/FontCascade.h: (WebCore::FontCascade::advancedTextRenderingMode const): * platform/graphics/FontCascadeFonts.cpp: (WebCore::FontCascadeFonts::glyphDataForSystemFallback): (WebCore::FontCascadeFonts::glyphDataForVariant): (WebCore::glyphPageFromFontRanges): * platform/graphics/FontDescription.cpp: (WebCore::FontCascadeDescription::FontCascadeDescription): * platform/graphics/FontDescription.h: (WebCore::FontDescription::setTextRenderingMode): (WebCore::FontDescription::setOrientation): (WebCore::FontDescription::setWidthVariant): (WebCore::FontCascadeDescription::setFontSmoothing): (WebCore::FontCascadeDescription::initialSmallCaps): (WebCore::FontCascadeDescription::initialFontSmoothing): (WebCore::FontCascadeDescription::initialTextRenderingMode): * platform/graphics/FontPlatformData.h: (WebCore::FontPlatformData::isForTextCombine const): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): * platform/graphics/cocoa/FontCascadeCocoa.mm: (WebCore::showLetterpressedGlyphsWithAdvances): (WebCore::showGlyphsWithAdvances): (WebCore::FontCascade::drawGlyphs): (WebCore::FontCascade::fontForCombiningCharacterSequence const): * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::platformInit): (WebCore::Font::platformBoundsForGlyph const): (WebCore::Font::platformWidthForGlyph const): * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::FontPlatformData::hash const): (WebCore::mapFontWidthVariantToCTFeatureSelector): (WebCore::FontPlatformData::ctFont const): (WebCore::FontPlatformData::description const): * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::FontPlatformData::buildScaledFont): * platform/graphics/freetype/SimpleFontDataFreeType.cpp: (WebCore::Font::platformInit): (WebCore::Font::platformWidthForGlyph const): * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: (WebCore::fontFeatures): (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): * platform/graphics/mac/SimpleFontDataCoreText.cpp: (WebCore::Font::getCFStringAttributes const): * platform/graphics/win/FontCGWin.cpp: (WebCore::FontCascade::drawGlyphs): * platform/graphics/win/FontCascadeDirect2D.cpp: (WebCore::FontCascade::drawGlyphs): * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp: (WebCore::GlyphPage::fill): * platform/graphics/win/SimpleFontDataDirect2D.cpp: (WebCore::Font::platformInit): (WebCore::Font::platformBoundsForGlyph const): (WebCore::Font::platformWidthForGlyph const): * platform/text/TextFlags.h: * rendering/RenderCombineText.cpp: (WebCore::RenderCombineText::combineTextIfNeeded): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextWithShadows): * rendering/TextPainter.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::fontAndGlyphOrientation): * rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle): 2018-07-16 Sergio Villar Senin <svillar@igalia.com> [WebVR] Add support for connect/disconnect and mount/unmount device events https://bugs.webkit.org/show_bug.cgi?id=187343 Reviewed by Žan Doberšek. WebVR specs define a series of events as part of the Window Interface Extension. We're adding support for the connect/disconnect and mount/unmount events both at the module level and the platform level using OpenVR. In order to do that we need to keep lists of VRPlatformDisplays at platform level and VRDisplays at bindings level. We then update those lists accordingly to detect potential additions/removals, and emit the corresponding signals. A new client interface VRPlatformDisplayClient was also defined so that VRPlatformDisplay implementations could notify their clients (typically a VRDisplay). Last but not least, NavigatorWebVR was updated so it supplements Navigator instead of supplementing Page. * Modules/webvr/NavigatorWebVR.cpp: Supplement Navigator not Page. (WebCore::NavigatorWebVR::getVRDisplays): Keep a list of VRDisplays and update them conveniently, also emitting the required events under certain conditions (like device disconnection). (WebCore::NavigatorWebVR::supplementName): New method. (WebCore::NavigatorWebVR::from): Ditto. * Modules/webvr/NavigatorWebVR.h: Supplement Navigator not Page. * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::create): Moved suspendIfNeeded() to constructor. (WebCore::VRDisplay::VRDisplay): Set itself as VRPlatformDisplay client. (WebCore::VRDisplay::~VRDisplay): Unset as VRPlatformDisplay client. (WebCore::VRDisplay::VRPlatformDisplayConnected): Dispatch event on DOM window. (WebCore::VRDisplay::VRPlatformDisplayDisconnected): Ditto. (WebCore::VRDisplay::VRPlatformDisplayMounted): Ditto. (WebCore::VRDisplay::VRPlatformDisplayUnmounted): Ditto. * Modules/webvr/VRDisplay.h: Extend from VRPlatformDisplayClient. (WebCore::VRDisplay::document): * Modules/webvr/VRDisplayEvent.cpp: Updated Copyright. * Modules/webvr/VRDisplayEvent.h: Ditto. * Sources.txt: Added the two new files. * WebCore.xcodeproj/project.pbxproj: Ditto. * platform/vr/VRManager.cpp: (WebCore::VRManager::getVRDisplays): Keep a list of VRPlatformDisplays and update them conveniently, also emitting the required events under certain conditions (like device disconnection). * platform/vr/VRManager.h: * platform/vr/VRPlatformDisplay.cpp: New file with common implementations for VRPlatformDisplays. (WebCore::VRPlatformDisplay::setClient): (WebCore::VRPlatformDisplay::notifyVRPlatformDisplayEvent): * platform/vr/VRPlatformDisplay.h: Added a generic method to notify about different events. Added the client pointer. * platform/vr/VRPlatformDisplayClient.h: New file. VRPlatformDisplay implementations will call the client methods in the event of some circumstances happening. (WebCore::VRPlatformDisplayClient::VRPlatformDisplayConnected): (WebCore::VRPlatformDisplayClient::VRPlatformDisplayDisconnected): (WebCore::VRPlatformDisplayClient::VRPlatformDisplayMounted): (WebCore::VRPlatformDisplayClient::VRPlatformDisplayUnmounted): * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: (WebCore::VRPlatformDisplayOpenVR::updateDisplayInfo): Poll the device for new events to detect connection/disconnections or device activations/deactivations (HMD mounted/unmounted). * platform/vr/openvr/VRPlatformDisplayOpenVR.h: 2018-07-16 Zan Dobersek <zdobersek@igalia.com> [Nicosia] Add Nicosia::PlatformLayer, Nicosia::CompositionLayer classes https://bugs.webkit.org/show_bug.cgi?id=187693 Reviewed by Carlos Garcia Campos. Add the Nicosia::PlatformLayer class. This will be the base platform layer class from which different derivatives will be created, addressing different use cases. The generic PlatformLayer type alias will point to this class in the future. First class deriving from Nicosia::PlatformLayer is Nicosia::CompositionLayer, purpose of which will be to mirror the state that's stored in the platform-specific GraphicsLayer derivative. It will also allow making thread-safe updates to that state. CoordinatedGraphicsLayer implementation now spawns a CompositionLayer object and tracks state changes in a separate CompositionLayer::LayerState::Delta object. During flushing, the changed state is applied to the layer's pending state before the delta is nulled out. The updated state isn't used anywhere yet, but future changes will implement committing this state into the rendering pipeline. There's bits of state not yet being managed by CompositionLayer, e.g. debug visuals, filters and animations. These will be addressed later. The m_solidColor member variable is added to CoordinatedGraphicsLayer in order to properly store the solid color value. Normally this would be contained by the parent GraphicsLayer class, but no such member variable exists there. * platform/TextureMapper.cmake: * platform/graphics/nicosia/NicosiaPlatformLayer.cpp: Added. (Nicosia::PlatformLayer::PlatformLayer): (Nicosia::CompositionLayer::CompositionLayer): * platform/graphics/nicosia/NicosiaPlatformLayer.h: Added. (Nicosia::PlatformLayer::isCompositionLayer const): (Nicosia::PlatformLayer::id const): (Nicosia::CompositionLayer::create): (Nicosia::CompositionLayer::LayerState::Flags::Flags): (Nicosia::CompositionLayer::updateState): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): (WebCore::CoordinatedGraphicsLayer::setPosition): (WebCore::CoordinatedGraphicsLayer::setAnchorPoint): (WebCore::CoordinatedGraphicsLayer::setSize): (WebCore::CoordinatedGraphicsLayer::setTransform): (WebCore::CoordinatedGraphicsLayer::setChildrenTransform): (WebCore::CoordinatedGraphicsLayer::setPreserves3D): (WebCore::CoordinatedGraphicsLayer::setMasksToBounds): (WebCore::CoordinatedGraphicsLayer::setDrawsContent): (WebCore::CoordinatedGraphicsLayer::setContentsVisible): (WebCore::CoordinatedGraphicsLayer::setContentsOpaque): (WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility): (WebCore::CoordinatedGraphicsLayer::setOpacity): (WebCore::CoordinatedGraphicsLayer::setContentsRect): (WebCore::CoordinatedGraphicsLayer::setContentsTileSize): (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase): (WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor): (WebCore::CoordinatedGraphicsLayer::setMaskLayer): (WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer): (WebCore::CoordinatedGraphicsLayer::syncChildren): (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2018-07-15 Wenson Hsieh <wenson_hsieh@apple.com> [iOS apps on macOS] Playing embedded Twitter videos in the News app crashes the web process https://bugs.webkit.org/show_bug.cgi?id=187690 <rdar://problem/41869703> Reviewed by Tim Horton. Work around unexpected behavior when soft-linking AVFoundation. After using `dlopen_preflight` to check for the existence of a library prior to loading the library using `dlopen`, `dlsym` subsequently returns null for some symbols that would otherwise be available. This causes us to RELEASE_ASSERT later down the road when we try to load AVAudioSessionModeDefault in AudioSessionIOS.mm. To fix this for now, simply check for the library directly instead of using the more lightweight preflight check. See clone: <rdar://problem/42224780> for more detail. * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: (WebCore::AVFoundationMIMETypeCache::isAvailable const): 2018-07-14 Simon Fraser <simon.fraser@apple.com> Shrink StyleFillData, StyleStrokeData and StyleMiscData https://bugs.webkit.org/show_bug.cgi?id=187681 Reviewed by Anders Carlsson. Shrink these data structures by making more enum classes one byte in size, and re-ordering. StyleFillData goes from 56 to 48, StyleStrokeData from 80 to 72, StyleMiscData from 40 to 32 bytes. * rendering/style/SVGRenderStyleDefs.cpp: (WebCore::StyleFillData::StyleFillData): (WebCore::StyleFillData::operator== const): (WebCore::StyleStrokeData::StyleStrokeData): (WebCore::StyleStrokeData::operator== const): (WebCore::StyleStopData::operator== const): (WebCore::StyleMiscData::StyleMiscData): * rendering/style/SVGRenderStyleDefs.h: 2018-07-14 Simon Fraser <simon.fraser@apple.com> Shrink CachedResource and subclasses https://bugs.webkit.org/show_bug.cgi?id=187546 Reviewed by Daniel Bates. Shrink CachedResource down from 1384 to 1336 bytes, CachedImage from 1480 to 1424 bytes, and CachedFont a little. This saves about 23KB on cnn.com. * loader/ResourceLoaderOptions.h: * loader/cache/CachedFont.h: * loader/cache/CachedImage.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): * loader/cache/CachedResource.h: * platform/network/CacheValidation.h: (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus): * platform/network/NetworkLoadMetrics.h: * platform/network/ParsedContentRange.h: * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: 2018-07-14 Simon Fraser <simon.fraser@apple.com> Shrink some style-related classes and enums https://bugs.webkit.org/show_bug.cgi?id=187680 Reviewed by Antti Koivisto. Make all the enum classes in RenderStyleConstants be one byte big (all have less than 256 values). Shrink DocumentRuleSet from 384 to 368 bytes by re-ordering, which also helps shrink StyleResolver from 1024 to 952 bytes. Shrink BorderValue by re-ordering (now that the layout of Color has changed) which shrinks BorderData from 168 to 136 bytes. Convert a couple of other enums to enum class so that they can have explicit size. * css/DocumentRuleSets.h: * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::documentElementUserAgentStyle const): * css/StyleMedia.cpp: (WebCore::StyleMedia::matchMedium const): * css/StyleResolver.cpp: (WebCore::StyleResolver::StyleResolver): (WebCore::StyleResolver::State::State): (WebCore::StyleResolver::styleForElement): (WebCore::StyleResolver::cascadedPropertiesForRollback): (WebCore::StyleResolver::applyProperty): (WebCore::cascadeLevelForIndex): * css/StyleResolver.h: * rendering/style/BorderValue.h: * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyleConstants.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::styleForElement): * svg/SVGElementRareData.h: (WebCore::SVGElementRareData::overrideComputedStyle): 2018-07-14 Kocsen Chung <kocsen_chung@apple.com> Ensure WebKit stack is ad-hoc signed https://bugs.webkit.org/show_bug.cgi?id=187667 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: 2018-07-14 Dirk Schulze <krit@webkit.org> [css-masking] Fully support -webkit-clip-path on SVG elements https://bugs.webkit.org/show_bug.cgi?id=185829 Reviewed by Simon Fraser. -webkit-clip-path contributes to SVG elements with boxes, shapes and now with element references to <clipPath> elements as well. Make sure that all types contribute to hit-testing of the SVG element as well as they should. Tests: svg/clip-path/webkit-clip-path-after-expected.svg svg/clip-path/webkit-clip-path-after.svg svg/clip-path/webkit-clip-path-before-expected.svg svg/clip-path/webkit-clip-path-before.svg svg/dynamic-updates/SVGClipPath-prefixed-influences-hitTesting.html svg/dynamic-updates/SVGClipPath-prefixed-path-influences-hitTesting.html svg/dynamic-updates/SVGClipPathElement-prefixed-css-transform-influences-hitTesting.html svg/dynamic-updates/SVGClipPathElement-prefixed-transform-influences-hitTesting.html * rendering/svg/SVGRenderSupport.cpp: Share code as much as possible. (WebCore::clipPathReferenceBox): (WebCore::isPointInCSSClippingArea): Take -webkit-clip-path into account. (WebCore::SVGRenderSupport::clipContextToCSSClippingArea): (WebCore::SVGRenderSupport::pointInClippingArea): * rendering/svg/SVGRenderSupport.h: * rendering/svg/SVGRenderingContext.cpp: Clip to -webkit-clip-path boxes, shapes and references. (WebCore::SVGRenderingContext::prepareToRenderSVGContent): * rendering/svg/SVGResources.cpp: Add -webkit-clip-path references to cached resources. Mimic SVG clip-path. (WebCore::SVGResources::buildCachedResources): 2018-07-13 Simon Fraser <simon.fraser@apple.com> Avoid fetching visitedDependentColor() so many times in editing code https://bugs.webkit.org/show_bug.cgi?id=187676 Reviewed by Zalan Bujtas. editingAttributedStringFromRange called style.visitedDependentColor() twice for each property, and fontAttributesForSelectionStart() called it two or three times. Use a local Color variable to avoid so many calls. Also replace a call to alpha() with isVisible() which makes the usage more clear. No behavior change. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::fontAttributesForSelectionStart const): * editing/cocoa/HTMLConverter.mm: (WebCore::editingAttributedStringFromRange): 2018-07-13 Youenn Fablet <youenn@apple.com> Support connecting a MediaStreamAudioDestinationNode to RTCPeerConnection https://bugs.webkit.org/show_bug.cgi?id=187627 <rdar://problem/35334400> Reviewed by Jer Noble. When MediaStreamAudioSource is called to read new audio samples, convert these samples to a WebAudioBufferList and call RealtimeMediaSource::audioSamplesAvailable. This makes its observers to get the audio data. Test: webrtc/peer-connection-createMediaStreamDestination.html * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::create): Minor refactoring. * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: (WebCore::createMediaStream): (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): (WebCore::MediaStreamAudioDestinationNode::process): * Modules/webaudio/MediaStreamAudioDestinationNode.h: * Modules/webaudio/MediaStreamAudioSource.cpp: (WebCore::MediaStreamAudioSource::MediaStreamAudioSource): (WebCore::MediaStreamAudioSource::consumeAudio): * Modules/webaudio/MediaStreamAudioSource.h: * Modules/webaudio/MediaStreamAudioSourceCocoa.cpp: Added. (WebCore::streamDescription): (WebCore::MediaStreamAudioSource::consumeAudio): * WebCore.xcodeproj/project.pbxproj: * platform/audio/AudioDestinationConsumer.h: Removed. * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::create): * platform/mediastream/MediaStreamPrivate.h: 2018-07-13 Christopher Reid <chris.reid@sony.com> [WinCairo] Enable WebGL when Accelerated Compositing is disabled https://bugs.webkit.org/show_bug.cgi?id=187664 Reviewed by Fujii Hironori. AC was disabled for WinCairo in r233725 but it can still run WebGL without AC. * html/HTMLCanvasElement.cpp: 2018-07-13 Chris Dumez <cdumez@apple.com> Crash under ApplicationCacheGroup::didFailLoadingEntry() https://bugs.webkit.org/show_bug.cgi?id=187661 <rdar://problem/42179755> Reviewed by Youenn Fablet. If ApplicationCacheResourceLoader::create() fails synchronously with ApplicationCacheResourceLoader::Error::CannotCreateResource error, then m_entryLoader will be null when didFailLoadingEntry() is called. However, didFailLoadingEntry() fails to null check m_entryLoader before using it. * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didFailLoadingEntry): (WebCore::ApplicationCacheGroup::startLoadingEntry): * loader/appcache/ApplicationCacheGroup.h: 2018-07-13 Alex Christensen <achristensen@webkit.org> Add release assertion to check thread in TimerBase::setNextFireTime https://bugs.webkit.org/show_bug.cgi?id=187666 Reviewed by Ryosuke Niwa. This should give us insight into what is causing <rdar://problem/33352721> * platform/Timer.cpp: (WebCore::TimerBase::setNextFireTime): 2018-07-13 Ryosuke Niwa <rniwa@webkit.org> [iOS] [WK1] Crash inside IOSurfacePool::platformGarbageCollectNow() in WebThread https://bugs.webkit.org/show_bug.cgi?id=187635 <rdar://problem/34297065> Reviewed by Simon Fraser. r167717 added code to trigger a CA commit in the web process via platformGarbageCollectNow() in order to free IOSurface-related memory. However, that code is also running in the web thread in apps using WebKit1, causing unwanted UIView layout on the web thread. Fix by not triggering this CA commit if it's called on the web thread. * platform/graphics/cocoa/IOSurfacePoolCocoa.mm: (WebCore::IOSurfacePool::platformGarbageCollectNow): 2018-07-13 Antoine Quint <graouts@apple.com> Dark Mode: document markers are difficult to see https://bugs.webkit.org/show_bug.cgi?id=187632 <rdar://problem/41099719> Reviewed by Simon Fraser. We update the way we draw the document markers for macOS and use more constrasting colors in dark mode. Paving the way for future improvements, we move the drawLineForDocumentMarker() method from GraphicsContext to RenderTheme and implement a first version in RenderThemeMac. The circles used for the underline are now drawn directly with Core Graphics and we no longer use an image resource. To allow both GraphicsContext and RenderTheme to have different versions of the drawLineForDocumentMarker() method, the DocumentMarkerLineStyle enum is now an "enum class". No new test due to webkit.org/b/105616, webkit.org/b/187655 was raised to track the creation of new tests when it becomes possible again. * platform/graphics/GraphicsContext.h: * platform/graphics/GraphicsContextImpl.h: * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawLineForDocumentMarker): * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker): * platform/graphics/cairo/GraphicsContextImplCairo.h: * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::GraphicsContext::drawLineForDocumentMarker): * platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::DrawLineForDocumentMarker::create): (WebCore::DisplayList::DrawLineForDocumentMarker::DrawLineForDocumentMarker): * platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::drawLineForDocumentMarker): * platform/graphics/displaylists/DisplayListRecorder.h: * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker): * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: * platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::drawLineForDocumentMarker): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintPlatformDocumentMarker): Call drawLineForDocumentMarker() on the RenderTheme on macOS and on GraphicsContext in all other cases. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::drawLineForDocumentMarker): * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::colorForStyle): Provide different colors for light and dark modes. (WebCore::RenderThemeMac::drawLineForDocumentMarker): A new macOS-specific version of drawLineForDocumentMarker() where we paint circles using Core Graphics directly. 2018-07-13 Charlie Turner <cturner@igalia.com> [GStreamer] Use smart pointers for GstByteReader https://bugs.webkit.org/show_bug.cgi?id=187638 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Add specialisation for GstByteReader. * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: Use the new smart pointer class to avoid needing to remember where to call gst_byte_reader_free. (webKitMediaClearKeyDecryptorDecrypt): 2018-07-13 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Move HTTP Setup logic from CurlRequest to CurlHandle for reuse. https://bugs.webkit.org/show_bug.cgi?id=187427 Reviewed by Fujii Hironori. CurlContext will be used by Secure WebSocket client, but HTTP setup code is in CurlRequest, which is only for regular HTTP/HTTPS transaction. This patch allows wss client to setup CurlHandle for HTTPS communication, such as TLS, proxy or authentication. No new tests because there's no behavior change. * platform/network/curl/CurlContext.cpp: (WebCore::CurlHandle::CurlHandle): (WebCore::CurlHandle::enableSSLForHost): (WebCore::CurlHandle::willSetupSslCtx): (WebCore::CurlHandle::willSetupSslCtxCallback): (WebCore::CurlHandle::sslErrors const): (WebCore::CurlHandle::setUrl): (WebCore::CurlHandle::enableHttp): (WebCore::CurlHandle::enableConnectionOnly): (WebCore::CurlHandle::certificateInfo const): (WebCore::CurlHandle::enableStdErrIfUsed): (WebCore::CurlHandle::initialize): Deleted. * platform/network/curl/CurlContext.h: (WebCore::CurlHandle::url const): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupTransfer): (WebCore::CurlRequest::didReceiveHeader): (WebCore::CurlRequest::didCompleteTransfer): (WebCore::CurlRequest::finalizeTransfer): (WebCore::CurlRequest::willSetupSslCtx): Deleted. (WebCore::CurlRequest::willSetupSslCtxCallback): Deleted. * platform/network/curl/CurlRequest.h: * platform/network/curl/CurlSSLVerifier.cpp: (WebCore::CurlSSLVerifier::CurlSSLVerifier): (WebCore::CurlSSLVerifier::verify): * platform/network/curl/CurlSSLVerifier.h: 2018-07-13 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer][MSE] Add GstFlowCombiner to handle non-linked inactive branches https://bugs.webkit.org/show_bug.cgi?id=187636 Reviewed by Carlos Garcia Campos. When we have more than one source buffer, only one will be rendered and the inactive branch will report linking errors that we have to deal with. * platform/graphics/gstreamer/GUniquePtrGStreamer.h: Added GstFlowCombiner. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webkitMediaSrcChain): Combine the flow in the flow combiner. (webkit_media_src_init): Initialize the flow combiner. (webKitMediaSrcLinkStreamToSrcPad): Add the proxypad to the combiner and set the chain function. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h: Declare the flow combiner. 2018-07-13 Charlie Turner <cturner@igalia.com> [GStreamer] Add GstBufferMapped abstraction https://bugs.webkit.org/show_bug.cgi?id=187600 Reviewed by Xabier Rodriguez-Calvar. There is a similar abstraction called `mapGstBuffer` and friends, which have a slightly different use-case: wanting a buffer that is mapped for a longer lifetime without have to keep track of the map infos separately. They could be subsumed by this abstraction, but everytime they need to write to the buffer, they'd have to remap the memory blocks. This abstraction is more for one-short reads and writes saving the user from remembering to unmap the buffer and having to manage to auxiliary GstMapInfo structures. * platform/graphics/gstreamer/GStreamerCommon.h: (WebCore::GstMappedBuffer::GstMappedBuffer): (WebCore::GstMappedBuffer::~GstMappedBuffer): (WebCore::GstMappedBuffer::data): (WebCore::GstMappedBuffer::size const): (WebCore::GstMappedBuffer::operator bool const): * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: (webKitMediaClearKeyDecryptorSetupCipher): (webKitMediaClearKeyDecryptorDecrypt): 2018-07-12 Wenson Hsieh <wenson_hsieh@apple.com> Make it easier to hit the significant rendered text layout milestone on pages with main article elements https://bugs.webkit.org/show_bug.cgi?id=187578 <rdar://problem/42104637> Reviewed by Ryosuke Niwa. Our current heuristics for triggering the significant rendered text layout milestone are very conservative, with the intention of avoiding false positives. In practice, we can relax some of these constraints when we've detected the presence of a main article element on the page. (e.g. in New York Times articles). See per-method changes below for more detail. Test: RenderingProgressTests.DidRenderSignificantAmountOfText * dom/Document.cpp: (WebCore::Document::registerArticleElement): (WebCore::Document::unregisterArticleElement): (WebCore::Document::updateMainArticleElementAfterLayout): As a post layout task, update the main article element by looping through the articles (up to a maximum limit of 10) in search of an article element that is several times larger than the second largest article element. * dom/Document.h: Store a set containing the article elements in the document, as well as the current main article on the page. (WebCore::Document::hasMainArticleElement const): * html/Element.cpp: (WebCore::Element::insertedIntoAncestor): (WebCore::Element::removedFromAncestor): Keep track of the article elements that exist in the document whenever elements with the article tag are added to or removed from the document. * page/FrameView.cpp: Add new minimum thresholds for firing the significant rendered text milestone when there exists a main article. (WebCore::FrameView::performPostLayoutTasks): (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded): Take the main article element into consideration when determining whether to fire the significant text layout milestone. 2018-07-12 Daniel Bates <dabates@apple.com> JavaScript URL gives incorrect result when frame is navigated https://bugs.webkit.org/show_bug.cgi?id=187203 <rdar://problem/41438443> Reviewed by David Kilzer. * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): 2018-07-12 Alex Christensen <achristensen@webkit.org> Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki and Youenn Fablet. We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! To restore the IPC encoding to how it was before r221165, I just encode the string and reparse it. * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): * workers/service/server/RegistrationDatabase.cpp: Increment the service worker registration schema version because of the URL encoding change. 2018-07-12 Youenn Fablet <youenn@apple.com> Add a FrameLoaderClient willInjectUserScriptForFrame callback https://bugs.webkit.org/show_bug.cgi?id=187565 Reviewed by Alex Christensen. Test: http/tests/contentextensions/injected-script-callback.html. * loader/FrameLoaderClient.h: * page/Frame.cpp: (WebCore::Frame::injectUserScriptImmediately): Calling the new callback whenever being about to inject a new script. 2018-07-12 Megan Gardner <megan_gardner@apple.com> Keep Selections within Shadow DOM boundaries https://bugs.webkit.org/show_bug.cgi?id=187556 <rdar://problem/41664567> Reviewed by Ryosuke Niwa. Expose needed functionality to WebKit to help with determing editing and shadow dom boundries. Only exposing functionality to WebKit. * dom/TreeScope.h: * editing/Editing.h: * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::adjustPositionForEnd const): (WebCore::VisibleSelection::adjustPositionForStart const): (WebCore::adjustPositionForEnd): Deleted. (WebCore::adjustPositionForStart): Deleted. * editing/VisibleSelection.h: 2018-07-12 Sihui Liu <sihui_liu@apple.com> IndexedDB: database file of subframe cannot be removed https://bugs.webkit.org/show_bug.cgi?id=187564 Reviewed by Youenn Fablet. For IndexedDB, if openingOrigin is different from mainFrameOrigin, there will be another layer in the database file path. IDBServer should delete database files recursively to make sure all files are removed. Covered by modified test: WebKit.WebsiteDataStoreCustomPaths. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::removeAllDatabasesForOriginPath): 2018-07-12 Per Arne Vollan <pvollan@apple.com> Add compile guard for enabling NSRunLoop in the WebContent process. https://bugs.webkit.org/show_bug.cgi?id=187563 Reviewed by Chris Dumez. No new tests, no change in behavior. * platform/mac/EventLoopMac.mm: (WebCore::EventLoop::cycle): 2018-07-12 Zalan Bujtas <zalan@apple.com> Newly added float should trigger full layout on the block. https://bugs.webkit.org/show_bug.cgi?id=187251 <rdar://problem/41726137> Reviewed by David Kilzer. RenderBlockFlow::determineStartPosition() is one of the places where we decide the extent of the line layout for the current block. In here we try to figure out the first line in the block that requires layout. In certain cases when floats are present, (due to their intrusive behavior) we just trigger a full layout on the entire block. One of the special cases is when a new float is added to the block. determineStartPosition() checks for such floats (floats inserted after the "last known float") and marks the block for full layout. However it missed the case when other, unrelated mutations happened in addition to this newly inserted float. This patch fixes this case by checking if the floats after the "last know float" actually need layout. Test: fast/inline/new-float-needs-layout-when-line-is-dirty.html * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::determineStartPosition): 2018-07-12 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Add pads to the GstFlowCombiner in MediaStreamSrc https://bugs.webkit.org/show_bug.cgi?id=187552 Reviewed by Alejandro G. Castro. This was overlooked and it is the way the API is supposed to be used. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::webkitMediaStreamSrcAddPad): 2018-07-12 Yusuke Suzuki <utatane.tea@gmail.com> [JSC] Thread VM& to JSCell::methodTable(VM&) https://bugs.webkit.org/show_bug.cgi?id=187548 Reviewed by Saam Barati. * bindings/js/JSDOMConstructorBase.h: (WebCore::JSDOMConstructorBase::className): * bindings/js/JSPluginElementFunctions.cpp: (WebCore::pluginElementCustomGetCallData): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::JSInterfaceName::estimatedSize): * bindings/scripts/test/JS/JSInterfaceName.h: 2018-07-11 Youenn Fablet <youenn@apple.com> MediaDevices should derive from EventTarget in its IDL https://bugs.webkit.org/show_bug.cgi?id=187575 Reviewed by Chris Dumez. Test: fast/mediastream/MediaDevices-addEventListener.html * Modules/mediastream/MediaDevices.idl: 2018-07-11 Jon Lee <jonlee@apple.com> Update iOS fullscreen alert text https://bugs.webkit.org/show_bug.cgi?id=187576 rdar://problem/42052284 Reviewed by Ryosuke Niwa. * English.lproj/Localizable.strings: 2018-07-11 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r233742. https://bugs.webkit.org/show_bug.cgi?id=187577 Binary incompatible change with respect to Service Worker registration map (Requested by dydz on #webkit). Reverted changeset: "Reduce size of WebCore::URL" https://bugs.webkit.org/show_bug.cgi?id=186820 https://trac.webkit.org/changeset/233742 2018-07-11 Aditya Keerthi <akeerthi@apple.com> REGRESSION (231276): Attempting to copy an image fails https://bugs.webkit.org/show_bug.cgi?id=187212 <rdar://problem/41540074> Reviewed by Ryosuke Niwa. Renamed methods to make it clear that one URL and one title are being passed in. Test: editing/mac/pasteboard/can-copy-url-without-title.html * platform/PasteboardStrategy.h: * platform/PlatformPasteboard.h: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::setURL): * platform/mac/PasteboardMac.mm: (WebCore::writeURLForTypes): (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType): * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::setURL): 2018-07-11 Alex Christensen <achristensen@webkit.org> Add SPI for immediate injection of user scripts https://bugs.webkit.org/show_bug.cgi?id=173342 <rdar://problem/29202285> Reviewed by Brady Eidson, Youenn Fablet, and Geoff Garen. The new SPI is WKUserContentController._addUserScriptImmediately. It is covered by new API tests. Existing functionality remains unchanged unless the new SPI is adopted. * page/Frame.cpp: (WebCore::Frame::injectUserScripts): (WebCore::Frame::injectUserScriptImmediately): Move injection functionality to allow us to call it directly from the new SPI. * page/Frame.h: * page/Page.cpp: (WebCore::Page::forEachPage): * page/Page.h: 2018-07-11 Alex Christensen <achristensen@webkit.org> Reduce size of WebCore::URL https://bugs.webkit.org/show_bug.cgi?id=186820 Reviewed by Yusuke Suzuki. We were using 32 bits for the length of the port, which is always between 0 and 5 inclusive because port numbers are missing or between 0 and 65535. Let's just use 3 bits here. We were using 32 bits for the length of the scheme, which is usually 3-5 characters and can be longer for some custom schemes, but I've never seen one more than 20 characters. If we assume schemes are always less than 64MB, we can save 8 bytes per URL! No change in behavior, just less memory use! * platform/URL.cpp: (WebCore::URL::invalidate): (WebCore::URL::lastPathComponent const): (WebCore::URL::port const): (WebCore::URL::protocolHostAndPort const): (WebCore::URL::path const): (WebCore::URL::removePort): (WebCore::URL::setPort): (WebCore::URL::setHostAndPort): (WebCore::URL::setPath): * platform/URL.h: (WebCore::URL::encode const): (WebCore::URL::decode): (WebCore::URL::hasPath const): (WebCore::URL::pathStart const): * platform/URLParser.cpp: (WebCore::URLParser::copyBaseWindowsDriveLetter): (WebCore::URLParser::urlLengthUntilPart): (WebCore::URLParser::copyURLPartsUntil): (WebCore::URLParser::shouldPopPath): (WebCore::URLParser::popPath): (WebCore::URLParser::parse): (WebCore::URLParser::parsePort): (WebCore::URLParser::parseHostAndPort): (WebCore::URLParser::allValuesEqual): (WebCore::URLParser::internalValuesConsistent): 2018-07-11 Youenn Fablet <youenn@apple.com> Fix remaining Cross-Origin-Resource-Policy failures, if any https://bugs.webkit.org/show_bug.cgi?id=186761 <rdar://problem/41209829> Reviewed by Alex Christensen. Add case-sensitive check for CORP header value, as per fetch specification. Add HTTP->HTTPS check for same-site case, as per fetch specification. https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check Test: imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html * loader/CrossOriginAccessControl.cpp: (WebCore::shouldCrossOriginResourcePolicyCancelLoad): * platform/network/HTTPParsers.cpp: (WebCore::parseCrossOriginResourcePolicyHeader): 2018-07-11 Ross Kirsling <ross.kirsling@sony.com> [WinCairo] MIME type registry doesn't explicitly recognize *.xht https://bugs.webkit.org/show_bug.cgi?id=187555 Reviewed by Konstantin Tokarev. Follow-up to r233715 -- WinCairo bots are failing on *.xht layout tests as they lack a registry key for this filetype. (Hopefully this is the last one to add.) * platform/win/MIMETypeRegistryWin.cpp: (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Add *.xht to the list of recognized filetypes. 2018-07-11 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186501 <rdar://problem/41000224> Unreviewed build fix after r233729 and r233730. * animation/KeyframeEffectReadOnly.cpp: (WebCore::processIterableKeyframes): 2018-07-11 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186501 <rdar://problem/41000224> Unreviewed build fix after r233729. * animation/KeyframeEffectReadOnly.cpp: (WebCore::processIterableKeyframes): 2018-07-10 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186501 <rdar://problem/41000224> Reviewed by Dean Jackson. There were two remaining assertions that we were failing in this WPT test file, both related to processing iterable keyframes. The first one was failing because didn't correctly propagate the TypeError exception in the forEachInIterable() callback. The second one was failing because we didn't use the "process a keyframe-like object" procedure when processing iterable keyframes and, as such, we didn't correctly sort property alphabetically before reading their values. To fix this second issue, we make processIterableKeyframes() use processKeyframeLikeObject(). To do so, we update processKeyframeLikeObject() to accept a new boolean flag to match the "allow lists" flag from the specification. We also ensure we sort the properties *before* reading from them which we didn't use to do previously. * animation/KeyframeEffectReadOnly.cpp: (WebCore::processKeyframeLikeObject): (WebCore::processIterableKeyframes): (WebCore::processPropertyIndexedKeyframes): * animation/KeyframeEffectReadOnly.h: * animation/KeyframeEffectReadOnly.idl: 2018-07-11 Zalan Bujtas <zalan@apple.com> SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com https://bugs.webkit.org/show_bug.cgi?id=186709 <rdar://problem/41173793> Reviewed by Simon Fraser. The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append. Not testable. * rendering/SimpleLineLayoutFlowContents.h: 2018-07-10 Youenn Fablet <youenn@apple.com> Make fetch() use "same-origin" credentials by default https://bugs.webkit.org/show_bug.cgi?id=176023 Reviewed by Chris Dumez. Covered by updated tests. * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::initializeWith): Setting credentials mode to same-origin for FetchRequest by default. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): Handle correctly referrer in case we restart a load. * page/PerformanceResourceTiming.cpp: (WebCore::entryStartTime): (WebCore::entryEndTime): In case it is not allowed to disclose resource timing info, update as https://www.w3.org/TR/resource-timing-1/#performanceresourcetiming 2018-07-10 Chris Dumez <cdumez@apple.com> "serviceworker.js" is fetched several times in a row https://bugs.webkit.org/show_bug.cgi?id=187435 <rdar://problem/41940569> Reviewed by Youenn Fablet. Soft updates happen every time a fetch event is sent to a service worker for a main resource request. This can happen many times during a page load and will cause us to spam the HTTP server with update requests, especially considering that the default behavior is to bypass the HTTP cache. To address the issue, we now do soft updates on a 1 second delay and we keep rescheduling this timer was long as soft update requests keep coming. Based on my understanding of the Chromium code, this seems to be what they are doing so this should align our behavior with them. * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration): (WebCore::ServiceWorkerRegistration::scheduleSoftUpdate): * workers/service/ServiceWorkerRegistration.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): 2018-07-10 Ross Kirsling <ross.kirsling@sony.com> [WinCairo] MIME type registry doesn't explicitly recognize *.css https://bugs.webkit.org/show_bug.cgi?id=187538 Reviewed by Yusuke Suzuki. MIMETypeRegistryWin doesn't explicitly recognize *.css; it instead falls back to the registry key "Content Type" under HKEY_CLASSES_ROOT\.css. This key doesn't exist on Windows Server unless an application actually registers it -- as a result, WinCairo bots are currently viewing it as an unrecognized filetype! * platform/win/MIMETypeRegistryWin.cpp: (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Add *.css to the list of recognized filetypes. 2018-07-10 Timothy Hatcher <timothy@apple.com> REGRESSION (r233552): Find highlight has white text on yellow background https://bugs.webkit.org/show_bug.cgi?id=187535 rdar://problem/42043371 Reviewed by Tim Horton. Fixes existing image tests: - fast/text/mark-matches-rendering.html - fast/text/mark-matches-broken-line-rendering.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::resolveStyleForMarkedText): Remove incorect UseDarkAppearance. 2018-07-10 Chris Fleizach <cfleizach@apple.com> AX: Crash in accessing AXObjectCache in textMarkerDataForVisiblePosition https://bugs.webkit.org/show_bug.cgi?id=187528 <rdar://problem/37231941> Reviewed by Joanmarie Diggs. Occasional crashes reported when running accessibility/mac/search-field-cancel-button.html. Looks like the cache object retrieved was not valid and we weren't checking for it. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::visiblePositionForTextMarkerData): (WebCore::AXObjectCache::textMarkerDataForVisiblePosition): (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl): 2018-07-10 Zalan Bujtas <zalan@apple.com> FragmentInterval, FragmentIntervalTree and FragmentSearchAdapter should hold not hold raw pointers to renderers. https://bugs.webkit.org/show_bug.cgi?id=187249 <rdar://problem/41725869> Reviewed by Simon Fraser. Test: fast/multicol/crash-in-vertical-writing-mode.html * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::updateFragmentsFragmentedFlowPortionRect): * rendering/RenderFragmentedFlow.h: (WTF::ValueToString<WeakPtr<WebCore::RenderFragmentContainer>>::string): 2018-07-10 Ryosuke Niwa <rniwa@webkit.org> Disable cross-origin-window-policy by default https://bugs.webkit.org/show_bug.cgi?id=187509 Reviewed by Chris Dumez. Disabled the feature by default. * page/Settings.yaml: 2018-07-10 Alejandro G. Castro <alex@igalia.com> [GTK][WPE] The LibWebRTCProvider object in RealtimeMediaSourceCenterLibWebRTC is not needed anymore https://bugs.webkit.org/show_bug.cgi?id=187513 Reviewed by Youenn Fablet. We used the factory of the LibWebRTCProvider in RealtimeMediaSourceCenterLibWebRTC as a singleton to make sure the devices were correctly listed and used, we needed this when using libwebrtc media devices management. We are now using GStreamer to handle the media devices so this is not needed anymore. No new tests, this change removed unused code. * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp: (WebCore::RealtimeMediaSourceCenterLibWebRTC::RealtimeMediaSourceCenterLibWebRTC): * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h: 2018-07-10 Zalan Bujtas <zalan@apple.com> Rollout r233530: Candidate for Speedometer regression. https://bugs.webkit.org/show_bug.cgi?id=187518 * rendering/SimpleLineLayoutFlowContents.h: 2018-07-09 Antoine Quint <graouts@apple.com> [Web Animations] Correct handle repetition of composite and easing values https://bugs.webkit.org/show_bug.cgi?id=187498 <rdar://problem/41999183> Reviewed by Dean Jackson. If there are fewer values for "easing" and "composite" than there are keyframes, we are supposed to fill in missing values by repeating the pattern of specified values. We were starting our iteration to fill those missing values on the second missing value rather than the first missing value. * animation/KeyframeEffectReadOnly.cpp: (WebCore::processPropertyIndexedKeyframes): 2018-07-09 Youenn Fablet <youenn@apple.com> Add the possibility to run unsandboxed plug-ins https://bugs.webkit.org/show_bug.cgi?id=187310 <rdar://problem/41798808> Reviewed by Alexey Proskuryakov. Add a runtime flag to enforce plugin sandboxing. Covered by manual testing. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setSandboxPlugInEnabled): (WebCore::RuntimeEnabledFeatures::sandboxPlugInEnabled const): 2018-07-09 Dean Jackson <dino@apple.com> Remove fullscreen-auto-hide-delay https://bugs.webkit.org/show_bug.cgi?id=187493 <rdar://problem/41830852> Reviewed by Antoine Quint. Remove the env() value for fullscreen-auto-hide-delay. * dom/ConstantPropertyMap.cpp: (WebCore::ConstantPropertyMap::nameForProperty const): (WebCore::ConstantPropertyMap::setFullscreenAutoHideDelay): Deleted. * dom/ConstantPropertyMap.h: * page/Page.cpp: (WebCore::Page::setFullscreenAutoHideDelay): Deleted. * page/Page.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): No need to reset delay. (WebCore::Internals::setFullscreenAutoHideDelay): Deleted. * testing/Internals.h: Remove the delay setter/getter. * testing/Internals.idl: 2018-07-09 Timothy Hatcher <timothy@apple.com> Semantic colors don't update when accessibility Increase Contrast mode is enabled. https://bugs.webkit.org/show_bug.cgi?id=187425 rdar://problem/39948240 Reviewed by Tim Horton. Added a listener for the accessibility change notification to invalidate our color caches. Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times. Instead, changed the functions to use the new instance version instead. * page/Page.cpp: (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work per instance instead of on all pages (since appearance can be difference per view). (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment. (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment. (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment. * page/Page.h: (WebCore::Page::setUseDarkAppearance): Moved to the implementation file. * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering with the setting of m_usingDarkAppearance and causing the wrong color cache to be used. (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto. * rendering/RenderThemeMac.mm: (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification. (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now. (WebCore::RenderThemeMac::systemColor): Change how system link colors are cached. Don't store useSystemAppearance link colors in the ColorCache, since that special bool isn't considered in the cache after the first time. 2018-07-09 Simon Fraser <simon.fraser@apple.com> Shrink various loading-related enums to shrink CachedResource https://bugs.webkit.org/show_bug.cgi?id=187443 Reviewed by Chris Dumez. ResourceRequestBase, ResourceResponseBase, ResourceLoaderOptions, FetchOptions and CachedResource have a lot of enum members variables most of which took 4 bytes each. These can be packed much more efficiently if the enums are declared with an 8-bit size. This requires turning enums into enum classes in some cases. This reduces the size of CachedResource from 1464 to 1384 bytes, which saves about 49KB over the ~600 CachedResources on nytimes.com. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::startLoadingBlobURL): (WebCore::FetchLoader::start): * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::requestStyleSheet): * fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::start): * html/MediaDocument.cpp: (WebCore::MediaDocumentParser::createDocumentStructure): * html/PluginDocument.cpp: (WebCore::PluginDocumentParser::appendBytes): * html/parser/CSSPreloadScanner.cpp: (WebCore::CSSPreloadScanner::emitRule): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::resourceType const): * inspector/NetworkResourcesData.cpp: (WebCore::shouldBufferResourceData): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didReceiveResponse): (WebCore::InspectorNetworkAgent::loadResource): (WebCore::InspectorNetworkAgent::cachedResourceContent): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::sourceMapURLForResource): (WebCore::InspectorPageAgent::inspectorResourceType): * loader/ApplicationManifestLoader.cpp: (WebCore::ApplicationManifestLoader::startLoading): * loader/ContentFilter.cpp: (WebCore::ContentFilter::deliverResourceData): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::notifyFinished): (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::tryLoadingRedirectRequestFromApplicationCache): (WebCore::DocumentLoader::subresource const): (WebCore::DocumentLoader::loadMainResource): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest): (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): (WebCore::DocumentThreadableLoader::preflightSuccess): (WebCore::DocumentThreadableLoader::loadRequest): * loader/FetchOptions.h: (WebCore::FetchOptions::FetchOptions): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadFrameRequest): (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::reloadWithOverrideEncoding): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::defaultRequestCachingPolicy): (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::loadedResourceFromMemoryCache): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/LinkLoader.cpp: (WebCore::LinkLoader::resourceTypeFromAsAttribute): (WebCore::createLinkPreloadResourceClient): (WebCore::LinkLoader::isSupportedType): (WebCore::LinkLoader::prefetchIfNeeded): * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::requestResource): * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::scheduleLocationChange): * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader): * loader/ResourceLoadInfo.cpp: (WebCore::toResourceType): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::init): (WebCore::ResourceLoader::start): (WebCore::ResourceLoader::setDataBufferingPolicy): (WebCore::ResourceLoader::addDataOrBuffer): (WebCore::ResourceLoader::willSendRequestInternal): (WebCore::ResourceLoader::didReceiveResponse): (WebCore::ResourceLoader::didReceiveDataOrBuffer): (WebCore::ResourceLoader::didFinishLoadingOnePart): (WebCore::ResourceLoader::cleanupForError): * loader/ResourceLoader.h: (WebCore::ResourceLoader::shouldSendResourceLoadCallbacks const): (WebCore::ResourceLoader::shouldSniffContent const): (WebCore::ResourceLoader::shouldIncludeCertificateInfo const): * loader/ResourceLoaderOptions.h: * loader/ResourceTimingInformation.cpp: (WebCore::ResourceTimingInformation::addResourceTiming): (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::SubresourceLoader): (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse const): (WebCore::SubresourceLoader::didReceiveResponse): (WebCore::logResourceLoaded): (WebCore::SubresourceLoader::didFinishLoading): (WebCore::SubresourceLoader::didFail): (WebCore::SubresourceLoader::didCancel): * loader/cache/CachedApplicationManifest.cpp: (WebCore::CachedApplicationManifest::CachedApplicationManifest): * loader/cache/CachedApplicationManifest.h: * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet): * loader/cache/CachedCSSStyleSheet.h: * loader/cache/CachedFont.h: * loader/cache/CachedImage.cpp: (WebCore::CachedImage::CachedImage): (WebCore::CachedImage::updateBuffer): (WebCore::CachedImage::updateData): * loader/cache/CachedImage.h: * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::updateBuffer): (WebCore::CachedRawResource::updateData): (WebCore::CachedRawResource::finishLoading): (WebCore::CachedRawResource::canReuse const): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::defaultPriorityForResourceType): (WebCore::deadDecodedDataDeletionIntervalForResourceType): (WebCore::CachedResource::CachedResource): (WebCore::CachedResource::load): (WebCore::CachedResource::updateBuffer): (WebCore::CachedResource::updateData): (WebCore::CachedResource::isCORSSameOrigin const): (WebCore::CachedResource::freshnessLifetime const): (WebCore::CachedResource::setResponse): (WebCore::CachedResource::addClientToSet): (WebCore::CachedResource::areAllClientsXMLHttpRequests const): * loader/cache/CachedResource.h: (WebCore::CachedResource::isImage const): (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const): (WebCore::CachedResource::ignoreForRequestCount const): (WebCore::CachedResource::shouldSendResourceLoadCallbacks const): * loader/cache/CachedResourceLoader.cpp: (WebCore::createResource): (WebCore::CachedResourceLoader::requestImage): (WebCore::CachedResourceLoader::requestFont): (WebCore::CachedResourceLoader::requestTextTrack): (WebCore::CachedResourceLoader::requestCSSStyleSheet): (WebCore::CachedResourceLoader::requestScript): (WebCore::CachedResourceLoader::requestXSLStyleSheet): (WebCore::CachedResourceLoader::requestSVGDocument): (WebCore::CachedResourceLoader::requestLinkResource): (WebCore::CachedResourceLoader::requestMedia): (WebCore::CachedResourceLoader::requestIcon): (WebCore::CachedResourceLoader::requestRawResource): (WebCore::CachedResourceLoader::requestBeaconResource): (WebCore::CachedResourceLoader::requestMainResource): (WebCore::CachedResourceLoader::requestApplicationManifest): (WebCore::contentTypeFromResourceType): (WebCore::CachedResourceLoader::checkInsecureContent const): (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const): (WebCore::CachedResourceLoader::canRequest): (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox const): (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): (WebCore::isResourceSuitableForDirectReuse): (WebCore::destinationForType): (WebCore::CachedResourceLoader::loadResource): (WebCore::CachedResourceLoader::determineRevalidationPolicy const): (WebCore::CachedResourceLoader::cachePolicy const): (WebCore::CachedResourceLoader::preload): (WebCore::CachedResourceLoader::warnUnusedPreloads): (WebCore::CachedResourceLoader::clearPreloads): (WebCore::CachedResourceLoader::defaultCachedResourceOptions): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::updateAccordingCacheMode): * loader/cache/CachedResourceRequest.h: * loader/cache/CachedSVGDocument.cpp: (WebCore::CachedSVGDocument::CachedSVGDocument): * loader/cache/CachedSVGDocument.h: * loader/cache/CachedSVGFont.cpp: (WebCore::CachedSVGFont::CachedSVGFont): * loader/cache/CachedSVGFont.h: * loader/cache/CachedScript.cpp: (WebCore::CachedScript::CachedScript): * loader/cache/CachedScript.h: * loader/cache/CachedTextTrack.cpp: (WebCore::CachedTextTrack::CachedTextTrack): (WebCore::CachedTextTrack::doUpdateBuffer): * loader/cache/CachedTextTrack.h: * loader/cache/CachedXSLStyleSheet.cpp: (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet): * loader/cache/CachedXSLStyleSheet.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::getStatistics): * loader/icon/IconLoader.cpp: (WebCore::IconLoader::startLoading): * loader/mac/ResourceLoaderMac.mm: (WebCore::ResourceLoader::willCacheResponseAsync): * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): * page/EventSource.cpp: (WebCore::EventSource::connect): * platform/ReferrerPolicy.h: * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::startLoading): * platform/ios/QuickLook.mm: (WebCore::registerQLPreviewConverterIfNeeded): * platform/network/CacheValidation.cpp: (WebCore::updateRedirectChainStatus): (WebCore::redirectChainAllowsReuse): * platform/network/CacheValidation.h: (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus): * platform/network/ResourceErrorBase.h: * platform/network/ResourceLoadPriority.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::httpBody const): (WebCore::ResourceRequestBase::updatePlatformRequest const): (WebCore::ResourceRequestBase::updateResourceRequest const): * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/StoredCredentialsPolicy.h: * platform/network/cf/ResourceRequest.h: (WebCore::ResourceRequest::ResourceRequest): * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::toPlatformRequestCachePolicy): (WebCore::fromPlatformRequestCachePolicy): (WebCore::ResourceRequest::doUpdateResourceRequest): * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::fromPlatformRequestCachePolicy): (WebCore::toPlatformRequestCachePolicy): (WebCore::ResourceRequest::doUpdateResourceRequest): * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]): * platform/network/ios/PreviewConverter.mm: (WebCore::PreviewConverter::safeRequest const): * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::createNSURLConnection): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::platformLoadResourceSynchronously): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): * testing/Internals.cpp: (WebCore::toResourceRequestCachePolicy): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): (WebCore::WorkerScriptLoader::loadAsynchronously): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createRequest): 2018-07-09 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186498 <rdar://problem/41000205> Reviewed by Dean Jackson. Add a Constructor to the DocumentTimeline IDL to match the spec and ensure we respect the provided origin time. To ensure all DocumentTimeline instances report matching current times, we read the current time from the "main" document timeline, the one created by the Document automatically. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::create): (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::currentTime): * animation/DocumentTimeline.h: * animation/DocumentTimeline.idl: * animation/DocumentTimelineOptions.h: * animation/DocumentTimelineOptions.idl: 2018-07-09 Antoine Quint <graouts@apple.com> [Web Animations] Support overlapping keyframes https://bugs.webkit.org/show_bug.cgi?id=187481 <rdar://problem/41988674> Reviewed by Dean Jackson. We now support parsing of multiple keyframes for the same offset. * animation/KeyframeEffectReadOnly.cpp: (WebCore::computeMissingKeyframeOffsets): Keyframes with a null offset that don't yet have a non-zero computed offset are keyframes with an offset that needs to be computed. (WebCore::KeyframeEffectReadOnly::processKeyframes): Only file an exception if an offset is found that is lower than a previously-parsed one, allowing offsets with the same value. * rendering/style/KeyframeList.cpp: (WebCore::KeyframeList::insert): Remove the assertion that prevented an offset to be found more than once. 2018-07-09 Youenn Fablet <youenn@apple.com> StringView operator==(char*) should check the length of the string https://bugs.webkit.org/show_bug.cgi?id=187422 Reviewed by Chris Dumez. Covered by existing tests. * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename): 2018-07-09 Simon Fraser <simon.fraser@apple.com> Shrink WebCore::Pair https://bugs.webkit.org/show_bug.cgi?id=187450 Reviewed by Sam Weinig. Move m_encoding to pack in with m_refCount and remove the virtual destructor, shrinking the class from 40 to 24 bytes. Also make the enum take only a byte, in case it gets used elsewhere There are about 500 Pairs on nytimes.com, so this memory saving is non-trivial. * css/Pair.h: 2018-07-09 Yusuke Suzuki <utatane.tea@gmail.com> [WebCore] Annotate classes with WTF_MAKE_FAST_ALLOCATED as much as possible https://bugs.webkit.org/show_bug.cgi?id=187474 Reviewed by Mark Lam. When opening cnn.com, debugger says that so many objects in WebCore are allocated from system allocator. This patch attempts to annotate these found classes with WTF_MAKE_FAST_ALLOCATED. We also annotate WebAudio classes with `final` to make WebAudio class hierarchy solid. No behavior change. * Modules/indexeddb/IDBIndex.h: * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/mediastream/UserMediaController.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * Modules/webaudio/AsyncAudioDecoder.h: * Modules/webaudio/AudioListener.h: (WebCore::AudioListener::create): Deleted. (WebCore::AudioListener::setPosition): Deleted. (WebCore::AudioListener::position const): Deleted. (WebCore::AudioListener::setOrientation): Deleted. (WebCore::AudioListener::orientation const): Deleted. (WebCore::AudioListener::setUpVector): Deleted. (WebCore::AudioListener::upVector const): Deleted. (WebCore::AudioListener::setVelocity): Deleted. (WebCore::AudioListener::velocity const): Deleted. (WebCore::AudioListener::setDopplerFactor): Deleted. (WebCore::AudioListener::dopplerFactor const): Deleted. (WebCore::AudioListener::setSpeedOfSound): Deleted. (WebCore::AudioListener::speedOfSound const): Deleted. * Modules/webaudio/AudioNode.h: * Modules/webaudio/AudioNodeInput.h: (WebCore::AudioNodeInput::node const): Deleted. * Modules/webaudio/AudioNodeOutput.h: * Modules/webaudio/AudioParam.h: (WebCore::AudioParam::create): Deleted. (WebCore::AudioParam::name const): Deleted. (WebCore::AudioParam::minValue const): Deleted. (WebCore::AudioParam::maxValue const): Deleted. (WebCore::AudioParam::defaultValue const): Deleted. (WebCore::AudioParam::units const): Deleted. (WebCore::AudioParam::resetSmoothedValue): Deleted. (WebCore::AudioParam::setSmoothingConstant): Deleted. (WebCore::AudioParam::setValueAtTime): Deleted. (WebCore::AudioParam::linearRampToValueAtTime): Deleted. (WebCore::AudioParam::exponentialRampToValueAtTime): Deleted. (WebCore::AudioParam::setTargetAtTime): Deleted. (WebCore::AudioParam::setValueCurveAtTime): Deleted. (WebCore::AudioParam::cancelScheduledValues): Deleted. (WebCore::AudioParam::hasSampleAccurateValues): Deleted. (WebCore::AudioParam::AudioParam): Deleted. * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/AudioProcessingEvent.h: (WebCore::AudioProcessingEvent::create): Deleted. (WebCore::AudioProcessingEvent::createForBindings): Deleted. (WebCore::AudioProcessingEvent::inputBuffer): Deleted. (WebCore::AudioProcessingEvent::outputBuffer): Deleted. (WebCore::AudioProcessingEvent::playbackTime const): Deleted. * Modules/webaudio/BiquadDSPKernel.h: (WebCore::BiquadDSPKernel::BiquadDSPKernel): Deleted. (WebCore::BiquadDSPKernel::biquadProcessor): Deleted. * Modules/webaudio/BiquadFilterNode.h: (WebCore::BiquadFilterNode::create): Deleted. (WebCore::BiquadFilterNode::frequency): Deleted. (WebCore::BiquadFilterNode::q): Deleted. (WebCore::BiquadFilterNode::gain): Deleted. (WebCore::BiquadFilterNode::detune): Deleted. (WebCore::BiquadFilterNode::biquadProcessor): Deleted. * Modules/webaudio/BiquadProcessor.h: (WebCore::BiquadProcessor::filterCoefficientsDirty const): Deleted. (WebCore::BiquadProcessor::hasSampleAccurateValues const): Deleted. (WebCore::BiquadProcessor::parameter1): Deleted. (WebCore::BiquadProcessor::parameter2): Deleted. (WebCore::BiquadProcessor::parameter3): Deleted. (WebCore::BiquadProcessor::parameter4): Deleted. (WebCore::BiquadProcessor::type const): Deleted. * Modules/webaudio/ChannelMergerNode.h: * Modules/webaudio/ChannelSplitterNode.h: * Modules/webaudio/DelayDSPKernel.h: (WebCore::DelayDSPKernel::maxDelayTime const): Deleted. (WebCore::DelayDSPKernel::setDelayFrames): Deleted. (WebCore::DelayDSPKernel::delayProcessor): Deleted. * Modules/webaudio/DelayNode.h: * Modules/webaudio/DelayProcessor.h: (WebCore::DelayProcessor::delayTime const): Deleted. (WebCore::DelayProcessor::maxDelayTime): Deleted. * Modules/webaudio/DynamicsCompressorNode.h: (WebCore::DynamicsCompressorNode::create): Deleted. (WebCore::DynamicsCompressorNode::threshold): Deleted. (WebCore::DynamicsCompressorNode::knee): Deleted. (WebCore::DynamicsCompressorNode::ratio): Deleted. (WebCore::DynamicsCompressorNode::attack): Deleted. (WebCore::DynamicsCompressorNode::release): Deleted. (WebCore::DynamicsCompressorNode::reduction): Deleted. * Modules/webaudio/GainNode.h: (WebCore::GainNode::create): Deleted. (WebCore::GainNode::gain): Deleted. * Modules/webaudio/MediaElementAudioSourceNode.h: (WebCore::MediaElementAudioSourceNode::mediaElement): Deleted. * Modules/webaudio/MediaStreamAudioDestinationNode.h: (WebCore::MediaStreamAudioDestinationNode::stream): Deleted. * Modules/webaudio/MediaStreamAudioSourceNode.h: (WebCore::MediaStreamAudioSourceNode::mediaStream): Deleted. * Modules/webaudio/OfflineAudioCompletionEvent.h: (WebCore::OfflineAudioCompletionEvent::renderedBuffer): Deleted. * Modules/webaudio/OfflineAudioDestinationNode.h: (WebCore::OfflineAudioDestinationNode::create): Deleted. * Modules/webaudio/PannerNode.h: (WebCore::PannerNode::create): Deleted. (WebCore::PannerNode::panningModel const): Deleted. (WebCore::PannerNode::position const): Deleted. (WebCore::PannerNode::setPosition): Deleted. (WebCore::PannerNode::orientation const): Deleted. (WebCore::PannerNode::setOrientation): Deleted. (WebCore::PannerNode::velocity const): Deleted. (WebCore::PannerNode::setVelocity): Deleted. (WebCore::PannerNode::refDistance): Deleted. (WebCore::PannerNode::setRefDistance): Deleted. (WebCore::PannerNode::maxDistance): Deleted. (WebCore::PannerNode::setMaxDistance): Deleted. (WebCore::PannerNode::rolloffFactor): Deleted. (WebCore::PannerNode::setRolloffFactor): Deleted. (WebCore::PannerNode::coneInnerAngle const): Deleted. (WebCore::PannerNode::setConeInnerAngle): Deleted. (WebCore::PannerNode::coneOuterAngle const): Deleted. (WebCore::PannerNode::setConeOuterAngle): Deleted. (WebCore::PannerNode::coneOuterGain const): Deleted. (WebCore::PannerNode::setConeOuterGain): Deleted. (WebCore::PannerNode::distanceGain): Deleted. (WebCore::PannerNode::coneGain): Deleted. * Modules/webaudio/PeriodicWave.h: (WebCore::PeriodicWave::rateScale const): Deleted. (WebCore::PeriodicWave::periodicWaveSize const): Deleted. (WebCore::PeriodicWave::sampleRate const): Deleted. (WebCore::PeriodicWave::numberOfRanges const): Deleted. * Modules/webaudio/RealtimeAnalyser.h: * Modules/webaudio/ScriptProcessorNode.h: (WebCore::ScriptProcessorNode::bufferSize const): Deleted. (WebCore::ScriptProcessorNode::doubleBufferIndex const): Deleted. (WebCore::ScriptProcessorNode::swapBuffers): Deleted. * Modules/webaudio/WaveShaperDSPKernel.h: (WebCore::WaveShaperDSPKernel::waveShaperProcessor): Deleted. * Modules/webaudio/WaveShaperProcessor.h: (WebCore::WaveShaperProcessor::curve): Deleted. (WebCore::WaveShaperProcessor::oversample const): Deleted. * dom/MessagePort.h: * html/FormAssociatedElement.h: * loader/LinkPreloadResourceClients.h: * page/WheelEventDeltaFilter.h: * page/mac/WheelEventDeltaFilterMac.h: * platform/RemoteCommandListener.h: * platform/audio/AudioDSPKernel.h: * platform/audio/AudioProcessor.h: * platform/audio/PlatformMediaSession.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h: * workers/service/ServiceWorkerContainer.h: 2018-07-09 Simon Fraser <simon.fraser@apple.com> Shrink RenderSVGShape https://bugs.webkit.org/show_bug.cgi?id=187459 Reviewed by Zalan Bujtas. Shrink RenderSVGShape from 328 to 320 bytes by moving the bits before the AffineTransform, which is 16-byte aligned. This saves 9.6KB on nytimes.com. * rendering/svg/RenderSVGShape.h: 2018-07-09 Simon Fraser <simon.fraser@apple.com> Shrink CSSFontFace https://bugs.webkit.org/show_bug.cgi?id=187456 Reviewed by Anders Carlsson. Shrink CSSFontFace by 56 bytes, from 288 to 256 bytes, mostly by defining enums as 8-bit, but also re-ordering the member variables. There are over 400 of these objects on nytimes.com, so this saves about 22KB. * css/CSSFontFace.cpp: (WebCore::CSSFontFace::CSSFontFace): * css/CSSFontFace.h: * platform/text/TextFlags.h: * rendering/style/RenderStyleConstants.h: 2018-07-09 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r233612. https://bugs.webkit.org/show_bug.cgi?id=187475 Revision caused the api test LinkColorWithSystemAppearance to fail on all systems. (Requested by Truitt on #webkit). Reverted changeset: "Semantic colors don't update when accessibility Increase Contrast mode is enabled." https://bugs.webkit.org/show_bug.cgi?id=187425 https://trac.webkit.org/changeset/233612 2018-07-09 Philippe Normand <pnormand@igalia.com> [GStreamer] Remove useless workaround https://bugs.webkit.org/show_bug.cgi?id=186921 Reviewed by Xabier Rodriguez-Calvar. In bug 67407 a workaround was added for GStreamer 0.10. With 1.x the media/video-reverse-play-duration.html test passes without any workaround needed. The other test mentioned in that bug was removed, it seems. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Removed early return, position queries shouldn't be avoided on EOS because the pipeline is in READY state, not NULL. (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const): 2018-07-08 Simon Fraser <simon.fraser@apple.com> Optimize packing of RenderSVGViewportContainer https://bugs.webkit.org/show_bug.cgi?id=187458 Reviewed by Zalan Bujtas. Shrink RenderSVGViewportContainer from 296 bytes to 280 bytes, saving about 6KB on nytimes.com. * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::RenderSVGContainer): * rendering/svg/RenderSVGContainer.h: * rendering/svg/RenderSVGViewportContainer.h: 2018-07-08 Simon Fraser <simon.fraser@apple.com> Shrink RenderTableSection https://bugs.webkit.org/show_bug.cgi?id=187457 Reviewed by Zalan Bujtas. Shrink RenderTableSection from 344 to 336 bytes, saving about 3.6KB on nytimes.com. * rendering/RenderTableSection.h: 2018-07-08 Simon Fraser <simon.fraser@apple.com> Optimize packing of RootInlineBox https://bugs.webkit.org/show_bug.cgi?id=187430 Reviewed by Zalan Bujtas. In InlineBox, move the m_logicalWidth float up next to the m_expansion float with m_topLeft next; this avoids padding of 4 bytes after this float. In InlineFlowBox, move the bitfields before the pointers so they can snug up into the 4 bytes after m_expansion in the base class. The comment about m_lineBreakPos's padding in RootInlineBox is wrong; just move it to the end to avoid padding before the m_lineBreakObj pointer. Make m_logicalWidth private and have derived classes use the accessor. Make EllipsisBox 4 bytes smaller too. * rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::EllipsisBox): (WebCore::EllipsisBox::paintMarkupBox): (WebCore::EllipsisBox::nodeAtPoint): * rendering/EllipsisBox.h: * rendering/InlineBox.h: (WebCore::InlineBox::InlineBox): * rendering/InlineFlowBox.cpp: * rendering/InlineFlowBox.h: (WebCore::InlineFlowBox::InlineFlowBox): (WebCore::InlineFlowBox::frameRectIncludingLineHeight const): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::localSelectionRect const): (WebCore::InlineTextBox::paint): (WebCore::InlineTextBox::paintPlatformDocumentMarker): (WebCore::InlineTextBox::paintMarkedTextBackground): (WebCore::InlineTextBox::paintCompositionUnderline const): * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::RootInlineBox): * rendering/RootInlineBox.h: 2018-07-08 Antoine Quint <graouts@apple.com> [Web Animations] A number of tests report an incorrect computed offset https://bugs.webkit.org/show_bug.cgi?id=187410 <rdar://problem/41905790> Reviewed by Dean Jackson. While we would correctly avoid computing missing offsets when processing the first keyframe following the last keyframes with a specified offset, we were forgetting to update the index of the last keyframe with a specified offset which meant we would accidentally override a specified offset with an automically-computed one. * animation/KeyframeEffectReadOnly.cpp: (WebCore::computeMissingKeyframeOffsets): 2018-07-08 David Kilzer <ddkilzer@apple.com> DOMMatrix.invertSelf() returns garbage values for a non-invertible matrix <https://webkit.org/b/187446> <rdar://problem/41853187> Reviewed by Daniel Bates. Test: http/wpt/css/geometry/DOMMatrix-invertSelf.html * css/DOMMatrix.cpp: (WebCore::DOMMatrix::invertSelf): Add missing `else`, and restructure to use positive logic. 2018-07-07 Wenson Hsieh <wenson_hsieh@apple.com> Introduce a layout milestone to track when the document contains a large number of rendered characters https://bugs.webkit.org/show_bug.cgi?id=187412 <rdar://problem/41744338> Reviewed by Ryosuke Niwa. Implements a new layout milestone: `DidRenderSignificantAmountOfText`. This is similar to the existing `DidFirstVisuallyNonEmptyLayout` milestone, but with a few important additional constraints: • The minimum threshold of rendered characters is much larger (3000 instead of 200). • The mean length of a text node must be large (at least 50). This is a (computationally) lightweight heuristic intended to estimate the likelihood that a page is capable of being presented in Reader mode. In many article-like pages, the average length of a text node is significantly longer than other types of pages; thus, on pages where the average length of a text node is very large *and* there is a large quantity of text, we can use this as a cue to opportunistically detect and enter Safari reader mode on watchOS. Test: RenderingProgressTests.DidRenderSignificantAmountOfText * page/FrameView.cpp: (WebCore::FrameView::reset): Clear out new state members that keep track of whether the significant rendered text milestone has been met. (WebCore::elementOverflowRectIsLargerThanThreshold): Factor out logic to grab the overflow height of an element into a separate helper function. (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const): (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded): Determines whether to fire this new milestone after the next layout pass is finished. The logic here is similar to the logic in qualifiesAsVisuallyNonEmpty, requiring that there are not still pending stylesheets in the head and that the document height is at least a minimum threshold. However, unlike the first visually non-empty layout, this milestone is never guaranteed to fire. (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded): * page/FrameView.h: (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount): * page/LayoutMilestones.h: 2018-07-06 Timothy Hatcher <timothy@apple.com> Semantic colors don't update when accessibility Increase Contrast mode is enabled. https://bugs.webkit.org/show_bug.cgi?id=187425 rdar://problem/39948240 Reviewed by Tim Horton. Added a listener for the accessibility change notification to invalidate our color caches. Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times. Instead, changed the functions to use the new instance version instead. * page/Page.cpp: (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work per instance instead of on all pages (since appearance can be difference per view). (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment. (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment. (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment. * page/Page.h: (WebCore::Page::setUseDarkAppearance): Moved to the implementation file. * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering with the setting of m_usingDarkAppearance and causing the wrong color cache to be used. (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto. * rendering/RenderThemeMac.mm: (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification. (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now. 2018-07-06 Ryosuke Niwa <rniwa@webkit.org> Make ReasonForSuspension enum class https://bugs.webkit.org/show_bug.cgi?id=187405 Reviewed by Zalan Bujtas. Made ReasonForSuspension an enum class instead of enum and moved out of ActiveDOMObject. * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::suspend): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::suspend): * dom/ActiveDOMObject.h: * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInFrame): (WebCore::Document::suspendActiveDOMObjects): (WebCore::Document::resumeActiveDOMObjects): (WebCore::Document::suspend): (WebCore::Document::resume): (WebCore::Document::suspendScheduledTasks): (WebCore::Document::resumeScheduledTasks): * dom/Document.h: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): (WebCore::ScriptExecutionContext::resumeActiveDOMObjects): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::reasonForSuspendingActiveDOMObjects const): * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): (WebCore::CachedFrame::CachedFrame): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::suspend): * html/HTMLSourceElement.cpp: (WebCore::HTMLSourceElement::suspend): * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::setJavaScriptPaused): * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): * page/Frame.cpp: (WebCore::Frame::suspendActiveDOMObjectsAndAnimations): (WebCore::Frame::resumeActiveDOMObjectsAndAnimations): * page/PageGroupLoadDeferrer.cpp: (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::suspend): 2018-07-06 Nan Wang <n_wang@apple.com> AX: add a subrole for meter elements on macOS https://bugs.webkit.org/show_bug.cgi?id=187409 <rdar://problem/41905702> Reviewed by Chris Fleizach. Test: accessibility/mac/meter-subrole.html * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper subrole]): 2018-07-06 Jeremy Jones <jeremyj@apple.com> For <video> element, use video fullscreen instead of element fullscreen. https://bugs.webkit.org/show_bug.cgi?id=186093 rdar://problem/40144751 Reviewed by Jer Noble. Some pages use webkitRequestFullscreen directly on the video element, without any custom controls. This will prevent native fullscreeen presentation mode conrols from being used. This change makes webkitRequestFullscreen on a video element call webKitSetPresentationMode. * dom/Element.h: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitRequestFullscreen): * html/HTMLVideoElement.h: 2018-07-06 Youenn Fablet <youenn@apple.com> WebRTC MediaStreamTrack Enable / Disable causes video delay / lag https://bugs.webkit.org/show_bug.cgi?id=186889 <rdar://problem/41370285> Reviewed by Eric Carlson. Libwebrtc expects a continuous flow of calls for audio data since the API does not provide any possiblity to give timestamps. We were optimizing previously when a source is muted so that we would not transmit audio data. This breaks synchronization between audio and video frames (which are timestamped). This patch reverts the optimization and instead makes sure to send zeros for silenced audio tracks. This requires MediaStreamTrackPrivate to send audio data even if disabled, so that RealtimeOutgoingAudioSource will continue sending zeros at the correct pace. This also requires WebAudioSourceProviderAVFObjC to exit early if its track is disabled. Covered by existing tests. Manual testing shows that synchronization is kept. * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::initializeConverter): (WebCore::RealtimeOutgoingAudioSource::stop): (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged): (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged): (WebCore::RealtimeOutgoingAudioSource::handleMutedIfNeeded): Deleted. * platform/mediastream/RealtimeOutgoingAudioSource.h: (WebCore::RealtimeOutgoingAudioSource::pullAudioData): (WebCore::RealtimeOutgoingAudioSource::isSilenced const): (WebCore::RealtimeOutgoingAudioSource::sendSilence): Deleted. * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData): (WebCore::RealtimeOutgoingAudioSourceCocoa::handleMutedIfNeeded): Deleted. (WebCore::RealtimeOutgoingAudioSourceCocoa::sendSilence): Deleted. * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable): 2018-07-06 Youenn Fablet <youenn@apple.com> Make RealtimeOutgoingVideoSource use DestructionThread::Main https://bugs.webkit.org/show_bug.cgi?id=187402 Reviewed by Chris Dumez. No change of behavior. * platform/mediastream/RealtimeOutgoingVideoSource.h: 2018-07-06 Ryosuke Niwa <rniwa@webkit.org> Make HTMLMediaElement::remove*Track take a Ref<>&& https://bugs.webkit.org/show_bug.cgi?id=187407 Reviewed by Zalan Bujtas. Make these functions take Ref<>&& since they can delete track objects. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removeAudioTrack): (WebCore::HTMLMediaElement::removeTextTrack): (WebCore::HTMLMediaElement::removeVideoTrack): (WebCore::HTMLMediaElement::forgetResourceSpecificTracks): * html/HTMLMediaElement.h: 2018-07-06 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186502 <rdar://problem/41000229>l Reviewed by Dean Jackson. Ensure we only attempt to convert defined objects or we risk to throw errors in valid situations. * animation/KeyframeEffectReadOnly.cpp: (WebCore::processKeyframeLikeObject): 2018-07-05 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186496 <rdar://problem/41000179> Reviewed by Dean Jackson. We used to only resolve animations that had a target element, but animations need not have a target and their current time should still advance so that their finished promise may resolve. We now maintain a list of animations without targets and we iterate through them as well as animations with targets in DocumentTimeline::updateAnimations(). * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::addAnimation): (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToElement): (WebCore::AnimationTimeline::animationWasRemovedFromElement): * animation/AnimationTimeline.h: (WebCore::AnimationTimeline:: const): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::updateAnimations): * animation/WebAnimation.cpp: (WebCore::WebAnimation::resolve): * animation/WebAnimation.h: 2018-07-05 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at interfaces/Animation/finished.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186497 <rdar://problem/41000193> Reviewed by Dean Jackson. We need to ensure the finished state is updated as a result of any timing property changing. * animation/AnimationEffectReadOnly.cpp: (WebCore::AnimationEffectReadOnly::timingDidChange): * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingPropertiesDidChange): * animation/WebAnimation.h: 2018-07-06 Antoine Quint <graouts@apple.com> [Web Animations] Using a Web Animation leaks the Document https://bugs.webkit.org/show_bug.cgi?id=187088 <rdar://problem/41392046> Reviewed by Darin Adler. Test: webanimations/leak-document-with-web-animation.html We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document. We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates the animation from its timeline. An earlier version of this patch (r233349) was rolled out due to crashes caught in the ASan configuration. The following changes were made to make it safe: - We protect the DocumentAnimationScheduler instance in displayRefreshFired() against code that might run in a requestAnimationFrame() callback that would trigger the object to be deleted. - We protect the WebAnimation instance in remove() against setEffectInternal() or setTimelineInternal() potentially causing the object to be deleted. Similar protections were addede to setEffect() and setTimeline(). - We changed ~DocumentTimeline() to a default implementation to ensure it calls ~DisplayRefreshMonitorClient() to avoid callbacks after the object has been marked for deletion. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation() since the new WebAnimation::remove() method will also set the timeline to null which will eventually call removeAnimation() on the disassociated timeline. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::remove): (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted. * animation/DeclarativeAnimation.h: * animation/DocumentAnimationScheduler.cpp: (WebCore::DocumentAnimationScheduler::displayRefreshFired): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations. (WebCore::DocumentTimeline::~DocumentTimeline): Deleted. * animation/WebAnimation.cpp: (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline. (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so that we can call this code without any JS-facing implications. (WebCore::WebAnimation::setTimelineInternal): (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted. * animation/WebAnimation.h: 2018-07-06 Daniel Bates <dabates@apple.com> Remove Strong Confirmation Password button https://bugs.webkit.org/show_bug.cgi?id=187306 <rdar://problem/41795185> Reviewed by Sam Weinig. Remove support for the Strong Confirmation Password button because we never made use of it. * English.lproj/Localizable.strings: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * html/HTMLInputElement.h: (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): * html/HTMLTextFormControlElement.h: * html/TextFieldInputType.cpp: (WebCore::autoFillButtonTypeToAccessibilityLabel): (WebCore::autoFillButtonTypeToAutoFillButtonText): (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName): (WebCore::isAutoFillButtonTypeChanged): * platform/LocalizedStrings.cpp: (WebCore::AXAutoFillStrongConfirmationPasswordLabel): Deleted. * platform/LocalizedStrings.h: * rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::layout): * testing/Internals.cpp: (WebCore::toAutoFillButtonType): (WebCore::toInternalsAutoFillButtonType): * testing/Internals.h: * testing/Internals.idl: 2018-07-06 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] REGRESSION(r233239): proxy settings not applied after r233239 https://bugs.webkit.org/show_bug.cgi?id=187381 Reviewed by Yusuke Suzuki. This is because the static variable for proxy settings was replaced by a NeverDestroyed, but the function is not returning a reference, but a copy. This is causing several unit tests to fail. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::proxySettings): 2018-07-06 Frederic Wang <fwang@igalia.com> [Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine https://bugs.webkit.org/show_bug.cgi?id=187382 Reviewed by Carlos Garcia Campos. WebCore::AnimationBase::updateStateMachine has two potential places where the use of an uninitialized std:optional value is possible and one of them is hit when using Google drive. Since that old animation code is going to be removed soon, we just quickly patch this issue via value_or() so that we can restore the ASSERT added in bug 186536. No new tests, code is going to be removed soon. * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::updateStateMachine): Use value_or(0) to avoid potential crashes. 2018-07-06 Frederic Wang <fwang@igalia.com> Rename HTMLTreeBuilder::didCreateCustomOrCallbackElement https://bugs.webkit.org/show_bug.cgi?id=187317 Reviewed by Ryosuke Niwa. This function is called with a new custom element or the fallback HTMLUnknownElement element so we rename it didCreateCustomOrFallbackElement. No new tests, behavior unchanged. * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::didCreateCustomOrFallbackElement): (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement): Deleted. * html/parser/HTMLTreeBuilder.h: 2018-07-05 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r233496): macOS Sierra hits debug assertions in TrackListBase::suspend https://bugs.webkit.org/show_bug.cgi?id=187378 <rdar://problem/41878885> Reviewed by Eric Carlson. These assertions were wrong since inline debugger, alert, etc... can suspend active DOM objects without calling canSuspendForDocumentSuspension. Fixed the bug by removing the assertion and instead suspending and resuming the generic event queue. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::suspend): (WebCore::MediaSource::resume): * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::suspend): (WebCore::SourceBuffer::resume): * Modules/mediasource/SourceBufferList.cpp: (WebCore::SourceBufferList::suspend): (WebCore::SourceBufferList::resume): * html/track/TrackListBase.cpp: (WebCore::TrackListBase::suspend): (WebCore::TrackListBase::resume): 2018-07-05 Youenn Fablet <youenn@apple.com> REGRESSION (r230843): Flash doesn't work; Produces blue box on page https://bugs.webkit.org/show_bug.cgi?id=187346 <rdar://problem/41773974> Reviewed by Ryosuke Niwa. Introduce clearPagesPluginData used by WebProcess when a plugin policy changes. Add a new internals API to get the plugin count as navigator.plugin is filtering plugins. Test: http/tests/plugins/plugin-allow-then-reload.html * plugins/PluginData.h: * plugins/PluginInfoProvider.cpp: (WebCore::PluginInfoProvider::clearPagesPluginData): * plugins/PluginInfoProvider.h: * testing/Internals.cpp: (WebCore::Internals::pluginCount): * testing/Internals.h: * testing/Internals.idl: 2018-07-05 Brady Eidson <beidson@apple.com> IndexedDB operations in a Page fail after a StorageProcess crash. <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123 Reviewed by Alex Christensen. Test: storage/indexeddb/modern/opendatabase-after-storage-crash.html When the connection to a StorageProcess goes away, explicitly tell all of the WebPages in the WebProcess about it. This puts Documents/Workers in an error mode where requests fail instead of timeout. It also clears the Page's connection so *new* Documents and Workers will get a fresh new connection that works. * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::callResultFunctionLater): (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase): (WebCore::IDBClient::IDBConnectionToServer::openDatabase): (WebCore::IDBClient::IDBConnectionToServer::createObjectStore): (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore): (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore): (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore): (WebCore::IDBClient::IDBConnectionToServer::createIndex): (WebCore::IDBClient::IDBConnectionToServer::deleteIndex): (WebCore::IDBClient::IDBConnectionToServer::renameIndex): (WebCore::IDBClient::IDBConnectionToServer::putOrAdd): (WebCore::IDBClient::IDBConnectionToServer::getRecord): (WebCore::IDBClient::IDBConnectionToServer::getAllRecords): (WebCore::IDBClient::IDBConnectionToServer::getCount): (WebCore::IDBClient::IDBConnectionToServer::deleteRecord): (WebCore::IDBClient::IDBConnectionToServer::openCursor): (WebCore::IDBClient::IDBConnectionToServer::iterateCursor): (WebCore::IDBClient::IDBConnectionToServer::establishTransaction): (WebCore::IDBClient::IDBConnectionToServer::commitTransaction): (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction): (WebCore::IDBClient::IDBConnectionToServer::abortTransaction): (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent): (WebCore::IDBClient::IDBConnectionToServer::confirmDidCloseFromServer): (WebCore::IDBClient::IDBConnectionToServer::connectionToServerLost): (WebCore::IDBClient::IDBConnectionToServer::openDBRequestCancelled): (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose): (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed): (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded): (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames): * Modules/indexeddb/client/IDBConnectionToServer.h: * Modules/indexeddb/shared/IDBError.h: (WebCore::IDBError::serverConnectionLostError): * page/Page.cpp: (WebCore::Page::setSessionID): (WebCore::Page::idbConnection): (WebCore::Page::optionalIDBConnection): (WebCore::Page::clearIDBConnection): * page/Page.h: 2018-07-05 Ryosuke Niwa <rniwa@webkit.org> Youtube video pages crash after a couple of minutes https://bugs.webkit.org/show_bug.cgi?id=187316 Reviewed by Antti Koivisto. The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager, which traverses all media players across different documents including the one in the main frame while its iframe is getting removed (to update the Touch Bar's media control). Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this, this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately. Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules a timer via scheduleUpdateNowPlayingInfo instead. Test: media/remove-video-best-media-element-in-main-frame-crash.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been moved to Page. (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of a raw pointer while we're at it. (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager. (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout. (WebCore::HTMLMediaElement::contextDestroyed): (WebCore::HTMLMediaElement::stop): (WebCore::HTMLMediaElement::schedulePlaybackControlsManagerUpdate): Renamed from scheduleUpdatePlaybackControlsManager. (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::playbackControlsManagerUpdateTimerFired. * html/HTMLMediaElement.h: * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added. (WebCore::Page::playbackControlsManagerUpdateTimerFired): Moved from HTMLMediaElement::updatePlaybackControlsManager. * page/Page.h: * testing/Internals.cpp: (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager): * testing/Internals.h: 2018-07-05 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r233496): Crash in WebCore::VideoTrack::clearClient() https://bugs.webkit.org/show_bug.cgi?id=187377 Reviewed by Simon Fraser. Clear m_client of an audio track or a video track before removing it from the list since TrackListBase::m_inbandTracks may hold the last ref to the track. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removeAudioTrack): (WebCore::HTMLMediaElement::removeVideoTrack): 2018-07-05 Fujii Hironori <Hironori.Fujii@sony.com> REGRESSION(r233495) [cairo] drawGlyphsShadow should use the fast path for zero blur-radius https://bugs.webkit.org/show_bug.cgi?id=187336 Reviewed by Carlos Garcia Campos. drawGlyphsShadow has a fast path to draw a shadow without a shadow layer. Since r233495, it is not used for zero blur-radius shadow. In Bug 187244, I changed ShadowState::isRequired not to check blur-radius is zero. This is not a right fix. This change reverts r233495. No new tests (Covered by existing tests). * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::ShadowState::isRequired const): Return false if 'blur' is zero. (WebCore::Cairo::fillRectWithRoundedHole): Use ShadowState::isVisible instead of ShadowState::isRequired to check a shadow should be drawn. 2018-07-05 Timothy Hatcher <timothy@apple.com> Rename and flip the meaning of defaultAppearance to be useDarkAppearance. https://bugs.webkit.org/show_bug.cgi?id=187369 rdar://problem/41870420 Reviewed by Tim Horton. * Modules/mediasession/WebMediaSessionManager.cpp: (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): * css/MediaQueryEvaluator.cpp: (WebCore::prefersDarkInterfaceEvaluate): * css/StyleColor.h: * dom/Document.cpp: (WebCore::Document::useDarkAppearance const): (WebCore::Document::styleColorOptions const): (WebCore::Document::useDefaultAppearance const): Deleted. * dom/Document.h: * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::paint): * page/Page.cpp: (WebCore::Page::useDarkAppearance const): (WebCore::Page::defaultAppearance const): Deleted. * page/Page.h: (WebCore::Page::setUseDarkAppearance): (WebCore::Page::setDefaultAppearance): Deleted. * platform/Theme.h: * platform/graphics/MediaPlaybackTargetPicker.h: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): * platform/mac/DragImageMac.mm: (WebCore::createDragImageForLink): * platform/mac/LocalDefaultSystemAppearance.h: * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (WebCore::ThemeMac::paint): * platform/mock/MediaPlaybackTargetPickerMock.cpp: (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker): * platform/mock/MediaPlaybackTargetPickerMock.h: * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::resolveStyleForMarkedText): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintContents): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::paintContents): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::documentViewFor const): (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeMac::supportsSelectionForegroundColors const): (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const): (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const): (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const): (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const): (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const): (WebCore::RenderThemeMac::colorCache const): (WebCore::RenderThemeMac::systemColor const): (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): (WebCore::RenderThemeMac::paintSliderThumb): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::draw): 2018-07-05 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r233539. https://bugs.webkit.org/show_bug.cgi?id=187368 Changes made for youtube crashes has caused 15 api failures (Requested by Truitt on #webkit). Reverted changeset: "Youtube video pages crash after a couple of minutes" https://bugs.webkit.org/show_bug.cgi?id=187316 https://trac.webkit.org/changeset/233539 2018-07-05 Chris Dumez <cdumez@apple.com> Update Element API to use qualifiedName instead of name/localName where applicable https://bugs.webkit.org/show_bug.cgi?id=187347 Reviewed by Darin Adler. Update Element API to use qualifiedName instead of name/localName where applicable. Naming is now consistent with the IDL and the specification: - https://dom.spec.whatwg.org/#element Our implementation properly deals with qualified names already, even though the parameters were named localName. * dom/Element.cpp: (WebCore::Element::getAttribute const): (WebCore::Element::toggleAttribute): (WebCore::Element::setAttribute): (WebCore::Element::removeAttribute): (WebCore::Element::getAttributeNode): (WebCore::Element::hasAttribute const): * dom/Element.h: 2018-07-04 Ryosuke Niwa <rniwa@webkit.org> Youtube video pages crash after a couple of minutes https://bugs.webkit.org/show_bug.cgi?id=187316 Reviewed by Antti Koivisto. The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager, which traverses all media players across different documents including the one in the main frame while its iframe is getting removed (to update the Touch Bar's media control). Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this, this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately. Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules a timer via scheduleUpdateNowPlayingInfo instead. Test: media/remove-video-best-media-element-in-main-frame-crash.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been moved to Page. (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of a raw pointer while we're at it. (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager. (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout. (WebCore::HTMLMediaElement::contextDestroyed): (WebCore::HTMLMediaElement::stop): (WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager): (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::schedulePlaybackControlsManagerUpdate. * html/HTMLMediaElement.h: * page/Page.cpp: (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added. * page/Page.h: * testing/Internals.cpp: (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager): * testing/Internals.h: 2018-07-05 Zalan Bujtas <zalan@apple.com> Do not assume that hypen's width can be computed using the simplified text measure codepath. https://bugs.webkit.org/show_bug.cgi?id=187352 <rdar://problem/40821283> Reviewed by Simon Fraser. Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well. Test: fast/text/hyphen-is-complex-crash.html * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator): * rendering/SimpleLineLayoutTextFragmentIterator.h: 2018-07-05 Eric Carlson <eric.carlson@apple.com> Video sometimes flickers when playing to AppleTV https://bugs.webkit.org/show_bug.cgi?id=187193 <rdar://problem/40153865> Unreviewed, fix a broken API test. * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::setCategory): None should set the category to AVAudioSessionCategoryAmbient, because it signals that WebKit is not playing audio so we want allow other apps to play. 2018-07-05 Per Arne Vollan <pvollan@apple.com> Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) in ScrollAnimatorMac.mm https://bugs.webkit.org/show_bug.cgi?id=187334 Reviewed by Alex Christensen. Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) instead of __MAC_OS_X_VERSION_MIN_REQUIRED when deciding to use NSTimer or NSAnimation for scrollbar animation. No new tests. No change in behavior. * platform/mac/ScrollAnimatorMac.mm: (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]): (-[WebScrollbarPartAnimation startAnimation]): (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]): 2018-07-05 Timothy Hatcher <timothy@apple.com> Don't invert text color for selections in light mode. https://bugs.webkit.org/show_bug.cgi?id=187349 rdar://problem/41297946 Reviewed by Tim Horton. Fix color caching in RenderTheme so we don't cache a dark mode color for a light appearance, or vise versa. Use the new color caching in RenderThemeMac, and clear the color caches in purgeCaches. Allow supportsSelectionForegroundColors to conditionalize on StyleColor::Options. Return true only in dark mode. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::activeSelectionBackgroundColor const): (WebCore::RenderTheme::inactiveSelectionBackgroundColor const): (WebCore::RenderTheme::activeSelectionForegroundColor const): (WebCore::RenderTheme::inactiveSelectionForegroundColor const): (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const): (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const): (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const): (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const): (WebCore::RenderTheme::purgeCaches): (WebCore::RenderTheme::platformColorsDidChange): (WebCore::RenderTheme::activeTextSearchHighlightColor const): (WebCore::RenderTheme::inactiveTextSearchHighlightColor const): * rendering/RenderTheme.h: (WebCore::RenderTheme::supportsSelectionForegroundColors const): (WebCore::RenderTheme::supportsListBoxSelectionForegroundColors const): (WebCore::RenderTheme::colorCache const): (WebCore::RenderTheme::purgeCaches): Deleted. * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::purgeCaches): (WebCore::RenderThemeMac::supportsSelectionForegroundColors const): (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const): (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const): (WebCore::RenderThemeMac::platformColorsDidChange): (WebCore::RenderThemeMac::colorCache const): (WebCore::RenderThemeMac::systemColor const): 2018-07-05 Zalan Bujtas <zalan@apple.com> SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com https://bugs.webkit.org/show_bug.cgi?id=186709 <rdar://problem/41173793> Reviewed by Simon Fraser. The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append. Not testable. * rendering/SimpleLineLayoutFlowContents.h: 2018-07-05 Nan Wang <n_wang@apple.com> AX: setValue on text controls should send out key events https://bugs.webkit.org/show_bug.cgi?id=186690 <rdar://problem/41169985> Reviewed by Chris Fleizach. Use Editor's insertText function when the text control element is being focused, so that the InputEvent will be dispatched properly. Test: accessibility/mac/set-value-editable-dispatch-events.html * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setValue): 2018-07-05 Chris Dumez <cdumez@apple.com> ASSERT(m_dictionaryStack.size() == 1) assertion hit in ~KeyedDecoderCF() when decoding fails https://bugs.webkit.org/show_bug.cgi?id=187152 Reviewed by Brent Fulgham. Whenever a call to KeyedDecoderCF::beginArrayElement() succeeds (returns true), it appends an item to m_dictionaryStack which is expected to get popped later on via a matching call to KeyedDecoderCF::endArrayElement(). The ASSERT(m_dictionaryStack.size() == 1) assertion in the destructor protects against a begin / end mismatch. However, there was a bug in KeyedDecoder::decodeObjects(), which would cause us to return early after a call to beginArrayElement() when the lambda function call returns false, causing us not to call the matching endArrayElement() in this case. This patch addresses the issue by calling endArrayElement() before returning early. This bug was uncovered by r233309 which slightly changed the ITP encoding / decoding format. Because empty HashCountedSets are now expected to be encoded as empty array, decoding of old data fails and we hit the buggy code path. * platform/KeyedCoding.h: (WebCore::KeyedDecoder::decodeObjects): 2018-07-05 Antti Koivisto <antti@apple.com> Move CSSParserContext to a file of its own https://bugs.webkit.org/show_bug.cgi?id=187342 Reviewed by Zalan Bujtas. Move it out from CSSParserMode.h and CSSParser.cpp. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * contentextensions/ContentExtensionParser.cpp: * css/PropertySetCSSStyleDeclaration.h: * css/StyleProperties.h: * css/StyleSheetContents.h: * css/parser/CSSDeferredParser.h: * css/parser/CSSParser.cpp: (WebCore::strictCSSParserContext): Deleted. (WebCore::CSSParserContext::CSSParserContext): Deleted. (WebCore::operator==): Deleted. * css/parser/CSSParser.h: * css/parser/CSSParserContext.cpp: Added. (WebCore::strictCSSParserContext): (WebCore::CSSParserContext::CSSParserContext): (WebCore::operator==): Also add the missing textAutosizingEnabled bit. * css/parser/CSSParserContext.h: Copied from Source/WebCore/css/parser/CSSParserMode.h. (WebCore::CSSParserContextHash::hash): Also add the missing bits to the hash function. (WebCore::isQuirksModeBehavior): Deleted. (WebCore::isUASheetBehavior): Deleted. (WebCore::isUnitLessValueParsingEnabledForMode): Deleted. (WebCore::isCSSViewportParsingEnabledForMode): Deleted. (WebCore::strictToCSSParserMode): Deleted. (WebCore::isStrictParserMode): Deleted. * css/parser/CSSParserIdioms.h: * css/parser/CSSParserImpl.h: * css/parser/CSSParserMode.h: (WebCore::CSSParserContext::completeURL const): Deleted. (WebCore::operator!=): Deleted. (WebCore::CSSParserContextHash::hash): Deleted. (WebCore::CSSParserContextHash::equal): Deleted. (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): Deleted. (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): Deleted. (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Deleted. * css/parser/CSSPropertyParserHelpers.h: * css/parser/CSSSelectorParser.cpp: * css/parser/CSSVariableParser.cpp: 2018-07-05 Antoine Quint <graouts@apple.com> [Web Animations] The ready promise should initially be resolved https://bugs.webkit.org/show_bug.cgi?id=187341 <rdar://problem/41844711> Reviewed by Dean Jackson. The Web Animations spec mandates that the ready promise is initially resolved. * animation/WebAnimation.cpp: (WebCore::WebAnimation::WebAnimation): 2018-07-05 Sergio Villar Senin <svillar@igalia.com> [WebVR] Fix VRDisplayEvent implementation https://bugs.webkit.org/show_bug.cgi?id=187337 Reviewed by Žan Doberšek. VRDisplayEvent implementation had two issues. First there were no attributes storing the VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it should be handled via an optional. * Modules/webvr/VRDisplayEvent.cpp: (WebCore::VRDisplayEvent::VRDisplayEvent): (WebCore::VRDisplayEvent::display const): Deleted. (WebCore::VRDisplayEvent::reason const): Deleted. * Modules/webvr/VRDisplayEvent.h: 2018-07-04 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r233325): [GTK] Broke 40 animations tests https://bugs.webkit.org/show_bug.cgi?id=187264 Reviewed by Žan Doberšek. This is because DocumentAnimationScheduler uses DisplayRefreshMonitor, that is only used by GTK port when accelerated compositing is enabled. Add a GTK display refresh monitor implementation to be used as the default. * PlatformGTK.cmake: Add new file to compilation. * platform/graphics/DisplayRefreshMonitor.cpp: (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): Create DisplayRefreshMonitorGtk in GTK. * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Added. (WebCore::DisplayRefreshMonitorGtk::DisplayRefreshMonitorGtk): (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk): (WebCore::onFrameClockUpdate): (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback): (WebCore::DisplayRefreshMonitorGtk::displayLinkFired): * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: Added. (WebCore::DisplayRefreshMonitorGtk::create): 2018-07-04 Antti Koivisto <antti@apple.com> Reparse user stylesheets when _useSystemAppearance changes https://bugs.webkit.org/show_bug.cgi?id=187312 <rdar://problem/38565834> Reviewed by Tim Horton. This setting may affect user stylesheet parsing. Reparse if it changes. Test: fast/media/use-system-appearance-user-stylesheet-parsing.html * page/Page.cpp: (WebCore::Page::setUseSystemAppearance): * page/Page.h: (WebCore::Page::setUseSystemAppearance): Deleted. * testing/Internals.cpp: (WebCore::Internals::setUseSystemAppearance): * testing/Internals.h: * testing/Internals.idl: 2018-07-04 Thibault Saunier <tsaunier@igalia.com> RealtimeIncomingVideoSources: Call stop() directly in the destructor https://bugs.webkit.org/show_bug.cgi?id=187303 Reviewed by Youenn Fablet. Avoiding to call stopProducingData when we are not actually producing data. This fixes tests that will run once the WPE/GTK PeerConnection implementation is merged. * platform/mediastream/RealtimeIncomingVideoSource.h: (WebCore::RealtimeIncomingVideoSource::~RealtimeIncomingVideoSource): 2018-07-04 Thibault Saunier <tsaunier@igalia.com> [GTK][WPE] Stop pushing the StreamCollection as event in GStreamerMediaStreamSource https://bugs.webkit.org/show_bug.cgi?id=187304 Reviewed by Philippe Normand. We let parsebin build the StreamCollection for us and pass extra metadata through the `TAG_EVENT` pushing the collection ourself is not bringing anything but adds extra work in the MediaPlayerGStreamer duplicating the STREAM_COLLECTION message for no good reason. MediaStream layout tests already test that code path. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: (WebCore::webkitMediaStreamSrcPadProbeCb): 2018-07-04 Frederic Wang <fwang@igalia.com> [WebIDL] Remove custom bindings for HTMLDocument https://bugs.webkit.org/show_bug.cgi?id=173444 Unreviewed, add missing bugzilla link for FIXME comments. * dom/Document.cpp: (WebCore::Document::closeForBindings): (WebCore::Document::write): (WebCore::Document::writeln): 2018-07-04 Tim Horton <timothy_horton@apple.com> Introduce PLATFORM(IOSMAC) https://bugs.webkit.org/show_bug.cgi?id=187315 Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: * Configurations/FeatureDefines.xcconfig: * Configurations/WebCore.xcconfig: * Modules/geolocation/ios/GeolocationPositionIOS.mm: (WebCore::GeolocationPosition::GeolocationPosition): * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::platformReleaseMemory): * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::setCategory): (WebCore::AudioSession::routingContextUID const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): * platform/ios/PlatformPasteboardIOS.mm: (WebCore::registerItemToPasteboard): * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderRegistrationInfoList itemProvider]): 2018-07-03 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at timing-model/timelines/timelines.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186508 <rdar://problem/41000260> Reviewed by Dean Jackson. The remaining failing assertion in this test assumes that the ready promise for an animation is fired prior to requestAnimationFrame callbacks being fired in the current event loop such that registering the requestAnimationFrame() call within the ready promise has its callback fired with the same timeline time. To ensure that is true, we perform a microtask checkpoint as soon as we're done running pending tasks, which will resolve the ready promise for any play-pending animations. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::updateAnimations): 2018-07-03 Ryosuke Niwa <rniwa@webkit.org> Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent() https://bugs.webkit.org/show_bug.cgi?id=187284 Reviewed by Eric Carlson. The null pointer crash was caused by some GenericEventQueue dispatching an event in a stopped document, which does not have a valid script execution context because some uses of GenericEventQueue in media code was not closing the queue upon stopping of all active DOM objects. Fixed all uses of GenericEventQueue which did not suspend or stop the queue with active DOM objects. Made SourceBufferList and TrackListBase (along with AudioTrackList, TextTrackList, and VideoTrackList) inherit from ActiveDOMObject instead of ContextDestructionObserver to do this. Also fixed a bug that media elements inside a template element (and other cases where the document doesn't have a browsing context) were scheduling events since this would hit the newly added debug assertion in GenericEventQueue::dispatchOneEvent. Test: media/track/video-track-addition-and-frame-removal.html * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: (WebCore::WebKitMediaKeySession::suspend): Assert that we never try to suspend when the document has this object alive since canSuspendForDocumentSuspension always returns false. (WebCore::WebKitMediaKeySession::resume): Ditto. (WebCore::WebKitMediaKeySession::stop): Stop the event queue to avoid the crash. * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::removeSourceBuffer): Don't do any work to update tracks when the active DOM objects are stopped since this MediaSource and the related media objects are about to be destructed. (WebCore::MediaSource::suspend): Assert that m_asyncEventQueue is empty as canSuspendForDocumentSuspension returns false whenever the queue is not empty. (WebCore::MediaSource::resume): Ditto. * Modules/mediasource/MediaSource.h: * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::suspend): Ditto. (WebCore::SourceBuffer::resume): Ditto. (WebCore::SourceBuffer::stop): Stop the event queue to avoid the crash. * Modules/mediasource/SourceBuffer.h: * Modules/mediasource/SourceBufferList.cpp: (WebCore::SourceBufferList): Made this an active DOM object. (WebCore::SourceBufferList::SourceBufferList): (WebCore::SourceBufferList::canSuspendForDocumentSuspension const): Added. Return false when there are pending events to match other media code. (WebCore::SourceBufferList::suspend): Added. Assert that the event queue is empty here. (WebCore::SourceBufferList::resume): Ditto. (WebCore::SourceBufferList::stop): Added. Stop the event queue to avoid the crash. (WebCore::SourceBufferList::activeDOMObjectName const): Added. * Modules/mediasource/SourceBufferList.h: (WebCore::SourceBufferList): Made this an active DOM object. * Modules/mediasource/SourceBufferList.idl: * dom/Document.h: (WebCore::Document::hasBrowsingContext const): Added. * dom/GenericEventQueue.cpp: (WebCore::GenericEventQueue::dispatchOneEvent): Added an assertion to catch when an event is dispatched inside a stopped document, which is never correct and causes this crash down the line. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::playInternal): Exit early when the document doesn't have a browsing context; e.g. when the media element is inside a template element. (WebCore::HTMLMediaElement::pauseInternal): Ditto. (WebCore::HTMLMediaElement::sourceWasAdded): Ditto. * html/track/AudioTrackList.cpp: (AudioTrackList::activeDOMObjectName const): Added. * html/track/AudioTrackList.h: * html/track/AudioTrackList.idl: * html/track/TextTrackList.cpp:: (TextTrackList::activeDOMObjectName const): Added. * html/track/TextTrackList.h: * html/track/TextTrackList.idl: * html/track/TrackListBase.cpp: (WebCore::TrackListBase): Made this an active DOM object. (WebCore::TrackListBase::TrackListBase): (WebCore::TrackListBase::canSuspendForDocumentSuspension const): Added. Return false when there are pending events to match other media code. (WebCore::TrackListBase::suspend): Added. Assert that the event queue is empty here. (WebCore::TrackListBase::resume): Ditto. (WebCore::TrackListBase::stop): Added. Stop the event queue to avoid the crash. * html/track/TrackListBase.h: * html/track/VideoTrackList.cpp: (VideoTrackList::activeDOMObjectName const): Added. * html/track/VideoTrackList.h: * html/track/VideoTrackList.idl: 2018-07-03 Fujii Hironori <Hironori.Fujii@sony.com> [cairo] Doesn't paint box-shadow with zero blur-radius https://bugs.webkit.org/show_bug.cgi?id=187244 Reviewed by Žan Doberšek. Cairo::ShadowState::isRequired() returned false if blur-radius is zero. No new tests (Covered by existing tests). * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::ShadowState::isRequired const): Do not check blur is zero. 2018-07-03 Ryosuke Niwa <rniwa@webkit.org> Add a release assert to diagnose infinite recursions in removeAllEventListeners() https://bugs.webkit.org/show_bug.cgi?id=187287 Reviewed by Keith Miller. Assert that we never re-enter removeAllEventListeners per thread. * dom/EventTarget.cpp: (WebCore::EventTarget::removeAllEventListeners): * platform/ThreadGlobalData.h: (WebCore::ThreadGlobalData::ThreadGlobalData::isInRemoveAllEventListeners const): (WebCore::ThreadGlobalData::ThreadGlobalData::setIsInRemoveAllEventListeners): 2018-07-03 Chris Dumez <cdumez@apple.com> performance-api/performance-observer-no-document-leak.html is flaky https://bugs.webkit.org/show_bug.cgi?id=186938 <rdar://problem/41379336> Reviewed by Simon Fraser. Add internals API to get the identifier of a document and to ask if the document with a given identifier is still alive. This is helpful to write tests for document leaking fixes. * testing/Internals.cpp: (WebCore::Internals::documentIdentifier const): (WebCore::Internals::isDocumentAlive const): * testing/Internals.h: * testing/Internals.idl: 2018-07-03 Chris Dumez <cdumez@apple.com> Improve window.event compliance: Should not be set when target is in shadow tree https://bugs.webkit.org/show_bug.cgi?id=186266 Reviewed by Ryosuke Niwa. Stop exposing window.event to Shadow DOM by not setting window.event if the event's target is a Node inside a shadow tree. This is as per the latest DOM specification: - https://github.com/whatwg/dom/pull/407 This aligns our behavior with Blink as well: - https://bugs.chromium.org/p/chromium/issues/detail?id=779461 Tests: imported/w3c/web-platform-tests/dom/events/event-global.html imported/w3c/web-platform-tests/dom/events/event-global.worker.html * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): 2018-07-03 Chris Dumez <cdumez@apple.com> [Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL https://bugs.webkit.org/show_bug.cgi?id=187270 <rdar://problem/40674034> Reviewed by Geoffrey Garen. Disable vnode guard related simulated crashes for WebSQL by setting the expected environment variable, if not already set by WKTR / DRT. * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::initialize): (WebCore::DatabaseManager::platformInitialize): * Modules/webdatabase/DatabaseManager.h: * Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: Added. (WebCore::DatabaseManager::paltformInitialize): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/FileSystem.h: * platform/posix/FileSystemPOSIX.cpp: (WebCore::FileSystem::realPath): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::realPath): 2018-07-03 Eric Carlson <eric.carlson@apple.com> Don't allow autoplay when the element is suspended https://bugs.webkit.org/show_bug.cgi?id=187299 <rdar://problem/41044691> Reviewed by Youenn Fablet. Block autoplay when a media element is suspended. Add more release logging to the methods that handle autoplay attempts to help diagnose future media playback problems. * html/HTMLMediaElement.cpp: (WebCore::convertEnumerationToString): Convert PlaybackWithoutUserGesture to a string. (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks): Add logging. (WebCore::HTMLMediaElement::hardwareMutedStateDidChange): Ditto. (WebCore::HTMLMediaElement::handleAutoplayEvent): Ditto. (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Ditto. (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Ditto. * html/HTMLMediaElement.h: (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::playbackPermitted const): Playback is not permitted when the element is suspended. * html/MediaElementSession.h: 2018-07-03 Zalan Bujtas <zalan@apple.com> [LFC] Generate anonymous inline box for text content. https://bugs.webkit.org/show_bug.cgi?id=187301 Reviewed by Antti Koivisto. Always have a inline container for text content (and no dedicated text renderer). * layout/layouttree/LayoutInlineBox.cpp: (WebCore::Layout::InlineBox::InlineBox): * layout/layouttree/LayoutInlineBox.h: (WebCore::Layout::InlineBox::setContent): * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createSubTree): 2018-07-03 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Embed certificate information into ResourceResponse. https://bugs.webkit.org/show_bug.cgi?id=187102 Reviewed by Youenn Fablet. No new tests but tested internally. Collect certificate information from the communication and put them into ResourceResponse for the sake of advanced security checking and information providing to the user. * platform/Curl.cmake: * platform/network/curl/CertificateInfo.cpp: Copied from Source/WebCore/platform/network/curl/CertificateInfo.h. (WebCore::CertificateInfo::CertificateInfo): (WebCore::CertificateInfo::isolatedCopy const): (WebCore::CertificateInfo::makeCertificate): * platform/network/curl/CertificateInfo.h: (WebCore::CertificateInfo::verificationError const): (WebCore::CertificateInfo::certificateChain const): (WebCore::operator==): (WebCore::CertificateInfo::CertificateInfo): Deleted. * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::didReceiveHeader): (WebCore::CurlRequest::didCompleteTransfer): * platform/network/curl/CurlRequest.h: (WebCore::CurlRequest::getCertificateInfo const): (WebCore::CurlRequest::getNetworkLoadMetrics const): (WebCore::CurlRequest::getNetworkLoadMetrics): Deleted. * platform/network/curl/CurlResourceHandleDelegate.cpp: (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse): (WebCore::CurlResourceHandleDelegate::curlDidComplete): * platform/network/curl/CurlSSLHandle.cpp: (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate): (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate): * platform/network/curl/CurlSSLHandle.h: * platform/network/curl/CurlSSLVerifier.cpp: (WebCore::CurlSSLVerifier::CurlSSLVerifier): (WebCore::CurlSSLVerifier::verifyCallback): (WebCore::StackOfX509::StackOfX509): For RAII. Used in pemDataFromCtx(). (WebCore::StackOfX509::~StackOfX509): Ditto. (WebCore::StackOfX509::count): Ditto. (WebCore::StackOfX509::item): Ditto. (WebCore::BIOHolder::BIOHolder): Ditto. (WebCore::BIOHolder::~BIOHolder): Ditto. (WebCore::BIOHolder::write): Ditto. (WebCore::BIOHolder::asCertificate): Ditto. (WebCore::pemDataFromCtx): Become simple static function. (WebCore::convertToSSLCertificateFlags): Ditto. (WebCore::CurlSSLVerifier::certVerifyCallback): Deleted. (WebCore::CurlSSLVerifier::getPemDataFromCtx): Deleted. (WebCore::CurlSSLVerifier::convertToSSLCertificateFlags): Deleted. * platform/network/curl/CurlSSLVerifier.h: (WebCore::CurlSSLVerifier::verificationError): (WebCore::CurlSSLVerifier::certificateChain const): * platform/network/curl/ResourceError.h: * platform/network/curl/ResourceErrorCurl.cpp: (WebCore::ResourceError::isSSLConnectError const): (WebCore::ResourceError::isSSLCertVerificationError const): (WebCore::ResourceError::hasSSLConnectError const): Deleted. * platform/network/curl/ResourceResponse.h: * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::setCertificateInfo): (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics): 2018-07-02 Simon Fraser <simon.fraser@apple.com> Clean up the layer volatility code and logging https://bugs.webkit.org/show_bug.cgi?id=187286 Reviewed by Tim Horton. Export a function. * platform/graphics/cocoa/IOSurface.h: 2018-07-03 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r233112. https://bugs.webkit.org/show_bug.cgi?id=187300 this revision is causing crashes on iOS 11 simulator (Requested by Truitt on #webkit). Reverted changeset: "[Fullscreen] Restore ASSERT_NOT_REACHED() checks in exit fullscreen handler after r231924" https://bugs.webkit.org/show_bug.cgi?id=186945 https://trac.webkit.org/changeset/233112 2018-07-03 Chris Dumez <cdumez@apple.com> Implement support for Element.toggleAttribute https://bugs.webkit.org/show_bug.cgi?id=186883 Reviewed by Sam Weinig. Implement support for Element.toggleAttribute as per: - https://github.com/whatwg/dom/issues/461 - https://dom.spec.whatwg.org/#dom-element-toggleattribute This was already implemented in Blink: - https://bugs.chromium.org/p/chromium/issues/detail?id=854960 Edge expressed public support: - https://github.com/whatwg/dom/issues/461#issuecomment-398206390 Gecko is working on it: - https://bugzilla.mozilla.org/show_bug.cgi?id=1469592 * dom/Element.cpp: (WebCore::Element::toggleAttribute): * dom/Element.h: * dom/Element.idl: 2018-07-03 Zalan Bujtas <zalan@apple.com> [LFC] Implement minimum/maximum content width logic. https://bugs.webkit.org/show_bug.cgi?id=187241 Reviewed by Antti Koivisto. Compute the minimum/maximum content width if needed and cache the values on the formatting state. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): (WebCore::Layout::shrinkToFitWidth): Deleted. * layout/FormattingState.cpp: (WebCore::Layout::FormattingState::FormattingState): * layout/FormattingState.h: (WebCore::Layout::FormattingState::setMinimumMaximumContentWidth): (WebCore::Layout::FormattingState::clearMinimumMaximumContentWidth): (WebCore::Layout::FormattingState::minimumMaximumContentWidth const): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::establishedFormattingState): * layout/LayoutContext.h: * layout/Verification.cpp: (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::createFormattingState const): (WebCore::Layout::BlockFormattingContext::minimumMaximumContentWidth const): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidthNeedsChildrenWidth): (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidth): * layout/blockformatting/BlockFormattingState.cpp: (WebCore::Layout::BlockFormattingState::BlockFormattingState): * layout/blockformatting/BlockFormattingState.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::createFormattingState const): (WebCore::Layout::InlineFormattingContext::minimumMaximumContentWidth const): * layout/inlineformatting/InlineFormattingContext.h: * layout/inlineformatting/InlineFormattingState.cpp: (WebCore::Layout::InlineFormattingState::InlineFormattingState): * layout/inlineformatting/InlineFormattingState.h: * page/FrameViewLayoutContext.cpp: 2018-07-03 Jonathan Bedard <jbedard@apple.com> Unreviewed, rolling out r233461. Assertions triggered during iOS 11 debug layout and API tests Reverted changeset: "[iOS] Add assert to catch improper use of WebCore::Timer in UI Process" https://bugs.webkit.org/show_bug.cgi?id=185330 https://trac.webkit.org/changeset/233461 2018-07-03 Jer Noble <jer.noble@apple.com> Update Fullscreen anti-phishing alert text https://bugs.webkit.org/show_bug.cgi?id=187199 <rdar://problem/41162543> Reviewed by Brent Fulgham. * English.lproj/Localizable.strings: 2018-07-03 Frederic Wang <fwang@igalia.com> REGRESSION (r232186): Hardware-accelerated CSS animations using steps() timing function no longer work https://bugs.webkit.org/show_bug.cgi?id=186129 Reviewed by Antoine Quint. When the WebAnimationsCSSIntegration flag is enabled, animating the transform property with a steps() timing function no longer works. This is because the WebAnimation code wrongly assumes that the transform property can always be accelerated (for counterexamples, see GraphicsLayerCA::animationCanBeAccelerated). For consistency with AnimationBase, we make WebAnimation fallback to non-accelerated mode when RenderBoxModelObject::startAnimation fails. This addresses the regression previously mentioned. Test: http/wpt/css/css-animations/start-animation-001.html * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Fallback to non-accelerated mode if startAnimation failed. 2018-07-03 David Kilzer <ddkilzer@apple.com> [iOS] Add assert to catch improper use of WebCore::Timer in UI Process <https://webkit.org/b/185330> <rdar://problem/32816079> Reviewed by Darin Adler. * platform/RuntimeApplicationChecks.cpp: (WebCore::s_webKitProcessType): Add. Global to track process type. (WebCore::setWebKitProcessType): Implement new function that is called when initializing Web, Network, and Storage processes. (WebCore::isInNetworkProcess): Add. (WebCore::isInStorageProcess): Add. (WebCore::isInWebProcess): Add. - Check value in s_webKitProcessType to determine which process is currently running. * platform/RuntimeApplicationChecks.h: (WebCore::isInNetworkProcess): Add. (WebCore::isInStorageProcess): Add. (WebCore::isInWebProcess): - Make available for all platforms. * platform/Timer.cpp: (WebCore::TimerBase::TimerBase): Add assert and os_log_fault. This catches the unwanted behavior on iOS using isAllowed(). (WebCore::TimerBase::isAllowed): Add implementation. * platform/Timer.h: (WebCore::TimerBase::isAllowed): Add declaration. * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::isInWebProcess): Delete. Replace with method in RuntimeApplicationChecks.cpp. 2018-07-02 Antti Koivisto <antti@apple.com> Tighter limit for canvas memory use on iOS https://bugs.webkit.org/show_bug.cgi?id=187279 <rdar://problem/38420562> Reviewed by Simon Fraser. We allowed 448MB of canvas buffer memory. This is still too much in some cases. Painting a large canvas may also requires several other temporary canvas sized buffers getting us easily over the process size limit. * html/HTMLCanvasElement.cpp: (WebCore::maxActivePixelMemory): Drop to (ramSize() / 4) which computes to 224MB on 2GB devices. 2018-07-02 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Google Fonts doesn't work if the user has the requested font locally-installed https://bugs.webkit.org/show_bug.cgi?id=187228 <rdar://problem/40967280> Reviewed by Brent Fulgham. This is due to the local() items in the src: descriptor in the @font-family blocks. This is because of a behavior difference between CSSFontFaceSource::load() and CSSFontFaceSource::font(). load() is supposed to set the status() to Success iff the font can be used, and then CSSFontFaceSource::font() is supposed to return the font itself to use. load() works by constructing a dummy FontDescription and performing a system lookup (to see if the local font really exists). However, this dummy FontDescription doesn't set the ShouldAllowUserInstalledFonts flag. Then, in CSSFontFaceSource::font(), a similar lookup is performed, except this one has the original FontDescription (with the correct value of the ShouldAllowUserInstalledFonts flag set. Therefore, the two functions disagree about the state of the flag. When the CSSFontFaceSource's status gets set to Success, that means "this is the font face source that represents the @font-face block" but when CSSFontFaceSource::font() returns nullptr, that means "The font face source can't be used for some reason" so we then continue searching down the font-family list (and render the text in Helvetica or whatever comes next). The solution is simple - just set the ShouldAllowUserInstalledFonts flag correctly in the dummy FontDescription. Test: fast/text/user-installed-fonts/local.html * css/CSSFontFace.cpp: (WebCore::CSSFontFace::allowUserInstalledFonts const): * css/CSSFontFace.h: * css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::load): 2018-06-29 Ryosuke Niwa <rniwa@webkit.org> Generate event and event target interface types directly instead of via macros https://bugs.webkit.org/show_bug.cgi?id=187215 Reviewed by Chris Dumez. Made make_event_factory.pl directly generate EventInterface enum values and toJSNewlyCreated for Event, and EventTargetInterface enum values and toJS for EventTarget. Removed the code to generate EventFactory::create since it was never even compiled or used anywhere. This patch faithfully replicates what the macro used to generate but we should consider always generating either toJS or toJSNewlyCreated for both interfaces in the future. No new tests since there should be no observable behavioral changes. * DerivedSources.make: Generate EventTargetFactory.cpp, which is used to generate toJS function for EventTarget. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSEventCustom.cpp: (WebCore::toJSNewlyCreated): Deleted. Now generated directly in EventFactory.cpp. * bindings/js/JSEventTargetCustom.cpp: (WebCore::JSEventTarget::toWrapped): Removed the use of TRY_TO_UNWRAP_WITH_INTERFACE. (WebCore::toJS): Deleted. Now generated directly in EventFactory.cpp. * bindings/scripts/InFilesCompiler.pm: (generateInterfacesHeader): Use #pragma once. Generate enum values directly. Added the support for suffixing each type name with namespace for EventTarget. * dom/Event.h: Removed the declaration of EventInterface enum. It's now directly generated in EventInterfaces.h * dom/EventNames.in: Generate toJSNewlyCreated. * dom/EventTarget.h: Removed the declaration of EventTargetInterface as it's now done in EventTargetInterfaces.h. * dom/EventTargetFactory.in: Generate toJS. * dom/make_event_factory.pl: (defaultParameters): Added two new options. factoryFunction specifies whether toJS or toJSNewlyCreated is generated, and useNamespaceAsSuffix specifies whether each entry should be suffixed by the namespace (used by EventTarget). (generateCode): Added a missing semicolon. (generateImplementation): Removed the early exit for EventTarget since we now need to generate its toJS function. Replaced the code to generate EventFactory::create by the one to generate toJS / toJSNewlyCreated. 2018-07-02 Zalan Bujtas <zalan@apple.com> HTML widget displays blank when playing on page https://bugs.webkit.org/show_bug.cgi?id=187272 <rdar://problem/39317899> Reviewed by Simon Fraser. When a composited layer gains content (in this particular case, going from NoContentsLayer to ContentsLayerForMedia), we need to size the associated graphics layer accordingly (NoContentsLayer means zero sized graphics layer). Not testable on iOS. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateConfiguration): 2018-07-02 David Kilzer <ddkilzer@apple.com> Refactor InlineTextBox::emphasisMarkExistsAndIsAbove() <https://webkit.org/b/187204> Reviewed by Darin Adler. No new tests since there is no change in behavior. Refactor emphasisMarkExistsAndIsAbove() to return a std::optional<bool> instead of returning a bool and taking a std::optional<bool> argument. The state returned is now: - std::nullopt => emphasis mark doesn't exist or is suppressed. - false => emphasis mark exists and is not suppressed, but is not above. - true => emphasis mark exists and is not suppressed, and is above. * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxesInBlockDirection): (WebCore::InlineFlowBox::addTextBoxVisualOverflow): (WebCore::InlineFlowBox::computeOverAnnotationAdjustment const): (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const): - Update for refactored method. Remove some redundant checks for TextEmphasisMark::None that already happen in emphasisMarkExistsAndIsAbove(). * rendering/InlineTextBox.cpp: (WebCore::emphasisPositionHasNeitherLeftNorRight): Delete. - Replaced by an OptionSet<TextEmphasisPosition>. (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const): - Refactor as described above. (WebCore::InlineTextBox::paintMarkedTextForeground): - Update for refactored method. * rendering/InlineTextBox.h: (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const): - Update for new method signature. 2018-07-02 Megan Gardner <megan_gardner@apple.com> Enable copy paste on iOS apps for Mac https://bugs.webkit.org/show_bug.cgi?id=187194 <rdar://problem/41451148> Reviewed by Darin Adler. Difficult to test this platform. UIKit doesn't support itemProviders for iOS apps for Mac, so we need to revert to the older way of setting a dictionary of objects and keys for items. Not everything is availble in this form, and we haven't cleaned up our itemProvider code yet, so we need to case some things out for now. Hopefully in the future, this will be implmented and can just work as expected, but for now, this is the best workaround. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::registerItemToPasteboard): (WebCore::PlatformPasteboard::write): (WebCore::PlatformPasteboard::readURL): * platform/ios/WebItemProviderPasteboard.h: * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderRegistrationInfoList itemProvider]): 2018-07-02 Eric Carlson <eric.carlson@apple.com> Video sometimes flickers when playing to AppleTV https://bugs.webkit.org/show_bug.cgi?id=187193 <rdar://problem/40153865> Reviewed by Jer Noble and Youenn Fablet. No new tests, existing test updated. Delay 100ms before changing the iOS audio session category because it is an expensive and potentially disruptive operation, and changing an audio or video element configuration can result in several quick, ultimately unnecessary, category changes. * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::clientWillBeginPlayback): Add logging. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): Initialize timer. (WebCore::PlatformMediaSessionManager::removeSession): Deactivate audio session when there are no sessions. (WebCore::PlatformMediaSessionManager::updateSessionStateTimerFired): New, update session now. (WebCore::PlatformMediaSessionManager::updateSessionState): Add parameter. * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): Defer update if it isn't supposed to happen immediately. * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::setCategory): Drive-by: setting the audio category to nil is a noop, so don't waste time doing it. (WebCore::AudioSession::tryToSetActive): Allow other apps to resume playback when we deactivate the audio session. * platform/Timer.h: (WebCore::DeferrableOneShotTimer): Add WTF_MAKE_FAST_ALLOCATED so it can be used in a unique_ptr. 2018-07-02 Wenson Hsieh <wenson_hsieh@apple.com> Clean up some spellchecking code https://bugs.webkit.org/show_bug.cgi?id=187238 Reviewed by Tim Horton. A few minor tweaks to modernize some spellchecking code. No change in behavior. * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::timerFired): * editing/Editor.cpp: (WebCore::Editor::markMisspellingsAfterTypingToWord): Use move semantics when passing Ranges to markAllMisspellingsAndBadGrammarInRanges. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Change this to take RefPtr<Range>&& instead of Range*. (WebCore::Editor::markMisspellingsAndBadGrammar): Remove an unnecessary call to `RefPtr::get()`. * editing/Editor.h: * editing/TextCheckingHelper.cpp: (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues): (WebCore::TextCheckingParagraph::checkingStart const): (WebCore::TextCheckingParagraph::checkingEnd const): (WebCore::TextCheckingParagraph::checkingLength const): (WebCore::TextCheckingParagraph::automaticReplacementStart const): (WebCore::TextCheckingParagraph::automaticReplacementLength const): Currently, all of these cached range offsets are `int`s, and use a value of -1 to denote that their values are missing and must be recomputed. Instead, make these `std::optional`s and let `std::nullopt` represent the missing value. * editing/TextCheckingHelper.h: 2018-07-02 Antoine Quint <graouts@apple.com> Crash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html https://bugs.webkit.org/show_bug.cgi?id=187145 Reviewed by Dean Jackson. Ensure we have a resolved time value before trying to use it. * animation/WebAnimation.cpp: (WebCore::WebAnimation::timeToNextRequiredTick const): 2018-07-02 Antoine Quint <graouts@apple.com> [Web Animations] Crash in KeyframeEffectReadOnly::applyPendingAcceleratedActions() https://bugs.webkit.org/show_bug.cgi?id=187139 Reviewed by Dean Jackson. Ensure we have a resolved time value before trying to use it. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): 2018-07-02 Youenn Fablet <youenn@apple.com> Reject getUserMedia promise if capture fails https://bugs.webkit.org/show_bug.cgi?id=187190 Reviewed by Eric Carlson. In case PendingActivationMediaStream is notified of a change, Check whether any track failed to capture. If so, reject the promise. Add more release logging in error case. Covered by manual testing. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream): (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged): (WebCore::UserMediaRequest::mediaStreamIsReady): (WebCore::UserMediaRequest::mediaStreamDidFail): * Modules/mediastream/UserMediaRequest.h: * platform/mediastream/MediaStreamPrivate.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::captureFailed): * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::setupCaptureSession): 2018-07-01 Fujii Hironori <Hironori.Fujii@sony.com> [WK2] fast/parser/document-open-in-unload.html makes the following test crash https://bugs.webkit.org/show_bug.cgi?id=98345 <rdar://problem/12474923> Reviewed by Ryosuke Niwa. m_documentLoader can become null in the middle of FrameLoader::commitProvisionalLoad by stopping the loading. No new tests (Covered by existing tests). * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Do null check of m_documentLoader. 2018-07-01 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] LastResort in the font family list causes emoji with joiners to be rendered as multiple .notdef characters https://bugs.webkit.org/show_bug.cgi?id=187209 <rdar://problem/40920785> Reviewed by Darin Adler. Inside our complex text codepath, we perform our own font fallback, which includes a function that asks "can this font support this grapheme cluster?" Because of the mechanics of how fonts work, the implementation of this function is "Does the font's cmap table support every character of the cluster?" We were using Font::glyphForCharacter() to determine this; however, this function maps certain control characters to the zero width space character (with the intention that these control characters shouldn't be visible in the fast text codepath). That replacement, however, was causing us to get false negatives, because Apple Color Emoji doesn't support zero width space. Therefore, Apple Color Emoji was looking like it didn't support emoji combining sequences. The best solution to this would be to get Font::glyphForCharacter() to stop performing these replacements (see https://bugs.webkit.org/show_bug.cgi?id=187166). However, that is too risky of a change to be making right now. Instead, a more localized solution is to implement a version of "Does the font's cmap table support every character of the cluster" that doesn't perform the substitutions. This patch does exactly that, and uses a bit vector to cache the results. In order to not have a giant bit vector, we take the old code path if we know the substitutions won't affect us (and uses ASSERT()s to validate this) so the bit vector only holds at maximum 3 words of storage. Test: fast/text/emoji-with-joiner.html * platform/graphics/Font.cpp: (WebCore::codePointSupportIndex): (WebCore::createAndFillGlyphPage): (WebCore::Font::platformSupportsCodePoint const): (WebCore::Font::supportsCodePoint const): (WebCore::Font::canRenderCombiningCharacterSequence const): * platform/graphics/Font.h: * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::platformSupportsCodePoint const): 2018-07-01 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Text replacements that end with symbols are expanded immediately https://bugs.webkit.org/show_bug.cgi?id=187225 <rdar://problem/41112433> Reviewed by Darin Adler. In shipping Safari, enabling grammar correction causes text shortcuts that end with symbols or punctuation marks to immediately trigger when typing; normally, when grammar correction is off, this is only triggered after the user has additionally inserted a punctuation mark or whitespace character after the replaced text. This bug happens because enabling grammar checking causes the spell checking range to expand to the range of the full sentence, so any text checking results that replace an existing range are triggered as long as they end anywhere in the sentence. In contrast, when grammar checking is disabled, the spell checking range is limited to the nearest adjacent word, which prevents text replacement from occurring elsewhere in the sentence. However, after r232530, we now always expand the spell checking range to the extent of the sentence when a word is typed regardless of whether grammar checking is enabled, which means that the issue described above now happens everywhere. To fix this recent regression and the existing bug, we: - Augment our spellchecking codepaths to include a new automatic text replacement range, alongside spellchecking and paragraph ranges. - Let this automatic text replacement range be the range of the adjacent word in the case where the user has finished typing a word. - When marking and replacing text checking results, consult this new automatic text replacement instead of the spellchecking range. This keeps the behavior grammar and sentence retro correction results intact, while limiting the scope in which text replacement results are applied. Test: editing/spelling/text-replacement-after-typing-to-word.html * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::timerFired): * editing/Editor.cpp: (WebCore::Editor::replaceSelectionWithFragment): (WebCore::Editor::markMisspellingsAfterTypingToWord): Pass in the adjacent word range for the `automaticReplacementRange`, instead of the spell checking range (which may be extended to the full range of the sentence). (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Add an `automaticReplacementRange` argument to markAllMisspellingsAndBadGrammarInRanges, and adjust call sites to pass in a range (generally the same as the spell checking range, but in the case where a word has been typed, this is a narrower range). (WebCore::correctSpellcheckingPreservingTextCheckingParagraph): (WebCore::Editor::markAndReplaceFor): When replacing text, only allow text replacement in the automatic replacement range rather than the spell checking range. (WebCore::Editor::markMisspellingsAndBadGrammar): * editing/Editor.h: * editing/SpellChecker.cpp: (WebCore::SpellCheckRequest::SpellCheckRequest): Add a new version of this constructor that takes a single Range representing both the spellchecking range and the automatic text replacement range, for convenience. (WebCore::SpellCheckRequest::create): * editing/SpellChecker.h: Add plumbing for the automatic replacement range. (WebCore::SpellCheckRequest::automaticReplacementRange const): * editing/TextCheckingHelper.cpp: Add plumbing for the automatic replacement range, and new helpers to locate the range as offsets within the text checking paragraph range. (WebCore::TextCheckingParagraph::TextCheckingParagraph): (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues): (WebCore::TextCheckingParagraph::automaticReplacementStart const): (WebCore::TextCheckingParagraph::automaticReplacementLength const): * editing/TextCheckingHelper.h: 2018-06-30 David Kilzer <ddkilzer@apple.com> Follow-up: Fix clang static analyzer warnings: Garbage return value <https://webkit.org/b/187224> Address review feedback from Eric Carlson. * platform/mediastream/MediaConstraints.h: (WebCore::NumericConstraint::valueForCapabilityRange const): - Use brace initialization for more local variables. 2018-06-30 Michael Catanzaro <mcatanzaro@igalia.com> Asan false positive: stack use after scope under WebCore::ApplyPropertyBorderImageModifier in WebCore::Length::Length(WebCore::Length&&) https://bugs.webkit.org/show_bug.cgi?id=186980 <rdar://problem/41409838> Reviewed by Oliver Hunt. We believe that we have found a bug in GCC's address sanitizer. It is blocking work on other issues, so work around it by changing a temporary into a local variable. * css/StyleBuilderCustom.h: (WebCore::ApplyPropertyBorderImageModifier::applyInitialValue): 2018-06-30 David Kilzer <ddkilzer@apple.com> Fix clang static analyzer warnings: Garbage return value <https://webkit.org/b/187224> Reviewed by Eric Carlson. * platform/mediastream/MediaConstraints.h: (WebCore::NumericConstraint::valueForCapabilityRange const): - Use brace initialization for local variables. 2018-06-30 Zalan Bujtas <zalan@apple.com> [LFC] Do not add the containing block's offset while computing the out-of-flow static position. https://bugs.webkit.org/show_bug.cgi?id=187202 Reviewed by Antti Koivisto. The static position for an out-of-flow elements is 1. the distance from the parent's border box. 2. climbing up on the containing block chain and offset the containers until we reach the out-of-flow element's containing block. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned): (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned): 2018-06-30 Zalan Bujtas <zalan@apple.com> [LFC] If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it. https://bugs.webkit.org/show_bug.cgi?id=187220 Reviewed by Antti Koivisto. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::isMarginBottomCollapsedThrough): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom): (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild): 2018-06-30 Zalan Bujtas <zalan@apple.com> [LFC] Adjust final out-of-flow position with the computed margin value. https://bugs.webkit.org/show_bug.cgi?id=187219 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): 2018-06-29 Antoine Quint <graouts@apple.com> [Web Animations] Make WPT test at timing-model/timelines/document-timelines.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=186507 <rdar://problem/41000257> Reviewed by Dean Jackson. The Web Animations spec, along with the HTML5 event loop spec, specify some assumptions on the time reported by document.timeline.currentTime: - it should only increase once per frame - it should have the same value as the timestamp passed to requestAnimationFrame() callbacks The WPT test at web-platform-tests/web-animations/timing-model/timelines/document-timelines.html relies on these assumptions to be true so that we check that the start time of a new animation is not the same as the timeline time when it was created, since it will be in the "play-pending" state for a frame. In order to support this, we add two new methods on DocumentAnimationScheduler. First, when a scheduled display update fires, we record the timestamp and expose it via lastTimestamp() such that DocumentTimeline and ScriptedAnimationController can use the same value when updating animations. Then, to know whether code is run as a result of a display update, we expose isFiring(). Now, within DocumentTimeline::currentTime(), we can cache the current time this way: - if we're in the middle of a display update, use the value returned by lastTimestamp(). - otherwise, compute what would have been the ideal number of frames (at 60fps or less if throttled) and add those to the lastTimestamp() value. Then, we remove this cached current time when both currently-running JavaScript has completed and all animation update code has completed by waiting on the invalidation task to run. * animation/DocumentAnimationScheduler.cpp: (WebCore::DocumentAnimationScheduler::displayRefreshFired): * animation/DocumentAnimationScheduler.h: (WebCore::DocumentAnimationScheduler::lastTimestamp): (WebCore::DocumentAnimationScheduler::isFiring const): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::currentTime): (WebCore::DocumentTimeline::performInvalidationTask): (WebCore::DocumentTimeline::maybeClearCachedCurrentTime): * animation/DocumentTimeline.h: * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceScriptedAnimations): (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): 2018-06-29 Nan Wang <n_wang@apple.com> Crash under WebCore::AXObjectCache::handleMenuItemSelected https://bugs.webkit.org/show_bug.cgi?id=186918 <rdar://problem/41365984> Reviewed by Chris Fleizach. When a node is being destroyed, we deregister it from the AX cache through the Node's destructor. But we did not remove the corresponding entry from the m_deferredFocusedNodeChange list. It would then lead to a crash if we try to access the deleted node from m_deferredFocusedNodeChange. Fixed it by removing the entry if the newly focused node is being destroyed. Test: accessibility/accessibility-crash-focused-element-change.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): 2018-06-29 Antti Koivisto <antti@apple.com> REGRESSION (r232806): Facebook login fields have blue fill background instead of white https://bugs.webkit.org/show_bug.cgi?id=187207 <rdar://problem/41606349> Reviewed by Tim Horton. This happens because a 'prefers-dark-interface' media query on UA sheet always evaluates to true in dark mode. Tests: fast/forms/input-background-ua-media-query.html * css/MediaQueryEvaluator.cpp: (WebCore::prefersDarkInterfaceEvaluate): Make prefers-dark-interface media query match only when using system appearance. 2018-06-29 Daniel Bates <dabates@apple.com> REGRESSION (r230921): Cannot log in to forums.swift.org using GitHub account https://bugs.webkit.org/show_bug.cgi?id=187197 <rdar://problem/40420821> Reviewed by Brent Fulgham. Fixes an issue where a Same-Site cookies are not sent with any child window load if the load is cross-origin with respect to the window's opener. One example where this issue manifest itself was in the GitHub sign in flow on forums.swift.org. Currently we always consider the origin of the window's opener (if we have one) when determining whether a frame load request is same-origin and hence should send Same-Site cookies when performing the request. So, when page A.com opens a child window to B.com and then a person clicks a hyperlink or submits a form to B.com/b2 then we do not send Same- Site cookies with the request to B.com/b2 (because its origin, B.com, is cross-origin with its opener, A.com). But we should send Same-Site cookies with the request to B.com/b2 because it is same-origin with the page that initiated the request, B.com. Instead of always considering the origin the window's opener for every frame load we should only consider it for the first non-empty document load. Tests: http/tests/cookies/same-site/fetch-in-about-blank-popup.html http/tests/cookies/same-site/post-from-cross-site-popup.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest): 2018-06-29 Nan Wang <n_wang@apple.com> AX: [iOS] VoiceOver scroll position is jumpy in frames https://bugs.webkit.org/show_bug.cgi?id=186956 Reviewed by Simon Fraser. iOS is using delegate scrolling and we should not take into account the scroll offset when converting rects. Also fixed a issue where we want to scroll the element into view even if it's partially visible. Test: fast/scrolling/ios/iframe-scroll-into-view.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::scrollToMakeVisible const): * platform/ScrollView.cpp: (WebCore::ScrollView::contentsToContainingViewContents const): 2018-06-29 Chris Dumez <cdumez@apple.com> WebKitLegacy: Can trigger recursive loads triggering debug assertions https://bugs.webkit.org/show_bug.cgi?id=187121 <rdar://problem/41259430> Reviewed by Brent Fulgham. In order to support asynchronous policy delegates, r229722 added a call to FrameLoader::clearProvisionalLoadForPolicyCheck() when starting a navigation policy decision in PolicyChecker::checkNavigationPolicy(). This calls stopLoading() on the current provisional loader if there is one, and potentially calls the didFailProvisionalLoadWithError cleint delegate. This delegate call is synchronous on WebKit1, so the client may start a new load from this delegate and re-enter Webcore. This happens in practive with Quickens 2017 / 2018 on Mac. Before r229722, this was not an issue because pending loads were canceled after the (asynchronous) navigation policy decision, via FrameLoader::stopAllLoaders(). FrameLoader::stopAllLoaders() sets a m_inStopAllLoaders flag and we return early in FrameLoader::loadRequest() when this flag is set to prevent recursive loads. To maintain shipping behavior as much as possible, this patch introduces a similar inClearProvisionalLoadForPolicyCheck which gets set during FrameLoader::clearProvisionalLoadForPolicyCheck() and we prevent new loads while this flag is set. I have verified that Quickens 2017 / 2018 works again after this change and I added API test coverage for this behavior. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck): * loader/FrameLoader.h: 2018-06-25 Said Abou-Hallawa <sabouhallawa@apple.com> Infinite loop if a <use> element references its ancestor and the DOMNodeInserted event handler of one its ancestor's descents updates the document style https://bugs.webkit.org/show_bug.cgi?id=186925 Reviewed by Antti Koivisto. This patches fixes two issues: -- SVGTRefTargetEventListener should not assume it has to be attached to target when its handleEvent() is called. Because SVGTRefTargetEventListener::handleEvent() references the target element, we just return if the listener is detached. -- The <use> element should not clone its shadow tree if it references one of its ancestors. The DOMNodeInserted of any node in the target element tree may issue a document command. This document command will cause the shadow tree to be re-cloned so this will cause infinite loop to happen. Test: svg/dom/svg-use-infinite-loop-cloning.html * svg/SVGTRefElement.cpp: (WebCore::SVGTRefTargetEventListener::handleEvent): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::updateShadowTree): 2018-06-29 Manuel Rego Casasnovas <rego@igalia.com> [WPE] Three CSS Grid Layout tests crash due to valueless std::optional access https://bugs.webkit.org/show_bug.cgi?id=186752 Reviewed by Frédéric Wang. This is a simple fix for the crash we're getting on WPE in IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep(). Covered by existent tests, just remove them from TestExpectations file. * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const): Check if minSize is null before trying to access it's value. 2018-06-29 David Fenton <david_fenton@apple.com> Unreviewed, rolling out r233349. caused 42 crashes on iOS GuardMalloc and iOS ASan tests Reverted changeset: "[Web Animations] Using a Web Animation leaks the Document" https://bugs.webkit.org/show_bug.cgi?id=187088 https://trac.webkit.org/changeset/233349 2018-06-29 Jer Noble <jer.noble@apple.com> Returning PiP'd video to fullscreen while playing leaves video muted. https://bugs.webkit.org/show_bug.cgi?id=187181 <rdar://problem/41408335> Reviewed by Eric Carlson. Test: media/picture-in-picture-interruption.html Don't reset the media session's state at the end of an interruption if it wasn't changed an the beginning of one. * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::endInterruption): * testing/Internals.cpp: (WebCore::Internals::mediaSessionState): * testing/Internals.h: * testing/Internals.idl: 2018-06-29 Zalan Bujtas <zalan@apple.com> [LFC] When the formatting root is also a containing block for out-of-flow elements. https://bugs.webkit.org/show_bug.cgi?id=187179 Reviewed by Antti Koivisto. Out-of-flow descendants' layout requires their containing block height to be computed. This patch takes care of the case when the containing block is also a formatting context root (e.g. relative positioned with overflow other than visible). * layout/Verification.cpp: (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const): 2018-06-29 Zalan Bujtas <zalan@apple.com> [LFC] Do not skip the next inflow sibling after finishing a formatting context root layout. https://bugs.webkit.org/show_bug.cgi?id=187178 Reviewed by Antti Koivisto. Since the block formatting layout is based on pre-order traversal, after finishing a formatting context layout (which takes care of its entire subtre), we need to visit the next (in-flow)sibling. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): 2018-06-29 Zalan Bujtas <zalan@apple.com> [LFC] The static position for an out-of-flow box should include the previous sibling's collapsed margin https://bugs.webkit.org/show_bug.cgi?id=187169 Reviewed by Antti Koivisto. When computing the static position of an absolutely positioned box, we need to look at the previous sibling's bottom margin. If the previous sibling happens to collapse its bottom margin with the parent's bottom margin, we still need to account for it and compute the static vertical position as if the bottom margin was not collapsed. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): * layout/FormattingContextGeometry.cpp: (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::initializeRoot): * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::nonCollapsedMarginBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setHasValidVerticalNonCollapsedMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::setVerticalNonCollapsedMargin): (WebCore::Display::Box::nonCollapsedMarginTop const): (WebCore::Display::Box::nonCollapsedMarginBottom const): 2018-06-27 Antoine Quint <graouts@apple.com> [Web Animations] Using a Web Animation leaks the Document https://bugs.webkit.org/show_bug.cgi?id=187088 <rdar://problem/41392046> Reviewed by Dean Jackson. Test: webanimations/leak-document-with-web-animation.html We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document. We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates the animation from its timeline. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation() since the new WebAnimation::remove() method will also set the timeline to null which will eventually call removeAnimation() on the disassociated timeline. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::remove): (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted. * animation/DeclarativeAnimation.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations. * animation/WebAnimation.cpp: (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline. (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so that we can call this code without any JS-facing implications. (WebCore::WebAnimation::setTimelineInternal): (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted. * animation/WebAnimation.h: 2018-06-28 Zalan Bujtas <zalan@apple.com> [LFC] Out-of-flow positioned height does not necessarily equal to "bottom - top". https://bugs.webkit.org/show_bug.cgi?id=187168 Reviewed by Antti Koivisto. According to the spec "For absolutely positioned elements, the used values of the vertical dimensions must satisfy this constraint: 'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block" With a non-auto "height" value, the bottom - top does not necessarily compute to the height of the element. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): 2018-06-28 Olivia Barnett <obarnett@apple.com> Find in page for typographic quotes does not find low (German) quotes https://bugs.webkit.org/show_bug.cgi?id=187164 <rdar://problem/29612785> Reviewed by Tim Horton. Added additional quote test to LayoutTests/fast/text/find-quotes.html. Added functionality to replace German quotes when matching. * editing/TextIterator.cpp: (WebCore::foldQuoteMark): (WebCore::foldQuoteMarks): 2018-06-28 Antti Koivisto <antti@apple.com> REGRESSION (233281): fast/dom/location-new-window-no-crash.html and some other tests are timing out https://bugs.webkit.org/show_bug.cgi?id=187156 Reviewed by Zalan Bujtas. We need still need to re-enable memory cache client calls even when not doing other post-resolution callbacks. * style/StyleTreeResolver.cpp: (WebCore::Style::memoryCacheClientCallsResumeQueue): Add a separate queue for this. (WebCore::Style::suspendMemoryCacheClientCalls): (WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler): 2018-06-28 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] DataTransfer.getData always returns the empty string when dropping text https://bugs.webkit.org/show_bug.cgi?id=187130 <rdar://problem/41014117> Reviewed by Ryosuke Niwa. Currently, DataTransfer.getData() always returns the empty string on drop. This is because all data on drop is backed by local files in the temporary directory, so the number of files is never 0; this, combined with the fact that WebKit will suppress access to the DataTransfer object if there is one or more file in the pasteboard, means that getData() never works for drag and drop on iOS at the moment. To fix this, we need to know whether a dropped item provider is a file. Ideally, we'd have a flag to tell us whether or not an NSItemProvider being dropped is a file, or instead just inline data - in fact, this flag already exists in the form of UIPreferredPresentationStyle. Unfortunately, not all apps that vend draggable files specify this, so we can't simply ask the item provider whether it's intended to be a file. As a workaround, we can use several heuristics to determine the "file content state" of the drag pasteboard on iOS (see below for more details). This patch adds some plumbing through the client layers to grab a list of item information describing each dropped item provider on iOS. Using this information, we tweak the logic in Pasteboard::fileContentState to make an educated guess at whether or not the pasteboard really contains files; if we determine that the pasteboard probably contains no files, we'll allow DataTransfer.getData() to retrieve information from the pasteboard. Otherwise, if the pasteboard may contain files, we'll fall back to our current behavior of including the "Files" type in DataTransfer.types and allowing the page to grab file data using DataTransfer.files or DataTransfer.items. Tests: DataInteractionTests.DataTransferGetDataReadPlainAndRichText DataInteractionTests.DataTransferSuppressGetDataDueToPresenceOfTextFile * dom/DataTransfer.cpp: (WebCore::DataTransfer::filesFromPasteboardAndItemList const): Check Pasteboard::fileContentState() to ensure that we don't expose files when DataTransfer.types does not contain the "Files" type, and vice versa, and DataTranser.files is also empty in this case. * dom/DataTransferItemList.cpp: * platform/PasteboardItemInfo.h: Add a couple of additional members to PasteboardItemInfo: suggestedFileName and hasDeclaredNonTextType, a flag that indicates whether or not the pasteboard item has a type representation that is a declared type, but is not a text type (i.e. does not conform to "public.text", "public.url", or rich text format with attachment types). (WebCore::PasteboardItemInfo::encode const): (WebCore::PasteboardItemInfo::decode): * platform/PasteboardStrategy.h: * platform/PlatformPasteboard.h: * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::fileContentState): Instead of always considering a dropped item provider on iOS to represent a file, only do so if at least one of the following conditions are met: - The drop session contains multiple item providers (flocking text selections is a very rare use case). - The item provider was explicitly marked as an attachment. - The item provider has a suggested file name. - The item provider has any other content that is not text. In the case where none of the above conditions are met, the item provider (if it ends up being a file) is essentially indistinguishable from inline data. An example of this is dropping a plain text file that is unnamed, with no presentation style, and alongside no other items nor other known type representations. These are cases in which whether the item is treated as a file or as inline data is (hopefully) irrelevant. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::allPasteboardItemInfo): (WebCore::PlatformPasteboard::informationForItemAtIndex): 2018-06-28 Timothy Hatcher <timothy@apple.com> Don't force black text when TextIndicator draws backgrounds or all content. https://bugs.webkit.org/show_bug.cgi?id=187161 rdar://problem/40434644 Reviewed by Tim Horton. * page/TextIndicator.cpp: (WebCore::snapshotOptionsForTextIndicatorOptions): Only set SnapshotOptionsForceBlackText when TextIndicatorOptionRespectTextColor and TextIndicatorOptionPaintBackgrounds are not set. 2018-06-28 Timothy Hatcher <timothy@apple.com> Find on page selection color isn't adapted for dark mode. https://bugs.webkit.org/show_bug.cgi?id=187072 Unreviewed, revert part of r233280. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const): Use pure yellow again. 2018-06-28 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183834 <rdar://problem/40997932> Reviewed by Dean Jackson. We need to run pending tasks in the "update animations" procedure to ensure that the start time has been set to a different time than the timeline time at the time the animation was asked to play(). This ensure the timeline current time has progressed and can be queried to a different value in a requestAnimationFrame() callback. When invalidating events, we need to make sure we disregard instances when an animation has and is still pending so that we wait until we change the pending state to work out which events to enqueue. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::updateAnimations): * animation/WebAnimation.cpp: (WebCore::WebAnimation::updatePendingTasks): (WebCore::WebAnimation::timeToNextRequiredTick const): (WebCore::WebAnimation::runPendingTasks): * animation/WebAnimation.h: 2018-06-28 Ryosuke Niwa <rniwa@webkit.org> Release assert in ScriptController::canExecuteScripts via WebCore::SVGUseElement::insertedIntoAncestor https://bugs.webkit.org/show_bug.cgi?id=187137 <rdar://problem/41081885> Reviewed by Zalan Bujtas. The bug was caused by SVGUseElement::notifyFinished firing a DOM event via SVGUseElement::updateExternalDocument inside SVGUseElement::insertedIntoAncestor. Ideally, we make every call to notifyFinished asynchronous but simply delay the call to updateExternalDocument() until didFinishInsertingNode() for now. No new tests since the failure is caught with the newly added assertion in notifyFinished by existing SVG tests such as svg/batik/filters/filterRegions.svg and svg/batik/text/smallFonts.svg. Unfortunately, I could not construct a test case which hits this release assertion since the real crash happens when the cached resource had an error but in the all cases I could find, the resource response with an error results in a reload or an asynchronous failure callback. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::didAddClient): Added a FIXME. * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::insertedIntoAncestor): Delay the call to updateExternalDocument. (WebCore::SVGUseElement::didFinishInsertingNode): Invoke updateExternalDocument. (WebCore::SVGUseElement::notifyFinished): Added an assertion. * svg/SVGUseElement.h: 2018-06-28 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r233309. Invalidates previous database model without versioning Reverted changeset: "Fix encoding / decoding issues in ResourceLoadStatistics" https://bugs.webkit.org/show_bug.cgi?id=186890 https://trac.webkit.org/changeset/233309 2018-06-28 Timothy Hatcher <timothy@apple.com> Focus ring color does not honor dark mode or system accent color. https://bugs.webkit.org/show_bug.cgi?id=187144 rdar://problem/41105081 Reviewed by Tim Horton. Pass the focus ring color through to the GraphicsContext methods that draw it. * platform/graphics/GraphicsContext.h: * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::drawFocusRingAtTime): (WebCore::drawFocusRing): (WebCore::drawFocusRingToContext): (WebCore::drawFocusRingToContextAtTime): (WebCore::GraphicsContext::drawFocusRing): (WebCore::GraphicsContext::focusRingColor): Deleted. * platform/mac/ThemeMac.mm: (WebCore::drawCellFocusRingWithFrameAtTime): * rendering/RenderElement.cpp: (WebCore::RenderElement::paintFocusRing): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintAreaElementFocusRing): 2018-06-28 Aditya Keerthi <akeerthi@apple.com> REGRESSION (r232040): Cursor jumping in Safari text fields https://bugs.webkit.org/show_bug.cgi?id=187142 <rdar://problem/41397577> Reviewed by Tim Horton. r232040 enabled click events to fire on nodes that are already being edited in iOS. This resulted FrameSelection::setSelection being called twice. One call originated from the UIWKTextInteractionAssistant, which snaps the caret to word boundaries. The other call originates from handleMousePressEvent in EventHandler, and uses character boundaries. Consequently, we see the caret jumping around. To fix this issue, an early return was added in the handleMousePressEvent codepath, which prevents FrameSelection::setSelection from being called when clicking on a node that is already being edited. This ensures that the UIWKTextInteractionAssistant codepath is the only influence on the caret position. Test: fast/events/ios/click-selectionchange-once.html * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEventSingleClick): 2018-06-28 Chris Dumez <cdumez@apple.com> Fix encoding / decoding issues in ResourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=186890 Reviewed by Brent Fulgham. * loader/ResourceLoadStatistics.cpp: (WebCore::encodeHashCountedSet): (WebCore::encodeHashSet): Do not return early if the container we're trying to encode is empty. Instead, have the encoder encode an empty array. This is important for encoding / decoding to be fully symmetric. Otherwise, when trying to decode one of these empty containers, the decoder would fail (silently since we were ignoring decoding errors). Worse, the decoder might succeed but actually be decoding the *next* container in the file, since we have several HashCountedSets / HashSets encoded one after another. (WebCore::decodeHashCountedSet): (WebCore::decodeHashSet): Return a boolean to indicate if the decoding suceeded or not. (WebCore::ResourceLoadStatistics::decode): Check for container decoding errors and return false when decoding fails. Otherwise, we would just silently keep going. 2018-06-28 Sihui Liu <sihui_liu@apple.com> Cookie API: cookie creation time is wrong https://bugs.webkit.org/show_bug.cgi?id=187101 Reviewed by Geoffrey Garen. Covered by API test: WebKit.WKHTTPCookieStoreCreationTime. * platform/network/cocoa/CookieCocoa.mm: (WebCore::Cookie::operator NSHTTPCookie * _Nullable const): 2018-06-28 Zalan Bujtas <zalan@apple.com> [LFC] Add Display::Box::nonCollapsedMarginBox for verification purposes. https://bugs.webkit.org/show_bug.cgi?id=187140 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::nonCollapsedMarginBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setVerticalNonCollapsedMargin): 2018-06-28 Zalan Bujtas <zalan@apple.com> [LFC] The margin bottom of the document element does not collapse with its last inflow child's bottom margin. https://bugs.webkit.org/show_bug.cgi?id=187135 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom): (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild): 2018-06-28 Dirk Schulze <krit@webkit.org> [css-masking] Update clip-path box mapping to unified box https://bugs.webkit.org/show_bug.cgi?id=185797 Reviewed by Simon Fraser. The box mapping for fill-box, stroke-box, view-box on HTML elements and content-box, padding-box, margin-box, border-box for SVG elements was aligned with the transform-box CSS property. Furthermore, the keywords fill changed to fill-box and stroke changed to stroke-box. https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box Update the -webkit-clip-path property. Tests: svg/clip-path/clip-path-shape-border-box-expected.svg svg/clip-path/clip-path-shape-border-box.svg svg/clip-path/clip-path-shape-content-box-expected.svg svg/clip-path/clip-path-shape-content-box.svg svg/clip-path/clip-path-shape-margin-box-expected.svg svg/clip-path/clip-path-shape-margin-box.svg svg/clip-path/clip-path-shape-padding-box-expected.svg svg/clip-path/clip-path-shape-padding-box.svg * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator CSSBoxType const): * css/CSSValueKeywords.in: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertClipPath): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBasicShapeOrBox): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::nodeAtPoint): * rendering/RenderLayer.cpp: (WebCore::computeReferenceBox): * rendering/shapes/BoxShape.cpp: (WebCore::computeRoundedRectForBoxShape): * rendering/shapes/ShapeOutsideInfo.cpp: (WebCore::ShapeOutsideInfo::setReferenceBoxLogicalSize): (WebCore::ShapeOutsideInfo::logicalTopOffset const): (WebCore::ShapeOutsideInfo::logicalLeftOffset const): * rendering/style/RenderStyleConstants.h: * rendering/svg/SVGRenderingContext.cpp: (WebCore::SVGRenderingContext::prepareToRenderSVGContent): 2018-06-27 Timothy Hatcher <timothy@apple.com> Don't expose new semantic -apple-system color keywords on iOS. https://bugs.webkit.org/show_bug.cgi?id=187080 rdar://problem/41505699 Reviewed by Tim Horton. * DerivedSources.make: Use gnu++14, since gnu++17 is giving errors on macOS 10.12. * css/CSSValueKeywords.in: Define new semantic colors only on macOS. 2018-06-27 Zalan Bujtas <zalan@apple.com> [LFC] Compute both the collapsed and the non-collapsed margin values. https://bugs.webkit.org/show_bug.cgi?id=187129 Reviewed by Antti Koivisto. For validation purposes only at this point. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::isMarginTopCollapsedWithParent): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): 2018-06-27 Zalan Bujtas <zalan@apple.com> [LFC] Align inFlowNonReplacedHeightAndMargin() style with the rest of the compute functions. https://bugs.webkit.org/show_bug.cgi?id=187126 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): 2018-06-27 Yusuke Suzuki <utatane.tea@gmail.com> [GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers https://bugs.webkit.org/show_bug.cgi?id=187089 Reviewed by Michael Catanzaro. Do not allow copying since XErrorTrapper's logic relies on the address of XErrorTrapper. * platform/graphics/x11/XErrorTrapper.h: 2018-06-27 Zalan Bujtas <zalan@apple.com> [LFC] Align inFlowNonReplacedWidthAndMargin() style with the rest of the compute functions. https://bugs.webkit.org/show_bug.cgi?id=187124 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): 2018-06-27 Dirk Schulze <krit@webkit.org> -webkit-clip-path wrong offset for clipPath references https://bugs.webkit.org/show_bug.cgi?id=129246 Reviewed by Simon Fraser. Compute the correct offset for reference clip-paths by reusing some of the logic from basic shapes. Makes reference based clip-path interoperable and follows the spec. Test: css3/masking/clip-path-reference-2.html * rendering/RenderLayer.cpp: (WebCore::computeReferenceBox): (WebCore::RenderLayer::computeClipPath const): (WebCore::RenderLayer::setupClipPath): 2018-06-27 Antti Koivisto <antti@apple.com> Don't invoke post resolution callbacks when resolving computed style https://bugs.webkit.org/show_bug.cgi?id=187113 <rdar://problem/41365766> Reviewed by Geoff Garen. Post-resolution callbacks should only be invoked when we resolve the full document style, not when resolving computed style for a single element. Tests: fast/dom/object-computed-style-event.html * dom/Document.cpp: (WebCore::Document::styleForElementIgnoringPendingStylesheets): * dom/Element.cpp: (WebCore::Element::resolveComputedStyle): Also ref the ancestor stack to be safe. * style/StyleTreeResolver.cpp: (WebCore::Style::PostResolutionCallbackDisabler::PostResolutionCallbackDisabler): (WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler): Add an option to not drain the callback queue on destruction. In this mode we just block network loads. * style/StyleTreeResolver.h: 2018-06-27 Timothy Hatcher <timothy@apple.com> Find on page selection color isn't adapted for dark mode. https://bugs.webkit.org/show_bug.cgi?id=187072 rdar://problem/40354841 Reviewed by Tim Horton. * page/mac/TextIndicatorWindow.mm: (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Use [NSColor findHighlightColor]. * platform/mac/LocalDefaultSystemAppearance.h: (WebCore::LocalDefaultSystemAppearance::usingDarkAppearance const): Added. * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Set m_usingDarkAppearance. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Use TextPaintPhase::Decoration since this matches step three of InlineTextBox::paint ("Paint fancy decorations"). This allows TextMatch to paint a forground and not end up painting during this "fancy decorations" phase. (WebCore::InlineTextBox::resolveStyleForMarkedText): Set the fillColor for TextMarker to force a dark text color which will draw over the yellow highlight. (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers): Added support for TextPaintPhase::Decoration. Seperate DocumentMarker::TelephoneNumber and DocumentMarker::TextMatch. Have DocumentMarker::TextMatch support Forground and Background phases. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::platformColorsDidChange): (WebCore::RenderTheme::activeTextSearchHighlightColor const): Added. Call the platfrom version. (WebCore::RenderTheme::inactiveTextSearchHighlightColor const): Added. Ditto. (WebCore::RenderTheme::platformActiveTextSearchHighlightColor const): Added StyleColor::Options. (WebCore::RenderTheme::platformInactiveTextSearchHighlightColor const): Ditto. * rendering/RenderTheme.h: * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const): Added. (WebCore::RenderThemeMac::platformInactiveTextSearchHighlightColor const): Added. (WebCore::RenderThemeMac::platformColorsDidChange): Clear new color caches. (WebCore::RenderThemeMac::systemColor const): Cache system colors by light and dark mode. 2018-06-27 Chris Dumez <cdumez@apple.com> Crash under SWServer::unregisterServiceWorkerClient() https://bugs.webkit.org/show_bug.cgi?id=187115 <rdar://problem/41539197> Reviewed by Youenn Fablet. Connections are usually destroyed before their SWServer. However, as per crash traces, it is possible for SWServers to get destroyed while they still have connections. When this happens, the connections (which are owned by the SWServer) get destroyed with other SWServer data members. In turn, the connection destructor tries to unregister its clients from the server that is currently being destroyed. To address the issue, the SWServer destructor now destroys remaining connections early, before SWServer's other data members get destroyed. * workers/service/server/SWServer.cpp: (WebCore::SWServer::~SWServer): 2018-06-27 Youenn Fablet <youenn@apple.com> NetworkLoadChecker should not need to hard ref NetworkConnectionToWebProcess https://bugs.webkit.org/show_bug.cgi?id=186551 Reviewed by Daniel Bates. No change of behavior. Add a way to set the client receiving any CSP warning/error notification. * page/csp/ContentSecurityPolicy.h: (WebCore::ContentSecurityPolicy::setClient): 2018-06-27 Zalan Bujtas <zalan@apple.com> [LFC] Do not collapse margin with the parent when element has border/padding. https://bugs.webkit.org/show_bug.cgi?id=187114 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::isMarginTopCollapsedWithParent): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): 2018-06-27 Simon Fraser <simon.fraser@apple.com> Fix Windows build after r233268. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (PlatformCALayerWin::hasContents const): * platform/graphics/ca/win/PlatformCALayerWin.h: 2018-06-27 Zalan Bujtas <zalan@apple.com> [LFC] Out-of-flow positioned element's height depends on its containing block's height. https://bugs.webkit.org/show_bug.cgi?id=187082 Reviewed by Antti Koivisto. We can't really compute the final height of an out-of-flow element until after its containing block's height is computed. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): * layout/FormattingContext.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::updateLayout): (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree): * layout/LayoutContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): * layout/layouttree/LayoutContainer.h: (WebCore::Layout::Container::outOfFlowDescendants const): (WebCore::Layout::Container::outOfFlowDescendants): Deleted. 2018-06-27 Youenn Fablet <youenn@apple.com> Disable content blockers in NetworkLoadChecker except for ping loads https://bugs.webkit.org/show_bug.cgi?id=187083 <rdar://problem/41440083> Reviewed by Chris Dumez. Add internals API to reload a frame without content extensions. Test: http/tests/contentextensions/reload-without-contentextensions.html * testing/Internals.cpp: (WebCore::Internals::reloadWithoutContentExtensions): * testing/Internals.h: * testing/Internals.idl: 2018-06-27 Simon Fraser <simon.fraser@apple.com> https://hackernoon.com/ uses lots of layer backing store https://bugs.webkit.org/show_bug.cgi?id=186909 rdar://problem/40257540 Reviewed by Tim Horton. The existing "backing store detached" logic, which was used to eliminate backing store for compositing layers outside the viewport, had a number of bugs that allowed layers to have backing store when they should not. Specifically, any code path that ended up in setNeedsDisplay{InRect}() in PlatformCALayer could trigger backing store creation on layers that should have never had any. Rather than monkeypatch all the GraphicsLayerCA call sites that call setNeedsDisplay{InRect}(), just bail early from the PlatformCALayer* methods that trigger repaints. Tests didn't catch this because they just dumped the state of the backingStoreAttached flag. To fix this, create backingStoreAttachedForTesting() which also tests whether the layer has contents. Test: compositing/backing/backing-store-attachment-outside-viewport.html * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::dumpProperties const): (showGraphicsLayerTree): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::backingStoreAttachedForTesting const): * platform/graphics/GraphicsLayerClient.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::backingStoreAttachedForTesting const): (WebCore::GraphicsLayerCA::setNeedsDisplay): * platform/graphics/ca/GraphicsLayerCA.h: * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayerCocoa::setNeedsDisplay): (PlatformCALayerCocoa::setNeedsDisplayInRect): (PlatformCALayerCocoa::hasContents const): 2018-06-27 David Kilzer <ddkilzer@apple.com> Fix clang static analyzer warnings: Branch condition evaluates to a garbage value <https://webkit.org/b/186968> Reviewed by Zalan Bujtas. This patch changes two stack-allocated `bool` variables into `std::optional<bool>` since the functions that set the variable may return early without setting it. It also changes one stack-allocated pointer to be initialized to `nullptr`. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Update for change to CSSPropertyAnimation::getPropertyAtIndex() argument type. * editing/ios/EditorIOS.mm: (WebCore::Editor::writeImageToPasteboard): Initialize `cachedImage` stack pointer to nullptr since getImage() has an early return that doesn't set `cachedImage`. * editing/mac/EditorMac.mm: (WebCore::Editor::writeImageToPasteboard): Ditto. * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimation::getPropertyAtIndex): * page/animation/CSSPropertyAnimation.h: (WebCore::CSSPropertyAnimation::getPropertyAtIndex): - Change method to take `std::optional<bool>` instead of `bool` as second argument since the method may return early without setting `isShorthand`. * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::updateTransitions): Update for change to CSSPropertyAnimation::getPropertyAtIndex() argument type. * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxesInBlockDirection): Also rename local `emphasisMarkIsOver` to `emphasisMarkIsAbove` to match other call sites. (WebCore::InlineFlowBox::addTextBoxVisualOverflow): (WebCore::InlineFlowBox::computeOverAnnotationAdjustment const): (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const): - Update for change to InlineTextBox::emphasisMarkExistsAndIsAbove() argument type. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const): - Change method to take `std::optional<bool>` instead of `bool` as second argument since the method may return early without setting `above`. (WebCore::InlineTextBox::paintMarkedTextForeground): - Update for change to InlineTextBox::emphasisMarkExistsAndIsAbove() argument type. * rendering/InlineTextBox.h: (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const): - Change method to take `std::optional<bool>` instead of `bool`. 2018-06-27 Zalan Bujtas <zalan@apple.com> [LFC] Move formatting context root layout logic to a dedicated function. https://bugs.webkit.org/show_bug.cgi?id=187097 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const): * layout/blockformatting/BlockFormattingContext.h: 2018-06-27 Zalan Bujtas <zalan@apple.com> [LFC] Compute static position for out-of-flow elements only when required. https://bugs.webkit.org/show_bug.cgi?id=187096 Reviewed by Antti Koivisto. Computing static position for out-of-flow elements could be somewhat expensive, so let's not do it unless we actually need it. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned): (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): (WebCore::Layout::BlockFormattingContext::Geometry::staticPositionForOutOfFlowPositioned): Deleted. 2018-06-27 Nan Wang <n_wang@apple.com> AX: [iOS] Remove the ability to set keyboard focus when VoiceOver takes focus https://bugs.webkit.org/show_bug.cgi?id=187076 Reviewed by Chris Fleizach. We shouldn't set keyboard focus when assistive technology takes focus since this is causing website incompatibility issues by causing focus to be lost. Test: accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]): 2018-06-21 Emilio Cobos Álvarez <emilio@crisal.io> Move clearChildNeedsStyleRecalc into resetStyleForNonRenderedDescendants. https://bugs.webkit.org/show_bug.cgi?id=186881 Reviewed by Antti Koivisto. Every caller does this already. No new tests, no change in behavior. * style/StyleTreeResolver.cpp: (WebCore::Style::resetStyleForNonRenderedDescendants): (WebCore::Style::TreeResolver::resolveComposedTree): 2018-06-27 Tomas Popela <tpopela@redhat.com> [GStreamer] Coverity scan issues https://bugs.webkit.org/show_bug.cgi?id=187087 Reviewed by Xabier Rodriguez-Calvar. Fix uninitialized members. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: 2018-06-27 Zan Dobersek <zdobersek@igalia.com> [GCrypt] Move definitions of GCryptUtilities helpers into a separate source file https://bugs.webkit.org/show_bug.cgi?id=187033 Reviewed by Michael Catanzaro. Move the GCryptUtilities helpers that operate on libgcrypt values and constants into a separate source file. This limits a bit the amount of inlining the compiler might feel compelled to do, and the resulting shared library is 8kB smaller in size. * crypto/gcrypt/GCryptUtilities.cpp: Copied from Source/WebCore/crypto/gcrypt/GCryptUtilities.h. (WebCore::hmacAlgorithm): (WebCore::digestAlgorithm): (WebCore::hashCryptoDigestAlgorithm): (WebCore::mpiLength): (WebCore::mpiData): (WebCore::mpiZeroPrefixedData): (WebCore::mpiSignedData): * crypto/gcrypt/GCryptUtilities.h: (WebCore::hmacAlgorithm): Deleted. (WebCore::digestAlgorithm): Deleted. (WebCore::hashCryptoDigestAlgorithm): Deleted. (WebCore::mpiLength): Deleted. (WebCore::mpiData): Deleted. (WebCore::mpiZeroPrefixedData): Deleted. (WebCore::mpiSignedData): Deleted. * platform/SourcesGCrypt.txt: 2018-06-26 Yusuke Suzuki <utatane.tea@gmail.com> [JSC] Pass VM& to functions more https://bugs.webkit.org/show_bug.cgi?id=186241 Reviewed by Mark Lam. * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::define): 2018-06-26 Simon Fraser <simon.fraser@apple.com> CSSGradientValue's color stops vector wastes 12KB on theverge.com https://bugs.webkit.org/show_bug.cgi?id=186988 Reviewed by Sam Weinig. Shrink the color stops vector when we're done parsing the stops. * css/CSSGradientValue.h: (WebCore::CSSGradientValue::doneAddingStops): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient): (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops): (WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops): 2018-06-25 Yusuke Suzuki <utatane.tea@gmail.com> Remove static initializers more https://bugs.webkit.org/show_bug.cgi?id=186969 Reviewed by Michael Catanzaro. This patch removes static initializers more. They typically exists in GTK port. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/ResourceUsageData.cpp: Removed. * page/ResourceUsageData.h: Remove ResourceUsageData constructors since default constructors are enough. (WebCore::MemoryCategoryInfo::MemoryCategoryInfo): * platform/gtk/PasteboardHelper.cpp: (WebCore::markupPrefix): (WebCore::removeMarkupPrefix): (WebCore::PasteboardHelper::fillSelectionData): Use NeverDestroyed<> and static functions. * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp: (WebCore::defaultVolumeCapability): (WebCore::GStreamerAudioCaptureSource::capabilities const): CapabilityValueOrRange's constructor is not constexpr. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::initialAcceptLanguages): (WebCore::proxySettings): (WebCore::SoupNetworkSession::SoupNetworkSession): (WebCore::SoupNetworkSession::setupProxy): (WebCore::SoupNetworkSession::setProxySettings): (WebCore::SoupNetworkSession::setInitialAcceptLanguages): Use NeverDestroyed<> and static functions. 2018-06-26 Daniel Bates <dabates@apple.com> REGRESSION (r231479): Unable to buy Odeon cinema tickets in STP (bogus 'X-Frame-Options' to 'SAMEORIGIN') https://bugs.webkit.org/show_bug.cgi?id=186090 <rdar://problem/40692595> Reviewed by Andy Estes. Fix up Content Security Policy logic for checking the frame ancestors now that we exclude the frame that initiated the load request. Test: http/tests/security/XFrameOptions/cross-origin-iframe-post-form-to-parent-same-origin-x-frame-options-page-allow.html * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowFrameAncestors const): * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::checkFrameAncestors): 2018-06-26 Chris Dumez <cdumez@apple.com> Simplify NetworkStorageSession::getAllStorageAccessEntries() https://bugs.webkit.org/show_bug.cgi?id=187016 Reviewed by Youenn Fablet. Iterate over the HashMaps' values instead of iterating over their keys and then looking them up in the HashMap. * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::getAllStorageAccessEntries const): 2018-06-26 Eric Carlson <eric.carlson@apple.com> [Mac] AirPlay picker uses incorrect theme in Dark mode https://bugs.webkit.org/show_bug.cgi?id=187054 <rdar://problem/41291093> Reviewed by Timothy Hatcher. * Modules/mediasession/WebMediaSessionManager.cpp: (WebCore::WebMediaSessionManager::showPlaybackTargetPicker): Add useDefaultAppearance parameter. * Modules/mediasession/WebMediaSessionManager.h: * platform/graphics/MediaPlaybackTargetPicker.cpp: (WebCore::MediaPlaybackTargetPicker::showPlaybackTargetPicker): Ditto. * platform/graphics/MediaPlaybackTargetPicker.h: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h: * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Choose theme based on useDefaultAppearance parameter. * platform/mock/MediaPlaybackTargetPickerMock.cpp: (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker): Log parameter. * platform/mock/MediaPlaybackTargetPickerMock.h: 2018-06-26 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Do not forget to set stream on track switching https://bugs.webkit.org/show_bug.cgi?id=187049 Reviewed by Philippe Normand. This was an overlooked issue introduced in Bug #186678 This is already tested, but we currently run only tests against playbin2 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::enableTrack): 2018-06-26 Zalan Bujtas <zalan@apple.com> [LFC] Fixed positioning is a subcategory of absolute positioning. https://bugs.webkit.org/show_bug.cgi?id=187043 Reviewed by Antti Koivisto. https://www.w3.org/TR/CSS22/visuren.html#absolute-positioning References in this specification to an absolutely positioned element (or its box) imply that the element's 'position' property has the value 'absolute' or 'fixed'. * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isAbsolutelyPositioned const): * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::isOutOfFlowPositioned const): 2018-06-26 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r233143. https://bugs.webkit.org/show_bug.cgi?id=187046 broke media/video-ended-event-negative-playback.html (Requested by philn on #webkit). Reverted changeset: "[GStreamer] Remove useless workaround" https://bugs.webkit.org/show_bug.cgi?id=186921 https://trac.webkit.org/changeset/233143 2018-06-25 Zalan Bujtas <zalan@apple.com> [LFC] Computed height for in-flow non-replaced should not include padding and border. https://bugs.webkit.org/show_bug.cgi?id=187031 Reviewed by Antti Koivisto. In certain cases the height of a non-replaced in-flow box is computed using the bottom position of its last in-flow child. The in-flow child's bottom position is in the coordinate system of the containing block's border box (border box's top left is 0, 0) -> it includes both the (top) border and the padding of the containing block. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): 2018-06-26 Zan Dobersek <zdobersek@igalia.com> Crash in WebAnimation::runPendingPlayTask https://bugs.webkit.org/show_bug.cgi?id=186189 Reviewed by Carlos Garcia Campos. Avoid crashes on nullopt std::optional dereference in the runPendingPlayTask() and runPendingPauseTask() methods of the WebAnimation class by defaulting to a Seconds(0) value. In both cases the std::optional value is the current time retrieved from the associated DocumentTimeline object. But there's no guarantee that the timeline is active and the resulting time value is resolved (i.e. not nullopt). Dereferencing the nullopt Seconds value doesn't cause a problem on configurations still building as C++14 and the fallback std::optional implementation provided by WTF -- no signal is raised, and a 0 value is returned. Configurations building as C++17 on the other hand use the stdlib-provided std::optional that does raise a signal on invalid access, leading to crashes. The default-to-Seconds(0) solution avoids crashes on configurations that build with C++17 support enabled, and thus match configurations that are still using WTF's std::optional. This still doesn't address the underlying problem of retrieving current time from an inactive document timeline and using it as ready time for the pending play/pause task execution. runPendingPlayTask() change addresses crashes in the following tests: - fast/animation/css-animation-resuming-when-visible.html - fast/animation/css-animation-resuming-when-visible-with-style-change.html - imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html - imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/getAnimations.html runPendingPauseTask() change addresses crashes in the following tests: - animations/multiple-animations-timing-function.html * animation/WebAnimation.cpp: (WebCore::WebAnimation::runPendingPlayTask): (WebCore::WebAnimation::runPendingPauseTask): 2018-06-26 Antoine Quint <graouts@apple.com> [Web Animations] Show the feature as "Supported in Preview" https://bugs.webkit.org/show_bug.cgi?id=187037 Reviewed by Dean Jackson. Web Animations are enabled by default in STP. * features.json: 2018-06-26 Miguel Gomez <magomez@igalia.com> [GTK] Many webpages can crash the browser in WebCore::CoordinatedGraphicsLayer::transformedVisibleRect https://bugs.webkit.org/show_bug.cgi?id=179304 Reviewed by Michael Catanzaro. When adding new CoordinatedGraphicsLayers to the tree, check that they have the appropriate CompositingCoordinator. If that's not the case, set the appropriate one to the layer and its children and set the state of those layers so they are rendered properly. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::addChild): (WebCore::CoordinatedGraphicsLayer::addChildAtIndex): (WebCore::CoordinatedGraphicsLayer::addChildAbove): (WebCore::CoordinatedGraphicsLayer::addChildBelow): (WebCore::CoordinatedGraphicsLayer::replaceChild): (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2018-06-25 Keith Rollin <krollin@apple.com> Adjust WEBCORE_EXPORT annotations for LTO https://bugs.webkit.org/show_bug.cgi?id=186944 <rdar://problem/41384880> Reviewed by David Kilzer. Adjust a number of places that result in WebKit's 'check-for-weak-vtables-and-externals' script reporting weak external symbols: ERROR: WebCore has a weak external symbol in it (/Volumes/Data/dev/webkit/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore) ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library. ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file. ... These cases are caused by inline methods being marked with WTF_EXPORT (or related macro) or with an inline function being in a class marked as such, and when enabling LTO builds. For the most part, address these by removing the WEBCORE_EXPORT annotation from inline methods. In some cases, move the implementation out-of-line because it's the class that has the WEBCORE_EXPORT on it and removing the annotation from the class would be too disruptive. Finally, in other cases, move the implementation out-of-line because check-for-weak-vtables-and-externals still complains when keeping the implementation inline and removing the annotation; this seems to typically (but not always) happen with destructors. No new tests. There is no changed functionality. Only the annotation and treatment of inline methods are altered. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::pause): * page/CacheStorageProvider.h: (): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::reportSynchronousScrollingReasonsChanged): (WebCore::ScrollingTree::reportExposedUnfilledArea): * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::hasActiveNowPlayingSession const): (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingTitle const): (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingDuration const): (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingElapsedTime const): (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingInfoUniqueIdentifier const): (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const): * platform/audio/mac/CARingBuffer.cpp: (WebCore::CARingBuffer::~CARingBuffer): * platform/audio/mac/CARingBuffer.h: (WebCore::CARingBuffer::~CARingBuffer): Deleted. * platform/cocoa/VideoFullscreenModelVideoElement.h: * platform/gamepad/GamepadProvider.h: * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::displayListAsText const): (WebCore::GraphicsLayer::setIsTrackingDisplayListReplay): (WebCore::GraphicsLayer::isTrackingDisplayListReplay const): (WebCore::GraphicsLayer::replayDisplayListAsText const): * platform/mac/PlaybackSessionInterfaceMac.h: * platform/mediastream/RealtimeMediaSourceCenter.h: (WebCore::RealtimeMediaSourceCenter::setAudioFactory): (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory): * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::LibWebRTCProvider::setActive): (WebCore::LibWebRTCProvider::createDecoderFactory): (WebCore::LibWebRTCProvider::createEncoderFactory): (WebCore::LibWebRTCProvider::disableEnumeratingAllNetworkInterfaces): (WebCore::LibWebRTCProvider::enableEnumeratingAllNetworkInterfaces): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/network/ResourceHandleClient.h: (WebCore::ResourceHandleClient::willCacheResponseAsync): * testing/MockGamepadProvider.h: * workers/service/server/SWServer.h: (WebCore::SWServer::Connection::~Connection): 2018-06-25 Zalan Bujtas <zalan@apple.com> [LFC] Adjust static position for out-of-flow positioned boxes. https://bugs.webkit.org/show_bug.cgi?id=187000 Reviewed by Antti Koivisto. The static position of an out-of-flow positioned box is the the position where box would go if it was in-flow positioned. This position needs to the resolved in the containing block's coordinate system. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::staticPositionForOutOfFlowPositioned): (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): 2018-06-25 Brady Eidson <beidson@apple.com> Remove RELEASE_ASSERT added in r230875. <rdar://problem/40860061> and https://bugs.webkit.org/show_bug.cgi?id=187022 Reviewed by Brent Fulgham. There's actually more than one way for a network session to be destroyed, and that can happen asynchronously and unpredictably. And the request to start up a WebSocket and do its handshake is also asynchronous and unpredictable It's an expected race. If the NetworkStorageSession cannot be found then the WebSocket handshake should just fail. * platform/network/SocketStreamHandleImpl.cpp: (WebCore::cookieDataForHandshake): If the NetworkStorageSession cannot be found, return std::nullopt. (WebCore::SocketStreamHandleImpl::platformSendHandshake): If the cookieData is null, fail the handshake. 2018-06-25 Wenson Hsieh <wenson_hsieh@apple.com> [iPad apps on macOS] Web process crashes when attempting to play embedded YouTube video in News https://bugs.webkit.org/show_bug.cgi?id=187011 <rdar://problem/40906808> Reviewed by Tim Horton. Disable remote media commands when running iOS WebKit on macOS. The iOS flavor of RemoteCommandListener currently throws an exception when attempting to soft-link the MediaPlayer framework, which prevents video from being played altogether. For a followup tracking touch bar integration in iOS WebKit on macOS, see: <rdar://problem/39164732>. Manually tested by playing a YouTube video in News. * platform/RemoteCommandListener.cpp: * platform/ios/RemoteCommandListenerIOS.h: * platform/ios/RemoteCommandListenerIOS.mm: 2018-06-25 Keith Rollin <krollin@apple.com> Unreviewed, rolling out r233087. Causes 5% Mac PLT regression. Reverted changeset: "Recalc styles every time defaultAppearance changes." https://bugs.webkit.org/show_bug.cgi?id=186866 https://trac.webkit.org/changeset/233087 2018-06-25 Brent Fulgham <bfulgham@apple.com> REGRESSION(r229722): WebKitLegacy clients can crash when loading alternate page https://bugs.webkit.org/show_bug.cgi?id=187008 Reviewed by Chris Dumez. The new call to 'clearProvisionalLoadForPolicyCheck' added in r229722 broke loading behavior in WebKitLegacy. 1. We can now enter 'cancelPolicyCheckIfNeeded' without a Frame loader, in what appears to be a recursive call during the load cancellation (the 'm_waitingForContentPolicy' and 'm_waitingForNavigationPolicy' have already been nulled). It seems like we should return early here, or perhaps just move the RELEASE_ASSERT inside the case where we have an active policy check happening. 2. We also enter FrameLoader::checkContentPolicy without an active document loader. We should recognize this case and handle it, rather than trying to dereference a nullptr document loader. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded): Move the RELEASE_ASSERT inside the conditional where the frameLoader is actually used. * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkContentPolicy): Recognize that the activeDocumentLoader may be nullptr at this point, and take appropriate action (rather than crashing). 2018-06-25 Simon Fraser <simon.fraser@apple.com> MatchedPropertiesCacheItem wastes 388KB of vector capacity on nytimes.com https://bugs.webkit.org/show_bug.cgi?id=186990 Reviewed by Antti Koivisto. MatchedPropertiesCacheItem.matchedProperties was appended to, so it allocated capacity in 16-size chunks. Instead, assign to it so it only allocates as much capacity as is needed. Copy-constructing is more wasteful, since it copies the 64-chunk size from the right-hand side. * css/StyleResolver.cpp: (WebCore::StyleResolver::addToMatchedPropertiesCache): * css/StyleResolver.h: (WebCore::StyleResolver::MatchedPropertiesCacheItem::MatchedPropertiesCacheItem): 2018-06-25 Chris Dumez <cdumez@apple.com> Null dereference crash un ApplicationCacheGroup::startLoadingEntry() https://bugs.webkit.org/show_bug.cgi?id=187012 <rdar://problem/40793716> Reviewed by Youenn Fablet. m_entryLoader can be null because ApplicationCacheResourceLoader::create() return null when CachedResourceLoader::requestRawResource() fails synchronously. In such case, the completion handler gets called with a ApplicationCacheResourceLoader::Error::CannotRequestResource error. To address the issue, we capture the request's URL in the lambda and use it instead of trying to get the URL from the loader's resource. * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::startLoadingEntry): 2018-06-25 Ross Kirsling <ross.kirsling@sony.com> REGRESSION (r233140): Windows build failure due to incomplete FrameView and RenderBox types https://bugs.webkit.org/show_bug.cgi?id=186997 * animation/KeyframeEffectReadOnly.cpp: 2018-06-25 Antoine Quint <graouts@apple.com> REGRESSION: hardware-accelerated animation fails on inline element https://bugs.webkit.org/show_bug.cgi?id=186981 <rdar://problem/41418697> Reviewed by Dean Jackson. Ensure we only queue accelerated actions when we have a renderer so we don't attempt to start an accelerated animation too soon. Test: webanimations/opacity-animation-yields-compositing-span.html * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState): 2018-06-25 David Kilzer <ddkilzer@apple.com> REGRESSION (r233140): v2: Windows build failure due to incomplete DocumentAnimationScheduler type <https://webkit.org/b/186997> * dom/Document.cpp: (WebCore::Document::prepareForDestruction): (WebCore::Document::windowScreenDidChange): * dom/Document.h: - DocumentAnimationScheduler is behind the USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) macro, which is disabled on Windows. - This also reverts my fix in r233144 since it didn't work. 2018-06-25 Youenn Fablet <youenn@apple.com> Add API to control mock media devices https://bugs.webkit.org/show_bug.cgi?id=186958 Reviewed by Eric Carlson. Refactor code to introduce a MockDevice structure that can be used in multiple processes. Update mock sources and center to use MockDevice. Add API to update mock media devices. Make MediaDevices an ActiveDOMObject so that it does not get collected when ondevicechange is set. Test: fast/mediastream/device-change-event-2.html * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::MediaDevices): (WebCore::MediaDevices::stop): (WebCore::MediaDevices::scheduledEventTimerFired): (WebCore::MediaDevices::hasPendingActivity const): (WebCore::MediaDevices::activeDOMObjectName const): (WebCore::MediaDevices::canSuspendForDocumentSuspension const): * Modules/mediastream/MediaDevices.h: * Modules/mediastream/MediaDevices.idl: * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/RealtimeMediaSourceCenter.h: * platform/mock/MockMediaDevice.h: Added. (WebCore::MockMicrophoneProperties::encode const): (WebCore::MockMicrophoneProperties::decode): (WebCore::MockCameraProperties::encode const): (WebCore::MockCameraProperties::decode): (WebCore::MockDisplayProperties::encode const): (WebCore::MockDisplayProperties::decode): (WebCore::MockMediaDevice::isMicrophone const): (WebCore::MockMediaDevice::isCamera const): (WebCore::MockMediaDevice::isDisplay const): (WebCore::MockMediaDevice::type const): (WebCore::MockMediaDevice::encode const): (WebCore::MockMediaDevice::decodeMockMediaDevice): (WebCore::MockMediaDevice::decode): * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::MockRealtimeAudioSource::startProducingData): * platform/mock/MockRealtimeMediaSource.cpp: (WebCore::defaultDevices): (WebCore::devices): (WebCore::deviceMap): (WebCore::deviceListForDevice): (WebCore::MockRealtimeMediaSource::createCaptureDevice): (WebCore::MockRealtimeMediaSource::resetDevices): (WebCore::MockRealtimeMediaSource::setDevices): (WebCore::MockRealtimeMediaSource::addDevice): (WebCore::MockRealtimeMediaSource::removeDevice): (WebCore::MockRealtimeMediaSource::captureDeviceWithPersistentID): (WebCore::MockRealtimeMediaSource::audioDevices): (WebCore::MockRealtimeMediaSource::videoDevices): (WebCore::MockRealtimeMediaSource::displayDevices): (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource): (WebCore::MockRealtimeMediaSource::initializeCapabilities): (WebCore::MockRealtimeMediaSource::initializeSettings): (WebCore::MockRealtimeMediaSource::settings const): (WebCore::MockRealtimeMediaSource::supportedConstraints): * platform/mock/MockRealtimeMediaSource.h: (WebCore::MockRealtimeMediaSource::device const): * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::MockRealtimeMediaSourceCenter::singleton): (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled): (WebCore::MockRealtimeMediaSourceCenter::setDevices): (WebCore::MockRealtimeMediaSourceCenter::addDevice): (WebCore::MockRealtimeMediaSourceCenter::removeDevice): * platform/mock/MockRealtimeMediaSourceCenter.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): (WebCore::MockRealtimeVideoSource::initializeCapabilities): (WebCore::MockRealtimeVideoSource::drawText): (WebCore::MockRealtimeVideoSource::generateFrame): * platform/mock/MockRealtimeVideoSource.h: (WebCore::MockRealtimeVideoSource::mockCamera const): (WebCore::MockRealtimeVideoSource::mockScreen const): 2018-06-25 Simon Fraser <simon.fraser@apple.com> AutoTableLayout wastes 52KB of Vector capacity on nytimes.com https://bugs.webkit.org/show_bug.cgi?id=186710 Reviewed by Zalan Bujtas. Call resizeToFit() to only allocate enough capacity for the number of columns. * rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::fullRecalc): (WebCore::AutoTableLayout::insertSpanCell): Whitespace fix. * rendering/AutoTableLayout.h: 2018-06-25 Zalan Bujtas <zalan@apple.com> [LFC] Adjust static position with containing block's content box top/left https://bugs.webkit.org/show_bug.cgi?id=186999 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::contentBoxTop const): (WebCore::Display::Box::contentBoxLeft const): 2018-06-25 David Kilzer <ddkilzer@apple.com> REGRESSION (r233140): Windows build failure due to incomplete DocumentAnimationScheduler type <https://webkit.org/b/186997> * dom/Document.cpp: * dom/Document.h: - Attempt to fix Windows build failure by moving include of DocumentAnimationScheduler.h from Document.cpp to Document.h. 2018-06-25 Philippe Normand <pnormand@igalia.com> [GStreamer] Remove useless workaround https://bugs.webkit.org/show_bug.cgi?id=186921 Reviewed by Xabier Rodriguez-Calvar. In bug 67407 a workaround was added for GStreamer 0.10. With 1.x the media/video-reverse-play-duration.html test passes without any workaround needed. The other test mentioned in that bug was removed, it seems. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const): 2018-06-24 Tomas Popela <tpopela@redhat.com> Unreviewed, address Darin's comment https://bugs.webkit.org/show_bug.cgi?id=186757 * page/linux/ResourceUsageThreadLinux.cpp: (WebCore::cpuPeriod): 2018-06-25 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-animations/test_animation-pausing.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183826 <rdar://problem/40997412> Reviewed by Dean Jackson. The CSS Animations Level 2 specification defines that calling pause() on a CSSAnimation object is "sticky" until a call to play() is made, meaning that any changes to the running state via the CSS animation-play-state property is overridden by the stickiness of the pause() call. In this patch we add an m_stickyPaused flag which is set in API calls to pause() and play(). While this flag is true, changes to the animation-play-state property to the "running" value are ignored. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): (WebCore::CSSAnimation::bindingsPlay): (WebCore::CSSAnimation::bindingsPause): * animation/CSSAnimation.h: 2018-06-25 Antoine Quint <graouts@apple.com> [Web Animations] Ensure animations are updated prior to requestAnimationFrame callbacks https://bugs.webkit.org/show_bug.cgi?id=186997 <rdar://problem/41419414> Reviewed by Dean Jackson. Some sub-tests of imported/mozilla/css-animations/test_animation-pausing.html clearly expect that animations would be resolved prior to firing a requestAnimationFrame() callback, as the HTML5 event loop mandates. But until now, both DocumentTimeline and ScriptedAnimationController would make calls to DisplayRefreshMonitorManager::scheduleAnimation() that were not coordinated and so the order in which the DocumentTimeline and ScriptedAnimationController callbacks were performed was not guaranteed. In this patch we add a new DocumentAnimationScheduler class which is created by a Document to manage this specific situation. Now DocumentTimeline and ScriptedAnimationController use this supporting object instead of being their own DisplayRefreshMonitorClient and call scheduleWebAnimationsResolution() and scheduleScriptedAnimationResolution() respectively to indicate the need to schedule an animation through the DisplayRefreshMonitorManager to serve the specific needs of either, or both, classes. Then DocumentAnimationScheduler ensures that Web Animations resolution happens prior to requestAnimationFrame callbacks when both are scheduled. In the future we should be able to move more code from DocumentTimeline and ScriptedAnimationController over to DocumentAnimationScheduler, such as support for throttling and using a timer-based fallback, but this patch provides the minimal functionality required to provide a sounder foundation. * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::requestAnimationFrame): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/DocumentAnimationScheduler.cpp: Added. (WebCore::DocumentAnimationScheduler::create): (WebCore::DocumentAnimationScheduler::DocumentAnimationScheduler): (WebCore::DocumentAnimationScheduler::detachFromDocument): (WebCore::DocumentAnimationScheduler::scheduleWebAnimationsResolution): (WebCore::DocumentAnimationScheduler::scheduleScriptedAnimationResolution): (WebCore::DocumentAnimationScheduler::displayRefreshFired): (WebCore::DocumentAnimationScheduler::windowScreenDidChange): (WebCore::DocumentAnimationScheduler::createDisplayRefreshMonitor const): * animation/DocumentAnimationScheduler.h: Copied from Source/WebCore/animation/CSSAnimation.h. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::create): (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::scheduleAnimationResolution): (WebCore::DocumentTimeline::windowScreenDidChange): Deleted. (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Deleted. * animation/DocumentTimeline.h: * dom/Document.cpp: (WebCore::Document::prepareForDestruction): (WebCore::Document::windowScreenDidChange): (WebCore::Document::requestAnimationFrame): (WebCore::Document::animationScheduler): (WebCore::Document::timeline): * dom/Document.h: * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::ScriptedAnimationController): (WebCore::ScriptedAnimationController::scheduleAnimation): (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): (WebCore::ScriptedAnimationController::windowScreenDidChange): Deleted. (WebCore::ScriptedAnimationController::displayRefreshFired): Deleted. (WebCore::ScriptedAnimationController::createDisplayRefreshMonitor const): Deleted. * dom/ScriptedAnimationController.h: (WebCore::ScriptedAnimationController::create): 2018-06-25 Zan Dobersek <zdobersek@igalia.com> [GCrypt] Zero-prefix (if necessary) output of RSA-based encryption and signing operations https://bugs.webkit.org/show_bug.cgi?id=186967 Reviewed by Michael Catanzaro. Output for RSA-based encryption and signing operations should match the length of the RSA key. The way we retrieve the MPI data means libgcrypt can ignore the high-bit zero values and leave us with a valid result that's shorter in length compared to the RSA key. For instance, if the output MPI fits into 2040 bits while a 2048-bit key was used we'll end up with MPI data that will be fitted into a 255-byte Vector, one byte short of the expected output length. To avoid this, mpiZeroPrefixedData() is now used when retrieving output of these RSA operations, and the value of the key size in bytes is passed to it. This efficiently prepares the output Vector and then copies the MPI data into it, respecting the MPI data length as well as the desired length of the output. No new tests -- relevant tests are now stable (i.e. not sporadically failing anymore), associated expectations are removed. * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp: (WebCore::gcryptDerive): Also use mpiZeroPrefixedData(). * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp: (WebCore::gcryptEncrypt): (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp: (WebCore::gcryptSign): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp: (WebCore::gcryptEncrypt): (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp: (WebCore::gcryptSign): (WebCore::CryptoAlgorithmRSA_PSS::platformSign): * crypto/gcrypt/GCryptUtilities.h: (WebCore::mpiZeroPrefixedData): 2018-06-24 Simon Fraser <simon.fraser@apple.com> Fix the DUMP_NODE_STATISTICS code so that it compiles https://bugs.webkit.org/show_bug.cgi?id=186982 Reviewed by Anders Carlsson. The DUMP_NODE_STATISTICS code had bitrotted. ENTITY_NODE no longer exists. liveNodeSet needs to be a static function with a NeverDestroyed<>. * dom/Node.cpp: (WebCore::Node::dumpStatistics): (WebCore::Node::trackForDebugging): (WebCore::Node::~Node): 2018-06-24 Simon Fraser <simon.fraser@apple.com> Fix the composition underline to be transformed by -apple-color-filter https://bugs.webkit.org/show_bug.cgi?id=186983 rdar://problem/40515558 Reviewed by Zalan Bujtas. Transform the composition underline color with the color filter. Test: css3/color-filters/color-filter-composition-underline-color.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintCompositionUnderline const): 2018-06-23 Zalan Bujtas <zalan@apple.com> [Mail] Use the Mail Viewer width as the base for resolving horizontal viewport units https://bugs.webkit.org/show_bug.cgi?id=186585 <rdar://problem/30685325> Reviewed by Tim Horton. Use the existing "override viewport size for viewport units" mechanism to compute the preferred viewport unit values for the Mail Viewer html content. Test: fast/dynamic/mail-autosize-viewport-unit.html * page/FrameView.cpp: (WebCore::FrameView::FrameView): (WebCore::FrameView::enableAutoSizeMode): (WebCore::FrameView::clearViewportSizeOverrideForCSSViewportUnits): (WebCore::FrameView::setViewportSizeForCSSViewportUnits): (WebCore::FrameView::overrideViewportSizeForCSSViewportUnits): (WebCore::FrameView::viewportSizeForCSSViewportUnits const): * page/FrameView.h: 2018-06-23 Zalan Bujtas <zalan@apple.com> [LFC] Relatively positioned renderer needs offsetting for validation https://bugs.webkit.org/show_bug.cgi?id=186959 Reviewed by Antti Koivisto. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): 2018-06-23 Zalan Bujtas <zalan@apple.com> [LFC] Miscellaneous fixes to fix simple absolute positioning. https://bugs.webkit.org/show_bug.cgi?id=186962 Reviewed by Antti Koivisto. 1. Collect out-of-flow formatting root descendants. 2. Remove invalid and redundant ASSERTs invalid because the assertion is missing border, padding etc. redundant becasue we assert on geometry correctness in validateGeometryConstraintsAfterLayout. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): * layout/layouttree/LayoutContainer.cpp: (WebCore::Layout::Container::addOutOfFlowDescendant): (WebCore::Layout::Container::setOutOfFlowDescendants): Deleted. * layout/layouttree/LayoutContainer.h: * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createSubTree): 2018-06-23 Yusuke Suzuki <utatane.tea@gmail.com> [WTF] Add user-defined literal for ASCIILiteral https://bugs.webkit.org/show_bug.cgi?id=186839 Reviewed by Darin Adler. No behavior change. * Modules/applicationmanifest/ApplicationManifestParser.cpp: (WebCore::ApplicationManifestParser::parseManifest): (WebCore::ApplicationManifestParser::logManifestPropertyNotAString): (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL): (WebCore::ApplicationManifestParser::logDeveloperWarning): (WebCore::ApplicationManifestParser::parseStartURL): (WebCore::ApplicationManifestParser::parseDisplay): (WebCore::ApplicationManifestParser::parseName): (WebCore::ApplicationManifestParser::parseDescription): (WebCore::ApplicationManifestParser::parseShortName): (WebCore::ApplicationManifestParser::parseScope): * Modules/beacon/NavigatorBeacon.cpp: (WebCore::NavigatorBeacon::logError): (WebCore::NavigatorBeacon::sendBeacon): * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::requestFromInfo): (WebCore::DOMCache::addAll): (WebCore::DOMCache::put): * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::errorToException): * Modules/credentialmanagement/BasicCredential.cpp: (WebCore::BasicCredential::type const): * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::root): (WebCore::validatePathIsExpectedType): (WebCore::resolveRelativeVirtualPath): (WebCore::DOMFileSystem::getEntry): * Modules/entriesapi/FileSystemDirectoryEntry.cpp: (WebCore::FileSystemDirectoryEntry::getEntry): * Modules/entriesapi/FileSystemDirectoryReader.cpp: (WebCore::FileSystemDirectoryReader::readEntries): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::loadingFailed): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::consumeOnceLoadingFinished): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::consumeBodyAsStream): * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::startLoadingBlobURL): (WebCore::FetchLoader::start): * Modules/fetch/FetchRequest.cpp: (WebCore::setMethod): (WebCore::computeReferrer): (WebCore::buildOptions): (WebCore::FetchRequest::initializeOptions): (WebCore::FetchRequest::initializeWith): (WebCore::FetchRequest::setBody): (WebCore::FetchRequest::referrer const): (WebCore::FetchRequest::clone): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * Modules/geolocation/GeoNotifier.cpp: (WebCore::GeoNotifier::timerFired): * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::startRequest): (WebCore::Geolocation::requestUsesCachedPosition): (WebCore::Geolocation::makeCachedPositionCallbacks): (WebCore::Geolocation::setIsAllowed): (WebCore::Geolocation::cancelRequests): (WebCore::Geolocation::handlePendingPermissionNotifiers): * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::update): (WebCore::IDBCursor::advance): (WebCore::IDBCursor::continuePrimaryKey): (WebCore::IDBCursor::continueFunction): (WebCore::IDBCursor::deleteFunction): * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::createObjectStore): (WebCore::IDBDatabase::transaction): (WebCore::IDBDatabase::deleteObjectStore): * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::open): (WebCore::IDBFactory::openInternal): (WebCore::IDBFactory::deleteDatabase): (WebCore::IDBFactory::cmp): * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::setName): (WebCore::IDBIndex::openCursor): (WebCore::IDBIndex::openKeyCursor): (WebCore::IDBIndex::count): (WebCore::IDBIndex::doCount): (WebCore::IDBIndex::get): (WebCore::IDBIndex::doGet): (WebCore::IDBIndex::getKey): (WebCore::IDBIndex::doGetKey): (WebCore::IDBIndex::getAll): (WebCore::IDBIndex::getAllKeys): * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::loggingString const): * Modules/indexeddb/IDBKeyRangeData.cpp: (WebCore::IDBKeyRangeData::loggingString const): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::setName): (WebCore::IDBObjectStore::openCursor): (WebCore::IDBObjectStore::openKeyCursor): (WebCore::IDBObjectStore::get): (WebCore::IDBObjectStore::getKey): (WebCore::IDBObjectStore::putOrAdd): (WebCore::IDBObjectStore::doDelete): (WebCore::IDBObjectStore::deleteFunction): (WebCore::IDBObjectStore::clear): (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::count): (WebCore::IDBObjectStore::doCount): (WebCore::IDBObjectStore::getAll): (WebCore::IDBObjectStore::getAllKeys): * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::result const): (WebCore:: const): (WebCore::IDBRequest::uncaughtExceptionInEventHandler): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::abort): (WebCore::IDBTransaction::putOrAddOnServer): * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::performGetAllDatabaseNames): * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::deleteRange): (WebCore::IDBServer::MemoryIDBBackingStore::addRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords): (WebCore::IDBServer::MemoryIDBBackingStore::getIndexRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getCount): (WebCore::IDBServer::MemoryIDBBackingStore::openCursor): (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor): * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename): (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey): (WebCore::IDBServer::SQLiteIDBBackingStore::getCount): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::openCursor): (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore): * Modules/indexeddb/server/SQLiteIDBTransaction.cpp: (WebCore::IDBServer::SQLiteIDBTransaction::begin): (WebCore::IDBServer::SQLiteIDBTransaction::commit): (WebCore::IDBServer::SQLiteIDBTransaction::abort): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::deleteObjectStore): (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore): (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex): (WebCore::IDBServer::UniqueIDBDatabase::renameIndex): (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction): (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction): * Modules/indexeddb/shared/IDBError.h: (WebCore::IDBError::userDeleteError): * Modules/indexeddb/shared/IDBTransactionInfo.cpp: (WebCore::IDBTransactionInfo::loggingString const): * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::addIceCandidate): * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::deny): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate): * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::checkAndCanonicalizeTotal): (WebCore::PaymentRequest::create): * Modules/quota/DOMWindowQuota.cpp: (WebCore::DOMWindowQuota::webkitStorageInfo const): * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::looping): (WebCore::AudioBufferSourceNode::setLooping): * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::channelCountMode): (WebCore::AudioNode::channelInterpretation): * Modules/webaudio/MediaStreamAudioSource.cpp: (WebCore::MediaStreamAudioSource::MediaStreamAudioSource): * Modules/webauthn/AuthenticatorManager.cpp: (WebCore::AuthenticatorManagerInternal::produceClientDataJson): (WebCore::AuthenticatorManagerInternal::initTimeoutTimer): (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): (WebCore::AuthenticatorManager::isUserVerifyingPlatformAuthenticatorAvailable const): * Modules/webauthn/cocoa/LocalAuthenticator.mm: (WebCore::LocalAuthenticator::makeCredential): (WebCore::LocalAuthenticator::getAssertion): * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::usage): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): (WebCore::WebSocket::close): (WebCore::WebSocket::binaryType const): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::readStatusLine): (WebCore::WebSocketHandshake::readHTTPHeaders): (WebCore::WebSocketHandshake::checkResponseHeaders): * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::requestPresent): (WebCore::VRDisplay::exitPresent): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::defaultLiveRegionStatusForRole): (WebCore::AccessibilityObject::invalidStatus const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement const): * bindings/js/JSCustomElementInterface.cpp: (WebCore::constructCustomElementSynchronously): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::getCustomElementCallback): (WebCore::validateCustomElementNameAndThrowIfNeeded): (WebCore::JSCustomElementRegistry::define): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMConstructorBase.cpp: (WebCore::callThrowTypeError): * bindings/js/JSDOMConstructorBase.h: (WebCore::JSDOMConstructorBase::className): * bindings/js/JSDOMConstructorNotConstructable.h: (WebCore::JSDOMConstructorNotConstructable::callThrowTypeError): * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::createDOMException): (WebCore::throwSequenceTypeError): (WebCore::throwNonFiniteTypeError): * bindings/js/JSDOMIterator.h: (WebCore::iteratorForEach): (WebCore::IteratorTraits>::next): * bindings/js/JSDOMWindowBase.cpp: (WebCore::isResponseCorrect): (WebCore::handleResponseOnStreamingAction): (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::preventExtensions): (WebCore::JSDOMWindow::toStringName): * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): * bindings/js/JSLocationCustom.cpp: (WebCore::JSLocation::preventExtensions): (WebCore::JSLocation::toStringName): * bindings/js/JSReadableStreamPrivateConstructors.cpp: (WebCore::constructJSReadableStreamDefaultController): (WebCore::constructJSReadableByteStreamController): (WebCore::constructJSReadableStreamBYOBRequest): * bindings/js/JSRemoteDOMWindowCustom.cpp: (WebCore::JSRemoteDOMWindow::preventExtensions): (WebCore::JSRemoteDOMWindow::toStringName): * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::ReadableStreamDefaultController::invoke): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/SerializedScriptValue.cpp: (WebCore::maybeThrowExceptionIfSerializationFailed): * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::evaluate): * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): (GenerateConstructorHelperMethods): (GenerateCallTracer): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::JSInterfaceNameConstructor::initializeProperties): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::JSMapLikeConstructor::initializeProperties): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::JSReadOnlyMapLikeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::JSTestActiveDOMObjectConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::JSTestCEReactionsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::JSTestCEReactionsStringifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::JSTestCallTracerConstructor::initializeProperties): (WebCore::jsTestCallTracerTestAttributeInterfaceGetter): (WebCore::setJSTestCallTracerTestAttributeInterfaceSetter): (WebCore::jsTestCallTracerTestAttributeSpecifiedGetter): (WebCore::setJSTestCallTracerTestAttributeSpecifiedSetter): (WebCore::jsTestCallTracerTestAttributeWithVariantGetter): (WebCore::setJSTestCallTracerTestAttributeWithVariantSetter): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationInterfaceBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationSpecifiedBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithArgumentsBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody): * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: (WebCore::JSTestCallbackInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::JSTestClassWithJSBuiltinConstructorConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: (WebCore::JSTestCustomConstructorWithNoInterfaceObjectConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::JSTestDOMJITConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::JSTestEnabledBySettingConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::JSTestEventConstructorConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::JSTestEventTargetConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::JSTestExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::JSTestGenerateIsReachableConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::JSTestGlobalObjectConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: (WebCore::JSTestIndexedSetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: (WebCore::JSTestIndexedSetterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::JSTestIndexedSetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::construct): (WebCore::JSTestInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::JSTestIterableConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::JSTestJSBuiltinConstructorConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::JSTestMediaQueryListListenerConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::JSTestNamedAndIndexedSetterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorConstructor::initializeProperties): (WebCore::JSTestNamedConstructorNamedConstructor::construct): (WebCore::JSTestNamedConstructorNamedConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: (WebCore::JSTestNamedDeleterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: (WebCore::JSTestNamedDeleterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::JSTestNamedDeleterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: (WebCore::JSTestNamedDeleterWithIndexedGetterConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: (WebCore::JSTestNamedGetterCallWithConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: (WebCore::JSTestNamedGetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::JSTestNamedGetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::JSTestNamedSetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::JSTestNamedSetterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::JSTestNamedSetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetterConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetterAndSetterConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: (WebCore::JSTestNamedSetterWithOverrideBuiltinsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::JSTestNamedSetterWithUnforgablePropertiesConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNodeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::JSTestObjConstructor::initializeProperties): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValueBody): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::JSTestOverloadedConstructorsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::JSTestOverloadedConstructorsWithSequenceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::JSTestOverrideBuiltinsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::JSTestPluginInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::JSTestPromiseRejectionEventConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::JSTestSerializationConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: (WebCore::JSTestSerializationIndirectInheritanceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: (WebCore::JSTestSerializationInheritConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: (WebCore::JSTestSerializationInheritFinalConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::JSTestStringifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::JSTestStringifierAnonymousOperationConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::JSTestStringifierNamedOperationConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::JSTestStringifierOperationImplementedAsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::JSTestStringifierOperationNamedToStringConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::JSTestStringifierReadOnlyAttributeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::JSTestStringifierReadWriteAttributeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::JSTestTypedefsConstructor::initializeProperties): * bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::invokeMethod): (JSC::Bindings::CInstance::invokeDefaultMethod): (JSC::Bindings::CInstance::invokeConstruct): (JSC::Bindings::CInstance::stringValue const): (JSC::Bindings::CInstance::toJSPrimitive const): * bridge/objc/objc_instance.mm: (ObjcInstance::invokeMethod): * bridge/objc/objc_runtime.mm: (JSC::Bindings::ObjcArray::setValueAt const): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): * crypto/SubtleCrypto.cpp: (WebCore::rejectWithException): (WebCore::SubtleCrypto::encrypt): (WebCore::SubtleCrypto::decrypt): (WebCore::SubtleCrypto::sign): (WebCore::SubtleCrypto::verify): (WebCore::SubtleCrypto::deriveKey): (WebCore::SubtleCrypto::deriveBits): (WebCore::SubtleCrypto::exportKey): (WebCore::SubtleCrypto::wrapKey): (WebCore::SubtleCrypto::unwrapKey): * crypto/keys/CryptoKeyEC.cpp: (WebCore::CryptoKeyEC::algorithm const): * css/CSSInheritedValue.cpp: (WebCore::CSSInheritedValue::customCSSText const): * css/CSSInitialValue.cpp: (WebCore::CSSInitialValue::customCSSText const): * css/CSSKeyframesRule.cpp: (WebCore::CSSKeyframesRule::insertRule): * css/CSSRevertValue.cpp: (WebCore::CSSRevertValue::customCSSText const): * css/CSSStyleSheet.h: * css/CSSUnsetValue.cpp: (WebCore::CSSUnsetValue::customCSSText const): * css/CSSValueList.cpp: (WebCore::CSSValueList::customCSSText const): * css/DOMMatrixReadOnly.cpp: (WebCore::DOMMatrixReadOnly::validateAndFixup): (WebCore::DOMMatrixReadOnly::toFloat32Array const): (WebCore::DOMMatrixReadOnly::toFloat64Array const): (WebCore::DOMMatrixReadOnly::toString const): * css/DeprecatedCSSOMValueList.cpp: (WebCore::DeprecatedCSSOMValueList::cssText const): * css/FontFace.cpp: (WebCore::FontFace::create): (WebCore::FontFace::unicodeRange const): (WebCore::FontFace::featureSettings const): * css/MediaQuery.cpp: (WebCore::MediaQuery::serialize const): * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority): * css/WebKitCSSMatrix.cpp: (WebCore::WebKitCSSMatrix::toString const): * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::commitMediaQuery): * dom/CDATASection.cpp: (WebCore::CDATASection::nodeName const): * dom/Comment.cpp: (WebCore::Comment::nodeName const): * dom/DOMException.cpp: (WebCore::DOMException::description const): (WebCore::DOMException::create): * dom/DOMException.h: (WebCore::DOMException::name): (WebCore::DOMException::message): * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createHTMLDocument): * dom/DataTransfer.cpp: (WebCore::DataTransfer::DataTransfer): (WebCore::DataTransfer::types const): (WebCore::DataTransfer::createForInputEvent): (WebCore::DataTransfer::dropEffect const): (WebCore::DataTransfer::effectAllowed const): * dom/DataTransferItem.cpp: (WebCore::DataTransferItem::kind const): * dom/Document.cpp: (WebCore::Document::suggestedMIMEType const): (WebCore::Document::contentType const): (WebCore::Document::nodeName const): (WebCore::Document::writeln): (WebCore::Document::canNavigate): (WebCore::Document::designMode const): (WebCore::Document::requestFullScreenForElement): * dom/DocumentFragment.cpp: (WebCore::DocumentFragment::nodeName const): * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::createSheet): * dom/MouseEvent.cpp: (WebCore::MouseEvent::initMouseEventQuirk): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * dom/ScriptElementCachedScriptFetcher.cpp: (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::dispatchErrorEvent): * dom/ScriptedAnimationController.cpp: (WebCore::throttlingReasonsToString): * dom/Text.cpp: (WebCore::Text::nodeName const): * dom/TextEncoder.cpp: (WebCore::TextEncoder::encoding const): * dom/Traversal.cpp: (WebCore::NodeIteratorBase::acceptNode): * editing/EditCommand.cpp: (WebCore::inputTypeNameForEditingAction): * editing/Editing.cpp: (WebCore::createTabSpanElement): * editing/Editor.cpp: (WebCore::createDataTransferForClipboardEvent): * editing/EditorCommand.cpp: (WebCore::executeInsertBacktab): (WebCore::executeInsertLineBreak): (WebCore::executeInsertNewline): (WebCore::executeInsertTab): (WebCore::executeJustifyCenter): (WebCore::executeJustifyFull): (WebCore::executeJustifyLeft): (WebCore::executeJustifyRight): (WebCore::executeStrikethrough): (WebCore::executeSubscript): (WebCore::executeSuperscript): (WebCore::executeToggleBold): (WebCore::executeToggleItalic): (WebCore::executeUnderline): (WebCore::executeUnscript): (WebCore::stateBold): (WebCore::stateItalic): (WebCore::stateStrikethrough): (WebCore::stateSubscript): (WebCore::stateSuperscript): (WebCore::stateUnderline): (WebCore::stateJustifyCenter): (WebCore::stateJustifyFull): (WebCore::stateJustifyLeft): (WebCore::stateJustifyRight): (WebCore::Editor::Command::value const): * editing/SmartReplace.cpp: (WebCore::getSmartSet): * fileapi/FileCocoa.mm: (WebCore::File::computeNameAndContentTypeForReplacedFile): * html/BaseCheckableInputType.cpp: (WebCore::BaseCheckableInputType::saveFormControlState const): * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue): * html/ColorInputType.cpp: (WebCore::ColorInputType::fallbackValue const): * html/DOMFormData.cpp: (WebCore::DOMFormData::createFileEntry): * html/FTPDirectoryDocument.cpp: (WebCore::processFilesizeString): (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::relList const): (WebCore::HTMLAnchorElement::isSystemPreviewLink const): * html/HTMLAppletElement.cpp: (WebCore::HTMLAppletElement::HTMLAppletElement): (WebCore::HTMLAppletElement::updateWidget): * html/HTMLCanvasElement.cpp: (WebCore::toEncodingMimeType): (WebCore::HTMLCanvasElement::toDataURL): (WebCore::HTMLCanvasElement::captureStream): * html/HTMLElement.cpp: (WebCore::HTMLElement::contentEditable const): * html/HTMLFormControlElement.cpp: (WebCore::shouldAutofocus): * html/HTMLHtmlElement.cpp: (WebCore::HTMLHtmlElement::insertedByParser): * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::keytype const): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): (WebCore::stringForNetworkState): (WebCore::HTMLMediaElement::preload const): (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript): * html/HTMLObjectElement.cpp: (WebCore::mapDataParamToSrc): * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::setReplacement): * html/ImageData.cpp: (WebCore::ImageData::create): * html/ImageDocument.cpp: (WebCore::ImageDocument::createDocumentStructure): * html/ImageInputType.cpp: (WebCore::ImageInputType::appendFormData const): * html/PluginDocument.cpp: (WebCore::PluginDocumentParser::createDocumentStructure): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getExtension): (WebCore::WebGL2RenderingContext::getSupportedExtensions): (WebCore::WebGL2RenderingContext::getParameter): * html/canvas/WebGLCompressedTextureASTC.cpp: (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC): (WebCore::WebGLCompressedTextureASTC::getSupportedProfiles): (WebCore::WebGLCompressedTextureASTC::supported): (WebCore::m_isLDRSupported): Deleted. * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): (WebCore::WebGLRenderingContext::getParameter): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::enableSupportedExtension): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGPUEnums.cpp: (WebCore::web3DCompareFunctionName): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseCORSSettingsAttribute): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::initiatorFor): * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::insertPhoneNumberLink): * html/track/DataCue.cpp: (WebCore::DataCue::toJSONString const): * html/track/InbandGenericTextTrack.cpp: (WebCore::InbandGenericTextTrack::updateCueFromCueData): * html/track/TextTrackCue.cpp: (WebCore::TextTrackCue::toJSON const): * html/track/TextTrackCueGeneric.cpp: (WebCore::TextTrackCueGeneric::toJSONString const): * html/track/TrackBase.cpp: (WebCore::TrackBase::setLanguage): * html/track/VTTCue.cpp: (WebCore::VTTCue::toJSON const): * inspector/CommandLineAPIModule.cpp: (WebCore::CommandLineAPIModule::CommandLineAPIModule): * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::getCanvasContentAsDataURL): (WebCore::InspectorCanvas::indexForData): (WebCore::InspectorCanvas::buildInitialState): (WebCore::InspectorCanvas::buildArrayForCanvasGradient): (WebCore::InspectorCanvas::buildArrayForCanvasPattern): * inspector/InspectorFrontendClient.h: (WebCore::InspectorFrontendClient::debuggableType): * inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::openInNewTab): * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection): (WebCore::InspectorFrontendHost::platform): (WebCore::InspectorFrontendHost::port): * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::setIndicating): (WebCore::InspectorOverlay::drawPaintRects): (WebCore::InspectorOverlay::drawRulers): (WebCore::appendPathSegment): * inspector/InspectorStyleSheet.h: (WebCore::InspectorCSSId::InspectorCSSId): * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord): (WebCore::TimelineRecordFactory::createFunctionCallData): (WebCore::TimelineRecordFactory::createConsoleProfileData): (WebCore::TimelineRecordFactory::createProbeSampleData): (WebCore::TimelineRecordFactory::createEventDispatchData): (WebCore::TimelineRecordFactory::createGenericTimerData): (WebCore::TimelineRecordFactory::createTimerInstallData): (WebCore::TimelineRecordFactory::createEvaluateScriptData): (WebCore::TimelineRecordFactory::createTimeStampData): (WebCore::TimelineRecordFactory::createAnimationFrameData): (WebCore::TimelineRecordFactory::createPaintData): (WebCore::TimelineRecordFactory::appendLayoutRoot): * inspector/WebInjectedScriptHost.cpp: (WebCore::WebInjectedScriptHost::subtype): (WebCore::jsStringForPaymentRequestState): (WebCore::WebInjectedScriptHost::getInternalProperties): * inspector/agents/InspectorApplicationCacheAgent.cpp: (WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent): * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::InspectorCSSAgent): (WebCore::InspectorCSSAgent::getMatchedStylesForNode): (WebCore::InspectorCSSAgent::createStyleSheet): (WebCore::InspectorCSSAgent::addRule): (WebCore::InspectorCSSAgent::elementForId): (WebCore::InspectorCSSAgent::assertStyleSheetForId): * inspector/agents/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::InspectorCanvasAgent): (WebCore::InspectorCanvasAgent::requestNode): (WebCore::InspectorCanvasAgent::requestContent): (WebCore::InspectorCanvasAgent::resolveCanvasContext): (WebCore::InspectorCanvasAgent::startRecording): (WebCore::InspectorCanvasAgent::stopRecording): (WebCore::InspectorCanvasAgent::requestShaderSource): (WebCore::InspectorCanvasAgent::updateShader): (WebCore::InspectorCanvasAgent::setShaderProgramDisabled): (WebCore::InspectorCanvasAgent::setShaderProgramHighlighted): (WebCore::InspectorCanvasAgent::assertInspectorCanvas): (WebCore::InspectorCanvasAgent::assertInspectorProgram): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::InspectorDOMAgent): (WebCore::InspectorDOMAgent::assertNode): (WebCore::InspectorDOMAgent::assertDocument): (WebCore::InspectorDOMAgent::assertElement): (WebCore::InspectorDOMAgent::assertEditableNode): (WebCore::InspectorDOMAgent::assertEditableElement): (WebCore::InspectorDOMAgent::getDocument): (WebCore::InspectorDOMAgent::pushNodeToFrontend): (WebCore::InspectorDOMAgent::requestChildNodes): (WebCore::InspectorDOMAgent::querySelector): (WebCore::InspectorDOMAgent::querySelectorAll): (WebCore::InspectorDOMAgent::releaseBackendNodeIds): (WebCore::InspectorDOMAgent::setAttributesAsText): (WebCore::InspectorDOMAgent::removeNode): (WebCore::InspectorDOMAgent::setOuterHTML): (WebCore::InspectorDOMAgent::insertAdjacentHTML): (WebCore::InspectorDOMAgent::setNodeValue): (WebCore::InspectorDOMAgent::setEventListenerDisabled): (WebCore::InspectorDOMAgent::performSearch): (WebCore::InspectorDOMAgent::getSearchResults): (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject): (WebCore::InspectorDOMAgent::highlightQuad): (WebCore::InspectorDOMAgent::highlightSelector): (WebCore::InspectorDOMAgent::highlightNode): (WebCore::InspectorDOMAgent::highlightNodeList): (WebCore::InspectorDOMAgent::moveTo): (WebCore::InspectorDOMAgent::focus): (WebCore::InspectorDOMAgent::setInspectedNode): (WebCore::InspectorDOMAgent::resolveNode): (WebCore::InspectorDOMAgent::pushNodeByPathToFrontend): (WebCore::InspectorDOMAgent::pushNodeByBackendIdToFrontend): * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent): (WebCore::InspectorDOMDebuggerAgent::setBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeBreakpoint): (WebCore::domTypeName): (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent): (WebCore::InspectorDOMStorageAgent::getDOMStorageItems): (WebCore::InspectorDOMStorageAgent::setDOMStorageItem): (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem): (WebCore::InspectorDOMStorageAgent::findStorageArea): * inspector/agents/InspectorDatabaseAgent.cpp: (WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent): (WebCore::InspectorDatabaseAgent::getDatabaseTableNames): * inspector/agents/InspectorIndexedDBAgent.cpp: (WebCore::Inspector::idbKeyRangeFromKeyRange): (WebCore::InspectorIndexedDBAgent::InspectorIndexedDBAgent): (WebCore::InspectorIndexedDBAgent::requestData): * inspector/agents/InspectorLayerTreeAgent.cpp: (WebCore::InspectorLayerTreeAgent::InspectorLayerTreeAgent): (WebCore::InspectorLayerTreeAgent::layersForNode): (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer): * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::InspectorMemoryAgent): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::InspectorNetworkAgent): (WebCore::InspectorNetworkAgent::getResponseBody): (WebCore::InspectorNetworkAgent::loadResource): (WebCore::InspectorNetworkAgent::resolveWebSocket): (WebCore::InspectorNetworkAgent::createTextDecoder): (WebCore::InspectorNetworkAgent::searchInRequest): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::resourceContent): (WebCore::InspectorPageAgent::InspectorPageAgent): (WebCore::InspectorPageAgent::navigate): (WebCore::InspectorPageAgent::assertFrame): (WebCore::InspectorPageAgent::assertDocumentLoader): (WebCore::InspectorPageAgent::snapshotNode): (WebCore::InspectorPageAgent::snapshotRect): (WebCore::InspectorPageAgent::archive): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): (WebCore::InspectorTimelineAgent::setInstruments): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::stopFromConsole): (WebCore::InspectorTimelineAgent::didCompleteRecordEntry): * inspector/agents/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::initialized): (WebCore::InspectorWorkerAgent::sendMessageToWorker): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::setLoggingChannelLevel): * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::injectedScriptForEval): * inspector/agents/page/PageNetworkAgent.cpp: (WebCore::PageNetworkAgent::scriptExecutionContext): * inspector/agents/page/PageRuntimeAgent.cpp: (WebCore::PageRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * loader/ContentFilter.cpp: (WebCore::ContentFilter::handleProvisionalLoadFailure): * loader/CrossOriginAccessControl.cpp: (WebCore::passesAccessControlCheck): (WebCore::validatePreflightResponse): * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::notifyFinished): (WebCore::CrossOriginPreflightChecker::doPreflight): * loader/DocumentLoader.cpp: (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::startIconLoading): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::reportRedirectionWithBadScheme): (WebCore::DocumentThreadableLoader::reportContentSecurityPolicyError): (WebCore::DocumentThreadableLoader::reportCrossOriginResourceSharingError): (WebCore::DocumentThreadableLoader::reportIntegrityMetadataError): * loader/FormSubmission.cpp: (WebCore::FormSubmission::Attributes::parseEncodingType): * loader/FormSubmission.h: (WebCore::FormSubmission::Attributes::methodString): * loader/FrameLoader.cpp: (WebCore::FrameLoader::initForSynthesizedDocument): (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::defaultSubstituteDataForURL): (WebCore::FrameLoader::addHTTPUpgradeInsecureRequestsIfNeeded): (WebCore::FrameLoader::dispatchBeforeUnloadEvent): * loader/LinkLoader.cpp: (WebCore::LinkLoader::preconnectIfNeeded): * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::scheduleLocationChange): * loader/PingLoader.cpp: (WebCore::PingLoader::sendViolationReport): * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::primaryDomain): (WebCore::ResourceLoadStatistics::areDomainsAssociated): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::loadDataURL): (WebCore::ResourceLoader::didBlockAuthenticationChallenge): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::logError): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::abort): (WebCore::ApplicationCacheGroup::didFinishLoadingEntry): (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::createFileURL): * loader/appcache/ManifestParser.cpp: (WebCore::parseManifest): * loader/archive/ArchiveFactory.cpp: (WebCore::createArchiveMIMETypesMap): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::load): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::canRequest): (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceRequest.cpp: (WebCore::acceptHeaderValueFromType): (WebCore::CachedResourceRequest::updateAcceptEncodingHeader): * loader/cache/CachedScript.cpp: (WebCore::CachedScript::CachedScript): * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::getOriginsWithCache): * loader/soup/ResourceLoaderSoup.cpp: (WebCore::ResourceLoader::loadGResource): * page/DOMSelection.cpp: (WebCore::DOMSelection::type const): * page/DOMWindow.cpp: (WebCore::DOMWindow::close): (WebCore::DOMWindow::addEventListener): (WebCore::DOMWindow::createWindow): * page/DebugPageOverlays.cpp: (WebCore::touchEventRegionColors): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::mediaLoadedKey): (WebCore::DiagnosticLoggingKeys::mediaLoadingFailedKey): (WebCore::DiagnosticLoggingKeys::memoryCacheEntryDecisionKey): (WebCore::DiagnosticLoggingKeys::memoryCacheUsageKey): (WebCore::DiagnosticLoggingKeys::missingValidatorFieldsKey): (WebCore::DiagnosticLoggingKeys::pluginLoadedKey): (WebCore::DiagnosticLoggingKeys::pluginLoadingFailedKey): (WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey): (WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey): (WebCore::DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey): (WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey): (WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey): (WebCore::DiagnosticLoggingKeys::provisionalLoadKey): (WebCore::DiagnosticLoggingKeys::pageContainsPluginKey): (WebCore::DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey): (WebCore::DiagnosticLoggingKeys::pageContainsMediaEngineKey): (WebCore::DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey): (WebCore::DiagnosticLoggingKeys::pageLoadedKey): (WebCore::DiagnosticLoggingKeys::playedKey): (WebCore::DiagnosticLoggingKeys::engineFailedToLoadKey): (WebCore::DiagnosticLoggingKeys::entryRightlyNotWarmedUpKey): (WebCore::DiagnosticLoggingKeys::entryWronglyNotWarmedUpKey): (WebCore::DiagnosticLoggingKeys::navigationKey): (WebCore::DiagnosticLoggingKeys::needsRevalidationKey): (WebCore::DiagnosticLoggingKeys::networkCacheKey): (WebCore::DiagnosticLoggingKeys::networkCacheFailureReasonKey): (WebCore::DiagnosticLoggingKeys::networkCacheUnusedReasonKey): (WebCore::DiagnosticLoggingKeys::networkCacheReuseFailureKey): (WebCore::DiagnosticLoggingKeys::networkKey): (WebCore::DiagnosticLoggingKeys::networkProcessCrashedKey): (WebCore::DiagnosticLoggingKeys::neverSeenBeforeKey): (WebCore::DiagnosticLoggingKeys::noKey): (WebCore::DiagnosticLoggingKeys::noCacheKey): (WebCore::DiagnosticLoggingKeys::noStoreKey): (WebCore::DiagnosticLoggingKeys::nonVisibleStateKey): (WebCore::DiagnosticLoggingKeys::notInMemoryCacheKey): (WebCore::DiagnosticLoggingKeys::pageCacheKey): (WebCore::DiagnosticLoggingKeys::pageCacheFailureKey): (WebCore::DiagnosticLoggingKeys::noDocumentLoaderKey): (WebCore::DiagnosticLoggingKeys::noLongerInCacheKey): (WebCore::DiagnosticLoggingKeys::otherKey): (WebCore::DiagnosticLoggingKeys::mainDocumentErrorKey): (WebCore::DiagnosticLoggingKeys::mainResourceKey): (WebCore::DiagnosticLoggingKeys::isErrorPageKey): (WebCore::DiagnosticLoggingKeys::isExpiredKey): (WebCore::DiagnosticLoggingKeys::isReloadIgnoringCacheDataKey): (WebCore::DiagnosticLoggingKeys::loadingKey): (WebCore::DiagnosticLoggingKeys::hasPluginsKey): (WebCore::DiagnosticLoggingKeys::httpsNoStoreKey): (WebCore::DiagnosticLoggingKeys::imageKey): (WebCore::DiagnosticLoggingKeys::inMemoryCacheKey): (WebCore::DiagnosticLoggingKeys::inactiveKey): (WebCore::DiagnosticLoggingKeys::internalErrorKey): (WebCore::DiagnosticLoggingKeys::invalidSessionIDKey): (WebCore::DiagnosticLoggingKeys::isAttachmentKey): (WebCore::DiagnosticLoggingKeys::isConditionalRequestKey): (WebCore::DiagnosticLoggingKeys::isDisabledKey): (WebCore::DiagnosticLoggingKeys::noCurrentHistoryItemKey): (WebCore::DiagnosticLoggingKeys::quirkRedirectComingKey): (WebCore::DiagnosticLoggingKeys::rawKey): (WebCore::DiagnosticLoggingKeys::redirectKey): (WebCore::DiagnosticLoggingKeys::isLoadingKey): (WebCore::DiagnosticLoggingKeys::documentLoaderStoppingKey): (WebCore::DiagnosticLoggingKeys::domainCausingCrashKey): (WebCore::DiagnosticLoggingKeys::domainCausingEnergyDrainKey): (WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey): (WebCore::DiagnosticLoggingKeys::simulatedPageCrashKey): (WebCore::DiagnosticLoggingKeys::exceededActiveMemoryLimitKey): (WebCore::DiagnosticLoggingKeys::exceededInactiveMemoryLimitKey): (WebCore::DiagnosticLoggingKeys::exceededBackgroundCPULimitKey): (WebCore::DiagnosticLoggingKeys::domainVisitedKey): (WebCore::DiagnosticLoggingKeys::cannotSuspendActiveDOMObjectsKey): (WebCore::DiagnosticLoggingKeys::cpuUsageKey): (WebCore::DiagnosticLoggingKeys::createSharedBufferFailedKey): (WebCore::DiagnosticLoggingKeys::activeInForegroundTabKey): (WebCore::DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey): (WebCore::DiagnosticLoggingKeys::applicationCacheKey): (WebCore::DiagnosticLoggingKeys::applicationManifestKey): (WebCore::DiagnosticLoggingKeys::audioKey): (WebCore::DiagnosticLoggingKeys::backNavigationDeltaKey): (WebCore::DiagnosticLoggingKeys::canCacheKey): (WebCore::DiagnosticLoggingKeys::cacheControlNoStoreKey): (WebCore::DiagnosticLoggingKeys::cachedResourceRevalidationKey): (WebCore::DiagnosticLoggingKeys::cachedResourceRevalidationReasonKey): (WebCore::DiagnosticLoggingKeys::deniedByClientKey): (WebCore::DiagnosticLoggingKeys::deviceMotionKey): (WebCore::DiagnosticLoggingKeys::deviceOrientationKey): (WebCore::DiagnosticLoggingKeys::diskCacheKey): (WebCore::DiagnosticLoggingKeys::diskCacheAfterValidationKey): (WebCore::DiagnosticLoggingKeys::reloadKey): (WebCore::DiagnosticLoggingKeys::replaceKey): (WebCore::DiagnosticLoggingKeys::retrievalRequestKey): (WebCore::DiagnosticLoggingKeys::resourceLoadedKey): (WebCore::DiagnosticLoggingKeys::resourceResponseSourceKey): (WebCore::DiagnosticLoggingKeys::retrievalKey): (WebCore::DiagnosticLoggingKeys::revalidatingKey): (WebCore::DiagnosticLoggingKeys::reloadFromOriginKey): (WebCore::DiagnosticLoggingKeys::reloadRevalidatingExpiredKey): (WebCore::DiagnosticLoggingKeys::sameLoadKey): (WebCore::DiagnosticLoggingKeys::scriptKey): (WebCore::DiagnosticLoggingKeys::serviceWorkerKey): (WebCore::DiagnosticLoggingKeys::streamingMedia): (WebCore::DiagnosticLoggingKeys::styleSheetKey): (WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey): (WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey): (WebCore::DiagnosticLoggingKeys::svgDocumentKey): (WebCore::DiagnosticLoggingKeys::synchronousMessageFailedKey): (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey): (WebCore::DiagnosticLoggingKeys::timedOutKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::occurredKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::uncacheableStatusCodeKey): (WebCore::DiagnosticLoggingKeys::underMemoryPressureKey): (WebCore::DiagnosticLoggingKeys::unknownEntryRequestKey): (WebCore::DiagnosticLoggingKeys::unlikelyToReuseKey): (WebCore::DiagnosticLoggingKeys::unsupportedHTTPMethodKey): (WebCore::DiagnosticLoggingKeys::unsuspendableDOMObjectKey): (WebCore::DiagnosticLoggingKeys::unusedKey): (WebCore::DiagnosticLoggingKeys::unusedReasonCredentialSettingsKey): (WebCore::DiagnosticLoggingKeys::unusedReasonErrorKey): (WebCore::DiagnosticLoggingKeys::unusedReasonMustRevalidateNoValidatorKey): (WebCore::DiagnosticLoggingKeys::unusedReasonNoStoreKey): (WebCore::DiagnosticLoggingKeys::unusedReasonRedirectChainKey): (WebCore::DiagnosticLoggingKeys::unusedReasonReloadKey): (WebCore::DiagnosticLoggingKeys::unusedReasonTypeMismatchKey): (WebCore::DiagnosticLoggingKeys::usedKey): (WebCore::DiagnosticLoggingKeys::userZoomActionKey): (WebCore::DiagnosticLoggingKeys::varyingHeaderMismatchKey): (WebCore::DiagnosticLoggingKeys::videoKey): (WebCore::DiagnosticLoggingKeys::visibleNonActiveStateKey): (WebCore::DiagnosticLoggingKeys::visibleAndActiveStateKey): (WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithRevalidationKey): (WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithoutRevalidationKey): (WebCore::DiagnosticLoggingKeys::webViewKey): (WebCore::DiagnosticLoggingKeys::yesKey): (WebCore::DiagnosticLoggingKeys::expiredKey): (WebCore::DiagnosticLoggingKeys::fontKey): (WebCore::DiagnosticLoggingKeys::prunedDueToMemoryPressureKey): (WebCore::DiagnosticLoggingKeys::prunedDueToMaxSizeReached): (WebCore::DiagnosticLoggingKeys::prunedDueToProcessSuspended): (WebCore::WebCore::DiagnosticLoggingKeys::notHTTPFamilyKey): (WebCore::WebCore::DiagnosticLoggingKeys::webGLStateKey): (WebCore::DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey): * page/DisabledAdaptations.cpp: (WebCore::watchAdaptationName): * page/EventHandler.cpp: (WebCore::EventHandler::handlePasteGlobalSelection): (WebCore::convertDragOperationToDropZoneOperation): * page/EventSource.cpp: (WebCore::EventSource::EventSource): * page/History.cpp: (WebCore::History::stateObjectAdded): * page/NavigatorBase.cpp: (WebCore::NavigatorBase::appName): (WebCore::NavigatorBase::appCodeName): * page/Page.cpp: (WebCore::Page::logNavigation): * page/PageDebuggable.cpp: (WebCore::PageDebuggable::url const): * page/PageSerializer.cpp: (WebCore::PageSerializer::serializeCSSStyleSheet): * page/PerformanceMark.h: * page/PerformanceMeasure.h: * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::observe): * page/PerformanceResourceTiming.cpp: (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): * page/PerformanceUserTiming.cpp: (WebCore::restrictedMarkFunction): * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): * page/PrintContext.cpp: (WebCore::PrintContext::pageProperty): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::toString const): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::toString const): (WebCore::SecurityOriginData::databaseIdentifier const): * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::gcTimerString): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::reportViolation const): (WebCore::ContentSecurityPolicy::reportUnsupportedDirective const): * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::cpuUsageString): (WebCore::gcTimerString): * platform/ContentType.cpp: (WebCore::ContentType::codecsParameter): (WebCore::ContentType::profilesParameter): * platform/Decimal.cpp: (WebCore::Decimal::toString const): * platform/MIMETypeRegistry.cpp: (WebCore::initializeSupportedImageMIMETypes): (WebCore::typesForCommonExtension): (WebCore::initializeUnsupportedTextMIMETypes): (WebCore::MIMETypeRegistry::getNormalizedMIMEType): * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme): * platform/URL.cpp: (WebCore::mimeTypeFromDataURL): * platform/UserAgentQuirks.cpp: (WebCore::UserAgentQuirks::stringForQuirk): * platform/cocoa/KeyEventCocoa.mm: (WebCore::keyForCharCode): * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::unblockHandler const): * platform/cocoa/ParentalControlsContentFilter.mm: (WebCore::ParentalControlsContentFilter::unblockHandler const): * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::fileContentState): * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::MacApplication::isSafari): (WebCore::MacApplication::isAppleMail): (WebCore::MacApplication::isIBooks): (WebCore::MacApplication::isITunes): (WebCore::MacApplication::isMicrosoftMessenger): (WebCore::MacApplication::isAdobeInstaller): (WebCore::MacApplication::isAOLInstantMessenger): (WebCore::MacApplication::isMicrosoftMyDay): (WebCore::MacApplication::isMicrosoftOutlook): (WebCore::MacApplication::isQuickenEssentials): (WebCore::MacApplication::isAperture): (WebCore::MacApplication::isVersions): (WebCore::MacApplication::isHRBlock): (WebCore::MacApplication::isIAdProducer): (WebCore::MacApplication::isSolidStateNetworksDownloader): (WebCore::IOSApplication::isMobileMail): (WebCore::IOSApplication::isMobileSafari): (WebCore::IOSApplication::isWebBookmarksD): (WebCore::IOSApplication::isDumpRenderTree): (WebCore::IOSApplication::isMobileStore): (WebCore::IOSApplication::isSpringBoard): (WebCore::IOSApplication::isWebApp): (WebCore::IOSApplication::isIBooks): (WebCore::IOSApplication::isIBooksStorytime): (WebCore::IOSApplication::isTheSecretSocietyHiddenMystery): (WebCore::IOSApplication::isCardiogram): (WebCore::IOSApplication::isNike): * platform/cocoa/UserAgentCocoa.mm: (WebCore::userAgentBundleVersion): * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/graphics/InbandTextTrackPrivateClient.h: (WebCore::GenericCueData::toJSONString const): * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: (WebCore::CDMFactoryFairPlayStreaming::supportsKeySystem): * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::isEqual): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const): * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::generateKeyRequest): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::generateKeyRequest): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::propertyIdToString): * platform/graphics/ca/TileController.cpp: (WebCore::TileController::tileGridContainerLayerName): (WebCore::TileController::zoomedOutTileGridContainerLayerName): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::toDataURL const): (WebCore::dataURL): * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::VideoTextureCopierCV::initializeContextObjects): (WebCore::VideoTextureCopierCV::initializeUVContextObjects): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): * platform/graphics/iso/ISOVTTCue.cpp: (WebCore::ISOWebVTTCue::toJSONString const): * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded): * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::getUnmangledInfoLog): * platform/graphics/texmap/TextureMapperContextAttributes.cpp: (WebCore::TextureMapperContextAttributes::get): * platform/graphics/win/ImageBufferDirect2D.cpp: (WebCore::ImageBuffer::toDataURL const): (WebCore::ImageDataToDataURL): * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::typesForLegacyUnsafeBindings): * platform/gtk/PasteboardHelper.cpp: * platform/gtk/PlatformKeyboardEventGtk.cpp: (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): * platform/image-decoders/bmp/BMPImageDecoder.h: * platform/image-decoders/gif/GIFImageDecoder.h: * platform/image-decoders/ico/ICOImageDecoder.h: * platform/image-decoders/jpeg/JPEGImageDecoder.h: * platform/image-decoders/png/PNGImageDecoder.h: * platform/image-decoders/webp/WEBPImageDecoder.h: * platform/ios/Device.cpp: (WebCore::deviceName): * platform/ios/PasteboardIOS.mm: (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType): * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::keyForKeyEvent): (WebCore::codeForKeyEvent): * platform/ios/PlatformPasteboardIOS.mm: (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::read): (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::keyForKeyEvent): (WebCore::codeForKeyEvent): * platform/mac/PlatformPasteboardMac.mm: (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): * platform/mediastream/MediaConstraints.cpp: (WebCore::addDefaultVideoConstraints): * platform/mediastream/PeerMediaDescription.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::applyConstraints): * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp: (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): * platform/mock/MockRealtimeMediaSource.cpp: (WebCore::deviceMap): (WebCore::MockRealtimeMediaSource::audioDevices): (WebCore::MockRealtimeMediaSource::videoDevices): (WebCore::MockRealtimeMediaSource::displayDevices): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): * platform/network/BlobRegistryImpl.cpp: (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles): * platform/network/DataURLDecoder.cpp: (WebCore::DataURLDecoder::parseMediaType): * platform/network/FormData.cpp: (WebCore::FormData::appendMultiPartFileValue): * platform/network/HTTPParsers.cpp: (WebCore::parseHTTPRequestLine): (WebCore::parseHTTPHeader): (WebCore::normalizeHTTPMethod): * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::ResourceRequestBase): * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::handleDataURL): * platform/network/curl/SynchronousLoaderClientCurl.cpp: (WebCore::SynchronousLoaderClient::platformBadResponseError): * platform/network/win/DownloadBundleWin.cpp: (WebCore::DownloadBundle::fileExtension): * platform/sql/SQLiteDatabase.cpp: (WebCore::SQLiteDatabase::open): (WebCore::SQLiteDatabase::setFullsync): (WebCore::SQLiteDatabase::maximumSize): (WebCore::SQLiteDatabase::pageSize): (WebCore::SQLiteDatabase::freeSpaceSize): (WebCore::SQLiteDatabase::totalSize): (WebCore::SQLiteDatabase::clearAllTables): (WebCore::SQLiteDatabase::runVacuumCommand): (WebCore::SQLiteDatabase::runIncrementalVacuumCommand): (WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum): * platform/sql/SQLiteFileSystem.cpp: (WebCore::SQLiteFileSystem::deleteDatabaseFile): * platform/text/LocaleICU.cpp: (WebCore::LocaleICU::dateFormat): (WebCore::getFormatForSkeleton): * platform/text/LocaleNone.cpp: (WebCore::LocaleNone::dateFormat): (WebCore::LocaleNone::monthFormat): (WebCore::LocaleNone::shortMonthFormat): (WebCore::LocaleNone::timeFormat): (WebCore::LocaleNone::shortTimeFormat): (WebCore::LocaleNone::dateTimeFormatWithSeconds): (WebCore::LocaleNone::dateTimeFormatWithoutSeconds): * platform/text/LocaleToScriptMappingDefault.cpp: (WebCore::scriptNameToCode): (WebCore::localeToScriptCodeForFontSelection): * platform/text/TextEncodingRegistry.cpp: (WebCore::defaultTextEncodingNameForSystemLanguage): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::bundleName): * platform/wpe/RenderThemeWPE.cpp: (WebCore::RenderThemeWPE::mediaControlsStyleSheet): * rendering/RenderMenuList.cpp: (RenderMenuList::setText): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::extraDefaultStyleSheet): * svg/SVGComponentTransferFunctionElement.h: (WebCore::SVGPropertyTraits<ComponentTransferType>::toString): * svg/SVGFEColorMatrixElement.h: (WebCore::SVGPropertyTraits<ColorMatrixType>::toString): * svg/SVGFECompositeElement.h: (WebCore::SVGPropertyTraits<CompositeOperationType>::toString): * svg/SVGFEConvolveMatrixElement.h: (WebCore::SVGPropertyTraits<EdgeModeType>::toString): * svg/SVGFEDisplacementMapElement.h: (WebCore::SVGPropertyTraits<ChannelSelectorType>::toString): * svg/SVGFEMorphologyElement.h: (WebCore::SVGPropertyTraits<MorphologyOperatorType>::toString): * svg/SVGFETurbulenceElement.h: (WebCore::SVGPropertyTraits<SVGStitchOptions>::toString): (WebCore::SVGPropertyTraits<TurbulenceType>::toString): * svg/SVGGradientElement.h: (WebCore::SVGPropertyTraits<SVGSpreadMethodType>::toString): * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGMarkerTypes.h: (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): * svg/SVGMatrixValue.h: * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::SVGSVGElement): (WebCore::SVGSVGElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGPropertyTraits<SVGLengthAdjustType>::toString): * svg/SVGTextPathElement.h: (WebCore::SVGPropertyTraits<SVGTextPathMethodType>::toString): (WebCore::SVGPropertyTraits<SVGTextPathSpacingType>::toString): * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::appendCFFTable): * svg/SVGUnitTypes.h: (WebCore::SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::toString): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::toClipPath): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::filenameExtension const): * testing/InternalSettings.cpp: (WebCore::InternalSettings::userInterfaceDirectionPolicy): (WebCore::InternalSettings::systemLayoutDirection): * testing/Internals.cpp: (WebCore::Internals::areSVGAnimationsPaused const): (WebCore::Internals::accessKeyModifiers const): (WebCore::Internals::setMediaDeviceState): (WebCore::Internals::audioSessionCategory const): (WebCore::Internals::systemPreviewRelType): * testing/MockCDMFactory.cpp: (WebCore::MockCDM::sanitizeResponse const): (WebCore::MockCDMInstance::updateLicense): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::unblockRequestDeniedScript const): * testing/MockCredentialsMessenger.cpp: (WebCore::MockCredentialsMessenger::~MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::makeCredential): (WebCore::MockCredentialsMessenger::getAssertion): * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::showPaymentUI): * workers/WorkerRunLoop.cpp: (WebCore::WorkerRunLoop::debuggerMode): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): (WebCore::WorkerScriptLoader::createResourceRequest): (WebCore::WorkerScriptLoader::didReceiveData): * workers/service/ExtendableEvent.cpp: (WebCore::ExtendableEvent::waitUntil): * workers/service/FetchEvent.cpp: (WebCore::FetchEvent::~FetchEvent): (WebCore::FetchEvent::respondWith): (WebCore::FetchEvent::promiseIsSettled): * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::clearPendingJobs): * workers/service/ServiceWorker.cpp: (WebCore::ServiceWorker::postMessage): * workers/service/ServiceWorkerClients.cpp: (WebCore::ServiceWorkerClients::openWindow): (WebCore::ServiceWorkerClients::claim): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::getRegistration): (WebCore::ServiceWorkerContainer::startScriptFetchForJob): * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): (WebCore::ServiceWorkerJob::didReceiveResponse): * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::update): * workers/service/ServiceWorkerWindowClient.cpp: (WebCore::ServiceWorkerWindowClient::focus): (WebCore::ServiceWorkerWindowClient::navigate): * workers/service/context/ServiceWorkerDebuggable.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::doPushChanges): (WebCore::RegistrationDatabase::importRecords): * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::runRegisterJob): (WebCore::SWServerJobQueue::runUnregisterJob): (WebCore::SWServerJobQueue::runUpdateJob): * xml/XMLErrors.cpp: (WebCore::createXHTMLParserErrorHeader): (WebCore::XMLErrors::insertErrorMessageBlock): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): (WebCore::XMLHttpRequest::responseMIMEType const): * xml/XMLTreeViewer.cpp: (WebCore::XMLTreeViewer::transformDocumentToTreeView): * xml/XPathPredicate.cpp: (WebCore::XPath::evaluatePredicate): * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): * xml/parser/CharacterReferenceParserInlines.h: (WebCore::consumeCharacterReference): 2018-06-22 Youenn Fablet <youenn@apple.com> Disable WebSocket in WatchOS https://bugs.webkit.org/show_bug.cgi?id=186931 <rdar://problem/39584458> Reviewed by Wenson Hsieh. Add a runtime flag to enable/disable WebSocket. By default, flag is on for all platforms except for WatchOS. Test: fast/dom/Window/watchos/websocket/watchos/no-websocket-in-watchos.html * Modules/websockets/WebSocket.idl: * page/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebSocketEnabled): (WebCore::RuntimeEnabledFeatures::webSocketEnabled const): 2018-06-22 Woodrow Wang <woodrow_wang@apple.com> SubresourceLoader::didFail() should only log message if state is Initialized https://bugs.webkit.org/show_bug.cgi?id=185124 Reviewed by Daniel Bates. Functionality does not change. Moved console logging to be after checking state of subresource loader. We only need to log if the state is initialized. This is consistent with other functions in the file. We can also remove a null check for the frame pointer (m_frame). The superclass ResourceLoader constructor takes an lvalue reference and initializes m_frame, ensuring m_frame cannot be null. It is only set to null by ResourceLoader::releaseResources(), which is only called after the resource finishes loading or fails to load. Thus, in didFail(), m_frame must be non-null when we're logging and up until the end of the function. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFail): 2018-06-22 Timothy Hatcher <timothy@apple.com> Corner of two scroll bars is white with dark mode enabled. https://bugs.webkit.org/show_bug.cgi?id=186819 rdar://problem/40434350 Reviewed by Tim Horton. * Configurations/WebCore.xcconfig: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::paint): Added LocalDefaultSystemAppearance. * page/Page.h: * platform/ScrollView.cpp: (WebCore::ScrollView::paintScrollCorner): Dropped ScrollView argument. * platform/ScrollbarTheme.h: (WebCore::ScrollbarTheme::paintScrollCorner): Ditto. * platform/ScrollbarThemeComposite.cpp: (WebCore::ScrollbarThemeComposite::paintScrollCorner): Deleted. Default is the same. * platform/ScrollbarThemeComposite.h: * platform/mac/LocalDefaultSystemAppearance.h: * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Added recursion early return. (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto. * platform/mac/ScrollbarThemeMac.h: * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::paintScrollCorner): Added. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintScrollCorner): Call ScrollbarTheme::paintScrollCorner. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintContents): Added LocalDefaultSystemAppearance. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::paintContents): Added LocalDefaultSystemAppearance. * rendering/RenderScrollbarTheme.cpp: (WebCore::RenderScrollbarTheme::paintScrollCorner): Call ScrollbarTheme::paintScrollCorner. * rendering/RenderScrollbarTheme.h: * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::draw): Added LocalDefaultSystemAppearance. 2018-06-22 Tim Horton <timothy_horton@apple.com> Make it possible to add a border around loading or failed-to-load images https://bugs.webkit.org/show_bug.cgi?id=186614 <rdar://problem/39050152> Reviewed by Zalan Bujtas. Tests: http/tests/images/loading-image-border.html http/tests/images/loading-image-no-border.html * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIncompleteImageOutline): (WebCore::RenderImage::paintReplaced): * rendering/RenderImage.h: Factor the missing-image outline out, and - if desired - paint it in cases where the image is still loading or otherwise pending, not just when the image fails to load. * page/Settings.yaml: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setIncompleteImageBorderEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: Add and expose a setting to enable the feature. 2018-06-22 Brady Eidson <beidson@apple.com> WKURLSchemeHandler doesn't handle sync XHR. <rdar://problem/40955884> and https://bugs.webkit.org/show_bug.cgi?id=186902 Reviewed by Chris Dumez. * English.lproj/Localizable.strings: 2018-06-22 Jer Noble <jer.noble@apple.com> [Fullscreen] Restore ASSERT_NOT_REACHED() checks in exit fullscreen handler after r231924 https://bugs.webkit.org/show_bug.cgi?id=186945 <rdar://problem/37277469> Reviewed by Simon Fraser. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::exitFullscreen): (VideoFullscreenInterfaceAVKit::exitFullscreenHandler): (VideoFullscreenInterfaceAVKit::cleanupFullscreen): 2018-06-22 Per Arne Vollan <pvollan@apple.com> Unreviewed build fix on Windows. * testing/Internals.h: 2018-06-22 Youenn Fablet <youenn@apple.com> Incoming G722 doesn't work https://bugs.webkit.org/show_bug.cgi?id=186307 <rdar://problem/40809745> Reviewed by Eric Carlson. WebRTC backends usually does the following: - Initially call RealtimeIncomingAudioSource with 16KHz data - Switch to 48KHz when actual data is decoded. We added a check that was discarding any 16KHz data, but in case of G722, the data remains as 16KHz and is then never read. The solution is to remove the check that discards 16KHz information. We then need to fix a bug in AudioTrackPrivateMediaStreamCocoa that was preventing proper handling of change of audio data configuration. Test: webrtc/audio-peer-connection-g722.html * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable): * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: (WebCore::RealtimeIncomingAudioSourceCocoa::OnData): 2018-06-22 Timothy Hatcher <timothy@apple.com> Recalc styles every time defaultAppearance changes. https://bugs.webkit.org/show_bug.cgi?id=186866 rdar://problem/41309805 Reviewed by Tim Horton. * page/Page.cpp: (WebCore::Page::setUseSystemAppearance): Added. Recalc styles and update system colors. (WebCore::Page::setDefaultAppearance): Added. Ditto. * page/Page.h: (WebCore::Page::setUseSystemAppearance): Deleted impl. (WebCore::Page::setDefaultAppearance): Deleted impl. 2018-06-22 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Avoid sending SELECT_STREAM events when nothing changed https://bugs.webkit.org/show_bug.cgi?id=186678 Reviewed by Philippe Normand. This avoid extra work in decodebin3 and should work around a crash in decodebin3 when we send spurious SELECT_STREAM in the mediastream layout tests. GStreamer was also missing safe guards in the GstStream APIs which have been added in gstreamer core in 8833ca942ea21c58c0f63822f0e2b61695b39447 "stream: Add some missing API safe guards". Should fix following flakes: - fast/mediastream/MediaStream-video-element-track-stop.html - fast/mediastream/change-tracks-media-stream-being-played.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::enableTrack): 2018-06-22 Michael Catanzaro <mcatanzaro@igalia.com> REGRESSION(r230950): [GTK] WebKit::CoordinatedBackingStoreTile::setBackBuffer(): WebKitWebProcess killed by SIGSEGV (ASSERTION FAILED: it != m_tiles.end()) https://bugs.webkit.org/show_bug.cgi?id=186206 Unreviewed manual rollout of r230950 * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const): 2018-06-20 Darin Adler <darin@apple.com> [Cocoa] Use the isDirectory: variants of NSURL methods more to eliminate unnecessary file system activity https://bugs.webkit.org/show_bug.cgi?id=186875 Reviewed by Anders Carlsson. * platform/cocoa/ThemeCocoa.mm: (WebCore::passKitBundle): Use isDirectory:YES when creating a URL pointing to a framework, since frameworks are directories. 2018-06-22 Miguel Gomez <magomez@igalia.com> [WPE][ThreadedRendering] WPE crashes rendering SVG content when using ThreadedRendering https://bugs.webkit.org/show_bug.cgi?id=186914 Reviewed by Carlos Garcia Campos. Add GraphicsContextImpl::clipToImageBuffer() to the interface and the implementors. Forward the call to GraphicsContext::clipToImageBuffer() to the implementation if possible in the cairo case. Covered by existent tests. * platform/graphics/GraphicsContextImpl.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::clipToImageBuffer): * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::GraphicsContextImplCairo::clipToImageBuffer): * platform/graphics/cairo/GraphicsContextImplCairo.h: * platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::clipToImageBuffer): * platform/graphics/displaylists/DisplayListRecorder.h: * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: (Nicosia::CairoOperationRecorder::clipToImageBuffer): * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: 2018-06-22 Carlos Garcia Campos <cgarcia@igalia.com> [CMake] Generated sources depending on SelectorPseudoClassAndCompatibilityElementMap.in are not regenerated https://bugs.webkit.org/show_bug.cgi?id=186911 Reviewed by Michael Catanzaro. This is causing test fullscreen/fullscreen-env.html to fail since it was added in r233066 in the bots that didn't start a clean build. The problem is that the CMake command to generate SelectorPseudoClassAndCompatibilityElementMap.cpp doesn't depend on SelectorPseudoClassAndCompatibilityElementMap.in. * CMakeLists.txt: 2018-06-22 Miguel Gomez <magomez@igalia.com> [WPE][ThreadedRendering] WPE crashes rendering some pieces of text when using ThreadedRendering https://bugs.webkit.org/show_bug.cgi?id=186886 Reviewed by Žan Doberšek. Modify DisplayList DrawGlyphs element to use a GraphicsContext for replaying. To do so, modify GraphicsContext::drawGlyphs() API so it doesn't require a FontCascade, and update all the calls to it. Covered by existent tests. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::drawGlyphBuffer const): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawGlyphs): * platform/graphics/GraphicsContext.h: * platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::DrawGlyphs::apply const): * rendering/mathml/MathOperator.cpp: (WebCore::MathOperator::paintGlyph): (WebCore::MathOperator::paint): * rendering/mathml/RenderMathMLToken.cpp: (WebCore::RenderMathMLToken::paint): 2018-06-15 Jer Noble <jer.noble@apple.com> Address fullscreen api CSS env feedback https://bugs.webkit.org/show_bug.cgi?id=186684 Reviewed by Simon Fraser. Test: fullscreen/fullscreen-env.html + Update the phishing alert text to be more explicit about the specific threats phishing sites represent. + Make the top inset static, rather than dynamic. + Add bottom, left, and right insets for completeness. + Set the fullscreen animation duration as well as delay. + Notify the page when the controls show and hide. * English.lproj/Localizable.strings: * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * css/CSSSelector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne const): * css/SelectorCheckerTestFunctions.h: (WebCore::matchesFullScreenControlsHiddenPseudoClass): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): * dom/ConstantPropertyMap.cpp: (WebCore::ConstantPropertyMap::nameForProperty const): (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): (WebCore::ConstantPropertyMap::setFullscreenAutoHideDuration): (WebCore::ConstantPropertyMap::setFullscreenInsetTop): Deleted. * dom/ConstantPropertyMap.h: * dom/Document.cpp: (WebCore::Document::areFullscreenControlsHidden const): (WebCore::Document::setFullscreenControlsHidden): * dom/Document.h: * page/Page.cpp: (WebCore::Page::setFullscreenInsets): (WebCore::Page::setFullscreenAutoHideDuration): (WebCore::Page::setFullscreenControlsHidden): (WebCore::Page::setFullscreenInsetTop): Deleted. * page/Page.h: (WebCore::Page::fullscreenInsets const): * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setFullscreenInsets): (WebCore::Internals::setFullscreenAutoHideDuration): (WebCore::Internals::setFullscreenControlsHidden): (WebCore::Internals::setFullscreenInsetTop): Deleted. * testing/Internals.h: * testing/Internals.idl: 2018-06-21 Jer Noble <jer.noble@apple.com> [Fullscreen] Page sometimes ends up with an incorrect zoom level after entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=186822 Reviewed by Simon Fraser. * dom/Document.cpp: (WebCore::Document::setOverrideViewportArguments): (WebCore::Document::updateViewportArguments): * dom/Document.h: 2018-06-20 Said Abou-Hallawa <sabouhallawa@apple.com> RenderSVGInline has to be inline always regardless of its css display value https://bugs.webkit.org/show_bug.cgi?id=186656 Reviewed by Zalan Bujtas. According to https://www.w3.org/TR/SVG2/text.html#TextLayout, the <text> element has to be laid out as if it were a block element and any <tspan>, <textPath>, <a> and <tref> descendants were inline elements. If a css rule, which contains the property "display: block;", is applied to any of children of a <text> element, this property has to be ignored. We currently ignore this property in RenderSVGInline::updateFromStyle() by forcing setInline(true). But we do not do the same thing in RenderTreeBuilder::normalizeTreeAfterStyleChange(). In fact we allow making the children of the <text> element to be non-inline. This puts the render tree in weired state and causes many assertions to fire while laying out RenderSVGText. Test: svg/dom/svg-inline-text-display-block-crash.html * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange): 2018-06-20 Zalan Bujtas <zalan@apple.com> Do not reuse generated inline renderer for the first letter. https://bugs.webkit.org/show_bug.cgi?id=186657 <rdar://problem/41157892> Reviewed by Simon Fraser. When the first letter pseudo element is present, we construct a dedicated subtree for its content like this: <div><span>foobar</span></div> -> with ::first-letter on the <div> DIV RenderBlock SPAN RenderInline RenderInline (generated wrapper for the first letter content) RenderText (fist letter content) RenderText (remaining text content) "display: contents" on the <span> forces us not to construct a RenderInline for the <span> (or just come up with a wrapper at best). FirstLetter::createRenderers logic needs to check for such cases and pick the correct parent for the first letter subtree accordingly. Test: fast/text/first-letter-with-display-contents-crash.html imported/w3c/web-platform-tests/css/css-display/display-contents-first-letter-002.html is not crashing anymore either. * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): 2018-06-21 Chris Dumez <cdumez@apple.com> JSPerformanceObserverCallback creates a GC strongly-referenced Function that is never cleaned up https://bugs.webkit.org/show_bug.cgi?id=186873 <rdar://problem/41271574> Reviewed by Simon Fraser. Add [IsWeakCallback] to PerformanceObserverCallback interface so that the generated JSPerformanceObserverCallback uses a JSC::Weak instead of a JSC::Strong to store the js function. To keep the function alive, add [JSCustomMarkFunction] to PerformanceObserver interface and have its visitAdditionalChildren() visit the callback's js function. Finally, because we want the callback to still be called even if the JS does not keep the PerformanceObserver wrapper alive, add [CustomIsReachable] to PerformanceObserver interface and have its isReachableFromOpaqueRoots() return true if the observer is registered (i.e. it may need to call the callback in the future). I have confirmed locally, that the Performance / PerformanceObserver / Document objects properly get destroyed if I navigate away from a page that had a performance observer and trigger a memory pressure warning. Also, `notifyutil -p com.apple.WebKit.showAllDocuments` no longer shows the old document. Tests: performance-api/performance-observer-callback-after-gc.html performance-api/performance-observer-no-document-leak.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSPerformanceObserverCustom.cpp: Added. (WebCore::JSPerformanceObserver::visitAdditionalChildren): (WebCore::JSPerformanceObserverOwner::isReachableFromOpaqueRoots): * bindings/js/ScriptController.cpp: * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::disassociate): * page/PerformanceObserver.h: (WebCore::PerformanceObserver::isRegistered const): (WebCore::PerformanceObserver::callback): * page/PerformanceObserver.idl: * page/PerformanceObserverCallback.h: * page/PerformanceObserverCallback.idl: 2018-06-20 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-animations/test_animation-ready.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183830 <rdar://problem/40997539> Reviewed by Dean Jackson. The CSS Animations Level 2 spec explains how the Web Animations API and CSS Animations interact and requires pending styles changes on the target element of a CSS Animation to be flushed when using a Web Animations API on it in order to ensure that any animation- CSS property is accounted for. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::bindingsStartTime const): (WebCore::CSSAnimation::setBindingsStartTime): (WebCore::CSSAnimation::bindingsCurrentTime const): (WebCore::CSSAnimation::setBindingsCurrentTime): (WebCore::CSSAnimation::bindingsPlayState const): (WebCore::CSSAnimation::bindingsPending const): (WebCore::CSSAnimation::bindingsReady): (WebCore::CSSAnimation::bindingsFinished): (WebCore::CSSAnimation::bindingsPlay): (WebCore::CSSAnimation::bindingsPause): (WebCore::CSSAnimation::flushPendingStyleChanges const): * animation/CSSAnimation.h: * animation/WebAnimation.h: (WebCore::WebAnimation::bindingsPlayState const): (WebCore::WebAnimation::bindingsPending const): (WebCore::WebAnimation::bindingsReady): (WebCore::WebAnimation::bindingsFinished): (WebCore::WebAnimation::bindingsPlay): (WebCore::WebAnimation::bindingsPause): * animation/WebAnimation.idl: 2018-06-21 Jer Noble <jer.noble@apple.com> [Fullscreen] Suspend page (and pause video) while phishing warning is presented https://bugs.webkit.org/show_bug.cgi?id=186856 <rdar://problem/41212444> Reviewed by Tim Horton. Pause the media element when the page is suspended, and unpause when the page resumes. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): (WebCore::HTMLMediaElement::suspend): (WebCore::HTMLMediaElement::resume): * html/HTMLMediaElement.h: 2018-06-21 Michael Catanzaro <mcatanzaro@igalia.com> Bad optional access in WebCore::ContentSecurityPolicySource::portMatches https://bugs.webkit.org/show_bug.cgi?id=186535 Reviewed by Daniel Bates. Make sure the ports have explicit values before dereferencing them. This is hard to test. If the layout test script-src-parsing-implicit-and-explicit-port-number continues to pass for WebKitLegacy, then I have at least probably not broken anything. To reproduce the crash in a layout test that I can run, I think I would need to implement internals.registerDefaultPortForProtocol for modern WebKit, which is too much work for this crash. Otherwise, we'd need to run the test server on port 80, which would be unfriendly. * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::portMatches const): 2018-06-21 Fujii Hironori <Hironori.Fujii@sony.com> [GStreamer] ASSERTION FAILED: end.isValid() in PlatformTimeRanges::add https://bugs.webkit.org/show_bug.cgi?id=186880 Reviewed by Xabier Rodriguez-Calvar. Bug 180253 has added assertions the arugments `start` and `end` is valid MediaTime in PlatformTimeRanges::add. Since then, some LayoutTests fail due to the assertion failure. The invalid MediaTime is added into the PlatformTimeRanges in MediaPlayerPrivateGStreamer::buffered. Before adding MediaTime, original implementation checks MediaTime::operator bool() returns true. But, this method returns true if the time value is invalid. Then, PlatformTimeRanges::add is called with an invalid MediaTime. No new tests (No behavior change). * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::buffered const): Check maxTimeLoaded() is valid before adding to `timeRanges`. 2018-06-20 David Kilzer <ddkilzer@apple.com> Fix leaks in WebCore found by clang static analyzer in deep mode <https://webkit.org/b/186865> Reviewed by Joseph Pecoraro. * platform/mac/WebCoreNSURLExtras.mm: (WebCore::mapHostNames): Fix leak of an empty NSMutableArray during an early return. RetainPtr<> is not used here since a pointer to the NSMutableArray * is passed around. * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Fix leak of a CGDisplayModeRef during an early return. 2018-06-20 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the watchOS build after r233016. * page/EventHandler.cpp: (WebCore::EventHandler::selectionExtentRespectingEditingBoundary): Move this helper out of the ENABLE(DRAG_SUPPORT) guard. * page/EventHandler.h: 2018-06-20 Simon Fraser <simon.fraser@apple.com> AnimationList wastes 60KB of vector capacity https://bugs.webkit.org/show_bug.cgi?id=186701 Reviewed by Chris Dumez. AnimationList was the second most wasteful call site for Vector capacity on theverge.com, wasting almost 60KB. Lists had between 1 and 3 entries, so give AnimationList's vector of Animations a min capacity of zero so it doesn't grow in increments of 16. Also shrink Animation from 88 bytes to 72 bytes by optimizing packing. * platform/animation/Animation.cpp: (WebCore::Animation::Animation): (WebCore::Animation::operator=): (WebCore::Animation::animationsMatch const): * platform/animation/Animation.h: (WebCore::Animation::animationMode const): (WebCore::Animation::setAnimationMode): * platform/animation/AnimationList.h: 2018-06-20 Simon Fraser <simon.fraser@apple.com> ContentSecurityPolicySourceList wastes 51KB of Vector capacity on cnn.com https://bugs.webkit.org/show_bug.cgi?id=186706 Reviewed by Chris Dumez. Make ContentSecurityPolicySourceList::parse() call shrinkToFit() on m_list after parsing to eliminate wasted vector capacity. Shrink ContentSecurityPolicySource down to 40 bytes by optimizing packing. * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource): * page/csp/ContentSecurityPolicySource.h: * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::matches const): (WebCore::ContentSecurityPolicySourceList::parse): (WebCore::ContentSecurityPolicySourceList::matches): Deleted. * page/csp/ContentSecurityPolicySourceList.h: 2018-06-20 Megan Gardner <megan_gardner@apple.com> Restrict Selection in contenteditable the extent of that contenteditable https://bugs.webkit.org/show_bug.cgi?id=186792 Reviewed by Wenson Hsieh. My system currently will not allow me to run tests. I will add one when I can update. Expose the already existing funcitonality to restrict a selection to a single contentenditable * page/EventHandler.cpp: (WebCore::EventHandler::selectionExtentRespectingEditingBoundary): (WebCore::selectionExtentRespectingEditingBoundary): Deleted. * page/EventHandler.h: * rendering/HitTestResult.h: 2018-06-20 Simon Fraser <simon.fraser@apple.com> CSSFontFace wastes 59KB of Vector capacity on nytimes.com https://bugs.webkit.org/show_bug.cgi?id=186708 Reviewed by Anders Carlsson. Most CSSFontFace have one or two CSSFontFaceSource so don't allocate vector capacity in the default 16-size chunks. * css/CSSFontFace.h: 2018-06-20 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-transitions/test_element-get-animations.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183841 <rdar://problem/40998101> Reviewed by Dean Jackson. We must ignore CSS Animations with "animation-name: none". * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSAnimationsForElement): 2018-06-20 Miguel Gomez <magomez@igalia.com> [GTK][ThreadedRendering][Nicosia] Themed elements cannot be rendered using threaded rendering https://bugs.webkit.org/show_bug.cgi?id=186840 Reviewed by Carlos Garcia Campos. Disable threaded rendering for GTK port. * platform/graphics/nicosia/NicosiaPaintingEngine.cpp: (Nicosia::PaintingEngine::create): 2018-06-20 Yusuke Suzuki <utatane.tea@gmail.com> [GTK][WPE][Nicosia] Add name for Nicosia Painting Threads https://bugs.webkit.org/show_bug.cgi?id=186836 Reviewed by Carlos Garcia Campos. Use "PaintingThread" name. * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded): 2018-06-19 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-animations/test_pseudoElement-get-animations.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183818 <rdar://problem/40997015> Reviewed by Dean Jackson. We add a new opt-in flag to return sorted animations when calling AnimationTimeline::animationsForElement() so that Element::getAnimations() can opt into returning animations sorted by the rules defined by the CSS Transitions spec. The rule is that CSS Transitions must be sorted prior to CSS Animations and regular Web Animations, and then sorted by the time they were generated and, if generated at the same time, sorted alphabetically based on the transitioned property. To be able to accomodate this, we add a new generationTime() method to CSSTransition. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationsForElement const): (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/AnimationTimeline.h: * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): (WebCore::CSSTransition::CSSTransition): * animation/CSSTransition.h: * dom/Element.cpp: (WebCore::Element::getAnimations): 2018-06-19 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Allow passing contents of Root CA data directly. https://bugs.webkit.org/show_bug.cgi?id=185782 Currently the data must be in a file and set by its path. This patch allow application to set root CA data by passing binary data directly. Reviewed by Yusuke Suzuki. No new tests. Tested internally. * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupTransfer): * platform/network/curl/CurlSSLHandle.cpp: (WebCore::CurlSSLHandle::CurlSSLHandle): (WebCore::CurlSSLHandle::getCACertPathEnv): (WebCore::CurlSSLHandle::setCACertPath): (WebCore::CurlSSLHandle::setCACertData): (WebCore::CurlSSLHandle::clearCACertInfo): * platform/network/curl/CurlSSLHandle.h: (WebCore::CurlSSLHandle::getCipherList const): (WebCore::CurlSSLHandle::getSignatureAlgorithmsList const): (WebCore::CurlSSLHandle::getCurvesList const): (WebCore::CurlSSLHandle::setCipherList): (WebCore::CurlSSLHandle::setSignatureAlgorithmsList): (WebCore::CurlSSLHandle::setCurvesList): (WebCore::CurlSSLHandle::setIgnoreSSLErrors): (WebCore::CurlSSLHandle::getCACertInfo const): (WebCore::CurlSSLHandle::getCACertPath const): Deleted. (WebCore::CurlSSLHandle::setCACertPath): Deleted. * platform/network/curl/CurlSSLVerifier.cpp: (WebCore::CurlSSLVerifier::CurlSSLVerifier): 2018-06-19 Dean Jackson <dino@apple.com> ARKit badge drop shadow updates its blur radius based on page zoom https://bugs.webkit.org/show_bug.cgi?id=186829 <rdar://problem/40738779> Reviewed by Tim Horton. We need to make sure the shadow blur radius takes into account the current zoom. Thankfully, the GraphicsContext platform code already does this, so just use it. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintSystemPreviewBadge): 2018-06-19 Dean Jackson <dino@apple.com> Blank viewer comes up and then auto-dismisses when device is not connected to Internet https://bugs.webkit.org/show_bug.cgi?id=186825 <rdar://problem/40294170> Reviewed by Tim Horton. Export isSuccessful() to WebKit. * platform/network/ResourceResponseBase.h: 2018-06-19 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Enable Proxy Authentication. https://bugs.webkit.org/show_bug.cgi?id=185266 Add support for Proxy Authentication to curl network layer. Reviewed by Alex Christensen. No new tests in public. Tested internally. * platform/network/curl/AuthenticationChallenge.h: * platform/network/curl/AuthenticationChallengeCurl.cpp: (WebCore::AuthenticationChallenge::protectionSpaceServerTypeFromURI): (WebCore::AuthenticationChallenge::protectionSpaceFromHandle): (WebCore::AuthenticationChallenge::determineProxyPort): (WebCore::AuthenticationChallenge::authenticationSchemeFromCurlAuth): (WebCore::AuthenticationChallenge::parseRealm): * platform/network/curl/CurlContext.cpp: (WebCore::CurlHandle::enableProxyIfExists): (WebCore::CurlHandle::getProxyUrl): (WebCore::CurlHandle::getProxyAuthAvail): (WebCore::CurlHandle::getPrimaryPort): Deleted. * platform/network/curl/CurlContext.h: (WebCore::CurlContext::setDefaultProxyAuthMethod): (WebCore::CurlContext::setProxyAuthMethod): * platform/network/curl/CurlProxySettings.cpp: (WebCore::determineAuthMethod): (WebCore::CurlProxySettings::setAuthMethod): (WebCore::protocolIsInSocksFamily): * platform/network/curl/CurlProxySettings.h: (WebCore::CurlProxySettings::setDefaultAuthMethod): (WebCore::CurlProxySettings::authMethod const): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::didReceiveHeader): * platform/network/curl/CurlResponse.h: (WebCore::CurlResponse::isolatedCopy const): * platform/network/curl/ResourceResponse.h: * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::isProxyAuthenticationRequired const): 2018-06-19 Tim Horton <timothy_horton@apple.com> Unpainted area while scrolling in Reader is white https://bugs.webkit.org/show_bug.cgi?id=186541 <rdar://problem/40471363> Reviewed by Timothy Hatcher. New test: tiled-drawing/simple-document-with-dynamic-background-color.html For platforms that do not use the overhang layer, we depend on RenderView's background color to fill unpainted space. RenderView's background color is only updated inside updateRootLayerConfiguration, and it is possible with a simple enough page to change the document's background color without running that code. * page/FrameView.cpp: (WebCore::FrameView::setTransparent): (WebCore::FrameView::setBaseBackgroundColor): Make use of the newly added rootBackgroundColorOrTransparencyChanged. (WebCore::FrameView::calculateExtendedBackgroundMode const): Update a comment, since the function it mentioned is no longer. (WebCore::FrameView::updateTilesForExtendedBackgroundMode): Remove this code that clears the root extended background color if using tiles to extend in both directions. Two reasons: 1) it seems harmless to also have a root extended background color 2) this just gets clobbered by the call in RenderView::paintBoxDecorations * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): Add a bit that will do a updateConfiguration() on the root layer if no other work needs to be done, so that we can update the root layer's transparency or background color without doing a full layer rebuild. (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged): Make use of the newly added rootBackgroundColorOrTransparencyChanged. (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged): Change rootBackgroundTransparencyChanged to also cover color changes. Fold setRootExtendedBackgroundColor in here, and make use of setRootLayerConfigurationNeedsUpdate() instead of doing a full rebuild. Previously, we would bail if the transparency state hadn't changed; now, we'll also update the root layer's background color and the exposed-to-WebKit extended background color if they change too. (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Deleted. (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor): Deleted. * rendering/RenderLayerCompositor.h: Add setRootLayerConfigurationNeedsUpdate, remove setRootExtendedBackgroundColor, and add both a bit indicating that the root layer configuration needs updating and the cached view background color to make the early return in rootBackgroundColorOrTransparencyChanged possible. * rendering/RenderView.cpp: (WebCore::RenderView::paintBoxDecorations): Make use of the newly added rootBackgroundColorOrTransparencyChanged. 2018-06-19 Youenn Fablet <youenn@apple.com> Need to properly handle removal of worker in SWServer::unregisterServiceWorkerClient timer lambda https://bugs.webkit.org/show_bug.cgi?id=186674 <rdar://problem/40974812> Reviewed by Chris Dumez. While looping over the running workers map and trying to terminate some of the workers, there is a chance that the map will be modified synchronously which may affect iterating the map. This patch removes that potential threat. * workers/service/server/SWServer.cpp: (WebCore::SWServer::unregisterServiceWorkerClient): 2018-06-19 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-animations/test_animation-playstate.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183828 <rdar://problem/40997469> Reviewed by Dean Jackson. We need to ensure pending styles have been resolved prior to returning the play state for a CSS Animation since it can be controlled by the animation-play-state CSS property. To that end we expose a specific bindings-only method which we override for CSSAnimation to force a style update. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::bindingsPlayState const): * animation/CSSAnimation.h: * animation/WebAnimation.h: (WebCore::WebAnimation::bindingsPlayState const): * animation/WebAnimation.idl: 2018-06-19 David Kilzer <ddkilzer@apple.com> Revert: Add logging when splashboardd enables WebThread <https://webkit.org/b/186793> <rdar://problem/41213255> Turns out this isn't needed, so reverting r232959. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isSplashBoardd): Deleted. * platform/ios/wak/WebCoreThread.mm: (WebThreadEnable): 2018-06-19 Wenson Hsieh <wenson_hsieh@apple.com> [WebKit on watchOS] Vend username text content type when using scribble in login fields https://bugs.webkit.org/show_bug.cgi?id=186791 <rdar://problem/41226935> Reviewed by Beth Dakin. Expose AutofillElements' autofillable username input element. See WebKit ChangeLog for more details. * editing/ios/AutofillElements.h: (WebCore::AutofillElements::username const): 2018-06-19 Chris Dumez <cdumez@apple.com> WebCoreNSURLSessionDataTaskClient::redirectReceived() calls WebCore on non-main thread https://bugs.webkit.org/show_bug.cgi?id=186805 <rdar://problem/36960714> Reviewed by Youenn Fablet. Make sure WebCoreNSURLSessionDataTaskClient::redirectReceived() dispatches to the main thread before calling its completion handler. Otherwise, we end up calling into WebCore on a NSOperationQueue background thread and we crash. * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): 2018-06-19 Chris Dumez <cdumez@apple.com> HTTPHeaderMap wastes 226KB of HashTable capacity on cnn.com https://bugs.webkit.org/show_bug.cgi?id=186735 <rdar://problem/41189164> Reviewed by Geoffrey Garen. Resource requests and responses normally do not have a large amount of HTTP headers (local testing shows 6 common headers on average and 0.3 uncommon ones). As a result, move the internal representation of HTTPHeaderMap from HashMaps to Vectors. Given the number of headers, the impact on performance should be negligible. However, the new implementation uses a lot less memory. In a follow-up, we can save even more memory by calling HTTPHeaderMap::shrinkToFit() when possible. * loader/CrossOriginAccessControl.cpp: (WebCore::createAccessControlPreflightRequest): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::canReuse const): * platform/network/HTTPHeaderMap.cpp: (WebCore::HTTPHeaderMap::isolatedCopy const): (WebCore::HTTPHeaderMap::get const): (WebCore::HTTPHeaderMap::set): (WebCore::HTTPHeaderMap::add): (WebCore::HTTPHeaderMap::append): (WebCore::HTTPHeaderMap::addIfNotPresent): (WebCore::HTTPHeaderMap::contains const): (WebCore::HTTPHeaderMap::remove): * platform/network/HTTPHeaderMap.h: (WebCore::HTTPHeaderMap::CommonHeader::isolatedCopy const): (WebCore::HTTPHeaderMap::CommonHeader::operator== const): (WebCore::HTTPHeaderMap::UncommonHeader::isolatedCopy const): (WebCore::HTTPHeaderMap::UncommonHeader::operator== const): (WebCore::HTTPHeaderMap::HTTPHeaderMapConstIterator::HTTPHeaderMapConstIterator): (WebCore::HTTPHeaderMap::HTTPHeaderMapConstIterator::updateKeyValue): (WebCore::HTTPHeaderMap::shrinkToFit): (WebCore::HTTPHeaderMap::commonHeaders const): (WebCore::HTTPHeaderMap::uncommonHeaders const): (WebCore::HTTPHeaderMap::commonHeaders): (WebCore::HTTPHeaderMap::uncommonHeaders): (WebCore::HTTPHeaderMap::CommonHeader::encode const): (WebCore::HTTPHeaderMap::CommonHeader::decode): (WebCore::HTTPHeaderMap::UncommonHeader::encode const): (WebCore::HTTPHeaderMap::UncommonHeader::decode): (WebCore::HTTPHeaderMap::encode const): (WebCore::HTTPHeaderMap::decode): * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::filter): (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields): 2018-06-19 Youenn Fablet <youenn@apple.com> Network Preflights do not show in WebInspector after moving CORS checks to NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=186312 <rdar://problem/40495434> Reviewed by Chris Dumez. Test: http/wpt/fetch/inspect-preflight.html No change of behavior in regular conditions. All intermediate requests/responses are now buffered in NetworkProcess if Web inspector shows up. Add NetworkLoadInformation and NetworkIntermediateLoadInformation for that purpose. Add a new LoaderStrategy method to grab this information from NetworkProcess synchronously. Add Internals API for testing the storage by the Network Process and the sending to WebProcess. * WebCore.xcodeproj/project.pbxproj: * loader/LoaderStrategy.cpp: (WebCore::LoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier): * loader/LoaderStrategy.h: * platform/network/NetworkLoadInformation.h: Added. (WebCore::NetworkTransactionInformation::encode const): (WebCore::NetworkTransactionInformation::decode): * testing/Internals.cpp: (WebCore::Internals::setCaptureExtraNetworkLoadMetricsEnabled): (WebCore::Internals::ongoingLoadDescriptions): * testing/Internals.h: * testing/Internals.idl: 2018-06-19 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-transitions/test_animation-cancel.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183821 <rdar://problem/40997034> Reviewed by Dean Jackson. If an element gets a "display: none" style RenderTreeUpdater::tearDownRenderers() will be called with a RendererUpdateCancelingAnimations teardown type on all of its children. We need to ensure all declarative animations, and only those since regular Web Animations should be kept active regardless of their target's style, are canceled in this situation. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement): * animation/AnimationTimeline.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2018-06-19 David Kilzer <ddkilzer@apple.com> Add logging when splashboardd enables WebThread <https://webkit.org/b/186793> <rdar://problem/41213255> Reviewed by Daniel Bates. * platform/RuntimeApplicationChecks.h: (WebCore::IOSApplication::isSplashBoardd): Add declaration. * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isSplashBoardd): Add implementation. * platform/ios/wak/WebCoreThread.mm: (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by splashboardd. 2018-06-19 Miguel Gomez <magomez@igalia.com> [GTK][WPE][Nicosia] Add environment variable to enable threaded rendering and set the number of painting threads https://bugs.webkit.org/show_bug.cgi?id=186801 Reviewed by Carlos Garcia Campos. Add and environment variable to enable the usage of the threaded renderer and define the number of painting threads. No new tests. * platform/graphics/nicosia/NicosiaPaintingEngine.cpp: (Nicosia::PaintingEngine::create): * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded): * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h: 2018-06-19 Youenn Fablet <youenn@apple.com> RTCRtpSender.replaceTrack(null) ends current track https://bugs.webkit.org/show_bug.cgi?id=184911 <rdar://problem/40758138> Reviewed by Eric Carlson. Before the patch, when replacing the sender track by null, the previous track was stopped. Instead of doing that, the track now stays alive and it is the realtime source that is stopped. This ensures that the data is no longer sent while the track can still be used elsewhere. Covered by updated and rebased tests. * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::addTransceiver): (WebCore::RTCPeerConnection::enqueueReplaceTrackTask): (WebCore::RTCPeerConnection::replaceTrack): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::replaceTrack): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::updateTrackSource): (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: 2018-06-18 Chris Dumez <cdumez@apple.com> Better pack ResourceRequest https://bugs.webkit.org/show_bug.cgi?id=186717 Reviewed by Darin Adler. Better pack ResourceRequest to reduce its size from 240 to 232 bytes on Mac. * platform/network/ResourceRequestBase.h: 2018-06-18 Antoine Quint <graouts@apple.com> [Web Animations] Implement "Starting of transitions" section from CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186517 <rdar://problem/41000798> Reviewed by Dean Jackson. We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions. To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID) and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID). * animation/AnimationTimeline.cpp: (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID). (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement(). We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate(). (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition in an AnimationList that matches the value used in a given RenderStyle. (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility. (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting a shorthand for which this property is a longhand, or targeting "all". (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps as they appear in the spec. (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement(). * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style, as well as a reversing-shortening factor. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(), we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition. (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create(). (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect. (WebCore::CSSTransition::initialize): Deleted. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set for CSSAnimation. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false. (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto". (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * page/animation/CSSPropertyAnimation.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their shared call site. 2018-06-18 Nan Wang <n_wang@apple.com> AX: [macOS] When zoom is enabled, focus doesn't follow text cursor https://bugs.webkit.org/show_bug.cgi?id=186697 Reviewed by Darin Adler. Now that web process doesn't have access to NSScreen. The conversion of the rects is wrong. Fixed this by using the right function that's available in WebCore to get the rects. * editing/mac/FrameSelectionMac.mm: (WebCore::accessibilityConvertScreenRect): 2018-06-18 Youenn Fablet <youenn@apple.com> Expose RTCPeerConnectionIceEventInit constructor https://bugs.webkit.org/show_bug.cgi?id=186770 Reviewed by Alex Christensen. Add event constructor as per specification. Add support for the url attribute. For that purpose, we need to pipe that information from LibWebRTCMediaEndpoint up to RTCPeerConnectionIceEvent. Covered by rebased test. * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::fireICECandidateEvent): (WebCore::PeerConnectionBackend::disableICECandidateFiltering): (WebCore::PeerConnectionBackend::newICECandidate): (WebCore::PeerConnectionBackend::doneGatheringCandidates): (WebCore::PeerConnectionBackend::finishedRegisteringMDNSName): * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCPeerConnectionIceEvent.cpp: (WebCore::RTCPeerConnectionIceEvent::create): (WebCore::RTCPeerConnectionIceEvent::RTCPeerConnectionIceEvent): * Modules/mediastream/RTCPeerConnectionIceEvent.h: (WebCore::RTCPeerConnectionIceEvent::url const): * Modules/mediastream/RTCPeerConnectionIceEvent.idl: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate): * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.in: 2018-06-18 Simon Fraser <simon.fraser@apple.com> SVGTransformListValues wastes 127KB of Vector capacity on nytimes.com https://bugs.webkit.org/show_bug.cgi?id=186704 Reviewed by Said Abou-Hallawa. SVGTransformListValues has inline capacity 1, and every SVGGraphicsElement has a SVGSynchronizableAnimatedProperty<WebCore::SVGTransformListValues>, so the inline capacity wastes space for every SVGGraphicsElement that doesn't have a transform (i.e. most of them). So make SVGTransformListValues have zero inline capacity, and set its min capacity to 2, rather than the default 16, since most transform lists are short. * svg/SVGTransformListValues.h: 2018-06-18 Said Abou-Hallawa <sabouhallawa@apple.com> Document should not be mutated under SMILTimeContainer::updateAnimations() https://bugs.webkit.org/show_bug.cgi?id=186658 Reviewed by Simon Fraser. To update the animation of an SVG <animate> element, we call SVGAnimateElementBase::resetAnimatedType(). It ensures the pointer m_animator is valid. If it animates a css property, it calls computeCSSPropertyValue() which calls resolveStyle() via other calls. resolveStyle() may call delayed callbacks through the destructor of PostResolutionCallbackDisabler. These callbacks may fire events. These events may execute JS event handlers. If one of these event handlers deletes the same SVG <animate> we animate, we will end up calling SVGAnimateElementBase::resetAnimatedPropertyType() of the same <animate> element. This function will delete the same m_animator which resetAnimatedType() still holds and will use later. This code re-entrance is unexpected and unwanted. The fix is to disable mutating the DOM while updating the SVG animations. Test: svg/dom/css-animate-input-foucs-crash.html * svg/animation/SMILTimeContainer.cpp: (WebCore::SMILTimeContainer::updateAnimations): 2018-06-18 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r232935. https://bugs.webkit.org/show_bug.cgi?id=186783 This patch broke macOS 32-bit build (Requested by n_wang on #webkit). Reverted changeset: "AX: [macOS] When zoom is enabled, focus doesn't follow text cursor" https://bugs.webkit.org/show_bug.cgi?id=186697 https://trac.webkit.org/changeset/232935 2018-06-18 Nan Wang <n_wang@apple.com> AX: [macOS] When zoom is enabled, focus doesn't follow text cursor https://bugs.webkit.org/show_bug.cgi?id=186697 Reviewed by Darin Adler. Now that web process doesn't have access to NSScreen. The conversion of the rects is wrong. Fixed this by using the right function that's available in WebCore to convert the rects. * editing/mac/FrameSelectionMac.mm: (WebCore::accessibilityConvertScreenRect): 2018-06-18 Youenn Fablet <youenn@apple.com> Validate Cross-Origin-Resource-Policy for resources cached in the MemoryCache https://bugs.webkit.org/show_bug.cgi?id=186639 <rdar://problem/41106984> Reviewed by Geoffrey Garen. Add a method to check CORP. Make use of it to validate any memory cached resource. Whitelist CORP header so that it is not filtered out by Network Process. Test: http/wpt/cross-origin-resource-policy/image-in-iframe-loads.html * loader/CrossOriginAccessControl.cpp: (WebCore::shouldCrossOriginResourcePolicyCancelLoad): (WebCore::validateCrossOriginResourcePolicy): * loader/CrossOriginAccessControl.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestResource): * platform/network/ResourceResponseBase.cpp: (WebCore::isSafeRedirectionResponseHeader): (WebCore::isSafeCrossOriginResponseHeader): 2018-06-18 Carlos Alberto Lopez Perez <clopez@igalia.com> [WTF] Remove workarounds needed to support libstdc++-4 https://bugs.webkit.org/show_bug.cgi?id=186762 Reviewed by Michael Catanzaro. Revert r226299, r226300 r226301 and r226302. No new tests, no change in behaviour. * platform/graphics/FontSelectionAlgorithm.h: (WebCore::FontSelectionValue::clampFloat): * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: (WebCore::MediaPlayerPrivateAVFoundationCF::currentMediaTime const): * platform/graphics/win/UniscribeController.cpp: (WebCore::UniscribeController::shapeAndPlaceItem): 2018-06-18 Karl Leplat <karl.leplat_ext@softathome.com> [Threaded paintingEngine] Fix rendering glitches https://bugs.webkit.org/show_bug.cgi?id=186764 Reviewed by Žan Doberšek. * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp: (Nicosia::PaintingEngineBasic::paint): To keep backwards compatibility with no multi-threaded, we call Nicosia::Buffer functions beginPainting() and completePainting(). 2018-06-18 Tomas Popela <tpopela@redhat.com> Properly check the sscanf return valua https://bugs.webkit.org/show_bug.cgi?id=186757 Reviewed by Carlos Garcia Campos. Check if we matched anything and if we matched the expected amount of data. * page/linux/ResourceUsageThreadLinux.cpp: (WebCore::cpuPeriod): 2018-06-18 Tomas Popela <tpopela@redhat.com> [GTK] Wrong variable used in RenderThemeGtk https://bugs.webkit.org/show_bug.cgi?id=186756 Reviewed by Carlos Garcia Campos. Use SliderThumbHorizontalPart instead of SliderHorizontalPart. * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::adjustSliderThumbSize const): 2018-06-18 Philippe Normand <pnormand@igalia.com> [GStreamer] Crash when adding in-band text track with playbin3 enabled https://bugs.webkit.org/show_bug.cgi?id=186654 Reviewed by Xabier Rodriguez-Calvar. Text track indexes should be relative to the total amount of in-band text tracks. The previous code would induce the creation of in-band text tracks with indexes relative to the total amount of all in-band (audio, video, text) tracks. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::updateTracks): 2018-06-17 Zalan Bujtas <zalan@apple.com> Anonymous block collapsing can destroy the renderer's parent. https://bugs.webkit.org/show_bug.cgi?id=186655 <rdar://problem/41157554> Reviewed by Antti Koivisto. While destroying a chain of renderers (text renderer -> first letter renderer), we need to check if the anonymous block collapsing destroyed the parent renderer (see webkit.org/b/186746). Test: fast/text/first-letter-with-anon-wrapper-crash.html * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): 2018-06-17 Wenson Hsieh <wenson_hsieh@apple.com> [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 3) https://bugs.webkit.org/show_bug.cgi?id=186442 <rdar://problem/40879364> Reviewed by Darin Adler. Rename references to "Extra zoom mode". No change in behavior. * page/DisabledAdaptations.cpp: (WebCore::watchAdaptationName): (WebCore::extraZoomModeAdaptationName): Deleted. * page/DisabledAdaptations.h: * page/ViewportConfiguration.cpp: (WebCore::needsUpdateAfterChangingDisabledAdaptations): (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const): * page/WindowFeatures.cpp: (WebCore::parseDisabledAdaptations): * testing/Internals.cpp: (WebCore::Internals::extraZoomModeAdaptationName const): Deleted. * testing/Internals.h: * testing/Internals.idl: 2018-06-17 Youenn Fablet <youenn@apple.com> Rename Document::hasHadActiveMediaStreamTrack to Document::hasHadCaptureMediaStreamTrack https://bugs.webkit.org/show_bug.cgi?id=186743 rdar://problem/41151193 Reviewed by Eric Carlson. Covered by existing tests. Rename setter and getter to be more accurate. Move the place to call the setter to when creating a capture stream. * Modules/mediastream/MediaDevicesRequest.cpp: (WebCore::MediaDevicesRequest::start): * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::statusDidChange): * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::mediaStreamIsReady): * dom/Document.h: (WebCore::Document::setHasCaptureMediaStreamTrack): (WebCore::Document::hasHadCaptureMediaStreamTrack const): (WebCore::Document::setHasActiveMediaStreamTrack): Deleted. (WebCore::Document::hasHadActiveMediaStreamTrack const): Deleted. 2018-06-17 Zalan Bujtas <zalan@apple.com> [LFC] DisplayBox API should be more clear about height/width vs. contentBoxHeight/width https://bugs.webkit.org/show_bug.cgi?id=186744 Reviewed by Antti Koivisto. Display::Box::height/width -> border box size. Display::Box::contentBoxHeight/width -> content box size. Display::Box::top/left/bottom/right -> border box position in the containing box's coordinate system. Display::Box::marginBox/borderBox/paddingBox/contentBox -> relative to border box (border box is { 0, 0 }) (This patch also removes the box-sizing logic from Display::Box. FormattingContext::Geometry should set the correct contentBoxSize/borderBoxSize based on the CSS property.) * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const): * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedPadding): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::initializeRoot): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::marginBox const): (WebCore::Display::Box::borderBox const): (WebCore::Display::Box::paddingBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::top const): (WebCore::Display::Box::left const): (WebCore::Display::Box::bottom const): (WebCore::Display::Box::right const): (WebCore::Display::Box::topLeft const): (WebCore::Display::Box::bottomRight const): (WebCore::Display::Box::size const): (WebCore::Display::Box::width const): (WebCore::Display::Box::height const): (WebCore::Display::Box::rect const): (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::moveHorizontally): (WebCore::Display::Box::moveVertically): (WebCore::Display::Box::setHasValidContentHeight): (WebCore::Display::Box::setHasValidContentWidth): (WebCore::Display::Box::setContentBoxHeight): (WebCore::Display::Box::setContentBoxWidth): (WebCore::Display::Box::contentBoxHeight const): (WebCore::Display::Box::contentBoxWidth const): (WebCore::Display::Box::setWidth): Deleted. (WebCore::Display::Box::setHeight): Deleted. (WebCore::Display::Box::setSize): Deleted. 2018-06-17 Carlos Eduardo Ramalho <cadubentzen@gmail.com> [GTK] Correct behavior for dark themes https://bugs.webkit.org/show_bug.cgi?id=186219 Reviewed by Michael Catanzaro. Override RenderThemeGtk::isControlStyled() to not style text inputs if color is set different than default. No new tests. Manual theme test and existing layout tests already cover it. * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::isControlStyled const): * rendering/RenderThemeGtk.h: 2018-06-12 Darin Adler <darin@apple.com> [Cocoa] Make some RetainPtr refinements to get more ready for ARC https://bugs.webkit.org/show_bug.cgi?id=186526 Reviewed by Anders Carlsson. * platform/ios/UserAgentIOS.mm: (WebCore::deviceNameForUserAgent): Drop unnecessary use of RetainPtr. * platform/mac/URLMac.mm: (WebCore::URL::operator NSURL * const): Use bridgingAutorelease. 2018-06-16 Chris Dumez <cdumez@apple.com> Better pack ResourceResponse https://bugs.webkit.org/show_bug.cgi?id=186718 Reviewed by Simon Fraser. Better pack ResourceResponse to reduce its size on Mac from 632 to 616 bytes. * platform/network/ResourceResponseBase.h: 2018-06-15 Chris Dumez <cdumez@apple.com> Better pack MediaQuery https://bugs.webkit.org/show_bug.cgi?id=186716 Reviewed by Simon Fraser. Better pack MediaQuery to reduce its size from 48 bytes to 40 and save some memory. * css/MediaQuery.cpp: (WebCore::MediaQuery::MediaQuery): * css/MediaQuery.h: 2018-06-15 Chris Dumez <cdumez@apple.com> StyleRuleMedia wastes 158KB of Vector capacity on cnn.com https://bugs.webkit.org/show_bug.cgi?id=186705 <rdar://problem/41173637> Reviewed by Simon Fraser. Call shrinkToFit on RefPtr<StyleRuleBase> vectors in CSSParserImpl, after we're done parsing and before constructing StyleRuleMedia, StyleRuleSupports and deferred rules in StyleRuleGroup. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseDeferredRuleList): (WebCore::CSSParserImpl::consumeMediaRule): (WebCore::CSSParserImpl::consumeSupportsRule): 2018-06-15 Chris Dumez <cdumez@apple.com> MediaQuerySet wastes a lot of vector capacity https://bugs.webkit.org/show_bug.cgi?id=186696 <rdar://problem/41172850> Reviewed by Simon Fraser. Call shrinkToFit() on the MediaQuerySet after we're done parsing it to avoid wasting memory. * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::parseInternal): 2018-06-15 Chris Dumez <cdumez@apple.com> CachedRawResource wastes 57K of Vector capacity https://bugs.webkit.org/show_bug.cgi?id=186703 <rdar://problem/41173515> Reviewed by Simon Fraser. Use 0 as minimum capacity for CachedRawResource::m_redirectChain, instead of the default value of 16. m_redirectChain usually contains very few items so 16 is wasteful, especially considering that m_redirectChain contains fairly large objects (std::pair<ResourceRequest, ResourceResponse>). CachedRawResource are stored in the memory cache so it is important to not use more memory than necessary. We are also not worried about the performance cost of allocations here since this vector is only populated on HTTP redirects. * loader/cache/CachedRawResource.h: 2018-06-15 Antti Koivisto <antti@apple.com> Semantic colors should not be transformed by color-filter https://bugs.webkit.org/show_bug.cgi?id=186566 <rdar://problem/40705739> Reviewed by Simon Fraser. Test: css3/color-filters/color-filter-ignore-semantic.html * platform/graphics/Color.h: (WebCore::Color::Color): (WebCore::Color::isSemantic const): (WebCore::Color::setIsSemantic): Add a bit to Color to indicate it originated from a semantic color name. Note that a color compares unequal to the semantic version of the same color. * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): * platform/graphics/mac/ColorMac.h: * platform/graphics/mac/ColorMac.mm: (WebCore::semanticColorFromNSColor): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): Set the bit for semantic system colors. * rendering/RenderTreeAsText.cpp: (WebCore::RenderTreeAsText::writeRenderObject): Fix up the output to avoid unneccary render tree dump changes. 2018-06-15 Chris Dumez <cdumez@apple.com> Add API test coverage for SW RegistrationDatabase destruction and fix issues found by the test https://bugs.webkit.org/show_bug.cgi?id=186681 Reviewed by Brady Eidson. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::RegistrationDatabase): (WebCore::RegistrationDatabase::importRecords): * workers/service/server/RegistrationDatabase.h: Rename m_session to m_sessionID for clarity. * workers/service/server/RegistrationStore.cpp: (WebCore::RegistrationStore::~RegistrationStore): Drop bad assertion now that the RegistrationDatabase is refcounted and can outlive the RegistrationStore. The RegistrationDatabase will take care of closing / destroying the SQLiteDatabase on the background thread when destroyed. 2018-06-15 Timothy Hatcher <timothy@apple.com> REGRESSION (r232799): Form controls are blank in dark mode. https://bugs.webkit.org/show_bug.cgi?id=186677 rdar://problem/41162899 Reviewed by Wenson Hsieh. * rendering/RenderThemeMac.mm: (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]): Dark mode controls don't have borders, just a semi-transparent background of shadows. In the dark mode case we can't disable borders, or we will not paint anything for the control. 2018-06-15 Zalan Bujtas <zalan@apple.com> [LFC] Fix static position left/top https://bugs.webkit.org/show_bug.cgi?id=186640 Reviewed by Antti Koivisto. In visual formatting model, we normally go like [top, left] while LayoutPoint takes [x, y]. Let's make this less error prone. * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): 2018-06-15 Chris Dumez <cdumez@apple.com> Crash under WebCore::SWServer::registrationStoreImportComplete() https://bugs.webkit.org/show_bug.cgi?id=186644 <rdar://problem/40982257> Reviewed by Brady Eidson. Fix lifetime management issues with RegistrationDatabase. RegistrationDatabase was previously subclassing CrossThreadTaskHandler. CrossThreadTaskHandler currently is not safe for objects that can get destroyed (such as RegistrationDatabase). This is because it does not keep the object alive when going to the background thread or back to the main thread. This would cause crashes such as the one in the radar. To address the issue, stop subclassing CrossThreadTaskHandler and use a simple WorkQueue instead. RegistrationDatabase is now ThreadSafeRefCounted and we take care of ref'ing it whenever we dispatch a task to the work queue or back to the main thread. Because the RegistrationDatabase can now outlive the RegistrationStore, m_store is now a WeakPtr. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::RegistrationDatabase): (WebCore::RegistrationDatabase::~RegistrationDatabase): (WebCore::RegistrationDatabase::postTaskToWorkQueue): (WebCore::RegistrationDatabase::openSQLiteDatabase): (WebCore::RegistrationDatabase::importRecordsIfNecessary): (WebCore::RegistrationDatabase::pushChanges): (WebCore::RegistrationDatabase::clearAll): (WebCore::RegistrationDatabase::importRecords): (WebCore::RegistrationDatabase::addRegistrationToStore): (WebCore::RegistrationDatabase::databaseFailedToOpen): (WebCore::RegistrationDatabase::databaseOpenedAndRecordsImported): * workers/service/server/RegistrationDatabase.h: (WebCore::RegistrationDatabase::create): * workers/service/server/RegistrationStore.cpp: (WebCore::RegistrationStore::RegistrationStore): (WebCore::RegistrationStore::~RegistrationStore): (WebCore::RegistrationStore::pushChangesToDatabase): (WebCore::RegistrationStore::clearAll): * workers/service/server/RegistrationStore.h: 2018-06-15 Zalan Bujtas <zalan@apple.com> [LFC] Align compute functions styles. https://bugs.webkit.org/show_bug.cgi?id=186649 Reviewed by Antti Koivisto. Improve code readability. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::contentHeightForFormattingContextRoot): (WebCore::Layout::FormattingContext::Geometry::computedValueIfNotAuto): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): (WebCore::Layout::computedValueIfNotAuto): Deleted. * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): 2018-06-15 Zalan Bujtas <zalan@apple.com> [LFC] Add FormattingContextLayout logging channel https://bugs.webkit.org/show_bug.cgi?id=186637 Reviewed by Antti Koivisto. Add some basic layout logging (-WebCoreLogging "FormattingContextLayout"). * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): * layout/FormattingContextGeometry.cpp: (WebCore::Layout::contentHeightForFormattingContextRoot): (WebCore::Layout::shrinkToFitWidth): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedBorder): (WebCore::Layout::FormattingContext::Geometry::computedPadding): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): (WebCore::Layout::verifyAndOutputSubtree): (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::outputLayoutBox): (WebCore::Layout::outputLayoutTree): (WebCore::Layout::TreeBuilder::showLayoutTree): (WebCore::Layout::printLayoutTreeForLiveDocuments): * layout/layouttree/LayoutTreeBuilder.h: * platform/Logging.h: 2018-06-15 Antoine Quint <graouts@apple.com> [Web Animations] CSS Animations should take precedence over CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=186651 Reviewed by Dean Jackson. Ensure CSS Animations override CSS Transitions by modifying the order in which animations are returned by animationsForElement(). * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationsForElement const): 2018-06-14 Youenn Fablet <youenn@apple.com> Make NetworkProcess get cache storage parameters at creation of the CacheStorage engine https://bugs.webkit.org/show_bug.cgi?id=186166 Reviewed by Alex Christensen. Covered by existing tests. * platform/network/NetworkStorageSession.h: (WebCore::NetworkStorageSession::cacheStorageDirectory const): Deleted. (WebCore::NetworkStorageSession::setCacheStorageDirectory): Deleted. (WebCore::NetworkStorageSession::cacheStoragePerOriginQuota const): Deleted. (WebCore::NetworkStorageSession::setCacheStoragePerOriginQuota): Deleted. 2018-06-14 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r232823. This caused both test timeouts and api failures. Reverted changeset: "[Mail] Use the Mail Viewer width as the base for resolving horizontal viewport units" https://bugs.webkit.org/show_bug.cgi?id=186585 https://trac.webkit.org/changeset/232823 2018-06-14 Nan Wang <n_wang@apple.com> AX: Crash in AccessibilityNodeObject::textUnderElement(WebCore::AccessibilityTextUnderElementMode) const + 536 https://bugs.webkit.org/show_bug.cgi?id=186629 Reviewed by Chris Fleizach. This crashed when we passed a null node to ancestorsOfType. Fixed it by adding a null check. Test: accessibility/hidden-object-text-value-crash.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::textUnderElement const): 2018-06-14 Timothy Hatcher <timothy@apple.com> Expose more semantic system colors. https://bugs.webkit.org/show_bug.cgi?id=186609 rdar://problem/39287277 Reviewed by Tim Horton. Add the following semantic colors: -apple-system-control-accent -apple-system-even-alternating-content-background -apple-system-odd-alternating-content-background -apple-system-selected-content-background -apple-system-unemphasized-selected-content-background -apple-system-selected-text -apple-system-unemphasized-selected-text -apple-system-selected-text-background -apple-system-unemphasized-selected-text-background -apple-system-placeholder-text -apple-system-find-highlight-background -apple-system-separator * css/CSSValueKeywords.in: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): 2018-06-14 Eric Carlson <eric.carlson@apple.com> [iOS] WebAVPlayerController isPlayingOnSecondScreen should be declared read-write https://bugs.webkit.org/show_bug.cgi?id=186621 <rdar://problem/40243303> Reviewed by Jer Noble. * platform/ios/WebAVPlayerController.h: 2018-06-13 Zalan Bujtas <zalan@apple.com> [LFC] Miscellaneous fixes to be able to layout <div> with fixed width/height https://bugs.webkit.org/show_bug.cgi?id=186616 Reviewed by Antti Koivisto. 1. Move box horizontally/vertically when relevant margin is computed. 2. Fix isStretchedToViewport() logic and make sure that the width/height is adjusted with the margin when the box is stretchy. 3. Fix isPaddingApplicable() and add "GenericElement" for elements that don't need special handling. With this patch LFC produces the correct geometry for the following content: <html><body><div style="width: 100px; height: 100px;"></div></body></html> * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::isStretchedToViewport): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::moveHorizontally): (WebCore::Display::Box::moveVertically): (WebCore::Display::Box::Rect::setWidth): (WebCore::Display::Box::Rect::setHeight): (WebCore::Display::Box::Rect::moveHorizontally): (WebCore::Display::Box::Rect::moveVertically): * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isPaddingApplicable const): * layout/layouttree/LayoutBox.h: * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createSubTree): 2018-06-13 Chris Dumez <cdumez@apple.com> Crash under SWServer::unregisterConnection(Connection&) https://bugs.webkit.org/show_bug.cgi?id=186584 <rdar://problem/40931680> Reviewed by Youenn Fablet. The crash was due to SWServer::Connection objects outliving their SWServer, even though SWServer::Connection::m_server is a C++ reference. This was possible because SWServer does not own the connections, StorageToWebProcessConnection does. This started crashing recently, after r232423, because SWServer can get destroyed now. The SWServer might get destroyed before the StorageToWebProcessConnection, in which case the SWServer::Connection objects will get destroyed later. We were crashing because the SWServer::Connection destructor tries to unregister the connection from the SWServer (which is dead). To address the issue, the SWServer now owns the connections. StorageToWebProcessConnection merely has weak pointers to the connections. * workers/service/server/SWServer.cpp: (WebCore::SWServer::Connection::Connection): (WebCore::SWServer::addConnection): (WebCore::SWServer::removeConnection): (WebCore::SWServer::resolveRegistrationReadyRequests): * workers/service/server/SWServer.h: (WebCore::SWServer::Connection::~Connection): (WebCore::SWServer::Connection::server): (WebCore::SWServer::connection): * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::forEachConnection): (WebCore::SWServerRegistration::notifyClientsOfControllerChange): (WebCore::SWServerRegistration::controlClient): 2018-06-13 Zalan Bujtas <zalan@apple.com> [Mail] Use the Mail Viewer width as the base for resolving horizontal viewport units https://bugs.webkit.org/show_bug.cgi?id=186585 <rdar://problem/30685325> Reviewed by Tim Horton. Use the existing "override viewport size for viewport units" mechanism to compute the preferred viewport unit values for the Mail Viewer html content. Test: fast/dynamic/mail-autosize-viewport-unit.html * page/FrameView.cpp: (WebCore::FrameView::FrameView): (WebCore::FrameView::enableAutoSizeMode): (WebCore::FrameView::clearViewportSizeOverrideForCSSViewportUnits): (WebCore::FrameView::setViewportSizeForCSSViewportUnits): (WebCore::FrameView::overrideViewportSizeForCSSViewportUnits): (WebCore::FrameView::viewportSizeForCSSViewportUnits const): * page/FrameView.h: 2018-06-13 Dean Jackson <dino@apple.com> Disable AR support in WKWebView clients https://bugs.webkit.org/show_bug.cgi?id=186611 <rdar://problem/39544684> Reviewed by Jon Lee. Since it hasn't been adequately tested, System Preview (AR) should be disabled by default for WKWebViews. Add a new RuntimeEnabledFeature to control this, and guard for this case everywhere we use system previews. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::isSystemPreviewLink const): (WebCore::HTMLAnchorElement::handleClick): * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::isSystemPreviewImage const): * html/HTMLPictureElement.cpp: (WebCore::HTMLPictureElement::isSystemPreviewImage const): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setSystemPreviewEnabled): (WebCore::RuntimeEnabledFeatures::systemPreviewEnabled const): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIntoRect): 2018-06-13 Youenn Fablet <youenn@apple.com> Supported plugin check should be based on plugin identifier https://bugs.webkit.org/show_bug.cgi?id=186578 <rdar://problem/40523828> Reviewed by Darin Adler. Rename SupportedPluginName in SupportedPluginIdentifier. Add cross-platform support for plug-in identifier. Update built-in PDF plug-in to check its identifier instead of its name. This is stronger as the name may change according localization. * loader/EmptyClients.cpp: * plugins/PluginData.cpp: (WebCore::isBuiltInPDFPlugIn): (WebCore::PluginData::initPlugins): * plugins/PluginData.h: (WebCore::operator==): (WebCore::isSupportedPlugin): (WebCore::SupportedPluginIdentifier::decode): (WebCore::SupportedPluginIdentifier::encode const): (WebCore::SupportedPluginName::decode): Deleted. (WebCore::SupportedPluginName::encode const): Deleted. * plugins/PluginInfoProvider.h: 2018-06-13 Chris Dumez <cdumez@apple.com> PSON: http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html ASSERTS with process swap enabled https://bugs.webkit.org/show_bug.cgi?id=186545 Reviewed by Brady Eidson. Move frame navigation logging for ITP purposes from the WebProcess to the UIProcess. This information was previously logged in DocumentLoader::willSendRequest() and was getting sync'd to the UIProcess at regular intervals or when the layout tests call testRunner's statisticsNotifyObserver(). We now do the logging directly in the UIProcess, in WebPageProxy::decidePolicyForNavigationAction (which was getting called via IPC from DocumentLoader::willSendRequest()). This is more efficient and will also be needed soon due to the way process swap on navigation deals with cross-origin redirects. On cross-origin redirect of the main frame, PSON cancels the load and started a new load to the redirected to URL in the new WebProcess. As a result, the new WebProcess is not aware that the load is a redirect, which is information that ITP requires. By moving the ITP logging to the UIProcess, we still have access to this information. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Stop logging the navigation now that it is logged in the UIProcess. * loader/EmptyClients.cpp: (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithDocumentLoader): * loader/FrameLoaderClient.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/PolicyChecker.h: We now pass the full redirect request to the decidePolicyForNavigationAction delegate instead of a simple isRedirect boolean, so that we have the redirect response URL in the UIProcess for ITP logging. * loader/ResourceLoadObserver.cpp: (WebCore::areDomainsAssociated): (WebCore::ResourceLoadObserver::logSubresourceLoading): (WebCore::ResourceLoadObserver::logWebSocketLoading): (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::areDomainsAssociated): (WebCore::ResourceLoadStatistics::reduceTimeResolution): * loader/ResourceLoadStatistics.h: - Remove ResourceLoadObserver::logFrameNavigation() now that it is on the WebResourceLoadStatisticsStore. - Move some code from ResourceLoadObserver to ResourceLoadStatistics so that it can be called from the UIProcess and to avoid code duplication. 2018-06-13 Mark Lam <mark.lam@apple.com> FloatingPointEnvironment is only needed for ARM CPUs. https://bugs.webkit.org/show_bug.cgi?id=186567 <rdar://problem/40929441> Reviewed by Michael Saboff. No new tests. This behavior is already covered by existing tests. * platform/ios/wak/FloatingPointEnvironment.cpp: * platform/ios/wak/FloatingPointEnvironment.h: (WebCore::FloatingPointEnvironment::enableDenormalSupport): (WebCore::FloatingPointEnvironment::saveMainThreadEnvironment): (WebCore::FloatingPointEnvironment::propagateMainThreadEnvironment): (WebCore::FloatingPointEnvironment::singleton): 2018-06-13 Timothy Hatcher <timothy@apple.com> Input form controls have a white background in dark mode, when they should not. https://bugs.webkit.org/show_bug.cgi?id=186577 rdar://problem/39258325 Reviewed by Tim Horton. * DerivedSources.make: Allow WTF_PLATFORM_MAC ifdefs to preprocess in html.css. * css/CSSValueKeywords.in: Added -apple-system-control-background. * css/MediaQueryExpression.cpp: (WebCore::featureWithValidIdent): Allow dark mode media query in user agent stylesheets. (WebCore::isFeatureValidWithoutValue): Ditto. * css/MediaQueryParserContext.cpp: (WebCore::MediaQueryParserContext::MediaQueryParserContext): Transfer the CSSParserMode from CSSParserContext. * css/MediaQueryParserContext.h: * css/html.css: Set color and background-color to semantic colors for input, textarea, and select. Make input background-color transparent in dark mode to match AppKit. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): Added -apple-system-control-background. (WebCore::RenderThemeMac::paintTextField): Adjust the drawing rect to match new artwork in macOS 10.14. 2018-06-13 Said Abou-Hallawa <sabouhallawa@apple.com> TileFirstPaint strategy for async image decoding should be disabled for non root RenderLayers https://bugs.webkit.org/show_bug.cgi?id=186336 <rdar://problem/40808099> Reviewed by Simon Fraser. When showing a composited RenderLayer for the first time, the images in this layer have to be decoded synchronously to avoid unwanted flashing. To create a layout test for this patch, FrameDecodingDurationForTesting needs to be generalized for large and animated images. The decoding thread now forces the decoding time to be at least equal to FrameDecodingDurationForTesting. Test: fast/images/async-image-composited-show.html * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages const): (WebCore::BitmapImage::internalStartAnimation): (WebCore::BitmapImage::advanceAnimation): * platform/graphics/BitmapImage.h: * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::startAsyncDecodingQueue): * platform/graphics/ImageSource.h: (WebCore::ImageSource::setFrameDecodingDurationForTesting): (WebCore::ImageSource::frameDecodingDurationForTesting const): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): 2018-06-13 Wenson Hsieh <wenson_hsieh@apple.com> CSS "background-color" style no longer affects natively rendered text fields https://bugs.webkit.org/show_bug.cgi?id=186597 <rdar://problem/41050528> Reviewed by Tim Horton. AppKit currently does not support rendering background color to the edges of a text field cell. This means that in WebCore, when natively rendering text inputs with background color, we need to only draw the bezels of a text field, such that the background color we paint behind the text field will be shown. Currently, the way we accomplish this is by intercepting an internal NSTextField method that computes drawing options for CoreUI, and inserting a `"borders only" => true` entry. However, in a recent build of macOS Mojave, AppKit tweaked -_coreUIDrawOptionsWithFrame:inView:includeFocus: to add an extra argument (such that it's now -_coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:), which negates the above workaround. To fix this in the short term, augment the workaround to apply to the latest macOS Mojave as well. A longer-term fix is already tracked in <rdar://problem/11385461>, which would allow WebKit to simply specify a background color on the text field cell, and have AppKit render it properly to the edges of the bezels. Covered by a test that is currently failing on Mojave: fast/forms/hidpi-textfield-background-bleeding.html * rendering/RenderThemeMac.mm: (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]): (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]): (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:]): 2018-06-13 Thibault Saunier <tsaunier@igalia.com> [WPE] Build getUserMedia support https://bugs.webkit.org/show_bug.cgi?id=186547 Reviewed by Alejandro G. Castro. Enable mediastream tests. * PlatformWPE.cmake: Build MediaStream support. * SourcesGTK.txt: Moved GStreamer related files to GStreamer.cmake. * SourcesWPE.txt: Removed `platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp` which is now in GStreamer.cmake. * platform/GStreamer.cmake: Build more MediaStream/webrtc related files. * platform/graphics/ImageBuffer.cpp: Handle the fact that toBGRAData is now built directly into the Cairo backend and not GTK anymore. * platform/graphics/cairo/ImageBufferCairo.cpp: Implement `toBGRAData` * platform/graphics/gtk/ImageBufferGtk.cpp: Removed `toBGRAData` as it is now implemented in the Cairo backend itself. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Switch an ASSERT to RELEASE_ASSERT when adding the GhostPad to itself. This was making test fail when built in RELEASE mode. (WebCore::webkitMediaStreamSrcChain): Minor variable name change to make it more accurate. (WebCore::webkitMediaStreamSrcAddPad): Now add the ghost pad to the element before setting its chain function, making things clearer. (WebCore::webkitMediaStreamSrcSetupSrc): Remove extra new line. 2018-06-13 Philippe Normand <pnormand@igalia.com> [GStreamer] fast/canvas/webgl crashes https://bugs.webkit.org/show_bug.cgi?id=186590 Reviewed by Carlos Alberto Lopez Perez. After r232747 the sample managed by the player can be empty, without buffer. So we need to check for this before mapping video frames. Also use the GstVideoFrameHolder in more places to reduce copy-paste churn. * platform/graphics/gstreamer/ImageGStreamer.h: * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: (ImageGStreamer::ImageGStreamer): (ImageGStreamer::~ImageGStreamer): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::GstVideoFrameHolder::GstVideoFrameHolder): (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture): (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime): 2018-06-13 Philippe Normand <pnormand@igalia.com> Unreviewed GTK build fix for --cmakeargs=-DUSE_GSTREAMER_GL=OFF * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::load): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor): 2018-06-12 Philippe Normand <pnormand@igalia.com> [GStreamer] Video freezes when GStreamerGL is not installed https://bugs.webkit.org/show_bug.cgi?id=184925 Reviewed by Žan Doberšek. At runtime when the GStreamer opengl plugin isn't available the player will fallback to the internal WebKit video sink. The VideoFrameHolder was refactored to handle both cases (opengl, non-opengl). * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::GstVideoFrameHolder::GstVideoFrameHolder): (WebCore::GstVideoFrameHolder::~GstVideoFrameHolder): (WebCore::GstVideoFrameHolder::frame const): (WebCore::GstVideoFrameHolder::updateTexture): (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): (WebCore::GstVideoFrameHolder::isValid const): Deleted. (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2018-06-12 Zalan Bujtas <zalan@apple.com> Complex text handling should opt out of bounded text layout. https://bugs.webkit.org/show_bug.cgi?id=186571 <rdar://problem/41060908> Reviewed by Tim Horton. Test: fast/text/complex-long-text-crash.html * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): 2018-06-12 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r232774. Breaks internal builds. Reverted changeset: "Complex text handling should opt out of bounded text layout." https://bugs.webkit.org/show_bug.cgi?id=186571 https://trac.webkit.org/changeset/232774 2018-06-12 Ryosuke Niwa <rniwa@webkit.org> iOS WK1: Occasional crash in FrameView::setScrollPosition https://bugs.webkit.org/show_bug.cgi?id=186575 Reviewed by David Kilzer. The bug was caused by ScrollView::platformSetScrollPosition releasing the web thread lock and DumpRenderTree requesting a new page load thereby destroying FrameView. Fixed the crash by keeping FrameView alive while scrollToFocusedElementTimerFired is getting called. No new tests since the bug is caught by existing layout tests under guard malloc. * page/FrameView.cpp: (WebCore::FrameView::scrollToFocusedElementTimerFired): 2018-06-12 Zalan Bujtas <zalan@apple.com> Complex text handling should opt out of bounded text layout. https://bugs.webkit.org/show_bug.cgi?id=186571 <rdar://problem/40801429> Reviewed by Tim Horton. Test: fast/text/complex-long-text-crash.html * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): 2018-06-12 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the Windows build after r232757 * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren): 2018-06-12 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION(r228724): Occasional crash when executing ReplaceSelectionCommand at the end of the document https://bugs.webkit.org/show_bug.cgi?id=186555 <rdar://problem/39703004> Reviewed by Ryosuke Niwa. r228724 removed a null check for m_lastNodeInserted in InsertedNodes::pastLastLeaf(). This null check was guarding against the case where m_firstNodeInserted might exist, but m_lastNodeInserted is null, which may happen when inserting content at the end of the document, since InsertedNodes::willRemoveNodePreservingChildren may cause m_lastNodeInserted to be null. This is because the removed node may be at the very end of the document _and also_ not have any children, which means that both `node->lastChild()` as well as `NodeTraversal::nextSkippingChildren(*node)` will be null. After getting into this state, we subsequently crash when attempting to compute InsertedNodes::pastLastLeaf(). To fix this, avoid accidentally clearing out m_lastNodeInserted; if the last inserted node has neither a child nor a next node, seek backwards to the previous node in the DOM instead, and clamp to the first inserted node, such that the last inserted node's document position is at or after the first inserted node's position. Test: editing/execCommand/insert-apple-style-span-at-document-end.html * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren): 2018-06-12 Jianjun Zhu <jianjun.zhu@intel.com> Hash deviceId and groupId of MediaTrackCapabilities. https://bugs.webkit.org/show_bug.cgi?id=186471 Reviewed by Eric Carlson. This change makes the identifier for the source of the MediaStreamTrack has the same value returned by enumerateDevices(). It also prevents real device ID being leaked. (WebCore::MediaStreamTrack::getCapabilities const): * Modules/mediastream/MediaStreamTrack.h: * Modules/mediastream/MediaStreamTrack.idl: 2018-06-12 Philippe Normand <pnormand@igalia.com> Unreviewed WPE build fix after r232749. * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: 2018-06-12 Zalan Bujtas <zalan@apple.com> [LFC] Add vertical margin computation for inflow non-replaced box and for the (10.6.6) complicated cases. https://bugs.webkit.org/show_bug.cgi?id=186469 Reviewed by Antti Koivisto. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): 2018-06-12 Philippe Normand <pnormand@igalia.com> [GStreamer] Bump required version to 1.8.3 https://bugs.webkit.org/show_bug.cgi?id=186558 Reviewed by Xabier Rodriguez-Calvar. * platform/GStreamer.cmake: Remove useless file. * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webKitWebAudioSrcChangeState): Remove useless version check. * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Removed. createDecryptor() is dead code since the decryptors moved to the MSE playback pipeline. * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: (WebCore::GStreamerEMEUtilities::keySystemToUuid): 2018-06-11 Philippe Normand <philn@igalia.com> [GStreamer] flush video sample upon DRAIN query https://bugs.webkit.org/show_bug.cgi?id=186481 Reviewed by Xabier Rodriguez-Calvar. Use the appsink sink pad pad probe for both event and drain query management. This patch is partially based on https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d3a336523d123119fe1dd53da5d9006c92cf078c by Enrique Ocaña González <eocanha@igalia.com>. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): 2018-06-11 Zalan Bujtas <zalan@apple.com> [LFC] Replace HorizontalGeometry::width and margin with WidthAndMargin (Vertical too) https://bugs.webkit.org/show_bug.cgi?id=186556 Reviewed by Sam Weinig. HorizontalGeometry::width and margin -> WidthAndMargin VerticalGeometry::height and margin -> HeightAndMargin * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): 2018-06-11 Youenn Fablet <youenn@apple.com> Improve error messages in case FetchEvent.respondWith has a rejected promise https://bugs.webkit.org/show_bug.cgi?id=186368 Reviewed by Chris Dumez. Covered by rebased tests. Introduce a new error domain for service worker ResourceError. Used this domain to log in the console any such error. Update FetchEvent implementation to get meaningful error messages for respondWith error cases. In particular, convert the rejected promise JS value as a string to populate the error message. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFail): * platform/network/ResourceErrorBase.cpp: * platform/network/ResourceErrorBase.h: * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish): * workers/service/FetchEvent.cpp: (WebCore::FetchEvent::~FetchEvent): (WebCore::FetchEvent::createResponseError): (WebCore::FetchEvent::onResponse): (WebCore::FetchEvent::respondWithError): (WebCore::FetchEvent::processResponse): (WebCore::FetchEvent::promiseIsSettled): * workers/service/FetchEvent.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): (WebCore::ServiceWorkerFetch::dispatchFetchEvent): 2018-06-11 Chris Dumez <cdumez@apple.com> http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html times out with PSON enabled https://bugs.webkit.org/show_bug.cgi?id=186546 Reviewed by Brady Eidson. Add a hasOpenedFrames flag to NavigationAction, which we'll use in the UIProcess when deciding to process swap on navigation or not. Test: http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): * loader/NavigationAction.h: (WebCore::NavigationAction::hasOpenedFrames const): (WebCore::NavigationAction::setHasOpenedFrames): 2018-06-11 Tim Horton <timothy_horton@apple.com> Link drag image is inconsistently unreadable in dark mode https://bugs.webkit.org/show_bug.cgi?id=186472 Reviewed by Timothy Hatcher. * platform/mac/DragImageMac.mm: (WebCore::createDragImageForLink): Use LocalDefaultSystemAppearance so that NSColors used inside createDragImageForLink are interpreted correctly. This function always follows the system appearance regardless of what the preference is set to, because it's generating UI that isn't part of the page. Use controlBackgroundColor to get a consistently contrasting background for the link drag image. 2018-06-11 Chris Dumez <cdumez@apple.com> http/tests/security/cors-post-redirect-307.html fails with PSON enabled https://bugs.webkit.org/show_bug.cgi?id=186441 Reviewed by Brady Eidson. When we are continuing a load in a new process, we currently bypass the navigation policy check. We now also bypass the adding of headers such as the Origin one since the request was already processed in the previous process. This is important because in the case of a cross-origin redirect, the previous process has removed the Origin header from the request and we do not want the new process to add it again. Test: http/tests/security/cors-post-redirect-307-pson.html * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setShouldTreatAsContinuingLoad): (WebCore::FrameLoadRequest::shouldTreatAsContinuingLoad const): (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy): Deleted. (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const): Deleted. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::reloadWithOverrideEncoding): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::addExtraFieldsToRequest): (WebCore::FrameLoader::addHTTPOriginIfNeeded): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/ShouldTreatAsContinuingLoad.h: Renamed from Source/WebCore/loader/NavigationPolicyCheck.h. * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: 2018-06-11 Youenn Fablet <youenn@apple.com> Accept request header values should be more tightly checked after r232572 in case of CORS load https://bugs.webkit.org/show_bug.cgi?id=186533 <rdar://problem/40933880> Reviewed by Darin Adler. Covered by updated test. * platform/network/HTTPParsers.cpp: (WebCore::isValidAcceptHeaderValue): Checking that Accept header value conforms with RFC7370. If not, this will trigger preflighting for CORS cross origin loads. Current checks for Accept-Language and Content-Language are sufficient to ensure values conform with RFC7370. 2018-06-11 Chris Dumez <cdumez@apple.com> Crash under com.apple.WebKit.Networking at WebCore: WebCore::NetworkStorageSession::hasStorageAccess const https://bugs.webkit.org/show_bug.cgi?id=186433 <rdar://problem/40750907> Reviewed by Geoffrey Garen. Do some hardening in NetworkStorageSession::hasStorageAccess() to make sure we do not try and do a HashMap lookup with a null firstPartyDomain, as this would crash. * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::hasStorageAccess const): 2018-06-11 Zalan Bujtas <zalan@apple.com> [LFC] Remove redundant position functions for out-of-flow elements https://bugs.webkit.org/show_bug.cgi?id=186525 Reviewed by Antti Koivisto. Position is computed as part of the Horizontal/Vertical geometry computation. (see outOfFlow(Non)ReplacedHorizontalGeometry/outOfFlow(Non)ReplacedVerticalGeometry functions) * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::outOfFlowNonReplacedPosition): Deleted. (WebCore::Layout::outOfFlowReplacedPosition): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowPosition): Deleted. 2018-06-11 Zalan Bujtas <zalan@apple.com> [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow replaced elements https://bugs.webkit.org/show_bug.cgi?id=186524 Reviewed by Antti Koivisto. Implement https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-height (10.6.5 Absolutely positioned, replaced elements) * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): 2018-06-11 Zalan Bujtas <zalan@apple.com> [LFC] Merge left, right, width and horizontal margin computation for out-of-flow replaced elements https://bugs.webkit.org/show_bug.cgi?id=186475 Reviewed by Antti Koivisto. Implement https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-width (10.3.8 Absolutely positioned, replaced elements) * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::computedValueIfNotAuto): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin): Deleted. 2018-06-11 Zalan Bujtas <zalan@apple.com> [LFC] Merge left, right, width and horizontal margin computation for out-of-flow non-replaced elements https://bugs.webkit.org/show_bug.cgi?id=186474 Reviewed by Antti Koivisto. Implement https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-width (10.3.7 Absolutely positioned, non-replaced elements) * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin): Deleted. 2018-06-10 Zalan Bujtas <zalan@apple.com> [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow non-replaced elements https://bugs.webkit.org/show_bug.cgi?id=186476 Reviewed by Antti Koivisto. Implement https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height (10.6.4 Absolutely positioned, non-replaced elements) * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::computedValueIfNotAuto): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeightAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeightAndMargin): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeightAndMargin): Deleted. 2018-06-10 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add API run run javascript from a WebKitWebView in an isolated world https://bugs.webkit.org/show_bug.cgi?id=186192 Reviewed by Michael Catanzaro. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::executeScriptInWorld): Add ExceptionDetails parameter. * bindings/js/ScriptController.h: 2018-06-10 Michael Catanzaro <mcatanzaro@igalia.com> [WPE][GTK] paypal.com requires user agent quirk https://bugs.webkit.org/show_bug.cgi?id=186466 Reviewed by Carlos Garcia Campos. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresMacintoshPlatform): 2018-06-09 Dan Bernstein <mitz@apple.com> [Xcode] Clean up and modernize some build setting definitions https://bugs.webkit.org/show_bug.cgi?id=186463 Reviewed by Sam Weinig. * Configurations/Base.xcconfig: Removed definition for macOS 10.11. * Configurations/DebugRelease.xcconfig: Ditto. * Configurations/FeatureDefines.xcconfig: Simplified the definitions of ENABLE_APPLE_PAY and ENABLE_VIDEO_PRESENTATION_MODE now macOS 10.12 is the earliest supported version. * Configurations/Version.xcconfig: Removed definition for macOS 10.11. * Configurations/WebCore.xcconfig: Simplified the definition of WK_PRIVATE_FRAMEWORKS_DIR now that WK_XCODE_SUPPORTS_TEXT_BASED_STUBS is true for all supported Xcode versions. * Configurations/WebKitTargetConditionals.xcconfig: Removed definitions for macOS 10.11. 2018-06-09 Dan Bernstein <mitz@apple.com> Added missing file references to the Configuration group. * WebCore.xcodeproj/project.pbxproj: 2018-06-09 Zalan Bujtas <zalan@apple.com> REGRESSION (r230480): Cannot adjust photo position on LinkedIn's profile page https://bugs.webkit.org/show_bug.cgi?id=186464 <rdar://problem/40369448> Reviewed by Simon Fraser. The optimization logic for skipping image layout when we only need overflow computation should check if the image actually needs simplified layout only. The needsSimplifiedNormalFlowLayout() flag means that the overflow information needs to be updated but it does not mean that overflow is the only property that we need to recompute. Test: fast/images/positioned-image-when-transform-is-present.html * rendering/RenderImage.cpp: (WebCore::RenderImage::layout): * rendering/RenderObject.h: (WebCore::RenderObject::needsSimplifiedNormalFlowLayoutOnly const): 2018-06-09 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(macOS Mojave): move-by-word-visually-multi-line.html fails https://bugs.webkit.org/show_bug.cgi?id=186454 Reviewed by Darin Adler. Like r232635, this patch fixes a selection test failure caused by the change in ICU's behavior in macOS Mojave, which caused isWordTextBreak to return true in more cases. In this particular failing test case, previousTextOrLineBreakBox and nextTextOrLineBreakBox were failing to find an inline text box when it found an inline box for a BR, which was mentioned by an existing FIXME comment. Consequently, visualWordPosition were erroneously detecting the end of a word followed by a blank line created by a BR as a valid word boundary to move when the Windows editing behavior is enacted. Addressed the FIXME comment by finding the next inline text box skipping all inline boxes for BRs. Renamed misleadingly named previousBoxInDifferentBlock and nextBoxInDifferentBlock to previousBoxInDifferentLine and nextBoxInDifferentLine respectively, and set them to true as they're really indicating whether line boxes belong to a distinct line or not; whether an inline box belong to two (render) blocks or not is irrelevant. Finally, this patch fixes a bug in visualWordPosition that it was failing to skip blank lines when a word break is found as we traversed past a line break. In those cases, we must skip all line breaks before stopping. Tests: editing/selection/move-by-word-visually-mac.html editing/selection/move-by-word-visually-multi-line.htm * editing/VisibleUnits.cpp: (WebCore::CachedLogicallyOrderedLeafBoxes::previousTextOrLineBreakBox): (WebCore::CachedLogicallyOrderedLeafBoxes::nextTextOrLineBreakBox): (WebCore::CachedLogicallyOrderedLeafBoxes::boxIndexInLeaves const): (WebCore::logicallyPreviousBox): (WebCore::logicallyNextBox): (WebCore::wordBreakIteratorForMinOffsetBoundary): (WebCore::wordBreakIteratorForMaxOffsetBoundary): (WebCore::visualWordPosition): 2018-06-09 Zalan Bujtas <zalan@apple.com> [LFC] MarginCollapse functions should be able to resolve non-fixed margin values https://bugs.webkit.org/show_bug.cgi?id=186461 Reviewed by Antti Koivisto. We need the containing block's computed width to resolve vertical and horizontal margins. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild): (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop): (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop): (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom): (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild): (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom): (WebCore::Layout::collapsedMarginTopFromFirstChild): Deleted. (WebCore::Layout::nonCollapsedMarginTop): Deleted. 2018-06-08 Darin Adler <darin@apple.com> [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC https://bugs.webkit.org/show_bug.cgi?id=186436 Reviewed by Anders Carlsson. * bridge/objc/objc_class.mm: Use import instead of include. * bridge/objc/objc_instance.h: Replaced _pool member to hold an object with m_autoreleasePool member to hold a token from objc_autoreleasePoolPush. Also initialize all data members here in the class definition. * bridge/objc/objc_instance.mm: (ObjcInstance::ObjcInstance): Moved most initialization to class definition. (ObjcInstance::virtualBegin): Use objc_autoreleasePoolPush instead of NSAutoreleasePool class. (ObjcInstance::virtualEnd): Use objc_autoreleasePoolPop. * bridge/objc/objc_runtime.mm: Use import instead of include. * bridge/objc/objc_utility.mm: Ditto. * platform/audio/mac/AudioBusMac.mm: (WebCore::AudioBus::loadPlatformResource): Use @autoreleasepool. * platform/ios/wak/WebCoreThread.mm: Re-sorted includes. Removed declaration of autorelease pool SPI and use FoundationSPI.h instead. * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::ResourceResponse::platformLazyInit): Use @autoreleasepool. 2018-06-08 Wenson Hsieh <wenson_hsieh@apple.com> [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 1) https://bugs.webkit.org/show_bug.cgi?id=186442 <rdar://problem/40879364> Reviewed by Tim Horton. No change in behavior. * Configurations/FeatureDefines.xcconfig: * page/DisabledAdaptations.cpp: (WebCore::extraZoomModeAdaptationName): 2018-06-08 Per Arne Vollan <pvollan@apple.com> Only display refresh monitors having requested display refresh callback should get notified on screen updates. https://bugs.webkit.org/show_bug.cgi?id=186397 <rdar://problem/40897835> Reviewed by Brent Fulgham. Since all display refresh monitors in the WebContent process share a single UI process display link, we should make sure that only the monitors having requested callback are getting notified on screen updates. I have not been able to reproduce a case where a monitor is being notified without having requested updates, but we should safeguard the code for future code changes. No new tests, since this is a safeguarding measure. * platform/graphics/DisplayRefreshMonitor.h: (WebCore::DisplayRefreshMonitor::hasRequestedRefreshCallback const): * platform/graphics/DisplayRefreshMonitorManager.cpp: (WebCore::DisplayRefreshMonitorManager::displayWasUpdated): 2018-06-07 Jer Noble <jer.noble@apple.com> REGRESSION: Cannot listen to audio on Google Translate with side switch set to "vibrate" https://bugs.webkit.org/show_bug.cgi?id=186415 <rdar://problem/40584651> Reviewed by Eric Carlson. Test: platform/mac/media/audio-session-category-audio-autoplay.html Make sure that the PlatformMediaSession's state has already been set when calling updateSessionStates(). * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::setState): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionStateChanged): 2018-06-08 Dean Jackson <dino@apple.com> 'setRenderPipelineState:' is unavailable: not available on iOS https://bugs.webkit.org/show_bug.cgi?id=186449 <rdar://problem/40880602> Reviewed by Simon Fraser. Be more explicit about the protocol type to avoid the compiler getting confused by a similar signature. * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm: (WebCore::GPURenderCommandEncoder::setRenderPipelineState): 2018-06-08 Darin Adler <darin@apple.com> Fix iOS build. * platform/ios/QuickLookSoftLink.mm: Removed QLPreviousScheme, which I said I did in the change log but looks like it didn't happen. 2018-06-08 Darin Adler <darin@apple.com> [Cocoa] Make more of our soft linking ARC-compatible https://bugs.webkit.org/show_bug.cgi?id=186437 Reviewed by Daniel Bates. * editing/cocoa/DataDetection.mm: (WebCore::removeResultLinksFromAnchor): Fix comment referring to unused constant DDURLScheme. * platform/cocoa/DataDetectorsCoreSoftLink.h: Removed unused DDURLScheme. * platform/cocoa/DataDetectorsCoreSoftLink.mm: Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Use SOFT_LINK_CONSTANT_MAY_FAIL for NSString constants instead of using SOFT_LINK_POINTER_OPTIONAL. Required moving iOS-specific items inside the #if PLATFORM(IOS) section. (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Use the canLoad functions instead of checking for null to handle possibly-missing string constants. (WebCore::metadataType): Ditto. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Removed unused AVMediaTypeVideo, AVMediaTypeAudio, and AVMediaTypeText soft linking. * platform/ios/QuickLook.mm: (WebCore::isQuickLookPreviewURL): Removed unneeded assertion. * platform/ios/QuickLookSoftLink.h: Removed unneeded QLPreviousScheme, which was used only for an assertion, one we can do without. * platform/ios/QuickLookSoftLink.mm: Ditto. * platform/mediastream/mac/AVVideoCaptureSource.mm: Removed unused soft linking of AVCaptureVideoPreviewLayer class and AVCaptureSessionPresetLow string constant. Use SOFT_LINK_CONSTANT_MAY_FAIL for NSString constants instead of using SOFT_LINK_POINTER_OPTIONAL. (WebCore::AVVideoCaptureSource::initializeCapabilities): Use the canLoad functions instead of checking for null to handle possibly-missing string constants. (WebCore::sizeForPreset): Ditto. (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions const): Ditto. 2018-06-08 Aditya Keerthi <akeerthi@apple.com> [Datalist] Allow TextFieldInputType to show and hide suggestions https://bugs.webkit.org/show_bug.cgi?id=186151 Reviewed by Tim Horton. TextFieldInputTypes with a list attribute should be able to display suggestions as the user interacts with the input field. In order to display suggestions for an input field with a list attribute, we need provide certain information - including the items to suggest and the location to present the suggestions. TextFieldInputType can now provide this information by conforming to the DataListSuggestionsClient interface. In this initial patch, the suggestions can be shown in two ways. The first is by clicking on the input field. The other is by typing text in the field. In a later patch, we will add a third way to display suggestions, using a button. These ways to activate the suggestions are enumerated in DataListSuggestionInformation. We hide the suggestions if there are no more to show, or if the input has blurred. Tests to be added once work has been done in the UIProcess. * WebCore.xcodeproj/project.pbxproj: * html/DataListSuggestionInformation.h: Added. Contains the information necessary to display suggestions. * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::~TextFieldInputType): (WebCore::TextFieldInputType::handleClickEvent): Show suggestions when the element is clicked. (WebCore::TextFieldInputType::handleKeydownEvent): Allow users to interact with the suggestions using the keyboard. (WebCore::TextFieldInputType::elementDidBlur): Hide the suggestions. (WebCore::TextFieldInputType::shouldRespectListAttribute): (WebCore::TextFieldInputType::didSetValueByUserEdit): Update the suggestions if the text has changed. (WebCore::TextFieldInputType::elementRectRelativeToRootView const): Provide the location where the suggestions should be shown. (WebCore::TextFieldInputType::suggestions const): Provide the list of suggestions. (WebCore::TextFieldInputType::didSelectDataListOption): Update the text once an suggestion has been selected. (WebCore::TextFieldInputType::didCloseSuggestions): (WebCore::TextFieldInputType::displaySuggestions): (WebCore::TextFieldInputType::closeSuggestions): * html/TextFieldInputType.h: * loader/EmptyClients.cpp: (WebCore::EmptyChromeClient::createDataListSuggestionPicker): * loader/EmptyClients.h: * page/Chrome.cpp: (WebCore::Chrome::createDataListSuggestionPicker): * page/Chrome.h: * page/ChromeClient.h: * platform/DataListSuggestionPicker.h: Added. (WebCore::DataListSuggestionPicker::close): (WebCore::DataListSuggestionPicker::handleKeydownWithIdentifier): (WebCore::DataListSuggestionPicker::displayWithActivationType): * platform/DataListSuggestionsClient.h: Added. 2018-06-07 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(macOS Mojave): move-by-word-visually-inline-block-positioned-element.html fails https://bugs.webkit.org/show_bug.cgi?id=186424 Reviewed by Wenson Hsieh. The test failure is ultimately caused by the change in ICU's behavior. With the CPU in the latest macOS Mojave, ubrk_getRuleStatus returns 200 / UBRK_WORD_LETTER at the end of a buffer given to UBreakIterator. This caused isWordTextBreak to return true instead of false in isLogicalStartOfWord at the end of the buffer. This ICU behavior shouldn't have caused a problem in theory. However, WebKit had a bug in visualWordPosition which caused UBreakIterator to not include the succeeding word when traversing words to the left (backwards in LTR text) at the beginning of the last block element with exactly one line box after an non-statically positioned element. In this case, visualWordPosition invokes wordBreakIteratorForMaxOffsetBoundary (because adjacentCharacterPosition is now at the end of the last word in the non-statically positioned element) to setup UBreakIterator. Because there are no line boxes left in the current line (in the last block element with exactly one line box), logicallyNextBox enters the while loop and invoke nextRootInlineBoxCandidatePosition to find the next root line box. However, the visible position given to this function is at the beginning of the first word in the block element. As a result, nextRootInlineBoxCandidatePosition skips over this entire line and finds no line box after the one we had in the non-statically positioned element. Let us consider the following concrete example in which a position: static div is followed by another div, and each div contains text nodes "hello" and "world" respectively: - div position: static (1) - "hello" - div (2) - "world" Suppose we're at the offset 0 of "world", and trying to move to the left. In this case, adjacentCharacterPosition is at offset 5 of "world". The next line box should be that of "world". However, because we invoke logicallyNextBox via wordBreakIteratorForMaxOffsetBoundary with the visible position at offset 0 of "world", it skips this line and return nullptr. This patch addresses this test failure by fixing visualWordPosition by passing adjacentCharacterPosition (at offset 5 of "hello") as the visible position to find the next text box so that nextRootInlineBoxCandidatePosition invoked in logicallyNextBox would not skip the line ("world") from which we started the traversal to find the next line box. Tests: editing/selection/move-by-word-visually-inline-block-positioned-element.html * editing/VisibleUnits.cpp: (WebCore::visualWordPosition): 2018-06-08 Brent Fulgham <bfulgham@apple.com> REGRESSION (r230930): Link drag image is very blurry https://bugs.webkit.org/show_bug.cgi?id=186435 <rdar://problem/40797202> Reviewed by Tim Horton. Tell NSImage the proper display scale factor it needs when performing a 'lockFocus' by passing the correct scaling transform as an NSImageHintCTM. I reviewed the other drag operations (selection, image, and attachment) and confirmed through manual testing that these operations already properly scale the images. It appears that links were the only place where we relied on NSImage to determine and use the relevant device scale factor. * SourcesCocoa.txt: Add new WebKitNSImageExtras.mm file. * WebCore.xcodeproj/project.pbxproj: Update for new files. * platform/graphics/mac/WebKitNSImageExtras.h: Added. * platform/graphics/mac/WebKitNSImageExtras.mm: Added. (-[NSImage _web_lockFocusWithTransform:]): Helper method that takes a device scale factor, creates the relevant scaling NSAffineTransform and passes it to the internal NSImage 'lockFocusWithRect' as the NSImageHintCTM hint. * platform/mac/DragImageMac.mm: (WebCore::createDragImageForLink): Use the new helper function. 2018-06-08 Zalan Bujtas <zalan@apple.com> [LFC] Add vertical margin computation for inline, block-level, inline-block and floating replaced elements https://bugs.webkit.org/show_bug.cgi?id=186432 Reviewed by Antti Koivisto. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Use the computed non-auto values when margin is not auto. (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): 2018-06-07 Yusuke Suzuki <utatane.tea@gmail.com> [WTF] Add WorkerPool https://bugs.webkit.org/show_bug.cgi?id=174569 Reviewed by Carlos Garcia Campos. We start using WorkerPool for NicosiaPaintingEngineThreaded instead of glib thread pool. This makes NicosiaPaintingEngineThreaded platform-independent and usable for WinCairo. * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded): (Nicosia::PaintingEngineThreaded::~PaintingEngineThreaded): (Nicosia::PaintingEngineThreaded::paint): (Nicosia::s_threadFunc): Deleted. * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h: 2018-06-08 Miguel Gomez <magomez@igalia.com> [GTK][WPE] Wrong result when calling ImageBufferCairo's getImageData() https://bugs.webkit.org/show_bug.cgi?id=186384 Reviewed by Michael Catanzaro. Fix calculations so the result is the expected one. * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::getImageData): 2018-06-07 Fujii Hironori <Hironori.Fujii@sony.com> Add base class to get WeakPtrFactory member and avoid some boilerplate code https://bugs.webkit.org/show_bug.cgi?id=186407 <rdar://problem/40922716> Unreviewed WinCairo build fix MediaPlayerPrivateMediaFoundation.cpp(1726): error C2039: 'makeWeakPtr': is not a member of 'WebCore::MediaPlayerPrivateMediaFoundation' No new tests (No behavior change). * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify): 2018-06-07 Chris Dumez <cdumez@apple.com> Add base class to get WeakPtrFactory member and avoid some boilerplate code https://bugs.webkit.org/show_bug.cgi?id=186407 Reviewed by Brent Fulgham. Add CanMakeWeakPtr base class to get WeakPtrFactory member and its getter, in order to avoid some boilerplate code in every class needing a WeakPtrFactory. This also gets rid of old-style createWeakPtr() methods in favor of the newer makeWeakPtr(). * Modules/credentialmanagement/CredentialsMessenger.h: * Modules/credentialmanagement/NavigatorCredentials.cpp: (WebCore::NavigatorCredentials::credentials): * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::doSupportedConfigurationStep): (WebCore::CDM::getConsentStatus): * Modules/encryptedmedia/CDM.h: * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::generateRequest): (WebCore::MediaKeySession::load): (WebCore::MediaKeySession::update): (WebCore::MediaKeySession::close): (WebCore::MediaKeySession::remove): * Modules/encryptedmedia/MediaKeySession.h: * Modules/encryptedmedia/MediaKeys.cpp: (WebCore::MediaKeys::createSession): * Modules/encryptedmedia/MediaKeys.h: * Modules/gamepad/GamepadManager.cpp: (WebCore::GamepadManager::platformGamepadDisconnected): (WebCore::GamepadManager::makeGamepadVisible): * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::MediaDevices): * Modules/mediastream/MediaDevices.h: * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::applyConstraints): * Modules/mediastream/MediaStreamTrack.h: * Modules/webauthn/cocoa/LocalAuthenticator.h: * Modules/webauthn/cocoa/LocalAuthenticator.mm: (WebCore::LocalAuthenticator::makeCredential): * accessibility/AccessibilityRenderObject.h: * accessibility/AccessibilitySVGRoot.cpp: (WebCore::AccessibilitySVGRoot::setParent): * crypto/SubtleCrypto.cpp: (WebCore::SubtleCrypto::encrypt): (WebCore::SubtleCrypto::decrypt): (WebCore::SubtleCrypto::sign): (WebCore::SubtleCrypto::verify): (WebCore::SubtleCrypto::digest): (WebCore::SubtleCrypto::generateKey): (WebCore::SubtleCrypto::deriveKey): (WebCore::SubtleCrypto::deriveBits): (WebCore::SubtleCrypto::importKey): (WebCore::SubtleCrypto::exportKey): (WebCore::SubtleCrypto::wrapKey): (WebCore::SubtleCrypto::unwrapKey): * crypto/SubtleCrypto.h: * css/CSSFontFace.cpp: (WebCore::CSSFontFace::CSSFontFace): (WebCore::CSSFontFace::wrapper): (WebCore::CSSFontFace::setWrapper): * css/DeprecatedCSSOMValue.h: * css/FontFace.cpp: * css/FontFace.h: * css/MediaQueryEvaluator.cpp: (WebCore::MediaQueryEvaluator::MediaQueryEvaluator): * css/StyleSheetContents.h: * css/parser/CSSDeferredParser.cpp: (WebCore::CSSDeferredParser::CSSDeferredParser): * dom/DataTransferItemList.cpp: (WebCore::DataTransferItemList::add): (WebCore::DataTransferItemList::ensureItems const): (WebCore::DataTransferItemList::didSetStringData): * dom/DataTransferItemList.h: * dom/Document.cpp: (WebCore::Document::postTask): (WebCore::Document::hasStorageAccess): (WebCore::Document::requestStorageAccess): * dom/Document.h: (WebCore::Document::setContextDocument): * dom/MessagePort.h: * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::setPictureElement): * html/HTMLInputElement.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader): * html/HTMLMediaElement.h: * html/HTMLPictureElement.h: * html/parser/HTMLResourcePreloader.h: * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::style const): * loader/FormState.h: * loader/LinkLoader.cpp: (WebCore::LinkLoader::preconnectIfNeeded): * loader/LinkLoader.h: * loader/LinkPreloadResourceClients.cpp: (WebCore::LinkPreloadResourceClient::LinkPreloadResourceClient): * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::MediaResourceLoader): * loader/MediaResourceLoader.h: * page/DOMWindow.h: * page/EventHandler.cpp: (WebCore::widgetForElement): (WebCore::EventHandler::updateLastScrollbarUnderMouse): * platform/GenericTaskQueue.cpp: (WebCore::TaskDispatcher<Timer>::postTask): * platform/GenericTaskQueue.h: (WebCore::GenericTaskQueue::enqueueTask): (WebCore::GenericTaskQueue::cancelAllTasks): * platform/ScrollView.h: * platform/ScrollableArea.h: * platform/Scrollbar.h: * platform/Widget.cpp: (WebCore::Widget::setParent): * platform/Widget.h: * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp: (WebCore::AudioFileReader::decodeAudioForBusCreation): * platform/audio/mac/AudioHardwareListenerMac.cpp: (WebCore::AudioHardwareListenerMac::AudioHardwareListenerMac): * platform/audio/mac/AudioHardwareListenerMac.h: * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::CDMInstanceClearKey::requestLicense): (WebCore::CDMInstanceClearKey::updateLicense): (WebCore::CDMInstanceClearKey::loadSession): (WebCore::CDMInstanceClearKey::closeSession): (WebCore::CDMInstanceClearKey::removeSessionData): * platform/encryptedmedia/clearkey/CDMClearKey.h: * platform/graphics/FontCascade.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest): * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: (WebCore::CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability): (WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata): (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime): (WebCore::MediaPlayerPrivateAVFoundationObjC::createSession): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask): * platform/graphics/cv/TextureCacheCV.h: * platform/graphics/cv/TextureCacheCV.mm: (WebCore::TextureCacheCV::textureFromImage): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): * platform/graphics/mac/DisplayRefreshMonitorMac.cpp: (WebCore::DisplayRefreshMonitorMac::displayLinkFired): * platform/graphics/mac/DisplayRefreshMonitorMac.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::setMaskLayer): (WebCore::TextureMapperLayer::setReplicaLayer): * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: (WebCore::MediaPlayerPrivateMediaFoundation::endCreatedMediaSource): (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent): (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify): * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: * platform/ios/RemoteCommandListenerIOS.h: * platform/ios/RemoteCommandListenerIOS.mm: (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS): * platform/mac/RemoteCommandListenerMac.h: * platform/mac/RemoteCommandListenerMac.mm: (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::scheduleDeferredTask): * platform/mediastream/MediaStreamPrivate.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::scheduleDeferredTask): * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): * platform/vr/VRPlatformDisplay.h: * platform/vr/openvr/VRPlatformManagerOpenVR.cpp: (WebCore::VRPlatformManagerOpenVR::getVRDisplays): * rendering/FloatingObjects.h: (WebCore::FloatingObject::setOriginatingLine): * rendering/RenderObject.h: * rendering/RootInlineBox.cpp: * rendering/RootInlineBox.h: * svg/SVGPathElement.h: * svg/SVGPathSegWithContext.h: (WebCore::SVGPathSegWithContext::SVGPathSegWithContext): (WebCore::SVGPathSegWithContext::setContextAndRole): * svg/SVGTransformList.h: * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::baseVal): (WebCore::SVGAnimatedListPropertyTearOff::animVal): * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h: * svg/properties/SVGAnimatedPropertyTearOff.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValuesAndWrappers): * svg/properties/SVGMatrixTearOff.h: * svg/properties/SVGPropertyTearOff.h: * testing/MockCDMFactory.cpp: (WebCore::MockCDMFactory::createCDM): (WebCore::MockCDM::createInstance): * testing/MockCDMFactory.h: * workers/service/ExtendableEvent.h: * workers/service/FetchEvent.cpp: (WebCore::FetchEvent::respondWith): * workers/service/server/SWServer.h: * xml/DOMParser.cpp: (WebCore::DOMParser::DOMParser): 2018-06-07 Chris Dumez <cdumez@apple.com> PopStateEvent should not be cancelable by default https://bugs.webkit.org/show_bug.cgi?id=186420 Reviewed by Darin Adler. PopStateEvent should not be cancelable by default: - https://github.com/web-platform-tests/wpt/pull/11355 - https://html.spec.whatwg.org/#history-traversal All other browsers agree with the specification. No new tests, updated existing tests. * dom/PopStateEvent.cpp: (WebCore::PopStateEvent::PopStateEvent): 2018-06-07 Simon Fraser <simon.fraser@apple.com> Remove a log that was left in by mistake. * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::pruneLiveResourcesToSize): 2018-06-07 Antoine Quint <graouts@apple.com> [ASan / StressGC] DumpRenderTree crashed in com.apple.WebCore: WebCore::EventTarget::ref + 16 https://bugs.webkit.org/show_bug.cgi?id=186207 <rdar://problem/40568747> Reviewed by Dean Jackson. Ensure that we clear the DOM event queue for declarative animations once an animation is cleared for an element since the element can be deleted before events get dispatched asynchronouly for this animation. We also only call AnimationTimeline::removeAnimationsForElement() from RenderTreeUpdater::tearDownRenderers() in the case where we're tearing down the whole document as otherwise this would yield early clearing of the event queue in the case where an element would get a "display: none" style. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimationsForElement): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::~DeclarativeAnimation): (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): * animation/DeclarativeAnimation.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::prepareAnimationForRemoval): * animation/WebAnimation.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2018-06-07 Don Olmstead <don.olmstead@sony.com> [CoordGraphics] Fix compilation errors around USE(COORDINATED_GRAPHICS) https://bugs.webkit.org/show_bug.cgi?id=186374 Reviewed by Žan Doberšek. No new tests. No change in behavior. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp: * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp: * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp: * platform/PlatformWheelEvent.h: * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h: * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h: 2018-06-07 Thibault Saunier <tsaunier@igalia.com> and Alejandro G. Castro <alex@igalia.com> [GTK][WPE] Start implementing MediaStream API https://bugs.webkit.org/show_bug.cgi?id=185787 Reviewed by Philippe Normand. We are adding all the required classes to make the MediaStream API work, that means our own RealtimeMediaSourceCenterLibWebRTC for the platform, the GStreamerCaptureDeviceManager, the audio/video capturers and their respective audio/video sources as well as a dedicated GStreamer Source that adds support for using MediaStream stream inside playbin3. We are using the GstDeviceMonitor to list devices on the devices. Enable mediastream tests. * platform/GStreamer.cmake: Added the new files to the compilation. * platform/audio/AudioStreamDescription.h: Added new GStreamer type. * platform/audio/PlatformAudioData.h: Added new GStreamer type for the GStreamerAudioData class. * platform/graphics/gstreamer/GStreamerCommon.cpp: (WebCore::simpleBusMessageCallback): This function and the next one help us to connect a monitoring callback to a pipeline for debugging. (WebCore::connectSimpleBusMessageCallback): Ditto. * platform/graphics/gstreamer/GStreamerCommon.h: Ditto * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::load): Make use of the loadFull() method. (WebCore::MediaPlayerPrivateGStreamer::loadFull): Very similar to load() but allows specifying what pipeline type to use (null to let the function determine which one should be used). This is required as we force to always use playbin3 for the mediastream source as it relies on the GstStream API. (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Style fix. (WebCore::MediaPlayerPrivateGStreamer::naturalSize const): Added, use MediaStream specific information if available. (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Some style fixes. (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Enhance dotfiles names. (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry): Minor formatting fix. (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Set MediaStream on WebKitMediaStreamSource when setting it up. (WebCore::MediaPlayerPrivateGStreamer::supportsType): Advertise that we support MediaStream if support is built. (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Make sure playbin3 is forced when loading a MediaStream. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add a reference to the MediaStream object and declare loadFull and naturalSize override. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::registerWebKitGStreamerElements): Register the new MediaStreamSrc element. * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer): Make sure that MediaStream MAIN tracks are selected by default. We have no way to do it in MediaStreamSrc now as the GstStreamCollection is recreated by parsebin. * platform/mediastream/RealtimeMediaSource.h: Make CaptureFailed a virtual method as in our mocks we require need to make * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::singleton): Remove the code used for compilation for the platform when we do not have a RealtimeMediaSourceCenterLibWebRTC. Now we return the proper class for the platform. * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp: Added class representing the RealtimeMediaSource for the Audio with GStreamer. * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h: Ditto. * platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp: Added this class that represents the GStreamer pipeline that captures audio from the system devices, it inherits from GStreamerCapturer. * platform/mediastream/gstreamer/GStreamerAudioCapturer.h: Dito. * platform/mediastream/gstreamer/GStreamerAudioData.h: Added this class implementing PlatformAudioData for the GStreamer platform, used to pass the samples information. * platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h: Added this class implementing AudioStreamDescription to export the information about the audio stream to libwebrtc. * platform/mediastream/gstreamer/GStreamerCaptureDevice.h: Added this base class for the audio and video capturing devices, it implements general WebKit CaptureDevice class. * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp: Added this class that implements the system monitor to get the list of available devices in the system. It uses GstDeviceMonitor to handle the operation. It uses two singleton device managers one for audio and another one for video, as required by the RealtimeMediaSourceCenter design. * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: Ditto. * platform/mediastream/gstreamer/GStreamerCapturer.cpp: Added this base class representing how GStreamer captures the media from the input devices in the system. Two classes inherit from this one to capture audio and video. It setups the GStreamer pipeline and adds functions to control it. * platform/mediastream/gstreamer/GStreamerCapturer.h: Ditto. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Added. Implements a subclass of GstBin as a source element that will contain several GstAppSrc, basically one per MediaStreamTrackPrivate of the MediaStreamPrivate passed in parameter. It adds Observers on the MediaStreamTracks and pushes the data to the sources as required. The element implements the GstURIHandler interface so it can be used in playbin. The MediaPlayerPrivateGStreamer is responsible for passing the MediaStreamPrivate object to the source when required. (WebCore::webkitMediaStreamSrcPadProbeCb): Event probe that fixes stream_start events (setting the ID etc) and finally add src pads to the pipeline. * platform/mediastream/gstreamer/GStreamerMediaStreamSource.h: Ditto. * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp: Added this RealtimeMediaSource representing the source of the video data for the GStreamer platform. It handles the settings and capabilities of the source and creates the capturer used to control the operation of the stream. * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h: Ditto. * platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp: Added this class that inherits from the GStreamerCapturer and controls the GStreamer pipelines of the video streams of the system. * platform/mediastream/gstreamer/GStreamerVideoCapturer.h: Ditto. * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: Added. Implementation of a Mock capturer for audio stream. Subclasses GStreamerAudioCapturer and wraps a MockRealtimeAudioSource so that the behaviour is the same a MockRealtimeAudioSource but still the GStreamer implementation code paths are tested. * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h: Ditto. * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp: Added. Implementation of a Mock capturer for video stream. Subclasses GStreamerVideoCapturer and wraps a MockRealtimeVideoSource so that the behaviour is the same a MockRealtimeVideoSource but still the GStreamer implementation code paths are tested. * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h: Ditto. * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp: Added this class that implements the key RealtimeMediaSourceCenter functions to configure the base class for the platform, using the other GStreamer classes. * platform/mock/MockRealtimeAudioSource.cpp: Do not build ::create if GStreamer implementation is built * platform/mock/MockRealtimeVideoSource.cpp: Do not build ::create if GStreamer implementation is built 2018-06-07 Brent Fulgham <bfulgham@apple.com> Handle Storage Access API calls in the absence of an attached frame https://bugs.webkit.org/show_bug.cgi?id=186373 <rdar://problem/40028265> Reviewed by Daniel Bates. Tests: http/tests/storageAccess/has-storage-access-crash.html http/tests/storageAccess/request-storage-access-crash.html The new frame-specific storage access checks were done without confirming a frame was present, although the frame state was validated in other parts of the same method. This patch checks for a non-null frame before making frame-specific calls. * dom/Document.cpp: (WebCore::Document::hasStorageAccess): (WebCore::Document::requestStorageAccess): 2018-06-07 Zalan Bujtas <zalan@apple.com> [LFC] Merge height and vertical margin computation https://bugs.webkit.org/show_bug.cgi?id=186394 Reviewed by Antti Koivisto. To match the spec (and the width/horizontal margin computation). -currently with default values. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeFloatingHeight const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): (WebCore::Layout::outOfFlowNonReplacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeight): Deleted. (WebCore::Layout::floatingNonReplacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeight): Deleted. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted. (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeight): Deleted. 2018-06-07 Antti Koivisto <antti@apple.com> Don't start service worker fetch when there is substitute data https://bugs.webkit.org/show_bug.cgi?id=186349 <rdar://problem/38881568> Reviewed by Youenn Fablet. Loading content via WKWebView.loadData may also end up starting a main resource service worker fetch. This breaks DocumentWriter assumptions. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::tryLoadingRequestFromApplicationCache): (WebCore::DocumentLoader::tryLoadingSubstituteData): Factor substitute resource loading out from tryLoadingRequestFromApplicationCache. (WebCore::DocumentLoader::startLoadingMainResource): If we have substitute data already (typically from WKWebView.loadData), allow service worker registration but load the main resource using the substitute data. (WebCore::DocumentLoader::handleSubstituteDataLoadSoon): Deleted. Merge to tryLoadingSubstituteData. * loader/DocumentLoader.h: 2018-06-07 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Fix the way GstStreamCollection is handled https://bugs.webkit.org/show_bug.cgi?id=184588 Reviewed by Philippe Normand. The stream collection message replaces the collection of stream previously advertised, this means that we should rebuild our set of Track from scratch and not update previously exposed tracks. In the end, this simplifies the code as we do not care about what tracks existed previously, we just need to expose what GStreamer tells us, deleting any previous state. Handle the STREAM_COLLECTION message from the sync handler so that tracks are updated before we mark the pipeline as READY for the live case (everything happen synchronously with the call to the `load()` method in that case), the update still always happens on the main thread. No new tests is added as this is mostly refactoring, it is already tested and it will fix MediaStream tests that are currently disabled as the support is being implemented in #185787. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::clearTracks): Removes all tracks. (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Updates configured tracks from the new GstStreamColection track. (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Stop handling GST_STREAM_COLLECTION event. (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): Handle stream collection event synchronously. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add handleSyncMessage 2018-06-07 Michael Catanzaro <mcatanzaro@igalia.com> Remove unused image encoders https://bugs.webkit.org/show_bug.cgi?id=186365 Reviewed by Carlos Garcia Campos. * platform/image-encoders/JPEGImageEncoder.cpp: Removed. * platform/image-encoders/JPEGImageEncoder.h: Removed. * platform/image-encoders/PNGImageEncoder.cpp: Removed. * platform/image-encoders/PNGImageEncoder.h: Removed. 2018-06-06 Youenn Fablet <youenn@apple.com> HTTP Header values validation is too strict https://bugs.webkit.org/show_bug.cgi?id=167112 Reviewed by Alex Christensen. Moving header values and names from DOMString to ByteString as per spec. Updating WebCore::isValidHTTPHeaderValue as per https://fetch.spec.whatwg.org/#terminology-headers. Covered by rebased and updated tests. Updated test is now also passing in other browsers. * platform/network/HTTPParsers.cpp: (WebCore::isValidHTTPHeaderValue): 2018-06-06 Youenn Fablet <youenn@apple.com> Add Accept-Encoding: identity to Range requests https://bugs.webkit.org/show_bug.cgi?id=186335 <rdar://problem/40837190> Reviewed by Eric Carlson. Tests: imported/w3c/web-platform-tests/fetch/range/general.any.html imported/w3c/web-platform-tests/fetch/range/general.any.worker.html * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::updateHTTPRequestHeaders): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::updateAcceptEncodingHeader): * loader/cache/CachedResourceRequest.h: 2018-06-06 Per Arne Vollan <pvollan@apple.com> Display links are sometimes not notifying WebCore when fired. https://bugs.webkit.org/show_bug.cgi?id=186367 <rdar://problem/40439109> Reviewed by Brent Fulgham. When the WebContent process is receiving an IPC message notifying about a screen update, all display refresh monitors are notified by the manager in DisplayRefreshMonitorManager::displayWasUpdated(). The manager checks that the monitor is scheduled before notifying. This is a problem, since the scheduled flag is always set to false in the DisplayRefreshMonitor::displayDidRefresh() method, when the monitor is first notified about a screen update. This can lead to display links running without notifying the monitors, causing extra CPU usage. It can also prevent them from being deleted, since the monitors are not notified. Instead, we can check that the display refresh monitor is active before notifying it. This matches the original display link implementation used when the WebContent process has WindowServer access, where the monitors are always notified. No new tests, since I have not been able to reproduce this in a test case yet. * platform/graphics/DisplayRefreshMonitorManager.cpp: (WebCore::DisplayRefreshMonitorManager::displayWasUpdated): 2018-06-06 Antoine Quint <graouts@apple.com> Rename color-filter to -apple-color-filter and do not expose it to Web content https://bugs.webkit.org/show_bug.cgi?id=186306 <rdar://problem/39874167> Reviewed by Simon Fraser. Rename the color-filter CSS property to -apple-color-filter. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::checkForMatchingColorFilterFunctionLists): * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSGradientValue.cpp: (WebCore::CSSGradientValue::image): (WebCore::CSSGradientValue::computeStops): (WebCore::CSSGradientValue::knownToBeOpaque const): * css/CSSProperties.json: * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::checkForMatchingColorFilterFunctionLists): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::checkForMatchingColorFilterFunctionLists): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintMarkedTextForeground): (WebCore::InlineTextBox::paintMarkedTextDecoration): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint const): (WebCore::RenderStyle::visitedDependentColorWithColorFilter const): (WebCore::RenderStyle::colorByApplyingColorFilter const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::mutableAppleColorFilter): (WebCore::RenderStyle::appleColorFilter const): (WebCore::RenderStyle::hasAppleColorFilter const): (WebCore::RenderStyle::setAppleColorFilter): (WebCore::RenderStyle::initialAppleColorFilter): (WebCore::RenderStyle::mutableColorFilter): Deleted. (WebCore::RenderStyle::colorFilter const): Deleted. (WebCore::RenderStyle::hasColorFilter const): Deleted. (WebCore::RenderStyle::setColorFilter): Deleted. (WebCore::RenderStyle::initialColorFilter): Deleted. * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): (WebCore::StyleRareInheritedData::hasColorFilters const): * rendering/style/StyleRareInheritedData.h: 2018-06-06 Jer Noble <jer.noble@apple.com> REGRESSION (r231817?): Layout Test media/track/track-delete-during-setup.html is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=185889 <rdar://problem/40583180> Reviewed by Eric Carlson. Explicitly update the network and ready states when detaching the AVPlayerItem from the AVPlayer. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData): 2018-06-06 Antoine Quint <graouts@apple.com> Use the default label for snapshotted plug-ins if no mime-type is available https://bugs.webkit.org/show_bug.cgi?id=186348 Reviewed by Jon Lee. In case the mime-type is not available, use the default labels otherwise we'd crash trying to look up the empty string in the HashMap. * html/HTMLPlugInImageElement.cpp: (WebCore::titleText): (WebCore::subtitleText): 2018-06-06 Timothy Hatcher <timothy@apple.com> Wrong NSVisualEffectMaterial used for exit full screen overlay in dark mode. https://bugs.webkit.org/show_bug.cgi?id=186350 rdar://problem/39135535 Reviewed by Anders Carlsson. * platform/mac/WebCoreFullScreenPlaceholderView.mm: (-[WebCoreFullScreenPlaceholderView initWithFrame:]): Use the NSVisualEffectMaterialFullScreenUI on macOS 10.14 and don't set an explicit NSAppearance. 2018-06-06 Jer Noble <jer.noble@apple.com> Regions outside of the fullscreen window are exposed during zoom operations https://bugs.webkit.org/show_bug.cgi?id=186330 <rdar://problem/34698009> Reviewed by Simon Fraser. Test: fullscreen/full-screen-layer-dump.html Introduce the concept of "requiresBackgroundLayer" to RenderLayerBacking, for use by RenderFullScreen. Previously, the backgroundLayer in RenderLayerBacking was only used by the root renderer with fixed backgrounds. Give the RenderFullScreen a background layer that's approximately 3x as tall and wide as the renderer itself, so nothing is exposed during pinch operations. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::RenderLayerBacking): (WebCore::RenderLayerBacking::updateConfiguration): (WebCore::RenderLayerBacking::updateGeometry): (WebCore::RenderLayerBacking::updateDrawsContent): (WebCore::RenderLayerBacking::setRequiresBackgroundLayer): (WebCore::RenderLayerBacking::updateBackgroundLayer): (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor): (WebCore::RenderLayerBacking::paintIntoLayer): * rendering/RenderLayerBacking.h: 2018-06-06 Jer Noble <jer.noble@apple.com> Set the AVAssetResourceLoaderRequest's contentType to AVStreamingKeyDeliveryContentKeyType in the case of a FPS key request. https://bugs.webkit.org/show_bug.cgi?id=186328 <rdar://problem/40829228> Reviewed by Eric Carlson. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance): 2018-06-06 Zalan Bujtas <zalan@apple.com> [LFC] Add margin computation for floating, replaced elements. https://bugs.webkit.org/show_bug.cgi?id=186337 Reviewed by Antti Koivisto. If 'margin-left' or 'margin-right' are computed as 'auto', their used value is '0'. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): 2018-06-06 Zalan Bujtas <zalan@apple.com> [LFC] Add margin computation for floating, no-replaced elements. https://bugs.webkit.org/show_bug.cgi?id=186334 Reviewed by Antti Koivisto. If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): 2018-06-06 Antti Koivisto <antti@apple.com> Use minimal coverage rect for tiled layers when under memory pressure https://bugs.webkit.org/show_bug.cgi?id=186185 <rdar://problem/40713608> Reviewed by Darin Adler. We do this for the main content layer already. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect): 2018-06-05 Antoine Quint <graouts@apple.com> [Web Animations] Only expose CSSAnimation and CSSTransition if the WebAnimationsCSSIntegration runtime flag is enabled https://bugs.webkit.org/show_bug.cgi?id=186305 Reviewed by Dean Jackson. * animation/CSSAnimation.idl: * animation/CSSTransition.idl: 2018-06-05 Per Arne Vollan <pvollan@apple.com> Move OpenGL display mask to screen data struct. https://bugs.webkit.org/show_bug.cgi?id=186198 <rdar://problem/40724854> Reviewed by Brent Fulgham. Currently, the OpenGL display mask is a global in the WebContent process. This is not correct in all cases, since it is possible to have two Web views in the same WebContent process, displayed on different displays. This can be resolved by moving the OpenGL display mask to a new ScreenData struct, containing information specific to each display. The display ID of the host window is used to find the OpenGL display mask when needed. This patch makes the host window available when creating an IOSurface, in order to find the right OpenGL display mask. If no host window is available, the OpenGL display mask of the main display is used. No new tests, since testing this requires two Web views in the same WebContent process, displayed on two different monitors. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::createImageBuffer const): * platform/PlatformScreen.h: * platform/ScreenProperties.h: (WebCore::ScreenProperties::encode const): (WebCore::ScreenProperties::decode): (WebCore::ScreenData::encode const): (WebCore::ScreenData::decode): * platform/graphics/GraphicsContext3D.h: * platform/graphics/ImageBuffer.cpp: (WebCore::ImageBuffer::create): * platform/graphics/ImageBuffer.h: * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::createCompatibleBuffer): (WebCore::ImageBuffer::ImageBuffer): * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::GraphicsContext3D::GraphicsContext3D): (WebCore::GraphicsContext3D::allowOfflineRenderers const): (WebCore::GraphicsContext3D::setOpenGLDisplayMask): Deleted. (WebCore::GraphicsContext3D::getOpenGLDisplayMask): Deleted. * platform/graphics/cocoa/IOSurface.h: * platform/graphics/cocoa/IOSurface.mm: (WebCore::IOSurface::ensurePlatformContext): * platform/mac/PlatformScreenMac.mm: (WebCore::screenProperties): (WebCore::collectScreenProperties): (WebCore::setScreenProperties): (WebCore::screenData): (WebCore::primaryOpenGLDisplayMask): (WebCore::displayMaskForDisplay): (WebCore::getScreenProperties): (WebCore::screenIsMonochrome): (WebCore::screenHasInvertedColors): (WebCore::screenDepth): (WebCore::screenDepthPerComponent): (WebCore::screenRectForDisplay): (WebCore::screenRect): (WebCore::screenAvailableRect): (WebCore::screenColorSpace): (WebCore::screenSupportsExtendedColor): 2018-06-05 Jer Noble <jer.noble@apple.com> REGRESSION (231817): Videos permanently blank out after switching out of a tab and back in https://bugs.webkit.org/show_bug.cgi?id=186326 <rdar://problem/40778157> Reviewed by Eric Carlson. Check whether the element is visible in the viewport when the web view itself becomes visible, and if so, clear the m_elementIsHiddenUntilVisibleInViewport flag. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::visibilityChanged): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 2018-06-05 Zalan Bujtas <zalan@apple.com> [LFC] Move inflow, replaced width and margin computation to a dedicated function. https://bugs.webkit.org/show_bug.cgi?id=186327 Reviewed by Sam Weinig. I was searching for the function inFlowReplacedWidthAndMargin() and there was none. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): 2018-06-05 Zalan Bujtas <zalan@apple.com> [LFC] Add missing margins for inflow, non replaced block and replaced inline elements https://bugs.webkit.org/show_bug.cgi?id=186332 Reviewed by Darin Adler. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): 2018-06-05 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Spelling errors in the middle of an inserted paragraph are not displayed https://bugs.webkit.org/show_bug.cgi?id=185584 <rdar://problem/38676081> Reviewed by Ryosuke Niwa. Currently when typing, we only consider the range of adjacent words when determining where to place spelling correction markers, even though we provide NSSpellChecker with the full context of the sentence (and get back results encompassing the full range). In macOS Mojave, NSSpellChecker may now return spell checking results that include correctly spelled words that are misused in the context of the sentence. This means that while typing a sentence, a different part of the sentence may gain or lose spelling markers as a result. To support this, WebKit needs to mark or unmark spelling corrections in the full range of the sentence whenever a full word is typed (since the context of other words within the sentence may have changed, resulting in different platform spellchecking results). In markMisspellingsAfterTypingToWord, we expand the spell checking range past the adjacent words so that it encompasses the largest subrange of the full sentence that includes the start of the typed word, and does not include any position that is under an element with `spellcheck=false`. This guarantees that we don't erroneously place spelling document markers under elements where spellchecking is disabled, while allowing for sentence retro corrections when spellchecking is enabled. However, this doesn't handle the case where an element with spellchecking disabled lies between a sentence retro correction range and the currently typed word. In the future, we could fix this by refactoring SpellCheckRequest to track a list of non-contiguous spelling correction ranges — see the FIXME in markMisspellingsAfterTypingToWord for more detail. Covered by 2 new layout tests, as well as an existing spell-checking test that should now be passing. Tests: editing/spelling/retro-correction-spelling-markers.html editing/spelling/spelling-markers-after-pasting-sentence.html * editing/Editor.cpp: (WebCore::Editor::markMisspellingsAfterTypingToWord): * testing/Internals.h: * testing/Internals.idl: Add an internal testing helper to determine whether retro sentence corrections are enabled. 2018-06-05 Darin Adler <darin@apple.com> [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers https://bugs.webkit.org/show_bug.cgi?id=186324 Reviewed by Anders Carlsson. * platform/FileMonitor.h: Use OSObjectPtr instead of DispatchPtr. * platform/cocoa/FileMonitorCocoa.mm: (WebCore::FileMonitor::FileMonitor): Ditto. 2018-06-05 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, fix the macOS build with recent SDKs. * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::paintContents): 2018-06-05 Brent Fulgham <bfulgham@apple.com> Adjust compile and runtime flags to match shippable state of features https://bugs.webkit.org/show_bug.cgi?id=186319 <rdar://problem/40352045> Reviewed by Maciej Stachowiak, Jon Lee, and others. * Configurations/FeatureDefines.xcconfig: Don't build ENABLE_INPUT_TYPE_COLOR or ENABLE_INPUT_TYPE_COLOR_POPOVER. 2018-06-05 Timothy Hatcher <timothy@apple.com> Clean up LocalDefaultSystemAppearance and prefers-dark-interface media query https://bugs.webkit.org/show_bug.cgi?id=186323 rdar://problem/38382252 Reviewed by Tim Horton. * css/MediaFeatureNames.h: * css/MediaQueryEvaluator.cpp: (WebCore::prefersDarkInterfaceEvaluate): (WebCore::defaultAppearanceEvaluate): Deleted. * css/MediaQueryExpression.cpp: (WebCore::featureWithValidIdent): (WebCore::isFeatureValidWithoutValue): * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): 2018-06-05 Darin Adler <darin@apple.com> [Cocoa] Improve some soft linking compatibility with ARC https://bugs.webkit.org/show_bug.cgi?id=186309 Reviewed by Anders Carlsson. * platform/audio/ios/AudioSessionIOS.mm: Use SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER for NSString constants. * platform/audio/ios/MediaSessionManagerIOS.mm: Ditto. * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: Ditto. * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: Ditto. * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm: Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::synchronizeTextTrackState): Use __bridge for some bridging casts. (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): Ditto. (WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: Use SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER for NSString constants. * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: Ditto. * platform/mediastream/mac/AVCaptureDeviceManager.mm: Ditto. * platform/mediastream/mac/AVMediaCaptureSource.mm: Ditto. * platform/mediastream/mac/AVVideoCaptureSource.mm: Ditto. 2018-06-05 Youenn Fablet <youenn@apple.com> ServiceWorker registration should store any script fetched through importScripts https://bugs.webkit.org/show_bug.cgi?id=182444 <rdar://problem/37164835> Reviewed by Chris Dumez. Covered by added test http/wpt/service-workers/persistent-importScripts.html. Update importScripts implementation to look for/update the resource map in case of service worker scope. This resource map is stored persistently and sent when running the service worker. Add support to persistent storage of this resource map. This requires updating the schema database. The schema version is bumped to 2 and we delete any data related to old registrations. When updating the service worker, the resource map is currently flushed so that all scripts will be retrieved from the network. Did some limited refactoring to put more loading handling in WorkerScriptLoader. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): (WebCore::WorkerScriptLoader::script): * workers/WorkerScriptLoader.h: * workers/service/ServiceWorkerContextData.cpp: (WebCore::ServiceWorkerContextData::isolatedCopy const): * workers/service/ServiceWorkerContextData.h: (WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const): (WebCore::ServiceWorkerContextData::ImportedScript::encode const): (WebCore::ServiceWorkerContextData::ImportedScript::decode): (WebCore::ServiceWorkerContextData::encode const): (WebCore::ServiceWorkerContextData::decode): * workers/service/ServiceWorkerGlobalScope.cpp: (WebCore::ServiceWorkerGlobalScope::scriptResource const): (WebCore::ServiceWorkerGlobalScope::setScriptResource): * workers/service/ServiceWorkerGlobalScope.h: * workers/service/context/SWContextManager.h: * workers/service/server/RegistrationDatabase.cpp: (WebCore::v1RecordsTableSchema): (WebCore::RegistrationDatabase::doPushChanges): (WebCore::RegistrationDatabase::importRecords): * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistrationFromStore): (WebCore::SWServer::updateWorker): (WebCore::SWServer::installContextData): * workers/service/server/SWServer.h: * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptFetchFinished): * workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::setScriptResource): * workers/service/server/SWServerToContextConnection.h: * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::SWServerWorker): (WebCore::m_scriptResourceMap): (WebCore::SWServerWorker::contextData const): (WebCore::SWServerWorker::setScriptResource): * workers/service/server/SWServerWorker.h: 2018-06-05 Brent Fulgham <bfulgham@apple.com> Revise DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to work properly on Apple builds https://bugs.webkit.org/show_bug.cgi?id=186286 <rdar://problem/40782992> Reviewed by Dan Bernstein. Use the WK_RELOCATABLE_FRAMEWORKS flag (which is always defined for non-production builds) to define ENABLE(EXPERIMENTAL_FEATURES) so that we do not need to manually change this flag when preparing for a production release. * Configurations/FeatureDefines.xcconfig: Use WK_RELOCATABLE_FRAMEWORKS to determine whether experimental features should be enabled, and use it to properly define the feature flag. 2018-06-05 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix after r232511. https://bugs.webkit.org/show_bug.cgi?id=186304 * platform/ios/WebItemProviderPasteboard.mm: Add missing include. 2018-06-05 Antoine Quint <graouts@apple.com> Fix the iOS build after r232496 https://bugs.webkit.org/show_bug.cgi?id=186304 Reviewed by Brent Fulgham. The changes in r232496 changed the InputType::element() signature from HTMLInputElement& to HTMLInputElement* and some call sites did not expect that. * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent): (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree): (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue): (WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue): (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent): (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent): (WebCore::BaseChooserOnlyDateAndTimeInputType::accessKeyAction): (WebCore::BaseChooserOnlyDateAndTimeInputType::isMouseFocusable const): * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::setValueAsDate const): (WebCore::BaseDateAndTimeInputType::valueAsDouble const): (WebCore::BaseDateAndTimeInputType::setValueAsDecimal const): (WebCore::BaseDateAndTimeInputType::typeMismatch const): (WebCore::BaseDateAndTimeInputType::serializeWithComponents const): (WebCore::BaseDateAndTimeInputType::localizeValue const): (WebCore::BaseDateAndTimeInputType::visibleValue const): (WebCore::BaseDateAndTimeInputType::valueMissing const): (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const): * html/DateInputType.cpp: (WebCore::DateInputType::createStepRange const): * html/DateTimeLocalInputType.cpp: (WebCore::DateTimeLocalInputType::createStepRange const): * html/MonthInputType.cpp: (WebCore::MonthInputType::valueAsDate const): (WebCore::MonthInputType::createStepRange const): * html/TimeInputType.cpp: (WebCore::TimeInputType::createStepRange const): * html/WeekInputType.cpp: (WebCore::WeekInputType::createStepRange const): 2018-06-03 Darin Adler <darin@apple.com> Simplify and remove some unused video element code (helpful for ARC-compatibility) https://bugs.webkit.org/show_bug.cgi?id=186258 Reviewed by Daniel Bates. My main mission was to remove the PlatformMedia struct, which had a union of Objective-C object pointers in it, which doesn't work in ARC. However, I found some other unused code to remove and simple mistakes to fix. * Modules/mediasource/VideoPlaybackQuality.cpp: (WebCore::VideoPlaybackQuality::create): Use unsigned instead of unsigned long, since IDL "unsigned long" really means unsigned. (WebCore::VideoPlaybackQuality::VideoPlaybackQuality): Ditto. * Modules/mediasource/VideoPlaybackQuality.h: Updated for the above. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::platformMedia const): Deleted. * html/HTMLMediaElement.h: Updated for the above. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::MediaPlayer): Moved initialization of many data members to the class definition. (WebCore::MediaPlayer::load): Use nullptr instead of 0. (WebCore::MediaPlayer::platformMedia const): Deleted. (WebCore::MediaPlayer::videoPlaybackQualityMetrics): Updated name of return type. (WebCore::MediaPlayer::objCAVFoundationAVPlayer const): Added. Replaces platformMedia for the one case where it was being used. * platform/graphics/MediaPlayer.h: Removed unneeded includes. Re-sorted things. Updated for the above. Removed PlatformMedia struct and NoPlatformMedia constant. Removed explicit constructor in MediaEngineSupportParameters. Renamed PlatformVideoPlaybackQualityMetrics struct to VideoPlaybackQualityMetrics, removed its constructor, and changed types from unsigned long to unsigned. Un-nested #if statements. Removed some Chromium-specific comments. * platform/graphics/MediaPlayerPrivate.h: Removed unneeded includes and forward declarations. Removed platformMedia. Updated return type for videoPlaybackQualityMetrics. Added objCAVFoundationAVPlayer. * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: Removed platformMedia. * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: (WebCore::MediaPlayerPrivateAVFoundation::platformMedia const): Deleted. * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h: Updated for the above. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: Added override of objCAVFoundationAVPlayer. Removed platformMedia. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const): Deleted. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: Removed platformMedia. Updated return type for videoPlaybackQualityMetrics. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformMedia const): Deleted. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics): Updated return type, changed to use aggregate initialization instead of calling a constructor, and added casts to unsigned. * platform/graphics/cocoa/WebCoreDecompressionSession.h: Switched from unsigned long to unsigned for frame counts and from long to int for quality of service tier. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::platformMedia): Deleted. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: Updated for the above. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: Removed videoPlaybackQualityMetrics since it was overriding a derived function without changing its behavior, and the type has changed. * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: (WebCore::MockMediaPlayerMediaSource::load): Pass two references. (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics): Updated return type. * platform/mock/mediasource/MockMediaPlayerMediaSource.h: Updated for the above. * platform/mock/mediasource/MockMediaSourcePrivate.cpp: (WebCore::MockMediaSourcePrivate::create): Return a Ref, take references. (WebCore::MockMediaSourcePrivate::MockMediaSourcePrivate): Moved most data member initialization into the class definition. Take references. (WebCore::MockMediaSourcePrivate::~MockMediaSourcePrivate): Use a modern for loop. (WebCore::MockMediaSourcePrivate::durationChanged): Update since m_player is a reference. (WebCore::MockMediaSourcePrivate::markEndOfStream): Ditto. (WebCore::MockMediaSourcePrivate::readyState): Ditto. (WebCore::MockMediaSourcePrivate::setReadyState): Ditto. (WebCore::MockMediaSourcePrivate::waitForSeekCompleted): Ditto. (WebCore::MockMediaSourcePrivate::seekCompleted): Ditto. (WebCore::MockMediaSourcePrivate::removeSourceBuffer): Use Vector::removeFirst instead of find/remove pairs. (WebCore::MockMediaSourcePrivate::sourceBufferPrivateDidChangeActiveState): Ditto. (WebCore::MockMediaSourcePrivate::seekToTime): Use modern for loop. (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics): Updated return type, changed to use aggregate initialization instead of calling a constructor. * platform/mock/mediasource/MockMediaSourcePrivate.h: Updated for the above. * platform/mock/mediasource/MockSourceBufferPrivate.cpp: (WebCore::MockSourceBufferPrivate::readyState): Updated since player is now a reference. (WebCore::MockSourceBufferPrivate::setReadyState): Ditto. 2018-06-04 Darin Adler <darin@apple.com> [Cocoa] Improve smart pointer support for ARC (OSObjectPtr/DispatchPtr) https://bugs.webkit.org/show_bug.cgi?id=186300 Reviewed by Daniel Bates. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: Removed unnecessary include of OSObjectPtr.h. * platform/ios/WebItemProviderPasteboard.mm: Ditto. 2018-06-05 Joanmarie Diggs <jdiggs@igalia.com> AX: Implement support for new blockquote, caption, and paragraph ARIA roles https://bugs.webkit.org/show_bug.cgi?id=186274 Reviewed by Chris Fleizach. Add the three new ARIA roles to the internal rolemap so that they are treated in the same fashion as their HTML element counterparts. Also ensure that an element with an explicit caption role does not get pruned from the macOS accessibility tree. No new tests. Instead add the roles to the existing role-exposure tests. * accessibility/AccessibilityObject.cpp: (WebCore::initializeRoleMap): * accessibility/mac/AccessibilityObjectMac.mm: (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (createAccessibilityRoleMap): 2018-06-05 Zalan Bujtas <zalan@apple.com> [LFC] Merge width and margin computation for block-level, replaced elements in normal flow https://bugs.webkit.org/show_bug.cgi?id=186270 Reviewed by Sam Weinig. https://www.w3.org/TR/CSS22/visudet.html#block-replaced-width 10.3.4 Block-level, replaced elements in normal flow The used value of 'width' is determined as for inline replaced elements. Then the rules for non-replaced block-level elements are applied to determine the margins. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): 2018-06-04 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][MSE] MediaPlayerPrivateGStreamerMSE.h includes and forward declares PlaybackPipeline https://bugs.webkit.org/show_bug.cgi?id=186190 Reviewed by Xabier Rodriguez-Calvar. This is just a compilation improvement. * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: 2018-06-03 Darin Adler <darin@apple.com> [Cocoa] Update more code to be more ARC-compatible to prepare for future ARC adoption https://bugs.webkit.org/show_bug.cgi?id=186245 Reviewed by Daniel Bates. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (convertToNSArray): Explicitly cast to WebAccessibilityObjectWrapperBase so we don't make method calls on WebAccessibilityObjectWrapper, a forward-declared class. (-[WebAccessibilityObjectWrapperBase convertPathToScreenSpace:]): Use CFAutorelease for the CGPathRef return value instead of Objective-C autorelease. Another option would be to use RetainPtr for the return type instead. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (AXObjectIsTextMarker): Use __bridge for bridging typecast. (AXObjectIsTextMarkerRange): Ditto. (AXTextMarkerRange): Ditto. (AXTextMarkerRangeStart): Ditto. (AXTextMarkerRangeEnd): Ditto. (isTextMarkerIgnored): Ditto. (accessibilityObjectForTextMarker): Ditto. (-[WebAccessibilityObjectWrapper characterOffsetForTextMarker:]): Ditto. (-[WebAccessibilityObjectWrapper visiblePositionForTextMarker:]): Ditto. (visiblePositionForStartOfTextMarkerRange): Ditto. (visiblePositionForEndOfTextMarkerRange): Ditto. (AXAttributeStringSetFont): Ditto. Also use @{} syntax to make NSDictionary and @() to make NSNumber. (AXAttributeStringSetColor): Use __bridge for bridging typecast, rearranging code so that the typecasts are on function arguments, not local variables, which makes lifetimes clearer. (AXAttributeStringSetElement): Use __bridge for bridging typecast. (WebTransformCGPathToNSBezierPath): (-[WebAccessibilityObjectWrapper bezierPathFromPath:]): Added a bridging typecast when passing an NSBezierPath through as a void* context argument; silent conversion to void* is not compatible with ARC. (createAccessibilityRoleMap): Use __unsafe_unretained for a table of NSString constants. * bindings/js/ScriptControllerMac.mm: (WebCore::ScriptController::createScriptInstanceForWidget): Use __bridge for bridging typecast. * bridge/objc/objc_class.mm: (JSC::Bindings::ObjcClass::classForIsA): Added bridging typecasts to convert a Class into a CFTypeRef. (JSC::Bindings::ObjcClass::methodNamed const): Use __bridge for bridging typecast. (JSC::Bindings::ObjcClass::fieldNamed const): Ditto. * bridge/objc/objc_instance.mm: (ObjcInstance::invokeObjcMethod): Ditto. * bridge/objc/objc_runtime.mm: (JSC::Bindings::ObjcField::valueFromInstance const): Ditto. (JSC::Bindings::ObjcField::setValueToInstance const): Ditto. * bridge/objc/objc_utility.mm: (JSC::Bindings::convertObjcValueToValue): Ditto. Also add a missing const to make it clearer to the compiler that the code is correct. * crypto/mac/SerializedCryptoKeyWrapMac.mm: (WebCore::createAndStoreMasterKey): Ditto. (WebCore::findMasterKey): Ditto. * editing/cocoa/DataDetection.mm: (WebCore::detectItemAtPositionWithRange): Ditto. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::fontAttributesForSelectionStart const): Ditto. * editing/cocoa/HTMLConverter.mm: (_font): Ditto. (fileWrapperForElement): Ditto. * fileapi/FileCocoa.mm: (WebCore::File::shouldReplaceFile): Ditto. * loader/archive/cf/LegacyWebArchiveMac.mm: (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Ditto. * page/mac/TextIndicatorWindow.mm: (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Ditto. (createContentCrossfadeAnimation): Ditto. * platform/cocoa/LocalizedStringsCocoa.mm: (WebCore::localizedString): Ditto. * platform/cocoa/SharedBufferCocoa.mm: (WebCore::SharedBuffer::create): Ditto. (WebCore::SharedBuffer::append): Ditto. * platform/graphics/FontPlatformData.h: (WebCore::toCTFont): Ditto. (WebCore::toNSFont): Ditto. * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm: (WebCore::assetTrackMeetsHardwareDecodeRequirements): Ditto. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Ditto. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::MediaDescriptionAVFObjC::MediaDescriptionAVFObjC): Ditto. (WebCore::bufferWasConsumedCallback): Ditto. (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto. * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage): Ditto. (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): Ditto. * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayerCocoa::create): Ditto. (PlatformCALayer::platformCALayer): Ditto. (PlatformCALayerCocoa::superlayer const): Ditto. (PlatformCALayerCocoa::contents const): Ditto. (PlatformCALayerCocoa::setContents): Ditto. * platform/graphics/cocoa/IOSurface.h: Ditto. * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: (TextTrackRepresentationCocoa::update): Ditto. * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample): Ditto. (WebCore::WebCoreDecompressionSession::resetQosTier): Ditto. * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer display]): Ditto. * platform/graphics/mac/ImageMac.mm: (WebCore::BitmapImage::nsImage): Ditto. (WebCore::BitmapImage::snapshotNSImage): Ditto. * platform/graphics/mac/WebLayer.mm: (-[WebLayer drawInContext:]): Ditto. (-[WebSimpleLayer setNeedsDisplay]): Ditto. (-[WebSimpleLayer setNeedsDisplayInRect:]): Ditto. (-[WebSimpleLayer display]): Ditto. (-[WebSimpleLayer drawInContext:]): Ditto. * platform/mac/CursorMac.mm: (WebCore::cursor): Mark pointer __strong to match the globals it points to. * platform/mac/FileSystemMac.mm: (WebCore::FileSystem::setMetadataURL): Use RetainPtr instead of autorelease. * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::bufferForType): Use __bridge for bridging typecast. * platform/mac/PlatformSpeechSynthesizerMac.mm: (WebCore::speechSynthesisGetVoiceIdentifiers): Ditto. (WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale): Ditto. * platform/mac/PluginBlacklist.h: Use RetainPtr instead of explicit retain and release for NSDictionary and NSSet. * platform/mac/PluginBlacklist.mm: (WebCore::PluginBlacklist::create): Use __bridge for bridging typecast. (WebCore::PluginBlacklist::~PluginBlacklist): Remove explicit CFRelease calls. (WebCore::PluginBlacklist::PluginBlacklist): Add adoptNS calls and remove explciit CFRetain/release pairs. * platform/mac/PublicSuffixMac.mm: (WebCore::isPublicSuffix): Use __bridge for bridging typecast. * platform/mac/RemoteCommandListenerMac.mm: (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Ditto. * platform/mac/SerializedPlatformRepresentationMac.mm: (WebCore::jsValueWithDictionaryInContext): Ditto. * platform/mac/URLMac.mm: (WebCore::URL::URL): Ditto. (WebCore::URL::createCFURL const): Ditto. * platform/mac/WebCoreNSURLExtras.mm: (WebCore::collectRangesThatNeedMapping): Mark pointer __strong to match the local variable it eventually points to. (WebCore::stringByTrimmingWhitespace): Use __bridge for bridging typecast. (WebCore::URLByTruncatingOneCharacterBeforeComponent): Use CFBridgingRelease instead of autorelease, reducing typecasts. (WebCore::URLByRemovingComponentAndSubsequentCharacter): Ditto. (WebCore::userVisibleString): Use __bridge for bridging typecast. (WebCore::isUserVisibleURL): Ditto. * platform/mac/WebGLBlacklist.mm: (WebCore::WebGLBlacklist::create): Use __bridge for bridging typecast. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::setPreset): Ditto. (WebCore::AVVideoCaptureSource::setupCaptureSession): Ditto. Also use @() instead of NSNumber. * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Ditto. * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): Ditto. * platform/network/cocoa/ResourceResponseCocoa.mm: Use CFStringRef and CFSTR for constant string array commonHeaderFields rather than using NSString * and then relying on implicit bridging conversion. * platform/network/mac/CertificateInfoMac.mm: (WebCore::CertificateInfo::dump const): Use __bridge for bridging typecast. * platform/network/mac/FormDataStreamMac.mm: (WebCore::createHTTPBodyNSInputStream): Ditto. (WebCore::httpBodyFromStream): Ditto. * platform/network/mac/ResourceErrorMac.mm: (WebCore::ResourceError::ResourceError): Ditto. (WebCore::ResourceError::cfError const): Ditto. * rendering/RenderThemeMac.mm: (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]): Use CFSTR("") instead of @"" for a string that is passed to CFDIctionaryRef. (WebCore::AttachmentLayout::layOutTitle): Use __bridge for bridging typecast. (WebCore::AttachmentLayout::layOutSubtitle): Ditto. * testing/cocoa/WebArchiveDumpSupport.mm: (WebCoreTestSupport::createCFURLResponseFromResponseData): Use __bridge for bridging typecast. (WebCoreTestSupport::supportedNonImageMIMETypes): Deleted. (WebCoreTestSupport::convertWebResourceDataToString): Use the MIMETypeRegistry::isSupportedNonImageMIMEType function directly instead of building a CFArray out of MIMETypeRegistry::getSupportedNonImageMIMETypes and using CFArrayContainsValue. This is both much more direct and much more efficient as well. 2018-06-04 Timothy Hatcher <timothy@apple.com> [Win] REGRESSION(r232486) 'WebCore::RenderTheme::activeListBoxSelectionBackgroundColor': function does not take 0 arguments https://bugs.webkit.org/show_bug.cgi?id=186296 Unreviewed build fix. * platform/win/PopupMenuWin.cpp: (WebCore::PopupMenuWin::paint): * rendering/RenderThemeWin.cpp: (WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const): 2018-06-04 Chris Dumez <cdumez@apple.com> Rename "Cross-Origin-Options" HTTP header to "Cross-Origin-Window-Policy" https://bugs.webkit.org/show_bug.cgi?id=186287 <rdar://problem/40783352> Reviewed by Youenn Fablet. Tests: http/wpt/cross-origin-window-policy/allow-postmessage-from-deny.html http/wpt/cross-origin-window-policy/allow-postmessage.html http/wpt/cross-origin-window-policy/cross-origin-window-policy-header.html http/wpt/cross-origin-window-policy/navigation-from-opener-via-open-target.html http/wpt/cross-origin-window-policy/navigation-from-subframe-via-anchor-target.html * bindings/js/JSDOMBindingSecurity.cpp: (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginWindowPolicy): * bindings/js/JSDOMBindingSecurity.h: * bindings/js/JSDOMWindowCustom.cpp: (WebCore::effectiveCrossOriginWindowPolicyForAccess): (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): (WebCore::JSDOMWindow::getOwnPropertySlotByIndex): (WebCore::addCrossOriginWindowPropertyNames): (WebCore::addScopedChildrenIndexes): * bindings/scripts/CodeGeneratorJS.pm: (GenerateAttributeGetterBodyDefinition): (GetCrossOriginsOptionsFromExtendedAttributeValue): (GenerateAttributeSetterBodyDefinition): (GenerateOperationBodyDefinition): * bindings/scripts/IDLAttributes.json: * dom/Document.cpp: (WebCore::Document::canNavigate): * loader/FrameLoader.cpp: (WebCore::FrameLoader::didBeginDocument): * page/AbstractDOMWindow.cpp: (WebCore::AbstractDOMWindow::AbstractDOMWindow): * page/AbstractDOMWindow.h: (WebCore::AbstractDOMWindow::crossOriginWindowPolicy): (WebCore::AbstractDOMWindow::setCrossOriginWindowPolicy): * page/DOMWindow.idl: * page/Settings.yaml: * platform/network/HTTPHeaderNames.in: * platform/network/HTTPParsers.cpp: (WebCore::parseCrossOriginWindowPolicyHeader): * platform/network/HTTPParsers.h: 2018-06-04 Brent Fulgham <bfulgham@apple.com> REGRESSION(r231291): InputType should hold a WeakPtr to its HTMLInputElement https://bugs.webkit.org/show_bug.cgi?id=186096 <rdar://problem/40651015> Reviewed by Ryosuke Niwa. Now that the InputType may be kept alive as part of in-flight form submissions, we shouldn't assume that the referenced HTMLInputElement is still valid before using it. The only time we should be lacking a referencing element is in cases where the InputType is changing, either through a change in the HTMLInputElement's type attribute. In those cases we should check for a valid HTMLInputElement. In other cases, we should ASSERT. * html/BaseButtonInputType.cpp: (WebCore::BaseButtonInputType::createInputRenderer): (WebCore::BaseButtonInputType::setValue): * html/BaseCheckableInputType.cpp: (WebCore::BaseCheckableInputType::saveFormControlState const): (WebCore::BaseCheckableInputType::restoreFormControlState): (WebCore::BaseCheckableInputType::appendFormData const): (WebCore::BaseCheckableInputType::handleKeydownEvent): (WebCore::BaseCheckableInputType::accessKeyAction): (WebCore::BaseCheckableInputType::setValue): * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::attributeChanged): Add a nullptr check here, since this is called directly by code that causes the old InputType to be removed, which could leave us with a nullptr element(). * html/BaseClickableWithKeyInputType.cpp: (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent): (WebCore::BaseClickableWithKeyInputType::handleKeypressEvent): (WebCore::BaseClickableWithKeyInputType::accessKeyAction): * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::attributeChanged): Add a nullptr check here, since this is called directly by code that causes the old InputType to be removed, which could leave us with a nullptr element(). * html/BaseTextInputType.cpp: (WebCore::BaseTextInputType::patternMismatch const): * html/CheckboxInputType.cpp: (WebCore::CheckboxInputType::valueMissing const): (WebCore::CheckboxInputType::willDispatchClick): (WebCore::CheckboxInputType::didDispatchClick): (WebCore::CheckboxInputType::shouldAppearIndeterminate const): * html/ColorInputType.cpp: (WebCore::ColorInputType::valueAsColor const): (WebCore::ColorInputType::createShadowSubtree): (WebCore::ColorInputType::handleDOMActivateEvent): (WebCore::ColorInputType::didChooseColor): (WebCore::ColorInputType::updateColorSwatch): (WebCore::ColorInputType::shadowColorSwatch const): (WebCore::ColorInputType::elementRectRelativeToRootView const): (WebCore::ColorInputType::shouldShowSuggestions const): (WebCore::ColorInputType::suggestions const): * html/EmailInputType.cpp: (WebCore::EmailInputType::typeMismatchFor const): (WebCore::EmailInputType::typeMismatch const): (WebCore::EmailInputType::typeMismatchText const): (WebCore::EmailInputType::sanitizeValue const): * html/FileInputType.cpp: (WebCore::FileInputType::appendFormData const): (WebCore::FileInputType::attributeChanged): Add a nullptr check here, since this is called directly by code that causes the old InputType to be removed, which could leave us with a nullptr element(). (WebCore::FileInputType::valueMissing const): (WebCore::FileInputType::valueMissingText const): (WebCore::FileInputType::handleDOMActivateEvent): (WebCore::FileInputType::createInputRenderer): (WebCore::FileInputType::setValue): (WebCore::FileInputType::createShadowSubtree): (WebCore::FileInputType::disabledAttributeChanged): (WebCore::FileInputType::multipleAttributeChanged): (WebCore::FileInputType::allowsDirectories const): (WebCore::FileInputType::setFiles): (WebCore::FileInputType::iconLoaded): (WebCore::FileInputType::receiveDroppedFiles): (WebCore::FileInputType::defaultToolTip const): * html/HTMLInputElement.h: (WebCore::HTMLInputElement::weakPtrFactory const): * html/HiddenInputType.cpp: (WebCore::HiddenInputType::saveFormControlState const): (WebCore::HiddenInputType::restoreFormControlState): (WebCore::HiddenInputType::setValue): (WebCore::HiddenInputType::appendFormData const): * html/ImageInputType.cpp: (WebCore::ImageInputType::appendFormData const): (WebCore::ImageInputType::handleDOMActivateEvent): (WebCore::ImageInputType::createInputRenderer): (WebCore::ImageInputType::altAttributeChanged): (WebCore::ImageInputType::srcAttributeChanged): (WebCore::ImageInputType::attach): (WebCore::ImageInputType::height const): (WebCore::ImageInputType::width const): * html/InputType.cpp: (WebCore::InputType::saveFormControlState const): (WebCore::InputType::restoreFormControlState): (WebCore::InputType::isFormDataAppendable const): (WebCore::InputType::appendFormData const): (WebCore::InputType::sizeShouldIncludeDecoration const): (WebCore::InputType::validationMessage const): (WebCore::InputType::createInputRenderer): (WebCore::InputType::blur): (WebCore::InputType::destroyShadowSubtree): (WebCore::InputType::dispatchSimulatedClickIfActive const): (WebCore::InputType::chrome const): (WebCore::InputType::isKeyboardFocusable const): (WebCore::InputType::isMouseFocusable const): (WebCore::InputType::accessKeyAction): (WebCore::InputType::setValue): (WebCore::InputType::visibleValue const): (WebCore::InputType::applyStep): (WebCore::InputType::stepUpFromRenderer): * html/InputType.h: (WebCore::InputType::InputType): (WebCore::InputType::element const): * html/NumberInputType.cpp: (WebCore::NumberInputType::attributeChanged): Add a nullptr check here, since this is called directly by code that causes the old InputType to be removed, which could leave us with a nullptr element(). (WebCore::NumberInputType::setValue): (WebCore::NumberInputType::valueAsDouble const): (WebCore::NumberInputType::setValueAsDouble const): (WebCore::NumberInputType::setValueAsDecimal const): (WebCore::NumberInputType::typeMismatch const): (WebCore::NumberInputType::createStepRange const): (WebCore::NumberInputType::sizeShouldIncludeDecoration const): (WebCore::NumberInputType::decorationWidth const): (WebCore::NumberInputType::localizeValue const): (WebCore::NumberInputType::visibleValue const): (WebCore::NumberInputType::convertFromVisibleValue const): (WebCore::NumberInputType::hasBadInput const): (WebCore::NumberInputType::minOrMaxAttributeChanged): (WebCore::NumberInputType::stepAttributeChanged): * html/RadioInputType.cpp: (WebCore::RadioInputType::valueMissing const): (WebCore::RadioInputType::handleKeydownEvent): (WebCore::RadioInputType::handleKeyupEvent): (WebCore::RadioInputType::isKeyboardFocusable const): (WebCore::RadioInputType::shouldSendChangeEventAfterCheckedChanged): (WebCore::RadioInputType::willDispatchClick): (WebCore::RadioInputType::didDispatchClick): (WebCore::RadioInputType::matchesIndeterminatePseudoClass const): * html/RangeInputType.cpp: (WebCore::RangeInputType::attributeChanged): Add a nullptr check here, since this is called directly by code that causes the old InputType to be removed, which could leave us with a nullptr element(). (WebCore::RangeInputType::valueAsDouble const): (WebCore::RangeInputType::setValueAsDecimal const): (WebCore::RangeInputType::createStepRange const): (WebCore::RangeInputType::handleMouseDownEvent): (WebCore::RangeInputType::handleTouchEvent): (WebCore::RangeInputType::handleKeydownEvent): (WebCore::RangeInputType::createShadowSubtree): (WebCore::RangeInputType::sliderTrackElement const): (WebCore::RangeInputType::createInputRenderer): (WebCore::RangeInputType::accessKeyAction): (WebCore::RangeInputType::minOrMaxAttributeChanged): (WebCore::RangeInputType::setValue): (WebCore::RangeInputType::updateTickMarkValues): * html/ResetInputType.cpp: (WebCore::ResetInputType::handleDOMActivateEvent): * html/SearchInputType.cpp: (WebCore::SearchInputType::addSearchResult): (WebCore::SearchInputType::maxResultsAttributeChanged): (WebCore::SearchInputType::createInputRenderer): (WebCore::SearchInputType::createShadowSubtree): (WebCore::SearchInputType::handleKeydownEvent): (WebCore::SearchInputType::startSearchEventTimer): (WebCore::SearchInputType::searchEventTimerFired): (WebCore::SearchInputType::searchEventsShouldBeDispatched const): (WebCore::SearchInputType::didSetValueByUserEdit): (WebCore::SearchInputType::sizeShouldIncludeDecoration const): * html/SubmitInputType.cpp: (WebCore::SubmitInputType::appendFormData const): (WebCore::SubmitInputType::handleDOMActivateEvent): * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::attributeChanged): Add a nullptr check here, since this is called directly by code that causes the old InputType to be removed, which could leave us with a nullptr element(). (WebCore::TextFieldInputType::isKeyboardFocusable const): (WebCore::TextFieldInputType::isMouseFocusable const): (WebCore::TextFieldInputType::valueMissing const): (WebCore::TextFieldInputType::setValue): (WebCore::TextFieldInputType::handleKeydownEvent): (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): (WebCore::TextFieldInputType::forwardEvent): (WebCore::TextFieldInputType::elementDidBlur): (WebCore::TextFieldInputType::handleFocusEvent): (WebCore::TextFieldInputType::handleBlurEvent): (WebCore::TextFieldInputType::createInputRenderer): (WebCore::TextFieldInputType::shouldHaveSpinButton const): (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator const): (WebCore::TextFieldInputType::createShadowSubtree): (WebCore::TextFieldInputType::handleBeforeTextInsertedEvent): (WebCore::TextFieldInputType::updatePlaceholderText): (WebCore::TextFieldInputType::appendFormData const): (WebCore::TextFieldInputType::subtreeHasChanged): (WebCore::TextFieldInputType::didSetValueByUserEdit): (WebCore::TextFieldInputType::updateInnerTextValue): (WebCore::TextFieldInputType::focusAndSelectSpinButtonOwner): (WebCore::TextFieldInputType::shouldSpinButtonRespondToMouseEvents): (WebCore::TextFieldInputType::shouldSpinButtonRespondToWheelEvents): (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): (WebCore::TextFieldInputType::shouldDrawAutoFillButton const): (WebCore::TextFieldInputType::autoFillButtonElementWasClicked): (WebCore::TextFieldInputType::createContainer): (WebCore::TextFieldInputType::createAutoFillButton): (WebCore::TextFieldInputType::updateAutoFillButton): * html/URLInputType.cpp: (WebCore::URLInputType::typeMismatch const): 2018-06-04 Chris Dumez <cdumez@apple.com> Unreviewed iOS build fix with recent SDKs. * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): 2018-06-04 Dean Jackson <dino@apple.com> AR Badging on transparent thumbnail images makes the glyph look really dark https://bugs.webkit.org/show_bug.cgi?id=186289 <rdar://problem/40627111> Reviewed by Anders Carlsson. Clip out the shape for the drop shadow, so that it isn't visible if there is transparent pixel data on top of it. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintSystemPreviewBadge): 2018-06-04 Timothy Hatcher <timothy@apple.com> Selection color is dark when using Safari in dark mode. https://bugs.webkit.org/show_bug.cgi?id=186288 rdar://problem/38438625 Reviewed by Simon Fraser. Pass StyleColor::Options to all of the selection color functions. Removed supportsSelectionForegroundColors() from RenderThemeMac, to get the default of true, since the forground colors in dark mode can be different now. Use new semantic color methods on NSColor. * rendering/RenderElement.cpp: (WebCore::RenderElement::selectionColor const): (WebCore::RenderElement::selectionBackgroundColor const): * rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItemForeground): (WebCore::RenderListBox::paintItemBackground): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::activeSelectionBackgroundColor const): (WebCore::RenderTheme::inactiveSelectionBackgroundColor const): (WebCore::RenderTheme::activeSelectionForegroundColor const): (WebCore::RenderTheme::inactiveSelectionForegroundColor const): (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const): (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const): (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const): (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const): (WebCore::RenderTheme::platformActiveSelectionForegroundColor const): (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const): (WebCore::RenderTheme::platformInactiveSelectionForegroundColor const): (WebCore::RenderTheme::platformActiveListBoxSelectionBackgroundColor const): (WebCore::RenderTheme::platformActiveListBoxSelectionForegroundColor const): (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const): (WebCore::RenderTheme::platformInactiveListBoxSelectionForegroundColor const): * rendering/RenderTheme.h: * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor const): (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor const): (WebCore::RenderThemeGtk::platformActiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeGtk::platformActiveListBoxSelectionForegroundColor const): (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionForegroundColor const): * rendering/RenderThemeGtk.h: * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeIOS::platformInactiveSelectionBackgroundColor const): * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const): (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const): (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const): (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const): * rendering/RenderThemeWin.cpp: (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const): (WebCore::RenderThemeWin::platformInactiveSelectionForegroundColor const): * rendering/RenderThemeWin.h: 2018-06-04 Chris Dumez <cdumez@apple.com> Update Fetch code to provide more useful exception messages https://bugs.webkit.org/show_bug.cgi?id=186156 Reviewed by Youenn Fablet. Provide more useful error messages in our Loading / Fetch code. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::consumeOnceLoadingFinished): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): (WebCore::FetchHeaders::get const): (WebCore::FetchHeaders::has const): * Modules/fetch/FetchRequest.cpp: (WebCore::FetchRequest::setBody): (WebCore::FetchRequest::clone): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::clone): * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/context/ServiceWorkerFetch.h: 2018-06-04 Daniel Bates <dabates@apple.com> Update Strong Password appearance https://bugs.webkit.org/show_bug.cgi?id=186239 <rdar://problem/38183795> Reviewed by Brent Fulgham. Fix up the gradient mask to start half-way through the visible text and size it to the width of the visible text. Also change the color of the Strong Password label to 80% black. We achieve sizing of the gradient to the width of the visible text by changing the CSS display of the inner text element to be an inline-block and specifying "max-width: 100%" so that its maximum width is less than or equal to the width of its containing block. Additionally, only apply strong password-specific inner text element styles when the field is not disabled or read-only and has a strong password appearance. Otherwise these styles, specifically the display type, will adversely effect rendering of the text when the field is disabled or readonly. * css/html.css: (input::-webkit-strong-password-auto-fill-button): * html/HTMLInputElement.cpp: (WebCore::autoFillStrongPasswordMaskImage): (WebCore::HTMLInputElement::createInnerTextStyle): 2018-06-04 Wenson Hsieh <wenson_hsieh@apple.com> [WebKit on watchOS] Remove all uses of the EXTRA_ZOOM_MODE compiler flag https://bugs.webkit.org/show_bug.cgi?id=186279 Reviewed by Tim Horton. Replaces uses of ENABLE(EXTRA_ZOOM_MODE) with PLATFORM(WATCHOS). No change in behavior. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::compactMode const): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::updatePlayState): * page/Page.cpp: (WebCore::relevantViewRect): * page/SettingsBase.cpp: (WebCore::SettingsBase::defaultMinimumZoomFontSize): (WebCore::SettingsBase::defaultDownloadableBinaryFontsEnabled): * page/ViewportConfiguration.cpp: (WebCore::platformDeviceWidthOverride): (WebCore::shouldOverrideShrinkToFitArgument): (WebCore::needsUpdateAfterChangingDisabledAdaptations): * platform/LocalizedStrings.cpp: * platform/LocalizedStrings.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): (-[WebMediaSessionHelper dealloc]): (-[WebMediaSessionHelper hasWirelessTargetsAvailable]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): * platform/ios/PlaybackSessionInterfaceAVKit.mm: (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged): * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerViewController initWithFullscreenInterface:]): (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]): (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]): (-[WebAVPlayerViewController MY_NO_RETURN]): (-[WebAVPlayerViewController isPictureInPicturePossible]): (-[WebAVPlayerViewController isPictureInPictureActive]): (-[WebAVPlayerViewController pictureInPictureActive]): (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]): (-[WebAVPlayerViewController showsPlaybackControls]): (-[WebAVPlayerViewController setShowsPlaybackControls:]): (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]): (-[WebAVPlayerViewController setDelegate:]): (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): (VideoFullscreenInterfaceAVKit::doSetup): (WebCore::supportsPictureInPicture): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::willExitFullscreen): * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: 2018-06-04 Youenn Fablet <youenn@apple.com> [WK1] Add an option to restrict communication to localhost sockets https://bugs.webkit.org/show_bug.cgi?id=186249 Reviewed by Eric Carlson. Covered by existing tests. Set explicitly webrtc socket IP address to 127.0.0.1 in testing mode. For that purpose, we need WK1 to create a wrapper around a socket factory, this wrapper being responsible of setting or not the IP address to 127.0.0.1. * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::prepareSocketAddress): (WebCore::BasicPacketSocketFactory::BasicPacketSocketFactory): (WebCore::BasicPacketSocketFactory::setDisableNonLocalhostConnections): (WebCore::BasicPacketSocketFactory::CreateClientTcpSocket): (WebCore::LibWebRTCProvider::createPeerConnection): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: 2018-06-04 Zalan Bujtas <zalan@apple.com> [LFC] Merge width and margin computation for block-level, non-replaced and inline,replaced element in normal flow https://bugs.webkit.org/show_bug.cgi?id=186225 Reviewed by Antti Koivisto. This patch merges the width and horizontal margin computation for https://www.w3.org/TR/CSS22/visudet.html#inline-replaced-width and https://www.w3.org/TR/CSS22/visudet.html#blockwidth * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): 2018-06-01 Zalan Bujtas <zalan@apple.com> [LFC] Merge width and horizontal margin computation https://bugs.webkit.org/show_bug.cgi?id=186217 Reviewed by Antti Koivisto. We could certainly compute width and maring separately, but to match each steps defined at https://www.w3.org/TR/CSS22/visudet.html, we should just merge width and horizontal margin computations (followed by height and vertical margins). Use 0 computed marings for now. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): Deleted. (WebCore::Layout::FormattingContext::computeFloatingWidth const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): (WebCore::Layout::FormattingContext::Geometry::computedPadding): (WebCore::Layout::outOfFlowNonReplacedWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidth): Deleted. (WebCore::Layout::floatingNonReplacedWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidth): Deleted. * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::initializeRoot): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const): (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const): (WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted. (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): Deleted. (WebCore::Layout::BlockFormattingContext::computeMargin const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidth): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidth): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::computedMargin): Deleted. * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::marginBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setHasValidVerticalMargin): (WebCore::Display::Box::setHasValidHorizontalMargin): (WebCore::Display::Box::invalidateMargin): (WebCore::Display::Box::setHorizontalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::marginTop const): (WebCore::Display::Box::marginLeft const): (WebCore::Display::Box::marginBottom const): (WebCore::Display::Box::marginRight const): (WebCore::Display::Box::Edges::Edges): Deleted. (WebCore::Display::Box::setHasValidMargin): Deleted. (WebCore::Display::Box::setMargin): Deleted. 2018-06-03 Michael Catanzaro <mcatanzaro@igalia.com> REGRESSION(r232338): [GTK] Broke a few layout tests https://bugs.webkit.org/show_bug.cgi?id=186244 Unreviewed, also rollout r232392. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle): * rendering/RenderTheme.h: (WebCore::RenderTheme::adjustListboxStyle const): Deleted. * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::adjustListboxStyle const): Deleted. * rendering/RenderThemeGtk.h: 2018-06-03 Michael Catanzaro <mcatanzaro@igalia.com> REGRESSION(r232338): [GTK] Broke a few layout tests https://bugs.webkit.org/show_bug.cgi?id=186244 Unreviewed, rollout r232338. * platform/gtk/RenderThemeGadget.cpp: (WebCore::RenderThemeGadget::RenderThemeGadget): (WebCore::baseStyleContext): Deleted. * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::adjustButtonStyle const): (WebCore::RenderThemeGtk::adjustTextFieldStyle const): (WebCore::RenderThemeGtk::adjustSearchFieldStyle const): (WebCore::styleColor): (WebCore::RenderThemeGtk::adjustTextAreaStyle const): Deleted. * rendering/RenderThemeGtk.h: 2018-06-03 Eric Carlson <eric.carlson@apple.com> [iOS] MediaPlayer.framework is not always available https://bugs.webkit.org/show_bug.cgi?id=186220 <rdar://problem/40571286> Reviewed by Tim Horton. * platform/ios/RemoteCommandListenerIOS.mm: (WebCore::RemoteCommandListener::create): 2018-06-02 Darin Adler <darin@apple.com> [Cocoa] Update some code to be more ARC-compatible to prepare for future ARC adoption https://bugs.webkit.org/show_bug.cgi?id=186227 Reviewed by Dan Bernstein. * bridge/objc/objc_instance.mm: (ObjcInstance::~ObjcInstance): Use @autoreleasepool instead of NSAutoreleasePool. * platform/ios/wak/WAKView.mm: (-[WAKView _appendDescriptionToString:atLevel:]): Ditto. 2018-06-03 Zan Dobersek <zdobersek@igalia.com> [WebGL] GL_EXT_robustness utilization should depend on CONTEXT_ROBUST_ACCESS value https://bugs.webkit.org/show_bug.cgi?id=186187 Reviewed by Carlos Garcia Campos. Don't utilize the GL_EXT_robustness extension for reading pixels from the GPU if the underlying OpenGL context did not enable robust access support upon creation. For EGL contexts, this would be done by passing EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT and EGL_TRUE key-value pair in the attribute list passed to eglCreateContext() (as specified in the EGL_EXT_create_context_robustness extension), but at the moment this capability is not utilized. As such, on drivers that implement GL_EXT_robustness support, pixel reads done in WebGLRenderingContextBase end up using glReadnPixels(), but that fails to successfully read anything due to the context rejecting such calls. GL_EXT_robustness is specific to OpenGL ES versions, so to fix this, Extensions3DOpenGLES overrides the isEnabled() method. That override returns false immediately if the inherited isEnabled() implementation returns false. Otherwise it returns true, unless the tested extension is GL_EXT_robustness, in which case we now check that the context's CONTEXT_ROBUST_ACCESS state value is true, meaning the context was created with robust access support enabled. No new tests are possible because this is optional driver-provided functionality that Web content cannot have effect on. * platform/graphics/Extensions3D.h: * platform/graphics/opengl/Extensions3DOpenGLES.cpp: (WebCore::Extensions3DOpenGLES::isEnabled): * platform/graphics/opengl/Extensions3DOpenGLES.h: 2018-06-01 Ryosuke Niwa <rniwa@webkit.org> Editor can hold references to Documents after you navigate away https://bugs.webkit.org/show_bug.cgi?id=186215 Reviewed by Simon Fraser. Clear the various member variables that can hold onto a document in Editor::clear and FrameSelection::prepareForDestruction. Test: editing/selection/navigation-clears-editor-state.html * editing/Editor.cpp: (WebCore::Editor::clear): * editing/Editor.h: * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::prepareForDestruction): * editing/FrameSelection.h: 2018-06-01 Ryosuke Niwa <rniwa@webkit.org> ResourceLoader::cancel() shouldn't synchronously fire load event on document https://bugs.webkit.org/show_bug.cgi?id=185284 Revert the erroneous change to SSFontSelector::beginLoadTimerFired(), which broke CancelLoading.CancelFontSubresource. FrameLoader::loadDone calls checkCompleted, not checkLoadComplete so we still need to call checkLoadComplete here. * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::beginLoadTimerFired): 2018-06-01 Jeremy Jones <jeremyj@apple.com> Keyboard focus should exit fullscreen. https://bugs.webkit.org/show_bug.cgi?id=185617 rdar://problem/34697938 Reviewed by Ryosuke Niwa. No opensource test because feature is not enabled. While in element fullscreen, initiating keyboard focus should exit fullscreen in iOS. Improve fullscreen testability by exposing isAnimatingFullScreen. * dom/Document.h: * testing/Internals.cpp: (WebCore::Internals::isAnimatingFullScreen const): * testing/Internals.h: * testing/Internals.idl: 2018-06-01 Jeremy Jones <jeremyj@apple.com> Don't continue playing in background when auto-picture-in-picture is disabled. https://bugs.webkit.org/show_bug.cgi?id=186089 rdar://problem/40314314 Reviewed by Eric Carlson. No new tests because we don't have a way to test auto-pip. With the refactoring work done in VideoFullscreenInterfaceAVKit, HTMLMediaElement no longer has to anticipate auto-pip when if it should pause on suspend. Instead VideoFullscreenInterfaceAVKit proactively updates videoFullscreenMode, so checking for PIP is sufficient. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): 2018-06-01 Chris Dumez <cdumez@apple.com> REGRESSION (r231456): Colloquy is broken https://bugs.webkit.org/show_bug.cgi?id=186197 <rdar://problem/40722960> Reviewed by Timothy Hatcher. Restore pre-r231456 behavior for Colloquy app so that it works again. * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::openURL): * page/Settings.yaml: 2018-06-01 Chris Dumez <cdumez@apple.com> Regression(r230567): Unable to log into twitter.com in private sessions https://bugs.webkit.org/show_bug.cgi?id=186205 <rdar://problem/40670799> Reviewed by Youenn Fablet. We were using the same SWServer for all private sessions and the SWServer's sessionID would be legacyPrivateSessionID(). As a result, the service worker's sessionID would be legacyPrivateSessionID() as well and would not match the sessionID of its client pages. This sessionID mismatch was causing the breakage. Instead of using the same SWServer of all private sessions, we now go back to using a SWServer per private session. However, we now make sure that the SWServer gets destroyed whenever its corresponding session gets destroyed. * workers/service/server/SWServer.cpp: (WebCore::SWServer::~SWServer): 2018-06-01 Youenn Fablet <youenn@apple.com> Add an option to restrict communication to localhost sockets https://bugs.webkit.org/show_bug.cgi?id=186208 Reviewed by Eric Carlson. Covered by existing tests. Add an option in LibWebRTCProvider to restrict to localhost sockets. Use that option when Internals is used. * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): 2018-06-01 Ryosuke Niwa <rniwa@webkit.org> ResourceLoader::cancel() shouldn't synchronously fire load event on document https://bugs.webkit.org/show_bug.cgi?id=185284 Reviewed by Antti Koivisto. Because a resource loading can be canceled as a node is removed a document or CachedResource is destructed, it's not safe to synchronously fire load event on document upon cancelation. This patch makes the cancellation of a resource load schedule m_checkTimer in FrameLoader to fire a load event asynchronously instead. Specifically, this patch makes FrameLoader::loadDone call FrameLoader::scheduleCheckCompleted when the load had failed or cancled instead of calling FrameLoader::checkCompleted which can synchronously fire load event. To differentiate the two cases, new enum LoadCompletionType has been added to FrameLoader::loadDone and related functions. To avoid calling the navigation delegate too early, the same abstraction for checkLoadComplete() has been added in the form of FrameLoader::subresourceLoadDone. Unfortunately, delaying calls to checkCompleted() and checkLoadComplete() by a timer can result in client callbacks such as didFinishLoadForFrame and didFailLoadWithError to never get called when the frame gets detached from the parent after the last resource had stopped loading but before the timer fires. To preserve these deleagte callbacks, this patch expedites the timer in FrameLoader::frameDetached and Page::goToItem by by invoking newly added stopAllLoadersAndCheckCompleteness, which stops all loading and then immediately invokes checkCompleted() and checkLoadComplete() synchronously if m_checkTimer had been started. Tests: http/tests/preload/dynamic_removing_preload.html * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::beginLoadTimerFired): Removed superfluous call to checkLoadComplete since cachedResourceLoader's loadDone would call checkLoadComplete anyway. * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::disconnectContentFrame): Removed the misleading comment added in r140090. Firefox DOES indeed fire unload event in the content document of a removed frame. While this comment made it sound like this function isn't called when a frame is removed from the tree when in reality we simply remove a frame prior to removing the node via disconnectSubframesIfNeeded. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::removeSubresourceLoader): * loader/DocumentLoader.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::FrameLoader): (WebCore::FrameLoader::loadDone): (WebCore::FrameLoader::subresourceLoadDone): (WebCore::FrameLoader::checkCompleted): Added a release assert that this function is only called when it's safe to execute scripts. (WebCore::FrameLoader::checkTimerFired): (WebCore::FrameLoader::checkCompletenessNow):Extracted from checkTimerFired. (WebCore::FrameLoader::stopAllLoaders): Removed the code to stop m_checkTimer introduced in r53655. Stopping the timer here would prevent FrameLoader::frameDetached to detect the case when stopping the loader scheduled a load completion check. Also stopping this timer without clearing the corresponding booleans: m_checkingLoadCompleteForDetachment and m_checkingLoadCompleteForDetachment is problematic. The assertion r53655 addressed is now addressed by explicitly checking & clearing the timer in frameDetached. (WebCore::FrameLoader::stopAllLoadersAndCheckCompleteness): Added. (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Avoid an early exit when the newly added boolean m_checkingLoadCompleteForDetachment is set since m_isStopping is no longer set in frameDetached in order to invoke didFailLoadWithError when detaching a frame. (WebCore::FrameLoader::frameDetached): Call checkCompletenessNow in the case the frame had already been completed loading. Also call stopAllLoadersAndCheckCompleteness in the case stopping loading would complete the loading before stopping active DOM objects. * loader/FrameLoader.h: (WebCore::FrameLoader::m_checkingLoadCompleteForDetachment): Added. * loader/FrameLoaderTypes.h: (WebCore::LoadCompletionType): Added. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): (WebCore::SubresourceLoader::didFail): (WebCore::SubresourceLoader::didCancel): (WebCore::SubresourceLoader::notifyDone): * loader/SubresourceLoader.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::loadDone): * loader/cache/CachedResourceLoader.h: * page/Page.cpp: (WebCore::Page::goToItem): Call stopAllLoadersAndCheckCompleteness instead of stopAllLoaders since stopping loading here may complete loading. 2018-06-01 Sihui Liu <sihui_liu@apple.com> Stop using StorageTracker.db in LocalStorageDatabaseTracker https://bugs.webkit.org/show_bug.cgi?id=186104 Reviewed by Geoffrey Garen. No behavior change. * platform/sql/SQLiteFileSystem.h: 2018-06-01 Zalan Bujtas <zalan@apple.com> [LFC] Simplify the formatting class implementation by pushing down some of the logic to the Geometry class https://bugs.webkit.org/show_bug.cgi?id=186179 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeFloatingHeight const): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::outOfFlowNonReplacedHeight): (WebCore::Layout::outOfFlowNonReplacedWidth): (WebCore::Layout::outOfFlowReplacedHeight): (WebCore::Layout::outOfFlowReplacedWidth): (WebCore::Layout::floatingNonReplacedHeight): (WebCore::Layout::floatingNonReplacedWidth): (WebCore::Layout::floatingReplacedHeight): (WebCore::Layout::floatingReplacedWidth): (WebCore::Layout::outOfFlowNonReplacedPosition): (WebCore::Layout::outOfFlowReplacedPosition): (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeight): (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidth): (WebCore::Layout::FormattingContext::Geometry::floatingHeight): (WebCore::Layout::FormattingContext::Geometry::floatingWidth): (WebCore::Layout::FormattingContext::Geometry::outOfFlowPosition): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeight): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidth): (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidth): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedPosition): Deleted. (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedPosition): Deleted. (WebCore::Layout::FormattingContext::Geometry::replacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::replacedWidth): Deleted. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeStaticPosition const): (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::inFlowNonReplacedHeight): (WebCore::Layout::inFlowNonReplacedWidth): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeight): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidth): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): Deleted. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidth): Deleted. 2018-06-01 Zalan Bujtas <zalan@apple.com> [LFC] Push FormattingContext::computeWidth/computeHeight logic from the base to the subclasses. https://bugs.webkit.org/show_bug.cgi?id=186172 Reviewed by Antti Koivisto. FormattingContext::computeWidth/computeHeight virtual functions have very little benefit and in the long run it's better if we keep the number of virtual functions to the minimum necessary. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeStaticPosition const): Deleted. (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition const): Deleted. (WebCore::Layout::FormattingContext::computeWidth const): Deleted. (WebCore::Layout::FormattingContext::computeHeight const): Deleted. (WebCore::Layout::FormattingContext::computeMargin const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeight): (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidth): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeight): (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidth): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeight): (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidth): (WebCore::Layout::FormattingContext::Geometry::replacedHeight): Deleted. (WebCore::Layout::FormattingContext::Geometry::replacedWidth): Deleted. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeWidth const): (WebCore::Layout::BlockFormattingContext::computeHeight const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeStaticPosition const): (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const): (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const): Deleted. (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2018-06-01 Carlos Eduardo Ramalho <cadubentzen@gmail.com> [GTK] Difficult to read combo box text in dark theme https://bugs.webkit.org/show_bug.cgi?id=165072 Reviewed by Carlos Garcia Campos. Set listbox foreground color to theme color to fix hard-to-read text color in combo box while using dark theme. No new tests required. ManualTests/gtk/theme.html already covers it. See the "Option Lists" section. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle): Adjust style for ListboxPart as well. * rendering/RenderTheme.h: Add adjustListboxStyle() * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::adjustListboxStyle const): Set color to the theme foreground color. * rendering/RenderThemeGtk.h: adjustListboxStyle() overriden. 2018-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Switch to use a popup window with a tree view instead of a menu for option menu default implementation https://bugs.webkit.org/show_bug.cgi?id=186146 Reviewed by Michael Catanzaro. Make it possible to use GUniquePtr with GtkTreePath. * platform/gtk/GUniquePtrGtk.h: 2018-05-31 Per Arne Vollan <pvollan@apple.com> Add OpenGL display mask to WebPage creation parameters. https://bugs.webkit.org/show_bug.cgi?id=186163 <rdar://problem/40634504> Reviewed by Brent Fulgham. To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters. The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered on some hardware configurations. No new tests, since it is not trivial to test whether OpenGL rendering is hardware accelerated. * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::displayID): 2018-05-31 Megan Gardner <megan_gardner@apple.com> Add setting to allow override screen size to be disabled. https://bugs.webkit.org/show_bug.cgi?id=186109 Reviewed by Andy Estes. Not Testable, and for debug only. Pipe settings and use them to ignore override screen size if setting is set. * page/DeprecatedGlobalSettings.cpp: * page/DeprecatedGlobalSettings.h: (WebCore::DeprecatedGlobalSettings::setDisableScreenSizeOverride): (WebCore::DeprecatedGlobalSettings::disableScreenSizeOverride): * page/Settings.yaml: * platform/ios/PlatformScreenIOS.mm: 2018-05-31 Brent Fulgham <bfulgham@apple.com> REGRESSION(r216119): DocumentLoader::detachFromFrame still encounters nullptr frame https://bugs.webkit.org/show_bug.cgi?id=186081 <rdar://problem/34918109> Reviewed by David Kilzer. The nullptr check that was removed in r216119 was still needed because when the DocumentLoader is in 'm_waitingForNavigationPolicy' or in 'm_waitingForContentPolicy', a call to the policy checker to stopCheck we will clear the frame as part of the cleanup phase. If m_frame is nullptr after cancelPolicyCheckIfNeeded, our work is already done so just return. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::detachFromFrame): 2018-05-31 Dean Jackson <dino@apple.com> Don't paint the System Preview badge if the image isn't fully decoded https://bugs.webkit.org/show_bug.cgi?id=186158 <rdar://problem/40454866> Reviewed by Antoine Quint. Only paint the system preview badge if the image itself said that it succeeded in drawing. * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIntoRect): Check the ImageDrawResult. 2018-05-31 David Kilzer <ddkilzer@apple.com> Implement checked cast for DDResultRef once DDResultGetCFTypeID() is available <https://webkit.org/b/184554> <rdar://problem/36241894> Reviewed by Brent Fulgham. * editing/cocoa/DataDetection.mm: (WebCore::detectItemAtPositionWithRange): Implement checked cast for DDResultRef. 2018-05-31 Alex Christensen <achristensen@webkit.org> Fix Windows build after r232246. https://bugs.webkit.org/show_bug.cgi?id=186024 * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateAlignmentBaselineShift const): 2018-05-31 Chris Dumez <cdumez@apple.com> Fix memory leak under NetworkStateNotifier::updateStateWithoutNotifying() https://bugs.webkit.org/show_bug.cgi?id=186149 <rdar://problem/40674537> Reviewed by Geoffrey Garen. * platform/network/mac/NetworkStateNotifierMac.cpp: (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): 2018-05-31 Zalan Bujtas <zalan@apple.com> [LFC] Layout code needs to know the type of the Element associated with a Layout::Box https://bugs.webkit.org/show_bug.cgi?id=186117 Reviewed by Antti Koivisto. Since these attributes don't change during layout, we could just pass them in to Layout::Box instead of keep querying the Element. * layout/layouttree/LayoutBlockContainer.cpp: (WebCore::Layout::BlockContainer::BlockContainer): * layout/layouttree/LayoutBlockContainer.h: * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::Box): (WebCore::Layout::Box::isPaddingApplicable const): (WebCore::Layout::Box::isDocumentBox const): Deleted. (WebCore::Layout::Box::isBodyBox const): Deleted. * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::isAnonymous const): (WebCore::Layout::Box::isDocumentBox const): (WebCore::Layout::Box::isBodyBox const): (WebCore::Layout::Box::ElementAttributes::ElementAttributes): (WebCore::Layout::Box::setPreviousSibling): (WebCore::Layout::Box::setIsAnonymous): Deleted. * layout/layouttree/LayoutContainer.cpp: (WebCore::Layout::Container::Container): * layout/layouttree/LayoutContainer.h: * layout/layouttree/LayoutInlineBox.cpp: (WebCore::Layout::InlineBox::InlineBox): * layout/layouttree/LayoutInlineBox.h: * layout/layouttree/LayoutInlineContainer.cpp: (WebCore::Layout::InlineContainer::InlineContainer): * layout/layouttree/LayoutInlineContainer.h: * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createLayoutTree): (WebCore::Layout::TreeBuilder::createSubTree): 2018-05-31 Chris Dumez <cdumez@apple.com> Unreviewed iOS build fix after r232335. * html/BaseChooserOnlyDateAndTimeInputType.h: * html/BaseDateAndTimeInputType.h: 2018-05-31 Chris Dumez <cdumez@apple.com> Unreviewed, apply review comments from Darin after r232310. * platform/ReferrerPolicy.cpp: (WebCore::parseReferrerPolicy): 2018-05-31 Zalan Bujtas <zalan@apple.com> [LFC] Margin box is border box + margins. https://bugs.webkit.org/show_bug.cgi?id=186124 Reviewed by Antti Koivisto. * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::marginBox const): 2018-05-31 Zalan Bujtas <zalan@apple.com> [LFC] Add quirks mode setter/getting to LayoutContext https://bugs.webkit.org/show_bug.cgi?id=186122 Reviewed by Antti Koivisto. * layout/LayoutContext.h: (WebCore::Layout::LayoutContext::setInQuirksMode): (WebCore::Layout::LayoutContext::inQuirksMode const): * page/FrameViewLayoutContext.cpp: (WebCore::layoutUsingFormattingContext): 2018-05-30 Carlos Eduardo Ramalho <cadubentzen@gmail.com> [GTK] Hardcoded text color in input fields https://bugs.webkit.org/show_bug.cgi?id=126907 Reviewed by Carlos Garcia Campos. Set text color in input fields to foreground theme color. Also, set "window.background" as base GtkStyleContext to mimic GTK applications and fix some theme bugs. No new tests required. ManualTests/gtk/theme.html already covers it. * platform/gtk/RenderThemeGadget.cpp: (WebCore::baseStyleContext): Added. (WebCore::RenderThemeGadget::RenderThemeGadget): Use "window.background" GtkStyleContext instead of null parent for RenderThemeGadgets. * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::adjustButtonStyle const): Set color as foreground theme color. (WebCore::RenderThemeGtk::adjustTextFieldStyle const): Ditto. (WebCore::RenderThemeGtk::adjustTextAreaStyle const): Ditto. (WebCore::RenderThemeGtk::adjustSearchFieldStyle const): Ditto. * rendering/RenderThemeGtk.h: adjustTextAreaStyle() overriden. 2018-05-30 Yusuke Suzuki <utatane.tea@gmail.com> [JSC] Pass VM& parameter as much as possible https://bugs.webkit.org/show_bug.cgi?id=186085 Reviewed by Saam Barati. No behavior change. * bindings/js/JSCSSRuleListCustom.cpp: (WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots): * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackData::invokeCallback): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMBuiltinConstructorBase.cpp: (WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments): * bindings/js/JSDOMConvertScheduledAction.h: (WebCore::Converter<IDLScheduledAction>::convert): * bindings/js/JSDOMIterator.h: (WebCore::iteratorForEach): * bindings/js/JSDOMMapLike.cpp: (WebCore::forwardFunctionCallToBackingMap): (WebCore::forwardForEachCallToBackingMap): * bindings/js/JSDOMPromise.cpp: (WebCore::callFunction): * bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::DeferredPromise::callFunction): (WebCore::createRejectedPromiseWithTypeError): * bindings/js/JSDeprecatedCSSOMValueCustom.cpp: (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSNodeListCustom.cpp: (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots): * bindings/js/JSPluginElementFunctions.cpp: (WebCore::pluginElementCustomPut): (WebCore::callPlugin): * bindings/js/JSWindowProxy.cpp: (WebCore::JSWindowProxy::setWindow): * bindings/js/ReadableStream.cpp: (WebCore::ReadableStreamInternal::callFunction): * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::callFunction): * bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::executeFunctionInContext): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::getProperty): (WebCore::CloneSerializer::serialize): * bindings/js/StructuredClone.cpp: (WebCore::structuredCloneArrayBufferView): * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::initScript): * bridge/NP_jsobject.cpp: * bridge/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): * testing/Internals.cpp: (WebCore::Internals::cloneArrayBuffer): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::injectInternalsObject): 2018-05-28 Darin Adler <darin@apple.com> Straighten out HTMLInputElement attribute handling https://bugs.webkit.org/show_bug.cgi?id=186043 Reviewed by Daniel Bates. * dom/RadioButtonGroups.cpp: (WebCore::RadioButtonGroup::requiredStateChanged): Renamed from requiredAttributeChanged, and changed to take a reference. (WebCore::RadioButtonGroups::requiredStateChanged): Ditto. * dom/RadioButtonGroups.h: Updated for changes above. * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree): Call updateInnerTextValue by its new name. (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue): Renamed from updateAppearance. (WebCore::BaseChooserOnlyDateAndTimeInputType::setValue): Call updateInnerTextValue by its new name. (WebCore::BaseChooserOnlyDateAndTimeInputType::attributeChanged): Override this instead of valueAttributeChanged. * html/BaseChooserOnlyDateAndTimeInputType.h: Tighten up inheritance a bit. Also use final a bit more and update for changes above. * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::attributeChanged): Replaced minOrMaxAttributeChanged with this override, checking for the attribute names. * html/BaseDateAndTimeInputType.h: Updated for changes above. * html/FileInputType.cpp: (WebCore::FileInputType::disabledStateChanged): Renamed from disabledAttributeChanged. (WebCore::FileInputType::attributeChanged): Replaced multipleAttributeChanged with this override, checking for the attribute names. * html/FileInputType.h: Updated for changes above. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::parseAttribute): Updated function names to say "state changed" rather than "attribute changed" if they are called only when the computed value is changed, not the raw attribute value. (WebCore::HTMLFormControlElement::readOnlyStateChanged): Updated name. (WebCore::HTMLFormControlElement::requiredStateChanged): Ditto. * html/HTMLFormControlElement.h: Updated for changes above. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseAttribute): Removed the code to call lots of specific attribute changed functions that have now been deleted. Also removed empty code for a couple of attributes. (WebCore::HTMLInputElement::disabledStateChanged): Added. Forward call to input type. (WebCore::HTMLInputElement::readOnlyStateChanged): Ditto. (WebCore::HTMLInputElement::requiredStateChanged): Renamed from requiredAttributeChanged. * html/HTMLInputElement.h: Updated for changes above. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::readOnlyStateChanged): Renamed from readOnlyAttributeChanged. Also fixed incorrect call to base class. This may have fixed a bug: With some work we could probably create a test case to demonstrate that. * html/HTMLTextFormControlElement.h: Updated for changes above. * html/ImageInputType.cpp: (WebCore::ImageInputType::attributeChanged): Replaced altAttributeChanged and srcAttributeChanged with this override, checking for the attribute names. * html/ImageInputType.h: Updated for changes above. * html/InputType.cpp: (WebCore::InputType::altAttributeChanged): Deleted. (WebCore::InputType::srcAttributeChanged): Deleted. (WebCore::InputType::maxResultsAttributeChanged): Deleted. (WebCore::InputType::minOrMaxAttributeChanged): Deleted. (WebCore::InputType::stepAttributeChanged): Deleted. (WebCore::InputType::valueAttributeChanged): Deleted. (WebCore::InputType::attributeChanged): Moved to header as an inline so derived classes can call through to the base class with the empty function inlined. (WebCore::InputType::multipleAttributeChanged): Deleted. (WebCore::InputType::disabledAttributeChanged): Moved to header as an inline. (WebCore::InputType::readonlyAttributeChanged): Ditto. (WebCore::InputType::requiredAttributeChanged): Ditto. * html/InputType.h: Updated for changes above. * html/NumberInputType.cpp: (WebCore::NumberInputType::attributeChanged): Replaced minOrMaxAttributeChanged and stepAttributeChanged with this override, checking for the attribute names. * html/NumberInputType.h: Updated for changes above. * html/RangeInputType.cpp: (WebCore::RangeInputType::disabledStateChanged): Renamed from disabledAttributeChanged. (WebCore::RangeInputType::attributeChanged): Replaced minOrMaxAttributeChanged with this override, checking for the attribute names. * html/RangeInputType.h: Updated for changes above. * html/SearchInputType.cpp: (WebCore::SearchInputType::SearchInputType): Removed unneeded initialization of RefPtr data members to nullptr. (WebCore::updateResultButtonPseudoType): Removed unneeded if statement; the two cases above cover 0, and less than 0, so there is no need to check for greater than 0 for the third case. (WebCore::SearchInputType::attributeChanged): Replaced maxResultsAttributeChanged with this override, checking for the attribute name. * html/SearchInputType.h: Updated for changes above and marked more member functions final. * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::attributeChanged): Added a call through to the base class to match the style of other overrides of this function. (WebCore::TextFieldInputType::disabledStateChanged): Renamed from disabledAttributeChanged. (WebCore::TextFieldInputType::readOnlyStateChanged): Renamed from readonlyAttributeChanged. * html/TextFieldInputType.h: Updated for changes above. Also made attributeChanged no longer be marked final since derived classes now override it. * html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::SliderThumbElement): Moved some data member initialization from this constructor to the class definition. (WebCore::SliderThumbElement::hostDisabledStateChanged): Renamed from disabledAttributeChanged. * html/shadow/SliderThumbElement.h: Updated for changes above and marked more member functions final. 2018-05-30 Nan Wang <n_wang@apple.com> AX: VoiceOver on macOS does not announce fieldset description from aria-describedby when focussing inputs https://bugs.webkit.org/show_bug.cgi?id=185246 <rdar://problem/39939028> Reviewed by Chris Fleizach. Exposed the fieldset's description to its form control children. Test: accessibility/mac/aria-describedby-fieldset.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::helpText const): 2018-05-30 Chris Fleizach <cfleizach@apple.com> AX: Expose link rel type to voiceover https://bugs.webkit.org/show_bug.cgi?id=186084 <rdar://problem/40640871> Reviewed by Sam Weinig. Make the link rel attribute available to accessibility clients. Test: accessibility/mac/linkrel.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::linkRelValue const): * accessibility/AccessibilityObject.h: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityLinkRelationshipType]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2018-05-30 Brady Eidson <beidson@apple.com> REGRESSION (r224684): User-agent seen by page does not change when modified by the develop menu options after reloading. <rdar://problem/34918109> and https://bugs.webkit.org/show_bug.cgi?id=186111 Reviewed by Andy Estes. Test: http/tests/navigation/useragent-reload.php * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::clientHandshakeRequest const): Use setUserAgent() for consistency. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource): Clear the user agent from the original DocumentLoader request before adding additional fields, as reloads should pick up user agent changes. 2018-05-30 Dean Jackson <dino@apple.com> WebContent crashes with system preview content https://bugs.webkit.org/show_bug.cgi?id=186118 Reviewed by Myles Maxfield. We were receiving crash reports on iOS devices when getting platformContext() from a GraphicsContext. This usually occurred when the page was invisible. Debugging showed that it was trying to draw with a disabled context. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintSystemPreviewBadge): Early return if the context has painting disabled. 2018-05-30 Daniel Bates <dabates@apple.com> Web Inspector: Annotate Same-Site cookies https://bugs.webkit.org/show_bug.cgi?id=184897 <rdar://problem/35178209> Reviewed by Brian Burg. Store and retrieve the Same-Site cookie policy from CFNetwork. * inspector/agents/InspectorPageAgent.cpp: (WebCore::cookieSameSitePolicyJSON): Added. (WebCore::buildObjectForCookie): Modified to include cookie Same-Site policy. * platform/Cookie.h: (WebCore::Cookie::encode const): Encode Same-Site policy. (WebCore::Cookie::decode): Decode Same-Site policy. * platform/network/cocoa/CookieCocoa.mm: (WebCore::portStringFromVector): (WebCore::coreSameSitePolicy): (WebCore::nsSameSitePolicy): (WebCore::Cookie::operator NSHTTPCookie * _Nullable const): (WebCore::Cookie::operator NSHTTPCookie * const): Deleted. 2018-05-30 Daniel Bates <dabates@apple.com> NavigationAction does not need to hold initiating DOM Event https://bugs.webkit.org/show_bug.cgi?id=185958 <rdar://problem/40531539> Reviewed by Simon Fraser. Take a similar approach as was done in <https://bugs.webkit.org/show_bug.cgi?id=185712> and have NavigationAction hold only as many details of the initiating DOM Event as necessary to support WebKit functionality. Retaining a DOM Event effectively retains the document that associated with the event. And DocumentLoader always keeps around the NavigationAction of the last navigation for the "benefit of the various policy handlers". Therefore, having NavigationAction hold only the relevant details of the DOM Event instead of the DOM Event itself we avoid keeping the document we navigated from alive longer than necessary. * dom/MouseRelatedEvent.h: * dom/UIEventWithKeyState.h: * loader/NavigationAction.cpp: (WebCore::NavigationAction::UIEventWithKeyStateData::UIEventWithKeyStateData): Added. (WebCore::NavigationAction::MouseEventData::MouseEventData): Added. (WebCore::keyStateDataForFirstEventWithKeyState): Added. (WebCore::mouseEventDataForFirstMouseEvent): Added. * loader/NavigationAction.h: (WebCore::NavigationAction::keyStateEventData const): Added. (WebCore::NavigationAction::mouseEventData const): Added (WebCore::NavigationAction::event const): Deleted. 2018-05-30 Youenn Fablet <youenn@apple.com> Revert changes made to URLWithUserTypedString made in https://trac.webkit.org/changeset/232281 https://bugs.webkit.org/show_bug.cgi?id=186108 <rdar://problem/40663065> Reviewed by Alex Christensen. Covered by existing API tests. * platform/mac/WebCoreNSURLExtras.mm: (WebCore::URLWithUserTypedString): Return early if WebCore::URL is not able to create a CFURL. Use CFURL otherwise to keep the existing behavior as much as possible. 2018-05-30 Youenn Fablet <youenn@apple.com> Rename FromOrigin runtime flag to CrossOriginResourcePolicy and enable it by default https://bugs.webkit.org/show_bug.cgi?id=186082 Reviewed by Chris Dumez. No change of behavior. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setCrossOriginResourcePolicyEnabled): (WebCore::RuntimeEnabledFeatures::crossOriginResourcePolicyEnabled const): (WebCore::RuntimeEnabledFeatures::setFromOriginResponseHeaderEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::fromOriginResponseHeaderEnabled const): Deleted. 2018-05-30 Chris Dumez <cdumez@apple.com> Referrer-Policy response header is ignored https://bugs.webkit.org/show_bug.cgi?id=186037 <rdar://problem/40600335> Reviewed by Youenn Fablet. Add support for Referrer-Policy HTTP response header: - https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-header Tests: http/tests/security/referrer-policy-header-and-meta-tag-emptyString.html http/tests/security/referrer-policy-header-and-meta-tag.html http/tests/security/referrer-policy-header.html * dom/Document.cpp: (WebCore::Document::setReferrerPolicy): (WebCore::Document::processReferrerPolicy): * dom/Document.h: (WebCore::Document::referrerPolicy const): * html/HTMLMetaElement.cpp: (WebCore::HTMLMetaElement::process): * loader/FrameLoader.cpp: (WebCore::FrameLoader::didBeginDocument): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::updateReferrerPolicy): * platform/ReferrerPolicy.cpp: (WebCore::parseReferrerPolicyToken): (WebCore::parseReferrerPolicy): * platform/ReferrerPolicy.h: 2018-05-30 Youenn Fablet <youenn@apple.com> Rename CrossOriginResourcePolicy same to same-origin https://bugs.webkit.org/show_bug.cgi?id=186080 Reviewed by Chris Dumez. Covered by updated tests. * platform/network/HTTPParsers.cpp: (WebCore::parseCrossOriginResourcePolicyHeader): * platform/network/HTTPParsers.h: 2018-05-30 Aditya Keerthi <akeerthi@apple.com> Fix the ENABLE(DATALIST_ELEMENT) build https://bugs.webkit.org/show_bug.cgi?id=186105 Reviewed by Wenson Hsieh. * WebCore.xcodeproj/project.pbxproj: * html/ColorInputType.cpp: (WebCore::ColorInputType::suggestions const): * html/HTMLInputElement.h: * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::ownerDataListElement const): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paintSliderTicks): 2018-05-30 Alex Christensen <achristensen@webkit.org> Reduce String allocations https://bugs.webkit.org/show_bug.cgi?id=186059 Reviewed by Darin Adler. Don't allocate Strings just to convert it to another form. Based mostly on Darin's feedback on bug 185986. No change in behavior. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): (WebCore::WebSocketHandshake::host const): * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): (WebCore::CSSSelectorParser::consumeANPlusB): * loader/mac/LoaderNSURLExtras.mm: (suggestedFilenameWithMIMEType): * page/SecurityOriginData.h: (WebCore::SecurityOriginData::fromURL): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::wildcardMatches): (WebCore::ContentSecurityPolicySource::hostMatches const): * platform/URL.cpp: (WebCore::URL::hostAndPort const): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::createStreams): 2018-05-30 Jer Noble <jer.noble@apple.com> Media elements outside fullscreen should not be considered main content. https://bugs.webkit.org/show_bug.cgi?id=186063 <rdar://problem/40630437> Reviewed by Eric Carlson. Test: platform/mac/media/video-best-element-for-playback-controls-purpose.html Media elements outside the current fullscreen element are not visible, and thus should not be considered main content. Drive-by fix: set the m_hasEverNotifiedAboutPlaying before dispatching the 'playing' event, so that tests can check bestMediaElementForShowingPlaybackControlsManager() in the 'playing' handler. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::notifyAboutPlaying): * html/HTMLMediaElement.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager const): * testing/Internals.cpp: (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager): * testing/Internals.h: * testing/Internals.idl: 2018-05-30 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed, silence a -Wreturn-type warning * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::glyphOrientationToCSSPrimitiveValue): 2018-05-30 Alexey Proskuryakov <ap@apple.com> Build fix attempt after https://trac.webkit.org/r232198 * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::ResourceHandle::createCFURLConnection): Added some toString() calls. 2018-05-30 Zalan Bujtas <zalan@apple.com> [LFC] Miscellaneous fixes to get closer to geometry correctness https://bugs.webkit.org/show_bug.cgi?id=186083 Reviewed by Antti Koivisto. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedBorder): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::initializeRoot): * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::isStretchedToViewport): (WebCore::Layout::initialContainingBlock): (WebCore::Layout::computedInFlowNonReplacedComputedHeight): (WebCore::Layout::inFlowNonReplacedComputedWidth): (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): lambda should capture the specification part. (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidth): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::marginBox const): (WebCore::Display::Box::paddingBox const): (WebCore::Display::Box::contentBox const): * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isDocumentBox const): (WebCore::Layout::Box::isBodyBox const): * layout/layouttree/LayoutBox.h: * rendering/style/BorderValue.h: ignore border-width when type is hidden or none. (WebCore::BorderValue::boxModelWidth const): 2018-05-30 Stephen McGruer <smcgruer@chromium.org> iOS: setting 'defaultValue' of input type=date from script should cause a UI update https://bugs.webkit.org/show_bug.cgi?id=185982 Reviewed by Darin Adler. Test: fast/forms/date/date-appearance-defaultValue.html * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::valueAttributeChanged): * html/BaseChooserOnlyDateAndTimeInputType.h: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseAttribute): * html/InputType.cpp: (WebCore::InputType::valueAttributeChanged): * html/InputType.h: 2018-05-29 Nan Wang <n_wang@apple.com> Unreviewed, follow-up after r232285 https://bugs.webkit.org/show_bug.cgi?id=180871 Removed redundant null check. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isExpanded const): 2018-05-29 Nan Wang <n_wang@apple.com> AX: macOS VoiceOver doesn't announce when details element is expanded when using role group https://bugs.webkit.org/show_bug.cgi?id=180866 <rdar://problem/36074338> Reviewed by Chris Fleizach. We should use is<HTMLDetailsElement> to check for the details parent instead of using the role. Added test cases to the existing test. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isExpanded const): 2018-05-29 Youenn Fablet <youenn@apple.com> Add a consistency check between URL and CFURL https://bugs.webkit.org/show_bug.cgi?id=186057 <rdar://problem/40258457> Reviewed by Geoff Garen. It is important that WebCore::URL used in WebCore and CFURL that gets serialized in the network pipe remain consistent. Otherwise, we will end-up with odd bugs. We add such a check when creating a CFURL from an URL. To make things more consistent, we also rely now more on WebCore::URL instead of directly creating a CFURL. * platform/URL.h: * platform/cf/CFURLExtras.cpp: (WebCore::isCFURLSameOrigin): * platform/cf/CFURLExtras.h: * platform/cf/URLCF.cpp: (WebCore::URL::createCFURL const): * platform/mac/URLMac.mm: (WebCore::URL::createCFURL const): * platform/mac/WebCoreNSURLExtras.mm: (WebCore::URLWithUserTypedString): 2018-05-29 Timothy Hatcher <timothy@apple.com> Printing does not apply the right colors in all cases. https://bugs.webkit.org/show_bug.cgi?id=186066 rdar://problem/40274975 Reviewed by Tim Horton. * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::setEmulatedMedia): Call RenderTheme::platformColorsDidChange to invalidate the color cache. * page/FrameView.cpp: (WebCore::FrameView::adjustMediaTypeForPrinting): Ditto. * page/Page.cpp: (WebCore::Page::defaultAppearance const): Added. Use default when not screen. * page/Page.h: (WebCore::Page::defaultAppearance const): Deleted. 2018-05-29 Per Arne Vollan <pvollan@apple.com> Create typedef for HashMap<PlatformDisplayID, ScreenProperties> https://bugs.webkit.org/show_bug.cgi?id=186056 Reviewed by Brent Fulgham. No new tests, no change in behavior. * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::screenProperties): (WebCore::getScreenProperties): (WebCore::setScreenProperties): 2018-05-29 Ryosuke Niwa <rniwa@webkit.org> iOS WK1: Occasional crash in sanitizedMarkupForFragmentInDocument https://bugs.webkit.org/show_bug.cgi?id=186011 Reviewed by David Kilzer. The crash was caused by the HTML parser in sanitizedMarkupForFragmentInDocument yielding in the web thread when _WebThreadLock() sets webThreadShouldYield to true in the main thread. No new tests. This is occasionally caught by existing tests. * editing/markup.cpp: (WebCore::createPageForSanitizingWebContent): Fixed the bug by making the HTML parser never yield. Also release-assert that the body is never null here. (WebCore::sanitizedMarkupForFragmentInDocument): Removed superflous call to WTFMove since appendChild takes a reference, not a Ref. * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::overlayPage): Deployed the same fix. * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::insertDataSynchronously): Added. * loader/DocumentWriter.h: 2018-05-29 Chris Dumez <cdumez@apple.com> Avoid unnecessary String allocation in isPublicSuffix(const String&) https://bugs.webkit.org/show_bug.cgi?id=186054 Reviewed by Sam Weinig. Avoid unnecessary String allocation in isPublicSuffix(const String&) by calling directly the decodeHostName() overload taking in a NSString*. This overload returns a NSString*, which is what we need. We would previously call the overloading taking in a String, which would return a String, which we would have to convert back to a NSString*. * platform/mac/PublicSuffixMac.mm: (WebCore::isPublicSuffix): 2018-05-29 Alex Christensen <achristensen@webkit.org> Do even fewer allocations in URL host operations https://bugs.webkit.org/show_bug.cgi?id=186003 Reviewed by Geoffrey Garen. * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::primaryDomain): * loader/ResourceLoadStatistics.h: * platform/URL.cpp: (WebCore::URL::hostIsIPAddress): * platform/URL.h: * platform/mac/URLMac.mm: (WebCore::URL::hostIsIPAddress): * platform/soup/URLSoup.cpp: (WebCore::URL::hostIsIPAddress): 2018-05-29 Tadeu Zagallo <tzagallo@apple.com> Don't assert on m_actionsStart when setting actions on DFA nodes https://bugs.webkit.org/show_bug.cgi?id=185979 <rdar://problem/39669458> Reviewed by Geoffrey Garen. DFANode::setActions is called immediately after the node is created, and once again to set the actions of catch-all regular expressions (.*) on the root node. That works because m_actionsStart is initially 0, since the root was the first node to be created, but may fail after minimizing the DFA, when the root may no longer be the first node, and therefore m_actionsStart would not be 0, even if there are no actions attached to that node. Test: http/tests/contentextensions/root-actions.html * contentextensions/DFANode.h: 2018-05-29 Nan Wang <n_wang@apple.com> AX: setValue on contenteditable should preserve whitespace https://bugs.webkit.org/show_bug.cgi?id=185897 Reviewed by Ryosuke Niwa. We should mimic typing when setting value to a contenteditable from accessibility instead of mutating the DOM by using setInnerText. Updated tests to cover this change. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setValue): 2018-05-29 Zalan Bujtas <zalan@apple.com> [LFC] Miscellaneous fixes to ensure no assertion in LayoutContext::layout https://bugs.webkit.org/show_bug.cgi?id=186052 Reviewed by Antti Koivisto. With this patch, LayoutContext::layout() does not assert on <html><body><div></div></body></html> anymore. * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::initializeRoot): New context root is always a layout root. * layout/LayoutContext.h: * layout/Verification.cpp: (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): we need computed margin/border/padding for width computation * layout/displaytree/DisplayBox.cpp: Add clone() method to be able to carry over the 'hasValid*' bits. (WebCore::Display::Box::Style::Style): (WebCore::Display::Box::borderBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::Rect::operator LayoutRect const): (WebCore::Display::Box::setSize): (WebCore::Display::Box::setHasValidMargin): (WebCore::Display::Box::setHasValidBorder): (WebCore::Display::Box::setHasValidPadding): (WebCore::Display::Box::Rect::setHasValidPosition): (WebCore::Display::Box::Rect::setHasValidSize): (WebCore::Display::Box::Rect::setSize): (WebCore::Display::Box::Rect::clone const): (WebCore::Display::Box::setMargin): (WebCore::Display::Box::setBorder): (WebCore::Display::Box::setPadding): (WebCore::Display::Box::Rect::Rect): Deleted. 2018-05-29 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] "Significant area painted" rendering progress event is rarely fired https://bugs.webkit.org/show_bug.cgi?id=186042 <rdar://problem/40604182> Reviewed by Tim Horton. Makes a minor tweak to the size of the relevant view rect in extra zoom mode, such that it's no wider than the visible content rect. Previously, the width of this rect has hard-coded to a value optimized for macOS (980), which makes it difficult for content laid out at device width in extra zoom mode to cover a significant portion of the relevant view rect. Test: RenderingProgressTests.FirstPaintWithSignificantArea * page/Page.cpp: (WebCore::relevantViewRect): 2018-05-29 Antoine Quint <graouts@apple.com> [Web Animations] Handle relative length units https://bugs.webkit.org/show_bug.cgi?id=186047 Reviewed by Dean Jackson. In order to correctly handle relative units, such as "em", "vw" and "vh", we need to do two things. First, because we need to apply the cascade to correctly compute relative lengths, we need to delay the computation of "blending keyframes" to when we have both keyframes data and a valid target. This also means that we need to reset blending keyframes when the target changes. As a result, old call sites of updateBlendingKeyframes() have been replaced by a call to m_blendingKeyframes.clear() and the method now gets called as part of apply() with the RenderStyle of the targeted element as a parameter. Second, and as a result of the first change, we need to update the accelerated animation state based on animation progress rather than when calling specific methods, such as Animation.play() and Animation.pause(), since blending keyframes may not be available at those more specific call sites. We now have a new updateAcceleratedAnimationState() method that gets called as part of apply(). We also rename animationPlayStateDidChange() to animationSuspensionStateDidChange() since this method was specific to suspension and had a confusing name. * animation/AnimationEffectReadOnly.h: Rename animationPlayStateDidChange() to animationSuspensionStateDidChange(). * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::getKeyframes): Fix a crash that revealed itself after other changes in this patch. We would later call into ComputedStyleExtractor::animationSuspensionStateDidChange() and this would yield an assertion because we'd call potentially call it with a custom CSS property. (WebCore::KeyframeEffectReadOnly::processKeyframes): Reset blending keyframes instead of calling updateBlendingKeyframes() since blending keyframes is now performed asynchronously upon style resolution. (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes): Take the target's RenderStyle as a parameter and use it to reset the associated StyleResolver's state, just like we do in StyleResolver::keyframeStylesForAnimation(), so that the CSS cascade is correctly accounted for when computing values using relative length units. Since blending keyframes can now be computed several times for a given set of keyframes, since the effect's target may change, we also need to create a copy of the MutableStyleProperties to pass to StyleRuleKeyframe::create(). (WebCore::KeyframeEffectReadOnly::setTarget): Reset blending keyframes instead of calling updateBlendingKeyframes() since blending keyframes is now performed asynchronously upon style resolution. (WebCore::KeyframeEffectReadOnly::apply): Update blending keyframes and the accelerated animation state. (WebCore::KeyframeEffectReadOnly::getAnimatedStyle): Make sure we have blending keyframes with a call to updateBlendingKeyframes() in case the animation hasn't naturally progressed when this method is called. (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): Make sure we have blending keyframes with a call to updateBlendingKeyframes() in case the animation hasn't naturally progressed when this method is called. (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState): Account for the animation's local time and play state to update the accelerated animation state. (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Record the last accelerated action in a member variable which we can use to determine if we're running accelerated accounting for uncommited changes. (WebCore::KeyframeEffectReadOnly::animationDidSeek): Only record an AcceleratedAction::Seek action if we're already running accelerated. (WebCore::KeyframeEffectReadOnly::animationSuspensionStateDidChange): Only record an AcceleratedAction::Pause or AcceleratedAction::Play action if we're already running accelerated. (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Ensure we clone and clear the list of accelerated actions and check that we have any cloned actions before proceeding any further. Then we can stop accounting for m_startedAccelerated since the list of accelerated actions already account for animation state changes. (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Deleted. * animation/KeyframeEffectReadOnly.h: (WebCore::KeyframeEffectReadOnly::isRunningAccelerated const): Account for the m_lastRecordedAcceleratedAction to identify whether we're running. * animation/WebAnimation.cpp: (WebCore::WebAnimation::play): Stop calling animationPlayStateDidChange() directly since the accelerated animation state is now updated when the animation's effect is applied. (WebCore::WebAnimation::pause): Stop calling animationPlayStateDidChange() directly since the accelerated animation state is now updated when the animation's effect is applied. (WebCore::WebAnimation::resolve): Make sure we update the finished state prior to applying the animation's effect since the play state can change when updating the finished state and KeyframeEffectReadOnly::updateAcceleratedAnimationState(), which is called when calling into KeyframeEffectReadOnly::apply(), relies on it to correctly update the accelerated animation state. (WebCore::WebAnimation::setSuspended): Rename animationPlayStateDidChange() to animationSuspensionStateDidChange(). * css/StyleResolver.cpp: (WebCore::StyleResolver::setNewStateWithElement): Add a new public method to reset a StyleResolver's state such that we can call it when creating blending keyframes for JS-originated animations just like we do when creating blending keyframes for CSS Animations in keyframeStylesForAnimation(). (WebCore::StyleResolver::keyframeStylesForAnimation): Use the new setNewStateWithElement() method. * css/StyleResolver.h: 2018-05-29 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Update "qtdemux: Clarify field name about stream-encryption-system" patch https://bugs.webkit.org/show_bug.cgi?id=186040 Reviewed by Xabier Rodriguez-Calvar. s/avalaible-stream-encryption-systems/available-stream-encryption-systems/g Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-* * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::extractEventsAndSystemsFromMessage): 2018-05-28 Zalan Bujtas <zalan@apple.com> Unreviewed build fix. * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::Rect::operator LayoutRect const): 2018-05-28 Zalan Bujtas <zalan@apple.com> [LFC] Add Rect interface to Display::Box https://bugs.webkit.org/show_bug.cgi?id=186019 Reviewed by Antti Koivisto. Having a dedicated Rect class and moving the geometry invalidation to it enables us to call displayBox.contentBox().left() even when the widht/height are not computed yet. Also having Rect with top/left/bottom/right interface is more aligned with the rest of the layout code than x/y/maxX/maxY. * layout/FormattingContextGeometry.cpp: (WebCore::Layout::contentHeightForFormattingContextRoot): * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::marginBox const): (WebCore::Display::Box::borderBox const): (WebCore::Display::Box::paddingBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::Rect::invalidateTop): (WebCore::Display::Box::Rect::invalidateLeft): (WebCore::Display::Box::Rect::invalidateWidth): (WebCore::Display::Box::Rect::invalidateHeight): (WebCore::Display::Box::Rect::hasValidPosition const): (WebCore::Display::Box::Rect::hasValidSize const): (WebCore::Display::Box::Rect::hasValidGeometry const): (WebCore::Display::Box::rect const): (WebCore::Display::Box::top const): (WebCore::Display::Box::left const): (WebCore::Display::Box::bottom const): (WebCore::Display::Box::right const): (WebCore::Display::Box::topLeft const): (WebCore::Display::Box::bottomRight const): (WebCore::Display::Box::size const): (WebCore::Display::Box::width const): (WebCore::Display::Box::height const): (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setWidth): (WebCore::Display::Box::setHeight): (WebCore::Display::Box::Rect::invalidatePosition): (WebCore::Display::Box::Rect::setHasValidPosition): (WebCore::Display::Box::Rect::Rect): (WebCore::Display::Box::Rect::top const): (WebCore::Display::Box::Rect::left const): (WebCore::Display::Box::Rect::bottom const): (WebCore::Display::Box::Rect::right const): (WebCore::Display::Box::Rect::topLeft const): (WebCore::Display::Box::Rect::bottomRight const): (WebCore::Display::Box::Rect::size const): (WebCore::Display::Box::Rect::width const): (WebCore::Display::Box::Rect::height const): (WebCore::Display::Box::Rect::setTopLeft): (WebCore::Display::Box::Rect::setTop): (WebCore::Display::Box::Rect::setLeft): (WebCore::Display::Box::Rect::setWidth): (WebCore::Display::Box::Rect::setHeight): (WebCore::Display::Box::Rect::shiftLeftTo): (WebCore::Display::Box::Rect::shiftRightTo): (WebCore::Display::Box::Rect::shiftTopTo): (WebCore::Display::Box::Rect::shiftBottomTo): (WebCore::Display::Box::Rect::expand): (WebCore::Display::Box::invalidateTop): Deleted. (WebCore::Display::Box::invalidateLeft): Deleted. (WebCore::Display::Box::invalidateWidth): Deleted. (WebCore::Display::Box::invalidateHeight): Deleted. (WebCore::Display::Box::hasValidPosition const): Deleted. (WebCore::Display::Box::hasValidSize const): Deleted. (WebCore::Display::Box::hasValidGeometry const): Deleted. (WebCore::Display::Box::invalidatePosition): Deleted. (WebCore::Display::Box::setHasValidPosition): Deleted. 2018-05-28 Zalan Bujtas <zalan@apple.com> [LFC] Add formatting context testing codepath in FrameViewLayoutContext https://bugs.webkit.org/show_bug.cgi?id=186036 Reviewed by Antti Koivisto. This is to verify the formatting context layout correctness. * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::LayoutContext): (WebCore::Layout::LayoutContext::initializeRoot): * layout/LayoutContext.h: (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const): * page/FrameViewLayoutContext.cpp: (WebCore::layoutUsingFormattingContext): (WebCore::FrameViewLayoutContext::layout): 2018-05-28 Zalan Bujtas <zalan@apple.com> [LFC] Add layout tree verification. https://bugs.webkit.org/show_bug.cgi?id=186018 Reviewed by Antti Koivisto. Compare layout and render tree geometry and output the mismtaching rectangles. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add missing headers and make then private. * layout/LayoutContext.h: * layout/Verification.cpp: Added. (WebCore::Layout::outputMismatchedBoxInformationIfNeeded): (WebCore::Layout::verifySubtree): (WebCore::Layout::LayoutContext::verifyAndOutputLayoutTree const): 2018-05-28 Sam Weinig <sam@webkit.org> Modernize SVGRenderStyleDefs.h https://bugs.webkit.org/show_bug.cgi?id=186024 Reviewed by Daniel Bates. Modernized the set of enums in SVGRenderStyleDefs.h and WindRule.h by: - Converting them to enum classes - Renaming them to remove unnecessary prefix 'E's - Renaming values to take advantage of enum class scoping (e.g. StyleDifferenceEqual -> StyleDifference::Equal) - Renaming to match modern conventions (e.g BNONE -> None) Modernizes the following enums: SVGPaintType BaselineShift (renamed from EBaselineShift) TextAnchor (renamed from ETextAnchor) ColorInterpolation (renamed from EColorInterpolation) ColorRendering (renamed from EColorRendering) ShapeRendering (renamed from EShapeRendering) GlyphOrientation (renamed from EGlyphOrientation) AlignmentBaseline (renamed from EAlignmentBaseline) DominantBaseline (renamed from EDominantBaseline) VectorEffect (renamed from EVectorEffect) BufferedRendering (renamed from EBufferedRendering) MaskType (renamed from EMaskType) WindRule * css/CSSBasicShapes.cpp: (WebCore::buildPathString): (WebCore::buildPolygonString): * css/CSSBasicShapes.h: * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator WindRule const): (WebCore::CSSPrimitiveValue::operator AlignmentBaseline const): (WebCore::CSSPrimitiveValue::operator BufferedRendering const): (WebCore::CSSPrimitiveValue::operator ColorInterpolation const): (WebCore::CSSPrimitiveValue::operator ColorRendering const): (WebCore::CSSPrimitiveValue::operator DominantBaseline const): (WebCore::CSSPrimitiveValue::operator ShapeRendering const): (WebCore::CSSPrimitiveValue::operator TextAnchor const): (WebCore::CSSPrimitiveValue::operator VectorEffect const): (WebCore::CSSPrimitiveValue::operator MaskType const): (WebCore::CSSPrimitiveValue::operator EAlignmentBaseline const): Deleted. (WebCore::CSSPrimitiveValue::operator EBufferedRendering const): Deleted. (WebCore::CSSPrimitiveValue::operator EColorInterpolation const): Deleted. (WebCore::CSSPrimitiveValue::operator EColorRendering const): Deleted. (WebCore::CSSPrimitiveValue::operator EDominantBaseline const): Deleted. (WebCore::CSSPrimitiveValue::operator EShapeRendering const): Deleted. (WebCore::CSSPrimitiveValue::operator ETextAnchor const): Deleted. (WebCore::CSSPrimitiveValue::operator EVectorEffect const): Deleted. (WebCore::CSSPrimitiveValue::operator EMaskType const): Deleted. * css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::glyphOrientationToCSSPrimitiveValue): (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const): (WebCore::ComputedStyleExtractor::svgPropertyValue): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertGlyphOrientation): (WebCore::StyleBuilderConverter::convertGlyphOrientationOrAuto): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueBaselineShift): (WebCore::StyleBuilderCustom::applyValueFill): (WebCore::StyleBuilderCustom::applyValueStroke): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeBasicShapePolygon): (WebCore::consumeBasicShapePath): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::toWindRule): * page/animation/CSSPropertyAnimation.cpp: (WebCore::PropertyWrapperSVGPaint::PropertyWrapperSVGPaint): * platform/graphics/FloatPolygon.cpp: (WebCore::FloatPolygon::contains const): * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::fillRectWithRoundedHole): * platform/graphics/GraphicsContext.h: * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::shapeLayerWindRule const): * platform/graphics/GraphicsLayer.h: * platform/graphics/GraphicsTypes.cpp: (WebCore::operator<<): * platform/graphics/Path.h: * platform/graphics/ShadowBlur.cpp: (WebCore::ShadowBlur::drawInsetShadow): (WebCore::ShadowBlur::drawInsetShadowWithoutTiling): (WebCore::ShadowBlur::drawInsetShadowWithTiling): * platform/graphics/WindRule.h: (): Deleted. * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayerCocoa::shapeWindRule const): (PlatformCALayerCocoa::setShapeWindRule): * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::calculateDrawingMode): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::fillRectWithRoundedHole): (WebCore::GraphicsContext::clipPath): * platform/graphics/cg/PathCG.cpp: (WebCore::Path::contains const): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawAnimation): * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::buildReferenceFilter): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintBorder): (WebCore::RenderBoxModelObject::clipBorderSidePolygon): * rendering/RenderElement.cpp: (WebCore::RenderElement::paintOutline): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::computeClipPath const): * rendering/style/BasicShapes.h: (WebCore::BasicShape::windRule const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::fillPaintType const): (WebCore::RenderStyle::setFillPaintColor): (WebCore::RenderStyle::strokePaintType const): (WebCore::RenderStyle::setStrokePaintColor): * rendering/style/SVGRenderStyle.h: (WebCore::SVGRenderStyle::initialAlignmentBaseline): (WebCore::SVGRenderStyle::initialDominantBaseline): (WebCore::SVGRenderStyle::initialBaselineShift): (WebCore::SVGRenderStyle::initialVectorEffect): (WebCore::SVGRenderStyle::initialBufferedRendering): (WebCore::SVGRenderStyle::initialClipRule): (WebCore::SVGRenderStyle::initialColorInterpolation): (WebCore::SVGRenderStyle::initialColorInterpolationFilters): (WebCore::SVGRenderStyle::initialColorRendering): (WebCore::SVGRenderStyle::initialFillRule): (WebCore::SVGRenderStyle::initialShapeRendering): (WebCore::SVGRenderStyle::initialTextAnchor): (WebCore::SVGRenderStyle::initialGlyphOrientationHorizontal): (WebCore::SVGRenderStyle::initialGlyphOrientationVertical): (WebCore::SVGRenderStyle::initialFillPaintType): (WebCore::SVGRenderStyle::initialStrokePaintType): (WebCore::SVGRenderStyle::initialMaskType): (WebCore::SVGRenderStyle::setAlignmentBaseline): (WebCore::SVGRenderStyle::setDominantBaseline): (WebCore::SVGRenderStyle::setBaselineShift): (WebCore::SVGRenderStyle::setVectorEffect): (WebCore::SVGRenderStyle::setBufferedRendering): (WebCore::SVGRenderStyle::setClipRule): (WebCore::SVGRenderStyle::setColorInterpolation): (WebCore::SVGRenderStyle::setColorInterpolationFilters): (WebCore::SVGRenderStyle::setColorRendering): (WebCore::SVGRenderStyle::setFillRule): (WebCore::SVGRenderStyle::setShapeRendering): (WebCore::SVGRenderStyle::setTextAnchor): (WebCore::SVGRenderStyle::setGlyphOrientationHorizontal): (WebCore::SVGRenderStyle::setGlyphOrientationVertical): (WebCore::SVGRenderStyle::setMaskType): (WebCore::SVGRenderStyle::alignmentBaseline const): (WebCore::SVGRenderStyle::dominantBaseline const): (WebCore::SVGRenderStyle::baselineShift const): (WebCore::SVGRenderStyle::vectorEffect const): (WebCore::SVGRenderStyle::bufferedRendering const): (WebCore::SVGRenderStyle::clipRule const): (WebCore::SVGRenderStyle::colorInterpolation const): (WebCore::SVGRenderStyle::colorInterpolationFilters const): (WebCore::SVGRenderStyle::colorRendering const): (WebCore::SVGRenderStyle::fillRule const): (WebCore::SVGRenderStyle::shapeRendering const): (WebCore::SVGRenderStyle::textAnchor const): (WebCore::SVGRenderStyle::glyphOrientationHorizontal const): (WebCore::SVGRenderStyle::glyphOrientationVertical const): (WebCore::SVGRenderStyle::fillPaintType const): (WebCore::SVGRenderStyle::strokePaintType const): (WebCore::SVGRenderStyle::maskType const): (WebCore::SVGRenderStyle::visitedLinkFillPaintType const): (WebCore::SVGRenderStyle::visitedLinkStrokePaintType const): (WebCore::SVGRenderStyle::hasStroke const): (WebCore::SVGRenderStyle::hasFill const): (WebCore::SVGRenderStyle::setBitDefaults): * rendering/style/SVGRenderStyleDefs.h: (WebCore::StyleFillData::create): (WebCore::StyleFillData::operator!= const): (WebCore::StyleStrokeData::create): (WebCore::StyleStrokeData::operator!= const): (WebCore::StyleStopData::create): (WebCore::StyleStopData::operator!= const): (WebCore::StyleTextData::create): (WebCore::StyleTextData::operator!= const): (WebCore::StyleMiscData::create): (WebCore::StyleMiscData::operator!= const): (WebCore::StyleShadowSVGData::create): (WebCore::StyleShadowSVGData::operator!= const): (WebCore::StyleResourceData::create): (WebCore::StyleResourceData::operator!= const): (WebCore::StyleInheritedResourceData::create): (WebCore::StyleInheritedResourceData::operator!= const): (WebCore::StyleLayoutData::create): (WebCore::StyleLayoutData::operator!= const): (): Deleted. * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::paint): * rendering/svg/RenderSVGRect.cpp: (WebCore::RenderSVGRect::updateShapeFromElement): * rendering/svg/RenderSVGResource.cpp: (WebCore::requestPaintingResource): * rendering/svg/RenderSVGResourceClipper.cpp: (WebCore::RenderSVGResourceClipper::pathOnlyClipping): * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::buildPrimitives const): * rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::applyResource): * rendering/svg/RenderSVGResourceMasker.cpp: (WebCore::RenderSVGResourceMasker::applyResource): (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage): * rendering/svg/RenderSVGResourcePattern.cpp: (WebCore::RenderSVGResourcePattern::applyResource): * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::paint): * rendering/svg/RenderSVGShape.h: (WebCore::RenderSVGShape::hasNonScalingStroke const): * rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::writeStyle): (WebCore::writeSVGInlineTextBox): * rendering/svg/SVGResources.cpp: (WebCore::paintingResourceFromSVGPaint): * rendering/svg/SVGTextChunk.cpp: (WebCore::SVGTextChunk::SVGTextChunk): * rendering/svg/SVGTextLayoutEngineBaseline.cpp: (WebCore::SVGTextLayoutEngineBaseline::calculateBaselineShift const): (WebCore::SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBaseline const): (WebCore::SVGTextLayoutEngineBaseline::calculateAlignmentBaselineShift const): (WebCore::SVGTextLayoutEngineBaseline::calculateGlyphOrientationAngle const): * rendering/svg/SVGTextLayoutEngineBaseline.h: 2018-05-28 Carlos Garcia Campos <cgarcia@igalia.com> [Web Animations] Test webanimations/css-animations.html is crashing https://bugs.webkit.org/show_bug.cgi?id=186031 Reviewed by Antoine Quint. This is another case of std::optional value being used while it's nullopt, I guess this started to fail when we stopped using the WTF implementation of std::optional. The problem is that we try to get the current iteration of a declarative animation when the active time is unresolved. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): Use value_or(0) instead of value() to get the current iteration of the effect. 2018-05-28 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Handle changes in the "drm-preferred-decryption-system-id" NEED_CONTEXT message. https://bugs.webkit.org/show_bug.cgi?id=185948 Reviewed by Xabier Rodriguez-Calvar. - The "stream-encryption-systems" field of the "drm-preferred-decryption-system-id" query was renamed to "avalaible-stream-encryption-systems" - It can now be NULL, meaning there is no decryptor avalaible. Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-* * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::extractEventsAndSystemsFromMessage): Handle NULL value for "avalaible-stream-encryption-systems", moved some code to make the order of the Arrays in the pair clearer. 2018-05-27 Dan Bernstein <mitz@apple.com> Reverted the changes made for https://webkit.org/b/186016 They broke the USE(APPLE_INTERNAL_SDK) Sierra build. 2018-05-27 David Kilzer <ddkilzer@apple.com> [iOS] Fix warnings about leaks found by clang static analyzer <https://webkit.org/b/186009> <rdar://problem/40574267> Reviewed by Daniel Bates. * Modules/webauthn/cocoa/LocalAuthenticator.mm: (WebCore::LocalAuthenticator::makeCredential): (WebCore::LocalAuthenticator::getAssertion): (WebCore::LocalAuthenticator::issueClientCertificate const): - Don't leak CF objects in early return paths, and get rid of `retained*` variables, by making original variables use RetainPtr<>. * bridge/objc/WebScriptObject.mm: (+[WebUndefined allocWithZone:]): Modernize WebUndefined by using NeverDestroyed<RetainPr<WebUndefined>> type. Explicitly retain the object returned on each call. (+[WebUndefined undefined]): Explicitly autorelease the object returned. Note that neither of these changes fixes the static analyzer warnings in this source file. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::exernalDeviceDisplayNameForPlayer): Use RetainPtr<> to stop leaking NSString objects in a loop. * platform/ios/wak/WAKWindow.h: (-[WAKWindow _newFirstResponderAfterResigning]): Mark as NS_RETURNS_NOT_RETAINED like the corresponding AppKit method since this doesn't return a new object. This fixes some false-positive leaks warnings. 2018-05-27 Dan Bernstein <mitz@apple.com> [Cocoa] Avoid importing directly from subumbrella frameworks https://bugs.webkit.org/show_bug.cgi?id=186016 Reviewed by Sam Weinig. * Configurations/WebCore.xcconfig: Removed -iframework options from OTHER_CFLAGS and OTHER_CPLUSPLUSFLAGS. * editing/mac/DictionaryLookup.mm: Import Quartz.h instead of a PDFKit header. * html/HTMLKeygenElement.cpp: Removed "using namespace WebCore" from this WebCore implementation file. * platform/mac/PlatformEventFactoryMac.mm: Import Carbon.h instead of HIToolbox headers. * platform/mac/PlatformScreenMac.mm: Import ApplicationServices.h instead of ColorSync.h when using SDKs earlier than 10.13. * platform/mediastream/CaptureDeviceManager.cpp: Enclosed the definitions in the WebCore namespace and removed "using namespace WebCore" from this WebCore implementation file. * platform/text/mac/TextEncodingRegistryMac.mm: Import Carbon.h instead of CarbonCore.h. 2018-05-27 Fujii Hironori <Hironori.Fujii@sony.com> REGRESSION(r232198) [WinCairo] cannot convert from 'WTF::StringView' to 'const WTF::String' https://bugs.webkit.org/show_bug.cgi?id=186027 Unreviewed build fix No new tests (No behavior change). * platform/network/curl/AuthenticationChallengeCurl.cpp: (WebCore::AuthenticationChallenge::protectionSpaceFromHandle): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupTransfer): (WebCore::CurlRequest::willSetupSslCtx): 2018-05-27 Sam Weinig <sam@webkit.org> Modernize RenderStyleConstants.h - Part 3 https://bugs.webkit.org/show_bug.cgi?id=186015 Reviewed by Yusuke Suzuki. Modernized the third and final set of enums in RenderStyleConstants.h by: - Converting them to enum classes - Renaming them to remove unnecessary prefix 'E's - Renaming values to take advantage of enum class scoping (e.g. StyleDifferenceEqual -> StyleDifference::Equal) Modernizes the following enums: TextDecoration TextDecorationSkip (renamed from TextDecorationSkipItems) TextUnderlinePosition HangingPunctuation SpeakAs (renamed from ESpeakAs) TextEmphasisPosition (renamed from TextEmphasisPositions) This final set of enums are mostly (TextUnderlinePosition isn't really) used as bitmasks, so this change also converts their uses to use OptionSet. * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::speakAsProperty const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::speakAsProperty const): (WebCore::AccessibilityRenderObject::hasPlainText const): (WebCore::AccessibilityRenderObject::hasUnderline const): * accessibility/AccessibilityRenderObject.h: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (AXAttributeStringSetStyle): * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (AXAttributeStringSetStyle): * css/CSSComputedStyleDeclaration.cpp: (WebCore::renderTextDecorationFlagsToCSSValue): (WebCore::renderTextDecorationSkipFlagsToCSSValue): (WebCore::renderEmphasisPositionFlagsToCSSValue): (WebCore::speakAsToCSSValue): (WebCore::hangingPunctuationToCSSValue): * css/CSSLineBoxContainValue.h: * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator HangingPunctuation const): (WebCore::CSSPrimitiveValue::operator TextDecoration const): (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator TextUnderlinePosition const): (WebCore::CSSPrimitiveValue::operator SpeakAs const): (WebCore::CSSPrimitiveValue::operator ESpeakAs const): Deleted. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertTextDecoration): (WebCore::StyleBuilderConverter::valueToEmphasisPosition): (WebCore::StyleBuilderConverter::convertTextEmphasisPosition): (WebCore::StyleBuilderConverter::convertTextUnderlinePosition): (WebCore::StyleBuilderConverter::valueToDecorationSkip): (WebCore::StyleBuilderConverter::convertTextDecorationSkip): (WebCore::StyleBuilderConverter::convertSpeakAs): (WebCore::StyleBuilderConverter::convertHangingPunctuation): * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle const): * editing/cocoa/HTMLConverter.mm: (WebCore::editingAttributedStringFromRange): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::maxLogicalBottomForTextDecorationLine const): (WebCore::InlineFlowBox::minLogicalTopForTextDecorationLine const): * rendering/InlineFlowBox.h: * rendering/InlineTextBox.cpp: (WebCore::emphasisPositionHasNeitherLeftNorRight): (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const): (WebCore::InlineTextBox::paint): (WebCore::InlineTextBox::paintMarkedTextDecoration): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const): * rendering/RenderBlockLineLayout.cpp: (WebCore::setLogicalWidthForTextRun): (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): * rendering/RenderElement.cpp: (WebCore::RenderElement::enclosingRendererWithTextDecoration const): * rendering/RenderElement.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addCell): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): (WebCore::SimpleLineLayout::canUseForWithReason): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::TextDecorationPainter): (WebCore::TextDecorationPainter::paintTextDecoration): (WebCore::collectStylesForRenderer): (WebCore::TextDecorationPainter::stylesForRenderer): * rendering/TextDecorationPainter.h: * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleText): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::RenderStyle): (WebCore::RenderStyle::changeAffectsVisualOverflow const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::textDecorationsInEffect const): (WebCore::RenderStyle::textDecoration const): (WebCore::RenderStyle::textDecorationSkip const): (WebCore::RenderStyle::hangingPunctuation const): (WebCore::RenderStyle::textEmphasisPosition const): (WebCore::RenderStyle::speakAs const): (WebCore::RenderStyle::addToTextDecorationsInEffect): (WebCore::RenderStyle::setTextDecorationsInEffect): (WebCore::RenderStyle::setTextDecoration): (WebCore::RenderStyle::setTextDecorationSkip): (WebCore::RenderStyle::setSpeakAs): (WebCore::RenderStyle::setTextEmphasisPosition): (WebCore::RenderStyle::setHangingPunctuation): (WebCore::RenderStyle::initialHangingPunctuation): (WebCore::RenderStyle::initialTextDecoration): (WebCore::RenderStyle::initialTextDecorationSkip): (WebCore::RenderStyle::initialTextUnderlinePosition): (WebCore::RenderStyle::initialSpeakAs): (WebCore::RenderStyle::initialTextEmphasisPosition): * rendering/style/RenderStyleConstants.h: (WebCore::operator|): Deleted. (WebCore::operator|=): Deleted. * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): * rendering/style/StyleVisualData.cpp: (WebCore::StyleVisualData::StyleVisualData): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paint): (WebCore::positionOffsetForDecoration): (WebCore::thicknessForDecoration): (WebCore::findRendererDefininingTextDecoration): (WebCore::SVGInlineTextBox::paintDecoration): (WebCore::SVGInlineTextBox::paintDecorationWithStyle): * rendering/svg/SVGInlineTextBox.h: * style/InlineTextBoxStyle.cpp: (WebCore::computeUnderlineOffset): (WebCore::visualOverflowForDecorations): 2018-05-26 Zalan Bujtas <zalan@apple.com> [LFC] Implement margin computation https://bugs.webkit.org/show_bug.cgi?id=186008 Reviewed by Antti Koivisto. * WebCore.xcodeproj/project.pbxproj: * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeMargin const): (WebCore::Layout::FormattingContext::marginTop const): Deleted. (WebCore::Layout::FormattingContext::marginLeft const): Deleted. (WebCore::Layout::FormattingContext::marginBottom const): Deleted. (WebCore::Layout::FormattingContext::marginRight const): Deleted. * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::computeMargin const): (WebCore::Layout::BlockFormattingContext::marginTop const): Deleted. (WebCore::Layout::BlockFormattingContext::marginBottom const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): (WebCore::Layout::BlockFormattingContext::Geometry::computedMargin): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::_isMarginBottomCollapsedWithParent): (WebCore::Layout::collapsedMarginBottomFromLastChild): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom): (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent): (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom): (WebCore::Layout::BlockMarginCollapse::marginTop): Deleted. (WebCore::Layout::BlockMarginCollapse::marginBottom): Deleted. (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent): Deleted. (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom): Deleted. * layout/blockformatting/BlockMarginCollapse.h: Removed. 2018-05-25 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Delete unnecessary WebCascadeList in ComplexTextController https://bugs.webkit.org/show_bug.cgi?id=186007 Reviewed by Zalan Bujtas. Inside ComplexTextController::collectComplexTextRuns(), we chop up text based on which fonts should be used to render which grapheme clusters. For each grapheme cluster, we run through the font-family list in FontCascade::fontForCombiningCharacterSequence() and find the first font that can render the cluster. If no items can render the cluster, we construct a WebCascadeList and let CoreText try to figure out which fonts can render which clusters. Except there's no point, because we just determined that no font in the list can be used to render the cluster. CoreText isn't magic; it isn't going to somehow disagree with us. WebCascadeList is just useless code. No new tests because there is no behavior change. * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): (-[WebCascadeList initWithFont:character:]): Deleted. (-[WebCascadeList count]): Deleted. (-[WebCascadeList objectAtIndex:]): Deleted. 2018-05-25 Myles C. Maxfield <mmaxfield@apple.com> Improve the performance of Font::canRenderCombiningCharacterSequence() https://bugs.webkit.org/show_bug.cgi?id=185933 Reviewed by Ryosuke Niwa. We don't need to create a whole CTLine just to determine whether or not a font supports rendering a grapheme cluster. Instead, the right way to do it is just see if the font's cmap table supports every code point in the cluster. This patch reports a 2% progression on the attached PerformanceTest. Test: Layout/ComplexLongUnique.html * platform/graphics/Font.cpp: (WebCore::Font::canRenderCombiningCharacterSequence const): * platform/graphics/Font.h: * platform/graphics/cocoa/FontCocoa.mm: (WebCore::provideStringAndAttributes): Deleted. (WebCore::Font::canRenderCombiningCharacterSequence const): Deleted. * platform/graphics/freetype/SimpleFontDataFreeType.cpp: (WebCore::Font::canRenderCombiningCharacterSequence const): Deleted. 2018-05-25 Eric Carlson <eric.carlson@apple.com> Captions are sized incorrectly in PiP mode https://bugs.webkit.org/show_bug.cgi?id=186005 <rdar://problem/39729718> Reviewed by Dean Jackson. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::updateSizes): Only sync text track bounds when the size actually changes. * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): Call syncTextTrackBounds. (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): Set the text track layer size to m_videoFullscreenFrame, it is always set the size of the PiP/Fullscreen layer. 2018-05-25 Timothy Hatcher <timothy@apple.com> Setting drawsBackground to YES on a WKView doesn't take effect immediately https://bugs.webkit.org/show_bug.cgi?id=185885 rdar://problem/39706506 Reviewed by Simon Fraser. * page/Frame.cpp: (WebCore::Frame::createView): Always call updateBackgroundRecursively, it handles invalid colors correctly already. * page/FrameView.cpp: (WebCore::FrameView::setTransparent): Call setNeedsLayout() since base background color and transparent is used to update layers. (WebCore::FrameView::setBaseBackgroundColor): Ditto. (WebCore::FrameView::updateBackgroundRecursively): Schedule layout if needed. * page/FrameView.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::viewHasTransparentBackground const): Use baseBackgroundColor instead of hardcoding white. (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Fixed incorrect changed logging. 2018-05-25 Youenn Fablet <youenn@apple.com> Migrate From-Origin to Cross-Origin-Resource-Policy https://bugs.webkit.org/show_bug.cgi?id=185840 Reviewed by Chris Dumez. Tests: http/wpt/cross-origin-resource-policy/fetch-in-iframe.html http/wpt/cross-origin-resource-policy/fetch.html http/wpt/cross-origin-resource-policy/iframe-loads.html http/wpt/cross-origin-resource-policy/image-loads.html http/wpt/cross-origin-resource-policy/script-loads.html * platform/network/HTTPHeaderNames.in: * platform/network/HTTPParsers.cpp: (WebCore::parseCrossOriginResourcePolicyHeader): * platform/network/HTTPParsers.h: 2018-05-25 Daniel Bates <dabates@apple.com> NavigationAction should not hold a strong reference to a Document https://bugs.webkit.org/show_bug.cgi?id=185712 <rdar://problem/40320916> Reviewed by Brent Fulgham. Have NavigationAction store all the relevant details callers need to know about the document that initiated the navigation in an independent data structure, called NavigationAction::Requester, as opposed to holding a RefPtr to the document itself. The benefit of this approach is that it is a step towards ensuring that NavigationAction does not keep the document alive after navigating to a new document given that DocumentLoader stores the NavigationAction for the last navigation. * loader/NavigationAction.cpp: (WebCore::NavigationAction::Requester::Requester): Track all relevant details of the document that requested this navigation that are needed to support WebKit API/SPI. We hold the SecurityOrigin in a RefPtr to avoid the need to explicitly define a copy constructor and copy-assignment constructor because Requester needs to be copyable as NavigationAction, which owns a Requester, is copyable. (WebCore::shouldTreatAsSameOriginNavigation): Fix some style nits. (WebCore::NavigationAction::NavigationAction): Instantiate a Requester from the specified document. * loader/NavigationAction.h: (WebCore::NavigationAction::Requester::url const): Added. (WebCore::NavigationAction::Requester::securityOrigin const): Added. (WebCore::NavigationAction::Requester::pageID const): Added. (WebCore::NavigationAction::Requester::frameID const): Added. (WebCore::NavigationAction::requester const): Returns details about the document that requested this navigation, if applicable. (WebCore::NavigationAction::isEmpty const): Update criterion for being empty to consider the requester. (WebCore::NavigationAction::setOpener): Extracted out the datatype of the parameter into a type alias to avoid duplication and updated this code to use the alias. (WebCore::NavigationAction::opener const): Ditto. (WebCore::NavigationAction::sourceDocument const): Deleted. 2018-05-25 Jeremy Jones <jeremyj@apple.com> Fullscreen element can be clipped by ancestor. https://bugs.webkit.org/show_bug.cgi?id=185980 rdar://problem/40320006 Reviewed by Jer Noble. Adds style to fullscreen css to prevent the fullscreen element from being clipped by an ancestor element. * css/fullscreen.css: (:-webkit-full-screen-ancestor:not(iframe)): 2018-05-25 Jeremy Jones <jeremyj@apple.com> Use correct AVKit delegate for picture in picture failure. https://bugs.webkit.org/show_bug.cgi?id=185981 rdar://problem/40549652 Reviewed by Eric Carlson. No new tests since we don't have a way to simulate picture-in-picture failure. Use the new name for this delegate callback. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerViewControllerDelegate playerViewController:failedToStartPictureInPictureWithError:]): (-[WebAVPlayerViewControllerDelegate playerViewControllerFailedToStartPictureInPicture:withError:]): Deleted. 2018-05-25 Zalan Bujtas <zalan@apple.com> iBooks: text can disappear/flash during finger drag highlight https://bugs.webkit.org/show_bug.cgi?id=185993 <rdar://problem/34026943> Reviewed by Simon Fraser. Reuse existing tiles when override rect is fully covered by the active grid. Also, recover dropped tiles if override rect forces us to create new ones. Unable to create a reproducible test case. * platform/ios/LegacyTileCache.h: * platform/ios/LegacyTileCache.mm: (WebCore::LegacyTileCache::setOverrideVisibleRect): * platform/ios/LegacyTileLayer.mm: (-[LegacyTileHostLayer renderInContext:]): 2018-05-25 Eric Carlson <eric.carlson@apple.com> Encode ISOWebVTTCue "strings" when logging https://bugs.webkit.org/show_bug.cgi?id=185991 <rdar://problem/40563902> Reviewed by Jer Noble. * platform/graphics/iso/ISOVTTCue.cpp: (WebCore::ISOWebVTTCue::toJSONString const): Use encodeWithURLEscapeSequences for all Strings taken from ISO boxes. 2018-05-25 Alex Christensen <achristensen@webkit.org> URL::host should return a StringView to reduce allocations https://bugs.webkit.org/show_bug.cgi?id=185986 Reviewed by Geoff Garen. No change in behaviour. Just fewer allocations. * Modules/plugins/YouTubePluginReplacement.cpp: (WebCore::isYouTubeURL): (WebCore::processAndCreateYouTubeURL): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): (WebCore::WebSocketHandshake::host const): * contentextensions/ContentExtension.cpp: (WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::parseAttribute): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaSessionTitle const): (WebCore::needsSeekingSupportQuirk): * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns): (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): * html/ImageDocument.cpp: (WebCore::ImageDocument::finishedParsing): * html/URLUtils.h: (WebCore::URLUtils<T>::hostname const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::setFirstPartyForCookies): * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLink): * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::primaryDomain): * loader/mac/LoaderNSURLExtras.mm: (suggestedFilenameWithMIMEType): * page/Chrome.cpp: (WebCore::Chrome::mouseDidMoveOverElement): * page/Location.cpp: (WebCore::Location::hostname const): * page/Page.cpp: (WebCore::Page::mainFrameLoadStarted): * page/PerformanceMonitor.cpp: (WebCore::reportPageOverPostLoadResourceThreshold): * page/SecurityOrigin.cpp: (WebCore::isLoopbackIPAddress): (WebCore::shouldTreatAsPotentiallyTrustworthy): (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress): * page/SecurityOrigin.h: * page/SecurityOriginData.h: (WebCore::SecurityOriginData::fromURL): * page/UserContentURLPattern.cpp: (WebCore::UserContentURLPattern::matchesHost const): * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::hostMatches const): * platform/PublicSuffix.h: * platform/URL.cpp: (WebCore::URL::host const): (WebCore::URL::hostAndPort const): (WebCore::URL::isMatchingDomain const): * platform/URL.h: * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): * platform/network/ResourceRequestBase.h: (WebCore::registrableDomainsAreEqual): * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::getPartitioningDomain): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::createStreams): * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::hostname const): * workers/service/server/SWServer.cpp: (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks): 2018-05-24 Dean Jackson <dino@apple.com> Need to provide a way to feature detect support for system preview https://bugs.webkit.org/show_bug.cgi?id=185970 <rdar://problem/40538321> Reviewed by Sam Weinig. Update the supports function in the DOMTokenList that HTMLAnchorElement produces for relList to return true for the system preview token. Tested internally. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::relList const): 2018-05-25 Chris Dumez <cdumez@apple.com> Minor ApplicationCacheStorage clean up https://bugs.webkit.org/show_bug.cgi?id=185984 Reviewed by Youenn Fablet. * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::getManifestURLs): (WebCore::ApplicationCacheStorage::deleteCacheGroup): (WebCore::ApplicationCacheStorage::originsWithCache): (WebCore::ApplicationCacheStorage::deleteAllCaches): (WebCore::ApplicationCacheStorage::deleteCacheForOrigin): (WebCore::ApplicationCacheStorage::ApplicationCacheStorage): (WebCore::ApplicationCacheStorage::cacheDirectory const): Deleted. (WebCore::ApplicationCacheStorage::cacheGroupSize): Deleted. (WebCore::ApplicationCacheStorage::getOriginsWithCache): Deleted. (WebCore::ApplicationCacheStorage::create): Deleted. * loader/appcache/ApplicationCacheStorage.h: (WebCore::ApplicationCacheStorage::create): 2018-05-25 Sihui Liu <sihui_liu@apple.com> [WKHTTPCookieStore getAllCookies] returns inconsistent creation time https://bugs.webkit.org/show_bug.cgi?id=185041 <rdar://problem/34684214> Reviewed by Geoffrey Garen. Set creationtime property when creating Cookie object to keep consistency after conversion. New API test: WebKit.WKHTTPCookieStoreCreationTime. * platform/network/cocoa/CookieCocoa.mm: (WebCore::Cookie::operator NSHTTPCookie * const): 2018-05-25 Zalan Bujtas <zalan@apple.com> [LFC] Implement border and padding computation https://bugs.webkit.org/show_bug.cgi?id=185972 Reviewed by Antti Koivisto. This patch also removes redundant Display::Box methods and adds a lightweight Edge struct. (Since padding is optional, if during layout we mistakenly try to access paddingTop/Left/Bottom/Right, Display::Box will assert!) * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeBorderAndPadding const): * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: (WebCore::Layout::FormattingContext::Geometry::computedBorder): (WebCore::Layout::FormattingContext::Geometry::computedPadding): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::marginBox const): (WebCore::Display::Box::paddingBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::Edges::Edges): (WebCore::Display::Box::setHasValidPosition): (WebCore::Display::Box::setWidth): (WebCore::Display::Box::setHeight): (WebCore::Display::Box::setMargin): (WebCore::Display::Box::setBorder): (WebCore::Display::Box::setPadding): (WebCore::Display::Box::marginTop const): (WebCore::Display::Box::marginLeft const): (WebCore::Display::Box::marginBottom const): (WebCore::Display::Box::marginRight const): (WebCore::Display::Box::paddingTop const): (WebCore::Display::Box::paddingLeft const): (WebCore::Display::Box::paddingBottom const): (WebCore::Display::Box::paddingRight const): (WebCore::Display::Box::borderTop const): (WebCore::Display::Box::borderLeft const): (WebCore::Display::Box::borderBottom const): (WebCore::Display::Box::borderRight const): (WebCore::Display::Box::invalidateSize): Deleted. (WebCore::Display::Box::setHasValidSize): Deleted. (WebCore::Display::Box::setHasValidGeometry): Deleted. (WebCore::Display::Box::setRect): Deleted. (WebCore::Display::Box::setSize): Deleted. * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isPaddingEnabled const): * layout/layouttree/LayoutBox.h: 2018-05-25 David Kilzer <ddkilzer@apple.com> Fix issues with -dealloc methods found by clang static analyzer <https://webkit.org/b/185887> Reviewed by Joseph Pecoraro. * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController dealloc]): Release `_minTiming` and `_maxTiming` to fix leaks. * platform/ios/WebBackgroundTaskController.mm: (-[WebBackgroundTaskController dealloc]): Release `_backgroundTaskStartBlock` and `_backgroundTaskEndBlock` to fix leaks. * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderRegistrationInfoList dealloc]): Release `_teamData` to fix leak. 2018-05-25 Antoine Quint <graouts@apple.com> [Web Animations] WebAnimation objects never get destroyed https://bugs.webkit.org/show_bug.cgi?id=185917 <rdar://problem/39539371> Reviewed by Dean Jackson and Antti Koivisto. The AnimationTimeline class keeps references to WebAnimation objects organized in various ways. First, there are three main maps across which all animations are stored, one for non-subclass WebAnimation objects (m_elementToAnimationsMap), one for CSSSAnimation objects (m_elementToCSSAnimationsMap) and one for CSSTranstion objects (m_elementToCSSTransitionsMap). On top of that, we also keep a map to access CSSAnimation objects for a given element by CSS animation name (m_elementToCSSAnimationByName) and another map to access CSSTransition objects for a given element by CSS property (m_elementToCSSTransitionByCSSPropertyID). None of the RefPtr<WebAnimation> stored in these maps would get cleared when the document would get torn down, which would also prevent the AnimationTimeline (and its DocumentTimeline subclass) from being destroyed. We now ensure that element and document tear-down correctly removes animations and clears those maps, which in turn allows the DocumentTimeline to be destroyed, fixing the significant memory leak introduced by Web Animations so far. Finally, we change the collection type for those maps to be ListHashRef instead of Vector to guarantee we only add an animation once per collection due to changes in how setEffect() and setTimeline() operate. Test: animations/leak-document-with-css-animation.html * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::~AnimationTimeline): There is no need to clear those tables as they'll need to be empty for the AnimationTimeline to even be destroyed. (WebCore::AnimationTimeline::relevantMapForAnimation): Change to use ListHashRef instead of Vector. (WebCore::AnimationTimeline::animationWasAddedToElement): Change to use ListHashRef instead of Vector. (WebCore::AnimationTimeline::animationWasRemovedFromElement): When an animation is removed from an element, ensure that references to this animation stored in the m_elementToCSSAnimationByName and m_elementToCSSTransitionByCSSPropertyID maps are cleared. (WebCore::AnimationTimeline::animationsForElement const): Change to use ListHashRef instead of Vector. (WebCore::AnimationTimeline::removeAnimationsForElement): Instead of just calling cancel() on all known declarative animations (this method used to be called cancelDeclarativeAnimationsForElement()), we now set the effect of known animations, declarative or not, for the provided element which will in turn call animationWasRemovedFromElement() and remove the animation from all maps that might keep a reference to it. (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Replace call to removeDeclarativeAnimation() with a simple call to removeAnimation() which will remove references for this animation from the relevant maps. (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Ditto. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimation): Deleted. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::elementToAnimationsMap): Change to use ListHashRef instead of Vector. (WebCore::AnimationTimeline::elementToCSSAnimationsMap): Change to use ListHashRef instead of Vector. (WebCore::AnimationTimeline::elementToCSSTransitionsMap): Change to use ListHashRef instead of Vector. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): In the case of a declarative animation, we don't want to remove the animation from the relevant maps because while the effect was set via the API, the element still has a transition or animation set up and we must not break the timeline-to-animation relationship. (WebCore::WebAnimation::setEffectInternal): Factor parts of setEffect() out into a new method that can be called from AnimationTimeline::removeAnimationsForElement() to reset the m_effect member and correctly call animationWasRemovedFromElement() without all the Web Animations machinery of setEffect(), which is a public API that has unwanted side effects (such as rejecting promises). (WebCore::WebAnimation::setTimeline): In the case of a declarative animation, we don't want to remove the animation from the relevant maps because, while the timeline was set via the API, the element still has a transition or animation set up and we must not break the relationship. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::~DocumentTimeline): (WebCore::DocumentTimeline::detachFromDocument): Close the GenericTaskQueues when detaching from the document as it's too late to perform this work in the destructor. We also cancel the schedule timer which we had forgotten to do before. * animation/WebAnimation.h: * dom/Document.cpp: (WebCore::Document::prepareForDestruction): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2018-05-24 Chris Dumez <cdumez@apple.com> Avoid doing unnecessary work in Document::shouldEnforceContentDispositionAttachmentSandbox() when setting is disabled https://bugs.webkit.org/show_bug.cgi?id=185964 Reviewed by Geoffrey Garen. * dom/Document.cpp: (WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox const): 2018-05-24 Chris Dumez <cdumez@apple.com> [iOS] Avoid dlopening QuickLooks in the common case where the main resource is HTML or plain text https://bugs.webkit.org/show_bug.cgi?id=185966 Reviewed by Geoffrey Garen. Avoid dlopening QuickLooks in the common case where the main resource is HTML or plain text for performance reasons. * loader/ios/PreviewLoader.mm: (WebCore::PreviewLoader::shouldCreateForMIMEType): 2018-05-24 Sam Weinig <sam@webkit.org> Modernize RenderStyleConstants.h - Part 2 https://bugs.webkit.org/show_bug.cgi?id=185901 Reviewed by Simon Fraser. Modernized the second set of enums in RenderStyleConstants.h by: - Converting them to enum classes - Renaming them to remove unnecessary prefix 'E's - Renaming values to take advantage of enum class scoping (e.g. StyleDifferenceEqual -> StyleDifference::Equal) - Renaming to match modern conventions (e.g BNONE -> None) - Reformatting them so that each value is on its own line. Modernizes the following enums: PseudoId ListStyleType (renamed from EListStyleType) BorderFit (renamed from EBorderFit) AnimationFillMode (renamed from EAnimationFillMode) AnimationPlayState (renamed from EAnimPlayState) WhiteSpace (renamed from EWhiteSpace) TextAlignMode (renamed from ETextAlign) TextTransform (renamed from ETextTransform) TextDecorationStyle TextAlignLast TextJustify TextZoom BreakBetween BreakInside EmptyCell (renamed from EEmptyCell) CaptionSide (renamed from ECaptionSide) ListStylePosition (renamed from EListStylePosition) Visibility (renamed from EVisibility) CursorType (renamed from ECursor) CursorVisibility DisplayType (renamed from EDisplay) InsideLink (renamed from EInsideLink) PointerEvents (renamed from EPointerEvents) Hyphens TextEmphasisFill TextEmphasisMark ImageResolutionSource ImageResolutionSnap Order ColumnAxis ColumnProgression LineSnap LineAlign RubyPosition AutoRepeatType CSSBoxType * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::isNodeVisible const): * accessibility/AccessibilityList.cpp: (WebCore::AccessibilityList::determineAccessibilityRole): * accessibility/AccessibilityMediaControls.cpp: (WebCore::AccessibilityMediaControl::computeAccessibilityIsIgnored const): (WebCore::AccessibilityMediaTimeDisplay::computeAccessibilityIsIgnored const): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isDOMHidden const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::defaultObjectInclusion const): (WebCore::AccessibilityRenderObject::isUnvisited const): (WebCore::AccessibilityRenderObject::isVisited const): (WebCore::AccessibilityRenderObject::setValue): * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::isDataTable const): * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (getAttributeSetForAccessibilityObject): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSAnimationsForElement): (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const): * css/CSSComputedStyleDeclaration.cpp: (WebCore::renderTextDecorationStyleFlagsToCSSValue): (WebCore::convertToPageBreak): (WebCore::convertToColumnBreak): (WebCore::ComputedStyleExtractor::styledElement const): (WebCore::ComputedStyleExtractor::styledRenderer const): (WebCore::computeRenderStyleForProperty): (WebCore::shapePropertyValue): (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSComputedStyleDeclaration.h: * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator CaptionSide const): (WebCore::CSSPrimitiveValue::operator CursorType const): (WebCore::CSSPrimitiveValue::operator CursorVisibility const): (WebCore::CSSPrimitiveValue::operator DisplayType const): (WebCore::CSSPrimitiveValue::operator EmptyCell const): (WebCore::CSSPrimitiveValue::operator ListStylePosition const): (WebCore::CSSPrimitiveValue::operator ListStyleType const): (WebCore::CSSPrimitiveValue::operator BreakBetween const): (WebCore::CSSPrimitiveValue::operator BreakInside const): (WebCore::CSSPrimitiveValue::operator TextAlignMode const): (WebCore::CSSPrimitiveValue::operator TextAlignLast const): (WebCore::CSSPrimitiveValue::operator TextJustify const): (WebCore::CSSPrimitiveValue::operator TextDecorationStyle const): (WebCore::CSSPrimitiveValue::operator TextTransform const): (WebCore::CSSPrimitiveValue::operator Visibility const): (WebCore::CSSPrimitiveValue::operator WhiteSpace const): (WebCore::CSSPrimitiveValue::operator RubyPosition const): (WebCore::CSSPrimitiveValue::operator TextEmphasisFill const): (WebCore::CSSPrimitiveValue::operator TextEmphasisMark const): (WebCore::CSSPrimitiveValue::operator PointerEvents const): (WebCore::CSSPrimitiveValue::operator Hyphens const): (WebCore::CSSPrimitiveValue::operator LineSnap const): (WebCore::CSSPrimitiveValue::operator LineAlign const): (WebCore::CSSPrimitiveValue::operator Order const): (WebCore::CSSPrimitiveValue::operator BorderFit const): (WebCore::CSSPrimitiveValue::operator ColumnAxis const): (WebCore::CSSPrimitiveValue::operator ColumnProgression const): (WebCore::CSSPrimitiveValue::operator CSSBoxType const): (WebCore::CSSPrimitiveValue::operator TextZoom const): (WebCore::CSSPrimitiveValue::operator ECaptionSide const): Deleted. (WebCore::CSSPrimitiveValue::operator ECursor const): Deleted. (WebCore::CSSPrimitiveValue::operator EDisplay const): Deleted. (WebCore::CSSPrimitiveValue::operator EEmptyCell const): Deleted. (WebCore::CSSPrimitiveValue::operator EListStylePosition const): Deleted. (WebCore::CSSPrimitiveValue::operator EListStyleType const): Deleted. (WebCore::CSSPrimitiveValue::operator ETextAlign const): Deleted. (WebCore::CSSPrimitiveValue::operator ETextTransform const): Deleted. (WebCore::CSSPrimitiveValue::operator EVisibility const): Deleted. (WebCore::CSSPrimitiveValue::operator EWhiteSpace const): Deleted. (WebCore::CSSPrimitiveValue::operator EPointerEvents const): Deleted. (WebCore::CSSPrimitiveValue::operator EBorderFit const): Deleted. * css/CSSSelector.cpp: (WebCore::CSSSelector::pseudoId): * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationFillMode): (WebCore::CSSToStyleMap::mapAnimationPlayState): * css/CSSValueKeywords.in: * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::collectMatchingRules): (WebCore::ElementRuleCollector::ruleMatches): (WebCore::ElementRuleCollector::collectMatchingRulesForList): * css/ElementRuleCollector.h: * css/SelectorChecker.cpp: (WebCore::SelectorChecker::match const): (WebCore::SelectorChecker::matchHostPseudoClass const): (WebCore::hasScrollbarPseudoElement): (WebCore::SelectorChecker::matchRecursively const): * css/SelectorChecker.h: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertTextAlign): (WebCore::StyleBuilderConverter::convertClipPath): (WebCore::StyleBuilderConverter::convertShapeValue): (WebCore::StyleBuilderConverter::createGridTrackList): (WebCore::StyleBuilderConverter::csstoLengthConversionDataWithTextZoomFactor): (WebCore::StyleBuilderConverter::convertPageBreakBetween): (WebCore::StyleBuilderConverter::convertPageBreakInside): (WebCore::StyleBuilderConverter::convertColumnBreakBetween): (WebCore::StyleBuilderConverter::convertColumnBreakInside): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueImageResolution): (WebCore::computeBaseSpecifiedFontSize): (WebCore::StyleBuilderCustom::applyValueWebkitTextZoom): (WebCore::StyleBuilderCustom::isValidDisplayValue): (WebCore::StyleBuilderCustom::applyInheritDisplay): (WebCore::StyleBuilderCustom::applyValueDisplay): (WebCore::StyleBuilderCustom::applyValueWebkitTextEmphasisStyle): (WebCore::StyleBuilderCustom::applyValueCursor): (WebCore::StyleBuilderCustom::applyValueContent): (WebCore::StyleBuilderCustom::determineRubyTextSizeMultiplier): (WebCore::StyleBuilderCustom::applyValueAlt): * css/StyleResolver.cpp: (WebCore::StyleResolver::styleForElement): (WebCore::equivalentBlockDisplay): (WebCore::doesNotInheritTextDecoration): (WebCore::StyleResolver::adjustStyleForInterCharacterRuby): (WebCore::adjustDisplayContentsStyle): (WebCore::StyleResolver::adjustSVGElementStyle): (WebCore::StyleResolver::adjustRenderStyle): (WebCore::StyleResolver::styleRulesForElement): (WebCore::isCacheableInMatchedPropertiesCache): (WebCore::StyleResolver::applyMatchedProperties): (WebCore::StyleResolver::CascadedProperties::Property::apply): * css/StyleResolver.h: (WebCore::StyleResolver::State::elementLinkState const): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::constructFragmentsInternal): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateRequestedPseudoElementEqualsToSelectorPseudoElement): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateMarkPseudoStyleForPseudoElement): * dom/Document.cpp: (WebCore::Document::styleForElementIgnoringPendingStylesheets): (WebCore::Document::isPageBoxVisible): (WebCore::Document::setVisuallyOrdered): * dom/Document.h: * dom/Element.cpp: (WebCore::Element::isFocusable const): (WebCore::Element::hasDisplayContents const): (WebCore::Element::storeDisplayContentsStyle): (WebCore::Element::rendererIsNeeded): (WebCore::beforeOrAfterPseudoElement): (WebCore::Element::computedStyle): * dom/Element.h: * dom/Node.cpp: (WebCore::computeEditabilityFromComputedStyle): * dom/Node.h: (WebCore::Node::isPseudoElement const): (WebCore::Node::isBeforePseudoElement const): (WebCore::Node::isAfterPseudoElement const): (WebCore::Node::pseudoId const): (WebCore::Node::customPseudoId const): * dom/Position.cpp: (WebCore::Position::upstream const): (WebCore::Position::downstream const): (WebCore::Position::isCandidate const): (WebCore::Position::rendersInDifferentPosition const): * dom/PositionIterator.cpp: (WebCore::PositionIterator::isCandidate const): * dom/PseudoElement.cpp: (WebCore::PseudoElement::pseudoElementNameForEvents): (WebCore::PseudoElement::PseudoElement): * dom/VisitedLinkState.cpp: (WebCore::VisitedLinkState::determineLinkStateSlowCase): * dom/VisitedLinkState.h: (WebCore::VisitedLinkState::determineLinkState): * editing/Editing.cpp: (WebCore::isSpecialHTMLElement): (WebCore::isNodeRendered): * editing/TextIterator.cpp: (WebCore::hasVisibleTextNode): (WebCore::TextIterator::handleTextNode): (WebCore::TextIterator::handleTextBox): (WebCore::TextIterator::handleTextNodeFirstLetter): (WebCore::TextIterator::handleReplacedElement): (WebCore::TextIterator::shouldRepresentNodeOffsetZero): (WebCore::SimplifiedBackwardsTextIterator::advance): * editing/VisibleUnits.cpp: (WebCore::findStartOfParagraph): (WebCore::findEndOfParagraph): * editing/ios/EditorIOS.mm: (WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection): * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::isFocusable const): * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::rendererIsNeeded): * html/HTMLIFrameElement.cpp: (WebCore::HTMLIFrameElement::rendererIsNeeded): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::createInnerTextStyle): * html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::isFocusable const): * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::isFocusable const): * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::createInnerTextStyle): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setSelectionRange): (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::autoplayPermitted const): (WebCore::isMainContentForPurposesOfAutoplay): * html/RubyElement.cpp: (WebCore::RubyElement::createElementRenderer): * html/RubyTextElement.cpp: (WebCore::RubyTextElement::createElementRenderer): * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlInnerElement::resolveCustomStyle): (WebCore::TextControlPlaceholderElement::resolveCustomStyle): * inspector/InspectorOverlay.cpp: (WebCore::buildObjectForElementData): * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getMatchedStylesForNode): (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::pseudoElementType): (WebCore::InspectorDOMAgent::buildObjectForNode): * inspector/agents/InspectorLayerTreeAgent.cpp: (WebCore::InspectorLayerTreeAgent::buildObjectForLayer): * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isInlineBlockBox const): (WebCore::Layout::Box::isBlockLevelBox const): (WebCore::Layout::Box::isInlineLevelBox const): (WebCore::Layout::Box::isBlockContainerBox const): * page/EventHandler.cpp: (WebCore::EventHandler::selectCursor): * page/Frame.cpp: (WebCore::Frame::searchForLabelsAboveCell): (WebCore::Frame::searchForLabelsBeforeElement): * page/FrameView.cpp: (WebCore::FrameView::createScrollbar): (WebCore::FrameView::adjustScrollStepForFixedContent): (WebCore::FrameView::updateScrollCorner): * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::playStatePlaying const): (WebCore::AnimationBase::updatePlayState): * page/animation/AnimationBase.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * page/animation/CompositeAnimation.cpp: (WebCore::CompositeAnimation::updateTransitions): (WebCore::CompositeAnimation::updateKeyframeAnimations): (WebCore::CompositeAnimation::suspendAnimations): (WebCore::CompositeAnimation::resumeAnimations): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate): * page/ios/FrameIOS.mm: (WebCore::Frame::nodeRespondingToClickEvents): * platform/animation/Animation.cpp: (WebCore::Animation::Animation): * platform/animation/Animation.h: (WebCore::Animation::clearPlayState): (WebCore::Animation::fillMode const): (WebCore::Animation::playState const): (WebCore::Animation::setFillMode): (WebCore::Animation::setPlayState): (WebCore::Animation::fillsBackwards const): (WebCore::Animation::fillsForwards const): (WebCore::Animation::initialFillMode): (WebCore::Animation::initialPlayState): * platform/graphics/GraphicsTypes.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/ios/wak/WAKWindow.mm: (-[WAKWindow dumpTiles]): * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isLookalikeCharacter): * rendering/ClipPathOperation.h: * rendering/InlineBox.h: (WebCore::InlineBox::visibleToHitTesting const): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::addToLine): (WebCore::InlineFlowBox::placeBoxesInBlockDirection): (WebCore::InlineFlowBox::addTextBoxVisualOverflow): (WebCore::InlineFlowBox::paint): (WebCore::InlineFlowBox::paintBoxDecorations): (WebCore::InlineFlowBox::paintMask): (WebCore::InlineFlowBox::computeOverAnnotationAdjustment const): (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const): (WebCore::InlineFlowBox::collectLeafBoxesInLogicalOrder const): * rendering/InlineFlowBox.h: (WebCore::InlineFlowBox::InlineFlowBox): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const): (WebCore::InlineTextBox::paint): (WebCore::InlineTextBox::createTextRun const): * rendering/PointerEventsHitRules.cpp: (WebCore::PointerEventsHitRules::PointerEventsHitRules): * rendering/PointerEventsHitRules.h: * rendering/RenderBlock.cpp: (WebCore::RenderBlock::computeStartPositionDeltaForChildAvoidingFloats): (WebCore::RenderBlock::paint): (WebCore::RenderBlock::paintObject): (WebCore::RenderBlock::shouldPaintSelectionGaps const): (WebCore::RenderBlock::adjustLogicalLeftOffsetForLine const): (WebCore::RenderBlock::adjustLogicalRightOffsetForLine const): (WebCore::isChildHitTestCandidate): (WebCore::RenderBlock::computeBlockPreferredLogicalWidths const): (WebCore::RenderBlock::firstLineBlock const): (WebCore::findFirstLetterBlock): (WebCore::RenderBlock::getFirstLetter): (WebCore::RenderBlock::createAnonymousBlockWithStyleAndDisplay): (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation const): (WebCore::RenderBlock::constructTextRun): (WebCore::RenderBlock::layoutExcludedChildren): * rendering/RenderBlock.h: (WebCore::RenderBlock::createAnonymousWithParentRendererAndDisplay): (WebCore::RenderBlock::createAnonymousBlock const): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willCreateColumns const): (WebCore::RenderBlockFlow::layoutBlock): (WebCore::RenderBlockFlow::applyBeforeBreak): (WebCore::RenderBlockFlow::applyAfterBreak): (WebCore::RenderBlockFlow::adjustForUnsplittableChild): (WebCore::RenderBlockFlow::updateStylesForColumnChildren): (WebCore::RenderBlockFlow::computeLogicalLocationForFloat): (WebCore::RenderBlockFlow::lowestInitialLetterLogicalBottom const): (WebCore::RenderBlockFlow::adjustForBorderFit const): (WebCore::RenderBlockFlow::fitBorderToLinesIfNeeded): (WebCore::RenderBlockFlow::lineAtIndex const): (WebCore::RenderBlockFlow::lineCount const): (WebCore::getHeightForLineCount): (WebCore::RenderBlockFlow::clearTruncation): (WebCore::RenderBlockFlow::findClosestTextAtAbsolutePoint): (WebCore::RenderBlockFlow::lineCountForTextAutosizing): (WebCore::RenderBlockFlow::setComputedColumnCountAndWidth): (WebCore::RenderBlockFlow::updateColumnProgressionFromStyle): (WebCore::RenderBlockFlow::isTopLayoutOverflowAllowed const): (WebCore::RenderBlockFlow::isLeftLayoutOverflowAllowed const): * rendering/RenderBlockFlow.h: * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::constructLine): (WebCore::RenderBlockFlow::textAlignmentForLine const): (WebCore::RenderBlockFlow::updateLogicalWidthForAlignment): (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForLine): (WebCore::expansionBehaviorForInlineTextBox): (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): (WebCore::RenderBlockFlow::checkFloatInCleanLine): (WebCore::RenderBlockFlow::deleteEllipsisLineBoxes): (WebCore::RenderBlockFlow::checkLinesForTextOverflow): (WebCore::RenderBlockFlow::startAlignedOffsetForLine): * rendering/RenderBox.cpp: (WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const): (WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const): (WebCore::isCandidateForOpaquenessTest): (WebCore::RenderBox::paintMask): (WebCore::RenderBox::paintClippingMask): (WebCore::RenderBox::positionLineBox): (WebCore::RenderBox::clippedOverflowRectForRepaint const): (WebCore::RenderBox::computeLogicalWidthInFragment const): (WebCore::RenderBox::computeInlineDirectionMargins const): (WebCore::RenderBox::skipContainingBlockForPercentHeightCalculation const): (WebCore::RenderBox::positionForPoint): (WebCore::RenderBox::isUnsplittableForPagination const): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::localCaretRectForEmptyElement): * rendering/RenderBoxModelObject.h: * rendering/RenderCounter.cpp: (WebCore::planCounter): (WebCore::RenderCounter::originalText const): * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::childDoesNotAffectWidthOrFlexing): (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): * rendering/RenderDetailsMarker.cpp: (WebCore::RenderDetailsMarker::paint): * rendering/RenderElement.cpp: (WebCore::RenderElement::createFor): (WebCore::RenderElement::computeFirstLineStyle const): (WebCore::RenderElement::propagateStyleToAnonymousChildren): (WebCore::RenderElement::styleWillChange): (WebCore::RenderElement::insertedIntoTree): (WebCore::RenderElement::willBeRemovedFromTree): (WebCore::RenderElement::repaintAfterLayoutIfNeeded): (WebCore::RenderElement::isVisibleInDocumentRect const): (WebCore::RenderElement::getCachedPseudoStyle const): (WebCore::RenderElement::getUncachedPseudoStyle const): (WebCore::RenderElement::selectionPseudoStyle const): * rendering/RenderElement.h: (WebCore::RenderElement::visibleToHitTesting const): * rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::paintObject): * rendering/RenderFullScreen.cpp: (WebCore::createFullScreenStyle): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat const): * rendering/RenderImage.cpp: (WebCore::RenderImage::repaintOrMarkForLayout): * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): (WebCore::updateStyleOfAnonymousBlockContinuations): (WebCore::RenderInline::updateAlwaysCreateLineBoxes): (WebCore::RenderInline::clippedOverflowRectForRepaint const): (WebCore::RenderInline::addAnnotatedRegions): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::updateDescendantDependentFlags): (WebCore::RenderLayer::createScrollbar): (WebCore::styleRequiresScrollbar): (WebCore::styleDefinesAutomaticScrollbar): (WebCore::computeReferenceBox): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateAfterDescendants): * rendering/RenderLayerCompositor.cpp: (WebCore::scrollbarHasDisplayNone): (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const): (WebCore::RenderLayerCompositor::requiresCompositingForFrame const): * rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintObject): (WebCore::itemOffsetForAlignment): (WebCore::RenderListBox::paintItemForeground): (WebCore::RenderListBox::paintItemBackground): (WebCore::RenderListBox::createScrollbar): * rendering/RenderListItem.cpp: (WebCore::RenderListItem::computeMarkerStyle const): * rendering/RenderListMarker.cpp: (WebCore::effectiveListMarkerType): (WebCore::listMarkerSuffix): (WebCore::listMarkerText): (WebCore::RenderListMarker::paint): (WebCore::RenderListMarker::updateContent): (WebCore::RenderListMarker::computePreferredLogicalWidths): (WebCore::RenderListMarker::updateMargins): (WebCore::RenderListMarker::suffix const): (WebCore::RenderListMarker::isInside const): (WebCore::RenderListMarker::getRelativeMarkerRect): * rendering/RenderListMarker.h: * rendering/RenderMediaControlElements.cpp: (WebCore::RenderMediaVolumeSliderContainer::layout): (WebCore::RenderTextTrackContainerElement::layout): * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::adjustInnerStyle): (WebCore::if): (RenderMenuList::itemStyle const): (RenderMenuList::menuStyle const): (RenderMenuList::createScrollbar): * rendering/RenderMultiColumnSpannerPlaceholder.cpp: (WebCore::RenderMultiColumnSpannerPlaceholder::createAnonymous): * rendering/RenderObject.cpp: (WebCore::RenderObject::addAnnotatedRegions): * rendering/RenderObject.h: (WebCore::RenderObject::isAnonymousBlock const): (WebCore::RenderObject::isBeforeContent const): (WebCore::RenderObject::isAfterContent const): * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::shouldPaint): (WebCore::RenderReplaced::clippedOverflowRectForRepaint const): * rendering/RenderRubyBase.cpp: (WebCore::RenderRubyBase::textAlignmentForLine const): * rendering/RenderRubyBase.h: * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::createRubyBase const): (WebCore::RenderRubyRun::staticCreateRubyRun): (WebCore::RenderRubyRun::layoutBlock): * rendering/RenderRubyText.cpp: (WebCore::RenderRubyText::textAlignmentForLine const): (WebCore::RenderRubyText::adjustInlineDirectionLineBounds const): * rendering/RenderRubyText.h: * rendering/RenderScrollbar.cpp: (WebCore::pseudoForScrollbarPart): (WebCore::RenderScrollbar::updateScrollbarPart): * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::updateCancelButtonVisibility const): (WebCore::RenderSearchField::visibilityForCancelButton const): (WebCore::RenderSearchField::menuStyle const): (WebCore::RenderSearchField::createScrollbar): * rendering/RenderSearchField.h: * rendering/RenderTable.cpp: (WebCore::RenderTable::willInsertTableSection): (WebCore::RenderTable::layoutCaptions): (WebCore::RenderTable::layout): (WebCore::RenderTable::paintObject): (WebCore::RenderTable::adjustBorderBoxRectForPainting): (WebCore::RenderTable::paintMask): (WebCore::RenderTable::recalcSections const): (WebCore::RenderTable::createTableWithStyle): * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::styleDidChange): (WebCore::RenderTableCell::paintCollapsedBorders): (WebCore::RenderTableCell::paintBackgroundsBehindCell): (WebCore::RenderTableCell::paintBoxDecorations): (WebCore::RenderTableCell::paintMask): (WebCore::RenderTableCell::createTableCellWithStyle): * rendering/RenderTableCol.cpp: (WebCore::RenderTableCol::updateFromElement): (WebCore::RenderTableCol::isChildAllowed const): * rendering/RenderTableCol.h: * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::styleDidChange): (WebCore::RenderTableRow::paintOutlineForRowIfNeeded): (WebCore::RenderTableRow::createTableRowWithStyle): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addCell): (WebCore::RenderTableSection::paint): (WebCore::RenderTableSection::createTableSectionWithStyle): * rendering/RenderText.cpp: (WebCore::RenderText::styleDidChange): (WebCore::RenderText::computePreferredLogicalWidths): (WebCore::applyTextTransform): * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::styleDidChange): (WebCore::RenderTextFragment::blockForAccompanyingFirstLetter): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::adjustMenuListStyle const): * rendering/RenderThemeWin.cpp: (WebCore::RenderThemeWin::adjustMenuListButtonStyle const): * rendering/RenderView.cpp: (WebCore::rendererObscuresBackground): * rendering/RenderWidget.cpp: (WebCore::RenderWidget::setWidget): (WebCore::RenderWidget::styleDidChange): * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::paintEllipsisBox const): (WebCore::RootInlineBox::lineSnapAdjustment const): (WebCore::RootInlineBox::lineSelectionGap): (WebCore::RootInlineBox::computeCaretRect const): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForFontAndText): (WebCore::SimpleLineLayout::canUseForStyle): (WebCore::SimpleLineLayout::computeLineLeft): (WebCore::SimpleLineLayout::updateLineConstrains): (WebCore::SimpleLineLayout::createLineRuns): (WebCore::SimpleLineLayout::textAlignForLine): (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): (WebCore::SimpleLineLayout::hitTestFlow): * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): * rendering/SimpleLineLayoutTextFragmentIterator.h: * rendering/TextDecorationPainter.cpp: (WebCore::textDecorationStyleToStrokeStyle): (WebCore::TextDecorationPainter::paintTextDecoration): (WebCore::collectStylesForRenderer): * rendering/TextDecorationPainter.h: * rendering/line/BreakingContext.h: (WebCore::BreakingContext::BreakingContext): (WebCore::BreakingContext::clearLineBreakIfFitsOnLine): (WebCore::BreakingContext::handleBR): (WebCore::BreakingContext::handleOutOfFlowPositioned): (WebCore::BreakingContext::handleText): (WebCore::BreakingContext::canBreakAtThisPosition): (WebCore::BreakingContext::handleEndOfLine): * rendering/line/LineInlineHeaders.h: (WebCore::shouldCollapseWhiteSpace): * rendering/line/LineWidth.cpp: (WebCore::newFloatShrinksLine): * rendering/mathml/MathOperator.cpp: (WebCore::MathOperator::paint): * rendering/mathml/RenderMathMLFraction.cpp: (WebCore::RenderMathMLFraction::paint): * rendering/mathml/RenderMathMLMath.cpp: (WebCore::RenderMathMLMath::layoutBlock): * rendering/mathml/RenderMathMLMenclose.cpp: (WebCore::RenderMathMLMenclose::paint): * rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::paint): * rendering/mathml/RenderMathMLToken.cpp: (WebCore::RenderMathMLToken::paint): * rendering/shapes/BoxShape.cpp: (WebCore::computeRoundedRectForBoxShape): * rendering/shapes/ShapeOutsideInfo.cpp: (WebCore::referenceBox): (WebCore::ShapeOutsideInfo::setReferenceBoxLogicalSize): (WebCore::ShapeOutsideInfo::logicalTopOffset const): (WebCore::ShapeOutsideInfo::logicalLeftOffset const): * rendering/style/CounterContent.h: (WebCore::CounterContent::CounterContent): (WebCore::CounterContent::listStyle const): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::createAnonymousStyleWithDisplay): (WebCore::RenderStyle::createStyleInheritingFromPseudoStyle): (WebCore::RenderStyle::RenderStyle): (WebCore::RenderStyle::hasUniquePseudoStyle const): (WebCore::RenderStyle::getCachedPseudoStyle const): (WebCore::RenderStyle::addCachedPseudoStyle): (WebCore::RenderStyle::changeRequiresLayout const): (WebCore::requiresPainting): (WebCore::RenderStyle::hyphenString const): (WebCore::RenderStyle::textEmphasisMarkString const): (WebCore::RenderStyle::visitedDependentColor const): (WebCore::RenderStyle::textEmphasisMark const): (WebCore::RenderStyle::setColumnStylesFromPaginationMode): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setStyleType): (WebCore::RenderStyle::setRTLOrdering): (WebCore::RenderStyle::display const): (WebCore::RenderStyle::visibility const): (WebCore::RenderStyle::textAlign const): (WebCore::RenderStyle::textTransform const): (WebCore::RenderStyle::whiteSpace const): (WebCore::RenderStyle::emptyCells const): (WebCore::RenderStyle::captionSide const): (WebCore::RenderStyle::listStyleType const): (WebCore::RenderStyle::listStylePosition const): (WebCore::RenderStyle::cursor const): (WebCore::RenderStyle::insideLink const): (WebCore::RenderStyle::borderFit const): (WebCore::RenderStyle::pointerEvents const): (WebCore::RenderStyle::setDisplay): (WebCore::RenderStyle::setOriginalDisplay): (WebCore::RenderStyle::setVisibility): (WebCore::RenderStyle::setTextAlign): (WebCore::RenderStyle::setTextTransform): (WebCore::RenderStyle::setTextDecorationStyle): (WebCore::RenderStyle::setTextDecorationSkip): (WebCore::RenderStyle::setTextUnderlinePosition): (WebCore::RenderStyle::setDirection): (WebCore::RenderStyle::setTextZoom): (WebCore::RenderStyle::setWhiteSpace): (WebCore::RenderStyle::setEmptyCells): (WebCore::RenderStyle::setCaptionSide): (WebCore::RenderStyle::setListStyleType): (WebCore::RenderStyle::setListStylePosition): (WebCore::RenderStyle::setCursor): (WebCore::RenderStyle::setCursorVisibility): (WebCore::RenderStyle::setInsideLink): (WebCore::RenderStyle::setHyphens): (WebCore::RenderStyle::setBorderFit): (WebCore::RenderStyle::setColumnAxis): (WebCore::RenderStyle::setColumnProgression): (WebCore::RenderStyle::setTextEmphasisFill): (WebCore::RenderStyle::setTextEmphasisMark): (WebCore::RenderStyle::setRubyPosition): (WebCore::RenderStyle::setBreakBefore): (WebCore::RenderStyle::setBreakAfter): (WebCore::RenderStyle::setBreakInside): (WebCore::RenderStyle::setHangingPunctuation): (WebCore::RenderStyle::setLineSnap): (WebCore::RenderStyle::setLineAlign): (WebCore::RenderStyle::setPointerEvents): (WebCore::RenderStyle::initialDisplay): (WebCore::RenderStyle::initialBreakBetween): (WebCore::RenderStyle::initialBreakInside): (WebCore::RenderStyle::initialCaptionSide): (WebCore::RenderStyle::initialColumnAxis): (WebCore::RenderStyle::initialColumnProgression): (WebCore::RenderStyle::initialEmptyCells): (WebCore::RenderStyle::initialListStylePosition): (WebCore::RenderStyle::initialListStyleType): (WebCore::RenderStyle::initialTextTransform): (WebCore::RenderStyle::initialVisibility): (WebCore::RenderStyle::initialWhiteSpace): (WebCore::RenderStyle::initialCursor): (WebCore::RenderStyle::initialTextAlign): (WebCore::RenderStyle::initialTextDecorationStyle): (WebCore::RenderStyle::initialTextZoom): (WebCore::RenderStyle::initialHyphens): (WebCore::RenderStyle::initialBorderFit): (WebCore::RenderStyle::initialRTLOrdering): (WebCore::RenderStyle::initialPointerEvents): (WebCore::RenderStyle::initialTextEmphasisColor): (WebCore::RenderStyle::initialTextEmphasisFill): (WebCore::RenderStyle::initialTextEmphasisMark): (WebCore::RenderStyle::initialRubyPosition): (WebCore::RenderStyle::initialImageResolutionSource): (WebCore::RenderStyle::initialImageResolutionSnap): (WebCore::RenderStyle::initialTextAlignLast): (WebCore::RenderStyle::initialTextJustify): (WebCore::RenderStyle::initialCursorVisibility): (WebCore::RenderStyle::initialGridAutoRepeatType): (WebCore::RenderStyle::initialLineSnap): (WebCore::RenderStyle::initialLineAlign): (WebCore::RenderStyle::NonInheritedFlags::hasAnyPublicPseudoStyles const): (WebCore::RenderStyle::originalDisplay const): (WebCore::RenderStyle::NonInheritedFlags::hasPseudoStyle const): (WebCore::RenderStyle::NonInheritedFlags::setHasPseudoStyle): (WebCore::RenderStyle::NonInheritedFlags::setHasPseudoStyles): (WebCore::RenderStyle::autoWrap): (WebCore::RenderStyle::preserveNewline): (WebCore::RenderStyle::collapseWhiteSpace): (WebCore::RenderStyle::breakOnlyAfterWhiteSpace const): (WebCore::RenderStyle::hasInlineColumnAxis const): (WebCore::RenderStyle::isDisplayRegionType const): (WebCore::RenderStyle::isDisplayReplacedType): (WebCore::RenderStyle::isDisplayInlineType): (WebCore::RenderStyle::isDisplayFlexibleBox): (WebCore::RenderStyle::isDisplayGridBox): (WebCore::RenderStyle::isDisplayFlexibleOrGridBox): (WebCore::pseudoElementRendererIsNeeded): * rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): (WebCore::alwaysPageBreak): * rendering/style/RenderStyleConstants.h: (WebCore::PseudoIdSet::has const): (WebCore::PseudoIdSet::add): * rendering/style/ShapeValue.h: * rendering/style/StyleMultiColData.cpp: (WebCore::StyleMultiColData::StyleMultiColData): * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): * rendering/style/StyleRareNonInheritedData.h: * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::paint): * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::paint): (WebCore::RenderSVGImage::nodeAtFloatPoint): * rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::styleDidChange): * rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::checkIntersection): (WebCore::RenderSVGModelObject::checkEnclosure): * rendering/svg/RenderSVGResource.cpp: (WebCore::requestPaintingResource): * rendering/svg/RenderSVGResourceClipper.cpp: (WebCore::RenderSVGResourceClipper::pathOnlyClipping): (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage): (WebCore::RenderSVGResourceClipper::calculateClipContentRepaintRect): * rendering/svg/RenderSVGResourceMasker.cpp: (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage): (WebCore::RenderSVGResourceMasker::calculateMaskContentRepaintRect): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::clippedOverflowRectForRepaint const): * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::paint): (WebCore::RenderSVGShape::nodeAtFloatPoint): * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::nodeAtFloatPoint): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paintSelectionBackground): (WebCore::SVGInlineTextBox::paint): (WebCore::SVGInlineTextBox::constructTextRun const): (WebCore::SVGInlineTextBox::paintDecoration): (WebCore::SVGInlineTextBox::nodeAtPoint): * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::clippedOverflowRectForRepaint): * rendering/svg/SVGRenderingContext.cpp: (WebCore::SVGRenderingContext::prepareToRenderSVGContent): * rendering/svg/SVGTextLayoutAttributesBuilder.cpp: (WebCore::processRenderSVGInlineText): * rendering/svg/SVGTextMetricsBuilder.cpp: (WebCore::SVGTextMetricsBuilder::measureTextRenderer): * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::detach): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::styleForFirstLetter): (WebCore::RenderTreeBuilder::FirstLetter::updateAfterDescendants): (WebCore::RenderTreeBuilder::FirstLetter::updateStyle): (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::attachIgnoringContinuation): (WebCore::RenderTreeBuilder::Inline::newChildIsInline): * rendering/updating/RenderTreeBuilderList.cpp: (WebCore::RenderTreeBuilder::List::updateItemMarker): * rendering/updating/RenderTreeBuilderMathML.cpp: (WebCore::RenderTreeBuilder::MathML::createMathMLOperator): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::isAnonymousRubyInlineBlock): (WebCore::isRubyBeforeBlock): (WebCore::isRubyAfterBlock): (WebCore::createAnonymousRubyInlineBlock): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateBeforeDescendants): (WebCore::RenderTreeUpdater::updateAfterDescendants): (WebCore::RenderTreeUpdater::updateElementRenderer): (WebCore::elementImplicitVisibility): (WebCore::CheckForVisibilityChange::CheckForVisibilityChange): (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange): * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): * style/InlineTextBoxStyle.cpp: (WebCore::visualOverflowForDecorations): * style/StyleChange.cpp: (WebCore::Style::determineChange): * style/StyleFontSizeFunctions.cpp: (WebCore::Style::computedFontSizeFromSpecifiedSize): * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): * style/StyleSharingResolver.cpp: * style/StyleTreeResolver.cpp: (WebCore::Style::affectsRenderedSubtree): (WebCore::Style::TreeResolver::resolveElement): (WebCore::Style::TreeResolver::resolvePseudoStyle): (WebCore::Style::TreeResolver::parentBoxStyle const): (WebCore::Style::createInheritedDisplayContentsStyleIfNeeded): (WebCore::Style::TreeResolver::resolveComposedTree): * svg/SVGElement.h: * svg/SVGGElement.cpp: (WebCore::SVGGElement::createElementRenderer): 2018-05-24 Chris Dumez <cdumez@apple.com> Enable subsampling for progressive JPEG images https://bugs.webkit.org/show_bug.cgi?id=185956 Reviewed by Said Abou-Hallawa. Enable subsampling for progressive JPEG images now that it is supposed (rdar://problem/5191418). I verified locally that such images are still loading and do not cause any hang on iOS. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::frameAllowSubsamplingAtIndex const): 2018-05-24 Chris Dumez <cdumez@apple.com> Reduce copying of FontCascadeDescription objects by moving them around https://bugs.webkit.org/show_bug.cgi?id=185963 Reviewed by Simon Fraser. Reduce copying of FontCascadeDescription objects by moving them around when possible. * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueWebkitLocale): (WebCore::StyleBuilderCustom::applyInitialFontFamily): (WebCore::StyleBuilderCustom::applyInheritFontFamily): (WebCore::StyleBuilderCustom::applyValueFontFamily): (WebCore::StyleBuilderCustom::applyInheritFontVariantLigatures): (WebCore::StyleBuilderCustom::applyInitialFontVariantLigatures): (WebCore::StyleBuilderCustom::applyValueFontVariantLigatures): (WebCore::StyleBuilderCustom::applyInheritFontVariantNumeric): (WebCore::StyleBuilderCustom::applyInitialFontVariantNumeric): (WebCore::StyleBuilderCustom::applyValueFontVariantNumeric): (WebCore::StyleBuilderCustom::applyInheritFontVariantEastAsian): (WebCore::StyleBuilderCustom::applyInitialFontVariantEastAsian): (WebCore::StyleBuilderCustom::applyValueFontVariantEastAsian): (WebCore::StyleBuilderCustom::applyInitialFontSize): (WebCore::StyleBuilderCustom::applyInheritFontSize): (WebCore::StyleBuilderCustom::applyInitialFontStyle): (WebCore::StyleBuilderCustom::applyInheritFontStyle): (WebCore::StyleBuilderCustom::applyValueFontStyle): (WebCore::StyleBuilderCustom::applyValueFontSize): * css/StyleResolver.cpp: (WebCore::checkForOrientationChange): (WebCore::StyleResolver::checkForTextSizeAdjust): (WebCore::StyleResolver::checkForZoomChange): (WebCore::StyleResolver::checkForGenericFamilyChange): (WebCore::StyleResolver::initializeFontStyle): * css/StyleResolver.h: (WebCore::StyleResolver::State::setFontDescription): (WebCore::StyleResolver::setFontDescription): * css/makeprop.pl: (generateInitialValueSetter): (generateInheritValueSetter): (generateValueSetter): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::setFont): * page/DebugPageOverlays.cpp: (WebCore::NonFastScrollableRegionOverlay::drawRect): * page/linux/ResourceUsageOverlayLinux.cpp: * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::FontCascade): * platform/graphics/FontCascade.h: * platform/graphics/ca/win/PlatformCALayerWin.cpp: (PlatformCALayerWin::drawTextAtPoint const): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): * platform/win/DragImageWin.cpp: (WebCore::dragLabelFont): * platform/win/PopupMenuWin.cpp: (WebCore::PopupMenuWin::calculatePositionAndSize): (WebCore::PopupMenuWin::paint): * rendering/RenderBox.cpp: (WebCore::RenderBox::styleDidChange): * rendering/RenderCombineText.cpp: (WebCore::RenderCombineText::combineTextIfNeeded): * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::getReplacementTextGeometry const): * rendering/RenderListBox.cpp: (WebCore::bolder): (WebCore::RenderListBox::paintItemForeground): * rendering/RenderListItem.cpp: (WebCore::RenderListItem::computeMarkerStyle const): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::setFontFromControlSize const): * rendering/TextAutoSizing.cpp: (WebCore::TextAutoSizingValue::adjustTextNodeSizes): (WebCore::TextAutoSizingValue::reset): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::setFontDescription): (WebCore::RenderStyle::setFontSize): (WebCore::RenderStyle::setFontVariationSettings): (WebCore::RenderStyle::setFontWeight): (WebCore::RenderStyle::setFontStretch): (WebCore::RenderStyle::setFontItalic): * rendering/style/RenderStyle.h: * rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::styleForFirstLetter): * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2018-05-24 Chris Dumez <cdumez@apple.com> Avoid constructing the string "all" repeatedly in MediaQueryParser https://bugs.webkit.org/show_bug.cgi?id=185961 Reviewed by Simon Fraser. Avoid constructing the string "all" repeatedly in MediaQueryParser by: - Having MediaQueryData use an std::optional<String> instead of a String - Updating MediaQueryParser to use a static to store the default media type and use it when the MediaQueryData's media type is std::nullopt. Also do some cleanup. * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::commitMediaQuery): (WebCore::MediaQueryParser::MediaQueryData::MediaQueryData): (WebCore::MediaQueryParser::MediaQueryData::clear): (WebCore::MediaQueryParser::MediaQueryData::addExpression): (WebCore::MediaQueryParser::MediaQueryData::lastExpressionValid): (WebCore::MediaQueryParser::MediaQueryData::removeLastExpression): * css/parser/MediaQueryParser.h: (WebCore::MediaQueryParser::MediaQueryData::setMediaType): (WebCore::MediaQueryParser::MediaQueryData::restrictor const): (WebCore::MediaQueryParser::MediaQueryData::expressions): (WebCore::MediaQueryParser::MediaQueryData::mediaType const): (WebCore::MediaQueryParser::MediaQueryData::currentMediaQueryChanged const): (WebCore::MediaQueryParser::MediaQueryData::restrictor): (WebCore::MediaQueryParser::MediaQueryData::setRestrictor): (WebCore::MediaQueryParser::MediaQueryData::setMediaFeature): (WebCore::MediaQueryParser::MediaQueryData::setMediaQueryParserContext): 2018-05-24 Joseph Pecoraro <pecoraro@apple.com> [iOS] Hard link AppSupport instead of soft linking https://bugs.webkit.org/show_bug.cgi?id=185959 <rdar://problem/40506538> Reviewed by Timothy Horton. * Configurations/WebCore.xcconfig: * platform/network/ios/NetworkStateNotifierIOS.mm: (-[WebNetworkStateObserver initWithBlock:]): (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): 2018-05-24 Chris Dumez <cdumez@apple.com> Cache navigator.userAgent for performance https://bugs.webkit.org/show_bug.cgi?id=185952 Reviewed by Geoffrey Garen. Cache navigator.userAgent for performance. Previously, we would ask the client 5 times while loading apple.com. * page/Navigator.cpp: (WebCore::Navigator::userAgent const): * page/Navigator.h: * page/NavigatorBase.h: * page/NavigatorID.idl: * page/WorkerNavigator.cpp: (WebCore::WorkerNavigator::userAgent const): * page/WorkerNavigator.h: 2018-05-24 Chris Dumez <cdumez@apple.com> Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds https://bugs.webkit.org/show_bug.cgi?id=185951 Reviewed by Geoffrey Garen. Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds and slows down launch time. In particular, it is unnecessary to read NSDefaults to figure out which logging channels should be enabled. * platform/mac/LoggingMac.mm: (WebCore::logLevelString): * platform/unix/LoggingUnix.cpp: (WebCore::logLevelString): * platform/win/LoggingWin.cpp: (WebCore::logLevelString): 2018-05-24 Chris Dumez <cdumez@apple.com> [iOS WK2] Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-fetch-event.https.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=181499 <rdar://problem/36443428> Reviewed by Youenn Fablet. After resolving a registration promise, we send an IPC back to the StorageProcess for synchronization purposes, to make sure the registration does not get updated before the promise's JS code has been executed. However, resolving a promise schedules a microtask to run the JS and we would therefore send the IPC back too early, thus causing flakiness. We now only send the IPC back back only after that microtask has run and the JS has been executed. * bindings/js/JSDOMPromiseDeferred.cpp: (WebCore::DeferredPromise::callFunction): (WebCore::DeferredPromise::whenSettled): * bindings/js/JSDOMPromiseDeferred.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): 2018-05-24 Jinho Bang <zino@chromium.org> [PaymentRequest] Remove currencySystem member https://bugs.webkit.org/show_bug.cgi?id=185860 Reviewed by Andy Estes. After a long discussion, Web Payment Working Group decided to remove the `currencySystem` member[1]. The currency code should be well-formed 3-letter alphabetic code and is allowed even if that is not part of the official ISO 4217 list. [1] https://github.com/w3c/payment-request/pull/694 Test: http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html * Modules/paymentrequest/PaymentCurrencyAmount.h: * Modules/paymentrequest/PaymentCurrencyAmount.idl: * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::checkAndCanonicalizeAmount): (WebCore::checkAndCanonicalizeTotal): * inspector/WebInjectedScriptHost.cpp: (WebCore::objectForPaymentCurrencyAmount): 2018-05-24 Zalan Bujtas <zalan@apple.com> [LFC] Implement position computation for inflow positioned elements https://bugs.webkit.org/show_bug.cgi?id=185936 Reviewed by Antti Koivisto. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): 2018-05-24 Zalan Bujtas <zalan@apple.com> [LFC] Implement FormattingContext::placeInFlowPositionedChildren https://bugs.webkit.org/show_bug.cgi?id=185934 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition const): (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): 2018-05-23 Joseph Pecoraro <pecoraro@apple.com> Use ASCIILiteral with applicationBundleIsEqualTo in RuntimeApplicationChecksCocoa https://bugs.webkit.org/show_bug.cgi?id=185935 Reviewed by Yusuke Suzuki. * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::MacApplication::isSafari): (WebCore::MacApplication::isAppleMail): (WebCore::MacApplication::isIBooks): (WebCore::MacApplication::isITunes): (WebCore::MacApplication::isMicrosoftMessenger): (WebCore::MacApplication::isAdobeInstaller): (WebCore::MacApplication::isAOLInstantMessenger): (WebCore::MacApplication::isMicrosoftMyDay): (WebCore::MacApplication::isMicrosoftOutlook): (WebCore::MacApplication::isQuickenEssentials): (WebCore::MacApplication::isAperture): (WebCore::MacApplication::isVersions): (WebCore::MacApplication::isHRBlock): (WebCore::MacApplication::isIAdProducer): (WebCore::MacApplication::isSolidStateNetworksDownloader): (WebCore::IOSApplication::isMobileMail): (WebCore::IOSApplication::isMobileSafari): (WebCore::IOSApplication::isWebBookmarksD): (WebCore::IOSApplication::isDumpRenderTree): (WebCore::IOSApplication::isMobileStore): (WebCore::IOSApplication::isSpringBoard): (WebCore::IOSApplication::isWebApp): (WebCore::IOSApplication::isIBooks): (WebCore::IOSApplication::isIBooksStorytime): (WebCore::IOSApplication::isTheSecretSocietyHiddenMystery): (WebCore::IOSApplication::isCardiogram): (WebCore::IOSApplication::isNike): 2018-05-23 Brent Fulgham <bfulgham@apple.com> Avoid keeping FormState alive longer than necessary https://bugs.webkit.org/show_bug.cgi?id=185877 <rdar://problem/39329219> Reviewed by Ryosuke Niwa. A number of crash fixes were done to prevent FormState objects from being accessed after their relevant Frames had been destroyed. Unfortunately, this could cause the FormState to persist after the owning Frame had been destroyed, resulting in nullptr dereferences. This patch does the following: 1. Uses WeakPtr's for FormState objects passed to completion handlers, rather than RefPtr, since those completion handlers might fire as part of the clean-up process during Frame destruction. This allows us to use the FormState if they are still valid, but gracefully handle cases where a form submission is cancelled in-flight. 2. Moves FormState object as they pass through the loader. 3. Removes some extraneous WTFMove() calls being made on bare FormState pointers. 4. Changes FormSubmission to hold a RefPtr so we can move the FormState to the loader in the code path that uses it (the FormSubmission is always destroyed shortly afterwards). 5. Changes the trap from Bug 183704 so that it only fires if the FormState object is being retained more than once. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Update for new CompletionHandler signature. * loader/FormState.cpp: (WebCore::FormState::willDetachPage): Revise trap to check for retain counts above one. * loader/FormState.h: (WebCore::FormState::weakPtrFactory const): Added. * loader/FormSubmission.h: (WebCore::FormSubmission::state const): Revised for change to RefPtr. (WebCore::FormSubmission::takeState): Added. * loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): Update for new CompletionHandler signature. (WebCore::FrameLoader::loadURLIntoChildFrame): Ditto. (WebCore::FrameLoader::loadFrameRequest): Ditto. (WebCore::FrameLoader::loadURL): Ditto. (WebCore::FrameLoader::load): Ditto. (WebCore::FrameLoader::loadWithNavigationAction): Ditto. (WebCore::FrameLoader::loadWithDocumentLoader): Ditto. (WebCore::FrameLoader::reloadWithOverrideEncoding): Ditto. (WebCore::FrameLoader::reload): Ditto. (WebCore::FrameLoader::loadPostRequest): Ditto. (WebCore::FrameLoader::loadDifferentDocumentItem): Ditto. * loader/FrameLoader.h: * loader/NavigationScheduler.cpp: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy):Revise to use WeakPtr for FormState passed to the completion handler. Remove some extraneous WTFMove() calls on bare pointers. (WebCore::PolicyChecker::checkNewWindowPolicy): Ditto. * loader/PolicyChecker.h: * page/ContextMenuController.cpp: (WebCore::openNewWindow): Revise for new signatures. (WebCore::ContextMenuController::contextMenuItemSelected): Ditto. 2018-05-23 Keith Miller <keith_miller@apple.com> Expose $vm if window.internals is exposed https://bugs.webkit.org/show_bug.cgi?id=185900 Reviewed by Mark Lam. This is useful for testing vm internals when running LayoutTests. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::injectInternalsObject): 2018-05-23 David Kilzer <ddkilzer@apple.com> Don't create the SubimageCache just to clear an image from it <https://webkit.org/b/185757> Reviewed by Said Abou-Hallawa. To fix this we make SubimageCacheWithTimer::clearImage() a static class method that checks whether the cache exists before removing it. We also make SubimageCacheWithTimer::getImage() a static class method, and move more methods into the SubimageCacheWithTimer class and make them private to reduce API footprint. * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawNativeImage): Switch to use new SubimageCacheWithTimer::getSubimage() static class method. * platform/graphics/cg/NativeImageCG.cpp: (WebCore::clearNativeImageSubimages): Switch to use new SubimageCacheWithTimer::clearImage() static class method which returns early if the subimage cache has not been created yet. This fixes the bug. * platform/graphics/cg/SubimageCacheWithTimer.cpp: (WebCore::SubimageCacheWithTimer::s_cache): Allocate space for static class variable. (WebCore::SubimageCacheWithTimer::getSubimage): Replace instance method with new static class method that gets the subimage cache singleton and calls the subimage() instance method. (WebCore::SubimageCacheWithTimer::clearImage): Replace instance methdod with new static class method that returns early if the static cache singleton doesn't exist (fixes the bug), otherwise calls the clearImageAndSubimages() instance method. (WebCore::SubimageCacheWithTimer::subimage): Rename from getSubimage(). Use `auto` after renaming SubimageCache typedef to SubimageCacheHashSet. (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): Rename from clearImage(). Modernize loops. (WebCore::SubimageCacheWithTimer::subimageCache): Change WebCore::subimageCache() to a static class method that creates the subimage cache singleton if it doesn't exist yet, and returns it. (WebCore::SubimageCacheWithTimer::subimageCacheExists): Add. Returns false if the subimage cache singleton has not been created yet. * platform/graphics/cg/SubimageCacheWithTimer.h: - Rename typedef SubimageCache to SubimageCacheHashSet to avoid general confusion. (WebCore::SubimageCacheWithTimer::getSubimage): (WebCore::SubimageCacheWithTimer::clearImage): - Change to static class methods. (WebCore::SubimageCacheWithTimer::SubimageCacheWithTimer): - Make private. (WebCore::SubimageCacheWithTimer::subimage): - Rename from getSubimage() and make private. (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): - Rename from clearImage() and make private. (WebCore::SubimageCacheWithTimer::subimageCache): - Rename from WebCore::subimageCache() and make a private static class method. (WebCore::SubimageCacheWithTimer::subimageCacheExists): - Add private static class method. (WebCore::SubimageCacheWithTimer::s_cache): - Declare private static variable to hold singleton. 2018-05-23 Eric Carlson <eric.carlson@apple.com> Avoid loading AVFoundation to check supported MIME types if possible https://bugs.webkit.org/show_bug.cgi?id=185839 <rdar://problem/40182010> Reviewed by Jer Noble. Avoid loading AVFoundation to call +[AVURLAssetClass audiovisualMIMETypes] as long as possible, and when they are loaded send the list to the UI process so it can pass it to all extant and all new web processes so they can won't have call it at all. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/ImageDecoder.cpp: (WebCore::ImageDecoder::create): Don't call ImageDecoderAVFObjC::canDecodeType if ImageDecoderCG can decode the type so we don't have to load AVFoundation. (WebCore::ImageDecoder::supportsMediaType): Return as soon as a decoder class says it supports a media type to avoid calling more than one. Call ImageDecoderAVFObjC last. * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h: (WebCore::AVFoundationMIMETypeCache::setCacheMIMETypesCallback): * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: (WebCore::AVFoundationMIMETypeCache::singleton): Simplify. (WebCore::AVFoundationMIMETypeCache::setSupportedTypes): Cache the supplied list of types so we won't have to load AVFoundation when asked for types later. (WebCore::AVFoundationMIMETypeCache::types): (WebCore::AVFoundationMIMETypeCache::supportsContentType): New convenience routine. (WebCore::AVFoundationMIMETypeCache::canDecodeType): Ditto. (WebCore::AVFoundationMIMETypeCache::isAvailable const): New, check to see if AVFoundation.framework is available without actually loading it. (WebCore::AVFoundationMIMETypeCache::loadMIMETypes): Load types if possible. (WebCore::AVFoundationMIMETypeCache::AVFoundationMIMETypeCache): Deleted. (WebCore::AVFoundationMIMETypeCache::loadTypes): Deleted. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::create): Use AVFoundationMIMETypeCache::isAvailable instead of loading the frameworks. (WebCore::ImageDecoderAVFObjC::supportsMediaType): Ditto. (WebCore::ImageDecoderAVFObjC::supportsContentType): Use AVFoundationMIMETypeCache::supportsContentType. (WebCore::ImageDecoderAVFObjC::canDecodeType): Use AVFoundationMIMETypeCache::canDecodeType. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): ASSERT if the AVFoundationMIMETypeCache is empty, it shouldn't be possible to get here in that state. (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType): Use AVFoundationMIMETypeCache::supportsContentType. (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem): Use AVFoundationMIMETypeCache::canDecodeType. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine): ASSERT if the AVFoundationMIMETypeCache is empty, it shouldn't be possible to get here in that state. (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): Use AVFoundationMIMETypeCache::canDecodeType. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::canDecodeType): New. * platform/graphics/cg/ImageDecoderCG.h: 2018-05-23 Chris Dumez <cdumez@apple.com> RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent https://bugs.webkit.org/show_bug.cgi?id=185664 <rdar://problem/36185260> Reviewed by Simon Fraser. RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent. There was logic in FrameLoader::scrollToFragmentWithParentBoundary() to temporarily set the 'safeToPropagateScrollToParent' flag to false on the cross-origin ancestor frame during the call to FrameView::scrollToFragment(). This would correctly prevent RenderLayer::scrollRectToVisible() to propagate the scroll to the cross-origin ancestor frame when scrollRectToVisible() is called synchronously. However, scrollRectToVisible() can get called asynchronously in case of a dirty layout, as part of the post layout tasks. To address the issue, we get rid of the safeToPropagateScrollToParent flag on FrameView and instead update FrameView::safeToPropagateScrollToParent() to do the cross-origin check. FrameView::safeToPropagateScrollToParent() is called by RenderLayer::scrollRectToVisible() and this is a lot more robust than relying on a flag which gets temporarily set. Test: http/tests/navigation/fragment-navigation-cross-origin-subframe-no-scrolling-parent.html * dom/Document.cpp: * dom/Document.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::scrollToFragmentWithParentBoundary): * page/FrameView.cpp: (WebCore::FrameView::FrameView): (WebCore::FrameView::reset): (WebCore::FrameView::safeToPropagateScrollToParent const): * page/FrameView.h: 2018-05-23 Youenn Fablet <youenn@apple.com> NetworkLoadChecker should check cached redirections https://bugs.webkit.org/show_bug.cgi?id=185849 Reviewed by Chris Dumez. Covered by rebased tests. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): Log the case of a redirection with fetch error mode. 2018-05-23 Nan Wang <n_wang@apple.com> AX: setValue on contenteditable should preserve whitespace https://bugs.webkit.org/show_bug.cgi?id=185897 Reviewed by Chris Fleizach. RenderText is using its parent renderer's style to determine if whitespace collapsing is necessary. So when setting the innerText of the element in setValue, let's also set its style in order to preserve whitespaces. Modified an existing test to cover this change. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setValue): 2018-05-23 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Silence GCC 8 warnings https://bugs.webkit.org/show_bug.cgi?id=185556 Reviewed by Žan Doberšek. Silence remaining -Wcast-function-type warnings by casting through void (*)(void), aka GCallback. * accessibility/atk/WebKitAccessibleHyperlink.cpp: (webkitAccessibleHyperlinkSetProperty): (webkitAccessibleHyperlinkGetType): * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (webkitAccessibleGetType): * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage): 2018-05-23 Zalan Bujtas <zalan@apple.com> [LFC] Move sizing/positioning logic to helper classes https://bugs.webkit.org/show_bug.cgi?id=185898 Reviewed by Antti Koivisto. The idea here is to move all the sizing and positioning logic to helper classes so that the formatting context code stays lean. This is similar to the dedicated BlockMarginCollapse class for the collapsing logic. The helper classes have only static functions. These static functions do not mutate the associated DisplayBoxes, but instead they simply retun the computed values. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeFloatingHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const): Deleted. (WebCore::Layout::FormattingContext::computeFloatingNonReplacedHeight const): Deleted. (WebCore::Layout::FormattingContext::computeReplacedHeight const): Deleted. (WebCore::Layout::FormattingContext::computeReplacedWidth const): Deleted. (WebCore::Layout::FormattingContext::contentHeightForFormattingContextRoot const): Deleted. (WebCore::Layout::FormattingContext::computeFloatingNonReplacedWidth const): Deleted. (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const): Deleted. (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedHeight const): Deleted. (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const): Deleted. (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedPosition const): Deleted. (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedPosition const): Deleted. (WebCore::Layout::FormattingContext::shrinkToFitWidth const): Deleted. * layout/FormattingContext.h: * layout/FormattingContextGeometry.cpp: Copied from Source/WebCore/layout/FormattingContext.cpp. (WebCore::Layout::contentHeightForFormattingContextRoot): (WebCore::Layout::shrinkToFitWidth): (WebCore::Layout::FormattingContextGeometry::outOfFlowNonReplacedHeight): (WebCore::Layout::FormattingContextGeometry::outOfFlowNonReplacedWidth): (WebCore::Layout::FormattingContextGeometry::outOfFlowReplacedHeight): (WebCore::Layout::FormattingContextGeometry::outOfFlowReplacedWidth): (WebCore::Layout::FormattingContextGeometry::floatingNonReplacedHeight): (WebCore::Layout::FormattingContextGeometry::floatingNonReplacedWidth): (WebCore::Layout::FormattingContextGeometry::floatingReplacedHeight): (WebCore::Layout::FormattingContextGeometry::floatingReplacedWidth): (WebCore::Layout::FormattingContextGeometry::outOfFlowNonReplacedPosition): (WebCore::Layout::FormattingContextGeometry::outOfFlowReplacedPosition): (WebCore::Layout::FormattingContextGeometry::replacedHeight): (WebCore::Layout::FormattingContextGeometry::replacedWidth): * layout/FormattingContextGeometry.h: Copied from Source/WebCore/layout/blockformatting/BlockFormattingContext.h. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeStaticPosition const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedWidth const): Deleted. (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedHeight const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingContextGeometry.cpp: Added. (WebCore::Layout::BlockFormattingContextGeometry::inFlowNonReplacedHeight): (WebCore::Layout::BlockFormattingContextGeometry::inFlowNonReplacedWidth): (WebCore::Layout::BlockFormattingContextGeometry::inFlowReplacedHeight): (WebCore::Layout::BlockFormattingContextGeometry::inFlowReplacedWidth): (WebCore::Layout::BlockFormattingContextGeometry::staticPosition): * layout/blockformatting/BlockFormattingContextGeometry.h: Copied from Source/WebCore/layout/blockformatting/BlockFormattingContext.h. * layout/displaytree/DisplayBox.h: 2018-05-23 Antti Koivisto <antti@apple.com> Page keeps reloading when viewing photos in google drive (due to too high canvas memory limits) https://bugs.webkit.org/show_bug.cgi?id=185903 <rdar://problem/38420562> Reviewed by Simon Fraser. The canvas memory usage limits don't work on iOS since the current 2GB minimum limit is larger than the maximum process size. * html/HTMLCanvasElement.cpp: (WebCore::maxActivePixelMemory): Always base this on the reported ramSize() on iOS. Make it still fairly large to not risk breaking any currently working content. In practice the limit computes to 448MB on device at the moment. 2018-05-23 Zalan Bujtas <zalan@apple.com> [LFC] Implement positioning for replaced out-of-flow elements https://bugs.webkit.org/show_bug.cgi?id=185902 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedPosition const): 2018-05-22 Myles C. Maxfield <mmaxfield@apple.com> Text can wrap between hyphens and commas https://bugs.webkit.org/show_bug.cgi?id=185899 <rdar://problem/40118983> Reviewed by Zalan Bujtas. Chrome, Firefox, and ICU all agree that text shouldn't wrap there. Test: fast/text/line-break-hyphen-comma.html * rendering/BreakLines.cpp: 2018-05-22 Simon Fraser <simon.fraser@apple.com> Add notifyutil callbacks to dump the memory cache, and the list of live Pages and Documents https://bugs.webkit.org/show_bug.cgi?id=185853 Reviewed by Keith Miller. Add a notifyutil callback to dump the PageCache, which dumps the stats, and the list of live pages. This can be invoked on iOS and macOS via "notifyutil -p com.apple.WebKit.showPageCache". Add a notifyutil callback that dumps the list of all Pages, and the list of all Documents, with Document pointer address and URL. This can be invoked on iOS and macOS via "notifyutil -p com.apple.WebKit.showAllDocuments". * history/PageCache.cpp: (WebCore::PageCache::PageCache): (WebCore::PageCache::dump const): * history/PageCache.h: * loader/cache/CachedResource.h: (WebCore::CachedResource::numberOfClients const): (WebCore::CachedResource::count const): Deleted. * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::MemoryCache): (WebCore::MemoryCache::pruneLiveResourcesToSize): (WebCore::MemoryCache::dumpStats): (WebCore::MemoryCache::dumpLRULists const): * loader/cache/MemoryCache.h: * page/mac/PageMac.mm: (WebCore::Page::platformInitialize): 2018-05-22 Dean Jackson <dino@apple.com> Optimized path zoom animation needs a valid UIImage and CGRect https://bugs.webkit.org/show_bug.cgi?id=185883 <rdar://problem/40306056> Build fix. * loader/FrameLoadRequest.h: 2018-05-22 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r232081. https://bugs.webkit.org/show_bug.cgi?id=185895 Broke two API tests (Requested by bfulgham_ on #webkit). Reverted changeset: "Avoid keeping FormState alive longer than necessary" https://bugs.webkit.org/show_bug.cgi?id=185877 https://trac.webkit.org/changeset/232081 2018-05-22 Dean Jackson <dino@apple.com> Optimized path zoom animation needs a valid UIImage and CGRect https://bugs.webkit.org/show_bug.cgi?id=185883 <rdar://problem/40306056> Reviewed by Jon Lee. Pass the bounding box of the element that was clicked onto the UI process, so it can perform an animation from that spot. This involved adding an IntRect to the ResourceRequest, and passing that info into it from the HTMLAnchorElement, using a new struct called SystemPreviewInfo. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): * loader/FrameLoadRequest.cpp: (WebCore::FrameLoadRequest::FrameLoadRequest): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::FrameLoadRequest): (WebCore::FrameLoadRequest::isSystemPreview const): (WebCore::FrameLoadRequest::systemPreviewRect const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::loadURL): * loader/FrameLoader.h: (WebCore::FrameLoader::urlSelected): * loader/FrameLoaderTypes.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::systemPreviewRect const): (WebCore::ResourceRequestBase::setSystemPreviewRect): * platform/network/ResourceRequestBase.h: 2018-05-22 Chris Dumez <cdumez@apple.com> [POSIX] Use access() instead of stat() in FileSystem::fileExists() https://bugs.webkit.org/show_bug.cgi?id=185882 Reviewed by Geoffrey Garen. Use access() instead of stat() in FileSystem::fileExists(). stat() returns a lot of information we do not leverage and local benchmarking on macOS shows access() being > 80% faster than stat(): stat: 0.31567 (lower is better) access: 0.16074 (lower is better) stat: 0.303665 (lower is better) access: 0.165468 (lower is better) * platform/posix/FileSystemPOSIX.cpp: (WebCore::FileSystem::fileExists): 2018-05-22 Brent Fulgham <bfulgham@apple.com> Avoid keeping FormState alive longer than necessary https://bugs.webkit.org/show_bug.cgi?id=185877 <rdar://problem/39329219> Reviewed by Ryosuke Niwa. A number of crash fixes were done to prevent FormState objects from being accessed after their relevant Frames had been destroyed. Unfortunately, this could cause the FormState to persist after the owning Frame had been destroyed, resulting in nullptr dereferences. This patch does the following: 1. Changes to use WeakPtr's for FormState objects passed to completion handlers, rather than RefPtr, since those completion handlers might fire as part of the clean-up process during Frame destruction. This allows us to use the FormState if they are still valid, but gracefully handle cases where a form submission is cancelled in-flight. 2. Removes some extraneous WTFMove() calls being made on bare FormState pointers. 3. Changes the trap from Bug 183704 so that it only fires if the FormState object is being retained more than once. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Update for new CompletionHandler signature. * loader/FormState.cpp: (WebCore::FormState::willDetachPage): Revise trap to check for retain counts above one. * loader/FormState.h: (WebCore::FormState::weakPtrFactory const): Added. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadFrameRequest): Revise to use WeakPtr for FormState passed to the completion handler. (WebCore::FrameLoader::loadURL): Update for new CompletionHandler signature. (WebCore::FrameLoader::load): Ditto. (WebCore::FrameLoader::loadWithDocumentLoader): Ditto. (WebCore::FrameLoader::loadPostRequest): Ditto. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): Revise to use WeakPtr for FormState passed to the completion handler. Remove some extraneous WTFMove() calls on bare pointers. (WebCore::PolicyChecker::checkNewWindowPolicy): Ditto. * loader/PolicyChecker.h: 2018-05-22 Sihui Liu <sihui_liu@apple.com> Conversion between SecurityOriginData and DatabaseIdentifier is asymmetric when port is null https://bugs.webkit.org/show_bug.cgi?id=185715 Reviewed by Geoffrey Garen. Fixed the issue of null port when converting between SecurityOriginData and DatabaseIdentifier. Test: WKWebView.LocalStorageFetchDataRecords. * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::fromDatabaseIdentifier): 2018-05-22 Keith Miller <keith_miller@apple.com> We should have a CoW storage for NewArrayBuffer arrays. https://bugs.webkit.org/show_bug.cgi?id=185003 Reviewed by Filip Pizlo. * bindings/js/JSDOMConvertSequences.h: (WebCore::Detail::NumericSequenceConverter::convertArray): (WebCore::Detail::SequenceConverter::convertArray): 2018-05-22 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r232052. Breaks internal builds. Reverted changeset: "Use more C++17" https://bugs.webkit.org/show_bug.cgi?id=185176 https://trac.webkit.org/changeset/232052 2018-05-22 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] WebDriver: Network process crash when running imported/w3c/webdriver/tests/delete_cookie/delete.py::test_unknown_cookie https://bugs.webkit.org/show_bug.cgi?id=185867 Reviewed by Michael Catanzaro. We need to null check the value returned by URL::createSoupURI() before passing it to soup. * platform/network/soup/CookieJarSoup.cpp: (WebCore::setCookiesFromDOM): (WebCore::cookiesForSession): (WebCore::getRawCookies): (WebCore::deleteCookie): * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::getCookies): 2018-05-22 Zalan Bujtas <zalan@apple.com> [LFC] Implement positioning for non-replaced out-of-flow elements. https://bugs.webkit.org/show_bug.cgi?id=185858 Reviewed by Antti Koivisto. In certain cases, the out-of-flow element's final position depends on the element's size. Call computeOutOfFlowPosition() after width/height are resolved. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedPosition const): (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedPosition const): * layout/FormattingContext.h: 2018-05-22 Olivier Blin <olivier.blin@softathome.com> Fix build without MathML https://bugs.webkit.org/show_bug.cgi?id=185865 Reviewed by Frédéric Wang. Regression(r226654): [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181443 Regression(r229694): Put the DOM in IsoHeaps https://bugs.webkit.org/show_bug.cgi?id=183546 No new tests, build fix. * mathml/MathMLUnknownElement.cpp: * mathml/MathMLUnknownElement.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::attach): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderMathML.cpp: * rendering/updating/RenderTreeBuilderMathML.h: 2018-05-22 Yacine Bandou <yacine.bandou_ext@softathome.com> [GStreamer] Don't set the ReadyState to HaveNothing when an error occurs in playback pipeline https://bugs.webkit.org/show_bug.cgi?id=185725 Reviewed by Philippe Normand. The ReadyState should not be set to HaveNothing when an error occurs in playback pipeline, because at least we should have the metadata in order to have an error in pipeline. Here is the definition of HaveNothing state in W3C spec https://dev.w3.org/html5/spec-preview/media-elements.html#ready-states "HAVE_NOTHING (numeric value 0): No information regarding the media resource is available. No data for the current playback position is available. Media elements whose networkState attribute is NETWORK_EMPTY are always in the HAVE_NOTHING state." In MSE case, this patch fixes the crashes of the followings WPT encrypted-media tests: - clearkey-mp4-playback-temporary-clear-encrypted.https.html - clearkey-mp4-playback-temporary-multikey-sequential.https.html - clearkey-mp4-playback-temporary-multikey-sequential-readyState.https.html Here is the cause of the crashes: When an error occurs in playback pipeline like no decipher key, in case of encrypted content, the MediaPlayerPrivateGstreamer sets NetworkState to FormatError which causes the detachment of MediaElement from MediaSource, then MediaPlayerPrivateGstreamer sets the ReadyState to HaveNothing which causes a trying again to play the same URI, thus the crash occurs because the MediaElement is detached from MediaSource, see bugzilla for more details. Note: these crashes should be fixed in 185242 but unfortunately it isn't the case. See bug 185242 for more details. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): 2018-05-22 Yacine Bandou <yacine.bandou_ext@softathome.com> [MSE][GStreamer] Fix the deadlock caused by bug 185242 (r231351) https://bugs.webkit.org/show_bug.cgi?id=185723 Reviewed by Xabier Rodriguez-Calvar. After a detailed investigation, we found that, the patch r231351 doesn't fix the crash that expected to fix, it just replaces it by a deadlock. Now the crash is fixed in the bug 185725. This Patch will remove a part of r231351 that causes the deadlock. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcFreeStream): 2018-05-21 Yusuke Suzuki <utatane.tea@gmail.com> Use more C++17 https://bugs.webkit.org/show_bug.cgi?id=185176 Reviewed by JF Bastien. * Configurations/Base.xcconfig: * DerivedSources.make: * platform/ios/LegacyTileGrid.mm: (WebCore::LegacyTileGrid::dropDistantTiles): 2018-05-21 Zalan Bujtas <zalan@apple.com> [LFC] Box::isDescendantOf() should work with out-of-flow elements. https://bugs.webkit.org/show_bug.cgi?id=185812 Reviewed by Antti Koivisto. Use the containing block chain instead of the parent chain to check for isDescendantOf(). (containing block is not always the direct parent) * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isDescendantOf const): 2018-05-21 Chris Nardi <cnardi@chromium.org> Remove dead exception in MediaList.appendMedium https://bugs.webkit.org/show_bug.cgi?id=185278 Reviewed by Chris Dumez. MediaList.appendMedium was able to throw an exception, but MediaQuerySet::add() always returned true, making it impossible for that exception to be thrown. This matched the spec, as |appendMedium| is not specified to throw an exception. Remove the dead code surrounding the exception, and make MediaQuerySet::add() return false if the medium is not added. No new/modified tests as there should be no functional changes. * css/MediaList.cpp: (WebCore::MediaQuerySet::add): (WebCore::MediaList::appendMedium): * css/MediaList.h: * css/MediaList.idl: 2018-05-21 Chris Dumez <cdumez@apple.com> File's structured serialization should serialize lastModified attribute https://bugs.webkit.org/show_bug.cgi?id=185773 Reviewed by Youenn Fablet. Update our implementation for the stuctured serialization of a File to include its lastModified attribute, as per: - https://w3c.github.io/FileAPI/#file-section No new tests, rebaselined existing test. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::write): (WebCore::CloneDeserializer::readFile): * fileapi/File.cpp: (WebCore::File::File): * fileapi/File.h: 2018-05-21 Zalan Bujtas <zalan@apple.com> [LFC] Add FormattingContext::validateGeometryConstraintsAfterLayout https://bugs.webkit.org/show_bug.cgi?id=185811 Reviewed by Antti Koivisto. Also implement LayoutDescendantIterator and fix LayoutIterator. * WebCore.xcodeproj/project.pbxproj: * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): * layout/layouttree/LayoutDescendantIterator.h: Added. (WebCore::Layout::LayoutDescendantIterator<T>::LayoutDescendantIterator): (WebCore::Layout::LayoutDescendantIterator<T>::operator): (WebCore::Layout::LayoutDescendantIteratorAdapter<T>::LayoutDescendantIteratorAdapter): (WebCore::Layout::LayoutDescendantIteratorAdapter<T>::begin): (WebCore::Layout::LayoutDescendantIteratorAdapter<T>::end): (WebCore::Layout::LayoutDescendantIteratorAdapter<T>::at): (WebCore::Layout::descendantsOfType): * layout/layouttree/LayoutIterator.h: (WebCore::Layout::LayoutBoxTraversal::firstChild): (WebCore::Layout::LayoutBoxTraversal::nextAncestorSibling): (WebCore::Layout::LayoutBoxTraversal::next): (WebCore::Layout::LayoutBoxTraversal::nextSkippingChildren): (WebCore::Layout::Traversal::firstChild): (WebCore::Layout::Traversal::nextSibling): (WebCore::Layout::Traversal::previousSibling): (WebCore::Layout::Traversal::findAncestorOfType): (WebCore::Layout::Traversal::firstWithin): (WebCore::Layout::Traversal::next): (WebCore::Layout::LayoutIterator<T>::traversePreviousSibling): (WebCore::Layout::LayoutIterator<T>::traverseAncestor): (WebCore::Layout::Traversal::nextAncestorSibling): Deleted. (WebCore::Layout::Traversal::nextWithin): Deleted. 2018-05-21 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Bugfix for r231968, Suspend/Resume with WK2 https://bugs.webkit.org/show_bug.cgi?id=185830 The flags are needed to be updated even if it is cancelled or finished to cleanup correctly. Also fixed trivial bug for very rare case (hard to produce the situation). Reviewed by Youenn Fablet. No new tests because WK2 is not ready for WinCairo yet in public., tested internaly. * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::suspend): (WebCore::CurlRequest::resume): (WebCore::CurlRequest::pausedStatusChanged): 2018-05-21 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r232030. https://bugs.webkit.org/show_bug.cgi?id=185850 "Caused TestWebKitAPI.IndexedDB.StructuredCloneBackwardCompatibility API test to fail" (Requested by cdumez on #webkit). Reverted changeset: "File's structured serialization should serialize lastModified attribute" https://bugs.webkit.org/show_bug.cgi?id=185773 https://trac.webkit.org/changeset/232030 2018-05-21 Daniel Bates <dabates@apple.com> REGRESSION (r231107): CSP report-only policies are ignored for beacon, importScripts, fetch(), EventSource, and XHR https://bugs.webkit.org/show_bug.cgi?id=185789 <rdar://problem/40380175> Reviewed by Andy Estes. Fixes an issue where CSP report-only policies were ignored for DocumentThreadableLoader and PingLoad initiated loads as a result of moving CSP processing to NetworkProcess. Have NetworkLoadChecker implement the ContentSecurityPolicyClient interface and support logging console messages, sending CSP reports, and dispatching SecurityPolicyViolation events. To support the latter we introduce a new WebPage message, EnqueueSecurityPolicyViolationEvent, to enqueue a SecurityPolicyViolationEvent created from an event init dictionary on the document's event dispatch queue. Additionally, shorten the description for a ResourceError caused by CSP to "Blocked by Content Security Policy" because the CSP code run in NetworkProcess can now log its more detailed error description to Web Inspector. Tests: http/tests/security/contentSecurityPolicy/connect-src-beacon-allowed.html http/tests/security/contentSecurityPolicy/connect-src-beacon-blocked.html http/tests/security/contentSecurityPolicy/report-only-connect-src-beacon-redirect-blocked.php http/tests/security/contentSecurityPolicy/report-only-connect-src-xmlhttprequest-redirect-to-blocked.php * WebCore.xcodeproj/project.pbxproj: Change SecurityPolicyViolationEvent.h from a project header to a private header so that we can include it in WebKit code. * dom/Document.cpp: (WebCore::Document::enqueueSecurityPolicyViolationEvent): Added. * dom/Document.h: * dom/EventInit.h: (WebCore::EventInit::encode const): (WebCore::EventInit::decode * dom/SecurityPolicyViolationEvent.h: (WebCore::SecurityPolicyViolationEvent::Init::encode const): (WebCore::SecurityPolicyViolationEvent::Init::decode): Support encoding and decoding for the event. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::enqueueSecurityPolicyViolationEvent): Formerly named "dispatchSecurityPolicyViolationEvent". (WebCore::DocumentLoader::dispatchSecurityPolicyViolationEvent): Deleted; renamed to "enqueueSecurityPolicyViolationEvent". * loader/DocumentLoader.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): While I am here, move the check for whether the loader strategy took responsibility for performing security checks to be before we perform the CSP check to avoid doing such CSP checks twice in the case that the loader strategy already did them. (WebCore::DocumentThreadableLoader::didFail): Remove code that checked the CSP policy if the load failed. When the loader strategy (NetworkProcess) is responsible for performing security checks then this code would never be executed for a violation of a CSP report-only policy because the loader does not and should not fail the load for a report-only violations. As the name implies, a report-only violation is only reported. That is, it is not enforced such that the load is blocked; => fail the load. (WebCore::DocumentThreadableLoader::reportContentSecurityPolicyError): Update the error description to more accurately describe the error and be consistent with the error message used in NetworkProcess. This error message is shown for a redirect blocked by CSP regardless of whether the redirect was to a same-origin or cross-origin resource. I chose to make the error message more vague than necessary for simplicity because the CSP code will log a more detailed message for this error than could ever be captured by error message for the ResourceError. Also use ASCIILiteral to efficiently construct the String object for the error message. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::reportViolation const): Build up a SecurityPolicyViolationEvent::Init and pass that to the delegate to dispatch. * page/csp/ContentSecurityPolicy.h: Export allowScriptFromSource() and allowChildContextFromSource() so that we can call them from WebKit. * page/csp/ContentSecurityPolicyClient.h: Update for renaming. * platform/network/ResourceRequestBase.h: Define a new requester type to be able to differentiate a request initiated by importScripts() from other requests. We use this to perform the appropriate CSP checks in NetworkProcess. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): Set the requester on the ResourceRequest to ResourceRequest::Requester::ImportScripts so that we can differentiate this request from other requests. See remark for file ResourceRequestBase.h for more details. 2018-05-21 Chris Dumez <cdumez@apple.com> File's structured serialization should serialize lastModified attribute https://bugs.webkit.org/show_bug.cgi?id=185773 Reviewed by Youenn Fablet. Update our implementation for the stuctured serialization of a File to include its lastModified attribute, as per: - https://w3c.github.io/FileAPI/#file-section No new tests, rebaselined existing test. * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::write): (WebCore::CloneDeserializer::readFile): * fileapi/File.cpp: (WebCore::File::File): * fileapi/File.h: 2018-05-21 Jer Noble <jer.noble@apple.com> Complete fix for enabling modern EME by default https://bugs.webkit.org/show_bug.cgi?id=185770 <rdar://problem/40368220> Reviewed by Eric Carlson. * Configurations/FeatureDefines.xcconfig: 2018-05-21 Olivier Blin <olivier.blin@softathome.com> [CMake][WebCore] fix sqlite include dir variable https://bugs.webkit.org/show_bug.cgi?id=185825 Reviewed by Konstantin Tokarev. WebCore's CMakeLists.txt used SQLITE_INCLUDE_DIRS, but only SQLITE_INCLUDE_DIR is defined. No new tests, build fix only. * CMakeLists.txt: Use SQLITE_INCLUDE_DIR instead of SQLITE_INCLUDE_DIRS. 2018-05-21 Olivier Blin <olivier.blin@softathome.com> Propagate WebCore system include dirs in WebCoreHeaderInterface https://bugs.webkit.org/show_bug.cgi?id=185822 Reviewed by Michael Catanzaro. System include directories from WebCore are not propagated anymore to its users. For example gcrypt, sqlite and ICU system headers defined in PAL are not properly passed to WebKit build. This may have been caused partly by the fix in r230385: [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library https://bugs.webkit.org/show_bug.cgi?id=184127 No new tests, build fix. * CMakeLists.txt: 2018-05-21 Olivier Blin <olivier.blin@softathome.com> Fix FrameLoader build without video https://bugs.webkit.org/show_bug.cgi?id=185821 Reviewed by Michael Catanzaro. Regression(r231392): Release assert in ScriptController::canExecuteScripts via HTMLMediaElement::~HTMLMediaElement() https://bugs.webkit.org/show_bug.cgi?id=185288 No new tests, build fix only. * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkCompleted): Flag HTMLMediaElement::isRunningDestructor() usage. 2018-05-21 Sam Weinig <sam@webkit.org> Modernize RenderStyleConstants.h - Part 1 https://bugs.webkit.org/show_bug.cgi?id=185809 Reviewed by Yusuke Suzuki. Modernized the first set of enums in RenderStyleConstants.h by: - Converting them to enum classes - Renaming them to remove unnecessary prefix 'E's - Renaming values to take advantage of enum class scoping (e.g. StyleDifferenceEqual -> StyleDifference::Equal) - Renaming to match modern conventions (e.g BNONE -> None) - Reformatting them so that each value is on its own line. Modernizes the following enums: PrintColorAdjust StyleDifference StyleDifferenceContextSensitiveProperty ColumnFill ColumnSpan BorderCollapse (renamed from EBorderCollapse) BorderStyle (renamed from EBorderStyle) BorderPrecedence (renamed from EBorderPrecedence) OutlineIsAuto PositionType (renamed from EPosition) Float (renamed from EFloat) MarginCollapse (renamed from EMarginCollapse) BoxDecorationBreak (renamed from EBoxDecorationBreak) BoxSizing (renamed from EBoxSizing) Overflow (renamed from EOverflow) VerticalAlign (renamed from EVerticalAlign) Clear (renamed from EClear) TableLayoutType (renamed from ETableLayout) TextCombine FillAttachment (renamed from EFillAttachment) FillBox (renamed from EFillBox) FillRepeat (renamed from EFillRepeat) FillLayerType (renamed from EFillLayerType) FillSizeType (renamed from EFillSizeType) MaskSourceType (renamed from EMaskSourceType) BoxPack (renamed from EBoxPack) BoxAlignment (renamed from EBoxAlignment) BoxOrient (renamed from EBoxOrient) BoxLines (renamed from EBoxLines) BoxDirection (renamed from EBoxDirection) AlignContent (renamed from EAlignContent) FlexDirection (renamed from EFlexDirection) FlexWrap (renamed from EFlexWrap) ItemPosition OverflowAlignment ItemPositionType ContentPosition ContentDistribution (renamed from ContentDistributionType) TextSecurity (renamed from ETextSecurity) UserModify (renamed from EUserModify) UserDrag (renamed from EUserDrag) UserSelect (renamed from EUserSelect) ObjectFit AspectRatioType WordBreak (renamed from EWordBreak) OverflowWrap (renamed from EOverflowWrap) NBSPMode (renamed from ENBSPMode) LineBreak Resize (renamed from EResize) QuoteType TransformStyle3D (renamed from ETransformStyle3D) BackfaceVisibility (renamed from EBackfaceVisibility) LineClamp (renamed from ELineClamp) TextOverflow ImageRendering (renamed from EImageRendering) TextIndentLine TextIndentType Isolation * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (AXAttributeStringSetStyle): * css/BasicShapeFunctions.cpp: (WebCore::valueForCenterCoordinate): (WebCore::valueForBasicShape): * css/CSSComputedStyleDeclaration.cpp: (WebCore::sizingBox): (WebCore::fillRepeatToCSSValue): (WebCore::fillSourceTypeToCSSValue): (WebCore::fillSizeToCSSValue): (WebCore::valueForItemPositionWithOverflowAlignment): (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment): (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator LineClampValue const): (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ColumnFill const): (WebCore::CSSPrimitiveValue::operator ColumnSpan const): (WebCore::CSSPrimitiveValue::operator PrintColorAdjust const): (WebCore::CSSPrimitiveValue::operator BorderStyle const): (WebCore::CSSPrimitiveValue::operator OutlineIsAuto const): (WebCore::CSSPrimitiveValue::operator BackfaceVisibility const): (WebCore::CSSPrimitiveValue::operator FillAttachment const): (WebCore::CSSPrimitiveValue::operator FillBox const): (WebCore::CSSPrimitiveValue::operator FillRepeat const): (WebCore::CSSPrimitiveValue::operator BoxPack const): (WebCore::CSSPrimitiveValue::operator BoxAlignment const): (WebCore::CSSPrimitiveValue::operator BoxDecorationBreak const): (WebCore::CSSPrimitiveValue::operator BoxSizing const): (WebCore::CSSPrimitiveValue::operator BoxDirection const): (WebCore::CSSPrimitiveValue::operator BoxLines const): (WebCore::CSSPrimitiveValue::operator BoxOrient const): (WebCore::CSSPrimitiveValue::operator Clear const): (WebCore::CSSPrimitiveValue::operator FlexDirection const): (WebCore::CSSPrimitiveValue::operator AlignContent const): (WebCore::CSSPrimitiveValue::operator FlexWrap const): (WebCore::CSSPrimitiveValue::operator Float const): (WebCore::CSSPrimitiveValue::operator LineBreak const): (WebCore::CSSPrimitiveValue::operator MarginCollapse const): (WebCore::CSSPrimitiveValue::operator NBSPMode const): (WebCore::CSSPrimitiveValue::operator Overflow const): (WebCore::CSSPrimitiveValue::operator PositionType const): (WebCore::CSSPrimitiveValue::operator Resize const): (WebCore::CSSPrimitiveValue::operator TableLayoutType const): (WebCore::CSSPrimitiveValue::operator TextSecurity const): (WebCore::CSSPrimitiveValue::operator UserDrag const): (WebCore::CSSPrimitiveValue::operator UserModify const): (WebCore::CSSPrimitiveValue::operator UserSelect const): (WebCore::CSSPrimitiveValue::operator VerticalAlign const): (WebCore::CSSPrimitiveValue::operator WordBreak const): (WebCore::CSSPrimitiveValue::operator OverflowWrap const): (WebCore::CSSPrimitiveValue::operator TextCombine const): (WebCore::CSSPrimitiveValue::operator TextOverflow const): (WebCore::CSSPrimitiveValue::operator ObjectFit const): (WebCore::CSSPrimitiveValue::operator Isolation const): (WebCore::CSSPrimitiveValue::operator BorderCollapse const): (WebCore::CSSPrimitiveValue::operator ImageRendering const): (WebCore::CSSPrimitiveValue::operator TransformStyle3D const): (WebCore::CSSPrimitiveValue::operator ItemPosition const): (WebCore::CSSPrimitiveValue::operator OverflowAlignment const): (WebCore::CSSPrimitiveValue::operator ContentPosition const): (WebCore::CSSPrimitiveValue::operator ContentDistribution const): (WebCore::CSSPrimitiveValue::operator EBorderStyle const): Deleted. (WebCore::CSSPrimitiveValue::operator EBackfaceVisibility const): Deleted. (WebCore::CSSPrimitiveValue::operator EFillAttachment const): Deleted. (WebCore::CSSPrimitiveValue::operator EFillBox const): Deleted. (WebCore::CSSPrimitiveValue::operator EFillRepeat const): Deleted. (WebCore::CSSPrimitiveValue::operator EBoxPack const): Deleted. (WebCore::CSSPrimitiveValue::operator EBoxAlignment const): Deleted. (WebCore::CSSPrimitiveValue::operator EBoxDecorationBreak const): Deleted. (WebCore::CSSPrimitiveValue::operator EBoxSizing const): Deleted. (WebCore::CSSPrimitiveValue::operator EBoxDirection const): Deleted. (WebCore::CSSPrimitiveValue::operator EBoxLines const): Deleted. (WebCore::CSSPrimitiveValue::operator EBoxOrient const): Deleted. (WebCore::CSSPrimitiveValue::operator EClear const): Deleted. (WebCore::CSSPrimitiveValue::operator EFlexDirection const): Deleted. (WebCore::CSSPrimitiveValue::operator EAlignContent const): Deleted. (WebCore::CSSPrimitiveValue::operator EFlexWrap const): Deleted. (WebCore::CSSPrimitiveValue::operator EFloat const): Deleted. (WebCore::CSSPrimitiveValue::operator EMarginCollapse const): Deleted. (WebCore::CSSPrimitiveValue::operator ENBSPMode const): Deleted. (WebCore::CSSPrimitiveValue::operator EOverflow const): Deleted. (WebCore::CSSPrimitiveValue::operator EPosition const): Deleted. (WebCore::CSSPrimitiveValue::operator EResize const): Deleted. (WebCore::CSSPrimitiveValue::operator ETableLayout const): Deleted. (WebCore::CSSPrimitiveValue::operator ETextSecurity const): Deleted. (WebCore::CSSPrimitiveValue::operator EUserDrag const): Deleted. (WebCore::CSSPrimitiveValue::operator EUserModify const): Deleted. (WebCore::CSSPrimitiveValue::operator EUserSelect const): Deleted. (WebCore::CSSPrimitiveValue::operator EVerticalAlign const): Deleted. (WebCore::CSSPrimitiveValue::operator EWordBreak const): Deleted. (WebCore::CSSPrimitiveValue::operator EOverflowWrap const): Deleted. (WebCore::CSSPrimitiveValue::operator EBorderCollapse const): Deleted. (WebCore::CSSPrimitiveValue::operator EImageRendering const): Deleted. (WebCore::CSSPrimitiveValue::operator ETransformStyle3D const): Deleted. (WebCore::CSSPrimitiveValue::operator ContentDistributionType const): Deleted. * css/CSSProperties.json: * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapFillAttachment): (WebCore::CSSToStyleMap::mapFillSize): (WebCore::CSSToStyleMap::mapFillMaskSourceType): * css/CSSValueKeywords.in: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertResize): (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueTextIndent): (WebCore::StyleBuilderCustom::applyInheritWebkitAspectRatio): (WebCore::StyleBuilderCustom::applyValueWebkitAspectRatio): (WebCore::StyleBuilderCustom::applyValueContent): * css/StyleResolver.cpp: (WebCore::isScrollableOverflow): (WebCore::StyleResolver::adjustRenderStyle): * css/StyleResolver.h: * css/makeprop.pl: (getFillLayerType): * dom/Element.h: * dom/Node.cpp: (WebCore::computeEditabilityFromComputedStyle): (WebCore::Node::canStartSelection const): * dom/Position.cpp: (WebCore::Position::nodeIsUserSelectNone): (WebCore::Position::nodeIsUserSelectAll): * dom/Range.cpp: (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines const): * editing/ApplyBlockElementCommand.cpp: (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded): * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::doApply): * editing/Editing.cpp: (WebCore::isSpecialHTMLElement): * editing/EditorCommand.cpp: (WebCore::verticalScrollDistance): * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply): * editing/SimplifyMarkupCommand.cpp: (WebCore::SimplifyMarkupCommand::doApply): * editing/VisibleUnits.cpp: (WebCore::backwardSearchForBoundaryWithTextIterator): (WebCore::forwardSearchForBoundaryWithTextIterator): * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::fontAttributesForSelectionStart const): * editing/cocoa/HTMLConverter.mm: (WebCore::editingAttributedStringFromRange): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::shouldTruncateText const): (WebCore::HTMLInputElement::createInnerTextStyle): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const): * html/shadow/SliderThumbElement.cpp: (WebCore::RenderSliderContainer::layout): * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlInnerContainer::resolveCustomStyle): (WebCore::TextControlInnerElement::resolveCustomStyle): (WebCore::TextControlPlaceholderElement::resolveCustomStyle): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::borderBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isRelativelyPositioned const): (WebCore::Layout::Box::isStickyPositioned const): (WebCore::Layout::Box::isAbsolutelyPositioned const): (WebCore::Layout::Box::isFixedPositioned const): (WebCore::Layout::Box::isFloatingPositioned const): (WebCore::Layout::Box::isOverflowVisible const): * page/DragController.cpp: (WebCore::DragController::draggableElement const): * page/Frame.cpp: (WebCore::Frame::rangeForPoint): * page/FrameView.cpp: (WebCore::paginationModeForRenderStyle): (WebCore::FrameView::applyOverflowToViewport): (WebCore::FrameView::applyPaginationToViewport): (WebCore::FrameView::calculateScrollbarModesForLayout): (WebCore::FrameView::calculateExtendedBackgroundMode const): (WebCore::FrameView::adjustScrollStepForFixedContent): * page/SpatialNavigation.cpp: (WebCore::canScrollInDirection): (WebCore::canBeScrolledIntoView): * page/ios/FrameIOS.mm: (WebCore::Frame::nodeRespondingToScrollWheelEvents): * page/mac/EventHandlerMac.mm: (WebCore::scrolledToEdgeInDominantDirection): * rendering/BorderEdge.cpp: (WebCore::BorderEdge::BorderEdge): (WebCore::BorderEdge::obscuresBackgroundEdge const): (WebCore::BorderEdge::obscuresBackground const): * rendering/BorderEdge.h: (WebCore::BorderEdge::style const): (WebCore::BorderEdge::hasVisibleColorAndStyle const): * rendering/FlexibleBoxAlgorithm.h: (WebCore::FlexLayoutAlgorithm::isMultiline const): * rendering/FloatingObjects.cpp: (WebCore::FloatingObject::FloatingObject): * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const): (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks): * rendering/HitTestResult.cpp: (WebCore::HitTestResult::innerTextIfTruncated const): * rendering/ImageQualityController.cpp: (WebCore::ImageQualityController::interpolationQualityFromStyle): * rendering/InlineBox.h: (WebCore::InlineBox::verticalAlign const): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::addToLine): (WebCore::InlineFlowBox::determineSpacingForFlowBoxes): (WebCore::InlineFlowBox::adjustMaxAscentAndDescent): (WebCore::InlineFlowBox::computeLogicalBoxHeights): (WebCore::InlineFlowBox::placeBoxesInBlockDirection): (WebCore::InlineFlowBox::paintFillLayer): * rendering/LogicalSelectionOffsetCaches.h: (WebCore::LogicalSelectionOffsetCaches::containingBlockInfo const): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::removePositionedObjectsIfNeeded): (WebCore::RenderBlock::styleDidChange): (WebCore::RenderBlock::isSelfCollapsingBlock const): (WebCore::RenderBlock::addOverflowFromPositionedObjects): (WebCore::RenderBlock::markFixedPositionObjectForLayoutIfNeeded): (WebCore::RenderBlock::isSelectionRoot const): (WebCore::RenderBlock::selectionGaps): (WebCore::RenderBlock::computeBlockPreferredLogicalWidths const): (WebCore::RenderBlock::adjustBorderBoxLogicalHeightForBoxSizing const): (WebCore::RenderBlock::adjustContentBoxLogicalHeightForBoxSizing const): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::MarginInfo::MarginInfo): (WebCore::RenderBlockFlow::willCreateColumns const): (WebCore::RenderBlockFlow::marginOffsetForSelfCollapsingBlock): (WebCore::RenderBlockFlow::clearFloatsIfNeeded): (WebCore::RenderBlockFlow::marginBeforeEstimateForChild const): (WebCore::RenderBlockFlow::setMustDiscardMarginBefore): (WebCore::RenderBlockFlow::setMustDiscardMarginAfter): (WebCore::RenderBlockFlow::mustDiscardMarginBefore const): (WebCore::RenderBlockFlow::mustDiscardMarginAfter const): (WebCore::RenderBlockFlow::mustDiscardMarginBeforeForChild const): (WebCore::RenderBlockFlow::mustDiscardMarginAfterForChild const): (WebCore::RenderBlockFlow::mustSeparateMarginBeforeForChild const): (WebCore::RenderBlockFlow::mustSeparateMarginAfterForChild const): (WebCore::RenderBlockFlow::styleDidChange): (WebCore::RenderBlockFlow::styleWillChange): (WebCore::RenderBlockFlow::computeLogicalLocationForFloat): (WebCore::RenderBlockFlow::positionNewFloats): (WebCore::RenderBlockFlow::clearFloats): (WebCore::RenderBlockFlow::getClearDelta): (WebCore::RenderBlockFlow::inlineBlockBaseline const): (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const): * rendering/RenderBlockFlow.h: * rendering/RenderBlockLineLayout.cpp: (WebCore::expansionBehaviorForInlineTextBox): (WebCore::isCollapsibleSpace): (WebCore::RenderBlockFlow::layoutRunsAndFloats): (WebCore::RenderBlockFlow::layoutLineBoxes): * rendering/RenderBox.cpp: (WebCore::RenderBox::styleWillChange): (WebCore::RenderBox::styleDidChange): (WebCore::RenderBox::updateFromStyle): (WebCore::RenderBox::includeVerticalScrollbarSize const): (WebCore::RenderBox::includeHorizontalScrollbarSize const): (WebCore::RenderBox::intrinsicScrollbarLogicalWidth const): (WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const): (WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const): (WebCore::RenderBox::adjustBorderBoxLogicalWidthForBoxSizing const): (WebCore::RenderBox::adjustBorderBoxLogicalHeightForBoxSizing const): (WebCore::RenderBox::adjustContentBoxLogicalWidthForBoxSizing const): (WebCore::RenderBox::adjustContentBoxLogicalHeightForBoxSizing const): (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect const): (WebCore::isCandidateForOpaquenessTest): (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const): (WebCore::RenderBox::backgroundHasOpaqueTopLayer const): (WebCore::RenderBox::computeRectForRepaint const): (WebCore::RenderBox::computeLogicalWidthInFragment const): (WebCore::RenderBox::columnFlexItemHasStretchAlignment const): (WebCore::RenderBox::isStretchingColumnFlexItem const): (WebCore::RenderBox::hasStretchedLogicalWidth const): (WebCore::RenderBox::sizesLogicalWidthToFitContent const): (WebCore::RenderBox::computeLogicalHeight const): (WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const): (WebCore::RenderBox::createsNewFormattingContext const): * rendering/RenderBox.h: (WebCore::RenderBox::scrollsOverflowX const): (WebCore::RenderBox::scrollsOverflowY const): (WebCore::RenderBox::selfAlignmentNormalBehavior const): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): (WebCore::RenderBoxModelObject::calculateFillTileSize const): (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry const): (WebCore::styleRequiresClipPolygon): (WebCore::borderStyleFillsBorderArea): (WebCore::borderStyleHasInnerDetail): (WebCore::borderStyleIsDottedOrDashed): (WebCore::borderStyleHasUnmatchedColorsAtCorner): (WebCore::borderStylesRequireMitre): (WebCore::RenderBoxModelObject::paintBorder): (WebCore::RenderBoxModelObject::drawBoxSideFromPath): (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const): * rendering/RenderBoxModelObject.h: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::FlexBoxIterator::FlexBoxIterator): (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): * rendering/RenderDeprecatedFlexibleBox.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::adjustStyleDifference const): (WebCore::RenderElement::shouldRepaintForStyleDifference const): (WebCore::RenderElement::initializeStyle): (WebCore::RenderElement::setStyle): (WebCore::RenderElement::didAttachChild): (WebCore::RenderElement::propagateStyleToAnonymousChildren): (WebCore::RenderElement::styleWillChange): (WebCore::RenderElement::styleDidChange): (WebCore::mustRepaintFillLayers): (WebCore::RenderElement::selectionColor const): (WebCore::RenderElement::selectionBackgroundColor const): (WebCore::RenderElement::drawLineForBoxSide const): (WebCore::RenderElement::paintFocusRing): (WebCore::RenderElement::paintOutline): (WebCore::RenderElement::updateOutlineAutoAncestor): (WebCore::includeNonFixedHeight): * rendering/RenderElement.h: (WebCore::RenderElement::hasHiddenBackface const): (WebCore::RenderElement::canContainAbsolutelyPositionedObjects const): * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::firstLineBaseline const): (WebCore::contentAlignmentNormalBehavior): (WebCore::RenderFlexibleBox::styleDidChange): (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems): (WebCore::RenderFlexibleBox::isLeftToRightFlow const): (WebCore::RenderFlexibleBox::isMultiline const): (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): (WebCore::initialJustifyContentOffset): (WebCore::justifyContentSpaceBetweenChildren): (WebCore::alignmentOffset): (WebCore::RenderFlexibleBox::staticMainAxisPositionForPositionedChild): (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedChild): (WebCore::RenderFlexibleBox::alignmentForChild const): (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight const): (WebCore::RenderFlexibleBox::mainAxisOverflowForChild const): (WebCore::RenderFlexibleBox::crossAxisOverflowForChild const): (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): (WebCore::RenderFlexibleBox::layoutColumnReverse): (WebCore::initialAlignContentOffset): (WebCore::alignContentSpaceBetweenChildren): (WebCore::RenderFlexibleBox::alignFlexLines): (WebCore::RenderFlexibleBox::alignChildren): * rendering/RenderFlexibleBox.h: * rendering/RenderFragmentContainer.cpp: (WebCore::RenderFragmentContainer::overflowRectForFragmentedFlowPortion): * rendering/RenderFullScreen.cpp: (WebCore::createFullScreenStyle): * rendering/RenderFullScreen.h: * rendering/RenderGrid.cpp: (WebCore::RenderGrid::selfAlignmentChangedToStretch const): (WebCore::RenderGrid::selfAlignmentChangedFromStretch const): (WebCore::RenderGrid::styleDidChange): (WebCore::contentAlignmentNormalBehaviorGrid): (WebCore::computeOverflowAlignmentOffset): (WebCore::RenderGrid::isInlineBaselineAlignedChild const): (WebCore::RenderGrid::columnAxisPositionForChild const): (WebCore::RenderGrid::rowAxisPositionForChild const): (WebCore::RenderGrid::resolveAutoStartGridPosition const): (WebCore::RenderGrid::resolveAutoEndGridPosition const): (WebCore::resolveContentDistributionFallback): (WebCore::contentDistributionOffset): (WebCore::RenderGrid::computeContentPositionAndDistributionOffset const): * rendering/RenderGrid.h: * rendering/RenderIFrame.cpp: (WebCore::RenderIFrame::requiresLayer const): * rendering/RenderImage.cpp: (WebCore::RenderImage::styleDidChange): (WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect const): * rendering/RenderInline.cpp: (WebCore::RenderInline::styleWillChange): (WebCore::RenderInline::updateAlwaysCreateLineBoxes): (WebCore::RenderInline::paintOutline): (WebCore::RenderInline::paintOutlineForLine): * rendering/RenderLayer.cpp: (WebCore::isContainerForPositioned): (WebCore::RenderLayer::enclosingAncestorForPosition const): (WebCore::accumulateOffsetTowardsAncestor): (WebCore::RenderLayer::canResize const): (WebCore::RenderLayer::resize): (WebCore::RenderLayer::scrollCornerRect const): (WebCore::resizerCornerRect): (WebCore::RenderLayer::hasOverflowControls const): (WebCore::styleRequiresScrollbar): (WebCore::styleDefinesAutomaticScrollbar): (WebCore::RenderLayer::updateScrollbarsAfterLayout): (WebCore::RenderLayer::paintResizer): (WebCore::RenderLayer::hitTestOverflowControls): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): (WebCore::canDirectlyCompositeBackgroundBackgroundImage): (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const): (WebCore::backgroundRectForBox): * rendering/RenderLayerCompositor.cpp: (WebCore::isScrollableOverflow): (WebCore::styleChangeRequiresLayerRebuild): (WebCore::RenderLayerCompositor::layerStyleChanged): (WebCore::RenderLayerCompositor::reasonsForCompositing const): (WebCore::RenderLayerCompositor::requiresCompositingForBackfaceVisibility const): (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const): (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const): (WebCore::RenderLayerCompositor::requiresCompositingForPosition const): (WebCore::RenderLayerCompositor::layerHas3DContent const): (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::styleWillChange): * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::adjustInnerStyle): * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::requiresBalancing const): (WebCore::RenderMultiColumnSet::paintColumnRules): * rendering/RenderMultiColumnSpannerPlaceholder.cpp: (WebCore::RenderMultiColumnSpannerPlaceholder::createAnonymous): * rendering/RenderObject.cpp: (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const): (WebCore::containerForElement): (WebCore::RenderObject::calculateBorderStyleColor): * rendering/RenderObject.h: (WebCore::RenderObject::isFixedPositioned const): (WebCore::RenderObject::isAbsolutelyPositioned const): (WebCore::RenderObject::setPositionState): (WebCore::RenderObject::RenderObjectBitfields::setPositionedState): (WebCore::RenderObject::RenderObjectBitfields::clearPositionedState): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::styleDidChange): (WebCore::RenderQuote::computeText const): (WebCore::RenderQuote::isOpen const): * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::layout): (WebCore::RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange): (WebCore::RenderReplaced::replacedContentRect const): * rendering/RenderScrollbarPart.cpp: (WebCore::RenderScrollbarPart::styleDidChange): * rendering/RenderTable.cpp: (WebCore::RenderTable::styleDidChange): (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth): (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight): (WebCore::RenderTable::calcBorderStart const): (WebCore::RenderTable::calcBorderEnd const): (WebCore::RenderTable::outerBorderBefore const): (WebCore::RenderTable::outerBorderAfter const): (WebCore::RenderTable::outerBorderStart const): (WebCore::RenderTable::outerBorderEnd const): * rendering/RenderTable.h: (WebCore::RenderTable::collapseBorders const): * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::computeIntrinsicPadding): (WebCore::RenderTableCell::styleDidChange): (WebCore::compareBorders): (WebCore::chooseBorder): (WebCore::emptyBorder): (WebCore::RenderTableCell::computeCollapsedStartBorder const): (WebCore::RenderTableCell::computeCollapsedEndBorder const): (WebCore::RenderTableCell::computeCollapsedBeforeBorder const): (WebCore::RenderTableCell::computeCollapsedAfterBorder const): (WebCore::CollapsedBorders::addBorder): (WebCore::RenderTableCell::paintCollapsedBorders): (WebCore::RenderTableCell::scrollbarsChanged): * rendering/RenderTableCell.h: (WebCore::RenderTableCell::logicalHeightForRowSizing const): (WebCore::RenderTableCell::isBaselineAligned const): * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::styleDidChange): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::calcOuterBorderBefore const): (WebCore::RenderTableSection::calcOuterBorderAfter const): (WebCore::RenderTableSection::calcOuterBorderStart const): (WebCore::RenderTableSection::calcOuterBorderEnd const): (WebCore::RenderTableSection::paintRowGroupBorder): (WebCore::RenderTableSection::paintRowGroupBorderIfRequired): (WebCore::RenderTableSection::cachedCollapsedBorder): * rendering/RenderTableSection.h: * rendering/RenderText.cpp: (WebCore::RenderText::styleDidChange): (WebCore::RenderText::absoluteQuadsClippedToEllipsis const): (WebCore::isSpaceAccordingToStyle): (WebCore::mapLineBreakToIteratorMode): (WebCore::RenderText::computePreferredLogicalWidths): (WebCore::RenderText::setRenderedText): (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const): (WebCore::RenderText::momentarilyRevealLastTypedCharacter): * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::computeLogicalHeight const): * rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::styleDidChange): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::extractControlStatesForRenderer const): * rendering/RenderThemeIOS.mm: (WebCore::adjustInputElementButtonStyle): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::updateFocusedState): (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): (WebCore::RenderThemeMac::adjustSearchFieldStyle const): * rendering/RenderTreeAsText.cpp: (WebCore::printBorderStyle): * rendering/RenderVideo.cpp: (WebCore::RenderVideo::updatePlayer): * rendering/RenderView.cpp: (WebCore::RenderView::RenderView): (WebCore::rendererObscuresBackground): * rendering/RootInlineBox.cpp: (WebCore::RootInlineBox::verticalPositionForBox): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): (WebCore::SimpleLineLayout::canUseForWithReason): * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): * rendering/line/BreakingContext.h: (WebCore::BreakingContext::handleBR): (WebCore::shouldAddBorderPaddingMargin): (WebCore::BreakingContext::handleText): (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): * rendering/line/LineBreaker.cpp: (WebCore::LineBreaker::reset): * rendering/line/LineBreaker.h: (WebCore::LineBreaker::clear): * rendering/line/LineInlineHeaders.h: (WebCore::skipNonBreakingSpace): * rendering/line/LineWidth.cpp: (WebCore::requiresIndent): * rendering/style/BorderData.h: (WebCore::BorderData::borderLeftWidth const): (WebCore::BorderData::borderRightWidth const): (WebCore::BorderData::borderTopWidth const): (WebCore::BorderData::borderBottomWidth const): * rendering/style/BorderValue.h: (WebCore::BorderValue::BorderValue): (WebCore::BorderValue::nonZero const): (WebCore::BorderValue::isVisible const): (WebCore::BorderValue::style const): * rendering/style/CollapsedBorderValue.h: (WebCore::CollapsedBorderValue::CollapsedBorderValue): (WebCore::CollapsedBorderValue::width const): (WebCore::CollapsedBorderValue::style const): (WebCore::CollapsedBorderValue::exists const): (WebCore::CollapsedBorderValue::precedence const): * rendering/style/FillLayer.cpp: (WebCore::FillLayer::FillLayer): (WebCore::clipMax): (WebCore::FillLayer::computeClipMax const): (WebCore::FillLayer::hasRepeatXY const): (WebCore::FillLayer::hasFixedImage const): * rendering/style/FillLayer.h: (WebCore::FillSize::FillSize): (WebCore::FillLayer::attachment const): (WebCore::FillLayer::clip const): (WebCore::FillLayer::origin const): (WebCore::FillLayer::repeatX const): (WebCore::FillLayer::repeatY const): (WebCore::FillLayer::sizeType const): (WebCore::FillLayer::size const): (WebCore::FillLayer::maskSourceType const): (WebCore::FillLayer::isSizeSet const): (WebCore::FillLayer::setAttachment): (WebCore::FillLayer::setClip): (WebCore::FillLayer::setOrigin): (WebCore::FillLayer::setRepeatX): (WebCore::FillLayer::setRepeatY): (WebCore::FillLayer::setComposite): (WebCore::FillLayer::setBlendMode): (WebCore::FillLayer::setSizeType): (WebCore::FillLayer::setSize): (WebCore::FillLayer::setMaskSourceType): (WebCore::FillLayer::clearSize): (WebCore::FillLayer::type const): (WebCore::FillLayer::initialFillAttachment): (WebCore::FillLayer::initialFillClip): (WebCore::FillLayer::initialFillOrigin): (WebCore::FillLayer::initialFillRepeatX): (WebCore::FillLayer::initialFillRepeatY): (WebCore::FillLayer::initialFillComposite): (WebCore::FillLayer::initialFillBlendMode): (WebCore::FillLayer::initialFillSize): (WebCore::FillLayer::initialFillXPosition): (WebCore::FillLayer::initialFillYPosition): (WebCore::FillLayer::initialFillImage): (WebCore::FillLayer::initialFillMaskSourceType): * rendering/style/LineClampValue.h: (WebCore::LineClampValue::LineClampValue): (WebCore::LineClampValue::isPercentage const): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::RenderStyle): (WebCore::resolvedSelfAlignment): (WebCore::RenderStyle::resolvedAlignSelf const): (WebCore::RenderStyle::resolvedJustifySelf const): (WebCore::resolvedContentAlignment): (WebCore::resolvedContentAlignmentPosition): (WebCore::resolvedContentAlignmentDistribution): (WebCore::RenderStyle::resolvedJustifyContentDistribution const): (WebCore::RenderStyle::resolvedAlignContentDistribution const): (WebCore::RenderStyle::changeRequiresLayout const): (WebCore::RenderStyle::changeRequiresPositionedLayoutOnly const): (WebCore::RenderStyle::changeRequiresLayerRepaint const): (WebCore::RenderStyle::changeRequiresRepaint const): (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline const): (WebCore::RenderStyle::changeRequiresRecompositeLayer const): (WebCore::RenderStyle::diff const): (WebCore::RenderStyle::diffRequiresLayerRepaint const): (WebCore::allLayersAreFixed): (WebCore::RenderStyle::colorIncludingFallback const): (WebCore::RenderStyle::setColumnStylesFromPaginationMode): (WebCore::RenderStyle::outlineWidth const): (WebCore::RenderStyle::outlineOffset const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::isFloating const): (WebCore::RenderStyle::position const): (WebCore::RenderStyle::hasOutOfFlowPosition const): (WebCore::RenderStyle::hasInFlowPosition const): (WebCore::RenderStyle::hasViewportConstrainedPosition const): (WebCore::RenderStyle::floating const): (WebCore::RenderStyle::borderLeftStyle const): (WebCore::RenderStyle::borderRightStyle const): (WebCore::RenderStyle::borderTopStyle const): (WebCore::RenderStyle::borderBottomStyle const): (WebCore::RenderStyle::hasOutline const): (WebCore::RenderStyle::outlineStyle const): (WebCore::RenderStyle::overflowX const): (WebCore::RenderStyle::overflowY const): (WebCore::RenderStyle::overflowInlineDirection const): (WebCore::RenderStyle::overflowBlockDirection const): (WebCore::RenderStyle::verticalAlign const): (WebCore::RenderStyle::clear const): (WebCore::RenderStyle::tableLayout const): (WebCore::RenderStyle::backgroundRepeatX const): (WebCore::RenderStyle::backgroundRepeatY const): (WebCore::RenderStyle::backgroundAttachment const): (WebCore::RenderStyle::backgroundClip const): (WebCore::RenderStyle::backgroundOrigin const): (WebCore::RenderStyle::backgroundSizeType const): (WebCore::RenderStyle::maskRepeatX const): (WebCore::RenderStyle::maskRepeatY const): (WebCore::RenderStyle::maskClip const): (WebCore::RenderStyle::maskOrigin const): (WebCore::RenderStyle::maskSizeType const): (WebCore::RenderStyle::borderCollapse const): (WebCore::RenderStyle::boxAlign const): (WebCore::RenderStyle::boxDirection const): (WebCore::RenderStyle::boxLines const): (WebCore::RenderStyle::boxOrient const): (WebCore::RenderStyle::boxPack const): (WebCore::RenderStyle::flexDirection const): (WebCore::RenderStyle::isColumnFlexDirection const): (WebCore::RenderStyle::isReverseFlexDirection const): (WebCore::RenderStyle::flexWrap const): (WebCore::RenderStyle::boxDecorationBreak const): (WebCore::RenderStyle::boxSizing const): (WebCore::RenderStyle::userModify const): (WebCore::RenderStyle::userDrag const): (WebCore::RenderStyle::userSelect const): (WebCore::RenderStyle::marginBeforeCollapse const): (WebCore::RenderStyle::marginAfterCollapse const): (WebCore::RenderStyle::wordBreak const): (WebCore::RenderStyle::overflowWrap const): (WebCore::RenderStyle::nbspMode const): (WebCore::RenderStyle::resize const): (WebCore::RenderStyle::columnRuleStyle const): (WebCore::RenderStyle::hasTextCombine const): (WebCore::RenderStyle::transformStyle3D const): (WebCore::RenderStyle::preserves3D const): (WebCore::RenderStyle::backfaceVisibility const): (WebCore::RenderStyle::textSecurity const): (WebCore::RenderStyle::imageRendering const): (WebCore::RenderStyle::setIsolation): (WebCore::RenderStyle::hasIsolation const): (WebCore::RenderStyle::isolation const): (WebCore::RenderStyle::setPosition): (WebCore::RenderStyle::setFloating): (WebCore::RenderStyle::setBackgroundSize): (WebCore::RenderStyle::setBorderLeftStyle): (WebCore::RenderStyle::setBorderRightStyle): (WebCore::RenderStyle::setBorderTopStyle): (WebCore::RenderStyle::setBorderBottomStyle): (WebCore::RenderStyle::setOutlineStyleIsAuto): (WebCore::RenderStyle::setOutlineStyle): (WebCore::RenderStyle::setOverflowX): (WebCore::RenderStyle::setOverflowY): (WebCore::RenderStyle::setVerticalAlign): (WebCore::RenderStyle::setVerticalAlignLength): (WebCore::RenderStyle::setClear): (WebCore::RenderStyle::setTableLayout): (WebCore::RenderStyle::setImageRendering): (WebCore::RenderStyle::clearBackgroundLayers): (WebCore::RenderStyle::clearMaskLayers): (WebCore::RenderStyle::setBorderCollapse): (WebCore::RenderStyle::setAspectRatioType): (WebCore::RenderStyle::setPrintColorAdjust): (WebCore::RenderStyle::setBoxAlign): (WebCore::RenderStyle::setBoxDirection): (WebCore::RenderStyle::setBoxLines): (WebCore::RenderStyle::setBoxOrient): (WebCore::RenderStyle::setBoxPack): (WebCore::RenderStyle::setBoxSizing): (WebCore::RenderStyle::setFlexDirection): (WebCore::RenderStyle::setFlexWrap): (WebCore::RenderStyle::setBoxDecorationBreak): (WebCore::RenderStyle::setUserModify): (WebCore::RenderStyle::setUserDrag): (WebCore::RenderStyle::setUserSelect): (WebCore::RenderStyle::setTextOverflow): (WebCore::RenderStyle::setMarginBeforeCollapse): (WebCore::RenderStyle::setMarginAfterCollapse): (WebCore::RenderStyle::setWordBreak): (WebCore::RenderStyle::setOverflowWrap): (WebCore::RenderStyle::setNBSPMode): (WebCore::RenderStyle::setLineBreak): (WebCore::RenderStyle::setResize): (WebCore::RenderStyle::setColumnFill): (WebCore::RenderStyle::setColumnRuleStyle): (WebCore::RenderStyle::setColumnSpan): (WebCore::RenderStyle::setTextCombine): (WebCore::RenderStyle::setObjectFit): (WebCore::RenderStyle::setTransformStyle3D): (WebCore::RenderStyle::setBackfaceVisibility): (WebCore::RenderStyle::setTextSecurity): (WebCore::RenderStyle::initialOverflowX): (WebCore::RenderStyle::initialOverflowY): (WebCore::RenderStyle::initialClear): (WebCore::RenderStyle::initialPosition): (WebCore::RenderStyle::initialVerticalAlign): (WebCore::RenderStyle::initialFloating): (WebCore::RenderStyle::initialTableLayout): (WebCore::RenderStyle::initialBorderCollapse): (WebCore::RenderStyle::initialBorderStyle): (WebCore::RenderStyle::initialOutlineStyleIsAuto): (WebCore::RenderStyle::initialTextCombine): (WebCore::RenderStyle::initialObjectFit): (WebCore::RenderStyle::initialBoxAlign): (WebCore::RenderStyle::initialBoxDecorationBreak): (WebCore::RenderStyle::initialBoxDirection): (WebCore::RenderStyle::initialBoxLines): (WebCore::RenderStyle::initialBoxOrient): (WebCore::RenderStyle::initialBoxPack): (WebCore::RenderStyle::initialBoxSizing): (WebCore::RenderStyle::initialJustifyItems): (WebCore::RenderStyle::initialSelfAlignment): (WebCore::RenderStyle::initialDefaultAlignment): (WebCore::RenderStyle::initialContentAlignment): (WebCore::RenderStyle::initialFlexDirection): (WebCore::RenderStyle::initialFlexWrap): (WebCore::RenderStyle::initialUserModify): (WebCore::RenderStyle::initialUserDrag): (WebCore::RenderStyle::initialUserSelect): (WebCore::RenderStyle::initialTextOverflow): (WebCore::RenderStyle::initialMarginBeforeCollapse): (WebCore::RenderStyle::initialMarginAfterCollapse): (WebCore::RenderStyle::initialWordBreak): (WebCore::RenderStyle::initialOverflowWrap): (WebCore::RenderStyle::initialNBSPMode): (WebCore::RenderStyle::initialLineBreak): (WebCore::RenderStyle::initialResize): (WebCore::RenderStyle::initialAspectRatioType): (WebCore::RenderStyle::initialColumnFill): (WebCore::RenderStyle::initialColumnSpan): (WebCore::RenderStyle::initialTransformStyle3D): (WebCore::RenderStyle::initialBackfaceVisibility): (WebCore::RenderStyle::initialImageRendering): (WebCore::RenderStyle::initialPrintColorAdjust): (WebCore::RenderStyle::initialTextIndentLine): (WebCore::RenderStyle::initialTextIndentType): (WebCore::RenderStyle::initialTextSecurity): (WebCore::RenderStyle::initialIsolation): (WebCore::collapsedBorderStyle): (WebCore::RenderStyle::breakOnlyAfterWhiteSpace const): (WebCore::RenderStyle::breakWords const): (WebCore::RenderStyle::setTextOrientation): * rendering/style/RenderStyleConstants.cpp: (WebCore::operator<<): * rendering/style/RenderStyleConstants.h: (WebCore::operator|): (WebCore::operator|=): (WebCore::operator| ): Deleted. (WebCore::operator|= ): Deleted. * rendering/style/SVGRenderStyle.cpp: (WebCore::SVGRenderStyle::diff const): * rendering/style/StyleBackgroundData.cpp: (WebCore::StyleBackgroundData::StyleBackgroundData): * rendering/style/StyleBoxData.cpp: (WebCore::StyleBoxData::StyleBoxData): * rendering/style/StyleBoxData.h: (WebCore::StyleBoxData::boxSizing const): (WebCore::StyleBoxData::boxDecorationBreak const): * rendering/style/StyleContentAlignmentData.h: (WebCore::StyleContentAlignmentData::StyleContentAlignmentData): (WebCore::StyleContentAlignmentData::setPosition): (WebCore::StyleContentAlignmentData::setDistribution): (WebCore::StyleContentAlignmentData::setOverflow): (WebCore::StyleContentAlignmentData::distribution const): * rendering/style/StyleDeprecatedFlexibleBoxData.cpp: (WebCore::StyleDeprecatedFlexibleBoxData::StyleDeprecatedFlexibleBoxData): * rendering/style/StyleDeprecatedFlexibleBoxData.h: * rendering/style/StyleFlexibleBoxData.cpp: (WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData): * rendering/style/StyleFlexibleBoxData.h: * rendering/style/StyleMultiColData.cpp: (WebCore::StyleMultiColData::StyleMultiColData): * rendering/style/StyleMultiColData.h: (WebCore::StyleMultiColData::ruleWidth const): * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): * rendering/style/StyleRareInheritedData.h: * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): * rendering/style/StyleRareNonInheritedData.h: * rendering/style/StyleSelfAlignmentData.h: (WebCore::StyleSelfAlignmentData::StyleSelfAlignmentData): (WebCore::StyleSelfAlignmentData::setPosition): (WebCore::StyleSelfAlignmentData::setPositionType): (WebCore::StyleSelfAlignmentData::setOverflow): * rendering/svg/RenderSVGBlock.cpp: (WebCore::RenderSVGBlock::styleDidChange): * rendering/svg/RenderSVGGradientStop.cpp: (WebCore::RenderSVGGradientStop::styleDidChange): * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::styleDidChange): * rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::styleDidChange): * rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::styleDidChange): * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::registerResource): * rendering/svg/RenderSVGResourceFilterPrimitive.cpp: (WebCore::RenderSVGResourceFilterPrimitive::styleDidChange): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::layout): (WebCore::RenderSVGRoot::shouldApplyViewportClip const): (WebCore::RenderSVGRoot::styleDidChange): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paintText): * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::isOverflowHidden): * rendering/svg/SVGResourcesCache.cpp: (WebCore::SVGResourcesCache::clientStyleChanged): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::attachToRenderElementInternal): * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::insertChildToContinuation): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::styleForFirstLetter): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::isValidColumnSpanner): (WebCore::RenderTreeBuilder::MultiColumn::resolveMovedChild): (WebCore::RenderTreeBuilder::MultiColumn::multiColumnRelativeWillBeRemoved): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2018-05-21 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Stream::decodebinSinkPad is read but never assigned https://bugs.webkit.org/show_bug.cgi?id=185724 Reviewed by Xabier Rodriguez-Calvar. This is a dead code removal patch; except when a Stream instance happens to be instantiated in such a place that the non-initialized decodeSinkPad is != 0, then it is a crash bug fix. * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcLinkStreamToSrcPad): * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamerPrivate.h: 2018-05-21 Alicia Boya García <aboya@igalia.com> [MSE][GStreamer] Force segment.start = 0 after matroskademux https://bugs.webkit.org/show_bug.cgi?id=185740 Reviewed by Xabier Rodriguez-Calvar. This patch ensures that when WebM MSE media segments are appended in an out of order fashion their frames are not discarded by opusparse or any other potential elements downstream in the AppendPipeline that perform segment clipping. This patch fixes the following YTTV 2018 tests: 38. OpusAudioWithOverlap 39. OpusAudioWithSmallGap 40. OpusAudioWithLargeGap 70. VP9VideoWithOverlap 71. VP9VideoWithSmallGap This patch is necessary, but not sufficient for fixing the following YTTV 2018 tests: 36. AppendOpusAudioOutOfOrder 67. AppendVP9VideoOutOfOrder * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): (WebCore::matroskademuxForceSegmentStartToEqualZero): 2018-05-19 Eric Carlson <eric.carlson@apple.com> 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 <commit-queue@webkit.org> Unreviewed, rolling out r231996. https://bugs.webkit.org/show_bug.cgi?id=185799 Broke the GTK build (Requested by eric_carlson on #webkit). Reverted changeset: "Improve NowPlaying "title"" https://bugs.webkit.org/show_bug.cgi?id=185680 https://trac.webkit.org/changeset/231996 2018-05-18 Eric Carlson <eric.carlson@apple.com> 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-18 Rob Buis <rbuis@igalia.com> Cannot unset transition with important https://bugs.webkit.org/show_bug.cgi?id=177684 Reviewed by Chris Dumez. Make removeProperty remove the property regardless if it was set using !important [1]. The new behavior is consistent with Firefox, Chrome and Edge. [1] https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty Test: web-platform-tests/cssom/cssom-setProperty-shorthand.html * css/StyleProperties.cpp: (WebCore::MutableStyleProperties::removePropertiesInSet): 2018-05-18 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r231982. https://bugs.webkit.org/show_bug.cgi?id=185793 Caused layout test failures (Requested by realdawei on #webkit). Reverted changeset: "Complete fix for enabling modern EME by default" https://bugs.webkit.org/show_bug.cgi?id=185770 https://trac.webkit.org/changeset/231982 2018-05-18 Jer Noble <jer.noble@apple.com> Complete fix for enabling modern EME by default https://bugs.webkit.org/show_bug.cgi?id=185770 <rdar://problem/40368220> Reviewed by Eric Carlson. * Configurations/FeatureDefines.xcconfig: 2018-05-18 Brent Fulgham <bfulgham@apple.com> Convert ProcessPrivilege assertions to regular debug-only assertions https://bugs.webkit.org/show_bug.cgi?id=185775 <rdar://problem/40372286> Reviewed by Geoffrey Garen. In Bug 184322 I added a number of RELEASE_ASSERT checks that certain UI-only calls were not being made in the WebContent process. Measurements have shown that these RELEASE_ASSERTs have regressed performance by around 1% on some benchmarks, so we should convert them to normal asserts. This patch changes the RELEASE_ASSERTs into ASSERTs. * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::setDragImage): * platform/mac/PlatformScreenMac.mm: (WebCore::displayID): (WebCore::firstScreen): (WebCore::window): (WebCore::screen): (WebCore::getScreenProperties): (WebCore::screenIsMonochrome): 2018-05-18 Eric Carlson <eric.carlson@apple.com> Handle failure to extend sandbox gracefully https://bugs.webkit.org/show_bug.cgi?id=185779 <rdar://problem/40316349> Reviewed by Brent Fulgham. Test: TestWebKitAPI/Tests/WebKitCocoa/UserMediaSimulateFailedSandbox.mm * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::deny): Include the error string in the promise rejection. * Modules/mediastream/UserMediaRequest.h: 2018-05-18 Antoine Quint <graouts@apple.com> [Web Animations] Turn Web Animations with CSS integration on for test runners https://bugs.webkit.org/show_bug.cgi?id=184819 <rdar://problem/39597337> Unreviewed. Rolling out the patch for this bug, it caused some flaky timeouts for animation suspension tests. Tests: animations/animation-internals-api-multiple-keyframes.html animations/animation-internals-api.html transitions/transition-drt-api-delay.html transitions/transition-drt-api.html * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * page/FrameView.cpp: (WebCore::FrameView::didDestroyRenderTree): * page/RuntimeEnabledFeatures.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2018-05-18 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Bug fix on suspend/resume behavior. https://bugs.webkit.org/show_bug.cgi?id=183089 The flag was not set correctly. Also wrong method was called. Reviewed by Youenn Fablet. Enable loader tests to cover this case. * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::cancel): Remove unnecessary cleanup. Use runXXX method. (WebCore::CurlRequest::suspend): Added cancel check. (WebCore::CurlRequest::resume): Ditto. (WebCore::CurlRequest::callClient): Use runXXX method. Change to move semantics. (WebCore::runOnMainThread): Added. (WebCore::CurlRequest::runOnWorkerThreadIfRequired): Added. (WebCore::CurlRequest::setupTransfer): Bug fix. Call setRequestPaused directly. (WebCore::CurlRequest::didReceiveData): Add state flag update. (WebCore::CurlRequest::invokeDidReceiveResponseForFile): Use runXXX to simplify. (WebCore::CurlRequest::completeDidReceiveResponse): Ditto. (WebCore::CurlRequest::setRequestPaused): Protect state change by mutex. (WebCore::CurlRequest::setCallbackPaused): Ditto. (WebCore::CurlRequest::invokeCancel): Added. (WebCore::CurlRequest::pausedStatusChanged): Use runXXX to simplify. (WebCore::CurlRequest::updateHandlePauseState): Accessor for m_isHandlePaused. (WebCore::CurlRequest::isHandlePaused const): Ditto. * platform/network/curl/CurlRequest.h: Add mutex and paused state. (WebCore::CurlRequest::shouldBePaused const): Rename from isPaused. (WebCore::CurlRequest::isPaused const): Deleted. 2018-05-18 Chris Dumez <cdumez@apple.com> Avoid keeping the frame alive when ref'ing a WindowProxy https://bugs.webkit.org/show_bug.cgi?id=185737 <rdar://problem/40004666> Reviewed by Sam Weinig. Avoid keeping the frame alive when ref'ing a WindowProxy by making WindowProxy manage its own refcount (instead of proxying refcounting to the Frame). As a result, a WindowProxy can now be detached from its Frame. When detached, it return null when asked for a JSWindowProxy. It is important to not extend the lifetime of the Frame because we want script to stop running when the Page gets destroyed. * bindings/js/JSWindowProxy.cpp: (WebCore::toJS): (WebCore::toJSWindowProxy): * bindings/js/JSWindowProxy.h: (WebCore::toJSWindowProxy): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::setupModuleScriptHandlers): (WebCore::ScriptController::jsWindowProxy): (WebCore::ScriptController::windowScriptNPObject): (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: (WebCore::ScriptController::globalObject): * bindings/js/ScriptControllerMac.mm: (WebCore::ScriptController::windowScriptObject): * bindings/js/ScriptState.cpp: (WebCore::mainWorldExecState): * bindings/js/WindowProxy.cpp: (WebCore::WindowProxy::WindowProxy): (WebCore::WindowProxy::~WindowProxy): (WebCore::WindowProxy::detachFromFrame): (WebCore::WindowProxy::createJSWindowProxy): (WebCore::WindowProxy::globalObject): (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript): (WebCore::WindowProxy::setDOMWindow): (WebCore::WindowProxy::window const): (WebCore::WindowProxy::ref): Deleted. (WebCore::WindowProxy::deref): Deleted. * bindings/js/WindowProxy.h: (WebCore::WindowProxy::create): (WebCore::WindowProxy::frame const): (WebCore::WindowProxy::jsWindowProxy): * dom/DocumentTouch.cpp: (WebCore::DocumentTouch::createTouch): * page/AbstractFrame.cpp: (WebCore::AbstractFrame::AbstractFrame): (WebCore::AbstractFrame::~AbstractFrame): * page/AbstractFrame.h: 2018-05-18 Myles C. Maxfield <mmaxfield@apple.com> [iOS] Password fields obscure the text with rectangles instead of circles https://bugs.webkit.org/show_bug.cgi?id=185760 <rdar://problem/38644697> Reviewed by Zalan Bujtas. Password fields are obscured by drawing U+25CF BLACK CIRCLE. On iOS, we have custom handling for this character. However, this custom handling is unnecessary and isn't present on macOS. Instead, we should simply unify the password obscuring codepath between iOS and macOS. Test: fast/text/black-circle.html * platform/graphics/ios/FontCacheIOS.mm: (WebCore::requiresCustomFallbackFont): (WebCore::FontCache::getCustomFallbackFont): 2018-05-18 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r231935. Caused an accessibility test to fail Reverted changeset: "RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent" https://bugs.webkit.org/show_bug.cgi?id=185664 https://trac.webkit.org/changeset/231935 2018-05-18 Zalan Bujtas <zalan@apple.com> [LFC] Implement height computation for non-replaced floating elements. https://bugs.webkit.org/show_bug.cgi?id=185767 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingHeight const): (WebCore::Layout::FormattingContext::computeFloatingNonReplacedHeight const): (WebCore::Layout::FormattingContext::contentHeightForFormattingContextRoot const): * layout/FormattingContext.h: 2018-05-18 Dirk Schulze <krit@webkit.org> Make all SVG shape interfaces inherit from SVGGeometryElement https://bugs.webkit.org/show_bug.cgi?id=185600 Reviewed by Antti Koivisto. Make all SVG shape interfaces inherit from SVGGeometryElement as defined by SVG2: https://svgwg.org/svg2-draft/shapes.html#DOMInterfaces Tests: svg/dom/SVGGeometry-circle.xhtml svg/dom/SVGGeometry-ellipse.xhtml svg/dom/SVGGeometry-line.xhtml svg/dom/SVGGeometry-polygon.xhtml svg/dom/SVGGeometry-polyline.xhtml svg/dom/SVGGeometry-rect.xhtml * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::getTotalLength const): Added shape independent implementation for all methods defined by SVGGeometryElement interface. Calculations are based on the Path object created and referenced by RenderSVGShape. (WebCore::RenderSVGShape::getPointAtLength const): * rendering/svg/RenderSVGShape.h: * svg/SVGCircleElement.cpp: Repeating pattern: Change inheritance from SVGGraphicsElement to SVGGeometryElement. (WebCore::SVGCircleElement::SVGCircleElement): * svg/SVGCircleElement.h: * svg/SVGCircleElement.idl: * svg/SVGEllipseElement.cpp: (WebCore::SVGEllipseElement::SVGEllipseElement): * svg/SVGEllipseElement.h: * svg/SVGEllipseElement.idl: * svg/SVGGeometryElement.cpp: (WebCore::SVGGeometryElement::getTotalLength const): (WebCore::SVGGeometryElement::getPointAtLength const): * svg/SVGGeometryElement.h: * svg/SVGLineElement.cpp: (WebCore::SVGLineElement::SVGLineElement): * svg/SVGLineElement.h: * svg/SVGLineElement.idl: * svg/SVGPolyElement.cpp: (WebCore::SVGPolyElement::SVGPolyElement): * svg/SVGPolyElement.h: * svg/SVGPolygonElement.idl: * svg/SVGPolylineElement.idl: * svg/SVGRectElement.cpp: (WebCore::SVGRectElement::SVGRectElement): * svg/SVGRectElement.h: * svg/SVGRectElement.idl: 2018-05-18 Zalan Bujtas <zalan@apple.com> [LFC] Implement height computation for replaced elements. https://bugs.webkit.org/show_bug.cgi?id=185756 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeFloatingHeight const): (WebCore::Layout::FormattingContext::computeReplacedHeight const): (WebCore::Layout::FormattingContext::computeReplacedWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedHeight const): * layout/FormattingContext.h: 2018-05-18 Zalan Bujtas <zalan@apple.com> [LFC] Implement width computation for non-replaced floating elements. https://bugs.webkit.org/show_bug.cgi?id=185759 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeFloatingNonReplacedWidth const): * layout/FormattingContext.h: 2018-05-18 Antoine Quint <graouts@apple.com> [modern-media-controls] AirPlaySupport should be disabled by default https://bugs.webkit.org/show_bug.cgi?id=185658 <rdar://problem/40272213> Reviewed by Simon Fraser. We now only enable AirplaySupport if the controls are visible to the user _and_ media has played. Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html * Modules/modern-media-controls/media/airplay-support.js: (AirplaySupport.prototype.enable): (AirplaySupport.prototype.controlsUserVisibilityDidChange): (AirplaySupport.prototype._shouldBeEnabled): (AirplaySupport): 2018-05-18 Tim Horton <timothy_horton@apple.com> Stop softlinking QuickLook when loading from client-registered schemes https://bugs.webkit.org/show_bug.cgi?id=185716 <rdar://problem/40303227> Reviewed by Dan Bernstein. No new tests, just a performance improvement. * dom/Document.cpp: * platform/SchemeRegistry.cpp: * platform/ios/QuickLook.h: * platform/ios/QuickLook.mm: (WebCore::isQuickLookPreviewURL): (WebCore::QLPreviewProtocol): Deleted. Hard-code the QuickLook preview URL scheme, instead of loading the QuickLook framework to retrieve it. It will never change, and just in case it does, add an ASSERT (which does load QuickLook) so that we'll find out. 2018-05-18 Antoine Quint <graouts@apple.com> [Web Animations] Turn Web Animations with CSS integration on for test runners https://bugs.webkit.org/show_bug.cgi?id=184819 <rdar://problem/39597337> Reviewed by Jon Lee. We ensure we always call into both CSSAnimationController::cancelAnimations() and AnimationTimeline::cancelDeclarativeAnimationsForElement() since we want teardown of animations to be performed no matter which animation code path is used. What that in mind, we don't conditionalize the CSSAnimationController-related ASSERT() in FrameView::didDestroyRenderTree(). * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * page/FrameView.cpp: (WebCore::FrameView::didDestroyRenderTree): * page/RuntimeEnabledFeatures.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2018-05-17 David Kilzer <ddkilzer@apple.com> Lazily create WebCore::Timer for WebCore::Image <https://webkit.org/b/185752> Reviewed by Simon Fraser. Not every image is an animated image, so lazily creating m_animationStartTimer saves 64 bytes per instance of WebCore::Image. * platform/graphics/Image.cpp: (WebCore::Image::Image): Remove default initializer for m_animationStartTimer. (WebCore::Image::startAnimationAsynchronously): Initialize m_animationStartTimer if it's not already created. * platform/graphics/Image.h: (WebCore::Image::animationPending const): Update to check if m_animationStartTimer has been set before dereferencing it. (WebCore::Image::m_animationStartTimer): Change type to std::unique_ptr<Timer>. 2018-05-17 Nan Wang <n_wang@apple.com> AX: [macOS] Expose the primary screen height through AX API https://bugs.webkit.org/show_bug.cgi?id=185742 Reviewed by Chris Fleizach. Added a new attribute to expose the primary screen size on both WebAccessibilityObjectWrapper and WKAccessibilityWebPageObject. Test: accessibility/mac/primary-screen-height.html * WebCore.xcodeproj/project.pbxproj: * accessibility/mac/WebAccessibilityObjectWrapperMac.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]): (-[WebAccessibilityObjectWrapper primaryScreenHeight]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::screenRectForPrimaryScreen): 2018-05-17 Chris Dumez <cdumez@apple.com> RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent https://bugs.webkit.org/show_bug.cgi?id=185664 <rdar://problem/36185260> Reviewed by Simon Fraser. RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent. There was logic in FrameLoader::scrollToFragmentWithParentBoundary() to temporarily set the 'safeToPropagateScrollToParent' flag to false on the cross-origin ancestor frame during the call to FrameView::scrollToFragment(). This would correctly prevent RenderLayer::scrollRectToVisible() to propagate the scroll to the cross-origin ancestor frame when scrollRectToVisible() is called synchronously. However, scrollRectToVisible() can get called asynchronously in case of a dirty layout, as part of the post layout tasks. To address the issue, we get rid of the safeToPropagateScrollToParent flag on FrameView and instead update FrameView::safeToPropagateScrollToParent() to do the cross-origin check. FrameView::safeToPropagateScrollToParent() is called by RenderLayer::scrollRectToVisible() and this is a lot more robust than relying on a flag which gets temporarily set. Test: http/tests/navigation/fragment-navigation-cross-origin-subframe-no-scrolling-parent.html * dom/Document.cpp: * dom/Document.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::scrollToFragmentWithParentBoundary): * page/FrameView.cpp: (WebCore::FrameView::FrameView): (WebCore::FrameView::reset): (WebCore::FrameView::safeToPropagateScrollToParent const): * page/FrameView.h: 2018-05-17 Don Olmstead <don.olmstead@sony.com> [Curl] Enable HTTP/2 Multiplexing https://bugs.webkit.org/show_bug.cgi?id=185746 Reviewed by Youenn Fablet. Covered by existing tests. * platform/network/curl/CurlContext.cpp: (WebCore::CurlMultiHandle::CurlMultiHandle): 2018-05-17 Jeremy Jones <jeremyj@apple.com> Remove unnecessary exit fullscreen call on application resume https://bugs.webkit.org/show_bug.cgi?id=185747 rdar://problem/40345725 Reviewed by Jer Noble. No new tests because no behavior change. Auto-PiP doesn't automatically return to fullscreen on app resume, so we don't need to keep this vestigial code for handling a corner case of that feature. Also, this can cause an unnecessary exit fullscreen that could cause debug asserts. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive): 2018-05-17 Jeremy Jones <jeremyj@apple.com> Fullscreen to PiP results in exit fullscreen call failure https://bugs.webkit.org/show_bug.cgi?id=185699 rdar://problem/40310291 Reviewed by Eric Carlson. No new tests because no behavior change. Prevent multiple exit fullscreen calls when transitioning from fullscreen to picture-in-picture. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart:]): Implement this to prevent AVKit from automatically initiating exit fullscreen on pip. (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): Set the return to fullscreen flag here, since this is where exit fullscreen happens. (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): Don't exit fullscreen here since it is already initiated in didStartPictureInPicture. 2018-05-17 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r231899. Caused flakiness in two existing modern-media-controls tests. Reverted changeset: "[modern-media-controls] AirPlaySupport should be disabled by default" https://bugs.webkit.org/show_bug.cgi?id=185658 https://trac.webkit.org/changeset/231899 2018-05-17 Eric Carlson <eric.carlson@apple.com> [iOS] Update AirPlay route monitoring https://bugs.webkit.org/show_bug.cgi?id=185706 <rdar://problem/40230677> Unreviewed, fix extra zoom mode build after r231913. * platform/audio/ios/MediaSessionManagerIOS.mm: (-[WebMediaSessionHelper dealloc]): (-[WebMediaSessionHelper hasWirelessTargetsAvailable]): 2018-05-17 Jer Noble <jer.noble@apple.com> CRASH in ImageDecoderAVFObjC::sampleAtIndex() https://bugs.webkit.org/show_bug.cgi?id=185734 <rdar://problem/40295094> Reviewed by Eric Carlson. Test: fast/images/animated-image-mp4-crash.html Test the correct size value before iterating over the SampleMap in presentationOrder() * Modules/mediasource/SampleMap.h: (WebCore::PresentationOrderSampleMap::size const): * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::sampleAtIndex const): 2018-05-17 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Disabled adaptations are not reset upon mainframe navigation https://bugs.webkit.org/show_bug.cgi?id=185735 <rdar://problem/40335311> Reviewed by Tim Horton. When performing mainframe navigation, we currently don't update the Page's ViewportConfiguration's disabled adaptations. This causes disabled adaptations from the previous main document to persist. To fix this, propagate the new document's disabled adaptations to the client when it becomes the main document in the page. Test: fast/viewport/extrazoom/viewport-adaptations-after-navigation.html * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInFrame): (WebCore::Document::processDisabledAdaptations): (WebCore::Document::dispatchDisabledAdaptationsDidChangeForMainFrame): * dom/Document.h: 2018-05-17 Eric Carlson <eric.carlson@apple.com> [iOS] Update AirPlay route monitoring https://bugs.webkit.org/show_bug.cgi?id=185706 <rdar://problem/40230677> Reviewed by Jer Noble. Use an AVRouteDetector instead of an MPVolumeView and an MPAVRoutingController for AirPlay route detection and availability monitoring. No new tests, tested manually. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::hasWirelessPlaybackTargets): No need to update m_hasPlaybackTargets manually, it is always updated by the session manager when route availability changes. * platform/audio/ios/MediaSessionManagerIOS.mm: (-[WebMediaSessionHelper dealloc]): Pull the logic from safelyTearDown inline. (-[WebMediaSessionHelper hasWirelessTargetsAvailable]): Use the AVRouteDetector. (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): Ditto. Simplify logic, there is no need to dispatch twice. (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]): Don't release the route detector completely, just disable route detection, because AVRouteDetector is a lightweight object so it is not worth the overhead of dealloc/realloc to disable/enable route detection. (-[WebMediaSessionHelper interruption:]): Use callOnWebThreadOrDispatchAsyncOnMainThread instead of WebThreadRun so it works correctly in WK2 as well as in WK1. (-[WebMediaSessionHelper applicationWillEnterForeground:]): Ditto. (-[WebMediaSessionHelper applicationDidBecomeActive:]): Ditto. (-[WebMediaSessionHelper applicationWillResignActive:]): Ditto. (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]): Ditto. (-[WebMediaSessionHelper applicationDidEnterBackground:]): Ditto. (safelyTearDown): Deleted. 2018-05-17 Chris Dumez <cdumez@apple.com> Cross-Origin-Options: deny/allow-postmessage should prevent getting navigated by cross-origin scripts https://bugs.webkit.org/show_bug.cgi?id=185681 <rdar://problem/40296313> Reviewed by Geoffrey Garen. Update our canNavigate() implementation [1] to take into account the Cross-Origin-Options header. If the window being navigated or the window trigerring the navigation have a Cross-Origin-Options header value different than 'allow', then the attempt to navigate will be blocked. Note that it was already not possible to navigate via setting window.location since trying to set it would throw a SecurityError with 'Cross-Origin-Options: deny/allow-postmessage'. However, it was possible to trigger a "targeted" navigation via <a target="foo"> or open(url, "foo"). [1] https://html.spec.whatwg.org/#allowed-to-navigate Tests: http/wpt/cross-origin-options/navigation-from-opener-via-open-target.html http/wpt/cross-origin-options/navigation-from-subframe-via-anchor-target.html * dom/Document.cpp: (WebCore::Document::canNavigate): 2018-05-17 Brent Fulgham <bfulgham@apple.com> Storage Access API: Allow documents that have been granted storage access to also do a popup https://bugs.webkit.org/show_bug.cgi?id=185615 <rdar://problem/39105791> Reviewed by Chris Dumez. * dom/Document.cpp: (WebCore::Document::consumeTemporaryUserGesture): Added. Clear the document's active one-time user activity (for window opening) state. (WebCore::Document::enableTemporaryUserGesture): Added. Establish a new active one-time user activity (for window opening) state. (WebCore::Document::requestStorageAccess): If the user approves Storage Access, establish a new UserInteraction scope, then resolve the promise. Also post a task to clear the one-time user gesture state. 2018-05-17 Zalan Bujtas <zalan@apple.com> [LFC] Introduce DisplayBox::Style https://bugs.webkit.org/show_bug.cgi?id=185733 Reviewed by Antti Koivisto. This is the collection of computed style data needed to paint/hittest the display boxtree. * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::createDisplayBox): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): (WebCore::Display::Box::Style::Style): (WebCore::Display::Box::borderBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: 2018-05-17 Antoine Quint <graouts@apple.com> [modern-media-controls] AirPlaySupport should be disabled by default https://bugs.webkit.org/show_bug.cgi?id=185658 <rdar://problem/40272213> Reviewed by Simon Fraser. We now only enable AirplaySupport if the controls are visible to the user _and_ media has played. Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html * Modules/modern-media-controls/media/airplay-support.js: (AirplaySupport.prototype.enable): (AirplaySupport.prototype.controlsUserVisibilityDidChange): (AirplaySupport.prototype._shouldBeEnabled): (AirplaySupport): 2018-05-17 Zalan Bujtas <zalan@apple.com> [LFC] Replace ASSERT_NOT_REACHED with ASSERT_NOT_IMPLEMENTED_YET where applicable. https://bugs.webkit.org/show_bug.cgi?id=185728 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): leftover from previous patch. (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const): (WebCore::Layout::FormattingContext::computeReplacedWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::styleChanged): (WebCore::Layout::LayoutContext::formattingContext): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedWidth const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedHeight const): * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createSubTree): 2018-05-17 Zalan Bujtas <zalan@apple.com> [LFC] Move replaced logic from Layout::Box to Layout::Replaced class https://bugs.webkit.org/show_bug.cgi?id=185711 Reviewed by Antti Koivisto. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeInFlowReplacedWidth const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isReplaced const): Deleted. (WebCore::Layout::Box::hasIntrinsicWidth const): Deleted. (WebCore::Layout::Box::hasIntrinsicHeight const): Deleted. (WebCore::Layout::Box::hasIntrinsicRatio const): Deleted. (WebCore::Layout::Box::intrinsicWidth const): Deleted. (WebCore::Layout::Box::intrinsicHeight const): Deleted. (WebCore::Layout::Box::intrinsicRatio const): Deleted. * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::replaced const): 2018-05-17 Zalan Bujtas <zalan@apple.com> [LFC] Implement width computation for replaced out if flow elements. https://bugs.webkit.org/show_bug.cgi?id=185701 Reviewed by Antti Koivisto. The used value of 'width' is determined as for inline replaced elements. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const): * layout/FormattingContext.h: 2018-05-17 Thibault Saunier <tsaunier@igalia.com> [GStreamer]: Consider GstStream(Collection) as if if was not a GInitiallyUnowned https://bugs.webkit.org/show_bug.cgi?id=185657 Reviewed by Philippe Normand. Starting with GStreamer 1.14[1] the reference is sunk at object creation time, making it a normal GObject in practice, in our GRefPtr template implementation we should just consider GstStream as if it was a normal GObject and not care about its floating reference state as the ref is never sunk by anyone before 1.14 though that floating ref is considered as a hard reference by the GstStreamCollection (leading to assertions/) The exact same issue happens with GstStreamCollection, so fix it at the same time. Also do not adoptRef() on the result of gst_stream_collection_get_stream() as this function is transfer-none. [1] commit f119e93b47efb06ffc68c01d3e094d5346c30041 `gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent` * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: (WTF::adoptGRef): (WTF::refGPtr<GstStream>): (WTF::refGPtr<GstStreamCollection>): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): 2018-05-16 Devin Rousso <webkit@devinrousso.com> Web Inspector: create a navigation item for toggling the overlay rulers/guides https://bugs.webkit.org/show_bug.cgi?id=185644 Reviewed by Matt Baker. This patch is purely a visual change for WebInspector, and doesn't affect anything else. * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::setShowRulers): Added. * inspector/InspectorOverlay.h: * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::shouldShowOverlay): (WebCore::InspectorOverlay::update): (WebCore::InspectorOverlay::setShowRulers): Added. (WebCore::InspectorOverlay::drawRulers): Added. (WebCore::InspectorOverlay::reset): * inspector/InspectorOverlayPage.js: (drawNodeHighlight): (drawQuadHighlight): (drawRulers): Added. (_drawBounds): Added. (reset): (_drawRulers): Deleted. 2018-05-16 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] SoupNetworkSession.h:68:62: error: unknown type name 'URL' https://bugs.webkit.org/show_bug.cgi?id=185378 Unreviewed, just replace unneeded #include with a forward declaration * platform/network/soup/SoupNetworkSession.h: 2018-05-16 Jer Noble <jer.noble@apple.com> CRASH: Exception thrown from -[AVContentKeySession processContentKeyRequestWithIdentifier:initializationData:options:] after -expire called https://bugs.webkit.org/show_bug.cgi?id=185690 <rdar://problem/38297768> Reviewed by Eric Carlson. Reject all calls to update() after close() has been called on the session. * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::update): 2018-05-16 Andy VanWagoner <andy@vanwagoner.family> Add support for Intl NumberFormat formatToParts https://bugs.webkit.org/show_bug.cgi?id=185375 Reviewed by Yusuke Suzuki. Test: js/intl-numberformat-format-to-parts.html Add flag & tests for NumberFormat formatToParts. * Configurations/FeatureDefines.xcconfig: 2018-05-16 Eric Carlson <eric.carlson@apple.com> Improve NowPlaying "title" https://bugs.webkit.org/show_bug.cgi?id=185680 <rdar://problem/40296700> Reviewed by Jer Noble. We send NowPlaying the element's title attribute if not empty, else the element's current url. Title should be preferred because it is the most specific, but we should use the document title if non-empty next, and if falling back to the element's url use just the domain instead of the full url because it isn't likely to be useful to the user given the small amount of space control center uses to display the title. Further, don't use any title at all when in private browsing mode. Tests: http/tests/media/now-playing-info-private-browsing.html http/tests/media/now-playing-info.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::parseAttribute): Update NowPlaying when the title attribute changes. (WebCore::HTMLMediaElement::finishSeek): Update NowPlaying when a seek completes. (WebCore::HTMLMediaElement::mediaSessionTitle const): Update logic. (WebCore::HTMLMediaElement::mediaSessionUniqueIdentifier const): Use the hash of the current url as the unique identifier. * html/HTMLMediaElement.h: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::uniqueIdentifier const): New. (WebCore::PlatformMediaSessionClient::mediaSessionUniqueIdentifier const): Ditto. * platform/audio/PlatformMediaSession.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Update m_lastUpdatedNowPlayingInfoUniqueIdentifier. * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Update. * testing/Internals.cpp: (WebCore::Internals::nowPlayingState const): Expose NowPlaying state. * testing/Internals.h: * testing/Internals.idl: 2018-05-16 Daniel Bates <dabates@apple.com> Attempt to fix the WinCairo build following r231859 (https://bugs.webkit.org/show_bug.cgi?id=185654) Instantiate Cookie as a struct and set applicable fields. * platform/network/curl/CookieJarDB.cpp: (WebCore::CookieJarDB::searchCookies): 2018-05-16 Daniel Bates <dabates@apple.com> Cleanup platform Cookie https://bugs.webkit.org/show_bug.cgi?id=185654 Reviewed by Per Arne Vollan. Remove unnecessary constructor and use =default for default constructor. Simplify Cookie::decode() by having it decode directly into a stack-allocated cookie. Remove some unnecessary local variables. Fix style nits. * platform/Cookie.h: (WebCore::Cookie::Cookie): (WebCore::Cookie::isNull const): (WebCore::Cookie::encode const): (WebCore::Cookie::decode): * platform/network/cf/CookieJarCFNet.cpp: (WebCore::getRawCookies): * platform/network/cocoa/CookieCocoa.mm: (WebCore::cookieCreated): (WebCore::Cookie::Cookie): (WebCore::Cookie::operator== const): (WebCore::Cookie::hash const): * platform/network/soup/CookieJarSoup.cpp: (WebCore::getRawCookies): 2018-05-14 Yusuke Suzuki <utatane.tea@gmail.com> [Win] Use C++17 in MSVC https://bugs.webkit.org/show_bug.cgi?id=185232 Reviewed by Alex Christensen. Workaround for MSVC + /std:c++17. * Modules/geolocation/Coordinates.h: (WebCore::Coordinates::isolatedCopy const): 2018-05-16 Chris Nardi <cnardi@chromium.org> Remove Document#selectedStylesheetSet/preferredStylesheetSet https://bugs.webkit.org/show_bug.cgi?id=185381 Reviewed by Darin Adler. Document#selectedStylesheetSet/preferredStylesheetSet are non-standard methods that are only implemented WebKit. Blink removed these methods in https://crbug.com/690609. The standard versions of these methods are are no longer in the spec. Remove them entirely from our implementation. Updated existing tests and imported/w3c/web-platform-tests/cssom/historical.html. * dom/Document.cpp: (WebCore::Document::processHttpEquiv): * dom/Document.h: * dom/Document.idl: * style/StyleScope.cpp: (WebCore::Style::Scope::collectActiveStyleSheets): * style/StyleScope.h: (WebCore::Style::Scope::preferredStylesheetSetName const): 2018-05-16 Zalan Bujtas <zalan@apple.com> [LFC] Implement width computation for replaced inflow elements. https://bugs.webkit.org/show_bug.cgi?id=185672 Reviewed by Antti Koivisto. Replaced width for block, inline and float elements compute the same way. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeWidth const): (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeInFlowReplacedWidth const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::hasIntrinsicWidth const): (WebCore::Layout::Box::hasIntrinsicHeight const): (WebCore::Layout::Box::hasIntrinsicRatio const): (WebCore::Layout::Box::intrinsicWidth const): (WebCore::Layout::Box::intrinsicHeight const): (WebCore::Layout::Box::intrinsicRatio const): * layout/layouttree/LayoutBox.h: 2018-05-16 Zalan Bujtas <zalan@apple.com> [LFC] Make Display::Box box sizing aware https://bugs.webkit.org/show_bug.cgi?id=185649 Reviewed by Antti Koivisto. Display::Box::width() == Display::Box::contentBox().width() <= box-sizing: content-box; (initial and default value) Display::Box::width() == Display::Box::borderBox().width() <= box-sizing: border-box; * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::createDisplayBox): * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): (WebCore::Display::Box::marginBox const): (WebCore::Display::Box::borderBox const): (WebCore::Display::Box::paddingBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: 2018-05-16 Antoine Quint <graouts@apple.com> REGRESSION (r230574): Interrupted hardware transitions don't behave correctly https://bugs.webkit.org/show_bug.cgi?id=185299 <rdar://problem/39630230> Reviewed by Simon Fraser. In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a newly-uncommitted animation. Test: transitions/interrupted-transition-hardware.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation): 2018-05-15 Yusuke Suzuki <utatane.tea@gmail.com> [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function https://bugs.webkit.org/show_bug.cgi?id=185601 Reviewed by Saam Barati. No behavior change. * Modules/plugins/QuickTimePluginReplacement.mm: (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::getCustomElementCallback): * bindings/js/JSDOMConstructorBase.h: * bindings/js/JSDOMConvertCallbacks.h: (WebCore::Converter<IDLCallbackFunction<T>>::convert): * bindings/js/JSDOMPromise.cpp: (WebCore::DOMPromise::whenSettled): * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::pipeTo): (WebCore::ReadableStream::tee): * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::ReadableStreamDefaultController::invoke): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateOverloadDispatcher): * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestPluginInterface.h: * bridge/objc/objc_runtime.h: * bridge/runtime_method.h: * bridge/runtime_object.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript): * testing/Internals.cpp: (WebCore::Internals::parserMetaData): (WebCore::Internals::cloneArrayBuffer): 2018-05-15 Matt Baker <mattbaker@apple.com> Web Inspector: element details hanger in inspector overlay should have better placement logic https://bugs.webkit.org/show_bug.cgi?id=128482 <rdar://problem/16020709> Reviewed by Timothy Hatcher. When determining the best position for the hovered element details "tooltip", perform placement tests in view space, not canvas space, and account for the top content inset. * inspector/InspectorOverlayPage.js: (reset): Drive by fix: added missing `.height`. (_drawElementTitle): 2018-05-15 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r231765. https://bugs.webkit.org/show_bug.cgi?id=185668 the layout test added with this change is very flaky (Requested by realdawei on #webkit). Reverted changeset: "REGRESSION (r230574): Interrupted hardware transitions don't behave correctly" https://bugs.webkit.org/show_bug.cgi?id=185299 https://trac.webkit.org/changeset/231765 2018-05-15 Devin Rousso <webkit@devinrousso.com> Web Inspector: Add rulers and guides https://bugs.webkit.org/show_bug.cgi?id=32263 <rdar://problem/19281564> Reviewed by Matt Baker. This patch is purely a visual change for WebInspector, and doesn't affect anything else. * inspector/InspectorOverlay.h: * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::update): (WebCore::InspectorOverlay::reset): (WebCore::InspectorOverlay::drawGutter): Deleted. * inspector/InspectorOverlayPage.html: * inspector/InspectorOverlayPage.js: (Bounds): Added. (Bounds.prototype.get minX): Added. (Bounds.prototype.get minY): Added. (Bounds.prototype.get maxX): Added. (Bounds.prototype.get maxY): Added. (Bounds.prototype.update): Added. (drawNodeHighlight): (drawQuadHighlight): (reset): (_isolateActions): Added. (_quadToPath): Added. (_quadToPath.parseQuadPoint): Added. (_drawOutlinedQuad): Added. (_drawPath): Added. (_drawPath.parsePoints): Added. (_drawOutlinedQuadWithClip): Added. (_drawElementTitle): (_drawShapeHighlight): (_drawFragmentHighlight): (_drawRulers): Added. (quadToPath): Deleted. (drawOutlinedQuad): Deleted. (pathCommand): Deleted. (drawPath): Deleted. (drawOutlinedQuadWithClip): Deleted. (drawGutter): Deleted. * inspector/InspectorOverlayPage.css: (#log): Added. (#right-gutter): Deleted. (#bottom-gutter): Deleted. 2018-05-15 Jer Noble <jer.noble@apple.com> Media continues loading after rendered invisible (removed from DOM; scrolled off screen) https://bugs.webkit.org/show_bug.cgi?id=185487 Reviewed by Eric Carlson. Test: media/video-buffering-allowed.html When a media element is removed from the dom (e.g. through innerHTML=""), it doesn't necessarily stop loading media data; it will continue to do so until its destructor is called through garbage collection. Similarly, when a media element is rendered not-visible by being scrolled off-screen or being made display:none, media loading continues. There are legitimate use cases for out-of-DOM media loading, so only temporarily block loading when the element transitions out of the document. Similarly, only block loading for non-visible media elements when returning from the "page is hidden" state, and only until the media element is asked to play or is otherwise made visible. Note: this refactors a lot of code out of PlatformMediaSession and into MediaElementSession, since this code is specific to "media elements". * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): (WebCore::HTMLMediaElement::insertedIntoAncestor): (WebCore::HTMLMediaElement::removedFromAncestor): (WebCore::HTMLMediaElement::playInternal): (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): (WebCore::HTMLMediaElement::resume): (WebCore::HTMLMediaElement::visibilityStateChanged): (WebCore::HTMLMediaElement::createMediaPlayer): (WebCore::HTMLMediaElement::setShouldBufferData): (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible): (WebCore::HTMLMediaElement::isVisibleInViewportChanged): (WebCore::HTMLMediaElement::fullscreenModeChanged): (WebCore::HTMLMediaElement::setInActiveDocument): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::shouldBufferData const): (WebCore::HTMLMediaElement::elementIsHidden const): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::MediaElementSession): (WebCore::MediaElementSession::clientWillBeginAutoplaying): (WebCore::MediaElementSession::clientWillBeginPlayback): (WebCore::MediaElementSession::clientWillPausePlayback): (WebCore::MediaElementSession::visibilityChanged): (WebCore::MediaElementSession::isVisibleInViewportChanged): (WebCore::MediaElementSession::inActiveDocumentChanged): (WebCore::MediaElementSession::scheduleClientDataBufferingCheck): (WebCore::MediaElementSession::clientDataBufferingTimerFired): (WebCore::MediaElementSession::updateClientDataBuffering): (WebCore::MediaElementSession::dataBufferingPermitted const): (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay const): * html/MediaElementSession.h: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::PlatformMediaSession): (WebCore::PlatformMediaSession::clientWillBeginAutoplaying): (WebCore::PlatformMediaSession::clientWillBeginPlayback): (WebCore::PlatformMediaSession::clientWillPausePlayback): (): Deleted. (WebCore::PlatformMediaSession::visibilityChanged): Deleted. (WebCore::PlatformMediaSession::scheduleClientDataBufferingCheck): Deleted. (WebCore::PlatformMediaSession::clientDataBufferingTimerFired): Deleted. (WebCore::PlatformMediaSession::updateClientDataBuffering): Deleted. (WebCore::PlatformMediaSession::isHidden const): Deleted. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSessionClient::setShouldBufferData): Deleted. (WebCore::PlatformMediaSessionClient::elementIsHidden const): Deleted. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::sessionCanLoadMedia const): Deleted. * platform/audio/PlatformMediaSessionManager.h: * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::sessionCanLoadMedia const): Deleted. * rendering/RenderVideo.cpp: (WebCore::RenderVideo::willBeDestroyed): * testing/Internals.cpp: (WebCore::Internals::elementShouldBufferData): * testing/Internals.h: * testing/Internals.idl: 2018-05-15 Charles Vazac <cvazac@gmail.com> Add the PerformanceServerTiming Interface which makes Server-Timing header timing values available to JavaScript running in the browser. https://bugs.webkit.org/show_bug.cgi?id=175569 Reviewed by Youenn Fablet. Tests were imported from web-platform-tests: WebKit/LayoutTests/imported/w3c/web-platform-tests/server-timing/* * Sources.txt: Added references to HeaderFieldTokenizer.cpp, ServerTiming.cpp, and ServerTimingParser.cpp. * WebCore.xcodeproj/project.pbxproj: Added various files. * loader/HeaderFieldTokenizer.cpp: Added. (WebCore::HeaderFieldTokenizer::HeaderFieldTokenizer): Added class for tokenizing header values. (WebCore::HeaderFieldTokenizer::consume): Added method to consume a specified character. (WebCore::HeaderFieldTokenizer::consumeQuotedString): Added method to consume a quote-string. (WebCore::HeaderFieldTokenizer::consumeToken): Added a method to consume a token. (WebCore::HeaderFieldTokenizer::consumeTokenOrQuotedString): Added method to consume a quote-string or quote-string, depending on net character. (WebCore::HeaderFieldTokenizer::skipSpaces): Added method to skip whitespace. (WebCore::HeaderFieldTokenizer::consumeBeforeAnyCharMatch): Added method to advance the cursor up until any of a list of characters. * loader/HeaderFieldTokenizer.h: Added. * loader/HTTPHeaderField.cpp: Expose isTokenCharacter and isWhitespace. * loader/HTTPHeaderField.h: Expose isTokenCharacter and isWhitespace. * loader/PolicyChecker.cpp: Added #include so source compiled on my machine. * loader/ResourceTiming.cpp: (WebCore::ResourceTiming::ResourceTiming): Added call to initServerTiming to parse the header. (WebCore::ResourceTiming::initServerTiming): Added method to parse the header. (WebCore::ResourceTiming::populateServerTiming): Added method to populate the server timing entries on a PerformanceResourceTiming object. (WebCore::ResourceTiming::isolatedCopy const): Added code to copy over the server timing entries. * loader/ResourceTiming.h: (WebCore::ResourceTiming::ResourceTiming): Accept collection of server timing entries in c'tor. * loader/ServerTiming.cpp: Added. (WebCore::ServerTiming::setParameter): Set named parameters, ignoring unrecognized or duplicates. (WebCore::ServerTiming::isolatedCopy const): Return a new pointer to the object. * loader/ServerTiming.h: Added. (WebCore::ServerTiming::ServerTiming): Added struct for the data needed by a server timing entry. (WebCore::ServerTiming::name const): Added name field of a server timing entry. (WebCore::ServerTiming::duration const): Added duration field of a server timing entry. (WebCore::ServerTiming::description const): Added description field of a server timing entry. * loader/ServerTimingParser.cpp: Added. (WebCore::ServerTimingParser::parseServerTiming): Parses the header generating a collection of server timing structs. * loader/ServerTimingParser.h: Added. * loader/WorkerThreadableLoader.h: Fix build. * page/Performance.cpp: (WebCore::Performance::addResourceTiming): Fixed a typo. * page/PerformanceResourceTiming.cpp: (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): Given a ResourceTiming object, populate our collection of PerformanceServerTiming objects. * page/PerformanceResourceTiming.h: Added serverTiming member and getter. * page/PerformanceResourceTiming.idl: Added serverTiming member to interface. * platform/network/HTTPHeaderNames.in: Added "Server-Timing" to the header enum. * platform/network/ResourceResponseBase.cpp: Added "Server-Timing" to isSafeCrossOriginResponseHeader whitelist. 2018-05-15 Brady Eidson <beidson@apple.com> Fix crash after a Worker terminates but there are still IDB transactions the server is trying to open for it. <rdar://problem/33744241> and https://bugs.webkit.org/show_bug.cgi?id=185653 Reviewed by Andy Estes. Test: storage/indexeddb/modern/worker-transaction-open-after-worker-stop.html * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): It's okay to not be able to find a pending TX that the server has started. e.g. When it was a WebWorker that asked for the TX but it has since terminated. 2018-05-15 Thomas Klausner <tk@giga.or.at> Add missing header to fix build. https://bugs.webkit.org/show_bug.cgi?id=185378 Reviewed by Michael Catanzaro. * platform/network/soup/SoupNetworkSession.h: 2018-05-15 Carlos Alberto Lopez Perez <clopez@igalia.com> [WPE] Build failure with RPi userland drivers and gstreamer-gl https://bugs.webkit.org/show_bug.cgi?id=185639 Reviewed by Philippe Normand. When building for the RPi with userland drivers (dispmanx) override the value of GST_GL_HAVE_GLSYNC to 1 to avoid that the gstreamer-gl headers try to redefine the GLsync type that is already defined in libepoxy. Defining __gl2_h_ is also needed to avoid other conflicting type definitions that happen between libepoxy and RPi GLES2 userland headers when the gstreamer-gl headers are included. The issue doesn't happen with 1.14.0, so a check for that is added as well. No new tests, no behavior change. It is a build fix. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 2018-05-15 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed, rolling out r230749 This did not work as desired. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresMacintoshPlatform): 2018-05-15 Dirk Schulze <krit@webkit.org> Add new SVGDOM SVGFEBLEND constants https://bugs.webkit.org/show_bug.cgi?id=185581 Reviewed by Simon Fraser. Provide new SVG DOM constants for the new blend modes added to feBlend. https://drafts.fxtf.org/filter-effects-1/#InterfaceSVGFEBlendElement * platform/graphics/GraphicsTypes.cpp: (WebCore::blendModeName): * platform/graphics/GraphicsTypes.h: * svg/SVGFEBlendElement.h: (WebCore::SVGPropertyTraits<BlendMode>::highestEnumValue): (WebCore::SVGPropertyTraits<BlendMode>::toString): * svg/SVGFEBlendElement.idl: 2018-05-15 Antoine Quint <graouts@apple.com> [Web Animations] Expose Web Animations CSS integration as an experimental feature https://bugs.webkit.org/show_bug.cgi?id=185647 Reviewed by Dean Jackson. Make the Web Animations CSS integration flag an experimental feature, and only indicate that it is on if the Web Animations experimental feature is also enabled. * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInFrame): (WebCore::Document::resume): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): * page/Frame.cpp: (WebCore::Frame::clearTimers): * page/FrameView.cpp: (WebCore::FrameView::didDestroyRenderTree): * page/Page.cpp: (WebCore::Page::handleLowModePowerChange): (WebCore::Page::setIsVisibleInternal): (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebAnimationsCSSIntegrationEnabled): (WebCore::RuntimeEnabledFeatures::webAnimationsCSSIntegrationEnabled const): (WebCore::RuntimeEnabledFeatures::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled const): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::currentTransform const): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * testing/InternalSettings.cpp: (WebCore::InternalSettings::webAnimationsCSSIntegrationEnabled): (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted. * testing/InternalSettings.h: * testing/InternalSettings.idl: * testing/Internals.cpp: (WebCore::Internals::numberOfActiveAnimations const): (WebCore::Internals::animationsAreSuspended const): (WebCore::Internals::animationsInterval const): (WebCore::Internals::suspendAnimations const): (WebCore::Internals::resumeAnimations const): 2018-05-15 David Kilzer <ddkilzer@apple.com> Fix -Wreturn-std-move warnings in WebKit found by new clang compiler <https://webkit.org/b/185621> Reviewed by Youenn Fablet. Fix warnings like the following: In file included from DerivedSources/WebCore/unified-sources/UnifiedSource139.cpp:5: ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: error: local variable 'sdp' will be copied despite being returned by name [-Werror,-Wreturn-std-move] return sdp; ^~~ ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: note: call 'std::move' explicitly to avoid copying return sdp; ^~~ std::move(sdp) 1 error generated. * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::filterSDP const): * accessibility/AccessibilityObject.cpp: (WebCore::rangeClosestToRange): * bindings/js/JSDOMConvertSequences.h: (WebCore::Detail::GenericSequenceConverter::convert): (WebCore::Detail::NumericSequenceConverter::convertArray): * bindings/js/JSDOMConvertStrings.cpp: (WebCore::stringToByteString): (WebCore::stringToUSVString): - Use WTFMove() in return statements to fix the warnings. 2018-05-14 Dean Jackson <dino@apple.com> Download and present System Preview https://bugs.webkit.org/show_bug.cgi?id=185459 <rdar://problem/40079228> Reviewed by Tim Horton. If an <a> is a system preview, tell the resource request about it. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): 2018-05-15 Antti Koivisto <antti@apple.com> animation-play-state: paused causes very high cpu load because of style invalidation loop https://bugs.webkit.org/show_bug.cgi?id=182436 <rdar://problem/37182562> Reviewed by Dean Jackson. Test: animations/animation-playstate-paused-style-resolution.html If the style of an element with 'animation-play-state: paused' is recomputed so it stays paused we would enter zero-duration animation timer loop. * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::updateStateMachine): Don't move to AnimationState::PausedWaitResponse unless we get AnimationStateInput::StyleAvailable (matching the comments). Otherwise just stay in the existing paused state. Remove AnimationStateInput::StartAnimation from assertion as the case can't happen. 2018-05-14 Youenn Fablet <youenn@apple.com> readableStreamDefaultControllerError should return early if stream is not readable https://bugs.webkit.org/show_bug.cgi?id=185602 Reviewed by Chris Dumez. Return early if stream is not readable in @readableStreamDefaultControllerError. Update call sites to no longer check for ReadableStream state. Covered by unflaked and rebased tests. * Modules/streams/ReadableStreamDefaultController.js: (error): * Modules/streams/ReadableStreamInternals.js: (readableStreamDefaultControllerError): (readableStreamDefaultControllerCallPullIfNeeded): 2018-05-14 Zalan Bujtas <zalan@apple.com> [LFC] Implement width computation for non-replaced block level inflow elements. https://bugs.webkit.org/show_bug.cgi?id=185641 Reviewed by Sam Weinig. Block level inflow elements participate in block formatting context. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeWidth const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const): * layout/inlineformatting/InlineFormattingContext.h: 2018-05-14 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the iOS build after r231779 Also address a minor in-person review comment by returning "extrazoom" instead of the empty string. * page/DisabledAdaptations.cpp: (WebCore::extraZoomModeAdaptationName): 2018-05-14 Zalan Bujtas <zalan@apple.com> [LFC] FormattingContext:computeOutOfFlowNonReplacedHeight/Width should use the computed margins/paddings/borders https://bugs.webkit.org/show_bug.cgi?id=185633 Reviewed by Sam Weinig. By the time we start computing height and width, DisplayBox should already have the computed values for margin/padding/border. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::paddingTop const): (WebCore::Display::Box::paddingLeft const): (WebCore::Display::Box::paddingBottom const): (WebCore::Display::Box::paddingRight const): (WebCore::Display::Box::borderTop const): (WebCore::Display::Box::borderLeft const): (WebCore::Display::Box::borderBottom const): (WebCore::Display::Box::borderRight const): 2018-05-14 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Google search results are excessively zoomed in https://bugs.webkit.org/show_bug.cgi?id=185347 <rdar://problem/39999778> Reviewed by Tim Horton. It turns out that basing minimum layout size and shrink-to-fit behaviors off of the `shrink-to-fit` viewport argument poses compatibility risks with web pages that already specify `shrink-to-fit` to opt out of default viewport shrinking behaviors in 1/3 multitasking mode on iPad. One way to resolve this is to introduce a new viewport meta content attribute to disable viewport heuristics in extra zoom mode. However, combined shrink-to-fit and minimum device width behaviors are difficult to describe using a single backwards-compatible viewport meta content attribute, and the need to suppress the default behavior of `shrink-to-fit=no` if such an attribute is not disabled further muddles our viewport story. After some internal deliberation, we’ve decided to experiment with a new meta tag named "disabled-adaptations". The content of this meta tag is a comma-separated list of adaptation names; if an adaptation name matches a known adaptation type (for instance, extra zoom mode), we disable the class of behaviors used to adapt web content. The first and only known adaptation type is extra zoom mode, which affects `shrink-to-fit` and layout size adjustments. See per-method changes below for more details. Test: fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::processDisabledAdaptations): * dom/Document.h: (WebCore::Document::disabledAdaptations const): Add disabled adaptations to Document. Changes to disabled adaptations are not propagated if the parsed disabled adaptation types don't change; upon changing adaptation types, notify the client to adjust for the new disabled adaptations (currently, this only affects the viewport configuration). * dom/ViewportArguments.h: * html/HTMLMetaElement.cpp: (WebCore::HTMLMetaElement::process): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner): (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * loader/FrameLoader.cpp: (WebCore::FrameLoader::commitProvisionalLoad): Restore the set of disabled adaptations when restoring a page from the cache. * page/Chrome.cpp: (WebCore::Chrome::dispatchDisabledAdaptationsDidChange const): * page/Chrome.h: * page/ChromeClient.h: Add plumbing for changes to the set of disabled adaptations. * page/DisabledAdaptations.cpp: Added. (WebCore::extraZoomModeAdaptationName): * page/DisabledAdaptations.h: Added. Introduce a header containing a new enum for the extra zoom mode adaptation, as well as a helper function to return the extra zoom mode adaptation name. * page/Page.cpp: (WebCore::Page::disabledAdaptations const): Returns the mainframe's set of adaptations to disable. * page/Page.h: * page/RemoteFrame.h: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setDisabledAdaptationsMetaTagEnabled): (WebCore::RuntimeEnabledFeatures::disabledAdaptationsMetaTagEnabled const): Add a new runtime feature to gate handling the "disabled-adaptations" meta tag. * page/ViewportConfiguration.cpp: (WebCore::shouldOverrideShrinkToFitArgument): (WebCore::needsUpdateAfterChangingDisabledAdaptations): (WebCore::ViewportConfiguration::setDisabledAdaptations): (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const): Consult whether or not extra zoom mode adaptations are disabled, instead of the shrink-to-fit attribute value. (WebCore::ViewportConfiguration::updateConfiguration): * page/ViewportConfiguration.h: Add an OptionSet of disabled adaptation types to ViewportConfiguration. Updates to the adaptation type are propagated to the ViewportConfiguration from Document, through the ChromeClient and the client layer (refer to changes in WebKit). Once the OptionSet is changed, we recompute the viewport configuration only if needed by the platform. (WebCore::ViewportConfiguration::viewLayoutSize const): (WebCore::ViewportConfiguration::disabledAdaptations const): * page/WindowFeatures.cpp: (WebCore::parseDisabledAdaptations): * page/WindowFeatures.h: Add a new helper to parse the meta content of a "disabled-adaptations" tag as an OptionSet of disabled adaptation types. The string is parsed by first splitting on the comma character, and then iterating over lower case, whitespace-stripped tokens to look for known adaptation names. So far, only extra zoom mode is supported. * testing/Internals.cpp: (WebCore::Internals::extraZoomModeAdaptationName const): * testing/Internals.h: * testing/Internals.idl: Expose the extra zoom mode adaptation name to the DOM, only when running layout tests. 2018-05-14 Joanmarie Diggs <jdiggs@igalia.com> AX: Listbox and Combobox roles embedded in labels should participate in name calculation https://bugs.webkit.org/show_bug.cgi?id=185521 Reviewed by Chris Fleizach. Take selected children into account when computing the name in accessibleNameForNode. Add ListBox to the roles for which accessibleNameDerivesFromContent returns false so that native select elements with size > 1 are treated the same way as ARIA listbox. Also add ListBox to the roles which are treated as controls when used in ARIA. Finally, prevent labels which contain unrelated controls from being used as an AXTitleUIElement. This causes us to build a string from the label and its descendants, ensuring the latter participate in the name calculation. Test: accessibility/text-alternative-calculation-from-listbox.html * accessibility/AccessibilityLabel.cpp: (WebCore::childrenContainUnrelatedControls): (WebCore::AccessibilityLabel::containsUnrelatedControls const): * accessibility/AccessibilityLabel.h: * accessibility/AccessibilityNodeObject.cpp: (WebCore::accessibleNameForNode): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const): (WebCore::AccessibilityObject::isARIAControl): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::exposesTitleUIElement const): (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): 2018-05-14 Antoine Quint <graouts@apple.com> [Web Animations] Tests using the new animation engine may crash under WebCore::FrameView::didDestroyRenderTree when using internals methods https://bugs.webkit.org/show_bug.cgi?id=185612 <rdar://problem/39579344> Reviewed by Dean Jackson. Add a new internals.pseudoElement() method to obtain a pseudo element matching a given pseudo-id. This is necessary to be able to move off internals.pauseTransitionAtTimeOnPseudoElement() and internals.pauseAnimationAtTimeOnPseudoElement() for Web Animations testing. * testing/Internals.cpp: (WebCore::Internals::pseudoElement): * testing/Internals.h: * testing/Internals.idl: 2018-05-14 Antoine Quint <graouts@apple.com> REGRESSION (r230574): Interrupted hardware transitions don't behave correctly https://bugs.webkit.org/show_bug.cgi?id=185299 <rdar://problem/39630230> Reviewed by Simon Fraser. In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a newly-uncommitted animation. Test: transitions/interrupted-transition-hardware.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation): 2018-05-14 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Fix style issue in MediaPlayerPrivateGStreamerBase https://bugs.webkit.org/show_bug.cgi?id=185510 Reviewed by Philippe Normand. ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:629: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:684: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:807: More than one command on the same line [whitespace/newline] [4] Indentation and style issue fixed only. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback): (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): 2018-05-14 Zalan Bujtas <zalan@apple.com> [LFC] Implement height computation for non-replaced out of flow elements. https://bugs.webkit.org/show_bug.cgi?id=185585 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const): (WebCore::Layout::FormattingContext::computeHeightForBlockFormattingContextRootWithAutoHeight const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.h: * layout/displaytree/DisplayBox.h: 2018-05-14 Manuel Rego Casasnovas <rego@igalia.com> Renaming of overrides in LayoutBox https://bugs.webkit.org/show_bug.cgi?id=185609 Reviewed by Javier Fernandez. The names of the methods for the overrides were not consistent, this patch fixes it by using the same structure in all the cases. No new tests, no change of behavior. * rendering/GridLayoutFunctions.cpp: (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild): * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::computeChildPreferredLogicalWidths const): (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::fitBorderToLinesIfNeeded): * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::updateRubyForJustifiedText): * rendering/RenderBox.cpp: (WebCore::RenderBox::willBeDestroyed): (WebCore::RenderBox::hasOverrideContentLogicalHeight const): (WebCore::RenderBox::hasOverrideContentLogicalWidth const): (WebCore::RenderBox::setOverrideContentLogicalHeight): (WebCore::RenderBox::setOverrideContentLogicalWidth): (WebCore::RenderBox::clearOverrideContentLogicalHeight): (WebCore::RenderBox::clearOverrideContentLogicalWidth): (WebCore::RenderBox::clearOverrideContentSize): (WebCore::RenderBox::overrideContentLogicalWidth const): (WebCore::RenderBox::overrideContentLogicalHeight const): (WebCore::RenderBox::overrideContainingBlockContentLogicalWidth const): (WebCore::RenderBox::overrideContainingBlockContentLogicalHeight const): (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalWidth const): (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalHeight const): (WebCore::RenderBox::setOverrideContainingBlockContentLogicalWidth): (WebCore::RenderBox::setOverrideContainingBlockContentLogicalHeight): (WebCore::RenderBox::clearOverrideContainingBlockContentSize): (WebCore::RenderBox::clearOverrideContainingBlockContentLogicalHeight): (WebCore::RenderBox::containingBlockLogicalWidthForContent const): (WebCore::RenderBox::containingBlockLogicalHeightForContent const): (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight const): (WebCore::RenderBox::computeLogicalWidthInFragment const): (WebCore::RenderBox::computeLogicalHeight const): (WebCore::RenderBox::computePercentageLogicalHeight const): (WebCore::RenderBox::computeReplacedLogicalHeightUsing const): (WebCore::RenderBox::availableLogicalHeightUsing const): (WebCore::RenderBox::containingBlockLogicalWidthForPositioned const): (WebCore::RenderBox::containingBlockLogicalHeightForPositioned const): * rendering/RenderBox.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const): * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::contentWidthForChild): (WebCore::contentHeightForChild): (WebCore::gatherFlexChildrenInfo): (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp): * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): (WebCore::RenderFlexibleBox::constructFlexItem): (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild): (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::unwrapRenderer): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::layoutBlock): (WebCore::RenderGrid::layoutGridItems): (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded): * rendering/RenderRubyBase.cpp: (WebCore::RenderRubyBase::adjustInlineDirectionLineBounds const): * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::setOverrideContentLogicalHeightFromRowHeight): * rendering/RenderTableCell.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::calcRowLogicalHeight): (WebCore::RenderTableSection::relayoutCellIfFlexed): 2018-05-14 Zalan Bujtas <zalan@apple.com> [LFC] Implement width computation for non-replaced out of flow elements. https://bugs.webkit.org/show_bug.cgi?id=185598 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const): (WebCore::Layout::FormattingContext::shrinkToFitWidth const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): * layout/displaytree/DisplayBox.h: 2018-05-14 Zan Dobersek <zdobersek@igalia.com> Drop the m_compositorTexture member variable in TextureMapperGC3DPlatformLayer. It's not used at all inside the class or outside it. Rubber-stamped by Michael Catanzaro. * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h: 2018-05-14 Zan Dobersek <zdobersek@igalia.com> [GTK] REGRESSION(r231170) Build broken with Clang 5.0 https://bugs.webkit.org/show_bug.cgi?id=185198 Reviewed by Michael Catanzaro. Avoid gperf files using the register keyword which has been made reserved and as such unusable in C++17. * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/makeSelectorPseudoElementsMap.py: * css/makeprop.pl: * css/makevalues.pl: * platform/ColorData.gperf: * platform/ReferrerPolicy.h: With std::optional forward declaration gone, explicitly include the WTF Optional.h header. * platform/Theme.h: Ditto. * platform/network/create-http-header-name-table: 2018-05-14 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r219515. https://bugs.webkit.org/show_bug.cgi?id=185603 It sometimes makes AudioUnitInitialize call to fail in CoreAudioCaptureSource (Requested by youenn on #webkit). Reverted changeset: "Remove CoreAudioCaptureSource speaker configuration" https://bugs.webkit.org/show_bug.cgi?id=174512 https://trac.webkit.org/changeset/219515 2018-05-13 Dirk Schulze <krit@webkit.org> Implement SVGGeometryElement's isPointInFill and isPointInStroke https://bugs.webkit.org/show_bug.cgi?id=185580 Reviewed by Antti Koivisto. Implement isPointInFill and isPointInStroke methods for SVGGeometryElement interface from SVG2. https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement Tests: svg/dom/SVGGeometry-isPointInFill.xhtml svg/dom/SVGGeometry-isPointInStroke.xhtml * rendering/svg/RenderSVGEllipse.cpp: (WebCore::RenderSVGEllipse::shapeDependentStrokeContains): Flag to switch between local and "global" coordinate space for hit testing. * rendering/svg/RenderSVGEllipse.h: * rendering/svg/RenderSVGPath.cpp: (WebCore::RenderSVGPath::shapeDependentStrokeContains): Flag to switch between local and "global" coordinate space for hit testing. * rendering/svg/RenderSVGPath.h: * rendering/svg/RenderSVGRect.cpp: (WebCore::RenderSVGRect::shapeDependentStrokeContains): Flag to switch between local and "global" coordinate space for hit testing. * rendering/svg/RenderSVGRect.h: * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::shapeDependentStrokeContains): Flag to switch between local and "global" coordinate space for hit testing. (WebCore::RenderSVGShape::isPointInFill): Take the winding rule given by `fill-rule` to test if a given point is in the fill area of a path. (WebCore::RenderSVGShape::isPointInStroke): Take stroke properties into account to check if a point is on top of the stroke area. * rendering/svg/RenderSVGShape.h: * svg/SVGGeometryElement.cpp: (WebCore::SVGGeometryElement::isPointInFill): (WebCore::SVGGeometryElement::isPointInStroke): (WebCore::SVGGeometryElement::createElementRenderer): Deleted. This is getting implemented by inheriting classes. No need to create RenderSVGPath here. * svg/SVGGeometryElement.h: * svg/SVGGeometryElement.idl: 2018-05-12 Zalan Bujtas <zalan@apple.com> Use WeakPtr for m_enclosingPaginationLayer in RenderLayer https://bugs.webkit.org/show_bug.cgi?id=185566 <rdar://problem/36486052> Reviewed by Simon Fraser. Since RenderLayer does not own the enclosing pagination layout, it should construct a weak pointer instead of holding on to a raw pointer. Unable to create a reliably reproducible test case. * page/mac/EventHandlerMac.mm: (WebCore::scrollableAreaForEventTarget): (WebCore::scrollableAreaForContainerNode): (WebCore::EventHandler::platformPrepareForWheelEvents): * platform/ScrollableArea.h: (WebCore::ScrollableArea::weakPtrFactory const): (WebCore::ScrollableArea::createWeakPtr): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::updatePagination): * rendering/RenderLayer.h: 2018-05-11 Daniel Bates <dabates@apple.com> X-Frame-Options: SAMEORIGIN needs to check all ancestor frames https://bugs.webkit.org/show_bug.cgi?id=185567 <rdar://problem/40175008> Reviewed by Brent Fulgham. Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames are same-origin with the document that delivered this header. This prevents an intermediary malicious frame from clickjacking a child frame whose document is same-origin with the top- level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match the behavior of X-Frame-Options in other browsers, including Chrome and Firefox. Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin with the top-level frame's document in order to be displayed. This prevents clickjacking by a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However, it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim) if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a document same origin with the victim page. We should protect against such attacks. Tests: http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-allow.html http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-deny.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions): 2018-05-11 Daniel Bates <dabates@apple.com> [iOS] Text decoration of dragged content does not paint with opacity https://bugs.webkit.org/show_bug.cgi?id=185551 <rdar://problem/40166867> Reviewed by Wenson Hsieh. Respect alpha when painting the text decoration for dragged content. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::MarkedTextStyle::areDecorationMarkedTextStylesEqual): Consider alpha when comparing decoration styles for equality so that we do not coalesce styles with differing alpha. (WebCore::InlineTextBox::paintMarkedTextDecoration): Respect alpha when painting dragged content. 2018-05-11 Nan Wang <n_wang@apple.com> AX: In role=dialog elements with aria-modal=true VoiceOver iOS/macOS can't manually focus or read dialog paragraph description text inside the modal. https://bugs.webkit.org/show_bug.cgi?id=185219 <rdar://problem/39920009> Reviewed by Chris Fleizach. The text node descendants of a modal dialog are ignored. Fixed it by using AccessibilityObject's node() to determine if it's the descendant of the modal dialog node. Test: accessibility/aria-modal-text-descendants.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isModalDescendant const): 2018-05-11 Ryosuke Niwa <rniwa@webkit.org> Tapping after CSS-based table casues an infinite loop in wordRangeFromPosition https://bugs.webkit.org/show_bug.cgi?id=185465 <rdar://problem/35263057> Reviewed by Antti Koivisto. The bug was caused by TextIterator not emitting a line break when exiting a CSS-based table when an element with `display: table-row` has an invisible text node. Specifically, TextIterator::exitNode is never called on an element with `table-cell: row` when m_node is a text node with whitespaces which appears after an element with `display: table-cell`. For example, for a tree structure like: table-row (R) table-cell (C) "text" (1) " " (2) Getting out of (C) would result in moving onto (2) without generating a line break for (R). When this happens in nextBoundary as it tries to find the end of the last word in the table cell, we end up finding the end of the document as the end of the word. As a result, nextWordBoundaryInDirection, the caller of nextBoundary, ends up infinite looping between the positon at the end of the document and the position immediately before the last word in the last table cell when it traverses words backwards. This patch fixes the hang by addressing this root cause in TextIterator. Namely, TextIterator now generates a line break when exiting a block while walking up ancestors in TextIterator::advance(). Tests: editing/selection/tapping-in-table-at-end-of-document.html editing/text-iterator/table-at-end-of-document.html * editing/TextIterator.cpp: (WebCore::TextIterator::advance): Fixed the bug. (WebCore::shouldEmitNewlineAfterNode): Do generate a new line at the end of a document when we're trying to generate every visible poitions even there are no renderers beyond this point. e.g. a position inside the last cell of a table at the end of a document hits this condition. (WebCore::shouldEmitExtraNewlineForNode): Don't emit a line break when the render box's height is 0px to avoid generating many empty lines for empty paragraph and header elements (this function is used to generate a blank line between p's and h1/h2/...'s). (WebCore::TextIterator::exitNode): 2018-05-11 Dean Jackson <dino@apple.com> System preview badge doesn't show on <picture> elements https://bugs.webkit.org/show_bug.cgi?id=185559 <rdar://problem/40150066> Reviewed by Tim Horton. We should also identify <img>s that are the child of a <picture> contained inside the appropriate <a> element. Tested internally, since the badge is platform specific. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::isSystemPreviewImage const): Add logic to look for <picture> parents. 2018-05-11 Chris Dumez <cdumez@apple.com> REGRESSION (async policy delegate): Revoking an object URL immediately after triggering download breaks file download https://bugs.webkit.org/show_bug.cgi?id=185531 <rdar://problem/39909589> Reviewed by Geoffrey Garen. Whenever we start an asynchronous navigation policy decision for a blob URL, create a temporary blob URL pointing to the same data, and update the request's URL. This way, if the page's JS revokes the URL during the policy decision, the load will still succeed. Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadPostRequest): * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::extendBlobURLLifetimeIfNecessary const): (WebCore::PolicyChecker::checkNavigationPolicy): (WebCore::PolicyChecker::checkNewWindowPolicy): * loader/PolicyChecker.h: 2018-05-11 Antti Koivisto <antti@apple.com> LinkLoader fails to remove CachedResourceClient in some cases https://bugs.webkit.org/show_bug.cgi?id=185553 <rdar://problem/36879656> Reviewed by Geoffrey Garen. Test: http/tests/preload/link-preload-client-remove.html * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLink): If there is a link preload already in progress, we fail to clear the client for the ongoing load. This may leave the CachedResource client map in a bad state. 2018-05-11 Charles Vazac <cvazac@gmail.com> Runtime feature flag for Server-Timing https://bugs.webkit.org/show_bug.cgi?id=184758 Reviewed by Youenn Fablet. * Source/WebCore/CMakeLists.txt: Added reference to PerformanceServerTiming.idl. * Source/WebCore/DerivedSources.make: Added reference to PerformanceServerTiming.idl. * Source/WebCore/Sources.txt: Added reference to PerformanceServerTiming.cpp and JSPerformanceServerTiming.cpp. * Source/WebCore/WebCore.xcodeproj/project.pbxproj: Added references to PerformanceServerTiming.cpp, PerformanceServerTiming.h, and PerformanceServerTiming.idl. * Source/WebCore/bindings/js/WebCoreBuiltinNames.h: Added PerformanceServerTiming. * Source/WebCore/page/PerformanceResourceTiming.h: Added serverTiming member. * Source/WebCore/page/PerformanceResourceTiming.idl: Added serverTiming attribute. * Source/WebCore/page/PerformanceServerTiming.cpp: Added. * Source/WebCore/page/PerformanceServerTiming.h: Added. * Source/WebCore/page/PerformanceServerTiming.idl: Added. 2018-05-11 Brady Eidson <beidson@apple.com> Make sure history navigations reuse the existing process when necessary. <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532 Reviewed by Ryosuke Niwa. Covered by new API tests. In WebCore-land, make sure *all* NavigationActions to a back/forward item are tagged with the item identifier. * history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem): (WebCore::HistoryItem::logString const): * history/HistoryItem.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/NavigationAction.cpp: (WebCore::NavigationAction::setTargetBackForwardItem): * loader/NavigationAction.h: (WebCore::NavigationAction::targetBackForwardItemIdentifier const): 2018-05-11 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Handle the protection event in MediaPlayerPrivate https://bugs.webkit.org/show_bug.cgi?id=185535 Reviewed by Xabier Rodriguez-Calvar. This patch is based on this calvaris's commit https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d966168b0d2b65f9ca9415426e26d3752c78b03e It adds a handler for the protection event in MediaPalyerPrivateGStreamerBase, it extracts the InitData from the event and sends the encrypted event to JS via HTMLMediaElement. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Add a new type InitData. 2018-05-11 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Make the cipher suites, the signing algorithms and the curve lists configurable. https://bugs.webkit.org/show_bug.cgi?id=185139 Add interface to configure the cipher suites, the signing algorithms and the curve lists used by OpenSSL and libcurl to exchange, to sign or to verify keys. Reviewed by Youenn Fablet. No new tests in public. Have tested internally. * platform/network/curl/CurlContext.cpp: (WebCore::CurlHandle::setSslCipherList): * platform/network/curl/CurlContext.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupTransfer): (WebCore::CurlRequest::willSetupSslCtx): * platform/network/curl/CurlSSLHandle.cpp: (WebCore::CurlSSLHandle::getCACertPathEnv): * platform/network/curl/CurlSSLHandle.h: (WebCore::CurlSSLHandle::getCipherList const): (WebCore::CurlSSLHandle::getSignatureAlgorithmsList const): (WebCore::CurlSSLHandle::getCurvesList const): (WebCore::CurlSSLHandle::setCipherList): (WebCore::CurlSSLHandle::setSignatureAlgorithmsList): (WebCore::CurlSSLHandle::setCurvesList): (WebCore::CurlSSLHandle::getCACertPath const): (WebCore::CurlSSLHandle::setCACertPath): * platform/network/curl/CurlSSLVerifier.cpp: (WebCore::CurlSSLVerifier::CurlSSLVerifier): 2018-05-10 Daniel Bates <dabates@apple.com> Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options https://bugs.webkit.org/show_bug.cgi?id=185412 Reviewed by Ryosuke Niwa. Consolidate the knowledge on how to determine whether security checks were performed on a ResourceResponse into LoaderStrategy::havePerformedSecurityChecks() (default implementation returns false) and query it to determine whether CSP frame-ancestors and X-Frame-Options need to be checked for a ResourceResponse. Additionally, rename LoaderStrategy::isDoingLoadingSecurityChecks() to shouldPerformSecurityChecks() for consistency with havePerformedSecurityChecks(). Querying shouldPerformSecurityChecks() answers the question of whether the loader strategy is responsible for performing security checks when building up a ResourceRequest to have the loader strategy load. And LoaderStrategy::havePerformedSecurityChecks() is used to determine whether the loader strategy performed these security checks for a given ResourceResponse. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didReceiveResponse): (WebCore::InspectorNetworkAgent::didFinishLoading): (WebCore::isResponseProbablyComingFromNetworkProcess): Deleted. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): * loader/DocumentThreadableLoader.cpp: (WebCore::shouldPerformSecurityChecks): (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const): (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest): (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): (WebCore::DocumentThreadableLoader::redirectReceived): (WebCore::DocumentThreadableLoader::didFail): (WebCore::DocumentThreadableLoader::loadRequest): (WebCore::isDoingSecurityChecksInNetworkProcess): Deleted. (WebCore::isResponseComingFromNetworkProcess): Deleted. * loader/LoaderStrategy.cpp: * loader/LoaderStrategy.h: * page/Settings.yaml: Remove setting networkProcessCSPFrameAncestorsCheckingEnabled as we now make use of the loader strategy to determine whether to perform CSP frame-ancestors and X-Frame-Options checking in DocumentLoader. * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::setSource): Added an ASSERT to catch the programming error of setting source to ResourceResponse::Source::Unknown. This source type represents an uninitialized ResourceResponse. 2018-05-10 Tim Horton <timothy_horton@apple.com> Lookup sometimes shows a second yellow highlight on top of WebKit's TextIndicator https://bugs.webkit.org/show_bug.cgi?id=185538 <rdar://problem/38817825> Reviewed by Sam Weinig. * editing/mac/DictionaryLookup.mm: (WebCore::showPopupOrCreateAnimationController): Options can be nil, in which case we can't mutableCopy it and add LUTermOptionDisableSearchTermIndicator. Instead, create a new dictionary, and add the items from options, if it's not nil. 2018-05-10 Matt Baker <mattbaker@apple.com> Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener https://bugs.webkit.org/show_bug.cgi?id=181580 <rdar://problem/36461309> Reviewed by Brian Burg. EventTarget should pass newly added EventListeners to InspectorInstrumentation, instead of PageDebuggerAgent assuming the last item in the EventListenerVector is the most recently added listener. This assumption does not hold when the new listener replaces an existing listener. * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::setAttributeEventListener): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didAddEventListenerImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didAddEventListener): * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::didAddEventListener): * inspector/agents/page/PageDebuggerAgent.h: 2018-05-10 Chris Dumez <cdumez@apple.com> 'Cross-Origin-Options header implementation follow-up https://bugs.webkit.org/show_bug.cgi?id=185520 Reviewed by Ryosuke Niwa. * dom/Document.cpp: * dom/Document.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::didBeginDocument): Using isNull() check is sufficient here as the header parsing function will do the right thing when passed the empty string. Also set the options directly on the window instead of the document. The window is guaranteed to have been constructed by then because didBeginDocument() is called DocumentWriter::begin() which calls Document::createDOMWindow() or Document::takeDOMWindowFrom(). * page/AbstractDOMWindow.cpp: (WebCore::AbstractDOMWindow::AbstractDOMWindow): * page/AbstractDOMWindow.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::DOMWindow): (WebCore::DOMWindow::didSecureTransitionTo): * page/RemoteDOMWindow.cpp: (WebCore::RemoteDOMWindow::RemoteDOMWindow): * page/RemoteDOMWindow.h: CrossOriginOptions are now stored only on the Window, not the Document. * platform/network/HTTPParsers.cpp: (WebCore::parseCrossOriginOptionsHeader): Drop strippedHeader local variable as it is not strictly needed. 2018-05-10 Tim Horton <timothy_horton@apple.com> Fix the build after r231393 https://bugs.webkit.org/show_bug.cgi?id=185519 <rdar://problem/40131741> Reviewed by Simon Fraser. * Configurations/WebCore.xcconfig: 2018-05-10 Eric Carlson <eric.carlson@apple.com> Log missing cues correctly https://bugs.webkit.org/show_bug.cgi?id=185499 <rdar://problem/40113821> Reviewed by Daniel Bates. No new tests, tested manually. * html/track/InbandGenericTextTrack.cpp: (WebCore::InbandGenericTextTrack::removeGenericCue): Log the cue we searched for, not the NULL cue. 2018-05-10 Zalan Bujtas <zalan@apple.com> [LFC] Implement height computation for non-replaced inflow elements. https://bugs.webkit.org/show_bug.cgi?id=185474 Reviewed by Antti Koivisto. Initial implementation. Does not cover all the cases. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeHeight const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedHeight const): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::collapsedMarginBottomFromLastChild): (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent): (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom): (WebCore::Layout::isMarginBottomCollapsedWithParent): Deleted. * layout/blockformatting/BlockMarginCollapse.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const): * layout/inlineformatting/InlineFormattingContext.h: * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::isReplaced const): * layout/layouttree/LayoutBox.h: 2018-05-10 Thibault Saunier <tsaunier@igalia.com> [GTK] Implement ImageBuffer::toBGRAData https://bugs.webkit.org/show_bug.cgi?id=185511 Reviewed by Michael Catanzaro. This was never implemented but will be required for the MediaStream API tests. * platform/graphics/ImageBuffer.cpp: (WebCore::ImageBuffer::toBGRAData const): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::toBGRAData const): * platform/graphics/gtk/ImageBufferGtk.cpp: (WebCore::ImageBuffer::toBGRAData const): 2018-05-10 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Add a handler for GStreamer protection event https://bugs.webkit.org/show_bug.cgi?id=185245 Reviewed by Xabier Rodriguez-Calvar. Qtdemux sends the protection event when encountered a new PSSH box (encrypted content). The Decryptor is moved from AppendPipeline to PlaybackPipeline (see https://bugs.webkit.org/show_bug.cgi?id=181855), thus the protection event is no longer handled because the Decryptor is not in the same pipeline as qtdemux. AppendPipeline: httpsrc-->qtdemux-->appsink PlaybackPipeline: appsrc-->parser--> decryptor-->decoder-->sink This patch attaches a probe to the sink pad of the appsink in the appendPipeline in order to catch and manage the protection event. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::~AppendPipeline): (WebCore::appendPipelineAppsinkPadEventProbe): * platform/graphics/gstreamer/mse/AppendPipeline.h: (WebCore::AppendPipeline::playerPrivate): 2018-05-10 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline. https://bugs.webkit.org/show_bug.cgi?id=181855 Reviewed by Xabier Rodriguez-Calvar. The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size. When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue the decrypted GstBuffers that are in SVP memory. This behavior cause an out-of-memory error, because we are limited in SVP memory size. By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory. This new architecture also allows to start the buffering before obtaining the DRM license and it makes easier to manage dynamic change of the license or Key. The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline. SVP: Secure Video Path also named trusted or protected video path, it is a memory which is protected by a hardware access control engine, it is not accessible to other unauthorised software or hardware components. Tests: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: (webkitMediaCommonEncryptionDecryptSinkEventHandler): * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::dumpAppendState): (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::handleNeedContextSyncMessage): (WebCore::AppendPipeline::handleAppsrcNeedDataReceived): (WebCore::AppendPipeline::setAppendState): (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): (WebCore::AppendPipeline::appsinkNewSample): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread): (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread): (WebCore::appendPipelineElementMessageCallback): Deleted. (WebCore::AppendPipeline::handleElementMessage): Deleted. (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted. (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted. * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance): * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: 2018-05-09 Nan Wang <n_wang@apple.com> AX: VoiceOver iframe scrolling focus jumping bug https://bugs.webkit.org/show_bug.cgi?id=176615 <rdar://problem/34333067> Reviewed by Chris Fleizach. Scrolling to make elements visible is not working correctly for elements inside an offscreen iframe. Fixed it by using RenderLayer::scrollRectToVisible() to handle scrolling more properly. Test: accessibility/scroll-to-make-visible-iframe-offscreen.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::scrollToMakeVisible const): 2018-05-09 Joanmarie Diggs <jdiggs@igalia.com> AX: accessibleNameForNode should simplify whitespace when using innerText https://bugs.webkit.org/show_bug.cgi?id=185498 Reviewed by Chris Fleizach. Test: accessibility/text-alternative-calculation-from-unrendered-table.html Call simplifyWhiteSpace() before returning the innerText value. * accessibility/AccessibilityNodeObject.cpp: (WebCore::accessibleNameForNode): 2018-05-09 Chris Dumez <cdumez@apple.com> Add initial support for 'Cross-Origin-Options' HTTP response header https://bugs.webkit.org/show_bug.cgi?id=184996 <rdar://problem/39664620> Reviewed by Geoff Garen. Add initial support for 'Cross-Origin-Options' HTTP response header behind an experimental feature flag, on by default. When the HTTP server services this HTTP response header for a main resource, we'll set these options on the corresponding Document. This will impact the behavior of the Document's associated Window API when cross-origin. The HTTP header has 3 possible values: - allow: This is the default. Regular cross-origin Window API is available. - allow-postmessage: Only postMessage() is available on a cross-origin window, trying to access anything else will throw a SecurityError. - deny: Trying to do anything with a cross-origin window will throw a SecurityError. The header has no effect when accessing same origin windows. Note that on cross-origin access from Window A to Window B, we check the cross-origin options for both Window A and Window B and use the lowest common denominator as effective cross-origin options for the access. So if Window A has 'Cross-Origin-Options: deny' and tries to call postMessage() on Window B which has 'Cross-Origin-Options: allow-postmessage', we will throw a SecurityError. This is because Window A's more restrictive options (deny) apply. Tests: http/wpt/cross-origin-options/allow-postmessage-from-deny.html http/wpt/cross-origin-options/allow-postmessage.html http/wpt/cross-origin-options/cross-origin-options-header.html * bindings/js/JSDOMBindingSecurity.cpp: (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions): * bindings/js/JSDOMBindingSecurity.h: * bindings/js/JSDOMWindowCustom.cpp: (WebCore::effectiveCrossOriginOptionsForAccess): (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): (WebCore::JSDOMWindow::getOwnPropertySlot): (WebCore::JSDOMWindow::getOwnPropertySlotByIndex): (WebCore::addCrossOriginWindowPropertyNames): (WebCore::addScopedChildrenIndexes): (WebCore::addCrossOriginWindowOwnPropertyNames): (WebCore::JSDOMWindow::getOwnPropertyNames): * bindings/js/JSDOMWindowCustom.h: * bindings/js/JSRemoteDOMWindowCustom.cpp: (WebCore::JSRemoteDOMWindow::getOwnPropertySlot): (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex): (WebCore::JSRemoteDOMWindow::getOwnPropertyNames): * bindings/scripts/CodeGeneratorJS.pm: (GenerateAttributeGetterBodyDefinition): (GetCrossOriginsOptionsFromExtendedAttributeValue): (GenerateAttributeSetterBodyDefinition): (GenerateOperationBodyDefinition): * bindings/scripts/IDLAttributes.json: * dom/Document.cpp: (WebCore::Document::setCrossOriginOptions): * dom/Document.h: (WebCore::Document::crossOriginOptions const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::didBeginDocument): * page/AbstractDOMWindow.cpp: (WebCore::AbstractDOMWindow::AbstractDOMWindow): * page/AbstractDOMWindow.h: (WebCore::AbstractDOMWindow::crossOriginOptions): (WebCore::AbstractDOMWindow::setCrossOriginOptions): * page/DOMWindow.cpp: (WebCore::DOMWindow::DOMWindow): (WebCore::DOMWindow::didSecureTransitionTo): * page/DOMWindow.idl: * page/Frame.h: * page/RemoteDOMWindow.cpp: (WebCore::RemoteDOMWindow::RemoteDOMWindow): * page/RemoteDOMWindow.h: * page/Settings.yaml: * platform/network/HTTPHeaderNames.in: * platform/network/HTTPParsers.cpp: (WebCore::parseCrossOriginOptionsHeader): * platform/network/HTTPParsers.h: 2018-05-09 Ryosuke Niwa <rniwa@webkit.org> Release assert in TreeScopeOrderedMap::remove via HTMLImageElement::removedFromAncestor https://bugs.webkit.org/show_bug.cgi?id=185493 Reviewed by Brent Fulgham. Fixed the bug that HTMLImageElement::removedFromAncestor and HTMLMapElement::removedFromAncestor were calling removeImageElementByUsemap on the document instead of the shadow tree from which it was removed. Test: fast/images/imagemap-in-shadow-tree-removed.html * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::removedFromAncestor): * html/HTMLMapElement.cpp: (WebCore::HTMLMapElement::removedFromAncestor): 2018-05-09 Joanmarie Diggs <jdiggs@igalia.com> AX: Hidden nodes which are not directly referenced should not participate name/description from content https://bugs.webkit.org/show_bug.cgi?id=185478 Reviewed by Chris Fleizach. Add a check to AccessibilityNodeObject::textUnderElement() and return early if the node is hidden, not referenced by aria-labelledby or aria-describedby, not an HTMLLabelElement, and not fallback content for an HTMLCanvasElement. Test: accessibility/text-alternative-calculation-hidden-nodes.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::textUnderElement const): 2018-05-09 Eric Carlson <eric.carlson@apple.com> Update MediaSession to use release logging https://bugs.webkit.org/show_bug.cgi?id=185376 <rdar://problem/40022203> Reviewed by Youenn Fablet. No new tests, tested manually. * Modules/mediastream/MediaStream.h: hostingDocument() doesn't need to return a const Document. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::hostingDocument const): Ditto. * Modules/webaudio/AudioContext.h: * html/HTMLMediaElement.h: Ditto. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::MediaElementSession): (WebCore::MediaElementSession::addBehaviorRestriction): (WebCore::MediaElementSession::removeBehaviorRestriction): (WebCore::MediaElementSession::dataLoadingPermitted const): (WebCore::MediaElementSession::fullscreenPermitted const): (WebCore::MediaElementSession::pageAllowsDataLoading const): (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const): (WebCore::MediaElementSession::canShowControlsManager const): (WebCore::MediaElementSession::showPlaybackTargetPicker): (WebCore::MediaElementSession::hasWirelessPlaybackTargets const): (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const): (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled): (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners): (WebCore::MediaElementSession::externalOutputDeviceAvailableDidChange): (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget): (WebCore::MediaElementSession::mediaEngineUpdated): (WebCore::MediaElementSession::willLog const): Deleted. (WebCore::MediaElementSession::logger const): Deleted. (WebCore::MediaElementSession::logIdentifier const): Deleted. (WebCore::MediaElementSession::logChannel const): Deleted. * html/MediaElementSession.h: * platform/audio/PlatformMediaSession.cpp: (WebCore::nextLogIdentifier): (WebCore::convertEnumerationToString): (WebCore::PlatformMediaSession::PlatformMediaSession): (WebCore::PlatformMediaSession::setState): (WebCore::PlatformMediaSession::beginInterruption): (WebCore::PlatformMediaSession::endInterruption): (WebCore::PlatformMediaSession::clientWillBeginAutoplaying): (WebCore::PlatformMediaSession::clientWillPausePlayback): (WebCore::PlatformMediaSession::pauseSession): (WebCore::PlatformMediaSession::stopSession): (WebCore::PlatformMediaSession::clientDataBufferingTimerFired): (WebCore::PlatformMediaSession::logChannel const): (WebCore::stateName): Deleted. (WebCore::interruptionName): Deleted. * platform/audio/PlatformMediaSession.h: (WTF::LogArgument<WebCore::PlatformMediaSession::State>::toString): (WTF::LogArgument<WebCore::PlatformMediaSession::InterruptionType>::toString): 2018-05-09 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Never call updateTracks if running on legacy pipeline https://bugs.webkit.org/show_bug.cgi?id=184581 This makes sure failling code path is never reached in the conditions where it should not have been reached. Reviewed by Philippe Normand. Re enables all tests that were disabled after fixing. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): 2018-05-09 Daniel Bates <dabates@apple.com> REGRESSION (r231479): http/tests/appcache/x-frame-options-prevents-framing.php is timing out https://bugs.webkit.org/show_bug.cgi?id=185443 <rdar://problem/40100660> Reviewed by Andy Estes. Following r231479 when using WebKit2 and Restricted HTTP Response Access is enabled (enabled in WebKitTestRunner) we only check the CSP frame-ancestors directive and X-Frame-Options in NetworkProcess. We need to check these security requirements in WebContent process whenever we are performing a substitute data load, such as for app cache, as these loads do not go through NetworkProcess. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): 2018-05-09 Justin Fan <justin_fan@apple.com> Hooked up ASTC support in WebGL; requires OpenGL ES 3 context to work. https://bugs.webkit.org/show_bug.cgi?id=185272 <rdar://problem/15745737> Reviewed by Dean Jackson. Also added in Khronos' ASTC test from version 1.0.4 beta of their conformance test suite, although again, this requires OpenGL ES 3 context for WebKit to detect proper support. Test: fast/canvas/webgl/webgl-compressed-texture-astc.html * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getExtension): (WebCore::WebGL2RenderingContext::getSupportedExtensions): * html/canvas/WebGLCompressedTextureASTC.cpp: Added. (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC): (WebCore::WebGLCompressedTextureASTC::getName const): (WebCore::WebGLCompressedTextureASTC::supported): (WebCore::WebGLCompressedTextureASTC::getSupportedProfiles): * html/canvas/WebGLCompressedTextureASTC.h: Added. * html/canvas/WebGLCompressedTextureASTC.idl: Added. * html/canvas/WebGLExtension.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData): (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/Extensions3D.h: 2018-05-09 Youenn Fablet <youenn@apple.com> Allow WebResourceLoader to cancel a load served from a service worker https://bugs.webkit.org/show_bug.cgi?id=185274 Reviewed by Chris Dumez. Add support for cancelling a fetch from WebProcess to service worker process. Use FetchIdentifier instead of uint64_t. * Modules/fetch/FetchIdentifier.h: Added. * WebCore.xcodeproj/project.pbxproj: * workers/service/context/ServiceWorkerFetch.h: * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::startFetch): (WebCore::ServiceWorkerThreadProxy::cancelFetch): * workers/service/context/ServiceWorkerThreadProxy.h: 2018-05-09 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Fix style issue in MediaPlayerPrivateGStreamer https://bugs.webkit.org/show_bug.cgi?id=185479 Reviewed by Philippe Normand. ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:114: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:194: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:398: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:440: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:806: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:869: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:880: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:940: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1102: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1109: Multi line control clauses should use braces. [whitespace/braces] [4] Indentation and style issue fixed only. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine): (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): (WebCore::MediaPlayerPrivateGStreamer::changePipelineState): (WebCore::MediaPlayerPrivateGStreamer::play): (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback): (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback): (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback): (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback): (WebCore::MediaPlayerPrivateGStreamer::buffered const): (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation): 2018-05-09 Daniel Bates <dabates@apple.com> REGRESSION (r231479): com.apple.WebCore crash in WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() https://bugs.webkit.org/show_bug.cgi?id=185475 <rdar://problem/40093853> Reviewed by Andy Estes. DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() must extends its lifetime until completion as dispatching a DOM load event at the associated frame can cause JavaScript execution that can do anything, including destroying the loader that dispatched the event. Following r231479 DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() is now invoked by both DocumentLoader::responseReceived() and WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied(). The latter only can happen when using WebKit2 and the experimental feature Restricted HTTP Response Access is enabled (RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()). Unlike DocumentLoader::responseReceived() WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() does not take out a ref on the DocumentLoader before invoking DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied(). Therefore, DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() can cause its own destruction as a result of dispatching a DOM load event at the frame. We should take out a ref on the DocumentLoader when executing DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied(). * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): 2018-05-09 Tim Horton <timothy_horton@apple.com> Fix the build by ignoring some deprecation warnings * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): 2018-05-09 Michael Catanzaro <mcatanzaro@igalia.com> [WPE] Build cleanly with GCC 8 and ICU 60 https://bugs.webkit.org/show_bug.cgi?id=185462 Reviewed by Carlos Alberto Lopez Perez. * PlatformGTK.cmake: Include directories are in the wrong place. * accessibility/AXObjectCache.cpp: Silence -Wclass-memaccess problems and leave warnings. (WebCore::AXObjectCache::startOrEndTextMarkerDataForRange): (WebCore::AXObjectCache::textMarkerDataForCharacterOffset): (WebCore::AXObjectCache::textMarkerDataForVisiblePosition): (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl): * css/CSSFontFace.cpp: Silence -Wfallthrough (WebCore::CSSFontFace::fontLoadTiming const): * css/CSSSelectorList.cpp: Silence -Wclass-memaccess, this one is intentional. (WebCore::CSSSelectorList::adoptSelectorVector): * editing/TextIterator.cpp: Silence ICU deprecation warnings. * platform/Length.h: (WebCore::Length::operator=): More -Wclass-memaccess, looks benign. * platform/graphics/Gradient.cpp: (WebCore::Gradient::hash const): -Wclass-memaccess again. Leave a warning. * platform/graphics/SurrogatePairAwareTextIterator.cpp: Silence ICU deprecation warnings. * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: (WebCore::FontCascade::fontForCombiningCharacterSequence const): Silence ICU deprecation. * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: (WebCore::FontCustomPlatformData::FontCustomPlatformData): Silence -Wcast-function-type. * platform/graphics/freetype/SimpleFontDataFreeType.cpp: (WebCore::Font::canRenderCombiningCharacterSequence const): Silence ICU deprecation. * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: (gstAllocatorFastMallocMemUnmap): Fix -Wcast-function-type. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Fix bad printf. (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Another bad printf. (WebCore::findHLSQueue): Fix -Wcast-function-type. * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: (webKitMediaClearKeyDecryptorDecrypt): Fix another bad printf. * platform/network/soup/SocketStreamHandleImplSoup.cpp: Silence -Wcast-function-type. (WebCore::SocketStreamHandleImpl::beginWaitingForSocketWritability): * platform/text/TextEncoding.cpp: Silence ICU deprecration. 2018-05-08 Simon Fraser <simon.fraser@apple.com> SVG lighting colors need to be converted into linearSRGB https://bugs.webkit.org/show_bug.cgi?id=181196 Reviewed by Darin Adler. Address post-commit comments. Don't make a Color that contains linearRGB components, but use FloatComponents instead. Since these FloatComponents are in the 0-1 range, FELighting::setPixelInternal() needs to multiply by 255 since the output pixels are 8-bit 0-255. Change linearToSRGBColorComponent() and sRGBToLinearColorComponent() to do math in floats without promoting to doubles. * platform/graphics/ColorUtilities.cpp: (WebCore::FloatComponents::FloatComponents): (WebCore::linearToSRGBColorComponent): (WebCore::sRGBToLinearColorComponent): (WebCore::sRGBColorToLinearComponents): (WebCore::linearToSRGBColor): Deleted. (WebCore::sRGBToLinearColor): Deleted. * platform/graphics/ColorUtilities.h: * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::setPixelInternal): (WebCore::FELighting::drawLighting): 2018-05-09 Timothy Hatcher <timothy@apple.com> Use StyleColor::Options in more places. https://bugs.webkit.org/show_bug.cgi?id=185458 rdar://problem/39853798 Add UseDefaultAppearance to StyleColor::Options, to avoid passing yet another boolean on some of these functions. Reviewed by Tim Horton. * css/MediaQueryEvaluator.cpp: * css/StyleColor.h: * dom/Document.cpp: (WebCore::Document::useDefaultAppearance const): (WebCore::Document::styleColorOptions const): * dom/Document.h: * platform/Theme.cpp: (WebCore::Theme::paint): * platform/Theme.h: * platform/mac/LocalDefaultSystemAppearance.h: * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (WebCore::paintToggleButton): (WebCore::paintButton): (WebCore::ThemeMac::ensuredView): (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): (WebCore::ThemeMac::paint): (-[WebCoreThemeView initWithUseSystemAppearance:]): Deleted. * platform/wpe/ThemeWPE.cpp: (WebCore::ThemeWPE::paint): * platform/wpe/ThemeWPE.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItemBackground): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const): (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const): * rendering/RenderTheme.h: * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor const): * rendering/RenderThemeGtk.h: * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::documentViewFor const): (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const): (WebCore::RenderThemeMac::systemColor const): (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): (WebCore::RenderThemeMac::paintSliderThumb): 2018-05-09 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Crash when the mediaKeys are created before loading the media in debug conf https://bugs.webkit.org/show_bug.cgi?id=185244 Reviewed by Xabier Rodriguez-Calvar. The function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" is expected to be called once, so there is an ASSERT(!m_cdmInstance). But when the MediaKeys are created before loading the media, the cdminstance is created and attached to the MediaPlayerPrivate via "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" before loading the media, then when the media is loading, the function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" will be called several times via the function "mediaEngineWasUpdated" wich is called for each change in the MediaElement state, thus the WebProcess crashes in the ASSERT(!m_cdmInstance). This commit avoid the crash by replacing the assert with a simple check. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached): (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached): 2018-05-09 Antti Koivisto <antti@apple.com> Add OptionSet::operator& and operator bool https://bugs.webkit.org/show_bug.cgi?id=185306 Reviewed by Anders Carlsson. Use it in a few places. * loader/FrameLoader.cpp: (WebCore::FrameLoader::reload): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logReasonsForCompositing): (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): 2018-05-08 Dean Jackson <dino@apple.com> Disable system preview link fetching https://bugs.webkit.org/show_bug.cgi?id=185463 Reviewed by Jon Lee. Temporarily disable system preview detection when a link is clicked. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): 2018-05-08 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the internal iOS build Add a missing import statement in an implementation file. * editing/cocoa/WebContentReaderCocoa.mm: 2018-05-08 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r231486. Caused service worker LayoutTest failures on macOS Debug WK2. Reverted changeset: "Allow WebResourceLoader to cancel a load served from a service worker" https://bugs.webkit.org/show_bug.cgi?id=185274 https://trac.webkit.org/changeset/231486 2018-05-08 Wenson Hsieh <wenson_hsieh@apple.com> Consolidate WebContentReaderIOS and WebContentReaderMac into WebContentReaderCocoa https://bugs.webkit.org/show_bug.cgi?id=185340 Reviewed by Tim Horton. WebContentReader::readURL is currently the only method implemented separately in iOS and macOS platform WebContentReader files. The implementation across macOS and iOS is nearly identical (with some exceptions with the way iOS handles file URLs and plain text editing), so we can merge these into a single method WebContentReaderCocoa and delete WebContentReaderIOS and WebContentReaderMac. This also has the added bonus of fixing a latent bug in WebContentReaderMac, wherein URLs written to the pasteboard using -[NSPasteboard writeObjects:] are currently pasted as empty anchor elements. In this case, the link title isn't made explicit, so the `title` passed in to WebContentReader::readURL is empty. On iOS, we have code to fall back to pasting the absolute string of the URL if the title is empty, but on macOS, we'll just use this empty string as the title of the anchor. Test: PasteMixedContent.PasteURLWrittenToPasteboardUsingWriteObjects * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readURL): * editing/ios/WebContentReaderIOS.mm: Removed. * editing/mac/WebContentReaderMac.mm: Removed. 2018-05-08 Zalan Bujtas <zalan@apple.com> [Simple line layout] Cache run resolver. https://bugs.webkit.org/show_bug.cgi?id=185411 Reviewed by Antti Koivisto. This patch caches the run resolver on the [SimpleLine]Layout object. In certain cases, when the block container has thousands of elements (foobar1<br>foobar2<br>.....foobar9999<br>), constructing the resolver (and its dependencies) in a repeating fashion could hang the WebProcess. Covered by existing tests. * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::create): (WebCore::SimpleLineLayout::Layout::create): (WebCore::SimpleLineLayout::Layout::Layout): * rendering/SimpleLineLayout.h: (WebCore::SimpleLineLayout::Layout::runResolver const): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): (WebCore::SimpleLineLayout::hitTestFlow): (WebCore::SimpleLineLayout::collectFlowOverflow): (WebCore::SimpleLineLayout::computeBoundingBox): (WebCore::SimpleLineLayout::computeFirstRunLocation): (WebCore::SimpleLineLayout::collectAbsoluteRects): (WebCore::SimpleLineLayout::collectAbsoluteQuads): (WebCore::SimpleLineLayout::textOffsetForPoint): (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange): (WebCore::SimpleLineLayout::generateLineBoxTree): * rendering/SimpleLineLayoutResolver.cpp: (WebCore::SimpleLineLayout::LineResolver::LineResolver): * rendering/SimpleLineLayoutResolver.h: (WebCore::SimpleLineLayout::lineResolver): 2018-05-08 Brent Fulgham <bfulgham@apple.com> Switch some RELEASE_ASSERTS to plain debug ASSERTS in PlatformScreenMac.mm https://bugs.webkit.org/show_bug.cgi?id=185451 <rdar://problem/39620348> Reviewed by Zalan Bujtas. Change a set of RELEASE_ASSERTS used to prevent accessing NSScreen related functions in the PlatformScreenMac implementation to less expensive Debug ASSERTS. No change in behavior. * platform/mac/PlatformScreenMac.mm: (WebCore::screenHasInvertedColors): (WebCore::screenDepth): (WebCore::screenDepthPerComponent): (WebCore::screenRectForDisplay): (WebCore::screenRect): (WebCore::screenAvailableRect): (WebCore::screenColorSpace): (WebCore::screenSupportsExtendedColor): 2018-05-08 Daniel Bates <dabates@apple.com> Resign Strong Password appearance when text field value changes https://bugs.webkit.org/show_bug.cgi?id=185433 <rdar://problem/39958508> Reviewed by Ryosuke Niwa. Remove the Strong Password decoration when the text field's value changes to avoid interfering with web sites that allow a person to clear the password field. Tests: fast/forms/auto-fill-button/auto-fill-strong-password-button-when-maxlength-changes.html fast/forms/auto-fill-button/auto-fill-strong-password-button-when-minlength-changes.html fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::resignStrongPasswordAppearance): Extracted from HTMLInputElement::updateType(). (WebCore::HTMLInputElement::updateType): Extract out logic to resign the Strong Password appearance into a function that can be shared by this function and HTMLInputElement::setValue(). (WebCore::HTMLInputElement::setValue): Resign the Strong Password appearance if this field was changed programmatically (i.e. no DOM change event was dispatched). * html/HTMLInputElement.h: 2018-05-08 Jer Noble <jer.noble@apple.com> Unreviewed build fix; add missing function definition. * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::didPassCORSAccessCheck const): 2018-05-08 Jer Noble <jer.noble@apple.com> Mute MediaElementSourceNode when tainted. https://bugs.webkit.org/show_bug.cgi?id=184866 Reviewed by Eric Carlson. Test: http/tests/security/webaudio-render-remote-audio-blocked-no-crossorigin.html * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::wouldTaintOrigin const): * Modules/webaudio/AudioContext.h: * Modules/webaudio/MediaElementAudioSourceNode.cpp: (WebCore::MediaElementAudioSourceNode::setFormat): (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin): (WebCore::MediaElementAudioSourceNode::process): * Modules/webaudio/MediaElementAudioSourceNode.h: 2018-05-08 Eric Carlson <eric.carlson@apple.com> Log rtcstats as JSON https://bugs.webkit.org/show_bug.cgi?id=185437 <rdar://problem/40065332> Reviewed by Youenn Fablet. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::RTCStatsLogger::RTCStatsLogger): Create a wrapper class so we don't have to add a toJSONString method to libwebrtc. (WebCore::RTCStatsLogger::toJSONString const): Log stats as JSON. (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): Don't use the LOGIDENTIFIER macro because it doesn't work well inside of a lambda. (WTF::LogArgument<WebCore::RTCStatsLogger>::toString): Move into .cpp file because it is only used here. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: (WTF::LogArgument<webrtc::RTCStats>::toString): Deleted. Move to .cpp file. 2018-05-08 Dean Jackson <dino@apple.com> System Preview links should trigger a download https://bugs.webkit.org/show_bug.cgi?id=185439 <rdar://problem/40065545> Reviewed by Jon Lee. Add a new field to FrameLoadRequest, which then is copied into ResourceRequest, identifying if the link clicked is a system preview. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): Look for isSystemPreviewLink(). * loader/FrameLoadRequest.cpp: (WebCore::FrameLoadRequest::FrameLoadRequest): * loader/FrameLoadRequest.h: New property. (WebCore::FrameLoadRequest::FrameLoadRequest): (WebCore::FrameLoadRequest::isSystemPreview const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::urlSelected): (WebCore::FrameLoader::loadURL): * loader/FrameLoader.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::isSystemPreview const): (WebCore::ResourceRequestBase::setSystemPreview): * platform/network/ResourceRequestBase.h: 2018-05-08 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r231491. https://bugs.webkit.org/show_bug.cgi?id=185434 Setting the Created key on a cookie does not work yet, due a bug in CFNetwork (Requested by ggaren on #webkit). Reverted changeset: "[WKHTTPCookieStore getAllCookies] returns inconsistent creation time" https://bugs.webkit.org/show_bug.cgi?id=185041 https://trac.webkit.org/changeset/231491 2018-05-08 Sihui Liu <sihui_liu@apple.com> [WKHTTPCookieStore getAllCookies] returns inconsistent creation time https://bugs.webkit.org/show_bug.cgi?id=185041 <rdar://problem/34684214> Reviewed by Geoffrey Garen. Set creationtime property when creating Cookie object to keep consistency after conversion. New API test: WebKit.WKHTTPCookieStoreCreationTime. * platform/network/cocoa/CookieCocoa.mm: (WebCore::Cookie::operator NSHTTPCookie * const): 2018-05-08 Eric Carlson <eric.carlson@apple.com> Text track cue logging should include cue text https://bugs.webkit.org/show_bug.cgi?id=185353 <rdar://problem/40003565> Reviewed by Brent Fulgham. No new tests, tested manually. * html/track/VTTCue.cpp: (WebCore::VTTCue::toJSON const): * platform/graphics/InbandTextTrackPrivateClient.h: (WebCore::GenericCueData::toJSONString const): * platform/graphics/iso/ISOVTTCue.cpp: (WebCore::ISOWebVTTCue::toJSONString const): 2018-05-08 Sam Weinig <sam@webkit.org> More cleanup of XMLHttpRequestUpload https://bugs.webkit.org/show_bug.cgi?id=185409 Reviewed by Alex Christensen. - Remove unneeded #includes - Rename m_xmlHttpRequest to m_request - Make some overloaded some methods private, and mark them as final rather than override. * xml/XMLHttpRequestUpload.cpp: (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload): * xml/XMLHttpRequestUpload.h: 2018-05-08 Zalan Bujtas <zalan@apple.com> [LFC] Start using BlockMarginCollapse https://bugs.webkit.org/show_bug.cgi?id=185424 Reviewed by Antti Koivisto. BlockMarginCollapse could be all static. * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::marginTop const): (WebCore::Layout::BlockFormattingContext::marginBottom const): * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::isMarginTopCollapsedWithSibling): (WebCore::Layout::isMarginBottomCollapsedWithSibling): (WebCore::Layout::isMarginTopCollapsedWithParent): (WebCore::Layout::isMarginBottomCollapsedWithParent): (WebCore::Layout::collapsedMarginTopFromFirstChild): (WebCore::Layout::collapsedMarginBottomFromLastChild): (WebCore::Layout::nonCollapsedMarginTop): (WebCore::Layout::nonCollapsedMarginBottom): (WebCore::Layout::BlockMarginCollapse::marginTop): (WebCore::Layout::BlockMarginCollapse::marginBottom): (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse): Deleted. (WebCore::Layout::BlockMarginCollapse::marginTop const): Deleted. (WebCore::Layout::BlockMarginCollapse::marginBottom const): Deleted. (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const): Deleted. (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const): Deleted. (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const): Deleted. (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const): Deleted. (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const): Deleted. (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const): Deleted. (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const): Deleted. (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const): Deleted. (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const): Deleted. * layout/blockformatting/BlockMarginCollapse.h: 2018-05-08 Youenn Fablet <youenn@apple.com> Allow WebResourceLoader to cancel a load served from a service worker https://bugs.webkit.org/show_bug.cgi?id=185274 Reviewed by Chris Dumez. Add support for cancelling a fetch from WebProcess to service worker process. Use FetchIdentifier instead of uint64_t. * Modules/fetch/FetchIdentifier.h: Added. * WebCore.xcodeproj/project.pbxproj: * workers/service/context/ServiceWorkerFetch.h: * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::startFetch): (WebCore::ServiceWorkerThreadProxy::cancelFetch): * workers/service/context/ServiceWorkerThreadProxy.h: 2018-05-08 Said Abou-Hallawa <sabouhallawa@apple.com> feTurbulence is not rendered correctly on Retina display https://bugs.webkit.org/show_bug.cgi?id=183798 Reviewed by Simon Fraser. On 2x display the feTurbulence filter creates a scaled ImageBuffer but processes only the unscaled size. This is a remaining work of r168577 and is very similar to what was done for the feMorphology filter in r188271. Test: fast/hidpi/filters-turbulence.html * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::fillRegion const): (WebCore::FETurbulence::platformApplySoftware): 2018-05-07 Zalan Bujtas <zalan@apple.com> [LFC] Add FormattingContext::layoutOutOfFlowDescendants implementation https://bugs.webkit.org/show_bug.cgi?id=185377 Reviewed by Antti Koivisto. Also, remove FormattingContext's m_layoutContext member and pass it in to ::layout() instead. In theory LayoutContext is needed only during ::layout() call. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::layoutContext const): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::updateLayout): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layout const): * layout/inlineformatting/InlineFormattingContext.h: 2018-05-07 Daniel Bates <dabates@apple.com> Check X-Frame-Options and CSP frame-ancestors in network process https://bugs.webkit.org/show_bug.cgi?id=185410 <rdar://problem/37733934> Reviewed by Ryosuke Niwa. * WebCore.xcodeproj/project.pbxproj: Make PingLoader.h a private header so that we can include it in WebKit. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): Only check CSP frame-ancestors and X-Frame-Options here if we are not checking them in the NetworkProcess and HTTP response access is restricted. I code is otherwise kept unchanged. There may be opportunities to clean this code up more and share more of it. We should look into this in subsequent bugs. * loader/DocumentLoader.h: Change visibility of stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() from private to public and export it so that we can call it from the WebKit. * loader/PingLoader.h: * page/Settings.yaml: Add a new setting called networkProcessCSPFrameAncestorsCheckingEnabled (defaults: false) and is hardcoded in WebPage.cpp to be enabled. This setting is used to determine if we will be using the NetworkProcess. Ideally we wouldn't have this setting and just key off RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess(). However RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() is always enabled in WebKit Legacy at the time of writing (why?). And, strangely, RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() is conditionally enabled in WebKit. For now, we add a new setting, networkProcessCSPFrameAncestorsCheckingEnabled, to determine if CSP checking should be performed in NetworkProcess. For checking to actually happen in NetworkProcess and not in DocumentLoader::responseReceived() RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() will also need to be enabled. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowFrameAncestors const): Added a variant that takes a vector of ancestor origins. * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::checkFrameAncestors): Ditto. (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins const): Ditto. * page/csp/ContentSecurityPolicyDirectiveList.h: Export constructor so that we can invoke it from NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions(). * page/csp/ContentSecurityPolicyResponseHeaders.h: * platform/network/HTTPParsers.h: Export XFrameOptionsDisposition() so that we can use in WebKit. 2018-05-07 Daniel Bates <dabates@apple.com> Abstract logic to log console messages and send CSP violation reports into a client https://bugs.webkit.org/show_bug.cgi?id=185393 <rdar://problem/40036053> Reviewed by Brent Fulgham. First pass at adding infrastructure to supporting CSP reporting from NetworkProcess and workers. Replaces the existing ContentSecurityPolicy constructor that takes a Frame with one that takes a ContentSecurityPolicyClient to delegate to for logging and sending reports. We will look to remove ContentSecurityPolicy constructor that takes a ScriptExecutionContext in a follow up. Standardize on instantiating a ContentSecurityPolicy with the full URL to resource that it protects instead of taking only the SecurityOrigin of this URL. By taking the full URL the ContentSecurityPolicy object is now capable of resolving a relative report URL without needing a Document/ScriptExecutionContext. We are underutilizing the CSPInfo struct and ContentSecurityPolicyClient::willSendCSPViolationReport() delegate callback in this patch. We will make use of this functionality in a subsequent patch to support collecting script state (e.g. source line number) when reporting CSP violations in worker threads. We also no longer go through the unnecessary motions to try to collect script state for a frame-ancestors violation (since DocumentLoader extends ContentSecurityPolicyClient and does not implement ContentSecurityPolicyClient::willSendCSPViolationReport()). The frame-ancestors directive is checked before a document is parsed and executes script; => there will never be any script state to collect; => it is not necessary to try to collect it as we currently do. * Sources.txt: Add file ContentSecurityPolicyClient.cpp. See the remarks for ContentSecurityPolicyClient.cpp below on why we have this file. * WebCore.xcodeproj/project.pbxproj: Add files ContentSecurityPolicyClient.{h, cpp}. * dom/Document.cpp: (WebCore::Document::initSecurityContext): Pass the URL of the protected document. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): Ditto. (WebCore::DocumentLoader::addConsoleMessage): Added. (WebCore::DocumentLoader::sendCSPViolationReport): Added. (WebCore::DocumentLoader::dispatchSecurityPolicyViolationEvent): Added. * loader/DocumentLoader.h: * loader/FrameLoaderClient.h: Fix typo in comment. * loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Pass the URL of the worker script. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Added overload that takes a URL&& and an optional ContentSecurityPolicyClient*. (WebCore::ContentSecurityPolicy::deprecatedURLForReporting const): Extracted and simplified stripURLForUseInReport() into this member function. (WebCore::ContentSecurityPolicy::reportViolation const): Modified to make use of the client, if we have one and removed code for handling a ContentSecurityPolicy that was instantiated with a Frame. (WebCore::ContentSecurityPolicy::logToConsole const): Ditto. (WebCore::stripURLForUseInReport): Deleted; incorporated into ContentSecurityPolicy::deprecatedURLForReporting(). * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyClient.cpp: Added. This file exists so that we can define the virtual destructor out-of-line and export this abstract class so as to avoid the need for the vtable to be defined in the translation unit of each derived class. * page/csp/ContentSecurityPolicyClient.h: Added. * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::operator SecurityOriginData const): Added. * page/csp/ContentSecurityPolicySource.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): Instantiate the ContentSecurityPolicy object with the URL of the worker script. 2018-05-07 Simon Fraser <simon.fraser@apple.com> CSS filters which reference SVG filters fail to respect the "color-interpolation-filters" of the filter https://bugs.webkit.org/show_bug.cgi?id=185343 Reviewed by Dean Jackson. Test: css3/filters/color-interpolation-filters.html When applying CSS reference filters, apply the value of "color-interpolation-filters" for the referenced filter effect element, just as we do for SVG filters. * rendering/FilterEffectRenderer.cpp: (WebCore::FilterEffectRenderer::buildReferenceFilter): 2018-05-07 Daniel Bates <dabates@apple.com> CSP status-code incorrect for document blocked due to violation of its frame-ancestors directive https://bugs.webkit.org/show_bug.cgi?id=185366 <rdar://problem/40035116> Reviewed by Brent Fulgham. Fixes an issue where the status-code in the sent CSP report for an HTTP document blocked because its frame-ancestors directive was violated would be the status code of the previously loaded document in the frame. If the previously loaded document was about:blank then this would be 0. Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for the HTTP status code for the last response. Document::loader() returns the loader for the last committed document its frame. For a frame-ancestors violation, a CSP report is sent before the document that had the frame-ancestors directive has been committed and after it has been associate with a frame. As a result we are in are in a transient transition state for the frame and hence the last response for new document's loader (Document::loader()) is actually the last response of the previously loaded document in the frame. Instead we need to take care to tell CSP about the HTTP status code for the response associated with the document the CSP came from. * dom/Document.cpp: (WebCore::Document::processHttpEquiv): (WebCore::Document::initSecurityContext): Pass the HTTP status code to CSP. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::copyStateFrom): (WebCore::ContentSecurityPolicy::responseHeaders const): (WebCore::ContentSecurityPolicy::didReceiveHeaders): (WebCore::ContentSecurityPolicy::didReceiveHeader): (WebCore::ContentSecurityPolicy::reportViolation const): * page/csp/ContentSecurityPolicy.h: Modify existing functions to take the HTTP status code, store it in a instance variable, and reference this variable when reporting a violation. * page/csp/ContentSecurityPolicyResponseHeaders.cpp: (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders): (WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy const): * page/csp/ContentSecurityPolicyResponseHeaders.h: (WebCore::ContentSecurityPolicyResponseHeaders::encode const): (WebCore::ContentSecurityPolicyResponseHeaders::decode): Store the HTTP status code along with the response headers. 2018-05-07 Daniel Bates <dabates@apple.com> CSP referrer incorrect for document blocked due to violation of its frame-ancestors directive https://bugs.webkit.org/show_bug.cgi?id=185380 Reviewed by Brent Fulgham. Similar to <https://bugs.webkit.org/show_bug.cgi?id=185366>, fixes an issue where the referrer in the sent CSP report for an HTTP document blocked because its frame-ancestors directive was violated would be the referrer of the previously loaded document in the frame. Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for the referrer for the last request. Document::loader() returns the loader for the last committed document in its frame. For a frame-ancestors violation, a CSP report is sent before the document that had the frame-ancestors directive has been committed and after it has been associate with a frame. As a result we are in a transient transition state for the frame and hence the last request for the new document's loader (Document::loader()) is actually the last request of the previously loaded document in the frame. Instead we need to take care to tell CSP about the referrer for the request associated with the document the CSP came from. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): 2018-05-07 Brent Fulgham <bfulgham@apple.com> Add experimental feature to prompt for Storage Access API use https://bugs.webkit.org/show_bug.cgi?id=185335 <rdar://problem/39994649> Reviewed by Alex Christensen and Youenn Fablet. Create a new experimental feature that gates the ability of WebKit clients to prompt the user when Storage Access API is invoked. Currently this feature doesn't have any user-visible impact. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled): (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const): * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setStorageAccessPromptsEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2018-05-07 Chris Dumez <cdumez@apple.com> Stop using an iframe's id as fallback if its name attribute is not set https://bugs.webkit.org/show_bug.cgi?id=11388 Reviewed by Geoff Garen. WebKit had logic to use an iframe's id as fallback name when its name content attribute is not set. This behavior was not standard and did not match other browsers: - https://html.spec.whatwg.org/#attr-iframe-name Gecko / Trident never behaved this way. Blink was aligned with us until they started to match the specification in: - https://bugs.chromium.org/p/chromium/issues/detail?id=347169 This WebKit quirk was causing some Web-compatibility issues because it would affect the behavior of Window's name property getter when trying to look up an iframe by id. Because of Window's named property getter behavior [1], we would return the frame's contentWindow instead of the iframe element itself. [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object Test: fast/dom/Window/named-getter-frame-id.html * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::parseAttribute): (WebCore::HTMLFrameElementBase::didFinishInsertingNode): * html/HTMLFrameElementBase.h: 2018-05-07 Chris Dumez <cdumez@apple.com> ASSERT(!childItemWithTarget(child->target())) is hit in HistoryItem::addChildItem() https://bugs.webkit.org/show_bug.cgi?id=185322 Reviewed by Geoff Garen. We generate unique names for Frame to be used in HistoryItem. Those names not only need to be unique, they also need to be repeatable to avoid layout tests flakiness and for things like restoring form state from a HistoryItem. The previously generated frame names were relying on the Frame's index among a parent Frame's children. The issue was that we could end up with duplicate names because one could insert a Frame *before* an existing one. This is because the code would not take care of updating existing Frames' unique name on frame tree mutation. Updating frame tree names on mutation would be inefficient and is also not necessary. The approach chosen in this patch is to stop using the Frame's index and instead rely on an increasing counter stored on the top-frame's FrameTree. To make the names repeatable, we reset the counter on page navigation. * page/Frame.cpp: (WebCore::Frame::setDocument): * page/FrameTree.cpp: (WebCore::FrameTree::uniqueChildName const): (WebCore::FrameTree::generateUniqueName const): * page/FrameTree.h: (WebCore::FrameTree::resetFrameIdentifiers): 2018-05-07 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Fix wrong subsample parsing on r227067 https://bugs.webkit.org/show_bug.cgi?id=185382 Reviewed by Philippe Normand. The initialization of sampleIndex should be moved outside of the loop. Without this patch we will have a bad log and the check of the subsample count will be useless. * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: (webKitMediaClearKeyDecryptorDecrypt): 2018-05-07 Daniel Bates <dabates@apple.com> CSP should be passed the referrer https://bugs.webkit.org/show_bug.cgi?id=185367 Reviewed by Per Arne Vollan. As a step towards formalizing a CSP delegate object and removing the dependencies on ScriptExecutionContext and Frame, we should pass the document's referrer directly instead of indirectly obtaining it from the ScriptExecutionContext or Frame used to instantiate the ContentSecurityPolicy object. * dom/Document.cpp: (WebCore::Document::processHttpEquiv): Pass the document's referrer. (WebCore::Document::initSecurityContext): Ditto. (WebCore::Document::applyQuickLookSandbox): Ditto. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): Ditto. * loader/FrameLoader.cpp: (WebCore::FrameLoader::didBeginDocument): Ditto. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::copyStateFrom): We pass a null string for the referrer to didReceiveHeader() as a placeholder since it requires the referrer be given to it. We fix up the referrer (m_referrer) after copying all the policy headers. (WebCore::ContentSecurityPolicy::didReceiveHeaders): Ditto. (WebCore::ContentSecurityPolicy::didReceiveHeader): Modified to take a referrer and WTFMove()s it into an instance variable (m_referrer). (WebCore::ContentSecurityPolicy::reportViolation const): Modified to use the stored referrer. * page/csp/ContentSecurityPolicy.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Pass a null string for the referrer as a worker does not have a referrer. 2018-05-07 Daniel Bates <dabates@apple.com> CSP should only notify Inspector to pause the debugger on the first policy to violate a directive https://bugs.webkit.org/show_bug.cgi?id=185364 Reviewed by Brent Fulgham. Notify Web Inspector that a script was blocked on the first enforced CSP policy that it violates. A page can have more than one enforced Content Security Policy. Currently for inline scripts, inline event handlers, JavaScript URLs, and eval() that are blocked by CSP we notify Web Inspector that it was blocked for each CSP policy that blocked it. When Web Inspector is notified it pauses script execution. It does not seem very meaningful to pause script execution on the same script for each CSP policy that blocked it. Therefore, only tell Web Inspector that a script was blocked for the first enforced CSP policy that blocked it. * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const): (WebCore::ContentSecurityPolicy::allowInlineEventHandlers const): (WebCore::ContentSecurityPolicy::allowInlineScript const): (WebCore::ContentSecurityPolicy::allowEval const): 2018-05-07 Daniel Bates <dabates@apple.com> Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty() https://bugs.webkit.org/show_bug.cgi?id=185170 Reviewed by Per Arne Vollan. Rename CrossOriginPreflightResultCache::empty() to CrossOriginPreflightResultCache::clear() make it consistent with the terminology we use in WebKit to signify a function that clears a collection. A member function named "empty" is expected to return an instance of a class in its "empty state". For example, StringImpl::empty() returns a StringImpl instance that represents the empty string. However CrossOriginPreflightResultCache::empty() clears out the cache in-place. We should rename this function to better describe its purpose. * loader/CrossOriginPreflightResultCache.cpp: (WebCore::CrossOriginPreflightResultCache::clear): (WebCore::CrossOriginPreflightResultCache::empty): Deleted. * loader/CrossOriginPreflightResultCache.h: 2018-05-06 Dean Jackson <dino@apple.com> WebGL: Reset simulated values after validation fails https://bugs.webkit.org/show_bug.cgi?id=185363 <rdar://problem/39733417> Reviewed by Anders Carlsson. While fixing a previous bug, I forgot to reset some values when validation fails. This caused a bug where a subsequent invalid call might use those values and escape detection. Test: fast/canvas/webgl/index-validation-with-subsequent-draws.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Reset the sizes when validation fails. * html/canvas/WebGLRenderingContextBase.h: 2018-05-07 Ms2ger <Ms2ger@igalia.com> Support negative sw/sh values in createImageBitmap(). https://bugs.webkit.org/show_bug.cgi?id=184449 Reviewed by Dean Jackson. Tests: LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html LayoutTests/http/wpt/2dcontext/imagebitmap/createImageBitmap.html * html/ImageBitmap.cpp: (WebCore::ImageBitmap::createPromise): handle negative values per spec. 2018-05-07 Brian Burg <bburg@apple.com> Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected https://bugs.webkit.org/show_bug.cgi?id=184861 <rdar://problem/39153768> Reviewed by Timothy Hatcher. Notify the client of the current connection count whenever a frontend connects or disconnects. Covered by new API test. * inspector/InspectorClient.h: (WebCore::InspectorClient::frontendCountChanged): * inspector/InspectorController.cpp: (WebCore::InspectorController::connectFrontend): (WebCore::InspectorController::disconnectFrontend): (WebCore::InspectorController::disconnectAllFrontends): * inspector/InspectorController.h: 2018-05-07 Eric Carlson <eric.carlson@apple.com> Text track cue logging should include cue text https://bugs.webkit.org/show_bug.cgi?id=185353 <rdar://problem/40003565> Reviewed by Youenn Fablet. No new tests, tested manually. * html/track/VTTCue.cpp: (WebCore::VTTCue::toJSONString const): Use toJSON. (WebCore::VTTCue::toJSON const): New. * html/track/VTTCue.h: * platform/graphics/InbandTextTrackPrivateClient.h: (WebCore::GenericCueData::toJSONString const): Log m_content. * platform/graphics/iso/ISOVTTCue.cpp: (WebCore::ISOWebVTTCue::toJSONString const): Log m_cueText. 2018-05-06 Zalan Bujtas <zalan@apple.com> [LFC] Add assertions for stale Display::Box geometry https://bugs.webkit.org/show_bug.cgi?id=185357 Reviewed by Antti Koivisto. Ensure that we don't access stale geometry of other boxes during layout. For example, in order to layout a block child we need the containing block's content box top/left and width (but not the height) * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::invalidateTop): (WebCore::Display::Box::invalidateLeft): (WebCore::Display::Box::invalidateWidth): (WebCore::Display::Box::invalidateHeight): (WebCore::Display::Box::hasValidPosition const): (WebCore::Display::Box::hasValidSize const): (WebCore::Display::Box::hasValidGeometry const): (WebCore::Display::Box::invalidatePosition): (WebCore::Display::Box::invalidateSize): (WebCore::Display::Box::setHasValidPosition): (WebCore::Display::Box::setHasValidSize): (WebCore::Display::Box::setHasValidGeometry): (WebCore::Display::Box::rect const): (WebCore::Display::Box::top const): (WebCore::Display::Box::left const): (WebCore::Display::Box::bottom const): (WebCore::Display::Box::right const): (WebCore::Display::Box::topLeft const): (WebCore::Display::Box::bottomRight const): (WebCore::Display::Box::size const): (WebCore::Display::Box::width const): (WebCore::Display::Box::height const): (WebCore::Display::Box::setRect): (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setSize): (WebCore::Display::Box::setWidth): (WebCore::Display::Box::setHeight): 2018-05-06 Zalan Bujtas <zalan@apple.com> [LFC] Add BlockFormattingContext::computeStaticPosition https://bugs.webkit.org/show_bug.cgi?id=185352 Reviewed by Antti Koivisto. This is the core logic for positioning inflow boxes in a block formatting context (very naive though). * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeStaticPosition const): * layout/displaytree/DisplayBox.h: 2018-05-05 Sam Weinig <sam@webkit.org> Cleanup XMLHttpRequestUpload a little https://bugs.webkit.org/show_bug.cgi?id=185344 Reviewed by Yusuke Suzuki. * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::visitAdditionalChildren): Use auto to reduce redundancy. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::upload): * xml/XMLHttpRequest.h: Switch upload() to return a reference. * xml/XMLHttpRequestUpload.cpp: (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload): (WebCore::XMLHttpRequestUpload::dispatchProgressEvent): * xml/XMLHttpRequestUpload.h: Cleanup formatting, modernize and switch XMLHttpRequest member from a pointer to a reference. 2018-05-05 Dean Jackson <dino@apple.com> Draw a drop-shadow behind the system preview badge https://bugs.webkit.org/show_bug.cgi?id=185356 <rdar://problem/40004936> Reviewed by Wenson Hsieh. Draw a very subtle drop-shadow under the system preview badge so that it is more visible on a pure white background. I also moved some code around to make it more clear and improved comments. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintSystemPreviewBadge): 2018-05-04 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart https://bugs.webkit.org/show_bug.cgi?id=185289 <rdar://problem/35756912> Reviewed by Tim Horton and Darin Adler. When inserting multiple URLs as individual items in a single drop, we currently separate each item with a space (see r217284). However, it still seems difficult to tell dropped links apart. This patch makes some slight tweaks to WebContentReader::readURL so that it inserts line breaks before dropped URLs, if the dropped URL isn't the first item to be inserted in the resulting document fragment. Augments existing API tests in DataInteractionTests. * editing/ios/WebContentReaderIOS.mm: Additionally remove some extraneous header imports from this implementation file. (WebCore::WebContentReader::readURL): 2018-05-02 Dean Jackson <dino@apple.com> Use IOSurfaces for CoreImage operations where possible https://bugs.webkit.org/show_bug.cgi?id=185230 <rdar://problem/39926929> Reviewed by Jon Lee. On iOS hardware, we can use IOSurfaces as a rendering destination for CoreImage, which means we're keeping data on the GPU for rendering. As a drive-by fix, I used a convenience method for Gaussian blurs. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintSystemPreviewBadge): 2018-05-04 Tim Horton <timothy_horton@apple.com> Shift to a lower-level framework for simplifying URLs https://bugs.webkit.org/show_bug.cgi?id=185334 Reviewed by Dan Bernstein. * Configurations/WebCore.xcconfig: * platform/mac/DragImageMac.mm: (WebCore::LinkImageLayout::LinkImageLayout): 2018-05-03 Ryosuke Niwa <rniwa@webkit.org> Release assert in ScriptController::canExecuteScripts via HTMLMediaElement::~HTMLMediaElement() https://bugs.webkit.org/show_bug.cgi?id=185288 Reviewed by Jer Noble. The crash is caused by HTMLMediaElement::~HTMLMediaElement canceling the resource load via CachedResource which ends up calling FrameLoader::checkCompleted() and fire load event on the document synchronously. Speculatively fix the crash by scheduling the check instead. In long term, ResourceLoader::cancel should never fire load event synchronously: webkit.org/b/185284. Unfortunately, no new tests since I can't get MediaResource to get destructed at the right time. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::isRunningDestructor): Added to detect this specific case. (WebCore::HTMLMediaElementDestructorScope): Added. (WebCore::HTMLMediaElementDestructorScope::HTMLMediaElementDestructorScope): Added. (WebCore::HTMLMediaElementDestructorScope::~HTMLMediaElementDestructorScope): Added. (WebCore::HTMLMediaElement::~HTMLMediaElement): Instantiate HTMLMediaElement. * html/HTMLMediaElement.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkCompleted): Call scheduleCheckCompleted instead of synchronously calling checkCompleted if we're in the middle of destructing a HTMLMediaElement. 2018-05-04 Ryosuke Niwa <rniwa@webkit.org> Rename DocumentOrderedMap to TreeScopeOrderedMap https://bugs.webkit.org/show_bug.cgi?id=185290 Reviewed by Zalan Bujtas. Renamed the class since it's almost always a mistake to use this class as a member variable of Document. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/MouseRelatedEvent.cpp: Include the forgotten DOMWindow.h. Unified build files bit us here. * dom/TreeScope.cpp: (WebCore::TreeScope::addElementById): (WebCore::TreeScope::addElementByName): (WebCore::TreeScope::addImageMap): (WebCore::TreeScope::addImageElementByUsemap): (WebCore::TreeScope::labelElementForId): * dom/TreeScope.h: * dom/TreeScopeOrderedMap.cpp: Renamed from DocumentOrderedMap.cpp * dom/TreeScopeOrderedMap.h: Renamed from DocumentOrderedMap.h * html/HTMLDocument.h: 2018-05-04 Don Olmstead <don.olmstead@sony.com> [Win][WebKit] Fix forwarding headers for Windows build https://bugs.webkit.org/show_bug.cgi?id=184412 Reviewed by Alex Christensen. No new tests. No change in behavior. * PlatformWin.cmake: 2018-05-04 Zalan Bujtas <zalan@apple.com> [Simple line layout] Add support for line layout box generation with multiple text renderers. https://bugs.webkit.org/show_bug.cgi?id=185276 Reviewed by Antti Koivisto. Covered by existing tests. * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::canUseForLineBoxTree): (WebCore::SimpleLineLayout::generateLineBoxTree): * rendering/SimpleLineLayoutResolver.cpp: (WebCore::SimpleLineLayout::RunResolver::Run::renderer const): (WebCore::SimpleLineLayout::RunResolver::Run::localStart const): (WebCore::SimpleLineLayout::RunResolver::Run::localEnd const): * rendering/SimpleLineLayoutResolver.h: 2018-05-04 Timothy Hatcher <timothy@apple.com> Deprecate legacy WebView and friends https://bugs.webkit.org/show_bug.cgi?id=185279 rdar://problem/33268700 Reviewed by Tim Horton. * Configurations/WebCore.xcconfig: Added BUILDING_WEBKIT define to disable the deprecation macros. * bridge/objc/WebScriptObject.h: Added deprecation macros to WebScriptObject and WebUndefined. * platform/cocoa/WebKitAvailability.h: Added more macros and a way to disable deprecation warnings for WebKit build and in clients like Safari. 2018-05-04 Eric Carlson <eric.carlson@apple.com> Log media time range as JSON https://bugs.webkit.org/show_bug.cgi?id=185321 <rdar://problem/39986746> Reviewed by Youenn Fablet. No new tests, tested manually. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::addPlayedRange): Log as time range. (WebCore::HTMLMediaElement::visibilityStateChanged): Cleanup. * platform/graphics/MediaPlayer.h: (WTF::LogArgument<MediaTime>::toString): (WTF::LogArgument<MediaTimeRange>::toString): * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Log error as time range. 2018-05-04 Zalan Bujtas <zalan@apple.com> Use the containing block to compute the pagination gap when the container is inline. https://bugs.webkit.org/show_bug.cgi?id=184724 <rdar://problem/39521800> Reviewed by Simon Fraser. Test: fast/overflow/page-overflow-with-inline-body-crash.html * page/FrameView.cpp: (WebCore::FrameView::applyPaginationToViewport): 2018-05-04 Tim Horton <timothy_horton@apple.com> Don't use GSFont* in minimal simulator mode https://bugs.webkit.org/show_bug.cgi?id=185320 <rdar://problem/39734478> Reviewed by Beth Dakin. * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::platformReleaseMemory): 2018-05-04 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r231331. Caused a few tests to assert Reverted changeset: "Stop using an iframe's id as fallback if its name attribute is not set" https://bugs.webkit.org/show_bug.cgi?id=11388 https://trac.webkit.org/changeset/231331 2018-05-04 Youenn Fablet <youenn@apple.com> Use more references in updateTracksOfType https://bugs.webkit.org/show_bug.cgi?id=185305 Reviewed by Eric Carlson. No change of behavior. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::updateTracksOfType): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): 2018-05-04 Myles C. Maxfield <mmaxfield@apple.com> Text shaping in the simple path is flipped in the y direction https://bugs.webkit.org/show_bug.cgi?id=185062 <rdar://problem/39778678> Reviewed by Simon Fraser. Shaping in our simple codepath occurs in an "increasing-y-goes-up" coordinate system, but our painting code uses an "increasing-y-goes-down" coordinate system. We weren't fixing up the coordinate systems because we never noticed. This is because the simple codepath is only designed for kerning and ligatures, neither of which move glyphs vertically in the common case. Test: fast/text/vertical-displacement-simple-codepath.html * platform/graphics/Font.cpp: (WebCore::Font::applyTransforms const): * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::applyFontTransforms): 2018-05-04 Chris Nardi <cnardi@chromium.org> Serialize all URLs with double-quotes per CSSOM spec https://bugs.webkit.org/show_bug.cgi?id=184935 Reviewed by Antti Koivisto. According to https://drafts.csswg.org/cssom/#serialize-a-url, all URLs should be serialized as strings, which means they should have double quotes around the text of the URL. Update our implementation to match this (and Firefox/Chrome). Also remove isCSSTokenizerURL() as this method is no longer needed. Tests: Many LayoutTests updated to use double quotes. * css/CSSMarkup.cpp: (WebCore::serializeString): Remove FIXME as this was already fixed in a previous patch. (WebCore::serializeURL): Remove FIXME and update implementation. 2018-05-04 Youenn Fablet <youenn@apple.com> LayoutTests/fast/mediastream/change-tracks-media-stream-being-played.html is crashing after r231304 https://bugs.webkit.org/show_bug.cgi?id=185303 Reviewed by Eric Carlson. We need to stop observing the audio track like we do for video track once we are no longer interested in it. Covered by test no longer crashing. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): 2018-05-04 Zalan Bujtas <zalan@apple.com> [LFC] Set the invalidation root as the result of style change. https://bugs.webkit.org/show_bug.cgi?id=185301 Reviewed by Antti Koivisto. Compute/propagate the update type on the ancestor chain and return the invalidation root so that LayoutContext could use it as the entry point for the next layout frame. * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::updateLayout): (WebCore::Layout::LayoutContext::styleChanged): * layout/LayoutContext.h: order is not important. * layout/blockformatting/BlockInvalidation.cpp: (WebCore::Layout::invalidationStopsAtFormattingContextBoundary): (WebCore::Layout::computeUpdateType): (WebCore::Layout::computeUpdateTypeForAncestor): (WebCore::Layout::BlockInvalidation::invalidate): * layout/blockformatting/BlockInvalidation.h: * layout/inlineformatting/InlineInvalidation.cpp: (WebCore::Layout::InlineInvalidation::invalidate): * layout/inlineformatting/InlineInvalidation.h: 2018-05-04 Youenn Fablet <youenn@apple.com> PeerConnection should have its connectionState closed even if doing gathering https://bugs.webkit.org/show_bug.cgi?id=185267 Reviewed by Darin Adler. Test: webrtc/addICECandidate-closed.html In case m_iceConnectionState is closed, m_connectionState should also be set to closed and RTCPeerConnection should be closed so as to reject any other call. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::close): (WebCore::RTCPeerConnection::updateConnectionState): 2018-05-04 Yacine Bandou <yacine.bandou_ext@softathome.com> [MSE][GStreamer] Delete properly the stream from the WebKitMediaSource https://bugs.webkit.org/show_bug.cgi?id=185242 Reviewed by Xabier Rodriguez-Calvar. When the sourceBuffer is removed from mediasource, the appropriate stream is not properly deleted from WebKitMediaSource, because the appsrc and parser elements of the stream are not removed from the WebKitMediaSource bin. This patch avoids the regression of r231089, see https://bugs.webkit.org/show_bug.cgi?id=185071 * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcFreeStream): 2018-05-04 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com https://bugs.webkit.org/show_bug.cgi?id=174730 Reviewed by Michael Catanzaro. Export ResourceRequestBase::hasHTTPHeaderField(). * platform/network/ResourceRequestBase.h: 2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com> Use subprocess.call instead of os.system to handle path with spaces https://bugs.webkit.org/show_bug.cgi?id=185291 Reviewed by Darin Adler. If gperf path includes spaces, these python scripts fail to execute gperf. We use subprocess module instead of os.system to invoke gperf. * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/makeSelectorPseudoElementsMap.py: * platform/network/create-http-header-name-table: 2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, attempt to fix WinCairo build failure https://bugs.webkit.org/show_bug.cgi?id=185218 * platform/text/win/LocaleWin.cpp: (WebCore::LocaleWin::getLocaleInfoString): 2018-05-03 Filip Pizlo <fpizlo@apple.com> Strings should not be allocated in a gigacage https://bugs.webkit.org/show_bug.cgi?id=185218 Reviewed by Saam Barati. No new tests because no new behavior. * Modules/indexeddb/server/IDBSerialization.cpp: (WebCore::decodeKey): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::normalizeSpaces): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace): * platform/URLParser.cpp: (WebCore::percentEncodeByte): (WebCore::serializeURLEncodedForm): (WebCore::URLParser::serialize): * platform/URLParser.h: * platform/graphics/FourCC.cpp: (WebCore::FourCC::toString const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::ReplicaState::cloneID const): * platform/text/LocaleICU.cpp: (WebCore::LocaleICU::decimalSymbol): (WebCore::LocaleICU::decimalTextAttribute): (WebCore::getDateFormatPattern): (WebCore::LocaleICU::createLabelVector): (WebCore::getFormatForSkeleton): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::getFinalPathName): (WebCore::FileSystem::pathByAppendingComponent): (WebCore::FileSystem::storageDirectory): 2018-05-02 Brent Fulgham <bfulgham@apple.com> Widgets should hold a WeakPtr to their parents https://bugs.webkit.org/show_bug.cgi?id=185239 <rdar://problem/39741250> Reviewed by Zalan Bujtas. * platform/ScrollView.h: (WebCore::ScrollView::weakPtrFactory): Added. * platform/Widget.cpp: (WebCore::Widget::init): Don't perform an unnecessary assignment. (WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView. * platform/Widget.h: (WebCore::Widget::parent const): Change type to a WeakPtr. 2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com> Use pointer instead of std::optional<T&> https://bugs.webkit.org/show_bug.cgi?id=185186 Reviewed by Alex Christensen. std::optional<T&> is not accepted in C++17 spec. In this patch, we replace it with T*, which is well-aligned to WebKit's convention. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::iceServersFromConfiguration): (WebCore::RTCPeerConnection::initializeConfiguration): (WebCore::RTCPeerConnection::setConfiguration): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSystemColor): * css/parser/CSSParser.h: * dom/DatasetDOMStringMap.cpp: (WebCore::DatasetDOMStringMap::item const): (WebCore::DatasetDOMStringMap::namedItem const): (WebCore:: const): Deleted. * dom/DatasetDOMStringMap.h: * dom/Element.cpp: (WebCore::Element::insertAdjacentHTML): * dom/Element.h: * html/canvas/CanvasStyle.cpp: (WebCore::parseColor): * inspector/DOMEditor.cpp: * platform/network/curl/CurlFormDataStream.cpp: (WebCore::CurlFormDataStream::getPostData): (): Deleted. * platform/network/curl/CurlFormDataStream.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupPOST): * testing/MockCDMFactory.cpp: (WebCore::MockCDMFactory::keysForSessionWithID const): (WebCore::MockCDMInstance::updateLicense): (WebCore:: const): Deleted. * testing/MockCDMFactory.h: 2018-05-03 Chris Dumez <cdumez@apple.com> Stop using an iframe's id as fallback if its name attribute is not set https://bugs.webkit.org/show_bug.cgi?id=11388 Reviewed by Geoff Garen. WebKit had logic to use an iframe's id as fallback name when its name content attribute is not set. This behavior was not standard and did not match other browsers: - https://html.spec.whatwg.org/#attr-iframe-name Gecko / Trident never behaved this way. Blink was aligned with us until they started to match the specification in: - https://bugs.chromium.org/p/chromium/issues/detail?id=347169 This WebKit quirk was causing some Web-compatibility issues because it would affect the behavior of Window's name property getter when trying to look up an iframe by id. Because of Window's named property getter behavior [1], we would return the frame's contentWindow instead of the iframe element itself. [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object Test: fast/dom/Window/named-getter-frame-id.html * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::openURL): (WebCore::HTMLFrameElementBase::parseAttribute): (WebCore::HTMLFrameElementBase::didFinishInsertingNode): * html/HTMLFrameElementBase.h: 2018-05-03 Eric Carlson <eric.carlson@apple.com> [iOS] Internal text and audio tracks not in fullscreen menu https://bugs.webkit.org/show_bug.cgi?id=185268 <rdar://problem/38673440> Reviewed by Jer Noble. * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::setMediaElement): 'addtrack' and 'removetrack' events are fired at the track lists, not the media element. 2018-05-03 Ryosuke Niwa <rniwa@webkit.org> Using image map inside a shadow tree results hits a release assert in DocumentOrderedMap::add https://bugs.webkit.org/show_bug.cgi?id=185238 Reviewed by Antti Koivisto. The bug was caused by DocumentOrderedMap for the image elements with usemap being stored in Document even if those image elements were in a shadow tree. Fixed the bug by moving the map to TreeScope. Test: fast/images/imagemap-in-nested-shadow-tree.html fast/images/imagemap-in-shadow-tree.html * dom/Document.cpp: (WebCore::Document::addImageElementByUsemap): Moved to TreeScope. (WebCore::Document::removeImageElementByUsemap): Ditto. (WebCore::Document::imageElementByUsemap const): Ditto. * dom/Document.h: * dom/TreeScope.cpp: (WebCore::TreeScope::destroyTreeScopeData): Clear m_imagesByUsemap as well as m_elementsByName. (WebCore::TreeScope::getImageMap const): Removed the code to parse usemap. RenderImage::imageMap() which used to call this function with the raw value of the usemap content attribute now calls it via HTMLImageElement::associatedMapElement(), which uses the parsed usemap. (WebCore::TreeScope::addImageElementByUsemap): Moved from Document. (WebCore::TreeScope::removeImageElementByUsemap): Ditto. (WebCore::TreeScope::imageElementByUsemap const): Ditto. * dom/TreeScope.h: * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::parseAttribute): (WebCore::HTMLImageElement::insertedIntoAncestor): This image element can be associated with a map element if it's connected to a document. (WebCore::HTMLImageElement::removedFromAncestor): (WebCore::HTMLImageElement::associatedMapElement const): * html/HTMLImageElement.h: * html/HTMLMapElement.cpp: (WebCore::HTMLMapElement::imageElement): * rendering/RenderImage.cpp: (WebCore::RenderImage::imageMap const): 2018-05-03 Justin Fan <justin_fan@apple.com> [WebGL] Add runtime flag for enabling ASTC support in WebGL https://bugs.webkit.org/show_bug.cgi?id=184840 Reviewed by Myles C. Maxfield. Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebGLCompressedTextureASTCSupportEnabled): (WebCore::RuntimeEnabledFeatures::webGLCompressedTextureASTCSupportEnabled const): 2018-05-03 Chris Nardi <cnardi@chromium.org> Remove [NoInterfaceObject] from DOMRectList https://bugs.webkit.org/show_bug.cgi?id=185255 Reviewed by Chris Dumez. In https://github.com/w3c/fxtf-drafts/issues/233, [NoInterfaceObject] was removed from DOMRectList. Remove it from our implementation to match the spec, as well as Chrome and Firefox. Updated web platform tests IDL test for the Geometry spec. * dom/DOMRectList.idl: 2018-05-03 Chris Dumez <cdumez@apple.com> REGRESSION(iOS 11.3): Crashes in TimerBase::~TimerBase() in Tencent x5gamehelper https://bugs.webkit.org/show_bug.cgi?id=185073 <rdar://problem/39821223> Reviewed by Alexey Proskuryakov. The following changes were made: - Make sure SocketStream callbacks are always scheduled on the right runloop: WebThreadRunLoop() on WebKitLegacy iOS, loaderRunLoop() on Windows and main runloop otherwise. - When the SocketStream callbacks are called, unconditionally call callOnMainThreadAndWait() before calling methods on the SocketStream client. Previously, this code path was specific to Windows but there is no reason to have platform-specific code here. callOnMainThreadAndWait() calls the function right away if we're already on the main thread, which will be the case on other platform than Windows. * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::callbacksRunLoop): (WebCore::callbacksRunLoopMode): (WebCore::SocketStreamHandleImpl::scheduleStreams): (WebCore::SocketStreamHandleImpl::pacExecutionCallback): (WebCore::SocketStreamHandleImpl::executePACFileURL): (WebCore::SocketStreamHandleImpl::removePACRunLoopSource): (WebCore::SocketStreamHandleImpl::readStreamCallback): (WebCore::SocketStreamHandleImpl::writeStreamCallback): (WebCore::SocketStreamHandleImpl::platformClose): 2018-05-03 Zalan Bujtas <zalan@apple.com> [LFC] Enable multiple layout roots for incremental layout. https://bugs.webkit.org/show_bug.cgi?id=185185 Reviewed by Antti Koivisto. With certain type of style changes, we can stop the box invalidation at the formatting context boundary. When multiple boxes need updating in different formatting contexts, instead of marking the parent containing block chain all the way up to a common ancestor, we could just work with a list of layout entry points per layout frame. * layout/FormattingState.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::updateLayout): (WebCore::Layout::LayoutContext::addLayoutEntryPoint): * layout/LayoutContext.h: 2018-05-03 Zalan Bujtas <zalan@apple.com> [LFC] Box invalidation logic should go to dedicated classes. https://bugs.webkit.org/show_bug.cgi?id=185249 Reviewed by Antti Koivisto. Each formatting context can initiate a different type of invalidation when style attribute changes in a box. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/FormattingState.cpp: (WebCore::Layout::FormattingState::FormattingState): * layout/FormattingState.h: (WebCore::Layout::FormattingState::isBlockFormattingState const): (WebCore::Layout::FormattingState::isInlineFormattingState const): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::styleChanged): (WebCore::Layout::LayoutContext::markNeedsUpdate): * layout/LayoutContext.h: * layout/blockformatting/BlockFormattingState.cpp: (WebCore::Layout::BlockFormattingState::BlockFormattingState): * layout/blockformatting/BlockFormattingState.h: * layout/blockformatting/BlockInvalidation.cpp: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.cpp. (WebCore::Layout::BlockInvalidation::invalidate): * layout/blockformatting/BlockInvalidation.h: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.h. * layout/inlineformatting/InlineFormattingState.cpp: (WebCore::Layout::InlineFormattingState::InlineFormattingState): * layout/inlineformatting/InlineFormattingState.h: * layout/inlineformatting/InlineInvalidation.cpp: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp. (WebCore::Layout::InlineInvalidation::invalidate): * layout/inlineformatting/InlineInvalidation.h: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.h. 2018-05-03 Michael Catanzaro <mcatanzaro@igalia.com> WebKit should send fake macOS user agent to docs.google.com https://bugs.webkit.org/show_bug.cgi?id=185165 Reviewed by Carlos Garcia Campos. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresMacintoshPlatform): (WebCore::urlRequiresLinuxDesktopPlatform): 2018-05-03 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r231223 and r231288. https://bugs.webkit.org/show_bug.cgi?id=185256 The change in r231223 breaks internal builds, and r231288 is a dependent change. (Requested by ryanhaddad on #webkit). Reverted changesets: "Use default std::optional if it is provided" https://bugs.webkit.org/show_bug.cgi?id=185159 https://trac.webkit.org/changeset/231223 "Use pointer instead of std::optional<std::reference_wrapper<>>" https://bugs.webkit.org/show_bug.cgi?id=185186 https://trac.webkit.org/changeset/231288 2018-05-03 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r231253. The API test added with this change is crashing on the bots. Reverted changeset: "Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected" https://bugs.webkit.org/show_bug.cgi?id=184861 https://trac.webkit.org/changeset/231253 2018-05-03 Youenn Fablet <youenn@apple.com> A MediaStream being played should allow removing some of its tracks https://bugs.webkit.org/show_bug.cgi?id=185233 Reviewed by Eric Carlson. Update the tracks out of the for loop. Test: fast/mediastream/change-tracks-media-stream-being-played.html * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::updateTracksOfType): 2018-05-03 Miguel Gomez <magomez@igalia.com> WebCore::TextureMapperLayer object used after freed https://bugs.webkit.org/show_bug.cgi?id=184729 Reviewed by Michael Catanzaro. Replace the raw pointers with WeakPtr for effectTarget, maskLayer and replicaLayer inside TextureMapperLayer. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::~TextureMapperLayer): (WebCore::TextureMapperLayer::setMaskLayer): (WebCore::TextureMapperLayer::setReplicaLayer): * platform/graphics/texmap/TextureMapperLayer.h: 2018-05-03 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Add OpenSSL/LibreSSL multi-threading support https://bugs.webkit.org/show_bug.cgi?id=185138 The older OpenSSL manual says the locking_function and threadid_function should be set when use it in multi-threading environment. This applies to LibreSSL also. https://www.openssl.org/docs/man1.0.2/crypto/threads.html For unix and other similar os, the default threadId_function implementation is good enough. We'll set custom callback only for Windows OS. Note it's not required for OpenSSL 1.1.0 and after. https://www.openssl.org/blog/blog/2017/02/21/threads/ Reviewed by Per Arne Vollan. * platform/network/curl/CurlSSLHandle.cpp: (WebCore::CurlSSLHandle::CurlSSLHandle): (WebCore::CurlSSLHandle::ThreadSupport::ThreadSupport): (WebCore::CurlSSLHandle::ThreadSupport::lockingCallback): (WebCore::CurlSSLHandle::ThreadSupport::threadIdCallback): * platform/network/curl/CurlSSLHandle.h: (WebCore::CurlSSLHandle::ThreadSupport::setup): (WebCore::CurlSSLHandle::ThreadSupport::singleton): (WebCore::CurlSSLHandle::ThreadSupport::lock): (WebCore::CurlSSLHandle::ThreadSupport::unlock): 2018-05-02 Ryosuke Niwa <rniwa@webkit.org> Remove superfluous check for a null attribute value check in Element::removeAttributeInternal https://bugs.webkit.org/show_bug.cgi?id=185227 Reviewed by Chris Dumez. Removed the check. The attribute value string can never be null. * dom/Element.cpp: (WebCore::Element::removeAttributeInternal): 2018-05-02 Zalan Bujtas <zalan@apple.com> [LFC] Implement LayoutContext::createDisplayBox https://bugs.webkit.org/show_bug.cgi?id=185158 Reviewed by Antti Koivisto. Now compute*() functions take both the const layout and the corresponding non-const display boxes. Display boxes are owned by the LayoutContext and they don't form a tree structure (only implicitly through the layout tree). (This might need to change in the future if we decide to arrange them in some sort of painting order) * layout/FloatingContext.cpp: (WebCore::Layout::FloatingContext::computePosition): * layout/FloatingContext.h: * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeStaticPosition const): (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition const): (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const): (WebCore::Layout::FormattingContext::computeWidth const): (WebCore::Layout::FormattingContext::computeHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeFloatingHeight const): * layout/FormattingContext.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::createDisplayBox): * layout/LayoutContext.h: (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::computeStaticPosition const): (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): * layout/blockformatting/BlockFormattingContext.h: * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::parent const): Deleted. (WebCore::Display::Box::nextSibling const): Deleted. (WebCore::Display::Box::previousSibling const): Deleted. (WebCore::Display::Box::firstChild const): Deleted. (WebCore::Display::Box::lastChild const): Deleted. (WebCore::Display::Box::setParent): Deleted. (WebCore::Display::Box::setNextSibling): Deleted. (WebCore::Display::Box::setPreviousSibling): Deleted. (WebCore::Display::Box::setFirstChild): Deleted. (WebCore::Display::Box::setLastChild): Deleted. (): Deleted. * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const): (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const): * layout/inlineformatting/InlineFormattingContext.h: 2018-05-02 Said Abou-Hallawa <sabouhallawa@apple.com> Hiding then showing an <object> of type image makes the underlaying image disappear https://bugs.webkit.org/show_bug.cgi?id=185216 <rdar://problem/39055630> Reviewed by Youenn Fablet. Ensure the HTMLPlugInImageElement updates the RenderImageResource of its RenderImage with the CachedImage of its ImageLoader when the RenderImage is recreated. Test: fast/images/object-image-hide-show.html * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::didAttachRenderers): This is very similar to what we do in HTMLImageElement::didAttachRenderers(). 2018-05-02 Brent Fulgham <bfulgham@apple.com> Use RetainPtr for form input type https://bugs.webkit.org/show_bug.cgi?id=185210 <rdar://problem/39734040> Reviewed by Ryosuke Niwa. Refactor our HTMLInputElement class to store its InputType member as a RefPtr. Test: fast/forms/access-key-mutation-2.html. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::HTMLInputElement): (WebCore::HTMLInputElement::didAddUserAgentShadowRoot): (WebCore::HTMLInputElement::accessKeyAction): (WebCore::HTMLInputElement::parseAttribute): (WebCore::HTMLInputElement::appendFormData): * html/HTMLInputElement.h: * html/InputType.cpp: (WebCore::createInputType): (WebCore::InputType::create): (WebCore::InputType::createText): * html/InputType.h: 2018-05-01 Yusuke Suzuki <utatane.tea@gmail.com> Use pointer instead of std::optional<std::reference_wrapper<>> https://bugs.webkit.org/show_bug.cgi?id=185186 Reviewed by Alex Christensen. std::optional<T&> is not accepted in C++17 spec. So we replaced it with std::optional<std::reference_wrapper<T>>. In this patch, we replace it with T*, which is well-aligned to WebKit's convention. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::iceServersFromConfiguration): (WebCore::RTCPeerConnection::initializeConfiguration): (WebCore::RTCPeerConnection::setConfiguration): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSystemColor): * css/parser/CSSParser.h: * dom/DatasetDOMStringMap.cpp: (WebCore::DatasetDOMStringMap::item const): (WebCore::DatasetDOMStringMap::namedItem const): * dom/DatasetDOMStringMap.h: * dom/Element.cpp: (WebCore::Element::insertAdjacentHTML): * dom/Element.h: * html/canvas/CanvasStyle.cpp: (WebCore::parseColor): * inspector/DOMEditor.cpp: * platform/network/curl/CurlFormDataStream.cpp: (WebCore::CurlFormDataStream::getPostData): * platform/network/curl/CurlFormDataStream.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupPOST): * testing/MockCDMFactory.cpp: (WebCore::MockCDMFactory::keysForSessionWithID const): (WebCore::MockCDMInstance::updateLicense): * testing/MockCDMFactory.h: 2018-05-02 Keith Rollin <krollin@apple.com> Add facility for tracking times and results of page and resource loading https://bugs.webkit.org/show_bug.cgi?id=184838 <rdar://problem/36548974> Reviewed by Brent Fulgham. Update FrameProgressTracker to send the necessary page load start/stop signals so that we can track the entire page load at a network level. Add an empty override of the pure virtual LoaderStrategy::pageLoadCompleted method. No new tests. There is no testable effect from these changes. On Cocoa, measurable changes take place in another (non-WebKit) process. On non-Cocoa systems, this facility is currently disabled. * loader/FrameLoader.cpp: (WebCore::FrameLoader::FrameProgressTracker::progressCompleted): * loader/LoaderStrategy.h: 2018-05-02 Aditya Keerthi <akeerthi@apple.com> Can't copy and paste URLs that have no title into Mail (macOS) https://bugs.webkit.org/show_bug.cgi?id=185205 <rdar://problem/36352406> Reviewed by Tim Horton. The pasteboardURL generated has an empty title for URLs without titles. Currently, the pasteboardURL.title is being saved to the pasteboard. To fix the error, we check whether the title is empty and instead save the lastPathComponent to the pasteboard. This matches current behavior as the fallback title. Augmented WebKitLegacy.ContextMenuCanCopyURL test * platform/mac/PasteboardMac.mm: (WebCore::writeURLForTypes): 2018-05-01 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r225868): Release assert when removing an SVGUseElement from Document::m_svgUseElements https://bugs.webkit.org/show_bug.cgi?id=182188 <rdar://problem/36689240> Reviewed by Antti Koivisto. Fixed the crash by removing up the release assert. The crash is likely caused by re-entrancy to Document::resolveStyle during SVGUseElement::updateShadowTree. Because Document::resolveStyle invokes updateShadowTree on SVG use elements in Document::m_svgUseElements without clearing the map, the nested call to resolveStyle ends up calling updateShadowTree() for all elements in m_svgUseElements and removing them all from the map. When the stack frame eventually comes back to the outer invocation of Document::resolveStyle, updateShadowTree gets invoked for the second time on SVG use elements whose shadow tree had already been updated within the inner invocation to updateShadowTree, and release-asserts. There is an alternative fix: avoid calling updateShadowTree on a svg element when shadowTreeNeedsUpdate returns true on the element in resolveStyle. However, removing the release assert is a sure way to fix the crash so this patch opts for that fix instead especially since we don't have any reproducible test case for this crash. This release assertion was added in r225868 as a cautious measure to catch any use-after-frees of SVGUseElement's since m_svgUseElements stored raw pointes to SVG use elements but this crash is not an indicative of any UAF, and there is no evidence that r225868 has led to new UAFs even after five months. No new tests. I couldn't find a way to trigger a nested style update inside SVGUseElement::updateShadowTree. * dom/Document.cpp: (WebCore::Document::removeSVGUseElement): 2018-05-02 Dirk Schulze <dschulze@chromium.org> getCharNumAtPosition should take DOMPointInit as argument https://bugs.webkit.org/show_bug.cgi?id=184695 Reviewed by Antti Koivisto. Extend existing tests for getCharNumAtPosition. * svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::getCharNumAtPosition): * svg/SVGTextContentElement.h: * svg/SVGTextContentElement.idl: Use DOMPointInit argument. 2018-05-02 Youenn Fablet <youenn@apple.com> Use NetworkLoadChecker for navigation loads https://bugs.webkit.org/show_bug.cgi?id=184892 <rdar://problem/39652686> Reviewed by Chris Dumez. Sanitize headers according response tainting. If tainting is basic, it means same origin load in which case we only filter Cookie related headers. If tainting is Opaque, we filter all uncommon headers. If tainting is CORS, we filter all uncommon headers except the one explicitely allowed by CORS headers. Covered by updated test. * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting): (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields): * platform/network/ResourceResponseBase.h: 2018-05-02 Myles C. Maxfield <mmaxfield@apple.com> Collection fragment identifiers don't use PostScript names https://bugs.webkit.org/show_bug.cgi?id=184624 <rdar://problem/39432089> Reviewed by Simon Fraser. In a previous version of the CSS Fonts spec, there was text saying that items in font collections should be 1-indexed (so the first item would be MyFonts.ttc#1). However, this is unfortunate because inserting an item into the middle of a collection would throw off all content that uses the file. Instead, the spec has since changed to use PostScript names (so the content instead would say MyFonts.ttc#MyFont-Regular). Test: fast/text/font-collection.html * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::load): * loader/cache/CachedFont.cpp: (WebCore::CachedFont::calculateItemInCollection const): (WebCore::CachedFont::ensureCustomFontData): (WebCore::CachedFont::createCustomFontData): (WebCore::CachedFont::calculateIndex const): Deleted. * loader/cache/CachedFont.h: * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::createFontCustomPlatformData): * platform/graphics/mac/FontCustomPlatformData.h: 2018-05-02 Brian Burg <bburg@apple.com> Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected https://bugs.webkit.org/show_bug.cgi?id=184861 <rdar://problem/39153768> Reviewed by Ryosuke Niwa. Notify the client of the current connection count whenever a frontend connects or disconnects. Covered by new API test. * inspector/InspectorClient.h: (WebCore::InspectorClient::frontendCountChanged): * inspector/InspectorController.cpp: (WebCore::InspectorController::connectFrontend): (WebCore::InspectorController::disconnectFrontend): (WebCore::InspectorController::disconnectAllFrontends): * inspector/InspectorController.h: 2018-05-02 Carlos Alberto Lopez Perez <clopez@igalia.com> [GStreamer] Remove unneeded include of gstgldisplay_wayland.h after r228866 and r229022 https://bugs.webkit.org/show_bug.cgi?id=185207 Reviewed by Michael Catanzaro. Remove unneeded include of gstgldisplay_wayland.h No new tests, no change in behaviour. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 2018-05-02 Chris Dumez <cdumez@apple.com> document.open() event listener removal is not immediate https://bugs.webkit.org/show_bug.cgi?id=185191 Reviewed by Darin Adler. We need to make sure we set the 'wasremoved' flag on RegisteredEventListeners whenever they get removed from the EventListenerMap. We were doing so correctly in EventListenerMap:remove() but not EventListenerMap::clear(). This patch updates clear() accordingly. The reason we need to set this flag is that RegisteredEventListeners is RefCounted and EventTarget::fireEventListeners() may be currently running and calling each listener one by one, holding a reference to all listener of a given event. Test: fast/dom/Document/document-open-removes-all-listeners.html * dom/EventListenerMap.cpp: (WebCore::EventListenerMap::clear): 2018-05-02 Zalan Bujtas <zalan@apple.com> Use WeakPtr in GridCell https://bugs.webkit.org/show_bug.cgi?id=185180 <rdar://problem/39432165> Reviewed by Antti Koivisto. Since GridCell does not own the renderers, it should construct weak pointers. Unable to create a reliably reproducible test case. * rendering/Grid.cpp: (WebCore::Grid::insert): (WebCore::GridIterator::nextGridItem): * rendering/Grid.h: * rendering/RenderGrid.cpp: (WebCore::RenderGrid::firstLineBaseline const): 2018-05-02 Eric Carlson <eric.carlson@apple.com> [iOS] Provide audio route information when invoking AirPlay picker https://bugs.webkit.org/show_bug.cgi?id=185199 <rdar://problem/39853103> Reviewed by Jer Noble. No new tests, this requires a specific hardware setup. * dom/Document.cpp: (WebCore::Document::showPlaybackTargetPicker): Pass route sharing policy and routing context UID. * dom/Document.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::showPlaybackTargetPicker): Ditto. * loader/EmptyClients.h: * page/ChromeClient.h: * page/Page.cpp: (WebCore::Page::showPlaybackTargetPicker): Ditto. * page/Page.h: * platform/audio/AudioSession.cpp: (WebCore::AudioSession::routeSharingPolicy const): Empty implementation for non-iOS ports. (WebCore::routingContextUID const): Ditto. * platform/audio/AudioSession.h: * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::routeSharingPolicy const): Return the route sharing policy. (WebCore::AudioSession::routingContextUID const): Return the route context UID. 2018-05-02 Dean Jackson <dino@apple.com> Draw SystemPreview badge to specification on iOS https://bugs.webkit.org/show_bug.cgi?id=185203 <rdar://problem/39908855> Reviewed by Tim Horton. Use CoreImage to render a badge with a blurred background, at particular sizes. This will be tested internally while we're getting artwork from WebKitAdditions. * Configurations/WebCore.xcconfig: Link against CoreImage. * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::paintSystemPreviewBadge): New function in the iOS platform RenderTheme that draws the system preview. 2018-05-01 Brent Fulgham <bfulgham@apple.com> Prevent Debug ASSERT when changing forms https://bugs.webkit.org/show_bug.cgi?id=185173 <rdar://problem/39738669> Reviewed by Ryosuke Niwa. Form submission could trigger a debug assertion during validation when a form is changed during an input submission. Fix this by cleaning up the event handling logic and make it more consistent with modern WebKit coding style. Test: fast/forms/form-submission-crash-3.html * html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::defaultEventHandler): Make sure layout runs before attempting to perform event handling. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::reportValidity): Ditto. (WebCore::HTMLFormElement::validateInteractively): Remove call to perform layout here, since we expect this to happen earlier in the layout pass. Add an assertion that the tree is not dirty. * html/ImageInputType.cpp: (WebCore::ImageInputType::handleDOMActivateEvent): Make sure layout runs before attempting to perform event handling. * html/SubmitInputType.cpp: (WebCore::SubmitInputType::handleDOMActivateEvent): Ditto. 2018-05-02 Jer Noble <jer.noble@apple.com> Unreviewed; address review comments made before landing r231231. * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::volume const): 2018-05-02 Jer Noble <jer.noble@apple.com> Pipe volume through PlaybackSessionManager/Proxy. https://bugs.webkit.org/show_bug.cgi?id=185182 Reviewed by Eric Carlson. Add support for the volume property to PlaybackSessionModel, and all its clients. * platform/cocoa/PlaybackSessionModel.h: (WebCore::PlaybackSessionModelClient::volumeChanged): * platform/cocoa/PlaybackSessionModelMediaElement.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::updateForEventName): (WebCore::PlaybackSessionModelMediaElement::setVolume): (WebCore::PlaybackSessionModelMediaElement::volume const): * platform/ios/PlaybackSessionInterfaceAVKit.h: * platform/ios/PlaybackSessionInterfaceAVKit.mm: (WebCore::PlaybackSessionInterfaceAVKit::volumeChanged): * platform/ios/WebAVPlayerController.h: * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController volume]): (-[WebAVPlayerController setVolume:]): (-[WebAVPlayerController volumeChanged:]): (-[WebAVPlayerController resetMediaState]): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::volumeChanged): (VideoFullscreenControllerContext::volume const): (VideoFullscreenControllerContext::setVolume): 2018-05-01 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, fix build in WinCairo https://bugs.webkit.org/show_bug.cgi?id=185169 * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSDOMWindowBase.h: 2018-05-01 Yusuke Suzuki <utatane.tea@gmail.com> Use default std::optional if it is provided https://bugs.webkit.org/show_bug.cgi?id=185159 Reviewed by JF Bastien. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::iceServersFromConfiguration): (WebCore::RTCPeerConnection::setConfiguration): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSystemColor): * css/parser/CSSParser.h: * dom/DatasetDOMStringMap.cpp: (WebCore::DatasetDOMStringMap::item const): (WebCore::DatasetDOMStringMap::namedItem const): (WebCore:: const): Deleted. * dom/DatasetDOMStringMap.h: * dom/Element.cpp: (WebCore::Element::insertAdjacentHTML): * dom/Element.h: * inspector/DOMEditor.cpp: * platform/network/curl/CurlFormDataStream.cpp: (WebCore::CurlFormDataStream::getPostData): (): Deleted. * platform/network/curl/CurlFormDataStream.h: * testing/MockCDMFactory.cpp: (WebCore::MockCDMFactory::keysForSessionWithID const): (WebCore::MockCDMInstance::updateLicense): (WebCore:: const): Deleted. * testing/MockCDMFactory.h: 2018-05-01 Chris Dumez <cdumez@apple.com> Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue https://bugs.webkit.org/show_bug.cgi?id=185181 Reviewed by Geoffrey Garen. Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue on iOS WebKitLegacy (Bug 185073). It appears readStreamCallback() can get called on the UIThread, which should not be possible if scheduleStreams() was called on the WebThread, as it is supposed to. The new release assertion in scheduleStreams() should tell us if somebody is calling it from the UIthread instead of the WebThread on iOS WebKitLegacy. * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::scheduleStreams): (WebCore::SocketStreamHandleImpl::readStreamCallback): 2018-05-01 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, remove an unused variable in RuntimeEnabledFeatures.h * page/RuntimeEnabledFeatures.h: 2018-05-01 Oleksandr Skachkov <gskachkov@gmail.com> Fix build error after r231194 https://bugs.webkit.org/show_bug.cgi?id=185169 Reviewed by JF Bastien. Prevent compile error in iOS Simulator debug build by tagging function * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): 2018-05-01 Oleksandr Skachkov <gskachkov@gmail.com> WebAssembly: add support for stream APIs - JavaScript API https://bugs.webkit.org/show_bug.cgi?id=183442 Reviewed by Yusuke Suzuki and JF Bastien. Add WebAssembly streaming API to WebCore. * Configurations/FeatureDefines.xcconfig: * bindings/js/JSDOMWindowBase.cpp: (WebCore::tryAllocate): (WebCore::isResponseCorrect): (WebCore::handleResponseOnStreamingAction): (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSRemoteDOMWindowBase.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: 2018-04-30 Myles C. Maxfield <mmaxfield@apple.com> Improve the performance of FontCascadeDescription's effectiveFamilies https://bugs.webkit.org/show_bug.cgi?id=184720 <rdar://problem/38970927> Reviewed by Simon Fraser. The page that had the performance problem renders many different Chinese characters in system-ui with only a small number of individual fonts. It turns out we were calling into the system-ui machinery for each character in order to opportunistically start loading data URLs (see also: https://bugs.webkit.org/show_bug.cgi?id=175845). These data URLS will never represent the system font, so we don't need to invoke the system-ui machinery at all. This patch makes a 92x performance improvement on the associated performance test. This test is designed to test Chinese text rendered with system-ui. Performance test: Layout/system-ui.html * platform/graphics/FontCascadeFonts.cpp: (WebCore::opportunisticallyStartFontDataURLLoading): 2018-04-30 Jer Noble <jer.noble@apple.com> <img src=mp4> does not display on ios despite Accept: video/* advertisement https://bugs.webkit.org/show_bug.cgi?id=185029 <rdar://problem/39771989> Reviewed by Eric Carlson. Returning "NO" from resourceLoader:shouldWaitForLoadingOfResource: signals that the load failed, even if the resource request is successfully fulfilled prior to the return. Always return YES in the case that loading succeeded. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]): 2018-04-30 Zalan Bujtas <zalan@apple.com> REGRESSION(r230914) Selecting text on this apple.com page makes it vanish https://bugs.webkit.org/show_bug.cgi?id=185142 <rdar://problem/39821446> Reviewed by Simon Fraser. Set the overflow rect on the inline textbox when needed. Test: fast/text/simple-line-layout-selection-with-overflow.html * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::initializeInlineTextBox): (WebCore::SimpleLineLayout::generateLineBoxTree): (WebCore::SimpleLineLayout::initializeInlineBox): Deleted. 2018-04-30 JF Bastien <jfbastien@apple.com> Use some C++17 features https://bugs.webkit.org/show_bug.cgi?id=185135 Reviewed by Alex Christensen. As discussed here [0] let's move WebKit to a subset of C++17. We now require GCC 6 [1] which means that, according to [2] we can use the following C++17 language features (I removed some uninteresting ones): - New auto rules for direct-list-initialization - static_assert with no message - typename in a template template parameter - Nested namespace definition - Attributes for namespaces and enumerators - u8 character literals - Allow constant evaluation for all non-type template arguments - Fold Expressions - Unary fold expressions and empty parameter packs - __has_include in preprocessor conditional - Differing begin and end types in range-based for - Improving std::pair and std::tuple Consult the Tony Tables [3] to see before / after examples. Of course we can use any library feature if we're willing to import them to WTF (and they don't require language support). [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html [1]: https://trac.webkit.org/changeset/231152/webkit [2]: https://en.cppreference.com/w/cpp/compiler_support [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md * DerivedSources.make: * platform/URLParser.cpp: work around an odd GCC 6 bug with class static value as a template parameter. (WebCore::URLParser::percentDecode): (WebCore::URLParser::domainToASCII): (WebCore::URLParser::hasForbiddenHostCodePoint): (WebCore::URLParser::parseHostAndPort): * platform/URLParser.h: 2018-04-30 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width https://bugs.webkit.org/show_bug.cgi?id=185132 <rdar://problem/39834562> Reviewed by Tim Horton. Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the `shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail. Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html. * dom/ViewportArguments.cpp: (WebCore::setViewportFeature): (WebCore::operator<<): * dom/ViewportArguments.h: Removes the `minDeviceWidth` viewport argument. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): Deleted. Removes the runtime switch for `min-device-width`. * page/ViewportConfiguration.cpp: (WebCore::platformDeviceWidthOverride): Hard-code the override device width in extra zoom mode. (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const): In extra zoom mode, override the device width only if shrink-to-fit has not been expliticly disabled, and the device width is less than the override device width. (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const): (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const): (WebCore::ViewportConfiguration::updateConfiguration): (WebCore::ViewportConfiguration::updateMinimumLayoutSize): Do not override the minimum layout size if `shrink-to-fit` has been explicitly explicitly disabled, or if the device width is greater than the override device width. (WebCore::computedMinDeviceWidth): Deleted. (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Deleted. * page/ViewportConfiguration.h: 2018-04-30 Chris Nardi <cnardi@chromium.org> Serialize font-variation-settings with double-quotes per spec https://bugs.webkit.org/show_bug.cgi?id=182542 Reviewed by Myles C. Maxfield. According to the CSSOM spec [1], all strings should be serialized with double-quotes. The axis name in font-variation-settings was previously serialized with single-quotes; change this to double-quotes to match the spec and non-WebKit browsers. [1]: https://drafts.csswg.org/cssom/#common-serializing-idioms Updated fast/text/variations/getComputedStyle.html to test the change. * css/CSSFontVariationValue.cpp: (WebCore::CSSFontVariationValue::customCSSText const): 2018-04-30 Chris Dumez <cdumez@apple.com> Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages() https://bugs.webkit.org/show_bug.cgi?id=185134 Reviewed by Geoffrey Garen. Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages(). This code runs on iOS WebKitLegacy and it is therefore unsafe to use RunLoop::main() here. We want to use callOnMainThread() instead to run code on the WebThread. * dom/MessagePort.cpp: (WebCore::MessagePort::dispatchMessages): 2018-04-30 Simon Fraser <simon.fraser@apple.com> Make color-filter affect caret-color https://bugs.webkit.org/show_bug.cgi?id=185129 rdar://problem/39829066 Reviewed by Tim Horton. Transform the colors used to compare the caret color with the background through color-filter (since we want contrasting colors after filters are applied), and transform caret-color itself. Test: css3/color-filters/color-filter-caret-color.html * editing/FrameSelection.cpp: (WebCore::CaretBase::paintCaret const): 2018-04-30 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Webkit should spoof as Safari on a Mac when on Chase.com https://bugs.webkit.org/show_bug.cgi?id=185103 Reviewed by Carlos Garcia Campos. Send a fake user agent to chase.com to make it work. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresMacintoshPlatform): (WebCore::UserAgentQuirks::stringForQuirk): Also, remove this stale comment. 2018-04-29 Simon Fraser <simon.fraser@apple.com> Make color-filter affect <attachment> https://bugs.webkit.org/show_bug.cgi?id=185122 rdar://problem/39818763 Reviewed by Tim Horton. Convert the colors used to render <attachment> through color-filter, except for those parts that render over the icon (like the progress bar). Not easily testable. * rendering/RenderThemeMac.mm: (WebCore::titleTextColorForAttachment): (WebCore::AttachmentLayout::layOutTitle): (WebCore::AttachmentLayout::layOutSubtitle): (WebCore::paintAttachmentIconBackground): (WebCore::paintAttachmentTitleBackground): (WebCore::paintAttachmentPlaceholderBorder): 2018-04-28 Simon Fraser <simon.fraser@apple.com> Fix color-filter to apply to SVG colors https://bugs.webkit.org/show_bug.cgi?id=185113 rdar://problem/39665082 Reviewed by Dean Jackson. Convert SVG colors through color-filter operations for the places in SVG that use color, namely fill and stroke, gradients, lighting colors and drop-shadow. Test: css3/color-filters/svg/color-filter-inline-svg.html * rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::applyResource): * rendering/svg/RenderSVGResourceGradient.h: * rendering/svg/RenderSVGResourceLinearGradient.cpp: (WebCore::RenderSVGResourceLinearGradient::buildGradient const): * rendering/svg/RenderSVGResourceLinearGradient.h: * rendering/svg/RenderSVGResourceRadialGradient.cpp: (WebCore::RenderSVGResourceRadialGradient::buildGradient const): * rendering/svg/RenderSVGResourceRadialGradient.h: * rendering/svg/RenderSVGResourceSolidColor.cpp: (WebCore::RenderSVGResourceSolidColor::applyResource): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute): (WebCore::SVGFEDiffuseLightingElement::build): * svg/SVGFEDropShadowElement.cpp: (WebCore::SVGFEDropShadowElement::build): * svg/SVGFEFloodElement.cpp: (WebCore::SVGFEFloodElement::build): * svg/SVGFESpecularLightingElement.cpp: (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute): (WebCore::SVGFESpecularLightingElement::build): 2018-04-29 Michael Catanzaro <mcatanzaro@igalia.com> [CMake] Require GCC 6 https://bugs.webkit.org/show_bug.cgi?id=184985 Reviewed by Alex Christensen. Remove a GCC 5 fallback path. This seems to be the only such fallback path in WebKit. * platform/graphics/FourCC.h: (WebCore::FourCC::FourCC): 2018-04-29 Zalan Bujtas <zalan@apple.com> [LFC] Implement Display::Box functions https://bugs.webkit.org/show_bug.cgi?id=185116 Reviewed by Antti Koivisto. * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): (WebCore::Display::Box::~Box): (WebCore::Display::Box::marginBox const): (WebCore::Display::Box::borderBox const): (WebCore::Display::Box::paddingBox const): (WebCore::Display::Box::contentBox const): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::rect const): (WebCore::Display::Box::top const): (WebCore::Display::Box::left const): (WebCore::Display::Box::bottom const): (WebCore::Display::Box::right const): (WebCore::Display::Box::topLeft const): (WebCore::Display::Box::bottomRight const): (WebCore::Display::Box::size const): (WebCore::Display::Box::width const): (WebCore::Display::Box::height const): (WebCore::Display::Box::marginTop const): (WebCore::Display::Box::marginLeft const): (WebCore::Display::Box::marginBottom const): (WebCore::Display::Box::marginRight const): (WebCore::Display::Box::parent const): (WebCore::Display::Box::nextSibling const): (WebCore::Display::Box::previousSibling const): (WebCore::Display::Box::firstChild const): (WebCore::Display::Box::lastChild const): (WebCore::Display::Box::setRect): (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setSize): (WebCore::Display::Box::setWidth): (WebCore::Display::Box::setHeight): (WebCore::Display::Box::setMarginTop): (WebCore::Display::Box::setMarginLeft): (WebCore::Display::Box::setMarginBottom): (WebCore::Display::Box::setMarginRight): (WebCore::Display::Box::setBorderTop): (WebCore::Display::Box::setBorderLeft): (WebCore::Display::Box::setBorderBottom): (WebCore::Display::Box::setBorderRight): (WebCore::Display::Box::setPaddingTop): (WebCore::Display::Box::setPaddingLeft): (WebCore::Display::Box::setPaddingBottom): (WebCore::Display::Box::setPaddingRight): (WebCore::Display::Box::setParent): (WebCore::Display::Box::setNextSibling): (WebCore::Display::Box::setPreviousSibling): (WebCore::Display::Box::setFirstChild): (WebCore::Display::Box::setLastChild): 2018-04-29 Youenn Fablet <youenn@apple.com> Make RestrictedHTTPResponseAccess flag true by default https://bugs.webkit.org/show_bug.cgi?id=185089 Reviewed by Geoffrey Garen. * page/RuntimeEnabledFeatures.h: 2018-04-28 Sihui Liu <sihui_liu@apple.com> [Cocoa] Set HTTPOnly flag when converting Cookie to NSHTTPCookie https://bugs.webkit.org/show_bug.cgi?id=185052 Reviewed by Geoffrey Garen. Set HTTPOnly for NSHTTPCookie when it's converted from Cookie, so the WebKit APIs could create NSHTTPCookie with correct HTTPOnly flag. Also, reverted the change made to operator function because we want the Cookie class to act as a wrapper for NSHTTPCookie and leverage its equal function. Modified API test: WebKit.WKHTTPCookieStoreHttpOnly * platform/network/cocoa/CookieCocoa.mm: (WebCore::Cookie::operator NSHTTPCookie * const): (WebCore::Cookie::operator== const): * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::deleteCookie): 2018-04-28 Zalan Bujtas <zalan@apple.com> [LFC] Add LayoutTreeBuilder class to generate the layout tree https://bugs.webkit.org/show_bug.cgi?id=185108 Reviewed by Antti Koivisto. This is for testing purposes. * WebCore.xcodeproj/project.pbxproj: * layout/FormattingState.cpp: (WebCore::Layout::FormattingState::~FormattingState): * layout/FormattingState.h: * layout/LayoutContext.h: * layout/blockformatting/BlockFormattingState.cpp: (WebCore::Layout::BlockFormattingState::~BlockFormattingState): * layout/blockformatting/BlockFormattingState.h: * layout/inlineformatting/InlineFormattingState.cpp: (WebCore::Layout::InlineFormattingState::~InlineFormattingState): * layout/inlineformatting/InlineFormattingState.h: * layout/layouttree/LayoutBlockContainer.h: * layout/layouttree/LayoutBox.h: * layout/layouttree/LayoutContainer.h: * layout/layouttree/LayoutInlineContainer.h: * layout/layouttree/LayoutTreeBuilder.cpp: Added. (WebCore::Layout::TreeBuilder::createLayoutTree): (WebCore::Layout::TreeBuilder::createSubTree): (WebCore::Layout::outputLayoutBox): (WebCore::Layout::outputLayoutTree): (WebCore::Layout::TreeBuilder::showLayoutTree): (WebCore::Layout::printLayoutTreeForLiveDocuments): * layout/layouttree/LayoutTreeBuilder.h: Copied from Source/WebCore/layout/layouttree/LayoutBlockContainer.h. * page/mac/PageMac.mm: (WebCore::Page::platformInitialize): 2018-04-28 Zalan Bujtas <zalan@apple.com> [LFC] Implement BlockMarginCollapse functions. https://bugs.webkit.org/show_bug.cgi?id=185036 Reviewed by Antti Koivisto. * layout/blockformatting/BlockMarginCollapse.cpp: (WebCore::Layout::marginValue): (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse): (WebCore::Layout::BlockMarginCollapse::marginTop const): (WebCore::Layout::BlockMarginCollapse::marginBottom const): (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const): (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const): (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const): (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const): (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const): (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const): (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const): (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const): (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const): * layout/blockformatting/BlockMarginCollapse.h: * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::style const): 2018-04-27 David Kilzer <ddkilzer@apple.com> Add logging when SpringBoard enables WebThread <https://webkit.org/b/185100> <rdar://problem/39746542> Reviewed by Daniel Bates. * platform/RuntimeApplicationChecks.h: (WebCore::IOSApplication::isSpringBoard): Add declaration. * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isSpringBoard): Add implementation. * platform/ios/wak/WebCoreThread.mm: (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by SpringBoard. 2018-04-27 Keith Rollin <krollin@apple.com> Fix crash in DocumentLoader::startLoadingMainResource https://bugs.webkit.org/show_bug.cgi?id=185088 rdar://problem/39689263 Reviewed by Chris Dumez. Add a "protectedThis" to address a case where a deleted "this" was accessed in a RELEASE_LOG statement. No new tests -- covered by existing tests, which now pass. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource): 2018-04-27 Simon Fraser <simon.fraser@apple.com> Implement color-filter for text stroke https://bugs.webkit.org/show_bug.cgi?id=185098 Reviewed by Alan Bujtas. Transform the text stroke color through color-filter. Test: css3/color-filters/color-filter-text-stroke.html * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): 2018-04-27 Simon Fraser <simon.fraser@apple.com> Implement animation for color-filter https://bugs.webkit.org/show_bug.cgi?id=185092 rdar://problem/39773810 Reviewed by Tim Horton. Implement animation of color-filter. This requires tracking whether the color-filter function lists match for both old and new animation code paths. The filter-related ProperyWappers in CSSPropertyAnimation are cleaned up to use a single wrapper, which has to pass the propertyID to the blend function so we know which "lists match" to check. This wrapper reports that its accelerated for filter and backdrop-filter, but not color-filter. Test: css3/color-filters/color-filter-animation.html * animation/CSSPropertyBlendingClient.h: * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::checkForMatchingColorFilterFunctionLists): * animation/KeyframeEffectReadOnly.h: * page/animation/AnimationBase.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::PropertyWrapperFilter::PropertyWrapperFilter): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): (WebCore::PropertyWrapperAcceleratedFilter::PropertyWrapperAcceleratedFilter): Deleted. (WebCore::PropertyWrapperAcceleratedBackdropFilter::PropertyWrapperAcceleratedBackdropFilter): Deleted. (WebCore::PropertyWrapperAcceleratedBackdropFilter::animationIsAccelerated const): Deleted. (WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const): Deleted. * page/animation/ImplicitAnimation.cpp: (WebCore::ImplicitAnimation::reset): (WebCore::ImplicitAnimation::checkForMatchingColorFilterFunctionLists): * page/animation/ImplicitAnimation.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::KeyframeAnimation): (WebCore::KeyframeAnimation::checkForMatchingColorFilterFunctionLists): * page/animation/KeyframeAnimation.h: 2018-04-27 Zalan Bujtas <zalan@apple.com> [LFC] Add FormattingContext::computeWidth/computeHeight logic. https://bugs.webkit.org/show_bug.cgi?id=185091 Reviewed by Antti Koivisto. Inflow width and height can't really be computed without knowing the exact context. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::computeWidth const): (WebCore::Layout::FormattingContext::computeHeight const): (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): (WebCore::Layout::FormattingContext::computeFloatingWidth const): (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): (WebCore::Layout::FormattingContext::computeFloatingHeight const): * layout/FormattingContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): (WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted. (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const): (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const): * layout/inlineformatting/InlineFormattingContext.h: 2018-04-27 Chris Dumez <cdumez@apple.com> Use WindowProxy instead of DOMWindow in our IDL https://bugs.webkit.org/show_bug.cgi?id=185022 Reviewed by Sam Weinig. Stop using DOMWindow in all of our IDL files and use WindowProxy as per their respective specifications. As a result, the implementation as also updated to use WindowProxy type instead of DOMWindow. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMConvertWindowProxy.h: Removed. * bindings/js/JSWindowProxy.cpp: (WebCore::JSWindowProxy::windowProxy const): (WebCore::JSWindowProxy::toWrapped): * bindings/js/JSWindowProxy.h: (WebCore::window): Use static_cast<>() instead of jsCast<>() because jsCast<>() relies on classInfo() which is not allowed to be called during JS sweep due to an assertion inside classInfo(). The JSWindowProxy objects are held strongly by the WindowProxy so we know the JSWindowProxy object is not getting destroyed here. (WebCore::toJS): * bindings/js/WindowProxy.cpp: (WebCore::WindowProxy::globalObject): * bindings/js/WindowProxy.h: (WebCore::WindowProxy::frame const): * bindings/scripts/CodeGenerator.pm: (IsBuiltinType): (ComputeIsCallbackInterface): (ComputeIsCallbackFunction): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): (NativeToJSValueDOMConvertNeedsState): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher): * bindings/scripts/test/TestObj.idl: * dom/CompositionEvent.cpp: (WebCore::CompositionEvent::CompositionEvent): (WebCore::CompositionEvent::initCompositionEvent): * dom/CompositionEvent.h: * dom/CompositionEvent.idl: * dom/Document.cpp: (WebCore::Document::defaultView const): * dom/Document.h: * dom/Document.idl: * dom/DocumentTouch.cpp: (WebCore::DocumentTouch::createTouch): * dom/DocumentTouch.h: * dom/DocumentTouch.idl: * dom/FocusEvent.cpp: (WebCore::FocusEvent::FocusEvent): * dom/FocusEvent.h: * dom/InputEvent.cpp: (WebCore::InputEvent::create): (WebCore::InputEvent::InputEvent): * dom/InputEvent.h: * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): (WebCore::KeyboardEvent::create): (WebCore::KeyboardEvent::initKeyboardEvent): (WebCore::KeyboardEvent::charCode const): * dom/KeyboardEvent.h: * dom/KeyboardEvent.idl: * dom/MessageEvent.h: * dom/MessageEvent.idl: * dom/MouseEvent.cpp: (WebCore::MouseEvent::create): (WebCore::MouseEvent::MouseEvent): (WebCore::MouseEvent::initMouseEvent): (WebCore::MouseEvent::initMouseEventQuirk): * dom/MouseEvent.h: * dom/MouseEvent.idl: * dom/MouseRelatedEvent.cpp: (WebCore::MouseRelatedEvent::MouseRelatedEvent): (WebCore::MouseRelatedEvent::init): (WebCore::MouseRelatedEvent::frameViewFromWindowProxy): (WebCore::MouseRelatedEvent::initCoordinates): (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const): (WebCore::MouseRelatedEvent::computePageLocation): (WebCore::MouseRelatedEvent::locationInRootViewCoordinates const): * dom/MouseRelatedEvent.h: * dom/Node.cpp: * dom/SimulatedClick.cpp: * dom/TextEvent.cpp: (WebCore::TextEvent::create): (WebCore::TextEvent::createForPlainTextPaste): (WebCore::TextEvent::createForFragmentPaste): (WebCore::TextEvent::createForDrop): (WebCore::TextEvent::createForDictation): (WebCore::TextEvent::TextEvent): (WebCore::TextEvent::initTextEvent): * dom/TextEvent.h: * dom/TextEvent.idl: * dom/TouchEvent.idl: * dom/UIEvent.cpp: (WebCore::UIEvent::UIEvent): (WebCore::UIEvent::initUIEvent): * dom/UIEvent.h: (WebCore::UIEvent::create): (WebCore::UIEvent::view const): * dom/UIEvent.idl: * dom/UIEventInit.h: * dom/UIEventInit.idl: * dom/UIEventWithKeyState.h: (WebCore::UIEventWithKeyState::UIEventWithKeyState): * dom/WheelEvent.cpp: (WebCore::WheelEvent::WheelEvent): (WebCore::WheelEvent::create): (WebCore::WheelEvent::initWebKitWheelEvent): * dom/WheelEvent.h: * dom/WheelEvent.idl: * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::insertDictatedText): * editing/Editor.cpp: (WebCore::Editor::pasteAsPlainText): (WebCore::Editor::pasteAsFragment): (WebCore::Editor::setComposition): * html/HTMLDocument.cpp: (WebCore::HTMLDocument::namedItem): * html/HTMLDocument.h: * html/HTMLDocument.idl: * html/HTMLFrameElement.idl: * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::contentWindow const): * html/HTMLFrameOwnerElement.h: * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::namedItem): * html/HTMLFrameSetElement.h: * html/HTMLFrameSetElement.idl: * html/HTMLIFrameElement.idl: * html/ImageDocument.cpp: * page/DOMWindow.cpp: (WebCore::PostMessageTimer::PostMessageTimer): (WebCore::PostMessageTimer::event): (WebCore::DOMWindow::postMessage): * page/DragController.cpp: (WebCore::DragController::dispatchTextInputEventFor): * page/EventHandler.cpp: (WebCore::EventHandler::handleTextInputEvent): 2018-04-27 Nan Wang <n_wang@apple.com> AX: Accessibility needs to know which part of the content view is visible on iOS https://bugs.webkit.org/show_bug.cgi?id=185085 <rdar://problem/39801363> Reviewed by Chris Fleizach. Exposed unobscuredContentRect() to iOS accessibility object wrapper. Test: accessibility/ios-simulator/unobscured-content-rect.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]): 2018-04-27 Simon Fraser <simon.fraser@apple.com> Refactor filter list checking code https://bugs.webkit.org/show_bug.cgi?id=185087 Reviewed by Alan Bujtas. Deduplicate code between filter and backdrop-filter for checking whether function lists match, by making a shared function that takes a std::function. The call sites have to declare the return type (-> const FilterOperations&) to avoid std::function converting the return type into a value. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists const): (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists): (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists): * animation/KeyframeEffectReadOnly.h: * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists const): (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists): (WebCore::KeyframeAnimation::checkForMatchingBackdropFilterFunctionLists): * page/animation/KeyframeAnimation.h: 2018-04-27 Chris Dumez <cdumez@apple.com> Regression(r222392?): Events can have a negative timestamp which causes app breakage https://bugs.webkit.org/show_bug.cgi?id=185040 <rdar://problem/39638051> Reviewed by Wenson Hsieh. The real fix is in UIKit when generating the touch timestamps. However, this patch does some hardening to make sure that Event.timestamp can never return a negative value even if something goes wrong. * dom/Event.cpp: (WebCore::Event::timeStampForBindings const): 2018-04-27 Christopher Reid <chris.reid@sony.com> URL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function https://bugs.webkit.org/show_bug.cgi?id=184836 Reviewed by Alex Christensen. Update URL::appendEncodedHostName to use uidna_nameToASCII as done in r208902. Test: LayoutTests\fast\url\url-hostname-encoding.html * platform/URL.cpp: 2018-04-27 Youenn Fablet <youenn@apple.com> CachedRawResource is not handling incremental data computation correctly https://bugs.webkit.org/show_bug.cgi?id=184936 <rdar://problem/38798141> Reviewed by Darin Adler. * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::updateBuffer): Fixing style. 2018-04-27 Zalan Bujtas <zalan@apple.com> [LFC] Implement BlockFormattingContext::layout logic and its dependencies https://bugs.webkit.org/show_bug.cgi?id=185024 Reviewed by Antti Koivisto. This patch implements the logic for block formatting context according to https://www.w3.org/TR/CSS22/visuren.html#block-formatting 1. Traverse the tree iteratively (in post-order fashion) and compute the width/static position for the containers as we visit the descendant nodes until we hit a leaf node. 2. Compute the position/geometry of the leaf node and move over to its sibling(s). 3. Finalize the container's height/final position as we climb back on the tree. 4. Run layout on the out-of-flow descendants. Note that subtrees with a formatting context root need to be laid out completely before moving on to the next box. The formatting root box is laid out in the formatting context it lives in, however its descendants get laid out in a separate formatting context (excluding out-of-flow boxes that don't belong to the root). * layout/FloatingContext.cpp: (WebCore::Layout::FloatingContext::FloatingContext): (WebCore::Layout::FloatingContext::computePosition): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const): (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): * layout/FormattingContext.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::updateLayout): (WebCore::Layout::LayoutContext::establishedFormattingState): * layout/LayoutContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::layout const): (WebCore::Layout::BlockFormattingContext::layout): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::layout const): (WebCore::Layout::InlineFormattingContext::layout): Deleted. * layout/inlineformatting/InlineFormattingContext.h: 2018-04-27 Youenn Fablet <youenn@apple.com> Use NetworkLoadChecker for XHR/fetch loads https://bugs.webkit.org/show_bug.cgi?id=184741 Reviewed by Chris Dumez. Covered by existing tests. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const): We need to set this option for CORS done in NetworkProcess. (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Set httpHeadersTokeep when needed (service worker or CORS loads). Remove the synchronous disabling of preflight since this is now also done for asynchronous loads. (WebCore::DocumentThreadableLoader::checkURLSchemeAsCORSEnabled): Helper routine to make the same check for both simple and preflight case. This allows more consistent error logging between WK1 and WK2. (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest): Skip preflight in case this is done in NetworkProcess. (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): (WebCore::isResponseComingFromNetworkProcess): (WebCore::DocumentThreadableLoader::redirectReceived): Bypass security checks when they are already done in NetworkProcess. (WebCore::DocumentThreadableLoader::didFail): In case of AccessControl error, it might be due to a CSP check done in NetworkProcess. Check it again to enable specific CSP console logging and error reporting. (WebCore::DocumentThreadableLoader::loadRequest): Recreating the error in case of synchronous loads to be able to log it adequately. (WebCore::DocumentThreadableLoader::isDoingSecurityChecksInNetworkProcess const): * loader/DocumentThreadableLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Specific handling of SameOrigin credential mode for which cross-origin load will not use any credential. (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): We keep the application headers so that DocumentThreadableLoader does not have to restart a brand new load. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestResource): DocumentThreadableLoader is setting referrer and origin directly. Until we fix that, we remove them from the original requests as applications are not supposed to set these headers. 2018-04-27 Wenson Hsieh <wenson_hsieh@apple.com> Add an experimental feature flag for viewport "min-device-width" https://bugs.webkit.org/show_bug.cgi?id=185050 <rdar://problem/39624038> Reviewed by Tim Horton. Add MinDeviceWidthEnabled as a new runtime-enabled feature. * dom/ViewportArguments.cpp: (WebCore::setViewportFeature): Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): 2018-04-27 Simon Fraser <simon.fraser@apple.com> Make color-filter transform gradient colors https://bugs.webkit.org/show_bug.cgi?id=185080 Reviewed by Zalan Bujtas. In CSSGradientValue::computeStops(), transform the color of each gradient color stop through the color filter. Having a color filter makes the gradient uncacheable. Color filters can add alpha, so we also have to fix up CSSGradientValue::knownToBeOpaque() to take a RenderStyle and convert the colors before testing opaqueness. Clean up some related functions to take const RenderStyle&. Test: css3/color-filters/color-filter-gradients.html * css/CSSCrossfadeValue.cpp: (WebCore::subimageKnownToBeOpaque): * css/CSSFilterImageValue.cpp: (WebCore::CSSFilterImageValue::knownToBeOpaque const): * css/CSSFilterImageValue.h: * css/CSSGradientValue.cpp: (WebCore::CSSGradientValue::image): (WebCore::CSSGradientValue::computeStops): (WebCore::CSSGradientValue::knownToBeOpaque const): (WebCore::CSSLinearGradientValue::createGradient): (WebCore::CSSRadialGradientValue::createGradient): * css/CSSGradientValue.h: * css/CSSImageGeneratorValue.cpp: (WebCore::CSSImageGeneratorValue::knownToBeOpaque const): * css/CSSImageValue.cpp: (WebCore::CSSImageValue::knownToBeOpaque const): * css/CSSImageValue.h: 2018-04-26 Simon Fraser <simon.fraser@apple.com> Fix color-filter to apply to text decorations https://bugs.webkit.org/show_bug.cgi?id=185068 <rdar://problem/39782136> Reviewed by Alan Bujtas. Transform the colors of text shadows, and the shadows of text-decorations through the color-filter. Rather than clone the ShadowData stored on TextPainter and TextDecorationPainter (which would have awkward ownership implications) we pass the color filters through and just map the color through it before painting. Re-order the members of TextPainter a little to optimize padding. Also fix a bug where FilterOperations::transformColor() could transform an invalid color to a valid one; we never want this. Tests: css3/color-filters/color-filter-text-decoration-shadow.html css3/color-filters/color-filter-text-shadow.html * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintMarkedTextForeground): (WebCore::InlineTextBox::paintMarkedTextDecoration): * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::paintTextDecoration): * rendering/TextDecorationPainter.h: (WebCore::TextDecorationPainter::setTextShadow): (WebCore::TextDecorationPainter::setShadowColorFilter): (WebCore::TextDecorationPainter::addTextShadow): Deleted. * rendering/TextPainter.cpp: (WebCore::ShadowApplier::ShadowApplier): (WebCore::TextPainter::paintTextWithShadows): (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): Simplify the logic that only paints the shadow on the first iteration. (WebCore::TextPainter::paintRange): * rendering/TextPainter.h: (WebCore::TextPainter::setShadowColorFilter): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::paintTextWithShadows): 2018-04-27 Wenson Hsieh <wenson_hsieh@apple.com> Rename minimumLayoutSize to viewLayoutSize https://bugs.webkit.org/show_bug.cgi?id=185050 <rdar://problem/39624038> Reviewed by Tim Horton. See WebKit/ChangeLog for more information. No change in behavior. * page/ViewportConfiguration.cpp: (WebCore::ViewportConfiguration::ViewportConfiguration): (WebCore::ViewportConfiguration::setViewLayoutSize): Remove a FIXME comment that is addressed by this refactoring. (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): (WebCore::ViewportConfiguration::initialScaleFromSize const): (WebCore::ViewportConfiguration::minimumScale const): (WebCore::ViewportConfiguration::updateMinimumLayoutSize): (WebCore::ViewportConfiguration::setMinimumLayoutSize): Deleted. * page/ViewportConfiguration.h: (WebCore::ViewportConfiguration::viewLayoutSize const): (WebCore::ViewportConfiguration::viewSize const): Deleted. 2018-04-27 Zalan Bujtas <zalan@apple.com> [LFC] Formatting contexts should create floating states. https://bugs.webkit.org/show_bug.cgi?id=185032 Reviewed by Antti Koivisto. This patch implements the logic for sharing floating states across multiple formatting contexts. At this point this is mostly about inline formatting contexts. They either create a new floating state or inherit it from the parent formatting context. * layout/FloatingState.cpp: (WebCore::Layout::FloatingState::FloatingState): * layout/FloatingState.h: (WebCore::Layout::FloatingState::create): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::FormattingContext): * layout/FormattingContext.h: (WebCore::Layout::FormattingContext::layoutContext const): * layout/FormattingState.cpp: (WebCore::Layout::FormattingState::FormattingState): * layout/FormattingState.h: (WebCore::Layout::FormattingState::floatingState const): * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::updateLayout): (WebCore::Layout::LayoutContext::formattingStateForBox const): (WebCore::Layout::LayoutContext::establishedFormattingState): (WebCore::Layout::LayoutContext::formattingContext): (WebCore::Layout::LayoutContext::formattingState): Deleted. * layout/LayoutContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::BlockFormattingContext): (WebCore::Layout::BlockFormattingContext::createFormattingState const): (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const): (WebCore::Layout::BlockFormattingContext::formattingState const): Deleted. * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingState.cpp: (WebCore::Layout::BlockFormattingState::BlockFormattingState): * layout/blockformatting/BlockFormattingState.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::InlineFormattingContext): (WebCore::Layout::InlineFormattingContext::createFormattingState const): (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const): (WebCore::Layout::InlineFormattingContext::formattingState const): Deleted. * layout/inlineformatting/InlineFormattingContext.h: * layout/inlineformatting/InlineFormattingState.cpp: (WebCore::Layout::InlineFormattingState::InlineFormattingState): * layout/inlineformatting/InlineFormattingState.h: * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::formattingContextRoot const): * layout/layouttree/LayoutBox.h: 2018-04-27 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode https://bugs.webkit.org/show_bug.cgi?id=185050 <rdar://problem/39624038> Reviewed by Tim Horton. Currently, in extra zoom mode, there's no way for web pages to opt out of the default viewport behaviors (namely, laying out at a larger width and shrinking to fit) when the web view is very tall and narrow. This patch adds a new experimental viewport attribute, "min-device-width", that can be used to prevent WebKit from automatically clamping the web view width to a greater value for the device width in this scenario. Note that after this patch, logic that plumbs a minimumLayoutSize from WKWebView to the viewport configuration will need to be renamed to reflect that this size is no longer the minimum layout size, but rather, the view size that is used for viewport device dimensions by default. This refactoring will be done in a followup part. See per-method comments below for more detail. Test: fast/viewport/extrazoom/viewport-change-min-device-width.html * dom/ViewportArguments.cpp: (WebCore::setViewportFeature): (WebCore::operator<<): * dom/ViewportArguments.h: Removes `m_forceHorizontalShrinkToFit` (more detail below). * page/ViewportConfiguration.cpp: (WebCore::computedMinDeviceWidth): (WebCore::ViewportConfiguration::ViewportConfiguration): (WebCore::ViewportConfiguration::setMinimumLayoutSize): Instead of directly setting the minimum layout size, setMinimumLayoutSize now first sets the view size (i.e. the size we use for `device-width` in the viewport meta tag), and then updates the minimum layout size. (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Replaces `m_forceHorizontalShrinkToFit`. Whether or not we shrink to fit is now determined by whether the min-device-width attribute is actively clamping the width of the view. (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const): (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const): (WebCore::ViewportConfiguration::updateMinimumLayoutSize): Computes and sets the minimum layout size using the view size, taking the minimum device width into account if needed. (WebCore::ViewportConfiguration::description const): (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit): Deleted. * page/ViewportConfiguration.h: 2018-04-27 Zalan Bujtas <zalan@apple.com> [LFC] Formatting contexts should take const Box& https://bugs.webkit.org/show_bug.cgi?id=185031 Reviewed by Sam Weinig. The formatting root boxes are supposed to be all const. The only reason why they are not is because WeakPtr<> does not support const objects yet. Use const_cast instead (remove it when WeakPtr<> gains const support). * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::FormattingContext): * layout/FormattingContext.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::LayoutContext): (WebCore::Layout::LayoutContext::formattingContext): * layout/LayoutContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::BlockFormattingContext): * layout/blockformatting/BlockFormattingContext.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::InlineFormattingContext): * layout/inlineformatting/InlineFormattingContext.h: 2018-04-27 Zalan Bujtas <zalan@apple.com> [LFC] Add layout tree iterators. https://bugs.webkit.org/show_bug.cgi?id=185058 Reviewed by Antti Koivisto. They work exactly like the renderer tree iterators. * WebCore.xcodeproj/project.pbxproj: * layout/layouttree/LayoutAncestorIterator.h: Added. (WebCore::Layout::LayoutAncestorIterator<T>::LayoutAncestorIterator): (WebCore::Layout::LayoutAncestorIterator<T>::operator): (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::LayoutAncestorIteratorAdapter): (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::begin const): (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::end const): (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::first const): (WebCore::Layout::ancestorsOfType): (WebCore::Layout::lineageOfType): * layout/layouttree/LayoutBox.cpp: * layout/layouttree/LayoutChildIterator.h: Added. (WebCore::Layout::LayoutChildtIterator<T>::LayoutChildtIterator): (WebCore::Layout::LayoutChildtIterator<T>::operator): (WebCore::Layout::LayoutChildtIteratorAdapter<T>::LayoutChildtIteratorAdapter): (WebCore::Layout::LayoutChildtIteratorAdapter<T>::begin const): (WebCore::Layout::LayoutChildtIteratorAdapter<T>::end const): (WebCore::Layout::LayoutChildtIteratorAdapter<T>::first const): (WebCore::Layout::LayoutChildtIteratorAdapter<T>::last const): (WebCore::Layout::childrenOfType): * layout/layouttree/LayoutIterator.h: Added. (WebCore::Layout::isLayoutBoxOfType): (WebCore::Layout::Traversal::firstChild): (WebCore::Layout::Traversal::lastChild): (WebCore::Layout::Traversal::nextSibling): (WebCore::Layout::Traversal::previousSibling): (WebCore::Layout::Traversal::findAncestorOfType): (WebCore::Layout::Traversal::nextAncestorSibling): (WebCore::Layout::Traversal::nextWithin): (WebCore::Layout::Traversal::firstWithin): (WebCore::Layout::Traversal::next): (WebCore::Layout::LayoutIterator<T>::LayoutIterator): (WebCore::Layout::LayoutIterator<T>::traverseNextSibling): (WebCore::Layout::LayoutIterator<T>::traverseNext): (WebCore::Layout::LayoutIterator<T>::traversePreviousSibling): (WebCore::Layout::LayoutIterator<T>::traverseAncestor): (WebCore::Layout::LayoutIterator<T>::operator const): (WebCore::Layout:: const): (WebCore::Layout::= const): 2018-04-27 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r231089. https://bugs.webkit.org/show_bug.cgi?id=185071 Broke and made crash some WPE EME tests (Requested by calvaris on #webkit). Reverted changeset: "[EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline." https://bugs.webkit.org/show_bug.cgi?id=181855 https://trac.webkit.org/changeset/231089 2018-04-27 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline. https://bugs.webkit.org/show_bug.cgi?id=181855 Reviewed by Xabier Rodriguez-Calvar. The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size. When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue the decrypted GstBuffers that are in SVP memory. This behavior cause an out-of-memory error, because we are limited in SVP memory size. By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory. This new architecture also allows to start the buffering before obtaining the DRM license and it makes easier to manage dynamic change of the license or Key. The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline. SVP: Secure Video Path also named trusted or protected video path, it is a memory which is protected by a hardware access control engine, it is not accessible to other unauthorised software or hardware components. Tests: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: (webkitMediaCommonEncryptionDecryptSinkEventHandler): * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::dumpAppendState): (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::handleNeedContextSyncMessage): (WebCore::AppendPipeline::handleAppsrcNeedDataReceived): (WebCore::AppendPipeline::setAppendState): (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): (WebCore::AppendPipeline::appsinkNewSample): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread): (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread): (WebCore::appendPipelineElementMessageCallback): Deleted. (WebCore::AppendPipeline::handleElementMessage): Deleted. (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted. (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted. * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance): * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: 2018-04-27 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application. https://bugs.webkit.org/show_bug.cgi?id=181858 Reviewed by Xabier Rodriguez-Calvar. Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key. This message should be handled by the application in order to dispatch or send the key to the decryptor. This patch is a preparation for the patch 181855. With the patch 181855, the decryptor will be in the PlaybackPipeline instead of AppendPipeline, thus we can get the DRM license or key before to instantiate or load the decryptor plugin in PlaybackPipeline. When the decryptor plugin is instantiated or loaded, it should able to ask the application to resend the DRM license or key by using this new message "decrypt-key-needed". * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::dispatchCDMInstance): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: (webkitMediaCommonEncryptionDecryptTransformInPlace): 2018-04-26 Justin Fan <justin_fan@apple.com> tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData. https://bugs.webkit.org/show_bug.cgi?id=184843 <rdar://problem/34898868> Reviewed by Simon Fraser. On certain test pages passing 2d canvas objects to gl.texSubImage2D, we spend significant time doing an alpha unpremultiplication in FormatConverter::convert on a single thread. For now, I am introducing use of the Accelerate framework to do canvas alpha unpremultiplication, specifically for RGBA8 > RGBA8. This improves this rendering path by a factor of ~4. The rest of FormatConverter could use similar improvements; filed https://bugs.webkit.org/show_bug.cgi?id=185064 for these. * platform/graphics/FormatConverter.cpp: (WebCore::FormatConverter::convert): 2018-04-26 Simon Fraser <simon.fraser@apple.com> Implement rendering support for the color-filter CSS property https://bugs.webkit.org/show_bug.cgi?id=185047 rdar://problem/39664967 Reviewed by Tim Horton. The color-filter property transforms CSS colors just before painting. To support this, add to RenderStyle colorByApplyingColorFilter() and visitedDependentColorWithColorFilter(). At most calls sites that transform colors for rendering, replace calls to visitedDependentColor() with visitedDependentColorWithColorFilter(). The few locations that don't use visitedDependentColor() (e.g. for shadows) call colorByApplyingColorFilter(). Color transformation is implemented via a new virtual function on FilterOperation; BasicColorMatrixFilterOperation overrides this to use a new ColorMatrix class to do color math, and BasicComponentTransferFilterOperation to do the equivalent of component transfer operations. The math in both cases matches that for SVG filters, with the exception that color components are stored as floats through multiple filters and then mapped to normal 0-255 color components at the end. Tests: css3/color-filters/color-filter-backgrounds-borders.html css3/color-filters/color-filter-box-shadow.html css3/color-filters/color-filter-brightness.html css3/color-filters/color-filter-color-property-list-item.html css3/color-filters/color-filter-color-property.html css3/color-filters/color-filter-color-text-decorations.html css3/color-filters/color-filter-column-rule.html css3/color-filters/color-filter-contrast.html css3/color-filters/color-filter-current-color.html css3/color-filters/color-filter-filter-list.html css3/color-filters/color-filter-grayscale.html css3/color-filters/color-filter-hue-rotate.html css3/color-filters/color-filter-inherits.html css3/color-filters/color-filter-invert.html css3/color-filters/color-filter-opacity.html css3/color-filters/color-filter-outline.html css3/color-filters/color-filter-saturate.html css3/color-filters/color-filter-sepia.html css3/color-filters/color-filter-text-emphasis.html * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const): * page/FrameView.cpp: (WebCore::FrameView::documentBackgroundColor const): * platform/graphics/ColorUtilities.cpp: (WebCore::ColorMatrix::ColorMatrix): (WebCore::ColorMatrix::makeIdentity): (WebCore::ColorMatrix::grayscaleMatrix): (WebCore::ColorMatrix::saturationMatrix): (WebCore::ColorMatrix::hueRotateMatrix): (WebCore::ColorMatrix::sepiaMatrix): (WebCore::ColorMatrix::transformColorComponents const): * platform/graphics/ColorUtilities.h: * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::transformColor const): (WebCore::BasicComponentTransferFilterOperation::transformColor const): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::transformColor const): * platform/graphics/filters/FilterOperations.cpp: (WebCore::FilterOperations::transformColor const): * platform/graphics/filters/FilterOperations.h: * rendering/BorderEdge.cpp: (WebCore::BorderEdge::getBorderEdgeInfo): * rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::paint): (WebCore::EllipsisBox::paintSelection): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::paintBoxDecorations): * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintMarkedTextForeground): (WebCore::InlineTextBox::paintMarkedTextDecoration): (WebCore::InlineTextBox::paintCompositionUnderline const): * rendering/RenderBox.cpp: (WebCore::RenderBox::paintRootBoxFillLayers): (WebCore::RenderBox::paintBackground): (WebCore::RenderBox::getBackgroundPaintedExtent const): (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect const): (WebCore::RenderBox::backgroundHasOpaqueTopLayer const): * rendering/RenderBoxModelObject.cpp: (WebCore::applyBoxShadowForBackground): (WebCore::RenderBoxModelObject::paintFillLayerExtended): (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const): (WebCore::RenderBoxModelObject::paintBoxShadow): * rendering/RenderDetailsMarker.cpp: (WebCore::RenderDetailsMarker::paint): * rendering/RenderElement.cpp: (WebCore::RenderElement::selectionColor const): (WebCore::RenderElement::selectionBackgroundColor const): (WebCore::RenderElement::paintFocusRing): (WebCore::RenderElement::paintOutline): * rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::paintObject): * rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::paintColumnBorder): (WebCore::RenderFrameSet::paintRowBorder): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintReplaced): (WebCore::RenderImage::paintAreaElementFocusRing): * rendering/RenderInline.cpp: (WebCore::RenderInline::paintOutline): * rendering/RenderLayerBacking.cpp: (WebCore::canDirectlyCompositeBackgroundBackgroundImage): (WebCore::RenderLayerBacking::rendererBackgroundColor const): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged): * rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItemForeground): (WebCore::RenderListBox::paintItemBackground): * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::paint): * rendering/RenderMenuList.cpp: (RenderMenuList::itemStyle const): (RenderMenuList::getItemBackgroundColor const): (RenderMenuList::menuStyle const): * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::paintColumnRules): * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::menuStyle const): * rendering/RenderTable.h: (WebCore::RenderTable::bgColor const): * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::computeCollapsedStartBorder const): (WebCore::RenderTableCell::computeCollapsedEndBorder const): (WebCore::RenderTableCell::computeCollapsedBeforeBorder const): (WebCore::RenderTableCell::computeCollapsedAfterBorder const): (WebCore::RenderTableCell::paintBackgroundsBehindCell): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::paintRowGroupBorder): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paintSliderTicks): * rendering/TextDecorationPainter.cpp: (WebCore::decorationColor): * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): * rendering/mathml/MathOperator.cpp: (WebCore::MathOperator::paint): * rendering/mathml/RenderMathMLFraction.cpp: (WebCore::RenderMathMLFraction::paint): * rendering/mathml/RenderMathMLMenclose.cpp: (WebCore::RenderMathMLMenclose::paint): * rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::paint): * rendering/mathml/RenderMathMLToken.cpp: (WebCore::RenderMathMLToken::paint): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::visitedDependentColorWithColorFilter const): (WebCore::RenderStyle::colorByApplyingColorFilter const): * rendering/style/RenderStyle.h: 2018-04-26 Mark Lam <mark.lam@apple.com> Gardening: Speculative build fix for Windows. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Not reviewed. * cssjit/CSSPtrTag.h: 2018-04-26 Brent Fulgham <bfulgham@apple.com> Show punycode if URL contains Latin small letter o with dot below character https://bugs.webkit.org/show_bug.cgi?id=185051 <rdar://problem/39459297> Reviewed by David Kilzer. Revise our "lookalike character" logic to include the small Latin o with dot below character. Test: fast/url/host.html * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isLookalikeCharacter): 2018-04-26 Daniel Bates <dabates@apple.com> Fix the build following r231068 (https://bugs.webkit.org/show_bug.cgi?id=185002) Substitute mainResourceRequest.resourceRequest().url() for mainResourceRequest.url() as the latter does not exist. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::loadMainResource): 2018-04-26 Daniel Bates <dabates@apple.com> DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest https://bugs.webkit.org/show_bug.cgi?id=185002 Reviewed by Youenn Fablet and Alex Christensen. In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource() and the service worker code. As part of this extraction, DocumentLoader::loadMainResource() takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest. Instead we should WTFMove() the passed request into the CachedResourceRequest. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::loadMainResource): 2018-04-26 Sihui Liu <sihui_liu@apple.com> -[WKHTTPCookieStore deleteCookie:completionHandler:] doesn't delete cookies https://bugs.webkit.org/show_bug.cgi?id=184938 <rdar://problem/34737395> Reviewed by Geoffrey Garen. When a Cookie object was converted to NSHTTPCookie object, the HTTPOnly property information was lost so the delete function cannot find the proper cookie to delete. This patch implements a workaround that compares Cookie object instead of NSHTTPCookie object. We might want to add the ability to set HTTPOnly header during conversion if there is an easy way to do it later. New API test: WebKit.WKHTTPCookieStoreHttpOnly * platform/network/cocoa/CookieCocoa.mm: (WebCore::Cookie::operator== const): * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::deleteCookie): 2018-04-26 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r231052. https://bugs.webkit.org/show_bug.cgi?id=185044 Broke test http/tests/security/credentials-main-resource.html (Requested by dydz on #webkit). Reverted changeset: "DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest" https://bugs.webkit.org/show_bug.cgi?id=185002 https://trac.webkit.org/changeset/231052 2018-04-26 Jer Noble <jer.noble@apple.com> WK_COCOA_TOUCH all the things. https://bugs.webkit.org/show_bug.cgi?id=185006 Reviewed by Tim Horton. * Configurations/WebCore.xcconfig: 2018-04-26 David Kilzer <ddkilzer@apple.com> Make WAKScrollView delegate a weak property <https://webkit.org/b/184799> <rdar://problem/39469669> Reviewed by Simon Fraser. * platform/ios/wak/WAKScrollView.h: - Remove `delegate` instance variable declaration. - Declare `delegate` property as weak. (-[WAKScrollView setDelegate:]): Delete declaration. (-[WAKScrollView delegate]): Ditto. * platform/ios/wak/WAKScrollView.mm: - Synthesize getter/setter methods for `delegate` property. (-[WAKScrollView setDelegate:]): Delete implementation. (-[WAKScrollView delegate]): Ditto. 2018-04-26 Youenn Fablet <youenn@apple.com> CORS preflight checker should add a console message when preflight load is blocked https://bugs.webkit.org/show_bug.cgi?id=185021 Reviewed by Chris Dumez. No change of behavior, adding a JS console message when preflight load is blocked. This mirrors what is being done in preflighting done from NetworkProcess. Covered by existing tests. * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::notifyFinished): (WebCore::CrossOriginPreflightChecker::doPreflight): 2018-04-26 Daniel Bates <dabates@apple.com> DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest https://bugs.webkit.org/show_bug.cgi?id=185002 Reviewed by Youenn Fablet and Alex Christensen. In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource() and the service worker code. As part of this extraction, DocumentLoader::loadMainResource() takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest. Instead we should WTFMove() the passed request into the CachedResourceRequest. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::loadMainResource): 2018-04-26 Per Arne Vollan <pvollan@apple.com> Disable content filtering in minimal simulator mode https://bugs.webkit.org/show_bug.cgi?id=185027 <rdar://problem/39736091> Reviewed by Jer Noble. * Configurations/FeatureDefines.xcconfig: 2018-04-25 Brent Fulgham <bfulgham@apple.com> Add port 548 (afpovertcp) to port blacklist https://bugs.webkit.org/show_bug.cgi?id=185000 <rdar://problem/39540481> Reviewed by David Kilzer. Tested by security/block-test.html. * platform/URL.cpp: (WebCore::portAllowed):Also block port 548. 2018-04-26 Andy VanWagoner <thetalecrafter@gmail.com> [INTL] Implement Intl.PluralRules https://bugs.webkit.org/show_bug.cgi?id=184312 Reviewed by JF Bastien. Added Intl.PluralRules feature flag. Test: js/intl-pluralrules.html * Configurations/FeatureDefines.xcconfig: 2018-04-15 Darin Adler <darin@apple.com> [Cocoa] Adopt CCRSAGetCRTComponents and stop using CCBigNum https://bugs.webkit.org/show_bug.cgi?id=184637 Reviewed by Alexey Proskuryakov. * crypto/CommonCryptoUtilities.cpp: Compile out WebCore::CCBigNum class if HAVE(CCRSAGetCRTComponents) is true. * crypto/CommonCryptoUtilities.h: Define HAVE(CCRSAGetCRTComponents) on new enough versions of iOS and macOS that have it and add declarations of the function for the non-Apple-internal-SDK case. Also don't define the WebCore::CCBigNum class if HAVE(CCRSAGetCRTComponents) is true. * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::getPrivateKeyComponents): Use CCRSAGetCRTComponents if present. 2018-04-26 Per Arne Vollan <pvollan@apple.com> Add lazy initialization of caption display mode for videos. https://bugs.webkit.org/show_bug.cgi?id=184993 The call to MACaptionAppearanceGetDisplayType in CaptionUserPreferencesMediaAF::captionDisplayMode() is showing up in samples when called from HTMLMediaElement::finishInitialization(). Reviewed by Eric Carlson. No new tests, covered by existing tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::finishInitialization): (WebCore::HTMLMediaElement::setSelectedTextTrack): (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): (WebCore::HTMLMediaElement::captionPreferencesChanged): (WebCore::HTMLMediaElement::captionDisplayMode): * html/HTMLMediaElement.h: 2018-04-26 Zan Dobersek <zdobersek@igalia.com> [GTK][WPE] Initial ASYNC_SCROLLING support https://bugs.webkit.org/show_bug.cgi?id=184961 Reviewed by Carlos Garcia Campos. Add CoordinatedGraphics-specific code that will be required for async scrolling support. The ScrollingCoordinatorCoordinatedGraphics and ScrollingTreeCoordinatedGraphics classes are mostly complete already, but the new ScrollingTreeNode-inheriting classes will need further work that will have to be done in parallel with other improvements planned for the CoordinatedGraphics subsystem. While the build-time flag is enabled, the feature is still not enabled at runtime due to being marked as unsupported by the DrawingArea implementation in the WebKit layer. It would also not work yet if it were enabled due to the before-mentioned pending changes. Various build fixes that address non-Cocoa usage of ASYNC_SCROLLING code are included. * Sources.txt: Add AsyncScrollingCoordinator.cpp to build. * SourcesCocoa.txt: * SourcesGTK.txt: Add new files to build. * SourcesWPE.txt: Ditto. * page/scrolling/AsyncScrollingCoordinator.cpp: Guard setStateScrollingNodeSnapOffsetsAsFloat() with CSS_SCROLL_SNAP. * page/scrolling/ScrollingTree.h: * page/scrolling/ThreadedScrollingTree.cpp: * page/scrolling/ThreadedScrollingTree.h: currentSnapPointIndicesDidChange() method is only invoked in Cocoa-specific code, and its implementation calls Cocoa-specific method on the AsyncScrollingCoordinator class. * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp: (WebCore::ScrollingCoordinator::create): (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics): (WebCore::ScrollingCoordinatorCoordinatedGraphics::~ScrollingCoordinatorCoordinatedGraphics): (WebCore::ScrollingCoordinatorCoordinatedGraphics::pageDestroyed): (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeStateIfNeeded): (WebCore::ScrollingCoordinatorCoordinatedGraphics::handleWheelEvent): (WebCore::ScrollingCoordinatorCoordinatedGraphics::scheduleTreeStateCommit): (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeState): * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Added. * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp: Added. (WebCore::ScrollingTreeCoordinatedGraphics::create): (WebCore::ScrollingTreeCoordinatedGraphics::ScrollingTreeCoordinatedGraphics): (WebCore::ScrollingTreeCoordinatedGraphics::createScrollingTreeNode): * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h: Added. * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp: Added. (WebCore::ScrollingTreeFixedNode::create): (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode): (WebCore::ScrollingTreeFixedNode::~ScrollingTreeFixedNode): (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren): (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h: Added. * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp: Added. (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::create): (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::ScrollingTreeFrameScrollingNodeCoordinatedGraphics): (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::handleWheelEvent): (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::scrollPosition const): (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPosition): (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPositionWithoutContentEdgeConstraints): (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition): (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::updateLayersAfterViewportChange): * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h: Added. * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp: Added. (WebCore::ScrollingTreeStickyNode::create): (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode): (WebCore::ScrollingTreeStickyNode::~ScrollingTreeStickyNode): (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren): (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h: Added. * platform/PlatformWheelEvent.h: Enable PlatformWheelEventPhase code for WPE. Guard latching-specific methods under ASYNC_SCROLLING. * platform/TextureMapper.cmake: Two build targets have been moved to SourcesGTK.txt and SourcesWPE.txt. 2018-04-25 Michael Catanzaro <mcatanzaro@igalia.com> [WPE] Build and link against latest WPEBackend and WPEBackend-fdo https://bugs.webkit.org/show_bug.cgi?id=184643 Reviewed by Žan Doberšek. Adapt to single-header WPE includes. * platform/graphics/egl/GLContextEGLWPE.cpp: * platform/graphics/wpe/PlatformDisplayWPE.cpp: * platform/wpe/PlatformPasteboardWPE.cpp: 2018-04-25 Youenn Fablet <youenn@apple.com> Use NetworkLoadChecker for all subresource loads except fetch/XHR https://bugs.webkit.org/show_bug.cgi?id=184870 <rdar://problem/39370034> Reviewed by Chris Dumez. No change of behavior. Update CachedResourceLoader error messages to match NetworkProcess error messages. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::printAccessDeniedMessage const): 2018-04-25 Zalan Bujtas <zalan@apple.com> [LFC] Add support for is<> and downcast<> https://bugs.webkit.org/show_bug.cgi?id=185016 Reviewed by Antti Koivisto. * layout/layouttree/LayoutBlockContainer.cpp: (WebCore::Layout::BlockContainer::BlockContainer): * layout/layouttree/LayoutBlockContainer.h: * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::Box): * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::isContainer const): (WebCore::Layout::Box::isBlockContainer const): (WebCore::Layout::Box::isInlineBox const): (WebCore::Layout::Box::isInlineContainer const): * layout/layouttree/LayoutContainer.cpp: (WebCore::Layout::Container::Container): * layout/layouttree/LayoutContainer.h: * layout/layouttree/LayoutInlineBox.cpp: (WebCore::Layout::InlineBox::InlineBox): * layout/layouttree/LayoutInlineBox.h: * layout/layouttree/LayoutInlineContainer.cpp: (WebCore::Layout::InlineContainer::InlineContainer): * layout/layouttree/LayoutInlineContainer.h: 2018-04-25 Chris Dumez <cdumez@apple.com> window.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMWindow https://bugs.webkit.org/show_bug.cgi?id=184981 Reviewed by Sam Weinig. window.postMessage() / focus() / blur() was throwing a TypeError when called on a RemoteDOMWindow, complaining that |this| is not a Window. This was caused by a copy & paste mistake in JSDOMWindowCustom where we were calling the JSDOMWindow methods instead of the JSRemoteDOMWindow ones. No new tests, updated existing tests. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): * page/RemoteDOMWindow.cpp: (WebCore::RemoteDOMWindow::postMessage): * page/RemoteDOMWindow.h: * page/RemoteDOMWindow.idl: 2018-04-25 Simon Fraser <simon.fraser@apple.com> brightness() filter should default to 1, and not allow negative values https://bugs.webkit.org/show_bug.cgi?id=184937 Reviewed by Dean Jackson. Remove the special-casing for brightness() in consumeFilterFunction(), so it now follows the same logic as the other color-related filters in not allowing negative values. Removed the special-casing for brightness() in createFilterOperations() so its default value is now 1. Modified existing tests. * css/StyleResolver.cpp: (WebCore::StyleResolver::createFilterOperations): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::allowsValuesGreaterThanOne): (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): 2018-04-25 Wenson Hsieh <wenson_hsieh@apple.com> Missing closing parenthesis when determining INSTALL_PATH build setting in WebCore.xcconfig https://bugs.webkit.org/show_bug.cgi?id=184999 Reviewed by Tim Horton. Tweaks a line in WebCore.xcconfig that computes INSTALL_PATH, so that it doesn't use WK_NOT or WK_EMPTY. * Configurations/WebCore.xcconfig: 2018-04-25 Zalan Bujtas <zalan@apple.com> [LFC] Implement LayoutContexet::layout() and its dependencies. https://bugs.webkit.org/show_bug.cgi?id=184951 Reviewed by Antti Koivisto. * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::FormattingContext): (WebCore::Layout::FormattingContext::~FormattingContext): (WebCore::Layout::FormattingContext::computeStaticPosition): (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition): (WebCore::Layout::FormattingContext::computeOutOfFlowPosition): (WebCore::Layout::FormattingContext::computeWidth): (WebCore::Layout::FormattingContext::computeHeight): (WebCore::Layout::FormattingContext::marginTop): (WebCore::Layout::FormattingContext::marginLeft): (WebCore::Layout::FormattingContext::marginBottom): (WebCore::Layout::FormattingContext::marginRight): * layout/FormattingContext.h: * layout/FormattingState.cpp: (WebCore::Layout::FormattingState::FormattingState): * layout/FormattingState.h: * layout/LayoutContext.cpp: (WebCore::Layout::LayoutContext::LayoutContext): (WebCore::Layout::LayoutContext::updateLayout): (WebCore::Layout::LayoutContext::formattingState): (WebCore::Layout::LayoutContext::formattingContext): * layout/LayoutContext.h: * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::BlockFormattingContext): (WebCore::Layout::BlockFormattingContext::layout): (WebCore::Layout::BlockFormattingContext::formattingState const): (WebCore::Layout::BlockFormattingContext::computeStaticPosition): (WebCore::Layout::BlockFormattingContext::computeWidth): (WebCore::Layout::BlockFormattingContext::computeHeight): (WebCore::Layout::BlockFormattingContext::marginTop): (WebCore::Layout::BlockFormattingContext::marginBottom): * layout/blockformatting/BlockFormattingContext.h: * layout/blockformatting/BlockFormattingState.cpp: (WebCore::Layout::BlockFormattingState::BlockFormattingState): * layout/blockformatting/BlockFormattingState.h: * layout/inlineformatting/InlineFormattingContext.cpp: (WebCore::Layout::InlineFormattingContext::InlineFormattingContext): (WebCore::Layout::InlineFormattingContext::layout): (WebCore::Layout::InlineFormattingContext::formattingState const): * layout/inlineformatting/InlineFormattingContext.h: * layout/inlineformatting/InlineFormattingState.cpp: (WebCore::Layout::InlineFormattingState::InlineFormattingState): * layout/inlineformatting/InlineFormattingState.h: 2018-04-25 Mark Lam <mark.lam@apple.com> Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): 2018-04-25 Eric Carlson <eric.carlson@apple.com> [iOS] remove media element parameter from MediaElementSession methods https://bugs.webkit.org/show_bug.cgi?id=184992 <rdar://problem/39731624> Reviewed by Jon Lee. No new tests, no behavior change. * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::allowsInlineMediaPlayback const): (WebCore::MediaControlsHost::userGestureRequired const): * accessibility/AccessibilityMediaObject.cpp: (WebCore::AccessibilityMediaObject::isPlayingInline const): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::parseAttribute): (WebCore::HTMLMediaElement::prepareForLoad): (WebCore::HTMLMediaElement::selectMediaResource): (WebCore::HTMLMediaElement::loadResource): (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const): (WebCore::HTMLMediaElement::setReadyState): (WebCore::HTMLMediaElement::play): (WebCore::HTMLMediaElement::pause): (WebCore::HTMLMediaElement::pauseInternal): (WebCore::HTMLMediaElement::setVolume): (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::mediaEngineWasUpdated): (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): (WebCore::HTMLMediaElement::updatePlayState): (WebCore::HTMLMediaElement::clearMediaPlayer): (WebCore::HTMLMediaElement::resume): (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): (WebCore::HTMLMediaElement::addEventListener): (WebCore::HTMLMediaElement::removeEventListener): (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent): (WebCore::HTMLMediaElement::exitFullscreen): (WebCore::HTMLMediaElement::configureMediaControls): (WebCore::HTMLMediaElement::createMediaPlayer): (WebCore::HTMLMediaElement::mediaPlayerIsFullscreenPermitted const): (WebCore::HTMLMediaElement::updateMediaState): (WebCore::HTMLMediaElement::mediaState const): (WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged): (WebCore::HTMLMediaElement::updateShouldPlay): * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::parseAttribute): (WebCore::HTMLVideoElement::supportsFullscreen const): (WebCore::HTMLVideoElement::webkitEnterFullscreen): (WebCore::HTMLVideoElement::webkitWirelessVideoPlaybackDisabled const): (WebCore::HTMLVideoElement::webkitSupportsPresentationMode const): (WebCore::HTMLVideoElement::setFullscreenMode): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::playbackPermitted const): (WebCore::MediaElementSession::dataLoadingPermitted const): (WebCore::MediaElementSession::fullscreenPermitted const): (WebCore::MediaElementSession::pageAllowsDataLoading const): (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const): (WebCore::MediaElementSession::canShowControlsManager const): (WebCore::MediaElementSession::showPlaybackTargetPicker): (WebCore::MediaElementSession::hasWirelessPlaybackTargets const): (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const): (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled): (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners): (WebCore::MediaElementSession::mediaStateDidChange): (WebCore::MediaElementSession::effectivePreloadForElement const): (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const): (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading const): (WebCore::MediaElementSession::mediaEngineUpdated): (WebCore::MediaElementSession::allowsPictureInPicture const): * html/MediaElementSession.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled const): 2018-04-25 Jiewen Tan <jiewen_tan@apple.com> Remove access to keychain from the WebContent process https://bugs.webkit.org/show_bug.cgi?id=184428 <rdar://problem/13150903> Reviewed by Brent Fulgham. Part 2. This patch move the operation of HTMLKeygenElement from WebContent Process to UI Process. Function signedPublicKeyAndChallengeString is therefore marked as WEBCORE_EXPORT. Also, a localized string is marked WEBCORE_EXPORT as well to support the API test. Covered by existing tests and api tests. * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::signedPublicKeyAndChallengeString): * dom/Document.h: * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::appendFormData): * page/ChromeClient.h: * platform/LocalizedStrings.h: * platform/SSLKeyGenerator.h: 2018-04-25 Ryosuke Niwa <rniwa@webkit.org> PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank https://bugs.webkit.org/show_bug.cgi?id=184962 Reviewed by Youenn Fablet. Added NavigationAction::treatAsSameOriginNavigation, which signifies WebKit code to avoid creating a new WebContent process when navigating to a blob URL, data URL, and about:blank. Tests: ProcessSwap.SameOriginBlobNavigation ProcessSwap.CrossOriginBlobNavigation ProcessSwap.NavigateToAboutBlank ProcessSwap.NavigateToDataURL * loader/NavigationAction.cpp: (WebCore::treatAsSameOriginNavigation): * loader/NavigationAction.h: (WebCore::NavigationAction::treatAsSameOriginNavigation const): 2018-04-25 Zalan Bujtas <zalan@apple.com> [LFC] Implement Layout::BlockContainer functions. https://bugs.webkit.org/show_bug.cgi?id=184994 Reviewed by Antti Koivisto. * layout/layouttree/LayoutBlockContainer.cpp: (WebCore::Layout::BlockContainer::BlockContainer): (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const): 2018-04-25 Zalan Bujtas <zalan@apple.com> [LFC] Implement Layout::Container functions. https://bugs.webkit.org/show_bug.cgi?id=184988 Reviewed by Antti Koivisto. * layout/layouttree/LayoutContainer.cpp: (WebCore::Layout::Container::Container): (WebCore::Layout::Container::firstInFlowChild const): (WebCore::Layout::Container::firstInFlowOrFloatingChild const): (WebCore::Layout::Container::lastInFlowChild const): (WebCore::Layout::Container::lastInFlowOrFloatingChild const): (WebCore::Layout::Container::setFirstChild): (WebCore::Layout::Container::setLastChild): (WebCore::Layout::Container::setOutOfFlowDescendants): * layout/layouttree/LayoutContainer.h: (WebCore::Layout::Container::firstChild const): (WebCore::Layout::Container::lastChild const): (WebCore::Layout::Container::hasChild const): (WebCore::Layout::Container::hasInFlowChild const): (WebCore::Layout::Container::hasInFlowOrFloatingChild const): (WebCore::Layout::Container::outOfFlowDescendants): 2018-04-25 Brent Fulgham <bfulgham@apple.com> Don't Block First Party Cookies on Redirects https://bugs.webkit.org/show_bug.cgi?id=184948 <rdar://problem/39534099> Reviewed by Youenn Fablet. The Navigation scheduler looses the 'requester' value when performing a ScheduledRedirect. Test: http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html * loader/NavigationScheduler.cpp: 2018-04-25 Youenn Fablet <youenn@apple.com> CachedRawResource is not handling incremental data computation correctly https://bugs.webkit.org/show_bug.cgi?id=184936 Reviewed by Chris Dumez. Covered by updated test. The previous logic was handling the case of only one additional segment being added to the SharedBuffer. In service worker case, a SharedBuffer may contain more than one segment. This is fixed by iterating until all new data is sent to clients. * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::updateBuffer): 2018-04-25 Andy Estes <aestes@apple.com> [Mac] Number of drop items is always 0 when performing a DHTML drag https://bugs.webkit.org/show_bug.cgi?id=184943 Reviewed by Ryosuke Niwa. New API test: DragAndDropPasteboardTests.NumberOfValidItemsForDrop DragController tracks the number of items to be accepted by a file input element, taking into account whether the control is disabled or accepts multiple files. When this number changes, WebKit informs the NSDraggingInfo-conforming object passed to -draggingUpdated by calling -setNumberOfValidItemsForDrop:. This number is presented to the user in a badge rendered next to the dragging item thumbnails. When performing a DHTML drag, we don't know how many items the page will accept, so prior to this patch we would render a "0" in the badge. This is misleading, because the page is more likely to accept all the items (or at least one of them) rather than none of them. Let's do the straightforward thing and set numberOfValidItemsForDrop to equal the number of files in the drag operation when performing a DHTML file drag. * page/DragController.cpp: (WebCore::DragController::tryDocumentDrag): 2018-04-25 Eric Carlson <eric.carlson@apple.com> [iOS] Set route sharing policy when setting audio session category https://bugs.webkit.org/show_bug.cgi?id=184979 <rdar://problem/39709577> Reviewed by Jer Noble. * platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSession::setCategory): 2018-04-25 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Fix wrong schema checking on r230973 https://bugs.webkit.org/show_bug.cgi?id=184977 Did write a wrong condition when making a string. Reviewed by Alex Christensen. No new tests because test interface is not ready. * platform/network/curl/CurlProxySettings.cpp: (WebCore::createProxyUrl): 2018-04-25 Youenn Fablet <youenn@apple.com> Make DocumentThreadableLoader error logging more consistent https://bugs.webkit.org/show_bug.cgi?id=184853 Reviewed by Chris Dumez. Covered by rebased tests. Make EventSource, XHR and Fetch log error messages consistently. This patch also prepares consistent error logging between WK1 and WK2 as WK2 NetworkProcess will issue more and more errors in places different from WK1. This is the reason for SubresourceLoader changes in this patch and DTL/didFail/preflightFailure changes. Update ImageLoader error message to be more general than CORS. * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::doPreflight): Add some more logging for consistency between WK1 and WK2. (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Ditto. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::didFail): (WebCore::DocumentThreadableLoader::preflightFailure): (WebCore::DocumentThreadableLoader::logErrorAndFail): * loader/ImageLoader.cpp: (WebCore::ImageLoader::notifyFinished): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFail): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::logError): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::load): * loader/cache/CachedResourceRequestInitiators.cpp: (WebCore::CachedResourceRequestInitiators::CachedResourceRequestInitiators): * loader/cache/CachedResourceRequestInitiators.h: * page/EventSource.cpp: (WebCore::EventSource::connect): (WebCore::EventSource::didFail): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::didFail): 2018-04-25 Zalan Bujtas <zalan@apple.com> [LFC] Implement Layout::Box functions. https://bugs.webkit.org/show_bug.cgi?id=184974 Reviewed by Antti Koivisto. * layout/layouttree/LayoutBlockContainer.h: * layout/layouttree/LayoutBox.cpp: (WebCore::Layout::Box::Box): (WebCore::Layout::Box::~Box): (WebCore::Layout::Box::establishesFormattingContext const): (WebCore::Layout::Box::establishesBlockFormattingContext const): (WebCore::Layout::Box::isRelativelyPositioned const): (WebCore::Layout::Box::isStickyPositioned const): (WebCore::Layout::Box::isAbsolutelyPositioned const): (WebCore::Layout::Box::isFixedPositioned const): (WebCore::Layout::Box::isFloatingPositioned const): (WebCore::Layout::Box::containingBlock const): (WebCore::Layout::Box::isDescendantOf const): (WebCore::Layout::Box::isAnonymous const): (WebCore::Layout::Box::isInlineBlockBox const): (WebCore::Layout::Box::isBlockLevelBox const): (WebCore::Layout::Box::isInlineLevelBox const): (WebCore::Layout::Box::isBlockContainerBox const): (WebCore::Layout::Box::isInitialContainingBlock const): (WebCore::Layout::Box::nextInFlowSibling const): (WebCore::Layout::Box::nextInFlowOrFloatingSibling const): (WebCore::Layout::Box::previousInFlowSibling const): (WebCore::Layout::Box::previousInFlowOrFloatingSibling const): (WebCore::Layout::Box::setParent): (WebCore::Layout::Box::setNextSibling): (WebCore::Layout::Box::setPreviousSibling): (WebCore::Layout::Box::isOverflowVisible const): * layout/layouttree/LayoutBox.h: (WebCore::Layout::Box::establishesInlineFormattingContext const): (WebCore::Layout::Box::isInFlow const): (WebCore::Layout::Box::isPositioned const): (WebCore::Layout::Box::isInFlowPositioned const): (WebCore::Layout::Box::isOutOfFlowPositioned const): (WebCore::Layout::Box::isFloatingOrOutOfFlowPositioned const): (WebCore::Layout::Box::parent const): (WebCore::Layout::Box::nextSibling const): (WebCore::Layout::Box::previousSibling const): (WebCore::Layout::Box::weakPtrFactory const): * layout/layouttree/LayoutContainer.h: * layout/layouttree/LayoutInlineBox.h: * layout/layouttree/LayoutInlineContainer.h: 2018-04-25 Per Arne Vollan <pvollan@apple.com> [Win] Crash under WebCore::SimpleLineLayout::generateLineBoxTree https://bugs.webkit.org/show_bug.cgi?id=184953 This is possibly a MSVC compiler bug, since a simple rearrangement of the code fixes the crash. The crash is only happening in release builds, which also is an indication of this being a compiler issue. Reviewed by Zalan Bujtas. No new tests, covered by existing tests. * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::generateLineBoxTree): 2018-04-25 Dean Jackson <dino@apple.com> Make a better flag for system preview, and disable it where necessary https://bugs.webkit.org/show_bug.cgi?id=184968 <rdar://problem/39686506> Reviewed by Eric Carlson. Use USE(SYSTEM_PREVIEW). * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::isSystemPreviewLink const): * html/HTMLAnchorElement.h: * html/HTMLImageElement.cpp: * html/HTMLImageElement.h: * html/HTMLPictureElement.cpp: * html/HTMLPictureElement.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIntoRect): * rendering/RenderTheme.cpp: * rendering/RenderTheme.h: * testing/Internals.cpp: (WebCore::Internals::systemPreviewRelType): (WebCore::Internals::isSystemPreviewLink const): (WebCore::Internals::isSystemPreviewImage const): 2018-04-25 Zalan Bujtas <zalan@apple.com> Fix project file after r230931. * WebCore.xcodeproj/project.pbxproj: 2018-04-25 Miguel Gomez <magomez@igalia.com> [GTK] fast/repaint/fixed-scale.html failing since r230479 "[TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform" https://bugs.webkit.org/show_bug.cgi?id=184780 Reviewed by Žan Doberšek. Initialize the anchorPoint to (0.5, 0.5, 0) in TextureMapperLayer::State. Covered by existent tests. * platform/graphics/texmap/TextureMapperLayer.h: 2018-04-25 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Implement MouseEvent.buttons https://bugs.webkit.org/show_bug.cgi?id=184913 Reviewed by Žan Doberšek. Add helper function to get the state modifier of a GDK button. * platform/gtk/GtkUtilities.cpp: (WebCore::stateModifierForGdkButton): * platform/gtk/GtkUtilities.h: 2018-04-24 Ryosuke Niwa <rniwa@webkit.org> Release assert in ScriptController::canExecuteScripts via CachedSVGFont::ensureCustomFontData during Document::updateStyleIfNeeded https://bugs.webkit.org/show_bug.cgi?id=184950 Reviewed by Zalan Bujtas. Convert an existing ScriptDisallowedScope::EventAllowedScope which only disables the debug assertions by ScriptDisallowedScope::DisableAssertionsInScope which also disables the release assertion. Because SVG font is loaded in a document isolated from the rest of the page (m_externalSVGDocument), there is no security implication to execute scripts in this isolated document. Unfortunately, no new tests. I could never make CachedSVGFont::ensureCustomFontData to get called inside style resolution with m_externalSVGDocument set to nullptr after many attempts. Even EventAllowedScope I added 13 months ago in r211965, which this patch replaces by DisableAssertionsInScope, is not utilized by the existing layout tests since removing the assertion doesn't cause any layout test to hit an assertion. * dom/ScriptDisallowedScope.h: Updated the comment. * loader/cache/CachedSVGFont.cpp: (WebCore::CachedSVGFont::ensureCustomFontData): Replaced the asssertion. 2018-04-24 Simon Fraser <simon.fraser@apple.com> visitedDependentColor() should take a CSSPropertyID https://bugs.webkit.org/show_bug.cgi?id=184949 Reviewed by Sam Weinig. Change RenderStyle::colorIncludingFallback(), RenderStyle::visitedDependentColor() and RenderElement::selectionColor() to take CSSPropertyID rather than int. No behavior change. * rendering/RenderElement.cpp: (WebCore::RenderElement::selectionColor const): * rendering/RenderElement.h: * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::computeCollapsedStartBorder const): (WebCore::RenderTableCell::computeCollapsedEndBorder const): (WebCore::RenderTableCell::computeCollapsedBeforeBorder const): (WebCore::RenderTableCell::computeCollapsedAfterBorder const): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorIncludingFallback const): (WebCore::RenderStyle::visitedDependentColor const): * rendering/style/RenderStyle.h: 2018-04-24 Simon Fraser <simon.fraser@apple.com> Add a new "color-filter" CSS property as an experimental feature https://bugs.webkit.org/show_bug.cgi?id=184940 rdar://problem/39664904 Reviewed by Jon Lee. Add a new CSS property called "color-filter" as an experimental feature (off by default). This property specifies a list of filter functions (as specified in https://drafts.fxtf.org/filter-effects/#supported-filter-functions) to CSS colors, allowing authors to modify the provided page colors, for example to improve accessibility. Filters that move pixels (i.e. blur() and drop-shadow()) are invalid in this property. Colors will be mapped through the filter functions just before paint time, and gradient stop colors will also be mapped. This patch adds support for parsing color-filter. Test: css3/color-filters/color-filter-parsing.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSProperties.json: * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::operator==): * css/parser/CSSParserMode.h: * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::isColorFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilterFunction): (WebCore::CSSPropertyParserHelpers::consumeFilter): * css/parser/CSSPropertyParserHelpers.h: * page/Settings.yaml: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::changeRequiresRepaint const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::mutableColorFilter): (WebCore::RenderStyle::colorFilter const): (WebCore::RenderStyle::hasColorFilter const): (WebCore::RenderStyle::setColorFilter): (WebCore::RenderStyle::initialColorFilter): * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): (WebCore::StyleRareInheritedData::hasColorFilters const): * rendering/style/StyleRareInheritedData.h: 2018-04-24 Simon Fraser <simon.fraser@apple.com> shape-outside and filter styles occur twice in the result of getComputedStyle https://bugs.webkit.org/show_bug.cgi?id=184931 Reviewed by Antti Koivisto. CSSPropertyShapeOutside and CSSPropertyFilter were duplicated in the list of computedProperties[] used by getComputedStyle. Remove the duplication. Tested by existing tests. * css/CSSComputedStyleDeclaration.cpp: 2018-04-24 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Extract proxy settings into a separate class to hold advanced information. https://bugs.webkit.org/show_bug.cgi?id=184714 It was simplely structure to hold proxy setting. To support advanced feature of proxy such as authentication, more inteligent object is required to store intermediate state or errors. That's why we've introduced new class for that purpose. Reviewed by Youenn Fablet. No new tests because there's no new behavior. * platform/Curl.cmake: * platform/network/curl/CurlContext.cpp: (WebCore::CurlHandle::enableProxyIfExists): (WebCore::CurlContext::ProxyInfo::url const): Deleted. (WebCore::CurlContext::setProxyInfo): Deleted. * platform/network/curl/CurlContext.h: (WebCore::CurlContext::proxySettings const): (WebCore::CurlContext::setProxySettings): (WebCore::CurlContext::setProxyUserPass): (WebCore::CurlContext::proxyInfo const): Deleted. (WebCore::CurlContext::setProxyInfo): Deleted. * platform/network/curl/CurlProxySettings.cpp: Added. (WebCore::CurlProxySettings::CurlProxySettings): (WebCore::CurlProxySettings::rebuildUrl): (WebCore::CurlProxySettings::setUserPass): (WebCore::protocolIsInSocksFamily): (WebCore::getProxyPort): (WebCore::createProxyUrl): * platform/network/curl/CurlProxySettings.h: Added. (WebCore::CurlProxySettings::CurlProxySettings): (WebCore::CurlProxySettings::isEmpty const): (WebCore::CurlProxySettings::mode const): (WebCore::CurlProxySettings::url const): (WebCore::CurlProxySettings::ignoreHosts const): (WebCore::CurlProxySettings::user const): (WebCore::CurlProxySettings::password const): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::didReceiveHeader): * platform/network/curl/CurlResponse.h: (WebCore::CurlResponse::isolatedCopy const): * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::ResourceResponse): 2018-04-24 Youenn Fablet <youenn@apple.com> Throw in case of PeerConnection created for detached documents https://bugs.webkit.org/show_bug.cgi?id=184921 <rdar://problem/39629216> Reviewed by Eric Carlson. Add a check to ensure that page is not null when creating a peer connection backend. In that case, the peer connection constructor will later on throw. The same for setConfiguration is done. Behavior is consistent with Chrome. Test: webrtc/pc-detached-document.html * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::createLibWebRTCPeerConnectionBackend): (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend): (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration): (WebCore::libWebRTCProvider): Deleted. * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: 2018-04-24 John Wilander <wilander@apple.com> From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check https://bugs.webkit.org/show_bug.cgi?id=184560 <rdar://problem/38901344> Reviewed by Youenn Fablet and Daniel Bates. Tests: http/tests/from-origin/document-from-origin-same-accepted.html http/tests/from-origin/document-from-origin-same-blocked.html http/tests/from-origin/document-from-origin-same-site-accepted.html http/tests/from-origin/document-from-origin-same-site-blocked.html http/tests/from-origin/document-nested-from-origin-same-accepted.html http/tests/from-origin/document-nested-from-origin-same-blocked.html http/tests/from-origin/fetch-data-iframe-from-origin-same-blocked.html http/tests/from-origin/fetch-from-origin-same-accepted.html http/tests/from-origin/fetch-from-origin-same-blocked.html http/tests/from-origin/fetch-from-origin-same-site-accepted.html http/tests/from-origin/fetch-from-origin-same-site-blocked.html http/tests/from-origin/fetch-iframe-from-origin-same-accepted.html http/tests/from-origin/fetch-iframe-from-origin-same-blocked.html http/tests/from-origin/image-about-blank-from-origin-same-blocked.html http/tests/from-origin/image-from-origin-same-accepted.html http/tests/from-origin/image-from-origin-same-blocked.html http/tests/from-origin/image-from-origin-same-site-accepted.html http/tests/from-origin/image-from-origin-same-site-blocked.html http/tests/from-origin/redirect-document-from-origin-same-blocked.html http/tests/from-origin/redirect-fetch-from-origin-same-blocked.html http/tests/from-origin/redirect-image-from-origin-same-blocked.html http/tests/from-origin/redirect-script-from-origin-same-blocked.html http/tests/from-origin/redirect-xhr-from-origin-same-blocked.html http/tests/from-origin/sandboxed-sub-frame-from-origin-same-blocked.html http/tests/from-origin/sandboxed-sub-frame-nested-cross-origin-from-origin-same-blocked.html http/tests/from-origin/sandboxed-sub-frame-nested-same-origin-from-origin-same-blocked.html http/tests/from-origin/script-from-origin-same-accepted.html http/tests/from-origin/script-from-origin-same-blocked.html http/tests/from-origin/script-from-origin-same-site-accepted.html http/tests/from-origin/script-from-origin-same-site-blocked.html http/tests/from-origin/top-frame-document-from-origin-same-accepted.php http/tests/from-origin/xhr-from-origin-same-accepted.html http/tests/from-origin/xhr-from-origin-same-blocked.html http/tests/from-origin/xhr-from-origin-same-site-accepted.html http/tests/from-origin/xhr-from-origin-same-site-blocked.html * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFail): Outputs the error's localized description in a console message except when the destination is FetchOptions::Destination::Serviceworker or FetchOptions::Destination::EmptyString. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setFromOriginResponseHeaderEnabled): (WebCore::RuntimeEnabledFeatures::fromOriginResponseHeaderEnabled const): Added From-Origin support as an experimental feature. * platform/network/HTTPHeaderNames.in: Added From-Origin. * platform/network/HTTPParsers.cpp: (WebCore::parseFromOriginHeader): Parses the From-Origin header, currently supporting 'Same' and 'Same-Site.' * platform/network/HTTPParsers.h: 2018-04-24 Antti Koivisto <antti@apple.com> Rename LayoutCtx.h/cpp to LayoutContext.h/cpp https://bugs.webkit.org/show_bug.cgi?id=184922 Reviewed by Zalan Bujtas. To achieve this the existing LayoutContext class is renamed to FrameViewLayoutContext. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/LayoutContext.cpp: Copied from Source/WebCore/layout/LayoutCtx.cpp. * layout/LayoutContext.h: Copied from Source/WebCore/layout/LayoutCtx.h. * layout/LayoutCtx.cpp: Removed. * layout/LayoutCtx.h: Removed. * page/FrameView.cpp: (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange): (WebCore::FrameView::updateLayoutViewport): (WebCore::FrameView::updateLayerPositionsAfterScrolling): (WebCore::FrameView::updateCompositingLayersAfterScrolling): (WebCore::FrameView::availableContentSizeChanged): * page/FrameView.h: * page/FrameViewLayoutContext.cpp: Copied from Source/WebCore/page/LayoutContext.cpp. (WebCore::LayoutScope::LayoutScope): (WebCore::FrameViewLayoutContext::FrameViewLayoutContext): (WebCore::FrameViewLayoutContext::~FrameViewLayoutContext): (WebCore::FrameViewLayoutContext::layout): (WebCore::FrameViewLayoutContext::runOrScheduleAsynchronousTasks): (WebCore::FrameViewLayoutContext::runAsynchronousTasks): (WebCore::FrameViewLayoutContext::flushAsynchronousTasks): (WebCore::FrameViewLayoutContext::reset): (WebCore::FrameViewLayoutContext::needsLayout const): (WebCore::FrameViewLayoutContext::setNeedsLayout): (WebCore::FrameViewLayoutContext::enableSetNeedsLayout): (WebCore::FrameViewLayoutContext::disableSetNeedsLayout): (WebCore::FrameViewLayoutContext::scheduleLayout): (WebCore::FrameViewLayoutContext::unscheduleLayout): (WebCore::FrameViewLayoutContext::scheduleSubtreeLayout): (WebCore::FrameViewLayoutContext::layoutTimerFired): (WebCore::FrameViewLayoutContext::convertSubtreeLayoutToFullLayout): (WebCore::FrameViewLayoutContext::setSubtreeLayoutRoot): (WebCore::FrameViewLayoutContext::canPerformLayout const): (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded): (WebCore::FrameViewLayoutContext::updateStyleForLayout): (WebCore::FrameViewLayoutContext::handleLayoutWithFrameFlatteningIfNeeded): (WebCore::FrameViewLayoutContext::startLayoutAtMainFrameViewIfNeeded): (WebCore::FrameViewLayoutContext::layoutDelta const): (WebCore::FrameViewLayoutContext::addLayoutDelta): (WebCore::FrameViewLayoutContext::layoutDeltaMatches): (WebCore::FrameViewLayoutContext::layoutState const): (WebCore::FrameViewLayoutContext::pushLayoutState): (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded): (WebCore::FrameViewLayoutContext::popLayoutState): (WebCore::FrameViewLayoutContext::checkLayoutState): (WebCore::FrameViewLayoutContext::frame const): (WebCore::FrameViewLayoutContext::view const): (WebCore::FrameViewLayoutContext::renderView const): (WebCore::FrameViewLayoutContext::document const): (WebCore::LayoutContext::LayoutContext): Deleted. (WebCore::LayoutContext::~LayoutContext): Deleted. (WebCore::LayoutContext::layout): Deleted. (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Deleted. (WebCore::LayoutContext::runAsynchronousTasks): Deleted. (WebCore::LayoutContext::flushAsynchronousTasks): Deleted. (WebCore::LayoutContext::reset): Deleted. (WebCore::LayoutContext::needsLayout const): Deleted. (WebCore::LayoutContext::setNeedsLayout): Deleted. (WebCore::LayoutContext::enableSetNeedsLayout): Deleted. (WebCore::LayoutContext::disableSetNeedsLayout): Deleted. (WebCore::LayoutContext::scheduleLayout): Deleted. (WebCore::LayoutContext::unscheduleLayout): Deleted. (WebCore::LayoutContext::scheduleSubtreeLayout): Deleted. (WebCore::LayoutContext::layoutTimerFired): Deleted. (WebCore::LayoutContext::convertSubtreeLayoutToFullLayout): Deleted. (WebCore::LayoutContext::setSubtreeLayoutRoot): Deleted. (WebCore::LayoutContext::canPerformLayout const): Deleted. (WebCore::LayoutContext::applyTextSizingIfNeeded): Deleted. (WebCore::LayoutContext::updateStyleForLayout): Deleted. (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded): Deleted. (WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded): Deleted. (WebCore::LayoutContext::layoutDelta const): Deleted. (WebCore::LayoutContext::addLayoutDelta): Deleted. (WebCore::LayoutContext::layoutDeltaMatches): Deleted. (WebCore::LayoutContext::layoutState const): Deleted. (WebCore::LayoutContext::pushLayoutState): Deleted. (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded): Deleted. (WebCore::LayoutContext::popLayoutState): Deleted. (WebCore::LayoutContext::checkLayoutState): Deleted. (WebCore::LayoutContext::frame const): Deleted. (WebCore::LayoutContext::view const): Deleted. (WebCore::LayoutContext::renderView const): Deleted. (WebCore::LayoutContext::document const): Deleted. * page/FrameViewLayoutContext.h: Copied from Source/WebCore/page/LayoutContext.h. (WebCore::LayoutContext::startDisallowingLayout): Deleted. (WebCore::LayoutContext::endDisallowingLayout): Deleted. (WebCore::LayoutContext::layoutPhase const): Deleted. (WebCore::LayoutContext::isLayoutNested const): Deleted. (WebCore::LayoutContext::isLayoutPending const): Deleted. (WebCore::LayoutContext::isInLayout const): Deleted. (WebCore::LayoutContext::isInRenderTreeLayout const): Deleted. (WebCore::LayoutContext::inPaintableState const): Deleted. (WebCore::LayoutContext::layoutCount const): Deleted. (WebCore::LayoutContext::subtreeLayoutRoot const): Deleted. (WebCore::LayoutContext::clearSubtreeLayoutRoot): Deleted. (WebCore::LayoutContext::resetFirstLayoutFlag): Deleted. (WebCore::LayoutContext::didFirstLayout const): Deleted. (WebCore::LayoutContext::setNeedsFullRepaint): Deleted. (WebCore::LayoutContext::needsFullRepaint const): Deleted. (WebCore::LayoutContext::isPaintOffsetCacheEnabled const): Deleted. (WebCore::LayoutContext::layoutDisallowed const): Deleted. (WebCore::LayoutContext::isLayoutSchedulingEnabled const): Deleted. (WebCore::LayoutContext::inAsynchronousTasks const): Deleted. (WebCore::LayoutContext::disablePaintOffsetCache): Deleted. (WebCore::LayoutContext::enablePaintOffsetCache): Deleted. * page/LayoutContext.cpp: Removed. * page/LayoutContext.h: Removed. * rendering/LayoutState.cpp: (WebCore::LayoutState::LayoutState): (WebCore::LayoutState::computePaginationInformation): (WebCore::LayoutState::establishLineGrid): (WebCore::LayoutStateDisabler::LayoutStateDisabler): * rendering/LayoutState.h: 2018-04-24 Mark Lam <mark.lam@apple.com> Need to acquire the VM lock before calling toNumber on a JSValue. https://bugs.webkit.org/show_bug.cgi?id=184924 <rdar://problem/39690679> Reviewed by Saam Barati. * bridge/objc/objc_utility.mm: (JSC::Bindings::convertValueToObjcValue): 2018-04-24 Tadeu Zagallo <tzagallo@apple.com> REGRESSION(r221839): Fix requests with FormData containing empty files https://bugs.webkit.org/show_bug.cgi?id=184490 <rdar://problem/39385169> Reviewed by Geoffrey Garen. We should not append the blob to the FormData when it is a file but has no path. It broke the submission since the request was failing to read the file in FormDataStreamCFNet.h:156 Test: http/tests/local/formdata/send-form-data-with-empty-file.html * platform/network/FormData.cpp: (WebCore::FormData::appendMultiPartFileValue): 2018-04-24 Zalan Bujtas <zalan@apple.com> Fix project file after r230931. * WebCore.xcodeproj/project.pbxproj: 2018-04-24 Jer Noble <jer.noble@apple.com> Don't add system framework paths to FRAMEWORK_SEARCH_PATHS https://bugs.webkit.org/show_bug.cgi?id=184786 Reviewed by Tim Horton. * Configurations/WebCore.xcconfig: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: 2018-04-24 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Remove dead fixed layer code https://bugs.webkit.org/show_bug.cgi?id=184912 Reviewed by Michael Catanzaro. Remove CoordinatedGraphicsLayer::setFixedToViewport() and the corresponding attribute on the CoordinatedGraphicsLayerState struct. The method is not called anywhere since r230952. CoordinatedGraphicsState struct also loses the scrollPosition attribute that also isn't used anymore. Changes to GraphicsLayerTextureMapper class mirror those made to CoordinatedGraphicsLayer, removing support for the fixed-to-viewport attribute. This too was not called from anywhere. All that enables us removing fixed-to-viewport handling in the TextureMapperLayer class. Along with related changes in the CoordinatedGraphicsScene class, we're able to remove a bunch of methods and member variables that are not used or needed anymore. * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper): (WebCore::GraphicsLayerTextureMapper::commitLayerChanges): (WebCore::GraphicsLayerTextureMapper::setFixedToViewport): Deleted. * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::computeTransformsRecursive): (WebCore::TextureMapperLayer::setFixedToViewport): Deleted. (WebCore::TextureMapperLayer::isAncestorFixedToViewport const): Deleted. (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded): Deleted. * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): (WebCore::CoordinatedGraphicsLayer::syncLayerState): (WebCore::CoordinatedGraphicsLayer::setFixedToViewport): Deleted. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h: (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState): 2018-04-24 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Remove unused fixed layout functionality https://bugs.webkit.org/show_bug.cgi?id=184908 Reviewed by Carlos Garcia Campos. Ports using the CoordinatedGraphics subsystem don't expose fixed layout support. As such, we're able to remove a lot of unused code and unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections in both WebCore and WebKit. With fixed layout not available for use to users of the GTK+ and WPE ports, we can remove the ScrollingCoordinatorCoordinatedGraphics implementation, making room for an implementation that inherits from AsyncScrollingCoordinator in the future. For that purpose the ScrollingCoordinator::create() function is moved into the ScrollingCoordinatorCoordinatedGraphics.cpp file already. This also enables removing delegatedScrollRequested() method from HostWindow and the inheriting ChromeClient interface. * loader/EmptyClients.h: * page/Chrome.cpp: (WebCore::Chrome::delegatedScrollRequested): Deleted. * page/Chrome.h: * page/ChromeClient.h: * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::create): * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp: (WebCore::ScrollingCoordinator::create): (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics): Deleted. (WebCore::ScrollingCoordinatorCoordinatedGraphics::attachToStateTree): Deleted. (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree): Deleted. (WebCore::ScrollingCoordinatorCoordinatedGraphics::clearStateTree): Deleted. (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer): Deleted. (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints): Deleted. (WebCore::ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate): Deleted. * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Removed. * platform/HostWindow.h: 2018-04-24 Daniel Bates <dabates@apple.com> Attempt to fix the Apple Internal build following r230922 (https://bugs.webkit.org/show_bug.cgi?id=184737) Cast the return value of std::map::size() to a size_t before logging it with format specifier "%zu". std::map::size() returns a size_type. According to <http://en.cppreference.com/w/cpp/container/map> size_type is "usually a size_t", but it may not be. An Apple Internal debug builder reports that size_type = unsigned int != unsigned long = size_t. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::provideMediaData): 2018-04-24 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Avoid painting backing stores for zero-opacity layers https://bugs.webkit.org/show_bug.cgi?id=184143 Reviewed by Carlos Garcia Campos. Skip generating backing stores for layers that have zero opacity and do not animate the opacity value. In the current CoordinatedGraphics system this can end up saving loads of memory on Web content that deploys a large number of such elements. * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const): 2018-04-24 Daniel Bates <dabates@apple.com> Attempt to fix the Apple Internal build following r230944 (https://bugs.webkit.org/show_bug.cgi?id=159464) * platform/network/mac/CookieJarMac.mm: 2018-04-24 Daniel Bates <dabates@apple.com> Another attempt to fix the Mac and iOS build following r230944 (https://bugs.webkit.org/show_bug.cgi?id=159464) * platform/network/mac/CookieJarMac.mm: (WebCore::policyProperties): 2018-04-24 Daniel Bates <dabates@apple.com> Attempt to fix the Mac and iOS build following r230944 (https://bugs.webkit.org/show_bug.cgi?id=159464) * platform/network/mac/CookieJarMac.mm: (WebCore::policyProperties): 2018-04-23 Daniel Bates <dabates@apple.com> Implement Same-Site cookies https://bugs.webkit.org/show_bug.cgi?id=159464 <rdar://problem/27196358> Reviewed by Brent Fulgham. Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>. The implementation is materially consistent with the spec. though implements the computation for a document's "site for cookies" indirectly as part of loading its frame. This is done to avoid traversing the frame tree on each subresource request initiated by the document or one of its workers. We take advantage of the fact that Web Workers and Service Workers use their host document's loader to load resources on their behalf to use the correct "site for cookies" for requests (e.g. fetch()) initiating by them without the need to duplicate and store the host document's "site for cookies" in the worker's script execution context. The implementation differs from the spec. in the handling of about: URLs and the empty URL and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin> (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("") are treated as same-site because these URLs inherit their origin from their owner. Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html http/tests/cookies/same-site/fetch-in-about-blank-page.html http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html http/tests/cookies/same-site/fetch-in-cross-origin-page.html http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html http/tests/cookies/same-site/fetch-in-cross-origin-worker.html http/tests/cookies/same-site/fetch-in-same-origin-page.html http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html http/tests/cookies/same-site/fetch-in-same-origin-worker.html http/tests/cookies/same-site/popup-cross-site-post.html http/tests/cookies/same-site/popup-cross-site.html http/tests/cookies/same-site/popup-same-site-post.html http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html http/tests/cookies/same-site/popup-same-site.html * Sources.txt: Add source file SameSiteInfo.cpp. * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}. * dom/Document.cpp: (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner(). (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto. (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy. * dom/Document.h: (WebCore::Document::firstPartyForSameSiteCookies const): Added. (WebCore::Document::setFirstPartyForSameSiteCookies): Added. * loader/CookieJar.cpp: (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document. (WebCore::cookies): Pass the same-site info down to the platform. (WebCore::cookieRequestHeaderFieldProxy): Ditto. (WebCore::setCookies): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request. (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest() here. Specifically, we would not need to differentiate between a request with an unspecified same-site state (default state of a new request) from a request whose same-site state has been explicitly set if we can assume that the same-site state of a request is set exactly once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing same-site information computed with a null initiating document (the case of a new address bar initiated load) from a load initiated by the document associated with this loader. * loader/FrameLoader.cpp: (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for same-site cookies ("site for cookies"). (WebCore::FrameLoader::load): Add same-site info to the request. (WebCore::FrameLoader::reload): Ditto. (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto. (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have same-site info then compute it and add it to the request. Mark main frame main resource requests as a "top-site". (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site' Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>. (WebCore::createWindow): Add same-site info to the request. * loader/FrameLoader.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::init): Ditto. * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): Ditto. * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp. * page/SecurityPolicy.h: * platform/CookiesStrategy.h: * platform/network/CacheValidation.cpp: (WebCore::headerValueForVary): Pass the same-site info down to the platform. * platform/network/CookieRequestHeaderFieldProxy.h: (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits. (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits. * platform/network/PlatformCookieJar.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added. (WebCore::ResourceRequestBase::isSameSite const): Added. (WebCore::ResourceRequestBase::setIsSameSite): Added. (WebCore::ResourceRequestBase::isTopSite const): Added. (WebCore::ResourceRequestBase::setIsTopSite): Added. (WebCore::equalIgnoringHeaderFields): * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource() for more details. (WebCore::registrableDomainsAreEqual): Added. (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits. (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits. * platform/network/SameSiteInfo.cpp: Added. (WebCore::SameSiteInfo::create): * platform/network/SameSiteInfo.h: Added. (WebCore::SameSiteInfo::encode const): (WebCore::SameSiteInfo::decode): * platform/network/cf/CookieJarCFNet.cpp: (WebCore::setCookiesFromDOM): Pass Same-Site info down. (WebCore::cookiesForDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::siteForCookies): Added. (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info. (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto. * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto. (WebCore::siteForCookies): Added. (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info. * platform/network/curl/CookieJarCurl.cpp: (WebCore::cookiesForDOM): Pass Same-Site info down. (WebCore::setCookiesFromDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * platform/network/curl/CookieJarCurl.h: * platform/network/curl/CookieJarCurlDatabase.cpp: (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto. (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto. (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto. (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto. * platform/network/curl/CookieJarCurlDatabase.h: * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::createCurlRequest): Ditto. * platform/network/mac/CookieJarMac.mm: (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other CFNetwork helper functions. Modified to support fetching same-site cookies. (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL(). Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme case-insensitively matches "https". (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL(). (WebCore::cookiesForSession): Pass the Same-Site info. (WebCore::cookiesForDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::setCookiesFromDOM): Ditto. (WebCore::getRawCookies): Ditto. (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite attribute when fetching cookies to delete. * platform/network/soup/CookieJarSoup.cpp: (WebCore::setCookiesFromDOM): Pass the Same-Site info. (WebCore::cookiesForDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to the script URL. * xml/XSLTProcessor.cpp: (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the new document. 2018-04-23 Youenn Fablet <youenn@apple.com> Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=184763 Reviewed by Chris Dumez. No change of behavior yet since we do not use these parameters in NetworkProcess yet. Add PreflightPolicy and CSP response headers as ResourceLoaderOptions. This allows passing them from DocumentThreadableLoader to WebLoaderStrategy. Allow getting the original headers from a SubresourceLoader. This allows passing them from DocumentThreadableLoader down to WebLoaderStrategy. * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::startLoadingBlobURL): (WebCore::FetchLoader::start): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest): (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): * loader/ResourceLoaderOptions.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::originalHeaders const): * loader/SubresourceLoader.h: * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): (WebCore::ThreadableLoaderOptions::isolatedCopy const): * loader/ThreadableLoader.h: * page/EventSource.cpp: (WebCore::EventSource::connect): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createRequest): 2018-04-23 Michael Catanzaro <mcatanzaro@igalia.com> [WPE][GTK] Remove WlUniquePtr<wl_display> footgun https://bugs.webkit.org/show_bug.cgi?id=184405 Reviewed by Carlos Garcia Campos. WlUniquePtr<wl_display> is a pretty big footgun because there are two different destruction functions -- wl_display_disconnect() and wl_display_destroy() -- and which one you need to use depends on how the wl_display() was created, and WebKit uses both in different places. So WlUniquePtr<wl_display> is pretty unsafe. See bug #176490 for an example of fun caused by using it incorrectly. Let's use std::unique_ptr with custom deleter functors instead. * platform/graphics/wayland/WlUniquePtr.h: 2018-04-23 Antti Koivisto <antti@apple.com> REGRESSION (r220112): reCAPTCHA images render off screen on Twitch.tv app Log In or Sign Up https://bugs.webkit.org/show_bug.cgi?id=182859 <rdar://problem/37595065> Reviewed by Zalan Bujtas. Roll out this change from the trunk as the issue it fixed no longer occurs. * css/MediaQueryEvaluator.cpp: (WebCore::orientationEvaluate): (WebCore::aspectRatioEvaluate): (WebCore::heightEvaluate): (WebCore::widthEvaluate): * page/FrameView.cpp: (WebCore::FrameView::layoutSizeForMediaQuery const): Deleted. * page/FrameView.h: * page/LayoutContext.cpp: (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded): 2018-04-23 Daniel Bates <dabates@apple.com> Another attempt to fix the Windows build following r230921 (https://bugs.webkit.org/show_bug.cgi?id=159464) Pass dictionary key name using a string instead of a constant and pass CFURL* to siteForCookies(). * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::ResourceRequest::doUpdatePlatformRequest): (WebCore::ResourceRequest::doUpdateResourceRequest): 2018-04-23 Zalan Bujtas <zalan@apple.com> [LayoutFormattingContext] Initial commit. https://bugs.webkit.org/show_bug.cgi?id=184896 Reviewed by Antti Koivisto. This is the initial commit of the new layout component -class definitions only (and mostly public functions). See the header files (and Tools/LayoutReloaded project) for more information. // Top level layout. rootContainer = TreeBuilder::createLayoutTree(document); rootDisplayBox = new Display::Box(); rootDisplayBox->setSize(viewportSize); layoutContext = new LayoutContext(rootContainer, rootDisplayBox); layoutContext->layout(rootContainer); Driven by build time flag (currently off). Not testable yet. * Configurations/FeatureDefines.xcconfig: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * layout/BlockFormatting/BlockFormattingContext.cpp: Added. * layout/BlockFormatting/BlockFormattingContext.h: Added. * layout/BlockFormatting/BlockFormattingState.cpp: Added. * layout/BlockFormatting/BlockFormattingState.h: Added. * layout/BlockFormatting/BlockMarginCollapse.cpp: Added. * layout/BlockFormatting/BlockMarginCollapse.h: Added. * layout/DisplayTree/DisplayBox.cpp: Added. * layout/DisplayTree/DisplayBox.h: Added. * layout/FloatingContext.cpp: Added. * layout/FloatingContext.h: Added. * layout/FloatingState.cpp: Added. * layout/FloatingState.h: Added. * layout/FormattingContext.cpp: Added. * layout/FormattingContext.h: Added. * layout/FormattingState.cpp: Added. * layout/FormattingState.h: Added. * layout/InlineFormatting/InlineFormattingContext.cpp: Added. * layout/InlineFormatting/InlineFormattingContext.h: Added. * layout/InlineFormatting/InlineFormattingState.cpp: Added. * layout/InlineFormatting/InlineFormattingState.h: Added. * layout/LayoutCtx.cpp: Added. * layout/LayoutCtx.h: Added. * layout/LayoutTree/LayoutBlockContainer.cpp: Added. * layout/LayoutTree/LayoutBlockContainer.h: Added. * layout/LayoutTree/LayoutBox.cpp: Added. * layout/LayoutTree/LayoutBox.h: Added. * layout/LayoutTree/LayoutContainer.cpp: Added. * layout/LayoutTree/LayoutContainer.h: Added. * layout/LayoutTree/LayoutCtx.h: Added. * layout/LayoutTree/LayoutInlineBox.cpp: Added. * layout/LayoutTree/LayoutInlineBox.h: Added. * layout/LayoutTree/LayoutInlineContainer.cpp: Added. * layout/LayoutTree/LayoutInlineContainer.h: Added. 2018-04-23 Daniel Bates <dabates@apple.com> Attempt to fix the Mac and iOS build after r230921 (https://bugs.webkit.org/show_bug.cgi?id=159464) Pass strings for the dictionary key names instead of using an extern constant as the latter may not be available on all systems. * platform/network/mac/CookieJarMac.mm: (WebCore::setHTTPCookiesForURL): 2018-04-23 Daniel Bates <dabates@apple.com> Attempt to fix the build after r230921 (https://bugs.webkit.org/show_bug.cgi?id=159464) Pass Same-Site info through. * platform/network/cf/CookieJarCFNet.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/curl/CookieJarCurl.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/curl/CookieJarCurlDatabase.cpp: (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): * platform/network/soup/CookieJarSoup.cpp: (WebCore::cookieRequestHeaderFieldValue): 2018-04-23 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, speculative macOS build fix attempt. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::provideMediaData): 2018-04-23 Daniel Bates <dabates@apple.com> Implement Same-Site cookies https://bugs.webkit.org/show_bug.cgi?id=159464 <rdar://problem/27196358> Reviewed by Brent Fulgham. Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>. The implementation is materially consistent with the spec. though implements the computation for a document's "site for cookies" indirectly as part of loading its frame. This is done to avoid traversing the frame tree on each subresource request initiated by the document or one of its workers. We take advantage of the fact that Web Workers and Service Workers use their host document's loader to load resources on their behalf to use the correct "site for cookies" for requests (e.g. fetch()) initiating by them without the need to duplicate and store the host document's "site for cookies" in the worker's script execution context. The implementation differs from the spec. in the handling of about: URLs and the empty URL and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin> (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("") are treated as same-site because these URLs inherit their origin from their owner. Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html http/tests/cookies/same-site/fetch-in-about-blank-page.html http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html http/tests/cookies/same-site/fetch-in-cross-origin-page.html http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html http/tests/cookies/same-site/fetch-in-cross-origin-worker.html http/tests/cookies/same-site/fetch-in-same-origin-page.html http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html http/tests/cookies/same-site/fetch-in-same-origin-worker.html http/tests/cookies/same-site/popup-cross-site-post.html http/tests/cookies/same-site/popup-cross-site.html http/tests/cookies/same-site/popup-same-site-post.html http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html http/tests/cookies/same-site/popup-same-site.html * Sources.txt: Add source file SameSiteInfo.cpp. * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}. * dom/Document.cpp: (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner(). (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto. (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy. * dom/Document.h: (WebCore::Document::firstPartyForSameSiteCookies const): Added. (WebCore::Document::setFirstPartyForSameSiteCookies): Added. * loader/CookieJar.cpp: (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document. (WebCore::cookies): Pass the same-site info down to the platform. (WebCore::cookieRequestHeaderFieldProxy): Ditto. (WebCore::setCookies): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request. (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest() here. Specifically, we would not need to differentiate between a request with an unspecified same-site state (default state of a new request) from a request whose same-site state has been explicitly set if we can assume that the same-site state of a request is set exactly once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing same-site information computed with a null initiating document (the case of a new address bar initiated load) from a load initiated by the document associated with this loader. * loader/FrameLoader.cpp: (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for same-site cookies ("site for cookies"). (WebCore::FrameLoader::load): Add same-site info to the request. (WebCore::FrameLoader::reload): Ditto. (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto. (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have same-site info then compute it and add it to the request. Mark main frame main resource requests as a "top-site". (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site' Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>. (WebCore::createWindow): Add same-site info to the request. * loader/FrameLoader.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::init): Ditto. * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): Ditto. * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp. * page/SecurityPolicy.h: * platform/CookiesStrategy.h: * platform/network/CacheValidation.cpp: (WebCore::headerValueForVary): Pass the same-site info down to the platform. * platform/network/CookieRequestHeaderFieldProxy.h: (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits. (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits. * platform/network/PlatformCookieJar.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added. (WebCore::ResourceRequestBase::isSameSite const): Added. (WebCore::ResourceRequestBase::setIsSameSite): Added. (WebCore::ResourceRequestBase::isTopSite const): Added. (WebCore::ResourceRequestBase::setIsTopSite): Added. (WebCore::equalIgnoringHeaderFields): * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource() for more details. (WebCore::registrableDomainsAreEqual): Added. (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits. (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits. * platform/network/SameSiteInfo.cpp: Added. (WebCore::SameSiteInfo::create): * platform/network/SameSiteInfo.h: Added. (WebCore::SameSiteInfo::encode const): (WebCore::SameSiteInfo::decode): * platform/network/cf/CookieJarCFNet.cpp: (WebCore::setCookiesFromDOM): Pass Same-Site info down. (WebCore::cookiesForDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::siteForCookies): Added. (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info. (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto. * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto. (WebCore::siteForCookies): Added. (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info. * platform/network/curl/CookieJarCurl.cpp: (WebCore::cookiesForDOM): Pass Same-Site info down. (WebCore::setCookiesFromDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * platform/network/curl/CookieJarCurl.h: * platform/network/curl/CookieJarCurlDatabase.cpp: (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto. (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto. (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto. (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto. * platform/network/curl/CookieJarCurlDatabase.h: * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::createCurlRequest): Ditto. * platform/network/mac/CookieJarMac.mm: (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other CFNetwork helper functions. Modified to support fetching same-site cookies. (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL(). Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme case-insensitively matches "https". (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL(). (WebCore::cookiesForSession): Pass the Same-Site info. (WebCore::cookiesForDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::setCookiesFromDOM): Ditto. (WebCore::getRawCookies): Ditto. (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite attribute when fetching cookies to delete. * platform/network/soup/CookieJarSoup.cpp: (WebCore::setCookiesFromDOM): Pass the Same-Site info. (WebCore::cookiesForDOM): Ditto. (WebCore::cookieRequestHeaderFieldValue): Ditto. (WebCore::getRawCookies): Ditto. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to the script URL. * xml/XSLTProcessor.cpp: (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the new document. 2018-04-23 Chris Dumez <cdumez@apple.com> HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction https://bugs.webkit.org/show_bug.cgi?id=184848 <rdar://problem/39145306> Reviewed by Brady Eidson. When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank' with substitute data. In such case, we want to do a regular asynchronous policy delegate check, there is no reason we need it to be synchronous. Update our check to make sure we only do a synchronous policy check for initial 'about:blank' loads that do not have substitute data. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): 2018-04-23 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] 100vw is roughly half of the viewport width in extra zoom mode https://bugs.webkit.org/show_bug.cgi?id=184871 <rdar://problem/39477595> Reviewed by Andy Estes. Currently, when computing CSS viewport units, we use ViewportConfiguration::initialScaleIgnoringContentSize(). This method computes an initial scale from the layout width and height without relying on any information derived from the current content size. This is done to ensure that the content size and viewport dimensions for CSS viewport units should not be simultaneously dependent on each other. Since shrink-to-fit heuristics depend on content size, we currently assume that shrink-to-fit is disabled when computing initialScaleIgnoringContentSize, by always passing in `false` for `shouldIgnoreScalingConstraints`. However, in extra zoom mode, the opposite is true: since we force both `m_canIgnoreScalingConstraints` and `m_forceHorizontalShrinkToFit` to be `true` in this mode, we will always try to shrink-to-fit regardless of content size. Because of this shrink-to-fit disparity between `initialScale` and `initialScaleIgnoringContentSize`, viewport units in extra zoom mode are currently computed assuming an initial scale set by the page, whereas the real viewport is scaled to fit, which causes any lengths computed in terms of vw and vh to be incorrect. To fix this, we introduce a version of shouldIgnoreScalingConstraints() that returns `true` iff scaling constraints are always ignored, regardless of content size. We then use this in initialScaleIgnoringContentSize, instead of always passing in `false` for `shouldIgnoreScalingConstraints`. Test: fast/css/extrazoom/viewport-units-shrink-to-fit.html * page/ViewportConfiguration.cpp: (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const): (WebCore::ViewportConfiguration::initialScaleIgnoringContentSize const): * page/ViewportConfiguration.h: 2018-04-23 Zalan Bujtas <zalan@apple.com> [Simple line layout] Generate inline boxtree using simple line layout runs. https://bugs.webkit.org/show_bug.cgi?id=184833 Reviewed by Antti Koivisto. RenderBlockFlow::ensureLineBoxes triggers line layout on the block content to replace the simple line layout runs with an inline boxtree. The runs generated by the fast path should always match the inline tree boxes. In this patch instead of triggering layout, we just convert the simple line runs to inline boxes. Currently, it works with only one, non-paginated text renderer, but we should be able to extend it to all the simple line layout content. Covered by existing tests. * rendering/InlineBox.h: (WebCore::InlineBox::setHasHyphen): (WebCore::InlineBox::setCanHaveLeadingExpansion): (WebCore::InlineBox::setCanHaveTrailingExpansion): (WebCore::InlineBox::setForceTrailingExpansion): (WebCore::InlineBox::setForceLeadingExpansion): (WebCore::InlineBox::hasHyphen const): (WebCore::InlineBox::canHaveLeadingExpansion const): (WebCore::InlineBox::canHaveTrailingExpansion const): (WebCore::InlineBox::forceTrailingExpansion const): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::ensureLineBoxes): * rendering/RenderBlockFlow.h: * rendering/SimpleLineLayoutFlowContents.h: (WebCore::SimpleLineLayout::FlowContents::segmentForRun const): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::canUseForLineBoxTree): (WebCore::SimpleLineLayout::initializeInlineBox): (WebCore::SimpleLineLayout::generateLineBoxTree): * rendering/SimpleLineLayoutFunctions.h: * rendering/SimpleLineLayoutResolver.cpp: (WebCore::SimpleLineLayout::RunResolver::rangeForLine const): * rendering/SimpleLineLayoutResolver.h: 2018-04-23 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer https://bugs.webkit.org/show_bug.cgi?id=184881 Reviewed by Michael Catanzaro. Remove the redundant findFirstDescendantWithContentsRecursively() and setVisibleContentRectTrajectoryVector() methods on the CoordinatedGraphicsLayer class. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively): Deleted. (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): Deleted. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2018-04-23 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value https://bugs.webkit.org/show_bug.cgi?id=184880 Reviewed by Michael Catanzaro. Drop the m_supportsAlpha member from the TiledBackingStore class. The member value was unused. TiledBackingStore::setSupportsAlpha() method is removed. TiledBackingStore::setSupportsAlpha() invalidated the backing store, so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same behavior by manually updating the m_needsDisplay struct. This means that during the following layer flush the backing store is repainted in its entirety. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setContentsOpaque): (WebCore::CoordinatedGraphicsLayer::createBackingStore): * platform/graphics/texmap/coordinated/TiledBackingStore.cpp: (WebCore::TiledBackingStore::TiledBackingStore): (WebCore::TiledBackingStore::setSupportsAlpha): Deleted. * platform/graphics/texmap/coordinated/TiledBackingStore.h: 2018-04-23 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method https://bugs.webkit.org/show_bug.cgi?id=184650 Reviewed by Philippe Normand. In the playbin3 case we can assume that if the GstStream is selected by default, it is the Main track of that kind. No new tests are added as: * It relies on playbin3 case which support might be compiled out * we already have a few test that are currently disabled in the mediastream testsuite. This patch is part of the work to enable them. * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: (WebCore::AudioTrackPrivateGStreamer::kind const): * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: (WebCore::VideoTrackPrivateGStreamer::kind const): * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h: 2018-04-23 Alicia Boya García <aboya@igalia.com> [MSE] Add allSamplesInTrackEnqueued event https://bugs.webkit.org/show_bug.cgi?id=184737 MediaSource has a .endOfStream() method to signal when there are no more frames after the ones currently buffered. This bit of data is important for some multimedia frameworks. For instance, in GStreamer a stream of frames being decoded should be terminated by a 'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements will expect this event in order to work properly under some circumstances. Unfortunately currently WebKit provides no mechanism for this: an event of sorts should be emitted after no more frames are going to be enqueued to signal the end of the stream. The closest mechanism WebKit has for this is `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs that -- as far as network buffering is concerned -- we are done; but at that point there may still be (and often are) many frames waiting in the decodeQueue, so it would be wrong to signal the decoder that there are no more frames. This patch introduces a new optional method in SourceBufferPrivate, `allSamplesInTrackEnqueued(const AtomicString& trackID)` that is called whenever the MediaSource is in "ended" state (the user has called `MediaSource.endOfStream()`) and the decodeQueue is empty. Media framework implementations can use this method to send a EOS event to a decoder that needs it. Reviewed by Xabier Rodriguez-Calvar. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::streamEndedWithError): * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::provideMediaData): (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued): (WebCore::SourceBuffer::trySignalAllSamplesEnqueued): * Modules/mediasource/SourceBuffer.h: * platform/graphics/SourceBufferPrivate.h: (WebCore::SourceBufferPrivate::allSamplesInTrackEnqueued): * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued): * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: (WebCore::PlaybackPipeline::allSamplesInTrackEnqueued): * platform/graphics/gstreamer/mse/PlaybackPipeline.h: * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued): * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: 2018-04-23 Ms2ger <Ms2ger@igalia.com> Avoid uninitialized memory read. https://bugs.webkit.org/show_bug.cgi?id=184505 <rdar://problem/39348325> Reviewed by Dean Jackson. Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html * html/ImageBitmap.cpp: (WebCore::croppedSourceRectangleWithFormatting): 2018-04-23 Zan Dobersek <zdobersek@igalia.com> [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore https://bugs.webkit.org/show_bug.cgi?id=184810 Reviewed by Carlos Garcia Campos. Turn TextureMapperBackingStore into a simple interface that doesn't inherit from RefCounted<>. Instead, push that inheritance off to the classes that implement the TextureMapperBackingStore interface. This narrows down the purpose of TextureMapperBackingStore towards a simple interface that TextureMapper algorithms can work with. TextureMapperLayer has its m_backingStore member variable turn into a simple pointer instead of a RefPtr<>. Setter method and call sites of that method are updated to reflect that. TextureMapperTiledBackingStore now inherits from RefCounted<> directly, instead of through TextureMapperBackingStore. * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::commitLayerChanges): (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded): * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/TextureMapperBackingStore.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::setBackingStore): * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/TextureMapperTiledBackingStore.h: 2018-04-22 Zan Dobersek <zdobersek@igalia.com> [AsyncScrolling] Add generic ScrollingThread implementation https://bugs.webkit.org/show_bug.cgi?id=184809 Reviewed by Yusuke Suzuki. Add a generic ScrollingThread implementation that internally uses RunLoop facilities to run the scrolling thread and dispatch callbacks on that thread. ScrollingThread::initializeRunLoop() retrieves address of the thread-specific RunLoop and signals the Condition object. ScrollingThread::wakeUpRunLoop() uses RunLoop::dispatch() to schedule callback dispatches on the scrolling thread. ScrollingThread::createThreadIfNeeded() mimics Cocoa implementation and waits for the RunLoop address to be retrieved before continuing. * SourcesGTK.txt: Add to build. * SourcesWPE.txt: Ditto. * page/scrolling/ScrollingThread.cpp: (WebCore::ScrollingThread::createThreadIfNeeded): * page/scrolling/ScrollingThread.h: * page/scrolling/generic/ScrollingThreadGeneric.cpp: Added. (WebCore::ScrollingThread::initializeRunLoop): (WebCore::ScrollingThread::wakeUpRunLoop): 2018-04-22 Zan Dobersek <zdobersek@igalia.com> [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState https://bugs.webkit.org/show_bug.cgi?id=184811 Reviewed by Carlos Garcia Campos. Remove the unused contentsSize and coveredRect attributes on the CoordinatedGraphicsState struct. CoordinatedGraphicsLayer::coverRect() method is now unused and can also be removed. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h: 2018-04-21 Daniel Bates <dabates@apple.com> Cleanup CookieRequestHeaderFieldProxy https://bugs.webkit.org/show_bug.cgi?id=184868 Remove extraneous whitespace that I inadvertently added. * platform/network/CookieRequestHeaderFieldProxy.h: (WebCore::CookieRequestHeaderFieldProxy::decode): 2018-04-21 Daniel Bates <dabates@apple.com> Cleanup CookieRequestHeaderFieldProxy https://bugs.webkit.org/show_bug.cgi?id=184868 Reviewed by Youenn Fablet. Simplify the struct CookieRequestHeaderFieldProxy and make it consistent with other structs. Among other changes, remove constructors for CookieRequestHeaderFieldProxy as they are unnecessary as all supported compilers support non-static data member initializers (NSDMI) for aggregates, remove prefix "m_" from the name of fields as this is struct exists for convenience and offers no encapsulation and simplify decoding logic of this struct. No functionality changed. So, no new tests. * loader/CookieJar.cpp: (WebCore::cookieRequestHeaderFieldProxy): * platform/network/CookieRequestHeaderFieldProxy.h: (WebCore::CookieRequestHeaderFieldProxy::encode const): (WebCore::CookieRequestHeaderFieldProxy::decode): (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): Deleted. * platform/network/SocketStreamHandleImpl.cpp: (WebCore::cookieDataForHandshake): * platform/network/cf/CookieJarCFNet.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/curl/CookieJarCurl.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/curl/CookieJarCurlDatabase.cpp: (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): * platform/network/mac/CookieJarMac.mm: (WebCore::cookieRequestHeaderFieldValue): * platform/network/soup/CookieJarSoup.cpp: (WebCore::cookieRequestHeaderFieldValue): 2018-04-21 Antoine Quint <graouts@apple.com> [Modern Media Controls] Show a loading indicator after pressing the play button in compact mode https://bugs.webkit.org/show_bug.cgi?id=184863 <rdar://problem/38939468> Reviewed by Dean Jackson. We now display a loading indicator after pressing the play button when in compact mode. We also update the behavior to use assets provided through WebKitAdditions (see webkit.org/b/184862) for the play button and the invalid icon. Additionally, we always show a 20% opaque black overlay in the background while any piece of user interface is up. * Modules/modern-media-controls/controls/compact-activity-indicator.css: Added. (button.compact-activity-indicator > picture): The loading indicator asset is a sprite made of 23 frames, so we specify the mask size (since all buttons are rendered via a mask) to be 23 * 100% the rendered size. The display of the loading indicator is performed with a first intro animation which runs once through the first 8 frames and then a continuously looping animation going through the remaining frames. We use a frames() timing function to achieve the frame-by-frame effect while using only from/to keyframe animations. When we fade out, we use a simply opacity fade, which is combined with the spinning animation. We use CSS variables to encode both animations so they can be used combined or one at a time without redefining the whole animation property. (button.compact-activity-indicator.spins > picture): Use the "spins" animation variable when spinning. (button.compact-activity-indicator.spins.fades-out > picture): Combine the "spins" and "fades-out" animation variables when fading out. (@keyframes compact-activity-indicator-intro): Animation going through the first 8 frames of the loading indicator. (@keyframes compact-activity-indicator-loop): Animation going through the remaining frames of the loading indicator. (@keyframes compact-activity-indicator-fades-out): Animation fading opacity from 1 to 0. * Modules/modern-media-controls/controls/compact-activity-indicator.js: Added. (CompactActivityIndicator): (CompactActivityIndicator.prototype.show): Add the "spins" CSS class to show the control spinning with the intro animation. (CompactActivityIndicator.prototype.hide): Add the "fades-out" CSS class to hide the control, removing both this class and the "spins" class when the fade-out animation completes. * Modules/modern-media-controls/controls/compact-media-controls.css: Added. (.media-controls.compact:before): Add a 20% black overlay over the video frame to provide contrast for controls. (.media-controls.compact button): Ensure buttons are sized to use the entire video frame so that their hit region comprises the whole video frame. (.media-controls.compact button > picture): Override default blending styles for a simple solid white mask. (.media-controls.compact button:active > picture): Turn off the scale down effect when pressing a button. * Modules/modern-media-controls/controls/compact-media-controls.js: Expose a "state" property for the compact media controls, which can be exlusively one of three: "paused", "pending" and "invalid". (CompactMediaControls.): (CompactMediaControls.prototype.get state): (CompactMediaControls.prototype.set state): (CompactMediaControls.prototype.layout): In the "paused" state, show the play button. In the "pending" state show the loading indicator. In the "invalid" state show the invalid button. (CompactMediaControls.prototype.get placard): Deleted. (CompactMediaControls.prototype.set placard): Deleted. * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/media/compact-media-controls-support.js: Added. (CompactMediaControlsSupport.prototype.get mediaEvents): (CompactMediaControlsSupport.prototype.handleEvent): Make the controls enter the "paused" state when receiving a "pause" event. Make the controls enter the "invalid" state when receiving an "error" event. (CompactMediaControlsSupport.prototype.enable): (CompactMediaControlsSupport.prototype.disable): (CompactMediaControlsSupport.prototype.buttonWasPressed): Play the media when pressing the play button and make the controls enter the "pending" state. When pressing the loading indicator, pause the media and make the controls enter the "paused" state. (CompactMediaControlsSupport.prototype._buttons): (CompactMediaControlsSupport): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._supportingObjectClasses): Only use CompactMediaControlsSupport as a media controller supporting object in the compact mode. * Modules/modern-media-controls/media/placard-support.js: (PlacardSupport.prototype.get mediaEvents): This media controller support object no longer needs to deal with compact mode. * Modules/modern-media-controls/media/playback-support.js: (PlaybackSupport.prototype.syncControl): This media controller support object no longer needs to deal with compact mode. (PlaybackSupport): 2018-04-21 Antoine Quint <graouts@apple.com> [Modern Media Controls] Obtain compact mode icons through WebKitAdditions https://bugs.webkit.org/show_bug.cgi?id=184862 <rdar://problem/39621645> Reviewed by Jon Lee. * Modules/modern-media-controls/controls/button.js: (Button.prototype._updateImageMetrics): Handle PDF assets where the image source's intrinsic size needs to be adjusted for the device pixel density. (Button): * Modules/modern-media-controls/controls/icon-service.js: Expect three additional icons provided through WebKitAdditions, including two in the PDF format, so we add support for this format. * WebCore.xcodeproj/project.pbxproj: Copy additional assets from the WebKitAdditions build directory should any be present. 2018-04-21 Dean Jackson <dino@apple.com> Expose whether you've build with the Apple Internal SDK https://bugs.webkit.org/show_bug.cgi?id=184864 Reviewed by Wenson Hsieh. Internals API to let a test know if it is running with the Apple internal SDK. * testing/Internals.cpp: (WebCore::usingAppleInternalSDK const): * testing/Internals.h: * testing/Internals.idl: 2018-04-20 Nan Wang <n_wang@apple.com> AX: AOM does not work with DOM Level 1 events https://bugs.webkit.org/show_bug.cgi?id=184847 Reviewed by Chris Fleizach. Added the accessibility events to the HTML attribute names. Test cases are added to the existing layout tests. * html/HTMLAttributeNames.in: * html/HTMLElement.cpp: (WebCore::HTMLElement::createEventHandlerNameMap): 2018-04-20 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r228088): [SOUP] Check TLS errors for WebSockets on GTlsConnection::accept-certificate https://bugs.webkit.org/show_bug.cgi?id=184804 Reviewed by Michael Catanzaro. * platform/network/soup/SocketStreamHandleImpl.h: Add a public url getter. * platform/network/soup/SocketStreamHandleImplSoup.cpp: (WebCore::acceptCertificateCallback): Call SoupNetworkSession::checkTLSErrors() to decide whether to accept the certificate or not. (WebCore::connectProgressCallback): Receive the SocketStreamHandle and pass it to acceptCertificateCallback callback. (WebCore::socketClientEventCallback): Ditto. (WebCore::SocketStreamHandleImpl::create): Always connect to network events. (WebCore::wssConnectionAcceptCertificateCallback): Deleted. (WebCore::wssSocketClientEventCallback): Deleted. 2018-04-20 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Do TLS error checking on GTlsConnection::accept-certificate https://bugs.webkit.org/show_bug.cgi?id=184480 Reviewed by Michael Catanzaro. * platform/network/soup/ResourceError.h: Change tlsError to recieve a failing URL instead of a SoupRequest, since the request was only used to get the failing URL. * platform/network/soup/ResourceErrorSoup.cpp: (WebCore::ResourceError::tlsError): Use the given failing URL. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::SoupNetworkSession::SoupNetworkSession): Use ssl-strict when creating the SoupSession to handle the certificates ourselves by connecting to GTlsConnection::accept-certificate. (WebCore::SoupNetworkSession::checkTLSErrors): Updated to receive a URL, certificate and errors instead of receiving a SoupRequest and SoupMessage and extract the url, certirficate and errors from them. Also return the optional error directly instead of using a completion handler since the function is always synchronous. * platform/network/soup/SoupNetworkSession.h: 2018-04-20 Tim Horton <timothy_horton@apple.com> Adjust geolocation feature flag https://bugs.webkit.org/show_bug.cgi?id=184856 Reviewed by Wenson Hsieh. * Configurations/FeatureDefines.xcconfig: 2018-04-20 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix Windows build after r230875. * platform/network/cf/CookieJarCFNet.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/curl/CookieJarCurlDatabase.cpp: 2018-04-20 Chris Dumez <cdumez@apple.com> REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler https://bugs.webkit.org/show_bug.cgi?id=184210 <rdar://problem/39072354> Reviewed by Wenson Hsieh. r229828 tried to have some API tests happy on iOS by freezing the layer tree during the navigation policy decision. However, this is observable by the client application and a regression from when the policy delegate was synchronous. To address the issue, this patch reverts r229828 and instead updates the iOS API tests to wait for the next presentation update after navigating before interacting with the view. * loader/FrameLoaderClient.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): 2018-04-20 Brent Fulgham <bfulgham@apple.com> Limit cookie header access to Network process https://bugs.webkit.org/show_bug.cgi?id=184764 <rdar://problem/36785285> Reviewed by Youenn Fablet. Revise the handling of cookie request headers so that we don't interact with them in the WebContent process. They are only needed for interaction with the server and the network process, so we should limit their scope to just the Network process. Instead, we should handle a token that represents the cookie headers in the WebContent process, which can be converted to the relevant cookie data in the network process when needed. * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::didOpenSocketStream): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::clientHandshakeMessage const): (WebCore::WebSocketHandshake::clientHandshakeRequest const): (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const): (WebCore::WebSocketHandshake::clientHandshakeMessage): Deleted. (WebCore::WebSocketHandshake::clientHandshakeRequest): Deleted. * Modules/websockets/WebSocketHandshake.h: * WebCore.xcodeproj/project.pbxproj: * loader/CookieJar.cpp: (WebCore::cookieRequestHeaderFieldProxy): * loader/CookieJar.h: * platform/network/CookieRequestHeaderFieldProxy.h: Added. (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): (WebCore::CookieRequestHeaderFieldProxy::isolatedCopy const): (WebCore::CookieRequestHeaderFieldProxy::encode const): (WebCore::CookieRequestHeaderFieldProxy::decode): * platform/network/PlatformCookieJar.h: * platform/network/SocketStreamHandle.cpp: (WebCore::SocketStreamHandle::sendHandshake): * platform/network/SocketStreamHandle.h: * platform/network/SocketStreamHandleImpl.cpp: (WebCore::SocketStreamHandleImpl::platformSendHandshake): * platform/network/cf/SocketStreamHandleImpl.h: * platform/network/curl/CookieJarCurl.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/curl/CookieJarCurl.h: * platform/network/curl/SocketStreamHandleImpl.h: * platform/network/mac/CookieJarMac.mm: (WebCore::cookieRequestHeaderFieldValue): * platform/network/soup/CookieJarSoup.cpp: (WebCore::cookieRequestHeaderFieldValue): * platform/network/soup/SocketStreamHandleImpl.h: 2018-04-20 Daniel Bates <dabates@apple.com> Hide Strong Password label when text field is too narrow https://bugs.webkit.org/show_bug.cgi?id=184785 <rdar://problem/38183939> Reviewed by Zalan Bujtas. We accomplish this illusion by allowing the text field's decorations to wrap, specifying flex shrink factors, a flex basis and hiding overflow. Hiding overflow is accomplished by a combination of setting "overflow: hidden", "text-overflow: clip", and patching RenderTextControlSingleLine::layout() to ensure that the height of the container element is equal to the intrinsic height of the inner elements. Because the container is a flex box and we want to vertically center its contents we also need to fix up the y-position of the container element as it may have flexed as a result of forcing its height to match the intrinsic height of the inner elements. * css/html.css: (input::-webkit-strong-password-auto-fill-button): Specify a flex-shrink factor and prevent wrapping of the "Strong Password" text when flexed. * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlInnerContainer::TextControlInnerContainer): Register for a custom style resolution callback so that we can style the container if it is a Strong Password or Strong Confirmation Password text field. Ideally we could accomplish this effect with a user agent- specific pseudo class together with a selector definition in the user agent style sheet, html.css. Unfortunately the style resolver does not seem to apply pseudo classes to shadow DOM pseudo elements (why?). Therefore we use a custom style resolution callback to achieve the same effect. (WebCore::isStrongPasswordTextField): Returns whether the specified DOM element is a Strong Password text field. (WebCore::TextControlInnerContainer::resolveCustomStyle): Conditionally apply CSS properties "flex-wrap: wrap" and overflow: hidden" if the shadow host of this container is a Strong Password text field. (WebCore::TextControlInnerElement::resolveCustomStyle): Conditionally style the inner text if the shadow host of this container is a Strong Password text field. We need to apply these styles here as opposed to in html.css for the same reason we need to apply the styles to the container in a custom style resolution callback. See the comments for TextControlInnerContainer() above for more details * html/shadow/TextControlInnerElements.h: * rendering/RenderTextControlSingleLine.cpp: (WebCore::resetOverriddenHeight): Added. Incorporates the logic from setNeedsLayoutOnAncestors(). (WebCore::RenderTextControlSingleLine::layout): Override the height of the container element to match the height of the inner elements when this text field is a Strong Password field. We cache the container's logical top before adjusting its height so that we can restore it after performing a second layout of this renderer. This is needed because we vertically center the elements in this renderer and adjusting the height of the container may cause it to flex and re-position along its cross axis when the container's height is taller than the inner element's height (e.g. the "Strong Password" label wraps to the next line). This re-positioning causes a noticeable jitter when transitioning from a field that has a visible "Strong Password" label to one that does not. Caching and restoring the logical top of the container element avoids this jitter. (WebCore::setNeedsLayoutOnAncestors): Deleted. Moved its implementation into resetOverriddenHeight(). 2018-04-20 Dean Jackson <dino@apple.com> Render a badge on system preview images https://bugs.webkit.org/show_bug.cgi?id=184854 <rdar://problem/39615154> Reviewed by Tim Horton. At paint time, if a RenderImage is an image element which is identified as a system preview, then draw a little badge in the top right corner. It is expected that platforms will override the default rendering with something that identifies how a system preview will operate. e.g. QuickLook on Apple systems. Test: system-preview/badge.html * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIntoRect): If we are a system preview, call RenderTheme to draw a badge. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paintSystemPreviewBadge): A default implementation that draws a red circle. * rendering/RenderTheme.h: 2018-04-20 Brian Burg <bburg@apple.com> Web Inspector: remove some dead code in IdentifiersFactory https://bugs.webkit.org/show_bug.cgi?id=184839 Reviewed by Timothy Hatcher. * inspector/InspectorController.cpp: (WebCore::InspectorController::setProcessId): Deleted. * inspector/InspectorController.h: 2018-04-20 Chris Dumez <cdumez@apple.com> Use WindowProxy in DOMWindow.idl https://bugs.webkit.org/show_bug.cgi?id=184820 Reviewed by Sam Weinig. Use WindowProxy in DOMWindow.idl to match the specification more closely. * bindings/js/JSWindowProxy.h: * bindings/js/WindowProxy.cpp: (WebCore::WindowProxy::window const): * bindings/js/WindowProxy.h: * bindings/scripts/CodeGeneratorJS.pm: (NativeToJSValueDOMConvertNeedsState): * dom/Document.cpp: * dom/Document.h: * dom/Document.idl: * page/DOMWindow.cpp: (WebCore::DOMWindow::focus): (WebCore::DOMWindow::self const): (WebCore::DOMWindow::opener const): (WebCore::DOMWindow::parent const): (WebCore::DOMWindow::top const): (WebCore::DOMWindow::open): * page/DOMWindow.h: * page/DOMWindow.idl: * testing/Internals.cpp: (WebCore::Internals::openDummyInspectorFrontend): * testing/Internals.h: * testing/Internals.idl: 2018-04-20 Chris Dumez <cdumez@apple.com> Update cross-origin SecurityError messages to not include the target origin https://bugs.webkit.org/show_bug.cgi?id=184803 <rdar://problem/39547724> Reviewed by Sam Weinig. No new tests, rebaselined existing tests. * bindings/js/JSDOMBindingSecurity.cpp: (WebCore::canAccessDocument): (WebCore::BindingSecurity::shouldAllowAccessToFrame): (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow): * page/DOMWindow.cpp: (WebCore::DOMWindow::crossDomainAccessErrorMessage): (WebCore::DOMWindow::isInsecureScriptAccess): * page/DOMWindow.h: * page/Location.cpp: (WebCore::Location::reload): 2018-04-20 Chris Nardi <cnardi@chromium.org> Update HSL/HSLA parsing to match CSS Color 4 https://bugs.webkit.org/show_bug.cgi?id=180528 <rdar://problem/35926675> CSS Color 4 specifies a comma optional syntax for HSL/HSLA, as well as allowing angle values for the hue and percent alpha values. Update our parsing to match this. Reviewed by Simon Fraser. This change also updates the import of WPT css-color to test the changes. Tests: LayoutTests/imported/w3c/web-platform-tests/css/css-color/hsl{a}-{001-008}.html * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::parseHSLParameters): (WebCore::CSSPropertyParserHelpers::parseColorFunction): (WebCore::CSSPropertyParserHelpers::consumeColor): * platform/graphics/Color.cpp: (WebCore::calcHue): (WebCore::makeRGBAFromHSLA): 2018-04-20 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Injected bundle form client should be notified when editing text fields https://bugs.webkit.org/show_bug.cgi?id=184822 <rdar://problem/38807319> Reviewed by Tim Horton. Export the constructor and destructor of UserTypingGestureIndicator for use in WebKit (see WebPage.cpp). Test: fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html * dom/UserTypingGestureIndicator.h: 2018-04-18 Jer Noble <jer.noble@apple.com> Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds https://bugs.webkit.org/show_bug.cgi?id=184762 Reviewed by Dan Bernstein. * Configurations/WebCore.xcconfig: * WebCore.xcodeproj/project.pbxproj: 2018-04-20 Daniel Bates <dabates@apple.com> Remove code for compilers that did not support NSDMI for aggregates https://bugs.webkit.org/show_bug.cgi?id=184599 Reviewed by Per Arne Vollan. Remove workaround for earlier Visual Studio versions that did not support non-static data member initializers (NSDMI) for aggregates. We have since updated all the build.webkit.org and EWS bots to a newer version that supports this feature. * Modules/cache/CacheQueryOptions.h: (WebCore::CacheQueryOptions::CacheQueryOptions): Deleted. * dom/Node.h: (WebCore::Node::InsertionType::InsertionType): Deleted. (WebCore::Node::RemovalType::RemovalType): Deleted. * html/canvas/CanvasStyle.h: (WebCore::CanvasStyle::CMYKAColor::CMYKAColor): Deleted. * page/EventHandler.h: (WebCore::EventHandler::DragTargetResponse::DragTargetResponse): Deleted. * page/animation/CSSAnimationController.h: (WebCore::AnimationUpdate::AnimationUpdate): Deleted. * platform/graphics/FontSelectionAlgorithm.h: (WebCore::FontSelectionRequest::tied const): (WebCore::FontSelectionRequest::FontSelectionRequest): Deleted. (WebCore::FontSelectionCapabilities::FontSelectionCapabilities): Deleted. * platform/mediastream/IceCandidate.h: (WebCore::IceCandidate::IceCandidate): Deleted. * platform/text/StringWithDirection.h: (WebCore::StringWithDirection::StringWithDirection): Deleted. * rendering/MarkedText.h: (WebCore::MarkedText::MarkedText): Deleted. * style/StyleUpdate.h: (WebCore::Style::ElementUpdate::ElementUpdate): Deleted. (WebCore::Style::ElementUpdates::ElementUpdates): Deleted. (WebCore::Style::TextUpdate::TextUpdate): Deleted. 2018-04-20 Youenn Fablet <youenn@apple.com> WebPage sometimes incorrectly rules out PDF as a mime type that can be showed https://bugs.webkit.org/show_bug.cgi?id=184369 Reviewed by Chris Dumez. WebPage does need to check for plugins at reception of the response. In that case, the page URL is the URL from which we are navigating out. Add plugin API to check for plugin availability with an extra URL parameter to cover that case. Covered by API test. * plugins/PluginData.cpp: (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const): (WebCore::PluginData::supportsWebVisibleMimeType const): * plugins/PluginData.h: 2018-04-20 Daniel Bates <dabates@apple.com> Remove Strong Password decoration when text field type changes https://bugs.webkit.org/show_bug.cgi?id=184795 <rdar://problem/38325108> Reviewed by Antti Koivisto. Remove the Strong Password decoration when the text field's type changes to avoid interfering with web sites that allow a person to show/hide their password. Test: fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateType): 2018-04-20 Javier Fernandez <jfernandez@igalia.com> Update Alignment shorthands to the spec now that they are not ambiguous https://bugs.webkit.org/show_bug.cgi?id=184812 Reviewed by Antti Koivisto. Now that the issue [1] about the syntax ambiguity has been resolved we don't need to use the custom syntax anymore. The Alignment shorthands use now the simple syntax, defined based on the longhands' syntax. Since we allow all the values valid for each longhand, we'll update in this CL the corresponding web platform tests. Additionally, this CL updates also the shorthand serialization tests [2], which didn't consider the new value 'legacy' for justify-items (and place-items) due to the bug [3] Firefox still has pending to be fixed. [1] https://github.com/w3c/csswg-drafts/issues/1001 [2] css/css-align/default-alignment/shorthand-serialization-001.html [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1363875 Tests: imported/w3c/web-platform-tests/css/css-align/default-alignment/shorthand-serialization-001.html imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-computed-001.html imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-001.html imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-002.html * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumePlaceContentShorthand): Using the justify-content and align-content parsing logic to parse the shorthand. (WebCore::CSSPropertyParser::consumePlaceItemsShorthand): Using the justify-items and align-items parsing logic to parse the shorthand. (WebCore::CSSPropertyParser::consumePlaceSelfShorthand): Using the justify-self and align-self parsing logic to parse the shorthand. 2018-04-20 Daniel Bates <dabates@apple.com> Unreviewed, rolling out r230117. Broke find-in-page for PDFs Reverted changeset: "ASSERTION FAILED: ASSERT(!containsImage || MIMETypeRegistry::isSupportedImageResourceMIMEType([resource MIMEType])) in -[NSPasteboard(WebExtras) _web_writePromisedRTFDFromArchive:containsImage:]" https://bugs.webkit.org/show_bug.cgi?id=184161 https://trac.webkit.org/changeset/230117 2018-04-20 Eric Carlson <eric.carlson@apple.com> Pausing should clear m_waitingToEnterFullscreen https://bugs.webkit.org/show_bug.cgi?id=184831 <rdar://problem/39602852> Reviewed by Jer Noble. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::pause): Clear m_waitingToEnterFullscreen 2018-04-20 Eric Carlson <eric.carlson@apple.com> [Extra zoom mode] Disable CA transactions while setting up for fullscreen https://bugs.webkit.org/show_bug.cgi?id=184817 <rdar://problem/39596075> Reviewed by Jer Noble. This was tested manually as it is not possible to write an automated test for this. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::doSetup): Move the call to disable CA transactions outside of the EXTRA_ZOOM_MODE check, the [CATransaction commit] was already unguarded. 2018-04-20 Youenn Fablet <youenn@apple.com> Make PluginData cache its web visible plugins https://bugs.webkit.org/show_bug.cgi?id=184421 Reviewed by Chris Dumez. Buffer visible plugins until the page URL changes. For that purpose, we now cache the visible plugins and the URL it was computed from in PluginData. Update plugin info provider API to pass the URL used to check for plugin visibility. No observable change of behavior. * loader/EmptyClients.cpp: * plugins/PluginData.cpp: (WebCore::PluginData::webVisiblePlugins const): (WebCore::PluginData::publiclyVisiblePlugins const): (WebCore::PluginData::supportsMimeType const): * plugins/PluginData.h: * plugins/PluginInfoProvider.h: 2018-04-20 Chris Dumez <cdumez@apple.com> Unreviewed build fix after r230840. * bindings/js/JSWindowProxy.cpp: (WebCore::JSWindowProxy::attachDebugger): 2018-04-20 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix the Windows build after r230831. * bindings/js/JSWindowProxy.cpp: (WebCore::JSWindowProxy::create): (WebCore::JSWindowProxy::attachDebugger): 2018-04-20 Chris Nardi <cnardi@chromium.org> Omit default value when serializing font-feature-settings https://bugs.webkit.org/show_bug.cgi?id=182382 Reviewed by Myles C. Maxfield. According to the shortest-serialization principle [1], values should be omitted if their omission wouldn't change the value of reparsing. As "1"/"on" is the default value for font-feature-settings, omit this when serializing, matching the behavior of Firefox and Chrome. [1]: https://github.com/w3c/csswg-drafts/issues/1564 Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html, and fast/text/font-face-javascript.html. * css/CSSFontFeatureValue.cpp: (WebCore::CSSFontFeatureValue::customCSSText const): 2018-04-19 Alexey Proskuryakov <ap@apple.com> More WK_ALTERNATE_FRAMEWORKS_DIR adoption in WebCore https://bugs.webkit.org/show_bug.cgi?id=184805 Reviewed by Dan Bernstein. * Configurations/WebCoreTestShim.xcconfig: * Configurations/WebCoreTestSupport.xcconfig: 2018-04-19 Brady Eidson <beidson@apple.com> Make back forward cache work with process swapping. <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793 Reviewed by Chris Dumez. Covered by API tests. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::reloadWithOverrideEncoding): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/FrameLoader.h: 2018-04-19 Chris Dumez <cdumez@apple.com> Rename JSDOMWindowProxy to JSWindowProxy https://bugs.webkit.org/show_bug.cgi?id=184797 Reviewed by Sam Weinig. Rename JSDOMWindowProxy to JSWindowProxy for consistency with WindowProxy. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/IDLTypes.h: * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMConvertWindowProxy.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::JSDOMWindowBase): (WebCore::JSDOMWindowBase::finishCreation): (WebCore::JSDOMWindowBase::proxy const): (WebCore::toJSDOMWindow): * bindings/js/JSDOMWindowBase.h: * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::toWrapped): * bindings/js/JSEventTargetCustom.cpp: (WebCore::JSEventTarget::toWrapped): * bindings/js/JSRemoteDOMWindowBase.cpp: (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase): (WebCore::toJSRemoteDOMWindow): * bindings/js/JSRemoteDOMWindowBase.h: * bindings/js/JSWindowProxy.cpp: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.cpp. (WebCore::JSWindowProxy::JSWindowProxy): (WebCore::JSWindowProxy::finishCreation): (WebCore::JSWindowProxy::create): (WebCore::JSWindowProxy::destroy): (WebCore::JSWindowProxy::setWindow): (WebCore::JSWindowProxy::attachDebugger): (WebCore::JSWindowProxy::wrapped const): (WebCore::JSWindowProxy::toWrapped): (WebCore::toJS): (WebCore::toJSWindowProxy): * bindings/js/JSWindowProxy.h: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.h. (WebCore::toJS): (WebCore::toJSWindowProxy): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::initScriptForWindowProxy): * bindings/js/ScriptController.h: * bindings/js/WindowProxy.cpp: (WebCore::WindowProxy::createJSWindowProxy): (WebCore::WindowProxy::jsWindowProxiesAsVector const): (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript): * bindings/js/WindowProxy.h: (WebCore::WindowProxy::jsWindowProxy): (WebCore::WindowProxy::existingJSWindowProxy const): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GenerateHeader): (GenerateOverloadDispatcher): (GenerateImplementation): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher): * page/Frame.cpp: * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::didCreateWindowProxy const): * page/csp/ContentSecurityPolicy.h: 2018-04-19 Dirk Schulze <krit@webbkit.org> Introduce SVGGeometryElement interface https://bugs.webkit.org/show_bug.cgi?id=184768 Reviewed by Antti Koivisto. Start implementing SVGGeometryElement interface from SVG2. https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement Start with SVGPathElement only for now. Also, just inferface gets implemented by this patch. No new functionality like isPointInFill yet. Fix getPointAtLength and make it more restrictive. This follows the spec and all other implementations. Added additional test scenarios to existing tests. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/scripts/CodeGeneratorJS.pm: (GetGnuVTableOffsetForType): * svg/SVGAllInOne.cpp: * svg/SVGGeometryElement.cpp: Added. (WebCore::SVGGeometryElement::SVGGeometryElement): (WebCore::SVGGeometryElement::isSupportedAttribute): (WebCore::SVGGeometryElement::parseAttribute): (WebCore::SVGGeometryElement::svgAttributeChanged): (WebCore::SVGGeometryElement::createElementRenderer): * svg/SVGGeometryElement.h: Added. * svg/SVGGeometryElement.idl: Added. * svg/SVGGradientElement.cpp: * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::SVGPathElement): (WebCore::SVGPathElement::parseAttribute): (WebCore::SVGPathElement::svgAttributeChanged): (WebCore::SVGPathElement::insertedIntoAncestor): (WebCore::SVGPathElement::removedFromAncestor): * svg/SVGPathElement.h: * svg/SVGPathElement.idl: 2018-04-19 Tadeu Zagallo <tzagallo@apple.com> REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts https://bugs.webkit.org/show_bug.cgi?id=184254 <rdar://problem/39140200> Reviewed by Daniel Bates. Add a new encoding method to SerializedScriptValue that includes ArrayBuffers. Test: workers/message-port.html * bindings/js/SerializedScriptValue.h: (WebCore::SerializedScriptValue::encode const): (WebCore::SerializedScriptValue::decode): * dom/messageports/MessageWithMessagePorts.h: (WebCore::MessageWithMessagePorts::encode const): (WebCore::MessageWithMessagePorts::decode): 2018-04-19 David Kilzer <ddkilzer@apple.com> Enable Objective-C weak references <https://webkit.org/b/184789> <rdar://problem/39571716> Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: (CLANG_ENABLE_OBJC_WEAK): Enable. 2018-04-19 Antti Koivisto <antti@apple.com> Don't use RenderTreeBuilder::current() in RenderTreeUpdater https://bugs.webkit.org/show_bug.cgi?id=184794 Reviewed by Zalan Bujtas. Pass the builder as a parameter where needed. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): (WebCore::RenderTreeUpdater::updateTextRenderer): (WebCore::RenderTreeUpdater::tearDownRenderers): (WebCore::RenderTreeUpdater::tearDownRenderer): (WebCore::RenderTreeUpdater::tearDownTextRenderer): (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded): (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren): * rendering/updating/RenderTreeUpdater.h: * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): (WebCore::RenderTreeUpdater::GeneratedContent::removeBeforePseudoElement): (WebCore::RenderTreeUpdater::GeneratedContent::removeAfterPseudoElement): * rendering/updating/RenderTreeUpdaterGeneratedContent.h: 2018-04-19 Eric Carlson <eric.carlson@apple.com> Runtime logging during GC can cause crash https://bugs.webkit.org/show_bug.cgi?id=184792 <rdar://problem/39567927> Reviewed by Jer Noble. Test: media/destructor-logging-crash.html * dom/Document.cpp: (WebCore::Document::~Document): Clear the logger observer immediately so anything logged as a side effect of the destructor won't cause a problem. (WebCore::Document::didLogMessage): Create the ConsoleMessage in a task. * dom/Document.h: 2018-04-19 Youenn Fablet <youenn@apple.com> Web Inspector backend should get headers & cookies from network process separately from resource requests https://bugs.webkit.org/show_bug.cgi?id=184396 <rdar://problem/38877384> Reviewed by Brian Burg. Add two new loader strategies to get response and network metrics directly from NetworkProcess based on resource loader identifier. Use these methods in InspectorNetworkAgent when response/metrics might be filtered. Covered by existing tests, in particular http/tests/inspector/network/fetch-network-data.html which would fail without this since we are now setting the sourceOrigin for NetworkResourceLoader, which is used to sanitize response headers. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::didReceiveResponse): (WebCore::InspectorNetworkAgent::didFinishLoading): * loader/LoaderStrategy.cpp: (WebCore::LoaderStrategy::responseFromResourceLoaIdentifier): (WebCore::LoaderStrategy::networkMetricsFromResourceLoaIdentifier): * loader/LoaderStrategy.h: 2018-04-19 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode https://bugs.webkit.org/show_bug.cgi?id=184782 <rdar://problem/38346712> Reviewed by Tim Horton. Add a new helper on FrameView to compute an expanded layout viewport size, as well as a new setting for the height expansion factor when computing visual viewport dimensions. See WebKit/ChangeLog for more detail. Test: fast/visual-viewport/extrazoom/layout-viewport-after-scrolling-and-resizing.html * page/FrameView.cpp: (WebCore::FrameView::expandedLayoutViewportSize): * page/FrameView.h: * page/Settings.yaml: 2018-04-19 Chris Dumez <cdumez@apple.com> REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML string https://bugs.webkit.org/show_bug.cgi?id=184209 <rdar://problem/39145306> Reviewed by Ryosuke Niwa. In r229133, we stopped doing navigation policy checks for about:blank because about:blank loads need to happen synchronously for Web-compatibility. However, this regressed loading an HTML string in a WebView because in such cases, the URL is also about:blank with substitute data. In this patch, we take a more conservative approach and restore policy checking for 'about:blank' but using synchronous IPC. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): 2018-04-19 Chris Nardi <cnardi@chromium.org> Support calc() in webkit-gradient and cross-fade https://bugs.webkit.org/show_bug.cgi?id=182225 Reviewed by Simon Fraser. calc() was previously unsupported in webkit-gradient and webkit-cross-fade, but both should take calc() values. Update the code to support calc() values. Tests: LayoutTests/css3/calc/cross-fade-calc.html LayoutTests/css3/calc/webkit-gradient-calc.html * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop): (WebCore::CSSPropertyParserHelpers::consumeCrossFade): 2018-04-17 Filip Pizlo <fpizlo@apple.com> The InternalFunction hierarchy should be in IsoSubspaces https://bugs.webkit.org/show_bug.cgi?id=184721 Reviewed by Saam Barati. No new tests because no new behavior. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::runtimeMethodSpace): * bridge/runtime_method.cpp: (JSC::RuntimeMethod::subspaceForImpl): * bridge/runtime_method.h: 2018-04-19 Brady Eidson <beidson@apple.com> Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them). <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750 Reviewed by Ryosuke Niwa. No new tests (Refactor, no behavior change). In WebCore, we: - Add a process-unique "BackForwardItemIdentifier" - Make all HistoryItems have such an identifier as a member * WebCore.xcodeproj/project.pbxproj: * history/BackForwardItemIdentifier.h: Added. (WebCore::BackForwardItemIdentifier::logString const): (WebCore::operator==): (WebCore::BackForwardItemIdentifier::encode const): (WebCore::BackForwardItemIdentifier::decode): (WebCore::BackForwardItemIdentifier::hash const): (WTF::BackForwardItemIdentifierHash::hash): (WTF::BackForwardItemIdentifierHash::equal): (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::emptyValue): (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue): (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue): * history/HistoryItem.cpp: (WebCore::HistoryItem::generateSequenceNumber): (WebCore::HistoryItem::HistoryItem): (WebCore::generateSequenceNumber): Deleted. * history/HistoryItem.h: (WebCore::HistoryItem::create): (WebCore::HistoryItem::identifier const): 2018-04-19 Nan Wang <n_wang@apple.com> AX: AOM: respect the accessibility setting for dispatching the accessible events https://bugs.webkit.org/show_bug.cgi?id=184619 Reviewed by Ryosuke Niwa. Added accessibilityEventsEnabled as a setting on the page. Test: accessibility/ios-simulator/accessibility-events-setting.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const): * page/Settings.yaml: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setAccessibilityEventsEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2018-04-18 Jer Noble <jer.noble@apple.com> Fix build when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value https://bugs.webkit.org/show_bug.cgi?id=184693 <rdar://problem/39491884> Reviewed by Tim Horton. * Configurations/WebCore.xcconfig: 2018-04-19 Eric Stobbart <ericstobbart@gmail.com> Change MediaSource WebCore to return NewObject for SourceBuffers https://bugs.webkit.org/show_bug.cgi?id=184642 Reviewed by Chris Dumez. Minor change inline with IDL documentation * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::addSourceBuffer): (): Deleted. * Modules/mediasource/MediaSource.h: * Modules/mediasource/MediaSource.idl: 2018-04-19 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, build fix for Ubuntu LTS GCC https://bugs.webkit.org/show_bug.cgi?id=184756 The variable name "windowProxy" (with auto&) conflicts with the function name "windowProxy". * bindings/js/ScriptController.cpp: (WebCore::ScriptController::updateDocument): (WebCore::ScriptController::collectIsolatedContexts): 2018-04-19 Manuel Rego Casasnovas <rego@igalia.com> Caret rendered at incorrect location inside empty table cell https://bugs.webkit.org/show_bug.cgi?id=85385 Reviewed by Zalan Bujtas. This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>. This fixes the position of the caret in empty cells, that was painted lower than expected (and then modified when you start to edit the cell). Ensures that editable table cells have at least one line when they are laid out. This ensures that the cell's intrinsic before/after padding is calculated correctly, which results in the caret location being calculated correctly. Test: editing/caret/caret-in-empty-cell.html * rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider that it has an an empty line if the table cell is editable. * rendering/RenderTableCell.h: 2018-04-18 Daniel Bates <dabates@apple.com> Cleanup TextControlInnerElements https://bugs.webkit.org/show_bug.cgi?id=184475 Reviewed by Antti Koivisto. Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of TextControlPlaceholderElement::create() from the header to the cpp file, replace fancy comments to demarcate classes with MARK: so that they show up in Xcode's function menu. * html/shadow/TextControlInnerElements.cpp: (WebCore::TextControlInnerElement::resolveCustomStyle): (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement): (WebCore::TextControlPlaceholderElement::create): * html/shadow/TextControlInnerElements.h: 2018-04-18 Chris Dumez <cdumez@apple.com> Rename WindowProxyController to WindowProxy https://bugs.webkit.org/show_bug.cgi?id=184756 Reviewed by Sam Weinig. Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation needed use WindowProxyController type, which was a bit confusing. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMWrapperWorld.cpp: (WebCore::DOMWrapperWorld::~DOMWrapperWorld): (WebCore::DOMWrapperWorld::clearWrappers): * bindings/js/DOMWrapperWorld.h: (WebCore::DOMWrapperWorld::didCreateWindowProxy): (WebCore::DOMWrapperWorld::didDestroyWindowProxy): * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMWindowBase.cpp: (WebCore::toJS): * bindings/js/JSDOMWindowProxy.cpp: (WebCore::toJS): (WebCore::toJSDOMWindowProxy): * bindings/js/JSDOMWindowProxy.h: (WebCore::toJS): (WebCore::toJSDOMWindowProxy): * bindings/js/ScriptCachedFrameData.cpp: (WebCore::ScriptCachedFrameData::ScriptCachedFrameData): (WebCore::ScriptCachedFrameData::restore): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::setupModuleScriptHandlers): (WebCore::ScriptController::windowProxy): (WebCore::ScriptController::enableEval): (WebCore::ScriptController::enableWebAssembly): (WebCore::ScriptController::disableEval): (WebCore::ScriptController::disableWebAssembly): (WebCore::ScriptController::updateDocument): (WebCore::ScriptController::collectIsolatedContexts): (WebCore::ScriptController::windowScriptNPObject): (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: (WebCore::ScriptController::globalObject): * bindings/js/ScriptControllerMac.mm: (WebCore::ScriptController::windowScriptObject): * bindings/js/ScriptState.cpp: (WebCore::mainWorldExecState): * bindings/js/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp. (WebCore::WindowProxy::WindowProxy): (WebCore::WindowProxy::~WindowProxy): (WebCore::WindowProxy::destroyJSWindowProxy): (WebCore::WindowProxy::createJSWindowProxy): (WebCore::WindowProxy::jsWindowProxiesAsVector const): (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript): (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow): (WebCore::WindowProxy::setDOMWindow): (WebCore::WindowProxy::attachDebugger): * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h. (WebCore::WindowProxy::jsWindowProxies const): (WebCore::WindowProxy::releaseJSWindowProxies): (WebCore::WindowProxy::setJSWindowProxies): (WebCore::WindowProxy::jsWindowProxy): (WebCore::WindowProxy::existingJSWindowProxy const): (WebCore::WindowProxy::globalObject): * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld): * page/AbstractFrame.cpp: (WebCore::AbstractFrame::AbstractFrame): * page/AbstractFrame.h: (WebCore::AbstractFrame::windowProxy): (WebCore::AbstractFrame::windowProxy const): * page/Page.cpp: (WebCore::Page::setDebugger): * page/RemoteDOMWindow.cpp: (WebCore::RemoteDOMWindow::self const): (WebCore::RemoteDOMWindow::top const): (WebCore::RemoteDOMWindow::opener const): (WebCore::RemoteDOMWindow::parent const): * page/RemoteDOMWindow.h: 2018-04-18 Chris Dumez <cdumez@apple.com> Set RemoteDOMWindow's initial opener https://bugs.webkit.org/show_bug.cgi?id=184716 Reviewed by Sam Weinig. Add support for WindowProxy type in the IDL. The implementation should return a WindowProxyController and toJS() will take care of converting this into a JSValue via JSDOMWindowProxy. No new tests, rebaselined existing test. * WebCore.xcodeproj/project.pbxproj: * bindings/IDLTypes.h: * bindings/js/JSDOMConvertWindowProxy.h: Added. (WebCore::JSConverter<IDLWindowProxy>::convert): * bindings/js/JSDOMWindowBase.cpp: (WebCore::toJS): * bindings/js/JSDOMWindowBase.h: (WebCore::toJS): * bindings/js/JSDOMWindowProxy.cpp: (WebCore::toJS): (WebCore::toJSDOMWindowProxy): * bindings/js/JSDOMWindowProxy.h: (WebCore::toJS): (WebCore::toJSDOMWindowProxy): * bindings/js/JSRemoteDOMWindowBase.cpp: * bindings/js/JSRemoteDOMWindowBase.h: * bindings/scripts/CodeGenerator.pm: (IsBuiltinType): * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GetBaseIDLType): * page/RemoteDOMWindow.cpp: (WebCore::RemoteDOMWindow::self const): (WebCore::RemoteDOMWindow::top const): (WebCore::RemoteDOMWindow::opener const): (WebCore::RemoteDOMWindow::parent const): * page/RemoteDOMWindow.h: * page/RemoteDOMWindow.idl: * page/RemoteFrame.h: 2018-04-18 Dean Jackson <dino@apple.com> Detect system preview links https://bugs.webkit.org/show_bug.cgi?id=184753 <rdar://problem/39500514> Reviewed by Antoine Quint. Detect a special type of link anchor, which we're calling System Previews. Ultimately this will allow WebKit to present such links in a special way. A System Preview link is an <a> element, with a rel attribute that includes "system-preview". It has a single element child, which is either an <img> or a <picture>. Test: system-preview/detection.html * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::relList): Add braces. (WebCore::HTMLAnchorElement::isSystemPreviewLink const): New function. * html/HTMLAnchorElement.h: * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::isSystemPreviewImage const): Ask the parent if it is a system preview link. * html/HTMLImageElement.h: * html/HTMLPictureElement.cpp: (WebCore::HTMLPictureElement::isSystemPreviewImage const): Ditto. * html/HTMLPictureElement.h: * testing/Internals.cpp: Testing helpers. (WebCore::Internals::systemPreviewRelType): (WebCore::Internals::isSystemPreviewLink const): (WebCore::Internals::isSystemPreviewImage const): * testing/Internals.h: * testing/Internals.idl: 2018-04-18 Antti Koivisto <antti@apple.com> :active pseudo class doesn't deactivate when using pressure sensitive trackpad https://bugs.webkit.org/show_bug.cgi?id=181680 Reviewed by Beth Dakin. Trackpad sends a mouse force event with force of zero after mouse up event. This causes the element under cursor activate again. Even a fake event test doesn't appear to be currently possible as TestRunner crashes if you try to send mouseForceChanged. All the tests using it are skipped. * page/EventHandler.cpp: (WebCore::EventHandler::handleMouseForceEvent): Don't add HitTestRequest::Active if the force of the force event is zero. 2018-04-18 Megan Gardner <megan_gardner@apple.com> Ensure correct screen sizes https://bugs.webkit.org/show_bug.cgi?id=184757 Reviewed by Wenson Hsieh. Make sure that the screen sizes are actually correct. Not currently testable, will add tests when it is. * platform/ios/PlatformScreenIOS.mm: 2018-04-18 Nan Wang <n_wang@apple.com> AX: [macOS] WebKit hangs when triggering an alert from an AOM increment event https://bugs.webkit.org/show_bug.cgi?id=184742 Reviewed by Chris Fleizach. Made increment and decrement actions on the macOS to be async. So that VoiceOver won't hang indefinitely if performing the actions causes an alert or other modal behaviors. Test: accessibility/mac/async-increment-decrement-action.html * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityPerformIncrementAction]): (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]): (-[WebAccessibilityObjectWrapper accessibilityPerformDecrementAction]): (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]): (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]): 2018-04-18 Youenn Fablet <youenn@apple.com> MediaResourceLoader should set its fetch destination https://bugs.webkit.org/show_bug.cgi?id=184746 Reviewed by Eric Carlson. Covered by updated test. * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::requestResource): 2018-04-18 Jer Noble <jer.noble@apple.com> Fix runtime errors in simulator while playing media https://bugs.webkit.org/show_bug.cgi?id=184751 Reviewed by Eric Carlson. AVURLAssetHTTPCookiesKey may not be present, and AVPlayer may not respond to certain methods. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): 2018-04-18 Jer Noble <jer.noble@apple.com> Ignore ASSERT when setting AVAudioSessionCategory returns an error on simulator. https://bugs.webkit.org/show_bug.cgi?id=184698 Reviewed by Eric Carlson. * platform/audio/ios/AudioSessionIOS.mm: * platform/audio/mac/AudioSessionMac.cpp: 2018-04-18 Sihui Liu <sihui_liu@apple.com> REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list https://bugs.webkit.org/show_bug.cgi?id=184570 <rdar://problem/34807323> Reviewed by Chris Dumez. Set FrameLoadType properly when error occurs in reload. tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm * loader/FrameLoader.cpp: (WebCore::FrameLoader::load): 2018-04-18 Chris Dumez <cdumez@apple.com> Add support for converting a local window to a remote window https://bugs.webkit.org/show_bug.cgi?id=184515 <rdar://problem/39011318> Reviewed by Ryosuke Niwa. Add initial support for process-swapping when navigating cross-origin as a result of a window.open(). The window object returned by window.open() is initially same origin and is for about:blank. The navigation cross-origin then happens and the JS wrappers for the window then point to a cross-origin window which is remote (i.e. hosted in another WebProcess). The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few exceptions due to our incomplete implementation (e.g. w.location returns null) and most of its API is currently not functional. The RemoteDOMWindow API will be implemented in a follow-up by relying on IPC. Test: http/tests/navigation/process-swap-window-open.html * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::scriptExecutionContext const): * bindings/js/JSDOMPromiseDeferred.h: * bindings/js/JSDOMWindowProperties.cpp: (WebCore::JSDOMWindowProperties::getOwnPropertySlot): * bindings/js/JSDOMWindowProxy.cpp: (WebCore::JSDOMWindowProxy::finishCreation): (WebCore::JSDOMWindowProxy::create): * bindings/js/JSDOMWindowProxy.h: * bindings/js/JSDOMWrapper.cpp: (WebCore::JSDOMObject::JSDOMObject): * bindings/js/JSDOMWrapper.h: * bindings/js/WindowProxyController.cpp: (WebCore::WindowProxyController::createWindowProxy): (WebCore::WindowProxyController::setDOMWindowForWindowProxy): * bridge/objc/WebScriptObject.mm: (-[WebScriptObject _isSafeScript]): Teach more of our bindings code about RemoteDOMWindows. * dom/Document.cpp: (WebCore::Document::createDOMWindow): * loader/FrameLoaderClient.h: Add FrameLoaderClient function to notify the client when a DOMWindow is constructed in the frame. This is needed for WebKit2 to link the old window to its new representation in the new WebProcess. 2018-04-17 Zan Dobersek <zdobersek@igalia.com> [CMake] Add and enable the ENABLE_CSS_ANIMATIONS_LEVEL_2 feature define https://bugs.webkit.org/show_bug.cgi?id=184681 Reviewed by Carlos Garcia Campos. * Sources.txt: Include CSSAnimationTriggerScrollValue.cpp in the build. * WebCore.xcodeproj/project.pbxproj: Remove CSSAnimationTriggerScrollValue.cpp build target now that it's built via Sources.txt. 2018-04-17 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] CoordinatedImageBacking can simplify image drawing https://bugs.webkit.org/show_bug.cgi?id=183986 Reviewed by Michael Catanzaro. In CoordinatedImageBacking::update(), when drawing the image into a freshly-created image backing, we can avoid save-and-restoring the painting context. We also don't have to clip it, since the clipping area is the same as the image (and buffer) bounds. Since the buffer is initialized to transparent color, we can use the CompositeCopy operator to just copy image data into the destination since there's nothing to paint the source over. No new tests -- no change in functionality. * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp: (WebCore::CoordinatedImageBacking::update): 2018-04-17 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Webkit should spoof as Safari on a Mac for Outlook.com https://bugs.webkit.org/show_bug.cgi?id=184573 Reviewed by Carlos Alberto Lopez Perez. Add quirk for outlook.live.com. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresMacintoshPlatform): 2018-04-17 Mark Lam <mark.lam@apple.com> Templatize CodePtr/Refs/FunctionPtrs with PtrTags. https://bugs.webkit.org/show_bug.cgi?id=184702 <rdar://problem/35391681> Reviewed by Filip Pizlo and Saam Barati. No new tests. This is covered by existing tests. * WebCore.xcodeproj/project.pbxproj: * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::ruleMatches): * cssjit/CSSPtrTag.h: Added. * cssjit/CompiledSelector.h: * cssjit/FunctionCall.h: (WebCore::FunctionCall::FunctionCall): (WebCore::FunctionCall::setFunctionAddress): (WebCore::FunctionCall::prepareAndCall): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::compileSelector): (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext): (WebCore::SelectorCompiler::addPseudoClassType): (WebCore::SelectorCompiler::SelectorCodeGenerator::compile): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest): * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const): (WebCore::SelectorDataList::execute const): * dom/SelectorQuery.h: 2018-04-17 Tadeu Zagallo <tzagallo@apple.com> Retain MessagePortChannel for transfer when disentangling ports https://bugs.webkit.org/show_bug.cgi?id=184502 <rdar://problem/39372771> Reviewed by Geoffrey Garen. MessagePortChannels should be retained while ports are being transferred, but that was only happening when sending a port through another port, but not when sending it through a worker. Test: workers/worker-to-worker.html * dom/messageports/MessagePortChannel.cpp: (WebCore::MessagePortChannel::entanglePortWithProcess): (WebCore::MessagePortChannel::disentanglePort): (WebCore::MessagePortChannel::postMessageToRemote): (WebCore::MessagePortChannel::takeAllMessagesForPort): 2018-04-17 Tadeu Zagallo <tzagallo@apple.com> References from CSSStyleDeclaration to CSSValues should be weak https://bugs.webkit.org/show_bug.cgi?id=180280 <rdar://problem/35804869> Reviewed by Geoffrey Garen. No new tests - used the existing test to verify the leak * css/DeprecatedCSSOMValue.h: (WebCore::DeprecatedCSSOMValue::weakPtrFactory): * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM): * css/PropertySetCSSStyleDeclaration.h: 2018-04-17 Jonathan Bedard <jbedard@apple.com> Unreviewed rollout of r230632. Regression in memory usage. That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569. Tests: animations/animation-internals-api-multiple-keyframes.html animations/animation-internals-api.html transitions/transition-drt-api-delay.html transitions/transition-drt-api.html * page/RuntimeEnabledFeatures.h: * testing/Internals.cpp: (WebCore::Internals::pseudoElement): Deleted. * testing/Internals.h: * testing/Internals.idl: 2018-04-17 Tadeu Zagallo <tzagallo@apple.com> Do not unregister MessagePorts on deallocation if it has been disentangled https://bugs.webkit.org/show_bug.cgi?id=184285 <rdar://problem/39256714> Reviewed by Darin Adler. Test: workers/message-port-gc.html * dom/MessagePort.cpp: (WebCore::MessagePort::deref const): 2018-04-17 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Fix timing of reporting error to the client https://bugs.webkit.org/show_bug.cgi?id=184707 Before checking the result code, check the status of callback invocation and do the right thing. Reviewed by Youenn Fablet. No new tests because there's no new behavior. * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::didCompleteTransfer): * platform/network/curl/CurlRequest.h: (WebCore::CurlRequest::needToInvokeDidReceiveResponse const): 2018-04-17 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Export authentication information to be used by the client. https://bugs.webkit.org/show_bug.cgi?id=184709 Just added getters for username and password member variables. Reviewed by Alex Christensen. No new tests because there's no new behavior. * platform/network/curl/CurlRequest.h: (WebCore::CurlRequest::user const): (WebCore::CurlRequest::password const): 2018-04-17 Chris Dumez <cdumez@apple.com> REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab https://bugs.webkit.org/show_bug.cgi?id=184678 <rdar://problem/39422122> Reviewed by Alex Christensen. Frament navigations need to happen synchronously for Web-compatibility. Because of this, r225657 added code to make sure that if the client does not make the navigation policy decision synchronously for frament navigations, then we'll stop waiting for the client and proceed with the navigation. However, r229831 make the navigation policy decision IPC decision, meaning that even if the client responds synchronously, it would be asynchronously from WebCore's point of view. As a result, we would always ignore the client's policy decision when doing a fragment navigation. This is an issue on iclould.com because the web-app links are fragment URLs. When you CMD+click one of these link, we do the navigation policy check. As a result of this check, Safari responds IGNORE to the policy decision and instead decides to load the link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we would not obey the IGNORE policy decision from Safari and load the link in the current tab, even though Safari would already be loading it in a new tab. To address the issue, I reintroduced a synchronous code path for navigation policy decision making, backed by synchronous IPC. This synchronous code path is now used for fragment navigations to restore pre-r229831 behavior. If the client does not answer synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831. Test: http/tests/navigation/fragment-navigation-policy-ignore.html * loader/EmptyClients.cpp: (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithDocumentLoader): * loader/FrameLoaderClient.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): * loader/PolicyChecker.h: 2018-04-17 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r230713. This caused internal build failures. Reverted changeset: "Implement checked cast for DDResultRef once DDResultGetTypeID() is available" https://bugs.webkit.org/show_bug.cgi?id=184554 https://trac.webkit.org/changeset/230713 2018-04-17 Chris Dumez <cdumez@apple.com> Add bindings code for RemoteDOMWindow https://bugs.webkit.org/show_bug.cgi?id=184653 Reviewed by Ryosuke Niwa. Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings code is identical to the DOMWindow code paths from cross-origin handling. No new tests, this code will be used and tested via Bug 184515. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): (WebCore::JSDOMWindow::getOwnPropertySlot): (WebCore::JSDOMWindow::getOwnPropertySlotByIndex): (WebCore::addCrossOriginWindowOwnPropertyNames): * bindings/js/JSDOMWindowCustom.h: * bindings/js/JSRemoteDOMWindowBase.cpp: Added. (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase): (WebCore::JSRemoteDOMWindowBase::destroy): (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags): (WebCore::toJS): (WebCore::toJSRemoteDOMWindow): * bindings/js/JSRemoteDOMWindowBase.h: Added. JSRemoteDOMWindow unfortunately currently needs to be a global object because of: 1. a JSProxy's target needs to be a JSGlobalObject currently 2. The 'structure()->setGlobalObject(vm, &window);' call in JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject. Ideally, this wouldn't be the case in the future but this would require some code refactoring. Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject, which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the m_wrapped implementation pointer. I followed the same pattern here. (WebCore::toJS): * bindings/js/JSRemoteDOMWindowCustom.cpp: Added. (WebCore::JSRemoteDOMWindow::getOwnPropertySlot): (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex): (WebCore::JSRemoteDOMWindow::put): (WebCore::JSRemoteDOMWindow::putByIndex): (WebCore::JSRemoteDOMWindow::deleteProperty): (WebCore::JSRemoteDOMWindow::deletePropertyByIndex): (WebCore::JSRemoteDOMWindow::getOwnPropertyNames): (WebCore::JSRemoteDOMWindow::defineOwnProperty): (WebCore::JSRemoteDOMWindow::getPrototype): (WebCore::JSRemoteDOMWindow::preventExtensions): (WebCore::JSRemoteDOMWindow::toStringName): * bindings/scripts/CodeGeneratorJS.pm: (IsDOMGlobalObject): (GenerateHeader): (GenerateOverloadDispatcher): (GenerateImplementation): * page/RemoteDOMWindow.idl: Added. 2018-04-17 David Kilzer <ddkilzer@apple.com> Implement checked cast for DDResultRef once DDResultGetTypeID() is available <https://webkit.org/b/184554> <rdar://problem/36241894> Reviewed by Brent Fulgham. * editing/cocoa/DataDetection.mm: (WebCore::detectItemAtPositionWithRange): Implement checked cast for DDResultRef. 2018-04-17 Said Abou-Hallawa <sabouhallawa@apple.com> Animated GIF imagery with finite looping are falling one loop short https://bugs.webkit.org/show_bug.cgi?id=183153 Reviewed by Simon Fraser. The Netscape Looping Application Extension is a block which may be added to a GIF file to tell the viewer to loop through the entire GIF frames. This is communicated through two bytes designated for the "loopCount" in this block. The entire block may not be found in the GIF, in which case the GIF is supposed to animate its entire frames only once. If the block exists and loopCount = 0, this means the image has to loop through its frames indefinitely. If the block exist and loopCount > 0, this should mean the image has to loop through its frames loopCount + 1 times. The extra loop seems to be the consensus among most of the GIF generators and viewers. For example, if the image designer wants the image to loop through its frames n times: -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) will write n - 1 for loopCount. However http://gifmaker.me and http://gifmaker.org write n for loopCount. -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will translate loopCount = n - 1 to: animate GIF once + loop n - 1, which means loop the GIF n times. Because the specs are not really clear about this, we are going to consider the agreed-upon behavior among most of the web browsers the specs here. * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::repetitionCount const): * platform/image-decoders/gif/GIFImageDecoder.cpp: (WebCore::GIFImageDecoder::repetitionCount const): 2018-04-17 Saam Barati <sbarati@apple.com> Add system trace points for process launch and for initializeWebProcess https://bugs.webkit.org/show_bug.cgi?id=184669 Reviewed by Simon Fraser. No testing needed because there is no new functionality here. * loader/FrameLoader.cpp: (WebCore::FrameLoader::provisionalLoadStarted): (WebCore::FrameLoader::checkLoadCompleteForThisFrame): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::didFinishLoading): (WebCore::SubresourceLoader::didFail): (WebCore::SubresourceLoader::didCancel): 2018-04-17 Eric Carlson <eric.carlson@apple.com> [iOS] AirPlay device name is sometimes wrong https://bugs.webkit.org/show_bug.cgi?id=184543 <rdar://problem/39105498> Reviewed by Jer Noble. No new tests, this can only be tested with a specific hardware setup. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext when possible. 2018-04-17 Carlos Alberto Lopez Perez <clopez@igalia.com> [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display) https://bugs.webkit.org/show_bug.cgi?id=184406 Rubber-stamped by Michael Catanzaro. Fix build with clang 3.8 No new tests, it is a build fix. * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::create): 2018-04-16 Antoine Quint <graouts@apple.com> Layout Test animations/needs-layout.html is a flaky Image Failure. https://bugs.webkit.org/show_bug.cgi?id=172397 Reviewed by Dean Jackson. Animations that animate a transform and uses a relative value for either the x or y components require a layout before starting, which CSSAnimationController would perform in the call to CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was created. We now perform a similar task where upon setting new blending keyframes we compute a flag indicating if the keyframe effect is animating a transform with relative x or y components. Then, when we perform the first invalidation task, which runs in the next run loop after a change to the timing model has been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate() where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure we commit animations on the compositor immediately after that too, instead of waiting until the next DisplayRefreshMonitor callback. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::performInvalidationTask): (WebCore::DocumentTimeline::updateAnimations): * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded): (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout): (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): * animation/KeyframeEffectReadOnly.h: 2018-04-16 Pablo Saavedra <psaavedra@igalia.com> Inconsistent EGL defines in ImageBufferCairo https://bugs.webkit.org/show_bug.cgi?id=184661 Reviewed by Žan Doberšek. On revision r219391 libepoxy is added. The headers in ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during the Webkit build: ... /usr/include/GLES2/gl2.h:503:82: error: 'voi epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind of symbol GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); No new tests. * platform/graphics/cairo/ImageBufferCairo.cpp: 2018-04-16 Filip Pizlo <fpizlo@apple.com> MutationObserver should be in an IsoHeap https://bugs.webkit.org/show_bug.cgi?id=184671 <rdar://problem/36081981> Reviewed by Sam Weinig. No new tests because no new behavior. * dom/MutationObserver.cpp: * dom/MutationObserver.h: 2018-04-16 Youenn Fablet <youenn@apple.com> Use NetworkLoadChecker to handle synchronous HTTP loads https://bugs.webkit.org/show_bug.cgi?id=184240 Reviewed by Chris Dumez. Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly. Update various call sites accordingly. This allows NetworkProcess to do all necessary checks. Add an option to disable security checks if NetworkProcess does it for WebProcess. This option will be also used for regular asynchronous loads in future patches. Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess. Covered by existing and rebased tests. * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::doPreflight): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): (WebCore::DocumentThreadableLoader::loadRequest): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadResourceSynchronously): * loader/FrameLoader.h: * loader/LoaderStrategy.h: * xml/XSLTProcessorLibxslt.cpp: (WebCore::docLoaderFunc): * xml/parser/XMLDocumentParserLibxml2.cpp: (WebCore::openFunc): 2018-04-16 Christopher Reid <chris.reid@sony.com> [WinCairo] Media elements should be enabled by default https://bugs.webkit.org/show_bug.cgi?id=184597 Reviewed by Per Arne Vollan. Enabling media elements by default with media foundation. * page/SettingsDefaultValues.h: 2018-04-16 Christopher Reid <chris.reid@sony.com> [Curl] Add the Accept-Language field to curl request headers https://bugs.webkit.org/show_bug.cgi?id=184605 Reviewed by Alex Christensen. Add Accept-Language field to curl request headers * platform/network/curl/CurlRequest.cpp: * platform/network/curl/CurlRequest.h: 2018-04-16 Chris Dumez <cdumez@apple.com> Move more WindowProxy-related logic from ScriptController to WindowProxyController https://bugs.webkit.org/show_bug.cgi?id=184640 Reviewed by Ryosuke Niwa. Move more WindowProxy-related logic from ScriptController to WindowProxyController, for clarity. * bindings/js/JSDOMWindowProxy.cpp: (WebCore::JSDOMWindowProxy::attachDebugger): * bindings/js/JSDOMWindowProxy.h: * bindings/js/ScriptCachedFrameData.cpp: (WebCore::ScriptCachedFrameData::ScriptCachedFrameData): (WebCore::ScriptCachedFrameData::restore): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::~ScriptController): (WebCore::ScriptController::initScriptForWindowProxy): * bindings/js/ScriptController.h: (WebCore::ScriptController::existingCacheableBindingRootObject const): * bindings/js/WindowProxyController.cpp: (WebCore::collectGarbageAfterWindowProxyDestruction): (WebCore::WindowProxyController::~WindowProxyController): (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow): (WebCore::WindowProxyController::setDOMWindowForWindowProxy): (WebCore::WindowProxyController::attachDebugger): * bindings/js/WindowProxyController.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): * page/Page.cpp: (WebCore::Page::setDebugger): 2018-04-16 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor https://bugs.webkit.org/show_bug.cgi?id=184652 Reviewed by Philippe Normand. In the constructor we should mark selected streams based on the default values from GstStream, if the user changes them, they will be updated as required later on. No new tests are added as we already have a few ones that are currently disabled in the mediastream testsuite. This patch is part of the work to enable them. * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer): * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer): 2018-04-16 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible https://bugs.webkit.org/show_bug.cgi?id=184651 Reviewed by Philippe Normand. We can't notify the client if none is connected, but still we need to fill our metadatas from the provided GstTagList, especially in the case of playbin3 where the client is not set yet at construct time but the metadata might already be preset (and won't be updated later on). No new tests are added as we already have a few ones that are currently disabled in the mediastream testsuite. This patch is part of the work to enable them. * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): 2018-04-16 Antoine Quint <graouts@apple.com> [Web Animations] Ensure we never return -0 through the API https://bugs.webkit.org/show_bug.cgi?id=184644 Reviewed by Dean Jackson. We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests. This would happen when playbackRate < 0. * animation/WebAnimationUtilities.h: (WebCore::secondsToWebAnimationsAPITime): 2018-04-15 Antoine Quint <graouts@apple.com> [Web Animations] Animations do not naturally get a finish event https://bugs.webkit.org/show_bug.cgi?id=184639 <rdar://problem/39397649> Reviewed by Jon Lee. We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise they will keep being scheduled in a loop. * animation/WebAnimation.cpp: (WebCore::WebAnimation::timeToNextRequiredTick const): (WebCore::WebAnimation::resolve): 2018-04-15 Chris Dumez <cdumez@apple.com> Change Event's returnValue so it doesn't expose a new primitive https://bugs.webkit.org/show_bug.cgi?id=184415 Reviewed by Darin Adler. Update Event.returnValue setter to match the latest DOM specification after: - https://github.com/whatwg/dom/pull/626 In particular, the returnValue setter is now a no-op if the new flag value is true. If the input flag value is false, it only sets the 'canceled' flag if the event is cancelable and the event’s in passive listener flag is unset. Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html * dom/Event.cpp: (WebCore::Event::setLegacyReturnValue): (WebCore::Event::setCanceledFlagIfPossible): (WebCore::Event::preventDefault): * dom/Event.h: 2018-04-14 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer https://bugs.webkit.org/show_bug.cgi?id=184620 Reviewed by Philippe Normand. This is a minor change, a dedicated test doesn't really make sense here. * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: (WebCore::TrackPrivateBaseGStreamer::stream): 2018-04-13 Ryosuke Niwa <rniwa@webkit.org> WebKit crashes when libwebrtc.dylib is missing https://bugs.webkit.org/show_bug.cgi?id=184607 Rubber-stamped by Jer Noble. Don't call LibWebRTC related code when libwebrtc is not available. * dom/Document.cpp: (WebCore::Document::prepareForDestruction): (WebCore::Document::suspend): 2018-04-13 Chris Dumez <cdumez@apple.com> Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame https://bugs.webkit.org/show_bug.cgi?id=184591 Reviewed by Sam Weinig. Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame. RemoteFrames do not need a ScriptController but do need to maintain WindowProxies. This is work towards fixing Bug 184515. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMWrapperWorld.cpp: (WebCore::DOMWrapperWorld::~DOMWrapperWorld): (WebCore::DOMWrapperWorld::clearWrappers): * bindings/js/DOMWrapperWorld.h: (WebCore::DOMWrapperWorld::didCreateWindowProxy): (WebCore::DOMWrapperWorld::didDestroyWindowProxy): * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/JSDOMWindowBase.cpp: (WebCore::toJSDOMWindow): * bindings/js/JSDOMWindowProxy.cpp: (WebCore::toJS): (WebCore::toJSDOMWindowProxy): * bindings/js/ScriptCachedFrameData.cpp: (WebCore::ScriptCachedFrameData::ScriptCachedFrameData): (WebCore::ScriptCachedFrameData::restore): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::~ScriptController): (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow): (WebCore::ScriptController::setDOMWindowForWindowProxy): (WebCore::ScriptController::initScriptForWindowProxy): (WebCore::ScriptController::setupModuleScriptHandlers): (WebCore::ScriptController::windowProxyController): (WebCore::ScriptController::enableEval): (WebCore::ScriptController::enableWebAssembly): (WebCore::ScriptController::disableEval): (WebCore::ScriptController::disableWebAssembly): (WebCore::ScriptController::attachDebugger): (WebCore::ScriptController::updateDocument): (WebCore::ScriptController::collectIsolatedContexts): (WebCore::ScriptController::windowScriptNPObject): (WebCore::ScriptController::executeIfJavaScriptURL): * bindings/js/ScriptController.h: (WebCore::ScriptController::globalObject): * bindings/js/ScriptControllerMac.mm: (WebCore::ScriptController::windowScriptObject): * bindings/js/ScriptState.cpp: (WebCore::mainWorldExecState): * bindings/js/WindowProxyController.cpp: Added. (WebCore::WindowProxyController::WindowProxyController): (WebCore::WindowProxyController::destroyWindowProxy): (WebCore::WindowProxyController::createWindowProxy): (WebCore::WindowProxyController::windowProxies): (WebCore::WindowProxyController::createWindowProxyWithInitializedScript): * bindings/js/WindowProxyController.h: Added. (WebCore::WindowProxyController::releaseWindowProxies): (WebCore::WindowProxyController::setWindowProxies): (WebCore::WindowProxyController::windowProxy): (WebCore::WindowProxyController::existingWindowProxy const): (WebCore::WindowProxyController::globalObject): * loader/FrameLoader.cpp: (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld): * page/AbstractFrame.cpp: (WebCore::AbstractFrame::AbstractFrame): * page/AbstractFrame.h: (WebCore::AbstractFrame::windowProxyController): (WebCore::AbstractFrame::windowProxyController const): 2018-04-13 Brady Eidson <beidson@apple.com> Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one. https://bugs.webkit.org/show_bug.cgi?id=184559 Reviewed by Alex Christensen. Covered by new API test. WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::redirectReceived): (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::startLoadingMainResource): * loader/DocumentLoader.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::init): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): 2018-04-13 Chris Dumez <cdumez@apple.com> input.webkitEntries does not work as expected when folder contains accented chars https://bugs.webkit.org/show_bug.cgi?id=184517 <rdar://problem/39265537> Reviewed by Alex Christensen. Use String::fromUTF8() to construct a WTF String from the char* returned by dirname() in FileSystem::directoryName(). Previously, we were just calling the String constructor, which would treat the input as latin 1 instead of UTF-8. Change is covered by an API test rather than a layout test due to file versioning limitations. * platform/posix/FileSystemPOSIX.cpp: (WebCore::FileSystem::directoryName): 2018-04-13 Yusuke Suzuki <utatane.tea@gmail.com> [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS https://bugs.webkit.org/show_bug.cgi?id=184401 Rubber stamped by Saam Barati. Apply bug 183970 changes to WebCore JS too. This offers solid type checking with @getByIdDirectPrivate(). * Modules/mediastream/RTCPeerConnection.js: (initializeRTCPeerConnection): (getLocalStreams): (getStreamById): (addStream): * Modules/mediastream/RTCPeerConnectionInternals.js: (isRTCPeerConnection): * Modules/streams/ReadableByteStreamController.js: (enqueue): (error): (close): (getter.byobRequest): * Modules/streams/ReadableByteStreamInternals.js: (privateInitializeReadableStreamBYOBReader): (privateInitializeReadableByteStreamController): (privateInitializeReadableStreamBYOBRequest): (isReadableByteStreamController): (isReadableStreamBYOBRequest): (isReadableStreamBYOBReader): (readableByteStreamControllerCancel): (readableByteStreamControllerError): (readableByteStreamControllerClose): (readableByteStreamControllerClearPendingPullIntos): (readableByteStreamControllerGetDesiredSize): (readableStreamHasBYOBReader): (readableStreamHasDefaultReader): (readableByteStreamControllerHandleQueueDrain): (readableByteStreamControllerPull): (readableByteStreamControllerShouldCallPull): (readableByteStreamControllerCallPullIfNeeded): (readableByteStreamControllerEnqueue): (readableByteStreamControllerEnqueueChunk): (readableByteStreamControllerRespondWithNewView): (readableByteStreamControllerRespond): (readableByteStreamControllerRespondInternal): (readableByteStreamControllerRespondInReadableState): (readableByteStreamControllerRespondInClosedState): (readableByteStreamControllerProcessPullDescriptors): (readableByteStreamControllerFillDescriptorFromQueue): (readableByteStreamControllerShiftPendingDescriptor): (readableByteStreamControllerInvalidateBYOBRequest): (readableByteStreamControllerCommitDescriptor): (readableStreamFulfillReadIntoRequest): (readableByteStreamControllerPullInto): (readableStreamAddReadIntoRequest): * Modules/streams/ReadableStream.js: (initializeReadableStream): (pipeThrough): * Modules/streams/ReadableStreamBYOBReader.js: (cancel): (read): (releaseLock): (getter.closed): * Modules/streams/ReadableStreamBYOBRequest.js: (respond): (respondWithNewView): (getter.view): * Modules/streams/ReadableStreamDefaultController.js: (error): * Modules/streams/ReadableStreamDefaultReader.js: (cancel): (read): (releaseLock): (getter.closed): * Modules/streams/ReadableStreamInternals.js: (privateInitializeReadableStreamDefaultReader): (readableStreamReaderGenericInitialize): (readableStreamDefaultControllerError): (readableStreamPipeTo): (readableStreamTee): (isReadableStream): (isReadableStreamDefaultReader): (isReadableStreamDefaultController): (readableStreamError): (readableStreamDefaultControllerCallPullIfNeeded): (readableStreamDefaultControllerGetDesiredSize): (readableStreamReaderGenericCancel): (readableStreamCancel): (readableStreamDefaultControllerCancel): (readableStreamDefaultControllerPull): (readableStreamDefaultControllerClose): (readableStreamClose): (readableStreamFulfillReadRequest): (readableStreamDefaultReaderRead): (readableStreamAddReadRequest): (isReadableStreamDisturbed): (readableStreamReaderGenericRelease): (readableStreamDefaultControllerCanCloseOrEnqueue): (privateInitializeReadableStreamDefaultController): Deleted. * Modules/streams/StreamInternals.js: (validateAndNormalizeQueuingStrategy): * Modules/streams/WritableStream.js: (initializeWritableStream): (abort): (close): (write): (getter.closed): (getter.ready): (getter.state): * Modules/streams/WritableStreamInternals.js: (isWritableStream): (syncWritableStreamStateWithQueue): (errorWritableStream): (callOrScheduleWritableStreamAdvanceQueue): * bindings/js/JSDOMBindingInternals.js: (mapLikeForEach): 2018-04-12 Antoine Quint <graouts@apple.com> [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default https://bugs.webkit.org/show_bug.cgi?id=184569 <rdar://problem/38671301> Reviewed by Jon Lee. We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement() to now work with the Web Animations API. * page/RuntimeEnabledFeatures.h: * testing/Internals.cpp: (WebCore::Internals::pseudoElement): * testing/Internals.h: * testing/Internals.idl: 2018-04-13 Sergio Villar Senin <svillar@igalia.com> [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers() https://bugs.webkit.org/show_bug.cgi?id=184530 Reviewed by Žan Doberšek. WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for a variety of reasons and can be eventually cancelled with exitPresent(). Once we are presenting we could access the presenting layers (right now just one) with getLayers(). Note that we are not presenting anything to the HMD yet, that will be done later in a follow up patch. I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method that should be called maxLayers instead of maxLayer. * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::requestPresent): (WebCore::VRDisplay::stopPresenting): (WebCore::VRDisplay::exitPresent): (WebCore::VRDisplay::getLayers const): (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file. * Modules/webvr/VRDisplay.h: (WebCore::VRDisplay::isPresenting const): * Modules/webvr/VRDisplayCapabilities.h: (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer(). (WebCore::VRDisplayCapabilities::maxLayer const): Deleted. * Modules/webvr/VRDisplayCapabilities.idl: 2018-04-13 Miguel Gomez <magomez@igalia.com> REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode https://bugs.webkit.org/show_bug.cgi?id=184583 Reviewed by Carlos Garcia Campos. In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase. Covered by existent tests. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2018-04-13 Miguel Gomez <magomez@igalia.com> [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF https://bugs.webkit.org/show_bug.cgi?id=183362 Reviewed by Carlos Garcia Campos. Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed. That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which can be used to handle the pause event without avoiding future renderings. Also cancelRepaint() has only effect when not in AC mode. Covered by existent tests. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2018-04-13 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits https://bugs.webkit.org/show_bug.cgi?id=184533 Reviewed by Philippe Normand. Renamed GStreamerUtilities* files into GStreamerCommon* and modified files including them accordingly. Include GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h to avoid problems destroying objects when those files are forgotten to be included. * Modules/webaudio/AudioContext.cpp: * platform/GStreamer.cmake: * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h: * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp. * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h. * platform/graphics/gstreamer/ImageGStreamer.h: * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/MediaSampleGStreamer.cpp: * platform/graphics/gstreamer/MediaSampleGStreamer.h: * platform/graphics/gstreamer/TextCombinerGStreamer.cpp: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp: * platform/graphics/gstreamer/mse/AppendPipeline.cpp: * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp: * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h: 2018-04-12 Christopher Reid <chris.reid@sony.com> [Curl] Fix clang build error in CurlContext.cpp https://bugs.webkit.org/show_bug.cgi?id=184561 Reviewed by Darin Adler. MSVC allows explicit template specialization in classes but gcc/clang do not. * platform/network/curl/CurlContext.cpp: 2018-04-12 Christopher Reid <chris.reid@sony.com> [Curl] Cookie Database on memory path should be :memory: https://bugs.webkit.org/show_bug.cgi?id=184572 Reviewed by Alex Christensen. CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory: For reference, see: https://www.sqlite.org/inmemorydb.html * platform/network/curl/CookieJarDB.h: 2018-04-12 Daniel Bates <dabates@apple.com> Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/> (https://bugs.webkit.org/show_bug.cgi?id=184386) Visual Studio cannot prove that all cases in the switch are covered :( So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. * loader/cache/CachedResourceLoader.cpp: (WebCore::destinationForType): 2018-04-12 Chris Dumez <cdumez@apple.com> Introduce remote variants of Frame / DOMWindow classes https://bugs.webkit.org/show_bug.cgi?id=184467 <rdar://problem/39011267> Reviewed by Ryosuke Niwa. Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows are hosted on another WebProcess. Those will be used in a follow-up patch. The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise patch size): - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess) - Frame: A local frame - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote. - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess) - DOMWindow: A local DOMWindow - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also remote. A RemoteDOMWindow is always cross-origin. This patch introduces global identifiers (unique across all WebProcesses) for both Frames and Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame / RemoteDOMWindow is pointing to. Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones, when a newly opened window (via window.open) is navigated cross-origin (Bug 184515). Other things we'll need to implement in follow-ups: - RemoteDOMWindow will need to know about its opener in order to support the window.opener API. Internally, the opener will be stored as a RemoteFrame so that window.opener always returns the current window in the opener frame (which changes upon navigation). - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless. A frameless window behaves very differently (e.g. very little API is exposed to the Web). This happens when either the newly opened window is either closed or navigated. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * loader/ContentFilter.cpp: (WebCore::ContentFilter::didDecide): * page/AbstractDOMWindow.cpp: Added. (WebCore::AbstractDOMWindow::AbstractDOMWindow): (WebCore::AbstractDOMWindow::~AbstractDOMWindow): * page/AbstractDOMWindow.h: Added. (WebCore::AbstractDOMWindow::identifier const): * page/AbstractFrame.cpp: Added. (WebCore::AbstractFrame::AbstractFrame): (WebCore::AbstractFrame::~AbstractFrame): * page/AbstractFrame.h: Added. (WebCore::AbstractFrame::window const): * page/DOMWindow.cpp: (WebCore::DOMWindow::DOMWindow): * page/DOMWindow.h: (isType): * page/Frame.cpp: (WebCore::Frame::window const): (WebCore::Frame::virtualWindow const): * page/Frame.h: (isType): * page/GlobalFrameIdentifier.h: Added. (WebCore::GlobalFrameIdentifier::encode const): (WebCore::GlobalFrameIdentifier::decode): * page/GlobalWindowIdentifier.h: Added. (WebCore::operator==): (WebCore::GlobalWindowIdentifier::hash const): (WebCore::GlobalWindowIdentifier::encode const): (WebCore::GlobalWindowIdentifier::decode): (WTF::GlobalWindowIdentifierHash::hash): (WTF::GlobalWindowIdentifierHash::equal): (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue): (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue): (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue): * page/RemoteDOMWindow.cpp: Added. (WebCore::RemoteDOMWindow::RemoteDOMWindow): (WebCore::RemoteDOMWindow::~RemoteDOMWindow): (WebCore::RemoteDOMWindow::self const): (WebCore::RemoteDOMWindow::location const): (WebCore::RemoteDOMWindow::close): (WebCore::RemoteDOMWindow::closed const): (WebCore::RemoteDOMWindow::focus): (WebCore::RemoteDOMWindow::blur): (WebCore::RemoteDOMWindow::length const): (WebCore::RemoteDOMWindow::top const): (WebCore::RemoteDOMWindow::opener const): (WebCore::RemoteDOMWindow::parent const): (WebCore::RemoteDOMWindow::postMessage): The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin, since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the DOMWindow they're pointing to, so we do not have to rely on synchronous IPC. * page/RemoteDOMWindow.h: Added. (isType): * page/RemoteFrame.cpp: Added. (WebCore::RemoteFrame::RemoteFrame): (WebCore::RemoteFrame::~RemoteFrame): (WebCore::RemoteFrame::virtualWindow const): * page/RemoteFrame.h: Added. (isType): 2018-04-12 Daniel Bates <dabates@apple.com> Content-Type not enforced for <script> allows for XSS https://bugs.webkit.org/show_bug.cgi?id=184386 <rdar://problem/39112268> Reviewed by Brady Eidson. As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018), we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type that begins with "audio/", "image/" or "video/". As a side benefit of this change we now set the destination property [1] on preload requests. [1] <https://fetch.spec.whatwg.org/#concept-request-destination> Tests: http/tests/security/script-with-banned-mimetype.html http/tests/workers/worker-importScripts-banned-mimetype.html * Sources.txt: Add file FetchIdioms.cpp. * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}. * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and block the script if applicable. * dom/LoadableScript.h: Add error type MIMEType. * loader/FetchIdioms.cpp: Added. (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked due to its MIME type?" algorithm from the Fetch standard. * loader/FetchIdioms.h: Added. * loader/FetchOptions.h: (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as CachedResourceLoader::requestResource() is now responsible for doing this. (WebCore::CachedResourceLoader::requestFont): Ditto. (WebCore::CachedResourceLoader::requestTextTrack): Ditto. (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto. (WebCore::CachedResourceLoader::requestScript): Ditto. (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto. (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert that the destination property is either video or audio. (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as CachedResourceLoader::requestResource() is now responsible for doing this. (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to load many kinds of requests that have different destination properties. The caller is responsible for setting the appropriate destintion property. (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property as CachedResourceLoader::requestResource() is now responsible for doing this. (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination. (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not already set. * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions and add a comment to explain what it is used for. * workers/Worker.cpp: (WebCore::Worker::create): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): Set the destination property to FetchOptions::Destination::Script and store it in an instance variable as we will need to reference it once we receive the HTTP response. Note that this function is only used to support the Web API importScripts(). (WebCore::WorkerScriptLoader::loadAsynchronously): Store the passed destination property in an instance as we will need to reference it once we receive the HTTP response. (WebCore::WorkerScriptLoader::didReceiveResponse): Check the MIME type of the response and block the script if applicable. * workers/WorkerScriptLoader.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): Set the destination property to FetchOptions::Destination::Serviceworker. 2018-04-12 Antoine Quint <graouts@apple.com> [Web Animations] Fix a host of small CSS Animations and CSS Transitions issues https://bugs.webkit.org/show_bug.cgi?id=184555 Reviewed by Dean Jackson. A series of small and intertwined issues were preventing a number of CSS Animations and CSS Trantions tests to fail when expressed as Web Animations. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Pass the old and new RenderStyles to CSSAnimation::create() since we're refactoring DeclarativeAnimation to create blending keyframes in initialize(), no longer requiring each subclass to create them. (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): Return the animation, if any, for a property animated by a CSS animation, so that we can determine if a property is already being animated when running a CSS Transition. (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Since a property can be specified twice in a "transition" property, once via "all" and once explicitly, ensure we look at all currently running transitions for the currently-processed property to see if we need to cancel this transition. Previously, we used to only see if it had been transitioned in the old style. We also start transitions even if the duration is 0 provided the delay is a positive, non-zero value. Then, if there is a CSS Animation for this property already running, use that animation's original unanimated style as the from value. * animation/AnimationTimeline.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::create): The animation name is now set in the CSSAnimation constructor. (WebCore::CSSAnimation::CSSAnimation): Set the animation name and keep a copy of the unanimated style such that we can get it when a CSS Transition is created and takes precedence over this CSS Animation. (WebCore::CSSAnimation::initialize): Deleted. * animation/CSSAnimation.h: * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): (WebCore::CSSTransition::initialize): * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): Call the new computeDeclarativeAnimationBlendingKeyframes() on the KeyframeEffect directly in this method so that subclasses don't need to create it manually, but most important so that keyframes are created before timing properties are set based on the backing animation. * animation/DeclarativeAnimation.h: * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::getKeyframes): Ensure we have a CSSValue before trying to serialize it. (WebCore::KeyframeEffectReadOnly::computeDeclarativeAnimationBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Use the animation's unanimated style to compute keyframes, instead of a default RenderStyle which would not use the right values for implicit keyframes. (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Look at the property used to create the transition rather than that specified on the backing Animation object since it can be CSSPropertyInvalid in the case of "transition: all". (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): If we're dealing with a CSS animation, we consider the first and last keyframes to always have the property listed since the underlying style was provided and should be captured. * animation/KeyframeEffectReadOnly.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Apply CSS Animations after CSS Trasitions since they take precedence. 2018-04-12 Antoine Quint <graouts@apple.com> [Web Animations] Only cancel declarative animations upon element removal https://bugs.webkit.org/show_bug.cgi?id=184553 Reviewed by Dean Jackson. Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject the ready promise and produce spurious logging from WPT tests. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement): (WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted. * animation/AnimationTimeline.h: * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): 2018-04-12 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r230554. The non-ASCII character in the filename causes issues with SVN Reverted changeset: "input.webkitEntries does not work as expected when folder contains accented chars" https://bugs.webkit.org/show_bug.cgi?id=184517 https://trac.webkit.org/changeset/230554 2018-04-12 Alicia Boya García <aboya@igalia.com> [MSE] Add isValid() assertions on PlatformTimeRanges::add() range ends https://bugs.webkit.org/show_bug.cgi?id=180253 Right now it's checked that start <= end but it's not checked that neither of them is undefined. When this happens, the bug can be hard to track down. The assertion is not enabled for Mac because there is currently a test that is hitting it. Reviewed by Jer Noble. * platform/graphics/PlatformTimeRanges.cpp: (WebCore::PlatformTimeRanges::add): 2018-04-12 Chris Dumez <cdumez@apple.com> Process::setIdentifier() / Process::identifier() do not need a lock https://bugs.webkit.org/show_bug.cgi?id=184544 Reviewed by Brady Eidson. Process::setIdentifier() / Process::identifier() do not need a lock. Process::setIdentifier() gets called in ChildProcess::initialize(), before we start any background threads. It is then safe to query this process identifier later on from background threads without locks. * platform/Process.cpp: (WebCore::Process::setIdentifier): (WebCore::Process::identifier): 2018-04-12 Antoine Quint <graouts@apple.com> Unreviewed, fix the Windows build. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::computeExtentOfAnimation const): 2018-04-12 Antoine Quint <graouts@apple.com> [Web Animations] Suspend animations when required https://bugs.webkit.org/show_bug.cgi?id=184541 Reviewed by Jon Lee. Animations managed by CSSAnimationController get suspended under a number of scenarios, we now add the possibility to suspend animations on a DocumentTimeline as well such that Web Animations and CSS Animations and CSS Transitions implemented as Web Animations get suspended under the same conditions as well. We also update the implementation for Internals::numberOfActiveAnimations() such that tests checking that animations get suspended pass. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::suspendAnimations): When asked to be suspended, the DocumentTimeline cancels pending invalidation tasks and updates all of the animations it manages, including those running on the compositor. (WebCore::DocumentTimeline::resumeAnimations): When asked to be resumed, the DocumentTimeline resumes animations it manages and rewinds its invalidation timer. (WebCore::DocumentTimeline::animationsAreSuspended): (WebCore::DocumentTimeline::numberOfActiveAnimationsForTesting const): Called by Internals::numberOfActiveAnimations(), this returns the number of animations managed by this timeline that are not suspended. (WebCore::DocumentTimeline::currentTime): (WebCore::DocumentTimeline::timingModelDidChange): Ensure the invalidation timer is not rewound if the timeline is suspended. * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::setTimeline): When moving to a new timeline, ensure we match the new timeline's animation state. (WebCore::WebAnimation::setSuspended): Toggle the accelerated running state of any backing hardware animations when the suspension state of an animation changes. * animation/WebAnimation.h: (WebCore::WebAnimation::isSuspended const): * dom/Document.cpp: (WebCore::Document::didBecomeCurrentDocumentInFrame): (WebCore::Document::resume): * dom/Document.h: * history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): * page/Frame.cpp: (WebCore::Frame::clearTimers): * page/Page.cpp: (WebCore::Page::setIsVisibleInternal): (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged): * testing/Internals.cpp: (WebCore::Internals::numberOfActiveAnimations const): (WebCore::Internals::animationsAreSuspended const): (WebCore::Internals::suspendAnimations const): (WebCore::Internals::resumeAnimations const): 2018-04-12 Antoine Quint <graouts@apple.com> [Web Animations] Throttle animations when lowPowerMode is on https://bugs.webkit.org/show_bug.cgi?id=184540 Reviewed by Jon Lee. Ensure animations are sampled at a lower frequency when lowPowerMode is on. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::updateThrottlingState): (WebCore::DocumentTimeline::animationInterval const): (WebCore::DocumentTimeline::updateAnimationSchedule): (WebCore::DocumentTimeline::scheduleAnimationResolution): * animation/DocumentTimeline.h: * page/Page.cpp: (WebCore::Page::handleLowModePowerChange): * testing/Internals.cpp: (WebCore::Internals::animationsInterval const): 2018-04-12 Antoine Quint <graouts@apple.com> [Web Animations] Ensure elements overlapping with elements animating also get composited https://bugs.webkit.org/show_bug.cgi?id=184539 Reviewed by Jon Lee. A number of compositing tests failed because we didn't call into the Web Animations engine while various calls on RenderLayer and RenderLayerBacking were made. We bring the functionality over from CSSAnimationController to DocumentTimeline and KeyframeAnimation to KeyframeEffectReadOnly. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationsForElement const): Update this method's signature to be const since it should be callable by other const method. (WebCore::AnimationTimeline::animationsForElement): Deleted. * animation/AnimationTimeline.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::computeExtentOfAnimation const): Adapt this method from CSSAnimationController. (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): Adapt this method from CSSAnimationController. (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): Adapt this method from CSSAnimationController. * animation/DocumentTimeline.h: * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::computeExtentOfTransformAnimation const): Bring this method over from KeyframeAnimation. (WebCore::containsRotation): Bring this method over from KeyframeAnimation. (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaTransformList const): Bring this method over from KeyframeAnimation. (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaMatrix const): Bring this method over from KeyframeAnimation. * animation/KeyframeEffectReadOnly.h: (WebCore::KeyframeEffectReadOnly::animatedProperties const): DocumentTimeline::computeExtentOfAnimation() needs to get a list of all animated properties to see if a transform is animated, so we now expose such a list. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::currentTransform const): Update this method to call into DocumentTimeline if the CSS Animations and CSS Transitions as Web Animations flag is on. (WebCore::RenderLayer::calculateClipRects const): Update this method to call into DocumentTimeline if the CSS Animations and CSS Transitions as Web Animations flag is on. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): Update this method to call into DocumentTimeline if the CSS Animations and CSS Transitions as Web Animations flag is on. * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): Update this method to call into DocumentTimeline if the CSS Animations and CSS Transitions as Web Animations flag is on. * rendering/RenderObject.h: (WebCore::RenderObject::documentTimeline const): 2018-04-11 Antoine Quint <graouts@apple.com> [Web Animations] Enable seeking for hardware animations https://bugs.webkit.org/show_bug.cgi?id=184518 Reviewed by Dean Jackson. Hardware animations had lagged behind software animations in support and this patch bring their respective level of support closer to one another. Importantly, we add the ability to seek an animation added to a GraphicsLayerCA since many tests pause and seek animations to test their state. Animations may also have their playback state changed along with their current time in the same run loop, so we now maintain a list of pending processing actions for hardware animations. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::updateAnimationSchedule): If we have animations queued up for updates to their accelerated state we can schedule animation resolution immediately since we've already established we'll have work to do. (WebCore::DocumentTimeline::updateAnimations): Factor the updates of pending accelerated animations out in a dedicated method. (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): Go through all pending accelerated animations and update their state. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): Update the m_shouldRunAccelerated flag when setting blending keyframes. (WebCore::KeyframeEffectReadOnly::apply): Ensure we finish accelerated animations if the progress is 1 or null (no longer active). start accelerated animations if the animation is starting and always resolve styles in software as well to ensure that hit testing will work as expected. (WebCore::KeyframeEffectReadOnly::computeShouldRunAccelerated): (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Called by WebAnimation when play() or pause() is called with the appropriate flag. (WebCore::KeyframeEffectReadOnly::animationDidSeek): Called by WebAnimation when the currentTime property is set. (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Add the provided action to the list of pending accelerated actions and notify the animation that the accelerated state needs changing. (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Called by DocumentTimeline, through WebAnimation, to apply all pending accelerated actions. (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const): If we're dealing with a declarative animation, we already have a backing Animation object, so use it directly. Otherwise, create one and ensure it reflects all timing properties for the animation. (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): Deleted. (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): Deleted. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setCurrentTime): Call animationDidSeek() on the effect to ensure its accelerated animation gets seeked. (WebCore::WebAnimation::play): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation is started or resumed. (WebCore::WebAnimation::pause): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation gets paused. (WebCore::WebAnimation::acceleratedStateDidChange): (WebCore::WebAnimation::applyPendingAcceleratedActions): (WebCore::WebAnimation::acceleratedRunningStateDidChange): Deleted. (WebCore::WebAnimation::startOrStopAccelerated): Deleted. * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::seekAnimation): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::addProcessingActionForAnimation): Add an AnimationProcessingAction to the list of such actions for a given animation name. In case we already have a Remove action, we ignore the action since the hardware animation will have been removed by the time we try to apply this processing action. (WebCore::GraphicsLayerCA::pauseAnimation): Add a Pause processing action. (WebCore::GraphicsLayerCA::seekAnimation): Add a Seek processing action. (WebCore::GraphicsLayerCA::removeAnimation): Add a Remove processing action. (WebCore::GraphicsLayerCA::updateAnimations): First ensure that all animations pending commit are committed and then update all animations based on the actions added through addProcessingActionForAnimation(). (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Generate a new animation based on the new seek time provided. * platform/graphics/ca/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::animationSeeked): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::animationSeeked): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Fix an issue where we would run the CSSAnimationController logic even when the legacy animation engine was disabled. 2018-04-12 Xabier Rodriguez Calvar <calvaris@igalia.com> Unreviewed, fix GStreamer builds * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): We were passing a String to a GST_WARNING call. 2018-04-11 Chris Dumez <cdumez@apple.com> input.webkitEntries does not work as expected when folder contains accented chars https://bugs.webkit.org/show_bug.cgi?id=184517 <rdar://problem/39265537> Reviewed by Ryosuke Niwa. Use String::fromUTF8() to construct a WTF String from the char* returned by dirname() in FileSystem::directoryName(). Previously, we were just calling the String constructor, which would treat the input as latin 1 instead of UTF-8. Test: fast/forms/file/entries-api/webkitEntries-nonascii-folder-name.html * platform/posix/FileSystemPOSIX.cpp: (WebCore::FileSystem::directoryName): 2018-04-11 Youenn Fablet <youenn@apple.com> Preventively expect UTF8 strings from libwebrtc SDP and error messages https://bugs.webkit.org/show_bug.cgi?id=184509 Reviewed by Eric Carlson. Make WebCore code expect any libwebrtc string to contain UTF-8. Currently SDPs do not contain any UTF-8 specific character but https://tools.ietf.org/html/rfc4566 allows it. Add Internals API to set track id so that we can inject UTF-8 inside some WebRTC tests. Test: webrtc/utf8-sdp.html * Modules/mediastream/MediaStreamTrack.h: (WebCore::MediaStreamTrack::setIdForTesting): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::fromStdString): (WebCore::fromSessionDescription): (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription): (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream): (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack): (WebCore::LibWebRTCMediaEndpoint::addDataChannel): (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate): (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded): (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): (WebCore::trackId): Deleted. * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::fromStdString): (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate): (WebCore::createReceiverForSource): * platform/mediastream/MediaStreamTrackPrivate.h: (WebCore::MediaStreamTrackPrivate::setIdForTesting): * testing/Internals.cpp: (WebCore::Internals::setMediaStreamTrackIdentifier): * testing/Internals.h: * testing/Internals.idl: 2018-04-11 Said Abou-Hallawa <sabouhallawa@apple.com> Cache glyphs (using display lists) when painting at high frequency https://bugs.webkit.org/show_bug.cgi?id=178750 <rdar://problem/35201729> Reviewed by Antti Koivisto. This patch adds support for caching of glyph drawing commands when painting at high frequency. Caching the glyph drawing will be done using DisplayLists. GlyphDisplayListCache is basically a hash map which maps InlineTextBox or SimpleLineLayout::Run to DisplayList. Before adding a new entry to it we have to check whether the conditions for caching the glyph DisplayList are met or not. If no entry is found for a given run, a new DisplayList is created and a new entry is add to the cache. * WebCore.xcodeproj/project.pbxproj: * page/MemoryRelease.cpp: (WebCore::releaseNoncriticalMemory): Make GlyphDisplayListCache respond to memory pressure. * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::displayListForTextRun const): * platform/graphics/FontCascade.h: (WebCore::FontCascade::displayListForTextRun): Record the drawing of a glyph run into a DisplayList. * rendering/GlyphDisplayListCache.h: Added. (WebCore::GlyphDisplayListCache::singleton): (WebCore::GlyphDisplayListCache::get): (WebCore::GlyphDisplayListCache::remove): (WebCore::GlyphDisplayListCache::clear): (WebCore::GlyphDisplayListCache::size const): (WebCore::GlyphDisplayListCache::sizeInBytes const): A simple cache for the TextRun DisplayList. Adding a new entry in the cache happens under restricted conditions. So this cache is not expected to grow much. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::~InlineTextBox): (WebCore::InlineTextBox::paint): (WebCore::InlineTextBox::paintMarkedTexts): (WebCore::InlineTextBox::paintMarkedTextBackground): (WebCore::InlineTextBox::paintMarkedTextForeground): (WebCore::InlineTextBox::paintMarkedTextDecoration): (WebCore::InlineTextBox::paintCompositionBackground): (WebCore::InlineTextBox::paintCompositionUnderlines const): (WebCore::InlineTextBox::paintCompositionUnderline const): * rendering/InlineTextBox.h: (WebCore::InlineTextBox::paintMarkedTexts): InlineTextBox::paintMarkedTextForeground() now requires PaintInfo to know whether the entry in the GlyphDisplayListCache should be removed or not. Change all the GraphicsContext arguments to be PaintInfo. * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::Layout::~Layout): * rendering/SimpleLineLayout.h: * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): (WebCore::SimpleLineLayout::simpleLineLayoutWillBeDeleted): * rendering/SimpleLineLayoutFunctions.h: * rendering/SimpleLineLayoutResolver.h: (WebCore::SimpleLineLayout::RunResolver::Run::simpleRun const): Implement the glyph caching for SimpleLineLayout::Run. * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextOrEmphasisMarks): If the DisplayList is available, replay it back into the GraphicsContext. Make sure to reset to the DisplayList pointer to nullptr after painting. (WebCore::TextPainter::clearGlyphDisplayLists): (WebCore::TextPainter::shouldUseGlyphDisplayList): Check whether we should use DisplayList to the draw glyph run. * rendering/TextPainter.h: (WebCore::TextPainter::setGlyphDisplayListIfNeeded): Check whether we should should use DisplayList to the draw glyph run and if we should, ensure first the DisplayList is cached and set it in the TextPainter so it uses it when the run is painted. (WebCore::TextPainter::removeGlyphDisplayList): Remove the cached DisplayList entry for a glyph layout run. 2018-04-11 Brent Fulgham <bfulgham@apple.com> GraphicsLayerCA::createPlatformCALayer always disables extended color in its backing store https://bugs.webkit.org/show_bug.cgi?id=184367 <rdar://problem/39249074> Reviewed by Simon Fraser. 'createPlatformCALayer' always passes a nil widget, which early returns from 'screenSupportsExtendedColor' with false. Instead, we should just pass the widget (nil or not) to the screen properties methods, which will use the primary screen if no screen is specified. I.e., we shouldn't do an early return here if the passed widget is nil. * platform/mac/PlatformScreenMac.mm: (WebCore::screenSupportsExtendedColor): 2018-04-11 Youenn Fablet <youenn@apple.com> Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=184374 Reviewed by Chris Dumez. Add support for SecurityOrigin encode/decode routines. * page/SecurityOrigin.h: 2018-04-11 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set https://bugs.webkit.org/show_bug.cgi?id=184498 Reviewed by Philippe Normand. [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set This is the same behaviour as with playbin itself. Make sure to keep using "playbin" for MediaSource. No test added as this is basically a small rework of the way we expose a feature. * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h: * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: * platform/graphics/gstreamer/GRefPtrGStreamer.h: * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::load): (WebCore::MediaPlayerPrivateGStreamer::enableTrack): (WebCore::MediaPlayerPrivateGStreamer::handleMessage): (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::disconnect): (WebCore::TrackPrivateBaseGStreamer::tagsChanged): * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h: 2018-04-10 Alex Christensen <achristensen@webkit.org> IDN spoofing with Hebrew combining characters https://bugs.webkit.org/show_bug.cgi?id=184472 <rdar://problem/39148687> Reviewed by Brent Fulgham. Covered by new API tests. * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isLookalikeCharacter): Punycode-encode hosts with Hebrew combining marks that look like dots and Vav with a combining dot above like we do with dotless i and j. 2018-04-11 Brent Fulgham <bfulgham@apple.com> Show punycode if URL contains Latin dum character https://bugs.webkit.org/show_bug.cgi?id=184477 <rdar://problem/39121999> Reviewed by David Kilzer. Revise our "lookalike character" logic to include the small Latin dum character. Test: fast/url/host.html * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isLookalikeCharacter): 2018-04-11 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] WaylandCompositorDisplay leaks its wl_display https://bugs.webkit.org/show_bug.cgi?id=184406 Reviewed by Carlos Garcia Campos. Well, this was harder than expected. We really just want to fix a small leak in the WebKit layer, but that requires a change in how WaylandCompositorDisplay calls the PlatformDisplayWayland constructor, to pass NativeDisplayOwned::Yes. That means WaylandCompositorDisplay can no longer use PlatformDisplayWayland's protected default constructor. Problem is that the normal PlatformDisplayWayland constructor calls PlatformDisplayWayland::initialize, which calls PlatformDisplayWayland::registryGlobal, which is a virtual function. The WaylandCompositorDisplay portion of the object is not constructed yet at this point, so WaylandCompositorDisplay::registryGlobal will never be called if we do that. I had to revert the previous version of this fix due to this problem. It had broken accelerated compositing. I'm reminded of Effective C++ item #9: Never call virtual functions during construction or destruction ("because such calls will never go to a more derived class than that of the currently executing constructor or destructor"). This code is fragile and likely to break again in the future, so let's refactor it a bit. Instead of calling initialize in the constructor, we'll call it from create functions. We'll have to add a couple create functions, and make the constructor protected to ensure it's not possible to create a PlatformDisplayWayland without initializing it. For good parallelism, do the same for the other PlatformDisplay classes. This commit additionally removes PlatformDisplayWayland's protected default constructor, since it's not needed anymore. The NativeDisplayOwned arguments to the PlatformDisplay constructors are now mandatory, instead of using NativeDisplayOwned::No as the default value, since that was dangerously close to being the cause of this leak, and the constructors are now accessed from private create functions anyway. Some more caution when using default parameter values is warranted in the future. Lastly, since we have to change PlatformDisplay::createPlatformDisplay to use the new create functions, take the opportunity to move things around a bit for clarity. There should be no change in behavior. I was just disappointed that the PlatformDisplayWPE creation was at the bottom of the function, after a comment indicating that normal display creation has failed, which is not the case for WPE. This all might have been a bit overkill, since the leak could probably have been fixed by passing nullptr to the PlatformDisplayWayland constructor for the wl_display and not removing WaylandCompositorDisplay's call to PlatformDisplayWayland::initialize. But the correctness of that code would then rely on implementation details of initialize, so this refactor seems better. No new tests since there *should* be no behavior change. Then again, I'm touching PlatformDisplay, and history shows we don't have the greatest track record of touching this code without introducing problems. * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::createPlatformDisplay): * platform/graphics/PlatformDisplay.h: * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::create): (WebCore::PlatformDisplayWayland::create): (WebCore::PlatformDisplayWayland::createHeadless): (WebCore::PlatformDisplayWayland::PlatformDisplayWayland): (WebCore::PlatformDisplayWayland::initialize): * platform/graphics/wayland/PlatformDisplayWayland.h: * platform/graphics/win/PlatformDisplayWin.h: * platform/graphics/wpe/PlatformDisplayWPE.cpp: (WebCore::create): * platform/graphics/wpe/PlatformDisplayWPE.h: * platform/graphics/x11/PlatformDisplayX11.cpp: (WebCore::PlatformDisplayX11::create): (WebCore::PlatformDisplayX11::create): (WebCore::PlatformDisplayX11::createHeadless): * platform/graphics/x11/PlatformDisplayX11.h: 2018-04-11 Jianjun Zhu <jianjun.zhu@intel.com> Fix a WebRTC data channel issue for non-ASCII characters. At the sender side, buffer size are calulcated after UTF8 encoding. At the receiver side, strings are constructed with UTF8 data. https://bugs.webkit.org/show_bug.cgi?id=184481 Reviewed by Youenn Fablet. Updated test: LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-send-expected.txt * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::sendStringData): (WebCore::LibWebRTCDataChannelHandler::OnMessage): 2018-04-11 Antti Koivisto <antti@apple.com> ImageFrame type used by non-Cocoa image decoder should not be the same as that used by ImageSource https://bugs.webkit.org/show_bug.cgi?id=184418 Reviewed by Said Abou-Hallawa. ScalableImageDecoder uses ImageFrame class which is meant to be an implementation detail of ImageSource. There are bunch of fields and methods in the type that are only used by one or the other client. For hackability there should be an unrelated frame type for ScalableImageDecoder. This patch adds ScalableImageDecoderFrame type used in ScalableImageDecoder only. It then cleans up unneeded things from both ImageFrame and ScalableImageDecoderFrame. * platform/ImageDecoders.cmake: * platform/graphics/ImageFrame.cpp: (WebCore::ImageFrame::operator=): (WebCore::ImageFrame::clearImage): (WebCore::ImageFrame::size const): (WebCore::ImageFrame::initialize): Deleted. * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::setDisposalMethod): Deleted. (WebCore::ImageFrame::disposalMethod const): Deleted. (WebCore::ImageFrame::backingStore const): Deleted. (WebCore::ImageFrame::hasBackingStore const): Deleted. * platform/image-decoders/ScalableImageDecoder.cpp: (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const): (WebCore::ScalableImageDecoder::frameDurationAtIndex const): (WebCore::ScalableImageDecoder::createFrameImageAtIndex): * platform/image-decoders/ScalableImageDecoder.h: * platform/image-decoders/ScalableImageDecoderFrame.cpp: Copied from Source/WebCore/platform/graphics/ImageFrame.cpp. (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame): (WebCore::ScalableImageDecoderFrame::~ScalableImageDecoderFrame): (WebCore::ScalableImageDecoderFrame::operator=): (WebCore::ScalableImageDecoderFrame::setDecodingStatus): (WebCore::ScalableImageDecoderFrame::decodingStatus const): (WebCore::ScalableImageDecoderFrame::clearImage): (WebCore::ScalableImageDecoderFrame::clear): (WebCore::ScalableImageDecoderFrame::initialize): (WebCore::ScalableImageDecoderFrame::size const): (WebCore::ImageFrame::ImageFrame): Deleted. (WebCore::ImageFrame::~ImageFrame): Deleted. (WebCore::ImageFrame::defaultFrame): Deleted. (WebCore::ImageFrame::operator=): Deleted. (WebCore::ImageFrame::setDecodingStatus): Deleted. (WebCore::ImageFrame::decodingStatus const): Deleted. (WebCore::ImageFrame::clearImage): Deleted. (WebCore::ImageFrame::clear): Deleted. (WebCore::ImageFrame::initialize): Deleted. (WebCore::ImageFrame::size const): Deleted. (WebCore::ImageFrame::hasNativeImage const): Deleted. (WebCore::ImageFrame::hasFullSizeNativeImage const): Deleted. (WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions const): Deleted. (WebCore::ImageFrame::singlePixelSolidColor const): Deleted. * platform/image-decoders/ScalableImageDecoderFrame.h: Copied from Source/WebCore/platform/graphics/ImageFrame.h. (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame): (WebCore::ScalableImageDecoderFrame::disposalMethod const): (WebCore::ScalableImageDecoderFrame::hasAlpha const): (WebCore::ScalableImageDecoderFrame::hasBackingStore const): (WebCore::ImageFrame::ImageFrame): Deleted. (WebCore::ImageFrame::isInvalid const): Deleted. (WebCore::ImageFrame::isPartial const): Deleted. (WebCore::ImageFrame::isComplete const): Deleted. (WebCore::ImageFrame::sizeRespectingOrientation const): Deleted. (WebCore::ImageFrame::frameBytes const): Deleted. (WebCore::ImageFrame::subsamplingLevel const): Deleted. (WebCore::ImageFrame::setDisposalMethod): Deleted. (WebCore::ImageFrame::disposalMethod const): Deleted. (WebCore::ImageFrame::nativeImage const): Deleted. (WebCore::ImageFrame::setOrientation): Deleted. (WebCore::ImageFrame::orientation const): Deleted. (WebCore::ImageFrame::setDuration): Deleted. (WebCore::ImageFrame::duration const): Deleted. (WebCore::ImageFrame::setHasAlpha): Deleted. (WebCore::ImageFrame::hasAlpha const): Deleted. (WebCore::ImageFrame::hasNativeImage): Deleted. (WebCore::ImageFrame::hasFullSizeNativeImage): Deleted. (WebCore::ImageFrame::hasMetadata const): Deleted. (WebCore::ImageFrame::backingStore const): Deleted. (WebCore::ImageFrame::hasBackingStore const): Deleted. * platform/image-decoders/bmp/BMPImageDecoder.cpp: (WebCore::BMPImageDecoder::frameBufferAtIndex): * platform/image-decoders/bmp/BMPImageDecoder.h: * platform/image-decoders/bmp/BMPImageReader.h: (WebCore::BMPImageReader::setBuffer): * platform/image-decoders/gif/GIFImageDecoder.cpp: (WebCore::GIFImageDecoder::findFirstRequiredFrameToDecode): (WebCore::GIFImageDecoder::frameBufferAtIndex): (WebCore::GIFImageDecoder::clearFrameBufferCache): (WebCore::GIFImageDecoder::haveDecodedRow): (WebCore::GIFImageDecoder::frameComplete): (WebCore::GIFImageDecoder::initFrameBuffer): * platform/image-decoders/gif/GIFImageDecoder.h: * platform/image-decoders/gif/GIFImageReader.cpp: (GIFImageReader::parse): * platform/image-decoders/gif/GIFImageReader.h: (GIFFrameContext::GIFFrameContext): * platform/image-decoders/ico/ICOImageDecoder.cpp: (WebCore::ICOImageDecoder::frameBufferAtIndex): * platform/image-decoders/ico/ICOImageDecoder.h: * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: (WebCore::JPEGImageDecoder::frameBufferAtIndex): (WebCore::setPixel): (WebCore::JPEGImageDecoder::outputScanlines): (WebCore::JPEGImageDecoder::jpegComplete): * platform/image-decoders/jpeg/JPEGImageDecoder.h: * platform/image-decoders/png/PNGImageDecoder.cpp: (WebCore::PNGImageDecoder::frameBufferAtIndex): (WebCore::PNGImageDecoder::rowAvailable): (WebCore::PNGImageDecoder::readChunks): (WebCore::PNGImageDecoder::clearFrameBufferCache): (WebCore::PNGImageDecoder::initFrameBuffer): (WebCore::PNGImageDecoder::frameComplete): * platform/image-decoders/png/PNGImageDecoder.h: * platform/image-decoders/webp/WEBPImageDecoder.cpp: (WebCore::WEBPImageDecoder::frameBufferAtIndex): (WebCore::WEBPImageDecoder::findFirstRequiredFrameToDecode): (WebCore::WEBPImageDecoder::decodeFrame): (WebCore::WEBPImageDecoder::initFrameBuffer): (WebCore::WEBPImageDecoder::applyPostProcessing): (WebCore::WEBPImageDecoder::clearFrameBufferCache): * platform/image-decoders/webp/WEBPImageDecoder.h: 2018-04-11 Antoine Quint <graouts@apple.com> [Web Animations] Turn Web Animations on by default https://bugs.webkit.org/show_bug.cgi?id=184491 Reviewed by Simon Fraser. * page/RuntimeEnabledFeatures.h: 2018-04-11 Ryosuke Niwa <rniwa@webkit.org> Fix warning in HashTools.h for newer versions of clang https://bugs.webkit.org/show_bug.cgi?id=184489 Reviewed by Alexey Proskuryakov. Removed "register" storage class specififer as it has been deprecated in C++11. * platform/HashTools.h: 2018-04-10 Wenson Hsieh <wenson_hsieh@apple.com> FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it https://bugs.webkit.org/show_bug.cgi?id=183395 <rdar://problem/38055732> Reviewed by Zalan Bujtas. In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple mitigation by wrapping the Frame in a Ref when firing the appearance update timer. Test: editing/selection/iframe-update-selection-appearance.html * editing/FrameSelection.cpp: (WebCore::FrameSelection::appearanceUpdateTimerFired): 2018-04-10 Brent Fulgham <bfulgham@apple.com> Unreviewed follow-up to r230468. Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts. * page/mac/EventHandlerMac.mm: (WebCore::lastEventIsMouseUp): (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): * platform/mac/EventLoopMac.mm: (WebCore::EventLoop::cycle): 2018-04-10 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the iOS build I accidentally exported an inline function in r230506. * page/ViewportConfiguration.h: (WebCore::ViewportConfiguration::viewSize const): 2018-04-10 Nan Wang <n_wang@apple.com> AX: Expose strong password fields on iOS https://bugs.webkit.org/show_bug.cgi?id=184465 <rdar://problem/39325104> Reviewed by Chris Fleizach. Exposed the strong password field on iOS. And made sure we are returning its actual value in accessibilityValue. Test: accessibility/ios-simulator/strong-password-field.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]): (-[WebAccessibilityObjectWrapper accessibilityValue]): 2018-04-10 Fujii Hironori <Hironori.Fujii@sony.com> [Win] Add UserAgentWin.cpp https://bugs.webkit.org/show_bug.cgi?id=184438 Reviewed by Michael Catanzaro. No new tests (No behavior change). * PlatformWin.cmake: * platform/win/UserAgentWin.cpp: Added. (WebCore::standardUserAgent): (WebCore::standardUserAgentForURL): 2018-04-10 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode https://bugs.webkit.org/show_bug.cgi?id=184435 <rdar://problem/38726260> Reviewed by Dean Jackson. Expose the size of the platform view. By default, in extra zoom mode, this *not* the same as the minimum layout size, since we lay out at a large width and then shrink down to real device dimensions when computing the initial scale (see r229063). ViewGestureGeometryCollector uses this in the process of computing a target zoom scale when double tapping. * page/ViewportConfiguration.h: (WebCore::ViewportConfiguration::viewSize const): 2018-04-10 Fujii Hironori <Hironori.Fujii@sony.com> [Win][WebKit] LibWebRTCProvider::webRTCAvailable is an undefined symbol https://bugs.webkit.org/show_bug.cgi?id=184437 Reviewed by Michael Catanzaro. No new tests (No behavior change). * PlatformWin.cmake: Added LibWebRTCProviderWin.cpp. * platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Added. (WebCore::LibWebRTCProvider::webRTCAvailable): 2018-04-10 Chris Dumez <cdumez@apple.com> Unreviewed build fix. Those enum value names were too generic and would cause conflicts. * Modules/webvr/VRDisplayCapabilities.h: (WebCore::VRDisplayCapabilities::hasPosition const): (WebCore::VRDisplayCapabilities::hasOrientation const): (WebCore::VRDisplayCapabilities::hasExternalDisplay const): (WebCore::VRDisplayCapabilities::canPresent const): * platform/vr/VRPlatformDisplay.h: * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR): 2018-04-10 Chris Dumez <cdumez@apple.com> Avoid constructing a service worker RegistrationStore for private sessions https://bugs.webkit.org/show_bug.cgi?id=184463 <rdar://problem/36613948> Reviewed by Youenn Fablet. Avoid constructing a service worker RegistrationStore for private sessions since there is no need for persistence and the registrationDatabaseDirectory is the empty string in such cases. * workers/service/server/SWServer.cpp: (WebCore::SWServer::removeRegistration): (WebCore::SWServer::clearAll): (WebCore::SWServer::clear): (WebCore::SWServer::SWServer): (WebCore::SWServer::didFinishActivation): * workers/service/server/SWServer.h: 2018-04-10 Chris Dumez <cdumez@apple.com> Unreviewed build fix. * page/LayoutContext.cpp: (WebCore::LayoutContext::~LayoutContext): * page/LayoutContext.h: 2018-04-10 Jeremy Jones <jeremyj@apple.com> MediaSessionManageriOS should defer creation of MPVolumeView until it needs to monitor AirPlay routes https://bugs.webkit.org/show_bug.cgi?id=184373 <rdar://problem/35177606> Reviewed by Eric Carlson. No change of behavior. This delays the creation of MPVolumeView until airplay routes are monitored. MPVolumeView is now also released when monitoring ends. This makes sure the MP* objects are only accessed from a UI safe thread. WebCore's "MainThread" may be different that the UI thread. Since this state change is necessarily asynchronous, starting and stopping must prevent races to keep state coherent. * platform/audio/ios/MediaSessionManagerIOS.mm: (-[WebMediaSessionHelper initWithCallback:]): (-[WebMediaSessionHelper dealloc]): (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]): (-[WebMediaSessionHelper allocateVolumeView]): Deleted. (-[WebMediaSessionHelper setVolumeView:]): Deleted. 2018-04-10 Sihui Liu <sihui_liu@apple.com> Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse https://bugs.webkit.org/show_bug.cgi?id=184268 <rdar://problem/39144446> Reviewed by Chris Dumez. The assertion is no longer true after the change, because multiple resources could have same url. Used if condition here to make sure we only delete specified resource. No new tests. Updated an existing test to test the stop loading case by not using injected bundle policy: http/tests/multipart/multipart-html.php. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::removeCachedResource): 2018-04-10 Zalan Bujtas <zalan@apple.com> Do not layout images when we only need the overflow information. https://bugs.webkit.org/show_bug.cgi?id=175331 Reviewed by Simon Fraser. This improves MotionMark's Simple Leaves by ~10%. Covered by existing tests. * rendering/RenderImage.cpp: (WebCore::RenderImage::layout): 2018-04-10 Zan Dobersek <zdobersek@igalia.com> [TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform https://bugs.webkit.org/show_bug.cgi?id=183868 Reviewed by Carlos Garcia Campos. Drop the GraphicsLayerTransform member variable from TextureMapperLayer and instead compute all the required transform information in the computeTransformsRecursive() method. These computations are not too expensive, and in turn we can drop an object from this class' state that was only duplicating a bunch of state variables. No new tests -- no change in functionality. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::computeTransformsRecursive): (WebCore::TextureMapperLayer::paintSelf): (WebCore::TextureMapperLayer::paintSelfAndChildren): (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica): (WebCore::TextureMapperLayer::replicaTransform): (WebCore::TextureMapperLayer::computeOverlapRegions): (WebCore::TextureMapperLayer::setPosition): (WebCore::TextureMapperLayer::setSize): (WebCore::TextureMapperLayer::setAnchorPoint): (WebCore::TextureMapperLayer::setPreserves3D): (WebCore::TextureMapperLayer::setTransform): (WebCore::TextureMapperLayer::setChildrenTransform): (WebCore::TextureMapperLayer::syncAnimations): (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded): * platform/graphics/texmap/TextureMapperLayer.h: 2018-04-09 Brent Fulgham <bfulgham@apple.com> Add ProcessPrivilege assertions to places that access NSApp https://bugs.webkit.org/show_bug.cgi?id=184322 <rdar://problem/39194560> Reviewed by Per Arne Vollan. Add ProcessPrivilege assertions to places where we interact with NSApp so that we can prevent accidentally using them in the WebContent process. * page/mac/EventHandlerMac.mm: (WebCore::lastEventIsMouseUp): (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): * platform/mac/EventLoopMac.mm: (WebCore::EventLoop::cycle): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::setDragImage): 2018-04-09 John Wilander <wilander@apple.com> Refactor Ignore HSTS code https://bugs.webkit.org/show_bug.cgi?id=184433 <rdar://problem/39298238> Reviewed by Darin Adler. This patch refactors our ignore HSTS code. The convenience functions are moved out of CFNetwork SPI in PAL, and into where they are used. It also switches from performSelector: calls to straight function calls, after checking that there is a responder. * platform/network/mac/WebCoreURLResponse.mm: (WebCore::schemeWasUpgradedDueToDynamicHSTS): Add convenience function here since it was moved out of CFNetworkSPI.h. 2018-04-09 Brady Eidson <beidson@apple.com> Expand WebCore policy concept of "shouldContinue" to allow for more than true/false https://bugs.webkit.org/show_bug.cgi?id=184424 Reviewed by Alex Christensen. No new tests (No behavior change, refactor only) Specifically this expands the "shouldContinue" bool to be an enum class with: -Yes -No -ForSuspension * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::loadPostRequest): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): * loader/FrameLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): (WebCore::PolicyChecker::checkNewWindowPolicy): * loader/PolicyChecker.h: 2018-04-09 Sihui Liu <sihui_liu@apple.com> REGRESSION(r229929): localStorage is broken for WebInspector https://bugs.webkit.org/show_bug.cgi?id=184382 <rdar://problem/39257355> Reviewed by Chris Dumez. Removed an if condition that caused false positive cases of database error. As per https://www.sqlite.org/c3ref/errcode.html, return value of sqlite3_errcode() is undefined on successful API call, so we should not use the code to check if there is an error. We should only use it when there is an error. After moving this condition, LocalStorage might return empty string instead of NULL on sqlite3_column_blob() error. Modified a test to cover this case: TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm. * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::getColumnBlobAsString): 2018-04-09 Brent Fulgham <bfulgham@apple.com> WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen https://bugs.webkit.org/show_bug.cgi?id=184344 <rdar://problem/39224969> Reviewed by Per Arne Vollan. The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the screen boundaries of the current display. This causes a bunch of interaction with NSScreen that we do not want to allow in the WebContent process. Instead, we should just use the cached screen information the WebContent process already possesses. This patch makes the following changes: 1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with the WindowServer directly. 2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing the user space version of the coordinates. A nil Window just means we want to get coordinates in terms of the primary display. 3. Keep track of the primary display so we can refer to it later. 4. Modify the IPC messages to include the primary display's ID so we can easily access it later. 5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather than whichever screen happened to hash to the lowest value. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): Use new methods that don't require WindowServer access. * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::displayID): Assert if we hit this code in the WebContent process. (WebCore::firstScreen): Ditto. (WebCore::window): Ditto. (WebCore::screen): Ditto. (WebCore::primaryScreenID): Added. (WebCore::getScreenProperties): Modify to return a pair consisting of the primary display ID and the HashSet of screen settings. (WebCore::setScreenProperties): Update to also track the primary display ID. (WebCore::screenProperties): Update to use the primary display ID. (WebCore::screenHasInvertedColors): Ditto. (WebCore::toUserSpaceForPrimaryScreen): Added. 2018-04-09 Said Abou-Hallawa <sabouhallawa@apple.com> Make InlineTextBox::createTextRun() take a const lvalue reference String https://bugs.webkit.org/show_bug.cgi?id=184182 Reviewed by Zalan Bujtas. InlineTextBox::createTextRun() takes a non-const lvalue reference String. It is tempting to change the signature of this method to take a const lvalue reference. But this was done intentionally. TextRun is effectively a StringView: it does not own the passed string. Having the argument a non-const lvalue reference makes the compiler prevent calls like createTextRun("abc"). To have a better way to express the lifetime of TextRun, this patch does the following: -- It makes TextRun::m_text of type String instead of StringView. -- It adds a new constructor which takes const String&. This constructor will addRef the underlying StringImpl when assigning it to m_text. -- It keeps the constructor which takes a StringView. The caller of this constructor still has to make sure the underlying String outlives the TextRun. To avoid copying the underlying buffer of the StringView, we will not use StringView::toString(). Instead we will use StringView::toStringWithoutCopying() which makes the returned String accesses the same buffer the StringView uses. In this case, the returned String is effectively a StringView. * page/DebugPageOverlays.cpp: (WebCore::drawRightAlignedText): * platform/graphics/TextRun.cpp: * platform/graphics/TextRun.h: (WebCore::TextRun::TextRun): (WebCore::TextRun::subRun const): (WebCore::TextRun::length const): (WebCore::TextRun::setText): (WebCore::TextRun::string const): Deleted. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::localSelectionRect const): (WebCore::InlineTextBox::paint): (WebCore::InlineTextBox::paintPlatformDocumentMarker): (WebCore::InlineTextBox::paintMarkedTextBackground): (WebCore::InlineTextBox::paintMarkedTextForeground): (WebCore::InlineTextBox::paintMarkedTextDecoration): (WebCore::InlineTextBox::offsetForPosition const): (WebCore::InlineTextBox::positionForOffset const): (WebCore::InlineTextBox::createTextRun const): There is no need for this function to take a String argument anymore. The reason for passing the String was to guarantee its lifetime by keeping a copy of it in the caller side. Now there is no need for that. The TextRun itself will keep this copy. * rendering/InlineTextBox.h: * rendering/RenderText.cpp: (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const): RenderText::text() returns StringImpl. The compiler wants us to be more explicit about which constructor of TextRun to call. * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForFontAndText): * rendering/SimpleLineLayoutTextFragmentIterator.cpp: (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): RenderStyle::hyphenString() returns an AtomicString. 2018-04-09 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed, rolling out r230390. Broke accelerated compositing Reverted changeset: "[GTK] WaylandCompositorDisplay leaks its wl_display" https://bugs.webkit.org/show_bug.cgi?id=184406 https://trac.webkit.org/changeset/230390 2018-04-03 Sergio Villar Senin <svillar@igalia.com> [OpenVR][WebVR] Retrieve FrameData in WebVR's rAF https://bugs.webkit.org/show_bug.cgi?id=184265 Reviewed by Žan Doberšek. VRFrameData contains all the required information to properly render a VR scene like view and projection matrices, pose data (position & orientation) and linear & angular velocity among others. The getFrameData() call must be issued inside a WebVR's own requestAnimationFrame. * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::getFrameData const): (WebCore::VRDisplay::getPose const): (WebCore::VRDisplay::requestAnimationFrame): (WebCore::VRDisplay::cancelAnimationFrame): * Modules/webvr/VRDisplay.h: * Modules/webvr/VREyeParameters.h: (WebCore::VREyeParameters::rawOffset const): Required to compute view matrices. * Modules/webvr/VRFrameData.cpp: (WebCore::matrixToArray): (WebCore::VRFrameData::leftProjectionMatrix const): (WebCore::VRFrameData::leftViewMatrix const): (WebCore::VRFrameData::rightProjectionMatrix const): (WebCore::VRFrameData::rightViewMatrix const): (WebCore::projectionMatrixFromFieldOfView): (WebCore::rotationMatrixFromQuaternion): (WebCore::applyHeadToEyeTransform): (WebCore::VRFrameData::update): (WebCore::VRFrameData::timestamp const): Deleted. * Modules/webvr/VRFrameData.h: (WebCore::VRFrameData::timestamp const): * Modules/webvr/VRPose.cpp: (WebCore::optionalFloat3ToJSCArray): (WebCore::VRPose::position const): (WebCore::VRPose::linearVelocity const): (WebCore::VRPose::linearAcceleration const): (WebCore::VRPose::orientation const): (WebCore::VRPose::angularVelocity const): (WebCore::VRPose::angularAcceleration const): * Modules/webvr/VRPose.h: (WebCore::VRPose::create): (WebCore::VRPose::update): (WebCore::VRPose::VRPose): * platform/vr/VRPlatformDisplay.h: (WebCore::VRPlatformTrackingInfo::Quaternion::Quaternion): (WebCore::VRPlatformTrackingInfo::Quaternion::conjugate): (WebCore::VRPlatformTrackingInfo::Quaternion::operator*): (WebCore::VRPlatformTrackingInfo::Float3::Float3): Just a group of 3 floats used to store both velocity and acceleration in a format which is very convenient to later generate JSC arrays. (WebCore::VRPlatformTrackingInfo::clear): * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR): (WebCore::rotationMatrixToQuaternion): (WebCore::VRPlatformDisplayOpenVR::getTrackingInfo): * platform/vr/openvr/VRPlatformDisplayOpenVR.h: 2018-04-09 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] WaylandCompositorDisplay leaks its wl_display https://bugs.webkit.org/show_bug.cgi?id=184406 Reviewed by Carlos Garcia Campos. Remove the protected default constructor, for good measure. * platform/graphics/wayland/PlatformDisplayWayland.h: 2018-04-08 Fujii Hironori <Hironori.Fujii@sony.com> [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library https://bugs.webkit.org/show_bug.cgi?id=184127 Reviewed by Konstantin Tokarev. No new tests (No behaviour changes). * CMakeLists.txt: Added a interface library WebCoreHeaderInterface. 2018-04-08 Yusuke Suzuki <utatane.tea@gmail.com> Use alignas instead of compiler-specific attributes https://bugs.webkit.org/show_bug.cgi?id=183508 Reviewed by Mark Lam. Use alignas instead of aligned. * platform/graphics/cpu/arm/filters/FELightingNEON.cpp: * platform/graphics/cpu/arm/filters/FELightingNEON.h: (WebCore::FELighting::platformApplyNeon): 2018-04-08 Michael Catanzaro <mcatanzaro@igalia.com> [WPE][GTK] Remove applicationDirectoryPath() and sharedResourcePath() https://bugs.webkit.org/show_bug.cgi?id=184381 Reviewed by Carlos Garcia Campos. These are unused. * platform/FileSystem.h: * platform/glib/FileSystemGlib.cpp: (WebCore::FileSystem::applicationDirectoryPath): Deleted. (WebCore::FileSystem::sharedResourcesPath): Deleted. 2018-04-07 Daniel Bates <dabates@apple.com> Have WorkerScriptLoader::loadAsynchronously() take a FetchOptions https://bugs.webkit.org/show_bug.cgi?id=184385 Reviewed by Youenn Fablet. Currently we pass various FetchOptions to WorkerScriptLoader::loadAsynchronously() so that it can build up a ThreadableLoaderOptions structure to pass to the loader. Each time we want to set another FetchOptions option we need to add a new parameter. Instead we should have WorkerScriptLoader::loadAsynchronously() take a FetchOptions. This will make it straightforward for a caller to set new loader options as needed. In particular, this will make it straightforward to support setting the request's destination flag (i.e. FetchOptions::destination) to support blocking scripts with a non-JavaScript MIME type in a subsequent commit. No functionality changed. So, no new tests. * loader/ResourceLoaderOptions.h: (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): Modified to take a FetchOptions by value so as to support both move and copy semantics. * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Added helper constructor that takes a FetchOptions. * loader/ThreadableLoader.h: * workers/Worker.cpp: (WebCore::Worker::create): Instantiate and pass a FetchOptions to the loader for the mode, cache policy, and redirect policy. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): Modified to take a FetchOptions and instantiate a ThreadableLoaderOptions from it. * workers/WorkerScriptLoader.h: * workers/WorkerScriptLoaderClient.h: (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const): Deleted. This function is no longer needed because the Service Worker client now passes the service worker mode directly to the loader. * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): Instantiate and pass a FetchOptions to the loader. * workers/service/ServiceWorkerJob.h: 2018-04-07 Timothy Hatcher <timothy@apple.com> Use the system's link color when system appearance is desired for a WebView. https://bugs.webkit.org/show_bug.cgi?id=184353 rdar://problem/9420053 Reviewed by Wenson Hsieh. Have Document consult RenderTheme via StyleColor for the various link colors. This allows the system to have different colors than the standard hardcoded ones. This adds StyleColor::Options, to avoid multiple booleans being passed around, since the "for visited link" state is now needed in RenderTheme. * WebCore.xcodeproj/project.pbxproj: Made StyleColor.h private, since RenderTheme.h includes it. * css/StyleColor.cpp: (WebCore::StyleColor::colorFromKeyword): Use options instead of a bool. (WebCore::StyleColor::isSystemColor): Consider CSSValueWebkitLink the start of system colors. * css/StyleColor.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::colorFromPrimitiveValue const): Use StyleColor::Options. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSystemColor): Use StyleColor::Options. * dom/Document.cpp: (WebCore::Document::resetLinkColor): Ask StyleColor for the link color instead of hardcoding it. (WebCore::Document::resetVisitedLinkColor): Ditto. (WebCore::Document::resetActiveLinkColor): Ditto. (WebCore::Document::styleColorOptions const): Added. Helper to get the options used. * dom/Document.h: * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Use StyleColor::Options. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::systemColor const): Add default values here, moved from Document. (WebCore::RenderTheme::focusRingColor): Use StyleColor::Options. * rendering/RenderTheme.h: (WebCore::RenderTheme::platformFocusRingColor const): Use StyleColor::Options. * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::systemColor const): Use StyleColor::Options. * rendering/RenderThemeGtk.h: * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::systemColor const): Use StyleColor::Options. * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformFocusRingColor const): Use StyleColor::Options. (WebCore::RenderThemeMac::platformColorsDidChange): Clear m_systemVisitedLinkColor. (WebCore::RenderThemeMac::systemColor const): Use StyleColor::Options. (WebCore::RenderThemeMac::adjustMenuListStyle const): Ditto. * rendering/RenderThemeWin.cpp: (WebCore::RenderThemeWin::systemColor const): Use StyleColor::Options. * rendering/RenderThemeWin.h: * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): Use StyleColor::Options. 2018-04-06 Youenn Fablet <youenn@apple.com> Response headers should be filtered when sent from NetworkProcess to WebProcess https://bugs.webkit.org/show_bug.cgi?id=184310 Reviewed by Ryosuke Niwa. Did some refactoring to allow ResourceResponse to use header value parsing routines. We add sanitization levels for regular responses in case responses might be exposed to scripts or not. If not exposed to scripts, additional filtering is done. Add internal API to get unfiltered response headers from a fetch response. Test: http/wpt/service-workers/header-filtering.https.html * Modules/fetch/FetchResponse.h: * loader/CrossOriginPreflightResultCache.cpp: (WebCore::CrossOriginPreflightResultCacheItem::parse): * platform/network/HTTPParsers.h: (WebCore::addToAccessControlAllowList): (WebCore::parseAccessControlAllowList): * platform/network/ResourceResponseBase.cpp: (WebCore::isSafeToKeepRedirectionResponseHeader): (WebCore::isCrossOriginSafeToKeepResponseHeader): (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields): * platform/network/ResourceResponseBase.h: * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::fetchResponseHeaderList): * testing/ServiceWorkerInternals.h: * testing/ServiceWorkerInternals.idl: 2018-04-06 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed, fix unused parameter warning when credential storage is disabled * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage): 2018-04-06 Eric Carlson <eric.carlson@apple.com> [Extra zoom mode] Block playback until fullscreen begins https://bugs.webkit.org/show_bug.cgi?id=184371 <rdar://problem/39250891> Reviewed by Youenn Fablet. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::updatePlayState): Return early when waiting to enter fullscreen. (WebCore::HTMLMediaElement::enterFullscreen): Set m_waitingToEnterFullscreen. (WebCore::HTMLMediaElement::exitFullscreen): Clear m_waitingToEnterFullscreen. (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto. * html/HTMLMediaElement.h: 2018-04-06 Brent Fulgham <bfulgham@apple.com> WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=184364 <rdar://problem/39246314> Reviewed by Per Arne Vollan. The WebContent process is interacting directly with NSScreen to determine if the current screen has extended color support. This should be brokered from the UIProcess. Tested by fast/media/mq-color-gamut.html. * platform/ScreenProperties.h: (WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor. (WebCore::ScreenProperties::decode): Ditto. * platform/mac/PlatformScreenMac.mm: (WebCore::getScreenProperties): Retrieve extended color support. (WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent process. Assert that NSScreen is not accessed in the WebContent process. 2018-04-06 Fujii Hironori <Hironori.Fujii@sony.com> [Win][WebCore] Expose a constant for scrollbar pixels per line (cScrollbarPixelsPerLine) https://bugs.webkit.org/show_bug.cgi?id=184296 Reviewed by Alex Christensen. No new tests (No behavior changes). * platform/PlatformWheelEvent.h: Placed cScrollbarPixelsPerLine definition. * platform/win/WheelEventWin.cpp: (WebCore::PlatformWheelEvent::PlatformWheelEvent): Removed cScrollbarPixelsPerLine definition. 2018-04-06 Brent Fulgham <bfulgham@apple.com> Unreviewed test fix after r230323 * platform/mac/PlatformScreenMac.mm: (WebCore::screenSupportsExtendedColor): Remove assertion hit during test runs. 2018-04-06 Brent Fulgham <bfulgham@apple.com> WebCore::screenColorSpace is retrieving CGColorSpace from NSScreen directly https://bugs.webkit.org/show_bug.cgi?id=184343 <rdar://problem/39224881> Reviewed by Per Arne Vollan. Revise ScreenProperties to serialize the screen's color space, and later retrieve that in the WebContent process. This allows us to close off the CGSWindowServer connection. * platform/ScreenProperties.h: (WebCore::ScreenProperties::encode const): Add CGColorSpaceRef support. (WebCore::ScreenProperties::decode): Ditto. * platform/mac/PlatformScreenMac.mm: (WebCore::displayID): Add assertion to prevent use in WebContent process. (WebCore::firstScreen): Ditto. (WebCore::getScreenProperties): Add support for CGColorSpaceRef. (WebCore::screenColorSpace): Retrieve cached version when in WebContent process. Assert that NSScreen is not accessed in WebContent process. 2018-04-06 Ms2ger <Ms2ger@igalia.com> Implement createImageBitmap(Blob) https://bugs.webkit.org/show_bug.cgi?id=183247 Reviewed by Dean Jackson. Tests: - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html * fileapi/FileReaderLoader.h: (WebCore::FileReaderLoader::url): expose the Blob's URL. * html/ImageBitmap.cpp: implement createImageBitmap(Blob). * html/ImageBitmap.h: allow the BlobImageObserver class access to the creation function. * loader/cache/CachedImage.cpp: reuse extracted code. (WebCore::CachedImage::isPDFResource const): (WebCore::CachedImage::isPostScriptResource const): (WebCore::CachedImage::createImage): * platform/graphics/Image.cpp: extract some code from CachedImage to reuse. (WebCore::Image::create): (WebCore::Image::isPDFResource): (WebCore::Image::isPostScriptResource): * platform/graphics/Image.h: add declarations. 2018-04-06 Zalan Bujtas <zalan@apple.com> Flex child does not get repainted when it is inserted back to the render tree. https://bugs.webkit.org/show_bug.cgi?id=184361 <rdar://problem/34528716> Reviewed by Antti Koivisto. As with any regular block children, we should issue full repaint for flexbox items on their first layout (see RenderBlockFlow::layoutBlockChild()). Test: fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): 2018-04-06 Ms2ger <Ms2ger@igalia.com> Support transferring ImageBitmap objects https://bugs.webkit.org/show_bug.cgi?id=183131 Reviewed by Dean Jackson. Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer.html * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::serialize): thread through ImageBitmaps. (WebCore::CloneSerializer::CloneSerializer): thread through ImageBitmaps. (WebCore::CloneSerializer::fillTransferMap): don't require a mutable reference. (WebCore::CloneSerializer::dumpImageBitmap): add. (WebCore::CloneSerializer::dumpIfTerminal): check for ImageBitmap. (WebCore::CloneDeserializer::deserialize): thread through ImageBitmaps. (WebCore::CloneDeserializer::CloneDeserializer): thread through ImageBitmaps. (WebCore::CloneDeserializer::readImageBitmap): add. (WebCore::CloneDeserializer::readTerminal): check for ImageBitmap. (WebCore::SerializedScriptValue::SerializedScriptValue): thread through ImageBitmaps. (WebCore::SerializedScriptValue::create): thread through ImageBitmaps. (WebCore::containsDuplicates): add. (WebCore::SerializedScriptValue::deserialize): handle ImageBitmap arguments. * bindings/js/SerializedScriptValue.h: update signatures, add member. * html/ImageBitmap.cpp: (WebCore::ImageBitmap::create): add. (WebCore::ImageBitmap::detachBitmaps): add. * html/ImageBitmap.h: add signatures. 2018-04-06 Said Abou-Hallawa <sabouhallawa@apple.com> When recording the drawing, the DisplayList should be initialized with the GraphicsContextState of the underlying GraphicsContext https://bugs.webkit.org/show_bug.cgi?id=184336 Reviewed by Antti Koivisto. The state of the drawing context has to be transfered to the recording DisplayList before recording. Many recording GraphicsContext functions will behave wrongly if it gets the default state. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::DisplayListDrawingContext::DisplayListDrawingContext): (WebCore::CanvasRenderingContext2DBase::drawingContext const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::recursiveCommitChanges): * platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::Recorder): * platform/graphics/displaylists/DisplayListRecorder.h: (WebCore::DisplayList::Recorder::ContextState::ContextState): (WebCore::DisplayList::Recorder::ContextState::cloneForSave const): * platform/graphics/displaylists/DisplayListReplayer.cpp: (WebCore::DisplayList::Replayer::replay): * platform/graphics/displaylists/DisplayListReplayer.h: (WebCore::DisplayList::Replayer::replay): If we do not have a clipping rectangle and we want to record all the drawing, we need a default value for the clipping rectangle and we want no clipping to happen. 2018-04-06 Daniel Bates <dabates@apple.com> Emit a more informative message when a script is blocked due to "X-Content-Type: nosniff" https://bugs.webkit.org/show_bug.cgi?id=184359 Reviewed by Per Arne Vollan. Emphasize in the message that the script was blocked from executing. Test: http/tests/security/contentTypeOptions/nosniff-importScript-blocked.html * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::notifyFinished): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::didReceiveResponse): 2018-04-06 Daniel Bates <dabates@apple.com> importScripts() should throw exception with a reason when it fails to load a script from the network https://bugs.webkit.org/show_bug.cgi?id=184345 Reviewed by Alexey Proskuryakov. Currently importScripts() throws a NetworkError exception without a reason when it fails to load a script from the network. It is ambiguous whether the load failed due to an access control failure or some other error. Instead we should include the reason the load failed in the thrown exception. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::importScripts): 2018-04-06 Daniel Bates <dabates@apple.com> Attempt to fix the build after <https://trac.webkit.org/changeset/230338> (https://bugs.webkit.org/show_bug.cgi?id=184360) Make lambdas mutable so that we can WTFMove() their captured arguments. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): 2018-04-06 Daniel Bates <dabates@apple.com> Have class Exception take String by value instead of a String&& https://bugs.webkit.org/show_bug.cgi?id=184360 Reviewed by Alexey Proskuryakov. For convenience support instantiating an Exception with either an lvalue String or rvalue String. Although it can be argued that having Exception take a String by value instead of String&& can lead to missed opportunities to WTFMove() a String object into Exception such mistakes are just that, missed opportunities. That is, correctness is not affected and we may perform an unnecessary ref/deref of the underlying StringImpl when instantiating an Exception. If such missed opportunities show up in profiles and such mistakes happen often then we can re-evaluate the decision to have Exception take a String by value. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): Simplify code now that Exception takes a String by value. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didFail): Ditto. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): Move String into Exception to avoid an unnecessary ref/de-ref. (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): Ditto. (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): Ditto. * dom/Exception.h: (WebCore::Exception::Exception): Take String by value. Also use uniform initializer syntax. 2018-04-06 Antti Koivisto <antti@apple.com> Tighten ImageSource to have BitmapImage pointer instead of Image https://bugs.webkit.org/show_bug.cgi?id=184356 Reviewed by Said Abou-Hallawa. ImageSource is an implementation detail of BitmapImage, not a generic type. * loader/ImageLoader.cpp: (WebCore::ImageLoader::decode): * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: (WebCore::Image::decode): Deleted. (WebCore::Image::imageFrameAvailableAtIndex): Deleted. Also make some BitmapImage specific functions non-virtual and remove them from Image. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::ImageSource): * platform/graphics/ImageSource.h: (WebCore::ImageSource::create): Make constructors private. * platform/graphics/cg/GraphicsContext3DCG.cpp: (WebCore::GraphicsContext3D::ImageExtractor::extractImage): 2018-04-06 Brent Fulgham <bfulgham@apple.com> Unreviewed test fix after r230323 * platform/mac/PlatformScreenMac.mm: (WebCore::screen): Remove assertion we still hit due to event handling code. 2018-04-05 Youenn Fablet <youenn@apple.com> REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing https://bugs.webkit.org/show_bug.cgi?id=184306 Reviewed by Ryosuke Niwa. Add an option to not compile CSS rules since they are not useful in NetworkProcess. Covered by tests no longer crashing in Debug WK2 bots. * contentextensions/ContentExtension.cpp: (WebCore::ContentExtensions::ContentExtension::create): (WebCore::ContentExtensions::ContentExtension::ContentExtension): * contentextensions/ContentExtension.h: * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension): * contentextensions/ContentExtensionsBackend.h: 2018-04-05 Brent Fulgham <bfulgham@apple.com> WebContent process is calling CGDisplayUsesInvertedPolarity https://bugs.webkit.org/show_bug.cgi?id=184337 <rdar://problem/39215702> Reviewed by Zalan Bujtas. The PlatformScreenMac code is still calling display-related routines directly, specifically CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from the UIProcess. There's also no reason to avoid the brokering behavior on current WebKit builds. Remove the compile guards so all macOS builds use this behavior. Finally, add some ProcessPrivilege assertions to guard against accidentally calling these routines in the future. Tested by existing regression tests. * platform/PlatformScreen.h: * platform/ScreenProperties.h: (WebCore::ScreenProperties::encode const): Add new values. (WebCore::ScreenProperties::decode): * platform/mac/PlatformScreenMac.mm: (WebCore::displayID): Add assertion that this is not calling display-related routines in the WebContent process. (WebCore::firstScreen): Ditto. (WebCore::screenProperties): Moved higher in the file so it can be reused. Add calls to CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. (WebCore::getScreenProperties): Moved higher in the file so it can be reused. Stop double-hashing displayID. (WebCore::screenIsMonochrome): Use cached values in WebContent process. Assert if this code attempts a display-related routine in the WebContent process. (WebCore::screenHasInvertedColors): Ditto. (WebCore::screenDepth): Add assertion that this is not calling display-related routines in the WebContent process. (WebCore::screenDepthPerComponent): Ditto. (WebCore::screenRect): Ditto. (WebCore::screenAvailableRect): Ditto. (WebCore::screen): Ditto. (WebCore::screenColorSpace): Ditto. (WebCore::screenSupportsExtendedColor): Ditto. 2018-04-05 John Wilander <wilander@apple.com> Resource Load Statistics: Apply cookie blocking to setCookiesFromDOM() https://bugs.webkit.org/show_bug.cgi?id=184346 <rdar://problem/39226036> Reviewed by Brent Fulgham. Since these cookies can't be seen and are not sent in requests, I can't write an automated test for them. This really should have been done as part of: https://bugs.webkit.org/show_bug.cgi?id=180682. That said, I have tested this manually. * platform/network/mac/CookieJarMac.mm: (WebCore::setCookiesFromDOM): 2018-04-05 Zalan Bujtas <zalan@apple.com> Folding anonymous blocks should not result in deleting content. https://bugs.webkit.org/show_bug.cgi?id=184339 <rdar://problem/37327428> Reviewed by Antti Koivisto. While folding multiple anonymous blocks (moving the children from next sibling over to previous sibling) we should ensure that the block we are about to destroy does not gain new descendants. In case of 4 sibling anonymous blocks (A B C D), while destroying B 1. we move C's children to A and destroy C. 2. While destroying C, we notice B and C as sibling anonymous blocks and we move D's children over to B (even though B is going to be destroyed as we climb back on the stack). In this patch, B is detached from the tree before we start moving renderers around so that a subsequent folding won't find B anymore as a candidate. Test: fast/block/crash-while-folding-anonymous-blocks.html * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::detach): 2018-04-05 Andy Estes <aestes@apple.com> Mark Payment Request as "Supported" in features.json https://bugs.webkit.org/show_bug.cgi?id=184338 Reviewed by Anders Carlsson. * features.json: 2018-04-05 Chris Dumez <cdumez@apple.com> Unreviewed, rolling out r230042. It is no longer needed now that it is safe to construct a SecurityOrigin from an on-main thread Reverted changeset: "WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread" https://bugs.webkit.org/show_bug.cgi?id=184068 https://trac.webkit.org/changeset/230042 2018-04-05 Yusuke Suzuki <utatane.tea@gmail.com> [WTF] Remove StaticLock https://bugs.webkit.org/show_bug.cgi?id=184332 Reviewed by Mark Lam. No behavior change. * Modules/webdatabase/Database.cpp: (WebCore::Database::Database): (WebCore::Database::performOpenAndVerify): (WebCore::Database::closeDatabase): (WebCore::Database::getCachedVersion const): (WebCore::Database::setCachedVersion): * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::openDatabaseMutex): * Modules/webdatabase/DatabaseTracker.h: * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::allActiveWebSocketsMutex): * Modules/websockets/WebSocket.h: * bridge/objc/WebScriptObject.mm: * crypto/CryptoAlgorithmRegistry.cpp: (WebCore::CryptoAlgorithmRegistry::identifier): (WebCore::CryptoAlgorithmRegistry::name): (WebCore::CryptoAlgorithmRegistry::create): (WebCore::CryptoAlgorithmRegistry::registerAlgorithm): * dom/Node.cpp: * platform/URL.cpp: * platform/graphics/FontCache.cpp: * platform/graphics/MediaPlayer.cpp: * platform/ios/QuickLook.mm: * platform/ios/WebSQLiteDatabaseTrackerClient.mm: * platform/ios/wak/WebCoreThread.mm: * platform/ios/wak/WebCoreThreadRun.cpp: * platform/network/cf/LoaderRunLoopCF.cpp: (WebCore::loaderRunLoop): * platform/network/curl/CurlContext.cpp: (WebCore::CurlShareHandle::mutexFor): * platform/network/curl/CurlContext.h: * platform/sql/SQLiteDatabaseTracker.cpp: (WebCore::SQLiteDatabaseTracker::incrementTransactionInProgressCount): (WebCore::SQLiteDatabaseTracker::decrementTransactionInProgressCount): * platform/text/TextEncodingRegistry.cpp: (WebCore::buildBaseTextCodecMaps): (WebCore::newTextCodec): (WebCore::atomicCanonicalTextEncodingName): * workers/WorkerThread.cpp: (WebCore::WorkerThread::workerThreadCount): (WebCore::WorkerThread::WorkerThread): (WebCore::WorkerThread::~WorkerThread): (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads): 2018-04-04 Youenn Fablet <youenn@apple.com> WebRTC data channel only applications require capture permissions for direct connections https://bugs.webkit.org/show_bug.cgi?id=174500 <rdar://problem/34134281> Reviewed by Eric Carlson. Test: webrtc/datachannel/mdns-ice-candidates.html Add support at PeerConnectionBackend to obfuscate any gathered host candidate by replacing the IP address with an opaque name that can be resolved by MDNS. An opaque name is generated for each IP address and is scoped by the document owning the peer connection object. Add support to resolve any such MDNS ICE candidate. A limit of 250 ms is fixed for the resolution to happen. After 250 ms, the candidate is discarded. Add an experimental flag around this feature, off by default. * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::extractIPAddres): (WebCore::PeerConnectionBackend::addIceCandidate): (WebCore::PeerConnectionBackend::addIceCandidateSucceeded): (WebCore::PeerConnectionBackend::addIceCandidateFailed): (WebCore::PeerConnectionBackend::newICECandidate): (WebCore::PeerConnectionBackend::doneGatheringCandidates): (WebCore::PeerConnectionBackend::registerMDNSName): (WebCore::PeerConnectionBackend::finishedRegisteringMDNSName): * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCIceCandidate.h: (WebCore::RTCIceCandidate::setCandidate): * Modules/mediastream/RTCPeerConnection.h: * dom/Document.cpp: (WebCore::Document::prepareForDestruction): (WebCore::Document::suspend): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::mdnsICECandidatesEnabled const): (WebCore::RuntimeEnabledFeatures::setMDNSICECandidatesEnabled): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: 2018-04-04 Brian Burg <bburg@apple.com> [Cocoa] WebDriver: test imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_non_session_cookie fails https://bugs.webkit.org/show_bug.cgi?id=184314 <rdar://problem/39186578> Reviewed by Timothy Hatcher. Covered by several tests in add_cookie.py per the bug title. * platform/network/cocoa/CookieCocoa.mm: (WebCore::Cookie::operator NSHTTPCookie * const): By converting an integral UNIX timestamp to |maxAge| fractional seconds into the future, we introduce unwanted precision that is truncated when switching back to a UNIX timestamp later. Always round up maxAge so that the truncated value and actual value are the same. 2018-04-04 Alex Christensen <achristensen@webkit.org> Move PingHandle to WebKitLegacy https://bugs.webkit.org/show_bug.cgi?id=184145 Reviewed by Youenn Fablet. * WebCore.xcodeproj/project.pbxproj: * platform/network/PingHandle.h: Removed. 2018-04-04 Per Arne Vollan <pvollan@apple.com> The layout test fast/canvas/canvas-blending-global-alpha.html is failing when the WebContent process does not have WindowServer access. https://bugs.webkit.org/show_bug.cgi?id=183752 <rdar://problem/38635731> The test is failing because the system is only providing software rendering when there is no access to the WindowServer, and software rendering is producing slightly different results than hardware rendering. To enable accelerated rendering, the GPU to be used for IOSurface rendering needs to be selected by handing over the OpenGL display mask to the IOSurface CGContext. Reviewed by Brent Fulgham. No new tests, covered by existing tests. * platform/graphics/GraphicsContext3D.h: * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::GraphicsContext3D::getOpenGLDisplayMask): * platform/graphics/cocoa/IOSurface.mm: (WebCore::IOSurface::ensurePlatformContext): 2018-04-04 Said Abou-Hallawa <sabouhallawa@apple.com> Track the paint frequency through a new class named PaintFrequencyTracker https://bugs.webkit.org/show_bug.cgi?id=184311 Reviewed by Antti Koivisto. PaintFrequencyTracker is a class which detects when a layer is painted frequently. SinglePaintFrequencyTracking is used in conjunction with PaintFrequencyTracker to recored a single paint timing. * rendering/PaintFrequencyTracker.h: Added. (WebCore::PaintFrequencyTracker::begin): (WebCore::PaintFrequencyTracker::end): (WebCore::PaintFrequencyTracker::paintingFrequently const): Simplify the logic for tracking the paint frequency and move it from RenderLayer.cpp. (WebCore::SinglePaintFrequencyTracking::SinglePaintFrequencyTracking): (WebCore::SinglePaintFrequencyTracking::~SinglePaintFrequencyTracking): A convenient way to bracket the begin() and the end() methods of PaintFrequencyTracker. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): (WebCore::RenderLayer::calculateClipRects const): (WebCore::PaintFrequencyInfo::PaintFrequencyInfo): Deleted. (WebCore::PaintFrequencyInfo::setPaintedCacheableResource): Deleted. (WebCore::PaintFrequencyInfo::paintingFrequently const): Deleted. (WebCore::PaintFrequencyInfo::updatePaintFrequency): Deleted. (WebCore::PaintFrequencyInfo::paintingCacheableResource): Deleted. * rendering/RenderLayer.h: Rename PaintFrequencyInfo to PaintFrequencyTracker and move it a separate header file. 2018-04-04 Jer Noble <jer.noble@apple.com> RELEASE_ASSERT in CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF() when MediaToolbox.framework missing https://bugs.webkit.org/show_bug.cgi?id=184247 <rdar://problem/39007591> Rubber-stamped by Eric Carlson. Use SOFT_LINK_FRAMEWORK_OPTIONAL for frameworks which are not guaranteed to be present. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF): 2018-04-04 Brent Fulgham <bfulgham@apple.com> Failures from mach port reference handling should be fatal https://bugs.webkit.org/show_bug.cgi?id=184202 <rdar://problem/37771114> Reviewed by Anders Carlsson. We may corrupt the Mach port space by improperly matching the equivalent of reference counting retains (mach_port_mod_refs) with releases (mach_port_deallocate). Our current implementation of MachSendRights::create does not grab a reference if the passed port is MACH_PORT_DEAD, but we unconditionally call mach_port_deallocate on the port, which could lead to a reference count mismatch. Likewise, our MachSendRight destructor does not release the port if it has changed to MACH_PORT_DEAD (e.g., if a child process dies), again leading to a mismatch in retain/releases. Finally, failures in mach_port_deallocate should be fatal because they indicate that the application was attempting to remove an unowned right. This is a fatal condition for Mach, and should lead to an abort. This patch does the following: 1. It creates a helper function that does the right thing for safely deallocating a mach port. 2. It uses it in multiple places. 3. It revises 'MachSendRight::create" so that it properly handles the condition of a dead port. 4. It revises the MachSendRight destructor to properly handle the condition of a dead port. No new tests, no change in behavior expected. * SourcesCocoa.txt: Update for move of MachSendRight files. * WebCore.xcodeproj/project.pbxproj: Ditto. * page/cocoa/ResourceUsageThreadCocoa.mm: (WebCore::getMachThreads): Added. (WebCore::cpuUsage): Use the new cleanup helper function. * platform/cocoa/MachSendRight.cpp: Removed. * platform/cocoa/MachSendRight.h: Removed. * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): * platform/graphics/cocoa/IOSurface.h: * platform/graphics/cocoa/IOSurface.mm: 2018-04-04 Youenn Fablet <youenn@apple.com> Remove unused HTTP header names https://bugs.webkit.org/show_bug.cgi?id=184272 Reviewed by Alex Christensen. No change of behavior. Removed some names that are not used in the code base. This allows to strengthen filtering of responses sent to WebProcess. Added two headers used by web inspector. Updated existing code to use indexed HTTP header names. * html/parser/XSSAuditor.cpp: (WebCore::XSSAuditor::init): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::sourceMapURLForResource): * platform/network/HTTPHeaderNames.in: 2018-04-04 Beth Dakin <bdakin@apple.com> Fix the !HAVE(AVFOUNDATION_VIDEO_OUTPUT) build https://bugs.webkit.org/show_bug.cgi?id=184309 -and corresponding- rdar://problem/39179126 Reviewed by Jer Noble. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): 2018-04-04 Youenn Fablet <youenn@apple.com> MockRealtimeVideoSourceMac should produce kCVPixelFormatType_420YpCbCr8Planar buffers https://bugs.webkit.org/show_bug.cgi?id=184304 Reviewed by Eric Carlson. Allows covering RealtimeOutgoingVideoSourceMac code path handling native buffers produced by capture video sources. ARGB buffer coverage is done through canvas capture streams. * platform/mediastream/mac/MockRealtimeVideoSourceMac.h: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): 2018-04-04 Youenn Fablet <youenn@apple.com> Introduce a ThreadSafeRefCounted parameter to ensure being destroyed on the main thread https://bugs.webkit.org/show_bug.cgi?id=183988 Reviewed by Darin Adler. No change of behavior, TrackPrivate remains destroyed on the main thread. * platform/graphics/TrackPrivateBase.h: * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable): (WebCore::AudioTrackPrivateMediaStreamCocoa::render): 2018-04-04 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix the build with libsoup < 2.49.91 after r230251. Stop using ResourceHandle in SoupNetworkSession. * platform/network/soup/SoupNetworkSession.cpp: (WebCore::SoupNetworkSession::SoupNetworkSession): (WebCore::authenticateCallback): Deleted. (WebCore::requestStartedCallback): Deleted. 2018-04-03 Alex Christensen <achristensen@webkit.org> Remove unused libsoup ResourceHandle implementation https://bugs.webkit.org/show_bug.cgi?id=184048 Reviewed by Michael Catanzaro. This code is unused since r228901 so let's remove it! * platform/network/ResourceHandle.h: * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::ResourceHandle::~ResourceHandle): (WebCore::ResourceHandleInternal::soupSession): (WebCore::ResourceHandle::cancelledOrClientless): (WebCore::ResourceHandle::ensureReadBuffer): (WebCore::ResourceHandle::currentStreamPosition const): (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse): (WebCore::ResourceHandle::didStartRequest): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::releaseForDownload): (WebCore::ResourceHandle::sendPendingRequest): (WebCore::ResourceHandle::cancel): (WebCore::ResourceHandle::shouldUseCredentialStorage): (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::receivedCancellation): (WebCore::ResourceHandle::receivedChallengeRejection): (WebCore::ResourceHandle::platformSetDefersLoading): (WebCore::sessionFromContext): Deleted. (WebCore::ResourceHandle::create): Deleted. (WebCore::ResourceHandle::ResourceHandle): Deleted. (WebCore::isAuthenticationFailureStatusCode): Deleted. (WebCore::tlsErrorsChangedCallback): Deleted. (WebCore::gotHeadersCallback): Deleted. (WebCore::applyAuthenticationToRequest): Deleted. (WebCore::restartedCallback): Deleted. (WebCore::shouldRedirect): Deleted. (WebCore::shouldRedirectAsGET): Deleted. (WebCore::continueAfterWillSendRequest): Deleted. (WebCore::doRedirect): Deleted. (WebCore::redirectSkipCallback): Deleted. (WebCore::wroteBodyDataCallback): Deleted. (WebCore::cleanupSoupRequestOperation): Deleted. (WebCore::nextMultipartResponsePartCallback): Deleted. (WebCore::sendRequestCallback): Deleted. (WebCore::continueAfterDidReceiveResponse): Deleted. (WebCore::startingCallback): Deleted. (WebCore::networkEventCallback): Deleted. (WebCore::createSoupMessageForHandleAndRequest): Deleted. (WebCore::createSoupRequestAndMessageForHandle): Deleted. (WebCore::ResourceHandle::timeoutFired): Deleted. (WebCore::waitingToSendRequest): Deleted. (WebCore::readCallback): Deleted. 2018-04-03 Ross Kirsling <ross.kirsling@sony.com> Add missing WEBCORE_EXPORTs (for Windows shared library build) https://bugs.webkit.org/show_bug.cgi?id=184279 Reviewed by Alex Christensen. * dom/Element.h: * dom/Node.h: * editing/FrameSelection.h: * html/DOMURL.h: * html/HTMLFormElement.h: * html/canvas/CanvasRenderingContext.h: * platform/graphics/GraphicsContext.h: * platform/graphics/PlatformDisplay.h: * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/GraphicsContextImplCairo.h: * platform/graphics/texmap/TextureMapperLayer.h: * platform/network/HTTPHeaderMap.h: * platform/network/ResourceRequestBase.h: * platform/network/ResourceResponseBase.h: * platform/network/curl/AuthenticationChallenge.h: * platform/network/curl/CurlFormDataStream.h: * platform/network/curl/CurlRequest.h: * platform/network/curl/CurlSSLHandle.h: * platform/network/curl/ResourceError.h: * platform/network/curl/ResourceResponse.h: 2018-04-03 Youenn Fablet <youenn@apple.com> RealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer https://bugs.webkit.org/show_bug.cgi?id=184281 rdar://problem/39153262 Reviewed by Jer Noble. Covered by manual testing by going to WebRTC web sites. * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): 2018-04-03 Filip Pizlo <fpizlo@apple.com> GC shouldn't do object distancing https://bugs.webkit.org/show_bug.cgi?id=184195 Reviewed by Saam Barati. No new tests because no change in behavior. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::JSDOMGlobalObject): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::JSDOMWindowBase): * dom/Document.cpp: (WebCore::Document::threadLocalCache): Deleted. * dom/Document.h: * page/OriginThreadLocalCache.cpp: Removed. * page/OriginThreadLocalCache.h: Removed. 2018-04-03 Brent Fulgham <bfulgham@apple.com> Guard against keychain/certificate access outside the network process https://bugs.webkit.org/show_bug.cgi?id=184214 <rdar://problem/38734795> Reviewed by Youenn Fablet. Use the ProcessPrivilege assertions to guard against accessing the Keychain from a non-Networking process. * Modules/webauthn/cocoa/LocalAuthenticator.mm: (WebCore::LocalAuthenticator::makeCredential): Assert if we access the keychain from a proces other than the Network or UI process. (WebCore::LocalAuthenticator::getAssertion): Ditto. (WebCore::LocalAuthenticator::issueClientCertificate const): Ditto. * crypto/mac/SerializedCryptoKeyWrapMac.mm: (WebCore::createAndStoreMasterKey): Ditto. (WebCore::findMasterKey): Ditto. (WebCore::deleteDefaultWebCryptoMasterKey): Ditto. * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): Ditto. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::createPrivateStorageSession): Ditto. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Ditto. 2018-04-03 Youenn Fablet <youenn@apple.com> NetworkResourceLoader does not need to expose all redirect response headers https://bugs.webkit.org/show_bug.cgi?id=184114 <rdar://problem/39010557> Reviewed by Ryosuke Niwa. No JS observable change of behavior. Behavior change is observable for injected bundles since they will no longer get access to the full response. List of response headers correspond to the one currently being used/exposed for redirections. Test: http/wpt/loading/redirect-headers.html * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setRestrictedHTTPResponseAccess): (WebCore::RuntimeEnabledFeatures::restrictedHTTPResponseAccess const): * platform/network/ResourceResponseBase.cpp: (WebCore::isSafeToKeepRedirectionHeader): (WebCore::ResourceResponseBase::sanitizeRedirectionHTTPHeaderFields): * platform/network/ResourceResponseBase.h: 2018-04-03 Andy Estes <aestes@apple.com> [Mac] Prioritize file promises over filenames during drag and drop https://bugs.webkit.org/show_bug.cgi?id=184237 <rdar://problem/38278076> Reviewed by Wenson Hsieh. When performing a drag operation where the pasteboard contains both a file path and a file promise, we have historically preferred to accept the file path. Some versions of Photos.app will provide both a low-resolution thumbnail as a file path and its high-resolution counterpart as a file promise when dragging a photo, and our current logic leads us to choose the low-quality thumbnail. This patch changes our logic to prefer file promises over file paths. This matches the behavior of Finder and ensures we accept high-resolution assets from Photos.app. Covered by existing file promise drag tests. beginDragWithFilePromises() was updated to write a bogus file path to the pasteboard along with the legitimate file promise. * platform/mac/DragDataMac.mm: (WebCore::DragData::asFilenames const): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::read): (WebCore::Pasteboard::readFilePaths): * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::numberOfFiles const): 2018-04-03 Mark Lam <mark.lam@apple.com> Fix mis-application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION macro. https://bugs.webkit.org/show_bug.cgi?id=184276 <rdar://problem/39109543> Rubber-stamped by Michael Saboff. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::toJSNewlyCreated): 2018-04-03 Yousuke Kimoto <yousuke.kimoto@sony.com> [CMake] gperf path should be given when WebCore/css/makevalues.pl is executed https://bugs.webkit.org/show_bug.cgi?id=184224 Reviewed by Konstantin Tokarev. When a building evironment doens't include a path to gperf, WebCore/css/makevalue.pl failes due to failing to execute gperf, so the full path to gperf should be given like WebCore/css/makeprop.pl. No new tests, no Web-facing behavior change. * CMakeLists.txt: gperf path is given to css/makevalues.pl. * css/makevalues.pl: Add an argument to handle a given gperf path. 2018-04-03 Chris Dumez <cdumez@apple.com> Drop MainFrame class https://bugs.webkit.org/show_bug.cgi?id=184191 Reviewed by Darin Adler. Drop MainFrame class and move contents into Page / Frame since there is a 1:1 relationship between the Page and the MainFrame. This is ground work for introducing LocalFrame / RemoteFrame concepts. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::create): (WebCore::ApplePaySession::supportsVersion): (WebCore::ApplePaySession::canMakePayments): (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): (WebCore::ApplePaySession::openPaymentSetup): (WebCore::ApplePaySession::paymentCoordinator const): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::paymentCoordinator): * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: * Modules/mediastream/UserMediaRequest.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::mainFrame const): (WebCore::AccessibilityObject::visiblePositionForBounds const): * accessibility/AccessibilityObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: * bindings/js/ScriptController.cpp: * bindings/js/ScriptState.cpp: * contentextensions/ContentExtensionsBackend.cpp: * css/MediaQueryEvaluator.cpp: (WebCore::displayModeEvaluate): * dom/DOMImplementation.cpp: * dom/Document.cpp: * dom/DocumentMarkerController.cpp: * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/EventDispatcher.cpp: * dom/ScriptedAnimationController.cpp: * editing/Editor.cpp: (WebCore::Editor::scanSelectionForTelephoneNumbers): * editing/EditorCommand.cpp: * editing/SelectionRectGatherer.cpp: (WebCore::SelectionRectGatherer::Notifier::~Notifier): * editing/cocoa/WebContentReaderCocoa.mm: * editing/markup.cpp: * history/CachedFrame.cpp: * history/CachedPage.cpp: * history/PageCache.cpp: (WebCore::destroyRenderTree): * html/HTMLMediaElement.cpp: * html/HTMLPlugInImageElement.cpp: * html/ImageDocument.cpp: * html/MediaElementSession.cpp: (WebCore::isMainContentForPurposesOfAutoplay): * html/canvas/WebGLRenderingContextBase.cpp: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorOverlay.cpp: * inspector/PageScriptDebugServer.cpp: * inspector/agents/InspectorApplicationCacheAgent.cpp: * inspector/agents/InspectorCanvasAgent.cpp: * inspector/agents/InspectorDOMAgent.cpp: * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::mainFrame): * inspector/agents/InspectorPageAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: * inspector/agents/page/PageRuntimeAgent.cpp: * loader/DocumentLoader.cpp: * loader/DocumentWriter.cpp: * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::setState): * loader/HistoryController.cpp: * loader/NavigationDisabler.h: * loader/ProgressTracker.cpp: * loader/ResourceLoadObserver.cpp: * loader/ResourceLoader.cpp: * loader/SubframeLoader.cpp: * loader/SubresourceLoader.cpp: * loader/appcache/ApplicationCacheHost.cpp: * loader/archive/mhtml/MHTMLArchive.cpp: * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.cpp: * page/AutoscrollController.cpp: * page/Chrome.cpp: * page/ContextMenuController.cpp: * page/DOMWindow.cpp: * page/DebugPageOverlays.cpp: (WebCore::MouseWheelRegionOverlay::updateRegion): (WebCore::NonFastScrollableRegionOverlay::updateRegion): (WebCore::RegionOverlay::create): (WebCore::RegionOverlay::RegionOverlay): (WebCore::RegionOverlay::~RegionOverlay): (WebCore::DebugPageOverlays::ensureRegionOverlayForPage): (WebCore::DebugPageOverlays::showRegionOverlay): (WebCore::DebugPageOverlays::hideRegionOverlay): (WebCore::DebugPageOverlays::regionChanged): (WebCore::DebugPageOverlays::regionOverlayForPage const): (WebCore::DebugPageOverlays::updateOverlayRegionVisibility): (WebCore::DebugPageOverlays::settingsChanged): * page/DebugPageOverlays.h: (WebCore::DebugPageOverlays::hasOverlaysForPage const): (WebCore::DebugPageOverlays::hasOverlays): (WebCore::DebugPageOverlays::didLayout): (WebCore::DebugPageOverlays::didChangeEventHandlers): * page/DragController.cpp: (WebCore::DragController::performDragOperation): (WebCore::DragController::tryDHTMLDrag): (WebCore::DragController::beginDrag): (WebCore::DragController::doSystemDrag): * page/EventHandler.cpp: (WebCore::EventHandler::handleMousePressEvent): (WebCore::EventHandler::mouseMoved): (WebCore::EventHandler::handleMouseReleaseEvent): (WebCore::EventHandler::handleWheelEvent): (WebCore::EventHandler::clearLatchedState): (WebCore::EventHandler::defaultWheelEventHandler): * page/FocusController.cpp: * page/Frame.cpp: (WebCore::Frame::Frame): (WebCore::Frame::dropChildren): (WebCore::Frame::selfOnlyRef): (WebCore::Frame::selfOnlyDeref): * page/Frame.h: (WebCore::Frame::mainFrame const): * page/FrameTree.cpp: * page/FrameView.cpp: (WebCore::FrameView::setFrameRect): (WebCore::FrameView::setContentsSize): (WebCore::FrameView::didChangeScrollOffset): (WebCore::FrameView::setViewExposedRect): * page/History.cpp: * page/MainFrame.cpp: Removed. * page/MainFrame.h: Removed. * page/MemoryRelease.cpp: * page/Page.cpp: (WebCore::Page::Page): (WebCore::m_applicationManifest): (WebCore::Page::setDeviceScaleFactor): (WebCore::Page::latchingState): (WebCore::Page::pushNewLatchingState): (WebCore::Page::resetLatchingState): (WebCore::Page::popLatchingState): (WebCore::Page::removeLatchingStateForTarget): (WebCore::Page::setPaymentCoordinator): * page/Page.h: (WebCore::Page::mainFrame): (WebCore::Page::mainFrame const): (WebCore::Page::wheelEventDeltaFilter): (WebCore::Page::pageOverlayController): (WebCore::Page::servicesOverlayController): (WebCore::Page::paymentCoordinator const): (WebCore::Page::applicationManifest const): (WebCore::Page::performanceLogging const): * page/PageConsoleClient.cpp: * page/PageDebuggable.cpp: * page/PageGroup.cpp: * page/PageGroupLoadDeferrer.cpp: * page/PageOverlay.cpp: (WebCore::PageOverlay::controller const): * page/PageOverlayController.cpp: (WebCore::PageOverlayController::PageOverlayController): (WebCore::PageOverlayController::createRootLayersIfNeeded): (WebCore::PageOverlayController::layerWithDocumentOverlays): (WebCore::PageOverlayController::layerWithViewOverlays): (WebCore::PageOverlayController::installPageOverlay): (WebCore::PageOverlayController::updateForceSynchronousScrollLayerPositionUpdates): (WebCore::PageOverlayController::didChangeViewExposedRect): (WebCore::PageOverlayController::updateSettingsForLayer): (WebCore::PageOverlayController::deviceScaleFactor const): (WebCore::PageOverlayController::notifyFlushRequired): (WebCore::PageOverlayController::tiledBackingUsageChanged): * page/PageOverlayController.h: * page/PageSerializer.cpp: * page/PerformanceLogging.cpp: (WebCore::PerformanceLogging::PerformanceLogging): (WebCore::PerformanceLogging::didReachPointOfInterest): * page/PerformanceLogging.h: * page/PerformanceMonitor.cpp: * page/ResourceUsageOverlay.cpp: (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay): (WebCore::ResourceUsageOverlay::initialize): * page/SettingsBase.cpp: * page/SpatialNavigation.cpp: * page/UserContentProvider.cpp: * page/ios/FrameIOS.mm: * page/mac/DragControllerMac.mm: * page/mac/EventHandlerMac.mm: (WebCore::latchingIsLockedToPlatformFrame): (WebCore::latchingIsLockedToAncestorOfThisFrame): (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::platformPrepareForWheelEvents): (WebCore::EventHandler::platformRecordWheelEvent): (WebCore::EventHandler::platformCompleteWheelEvent): (WebCore::EventHandler::platformCompletePlatformWidgetWheelEvent): * page/mac/PageMac.mm: * page/mac/ServicesOverlayController.h: (WebCore::ServicesOverlayController::page const): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::Highlight): (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired): (WebCore::ServicesOverlayController::Highlight::deviceScaleFactor const): (WebCore::ServicesOverlayController::ServicesOverlayController): (WebCore::ServicesOverlayController::invalidateHighlightsOfType): (WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded): (WebCore::ServicesOverlayController::remainingTimeUntilHighlightShouldBeShown const): (WebCore::ServicesOverlayController::buildPhoneNumberHighlights): (WebCore::ServicesOverlayController::buildSelectionHighlight): (WebCore::ServicesOverlayController::hasRelevantSelectionServices): (WebCore::ServicesOverlayController::createOverlayIfNeeded): (WebCore::ServicesOverlayController::telephoneNumberRangesForFocusedFrame): (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): (WebCore::ServicesOverlayController::mouseEvent): (WebCore::ServicesOverlayController::handleClick): (WebCore::ServicesOverlayController::mainFrame const): * page/scrolling/AsyncScrollingCoordinator.cpp: * page/scrolling/ScrollingCoordinator.cpp: * page/scrolling/ios/ScrollingCoordinatorIOS.mm: * page/scrolling/mac/ScrollingCoordinatorMac.mm: * platform/graphics/ca/win/CACFLayerTreeHost.cpp: * plugins/DOMMimeType.cpp: * plugins/PluginInfoProvider.cpp: (WebCore::PluginInfoProvider::refresh): * rendering/RenderBox.cpp: * rendering/RenderLayer.cpp: * rendering/RenderLayerBacking.cpp: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::hasAnyAdditionalCompositedLayers const): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers): (WebCore::RenderLayerCompositor::attachRootLayer): (WebCore::RenderLayerCompositor::detachRootLayer): (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): * rendering/RenderObject.cpp: * replay/UserInputBridge.cpp: * storage/StorageEventDispatcher.cpp: * style/StyleTreeResolver.cpp: (WebCore::Style::suspendMemoryCacheClientCalls): * svg/SVGSVGElement.cpp: * svg/graphics/SVGImage.cpp: * testing/InternalSettings.cpp: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::installMockPageOverlay): (WebCore::Internals::pageOverlayLayerTreeAsText const): * testing/MockPageOverlay.cpp: * testing/MockPageOverlay.h: * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::installOverlay): (WebCore::MockPageOverlayClient::layerTreeAsText): * testing/MockPageOverlayClient.h: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::MockPaymentCoordinator): (WebCore::MockPaymentCoordinator::showPaymentUI): (WebCore::MockPaymentCoordinator::completeMerchantValidation): (WebCore::MockPaymentCoordinator::changeShippingOption): (WebCore::MockPaymentCoordinator::changePaymentMethod): (WebCore::MockPaymentCoordinator::acceptPayment): (WebCore::MockPaymentCoordinator::cancelPayment): * testing/MockPaymentCoordinator.h: * workers/service/context/ServiceWorkerThreadProxy.cpp: 2018-04-03 Sihui Liu <sihui_liu@apple.com> The referer header is not set after redirect https://bugs.webkit.org/show_bug.cgi?id=182644 <rdar://problem/37479048> Reviewed by Youenn Fablet. Update referrer policy and recompute referrer in redirection check, so Referer header would be set after it's removed from cross-origin request. Add support for Referrer-Policy header, so referrer policy would be changed based on redirect response. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::processReferrerPolicy): * loader/CrossOriginAccessControl.cpp: (WebCore::updateRequestReferrer): * loader/CrossOriginAccessControl.h: * loader/ResourceLoader.h: (WebCore::ResourceLoader::setReferrerPolicy): (WebCore::ResourceLoader::referrerPolicy const): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): (WebCore::SubresourceLoader::updateReferrerPolicy): * loader/SubresourceLoader.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin): (WebCore::CachedResourceRequest::updateForAccessControl): (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders): * platform/ReferrerPolicy.cpp: Added. (WebCore::parseReferrerPolicy): * platform/ReferrerPolicy.h: * platform/network/HTTPHeaderNames.in: 2018-04-03 Chris Dumez <cdumez@apple.com> Make SecurityOrigin safe to create and use from any thread https://bugs.webkit.org/show_bug.cgi?id=184216 Reviewed by Youenn Fablet. We found that we have a decent amount of code constructing and using SecurityOrigin objects from non-main threads. Unfortunately, this was not safe, mostly due to SecurityOrigin's reliance on the SchemeRegistry. This patch makes it safe to construct a SecurityOrigin on any thread A and use it later on the same thread A. However, developers still need to call isolatedCopy() if they want to pass such object to another thread B. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canDisplay const): * page/SecurityOrigin.h: * page/SecurityPolicy.cpp: (WebCore::originAccessMapLock): (WebCore::originAccessMap): (WebCore::SecurityPolicy::isAccessWhiteListed): (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry): (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry): (WebCore::SecurityPolicy::resetOriginAccessWhitelists): * platform/SchemeRegistry.cpp: (WebCore::schemeRegistryLock): (WebCore::allBuiltinSchemes): (WebCore::builtinLocalURLSchemes): (WebCore::localURLSchemes): (WebCore::displayIsolatedURLSchemes): (WebCore::builtinSecureSchemes): (WebCore::secureSchemes): (WebCore::builtinSchemesWithUniqueOrigins): (WebCore::schemesWithUniqueOrigins): (WebCore::builtinEmptyDocumentSchemes): (WebCore::emptyDocumentSchemes): (WebCore::schemesForbiddenFromDomainRelaxation): (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes): (WebCore::canDisplayOnlyIfCanRequestSchemes): (WebCore::notAllowingJavascriptURLsSchemes): (WebCore::SchemeRegistry::registerURLSchemeAsLocal): (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal): (WebCore::schemesAllowingLocalStorageAccessInPrivateBrowsing): (WebCore::schemesAllowingDatabaseAccessInPrivateBrowsing): (WebCore::builtinCORSEnabledSchemes): (WebCore::CORSEnabledSchemes): (WebCore::ContentSecurityPolicyBypassingSchemes): (WebCore::cachePartitioningSchemes): (WebCore::serviceWorkerSchemes): (WebCore::alwaysRevalidatedSchemes): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal): (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess): (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated): (WebCore::SchemeRegistry::registerURLSchemeAsSecure): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure): (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest): (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest): (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy): (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy): (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy): (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned): (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme): (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle): (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme): (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme): * platform/SchemeRegistry.h: 2018-04-03 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Stop using ResourceHandle to load GResources https://bugs.webkit.org/show_bug.cgi?id=184259 Reviewed by Sergio Villar Senin. GResources are loaded in the WebProcess using ResourceHandle because soup handles them transparently. But now that we no longer use ResourceHandle, we can add a simple loader for GResources, similar to the one used for data URLS, since loading a GResource is a matter of calling g_resources_lookup_data() in the end. * SourcesGTK.txt: * SourcesWPE.txt: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::start): Check if resource to load is a GResource and call loadGResource(). * loader/ResourceLoader.h: * loader/soup/ResourceLoaderSoup.cpp: Added. (WebCore::ResourceLoader::loadGResource): Load the GResource in a GTask thread. * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::DataSegment::data const): (WebCore::SharedBuffer::DataSegment::size const): * platform/SharedBuffer.h: * platform/glib/SharedBufferGlib.cpp: (WebCore::SharedBuffer::SharedBuffer): (WebCore::SharedBuffer::create): 2018-04-02 Carlos Garcia Campos <cgarcia@igalia.com> [Enchant] Clean up TextCheckerEnchant https://bugs.webkit.org/show_bug.cgi?id=184233 Reviewed by Michael Catanzaro. Several cleanups and improvements: * platform/text/enchant/TextCheckerEnchant.cpp: (WebCore::TextCheckerEnchant::singleton): Make TextCheckerEnchant a singleton since it's always used as a singleton. (WebCore::TextCheckerEnchant::EnchantDictDeleter::operator() const): (WebCore::TextCheckerEnchant::TextCheckerEnchant): (WebCore::TextCheckerEnchant::ignoreWord): Convert to utf8 once instead of on every loop iteration. (WebCore::TextCheckerEnchant::learnWord): Ditton. (WebCore::TextCheckerEnchant::checkSpellingOfWord): m_enchantDictionaries is now a Vector of std::unique_ptr. (WebCore::TextCheckerEnchant::getGuessesForWord): Convert to utf8 once instead of on every loop iteration. (WebCore::TextCheckerEnchant::updateSpellCheckingLanguages): Get only the first language instead of building a vector to get its first item. Use WTFMove to replace m_enchantDictionaries with the new Vector. (WebCore::TextCheckerEnchant::loadedSpellCheckingLanguages const): Use a lambda to get the list of languages already converted to String and iterate only once. (WebCore::TextCheckerEnchant::availableSpellCheckingLanguages const): Ditto. (WebCore::enchantDictDescribeCallback): Deleted. (WebCore::TextCheckerEnchant::~TextCheckerEnchant): Deleted. (WebCore::TextCheckerEnchant::freeEnchantBrokerDictionaries): Deleted. * platform/text/enchant/TextCheckerEnchant.h: 2018-04-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Segfaults in enchant_broker_free_dict() https://bugs.webkit.org/show_bug.cgi?id=183738 Reviewed by Michael Catanzaro. Check enchant_broker_request_dict() didn't return nullptr before adding it to the m_enchantDictionaries vector. * platform/text/enchant/TextCheckerEnchant.cpp: (WebCore::TextCheckerEnchant::updateSpellCheckingLanguages): 2018-04-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback) https://bugs.webkit.org/show_bug.cgi?id=183346 Reviewed by Michael Catanzaro. This might happen if a request is cancelled right after the password request starts and before it finishes. We should cancel the password search when the network request is cancelled, not only when the NetworkStorageSession is destroyed. * platform/network/NetworkStorageSession.h: * platform/network/soup/NetworkStorageSessionSoup.cpp: (WebCore::NetworkStorageSession::~NetworkStorageSession): (WebCore::SecretServiceSearchData::SecretServiceSearchData): Helper struct to keep the request cancellable and completion handler. (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage): Create a SecretServiceSearchData for the request. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Pass the request cancellable to NetworkStorageSession::getCredentialFromPersistentStorage(). 2018-04-02 Eric Carlson <eric.carlson@apple.com> [Extra zoom mode] Replace video with a placeholder image during fullscreen transition https://bugs.webkit.org/show_bug.cgi?id=184188 <rdar://problem/38940307> Reviewed by Youenn Fablet. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::willExitFullscreen): * html/HTMLMediaElement.h: * platform/cocoa/VideoFullscreenChangeObserver.h: * platform/cocoa/VideoFullscreenModelVideoElement.h: * platform/cocoa/VideoFullscreenModelVideoElement.mm: (VideoFullscreenModelVideoElement::willExitFullscreen): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::updateVideoFullscreenInlineImage): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::updateVideoFullscreenInlineImage): * platform/graphics/VideoFullscreenLayerManager.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer): * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::exitFullscreen): (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::willExitFullscreen): 2018-04-02 Eric Carlson <eric.carlson@apple.com> Define AVKit softlink macro https://bugs.webkit.org/show_bug.cgi?id=184241 Reviewed by Jer Noble. No new tests, no functional change. * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: * platform/ios/PlaybackSessionInterfaceAVKit.mm: * platform/ios/VideoFullscreenInterfaceAVKit.mm: * platform/ios/WebAVPlayerController.mm: * platform/mac/PlaybackSessionInterfaceMac.mm: * platform/mac/VideoFullscreenInterfaceMac.mm: 2018-04-02 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Update date picker UI to latest specifications https://bugs.webkit.org/show_bug.cgi?id=184234 <rdar://problem/38804760> Reviewed by Timothy Hatcher. Tweak localizable strings. Day, month and year labels should be fully capitalized, and there needs to be a string for the "Set" button title. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::datePickerSetButtonTitle): (WebCore::datePickerDayLabelTitle): (WebCore::datePickerMonthLabelTitle): (WebCore::datePickerYearLabelTitle): * platform/LocalizedStrings.h: 2018-04-02 Ryosuke Niwa <rniwa@webkit.org> REGRESSION(r228260):WebHTMLView beeps at every keydown for Chinese/Japanese/Korean Input Method https://bugs.webkit.org/show_bug.cgi?id=184231 Reviewed by Alexey Proskuryakov. The bug was caused by EventHandler::internalKeyEvent calling setDefaultHandled and expecting it to stay true after dispatching the event even though m_defaultHandled is always cleared after r228260. This results in EventHandler::internalKeyEvent returning false, and resulting in a beep. Unfortunately, no new tests since there is no facility to detect this case in layout tests, and we can't easily emulate or trigger a real input method in API tests. * page/EventHandler.cpp: (WebCore::EventHandler::internalKeyEvent): 2018-04-02 Jer Noble <jer.noble@apple.com> AudioBufferSourceNode start method causes OfflineAudioContext to start running https://bugs.webkit.org/show_bug.cgi?id=181939 <rdar://problem/36755393> Reviewed by Eric Carlson. Test: webaudio/offlineaudiocontext-restriction.html Don't respect playback restrictions for offline AudioContexts. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::constructCommon): * Modules/webaudio/AudioContext.h: (WebCore::AudioContext::isOfflineContext const): (WebCore::AudioContext::userGestureRequiredForAudioStart const): (WebCore::AudioContext::pageConsentRequiredForAudioStart const): (WebCore::AudioContext::isOfflineContext): Deleted. 2018-04-02 Alejandro G. Castro <alex@igalia.com> [GTK] Make libwebrtc backend buildable for GTK port https://bugs.webkit.org/show_bug.cgi?id=178860 Reviewed by Youenn Fablet. This is the first step to add webrtc support to the GTK port using the libwebrtc backend. No new tests, no new feature added, it should be tested by current tests. * CMakeLists.txt: Add the new files to the compilation and set the new includes in the libwebrtc library. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: Reorder the includes alphabetically and add some that are missing. * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: Ditto. * Sources.txt: Add new file to the compilation. * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp: Added. Initial implementation for GTK and WPE. * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h: Added. Ditto. * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp: Added. Ditto. * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h: Added. Ditto. * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: Added. Ditto. * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: Added. Ditto. * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: Added. Ditto. * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h: Added. Ditto. * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Added includes for the compilation. * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Added, inherit from the LibWebRTCProvider to adapt for glib. 2018-04-01 Yusuke Suzuki <utatane.tea@gmail.com> Use WTF::Lock instead of GMutex https://bugs.webkit.org/show_bug.cgi?id=184227 Reviewed by Saam Barati. Prefer WTF::Lock over GMutex since these locks are just protecting WebKit C++ fields. No behavior change. * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp: (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer): (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer): (WebCore::AudioSourceProviderGStreamer::provideInput): (WebCore::AudioSourceProviderGStreamer::handleAudioBuffer): (WebCore::AudioSourceProviderGStreamer::clearAdapters): * platform/audio/gstreamer/AudioSourceProviderGStreamer.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const): (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): (WebCore::MediaPlayerPrivateGStreamerBase::paint): (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture): (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: 2018-03-31 Brent Fulgham <bfulgham@apple.com> Show punycode if URL contains hyphen character https://bugs.webkit.org/show_bug.cgi?id=184221 <rdar://problem/38044633> Reviewed by Darin Adler. Revise our "lookalike character" logic to include the hyphen, non-breaking hyphen, and minus sign. Test: fast/url/host.html * platform/mac/WebCoreNSURLExtras.mm: (WebCore::isLookalikeCharacter): 2018-03-31 Filip Pizlo <fpizlo@apple.com> JSObject shouldn't do index masking https://bugs.webkit.org/show_bug.cgi?id=184194 Reviewed by Yusuke Suzuki. No new tests because no new behavior. * bindings/js/JSDOMConvertSequences.h: (WebCore::Detail::NumericSequenceConverter::convertArray): (WebCore::Detail::SequenceConverter::convertArray): 2018-03-30 Chris Dumez <cdumez@apple.com> REGRESSION (r229828): Facebook login popup is blank https://bugs.webkit.org/show_bug.cgi?id=184206 <rdar://problem/39057006> Reviewed by Wenson Hsieh. Since r229828, we freeze the layer tree during the navigation policy check. We freeze in WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction() and unfreeze in WebFrameLoaderClient::didDecidePolicyForNavigationAction(). WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction() gets called from PolicyChecker::checkNavigationPolicy() which has 3 call sites in FrameLoader and one in DocumentLoader for redirects. The call sites in FrameLoader were taking care of calling didDecidePolicyForNavigationAction() on the FrameLoaderClient in their completion handler, but the DocumentLoader call site was failing to do so. As a result, the layer tree would stay frozen. To make this a lot less error prone, I moved the call to WebFrameLoaderClient::didDecidePolicyForNavigationAction() to PolicyChecker::checkNavigationPolicy(), inside the completion handler passed to WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(). This way, even if new code starts calling PolicyChecker::checkNavigationPolicy(), we do not need to worry about letting the client know when the policy decision is made. No new tests, covered by existing redirection tests with the new assertion I added. * loader/FrameLoader.cpp: (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): 2018-03-30 Devin Rousso <webkit@devinrousso.com> Web Inspector: tint all pixels drawn by shader program when hovering ShaderProgramTreeElement https://bugs.webkit.org/show_bug.cgi?id=175223 Reviewed by Matt Baker. Test: inspector/canvas/setShaderProgramHighlighted.html * html/canvas/InspectorShaderProgram.h: (WebCore::InspectorShaderProgram::highlighted): (WebCore::InspectorShaderProgram::setHighlighted): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::InspectorScopedShaderProgramHighlight::InspectorScopedShaderProgramHighlight): (WebCore::InspectorScopedShaderProgramHighlight::~InspectorScopedShaderProgramHighlight): (WebCore::InspectorScopedShaderProgramHighlight::showHighlight): (WebCore::InspectorScopedShaderProgramHighlight::hideHighlight): (WebCore::InspectorScopedShaderProgramHighlight::saveBlendValue): (WebCore::InspectorScopedShaderProgramHighlight::hasBufferBinding): (WebCore::InspectorScopedShaderProgramHighlight::hasFramebufferParameterAttachment): (WebCore::WebGLRenderingContextBase::drawArrays): (WebCore::WebGLRenderingContextBase::drawElements): If the current shader program has been marked as highlighted, apply a blend right before `drawArrays` and `drawElements` is called, tinting the resulting pixels so that they are visually distinguished from pixels drawn by other shader programs. * inspector/InspectorCanvasAgent.h: * inspector/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::setShaderProgramHighlighted): (WebCore::InspectorCanvasAgent::isShaderProgramHighlighted): * inspector/InspectorInstrumentation.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::isShaderProgramHighlighted): (WebCore::InspectorInstrumentation::isShaderProgramHighlightedImpl): 2018-03-30 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Adopt list view controller UI for numeric input types https://bugs.webkit.org/show_bug.cgi?id=184184 <rdar://problem/37238916> Reviewed by Timothy Hatcher. Add a localized string for the OK button shown on number pads in extra zoomed form controls. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::numberPadOKButtonTitle): * platform/LocalizedStrings.h: 2018-03-30 Ryosuke Niwa <rniwa@webkit.org> Copying a list from Microsoft Word to TinyMCE fails when mso-list is the first property https://bugs.webkit.org/show_bug.cgi?id=182938 <rdar://problem/37683007> Reviewed by Wenson Hsieh. Made the logic to detect Microsoft Word's mso-list CSS property more generic by detecting inline styles which start with "mso-list:" and one which line-break right before it: "\nmso-list:" Tests: PasteHTML.PreservesMSOList * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement): 2018-03-30 Youenn Fablet <youenn@apple.com> NetworkLoadChecker should upgrade redirects if needed https://bugs.webkit.org/show_bug.cgi?id=184098 Reviewed by Chris Dumez. Test: imported/w3c/web-platform-tests/beacon/upgrade-beacon.https.html * page/csp/ContentSecurityPolicy.h: 2018-03-30 Daniel Bates <dabates@apple.com> ASSERTION FAILED: ASSERT(!containsImage || MIMETypeRegistry::isSupportedImageResourceMIMEType([resource MIMEType])) in -[NSPasteboard(WebExtras) _web_writePromisedRTFDFromArchive:containsImage:] https://bugs.webkit.org/show_bug.cgi?id=184161 Reviewed by Per Arne Vollan. Fixes an assertion failure when quiting an app that uses a Legacy WebKit web view after dragging-and-dropping a PDF embedded using an HTML image element into the same web view. When performing a drag-and-drop of a PDF document image (WebCore::PDFDocumentImage) we create a WebArchive from the main frame's WebHTMLView and promise AppKit that will provide a Rich Text Format (RTF) document from this archive if needed. For some reason, on app termination AppKit requests that the WebHTMLView fullfill its RTF document promise for the WebArchive created at the start of the drag operation. WebKit expects that the created WebArchive is either for an inline image (e.g. <img>) or an image document that has a supported image resource MIME type (by querying MIMETypeRegistry::isSupportedImageResourceMIMEType()) and checks for these cases in this order. PDF/PostScript are not listed in the set of supported image resource MIME types. So, the first check fails and WebKit assumes that the WebArchive was created from an image document of a supported image resource MIME type. However, the WebArchive was created from a WebHTMLView and has MIME type text/html. Therefore the assertion fails. We need to add PDF and PostScript to the set of supported image resource MIME types so that WebKit does not fall back to the WebHTMLView code path. Historically, PDF and PostScript were in the set supported image resource MIME types. Over time the set of MIME types for image resouces (images loaded as a document) became identical to the set of MIME types for images loaded inline (e.g. <img>) and this set omitted the MIME types for PDF and PostScript. Additionally it is sufficient to implement MIMETypeRegistry::isSupportedImageResourceMIMEType() in terms of MIMETypeRegistry::isSupportedImageMIMEType() and MIMETypeRegistry::isPDFOrPostScriptMIMEType() instead of allocating a dedicated HashSet for the supported image resource MIME types (as we currently do). * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocument): Assert that PDF is a supported image MIME type before instantiating an ImageDocument. * platform/MIMETypeRegistry.cpp: (WebCore::initializeSupportedImageMIMETypes): Remove unnecessary allocation of a HashSet for the support image resource MIME types. (WebCore::MIMETypeRegistry::isSupportedImageResourceMIMEType): Write in terms of MIMETypeRegistry::isSupportedImageMIMEType() and MIMETypeRegistry::isPDFOrPostScriptMIMEType(). (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes): Deleted. * platform/MIMETypeRegistry.h: 2018-03-29 Antoine Quint <graouts@apple.com> [Web Animations] CSSTransition objects should have fill: backwards to allow seeking prior to start time https://bugs.webkit.org/show_bug.cgi?id=184129 Reviewed by Dean Jackson. In order to allow a CSS Transition to be seeked prior to its start time, it needs to have its fill mode set to backwards. Adding code to set the fill mode in CSSTransition::initialize() yields early timing model invalidation and we could get in a situation where stylesWouldYieldNewCSSTransitionsBlendingKeyframes() was called before we had a chance to create blending keyframes for a CSS transitions, since the call to create blending keyframes is made after the call to initialize(), so we now cater for this case. * animation/CSSTransition.cpp: (WebCore::CSSTransition::initialize): * animation/CSSTransition.h: * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): 2018-03-30 Daniel Bates <dabates@apple.com> Remove unused MIMETypeRegistry::getSupportedImageMIMETypesForEncoding() https://bugs.webkit.org/show_bug.cgi?id=184154 Reviewed by Per Arne Vollan. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding): Deleted. * platform/MIMETypeRegistry.h: 2018-03-30 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r230102. Caused assertion failures on JSC bots. Reverted changeset: "A stack overflow in the parsing of a builtin (called by createExecutable) cause a crash instead of a catchable js exception" https://bugs.webkit.org/show_bug.cgi?id=184074 https://trac.webkit.org/changeset/230102 2018-03-30 Robin Morisset <rmorisset@apple.com> A stack overflow in the parsing of a builtin (called by createExecutable) cause a crash instead of a catchable js exception https://bugs.webkit.org/show_bug.cgi?id=184074 <rdar://problem/37165897> Reviewed by Keith Miller. I had to slightly change the type of some bindings between JSC and WebCore. No functional change intended on the WebCore side. * bindings/js/JSReadableStreamPrivateConstructors.cpp: (WebCore::JSBuiltinReadableStreamDefaultReaderPrivateConstructor::initializeExecutable): (WebCore::JSBuiltinReadableStreamDefaultControllerPrivateConstructor::initializeExecutable): (WebCore::JSBuiltinReadableByteStreamControllerPrivateConstructor::initializeExecutable): (WebCore::JSBuiltinReadableStreamBYOBReaderPrivateConstructor::initializeExecutable): (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable): * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorHelperMethods): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::JSTestClassWithJSBuiltinConstructorConstructor::initializeExecutable): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::JSTestJSBuiltinConstructorConstructor::initializeExecutable): 2018-03-29 Antoine Quint <graouts@apple.com> [Web Animations] Correctly obtain the timing function for a given keyframe https://bugs.webkit.org/show_bug.cgi?id=184146 Reviewed by Dean Jackson. The way we would get the timing function for a given KeyframeValue stored in a KeyframeList was really suboptimal. When keyframes were created, we would set the animated element's style on each keyframe, and set keyframe-specific properties and values on top. When figuring out the timing function for a KeyframeValue, we would look at its render style, go through its list of animations, which could include animations that are irrelevant to this specific keyframe list since all animations from the animated element are referenced, and we would have to look up the correct animation by name and get the timing function, even though the timing function stored on the animation was now specific to this particular keyframe. We now simply set a m_timingFunction member on a KeyframeValue, which is null if no explicit animation-timing-function was provided for this keyframe in CSS, and otherwise set to a valid TimingFunction. This fixes our behavior for a 4 existing animation tests when opted into the CSS Animations and CSS Transitions as Web Animations feature. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex): * css/StyleResolver.cpp: (WebCore::StyleResolver::keyframeStylesForAnimation): * page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty const): * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::createFromCSSText): (WebCore::TimingFunction::createFromCSSValue): * platform/animation/TimingFunction.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::startAnimation): * rendering/style/KeyframeList.cpp: (WebCore::KeyframeValue::timingFunction const): Deleted. * rendering/style/KeyframeList.h: (WebCore::KeyframeValue::timingFunction const): (WebCore::KeyframeValue::setTimingFunction): 2018-03-29 Ryosuke Niwa <rniwa@webkit.org> Copying a list from Microsoft Word to TinyMCE fails when mso-list is on tags other than P https://bugs.webkit.org/show_bug.cgi?id=182954 <rdar://problem/37713141> Reviewed by Wenson Hsieh. Fixed the bug by relaxing the restriction that we only preserve mso-list on p. Tests: PasteHTML.PreservesMSOListOnH4 * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement): 2018-03-29 JF Bastien <jfbastien@apple.com> Use Forward.h instead of forward-declaring WTF::String https://bugs.webkit.org/show_bug.cgi?id=184172 <rdar://problem/39026146> Reviewed by Yusuke Suzuki. As part of #184164 I'm changing WTF::String, and the forward declarations are just wrong because I'm making it templated. We should use Forward.h anyways, so do that instead. * css/makeprop.pl: * platform/cocoa/PlaybackSessionInterface.h: * platform/ios/Device.h: * platform/ios/PlaybackSessionInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/win/PathWalker.h: * testing/js/WebCoreTestSupport.h: 2018-03-29 Ross Kirsling <ross.kirsling@sony.com> MSVC __forceinline slows down JSC release build fivefold after r229391 https://bugs.webkit.org/show_bug.cgi?id=184062 Reviewed by Alex Christensen. * platform/graphics/FormatConverter.cpp: Factor ALWAYS_INLINE_EXCEPT_MSVC out to WTF. 2018-03-29 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r230087. Introduced LayoutTest failures. Reverted changeset: "FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it" https://bugs.webkit.org/show_bug.cgi?id=183395 https://trac.webkit.org/changeset/230087 2018-03-29 Wenson Hsieh <wenson_hsieh@apple.com> FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it https://bugs.webkit.org/show_bug.cgi?id=183395 <rdar://problem/38055732> Reviewed by Zalan Bujtas. In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple mitigation by wrapping the Frame in a Ref when firing the appearance update timer, and ensuring that layout is really up to date before calling updateAppearanceAfterLayoutOrStyleChange() from the timer. Test: editing/selection/iframe-update-selection-appearance.html * editing/FrameSelection.cpp: (WebCore::FrameSelection::appearanceUpdateTimerFired): 2018-03-29 Daniel Bates <dabates@apple.com> Substitute ArchiveFactory::isArchiveMIMEType() for ArchiveFactory::isArchiveMimeType(). * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::commitLoad): * loader/archive/ArchiveFactory.cpp: (WebCore::ArchiveFactory::isArchiveMIMEType): (WebCore::ArchiveFactory::isArchiveMimeType): Deleted. * loader/archive/ArchiveFactory.h: * platform/MIMETypeRegistry.h: 2018-03-29 Daniel Bates <dabates@apple.com> MIMETypeRegistry should return const HashSets https://bugs.webkit.org/show_bug.cgi?id=184150 Reviewed by Per Arne Vollan. Only getSupportedNonImageMIMETypes() needs to return a non-const HashSet so that LegacyWebKit can modify the set of non-image MIME types. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes): (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes): (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding): (WebCore::MIMETypeRegistry::getSupportedMediaMIMETypes): (WebCore::MIMETypeRegistry::getPDFMIMETypes): (WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes): * platform/MIMETypeRegistry.h: 2018-03-29 Brady Eidson <beidson@apple.com> Update Service Worker feature status. https://bugs.webkit.org/show_bug.cgi?id=184139 Reviewed by Chris Dumez. * features.json: 2018-03-29 Chris Dumez <cdumez@apple.com> Drop DOMWindow::frames() / DOMWindow::window() methods https://bugs.webkit.org/show_bug.cgi?id=184112 Reviewed by Daniel Bates. Drop DOMWindow::frames() / DOMWindow::window() methods as they are just aliases for DOMWindow::self(). * page/DOMWindow.h: * page/DOMWindow.idl: 2018-03-29 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r230062. https://bugs.webkit.org/show_bug.cgi?id=184128 Broke mac port. web content process crashes while loading any web page (Requested by rniwa on #webkit). Reverted changeset: "MSVC __forceinline slows down JSC release build fivefold after r229391" https://bugs.webkit.org/show_bug.cgi?id=184062 https://trac.webkit.org/changeset/230062 2018-03-28 Antoine Quint <graouts@apple.com> [Web Animations] Implement more CSSPropertyBlendingClient methods https://bugs.webkit.org/show_bug.cgi?id=184077 Reviewed by Dean Jackson. We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we were animating non-matching transform, filter and backdrop-filter properties. We now implement those using the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and CSS Transitions as Web Animations feature. We also ensure we only run a CSSAnimationController assertion in FrameView::didDestroyRenderTree() if we're not using the CSS Animations and CSS Transitions as Web Animations feature. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource): (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists): (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists): (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists): (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): * animation/KeyframeEffectReadOnly.h: * page/FrameView.cpp: (WebCore::FrameView::didDestroyRenderTree): 2018-03-28 Chris Dumez <cdumez@apple.com> Align XMLHttpRequest's open() / send() / abort() with the latest specification https://bugs.webkit.org/show_bug.cgi?id=184108 Reviewed by Youenn Fablet. Align XMLHttpRequest's open() / send() / abort() with the latest specification: - https://xhr.spec.whatwg.org No new tests, rebaselined existing layout tests. * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::open): Align with https://xhr.spec.whatwg.org/#the-open()-method: - Change the order of some steps to match the order in the spec. In particular, open() no longer resets the state to UNSENT or abort any existing load when it fails early due to being passed a bad method. (WebCore::XMLHttpRequest::createRequest): Align with https://xhr.spec.whatwg.org/#the-send()-method: - Use the simpler "upload listener flag" logic from the spec instead of our more complex m_uploadEventsAllowed flag. This avoids constructing a SecurityOrigin objects on a background thread when XHR is used inside Web Workers, which was not thread-safe. - Set the upload complete flag when the request has no body as per step 9. - After firing the loadstartEvent, return early if the state is no longer OPEN or if the send flag is unset, as per step 11.3. (WebCore::XMLHttpRequest::abort): Align with https://xhr.spec.whatwg.org/#the-abort()-method: - Only set the state to UNSENT if the state is still DONE after firing the error events, as per step 3. (WebCore::XMLHttpRequest::didSendData): Use new "upload listener flag". (WebCore::XMLHttpRequest::dispatchErrorEvents): Align with https://xhr.spec.whatwg.org/#request-error-steps: - Stop firing a progress event in case of error as this is not as per specification and Firefox does not fire those either. * xml/XMLHttpRequest.h: 2018-03-28 Timothy Hatcher <timothy@apple.com> Consolidate NSColor to WebCore::Color conversion and fix system colors. https://bugs.webkit.org/show_bug.cgi?id=184096 rdar://problem/38918925 Reviewed by Tim Horton. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (CreateCGColorIfDifferent): Use CGColor property on NSColor, don't manually create new CGColor. * platform/graphics/mac/ColorMac.h: * platform/graphics/mac/ColorMac.mm: (WebCore::makeRGBAFromNSColor): Move pattern code from RenderThemeMac's convertNSColorToColor. Also use nextafter for proper RGBA float conversion. * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::color): Use colorFromNSColor. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const): Use colorFromNSColor. (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): Ditto. (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): Ditto. (WebCore::RenderThemeMac::systemColor const): Ditto. (WebCore::paintAttachmentTitleBackground): Ditto. (WebCore::convertNSColorToColor): Deleted. 2018-03-28 Said Abou-Hallawa <sabouhallawa@apple.com> The SVGAnimatedProperty wrappers have to be detached from the referenced values before the SVGAnimatedType is deleted https://bugs.webkit.org/show_bug.cgi?id=183972 Reviewed by Daniel Bates. If the SVGAnimatedType is a list type, e.g. SVGLengthListValues, the wrappers of the animated properties have to be detached from the items in the list before it's deleted. * svg/SVGAnimateElementBase.cpp: (WebCore::SVGAnimateElementBase::clearAnimatedType): 2018-03-28 Ross Kirsling <ross.kirsling@sony.com> MSVC __forceinline slows down JSC release build fivefold after r229391 https://bugs.webkit.org/show_bug.cgi?id=184062 Reviewed by Alex Christensen. * platform/graphics/FormatConverter.cpp: Factor ALWAYS_INLINE_EXCEPT_MSVC out to WTF. 2018-03-28 Zalan Bujtas <zalan@apple.com> Make it possible to override the screen size https://bugs.webkit.org/show_bug.cgi?id=184111 <rdar://problem/38972181> Reviewed by Tim Horton. We just call screenSize() atm. * page/Chrome.cpp: (WebCore::Chrome::overrideScreenSize const): * page/Chrome.h: * page/ChromeClient.h: * platform/HostWindow.h: * platform/PlatformScreen.h: * platform/ios/PlatformScreenIOS.mm: (WebCore::screenRect): (WebCore::overrideScreenSize): 2018-03-28 Timothy Hatcher <timothy@apple.com> Include the 'text' color keyword as a system color. https://bugs.webkit.org/show_bug.cgi?id=184113 rdar://problem/38779267 Reviewed by Tim Horton. * css/StyleColor.cpp: (WebCore::StyleColor::isColorKeyword): Don't check CSSValueMenu, it is a system color and is included. (WebCore::StyleColor::isSystemColor): Include CSSValueText. Check CSSValueWebkitFocusRingColor in the range, since it is immediately after CSSValueAppleSystemYellow. 2018-03-28 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Multiple select appearance doesn't update when selecting or deselecting rows in the picker view https://bugs.webkit.org/show_bug.cgi?id=184110 <rdar://problem/38796648> Reviewed by Tim Horton. HTMLSelectElement::optionSelectedByUser is invoked upon user interaction with a select menu. This currently takes two separate codepaths, depending on whether or not the menu list appearance is being used to render the select. If a menu list appearance is used, we call selectOption(), which updates validity, updates the element renderer, and then dispatches a `change` event if needed. However, if updateSelectedState() is used, we only update form validity and then dispatch the `change` event without updating the renderer, leaving it stale. Test: fast/forms/ios/ipad/multiple-select-updates-renderer.html * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::optionSelectedByUser): Update the renderer after updating the DOM to reflect the selected option. 2018-03-28 Daniel Bates <dabates@apple.com> Substitute "strong password confirmation auto fill" for "strong confirmation password auto fill" <rdar://problem/36518856> * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::AXAutoFillStrongConfirmationPasswordLabel): 2018-03-28 Daniel Bates <dabates@apple.com> WebSocket cookie incorrectly stored https://bugs.webkit.org/show_bug.cgi?id=184100 <rdar://problem/37928715> Reviewed by Brent Fulgham. A cookie received in a WebSocket response should be stored with respect to the origin of the WebSocket server in order for it to be sent in a subsequent request. Also removed a FIXME about implementing support for the long since deprecated Set-Cookie2 header. Test: http/tests/websocket/tests/hybi/websocket-cookie-overwrite-behavior.html * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::processBuffer): * Modules/websockets/WebSocketHandshake.h: 2018-03-28 Chris Dumez <cdumez@apple.com> Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener') https://bugs.webkit.org/show_bug.cgi?id=183962 <rdar://problem/38817833> Reviewed by Brady Eidson. Pass extra bits of information to the UIProcess via NavigationAction: - Is it a cross origin navigation caused by window.open() - Does the navigated frame have an opener This information is useful to determine on UIProcess side if we want to swap WebProcess. * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setIsCrossOriginWindowOpenNavigation): (WebCore::FrameLoadRequest::isCrossOriginWindowOpenNavigation const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): * loader/NavigationAction.h: (WebCore::NavigationAction::setIsCrossOriginWindowOpenNavigation): (WebCore::NavigationAction::isCrossOriginWindowOpenNavigation const): (WebCore::NavigationAction::setOpener): (WebCore::NavigationAction::opener const): * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): 2018-03-28 Chris Dumez <cdumez@apple.com> Thread safety issue in IDBFactory' shouldThrowSecurityException() https://bugs.webkit.org/show_bug.cgi?id=184064 Reviewed by Ryosuke Niwa. shouldThrowSecurityException() gets called on a non-main thread but it ended up using the SchemeRegistry via SecurityOrigin::canAccessDatabase() which calls SecurityOrigin::isLocal(). Since using the SchemeRegistry from the background thread is not safe (we recently added locks which we're trying to remove), and since SecurityOrigin methods are often called from background threads, this patch make SecurityOrigin::isLocal() safe to call from a background thread. To achieve this, we now query the SchemeRegistry in the SecurityOrigin constructor instead as SecurityOrigin objects are expected to be constructed on the main thread. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isLocal const): Deleted. * page/SecurityOrigin.h: (WebCore::SecurityOrigin::isLocal const): 2018-03-28 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r230033. The LayoutTests modified in this change fail an assertion on WK1. Reverted changeset: "[Web Animations] Implement more CSSPropertyBlendingClient methods" https://bugs.webkit.org/show_bug.cgi?id=184077 https://trac.webkit.org/changeset/230033 2018-03-28 Chris Dumez <cdumez@apple.com> WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread https://bugs.webkit.org/show_bug.cgi?id=184068 Reviewed by Youenn Fablet. WebSocket::didReceiveMessage() may construct a SecurityOrigin object on a non-main thread, which is not safe. We now use SecurityOriginData since we only need an origin String and it is safe to construct a SecurityOriginData on any thread. * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::didReceiveMessage): 2018-03-28 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Make boosted text autosizing values switchable at runtime https://bugs.webkit.org/show_bug.cgi?id=184092 <rdar://problem/38939917> Reviewed by Tim Horton. In r228697, we introduced a new set of boosted text autosizing constants tuned for extra zoom mode, which are currently hard-coded as default values in SettingsBase. However, we've since identified cases where clients may want to opt in or out of boosted text autosizing values and just use the existing values. This replaces settings to adjust text autosizing constants with a flag to enable or disable boosted text autosizing; when changed, we update all three text autosizing parameters to their default or boosted values, and then trigger style recalculation. Test: TextAutosizingBoost.ChangeAutosizingBoostAtRuntime * page/Settings.yaml: * page/SettingsBase.cpp: (WebCore::SettingsBase::shouldEnableTextAutosizingBoostChanged): (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient): Deleted. (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient): Deleted. (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease): Deleted. Changed these to constant values instead of helper functions, and also introduced boosted text autosizing constants for use in extra zoom mode. * page/SettingsBase.h: (WebCore::SettingsBase::oneLineTextMultiplierCoefficient const): (WebCore::SettingsBase::multiLineTextMultiplierCoefficient const): (WebCore::SettingsBase::maxTextAutosizingScaleIncrease const): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::extraDefaultStyleSheet): Tweak the stylesheet to make `-webkit-text-size-adjust: auto` overridable by web content. Adding the !important is breaking many websites that positioned text such that it is positioned within layout viewport bounds without text autosizing. 2018-03-28 Brent Fulgham <bfulgham@apple.com> Avoid uninitialized mach ports https://bugs.webkit.org/show_bug.cgi?id=184090 <rdar://problem/37261129> Reviewed by Chris Dumez. It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so there is a potential for us to try to use invalid ports. We should always check return values, and ensure that the mach port variables we seek to initialize are kept in a valid state. No new tests, no Web-facing behavior change. * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::attachToAppleGraphicsControl): Initialize masterPort to a default value. 2018-03-28 Antoine Quint <graouts@apple.com> [Web Animations] Implement more CSSPropertyBlendingClient methods https://bugs.webkit.org/show_bug.cgi?id=184077 Reviewed by Dean Jackson. We only had stubs for several of the CSSPropertyBlendingClient methods and thus always implied that we were animating non-matching transform, filter and backdrop-filter properties. We now implement those using the same code used in KeyframeAnimation. This allows for 31 new tests to opt into the CSS Animations and CSS Transitions as Web Animations feature. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource): (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::checkForMatchingTransformFunctionLists): (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists): (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists): (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): * animation/KeyframeEffectReadOnly.h: 2018-03-28 Antoine Quint <graouts@apple.com> [Web Animations] Comparing two matching FramesTimingFunction objects fails https://bugs.webkit.org/show_bug.cgi?id=184078 Reviewed by Jon Lee. Fix a stupid mistake in the == operator for FramesTimingFunction. Without a correct check, we would mistakenly interrupt and restart any transition with a frames() timing function when we check that the Animation objects are similar. * platform/animation/TimingFunction.h: 2018-03-28 Miguel Gomez <magomez@igalia.com> [GTK][WPE] Remove UpdateAtlas https://bugs.webkit.org/show_bug.cgi?id=184042 Reviewed by Žan Doberšek. Remove UpdateAtlas and AreaAllocator classes. Instead of using UpdateAtlas as a cache of buffers to render tiles with cairo, allocate a new buffer for each tile instead. Covered by existent tests. * loader/EmptyClients.h: * page/ChromeClient.h: * platform/TextureMapper.cmake: * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Removed. * platform/graphics/texmap/coordinated/AreaAllocator.h: Removed. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h: * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h: (): Deleted. * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Removed. * platform/graphics/texmap/coordinated/UpdateAtlas.h: Removed. * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): 2018-03-27 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed, rolling out r230008. Lots of HTTP test failures Reverted changeset: "Remove unused libsoup ResourceHandle implementation" https://bugs.webkit.org/show_bug.cgi?id=184048 https://trac.webkit.org/changeset/230008 2018-03-27 Chris Dumez <cdumez@apple.com> Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads https://bugs.webkit.org/show_bug.cgi?id=184029 Reviewed by Youenn Fablet. Make it possible to call ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() from non-main threads by having it use SecurityOriginData (which is safe to construct on non-main threads) instead of SecurityOrigin (which isn't). ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() is already called from non-main thread in FetchLoader, XHR and WebSocket when used in workers. This wasn't safe. * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::begin): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded const): (WebCore::ContentSecurityPolicy::setUpgradeInsecureRequests): (WebCore::ContentSecurityPolicy::takeNavigationRequestsToUpgrade): (WebCore::ContentSecurityPolicy::setInsecureNavigationRequestsToUpgrade): * page/csp/ContentSecurityPolicy.h: 2018-03-27 Daniel Bates <dabates@apple.com> Attempt to fix media control layout tests after <https://trac.webkit.org/changeset/230006/> (https://bugs.webkit.org/show_bug.cgi?id=179983) Exempt elements in user agent shadow DOM from having to perform a potentially CORS- enabled fetch for a mask image to try to fix the following tests from timing out: media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-inline.html media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html * style/StylePendingResources.cpp: (WebCore::Style::loadPendingImage): 2018-03-27 Per Arne Vollan <pvollan@apple.com> The layout test fast/canvas/webgl/read-pixels-test.html is timing out. https://bugs.webkit.org/show_bug.cgi?id=183923 <rdar://problem/38756869> Reviewed by Brent Fulgham. The test is timing out when we do not interact directly with the WindowServer, causing OpenGL to fall back to software rendering. In this mode, any call to CGLChoosePixelFormat requesting an accelerated pixel format will fail because it cannot determine which GPU is connected to the display. OpenGL treats all GPUs as if they were offline when used in a process (like the WebContent process) that does not directly control the display. We can get correct behavior if we tell OpenGL which GPU is currently connected to the display, and if we instruct CGLChoosePixelFormat to create an offline renderer pixel format by including the 'kCGLPFAAllowOfflineRenderers' flag in its arguments. We can use CGLSetVirtualScreen with an OpenGL display mask that tells the OpenGL framework which GPU it should use. See https://developer.apple.com/library/content/technotes/tn2229/_index.html#//apple_ref/doc/uid/DTS40008924-CH1-SUBSECTION7 for details on how the virtual screen is found from the OpenGL display mask. No new tests, covered by existing tests. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/GraphicsContext3D.h: * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::setPixelFormat): (WebCore::identifyAndSetCurrentGPU): (WebCore::GraphicsContext3D::GraphicsContext3D): (WebCore::GraphicsContext3D::setOpenGLDisplayMask): (WebCore::GraphicsContext3D::allowOfflineRenderers): 2018-03-27 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Implement authenticatorGetAssertion https://bugs.webkit.org/show_bug.cgi?id=183881 <rdar://problem/37258628> Reviewed by Brent Fulgham. This patch does the following few things: 1) It implements the spec: https://www.w3.org/TR/webauthn/#op-get-assertion as of 5 December 2017. 2) It tweaks encoding/decoding of PublicKeyCredentialRequestOptions such that options can be passed between UI and Web processes. 3) It refines the way how LocalAuthenticator::makeCredential find intersection between excludeCredentialDescriptorList and existing credentials in the authenticator, such that it is faster. Basically, it takes the CredentialID from the list and treat it as an ASCII string and put it into a HashSet<String>. It should not matter if a duplicated CredentialID is added. If the hash set is not empty, the algorithm then queries Keychain for all CredentialIDs related to the current RP ID once. For every queried CredentialID, the algorithm then treats it as an ASCII string as well and look for a match in the hash set to produce the intersetction. The new way is also employed in LocalAuthenticator::getAssertion as well. 4) It abstracts the way to produce authData and thus reorders a bit of code in LocalAuthenticator::makeCredential. Covered by API tests. * Modules/webauthn/AuthenticatorManager.cpp: (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * Modules/webauthn/PublicKeyCredentialRequestOptions.h: (WebCore::PublicKeyCredentialRequestOptions::encode const): (WebCore::PublicKeyCredentialRequestOptions::decode): * Modules/webauthn/cocoa/LocalAuthenticator.h: * Modules/webauthn/cocoa/LocalAuthenticator.mm: (WebCore::LocalAuthenticatorInternal::buildAuthData): (WebCore::LocalAuthenticatorInternal::produceHashSet): (WebCore::LocalAuthenticator::makeCredential): (WebCore::LocalAuthenticator::getAssertion): (WebCore::LocalAuthenticator::issueClientCertificate const): * WebCore.xcodeproj/project.pbxproj: 2018-03-27 Chris Dumez <cdumez@apple.com> Avoid constructing SecurityOrigin objects from non-main threads https://bugs.webkit.org/show_bug.cgi?id=184024 Reviewed by Youenn Fablet. Avoid constructing SecurityOrigin objects from non-main threads as much as possible as it is not safe. This patch gets rid of most offending cases but not all of them yet, which is why I haven't added a ASSERT(isMainThread()) to the SecurityOrigin constructor yet. For example, ContentSecurityPolicy::upgradeInsecureRequestIfNeeded() currently gets called from non-main threads and construct a SecurityOrigin. Fixing this will require some refactoring that would have made this patch much larger. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::matchRegistration): * page/EventSource.cpp: (WebCore::EventSource::didReceiveResponse): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::isPotentiallyTrustworthy const): * testing/Internals.cpp: (WebCore::Internals::hasServiceWorkerRegistration): * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::create): (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope): * workers/DedicatedWorkerGlobalScope.h: * workers/DedicatedWorkerThread.cpp: (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): * workers/DedicatedWorkerThread.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: * workers/WorkerLocation.cpp: (WebCore::WorkerLocation::origin const): * workers/WorkerThread.cpp: (WebCore::WorkerThreadStartupData::WorkerThreadStartupData): (WebCore::WorkerThread::workerThread): * workers/WorkerThread.h: * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::getRegistration): (WebCore::ServiceWorkerContainer::getRegistrations): * workers/service/ServiceWorkerGlobalScope.cpp: (WebCore::ServiceWorkerGlobalScope::create): (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope): * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerProvider.cpp: (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin): * workers/service/ServiceWorkerProvider.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::createWorkerGlobalScope): (WebCore::fireMessageEvent): (WebCore::ServiceWorkerThread::postMessageToServiceWorker): * workers/service/context/ServiceWorkerThread.h: 2018-03-27 Alex Christensen <achristensen@webkit.org> Remove unused libsoup ResourceHandle implementation https://bugs.webkit.org/show_bug.cgi?id=184048 Reviewed by Michael Catanzaro. This code is unused since r228901 so let's remove it! * platform/network/ResourceHandle.h: * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::ResourceHandle::~ResourceHandle): (WebCore::ResourceHandleInternal::soupSession): (WebCore::ResourceHandle::cancelledOrClientless): (WebCore::ResourceHandle::ensureReadBuffer): (WebCore::ResourceHandle::currentStreamPosition const): (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse): (WebCore::ResourceHandle::didStartRequest): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::releaseForDownload): (WebCore::ResourceHandle::sendPendingRequest): (WebCore::ResourceHandle::cancel): (WebCore::ResourceHandle::shouldUseCredentialStorage): (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::receivedCancellation): (WebCore::ResourceHandle::receivedChallengeRejection): (WebCore::ResourceHandle::platformSetDefersLoading): (WebCore::sessionFromContext): Deleted. (WebCore::ResourceHandle::create): Deleted. (WebCore::ResourceHandle::ResourceHandle): Deleted. (WebCore::isAuthenticationFailureStatusCode): Deleted. (WebCore::tlsErrorsChangedCallback): Deleted. (WebCore::gotHeadersCallback): Deleted. (WebCore::applyAuthenticationToRequest): Deleted. (WebCore::restartedCallback): Deleted. (WebCore::shouldRedirect): Deleted. (WebCore::shouldRedirectAsGET): Deleted. (WebCore::continueAfterWillSendRequest): Deleted. (WebCore::doRedirect): Deleted. (WebCore::redirectSkipCallback): Deleted. (WebCore::wroteBodyDataCallback): Deleted. (WebCore::cleanupSoupRequestOperation): Deleted. (WebCore::nextMultipartResponsePartCallback): Deleted. (WebCore::sendRequestCallback): Deleted. (WebCore::continueAfterDidReceiveResponse): Deleted. (WebCore::startingCallback): Deleted. (WebCore::networkEventCallback): Deleted. (WebCore::createSoupMessageForHandleAndRequest): Deleted. (WebCore::createSoupRequestAndMessageForHandle): Deleted. (WebCore::ResourceHandle::timeoutFired): Deleted. (WebCore::waitingToSendRequest): Deleted. (WebCore::readCallback): Deleted. 2018-03-27 Chris Dumez <cdumez@apple.com> Move online state detection from the WebProcess to the NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=183989 <rdar://problem/37093299> Reviewed by Youenn Fablet. Move online state detection from the WebProcess to the NetworkProcess. This avoid executing the same (expensive) code in EACH web process whenever a network interface's state changes. Now, the Network Process monitors network interfaces and determines the online state whenever an interface's state changes. If the onLine state changes, it notifies all its connected WebProcesses via IPC. * inspector/agents/InspectorApplicationCacheAgent.cpp: (WebCore::InspectorApplicationCacheAgent::networkStateChanged): * loader/LoaderStrategy.h: * page/Navigator.cpp: (WebCore::Navigator::onLine const): * page/Page.cpp: * platform/network/NetworkStateNotifier.h: * workers/Worker.cpp: (WebCore::Worker::Worker): (WebCore::Worker::notifyFinished): * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy): 2018-03-27 Daniel Bates <dabates@apple.com> CSS mask images should be retrieved using potentially CORS-enabled fetch https://bugs.webkit.org/show_bug.cgi?id=179983 <rdar://problem/35678149> Reviewed by Brent Fulgham. As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor’s Draft, 23 December 2017) we should fetch CSS mask images using a potentially CORS-enabled fetch. Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing attacks that can be used to reveal their pixel data when retrieved without regard to CORS. For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more closely align with the behavior in the spec. Test: http/tests/security/css-mask-image.html * page/Settings.yaml: Add a setting for toggle "Anonymous" mode fetching of mask images (defaults: true). We need this setting to avoid breaking the developer convenience feature that some modern media controls layout tests employ to load assets from the filesystem as opposed to using the hardcoded data URLs baked into the WebKit binary. * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs. (WebCore::Style::loadPendingImage): Ditto. (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching a mask image or shape-outside image. 2018-03-27 Zalan Bujtas <zalan@apple.com> RenderBox::parent/firstChild/nextSibling/previousSiblingBox() functions should type check. https://bugs.webkit.org/show_bug.cgi?id=184032 <rdar://problem/38384984> Reviewed by Antti Koivisto. We cannot rely on the correctness of the render tree structure when querying for parent/child/next and previous sibling since some features (multicolumn/spanners) move subtrees out of their original position (which is highly undesired and should not be encouraged at all though). It should also be noted that these functions are not equivalent of typeOfChildren<RenderBox> and the following usage for (auto* boxChild = firstChildBox(); boxChild; boxChild = boxChild->nextSiblingBox()) can lead to unexpected result. Test: fast/multicol/parent-box-when-spanner-is-present.html * rendering/RenderBox.h: (WebCore::RenderBox::parentBox const): (WebCore::RenderBox::firstChildBox const): (WebCore::RenderBox::lastChildBox const): (WebCore::RenderBox::previousSiblingBox const): (WebCore::RenderBox::nextSiblingBox const): * rendering/RenderListItem.cpp: (WebCore::RenderListItem::positionListMarker): * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::layout): * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::updateLogicalWidth): 2018-03-27 Brent Fulgham <bfulgham@apple.com> Further refine cookie read/write logging https://bugs.webkit.org/show_bug.cgi?id=184044 <rdar://problem/38915610> Reviewed by Chris Dumez. Export 'shouldBlockCookies' so that it can be accessed by the WebKit framework. * platform/network/NetworkStorageSession.h: 2018-03-27 Antoine Quint <graouts@apple.com> [Web Animations] Stop using internals.pauseAnimationAtTimeOnElement() in favor of Web Animations API for animations tests https://bugs.webkit.org/show_bug.cgi?id=184038 Reviewed by Dean Jackson. Expose a new method to indicate that the runtime flag for CSS Animations and CSS Transitions as Web Animations is enabled. * testing/InternalSettings.cpp: (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2018-03-27 Thibault Saunier <tsaunier@igalia.com> [GStreamer] Enhance debugging in the BasePlayer https://bugs.webkit.org/show_bug.cgi?id=184035 Reviewed by Philippe Normand. No behaviour changes so no test were added/enabled. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const): (WebCore::MediaPlayerPrivateGStreamerBase::setVolume): (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback): (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): (WebCore::MediaPlayerPrivateGStreamerBase::muted const): (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached): (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached): (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey): (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent): 2018-03-27 Eric Carlson <eric.carlson@apple.com> Make AVFoundationEnabled preference available on iOS https://bugs.webkit.org/show_bug.cgi?id=183876 <rdar://problem/38726459> Reviewed by Youenn Fablet. Test: AVFoundationPref API test. * html/HTMLAudioElement.idl: There is no need for a runtime setting to enable/disable audio, there is already settings.mediaEnabled. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::prepareForLoad): Fail if there are no media engines registered. (WebCore::HTMLMediaElement::noneSupported): Return early if m_error has already been set. (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Remove a typo. * page/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::audioEnabled const): Deleted. * page/RuntimeEnabledFeatures.h: 2018-03-27 Fujii Hironori <Hironori.Fujii@sony.com> [GTK] Layout test editing/deleting/delete-surrogatepair.html crashing with CRITICAL **: enchant_dict_check: assertion 'g_utf8_validate(word, len, NULL)' failed https://bugs.webkit.org/show_bug.cgi?id=176799 Reviewed by Carlos Garcia Campos. The length of a surrogate-pair UTF-16 character is 2 even though the number of characters is 1. An incorrect string length was passed to enchant_dict_check if the string contains a surrogate-pair character because the length was calculated by applying UTF-16 character position to UTF-8 string. No new tests (Covered by existing tests). * platform/text/enchant/TextCheckerEnchant.cpp: (WebCore::TextCheckerEnchant::checkSpellingOfWord): Changed the type of an argument `word` from CString to String. Convert a substring of the argument into UTF-8. (WebCore::TextCheckerEnchant::checkSpellingOfString): Pass the original UTF-16 string to checkSpellingOfWord instead of a converted UTF-8 string. * platform/text/enchant/TextCheckerEnchant.h: Changed the type of an argument `word` from CString to String. 2018-03-26 Ms2ger <Ms2ger@igalia.com> Remove an unnecessary const_cast from BitmapTextureGL::updateContents(). https://bugs.webkit.org/show_bug.cgi?id=184007 Reviewed by Žan Doberšek. No new tests. * platform/graphics/texmap/BitmapTextureGL.cpp: (WebCore::BitmapTextureGL::updateContents): 2018-03-23 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-animations/test_animation-currenttime.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183819 Reviewed by Dean Jackson. The current time for a CSS Animation exposed via the API should be clamped between 0 and the animation duration. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::bindingsCurrentTime const): * animation/CSSAnimation.h: * animation/WebAnimation.h: 2018-03-23 Antoine Quint <graouts@apple.com> [Web Animations] Correctly handle timing functions specified by CSS Animations and CSS Transitions https://bugs.webkit.org/show_bug.cgi?id=183935 Reviewed by Dean Jackson. We were incorrectly reflecting the animation-timing-function and transition-timing-function values on the generated DeclarativeAnimation effect timing "easing" property. In fact, those values should only be represented on the keyframes. In the case of a CSS Animation, the animation-timing-function property set on the element's style serves as the default value used for all keyframes, and individual keyframes can specify an overriding animation-timing-function. For a CSS Transition, the transition-timing-function property set on the element's style serves as the timing function of the from keyframe. To correctly reflect this, we provide a new timingFunctionForKeyframeAtIndex() function on KeyframeEffectReadOnly which will return the right TimingFunction object at a given index, regardless of the animation type. In the case of getKeyframes(), we manually return "linear" for the "to" keyframe since timingFunctionForKeyframeAtIndex() would otherwise return the same timing function as the "from" keyframe. This avoids creating an extra LinearTimingFunction object. As a result, a number of Mozilla imported tests progress since we have correct information on the "easing" property of objects returned by getKeyframes() and the "progress" reported by getComputedTiming() now always uses a linear timing function. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): The timing function of the backing Animation should not be reflected on the effect's timing object. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::getKeyframes): Return the correct timing function for a keyframe, and use a "linear" value for the "to" keyframe of a CSS Transition. (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex): * animation/KeyframeEffectReadOnly.h: 2018-03-26 Chris Dumez <cdumez@apple.com> Use SecurityOriginData more consistently in Service Worker code https://bugs.webkit.org/show_bug.cgi?id=183969 Reviewed by Darin Adler. Use SecurityOriginData more consistently in Service Worker code to avoid constructing SecurityOrigin objects unnecessarily. I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily in some cases as callers can now use SecurityOrigin::data() instead of SecurityOriginData::fromSecurityOrigin(). No new tests, no Web-facing behavior change. * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::origin const): * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::storageDirectory const): * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::mediaKeysStorageDirectory const): * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const): * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::openInternal): (WebCore::IDBFactory::deleteDatabase): * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames): * Modules/webdatabase/Database.cpp: (WebCore::Database::securityOrigin): * Modules/webdatabase/DatabaseContext.cpp: (WebCore::DatabaseContext::securityOrigin const): * Modules/webdatabase/DatabaseContext.h: * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::fullPathForDatabase): (WebCore::DatabaseManager::detailsForNameAndOrigin): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const): * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::findStorageArea): * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): (WebCore::ApplicationCacheStorage::calculateUsageForOrigin): (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): (WebCore::ApplicationCacheStorage::store): (WebCore::ApplicationCacheStorage::ensureOriginRecord): * page/DOMWindow.cpp: (WebCore:: const): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isPotentiallyTrustworthy const): (WebCore::SecurityOrigin::canAccess const): (WebCore::SecurityOrigin::canDisplay const): (WebCore::SecurityOrigin::domainForCachePartition const): (WebCore::SecurityOrigin::isLocal const): (WebCore::SecurityOrigin::toString const): (WebCore::SecurityOrigin::toRawString const): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::isSameSchemeHostPort const): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::protocol const): (WebCore::SecurityOrigin::host const): (WebCore::SecurityOrigin::port const): (WebCore::SecurityOrigin::data const): (WebCore::SecurityOrigin::isHTTPFamily const): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::toString const): (WebCore::SecurityOriginData::fromFrame): * page/SecurityOriginData.h: (WebCore::SecurityOriginData::fromURL): * storage/StorageNamespaceProvider.cpp: (WebCore::StorageNamespaceProvider::localStorageArea): * testing/Internals.cpp: (WebCore::Internals::clearCacheStorageMemoryRepresentation): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::removeRegistration): (WebCore::ServiceWorkerContainer::updateRegistration): * workers/service/ServiceWorkerRegistrationKey.cpp: (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const): * workers/service/ServiceWorkerRegistrationKey.h: * workers/service/server/SWOriginStore.cpp: (WebCore::SWOriginStore::add): (WebCore::SWOriginStore::remove): (WebCore::SWOriginStore::clear): * workers/service/server/SWOriginStore.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistration): (WebCore::SWServer::removeRegistration): (WebCore::SWServer::clear): (WebCore::SWServer::tryInstallContextData): (WebCore::SWServer::serverToContextConnectionCreated): (WebCore::SWServer::markAllWorkersForOriginAsTerminated): (WebCore::SWServer::unregisterServiceWorkerClient): (WebCore::SWServer::needsServerToContextConnectionForOrigin const): * workers/service/server/SWServer.h: * workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::SWServerToContextConnection): (WebCore::SWServerToContextConnection::~SWServerToContextConnection): (WebCore::SWServerToContextConnection::connectionForOrigin): * workers/service/server/SWServerToContextConnection.h: (WebCore::SWServerToContextConnection::securityOrigin const): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::origin const): (WebCore::SWServerWorker::securityOrigin const): * workers/service/server/SWServerWorker.h: 2018-03-26 Brent Fulgham <bfulgham@apple.com> Warn against cookie access in the WebContent process using ProcessPrivilege assertions https://bugs.webkit.org/show_bug.cgi?id=183911 <rdar://problem/38762306> Reviewed by Youenn Fablet. Add a set of ProcessPrivilege assertions to enforce the rule that the WebContent process should never call Cookie API directly. That should only happen in the Networking or UIProcess. Add a new static flag to NetworkStorageSession that indicates if the current process has permission to interact with the Cookie API. No new tests since there is no change in behavior. * platform/network/NetworkStorageSession.cpp: (WebCore::NetworkStorageSession::NetworkStorageSession): (WebCore::NetworkStorageSession::processMayUseCookieAPI): Added. (WebCore::NetworkStorageSession::permitProcessToUseCookieAPI): Added. This also adds the appropriate flag to the ProcessPrivileges data for the current process. * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::createCFStorageSessionForIdentifier): Do not create cookie storage if the current process is prohibited from interacting with the Cookie API. (WebCore::NetworkStorageSession::NetworkStorageSession): Add assertions. (WebCore::NetworkStorageSession::switchToNewTestingSession): Do not create cookie storage if the current process is prohibited from interacting with the Cookie API. (WebCore::NetworkStorageSession::defaultStorageSession): Ditto. (WebCore::NetworkStorageSession::ensureSession): Ditto. (WebCore::NetworkStorageSession::cookieStorage const): Ditto. * platform/network/cocoa/CookieStorageObserver.mm: (WebCore::CookieStorageObserver::CookieStorageObserver): Assert if accessed from untrusted process. (WebCore::CookieStorageObserver::startObserving): Ditto. (WebCore::CookieStorageObserver::stopObserving): Ditto. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::setCookie): (WebCore::NetworkStorageSession::setCookies): (WebCore::NetworkStorageSession::deleteCookie): (WebCore::nsCookiesToCookieVector): (WebCore::NetworkStorageSession::getAllCookies): (WebCore::NetworkStorageSession::getCookies): (WebCore::NetworkStorageSession::flushCookieStore): (WebCore::NetworkStorageSession::nsCookieStorage const): (WebCore::createPrivateStorageSession): * platform/network/mac/CookieJarMac.mm: (WebCore::httpCookies): (WebCore::deleteHTTPCookie): (WebCore::httpCookiesForURL): (WebCore::filterCookies): (WebCore::applyPartitionToCookies): (WebCore::cookiesInPartitionForURL): (WebCore::cookiesForSession): (WebCore::setHTTPCookiesForURL): (WebCore::deleteAllHTTPCookies): (WebCore::setCookiesFromDOM): (WebCore::httpCookieAcceptPolicy): (WebCore::deleteCookie): (WebCore::deleteCookiesForHostnames): (WebCore::deleteAllCookiesModifiedSince): 2018-03-26 Alex Christensen <achristensen@webkit.org> Merge ResourceHandleClient::willCacheResponseAsync with ResourceHandleClient::willCacheResponse https://bugs.webkit.org/show_bug.cgi?id=183965 Reviewed by Chris Dumez. It turns out that ResourceHandleClient::willCacheResponseAsync didn't do anything and the logic in ResourceHandleClient::willCacheResponse was not being called. This makes it so there is one code path and it executes the logic in ResourceHandleClient::willCacheResponse. * loader/EmptyFrameLoaderClient.h: * loader/FrameLoaderClient.h: * loader/ResourceLoader.h: * loader/SubresourceLoader.h: * loader/cocoa/SubresourceLoaderCocoa.mm: (WebCore::SubresourceLoader::willCacheResponseAsync): (WebCore::SubresourceLoader::willCacheResponse): Deleted. * loader/mac/ResourceLoaderMac.mm: (WebCore::ResourceLoader::willCacheResponseAsync): (WebCore::ResourceLoader::willCacheResponse): Deleted. * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.cpp: (WebCore::ResourceHandleClient::willCacheResponseAsync): Deleted. * platform/network/ResourceHandleClient.h: (WebCore::ResourceHandleClient::willCacheResponseAsync): (WebCore::ResourceHandleClient::shouldCacheResponse): (WebCore::ResourceHandleClient::willCacheResponse): Deleted. * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::ResourceHandle::continueWillCacheResponse): Deleted. * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse): Deleted. * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::continueWillCacheResponse): Deleted. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate continueWillCacheResponse:]): Deleted. 2018-03-26 Miguel Gomez <magomez@igalia.com> [GTK][WPE] Upload correct buffer in BitmapTextureGL::updateContents() https://bugs.webkit.org/show_bug.cgi?id=184004 Reviewed by Žan Doberšek. Do not upload the original buffer. Upload the result of creating a subImage buffer if it was required. Covered by existent tests. * platform/graphics/texmap/BitmapTextureGL.cpp: (WebCore::BitmapTextureGL::updateContents): 2018-03-25 Zan Dobersek <zdobersek@igalia.com> [TexMap] Clean up TextureMapperPlatformLayer, TextureMapperBackingStore code https://bugs.webkit.org/show_bug.cgi?id=183985 Reviewed by Michael Catanzaro. Clean up TextureMapperPlatformLayer and TextureMapperBackingStore headers and implementation files. Remove dubious whitespace, use #pragma once, clean up constructors, destructors, method definitions and remove unnecessary includes in favor of forward declarations where possible. The TextureMapperPlatformLayer::swapBuffers() method is removed as it wasn't called or overridden anywhere. No new tests -- no change in functionality. * platform/graphics/texmap/TextureMapperBackingStore.cpp: * platform/graphics/texmap/TextureMapperBackingStore.h: (WebCore::TextureMapperBackingStore::drawRepaintCounter): * platform/graphics/texmap/TextureMapperPlatformLayer.h: (WebCore::TextureMapperPlatformLayer::setClient): (WebCore::TextureMapperPlatformLayer::TextureMapperPlatformLayer): Deleted. (WebCore::TextureMapperPlatformLayer::swapBuffers): Deleted. 2018-03-25 Dan Bernstein <mitz@apple.com> [Xcode] Remove workaround only needed for deploying to iOS 10.0 and earlier https://bugs.webkit.org/show_bug.cgi?id=183999 Reviewed by Sam Weinig. * Configurations/WebCore.xcconfig: Removed build settings. * Configurations/WebCoreTestSupport.xcconfig: Removed location of phony WebKitLegacy from frameworks search path. * Configurations/WebKitLegacyStub.iOS.tbd: Removed. * WebCore.xcodeproj/project.pbxproj: Removed script build phase from the Derived Sources target. 2018-03-25 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229954. https://bugs.webkit.org/show_bug.cgi?id=184000 Caused many layout tests to crash on Apple High Sierra, Sierra, iOS Simulator and GTK Linux Debug test bots (Requested by dydz on #webkit). Reverted changeset: "Use SecurityOriginData more consistently in Service Worker code" https://bugs.webkit.org/show_bug.cgi?id=183969 https://trac.webkit.org/changeset/229954 2018-03-23 Alex Christensen <achristensen@webkit.org> Use completion handlers for ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync https://bugs.webkit.org/show_bug.cgi?id=183966 Reviewed by Chris Dumez. No change in behavior. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): * loader/ResourceLoader.h: * platform/network/BlobResourceHandle.cpp: * platform/network/PingHandle.h: * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/SynchronousLoaderClient.cpp: (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync): * platform/network/SynchronousLoaderClient.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace): * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace): (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace): Deleted. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate continueCanAuthenticateAgainstProtectionSpace:]): Deleted. 2018-03-24 Chris Dumez <cdumez@apple.com> Use SecurityOriginData more consistently in Service Worker code https://bugs.webkit.org/show_bug.cgi?id=183969 Reviewed by Darin Adler. Use SecurityOriginData more consistently in Service Worker code to avoid constructing SecurityOrigin objects unnecessarily. I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily in some cases as callers can now use SecurityOrigin::data() instead of SecurityOriginData::fromSecurityOrigin(). No new tests, no Web-facing behavior change. * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::origin const): * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::storageDirectory const): * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::mediaKeysStorageDirectory const): * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const): * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::openInternal): (WebCore::IDBFactory::deleteDatabase): * Modules/indexeddb/client/IDBConnectionToServer.cpp: (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames): * Modules/webdatabase/Database.cpp: (WebCore::Database::securityOrigin): * Modules/webdatabase/DatabaseContext.cpp: (WebCore::DatabaseContext::securityOrigin const): * Modules/webdatabase/DatabaseContext.h: * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::fullPathForDatabase): (WebCore::DatabaseManager::detailsForNameAndOrigin): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const): * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::findStorageArea): * loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): (WebCore::ApplicationCacheStorage::calculateUsageForOrigin): (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): (WebCore::ApplicationCacheStorage::store): (WebCore::ApplicationCacheStorage::ensureOriginRecord): * page/DOMWindow.cpp: (WebCore:: const): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): (WebCore::SecurityOrigin::isPotentiallyTrustworthy const): (WebCore::SecurityOrigin::canAccess const): (WebCore::SecurityOrigin::canDisplay const): (WebCore::SecurityOrigin::domainForCachePartition const): (WebCore::SecurityOrigin::isLocal const): (WebCore::SecurityOrigin::toString const): (WebCore::SecurityOrigin::toRawString const): (WebCore::SecurityOrigin::create): (WebCore::SecurityOrigin::isSameSchemeHostPort const): * page/SecurityOrigin.h: (WebCore::SecurityOrigin::protocol const): (WebCore::SecurityOrigin::host const): (WebCore::SecurityOrigin::port const): (WebCore::SecurityOrigin::data const): (WebCore::SecurityOrigin::isHTTPFamily const): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::toString const): (WebCore::SecurityOriginData::fromFrame): * page/SecurityOriginData.h: (WebCore::SecurityOriginData::fromURL): * storage/StorageNamespaceProvider.cpp: (WebCore::StorageNamespaceProvider::localStorageArea): * testing/Internals.cpp: (WebCore::Internals::clearCacheStorageMemoryRepresentation): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::removeRegistration): (WebCore::ServiceWorkerContainer::updateRegistration): * workers/service/ServiceWorkerRegistrationKey.cpp: (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const): * workers/service/ServiceWorkerRegistrationKey.h: * workers/service/server/SWOriginStore.cpp: (WebCore::SWOriginStore::add): (WebCore::SWOriginStore::remove): (WebCore::SWOriginStore::clear): * workers/service/server/SWOriginStore.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistration): (WebCore::SWServer::removeRegistration): (WebCore::SWServer::clear): (WebCore::SWServer::tryInstallContextData): (WebCore::SWServer::serverToContextConnectionCreated): (WebCore::SWServer::markAllWorkersForOriginAsTerminated): (WebCore::SWServer::unregisterServiceWorkerClient): (WebCore::SWServer::needsServerToContextConnectionForOrigin const): * workers/service/server/SWServer.h: * workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::SWServerToContextConnection): (WebCore::SWServerToContextConnection::~SWServerToContextConnection): (WebCore::SWServerToContextConnection::connectionForOrigin): * workers/service/server/SWServerToContextConnection.h: (WebCore::SWServerToContextConnection::securityOrigin const): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::origin const): (WebCore::SWServerWorker::securityOrigin const): * workers/service/server/SWServerWorker.h: 2018-03-24 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229792. https://bugs.webkit.org/show_bug.cgi?id=183980 not actually necessary (Requested by thorton on #webkit). Reverted changeset: "Fix the build" https://trac.webkit.org/changeset/229792 2018-03-23 Tim Horton <timothy_horton@apple.com> Fix the geolocation build https://bugs.webkit.org/show_bug.cgi?id=183975 * Modules/geolocation/ios/GeolocationPositionIOS.mm: (WebCore::GeolocationPosition::GeolocationPosition): 2018-03-23 Tim Horton <timothy_horton@apple.com> Fix the build with no pasteboard https://bugs.webkit.org/show_bug.cgi?id=183973 Reviewed by Dan Bernstein. * Configurations/FeatureDefines.xcconfig: * platform/ios/PlatformPasteboardIOS.mm: 2018-03-23 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Fix some localizable strings after r229878 https://bugs.webkit.org/show_bug.cgi?id=183963 Reviewed by Tim Horton. The WEB_UI_STRING macro was incorrectly used for certain localized strings pertaining to extra zoom mode. To correct this, make the "Done" string use WEB_UI_STRING with actual UI-facing text; since day, year and month labels in the date picker are less generalizable to other UI, leave these as unique keys, but change them to use WEB_UI_STRING_KEY instead. Additionally, remove now-unused localizable strings for the text input view controller. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::formControlDoneButtonTitle): (WebCore::datePickerDayLabelTitle): (WebCore::datePickerMonthLabelTitle): (WebCore::datePickerYearLabelTitle): 2018-03-23 Chris Dumez <cdumez@apple.com> NetworkStateNotifier::updateStateWithoutNotifying() is inefficient https://bugs.webkit.org/show_bug.cgi?id=183760 <rdar://problem/37093299> Reviewed by Ryosuke Niwa. Update NetworkStateNotifier::updateStateWithoutNotifying() to stop calling SCDynamicStoreCopyKeyList(). SCDynamicStoreCopyKeyList() is expensive as it expects its key parameter to be a regular expression and it can match several keys. It is also unnecessary in our case since we already have an exact key. We now call the more efficient SCDynamicStoreCopyValue() instead, which is the right thing to call when we have an exact key. This change was suggested by the SC team. This was tested manually as there is no easy way to write an automated test for this. In a follow-up, I also plan to call this code in the UIProcess (or NetworkProcess) to avoid calling it once per WebProcess. * platform/network/mac/NetworkStateNotifierMac.cpp: (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): 2018-03-23 Daniel Bates <dabates@apple.com> Unreviewed, rolling out r229868. Caused media controls tests to timeout. Will investigate offline. Reverted changeset: "CSS mask images should be retrieved using potentially CORS- enabled fetch" https://bugs.webkit.org/show_bug.cgi?id=179983 https://trac.webkit.org/changeset/229868 2018-03-23 Mark Lam <mark.lam@apple.com> Add pointer profiling hooks to the CSS JIT. https://bugs.webkit.org/show_bug.cgi?id=183947 <rdar://problem/38803593> Reviewed by JF Bastien. No new tests needed. Covered by existing tests. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): - Added a missing application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(). * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::toJSNewlyCreated): * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::ruleMatches): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::compile): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker): * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const): (WebCore::SelectorDataList::execute const): 2018-03-23 Sihui Liu <sihui_liu@apple.com> Local storage getItem() for an empty string returned UNDEFINED value. https://bugs.webkit.org/show_bug.cgi?id=69138 <rdar://problem/13410974> Reviewed by Brady Eidson. * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::getColumnBlobAsString): 2018-03-23 Chris Dumez <cdumez@apple.com> Promptly terminate service worker processes when they are no longer needed https://bugs.webkit.org/show_bug.cgi?id=183873 <rdar://problem/38676995> Reviewed by Youenn Fablet. The StorageProcess now keeps track of service worker clients for each security origin. When there is no longer any clients for a given security origin, the StorageProcess asks the service worker process for the given origin to terminate and severs its connection to it. Change is covered by API test. * workers/service/server/SWServer.cpp: (WebCore::SWServer::markAllWorkersForOriginAsTerminated): Pass the security origin since this is called when a service worker process crashes. When a service worker process for origin A crashes, we only want to mark service workers in origin A as terminated, not ALL of them. (WebCore::SWServer::registerServiceWorkerClient): (WebCore::SWServer::unregisterServiceWorkerClient): (WebCore::SWServer::needsServerToContextConnectionForOrigin const): Tweak logic so that we only relaunch a service worker process if we still have clients for its security origin. * workers/service/server/SWServer.h: (WebCore::SWServer::disableServiceWorkerProcessTerminationDelay): Add a way to disable the service worker termination delay to facilitate testing. * workers/service/server/SWServerToContextConnection.h: 2018-03-23 Brady Eidson <beidson@apple.com> Go to back/forward list items after a process-swapped navigation. <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920 Reviewed by Andy Estes. Covered by new API test. Most of the changes to WebCore are teaching HistoryItem navigations to know when they should do a policy check or not. * WebCore.xcodeproj/project.pbxproj: * history/BackForwardController.cpp: (WebCore::BackForwardController::goBackOrForward): (WebCore::BackForwardController::goBack): (WebCore::BackForwardController::goForward): * history/HistoryItem.cpp: (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess. This was a long standing bug that made it difficult to effectively test this change. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadDifferentDocumentItem): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: * loader/HistoryController.cpp: (WebCore::HistoryController::goToItem): (WebCore::HistoryController::setDefersLoading): (WebCore::HistoryController::recursiveGoToItem): * loader/HistoryController.h: * loader/NavigationPolicyCheck.h: * page/Page.cpp: (WebCore::Page::goToItem): * page/Page.h: 2018-03-23 John Wilander <wilander@apple.com> Resource Load Statistics: Fix decoder key isPrevalentResource->isVeryPrevalentResource https://bugs.webkit.org/show_bug.cgi?id=183950 <rdar://problem/38806275> Reviewed by Brent Fulgham. * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::decode): Now isVeryPrevalentResource is decoded to the correct field. 2018-03-23 Youenn Fablet <youenn@apple.com> WebProcessPool should not ask to register all clients for each service worker process creation https://bugs.webkit.org/show_bug.cgi?id=183941 Reviewed by Chris Dumez. Covered by existing unit tests. Register all Documents of a process no matter its session ID when asked to. Make sure that whenever a WebProcess is asked to do so, any further Document will be registered by calling setMayHaveRegisteredServiceWorkers(). This ensures that a WebProcess created before any service worker but empty at the time a service worker is created will actually register all its future clients. Add some assertions to ensure that a client is not registered twice. * workers/service/ServiceWorkerProvider.cpp: (WebCore::ServiceWorkerProvider::registerServiceWorkerClients): * workers/service/ServiceWorkerProvider.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::registerServiceWorkerClient): 2018-03-23 Eric Carlson <eric.carlson@apple.com> HTMLElement factory doesn't need to call MediaPlayer::isAvailable https://bugs.webkit.org/show_bug.cgi?id=183946 <rdar://problem/38802687> Reviewed by Youenn Fablet. Test: media/media-disabled.html * dom/make_names.pl: (printConstructorInterior): * page/Settings.yaml: * page/SettingsDefaultValues.h: 2018-03-23 David Kilzer <ddkilzer@apple.com> Stop using dispatch_set_target_queue() <https://webkit.org/b/183908> <rdar://problem/33553533> Reviewed by Daniel Bates. No new tests since no change in behavior. * platform/mediastream/mac/AVMediaCaptureSource.mm: (WebCore::globaVideoCaptureSerialQueue): Remove use of dispatch_set_target_queue() by changing dispatch_queue_create() to dispatch_queue_create_with_target(). 2018-03-23 Youenn Fablet <youenn@apple.com> Use libwebrtc ObjectiveC H264 encoder and decoder https://bugs.webkit.org/show_bug.cgi?id=183912 Reviewed by Eric Carlson. No observable change of behavior. Made use of libwebrtc WebKit utilities. Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame. * Configurations/WebCore.xcconfig: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa): (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed): (WebCore::LibWebRTCProviderCocoa::createDecoderFactory): (WebCore::LibWebRTCProviderCocoa::createEncoderFactory): (WebCore::LibWebRTCProviderCocoa::setActive): * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp. (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame): (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame): * testing/Internals.cpp: Removed commented out include. 2018-03-23 Youenn Fablet <youenn@apple.com> DocumentThreadableLoader should send credentials after redirections and preflight if fetch option credentials is include https://bugs.webkit.org/show_bug.cgi?id=183928 Reviewed by Chris Dumez. Tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.html imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.worker.html In case mode is include, keep sending credentials even after redirection with preflight. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): 2018-03-23 Tim Horton <timothy_horton@apple.com> Fix the build after r229858 * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: 2018-03-23 Youenn Fablet <youenn@apple.com> Allow fully whitelisted plug-ins to match non HTTP URLs https://bugs.webkit.org/show_bug.cgi?id=183938 rdar://problem/38534312 Reviewed by Chris Dumez. Covered by manual testing and unit testing. * platform/URL.cpp: (WebCore::URL::isMatchingDomain const): 2018-03-23 Youenn Fablet <youenn@apple.com> ActiveDOMObject should assert that they are destroyed in the thread they are created https://bugs.webkit.org/show_bug.cgi?id=183671 Reviewed by Chris Dumez. No change of behavior. Moved MessagePort assertion to ActiveDOMObject. * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::~ActiveDOMObject): * dom/ActiveDOMObject.h: * dom/MessagePort.cpp: (WebCore::MessagePort::~MessagePort): * dom/MessagePort.h: 2018-03-23 Youenn Fablet <youenn@apple.com> Safari WebKitWebRTCAudioModule crash during <video> tag update when audio track present in MediaStream https://bugs.webkit.org/show_bug.cgi?id=181180 <rdar://problem/36302375> Reviewed by Eric Carlson. Test: webrtc/video-update-often.html AudioTrackPrivateMediaStreamCocoa needs to be destroyed in the main thread since it owns a Ref to its MediaStreamTrackPrivate. We can still ref it on a background thread but we always deref it on the main thread. * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable): (WebCore::AudioTrackPrivateMediaStreamCocoa::render): 2018-03-23 Sergio Villar Senin <svillar@igalia.com> [css-grid] Fix auto repeat tracks computation with definite min sizes https://bugs.webkit.org/show_bug.cgi?id=183933 Reviewed by Javier Fernandez. Indefinitely sized containers use the specified definite min-size (if any) as available space in order to compute the number of auto repeat tracks to create. A bug in that code was causing the grid to be one track larger than expected. That was only happening in the case of the free space being a multiple of the total size of the autorepeat tracks. Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-auto-repeat-001.html * rendering/RenderGrid.cpp: (WebCore::RenderGrid::computeAutoRepeatTracksCount const): 2018-03-23 Miguel Gomez <magomez@igalia.com> [GTK][WPE] Avoid software color conversion inside BitmapTextureGL https://bugs.webkit.org/show_bug.cgi?id=183892 Reviewed by Žan Doberšek. Always use RGBA format on BitmapTextureGL (when no other format is specifically requested). When the texture is updated from BGRA content, use a flag to indicate the shader to perform a color conversion during the painting. This way we don't need to swap the R and B components on the CPU. Also, remove one of the lists in BitmapTexturePool as now all of them have the same format, and remove the UpdateContentsFlag as we never need to modify the original image data. Covered by existent tests. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): * platform/graphics/texmap/BitmapTexture.cpp: (WebCore::BitmapTexture::updateContents): * platform/graphics/texmap/BitmapTexture.h: * platform/graphics/texmap/BitmapTextureGL.cpp: (WebCore::BitmapTextureGL::BitmapTextureGL): (WebCore::BitmapTextureGL::didReset): (WebCore::BitmapTextureGL::updateContents): (WebCore::BitmapTextureGL::applyFilters): (WebCore::swizzleBGRAToRGBA): Deleted. (WebCore::BitmapTextureGL::updateContentsNoSwizzle): Deleted. * platform/graphics/texmap/BitmapTextureGL.h: (WebCore::BitmapTextureGL::colorConvertFlags const): * platform/graphics/texmap/BitmapTexturePool.cpp: (WebCore::BitmapTexturePool::acquireTexture): (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired): * platform/graphics/texmap/BitmapTexturePool.h: * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded): * platform/graphics/texmap/TextureMapperContextAttributes.cpp: (WebCore::TextureMapperContextAttributes::get): * platform/graphics/texmap/TextureMapperContextAttributes.h: * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::drawNumber): (WebCore::TextureMapperGL::drawTexture): * platform/graphics/texmap/TextureMapperGL.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintIntoSurface): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper): * platform/graphics/texmap/TextureMapperTile.cpp: (WebCore::TextureMapperTile::updateContents): * platform/graphics/texmap/TextureMapperTile.h: * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp: (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded): (WebCore::TextureMapperTiledBackingStore::updateContents): * platform/graphics/texmap/TextureMapperTiledBackingStore.h: 2018-03-23 Yusuke Suzuki <utatane.tea@gmail.com> [WTF] Add standard containers with FastAllocator specialization https://bugs.webkit.org/show_bug.cgi?id=183789 Reviewed by Darin Adler. * Modules/indexeddb/IDBKeyData.h: * Modules/mediasource/SampleMap.h: * Modules/mediasource/SourceBuffer.cpp: * Modules/webauthn/cbor/CBORValue.h: It did not use FastAllocator for its container. * page/WheelEventTestTrigger.h: * platform/audio/PlatformMediaSessionManager.h: * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h: * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction): * platform/mock/mediasource/MockSourceBufferPrivate.cpp: * platform/wpe/PlatformPasteboardWPE.cpp: * rendering/OrderIterator.h: 2018-03-23 Antoine Quint <graouts@apple.com> [Web Animations] infinite repeat counts aren't reflected for CSS Animations https://bugs.webkit.org/show_bug.cgi?id=183932 Reviewed by Dean Jackson. The "infinite" value for animation-repeat-count is reflected as a special value which resolves to -1. We need to check for this special value before setting the iterations count on the AnimationEffectTimingReadOnly object. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): 2018-03-22 Antoine Quint <graouts@apple.com> [Web Animations] Correctly cancel animations when a parent gets a "display: none" style or when an element is removed https://bugs.webkit.org/show_bug.cgi?id=183919 Reviewed by Dean Jackson. The old CSSAnimationController provided a cancelAnimations(Element&) method that allowed for animations for a given element to be canceled when a parent element in the hierarchy gets a "display: none" style or if an element with animations is removed. We add a similar cancelAnimationsForElement(Element&) method on AnimationTimeline and update CSSAnimationController::cancelAnimations() call sites to use AnimationTimeline::cancelAnimationsForElement() when the flag to use Web Animations is on. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::cancelAnimationsForElement): Iterate over all animations for the provided element and call cancel() on them. * animation/AnimationTimeline.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::animatedStyleForRenderer): Drive-by fix while I was reviewed call sites to animationsForElement() to make sure we don't create extra RefPtr<> objects. * dom/Element.cpp: (WebCore::Element::removedFromAncestor): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when an element is removed. * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when a pseudo-element is removed. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on for all children elements when an element gets a "display: none" style. 2018-03-23 Antoine Quint <graouts@apple.com> [Web Animations] Animated transform styles are ignored when calling getComputedStyle() https://bugs.webkit.org/show_bug.cgi?id=183918 Reviewed by Dean Jackson. Strictly looking at whether the renderer has a transform is a bad idea when determining whether a transform is applied for an element. Looking at the RenderStyle is preferable because in the case of animations running on the compositor, such as a transform-only animation or transition, the renderer doesn't necessarily have a transform style on it, since we don't blend properties in software as the animation progresses. Instead, all of the blending is performed by the compositor, and only the computed style object has the software-blended transform style on it. We do need to account for inline renderers though as these do not support transforms. * css/CSSComputedStyleDeclaration.cpp: (WebCore::computedTransform): 2018-03-22 Antoine Quint <graouts@apple.com> [Web Animations] Support "transition: all" for CSS Transitions as Web Animations https://bugs.webkit.org/show_bug.cgi?id=183917 Reviewed by Dean Jackson. We now support "transition: all" CSS Transitions by iterating over all known CSS properties should the mode of the backing animation be AnimateAll. Any property that we find to have a different value in the previous and current style will have a backing CSSTransition object created for it. To support this, we now explicitly provide a CSSPropertyID when creating a CSSTransition since we can no longer infer the transition property from the backing animation, as Animation objects with mode AnimateAll report CSSPropertyInvalid as their property. * animation/AnimationTimeline.cpp: (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): New method that checks whether a given backing Animation object is suitable for consideration as a CSSTransition, where the mode must not be either AnimateNone or AnimateUnknownProperty, and should the mode be AnimateSingleProperty, the property must not be CSSPropertyInvalid. (WebCore::AnimationTimeline::updateCSSTransitionsForElement): We now assemble the list of previously animated properties by looking at the m_elementToCSSTransitionByCSSPropertyID map and getting its keys. Then we compile all backing Animation objects found in the old style that match the conditions enforced by the new method shouldBackingAnimationBeConsideredForCSSTransition(). Then as we iterate over backing Animation objects found in the new style, we iterate over all known CSS properties if the mode is AnimateAll, indicating that we're dealing with a "transition: all" style. If we're dealing with a single property, we only process that single property. * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Expect a new CSSPropertyID parameter when creating a new CSSTransition since we can no longer infer it from the backing Animation object. (WebCore::CSSTransition::CSSTransition): Expect a new CSSPropertyID parameter when creating a new CSSTransition since we can no longer infer it from the backing Animation object. (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): We can no longer use the == overloaded operator for backing Animation objects to determine whether their respective properties match since this would compare the "property" member of both Animation objects and when going from a "transition: all" style to one targeting a single property, we would falsely identify mis-matching Animation objects. Instead, we pass a false flag to animationsMatch() which indicates that we don't care about matching the transition property itself. * animation/CSSTransition.h: Expose a new property() accessor which returns the CSSPropertyID passed at construction. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Use the new property() accessor on CSSTransition to get at the transition property. * platform/animation/Animation.cpp: (WebCore::Animation::animationsMatch const): Replace the boolean parameter, which was not in use in WebCore, to indicate whether we should match the property-related fields. We need this in CSSTransition::matchesBackingAnimationAndStyles(). * platform/animation/Animation.h: 2018-03-22 Tim Horton <timothy_horton@apple.com> Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebCore https://bugs.webkit.org/show_bug.cgi?id=183930 <rdar://problem/38782249> Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: * Configurations/WebCore.xcconfig: * Configurations/WebCoreTestSupport.xcconfig: 2018-03-22 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229876. https://bugs.webkit.org/show_bug.cgi?id=183929 Some webrtc tests are timing out on iOS simulator (Requested by youenn on #webkit). Reverted changeset: "Use libwebrtc ObjectiveC H264 encoder and decoder" https://bugs.webkit.org/show_bug.cgi?id=183912 https://trac.webkit.org/changeset/229876 2018-03-22 Megan Gardner <megan_gardner@apple.com> Expose more system colors via CSS https://bugs.webkit.org/show_bug.cgi?id=183764 <rdar://problem/36975898> Reviewed by Tim Horton. Test: fast/css/apple-system-control-colors.html Expose Apple specific system colors via CSS. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): 2018-03-22 Nan Wang <n_wang@apple.com> AX: Web table row count is incorrect when role row is added to <tr> in DOM https://bugs.webkit.org/show_bug.cgi?id=183922 Reviewed by Chris Fleizach. Although the parent table for an ARIA grid row should be an ARIA table, we should return the native table if the row is native <tr>. Test: accessibility/row-with-aria-role-in-native-table.html * accessibility/AccessibilityARIAGridRow.cpp: (WebCore::AccessibilityARIAGridRow::parentTable const): 2018-03-22 Chris Dumez <cdumez@apple.com> Include security origin in the service worker process name https://bugs.webkit.org/show_bug.cgi?id=183913 Reviewed by Youenn Fablet. Updated localizable strings. * English.lproj/Localizable.strings: 2018-03-22 Youenn Fablet <youenn@apple.com> Use libwebrtc ObjectiveC H264 encoder and decoder https://bugs.webkit.org/show_bug.cgi?id=183912 Reviewed by Eric Carlson. No observable change of behavior. Made use of libwebrtc WebKit utilities. Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame. * Configurations/WebCore.xcconfig: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa): (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed): (WebCore::LibWebRTCProviderCocoa::createDecoderFactory): (WebCore::LibWebRTCProviderCocoa::createEncoderFactory): (WebCore::LibWebRTCProviderCocoa::setActive): * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp. (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame): (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame): * testing/Internals.cpp: Removed commented out include. 2018-03-22 Michael Catanzaro <mcatanzaro@gnome.org> Unreviewed, fix format string warnings in service worker code On Linux x86_64, uint64_t is unsigned long, not unsigned long long. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::removeRegistration): (WebCore::ServiceWorkerContainer::updateRegistration): (WebCore::ServiceWorkerContainer::jobFailedWithException): (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult): (WebCore::ServiceWorkerContainer::startScriptFetchForJob): (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): (WebCore::ServiceWorkerContainer::jobFailedLoadingScript): 2018-03-22 Daniel Bates <dabates@apple.com> Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI https://bugs.webkit.org/show_bug.cgi?id=183907 <rdar://problem/38759127> Reviewed by Alex Christensen. Exports SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() so that we can use it from WebKit. * platform/SchemeRegistry.h: 2018-03-22 Daniel Bates <dabates@apple.com> CSS mask images should be retrieved using potentially CORS-enabled fetch https://bugs.webkit.org/show_bug.cgi?id=179983 <rdar://problem/35678149> Reviewed by Brent Fulgham. As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor's Draft, 23 December 2017) we should fetch CSS mask images using a potentially CORS-enabled fetch. Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing attacks that can be used to reveal their pixel data when retrieved without regard to CORS. For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more closely align with the behavior in the spec. Test: http/tests/security/css-mask-image.html * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs. (WebCore::Style::loadPendingImage): Ditto. (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching a mask image or shape-outside image. 2018-03-22 Zalan Bujtas <zalan@apple.com> [Simple line layout] Text with letter spacing is not positioned properly. https://bugs.webkit.org/show_bug.cgi?id=183079 <rdar://problem/38762569> Reviewed by Antti Koivisto. We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes since we might not be able to use the fast path anymore. Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html * rendering/RenderText.cpp: (WebCore::RenderText::styleDidChange): 2018-03-21 Antoine Quint <graouts@apple.com> [Web Animations] Make imported/mozilla/css-animations/test_event-dispatch.html pass reliably https://bugs.webkit.org/show_bug.cgi?id=183845 Reviewed by Dean Jackson. Finish the work to get DOM events for CSS Animations and CSS Transitions dispatching as specified. * animation/AnimationEffectReadOnly.cpp: Move timeEpsilon to be shared as part of WebAnimationUtilities.h since we now need it in WebAnimation::timeToNextRequiredTick(). * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We add a pre-emptive return clause when we know that the AnimationList for previous and current styles are a match. * animation/CSSTransition.cpp: (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Ensure we have a valid effect before downcasting it. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's playState is set correctly and the animation is not idle. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::updateAnimationSchedule): We no longer need to pass the current time to timeToNextRequiredTick() since the method has been reworked to use the animation's current time, which is based on the timeline's current time. (WebCore::DocumentTimeline::updateAnimations): Avoid creating a copy when iterating over pending hardware animations. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): We should never generate new blending keyframes if the old and new styles contain the same value, since there would be no transition between two equal values, and we should only look at whether the new style value and the recorded target value differ to determine if new blending keyframes are necessary. * animation/WebAnimation.cpp: (WebCore::WebAnimation::timeToNextRequiredTick const): We correct our scheduling code which was shown to be broken in several of the newly-imported Mozilla tests. Any running animation is now scheduled to invalidate again on the next tick, and we use timeEpsilon from WebAnimationUtilities.h to correctly check if we're right at the active threshold, when we also invalidate on the next tick. If our current time is negative, in other words when the animation has not yet started, we schedule this animation's next tick to be the negative of that value. In all other cases, no invalidation needs to be scheduled. * animation/WebAnimation.h: We move updateFinishedState() to private since this method is not actually used outside of WebAnimation.cpp. * animation/WebAnimationUtilities.h: Move timeEpsilon to be shared as part of WebAnimationUtilities.h. 2018-03-22 Tim Horton <timothy_horton@apple.com> Improve readability of WebCore's OTHER_LDFLAGS https://bugs.webkit.org/show_bug.cgi?id=183909 <rdar://problem/38760992> Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: * Configurations/FeatureDefines.xcconfig: * Configurations/WebCore.xcconfig: 2018-03-22 Tim Horton <timothy_horton@apple.com> Adopt USE(OPENGL[_ES]) in more places https://bugs.webkit.org/show_bug.cgi?id=183882 <rdar://problem/37912195> Reviewed by Dan Bernstein. * platform/graphics/GraphicsContext3D.h: * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::hasMuxableGPU): (WebCore::GraphicsContext3DManager::updateHighPerformanceState): (WebCore::GraphicsContext3D::GraphicsContext3D): (WebCore::GraphicsContext3D::~GraphicsContext3D): (WebCore::GraphicsContext3D::makeContextCurrent): (WebCore::GraphicsContext3D::checkGPUStatus): (WebCore::GraphicsContext3D::texImageIOSurface2D): * platform/graphics/cocoa/WebGLLayer.h: * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithGraphicsContext3D:]): (-[WebGLLayer copyImageSnapshotWithColorSpace:]): (-[WebGLLayer display]): * platform/graphics/ios/GraphicsContext3DIOS.h: * platform/graphics/opengl/Extensions3DOpenGL.cpp: (WebCore::Extensions3DOpenGL::blitFramebuffer): (WebCore::Extensions3DOpenGL::createVertexArrayOES): (WebCore::Extensions3DOpenGL::deleteVertexArrayOES): (WebCore::Extensions3DOpenGL::isVertexArrayOES): (WebCore::Extensions3DOpenGL::bindVertexArrayOES): * platform/graphics/opengl/Extensions3DOpenGL.h: * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::reshapeFBOs): (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary): (WebCore::GraphicsContext3D::renderbufferStorage): (WebCore::GraphicsContext3D::getIntegerv): (WebCore::GraphicsContext3D::texImage2D): (WebCore::GraphicsContext3D::depthRange): (WebCore::GraphicsContext3D::clearDepth): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): Make it a bit more clear which code is platform-dependent and which code is GL/GLES-dependent. 2018-03-22 Zan Dobersek <zdobersek@igalia.com> [TexMap] Make TextureMapperContextAttributes thread-specific https://bugs.webkit.org/show_bug.cgi?id=183895 Reviewed by Carlos Garcia Campos. Store the TextureMapperContextAttributes in a thread-specific manner. The TextureMapperContextAttributes::get() method is now used to retrieve a reference to that thread-specific object. If it's not been initialized yet, then the current GL context is used for the initialization, as it used to be done in the now-removed initialize() method. TextureMapperPlatformLayerBuffer::clone() method now doesn't need to be passed a TextureMapperGL object, since the texture can be created directly by calling BitmapTextureGL::create(), passing the TextureMapperContextAttributes object that's retrieved from the thread-specific storage. This further simplifies the TextureMapperPlatformLayerProxy::Compositor interface, removing the texmapGL() getter from it. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor): * platform/graphics/texmap/TextureMapperContextAttributes.cpp: (WebCore::threadSpecificAttributes): (WebCore::TextureMapperContextAttributes::get): (WebCore::TextureMapperContextAttributes::initialize): Deleted. * platform/graphics/texmap/TextureMapperContextAttributes.h: * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGL::TextureMapperGL): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp: (WebCore::TextureMapperPlatformLayerBuffer::clone): * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h: * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture): * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: 2018-03-22 Zalan Bujtas <zalan@apple.com> SVG root is skipped while marking percentage height descendants dirty. https://bugs.webkit.org/show_bug.cgi?id=183877 Reviewed by Antti Koivisto. Calling continingBlock() to get to the correct container works as long as the ancestor inline element renderers are wrapped in anonymous blocks (continuation for example). While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way, so containingBlock() will elegantly skip it and return an SVG root ancestor. dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain. This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers (note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block). Covered by existing tests. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants): 2018-03-22 Adrian Perez de Castro <aperez@igalia.com> [WPE][GTK] Build failure when ENABLE_VIDEO, ENABLE_WEB_AUDIO and ENABLE_XSLT are disabled https://bugs.webkit.org/show_bug.cgi?id=183896 Reviewed by Yusuke Suzuki. No new tests needed. * bindings/js/JSWebAnimationCustom.cpp: Add missing #include of Document.h 2018-03-21 Chris Dumez <cdumez@apple.com> Regression(r229828): WebKit.NoHistoryItemScrollToFragment API test is failing on iOS https://bugs.webkit.org/show_bug.cgi?id=183886 Reviewed by Wenson Hsieh. Since r229828, the FrameLoader needs to call FrameLoaderClient::didDecidePolicyForNavigationAction() whenever a navigation policy decision is made. I added such a call r229828 to FrameLoader::continueLoadAfterNavigationPolicy() but forgot to add one to FrameLoader::continueFragmentScrollAfterNavigationPolicy(), which is the equivalent for fragment navigations. * loader/FrameLoader.cpp: (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy): 2018-03-21 Said Abou-Hallawa <sabouhallawa@apple.com> Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a new list https://bugs.webkit.org/show_bug.cgi?id=183723 <rdar://problem/38517871> Reviewed by Daniel Bates. When setting the "d" attribute directly on a path, we rebuild the list of path segments held for creating the property tear off. The old path segments need to get disconnected from the path element. We already do that when a path segment is replaced or removed. Test: svg/dom/reuse-pathseg-after-changing-d.html * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::svgAttributeChanged): * svg/SVGPathSegList.cpp: (WebCore::SVGPathSegList::clear): SVGPathSegListValues::clearContextAndRoles() will now be called from SVGPathSegListValues::clear() via SVGListProperty::clearValues(). (WebCore::SVGPathSegList::replaceItem): (WebCore::SVGPathSegList::removeItem): (WebCore::SVGPathSegList::clearContextAndRoles): Deleted. * svg/SVGPathSegList.h: SVGPathSegListValues::clearContextAndRoles() will now be called from SVGPathSegListValues::clear() via SVGListProperty::initializeValues(). * svg/SVGPathSegListValues.cpp: (WebCore::SVGPathSegListValues::clearItemContextAndRole): (WebCore::SVGPathSegListValues::clearContextAndRoles): * svg/SVGPathSegListValues.h: (WebCore::SVGPathSegListValues::operator=): (WebCore::SVGPathSegListValues::clear): 2018-03-21 Antoine Quint <graouts@apple.com> [Web Animations] Ensure animationcancel and transitioncancel events are dispatched https://bugs.webkit.org/show_bug.cgi?id=183864 Reviewed by Dean Jackson. In order to correctly dispatch animationcancel and transitioncancel events, we must call cancel() on CSSAnimation and CSSTransitions objects that are removed while in a play or pause phase. Additionally, we cancel declarative animations that are moving from a valid to a null timeline. Finally, when cancel() is called on a declarative animation, we record the timestamp and manually call invalidateDOMEvents() passing that timestamp in to ensure that the right phase change is recorded and results in the queuing of animationcancel and transitioncancel events. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Make sure we cancel all recorded CSS Animations when we newly get a "display: none" style. We also call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing animations outright, for all animations that previously existed but are no longer listed in the current style. (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Like in updateCSSAnimationsForElement(), we cancel all recorded CSS Transitions when we newly get a "display: none" style. We now use the refactored removeDeclarativeAnimation() method to remove an a transition for a property that was already transitioned in the previous style but has a new backing Animation object. Finally, like in updateCSSAnimationsForElement(), we call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing transitions outright, for all transitions that previously existed but are no longer listed in the current style. (WebCore::AnimationTimeline::removeDeclarativeAnimation): Refactor code into this new method to remove a declarative animation. (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Cancels a DeclarativeAnimation if it's active or removes it right away. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::setTimeline): If we're moving from a valid timeline to a null timeline, call cancel() on this animation such that an animationcancel or transitioncancel event can be dispatched. (WebCore::DeclarativeAnimation::cancel): Cancelations require the computation of the time at which a declarative animation was canceled, so we record the animation's active time as it's canceled and manually call invalidateDOMEvents() with that time after the general cancel() code has run. (WebCore::DeclarativeAnimation::invalidateDOMEvents): Accept an explicit timestamp for cancel events. * animation/DeclarativeAnimation.h: * animation/WebAnimation.h: 2018-03-21 Chris Dumez <cdumez@apple.com> ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates https://bugs.webkit.org/show_bug.cgi?id=183787 Reviewed by Wenson Hsieh. * loader/FrameLoader.cpp: (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): * loader/FrameLoaderClient.h: 2018-03-21 Eric Carlson <eric.carlson@apple.com> Clean up platform VideoFullscreenLayerManager https://bugs.webkit.org/show_bug.cgi?id=183859 <rdar://problem/38715419> Reviewed by Jer Noble. No new tests, no functional change. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h. (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity): (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const): (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds): (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame): * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h. * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm. (-[WebVideoContainerLayer setBounds:]): (-[WebVideoContainerLayer setPosition:]): (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC): (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer): (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const): (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation): 2018-03-21 Antoine Quint <graouts@apple.com> [Web Animations] Dispatch DOM events for CSS Transitions and CSS Animations implemented as Web Animations https://bugs.webkit.org/show_bug.cgi?id=183781 Reviewed by Dean Jackson. Now that we've implemented CSS Animations and CSS Transitions as Web Animations (webkit.org/b/183504) we can dispatch DOM events for targets of DeclarativeAnimation objects. To do that, we add a new invalidateDOMEvents() method on DeclarativeAnimations which is called when the timer scheduled after the timing model has been invalidated fires in DocumentTimeline::performInvalidationTask(). When we check for DOM events to dispatch, we look at the last recorded phase and iteration and determine whether the state of the animation has changed. We use a GenericEventQueue to enqueue the events such that they are dispatched asynchronously at a moment when it is safe to evaluate script. * animation/AnimationEffectReadOnly.h: Make currentIteration() public since we now need it in DeclarativeAnimation::invalidateDOMEvents(). * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::create): Pass the animation target to the constructor instead of its document. (WebCore::CSSAnimation::CSSAnimation): Pass the animation target to the superclass instead of its document. * animation/CSSAnimation.h: * animation/CSSTransition.cpp: (WebCore::CSSTransition::create): Pass the animation target to the constructor instead of its document. (WebCore::CSSTransition::CSSTransition): Pass the animation target to the superclass instead of its document. * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::DeclarativeAnimation): Expect an Element instead of a Document and use that element as the target of the GenericEventQueue that we initialize. We also register this element as our m_target. (WebCore::DeclarativeAnimation::~DeclarativeAnimation): Close the GenericEventQueue member upon destruction. (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's playState is set correctly and the animation is not idle. (WebCore::DeclarativeAnimation::phaseWithoutEffect const): Because we may need to get an animation's current phase in invalidateDOMEvents() after an animation's effect has been removed, we provide an alternate way to compute the phase just by looking at the animation's current time. (WebCore::DeclarativeAnimation::invalidateDOMEvents): Based on the previous and current pending state, iteration and phase, we enqueue animation and transition DOM events as specified by the CSS Animations Level 2 and CSS Transitions Level 2 specifications. (WebCore::DeclarativeAnimation::enqueueDOMEvent): Enqueue an event on the GenericEventQueue based on the animation type. * animation/DeclarativeAnimation.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::performInvalidationTask): We call invalidateDOMEvents() on all declarative animations registered with this timeline now that the timing model has been invalidated. * dom/EventNames.h: Add the names of newly-implemented events (animationcancel, transitioncancel, transitionrun and transitionstart). * dom/GlobalEventHandlers.idl: Add new attribute-based event handlers for the newly-implemented events. * html/HTMLAttributeNames.in: Add new attribute-based event handlers for the newly-implemented events. * html/HTMLElement.cpp: (WebCore::HTMLElement::createEventHandlerNameMap): Add new attribute-based event handlers for the newly-implemented events. 2018-03-21 Per Arne Vollan <pvollan@apple.com> Compile error when not using IOSurface canvas backing store. https://bugs.webkit.org/show_bug.cgi?id=183855 Reviewed by Brent Fulgham. The method IOSurface::createFromImageBuffer is only referenced when IOSurface is used as canvas backing store. * platform/graphics/cocoa/IOSurface.h: * platform/graphics/cocoa/IOSurface.mm: 2018-03-21 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Track dirty rects that need update in CoordinatedGraphicsLayer https://bugs.webkit.org/show_bug.cgi?id=175376 Reviewed by Carlos Garcia Campos. Follow the GraphicsLayerCA class and track rectangles in need of display in a Vector object. In case the whole layer needs updating, it's marked separately, and further rects are ignored. During layer flush, all the rects are used to invalidate the backing store, or a single layer-sized rect is used in case the whole layer has to be updated. We can also bail early from updateContentBuffers() if there are no dirty rects recorded and there's no pending visible rect adjustment. At the end of updateContentBuffers() we now test for an existing previous backing store before inquiring the backing store if the visible area is already covered, enabling deletion of this backing store. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect): (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 2018-03-21 Carlos Alberto Lopez Perez <clopez@igalia.com> [WPE] Build failure with ENABLE_VIDEO=OFF when GStreamer is not available https://bugs.webkit.org/show_bug.cgi?id=183811 Reviewed by Philippe Normand. Add build guards for USE_GSTREAMER. No new tests, it is a build fix. * platform/graphics/gstreamer/GStreamerUtilities.h: 2018-03-21 Zan Dobersek <zdobersek@igalia.com> [Cairo] Draw Cairo patterns with cairo_paint_with_alpha() https://bugs.webkit.org/show_bug.cgi?id=183774 Reviewed by Carlos Garcia Campos. In the drawPatternToCairoContext() helper in CairoOperations.cpp source file, always clip the painting region to the specified rectangle and then use cairo_paint_with_alpha() to paint the passed-in pattern object, not relaying rasterization to cairo_fill() when using opaque alpha. We still clamp the alpha value to the 0.0 - 1.0 range. No new tests -- no change in behavior. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawPatternToCairoContext): 2018-03-21 Zan Dobersek <zdobersek@igalia.com> [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status https://bugs.webkit.org/show_bug.cgi?id=183771 Reviewed by Carlos Garcia Campos. TextureMapperLayer::applyAnimationsRecursively() should return true when the TextureMapperLayer tree has currently-running animations that require continuous scene update. TextureMapperAnimation::ApplicationResult gains the hasRunningAnimation member that's set to true if any of the applied animations are still in playing state. That information is then returned in syncAnimations(), and the result is accumulated in the top applyAnimationsRecursively() call and returned there to the caller. No new tests -- no change in behavior. * platform/graphics/texmap/TextureMapperAnimation.cpp: (WebCore::TextureMapperAnimation::apply): * platform/graphics/texmap/TextureMapperAnimation.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::applyAnimationsRecursively): (WebCore::TextureMapperLayer::syncAnimations): * platform/graphics/texmap/TextureMapperLayer.h: 2018-03-21 Zan Dobersek <zdobersek@igalia.com> Use-after-move in SWContextManager::terminateWorker() with Linux x86_64 calling convention https://bugs.webkit.org/show_bug.cgi?id=183783 Reviewed by Chris Dumez. In SWContextManager::terminateWorker(), some calling conventions can end up moving the ServiceWorkerThreadProxy RefPtr into the lambda struct before that proxy's thread (on which the lambda is bound to execute) is retrieved. Avoid this by taking a reference to the thread in a separate earlier expression, before the RefPtr is moved into the lambda in the following one. * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::terminateWorker): 2018-03-21 Timothy Horton <timothy_horton@apple.com> Fix the build * platform/network/cf/FormDataStreamCFNet.cpp: 2018-03-20 Tim Horton <timothy_horton@apple.com> Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO https://bugs.webkit.org/show_bug.cgi?id=183803 <rdar://problem/38690487> Reviewed by Sam Weinig. * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): (-[WebMediaSessionHelper initWithCallback:]): (-[WebMediaSessionHelper dealloc]): (-[WebMediaSessionHelper hasWirelessTargetsAvailable]): * platform/cocoa/CoreVideoSoftLink.cpp: * platform/cocoa/CoreVideoSoftLink.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::getRGBAImageData const): * platform/graphics/cv/PixelBufferConformerCV.cpp: * platform/graphics/cv/PixelBufferConformerCV.h: * platform/graphics/cv/TextureCacheCV.h: * platform/graphics/cv/TextureCacheCV.mm: * platform/graphics/cv/VideoTextureCopierCV.cpp: * platform/graphics/cv/VideoTextureCopierCV.h: Make it possible to disable our dependency on MediaPlayer and CoreVideo. 2018-03-20 Tim Horton <timothy_horton@apple.com> Enable the minimal simulator feature flag when appropriate https://bugs.webkit.org/show_bug.cgi?id=183807 Reviewed by Dan Bernstein. * Configurations/FeatureDefines.xcconfig: 2018-03-19 Ryosuke Niwa <rniwa@webkit.org> Expose content attributes on _WKLinkIconParameters https://bugs.webkit.org/show_bug.cgi?id=183768 Reviewed by Alex Christensen. Collect a vector of content attributes upon finding touch and fav-icons in order to expose it in a WebKit API. Tests: IconLoading.DefaultFavicon * html/LinkIconCollector.cpp: (WebCore::LinkIconCollector::iconsOfTypes): Collect attributes. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startIconLoading): Use an empty vector for /favicon.ico. * platform/LinkIcon.h: (WebCore::LinkIcon::encode const): Encode the vector of content attributes. (WebCore::LinkIcon::decode): Ditto for decoding. 2018-03-20 Zalan Bujtas <zalan@apple.com> RenderTreeNeedsLayoutChecker fails with absolutely positioned svg and <use> https://bugs.webkit.org/show_bug.cgi?id=183718 Reviewed by Antti Koivisto. This patch ensures after resolving the style for an SVG element with a corresponding element (<use>), we adjust this style for the cloned SVG element too. Test: svg/in-html/path-with-absolute-positioned-svg-and-use-crash.html * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustSVGElementStyle): (WebCore::StyleResolver::adjustRenderStyle): * css/StyleResolver.h: * svg/SVGElement.cpp: (WebCore::SVGElement::resolveCustomStyle): 2018-03-20 Brady Eidson <beidson@apple.com> First piece of process swapping on navigation. https://bugs.webkit.org/show_bug.cgi?id=183665 Reviewed by Andy Estes. Covered by API test(s) This patch: - A new PolicyAction::Suspend for future use in this feature - Makes sure that loads triggered as part of a process swap do *not* re-consult the policy delegate * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): * loader/FrameLoadRequest.h: (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy): (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): * loader/FrameLoader.h: * loader/FrameLoaderTypes.h: Add a new Policy type "Suspend" to be used in the future by the process-swap-on-navigation mechanism. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): (WebCore::PolicyChecker::checkNewWindowPolicy): 2018-03-20 Chris Dumez <cdumez@apple.com> QuickLook.NavigationDelegate API test is failing on iOS with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183791 Reviewed by Alex Christensen. Update PreviewLoader to not send data (or call finishFinishLoading) until the resource response has been processed. * loader/ios/PreviewLoader.mm: (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]): (-[WebPreviewLoader connectionDidFinishLoading:]): 2018-03-20 Antoine Quint <graouts@apple.com> [Web Animations] Update the timing model when pending tasks schedule changes https://bugs.webkit.org/show_bug.cgi?id=183785 Reviewed by Dean Jackson. Changing the time at which a pending play or pause task is scheduled changes the pending state of the animation and thus should notify that the timing model has changed and invalidate the effect. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setTimeToRunPendingPlayTask): (WebCore::WebAnimation::setTimeToRunPendingPauseTask): (WebCore::WebAnimation::updatePendingTasks): 2018-03-20 Tim Horton <timothy_horton@apple.com> Add and adopt WK_PLATFORM_NAME and adjust default feature defines https://bugs.webkit.org/show_bug.cgi?id=183758 <rdar://problem/38017644> Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: * Configurations/FeatureDefines.xcconfig: * WebCore.xcodeproj/project.pbxproj: 2018-03-19 Tim Horton <timothy_horton@apple.com> Apply some SDK checks in LocalDefaultSystemAppearance https://bugs.webkit.org/show_bug.cgi?id=183767 <rdar://problem/38649611> Reviewed by Zalan Bujtas. * platform/mac/LocalDefaultSystemAppearance.h: * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): 2018-03-19 Chris Dumez <cdumez@apple.com> Have one service worker process per security origin https://bugs.webkit.org/show_bug.cgi?id=183600 <rdar://problem/35280128> Reviewed by Brady Eidson. Split service workers from different origins into their own processes for security reasons. * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistrationFromStore): (WebCore::SWServer::clear): (WebCore::SWServer::tryInstallContextData): (WebCore::SWServer::serverToContextConnectionCreated): (WebCore::SWServer::installContextData): (WebCore::SWServer::runServiceWorkerIfNecessary): (WebCore::SWServer::markAllWorkersAsTerminated): * workers/service/server/SWServer.h: * workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::SWServerToContextConnection): (WebCore::SWServerToContextConnection::~SWServerToContextConnection): (WebCore::SWServerToContextConnection::connectionForOrigin): * workers/service/server/SWServerToContextConnection.h: (WebCore::SWServerToContextConnection::origin): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::SWServerWorker): (WebCore::SWServerWorker::securityOrigin const): (WebCore::SWServerWorker::contextConnection): * workers/service/server/SWServerWorker.h: 2018-03-19 Megan Gardner <megan_gardner@apple.com> Have select element respect current appearance https://bugs.webkit.org/show_bug.cgi?id=183753 Reviewed by Tim Horton. Not currently testable, will add tests in a later patch. Have the menu lists/select elements follow the system colors. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::adjustMenuListStyle const): 2018-03-19 Nan Wang <n_wang@apple.com> AX: embedded attachments do not work correctly with text marker APIs on macOS https://bugs.webkit.org/show_bug.cgi?id=183751 Reviewed by Chris Fleizach. In WebKit1, embedded attachments are not working well with text marker APIs. We should use the corresponding attachment view in the following cases: 1. Hit testing on an attachment object. 2. Getting the attachment object at a text marker position. 3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute. Not able to construct a layout test because it relies on embedded attachments. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (AXAttributeStringSetElement): (-[WebAccessibilityObjectWrapper accessibilityHitTest:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): 2018-03-19 Jiewen Tan <jiewen_tan@apple.com> Unreviewed, another quick fix for r229699 Restricts ENABLE_WEB_AUTHN to only macOS and iOS. * Configurations/FeatureDefines.xcconfig: 2018-03-19 Daniel Bates <dabates@apple.com> Fix case of Strong Password localized string * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::autoFillStrongPasswordLabel): 2018-03-19 Chris Dumez <cdumez@apple.com> WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183702 <rdar://problem/38566060> Reviewed by Alex Christensen. The issue is that the test calls loadHTMLString then loadRequest right after, without waiting for the first load to complete first. loadHTMLString is special as it relies on substitute data and which schedules a timer to commit the data. When doing the navigation policy check for the following loadRequest(), the substitute data timer would fire and commit its data and load. This would in turn cancel the pending navigation policy check for the loadRequest(). With sync policy delegates, this is not an issue because we take care of stopping all loaders when receiving the policy decision, which happens synchronously. However, when the policy decision happens asynchronously, the pending substitute data load does not get cancelled in time and it gets committed. To address the issue, we now cancel any pending provisional load before doing the navigation policy check. Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash-async-delegate.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck): * loader/FrameLoader.h: * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): Cancel any pending provisional load before starting the navigation policy check. This call needs to be here rather than in the call site of policyChecker().checkNavigationPolicy() because there is code in PolicyChecker::checkNavigationPolicy() which relies on FrameLoader::activeDocumentLoader(). Also, we only cancel the provisional load if there is a policy document loader. In some rare cases (when we receive a redirect after navigation policy has been decided for the initial request), the provisional document loader needs to receive navigation policy decisions so we cannot clear the provisional document loader in such case. 2018-03-19 Eric Carlson <eric.carlson@apple.com> [Extra zoom mode] Require fullscreen for video playback https://bugs.webkit.org/show_bug.cgi?id=183742 <rdar://problem/38235862> Reviewed by Jer Noble. * Modules/modern-media-controls/media/playback-support.js: (PlaybackSupport.prototype.syncControl): Always show the play button. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::updatePlayState): Return immediately if playback requires fullscreen (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Call updatePlayState in case playback is pending. * html/HTMLMediaElement.h: * platform/cocoa/VideoFullscreenModel.h: (WebCore::VideoFullscreenModel::presentingViewController): New. (WebCore::VideoFullscreenModel::createVideoFullscreenViewController): New. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): * platform/ios/PlaybackSessionInterfaceAVKit.mm: (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged): * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: Wrap AVPlayerLayerView so we can change its behavior. (WebAVPlayerLayerView_playerLayer): (WebAVPlayerLayerView_videoView): (allocWebAVPlayerLayerViewInstance): (-[WebAVPlayerViewController initWithFullscreenInterface:]): (-[WebAVPlayerViewController playerViewControllerShouldHandleDoneButtonTap:]): (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]): (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]): (-[WebAVPlayerViewController NO_RETURN_DUE_TO_ASSERT]): (-[WebAVPlayerViewController isPictureInPicturePossible]): (-[WebAVPlayerViewController isPictureInPictureActive]): (-[WebAVPlayerViewController isPictureInPictureSuspended]): (-[WebAVPlayerViewController pictureInPictureActive]): (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]): (-[WebAVPlayerViewController view]): (-[WebAVPlayerViewController showsPlaybackControls]): (-[WebAVPlayerViewController setShowsPlaybackControls:]): (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]): (-[WebAVPlayerViewController setDelegate:]): (-[WebAVPlayerViewController setPlayerController:]): (-[WebAVPlayerViewController avPlayerViewController]): (-[WebAVPlayerViewController removeFromParentViewController]): (VideoFullscreenInterfaceAVKit::setupFullscreen): (fallbackViewController): (VideoFullscreenInterfaceAVKit::presentingViewController): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): (VideoFullscreenInterfaceAVKit::doSetup): (WebCore::supportsPictureInPicture): 2018-03-19 Per Arne Vollan <pvollan@apple.com> When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail. https://bugs.webkit.org/show_bug.cgi?id=183604 <rdar://problem/38305109> Reviewed by Brent Fulgham. The call to CVDisplayLinkCreateWithCGDisplay can instead be made in the UIProcess. Notify the WebContent process about display updates by sending a message from the UIProcess on each screen update. This patch adds an extra IPC step when notifying the WebContent process about display updates. However, the MotionMark benchmark shows no performance regression when running it with this patch. A possible explanation for this is that the high priority display link thread is now running in the UIProcess instead of the WebContent process, which means there will be more available CPU resources for the WebContent process. A run loop observer is added to make sure that only one display callback (for each display observer) is executed in a single iteration of the run loop. This will make sure we are not filling the IPC message queue with unhandled display link messages. No new tests, covered by existing tests. * platform/graphics/DisplayRefreshMonitor.h: (WebCore::DisplayRefreshMonitor::displayLinkFired): * platform/graphics/DisplayRefreshMonitorManager.cpp: (WebCore::DisplayRefreshMonitorManager::displayWasUpdated): * platform/graphics/DisplayRefreshMonitorManager.h: * platform/graphics/mac/DisplayRefreshMonitorMac.h: 2018-03-19 Megan Gardner <megan_gardner@apple.com> Ensure local appearance actually mirrors the app's appearance https://bugs.webkit.org/show_bug.cgi?id=183743 Reviewed by Tim Horton. Not currently testable, will add tests in a later patch. Current appearance isn't always accurate by default and needs to be set manually. * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): 2018-03-19 Zan Dobersek <zdobersek@igalia.com> Unreviewed GCC 4.9 build-fix after r229672. * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: (Nicosia::createCommand): Don't depend on implicit conversion of the returning std::unique_ptr<> object, and instead only wrap the heap-allocated PaintingOperation-derived in a std::unique_ptr<> at the point of return. 2018-03-18 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229689. https://bugs.webkit.org/show_bug.cgi?id=183735 Causes fast/loader/inner-iframe-loads-data-url-into-parent-on- unload-crash.html to fail with async delegates (Requested by cdumez_ on #webkit). Reverted changeset: "WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates" https://bugs.webkit.org/show_bug.cgi?id=183702 https://trac.webkit.org/changeset/229689 2018-03-17 Tim Horton <timothy_horton@apple.com> Correct redefined fnfErr type https://bugs.webkit.org/show_bug.cgi?id=183728 <rdar://problem/38590063> Reviewed by Dan Bernstein. * platform/network/cf/FormDataStreamCFNet.cpp: CFStreamError's error parameter takes a SInt32, not an int. Make sure our redefinition has a compatible type. 2018-03-17 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Implement authenticatorMakeCredential https://bugs.webkit.org/show_bug.cgi?id=183527 <rdar://problem/35275886> Reviewed by Brent Fulgham. This patch does the following few things: 1) It implements the authenticatorMakeCredential logic from the spec: https://www.w3.org/TR/webauthn/#op-make-cred. 2) It tweaks enocding and deocding of PublicKeyCredentialCreationOptions between UIProccess and WebProcess. 3) It soft links LocalAuthentication.Framework to WebCore, which was linked to WebKit. 4) It creates SPI header for DeviceIdentity.Framework, and provides stubs to link it to WebCore. Here is a detailed explanantion of 1): 1. A helper class called LocalAuthenticator is crafted to represent Apple platform attached authenticator, i.e. the devices themselves. All operations are currently restricted to iOS at this moment as macOS lacks attestation support. 2. To do testing, this helper class is then moved from WebKit to WebCore even though all operations can only happens in the UIProcess. We currently lack the ability to pretend a https environment in TestWebKitAPI which is required by the WebAuthN API, and thus it is moved to WebCore to perform unit tesing flavor API tests. This is not enough as it can't test message exchange between the UI and Web processes. We will address this in a subsequent patch. 3. More on testing: The attestation process is abstracted into a protected method such that the testing enviroment can override it with self attestation as network access is restricted in the WebKit testing enviroment. Also, swizzlers of LocalAuthentication API are provided to override the behavoir of LAContext. 4. More on testing: The actual Apple attestation can only happen in real device and with network access, therefore it can only be covered by manual tests at this moment. 5. Back to LocalAuthenticator, it currently has two public methods: 5.1. makeCredential(): This method is the one does all the magic. + It first checks some parameters. + It then invokes LAContext to get user consent. + It then talks to Apple Attestation Privacy CA to do attestations. + It then stores necessary information into the Keychain. + Finally it generates the attestation object. 5.2 isAvailable(): To check if a LocalAuthenticator is available or not. 6. Even though files are of .mm format, they are written in a way that mixes NS, CF and C++ types. Here is the rule: 6.1 Use CF type only if it is requested by APIs. 6.2 Use NS type to manipulate all Objc objects. 6.3 Use C++ otherwise. Covered by API tests. * Configurations/WebCore.xcconfig: * Modules/credentialmanagement/CredentialsMessenger.cpp: (WebCore::getIdFromAttestationObject): Deleted. Decoding attestation object is tedious. UIProcess will instead return credential ID and attestation object at the same time. Therefore, this method is removed. * Modules/credentialmanagement/CredentialsMessenger.h: (WebCore::CreationReturnBundle::CreationReturnBundle): Deleted. (WebCore::AssertionReturnBundle::AssertionReturnBundle): Deleted. * Modules/webauthn/COSEConstants.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h. * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (WebCore::PublicKeyCredentialCreationOptions::isolatedPartialCopyPtr const): (WebCore::PublicKeyCredentialCreationOptions::Parameters::encode const): (WebCore::PublicKeyCredentialCreationOptions::Parameters::decode): (WebCore::PublicKeyCredentialCreationOptions::encode const): (WebCore::PublicKeyCredentialCreationOptions::decode): * Modules/webauthn/PublicKeyCredentialDescriptor.h: (WebCore::PublicKeyCredentialDescriptor::encode const): (WebCore::PublicKeyCredentialDescriptor::decode): * Modules/webauthn/PublicKeyCredentialType.h: * Modules/webauthn/cocoa/LocalAuthenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h. * Modules/webauthn/cocoa/LocalAuthenticator.mm: Added. (WebCore::LocalAuthenticatorInternal::freePtrs): (WebCore::LocalAuthenticator::makeCredential const): (WebCore::LocalAuthenticator::isAvailable const): (WebCore::LocalAuthenticator::issueClientCertificate const): * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * platform/cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h. * platform/cocoa/LocalAuthenticationSoftLink.mm: Added. * testing/MockCredentialsMessenger.cpp: (WebCore::MockCredentialsMessenger::setCreationReturnBundle): (WebCore::MockCredentialsMessenger::makeCredential): (WebCore::MockCredentialsMessenger::makeCredentialReply): (WebCore::MockCredentialsMessenger::setAttestationObject): Deleted. * testing/MockCredentialsMessenger.h: * testing/MockCredentialsMessenger.idl: 2018-03-16 Brent Fulgham <bfulgham@apple.com> Correct debug assertion in Range::borderAndTextRects https://bugs.webkit.org/show_bug.cgi?id=183710 <rdar://problem/38466976> Reviewed by Ryosuke Niwa. A debug assertion will fire if Range::borderAndTextRects is asked to evaluate a set of selected elements, where one of the elements does not have a parent. We should consider a nullptr parent as satisfying the condition of a parent not being present in the selection set. Tests: fast/dom/range/range-selection-empty-body.html * dom/Range.cpp: (WebCore::Range::borderAndTextRects const): 2018-03-15 Filip Pizlo <fpizlo@apple.com> Put the DOM in IsoHeaps https://bugs.webkit.org/show_bug.cgi?id=183546 Reviewed by Daniel Bates. No new tests because no change in behavior. This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means that DOM UAFs cannot be used for universal read gadgets. This looks neutral on Speedometer and membuster, though I did have one round of testing that led me to believe that membuster was regressed - I just wasn't able to reproduce that result on subsequent testing. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Attr.cpp: * dom/Attr.h: * dom/CDATASection.cpp: * dom/CDATASection.h: * dom/CharacterData.cpp: * dom/CharacterData.h: * dom/Comment.cpp: * dom/Comment.h: * dom/ContainerNode.cpp: * dom/ContainerNode.h: * dom/Document.cpp: * dom/Document.h: * dom/DocumentFragment.cpp: * dom/DocumentFragment.h: * dom/DocumentType.cpp: * dom/DocumentType.h: * dom/Node.cpp: * dom/Node.h: * dom/ProcessingInstruction.cpp: * dom/ProcessingInstruction.h: * dom/PseudoElement.cpp: * dom/PseudoElement.h: * dom/ShadowRoot.cpp: * dom/ShadowRoot.h: * dom/StyledElement.cpp: * dom/StyledElement.h: * dom/TemplateContentDocumentFragment.cpp: Added. * dom/TemplateContentDocumentFragment.h: * dom/Text.cpp: * dom/Text.h: * dom/XMLDocument.cpp: Added. * dom/XMLDocument.h: * html/FTPDirectoryDocument.cpp: * html/FTPDirectoryDocument.h: * html/FileInputType.cpp: * html/HTMLAnchorElement.cpp: * html/HTMLAnchorElement.h: * html/HTMLAppletElement.cpp: * html/HTMLAppletElement.h: * html/HTMLAreaElement.cpp: * html/HTMLAreaElement.h: * html/HTMLAttachmentElement.cpp: * html/HTMLAttachmentElement.h: * html/HTMLBDIElement.cpp: Added. * html/HTMLBDIElement.h: * html/HTMLBRElement.cpp: * html/HTMLBRElement.h: * html/HTMLBaseElement.cpp: * html/HTMLBaseElement.h: * html/HTMLBodyElement.cpp: * html/HTMLBodyElement.h: * html/HTMLButtonElement.cpp: * html/HTMLButtonElement.h: * html/HTMLCanvasElement.cpp: * html/HTMLCanvasElement.h: * html/HTMLDListElement.cpp: * html/HTMLDListElement.h: * html/HTMLDataElement.cpp: * html/HTMLDataElement.h: * html/HTMLDataListElement.cpp: * html/HTMLDataListElement.h: * html/HTMLDetailsElement.cpp: * html/HTMLDetailsElement.h: * html/HTMLDirectoryElement.cpp: * html/HTMLDirectoryElement.h: * html/HTMLDivElement.cpp: * html/HTMLDivElement.h: * html/HTMLDocument.cpp: * html/HTMLDocument.h: * html/HTMLElement.cpp: * html/HTMLElement.h: * html/HTMLEmbedElement.cpp: * html/HTMLEmbedElement.h: * html/HTMLFieldSetElement.cpp: * html/HTMLFieldSetElement.h: * html/HTMLFontElement.cpp: * html/HTMLFontElement.h: * html/HTMLFormControlElement.cpp: * html/HTMLFormControlElement.h: * html/HTMLFormControlElementWithState.cpp: * html/HTMLFormControlElementWithState.h: * html/HTMLFormElement.cpp: * html/HTMLFormElement.h: * html/HTMLFrameElement.cpp: * html/HTMLFrameElement.h: * html/HTMLFrameElementBase.cpp: * html/HTMLFrameElementBase.h: * html/HTMLFrameOwnerElement.cpp: * html/HTMLFrameOwnerElement.h: * html/HTMLFrameSetElement.cpp: * html/HTMLFrameSetElement.h: * html/HTMLHRElement.cpp: * html/HTMLHRElement.h: * html/HTMLHeadElement.cpp: * html/HTMLHeadElement.h: * html/HTMLHeadingElement.cpp: * html/HTMLHeadingElement.h: * html/HTMLHtmlElement.cpp: * html/HTMLHtmlElement.h: * html/HTMLIFrameElement.cpp: * html/HTMLIFrameElement.h: * html/HTMLImageElement.cpp: * html/HTMLImageElement.h: * html/HTMLInputElement.cpp: * html/HTMLInputElement.h: * html/HTMLKeygenElement.cpp: * html/HTMLKeygenElement.h: * html/HTMLLIElement.cpp: * html/HTMLLIElement.h: * html/HTMLLabelElement.cpp: * html/HTMLLabelElement.h: * html/HTMLLegendElement.cpp: * html/HTMLLegendElement.h: * html/HTMLLinkElement.cpp: * html/HTMLLinkElement.h: * html/HTMLMapElement.cpp: * html/HTMLMapElement.h: * html/HTMLMarqueeElement.cpp: * html/HTMLMarqueeElement.h: * html/HTMLMenuElement.cpp: * html/HTMLMenuElement.h: * html/HTMLMenuItemElement.cpp: * html/HTMLMenuItemElement.h: * html/HTMLMetaElement.cpp: * html/HTMLMetaElement.h: * html/HTMLMeterElement.cpp: * html/HTMLMeterElement.h: * html/HTMLModElement.cpp: * html/HTMLModElement.h: * html/HTMLOListElement.cpp: * html/HTMLOListElement.h: * html/HTMLObjectElement.cpp: * html/HTMLObjectElement.h: * html/HTMLOptGroupElement.cpp: * html/HTMLOptGroupElement.h: * html/HTMLOptionElement.cpp: * html/HTMLOptionElement.h: * html/HTMLOutputElement.cpp: * html/HTMLOutputElement.h: * html/HTMLParagraphElement.cpp: * html/HTMLParagraphElement.h: * html/HTMLParamElement.cpp: * html/HTMLParamElement.h: * html/HTMLPictureElement.cpp: * html/HTMLPictureElement.h: * html/HTMLPlugInElement.cpp: * html/HTMLPlugInElement.h: * html/HTMLPlugInImageElement.cpp: * html/HTMLPlugInImageElement.h: * html/HTMLPreElement.cpp: * html/HTMLPreElement.h: * html/HTMLProgressElement.cpp: * html/HTMLProgressElement.h: * html/HTMLQuoteElement.cpp: * html/HTMLQuoteElement.h: * html/HTMLScriptElement.cpp: * html/HTMLScriptElement.h: * html/HTMLSelectElement.cpp: * html/HTMLSelectElement.h: * html/HTMLSlotElement.cpp: * html/HTMLSlotElement.h: * html/HTMLSourceElement.cpp: * html/HTMLSourceElement.h: * html/HTMLSpanElement.cpp: * html/HTMLSpanElement.h: * html/HTMLStyleElement.cpp: * html/HTMLStyleElement.h: * html/HTMLSummaryElement.cpp: * html/HTMLSummaryElement.h: * html/HTMLTableCaptionElement.cpp: * html/HTMLTableCaptionElement.h: * html/HTMLTableCellElement.cpp: * html/HTMLTableCellElement.h: * html/HTMLTableColElement.cpp: * html/HTMLTableColElement.h: * html/HTMLTableElement.cpp: * html/HTMLTableElement.h: * html/HTMLTablePartElement.cpp: * html/HTMLTablePartElement.h: * html/HTMLTableRowElement.cpp: * html/HTMLTableRowElement.h: * html/HTMLTableSectionElement.cpp: * html/HTMLTableSectionElement.h: * html/HTMLTemplateElement.cpp: * html/HTMLTemplateElement.h: * html/HTMLTextAreaElement.cpp: * html/HTMLTextAreaElement.h: * html/HTMLTextFormControlElement.cpp: * html/HTMLTextFormControlElement.h: * html/HTMLTimeElement.cpp: * html/HTMLTimeElement.h: * html/HTMLTitleElement.cpp: * html/HTMLTitleElement.h: * html/HTMLTrackElement.cpp: * html/HTMLTrackElement.h: * html/HTMLUListElement.cpp: * html/HTMLUListElement.h: * html/HTMLUnknownElement.cpp: Added. * html/HTMLUnknownElement.h: * html/HTMLWBRElement.cpp: * html/HTMLWBRElement.h: * html/ImageDocument.cpp: * html/ImageDocument.h: * html/LabelableElement.cpp: * html/LabelableElement.h: * html/MediaController.cpp: (MediaController::create): Deleted. (MediaController::MediaController): Deleted. (MediaController::addMediaElement): Deleted. (MediaController::removeMediaElement): Deleted. (MediaController::containsMediaElement const): Deleted. (MediaController::buffered const): Deleted. (MediaController::seekable const): Deleted. (MediaController::played): Deleted. (MediaController::duration const): Deleted. (MediaController::currentTime const): Deleted. (MediaController::setCurrentTime): Deleted. (MediaController::unpause): Deleted. (MediaController::play): Deleted. (MediaController::pause): Deleted. (MediaController::setDefaultPlaybackRate): Deleted. (MediaController::playbackRate const): Deleted. (MediaController::setPlaybackRate): Deleted. (MediaController::setVolume): Deleted. (MediaController::setMuted): Deleted. (playbackStateWaiting): Deleted. (playbackStatePlaying): Deleted. (playbackStateEnded): Deleted. (MediaController::playbackState const): Deleted. (MediaController::reportControllerState): Deleted. (eventNameForReadyState): Deleted. (MediaController::updateReadyState): Deleted. (MediaController::updatePlaybackState): Deleted. (MediaController::updateMediaElements): Deleted. (MediaController::bringElementUpToSpeed): Deleted. (MediaController::isBlocked const): Deleted. (MediaController::hasEnded const): Deleted. (MediaController::scheduleEvent): Deleted. (MediaController::asyncEventTimerFired): Deleted. (MediaController::clearPositionTimerFired): Deleted. (MediaController::hasAudio const): Deleted. (MediaController::hasVideo const): Deleted. (MediaController::hasClosedCaptions const): Deleted. (MediaController::setClosedCaptionsVisible): Deleted. (MediaController::supportsScanning const): Deleted. (MediaController::beginScrubbing): Deleted. (MediaController::endScrubbing): Deleted. (MediaController::beginScanning): Deleted. (MediaController::endScanning): Deleted. (MediaController::canPlay const): Deleted. (MediaController::isLiveStream const): Deleted. (MediaController::hasCurrentSrc const): Deleted. (MediaController::returnToRealtime): Deleted. (MediaController::startTimeupdateTimer): Deleted. (MediaController::scheduleTimeupdateEvent): Deleted. * html/MediaDocument.cpp: * html/MediaDocument.h: * html/PluginDocument.cpp: * html/PluginDocument.h: * html/RubyElement.cpp: * html/RubyElement.h: * html/RubyTextElement.cpp: * html/RubyTextElement.h: * html/TextDocument.cpp: * html/TextDocument.h: * html/shadow/AutoFillButtonElement.cpp: * html/shadow/AutoFillButtonElement.h: * html/shadow/DetailsMarkerControl.cpp: * html/shadow/DetailsMarkerControl.h: * html/shadow/ImageControlsRootElement.cpp: * html/shadow/ImageControlsRootElement.h: * html/shadow/MediaControlElementTypes.cpp: * html/shadow/MediaControlElementTypes.h: * html/shadow/MediaControlElements.cpp: * html/shadow/MediaControlElements.h: * html/shadow/MediaControls.cpp: * html/shadow/MediaControls.h: * html/shadow/ProgressShadowElement.cpp: * html/shadow/ProgressShadowElement.h: * html/shadow/SliderThumbElement.cpp: * html/shadow/SliderThumbElement.h: * html/shadow/SpinButtonElement.cpp: * html/shadow/SpinButtonElement.h: * html/shadow/TextControlInnerElements.cpp: * html/shadow/TextControlInnerElements.h: * html/shadow/YouTubeEmbedShadowElement.cpp: * html/shadow/YouTubeEmbedShadowElement.h: * html/shadow/mac/ImageControlsButtonElementMac.cpp: * html/shadow/mac/ImageControlsButtonElementMac.h: * html/shadow/mac/ImageControlsRootElementMac.cpp: * html/shadow/mac/ImageControlsRootElementMac.h: * html/track/TextTrackCueGeneric.cpp: * html/track/VTTCue.cpp: * html/track/VTTCue.h: * html/track/WebVTTElement.cpp: * html/track/WebVTTElement.h: * loader/SinkDocument.cpp: * loader/SinkDocument.h: * mathml/MathMLAnnotationElement.cpp: * mathml/MathMLAnnotationElement.h: * mathml/MathMLElement.cpp: * mathml/MathMLElement.h: * mathml/MathMLFractionElement.cpp: * mathml/MathMLFractionElement.h: * mathml/MathMLMathElement.cpp: * mathml/MathMLMathElement.h: * mathml/MathMLMencloseElement.cpp: * mathml/MathMLMencloseElement.h: * mathml/MathMLOperatorElement.cpp: * mathml/MathMLOperatorElement.h: * mathml/MathMLPaddedElement.cpp: * mathml/MathMLPaddedElement.h: * mathml/MathMLPresentationElement.cpp: * mathml/MathMLPresentationElement.h: * mathml/MathMLRootElement.cpp: * mathml/MathMLRootElement.h: * mathml/MathMLRowElement.cpp: * mathml/MathMLRowElement.h: * mathml/MathMLScriptsElement.cpp: * mathml/MathMLScriptsElement.h: * mathml/MathMLSelectElement.cpp: * mathml/MathMLSelectElement.h: * mathml/MathMLSpaceElement.cpp: * mathml/MathMLSpaceElement.h: * mathml/MathMLTokenElement.cpp: * mathml/MathMLTokenElement.h: * mathml/MathMLUnderOverElement.cpp: * mathml/MathMLUnderOverElement.h: * mathml/MathMLUnknownElement.cpp: Added. * mathml/MathMLUnknownElement.h: * svg/SVGAElement.cpp: * svg/SVGAElement.h: * svg/SVGAltGlyphDefElement.cpp: * svg/SVGAltGlyphDefElement.h: * svg/SVGAltGlyphElement.cpp: * svg/SVGAltGlyphElement.h: * svg/SVGAltGlyphItemElement.cpp: * svg/SVGAltGlyphItemElement.h: * svg/SVGAnimateColorElement.cpp: * svg/SVGAnimateColorElement.h: * svg/SVGAnimateElement.cpp: * svg/SVGAnimateElement.h: * svg/SVGAnimateElementBase.cpp: * svg/SVGAnimateElementBase.h: * svg/SVGAnimateMotionElement.cpp: * svg/SVGAnimateMotionElement.h: * svg/SVGAnimateTransformElement.cpp: * svg/SVGAnimateTransformElement.h: * svg/SVGAnimationElement.cpp: * svg/SVGAnimationElement.h: * svg/SVGCircleElement.cpp: * svg/SVGCircleElement.h: * svg/SVGClipPathElement.cpp: * svg/SVGClipPathElement.h: * svg/SVGComponentTransferFunctionElement.cpp: * svg/SVGComponentTransferFunctionElement.h: * svg/SVGCursorElement.cpp: * svg/SVGCursorElement.h: * svg/SVGDefsElement.cpp: * svg/SVGDefsElement.h: * svg/SVGDescElement.cpp: * svg/SVGDescElement.h: * svg/SVGDocument.cpp: * svg/SVGDocument.h: * svg/SVGElement.cpp: * svg/SVGElement.h: * svg/SVGEllipseElement.cpp: * svg/SVGEllipseElement.h: * svg/SVGFEBlendElement.cpp: * svg/SVGFEBlendElement.h: * svg/SVGFEColorMatrixElement.cpp: * svg/SVGFEColorMatrixElement.h: * svg/SVGFEComponentTransferElement.cpp: * svg/SVGFEComponentTransferElement.h: * svg/SVGFECompositeElement.cpp: * svg/SVGFECompositeElement.h: * svg/SVGFEConvolveMatrixElement.cpp: * svg/SVGFEConvolveMatrixElement.h: * svg/SVGFEDiffuseLightingElement.cpp: * svg/SVGFEDiffuseLightingElement.h: * svg/SVGFEDisplacementMapElement.cpp: * svg/SVGFEDisplacementMapElement.h: * svg/SVGFEDropShadowElement.cpp: * svg/SVGFEDropShadowElement.h: * svg/SVGFEFloodElement.cpp: * svg/SVGFEFloodElement.h: * svg/SVGFEGaussianBlurElement.cpp: * svg/SVGFEGaussianBlurElement.h: * svg/SVGFEImageElement.cpp: * svg/SVGFEImageElement.h: * svg/SVGFELightElement.cpp: * svg/SVGFELightElement.h: * svg/SVGFEMergeElement.cpp: * svg/SVGFEMergeElement.h: * svg/SVGFEMergeNodeElement.cpp: * svg/SVGFEMergeNodeElement.h: * svg/SVGFEMorphologyElement.cpp: * svg/SVGFEMorphologyElement.h: * svg/SVGFEOffsetElement.cpp: * svg/SVGFEOffsetElement.h: * svg/SVGFESpecularLightingElement.cpp: * svg/SVGFESpecularLightingElement.h: * svg/SVGFETileElement.cpp: * svg/SVGFETileElement.h: * svg/SVGFETurbulenceElement.cpp: * svg/SVGFETurbulenceElement.h: * svg/SVGFilterElement.cpp: * svg/SVGFilterElement.h: * svg/SVGFilterPrimitiveStandardAttributes.cpp: * svg/SVGFilterPrimitiveStandardAttributes.h: * svg/SVGFontFaceElement.cpp: * svg/SVGFontFaceElement.h: * svg/SVGFontFaceFormatElement.cpp: * svg/SVGFontFaceFormatElement.h: * svg/SVGFontFaceNameElement.cpp: * svg/SVGFontFaceNameElement.h: * svg/SVGFontFaceSrcElement.cpp: * svg/SVGFontFaceSrcElement.h: * svg/SVGFontFaceUriElement.cpp: * svg/SVGFontFaceUriElement.h: * svg/SVGForeignObjectElement.cpp: * svg/SVGForeignObjectElement.h: * svg/SVGGElement.cpp: * svg/SVGGElement.h: * svg/SVGGlyphElement.cpp: * svg/SVGGlyphElement.h: * svg/SVGGlyphRefElement.cpp: * svg/SVGGlyphRefElement.h: * svg/SVGGradientElement.cpp: * svg/SVGGradientElement.h: * svg/SVGGraphicsElement.cpp: * svg/SVGGraphicsElement.h: * svg/SVGHKernElement.cpp: * svg/SVGHKernElement.h: * svg/SVGImageElement.cpp: * svg/SVGImageElement.h: * svg/SVGLineElement.cpp: * svg/SVGLineElement.h: * svg/SVGLinearGradientElement.cpp: * svg/SVGLinearGradientElement.h: * svg/SVGMPathElement.cpp: * svg/SVGMPathElement.h: * svg/SVGMarkerElement.cpp: * svg/SVGMarkerElement.h: * svg/SVGMaskElement.cpp: * svg/SVGMaskElement.h: * svg/SVGMetadataElement.cpp: * svg/SVGMetadataElement.h: * svg/SVGMissingGlyphElement.cpp: * svg/SVGMissingGlyphElement.h: * svg/SVGPathElement.cpp: * svg/SVGPathElement.h: * svg/SVGPatternElement.cpp: * svg/SVGPatternElement.h: * svg/SVGPolyElement.cpp: * svg/SVGPolyElement.h: * svg/SVGPolygonElement.cpp: * svg/SVGPolygonElement.h: * svg/SVGPolylineElement.cpp: * svg/SVGPolylineElement.h: * svg/SVGRadialGradientElement.cpp: * svg/SVGRadialGradientElement.h: * svg/SVGRectElement.cpp: * svg/SVGRectElement.h: * svg/SVGSVGElement.cpp: * svg/SVGSVGElement.h: * svg/SVGScriptElement.cpp: * svg/SVGScriptElement.h: * svg/SVGSetElement.cpp: * svg/SVGSetElement.h: * svg/SVGStopElement.cpp: * svg/SVGStopElement.h: * svg/SVGStyleElement.cpp: * svg/SVGStyleElement.h: * svg/SVGSwitchElement.cpp: * svg/SVGSwitchElement.h: * svg/SVGSymbolElement.cpp: * svg/SVGSymbolElement.h: * svg/SVGTRefElement.cpp: * svg/SVGTRefElement.h: * svg/SVGTSpanElement.cpp: * svg/SVGTSpanElement.h: * svg/SVGTextContentElement.cpp: * svg/SVGTextContentElement.h: * svg/SVGTextElement.cpp: * svg/SVGTextElement.h: * svg/SVGTextPathElement.cpp: * svg/SVGTextPathElement.h: * svg/SVGTextPositioningElement.cpp: * svg/SVGTextPositioningElement.h: * svg/SVGTitleElement.cpp: * svg/SVGTitleElement.h: * svg/SVGUnknownElement.cpp: Added. * svg/SVGUnknownElement.h: * svg/SVGUseElement.cpp: * svg/SVGUseElement.h: * svg/SVGVKernElement.cpp: * svg/SVGVKernElement.h: * svg/SVGViewElement.cpp: * svg/SVGViewElement.h: * svg/animation/SVGSMILElement.cpp: * svg/animation/SVGSMILElement.h: 2018-03-16 Youenn Fablet <youenn@apple.com> Ensure Document::responseReceived and clearResource are called on the main thread https://bugs.webkit.org/show_bug.cgi?id=183709 Reviewed by Chris Dumez. No change of behavior. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): (WebCore::DocumentLoader::clearMainResource): 2018-03-16 Chris Dumez <cdumez@apple.com> WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183702 Reviewed by Alex Christensen. The issue is that the test calls loadHTMLString then loadRequest right after, without waiting for the first load to complete first. loadHTMLString is special as it relies on substitute data and which schedules a timer to commit the data. When doing the navigation policy check for the following loadRequest(), the substitute data timer would fire and commit its data and load. This would in turn cancel the pending navigation policy check for the loadRequest(). With sync policy delegates, this is not an issue because we take care of stopping all loaders when receiving the policy decision, which happens synchronously. However, when the policy decision happens asynchronously, the pending substitute data load does not get cancelled in time and it gets committed. To address the issue, this patch updates loadWithDocumentLoader() to cancel any provisional load when there is an asynchronous navigation policy decision pending. Change covered by new API test. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithDocumentLoader): 2018-03-16 Brent Fulgham <bfulgham@apple.com> Set a trap to catch an infrequent form-related nullptr crash https://bugs.webkit.org/show_bug.cgi?id=183704 <rdar://problem/37579354> Reviewed by Ryosuke Niwa. Make FormState a FrameDestructionObserver. We expect all relevant FormState objects to have been cleaned up prior to the frame being destroyed. If we find such a case, we'd like to see the stack trace to see what's going on. * loader/FormState.cpp: (WebCore::FormState::FormState): (WebCore::FormState::willDetachPage): RELEASE_ASSERT_NOT_REACHED if we ever get here. * loader/FormState.h: 2018-03-16 Joanmarie Diggs <jdiggs@igalia.com> AX: AccessibilityNodeObject::textForLabelElement() doesn't follow AccName calculation rules https://bugs.webkit.org/show_bug.cgi?id=183661 Reviewed by Chris Fleizach. Have AccessibilityNodeObject::textForLabelElement() return the value from accessibleNameForNode() instead of innerText(). The former falls back on the latter if there is no author-provided accessible name. Tests: accessibility/aria-label-on-label-element.html accessibility/label-with-pseudo-elements.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::textForLabelElement const): (WebCore::AccessibilityNodeObject::titleElementText const): 2018-03-16 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Fix crash on websocket with bad handshake message. https://bugs.webkit.org/show_bug.cgi?id=183686 Reviewed by Youenn Fablet. The closing cleanup was called multiple times. Add flag to detect it is already closed or not. No new tests because it is covered by existing test: - LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash.html * platform/network/curl/SocketStreamHandleImpl.h: * platform/network/curl/SocketStreamHandleImplCurl.cpp: (WebCore::SocketStreamHandleImpl::platformClose): (WebCore::SocketStreamHandleImpl::didReceiveData): 2018-03-16 Jer Noble <jer.noble@apple.com> Make Fullscreen API an Experimental Feature https://bugs.webkit.org/show_bug.cgi?id=183662 Reviewed by Jon Lee. The Fullscreen APIs should be guarded by a Setting, so they are not present in the DOM when the Experimental Feature is disabled. * dom/Document.idl: * dom/Element.idl: 2018-03-16 Megan Gardner <megan_gardner@apple.com> Ensure that style is updated when the effective appearance changes https://bugs.webkit.org/show_bug.cgi?id=183690 <rdar://problem/38385900> Reviewed by Tim Horton and Wenson Hsieh. Only exposing a function to outside WebCore, no tests needed. * page/Page.h: 2018-03-16 Chris Dumez <cdumez@apple.com> WebKit.RestoreSessionStateContainingScrollRestorationDefault API test is failing with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183679 Reviewed by Alex Christensen. Update CachedRawResource::didAddClient() to not send data until we've received the policy decision for the response. No new tests, covered by new API test. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::handleSubstituteDataLoadNow): (WebCore::DocumentLoader::responseReceived): * loader/DocumentLoader.h: * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::responseReceived): * loader/DocumentThreadableLoader.h: * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::responseReceived): * loader/MediaResourceLoader.h: * loader/appcache/ApplicationCacheResourceLoader.cpp: (WebCore::ApplicationCacheResourceLoader::responseReceived): * loader/appcache/ApplicationCacheResourceLoader.h: * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::didAddClient): (WebCore::CachedRawResource::responseReceived): * loader/cache/CachedRawResourceClient.h: (WebCore::CachedRawResourceClient::responseReceived): * loader/cache/KeepaliveRequestTracker.cpp: (WebCore::KeepaliveRequestTracker::responseReceived): * loader/cache/KeepaliveRequestTracker.h: * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h: * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: (WebCore::WebCoreAVFResourceLoader::responseReceived): 2018-03-16 Youenn Fablet <youenn@apple.com> Name Service Worker threads differently from regular Worker threads https://bugs.webkit.org/show_bug.cgi?id=183698 Reviewed by Chris Dumez. No observable change of behavior. For debugging purposes, knowing that a thread is a service worker thread might help give context. It might also identify on a crash log whether the process is a service worker process or a regular web process. * workers/WorkerThread.cpp: (WebCore::WorkerThread::start): * workers/WorkerThread.h: (WebCore::WorkerThread::isServiceWorkerThread const): * workers/service/context/ServiceWorkerThread.h: 2018-03-16 Youenn Fablet <youenn@apple.com> IceCandidates leak on webrtc/datachannel/basic.html and other tests https://bugs.webkit.org/show_bug.cgi?id=183676 <rdar://problem/36116228> Reviewed by Eric Carlson. Covered by manual testing using --leaks option on WK1. WebKit should not release the candidates since libwebrtc is not taking ownership. * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): 2018-03-16 Zan Dobersek <zdobersek@igalia.com> [Nicosia] Add Cairo-specific GraphicsContext operation recorder https://bugs.webkit.org/show_bug.cgi?id=183593 Reviewed by Carlos Garcia Campos. Add Nicosia::CairoOperationRecorder, GraphicsContextImpl implementation that records all GraphicsContext operations for deferred replay on a different thread. Recording here mostly consists of storing all the Cairo resources in a thread-safe manner, which is eased by the atomic reference counting used in Cairo. Nicosia::PaintingOperation derivatives are used for operations or state updates that require recording. Instances of these classes are appended to a Vector<> object that is then pushed into a thread pool in Nicosia::PaintingEngineThreaded , replaying all the operations against the Cairo context established from an associated target Nicosia::Buffer. This GraphicsContextImpl implementation is now used in the PaintingContextCairo::ForRecording constructor to construct the GraphicsContext implementation that will be used for recording. * platform/TextureMapper.cmake: * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: Added. (Nicosia::getContext): (Nicosia::OperationData::arg const const): (Nicosia::createCommand): (Nicosia::CairoOperationRecorder::CairoOperationRecorder): (Nicosia::m_commandList): (Nicosia::CairoOperationRecorder::updateState): (Nicosia::CairoOperationRecorder::clearShadow): (Nicosia::CairoOperationRecorder::setLineCap): (Nicosia::CairoOperationRecorder::setLineDash): (Nicosia::CairoOperationRecorder::setLineJoin): (Nicosia::CairoOperationRecorder::setMiterLimit): (Nicosia::CairoOperationRecorder::fillRect): (Nicosia::CairoOperationRecorder::fillRoundedRect): (Nicosia::CairoOperationRecorder::fillRectWithRoundedHole): (Nicosia::CairoOperationRecorder::fillPath): (Nicosia::CairoOperationRecorder::fillEllipse): (Nicosia::CairoOperationRecorder::strokeRect): (Nicosia::CairoOperationRecorder::strokePath): (Nicosia::CairoOperationRecorder::strokeEllipse): (Nicosia::CairoOperationRecorder::clearRect): (Nicosia::CairoOperationRecorder::drawGlyphs): (Nicosia::CairoOperationRecorder::drawImage): (Nicosia::CairoOperationRecorder::drawTiledImage): (Nicosia::CairoOperationRecorder::drawNativeImage): (Nicosia::CairoOperationRecorder::drawPattern): (Nicosia::CairoOperationRecorder::drawRect): (Nicosia::CairoOperationRecorder::drawLine): (Nicosia::CairoOperationRecorder::drawLinesForText): (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker): (Nicosia::CairoOperationRecorder::drawEllipse): (Nicosia::CairoOperationRecorder::drawPath): (Nicosia::CairoOperationRecorder::drawFocusRing): (Nicosia::CairoOperationRecorder::save): (Nicosia::CairoOperationRecorder::restore): (Nicosia::CairoOperationRecorder::translate): (Nicosia::CairoOperationRecorder::rotate): (Nicosia::CairoOperationRecorder::scale): (Nicosia::CairoOperationRecorder::concatCTM): (Nicosia::CairoOperationRecorder::setCTM): (Nicosia::CairoOperationRecorder::getCTM): (Nicosia::CairoOperationRecorder::beginTransparencyLayer): (Nicosia::CairoOperationRecorder::endTransparencyLayer): (Nicosia::CairoOperationRecorder::clip): (Nicosia::CairoOperationRecorder::clipOut): (Nicosia::CairoOperationRecorder::clipPath): (Nicosia::CairoOperationRecorder::clipBounds): (Nicosia::CairoOperationRecorder::applyDeviceScaleFactor): (Nicosia::CairoOperationRecorder::roundToDevicePixels): (Nicosia::CairoOperationRecorder::append): * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: Added. * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::ForRecording::ForRecording): 2018-03-16 Zan Dobersek <zdobersek@igalia.com> [TexMap] Clean up TextureMapperLayer constructor https://bugs.webkit.org/show_bug.cgi?id=183634 Reviewed by Michael Catanzaro. In the TextureMapperLayer header, only declare the constructor, and move all the previous member initialization to the point of declaration of these member variables. In the TextureMapperLayer implementation file, the constructor and destructor are moved into proper order at the top of the file. The former is defaulted, and the latter remains unchanged. No change in behavior. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::~TextureMapperLayer): * platform/graphics/texmap/TextureMapperLayer.h: 2018-03-16 Miguel Gomez <magomez@igalia.com> [GTK] When using EGL, request an OpenGL core profile when possible https://bugs.webkit.org/show_bug.cgi?id=178719 Reviewed by Carlos Garcia Campos. When using EGL and OpenGL, try to request a context with version >= 3.2 with a core profile whenever possible. In order to to this, we require EGL version 1.5 or version 1.4 with the extension EGL_KHR_create_context. If EGL requirements are not met, or we cannot get a context with version >= 3.2 then use whatever EGL gives us. Covered by existent tests. * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::createWindowContext): (WebCore::GLContextEGL::createPbufferContext): (WebCore::GLContextEGL::createSurfacelessContext): (WebCore::GLContextEGL::createContextForEGLVersion): * platform/graphics/egl/GLContextEGL.h: * platform/graphics/egl/GLContextEGLWPE.cpp: (WebCore::GLContextEGL::createWPEContext): * platform/graphics/egl/GLContextEGLWayland.cpp: (WebCore::GLContextEGL::createWaylandContext): * platform/graphics/egl/GLContextEGLX11.cpp: (WebCore::GLContextEGL::createPixmapContext): 2018-03-16 Zan Dobersek <zdobersek@igalia.com> [TexMap] Don't use the TextureMapperAnimation::Client interface to apply animation https://bugs.webkit.org/show_bug.cgi?id=183656 Reviewed by Carlos Garcia Campos. Don't have the TextureMapperLayer class inherit from the TextureMapperAnimation::Client interface just for the purposes of synchronization of animation-affected attributes in syncAnimations(). For that purpose it's enough to provide a struct that is passed to that method, and with the TextureMapperAnimation class filling out any of the animated attributes that need to be updated. TextureMapperAnimation::ApplicationResult struct is introducted for that purpose. std::optional<> members in it are assigned values during the application process, if an appropriate animation affects them. The relevant member values in TextureMapperLayer are then updated, or value from the default state is used. TextureMapperAnimation::Client is removed. No new tests -- no change in behavior. * platform/graphics/texmap/TextureMapperAnimation.cpp: (WebCore::TextureMapperAnimation::apply): (WebCore::TextureMapperAnimation::applyInternal): (WebCore::TextureMapperAnimations::apply): * platform/graphics/texmap/TextureMapperAnimation.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::syncAnimations): (WebCore::TextureMapperLayer::setAnimatedTransform): Deleted. (WebCore::TextureMapperLayer::setAnimatedOpacity): Deleted. (WebCore::TextureMapperLayer::setAnimatedFilters): Deleted. * platform/graphics/texmap/TextureMapperLayer.h: 2018-03-16 Devin Rousso <webkit@devinrousso.com> Web Inspector: Canvas Tab: main WebGL canvas on acko.net has no reported size https://bugs.webkit.org/show_bug.cgi?id=178798 <rdar://problem/35175740> Reviewed by Brian Burg. When the main frame navigates, the DOMAgent would recieve two InspectorInstrumentation calls, one when the frame begins its navigation and the other when the document for that frame has loaded. Both of these would discard the DOMAgent's bindings, which included the map of `nodeId`s. This was an issue for canvases, as the frontend would be notified whenever any canvas is created, which would usually occur before the `DOMContentLoaded` event is fired. As a result, the canvases would attempt to retrieve their associated node, only to have the DOMAgent discard those bindings quickly thereafter. This patch removes DOMAgent's and DOMDebuggerAgent's (parity) instrumentation hooks for the latter event, ensuring that the bindings are only discarded once. * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::mainFrameDOMContentLoaded): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated): Added. (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded): Deleted. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl): (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl): 2018-03-15 Tim Horton <timothy_horton@apple.com> Include CADisplayLink explicitly where needed, instead of all of CA https://bugs.webkit.org/show_bug.cgi?id=183689 <rdar://problem/38528719> Reviewed by Wenson Hsieh. * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: 2018-03-15 Tim Horton <timothy_horton@apple.com> Include MobileCoreServices in the WebCore prefix header https://bugs.webkit.org/show_bug.cgi?id=183688 <rdar://problem/38527621> Reviewed by Dan Bernstein. * WebCorePrefix.h: 2018-03-15 Megan Gardner <megan_gardner@apple.com> Create MediaQueryParserContext to provide additional context for the evaluation of media queries https://bugs.webkit.org/show_bug.cgi?id=183677 Reviewed by Tim Horton. We need additional context for parsing media queries to make sure they are parsed correctly and valid. Not currently testable, will add tests in a later patch. * WebCore.xcodeproj/project.pbxproj: * css/MediaList.cpp: (WebCore::MediaQuerySet::create): (WebCore::MediaQuerySet::set): (WebCore::MediaQuerySet::add): (WebCore::MediaQuerySet::remove): * css/MediaList.h: * css/MediaQueryEvaluator.cpp: (WebCore::MediaQueryEvaluator::mediaAttributeMatches): * css/MediaQueryExpression.cpp: (WebCore::featureWithValidIdent): (WebCore::featureWithValidDensity): (WebCore::featureWithValidPositiveLength): (WebCore::featureWithPositiveInteger): (WebCore::featureWithPositiveNumber): (WebCore::featureWithZeroOrOne): (WebCore::isFeatureValidWithoutValue): (WebCore::MediaQueryExpression::MediaQueryExpression): * css/MediaQueryExpression.h: * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::matchMedia): * css/MediaQueryParserContext.cpp: Added. (WebCore::MediaQueryParserContext::MediaQueryParserContext): * css/MediaQueryParserContext.h: Added. (WebCore::MediaQueryParserContext::MediaQueryParserContext): * css/StyleMedia.cpp: (WebCore::StyleMedia::matchMedium const): * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::StyleRuleImport): (WebCore::StyleRuleImport::setCSSStyleSheet): * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::operator==): * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumeImportRule): (WebCore::CSSParserImpl::consumeMediaRule): * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::parseMediaQuerySet): (WebCore::MediaQueryParser::parseMediaCondition): (WebCore::MediaQueryParser::MediaQueryParser): (WebCore::MediaQueryData::addExpression): * css/parser/MediaQueryParser.h: (WebCore::MediaQueryData::setMediaQueryParserContext): * css/parser/SizesAttributeParser.cpp: (WebCore::SizesAttributeParser::parse): * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createCSSStyleSheet): * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::createSheet): * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::setCSSStyleSheet): * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): (WebCore::HTMLLinkElement::initializeStyleSheet): (WebCore::HTMLLinkElement::setCSSStyleSheet): * html/HTMLLinkElement.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::selectNextSourceChild): * html/HTMLSourceElement.cpp: (WebCore::HTMLSourceElement::parsedMediaAttribute const): * html/HTMLSourceElement.h: * html/HTMLStyleElement.cpp: (WebCore::HTMLStyleElement::parseAttribute): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): 2018-03-15 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229639. https://bugs.webkit.org/show_bug.cgi?id=183683 it is causing a crash in API tests (Requested by youenn on #webkit). Reverted changeset: "ActiveDOMObject should assert that they are destroyed in the thread they are created" https://bugs.webkit.org/show_bug.cgi?id=183671 https://trac.webkit.org/changeset/229639 2018-03-15 Youenn Fablet <youenn@apple.com> Bad configuration parameters should make RTCPeerConnection constructor throw https://bugs.webkit.org/show_bug.cgi?id=183615 Reviewed by Eric Carlson. Implement more of https://w3c.github.io/webrtc-pc/#set-pc-configuration. Throw an error whenever underlying libwebrtc set configuration fails. Covered by rebased test. * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::iceServersFromConfiguration): (WebCore::RTCPeerConnection::initializeConfiguration): (WebCore::RTCPeerConnection::setConfiguration): * Modules/mediastream/RTCPeerConnection.js: (initializeRTCPeerConnection): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: 2018-03-15 Youenn Fablet <youenn@apple.com> replaceTrack triggers negotiationneeded https://bugs.webkit.org/show_bug.cgi?id=180342 <rdar://problem/35822426> Reviewed by Eric Carlson. Covered by updated test. Fix the case of replacing a track for which data is already flowing. We should probably do the same for null tracks when fully implementing transceivers. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::enqueueReplaceTrackTask): 2018-03-15 Keith Rollin <krollin@apple.com> Telemetry for stalled webpage loads https://bugs.webkit.org/show_bug.cgi?id=183221 <rdar://problem/36549013> Reviewed by Chris Dumez. Add telemetry for page loads, tracking the pages that succeed, fail, or are canceled. This information will be used to track the overall health of our page loading as time goes on. No new tests -- no new/changed user-level functionality. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey): (WebCore::DiagnosticLoggingKeys::timedOutKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::occurredKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey): * page/DiagnosticLoggingKeys.h: * platform/network/cf/ResourceError.h: (WebCore::ResourceError::ResourceError): * platform/network/mac/ResourceErrorMac.mm: (WebCore::ResourceError::ResourceError): (WebCore::ResourceError::getNSURLErrorDomain const): (WebCore::ResourceError::getCFErrorDomainCFNetwork const): (WebCore::ResourceError::mapPlatformError): 2018-03-15 Youenn Fablet <youenn@apple.com> ActiveDOMObject should assert that they are destroyed in the thread they are created https://bugs.webkit.org/show_bug.cgi?id=183671 Reviewed by Chris Dumez. No change of behavior. Moved MessagePort assertion to ActiveDOMObject. * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::~ActiveDOMObject): * dom/ActiveDOMObject.h: * dom/MessagePort.cpp: (WebCore::MessagePort::~MessagePort): * dom/MessagePort.h: 2018-03-15 Youenn Fablet <youenn@apple.com> MessagePort is not always destroyed on the right thread https://bugs.webkit.org/show_bug.cgi?id=183619 <rdar://problem/38204711> Reviewed by Chris Dumez. Add assertion to ensure MessagePort is destroyed in the right thread. Modify methods taking a ref in a lambda to rely on weak pointers and refing the WorkerThread if in a worker context. It is safe to ref the WorkerThread since it is thread safe ref counted and we are passing the ref to the main thread where the WorkerThread is expected to be destroyed. Test: http/tests/workers/worker-messageport-2.html * dom/MessagePort.cpp: (WebCore::MessagePort::~MessagePort): (WebCore::MessagePort::dispatchMessages): (WebCore::MessagePort::updateActivity): (WebCore::MessagePort::hasPendingActivity const): * dom/MessagePort.h: 2018-03-15 Jer Noble <jer.noble@apple.com> Adopt new AVURLAssetUseClientURLLoadingExclusively AVURLAsset creation option. https://bugs.webkit.org/show_bug.cgi?id=183660 Reviewed by Jon Lee. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): 2018-03-15 Chris Dumez <cdumez@apple.com> Unreviewed, fix tiny mistake in r229615 that caused API tests failures. * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistrationFromStore): 2018-03-15 Zan Dobersek <zdobersek@igalia.com> [TexMap] Remove TextureMapperLayer::texture() https://bugs.webkit.org/show_bug.cgi?id=183635 Reviewed by Michael Catanzaro. Remove the unused TextureMapperLayer::texture() method. This enables removing the virtual TextureMapperBackingStore::texture() method, as well as the implementations of it in TextureMapperTiledBackingStore and CoordinatedBackingStore classes. No change in behavior. * platform/graphics/texmap/TextureMapperBackingStore.h: * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp: (WebCore::TextureMapperTiledBackingStore::texture const): Deleted. * platform/graphics/texmap/TextureMapperTiledBackingStore.h: 2018-03-15 Zan Dobersek <zdobersek@igalia.com> [TexMap] Don't bother caching pattern transform matrix https://bugs.webkit.org/show_bug.cgi?id=183633 Reviewed by Michael Catanzaro. Remove the m_patternTransform and m_patternTransformDirty member variables from the TextureMapperLayer class. These unnecessarily complicate the state update methods that need to compare the given attribute against the current state, and only update it if it has changed. Instead, compute the pattern TransformationMatrix value on-the-fly in the paintSelf() method, if at all necessary. No change in functionality. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelf): (WebCore::TextureMapperLayer::setContentsRect): (WebCore::TextureMapperLayer::setContentsTileSize): (WebCore::TextureMapperLayer::setContentsTilePhase): (WebCore::TextureMapperLayer::computePatternTransformIfNeeded): Deleted. * platform/graphics/texmap/TextureMapperLayer.h: 2018-03-14 John Wilander <wilander@apple.com> Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory() https://bugs.webkit.org/show_bug.cgi?id=183641 <rdar://problem/38469497> Reviewed by Brent Fulgham and Chris Dumez. No new tests. This change is to stabilize existing layout tests. See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620. * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::removeAllStorageAccess): New function to clear out all storage access entries. 2018-03-14 Youenn Fablet <youenn@apple.com> imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.worker.html is crashing https://bugs.webkit.org/show_bug.cgi?id=183602 Reviewed by Chris Dumez. Introduce a map of ScriptExecutionContext that is read/write protected using a Lock. This allows introducing postTaskTo taking a ScriptExecutionContext identifier and callable from any thread. Use that method in Crypto instead of refing/unrefing the context. Lock only happens if context does some postTask activity. This is governed by calling or not the new contextIdentifier() getter. Covered by crypto tests no longer failing m_workerGlobalScope->hasOneRef() assertion. * crypto/CryptoAlgorithm.cpp: (WebCore::dispatchAlgorithmOperation): * crypto/algorithms/CryptoAlgorithmECDH.cpp: (WebCore::CryptoAlgorithmECDH::deriveBits): * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::digest): * crypto/algorithms/CryptoAlgorithmSHA224.cpp: (WebCore::CryptoAlgorithmSHA224::digest): * crypto/algorithms/CryptoAlgorithmSHA256.cpp: (WebCore::CryptoAlgorithmSHA256::digest): * crypto/algorithms/CryptoAlgorithmSHA384.cpp: (WebCore::CryptoAlgorithmSHA384::digest): * crypto/algorithms/CryptoAlgorithmSHA512.cpp: (WebCore::CryptoAlgorithmSHA512::digest): * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: (WebCore::CryptoKeyRSA::generatePair): * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair): * dom/Document.cpp: (WebCore::Document::~Document): * dom/ScriptExecutionContext.cpp: (WebCore::allScriptExecutionContextsMapLock): (WebCore::ScriptExecutionContext::ScriptExecutionContext): (WebCore::ScriptExecutionContext::removeFromContextsMap): (WebCore::ScriptExecutionContext::checkConsistency const): (WebCore::ScriptExecutionContext::postTaskTo): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::contextIdentifier const): * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::~WorkerGlobalScope): 2018-03-14 Chris Dumez <cdumez@apple.com> Reduce use of SWServerToContextConnection::globalServerToContextConnection() https://bugs.webkit.org/show_bug.cgi?id=183626 Reviewed by Youenn Fablet. Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving towards having multiple context connections. No new tests, no expected behavior change. * workers/service/server/SWServer.cpp: (WebCore::SWServer::matchAll): (WebCore::SWServer::serverToContextConnectionCreated): (WebCore::SWServer::runServiceWorkerIfNecessary): (WebCore::SWServer::runServiceWorker): (WebCore::SWServer::terminateWorkerInternal): (WebCore::SWServer::markAllWorkersAsTerminated): (WebCore::SWServer::workerContextTerminated): (WebCore::SWServer::fireInstallEvent): (WebCore::SWServer::fireActivateEvent): * workers/service/server/SWServer.h: * workers/service/server/SWServerToContextConnection.cpp: (WebCore::SWServerToContextConnection::findClientByIdentifier): (WebCore::SWServerToContextConnection::matchAll): (WebCore::SWServerToContextConnection::claim): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::contextConnection): (WebCore::SWServerWorker::matchAll): * workers/service/server/SWServerWorker.h: 2018-03-14 Youenn Fablet <youenn@apple.com> MessagePort should remove its listeners when being closed https://bugs.webkit.org/show_bug.cgi?id=183644 Reviewed by Chris Dumez. Test: http/tests/workers/worker-messageport.html * dom/MessagePort.cpp: (WebCore::MessagePort::close): (WebCore::MessagePort::contextDestroyed): 2018-03-14 Chris Dumez <cdumez@apple.com> Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated() https://bugs.webkit.org/show_bug.cgi?id=183624 Reviewed by Youenn Fablet. Pass in context connection to SWServer::serverToContextConnectionCreated() to avoid relying on the deprecated globalServerToContextConnection(). No new tests, no expected behavior change. * workers/service/server/SWServer.cpp: (WebCore::SWServer::serverToContextConnectionCreated): * workers/service/server/SWServer.h: 2018-03-14 Mark Lam <mark.lam@apple.com> Enhance the MacroAssembler and LinkBuffer to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183623 <rdar://problem/38443314> Reviewed by Michael Saboff. No new tests. Just adding PtrTags required by new MacroAssembler API. * cssjit/FunctionCall.h: (WebCore::FunctionCall::prepareAndCall): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::compile): 2018-03-14 Chris Fleizach <cfleizach@apple.com> AX: Implement accessible dismiss action on iOS https://bugs.webkit.org/show_bug.cgi?id=183352 <rdar://problem/38161500> Reviewed by Zalan Bujtas. Test: accessibility/ios-simulator/AOM-dismiss-event.html * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityPerformEscape]): 2018-03-14 Youenn Fablet <youenn@apple.com> Update libwebrtc up to 36af4e9614f707f733eb2340fae66d6325aaac5b https://bugs.webkit.org/show_bug.cgi?id=183481 Reviewed by Eric Carlson. Covered by existing tests. Updated libwebrtc binding code. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::fillEncodingParameters): * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: 2018-03-14 Tim Horton <timothy_horton@apple.com> Fix the build after r229567 * Configurations/FeatureDefines.xcconfig: 2018-03-13 John Wilander <wilander@apple.com> Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document https://bugs.webkit.org/show_bug.cgi?id=183620 <rdar://problem/38431469> Reviewed by Brent Fulgham. Tests: http/tests/storageAccess/deny-storage-access-under-opener.html http/tests/storageAccess/grant-storage-access-under-opener.html It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577 wasn't enough to address the compatibility issues with popups. Some of them just detect their unpartitioned cookies, auto-dismiss themselves, and expect their unpartitioned cookies to be available under the opener afterwards. We should grant them access if the popup's domain has had user interaction _previously_. Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577 because if the popup's domain has not received user interaction previously, we will not grant it storage access on just the window open. * dom/Document.cpp: (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction): (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction): (WebCore::Document::hasGrantedPageSpecificStorageAccess): Deleted. (WebCore::Document::setHasGrantedPageSpecificStorageAccess): Deleted. Renamed from *Granted* to *Requested* since there is now a case where access will not be granted, i.e. when the popup domain has not had user interaction previously. * dom/Document.h: * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback): Renamed *Grant* to *Request*. (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): (WebCore::ResourceLoadObserver::logWindowCreation): New function called from DOMWindow::createWindow(). (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener): New convenience function. (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback): Deleted. Renamed *Grant* to *Request*. * loader/ResourceLoadObserver.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::createWindow): Now calls ResourceLoadObserver::logWindowCreation() if a window was created and the opener has a document and a page ID. 2018-03-13 Chris Dumez <cdumez@apple.com> fast/loader/javascript-url-iframe-remove-on-navigate.html is a flaky crash on iOS with async delegates https://bugs.webkit.org/show_bug.cgi?id=183610 Reviewed by Youenn Fablet. The issue was that in DocumentLoader::loadMainResource(), the call to requestMainResource() which return null due to the load getting cancelled synchronously. If this load is the parent frame's last pending load, then the 'load' event gets fired in the parent frame. In the test, the parent frame's load event handler does a document.write() call which blows away the iframe. As a result, when we return from the requestMainResource(), m_frame is null and we crash later on dereferencing it. No new tests, covered by fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html which was crashing flakily. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::loadMainResource): 2018-03-13 Jer Noble <jer.noble@apple.com> [iOS] Muted media playback can interrupt out-of-process audio https://bugs.webkit.org/show_bug.cgi?id=183606 <rdar://problem/37466253> Reviewed by Eric Carlson. Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set. A non-playing, non-muted media element will cause the AVAudioSession category to be set to "playing" when a muted media element begins playback. Ignore these non-playing elements for the purposes of determining the AVAudioSession category. * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: (PlatformMediaSessionManager::updateSessionState): 2018-03-13 Youenn Fablet <youenn@apple.com> Calling removeTrack with RTCRtpSender does not set SenderTrack to null https://bugs.webkit.org/show_bug.cgi?id=183308 Reviewed by Eric Carlson. Covered by updated test. * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed. * Modules/mediastream/RTCRtpSender.h: 2018-03-13 Youenn Fablet <youenn@apple.com> Changing link element rel attribute from preload to stylesheet should succeed loading the stylesheet https://bugs.webkit.org/show_bug.cgi?id=183601 <rdar://problem/38309441> Reviewed by Antti Koivisto. Test: http/wpt/preload/change-link-rel-attribute.html * loader/LinkPreloadResourceClients.h: (WebCore::LinkPreloadResourceClient::clearResource): Remove the call to CachedResource::cancelLoad. This call is expected to be called by ResourceLoader when cancelling the load from below CachedResource. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::allClientsRemoved): In case of preload, cancel the load if not finished when there is no more client attached to it. * loader/cache/CachedResource.h: 2018-03-12 John Wilander <wilander@apple.com> Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document https://bugs.webkit.org/show_bug.cgi?id=183577 <rdar://problem/38266987> Reviewed by Brent Fulgham. Tested manually on live websites. No new automated tests because of a bug in WebKitTestRunner: https://bugs.webkit.org/show_bug.cgi?id=183578 The event sender triggers gestures in the opener rather than in the popup. * dom/Document.cpp: (WebCore::Document::removedLastRef): Clears the new m_primaryDomainsGrantedPageSpecificStorageAccess. (WebCore::Document::hasGrantedPageSpecificStorageAccess): (WebCore::Document::setHasGrantedPageSpecificStorageAccess): * dom/Document.h: Added member m_primaryDomainsGrantedPageSpecificStorageAccess where we store domains that have been granted access. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback): (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): Now checks if there is a cross-origin opener and if so, immediately grants cookie access to the popup's domain if it is partitioned or blocked. * loader/ResourceLoadObserver.h: * platform/network/NetworkStorageSession.h: Added member m_pagesGrantedStorageAccess. * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::cookieStoragePartition const): (WebCore::NetworkStorageSession::hasStorageAccess const): Renamed from hasStorageAccessForFrame since the frameID now is optional. (WebCore::NetworkStorageSession::grantStorageAccess): Renamed from grantStorageAccessForFrame since the frameID now is optional. (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Now removes the pageID entry in m_pagesGrantedStorageAccess. (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Deleted. Renamed since the frameID now is optional. (WebCore::NetworkStorageSession::grantStorageAccessForFrame): Deleted. Renamed since the frameID now is optional. 2018-03-12 Tim Horton <timothy_horton@apple.com> Stop using SDK conditionals to control feature definitions https://bugs.webkit.org/show_bug.cgi?id=183430 <rdar://problem/38251619> Reviewed by Dan Bernstein. * Configurations/FeatureDefines.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: Renamed. 2018-03-12 Chris Dumez <cdumez@apple.com> Return boolean from DOMTokenList's replace() method https://bugs.webkit.org/show_bug.cgi?id=183567 Reviewed by Youenn Fablet. Have DOMTokenList's replace() method return a boolean indicating if the token was replaced, as per: - https://dom.spec.whatwg.org/#dom-domtokenlist-replace This is a recent addition to the DOM specification: - https://github.com/whatwg/dom/pull/582 No new tests, rebaselined existing test. * html/DOMTokenList.cpp: (WebCore::replaceInOrderedSet): (WebCore::DOMTokenList::replace): * html/DOMTokenList.h: * html/DOMTokenList.idl: 2018-03-12 Brian Burg <bburg@apple.com> Ignore some deprecation warnings encountered when compiling with newer versions of ICU https://bugs.webkit.org/show_bug.cgi?id=183584 <rdar://problem/38395317> Reviewed by Daniel Bates. Ignore new deprecation warnings. Where a function has more than one deprecation warning, mark out the entire function so it remains readable. * editing/TextIterator.cpp: * platform/graphics/SurrogatePairAwareTextIterator.cpp: (WebCore::SurrogatePairAwareTextIterator::normalizeVoicingMarks): * platform/text/TextEncoding.cpp: 2018-03-12 Yoav Weiss <yoav@yoav.ws> Runtime flag for link prefetch and remove link subresource. https://bugs.webkit.org/show_bug.cgi?id=183540 Reviewed by Chris Dumez. This patch removes the LINK_PREFETCH build time flag, removes link subresource, adds an off-by-default runtime flag for link prefetch and makes sure link prefetch only works when this flag is on. Subresource is removed as it's not a part of any spec, nor supported by any other browser. It was replaced by link preload. No new tests as this is not adding any new functionality. * Configurations/FeatureDefines.xcconfig: Remove the LINK_PREFETCH flag. * html/LinkRelAttribute.cpp: (WebCore::LinkRelAttribute::LinkRelAttribute): Put prefetch support behind the runtime flag. (WebCore::LinkRelAttribute::isSupported): Add prefetch. * html/LinkRelAttribute.h: Remove the LINK_PREFETCH flag. * loader/LinkLoader.cpp: (WebCore::createLinkPreloadResourceClient): Remove the LINK_PREFETCH flag. (WebCore::LinkLoader::prefetchIfNeeded): Move the prefetch code to `prefetchIfNeeded()`. Remove subresource bits. (WebCore::LinkLoader::loadLink): Call `prefetchIfNeeded()`. * loader/LinkLoader.h: * loader/ResourceLoadInfo.cpp: (WebCore::toResourceType): Remove the LINK_PREFETCH flag as well as subresource. * loader/SubresourceLoader.cpp: (WebCore::logResourceLoaded): Remove the LINK_PREFETCH flag as well as subresource. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::defaultPriorityForResourceType): Remove the LINK_PREFETCH flag as well as subresource. (WebCore::CachedResource::load): Remove the LINK_PREFETCH flag. * loader/cache/CachedResource.h: (WebCore::CachedResource::ignoreForRequestCount const): Remove the LINK_PREFETCH flag as well as subresource. * loader/cache/CachedResourceLoader.cpp: (WebCore::createResource): Remove the LINK_PREFETCH flag as well as subresource. (WebCore::CachedResourceLoader::requestLinkResource): Remove subresource. (WebCore::contentTypeFromResourceType): Remove the LINK_PREFETCH flag as well as subresource. (WebCore::CachedResourceLoader::checkInsecureContent const): Remove the LINK_PREFETCH flag as well as subresource. (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Remove the LINK_PREFETCH flag as well as subresource. * loader/cache/CachedResourceLoader.h: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setLinkPrefetchEnabled): Set the prefetch flag. (WebCore::RuntimeEnabledFeatures::linkPrefetchEnabled const): Get the prefetch flag. 2018-03-12 Youenn Fablet <youenn@apple.com> RTCPeerConnection's close method should update signalingState https://bugs.webkit.org/show_bug.cgi?id=174314 <rdar://problem/33267977> Reviewed by Eric Carlson. Covered by rebased test. Add closed as signalingState enum value. Set peer connection signaling state to closed once close is called. * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::doClose): * Modules/mediastream/RTCSignalingState.idl: * platform/mediastream/RTCSignalingState.h: 2018-03-12 Mark Lam <mark.lam@apple.com> Make a NativeFunction into a class to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183573 <rdar://problem/38384697> Reviewed by Filip Pizlo. No new tests because there's no new behavior. Only updating bindings. * bindings/scripts/CodeGeneratorJS.pm: (GenerateHashTableValueArray): * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: 2018-03-12 Tim Horton <timothy_horton@apple.com> Use a different SPI header for some AudioToolbox enums https://bugs.webkit.org/show_bug.cgi?id=183574 <rdar://problem/38385889> Reviewed by Anders Carlsson. * platform/audio/ios/AudioDestinationIOS.cpp: * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: Adjust SPI imports. 2018-03-12 Danyao Wang <danyao@chromium.org> Add a query and fragment exception to history API's unique origin restriction. https://bugs.webkit.org/show_bug.cgi?id=183028 Reviewed by Brent Fulgham. Tests: http/tests/navigation/pushstate-at-unique-origin-denied.php Tools/TestWebKitAPI/Tests/WebCore/URL.cpp * page/History.cpp: (WebCore::History::stateObjectAdded): 2018-03-12 Antti Koivisto <antti@apple.com> Don't invalidate descendants for nth pseudo classes unless needed https://bugs.webkit.org/show_bug.cgi?id=183566 Reviewed by Zalan Bujtas. We currently invalidate the whole subtrees that may match :nth-child and similar. In many common cases we know that only the direct siblings may be affected. * css/SelectorChecker.cpp: (WebCore::localContextForParent): (WebCore::SelectorChecker::matchRecursively const): Track if the context matches the subject element if the selector or its siblings only. (WebCore::SelectorChecker::checkOne const): Use different bits of descendant and child invalidation cases. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentMatchesRightmostOrAdjacentElement): (WebCore::SelectorCompiler::constructFragmentsInternal): Track if the context matches the subject element if the selector or its siblings only. (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild): Use different bits of descendant and child invalidation cases. * dom/Element.cpp: (WebCore::invalidateForForwardPositionalRules): (WebCore::invalidateForBackwardPositionalRules): Invalidate more precisely based on the new bits. (WebCore::checkForSiblingStyleChanges): (WebCore::Element::setDescendantsAffectedByForwardPositionalRules): (WebCore::Element::setDescendantsAffectedByBackwardPositionalRules): (WebCore::Element::hasFlagsSetDuringStylingOfChildren const): (WebCore::Element::rareDataDescendantsAffectedByForwardPositionalRules const): (WebCore::Element::rareDataDescendantsAffectedByBackwardPositionalRules const): New bits. * dom/Element.h: (WebCore::Element::descendantsAffectedByForwardPositionalRules const): (WebCore::Element::descendantsAffectedByBackwardPositionalRules const): * dom/ElementRareData.h: (WebCore::ElementRareData::descendantsAffectedByForwardPositionalRules const): (WebCore::ElementRareData::setDescendantsAffectedByForwardPositionalRules): (WebCore::ElementRareData::descendantsAffectedByBackwardPositionalRules const): (WebCore::ElementRareData::setDescendantsAffectedByBackwardPositionalRules): (WebCore::ElementRareData::ElementRareData): (WebCore::ElementRareData::resetStyleRelations): * style/StyleRelations.cpp: (WebCore::Style::commitRelationsToRenderStyle): (WebCore::Style::commitRelations): * style/StyleRelations.h: 2018-03-12 Javier Fernandez <jfernandez@igalia.com> Remove GridLayout runtime flag https://bugs.webkit.org/show_bug.cgi?id=183484 Reviewed by Myles C. Maxfield. The Grid Layout feature has been enabled by default for almost a year, so I think it's time to remove the runtime flag and the codepath run when the feature is disabled. No new tests, because there are no changes in functionality. * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment): (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertContentAlignmentData): * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): (WebCore::operator==): * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * css/parser/CSSParserMode.h: (WebCore::CSSParserContextHash::hash): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): * dom/Document.cpp: * dom/Document.h: * page/RuntimeEnabledFeatures.h: * rendering/RenderFlexibleBox.cpp: (WebCore::alignmentOffset): * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialDefaultAlignment): * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2018-03-12 Antoine Quint <graouts@apple.com> [Web Animations] Implement CSS Animations and CSS Transitions as Web Animations https://bugs.webkit.org/show_bug.cgi?id=183504 <rdar://problem/38372965> Reviewed by Dean Jackson and Jon Lee. Tests: webanimations/css-animations.html webanimations/css-transitions.html This patch implements CSS Animations and CSS Transitions as Web Animations. The main changes are: * StyleTreeResolver: StyleTreeResolver now has a code path to add CSSAnimation and CSSTransition objects onto the DocumentTimeline to be picked up by the Web Animations engine. The previous CSSAnimationController code path is preserved if the runtime flag is disabled. * AnimationTimeline: we add two new methods, updateCSSAnimationsForElement() and updateCSSTransitionsForElement() which are called from TreeResolver::createAnimatedElementUpdate(). These look at the AnimationList for the old and new RenderStyle objects and create, update and remove matching CSSAnimation and CSSTransition instances. * DeclarativeAnimation: a new superclass to both CSSAnimation and CSSTransition which introduces the concept of a backingAnimation(), which is an Animation held by the RenderStyle objects, and two virtual methods with base implementations, initialize() which is called upon creating by create() methods in subclasses, and syncPropertiesWithBackingAnimation() which ensures that properties on the DeclarativeAnimation objects (Web Animations side) match the backing animation (CSS side). * KeyframeEffectReadOnly: two new important methods to create blending keyframes (KeyframeList) based on backing Animation objects, computeCSSAnimationBlendingKeyframes() and computeCSSTransitionBlendingKeyframes(). * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffectReadOnly.h: (WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const): We fix this method such that calling it on a KeyframeEffect, which is a subclass of KeyframeEffectReadOnly, returns true. * animation/AnimationEffectTimingReadOnly.cpp: In order for DeclarativeAnimation::syncPropertiesWithBackingAnimation() to set the timing function for a declarative animation's effect, we need a public method to set an effect's timing function outside of just the "easing" property setter exposed via the JS API. So we introduce a setTimingFunction() method and call it from setEasing(). (WebCore::AnimationEffectTimingReadOnly::setEasing): (WebCore::AnimationEffectTimingReadOnly::setTimingFunction): * animation/AnimationEffectTimingReadOnly.h: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::~AnimationTimeline): Clear all maps and sets containing WebAnimation references to ensure these get destructed when the AnimationTimeline is being destructed and should no longer hold a reference to them. (WebCore::AnimationTimeline::relevantMapForAnimation): We store various subclasses of WebAnimation in dedicated maps so we can composite animations in the correct order when animating. This function returns the correct map for a given animation such that animationWasAddedToElement() and animationWasRemovedFromElement() mutate the right map. (WebCore::AnimationTimeline::animationWasAddedToElement): (WebCore::AnimationTimeline::animationWasRemovedFromElement): (WebCore::AnimationTimeline::animationsForElement): Make sure to look for animations in the lists of CSS Animations and CSS Transitions as well as Web Animations. (WebCore::AnimationTimeline::updateCSSAnimationsForElement): This method is called by TreeResolver::createAnimatedElementUpdate() during style resolution. It compares the AnimationList of the previous style and the new style for a given element, checks that animations with a given name that were not present in the old AnimationList have a new matching CSSAnimation object for them added to the AnimationTimeline, that animations with a given name that are no longer present in the new AnimationList have their matching CSSAnimation object removed from the AnimationTimeline, and that animations with a given name that are present in both the old and new AnimationList have their matching CSSAnimation updated to match the current state of the animation in the AnimationList. (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Similarly to updateCSSAnimationsForElement(), this method is called during style resolution by TreeResolver::createAnimatedElementUpdate(). Its role is to create or remove CSSTransition objects based on the AnimationList found in the old and new styles for a given element. It follows a slightly different logic than updateCSSAnimationsForElement() since for CSS Transitions, there is no need to update CSSTransition objects for a CSS property existing in both the old and new AnimationList, since when a CSS transitions property is changed, a whole new transition is initiated. However, it's important to check that different Animation objects and styles would actually result in different timing properties and blending keyframes, so check for this as well before creating new CSSTransition objects. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::animations const): Change the m_animations type from HashSet to ListHashSet to guarantee we preserve the insertion order which is required by getAnimations(). (WebCore::AnimationTimeline::hasElementAnimations const): Indicates to DocumentTimeline::updateAnimations() that there are animations targeting the provided element. (WebCore::AnimationTimeline::elementToAnimationsMap): (WebCore::AnimationTimeline::elementToCSSAnimationsMap): (WebCore::AnimationTimeline::elementToCSSTransitionsMap): * animation/CSSAnimation.cpp: CSSAnimation is now a subclass of DeclarativeAnimation and subclasses initialize() and syncPropertiesWithBackingAnimation() to perform work specific to CSS Animations. (WebCore::CSSAnimation::create): Set the animationName property based on the provided backing animation. (WebCore::CSSAnimation::CSSAnimation): (WebCore::CSSAnimation::initialize): Create the blending keyframes for this CSSAnimation. (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Reflect the animation-fill-mode, animation-direction, animation-iteration-count and animation-play-state CSS properties on the AnimationEffectTimingReadOnly object associated with this CSSAnimation. * animation/CSSAnimation.h: * animation/CSSTransition.cpp: CSSTransition is now a subclass of DeclarativeAnimation. (WebCore::CSSTransition::create): Set the transitionProperty property based on the provided backing animation. (WebCore::CSSTransition::CSSTransition): (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): (WebCore::CSSTransition::canBeListed const): Subclass this method such that we also check that we have blending keyframes for a CSSTransition to be listed by calls to getAnimations(). * animation/CSSTransition.h: * animation/DeclarativeAnimation.cpp: Added. This new WebAnimation subclass now is the common base class for both CSSAnimation and CSSTransition. It establishes a relationship with a "backing animation", which is an Animation obtained from a style's AnimationList while resolving styles. These backing animations contain all of the parsed CSS styles related to CSS Animations and CSS Transitions and we use those to set matching properties of the Web Animations timing model in the new syncPropertiesWithBackingAnimation() virtual method, which subclasses can override to perform further work that is specific to a given declarative animation type. The initialize() method is called during create() methods to perform common animation setup work. Note that while both initialize() and syncPropertiesWithBackingAnimation() are called, we suspend invalidation to that animation's effect since these methods are meant to be called during style invalidation and we would hit an assertion if we followed the usual route of calling updateStyleIfNeeded() on the target's document during invalidation. (WebCore::DeclarativeAnimation::DeclarativeAnimation): (WebCore::DeclarativeAnimation::setBackingAnimation): (WebCore::DeclarativeAnimation::initialize): Create a KeyframeEffectReadOnly for this animation and set the provided element as its target, set that element's document's timeline and play the animation if the backing animation's play state is playing. (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): Reflect the {animation|transition}-delay, {animation|transition}-duration and {animation|transition}-timing-function properties as set on the backing animation. * animation/DeclarativeAnimation.h: Added. (WebCore::DeclarativeAnimation::backingAnimation const): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::updateAnimations): Trigger style invalidation for elements targeted not just by WebAnimation instances, but also by any of the DeclarativeAnimation subclasses. We also remove the call to updateFinishedState() which should have been removed when we implemented correct support for asynchronous WebAnimation operations. (WebCore::DocumentTimeline::animatedStyleForRenderer): Declarative animations are backed by KeyframeEffectReadOnly effects, so make sure we check for KeyframeEffectReadOnly or one of its subclasses and not just KeyframeEffect since there now are animation types that use the ReadOnly variant. (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): Same as for animatedStyleForRenderer, check for KeyframeEffectReadOnly and not simply KeyframeEffect. * animation/KeyframeEffectReadOnly.cpp: (WebCore::invalidateElement): Stop forcing a style resolution as we invalidate element, marking them as dirty is sufficient. Calls to getAnimations() already force a style resolution as needed. (WebCore::KeyframeEffectReadOnly::create): Add a new create() method that only provides a target and which is used by DeclarativeAnimation::initialize(). (WebCore::KeyframeEffectReadOnly::getKeyframes): The previous implementation of getKeyframes() used the ParsedKeyframe list held as m_parsedKeyframes to compute keyframes. In the case of declarative animations, there are no ParsedKeyframe since the JS API was not involved, so we use the blending keyframes to look for keyframe data. (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Called by CSSAnimation::initialize(), this function creates blending keyframes by looking up the keyframes date obtained from the @keyframes rule with this backing animation's name. (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Called by CSSTransition::create(), this function creates blending keyframes by creating a 0-offset keyframe with the old style and a 1-offset keyframe with the new style as provided during TreeResolver::createAnimatedElementUpdate(). (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Called by AnimationTimeline::updateCSSTransitionsForElement() to check that a provided backing Animation and a pair of old and new RenderStyles that may be different objects actually would yield different timing properties and keyframe CSS values for a given CSS transition to avoid the deletion and creation of CSSTransition objects. (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): We mistakenly assumed we always had blending keyframes, which is not always the case with a CSSTransition where the transition style itself might be set first, but the target value after. So we should only run accelerated provided there are blending keyframes at least, the function already returning false if it finds a blending keyframe animating a non-accelerated CSS property. (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): Check that there actually is a matching ParsedKeyframe to read the timing function from. * animation/KeyframeEffectReadOnly.h: (WebCore::KeyframeEffectReadOnly::hasBlendingKeyframes const): * animation/WebAnimation.cpp: (WebCore::WebAnimation::~WebAnimation): We used to do something very wrong when a WebAnimation was destroyed which uncovered crashes when dealing with declarative animations. In AnimationTimeline's updateCSSAnimationsForElement() and updateCSSTransitionsForElement(), when we identify that a DeclarativeAnimation no longer matches an Animation from the current style's AnimationList, we set that DeclarativeAnimation's effect to null and call removeAnimation() on the timeline. This removes all references from AnimationTimeline to this DeclarativeAnimation and leads to ~WebAnimation being called. Calling removeAnimation() again in the destructor means that we'd hit ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun) in ref(). It was also meaningless to perform this work in the WebAnimation destructor since an animation could never be destroyed if it were still registered on a timeline. (WebCore::WebAnimation::suspendEffectInvalidation): DeclarativeAnimation instances have their timing model properties set during style invalidation, so we need a mechanism to allow the usual effect invalidation to be suspended in this case. We now maintain a simple m_suspendCount count that increases and decreases with calls to this method and unsuspendEffectInvalidation() and a isEffectInvalidationSuspended() method returning true whenever that count is positive. (WebCore::WebAnimation::unsuspendEffectInvalidation): (WebCore::WebAnimation::timingModelDidChange): Check that effect invalidation is not suspended before proceeding with invalidating the effect. (WebCore::WebAnimation::setEffect): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects. (WebCore::WebAnimation::setTimeline): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects. (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Ensure that the WebAnimation's lifecycle is extended at least to the completion of the scheduled microtask. This would otherwise cause crashes after declarative animations were destroyed when they were no longer applied. (WebCore::WebAnimation::runPendingPlayTask): Only fulfill the "ready" promise if it hasn't already been, which might have been the case if multiple calls to play() are made as a result of updating the animation play state in CSSAnimation::syncPropertiesWithBackingAnimation(). (WebCore::WebAnimation::runPendingPauseTask): Same as above but with multiple pause() calls. (WebCore::WebAnimation::startOrStopAccelerated): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects. (WebCore::WebAnimation::canBeListed const): This new method is called by {Document|Element}::getAnimations() to check that an animation is in the correct state to be listed. The Web Animations spec explains that only animations "that have an associated target effect which is current or in effect" can be listed. We implement this behavior as specified. * animation/WebAnimation.h: (WebCore::WebAnimation::isDeclarativeAnimation const): (WebCore::WebAnimation::isEffectInvalidationSuspended): * dom/Document.cpp: (WebCore::Document::getAnimations): Ensure that the document's pending styles are resolved before returning animations to ensure that any pending declarative animations are created. Additionally, we ensure that we only list qualifying animations that have effects targeting elements that are children of thi document. * dom/Element.cpp: (WebCore::Element::getAnimations): Same as Document::getAnimations(). * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): When resolving styles, call into the AnimationTimeline if the runtime flag to enable CSS Animations and CSS Transitions as Web Animations is on. Otherwise, use CSSAnimationController. 2018-03-12 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Crash in WebCore::PlatformDisplayWayland::~PlatformDisplayWayland https://bugs.webkit.org/show_bug.cgi?id=176490 Reviewed by Žan Doberšek. Destroy the wl_display with wl_display_disconnect() (client process API), not wl_display_destroy() (server process API). It has to be destroyed last, so explicitly destroy the wl_registry and wl_compositor first. * platform/graphics/wayland/PlatformDisplayWayland.cpp: (WebCore::PlatformDisplayWayland::~PlatformDisplayWayland): 2018-03-10 Megan Gardner <megan_gardner@apple.com> Media query for default appearance https://bugs.webkit.org/show_bug.cgi?id=183539 <rdar://problem/38326388> Reviewed by Tim Horton. Not currently testable, will add tests in a later patch. Write a media query to evaluate appearance. * css/CSSValueKeywords.in: * css/MediaFeatureNames.h: * css/MediaQueryEvaluator.cpp: (WebCore::defaultAppearanceEvaluate): * css/MediaQueryExpression.cpp: (WebCore::featureWithValidIdent): (WebCore::isFeatureValidWithoutValue): * page/Page.h: (WebCore::Page::defaultAppearance const): (WebCore::Page::setDefaultAppearance): 2018-03-10 Daniel Bates <dabates@apple.com> InlineTextBox should own shadow data https://bugs.webkit.org/show_bug.cgi?id=183359 <rdar://problem/38171343> Reviewed by Darin Adler. Following r229147 we recompute the selection style, including any shadow data, whenever we paint the inline text box. Therefore, InlineTextBox needs to take ownership of the shadow data or it may be deallocated before it can be used. Covered by existing tests. * rendering/InlineTextBox.cpp: Changed data type of InlineTextBox::MarkedTextStyle::textShadow from const ShadowData* to std::optional<ShadowData>. Also removed explicitly deleted equality and inequality operators as they are unnecessary. Layout tests should catch if these are ever implemented and used when painting because the painted results will be wrong. (WebCore::InlineTextBox::computeStyleForUnmarkedMarkedText const): Clone ShadowData. (WebCore::InlineTextBox::resolveStyleForMarkedText): Simplified logic. (WebCore::InlineTextBox::paintMarkedTextForeground): Modified code now that MarkedTextStyle holds a std::optional<ShadowData>. (WebCore::InlineTextBox::paintMarkedTextDecoration): Ditto. * rendering/TextPaintStyle.cpp: (WebCore::computeTextSelectionPaintStyle): Changed the out parameter type from const ShadowData* to std::optional<ShadowData>& and modified code as needed. * rendering/TextPaintStyle.h: * rendering/style/ShadowData.cpp: Removed unncessary #include of header LayoutRect.h. This header will be included via ShadowData.h. (WebCore::ShadowData::clone): Convenience method that returns an std::optional to a cloned ShadowData object. * rendering/style/ShadowData.h: 2018-03-09 Zalan Bujtas <zalan@apple.com> Turn off offset*/scroll* optimization for input elements with shadow content https://bugs.webkit.org/show_bug.cgi?id=182383 <rdar://problem/37114190> Reviewed by Antti Koivisto. We normally ensure clean tree before calling offsetHeight/Width, scrollHeight/Width. In certain cases (see updateLayoutIfDimensionsOutOfDate() for details), it's okay to return the previously computed values even when some part of the tree is dirty. In case of shadow content, updateLayoutIfDimensionsOutOfDate() might return false (no need to layout) for the root, while true (needs layout) for the shadow content. This could confuse the caller (Element::scrollWidth/Height etc) and lead to incorrect result. Test: fast/forms/scrollheight-with-mutation-crash.html * dom/Document.cpp: (WebCore::Document::updateLayoutIfDimensionsOutOfDate): 2018-03-10 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Copying a table from the Numbers app and pasting into iCloud Numbers fails https://bugs.webkit.org/show_bug.cgi?id=183485 <rdar://problem/38041984> Reviewed by Ryosuke Niwa. After r222656, WebKit now treats raw image data on the pasteboard as files for the purposes of computing DataTransfer.files and DataTransfer.types. However, this is combined with existing policies that suppress DataTransfer.getData and DataTransfer.setData when the pasteboard contains files (generalized to copy/paste in r222688). This means we now don't allow web pages to access "text/plain" in the case where the user copies part of a table from the native Numbers app since Numbers additionally writes a snapshot of the table to the platform pasteboard. This restriction on getData/setData was intended to prevent web pages from extracting users' file paths when pasting or dropping, so it doesn't make sense to enforce this restriction even when there is only in-memory image data on the pasteboard. To fix this bug, we make Pasteboard::fileContentState() differentiate between cases where there are (real) files on the pasteboard, and cases where we've fallen back to treating image data as files. Rebaselined existing LayoutTests to match new behavior. Also covered by 4 new API tests: - PasteMixedContent.ImageDataAndPlainText - PasteMixedContent.ImageDataAndPlainTextAndURL - PasteMixedContent.ImageDataAndPlainTextAndURLAndHTML - UIPasteboardTests.DataTransferGetDataWhenPastingImageAndText * dom/DataTransfer.cpp: (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const): If custom pasteboard data is enabled, suppress getData and setData if and only if we might actually expose file paths (see Pasteboard::fileContentState). (WebCore::DataTransfer::types const): Only allow "text/html" or "text/uri-list" in the case where there are actual files in the pasteboard. If there's only image data, add all of the DOM-safe types back into the list of types. * platform/Pasteboard.h: * platform/StaticPasteboard.h: Add an enum type to represent the result of Pasteboard::fileContentState. - NoFileOrImageData indicates that there was nothing on the pasteboard that could be considered a file from the point of view of the page. - InMemoryImage indicates that there are no files on the pasteboard, but there is image data that we consider to be files, exposed via DataTransfer API. - MayContainFilePaths indicates that there might be file paths on the pasteboard. This means that the source has either written file paths to the pasteboard (for example, through NSFilenamesPboardType) or the source has written image data along with a URL type of some sort that does not match one of the allowed URL schemes that are safe to expose (currently, these are http-family, data, or blob). * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::fileContentState): Refactor to return one of the three enum types described above. (WebCore::Pasteboard::containsFiles): Deleted. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::fileContentState): (WebCore::Pasteboard::containsFiles): Deleted. * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::fileContentState): (WebCore::Pasteboard::containsFiles): Deleted. * platform/wpe/PasteboardWPE.cpp: (WebCore::Pasteboard::fileContentState): (WebCore::Pasteboard::containsFiles): Deleted. Adjust for Pasteboard::fileContentState() tweaks. 2018-03-09 Chris Fleizach <cfleizach@apple.com> AX: WebKit seems to be running spell checker even on non-editable content text https://bugs.webkit.org/show_bug.cgi?id=183456 <rdar://problem/38076042> Reviewed by Joanmarie Diggs. Test: accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html Only apply misspelled attributes if it's for editable text. It's not useful or performant to do this for static text. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (AXAttributeStringSetSpelling): 2018-03-09 Nan Wang <n_wang@apple.com> AX: AOM: More accessibility events support https://bugs.webkit.org/show_bug.cgi?id=183023 <rdar://problem/37764380> Reviewed by Chris Fleizach. The test is crashing when we call updateBackingStore when the AXObjectCache object is gone. Added a check to fix that. Modified the test by using the right format of setTimeout and extended the delay. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::updateBackingStore): 2018-03-09 Ross Kirsling <ross.kirsling@sony.com> Unreviewed. Fix WinCairo build after r229497. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::getNormalizedMIMEType): 2018-03-09 Ross Kirsling <ross.kirsling@sony.com> Clean up MIMETypeRegistry::mimeTypeAssociationMap for Curl https://bugs.webkit.org/show_bug.cgi?id=170529 Reviewed by Alex Christensen. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::getNormalizedMIMEType): (WebCore::mimeTypeAssociationMap): Deleted. Create map with makeNeverDestroyed and a loop instead. 2018-03-09 Brian Burg <bburg@apple.com> Web Inspector: there should only be one way for async backend commands to send failure https://bugs.webkit.org/show_bug.cgi?id=183524 Reviewed by Timothy Hatcher. Remove some useless ErrorString arguments. Fix some bugs where we may never call the callback in an early exit situation. Covered by existing Inspector and protocol generator tests. * inspector/agents/InspectorDatabaseAgent.cpp: (WebCore::InspectorDatabaseAgent::executeSQL): * inspector/agents/InspectorDatabaseAgent.h: * inspector/agents/InspectorIndexedDBAgent.h: * inspector/agents/InspectorIndexedDBAgent.cpp: (WebCore::getDocumentAndIDBFactoryFromFrameOrSendFailure): (WebCore::InspectorIndexedDBAgent::requestDatabaseNames): (WebCore::InspectorIndexedDBAgent::requestDatabase): (WebCore::InspectorIndexedDBAgent::requestData): (WebCore::InspectorIndexedDBAgent::clearObjectStore): (WebCore::assertDocument): Deleted. (WebCore::assertIDBFactory): Deleted. Modernize this code a little bit to share the document/idbFactory extraction code. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::loadResource): * inspector/agents/InspectorNetworkAgent.h: 2018-03-09 Youenn Fablet <youenn@apple.com> Crash in ServiceWorkerContainer::ready https://bugs.webkit.org/show_bug.cgi?id=183380 Reviewed by Chris Dumez. Not using 'this' through lambdas. Instead rely on the last lambda that is passed a ScriptExecutionContext& to get back 'this' which is a ServiceWorkerContainer. Should be covered by imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html no longer crashing. Although it should probably be LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html that should crash since this is the main test using ready. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::ready): 2018-03-09 Youenn Fablet <youenn@apple.com> RealtimeOutgoingAudioSource and RealtimeOutgoingVideoSource should be destroyed on the main thread https://bugs.webkit.org/show_bug.cgi?id=183483 <rdar://problem/38214152> Reviewed by Eric Carlson. When dereferencing from libwebrtc code path, schedule a call to deref on main thread. WebCore dereferencing is happening in the main thread so this guarantees destruction on the main thread. Covered by updated mock libwebrtc peer connection backend. We make mock senders to keep a reference to their source which are RealtimeOutgoingXXSource. We then make mock peer connection backend to free the mock senders in a background thread. * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doStop): * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::stop): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::stop): * platform/mediastream/RealtimeOutgoingVideoSource.h: * testing/MockLibWebRTCPeerConnection.cpp: (WebCore::ThreadKeeper::create): (WebCore::ThreadKeeper::setThread): (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): * testing/MockLibWebRTCPeerConnection.h: 2018-03-09 Jer Noble <jer.noble@apple.com> Unconditionalize more methods in VideoFullscreenInterface (and related classes) https://bugs.webkit.org/show_bug.cgi?id=183501 Reviewed by Eric Carlson. No need for these methods to be PLATFORM(MAC) only. * platform/cocoa/PlaybackSessionModel.h: (WebCore::PlaybackSessionModelClient::ensureControlsManager): * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::isPlayingVideoInEnhancedFullscreen const): * platform/mac/VideoFullscreenInterfaceMac.h: 2018-03-09 Youenn Fablet <youenn@apple.com> ServiceWorker should respect IDB and DOMCache partitioning https://bugs.webkit.org/show_bug.cgi?id=183496 Reviewed by Brady Eidson. Test: http/wpt/service-workers/third-party-registration.html Set the correct top origin of service worker ScriptExecutionContext. * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): 2018-03-09 Youenn Fablet <youenn@apple.com> Cannot change audio input source device https://bugs.webkit.org/show_bug.cgi?id=175975 <rdar://problem/34073589> Reviewed by Eric Carlson. Covered by manually testing https://webrtc.github.io/samples/src/content/devices/input-output/ with a USB web cam. * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioSharedUnit::setCaptureDeviceID): (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource): 2018-03-09 Jer Noble <jer.noble@apple.com> Add new CSS env constants for use with fullscreen https://bugs.webkit.org/show_bug.cgi?id=183498 Reviewed by Dean Jackson. Tests: fullscreen/fullscreen-auto-hide-delay.html fullscreen/fullscreen-inset-top.html * dom/ConstantPropertyMap.cpp: (WebCore::ConstantPropertyMap::nameForProperty const): (WebCore::variableDataForPositiveDuration): (WebCore::ConstantPropertyMap::setFullscreenInsetTop): (WebCore::ConstantPropertyMap::setFullscreenAutoHideDelay): * dom/ConstantPropertyMap.h: * page/Page.cpp: (WebCore::Page::setFullscreenInsetTop): (WebCore::Page::setFullscreenAutoHideDelay): * page/Page.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setFullscreenInsetTop): (WebCore::Internals::setFullscreenAutoHideDelay): * testing/Internals.h: * testing/Internals.idl: 2018-03-09 Zalan Bujtas <zalan@apple.com> RenderTreeBuilder::splitAnonymousBoxesAroundChild should take multicolumn spanners into account. https://bugs.webkit.org/show_bug.cgi?id=183493 <rdar://problem/38030461> Reviewed by Antti Koivisto. Multicolumn spanners are taken out of their original position and placed next to a RenderMultiColumnSet. splitAnonymousBoxesAroundChild needs to know the original parent (in the render tree context). Test: fast/multicol/adjust-beforeChild-for-spanner-crash.html * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::adjustBeforeChildForMultiColumnSpannerIfNeeded): * rendering/updating/RenderTreeBuilderMultiColumn.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::attach): 2018-03-09 Jer Noble <jer.noble@apple.com> Add isPictureInPictureActive messaging across WebKit process boundary https://bugs.webkit.org/show_bug.cgi?id=183499 Reviewed by Eric Carlson. * platform/cocoa/PlaybackSessionModel.h: (WebCore::PlaybackSessionModelClient::pictureInPictureActiveChanged): * platform/cocoa/PlaybackSessionModelMediaElement.h: * platform/cocoa/PlaybackSessionModelMediaElement.mm: (WebCore::PlaybackSessionModelMediaElement::updateForEventName): (WebCore::PlaybackSessionModelMediaElement::isPictureInPictureActive const): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::isPictureInPictureActive const): 2018-03-09 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Implement connection limit. https://bugs.webkit.org/show_bug.cgi?id=183016 Implement both connection limit per host and total connection limit on curl network layer. Reviewed by Youenn Fablet. No new tests because there's no behavior change. * platform/network/curl/CurlContext.cpp: (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): (WebCore::CurlContext::CurlContext): (WebCore::CurlMultiHandle::setMaxConnects): (WebCore::CurlMultiHandle::setMaxTotalConnections): (WebCore::CurlMultiHandle::setMaxHostConnections): * platform/network/curl/CurlContext.h: (WebCore::CurlContext::scheduler): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::startWithJobManager): (WebCore::CurlRequest::cancel): (WebCore::CurlRequest::invokeDidReceiveResponseForFile): (WebCore::CurlRequest::completeDidReceiveResponse): (WebCore::CurlRequest::pausedStatusChanged): * platform/network/curl/CurlRequestScheduler.cpp: (WebCore::CurlRequestScheduler::CurlRequestScheduler): (WebCore::CurlRequestScheduler::workerThread): (WebCore::CurlRequestScheduler::singleton): Deleted. * platform/network/curl/CurlRequestScheduler.h: 2018-03-09 Jer Noble <jer.noble@apple.com> webkitfullscreenchange event not fired at the same time as :-webkit-full-screen pseudo selector changes; causes glitchiness https://bugs.webkit.org/show_bug.cgi?id=183383 Reviewed by Eric Carlson. Fire the webkitfullscreenchange event at the same time as the pseudo class selector changes, during the handling of webkitDidEnterFullScreenForElement. For WebKit2 clients, this is guaranteed to be asynchronous, since the calling method originates in the UIProcess. For WebKit1 clients (and WKTR and DRT), there's the possibility that webkitWillEnterFullScreenForElement will be called synchronously from within Document::requestFullScreenForElement(), so break that synchronousness by starting the ChromeClient::enterFullScreenForElement(...) process in a async task. Previously, the firing of the fullscreenchange event was done through a zero-length timer. Use a GenericTaskQueue instead. A number of layout tests depend on the behavior that the element will be in fullscreen when the 'playing' event fires. This was true for DRT (but not WKTR), since its fullscreen implementations were deliberately synchronous, but won't necessarily be true for all ports. Fix this in a subsequent patch. * dom/Document.cpp: (WebCore::Document::requestFullScreenForElement): (WebCore::Document::webkitExitFullscreen): (WebCore::Document::webkitWillEnterFullScreenForElement): (WebCore::Document::webkitDidEnterFullScreenForElement): (WebCore::Document::webkitDidExitFullScreenForElement): (WebCore::Document::dispatchFullScreenChangeEvents): * dom/Document.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setReadyState): (WebCore::HTMLMediaElement::playInternal): (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): (WebCore::HTMLMediaElement::updatePlayState): (WebCore::HTMLMediaElement::setPlaying): 2018-03-09 Zan Dobersek <zdobersek@igalia.com> [Nicosia] Add threaded PaintingEngine implementation https://bugs.webkit.org/show_bug.cgi?id=183511 Reviewed by Carlos Garcia Campos. Add Nicosia::PaintingEngineThreaded, class that internally uses a thread pool in which painting tasks are executed. Implementation for now defaults to using GLib's GThreadPool, defaulting to 4 threads that are exclusive to this pool. These parameters should be fine-tuned in the future, or even made configurable, but are a solid basis for testing. In PaintingEngineThreaded::paint(), PaintingContext implementation is used to record all the operations, and the gathered Vector is combined with the Buffer object and dispatched into the thread pool. In the thread function, the provided buffer and painting operations are run through the PaintingContext implementation, replaying all the operations on a painting context that draws into the given buffer. The recorded operation objects implement the PaintingOperation interface contain all the data necessary to replay a given operation. They can be executed against a PaintingOperationReplay object, as is the case during PaintingContext::replay(), or they can be dumped into a TextStream object for debugging purposes. PaintingContext now also provides the record() and replay() static functions. PaintingContext objects now differ per purpose, which can be either for painting or for recording. paint() and replay() use a for-painting PaintingContext, and record() uses a for-recording one. The for-painting PaintingContext receives a Buffer object, i.e. a memory area on which it can draw, while the for-recording PaintingContext uses the passed-in PaintingOperations Vector that should store all the recorded operations. The current Cairo implementation of PaintingContext is moved into PaintingContextCairo::ForPainting. PaintingContextCairo::ForRecording is added but is currently no-op until a Cairo-specific GraphicsContextImpl with recording capabilities is added, allowing any call on the GraphicsContext object used in PaintingContext::record() to be recorded for later replay. PaintingOperationReplayCairo, inheriting from PaintingOperationReplay, will be used for replay purposes, providing only reference to the PlatformContextCairo object that is constructed in PaintingContextCairo::ForPainting. The Cairo-specific GraphicsContextImpl implementation will be added in a separate patch. After that, PaintingEngine::create() will be modified so that the Nicosia::PaintingEngineThreaded implementation can be used for testing purposes, probably by setting an environment variable. * platform/TextureMapper.cmake: * platform/graphics/nicosia/NicosiaPaintingContext.cpp: (Nicosia::PaintingContext::createForPainting): (Nicosia::PaintingContext::createForRecording): (Nicosia::PaintingContext::create): Deleted. * platform/graphics/nicosia/NicosiaPaintingContext.h: (Nicosia::PaintingContext::paint): (Nicosia::PaintingContext::record): (Nicosia::PaintingContext::replay): * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: Added. (Nicosia::s_threadFunc): (Nicosia::paintLayer): (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded): (Nicosia::PaintingEngineThreaded::~PaintingEngineThreaded): (Nicosia::PaintingEngineThreaded::paint): * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp. * platform/graphics/nicosia/NicosiaPaintingOperation.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp. * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::ForPainting::ForPainting): (Nicosia::PaintingContextCairo::ForPainting::~ForPainting): (Nicosia::PaintingContextCairo::ForPainting::graphicsContext): (Nicosia::PaintingContextCairo::ForPainting::replay): (Nicosia::PaintingContextCairo::ForRecording::ForRecording): (Nicosia::PaintingContextCairo::ForRecording::graphicsContext): (Nicosia::PaintingContextCairo::ForRecording::replay): (Nicosia::PaintingContextCairo::PaintingContextCairo): Deleted. (Nicosia::PaintingContextCairo::~PaintingContextCairo): Deleted. (Nicosia::PaintingContextCairo::graphicsContext): Deleted. * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h: * platform/graphics/nicosia/cairo/NicosiaPaintingOperationReplayCairo.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp. (Nicosia::PaintingOperationReplayCairo::PaintingOperationReplayCairo): 2018-03-09 Zan Dobersek <zdobersek@igalia.com> Remove some unused cruft in TextureMapperLayer. The ScrollingClient class is not used anymore since r229318. findScrollableContentsLayerAt() is similarly unused, but also lacking an actual definition. ContentsLayerCount enum can also be purged. Rubber-stamped by Carlos Garcia Campos. * platform/graphics/texmap/TextureMapperLayer.h: 2018-03-08 Zan Dobersek <zdobersek@igalia.com> Add basic synchronization capability to Nicosia::Buffer https://bugs.webkit.org/show_bug.cgi?id=183500 Reviewed by Carlos Garcia Campos. Have Nicosia::Buffer track a painting state, and allow that state to be modified and accessed from different threads. The PaintingState enum value is protected by a Lock object, and can be modified via the beginPainting() and completePainting() methods. Additionally, the waitUntilPaintingComplete() method allows the caller to wait until the painting is complete for the given Nicosia::Buffer object. This added state doesn't affect a Nicosia::Buffer object internally, and doesn't have any effect on existing usages of Nicosia::Buffer (which are not multi-threaded). * platform/graphics/nicosia/NicosiaBuffer.cpp: (Nicosia::Buffer::beginPainting): (Nicosia::Buffer::completePainting): (Nicosia::Buffer::waitUntilPaintingComplete): * platform/graphics/nicosia/NicosiaBuffer.h: 2018-03-08 Zan Dobersek <zdobersek@igalia.com> Move NicosiaPaintingContextCairo files under Cairo-specific directory https://bugs.webkit.org/show_bug.cgi?id=183497 Reviewed by Carlos Garcia Campos. Pack Cairo-specific files in the Nicosia subsystem under cairo/. * platform/TextureMapper.cmake: * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp. * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.h. 2018-03-08 Nan Wang <n_wang@apple.com> AX: AOM: More accessibility events support https://bugs.webkit.org/show_bug.cgi?id=183023 <rdar://problem/37764380> Reviewed by Chris Fleizach. Fixed the crash that we shouldn't dispatch the accessibility events if the event path is empty. Also added a check to not dispatch events if the runtime flag is not enabled. Test: accessibility/mac/AOM-events-webarea-crash.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const): (WebCore::AccessibilityObject::dispatchAccessibilityEvent const): * accessibility/AccessibilityObject.h: 2018-03-08 Megan Gardner <megan_gardner@apple.com> Allow WebViews to disable system appearance https://bugs.webkit.org/show_bug.cgi?id=183418 <rdar://problem/36975642> Reviewed by Tim Horton. Not currently testable, tests will be added in a later patch. Allow webviews to choose whether or not to follow the default system appearance. * css/StyleColor.cpp: (WebCore::StyleColor::colorFromKeyword): * css/StyleColor.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::colorFromPrimitiveValue const): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSystemColor): * css/parser/CSSParser.h: * css/parser/CSSParserMode.h: * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::setStrokeColor): (WebCore::CanvasRenderingContext2DBase::setFillColor): * html/canvas/CanvasStyle.cpp: (WebCore::parseColor): (WebCore::parseColorOrCurrentColor): (WebCore::CanvasStyle::createFromString): (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): * html/canvas/CanvasStyle.h: * page/Page.h: (WebCore::Page::useSystemAppearance const): (WebCore::Page::setUseSystemAppearance): * platform/Theme.cpp: (WebCore::Theme::paint): * platform/Theme.h: * platform/mac/LocalDefaultSystemAppearance.h: * platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (-[WebCoreThemeView initWithUseSystemAppearance:]): (WebCore::paintToggleButton): (WebCore::paintButton): (WebCore::ThemeMac::ensuredView): (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): (WebCore::ThemeMac::paint): (-[WebCoreThemeView init]): Deleted. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): (WebCore::RenderTheme::systemColor const): (WebCore::RenderTheme::focusRingColor): * rendering/RenderTheme.h: (WebCore::RenderTheme::platformFocusRingColor const): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::systemColor const): * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::documentViewFor const): (WebCore::RenderThemeMac::platformFocusRingColor const): (WebCore::RenderThemeMac::systemColor const): (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): (WebCore::RenderThemeMac::paintSliderThumb): * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): 2018-03-08 Megan Gardner <megan_gardner@apple.com> Ensure default appearance for selection form control https://bugs.webkit.org/show_bug.cgi?id=183482 <rdar://problem/38274894> Reviewed by Tim Horton. The appearance for selection form controls was not set to default. Not currently testable, will add tests in a later patch. * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const): 2018-03-08 Per Arne Vollan <pvollan@apple.com> [Win] Compile error: pal/ExportMacros.h not found. https://bugs.webkit.org/show_bug.cgi?id=183467 Reviewed by Brent Fulgham. PAL header files are no longer located under the WebCore folder in forwarding headers. An additional build step is required to copy the PAL header files to the internal include folder. No new tests, no change in functionality. * PlatformWin.cmake: * WebCore.vcxproj/WebCore.proj: 2018-03-08 Megan Gardner <megan_gardner@apple.com> Ensure system appearance is default for legacy webkit https://bugs.webkit.org/show_bug.cgi?id=183473 <rdar://problem/38210306> Reviewed by Tim Horton. Need to set the appearance on the window for legacy webkit due to differences in drawing. Not currently testable, will add tests in a later patch. * platform/mac/ThemeMac.mm: (WebCore::paintButton): 2018-03-08 Youenn Fablet <youenn@apple.com> libwebrtc update broke internal builds https://bugs.webkit.org/show_bug.cgi?id=183454 Reviewed by Eric Carlson. No change of behavior. Fixed header search paths. Removed deleted file from XCode project as an additional clean-up. * Configurations/WebCore.xcconfig: * WebCore.xcodeproj/project.pbxproj: 2018-03-08 Per Arne Vollan <pvollan@apple.com> NSAnimation is not working in the WebContent process when WindowServer access is blocked. https://bugs.webkit.org/show_bug.cgi?id=183291 Reviewed by Dean Jackson. The animation can be implemented by using an NSTimer instead. Use the existing Bezier timing function to create a smooth animation. No new tests. This code is used to fade scrollbars in and out by animating the alpha value. This scrollbar setting is not the default in macOS, which makes it non trivial to create layout tests for this. * platform/mac/ScrollAnimatorMac.mm: (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]): (-[WebScrollbarPartAnimation startAnimation]): (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]): (-[WebScrollbarPartAnimation invalidate]): (-[WebScrollbarPartAnimation setDuration:]): (-[WebScrollbarPartAnimation stopAnimation]): (-[WebScrollbarPartAnimation setCurrentProgress:]): Deleted. 2018-03-08 Said Abou-Hallawa <sabouhallawa@apple.com> Templatize SVGAnimatedType https://bugs.webkit.org/show_bug.cgi?id=183017 Reviewed by Dean Jackson. This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The goal to have SVGAnimatedType be type independent. The appropriate method of this template will be implicitly instantiated based to the type of the animated attribute(s). * Sources.txt: Delete SVGAnimatedType.cpp since its function became template functions or short enough to be inline functions. * WebCore.xcodeproj/project.pbxproj: * svg/SVGAnimatedAngle.cpp: (WebCore::SVGAnimatedAngleAnimator::constructFromString): (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation): (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes): (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue): Use the template functions SVGAnimatedType::create<>() and SVGAnimatedType::as<>(). * svg/SVGAnimatedBoolean.cpp: (WebCore::SVGAnimatedBooleanAnimator::constructFromString): (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation): (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedColor.cpp: (WebCore::SVGAnimatedColorAnimator::constructFromString): (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedEnumeration.cpp: (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation): (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedInteger.cpp: (WebCore::SVGAnimatedIntegerAnimator::constructFromString): (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation): (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes): (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedIntegerOptionalInteger.cpp: (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation): (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes): (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedLength.cpp: (WebCore::SVGAnimatedLengthAnimator::constructFromString): (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation): (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::constructFromString): (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation): (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedNumber.cpp: (WebCore::SVGAnimatedNumberAnimator::constructFromString): (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation): (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes): (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedNumberList.cpp: (WebCore::SVGAnimatedNumberListAnimator::constructFromString): (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation): (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedNumberOptionalNumber.cpp: (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation): (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes): (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedPath.cpp: (WebCore::SVGAnimatedPathAnimator::constructFromString): (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation): (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes): (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedPointList.cpp: (WebCore::SVGAnimatedPointListAnimator::constructFromString): (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation): (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedPreserveAspectRatio.cpp: (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation): (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedRect.cpp: (WebCore::SVGAnimatedRectAnimator::constructFromString): (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation): (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes): (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedString.cpp: (WebCore::SVGAnimatedStringAnimator::constructFromString): (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation): (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::constructFromString): (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation): (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal): (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes): (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue): (WebCore::SVGAnimatedTransformListAnimator::calculateDistance): Ditto. * svg/SVGAnimatedType.cpp: Removed. * svg/SVGAnimatedType.h: (WebCore::SVGAnimatedType::create): (WebCore::SVGAnimatedType::SVGAnimatedType): (WebCore::SVGAnimatedType::~SVGAnimatedType): (WebCore::SVGAnimatedType::as const): (WebCore::SVGAnimatedType::as): (WebCore::SVGAnimatedType::type const): (WebCore::SVGAnimatedType::valueAsString const): (WebCore::SVGAnimatedType::setValueAsString): (WebCore::SVGAnimatedType::supportsAnimVal): (WebCore::SVGAnimatedType::angleAndEnumeration const): Deleted. (WebCore::SVGAnimatedType::boolean const): Deleted. (WebCore::SVGAnimatedType::color const): Deleted. (WebCore::SVGAnimatedType::enumeration const): Deleted. (WebCore::SVGAnimatedType::integer const): Deleted. (WebCore::SVGAnimatedType::integerOptionalInteger const): Deleted. (WebCore::SVGAnimatedType::length const): Deleted. (WebCore::SVGAnimatedType::lengthList const): Deleted. (WebCore::SVGAnimatedType::number const): Deleted. (WebCore::SVGAnimatedType::numberList const): Deleted. (WebCore::SVGAnimatedType::numberOptionalNumber const): Deleted. (WebCore::SVGAnimatedType::path const): Deleted. (WebCore::SVGAnimatedType::pointList const): Deleted. (WebCore::SVGAnimatedType::preserveAspectRatio const): Deleted. (WebCore::SVGAnimatedType::rect const): Deleted. (WebCore::SVGAnimatedType::string const): Deleted. (WebCore::SVGAnimatedType::transformList const): Deleted. (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted. (WebCore::SVGAnimatedType::boolean): Deleted. (WebCore::SVGAnimatedType::color): Deleted. (WebCore::SVGAnimatedType::enumeration): Deleted. (WebCore::SVGAnimatedType::integer): Deleted. (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted. (WebCore::SVGAnimatedType::length): Deleted. (WebCore::SVGAnimatedType::lengthList): Deleted. (WebCore::SVGAnimatedType::number): Deleted. (WebCore::SVGAnimatedType::numberList): Deleted. (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted. (WebCore::SVGAnimatedType::path): Deleted. (WebCore::SVGAnimatedType::pointList): Deleted. (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted. (WebCore::SVGAnimatedType::rect): Deleted. (WebCore::SVGAnimatedType::string): Deleted. (WebCore::SVGAnimatedType::transformList): Deleted. Replace the union by a Variant. Replace all the type specific functions by the template functions create() and as(). Use WTF::visit to get the value stored in the variant. Use the SVGPropertyTraits to perform the required operation. * svg/SVGAnimatedTypeAnimator.h: (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue): (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue): (WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForType): (WebCore::SVGAnimatedTypeAnimator::animValDidChangeForType): (WebCore::SVGAnimatedTypeAnimator::animValWillChangeForType): (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues): (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): (WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForTypes): (WebCore::SVGAnimatedTypeAnimator::animValDidChangeForTypes): (WebCore::SVGAnimatedTypeAnimator::animValWillChangeForTypes): (WebCore::SVGAnimatedTypeAnimator::executeAction): Rename the parameters and the local variables to match their types. Use the SVGAnimatedType template functions create() and as(). * svg/SVGLengthValue.h: (WebCore::SVGPropertyTraits<SVGLengthValue>::parse): This was moved from SVGAnimatedType::setValueAsString() (WebCore::SVGPropertyTraits<SVGLengthValue>::toString): This was moved from SVGAnimatedType::valueAsString(). * svg/SVGMarkerTypes.h: Add placeholders for parse() and toString() so SVGAnimatedType::valueAsString() and setValueAsString() can compile for all types. * svg/SVGNumberListValues.h: (WebCore::SVGPropertyTraits<SVGNumberListValues>::parse): * svg/SVGPathByteStream.h: (WebCore::SVGPropertyTraits<SVGPathByteStream>::parse): (WebCore::SVGPropertyTraits<SVGPathByteStream>::toString): * svg/SVGPointListValues.h: (WebCore::SVGPropertyTraits<SVGPointListValues>::parse): (WebCore::SVGPropertyTraits<SVGPointListValues>::toString): * svg/SVGPreserveAspectRatioValue.h: (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::parse): (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto. * svg/SVGTransformListValues.h: (WebCore::SVGPropertyTraits<SVGTransformListValues>::parse): Ditto. * svg/SVGValue.h: Added. SVGValueVariant is the replacement of the union SVGAnimatedType::DataUnion. * svg/properties/SVGPropertyInfo.h: Add a minimum and maximum AnimatedPropertyType so, SVGAnimatedType::type() can assert that the index of the variant is in the range of this enum. * svg/properties/SVGPropertyTraits.h: (WebCore::SVGPropertyTraits<bool>::parse): (WebCore::SVGPropertyTraits<unsigned>::parse): (WebCore::SVGPropertyTraits<int>::parse): Ditto. 2018-03-08 Yusuke Suzuki <utatane.tea@gmail.com> [JSC][WebCore] Extend jsDynamicCast for WebCore types in WebCore and remove jsDynamicDowncast https://bugs.webkit.org/show_bug.cgi?id=183449 Reviewed by Mark Lam. This patch removes jsDynamicDowncast. Our JSC::jsDynamicCast can have a way to inject a fast path that is similar to jsDynamicDowncast. WebCore can leverage this functionality to add a fast path for WebCore's extended JS object types (JSEvent, JSElement, JSNode, and JSDocument). No behavior change. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CommonVM.cpp: (WebCore::lexicalFrameFromCommonVM): * bindings/js/JSDOMConvertBufferSource.h: (WebCore::toPossiblySharedArrayBufferView): * bindings/js/JSDOMConvertPromise.h: (WebCore::Converter<IDLPromise<T>>::convert): * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::reportException): (WebCore::retrieveErrorMessage): * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::next): * bindings/js/JSDOMWindowProxy.cpp: (WebCore::JSDOMWindowProxy::toWrapped): * bindings/js/JSDOMWrapperCache.h: * bindings/js/JSDocumentCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSDocument>::inherits): (WebCore::jsDocumentCast): Deleted. * bindings/js/JSDynamicDowncast.h: Removed. * bindings/js/JSElementCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits): (WebCore::jsElementCast): Deleted. * bindings/js/JSEventCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSEvent>::inherits): (WebCore::jsEventCast): Deleted. * bindings/js/JSEventTargetCustom.cpp: (WebCore::jsEventTargetCast): * bindings/js/JSNodeCustom.h: (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSNode>::inherits): (WebCore::jsNodeCast): Deleted. * bindings/js/JSPluginElementFunctions.cpp: (WebCore::pluginElementPropertyGetter): * bindings/js/JSReadableStreamSourceCustom.cpp: (WebCore::JSReadableStreamSource::start): * bindings/js/JSWorkerGlobalScopeBase.cpp: (WebCore::toJSDedicatedWorkerGlobalScope): (WebCore::toJSWorkerGlobalScope): (WebCore::toJSServiceWorkerGlobalScope): * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::create): (WebCore::ReadableStream::isDisturbed): * bindings/js/ReadableStream.h: (WebCore::JSReadableStreamWrapperConverter::toWrapped): * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::evaluate): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneSerializer::serialize): * bindings/js/StructuredClone.cpp: (WebCore::structuredCloneArrayBufferView): * bindings/scripts/CodeGeneratorJS.pm: (GetCastingHelperForThisObject): (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::jsInterfaceNameConstructor): (WebCore::setJSInterfaceNameConstructor): (WebCore::JSInterfaceName::toWrapped): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::IDLAttribute<JSMapLike>::cast): (WebCore::IDLOperation<JSMapLike>::cast): (WebCore::jsMapLikeConstructor): (WebCore::setJSMapLikeConstructor): (WebCore::JSMapLike::toWrapped): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::IDLAttribute<JSReadOnlyMapLike>::cast): (WebCore::IDLOperation<JSReadOnlyMapLike>::cast): (WebCore::jsReadOnlyMapLikeConstructor): (WebCore::setJSReadOnlyMapLikeConstructor): (WebCore::JSReadOnlyMapLike::toWrapped): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::IDLAttribute<JSTestActiveDOMObject>::cast): (WebCore::IDLOperation<JSTestActiveDOMObject>::cast): (WebCore::jsTestActiveDOMObjectConstructor): (WebCore::setJSTestActiveDOMObjectConstructor): (WebCore::JSTestActiveDOMObject::toWrapped): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::IDLAttribute<JSTestCEReactions>::cast): (WebCore::IDLOperation<JSTestCEReactions>::cast): (WebCore::jsTestCEReactionsConstructor): (WebCore::setJSTestCEReactionsConstructor): (WebCore::JSTestCEReactions::toWrapped): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::IDLAttribute<JSTestCEReactionsStringifier>::cast): (WebCore::IDLOperation<JSTestCEReactionsStringifier>::cast): (WebCore::jsTestCEReactionsStringifierConstructor): (WebCore::setJSTestCEReactionsStringifierConstructor): (WebCore::JSTestCEReactionsStringifier::toWrapped): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::IDLAttribute<JSTestCallTracer>::cast): (WebCore::IDLOperation<JSTestCallTracer>::cast): (WebCore::jsTestCallTracerConstructor): (WebCore::setJSTestCallTracerConstructor): (WebCore::JSTestCallTracer::toWrapped): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::jsTestClassWithJSBuiltinConstructorConstructor): (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor): (WebCore::JSTestClassWithJSBuiltinConstructor::toWrapped): * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor): (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor): (WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::IDLAttribute<JSTestDOMJIT>::cast): (WebCore::IDLOperation<JSTestDOMJIT>::cast): (WebCore::jsTestDOMJITConstructor): (WebCore::setJSTestDOMJITConstructor): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::IDLAttribute<JSTestEnabledBySetting>::cast): (WebCore::IDLOperation<JSTestEnabledBySetting>::cast): (WebCore::jsTestEnabledBySettingConstructor): (WebCore::setJSTestEnabledBySettingConstructor): (WebCore::JSTestEnabledBySetting::toWrapped): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::IDLAttribute<JSTestEventConstructor>::cast): (WebCore::jsTestEventConstructorConstructor): (WebCore::setJSTestEventConstructorConstructor): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::IDLOperation<JSTestEventTarget>::cast): (WebCore::jsTestEventTargetConstructor): (WebCore::setJSTestEventTargetConstructor): (WebCore::JSTestEventTarget::toWrapped): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::IDLAttribute<JSTestException>::cast): (WebCore::jsTestExceptionConstructor): (WebCore::setJSTestExceptionConstructor): (WebCore::JSTestException::toWrapped): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::IDLAttribute<JSTestGenerateIsReachable>::cast): (WebCore::jsTestGenerateIsReachableConstructor): (WebCore::setJSTestGenerateIsReachableConstructor): (WebCore::JSTestGenerateIsReachable::toWrapped): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::IDLAttribute<JSTestGlobalObject>::cast): (WebCore::IDLOperation<JSTestGlobalObject>::cast): (WebCore::jsTestGlobalObjectConstructor): (WebCore::setJSTestGlobalObjectConstructor): (WebCore::JSTestGlobalObject::toWrapped): * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: (WebCore::jsTestIndexedSetterNoIdentifierConstructor): (WebCore::setJSTestIndexedSetterNoIdentifierConstructor): (WebCore::JSTestIndexedSetterNoIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: (WebCore::jsTestIndexedSetterThrowingExceptionConstructor): (WebCore::setJSTestIndexedSetterThrowingExceptionConstructor): (WebCore::JSTestIndexedSetterThrowingException::toWrapped): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::IDLOperation<JSTestIndexedSetterWithIdentifier>::cast): (WebCore::jsTestIndexedSetterWithIdentifierConstructor): (WebCore::setJSTestIndexedSetterWithIdentifierConstructor): (WebCore::JSTestIndexedSetterWithIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::IDLAttribute<JSTestInterface>::cast): (WebCore::IDLOperation<JSTestInterface>::cast): (WebCore::jsTestInterfaceConstructor): (WebCore::setJSTestInterfaceConstructor): (WebCore::JSTestInterface::toWrapped): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: (WebCore::IDLAttribute<JSTestInterfaceLeadingUnderscore>::cast): (WebCore::jsTestInterfaceLeadingUnderscoreConstructor): (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor): (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::IDLOperation<JSTestIterable>::cast): (WebCore::jsTestIterableConstructor): (WebCore::setJSTestIterableConstructor): (WebCore::JSTestIterable::toWrapped): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::IDLAttribute<JSTestJSBuiltinConstructor>::cast): (WebCore::IDLOperation<JSTestJSBuiltinConstructor>::cast): (WebCore::jsTestJSBuiltinConstructorConstructor): (WebCore::setJSTestJSBuiltinConstructorConstructor): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::IDLOperation<JSTestMediaQueryListListener>::cast): (WebCore::jsTestMediaQueryListListenerConstructor): (WebCore::setJSTestMediaQueryListListenerConstructor): (WebCore::JSTestMediaQueryListListener::toWrapped): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::jsTestNamedAndIndexedSetterNoIdentifierConstructor): (WebCore::setJSTestNamedAndIndexedSetterNoIdentifierConstructor): (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::jsTestNamedAndIndexedSetterThrowingExceptionConstructor): (WebCore::setJSTestNamedAndIndexedSetterThrowingExceptionConstructor): (WebCore::JSTestNamedAndIndexedSetterThrowingException::toWrapped): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::cast): (WebCore::jsTestNamedAndIndexedSetterWithIdentifierConstructor): (WebCore::setJSTestNamedAndIndexedSetterWithIdentifierConstructor): (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::jsTestNamedConstructorConstructor): (WebCore::setJSTestNamedConstructorConstructor): (WebCore::JSTestNamedConstructor::toWrapped): * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: (WebCore::jsTestNamedDeleterNoIdentifierConstructor): (WebCore::setJSTestNamedDeleterNoIdentifierConstructor): (WebCore::JSTestNamedDeleterNoIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: (WebCore::jsTestNamedDeleterThrowingExceptionConstructor): (WebCore::setJSTestNamedDeleterThrowingExceptionConstructor): (WebCore::JSTestNamedDeleterThrowingException::toWrapped): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::IDLOperation<JSTestNamedDeleterWithIdentifier>::cast): (WebCore::jsTestNamedDeleterWithIdentifierConstructor): (WebCore::setJSTestNamedDeleterWithIdentifierConstructor): (WebCore::JSTestNamedDeleterWithIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: (WebCore::jsTestNamedDeleterWithIndexedGetterConstructor): (WebCore::setJSTestNamedDeleterWithIndexedGetterConstructor): (WebCore::JSTestNamedDeleterWithIndexedGetter::toWrapped): * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: (WebCore::jsTestNamedGetterCallWithConstructor): (WebCore::setJSTestNamedGetterCallWithConstructor): (WebCore::JSTestNamedGetterCallWith::toWrapped): * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: (WebCore::jsTestNamedGetterNoIdentifierConstructor): (WebCore::setJSTestNamedGetterNoIdentifierConstructor): (WebCore::JSTestNamedGetterNoIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::IDLOperation<JSTestNamedGetterWithIdentifier>::cast): (WebCore::jsTestNamedGetterWithIdentifierConstructor): (WebCore::setJSTestNamedGetterWithIdentifierConstructor): (WebCore::JSTestNamedGetterWithIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::jsTestNamedSetterNoIdentifierConstructor): (WebCore::setJSTestNamedSetterNoIdentifierConstructor): (WebCore::JSTestNamedSetterNoIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::jsTestNamedSetterThrowingExceptionConstructor): (WebCore::setJSTestNamedSetterThrowingExceptionConstructor): (WebCore::JSTestNamedSetterThrowingException::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::IDLOperation<JSTestNamedSetterWithIdentifier>::cast): (WebCore::jsTestNamedSetterWithIdentifierConstructor): (WebCore::setJSTestNamedSetterWithIdentifierConstructor): (WebCore::JSTestNamedSetterWithIdentifier::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::IDLOperation<JSTestNamedSetterWithIndexedGetter>::cast): (WebCore::jsTestNamedSetterWithIndexedGetterConstructor): (WebCore::setJSTestNamedSetterWithIndexedGetterConstructor): (WebCore::JSTestNamedSetterWithIndexedGetter::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::cast): (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterConstructor): (WebCore::setJSTestNamedSetterWithIndexedGetterAndSetterConstructor): (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: (WebCore::jsTestNamedSetterWithOverrideBuiltinsConstructor): (WebCore::setJSTestNamedSetterWithOverrideBuiltinsConstructor): (WebCore::JSTestNamedSetterWithOverrideBuiltins::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::IDLAttribute<JSTestNamedSetterWithUnforgableProperties>::cast): (WebCore::IDLOperation<JSTestNamedSetterWithUnforgableProperties>::cast): (WebCore::jsTestNamedSetterWithUnforgablePropertiesConstructor): (WebCore::setJSTestNamedSetterWithUnforgablePropertiesConstructor): (WebCore::JSTestNamedSetterWithUnforgableProperties::toWrapped): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::IDLAttribute<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast): (WebCore::IDLOperation<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast): (WebCore::jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor): (WebCore::setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor): (WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::toWrapped): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::IDLAttribute<JSTestNode>::cast): (WebCore::IDLOperation<JSTestNode>::cast): (WebCore::jsTestNodeConstructor): (WebCore::setJSTestNodeConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::IDLAttribute<JSTestObj>::cast): (WebCore::IDLOperation<JSTestObj>::cast): (WebCore::jsTestObjConstructor): (WebCore::setJSTestObjConstructor): (WebCore::JSTestObj::toWrapped): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::jsTestOverloadedConstructorsConstructor): (WebCore::setJSTestOverloadedConstructorsConstructor): (WebCore::JSTestOverloadedConstructors::toWrapped): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::jsTestOverloadedConstructorsWithSequenceConstructor): (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor): (WebCore::JSTestOverloadedConstructorsWithSequence::toWrapped): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::IDLOperation<JSTestOverrideBuiltins>::cast): (WebCore::jsTestOverrideBuiltinsConstructor): (WebCore::setJSTestOverrideBuiltinsConstructor): (WebCore::JSTestOverrideBuiltins::toWrapped): * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::jsTestPluginInterfaceConstructor): (WebCore::setJSTestPluginInterfaceConstructor): (WebCore::JSTestPluginInterface::toWrapped): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::IDLAttribute<JSTestPromiseRejectionEvent>::cast): (WebCore::jsTestPromiseRejectionEventConstructor): (WebCore::setJSTestPromiseRejectionEventConstructor): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::IDLAttribute<JSTestSerialization>::cast): (WebCore::IDLOperation<JSTestSerialization>::cast): (WebCore::jsTestSerializationConstructor): (WebCore::setJSTestSerializationConstructor): (WebCore::JSTestSerialization::toWrapped): * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: (WebCore::jsTestSerializationIndirectInheritanceConstructor): (WebCore::setJSTestSerializationIndirectInheritanceConstructor): * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: (WebCore::IDLAttribute<JSTestSerializationInherit>::cast): (WebCore::IDLOperation<JSTestSerializationInherit>::cast): (WebCore::jsTestSerializationInheritConstructor): (WebCore::setJSTestSerializationInheritConstructor): * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: (WebCore::IDLAttribute<JSTestSerializationInheritFinal>::cast): (WebCore::IDLOperation<JSTestSerializationInheritFinal>::cast): (WebCore::jsTestSerializationInheritFinalConstructor): (WebCore::setJSTestSerializationInheritFinalConstructor): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::IDLAttribute<JSTestSerializedScriptValueInterface>::cast): (WebCore::IDLOperation<JSTestSerializedScriptValueInterface>::cast): (WebCore::jsTestSerializedScriptValueInterfaceConstructor): (WebCore::setJSTestSerializedScriptValueInterfaceConstructor): (WebCore::JSTestSerializedScriptValueInterface::toWrapped): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::IDLOperation<JSTestStringifier>::cast): (WebCore::jsTestStringifierConstructor): (WebCore::setJSTestStringifierConstructor): (WebCore::JSTestStringifier::toWrapped): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::IDLOperation<JSTestStringifierAnonymousOperation>::cast): (WebCore::jsTestStringifierAnonymousOperationConstructor): (WebCore::setJSTestStringifierAnonymousOperationConstructor): (WebCore::JSTestStringifierAnonymousOperation::toWrapped): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::IDLOperation<JSTestStringifierNamedOperation>::cast): (WebCore::jsTestStringifierNamedOperationConstructor): (WebCore::setJSTestStringifierNamedOperationConstructor): (WebCore::JSTestStringifierNamedOperation::toWrapped): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::IDLOperation<JSTestStringifierOperationImplementedAs>::cast): (WebCore::jsTestStringifierOperationImplementedAsConstructor): (WebCore::setJSTestStringifierOperationImplementedAsConstructor): (WebCore::JSTestStringifierOperationImplementedAs::toWrapped): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::IDLOperation<JSTestStringifierOperationNamedToString>::cast): (WebCore::jsTestStringifierOperationNamedToStringConstructor): (WebCore::setJSTestStringifierOperationNamedToStringConstructor): (WebCore::JSTestStringifierOperationNamedToString::toWrapped): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::IDLAttribute<JSTestStringifierReadOnlyAttribute>::cast): (WebCore::IDLOperation<JSTestStringifierReadOnlyAttribute>::cast): (WebCore::jsTestStringifierReadOnlyAttributeConstructor): (WebCore::setJSTestStringifierReadOnlyAttributeConstructor): (WebCore::JSTestStringifierReadOnlyAttribute::toWrapped): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::IDLAttribute<JSTestStringifierReadWriteAttribute>::cast): (WebCore::IDLOperation<JSTestStringifierReadWriteAttribute>::cast): (WebCore::jsTestStringifierReadWriteAttributeConstructor): (WebCore::setJSTestStringifierReadWriteAttributeConstructor): (WebCore::JSTestStringifierReadWriteAttribute::toWrapped): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::IDLAttribute<JSTestTypedefs>::cast): (WebCore::IDLOperation<JSTestTypedefs>::cast): (WebCore::jsTestTypedefsConstructor): (WebCore::setJSTestTypedefsConstructor): (WebCore::JSTestTypedefs::toWrapped): * bridge/objc/WebScriptObject.mm: (-[WebScriptObject setValue:forKey:]): * bridge/runtime_array.cpp: (JSC::RuntimeArray::lengthGetter): * bridge/runtime_method.cpp: (JSC::RuntimeMethod::lengthGetter): * html/HTMLMediaElement.cpp: (WebCore::controllerJSValue): (WebCore::HTMLMediaElement::updateCaptionContainer): (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForEventListener): 2018-03-08 Yusuke Suzuki <utatane.tea@gmail.com> [JSC] Add inherits<T>(VM&) leveraging JSCast fast path https://bugs.webkit.org/show_bug.cgi?id=183429 Reviewed by Mark Lam. * bindings/js/IDBBindingUtilities.cpp: (WebCore::createIDBKeyFromValue): * bindings/js/JSDOMConvertDate.cpp: (WebCore::valueToDate): * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::scriptExecutionContext const): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::toWrapped): * bindings/js/JSEventTargetCustom.cpp: * bindings/js/JSNodeCustom.cpp: (WebCore::JSNode::pushEventHandlerScope const): * bindings/js/JSXPathNSResolverCustom.cpp: (WebCore::JSXPathNSResolver::toWrapped): * bindings/js/ScriptState.cpp: (WebCore::domWindowFromExecState): (WebCore::scriptExecutionContextFromExecState): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::isArray): (WebCore::CloneSerializer::isMap): (WebCore::CloneSerializer::isSet): (WebCore::CloneSerializer::dumpArrayBufferView): (WebCore::CloneSerializer::dumpDOMPoint): (WebCore::CloneSerializer::dumpDOMRect): (WebCore::CloneSerializer::dumpDOMMatrix): (WebCore::CloneSerializer::dumpIfTerminal): (WebCore::CloneDeserializer::CloneDeserializer): (WebCore::CloneDeserializer::readArrayBufferView): * bindings/scripts/CodeGeneratorJS.pm: (GenerateOverloadDispatcher): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameterOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnionOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnionsOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnionOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnionOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameterOverloadDispatcher): (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunctionOverloadDispatcher): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::JSTestOverloadedConstructorsConstructor::construct): * bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::invokeMethod): * bridge/objc/WebScriptObject.mm: (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]): * bridge/objc/objc_instance.mm: (ObjcInstance::invokeMethod): * bridge/objc/objc_runtime.mm: (JSC::Bindings::callObjCFallbackObject): * bridge/runtime_method.cpp: (JSC::callRuntimeMethod): * bridge/runtime_object.cpp: (JSC::Bindings::callRuntimeObject): (JSC::Bindings::callRuntimeConstructor): * inspector/WebInjectedScriptHost.cpp: (WebCore::WebInjectedScriptHost::subtype): (WebCore::WebInjectedScriptHost::isHTMLAllCollection): 2018-03-08 Tim Horton <timothy_horton@apple.com> Stop linking ApplicationServices directly https://bugs.webkit.org/show_bug.cgi?id=182867 <rdar://problem/38252142> Reviewed by Alex Christensen. The frameworks that we use that live inside ApplicationServices have mostly moved out, so import them directly. * Configurations/WebCore.xcconfig: * html/canvas/CanvasRenderingContext2D.cpp: * html/canvas/CanvasRenderingContext2DBase.cpp: * platform/MIMETypeRegistry.cpp: * platform/graphics/ComplexTextController.cpp: * platform/graphics/cg/ColorCG.cpp: * platform/graphics/cg/ImageDecoderCG.cpp: * platform/graphics/cg/UTIRegistry.cpp: * platform/graphics/cocoa/FontCocoa.mm: * platform/graphics/mac/ComplexTextControllerCoreText.mm: * platform/graphics/mac/GlyphPageMac.cpp: * platform/graphics/mac/PDFDocumentImageMac.mm: * platform/graphics/mac/SimpleFontDataCoreText.cpp: * platform/graphics/win/FontCGWin.cpp: * platform/graphics/win/FontCacheWin.cpp: * platform/graphics/win/FontCustomPlatformData.cpp: * platform/graphics/win/FontPlatformDataCGWin.cpp: * platform/graphics/win/ImageCGWin.cpp: * platform/graphics/win/SimpleFontDataCGWin.cpp: 2018-03-07 Tim Horton <timothy_horton@apple.com> Sort and separate FeatureDefines.xcconfig https://bugs.webkit.org/show_bug.cgi?id=183427 Reviewed by Dan Bernstein. * Configurations/FeatureDefines.xcconfig: Sort and split FeatureDefines into paragraphs (to make it easier to sort later). 2018-03-07 Zalan Bujtas <zalan@apple.com> Invalid innerTextRenderer in RenderTextControlSingleLine::styleDidChange() https://bugs.webkit.org/show_bug.cgi?id=183385 <rdar://problem/38085397> Reviewed by Antti Koivisto. When HTMLInputElement::updateType() is called with a dirty value, we eagerly change the m_inputType first and then we take care of the dirty value by calling setAttributeWithoutSynchronization(). With a DOMSubtreeModified event listener attached, setAttributeWithoutSynchronization() can end up running some layout code (offsetHeight) with a renderer - m_inputType mismatch. This patch ensures that we don't change the m_inputType until after we finished setting the new value. Test: fast/DOM/HTMLInputElement/input-value-and-type-change-crash.html * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateType): 2018-03-07 Chris Dumez <cdumez@apple.com> Get rid of custom bindings for History's replaceState() / pushState() https://bugs.webkit.org/show_bug.cgi?id=183372 Reviewed by Youenn Fablet. Get rid of custom bindings for History's replaceState() / pushState() by moving the cached state from the wrapper to the History implementation object. No new tests, no web-facing behavior change. * bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::state const): (WebCore::JSHistory::visitAdditionalChildren): * page/History.cpp: (WebCore::History::cachedState): (WebCore::History::stateObjectAdded): * page/History.h: (WebCore::History::pushState): (WebCore::History::replaceState): * page/History.idl: 2018-03-07 Youenn Fablet <youenn@apple.com> Match unsupported plugins based on domains and not origin https://bugs.webkit.org/show_bug.cgi?id=183384 Reviewed by Chris Dumez. Move from an origin-keyed map to a vector of plugins. We iterate through the vector and a match happens if the page host name ends with the provided matching domain. This allows supporting rules for *.mydomain.com by passing 'mydomain.com'. Covered by existing tests. We are not testing subdomains like www.localhost since there is no support in our CI but this is tested through Unit tests. * loader/EmptyClients.cpp: * platform/URL.cpp: (WebCore::URL::isMatchingDomain const): * platform/URL.h: * plugins/PluginData.h: (WebCore::isSupportedPlugin): (WebCore::SupportedPluginName::decode): (WebCore::SupportedPluginName::encode const): * plugins/PluginInfoProvider.h: 2017-12-18 Youenn Fablet <youenn@apple.com> Update to libwebrtc revision 4e70a72571dd26b85c2385e9c618e343428df5d3 https://bugs.webkit.org/show_bug.cgi?id=180843 Reviewed by Eric Carlson. Covered by existing tests. Moving H264 codecs and factories to libwebrtc. Updating LibWebRTCProvider according new libwebrtc API. Updating ref counting according new libwebrtc API. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: (WebCore::LibWebRTCMediaEndpoint::AddRef const): (WebCore::LibWebRTCMediaEndpoint::Release const): (WTF::LogArgument<webrtc::RTCStats>::toString): * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::LibWebRTCProvider::createPeerConnectionFactory): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa): (WebCore::LibWebRTCProviderCocoa::createDecoderFactory): (WebCore::LibWebRTCProviderCocoa::createEncoderFactory): (WebCore::LibWebRTCProviderCocoa::setActive): * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h: * platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.cpp: Removed. * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: Removed. * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::ConvertToI420): (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/MockLibWebRTCPeerConnection.h: 2018-03-07 Sihui Liu <sihui_liu@apple.com> replaceState cause back/forward malfunction on html page with <base href="/"> tag https://bugs.webkit.org/show_bug.cgi?id=182678 <rdar://problem/37517821> Reviewed by Chris Dumez. replaceState should not change URL when the URL argument is NULL, but should change URL when the URL argument is an empty string. Test: http/tests/history/replacestate-no-url.html * page/History.cpp: (WebCore::History::urlForState): 2018-03-07 Antti Koivisto <antti@apple.com> Don't invalidate descendants for sibling combinators unless needed https://bugs.webkit.org/show_bug.cgi?id=183410 <rdar://problem/38227297> Reviewed by Zalan Bujtas. If we know the matched sibling combinator doesn't affect descendants we shouldn't invalidate them. * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively const): Use different bit for the descendant case. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentMatchesTheRightmostElement): Remove unneeded context assert. (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker): Use different bit for the descendant case. (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorCheckerExcludingPseudoElements): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPseudoElement): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateRequestedPseudoElementEqualsToSelectorPseudoElement): * dom/Element.cpp: (WebCore::invalidateForSiblingCombinators): Invalidate the target sibling or all descendants based on the bits. * dom/Element.h: (WebCore::Element::descendantsAffectedByPreviousSibling const): (WebCore::Element::setDescendantsAffectedByPreviousSibling const): * dom/Node.h: * style/StyleRelations.cpp: (WebCore::Style::commitRelationsToRenderStyle): (WebCore::Style::commitRelations): * style/StyleRelations.h: Add DescendantsAffectedByPreviousSibling bit. AffectedByPreviousSibling is now just about the target element. 2018-03-07 Antti Koivisto <antti@apple.com> checkForSiblingStyleChanges should use internal versions of the invalidation functions https://bugs.webkit.org/show_bug.cgi?id=183405 <rdar://problem/38218310> Reviewed by Zalan Bujtas. Non-internal invalidateStyleForElement/Subtree() implement sibling combinator invalidation. Checking this is only needed if the element in question changed somehow. In checkForSiblingStyleChanges we know that another element changed and we really just want to invalidate. * css/SelectorChecker.cpp: (WebCore::isFirstOfType): (WebCore::SelectorChecker::checkOne const): Also make :first-of-type use ChildrenAffectedByForwardPositionalRules for invalidation similar to :last-of-type for more correct invalidation. * dom/Element.cpp: (WebCore::checkForSiblingStyleChanges): 2018-03-07 Yusuke Suzuki <utatane.tea@gmail.com> HTML `pattern` attribute should set `u` flag for regular expressions https://bugs.webkit.org/show_bug.cgi?id=151598 Reviewed by Chris Dumez. This patch attaches "u" flag to the RegExp compiled for HTML "pattern" attribute[1]. [1]: https://html.spec.whatwg.org/multipage/forms.html#the-pattern-attribute * html/BaseTextInputType.cpp: (WebCore::BaseTextInputType::patternMismatch const): 2018-03-07 Frederic Wang <fwang@igalia.com> Relayout frames after AsyncFrameScrolling or FrameFlattening option is changed https://bugs.webkit.org/show_bug.cgi?id=183081 Reviewed by Antonio Gomes. The frames may be resized when the FrameFlattening option is modified and hence this patch forces a relayout. It also does that when AsyncFrameScrolling is modified too, since that may imply changes in frame flattening after bug 173704. Forcing a relayout will also be enough to trigger other updates for async frame scrolling in the future (see bug 149264 and bug 171667). Test: platform/ios/fast/frames/flattening/iframe-flattening-async-frame-scrolling-dynamic.html * page/Settings.yaml: Call setNeedsRelayoutAllFrames when one of the AsyncFrameScrolling or FrameFlattening options is changed. * page/SettingsBase.cpp: Include RenderWidget to make call on frame->ownerRenderer(). (WebCore::SettingsBase::setNeedsRelayoutAllFrames): Make layout and preferred widths dirty on all frames in the page and schedule a relayout. * page/SettingsBase.h: Declare setNeedsRelayoutAllFrames(). 2018-03-07 Alejandro G. Castro <alex@igalia.com> Make NetworkRTCResolver port agnostic https://bugs.webkit.org/show_bug.cgi?id=178855 Reviewed by Youenn Fablet. Add new API in the DNSResolveQueue allowing to revolve hostnames and get the result. Add platform specific code for soup platform and refactor the other platforms. Added new API to the DNS API header and move the general code to the DNS.cpp file, that way we can reuse that code in all the platforms and leave the ResolveQueue class of the platforms in a file. No new tests because this is a refactor. * PlatformAppleWin.cmake: Move the DNSCFNet class to DNSResolveQueueCFNet. * PlatformMac.cmake: Ditto. * Sources.txt: Add the DNS.cpp for compilation. * SourcesCocoa.txt: Move the DNSCFNet class to DNSResolveQueueCFNet. * WebCore.xcodeproj/project.pbxproj: Move the DNSCFNet class to DNSResolveQueueCFNet, add the DNS.cpp for compilation. Add the new DNSResolveQueueCFNet class. * platform/Curl.cmake: Move the DNSCFNet class to DNSResolveQueueCurl. * platform/network/DNS.cpp: Add this file with the default implementation of the DNS functions for all the platforms. (WebCore::prefetchDNS): Copied from every platform implementation. (WebCore::resolveDNS): Add the function, resolves a hostname, receives the identifier of the operation and the completion handler. (WebCore::stopResolveDNS): Add the function, stops a resolution operation, receives the identifier of the operation. * platform/network/DNS.h: Add the new APIs resolveDNS and stopResolveDNS with the classes used for the implementation. (WebCore::IPAddress::IPAddress): Add this class used to send the resolved address information, it does not depend on libwebrtc rtc classes. (WebCore::IPAddress::get): Get a reference to the struct sockaddr_in in the IPAddress class. (WebCore::DNSCompletionHandler): Add this CompletionHandler type to be used when resolving the DNS address. * platform/network/DNSResolveQueue.cpp: Add the DNSResolveQueue platform instantiation in the singleton. (WebCore::DNSResolveQueue::singleton): Use DNSResolveQueue platform classes when creating the singleton.. (WebCore::DNSResolveQueue::resolve): Add this method to get the address of a hostname, it sends the identifier and the completion handler to use when returning the result. (WebCore::DNSResolveQueue::stopResolve): Add this method to stop the resolve operation when required. * platform/network/DNSResolveQueue.h: Add the new methods and make the class abstract, so that every platform can implement the functions. * platform/network/cf/DNSResolveQueueCFNet.cpp: Renamed from Source/WebCore/platform/network/cf/DNSCFNet.cpp. Add the methods to the new class DNSResolveQueueCFNet, move the prefetchDNS to the DNS.cpp general implementation. * platform/network/cf/DNSResolveQueueCFNet.h: Add the new class inheriting from the DNSResolveQueue. Add the new methods, we have to implement these methods and move the NetworkRTCResolver for COCOA code here. (WebCore::DNSResolveQueueCF::resolve): Dummy method, not implemented. (WebCore::DNSResolveQueueCF::stopResolve): Ditto. * platform/network/curl/DNSResolveQueueCurl.cpp: Renamed from Source/WebCore/platform/network/curl/DNSCurl.cpp. * platform/network/curl/DNSResolveQueueCurl.h: Add the new class inheriting from the DNSResolveQueue. (WebCore::DNSResolveQueueCurl::resolve): Ditto. (WebCore::DNSResolveQueueCurl::stopResolve): Ditto. * platform/network/soup/DNSResolveQueueSoup.h: New class inheriting from the DNSResolveQueue class, adding a HasMap with the active operations, it allows stopping them. * platform/network/soup/DNSResolveQueueSoup.cpp: Renamed from Source/WebCore/platform/network/curl/DNSSoup.cpp. (WebCore::resolvedWithObserverCallback): Called when the result address from the soup platform is ready, sends the address to the completion handler. (WebCore::DNSResolveQueueSoup::resolve): Launch the resolve operation with the soup library. (WebCore::DNSResolveQueueSoup::stopResolve): Stop the resolve operation on process with a GCancellable. 2018-03-06 Brian Burg <bburg@apple.com> [Cocoa] Stop copying ForwardingHeaders directory that no longer exists https://bugs.webkit.org/show_bug.cgi?id=183396 Reviewed by Dan Bernstein. * WebCore.xcodeproj/project.pbxproj: Rename the phase to "Copy ICU Headers". ForwardingHeaders are no longer a thing. 2018-03-06 Youenn Fablet <youenn@apple.com> didReceiveServerRedirectForProvisionalNavigation is not called in case of document redirection with service worker registration change https://bugs.webkit.org/show_bug.cgi?id=183299 <rdar://problem/37547029> Reviewed by Alex Christensen. In case of redirection with service worker registration change, we cancel the load and create a new one. This prevent ResourceLoader::willSendRequestInternal to call the didReceiveServerRedirectForProvisionalNavigation callback. We thus explictly call this callback after restarting the load with the new service worker step. We only call this callback if the main resource is there as we do not want to call it if it was blocked by content extension. Test: http/wpt/service-workers/navigation-redirect-main-frame.https.html * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange): 2018-03-06 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Remove unnecessary copied ResourceRequest member variable. https://bugs.webkit.org/show_bug.cgi?id=183010 Reviewed by Youenn Fablet. * platform/network/ResourceHandle.h: * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/curl/CurlRequest.h: (WebCore::CurlRequest::resourceRequest const): * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::addCacheValidationHeaders): (WebCore::ResourceHandle::createCurlRequest): (WebCore::ResourceHandle::restartRequestWithCredential): (WebCore::ResourceHandle::continueAfterWillSendRequest): 2018-03-06 Nan Wang <n_wang@apple.com> AX: Flaky test after r229310 https://bugs.webkit.org/show_bug.cgi?id=183376 <rdar://problem/38188685> Reviewed by Chris Fleizach. The test that forces the context menu to show sometimes locks up the test runner. Also, we missed a case where calling AXShowMenu action on a combobox is not dispatching the accessibility event. Using the combobox example to test the event dispatching in order to avoid the test hang. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityPerformShowMenuAction]): (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]): 2018-03-06 Chris Dumez <cdumez@apple.com> fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed.html fails with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183345 Reviewed by Alex Christensen. FrameLoader::loadURL() was calling loadWithNavigationAction() and then resetting the m_quickRedirectComing flag right after. This works if the navigation policy decision triggered by loadWithNavigationAction() is made synchronously. However, when it is made asynchronously, the flag gets reset too early, before the policy decision handler has been called. This is an issue because the policy decision handler relies on the m_quickRedirectComing flag. Similarly, FrameLoader::loadFrameRequest() was calling loadPostRequest() / loadURL() and then focusing a frame right after. This does not work as intended when the navigation policy decision is made asynchronously. To address the issue, we now pass a completion handler that gets called when the operation has actually completion, after the policy decision has been made. This maintains the behavior in place with synchronous policy delegates. Test: fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed-async-delegates.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::loadFrameRequest): (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::load): (WebCore::FrameLoader::loadWithDocumentLoader): (WebCore::FrameLoader::reloadWithOverrideEncoding): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::loadPostRequest): (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/FrameLoader.h: 2018-03-06 Antoine Quint <graouts@apple.com> [Web Animations] Add a new CSSTransition subclass of WebAnimation https://bugs.webkit.org/show_bug.cgi?id=183373 <rdar://problem/38181985> Reviewed by Dean Jackson. Adding a new CSSAnimation subclass which we will create in a later patch while resolving styles upon identifying that a new CSS Animation has been added to an element. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/CSSTransition.cpp: Added. (WebCore::CSSTransition::create): (WebCore::CSSTransition::CSSTransition): * animation/CSSTransition.h: Added. * animation/CSSTransition.idl: Added. * animation/KeyframeEffect.cpp: * animation/WebAnimation.h: (WebCore::WebAnimation::isCSSTransition const): * bindings/js/JSWebAnimationCustom.cpp: (WebCore::toJSNewlyCreated): * bindings/js/WebCoreBuiltinNames.h: 2018-03-06 Megan Gardner <megan_gardner@apple.com> Ensure system appearance is default for web content https://bugs.webkit.org/show_bug.cgi?id=183354 <rdar://problem/36975571> <rdar://problem/38162381> Make sure the the system appearance for web content is default, and consolidate that code to a single class. Reviewed by Tim Horton. Not currently testable, will add tests in a future patch. * WebCore.xcodeproj/project.pbxproj: * platform/mac/LocalDefaultSystemAppearance.h: Added. * platform/mac/LocalDefaultSystemAppearance.mm: Added. (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): * platform/mac/ThemeMac.mm: (-[WebCoreThemeView init]): (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::systemColor const): 2018-03-06 Antoine Quint <graouts@apple.com> [Web Animations] Add a new runtime flag to control whether CSS Animations and CSS Transitions should run using the Web Animations timeline https://bugs.webkit.org/show_bug.cgi?id=183370 <rdar://problem/38180729> Reviewed by Dean Jackson. Before we start creating WebAnimation objects to perform CSS Animations and CSS Transitions, which will replace the existing codepath involving CSSAnimationController and CompositeAnimation, we need a runtime flag that will allow all the new code to be turned off by default while we bring this feature up. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): (WebCore::RuntimeEnabledFeatures::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled const): 2018-03-06 Daniel Bates <dabates@apple.com> Make more use of USE(OPENGL_ES) and replace typedefs with C++11 using statements in TextureCacheCV.h Rubber-stamped by Tim Horton. * platform/graphics/cv/TextureCacheCV.h: 2018-03-06 Antti Koivisto <antti@apple.com> Cache hasComplexSelectorsForStyleAttribute bit https://bugs.webkit.org/show_bug.cgi?id=183363 Reviewed by Andreas Kling. * css/DocumentRuleSets.cpp: (WebCore::DocumentRuleSets::collectFeatures const): (WebCore::DocumentRuleSets::hasComplexSelectorsForStyleAttribute const): Cache the bit to avoid hash lookups. * css/DocumentRuleSets.h: * dom/StyledElement.cpp: (WebCore::StyledElement::invalidateStyleAttribute): (WebCore::shouldSynchronizeStyleAttributeImmediatelyForInvalidation): Deleted. Move code to DocumentRuleSets. 2018-03-06 Myles C. Maxfield <mmaxfield@apple.com> Change the type of SVGToOTFFontConverter::m_weight to be not a char https://bugs.webkit.org/show_bug.cgi?id=183339 Reviewed by Alex Christensen. No new tests because there is no behavior change. * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::appendOS2Table): (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): 2018-03-06 Antoine Quint <graouts@apple.com> [Web Animations] Add a new CSSAnimation subclass of WebAnimation https://bugs.webkit.org/show_bug.cgi?id=183371 <rdar://problem/38181724> Reviewed by Dean Jackson. Adding a new CSSAnimation subclass which we will create in a later patch while resolving styles upon identifying that a new CSS Animation has been added to an element. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/CSSAnimation.cpp: Added. (WebCore::CSSAnimation::create): (WebCore::CSSAnimation::CSSAnimation): * animation/CSSAnimation.h: Added. * animation/CSSAnimation.idl: Added. * animation/KeyframeEffectReadOnly.cpp * animation/WebAnimation.h: (WebCore::WebAnimation::isCSSAnimation const): * animation/WebAnimation.idl: * bindings/js/JSWebAnimationCustom.cpp: (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: 2018-03-06 Ms2ger <Ms2ger@igalia.com> Explicitly qualify some method calls on this in lambdas in Service Worker code. https://bugs.webkit.org/show_bug.cgi?id=183367 Reviewed by Chris Dumez. No new tests -- no change in behavior. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource): * workers/service/server/SWServer.cpp: (WebCore::SWServer::matchAll): 2018-03-06 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Remove unused scrolling-related code in TextureMapperLayer, CoordinatedGraphics stack https://bugs.webkit.org/show_bug.cgi?id=183340 Reviewed by Michael Catanzaro. TextureMapperLayer::scrollBy() method is completely unused and can be removed. This opens the gates on removing majority of scrolling-related code in TextureMapperLayer, CoordinatedGraphicsLayer and CoordinatedGraphicsScene classes, along with smaller bits in other closely-associated classes. We're able to remove two virtual method overrides in the ScrollingCoordinatorCoordinatedGraphics class. TextureMapperLayer can drop the ScrollingClient member variable, along with multiple others. Various unused methods in that class are removed as well. CoordinatedGraphicsLayer and GraphicsLayerTextureMapper can both remove the custom scrolling state tracking. No new tests -- no change in behavior. * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp: (WebCore::ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange): Deleted. (WebCore::ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea): Deleted. * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper): (WebCore::GraphicsLayerTextureMapper::commitLayerChanges): (WebCore::GraphicsLayerTextureMapper::didCommitScrollOffset): Deleted. (WebCore::GraphicsLayerTextureMapper::setIsScrollable): Deleted. * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::hitTest): Deleted. (WebCore::TextureMapperLayer::scrollableLayerHitTestCondition): Deleted. (WebCore::TextureMapperLayer::findScrollableContentsLayerAt): Deleted. (WebCore::TextureMapperLayer::mapScrollOffset): Deleted. (WebCore::TextureMapperLayer::commitScrollOffset): Deleted. (WebCore::TextureMapperLayer::scrollBy): Deleted. (WebCore::TextureMapperLayer::didCommitScrollOffset): Deleted. * platform/graphics/texmap/TextureMapperLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): (WebCore::CoordinatedGraphicsLayer::syncLayerState): (WebCore::CoordinatedGraphicsLayer::resetLayerState): (WebCore::CoordinatedGraphicsLayer::setScrollableArea): Deleted. (WebCore::CoordinatedGraphicsLayer::commitScrollOffset): Deleted. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h: 2018-03-06 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value https://bugs.webkit.org/show_bug.cgi?id=183360 Reviewed by Sergio Villar Senin. When animations are being applied on the TextureMapperLayer tree, the monotonic time value is retrieved repeatedly in TextureMapperAnimation class. Instead of spawning repeated syscalls that are required to obtain the time value, TextureMapperLayer::applyAnimationsRecursively() now accepts a MonotonicTime value that should be used for all animation updates. No new tests -- no change in behavior. * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly): * platform/graphics/texmap/TextureMapperAnimation.cpp: (WebCore::TextureMapperAnimation::apply): (WebCore::TextureMapperAnimation::computeTotalRunningTime): (WebCore::TextureMapperAnimations::apply): * platform/graphics/texmap/TextureMapperAnimation.h: (WebCore::TextureMapperAnimation::keyframes const): (WebCore::TextureMapperAnimation::animation const): (WebCore::TextureMapperAnimation::boxSize const): Deleted. (WebCore::TextureMapperAnimation::listsMatch const): Deleted. (WebCore::TextureMapperAnimation::startTime const): Deleted. (WebCore::TextureMapperAnimation::pauseTime const): Deleted. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::applyAnimationsRecursively): (WebCore::TextureMapperLayer::syncAnimations): * platform/graphics/texmap/TextureMapperLayer.h: 2018-03-06 Zan Dobersek <zdobersek@igalia.com> [CoordGraphics] Clean up CoordinatedImageBacking https://bugs.webkit.org/show_bug.cgi?id=183332 Reviewed by Carlos Garcia Campos. Clean up the CoordinatedImageBacking class. Prefer reference values in class functions, methods and member variables, where possible. Move member variables into a more sensible order. Initialize a few member variables at the place of declaration. Drop releaseSurfaceIfNeeded() and updateVisibilityIfNeeded() methods, integrating them into the update() method, which was the only place where they were called from. We don't have to keep a reference to the buffer object, since we're not using it internally after it's been passed to the client's updateImageBacking() implementation. No new tests -- no change in behavior. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::syncImageBacking): (WebCore::CoordinatedGraphicsLayer::releaseImageBackingIfNeeded): * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp: (WebCore::CoordinatedImageBacking::getCoordinatedImageBackingID): (WebCore::CoordinatedImageBacking::CoordinatedImageBacking): (WebCore::CoordinatedImageBacking::addHost): (WebCore::CoordinatedImageBacking::removeHost): (WebCore::CoordinatedImageBacking::update): (WebCore::CoordinatedImageBacking::clearContentsTimerFired): (WebCore::CoordinatedImageBacking::create): Deleted. (WebCore::CoordinatedImageBacking::markDirty): Deleted. (WebCore::CoordinatedImageBacking::releaseSurfaceIfNeeded): Deleted. (WebCore::CoordinatedImageBacking::updateVisibilityIfNeeded): Deleted. * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h: 2018-03-06 Zan Dobersek <zdobersek@igalia.com> GraphicsLayerTextureMapper: remove the setAnimations() method https://bugs.webkit.org/show_bug.cgi?id=183358 Reviewed by Carlos Garcia Campos. Remove the GraphicsLayerTextureMapper::setAnimations() method. This was not called from anywhere, and is not the way animations are generated for a given GraphicsLayer object (that would be addAnimation() method). * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::setAnimations): Deleted. * platform/graphics/texmap/GraphicsLayerTextureMapper.h: 2018-03-06 Nan Wang <n_wang@apple.com> AX: AOM: More accessibility events support https://bugs.webkit.org/show_bug.cgi?id=183023 <rdar://problem/37764380> Reviewed by Chris Fleizach. Accessibility events. Spec: https://wicg.github.io/aom/spec/phase2.html This change adds support for these new events: accessiblecontextmenu accessibledecrement accessibledismiss accessiblefocus accessibleincrement accessiblescrollintoview accessibleselect Note: The show context menu action is only supported on macOS now. The dismiss action is not implemented for all the platforms yet. Test: accessibility/mac/AOM-events-all.html * accessibility/AccessibilityListBoxOption.cpp: (WebCore::AccessibilityListBoxOption::setSelected): * accessibility/AccessibilityMediaObject.cpp: (WebCore::AccessibilityMediaObject::increment): (WebCore::AccessibilityMediaObject::decrement): * accessibility/AccessibilityMenuListOption.cpp: (WebCore::AccessibilityMenuListOption::setSelected): * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::increment): (WebCore::AccessibilityNodeObject::decrement): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::press): (WebCore::AccessibilityObject::dispatchAccessibilityEvent const): (WebCore::AccessibilityObject::dispatchAccessibilityEventWithType const): (WebCore::AccessibilityObject::dispatchAccessibleSetValueEvent const): (WebCore::AccessibilityObject::scrollToMakeVisible const): (WebCore::AccessibilityObject::dispatchAccessibilityEvent): Deleted. (WebCore::AccessibilityObject::dispatchAccessibleSetValueEvent): Deleted. * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setFocused): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]): * dom/Element.idl: * dom/EventNames.h: 2018-03-05 Yusuke Suzuki <utatane.tea@gmail.com> Fix std::make_unique / new[] using system malloc https://bugs.webkit.org/show_bug.cgi?id=182975 Reviewed by JF Bastien. Use Vector, FAST_ALLOCATED, or UniqueArray instead. * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::setBuffer): * Modules/webaudio/AudioBufferSourceNode.h: * css/StyleRule.h: * cssjit/CompiledSelector.h: * html/HTMLFrameSetElement.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::LRUImageBufferCache): (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer): (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::bubbleToFront): * html/canvas/WebGLRenderingContextBase.h: * platform/Length.cpp: (WebCore::newCoordsArray): (WebCore::newLengthArray): (): Deleted. * platform/Length.h: * platform/audio/DynamicsCompressor.cpp: (WebCore::DynamicsCompressor::setNumberOfChannels): * platform/audio/DynamicsCompressor.h: * platform/audio/FFTFrame.h: * platform/audio/gstreamer/FFTFrameGStreamer.cpp: (WebCore::FFTFrame::FFTFrame): * platform/graphics/FormatConverter.h: (WebCore::FormatConverter::FormatConverter): * platform/graphics/GraphicsContext3D.cpp: (WebCore::GraphicsContext3D::texImage2DResourceSafe): * platform/graphics/GraphicsContext3D.h: * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::getDirtyRects): * platform/graphics/cairo/CairoUtilities.cpp: (WebCore::flipImageSurfaceVertically): * platform/graphics/cg/GraphicsContext3DCG.cpp: (WebCore::GraphicsContext3D::ImageExtractor::extractImage): * platform/graphics/gpu/Texture.cpp: (WebCore::Texture::updateSubRect): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): (WebCore::GraphicsContext3D::compileShader): (WebCore::GraphicsContext3D::getActiveAttribImpl): (WebCore::GraphicsContext3D::getActiveUniformImpl): (WebCore::GraphicsContext3D::getProgramInfoLog): (WebCore::GraphicsContext3D::getShaderInfoLog): * platform/graphics/texmap/TextureMapperShaderProgram.cpp: (WebCore::getShaderLog): (WebCore::getProgramLog): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::putData): * platform/image-decoders/png/PNGImageDecoder.cpp: (WebCore::PNGImageReader::PNGImageReader): (WebCore::PNGImageReader::close): (WebCore::PNGImageReader::interlaceBuffer const): (WebCore::PNGImageReader::createInterlaceBuffer): * platform/image-decoders/webp/WEBPImageDecoder.cpp: (WebCore::WEBPImageDecoder::decodeFrame): * platform/network/curl/SocketStreamHandleImpl.h: (WebCore::SocketStreamHandleImpl::SocketData::SocketData): * platform/network/curl/SocketStreamHandleImplCurl.cpp: (WebCore::createCopy): (WebCore::SocketStreamHandleImpl::readData): (): Deleted. * platform/network/soup/SocketStreamHandleImpl.h: * platform/network/soup/SocketStreamHandleImplSoup.cpp: (WebCore::SocketStreamHandleImpl::connected): * platform/win/LoggingWin.cpp: (WebCore::logLevelString): 2018-03-05 Yoav Weiss <yoav@yoav.ws> Support for preconnect Link headers https://bugs.webkit.org/show_bug.cgi?id=181657 Reviewed by Darin Adler. Move the preconnect functionality into its own function, and also call this function when Link headers are processed. Test: http/tests/preconnect/link-header-rel-preconnect-http.php * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded. (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here. (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded. * loader/LinkLoader.h: 2018-03-05 Antti Koivisto <antti@apple.com> Add ChildrenAffectedByForwardPositionalRules bit for nth-child pseudo class marking https://bugs.webkit.org/show_bug.cgi?id=183341 <rdar://problem/38151470> Reviewed by Zalan Bujtas. Use it instead of AffectsNextSibling/AffectedByPreviousSibling bits, similar to ChildrenAffectedByBackwardPositionalRules bit. This is more efficient and requires way less marking. * css/SelectorChecker.cpp: (WebCore::countElementsBefore): (WebCore::countElementsOfTypeBefore): (WebCore::SelectorChecker::checkOne const): Mark with ChildrenAffectedByForwardPositionalRules. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf): Mark with ChildrenAffectedByForwardPositionalRules. * dom/Element.cpp: (WebCore::checkForSiblingStyleChanges): Invalidate siblings after added/removed element. (WebCore::Element::setChildrenAffectedByForwardPositionalRules): (WebCore::Element::hasFlagsSetDuringStylingOfChildren const): (WebCore::Element::rareDataChildrenAffectedByForwardPositionalRules const): Add the new marking bit. * dom/Element.h: (WebCore::Element::childrenAffectedByForwardPositionalRules const): (WebCore::Element::attributeWithoutSynchronization const): Remove assert so we can use this to get the current unresolved lazy value of style attrbute. * dom/ElementRareData.h: (WebCore::ElementRareData::childrenAffectedByForwardPositionalRules const): (WebCore::ElementRareData::setChildrenAffectedByForwardPositionalRules): (WebCore::ElementRareData::ElementRareData): (WebCore::ElementRareData::resetStyleRelations): Add the new marking bit. * dom/StyledElement.cpp: (WebCore::StyledElement::invalidateStyleAttribute): In special case where we have attribute selectors for style attribute, synchronize the attribute immediately so we get invalidation right. Tested by fast/css/style-attribute-invalidation-propagates-to-counted-siblings.html * style/StyleRelations.cpp: (WebCore::Style::commitRelationsToRenderStyle): (WebCore::Style::commitRelations): Commit the new bit. * style/StyleRelations.h: 2018-03-05 Ryan Haddad <ryanhaddad@apple.com> Unreviewed build fix, remove unused variables. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeSpeakAs): (WebCore::consumeHangingPunctuation): 2018-03-05 Chris Dumez <cdumez@apple.com> fast/loader/onload-policy-ignore-for-frame.html is timing out with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183337 Reviewed by Ryosuke Niwa. Make sure we call checkCompleted() before calling checkLoadComplete() in FrameLoader::continueLoadAfterNavigationPolicy() when the client tells us to ignore the navigation, so that we properly recognize that the load is done. This matches what is already done in FrameLoader::receivedMainResourceError(). Test: fast/loader/onload-policy-ignore-for-frame-async-delegates.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): 2018-03-05 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Allow user-installed fonts to be disabled https://bugs.webkit.org/show_bug.cgi?id=183349 Rubber stamped by Brent Fulgham. Tests: fast/text/user-installed-font.html fast/text/user-installed-fonts/disable.html fast/text/user-installed-fonts/shadow-disable.html fast/text/user-installed-fonts/shadow-family-disable.html fast/text/user-installed-fonts/shadow-family.html fast/text/user-installed-fonts/shadow-postscript-disable.html fast/text/user-installed-fonts/shadow-postscript-family-disable.html fast/text/user-installed-fonts/shadow-postscript-family.html fast/text/user-installed-fonts/shadow-postscript.html fast/text/user-installed-fonts/shadow.html fast/text/user-installed-fonts/system-ui.html * platform/graphics/cocoa/FontCacheCoreText.cpp: 2018-03-05 Myles C. Maxfield <mmaxfield@apple.com> Silence OpenGL and OpenGL ES deprecation warnings in newer SDKs https://bugs.webkit.org/show_bug.cgi?id=183350 Unreviewed. * Configurations/WebCore.xcconfig: 2018-03-05 Andy Estes <aestes@apple.com> [Mac] Teach WebCore::Pasteboard about file promise drags https://bugs.webkit.org/show_bug.cgi?id=183314 <rdar://problem/38105493> Reviewed by Darin Adler. While WebKit does support receiving file promise drags (since r210360), WebCore::Pasteboard has not been instructed on how to read their file paths. When the various pasteboard readers ask for file paths after a file promise drop, they receive an empty vector. This impacts various features, most notably the DataTransfer API. Pasteboard actually cannot learn about promised file paths from the pasteboard itself, as the pasteboard only contains the dragged files' UTIs. Promised file paths aren't known until the WebKits call -[NSFilePromiseReceiver receivePromisedFilesAtDestination:...], at which point the file paths are passed to WebCore as part of WebCore::DragData. When we construct new Pasteboards for drag and drop, we need to store any promised file paths from the DragData. Then, when the various pasteboard readers ask for file paths and NSFilesPromisePboardType is on the pasteboard, we can return these promised file paths. Tests: editing/pasteboard/data-transfer-items-drag-drop-file-promise.html editing/pasteboard/data-transfer-items-drop-file-promise.html editing/pasteboard/datatransfer-items-drop-plaintext-file-promise.html editing/pasteboard/datatransfer-types-dropping-text-file-promise.html editing/pasteboard/drag-file-promises-to-editable-element-as-URLs.html editing/pasteboard/drag-file-promises-to-editable-element-as-attachment.html editing/pasteboard/file-input-files-access-promise.html * platform/FileSystem.h: * platform/Pasteboard.h: (WebCore::Pasteboard::Pasteboard): * platform/mac/DragDataMac.mm: (WebCore::DragData::containsPromise const): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::Pasteboard): (WebCore::Pasteboard::createForDragAndDrop): (WebCore::toString): (WebCore::Pasteboard::read): (WebCore::Pasteboard::readFilePaths): (WebCore::absoluteURLsFromPasteboardFilenames): Deleted. * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::numberOfFiles const): 2018-03-05 Andy Estes <aestes@apple.com> [Mac] Fix the build * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): Removed unused variables. 2018-03-05 Antti Koivisto <antti@apple.com> Don't invalidate all children when doing insertion/deletion in presence of backward positional selectors https://bugs.webkit.org/show_bug.cgi?id=183325 <rdar://problem/38134480> Reviewed by Zalan Bujtas. It is sufficient to invalidate siblings before the mutation point. * dom/Element.cpp: (WebCore::checkForSiblingStyleChanges): We already do sibling walk in the case of forwards positional rules and sibling combinators. The work done here is insignifant compared to cost of overinvalidating. 2018-03-05 Ali Juma <ajuma@chromium.org> imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html times out with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183297 Reviewed by Chris Dumez. When a FrameLoader's policy document loader is cleared after receiving a navigation policy decision to not continue loading, we still need to trigger a check for load completion, since this loader or an ancestor loader may have been in state isLoadingInAPISense only because of the existence of the just-cleared policy document loader. Without triggering this check, these loaders may never call WebFrameLoaderClient::dispatchDidFinishLoad. Test: http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): 2018-03-04 Yusuke Suzuki <utatane.tea@gmail.com> [WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively https://bugs.webkit.org/show_bug.cgi?id=183312 Reviewed by Mark Lam. Remove wtf/CurrentTime.h include pragma. * Modules/geolocation/Geolocation.cpp: * Modules/mediasource/SourceBuffer.cpp: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: * Modules/speech/SpeechSynthesis.cpp: * contentextensions/ContentExtensionCompiler.cpp: * contentextensions/ContentExtensionParser.cpp: * dom/Document.cpp: * dom/Element.cpp: * dom/Event.cpp: * dom/ScriptedAnimationController.cpp: * dom/SimulatedClick.cpp: * fileapi/File.cpp: * fileapi/FileReader.cpp: * history/CachedPage.cpp: * html/BaseDateAndTimeInputType.cpp: * html/DateTimeInputType.cpp: * html/HTMLMediaElement.cpp: * html/MediaController.cpp: * html/MediaElementSession.cpp: * html/MonthInputType.cpp: * html/TimeInputType.cpp: * html/parser/HTMLParserScheduler.h: * inspector/InspectorCanvas.cpp: * loader/FrameLoader.cpp: * loader/LoadTiming.cpp: * loader/NavigationScheduler.cpp: * loader/ProgressTracker.cpp: * loader/cache/CachedCSSStyleSheet.cpp: * loader/cache/CachedImage.cpp: * loader/cache/CachedResource.cpp: * loader/cache/MemoryCache.cpp: * page/DOMTimer.cpp: * page/DOMWindow.cpp: * page/DragController.cpp: * page/EventHandler.cpp: * page/FocusController.cpp: * page/FrameView.cpp: * page/Page.cpp: * page/Performance.cpp: * page/PerformanceTiming.cpp: * page/animation/AnimationBase.cpp: * page/animation/CSSAnimationController.cpp: * page/mac/WheelEventDeltaFilterMac.mm: * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: * platform/ScrollAnimationKinetic.cpp: * platform/ScrollAnimationSmooth.cpp: * platform/ThreadTimers.cpp: * platform/Timer.cpp: * platform/audio/mac/AudioSampleDataSource.mm: * platform/cocoa/ScrollController.mm: * platform/gamepad/cocoa/GameControllerGamepad.mm: * platform/gamepad/mac/HIDGamepad.cpp: * platform/graphics/BitmapImage.cpp: * platform/graphics/DisplayRefreshMonitorManager.cpp: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/ca/GraphicsLayerCA.cpp: * platform/graphics/ca/LayerPool.cpp: * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: * platform/graphics/ca/win/CACFLayerTreeHost.cpp: * platform/graphics/ca/win/PlatformCALayerWin.cpp: * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: * platform/graphics/cg/GraphicsContextCG.cpp: * platform/graphics/cocoa/WebCoreDecompressionSession.mm: * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: * platform/graphics/mac/DisplayRefreshMonitorMac.cpp: * platform/graphics/texmap/BitmapTexturePool.h: * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: * platform/graphics/texmap/TextureMapper.cpp: * platform/graphics/texmap/TextureMapperAnimation.cpp: * platform/graphics/texmap/TextureMapperFPSCounter.cpp: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/graphics/win/GraphicsLayerDirect2D.cpp: * platform/gtk/PlatformKeyboardEventGtk.cpp: * platform/gtk/ScrollAnimatorGtk.cpp: * platform/ios/LegacyTileCache.mm: * platform/ios/LegacyTileLayerPool.mm: * platform/ios/ScrollViewIOS.mm: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: * platform/mock/MockRealtimeMediaSource.cpp: * platform/mock/MockRealtimeVideoSource.cpp: * platform/network/CacheValidation.cpp: * platform/network/DNSResolveQueue.cpp: * platform/network/ResourceResponseBase.cpp: * platform/network/curl/CurlCacheEntry.cpp: * platform/network/soup/ResourceHandleSoup.cpp: * platform/text/TextEncodingRegistry.cpp: * platform/text/win/LocaleWin.cpp: * platform/win/MainThreadSharedTimerWin.cpp: * platform/win/PlatformMouseEventWin.cpp: * rendering/RenderLayerCompositor.cpp: * rendering/RenderProgress.cpp: * svg/animation/SMILTimeContainer.cpp: * testing/MockGamepad.cpp: * workers/WorkerRunLoop.cpp: 2018-03-04 Tim Horton <timothy_horton@apple.com> Make !ENABLE(DATA_DETECTION) iOS build actually succeed https://bugs.webkit.org/show_bug.cgi?id=183283 <rdar://problem/38062148> Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: 2018-03-03 Said Abou-Hallawa <sabouhallawa@apple.com> Delete incorrect version of clampTo() function from SVGToOTFFontConversion.cpp https://bugs.webkit.org/show_bug.cgi?id=183165 Reviewed by Darin Adler. Some of the calls in SVGToOTFFontConversion.cpp were directed to the function in MathExtras.h while the rest were directed to this local static function. There should not be two versions with the same name while they are supposed to do the same thing. Besides, the local version does not work correctly if the type of the argument's max limit is less the max limit of the returned type, e.g. char -> uint16_t. * svg/SVGToOTFFontConversion.cpp: (WebCore::clampTo): Deleted. 2018-03-03 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move styleDidChange mutation logic to RenderTreeUpdater https://bugs.webkit.org/show_bug.cgi?id=183273 <rdar://problem/38054892> Reviewed by Antti Koivisto. Covered by existing tests. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleDidChange): (WebCore::RenderElement::noLongerAffectsParentBlock const): Deleted. * rendering/RenderElement.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): 2018-03-03 Yoav Weiss <yoav@yoav.ws> Link headers for subresources are not being processes https://bugs.webkit.org/show_bug.cgi?id=181789 Reviewed by Youenn Fablet. Triggers Link header processing when the Link headers arrive on a subresource. Test: http/tests/preload/link-header-on-subresource.html * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLinksFromHeader): Change the media check conditions. * loader/LinkLoader.h: Add a third state for media checks. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveResponse): Preload links from headers for subresources. 2018-03-02 Yusuke Suzuki <utatane.tea@gmail.com> [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds https://bugs.webkit.org/show_bug.cgi?id=183293 Reviewed by Alex Christensen. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture): 2018-03-02 Dean Jackson <dino@apple.com> Remove NP_GLContext since it is unsupported https://bugs.webkit.org/show_bug.cgi?id=183305 <rdar://problem/36875555> Reviewed by Simon Fraser. * plugins/npapi.h: Remove NP_GLContext and mention that it is not supported. 2018-03-02 Chris Dumez <cdumez@apple.com> imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html crashes with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183294 <rdar://problem/38073596> Reviewed by Youenn Fablet. Drop code that was added to SubresourceLoader::willCancel() in r228852. The purpose of this code was to make sure that SubresourceLoader::m_policyForResponseCompletionHandler always gets called, even when the load is cancelled. However, this code is not needed (since m_policyForResponseCompletionHandler is a CompletionHandler, an assertion will be hit if we fail to call it and we'll know). Calling the completionHandler inside SubresourceLoader::willCancel() is too early and leads to crashes. The completionHandler currently gets called DocumentLoader::responseReceived() via a call to mainResourceLoader->didReceiveResponsePolicy(). Note that in r229177, we made sure that the call to didReceiveResponsePolicy() happens *after* the call to continueAfterContentPolicy() to maintain our non-async policy delegate behavior. However, continueAfterContentPolicy() would end up calling willCancel() and call the completionHandler when shouldContinue was false. Test: http/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-async-delegate.html * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willCancel): 2018-03-02 Tim Horton <timothy_horton@apple.com> Fix the build after r229185 and r229184 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::exernalDeviceDisplayNameForPlayer): * platform/ios/DeviceOrientationClientIOS.h: * platform/ios/DeviceOrientationClientIOS.mm: 2018-03-02 Tim Horton <timothy_horton@apple.com> Make the !ENABLE(DEVICE_ORIENTATION) iOS build succeed https://bugs.webkit.org/show_bug.cgi?id=183296 Reviewed by Dan Bernstein. * platform/ios/DeviceMotionClientIOS.h: * platform/ios/DeviceMotionClientIOS.mm: * platform/ios/WebCoreMotionManager.h: * platform/ios/WebCoreMotionManager.mm: 2018-03-02 Tim Horton <timothy_horton@apple.com> Make it possible to build for iOS without Celestial https://bugs.webkit.org/show_bug.cgi?id=183295 <rdar://problem/38074468> Reviewed by Dan Bernstein. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::exernalDeviceDisplayNameForPlayer): 2018-03-02 Youenn Fablet <youenn@apple.com> Clients should register to StorageProcess with their service worker registration identifier https://bugs.webkit.org/show_bug.cgi?id=182313 <rdar://problem/38044403> Reviewed by Chris Dumez. Relanding with fixing matchAll for uncontrolled clients. No observable change of behavior in regular conditions. When service worker process crashes, the service worker identifiers sent by the WebProcess might be wrong and we will not be able to retrieve the registration from these identifiers. The storage process will be able to still process correctly messages coming from the WebProcess to register clients of the registration. Otherwise, there is a chance that WebProcess clients will not be added to the SWServerRegistration.m_clientsUsingRegistration maps. * dom/Document.cpp: (WebCore::Document::setServiceWorkerConnection): * workers/service/SWClientConnection.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::matchAll): (WebCore::SWServer::claim): (WebCore::SWServer::registerServiceWorkerClient): (WebCore::SWServer::unregisterServiceWorkerClient): (WebCore::SWServer::setClientActiveWorker): Deleted. * workers/service/server/SWServer.h: * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::activate): 2018-03-02 Youenn Fablet <youenn@apple.com> Loads for a Document controlled by a Service Worker should not use AppCache https://bugs.webkit.org/show_bug.cgi?id=183148 Reviewed by Chris Dumez. Covered by updated test. Postponing document loading through app cache after matching service worker registration. Trying to load through app cache only if there is no service worker registration. Disabling app cache for any load that has a service worker registration identifier. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::redirectReceived): (WebCore::DocumentLoader::willSendRequest): (WebCore::DocumentLoader::tryLoadingRequestFromApplicationCache): (WebCore::DocumentLoader::tryLoadingRedirectRequestFromApplicationCache): (WebCore::DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange): (WebCore::DocumentLoader::scheduleSubstituteResourceLoad): (WebCore::DocumentLoader::startLoadingMainResource): * loader/DocumentLoader.h: * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::maybeLoadMainResource): (WebCore::ApplicationCacheHost::maybeLoadMainResourceForRedirect): (WebCore::ApplicationCacheHost::maybeLoadResource): (WebCore::ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache): * loader/appcache/ApplicationCacheHost.h: 2018-03-02 Chris Dumez <cdumez@apple.com> fast/events/before-unload-remove-itself.html crashes with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183290 <rdar://problem/38069045> Reviewed by Alex Christensen. When the navigation policy happens asynchronously, it is now possible for the Frame / FrameLoader to get destroyed between the point that policyChecker().checkNavigationPolicy() is called and when continueLoadAfterNavigationPolicy() is called. To address the issue, we now protect the Frame and capture it in the lambda passed to policyChecker().checkNavigationPolicy(). Test: fast/events/before-unload-remove-itself-async-delegate.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithDocumentLoader): 2018-03-02 Chris Dumez <cdumez@apple.com> Converting a load to a download does not work with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183254 <rdar://problem/38035334> Reviewed by Youenn Fablet. Update DocumentLoader::responseReceived() to call didReceiveResponsePolicy() on the mainResourceLoader *after* calling continueAfterContentPolicy(), not *before*. This makes sure that the WebResourceLoader sends the NetworkResourceLoader::ContinueDidReceiveResponse IPC back to the Network Process *after* the policy decision has been processed, which restores the pre-r228852 order. Test: fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): 2018-03-02 Youenn Fablet <youenn@apple.com> Some RealtimeMediaSource methods do not need to be marked as virtual https://bugs.webkit.org/show_bug.cgi?id=183272 Reviewed by Eric Carlson. No change of behavior. * platform/mediastream/RealtimeMediaSource.h: 2018-03-01 Yusuke Suzuki <utatane.tea@gmail.com> Remove monotonicallyIncreasingTime https://bugs.webkit.org/show_bug.cgi?id=182911 Reviewed by Michael Catanzaro. While generic code uses MonotonicTime, CAAnimation uses media time (CFTimeInterval). At this boundary, we convert MonotonicTime to media time, this is the same logic to the code before this patch. * Modules/gamepad/Gamepad.h: * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::SourceBuffer): (WebCore::SourceBuffer::monitorBufferingRate): * Modules/mediasource/SourceBuffer.h: * Modules/speech/SpeechSynthesis.cpp: (WebCore::SpeechSynthesis::startSpeakingImmediately): (WebCore::SpeechSynthesis::fireEvent): * Modules/speech/SpeechSynthesisUtterance.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::parseRuleList): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const): * dom/Element.cpp: (WebCore::Element::setActive): * history/CachedPage.cpp: (WebCore::CachedPage::CachedPage): (WebCore::CachedPage::hasExpired const): * history/CachedPage.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::startProgressEventTimer): (WebCore::HTMLMediaElement::progressEventTimerFired): (WebCore::HTMLMediaElement::refreshCachedTime const): (WebCore::HTMLMediaElement::invalidateCachedTime const): (WebCore::HTMLMediaElement::currentMediaTime const): (WebCore::HTMLMediaElement::startPlaybackProgressTimer): * html/HTMLMediaElement.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::removeBehaviorRestriction): (WebCore::MediaElementSession::mostRecentUserInteractionTime const): (WebCore::MediaElementSession::resetPlaybackSessionState): * html/MediaElementSession.h: * html/parser/HTMLParserScheduler.cpp: (WebCore::PumpSession::PumpSession): (WebCore::HTMLParserScheduler::HTMLParserScheduler): * html/parser/HTMLParserScheduler.h: (WebCore::HTMLParserScheduler::checkForYield): * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::recordAction): (WebCore::InspectorCanvas::finalizeFrame): * inspector/InspectorCanvas.h: * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::startTracking): (WebCore::InspectorMemoryAgent::didHandleMemoryPressure): (WebCore::InspectorMemoryAgent::collectSample): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::timestamp): (WebCore::InspectorNetworkAgent::didFinishLoading): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::timestamp): * inspector/agents/WebHeapAgent.cpp: (WebCore::WebHeapAgent::dispatchGarbageCollectedEvent): * inspector/agents/WebHeapAgent.h: * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::didDraw): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::didAccessDecodedData): * loader/cache/CachedResource.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::pruneLiveResourcesToSize): * page/EventHandler.cpp: (WebCore::MaximumDurationTracker::MaximumDurationTracker): (WebCore::MaximumDurationTracker::~MaximumDurationTracker): * page/FocusController.cpp: (WebCore::FocusController::setFocusedElement): (WebCore::FocusController::timeSinceFocusWasSet const): * page/FocusController.h: * page/FrameView.cpp: (WebCore::FrameView::reset): (WebCore::FrameView::willPaintContents): (WebCore::FrameView::didPaintContents): * page/FrameView.h: * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::freezeAtTime): (WebCore::AnimationBase::beginAnimationUpdateTime const): * page/animation/AnimationBase.h: (WebCore::AnimationBase::onAnimationStartResponse): * page/animation/CSSAnimationController.cpp: (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdateTime): (WebCore::CSSAnimationControllerPrivate::receivedStartTimeResponse): (WebCore::CSSAnimationControllerPrivate::startTimeResponse): (WebCore::CSSAnimationController::notifyAnimationStarted): * page/animation/CSSAnimationController.h: * page/animation/CSSAnimationControllerPrivate.h: * page/mac/WheelEventDeltaFilterMac.h: * page/mac/WheelEventDeltaFilterMac.mm: (WebCore::WheelEventDeltaFilterMac::beginFilteringDeltas): (WebCore::WheelEventDeltaFilterMac::updateFromDelta): (WebCore::WheelEventDeltaFilterMac::endFilteringDeltas): * platform/ControlStates.h: (WebCore::ControlStates::timeSinceControlWasFocused const): (WebCore::ControlStates::setTimeSinceControlWasFocused): * platform/PlatformSpeechSynthesisUtterance.h: (WebCore::PlatformSpeechSynthesisUtterance::startTime const): (WebCore::PlatformSpeechSynthesisUtterance::setStartTime): * platform/gamepad/PlatformGamepad.h: (WebCore::PlatformGamepad::lastUpdateTime const): (WebCore::PlatformGamepad::connectTime const): (WebCore::PlatformGamepad::PlatformGamepad): * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::HIDGamepad): (WebCore::HIDGamepad::valueChanged): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::suspendAnimations): * platform/graphics/GraphicsLayer.h: * platform/graphics/GraphicsLayerClient.h: (WebCore::GraphicsLayerClient::notifyAnimationStarted): * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: (WebCore::LayerClient::platformCALayerAnimationStarted): (WebCore::AVFWrapper::createImageForTimeInRect): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::addAnimation): (WebCore::GraphicsLayerCA::pauseAnimation): (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted): (WebCore::GraphicsLayerCA::setAnimationOnLayer): (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation): (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction): * platform/graphics/ca/LayerPool.cpp: (WebCore::LayerPool::LayerPool): (WebCore::LayerPool::addLayer): (WebCore::LayerPool::decayedCapacity const): (WebCore::LayerPool::pruneTimerFired): * platform/graphics/ca/LayerPool.h: * platform/graphics/ca/PlatformCAAnimation.h: * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/ca/PlatformCALayerClient.h: (WebCore::PlatformCALayerClient::platformCALayerAnimationStarted): * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::revalidateTiles): (WebCore::TileGrid::startedNewCohort): (WebCore::TileGrid::TileCohortInfo::timeUntilExpiration): (WebCore::TileGrid::cohortRemovalTimerFired): * platform/graphics/ca/TileGrid.h: (WebCore::TileGrid::TileCohortInfo::TileCohortInfo): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (mediaTimeToCurrentTime): (-[WebAnimationDelegate animationDidStart:]): (PlatformCALayerCocoa::animationStarted): * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::notifyAnimationsStarted): * platform/graphics/ca/win/PlatformCALayerWin.cpp: (PlatformCALayerWin::animationStarted): (PlatformCALayerWin::layerTreeAsString const): * platform/graphics/ca/win/PlatformCALayerWin.h: * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::decodeSample): * platform/graphics/texmap/BitmapTexturePool.cpp: (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired): * platform/graphics/texmap/BitmapTexturePool.h: (WebCore::BitmapTexturePool::Entry::markIsInUse): (WebCore::BitmapTexturePool::Entry::canBeReleased const): (): Deleted. * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper): (WebCore::GraphicsLayerTextureMapper::addAnimation): (WebCore::GraphicsLayerTextureMapper::pauseAnimation): * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/TextureMapperAnimation.cpp: (WebCore::TextureMapperAnimation::TextureMapperAnimation): (WebCore::TextureMapperAnimation::apply): (WebCore::TextureMapperAnimation::pause): (WebCore::TextureMapperAnimation::resume): (WebCore::TextureMapperAnimation::computeTotalRunningTime): (WebCore::TextureMapperAnimations::pause): (WebCore::TextureMapperAnimations::suspend): * platform/graphics/texmap/TextureMapperAnimation.h: (WebCore::TextureMapperAnimation::startTime const): (WebCore::TextureMapperAnimation::pauseTime const): * platform/graphics/texmap/TextureMapperFPSCounter.cpp: (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter): (WebCore::TextureMapperFPSCounter::updateFPSAndDisplay): * platform/graphics/texmap/TextureMapperFPSCounter.h: * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h: (WebCore::TextureMapperPlatformLayerBuffer::markUsed): (WebCore::TextureMapperPlatformLayerBuffer::lastUsedTime const): (): Deleted. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::releaseUnusedBuffersTimerFired): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::addAnimation): (WebCore::CoordinatedGraphicsLayer::pauseAnimation): (WebCore::CoordinatedGraphicsLayer::suspendAnimations): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread): * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: (WebCore::DisplayCaptureSourceCocoa::startProducingData): (WebCore::DisplayCaptureSourceCocoa::stopProducingData): (WebCore::DisplayCaptureSourceCocoa::elapsedTime): * platform/mediastream/mac/DisplayCaptureSourceCocoa.h: * platform/mediastream/mac/MockRealtimeAudioSourceMac.h: * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm: (WebCore::MockRealtimeAudioSourceMac::render): * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::MockRealtimeAudioSource::startProducingData): (WebCore::MockRealtimeAudioSource::stopProducingData): (WebCore::MockRealtimeAudioSource::elapsedTime): (WebCore::MockRealtimeAudioSource::tick): (WebCore::MockRealtimeAudioSource::delaySamples): * platform/mock/MockRealtimeAudioSource.h: (WebCore::MockRealtimeAudioSource::render): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::startProducingData): (WebCore::MockRealtimeVideoSource::stopProducingData): (WebCore::MockRealtimeVideoSource::elapsedTime): (WebCore::MockRealtimeVideoSource::drawText): (WebCore::MockRealtimeVideoSource::delaySamples): (WebCore::MockRealtimeVideoSource::generateFrame): * platform/mock/MockRealtimeVideoSource.h: * platform/network/DNSResolveQueue.cpp: (WebCore::DNSResolveQueue::DNSResolveQueue): (WebCore::DNSResolveQueue::isUsingProxy): * platform/network/DNSResolveQueue.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::suspendAnimations): * rendering/RenderBoxModelObject.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::paintFocusRing): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintAreaElementFocusRing): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::notifyAnimationStarted): (WebCore::RenderLayerBacking::suspendAnimations): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::didPaintBacking): * rendering/RenderProgress.cpp: (WebCore::RenderProgress::RenderProgress): (WebCore::RenderProgress::animationProgress const): (WebCore::RenderProgress::updateAnimationState): * rendering/RenderProgress.h: * rendering/RenderTheme.cpp: (WebCore::RenderTheme::animationDurationForProgressBar const): * rendering/RenderTheme.h: * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::animationDurationForProgressBar const): * rendering/RenderThemeGtk.h: * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::animationDurationForProgressBar const): * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::animationDurationForProgressBar const): * svg/animation/SMILTimeContainer.cpp: (WebCore::SMILTimeContainer::SMILTimeContainer): (WebCore::SMILTimeContainer::elapsed const): (WebCore::SMILTimeContainer::isActive const): (WebCore::SMILTimeContainer::isPaused const): (WebCore::SMILTimeContainer::isStarted const): (WebCore::SMILTimeContainer::begin): (WebCore::SMILTimeContainer::pause): (WebCore::SMILTimeContainer::resume): (WebCore::SMILTimeContainer::setElapsed): (WebCore::SMILTimeContainer::timerFired): * svg/animation/SMILTimeContainer.h: * testing/Internals.cpp: (WebCore::Internals::delayMediaStreamTrackSamples): * testing/MockGamepad.cpp: (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): 2018-03-02 Alejandro G. Castro <alex@igalia.com> Make LibWebRTCProvider port agnostic again after r215424 https://bugs.webkit.org/show_bug.cgi?id=183080 Reviewed by Youenn Fablet. In the r215424 commit the webRTCAvailable function started to use a function from the DARWIN platform, we have moved that code to the cocoa class and created a glib implementation that will be used in the future to implement the LibWebRTCProviderGlib class. No new tests, this is a refactor. * Sources.txt: Add the compilation of the new file. * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Remove the webRTCAvailable function from this file. (WebCore::LibWebRTCProvider::create): We want to use this even when LIBWEBRTC is not used. * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): Moved the code from the LibWebRTCProvider class. * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): Add the glib implementation, basically true, we are always linking libwebrtc for the moment in these situations. 2018-03-01 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r222843): [HarfBuzz] Combining enclosed keycap not correctly handled https://bugs.webkit.org/show_bug.cgi?id=183246 Reviewed by Michael Catanzaro. We are not correctly handling the combining enclosed keycap since we switched to use ComplexTextController. This is because fontForCombiningCharacterSequence() always returns the font of the first character, without checking if that font can render the whole sequence or not. Before 222843, the shaper did that check when creating the text runs. In this case the sequence was split and a different font was used for the text and the mark. This patch makes fontForCombiningCharacterSequence() try to find a suitable font for the whole sequence, first looking at the CSS fallbacks and finally at system ones. The result is much better than the old one, because we use the same font for both the text and the mark. If there isn't any font to render the mark, then we fallback to use the first character font, since we will end up rendering the missing glyph character, it's better to use the same font than the first character one. Test: fast/text/combining-enclosing-keycap.html * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: (WebCore::FontCascade::fontForCombiningCharacterSequence const): Check if the first charatcer font can render the whole sequence, trying with fallbacks otherwise. * platform/graphics/freetype/SimpleFontDataFreeType.cpp: (WebCore::Font::canRenderCombiningCharacterSequence const): Check if the font face has glyphs for the whole sequence not just the first character. 2018-03-01 Carlos Garcia Campos <cgarcia@igalia.com> [FreeType] Remove FontPlatformData fallbacks https://bugs.webkit.org/show_bug.cgi?id=183210 Reviewed by Michael Catanzaro. They are only used by FontCache::systemFallbackForCharacters() where a direct FcFontMatch provides the same or better results. * platform/graphics/FontPlatformData.h: Remove fallbacks. * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::FontCache::systemFallbackForCharacters): Use FcFontMatch() only. * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::FontPlatformData::fallbacks): Removed. 2018-03-01 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229153. https://bugs.webkit.org/show_bug.cgi?id=183274 it is breaking imported/w3c/web-platform-tests/service-workers /service-worker/clients-matchall-exact-controller.https.html (Requested by youenn on #webkit). Reverted changeset: "Clients should register to StorageProcess with their service worker registration identifier" https://bugs.webkit.org/show_bug.cgi?id=182313 https://trac.webkit.org/changeset/229153 2018-03-01 Youenn Fablet <youenn@apple.com> Clients should register to StorageProcess with their service worker registration identifier https://bugs.webkit.org/show_bug.cgi?id=182313 Reviewed by Chris Dumez. No observable change of behavior in regular conditions. When service worker process crashes, the service worker identifiers sent by the WebProcess might be wrong and we will not be able to retrieve the registration from these identifiers. The storage process will be able to still process correctly messages coming from the WebProcess to register clients of the registration. Otherwise, there is a chance that WebProcess clients will not be added to the SWServerRegistration.m_clientsUsingRegistration maps. * dom/Document.cpp: (WebCore::Document::setServiceWorkerConnection): * workers/service/SWClientConnection.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::registerServiceWorkerClient): * workers/service/server/SWServer.h: 2018-03-01 Youenn Fablet <youenn@apple.com> Add API test to validate setting of service worker and cache storage directories https://bugs.webkit.org/show_bug.cgi?id=182543 Reviewed by Chris Dumez. Covered by API tests. Add getters to service worker registration directory. * testing/Internals.cpp: (WebCore::Internals::serviceWorkerRegistrationDirectory): * testing/Internals.h: * testing/Internals.idl: * workers/service/SWClientConnection.h: * workers/service/server/RegistrationDatabase.h: (WebCore::RegistrationDatabase::serviceWorkerRegistrationDirectory const): * workers/service/server/RegistrationStore.h: (WebCore::RegistrationStore::serviceWorkerRegistrationDirectory const): * workers/service/server/SWServer.h: (WebCore::SWServer::serviceWorkerRegistrationDirectory const): 2018-03-01 Youenn Fablet <youenn@apple.com> SWServer::removeClientServiceWorkerRegistration should not log an error if there is no registration https://bugs.webkit.org/show_bug.cgi?id=183248 Reviewed by Chris Dumez. No change of behavior. Removed the error logging. As can be seen from running api and layout tests, a web process can ask a registration to be unregistered and by the time it goes to the StorageProcess, the registration is already cleared. * workers/service/server/SWServer.cpp: (WebCore::SWServer::removeClientServiceWorkerRegistration): 2018-03-01 Daniel Bates <dabates@apple.com> CSS ::selection stroke-color and stroke-width are not applied to selected text in text fields and ::selection:window-inactive stroke-color and stroke-width are never applied https://bugs.webkit.org/show_bug.cgi?id=183178 Reviewed by David Hyatt. This change fixes the following two issues: 1. Properties stroke-color and stroke-width are not applied to the ::selection pseudo- element of text fields. 2. Properties stroke-color and stroke-width are never applied to ::selection:window-inactive pseudo elements. Currently when computing the paint styles for selected text we query the cached styles for the ::selection pseudo element on the renderer. Text fields are implemented using a User Agent shadow DOM. With regards to issue (1) the renderer queried was the inner most renderer for the text in the text field. But it should have been the shadow host renderer (i.e. the renderer for the <input>). With regards to issue (2) we cannot retrieve cached styles for the ::selection pseudo element because it can be effected by a pseudo class, :window-inactive, which matches when the page is deactivated (i.e. the window is in the background as the user made another window the frontmost window). Both of these issues are fixed by making use of RenderElement::selectionPseudoStyle(). Tests: fast/selectors/selection-window-inactive-stroke-color.html fast/selectors/selection-window-inactive-text-shadow.html fast/selectors/text-field-selection-stroke-color.html fast/selectors/text-field-selection-text-shadow.html fast/selectors/text-field-selection-window-inactive-stroke-color.html fast/selectors/text-field-selection-window-inactive-text-shadow.html * rendering/RenderText.h: (WebCore::RenderText::selectionPseudoStyle const): Add a convenience function that turns around and calls the function of the same name on its parent. * rendering/TextPaintStyle.cpp: (WebCore::computeTextSelectionPaintStyle): Modified to use RenderText::selectionPseudoStyle() instead of directly querying for the cached styles for the ::selection pseudo element. 2018-03-01 Per Arne Vollan <pvollan@apple.com> Scrollbar preferences are ignored when the WebContent process doesn't have access to the WindowServer. https://bugs.webkit.org/show_bug.cgi?id=183231 <rdar://problem/37793457> Reviewed by Brent Fulgham. When the WebContent process doesn't have access to the WindowServer, the scrollbars are always of the overlay type. The notification about scrollbar preferences is never received by the WebContent process when there is no WindowServer access. This can be fixed by adding an observer of scrollbar preferences in the UI process, and notifying the WebProcess about this by sending it a message. This message should also contain the preferred scrollbar type, since the call '[NSScroller preferredScrollerStyle]' will always return the overlay style when there is no WindowServer access. No new tests, covered by existing tests. * WebCore.xcodeproj/project.pbxproj: * platform/mac/NSScrollerImpDetails.h: * platform/mac/NSScrollerImpDetails.mm: (WebCore::ScrollerStyle::recommendedScrollerStyle): (WebCore::ScrollerStyle::setUseOverlayScrollbars): (WebCore::recommendedScrollerStyle): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::ScrollAnimatorMac): (WebCore::ScrollAnimatorMac::mouseEnteredScrollbar const): (WebCore::ScrollAnimatorMac::mouseExitedScrollbar const): (WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting): * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::registerScrollbar): (WebCore::ScrollbarThemeMac::scrollbarThickness): (WebCore::ScrollbarThemeMac::usesOverlayScrollbarsChanged): 2018-03-01 Myles C. Maxfield <mmaxfield@apple.com> Temporarily enable user-installed-fonts everywhere until we can stop crashing on launch https://bugs.webkit.org/show_bug.cgi?id=183255 Unreviewed. Tests are already disabled. * platform/graphics/cocoa/FontCacheCoreText.cpp: 2018-03-01 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Split DNS cache expiration and connection timeout setting. https://bugs.webkit.org/show_bug.cgi?id=182979 It was mis-implemented and was named ambiguous name 'enableTimeout'. Implement each feature correctly. Reviewed by Per Arne Vollan. * platform/network/curl/CurlContext.cpp: (WebCore::EnvironmentVariableReader::read): (WebCore::EnvironmentVariableReader::defined): (WebCore::EnvironmentVariableReader::readAs): (WebCore::EnvironmentVariableReader::sscanTemplate): (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): (WebCore::CurlContext::CurlContext): (WebCore::safeTimeValue): (WebCore::CurlHandle::setDnsCacheTimeout): (WebCore::CurlHandle::setConnectTimeout): (WebCore::CurlHandle::setTimeout): (WebCore::CurlHandle::enableTimeout): Deleted. * platform/network/curl/CurlContext.h: (WebCore::CurlContext::dnsCacheTimeout const): (WebCore::CurlContext::connectTimeout const): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupTransfer): 2018-03-01 Zalan Bujtas <zalan@apple.com> Remove RenderElement::s_noLongerAffectsParentBlock https://bugs.webkit.org/show_bug.cgi?id=183196 <rdar://problem/38030797> Reviewed by Antti Koivisto. Remove the hack to track floating/out-of-flow changes between styleWillChange and styleDidChange. Covered by existing tests. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): (WebCore::RenderElement::noLongerAffectsParentBlock const): (WebCore::RenderElement::styleDidChange): * rendering/RenderElement.h: (WebCore::RenderElement::noLongerAffectsParentBlock const): Deleted. 2018-03-01 Chris Dumez <cdumez@apple.com> imported/w3c/web-platform-tests/html/browsers/windows/browsing-context.html fails with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183225 <rdar://problem/38003828> Reviewed by Alex Christensen. Bypass navigation policy check when loading about:blank. This does not seem necessary and it would not be Web-compatible for such policy check to happen synchronously. This is because an iframe without src or src="about:blank" should load synchronously as per HTML specification. Test: http/wpt/html/browsers/windows/browsing-context.html * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): 2018-03-01 Christopher Reid <chris.reid@sony.com> [Curl] Linker errors in some curl files due to missing exports https://bugs.webkit.org/show_bug.cgi?id=183238 Reviewed by Alex Christensen. No new tests, no change in behavior. Adding WEBCORE_EXPORT to functions now used in WebKit. * platform/network/NetworkStorageSession.h: * platform/network/curl/CookieJarDB.h: * platform/network/curl/CurlContext.h: 2018-03-01 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229130. https://bugs.webkit.org/show_bug.cgi?id=183244 It breaks AppleWin compilation (Requested by alexg__ on #webkit). Reverted changeset: "Make LibWebRTCProvider port agnostic again after r215424" https://bugs.webkit.org/show_bug.cgi?id=183080 https://trac.webkit.org/changeset/229130 2018-03-01 Alejandro G. Castro <alex@igalia.com> Make LibWebRTCProvider port agnostic again after r215424 https://bugs.webkit.org/show_bug.cgi?id=183080 Reviewed by Youenn Fablet. In the r215424 commit the webRTCAvailable function started to use a function from the DARWIN platform, we have moved that code to the cocoa class and created a glib implementation that will be used in the future to implement the LibWebRTCProviderGlib class. No new tests, this is a refactor. * Sources.txt: Add the compilation of the new file. * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Remove the webRTCAvailable function from this file. (WebCore::LibWebRTCProvider::create): We want to use this even when LIBWEBRTC is not used. * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): Moved the code from the LibWebRTCProvider class. * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: (WebCore::LibWebRTCProvider::webRTCAvailable): Add the glib implementation, basically true, we are always linking libwebrtc for the moment in these situations. 2018-03-01 Carlos Garcia Campos <cgarcia@igalia.com> [FreeType] Color emojis in WebKitGTK+ for great justice https://bugs.webkit.org/show_bug.cgi?id=183155 Reviewed by Michael Catanzaro. Emojis are actually rendered if there's an emoji font installed in the system, but the size is so tiny that we don't see them. This is because for some reason the matrix we are getting from fontconfig contains a scale, which we don't expect. We only get the fontconfig matrix to apply rotations in case of oblique fonts, and then we always apply the scale for the computed pixel font size. Ignoring the fontconfig matrix scale fixes the issue. * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::fontWeightToFontconfigWeight): Moved here since it's now used by configurePatternForFontDescription(). (WebCore::configurePatternForFontDescription): Helper function to apply the same options for fallback pattern. (WebCore::createFontConfigPatternForCharacters): Use configurePatternForFontDescription(). (WebCore::findBestFontGivenFallbacks): Adopt the returned reference. (WebCore::FontCache::systemFallbackForCharacters): Clean it up. (WebCore::FontCache::createFontPlatformData): Use configurePatternForFontDescription(). * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::FontPlatformData::buildScaledFont): Ignore the scale returned by fontconfig matrix. 2018-02-28 Philippe Normand <pnormand@igalia.com> [GStreamer] text samples no longer processed https://bugs.webkit.org/show_bug.cgi?id=183212 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::newTextSample): Refer to track stream ID instead of (potentially) manually generated track ID stored as hashmap keys. 2018-02-28 Tim Horton <timothy_horton@apple.com> Push WTF_PLATFORM_IOS down into preprocessor.pm instead of trying to determine it inside https://bugs.webkit.org/show_bug.cgi?id=183193 Reviewed by Andy Estes. * DerivedSources.make: * bindings/scripts/preprocessor.pm: (applyPreprocessor): Instead of trying to discern WTF_PLATFORM_IOS inside preprocessor.pm, push it down from DerivedSources.make. Also clean up DerivedSources.make a tiny bit by adding a variable, FEATURE_AND_PLATFORM_DEFINES, which contains both FEATURE_DEFINES and WTF_PLATFORM macros if needed. 2018-02-28 Nan Wang <n_wang@apple.com> AX: AOM: Dispatch accessiblesetvalue event https://bugs.webkit.org/show_bug.cgi?id=183021 <rdar://problem/37764242> Reviewed by Chris Fleizach. Accessibility events. Spec: https://wicg.github.io/aom/spec/phase2.html Added a new event type AccessibleSetValueEvent. Test: accessibility/mac/AOM-event-accessiblesetvalue.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AccessibilityAllInOne.cpp: * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::canSetValueAttribute const): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::press): (WebCore::AccessibilityObject::dispatchAccessibilityEvent): (WebCore::AccessibilityObject::dispatchAccessibleSetValueEvent): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setValue): * accessibility/AccessibilityScrollbar.cpp: (WebCore::AccessibilityScrollbar::setValue): * accessibility/AccessibilitySlider.cpp: (WebCore::AccessibilitySlider::setValue): * accessibility/AccessibleSetValueEvent.cpp: Added. (WebCore::AccessibleSetValueEvent::AccessibleSetValueEvent): * accessibility/AccessibleSetValueEvent.h: Added. (WebCore::AccessibleSetValueEvent::create): (WebCore::AccessibleSetValueEvent::value const): * accessibility/AccessibleSetValueEvent.idl: Added. * dom/Element.idl: * dom/EventNames.h: * dom/EventNames.in: 2018-02-28 Chris Dumez <cdumez@apple.com> html/browsers/browsing-the-web/navigating-across-documents/006.html fails with async policy delegates https://bugs.webkit.org/show_bug.cgi?id=183168 <rdar://problem/37951341> Reviewed by Alex Christensen. The test has an anchor element with both a 'click' event handler which submits a form and an href attribute. When clicking the link, as per specification, things happen in this order: 1. We fire the click event at the anchor, which will execute the event handler and submit the form. Submitting the form *schedules* a navigation to 'click.html'. 2. We execute the anchor activation code which *navigates* to 'href.html'. The navigation to 'href' is supposed to cancel the pending navigation to 'click.html' and we should navigate to 'href.html', which is what the test asserts. The issue for us is that we do not cancel pending navigations until after the navigation policy decision is made, when the provisional loads actually starts, in FrameLoader::provisionalLoadStarted(). Because the policy decision for the navigation can now be made asynchronously, the NavigationScheduler timer can now fire while the decision is made and we'll submit the form, thus navigating to 'click.html'. To address the issue, we now cancel any pending navigations in FrameLoader::loadWithDocumentLoader(), *before* doing the policy check for the navigation. Test: http/wpt/html/browsers/browsing-the-web/navigating-across-documents/006.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadWithDocumentLoader): 2018-02-28 John Wilander <wilander@apple.com> Add a second tier of prevalence to facilitate telemetry on very prevalent domains https://bugs.webkit.org/show_bug.cgi?id=183218 <rdar://problem/37992388> Reviewed by Brent Fulgham. Test: http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::encode const): (WebCore::ResourceLoadStatistics::decode): (WebCore::ResourceLoadStatistics::toString const): (WebCore::ResourceLoadStatistics::merge): Handling of the new boolean field isVeryPrevalentResource. * loader/ResourceLoadStatistics.h: Added the new boolean field isVeryPrevalentResource. 2018-02-28 Alex Christensen <achristensen@webkit.org> Reduce use of NetworkingContext in WebKit https://bugs.webkit.org/show_bug.cgi?id=183213 Reviewed by Brady Eidson. NetworkingContext is intended to be used only with ResourceHandle, which is now only used in WebKitLegacy. Now that we don't use ResourceHandle in the WebProcess, everything that was done through the NetworkingContext can now be done a cleaner way with no change in behavior. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadResourceSynchronously): * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLink): * loader/LoaderStrategy.h: * platform/network/ProxyServer.h: * platform/network/cf/ProxyServerCFNet.cpp: (WebCore::proxyServersForURL): * platform/network/curl/ProxyServerCurl.cpp: (WebCore::proxyServersForURL): * platform/network/soup/ProxyServerSoup.cpp: (WebCore::proxyServersForURL): 2018-02-28 Zalan Bujtas <zalan@apple.com> Remove RenderElement::s_affectsParentBlock https://bugs.webkit.org/show_bug.cgi?id=183187 <rdar://problem/37961079> Reviewed by Antti Koivisto. Remove the hack to track floating/out-of-flow changes between styleWillChange and styleDidChange. Covered by existing tests. * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): (WebCore::RenderElement::styleDidChange): * rendering/RenderElement.h: 2018-02-28 Antti Koivisto <antti@apple.com> Filter attribute selectors with selector filter https://bugs.webkit.org/show_bug.cgi?id=183200 Reviewed by Zalan Bujtas. Currently selector filtering is done based on tags, classes and ids. We should include attributes too. This patch adds filtering based on attribute name (but not content). * css/SelectorFilter.cpp: (WebCore::isExcludedAttribute): Ignore id, class and style attributes. First two are already handled and the last is common but is rarely used in selectors. (WebCore::collectElementIdentifierHashes): Collect attributes. Remove the unnecessary StyledElement casting. (WebCore::collectSimpleSelectorHash): Collect attribute selectors. (WebCore::chooseSelectorHashesForFilter): Pick attributes with high priority for the filter as it is likely a good signal. 2018-02-27 Sergio Villar Senin <svillar@igalia.com> [WebVR] Convert VRPlatformDisplayInfo into a class https://bugs.webkit.org/show_bug.cgi?id=183162 Reviewed by Žan Doberšek. In preparation for further changes we're transforming the VRPlatformDisplayInfo into a class. All the members are now private and the class provides the needed getters/setters. Apart from that VRDisplayCapabilityFlags is now just an unsigned and the different flags are defined in VRDisplayCapabilityFlag enum. Another cleanup was the removal of VRDisplayCapabilities.cpp as everything can be implemented in the header. * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::VRDisplay): (WebCore::VRDisplay::isConnected const): (WebCore::VRDisplay::stageParameters const): * Modules/webvr/VRDisplayCapabilities.cpp: Removed. * Modules/webvr/VRDisplayCapabilities.h: (WebCore::VRDisplayCapabilities::hasPosition const): (WebCore::VRDisplayCapabilities::hasOrientation const): (WebCore::VRDisplayCapabilities::hasExternalDisplay const): (WebCore::VRDisplayCapabilities::canPresent const): (WebCore::VRDisplayCapabilities::maxLayer const): (WebCore::VRDisplayCapabilities::VRDisplayCapabilities): * Sources.txt: * platform/vr/VRPlatformDisplay.h: (WebCore::VRPlatformDisplayInfo::displayName const): (WebCore::VRPlatformDisplayInfo::setDisplayName): (WebCore::VRPlatformDisplayInfo::isConnected const): (WebCore::VRPlatformDisplayInfo::setIsConnected): (WebCore::VRPlatformDisplayInfo::isMounted const): (WebCore::VRPlatformDisplayInfo::setIsMounted): (WebCore::VRPlatformDisplayInfo::capabilityFlags const): (WebCore::VRPlatformDisplayInfo::setCapabilityFlags): (WebCore::VRPlatformDisplayInfo::displayIdentifier const): (WebCore::VRPlatformDisplayInfo::setDisplayIdentifier): (WebCore::VRPlatformDisplayInfo::eyeTranslation const): (WebCore::VRPlatformDisplayInfo::setEyeTranslation): (WebCore::VRPlatformDisplayInfo::eyeFieldOfView const): (WebCore::VRPlatformDisplayInfo::setEyeFieldOfView): (WebCore::VRPlatformDisplayInfo::renderSize const): (WebCore::VRPlatformDisplayInfo::setRenderSize): (WebCore::VRPlatformDisplayInfo::setPlayAreaBounds): (WebCore::VRPlatformDisplayInfo::playAreaBounds const): (WebCore::VRPlatformDisplayInfo::setSittingToStandingTransform): (WebCore::VRPlatformDisplayInfo::sittingToStandingTransform const): * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR): (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters): (WebCore::VRPlatformDisplayOpenVR::updateStageParameters): 2018-02-27 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r229060. https://bugs.webkit.org/show_bug.cgi?id=183198 This patch causes crashes on two SVG tests (Requested by fredw on #webkit). Reverted changeset: "Relayout frames after AsyncFrameScrolling or FrameFlattening option is changed" https://bugs.webkit.org/show_bug.cgi?id=183081 https://trac.webkit.org/changeset/229060 2018-02-27 Youenn Fablet <youenn@apple.com> Do not trigger a service worker match in case of document redirection if it will be already served by AppCache https://bugs.webkit.org/show_bug.cgi?id=183185 <rdar://problem/37693796> Reviewed by Chris Dumez. Disabling service worker matching in case there is a substitute data. Otherwise there is a risk for a double load, substitute data first and the new load triggered if matching a new registration. A future fix should first do service worker registration matching and if there is no registration query appcache. Test: http/tests/appcache/main-resource-redirect-with-sw.html * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::redirectReceived): 2018-02-27 Tim Horton <timothy_horton@apple.com> Ensure target triple is propagated correctly to DerivedSources.make https://bugs.webkit.org/show_bug.cgi?id=183189 <rdar://problem/37959694> Reviewed by Dan Bernstein. If we don't propagate the target triple, we can sometimes build with the wrong options enabled. * Configurations/Base.xcconfig: Mentioning LLVM_TARGET_TRIPLE_SUFFIX here is required to get it to be available to scripts. * DerivedSources.make: Propagate the target triple into our compiler invocations. 2018-02-27 Doug Russell <doug@getitdownonpaper.com> AX: Spell check and style attributes should be optional when fetching attributed string https://bugs.webkit.org/show_bug.cgi?id=160744 Reviewed by Chris Fleizach. The overhead of fetching a spell checked attributed string via AX API is substantial. In some cases on the order of 7/8 of the total time spent fetching the string. This change introduces the new attribute AXAttributedStringForTextMarkerRangeWithOptions which accepts an NSDictionary as it's parameter with keys "AXTextMarkerRange" (AXTextMarkerRangeRef) and "AXSpellCheck" (NSNumber(BOOL)). AXAttributedStringForTextMarkerRange will remain unchanged. Tests: accessibility/mac/attributed-string/attributed-string-for-range-with-options.html accessibility/mac/attributed-string/attributed-string-for-range.html * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (AXAttributedStringAppendText): (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): (-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): (-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Deleted. 2018-02-27 Daniel Bates <dabates@apple.com> Standardize terminology for marked text https://bugs.webkit.org/show_bug.cgi?id=180999 Reviewed by Zalan Bujtas. The name MarkerSubrange is a misnomer for a data structure that associates a text subrange with a type and optional document marker. In particular, a MarkerSubrange may not always correspond to a document marker. For instance, selected text is represented using a MarkerSubrange that does not have a corresponding document marker. Let's standardize on the phrase "marked text" as the canonical way to describe these tagged text subranges. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::localSelectionRect const): (WebCore::InlineTextBox::MarkedTextStyle::areBackgroundMarkedTextStylesEqual): (WebCore::InlineTextBox::MarkedTextStyle::areForegroundMarkedTextStylesEqual): (WebCore::InlineTextBox::MarkedTextStyle::areDecorationMarkedTextStylesEqual): (WebCore::InlineTextBox::StyledMarkedText::StyledMarkedText): (WebCore::createMarkedTextFromSelectionInBox): (WebCore::InlineTextBox::paint): (WebCore::InlineTextBox::paintPlatformDocumentMarkers): (WebCore::InlineTextBox::paintPlatformDocumentMarker): (WebCore::InlineTextBox::computeStyleForUnmarkedMarkedText const): (WebCore::InlineTextBox::resolveStyleForMarkedText): (WebCore::InlineTextBox::subdivideAndResolveStyle): (WebCore::InlineTextBox::coalesceAdjacentMarkedTexts): (WebCore::InlineTextBox::collectMarkedTextsForDraggedContent): (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers): (WebCore::InlineTextBox::paintMarkedTexts): (WebCore::InlineTextBox::paintMarkedTextBackground): (WebCore::InlineTextBox::paintMarkedTextForeground): (WebCore::InlineTextBox::paintMarkedTextDecoration): (WebCore::InlineTextBox::paintCompositionBackground): (WebCore::InlineTextBox::MarkerSubrangeStyle::areBackgroundMarkerSubrangeStylesEqual): Deleted. (WebCore::InlineTextBox::MarkerSubrangeStyle::areForegroundMarkerSubrangeStylesEqual): Deleted. (WebCore::InlineTextBox::MarkerSubrangeStyle::areDecorationMarkerSubrangeStylesEqual): Deleted. (WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange): Deleted. (WebCore::createMarkerSubrangeFromSelectionInBox): Deleted. (WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Deleted. (WebCore::InlineTextBox::resolveStyleForSubrange): Deleted. (WebCore::InlineTextBox::coalesceAdjacentSubranges): Deleted. (WebCore::InlineTextBox::collectSubrangesForDraggedContent): Deleted. (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Deleted. (WebCore::InlineTextBox::paintMarkerSubranges): Deleted. (WebCore::InlineTextBox::paintTextSubrangeBackground): Deleted. (WebCore::InlineTextBox::paintTextSubrangeForeground): Deleted. (WebCore::InlineTextBox::paintTextSubrangeDecoration): Deleted. * rendering/InlineTextBox.h: (WebCore::InlineTextBox::paintMarkedTexts): (WebCore::InlineTextBox::paintMarkerSubranges): Deleted. * rendering/MarkedText.cpp: Renamed from Source/WebCore/rendering/MarkerSubrange.cpp. (WebCore::subdivide): * rendering/MarkedText.h: Renamed from Source/WebCore/rendering/MarkerSubrange.h. (WebCore::MarkedText::MarkedText): (WebCore::MarkedText::isEmpty const): (WebCore::MarkedText::operator!= const): (WebCore::MarkedText::operator== const): 2018-02-27 Chris Dumez <cdumez@apple.com> Unreviewed, roll out r228430. Roll out r228430 now that it is no longer needed after r228852. No new tests, initial fix is still covered by WebKit.RespondToPolicyForNavigationResponseAsynchronously API test. * loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::schedule): 2018-02-27 Antoine Quint <graouts@apple.com> [Web Animations] Correct implementation of pending tasks and promises https://bugs.webkit.org/show_bug.cgi?id=183161 Reviewed by Dean Jackson. We had an incorrect implementation of the spec due to two misinterpretations. The first one is about pending tasks (play and pause) which the spec says should be performed by "scheduling a task". In WebCore, this means using postTask() on a ScriptExecutionContext, such as Document. One of the big practical changes is that calling play() on an animation correctly sets its startTime to null (unresolved) immediately after the call to play() returns before setting it to a resolved value when the task is performed asynchronously. As a result, the playState is now always accurate. The second one is about promises where new promises need to be created in certain situations called out by the spec. We used to call clear() on them, but this merely resets the fulfillment or rejection state of the promise, while the spec requires a different object to be returned for the promise. We now create our promises using makeUniqueRef<> when new promise objects are expected to be created. This patch also corrects a few smaller bugs and spec compliant issues, called out below, related to pending tasks and promises uncovered while looking at relevant WPT tests. * animation/DocumentTimeline.h: Expose the Document used to create this timeline such that it may be used by WebAnimation objects registered for this timeline when scheduling a task is required via postTask(). * animation/WebAnimation.cpp: (WebCore::WebAnimation::WebAnimation): (WebCore::WebAnimation::setBindingsStartTime): (WebCore::WebAnimation::setCurrentTime): (WebCore::WebAnimation::cancel): Ensure the finished promise has not already been fulfilled before rejecting it. While the spec does not specifically call this out, a promise may not be rejected after being fulfilled, and we would hit an ASSERT if we didn't also check that it was in the correct pending state before attemping to reject it. (WebCore::WebAnimation::resetPendingTasks): (WebCore::WebAnimation::finish): (WebCore::WebAnimation::updateFinishedState): (WebCore::WebAnimation::finishNotificationSteps): (WebCore::WebAnimation::play): We used to only check for a pending pause task before canceling that task, but the spec says to check for either a pending pause or play task (ie. pending()) and to cancel whichever is scheduled. (WebCore::WebAnimation::runPendingPlayTask): We were missing an assertion called out by the spec when running a pending task. (WebCore::WebAnimation::pause): (WebCore::WebAnimation::runPendingPauseTask): (WebCore::WebAnimation::updatePendingTasks): We now use postTask() on the animation's associated timeline's document to schedule pending tasks for which the criteria to run are met, ie. there is an associated timeline. * animation/WebAnimation.h: 2018-02-27 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Implement additional SPI for adjusting viewport shrink-to-fit behavior https://bugs.webkit.org/show_bug.cgi?id=183100 <rdar://problem/37840987> Reviewed by Tim Horton. Introduce new customization options to ViewportConfiguration. The first is m_forceHorizontalShrinkToFit, which (when set to true) forces the viewport to scale using shrink-to-fit heuristics, regardless of whether "shrink-to-fit=no" is specified via viewport parameters or if content width did not exceed minimum layout size. The second is m_viewSize, which reflects the true size of the viewport. See WebKit ChangeLog for more details. Tests: ViewportSizingTests.ForceShrinkToFitViewportOverridesViewportParameters ViewportSizingTests.ShrinkToFitViewportWithMinimumAllowedLayoutWidth * page/ViewportConfiguration.cpp: (WebCore::ViewportConfiguration::ViewportConfiguration): (WebCore::ViewportConfiguration::setMinimumLayoutSize): Plumb the real size of the view alongside the minimum layout size when updating the minimum layout size. (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit): (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const): Bail early and return true if forceHorizontalShrinkToFit is set. This forces shrink-to-fit even in cases where "shrink-to-fit" is set to "no", or content dimensions don't exceed layout dimensions. (WebCore::ViewportConfiguration::initialScaleFromSize const): Use view dimensions rather than minimum layout dimensions when computing the initial scale. Minimum layout size is no longer always equal to the size of the view if the client has specified a minimum allowed layout width. As such, when computing the initial scale, to ensure that the content (which was laid out using the minimum layout size) fits within the real viewport, we need to divide real viewport dimensions by content dimensions. (WebCore::ViewportConfiguration::minimumScale const): Similarly, use view size instead of minimum layout size to compute minimum scale. (WebCore::ViewportConfiguration::description const): * page/ViewportConfiguration.h: 2018-02-27 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the debug build after r228877. In the case where CAN_DISALLOW_USER_INSTALLED_FONTS is enabled, this function doesn't return anything when allowUserInstalledFonts != AllowUserInstalledFonts::No. Fix the build by moving `return nullptr;` back out of the `#else`. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::installedFontMandatoryAttributes): 2018-02-27 Milan Crha <mcrha@redhat.com> Potential privacy issue: DNS prefetching can be re-enabled https://bugs.webkit.org/show_bug.cgi?id=182924 Reviewed by Michael Catanzaro. * dom/Document.cpp: (WebCore::Document::parseDNSPrefetchControlHeader): 2018-02-26 Antoine Quint <graouts@apple.com> [Web Animations] Implement the procedure to set the target effect of an animation https://bugs.webkit.org/show_bug.cgi?id=183146 Reviewed by Dean Jackson. We only had a partial implementation of setEffect() and we now update it to cover the entire implementation as mandated by the spec. While this doesn't yield any WPT results changes, this patch will help getting a significant number of new PASS results when we get around to implement correct support for async procedures (pending pause/play tasks and promises) in the next patch. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): 2018-02-26 Antoine Quint <graouts@apple.com> [Web Animations] Update the playState implementation https://bugs.webkit.org/show_bug.cgi?id=183145 Reviewed by Dean Jackson. The Web Animations spec has changed since we first implemented the playState property and the "pending" enum value has been dropped since then (there is a separate "pending" property which we also implement). We update our implementation to match the latest spec text. This does not change WPT test results a lot, but this patch will help getting a significant number of new PASS results when we get around to implementing correct support for async procedures (pending pause/play tasks and promises) in a couple of patches. * animation/WebAnimation.cpp: (WebCore::WebAnimation::playState const): * animation/WebAnimation.h: * animation/WebAnimation.idl: 2018-02-27 Wenson Hsieh <wenson_hsieh@apple.com> Address post-review comment after r229049. https://bugs.webkit.org/show_bug.cgi?id=183142 Reviewed by Tim Horton. Wrap a newly added string literal with ASCIILiteral. * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::extraDefaultStyleSheet): 2018-02-26 Mark Lam <mark.lam@apple.com> Modernize FINALIZE_CODE and peer macros to use __VA_ARGS__ arguments. https://bugs.webkit.org/show_bug.cgi?id=183159 <rdar://problem/37930837> Reviewed by Keith Miller. No new tests needed because this is just a refactoring patch. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::SelectorCodeGenerator::compile): 2018-02-26 Dan Bernstein <mitz@apple.com> Removed references to files that were removed in r228912. * WebCore.xcodeproj/project.pbxproj: Removed references to SourcesIOS.txt and SourcesMac.txt. 2018-02-26 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Tweak UA stylesheet to improve legibility of rendered text https://bugs.webkit.org/show_bug.cgi?id=183142 <rdar://problem/37912966> Reviewed by Tim Horton. Force text-size-adjust and hyphens to be always on in EXTRA_ZOOM_MODE. To accomplish this, we override the extra style sheet in RenderTheme to include these two style rules. * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::extraDefaultStyleSheet): 2018-02-26 Don Olmstead <don.olmstead@sony.com> Fix WebCore includes within WebKitLegacy https://bugs.webkit.org/show_bug.cgi?id=183147 Reviewed by Tim Horton. No new tests. No change in behavior. * PlatformWin.cmake: * platform/win/GDIUtilities.h: 2018-02-26 Youenn Fablet <youenn@apple.com> Add some more release logging related to DocumentWriter::addData crash https://bugs.webkit.org/show_bug.cgi?id=183141 Reviewed by Chris Dumez. No change of behavior. Add some additional release logging to verify whether DocumentWriter::begin was called and exited before updating its state. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::commitData): * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::begin): * loader/DocumentWriter.h: 2018-02-26 Antoine Quint <graouts@apple.com> [Web Animations] Implement the procedure to set the start time https://bugs.webkit.org/show_bug.cgi?id=183137 Reviewed by Dean Jackson. Implement the procedure to set the start time as setBindingsStartTime() and use the setStartTime() method as an internal method to set the m_startTime instance variable and invalidate the timing model rather than run the entire procedure which should only be called when setting the "startTime" property through the JS API. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::setBindingsStartTime): (WebCore::WebAnimation::setStartTime): (WebCore::WebAnimation::silentlySetCurrentTime): (WebCore::WebAnimation::finish): (WebCore::WebAnimation::updateFinishedState): (WebCore::WebAnimation::runPendingPlayTask): (WebCore::WebAnimation::runPendingPauseTask): 2018-02-26 Christopher Reid <chris.reid@sony.com> [Curl] Cookies are not being added to the Cookie field in Request Headers https://bugs.webkit.org/show_bug.cgi?id=183095 Reviewed by Alex Christensen. Populating the Cookie request header field now that cookies are no longer handled in libcurl. * platform/network/curl/CookieJarCurlDatabase.cpp: Renaming the httpOnly variable as its actual use wasn't clear * platform/network/curl/ResourceHandleCurl.cpp: 2018-02-26 Antoine Quint <graouts@apple.com> [Web Animations] Ensure setting the hold time invalidates the timing model https://bugs.webkit.org/show_bug.cgi?id=183136 Reviewed by Dean Jackson. We used to always set the m_holdTime member variable directly, but the computation of the currentTime depends on the value of m_holdTime, so setting the hold time should invalidate the timing model as well as setting the m_holdTime member variable. In this patch we add a new setHoldTime() private method that sets the member variable and invalidates the timing model. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::setHoldTime): (WebCore::WebAnimation::silentlySetCurrentTime): (WebCore::WebAnimation::setCurrentTime): (WebCore::WebAnimation::cancel): (WebCore::WebAnimation::finish): (WebCore::WebAnimation::updateFinishedState): (WebCore::WebAnimation::play): (WebCore::WebAnimation::runPendingPlayTask): (WebCore::WebAnimation::pause): (WebCore::WebAnimation::runPendingPauseTask): * animation/WebAnimation.h: 2018-02-26 Youenn Fablet <youenn@apple.com> MessagePort is not always destroyed in the right thread https://bugs.webkit.org/show_bug.cgi?id=183053 Reviewed by Chris Dumez. Make existingMessagePortForIdentifier take a lambda so that we hold the lock until there is no longer a need to keep the MessagePort around. This is very time sensitive and does not happen a lot when running WPT tests. Update existing call sites to pass a lambda. * dom/MessagePort.cpp: (WebCore::MessagePort::existingMessagePortForIdentifier): * dom/MessagePort.h: * dom/messageports/MessagePortChannelProviderImpl.cpp: (WebCore::MessagePortChannelProviderImpl::postMessageToRemote): (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity): 2018-02-26 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r226745. https://bugs.webkit.org/show_bug.cgi?id=183132 This is breaking some websites (Requested by youenn on #webkit). Reverted changeset: "Use no-cache fetch mode when loading main documents with location.reload()" https://bugs.webkit.org/show_bug.cgi?id=181285 https://trac.webkit.org/changeset/226745 2018-02-26 Philippe Normand <pnormand@igalia.com> Unreviewed, USE_GSTREAMER_PLAYBIN3 build fix. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: There is no such ENABLE_GSTREAMER_PLAYBIN3. 2018-02-26 Philippe Normand <pnormand@igalia.com> Unreviewed, manual rollout of r228866 causing EGL_BAD_CONTEXT errors * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Create an EGL display, even in Wayland. 2018-02-21 Sergio Villar Senin <svillar@igalia.com> [WebVR][OpenVR] Retrieve displayId and the z-depth of eye view frustum https://bugs.webkit.org/show_bug.cgi?id=182999 Reviewed by Žan Doberšek. Retrieve the z-depth of the eye view frustum and the HMD unique id. The unique identifier is generated by the VRPlatormManager whereas we use the default values from the spec for the z-depth (those can be changed by applications later via JavaScript). Once this lands the only remaining data to be retrieved from VR backends for VRDisplay is the pose (getPose() call) and the frame data (getFrameData() call). * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::VRDisplay): (WebCore::VRDisplay::displayId const): Deleted. (WebCore::VRDisplay::displayName const): Deleted. (WebCore::VRDisplay::depthNear const): Deleted. (WebCore::VRDisplay::setDepthNear): Deleted. (WebCore::VRDisplay::depthFar const): Deleted. (WebCore::VRDisplay::setDepthFar): Deleted. * Modules/webvr/VRDisplay.h: (WebCore::VRDisplay::displayId const): Moved implementation from source file. (WebCore::VRDisplay::displayName const): Ditto. (WebCore::VRDisplay::depthNear const): (WebCore::VRDisplay::setDepthNear): (WebCore::VRDisplay::depthFar const): (WebCore::VRDisplay::setDepthFar): * platform/vr/VRManager.cpp: (WebCore::VRManager::generateUniqueDisplayIdentifier): * platform/vr/VRManager.h: * platform/vr/VRPlatformDisplay.h: * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR): 2018-02-26 Charlie Turner <cturner@igalia.com> Fix build error with !LOG_DISABLED https://bugs.webkit.org/show_bug.cgi?id=183049 Reviewed by Philippe Normand. The following error message was being reported when doing a release build with -DLOG_DISABLED=0: ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp: In member function ‘void WebCore::MessagePortChannel::entanglePortWithProcess(const WebCore::MessagePortIdentifier&, WebCore::ProcessIdentifier)’: ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp:85:111: error: ‘logString’ was not declared in this scope LOG(MessagePorts, "MessagePortChannel %s (%p) entangling port %s (that port has %zu messages available)", logString().utf8().data(), this, port.logString().utf8().data(), m_pendingMessages[i].size()); Other uses of logString are guarded by !LOG_DISABLED rather than NDEBUG, which was the cause of this issue. * dom/messageports/MessagePortChannel.h: Guard using !LOG_DISABLED rather than NDEBUG. 2018-02-26 Carlos Garcia Campos <cgarcia@igalia.com> [GStreamer] User current executable name instead of g_get_prgname() for gst_init https://bugs.webkit.org/show_bug.cgi?id=183119 Reviewed by Philippe Normand. g_get_prgname() is only set for programs using GOptionContext, calling gtk_init or explicitly calling g_set_prgname(). Use WTF::getCurrentExecutableName() instead. * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::initializeGStreamer): 2018-02-25 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Disable downloadable binary fonts by default https://bugs.webkit.org/show_bug.cgi?id=183102 <rdar://problem/37860699> Reviewed by Tim Horton. Disable downloadable binary fonts by default in extra zoom mode by making the initial value of `downloadableBinaryFontsEnabled` conditional. Layout tests are not possible at this time; test to be added once layout test support is in place. * page/Settings.yaml: * page/SettingsBase.cpp: (WebCore::SettingsBase::defaultDownloadableBinaryFontsEnabled): * page/SettingsBase.h: 2018-02-25 Chris Dumez <cdumez@apple.com> Service workers do not work well inside Web.app https://bugs.webkit.org/show_bug.cgi?id=183105 <rdar://problem/37864140> Reviewed by Youenn Fablet. SessionID::defaultSessionID() was hardcoded in the ServiceWorkerThread constructor instead of using the sessionID of the SWServer that created the service worker thread. As a result, when the Service Worker would establish a SWClientConnection to the server, it would use the wrong sessionID and would end up using a different SWServer (Since we have a different SWServer instance per sessionID). As a result, ServiceWorkerRegistration / ServiceWorker objects inside the service worker would not be kept in sync with the server (since they registered themselves with the wrong SWServer). Covered by new API test. * workers/service/ServiceWorkerContextData.cpp: (WebCore::ServiceWorkerContextData::isolatedCopy const): * workers/service/ServiceWorkerContextData.h: (WebCore::ServiceWorkerContextData::encode const): (WebCore::ServiceWorkerContextData::decode): * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::createPageForServiceWorker): (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy): * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::importRecords): * workers/service/server/RegistrationStore.h: (WebCore::RegistrationStore::server): * workers/service/server/SWServer.cpp: (WebCore::SWServer::updateWorker): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::contextData const): 2018-02-24 Fujii Hironori <Hironori.Fujii@sony.com> Null-dereference of the second argument `resource` of DocumentLoader::scheduleSubstituteResourceLoad https://bugs.webkit.org/show_bug.cgi?id=182920 Reviewed by Darin Adler. A test case imported/w3c/web-platform-tests/html/browsers/offline/appcache/workers/appcache-worker.html always crashes due to a null-dereference if compiled and optimized by GCC 7.2. The second argument `resource` of DocumentLoader::scheduleSubstituteResourceLoad can be null if the resource can't be found in cache. I guess GCC optimizes inline HashMap::add based on assuming the `resource` never becomes null because its type is SubstituteResource&. This changes introduces a new method DocumentLoader::scheduleCannotShowURLError because it looks tricky to pass a nullptr to the second argument of scheduleSubstituteResourceLoad. No new tests (Covered by existing tests). * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::scheduleCannotShowURLError): Added a new method. * loader/DocumentLoader.h: * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::maybeLoadResource): Call scheduleCannotShowURLError if the resource not found in the appcache. 2018-02-17 Darin Adler <darin@apple.com> Prepare for ExtendedColor changes (first step) https://bugs.webkit.org/show_bug.cgi?id=182904 Reviewed by Sam Weinig. * css/CSSValuePool.cpp: (WebCore::CSSValuePool::createColorValue): Use HashMap::ensure. (WebCore::CSSValuePool::createFontFamilyValue): Ditto. (WebCore::CSSValuePool::createFontFaceValue): Ditto. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::maybeParseValue): Tightened up the logic a bit. * html/canvas/CanvasRenderingContext2D.cpp: Removed many unneeded includes. * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::recordAction): Updated for Ref instead of RefPtr and to use move semantics. (WebCore::buildArrayForAffineTransform): Return Ref instead of RefPtr. (WebCore::buildArrayForVector): Ditto. (WebCore::InspectorCanvas::buildInitialState): Ditto. Also use auto more. (WebCore::InspectorCanvas::buildAction): Ditto. (WebCore::InspectorCanvas::buildArrayForCanvasGradient): Ditto. (WebCore::InspectorCanvas::buildArrayForCanvasPattern): Ditto. (WebCore::InspectorCanvas::buildArrayForImageData): Ditto. * inspector/InspectorCanvas.h: Updated for the above. Also us "using" instead of typedef and removed unneeded ErrorString typedef and some includes. * page/DragController.cpp: (WebCore::DragController::concludeEditDrag): Use auto and Ref. * platform/DragData.h: Used pragma once and reorganized includes a bit. * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::frameBytes const): Use uint32_t instead of RGBA32 to prepare for removal of the RGBA32 type coming in a future patch. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::cacheNativeImageAtIndex): Ditto. (WebCore::ImageSource::canUseAsyncDecoding): Ditto. * platform/graphics/cocoa/GraphicsContextCocoa.mm: Tweaked #if for Mac-only code to use PLATFORM(MAC) to be easier to read. (WebCore::GraphicsContext::focusRingColor): Use sRGBColorSpaceRef instead of calling CGColorSpaceCreateWithName each time. * platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added include needed now that it was removed from some header. * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Use uint32_t instead of RGBA32 to prepare for removal of the RGBA32 type coming in a future patch. * platform/image-decoders/ScalableImageDecoder.cpp: (WebCore::ScalableImageDecoder::frameBytesAtIndex const): Ditto. * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp: (WebCore::ImageBackingStore::image const): Ditto. * platform/image-decoders/gif/GIFImageDecoder.cpp: (WebCore::GIFImageDecoder::haveDecodedRow): Ditto. * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: (WebCore::setPixel): Ditto. (WebCore::JPEGImageDecoder::outputScanlines): Ditto. * platform/image-decoders/png/PNGImageDecoder.cpp: (WebCore::PNGImageDecoder::rowAvailable): Ditto. (WebCore::PNGImageDecoder::frameComplete): Ditto. * platform/image-decoders/webp/WEBPImageDecoder.cpp: (WebCore::WEBPImageDecoder::decodeFrame): Ditto. (WebCore::WEBPImageDecoder::applyPostProcessing): Ditto. * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::color): Added comments. * rendering/EllipsisBox.cpp: (WebCore::EllipsisBox::paintSelection): Use Color::isVisible. 2018-02-23 Chris Dumez <cdumez@apple.com> Crash under SchemeRegistry::shouldTreatURLSchemeAsLocal(WTF::String const&) https://bugs.webkit.org/show_bug.cgi?id=183066 <rdar://problem/37804111> Reviewed by Ryosuke Niwa. SecurityOrigin objects are constructed on various threads. However, someone added a shouldTreatAsPotentiallyTrustworthy() call to the SecurityOrigin constructor which was not thread safe. This is because this function relies on SchemeRegistry::shouldTreatURLSchemeAsSecure() and SchemeRegistry::shouldTreatURLSchemeAsLocal() which were relying on global static HashMaps without locks. Update SecurityOrigin to initialize m_isPotentiallyTrustworthy lazily, to avoid paying initialization cost in the constructor. This is only queries by SecurityContext::isSecureContext(). Make SchemeRegistry::shouldTreatURLSchemeAsLocal() and SchemeRegistry::shouldTreatURLSchemeAsSecure() thread-safe, since they are needed to initialize SecurityOrigin::m_isPotentiallyTrustworthy from various threads. SchemeRegistry::shouldTreatURLSchemeAsSecure() is only called from SecurityOrigin (which requires thread-safety), and getUserMedia() which is not hot code so the extra locking there should not be an issue. SchemeRegistry::shouldTreatURLSchemeAsLocal() is called from SecurityOrigin (which requires thread- safety). It is also called from isQuickLookPreviewURL(), MHTMLArchive::create(), Page::userStyleSheetLocationChanged(), isRemoteWebArchive() and HTMLPlugInImageElement. All these are not hot code so I do not think we need a fast path. * page/SecurityOrigin.cpp: (WebCore::isLoopbackIPAddress): (WebCore::shouldTreatAsPotentiallyTrustworthy): (WebCore::SecurityOrigin::isPotentiallyTrustworthy const): (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress): * page/SecurityOrigin.h: * platform/SchemeRegistry.cpp: (WebCore::localURLSchemesLock): (WebCore::localURLSchemes): (WebCore::secureSchemesLock): (WebCore::secureSchemes): (WebCore::SchemeRegistry::registerURLSchemeAsLocal): (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal): (WebCore::SchemeRegistry::registerURLSchemeAsSecure): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure): * platform/SchemeRegistry.h: 2018-02-23 Christopher Reid <chris.reid@sony.com> [Curl] Cookie Database files are wrongfully getting deleted when the database is opened https://bugs.webkit.org/show_bug.cgi?id=183051 Reviewed by Per Arne Vollan. The file stat logic was backwards causing a wrongful detection of database corruption. Fixed the logic and abstracted these calls to use FileSystem. * platform/network/curl/CookieJarDB.cpp: 2018-02-23 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Make RenderTreeBuilder::* classes WTF_MAKE_FAST_ALLOCATED https://bugs.webkit.org/show_bug.cgi?id=183084 <rdar://problem/37828706> Reviewed by Antti Koivisto. * rendering/updating/RenderTreeBuilderBlock.h: * rendering/updating/RenderTreeBuilderBlockFlow.h: * rendering/updating/RenderTreeBuilderContinuation.h: * rendering/updating/RenderTreeBuilderFirstLetter.h: * rendering/updating/RenderTreeBuilderFormControls.h: * rendering/updating/RenderTreeBuilderFullScreen.h: * rendering/updating/RenderTreeBuilderInline.h: * rendering/updating/RenderTreeBuilderList.h: * rendering/updating/RenderTreeBuilderMathML.h: * rendering/updating/RenderTreeBuilderMultiColumn.h: * rendering/updating/RenderTreeBuilderRuby.h: * rendering/updating/RenderTreeBuilderSVG.h: * rendering/updating/RenderTreeBuilderTable.h: * rendering/updating/RenderTreeUpdaterGeneratedContent.h: 2018-02-23 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderFullScreen::createPlaceholder to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=183027 <rdar://problem/37773058> Reviewed by Antti Koivisto. No change in functionality. * dom/Document.cpp: (WebCore::Document::setFullScreenRenderer): * dom/Document.h: * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreenPlaceholder::RenderFullScreenPlaceholder): (WebCore::RenderFullScreenPlaceholder::isRenderFullScreenPlaceholder const): (WebCore::RenderFullScreen::wrapNewRenderer): (WebCore::RenderFullScreen::wrapExistingRenderer): (): Deleted. (WebCore::RenderFullScreen::createPlaceholder): Deleted. * rendering/RenderFullScreen.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::createPlaceholderForFullScreen): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderFullScreen.cpp: (WebCore::RenderTreeBuilder::FullScreen::createPlaceholder): * rendering/updating/RenderTreeBuilderFullScreen.h: 2018-02-23 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Add WARN_UNUSED_RETURN to detach() https://bugs.webkit.org/show_bug.cgi?id=183073 <rdar://problem/37814585> Reviewed by Antti Koivisto. So that we don't destroy a renderer accidentally. * rendering/updating/RenderTreeBuilderBlock.h: * rendering/updating/RenderTreeBuilderRuby.h: * rendering/updating/RenderTreeBuilderSVG.h: 2018-02-22 Antoine Quint <graouts@apple.com> REGRESSION (r228445): A big pause button shows over YouTube videos if you tap "Tap To Unmute" on iOS https://bugs.webkit.org/show_bug.cgi?id=183074 <rdar://problem/37747028> Reviewed by Eric Carlson. Test: media/modern-media-controls/start-support/start-support-disable-controls-and-re-enable-post-play.html In the fix for webkit.org/b/182668, we made it so that when the "controls" attribute is absent from a media element we stop listening to the bulk of media events and prevent controls from updating any DOM properties so as to minimize the amount of CPU usage by the Web process. An unfortunate side effect was that, if the media controls were disabled at the time the video starts playing, the StartSupport class would thus not catch the "play" event and would not be able to set the "hasPlayed" property to "true" on the MediaController, which would then prevent the _shouldShowStartButton() from returning "false". As a result, if the "controls" attribute was turned back on after the media started playing, they would default to showing the start button, which would be then in the play state, ie. showing the pause icon. We now set the "hasPlayed" property in the "play" event handler on MediaController, which is always registered regardless of the "controls" attribute setting. We also ensure we invalidate the "showStartButton" property on the media controls when StartSupport is enabled, which is the case when the "controls" attribute is toggled back to "true" from a previous "false" value. * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype.handleEvent): * Modules/modern-media-controls/media/start-support.js: (StartSupport): (StartSupport.prototype.enable): (StartSupport.prototype.handleEvent): (StartSupport.prototype._updateShowsStartButton): 2018-02-23 Carlos Garcia Campos <cgarcia@igalia.com> [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser https://bugs.webkit.org/show_bug.cgi?id=173655 <rdar://problem/37706341> Reviewed by Philippe Normand. Do not assume gst is only used in the WebProcess, the MIMETypeRegistry also uses gst to get the list of supported media types. Move the code to extract gst options from the process command line to a helper function and use it in the UI process to pass the options to the WebProcess, but also in the current process when gst is initialized without providing options. Fixes several unit tests that use MIMETypeRegistry in the UI process. * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::extractGStreamerOptionsFromCommandLine): Helper to get the gst options from the current process command line. (WebCore::initializeGStreamer): Ensure this is called once. Get the gst options from the given vector or extract it from the command line if not provided. * platform/graphics/gstreamer/GStreamerUtilities.h: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Bring back the gst initialization here. 2018-02-23 Philippe Normand <pnormand@igalia.com> [GStreamer] HTTP totalBytes query returns 0 after seeking (sometimes) https://bugs.webkit.org/show_bug.cgi?id=183002 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_init): Initialize member variables. Also no need to set the appsrc size at that point. (webKitWebSrcStop): There is no need to reset the size when seeking. Size should in most cases represent the Content-Length response attribute, even when seeking. (webKitWebSrcStart): No need to reset the size attribute. (webKitWebSrcQueryWithParent): Let appsrc handle DURATION queries. (CachedResourceStreamingClient::responseReceived): Emit duration notification one time only. 2018-02-23 Philippe Normand <pnormand@igalia.com> [GStreamer] media/video-src-blob-using-open-panel.html crashes in Debug https://bugs.webkit.org/show_bug.cgi?id=183005 Reviewed by Xabier Rodriguez-Calvar. Test: media/video-src-blob-using-open-panel.html * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::convertToInternalProtocol): Also convert blob URIs because they're handled by our httpsrc element. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcGetProtocols): Prefix blob URIs too, for consistency purpose. 2018-02-22 Yusuke Suzuki <utatane.tea@gmail.com> Remove currentTime() / currentTimeMS() https://bugs.webkit.org/show_bug.cgi?id=183052 Reviewed by Mark Lam. * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::haveSuitableCachedPosition): * dom/DOMTimeStamp.h: (WebCore::convertSecondsToDOMTimeStamp): * fileapi/File.cpp: (WebCore::File::File): (WebCore::File::lastModified const): * history/HistoryItem.cpp: (WebCore::generateSequenceNumber): * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::defaultValueForStepUp const): * html/DateTimeInputType.cpp: (WebCore::DateTimeInputType::defaultValueForStepUp const): * html/MonthInputType.cpp: (WebCore::MonthInputType::defaultValueForStepUp const): * html/TimeInputType.cpp: (WebCore::TimeInputType::defaultValueForStepUp const): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::willSendRequest): (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest): * loader/EmptyFrameLoaderClient.h: * loader/FormSubmission.cpp: (WebCore::generateFormDataIdentifier): * loader/FrameLoader.cpp: (WebCore::FrameLoader::clientRedirected): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: * loader/NavigationScheduler.cpp: * page/History.cpp: (WebCore::History::stateObjectAdded): * page/History.h: * page/PageOverlay.cpp: (WebCore::PageOverlay::startFadeAnimation): (WebCore::PageOverlay::fadeAnimationTimerFired): * page/PageOverlay.h: * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawNativeImage): * platform/ios/LegacyTileLayerPool.h: * platform/ios/LegacyTileLayerPool.mm: (WebCore::LegacyTileLayerPool::LegacyTileLayerPool): (WebCore::LegacyTileLayerPool::addLayer): (WebCore::LegacyTileLayerPool::decayedCapacity const): (WebCore::LegacyTileLayerPool::prune): * platform/ios/SystemMemoryIOS.cpp: (WebCore::systemMemoryLevel): * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: 2018-02-22 Per Arne Vollan <pvollan@apple.com> The WebContent process should not use NSScreen in the screenDepth implementation. https://bugs.webkit.org/show_bug.cgi?id=183048 Reviewed by Brent Fulgham. NSScreen method calls should be done in the UIProcess, since these calls will communicate with the WindowServer. The screen depth property can be retrieved in the UIProcess, and sent to the WebContent process, where it is cached. Whenever screen properties change, the UIProcess will send the new screen properties to the WebProcess. No new tests, covered by existing tests. * platform/ScreenProperties.h: (WebCore::ScreenProperties::encode const): (WebCore::ScreenProperties::decode): * platform/mac/PlatformScreenMac.mm: (WebCore::getScreenProperties): (WebCore::screenDepth): (WebCore::screenDepthPerComponent): (WebCore::screenRect): (WebCore::screenAvailableRect): 2018-02-22 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Rename insertChild() -> attach(), takeChild() -> detach() and removeAndDestroy() -> destroy() https://bugs.webkit.org/show_bug.cgi?id=183061 <rdar://problem/37800269> Reviewed by Ryosuke Niwa. ...and moveChildTo() -> move() (moveChildrenTo() -> moveChildren()), removeFromParentAndDestroyCleaningUpAnonymousWrappers() -> destroyAndCleanUpAnonymousWrappers() No change in functionality. * dom/Document.cpp: (WebCore::Document::destroyRenderTree): (WebCore::Document::setFullScreenRenderer): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/RenderButton.cpp: (WebCore::RenderButton::setText): * rendering/RenderElement.cpp: (WebCore::RenderElement::didAttachChild): (WebCore::RenderElement::didInsertChild): Deleted. * rendering/RenderElement.h: * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::wrapNewRenderer): (WebCore::RenderFullScreen::wrapExistingRenderer): (WebCore::RenderFullScreen::unwrapRenderer): (WebCore::RenderFullScreen::createPlaceholder): * rendering/RenderMenuList.cpp: (RenderMenuList::didAttachChild): (RenderMenuList::setText): (RenderMenuList::didInsertChild): Deleted. * rendering/RenderMenuList.h: * rendering/RenderQuote.cpp: (WebCore::RenderQuote::updateTextRenderer): * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::setText): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::destroy): (WebCore::RenderTreeBuilder::attach): (WebCore::RenderTreeBuilder::attachIgnoringContinuation): (WebCore::RenderTreeBuilder::detach): (WebCore::RenderTreeBuilder::attachToRenderElement): (WebCore::RenderTreeBuilder::attachToRenderElementInternal): (WebCore::RenderTreeBuilder::move): (WebCore::RenderTreeBuilder::moveAllChildren): (WebCore::RenderTreeBuilder::moveChildren): (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloats): (WebCore::RenderTreeBuilder::makeChildrenNonInline): (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild): (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock): (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers): (WebCore::RenderTreeBuilder::detachFromRenderGrid): (WebCore::RenderTreeBuilder::detachFromRenderElement): (WebCore::RenderTreeBuilder::attachToRenderGrid): (WebCore::RenderTreeBuilder::removeAndDestroy): Deleted. (WebCore::RenderTreeBuilder::insertChild): Deleted. (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation): Deleted. (WebCore::RenderTreeBuilder::takeChild): Deleted. (WebCore::RenderTreeBuilder::insertChildToRenderElement): Deleted. (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal): Deleted. (WebCore::RenderTreeBuilder::moveChildTo): Deleted. (WebCore::RenderTreeBuilder::moveAllChildrenTo): Deleted. (WebCore::RenderTreeBuilder::moveChildrenTo): Deleted. (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo): Deleted. (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Deleted. (WebCore::RenderTreeBuilder::takeChildFromRenderGrid): Deleted. (WebCore::RenderTreeBuilder::takeChildFromRenderElement): Deleted. (WebCore::RenderTreeBuilder::insertChildToRenderGrid): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::attach): (WebCore::RenderTreeBuilder::Block::insertChildToContinuation): (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation): (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock): (WebCore::RenderTreeBuilder::Block::detach): (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild): (WebCore::RenderTreeBuilder::Block::insertChild): Deleted. (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): Deleted. (WebCore::RenderTreeBuilder::Block::takeChild): Deleted. * rendering/updating/RenderTreeBuilderBlock.h: * rendering/updating/RenderTreeBuilderBlockFlow.cpp: (WebCore::RenderTreeBuilder::BlockFlow::attach): (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloats): (WebCore::RenderTreeBuilder::BlockFlow::insertChild): Deleted. (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo): Deleted. * rendering/updating/RenderTreeBuilderBlockFlow.h: * rendering/updating/RenderTreeBuilderContinuation.cpp: (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnDestroy): (WebCore::RenderTreeBuilder::FirstLetter::updateStyle): (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): * rendering/updating/RenderTreeBuilderFormControls.cpp: (WebCore::RenderTreeBuilder::FormControls::attach): (WebCore::RenderTreeBuilder::FormControls::detach): (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild): (WebCore::RenderTreeBuilder::FormControls::insertChild): Deleted. (WebCore::RenderTreeBuilder::FormControls::takeChild): Deleted. * rendering/updating/RenderTreeBuilderFormControls.h: * rendering/updating/RenderTreeBuilderFullScreen.cpp: (WebCore::RenderTreeBuilder::FullScreen::cleanupOnDestroy): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::attach): (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation): (WebCore::RenderTreeBuilder::Inline::attachIgnoringContinuation): (WebCore::RenderTreeBuilder::Inline::splitFlow): (WebCore::RenderTreeBuilder::Inline::splitInlines): (WebCore::RenderTreeBuilder::Inline::childBecameNonInline): (WebCore::RenderTreeBuilder::Inline::insertChild): Deleted. (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): Deleted. * rendering/updating/RenderTreeBuilderInline.h: * rendering/updating/RenderTreeBuilderList.cpp: (WebCore::RenderTreeBuilder::List::updateItemMarker): * rendering/updating/RenderTreeBuilderMathML.cpp: (WebCore::RenderTreeBuilder::MathML::makeFences): (WebCore::RenderTreeBuilder::MathML::attach): (WebCore::RenderTreeBuilder::MathML::insertChild): Deleted. * rendering/updating/RenderTreeBuilderMathML.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant): (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren): (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): (WebCore::RenderTreeBuilder::Ruby::attach): (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe): (WebCore::RenderTreeBuilder::Ruby::detach): (WebCore::RenderTreeBuilder::Ruby::insertChild): Deleted. (WebCore::RenderTreeBuilder::Ruby::takeChild): Deleted. * rendering/updating/RenderTreeBuilderRuby.h: * rendering/updating/RenderTreeBuilderSVG.cpp: (WebCore::RenderTreeBuilder::SVG::attach): (WebCore::RenderTreeBuilder::SVG::detach): (WebCore::RenderTreeBuilder::SVG::insertChild): Deleted. (WebCore::RenderTreeBuilder::SVG::takeChild): Deleted. * rendering/updating/RenderTreeBuilderSVG.h: * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild): (WebCore::RenderTreeBuilder::Table::attach): (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows): (WebCore::RenderTreeBuilder::Table::insertChild): Deleted. * rendering/updating/RenderTreeBuilderTable.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::createRenderer): (WebCore::RenderTreeUpdater::createTextRenderer): (WebCore::RenderTreeUpdater::tearDownRenderers): (WebCore::RenderTreeUpdater::tearDownTextRenderer): (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded): * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::createContentRenderers): 2018-02-22 Chris Dumez <cdumez@apple.com> ResourceRequestBase::isolatedCopy() fails to isolate copy the cachePartition https://bugs.webkit.org/show_bug.cgi?id=183059 <rdar://problem/37800202> Reviewed by Youenn Fablet. Update ResourceRequestBase::setAsIsolatedCopy() to call isolatedCopy() on the cachePartition as well, given that it is a String and it would not be safe to send it to another thread otherwise. * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setAsIsolatedCopy): 2018-02-22 Chris Dumez <cdumez@apple.com> ServiceWorkerContainer::startScriptFetchForJob() fails to isolate copy the registrationKey before passing it to the main thread https://bugs.webkit.org/show_bug.cgi?id=183050 <rdar://problem/37796881> Reviewed by Youenn Fablet. Create an isolated copy of the registrationKey before passing it to the main thread in ServiceWorkerContainer's startScriptFetchForJob() / jobFinishedLoadingScript() / jobFailedLoadingScript(). * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::startScriptFetchForJob): (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): (WebCore::ServiceWorkerContainer::jobFailedLoadingScript): 2018-02-22 Chris Dumez <cdumez@apple.com> ServiceWorkerContainer::scheduleJob() fails to isolate copy the jobData before passing it to the main thread https://bugs.webkit.org/show_bug.cgi?id=183046 <rdar://problem/37793395> Reviewed by Youenn Fablet. Make sure we isolate copy the jobData before passing it to the main thread in ServiceWorkerContainer::scheduleJob(). The jobData contains Strings / URLs so it is not safe to have non-isolated copies of it on various threads. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::scheduleJob): 2018-02-22 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Fix warning on clang. https://bugs.webkit.org/show_bug.cgi?id=182986 Reviewed by Konstantin Tokarev. No new tests because there's no behaviro changes. * platform/network/curl/CurlResourceHandleDelegate.cpp: (WebCore::CurlResourceHandleDelegate::curlDidSendData): (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer): (WebCore::CurlResourceHandleDelegate::curlDidFailWithError): * platform/network/curl/CurlResourceHandleDelegate.h: 2018-02-22 Youenn Fablet <youenn@apple.com> WorkerCacheStorageConnection::doRemove can assert in case two frames try to delete the same cache at the same time https://bugs.webkit.org/show_bug.cgi?id=183041 Reviewed by Chris Dumez. * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::WorkerCacheStorageConnection::doRemove): Update the assertion to accept the case of an already deleted cache, i.e. returned identifer is 0. 2018-02-22 Alejandro G. Castro <alex@igalia.com> Remove some code leftovers in LibWebRTCMediaEndpoint and RealtimeOutgoingVideoSource classes https://bugs.webkit.org/show_bug.cgi?id=183031 Reviewed by Youenn Fablet. This include and namespace are not required in the file. Just removing unused code, no tests required. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: 2018-02-22 Chris Dumez <cdumez@apple.com> Document.open() cancels existing provisional load but not navigation policy check https://bugs.webkit.org/show_bug.cgi?id=183012 <rdar://problem/37755831> Reviewed by Alex Christensen. Test: fast/dom/Document/open-with-pending-load-async-policy.html * dom/Document.cpp: (WebCore::Document::open): The existing code was calling FrameLoader::stopAllLoaders() when the loader's state is FrameStateProvisional. The issue is that the FrameLoader's state only gets set to FrameStateProvisional after the policy decision for the navigation is made. This means that we fail to cancel a pending load if is still in the policy decision stage, which can happen when the policy decision is made asynchronously. We now also cancel such pending navigation policy checks as well. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the lambda. Otherwise, it gets reset too early when the policy decision is made asynchronously. 2018-02-22 Youenn Fablet <youenn@apple.com> Add release asserts for service worker fetch and postMessage events https://bugs.webkit.org/show_bug.cgi?id=183025 rdar://problem/37765052 Reviewed by Daniel Bates. Add release assertion so that a service worker will only dispatch a message event for clients and service workers with the same origin. No change of behavior. * platform/network/ResourceRequestBase.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::postMessageToServiceWorker): * workers/service/context/ServiceWorkerThreadProxy.h: 2018-02-22 Miguel Gomez <magomez@igalia.com> including both gl3.h and gl2.h when USE_OPENGL_ES is enabled https://bugs.webkit.org/show_bug.cgi?id=183008 Reviewed by Michael Catanzaro. Don't include GLES3 headers as we stick to GLES2 API resources. No new tests, no behavior change. * platform/graphics/GLContext.cpp: 2018-02-22 Ms2ger <Ms2ger@igalia.com> [GTK][WPE] Fix some build errors in service workers code https://bugs.webkit.org/show_bug.cgi?id=182966 Reviewed by Žan Doberšek. No new tests: no change in behavior. * workers/service/ServiceWorkerProvider.h: add missing forward declaration. 2018-02-21 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderObject::insertedInto() mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=183022 <rdar://problem/37764326> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderObject.cpp: (WebCore::RenderObject::insertedIntoTree): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal): (WebCore::RenderTreeBuilder::moveChildrenTo): (WebCore::RenderTreeBuilder::multiColumnDescendantInserted): Deleted. * rendering/updating/RenderTreeBuilder.h: 2018-02-21 Tim Horton <timothy_horton@apple.com> Include all Cocoa sources in all Cocoa platform builds https://bugs.webkit.org/show_bug.cgi?id=183026 <rdar://problem/37513101> Reviewed by Dan Bernstein. Similar to r228571, don't have separate Sources files for iOS and Mac. All sources now have #ifdefs that ensure that only the right ones build on the right platforms. This makes it much easier to reason about what builds where by just looking at the sources. * SourcesCocoa.txt: * SourcesIOS.txt: Removed. * SourcesMac.txt: Removed. * WebCore.xcodeproj/project.pbxproj: * editing/WebContentReader.h: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: 2018-02-21 Youenn Fablet <youenn@apple.com> Make SubstituteResource take a ResourceResponse r-value https://bugs.webkit.org/show_bug.cgi?id=183020 Reviewed by Alex Christensen. No change of behavior. Make SubstituteResource take a ResourceResponse r-value. Update ArchiveResource accordingly. Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache before passing it to SubstituteResource constructor. * loader/SubstituteResource.h: (WebCore::SubstituteResource::SubstituteResource): (WebCore::SubstituteResource::resourceResponse): Deleted. * loader/appcache/ApplicationCacheResource.cpp: (WebCore::ApplicationCacheResource::create): (WebCore::ApplicationCacheResource::ApplicationCacheResource): * loader/appcache/ApplicationCacheResource.h: (WebCore::ApplicationCacheResource::create): Deleted. * loader/archive/ArchiveResource.cpp: (WebCore::ArchiveResource::ArchiveResource): 2018-02-21 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] ::willBeRemoved() does not need RenderTreeBuilder anymore. https://bugs.webkit.org/show_bug.cgi?id=183019 <rdar://problem/37761421> Reviewed by Antti Koivisto. All the willBeDestroyed() mutations have been moved over to RenderTreeBuilder. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::willBeDestroyed): * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willBeDestroyed): * rendering/RenderBlockFlow.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::willBeDestroyed): * rendering/RenderBox.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::willBeDestroyed): * rendering/RenderBoxModelObject.h: * rendering/RenderCounter.cpp: (WebCore::RenderCounter::willBeDestroyed): * rendering/RenderCounter.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::willBeDestroyed): * rendering/RenderElement.h: * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::willBeDestroyed): * rendering/RenderEmbeddedObject.h: * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::willBeDestroyed): * rendering/RenderFragmentedFlow.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::willBeDestroyed): * rendering/RenderImage.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderInline.h: * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::willBeDestroyed): * rendering/RenderLayerModelObject.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::willBeDestroyed): * rendering/RenderListBox.h: * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::willBeDestroyed): * rendering/RenderListMarker.h: * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::willBeDestroyed): * rendering/RenderMenuList.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::willBeDestroyed): (WebCore::RenderObject::destroy): * rendering/RenderObject.h: * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::willBeDestroyed): * rendering/RenderReplaced.h: * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::willBeDestroyed): * rendering/RenderSearchField.h: * rendering/RenderSnapshottedPlugIn.cpp: (WebCore::RenderSnapshottedPlugIn::willBeDestroyed): * rendering/RenderSnapshottedPlugIn.h: * rendering/RenderText.cpp: (WebCore::RenderText::willBeDestroyed): * rendering/RenderText.h: * rendering/RenderTextControlMultiLine.cpp: (WebCore::RenderTextControlMultiLine::willBeDestroyed): * rendering/RenderTextControlMultiLine.h: * rendering/RenderVideo.cpp: (WebCore::RenderVideo::willBeDestroyed): * rendering/RenderVideo.h: * rendering/RenderWidget.cpp: (WebCore::RenderWidget::willBeDestroyed): * rendering/RenderWidget.h: * rendering/svg/RenderSVGBlock.cpp: (WebCore::RenderSVGBlock::willBeDestroyed): * rendering/svg/RenderSVGBlock.h: * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::willBeDestroyed): * rendering/svg/RenderSVGImage.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::willBeDestroyed): * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::willBeDestroyed): * rendering/svg/RenderSVGModelObject.h: * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::willBeDestroyed): * rendering/svg/RenderSVGResourceContainer.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::willBeDestroyed): * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::willBeDestroyed): * rendering/svg/RenderSVGText.h: 2018-02-21 Per Arne Vollan <pvollan@apple.com> The WebContent process should not use NSScreen in the screenAvailableRect/screenRect implementations. https://bugs.webkit.org/show_bug.cgi?id=182855 Reviewed by Brent Fulgham. On macOS, the functions screenAvailableRect and screenRect is implemented using NSScreen, which is communicating with the WindowServer. To avoid this WindowServer communication from the WebContent process when calling screenAvailableRect and screenRect, it is possible to let the UIProcess send a message to the WebContent process whenever there is a change in the display properties, and have the WebContent process cache these display properties. This message should also be sent to a newly started WebContent process. No new tests, covered by existing tests. * WebCore.xcodeproj/project.pbxproj: * platform/PlatformScreen.h: * platform/mac/PlatformScreenMac.mm: (WebCore::getScreenProperties): (WebCore::screenProperties): (WebCore::setScreenProperties): (WebCore::screenRect): (WebCore::screenAvailableRect): * platform/ScreenProperties.h: Added. (WebCore::ScreenProperties::encode const): (WebCore::ScreenProperties::decode): 2018-02-21 Christopher Reid <chris.reid@sony.com> [Curl] Curl Cookie Database File should be configurable using NetworkProcessCreationParameters https://bugs.webkit.org/show_bug.cgi?id=182751 Reviewed by Youenn Fablet. No change in behavior. Adding support to set a custom CookieJar Database. Took CookieJarDB::open() out of its constructor because both the Network and Web process were trying to open the journal files but one process was failing due to a lack of permission. Now the database file is lazily opened and only the Network process will try to open the database. Some cleanup was done to CookieJarDB too. * platform/network/NetworkStorageSession.h: * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/CookieJarDB.h: * platform/network/curl/NetworkStorageSessionCurl.cpp: 2018-02-21 Chris Dumez <cdumez@apple.com> Regression(r228708): Crash under WebCore::MediaResource::responseReceived(WebCore::CachedResource&, WebCore::ResourceResponse const&) https://bugs.webkit.org/show_bug.cgi?id=183018 <rdar://problem/37754154> Reviewed by Eric Carlson. The fix at r228708 was trying to address the fact that avplayer sometimes deallocates WebCoreNSURLSessionDataTask objects on a non-main thread, which was not safe because its _resource data member needs to be deallocated on the main thread. The issue is that r228708 caused _resource to outlive its WebCoreNSURLSessionDataTask. This is an issue because _resource has a client data member (of type WebCoreNSURLSessionDataTaskClient) which has a raw pointer to the WebCoreNSURLSessionDataTask. This means that the main thread could call methods like responseReceived() on the resource, which would call responseReceived() on the client, which would try to call [WebCoreNSURLSessionDataTask receivedResponse:] with an invalid m_task pointer. To address the issue, I introduced a clearTask() method on WebCoreNSURLSessionDataTaskClient, which gets called from a non-main thread to clear the client's m_task pointer when the task is destroyed on a non-main thread. So that this is safe, every time the client tries to use m_task, we now acquire a lock for thread-safety and do a null-check on m_task. No new tests, no known reproduction case. * platform/graphics/PlatformMediaResourceLoader.h: (WebCore::PlatformMediaResource::client): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask): (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse): (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): (-[WebCoreNSURLSessionDataTask dealloc]): 2018-02-21 Youenn Fablet <youenn@apple.com> Move AppCache loading to the NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=178540 <rdar://problem/37119346> Reviewed by Alex Christensen. Covered by existing tests. Use ApplicationResourceLoader for cache entry loading. Remove all ResourceHandle use from ApplicationCacheGroup. Renamed m_loader in m_manifestLoader and added a new m_entryLoader to load cache entries. Updated ApplicationCacheResourceLoader to handle different types of CachedResource. This allows in particular to handle redirections based on the resource type and create the ApplicationCacheResource with the right type. Use Include as credentials mode as per specification. Add a new ApplicationCache ResourceResonse::Source. This allows fixing an assertion and should allow better inspector support if needs be. * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::responseSource): * loader/ResourceLoader.cpp: (WebCore::logResourceResponseSource): * loader/SubstituteResource.h: (WebCore::SubstituteResource::resourceResponse): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::stopLoading): (WebCore::ApplicationCacheGroup::update): (WebCore::ApplicationCacheGroup::didFinishLoading): (WebCore::ApplicationCacheGroup::didFinishLoadingEntry): (WebCore::ApplicationCacheGroup::didFail): (WebCore::ApplicationCacheGroup::didFailLoadingEntry): (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): (WebCore::ApplicationCacheGroup::startLoadingEntry): * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheResource.cpp: (WebCore::ApplicationCacheResource::ApplicationCacheResource): * loader/appcache/ApplicationCacheResourceLoader.cpp: (WebCore::ApplicationCacheResourceLoader::create): (WebCore::ApplicationCacheResourceLoader::ApplicationCacheResourceLoader): (WebCore::ApplicationCacheResourceLoader::responseReceived): (WebCore::ApplicationCacheResourceLoader::redirectReceived): * loader/appcache/ApplicationCacheResourceLoader.h: * platform/network/ResourceResponseBase.h: * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::ResourceResponse::platformCertificateInfo const): * testing/Internals.cpp: (WebCore::responseSourceToString): 2018-02-21 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBoxModelObject::willBeRemoved() mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=183014 <rdar://problem/37757428> Reviewed by Antti Koivisto. No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::~RenderBoxModelObject): (WebCore::RenderBoxModelObject::willBeDestroyed): (WebCore::RenderBoxModelObject::continuationChainNode const): (): Deleted. (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): Deleted. * rendering/RenderBoxModelObject.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::removeAndDestroy): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::continuationBuilder): * rendering/updating/RenderTreeBuilderContinuation.cpp: Added. (WebCore::RenderTreeBuilder::Continuation::Continuation): (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy): * rendering/updating/RenderTreeBuilderContinuation.h: Added. 2018-02-21 Youenn Fablet <youenn@apple.com> ServiceWorkerJob::m_lastResponse is unneeded https://bugs.webkit.org/show_bug.cgi?id=183013 Reviewed by Chris Dumez. Remove this field since not used anywhere. * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::didReceiveResponse): * workers/service/ServiceWorkerJob.h: 2018-02-21 Youenn Fablet <youenn@apple.com> Use ResourceLoader to load appcache manifest https://bugs.webkit.org/show_bug.cgi?id=182861 Reviewed by Alex Christensen. Covered by updated tests. Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader. Make use of it to load the app cache manifest. Future work should load entries using the same loader. Remove manifest handle. Ensure that DocumentLoader does not register the manifest resource loader as its lifetime is handled by its ApplicationCacheGroup. Add a ResourceLoader option to bypass the application cache. Use it for manifest loading. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::addSubresourceLoader): * loader/ResourceLoaderOptions.h: * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::stopLoading): (WebCore::ApplicationCacheGroup::update): (WebCore::ApplicationCacheGroup::createRequest): (WebCore::ApplicationCacheGroup::didReceiveResponseAsync): (WebCore::ApplicationCacheGroup::didReceiveData): (WebCore::ApplicationCacheGroup::didFinishLoading): (WebCore::ApplicationCacheGroup::didFail): (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::maybeLoadResource): (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect): (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse): (WebCore::ApplicationCacheHost::maybeLoadFallbackForError): * loader/appcache/ApplicationCacheResourceLoader.cpp: Added. * loader/appcache/ApplicationCacheResourceLoader.h: Added. 2018-02-21 Don Olmstead <don.olmstead@sony.com> [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h https://bugs.webkit.org/show_bug.cgi?id=182883 Reviewed by Per Arne Vollan. No new tests. No change in behavior. * WebCorePrefix.h: * config.h: * testing/js/WebCoreTestSupportPrefix.h: 2018-02-21 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderView::willBeRemoved() mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=183009 Reviewed by Antti Koivisto. No change in functionality. * dom/Document.cpp: (WebCore::Document::destroyRenderTree): * rendering/RenderView.cpp: (WebCore::RenderView::~RenderView): (WebCore::RenderView::willBeDestroyed): Deleted. * rendering/RenderView.h: 2018-02-21 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] USE_UPOWER causes crashes inside a chroot or on systems with broken dbus/upower https://bugs.webkit.org/show_bug.cgi?id=181825 Reviewed by Carlos Garcia Campos. We could fix this crash, but that would not be good enough, because upower-glib is a synchronous API that wraps D-Bus calls. That's not acceptable for use in the web process. Rewrite LowPowerModeNotifierGLib to use upower's D-Bus API directly, instead. Note that this also enables LowPowerModeNotifier for WPE, since the USE(UPOWER) build flag is no longer needed. * platform/LowPowerModeNotifier.cpp: * platform/LowPowerModeNotifier.h: * platform/glib/LowPowerModeNotifierGLib.cpp: (WebCore::LowPowerModeNotifier::LowPowerModeNotifier): (WebCore::LowPowerModeNotifier::updateWarningLevel): (WebCore::LowPowerModeNotifier::warningLevelChanged): (WebCore::LowPowerModeNotifier::gPropertiesChangedCallback): (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier): (WebCore::LowPowerModeNotifier::updateState): Deleted. (WebCore::LowPowerModeNotifier::warningLevelCallback): Deleted. 2018-02-21 Chris Dumez <cdumez@apple.com> VTTCue constructor should use 'double' type for startTime / endTime https://bugs.webkit.org/show_bug.cgi?id=182988 Reviewed by Eric Carlson. VTTCue constructor should use 'double' type for startTime / endTime, not 'unrestricted double': - https://w3c.github.io/webvtt/#the-vttcue-interface Otherwise, we end up potentially returning NaN for TextTrackCue.startTime / endTime, even though those correctly use type 'double': - https://html.spec.whatwg.org/multipage/media.html#texttrackcue The new behavior is consistent with Firefox and Chrome. No new tests, updated existing test. * bindings/js/JSDOMConvertNumbers.h: (WebCore::JSConverter<IDLDouble>::convert): Add assertion to make sure our implementation never tries to return NaN for an IDL attribute of type 'double'. This would be invalid as per Web IDL spec and would crash if the NaN being returned was impure as JSValue could not store it as a double. * html/track/VTTCue.idl: Update constructor parameters to use 'double' type instead of 'unrestricted double', as per: - https://w3c.github.io/webvtt/#the-vttcue-interface 2018-02-21 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderTextFragment::willBeRemoved() mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182946 <rdar://problem/37690039> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::willBeDestroyed): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnRemoval): * rendering/updating/RenderTreeBuilderFirstLetter.h: 2018-02-21 Ms2ger <Ms2ger@igalia.com> [GCrypt] Remove unsound assertion from CryptoKeyRSA::exportData(). https://bugs.webkit.org/show_bug.cgi?id=183001 Reviewed by Philippe Normand. This function is called from structured cloning, in particular when storing a key in IndexedDB. This would trip the assertion if the key in question is non-exportable. The assertion was copied from the macOS implementation in r172389; it was subsequently removed there in r172898 to handle this case. Test: crypto/subtle/rsa-indexeddb-non-exportable.html * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: (WebCore::CryptoKeyRSA::exportData const): remove assertion. 2018-02-21 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Make system-ui obey the user-installed-font policy https://bugs.webkit.org/show_bug.cgi?id=182860 <rdar://problem/36158249> Reviewed by Antti Koivisto. We have a completely different codepath for system-ui which makes it follow the system's font cascade list. This codepath (along with all the other relevant places which create system fonts) needs to obey the AllowUserInstalledFonts enum. This patch is fairly mechanical; we simply are hooking up the flag across SystemFontDatabase. There are a few places which creates system fonts which this patch doesn't touch. This is not a problem because all the remaining places either: 1) Simply pull out some attributes of the font (name, weight, size, etc.) and then throw away the font object itself, or 2) Use the font in an environment where script cannot access the characters rendered (such as DragImages or the fullscreen placeholder view or the inside of the attachment element). Test: fast/text/user-installed-fonts/system-ui.html * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::fontForPostScriptName): (WebCore::fontWithFamily): (WebCore::installedFontMandatoryAttributes): (WebCore::createSpecificFontForInstalledFonts): * platform/graphics/cocoa/FontCacheCoreText.h: * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator== const): (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash const): (WebCore::SystemFontDatabase::systemFontCascadeList): (WebCore::SystemFontDatabase::removeCascadeList): (WebCore::SystemFontDatabase::computeCascadeList): (WebCore::systemFontParameters): (WebCore::systemFontCascadeList): (WebCore::FontCascadeDescription::effectiveFamilyCount const): (WebCore::FontCascadeDescription::effectiveFamilyAt const): * platform/graphics/ios/FontCacheIOS.mm: (WebCore::platformFontWithFamilySpecialCase): * platform/graphics/mac/FontCacheMac.mm: (WebCore::platformFontWithFamilySpecialCase): 2018-02-21 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix build after r228867. * Modules/webvr/VRStageParameters.cpp: 2018-02-21 Philippe Normand <pnormand@igalia.com> [GStreamer] Rewrite purgeInvalid*Tracks methods https://bugs.webkit.org/show_bug.cgi?id=183004 Reviewed by Carlos Garcia Campos. Removing items from a hashmap while iterating is bad. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Safely remove items from the hashmap using removeIf(). (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto. (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto. 2018-02-21 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix build after r228867. * Modules/webvr/VRStageParameters.cpp: 2018-02-21 Philippe Normand <pnormand@igalia.com> [GStreamer] Crash in Debug build when purging invalid tracks https://bugs.webkit.org/show_bug.cgi?id=182997 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Clear the hashmap when there is no valid track left. (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto. (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto. * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::getLanguageCode): Demote debugging, this appears too much at least with playbin2. (WebCore::TrackPrivateBaseGStreamer::getTag): Ditto. 2018-02-21 Philippe Normand <pnormand@igalia.com> [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1 https://bugs.webkit.org/show_bug.cgi?id=182996 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Adopt references when running with GStreamer 1.13.1 to avoid memory leaks. 2018-02-20 Philippe Normand <pnormand@igalia.com> [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html failing since r228617 https://bugs.webkit.org/show_bug.cgi?id=160131 <rdar://problem/35873985> Reviewed by Michael Catanzaro. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): We can't assume the pad has a sticky event here like implemented in InbandTextTrackPrivateGStreamer because it might be emitted after the track was created. So fallback to a dummy stream ID like in the Audio and Video tracks. 2018-02-20 Sergio Villar Senin <svillar@igalia.com> [WebVR][OpenVR] Retrieve stage parameters https://bugs.webkit.org/show_bug.cgi?id=182976 Reviewed by Žan Doberšek. Use OpenVR to retrieve stage parameters, i.e., play area size and the transformation from sitting to standing position. It includes the same fallback used by Firefox to provide sensible values in case we cannot get the required information from the VR SDK (it's quite common not to have defined a play area). * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::stageParameters const): * Modules/webvr/VRDisplay.h: * Modules/webvr/VRStageParameters.cpp: (WebCore::VRStageParameters::VRStageParameters): (WebCore::VRStageParameters::sittingToStandingTransform const): (WebCore::VRStageParameters::sizeX const): (WebCore::VRStageParameters::sizeZ const): * Modules/webvr/VRStageParameters.h: (WebCore::VRStageParameters::create): * platform/vr/VRPlatformDisplay.h: * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR): (WebCore::VRPlatformDisplayOpenVR::updateStageParameters): * platform/vr/openvr/VRPlatformDisplayOpenVR.h: 2018-02-21 Philippe Normand <pnormand@igalia.com> [GStreamer] Create a Wayland GL display instead of EGL https://bugs.webkit.org/show_bug.cgi?id=182968 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Add logging and instantiate a GstDisplayWayland display instead of an EGL display when running under a Wayland compositor. 2018-02-21 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderFullScreen::willBeRemoved() mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182947 <rdar://problem/37690848> Reviewed by Antti Koivisto. No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::willBeDestroyed): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::fullScreenBuilder): * rendering/updating/RenderTreeBuilderFullScreen.cpp: Added. (WebCore::RenderTreeBuilder::FullScreen::FullScreen): (WebCore::RenderTreeBuilder::FullScreen::cleanupOnRemoval): * rendering/updating/RenderTreeBuilderFullScreen.h: Added. * rendering/updating/RenderTreeBuilderMathML.cpp: 2018-02-20 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderListItem::willBeRemoved() mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182943 <rdar://problem/37689029> Reviewed by Antti Koivisto. We don't need to destroy the marker in RenderListItem::willBeRemoved(), because it gets deleted in RenderTreeBuilder::removeAndDestroy() together with RenderListItem (as long as the marker is the RenderListItem's descendent). Covered by existing tests. * rendering/RenderListItem.cpp: (WebCore::RenderListItem::~RenderListItem): (WebCore::RenderListItem::willBeDestroyed): Deleted. * rendering/RenderListItem.h: 2018-02-20 Nan Wang <n_wang@apple.com> AX: Keyboard focus not following VoiceOver cursor into web content or within web content. https://bugs.webkit.org/show_bug.cgi?id=182752 <rdar://problem/37518233> Reviewed by Ryosuke Niwa. Call the assistive technology specific method for becoming first responder. Test: accessibility/mac/accessibility-make-first-responder.html * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]): * page/ChromeClient.h: 2018-02-20 Tim Horton <timothy_horton@apple.com> Introduce HAVE(IOSURFACE_ACCELERATOR) https://bugs.webkit.org/show_bug.cgi?id=182955 <rdar://problem/37699510> Reviewed by Sam Weinig. No new tests, no change in behavior. Introduce HAVE(IOSURFACE_ACCELERATOR) and guard all uses of IOSurfaceAccelerator behind it. Rename USE(IOSURFACE) to HAVE(IOSURFACE) for accuracy. * page/cocoa/MemoryReleaseCocoa.mm: * platform/graphics/ca/TileController.cpp: * platform/graphics/cg/IOSurfacePool.cpp: * platform/graphics/cg/IOSurfacePool.h: * platform/graphics/cg/ImageBufferCG.cpp: * platform/graphics/cocoa/IOSurface.h: * platform/graphics/cocoa/IOSurface.mm: * platform/graphics/cocoa/IOSurfacePoolCocoa.mm: * platform/graphics/cv/VideoTextureCopierCV.cpp: * platform/graphics/cv/VideoTextureCopierCV.h: 2018-02-20 Chris Dumez <cdumez@apple.com> Provisional load may get committed before receiving the decidePolicyForNavigationResponse response https://bugs.webkit.org/show_bug.cgi?id=182720 <rdar://problem/37515204> Reviewed by Alex Christensen. Wait for the policy response from the client after receiving a resource response, before sending the NetworkResourceLoader::ContinueDidReceiveResponse IPC back to the NetworkProcess. Otherwise, the network process may start sending us data and we may end up committing the provisional load before receiving the policy decision fron the client. Change is covered by new API test. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): * loader/NetscapePlugInStreamLoader.cpp: (WebCore::NetscapePlugInStreamLoader::didReceiveResponse): * loader/NetscapePlugInStreamLoader.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::deliverResponseAndData): (WebCore::ResourceLoader::loadDataURL): (WebCore::ResourceLoader::didReceiveResponse): (WebCore::ResourceLoader::didReceiveResponseAsync): * loader/ResourceLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveResponse): (WebCore::SubresourceLoader::didReceiveResponsePolicy): (WebCore::SubresourceLoader::willCancel): * loader/SubresourceLoader.h: * loader/ios/PreviewLoader.mm: (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): 2018-02-20 Chris Dumez <cdumez@apple.com> Crash under JSC::JSCell::toNumber(JSC::ExecState*) https://bugs.webkit.org/show_bug.cgi?id=182984 <rdar://problem/37694346> Reviewed by Mark Lam. The issue was caused by DOMMatrix attributes potentially returning "impure" NaN values. We would call JSC::jsNumber(double) to construct the JSValue but this is only safe for pure NaN values. Make sure we purify the double returned by the implementation for IDL attributes of type 'unrestricted double' before calling JSC::jsNumber(double). No new tests, extended existing test. * bindings/js/JSDOMConvertNumbers.h: (WebCore::JSConverter<IDLUnrestrictedDouble>::convert): * testing/TypeConversions.h: (WebCore::TypeConversions::testImpureNaNUnrestrictedDouble const): (WebCore::TypeConversions::testImpureNaN2UnrestrictedDouble const): (WebCore::TypeConversions::testQuietNaNUnrestrictedDouble const): * testing/TypeConversions.idl: 2018-02-20 Tim Horton <timothy_horton@apple.com> Make more use of USE(OPENGL_ES) where it makes sense https://bugs.webkit.org/show_bug.cgi?id=182957 <rdar://problem/37699443> Reviewed by Dan Bernstein. No new tests, no behavior change. Make use of USE(OPENGL_ES) for CoreVideo functions that differ based on GL availability. Also adjust GraphicsContext3D in the same way. * platform/cocoa/CoreVideoSoftLink.cpp: * platform/cocoa/CoreVideoSoftLink.h: * platform/graphics/GraphicsContext3D.h: * platform/graphics/cv/TextureCacheCV.mm: (WebCore::TextureCacheCV::create): (WebCore::TextureCacheCV::textureFromImage): * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::enumToStringMap): (WebCore::VideoTextureCopierCV::initializeContextObjects): (WebCore::VideoTextureCopierCV::initializeUVContextObjects): (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): 2018-02-20 Nan Wang <n_wang@apple.com> AX: AOM: Dispatch accessibleclick event https://bugs.webkit.org/show_bug.cgi?id=180898 <rdar://problem/36086710> Reviewed by Ryosuke Niwa. Accessibility events. Spec: https://wicg.github.io/aom/spec/phase2.html This patch allows developers to register event handlers on Elements for custom accessibility events. Accessibility events go through a capturing and bubbling phase just like DOM events, but in the accessibility tree. Implemented "accessibleclick" event. Test: accessibility/mac/AOM-events.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::press): (WebCore::AccessibilityObject::dispatchAccessibilityEvent): * accessibility/AccessibilityObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]): * dom/Element.idl: * dom/EventDispatcher.cpp: (WebCore::dispatchEventWithType): (WebCore::EventDispatcher::dispatchEvent): * dom/EventDispatcher.h: * dom/EventNames.h: * dom/EventPath.cpp: (WebCore::EventPath::EventPath): * dom/EventPath.h: 2018-02-20 Wenson Hsieh <wenson_hsieh@apple.com> [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app https://bugs.webkit.org/show_bug.cgi?id=182952 <rdar://problem/37636190> Reviewed by Tim Horton. After r220865 refactored the iOS copy codepaths to use NSItemProviders, we stopped writing the URL as plain text to the pasteboard. However, this means clients that only check for "text/plain" (or one of its aliases) on the pasteboard won't read any data on paste. To fix this, we restore the pre-iOS 11.3 behavior of writing both the URL and plain text to the pasteboard. Since we're using item providers, we also ensure that the NSURL is at a higher fidelity than the string to make it clear that the data should be consumed as a URL. This patch also rebaselines an existing drag and drop test to cover this change, and adds a new API test, ActionSheetTests.CopyLinkWritesURLAndPlainText, which simulates copying a link using the share sheet and pasting into a DataTransfer-dumping test harness. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): 2018-02-20 Eric Carlson <eric.carlson@apple.com> [iOS] Returning from Auto-PiP causes Safari to be unresponsive https://bugs.webkit.org/show_bug.cgi?id=182977 <rdar://problem/37685981> Reviewed by Jer Noble. Remove the error handling added in r228115, it breaks auto-pip. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive): (VideoFullscreenInterfaceAVKit::enterFullscreenStandard): (VideoFullscreenInterfaceAVKit::exitFullscreen): (VideoFullscreenInterfaceAVKit::cleanupFullscreen): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler): (VideoFullscreenInterfaceAVKit::exitFullscreenHandler): (VideoFullscreenInterfaceAVKit::enterFullscreenHandler): 2018-02-20 Jer Noble <jer.noble@apple.com> [EME] Adopt new AVContentKeySession success delegate callback https://bugs.webkit.org/show_bug.cgi?id=182974 <rdar://problem/36079035> Reviewed by Eric Carlson. Store the updateLicenseCallback if the new protocol method is present and supported. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequestDidSucceed:]): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed): 2018-02-19 Dean Jackson <dino@apple.com> Handle all writing-modes in downcast https://bugs.webkit.org/show_bug.cgi?id=182949 <rdar://problem/37710687> Reviewed by Myles Maxfield. It appears we forgot to handle the deprecated "lr" writing-mode value. Test: fast/writing-mode/svg-writing-modes.html * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator WritingMode const): 2018-02-20 Zan Dobersek <zdobersek@igalia.com> [Cairo] Drop target GraphicsContext usage in Cairo operations https://bugs.webkit.org/show_bug.cgi?id=182964 Reviewed by Carlos Garcia Campos. The GraphicsContext parameters in various Cairo operations are not used anymore, so they can be removed. Callsites are updated to reflect this. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawShadowLayerBuffer): (WebCore::Cairo::fillShadowBuffer): (WebCore::Cairo::drawPathShadow): (WebCore::Cairo::drawGlyphsShadow): (WebCore::Cairo::fillRect): (WebCore::Cairo::fillRoundedRect): (WebCore::Cairo::fillRectWithRoundedHole): (WebCore::Cairo::fillPath): (WebCore::Cairo::strokeRect): (WebCore::Cairo::strokePath): (WebCore::Cairo::drawGlyphs): (WebCore::Cairo::drawNativeImage): (WebCore::Cairo::drawSurface): * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/FontCairo.cpp: (WebCore::FontCascade::drawGlyphs): * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::drawNativeImage): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::fillRect): (WebCore::GraphicsContext::strokeRect): (WebCore::GraphicsContext::platformFillRoundedRect): (WebCore::GraphicsContext::fillRectWithRoundedHole): * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::GraphicsContextImplCairo::fillRect): (WebCore::GraphicsContextImplCairo::fillRoundedRect): (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole): (WebCore::GraphicsContextImplCairo::fillPath): (WebCore::GraphicsContextImplCairo::strokeRect): (WebCore::GraphicsContextImplCairo::strokePath): (WebCore::GraphicsContextImplCairo::drawGlyphs): (WebCore::GraphicsContextImplCairo::drawNativeImage): * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame): 2018-02-20 Sergio Villar Senin <svillar@igalia.com> [WebVR][OpenVR] Retrieve eye parameters and field of view https://bugs.webkit.org/show_bug.cgi?id=182962 Reviewed by Žan Doberšek. Get the required data from OpenVR to fill in the VREyeParameters and the VRFieldOfView objects. * Modules/webvr/VRDisplay.cpp: Create some attributes in the body of the constructor instead in the member initialization list to avoid calling getDisplayInfo() multiple times. (WebCore::VRDisplay::VRDisplay): (WebCore::VRDisplay::capabilities const): (WebCore::VRDisplay::getEyeParameters const): * Modules/webvr/VRDisplay.h: * Modules/webvr/VREyeParameters.cpp: (WebCore::VREyeParameters::VREyeParameters): Added new attributes to the constructor. (WebCore::VREyeParameters::offset const): Return a Ref instead of a raw pointer. (WebCore::VREyeParameters::renderWidth const): (WebCore::VREyeParameters::renderHeight const): * Modules/webvr/VREyeParameters.h: (WebCore::VREyeParameters::create): * Modules/webvr/VRFieldOfView.cpp: Removed. All the impletementation fits perfectly in the header file. * Modules/webvr/VRFieldOfView.h: (WebCore::VRFieldOfView::create): (WebCore::VRFieldOfView::upDegrees const): (WebCore::VRFieldOfView::rightDegrees const): (WebCore::VRFieldOfView::downDegrees const): (WebCore::VRFieldOfView::leftDegrees const): (WebCore::VRFieldOfView::VRFieldOfView): * Sources.txt: * platform/vr/VRPlatformDisplay.h: Added some more data to the VRPlatformDisplayInfo struct. * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR): (WebCore::VRPlatformDisplayOpenVR::computeFieldOfView): Computes the up/down/left/right FOV angles in degrees from the raw project values returned by OpenVR. (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters): Fills in the eye parameter info. (WebCore::VRPlatformDisplayOpenVR::~VRPlatformDisplayOpenVR): * platform/vr/openvr/VRPlatformDisplayOpenVR.h: 2018-02-20 Philippe Normand <pnormand@igalia.com> [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser https://bugs.webkit.org/show_bug.cgi?id=173655 Reviewed by Xabier Rodriguez-Calvar. The FIXME in GStreamerUtilities.cpp asks to pass the command line parameters to the GStreamer initialization function. Based on initial patch by: Vanessa Chipirrás Navalón <vchipirras@igalia.com> * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::constructCommon): Removes the call to the method that GStreamer initializes. It is no longer necessary. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer. * platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains GStreamer options as the input parameter of the initializeGStreamer() method. 2018-02-20 Miguel Gomez <magomez@igalia.com> [GTK] whatsapp web blurry in some parts, sharp on others https://bugs.webkit.org/show_bug.cgi?id=182673 Reviewed by Carlos Garcia Campos. CoordinatedGraphicsLayer::createBackingStore() uses the scale factor returned by effectiveContentsScale(), which is always 1 if selfOrAncestorHaveNonAffineTransforms() returns true. But this fuction always returns true if the layer has an AnimatedPropertyTransform animation, which means that layers with those animations won't use the appropriate scale factor, causing blurry renderings. This patch removes the animations check, so animated layers properly use the required scale factor. No new tests, no behavior change. * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms): 2018-02-20 Zan Dobersek <zdobersek@igalia.com> [Cairo] Leverage ShadowBlur without using scratch buffer, target GraphicsContext https://bugs.webkit.org/show_bug.cgi?id=182958 Reviewed by Carlos Garcia Campos. To allow ShadowBlur usage in different threads, avoid the ShadowBlur class using the scratch buffer internally. The current implementation of that scratch buffer is not thread-safe and its usage in such conditions can lead to crashes. Instead, the new methods use a temporary ImageBuffer object for drawing. This does negate the efficiency of possibly reusing the scratch buffer, but at this point that is not yet the priority. This only affects ports using Cairo for drawing. The added methods don't require a target GraphicsContext object to be passed in, instead they accept buffer draw callbacks that are invoked with the temporary ImageBuffer object containing the rasterized shadow, as well as position and size parameters. The CTM and clip bounds values also have to be passed in manually. In CairoOperations.cpp, the provided callbacks invoke commands that are equivalent in effect to those that would otherwise be invoked on the target GraphicsContext object in the ShadowBlur class. For now, this approach has to avoid the tiling-based drawing of the rectangular shadows in drawRectShadow() and inset shadows in drawInsetShadow(), and instead stick to the non-tiling fallback. While only affecting Cairo-using ports, with some refactoring it should be possible to again leverage the tiling-based approach as well. The beginShadowLayer() and endShadowLayer() functions, which are only used in CairoOperations.cpp, are replaced with the drawShadowLayer() method. This one accepts an additional callback that allows the caller to explicitly draw the shadow shape using the provided shadowing GraphicsContext object. As with the other two new methods, a temporary ImageBuffer object is used, and the buffer draw callback is invoked to allow caller to properly handle the shadowing output. In CairoOperations.cpp, the new ShadowBlur methods are exercised, with direct Cairo operation invocation replacing the GraphicsContext calls otherwise done through ShadowBlur. ShadowState object now also has to track the global alpha and the global composite operator values so that it can properly rasterize the resulting shadow into the final image. No new tests -- no change in behavior. * platform/graphics/ShadowBlur.cpp: (WebCore::ShadowBlur::adjustBlurRadius): (WebCore::ShadowBlur::calculateLayerBoundingRect): (WebCore::ShadowBlur::drawRectShadow): (WebCore::ShadowBlur::drawInsetShadow): (WebCore::ShadowBlur::drawShadowLayer): (WebCore::ShadowBlur::beginShadowLayer): Deleted. (WebCore::ShadowBlur::endShadowLayer): Deleted. * platform/graphics/ShadowBlur.h: * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawShadowLayerBuffer): (WebCore::Cairo::fillShadowBuffer): (WebCore::Cairo::drawPathShadow): (WebCore::Cairo::drawGlyphsShadow): (WebCore::Cairo::ShadowState::ShadowState): (WebCore::Cairo::fillRect): (WebCore::Cairo::fillRoundedRect): (WebCore::Cairo::fillRectWithRoundedHole): (WebCore::Cairo::drawSurface): * platform/graphics/cairo/CairoOperations.h: Default-initialize FillSource::fillRule to RULE_NONZERO. * platform/graphics/cairo/PlatformContextCairo.h: Drop the ShadowBlur.h include, it's moved to CairoOperations.cpp. * rendering/RenderThemeGtk.cpp: Explicitly include the FloatRoundedRect.h header now that it's not included through the ShadowBlur.h header via PlatformContextCairo.h. 2018-02-20 Sergio Villar Senin <svillar@igalia.com> [WebVR] Use RuntimeEnabledFeatures to enable/disable WebVR https://bugs.webkit.org/show_bug.cgi?id=182961 Reviewed by Xabier Rodriguez-Calvar. The shared feature was properly added to RuntimeEnabledFeatures some time ago but the code was instead using a private method in NavigatorWebVR to temporarily disable it. WebVR is enabled in WebPreferences.yaml for GTK+ & WPE as default experimental feature. * Modules/webvr/NavigatorWebVR.cpp: (WebCore::NavigatorWebVR::getVRDisplays): (WebCore::NavigatorWebVR::vrEnabled): Deleted. 2018-02-19 Antti Koivisto <antti@apple.com> Use selector filter when invalidating descendants https://bugs.webkit.org/show_bug.cgi?id=182839 <rdar://problem/37581072> Reviewed by Zalan Bujtas. We can make descendant invalidation faster by enabling filtering. * css/SelectorFilter.cpp: (WebCore::SelectorFilter::initializeParentStack): Traverse and reverse the ancestor chain, and push it. (WebCore::SelectorFilter::pushParent): (WebCore::SelectorFilter::pushParentInitializingIfNeeded): Add a version of pushParent that can initialize the stack. (WebCore::SelectorFilter::popParent): (WebCore::SelectorFilter::popParentsUntil): Pop until a given parent element. (WebCore::SelectorFilter::pushParentStackFrame): Deleted. (WebCore::SelectorFilter::popParentStackFrame): Deleted. These were the same as push/popParent. * css/SelectorFilter.h: (WebCore::SelectorFilter::popParent): Deleted. * style/StyleInvalidator.cpp: (WebCore::Style::Invalidator::invalidateStyleForDescendants): Use pushParentInitializingIfNeeded. (WebCore::Style::Invalidator::invalidateStyleWithMatchElement): Use selector filter when doing descendant tree invalidation. Make sure to pop it until the parent when reusing. 2018-02-19 Fujii Hironori <Hironori.Fujii@sony.com> null m_lastNodeInserted dereference at ReplaceSelectionCommand::InsertedNodes::lastLeafInserted https://bugs.webkit.org/show_bug.cgi?id=161947 Reviewed by Ryosuke Niwa. InsertedNodes happened to be empty if the inserted nodes were removed. Add more checks if InsertedNodes is empty. No new tests (Covered by existing tests). * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply): Return early if InsertedNodes becomes empty. * editing/ReplaceSelectionCommand.h: (WebCore::ReplaceSelectionCommand::InsertedNodes::isEmpty): New method. (WebCore::ReplaceSelectionCommand::InsertedNodes::lastLeafInserted const): Assert m_lastNodeInserted is not null. (WebCore::ReplaceSelectionCommand::InsertedNodes::pastLastLeaf const): Ditto. 2018-02-19 Said Abou-Hallawa <sabouhallawa@apple.com> Add SVGPropertyTraits::fromString() to all the SVG animated types https://bugs.webkit.org/show_bug.cgi?id=182901 Reviewed by Dean Jackson. This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits methods inside the template functions. * WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits from SVGMarkerElement.h to SVGMarkerTypes.h. * svg/SVGAngle.h: (WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method. * svg/SVGAngleValue.h: * svg/SVGAnimateMotionElement.cpp: (WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp * svg/SVGAnimatedAngle.cpp: (WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString(). * svg/SVGAnimatedBoolean.cpp: (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto. * svg/SVGAnimatedColor.cpp: (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto. (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const. (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto. * svg/SVGAnimatedEnumeration.cpp: (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto. * svg/SVGAnimatedInteger.cpp: (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto. * svg/SVGAnimatedIntegerOptionalInteger.cpp: (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto. * svg/SVGAnimatedLength.cpp: * svg/SVGAnimatedLengthList.cpp: (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto. * svg/SVGAnimatedNumber.cpp: (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto (WebCore::parseNumberFromString): * svg/SVGAnimatedNumberList.cpp: (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto. * svg/SVGAnimatedNumberOptionalNumber.cpp: (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto. * svg/SVGAnimatedPath.cpp: (WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto. * svg/SVGAnimatedPointList.cpp: (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto. * svg/SVGAnimatedPreserveAspectRatio.cpp: (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto. * svg/SVGAnimatedRect.cpp: (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto. * svg/SVGAnimatedString.cpp: (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto. * svg/SVGAnimatedTransformList.cpp: (WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto. * svg/SVGLength.h: (WebCore::SVGLength::SVGLength): Delete unused constructor and create() method. * svg/SVGLengthListValues.h: (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method. (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto. * svg/SVGMarkerElement.h: (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted. (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted. (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted. (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted. (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted. (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted. * svg/SVGMarkerTypes.h: Added. (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): * svg/SVGMatrix.h: Delete unused constructor and create method. * svg/SVGNumber.h: (WebCore::SVGNumber::SVGNumber): Ditto. * svg/SVGNumberListValues.h: (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method. * svg/SVGParserUtilities.cpp: (WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp * svg/SVGParserUtilities.h: * svg/SVGPathByteStream.h: (WebCore::SVGPathByteStream::SVGPathByteStream): (WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators. (WebCore::SVGPathByteStream::copy const): Use the copy assignment. (WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty(). (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method. (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto. * svg/SVGPathUtilities.cpp: (WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844. * svg/SVGPoint.h: (WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method. * svg/SVGPointListValues.h: (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method. * svg/SVGPolyElement.cpp: (WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator. * svg/SVGPreserveAspectRatio.h: (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method. * svg/SVGPreserveAspectRatioValue.cpp: (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor. * svg/SVGPreserveAspectRatioValue.h: (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method. (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto. * svg/SVGRect.h: (WebCore::SVGRect::SVGRect): Delete unused constructor and create method. * svg/SVGRectTraits.h: Removed. * svg/SVGTransform.h: (WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method. * svg/SVGTransformListValues.h: (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method. * svg/properties/SVGPropertyTearOff.h: Delete unused create method. * svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods. (WebCore::SVGPropertyTraits<bool>::fromString): (WebCore::SVGPropertyTraits<Color>::initialValue): (WebCore::SVGPropertyTraits<Color>::fromString): (WebCore::SVGPropertyTraits<Color>::parse): (WebCore::SVGPropertyTraits<Color>::toString): (WebCore::SVGPropertyTraits<int>::fromString): (WebCore::SVGPropertyTraits<float>::fromString): (WebCore::SVGPropertyTraits<float>::parse): (WebCore::SVGPropertyTraits<FloatPoint>::initialValue): (WebCore::SVGPropertyTraits<FloatPoint>::fromString): (WebCore::SVGPropertyTraits<FloatPoint>::parse): (WebCore::SVGPropertyTraits<FloatPoint>::toString): (WebCore::SVGPropertyTraits<FloatRect>::initialValue): (WebCore::SVGPropertyTraits<FloatRect>::fromString): (WebCore::SVGPropertyTraits<FloatRect>::parse): (WebCore::SVGPropertyTraits<FloatRect>::toString): (WebCore::SVGPropertyTraits<String>::fromString): (WebCore::SVGPropertyTraits<String>::parse): (WebCore::SVGPropertyTraits<String>::toString): 2018-02-19 Antoine Quint <graouts@apple.com> [Modern Media Controls] Implement a compact set of media controls https://bugs.webkit.org/show_bug.cgi?id=182937 <rdar://problem/37682257> Reviewed by Eric Carlson. We add a new type of media controls used when we need stripped down and compact controls. The new CompactMediaControls only show a play/pause button and an invalid placard and disregard all media events that are not relevant to the display of these controls. To distinguish cases where we need to show compact media controls, we expose a new property on MediaControlsHost called "compactMode". Tests: media/modern-media-controls/compact-media-controls/compact-media-controls-constructor.html media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html * Modules/mediacontrols/MediaControlsHost.cpp: (WebCore::MediaControlsHost::base64StringForIconNameAndType const): (WebCore::MediaControlsHost::compactMode const): * Modules/mediacontrols/MediaControlsHost.h: (WebCore::MediaControlsHost::setSimulateCompactMode): * Modules/mediacontrols/MediaControlsHost.idl: * Modules/modern-media-controls/controls/compact-media-controls.js: Added. (CompactMediaControls.prototype.get scaleFactor): (CompactMediaControls.prototype.set scaleFactor): (CompactMediaControls.prototype.get shouldCenterControlsVertically): (CompactMediaControls.prototype.set shouldCenterControlsVertically): (CompactMediaControls.prototype.get placard): (CompactMediaControls.prototype.set placard): (CompactMediaControls.prototype.layout): (CompactMediaControls.prototype.commitProperty): * Modules/modern-media-controls/controls/icon-service.js: (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconAndLayoutTraits): (const.iconService.new.IconService): * Modules/modern-media-controls/controls/inline-media-controls.js: * Modules/modern-media-controls/controls/layout-item.js: * Modules/modern-media-controls/js-files: * Modules/modern-media-controls/main.js: * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype.get layoutTraits): (MediaController.prototype._supportingObjectClasses): Compute the set of MediaControllerSupport classes based on the layout traits such that in compact mode we only return PlacardSupport and PlaybackSupport. (MediaController.prototype._updateControlsIfNeeded): (MediaController.prototype._controlsClassForLayoutTraits): (MediaController.prototype._shouldControlsBeAvailable): * Modules/modern-media-controls/media/placard-support.js: (PlacardSupport.prototype.get mediaEvents): Only track the "error" event in compact mode since this is the only relevant placard. * Modules/modern-media-controls/media/playback-support.js: (PlaybackSupport.prototype.syncControl): Only show or hide the play/pause button based on the playback state when in compact mode. (PlaybackSupport): * WebCore.xcodeproj/project.pbxproj: 2018-02-19 Antoine Quint <graouts@apple.com> [Web Animations] Make KeyframeEffect target nullable and read-write https://bugs.webkit.org/show_bug.cgi?id=182741 Reviewed by Dean Jackson. We used to completely disregard null targets, for instance not parsing keyframes, but targets can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL for KeyframeEffect to mark the target property as read-write and update the implementation to correctly handle null targets. This revealed a few issues in our implementation by allowing more WPT tests to run. So we also ensure that: - we don't crash when parsing font-related properties by calling update() on the generated RenderStyle's FontCascade when parsing keyframes. - CSS properties are provided as camel-case and not as hyphenated form - values provided in keyframes dictionaries are only read for valid properties - styles for effect targets are invalidated as soon as the timing model for that animation is changed * animation/KeyframeEffect.idl: * animation/KeyframeEffectReadOnly.cpp: (WebCore::invalidateElement): Add a new utility method to invalidate a given element since we may want to invalidate not only the current target (m_target) but also a previous target. (WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName so that it can call that function. We also check that we reject CSS properties that are not provided in camel-case form (eg. "font-size" vs. "fontSize"). (WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name maps to a valid CSS property. (WebCore::KeyframeEffectReadOnly::processKeyframes): Allow keyframes to be processed even if the effect's target is null. (WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and invalidate the style of the new target and the old targets, if any. We also update the blending keyframes since this task may not have been completed in a previous call to processKeyframes() due to the target being null at that time. (WebCore::KeyframeEffectReadOnly::invalidate): Use the invalidateElement() utility. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget() to inform the animation of the previous effect target and the new one upon a target change. This allows us to forward this information onto the timeline so that we correctly add or remove the targets from the list of animated elements. * animation/WebAnimation.h: 2018-02-19 Chris Dumez <cdumez@apple.com> Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType() https://bugs.webkit.org/show_bug.cgi?id=182927 <rdar://problem/37675748> Reviewed by Antti Koivisto. Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread. It is currently being called from a background thread in the following places: - ServiceWorkerJob::didReceiveResponse() - WorkerGlobalScope::importScripts() These call sites on non-main threads were added recently with the support for service workers. No new tests, already covered by existing tests that flakily experience service worker process crashes. * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType): 2018-02-19 Dean Jackson <dino@apple.com> SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45 https://bugs.webkit.org/show_bug.cgi?id=182944 <rdar://problem/35369984> Reviewed by Myles Maxfield. Avoid a divide-by-zero. Test: svg/text/font-bad-unitsperem.html * svg/SVGFontFaceElement.cpp: (WebCore::SVGFontFaceElement::unitsPerEm const): 2018-02-19 Tim Horton <timothy_horton@apple.com> REGRESSION (r219342): Touch event coordinates and elementFromPoint coordinates differ https://bugs.webkit.org/show_bug.cgi?id=182910 <rdar://problem/37533950> Reviewed by Simon Fraser. We reverted other changes to the definition of client coordinates in r219829 due to compatibility concerns. However, we failed to revert r219342 on trunk, leaving elementFromPoint() using coordinates relative to the layout viewport. Add a currently off-by-default setting to switch on layout-viewport-relative client coordinates and guard the elementFromPoint changes behind it. A future patch should roll r219829 back in also behind this setting, so that everything remains consistent regardless of which coordinate space we choose. * dom/TreeScope.cpp: (WebCore::absolutePointIfNotClipped): * page/Settings.yaml: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::hitTest): 2018-02-19 Eric Carlson <eric.carlson@apple.com> [Extra zoom mode] Don't allow PiP media playback https://bugs.webkit.org/show_bug.cgi?id=182930 <rdar://problem/37676259> Reviewed by Andy Estes. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled: if it isn't implemented. (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto. 2018-02-19 Antoine Quint <graouts@apple.com> [Web Animations] Decouple parsing JS keyframes and computing blending keyframes https://bugs.webkit.org/show_bug.cgi?id=182939 <rdar://problem/37678364> Reviewed by Dean Jackson. Move all the code used to create the KeyframeList into a dedicated updateBlendingKeyframes() method. No new tests since this code change has no user-visible impact. * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::processKeyframes): (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes): * animation/KeyframeEffectReadOnly.h: 2018-02-19 Jer Noble <jer.noble@apple.com> [EME] Add mechanism for MediaKeySession to react to HDCP changes https://bugs.webkit.org/show_bug.cgi?id=182935 Reviewed by Eric Carlson. Add a client callback interface to CDMInterface to allow subclasses to communicate up to MediaKeySEssion. Add a virtual method to CDMInterface to allow it to be notified of HDCP status changes. Override this method in CDMInstanceFairPlayStreamingAVFObjC. Hook up the outputObscuredDueToInsufficientExternalProtectionChanged() methods in both MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC to this new CDMInstance method. Add an Internals method to simulate an HDCP error for testing purposes. * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::MediaKeySession): (WebCore::MediaKeySession::~MediaKeySession): (WebCore::MediaKeySession::updateKeyStatuses): * Modules/encryptedmedia/MediaKeySession.h: * platform/encryptedmedia/CDMInstance.h: (WebCore::CDMInstance::setHDCPStatus): (WebCore::CDMInstance::setClient): (WebCore::CDMInstance::clearClient): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::beginSimulatedHDCPError): (WebCore::MediaPlayer::endSimulatedHDCPError): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::beginSimulatedHDCPError): (WebCore::MediaPlayerPrivateInterface::endSimulatedHDCPError): * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::outputObscuredDueToInsufficientExternalProtectionChanged): (WebCore::playerKVOProperties): (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]): (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged): * testing/Internals.cpp: (WebCore::Internals::beginSimulatedHDCPError): (WebCore::Internals::endSimulatedHDCPError): * testing/Internals.h: * testing/Internals.idl: 2018-02-19 Chris Dumez <cdumez@apple.com> CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::TimerBase::~TimerBase https://bugs.webkit.org/show_bug.cgi?id=182931 <rdar://problem/37602962> Reviewed by Antti Koivisto. Make sure PlatformMediaResource is ThreadSafeRefCounted since it is being used from several threads in WebCoreNSURLSession. Also make sure it is always destroyed on the main thread since it ends up destroying a CachedRawResource object. No new tests, no known reproduction case. * platform/graphics/PlatformMediaResourceLoader.h: * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSessionDataTask dealloc]): 2018-02-19 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Rename RenderTreeBuilder::removeAndDestroyChild() -> removeAndDestroy() https://bugs.webkit.org/show_bug.cgi?id=182934 <rdar://problem/37678241> Reviewed by Antti Koivisto. No change in functionality. * dom/Document.cpp: (WebCore::Document::setFullScreenRenderer): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): * rendering/RenderButton.cpp: (WebCore::RenderButton::setText): * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::willBeDestroyed): (WebCore::RenderFullScreen::unwrapRenderer): * rendering/RenderListItem.cpp: (WebCore::RenderListItem::willBeDestroyed): * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::willBeDestroyed): (WebCore::RenderTextFragment::setText): * rendering/RenderView.cpp: (WebCore::RenderView::willBeDestroyed): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::removeAndDestroy): (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): (WebCore::RenderTreeBuilder::removeAndDestroyChild): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::takeChild): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::updateStyle): (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): * rendering/updating/RenderTreeBuilderList.cpp: (WebCore::RenderTreeBuilder::List::updateItemMarker): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): (WebCore::RenderTreeBuilder::Ruby::takeChild): 2018-02-19 Daniel Bates <dabates@apple.com> Do not block authentication challenge to navigated resources https://bugs.webkit.org/show_bug.cgi?id=182807 <rdar://problem/37481619> Reviewed by Brent Fulgham. Blocking the main resource from asking for credentials depending on how it was navigated to could be confusing to a person and breaks web compatibility. Restore the behavior before r224134. * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::init): (WebCore::ResourceLoader::willSendRequestInternal): (WebCore::ResourceLoader::didBlockAuthenticationChallenge): (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const): (WebCore::ResourceLoader::isMixedContent const): Deleted. * loader/ResourceLoader.h: (WebCore::ResourceLoader::wasAuthenticationChallengeBlocked const): (WebCore::ResourceLoader::wasInsecureRequestSeen const): Deleted. 2018-02-17 Antoine Quint <graouts@apple.com> [Web Animations] Store all parsed keyframe input information in a single structure https://bugs.webkit.org/show_bug.cgi?id=182903 Reviewed by Dean Jackson. When parsing keyframe input provided through the JS API, we used to create several data structures. During parsing we would create a Vector<ProcessedKeyframe> where we would store the validated values for "offset", "easing" and "composite" as well as CSS properties and CSS values as strings. Then we would create a KeyframeList, a class that pre-dates the work on Web Animations and is used for hardware animations, with RenderStyle objects that are used for CSS property blending at runtime. Once the KeyframeList was created, the Vector<ProcessedKeyframe> was discarded. Since KeyframeList did not know about nullable offsets, timing functions and composite operations, and because we do not with to modify a legacy class that we will eventually remove once all the Web Animations work is complete, we also stored the parsed offsets as m_offsets, the timing functions as m_timingFunctions and the composite operations as m_compositeOperations. In this patch we rename the ProcessedKeyframe structure used temporarily during parsing to ParsedKeyframe and store both the input and processed data related to a given keyframe in that single structure which we keep around as m_parsedKeyframes when we finished processing the keyframes input. This update ParsedKeyframe structure allows to keep around the original nullable offsets, the original CSS properties and CSS values as strings as a HashMap<CSSPropertyID, String>, as well as the CSS properties and CSS values as CSSValue objects using a MutableStyleProperties object. This has the benefit of reducing the number of members, but also pave the way for supporting read-write targets where we will be able to decouple parsing keyframes and creating a KeyframeList, which requires a valid target to create RenderStyle objects used for blending, since the original parsing-time information is now stored. Finally, this allowed getKeyframes() to be more compliant by returning the CSS values as originally provided in the keyframe input with shorthand properties when provided, rather than the long-hands we used to read back through RenderStyle objects. The generated KeyframeList is now stored as m_blendingKeyframes and is only used for the purpose of interfacing with hardware animations and CSS property blending. While ProcessedKeyframe was copyable due to holding only simple types, ParsedKeyframe is not since it uses a Ref to hold the MutableStyleProperties. This uncovered some cases where we copied ProcessedKeyframe objects, we now ensure that the ParsedKeyframe objects are moved instead, which was the correct thing to do all along. * animation/KeyframeEffectReadOnly.cpp: (WebCore::computeMissingKeyframeOffsets): While we used to store std::optional<double> for the computed offset, we now store a simple double, which makes more sense since the computed offset is eventually a fully resolved value after calling computeMissingKeyframeOffsets(). So we now compute the final computed offset without resorting to intermediate nullable computed offsets. (WebCore::processIterableKeyframes): (WebCore::processPropertyIndexedKeyframes): (WebCore::KeyframeEffectReadOnly::KeyframeEffectReadOnly): (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource): (WebCore::KeyframeEffectReadOnly::getKeyframes): (WebCore::KeyframeEffectReadOnly::processKeyframes): (WebCore::KeyframeEffectReadOnly::computeStackingContextImpact): (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): (WebCore::KeyframeEffectReadOnly::getAnimatedStyle): (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): * animation/KeyframeEffectReadOnly.h: (WebCore::KeyframeEffectReadOnly::ParsedKeyframe::ParsedKeyframe): 2018-02-19 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Remove redundant RenderObject::removeFromParentAndDestroy https://bugs.webkit.org/show_bug.cgi?id=182926 <rdar://problem/37674997> Reviewed by Antti Koivisto. Call RenderTreeBuilder::removeAndDestroyChild() directly instead. No change in functionality. * dom/Document.cpp: (WebCore::Document::setFullScreenRenderer): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): * rendering/RenderButton.cpp: (WebCore::RenderButton::setText): * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::willBeDestroyed): (WebCore::RenderFullScreen::unwrapRenderer): * rendering/RenderListItem.cpp: (WebCore::RenderListItem::willBeDestroyed): * rendering/RenderObject.cpp: (WebCore::RenderObject::removeFromParentAndDestroy): Deleted. * rendering/RenderObject.h: * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::willBeDestroyed): (WebCore::RenderTextFragment::setText): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::takeChild): * rendering/updating/RenderTreeBuilderList.cpp: (WebCore::RenderTreeBuilder::List::updateItemMarker): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): (WebCore::RenderTreeBuilder::Ruby::takeChild): 2018-02-19 Tim Horton <timothy_horton@apple.com> Increase text autosizing constants for extra zoom mode https://bugs.webkit.org/show_bug.cgi?id=182919 <rdar://problem/37671259> Reviewed by Wenson Hsieh. * page/Settings.yaml: * page/SettingsBase.cpp: (WebCore::SettingsBase::defaultMinimumZoomFontSize): (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient): (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient): (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease): * page/SettingsBase.h: * rendering/RenderBlockFlow.cpp: (WebCore::oneLineTextMultiplier): (WebCore::textMultiplier): (WebCore::RenderBlockFlow::adjustComputedFontSizes): * rendering/TextAutoSizing.cpp: (WebCore::TextAutoSizingValue::adjustTextNodeSizes): Make autosizing constants settings, and change their default values. 2018-02-17 Antoine Quint <graouts@apple.com> [Web Animations] Accept null composite modes in keyframes https://bugs.webkit.org/show_bug.cgi?id=182902 Reviewed by Dean Jackson. The Web Animations spec used to specify that that composite modes should be non-null and instead not be provided when specifying keyframes, but now null values are accepted. We update the IDL input types used when parsing keyframes to allow for null values. We had already updated the getKeyframes() output in webkit.org/b/182600. * animation/KeyframeEffectReadOnly.cpp: (WebCore::processIterableKeyframes): (WebCore::processKeyframeLikeObject): (WebCore::processPropertyIndexedKeyframes): * animation/KeyframeEffectReadOnly.h: * animation/KeyframeEffectReadOnly.idl: 2018-02-19 Ms2ger <Ms2ger@igalia.com> Explicitly qualify some method calls on this in lamdas in Service Worker code. https://bugs.webkit.org/show_bug.cgi?id=182875 Reviewed by Chris Dumez. This is necessary for the code to build with GCC 5. Other code already appears to have been adapted similarly. No change in functionality. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::redirectReceived): (WebCore::DocumentLoader::startLoadingMainResource): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::ready): (WebCore::ServiceWorkerContainer::getRegistration): (WebCore::ServiceWorkerContainer::getRegistrations): (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest): * workers/service/ServiceWorkerGlobalScope.cpp: (WebCore::ServiceWorkerGlobalScope::updateExtendedEventsSet): * workers/service/server/SWServer.cpp: (WebCore::SWServer::claim): (WebCore::SWServer::Connection::resolveRegistrationReadyRequests): * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::updateRegistrationState): (WebCore::SWServerRegistration::setUpdateViaCache): (WebCore::SWServerRegistration::setLastUpdateTime): (WebCore::SWServerRegistration::fireUpdateFoundEvent): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::setState): 2018-02-19 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderElement::removeAndDestroyChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182915 <rdar://problem/37658123> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderElement.cpp: (WebCore::RenderElement::removeAndDestroyChild): Deleted. * rendering/RenderElement.h: (WebCore::RenderElement::isChildAllowed const): * rendering/RenderObject.cpp: (WebCore::RenderObject::removeFromParentAndDestroy): * rendering/RenderView.cpp: (WebCore::RenderView::willBeDestroyed): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::removeAndDestroyChild): (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::updateStyle): (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): 2018-02-12 Sergio Villar Senin <svillar@igalia.com> [WebVR][OpenVR] Implement getVRDisplays() https://bugs.webkit.org/show_bug.cgi?id=182692 Reviewed by Žan Doberšek. This provides an implementation of Navigator's getVRDisplays() method using OpenVR as backend. It queues several promises in a queue and resolves them all just once. The information retrieved is very minimal for the time being, but this change lays the ground for all the changes that are about to land. The VR code uses a VRManager which is the interface with the platform code and the responsible for instantiating the right platform code. This platform code is currently being implemented using OpenVR but could we also ported in the future to OpenXR or any other VR SDK. * CMakeLists.txt: * Modules/webvr/NavigatorWebVR.cpp: (WebCore::NavigatorWebVR::getVRDisplays): (WebCore::NavigatorWebVR::vrEnabled): * Modules/webvr/NavigatorWebVR.h: * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::create): (WebCore::VRDisplay::VRDisplay): (WebCore::VRDisplay::isConnected const): (WebCore::VRDisplay::displayName const): * Modules/webvr/VRDisplay.h: * Modules/webvr/VRDisplayCapabilities.cpp: (WebCore::VRDisplayCapabilities::VRDisplayCapabilities): (WebCore::VRDisplayCapabilities::hasPosition const): (WebCore::VRDisplayCapabilities::hasOrientation const): (WebCore::VRDisplayCapabilities::hasExternalDisplay const): (WebCore::VRDisplayCapabilities::canPresent const): (WebCore::VRDisplayCapabilities::maxLayer const): * Modules/webvr/VRDisplayCapabilities.h: (WebCore::VRDisplayCapabilities::create): * Sources.txt: * platform/vr/VRManager.cpp: Added. This is the main interface used by bindings code to access VR devices data provided by platform code. (WebCore::VRManager::singleton): (WebCore::VRManager::VRManager): (WebCore::VRManager::~VRManager): (WebCore::VRManager::refreshVRDevices): * platform/vr/VRManager.h: Added. * platform/vr/VRPlatformDisplay.h: Added. Abstraction of a VR display system. To be implemented by backends like OpenVR, OpenXR... * platform/vr/VRPlatformManager.h: Added. Abstraction of the platform specific class which retrieves data from VR devices. To be implemented by backends like OpenVR, OpenXR... * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: Added. (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR): * platform/vr/openvr/VRPlatformDisplayOpenVR.h: Added. * platform/vr/openvr/VRPlatformManagerOpenVR.cpp: Added. (WebCore::VRPlatformManagerOpenVR::create): (WebCore::VRPlatformManagerOpenVR::VRPlatformManagerOpenVR): (WebCore::VRPlatformManagerOpenVR::~VRPlatformManagerOpenVR): (WebCore::VRPlatformManagerOpenVR::initOpenVR): * platform/vr/openvr/VRPlatformManagerOpenVR.h: Added. * WebCore.xcodeproj/project.pbxproj: 2018-02-19 Manuel Rego Casasnovas <rego@igalia.com> [css-grid] Apply automatic minimum size clamping to spanning items too https://bugs.webkit.org/show_bug.cgi?id=182684 Reviewed by Javier Fernandez. In r225776 we added the conditions from the spec to apply the automatic minimum size clamping when required but only to non-spanning items. See: https://drafts.csswg.org/css-grid/#min-size-auto This patch moves the code from GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem() to GridTrackSizingAlgorithmStrategy::minSizeForChild() that way the clamping is applied for both spanning and non-spanning items. This somehow reverts r225776, as it was adding some duplicated code. All the checks to know if we should use that part of the spec were already present in GridTrackSizingAlgorithmStrategy::minSizeForChild(). Apart from using the previous code, there's a new loop to verify that the max track sizing function is fixed for all the tracks of the item. Tests: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-024.html imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-025.html * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem): (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const): 2018-02-19 Philippe Normand <pnormand@igalia.com> [GTK][GStreamer] Replaying a webm video twice causes the video to stop getting rendered https://bugs.webkit.org/show_bug.cgi?id=176789 Reviewed by Xabier Rodriguez-Calvar. Ensure the wrapped GstGLContext is set when the pipeline goes from READY to PAUSED state. This is a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=757933. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Add debug statement. (WebCore::MediaPlayerPrivateGStreamer::readyTimerFired): Ditto. (WebCore::MediaPlayerPrivateGStreamer::changePipelineState): Ensure the wrapped GstGLContext is set when the pipeline goes from READY to PAUSED state. (WebCore::MediaPlayerPrivateGStreamer::didEnd): Add debug statement. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: Change the requestGLContext to be a method instead of a static function. Being a static function was a requirement for the now-removed OpenWebRTC player. (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): Add debug statement, fix requestGLContext usage. (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): Refactor as method. (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): Fix requestGLContext usage. (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Remove fixed FIXME. (WebCore::MediaPlayerPrivateGStreamerBase::ensureGLVideoSinkContext): Set display and app wrapped contexts on the video sink. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 2018-02-19 Xabier Rodriguez Calvar <calvaris@igalia.com> [GStreamer] Crash in WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete https://bugs.webkit.org/show_bug.cgi?id=166733 Reviewed by Philippe Normand. There are a couple of issues to tackle here. First is handling getting more than one missing plugin installation request at the same time. For this we add the request to a Vector and handle them there. Second is that if the player is dead and we still get the result, bad things happen. For that we "weaked" the pointer capture by the lambda. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Handle Vector of callbacks. (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Weak private player pointer and put the callback in the Vector. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Callback becomes Vector. * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h: (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create): (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete): (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback): Callback function is refactored into a "using" type and added self as parameter to the function. 2018-02-19 Philippe Normand <pnormand@igalia.com> [GStreamer] Playbin3 support https://bugs.webkit.org/show_bug.cgi?id=182530 Reviewed by Xabier Rodriguez-Calvar. This patch introduces opt-in support for the playbin3 GStreamer element. This new playback element is still considered experimental but it can still be very useful for media assets containing multiple tracks of the same type. In such scenario audio/video decoders would be created only for the selected tracks whereas playbin2 creates decoder for each track. * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: Take a weak pointer of the media player instead of playbin and call the player when enabling tracks. Also use the GstStream API instead of inspecting the pad when playbin3 is used. (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer): (WebCore::AudioTrackPrivateGStreamer::disconnect): (WebCore::AudioTrackPrivateGStreamer::markAsActive): (WebCore::AudioTrackPrivateGStreamer::setEnabled): * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h: * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: GstStream and GstStreamCollection smart pointer support. (WTF::adoptGRef): (WTF::refGPtr<GstStream>): (WTF::derefGPtr<GstStream>): (WTF::refGPtr<GstStreamCollection>): (WTF::derefGPtr<GstStreamCollection>): * platform/graphics/gstreamer/GRefPtrGStreamer.h: * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: Use the GstStream API instead of inspecting the pad when playbin3 is used. (WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer): (WebCore::InbandTextTrackPrivateGStreamer::disconnect): * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h: (WebCore::InbandTextTrackPrivateGStreamer::create): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): m_{audio,video,text}Tracks are now hashmaps, which is a bit more convenient to use than Vectors. (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Update our tracks implementations depending on the streams stored in the collection. (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Activate the given track. This method is called by the TrackPrivate implementations. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Refactored legacy (playbin2) support for track hashmap storage. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Ditto. (WebCore::MediaPlayerPrivateGStreamer::newTextSample): Use track hashmap storage. (WebCore::MediaPlayerPrivateGStreamer::handleMessage): React on playbin3 GstStream messages, store the collection provided and activate the given selected streams accordingly. (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Invalidate tracks no longer needed. (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto. (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto. (WebCore::MediaPlayerPrivateGStreamer::sourceSetupCallback): Refactoring, use source-setup signal instead of the source property which is not supported in playbin3. (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Promoted logging messages, GST_TRACE should be used for very frequent and less interesting messages. (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Ditto. (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Called by the source-setup signal handler. (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Debugging message added. (WebCore::MediaPlayerPrivateGStreamer::setPreload): Ditto. (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Create a playbin3 element if USE(GSTREAMER_PLAYBIN3) was enabled and connect to playbin2 signals otherwise. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Promoted to public. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: New StreamCollectionChanged notification type, used the sub-class. * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): Support for GstStream API. (WebCore::TrackPrivateBaseGStreamer::disconnect): Clear GstStream too. (WebCore::TrackPrivateBaseGStreamer::tagsChanged): Get tags from GstStream. (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged): No need to check m_pad twice. (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Ditto. * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: Take a weak pointer of the media player instead of playbin and call the player when enabling tracks. Also use the GstStream API instead of inspecting the pad when playbin3 is used. (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer): (WebCore::VideoTrackPrivateGStreamer::disconnect): (WebCore::VideoTrackPrivateGStreamer::markAsActive): (WebCore::VideoTrackPrivateGStreamer::setSelected): * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h: * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Pass player pointer to track constructor. (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Source-setup signal handler. (WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: 2018-02-19 Fujii Hironori <Hironori.Fujii@sony.com> REGRESSION(r219298): RELEASE_ASSERT(!m_owningPointerForClose) fails in WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose https://bugs.webkit.org/show_bug.cgi?id=174354 <rdar://problem/33294987> Reviewed by Michael Catanzaro. UniqueIDBDatabase::invokeOperationAndTransactionTimer was called even after m_owningPointerForClose was set in UniqueIDBDatabase::didDeleteBackingStore. No new tests (Covered by existing tests). * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore): Do not start deleting the UniqueIDBDatabase. Just call invokeOperationAndTransactionTimer. (WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer): Assert m_owningPointerForClose is null. 2018-02-18 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> Fix build error after r228417 without ACCESSIBILITY https://bugs.webkit.org/show_bug.cgi?id=182914 Reviewed by Chris Fleizach. An inline empty version of AXObjectCache::deferFocusdUIElementChangeIfNeeded() needs to be defined if not HAVE(ACCESSIBILITY). * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded): 2018-02-18 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] REGRESSION(r228238) Detach renderer before destroying its subtree. https://bugs.webkit.org/show_bug.cgi?id=182908 <rdar://problem/37619394> Reviewed by Antti Koivisto. Prior to r228238 we first detached the to-be-destroyed renderer and then started nuking its descendants. r228238 changed the order and now the descendants are destroyed while they are still attached to the tree. Apparently some of the takeChild() normalization logic gets triggered now that the renderers still have access to their previous/next siblings. This is unexpected and it shouldn't matter whether the subtree is still attached. Let's revert it to the original order for now (see webkit.org/b/182909). Test: fast/block/crash-when-subtree-is-still-attached.html * rendering/RenderElement.cpp: (WebCore::RenderElement::removeAndDestroyChild): 2018-02-18 Charlie Turner <cturner@igalia.com> [GStreamer] Push smaller buffers from HTTP source https://bugs.webkit.org/show_bug.cgi?id=182829 Reviewed by Philippe Normand. Split the received buffer into smaller buffers of a size consistent with the basesrc (4KiB). It is important not to push large buffers into the appsrc (where large is relative to the appsrc's configured byte size). If large buffers are pushed, then when they are internally dequeued by the appsrc, the buffering percentage can dramatically plummet due to a large amount of bytes being removed after a push. This can in turn trick the media player into thinking it needs to buffer, and then issuing a spurious set of playing->paused then paused->playing transitions, which by the time the buffering logic completes, data are already available. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (CachedResourceStreamingClient::dataReceived): 2018-02-17 Darin Adler <darin@apple.com> Web Inspector: get rid of remaining uses of OptOutput<T> https://bugs.webkit.org/show_bug.cgi?id=180607 Reviewed by Brian Burg. * inspector/InspectorStyleSheet.cpp: (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*. (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead of lineEndings().get(). (WebCore::InspectorStyle::styleWithProperties const): Ditto. (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto. (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of a std::unique_ptr<Vector>. (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto. * inspector/InspectorStyleSheet.h: Updated for the above. * inspector/agents/InspectorCSSAgent.h: Removed some bogus const. * inspector/agents/InspectorCanvasAgent.cpp: Ditto. * inspector/agents/InspectorCanvasAgent.h: Ditto. * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings so we don't waste space with a pointer to the string. (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed explicit creation of String, which was wasteful and unnecessary. (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto. (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto. (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto. (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const. * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use final instead of override. * inspector/agents/InspectorPageAgent.cpp: Ditto. * inspector/agents/InspectorPageAgent.h: Ditto. 2018-02-16 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Cleanup RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182899 <rdar://problem/37627888> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): (WebCore::RenderTreeBuilder::moveChildTo): (WebCore::RenderTreeBuilder::moveAllChildrenTo): (WebCore::RenderTreeBuilder::moveChildrenTo): (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo): (WebCore::RenderTreeBuilder::makeChildrenNonInline): (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild): (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList): Deleted. (WebCore::RenderTreeBuilder::takeChildFromRenderButton): Deleted. * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::current): * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild): * rendering/updating/RenderTreeBuilderBlockFlow.cpp: (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo): * rendering/updating/RenderTreeBuilderFormControls.cpp: (WebCore::RenderTreeBuilder::FormControls::takeChild): * rendering/updating/RenderTreeBuilderFormControls.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren): (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): (WebCore::RenderTreeBuilder::Ruby::takeChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows): 2018-02-16 Daniel Bates <dabates@apple.com> Remove UTF-32 BOM parsing code https://bugs.webkit.org/show_bug.cgi?id=182900 <rdar://problem/37238717> Reviewed by Alexey Proskuryakov. The UTF-32 encodings were removed from the text codec registry in r224747. So, we no longer need code to parse UTF-32{BE, LE} BOM or encode and decode these variants. * dom/TextDecoder.cpp: (WebCore::codeUnitByteSize): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::checkForBOM): (WebCore::TextResourceDecoder::checkForHeadCharset): * platform/text/TextEncoding.cpp: (WebCore::TextEncoding::isNonByteBasedEncoding const): (WebCore::UTF32BigEndianEncoding): Deleted. (WebCore::UTF32LittleEndianEncoding): Deleted. * platform/text/TextEncoding.h: 2018-02-16 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBoxModelObject::moveChild*() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182896 <rdar://problem/37623051> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderBlock.h: (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo): Deleted. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo): Deleted. * rendering/RenderBlockFlow.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildTo): Deleted. (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted. (WebCore::RenderBoxModelObject::moveAllChildrenToInternal): Deleted. * rendering/RenderBoxModelObject.h: (WebCore::RenderBoxModelObject::moveChildTo): Deleted. (WebCore::RenderBoxModelObject::moveAllChildrenTo): Deleted. (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted. * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::moveChildTo): (WebCore::RenderTreeBuilder::moveAllChildrenTo): (WebCore::RenderTreeBuilder::moveChildrenTo): (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo): (WebCore::RenderTreeBuilder::makeChildrenNonInline): (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::moveAllChildrenToInternal): (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock): (WebCore::RenderTreeBuilder::Block::takeChild): (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild): * rendering/updating/RenderTreeBuilderBlockFlow.cpp: (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo): * rendering/updating/RenderTreeBuilderBlockFlow.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren): (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): (WebCore::RenderTreeBuilder::Ruby::takeChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows): 2018-02-16 Andy Estes <aestes@apple.com> [Cocoa] Stop using non-prefixed vDSP functions in 32-bit builds https://bugs.webkit.org/show_bug.cgi?id=182898 <rdar://problem/37195079> Reviewed by Tim Horton. There's no need to use non-prefixed vDSP function aliases on 32-bit builds. The vDSP-prefixed versions are available on all Cocoa platforms we currently support. * platform/audio/DirectConvolver.cpp: (WebCore::DirectConvolver::process): * platform/audio/VectorMath.cpp: (WebCore::VectorMath::vsmul): (WebCore::VectorMath::vadd): (WebCore::VectorMath::vmul): (WebCore::VectorMath::zvmul): 2018-02-16 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r228575. Introduced LayoutTest crashes under GuardMalloc. Reverted changeset: "Use ResourceLoader to load appcache manifest" https://bugs.webkit.org/show_bug.cgi?id=182861 https://trac.webkit.org/changeset/228575 2018-02-16 Dean Jackson <dino@apple.com> Use OPENGL macros to be more clear about which OpenGL/ES WebGL uses on Cocoa https://bugs.webkit.org/show_bug.cgi?id=182894 Reviewed by Tim Horton. Adjust the places where we check for PLATFORM(MAC) or PLATFORM(IOS) related to WebGL, and instead rely on USE(OPENGL) USE(OPENGL_ES). * CMakeLists.txt: * PlatformGTK.cmake: * platform/graphics/GLContext.cpp: (WebCore::initializeOpenGLShimsIfNeeded): * platform/graphics/GraphicsContext3DPrivate.cpp: * platform/graphics/OpenGLESShims.h: * platform/graphics/cairo/ImageBufferCairo.cpp: * platform/graphics/egl/GLContextEGL.cpp: (WebCore::GLContextEGL::getEGLConfig): (WebCore::GLContextEGL::createContext): (WebCore::GLContextEGL::createSharingContext): * platform/graphics/egl/GLContextEGLWPE.cpp: (WebCore::GLContextEGL::createWPEContext): * platform/graphics/egl/GLContextEGLWayland.cpp: (WebCore::GLContextEGL::createWaylandContext): * platform/graphics/egl/GLContextEGLX11.cpp: (WebCore::GLContextEGL::createPixmapContext): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp: (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer): (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer): (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture): * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h: * platform/graphics/opengl/Extensions3DOpenGLES.cpp: * platform/graphics/opengl/Extensions3DOpenGLES.h: * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: (WebCore::GraphicsContext3D::create): (WebCore::GraphicsContext3D::GraphicsContext3D): (WebCore::GraphicsContext3D::isGLES2Compliant const): * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: (WebCore::GraphicsContext3D::create): (WebCore::GraphicsContext3D::GraphicsContext3D): (WebCore::GraphicsContext3D::~GraphicsContext3D): (WebCore::GraphicsContext3D::isGLES2Compliant const): (WebCore::GraphicsContext3D::getExtensions): * platform/graphics/texmap/TextureMapperContextAttributes.cpp: (WebCore::TextureMapperContextAttributes::initialize): * platform/graphics/texmap/TextureMapperGL.cpp: (WebCore::TextureMapperGLData::~TextureMapperGLData): (WebCore::TextureMapperGLData::getVAO): (WebCore::TextureMapperGL::beginPainting): (WebCore::TextureMapperGL::endPainting): * platform/graphics/texmap/TextureMapperGLHeaders.h: * platform/graphics/texmap/TextureMapperShaderProgram.cpp: (WebCore::TextureMapperShaderProgram::create): 2018-02-16 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderElement::insertChildInternal() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182885 <rdar://problem/37617371> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderElement.cpp: (WebCore::RenderElement::insertChildInternal): Deleted. * rendering/RenderObject.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChildToRenderElement): 2018-02-16 Youenn Fablet <youenn@apple.com> Allow specifying which plug-ins are supported https://bugs.webkit.org/show_bug.cgi?id=182748 Reviewed by Chris Dumez. Tests: http/tests/plugins/nounsupported-plugin.html http/tests/plugins/supported-plugin-all-origin-visibility.html http/tests/plugins/supported-plugin-on-specific-origin.html http/tests/plugins/supported-plugin-origin-specific-visibility.html http/tests/plugins/unsupported-plugin-on-specific-origin.html plugins/unsupported-plugin.html Added support for computing plugin web visibility with the added knowledge of supported plugins. In case of a plugin failing to be created due to being unsupported, update the UI to use mark the plugin as "Unexpected plug in". Added internal API to retrieve the plug-in error description message. * English.lproj/Localizable.strings: * WebCore.xcodeproj/project.pbxproj: * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::setReplacement): * html/HTMLPlugInElement.h: * loader/EmptyClients.cpp: * platform/LocalizedStrings.cpp: (WebCore::unsupportedPluginText): * platform/LocalizedStrings.h: * plugins/PluginData.cpp: (WebCore::PluginData::initPlugins): * plugins/PluginData.h: (WebCore::decodePluginNames): (WebCore::encodePluginNames): (WebCore::SupportedPluginNames::decode): (WebCore::SupportedPluginNames::encode const): * plugins/PluginInfoProvider.h: * rendering/RenderEmbeddedObject.cpp: (WebCore::unavailablePluginReplacementText): * rendering/RenderEmbeddedObject.h: (WebCore::RenderEmbeddedObject::pluginReplacementTextIfUnavailable const): * testing/Internals.cpp: (WebCore::Internals::unavailablePluginReplacementText): * testing/Internals.h: * testing/Internals.idl: 2018-02-16 Chris Dumez <cdumez@apple.com> http/tests/security/http-0.9/xhr-blocked.html is flaky https://bugs.webkit.org/show_bug.cgi?id=182857 <rdar://problem/37616958> Reviewed by Antti Koivisto. WebCoreResourceHandleAsOperationQueueDelegate does not own the messageQueue and the detachHandle function was failing to nullout m_messageQueue when the resourceHandle gets destroyed. This means that callFunctionOnMainThread would sometimes try to append to a dead messageQueue. No new tests, already covered by: http/tests/security/http-0.9/xhr-blocked.html is flaky * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]): 2018-02-16 Antti Koivisto <antti@apple.com> Assert in mixed blend animation https://bugs.webkit.org/show_bug.cgi?id=182887 <rdar://problem/37598140> Reviewed by Zalan Bujtas. Test: fast/css/calc-mixed-blend-crash.html * platform/CalculationValue.cpp: (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength): Fix mismatch between the type test and the value used. 2018-02-16 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlock/RenderInline::addChildIgnoringContinuation() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182876 <rdar://problem/37607604> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addChildIgnoringContinuation): Deleted. * rendering/RenderBlock.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::addChildIgnoringContinuation): Deleted. * rendering/RenderElement.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::addChildIgnoringContinuation): Deleted. * rendering/RenderInline.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation): (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation): Deleted. (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::insertChildToContinuation): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation): (WebCore::RenderTreeBuilder::Inline::splitInlines): 2018-02-16 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Unify logic of ResourceHandleCurlDelegate into ResourceHandle https://bugs.webkit.org/show_bug.cgi?id=182578 Reconstruct the classes to match Curl port network layer more similar structure with other ports. Move CurlRequest handling into ResourceHandle and makes CurlResourceHandleDelegate simple life cycle. Also its duty is for most of incoming data and event handling from CurRequest. Reviewed by Alex Christensen. No new tests because there's no new behavior. * platform/Curl.cmake: * platform/network/ResourceHandle.h: * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/curl/CurlCacheManager.cpp: (WebCore::CurlCacheManager::didReceiveResponse): * platform/network/curl/CurlDownload.cpp: (WebCore::CurlDownload::~CurlDownload): (WebCore::CurlDownload::createCurlRequest): (WebCore::CurlDownload::curlDidReceiveResponse): (WebCore::CurlDownload::curlDidReceiveBuffer): (WebCore::CurlDownload::curlDidComplete): (WebCore::CurlDownload::curlDidFailWithError): (WebCore::CurlDownload::willSendRequest): * platform/network/curl/CurlDownload.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::CurlRequest): (WebCore::CurlRequest::cancel): (WebCore::CurlRequest::callClient): (WebCore::CurlRequest::willSendData): (WebCore::CurlRequest::didReceiveData): (WebCore::CurlRequest::didReceiveDataFromMultipart): (WebCore::CurlRequest::didCompleteTransfer): (WebCore::CurlRequest::invokeDidReceiveResponse): * platform/network/curl/CurlRequest.h: (WebCore::CurlRequest::create): (WebCore::CurlRequest::invalidateClient): (WebCore::CurlRequest::setClient): Deleted. * platform/network/curl/CurlRequestClient.h: * platform/network/curl/CurlResourceHandleDelegate.cpp: Added. (WebCore::CurlResourceHandleDelegate::CurlResourceHandleDelegate): (WebCore::CurlResourceHandleDelegate::ref): (WebCore::CurlResourceHandleDelegate::deref): (WebCore::CurlResourceHandleDelegate::cancelledOrClientless): (WebCore::CurlResourceHandleDelegate::client const): (WebCore::CurlResourceHandleDelegate::d): (WebCore::CurlResourceHandleDelegate::curlDidSendData): (WebCore::handleCookieHeaders): (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse): (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer): (WebCore::CurlResourceHandleDelegate::curlDidComplete): (WebCore::CurlResourceHandleDelegate::curlDidFailWithError): * platform/network/curl/CurlResourceHandleDelegate.h: Added. (WebCore::CurlResourceHandleDelegate::response const): * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandleInternal::~ResourceHandleInternal): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::cancel): (WebCore::ResourceHandle::cancelledOrClientless): (WebCore::ResourceHandle::createCurlRequest): (WebCore::ResourceHandle::delegate): (WebCore::ResourceHandle::platformSetDefersLoading): (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): (WebCore::ResourceHandle::receivedCredential): (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential): (WebCore::ResourceHandle::getCredential): (WebCore::ResourceHandle::restartRequestWithCredential): (WebCore::ResourceHandle::platformLoadResourceSynchronously): (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse): (WebCore::ResourceHandle::continueAfterDidReceiveResponse): (WebCore::ResourceHandle::shouldRedirectAsGET): (WebCore::ResourceHandle::willSendRequest): (WebCore::ResourceHandle::continueAfterWillSendRequest): (WebCore::ResourceHandle::handleDataURL): * platform/network/curl/ResourceHandleCurlDelegate.cpp: Removed. * platform/network/curl/ResourceHandleCurlDelegate.h: Removed. 2018-02-16 Youenn Fablet <youenn@apple.com> Use ResourceLoader to load appcache manifest https://bugs.webkit.org/show_bug.cgi?id=182861 Reviewed by Alex Christensen. Covered by updated tests. Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader. Make use of it to load the app cache manifest. Future work should load entries using the same loader. Remove manifest handle. Ensure that DocumentLoader does not register the manifest resource loader as its lifetime is handled by its ApplicationCacheGroup. Add a ResourceLoader option to bypass the application cache. Use it for manifest loading. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::addSubresourceLoader): * loader/ResourceLoaderOptions.h: * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::stopLoading): (WebCore::ApplicationCacheGroup::update): (WebCore::ApplicationCacheGroup::createRequest): (WebCore::ApplicationCacheGroup::didReceiveResponseAsync): (WebCore::ApplicationCacheGroup::didReceiveData): (WebCore::ApplicationCacheGroup::didFinishLoading): (WebCore::ApplicationCacheGroup::didFail): (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): * loader/appcache/ApplicationCacheGroup.h: * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::maybeLoadResource): (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect): (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse): (WebCore::ApplicationCacheHost::maybeLoadFallbackForError): * loader/appcache/ApplicationCacheResourceLoader.cpp: Added. * loader/appcache/ApplicationCacheResourceLoader.h: Added. 2018-02-16 Chris Dumez <cdumez@apple.com> Crash under WebCore::EventTarget::fireEventListeners https://bugs.webkit.org/show_bug.cgi?id=182880 <rdar://problem/20788804> Reviewed by Youenn Fablet. Make sure the 'ended' event does not get dispatched on a AudioScheduledSourceNode after ActiveDOMObjects have been stopped. Test: webaudio/audiobuffersource-ended-detached-frame.html * Modules/webaudio/AudioScheduledSourceNode.cpp: (WebCore::AudioScheduledSourceNode::finish): 2018-02-16 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Implement PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() https://bugs.webkit.org/show_bug.cgi?id=182771 <rdar://problem/36459988> Reviewed by Brent Fulgham. This patch implements PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() per https://www.w3.org/TR/webauthn/#isUserVerifyingPlatformAuthenticatorAvailable with some limitations. In addition, it changes DeferredPromise to DOMPromiseDeferred<> for all CredentialsManagement and WebAuthN API. Test: http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available.html * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): * Modules/credentialmanagement/CredentialsContainer.h: * Modules/credentialmanagement/CredentialsMessenger.cpp: (WebCore::CredentialsMessenger::addCreationCompletionHandler): Remove a redundant assertion. (WebCore::CredentialsMessenger::addRequestCompletionHandler): Remove a redundant assertion. (WebCore::CredentialsMessenger::addQueryCompletionHandler): (WebCore::CredentialsMessenger::takeQueryCompletionHandler): * Modules/credentialmanagement/CredentialsMessenger.h: * Modules/webauthn/AuthenticatorManager.cpp: (WebCore::AuthenticatorManagerInternal::initTimeoutTimer): (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): (WebCore::AuthenticatorManager::isUserVerifyingPlatformAuthenticatorAvailable const): * Modules/webauthn/AuthenticatorManager.h: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable): * Modules/webauthn/PublicKeyCredential.h: * testing/MockCredentialsMessenger.cpp: (WebCore::MockCredentialsMessenger::isUserVerifyingPlatformAuthenticatorAvailable): (WebCore::MockCredentialsMessenger::isUserVerifyingPlatformAuthenticatorAvailableReply): * testing/MockCredentialsMessenger.h: * testing/MockCredentialsMessenger.idl: 2018-02-16 Tim Horton <timothy_horton@apple.com> Stop using EXCLUDED_SOURCE_FILE_NAMES for touch and gesture files in WebCore https://bugs.webkit.org/show_bug.cgi?id=182866 Reviewed by Daniel Bates. * Configurations/WebCore.xcconfig: These generated files already have ENABLE() flags around them, so there's no reason to exclude them explicitly. 2018-02-16 Chris Dumez <cdumez@apple.com> Unreviewed, fix iOS build after r228562. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::openSQLiteDatabase): 2018-02-16 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderElement::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182878 <rdar://problem/37608349> Reviewed by Antti Koivisto. This patch removes the last addChild() related mutation logic from the renderers. No change in functionality. * rendering/RenderElement.cpp: (WebCore::RenderElement::didInsertChild): (WebCore::RenderElement::addChild): Deleted. * rendering/RenderElement.h: (WebCore::RenderElement::isChildAllowed const): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::insertChildToRenderElement): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): * rendering/updating/RenderTreeBuilderSVG.cpp: (WebCore::RenderTreeBuilder::SVG::insertChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::insertChild): 2018-02-16 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r228546. This caused a consistent crash on all macOS WK2 platforms. Reverted changeset: "Web Inspector: get rid of remaining uses of OptOutput<T>" https://bugs.webkit.org/show_bug.cgi?id=180607 https://trac.webkit.org/changeset/228546 2018-02-16 Youenn Fablet <youenn@apple.com> Log the error message when failing to open the database https://bugs.webkit.org/show_bug.cgi?id=182795 <rdar://problem/37592399> Unreviewed. Fixing iOS simulator debug build. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::openSQLiteDatabase): 2018-02-16 Fujii Hironori <Hironori.Fujii@sony.com> IndexedDB: Several test crash in when destroying a IDBKeyData https://bugs.webkit.org/show_bug.cgi?id=167576 Reviewed by Michael Catanzaro. IDBKeyDataHashTraits::constructDeletedValue is using operator= to assign deletedValue. But, the value is destructed just before calling constructDeletedValue. You can't use operator= for a destructed value. No new tests (Covered by existing tests). * Modules/indexeddb/IDBKeyData.h: (WebCore::IDBKeyDataHashTraits::constructDeletedValue): Construct null value before assigning deletedValue. 2018-02-16 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlock/RenderBlockFlow::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182862 <rdar://problem/37595464> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addChild): Deleted. * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::addChild): Deleted. * rendering/RenderBlockFlow.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::insertChildToRenderBlock): Deleted. (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlockFlow.cpp: (WebCore::RenderTreeBuilder::BlockFlow::insertChild): * rendering/updating/RenderTreeBuilderFormControls.cpp: (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild): * rendering/updating/RenderTreeBuilderMathML.cpp: (WebCore::RenderTreeBuilder::MathML::makeFences): (WebCore::RenderTreeBuilder::MathML::insertChild): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::insertChild): (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe): * rendering/updating/RenderTreeBuilderSVG.cpp: (WebCore::RenderTreeBuilder::SVG::insertChild): 2018-02-16 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Add basic support for <input type='date'> using date picker UI https://bugs.webkit.org/show_bug.cgi?id=182847 <rdar://problem/35143111> Reviewed by Tim Horton. Add new localized strings for "month", "day" and "year" as they appear in the date picker. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::textInputModeWriteButtonTitle): (WebCore::textInputModeSpeechButtonTitle): (WebCore::datePickerDayLabelTitle): (WebCore::datePickerMonthLabelTitle): (WebCore::datePickerYearLabelTitle): (WebCore::textInputModeWriteButton): Deleted. (WebCore::textInputModeSpeechButton): Deleted. * platform/LocalizedStrings.h: 2018-02-16 Zan Dobersek <zdobersek@igalia.com> HarfBuzzFace should operate with a FontPlatformData reference https://bugs.webkit.org/show_bug.cgi?id=182863 Reviewed by Carlos Garcia Campos. Instead of keeping a never-null pointer to FontPlatformData, HarfBuzzFace should operate with a FontPlatformData reference. * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::FontPlatformData::harfBuzzFace const): * platform/graphics/harfbuzz/HarfBuzzFace.cpp: (WebCore::HarfBuzzFace::HarfBuzzFace): * platform/graphics/harfbuzz/HarfBuzzFace.h: * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: (WebCore::HarfBuzzFace::createFace): (WebCore::HarfBuzzFace::createFont): 2018-02-15 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] parent.Render*::addChild() cleanup https://bugs.webkit.org/show_bug.cgi?id=182842 <rdar://problem/37585524> Reviewed by Antti Koivisto. No change in functionality. * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): * rendering/updating/RenderTreeBuilderFormControls.cpp: (WebCore::RenderTreeBuilder::FormControls::createInnerRendererIfNeeded): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): * rendering/updating/RenderTreeBuilderMathML.cpp: (WebCore::RenderTreeBuilder::MathML::makeFences): (WebCore::RenderTreeBuilder::MathML::insertChild): * rendering/updating/RenderTreeBuilderSVG.cpp: (WebCore::RenderTreeBuilder::SVG::insertChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::insertChild): 2018-02-15 Megan Gardner <megan_gardner@apple.com> Support scrolling for non-editable web-selection and start autoscroll when near screen edges https://bugs.webkit.org/show_bug.cgi?id=182815 Reviewed by Tim Horton. Adjust the position we are autoscrolling to so that when we are close to an edge, we will start autoscrolling while we are still inside the view. Autoscrolling still happens when you drag past the edge of a view. No new tests (This is difficult to test in this state, but when we switch assistants, test will also be added). * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startSelectionAutoscroll): (WebCore::EventHandler::cancelSelectionAutoscroll): (WebCore::autoscrollAdjustmentFactorForScreenBoundaries): (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): (WebCore::EventHandler::startTextAutoscroll): Deleted. (WebCore::EventHandler::cancelTextAutoscroll): Deleted. 2018-02-15 Youenn Fablet <youenn@apple.com> Log the error message when failing to open the database https://bugs.webkit.org/show_bug.cgi?id=182795 Reviewed by Chris Dumez. No change of behavior. Print the error message as it does not contain any user private information. * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::openSQLiteDatabase): 2018-02-15 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderMenuList::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182840 <rdar://problem/37583638> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderMenuList.cpp: (RenderMenuList::didInsertChild): (RenderMenuList::addChild): Deleted. * rendering/RenderMenuList.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): * rendering/updating/RenderTreeBuilderFormControls.cpp: (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild): (WebCore::RenderTreeBuilder::FormControls::insertChild): (WebCore::RenderTreeBuilder::FormControls::createInnerRendererIfNeeded): Deleted. * rendering/updating/RenderTreeBuilderFormControls.h: 2018-02-15 Darin Adler <darin@apple.com> Web Inspector: get rid of remaining uses of OptOutput<T> https://bugs.webkit.org/show_bug.cgi?id=180607 Reviewed by Brian Burg. * inspector/InspectorStyleSheet.cpp: (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*. (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead of lineEndings().get(). (WebCore::InspectorStyle::styleWithProperties const): Ditto. (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto. (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of a std::unique_ptr<Vector>. (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto. * inspector/InspectorStyleSheet.h: Updated for the above. * inspector/agents/InspectorCSSAgent.h: Removed some bogus const. * inspector/agents/InspectorCanvasAgent.cpp: Ditto. * inspector/agents/InspectorCanvasAgent.h: Ditto. * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings so we don't waste space with a pointer to the string. (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed explicit creation of String, which was wasteful and unnecessary. (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto. (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto. (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto. (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const. * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use final instead of override. * inspector/agents/InspectorPageAgent.cpp: Ditto. * inspector/agents/InspectorPageAgent.h: Ditto. 2018-02-15 Chris Dumez <cdumez@apple.com> Flaky Test: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html https://bugs.webkit.org/show_bug.cgi?id=182270 <rdar://problem/36904314> Reviewed by Antti Koivisto. No new tests, already covered by existing tests that crash flakily on the bots. * loader/ThreadableLoaderClientWrapper.h: (WebCore::ThreadableLoaderClientWrapper::ThreadableLoaderClientWrapper): isolate copy the initiator string as this object can be destroyed on a different thread. This was causing the test to flakily crash as well when destroying ThreadLocalData. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (scheduledWithCustomRunLoopMode): (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]): Fix thread safety issue in callFunctionOnMainThread. This function is called from a background thread to get to the main thread. However, it relied on m_handle which would get nullified on the main thread by detachHandle when the ResourceHandle is destroyed. Fix the issue by not relying on m_handle anymore. (-[WebCoreResourceHandleAsOperationQueueDelegate initWithHandle:messageQueue:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): - Go back to using autorelease() instead of get() for the returned objects to match the code pre-r224522. - Dispatch the protectedSelf variables that were added in r227073 to the main thread to make sure we do not get destroyed on the background thread when protectedSelf is the last strong reference to self. Destroying the WebCoreResourceHandleAsOperationQueueDelegate on the background safe is unsafe due to its m_messageQueue data member which contains lambdas that may capture anything. - Add a Lock to protect against detachHandle getting called on the main thread and nulling out m_handle / m_requestResult / m_cachedResponseResult while the background thread may be accessing them. 2018-02-15 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderTableRow::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182838 <rdar://problem/37580762> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::didInsertTableCell): (WebCore::RenderTableRow::addChild): Deleted. * rendering/RenderTableRow.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::insertChildToRenderTableRow): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::insertChild): 2018-02-15 Antoine Quint <graouts@apple.com> [Web Animations] Ensure that changing the timing model updates styles synchronously https://bugs.webkit.org/show_bug.cgi?id=182836 Reviewed by Dean Jackson. We did not invalidate the timing model when properties of an effect's timing object changed and even when we did invalidate the timing model, we did not update styles on effect targets synchronously, only scheduling such updates for the next animation frame. In this patch we expose the effect on the timing object such that changing timing properties can notify the effect of a change in the timing model, which can then be forwarded to the animation (which already informs its timeline, if any). Additionally, when an animation's timing model has changed, we now invalidate the effect, which will update styles synchronously. This produces a number of progressions in WPT tests. * animation/AnimationEffectReadOnly.cpp: (WebCore::AnimationEffectReadOnly::AnimationEffectReadOnly): Set the timing object's effect upon effect construction. (WebCore::AnimationEffectReadOnly::~AnimationEffectReadOnly): Set the timing object's effect to null upon effect destruction. (WebCore::AnimationEffectReadOnly::timingDidChange): Notify the animation (if any) that its timing model changed following a change in the timing properties. * animation/AnimationEffectReadOnly.h: Add a new virtual invalidate() method that subclasses can override to implement invalidation behavior when the animation finds out its timing model changed. * animation/AnimationEffectTimingReadOnly.cpp: Notify the effect when a property changes such that it may notify its animation of a timing model change. (WebCore::AnimationEffectTimingReadOnly::propertyDidChange): (WebCore::AnimationEffectTimingReadOnly::setIterationStart): (WebCore::AnimationEffectTimingReadOnly::setIterations): (WebCore::AnimationEffectTimingReadOnly::setBindingsDuration): (WebCore::AnimationEffectTimingReadOnly::setEasing): (WebCore::AnimationEffectTimingReadOnly::setDelay): (WebCore::AnimationEffectTimingReadOnly::setEndDelay): (WebCore::AnimationEffectTimingReadOnly::setFill): (WebCore::AnimationEffectTimingReadOnly::setIterationDuration): (WebCore::AnimationEffectTimingReadOnly::setDirection): * animation/AnimationEffectTimingReadOnly.h: (WebCore::AnimationEffectTimingReadOnly::setEffect): (WebCore::AnimationEffectTimingReadOnly::setBindingsDelay): (WebCore::AnimationEffectTimingReadOnly::setBindingsEndDelay): (WebCore::AnimationEffectTimingReadOnly::setDelay): Deleted. (WebCore::AnimationEffectTimingReadOnly::setEndDelay): Deleted. (WebCore::AnimationEffectTimingReadOnly::setFill): Deleted. (WebCore::AnimationEffectTimingReadOnly::setIterationDuration): Deleted. (WebCore::AnimationEffectTimingReadOnly::setDirection): Deleted. * animation/AnimationTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange() to align it with the new WebAnimation::timingModelDidChange() method. (WebCore::AnimationTimeline::addAnimation): (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::setCurrentTime): * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::timingModelDidChange): (WebCore::AnimationTimeline::animationTimingModelDidChange): Deleted. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::timingModelDidChange): (WebCore::DocumentTimeline::updateAnimations): (WebCore::DocumentTimeline::animationTimingModelDidChange): Deleted. * animation/DocumentTimeline.h: * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::invalidate): Override the invalidate() method to perform a synchronous style update in order to ensure that timing properties are accounted for right as they change. * animation/KeyframeEffectReadOnly.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::timingModelDidChange): Invalidate the effect and notify the timeline of a timing model change when an animation is notified that its timing model has changed. (WebCore::WebAnimation::setStartTime): * animation/WebAnimation.h: 2018-02-15 Timothy Horton <timothy_horton@apple.com> Fix the build. * platform/ios/KeyEventCodesIOS.h: 2018-02-15 John Wilander <wilander@apple.com> Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database https://bugs.webkit.org/show_bug.cgi?id=182812 <rdar://problem/37511406> Reviewed by Brent Fulgham. No new tests. Tested manually between versions of Safari. * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::decode): Now only expects these fields for model version 11 or higher: - topFrameUniqueRedirectsTo - topFrameUniqueRedirectsFrom - subresourceUniqueRedirectsFrom - timesAccessedAsFirstPartyDueToUserInteraction - timesAccessedAsFirstPartyDueToStorageAccessAPI * loader/ResourceLoadStatistics.h: 2018-02-15 Tim Horton <timothy_horton@apple.com> Stop using EXCLUDED_SOURCE_FILE_NAMES for actual source files in WebCore https://bugs.webkit.org/show_bug.cgi?id=182822 Reviewed by Dan Bernstein. It's much easier to reason about things if xcconfigs don't apply extra constraints to which source files actually build on a per-platform basis. We should use #ifs instead like we usually do. * Configurations/WebCore.xcconfig: * Modules/geolocation/ios/GeolocationPositionIOS.mm: * accessibility/ios/AccessibilityObjectIOS.mm: * accessibility/mac/AXObjectCacheMac.mm: * accessibility/mac/AccessibilityObjectMac.mm: * accessibility/mac/WebAccessibilityObjectWrapperMac.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: * dom/DataTransferMac.mm: * editing/ios/DictationCommandIOS.cpp: * editing/ios/DictationCommandIOS.h: * editing/ios/EditorIOS.mm: * editing/ios/WebContentReaderIOS.mm: * editing/mac/EditorMac.mm: * editing/mac/WebContentReaderMac.mm: * page/ios/EventHandlerIOS.mm: * page/ios/FrameIOS.mm: * page/mac/EventHandlerMac.mm: * page/scrolling/ios/ScrollingCoordinatorIOS.h: * page/scrolling/ios/ScrollingCoordinatorIOS.mm: * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: * platform/ThreadCheck.h: * platform/audio/ios/AudioDestinationIOS.h: * platform/audio/ios/AudioFileReaderIOS.h: * platform/audio/ios/MediaSessionManagerIOS.h: * platform/graphics/ios/DisplayRefreshMonitorIOS.h: * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: * platform/graphics/ios/FontCacheIOS.mm: * platform/graphics/ios/GraphicsContext3DIOS.h: * platform/graphics/ios/IconIOS.mm: * platform/graphics/mac/ColorMac.h: * platform/graphics/mac/ColorMac.mm: * platform/graphics/mac/DisplayRefreshMonitorMac.cpp: * platform/graphics/mac/DisplayRefreshMonitorMac.h: * platform/graphics/mac/IconMac.mm: * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: * platform/ios/CursorIOS.cpp: * platform/ios/DeviceMotionClientIOS.h: * platform/ios/DeviceOrientationClientIOS.h: * platform/ios/EventLoopIOS.mm: * platform/ios/KeyEventCodesIOS.h: * platform/ios/LowPowerModeNotifierIOS.mm: * platform/ios/PasteboardIOS.mm: * platform/ios/PlatformEventFactoryIOS.h: * platform/ios/PlatformEventFactoryIOS.mm: * platform/ios/PlatformPasteboardIOS.mm: * platform/ios/PlatformScreenIOS.mm: * platform/ios/PlatformSpeechSynthesizerIOS.mm: * platform/ios/RemoteCommandListenerIOS.h: * platform/ios/RemoteCommandListenerIOS.mm: * platform/ios/SSLKeyGeneratorIOS.cpp: * platform/ios/ScrollAnimatorIOS.h: * platform/ios/ScrollAnimatorIOS.mm: * platform/ios/ScrollViewIOS.mm: * platform/ios/ScrollbarThemeIOS.h: * platform/ios/ScrollbarThemeIOS.mm: * platform/ios/SystemMemoryIOS.cpp: * platform/ios/ThemeIOS.h: * platform/ios/ThemeIOS.mm: * platform/ios/TileControllerMemoryHandlerIOS.cpp: * platform/ios/TileControllerMemoryHandlerIOS.h: * platform/ios/UserAgentIOS.mm: * platform/ios/ValidationBubbleIOS.mm: * platform/ios/WidgetIOS.mm: * platform/mac/CursorMac.mm: * platform/mac/EventLoopMac.mm: * platform/mac/LocalCurrentGraphicsContext.h: * platform/mac/LocalCurrentGraphicsContext.mm: * platform/mac/NSScrollerImpDetails.h: * platform/mac/NSScrollerImpDetails.mm: * platform/mac/PasteboardMac.mm: * platform/mac/PlatformEventFactoryMac.h: * platform/mac/PlatformEventFactoryMac.mm: * platform/mac/PlatformPasteboardMac.mm: * platform/mac/PlatformScreenMac.mm: * platform/mac/PlatformSpeechSynthesizerMac.mm: * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/ScrollViewMac.mm: * platform/mac/ScrollbarThemeMac.h: * platform/mac/ScrollbarThemeMac.mm: * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: * platform/mac/ThreadCheck.mm: * platform/mac/UserAgentMac.mm: * platform/mac/WebCoreView.h: * platform/mac/WebCoreView.m: * platform/mac/WidgetMac.mm: * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h: * platform/network/ios/NetworkStateNotifierIOS.mm: * platform/network/ios/WebCoreURLResponseIOS.h: * platform/network/ios/WebCoreURLResponseIOS.mm: * platform/network/mac/NetworkStateNotifierMac.cpp: 2018-02-15 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderTableSection::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182835 <rdar://problem/37579191> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::willInsertTableRow): (WebCore::RenderTableSection::addChild): Deleted. * rendering/RenderTableSection.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): Leftover from r228529. (WebCore::RenderTreeBuilder::insertChildToRenderTable): Deleted. Leftover from r228529. (WebCore::RenderTreeBuilder::insertChildToRenderTableSection): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::insertChild): 2018-02-15 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderTable::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182832 <rdar://problem/37576362> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderTable.cpp: (WebCore::RenderTable::willInsertTableColumn): (WebCore::RenderTable::willInsertTableSection): (WebCore::RenderTable::addChild): Deleted. * rendering/RenderTable.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::insertChild): 2018-02-14 Darin Adler <darin@apple.com> Use std::make_unique instead of explicit calls to new and instead of writing create functions https://bugs.webkit.org/show_bug.cgi?id=182821 Reviewed by Anders Carlsson. * loader/LinkLoader.cpp: (WebCore::createLinkPreloadResourceClient): Use std::make_unique insteadof create functions. * loader/LinkPreloadResourceClients.h: Make constructors public, get rid of create functions, make overrides be private and final, get rid of unnecessary public default virtual destructors that the compiler will generate correctly without anything explicit. * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::CDMFactoryClearKey::createCDM): Use std::make_unique instead of std::unique_ptr/new. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Use std::make_unique instead of calling a create function. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Ditto. * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h: Made the constructor public and got rid of the create function. * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm: (WebCore::VideoFullscreenLayerManager::create): Deleted. * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithm::computeFlexFactorUnitSize const): Use std::make_unique instead of std::unique_ptr/new. 2018-02-15 Andy Estes <aestes@apple.com> Finish unifying Apple Pay and Payment Request sources https://bugs.webkit.org/show_bug.cgi?id=182831 Reviewed by Keith Miller. * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: 2018-02-15 Zan Dobersek <zdobersek@igalia.com> HarfBuzzFace: rework cache entry reference holding https://bugs.webkit.org/show_bug.cgi?id=182828 Reviewed by Michael Catanzaro. Move the FaceCacheEntry and HarfBuzzFaceCache types into the HarfBuzzFace class as CacheEntry and Cache, respectively. The Cache singleton is also moved there. In the HarfBuzzFace constructor, we now don't increase the CacheEntry reference, but instead just keep a reference to that object through a RefPtr<CacheEntry> object. We don't need to retrieve the hb_face_t object and the glyph cache HashMap in the constructor anymore, we just retrieve them when necessary through that CacheEntry reference. In the destructor, that RefPtr<CacheEntry> object is nulled out before the object in Cache is removed if that's where the final reference is kept. * platform/graphics/harfbuzz/HarfBuzzFace.cpp: (WebCore::HarfBuzzFace::CacheEntry::CacheEntry): (WebCore::HarfBuzzFace::CacheEntry::~CacheEntry): (WebCore::HarfBuzzFace::cache): (WebCore::HarfBuzzFace::HarfBuzzFace): (WebCore::HarfBuzzFace::~HarfBuzzFace): (WebCore::HarfBuzzFace::setScriptForVerticalGlyphSubstitution): (WebCore::FaceCacheEntry::create): Deleted. (WebCore::FaceCacheEntry::~FaceCacheEntry): Deleted. (WebCore::FaceCacheEntry::face): Deleted. (WebCore::FaceCacheEntry::glyphCache): Deleted. (WebCore::FaceCacheEntry::FaceCacheEntry): Deleted. (WebCore::harfBuzzFaceCache): Deleted. * platform/graphics/harfbuzz/HarfBuzzFace.h: (WebCore::HarfBuzzFace::CacheEntry::create): (WebCore::HarfBuzzFace::CacheEntry::face): (WebCore::HarfBuzzFace::CacheEntry::glyphCache): * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: (WebCore::harfBuzzGetGlyph): (WebCore::HarfBuzzFace::createFont): 2018-02-15 Zan Dobersek <zdobersek@igalia.com> FontPlatformData::harfBuzzFace() should return a reference https://bugs.webkit.org/show_bug.cgi?id=182825 Reviewed by Carlos Garcia Campos. Have FontPlatformData::harfBuzzFace() return a reference instead of a pointer, given that the returned HarfBuzzFace object cannot be null. Call-sites of FontPlatformData::harfBuzzFace() are adjusted. OpenTypeMathData constructors are also changed to not rely on preprocessor to correctly position the closing brace. * platform/graphics/FontPlatformData.h: * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::FontPlatformData::harfBuzzFace const): * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): * platform/graphics/opentype/OpenTypeMathData.cpp: (WebCore::OpenTypeMathData::OpenTypeMathData): 2018-02-15 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Revisit the whole async model of task dispatching, timeout and aborting https://bugs.webkit.org/show_bug.cgi?id=181946 <rdar://problem/37258262> Reviewed by Chris Dumez. This patch changes the original async model from a work queue to IPC between WebProcess and UIProcess. Since all authenticator operations must be handled in the UIProcess due to sandboxing, this message passing IPC async model then surpasses the original multi threading model. To cooperate that, a CredentialsMessenger class is then created and all task dispatching code is moved thre. As an improvement over existing code, static functions from PublicKeyCredential are moved to AuthenticatorManager. AuthenticatorManager is made as a singleton such that when static functions are called, they could reach the CredentialsMessenger to interact with UIProccess. CredentialsMessenger and AuthenticatorManager are separated so later on when other Credential types are created, they can reuse the same IPC messenger. What's more, a mock CredentialsMessenger is then created to mock behaviors of UIProcess for testing purpose. Covered by existing tests. * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::doesHaveSameOriginAsItsAncestors): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::PendingPromise::PendingPromise): Deleted. (WebCore::CredentialsContainer::dispatchTask): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): Deleted. * Modules/credentialmanagement/CredentialsMessenger.cpp: Added. (WebCore::CredentialsMessenger::exceptionReply): (WebCore::CredentialsMessenger::addCreationCompletionHandler): (WebCore::CredentialsMessenger::takeCreationCompletionHandler): (WebCore::CredentialsMessenger::addRequestCompletionHandler): (WebCore::CredentialsMessenger::takeRequestCompletionHandler): (WebCore::CredentialsMessenger::addQueryCompletionHandler): (WebCore::CredentialsMessenger::takeQueryCompletionHandler): (WebCore::getIdFromAttestationObject): * Modules/credentialmanagement/CredentialsMessenger.h: Added. (WebCore::CreationReturnBundle::CreationReturnBundle): (WebCore::AssertionReturnBundle::AssertionReturnBundle): (WebCore::CredentialsMessenger::weakPtrFactory const): * Modules/webauthn/Authenticator.cpp: Removed. * Modules/webauthn/Authenticator.h: Removed. * Modules/webauthn/AuthenticatorManager.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp. (WebCore::AuthenticatorManagerInternal::produceClientDataJson): (WebCore::AuthenticatorManagerInternal::produceClientDataJsonHash): (WebCore::AuthenticatorManagerInternal::initTimer): (WebCore::AuthenticatorManagerInternal::didTimerFire): (WebCore::AuthenticatorManager::singleton): (WebCore::AuthenticatorManager::setMessenger): (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): * Modules/webauthn/AuthenticatorManager.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): Deleted. (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): Deleted. (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): Deleted. (WebCore::PublicKeyCredential::collectFromCredentialStore): Deleted. (WebCore::PublicKeyCredential::discoverFromExternalSource): Deleted. (WebCore::PublicKeyCredential::store): Deleted. (WebCore::PublicKeyCredential::create): Deleted. (WebCore::PublicKeyCredential::rawId const): Deleted. (WebCore::PublicKeyCredential::response const): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::mockCredentialsMessenger const): * testing/Internals.h: * testing/Internals.idl: * testing/MockCredentialsMessenger.cpp: Added. (WebCore::MockCredentialsMessenger::MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::~MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::setAttestationObject): (WebCore::MockCredentialsMessenger::setAssertionReturnBundle): (WebCore::MockCredentialsMessenger::makeCredential): (WebCore::MockCredentialsMessenger::getAssertion): (WebCore::MockCredentialsMessenger::makeCredentialReply): (WebCore::MockCredentialsMessenger::getAssertionReply): * testing/MockCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * testing/MockCredentialsMessenger.idl: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. 2018-02-15 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderInline/RenderGrid::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182819 <rdar://problem/37558187> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::addChild): Deleted. * rendering/RenderGrid.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::addChild): Deleted. * rendering/RenderInline.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::takeChild): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): * rendering/updating/RenderTreeBuilderSVG.cpp: (WebCore::RenderTreeBuilder::SVG::insertChild): 2018-02-15 Antoine Quint <graouts@apple.com> [Modern Media Controls] REGRESSION: Inline media controls are not disabled while in fullscreen on iOS https://bugs.webkit.org/show_bug.cgi?id=182830 <rdar://problem/37537909> Reviewed by Eric Carlson. The test media/modern-media-controls/media-controller/ios/media-controller-stop-updates-in-fullscreen.html regressed when fixing webkit.org/b/182668 since we now started only caring about the presence of the "controls" attribute to identify that WebKit media controls should be available. We now have a dedicated _shouldControlsBeAvailable() method which more clearly establishes the conditions under which controls should be available and correctly disables them while in fullscreen on iOS, regardless of the "controls" attribute value. * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype._shouldControlsBeAvailable): (MediaController.prototype._updateControlsAvailability): 2018-02-15 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r228495. This caused mulitple perf tests to fail consistently. Reverted changeset: "Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database" https://bugs.webkit.org/show_bug.cgi?id=182812 https://trac.webkit.org/changeset/228495 2018-02-15 Zan Dobersek <zdobersek@igalia.com> Clean up HarfBuzzFaceCairo https://bugs.webkit.org/show_bug.cgi?id=182824 Reviewed by Carlos Garcia Campos. Clean up Cairo-specific bits of HarfBuzzFace implementation. HarfBuzzFontData is simplified, removing the constructor and turning the cairo_scaled_font_t member into a RefPtr<>, tying the Cairo object's lifetime to the lifetime of the HarfBuzzFontData instance. HarfBuzz font callbacks have the HarfBuzzFontData casting cleaned up, casting the user data pointer straight into a HarfBuzzFontData reference that's then used in the functions. HarfBuzzFontData member access is also adjusted. HarfBuzzFace::createFace() now references the cairo_scaled_font_t object that is then set as the user data pointer, with the destroy callback that dereferences that object also specified. With hb_face_t being a reference-counted object itself, this ensures the cairo_scaled_font_t object doesn't get destroyed while hb_face_t is still alive. In HarfBuzzFace::createFont(), the hb_font_t creation is cleaned up, with a C++ lambda used as the destroy callback. * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: (WebCore::harfBuzzGetGlyph): (WebCore::harfBuzzGetGlyphHorizontalAdvance): (WebCore::harfBuzzGetGlyphExtents): (WebCore::harfBuzzCairoGetTable): (WebCore::HarfBuzzFace::createFace): (WebCore::HarfBuzzFace::createFont): (WebCore::HarfBuzzFontData::HarfBuzzFontData): Deleted. (WebCore::destroyHarfBuzzFontData): Deleted. 2018-02-15 Philippe Normand <pnormand@igalia.com> [GStreamer] WebVTT caps changed in GStreamer 1.14 https://bugs.webkit.org/show_bug.cgi?id=182690 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Use text/vtt caps only for GStreamer versions inferior or equal to 1.12. In 1.13 (current git master) the VTT caps format changed to application/x-subtitle-vtt. 2018-02-15 Zan Dobersek <zdobersek@igalia.com> HarfBuzzFace should not be ref-counted https://bugs.webkit.org/show_bug.cgi?id=182823 Reviewed by Carlos Garcia Campos. The HarfBuzzFace objects shouldn't be copied along in FontPlatformData copy assignment operator, which made it a requirement for that class to be ref-counted. Cairo-based HarfBuzzFace implementation uses the cairo_scaled_font_t object from FontPlatformData internally, but upon FontPlatformData cloning that scaled font object could change, meaning HarfBuzzFace object that's shared with another FontPlatformData object would end up using a different cairo_scaled_font_t object from the one that's been regenerated in the newly-cloned FontPlatformData object. Instead of ref-counting the HarfBuzzFace objects, they should be handled in FontPlatformData through std::unique_ptr<>. In the FontPlatformData copy assignment operator, the copy target's m_harfBuzzFace object is nulled out, allowing the next harfBuzzFace() call to construct an object that properly leverages the cairo_scaled_font_t object that could have changed during cloning. * platform/graphics/FontPlatformData.h: * platform/graphics/freetype/FontPlatformDataFreeType.cpp: (WebCore::FontPlatformData::operator=): (WebCore::FontPlatformData::harfBuzzFace const): * platform/graphics/harfbuzz/HarfBuzzFace.h: (WebCore::HarfBuzzFace::create): Deleted. 2018-02-14 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderMathMLFenced::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182817 <rdar://problem/37556761> Reviewed by Antti Koivisto. No change in functionality. * rendering/mathml/RenderMathMLFenced.cpp: (WebCore::RenderMathMLFenced::addChild): Deleted. * rendering/mathml/RenderMathMLFenced.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderMathML.cpp: (WebCore::RenderTreeBuilder::MathML::insertChild): 2018-02-14 Antti Koivisto <antti@apple.com> Do sibling invalidation on mutation https://bugs.webkit.org/show_bug.cgi?id=182809 Reviewed by Zalan Bujtas. We used to invalidate siblings for sibling combinators and nth-pseudo classes during style resolution tree walk. This would consider any element with invalid style a reason to invalidate siblings too. However we now do accurate invalidation on class and attribute changes and this approach ends up invalidating too much. This patch sibling style invalidation to mutation time and removes invalidation code from style resolution tree walk. * dom/Element.cpp: (WebCore::invalidateSiblingsIfNeeded): Helper to invalidate siblings. (WebCore::Element::invalidateStyle): (WebCore::Element::invalidateStyleAndLayerComposition): (WebCore::Element::invalidateStyleForSubtree): (WebCore::Element::invalidateStyleAndRenderersForSubtree): Invalidate siblings if needed based on affectsNextSibling/affectedByPreviousSibling bits. (WebCore::Element::invalidateStyleInternal): (WebCore::Element::invalidateStyleForSubtreeInternal): Add "internal" versions that don't invalidate siblings. These are used by StyleInvalidator for accurate invalidation. * dom/Element.h: * style/StyleInvalidator.cpp: (WebCore::Style::Invalidator::invalidateIfNeeded): (WebCore::Style::Invalidator::invalidateStyle): Use internal invalidation functions. * style/StyleTreeResolver.cpp: (WebCore::Style::resetStyleForNonRenderedDescendants): (WebCore::Style::TreeResolver::resolveComposedTree): Remove sibling invalidation. * style/StyleTreeResolver.h: 2018-02-14 John Wilander <wilander@apple.com> Resource Load Statistics: Make sure WebResourceLoadStatisticsStore::mergeWithDataFromDecoder() can ingest older plist versions and not reset the database https://bugs.webkit.org/show_bug.cgi?id=182812 <rdar://problem/37511406> Reviewed by Brent Fulgham. No new tests. Tested manually between versions of Safari. * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::decode): Now only expects these fields for model version 11 or higher: - topFrameUniqueRedirectsTo - topFrameUniqueRedirectsFrom - subresourceUniqueRedirectsFrom - timesAccessedAsFirstPartyDueToUserInteraction - timesAccessedAsFirstPartyDueToStorageAccessAPI * loader/ResourceLoadStatistics.h: 2018-02-14 Basuke Suzuki <Basuke.Suzuki@sony.com> [WinCairo] Fix several build warnings under WebCore/platform https://bugs.webkit.org/show_bug.cgi?id=182802 Reviewed by Konstantin Tokarev. Warning C4101 'fileModificationDate': unreferenced local variable Source\WebCore\platform\network\curl\CurlCacheEntry.cpp:279 Warning C4239 nonstandard extension used: 'argument': conversion from 'WTF::String' to 'WTF::String &' Source\WebCore\platform\text\win\LocaleWin.cpp:75 Source\WebCore\platform\text\win\LocaleWin.cpp:77 Warning C4838 conversion from 'UINT' to 'CLIPFORMAT' requires a narrowing conversion Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:170 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:325 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:332 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:351 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:358 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:366 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:373 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:380 Source\WebCore\platform\win\ClipboardUtilitiesWin.cpp:387 * platform/network/curl/CurlCacheEntry.cpp: (WebCore::CurlCacheEntry::parseResponseHeaders): * platform/text/win/LocaleWin.cpp: (WebCore::LCIDFromLocaleInternal): * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::registerClipboardFormat): (WebCore::texthtmlFormat): (WebCore::urlWFormat): (WebCore::urlFormat): (WebCore::filenameWFormat): (WebCore::filenameFormat): (WebCore::htmlFormat): (WebCore::smartPasteFormat): (WebCore::fileDescriptorFormat): (WebCore::fileContentFormatZero): 2018-02-14 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderSVG*::addChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182811 <rdar://problem/37549714> Reviewed by Antti Koivisto. No change in functionality. * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::addChild): Deleted. * rendering/svg/RenderSVGContainer.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::addChild): Deleted. * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::addChild): Deleted. * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::addChild): Deleted. * rendering/svg/RenderSVGText.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::insertChildToSVGContainer): Deleted. (WebCore::RenderTreeBuilder::insertChildToSVGInline): Deleted. (WebCore::RenderTreeBuilder::insertChildToSVGRoot): Deleted. (WebCore::RenderTreeBuilder::insertChildToSVGText): Deleted. * rendering/updating/RenderTreeBuilder.h: 2018-02-14 Daniel Bates <dabates@apple.com> Disallow cross-origin subresources from asking for credentials https://bugs.webkit.org/show_bug.cgi?id=182579 <rdar://problem/36162271> Reviewed by Andy Estes. Prompts for credentials to load cross-origin subresources are typically seen as unexpected by a person that navigates to- or interacts with- a web page. The cross-origin and implicit loading nature of these subresources makes asking for credentials questionable because they are not being served by the same origin of the page a person explicitly loaded and are not guaranteed to correspond to an explicit user interaction other than the initial load of the page. We know that subresources that ask for credentials can be abused as part of a phishing attack. It seems reasonable to disallow cross-origin subresources from asking for credentials due to their questionable nature and the risk for abuse. This will also make the behavior of WebKit match the behavior of Chrome. Tests: http/tests/media/video-auth-with-allowCrossOriginSubresourcesToAskForCredentials.html http/tests/security/basic-auth-subresource.html http/tests/security/mixedContent/insecure-basic-auth-image-allowCrossOriginSubresourcesToAskForCredentials.https.html http/tests/security/mixedContent/insecure-image-redirects-to-basic-auth-secure-image-allowCrossOriginSubresourcesToAskForCredentials.html http/tests/security/mixedContent/secure-redirect-to-insecure-redirect-to-basic-auth-secure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-insecure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-secure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::isSubresourceLoader const): Formerly non-const. (WebCore::ResourceLoader::shouldAllowResourceToAskForCredentials const): Added. (WebCore::ResourceLoader::didBlockAuthenticationChallenge): Emit Web Inspector console message if the authentication challenge was blocked because the request is cross origin. (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const): Disallow a cross-origin request from prompting for credentials. (WebCore::ResourceLoader::isSubresourceLoader): Deleted; made const. * loader/ResourceLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::SubresourceLoader): Update ResourceLoader state so that block cross-origin subresources from prompting for credentials, if applicable. (WebCore::SubresourceLoader::isSubresourceLoader const): Formerly non-const. (WebCore::SubresourceLoader::isSubresourceLoader): Deleted; made const. * loader/SubresourceLoader.h: * page/Settings.yaml: Add setting allowCrossOriginSubresourcesToAskForCredentials (defaults: false - do not allow cross origin subresources to ask for credentials). 2018-02-14 Don Olmstead <don.olmstead@sony.com> WebCore headers should not include config.h or PlatformExportMacros.h https://bugs.webkit.org/show_bug.cgi?id=182799 Reviewed by Darin Adler. No new tests. No change in behavior. * Modules/speech/SpeechSynthesis.h: * bindings/js/JSDOMGlobalObject.h: * contentextensions/ContentExtensionError.h: * contentextensions/DFA.h: * dom/ContextDestructionObserver.h: * dom/DeviceOrientationClient.h: * dom/DeviceOrientationData.h: * editing/cocoa/HTMLConverter.h: * loader/FrameLoaderStateMachine.h: * loader/cache/CachedResourceHandle.h: * page/FrameDestructionObserver.h: * page/RuntimeEnabledFeatures.h: * platform/URL.h: * platform/audio/AudioHardwareListener.h: * platform/audio/AudioSession.h: * platform/graphics/Color.h: * platform/graphics/IntSize.h: * platform/graphics/transforms/AffineTransform.h: * platform/graphics/win/LocalWindowsContext.h: * platform/network/CacheValidation.h: * platform/network/CredentialBase.h: * platform/network/ResourceHandleClient.h: * platform/network/cf/CertificateInfo.h: 2018-02-12 Ryosuke Niwa <rniwa@webkit.org> REGRESSION (r223440): Copying & pasting a list from Microsoft Word to TinyMCE fails https://bugs.webkit.org/show_bug.cgi?id=182564 Reviewed by Wenson Hsieh. Unfortunately, r228352 was inadaquate to fix copying & pasting of a list item from Microsoft Word into TinyMCE in older verions of TinyMCE. This patch amends the approach taken by r228352 to make it work across the board as well as unbreak GMail. Turns out older versions of TinyMCE can't handle list items when computed styles are added as inline style declarations by WebKit. To make this work, avoid adding any computed styles as inline styles within mso-list conditionals as well as any p elements whose style attribute contains "mso-list" property. We would instead preserve these styles by keeping Microsoft Word's CSS style rules in addition to special @list rules. In addition, not keeping the style element of Microsoft Word in a head element as done in r228352 causes some versions of TinyMCE to treat it as regular text, and inserting a bunch of @list rules as user visible text. To work around this problem, we serialize the style rules as a comment (<!-- ~ -->) within a head element. Furthermore, when Microsoft Word is in the compatibility mode, it does not generate xmlns:o as the first xmlns declaration. Generalized the code to detect Microsoft Word's HTML declaration by looking for xmlns:o and xmlns:w xmls declarations. Finally, it turns out that Gmail has its own handling of list items copy & pasted from Microsoft Word, and also needs this quirks but in the pasted HTML, not the one exposed in getData. As such, this patch also enables the MSO list quirks in the pasted content as well as the one exposed in getData. Tests: PasteHTML.PreservesMSOList PasteHTML.PreservesMSOListInCompatibilityMode PasteHTML.StripsMSOListWhenMissingMSOHTMLElement PasteWebArchive.PreservesMSOList PasteWebArchive.PreservesMSOListInCompatibilityMode PasteWebArchive.StripsMSOListWhenMissingMSOHTMLElement * editing/HTMLInterchange.h: * editing/ReplaceSelectionCommand.cpp: (WebCore::removeHeadContents): Don't remove the special style element needed for the MSO list quirks since we don't keep the computed style as inline styles in this case. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readWebArchive): Enable the quirks in the pasted content as well as opposed to just in DataTransfer API exposed to the JavaScript. (WebCore::WebContentReader::readHTML): Ditto. * editing/markup.cpp: (WebCore::shouldPreserveMSOLists): Added. Generalized the logic to detect a Microsoft Word document. more xmlns declarations. (WebCore::StyledMarkupAccumulator::shouldPreserveMSOListStyleForElement): Added. (WebCore::StyledMarkupAccumulator::appendElement): Don't generate the second style element here for elements with most-list properties. Instead, avoid overriding inline styles with computed styles altogether. (WebCore::StyledMarkupAccumulator::appendNodeToPreserveMSOList): Include the style rules as well as list rules and wrap the "style" element in a "head" element to make it compatible with older versions of TinyMCE. 2018-02-14 Dean Jackson <dino@apple.com> CrashTracer: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot + 618 https://bugs.webkit.org/show_bug.cgi?id=182798 <rdar://problem/23337253> Reviewed by Eric Carlson. Speculative fix for a crash in HTMLPlugInImageElement::didAddUserAgentShadowRoot. The guess is that the m_swapRendererTimer is set, and the display state changes to something that does not require a shadow root, but before the timer fires. Fix this by ensuring that the timer is reset on every display state change. * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::setDisplayState): Guard for sets that wouldn't actually change value, and make sure we always reset the timer. 2018-02-14 Antoine Quint <graouts@apple.com> [Modern Media Controls] Don't use arrays as values for localisable strings https://bugs.webkit.org/show_bug.cgi?id=182791 <rdar://problem/36007262> Reviewed by Dean Jackson. Localization tools expect localizable strings to be specified as key-value pairs where both the key and the pair are plain strings. For the skip buttons, we used an array value to specify a replacement string. We now perform this task in code with a centralized SkipSeconds constant defining the skip amount. * English.lproj/modern-media-controls-localized-strings.js: * Modules/modern-media-controls/controls/icon-service.js: * Modules/modern-media-controls/main.js: (UIString): * Modules/modern-media-controls/media/skip-back-support.js: (SkipBackSupport.prototype.buttonWasPressed): * Modules/modern-media-controls/media/skip-forward-support.js: (SkipForwardSupport.prototype.buttonWasPressed): 2018-02-14 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r228444. Introduced API and Layout test failures. Reverted changeset: "[WebAuthN] Revisit the whole async model of task dispatching, timeout and aborting" https://bugs.webkit.org/show_bug.cgi?id=181946 https://trac.webkit.org/changeset/228444 2018-02-14 Brent Fulgham <bfulgham@apple.com> Confirm proper thread in UserGestureIndicator constructor https://bugs.webkit.org/show_bug.cgi?id=175980 Reviewed by Daniel Bates. Document is a main-thread object. If we enter the UserGestureIndicator constructor on a non-main thread, we should ASSERT, not return silently. * dom/UserGestureIndicator.cpp: (WebCore::UserGestureIndicator::UserGestureIndicator): 2018-02-14 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Remove redundant RenderTreeBuilder methods https://bugs.webkit.org/show_bug.cgi?id=182770 <rdar://problem/37525627> Reviewed by Daniel Bates. No change in functionality. * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::dropAnonymousBoxChild): Deleted. (WebCore::RenderTreeBuilder::moveRubyChildren): Deleted. (WebCore::RenderTreeBuilder::resolveMovedChildForMultiColumnFlow): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlockFlow.cpp: (WebCore::RenderTreeBuilder::BlockFlow::insertChild): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::insertChild): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::takeChild): 2018-02-14 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderElement::takeChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182762 <rdar://problem/37523756> Reviewed by Daniel Bates. This patch removes the remaining takeChild() related mutation logic from the renderers. No change in functionality. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildTo): * rendering/RenderElement.cpp: (WebCore::RenderElement::takeChild): Deleted. (WebCore::RenderElement::takeChildInternal): Deleted. * rendering/RenderElement.h: * rendering/RenderObject.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock): (WebCore::RenderTreeBuilder::takeChildFromRenderElement): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock): (WebCore::RenderTreeBuilder::Block::takeChild): (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::splitFlow): (WebCore::RenderTreeBuilder::Inline::splitInlines): (WebCore::RenderTreeBuilder::Inline::childBecameNonInline): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::takeChild): * rendering/updating/RenderTreeBuilderSVG.cpp: (WebCore::RenderTreeBuilder::SVG::takeChild): Leftover from the previous patch. 2018-02-13 Antti Koivisto <antti@apple.com> REGRESSION(r228313): Membuster | macOS | All Devices | 1.5 MB https://bugs.webkit.org/show_bug.cgi?id=182744 <rdar://problem/37463770> Reviewed by Zalan Bujtas. We need to respect low memory notifications explicitly now that the compiled selectors are not part of RuleData. * css/StyleRule.cpp: (WebCore::StyleRule::StyleRule): * css/StyleRule.h: Switch to std::unique_ptr<[]> from Vector to avoid unnecessary bloat. * css/StyleSheetContents.cpp: (WebCore::traverseRulesInVector): (WebCore::StyleSheetContents::traverseRules const): Add a rule traversal function, similar to the existing traverseSubresources. (WebCore::StyleSheetContents::traverseSubresources const): Use traverseRules to implement traverseSubresources. (WebCore::traverseSubresourcesInRules): Deleted. * css/StyleSheetContents.h: * page/MemoryRelease.cpp: (WebCore::releaseCriticalMemory): * style/StyleScope.cpp: (WebCore::Style::Scope::releaseMemory): Release memory for compiled selectors on memory notification. * style/StyleScope.h: 2018-02-13 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r228431. https://bugs.webkit.org/show_bug.cgi?id=182766 Regressed CMake build stability (Requested by dolmstead on #webkit). Reverted changeset: "[CMake] Make WebCore headers copies" https://bugs.webkit.org/show_bug.cgi?id=182512 https://trac.webkit.org/changeset/228431 2018-02-13 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r228437, r228439, and r228440. https://bugs.webkit.org/show_bug.cgi?id=182756 Introduced LayoutTest failures (Requested by ryanhadd_ on #webkit). Reverted changesets: "[Web Animations] Make KeyframeEffect target nullable and read-write" https://bugs.webkit.org/show_bug.cgi?id=182741 https://trac.webkit.org/changeset/228437 "Unreviewed attempt to fix build after r228437." https://trac.webkit.org/changeset/228439 "[Web Animations] Make KeyframeEffect target nullable and read-write" https://bugs.webkit.org/show_bug.cgi?id=182741 https://trac.webkit.org/changeset/228440 2018-02-13 Antoine Quint <graouts@apple.com> Removing the controls attribute from a <video> element does not tear down the controls shadow DOM nor cancel event listeners. https://bugs.webkit.org/show_bug.cgi?id=182668 <rdar://problem/33793004> Reviewed by Jer Noble. When controls were turned off for inline media players, we would remove all media controls elements from the shadow root, but we would nevertheless continue to listen to media events and, as a result, update properties of the media controls which would lead to requestAnimationFrame() calls that would update the detached DOM nodes. We now only listent to media events if controls are turned on. * Modules/modern-media-controls/media/controls-visibility-support.js: (ControlsVisibilitySupport.prototype.enable): Remove the mutation observer from ControlsVisibilitySupport since observing changes to the controls attribute is now performed directly in MediaController. We need to make sure that we update the controls however since fadesWhileIdle is turned off in the disable() call to ensure that the auto-hide behavior is disabled as well. (ControlsVisibilitySupport.prototype.disable): Disable the auto-hide controller as well. (ControlsVisibilitySupport.prototype._updateControls): Remove code that has now been moved into MediaController._updateControlsAvailability(). * Modules/modern-media-controls/media/media-controller.js: (MediaController): Listen to the "play" event on the media so that we call _updateControlsAvailability() in this situation to account for shouldForceControlsDisplay on MediaControlsHost. We also register for a mutation observer to track when the controls attribute availability changes in which case we want to call _updateControlsAvailability() as well. (MediaController.prototype.handleEvent): Call _updateControlsAvailability() instead of _updateiOSFullscreenProperties() which has been renamed and expanded. (MediaController.prototype._updateControlsIfNeeded): Call _updateControlsAvailability() after controls have been updated. (MediaController.prototype._updateControlsAvailability): We now disable supporting media controller objects when we know that controls should be hidden in all cases except when in fullscreen on macOS. (MediaController.prototype._updateiOSFullscreenProperties): Deleted. * Modules/modern-media-controls/media/placard-support.js: (PlacardSupport.prototype.disable): Only allow the media events required to track when to show placards when in fullscreen since inline media players need to show the AirPlay and picture-in-picture placards even when controls are disabled. 2018-02-13 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Revisit the whole async model of task dispatching, timeout and aborting https://bugs.webkit.org/show_bug.cgi?id=181946 <rdar://problem/37258262> Reviewed by Chris Dumez. This patch changes the original async model from a work queue to IPC between WebProcess and UIProcess. Since all authenticator operations must be handled in the UIProcess due to sandboxing, this message passing IPC async model then surpasses the original multi threading model. To cooperate that, a CredentialsMessenger class is then created and all task dispatching code is moved thre. As an improvement over existing code, static functions from PublicKeyCredential are moved to AuthenticatorManager. AuthenticatorManager is made as a singleton such that when static functions are called, they could reach the CredentialsMessenger to interact with UIProccess. CredentialsMessenger and AuthenticatorManager are separated so later on when other Credential types are created, they can reuse the same IPC messenger. What's more, a mock CredentialsMessenger is then created to mock behaviors of UIProcess for testing purpose. Covered by existing tests. * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::doesHaveSameOriginAsItsAncestors): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::PendingPromise::PendingPromise): Deleted. (WebCore::CredentialsContainer::dispatchTask): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): Deleted. * Modules/credentialmanagement/CredentialsMessenger.cpp: Added. (WebCore::CredentialsMessenger::exceptionReply): (WebCore::CredentialsMessenger::addCreationCompletionHandler): (WebCore::CredentialsMessenger::takeCreationCompletionHandler): (WebCore::CredentialsMessenger::addRequestCompletionHandler): (WebCore::CredentialsMessenger::takeRequestCompletionHandler): (WebCore::CredentialsMessenger::addQueryCompletionHandler): (WebCore::CredentialsMessenger::takeQueryCompletionHandler): (WebCore::getIdFromAttestationObject): * Modules/credentialmanagement/CredentialsMessenger.h: Added. (WebCore::CreationReturnBundle::CreationReturnBundle): (WebCore::AssertionReturnBundle::AssertionReturnBundle): (WebCore::CredentialsMessenger::weakPtrFactory const): * Modules/webauthn/Authenticator.cpp: Removed. * Modules/webauthn/Authenticator.h: Removed. * Modules/webauthn/AuthenticatorManager.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp. (WebCore::AuthenticatorManagerInternal::produceClientDataJson): (WebCore::AuthenticatorManagerInternal::produceClientDataJsonHash): (WebCore::AuthenticatorManagerInternal::initTimer): (WebCore::AuthenticatorManagerInternal::didTimerFire): (WebCore::AuthenticatorManager::singleton): (WebCore::AuthenticatorManager::setMessenger): (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): * Modules/webauthn/AuthenticatorManager.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): Deleted. (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): Deleted. (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): Deleted. (WebCore::PublicKeyCredential::collectFromCredentialStore): Deleted. (WebCore::PublicKeyCredential::discoverFromExternalSource): Deleted. (WebCore::PublicKeyCredential::store): Deleted. (WebCore::PublicKeyCredential::create): Deleted. (WebCore::PublicKeyCredential::rawId const): Deleted. (WebCore::PublicKeyCredential::response const): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::mockCredentialsMessenger const): * testing/Internals.h: * testing/Internals.idl: * testing/MockCredentialsMessenger.cpp: Added. (WebCore::MockCredentialsMessenger::setAttestationObject): (WebCore::MockCredentialsMessenger::setAssertionReturnBundle): (WebCore::MockCredentialsMessenger::makeCredential): (WebCore::MockCredentialsMessenger::getAssertion): (WebCore::MockCredentialsMessenger::makeCredentialReply): (WebCore::MockCredentialsMessenger::getAssertionReply): * testing/MockCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * testing/MockCredentialsMessenger.idl: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. 2018-02-13 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlock::takeChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182746 <rdar://problem/37512871> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::takeChild): Deleted. * rendering/RenderBlock.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList): (WebCore::RenderTreeBuilder::takeChildFromRenderButton): (WebCore::RenderTreeBuilder::takeChildFromRenderGrid): (WebCore::RenderTreeBuilder::takeChildFromRenderBlock): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::takeChild): 2018-02-13 Antoine Quint <graouts@apple.com> [Web Animations] Make KeyframeEffect target nullable and read-write https://bugs.webkit.org/show_bug.cgi?id=182741 Additional unreviewed attempt to fix build after r228437. * dom/Element.h: 2018-02-13 Chris Dumez <cdumez@apple.com> Unreviewed attempt to fix build after r228437. * dom/Element.h: 2018-02-13 Antoine Quint <graouts@apple.com> [Web Animations] Make KeyframeEffect target nullable and read-write https://bugs.webkit.org/show_bug.cgi?id=182741 Reviewed by Dean Jackson. We used to completely disregard null targets, for instance not parsing keyframes, but targets can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL for KeyframeEffect to mark the target property as read-write and update the implementation to correctly handle null targets by creating a StyleResolver based on the ScriptExecutionContext's document's document element (the <html> element in practice) and not the target itself, since it can be null. This revealed a few issues in our implementation by allowing more WPT tests to run. So we also ensure that: - we don't crash when parsing font-related properties by calling update() on the generated RenderStyle's FontCascade when parsing keyframes. - CSS properties are provided as camel-case and not as hyphenated form - values provided in keyframes dictionaries are only read for valid properties - styles for effect targets are invalidated as soon as the timing model for that animation is changed We also rename AnimationTimeline::animationTimingModelDidChange() to AnimationTimeline::timingModelDidChange() since the previous name didn't add useful information and we're adding a new WebAnimation::timingModelDidChange() method, so having the two methods have a similar name made more sense. * animation/Animatable.idl: Call animate() with a ScriptExecutionContext rather than a ScriptState so that the ScriptExecutionContext can be passed to the KeyframeEffectReadOnly constructor. * animation/AnimationEffectReadOnly.h: Add a new invalidate() method, designed to be subclassed, that is called when the timing model for this effect or owning animation has changed. * animation/AnimationTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange(). (WebCore::AnimationTimeline::addAnimation): (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::setCurrentTime): * animation/AnimationTimeline.h: Rename animationTimingModelDidChange() to timingModelDidChange(). (WebCore::AnimationTimeline::timingModelDidChange): (WebCore::AnimationTimeline::animationTimingModelDidChange): Deleted. * animation/DocumentTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange(). (WebCore::DocumentTimeline::timingModelDidChange): (WebCore::DocumentTimeline::updateAnimations): (WebCore::DocumentTimeline::animationTimingModelDidChange): Deleted. * animation/DocumentTimeline.h: Rename animationTimingModelDidChange() to timingModelDidChange(). * animation/KeyframeEffect.cpp: Expect a ScriptExecutionContext rather than a ScriptState. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::setKeyframes): * animation/KeyframeEffect.h: Expect a ScriptExecutionContext rather than a ScriptState. * animation/KeyframeEffect.idl: Expect a ScriptExecutionContext rather than a ScriptState and make the target property read-write. * animation/KeyframeEffectReadOnly.cpp: (WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName so that it can call that function. We also check that we reject CSS properties that are not provided in camel-case form (eg. "font-size" vs. "fontSize"). (WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name maps to a valid CSS property. (WebCore::KeyframeEffectReadOnly::create): Expect a ScriptExecutionContext rather than a ScriptState. (WebCore::KeyframeEffectReadOnly::processKeyframes): Expect a ScriptExecutionContext rather than a ScriptState and use the context's document to get an HTML element to create a StyleResolver. We also call update() on the generated RenderStyle's FontCascade since otherwise we would hit an ASSERT in FontCascade when parsing font-related CSS properties. (WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and invalidate the style of the new target and the old targets, if any. (WebCore::KeyframeEffectReadOnly::invalidate): Invalidate the target's style. This method is called by setTarget() and WebAnimation::timingModelDidChange(). * animation/KeyframeEffectReadOnly.h: Expect a ScriptExecutionContext rather than a ScriptState. * animation/KeyframeEffectReadOnly.idl: Expect a ScriptExecutionContext rather than a ScriptState. * animation/WebAnimation.cpp: (WebCore::WebAnimation::timingModelDidChange): We add this new method such that any place in WebAnimation where we know the animation's timing model has changed we can invalidate the associated effect, if any, as well as notify the timeline, if any. We used to only notify the timeline and, as a result, only invalidate the associated effect in the next display monitor refresh. (WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget() to inform the animation of the previous effect target and the new one upon a target change. This allows us to forward this information onto the timeline so that we correctly add or remove the targets from the list of animated elements. (WebCore::WebAnimation::setStartTime): * animation/WebAnimation.h: Expose the new effectTargetDidChange() and timingModelDidChange() methods. * dom/Element.cpp: Expect a ScriptExecutionContext rather than a ScriptState. (WebCore::Element::animate): * dom/Element.h: Expect a ScriptExecutionContext rather than a ScriptState. 2018-02-13 Antti Koivisto <antti@apple.com> Crash when breakpoint hit in unload handler https://bugs.webkit.org/show_bug.cgi?id=169855 <rdar://problem/28683567> Reviewed by Daniel Bates. Test: inspector/debugger/reload-paused.html CachedRawResource::updateBuffer may generate unload event in client notify callback. If Inspector was paused, this even would spawn a nested runloop. CachedRawResource::finishLoading would get called in the nested loop, confusing the DocumentLoader state machine and resulting in crashes later. * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::updateBuffer): - Set a bit when entering the client callback. - Ensure we don't re-enter updateBuffer. - If finishLoading got delayed during client callback, do it at the end. (WebCore::CachedRawResource::finishLoading): If we are in updateBuffer client callback, save the buffer and bail out. * loader/cache/CachedRawResource.h: 2018-02-13 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlockFlow::takeChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182739 <rdar://problem/37506542> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::takeChild): Deleted. * rendering/RenderBlockFlow.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): (WebCore::RenderTreeBuilder::multiColumnRelativeWillBeRemoved): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::takeChild): * rendering/updating/RenderTreeBuilderBlock.h: 2018-02-13 Don Olmstead <don.olmstead@sony.com> [CMake] Make WebCore headers copies https://bugs.webkit.org/show_bug.cgi?id=182512 Reviewed by Keith Miller. No new tests. No change in behavior. * CMakeLists.txt: * PlatformAppleWin.cmake: * PlatformGTK.cmake: * PlatformMac.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: * PlatformWinCairo.cmake: * platform/Cairo.cmake: * platform/Curl.cmake: * platform/FreeType.cmake: * platform/GStreamer.cmake: * platform/ImageDecoders.cmake: * platform/TextureMapper.cmake: * platform/graphics/win/LocalWindowsContext.h: 2018-02-13 Chris Dumez <cdumez@apple.com> REGRESSION (r228299): Broke reader mode in Safari https://bugs.webkit.org/show_bug.cgi?id=182697 <rdar://problem/37399012> Reviewed by Ryosuke Niwa. Rework the fix for r228299 to be more targeted. I moved the policy check cencelation from FrameLoader::stopLoading() to NavigationScheduler::schedule() when a pending load is cancelled by another load. I have verified that the sites fixed by r228299 still work with this more limited change. However, reader mode is now working again. The issue seems to be that we tell CFNetwork to continue with the load after receiving the response, even if the client has not responded to the decidePolicyForNavigationResponse delegate yet. As a result, CFNetwork sends us the resource data and we may commit the provisional load before receiving the policy response from the client. When the provisional load is committed, we call FrameLoader::stopLoading() which after r228299 cancelled pending policy checks. Because we did not wait for the policy check response to commit the load, we would cancel it which would make the load fail. The real fix here would be to make not tell CFNetwork to continue until after we've received the policy delegate response. However, this is a larger and riskier change at this point. I will follow-up on this issue. Covered by new API test. * loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::schedule): 2018-02-13 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderSVG*::takeChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182736 <rdar://problem/37503107> Reviewed by Antti Koivisto. No change in functionality. * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::takeChild): Deleted. * rendering/svg/RenderSVGContainer.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::takeChild): Deleted. * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::takeChild): Deleted. * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::takeChild): Deleted. * rendering/svg/RenderSVGText.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): * rendering/updating/RenderTreeBuilderSVG.cpp: (WebCore::RenderTreeBuilder::SVG::takeChild): * rendering/updating/RenderTreeBuilderSVG.h: 2018-02-13 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderGrid::takeChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182734 <rdar://problem/37500876> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::takeChild): Deleted. * rendering/RenderGrid.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChildFromRenderGrid): * rendering/updating/RenderTreeBuilder.h: 2018-02-13 Nan Wang <n_wang@apple.com> AX: Remove AccessibleNode class https://bugs.webkit.org/show_bug.cgi?id=182724 <rdar://problem/37486024> Reviewed by Chris Fleizach. Removed all the AccessibleNode related code since AOM has an alternate direction now. No new tests. Made sure existing tests don't break. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::findModalNodes): (WebCore::nodeHasRole): (WebCore::AXObjectCache::handleLiveRegionCreated): (WebCore::AXObjectCache::handleMenuItemSelected): (WebCore::AXObjectCache::handleModalChange): (WebCore::isNodeAriaVisible): * accessibility/AccessibilityARIAGrid.cpp: (WebCore::AccessibilityARIAGrid::isMultiSelectable const): * accessibility/AccessibilityARIAGridCell.cpp: (WebCore::AccessibilityARIAGridCell::readOnlyValue const): * accessibility/AccessibilityAllInOne.cpp: * accessibility/AccessibilityImageMapLink.cpp: (WebCore::AccessibilityImageMapLink::roleValue const): (WebCore::AccessibilityImageMapLink::accessibilityDescription const): * accessibility/AccessibilityListBoxOption.cpp: (WebCore::AccessibilityListBoxOption::isEnabled const): (WebCore::AccessibilityListBoxOption::stringValue const): * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::isEnabled const): (WebCore::AccessibilityNodeObject::isPressed const): (WebCore::AccessibilityNodeObject::isChecked const): (WebCore::AccessibilityNodeObject::isMultiSelectable const): (WebCore::AccessibilityNodeObject::isRequired const): (WebCore::AccessibilityNodeObject::headingLevel const): (WebCore::AccessibilityNodeObject::valueDescription const): (WebCore::AccessibilityNodeObject::valueForRange const): (WebCore::AccessibilityNodeObject::maxValueForRange const): (WebCore::AccessibilityNodeObject::minValueForRange const): (WebCore::AccessibilityNodeObject::ariaAccessibilityDescription const): (WebCore::siblingWithAriaRole): (WebCore::AccessibilityNodeObject::textForLabelElement const): (WebCore::AccessibilityNodeObject::alternativeText const): (WebCore::AccessibilityNodeObject::alternativeTextForWebArea const): (WebCore::AccessibilityNodeObject::hierarchicalLevel const): (WebCore::shouldUseAccessibilityObjectInnerText): (WebCore::AccessibilityNodeObject::stringValue const): (WebCore::accessibleNameForNode): (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute const): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::readOnlyValue const): (WebCore::AccessibilityObject::supportsAutoComplete const): (WebCore::AccessibilityObject::autoCompleteValue const): (WebCore::AccessibilityObject::ariaIsMultiline const): (WebCore::AccessibilityObject::invalidStatus const): (WebCore::AccessibilityObject::supportsCurrent const): (WebCore::AccessibilityObject::currentState const): (WebCore::AccessibilityObject::roleDescription const): (WebCore::AccessibilityObject::keyShortcutsValue const): (WebCore::AccessibilityObject::placeholderValue const): (WebCore::AccessibilityObject::supportsARIAAttributes const): (WebCore::AccessibilityObject::sortDirection const): (WebCore::AccessibilityObject::supportsHasPopup const): (WebCore::AccessibilityObject::hasPopupValue const): (WebCore::AccessibilityObject::supportsSetSize const): (WebCore::AccessibilityObject::supportsPosInSet const): (WebCore::AccessibilityObject::setSize const): (WebCore::AccessibilityObject::posInSet const): (WebCore::AccessibilityObject::supportsPressed const): (WebCore::AccessibilityObject::supportsExpanded const): (WebCore::AccessibilityObject::isExpanded const): (WebCore::AccessibilityObject::checkboxOrRadioValue const): (WebCore::AccessibilityObject::pressedIsPresent const): (WebCore::AccessibilityObject::isAXHidden const): (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const): (WebCore::AccessibilityObject::ariaDetailsElements const): (WebCore::AccessibilityObject::ariaDetailsReferencingElements const): (WebCore::AccessibilityObject::ariaErrorMessageElements const): (WebCore::AccessibilityObject::ariaErrorMessageReferencingElements const): (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild): (WebCore::AccessibilityObject::hasProperty const): Deleted. (WebCore::AccessibilityObject::stringValueForProperty const): Deleted. (WebCore::AccessibilityObject::boolValueForProperty const): Deleted. (WebCore::AccessibilityObject::intValueForProperty const): Deleted. (WebCore::AccessibilityObject::unsignedValueForProperty const): Deleted. (WebCore::AccessibilityObject::doubleValueForProperty const): Deleted. (WebCore::AccessibilityObject::elementValueForProperty const): Deleted. (WebCore::AccessibilityObject::elementsFromProperty const): Deleted. (WebCore::AccessibilityObject::elementsReferencedByProperty const): Deleted. * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::stringValue const): (WebCore::AccessibilityRenderObject::exposesTitleUIElement const): (WebCore::AccessibilityRenderObject::defaultObjectInclusion const): (WebCore::AccessibilityRenderObject::isSelected const): (WebCore::AccessibilityRenderObject::activeDescendant const): (WebCore::AccessibilityRenderObject::determineAccessibilityRole): (WebCore::AccessibilityRenderObject::orientation const): (WebCore::AccessibilityRenderObject::canSetExpandedAttribute const): (WebCore::AccessibilityRenderObject::liveRegionStatus const): (WebCore::AccessibilityRenderObject::liveRegionRelevant const): (WebCore::AccessibilityRenderObject::liveRegionAtomic const): (WebCore::AccessibilityRenderObject::isBusy const): * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::isDataTable const): (WebCore::AccessibilityTable::axColumnCount const): (WebCore::AccessibilityTable::axRowCount const): * accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::axColumnIndex const): (WebCore::AccessibilityTableCell::axRowIndex const): (WebCore::AccessibilityTableCell::axColumnSpan const): (WebCore::AccessibilityTableCell::axRowSpan const): * accessibility/AccessibilityTableRow.cpp: (WebCore::AccessibilityTableRow::axColumnIndex const): (WebCore::AccessibilityTableRow::axRowIndex const): * accessibility/AccessibleNode.cpp: Removed. * accessibility/AccessibleNode.h: Removed. * accessibility/AccessibleNode.idl: Removed. * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * bindings/js/WebCoreBuiltinNames.h: * dom/Element.cpp: (WebCore::Element::canContainRangeEndPoint const): (WebCore::Element::accessibleNode): Deleted. (WebCore::Element::existingAccessibleNode const): Deleted. * dom/Element.h: * dom/Element.idl: * dom/ElementRareData.cpp: * dom/ElementRareData.h: (WebCore::ElementRareData::accessibleNode const): Deleted. (WebCore::ElementRareData::setAccessibleNode): Deleted. * editing/TextIterator.cpp: (WebCore::isRendererReplacedElement): * rendering/RenderMenuList.cpp: (RenderMenuList::itemAccessibilityText const): 2018-02-13 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderButton::takeChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182732 <rdar://problem/37500564> Reviewed by Antti Koivisto. No change of functionality. * rendering/RenderButton.cpp: (WebCore::RenderButton::setInnerRenderer): (WebCore::RenderButton::takeChild): Deleted. * rendering/RenderButton.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChildFromRenderButton): * rendering/updating/RenderTreeBuilder.h: 2018-02-13 Alicia Boya García <aboya@igalia.com> [Gstreamer][MSE] Add string representation for GStreamerMediaSample https://bugs.webkit.org/show_bug.cgi?id=180262 Reviewed by Xabier Rodriguez-Calvar. * platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp: (WebCore::GStreamerMediaSample::offsetTimestampsBy): * platform/graphics/gstreamer/mse/GStreamerMediaSample.h: 2018-02-12 Chris Fleizach <cfleizach@apple.com> AX: defer focusedUIElement notifications https://bugs.webkit.org/show_bug.cgi?id=182643 <rdar://problem/37394310> Reviewed by Zalan Bujtas. Deferring focus changes for accessibility has a number of benefits. 1) Reduces the chance of calling into layout during layout. 2) Coalesces multiple focus notifications that would be needlessly sent. 3) Improves performance by not calling out to the accessibility notification machinery during layout. In this patch, I also started making more AXObjectCache calls private. This will reduce the chance that clients will call into AXObjectCache during unexpected times. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded): (WebCore::conditionallyAddNodeToFilterList): (WebCore::filterVectorPairForRemoval): (WebCore::filterMapForRemoval): (WebCore::filterListForRemoval): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): * accessibility/AXObjectCache.h: * dom/Document.cpp: (WebCore::Document::setFocusedElement): 2018-02-12 John Wilander <wilander@apple.com> Resource Load Statistics: Classify resources as prevalent based on redirects to other prevalent resources https://bugs.webkit.org/show_bug.cgi?id=182664 <rdar://problem/37372572> Reviewed by Brent Fulgham. Tests: http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logFrameNavigation): We now collect statistics on top frame navigational redirects too, both to and from. (WebCore::ResourceLoadObserver::logSubresourceLoading): We now collect statistics on redirects from in addition to the existing redirects to. * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::encode const): (WebCore::ResourceLoadStatistics::decode): (WebCore::ResourceLoadStatistics::toString const): (WebCore::ResourceLoadStatistics::merge): * loader/ResourceLoadStatistics.h: Three new fields: - topFrameUniqueRedirectsTo - topFrameUniqueRedirectsFrom - subresourceUniqueRedirectsFrom 2018-02-12 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderMenuList::takeChild() to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182715 <rdar://problem/37477050> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderMenuList.cpp: (RenderMenuList::takeChild): Deleted. * rendering/RenderMenuList.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList): * rendering/updating/RenderTreeBuilder.h: 2018-02-12 Ross Kirsling <ross.kirsling@sony.com> Unify UserAgent into WebCore/platform. https://bugs.webkit.org/show_bug.cgi?id=182716 Reviewed by Michael Catanzaro. No change in functionality. * SourcesCocoa.txt: * SourcesIOS.txt: * SourcesMac.txt: * WebCore.xcodeproj/project.pbxproj: * page/cocoa/UserAgent.h: Removed. * platform/UserAgent.h: * platform/cocoa/UserAgentCocoa.mm: Renamed from Source/WebCore/page/cocoa/UserAgent.mm. * platform/ios/UserAgentIOS.mm: Renamed from Source/WebCore/page/ios/UserAgentIOS.mm. * platform/mac/UserAgentMac.mm: Renamed from Source/WebCore/page/mac/UserAgentMac.mm. 2018-02-12 Antoine Quint <graouts@apple.com> [Web Animations] Support the copy constructors for KeyframeEffectReadOnly and KeyframeEffect https://bugs.webkit.org/show_bug.cgi?id=182712 Reviewed by Dean Jackson. We now support the variants for the KeyframeEffectReadOnly and KeyframeEffect constructors where another KeyframeEffectReadOnly is provided as a source. All timing, keyframe and target properties of that source are copied on the newly-constructed KeyframeEffect. To support copying properties, we add new copyPropertiesFromSource() methods to AnimationEffectTimingReadOnly and KeyframeEffectReadOnly to encapsulate copying various member variables in the relevant classes. Copying properties of the backing KeyframeList is performed in KeyframeEffectReadOnly::copyPropertiesFromSource() via public KeyframeList methods. * animation/AnimationEffectTimingReadOnly.cpp: (WebCore::AnimationEffectTimingReadOnly::copyPropertiesFromSource): * animation/AnimationEffectTimingReadOnly.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * animation/KeyframeEffectOptions.idl: * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::create): (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource): * animation/KeyframeEffectReadOnly.h: * animation/KeyframeEffectReadOnly.idl: 2018-02-12 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Introduce RenderTreebuilder::takeChild https://bugs.webkit.org/show_bug.cgi?id=182707 <rdar://problem/37473433> Reviewed by Antti Koivisto. All takeChild calls should go through RenderTreeBuilder::takeChild from now on. This patch also moves the Ruby related takeChild calls to RenderTreeBuilder. No change in functionality. * rendering/RenderButton.cpp: (WebCore::RenderButton::takeChild): * rendering/RenderElement.cpp: (WebCore::RenderElement::removeAndDestroyChild): * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::wrapExistingRenderer): (WebCore::RenderFullScreen::unwrapRenderer): * rendering/RenderMenuList.cpp: (RenderMenuList::takeChild): * rendering/RenderRuby.cpp: (WebCore::RenderRubyAsInline::takeChild): Deleted. (WebCore::RenderRubyAsBlock::takeChild): Deleted. * rendering/RenderRuby.h: * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::takeChild): Deleted. * rendering/RenderRubyRun.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChild): (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsInline): Deleted. (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsBlock): Deleted. (WebCore::RenderTreeBuilder::takeChildFromRenderRubyRun): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::updateStyle): * rendering/updating/RenderTreeBuilderList.cpp: (WebCore::RenderTreeBuilder::List::updateItemMarker): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::takeChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows): 2018-02-12 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlock::dropAnonymousBoxChild to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182704 <rdar://problem/37469469> Reviewed by Antti Koivisto. All the callsites are now in RenderTreeBuilder. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::dropAnonymousBoxChild): Deleted. * rendering/RenderBlock.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): (WebCore::RenderTreeBuilder::dropAnonymousBoxChild): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::takeChild): (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild): * rendering/updating/RenderTreeBuilderBlock.h: 2018-02-12 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r228376. This caused accessibility/mac/selection-notification-focus- change.html to become flaky on macOS. Reverted changeset: "AX: defer focusedUIElement notifications" https://bugs.webkit.org/show_bug.cgi?id=182643 https://trac.webkit.org/changeset/228376 2018-02-12 Ryan Haddad <ryanhaddad@apple.com> [iOS] media tests failing ASSERT_NOT_REACHED() in WebCore::VideoFullscreenInterfaceAVKit::cleanupFullscreen() https://bugs.webkit.org/show_bug.cgi?id=182527 Reviewed by Alexey Proskuryakov. Temporarily remove an assertion from VideoFullscreenInterfaceAVKit to stop tests from crashing on iOS while the root cause is being investigated. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::exitFullscreenHandler): 2018-02-12 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Remove redundant RenderTreeBuilder instance https://bugs.webkit.org/show_bug.cgi?id=182700 <rdar://problem/37463958> Reviewed by Antti Koivisto. * rendering/RenderView.cpp: (WebCore::RenderView::willBeDestroyed): 2018-02-12 Chris Fleizach <cfleizach@apple.com> AX: defer focusedUIElement notifications https://bugs.webkit.org/show_bug.cgi?id=182643 <rdar://problem/37394310> Reviewed by Zalan Bujtas. Deferring focus changes for accessibility has a number of benefits. 1) Reduces the chance of calling into layout during layout. 2) Coalesces multiple focus notifications that would be needlessly sent. 3) Improves performance by not calling out to the accessibility notification machinery during layout. In this patch, I also started making more AXObjectCache calls private. This will reduce the chance that clients will call into AXObjectCache during unexpected times. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded): (WebCore::conditionallyAddNodeToFilterList): (WebCore::filterVectorPairForRemoval): (WebCore::filterMapForRemoval): (WebCore::filterListForRemoval): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): * accessibility/AXObjectCache.h: * dom/Document.cpp: (WebCore::Document::setFocusedElement): 2018-02-11 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> [GTK] Scrolling sometimes jumps around https://bugs.webkit.org/show_bug.cgi?id=178519 Reviewed by Michael Catanzaro. * platform/gtk/ScrollAnimatorGtk.cpp: (WebCore::ScrollAnimatorGtk::computeVelocity): use -1 as the multiplier for the accumulated deltas, since all we need is to make them negative. Multiplying by -1000 leads to very high velocities being returned, causing the viewport to scroll to the end of the page. 2018-02-10 Wenson Hsieh <wenson_hsieh@apple.com> Remove an unused static variable in DeprecatedGlobalSettings.h https://bugs.webkit.org/show_bug.cgi?id=182672 Reviewed by Joseph Pecoraro. After r227282, this flag is no longer used anywhere. No change in behavior. * page/DeprecatedGlobalSettings.h: 2018-02-10 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlock::takeChild mutation to a RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182662 <rdar://problem/37408571> Reviewed by Simon Fraser. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::takeChild): (WebCore::canDropAnonymousBlock): Deleted. (WebCore::canMergeContiguousAnonymousBlocks): Deleted. * rendering/RenderBlock.h: (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo): * rendering/RenderBlockFlow.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takenChildFromRenderBlock): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::canDropAnonymousBlock): (WebCore::canMergeContiguousAnonymousBlocks): (WebCore::RenderTreeBuilder::Block::takeChild): * rendering/updating/RenderTreeBuilderBlock.h: 2018-02-08 Ryosuke Niwa <rniwa@webkit.org> REGRESSION (r223440): Copying & pasting a list from Microsoft Word to TinyMCE fails https://bugs.webkit.org/show_bug.cgi?id=182564 Reviewed by Wenson Hsieh. Turns out that Microsoft Word generates p and span elements with special styles instead of standard ul and ol elements when copying a list items, and TinyMCE has a specialized code path to process this proprietary format of Microsoft Word. The regression was caused by WebKit's sanitization code stripping away these non-standard CSS rules and inline styles. To preseve pre-r223440 behavior in TinyMCE, we preserve the following in a HTML markup: 1. The "html" element at the beginning with xmlns content attributes 2. @list rules in a style element starting with "/* List Definitions */" comment 3. inline style content attribute with "mso-list" property 4. comments conditional sections with "[if !supportLists]" and "[endif]" (1) is needed for TinyMCE to trigger the specialized code path for Microsoft Word. (2) contains the information about the structure of list items. (3) is needed to associate each p element with a rule in (2). (4) is needed to strip away the content generated as list markers (e.g. dots). We enable this "MSO list quirks" when the content comes from a non-WebKit client or a WebKit client that doesn't enable custom pasteboard data (detected by the content origin being null), and the HTML markup starts with a specific sequence of characters generated by Microsoft Word. Test: http/tests/security/clipboard/copy-paste-html-across-origin-strips-mso-list.html PasteHTML.PreservesMSOList PasteHTML.StripsMSOListWhenMissingMSOHTMLElement PasteWebArchive.PreservesMSOList PasteWebArchive.StripsMSOListWhenMissingMSOHTMLElement * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::appendTextSubstring): Added. * editing/MarkupAccumulator.h: * editing/WebContentReader.cpp: (WebCore::FrameWebContentReader::msoListQuirksForMarkup const): Added. Enables the MSO list quirks if the content origin is null. The content origin specifies the pasteboard content's origin if it's copied in WebKit with custom pasteboard data types enabled. In all other applications, it would be set to null. * editing/WebContentReader.h: * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::markupForFragmentInDocument): Moved to markup.cpp as sanitizedMarkupForFragmentInDocument. (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readWebArchive): Always disables MSO list quirks since this code path is only used by WebKit's native code to paste content. (WebCore::WebContentMarkupReader::readWebArchive): Calls msoListQuirksForMarkup since this is the code path used by DataTransfer. (WebCore::WebContentReader::readHTML): Always disables MSO list quirks since this code path is only used by WebKit's native code to paste content. (WebCore::WebContentMarkupReader::readHTML): Calls msoListQuirksForMarkup since this is the code path used by DataTransfer. * editing/markup.cpp: (WebCore::sanitizeMarkup): Use sanitizedMarkupForFragmentInDocument to share code. (WebCore::MSOListMode): Added. Set to Preserve if the sanitized markup is the one generated by Microsoft Word, and MSO list quirks should actually kick in. This is unlike MSOListQuirks, which is set to Enable whenever the content COULD be the one generated by Microsoft Word. (WebCore::StyledMarkupAccumulator): Added a special MSO list preservation mode enabled by MSOListMode. (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): (WebCore::StyledMarkupAccumulator::appendElement): Preseve (3). Unfortunately, TinyMCE only recognizes mso-list and related properties only if they appear on their own. But we also need to preserve the inline style generated using the computed style since we would lose the inline styles of the text otherwise (e.g. red text and bold font). To workaround this, we generate two style content attributes, one containing computed styles and another one containing mso-list. Luckily, the HTML parsing algorithm dictates that the first attribute always wins when more than one attributes of the same name appears, so we place the computed style's style attribute first so that the pasted content in non-TinyMCE environment will continue to work. (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): (WebCore::StyledMarkupAccumulator::appendNodeToPreserveMSOList): Added. Generates special markup for the conditional statements and the special style element with @list rules. (WebCore::createMarkupInternal): (WebCore::createMarkup): (WebCore::sanitizedMarkupForFragmentInDocument): Moved from WebContentReaderCocoa.mm. If MSOListQuirks is set to Enable, and the markup starts with a specific sequence of characters, generate the markup with the newly added quirks code in StyledMarkupAccumulator, and wrap it in a special "html" element TinyMCE recognizes. * editing/markup.h: (WebCore::MSOListQuirks): Added. Set to CheckIfNeeded if the content COULD require MSO list quirks. 2018-02-09 Dean Jackson <dino@apple.com> ImageBitmapRenderingContext should be Runtime guarded https://bugs.webkit.org/show_bug.cgi?id=182665 <rdar://problem/37411410> Reviewed by Sam Weinig. Add a flag to ensure the ImageBitmapRenderingContext interface is only visible when the runtime feature is enabled. * bindings/js/WebCoreBuiltinNames.h: * html/canvas/ImageBitmapRenderingContext.idl: 2018-02-09 Don Olmstead <don.olmstead@sony.com> [CMake] Make PAL headers copies https://bugs.webkit.org/show_bug.cgi?id=182645 Reviewed by Alex Christensen. No new tests. No change in behavior. * CMakeLists.txt: 2018-02-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderRubyRun::takeChild mutation to a RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182655 <rdar://problem/37406801> Reviewed by Simon Fraser. No change in functionality. * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::takeChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChildFromRenderRubyRun): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::takeChild): * rendering/updating/RenderTreeBuilderRuby.h: 2018-02-09 Andy Estes <aestes@apple.com> [Payment Request] Apple Pay sheet does not dismiss when calling complete() with result "unknown" or "fail" https://bugs.webkit.org/show_bug.cgi?id=182658 <rdar://problem/37293917> Reviewed by Brady Eidson. When PaymentResponse::complete() is called with a result of "unknown" or "fail", we should treat this as a fatal error and dismiss the Apple Pay sheet. However, we were adding an error with code "unknown" to the authorization result, which PassKit interprets as a non-fatal error. Instead, we should not set any errors and just use a status code of PaymentAuthorizationStatus::Failure, which PassKit interprets as a fatal error, dismissing the sheet. No test possible. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::complete): 2018-02-09 Wenson Hsieh <wenson_hsieh@apple.com> Pasting from Excel no longer provides text/html data https://bugs.webkit.org/show_bug.cgi?id=182636 <rdar://problem/37087060> Reviewed by Ryosuke Niwa. After r222656, we treat images on the pasteboard as files. However, we also have an existing policy which hides text data ("text/uri-list", "text/html", "text/plain") from the page when files are present on the pasteboard. When copying a table, Microsoft Excel writes a rendering of the table to the pasteboard as an image. This means that we'll hide other data types (importantly, 'text/html') upon pasting, even though important clients (such as Google Docs and Confluence) depend on the 'text/html' data in order to correctly handle the paste (rather than paste as an image of a table). To fix this, we add an exception to the DataTransfer.getData codepath when the pasteboard contains files. Instead of always returning the empty string for text/html, we still allow pasteboard access, but only read from a limited set of rich text types, i.e. web archive, RTF(D), and HTML markup. Importantly, this prevents us from exposing any file paths that appear as plain text or URLs on the pasteboard. Just as in the regular codepath for getData(), if the pasteboard data comes from the same origin, we allow unsanitized access; otherwise, we use WebContentMarkupReader to extract markup from the pasteboard. Tests: PasteMixedContent.ImageFileAndPlainText PasteMixedContent.ImageFileAndWebArchive PasteMixedContent.ImageFileAndHTML PasteMixedContent.ImageFileAndRTF PasteMixedContent.ImageFileAndURL PasteMixedContent.ImageFileWithHTMLAndURL DataInteractionTests.DataTransferGetDataWhenDroppingImageAndMarkup Also rebaselined some layout tests, which cover changes in behavior when dropping on macOS and pasting on iOS. * dom/DataTransfer.cpp: (WebCore::DataTransfer::getDataForItem const): Augment the codepath handling the case where the pasteboard contains files, such that we allow reading "text/html", but only from rich text types. (WebCore::DataTransfer::readStringFromPasteboard const): Factor out logic for reading from the pasteboard into a private helper. This is called in two places from getDataForItem: in the normal (existing) path, and in the case where we allow 'text/html' to be read despite files appearing in the pasteboard. One important difference here is that this helper now takes a WebContentReadingPolicy, whose purpose is to prevent reading from non-rich-text types when files appear in the pasteboard. Another tweak here is that we now use `lowercaseType` instead of the original (unadjusted) `type` when reading from the pasteboard. This doesn't seem to be intended in the first place. (WebCore::DataTransfer::types const): Tweak the implementation of DataTransfer.types() in the case where files exist on the pasteboard, such that we also add "text/html" if it is present in the list of DOM-safe types. * dom/DataTransfer.h: * platform/Pasteboard.h: Introduce WebContentReadingPolicy, which indicates whether or not we should limit web content reading from the pasteboard to only rich text types upon paste or drop. Normally, we allow all types to be read as web content (::AnyType), but when files appear on the pasteboard, we force OnlyRichTextTypes to ensure that no other types can unintentionally be read back as web content. * platform/StaticPasteboard.h: * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::read): * platform/ios/PasteboardIOS.mm: Teach Pasteboard (on iOS) to respect WebContentReadingPolicy. (WebCore::isTypeAllowedByReadingPolicy): (WebCore::Pasteboard::read): (WebCore::Pasteboard::readRespectingUTIFidelities): * platform/mac/PasteboardMac.mm: Teach Pasteboard (on macOS) to respect WebContentReadingPolicy. (WebCore::Pasteboard::read): * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::read): * platform/wpe/PasteboardWPE.cpp: (WebCore::Pasteboard::read): Adjust non-Cocoa Pasteboard implementations for an interface change. 2018-02-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderRubyAsInline/AsBlock::takeChild mutation to a RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182651 <rdar://problem/37405042> Reviewed by Antti Koivisto. No change in functionality. * rendering/RenderRuby.cpp: (WebCore::RenderRubyAsInline::takeChild): (WebCore::RenderRubyAsBlock::takeChild): (WebCore::isAnonymousRubyInlineBlock): Deleted. (WebCore::isRubyChildForNormalRemoval): Deleted. (WebCore::findRubyRunParent): Deleted. * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsInline): (WebCore::RenderTreeBuilder::takeChildFromRenderRubyAsBlock): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::findRubyRunParent): (WebCore::RenderTreeBuilder::Ruby::takeChild): * rendering/updating/RenderTreeBuilderRuby.h: 2018-02-09 Per Arne Vollan <pvollan@apple.com> Assert that NSApp is not running in the WebProcess. https://bugs.webkit.org/show_bug.cgi?id=182553 Reviewed by Simon Fraser. In WebCore, there are a few places where NSApp is referenced. Since the WebContent process is no longer using the NSApplication run loop, and NSApp is no longer guaranteed to be valid, we should make sure that the NSApp is not referenced by the WebContent process or the Network process, by asserting that the NSApplication event loop is running when NSApp is referenced. It is still ok for the UIProcess to reference NSApp. Adding these assert will help catch NSApp references when the NSApplication run loop is not used. Also, do not post a fake mouse event in PasteBoard::setDragImage when the NSApplication run loop is not running, since this is only relevant in WK1. No new tests, covered by existing tests. * page/mac/EventHandlerMac.mm: (WebCore::lastEventIsMouseUp): (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::setDragImage): 2018-02-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Introduce RenderTreeBuilder to willBeDestoryed/removeFromParentAndDestroy https://bugs.webkit.org/show_bug.cgi?id=182635 <rdar://problem/37377489> Reviewed by Antti Koivisto. This patch helps finding callsites where we don't have a RenderTreeBuilder instance. No change in functionality. * dom/Document.cpp: (WebCore::Document::setFullScreenRenderer): * dom/Document.h: * rendering/RenderBlock.cpp: (WebCore::RenderBlock::willBeDestroyed): (WebCore::RenderBlock::takeChild): * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willBeDestroyed): * rendering/RenderBlockFlow.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::willBeDestroyed): * rendering/RenderBox.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::willBeDestroyed): (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): * rendering/RenderBoxModelObject.h: * rendering/RenderButton.cpp: (WebCore::RenderButton::setText): * rendering/RenderCounter.cpp: (WebCore::RenderCounter::willBeDestroyed): * rendering/RenderCounter.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::willBeDestroyed): * rendering/RenderElement.h: * rendering/RenderEmbeddedObject.cpp: (WebCore::RenderEmbeddedObject::willBeDestroyed): * rendering/RenderEmbeddedObject.h: * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::willBeDestroyed): * rendering/RenderFragmentedFlow.h: * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::willBeDestroyed): (WebCore::RenderFullScreen::wrapNewRenderer): (WebCore::RenderFullScreen::wrapExistingRenderer): (WebCore::RenderFullScreen::unwrapRenderer): * rendering/RenderFullScreen.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::willBeDestroyed): * rendering/RenderImage.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderInline.h: * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::willBeDestroyed): * rendering/RenderLayerModelObject.h: * rendering/RenderListBox.cpp: (WebCore::RenderListBox::willBeDestroyed): * rendering/RenderListBox.h: * rendering/RenderListItem.cpp: (WebCore::RenderListItem::willBeDestroyed): * rendering/RenderListItem.h: * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::willBeDestroyed): * rendering/RenderListMarker.h: * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::willBeDestroyed): * rendering/RenderMenuList.h: * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::handleSpannerRemoval): * rendering/RenderObject.cpp: (WebCore::RenderObject::removeFromParentAndDestroy): (WebCore::RenderObject::willBeDestroyed): (WebCore::RenderObject::destroy): * rendering/RenderObject.h: * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::willBeDestroyed): * rendering/RenderReplaced.h: * rendering/RenderRuby.cpp: (WebCore::RenderRubyAsInline::takeChild): (WebCore::RenderRubyAsBlock::takeChild): * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::willBeDestroyed): * rendering/RenderSearchField.h: * rendering/RenderSnapshottedPlugIn.cpp: (WebCore::RenderSnapshottedPlugIn::willBeDestroyed): * rendering/RenderSnapshottedPlugIn.h: * rendering/RenderText.cpp: (WebCore::RenderText::willBeDestroyed): * rendering/RenderText.h: * rendering/RenderTextControlMultiLine.cpp: (WebCore::RenderTextControlMultiLine::willBeDestroyed): * rendering/RenderTextControlMultiLine.h: * rendering/RenderTextFragment.cpp: (WebCore::RenderTextFragment::willBeDestroyed): (WebCore::RenderTextFragment::setText): * rendering/RenderTextFragment.h: * rendering/RenderVideo.cpp: (WebCore::RenderVideo::willBeDestroyed): * rendering/RenderVideo.h: * rendering/RenderView.cpp: (WebCore::RenderView::willBeDestroyed): * rendering/RenderView.h: * rendering/RenderWidget.cpp: (WebCore::RenderWidget::willBeDestroyed): * rendering/RenderWidget.h: * rendering/svg/RenderSVGBlock.cpp: (WebCore::RenderSVGBlock::willBeDestroyed): * rendering/svg/RenderSVGBlock.h: * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::willBeDestroyed): * rendering/svg/RenderSVGImage.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::willBeDestroyed): * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::willBeDestroyed): * rendering/svg/RenderSVGModelObject.h: * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::willBeDestroyed): * rendering/svg/RenderSVGResourceContainer.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::willBeDestroyed): * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::willBeDestroyed): * rendering/svg/RenderSVGText.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilderList.cpp: (WebCore::RenderTreeBuilder::List::updateItemMarker): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): 2018-02-09 Brent Fulgham <bfulgham@apple.com> [macOS, iOS] Expose OS marketing version in UserAgent https://bugs.webkit.org/show_bug.cgi?id=182629 <rdar://problem/37370975> Reviewed by Daniel Bates. Revert back to dynamically reading the operating system marketing version rather than using a hard-coded version. * page/cocoa/UserAgent.mm: (WebCore::systemMarketingVersionForUserAgentString): 2018-02-08 Antoine Quint <graouts@apple.com> [Web Animations] Refactor AnimationEffect and KeyframeEffect into AnimationEffectReadOnly, KeyframeEffectReadOnly and KeyframeEffect https://bugs.webkit.org/show_bug.cgi?id=182608 Reviewed by Dean Jackson. Currently, we have an AnimationEffect class with read-write members and a KeyframeEffect subclass with read-write members. The spec has an AnimationEffectReadOnly class, with read-only members, a KeyframeEffectReadOnly subclass, with read-only members, and then the KeyframeEffect subclass (of KeyframeEffectReadOnly) with read-write members. Likewise, currently we have an AnimationEffectTiming class with read-write members. While the spec has this class as well, it also specifies a read-only AnimationEffectTimingReadOnly superclass. In this patch we refactor the code to match the spec, which gives us a big boost in our WPT pass rate. The vast majority of the code is just copied from one class to another verbatim. The limited actual code changes, all related to the new subclassing, are: - AnimationEffectTimingReadOnly is not actually read-only as far as WebCore is concerned, it actually exposes setters for all of its properties, but the IDL for this class specifies all properties as read-only, so we match the spec. The reason for this is that it is necessary to be able to set members of an AnimationEffectTimingReadOnly object based on a Variant<double, KeyframeEffectOptions> provided to Element.animate() or the KeyframeEffectReadOnly and KeyframeEffect constructors, and the logic to handle properties in such dictionaries is the same as the logic required to set individual members in AnimationEffectTiming. So in essence, the sole role of AnimationTimingEffect is to provide an IDL interface with read-write members, but the parent class is itself read-write as far as WebCore is concerned. - AnimationEffectTimingReadOnly exposes a new setProperties() method which takes in a nullable Variant<double, KeyframeEffectOptions> so that code that was previously specific to KeyframeEffect can be factored into this method and both the constructors of KeyframeEffectReadOnly and KeyframeEffect can make use of it without code duplication. - The AnimationEffectReadOnly constructor now takes an AnimationEffectTimingReadOnly as input since that class and KeyframeEffectReadOnly expose an AnimationEffectTimingReadOnly object, while KeyframeEffect exposes an AnimationEffectTiming read-write object. This allows the KeyframeEffect constructor to provide the right object type. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffectReadOnly.cpp: Renamed from Source/WebCore/animation/AnimationEffect.cpp. (WebCore::AnimationEffectReadOnly::AnimationEffectReadOnly): (WebCore::AnimationEffectReadOnly::localTime const): (WebCore::AnimationEffectReadOnly::phase const): (WebCore::AnimationEffectReadOnly::activeTime const): (WebCore::AnimationEffectReadOnly::overallProgress const): (WebCore::AnimationEffectReadOnly::simpleIterationProgress const): (WebCore::AnimationEffectReadOnly::currentIteration const): (WebCore::AnimationEffectReadOnly::currentDirection const): (WebCore::AnimationEffectReadOnly::directedProgress const): (WebCore::AnimationEffectReadOnly::transformedProgress const): (WebCore::AnimationEffectReadOnly::iterationProgress const): (WebCore::AnimationEffectReadOnly::getComputedTiming): * animation/AnimationEffectReadOnly.h: Renamed from Source/WebCore/animation/AnimationEffect.h. (WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const): (WebCore::AnimationEffectReadOnly::timing const): * animation/AnimationEffectReadOnly.idl: Copied from Source/WebCore/animation/AnimationEffect.idl. * animation/AnimationEffectTiming.cpp: (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::setIterationStart): Deleted. (WebCore::AnimationEffectTiming::setIterations): Deleted. (WebCore::AnimationEffectTiming::bindingsDuration const): Deleted. (WebCore::AnimationEffectTiming::setBindingsDuration): Deleted. (WebCore::AnimationEffectTiming::endTime const): Deleted. (WebCore::AnimationEffectTiming::activeDuration const): Deleted. (WebCore::AnimationEffectTiming::setEasing): Deleted. * animation/AnimationEffectTiming.h: (): Deleted. * animation/AnimationEffectTiming.idl: * animation/AnimationEffectTimingReadOnly.cpp: Copied from Source/WebCore/animation/AnimationEffectTiming.cpp. (WebCore::AnimationEffectTimingReadOnly::create): (WebCore::AnimationEffectTimingReadOnly::AnimationEffectTimingReadOnly): (WebCore::AnimationEffectTimingReadOnly::~AnimationEffectTimingReadOnly): (WebCore::AnimationEffectTimingReadOnly::setProperties): (WebCore::AnimationEffectTimingReadOnly::setIterationStart): (WebCore::AnimationEffectTimingReadOnly::setIterations): (WebCore::AnimationEffectTimingReadOnly::bindingsDuration const): (WebCore::AnimationEffectTimingReadOnly::setBindingsDuration): (WebCore::AnimationEffectTimingReadOnly::setEasing): (WebCore::AnimationEffectTimingReadOnly::endTime const): (WebCore::AnimationEffectTimingReadOnly::activeDuration const): * animation/AnimationEffectTimingReadOnly.h: Copied from Source/WebCore/animation/AnimationEffectTiming.h. (WebCore::AnimationEffectTimingReadOnly::isAnimationEffectTiming const): (WebCore::AnimationEffectTimingReadOnly::bindingsDelay const): (WebCore::AnimationEffectTimingReadOnly::setBindingsDelay): (WebCore::AnimationEffectTimingReadOnly::bindingsEndDelay const): (WebCore::AnimationEffectTimingReadOnly::setBindingsEndDelay): (WebCore::AnimationEffectTimingReadOnly::delay const): (WebCore::AnimationEffectTimingReadOnly::setDelay): (WebCore::AnimationEffectTimingReadOnly::endDelay const): (WebCore::AnimationEffectTimingReadOnly::setEndDelay): (WebCore::AnimationEffectTimingReadOnly::fill const): (WebCore::AnimationEffectTimingReadOnly::setFill): (WebCore::AnimationEffectTimingReadOnly::iterationStart const): (WebCore::AnimationEffectTimingReadOnly::iterations const): (WebCore::AnimationEffectTimingReadOnly::iterationDuration const): (WebCore::AnimationEffectTimingReadOnly::setIterationDuration): (WebCore::AnimationEffectTimingReadOnly::direction const): (WebCore::AnimationEffectTimingReadOnly::setDirection): (WebCore::AnimationEffectTimingReadOnly::easing const): (WebCore::AnimationEffectTimingReadOnly::timingFunction const): (WebCore::AnimationEffectTimingReadOnly::classType const): * animation/AnimationEffectTimingReadOnly.idl: Renamed from Source/WebCore/animation/AnimationEffect.idl. * animation/AnimationTimeline.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::IDLAttributeNameToAnimationPropertyName): Deleted. (WebCore::CSSPropertyIDToIDLAttributeName): Deleted. (WebCore::computeMissingKeyframeOffsets): Deleted. (WebCore::processIterableKeyframes): Deleted. (WebCore::processKeyframeLikeObject): Deleted. (WebCore::processPropertyIndexedKeyframes): Deleted. (WebCore::KeyframeEffect::getKeyframes): Deleted. (WebCore::KeyframeEffect::processKeyframes): Deleted. (WebCore::KeyframeEffect::computeStackingContextImpact): Deleted. (WebCore::KeyframeEffect::apply): Deleted. (WebCore::KeyframeEffect::shouldRunAccelerated): Deleted. (WebCore::KeyframeEffect::getAnimatedStyle): Deleted. (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Deleted. (WebCore::KeyframeEffect::startOrStopAccelerated): Deleted. (WebCore::KeyframeEffect::renderer const): Deleted. (WebCore::KeyframeEffect::currentStyle const): Deleted. * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * animation/KeyframeEffectReadOnly.cpp: Copied from Source/WebCore/animation/KeyframeEffect.cpp. (WebCore::IDLAttributeNameToAnimationPropertyName): (WebCore::CSSPropertyIDToIDLAttributeName): (WebCore::computeMissingKeyframeOffsets): (WebCore::processIterableKeyframes): (WebCore::processKeyframeLikeObject): (WebCore::processPropertyIndexedKeyframes): (WebCore::KeyframeEffectReadOnly::create): (WebCore::KeyframeEffectReadOnly::KeyframeEffectReadOnly): (WebCore::KeyframeEffectReadOnly::getKeyframes): (WebCore::KeyframeEffectReadOnly::processKeyframes): (WebCore::KeyframeEffectReadOnly::computeStackingContextImpact): (WebCore::KeyframeEffectReadOnly::apply): (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): (WebCore::KeyframeEffectReadOnly::getAnimatedStyle): (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): (WebCore::KeyframeEffectReadOnly::renderer const): (WebCore::KeyframeEffectReadOnly::currentStyle const): * animation/KeyframeEffectReadOnly.h: Copied from Source/WebCore/animation/KeyframeEffect.h. (WebCore::KeyframeEffectReadOnly::~KeyframeEffectReadOnly): (WebCore::KeyframeEffectReadOnly::target const): (WebCore::KeyframeEffectReadOnly::iterationComposite const): (WebCore::KeyframeEffectReadOnly::composite const): (WebCore::KeyframeEffectReadOnly::isRunningAccelerated const): * animation/KeyframeEffectReadOnly.idl: Copied from Source/WebCore/animation/KeyframeEffect.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectReadOnlyCustom.cpp: Copied from Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSCustomEventCustom.cpp: (WebCore::JSCustomEvent::detail const): Fix an error introduced in webkit.org/b/179591. * bindings/js/JSWebAnimationCustom.cpp: (WebCore::constructJSWebAnimation): * bindings/js/WebCoreBuiltinNames.h: 2018-02-09 Andy Estes <aestes@apple.com> [Payment Request] Crash in PaymentRequest::canMakePayment() when Apple Pay payment method data is missing required fields https://bugs.webkit.org/show_bug.cgi?id=182631 Reviewed by Mark Lam. PaymentRequest::canMakePayment() needs to parse each payment method's serialized data to determine if it is a supported payment method. If parsing fails by raising an exception, we intend to skip over that payment method and try the next one. If all payment method data fail to parse, we resolve the returned promise with false. At no point do we intend to propagate the parsing exception up to the calling script, however. Even though we intend to swallow any exceptions from parsing, we failed to clear the JavaScript VM's exception state. The next time WebCore tries to execute JavaScript, a release assertion is raised due to seeing an unexpected exception in the VM. Fix this by using a CatchScope in PaymentRequest::canMakePayment(), and calling CatchScope::clearException() in the places we intend to swallow exceptions. Added a test case to http/tests/paymentrequest/payment-request-canmakepayment-method.https.html. * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::canMakePayment): 2018-02-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move multicolumn descendant/sibling removal logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182628 <rdar://problem/37369528> Reviewed by Antti Koivisto. No change in functionality * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::takeChild): * rendering/RenderFragmentedFlow.h: * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::handleSpannerRemoval): Deleted. (WebCore::RenderMultiColumnFlow::fragmentedFlowRelativeWillBeRemoved): Deleted. * rendering/RenderMultiColumnFlow.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::multiColumnRelativeWillBeRemoved): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval): (WebCore::RenderTreeBuilder::MultiColumn::multiColumnRelativeWillBeRemoved): * rendering/updating/RenderTreeBuilderMultiColumn.h: 2018-02-09 Youenn Fablet <youenn@apple.com> Add support for cache storage of blob response https://bugs.webkit.org/show_bug.cgi?id=182637 Reviewed by Brady Eidson. Covered by updated WPT test. When putting a blob response in cache, create a readable stream to easily get the body. Make clear that caching form data is not supported. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBody.h: (WebCore::FetchBody::isBlob const): (WebCore::FetchBody::isFormData const): * Modules/fetch/FetchResponse.h: 2018-02-09 Youenn Fablet <youenn@apple.com> Make CoreAudioCaptureSource error logging be release logging https://bugs.webkit.org/show_bug.cgi?id=182614 Reviewed by Eric Carlson. No change of behavior. * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioSharedUnit::addEchoCancellationSource): (WebCore::CoreAudioSharedUnit::setupAudioUnit): (WebCore::CoreAudioSharedUnit::configureMicrophoneProc): (WebCore::CoreAudioSharedUnit::configureSpeakerProc): (WebCore::CoreAudioSharedUnit::checkTimestamps): (WebCore::CoreAudioSharedUnit::provideSpeakerData): (WebCore::CoreAudioSharedUnit::processMicrophoneSamples): (WebCore::CoreAudioSharedUnit::cleanupAudioUnit): (WebCore::CoreAudioSharedUnit::reconfigureAudioUnit): (WebCore::CoreAudioSharedUnit::startInternal): (WebCore::CoreAudioSharedUnit::verifyIsCapturing): (WebCore::CoreAudioSharedUnit::stopInternal): (WebCore::CoreAudioSharedUnit::defaultInputDevice): 2018-02-09 Carlos Garcia Campos <cgarcia@igalia.com> Add a way to check if a host is an IP address https://bugs.webkit.org/show_bug.cgi?id=182427 Reviewed by Alex Christensen. There are several places where this is needed. We currently just assume that any host ending in a digit is an IP address, except in PublicSuffix where platform specific code is used. This patch adds URL::hostIsIPAddress() platform specific implementations, falling back to current assumption if there isn't an implementation for the platform. * page/OriginAccessEntry.cpp: (WebCore::OriginAccessEntry::OriginAccessEntry): Use URL::hostIsIPAddress(). * platform/URL.cpp: (WebCore::URL::hostIsIPAddress): Fallback implementation. * platform/URL.h: * platform/mac/PublicSuffixMac.mm: (WebCore::topPrivatelyControlledDomain): Use URL::hostIsIPAddress(). * platform/mac/URLMac.mm: (WebCore::URL::hostIsIPAddress): Move implementation from PublicSuffixMac.mm. * platform/network/curl/CookieUtil.cpp: (WebCore::CookieUtil::isIPAddress): Use URL::hostIsIPAddress(). * platform/soup/URLSoup.cpp: (WebCore::URL::hostIsIPAddress): Use g_hostname_is_ip_address(). 2018-02-08 Philippe Normand <pnormand@igalia.com> [GStreamer][WebAudio] Winamp2-js woes https://bugs.webkit.org/show_bug.cgi?id=182612 Reviewed by Xabier Rodriguez Calvar and Carlos Alberto Lopez Perez. Test: webaudio/silence-after-playback.html * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp: (WebCore::copyGStreamerBuffersToAudioChannel): Clear the bus if the adapter can't provide enough data. This prevents a nasty noise after playing songs in Winamp. (WebCore::AudioSourceProviderGStreamer::setClient): No need to set the client more than once, this fixes runtime warnings. 2018-02-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move multicolumn spanner mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182627 <rdar://problem/37367284> Reviewed by Antti Koivisto. Move spanner triggered mutation logic to RenderTreeBuilder. No change in functionality. * rendering/RenderFragmentedFlow.h: * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): (WebCore::findSetRendering): Deleted. (WebCore::isValidColumnSpanner): Deleted. (WebCore::spannerPlacehoderCandidate): Deleted. (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): Deleted. (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted): Deleted. * rendering/RenderMultiColumnFlow.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::insertedIntoTree): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::multiColumnDescendantInserted): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::findSetRendering): (WebCore::spannerPlacehoderCandidate): (WebCore::isValidColumnSpanner): (WebCore::RenderTreeBuilder::MultiColumn::multiColumnDescendantInserted): (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant): * rendering/updating/RenderTreeBuilderMultiColumn.h: 2018-02-09 Javier Fernandez <jfernandez@igalia.com> [css-align] Implement the new behavior of 'legacy' for justify-items https://bugs.webkit.org/show_bug.cgi?id=172712 Reviewed by Antti Koivisto. The syntax of the 'justify-items' property accepts a new 'legacy' value, replacing the 'auto' value which is now parsed as invalid. https://github.com/w3c/csswg-drafts/issues/1318 This change affects also to the 'place-items' shorthand, which doesn't accept 'auto' and, for the time being, neither 'legacy'. Since the new value 'legacy' is also the default value, I don't expect this change to break content of sites currently using the 'justify-items' property. No new tests, rebaselined existing test. * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForItemPositionWithOverflowAlignment): (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ItemPosition const): * css/CSSProperties.json: * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustRenderStyle): * css/parser/CSSPropertyParser.cpp: (WebCore::isAuto): (WebCore::isNormalOrStretch): (WebCore::consumeSelfPositionOverflowPosition): (WebCore::consumeJustifyItems): (WebCore::consumeSimplifiedDefaultPosition): (WebCore::consumeSimplifiedSelfPosition): (WebCore::CSSPropertyParser::consumePlaceItemsShorthand): (WebCore::CSSPropertyParser::consumePlaceSelfShorthand): * rendering/RenderFlexibleBox.cpp: (WebCore::alignmentOffset): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::columnAxisPositionForChild const): (WebCore::RenderGrid::rowAxisPositionForChild const): * rendering/style/RenderStyle.cpp: (WebCore::resolvedSelfAlignment): (WebCore::RenderStyle::resolvedJustifyItems const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialJustifyItems): * rendering/style/RenderStyleConstants.h: * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): 2018-02-09 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Add support for encrypted caps in GStreamerUtilities https://bugs.webkit.org/show_bug.cgi?id=181990 Reviewed by Xabier Rodriguez-Calvar. Add the support of encrypted caps in GStreamerUtilities. Refactor the manner that the caps are handled, such as how to extract the resolution from the video caps or how to check if the caps are encrypted. The attachTrack function in PlaybackPipeline doesn't need the "structure" parameter, it is already included in the "caps" parameter. Replace the "mediaType" parameter by the "caps" parameter in reattachTrack function, it allows to use the new functions that handle the caps in GStreamerUtilities. Tests: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::getVideoSizeAndFormatFromCaps): Add the support of video encrypted caps. (WebCore::getVideoResolutionFromCaps): (WebCore::capsMediaType): (WebCore::doCapsHaveType): (WebCore::areEncryptedCaps): Add a new functions in order to handle the caps properly. * platform/graphics/gstreamer/GStreamerUtilities.h: * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp: (WebCore::GStreamerMediaDescription::codec const): (WebCore::GStreamerMediaDescription::isVideo const): (WebCore::GStreamerMediaDescription::isAudio const): * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected): * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: (WebCore::PlaybackPipeline::attachTrack): (WebCore::PlaybackPipeline::reattachTrack): * platform/graphics/gstreamer/mse/PlaybackPipeline.h: * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp: (webKitMediaSrcUpdatePresentationSize): Refactor some parts by using the new added functions. 2018-02-09 Philippe Normand <pnormand@igalia.com> [GStreamer] Layout test fast/replaced/border-radius-clip.html crashes with GStreamer-CRITICAL **: gst_segment_to_stream_time: assertion 'segment->format == format' failed in gst_segment_to_stream_time() https://bugs.webkit.org/show_bug.cgi?id=176802 Reviewed by Xabier Rodriguez Calvar. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::load): Prevent the player from loading animated gifs. 2018-02-09 Antti Koivisto <antti@apple.com> Move compiled selectors to StyleRule https://bugs.webkit.org/show_bug.cgi?id=182602 Reviewed by Zalan Bujtas. Currently they are owned by RuleData. Several RuleData objects can refer to the same StyleRule, requiring recompilation. Compiled selectors are context-independent so they can be shared between all clients. * WebCore.xcodeproj/project.pbxproj: * css/CSSSelectorList.cpp: (WebCore::CSSSelectorList::listSize const): Compute the number of complex selectors on the list. * css/CSSSelectorList.h: * css/DocumentRuleSets.cpp: (WebCore::makeRuleSet): (WebCore::DocumentRuleSets::classInvalidationRuleSets const): Pass around list index along with the selector index (compiled selectors are found by list index). * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::ruleMatches): * css/RuleSet.cpp: (WebCore::RuleData::RuleData): * css/RuleSet.h: (WebCore::RuleData::compilationStatus const): Deleted. (WebCore::RuleData::compiledSelectorCodeRef const): Deleted. (WebCore::RuleData::setCompiledSelector const): Deleted. (WebCore::RuleData::~RuleData): Deleted. (WebCore::RuleData::compiledSelectorUsed const): Deleted. * css/StyleRule.cpp: (WebCore::StyleRule::StyleRule): * css/StyleRule.h: Add CompiledSelector member. * cssjit/CompiledSelector.h: Added. Move to a header of its own to keeps dependencies simple. (WebCore::SelectorCompilationStatus::SelectorCompilationStatus): (WebCore::SelectorCompilationStatus::operator Status const): * cssjit/SelectorCompiler.h: (): Deleted. (WebCore::SelectorCompilationStatus::SelectorCompilationStatus): Deleted. (WebCore::SelectorCompilationStatus::operator Status const): Deleted. 2018-02-08 Antoine Quint <graouts@apple.com> [Web Animations] Always expose "composite" in output of getKeyframes() https://bugs.webkit.org/show_bug.cgi?id=182600 Reviewed by Dean Jackson. The Web Animations spec has changed and whereas the output of getKeyframes() would not feature the "composite" property for "null" values, it now lists "composite" in all cases. To support this, we needed to fix an issue in the code generator such that a "null" default value for an optional enum type was supported. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::getKeyframes): * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::convertDictionaryToJS): * bindings/scripts/test/TestObj.idl: 2018-02-08 Youenn Fablet <youenn@apple.com> CoreAudioCaptureSourceIOSListener should be a WebProcess singleton https://bugs.webkit.org/show_bug.cgi?id=182606 <rdar://problem/37355283> Reviewed by Eric Carlson. Not testable right now as this relies on iOS specific Core Audio stack. Efforts should be made to somehow mock that part and mock interruptions. Made CoreAudioCaptureSourceFactoryIOS responsible to receive iOS interruption messages. Before the patch, individual capture sources were receiving these messages. When there is only one capture source per process this is fine but with more capture sources, this is messing up things as they all share the same shared unit and we would try to interrupt it or resume it several times. Also, if we are suspended and there is no more capture source, the shared unit will remain suspended indefinitely, as we will not process the interruption messages. With the patch, we always process the messages. We still go through the active source as done now to limit the changes. In case of no source, we go to the shared unit. In the future, we should directly go to the shared unit and clients of the shared unit should see their state being updated. As a way to prevent staying suspended on iOS, we unsuspend ourselves in CoreAudioCaptureSource constructor. This is fine as this constructor is only called when getUserMedia grants access to the camera which always goes to the UIProcess. And the UIProcess is only processing getUserMedia calls if the WebProcess is foregrounded. * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h: * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: (-[WebCoreAudioCaptureSourceIOSListener initWithCallback:]): (WebCore::CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS): (WebCore::CoreAudioCaptureSourceFactoryIOS::~CoreAudioCaptureSourceFactoryIOS): (WebCore::CoreAudioCaptureSourceFactory::singleton): * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSourceFactory::singleton): (WebCore::CoreAudioCaptureSource::create): (WebCore::CoreAudioCaptureSourceFactory::beginInterruption): (WebCore::CoreAudioCaptureSourceFactory::endInterruption): (WebCore::CoreAudioCaptureSourceFactory::scheduleReconfiguration): (WebCore::CoreAudioCaptureSource::factory): (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource): (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource): (WebCore::CoreAudioCaptureSource::startProducingData): (WebCore::CoreAudioCaptureSource::scheduleReconfiguration): (WebCore::CoreAudioCaptureSource::beginInterruption): (WebCore::CoreAudioCaptureSource::endInterruption): * platform/mediastream/mac/CoreAudioCaptureSource.h: (WebCore::CoreAudioCaptureSourceFactory::setCoreAudioActiveSource): (WebCore::CoreAudioCaptureSourceFactory::unsetCoreAudioActiveSource): (WebCore::CoreAudioCaptureSourceFactory::coreAudioActiveSource): 2018-02-08 Chris Dumez <cdumez@apple.com> There should be a way to disable [OverrideBuiltins] behavior in a given DOMWrapperWorld https://bugs.webkit.org/show_bug.cgi?id=182524 <rdar://problem/9057327> Reviewed by Ryosuke Niwa. Add new flag on DOMWrapperWorld indicating if the [OverrideBuiltins] behavior should be enabled in this world or not. The behavior is enabled by default for Web-compatibility. This flag is queried in accessVisibleNamedProperty() when doing the named property lookup. Covered by new API test. * bindings/js/DOMWrapperWorld.h: (WebCore::DOMWrapperWorld::disableOverrideBuiltinsBehavior): (WebCore::DOMWrapperWorld::shouldDisableOverrideBuiltinsBehavior const): * bindings/js/JSDOMAbstractOperations.h: (WebCore::accessVisibleNamedProperty): 2018-02-08 Per Arne Vollan <pvollan@apple.com> Move WebVideoFullscreenController from WebCore to WebKitLegacy. https://bugs.webkit.org/show_bug.cgi?id=182615 Reviewed by Eric Carlson. It is only used by WK1. Also there are a few references to NSApp in WebVideoFullscreenController.mm. Ideally, we should not reference NSApp in WebCore. No new tests. No change in behavior. * SourcesMac.txt: * WebCore.xcodeproj/project.pbxproj: * html/HTMLMediaElement.h: * platform/mac/WebVideoFullscreenController.h: Removed. * platform/mac/WebVideoFullscreenController.mm: Removed. * platform/mac/WebVideoFullscreenHUDWindowController.h: Removed. * platform/mac/WebVideoFullscreenHUDWindowController.mm: Removed. * platform/mac/WebWindowAnimation.h: Removed. * platform/mac/WebWindowAnimation.mm: Removed. 2018-02-08 Chris Dumez <cdumez@apple.com> Form submission after navigation fails when decidePolicyForNavigationAction is async https://bugs.webkit.org/show_bug.cgi?id=182412 <rdar://problem/35181099> Reviewed by Alex Christensen. When the form is submitted and schedules the load in an iframe that is already loading, FrameLoader::stopLoading() is called as expected. However, because policy checks can now be asynchronous, stopLoading() also needs to stop pending policy checks. Otherwise, continueLoadAfterNavigationPolicy() gets called for a cancelled load and we're in trouble because the FrameLoader was reused for another load since then. Test: http/tests/navigation/sync-form-submit-iframe.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): 2018-02-08 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Do not use RenderTreeBuilder::current() in RenderRubyRun::takeChild https://bugs.webkit.org/show_bug.cgi?id=182607 <rdar://problem/37355944> Reviewed by Sam Weinig. No change in functionality. * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::takeChild): 2018-02-08 Antti Koivisto <antti@apple.com> Use invalidation rulesets for attribute selectors https://bugs.webkit.org/show_bug.cgi?id=182569 Reviewed by Zalan Bujtas. Attribute change style invalidation should use invalidation rulesets, similarly how class change invalidation already does. We'll invalidate fewer unnecessary elements immediately and enable more significant future gains. * css/DocumentRuleSets.cpp: (WebCore::DocumentRuleSets::collectFeatures const): (WebCore::DocumentRuleSets::classInvalidationRuleSets const): (WebCore::DocumentRuleSets::attributeInvalidationRuleSets const): Make and cache invalidation RuleSets for an attribute. (WebCore::DocumentRuleSets::ancestorAttributeRulesForHTML const): Deleted. * css/DocumentRuleSets.h: * css/RuleFeature.cpp: (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector): Collect attribute selectors along with match elements. (WebCore::RuleFeatureSet::collectFeatures): (WebCore::RuleFeatureSet::add): (WebCore::RuleFeatureSet::registerContentAttribute): Separate hash to deal with invalidation of content:attr(foo) special case. (WebCore::RuleFeatureSet::clear): (WebCore::RuleFeatureSet::shrinkToFit): (WebCore::makeAttributeSelectorKey): Deleted. * css/RuleFeature.h: (WebCore::RuleFeature::RuleFeature): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueContent): (WebCore::StyleBuilderCustom::applyValueAlt): Use registerContentAttribute() * html/HTMLEmbedElement.cpp: (WebCore::hasTypeOrSrc): (WebCore::HTMLEmbedElement::parseAttribute): Invalidate style if both type and src attributes go missing as this changes result of rendererIsNeeded(). This was previously relying on any attribute change invalidating style. (WebCore::HTMLEmbedElement::rendererIsNeeded): * style/AttributeChangeInvalidation.cpp: (WebCore::Style::AttributeChangeInvalidation::invalidateStyle): Collect the invalidation rulesets for this attribute change. Also check if any attribute selector actually changes state, unlike with classes attribute changes may often not lead to a selector becoming non-matching. (WebCore::Style::AttributeChangeInvalidation::invalidateStyleWithRuleSets): (WebCore::Style::AttributeChangeInvalidation::invalidateDescendants): Deleted. * style/AttributeChangeInvalidation.h: (WebCore::Style::AttributeChangeInvalidation::AttributeChangeInvalidation): (WebCore::Style::AttributeChangeInvalidation::~AttributeChangeInvalidation): * style/ClassChangeInvalidation.cpp: (WebCore::Style::ClassChangeInvalidation::computeInvalidation): Should not bail on shadow tree invalidation as we may also need to invalidate siblings. 2018-02-08 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Introduce RenderTreeBuilder to moveChild(ren)To() functions https://bugs.webkit.org/show_bug.cgi?id=182596 <rdar://problem/37340553> Reviewed by Sam Weinig. This is in preparation for moving mutation code out of moveChildTo/moveChildrenTo. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::dropAnonymousBoxChild): (WebCore::RenderBlock::takeChild): * rendering/RenderBlock.h: (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::styleDidChange): (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo): * rendering/RenderBlockFlow.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildTo): (WebCore::RenderBoxModelObject::moveChildrenTo): * rendering/RenderBoxModelObject.h: (WebCore::RenderBoxModelObject::moveChildTo): (WebCore::RenderBoxModelObject::moveAllChildrenTo): (WebCore::RenderBoxModelObject::moveChildrenTo): * rendering/RenderElement.cpp: (WebCore::RenderElement::styleDidChange): (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary): Deleted. * rendering/RenderElement.h: * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::takeChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::makeChildrenNonInline): (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild): (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): (WebCore::RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock): (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren): (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows): 2018-02-08 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r228261. This broke an internal build Reverted changeset: "Add a way to check if a host is an IP address" https://bugs.webkit.org/show_bug.cgi?id=182427 https://trac.webkit.org/changeset/228261 2018-02-08 Philippe Normand <pnormand@igalia.com> [GStreamer] WebKit improperly handles missing GStreamer elements https://bugs.webkit.org/show_bug.cgi?id=171205 Reviewed by Michael Catanzaro. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Add a test checking the videoflip element was correctly created. It might not be available on some exotic distros such as Gentoo. 2018-02-08 Chris Fleizach <cfleizach@apple.com> AX: Defer attribute computation until needed. https://bugs.webkit.org/show_bug.cgi?id=182386 <rdar://problem/37115277> Reviewed by Zalan Bujtas. Accessibility is doing too much work when handling attribute changes. Here's how we can improve this: 1) Defer attribute changes while the tree is dirty (and coalesce them). 2) Don't create AXObjects when an attribute changes unnecessarily. If no client has requested an ax object, it's likely no work needs to be done (with the exception of a few attributes like aria-modal) 3) Stop calculating the entire accessible ARIA label when trying to decide if an element should be ignored. That's generally wasteful and the consequence of including more AX elements in the tree is very minimal. * accessibility/AXObjectCache.cpp: (WebCore::rendererNeedsDeferredUpdate): (WebCore::nodeAndRendererAreValid): (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::handleAriaExpandedChange): (WebCore::AXObjectCache::handleAriaRoleChanged): (WebCore::AXObjectCache::deferAttributeChangeIfNeeded): (WebCore::AXObjectCache::shouldProcessAttributeChange): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::deferRecomputeIsIgnoredIfNeeded): (WebCore::AXObjectCache::deferRecomputeIsIgnored): (WebCore::AXObjectCache::deferTextChangedIfNeeded): (WebCore::AXObjectCache::deferSelectedChildrenChangedIfNeeded): (WebCore::AXObjectCache::handleAttributeChanged): Deleted. * accessibility/AXObjectCache.h: (WebCore::AXObjectCache::deferAttributeChangeIfNeeded): (WebCore::AXObjectCache::handleAttributeChanged): Deleted. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::hasAttributesRequiredForInclusion const): * accessibility/AccessibleNode.cpp: (WebCore::AccessibleNode::notifyAttributeChanged): * dom/Element.cpp: (WebCore::Element::attributeChanged): 2018-02-08 Chris Dumez <cdumez@apple.com> Unreviewed, tiny partial rollout of r228260 as it caused some worker failures * bindings/js/JSDOMGlobalObject.cpp: (WebCore::toJSDOMGlobalObject): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSErrorHandler.cpp: (WebCore::JSErrorHandler::handleEvent): * bindings/js/JSEventListener.cpp: (WebCore::toJSDOMGlobalObject): Deleted. 2018-02-08 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderElement::removeAnonymousWrappersForInlinesIfNecessary to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182582 <rdar://problem/37327890> Reviewed by Antti Koivisto. Tree mutation -> RenderTreeBuilder. No change in functionality * rendering/RenderElement.cpp: (WebCore::RenderElement::styleDidChange): (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary): Deleted. * rendering/RenderElement.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::removeAnonymousWrappersForInlinesIfNecessary): (WebCore::RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock): (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilder.h: 2018-02-08 Philippe Normand <pnormand@igalia.com> [GStreamer] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash https://bugs.webkit.org/show_bug.cgi?id=173916 Reviewed by Xabier Rodriguez Calvar. This patch fixes two crashes and a runtime warning: - The provider client configuration should be done from the main thread but the no-more-pads signal of deinterleave was fired from a non-main thread. - The deinterleave pad-removed signal can be fired for a not fully configured pipeline if the audio context is interrupted. So the peer quark of the removed pad needs to be checked, it might be a null pointer. - The provider connects to the deinterleave signals only when a client is provided, so the signal disconnection needs to check that to avoid runtime warnings. * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp: (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer): Create a main thread notifier. (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer): Invalidate notifier and check a client was set before disconnecting from deinterleave signals. (WebCore::AudioSourceProviderGStreamer::handleRemovedDeinterleavePad): Check validity of the pad peer. (WebCore::AudioSourceProviderGStreamer::deinterleavePadsConfigured): Set client from main thread. * platform/audio/gstreamer/AudioSourceProviderGStreamer.h: 2018-02-08 Philippe Normand <pnormand@igalia.com> [GStreamer][WebAudio] No need for version check in each loop iteration https://bugs.webkit.org/show_bug.cgi?id=182577 Reviewed by Xabier Rodriguez Calvar. * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webkit_web_audio_src_init): Detect version once only, when creating the element. (webKitWebAudioSrcLoop): Use boolean variable instead of checking the version every time. 2018-02-08 Frederic Wang <fwang@igalia.com> Add scrolling node types to distinguish main frames and subframes. https://bugs.webkit.org/show_bug.cgi?id=182533 Reviewed by Simon Fraser. This patch splits FrameScrollingNode type into two types: MainFrameScrollingNode and SubframeScrollingNode. This is needed because new places in the code are likely to distinguish them e.g. in ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll or when iOS frame scrolling is introduced (see bug 173833). No new tests, behavior unchanged. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): This is only called for main frames, so pass MainFrameScrollingNode. * page/scrolling/ScrollingCoordinator.cpp: (WebCore::operator<<): Distinguish subframe and main frame when dumping. * page/scrolling/ScrollingCoordinator.h: Split FrameScrollingNode into two cases. * page/scrolling/ScrollingStateFrameScrollingNode.cpp: Add node type to constructor and ASSERT it remains of type FrameScrollingNode. (WebCore::ScrollingStateFrameScrollingNode::create): (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode): * page/scrolling/ScrollingStateFrameScrollingNode.h: Add node type to constructor. * page/scrolling/ScrollingStateNode.h: (WebCore::ScrollingStateNode::isFrameScrollingNode const): Includes the two cases. * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::createNode): Split FrameScrollingNode into two cases and pass the node type. (WebCore::ScrollingStateTree::attachNode): The first case only happens for main frames while the second case only happens with subframes. Use the appriate node type. * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: Add node type to constructor and ASSERT it remains of type FrameScrollingNode. (WebCore::ScrollingTreeFrameScrollingNode::ScrollingTreeFrameScrollingNode): * page/scrolling/ScrollingTreeFrameScrollingNode.h: Add node type to constructor. * page/scrolling/ScrollingTreeNode.h: Includes the two cases. (WebCore::ScrollingTreeNode::isFrameScrollingNode const): * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Add node type to constructor. * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Ditto. (WebCore::ScrollingTreeFrameScrollingNodeIOS::create): (WebCore::ScrollingTreeFrameScrollingNodeIOS::ScrollingTreeFrameScrollingNodeIOS): * page/scrolling/ios/ScrollingTreeIOS.cpp: Split FrameScrollingNode into two cases. (WebCore::ScrollingTreeIOS::createScrollingTreeNode): * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: Add node type to constructor. * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: Ditto. (WebCore::ScrollingTreeFrameScrollingNodeMac::create): (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac): * page/scrolling/mac/ScrollingTreeMac.cpp: Split FrameScrollingNode into two cases. (ScrollingTreeMac::createScrollingTreeNode): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): Distinguish the cases of main frames and subframes. (WebCore::scrollCoordinationRoleForNodeType): Split FrameScrollingNode into two cases. (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): Distinguish the cases of main frames and subframes. (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Split FrameScrollingNode into two cases. 2018-02-07 Darin Adler <darin@apple.com> Try to fix ErrorEvent tests seen failing on buildbot after fix for bug 179591. * bindings/js/JSErrorHandler.cpp: (WebCore::JSErrorHandler::handleEvent): Add back line of code accidentally removed. 2018-02-05 Carlos Garcia Campos <cgarcia@igalia.com> Add a way to check if a host is an IP address https://bugs.webkit.org/show_bug.cgi?id=182427 Reviewed by Alex Christensen. There are several places where this is needed. We currently just assume that any host ending in a digit is an IP address, except in PublicSuffix where platform specific code is used. This patch adds URL::hostIsIPAddress() platform specific implementations, falling back to current assumption if there isn't an implementation for the platform. * page/OriginAccessEntry.cpp: (WebCore::OriginAccessEntry::OriginAccessEntry): Use URL::hostIsIPAddress(). * platform/URL.cpp: (WebCore::URL::hostIsIPAddress): Fallback implementation. * platform/URL.h: * platform/mac/PublicSuffixMac.mm: (WebCore::topPrivatelyControlledDomain): Use URL::hostIsIPAddress(). * platform/mac/URLMac.mm: (WebCore::URL::hostIsIPAddress): Move implementation from PublicSuffixMac.mm. * platform/network/curl/CookieUtil.cpp: (WebCore::CookieUtil::isIPAddress): Use URL::hostIsIPAddress(). * platform/soup/URLSoup.cpp: (WebCore::URL::hostIsIPAddress): Use g_hostname_is_ip_address(). 2018-01-13 Darin Adler <darin@apple.com> Event improvements https://bugs.webkit.org/show_bug.cgi?id=179591 Reviewed by Chris Dumez. - removed all use of Deprecated::ScriptValue - fixed uses of JSC::Strong that can lead to reference cycles in CustomEvent, MessageEvent, and PopStateEvent, refactoring to share more code - removed incorrect use of CachedAttribute on attributes that can change values (should have fixed a bug; can we find a way to test this?) - did a more thorough job of clearing state from events, including clearing certain things before dispatching, and clearing more in initKeyboardEvent (may have fixed some obscure low-severity bugs; can we find a way to test this?) - removed "dummy" keyboard events - reworked code that omits details from error events for security reasons; old approach was "sanitizing" the error by removing the details if not allowed, new approach is adding the details only if allowed * Modules/encryptedmedia/NavigatorEME.h: Added forward declaration needed to compile. * Modules/indexeddb/IDBCursor.h: Added comment about incorrect use of JSC::Strong. * Modules/indexeddb/IDBRequest.h: Ditto. * Modules/paymentrequest/PaymentResponse.h: Ditto. * WebCore.xcodeproj/project.pbxproj: Added JSValueInWrappedObject.h. * bindings/js/CommonVM.cpp: (WebCore::commonVMSlow): Use VM::create instead of VM::createLeaked. Also use local variable instead of the global. * bindings/js/DOMWrapperWorld.h: Put the inline bodies of the currentWorld and worldForDOMObject functions separate from the declarations; long term goal is that the declarations serve as documentation, and are not interspersed with the implementations. Changed currentWorld to take a reference instead of a pointer to ExecState. Added isWorldCompatible function. * bindings/js/JSCustomElementInterface.cpp: (WebCore::JSCustomElementInterface::upgradeElement): Use toJSDOMWindow instead of toJSDOMGlobalObject and added check for null. (WebCore::JSCustomElementInterface::invokeCallback): Ditto. * bindings/js/JSCustomEventCustom.cpp: (WebCore::JSCustomEvent::detail const): Use cachedPropertyValue. (WebCore::JSCustomEvent::visitAdditionalChildren): Added. Needed now that we are using JSValueInWrappedObject instead of JSC::Strong. * bindings/js/JSDOMConvertEventListener.h: (WebCore::Converter<IDLEventListener<T>>::convert): Pass a reference. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::toJSDOMGlobalObject): Ditto. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::JSDOMGlobalObject): Moved initialization to nullptr to the header. (WebCore::toJSDOMGlobalObject): Deleted. * bindings/js/JSDOMGlobalObject.h: Updated for the above. * bindings/js/JSDOMWindowBase.h: Updated includes. Added "DOMWindow.h" but also expanded the deprecated "JSDOMBinding.h" into all the things it includes. * bindings/js/JSDOMWindowProxy.cpp: (WebCore::JSDOMWindowProxy::finishCreation): Tweak argument type to match usage. (WebCore::JSDOMWindowProxy::create): Moved here from header, rolled in the code that creates the structure. (WebCore::JSDOMWindowProxy::setWindow): Take a reference instead of a pointer or a RefPtr&&. (WebCore::JSDOMWindowProxy::toWrapped): Use ? : instead of if. (WebCore::toJS): Pass a reference. * bindings/js/JSDOMWindowProxy.h: Updated for abvoe changes. * bindings/js/JSDOMWrapper.cpp: (WebCore::cloneAcrossWorlds): Added. * bindings/js/JSDOMWrapper.h: Ditto. * bindings/js/JSErrorHandler.cpp: (WebCore::JSErrorHandler::JSErrorHandler): Changed to take a reference. Marked inline. (WebCore::JSErrorHandler::create): Moved here from header. No longer inline, but the constructor is now inline, so same number of levels of function calls, and less code compiled at the call site and less to compile in the header. (WebCore::JSErrorHandler::handleEvent): Use toJSDOMWindow instead of toJSDOMGlobalObject. * bindings/js/JSErrorHandler.h: Ditto. Also made createJSErrorHandler take references instead of pointers. * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::create): Moved here from the header. (WebCore::createEventListenerForEventHandlerAttribute): Updated for change to currentWorld. (WebCore::toJSDOMGlobalObject): Moved here from JSDOMGlobalObject.cpp because this is the only place this function is used now. Also, this was one of four different overrides and so it was good to delete the other three. Also updated to take a reference rather than a "must not be null" pointer. (WebCore::JSEventListener::handleEvent): Coding style tweaks. (WebCore::JSEventListener::virtualisAttribute const): Deleted. Now isAttribute is virtual and uses final as needed to remain inline-able and efficient. (WebCore::JSEventListener::operator== const): Use is<> and downcast<> instead of JSEventListener::cast. (WebCore::eventHandlerAttribute): Updated for change to currentWorld. (WebCore::setEventHandlerAttribute): Ditto. (WebCore::setWindowEventHandlerAttribute): Ditto. (WebCore::setDocumentEventHandlerAttribute): Ditto. * bindings/js/JSEventListener.h: Moved create functions into the cpp file. Removed the cast function, since callers can use is<> and downcast<> instead. Use final rather than override and made isAttribute override the virtual function in the base class, eliminating virtualIsAttribute. * bindings/js/JSExtendableMessageEventCustom.cpp: (WebCore::JSExtendableMessageEvent::data const): Use isWorldCompatible. Still need to return here and fix the reference cycle for this class. * bindings/js/JSLazyEventListener.cpp: (WebCore::eventParameterName): Moved up so it can be used by the constructor. (WebCore::convertZeroToOne): Added, so that the constructor can fix up text positions passed in to it as part of initializing a data member. (WebCore::JSLazyEventListener::JSLazyEventListener): Changed to take a CreationArguments object instead of lots of separate arguments. (WebCore::JSLazyEventListener::initializeJSFunction const): Removed unneeded checks of m_code and m_eventParameterName, both guaranteed not to be null by the constructor. Tweaked coding style a bit. (WebCore::JSLazyEventListener::create): Pass CreationArguments object. * bindings/js/JSLazyEventListener.h: Updated for above changes. Changed the m_eventParameterName to be a reference since it's always a global string that is never destroyed. * bindings/js/JSMessageEventCustom.cpp: (WebCore::JSMessageEvent::data const): Use cachedPropertyValue and also updated for the new version of MessageEvent that uses a Variant instead of a type plus separate functions for each type. (WebCore::JSMessageEvent::visitAdditionalChildren): Added. Needed now that we are using JSValueInWrappedObject instead of JSC::Strong. * bindings/js/JSPopStateEventCustom.cpp: (WebCore::JSPopStateEvent::state const): Use isWorldCompatible and also updated to use JSValueInWrappedObject instead of JSC::Strong. Would be nice to share more code with CustomEvent and MessageEvent, but at the moment they are subtly different. Changed cacheState from a function to a lambda. (WebCore::JSPopStateEvent::visitAdditionalChildren): Added. Needed now that we are using JSValueInWrappedObject instead of JSC::Strong. * bindings/js/JSValueInWrappedObject.h: Added. * bindings/js/ScriptCachedFrameData.cpp: (WebCore::ScriptCachedFrameData::restore): Updated for changes to JSDOMWindowProxy. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::createWindowProxy): Ditto. (WebCore::ScriptController::setDOMWindowForWindowProxy): Ditto. * bindings/js/WorkerScriptController.cpp: Removed include of ScriptValue.h. (WebCore::WorkerScriptController::evaluate): Reworked to use the new canIncludeErrorDetails instead of sanitizeScriptError. Added a FIXME about the strange handling of the error message out argument. * bindings/scripts/CodeGeneratorJS.pm: (GenerateRuntimeEnableConditionalString): Pass a reference to worldForDOMObject. (GenerateImplementation): Removed an incorrect comment about a removed error check that is truly unneeded. (GenerateAttributeGetterBodyDefinition): Pass a reference to worldForDOMObject. (GenerateAttributeSetterBodyDefinition): Pass references to createJSErrorHandler and worldForDOMObject. (GenerateCallWith): Pass a reference to worldForDOMObject. * bindings/scripts/test/JS/JSTestGlobalObject.cpp: Updated for above changes. * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: Ditto. * bindings/scripts/test/JS/JSTestObj.cpp: Ditto. * dom/CustomEvent.cpp: (WebCore::CustomEvent::CustomEvent): Marked inline. Removed now unneeded ExecState argument. (WebCore::CustomEvent::create): Moved here from header. No longer inline, but the constructor is now inline, so same number of levels of function calls, and less code compiled at the call site and less to compile in the header. (WebCore::CustomEvent::initCustomEvent): Updated to use JSValueInWrappedObject. (WebCore::CustomEvent::trySerializeDetail): Deleted. Now handled by bindings. * dom/CustomEvent.h: Updated for the above. * dom/CustomEvent.idl: Added JSCustomMarkFunction and removed CallWith=ScriptState. * dom/Document.cpp: (WebCore::Document::shouldBypassMainWorldContentSecurityPolicy const): Updated to pass reference to currentWorld but also rewrote to be more direct. * dom/Element.cpp: (WebCore::Element::isKeyboardFocusable const): Take a pointer instead of a reference to the keyboard event. This function can be called with no event; before this patch we were using a "dummy event". * dom/Element.h: Ditto. * dom/ErrorEvent.cpp: (WebCore::ErrorEvent::error): Use isWorldCompatible. * dom/Event.cpp: (WebCore::Event::create): Moved here from header. (WebCore::Event::createForBindings): Ditto. (WebCore::Event::initEvent): Updated to use the name m_canceled instead of the name m_defaultPrevented. (WebCore::Event::resetBeforeDispatch): Added. Clears m_defaultHandled so a value left over from a previous dispatch doesn't affect the next dispatch. * dom/Event.h: Renamed m_defaultPrevented to m_canceled to match specification terminology and be slightly clearer. Added resetBeforeDispatch. Removed the setDefaultPrevented function. * dom/EventDispatcher.cpp: (WebCore::EventDispatcher::dispatchEvent): Added call to resetBeforeDispatch. * dom/EventListener.h: Made isAttribute virtual and got rid of virtualIsAttribute, which was an alternative to using "final" before we had that in the language. * dom/EventTarget.cpp: (WebCore::EventTarget::dispatchEvent): Added call to resetBeforeDispatch. * dom/KeyboardEvent.cpp: (WebCore::KeyboardEvent::KeyboardEvent): Removed unneeded code that initializes m_handledByInputMethod to false; we do that in the class definition now. (WebCore::KeyboardEvent::create): Moved here from header. (WebCore::KeyboardEvent::createForBindings): Ditto. (WebCore::KeyboardEvent::initKeyboardEvent): Added code to reset m_charCode, m_isComposing, m_keyCode, m_repeat, m_underlyingPlatformEvent, m_which, m_code, and m_key. These are needed now that we can reuse an existing event; we don't want them getting out of sync with the other data members. (WebCore::KeyboardEvent::keyCode const): Updated for name change from m_keyEvent to m_underlyingPlatformEvent. (WebCore::KeyboardEvent::charCode const): Ditto. (WebCore::findKeyboardEvent): Deleted. Was unused. * dom/KeyboardEvent.h: Updated for the above. Removed KeyboardEvent::createForDummy. * dom/MessageEvent.cpp: (WebCore::MessageEvent::MessageEvent): Removed unnneded ExecState argument. Simplified since m_data is now a Variant. (WebCore::MessageEvent::create): More of the same. (WebCore::MessageEvent::initMessageEvent): Ditto. (WebCore::MessageEvent::trySerializeData): Deleted. (WebCore::MessageEvent::data const): Deleted. * dom/MessageEvent.h: Use a Variant. * dom/MessageEvent.idl: Added JSCustomMarkFunction and removed CallWith=ScriptState and CachedAttribute. * dom/MouseEvent.h: Removed obsolete comment. * dom/MouseEvent.idl: Wrap line differently. * dom/PopStateEvent.cpp: (WebCore::PopStateEvent::PopStateEvent): Removed unneeded ExecState argument. Updated to use JSValueInWrappedObject. (WebCore::PopStateEvent::create): Ditto. (WebCore::PopStateEvent::trySerializeState): Ditto. * dom/PopStateEvent.h: Ditto. * dom/PopStateEvent.idl: Use JSCustomMarkFunction, and don't use ConstructorCallWith=ScriptState. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::sanitizeScriptError): Deleted. (WebCore::ScriptExecutionContext::canIncludeErrorDetails): Added. (WebCore::ScriptExecutionContext::dispatchErrorEvent): Clarify by using canIncludeErrorDetails instead of sanitizeScriptError. * dom/ScriptExecutionContext.h: Ditto. * dom/WheelEvent.cpp: (WebCore::WheelEvent::WheelEvent): Updated for name change and also to eliminate m_initializedWithPlatformWheelEvent. (WebCore::WheelEvent::create): Moved here from header. (WebCore::WheelEvent::createForBindings): Ditto. (WebCore::WheelEvent::initWebKitWheelEvent): Renamed from initWheelEvent. * dom/WheelEvent.h: Renamed initWheelEvent to initWebKitWheelEvent since there is no standard init function for wheel events and we have this only for backward compatibility. Got rid of the separate boolean m_initializedWithPlatformWheelEvent and instead made the renamed m_wheelEvent, m_underlyingPlatformEvent, optional for when there is no underlying platform event. * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const): Take a pointer to the event so we can handle the case where there is no event. * html/BaseDateAndTimeInputType.h: Ditto. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::isKeyboardFocusable const): Ditto. * html/HTMLAnchorElement.h: Ditto. * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::isKeyboardFocusable const): Ditto. * html/HTMLAreaElement.h: Ditto. * html/HTMLDocument.cpp: Added include of "DOMWindow.h". * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::isKeyboardFocusable const): Take pointer to the event. * html/HTMLFormControlElement.h: Ditto. * html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::isKeyboardFocusable const): Ditto. * html/HTMLFrameOwnerElement.h: Ditto. * html/HTMLIFrameElement.h: Ditto. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::isKeyboardFocusable const): Ditto. (WebCore::HTMLInputElement::isTextFormControlKeyboardFocusable const): Ditto. * html/HTMLInputElement.h: Ditto. * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::isKeyboardFocusable const): Ditto. * html/HTMLPlugInElement.h: Ditto. * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::isKeyboardFocusable const): Ditto. * html/HTMLSelectElement.h: Ditto. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::isKeyboardFocusable const): Ditto. * html/HTMLTextAreaElement.h: Ditto. * html/InputType.cpp: (WebCore::InputType::isKeyboardFocusable const): Ditto. * html/InputType.h: Ditto. * html/RadioInputType.cpp: (WebCore::RadioInputType::isKeyboardFocusable const): Ditto. * html/RadioInputType.h: Ditto. * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::isKeyboardFocusable const): Ditto. * html/TextFieldInputType.h: Ditto. * inspector/CommandLineAPIHost.cpp: (WebCore::listenerEntriesFromListenerInfo): Pass reference to currentWorld. Use is<> and downcast<> instead of JSEventListener::cast. * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::isContentScript const): Pass reference to currentWorld. * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::buildObjectForEventListener): Use is<> and downcast<> instead of JSEventListener::cast. * mathml/MathMLElement.cpp: (WebCore::MathMLElement::isKeyboardFocusable const): Take a pointer to the event so we can handle the case where there is no event. * mathml/MathMLElement.h: Ditto. * page/DOMWindow.cpp: (WebCore::DOMWindow::dispatchEvent): Added call to resetBeforeDispatch. All event dispatching paths now need to do this; there are 3. * page/EventHandler.cpp: (WebCore::handleWheelEventInAppropriateEnclosingBox): Use the new underlyingPlatformEvent function, less confusing than calling a function named wheelEvent() on an object of type WheelEvent. Also, it returns a const& to std::optional instead of a pointer, so updated for that. (WebCore::EventHandler::defaultWheelEventHandler): Ditto. (WebCore::EventHandler::internalKeyEvent): Use preventDefault instead of setDefaultPrevented(true). (WebCore::EventHandler::tabsToLinks const): Take a pointer. (WebCore::EventHandler::defaultArrowEventHandler): Pass a pointer. (WebCore::EventHandler::defaultTabEventHandler): Ditto. * page/EventHandler.h: Updated for the above. * page/EventSource.cpp: (WebCore::EventSource::dispatchMessageEvent): Pass a reference rather than a pointer when creating a message event. * page/FocusController.cpp: (WebCore::isFocusableElementOrScopeOwner): Use a pointer instead of reference for keyboard event. (WebCore::isNonFocusableScopeOwner): Ditto. (WebCore::isFocusableScopeOwner): Ditto. (WebCore::shadowAdjustedTabIndex): Ditto. (WebCore::FocusController::findFocusableElementDescendingIntoSubframes): Renamed to use simpler terminology than "descending down into frame document". Changed to take a pointer instead of reference. (WebCore::FocusController::setInitialFocus): Pass nullptr instead of using KeyboardEvent::createForDummy. (WebCore::FocusController::advanceFocus): Pointer instead of reference. (WebCore::FocusController::advanceFocusInDocumentOrder): Ditto. (WebCore::FocusController::findFocusableElementAcrossFocusScope): Ditto. (WebCore::FocusController::findFocusableElementWithinScope): Ditto. (WebCore::FocusController::nextFocusableElementWithinScope): Ditto. (WebCore::FocusController::previousFocusableElementWithinScope): Ditto. (WebCore::FocusController::findFocusableElementOrScopeOwner): Ditto. (WebCore::FocusController::findElementWithExactTabIndex): Ditto. (WebCore::nextElementWithGreaterTabIndex): Ditto. (WebCore::previousElementWithLowerTabIndex): Ditto. (WebCore::FocusController::nextFocusableElement): Ditto. (WebCore::FocusController::previousFocusableElement): Ditto. (WebCore::FocusController::nextFocusableElementOrScopeOwner): Ditto. (WebCore::FocusController::previousFocusableElementOrScopeOwner): Ditto. (WebCore::FocusController::findFocusCandidateInContainer): Ditto. (WebCore::FocusController::advanceFocusDirectionallyInContainer): Ditto. (WebCore::FocusController::advanceFocusDirectionally): Ditto. * page/FocusController.h: Updated for the above. * page/PageConsoleClient.cpp: (WebCore::objectArgumentAt): Added. Helper to make functions below simpler. (WebCore::canvasRenderingContext): Factored out logic to get the context from either a canvas or a canvas rendering context from the functions below. Also updated to not use ScriptValue and to use auto quite a bit more. (WebCore::PageConsoleClient::record): Updated to use the functions above. (WebCore::PageConsoleClient::recordEnd): Ditto. * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::tabsToAllFormControls const): Take a pointer instead of a reference. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::tabsToAllFormControls const): Ditto. * page/win/EventHandlerWin.cpp: (WebCore::EventHandler::tabsToAllFormControls const): Ditto. * platform/glib/EventHandlerGLib.cpp: (WebCore::EventHandler::tabsToAllFormControls const): Ditto. * svg/SVGAElement.cpp: (WebCore::SVGAElement::isKeyboardFocusable const): Ditto. * svg/SVGAElement.h: Ditto. * testing/Internals.cpp: (WebCore::Internals::isFromCurrentWorld const): Use isWorldCompatible. 2018-02-07 Andy Estes <aestes@apple.com> ASSERTION FAILED: vm->currentThreadIsHoldingAPILock() seen with http/tests/paymentrequest/payment-request-show-method.https.html https://bugs.webkit.org/show_bug.cgi?id=182591 Reviewed by Youenn Fablet. Fixes assertion failures in http/tests/paymentrequest/payment-request-show-method.https.html. DOMPromise::whenSettled() calls the JSC API without first aquiring the API lock, and r228195 added a call to whenSettled() where the lock is not guaranteed to be already acquired. Fix this by creating a JSLockHolder in DOMPromise::whenSettled(). * bindings/js/JSDOMPromise.cpp: (WebCore::DOMPromise::whenSettled): 2018-02-07 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r228243. Introduced an assertion failure with API test FullscreenZoomInitialFrame.WebKit Reverted changeset: "Assert that NSApp is not running in the WebProcess." https://bugs.webkit.org/show_bug.cgi?id=182553 https://trac.webkit.org/changeset/228243 2018-02-07 Christopher Reid <chris.reid@sony.com> [Curl] Cookie Database has some warnings when compiled in clang https://bugs.webkit.org/show_bug.cgi?id=182583 Reviewed by Alex Christensen. No new tests, no change in behavior. Fixing unused-parameter, missing-field-initializers, reorder, and pragma-once-outside-header warnings. * platform/network/NetworkStorageSession.h: * platform/network/curl/CookieJarCurlDatabase.cpp: * platform/network/curl/CookieJarDB.cpp: * platform/network/curl/NetworkStorageSessionCurl.cpp: 2018-02-07 Ryosuke Niwa <rniwa@webkit.org> Remove unused CSSParserContext in CSSParser::parseInlineStyleDeclaration https://bugs.webkit.org/show_bug.cgi?id=182587 Reviewed by Simon Fraser. Removed the code. There is no need to create an unused CSSParserContext in CSSParser. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseInlineStyleDeclaration): * css/parser/CSSParser.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parseInlineStyleDeclaration): * css/parser/CSSParserImpl.h: 2018-02-07 Ross Kirsling <ross.kirsling@sony.com> Add missing #if ENABLE(VIDEO_TRACK) after r228201. https://bugs.webkit.org/show_bug.cgi?id=182585 Reviewed by Chris Dumez. * loader/LinkPreloadResourceClients.h: 2018-02-07 Per Arne Vollan <pvollan@apple.com> Assert that NSApp is not running in the WebProcess. https://bugs.webkit.org/show_bug.cgi?id=182553 <rdar://problem/37316144> Reviewed by Simon Fraser. In WebCore, there are a few places where NSApp is referenced. Since the WebContent process is no longer using the NSApplication run loop, and NSApp is no longer guaranteed to be valid, we should make sure that the NSApp is not referenced by the WebContent process or the Network process, by asserting that the NSApplication event loop is running when NSApp is referenced. It is still ok for the UIProcess to reference NSApp. Adding these assert will help catch references to NSApp when the NSApplication run loop is not used. Also, do not post a fake mouse event in PasteBoard::setDragImage when the NSApplication run loop is not running, since this is only relevant in WK1. No new tests, covered by existing tests. * page/mac/EventHandlerMac.mm: (WebCore::lastEventIsMouseUp): (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::setDragImage): * platform/mac/WebVideoFullscreenController.mm: (-[WebVideoFullscreenController windowDidLoad]): (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): * platform/mac/WebWindowAnimation.mm: (WebCore::WebWindowAnimationDurationFromDuration): 2018-02-07 Youenn Fablet <youenn@apple.com> ASSERTION FAILED: m_timeOrigin in Performance::Performance() https://bugs.webkit.org/show_bug.cgi?id=182558 <rdar://problem/37297551> Reviewed by Chris Dumez. Test: http/wpt/fetch/cors-preflight-star.any.serviceworker.html * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::startPreflight): 2018-02-07 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION(r226396): File paths are inserted when dropping image files https://bugs.webkit.org/show_bug.cgi?id=182557 <rdar://problem/37294120> Reviewed by Ryosuke Niwa. Reverts unintended changes in <http://trac.webkit.org/r226396>. Before r226396, WebContentReader::readFilenames (a helper function in macOS-specific code) contained logic to create and insert attachment elements if ENABLE(ATTACHMENT_ELEMENT); otherwise, it would fall back to inserting the visible URL as a text node. Since we enable the attachment element on all Cocoa platforms via xcconfig files, this was effectively dead code. However, when r226396 (which moved this out from macOS to Cocoa platform code) refactored this helper function, it also moved this chunk of code out of the !ENABLE(ATTACHMENT) conditional and into a PLATFORM(MAC) guard, which means that we now fall back to inserting file paths as text when attachment elements are disabled. To fix this, we simply remove the (previously) dead code. A more subtle difference is that we no longer always return true from WebContentReader::readFilePaths. This means that when we drop files, we no longer skip over the early return in documentFragmentFromDragData when we've made a fragment, so we read the file path as a URL. To address this, we just restore the pre-macOS 10.13.4 behavior of initializing the document fragment. Test: modified editing/pasteboard/drag-files-to-editable-element-as-URLs.html. * editing/WebContentReader.cpp: (WebCore::WebContentReader::ensureFragment): Deleted. Remove this helper, as it was only used in WebContentReader::readFilePaths. * editing/WebContentReader.h: * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readFilePaths): 2018-02-07 John Wilander <wilander@apple.com> Restrict Referer to just the origin for third parties in private mode and third parties ITP blocks cookies for in regular mode https://bugs.webkit.org/show_bug.cgi?id=182559 <rdar://problem/36990337> Reviewed by Andy Estes. Tests: http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html http/tests/security/strip-referrer-to-origin-for-third-party-redirects-in-private-mode.html http/tests/security/strip-referrer-to-origin-for-third-party-requests-in-private-mode.html * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::referrerToOriginString): Now exposed within WebCore. This is to make sure we create a proper referrer string in WebCore::ResourceRequestBase::setExistingHTTPReferrerToOriginString(). (WebCore::referrerToOriginString): Deleted. Used to be internal. * page/SecurityPolicy.h: * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setExistingHTTPReferrerToOriginString): New, exported function used in WebKit. Note that this function does not set the referrer if the request has none since before. * platform/network/ResourceRequestBase.h: 2018-02-07 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Remove RenderElement::destroyLeftoverChildren. https://bugs.webkit.org/show_bug.cgi?id=182518 <rdar://problem/37256035> Reviewed by Antti Koivisto. Remove leftover children before we call takeChild() on the parent (as opposed to when we finally call destroy() on the parent). This patch also explicitly destroys the top level pagination renderers. Covered by existing tests. * rendering/RenderElement.cpp: (WebCore::RenderElement::removeAndDestroyChild): (WebCore::RenderElement::destroyLeftoverChildren): Deleted. * rendering/RenderElement.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::destroy): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded): * rendering/updating/RenderTreeUpdater.h: 2018-02-07 Daniel Bates <dabates@apple.com> Log error when authentication challenge is blocked due to an insecure request https://bugs.webkit.org/show_bug.cgi?id=182358 Reviewed by Andy Estes. Emit an error message to Web Inspector console that explains why an authentication challenge was blocked so that a developer can fix up their site. Tests: http/tests/security/mixedContent/insecure-basic-auth-image.https.html http/tests/security/mixedContent/secure-page-navigates-to-basic-auth-insecure-page.https.html http/tests/security/mixedContent/secure-page-navigates-to-basic-auth-secure-page-via-insecure-redirect.https.html * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): Log to the console an error message if the document we are loading was forbidden from prompting for credentials. Also removed duplicate assertion to ensure document is non-null and update call to LinkLoader::loadLinksFromHeader() to use local variable to access the document we are loading instead of asking the frame for it, again. (WebCore::FrameLoader::reportAuthenticationChallengeBlocked): Added. * loader/FrameLoader.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::init): (WebCore::ResourceLoader::willSendRequestInternal): Track the decision to forbid asking for credentials due to Fetch spec. requirements (m_canAskClientForCredentials) independently from the decision to forbid them due to making an insecure request (m_wasInsecureRequestSeen) so that we know the reason why we blocked asking for credentials when we receive an authentication challenge. (WebCore::ResourceLoader::didBlockAuthenticationChallenge): Added. (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const): Modified code now that we track whether we have seen an insecure request so far independently from decision to forbid prompting for credentials due to a Fetch spec. requirement. (WebCore::ResourceLoader::didReceiveAuthenticationChallenge): Store a bit whether we have seen an insecure request when loading the resource so far. Disallow asking for credentials if we have seen an insecure request so far. Once we receive a response * loader/ResourceLoader.h: (WebCore::ResourceLoader::wasAuthenticationChallengeBlocked const): Added. (WebCore::ResourceLoader::wasInsecureRequestSeen const): Added. 2018-02-06 Matt Lewis <jlewis3@apple.com> Removed the assertions from VideoFullscreenInterfaceAVKit.mm temporarily to stop the resulting crashes during debugging. https://bugs.webkit.org/show_bug.cgi?id=182527 Unreviewed build fix. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::exitFullscreen): (VideoFullscreenInterfaceAVKit::cleanupFullscreen): 2018-02-07 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlock::removeLeftoverAnonymousBlock to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182510 <rdar://problem/37250037> Reviewed by Antti Koivisto. Do not reinvent subtree reparenting. Covered by existing tests. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::removeLeftoverAnonymousBlock): Deleted. * rendering/RenderBlock.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveAllChildrenToInternal): * rendering/RenderBoxModelObject.h: * rendering/RenderButton.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::detachRendererInternal): (WebCore::RenderElement::attachRendererInternal): (WebCore::RenderElement::insertChildInternal): (WebCore::RenderElement::takeChildInternal): * rendering/RenderElement.h: * rendering/RenderRuby.h: * rendering/RenderRubyRun.h: * rendering/RenderTextControl.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): (WebCore::RenderTreeBuilder::Block::childBecameNonInline): (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock): * rendering/updating/RenderTreeBuilderBlock.h: 2018-02-06 Don Olmstead <don.olmstead@sony.com> Remove WebCore/ForwardingHeaders directory https://bugs.webkit.org/show_bug.cgi?id=182347 Reviewed by Keith Miller. No new tests. No change in behavior. * CMakeLists.txt: * ForwardingHeaders/bindings/ScriptFunctionCall.h: Removed. * ForwardingHeaders/bindings/ScriptObject.h: Removed. * ForwardingHeaders/bindings/ScriptValue.h: Removed. * ForwardingHeaders/builtins/BuiltinNames.h: Removed. * ForwardingHeaders/builtins/BuiltinUtils.h: Removed. * ForwardingHeaders/builtins/JSCBuiltins.h: Removed. * ForwardingHeaders/bytecode/CodeBlock.h: Removed. * ForwardingHeaders/bytecode/SpeculatedType.h: Removed. * ForwardingHeaders/bytecode/UnlinkedFunctionExecutable.h: Removed. * ForwardingHeaders/debugger/Debugger.h: Removed. * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Removed. * ForwardingHeaders/domjit/DOMJITEffect.h: Removed. * ForwardingHeaders/domjit/DOMJITGetterSetter.h: Removed. * ForwardingHeaders/domjit/DOMJITHeapRange.h: Removed. * ForwardingHeaders/domjit/DOMJITSignature.h: Removed. * ForwardingHeaders/heap/BlockDirectoryInlines.h: Removed. * ForwardingHeaders/heap/DeleteAllCodeEffort.h: Removed. * ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h: Removed. * ForwardingHeaders/heap/GCActivityCallback.h: Removed. * ForwardingHeaders/heap/GCFinalizationCallback.h: Removed. * ForwardingHeaders/heap/HandleTypes.h: Removed. * ForwardingHeaders/heap/Heap.h: Removed. * ForwardingHeaders/heap/HeapInlines.h: Removed. * ForwardingHeaders/heap/HeapObserver.h: Removed. * ForwardingHeaders/heap/IncrementalSweeper.h: Removed. * ForwardingHeaders/heap/LockDuringMarking.h: Removed. * ForwardingHeaders/heap/MachineStackMarker.h: Removed. * ForwardingHeaders/heap/MarkedBlockInlines.h: Removed. * ForwardingHeaders/heap/MarkingConstraint.h: Removed. * ForwardingHeaders/heap/RunningScope.h: Removed. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Removed. * ForwardingHeaders/heap/SlotVisitor.h: Removed. * ForwardingHeaders/heap/SlotVisitorInlines.h: Removed. * ForwardingHeaders/heap/Strong.h: Removed. * ForwardingHeaders/heap/StrongInlines.h: Removed. * ForwardingHeaders/heap/SubspaceInlines.h: Removed. * ForwardingHeaders/heap/ThreadLocalCache.h: Removed. * ForwardingHeaders/heap/Weak.h: Removed. * ForwardingHeaders/heap/WeakInlines.h: Removed. * ForwardingHeaders/inspector/ConsoleMessage.h: Removed. * ForwardingHeaders/inspector/ContentSearchUtilities.h: Removed. * ForwardingHeaders/inspector/IdentifiersFactory.h: Removed. * ForwardingHeaders/inspector/InjectedScript.h: Removed. * ForwardingHeaders/inspector/InjectedScriptBase.h: Removed. * ForwardingHeaders/inspector/InjectedScriptHost.h: Removed. * ForwardingHeaders/inspector/InjectedScriptManager.h: Removed. * ForwardingHeaders/inspector/InjectedScriptModule.h: Removed. * ForwardingHeaders/inspector/InspectorAgentBase.h: Removed. * ForwardingHeaders/inspector/InspectorAgentRegistry.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatcher.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorEnvironment.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendChannel.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendRouter.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolObjects.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolTypes.h: Removed. * ForwardingHeaders/inspector/PerGlobalObjectWrapperWorld.h: Removed. * ForwardingHeaders/inspector/ScriptArguments.h: Removed. * ForwardingHeaders/inspector/ScriptBreakpoint.h: Removed. * ForwardingHeaders/inspector/ScriptCallFrame.h: Removed. * ForwardingHeaders/inspector/ScriptCallStack.h: Removed. * ForwardingHeaders/inspector/ScriptCallStackFactory.h: Removed. * ForwardingHeaders/inspector/ScriptDebugListener.h: Removed. * ForwardingHeaders/inspector/ScriptDebugServer.h: Removed. * ForwardingHeaders/inspector/agents/InspectorAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorConsoleAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorHeapAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorRuntimeAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorScriptProfilerAgent.h: Removed. * ForwardingHeaders/interpreter/CallFrame.h: Removed. * ForwardingHeaders/interpreter/FrameTracers.h: Removed. * ForwardingHeaders/interpreter/ShadowChicken.h: Removed. * ForwardingHeaders/interpreter/StackVisitor.h: Removed. * ForwardingHeaders/jit/JITCode.h: Removed. * ForwardingHeaders/jit/JITMathICForwards.h: Removed. * ForwardingHeaders/jit/Snippet.h: Removed. * ForwardingHeaders/jit/SnippetParams.h: Removed. * ForwardingHeaders/jit/SpillRegistersMode.h: Removed. * ForwardingHeaders/masm/X86Assembler.h: Removed. * ForwardingHeaders/parser/ParserError.h: Removed. * ForwardingHeaders/parser/SourceCode.h: Removed. * ForwardingHeaders/parser/SourceProvider.h: Removed. * ForwardingHeaders/parser/SourceProviderCache.h: Removed. * ForwardingHeaders/profiler/ProfilerDatabase.h: Removed. * ForwardingHeaders/runtime/ArgList.h: Removed. * ForwardingHeaders/runtime/ArrayBuffer.h: Removed. * ForwardingHeaders/runtime/ArrayBufferView.h: Removed. * ForwardingHeaders/runtime/ArrayPrototype.h: Removed. * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Removed. * ForwardingHeaders/runtime/BooleanObject.h: Removed. * ForwardingHeaders/runtime/CallData.h: Removed. * ForwardingHeaders/runtime/CatchScope.h: Removed. * ForwardingHeaders/runtime/CommonIdentifiers.h: Removed. * ForwardingHeaders/runtime/Completion.h: Removed. * ForwardingHeaders/runtime/ConfigFile.h: Removed. * ForwardingHeaders/runtime/ConsoleClient.h: Removed. * ForwardingHeaders/runtime/ConsoleTypes.h: Removed. * ForwardingHeaders/runtime/ConstructAbility.h: Removed. * ForwardingHeaders/runtime/ConstructData.h: Removed. * ForwardingHeaders/runtime/DataView.h: Removed. * ForwardingHeaders/runtime/DateInstance.h: Removed. * ForwardingHeaders/runtime/Error.h: Removed. * ForwardingHeaders/runtime/ErrorHandlingScope.h: Removed. * ForwardingHeaders/runtime/ErrorInstance.h: Removed. * ForwardingHeaders/runtime/ErrorPrototype.h: Removed. * ForwardingHeaders/runtime/Exception.h: Removed. * ForwardingHeaders/runtime/ExceptionHelpers.h: Removed. * ForwardingHeaders/runtime/Float32Array.h: Removed. * ForwardingHeaders/runtime/Float64Array.h: Removed. * ForwardingHeaders/runtime/FunctionConstructor.h: Removed. * ForwardingHeaders/runtime/FunctionExecutable.h: Removed. * ForwardingHeaders/runtime/FunctionPrototype.h: Removed. * ForwardingHeaders/runtime/HashMapImpl.h: Removed. * ForwardingHeaders/runtime/Identifier.h: Removed. * ForwardingHeaders/runtime/IdentifierInlines.h: Removed. * ForwardingHeaders/runtime/InitializeThreading.h: Removed. * ForwardingHeaders/runtime/Int16Array.h: Removed. * ForwardingHeaders/runtime/Int32Array.h: Removed. * ForwardingHeaders/runtime/Int8Array.h: Removed. * ForwardingHeaders/runtime/InternalFunction.h: Removed. * ForwardingHeaders/runtime/Intrinsic.h: Removed. * ForwardingHeaders/runtime/IterationKind.h: Removed. * ForwardingHeaders/runtime/IteratorOperations.h: Removed. * ForwardingHeaders/runtime/IteratorPrototype.h: Removed. * ForwardingHeaders/runtime/JSAPIValueWrapper.h: Removed. * ForwardingHeaders/runtime/JSArray.h: Removed. * ForwardingHeaders/runtime/JSArrayBuffer.h: Removed. * ForwardingHeaders/runtime/JSArrayBufferView.h: Removed. * ForwardingHeaders/runtime/JSCInlines.h: Removed. * ForwardingHeaders/runtime/JSCJSValue.h: Removed. * ForwardingHeaders/runtime/JSCJSValueInlines.h: Removed. * ForwardingHeaders/runtime/JSCallee.h: Removed. * ForwardingHeaders/runtime/JSCell.h: Removed. * ForwardingHeaders/runtime/JSCellInlines.h: Removed. * ForwardingHeaders/runtime/JSDataView.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObject.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSExportMacros.h: Removed. * ForwardingHeaders/runtime/JSFunction.h: Removed. * ForwardingHeaders/runtime/JSGlobalObject.h: Removed. * ForwardingHeaders/runtime/JSGlobalObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSInternalPromise.h: Removed. * ForwardingHeaders/runtime/JSInternalPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSLock.h: Removed. * ForwardingHeaders/runtime/JSMap.h: Removed. * ForwardingHeaders/runtime/JSMapIterator.h: Removed. * ForwardingHeaders/runtime/JSModuleLoader.h: Removed. * ForwardingHeaders/runtime/JSModuleRecord.h: Removed. * ForwardingHeaders/runtime/JSNativeStdFunction.h: Removed. * ForwardingHeaders/runtime/JSONObject.h: Removed. * ForwardingHeaders/runtime/JSObject.h: Removed. * ForwardingHeaders/runtime/JSObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSPromise.h: Removed. * ForwardingHeaders/runtime/JSPromiseConstructor.h: Removed. * ForwardingHeaders/runtime/JSPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSProxy.h: Removed. * ForwardingHeaders/runtime/JSRunLoopTimer.h: Removed. * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/JSScriptFetcher.h: Removed. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSSet.h: Removed. * ForwardingHeaders/runtime/JSSetIterator.h: Removed. * ForwardingHeaders/runtime/JSSourceCode.h: Removed. * ForwardingHeaders/runtime/JSString.h: Removed. * ForwardingHeaders/runtime/JSTypedArrays.h: Removed. * ForwardingHeaders/runtime/JSWithScope.h: Removed. * ForwardingHeaders/runtime/Lookup.h: Removed. * ForwardingHeaders/runtime/MapBase.h: Removed. * ForwardingHeaders/runtime/MapData.h: Removed. * ForwardingHeaders/runtime/MapDataInlines.h: Removed. * ForwardingHeaders/runtime/MatchResult.h: Removed. * ForwardingHeaders/runtime/Microtask.h: Removed. * ForwardingHeaders/runtime/ObjectConstructor.h: Removed. * ForwardingHeaders/runtime/ObjectPrototype.h: Removed. * ForwardingHeaders/runtime/Operations.h: Removed. * ForwardingHeaders/runtime/PrivateName.h: Removed. * ForwardingHeaders/runtime/PromiseDeferredTimer.h: Removed. * ForwardingHeaders/runtime/PropertyNameArray.h: Removed. * ForwardingHeaders/runtime/Protect.h: Removed. * ForwardingHeaders/runtime/RegExp.h: Removed. * ForwardingHeaders/runtime/RegExpObject.h: Removed. * ForwardingHeaders/runtime/RuntimeFlags.h: Removed. * ForwardingHeaders/runtime/SamplingProfiler.h: Removed. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/ScriptFetcher.h: Removed. * ForwardingHeaders/runtime/StringObject.h: Removed. * ForwardingHeaders/runtime/StringPrototype.h: Removed. * ForwardingHeaders/runtime/Structure.h: Removed. * ForwardingHeaders/runtime/StructureChain.h: Removed. * ForwardingHeaders/runtime/StructureInlines.h: Removed. * ForwardingHeaders/runtime/Symbol.h: Removed. * ForwardingHeaders/runtime/SymbolTable.h: Removed. * ForwardingHeaders/runtime/ThrowScope.h: Removed. * ForwardingHeaders/runtime/TypedArrayController.h: Removed. * ForwardingHeaders/runtime/TypedArrayInlines.h: Removed. * ForwardingHeaders/runtime/TypedArrays.h: Removed. * ForwardingHeaders/runtime/Uint16Array.h: Removed. * ForwardingHeaders/runtime/Uint32Array.h: Removed. * ForwardingHeaders/runtime/Uint8Array.h: Removed. * ForwardingHeaders/runtime/Uint8ClampedArray.h: Removed. * ForwardingHeaders/runtime/VM.h: Removed. * ForwardingHeaders/runtime/VMEntryScope.h: Removed. * ForwardingHeaders/runtime/Watchdog.h: Removed. * ForwardingHeaders/runtime/WeakGCMap.h: Removed. * ForwardingHeaders/runtime/WeakGCMapInlines.h: Removed. * ForwardingHeaders/runtime/WriteBarrier.h: Removed. * ForwardingHeaders/wasm/WasmModule.h: Removed. * ForwardingHeaders/wasm/js/JSWebAssemblyModule.h: Removed. * ForwardingHeaders/yarr/RegularExpression.h: Removed. * ForwardingHeaders/yarr/Yarr.h: Removed. * ForwardingHeaders/yarr/YarrInterpreter.h: Removed. * ForwardingHeaders/yarr/YarrJIT.h: Removed. * ForwardingHeaders/yarr/YarrPattern.h: Removed. * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: * Modules/encryptedmedia/MediaKeyMessageEvent.h: * Modules/encryptedmedia/MediaKeyMessageEventInit.h: * Modules/encryptedmedia/MediaKeyStatusMap.h: * Modules/encryptedmedia/legacy/LegacyCDM.h: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: * Modules/fetch/FetchBody.cpp: * Modules/fetch/FetchRequestInit.h: * Modules/fetch/FetchResponse.h: * Modules/indexeddb/IDBCursor.cpp: * Modules/indexeddb/IDBCursor.h: * Modules/indexeddb/IDBCursorWithValue.cpp: * Modules/indexeddb/IDBDatabase.cpp: * Modules/indexeddb/IDBIndex.cpp: * Modules/indexeddb/IDBKey.cpp: * Modules/indexeddb/IDBKeyRange.cpp: * Modules/indexeddb/IDBObjectStore.cpp: * Modules/indexeddb/IDBRequest.cpp: * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/client/TransactionOperation.cpp: * Modules/indexeddb/server/MemoryObjectStore.cpp: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: * Modules/mediacontrols/MediaControlsHost.cpp: * Modules/mediasource/SourceBuffer.cpp: * Modules/mediastream/RTCDataChannel.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: * Modules/webaudio/AsyncAudioDecoder.cpp: * Modules/webaudio/AudioBuffer.cpp: * Modules/webaudio/AudioBuffer.h: * Modules/webaudio/AudioContext.cpp: * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/PeriodicWave.h: * Modules/webaudio/RealtimeAnalyser.cpp: * Modules/webaudio/RealtimeAnalyser.h: * Modules/webaudio/ScriptProcessorNode.cpp: * Modules/webaudio/WaveShaperProcessor.h: * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.h: * Modules/websockets/WebSocket.cpp: * Modules/websockets/WebSocketChannel.cpp: * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: * Modules/webvr/VREyeParameters.h: * Modules/webvr/VRFrameData.h: * Modules/webvr/VRPose.h: * Modules/webvr/VRStageParameters.h: * PlatformWin.cmake: * bindings/IDLTypes.h: * bindings/js/BufferSource.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/CachedScriptSourceProvider.h: * bindings/js/CallTracerTypes.h: * bindings/js/CommonVM.cpp: * bindings/js/DOMGCOutputConstraint.cpp: * bindings/js/DOMGCOutputConstraint.h: * bindings/js/GCController.cpp: * bindings/js/GCController.h: * bindings/js/IDBBindingUtilities.cpp: * bindings/js/JSCallbackData.cpp: * bindings/js/JSCallbackData.h: * bindings/js/JSCustomElementInterface.cpp: * bindings/js/JSCustomElementInterface.h: * bindings/js/JSCustomEventCustom.cpp: * bindings/js/JSCustomXPathNSResolver.cpp: * bindings/js/JSCustomXPathNSResolver.h: * bindings/js/JSDOMBinding.h: * bindings/js/JSDOMBuiltinConstructorBase.cpp: * bindings/js/JSDOMConstructorBase.cpp: * bindings/js/JSDOMConvertBase.h: * bindings/js/JSDOMConvertBufferSource.h: * bindings/js/JSDOMConvertDate.cpp: * bindings/js/JSDOMConvertInterface.h: * bindings/js/JSDOMConvertJSON.h: * bindings/js/JSDOMConvertNumbers.cpp: * bindings/js/JSDOMConvertNumbers.h: * bindings/js/JSDOMConvertObject.h: * bindings/js/JSDOMConvertRecord.h: * bindings/js/JSDOMConvertSequences.h: * bindings/js/JSDOMConvertStrings.cpp: * bindings/js/JSDOMConvertUnion.h: * bindings/js/JSDOMExceptionHandling.cpp: * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMGlobalObjectTask.cpp: * bindings/js/JSDOMGuardedObject.h: * bindings/js/JSDOMIterator.cpp: * bindings/js/JSDOMIterator.h: * bindings/js/JSDOMMapLike.cpp: * bindings/js/JSDOMMapLike.h: * bindings/js/JSDOMPromise.cpp: * bindings/js/JSDOMPromise.h: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMPromiseDeferred.h: * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSDOMWindowProxy.cpp: * bindings/js/JSDOMWindowProxy.h: * bindings/js/JSDOMWrapper.cpp: * bindings/js/JSDOMWrapper.h: * bindings/js/JSDOMWrapperCache.cpp: * bindings/js/JSDOMWrapperCache.h: * bindings/js/JSDynamicDowncast.h: * bindings/js/JSErrorHandler.cpp: * bindings/js/JSEventCustom.cpp: * bindings/js/JSEventListener.cpp: * bindings/js/JSEventListener.h: * bindings/js/JSHTMLElementCustom.cpp: * bindings/js/JSHistoryCustom.cpp: * bindings/js/JSIDBCursorWithValueCustom.cpp: * bindings/js/JSIDBIndexCustom.cpp: * bindings/js/JSImageDataCustom.cpp: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLocationCustom.cpp: * bindings/js/JSMainThreadExecState.h: * bindings/js/JSMainThreadExecStateInstrumentation.h: * bindings/js/JSMessageChannelCustom.cpp: * bindings/js/JSMessageEventCustom.cpp: * bindings/js/JSNodeIteratorCustom.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSReadableStreamPrivateConstructors.cpp: * bindings/js/JSTreeWalkerCustom.cpp: * bindings/js/JSWebGL2RenderingContextCustom.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/ReadableStreamDefaultController.cpp: * bindings/js/ReadableStreamDefaultController.h: * bindings/js/ScheduledAction.cpp: * bindings/js/ScheduledAction.h: * bindings/js/ScriptCachedFrameData.cpp: * bindings/js/ScriptCachedFrameData.h: * bindings/js/ScriptController.cpp: * bindings/js/ScriptController.h: * bindings/js/ScriptControllerMac.mm: * bindings/js/ScriptModuleLoader.cpp: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/js/ScriptState.cpp: * bindings/js/ScriptWrappable.h: * bindings/js/ScriptWrappableInlines.h: * bindings/js/SerializedScriptValue.cpp: * bindings/js/SerializedScriptValue.h: * bindings/js/StructuredClone.cpp: * bindings/js/WebCoreBuiltinNames.h: * bindings/js/WebCoreJSClientData.cpp: * bindings/js/WebCoreTypedArrayController.cpp: * bindings/js/WebCoreTypedArrayController.h: * bindings/js/WorkerScriptController.cpp: * bindings/js/WorkerScriptController.h: * bridge/NP_jsobject.cpp: * bridge/c/CRuntimeObject.cpp: * bridge/c/c_class.cpp: * bridge/c/c_instance.cpp: * bridge/c/c_runtime.cpp: * bridge/c/c_utility.cpp: * bridge/c/c_utility.h: * bridge/jsc/BridgeJSC.cpp: * bridge/jsc/BridgeJSC.h: * bridge/npruntime.cpp: * bridge/objc/ObjCRuntimeObject.mm: * bridge/objc/WebScriptObject.mm: * bridge/objc/WebScriptObjectPrivate.h: * bridge/objc/objc_instance.mm: * bridge/objc/objc_runtime.h: * bridge/objc/objc_runtime.mm: * bridge/objc/objc_utility.h: * bridge/objc/objc_utility.mm: * bridge/runtime_array.cpp: * bridge/runtime_array.h: * bridge/runtime_method.cpp: * bridge/runtime_method.h: * bridge/runtime_object.cpp: * bridge/runtime_object.h: * bridge/runtime_root.cpp: * bridge/runtime_root.h: * crypto/SubtleCrypto.cpp: * crypto/SubtleCrypto.h: * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: * crypto/keys/CryptoRsaKeyAlgorithm.h: * crypto/mac/CryptoKeyRSAMac.cpp: * crypto/parameters/CryptoAlgorithmEcdsaParams.h: * crypto/parameters/CryptoAlgorithmHkdfParams.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: * css/CSSFontFaceSource.h: * css/DOMMatrixReadOnly.cpp: * css/DOMMatrixReadOnly.h: * css/FontFace.cpp: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementRegistry.cpp: * dom/CustomEvent.cpp: * dom/CustomEvent.h: * dom/Document.cpp: * dom/Document.h: * dom/ErrorEvent.cpp: * dom/ErrorEvent.h: * dom/LoadableScript.h: * dom/MessageEvent.cpp: * dom/MessageEvent.h: * dom/ModuleFetchParameters.h: * dom/PopStateEvent.cpp: * dom/PopStateEvent.h: * dom/PromiseRejectionEvent.cpp: * dom/PromiseRejectionEvent.h: * dom/RejectedPromiseTracker.cpp: * dom/RejectedPromiseTracker.h: * dom/ScriptExecutionContext.cpp: * dom/ScriptExecutionContext.h: * dom/TextEncoder.cpp: * dom/TextEncoder.h: * domjit/DOMJITHelpers.h: * domjit/DOMJITIDLTypeFilter.h: * domjit/JSDocumentDOMJIT.cpp: * domjit/JSNodeDOMJIT.cpp: * fileapi/BlobBuilder.cpp: * fileapi/FileReader.cpp: * fileapi/FileReaderLoader.cpp: * fileapi/FileReaderSync.cpp: * html/BaseTextInputType.cpp: * html/EmailInputType.cpp: * html/HTMLAllCollection.cpp: * html/HTMLCanvasElement.cpp: * html/HTMLImageLoader.cpp: * html/HTMLMediaElement.cpp: * html/HTMLPlugInImageElement.cpp: * html/ImageData.cpp: * html/ImageData.h: * html/MediaEncryptedEventInit.h: * html/WebKitMediaKeyError.h: * html/canvas/WebGLAny.h: * html/canvas/WebGLRenderingContext.cpp: * html/canvas/WebGLRenderingContextBase.cpp: * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGPUBuffer.cpp: * html/canvas/WebGPURenderingContext.cpp: * html/canvas/WebGPURenderingContext.h: * html/track/DataCue.cpp: * html/track/DataCue.h: * inspector/CommandLineAPIHost.cpp: * inspector/CommandLineAPIHost.h: * inspector/CommandLineAPIModule.cpp: * inspector/CommandLineAPIModule.h: * inspector/InspectorCanvas.cpp: * inspector/InspectorCanvas.h: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorController.h: * inspector/InspectorDatabaseResource.h: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorInstrumentation.h: * inspector/InspectorOverlay.cpp: * inspector/InspectorOverlay.h: * inspector/InspectorShaderProgram.cpp: * inspector/InspectorShaderProgram.h: * inspector/InspectorStyleSheet.cpp: * inspector/InspectorStyleSheet.h: * inspector/InspectorWebAgentBase.h: * inspector/InstrumentingAgents.h: * inspector/PageScriptDebugServer.cpp: * inspector/PageScriptDebugServer.h: * inspector/TimelineRecordFactory.cpp: * inspector/WebInjectedScriptHost.h: * inspector/WebInjectedScriptManager.h: * inspector/WorkerInspectorController.cpp: * inspector/WorkerInspectorController.h: * inspector/WorkerScriptDebugServer.cpp: * inspector/WorkerScriptDebugServer.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/InspectorApplicationCacheAgent.h: * inspector/agents/InspectorCSSAgent.cpp: * inspector/agents/InspectorCSSAgent.h: * inspector/agents/InspectorCanvasAgent.cpp: * inspector/agents/InspectorCanvasAgent.h: * inspector/agents/InspectorDOMAgent.cpp: * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDatabaseAgent.cpp: * inspector/agents/InspectorDatabaseAgent.h: * inspector/agents/InspectorIndexedDBAgent.cpp: * inspector/agents/InspectorIndexedDBAgent.h: * inspector/agents/InspectorLayerTreeAgent.cpp: * inspector/agents/InspectorLayerTreeAgent.h: * inspector/agents/InspectorMemoryAgent.cpp: * inspector/agents/InspectorMemoryAgent.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorWorkerAgent.h: * inspector/agents/WebConsoleAgent.cpp: * inspector/agents/WebConsoleAgent.h: * inspector/agents/WebDebuggerAgent.h: * inspector/agents/WebHeapAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: * inspector/agents/page/PageRuntimeAgent.cpp: * inspector/agents/page/PageRuntimeAgent.h: * inspector/agents/worker/ServiceWorkerAgent.h: * inspector/agents/worker/WorkerDebuggerAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.h: * loader/EmptyClients.cpp: * page/CaptionUserPreferences.cpp: * page/Chrome.cpp: * page/ChromeClient.h: * page/Crypto.cpp: * page/DOMWindow.cpp: * page/DOMWindow.h: * page/Frame.cpp: * page/OriginThreadLocalCache.h: * page/PageConsoleClient.cpp: * page/PageConsoleClient.h: * page/PageDebuggable.cpp: * page/PageGroup.cpp: * page/SettingsBase.h: * page/UserContentController.cpp: * page/cocoa/ResourceUsageThreadCocoa.mm: * page/csp/ContentSecurityPolicy.cpp: * page/ios/FrameIOS.mm: * page/linux/ResourceUsageOverlayLinux.cpp: * page/linux/ResourceUsageThreadLinux.cpp: * platform/MediaSample.h: * platform/SerializedPlatformRepresentation.h: * platform/SharedBuffer.h: * platform/audio/mac/CARingBuffer.h: * platform/cocoa/SharedBufferCocoa.mm: * platform/graphics/ImageBuffer.h: * platform/graphics/LegacyCDMSession.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/MediaSampleAVFObjC.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/cairo/ImageBufferCairo.cpp: * platform/graphics/cg/ImageBufferDataCG.cpp: * platform/graphics/cg/ImageBufferDataCG.h: * platform/graphics/cocoa/GPUDeviceMetal.mm: * platform/graphics/filters/FEBlend.cpp: * platform/graphics/filters/FEColorMatrix.cpp: * platform/graphics/filters/FEComponentTransfer.cpp: * platform/graphics/filters/FEComposite.cpp: * platform/graphics/filters/FEConvolveMatrix.cpp: * platform/graphics/filters/FEDisplacementMap.cpp: * platform/graphics/filters/FEDropShadow.cpp: * platform/graphics/filters/FEGaussianBlur.cpp: * platform/graphics/filters/FELighting.h: * platform/graphics/filters/FEMorphology.cpp: * platform/graphics/filters/FETurbulence.cpp: * platform/graphics/filters/FilterEffect.cpp: * platform/graphics/filters/FilterEffect.h: * platform/graphics/gpu/GPUBuffer.h: * platform/graphics/gpu/GPUDevice.h: * platform/graphics/iso/ISOBox.cpp: * platform/graphics/iso/ISOOriginalFormatBox.cpp: * platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: * platform/graphics/iso/ISOSchemeInformationBox.cpp: * platform/graphics/iso/ISOSchemeTypeBox.cpp: * platform/graphics/iso/ISOTrackEncryptionBox.cpp: * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: * platform/graphics/win/ImageBufferDataDirect2D.cpp: * platform/graphics/win/ImageBufferDataDirect2D.h: * platform/ios/wak/WebCoreThread.mm: * platform/mac/SerializedPlatformRepresentationMac.mm: * platform/mac/StringUtilities.mm: * platform/mock/mediasource/MockBox.cpp: * platform/mock/mediasource/MockSourceBufferPrivate.cpp: * svg/graphics/SVGImage.cpp: * testing/GCObservation.cpp: * testing/GCObservation.h: * testing/Internals.cpp: * testing/Internals.h: * testing/LegacyMockCDM.cpp: * testing/MockCDMFactory.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/Worker.cpp: * workers/Worker.h: * workers/WorkerConsoleClient.cpp: * workers/WorkerConsoleClient.h: * workers/WorkerGlobalScope.cpp: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.cpp: * workers/WorkerMessagingProxy.cpp: * workers/WorkerThread.h: * workers/service/ExtendableEvent.cpp: * workers/service/ServiceWorker.cpp: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClient.h: * workers/service/context/ServiceWorkerInspectorProxy.cpp: * workers/service/context/ServiceWorkerThread.cpp: * xml/XMLHttpRequest.cpp: 2018-02-06 Said Abou-Hallawa <sabouhallawa@apple.com> Rendering SVG images with same size as WebGL texture doesn't work correctly https://bugs.webkit.org/show_bug.cgi?id=182367 Reviewed by Dean Jackson. If am image buffer is created for a webgl texture and then it is reused for another texture, it has to be cleared before drawing. Test: webgl/webgl-texture-image-buffer-reuse.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer): 2018-02-06 Youenn Fablet <youenn@apple.com> Use downcast in createLinkPreloadResourceClient https://bugs.webkit.org/show_bug.cgi?id=182488 Reviewed by Antti Koivisto. No observable change of behavior. Add a new link preloader client for text track. * loader/LinkLoader.cpp: (WebCore::createLinkPreloadResourceClient): * loader/LinkPreloadResourceClients.h: 2018-02-06 Youenn Fablet <youenn@apple.com> imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-response-body-with-invalid-chunk.https.html is flaky https://bugs.webkit.org/show_bug.cgi?id=182541 Reviewed by Chris Dumez. Covered by test being no longer flaky. In case of loading error when getting the response body, we were only reporting the error if there was a callback set or a ReadableStream already created. Otherwise, we were just stopping loading and if creating a ReadableStream, we were just returning an empty body. FetchBodyOwner now stores a loading error. In case a readable stream is created, it will error it if there is a loading error. If there is not and the loading failed later on, the stream will be errored using the current code path. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): 2018-02-06 Andy Estes <aestes@apple.com> [Payment Request] show() should take an optional PaymentDetailsUpdate promise https://bugs.webkit.org/show_bug.cgi?id=182538 <rdar://problem/36754552> Reviewed by Tim Horton. Taught show() to take an optional promise for a PaymentDetailsUpdate. Added test cases to http/tests/paymentrequest/payment-request-show-method.https.html. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::detailsUpdated): Changed to take a PaymentRequest::UpdateReason instead of a eventType string. (WebCore::ApplePayPaymentHandler::shippingAddressUpdated): (WebCore::ApplePayPaymentHandler::shippingOptionUpdated): (WebCore::ApplePayPaymentHandler::paymentMethodUpdated): (WebCore::ApplePayPaymentHandler::didAuthorizePayment): (WebCore::ApplePayPaymentHandler::didSelectShippingMethod): (WebCore::ApplePayPaymentHandler::didSelectShippingContact): (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod): Asserted that only one of the PaymentSession delegates is executing at a time. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: * Modules/paymentrequest/PaymentHandler.h: Changed detailsUpdated to take a PaymentRequest::UpdateReason instead of a eventType string. * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::show): If there is a details promise, call updateWith() with UpdateReason::ShowDetailsResolved. (WebCore::PaymentRequest::shippingAddressChanged): (WebCore::PaymentRequest::shippingOptionChanged): (WebCore::PaymentRequest::paymentMethodChanged): Used whenDetailsSettled() to ensure that update events do not start before the show() details promise settles. (WebCore::PaymentRequest::updateWith): (WebCore::PaymentRequest::settleDetailsPromise): Changed to use a PaymentRequest::UpdateReason instead of a eventType string. (WebCore::PaymentRequest::whenDetailsSettled): If there is a details promise, wait for it to settle before executing the callback. * Modules/paymentrequest/PaymentRequest.h: Defined enum class UpdateReason. * Modules/paymentrequest/PaymentRequest.idl: Updated show() to take an optional Promise<PaymentDetailsUpdate>. * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp: (WebCore::PaymentRequestUpdateEvent::updateWith): Map the event type to a PaymentRequest::UpdateReason. 2018-02-06 Dean Jackson <dino@apple.com> REGRESSION: WebGL no longer producing a transparent canvas on iOS https://bugs.webkit.org/show_bug.cgi?id=182550 <rdar://problem/37234491> Reviewed by Eric Carlson. Due to some weirdness GL_RGBA8 is sometimes different between iOS and other platforms. Only tell the WebGLLayer that it is opaque when it really is not transparent. Covered by existing test: fast/canvas/webgl/context-attributes-alpha * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::GraphicsContext3D::setRenderbufferStorageFromDrawable): Look at the context attributes to decide if we should use an opaque layer. * platform/graphics/cocoa/WebGLLayer.mm: Ditto. (-[WebGLLayer initWithGraphicsContext3D:]): 2018-02-06 Andy Estes <aestes@apple.com> [WebIDL] Support optional Promise arguments https://bugs.webkit.org/show_bug.cgi?id=182399 <rdar://problem/36754552> Reviewed by Sam Weinig and Chris Dumez. Previously, declaring a Promise argument as optional would result in a native type of std::optional<RefPtr<DOMPromise>>. This is wasteful, since RefPtr can represent an optional argument by storing nullptr. Further, PassArgumentExpression() assumed Promises were never optional and tried to pass the argument as a Ref by calling RefPtr::releaseNonNull(). This patch removes the std::optional wrapper around optional Promises and simply passes the promise as a RefPtr to native code. * bindings/scripts/CodeGeneratorJS.pm: (PassArgumentExpression): (GenerateParametersCheck): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalPromiseBody): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalPromise): * bindings/scripts/test/TestObj.idl: 2018-02-06 Youenn Fablet <youenn@apple.com> HasServiceWorkerRegistration bit should be sent when creating a new page https://bugs.webkit.org/show_bug.cgi?id=182410 Reviewed by Chris Dumez. Covered by new API test. Changed the default value of service workers being registered to false. Every page created in the process will be responsible to change the value to true, at which time the value will be kept to true for the lifetime of the process. * workers/service/ServiceWorkerProvider.h: 2018-02-06 Ross Kirsling <ross.kirsling@sony.com> Add missing #if ENABLE(VIDEO) after r228092. https://bugs.webkit.org/show_bug.cgi?id=182539 Reviewed by Michael Catanzaro. * html/ImageBitmap.cpp: 2018-02-06 Antoine Quint <graouts@apple.com> [Modern Media Controls] Test at media/modern-media-controls/tracks-panel/tracks-panel-controls-bar-remains-visible-after-clicking-over-it.html fails https://bugs.webkit.org/show_bug.cgi?id=182425 Reviewed by Dean Jackson. This test failed because the controls bar would not hit test at the moment we synthesized a mousemove over the controls bar as the first step towards synthesizing a click on the controls bar to dismiss the tracks panel. Indeed, it would have "pointer-events" set to "none" until the tracks panel was dismissed, which would only happen after the click event had been propagated. All we need to do is to ensure that none of the controls within the controls bar get activated as a result of clicking over them when the tracks panel is visible, so we instead set "pointer-events" to "none" on all children of a controls bar rather than the controls bar itself, which can thus still hit test. * Modules/modern-media-controls/controls/media-controls.css: (.media-controls.shows-tracks-panel > .controls-bar > *,): (.media-controls.shows-tracks-panel > .controls-bar,): Deleted. 2018-02-06 Chris Dumez <cdumez@apple.com> Service workers registrations are saved to disk before the install / activation succeeds https://bugs.webkit.org/show_bug.cgi?id=182535 <rdar://problem/36591485> Reviewed by Youenn Fablet. Service workers registrations are saved to disk before the install / activation succeeds. This means if the browser exits before the install / activation succeeds, we may restore from disk a registration with an “active” worker which may have never been installed / activated. To address the issue, we now delay saving the registration to disk until after the service worker has been activated. No new tests, restoration from disk is covered by API tests that still pass. * workers/service/server/SWServer.cpp: (WebCore::SWServer::didFinishActivation): (WebCore::SWServer::installContextData): 2018-02-06 Ms2ger <Ms2ger@igalia.com> Initialize ImageBitmap::m_bitmapData in the constructor. https://bugs.webkit.org/show_bug.cgi?id=182487 Reviewed by Sam Weinig. This removes the span of time where an ImageBitmap object would exist with a null m_bitmapData during its construction. No new tests: no behavior changes. * html/ImageBitmap.cpp: (WebCore::ImageBitmap::create): update signature (WebCore::ImageBitmap::createPromise): update callers (WebCore::ImageBitmap::ImageBitmap): update signature * html/ImageBitmap.h: update signatures 2018-02-05 Ryosuke Niwa <rniwa@webkit.org> Release assertion in inlineVideoFrame https://bugs.webkit.org/show_bug.cgi?id=182513 <rdar://problem/37159363> Reviewed by Zalan Bujtas. The bug was caused by the fact it's not always safe to invoke updateLayout even when isSafeToUpdateStyleOrLayout on a document of a flattened frame on iOS. isSafeToUpdateStyleOrLayout returns true when the frame view is in the frame-flattening mode to avoid hitting a release asssertion in updateLayout of the frame. However, it's still not safe to invoke updateLayout on a parent frame in this case. As a result, inlineVideoFrame (in Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm) invokes updateLayout even when the top-level document is not safe to update when the video element is in a frame-flattened document. Fixed this bug by explicitly checking that we still have a live render tree and document hasn't been stopped. Also replaced other uses of isSafeToUpdateStyleOrLayout by more explicit checks. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::updateBackingStore): Made the early exit condition added in r227006 more explicit. Namely, InspectorDOMAgent::pseudoElementCreated is invoked during style recalc. * dom/Document.cpp: (WebCore::isSafeToUpdateStyleOrLayout): Made this local to the file. (WebCore::Document::updateStyleIfNeeded): (WebCore::Document::updateLayout): * dom/Document.h: * html/MediaElementSession.cpp: (WebCore::isMainContentForPurposesOfAutoplay): Made the early exit condition added in r227529 more explicit. Don't update the layout when the render tree had been destroyed or the active DOM objects had been stopped. 2018-02-05 Youenn Fablet <youenn@apple.com> Crash in imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-origin.sub.html https://bugs.webkit.org/show_bug.cgi?id=182422 <rdar://problem/37182665> Reviewed by Alex Christensen. Covered by test no longer crashing in Debug mode. Make sure completionHandler is called on the main thread. * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]): 2018-02-05 Filip Pizlo <fpizlo@apple.com> Global objects should be able to use TLCs to allocate from different blocks from each other https://bugs.webkit.org/show_bug.cgi?id=182227 Reviewed by Daniel Bates and Chris Dumez. No new tests because no change in behavior. Adopt JSC TLC API to put distance between objects from different security origins. WebCore has a subclass of ThreadLocalCache that supports hash-consing based on the relevant origin data using the existing SecurityOriginHash. It's Document's job to initiate this, but all of the logic is in WebCore::OriginThreadLocalCache. Workers don't opt into this. They just get the VM's default TLC all the time. * ForwardingHeaders/heap/ThreadLocalCache.h: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::JSDOMGlobalObject): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::JSDOMWindowBase): * dom/Document.cpp: (WebCore::Document::initSecurityContext): (WebCore::Document::threadLocalCache): * dom/Document.h: * page/OriginThreadLocalCache.cpp: Added. (WebCore::threadLocalCacheMap): (WebCore::OriginThreadLocalCache::create): (WebCore::OriginThreadLocalCache::~OriginThreadLocalCache): (WebCore::OriginThreadLocalCache::OriginThreadLocalCache): * page/OriginThreadLocalCache.h: Added. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::passesFileCheck const): (WebCore::SecurityOrigin::setEnforcesFilePathSeparation): (WebCore::SecurityOrigin::toString const): (WebCore::SecurityOrigin::enforceFilePathSeparation): Deleted. * page/SecurityOrigin.h: (WebCore::SecurityOrigin::enforcesFilePathSeparation const): 2018-02-05 Per Arne Vollan <pvollan@apple.com> [Win] Release assert failed under NetworkStateNotifier::singleton. https://bugs.webkit.org/show_bug.cgi?id=182516 Reviewed by Brent Fulgham. The callback NetworkStateNotifier::addressChangeCallback will always be called on a worker thread on Windows. Since the method NetworkStateNotifier::singleton() is called by NetworkStateNotifier::addressChangeCallback, but has to be called on the on the main thread, the call has to be moved there. No new tests. I have not been able to reproduce the crash. * platform/network/win/NetworkStateNotifierWin.cpp: (WebCore::NetworkStateNotifier::addressChangeCallback): 2018-02-05 Don Olmstead <don.olmstead@sony.com> Abstract heap generator should include JavaScriptCore headers directly https://bugs.webkit.org/show_bug.cgi?id=182501 Reviewed by Alex Christensen. No new tests. No change in behavior. * domjit/generate-abstract-heap.rb: 2018-02-05 Wenson Hsieh <wenson_hsieh@apple.com> [Extra zoom mode] Implement number pad UI when editing `tel` and `number` inputs https://bugs.webkit.org/show_bug.cgi?id=182472 <rdar://problem/35143057> Reviewed by Tim Horton. Adds a localized string for the "Done" button text in extra zoomed form controls. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::formControlDoneButtonTitle): * platform/LocalizedStrings.h: 2018-02-05 John Wilander <wilander@apple.com> Build fix for r228115, simple naming issue succeeded —> success. https://bugs.webkit.org/show_bug.cgi?id=182507 <rdar://problem/37248566> Reviewed by Eric Carlson. No new tests. Build fix. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::enterFullscreenHandler): succeeded —> success 2018-02-05 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r228086. This introduced a failure with API test URLTest.HostIsIPAddress. Reverted changeset: "Add a way to check if a host is an IP address" https://bugs.webkit.org/show_bug.cgi?id=182427 https://trac.webkit.org/changeset/228086 2018-02-05 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r228103. This caused multiple tests to crash. Reverted changeset: "Use downcast in createLinkPreloadResourceClient" https://bugs.webkit.org/show_bug.cgi?id=182488 https://trac.webkit.org/changeset/228103 2018-02-05 Eric Carlson <eric.carlson@apple.com> [iOS] VideoFullscreenInterfaceAVKit should not ignore errors https://bugs.webkit.org/show_bug.cgi?id=182497 <rdar://problem/36986898> Reviewed by Jer Noble. Always call layoutIfNeeded before calling -[AVPlayerViewController enterFullScreenAnimated:completionHandler] or -[AVPlayerViewController exitFullScreenAnimated:completionHandler] because they both fail if the view needs layout. Also don't ignore errors returned by those calls. No new tests, the failure is non deterministic and I was not able to reproduce in a test. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive): (VideoFullscreenInterfaceAVKit::enterFullscreenStandard): (VideoFullscreenInterfaceAVKit::exitFullscreen): (VideoFullscreenInterfaceAVKit::cleanupFullscreen): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler): (VideoFullscreenInterfaceAVKit::doEnterFullscreen): (VideoFullscreenInterfaceAVKit::exitFullscreenHandler): (VideoFullscreenInterfaceAVKit::enterFullscreenHandler): 2018-02-05 Daniel Bates <dabates@apple.com> REGRESSION (r222795): Nike app "Refused to set unsafe header" when adding and viewing cart https://bugs.webkit.org/show_bug.cgi?id=182491 <rdar://problem/36533447> Reviewed by Brent Fulgham. Exempt Nike from the XHR header restrictions in r222795. Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers. However Nike also depends on such functionality. * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isNike): 2018-02-02 Brent Fulgham <bfulgham@apple.com> Improve NetworkResourceLoader logging so it can be used for 'setCookiesFromDOM' https://bugs.webkit.org/show_bug.cgi?id=182455 <rdar://problem/36626601> Reviewed by Chris Dumez. After this refactoring, a convenience method I added in r227860 is no longer needed. This patch removes this dead code. * platform/network/NetworkStorageSession.h: Export 'cookieStoragePartition' so it can be used in WebKit. * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::hasStorageAccessForFrame): Deleted unused method. 2018-02-05 Antti Koivisto <antti@apple.com> Make ASSERT_WITH_SECURITY_IMPLICATION in CachedResourceClientWalker::next a release assert https://bugs.webkit.org/show_bug.cgi?id=182492 Reviewed by Youenn Fablet. * loader/cache/CachedResourceClientWalker.h: (WebCore::CachedResourceClientWalker::next): 2018-02-05 John Wilander <wilander@apple.com> Storage Access API: Add testRunner.getAllStorageAccessEntries() to make testing easier and more explicit https://bugs.webkit.org/show_bug.cgi?id=181601 <rdar://problem/36475837> Reviewed by Alex Christensen. No new tests. Existing test updated. http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html was found to be flaky. With the testRunner.hasStorageAccessEntry() getter it's possible to check access even if a frame doesn't respond timely to postMessage after detach and attach. * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::getAllStorageAccessEntries const): 2018-02-05 Youenn Fablet <youenn@apple.com> Use downcast in createLinkPreloadResourceClient https://bugs.webkit.org/show_bug.cgi?id=182488 Reviewed by Antti Koivisto. No observable change of behavior. * loader/LinkLoader.cpp: (WebCore::createLinkPreloadResourceClient): 2018-02-05 Chris Dumez <cdumez@apple.com> Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https.html is flaky https://bugs.webkit.org/show_bug.cgi?id=181166 <rdar://problem/37169508> Reviewed by Youenn Fablet. I found out that this test was flakily timing out because our jobQueues would sometimes get stuck when their current job's connection or service worker (when scheduled by a service worker) would go away before the job is complete. This patch makes our job queues operation more robust by: 1. Cancelling all jobs from a given connection when a SWServerConnection goes away 2. Cancelling all jobs from a given service worker when a service worker gets terminated We also make sure service workers created by a job get properly terminated when a job is canceled to avoid leaving service workers in limbo. No new tests, unskipped existing flaky test. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::removeRegistration): (WebCore::ServiceWorkerContainer::updateRegistration): * workers/service/ServiceWorkerJobData.cpp: (WebCore::ServiceWorkerJobData::ServiceWorkerJobData): (WebCore::ServiceWorkerJobData::isolatedCopy const): * workers/service/ServiceWorkerJobData.h: (WebCore::ServiceWorkerJobData::encode const): (WebCore::ServiceWorkerJobData::decode): * workers/service/server/SWServer.cpp: (WebCore::SWServer::startScriptFetch): (WebCore::SWServer::scriptContextFailedToStart): (WebCore::SWServer::scriptContextStarted): (WebCore::SWServer::terminatePreinstallationWorker): (WebCore::SWServer::installContextData): (WebCore::SWServer::workerContextTerminated): (WebCore::SWServer::unregisterConnection): * workers/service/server/SWServer.h: * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::removeAllJobsMatching): (WebCore::SWServerJobQueue::cancelJobsFromConnection): (WebCore::SWServerJobQueue::cancelJobsFromServiceWorker): * workers/service/server/SWServerJobQueue.h: * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::setPreInstallationWorker): 2018-02-05 Antti Koivisto <antti@apple.com> Crash on sfgate.com because mismatching link preload types https://bugs.webkit.org/show_bug.cgi?id=182483 <rdar://problem/37065331> Reviewed by Daniel Bates. Preloading the same URL with different 'as' types causes some confusion. Test: http/tests/preload/link-preload-type-mismatch.html * loader/LinkLoader.cpp: (WebCore::createLinkPreloadResourceClient): Ensure we use the actual resource type when creating the client. (WebCore::LinkLoader::preloadIfNeeded): Don't construct client if the types don't match. This can happen if there is an existing preload for the same resource with different type. 2018-02-05 Manuel Rego Casasnovas <rego@igalia.com> [css-grid] Rename gutter properties to remove "grid-" prefix https://bugs.webkit.org/show_bug.cgi?id=180290 Reviewed by Javier Fernandez. This patch applies the resoultion of the CSS WG to unprefix the CSS Grid Layout gutter properties: https://github.com/w3c/csswg-drafts/issues/1696 column-gap already existed before, as it's part of Multicol. The patch adds the new properties row-gap and gap, and keep the legacy ones as aliases: - grid-column-gap => column-gap - grid-row-gap => row-gap - grid-gap => gap As column-gap was already animatable, this change takes advantage to make animatable row-gap too. Tests: imported/w3c/web-platform-tests/css/css-align/gaps/ * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSProperties.json: * css/StyleProperties.cpp: * css/parser/CSSParserFastPaths.cpp: (WebCore::isSimpleLengthPropertyID): * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseShorthand): * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::availableSpaceForGutters const): (WebCore::RenderGrid::gridGap const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::gridAutoRows const): (WebCore::RenderStyle::columnGap const): (WebCore::RenderStyle::rowGap const): (WebCore::RenderStyle::setGridItemRowEnd): (WebCore::RenderStyle::setColumnGap): (WebCore::RenderStyle::setRowGap): (WebCore::RenderStyle::initialRowGap): * rendering/style/StyleGridData.cpp: (WebCore::StyleGridData::StyleGridData): * rendering/style/StyleGridData.h: (WebCore::StyleGridData::operator== const): * rendering/style/StyleMultiColData.cpp: (WebCore::StyleMultiColData::StyleMultiColData): (WebCore::StyleMultiColData::operator== const): * rendering/style/StyleMultiColData.h: * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: 2018-02-05 Ms2ger <Ms2ger@igalia.com> Implement createImageBitmap(HTMLVideoElement) https://bugs.webkit.org/show_bug.cgi?id=182388 Reviewed by Žan Doberšek. The implementation is inspired by CanvasRenderingContext2DBase::drawImage(). Tests: - web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html - web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html * html/ImageBitmap.cpp: (WebCore::taintsOrigin): Add function to help with the implementation. (WebCore::ImageBitmap::createPromise): Fill in implementation. 2018-02-05 Zan Dobersek <zdobersek@igalia.com> Unreviewed, rolling out r228085. Pixel data stride is imposed by OpenGL and shouldn't be adjusted for Cairo Reverted changeset: "[Cairo] Correctly calculate stride in GraphicsContext3D::paintToCanvas()" https://bugs.webkit.org/show_bug.cgi?id=182466 https://trac.webkit.org/changeset/228085 2018-02-05 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] WebSockets must use system proxy settings https://bugs.webkit.org/show_bug.cgi?id=126384 Reviewed by Michael Catanzaro. Use soup_session_connect_async() when available to create the WebSockets connection instead of GSocketClient directly. * platform/network/soup/SocketStreamHandleImpl.h: * platform/network/soup/SocketStreamHandleImplSoup.cpp: (WebCore::wssSocketClientEventCallback): (WebCore::SocketStreamHandleImpl::create): (WebCore::SocketStreamHandleImpl::connected): (WebCore::SocketStreamHandleImpl::connectedCallback): (WebCore::SocketStreamHandleImpl::platformClose): 2018-02-05 Carlos Garcia Campos <cgarcia@igalia.com> Add a way to check if a host is an IP address https://bugs.webkit.org/show_bug.cgi?id=182427 Reviewed by Alex Christensen. There are several places where this is needed. We currently just assume that any host ending in a digit is an IP address, except in PublicSuffix where platform specific code is used. This patch adds URL::hostIsIPAddress() platform specific implementations, falling back to current assumption if there isn't an implementation for the platform. * page/OriginAccessEntry.cpp: (WebCore::OriginAccessEntry::OriginAccessEntry): Use URL::hostIsIPAddress(). * platform/URL.cpp: (WebCore::URL::hostIsIPAddress): Fallback implementation. * platform/URL.h: * platform/mac/PublicSuffixMac.mm: (WebCore::topPrivatelyControlledDomain): Use URL::hostIsIPAddress(). * platform/mac/URLMac.mm: (WebCore::URL::hostIsIPAddress): Move implementation from PublicSuffixMac.mm. * platform/network/curl/CookieUtil.cpp: (WebCore::CookieUtil::isIPAddress): Use URL::hostIsIPAddress(). * platform/soup/URLSoup.cpp: (WebCore::URL::hostIsIPAddress): Use g_hostname_is_ip_address(). 2018-02-04 Zan Dobersek <zdobersek@igalia.com> [Cairo] Correctly calculate stride in GraphicsContext3D::paintToCanvas() https://bugs.webkit.org/show_bug.cgi?id=182466 Reviewed by Michael Catanzaro. * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::paintToCanvas): Use cairo_format_stride_for_width() to obtain stride that Cairo thinks is appropriate for the given width, taking into account internal alignment requirements. 2018-02-04 Zan Dobersek <zdobersek@igalia.com> [Cairo] Split TexMap functionality out of GraphicsContext3DCairo https://bugs.webkit.org/show_bug.cgi?id=182465 Reviewed by Michael Catanzaro. Take the Non-Cairo GraphicsContext3D functionality that's stashed in GraphicsContext3DCairo and move it into the GraphicsContext3DTextureMapper file. In GraphicsContext3DCairo.cpp, only the Cairo-specific GraphicsContext3D functionality remains, specifically ImageExtractor and paintToCanvas(). Everything else is moved into GraphicsContext3DTextureMapper.cpp. This filename and its location under platform/graphics/texmap/ was chosen since all the ports using this file (GTK, WPE, WinCairo) are also using the TextureMapper module. Various #if-guards are simplified in the moved-over code to reflect this. GraphicsContext3DCairo.cpp now better reflects GraphicsContext3DCG.cpp, with both implementing functionality specific to a 2D painting library, whereas GraphicsContext3DTextureMapper.cpp reflects GraphicsContext3DCocoa.cpp in covering functionality needed to integrate the GraphicsContext3D output into the platform-specific composition system. No new tests -- no change in behavior. * platform/TextureMapper.cmake: * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::activeContexts): Deleted. (WebCore::GraphicsContext3D::create): Deleted. (WebCore::GraphicsContext3D::GraphicsContext3D): Deleted. (WebCore::GraphicsContext3D::~GraphicsContext3D): Deleted. (WebCore::GraphicsContext3D::setContextLostCallback): Deleted. (WebCore::GraphicsContext3D::setErrorMessageCallback): Deleted. (WebCore::GraphicsContext3D::makeContextCurrent): Deleted. (WebCore::GraphicsContext3D::checkGPUStatus): Deleted. (WebCore::GraphicsContext3D::platformGraphicsContext3D): Deleted. (WebCore::GraphicsContext3D::platformTexture const): Deleted. (WebCore::GraphicsContext3D::isGLES2Compliant const): Deleted. (WebCore::GraphicsContext3D::platformLayer const): Deleted. (WebCore::GraphicsContext3D::getExtensions): Deleted. * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: Copied from Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp. (WebCore::activeContexts): (WebCore::GraphicsContext3D::create): (WebCore::GraphicsContext3D::GraphicsContext3D): (WebCore::GraphicsContext3D::~GraphicsContext3D): (WebCore::GraphicsContext3D::setContextLostCallback): (WebCore::GraphicsContext3D::setErrorMessageCallback): (WebCore::GraphicsContext3D::makeContextCurrent): (WebCore::GraphicsContext3D::checkGPUStatus): (WebCore::GraphicsContext3D::platformGraphicsContext3D): (WebCore::GraphicsContext3D::platformTexture const): (WebCore::GraphicsContext3D::isGLES2Compliant const): (WebCore::GraphicsContext3D::platformLayer const): (WebCore::GraphicsContext3D::getExtensions): 2018-02-04 Zan Dobersek <zdobersek@igalia.com> Simplify GraphicsContext3D::paintToCanvas() https://bugs.webkit.org/show_bug.cgi?id=182459 Reviewed by Michael Catanzaro. Cairo-specific paintToCanvas() method is dropped in favor of the more common one that operates on a GraphicsContext object. The platform context object is then retrieved inside the Cairo-speficic paintToCanvas() implementation, and not at the call site in GraphicsContext3D::paintRenderingResultsToCanvas(). GraphicsContext3D::paintToCanvas() is also modified so that the image and canvas sizes are passed through IntSize objects, and not through a width-and-height pair of integer values. No new tests -- no change in behavior. * platform/graphics/GraphicsContext3D.h: * platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::paintToCanvas): * platform/graphics/cg/GraphicsContext3DCG.cpp: (WebCore::GraphicsContext3D::paintToCanvas): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): 2018-02-03 Alexey Proskuryakov <ap@apple.com> Tweak availability macros for CAN_DISALLOW_USER_INSTALLED_FONTS Rubber-stamped by Maciej Stachowiak. * platform/graphics/cocoa/FontCacheCoreText.cpp: 2018-02-02 Daniel Bates <dabates@apple.com> Clean up FrameLoader::receivedFirstData() https://bugs.webkit.org/show_bug.cgi?id=182361 Reviewed by Andy Estes. * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): 2018-02-02 Myles C. Maxfield <mmaxfield@apple.com> Test fix after r227995 https://bugs.webkit.org/show_bug.cgi?id=180951 Unreviewed. Webfonts shouldn't be run through CTFontDescriptorCreateMatchingFontDescriptor(). Also, unify macOS's and iOS's implementation of FontCache::lastResortFallbackFont(). Covered by existing tests. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::fontForPostScriptName): (WebCore::addAttributesForInstalledFonts): (WebCore::addAttributesForWebFonts): (WebCore::installedFontMandatoryAttributes): (WebCore::FontCache::lastResortFallbackFont): (WebCore::addAttributesForUserInstalledFonts): Deleted. (WebCore::mandatoryAttributesForUserInstalledFonts): Deleted. * platform/graphics/cocoa/FontCacheCoreText.h: * platform/graphics/ios/FontCacheIOS.mm: (WebCore::FontCache::lastResortFallbackFont): Deleted. * platform/graphics/mac/FontCacheMac.mm: (WebCore::FontCache::lastResortFallbackFont): Deleted. * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): 2018-02-02 Basuke Suzuki <Basuke.Suzuki@sony.com> Fix build error after r 227457 with VIDEO and WEB_AUDIO disabled https://bugs.webkit.org/show_bug.cgi?id=182395 Reviewed by Eric Carlson * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): 2018-02-02 Don Olmstead <don.olmstead@sony.com> Remove WebCore/ForwardingHeaders directory https://bugs.webkit.org/show_bug.cgi?id=182347 Reviewed by Alex Christensen. Baseline tests updated. * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): (GenerateEnumerationImplementationContent): (GenerateDictionaryImplementationContent): (GenerateHeader): (GenerateOverloadDispatcher): (addUnscopableProperties): (GenerateImplementation): (GenerateOperationDefinition): (GenerateSerializerDefinition): (GenerateConstructorHelperMethods): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.h: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestException.h: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.h: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * dom/make_event_factory.pl: (generateImplementation): 2018-02-02 David Quesada <david_quesada@apple.com> WebAppManifest scope should default to the containing directory of start_url if 'scope' is not specified https://bugs.webkit.org/show_bug.cgi?id=182363 rdar://problem/37093498 Reviewed by Ryosuke Niwa. If an app manifest doesn't specify a scope, we should default to the "parent directory" of the start URL, rather than leaving the app unbounded. This is more reasonable than using the entire internet as the app scope. No new tests, updates to the existing tests verify the new behavior. * Modules/applicationmanifest/ApplicationManifestParser.cpp: (WebCore::ApplicationManifestParser::parseScope): 2018-02-02 Youenn Fablet <youenn@apple.com> Clearing all service worker registrations should wait for importing service worker registration to finish https://bugs.webkit.org/show_bug.cgi?id=182407 <rdar://problem/37167523> Reviewed by Chris Dumez. * workers/service/server/SWServer.cpp: (WebCore::SWServer::clear): ensure completion handler is called on early exit case. 2018-02-02 Youenn Fablet <youenn@apple.com> Clearing all service worker registrations should wait for importing service worker registration to finish https://bugs.webkit.org/show_bug.cgi?id=182407 Reviewed by Chris Dumez. Covered by existing tests and the service worker API test being no longer flaky. * workers/service/server/SWServer.cpp: (WebCore::SWServer::registrationStoreImportComplete): (WebCore::SWServer::clearAll): (WebCore::SWServer::clear): (WebCore::SWServer::getOriginsWithRegistrations): * workers/service/server/SWServer.h: 2018-02-02 Chris Dumez <cdumez@apple.com> Clearing a registration should null out its workers before setting their state to "redundant" https://bugs.webkit.org/show_bug.cgi?id=182418 <rdar://problem/37142874> Reviewed by Youenn Fablet. Clearing a registration should null out its workers before setting their state to "redundant". This seems to match Firefox and Chrome. No new tests, rebaselined existing test. * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::clear): (WebCore::clearRegistrationWorker): Deleted. 2018-02-02 Antoine Quint <graouts@apple.com> [Modern Media Controls] Turn media/modern-media-controls/tracks-panel and media/modern-media-controls/tracks-support back on https://bugs.webkit.org/show_bug.cgi?id=182426 Reviewed by Dean Jackson. Ensure that the tracks panel isn't dismissed by updating the layout. * Modules/modern-media-controls/controls/inline-media-controls.js: (InlineMediaControls.prototype.layout): 2018-02-02 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r227964. https://bugs.webkit.org/show_bug.cgi?id=182423 It broke several unit tests (Requested by KaL on #webkit). Reverted changeset: "[SOUP] Ensure domain is valid when converting a WebCore Cookie to Soup" https://bugs.webkit.org/show_bug.cgi?id=182328 https://trac.webkit.org/changeset/227964 2018-02-01 Chris Dumez <cdumez@apple.com> When SW install fails, null out registration.installing before setting worker state to "redundant" https://bugs.webkit.org/show_bug.cgi?id=182416 <rdar://problem/37141997> Reviewed by Youenn Fablet. When SW install fails, null out registration.installing before setting worker state to "redundant". This does not match the spec but this is what Firefox and Chrome do. This is also what the web-platform-tests expect. Test: http/tests/workers/service/install-fails.html * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::didFinishInstall): 2018-02-01 Myles C. Maxfield <mmaxfield@apple.com> Test fix after r227848. https://bugs.webkit.org/show_bug.cgi?id=180951 Unreviewed. Using kCTFontNameAttribute on an in-memory font causes CTFontDescriptorCreateMatchingFontDescriptor() to return nullptr. Luckily, we weren't using that attribute anyway. Covered by existing tests. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::mandatoryAttributesForUserInstalledFonts): 2018-02-01 Youenn Fablet <youenn@apple.com> Delay service worker process creation until actually needed by SWServer https://bugs.webkit.org/show_bug.cgi?id=182301 Reviewed by Chris Dumez. Rename SWServer::Connection::scheduleJobInServer to scheduleJob. Add sessionID getter from an SWServer. * workers/service/server/SWServer.h: (WebCore::SWServer::sessionID const): 2018-02-01 Fujii Hironori <Hironori.Fujii@sony.com> REGRESSION(r227594) [WinCairo] NULL pointer crash in GraphicsContext::getWindowsContext https://bugs.webkit.org/show_bug.cgi?id=182282 Reviewed by Žan Doberšek. ImageBufferCairo has been changed to use GraphicsContextImplCairo in r227594. But, GraphicsContext::getWindowsContext doesn't care the case of using GraphicsContextImpl and crashes due to null dereference of GraphicsContext::m_data. GraphicsContext::getWindowsContext should create a HDC in that case. Remove the argument mayCreateBitmap because it is always true at the moment. No new tests (Covered by the existing tests) * platform/graphics/GraphicsContext.h: Removed a argument mayCreateBitmap of getWindowsContext and releaseWindowsContext. * platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::releaseWindowsContext): Ditto. * platform/graphics/win/GraphicsContextCairoWin.cpp: (WebCore::GraphicsContext::releaseWindowsContext): Ditto. * platform/graphics/win/GraphicsContextDirect2D.cpp: (WebCore::GraphicsContext::releaseWindowsContext): Ditto. * platform/graphics/win/GraphicsContextWin.cpp: (WebCore::GraphicsContext::getWindowsContext): Create a HDC if m_impl is null. Removed a argument mayCreateBitmap. * platform/graphics/win/LocalWindowsContext.h: (WebCore::LocalWindowsContext::LocalWindowsContext): Removed m_mayCreateBitmap. (WebCore::LocalWindowsContext::~LocalWindowsContext): Ditto. 2018-02-01 Christopher Reid <chris.reid@sony.com> [Curl] Use SQLite database in cookie jar implementation for Curl port https://bugs.webkit.org/show_bug.cgi?id=174942 Reviewed by Alex Christensen. No new tests, Set-Cookie is already tested in Layout tests. Adding an initial SQLite CookieJar implementation to the curl network layer. WebCore will now parse and handle both HTTP and DOM cookies instead of using libcurl. This currently supports cookie storage and retrieval. Cookie deletion is not yet implemented. * platform/Curl.cmake: * platform/network/NetworkStorageSession.h: Added cookieDB storage in curl. * platform/network/curl/CookieJarCurl.cpp: Removed the old curl cookie handling. * platform/network/curl/CookieJarCurl.h: * platform/network/curl/CookieJarCurlDatabase.cpp: Added. * platform/network/curl/CookieJarCurlDatabase.h: Added. * platform/network/curl/CookieJarDB.cpp: Added. * platform/network/curl/CookieJarDB.h: Added. * platform/network/curl/CookieUtil.cpp: Added. * platform/network/curl/CookieUtil.h: Added. * platform/network/curl/CurlContext.cpp: Removed the old curl cookie handling. * platform/network/curl/CurlContext.h: * platform/network/curl/CurlRequest.cpp: Added handlers for HTTP response cookies. * platform/network/curl/NetworkStorageSessionCurl.cpp: * platform/network/curl/ResourceHandleCurlDelegate.cpp: 2018-02-01 Chris Dumez <cdumez@apple.com> Add missing RETURN_IF_EXCEPTION() after object->get() calls in convertDictionary<>() https://bugs.webkit.org/show_bug.cgi?id=182392 <rdar://problem/37119215> Reviewed by Geoffrey Garen. Add missing RETURN_IF_EXCEPTION() after object->get() calls in convertDictionary<>(), given that getting the property from the object can throw an exception. No new tests, rebaselined existing test. * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: (WebCore::convertDictionary<TestCallbackInterface::Dictionary>): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::convertDictionary<TestEventConstructor::Init>): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>): (WebCore::convertDictionary<AlternateDictionaryName>): (WebCore::convertDictionary<TestObj::ParentDictionary>): (WebCore::convertDictionary<TestObj::ChildDictionary>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryA>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryB>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryC>): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::convertDictionary<TestPromiseRejectionEvent::Init>): * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertDictionary<DictionaryImplName>): 2018-02-01 Ryosuke Niwa <rniwa@webkit.org> Some test cases in accessibility/mac/selection-notification-focus-change.html fail https://bugs.webkit.org/show_bug.cgi?id=182212 <rdar://problem/36937147> Reviewed by Antti Koivisto and Wenson Hsieh. The failure was caused by the async update of the selection appearance not preserving selection reveal intent. Fixed the bug by storing the intent in a member variable and using it later. * dom/Element.cpp: (WebCore::Element::focus): Removed an unnecessary synchronous layout update. * editing/FrameSelection.cpp: (WebCore::FrameSelection::setNeedsSelectionUpdate): Use the default intent to preserve the old behavior. (WebCore::FrameSelection::respondToNodeModification): Ditto. (WebCore::FrameSelection::setSelection): Save the selection reveal intent. (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange): Use the saved intent. * editing/FrameSelection.h: * page/FocusController.cpp: (WebCore::FocusController::advanceFocusDirectionally): Always update the layout before invoking nodeRectInAbsoluteCoordinates. 2018-02-01 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby https://bugs.webkit.org/show_bug.cgi?id=182306 <rdar://problem/37041440> Reviewed by Darin Adler. Addressing post-review comment. * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::insertChild): (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe): * rendering/updating/RenderTreeBuilderRuby.h: 2018-02-01 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Introduce RenderTreeBuilder to takeChild() https://bugs.webkit.org/show_bug.cgi?id=182373 <rdar://problem/37101484> Reviewed by Antti Koivisto. This is in preparation for moving mutation code out of takeChild. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::takeChild): * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::takeChild): * rendering/RenderBlockFlow.h: * rendering/RenderButton.cpp: (WebCore::RenderButton::takeChild): * rendering/RenderButton.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::takeChild): (WebCore::RenderElement::removeAndDestroyChild): (WebCore::RenderElement::destroyLeftoverChildren): * rendering/RenderElement.h: * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::wrapExistingRenderer): (WebCore::RenderFullScreen::unwrapRenderer): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::takeChild): * rendering/RenderGrid.h: * rendering/RenderMenuList.cpp: (RenderMenuList::takeChild): * rendering/RenderMenuList.h: * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): * rendering/RenderObject.cpp: (WebCore::RenderObject::removeFromParentAndDestroy): * rendering/RenderRuby.cpp: (WebCore::RenderRubyAsInline::takeChild): (WebCore::RenderRubyAsBlock::takeChild): * rendering/RenderRuby.h: * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::takeChild): * rendering/RenderRubyRun.h: * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): Deleted. * rendering/RenderTableRow.h: * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::takeChild): * rendering/svg/RenderSVGContainer.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::takeChild): * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::takeChild): * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::takeChild): * rendering/svg/RenderSVGText.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::collapseAndDestroyAnonymousSiblingRows): (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::updateStyle): (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): * rendering/updating/RenderTreeBuilderList.cpp: (WebCore::RenderTreeBuilder::List::updateItemMarker): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::insertChild): 2018-02-01 Dean Jackson <dino@apple.com> REGRESSION (r219342): Scaled HTML widget is not responding to a clicks outside the body https://bugs.webkit.org/show_bug.cgi?id=182394 <rdar://problem/34840816> Reviewed by Simon Fraser. If a scale < 1 is applied to the page, then the visual viewport will be bigger than the layout viewport. Our hit testing code would then ignore any hits that were outside the layout viewport. The fix is to only apply a hit testing clip if the page is scaling up, not down. Update the existing fast/dom/elementFromPoint-scaled-scrolled.html test. * page/FrameView.cpp: (WebCore::FrameView::layoutViewportToAbsoluteRect const): Deleted. This helper is no longer used, and it would have probably been more confusing to have it accept a flag to ignore the scale if it is less than 1. * page/FrameView.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::hitTest): No need to take the layout rect, remove the origin, and pass it to a helper that added the origin back. The only thing the helper was doing for us was applying a scale factor, which we only want to do if it was scaling up. 2018-02-01 Yusuke Suzuki <utatane.tea@gmail.com> Structured cloning a Symbol should throw https://bugs.webkit.org/show_bug.cgi?id=182380 Reviewed by Darin Adler. Test: js/dom/post-message-symbol.html * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal): Structured cloning should throw "DataCloneError" DOMException if it finds Symbol. Remove unused `isNumber()` case. It is done in dumpImmediate. (WebCore::CloneSerializer::serializeUndefined): Deleted. (WebCore::CloneSerializer::serializeBoolean): Deleted. (WebCore::CloneSerializer::serializeNumber): Deleted. Remove unused functions. 2018-02-01 Chris Dumez <cdumez@apple.com> We no longer need to queue service worker jobs until the connection to the service worker process has been established https://bugs.webkit.org/show_bug.cgi?id=182375 Reviewed by Youenn Fablet. We no longer need to queue service worker jobs until the connection to the service worker process has been established. We initially did this to work around the fact that registrations restored from disk would not have an active worker until the service worker process had been established. However, this issue has been fixed in r227696. This is basically a revert of r227220, which is no longer needed after r227696. No new tests, initial fix was covered by an API test that still passes. * workers/service/server/SWServer.cpp: (WebCore::SWServer::clearAll): (WebCore::SWServer::clear): (WebCore::SWServer::scheduleJob): (WebCore::SWServer::serverToContextConnectionCreated): * workers/service/server/SWServer.h: 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Shift + mouse scroll should scroll horizontally https://bugs.webkit.org/show_bug.cgi?id=181629 Reviewed by Michael Catanzaro. We currently turn vertical scroll into horizontal when scrolling over the horizontal scrollbar. When Shift key is pressed, we still want to scroll in the scrollbar direction when scrolling over a scrollbar, so we need to swap directions in both scrollbars depending on whther the Shift key is pressed or not. * page/EventHandler.cpp: (WebCore::EventHandler::shouldSwapScrollDirection const): Renamed. (WebCore::EventHandler::handleWheelEvent): Use the new name. (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const): Deleted. * page/EventHandler.h: * platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::copySwappingDirection const): Swap the direction of the event. (WebCore::PlatformWheelEvent::copyTurningVerticalTicksIntoHorizontalTicks const): Deleted. * platform/glib/EventHandlerGLib.cpp: (WebCore::EventHandler::shouldSwapScrollDirection const): Take into account whether the Shift key is present. (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const): Deleted. 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Problem with Washington Post images https://bugs.webkit.org/show_bug.cgi?id=181421 Reviewed by Carlos Alberto Lopez Perez. This is because Washington Post is using the user agent to decide the image formats it serves. In the case of chromium the images are served as webp, for firefox jpeg is used and in our case it's assuming we are safari and it's providing jp2 images that we don't support. Add a user agent quirk to pretend to be chromium for washingtonpost.com. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresChromeBrowser): 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Ensure domain is valid when converting a WebCore Cookie to Soup https://bugs.webkit.org/show_bug.cgi?id=182328 Reviewed by Michael Catanzaro. soup_cookie_parse() adds the initial '.' to the domain if missing before creating the SoupCookie, but soup_cookie_new() allows for domain to be a hostname that needs to match exactly. When converting a WebCore Cookie into a SoupCookie we always want the domain to be considered as such and not as a hostname, so we need to prepend the '.' if missing. Fixes: imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_domain_cookie * platform/network/soup/CookieSoup.cpp: (WebCore::Cookie::toSoupCookie const): 2018-02-01 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderTableRow::collapseAndDestroyAnonymousSiblingRows to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182374 <rdar://problem/37102005> Reviewed by Antti Koivisto. It's only called from RenderTreeBuilder. No change in functionality. * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): Deleted. * rendering/RenderTableRow.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows): * rendering/updating/RenderTreeBuilderTable.h: 2018-02-01 Chris Dumez <cdumez@apple.com> Queue a microtask when a waitUntil() promise is settled https://bugs.webkit.org/show_bug.cgi?id=182372 <rdar://problem/37101019> Reviewed by Mark Lam. Queue a microtask when a waitUntil() promise is settled, as per: - https://w3c.github.io/ServiceWorker/#dom-extendableevent-waituntil (step 5) Otherwise, we decrement m_pendingPromiseCount too quickly and it may cause following calls to waitUntil() to throw when they shouldn't. No new tests, rebaselined existing test. * workers/service/ExtendableEvent.cpp: (WebCore::ExtendableEvent::addExtendLifetimePromise): 2018-02-01 Antti Koivisto <antti@apple.com> Invalidate style for sibling combinators accurately on class change https://bugs.webkit.org/show_bug.cgi?id=182336 Reviewed by Zalan Bujtas. Use Style::Invalidator to invalidate only those elements that may be affected by a class change for sibling combinators and nth pseudo classes. * css/RuleFeature.cpp: Add new AllSiblings MatchElement to use for nth pseudo classes with subselectors. (WebCore::isSiblingOrSubject): Add a helper. (WebCore::RuleFeatureSet::computeNextMatchElement): (WebCore::RuleFeatureSet::computeSubSelectorMatchElement): Compute and propage MatchElement::AllSiblings. * css/RuleFeature.h: * dom/Node.cpp: (WebCore::Node::updateAncestorsForStyleRecalc): Don't need to test for childrenAffectedByPropertyBasedBackwardPositionalRules anymore (an oddly named bit for nth pseudo classes). * style/StyleInvalidator.cpp: (WebCore::Style::Invalidator::invalidateStyleWithMatchElement): Invalidate only the potentially affected elements. The old code would just unconditionally invalidate the current element. This would propagate to descedants of siblings via affectedByPreviousSibling bits. That mechanism can be removed when everything has been switched to accurate invalidation. 2018-01-31 Simon Fraser <simon.fraser@apple.com> Use different debug red colors for different contexts https://bugs.webkit.org/show_bug.cgi?id=182362 Reviewed by Tim Horton. Pure red is used elsehwere in the system as a debug color indicator, so use different shades of red for WebKit in the two places where we paint a reddish wash in debug builds, so they are identifiable. * page/FrameView.cpp: (WebCore::FrameView::paintContents): 2018-01-31 Don Olmstead <don.olmstead@sony.com> [CMake] Make JavaScriptCore headers copies https://bugs.webkit.org/show_bug.cgi?id=182303 Reviewed by Alex Christensen. No new tests. No change in behavior. * CMakeLists.txt: * PlatformMac.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: * PlatformWinCairo.cmake: 2018-01-31 Per Arne Vollan <pvollan@apple.com> Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing https://bugs.webkit.org/show_bug.cgi?id=181204 <rdar://problem/36256274> Reviewed by Ryosuke Niwa. When a frame element is moved in the DOM tree during the execution of a beforeunload handler, the frame will be detached when removed from its previous position in the DOM tree. When being detached, an attempt will also be made to stop the load by calling FrameLoader::stopAllLoaders(). However, this method will return early when executed in a beforeunload handler, since navigation is not allowed then. The end result is a detached frame which will continue to load, and hitting asserts in DocumentLoader::dataReceived(), and DocumentLoader::notifyFinished(). It should be possible to stop a frame load, even when executing a beforeunload handler. No new tests. Covered by the existing test fast/events/beforeunload-dom-manipulation-crash.html. * history/PageCache.cpp: (WebCore::PageCache::addIfCacheable): Fix a failing API test by allowing scripts to be executed under the PageCache::prune method. * loader/FrameLoader.cpp: (WebCore::FrameLoader::isStopLoadingAllowed const): (WebCore::FrameLoader::stopAllLoaders): * loader/FrameLoader.h: * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::~SVGImage): Disable scripts disallowed assertions in this scope, since it is safe in this context. 2018-01-31 Javier Fernandez <jfernandez@igalia.com> inline-block baseline not computed correctly for vertical-lr https://bugs.webkit.org/show_bug.cgi?id=170176 Reviewed by Manuel Rego Casasnovas. When computing the baseline position of inline-block elements we use the InlineFlow logicalTop and the FontMetrics ascent. The issue comes from the fact that these units are incompatible. The logicalTop of a vertical-lr element is offset to the left edge, while the ascent is the distance from the right edge. We need to either use logical value for the FontMetrics ascent so we can compute the correctly the baselines of vertical-lr elements, or just using the logicalBottom for these cases. The approach based on a logicalAscent API for FontMetrics would require a lot of work because inline-block logic assumes everything is vertical-rl and at some point, flips the elements along the block-axis in case of vertical-lr mode. While it'd be desirable to get rid of this flipping logic, this patch tries first the simpler approach of using logicalBottom, which aligns with the currently implemented logic. Tests: fast/inline-block/baseline-vertical-01.html fast/inline-block/baseline-vertical-02.html fast/inline-block/baseline-vertical-03.html fast/inline-block/baseline-vertical-04.html fast/inline-block/baseline-vertical-05.html fast/inline-block/baseline-vertical-06.html fast/inline-block/baseline-vertical-07.html fast/inline-block/baseline-vertical-08.html * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxesInBlockDirection): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::inlineBlockBaseline const): 2018-01-31 Said Abou-Hallawa <sabouhallawa@apple.com> BitmapImage::drawPattern() may not draw a complete frame even after all the data is received https://bugs.webkit.org/show_bug.cgi?id=182277 Reviewed by Simon Fraser. BitmapImage::drawPattern() needs to destroy the incomplete decoded frame before trying to draw it as a pattern. Test: http/tests/images/draw-pattern-slow-load-large-image.html * loader/cache/CachedImage.cpp: (WebCore::CachedImage::updateBufferInternal): We need to disable CachedImage data buffering for testing. This simulates slow network where intervals between data chunks can last for seconds. * loader/cache/CachedImage.h: * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::drawPattern): Destroy the incomplete decoded frame before drawing this frame as a pattern. We do not destroy incomplete decoded frame once new data is received because it may be drawn by async image drawing while waiting for the newer frame to finish decoding. * testing/Internals.cpp: (WebCore::Internals::setForceUpdateImageDataEnabledForTesting): * testing/Internals.h: * testing/Internals.idl: 2018-01-31 Ryosuke Niwa <rniwa@webkit.org> Add a release assertion to ensure timers are deleted in the right thread https://bugs.webkit.org/show_bug.cgi?id=182351 Reviewed by David Kilzer. Added a relese assertion in ~TimerBase that the current thread is the one in which the timer was created. We use canAccessThreadLocalDataForThread for this purpose since the condition is more complicated when WebThread is being used. * platform/Timer.cpp: (WebCore::TimerBase::~TimerBase): Added the assertion. * platform/Timer.h: (WebCore::TimerBase::m_thread): Always store the current thread in a timer. 2018-01-31 Youenn Fablet <youenn@apple.com> Change SWServer::claim to set the iterator value as soon as possible https://bugs.webkit.org/show_bug.cgi?id=182337 Reviewed by Chris Dumez. No change of behavior, this is a "let's go safe way" fix. * workers/service/server/SWServer.cpp: (WebCore::SWServer::claim): 2018-01-31 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers to RenderTreeBuilder. https://bugs.webkit.org/show_bug.cgi?id=182348 <rdar://problem/37082837> Reviewed by Antti Koivisto. All the callsites are in the RenderTreeUpdater by now. No change in functionality. * rendering/RenderObject.cpp: (WebCore::isAnonymousAndSafeToDelete): Deleted. (WebCore::findDestroyRootIncludingAnonymous): Deleted. (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Deleted. * rendering/RenderObject.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::isAnonymousAndSafeToDelete): (WebCore::findDestroyRootIncludingAnonymous): (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): (WebCore::RenderTreeUpdater::tearDownTextRenderer): 2018-01-31 Ryosuke Niwa <rniwa@webkit.org> Release assertion in Performance::resourceTimingBufferFullTimerFired when the resource timing buffer is shrunk https://bugs.webkit.org/show_bug.cgi?id=182319 <rdar://problem/36904312> Reviewed by Chris Dumez. The crash was caused by a wrong release assertion. Handle author scripts shrinking the resource timing buffer while resourcetimingbufferfull event is being dispatched. Also fixed a bug that a superflous resourcetimingbufferfull event will be fired when new resource timing entries are queued while resourcetimingbufferfull event is being dispatched. Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-queue-resource-entry.html http/tests/performance/performance-resource-timing-resourcetimingbufferfull-shrinking-buffer-crash.html * page/Performance.cpp: (WebCore::Performance::resourceTimingBufferFullTimerFired): 2018-01-31 Youenn Fablet <youenn@apple.com> com.apple.WebKit.Storage crashing at com.apple.WebCore: WebCore::SWServerRegistration::removeClientUsingRegistration https://bugs.webkit.org/show_bug.cgi?id=182316 <rdar://problem/37025976> Reviewed by Chris Dumez. SWServer.m_clientToControllingWorker and SWServerRegistration.m_clientsUsingRegistration might currently get out of sync. This is a defensive fix to ensure storage process will not crash in Release. We keep the ASSERT as this probably means there is an abnormal situation that other patches might fix. * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::removeClientUsingRegistration): 2018-01-31 Antoine Quint <graouts@apple.com> [Modern Media Controls] Turn media/modern-media-controls/start-support tests back on https://bugs.webkit.org/show_bug.cgi?id=182297 Reviewed by Jon Lee and Eric Carlson. We identified one cause of flakiness when turning those tests back on and fix it in this patch. There would be cases where the play/pause button would never actually become visible because we would first set it as one of the buttons in the left container in the bottom controls bar before we would identify that we should show the prominent play/pause button, and then once we did, we would add it as a child to the InlineMediaControls. But, because the actual layout of the ButtonsContainer would happen in a rAF due to being a layout() method, we would remove the play/pause button from the InlineMediaControls and set it as a child of the left container even though it wasn't visible. Performing the layout of a ButtonsContainer should really happen immediately when we set the buttons, so in this patch we remove the "buttons" property and clients of ButtonsContainer can simply add or remove children which will be laid out in a row. To support this, we've added two notification methods to LayoutNode, one that indicates when children have changed, didChangeChildren(), which we override in ButtonsContainer to perform a synchronous layout. The other method is willRemoveChild() which we also override in ButtonsContainer, this time to reset the "x" and "visible" properties which we set while performing layout. This fixes flakiness for media/modern-media-controls/start-support/start-support-click-to-start.html, and maybe other modern-media-controls tests that could have been affected by this unexpected behavior. * Modules/modern-media-controls/controls/buttons-container.js: (ButtonsContainer.prototype.willRemoveChild): (ButtonsContainer.prototype.didChangeChildren): (ButtonsContainer.prototype.layout): (ButtonsContainer.prototype.get buttons): Deleted. (ButtonsContainer.prototype.set buttons): Deleted. * Modules/modern-media-controls/controls/inline-media-controls.js: (InlineMediaControls.prototype.layout): (InlineMediaControls.prototype._updateBottomControlsBarLabel): (InlineMediaControls.prototype._addTopRightBarWithMuteButtonToChildren): (InlineMediaControls): * Modules/modern-media-controls/controls/layout-node.js: (LayoutNode.prototype.set children): (LayoutNode.prototype.addChild): (LayoutNode.prototype.removeChild): (LayoutNode.prototype.willRemoveChild): (LayoutNode.prototype.didChangeChildren): * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: (MacOSFullscreenMediaControls.prototype.layout): * Modules/modern-media-controls/media/media-controller.js: Drive-by fix to correctly set the value passed as data-auto-hide-delay on a <video> element. 2018-01-31 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderMultiColumnFlow::resolveMovedChild to RenderTreeBuilder. https://bugs.webkit.org/show_bug.cgi?id=182315 <rdar://problem/37048160> Reviewed by Antti Koivisto. resolveMovedChild() is only called from RenderTreeBuilder. No change in functionality. * rendering/RenderFragmentedFlow.h: * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::resolveMovedChild const): Deleted. * rendering/RenderMultiColumnFlow.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::resolveMovedChildForMultiColumnFlow): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlockFlow.cpp: (WebCore::RenderTreeBuilder::BlockFlow::insertChild): * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::insertChild): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::resolveMovedChild): * rendering/updating/RenderTreeBuilderMultiColumn.h: 2018-01-31 Philippe Normand <pnormand@igalia.com> [GStreamer] Silent WebAudio buffers support https://bugs.webkit.org/show_bug.cgi?id=143869 Reviewed by Carlos Garcia Campos. * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: (webKitWebAudioSrcLoop): Flag silent buffers as GAP buffers. This enables downstream elements to optimize the buffer processing. 2018-01-31 Xabier Rodriguez Calvar <calvaris@igalia.com> [EME] Fix NavigatorEME::tryNextSupportedConfiguration typo https://bugs.webkit.org/show_bug.cgi?id=182324 Reviewed by Žan Doberšek. * Modules/encryptedmedia/NavigatorEME.cpp: (WebCore::tryNextSupportedConfiguration): Fix candidateCofiguration typo. 2018-01-30 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] syntheticBoldOffset makes a font with embedded bitmap fonts shown as double strike in HiDPI https://bugs.webkit.org/show_bug.cgi?id=182093 Reviewed by Alex Christensen. WebKit draws texts doubly by shifting 1px for fonts without bold fonts but bold font is desired. This synthetic bold method draws fonts with embedded bitmap fonts look like double strike in HiDPI. No new tests (Covered by the existing tests). * platform/graphics/win/FontCacheWin.cpp: (WebCore::createGDIFont): Overwrite lfWeight if the desired weight is bold and matched font weight is't bold and in WinCairo port. Fix wrong indentation. 2018-01-30 Youenn Fablet <youenn@apple.com> and Oleksandr Skachkov <gskachkov@gmail.com> FetchResponse should support ConsumeData callback on chunk data is received https://bugs.webkit.org/show_bug.cgi?id=181600 <rdar://problem/36932547> Reviewed by Alex Christensen. Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html Apply same read-by-chunk strategy for body coming from network as for body coming from ReadableStream. Refactor to have one consumeBodyReceivedByChunk method for both cases. This allows streaming data from a service worker to WebProcess as would be done by NetworkProcess. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::addAll): (WebCore::DOMCache::put): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::BodyLoader::didSucceed): (WebCore::FetchResponse::BodyLoader::didReceiveData): (WebCore::FetchResponse::BodyLoader::consumeDataByChunk): (WebCore::FetchResponse::consumeBody): (WebCore::FetchResponse::consumeBodyReceivedByChunk): * Modules/fetch/FetchResponse.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): 2018-01-30 Don Olmstead <don.olmstead@sony.com> JSExports.h should be included as <JavaScriptCore/JSExportMacros.h> https://bugs.webkit.org/show_bug.cgi?id=182312 Reviewed by Michael Catanzaro. No new tests. No change in behavior. * config.h: 2018-01-30 Chris Nardi <cnardi@chromium.org> Use double-quotes when serializing font-feature-settings https://bugs.webkit.org/show_bug.cgi?id=182201 According to the CSSOM spec, all strings should be serialized with double-quotes. The feature tag value was previously serialized with single-quotes; change this to double-quotes to match the spec and non-WebKit browsers. Reviewed by Myles C. Maxfield. Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html, and fast/text/font-face-javascript.html. * css/CSSFontFeatureValue.cpp: (WebCore::CSSFontFeatureValue::customCSSText const): 2018-01-30 Brent Fulgham <bfulgham@apple.com> Add telemetry to track storage access API adoption https://bugs.webkit.org/show_bug.cgi?id=182197 <rdar://problem/35803309> Reviewed by Chris Dumez. Part 2: Add telemetry for the Storage Access API case Adds a new convenience method to identify origin/page/frame combinations that have been granted access to the Storage Access API. This is used for debug logging in the NetworkProcess. It is not used in production builds. * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Added. 2018-01-30 Ryosuke Niwa <rniwa@webkit.org> Release assert in updateLayout() via AXObjectCache::childrenChanged https://bugs.webkit.org/show_bug.cgi?id=182279 <rdar://problem/36994456> Reviewed by Antti Koivisto. Disable the assertion in Document::updateLayout and Document::updateStyle* in this particular circumstance as fixing it would require a large architectural refactoring of the accessibility code. Test: accessibility/accessibility-object-update-during-style-resolution-crash.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::childrenChanged): Disabled the release assertion here. * dom/Document.cpp: (WebCore::Document::isSafeToUpdateStyleOrLayout const): Check LayoutAssertionDisableScope::shouldDisable. * dom/ScriptDisallowedScope.h: (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope): Added. (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::LayoutAssertionDisableScope): Added. (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::~LayoutAssertionDisableScope): Added. (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::shouldDisable): Added. * page/LayoutContext.cpp: (WebCore::LayoutContext::layout): Check LayoutAssertionDisableScope::shouldDisable. 2018-01-30 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby https://bugs.webkit.org/show_bug.cgi?id=182306 <rdar://problem/37041440> Reviewed by Antti Koivisto. With all the ruby mutation code moving, only RenderTreeBuilder calls RenderRubyRun::rubyBaseSafe. No change in functionality. * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::rubyText const): (WebCore::RenderRubyRun::rubyBase const): (WebCore::RenderRubyRun::firstLineBlock const): (WebCore::RenderRubyRun::takeChild): (WebCore::RenderRubyRun::rubyBaseSafe): Deleted. * rendering/RenderRubyRun.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::insertChild): (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe): * rendering/updating/RenderTreeBuilderRuby.h: 2018-01-30 Fujii Hironori <Hironori.Fujii@sony.com> Unified sources for FEMorphology.cpp seems to break the windows build. https://bugs.webkit.org/show_bug.cgi?id=178847 Reviewed by Yusuke Suzuki. Fix a compilation error. platform/graphics/filters/SpotLightSource.cpp(45): error C2027: use of undefined type 'WebCore::FilterEffect' No new tests (No behavior change) * Sources.txt: Removed @no-unify for FEMorphology.cpp. * platform/graphics/filters/SpotLightSource.cpp: Added #include "FilterEffect.h". 2018-01-30 Myles C. Maxfield <mmaxfield@apple.com> Test fix after r227776 https://bugs.webkit.org/show_bug.cgi?id=180951 Unreviewed. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::mandatoryAttributesForUserInstalledFonts): 2018-01-30 Dean Jackson <dino@apple.com> CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded https://bugs.webkit.org/show_bug.cgi?id=182299 <rdar://problem/36853088> Removing a misleading comment based on Zalan Bujtas's feedback. * rendering/RenderElement.cpp: (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): 2018-01-30 Dean Jackson <dino@apple.com> CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded https://bugs.webkit.org/show_bug.cgi?id=182299 <rdar://problem/36853088> Reviewed by Simon Fraser. Mostly speculative fix for the case where a scrollTo moves an animated SVG image into view, causing its animation to restart during a paint operation. This was causing a release ASSERT, so we now defer the resumption of the animation into a timer. Test: svg/animated-svgImage-scroll.html * rendering/RenderElement.cpp: (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Enqueue the animation if it is an SVGImage. * svg/graphics/SVGImage.cpp: Add a timer to enqueue animation starts. (WebCore::SVGImage::SVGImage): (WebCore::SVGImage::startAnimationTimerFired): (WebCore::SVGImage::enqueueStartAnimation): (WebCore::SVGImage::stopAnimation): * svg/graphics/SVGImage.h: 2018-01-30 Chris Dumez <cdumez@apple.com> Service worker registration soft updates happen too frequently https://bugs.webkit.org/show_bug.cgi?id=182296 <rdar://problem/37031862> Reviewed by Youenn Fablet. Move code that updates the registration's last update check time from after the script bytecheck to before, as per: - https://w3c.github.io/ServiceWorker/#update (step 7.19) This way, the last update check time gets updated even if the newly fetched script is identical to the previous one, which is the common case. * workers/service/server/SWServer.cpp: (WebCore::SWServer::updateWorker): * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptFetchFinished): 2018-01-30 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move childBecameNonInline to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=182265 <rdar://problem/37004459> Reviewed by Antti Koivisto. Move the mutation code that wraps/unwraps a child element when its flow state changes from(to) in-flow to(from) floating/out-of-flow. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::childBecameNonInline): Deleted. * rendering/RenderBlock.h: * rendering/RenderBoxModelObject.h: (WebCore::RenderBoxModelObject::childBecameNonInline): Deleted. * rendering/RenderElement.cpp: (WebCore::RenderElement::styleDidChange): (WebCore::RenderElement::handleDynamicFloatPositionChange): Deleted. * rendering/RenderInline.cpp: (WebCore::RenderInline::childBecameNonInline): Deleted. * rendering/RenderInline.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock): (WebCore::RenderTreeBuilder::splitFlow): Deleted. * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::childBecameNonInline): * rendering/updating/RenderTreeBuilderBlock.h: * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::childBecameNonInline): * rendering/updating/RenderTreeBuilderInline.h: 2018-01-30 Brent Fulgham <bfulgham@apple.com> Add telemetry to track storage access API adoption https://bugs.webkit.org/show_bug.cgi?id=182197 <rdar://problem/35803309> Reviewed by Chris Dumez. Partial roll-out of r227755. The original patch assumed the WebContent process kept track of user interaction. This is only tracked in the UIProcess, so we can get rid of some of the logging code adding in r227755. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logFrameNavigation): (WebCore::ResourceLoadObserver::logSubresourceLoading): (WebCore::ResourceLoadObserver::setTimeToLivePartitionFree): Deleted. (WebCore::ResourceLoadObserver::wasAccessedWithinInteractionWindow const): Deleted. * loader/ResourceLoadObserver.h: 2018-01-30 Chris Dumez <cdumez@apple.com> Make sure we never create a WebSWClientConnection with an invalid sessionID https://bugs.webkit.org/show_bug.cgi?id=182276 <rdar://problem/36582633> Reviewed by Alex Christensen. Make sure we never create a WebSWClientConnection with an invalid sessionID as this could corrupt our hash tables. * dom/Document.cpp: (WebCore::Document::privateBrowsingStateDidChange): * workers/service/ServiceWorker.cpp: (WebCore::ServiceWorker::postMessage): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::ready): (WebCore::ServiceWorkerContainer::getRegistration): (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest): (WebCore::ServiceWorkerContainer::getRegistrations): (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest): (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): (WebCore::ServiceWorkerContainer::ensureSWClientConnection): 2018-01-30 Antti Koivisto <antti@apple.com> Avoid traversing too much when doing class change invalidation https://bugs.webkit.org/show_bug.cgi?id=181604 Reviewed by Zalan Bujtas. We are now collecting information about which part of the tree a change in class can potentially affect. Use the information to traverse only the required elements in Style::Invalidator. The same mechanism can be later used for attribute and id change invalidation. * css/DocumentRuleSets.cpp: (WebCore::DocumentRuleSets::collectFeatures const): (WebCore::DocumentRuleSets::classInvalidationRuleSets const): (WebCore::DocumentRuleSets::subjectClassRules const): Deleted. (WebCore::DocumentRuleSets::ancestorClassRules const): Deleted. Remove separate subject and ancestor invalidation RuleSets. Instead collect all invalidation rulesets to a vector along with their MatchElements. * css/DocumentRuleSets.h: * css/RuleFeature.cpp: (WebCore::RuleFeatureSet::computeNextMatchElement): (WebCore::RuleFeatureSet::computeSubSelectorMatchElement): (WebCore::RuleFeatureSet::collectFeatures): Similarly collect all class invalidation RuleFeatures to a general HashMap along with the MatchElement. (WebCore::RuleFeatureSet::add): (WebCore::RuleFeatureSet::clear): (WebCore::RuleFeatureSet::shrinkToFit): * css/RuleFeature.h: (WebCore::RuleFeature::RuleFeature): * style/ClassChangeInvalidation.cpp: (WebCore::Style::ClassChangeInvalidation::computeInvalidation): Find out InvalidationRuleSets to use. (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets): Pass them to Style::Invalidator. * style/ClassChangeInvalidation.h: * style/StyleInvalidator.cpp: (WebCore::Style::Invalidator::invalidateStyleForTree): (WebCore::Style::Invalidator::invalidateStyleForDescendants): (WebCore::Style::Invalidator::invalidateStyleWithMatchElement): Traverse only the part of the tree needed by the given MatchElement. * style/StyleInvalidator.h: * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::classNamesAffectedByRules const): 2018-01-30 Javier Fernandez <jfernandez@igalia.com> [css-align] The 'baseline' value must be invalid for the 'justify-content' property https://bugs.webkit.org/show_bug.cgi?id=181794 Reviewed by Antti Koivisto. The CSS WG has resolved that it doesn't make sense to define Baseline Content-Alignment in the inline/main axis. https://github.com/w3c/csswg-drafts/issues/1184 The spec has been updated so that <baseline-postion> is not valid for the 'justify-content' property's syntax. This CL updates our parsing logic to match the new spec, including the parsing logic of the place-content shorthand. Additionally, this CL updates the computed value of the <baseline-position> values to match other browsers. We don't implement support for <baseline-position> values in the Content Distribution properties (align-content and justify-content), so I don't expect this change to break content of sites using the CSS Box Alignment feature. No new tests, just adapt the Web Platform Tests we already have to the new CSS syntax. * css/parser/CSSPropertyParser.cpp: (WebCore::getBaselineKeyword): (WebCore::consumeBaselineKeyword): (WebCore::consumeContentDistributionOverflowPosition): (WebCore::consumeSelfPositionOverflowPosition): (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::consumeSimplifiedContentPosition): (WebCore::CSSPropertyParser::consumePlaceContentShorthand): (WebCore::consumeSimplifiedItemPosition): 2018-01-30 Basuke Suzuki <Basuke.Suzuki@sony.com> [WinCairo] Fix forwarding header conflict of WebKit on WinCairo https://bugs.webkit.org/show_bug.cgi?id=177202 Reviewed by Alex Christensen. * PlatformWin.cmake: 2018-01-30 Myles C. Maxfield <mmaxfield@apple.com> A disallowed user-installed font may be used if its PostScript name is specified https://bugs.webkit.org/show_bug.cgi?id=180951 Reviewed by Brent Fulgham. This patch adds a new CoreText font attribute, kCTFontFallbackOptionAttribute, to the fonts which WebKit creates. It also adds this attribute to web fonts, so that font fallback will happen according to our rules about user-installed fonts. It also marks these font attributes as "mandatory" so CoreText will be guaranteed to follow the policy. Test: fast/text/user-installed-fonts/disable.html * platform/graphics/FontCache.h: (WebCore::FontDescriptionKey::makeFlagsKey): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::fontForPostScriptName): (WebCore::addAttributesForUserInstalledFonts): (WebCore::mandatoryAttributesForUserInstalledFonts): * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): 2018-01-29 Youenn Fablet <youenn@apple.com> Cache API should make sure to resolve caches.open promises in the same order as called https://bugs.webkit.org/show_bug.cgi?id=182193 <rdar://problem/36930363> Reviewed by Chris Dumez. Covered by LayoutTests/http/wpt/cache-storage/cache-open-delete-in-parallel.https.html. * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::doRemove): Removed optimization consisting in removing the cache from DOMCacheStorage object synchronously. This optimization prevents going to the network process to try deleting the cache. 2018-01-29 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Add a compile-time feature flag https://bugs.webkit.org/show_bug.cgi?id=182211 <rdar://problem/36936365> Reviewed by Brent Fulgham. Add a compile-time feature flag for WebAuthN as most of the functionality is platform dependent. No tests. * Configurations/FeatureDefines.xcconfig: * Modules/credentialmanagement/BasicCredential.cpp: * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: * Modules/credentialmanagement/CredentialsContainer.h: * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.cpp: * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/Authenticator.cpp: * Modules/webauthn/Authenticator.h: * Modules/webauthn/AuthenticatorAssertionResponse.cpp: * Modules/webauthn/AuthenticatorAssertionResponse.h: * Modules/webauthn/AuthenticatorAssertionResponse.idl: * Modules/webauthn/AuthenticatorAttestationResponse.cpp: * Modules/webauthn/AuthenticatorAttestationResponse.h: * Modules/webauthn/AuthenticatorAttestationResponse.idl: * Modules/webauthn/AuthenticatorResponse.cpp: * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Modules/webauthn/PublicKeyCredentialRequestOptions.h: * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: * Modules/webauthn/PublicKeyCredentialType.h: * Modules/webauthn/PublicKeyCredentialType.idl: * bindings/js/JSAuthenticatorResponseCustom.cpp: * bindings/js/JSBasicCredentialCustom.cpp: 2018-01-29 John Wilander <wilander@apple.com> Resource Load Statistics: Introduce debug mode as experimental feature https://bugs.webkit.org/show_bug.cgi?id=182199 <rdar://problem/36930364> Reviewed by Alex Christensen. No new tests. This adds an experimental feature. The only changes to default behavior are: - Increased resolution on timestamps which is needed to be able to set shorter timeouts in debug mode. - Only update partitioning and blocking table when needed. This is an optimization which pays off in less XPC with shorter timeouts. * loader/ResourceLoadObserver.cpp: (WebCore::reduceTimeResolution): (WebCore::ResourceLoadObserver::logFrameNavigation): (WebCore::ResourceLoadObserver::logSubresourceLoading): (WebCore::ResourceLoadObserver::logWebSocketLoading): (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): (WebCore::reduceToHourlyTimeResolution): Deleted. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setResourceLoadStatisticsDebugMode): (WebCore::RuntimeEnabledFeatures::resourceLoadStatisticsDebugMode const): * page/Settings.yaml: 2018-01-29 Oleksandr Skachkov <gskachkov@gmail.com> FetchResponse should support ConsumeData callback on chunk data is received: handling ReadableStream bodies https://bugs.webkit.org/show_bug.cgi?id=182008 Reviewed by Youenn Fablet. Modify FetchResponse to support ConsumeData callback with handling of ReadableStream by chunks * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::put): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolve): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::consumeBodyFromReadableStream): * Modules/fetch/FetchResponse.h: * Modules/streams/ReadableStreamChunk.h: Added. * Modules/streams/ReadableStreamSink.cpp: (WebCore::ReadableStreamToSharedBufferSink::enqueue): (WebCore::ReadableStreamToSharedBufferSink::close): * Modules/streams/ReadableStreamSink.h: * WebCore.xcodeproj/project.pbxproj: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::processResponse): 2018-01-29 Andy Estes <aestes@apple.com> [iOS] Restrict synthetic clicks to the origin that handled the underlying touch event https://bugs.webkit.org/show_bug.cgi?id=182252 <rdar://problem/21555881> Reviewed by Tim Horton. Test: http/tests/events/touch/ios/cross-frame-single-tap-same-origin.https.html * dom/Document.h: (WebCore::Document::handlingTouchEvent const): * page/EventHandler.h: (WebCore::EventHandler::touchEventTargetSubframe const): (WebCore::EventHandler::touches const): Exposed some information needed by WebPage::updatePotentialTapSecurityOrigin(). * page/Frame.h: * page/ios/FrameIOS.mm: (WebCore::Frame::betterApproximateNode): (WebCore::Frame::qualifyingNodeAtViewportLocation): Changed NodeQualifier from a function pointer to a WTF::Function. (WebCore::Frame::nodeRespondingToClickEvents): Turned ancestorRespondingToClickEvents() into a lambda that captures originRestriction. In the lambda, if there is an origin restriction, return nullptr if the hit test result's inner Node is not in the restricted origin. (WebCore::Frame::nodeRespondingToScrollWheelEvents): Turned ancestorRespondingToScrollWheelEvents() into a lambda. (WebCore::ancestorRespondingToScrollWheelEvents): Moved to lambda in nodeRespondingToScrollWheelEvents(). (WebCore::ancestorRespondingToClickEvents): Moved to lambda in nodeRespondingToClickEvents(). 2018-01-29 Emilio Cobos Álvarez <emilio@crisal.io> Trivially cleanup std::optional usage in RenderBlockFlow. https://bugs.webkit.org/show_bug.cgi?id=182142 Reviewed by Antti Koivisto. No new tests, no behavior change. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::firstLineBaseline const): (WebCore::RenderBlockFlow::inlineBlockBaseline const): 2018-01-29 Brent Fulgham <bfulgham@apple.com> Add telemetry to track storage access API adoption https://bugs.webkit.org/show_bug.cgi?id=182197 <rdar://problem/35803309> Reviewed by Chris Dumez. Part 1: Add telemetry for the user interaction case This patch adds telemetry to track how frequently third-party cookies are used in a first party context due to user interaction. This will help understand cases where the new Storage Access API can help, and to help us understand if we have considered relevant use cases in its design. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::setTimeToLivePartitionFree): Let the observer know the first party interaction duration. (WebCore::ResourceLoadObserver::wasAccessedWithinInteractionWindow const): Added. (WebCore::ResourceLoadObserver::logFrameNavigation): Note when a third party resource is accessed as a first party due to user interaction. (WebCore::ResourceLoadObserver::logSubresourceLoading): Ditto. * loader/ResourceLoadObserver.h: * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::encode const): Handle new fields. (WebCore::ResourceLoadStatistics::decode): Ditto. * loader/ResourceLoadStatistics.h: 2018-01-29 Antti Koivisto <antti@apple.com> CalcExpressionBlendLength::evaluate hits stack limit https://bugs.webkit.org/show_bug.cgi?id=182243 Reviewed by Zalan Bujtas. Speculative fix to prevent nesting of CalcExpressionBlendLength. No test, don't know how to make one. * platform/CalculationValue.cpp: (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength): CalcExpressionBlendLength is only used in Length values of animated style. Normally such styles are not used as input for further blending but there are some paths where this could in principle happen. Repeated application (for each animation frame) could construct CalcExpressionBlendLength expression that blows the stack when evaluated. Speculatively fix by flattening any nesting. * platform/CalculationValue.h: (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength): Deleted. 2018-01-29 Chris Dumez <cdumez@apple.com> Drop unnecessary "ServiceWorker Task Thread" in SWServer https://bugs.webkit.org/show_bug.cgi?id=182253 Reviewed by Youenn Fablet. Drop unnecessary "ServiceWorker Task Thread" in SWServer. We're spinning a thread for each SWServer that is never used. * workers/service/server/SWServer.cpp: (WebCore::SWServer::~SWServer): (WebCore::SWServer::SWServer): (WebCore::SWServer::taskThreadEntryPoint): Deleted. (WebCore::SWServer::postTask): Deleted. (WebCore::SWServer::postTaskReply): Deleted. (WebCore::SWServer::handleTaskRepliesOnMainThread): Deleted. * workers/service/server/SWServer.h: 2018-01-29 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r227731. This caused and assertion failure in API tests. Reverted changeset: "Layout Test fast/events/beforeunload-dom-manipulation- crash.html is crashing" https://bugs.webkit.org/show_bug.cgi?id=181204 https://trac.webkit.org/changeset/227731 2018-01-29 Brady Eidson <beidson@apple.com> Make it possible for apps that use both WK1 and WK2 to use MessagePorts. https://bugs.webkit.org/show_bug.cgi?id=182229 Reviewed by Chris Dumez. Covered by existing LayoutTests and a new API test. * dom/messageports/MessagePortChannel.cpp: (WebCore::MessagePortChannel::checkRemotePortForActivity): Don't use the global singleton provider. Instead use the provider that belongs to the owning registry. * dom/messageports/MessagePortChannelProviderImpl.cpp: (WebCore::MessagePortChannelProviderImpl::MessagePortChannelProviderImpl): Pass a reference to *this to the Registry. * dom/messageports/MessagePortChannelProviderImpl.h: * dom/messageports/MessagePortChannelRegistry.cpp: (WebCore::MessagePortChannelRegistry::MessagePortChannelRegistry): Keep a Provider member so MessagePortChannels can get to it instead of relying on the global singleton provider. * dom/messageports/MessagePortChannelRegistry.h: (WebCore::MessagePortChannelRegistry::provider): 2018-01-29 Per Arne Vollan <pvollan@apple.com> Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing https://bugs.webkit.org/show_bug.cgi?id=181204 <rdar://problem/36256274> Reviewed by Ryosuke Niwa. When a frame element is moved in the DOM tree during the execution of a beforeunload handler, the frame will be detached when removed from its previous position in the DOM tree. When being detached, an attempt will also be made to stop the load by calling FrameLoader::stopAllLoaders(). However, this method will return early when executed in a beforeunload handler, since navigation is not allowed then. The end result is a detached frame which will continue to load, and hitting asserts in DocumentLoader::dataReceived(), and DocumentLoader::notifyFinished(). It should be possible to stop a frame load, even when executing a beforeunload handler. No new tests. Covered by the existing test fast/events/beforeunload-dom-manipulation-crash.html. * loader/FrameLoader.cpp: (WebCore::FrameLoader::isStopLoadingAllowed const): (WebCore::FrameLoader::stopAllLoaders): * loader/FrameLoader.h: 2018-01-29 Miguel Gomez <magomez@igalia.com> [CoordnatedGraphics] A child layer of a semitransparent layer isn't clipped properly https://bugs.webkit.org/show_bug.cgi?id=181080 Reviewed by Žan Doberšek. Check whether the applied clipping area is empty before drawing the children of a TextureMapperLayer. If the area is empty no children will be drawn, so we can avoid drawing them. No new tests -- no change in behavior. * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelfAndChildren): 2018-01-29 Zan Dobersek <zdobersek@igalia.com> [Cairo] Add GraphicsContextImplCairo::createFactory() helpers https://bugs.webkit.org/show_bug.cgi?id=182238 Reviewed by Carlos Garcia Campos. Instead of duplicating lambdas that return a newly-created GraphicsContextImplCairo object, provide static createFactory() helpers on that class that produce GraphicsContextImplFactory wrappers which are then invoked in the GraphicsContext constructor. The static functions accept either the PlatformContextCairo reference or the cairo_t pointer, invoking the proper GraphicsContextImplCairo constructor in the returned lambda wrapper. No new tests -- no change in functionality. * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::GraphicsContextImplCairo::createFactory): * platform/graphics/cairo/GraphicsContextImplCairo.h: * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::ImageBuffer): * platform/graphics/cairo/PathCairo.cpp: (WebCore::Path::strokeBoundingRect const): (WebCore::Path::strokeContains const): * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::PaintingContextCairo): * platform/graphics/win/ImageCairoWin.cpp: (WebCore::BitmapImage::getHBITMAPOfSize): 2018-01-29 Zan Dobersek <zdobersek@igalia.com> Construct GraphicsContext with NonPaintingReasons::NoReason in FrameView::adjustPageHeightDeprecated() https://bugs.webkit.org/show_bug.cgi?id=182235 Reviewed by Carlos Garcia Campos. Pass the NonPaintingReasons::NoReason value to the GraphicsContext constructor in FrameView::adjustPageHeightDeprecated(). This has the same effect as when passing a null PlatformGraphicsContext to the constructor, which effectively disables any painting through that GraphicsContext, but doesn't have a platform-specific connotation. No new tests -- no change in functionality. * page/FrameView.cpp: (WebCore::FrameView::adjustPageHeightDeprecated): 2018-01-29 Zan Dobersek <zdobersek@igalia.com> [Cairo] Remove the GraphicsContext(cairo_t*) constructor https://bugs.webkit.org/show_bug.cgi?id=182234 Reviewed by Carlos Garcia Campos. Instead of using the GraphicsContext(cairo_t*) constructor, leverage the GraphicsContextImplCairo class and work with an existing Cairo context through that GraphicsContextImpl implementation. A new GraphicsContextImplCairo constructor is added, expecting pointer to the cairo_t object. With that, a PlatformContextCairo object is created, with ownership of that object now being handled by the GraphicsContextImplCairo class. Call sites of the GraphicsContext(cairo_t*) constructor are adjusted to instead provide a factory function that returns a fresh GraphicsContextImplCairo object, passing that cairo_t object to its constructor. No new tests -- no change in behavior. * platform/graphics/GraphicsContext.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::GraphicsContext): Deleted. * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::GraphicsContextImplCairo::GraphicsContextImplCairo): (WebCore::m_private): * platform/graphics/cairo/GraphicsContextImplCairo.h: * platform/graphics/cairo/PathCairo.cpp: (WebCore::Path::strokeBoundingRect const): (WebCore::Path::strokeContains const): * platform/graphics/win/ImageCairoWin.cpp: (WebCore::BitmapImage::getHBITMAPOfSize): 2018-01-28 Minsheng Liu <lambda@liu.ms> Overflow of formulas is hidden for display mathematics https://bugs.webkit.org/show_bug.cgi?id=160547 Reviewed by Frédéric Wang. Previously, <math> with display="block" uses its container's logical width as logical width. However, that behavior will truncate overflowed contents. The patch fixes it by setting the logical width as its content width rather than its container's logical width if the former is wider than the latter. Test: mathml/presentation/display-math-horizontal-overflow.html * rendering/mathml/RenderMathMLRow.cpp: (WebCore::RenderMathMLRow::layoutBlock): 2018-01-26 Antoine Quint <graouts@apple.com> [Web Animations] Distinguish between an omitted and a null timeline argument to the Animation constructor https://bugs.webkit.org/show_bug.cgi?id=179065 <rdar://problem/36869046> Reviewed by Dean Jackson. The Web Animations specification requires that a missing or undefined "timeline" parameter means that the document's timeline should be used, but a null value should be supported. To support this, we need to provide a custom Animation constructor where we can check on the ExecState whether the second argument passed is undefined, which is true if an explicit "undefined" value is passed or if the argument does not exist. * Sources.txt: Add the new JSWebAnimationCustom.cpp file. * WebCore.xcodeproj/project.pbxproj: Add the new JSWebAnimationCustom.cpp file. * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): Add a create() variant that doesn't provide an AnimationTimeline parameter to clearly indicate that the provided Document's timeline should be used. * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSWebAnimationCustom.cpp: Added. (WebCore::constructJSWebAnimation): Provide a custom Animation constructor where we check whether the second argument, the timeline, is undefined. * dom/Element.cpp: (WebCore::Element::animate): Use the new create() variant since passing "nullptr" now means a null timeline. 2018-01-26 Ricky Mondello <rmondello@apple.com> Use the standard -webkit-autofill color on iOS https://bugs.webkit.org/show_bug.cgi?id=182182 Reviewed by Tim Horton. * css/html.css: (input:-webkit-autofill, input:-webkit-autofill-strong-password): 2018-01-26 Dean Jackson <dino@apple.com> REGRESSION (r222961): Clear function not clearing whole screen when antialias is set to false https://bugs.webkit.org/show_bug.cgi?id=179368 <rdar://problem/36111549> Reviewed by Sam Weinig. When we changed from using a CAOpenGLLayer to a regular CALayer, we should have also swapped the "opaque" property to "contentsOpaque". Covered by the existing test: fast/canvas/webgl/context-attributes-alpha.html (when run on some hardware!) * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer initWithGraphicsContext3D:]): 2018-01-26 Mark Lam <mark.lam@apple.com> Add infrastructure for pointer preparation. https://bugs.webkit.org/show_bug.cgi?id=182191 <rdar://problem/36889194> Reviewed by JF Bastien. No new tests because this patch does not introduce any behavior change. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::toJSNewlyCreated): 2018-01-26 Simon Fraser <simon.fraser@apple.com> REGRESSiON (r226492): Crash under Element::absoluteEventBounds() on a SVGPathElement which has not been laid out yet https://bugs.webkit.org/show_bug.cgi?id=182185 rdar://problem/36836262 Reviewed by Zalan Bujtas. Document::absoluteRegionForEventTargets() can fire when layout is dirty, and SVGPathElement's path() can be null if it hasn't been laid out yet. So protect against a null path in getBBox(). Not easily testable because internals.nonFastScrollableRects() forces layout, and the crash depends on the timing of absoluteRegionForEventTargets(). * svg/SVGPathElement.cpp: (WebCore::SVGPathElement::getBBox): 2018-01-26 Chris Dumez <cdumez@apple.com> Offlined content does not work for apps on home screen https://bugs.webkit.org/show_bug.cgi?id=182070 <rdar://problem/36843906> Reviewed by Youenn Fablet. Already registered service workers were unable to intercept the very first load because registration matching was happening after the registration was loaded from disk, but *before* its active worker was populated. We now initialize the registrations' active worker as soon as we load them from disk. We do not necessarily have a SW Context process connection identifier yet at this point so I made it optional on the SWServerWorker. This identifier gets set on the SWServerWorker when the worker is actually launched and gets cleared when the SWServerWorker gets terminated. Covered by new API test. * workers/service/server/SWServer.cpp: (WebCore::SWServer::addRegistrationFromStore): (WebCore::SWServer::installContextData): (WebCore::SWServer::terminateWorkerInternal): (WebCore::SWServer::workerContextTerminated): (WebCore::SWServer::fireInstallEvent): (WebCore::SWServer::fireActivateEvent): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::SWServerWorker): * workers/service/server/SWServerWorker.h: (WebCore::SWServerWorker::contextConnectionIdentifier const): (WebCore::SWServerWorker::setContextConnectionIdentifier): 2018-01-26 Chris Nardi <cnardi@chromium.org> Addressing post-review comments after r226614 https://bugs.webkit.org/show_bug.cgi?id=182151 Reviewed by Myles C. Maxfield. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::sanitizeUserInputValue): * html/TextFieldInputType.cpp: (WebCore::limitLength): * platform/LocalizedStrings.cpp: (WebCore::truncatedStringForLookupMenuItem): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): 2018-01-26 Antoine Quint <graouts@apple.com> [iOS] prefers-reduced-motion media query is not working https://bugs.webkit.org/show_bug.cgi?id=182169 <rdar://problem/36801631> Reviewed by Dean Jackson. The code that would eventually query UIKit for the system setting was not run since USE(NEW_THEME) is off on iOS. Adding a PLATFORM(IOS) flag here allows the code to run. * css/MediaQueryEvaluator.cpp: (WebCore::prefersReducedMotionEvaluate): 2018-01-26 Youenn Fablet <youenn@apple.com> CSP post checks should be done for service worker responses https://bugs.webkit.org/show_bug.cgi?id=182160 Reviewed by Daniel Bates. Covered by updated test. Add security checks when receiving a service worker response. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveResponse): * loader/cache/CachedResourceLoader.h: 2018-01-26 Manuel Rego Casasnovas <rego@igalia.com> [css-multicol] Support percentages in column-gap https://bugs.webkit.org/show_bug.cgi?id=182004 Reviewed by Javier Fernandez. This patch adds percentage support to column-gap property. Most of the changes are related to the parsing logic, the column-gap property now accepts both length and percentages, on top of the "normal" initial value. A new utility class GapLength has been added, as it'll be useful to implement row-gap in the future. Apart from that the muticolumn layout code has been modified to resolve the percentage gaps (treating them as zero while computing preferred widths) and resolving them during layout. This doesn't follow the current text on the spec, but there is an ongoing discussion that might cause the text is changed: https://github.com/w3c/csswg-drafts/issues/509#issuecomment-355242101 We could update the implementation once we have a definitive answer from the CSS WG. Test: web-platform-tests/css/css-multicol/multicol-gap-percentage-001.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSProperties.json: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertGapLength): * css/StyleBuilderCustom.h: (WebCore::forwardInheritedValue): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeGapLength): (WebCore::CSSPropertyParser::parseSingleValue): * page/FrameView.cpp: (WebCore::FrameView::applyPaginationToViewport): * page/animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::columnGap const): * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::columnGap const): * rendering/style/GapLength.cpp: Added. (WebCore::operator<<): * rendering/style/GapLength.h: Added. (WebCore::GapLength::GapLength): (WebCore::GapLength::isNormal const): (WebCore::GapLength::length const): (WebCore::GapLength::operator== const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::columnGap const): (WebCore::RenderStyle::setColumnGap): (WebCore::RenderStyle::initialColumnGap): * rendering/style/StyleMultiColData.cpp: (WebCore::StyleMultiColData::StyleMultiColData): (WebCore::StyleMultiColData::operator== const): * rendering/style/StyleMultiColData.h: * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2018-01-26 Emilio Cobos Álvarez <emilio@crisal.io> Remove unused RenderFragmentedFlow::createFragmentedFlowStyle. https://bugs.webkit.org/show_bug.cgi?id=182138 Reviewed by Manuel Rego Casasnovas. Has no callers. No new tests, just removes unused code so no behavior change. * rendering/RenderFragmentedFlow.cpp: * rendering/RenderFragmentedFlow.h: 2018-01-26 Emilio Cobos Álvarez <emilio@crisal.io> Remove useless RenderBlockFlow overrides. https://bugs.webkit.org/show_bug.cgi?id=182139 Reviewed by Manuel Rego Casasnovas. I think these are leftovers from the CSS regions removal, looking at blame. No new tests, no behavior change. * rendering/RenderBlockFlow.cpp: * rendering/RenderBlockFlow.h: 2018-01-25 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Add InspectorShaderProgram to Unified Sources build https://bugs.webkit.org/show_bug.cgi?id=182084 Reviewed by Dan Bernstein. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * Sources.txt: Move to Sources.txt always. * inspector/InspectorShaderProgram.cpp: Add ENABLE(WEBGL) guard to contents. 2018-01-25 Ryosuke Niwa <rniwa@webkit.org> Make scrolling to the focused element async https://bugs.webkit.org/show_bug.cgi?id=181575 <rdar://problem/36459767> Reviewed by Simon Fraser. Made the revealing of the focused element asynchronous in Element::focus. Like selection, schedule a timer when a new element is focused, and only scroll to the focused element when the timer fires. If any other scrolling happens meanwhile, we cancel this timer. There are two Web exposed behavioral changes: 1. The scrolling position doesn't change immediately when calling Element::focus. 2. Only the last focused element will be revealed. Both behavioral changes pose its own compatibility risks but we're making a conscious decision here since the scrolling asynchronous has a clear performance benefit. There is one edge case to cosnider: when the history controller restores the scrolling position, canceling the timer results in a focused element in an overflow: hidden element to be never revealed. Expediate revealing of the focused element in this one case instead of canceling. Tests: fast/scrolling/scroll-to-focused-element-asynchronously.html fast/scrolling/scroll-to-focused-element-canceled-by-fragment-navigation.html * dom/Element.cpp: (WebCore::Element::focus): Call updateFocusAppearance on focusAppearanceUpdateTarget to handle HTMLAreaElement which delegates the focus appearance update to its image element. (WebCore::Element::focusAppearanceUpdateTarget): Extracted. Returns "this" element for all but HTMLAreaElement. (WebCore::Element::updateFocusAppearance): Schedule the revealing of the focused element in FrameView instead of synchronously scrolling to the focused element. * dom/Element.h: (WebCore::Element::defaultFocusTextStateChangeIntent): * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::focusAppearanceUpdateTarget): Extracted from updateFocusAppearance. (WebCore::HTMLAreaElement::updateFocusAppearance): Deleted. * html/HTMLAreaElement.h: * loader/HistoryController.cpp: (WebCore::HistoryController::restoreScrollPositionAndViewState): Reveal the focused element prior to restoring the scrolling location of the fragment navigation. This is needed to reveal a focused element inside overflow: hidden element which got focused. * page/FrameView.cpp: (WebCore::FrameView::FrameView): Added a boolean flag and a timer for scrolling to the focused element. (WebCore::FrameView::reset): Stop the timer and clear the flag. (WebCore::FrameView::maintainScrollPositionAtAnchor): Ditto when scrolling to an anchor. (WebCore::FrameView::setScrollPosition): Ditto when some other programatic scroll or the user scrolls the view. (WebCore::FrameView::scheduleScrollToFocusedElement): Added. (WebCore::FrameView::scrollToFocusedElementImmediatelyIfNeeded): Added. (WebCore::FrameView::scrollToFocusedElementTimerFired): Added. (WebCore::FrameView::scrollToAnchor): Stop the timer and clear the flag when scrolling to an achor. (WebCore::FrameView::setWasScrolledByUser): Ditto when the user scrolls. * page/FrameView.h: 2018-01-25 Said Abou-Hallawa <sabouhallawa@apple.com> REGRESSION(r217236): [iOS] PDFDocumentImage does not update its cached ImageBuffer if it has a sub-rectangle of the image https://bugs.webkit.org/show_bug.cgi?id=182083 Reviewed by Simon Fraser. Test: fast/images/pdf-as-image-dest-rect-change.html Revert the change r217236 back. Fix the issue of throwing out the cached ImageBuffer of the PDF document image when moving its rectangle. * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::cacheParametersMatch): Return the if-statement which was deleted in r217236 back but intersect it with dstRect. The context clipping rectangle can be more than the dstRect. (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): -- Remove a wrong optimization which used to work for Mac only if the context interpolation quality is not set to low or none quality. This optimization does not consider the case when srcRect or destRect change after caching the ImageBuffer. Or even if m_cachedImageRect does not include the whole clipping rectangle. -- Move back the call to cacheParametersMatch() before changing the m_cachedImageRect. -- Always intersect the clipping rectangle with the dstRect to ensure we only look at the dirty rectangle inside the image boundary. -- If cacheParametersMatch() returns true, set m_cachedDestinationRect to dstRect and move m_cachedImageRect by the difference between the new and the old dstRects since no re-caching will happen. * platform/graphics/cg/PDFDocumentImage.h: * testing/Internals.cpp: (WebCore::pdfDocumentImageFromImageElement): (WebCore::Internals::pdfDocumentCachingCount): * testing/Internals.h: * testing/Internals.idl: Add an internal API which returns the number of drawing the PDF into an ImageBuffer. 2018-01-25 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Remove unnecessary developerExtrasEnabled checks https://bugs.webkit.org/show_bug.cgi?id=182156 Reviewed by Matt Baker. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl): (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl): (WebCore::InspectorInstrumentation::didCreateWebSocketImpl): These checks should not be needed. The step above bails if there is no inspector frontend, and there can be no inspector frontend unless developer extras enabled are enabled. 2018-01-25 Wenson Hsieh <wenson_hsieh@apple.com> Add localizable strings for extra-zoomed form controls https://bugs.webkit.org/show_bug.cgi?id=182080 Reviewed by Tim Horton. Add new localizable strings. Additionally, run `update-webkit-localizable-strings` to re-sort Localizable.strings. * English.lproj/Localizable.strings: * platform/LocalizedStrings.cpp: (WebCore::formControlCancelButtonTitle): (WebCore::formControlHideButtonTitle): (WebCore::formControlGoButtonTitle): (WebCore::formControlSearchButtonTitle): (WebCore::textInputModeWriteButton): (WebCore::textInputModeSpeechButton): * platform/LocalizedStrings.h: 2018-01-25 Chris Dumez <cdumez@apple.com> Access to service workers / Cache API should be disabled in sandboxed frames without allow-same-origin flag https://bugs.webkit.org/show_bug.cgi?id=182140 <rdar://problem/36879952> Reviewed by Youenn Fablet. Throw a SecurityError when accessing navigator.serviceWorker or window.caches inside a sandboxed iframe without the allow-same-origin flag. This behavior is consistent with Chrome. Firefox, however, seems to return these objects but have their API reject promises with a SecurityError instead. No new tests, rebaselined existing tests. * Modules/cache/DOMWindowCaches.cpp: (WebCore::DOMWindowCaches::caches): Deleted. * Modules/cache/DOMWindowCaches.h: * Modules/cache/DOMWindowCaches.idl: * page/NavigatorBase.cpp: * page/NavigatorBase.h: * page/NavigatorServiceWorker.idl: 2018-01-25 Chris Dumez <cdumez@apple.com> Clients.get(id) should only returns clients in the service worker's origin https://bugs.webkit.org/show_bug.cgi?id=182149 <rdar://problem/36882310> Reviewed by Youenn Fablet. When looking for SW clients with a given identifier, only look in the list of clients that have the same origin as the service worker. No new tests, rebaselined existing test. * workers/service/server/SWServer.cpp: (WebCore::SWServer::serviceWorkerClientWithOriginByID const): (WebCore::SWServer::serviceWorkerClientByID const): Deleted. * workers/service/server/SWServer.h: * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::findClientByIdentifier const): * workers/service/server/SWServerWorker.h: 2018-01-25 Youenn Fablet <youenn@apple.com> WebPluginInfoProvider should handle null host queries https://bugs.webkit.org/show_bug.cgi?id=182112 Reviewed by Chris Dumez. No change of behavior. Removed assertion that is not always true, as shown by API tests. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): 2018-01-25 Youenn Fablet <youenn@apple.com> ShapeOutside should use same origin credentials mode https://bugs.webkit.org/show_bug.cgi?id=182141 Reviewed by Chris Dumez. Covered by updated test. As per https://drafts.csswg.org/css-shapes/#shape-outside-property, ShapeOutside images should be fetched with anonymous cors mode, meaning credentials should be set to same-origin. * style/StylePendingResources.cpp: (WebCore::Style::loadPendingImage): 2018-01-25 John Wilander <wilander@apple.com> Make sure we have a frame as we iterate in ResourceLoadObserver::nonNullOwnerURL() https://bugs.webkit.org/show_bug.cgi?id=182116 <rdar://problem/36210134> Reviewed by Alex Christensen. No new tests. No known repro case, just crash logs. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::nonNullOwnerURL const): 2018-01-25 Jer Noble <jer.noble@apple.com> Move ImageDecoderAVFObjC from using AVSampleBufferGenerator to AVAssetReaderOutput for parsing https://bugs.webkit.org/show_bug.cgi?id=182091 Reviewed by Eric Carlson. No new tests; should be covered by existing tests. AVSampleBufferGenerator is not available on iOS, so in order to enable ImageDecoderAVFObjC there, we must adopt a similar API which is available both on iOS and macOS: AVAssetReaderOutput. Unlike the generator, AVAssetReaderOutput doesn't necessarily generate samples in decode order, so we'll repurpose the SampleMap from EME to hold the decoded samples as well as their generated images. * Modules/mediasource/SampleMap.cpp: * Modules/mediasource/SampleMap.h: (WebCore::SampleMap::size const): * platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType): * platform/MediaSample.h: (WebCore::MediaSample::hasAlpha const): * platform/graphics/ImageDecoder.cpp: (WebCore::ImageDecoder::create): (WebCore::ImageDecoder::supportsMediaType): * platform/graphics/avfoundation/MediaSampleAVFObjC.h: Make non-final. (WebCore::MediaSampleAVFObjC::sampleBuffer const): (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h: * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjCSample::create): (WebCore::ImageDecoderAVFObjCSample::sampleBuffer const): (WebCore::ImageDecoderAVFObjCSample::image const): (WebCore::ImageDecoderAVFObjCSample::setImage): (WebCore::ImageDecoderAVFObjCSample::ImageDecoderAVFObjCSample): (WebCore::ImageDecoderAVFObjCSample::cacheMetadata): (WebCore::toSample): (WebCore::ImageDecoderAVFObjC::readSamples): (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): (WebCore::ImageDecoderAVFObjC::advanceCursor): (WebCore::ImageDecoderAVFObjC::setTrack): (WebCore::ImageDecoderAVFObjC::encodedDataStatus const): (WebCore::ImageDecoderAVFObjC::repetitionCount const): (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const): (WebCore::ImageDecoderAVFObjC::frameDurationAtIndex const): (WebCore::ImageDecoderAVFObjC::frameHasAlphaAtIndex const): (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex): (WebCore::ImageDecoderAVFObjC::setData): (WebCore::ImageDecoderAVFObjC::clearFrameBufferCache): (WebCore::ImageDecoderAVFObjC::sampleAtIndex const): (WebCore::ImageDecoderAVFObjC::readSampleMetadata): Deleted. 2018-01-25 Youenn Fablet <youenn@apple.com> DocumentThreadableLoader should ensure service worker is not reused if redirection comes from the network https://bugs.webkit.org/show_bug.cgi?id=182137 Reviewed by Chris Dumez. Covered by rebased test. In case redirection does not come from memory cache or service worker, disable service worker interception when following the redirection. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::redirectReceived): 2018-01-25 Youenn Fablet <youenn@apple.com> DocumentLoader should interrupt ongoing load when getting a redirection from network that matches a service worker https://bugs.webkit.org/show_bug.cgi?id=182115 Reviewed by Alex Christensen. Covered by rebased test. In case a navigation load is going to the network process, we need to interrupt it if having a redirection that leads to a new request going to a service worker. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::redirectReceived): 2018-01-25 Chris Dumez <cdumez@apple.com> Registering same scope as the script directory without the last slash should fail https://bugs.webkit.org/show_bug.cgi?id=182122 <rdar://problem/36877167> Reviewed by Youenn Fablet. This aligns our behavior with Firefox and Chrome. No new tests, rebaselined existing test. * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::didReceiveResponse): 2018-01-25 Antoine Quint <graouts@apple.com> [Web Animations] Expose the reverse() method https://bugs.webkit.org/show_bug.cgi?id=182100 <rdar://problem/36867117> Reviewed by Dean Jackson. We expose and implement the reverse() method on Animation as specified. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setPlaybackRate): (WebCore::WebAnimation::reverse): * animation/WebAnimation.h: * animation/WebAnimation.idl: 2018-01-25 Antoine Quint <graouts@apple.com> [Web Animations] Account for provided easings when computing progress and resolving keyframe effect values https://bugs.webkit.org/show_bug.cgi?id=182098 <rdar://problem/36866149> Reviewed by Dean Jackson. We now account for the timing functions provided through the "easing" propreties on whole animation effects and individual keyframes. Exposing those exposed shortcomings of our keyframe resolution in general through WPT tests so we now implement the "effect value of a keyframe effect" procedure from the spec to correctly resolve keyframes in KeyframeEffect::setAnimatedPropertiesInStyle(). The tests also showed some shortcomings in our TimingFunction code where our step() function resolution wasn't fully compliant and our cubic-bezier() resolution not accurate enough. We now have microsecond accuracy when resolving cubic-bezier() timing functions and identify cubic-bezier(0, 0, 0, 0), cubic-bezier(0, 0, 1, 1) and cubic-bezier(1, 1, 1, 1) as linear timing functions, as called out by the WPT tests. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::transformedProgress const): Account for the effect-wide timing function when computing the progress. (WebCore::AnimationEffect::iterationProgress const): Use the transformed progress now that we support this procedure. * animation/AnimationEffect.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::apply): We now use the computed progress from AnimationEffect rather than compute based on the provided time, which we've dropped as an argument. (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Implement the "effect value of a keyframe effect" procedure in full as specified (save for composite operations). (WebCore::KeyframeEffect::applyAtLocalTime): Deleted. * animation/KeyframeEffect.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::resolve): * css/CSSTimingFunctionValue.h: Fix a small error made in a previous patch where we used "int" instead of "unsigned". * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::transformTime const): * platform/animation/TimingFunction.h: 2018-01-25 Antoine Quint <graouts@apple.com> [Web Animations] Avoid querying the current time multiple time when resolving the play state https://bugs.webkit.org/show_bug.cgi?id=182099 Reviewed by Dean Jackson. No test change since this shouldn't cause any change in behavior. * animation/WebAnimation.cpp: (WebCore::WebAnimation::playState const): 2018-01-25 Youenn Fablet <youenn@apple.com> Set integrity fetch options for loading scripts and CSS https://bugs.webkit.org/show_bug.cgi?id=182077 Reviewed by Chris Dumez. Covered by updated test. Set integrity fetch option in script and CSS loading. * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::load): * bindings/js/CachedScriptFetcher.cpp: (WebCore::CachedScriptFetcher::requestModuleScript const): (WebCore::CachedScriptFetcher::requestScriptWithCache const): * bindings/js/CachedScriptFetcher.h: * dom/LoadableClassicScript.cpp: (WebCore::LoadableClassicScript::load): * dom/ScriptElementCachedScriptFetcher.cpp: (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const): * dom/ScriptElementCachedScriptFetcher.h: * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): 2018-01-25 Zan Dobersek <zdobersek@igalia.com> [Cairo] Use GraphicsContextImplCairo in Nicosia::PaintingContextCairo https://bugs.webkit.org/show_bug.cgi?id=182094 Reviewed by Carlos Garcia Campos. Have Nicosia::PaintingContextCairo create a GraphicsContext object that utilizes a factory function which returns a freshly-allocated GraphicsContextImplCairo through which all the painting is then done. This moves GraphicsLayer painting over to using the GraphicsContextImpl infrastructure. No new tests -- no changes in behavior. * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::PaintingContextCairo): 2018-01-24 Frederic Wang <fwang@igalia.com> ScrollingStateNode::reconcileLayerPositionForViewportRect is only called on direct children of the root https://bugs.webkit.org/show_bug.cgi?id=179946 Reviewed by Simon Fraser. ScrollingStateNode::reconcileLayerPositionForViewportRect is currently only called on the direct children of root of the scrolling tree. Hence nodes like "position: fixed" will not update their layers after scrolling when they are deeper in the tree. This is already possible on iOS with overflow nodes and will happen with subframes when async scrolling is implemented. This commit fixes that issue by recursively calling the function ScrollingStateNode::reconcileLayerPositionForViewportRect on the scrolling tree. Test: fast/scrolling/ios/reconcile-layer-position-recursive.html * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Just call reconcileLayerPositionForViewportRect on the root node. * page/scrolling/ScrollingStateNode.cpp: (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): By default, this function now recursively calls reconcileLayerPositionForViewportRect on the children. * page/scrolling/ScrollingStateNode.h: * page/scrolling/ScrollingStateFixedNode.cpp: (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect): Call the function on children. * page/scrolling/ScrollingStateStickyNode.cpp: (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect): Ditto. 2018-01-24 Zan Dobersek <zdobersek@igalia.com> [Cairo] Use GraphicsContextImplCairo for ImageBuffer context https://bugs.webkit.org/show_bug.cgi?id=181977 Reviewed by Carlos Garcia Campos. Enhance the GraphicsContextImpl interface to the point of enabling the Cairo-based implementation to be used for GraphicsContext construction in ImageBufferCairo.cpp. In order to enable GraphicsContextImpl implementations to properly manage PlatformGraphicsContext objects, the hasPlatformContext() and platformContext() methods are added. Cairo implementation returns true in the first method, and returns pointer to the PlatformContextCairo object in the second. The DisplayList::Recorder, due to its recording nature, doesn't manage such an object, so it returns false and nullptr, respectively. GraphicsContextImpl also gains the setCTM(), getCTM(), clipBounds() and roundToDevicePixels() methods, corresponding to the GraphicsContext methods that now invoke these new methods on any existing m_impl object. GraphicsContextImplCairo implementations mimic the existing behavior in the Cairo-specific GraphicsContext methods, but DisplayList::Recorder implementations remain no-op, logging the invocation but doing nothing otherwise. drawImage() and drawTiledImage() methods on the GraphicsContextImpl interface are changed to return the ImageDrawResult value, corresponding to what's been done in the method. In DisplayList::Recorder, the methods return ImageDrawResult::DidRecord, while in GraphicsContextImplCairo the methods return the return result of Image::draw() or Image::drawTiled() call. To make the protected Image::draw() and Image::drawTiled() methods accessible, invocations of those are packed into static drawImageImpl() and drawTiledImageImpl() functions on the GraphicsContextImpl class. This makes it possible to simply declare GraphicsContextImpl class as a friend class of Image, and not every specific GraphicsContextImpl derivation. Implementations of these functions mirror behavior of the drawImage() and drawTiledImage() methods on the GraphicsContext class, when an m_impl object isn't present, constructing a scope-tied InterpolationQualityMaintainer object and invoking the relevant Image method. To make immediate use of the new GraphicsContextImplCairo functionality, the GraphicsContext construction in Cairo-specific ImageBuffer implementation now uses a factory function that returns a new GraphicsContextImplCairo object through which the given PlatformContextCairo is used for painting. No new tests -- no change in functionality. * platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::hasPlatformContext const): (WebCore::GraphicsContext::drawImage): (WebCore::GraphicsContext::drawTiledImage): * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::hasPlatformContext const): Deleted. * platform/graphics/GraphicsContextImpl.cpp: (WebCore::GraphicsContextImpl::drawImageImpl): (WebCore::GraphicsContextImpl::drawTiledImageImpl): * platform/graphics/GraphicsContextImpl.h: * platform/graphics/Image.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::getCTM const): (WebCore::GraphicsContext::platformContext const): (WebCore::GraphicsContext::clipBounds const): (WebCore::GraphicsContext::roundToDevicePixels): (WebCore::GraphicsContext::setCTM): * platform/graphics/cairo/GraphicsContextImplCairo.cpp: (WebCore::m_private): (WebCore::GraphicsContextImplCairo::~GraphicsContextImplCairo): (WebCore::GraphicsContextImplCairo::hasPlatformContext const): (WebCore::GraphicsContextImplCairo::platformContext const): (WebCore::GraphicsContextImplCairo::updateState): (WebCore::GraphicsContextImplCairo::setLineCap): (WebCore::GraphicsContextImplCairo::setLineDash): (WebCore::GraphicsContextImplCairo::setLineJoin): (WebCore::GraphicsContextImplCairo::setMiterLimit): (WebCore::GraphicsContextImplCairo::fillRect): (WebCore::GraphicsContextImplCairo::fillRoundedRect): (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole): (WebCore::GraphicsContextImplCairo::fillPath): (WebCore::GraphicsContextImplCairo::fillEllipse): (WebCore::GraphicsContextImplCairo::strokeRect): (WebCore::GraphicsContextImplCairo::strokePath): (WebCore::GraphicsContextImplCairo::strokeEllipse): (WebCore::GraphicsContextImplCairo::clearRect): (WebCore::GraphicsContextImplCairo::drawGlyphs): (WebCore::GraphicsContextImplCairo::drawImage): (WebCore::GraphicsContextImplCairo::drawTiledImage): (WebCore::GraphicsContextImplCairo::drawNativeImage): (WebCore::GraphicsContextImplCairo::drawPattern): (WebCore::GraphicsContextImplCairo::drawRect): (WebCore::GraphicsContextImplCairo::drawLine): (WebCore::GraphicsContextImplCairo::drawLinesForText): (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker): (WebCore::GraphicsContextImplCairo::drawEllipse): (WebCore::GraphicsContextImplCairo::drawFocusRing): (WebCore::GraphicsContextImplCairo::save): (WebCore::GraphicsContextImplCairo::restore): (WebCore::GraphicsContextImplCairo::translate): (WebCore::GraphicsContextImplCairo::rotate): (WebCore::GraphicsContextImplCairo::scale): (WebCore::GraphicsContextImplCairo::concatCTM): (WebCore::GraphicsContextImplCairo::setCTM): (WebCore::GraphicsContextImplCairo::getCTM): (WebCore::GraphicsContextImplCairo::beginTransparencyLayer): (WebCore::GraphicsContextImplCairo::endTransparencyLayer): (WebCore::GraphicsContextImplCairo::clip): (WebCore::GraphicsContextImplCairo::clipOut): (WebCore::GraphicsContextImplCairo::clipPath): (WebCore::GraphicsContextImplCairo::clipBounds): (WebCore::GraphicsContextImplCairo::roundToDevicePixels): (WebCore::m_platformContext): Deleted. * platform/graphics/cairo/GraphicsContextImplCairo.h: * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::ImageBuffer): * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::clipBounds const): (WebCore::GraphicsContext::setCTM): (WebCore::GraphicsContext::getCTM const): (WebCore::GraphicsContext::roundToDevicePixels): * platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::drawImage): (WebCore::DisplayList::Recorder::drawTiledImage): (WebCore::DisplayList::Recorder::drawNativeImage): (WebCore::DisplayList::Recorder::setCTM): (WebCore::DisplayList::Recorder::getCTM): (WebCore::DisplayList::Recorder::clipBounds): (WebCore::DisplayList::Recorder::roundToDevicePixels): * platform/graphics/displaylists/DisplayListRecorder.h: 2018-01-24 Christopher Reid <chris.reid@sony.com> Linker error in ShareableBitmapCairo.cpp undefined reference to WebCore::Cairo::ShadowState::ShadowState https://bugs.webkit.org/show_bug.cgi?id=182060 Reviewed by Žan Doberšek. No new tests, no change in behavior. Added exports to WebCore::Cairo::ShadowState::ShadowState. * platform/graphics/cairo/CairoOperations.h: 2018-01-24 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Implement didSendData client callback. https://bugs.webkit.org/show_bug.cgi?id=182063 Reviewed by Alex Christensen. No new tests (covered by existing tests). * platform/network/curl/CurlDownload.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::willSendData): * platform/network/curl/CurlRequestClient.h: * platform/network/curl/ResourceHandleCurlDelegate.cpp: (WebCore::ResourceHandleCurlDelegate::curlDidSendData): * platform/network/curl/ResourceHandleCurlDelegate.h: 2018-01-24 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Implement PublicKeyCredential’s [[DiscoverFromExternalSource]] with a dummy authenticator https://bugs.webkit.org/show_bug.cgi?id=182032 <rdar://problem/36459922> Reviewed by Brent Fulgham. This patch implements PublicKeyCredential's [[DiscoverFromExternalSource]] from https://www.w3.org/TR/webauthn/#getAssertion as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure and a pass path. A number of dependencies need to be resolved later in order to comply with the spec, which are marked by FIXME in the patch and tracked by proper bugs. Those dependencies will be addressed once the first prototype is finshed. Tests: http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https.html http/wpt/credential-management/credentialscontainer-store-basics.https.html http/wpt/webauthn/public-key-credential-get-failure.https.html http/wpt/webauthn/public-key-credential-get-success.https.html * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): Fixes some minor issues. * Modules/webauthn/Authenticator.cpp: (WebCore::Authenticator::getAssertion const): * Modules/webauthn/Authenticator.h: (WebCore::Authenticator::AssertionReturnBundle::AssertionReturnBundle): * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredential::collectFromCredentialStore): Changed a parameter type. (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::create): Improved some comments. * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredentialRequestOptions.h: (): Deleted. * bindings/js/JSAuthenticatorResponseCustom.cpp: (WebCore::toJSNewlyCreated): 2018-01-24 Dean Jackson <dino@apple.com> Move WebGL's colorspace code into IOSurface https://bugs.webkit.org/show_bug.cgi?id=182076 <rdar://problem/36846863> Reviewed by Simon Fraser, with assistance from Tim Horton. Rather than have WebGLLayer talk directly to an IOSurfaceRef, use a helper function on WebCore::IOSurface. No behaviour change. * platform/graphics/cocoa/IOSurface.h: * platform/graphics/cocoa/IOSurface.mm: (WebCore::IOSurface::migrateColorSpaceToProperties): Add new helper. * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): The newly created IOSurfaces call the helper to set up their colorspace. 2018-01-24 Dean Jackson <dino@apple.com> Add a note about not implementing these functions without discussion. <rdar://problem/36666458> * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::clientWaitSync): (WebCore::WebGL2RenderingContext::getSyncParameter): 2018-01-24 Youenn Fablet <youenn@apple.com> Opaque being-loaded responses should clone their body https://bugs.webkit.org/show_bug.cgi?id=182056 Reviewed by Brady Eidson. Test: http/wpt/service-workers/clone-opaque-being-loaded-response.https.html When cloning a being-loaded response, make sure we create a ReadableStream. Before the patch, the readableStream was not created in that case for opaque responses. * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::readableStream): (WebCore::FetchBodyOwner::createReadableStream): * Modules/fetch/FetchBodyOwner.h: * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): 2018-01-24 Chris Dumez <cdumez@apple.com> close() operation should not be exposed inside a ServiceWorkerGlobalScope https://bugs.webkit.org/show_bug.cgi?id=182057 Reviewed by Youenn Fablet. Move close() from WorkerGlobalScope to DedicatedWorkerGlobalScope as per: - https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope This change to the specification was made to avoid exposing this deprecated features to service workers (which are new). No new tests, rebaselined existing test. * workers/DedicatedWorkerGlobalScope.idl: * workers/WorkerGlobalScope.idl: 2018-01-24 David Hyatt <hyatt@apple.com> Implement line clamp for mail. https://bugs.webkit.org/show_bug.cgi?id=180818 Reviewed by Dean Jackson. This patch implements a form of clamping that can clamp lines at both the top and the bottom, and the interior can be replaced with a DOM element (identified by id) that replaces the middle section. The implementation derives from the multicolumn classes, but ultimately the clamp should derive from the fragmentset classes instead (with most of the current multicolumn code moving into base classes). The virtualization of many of the multicolumn functions is something that would happen once we move pages/printing over to this pagination model anyway. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add the new clamp classes. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSProperties.json: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp): * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): * css/parser/CSSParserMode.h: (WebCore::CSSParserContextHash::hash): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeLinesClamp): (WebCore::CSSPropertyParser::parseSingleValue): Implement the new CSS property, webkit-lines-clamp. This is only exposed if a preference is set, so it is not exposed to the Web. * page/Settings.yaml: Add a new setting to control allowing access to the new CSS property. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::willCreateColumns const): Make sure columns are created when lines clamp is set. (WebCore::getHeightForLineCount): (WebCore::RenderBlockFlow::logicalHeightForLineCount): (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount): (WebCore::RenderBlockFlow::layoutExcludedChildren): (WebCore::RenderBlockFlow::heightForLineCount): Deleted. * rendering/RenderBlockFlow.h: Re-use the same clamping logic as the old line clamp code, but modernize it to work with writing modes and to be able to go backwards from the end of the block. * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): The line count method got renamed to have the word "logical" in it, since it now works with vertical writing. * rendering/RenderFragmentContainer.cpp: (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const): * rendering/RenderFragmentContainer.h: Since line clamp sets have variable page heights, this new method takes the offset as an argument so that it can return the appropriate page for the given offset. This method will eventually be used by printing/page sets as well, since pages can have variable heights. * rendering/RenderFragmentedFlow.cpp: (WebCore::RenderFragmentedFlow::validateFragments): (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const): (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const): * rendering/RenderFragmentedFlow.h: Support for variable page heights in a fragment set. * rendering/RenderLinesClampFlow.cpp: Added. (WebCore::RenderLinesClampFlow::RenderLinesClampFlow): (WebCore::RenderLinesClampFlow::renderName const): (WebCore::RenderLinesClampFlow::layout): (WebCore::RenderLinesClampFlow::createMultiColumnSet): (WebCore::RenderLinesClampFlow::isChildAllowedInFragmentedFlow const): (WebCore::RenderLinesClampFlow::layoutFlowExcludedObjects): * rendering/RenderLinesClampFlow.h: Added. * rendering/RenderLinesClampSet.cpp: Added. (WebCore::RenderLinesClampSet::RenderLinesClampSet): (WebCore::RenderLinesClampSet::recalculateColumnHeight): (WebCore::RenderLinesClampSet::computeLogicalHeight const): (WebCore::RenderLinesClampSet::columnCount const): (WebCore::RenderLinesClampSet::columnRectAt const): (WebCore::RenderLinesClampSet::columnIndexAtOffset const): (WebCore::RenderLinesClampSet::pageLogicalTopForOffset const): (WebCore::RenderLinesClampSet::pageLogicalHeightForOffset const): (WebCore::RenderLinesClampSet::fragmentedFlowPortionRectAt const): (WebCore::RenderLinesClampSet::fragmentedFlowPortionOverflowRect): (WebCore::RenderLinesClampSet::customBlockProgressionAdjustmentForColumn const): (WebCore::RenderLinesClampSet::renderName const): * rendering/RenderLinesClampSet.h: Added. The new classes. They subclass all the methods necessary to do multi-pass layout, and to determine the page heights of each section. * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const): (WebCore::isValidColumnSpanner): (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): (WebCore::RenderMultiColumnFlow::createMultiColumnSet): * rendering/RenderMultiColumnFlow.h: * rendering/RenderMultiColumnSet.cpp: (WebCore::RenderMultiColumnSet::collectLayerFragments): (WebCore::RenderMultiColumnSet::columnTranslationForOffset const): * rendering/RenderMultiColumnSet.h: (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const): (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const): Virtualized methods so that lines clamp can subclass and change behavior. * rendering/RenderObject.h: (WebCore::RenderObject::isRenderLinesClampFlow const): (WebCore::RenderObject::isRenderLinesClampSet const): Add new functions for type checking. * rendering/RenderRubyText.cpp: Include adjustment. * rendering/style/LineClampValue.h: (WebCore::LinesClampValue::LinesClampValue): (WebCore::LinesClampValue::isNone const): (WebCore::LinesClampValue::operator== const): (WebCore::LinesClampValue::operator!= const): (WebCore::LinesClampValue::start const): (WebCore::LinesClampValue::end const): (WebCore::LinesClampValue::center const): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::linesClamp const): (WebCore::RenderStyle::hasLinesClamp const): (WebCore::RenderStyle::setLinesClamp): (WebCore::RenderStyle::initialLinesClamp): (WebCore::RenderStyle::hasInlineColumnAxis const): * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: The front end style implementation of the new property. * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): Make sure to build the correct renderer when lines clamp is set. 2018-01-24 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Allocate CurlSSLVerifier only when it is required. https://bugs.webkit.org/show_bug.cgi?id=182061 CurlSSLVerifier was a member function of CurlRequest. This patch do lazy initialization of it only when actually it is required. Also configuration method is not required by moving those stuff to constructor of SSLVerifier which makes much safer because there's no change to change its behavior from outside. Reviewed by Alex Christensen. * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::willSetupSslCtx): (WebCore::CurlRequest::didCompleteTransfer): (WebCore::CurlRequest::finalizeTransfer): * platform/network/curl/CurlRequest.h: * platform/network/curl/CurlSSLVerifier.cpp: (WebCore::CurlSSLVerifier::CurlSSLVerifier): (WebCore::CurlSSLVerifier::setSslCtx): Deleted. * platform/network/curl/CurlSSLVerifier.h: (WebCore::CurlSSLVerifier::setCurlHandle): Deleted. (WebCore::CurlSSLVerifier::setHostName): Deleted. 2018-01-24 Antti Koivisto <antti@apple.com> Assertion failure in RenderMultiColumnSet::requiresBalancing() on fast/multicol/spanner-crash-when-adding-summary.html https://bugs.webkit.org/show_bug.cgi?id=179308 <rdar://problem/34592771> Reviewed by Zalan Bujtas. The issue here is that we fail to tear down render tree for a summary element because adding another summary element takes it out of the composed tree. This leaves behind renderers that break some multicolumn assumptions. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren): When tearing down renderers go through the real children of the shadow hosts at the end and see if we left any renderers behind. If so, tear them down too. * rendering/updating/RenderTreeUpdater.h: 2018-01-24 Daniel Bates <dabates@apple.com> [CSP] Check policy for targeted windows when navigating to a JavaScript URL https://bugs.webkit.org/show_bug.cgi?id=182018 <rdar://problem/36795781> Reviewed by Brent Fulgham. Move the CSP check to be earlier in the function. Test: http/tests/security/contentSecurityPolicy/window-open-javascript-url-with-target-blocked.html * loader/FrameLoader.cpp: (WebCore::createWindow): 2018-01-24 Chris Dumez <cdumez@apple.com> Add a IPC::SendSyncOption indicating we should not process incoming IPC while waiting for the sync reply https://bugs.webkit.org/show_bug.cgi?id=182021 <rdar://problem/21629943> Reviewed by Ryosuke Niwa. Add layout testing infrastructure for the new flag. Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html * page/ChromeClient.h: * testing/Internals.cpp: (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply): * testing/Internals.h: * testing/Internals.idl: 2018-01-24 Alex Christensen <achristensen@webkit.org> Remove pre-Sierra-OS-specific code in WebCore https://bugs.webkit.org/show_bug.cgi?id=182026 Reviewed by Tim Horton. * page/cocoa/UserAgent.mm: (WebCore::systemMarketingVersionForUserAgentString): * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm: (WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange): * platform/cocoa/PasteboardCocoa.mm: (WebCore::bitmapPNGFileType): * platform/graphics/FontPlatformData.cpp: * platform/graphics/FontPlatformData.h: * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm: (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (layerContentsFormat): (PlatformCALayerCocoa::updateContentsFormat): (PlatformCALayerCocoa::backingStoreBytesPerPixel const): * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::linearRGBColorSpaceRef): (WebCore::extendedSRGBColorSpaceRef): * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::drawPDFPage): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::getCSSAttribute): (WebCore::capabilitiesForFontDescriptor): (WebCore::findClosestFont): (WebCore::platformFontLookupWithFamily): (WebCore::lookupFallbackFont): (WebCore::fontWeightFromCoreText): Deleted. * platform/graphics/cocoa/FontCocoa.mm: (WebCore::Font::variantCapsSupportsCharacterForSynthesis const): (WebCore::Font::platformWidthForGlyph const): (WebCore::advanceForColorBitmapFont): Deleted. (WebCore::canUseFastGlyphAdvanceGetter): Deleted. * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore::FontPlatformData::FontPlatformData): (WebCore::FontPlatformData::hash const): (WebCore::FontPlatformData::platformIsEqual const): (WebCore::FontPlatformData::ctFont const): * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::linearRGBColorSpaceRef): Deleted. * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::setTimebase): * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::supportsFormat): * platform/mac/PlatformScreenMac.mm: (WebCore::screenSupportsExtendedColor): * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::didCreateScrollerImp): (WebCore::ScrollbarThemeMac::isLayoutDirectionRTL): * platform/mac/ThemeMac.mm: (WebCore::ThemeMac::userPrefersReducedMotion const): * platform/network/cocoa/ResourceRequestCocoa.mm: (WebCore::ResourceRequest::doUpdatePlatformRequest): * platform/text/mac/TextBoundaries.mm: (WebCore::findNextWordFromIndex): * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::shouldPlaceBlockDirectionScrollbarOnLeft const): * testing/Internals.mm: (WebCore::Internals::userPrefersReducedMotion const): 2018-01-24 Alex Christensen <achristensen@webkit.org> Remove WebProcess authentication code https://bugs.webkit.org/show_bug.cgi?id=182020 Reviewed by Brady Eidson. We were keeping it around for pre-NetworkSession media loading, which is gone now. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge): Deleted. * html/HTMLMediaElement.h: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveAuthenticationChallenge): * loader/ResourceLoader.h: * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge): Deleted. * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerShouldWaitForResponseToAuthenticationChallenge): Deleted. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForResponseToAuthenticationChallenge:]): (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge): Deleted. 2018-01-24 Joanmarie Diggs <jdiggs@igalia.com> AX: SVG AAM mapping trumps ARIA role attribute in the case of SVG root https://bugs.webkit.org/show_bug.cgi?id=181994 Reviewed by Chris Fleizach. Only return AccessibilityRole::Group if we have no author-provided ARIA role attribute value. Test: accessibility/svg-element-with-aria-role.html * accessibility/AccessibilitySVGRoot.cpp: (WebCore::AccessibilitySVGRoot::roleValue const): * accessibility/AccessibilitySVGRoot.h: 2018-01-24 Alex Christensen <achristensen@webkit.org> Remove unused QTKit preference https://bugs.webkit.org/show_bug.cgi?id=181968 Reviewed by Alexey Proskuryakov. They weren't used and didn't do anything. * page/DeprecatedGlobalSettings.cpp: (WebCore::DeprecatedGlobalSettings::setQTKitEnabled): Deleted. * page/DeprecatedGlobalSettings.h: (WebCore::DeprecatedGlobalSettings::isQTKitEnabled): Deleted. 2018-01-24 Antoine Quint <graouts@apple.com> [Web Animations] Compute the progress and currentIteration properties on getComputedTiming() https://bugs.webkit.org/show_bug.cgi?id=182039 <rdar://problem/36813568> Reviewed by Dean Jackson. Compute the "progress" and "currentIteration" properties on the dictionary returned by getComputedTiming(). To support this we implement several procedures from the specification implemented separately with links and steps copied from the specification. There is one last procedure we don't implement, which is to obtain the transformed time following the application of the provided easing, which will be the next patch. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::directedProgress const): (WebCore::AnimationEffect::iterationProgress const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: 2018-01-24 Daniel Bates <dabates@apple.com> REGRESSION (r226138): Selecting a line that ends with zero-width joiner (ZWJ) may cause text transformation https://bugs.webkit.org/show_bug.cgi?id=181993 <rdar://problem/36421080> Reviewed by David Hyatt. Re-implement paint optimization that was inadvertently removed in r226138. This optimization works around an issue where selecting the last printable character in a line that is followed followed by a zero-width joiner transforms the selected character. We need to fix <https://bugs.webkit.org/show_bug.cgi?id=181964> to improve the interaction of selection and zero-width joiner characters. For now, re-implement a paint optimization to perform a single paint operation when the style of the non-selected text is identical to the style of the selected text. Test: fast/text/mac/select-character-before-zero-width-joiner.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::MarkerSubrangeStyle::areBackgroundMarkerSubrangeStylesEqual): (WebCore::InlineTextBox::MarkerSubrangeStyle::areForegroundMarkerSubrangeStylesEqual): (WebCore::InlineTextBox::MarkerSubrangeStyle::areDecorationMarkerSubrangeStylesEqual): Add helper functions to determine when marker styles are identical. We make use of these equality functions to coalesce adjacent subranges that have the same visual style and hence reduce the number of drawing commands to paint all the subranges in a line. (WebCore::InlineTextBox::paint): Coalesce subranges before painting. (WebCore::InlineTextBox::subdivideAndResolveStyle): Split out the logic to coalesce subranges with the same style into its own function InlineTextBox::coalesceAdjacentSubranges() and kept this function focused on subdivision and style resolution. Manually compute the frontmost subranges so that we can resolve style for each subrange with respect to the correct base style. Formerly we always resolved style with respect the specified base style. Now we resolve style with respect the previous frontmost subrange to ensure styles cascade as expected. This change causes no visual difference now. Once we implement <https://bugs.webkit.org/show_bug.cgi?id=175784> we will be able to test this change with respect to selection of ::spelling-error/::grammar-error pseudo elements. (WebCore::InlineTextBox::coalesceAdjacentSubranges): Extracted logic from InlineTextBox::subdivideAndResolveStyle(). (WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const): Deleted. (WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const): Deleted. Comparing MarkerSubrangeStyle objects should be performed using the appropriate are*MarkerSubrangeStylesEqual() non-member function. * rendering/InlineTextBox.h: * rendering/MarkerSubrange.cpp: (WebCore::subdivide): Remove overlap strategy FrontmostWithLongestEffectiveRange as this strategy is now implemented by InlineTextBox::subdivideAndResolveStyle() and InlineTextBox::coalesceAdjacentSubranges() that compute the set of frontmost subranges and coalesces adjacent subranges with the same style into the longest effective subrange, respectively. Unlike WebCore::subdivide(), InlineTextBox knows what the base style should be for the subranges and can more aggressively coalesce adjacent subranges of different types that have the same visual style. * rendering/MarkerSubrange.h: 2018-01-24 Youenn Fablet <youenn@apple.com> Fetch response should copy its url from the request if null https://bugs.webkit.org/show_bug.cgi?id=182048 Reviewed by Chris Dumez. No change of behavior. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): Add assertion to check that the response URL is not null. 2018-01-24 Youenn Fablet <youenn@apple.com> Account for memory cache in DocumentThreadableLoader::didReceiveResponse assertion https://bugs.webkit.org/show_bug.cgi?id=182049 Reviewed by Chris Dumez. No change of behavior. A response served from Service Worker may be cached in Memory Cache and reused later on. Update DTL assertion to handle that case. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::didReceiveResponse): 2018-01-24 Eric Carlson <eric.carlson@apple.com> REGRESSION(r227457): Release assert in updateLayout while destructing a media element https://bugs.webkit.org/show_bug.cgi?id=182038 <rdar://problem/36812083> Reviewed by Jer Noble. * html/MediaElementSession.cpp: (WebCore::isMainContentForPurposesOfAutoplay): Early return if element.isSuspended(). * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::clientCharacteristicsChanged): Call scheduleUpdateNowPlayingInfo instead of updateNowPlayingInfo. 2018-01-24 Chris Fleizach <cfleizach@apple.com> AX: Provide a way for VoiceOver to uniquely identify a web session https://bugs.webkit.org/show_bug.cgi?id=181894 Reviewed by Joanmarie Diggs. Add a way for VoiceOver to uniquely track a web page session. Test: accessibility/mac/session-id.html * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 2018-01-24 Antti Koivisto <antti@apple.com> RenderBlockRareData::m_enclosingFragmentedFlow should be WeakPtr https://bugs.webkit.org/show_bug.cgi?id=182045 <rdar://problem/36334787> Reviewed by Zalan Bujtas. For safety. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::cachedEnclosingFragmentedFlow const): (WebCore::RenderBlock::updateCachedEnclosingFragmentedFlow const): (WebCore::RenderBlock::locateEnclosingFragmentedFlow const): 2018-01-23 Dean Jackson <dino@apple.com> REGRESSION (r222961?): sRGB images shown in WebGL are over-saturated on a wide gamut monitor https://bugs.webkit.org/show_bug.cgi?id=182033 <rdar://problem/36377780> Reviewed by Antoine Quint. My fix for YouTube360 changed the way we composite WebGL on macOS. Unfortunately it dropped a flag telling the compositor the colorspace of the content should be sRGB. Reinstate this by explicitly setting the colorspace on the IOSurface we use for WebGL back buffers. This *should* be covered by the test in: fast/canvas/webgl/match-page-color-space.html ... however, it shows a problem with our testing infrastructure. As long as it is not testing on a Wide Gamut display, and explicitly setting the color profile, an automated test won't pick up this regression. I could add an Internals helper to query the colorspace of the WebGL content, but that doesn't actually verify the composited result, which is all that matters. * platform/graphics/cocoa/WebGLLayer.mm: (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): 2018-01-24 Ms2ger <Ms2ger@igalia.com> [GTK] Fix some test failures in ATK selection handling. https://bugs.webkit.org/show_bug.cgi?id=168369 <rdar://problem/30534881> Reviewed by Joanmarie Diggs. In r208479, selectionBelongsToObject was changed to return false if the intersectsNode call returns an exception. In particular, this caused accessibility/gtk/text-at-offset-textarea.html to fail. In this test, the selection is situated in the shadow DOM of the textarea, while the node that is checked for intersection is the textarea itself. In line with the standard, intersectsNode returns an exception in this case. This caused webkitAccessibleText{Word, Line, Sentence}ForBoundary to stop returning the expected text in the tested case. Removing this check fixes the test, along with some others. Tests: accessibility/gtk/text-at-offset-textarea.html accessibility/gtk/text-at-offset-textinput.html accessibility/selected-text-range-aria-elements.html accessibility/textarea-selected-text-range.html * accessibility/atk/WebKitAccessibleInterfaceText.cpp: (getSelectionOffsetsForObject): Remove the selectionBelongsToObject() call. 2018-01-18 Sergio Villar Senin <svillar@igalia.com> [WebVR] Add OpenVR to the tree and to the build https://bugs.webkit.org/show_bug.cgi?id=177298 Reviewed by Žan Doberšek. Added build dependencies with the OpenVR library. * CMakeLists.txt: 2018-01-23 Wenson Hsieh <wenson_hsieh@apple.com> Harden against layout passes triggered when iterating through HTMLFormElement::associatedElements https://bugs.webkit.org/show_bug.cgi?id=182037 <rdar://problem/36747812> Reviewed by Ryosuke Niwa. Observe that HTMLFormElement::associatedElements returns a const reference to a Vector of raw FormAssociatedElement pointers. In various call sites that iterate through these associated elements using this function, some require synchronous layout updates per iteration, which can lead to a bad time when combined with the first observation. To address this, we introduce HTMLFormElement::copyAssociatedElementsVector. This returns a new vector containing strong Refs to each associated element. From each call site that may trigger synchronous layout and execute arbitrary script while iterating over associated form elements, we instead use iterate over protected FormAssociatedElements. From each call site that currently doesn't (and shouldn't) require a layout update, we use the old version that returns a list of raw FormAssociatedElement pointers, but add ScriptDisallowedScopes to ensure that we never execute script there in the future. Test: fast/forms/form-data-associated-element-iteration.html * html/DOMFormData.cpp: (WebCore::DOMFormData::DOMFormData): Change to use copyAssociatedElementsVector(). * html/FormController.cpp: (WebCore::recordFormStructure): (WebCore::FormController::restoreControlStateIn): Change to use copyAssociatedElementsVector(). * html/HTMLFieldSetElement.cpp: (WebCore::HTMLFieldSetElement::copyAssociatedElementsVector const): (WebCore:: const): (WebCore::HTMLFieldSetElement::length const): Refactor to use unsafeAssociatedElements(). * html/HTMLFieldSetElement.h: * html/HTMLFormControlsCollection.cpp: (WebCore:: const): (WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const): (WebCore::HTMLFormControlsCollection::customElementAfter const): (WebCore::HTMLFormControlsCollection::updateNamedElementCache const): Refactor these to use unsafeAssociatedElements(). * html/HTMLFormControlsCollection.h: * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::unsafeAssociatedElements const): (WebCore::HTMLFormElement::copyAssociatedElementsVector const): * html/HTMLFormElement.h: * loader/FormSubmission.cpp: (WebCore::FormSubmission::create): Refactor to use copyAssociatedElementsVector(). 2018-01-23 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Fix wrong redirection with relative url when it happens from different host than original host. https://bugs.webkit.org/show_bug.cgi?id=181873 Reviewed by Alex Christensen. * platform/network/curl/CurlDownload.cpp: (WebCore::CurlDownload::willSendRequest): * platform/network/curl/ResourceHandleCurlDelegate.cpp: (WebCore::ResourceHandleCurlDelegate::willSendRequest): 2018-01-23 Eric Carlson <eric.carlson@apple.com> Resign NowPlaying status when no media element is eligible https://bugs.webkit.org/show_bug.cgi?id=181914 <rdar://problem/35294116> Reviewed by Jer Noble. Updated API test. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged so NowPlaying status will be updated. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::playbackPermitted const): Return early when the media element has been suspended. (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried for NowPlaying status in an inactive document or when element has been suspended. (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update style because HitTest can force a layout. (WebCore::MediaElementSession::updateIsMainContent const): Ditto. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all ports. * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const): * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication whenever status changes. (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented in the base class. 2018-01-23 Alex Christensen <achristensen@webkit.org> Use CompletionHandlers for ResourceHandleClient::didReceiveResponseAsync https://bugs.webkit.org/show_bug.cgi?id=181961 Reviewed by Michael Catanzaro. No change in behavior. * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponseAsync): * loader/ResourceLoader.h: * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didReceiveResponseAsync): * loader/appcache/ApplicationCacheGroup.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::notifyResponseOnSuccess): (WebCore::BlobResourceHandle::notifyResponseOnError): (WebCore::BlobResourceHandle::continueDidReceiveResponse): Deleted. * platform/network/BlobResourceHandle.h: * platform/network/PingHandle.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.h: * platform/network/SynchronousLoaderClient.cpp: (WebCore::SynchronousLoaderClient::didReceiveResponseAsync): * platform/network/SynchronousLoaderClient.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse): Deleted. * platform/network/curl/ResourceHandleCurlDelegate.cpp: (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse): (WebCore::ResourceHandleCurlDelegate::handleDataURL): (WebCore::ResourceHandleCurlDelegate::continueDidReceiveResponse): Deleted. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::continueDidReceiveResponse): Deleted. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate continueDidReceiveResponse]): Deleted. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::nextMultipartResponsePartCallback): (WebCore::sendRequestCallback): (WebCore::ResourceHandle::continueDidReceiveResponse): Deleted. 2018-01-23 Chris Dumez <cdumez@apple.com> Unreviewed, rollout r227216 as it seems to be causing deadlocks https://bugs.webkit.org/show_bug.cgi?id=182013 * page/ChromeClient.h: * testing/Internals.cpp: (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply): Deleted. * testing/Internals.h: * testing/Internals.idl: 2018-01-23 Ali Juma <ajuma@chromium.org> REGRESSION (r226622): ASSERTION FAILED: !m_frame in WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame() https://bugs.webkit.org/show_bug.cgi?id=181756 Reviewed by Simon Fraser. Don't create a VisualViewport for a suspended DOMWindow. When a DOMWindow is suspended for document suspension, all DOMWindowProperties are disconnected from their frame. Creating a new VisualViewport while in this state means unexpectedly having a DOMWindowProperty that's connected to a frame, and this leads to an assertion failure. Test: http/tests/navigation/https-in-page-cache.html * page/DOMWindow.cpp: (WebCore::DOMWindow::visualViewport const): Don't create a VisualViewport while suspended. * page/FrameView.cpp: (WebCore::FrameView::updateLayoutViewport): Handle null DOMWindow::visualViewport. 2018-01-23 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] CurlRequest must protect its client from disposal while it's on duty. https://bugs.webkit.org/show_bug.cgi?id=181875 Reviewed by Alex Christensen. No new tests. It's covered by existing tests. * platform/network/curl/CurlDownload.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::callClient): (WebCore::CurlRequest::didReceiveData): (WebCore::CurlRequest::didReceiveDataFromMultipart): (WebCore::CurlRequest::didCompleteTransfer): (WebCore::CurlRequest::invokeDidReceiveResponse): * platform/network/curl/CurlRequest.h: * platform/network/curl/CurlRequestClient.h: * platform/network/curl/ResourceHandleCurlDelegate.h: 2018-01-23 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r227437. https://bugs.webkit.org/show_bug.cgi?id=182011 broke build (Requested by alexchristensen on #webkit). Reverted changeset: "Remove unused QTKit preference" https://bugs.webkit.org/show_bug.cgi?id=181968 https://trac.webkit.org/changeset/227437 2018-01-23 Antoine Quint <graouts@apple.com> [Web Animations] Expose getKeyframes() and parsing of remaining keyframe properties https://bugs.webkit.org/show_bug.cgi?id=181978 Not reviewed. Fix failures for http/wpt/web-animations/interfaces/AnimationEffectTiming/easing.html introduced in the previous patch. Those keyword values are not expected. * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::cssText const): 2018-01-23 Simon Fraser <simon.fraser@apple.com> feMorphology stops applying if either x or y radius is 0 but should not. https://bugs.webkit.org/show_bug.cgi?id=181903 Reviewed by Dean Jackson. feMorphology should allow the radius on one axis to be zero but still apply the effect (it's akin to a blur on just one axis). Also, any negative radius, or zero on both axes should act like a pass-through, rather than outputting transparent blank (this is a spec change from SVG 1.1 to SVG 2). Tests: svg/filters/feMorphology-zero-radius-one-axis-expected.svg svg/filters/feMorphology-zero-radius-one-axis.svg * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::platformApplyDegenerate): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::createImageBufferResult): 2018-01-23 Alex Christensen <achristensen@webkit.org> Remove unused MediaPlayerSupportsTypeClient https://bugs.webkit.org/show_bug.cgi?id=182003 Reviewed by Sam Weinig. This was used for a QTKit-specific hack I removed in r227372. * Modules/encryptedmedia/CDM.cpp: (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType): * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::isTypeSupported): * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createDocument): (WebCore::DOMImplementationSupportsTypeClient::DOMImplementationSupportsTypeClient): Deleted. (): Deleted. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): (WebCore::HTMLMediaElement::selectNextSourceChild): (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks const): Deleted. (WebCore::HTMLMediaElement::mediaPlayerDocumentHost const): Deleted. * html/HTMLMediaElement.h: * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::supportsType): * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerNeedsSiteSpecificHacks const): Deleted. (WebCore::MediaPlayerSupportsTypeClient::mediaPlayerDocumentHost const): Deleted. 2018-01-23 Alex Christensen <achristensen@webkit.org> Remove unused QTKit preference https://bugs.webkit.org/show_bug.cgi?id=181968 Reviewed by Alexey Proskuryakov. They weren't used and didn't do anything. * page/DeprecatedGlobalSettings.cpp: (WebCore::DeprecatedGlobalSettings::setQTKitEnabled): Deleted. * page/DeprecatedGlobalSettings.h: (WebCore::DeprecatedGlobalSettings::isQTKitEnabled): Deleted. 2018-01-23 Javier Fernandez <jfernandez@igalia.com> [css-align] 'left' and 'right' should parse as invalid in block/cross-axis alignment https://bugs.webkit.org/show_bug.cgi?id=181792 Reviewed by Antti Koivisto. The CSS WG resolved to remove the 'left' and 'right' values from the block/cross axis alignment properties. https://github.com/w3c/csswg-drafts/issues/1403 This patch changes the CSS parsing logic of all the CSS Box Alignment properties, both block-axis (align-{self, items, content} and inline-axis (justify-{self, items, content}). Additionally, the alignment shorthands (place-{self, items, content}) have been also changed to respect the new syntax. Despite the number of layout tests changed, I don't think this change will break any content in current sites. The CSS values 'left' and 'right' were introduced by the new CSS Box Alignment spec and only implemented by the CSS Grid Layout feature, shipped last year. Additionally, the removed values have no effect on the layout result when they are applied to the block/cross-axis CSS Alignment properties. Tests: imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-001.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-002.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-003.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-004.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-align-content-005.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-001.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-002.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-003.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-004.html imported/w3c/web-platform-tests/css/css-align/content-distribution/parse-justify-content-005.html imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-001.html imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-002.html imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-003.html imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-004.html imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-005.html imported/w3c/web-platform-tests/css/css-align/content-distribution/place-content-shorthand-006.html imported/w3c/web-platform-tests/css/css-align/default-alignment/justify-items-legacy-001.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-001.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-002.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-003.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-004.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-align-items-005.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-001.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-002.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-003.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-004.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-005.html imported/w3c/web-platform-tests/css/css-align/default-alignment/parse-justify-items-006.html imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-001.html imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-002.html imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-003.html imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-004.html imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-005.html imported/w3c/web-platform-tests/css/css-align/default-alignment/place-items-shorthand-006.html imported/w3c/web-platform-tests/css/css-align/distribution-values/space-evenly-001.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-001.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-002.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-003.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-004.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-align-self-005.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-001.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-002.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-003.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-004.html imported/w3c/web-platform-tests/css/css-align/self-alignment/parse-justify-self-005.html imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-001.html imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-002.html imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-003.html imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-004.html imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-005.html imported/w3c/web-platform-tests/css/css-align/self-alignment/place-self-shorthand-006.html * css/parser/CSSPropertyParser.cpp: (WebCore::isLeftOrRightKeyword): (WebCore::isContentPositionKeyword): (WebCore::isContentPositionOrLeftOrRightKeyword): (WebCore::consumeContentDistributionOverflowPosition): (WebCore::isSelfPositionKeyword): (WebCore::isSelfPositionOrLeftOrRightKeyword): (WebCore::consumeSelfPositionOverflowPosition): (WebCore::consumeAlignItems): (WebCore::consumeJustifyItems): (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::consumeSimplifiedContentPosition): (WebCore::CSSPropertyParser::consumePlaceContentShorthand): (WebCore::consumeSimplifiedItemPosition): (WebCore::CSSPropertyParser::consumePlaceItemsShorthand): (WebCore::CSSPropertyParser::consumePlaceSelfShorthand): 2018-01-23 Simon Fraser <simon.fraser@apple.com> Element with position:fixed stops scrolling at the bottom of the page, but is painted in the right place on Chacos.com. https://bugs.webkit.org/show_bug.cgi?id=181741 rdar://problem/36593581 Reviewed by Tim Horton. The #ifdef for iOS was wrong; on iOS, visibleSize() is in content coordinates and matches unscaledDocumentRect, so there's no need to scale it. Doing so computed the wrong unscaledMaximumScrollPosition which broke hit-testing when the document minimum scale was > 1. Test: fast/visual-viewport/ios/min-scale-greater-than-one.html * page/FrameView.cpp: (WebCore::FrameView::unscaledMaximumScrollPosition const): 2018-01-23 Antoine Quint <graouts@apple.com> [Web Animations] Expose getKeyframes() and parsing of remaining keyframe properties https://bugs.webkit.org/show_bug.cgi?id=181978 <rdar://problem/36772586> Reviewed by Dean Jackson. We finish our implementation of multiple keyframes by exposing the getKeyframes() method on KeyframeEffect and parsing the remaining properties that can be exposed on keyframes: "easing" and "composite". And since we parse those properties on keyframes, we also parse "easing" on AnimationEffectTiming and "composite" and "iterationComposite" on KeyframeEffect. To support this, we implement a new TimingFunction::createFromCSSText() method which takes in a string that is a value provided directly via the JS API. As its converse, we expose a TimingFunction::cssText() method which provides a string that can be sent back to JS to represent a timing function, using keywords when the timing function matches one and ommitting default values. We now also keep track of the original "offset" value provided through the JS API since that value is required when calling getKeyframes() and distinct from the "computedOffset". These original offsets, composite operations and timing functions are kept as separate Vectors from the KeyframeList since this type does not support exposing those. We may consider improving that in a future patch. Finally, we make some adjustments in the keyframe parsing to comply with the specification and correctly parse all provided timing functions, regardless of the number of keyframes and timing functions provided. Note that this patch is only about parsing, storing and returning provided easing and composite operations but that such values will only be used for the resolution of animation effects in future patches. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getComputedTiming): Set the "easing" property on the getComputedTiming() return value now that we expose "easing" on AnimationEffectTiming. * animation/AnimationEffectTiming.cpp: (WebCore::AnimationEffectTiming::AnimationEffectTiming): Create a linear TimingFunction by default. (WebCore::AnimationEffectTiming::setEasing): Parse the "easing" value and propagate an exception for invalid values. * animation/AnimationEffectTiming.h: Expose the new "easing" property and backing TimingFunction. * animation/AnimationEffectTiming.idl: Expose the new "easing" property. * animation/KeyframeEffect.cpp: (WebCore::CSSPropertyIDToIDLAttributeName): Provide a way to convert the name of a CSS property to a string that can be used to generate a JS property name for use by getKeyframes(). (WebCore::computeMissingKeyframeOffsets): Implement the full steps of the spec. (WebCore::processIterableKeyframes): Fix a problematic declaration for the easing variable. (WebCore::processPropertyIndexedKeyframes): Now that ProcessedKeyframe has both an offset and a computedOffset, use computed offsets. We also fix a couple of loops to fix compliance issues revealed by WPT tests. (WebCore::KeyframeEffect::create): Parse the provided "easing" property on the KeyframeEffectOptions object. (WebCore::KeyframeEffect::getKeyframes): Implement the getKeyframes() method as mandated by the spec. (WebCore::KeyframeEffect::processKeyframes): Keep a list of unused easings so these might be parsed as well, and potentially throw exceptions, as mandated by the spec. For valid easings, store their matching TimingFunction in m_timingFunctions, original offset values in m_offsets and CompositeOperation values in m_compositeOperations. * animation/KeyframeEffect.h: Switch the order in which we specify some of the Variant types so that default values are correctly used. * animation/KeyframeEffect.idl: Switch the order in which we specify some of the Variant types so that default values are correctly used. * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::createFromCSSText): (WebCore::TimingFunction::cssText const): * platform/animation/TimingFunction.h: 2018-01-23 Brady Eidson <beidson@apple.com> Allow passing MessagePorts across processes (e.g. ServiceWorkers). https://bugs.webkit.org/show_bug.cgi?id=181178 Reviewed by Andy Estes. Test: http/tests/workers/service/basic-messageport.html * dom/MessagePort.cpp: (WebCore::MessagePort::MessagePort): (WebCore::MessagePort::~MessagePort): * dom/messageports/MessagePortChannel.cpp: (WebCore::MessagePortChannel::entanglePortWithProcess): * dom/messageports/MessagePortChannel.h: * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::postMessageToServiceWorkerClient): * workers/service/SWClientConnection.h: * workers/service/ServiceWorker.cpp: (WebCore::ServiceWorker::postMessage): * workers/service/ServiceWorkerClient.cpp: (WebCore::ServiceWorkerClient::postMessage): * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::postMessageToServiceWorker): * workers/service/context/SWContextManager.h: 2018-01-23 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r227279 and r227373. https://bugs.webkit.org/show_bug.cgi?id=181988 The LayoutTest crash fix introduced an API test failure. (Requested by ryanhaddad on #webkit). Reverted changesets: "Resign NowPlaying status when no media element is eligible" https://bugs.webkit.org/show_bug.cgi?id=181914 https://trac.webkit.org/changeset/227279 "Resign NowPlaying status when no media element is eligible" https://bugs.webkit.org/show_bug.cgi?id=181914 https://trac.webkit.org/changeset/227373 2018-01-23 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed, fix some format specifiers added in r227190 https://bugs.webkit.org/show_bug.cgi?id=181454 * dom/messageports/MessagePortChannel.cpp: (WebCore::MessagePortChannel::takeAllMessagesForPort): 2018-01-23 Ting-Wei Lan <lantw44@gmail.com> [GTK] Add user agent quirk for Microsoft Outlook Web App https://bugs.webkit.org/show_bug.cgi?id=181982 Reviewed by Michael Catanzaro. Microsoft Outlook Web App forces users to switch to the lite version on the login page with our standard user agent on all non-macOS systems. Since it is an application that can be installed by different companies, schools and organizations, it is not possible to fix the issue unless we keep a big list of host names that are known to run it. We check the host name instead of the base domain name here because it is not expected to run all sites under a base domain on this webmail and calendar application. https://mail.ntu.edu.tw is a site that is known to run Microsoft Outlook Web App for several years, and it is not likely to change. When there are other sites found to run it and having the same user agent problem, we can expand the list to include them. * platform/UserAgentQuirks.cpp: (WebCore::urlRequiresMacintoshPlatform): 2018-01-23 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME] Add support of multi keys from different sessions in CDMinstanceClearKey https://bugs.webkit.org/show_bug.cgi?id=180083 Reviewed by Xabier Rodriguez-Calvar. Add support of multi keys from different MediaKeySession in CDMInstanceClearKey. Currently the CDMInstanceClearKey manages two "m_keys", one is a WTF::Vector where it stores the list of last added keys, an other which is defined in the ClearKeyState::singleton it is a WTF::HashMap, in this last one, it stores the keys lists of each created session. The method "keys()" of CDMInstanceClearKey returns the first "m_keys" which contains just the list of last keys. The goal of this commit is to return all keys lists of all sessions, thus we remove the "m_keys" which is WTF::Vector and we modify the method "keys()" to return all keys lists, which is stored in "m_keys" WTF::HashMap, in one Vector instead of return just the list of last keys. * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::CDMInstanceClearKey::keys const): (WebCore::CDMInstanceClearKey::updateLicense): * platform/encryptedmedia/clearkey/CDMClearKey.h: 2018-01-22 Simon Fraser <simon.fraser@apple.com> Optimize building the non-fast scrollable region with multiple iframes https://bugs.webkit.org/show_bug.cgi?id=181971 Reviewed by Zalan Bujtas. AsyncScrollingCoordinator::frameViewLayoutUpdated() is called every time a subframe lays out. We don't need to eagerly update the non-fast scrollable region at this time; we can just mark it dirty, and rely on the existing scrolling tree commit code to recompute it. On my machine this makes fast/frames/lots-of-objects.html no longer a timeout. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): 2018-01-22 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator https://bugs.webkit.org/show_bug.cgi?id=181928 <rdar://problem/36459893> Reviewed by Brent Fulgham. This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure and a pass path. A number of dependencies need to be resolved later in order to comply with the spec. Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole process. Those limitations will then be addressed once the first prototype is finshed. Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html http/wpt/webauthn/idl.https.html http/wpt/webauthn/public-key-credential-create-failure.https.html http/wpt/webauthn/public-key-credential-create-success.https.html * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::PendingPromise::PendingPromise): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): (WebCore::CredentialsContainer::preventSilentAccess): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::Authenticator::singleton): (WebCore::Authenticator::makeCredential const): * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h. * Modules/webauthn/AuthenticatorAssertionResponse.cpp: (WebCore::AuthenticatorAssertionResponse::authenticatorData const): (WebCore::AuthenticatorAssertionResponse::signature const): (WebCore::AuthenticatorAssertionResponse::userHandle const): (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted. (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted. (WebCore::AuthenticatorAssertionResponse::signature): Deleted. (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted. * Modules/webauthn/AuthenticatorAssertionResponse.h: (WebCore::AuthenticatorAssertionResponse::create): * Modules/webauthn/AuthenticatorAttestationResponse.cpp: (WebCore::AuthenticatorAttestationResponse::attestationObject const): (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted. (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted. * Modules/webauthn/AuthenticatorAttestationResponse.h: (WebCore::AuthenticatorAttestationResponse::create): * Modules/webauthn/AuthenticatorResponse.cpp: (WebCore::AuthenticatorResponse::clientDataJSON const): (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted. (WebCore::AuthenticatorResponse::clientDataJSON): Deleted. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::create): (WebCore::PublicKeyCredential::rawId const): (WebCore::PublicKeyCredential::response const): (WebCore::PublicKeyCredential::getClientExtensionResults const): (WebCore::PublicKeyCredential::rawId): Deleted. (WebCore::PublicKeyCredential::response): Deleted. (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (): Deleted. * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBindingsAllInOne.cpp: 2018-01-22 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Support font collections https://bugs.webkit.org/show_bug.cgi?id=181826 <rdar://problem/36455137> Reviewed by Dean Jackson. Use the CoreText call CTFontManagerCreateFontDescriptorsFromData() to get all the descriptors inside the collection file. We select which one by using the fragment identifier at the end of the url linking to the remote font. For example, to select the 4th font inside a TTC file, the @font-face block would look like: @font-face { font-family: "MyFont"; src: url("path/to/font.ttc#4"); } Note that these numbers are 1-indexed. The CSS Fonts spec states: > Fragment identifiers are used to indicate which font to load. If a container format lacks a defined > fragment identifier scheme, implementations should use a simple 1-based indexing scheme (e.g. > "font-collection#1" for the first font, "font-collection#2" for the second font). Not only are TTC font collections supported, but WOFF2 font collections are also supported, which is increasingly important web standard. No new tests because I don't have a font collection file with the appropriate license for the WebKit repository. I tested manually. * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::load): * loader/cache/CachedFont.cpp: (WebCore::CachedFont::calculateIndex const): (WebCore::CachedFont::ensureCustomFontData): (WebCore::CachedFont::createCustomFontData): * loader/cache/CachedFont.h: * platform/graphics/cairo/FontCustomPlatformData.h: * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: (WebCore::createFontCustomPlatformData): * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::createFontCustomPlatformData): * platform/graphics/mac/FontCustomPlatformData.h: * platform/graphics/win/FontCustomPlatformData.cpp: (WebCore::createFontCustomPlatformData): * platform/graphics/win/FontCustomPlatformData.h: * platform/graphics/win/FontCustomPlatformDataCairo.cpp: (WebCore::createFontCustomPlatformData): 2018-01-22 Simon Fraser <simon.fraser@apple.com> REGRESSION (r227011): fast/frames/hidpi-position-iframe-on-device-pixel.html times out https://bugs.webkit.org/show_bug.cgi?id=181959 Reviewed by Zalan Bujtas. This test creates 300 iframes, which became slow after r227011 because they all became part of the non-fast scrollable region, slowing down ScrollingCoordinator::absoluteEventTrackingRegionsForFrame(). Fix by not adding non-scrollable iframes, and making FrameView::isScrollable() more efficient for frames that have not done layout yet. * page/FrameView.cpp: (WebCore::FrameView::isScrollable): (WebCore::FrameView::addChild): 2018-01-22 Dan Bernstein <mitz@apple.com> Fixed building for macOS 10.12 with the macOS 10.13 SDK after r227156. * Configurations/WebCore.xcconfig: 2018-01-22 Simon Fraser <simon.fraser@apple.com> REGRESSION (r226981): ASSERTION FAILED: startY >= 0 && endY <= height && startY < endY in WebCore::FEMorphology::platformApplyGeneric https://bugs.webkit.org/show_bug.cgi?id=181836 Reviewed by Tim Horton. All the filters that use ParallelJobs<> has the same type of bug where very wide but not tall filter regions could result in computing an optimalThreadNumber that was greater than the number of rows to process, which resulted in jobs with zero rows to process. Since we split the work by rows, cap the maximum number of threads to height/8 so that each job has at least 8 rows of pixels to process. Add some assertions to detect jobs with zero rows. FEMorphology was also using implicit float -> int conversion to detect integer overflow of radius, so change that to use explicit clamping. Tests: svg/filters/feLighting-parallel-jobs.svg svg/filters/feTurbulence-parallel-jobs-wide.svg * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::platformApplyGenericPaint): (WebCore::FELighting::platformApplyGeneric): * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::platformApplyGeneric): (WebCore::FEMorphology::platformApply): (WebCore::FEMorphology::platformApplyDegenerate): (WebCore::FEMorphology::platformApplySoftware): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::fillRegion const): (WebCore::FETurbulence::platformApplySoftware): 2018-01-22 Eric Carlson <eric.carlson@apple.com> Resign NowPlaying status when no media element is eligible https://bugs.webkit.org/show_bug.cgi?id=181914 <rdar://problem/35294116> Reviewed by Jer Noble. No new tests, these changes prevent existing tests from crashing. * html/HTMLMediaElement.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::playbackPermitted const): Return early when the media element has been suspended. (WebCore::MediaElementSession::canShowControlsManager const): Return false when the media element has been suspended. (WebCore::isMainContentForPurposesOfAutoplay): Return early if it isn't safe to update style because HitTest can force a layout. (WebCore::MediaElementSession::updateIsMainContent const): Ditto. 2018-01-22 Alex Christensen <achristensen@webkit.org> Begin removing QTKit code https://bugs.webkit.org/show_bug.cgi?id=181951 Reviewed by Jer Noble. QTKit was being used on El Capitan and before. * Configurations/WebCore.xcconfig: * SourcesMac.txt: * WebCore.xcodeproj/project.pbxproj: * platform/graphics/MediaPlayer.cpp: (WebCore::buildMediaEnginesVector): (WebCore::MediaPlayer::supportsType): * platform/graphics/mac/MediaPlayerPrivateQTKit.h: Removed. * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Removed. * platform/graphics/mac/MediaTimeQTKit.h: Removed. * platform/graphics/mac/MediaTimeQTKit.mm: Removed. * platform/mac/WebVideoFullscreenController.mm: (-[WebVideoFullscreenController setVideoElement:]): (-[WebVideoFullscreenController updatePowerAssertions]): 2018-01-22 Per Arne Vollan <pvollan@apple.com> [Win] Null pointer crash under WebCore::RenderStyle::colorIncludingFallback. https://bugs.webkit.org/show_bug.cgi?id=181801 <rdar://problem/35614900> Reviewed by Brent Fulgham. Do not paint synchronously when popup items have been added or changed while the popup is visible. If new popup items have been added after the popup was shown, a synchronous paint operation will possibly access their style before it is ready, leading to a null pointer crash. The invalidated area will be painted asynchronously. No new tests. To reproduce this crash, it is necessary to open a popup with JavaScript, add new popup items, and then end the test. Opening the popup can be done by sending a mousedown event with the eventsender. However, on Windows the mousedown event is sent synchronously, and will block as long as the popup is open and running the popup event loop. This means no JS can be executed until the popup is closed, causing the test to always time out before new popup items can be added. I have verified the fix with a manual test case. * platform/win/PopupMenuWin.cpp: (WebCore::PopupMenuWin::updateFromElement): 2018-01-22 Chris Dumez <cdumez@apple.com> RELEASE_ASSERT(registration) hit in SWServer::installContextData(const ServiceWorkerContextData&) https://bugs.webkit.org/show_bug.cgi?id=181941 <rdar://problem/36744892> Reviewed by Youenn Fablet. Make sure we clear SWServer::m_pendingContextDatas & SWServer::m_pendingJobs as needed when clearing Website data. Otherwise, we will hit assertion when those gets processed after the connection to the SW process has been established (not to mentioned we failed to clear some in-memory data even though the user asked us to). * workers/service/server/SWServer.cpp: (WebCore::SWServer::clearAll): (WebCore::SWServer::clear): 2018-01-22 Ryosuke Niwa <rniwa@webkit.org> Blob conversion and sanitization doesn't work with Microsoft Word for Mac 2011 https://bugs.webkit.org/show_bug.cgi?id=181616 <rdar://problem/36484908> Reviewed by Wenson Hsieh. The bug was caused by WebContentReader::readHTML and WebContentMarkupReader::readHTML not sanitizing plain HTML string as done for web archives even when custom pasteboard data is enabled. Fixed the bug by doing the sanitization. Unfortunately, we can't make file URLs available in this case because WebContent process doesn't have sandbox extensions to access local files referenced by the HTML source in the clipboard, and we can't make WebContent process request for a sandbox extension¸on an arbitrary local file, as it would defeat the whole point of sandboxing. Instead, we strip away all HTML attributes referencing a URL whose scheme is not HTTP, HTTPS, or data when sanitizing text/html from the clipboard to avoid exposing local file paths, which can reveal privacy & security sensitive data such as the user's full name, and the location of private containers of other applications in the system. Tests: PasteHTML.DoesNotSanitizeHTMLWhenCustomPasteboardDataIsDisabled PasteHTML.DoesNotStripFileURLsWhenCustomPasteboardDataIsDisabled PasteHTML.ExposesHTMLTypeInDataTransfer PasteHTML.KeepsHTTPURLs PasteHTML.SanitizesHTML PasteHTML.StripsFileURLs * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readHTML): Fixed the bug by sanitizing the markup, and stripping away file URLs. (WebCore::WebContentMarkupReader::readHTML): Ditto. * editing/markup.cpp: (WebCore::removeSubresourceURLAttributes): Added. (WebCore::sanitizeMarkup): Added. * editing/markup.h: 2018-01-22 Chris Dumez <cdumez@apple.com> Add release logging to help debug issues related to service workers https://bugs.webkit.org/show_bug.cgi?id=181935 <rdar://problem/36735900> Reviewed by Brady Eidson. * workers/service/ServiceWorker.cpp: (WebCore::ServiceWorker::ServiceWorker): (WebCore::ServiceWorker::scheduleTaskToUpdateState): (WebCore::ServiceWorker::postMessage): (WebCore::ServiceWorker::isAlwaysOnLoggingAllowed const): * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::removeRegistration): (WebCore::ServiceWorkerContainer::updateRegistration): (WebCore::ServiceWorkerContainer::jobFailedWithException): (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult): (WebCore::ServiceWorkerContainer::startScriptFetchForJob): (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): (WebCore::ServiceWorkerContainer::jobFailedLoadingScript): (WebCore::ServiceWorkerContainer::isAlwaysOnLoggingAllowed const): * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration): (WebCore::ServiceWorkerRegistration::updateStateFromServer): (WebCore::ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent): * workers/service/server/SWServer.cpp: (WebCore::SWServer::scriptContextFailedToStart): (WebCore::SWServer::didFinishInstall): (WebCore::SWServer::didFinishActivation): (WebCore::SWServer::terminateWorkerInternal): * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::didResolveRegistrationPromise): (WebCore::SWServerJobQueue::runRegisterJob): 2018-01-22 Youenn Fablet <youenn@apple.com> Safari Tech Preview can't use GitHub login at forums.swift.org https://bugs.webkit.org/show_bug.cgi?id=181908 <rdar://problem/36715111> Reviewed by Chris Dumez. Test: http/wpt/service-workers/navigation-redirect.https.html For subresource loads, redirections will not change who is in charge of continuing the load (service worker or network process). For navigation loads, we need to match the registration for every redirection since this is using the Manual redirect mode. This allows starting the load with a service worker and finishing the load with another service worker, which will become the controller. Implement this by wrapping the registration matching of an URL within DocumentLoader::matchRegistration. Use that method in DocumentLoader::redirectReceived. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::matchRegistration): (WebCore::doRegistrationsMatch): (WebCore::DocumentLoader::redirectReceived): (WebCore::DocumentLoader::startLoadingMainResource): * loader/DocumentLoader.h: 2018-01-22 Antti Koivisto <antti@apple.com> REGRESSION (Safari 11): Buttons inside a fieldset legend cannot be clicked on in Safari 11 https://bugs.webkit.org/show_bug.cgi?id=179666 <rdar://problem/35534292> Reviewed by Zalan Bujtas. The legend element of a fieldset is in the border area, outside the clip rect. With overflow:hidden mouse events won't reach it. Test case by Dhaya Benmessaoud. Test: fast/forms/legend-overflow-hidden-hit-test.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::nodeAtPoint): (WebCore::RenderBlock::hitTestExcludedChildrenInBorder): Add a special case to hit testing to handle legend, similarly to what is done for painting. * rendering/RenderBlock.h: 2018-01-22 Joanmarie Diggs <jdiggs@igalia.com> AX: Implement support for Graphics ARIA roles https://bugs.webkit.org/show_bug.cgi?id=181796 Reviewed by Chris Fleizach. Add mappings for the three new roles (graphics-document, graphics-object, and graphics-symbol) as per the Graphics Accessibility API Mappings spec. No new tests; instead, new test cases added to roles-computedRoleString.html and roles-exposed.html. * accessibility/AccessibilityObject.cpp: (WebCore::initializeRoleMap): (WebCore::AccessibilityObject::computedRoleString const): * accessibility/AccessibilityObject.h: * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (atkRole): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (createAccessibilityRoleMap): (-[WebAccessibilityObjectWrapper subrole]): (-[WebAccessibilityObjectWrapper roleDescription]): 2018-01-22 Antti Koivisto <antti@apple.com> REGRESSION(r224535): Can't write reviews in the App Store https://bugs.webkit.org/show_bug.cgi?id=181936 <rdar://problem/36670246> Reviewed by Zalan Bujtas. * page/LayoutContext.cpp: (WebCore::LayoutContext::updateStyleForLayout): r224535 was about media queries but it also removed a seemingly spurious call to SyleScope::didChangeStyleSheetEnvironment from the path that does not involve media queries. Turns out UITextContentView somehow depended on it, so revert this specific change. 2018-01-22 Brady Eidson <beidson@apple.com> In WebKit2, make the MessagePortChannelRegistry live in the UI process. https://bugs.webkit.org/show_bug.cgi?id=181922 Reviewed by Andy Estes. No new tests (Refactor, no behavior change) Add encoder/decoders and EXPORT a whole bunch of stuff. * WebCore.xcodeproj/project.pbxproj: * dom/MessagePort.h: * dom/messageports/MessagePortChannel.cpp: (WebCore::MessagePortChannel::processForPort): * dom/messageports/MessagePortChannel.h: * dom/messageports/MessagePortChannelProvider.h: * dom/messageports/MessagePortChannelRegistry.h: * dom/messageports/MessageWithMessagePorts.h: (WebCore::MessageWithMessagePorts::encode const): (WebCore::MessageWithMessagePorts::decode): 2018-01-22 Youenn Fablet <youenn@apple.com> Fetch Headers from an Opaque response should be filtered out https://bugs.webkit.org/show_bug.cgi?id=181926 Reviewed by Chris Dumez. Covered by updated test. Refactor to use the same FetchResponse::create for Cache API and cloning. In this method, ensure that response and headers are filtered correctly according response tainting. Make also sure that synthetic responses do not get filtered (not needed since created by JavaScript). Introduce helper routine to set the header map of a resource response. Use this routine when cloning a synthetic response as in that case, m_internalResponse has no header at all. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::updateRecords): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::clone): * Modules/fetch/FetchResponse.h: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::setHTTPHeaderFields): * platform/network/ResourceResponseBase.h: * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse): 2018-01-22 Javier Fernandez <jfernandez@igalia.com> [css-align] 'overflow' keyword must precede the self-position and content-position value https://bugs.webkit.org/show_bug.cgi?id=181793 Reviewed by Antti Koivisto. There were several discussions to avoid ambiguities with the complex values, specially when it comes to define the place-xxx shorthands. One of the sources of problems is the 'overflow-position' keyword. The CSS WG has decided to change the syntax of all the CSS Box Alignment properties so that the 'overflow-position' keyword always precede the 'self-position' or the 'content-position' keywords. https://github.com/w3c/csswg-drafts/issues/1446#event-1125715434 In order to apply this change to the Content Distribution properties' (align-content and justify-content) syntax I had to completely re-implement their parsing function. Thanks to this I addressed also the issue with the content-distribution fallback, which cannot be specified explicitly now. https://github.com/w3c/csswg-drafts/issues/1002#ref-commit-c38cac4 No new tests, just rebaselined the expected results of the test cases affected. Despite the so many layout tests affected by this change, it's unlikely that it might break any content in current web sites. This patch changes the new CSS syntax, obviously backward compatible, defined by the new CSS Box Alignment. The 'overflow-position' keyword is only used by the layout models implementing the new spec, so far only CSS Grid Layout. Considering that CSS Grid has been shipped last year, it's unlikely that many sites are using the new CSS values. * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForItemPositionWithOverflowAlignment): (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment): * css/CSSContentDistributionValue.cpp: (WebCore::CSSContentDistributionValue::customCSSText const): * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeOverflowPositionKeyword): (WebCore::consumeContentPositionKeyword): (WebCore::consumeContentDistributionOverflowPosition): (WebCore::consumeSelfPositionOverflowPosition): 2018-01-22 Chris Nardi <csnardi1@gmail.com> Parse calc() in CSS media queries https://bugs.webkit.org/show_bug.cgi?id=181716 calc() was previously unsupported inside of media queries. This change adds in support for parsing calc inside of media queries. Reviewed by Antti Koivisto. Tests: Imported web-platform-tests/css/mediaqueries * css/MediaQueryExpression.cpp: (WebCore::featureWithValidIdent): Updated function to take a CSSPrimitiveValue. (WebCore::featureWithValidDensity): Updated function to take a CSSPrimitiveValue instead of a CSSParserToken. (WebCore::featureWithValidPositiveLength): Ditto. (WebCore::featureExpectingPositiveInteger): Ditto. (WebCore::featureWithPositiveInteger): Ditto. (WebCore::featureWithPositiveNumber): Ditto. (WebCore::featureWithZeroOrOne): Ditto. (WebCore::MediaQueryExpression::MediaQueryExpression): Use CSSPropertyParserHelpers for consuming. * css/MediaQueryExpression.h: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeResolution): Added function for use in media query expression parsing. * css/parser/CSSPropertyParserHelpers.h: * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::readRestrictor): Updated functions to take a CSSParserTokenRange in order to use CSSPropertyParserHelpers. (WebCore::MediaQueryParser::readMediaNot): Ditto. (WebCore::MediaQueryParser::readMediaType): Ditto. (WebCore::MediaQueryParser::readAnd): Ditto. (WebCore::MediaQueryParser::readFeatureStart): Ditto. (WebCore::MediaQueryParser::readFeature): Ditto. (WebCore::MediaQueryParser::readFeatureColon): Ditto. (WebCore::MediaQueryParser::readFeatureValue): Ditto. (WebCore::MediaQueryParser::readFeatureEnd): Ditto. (WebCore::MediaQueryParser::skipUntilComma): Ditto. (WebCore::MediaQueryParser::skipUntilBlockEnd): Ditto. (WebCore::MediaQueryParser::processToken): Ditto. (WebCore::MediaQueryParser::parseInternal): Ditto. (WebCore::MediaQueryData::clear): Removed reference to m_valueList (WebCore::MediaQueryData::addExpression): Use CSSParserTokenRange. (WebCore::MediaQueryData::lastExpressionValid): New helper function. (WebCore::MediaQueryData::removeLastExpression): New helper function. * css/parser/MediaQueryParser.h: 2018-01-22 Zan Dobersek <zdobersek@igalia.com> [Cairo] Refactor PlatformContextCairo::drawSurfaceToContext() into a Cairo operation https://bugs.webkit.org/show_bug.cgi?id=181930 Reviewed by Carlos Garcia Campos. Move the PlatformContextCairo::drawSurfaceToContext() code into the Cairo namespace as an operation, renaming it to drawSurface(). Mirroring other operations, the PlatformContextCairo object is now passed through a reference as the first argument to the function, and cairo_t context object is retrieved from that. Call sites of the PlatformContextCairo::drawSurfaceToContext() method are adjusted to now call Cairo::drawSurface() and properly pass the PlatformContextCairo object to the function. No new tests -- no change in functionality. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::prepareForStroking): Make this static. (WebCore::Cairo::drawPatternToCairoContext): (WebCore::Cairo::drawNativeImage): (WebCore::Cairo::drawSurface): * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/PlatformContextCairo.cpp: (WebCore::drawPatternToCairoContext): Deleted. (WebCore::PlatformContextCairo::drawSurfaceToContext): Deleted. * platform/graphics/cairo/PlatformContextCairo.h: * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame): 2018-01-22 Manuel Rego Casasnovas <rego@igalia.com> [css-grid] Spanning Grid item has too much space at the bottom / is too high https://bugs.webkit.org/show_bug.cgi?id=181677 Reviewed by Javier Fernandez. In IndefiniteSizeStrategy::findUsedFlexFraction() we were not subtracting the size of the gutters when we call findFrUnitSize(). If an item spans several tracks, we cannot pass the maxContentForChild() directly, we need to subtract the gutters as they are treated as fixed size tracks in the algorithm. The spec text is pretty clear regarding this (https://drafts.csswg.org/css-grid/#algo-find-fr-size): "Let leftover space be the space to fill minus the base sizes of the non-flexible grid tracks." Gutters are treated as fixed-size tracks for the purpose of the track sizing algorithm, so we need to subtract them from the leftover space while finding the size of an "fr". Tests: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-001.html imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-find-fr-size-gutters-002.html * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithm::findFrUnitSize const): (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction const): 2018-01-21 Ryosuke Niwa <rniwa@webkit.org> Turning off custom pasteboard data doesn't actually turn it off in WK2 https://bugs.webkit.org/show_bug.cgi?id=181920 <rdar://problem/36686429> Reviewed by Wenson Hsieh. Replaced the global settings for custom pasteboard data by regular runtime enabled flags. * dom/DataTransfer.cpp: (WebCore::DataTransfer::getDataForItem const): (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const): (WebCore::DataTransfer::setDataFromItemList): (WebCore::DataTransfer::types const): (WebCore::DataTransfer::commitToPasteboard): * dom/DataTransferItemList.cpp: (WebCore::shouldExposeTypeInItemList): * editing/Editor.cpp: (WebCore::createDataTransferForClipboardEvent): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragmentAndAddResources): (WebCore::WebContentReader::readWebArchive): * page/DeprecatedGlobalSettings.cpp: (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): Deleted. * page/DeprecatedGlobalSettings.h: (WebCore::DeprecatedGlobalSettings::setCustomPasteboardDataEnabled): Deleted. (WebCore::DeprecatedGlobalSettings::customPasteboardDataEnabled): Deleted. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setCustomPasteboardDataEnabled): (WebCore::RuntimeEnabledFeatures::customPasteboardDataEnabled const): * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setCustomPasteboardDataEnabled): 2018-01-21 Wenson Hsieh <wenson_hsieh@apple.com> Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h https://bugs.webkit.org/show_bug.cgi?id=181918 Reviewed by Tim Horton. Add EXTRA_ZOOM_MODE to FeatureDefines.xconfig (off by default). No change in behavior. * Configurations/FeatureDefines.xcconfig: 2018-01-19 Ryosuke Niwa <rniwa@webkit.org> Release assertion in canExecuteScript when executing scripts during page cache restore https://bugs.webkit.org/show_bug.cgi?id=181902 Reviewed by Antti Koivisto. The crash was caused by an erroneous instantiation of ScriptDisallowedScope::InMainThread in CachedPage::restore. It can execute arbitrary scripts since CachedFrame::open can update style, layout, and evaluate media queries. This is fine because there is no way to put this page back into a page cache until the load is commited via FrameLoader::commitProvisionalLoad is invoked later which only happens after CachedPage::restore had exited. Also added a release assert to make sure this condition holds. Tests: fast/history/page-cache-execute-script-during-restore.html fast/history/page-cache-navigate-during-restore.html * history/CachedPage.cpp: (WebCore::CachedPageRestorationScope::CachedPageRestorationScope): Added. (WebCore::CachedPageRestorationScope::~CachedPageRestorationScope): Added. (WebCore::CachedPage::restore): Don't instantiate ScriptDisallowedScope::InMainThread. Set isRestoringCachedPage on the cached pate to release-assert that there won't be any attempt to put this very page back into the cache. * history/PageCache.cpp: (WebCore::canCachePage): Added a release assert to make sure the page which is in the process of being restored from the page cache is not put into the page cache. * page/Page.h: (WebCore::Page::setIsRestoringCachedPage): Added. (WebCore::Page::isRestoringCachedPage const): Added. 2018-01-21 Eric Carlson <eric.carlson@apple.com> Resign NowPlaying status when no media element is eligible https://bugs.webkit.org/show_bug.cgi?id=181914 <rdar://problem/35294116> Reviewed by Jer Noble. Updated API test. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removedFromAncestor): Call mediaSession->clientCharacteristicsChanged so NowPlaying status will be updated. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager const): Return false when being queried for NowPlaying status in an inactive document. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Implement in for all ports. * platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::registeredAsNowPlayingApplication const): * platform/audio/ios/MediaSessionManagerIOS.h: * platform/audio/mac/MediaSessionManagerMac.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Call MRMediaRemoteSetCanBeNowPlayingApplication whenever status changes. (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): Deleted, implemented in the base class. 2018-01-21 Jer Noble <jer.noble@apple.com> REGRESSION (macOS 10.13.2): imported/w3c/web-platform-tests/media-source/mediasource-* LayoutTests failing https://bugs.webkit.org/show_bug.cgi?id=181891 Reviewed by Eric Carlson. In macOS 10.13.2, CoreMedia changed the definition of CMSampleBufferGetDuration() to return the presentation duration rather than the decode duration. For media streams where those two durations are identical (or at least, closely similar), this isn't a problem. But the media file used in the WPT tests have an unusual frame cadence: decode durations go {3000, 1, 5999, 1, 5999,...} and presentation durations go {3000, 2999, 3000, 2999}. This caused one check in the "Coded Frame Processing" algorithm to begin failing, where it checks that the delta between the last sample's decode time and the new decode time is no more than 2x as far as the last sample's duration. That's not a problem as long as the "duration" is the "decode duration" and the samples are all adjacent. Once the "duration" is "presentation duration", all the assumptions in the algorithm are invalidated. In the WPT test case, the delta between decode times is 5999, and 2 * the presentation duration is 5998, causing all samples up to the next sync sample to be dropped. To work around this change in behavior, we'll adopt the same technique used by Mozilla's MSE implementation, which was done for similar reasons. Rather than track the "last frame duration", we'll record the "greatest frame duration", and use actual decode timestamps to derive this duration. The "greatest frame duration" field will be reset at the same times as "last frame duration", and will be used only in the part of the algorithm that checks for large decode timestamp gaps. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::TrackBuffer::TrackBuffer): (WebCore::SourceBuffer::resetParserState): (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): 2018-01-21 Andy Estes <aestes@apple.com> [ios] LayoutTest imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html is crashing in JSC::JSONParse https://bugs.webkit.org/show_bug.cgi?id=177832 <rdar://problem/34805315> Reviewed by Tim Horton. Test: http/tests/paymentrequest/rejects_if_not_active.https.html * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::show): Rejected promise if the document is not active. 2018-01-20 Brady Eidson <beidson@apple.com> Make garbage collection of MessagePort objects be asynchronous. https://bugs.webkit.org/show_bug.cgi?id=181910 Reviewed by Andy Estes. No new tests (Covered by existing tests, including GC-specific ones). The basic premise here is as follows: - You can *always* GC a MessagePort that is closed - You can *always* GC a MessagePort that has no onmessage handler, as incoming messages cannot possibly revive it. - You can GC a MessagePort, even if it has a message handler, as long as there are no messages in flight between it and the remote port, and as long as the remote port is "maybe eligible for GC." A MessagePort is considered "maybe eligible for GC" once hasPendingActivity is asked once. A MessagePort loses "maybe eligible for GC" status once it is used for sending or receiving a message. The changes to MessagePort.cpp implement the above with a tiny little bool-driven state machine. * dom/MessagePort.cpp: (WebCore::MessagePort::postMessage): (WebCore::MessagePort::disentangle): (WebCore::MessagePort::registerLocalActivity): (WebCore::MessagePort::start): (WebCore::MessagePort::close): (WebCore::MessagePort::contextDestroyed): (WebCore::MessagePort::dispatchMessages): (WebCore::MessagePort::hasPendingActivity const): (WebCore::MessagePort::isLocallyReachable const): (WebCore::MessagePort::addEventListener): (WebCore::MessagePort::removeEventListener): * dom/MessagePort.h: - Remove the lock and any background-thread code paths - Add ASSERT(isMainThread())s throughout * dom/messageports/MessagePortChannel.cpp: (WebCore::MessagePortChannel::MessagePortChannel): (WebCore::MessagePortChannel::includesPort): (WebCore::MessagePortChannel::entanglePortWithProcess): (WebCore::MessagePortChannel::disentanglePort): (WebCore::MessagePortChannel::closePort): (WebCore::MessagePortChannel::postMessageToRemote): (WebCore::MessagePortChannel::takeAllMessagesForPort): (WebCore::MessagePortChannel::checkRemotePortForActivity): (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const): * dom/messageports/MessagePortChannel.h: Add a callback for a MessagePortChannel to go ask the remote MessagePort object about local activity: * dom/messageports/MessagePortChannelProvider.h: * dom/messageports/MessagePortChannelProviderImpl.cpp: (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity): (WebCore::MessagePortChannelProviderImpl::checkProcessLocalPortForActivity): (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync): Deleted. * dom/messageports/MessagePortChannelProviderImpl.h: - Remove the lock and any background-thread code paths - Add ASSERT(isMainThread())s throughout * dom/messageports/MessagePortChannelRegistry.cpp: (WebCore::MessagePortChannelRegistry::messagePortChannelCreated): (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed): (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote): (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort): (WebCore::MessagePortChannelRegistry::didCloseMessagePort): (WebCore::MessagePortChannelRegistry::didPostMessageToRemote): (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort): (WebCore::MessagePortChannelRegistry::checkRemotePortForActivity): (WebCore::MessagePortChannelRegistry::existingChannelContainingPort): (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): Deleted. * dom/messageports/MessagePortChannelRegistry.h: 2018-01-20 Andy Estes <aestes@apple.com> [Apple Pay] Stop eagerly loading PassKit.framework https://bugs.webkit.org/show_bug.cgi?id=181911 <rdar://problem/36555369> Reviewed by Tim Horton. r226458 and r226123 added code that caused PassKit.framework to be eagerly loaded when initializing a WKWebView. This is costly and should only be done when Apple Pay is first used. To avoid eagerly loading PassKit, this patch does two things: 1. Instead of sending the available payment networks as part of WebPageCreationParameters, PaymentCoordinator asks for them using a syncrhonous message the first time they are needed. 2. Instead of setting the Apple Pay preference to false when PassKit can't be loaded, the following API entry points check for a missing PassKit and return false, or throw exceptions, or reject promises: - ApplePaySession.canMakePayments() - ApplePaySession.canMakePaymentsWithActiveCard() - ApplePaySession.openPaymentSetup() - ApplePaySession.begin() No new tests for (1), which causes no change in behavior. (2) was manually verified by locally moving aside PassKit.framework, but that's not possible to do in an automated test. * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::PaymentCoordinator): (WebCore::PaymentCoordinator::validatedPaymentNetwork const): (WebCore::toHashSet): Deleted. * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: * loader/EmptyClients.cpp: * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): Removed PaymentCoordinator::m_availablePaymentNetworks and made PaymentCoordinator::validatedPaymentNetwork() call PaymentCoordinatorClient::validatedPaymentNetwork() instead. * page/PageConfiguration.h: Removed availablePaymentNetworks from PageConfiguration. * testing/Internals.cpp: (WebCore::Internals::Internals): * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::validatedPaymentNetwork): * testing/MockPaymentCoordinator.h: Implemented PaymentCoordinatorClient::validatedPaymentNetwork(). 2018-01-20 Jer Noble <jer.noble@apple.com> Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout https://bugs.webkit.org/show_bug.cgi?id=181840 <rdar://problem/36186214> Reviewed by Simon Fraser. Test: media/video-fullscreen-reload-crash.html Short circuit play() or pause() operations if the document is suspended or stopped. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::playInternal): (WebCore::HTMLMediaElement::pauseInternal): 2018-01-20 Youenn Fablet <youenn@apple.com> fetch redirect is incompatible with "no-cors" mode https://bugs.webkit.org/show_bug.cgi?id=181866 <rdar://problem/35827140> Reviewed by Chris Dumez. Covered by updated tests. Return a network error when no-cors mode and redirect mode is manual or error. Update preflight implementation to no longer use manual redirect mode to simulate https://fetch.spec.whatwg.org/#http-network-or-cache-fetch. Instead implement redirectReceived callback to treat any redirect response as the preflight response. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::canRequest): * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::redirectReceived): (WebCore::CrossOriginPreflightChecker::startPreflight): * loader/CrossOriginPreflightChecker.h: 2018-01-19 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] [WK2] Drag location is computed incorrectly when dragging content from subframes https://bugs.webkit.org/show_bug.cgi?id=181896 <rdar://problem/35479043> Reviewed by Tim Horton. In r218837, I packaged most of the information needed to start a drag into DragItem, which is propagated to the client layer via the startDrag codepath. However, this introduced a bug in computing the event position and drag location in window coordinates. Consider the case where we're determining the drag image offset for a dragged element in a subframe: Before the patch, the drag location (which starts out in the subframe's content coordinates) would be converted to root view coordinates, which would then be converted to mainframe content coordinates, which would then be converted to window coordinates using the mainframe's view. After the patch, we carry out the same math until the last step, where we erroneously use the _subframe's_ view to convert to window coordinates from content coordinates. This results in the position of the iframe relative to the mainframe being accounted for twice. To fix this, we simply use the main frame's view to convert from mainframe content coordinates to window coordinates while computing the drag location. As for the event position in window coordinates, this is currently unused by any codepath in WebKit, so we can just remove it altogether. Since this bug only affects drag and drop in the macOS WebKit2 port, there's currently no way to test this. I'll be using <https://bugs.webkit.org/show_bug.cgi?id=181898> to track adding test support for drag and drop on macOS WebKit2. Manually tested dragging in both WebKit1 and WebKit2 on macOS. dragLocationInWindowCoordinates isn't used at all for iOS drag and drop. * page/DragController.cpp: (WebCore::DragController::doSystemDrag): * platform/DragItem.h: (WebCore::DragItem::encode const): (WebCore::DragItem::decode): 2018-01-19 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r227235. The test for this change consistently times out on High Sierra. Reverted changeset: "Support for preconnect Link headers" https://bugs.webkit.org/show_bug.cgi?id=181657 https://trac.webkit.org/changeset/227235 2018-01-19 Youenn Fablet <youenn@apple.com> Cache storage errors like Quota should trigger console messages https://bugs.webkit.org/show_bug.cgi?id=181879 <rdar://problem/36669048> Reviewed by Chris Dumez. Covered by rebased test. * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::retrieveRecords): (WebCore::DOMCache::batchDeleteOperation): (WebCore::DOMCache::batchPutOperation): * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::errorToException): (WebCore::DOMCacheEngine::logErrorAndConvertToException): * Modules/cache/DOMCacheEngine.h: * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::retrieveCaches): (WebCore::DOMCacheStorage::doOpen): (WebCore::DOMCacheStorage::doRemove): 2018-01-19 Youenn Fablet <youenn@apple.com> Do not go to the storage process when registering a service worker client if there is no service worker registered https://bugs.webkit.org/show_bug.cgi?id=181740 <rdar://problem/36650400> Reviewed by Chris Dumez. Register a document as service worker client only if there is an existing service worker connection. This allows not creating any connection if no service worker is registered. Add internals API to test whether a service worker connection was created or not. This is used by API tests that cover the changes. * dom/Document.cpp: (WebCore::Document::privateBrowsingStateDidChange): No need to create a service worker connection if client is not registered yet. (WebCore::Document::setServiceWorkerConnection): No need to unregister/register if service worker connection is the same. Similarly, if Document is to be destroyed or suspended, we should not register it. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::commitData): * testing/Internals.cpp: (WebCore::Internals::hasServiceWorkerConnection): * testing/Internals.h: * testing/Internals.idl: * workers/service/ServiceWorkerProvider.cpp: (WebCore::ServiceWorkerProvider::registerServiceWorkerClients): * workers/service/ServiceWorkerProvider.h: 2018-01-19 Dean Jackson <dino@apple.com> REGRESSION (r221092): Swipe actions are hard to perform in FastMail app https://bugs.webkit.org/show_bug.cgi?id=181817 <rdar://problem/35274055> Add a setting for controlling whether touch listeners are passive by default on document/window/body. Updated existing test. * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): * page/Settings.yaml: 2018-01-19 Daniel Bates <dabates@apple.com> Update frame-ancestor directive to match Content Security Policy Level 3 https://bugs.webkit.org/show_bug.cgi?id=178891 <rdar://problem/35209458> Reviewed by Alex Christensen. Derived from Blink e667cc2e501fabab3605b838e4ee0d642a9c4a59: <https://chromium.googlesource.com/chromium/src.git/+/e667cc2e501fabab3605b838e4ee0d642a9c4a59> Update frame-ancestor directive to match against the origin of the ancestor document per the Content Security Policy Level 3 spec.: <https://w3c.github.io/webappsec-csp/> (15 January 2018). Specifically this change in behavior was made to CSP 3 in <https://github.com/w3c/webappsec/issues/311>. In earlier versions of the spec, the frame-ancestor directive matched against the URL of the ancestor document. Disregarding allow-same-origin sandboxed iframes, a document with policy "frame-ancestor 'self'" will be blocked from loading in a sandboxed iframe as a result of this change. Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-allow-same-origin-sandboxed-cross-url-allow.html http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-sandboxed-cross-url-block.html * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::checkFrameAncestors): 2018-01-19 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Add timeout support to XMLHttpRequest https://bugs.webkit.org/show_bug.cgi?id=181876 Reviewed by Alex Christensen * platform/network/ResourceRequestBase.cpp: * platform/network/curl/CurlContext.cpp: (WebCore::CurlHandle::setTimeout): * platform/network/curl/CurlContext.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::setupTransfer): (WebCore::CurlRequest::didCompleteTransfer): * platform/network/curl/ResourceError.h: * platform/network/curl/ResourceErrorCurl.cpp: (WebCore::ResourceError::httpError): 2018-01-19 Yoav Weiss <yoav@yoav.ws> Support for preconnect Link headers https://bugs.webkit.org/show_bug.cgi?id=181657 Reviewed by Darin Adler. Move the preconnect functionality into its own function, and also call this function when Link headers are processed. Test: http/tests/preconnect/link-header-rel-preconnect-http.php * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded. (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here. (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded. * loader/LinkLoader.h: 2018-01-19 Joseph Pecoraro <pecoraro@apple.com> AppCache: Log a Deprecation warning to the Console when AppCache is used https://bugs.webkit.org/show_bug.cgi?id=181778 Reviewed by Alex Christensen. * html/HTMLHtmlElement.cpp: (WebCore::HTMLHtmlElement::insertedByParser): 2018-01-19 Chris Dumez <cdumez@apple.com> ASSERT(registration || isTerminating()) hit in SWServerWorker::skipWaiting() https://bugs.webkit.org/show_bug.cgi?id=181761 <rdar://problem/36594564> Reviewed by Youenn Fablet. There is a short period of time, early in the registration process where a SWServerWorker object exists for a registration but is not in the registration's installing/waiting/active slots yet. As a result, if a registration is cleared during this period (for e.g. due to the user clearing all website data), that SWServerWorker will not be terminated. We then hit assertion later on when this worker is trying to do things (like call skipWaiting). To address the issue, we now keep a reference this SWServerWorker on the registration, via a new SWServerRegistration::m_preInstallationWorker data member. When the registration is cleared, we now take care of terminating this worker. No new tests, covered by existing tests that crash flakily in debug builds. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): if the mutex is locked, then the worker thread is still starting. We spin the runloop and try to stop again later. This avoids the deadlock shown in Bug 181763 as the worker thread may need to interact with the main thread during startup. * workers/service/server/SWServer.cpp: (WebCore::SWServer::installContextData): * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptContextFailedToStart): (WebCore::SWServerJobQueue::install): * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::~SWServerRegistration): (WebCore::SWServerRegistration::setPreInstallationWorker): (WebCore::SWServerRegistration::clear): * workers/service/server/SWServerRegistration.h: (WebCore::SWServerRegistration::preInstallationWorker const): 2018-01-19 Chris Dumez <cdumez@apple.com> Service worker registrations restored from disk may not be reused when the JS calls register() again https://bugs.webkit.org/show_bug.cgi?id=181810 <rdar://problem/36591711> Reviewed by Youenn Fablet. The issue was that when restoring a registration from disk, we would not set its active worker right away. We only set it later in installContextData(). installContextData() is only called after we’ve launched the service worker process and established a connection to it. However, we would start processing jobs (such as registrations) before we’ve established the connection to the service worker process. SWServerJobQueue::runRegisterJob(), in order to reuse an existing registration checks the registration’s active worker has the right script URL. The issue was that when this code would execute, we may not have set the registration’s active service worker yet, in which case, we would update the existing registration instead of reusing it as-is. To address the issue, we now delay the processing of jobs until the connection to the service worker process has been established and we've installed all pending contexts via installContextData(). Changed is covered by new API test. * workers/service/server/SWServer.cpp: (WebCore::SWServer::Connection::scheduleJobInServer): (WebCore::SWServer::scheduleJob): (WebCore::SWServer::serverToContextConnectionCreated): * workers/service/server/SWServer.h: 2018-01-19 James Craig <jcraig@apple.com> AX: when invert colors is on, double-invert image and picture elements in UserAgentStyleSheet https://bugs.webkit.org/show_bug.cgi?id=181281 <rdar://problem/36291776> Reviewed by Simon Fraser. Updated "Smart Invert" to include img and picture element inversion and tests. Tests: accessibility/smart-invert-reference.html accessibility/smart-invert.html * css/html.css: (@media (inverted-colors)): (img:not(picture>img), picture, video): 2018-01-19 Chris Dumez <cdumez@apple.com> The WebContent process should not process incoming IPC while waiting for a sync IPC reply https://bugs.webkit.org/show_bug.cgi?id=181560 Reviewed by Ryosuke Niwa. Add internals API for testing purposes. Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html * page/ChromeClient.h: * testing/Internals.cpp: (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply): * testing/Internals.h: * testing/Internals.idl: 2018-01-19 Keith Miller <keith_miller@apple.com> HaveInternalSDK includes should be "#include?" https://bugs.webkit.org/show_bug.cgi?id=179670 Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: 2018-01-19 Daniel Bates <dabates@apple.com> Fix misspelling; substitute willDetachRenderer for willDetatchRenderer. * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::willDetachRenderers): * plugins/PluginViewBase.h: (WebCore::PluginViewBase::willDetachRenderer): (WebCore::PluginViewBase::willDetatchRenderer): Deleted. 2018-01-19 Jonathan Bedard <jbedard@apple.com> Unreviewed build fix, remove unused lambda captures. * dom/messageports/MessagePortChannel.cpp: (WebCore::MessagePortChannel::takeAllMessagesForPort): * dom/messageports/MessagePortChannelRegistry.cpp: (WebCore::MessagePortChannelRegistry::messagePortChannelCreated): 2018-01-19 Antoine Quint <graouts@apple.com> [Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming() https://bugs.webkit.org/show_bug.cgi?id=181857 <rdar://problem/36660081> Reviewed by Dean Jackson. We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction. Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed properties that will come in later patch as we implement various processes defined by the spec. We also update the existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the specification. Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by the Web Animations specification. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::localTime const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.cpp: (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::setIterationStart): (WebCore::AnimationEffectTiming::setIterations): (WebCore::AnimationEffectTiming::bindingsDuration const): (WebCore::AnimationEffectTiming::setBindingsDuration): (WebCore::AnimationEffectTiming::endTime const): (WebCore::AnimationEffectTiming::activeDuration const): * animation/AnimationEffectTiming.h: * animation/AnimationEffectTiming.idl: * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const): (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::bindingsCurrentTime): * animation/ComputedTimingProperties.h: Added. * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since otherwise setting those properties to a null value would not set the properties in the converted JS dictionary. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary. (WebCore::KeyframeEffect::applyAtLocalTime): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::startOrStopAccelerated): * animation/WebAnimation.cpp: (WebCore::WebAnimation::bindingsStartTime const): (WebCore::WebAnimation::bindingsCurrentTime const): (WebCore::WebAnimation::effectEndTime const): (WebCore::WebAnimation::timeToNextRequiredTick const): * animation/WebAnimationUtilities.h: Added. (WebCore::secondsToWebAnimationsAPITime): 2018-01-19 Alex Christensen <achristensen@webkit.org> Remove dead networking code https://bugs.webkit.org/show_bug.cgi?id=181813 Reviewed by Tim Horton. CFURLConnection is only used on Windows. * platform/network/cf/ResourceError.h: * platform/network/cf/ResourceRequest.h: (WebCore::ResourceRequest::encodingRequiresPlatformData const): * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction): (WebCore::ResourceRequest::doUpdatePlatformRequest): (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): (WebCore::ResourceRequest::doUpdateResourceRequest): (WebCore::ResourceRequest::setStorageSession): * platform/network/cf/ResourceResponse.h: (WebCore::ResourceResponse::ResourceResponse): 2018-01-19 Alex Christensen <achristensen@webkit.org> Remove unused WebViewPrivate _allowCookies https://bugs.webkit.org/show_bug.cgi?id=181812 Reviewed by Tim Horton. This SPI was in the original iOS upstreaming and has not been used in many years. * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setDefaultAllowCookies): Deleted. (WebCore::ResourceRequestBase::defaultAllowCookies): Deleted. * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::ResourceRequestBase): 2018-01-18 Brady Eidson <beidson@apple.com> Make in-process MessagePorts be (mostly) asynchronous https://bugs.webkit.org/show_bug.cgi?id=181454 Reviewed by Alex Christensen. No new tests (Covered *brutally* by existing tests) Part of making MessagePorts be a thing we can pass across processes is making them work async. The existing "MessagePortChannel" method of abstraction was not cut out for this. This patch gets rid of MessagePortChannel and adds a new MessagePortChannelProvider abstraction. It then gets the new machinery working in-process (with some pieces of out-of-process in place) One synchronous behavior this patch maintains is the hasPendingActivity() check used to support GC. That will (creatively) be made async in the next followup. More generally from MessagePorts, this patch also adds a "MessageWithMessagePorts" object to be used with all forms of postMessage(). Much better. * CMakeLists.txt: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/InProcessMessagePortChannel.cpp: Removed. * dom/InProcessMessagePortChannel.h: Removed. * dom/MessagePortChannel.cpp: Removed. * dom/MessagePortChannel.h: Removed. * dom/MessageChannel.cpp: (WebCore::MessageChannel::create): (WebCore::MessageChannel::MessageChannel): (WebCore::m_port2): Deleted. * dom/MessageChannel.h: (WebCore::MessageChannel::create): Deleted. * dom/MessagePort.cpp: (WebCore::MessagePort::create): (WebCore::MessagePort::MessagePort): (WebCore::MessagePort::~MessagePort): (WebCore::MessagePort::entangle): (WebCore::MessagePort::postMessage): (WebCore::MessagePort::disentangle): (WebCore::MessagePort::messageAvailable): (WebCore::MessagePort::start): (WebCore::MessagePort::close): (WebCore::MessagePort::contextDestroyed): (WebCore::MessagePort::dispatchMessages): (WebCore::MessagePort::hasPendingActivity const): (WebCore::MessagePort::locallyEntangledPort const): (WebCore::MessagePort::disentanglePorts): (WebCore::MessagePort::entanglePorts): (WebCore::MessagePort::entangleWithRemote): Deleted. * dom/MessagePort.h: * dom/MessagePortIdentifier.h: (WebCore::MessagePortIdentifier::logString const): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::processMessageWithMessagePortsSoon): (WebCore::ScriptExecutionContext::dispatchMessagePortEvents): (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): Deleted. * dom/ScriptExecutionContext.h: Add a single object that represents two intertwined ports, tracks their pending messages, tracks which process they're in, etc etc: * dom/messageports/MessagePortChannel.cpp: Added. (WebCore::MessagePortChannel::create): (WebCore::MessagePortChannel::MessagePortChannel): (WebCore::MessagePortChannel::~MessagePortChannel): (WebCore::MessagePortChannel::includesPort): (WebCore::MessagePortChannel::entanglePortWithProcess): (WebCore::MessagePortChannel::disentanglePort): (WebCore::MessagePortChannel::closePort): (WebCore::MessagePortChannel::postMessageToRemote): (WebCore::MessagePortChannel::takeAllMessagesForPort): (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const): * dom/messageports/MessagePortChannel.h: Added. (WebCore::MessagePortChannel::port1 const): (WebCore::MessagePortChannel::port2 const): (WebCore::MessagePortChannel::logString const): Abstraction for creating and operating on MessagePorts in a potentially cross-process way: * dom/messageports/MessagePortChannelProvider.cpp: Added. (WebCore::MessagePortChannelProvider::singleton): (WebCore::MessagePortChannelProvider::setSharedProvider): * dom/messageports/MessagePortChannelProvider.h: Added. (WebCore::MessagePortChannelProvider::~MessagePortChannelProvider): Adds a concrete implementation of that provider to be used in-process (e.g. WK1): * dom/messageports/MessagePortChannelProviderImpl.cpp: Added. (WebCore::MessagePortChannelProviderImpl::~MessagePortChannelProviderImpl): (WebCore::MessagePortChannelProviderImpl::performActionOnAppropriateThread): (WebCore::MessagePortChannelProviderImpl::createNewMessagePortChannel): (WebCore::MessagePortChannelProviderImpl::entangleLocalPortInThisProcessToRemote): (WebCore::MessagePortChannelProviderImpl::messagePortDisentangled): (WebCore::MessagePortChannelProviderImpl::messagePortClosed): (WebCore::MessagePortChannelProviderImpl::postMessageToRemote): (WebCore::MessagePortChannelProviderImpl::takeAllMessagesForPort): (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync): * dom/messageports/MessagePortChannelProviderImpl.h: Added. Adds a main thread object to handle the set of all MessagePortChannels that are open. For now it lives in the WebProcess, but for out-of-process it will live in the UIProcess: * dom/messageports/MessagePortChannelRegistry.cpp: Added. (WebCore::MessagePortChannelRegistry::~MessagePortChannelRegistry): (WebCore::MessagePortChannelRegistry::didCreateMessagePortChannel): (WebCore::MessagePortChannelRegistry::messagePortChannelCreated): (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed): (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote): (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort): (WebCore::MessagePortChannelRegistry::didCloseMessagePort): (WebCore::MessagePortChannelRegistry::didPostMessageToRemote): (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort): (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): This is named against style and weird on purpose - to call attention to how bad it is and how it's temporary. (WebCore::MessagePortChannelRegistry::existingChannelContainingPort): * dom/messageports/MessagePortChannelRegistry.h: Added. Add an object that represents a "SerializedScriptValue for the message payload and the ports that are being transferred along with that payload". This is used in all forms of postMessage(): * dom/messageports/MessageWithMessagePorts.cpp: Added. * dom/messageports/MessageWithMessagePorts.h: Added. * page/DOMWindow.cpp: (WebCore::PostMessageTimer::PostMessageTimer): (WebCore::PostMessageTimer::event): (WebCore::DOMWindow::postMessage): * platform/Logging.h: * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::postMessage): * workers/Worker.cpp: (WebCore::Worker::postMessage): * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::postMessageToWorkerObject): (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerObjectProxy.h: * workers/service/ServiceWorker.cpp: (WebCore::ServiceWorker::postMessage): * workers/service/ServiceWorkerClient.cpp: (WebCore::ServiceWorkerClient::postMessage): * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::postMessageToServiceWorker): * workers/service/context/ServiceWorkerThread.cpp: (WebCore::fireMessageEvent): (WebCore::ServiceWorkerThread::postMessageToServiceWorker): * workers/service/context/ServiceWorkerThread.h: 2018-01-18 Ryan Haddad <ryanhaddad@apple.com> Unreviewed build fix, removed unused lambda capture. * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest): 2018-01-18 Chris Dumez <cdumez@apple.com> We should be able to terminate service workers that are unresponsive https://bugs.webkit.org/show_bug.cgi?id=181563 <rdar://problem/35280031> Reviewed by Alex Christensen. Test: http/tests/workers/service/postmessage-after-terminating-hung-worker.html * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::terminateWorker): Before calling WorkerThread::stop(), set a timer with the given timeout parameter. If the worker thread has not stopped when the timer fires, forcefully exit the service worker process. The StorageProcess will take care of relaunching the service worker process if it exits abruptly. (WebCore::SWContextManager::serviceWorkerFailedToTerminate): Log error message if we failed to terminate a service worker and call exit(). (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest): * workers/service/context/SWContextManager.h: 2018-01-18 Youenn Fablet <youenn@apple.com> Do not go to the storage process when loading a main resource if there is no service worker registered https://bugs.webkit.org/show_bug.cgi?id=181395 Reviewed by Chris Dumez. No observable behavior change. Instead of creating a connection to know whether there is a potential service worker, Ask the service worker provider that will use the connection if needed. Otherwise, it will use a default value provided by the UIProcess. Tested by cleaning all service workers and checking the computed value of the default value, then observing whether pages registering service workers work well. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource): * workers/service/ServiceWorkerProvider.cpp: (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin): * workers/service/ServiceWorkerProvider.h: 2018-01-18 Dan Bernstein <mitz@apple.com> [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions https://bugs.webkit.org/show_bug.cgi?id=181803 Reviewed by Tim Horton. * Configurations/Base.xcconfig: Updated. * Configurations/DebugRelease.xcconfig: Ditto. * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers. * Configurations/Version.xcconfig: Updated. * Configurations/macOSTargetConditionals.xcconfig: Added. Defines helper build settings useful for defining settings that depend on the target macOS version. 2018-01-18 Chris Dumez <cdumez@apple.com> Service Workers restored from persistent storage have 'redundant' state https://bugs.webkit.org/show_bug.cgi?id=181749 <rdar://problem/36556486> Reviewed by Youenn Fablet. Tested by new API test. * workers/service/server/SWServer.cpp: (WebCore::SWServer::installContextData): Make sure the SWServerWorker's state is set to "activated" after it is assigned to the registrations' active slot. Otherwise, it stays in its default state (redundant). 2018-01-18 Antti Koivisto <antti@apple.com> REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8% https://bugs.webkit.org/show_bug.cgi?id=181460 <rdar://problem/36379776> Reviewed by Ryosuke Niwa. * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): Don't do the expensive security origin test if the supplied sheet base URL is null. This is true for rules coming from the same document. 2018-01-18 Antti Koivisto <antti@apple.com> REGRESSION (r223604): Setting :before/after pseudo element on <noscript> asserts https://bugs.webkit.org/show_bug.cgi?id=181795 <rdar://problem/36334524> Reviewed by David Kilzer. <noscript> disallows renderer generation outside CSS mechanisms, however we would still construct PseudoElements for them during style resolution. These were never removed properly because the pseudo element removal was tied to render tree teardown. Without proper removal the associated animations were also not canceled. Test: fast/css-generated-content/noscript-pseudo-anim-crash.html * dom/Element.cpp: (WebCore::Element::removedFromAncestor): Take care to get rid of PseudoElements when the element is removed from the tree. This also cancels any associated animations. 2018-01-18 Chris Fleizach <cfleizach@apple.com> AX: Aria-activedescendant not supported https://bugs.webkit.org/show_bug.cgi?id=161734 <rdar://problem/28202679> Reviewed by Joanmarie Diggs. When a combo-box owns/controls a list/listbox/grid/tree, the owned element needs to check the active-descendant of the combobox when checking if it has selected children. The target of the selection change notification should also be the owned element in these cases. Test: accessibility/aria-combobox-controlling-list.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::selectedListItem): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const): (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged): (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const): (WebCore::AccessibilityRenderObject::selectedChildren): * accessibility/AccessibilityRenderObject.h: * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::postPlatformNotification): 2018-01-17 Per Arne Vollan <pvollan@apple.com> REGRESSION (r224780): Text stroke not applied to video captions. https://bugs.webkit.org/show_bug.cgi?id=181743 <rdar://problem/35874338> Reviewed by Simon Fraser. Tests: media/track/track-css-visible-stroke-expected.html media/track/track-css-visible-stroke.html After r224780, it is no longer possible to mix text stroke styles with webkit legacy text stroke styles. * css/StyleResolver.cpp: (WebCore::isValidCueStyleProperty): * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS const): 2018-01-18 Andy Estes <aestes@apple.com> [Payment Request] Support a default shipping address for Apple Pay https://bugs.webkit.org/show_bug.cgi?id=181754 <rdar://problem/36009733> Reviewed by Brady Eidson. Move shippingContact from ApplePayPaymentRequest to ApplePayRequestBase. This allows merchants to specify a default shipping address when using Apple Pay with Payment Request. This also fixes a bug found during testing where +[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:style:options:] would throw an exception when passed a nil NSPersonNameComponents. Test: http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html * Modules/applepay/ApplePayPaymentRequest.h: * Modules/applepay/ApplePayPaymentRequest.idl: * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::convertAndValidate): * Modules/applepay/ApplePayRequestBase.h: * Modules/applepay/ApplePayRequestBase.idl: * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): * Modules/applepay/ApplePaySessionPaymentRequest.h: (WebCore::ApplePaySessionPaymentRequest::version const): (WebCore::ApplePaySessionPaymentRequest::setVersion): * Modules/applepay/cocoa/PaymentContactCocoa.mm: (WebCore::convert): * Modules/applepay/paymentrequest/ApplePayRequest.idl: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::showPaymentUI): (WebCore::MockPaymentCoordinator::completeMerchantValidation): * testing/MockPaymentCoordinator.h: 2018-01-18 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Specify -[NSURL _title] for the associated URL when copying an image element https://bugs.webkit.org/show_bug.cgi?id=181783 <rdar://problem/35785445> Reviewed by Ryosuke Niwa. Always specify the -[NSURL _title] to be either the title specified in a PasteboardImage's inner PasteboardURL, or if no title is specified, fall back to the user-visible URL string. This is because at least one internal client always tries to use the -_title property to determine the title of a pasted URL, or if none is specified, the -suggestedName. Since we need to set suggestedName to the preferred file name of the copied image and we don't want the suggested name to become the title of the link, we need to explicitly set the link title. In doing so, this patch also fixes a bug wherein we forget to set the _title of the NSURL we're registering to an NSItemProvider. Tests: ActionSheetTests.CopyImageElementWithHREFAndTitle (new) ActionSheetTests.CopyImageElementWithHREF (modified) * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): 2018-01-17 Jer Noble <jer.noble@apple.com> WebVTT served via HLS never results in cues https://bugs.webkit.org/show_bug.cgi?id=181773 Reviewed by Eric Carlson. Test: http/tests/media/hls/hls-webvtt-tracks.html Three independant errors conspired to keep in-band WebVTT samples from parsing: - The definition of ISOWebVTTCue::boxTypeName() was incorrect. - ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset). - Use String::fromUTF8() rather than String.adopt(StringVector&&). * platform/graphics/iso/ISOVTTCue.cpp: (WebCore::ISOWebVTTCue::parse): * platform/graphics/iso/ISOVTTCue.h: (WebCore::ISOWebVTTCue::boxTypeName): 2018-01-17 John Wilander <wilander@apple.com> Resource Load Statistics: Block cookies for prevalent resources without user interaction https://bugs.webkit.org/show_bug.cgi?id=177394 <rdar://problem/34613960> Reviewed by Alex Christensen. Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html * platform/network/NetworkStorageSession.h: Now exports NetworkStorageSession::nsCookieStorage(). * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies): Fixes the FIXME. 2018-01-17 Dean Jackson <dino@apple.com> Remove linked-on test for Snow Leopard https://bugs.webkit.org/show_bug.cgi?id=181770 Reviewed by Eric Carlson. Remove a very old linked-on-or-after test. * platform/graphics/ca/GraphicsLayerCA.cpp: 2018-01-17 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r227098. This broke the build. Reverted changeset: "Remove linked-on test for Snow Leopard" https://bugs.webkit.org/show_bug.cgi?id=181770 https://trac.webkit.org/changeset/227098 2018-01-17 Dean Jackson <dino@apple.com> Remove linked-on test for Snow Leopard https://bugs.webkit.org/show_bug.cgi?id=181770 Reviewed by Eric Carlson. Remove a very old linked-on-or-after test. * platform/graphics/ca/GraphicsLayerCA.cpp: 2018-01-17 Stephan Szabo <stephan.szabo@sony.com> [Curl] Use ResourceRequest::encodeWithPlatformData() https://bugs.webkit.org/show_bug.cgi?id=181768 Reviewed by Alex Christensen. No new tests, assertion hit in downstream port, should be covered by existing tests. * platform/network/curl/ResourceRequest.h: (WebCore::ResourceRequest::encodeWithPlatformData const): (WebCore::ResourceRequest::decodeWithPlatformData): 2018-01-17 Eric Carlson <eric.carlson@apple.com> Use existing RGB colorspace instead of creating a new one https://bugs.webkit.org/show_bug.cgi?id=181765 <rdar://problem/36595753> Reviewed by Dean Jackson. * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Use sRGBColorSpaceRef instead of creating a new static colorspace. 2018-01-17 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r227076. This breaks internal builds Reverted changeset: "Resource Load Statistics: Block cookies for prevalent resources without user interaction" https://bugs.webkit.org/show_bug.cgi?id=177394 https://trac.webkit.org/changeset/227076 2018-01-17 Ryosuke Niwa <rniwa@webkit.org> input and textarea elements should reveal selection in setSelection when focused https://bugs.webkit.org/show_bug.cgi?id=181715 <rdar://problem/36570546> Reviewed by Zalan Bujtas. Made input and textarea elements reveal selection in FrameSelection::setSelection instead of by directly invoking FrameSelection::revealSelection in their respective updateFocusAppearance to unify code paths. Also added options to reveal selection up to the main frame to SetSelectionOption to be used in iOS. * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::moveWithoutValidationTo): Takes SelectionRevealMode as an argument and converts sets appropriate selection options. (WebCore::FrameSelection::setSelection): Reconstruct SelectionRevealMode out of selection option sets. (WebCore::FrameSelection::updateAndRevealSelection): * editing/FrameSelection.h: (WebCore::FrameSelection): Added RevealSelectionUpToMainFrame as a SelectionRevealMode and replaced m_shouldRevealSelection by m_selectionRevealMode. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateFocusAppearance): Pass SelectionRevealMode to HTMLTextFormControlElement's select and restoreCachedSelection instead of directly invoking FrameSelection::revealSelection. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::updateFocusAppearance): Ditto. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::select): (WebCore::HTMLTextFormControlElement::setSelectionRange): (WebCore::HTMLTextFormControlElement::restoreCachedSelection): * html/HTMLTextFormControlElement.h: 2018-01-17 Michael Catanzaro <mcatanzaro@igalia.com> WEBKIT_FRAMEWORK should not modify file-global include directories https://bugs.webkit.org/show_bug.cgi?id=181656 Reviewed by Konstantin Tokarev. * CMakeLists.txt: * PlatformWPE.cmake: 2018-01-17 Michael Catanzaro <mcatanzaro@igalia.com> [GTK] Try even harder not to static link WTF into libwebkit2gtk https://bugs.webkit.org/show_bug.cgi?id=181751 Reviewed by Alex Christensen. We don't want two copies of WTF. It should only be in libjavascriptcoregtk. * PlatformGTK.cmake: 2018-01-17 Zalan Bujtas <zalan@apple.com> Multicol: RenderMultiColumnFlow should not inherit the flow state https://bugs.webkit.org/show_bug.cgi?id=181762 <rdar://problem/35448565> Reviewed by Simon Fraser. Do not compute the inherited flow state flag for RenderMultiColumnFlow. It is (by definition) always inside a fragmented flow. Test: fast/multicol/crash-when-out-of-flow-positioned-becomes-in-flow.html * rendering/RenderObject.cpp: (WebCore::RenderObject::computedFragmentedFlowState): 2018-01-17 Alex Christensen <achristensen@webkit.org> Deprecate Application Cache https://bugs.webkit.org/show_bug.cgi?id=181764 Reviewed by Geoffrey Garen. * features.json: 2018-01-17 Wenson Hsieh <wenson_hsieh@apple.com> [iOS simulator] API test WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage is failing https://bugs.webkit.org/show_bug.cgi?id=181758 Reviewed by Tim Horton. This test is failing because Editor::clientReplacementURLForResource expects a MIME type, but on iOS, the type paramter passed into WebContentReader::readImage is a UTI; subsequently, the bundle editing delegate receives a MIME type that's actually a UTI, which is incorrect. To address this, ensure that a MIME type is passed to bundle SPI by converting the type in WebContentReader::readImage to a MIME type. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readImage): 2018-01-17 Antti Koivisto <antti@apple.com> REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32 https://bugs.webkit.org/show_bug.cgi?id=181742 <rdar://problem/36334726> Reviewed by David Kilzer. Test: fast/media/mediaqueryevaluator-crash.html * css/MediaQueryEvaluator.cpp: (WebCore::MediaQueryEvaluator::MediaQueryEvaluator): Use WeakPtr<Document> instead of a plain Frame pointer. (WebCore::MediaQueryEvaluator::evaluate const): Get the frame via document. * css/MediaQueryEvaluator.h: * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Take care to clear style resolver. 2018-01-17 Youenn Fablet <youenn@apple.com> Put fetch request keepAlive behind a runtime flag https://bugs.webkit.org/show_bug.cgi?id=181592 Reviewed by Chris Dumez. No change of behavior. * Modules/fetch/FetchRequest.idl: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const): (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled): 2018-01-17 Per Arne Vollan <pvollan@apple.com> [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy. https://bugs.webkit.org/show_bug.cgi?id=181686 Reviewed by Alex Christensen. No new tests, covered by existing tests. A switch will make the function easier on the eyes. Also, use the function in places where the ResourceRequestCachePolicy is just casted to a platform cache policy. * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::toPlatformRequestCachePolicy): 2018-01-17 John Wilander <wilander@apple.com> Resource Load Statistics: Block cookies for prevalent resources without user interaction https://bugs.webkit.org/show_bug.cgi?id=177394 <rdar://problem/34613960> Reviewed by Alex Christensen. Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html * platform/network/NetworkStorageSession.h: Now exports NetworkStorageSession::nsCookieStorage(). * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies): Fixes the FIXME. 2018-01-17 Daniel Bates <dabates@apple.com> REGRESSION (r222795): Cardiogram never signs in https://bugs.webkit.org/show_bug.cgi?id=181693 <rdar://problem/36286293> Reviewed by Ryosuke Niwa. Exempt Cardiogram from the XHR header restrictions in r222795. Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers. However Cardiogram also depends on such functionality. Test: fast/xmlhttprequest/set-dangerous-headers-from-file-when-setting-enabled.html * page/Settings.yaml: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isCardiogram): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::setRequestHeader): 2018-01-17 Daniel Bates <dabates@apple.com> ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle() https://bugs.webkit.org/show_bug.cgi?id=181746 <rdar://problem/36586248> Reviewed by Chris Dumez. Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries whether the ping is able to respond to an authentication request. (Pings do not respond to authenticate requests.) It will call the completion handler, nullify the completion handler, and deallocate the PingHandle. Nullifying the completion handler is necessary to avoid the assertion failure in ~PingHandle(). Test: http/tests/misc/before-unload-load-image.html * platform/network/PingHandle.h: 2018-01-17 Daniel Bates <dabates@apple.com> WebCoreResourceHandleAsOperationQueueDelegate/ResourceHandleCFURLConnectionDelegateWithOperationQueue may be deleted in main thread callback https://bugs.webkit.org/show_bug.cgi?id=181747 <rdar://problem/36588120> Reviewed by Alex Christensen. Retain the delegate (e.g. WebCoreResourceHandleAsOperationQueueDelegate) before scheduling a main thread callback and blocking on a semaphore for its reply because the main thread callback can do anything, including deleting the delegate, before the non-main thread has a chance to execute. For instance, a PingHandle will delete itself (and hence delete its resource handle delegate) in most of the code paths invoked by the delegate. * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): 2018-01-17 Chris Dumez <cdumez@apple.com> 'fetch' event may be sent to a service worker before its state is set to 'activated' https://bugs.webkit.org/show_bug.cgi?id=181698 <rdar://problem/36554856> Reviewed by Youenn Fablet. 'fetch' event may be sent to a service worker before its state is set to 'activated'. When the registration's active worker needs to intercept a load, and its state is 'activating', we queue the request to send the fetch event in SWServerWorker::m_whenActivatedHandlers. Once the SWServerWorker::setState() is called with 'activated' state, we then call the handlers in m_whenActivatedHandlers to make send the fetch event now that the worker is activated. The issue is that even though the worker is activated and its state was set to 'activated' on Storage process side, we had not yet notified the ServiceWorker process of the service worker's new state yet. To address the issue, we now make sure that SWServerWorker::m_whenActivatedHandlers are called *after* we've sent the IPC to the ServiceWorker process to update the worker's state to 'activated'. Also, we now call ServiceWorkerFetch::dispatchFetchEvent() asynchronously in a postTask() as the service worker's state is also updated asynchronously in a postTask. This is as per specification [1], which says to "queue a task" to fire the fetch event. [1] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18) No new tests, covered by imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html which hits the new assertion without the fix. * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Add assertions to make sure that we dispatch the fetch event on the right worker and that the worker is in 'activated' state. * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::postFetchTask): Queue a task to fire the fetch event as per: - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18) We need to match the specification exactly here or things will happen in the wrong order. In particular, things like "update registration state" and "update worker state" might happen *after* firing the fetch event, even though the IPC for "update registration/worker state" was sent before the "fire fetch event" one, because the code for updating a registration/ worker state already queues a task, as per the specification. * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::updateWorkerState): * workers/service/server/SWServerRegistration.h: * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::setState): Move code to send the IPC to the Service Worker process whenever the service worker's state needs to be updated from SWServerRegistration::updateWorkerState() to SWServerWorker::setState(). This way, we can make sure the IPC is sent *before* we call the m_whenActivatedHandlers handlers, as they may also send IPC to the Service Worker process, and we need to make sure this IPC happens after so that the service worker is in the right state. 2018-01-17 Stephan Szabo <stephan.szabo@sony.com> Page.cpp only sees forward declaration of ApplicationStateChangeListener when ENABLE(VIDEO) is off https://bugs.webkit.org/show_bug.cgi?id=181713 Reviewed by Darin Adler. No new tests (build fix). * page/Page.cpp: Add include for ApplicationStateChangeListener 2018-01-17 Wenson Hsieh <wenson_hsieh@apple.com> Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content https://bugs.webkit.org/show_bug.cgi?id=181637 <rdar://problem/36508471> Reviewed by Tim Horton. Before carrying out blob URL conversion for pasted or dropped rich content, let the editor client replace subresource URLs in WebKit2 by calling out to new injected bundle SPI. See comments below for more detail. Tests: WKAttachmentTests.InjectedBundleReplaceURLsWhenPastingAttributedString WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage * editing/Editor.cpp: (WebCore::Editor::clientReplacementURLForResource): * editing/Editor.h: Add a new helper to call out to the editor client for a URL string to replace a given ArchiveResource. In WebKit2, this calls out to the injected bundle's new `replacementURLForResource` SPI hook. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::shouldReplaceSubresourceURL): (WebCore::replaceRichContentWithAttachments): (WebCore::replaceSubresourceURLsWithURLsFromClient): Add a new static helper to replace subresource URLs in the given DocumentFragment with URLs supplied by the editor client. Additionally builds a list of ArchiveResources that have not been replaced, for use at call sites so that we don't unnecessarily create more Blobs for ArchiveResources that have already been replaced. (WebCore::createFragmentAndAddResources): (WebCore::sanitizeMarkupWithArchive): Tweak web content reading codepaths to first replace subresource URLs with editor-client-supplied URLs. (WebCore::WebContentReader::readImage): (WebCore::shouldConvertToBlob): Deleted. Rename this helper to shouldReplaceSubresourceURL, blob URL replacement is no longer the only scenario in which we replace resource URLs, but in both cases, we still want to ignore `http:`-family and `data:` URLs. * loader/EmptyClients.cpp: * page/EditorClient.h: 2018-01-17 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME][GStreamer] Add the full-sample encryption support in the GStreamer ClearKey decryptor https://bugs.webkit.org/show_bug.cgi?id=180080 Reviewed by Xabier Rodriguez-Calvar. Currently the GStreamer clearKey decryptor doesn't support the full-sample encryption, where the buffer is entirely encrypted, it supports only the sub-sample encryption. Test: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: (webKitMediaClearKeyDecryptorDecrypt): 2018-01-17 Zan Dobersek <zdobersek@igalia.com> Unreviewed follow-up to r227051. * platform/graphics/cairo/CairoOperations.h: Fix declaration of the fillRoundedRect() function by removing the bool parameter that's not used at all in the definition. This went unspotted due to the unified source build including the implementation file before fillRoundedRect() usage in GrapihcsContextCairo.cpp, leaving the declaration undefined and instead using the definition directly. 2018-01-17 Zan Dobersek <zdobersek@igalia.com> [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo https://bugs.webkit.org/show_bug.cgi?id=181725 Reviewed by Carlos Garcia Campos. Don't duplicate global alpha and image interpolation quality state values on the PlatformContextCairo. Instead, retrieve them from the managing GraphicsContextState when necessary. For Cairo operations, the FillSource and StrokeSource containers now store the global alpha value, using it during the operation executions. For drawNativeImage(), the global alpha and interpolation quality values are passed through arguments. In PlatformContextCairo, the two values are no longer stored on the internally-managed stack, and the getter-setter pairs for the two values are removed. In drawSurfaceToContext(), the two values are now expected to be passed through the method arguments. No new tests -- no change in behavior. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::prepareForFilling): (WebCore::Cairo::prepareForStroking): (WebCore::Cairo::drawPathShadow): (WebCore::Cairo::fillCurrentCairoPath): (WebCore::Cairo::FillSource::FillSource): (WebCore::Cairo::StrokeSource::StrokeSource): (WebCore::Cairo::strokeRect): (WebCore::Cairo::strokePath): (WebCore::Cairo::drawGlyphs): (WebCore::Cairo::drawNativeImage): (WebCore::Cairo::State::setGlobalAlpha): Deleted. (WebCore::Cairo::State::setImageInterpolationQuality): Deleted. * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::drawNativeImage): (WebCore::GraphicsContext::setPlatformAlpha): (WebCore::GraphicsContext::setPlatformImageInterpolationQuality): * platform/graphics/cairo/PlatformContextCairo.cpp: (WebCore::PlatformContextCairo::save): (WebCore::PlatformContextCairo::drawSurfaceToContext): (WebCore::PlatformContextCairo::State::State): Deleted. (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted. (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted. (WebCore::PlatformContextCairo::globalAlpha const): Deleted. (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted. * platform/graphics/cairo/PlatformContextCairo.h: * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame): 2018-01-17 Philippe Normand <pnormand@igalia.com> REGRESSION(r226973/r226974): Four multimedia tests failing https://bugs.webkit.org/show_bug.cgi?id=181696 Reviewed by Carlos Garcia Campos. This patch reverts some of the changes of the above revisions so as to fix layout test failures. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Properly prepare stalled event when an error was detected. (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Revert to previous version. (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto. (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Emit progress event also when streaming but not when an error was detected. (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): use isLiveStream like everywhere else. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_init): Revert to keep-alive FALSE by default. 2018-01-17 Zan Dobersek <zdobersek@igalia.com> [Cairo] Move prepareForFilling(), prepareForStroking() code to CairoOperations https://bugs.webkit.org/show_bug.cgi?id=181721 Reviewed by Carlos Garcia Campos. Move the prepareForFilling() and prepareForStroking() code off of the PlatformContextCairo class and into static functions inside the CairoOperations implementation files. The original methods weren't called from any place other than the Cairo operations, and they only operated with the cairo_t object that's stored in and retrievable from the PlatformContextCairo object. No new tests -- no change in behavior. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::reduceSourceByAlpha): (WebCore::Cairo::prepareCairoContextSource): (WebCore::Cairo::clipForPatternFilling): (WebCore::Cairo::prepareForFilling): (WebCore::Cairo::prepareForStroking): (WebCore::Cairo::drawPathShadow): (WebCore::Cairo::fillCurrentCairoPath): (WebCore::Cairo::strokeRect): (WebCore::Cairo::strokePath): (WebCore::Cairo::drawGlyphs): * platform/graphics/cairo/PlatformContextCairo.cpp: (WebCore::reduceSourceByAlpha): Deleted. (WebCore::prepareCairoContextSource): Deleted. (WebCore::PlatformContextCairo::prepareForFilling): Deleted. (WebCore::PlatformContextCairo::prepareForStroking): Deleted. (WebCore::PlatformContextCairo::clipForPatternFilling): Deleted. * platform/graphics/cairo/PlatformContextCairo.h: 2018-01-17 Zan Dobersek <zdobersek@igalia.com> [Cairo] Use one-time ShadowBlur objects when performing shadowing https://bugs.webkit.org/show_bug.cgi?id=181720 Reviewed by Carlos Garcia Campos. Don't maintain a ShadowBlur object in the PlatformContextCairo class. Instead, use temporary ShadowBlur objects whenever shadowing is needed, providing all the shadow state information to it and drawing shadow into the given GraphicsContext object. ShadowBlur constructors are cleaned up. The 'shadows ignored' argument can now also be provided to the variant that accepts explicit shadow attributes, but the argument is false by default. In CairoOperations, the ShadowBlurUsage functionality is rolled into the new ShadowState class. ShadowState parameter is now used for operations that might need to perform shadow painting. Call sites are modified accordingly. Cairo::State::setShadowValues() and Cairo::State::clearShadow() are removed, since the ShadowBlur object that was modified through those is being removed from the PlatformContextCairo class. We still have to flip the Y-axis of the shadow offset in GraphicsContext::setPlatformShadow() when shadows are ignoring transformations. No new tests -- no change in behavior. * platform/graphics/ShadowBlur.cpp: (WebCore::ShadowBlur::ShadowBlur): * platform/graphics/ShadowBlur.h: * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawPathShadow): (WebCore::Cairo::drawGlyphsShadow): (WebCore::Cairo::ShadowState::ShadowState): (WebCore::Cairo::ShadowState::isVisible const): (WebCore::Cairo::ShadowState::isRequired const): (WebCore::Cairo::fillRect): (WebCore::Cairo::fillRoundedRect): (WebCore::Cairo::fillRectWithRoundedHole): (WebCore::Cairo::fillPath): (WebCore::Cairo::strokeRect): (WebCore::Cairo::strokePath): (WebCore::Cairo::drawGlyphs): (WebCore::Cairo::drawNativeImage): (WebCore::Cairo::State::setShadowValues): Deleted. (WebCore::Cairo::State::clearShadow): Deleted. (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): Deleted. (WebCore::Cairo::ShadowBlurUsage::required const): Deleted. * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/FontCairo.cpp: (WebCore::FontCascade::drawGlyphs): * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::restorePlatformState): (WebCore::GraphicsContext::drawNativeImage): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::fillRect): (WebCore::GraphicsContext::setPlatformShadow): (WebCore::GraphicsContext::clearPlatformShadow): (WebCore::GraphicsContext::strokeRect): (WebCore::GraphicsContext::platformFillRoundedRect): (WebCore::GraphicsContext::fillRectWithRoundedHole): * platform/graphics/cairo/PlatformContextCairo.cpp: (WebCore::PlatformContextCairo::drawSurfaceToContext): * platform/graphics/cairo/PlatformContextCairo.h: (WebCore::PlatformContextCairo::shadowBlur): Deleted. * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame): 2018-01-17 Zan Dobersek <zdobersek@igalia.com> CanvasImageData: createImageData() parameter should not be nullable https://bugs.webkit.org/show_bug.cgi?id=181670 Reviewed by Sam Weinig. createImageData() method on the CanvasImageData interface should not treat the ImageData parameter as nullable, but should instead reject any null values with a TypeError, as demanded by the specification. No new tests -- current tests covering createImageData(null) are updated to properly cover new behavior of throwing a TypeError exception. * html/canvas/CanvasImageData.idl: * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::createImageData const): * html/canvas/CanvasRenderingContext2DBase.h: 2018-01-16 Fujii Hironori <Hironori.Fujii@sony.com> [CMake] Remove WebCoreDerivedSources library target https://bugs.webkit.org/show_bug.cgi?id=181664 Reviewed by Carlos Garcia Campos. After unified source build has been introduced, CMake Visual Studio build suffers complicated unnecessary recompilation issues because Visual Studio invokes scripts twice in both WebCore and WebCoreDerivedSources projects (Bug 181117). WebCoreDerivedSources library has been introduced in r198766 to avoid command line length limit of CMake Ninja build on macOS. Fortunately, unified source build has reduced the number of source files to compile, WebCore doesn't need to be split anymore. No new tests (No behavior change) * CMakeLists.txt: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. Removed WebCoreDerivedSources library target. Do not compile each JavaScript Builtins.cpp files because the unified source WebCoreJSBuiltins.cpp is already included. * PlatformGTK.cmake: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. * PlatformWin.cmake: Ditto. 2018-01-16 Simon Fraser <simon.fraser@apple.com> Can't scroll iframe after toggling it to display:none and back https://bugs.webkit.org/show_bug.cgi?id=181708 rdar://problem/13234778 Reviewed by Tim Horton. Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none. Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark the FrameView's scrollable area set as dirty. Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html * page/FrameView.cpp: (WebCore::FrameView::addChild): * page/FrameView.h: * platform/ScrollView.h: 2018-01-16 Chris Dumez <cdumez@apple.com> SWServerWorker::m_contextConnectionIdentifier may get out of date https://bugs.webkit.org/show_bug.cgi?id=181687 <rdar://problem/36548111> Reviewed by Brady Eidson. SWServerWorker::m_contextConnectionIdentifier may get out of date. This happens when the context process crashes and is relaunched. No new tests, added assertion in terminateWorkerInternal() that hits without this fix. * workers/service/server/SWServer.cpp: (WebCore::SWServer::runServiceWorker): (WebCore::SWServer::terminateWorkerInternal): (WebCore::SWServer::unregisterServiceWorkerClient): * workers/service/server/SWServerWorker.h: (WebCore::SWServerWorker::setContextConnectionIdentifier): 2018-01-16 Jer Noble <jer.noble@apple.com> Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed. https://bugs.webkit.org/show_bug.cgi?id=181707 <rdar://problem/34809474> Reviewed by Eric Carlson. Test: media/media-source/media-source-remove-unload-crash.html * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer): 2018-01-12 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Implement dummy WebAuthN IDLs https://bugs.webkit.org/show_bug.cgi?id=181627 <rdar://problem/36459864> Reviewed by Alex Christensen. This patch implements dummy WebAuthN IDLs and connect them with Credential Management as well. All implementations in this patch are subject to change when real implementations land. The purpose here on the other hand is to have IDLs, bindings and implementations connected. This patch should handle all IDLs that we need. No tests. * CMakeLists.txt: * DerivedSources.make: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/webauthn/AuthenticatorAssertionResponse.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp. (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse): (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): (WebCore::AuthenticatorAssertionResponse::authenticatorData): (WebCore::AuthenticatorAssertionResponse::signature): (WebCore::AuthenticatorAssertionResponse::userHandle): * Modules/webauthn/AuthenticatorAssertionResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h. * Modules/webauthn/AuthenticatorAssertionResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl. * Modules/webauthn/AuthenticatorAttestationResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h. (WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse): (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): (WebCore::AuthenticatorAttestationResponse::attestationObject): * Modules/webauthn/AuthenticatorAttestationResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h. * Modules/webauthn/AuthenticatorAttestationResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl. * Modules/webauthn/AuthenticatorResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h. (WebCore::AuthenticatorResponse::AuthenticatorResponse): (WebCore::AuthenticatorResponse::~AuthenticatorResponse): (WebCore::AuthenticatorResponse::clientDataJSON): * Modules/webauthn/AuthenticatorResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h. * Modules/webauthn/AuthenticatorResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl. * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredential::rawId): (WebCore::PublicKeyCredential::response): (WebCore::PublicKeyCredential::getClientExtensionResults): (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable): * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h. * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: Added. * Modules/webauthn/PublicKeyCredentialDescriptor.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h. * Modules/webauthn/PublicKeyCredentialDescriptor.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl. * Modules/webauthn/PublicKeyCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h. * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h. * Modules/webauthn/PublicKeyCredentialType.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl. * Modules/webauthn/PublicKeyCredentialType.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2018-01-16 Zalan Bujtas <zalan@apple.com> AX: Do not trigger layout in updateBackingStore() unless it is safe to do so https://bugs.webkit.org/show_bug.cgi?id=181703 <rdar://problem/36365706> Reviewed by Ryosuke Niwa. Document::isSafeToUpdateStyleOrLayout() can tell whether it is safe to run layout. Unable to create test with WebInspector involved. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::updateBackingStore): * dom/Document.cpp: (WebCore::Document::isSafeToUpdateStyleOrLayout const): (WebCore::Document::updateStyleIfNeeded): (WebCore::Document::updateLayout): (WebCore::isSafeToUpdateStyleOrLayout): Deleted. * dom/Document.h: 2018-01-16 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r226962. The LayoutTest added with this change is a flaky timeout. Reverted changeset: "Support for preconnect Link headers" https://bugs.webkit.org/show_bug.cgi?id=181657 https://trac.webkit.org/changeset/226962 2018-01-16 Simon Fraser <simon.fraser@apple.com> Text looks bad on some CSS spec pages https://bugs.webkit.org/show_bug.cgi?id=181700 rdar://problem/36552107 Reviewed by Tim Horton. When making new tiles in a TileController, we failed to set their "supports antialiased layer text" setting, so tile caches could end up with a mixture of layers that do and do not support antialiased layer text. No tests because the tiled drawing tests don't dump out tiles inside of tile caches. * platform/graphics/ca/TileController.cpp: (WebCore::TileController::createTileLayer): 2018-01-16 Said Abou-Hallawa <sabouhallawa@apple.com> REGRESSION(r221292): svg/animations/animateTransform-pattern-transform.html crashes with security assertion https://bugs.webkit.org/show_bug.cgi?id=179986 Reviewed by Simon Fraser. This patch reverts all or parts of the following changes-sets <http://trac.webkit.org/changeset/221292> <http://trac.webkit.org/changeset/197967> <http://trac.webkit.org/changeset/196670> A JS statement like this: var item = text.x.animVal.getItem(0); Creates the following C++ objects: SVGAnimatedListPropertyTearOff<SVGLengthListValues> for 'text.x' SVGListPropertyTearOff<SVGLengthListValues> for 'text.x.animVal' SVGPropertyTearOff<SVGLengthValue> for 'text.x.animVal.getItem(0)' If 'item' changes, the attribute 'x' of the element '<text>' will change as well. But this binding works only in one direction. If the attribute 'x' of the element '<text>' changes, e.g.: text.setAttribute('x', '10,20,30'); This will detach 'item' from the element <text> and any further changes in 'item' won't affect the attribute 'x' of element <text>. The one direction binding can only work if this chain of tear-off objects is kept connected. This is implemented by RefCounted back pointers from SVGPropertyTearOff and SVGListPropertyTearOff to SVGAnimatedListPropertyTearOff. The security crashes and the memory leaks are happening because of the raw forward pointers: -- SVGAnimatedListPropertyTearOff maintains raw pointers of type SVGListPropertyTearOff for m_baseVal and m_animVal -- The m_wrappers and m_animatedWrappers of SVGAnimatedListPropertyTearOff are vectors of raw pointer Vector<SVGLength*> To control the life cycle of the raw pointers, SVGListPropertyTearOff and SVGPropertyTearOff call SVGAnimatedListPropertyTearOff::propertyWillBeDeleted() to notify it they are going to be deleted. In propertyWillBeDeleted(), we clear the pointers so they are not used after being freed. This mechanism has been error-prone and we've never got it 100% right. The solution we need to adopt with SVG tear-off objects is the following: -- All the forward pointers should be weak pointers. -- All the back pointers should be ref pointers. This solution may not look intuitive but it solves the bugs and keeps the one direction binding. The forward weak pointers allows the tear-off objects to go aways if no reference from JS exists. The back ref pointers maintains the chain of objects and guarantees the correct binding. * svg/SVGPathSegList.h: * svg/SVGTransformList.h: * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::baseVal): (WebCore::SVGAnimatedListPropertyTearOff::animVal): * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h: * svg/properties/SVGAnimatedProperty.h: (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const): (WebCore::SVGAnimatedProperty::propertyWillBeDeleted): Deleted. * svg/properties/SVGAnimatedPropertyTearOff.h: * svg/properties/SVGAnimatedTransformListPropertyTearOff.h: * svg/properties/SVGListProperty.h: (WebCore::SVGListProperty::initializeValuesAndWrappers): (WebCore::SVGListProperty::getItemValuesAndWrappers): (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers): (WebCore::SVGListProperty::replaceItemValuesAndWrappers): (WebCore::SVGListProperty::removeItemValuesAndWrappers): (WebCore::SVGListProperty::appendItemValuesAndWrappers): (WebCore::SVGListProperty::createWeakPtr const): * svg/properties/SVGListPropertyTearOff.h: (WebCore::SVGListPropertyTearOff::removeItemFromList): (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Deleted. * svg/properties/SVGPropertyTearOff.h: (WebCore::SVGPropertyTearOff::createWeakPtr const): (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff): 2018-01-16 Eric Carlson <eric.carlson@apple.com> AVSampleBufferDisplayLayer should be flushed when application activates https://bugs.webkit.org/show_bug.cgi?id=181623 <rdar://problem/36487738> Reviewed by Darin Adler. No new tests, I wasn't able to reproduce it in a test. * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::addApplicationStateChangeListener): New. (WebCore::Document::removeApplicationStateChangeListener): Ditto. (WebCore::Document::forEachApplicationStateChangeListener): Ditto. * dom/Document.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::registerWithDocument): Register for application state changes. (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister. (WebCore::HTMLMediaElement::applicationWillResignActive): Pass through to the player. (WebCore::HTMLMediaElement::applicationDidBecomeActive): Ditto. * html/HTMLMediaElement.h: * page/ApplicationStateChangeListener.h: Added. (WebCore::ApplicationStateChangeListener::applicationWillResignActive): (WebCore::ApplicationStateChangeListener::applicationDidBecomeActive): * page/Page.cpp: (WebCore::Page::forEachDocument): (WebCore::Page::applicationWillResignActive): (WebCore::Page::applicationDidEnterBackground): (WebCore::Page::applicationWillEnterForeground): (WebCore::Page::applicationDidBecomeActive): * page/Page.h: * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::applicationWillResignActive): (WebCore::MediaPlayer::applicationDidBecomeActive): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::applicationWillResignActive): (WebCore::MediaPlayerPrivateInterface::applicationDidBecomeActive): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Switch to release logging. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Split out of enqueueVideoSample. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Move code that updates the display later to enqueueCorrectedVideoSample. Rearrange logic to the image painter sample buffer has the correct timestamp. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange): Switch to release logging. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): f the display layer is in the "failed" state, flush the renderer and update the display mode. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Switch to release logging. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareToPlay): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateReadyState) Ditto.: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): Ditto. (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes): Deleted. 2018-01-16 Michael Catanzaro <mcatanzaro@igalia.com> PAL should link to JavaScriptCore rather than WTF https://bugs.webkit.org/show_bug.cgi?id=181683 Reviewed by Konstantin Tokarev. Do not link directly to JavaScriptCore. Get it via PAL. * CMakeLists.txt: 2018-01-16 Zach Li <zachli@apple.com> Add pop-up policy support in website policies. https://bugs.webkit.org/show_bug.cgi?id=181544. rdar://problem/30521400. Reviewed by Alex Christensen. * loader/DocumentLoader.h: Introduce pop-up policy getter and setter. Initialize the policy as Default. (WebCore::DocumentLoader::popUpPolicy const): (WebCore::DocumentLoader::setPopUpPolicy): * page/DOMWindow.cpp: (WebCore::DOMWindow::allowPopUp): Pop-up policy specified on a per-page basis holds precedence over the global policy. If no pop-up policy is specified during navigation, global policy is used. 2018-01-16 Jer Noble <jer.noble@apple.com> Crash playing audio-only HLS stream via hls.js (MSE) https://bugs.webkit.org/show_bug.cgi?id=181691 <rdar://problem/32967295> Reviewed by Eric Carlson. Add a weak-link check to the block called by -[AVSampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:usingBlock:]. * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): 2018-01-16 Simon Fraser <simon.fraser@apple.com> Rename applyHorizontalScale/applyVerticalScale in SVG filters, and related cleanup https://bugs.webkit.org/show_bug.cgi?id=181684 Reviewed by Alex Christensen. Rename the confusing applyHorizontalScale/applyVerticalScale to scaledByFilterResolution(), and have it take and return a FloatSize. Change callers to do math in terms of FloatSizes. Add inflate(size) to each of the rect classes. * platform/graphics/FloatRect.h: (WebCore::FloatRect::inflate): * platform/graphics/IntRect.h: (WebCore::IntRect::inflate): * platform/graphics/LayoutRect.h: (WebCore::LayoutRect::inflate): * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::FEDisplacementMap::platformApplySoftware): * platform/graphics/filters/FEDropShadow.cpp: (WebCore::FEDropShadow::determineAbsolutePaintRect): (WebCore::FEDropShadow::platformApplySoftware): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::calculateUnscaledKernelSize): (WebCore::FEGaussianBlur::calculateKernelSize): (WebCore::FEGaussianBlur::determineAbsolutePaintRect): (WebCore::FEGaussianBlur::platformApplySoftware): * platform/graphics/filters/FEGaussianBlur.h: * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::determineAbsolutePaintRect): (WebCore::FEMorphology::platformApplySoftware): * platform/graphics/filters/FEOffset.cpp: (WebCore::FEOffset::determineAbsolutePaintRect): (WebCore::FEOffset::platformApplySoftware): * platform/graphics/filters/Filter.h: (WebCore::Filter::setSourceImage): (WebCore::Filter::scaledByFilterResolution const): (WebCore::Filter::applyHorizontalScale const): Deleted. (WebCore::Filter::applyVerticalScale const): Deleted. * platform/graphics/filters/FilterOperations.cpp: (WebCore::outsetSizeForBlur): * rendering/FilterEffectRenderer.h: * svg/graphics/filters/SVGFilter.cpp: (WebCore::SVGFilter::scaledByFilterResolution const): (WebCore::SVGFilter::applyHorizontalScale const): Deleted. (WebCore::SVGFilter::applyVerticalScale const): Deleted. * svg/graphics/filters/SVGFilter.h: 2018-01-16 Fujii Hironori <Hironori.Fujii@sony.com> [CMake][Mac] Fix the build errors https://bugs.webkit.org/show_bug.cgi?id=181665 Reviewed by Alex Christensen. No new tests (No behavior change) * CMakeLists.txt: Added Modules/paymentrequest/MerchantValidationEvent.idl to compile. * PlatformMac.cmake: Added Modules/paymentrequest/MerchantValidationEvent.cpp to compile. Added workers/service/context and Modules/applicationmanifest as forwarding header paths. 2018-01-16 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted https://bugs.webkit.org/show_bug.cgi?id=181638 <rdar://problem/36508702> Reviewed by Dan Bernstein. Adjust the `didInsertAttachment` codepath to additionally propagate the attachment element's `src`. Additionally, fix an issue with insertion and removal client notifications wherein the client can receive insertion calls without corresponding removal calls, or vice versa. This is an existing issue, but matters more now because we actually need to access the attachment element for its `src` when propagating changes to the client. See below for details. Test: WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup * dom/Document.h: (WebCore::Document::attachmentElementsByIdentifier const): * editing/Editor.cpp: (WebCore::Editor::notifyClientOfAttachmentUpdates): * page/EditorClient.h: (WebCore::EditorClient::didInsertAttachment): * page/Frame.cpp: (WebCore::Frame::setDocument): When a Frame's document changes, inform the client that the attachments in the previous document are going away. For each attachment currently connected to the document, we have either (1) already informed the client that it was inserted, or (2) the attachment is pending an insertion call to the client. If (1) is the case, then we'll tell the client that the attachment is removed, which will balance out the earlier insertion call. If (2) is the case, then we'll remove the previously inserted attachment identifier from the set of attachment identifiers pending insertion, and the client won't be informed of insertions or removals. 2018-01-16 Antoine Quint <graouts@apple.com> Use traits for animation timing functions https://bugs.webkit.org/show_bug.cgi?id=181651 Reviewed by Dean Jackson. Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The downcast function can match const automatically and it's a better style to put the * inside the downcast call rather than outside. * css/CSSComputedStyleDeclaration.cpp: (WebCore::createTimingFunctionValue): * platform/animation/TimingFunction.cpp: (WebCore::operator<<): (WebCore::TimingFunction::transformTime const): * platform/animation/TimingFunction.h: * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm: (WebCore::toCAMediaTimingFunction): 2018-01-16 Philippe Normand <pnormand@igalia.com> [GStreamer] Live streaming cleanups https://bugs.webkit.org/show_bug.cgi?id=181672 Reviewed by Michael Catanzaro. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to streaming code path when no content-length was reported by the http source element. (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (CachedResourceStreamingClient::responseReceived): Emit headers as an element message, like souphttpsrc. 2018-01-15 Philippe Normand <pnormand@igalia.com> [GStreamer] misc fixes and cleanups https://bugs.webkit.org/show_bug.cgi?id=181647 Reviewed by Michael Catanzaro. * platform/graphics/MediaPlayer.cpp: (WebCore::convertEnumerationToString): New utility function to convert preload enum to string. * platform/graphics/MediaPlayerEnums.h: Ditto. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto (WebCore::MediaPlayerPrivateGStreamer::play): Ditto (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update. (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto. (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak. (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Remove useless handlesSyncMessage method. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update. (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak. (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc. (webKitWebSrcStart): Debug tweak. (webKitWebSrcQueryWithParent): Ditto. (webKitWebSrcNeedData): Ditto. (CachedResourceStreamingClient::responseReceived): Change appsrc stream-type when we wan't seek. Also update caps like souphttpsrc does. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer. * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning. 2018-01-16 Yacine Bandou <yacine.bandou_ext@softathome.com> [WPE] Two clearkey tests failing since r226621 https://bugs.webkit.org/show_bug.cgi?id=181532 Reviewed by Xabier Rodriguez-Calvar. Whith a fake initData, we can have a pssh size nul, thus we should check it. We saw this issue in the subtest "initData longer than 64Kb characters" in the clearkey-generate-request-disallowed-input layout test. * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::extractKeyidsLocationFromCencInitData): 2018-01-15 Yoav Weiss <yoav@yoav.ws> Support for preconnect Link headers https://bugs.webkit.org/show_bug.cgi?id=181657 Reviewed by Darin Adler. Move the preconnect functionality into its own function, and also call this function when Link headers are processed. Test: http/tests/preconnect/link-header-rel-preconnect-http.php * loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect. (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here. (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`. (WebCore::LinkLoader::loadLink): Call preconnect. * loader/LinkLoader.h: 2018-01-15 Michael Catanzaro <mcatanzaro@igalia.com> Improve use of ExportMacros https://bugs.webkit.org/show_bug.cgi?id=181652 Reviewed by Konstantin Tokarev. Remove a comment. * platform/PlatformExportMacros.h: 2018-01-15 Konstantin Tokarev <annulen@yandex.ru> image-rendering should affect scaling of border-image https://bugs.webkit.org/show_bug.cgi?id=169440 Reviewed by Michael Catanzaro. Test: fast/borders/border-image-pixelated.html * rendering/style/NinePieceImage.cpp: (WebCore::NinePieceImage::paint): 2018-01-15 Tomas Popela <tpopela@redhat.com> 2.19.3 ACCELERATED_2D_CANVAS support is broken https://bugs.webkit.org/show_bug.cgi?id=180799 Reviewed by Michael Catanzaro. * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::didDraw): 2018-01-15 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Enable HTTP/2 https://bugs.webkit.org/show_bug.cgi?id=181551 Reviewed by Michael Catanzaro. Start supporting HTTP/2 protocol. The first step is just enabling the HTTP/2 on Curl backend. Next step will be to enable multiplexing feature. No new tests because we don't have HTTP/2 test backend yet. * platform/network/curl/CurlContext.cpp: (WebCore::CurlContext::isHttp2Enabled const): (WebCore::CurlHandle::enableHttp): (WebCore::CurlHandle::enableHttpGetRequest): (WebCore::CurlHandle::enableHttpHeadRequest): (WebCore::CurlHandle::enableHttpPostRequest): (WebCore::CurlHandle::enableHttpPutRequest): (WebCore::CurlHandle::setHttpCustomRequest): * platform/network/curl/CurlContext.h: 2018-01-15 Dean Jackson <dino@apple.com> Use a helper function for checked arithmetic in WebGL validation https://bugs.webkit.org/show_bug.cgi?id=181620 <rdar://problem/36485879> Reviewed by Eric Carlson. Eric recommended using a templated helper function to do a common arithmetic check in WebGL validation. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateIndexArrayConservative): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise): (WebCore::WebGLRenderingContextBase::validateDrawArrays): (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper. 2018-01-15 Dean Jackson <dino@apple.com> Use traits for animation timing functions https://bugs.webkit.org/show_bug.cgi?id=181651 <rdar://problem/36525328> Reviewed by Antoine Quint. Use the type traits for TimingFunction classes, so we can is<> and downcast<>. * css/CSSComputedStyleDeclaration.cpp: (WebCore::createTimingFunctionValue): * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::transformTime const): * platform/animation/TimingFunction.h: * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::animationHasStepsTimingFunction): (WebCore::animationHasFramesTimingFunction): * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm: (WebCore::toCAMediaTimingFunction): 2018-01-15 Youenn Fablet <youenn@apple.com> RealtimeMediaSource should be ThreadSafeRefCounted https://bugs.webkit.org/show_bug.cgi?id=181649 Reviewed by Eric Carlson. Difficult to write a test as this is really racy. RealtimeIncomingVideoSourceCocoa::OnFrame is taking a reference on a background thread to send a task to the main thread. This requires it to be thread safe ref counted. * platform/mediastream/RealtimeMediaSource.h: 2018-01-15 Philippe Normand <pnormand@igalia.com> Prevent useless MediaPlayer mute state notifications https://bugs.webkit.org/show_bug.cgi?id=181646 Reviewed by Carlos Garcia Campos. On GTK port the mute change notification was triggering the test runner to think the whole page mute state had changed and that media elements were muted. The simplest solution is to propagate the notification only if the state actually changed. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::muteChanged): Propagate mute notification only if the mute state actually changed. 2018-01-15 Sebastian Dröge <sebastian@centricular.com> [GStreamer] Don't wait for draw condition variable when shutting down. https://bugs.webkit.org/show_bug.cgi?id=180978 Reviewed by Carlos Garcia Campos. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: By also waiting for the draw condition variable while shutting down, it is possible that the GStreamer video sink is waiting for the main thread to actually render the current frame, while at the same time the main thread is waiting for the GStreamer video sink to shut down, resulting in a deadlock. 2018-01-13 Minsheng Liu <lambda@liu.ms> MathML Lengths should take zoom level into account https://bugs.webkit.org/show_bug.cgi?id=180029 Reviewed by Frédéric Wang. The patch applies the effective zoom factor to physical units in toUserUnits(). Test: mathml/presentation/mspace-units-with-zoom.html * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::toUserUnits): 2018-01-12 Chris Dumez <cdumez@apple.com> ASSERTION FAILED: registration || isTerminating() in WebCore::SWServerWorker::skipWaiting() https://bugs.webkit.org/show_bug.cgi?id=181603 <rdar://problem/36476050> Reviewed by Youenn Fablet. No new tests, covered by existing tests that crash flakily. * workers/service/server/SWServer.cpp: (WebCore::SWServer::terminateWorkerInternal): If the connection to the context process is gone, make sure we make the worker as terminated so that it does not stay in Running state and in SWServer::m_runningOrTerminatingWorkers. * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::~SWServerRegistration): Add assertions to make sure none of the registration's workers are still running when the registration is destroyed. (WebCore::SWServerRegistration::updateRegistrationState): Make sure registration workers that are overwritten are not still running. * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::setState): If a worker's state is set to redundant, make sure we also terminate it. 2018-01-12 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r226927. https://bugs.webkit.org/show_bug.cgi?id=181621 Breaks 32-bit and iOS release for some reason that i don't understand yet (Requested by dino on #webkit). Reverted changeset: "Use a helper function for checked arithmetic in WebGL validation" https://bugs.webkit.org/show_bug.cgi?id=181620 https://trac.webkit.org/changeset/226927 2018-01-12 Myles C. Maxfield <mmaxfield@apple.com> Data URL fonts split in the middle of an alphabet cause random letters to disappear https://bugs.webkit.org/show_bug.cgi?id=175845 <rdar://problem/33996578> Reviewed by Brent Fulgham. It is fairly common practice for a font foundry to split a font up into two files such that a semi-random half of the alphabet is present in one of the files, and the other half is present in the other file. This practice involves representing the files as data URLs, so as to minimize the time it takes to load them. Because resource loading is asynchronous (even for data URLs), it is possible today to get a paint after the first file is loaded but before the second file is loaded. Indeed, because of the way font fallback works, we will never start loading the second file until a layout has occurred with the first font. Because a site usually only uses this pattern for a handful of fonts, and I've never seen this pattern being used for CJK fonts, it isn't very expensive to opportunistically decode these data URLs eagerly. Using this method doesn't actually guarantee that the two fonts will load in between successive paints, but it at least makes this much more likely. This patch implements this strategy, along with a size threshold to make sure that we won't decode any super large data URLs when it isn't necessary. Test: fast/text/font-load-data-partitioned-alphabet.html * css/CSSFontFace.cpp: (WebCore::CSSFontFace::opportunisticallyStartFontDataURLLoading): * css/CSSFontFace.h: * css/CSSFontFaceSource.cpp: (WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading): * css/CSSFontFaceSource.h: * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::opportunisticallyStartFontDataURLLoading): * css/CSSFontSelector.h: * platform/graphics/FontCascadeFonts.cpp: (WebCore::opportunisticallyStartFontDataURLLoading): (WebCore::FontCascadeFonts::glyphDataForVariant): * platform/graphics/FontSelector.h: 2018-01-12 Alex Christensen <achristensen@webkit.org> History state should be updated during client redirects with asynchronous policy decisions https://bugs.webkit.org/show_bug.cgi?id=181358 <rdar://problem/35547689> Reviewed by Andy Estes. When decidePolicyForNavigationAction is responded to asynchronously during a client redirect, HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because the document loader has not been marked as a client redirect because the FrameLoader only looks at its provisional document loader to mark it as a client redirect. When decidePolicyForNavigationAction is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to its policy document loader. To get both asynchronous and synchronous cases, let's just mark the document loader as a client redirect whether it's the provisional or policy document loader. Covered by a new API test. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadPostRequest): 2018-01-12 Dean Jackson <dino@apple.com> Use a helper function for checked arithmetic in WebGL validation https://bugs.webkit.org/show_bug.cgi?id=181620 <rdar://problem/36485879> Reviewed by Eric Carlson. Eric recommended using a templated helper function to do a common arithmetic check in WebGL validation. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateIndexArrayConservative): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper. (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise): (WebCore::WebGLRenderingContextBase::validateDrawArrays): (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): * html/canvas/WebGLRenderingContextBase.h: 2018-01-12 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] CTFontCopyDefaultCascadeListForLanguages() can return nullptr https://bugs.webkit.org/show_bug.cgi?id=181615 <rdar://problem/36334637> Reviewed by Jon Lee. Speculative fix. We are getting crash reports saying that this call can return nullptr, and we don't check for it. No new tests because I couldn't find the specific input that causes it to return nullptr. (I tried running this code with every 0, 1, and 2 length locale string, every weight value, and every italic value, and couldn't get it to crash. I also inspected the code to figure out what values would cause it to return nullptr, and I couldn't find anything other than if the system has a totally busted font setup.) * platform/graphics/cocoa/FontDescriptionCocoa.cpp: (WebCore::SystemFontDatabase::computeCascadeList): 2018-01-11 Dean Jackson <dino@apple.com> [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors https://bugs.webkit.org/show_bug.cgi?id=181558 <rdar://problem/36189833> Reviewed by Eric Carlson. Very large element indices in the ELEMENT_ARRAY_BUFFER meant that our simulated vertexAttrib0 buffer might be too large. We need to check for out-of-memory, but we can also detect some of the issues earlier in our validation code. Additionally, make sure that we don't accidentally cast an unsigned to a signed. Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation code to look for overflow, rather than relying on looking for sign changes. * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise): (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate. (WebCore::WebGLRenderingContextBase::drawElements): (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and use GC3Duint, since that's what the indicies are. (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto. (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate. (WebCore::WebGLRenderingContextBase::drawElementsInstanced): * html/canvas/WebGLRenderingContextBase.h: 2018-01-12 Wenson Hsieh <wenson_hsieh@apple.com> Large in-place attachment elements cause the document width to expand when inserted https://bugs.webkit.org/show_bug.cgi?id=181614 Reviewed by Dan Bernstein. Make in-place images and videos have a max-width of 100%, so that large attachments aren't inserted with full display size, causing the document and viewport width to expand. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary): 2018-01-12 Keith Rollin <krollin@apple.com> Logged JSON should escape "'s and \'s in strings. https://bugs.webkit.org/show_bug.cgi?id=181608 Reviewed by Brent Fulgham. No new tests -- no new functionality, just changed logging. The efficacy of the logging was verified by inspecting its output. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): 2018-01-12 Dean Jackson <dino@apple.com> drawElements should be invalid if vertexAttrib0 doesn't have data https://bugs.webkit.org/show_bug.cgi?id=181609 <rdar://problem/36392883> Reviewed by Antoine Quint. If a vertex attribute has been enabled, but no data provided, then draw validation should fail. Test: fast/canvas/webgl/drawElements-empty-vertex-data.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateVertexAttributes): If there were never any data in the vertex buffer, then we incorrectly compared with 0. 2018-01-12 Youenn Fablet <youenn@apple.com> FormDataElement::lengthInBytes should use ThreadableBlobRegistry https://bugs.webkit.org/show_bug.cgi?id=181554 Reviewed by Chris Dumez. Covered by updated test. Fix blobRegistry() use and add support for creating a response that may trigger the issue. * platform/network/FormData.cpp: (WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate in case this is called from workers. * Modules/fetch/FetchBody.h: * Modules/fetch/FetchResponse.h: * fileapi/Blob.h: * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse): * testing/ServiceWorkerInternals.h: * testing/ServiceWorkerInternals.idl: 2018-01-12 Jer Noble <jer.noble@apple.com> Wrap CDMFairPlayStreaming and related classes in ENABLE(ENCRYPTED_MEDIA) checks https://bugs.webkit.org/show_bug.cgi?id=181602 Reviewed by Maciej Stachowiak. * platform/graphics/avfoundation/CDMFairPlayStreaming.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: 2018-01-12 Youenn Fablet <youenn@apple.com> WebProcess should pass the registration identifier and not the worker identifier for fetch events https://bugs.webkit.org/show_bug.cgi?id=181591 Reviewed by Chris Dumez. Test: http/wpt/service-workers/update-service-worker.https.html Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest): * loader/ResourceLoaderOptions.h: * loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::prepareFetch): (WebCore::CachedResourceLoader::determineRevalidationPolicy const): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded): (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData): (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted. * loader/cache/CachedResourceRequest.h: * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): (WebCore::WorkerScriptLoader::loadAsynchronously): * workers/service/server/SWServer.cpp: (WebCore::SWServer::activeWorkerFromRegistrationID): * workers/service/server/SWServer.h: 2018-01-12 Fujii Hironori <Hironori.Fujii@sony.com> [Win][CMake] Remove all-in-one file for WebCore DerivedSources https://bugs.webkit.org/show_bug.cgi?id=181582 Reviewed by Alex Christensen. Those source files are compiled in unified source build nowadays. No new tests (No behavior change) * CMakeLists.txt: Removed calling PROCESS_ALLINONE_FILE. * DerivedSources.cpp: Removed. * WebCoreMacros.cmake: Removed a macro PROCESS_ALLINONE_FILE. 2018-01-12 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo][CMake] Use ${CURL_LIBRARY} instead of specifying the library name libcurl_imp explicitly https://bugs.webkit.org/show_bug.cgi?id=181578 Reviewed by Alex Christensen. vcpkg has libcurl.lib, not libcurl_imp.lib. No new tests because no behavior change. * PlatformWinCairo.cmake: Link ${CURL_LIBRARY} instead of libcurl_imp. 2018-01-12 Jer Noble <jer.noble@apple.com> WebGL video texture black in Safari 11.0.2 and wrong colored in Safari Preview 11.1 https://bugs.webkit.org/show_bug.cgi?id=181445 <rdar://problem/36383183> Reviewed by Dean Jackson. Tests: added compile-time correctness tests for YCbCrMatrix values. Perform the derivation from YCbCr coefficients into matrices in constexpr expressions at compile-time. This allows us to also perform compile-time correctness checks to catch regressions which may cause incorrect color conversions. Since we now have general-purpose derivation of matrix values from coefficients, adding missing specificed matrices is trivial, so add support for SMPTE 240M and BT.2020 matrices. * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::GLfloatColor::GLfloatColor): (WebCore::GLfloatColor::abs): (WebCore::GLfloatColor::isApproximatelyEqualTo const): (WebCore::YCbCrMatrix::operator Vector<GLfloat> const): (WebCore::YCbCrMatrix::YCbCrMatrix): (WebCore::YCbCrMatrix::operator* const): (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction): 2018-01-12 Antoine Quint <graouts@apple.com> Add support for the frames() timing function https://bugs.webkit.org/show_bug.cgi?id=181585 <rdar://problem/36463317> Reviewed by Dean. Implement the frames() timing function as specified in the CSS Timing Functions Level 1 specification, specifically https://www.w3.org/TR/css-timing-1/#frames-timing-functions. A frames timing function is a type of timing function that divides the input time into a specified number of intervals of equal length. Test: transitions/frames-timing-function.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::createTimingFunctionValue): * css/CSSTimingFunctionValue.cpp: (WebCore::CSSFramesTimingFunctionValue::customCSSText const): (WebCore::CSSFramesTimingFunctionValue::equals const): * css/CSSTimingFunctionValue.h: * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationTimingFunction): * css/CSSValue.cpp: (WebCore::CSSValue::equals const): (WebCore::CSSValue::cssText const): (WebCore::CSSValue::destroy): * css/CSSValue.h: (WebCore::CSSValue::isFramesTimingFunctionValue const): * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeSteps): (WebCore::consumeFrames): (WebCore::consumeAnimationTimingFunction): * platform/animation/TimingFunction.cpp: (WebCore::operator<<): (WebCore::TimingFunction::transformTime const): * platform/animation/TimingFunction.h: (WebCore::TimingFunction::isFramesTimingFunction const): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::animationHasFramesTimingFunction): (WebCore::GraphicsLayerCA::animationCanBeAccelerated const): 2018-01-12 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r226721. https://bugs.webkit.org/show_bug.cgi?id=181583 Lets do a slightly different fix (Requested by anttik on #webkit). Reverted changeset: "REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%" https://bugs.webkit.org/show_bug.cgi?id=181460 https://trac.webkit.org/changeset/226721 2018-01-11 Keith Miller <keith_miller@apple.com> Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION https://bugs.webkit.org/show_bug.cgi?id=181573 Reviewed by Simon Fraser. * Configurations/FeatureDefines.xcconfig: 2018-01-11 Jiewen Tan <jiewen_tan@apple.com> [WebAuthN] Import a CBOR coder from Chromium https://bugs.webkit.org/show_bug.cgi?id=181522 <rdar://problem/36055729> Reviewed by Brent Fulgham. This patch imports a CBOR coder including encoder and decoder from Chromium. CBOR encoder is needed for WebAuthN to encode attestation object into binaries. When supporting extensions in the future, CBOR encoder/decoder will be needed as well. Implementating and maintaining a fully-fledged CBOR coder doesn't seem to align with WebKit's best interests. Therefore, importing a most suitable third party implementation will be wise. In this patch, it fully integrate the whole coder into our codebase. Those changes includes: 1. Substitute data structures that enjoy a better WTF version. 2. Replacing marcos. 3. Implementating workarounds for some functionalities that we lack fundamental types' support. 4. Changing the coding style to match ours. This patch doesn't intend to improve the logic of the original codebase. Hence some of the coding logic might not match what WebKit ususally has. Here is a full list of Chromium changes that constructed this CBOR coder in chronological order: 6efcf495521d18d060027762f48bb292d6979136, 9eb43fd347890b4c6cf54c4bd7ec1bbb88e381e1, 31c85e74fd567772f18e0a41be468d04af721f21, 68672fdcad280a8ff69b91927d38d0eabf2c87f2, 0ca8667c0584fb21c0748ebd7468d32889759a07, df763d790d7e45d70116bdefacbfd4f9faa8995e, 6d30c4a621c65314db63eb56e87c19ab75627b26, 50fe92953f4739f17a62303fedbf8db9234317c8, 47be22c3603424d1832d046a348ff3f982500288, 98a59e46948b2c71608926004fac8192b0ff2208, 07540c6d850ed6e0fa508d63c20a8ce96d751de6, 06ae32d640c8e4b86ea8914a80ee419ea16e56d8. Covered by API tests. * Modules/webauthn/cbor/CBORBinary.h: Added. * Modules/webauthn/cbor/CBORReader.cpp: Added. (cbor::CBORReader::CBORReader): (cbor::CBORReader::~CBORReader): (cbor::CBORReader::read): (cbor::CBORReader::decodeCBOR): (cbor::CBORReader::readVariadicLengthInteger): (cbor::CBORReader::decodeValueToNegative): (cbor::CBORReader::decodeValueToUnsigned): (cbor::CBORReader::readSimpleValue): (cbor::CBORReader::readString): Workarounds applied. (cbor::CBORReader::readBytes): (cbor::CBORReader::readCBORArray): (cbor::CBORReader::readCBORMap): (cbor::CBORReader::canConsume): (cbor::CBORReader::checkMinimalEncoding): (cbor::CBORReader::checkExtraneousData): (cbor::CBORReader::checkDuplicateKey): (cbor::CBORReader::hasValidUTF8Format): Workarounds applied. (cbor::CBORReader::checkOutOfOrderKey): (cbor::CBORReader::getErrorCode): (cbor::CBORReader::errorCodeToString): * Modules/webauthn/cbor/CBORReader.h: Added. * Modules/webauthn/cbor/CBORValue.cpp: Added. (cbor::CBORValue::CBORValue): (cbor::CBORValue::operator=): (cbor::CBORValue::~CBORValue): (cbor::CBORValue::clone const): (cbor::CBORValue::getInteger const): (cbor::CBORValue::getUnsigned const): (cbor::CBORValue::getNegative const): (cbor::CBORValue::getString const): (cbor::CBORValue::getByteString const): (cbor::CBORValue::getArray const): (cbor::CBORValue::getMap const): (cbor::CBORValue::getSimpleValue const): (cbor::CBORValue::internalMoveConstructFrom): (cbor::CBORValue::internalCleanup): * Modules/webauthn/cbor/CBORValue.h: Added. * Modules/webauthn/cbor/CBORWriter.cpp: Added. (cbor::CBORWriter::~CBORWriter): (cbor::CBORWriter::write): (cbor::CBORWriter::CBORWriter): (cbor::CBORWriter::encodeCBOR): Workarounds applied. (cbor::CBORWriter::startItem): (cbor::CBORWriter::setAdditionalInformation): (cbor::CBORWriter::setUint): (cbor::CBORWriter::getNumUintBytes): * Modules/webauthn/cbor/CBORWriter.h: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: 2018-01-11 Chris Dumez <cdumez@apple.com> Setting Window.opener to null should disown its opener https://bugs.webkit.org/show_bug.cgi?id=181505 <rdar://problem/36443151> Reviewed by Ryosuke Niwa. Setting Window.opener to null should disown its opener as per: - https://html.spec.whatwg.org/#dom-opener With this change, tabs opened by clicking link inside Gmail no longer have the Gmail window as opener. Tests: fast/dom/Window/window-opener-set-to-null.html fast/dom/Window/window-opener-shadowing.html * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::setOpener): * page/DOMWindow.cpp: (WebCore::DOMWindow::disownOpener): * page/DOMWindow.h: * page/DOMWindow.idl: 2018-01-11 Myles C. Maxfield <mmaxfield@apple.com> [Cocoa] Star character disappears when bolded https://bugs.webkit.org/show_bug.cgi?id=181568 <rdar://problem/18755569> Reviewed by Simon Fraser. We had some code in ComplexTextController to ask the FontCache for a font, given the name of a particular font CoreText used inside a CTRun. This is wrong for two reasons: fonts are not identifiable by PostScript name (in the general case), and because the lookup procedure requires a FontDescription, the result may yield a font that is not the one looked up. The goal of this code was simply to preserve the rendering mode of the font, but we removed support for these rendering modes years ago. So the solution is to skip that lookup and use the CoreText font directly. Test: fast/text/unknown-font.html * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): 2018-01-11 Keith Rollin <krollin@apple.com> Add optional logging of ITP-related user interaction information https://bugs.webkit.org/show_bug.cgi?id=181556 Reviewed by Brent Fulgham. In order to support the tracking of the efficacy of Intelligent Tracking Protection, add some logging indicating when the user interacts with a page in a way that affects cookie partitioning. This logging is off by default, and is enabled with `defaults write -g WebKitLogCookieInformation -bool true`. No new tests -- no changed functionality. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): * loader/ResourceLoadObserver.h: (WebCore::ResourceLoadObserver::shouldLogUserInteraction const): (WebCore::ResourceLoadObserver::setShouldLogUserInteraction): 2018-01-11 James Craig <jcraig@apple.com> AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet https://bugs.webkit.org/show_bug.cgi?id=168447 <rdar://problem/30559874> Reviewed by Simon Fraser. Double-invert video when platform "invert colors" setting is enabled. Behavior matches current "Smart Invert" feature of Safari Reader on macOS/iOS and other iOS native apps. Tests: accessibility/smart-invert-reference.html accessibility/smart-invert.html * Modules/modern-media-controls/controls/media-controls.css: (@media (inverted-colors)): (:host): (picture): * css/html.css: (@media (inverted-colors)): (video): 2018-01-11 Wenson Hsieh <wenson_hsieh@apple.com> Don't load inline data when requesting info for an attachment element backed by a file path https://bugs.webkit.org/show_bug.cgi?id=181550 Reviewed by Tim Horton. When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary, since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to simply send the file path to the UI process and have the UI process read the contents of the path as a memory- mapped NSData. This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file path is present, and no inline data was specified. Covered by existing API tests. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::requestInfo): 2018-01-10 Ryosuke Niwa <rniwa@webkit.org> Make elements of zero width or height focusable https://bugs.webkit.org/show_bug.cgi?id=181516 Reviewed by Chris Dumez. Don't check render box's size or bounding rect when deciding whether an element is focusable. New behavior matches that of Firefox and Chrome. Test: fast/events/focus-zero-size-element.html * dom/Element.cpp: (WebCore::Element::isFocusable): Only update the style. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::isFocusable const): Deleted. * html/HTMLFormControlElement.h: * mathml/MathMLElement.cpp: (WebCore::MathMLElement::isFocusable const): Deleted. As far as I can tell, no math ml element is focusable. * mathml/MathMLElement.h: * svg/SVGAElement.cpp: (WebCore::SVGAElement::isFocusable const): Deleted. * svg/SVGAElement.h: 2018-01-11 Filip Pizlo <fpizlo@apple.com> Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes https://bugs.webkit.org/show_bug.cgi?id=181543 Rubber stamped by Michael Saboff. No new tests because I'm just renaming things. * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h. * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed. * bindings/js/DOMGCOutputConstraint.cpp: 2018-01-11 Alex Christensen <achristensen@webkit.org> REGRESSION(r225003): Loading hangs in environments where dispatch_async does not work https://bugs.webkit.org/show_bug.cgi?id=181553 <rdar://problem/35733938> Reviewed by Eric Carlson. There is an environment where dispatch_async does not work, but performSelectorOnMainThread works. r225003 broke loading in this environment. This fixes it and updates the test that r225003 fixed. It failed sometimes because loading was happening in a different order than html parsing, so I made the test not depend on html parsing timing by updating media/video-src-remove.html. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]): 2018-01-11 Dean Jackson <dino@apple.com> Rolling out 226814. It crashes on some bots. 2018-01-11 Dean Jackson <dino@apple.com> [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors https://bugs.webkit.org/show_bug.cgi?id=181558 <rdar://problem/36189833> Reviewed by Eric Carlson. Very large element indices in the ELEMENT_ARRAY_BUFFER meant that our simulated vertexAttrib0 buffer might be too large. We need to check for out-of-memory, but we can also detect some of the issues earlier in our validation code. Additionally, make sure that we don't accidentally cast an unsigned to a signed. Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation code to look for overflow, rather than relying on looking for sign changes. * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto. * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise): (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate. (WebCore::WebGLRenderingContextBase::drawElements): (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and use GC3Duint, since that's what the indicies are. (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto. (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate. (WebCore::WebGLRenderingContextBase::drawElementsInstanced): * html/canvas/WebGLRenderingContextBase.h: 2018-01-11 Chris Dumez <cdumez@apple.com> ASSERTION FAILED: registration in WebCore::SWServerWorker::skipWaiting() https://bugs.webkit.org/show_bug.cgi?id=181222 <rdar://problem/36332686> Reviewed by Youenn Fablet. Replace assertion in SWServerWorker::skipWaiting() that assumes the worker has a registration. Nowadays, a SWServerWorker can stay alive for a short period without having a registration, while it is terminating. No new tests, unskipped existing test. * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::skipWaiting): 2018-01-11 Antti Koivisto <antti@apple.com> Don't call RenderElement::setStyle when nothing changes https://bugs.webkit.org/show_bug.cgi?id=181530 Reviewed by Zalan Bujtas. * style/StyleChange.h: Remove 'Force' value. This essentially meant 'compute style for all descendants and call setStyle unconditionally'. Using this value lost information about whether anything actually changed in a particular style as it was automatically inherited by all descendants. The 'compute all descendants' part of the behavior is what is actually needed. Instead add separate DescendantsToResolve enum for communicating what else to compute. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::Parent::Parent): (WebCore::Style::computeDescendantsToResolve): Figure out which descendants will need resolving based on how the current elements style changed. (WebCore::Style::TreeResolver::resolveElement): (WebCore::Style::TreeResolver::createAnimatedElementUpdate): (WebCore::Style::TreeResolver::pushParent): (WebCore::Style::shouldResolveElement): Use DescendantsToResolve as input. (WebCore::Style::TreeResolver::resolveComposedTree): * style/StyleTreeResolver.h: * style/StyleUpdate.h: (WebCore::Style::ElementUpdates::ElementUpdates): Add DescendantsToResolve. 2018-01-11 Wenson Hsieh <wenson_hsieh@apple.com> Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob https://bugs.webkit.org/show_bug.cgi?id=181497 Reviewed by Tim Horton. Refactor drag initiation with DOMFile-backed attachment elements. See WebKit ChangeLog for more information. No change in behavior; promised blob dragging covered by WKAttachment API tests. * loader/EmptyClients.cpp: * page/DragClient.h: (WebCore::DragClient::prepareToDragPromisedBlob): Deleted. * page/DragController.cpp: (WebCore::DragController::startDrag): (WebCore::DragController::doImageDrag): (WebCore::DragController::doSystemDrag): (WebCore::DragController::promisedBlobInfo): (WebCore::DragController::dragAttachmentElement): Deleted. * page/DragController.h: * platform/DragItem.h: (WebCore::DragItem::encode const): (WebCore::DragItem::decode): 2018-01-11 Youenn Fablet <youenn@apple.com> RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin https://bugs.webkit.org/show_bug.cgi?id=180851 Reviewed by Eric Carlson. Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access. For any such client origin, PeerConnection objects ICE candidate filtering is disabled. ICE candidate filtering is reset whenever navigating/reloading the page. * Modules/mediastream/RTCController.cpp: (WebCore::RTCController::reset): (WebCore::matchDocumentOrigin): (WebCore::RTCController::shouldDisableICECandidateFiltering): (WebCore::RTCController::add): (WebCore::RTCController::disableICECandidateFilteringForAllOrigins): (WebCore::RTCController::disableICECandidateFiltering): (WebCore::RTCController::enableICECandidateFiltering): * Modules/mediastream/RTCController.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::allow): * page/Page.cpp: (WebCore::Page::disableICECandidateFiltering): * testing/Internals.cpp: (WebCore::Internals::setICECandidateFiltering): 2018-01-11 Ali Juma <ajuma@chromium.org> window.visualViewport should behave as [SameObject] https://bugs.webkit.org/show_bug.cgi?id=181548 Reviewed by Chris Dumez. Add 'GenerateIsReachable' to VisualViewport so that window.visualViewport's JS wrapper object doesn't get garbage collected too soon. Test: fast/visual-viewport/visual-viewport-same-object.html * page/VisualViewport.idl: 2018-01-11 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Extract multipart handling from ResourceHandle to CurlRequest. https://bugs.webkit.org/show_bug.cgi?id=181506 Reviewed by Alex Christensen. Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask. No new tests because no new behavior. * platform/Curl.cmake: * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp. (WebCore::CurlMultipartHandle::createIfNeeded): (WebCore::CurlMultipartHandle::extractBoundary): (WebCore::CurlMultipartHandle::extractBoundaryFromContentType): (WebCore::CurlMultipartHandle::CurlMultipartHandle): (WebCore::CurlMultipartHandle::didReceiveData): (WebCore::CurlMultipartHandle::didComplete): (WebCore::CurlMultipartHandle::processContent): (WebCore::CurlMultipartHandle::checkForBoundary): (WebCore::CurlMultipartHandle::matchedLength): (WebCore::CurlMultipartHandle::parseHeadersIfPossible): * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h. (WebCore::CurlMultipartHandle::~CurlMultipartHandle): * platform/network/curl/CurlMultipartHandleClient.h: Added. (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::CurlRequest): (WebCore::CurlRequest::didReceiveHeader): (WebCore::CurlRequest::didReceiveData): (WebCore::CurlRequest::didReceiveHeaderFromMultipart): (WebCore::CurlRequest::didReceiveDataFromMultipart): (WebCore::CurlRequest::didCompleteTransfer): (WebCore::CurlRequest::finalizeTransfer): (WebCore::CurlRequest::invokeDidReceiveResponseForFile): (WebCore::CurlRequest::invokeDidReceiveResponse): (WebCore::CurlRequest::completeDidReceiveResponse): * platform/network/curl/CurlRequest.h: (WebCore::CurlRequest::create): * platform/network/curl/ResourceHandleCurlDelegate.cpp: (WebCore::ResourceHandleCurlDelegate::createCurlRequest): (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse): (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer): (WebCore::ResourceHandleCurlDelegate::curlDidComplete): * platform/network/curl/ResourceHandleCurlDelegate.h: 2018-01-11 Zalan Bujtas <zalan@apple.com> RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle. https://bugs.webkit.org/show_bug.cgi?id=181513 <rdar://problem/36367085> Reviewed by Antti Koivisto. This patch ensures that we use a valid RenderTreeBuilder even when Document::resolveStyle (incorrectly) triggers tree mutation. It can be reverted soon after the incorrect mutations are taken care of. Test: fast/forms/button-set-text-crash.html * rendering/RenderButton.cpp: (WebCore::RenderButton::setText): * rendering/RenderMenuList.cpp: (RenderMenuList::setText): 2018-01-11 Antoine Quint <graouts@apple.com> Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user https://bugs.webkit.org/show_bug.cgi?id=181547 <rdar://problem/35947650> Reviewed by Eric Carlson. Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS, we only listen to such events when controls are visible to the user. In other words, the MediaControls need to have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on MediaControls such that it can tell the MediaController that the "visible" property changed. With this message, MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which lets AirplaySupport disable itself when controls are no longer visible. Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html * Modules/modern-media-controls/controls/media-controls.js: (MediaControls.prototype.set visible): * Modules/modern-media-controls/media/airplay-support.js: (AirplaySupport.prototype.controlsUserVisibilityDidChange): * Modules/modern-media-controls/media/media-controller-support.js: (MediaControllerSupport.prototype.controlsUserVisibilityDidChange): * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype.mediaControlsVisibilityDidChange): (MediaController.prototype.mediaControlsFadedStateDidChange): (MediaController.prototype._controlsUserVisibilityDidChange): 2018-01-11 Antoine Quint <graouts@apple.com> [iOS] There should be no controls markup generated in fullscreen https://bugs.webkit.org/show_bug.cgi?id=181540 <rdar://problem/35060379> Reviewed by Eric Carlson. We completely forgo the display of any content when fullscreen on iOS by setting the "visible" flag to "false" on the MediaControls, which will prevent any DOM content from being added. * Modules/modern-media-controls/media/media-controller.js: (MediaController.prototype.handleEvent): (MediaController.prototype._updateiOSFullscreenProperties): (MediaController): (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted. 2018-01-11 Alex Christensen <achristensen@webkit.org> Revert changes accidentally committed with r226789. https://bugs.webkit.org/show_bug.cgi?id=181423 I had some local changes I did not mean to commit. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (scheduledWithCustomRunLoopMode): (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]): (WebCore::if): Deleted. (WebCore::>::fromCallable): Deleted. 2018-01-10 Simon Fraser <simon.fraser@apple.com> On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed https://bugs.webkit.org/show_bug.cgi?id=181511 rdar://problem/33741427 Reviewed by Zalan Bujtas. When reverting "client coordinates are relative to layout viewport" in r219829 I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there). Covered by existing tests. * page/FrameView.cpp: (WebCore::FrameView::documentToClientOffset const): 2018-01-11 Youenn Fablet <youenn@apple.com> Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default https://bugs.webkit.org/show_bug.cgi?id=181480 Reviewed by Eric Carlson. No change of behavior. * page/RuntimeEnabledFeatures.h: Set default value to false. 2018-01-11 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Support moving attachment elements in editable areas using drag and drop https://bugs.webkit.org/show_bug.cgi?id=181337 <rdar://problem/36324813> Reviewed by Tim Horton. Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag and drop behaves correctly. See per-change comments for more detail. Tests: WKAttachmentTests.DragInPlaceVideoAttachmentElement WKAttachmentTests.MoveAttachmentElementAsIconByDragging WKAttachmentTests.MoveInPlaceAttachmentElementByDragging * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::getPasteboardTypesAndDataForAttachment): Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization we can re-enable after investigation in a subsequent patch. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary): Add `draggable=false` to the image element of an in-place attachment element. * page/DragController.cpp: (WebCore::enclosingAttachmentElement): (WebCore::DragController::draggableElement const): Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well as the startElement's shadow host. (WebCore::DragController::startDrag): Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no longer correct, since attachments may now be displayed in-place. Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start. 2018-01-04 Filip Pizlo <fpizlo@apple.com> CodeBlocks should be in IsoSubspaces https://bugs.webkit.org/show_bug.cgi?id=180884 Reviewed by Saam Barati. No new tests because no new behavior. Adopting new parallel constraint API, so that more of the logic of doing parallel constraint solving is shared between the DOM's output constraints and JSC's output constraints. * bindings/js/DOMGCOutputConstraint.cpp: (WebCore::DOMGCOutputConstraint::executeImpl): (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted. (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted. * bindings/js/DOMGCOutputConstraint.h: 2018-01-11 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Support dragging attachment elements out as files on iOS https://bugs.webkit.org/show_bug.cgi?id=181199 <rdar://problem/36299316> Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro. Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles) from attachment elements on iOS for Mail. See below for more detail. Tests: WKAttachmentTestsIOS.DragAttachmentInsertedAsData WKAttachmentTestsIOS.DragAttachmentInsertedAsFile * page/DragController.cpp: (WebCore::DragController::platformContentTypeForBlobType const): (WebCore::DragController::dragAttachmentElement): * page/DragController.h: * page/mac/DragControllerMac.mm: (WebCore::DragController::platformContentTypeForBlobType const): Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume. * platform/ios/WebItemProviderPasteboard.h: * platform/ios/WebItemProviderPasteboard.mm: Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting- conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider pasteboard currently checks to see whether the info contains an object or a type and data. This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are three implementations below. (-[WebItemProviderDataRegistrar initWithData:type:]): (-[WebItemProviderDataRegistrar typeIdentifier]): (-[WebItemProviderDataRegistrar data]): (-[WebItemProviderDataRegistrar typeIdentifierForClient]): (-[WebItemProviderDataRegistrar dataForClient]): (-[WebItemProviderDataRegistrar registerItemProvider:]): (-[WebItemProviderDataRegistrar description]): A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a WebItemProviderRegistrationInfo with both a type and data, but no representing object. (-[WebItemProviderWritableObjectRegistrar initWithObject:]): (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]): (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]): (-[WebItemProviderWritableObjectRegistrar description]): The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This replaces a WebItemProviderRegistrationInfo with only a representing object. (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]): (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]): (-[WebItemProviderPromisedFileRegistrar description]): (-[WebItemProviderRegistrationInfoList addData:forType:]): (-[WebItemProviderRegistrationInfoList addRepresentingObject:]): (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]): Helper methods to add new registrars to a registration info list. (-[WebItemProviderRegistrationInfoList itemAtIndex:]): (-[WebItemProviderRegistrationInfoList enumerateItems:]): (-[WebItemProviderRegistrationInfoList itemProvider]): (-[WebItemProviderRegistrationInfoList description]): (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted. (-[WebItemProviderRegistrationInfo representingObject]): Deleted. (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted. 2018-01-11 Michael Saboff <msaboff@apple.com> Add a DOM gadget for Spectre testing https://bugs.webkit.org/show_bug.cgi?id=181351 Reviewed by Ryosuke Niwa. This change is used to test Spectre mitigations. Added a new DOM class to test for Spectre issues in the DOM layer. This additional functionality is disabled by default and must be enabled through the JSC option "enableSpectreGadgets". * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/SpectreGadget.cpp: Added. (WebCore::SpectreGadget::SpectreGadget): (WebCore::SpectreGadget::create): (WebCore::SpectreGadget::setReadLength): (WebCore::SpectreGadget::charCodeAt): (WebCore::SpectreGadget::clflushReadLength): * dom/SpectreGadget.h: Added. * dom/SpectreGadget.idl: Added. * page/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): * page/RuntimeEnabledFeatures.h: 2018-01-11 Philippe Normand <pnormand@igalia.com> [GTK] media/muted-video-is-playing-audio.html is timing out https://bugs.webkit.org/show_bug.cgi?id=163781 Reviewed by Carlos Garcia Campos. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto. 2018-01-10 Andy Estes <aestes@apple.com> [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent https://bugs.webkit.org/show_bug.cgi?id=181437 <rdar://problem/36376481> Reviewed by Tim Horton. Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise. Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html * DerivedSources.make: * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::merchantValidationCompleted): (WebCore::ApplePayPaymentHandler::validateMerchant): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp. (WebCore::MerchantValidationEvent::create): (WebCore::MerchantValidationEvent::MerchantValidationEvent): (WebCore::MerchantValidationEvent::eventInterface const): (WebCore::MerchantValidationEvent::complete): * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h. * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl. * Modules/paymentrequest/PaymentHandler.h: * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::completeMerchantValidation): * Modules/paymentrequest/PaymentRequest.h: * Modules/paymentrequest/PaymentRequest.idl: * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * dom/EventNames.in: 2018-01-10 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms Nhttps://bugs.webkit.org/show_bug.cgi?id=153088 Reviewed by Alex Christensen. No new tests because it's covered by existing tests. * platform/network/curl/CurlContext.cpp: (WebCore::CurlHandle::getHttpVersion): * platform/network/curl/CurlContext.h: * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::didReceiveHeader): * platform/network/curl/CurlResponse.h: (WebCore::CurlResponse::isolatedCopy const): * platform/network/curl/ResourceResponseCurl.cpp: (WebCore::ResourceResponse::ResourceResponse): (WebCore::ResourceResponse::setStatusLine): 2018-01-10 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION(r222507): Composition highlight doesn't render when using IME https://bugs.webkit.org/show_bug.cgi?id=181485 <rdar://problem/35896516> Reviewed by Ryosuke Niwa. Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground. Test: editing/marked-text-appearance.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintCompositionBackground): 2018-01-10 Youenn Fablet <youenn@apple.com> Use no-cache fetch mode when loading main documents with location.reload() https://bugs.webkit.org/show_bug.cgi?id=181285 Reviewed by Alex Christensen. Covered by rebased tests. Start to translate cache policy used for navigation as FetchOptions::Cache. This allows ensuring service workers receive the right cache mode when intercepting navigation loads. To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode. For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode, as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers. Keep reload mode for ReloadFromOrigin. * loader/DocumentLoader.cpp: (WebCore::toFetchOptionsCache): (WebCore::DocumentLoader::loadMainResource): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadFrameRequest): (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::defaultRequestCachingPolicy): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/NavigationScheduler.cpp: 2018-01-10 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r226667 and r226673. https://bugs.webkit.org/show_bug.cgi?id=181488 This caused a flaky crash. (Requested by mlewis13 on #webkit). Reverted changesets: "CodeBlocks should be in IsoSubspaces" https://bugs.webkit.org/show_bug.cgi?id=180884 https://trac.webkit.org/changeset/226667 "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces" https://bugs.webkit.org/show_bug.cgi?id=180884 https://trac.webkit.org/changeset/226673 2018-01-10 Antti Koivisto <antti@apple.com> REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8% https://bugs.webkit.org/show_bug.cgi?id=181460 <rdar://problem/36379776> Reviewed by Ryosuke Niwa. * css/parser/CSSParser.cpp: (WebCore::CSSParserContext::CSSParserContext): Don't do the expensive security origin test if the sheet base URL and document URL are identical. This is true for inline style and inline stylesheets. 2018-01-10 Antti Koivisto <antti@apple.com> Try to fix windows build. * css/RuleFeature.cpp: (WebCore::RuleFeatureSet::computeNextMatchElement): 2018-01-10 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderRuby's moveChildren logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181470 <rdar://problem/36397683> Reviewed by Antti Koivisto. This is about moving code, no cleanup and/or normalization (unfortunately it also means some temporary changes). No change in functionality. * rendering/RenderBlockFlow.h: * rendering/RenderRubyBase.cpp: (WebCore::RenderRubyBase::moveChildren): Deleted. (WebCore::RenderRubyBase::mergeChildrenWithBase): Deleted. (WebCore::RenderRubyBase::moveInlineChildren): Deleted. (WebCore::RenderRubyBase::moveBlockChildren): Deleted. * rendering/RenderRubyBase.h: * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::takeChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::moveRubyChildren): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren): (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren): (WebCore::RenderTreeBuilder::Ruby::moveChildren): (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal): (WebCore::RenderTreeBuilder::Ruby::insertChild): * rendering/updating/RenderTreeBuilderRuby.h: 2018-01-10 Philippe Normand <pnormand@igalia.com> [GStreamer] fix critical GObject warning Rubber-stamped by Carlos Garcia Campos. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): No need to resort to complicated things to get the element name... 2018-01-10 Philippe Normand <pnormand@igalia.com> [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html https://bugs.webkit.org/show_bug.cgi?id=181471 <rdar://problem/36402323> Reviewed by Carlos Garcia Campos. This patch mainly reduces the amount of playback state changes emitted by the GStreamer player to its client. Emitting those notifications too often has bad side effects. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages. (WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote. (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto. (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto. (WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit playback state change notification only when going to PLAYING. (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message. 2018-01-10 Youenn Fablet <youenn@apple.com> Add Service Worker CSP persistency https://bugs.webkit.org/show_bug.cgi?id=181434 Reviewed by Alex Christensen. Covered by manual testing. Future work on service worker test infrastructure should allow automating such tests. Add support for service worker CSP data persistency. Add a version parameter to increment each time the schema is changing. This allows the same store to be used by multiple WebKits. * workers/service/server/RegistrationDatabase.cpp: (WebCore::v1RecordsTableSchema): (WebCore::RegistrationDatabase::openSQLiteDatabase): (WebCore::RegistrationDatabase::doPushChanges): (WebCore::RegistrationDatabase::importRecords): 2018-01-10 Antti Koivisto <antti@apple.com> Invalidate current element style on class change accurately https://bugs.webkit.org/show_bug.cgi?id=181210 Reviewed by Zalan Bujtas. * css/DocumentRuleSets.cpp: (WebCore::DocumentRuleSets::collectFeatures const): (WebCore::DocumentRuleSets::subjectClassRules const): New rule set containing class rules affecting the subject element. (WebCore::DocumentRuleSets::ancestorClassRules const): * css/DocumentRuleSets.h: * css/RuleFeature.cpp: (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector): Classify selector components into various buckets based on the elements they match relative to the subject element. There are more categories than this patch strictly needs, for future use. (WebCore::RuleFeatureSet::collectFeatures): (WebCore::RuleFeatureSet::add): (WebCore::RuleFeatureSet::clear): (WebCore::RuleFeatureSet::shrinkToFit): * css/RuleFeature.h: * css/StyleResolver.h: (WebCore::StyleResolver::hasSelectorForClass const): Deleted. * style/ClassChangeInvalidation.cpp: (WebCore::Style::elementNeedsInvalidation): (WebCore::Style::ClassChangeInvalidation::computeInvalidation): Don't invalidate current element unconditionally on class change. Instead find the subject rulesets that might affect it use them to perform invalidation. (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets): (WebCore::Style::ClassChangeInvalidation::invalidateStyle): Deleted. (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle): Deleted. * style/ClassChangeInvalidation.h: (WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation): (WebCore::Style::ClassChangeInvalidation::~ClassChangeInvalidation): * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::classNamesAffectedByRules const): 2018-01-09 Antoine Quint <graouts@apple.com> [Web Animations] Expose the id property on Animation https://bugs.webkit.org/show_bug.cgi?id=181450 <rdar://problem/36383600> Reviewed by Dean Jackson. Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object passed to Element.animate(). All of the WPT tests related to this property are now passing. * animation/WebAnimation.h: * animation/WebAnimation.idl: * dom/Element.cpp: (WebCore::Element::animate): 2018-01-09 Chris Dumez <cdumez@apple.com> Make service workers behave correctly with regards to Page Cache https://bugs.webkit.org/show_bug.cgi?id=181446 <rdar://problem/36164291> Reviewed by Youenn Fablet. Make service workers behave correctly with regards to Page Cache: 1. If a document has an active service worker, do not let it go into PageCache 2. When a document goes into page cache, unregister it from the list of service worker clients 3. When a document is restored from page cache, add it nack to the list of service worker clients Tests: http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html http/tests/workers/service/no-page-cache-when-controlled.html http/tests/workers/service/other_resources/test.html * dom/Document.cpp: (WebCore::Document::suspend): (WebCore::Document::resume): * history/PageCache.cpp: (WebCore::canCacheFrame): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::serviceWorkerKey): * page/DiagnosticLoggingKeys.h: 2018-01-09 Chris Dumez <cdumez@apple.com> We should not return undefined for most properties of a detached Window https://bugs.webkit.org/show_bug.cgi?id=181416 <rdar://problem/36162489> Reviewed by Ryosuke Niwa. We should not return undefined for most properties on a detached Window. WebKit previously only exposed "closed" and "close" properties on detached / frameless windows. However, this does not match the HTML specification [1] or the behavior of Firefox and Chrome. Note that Chrome does not seem to fully follow the HTML specification either, it seems to treat detached windows the same way as cross-origin ones. As a result, it only exposed properties that are visible cross-origin when a window is detached / frameless. [1] https://html.spec.whatwg.org/#windowproxy-get No new tests, updated existingt tests. * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): (WebCore::JSDOMWindow::getOwnPropertySlot): (WebCore::JSDOMWindow::getOwnPropertySlotByIndex): 2018-01-09 Darin Adler <darin@apple.com> Further refinement to list item and counter code after "list-item" counter fix https://bugs.webkit.org/show_bug.cgi?id=181426 Reviewed by Zalan Bujtas. * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInheritCounter): Use auto. (WebCore::StyleBuilderCustom::applyValueCounter): Use auto, removed unneeded null checks for things that can never be null, moved the saturated addition here and got rid of the addIncrementValue function from CounterDirectives. Use the saturatedAddition function from SaturatedArithmetic.h instead of the much less efficient one that did the same thing, CounterDirectives::addClamped. * rendering/RenderCounter.cpp: (WebCore::listItemCounterDirectives): Use aggregate syntax for the return statements. (WebCore::planCounter): Changed to use a struct return value instead of two out arguments. Use the saturatedAddition function from SaturatedArithmetic.h instead of the much less efficient one that did the same thing, CounterDirectives::addClamped. (WebCore::findPlaceForCounter): Changed to use a struct return value instead of two out arguments. (WebCore::makeCounterNode): Updated for the above changes. Changed code to use add instead of both get and set. Updated to keep the counter maps inside the values of the "map of maps" instead of using a unique_ptr and allocating each one on the heap. (WebCore::destroyCounterNodeWithoutMapRemoval): Changed argument to a reference instead of a pointer. Updated for changes to the map. Use RefPtr more consistently. (WebCore::RenderCounter::destroyCounterNodes): Use iterators less. (WebCore::RenderCounter::destroyCounterNode): Ditto. (WebCore::RenderCounter::rendererRemovedFromTree): Add a check of hasCounterNodeMap here before calling destroyCounterNodes, so that function can assume the flag is true (both other callers already check it). (WebCore::updateCounters): Use auto and update for changes above. (WebCore::RenderCounter::rendererStyleChanged): Use modern for loops instead of iterators. (showCounterRendererTree): Use auto and udpate for changes above. * rendering/RenderListItem.cpp: (WebCore::enclosingList): Stop referring to elements as "nodes". Changed the local variable names for clarity. (WebCore::nextListItemHelper): Renamed from nextListItem since it's not intended to be called directly and we want to use a function pointer to nextListItem. Fixed the algorithm to correctly handle ad hoc "lists" that are not actually HTML list elements, using the definition in the enclosingList function as the previousListItem function already did. (WebCore::nextListItem): Updated for name changes. (WebCore::firstListItem): Renamed from nextListItem for clarity. (WebCore::previousListItem): Rewrote loop so it doesn't have to do things so strangely when we find another list. (WebCore::RenderListItem::updateItemValuesForOrderedList): Use auto and update local variable names. (WebCore::RenderListItem::itemCountForOrderedList): Ditto. (WebCore::RenderListItem::updateValueNow const): Rewrote to use an iterative algorithm instead of a recursive one. Fixes the FIXME here. (WebCore::RenderListItem::updateValue): Use m_valueWasSetExplicitly instead of m_explicitValue. (WebCore::RenderListItem::explicitValueChanged): Use auto and simplified the loop a bit. (WebCore::RenderListItem::setExplicitValue): Set m_valueWasSetExplicitly instead of m_explicitValue. (WebCore::previousOrNextItem): Deleted. (WebCore::RenderListItem::updateListMarkerNumbers): Streamlined the loop a bit and used a fucntion pointer to handle the two different directions. (WebCore::RenderListItem::isInReversedOrderedList const): Simplified by getting rid of an unneeded use of pointers and local variables. * rendering/RenderListItem.h: Use a boolean, m_valueWasSetExplicitly, instead of a separate optional m_explicitValue. * rendering/style/CounterDirectives.h: Since all the code in this file was rewritten, removed old copyrights. Deleted the addIncrementValue function, since it is clear enough in the one call site in the style builder. Deleted the addClamped function because it was just a much slower version of the saturatedAddition function. Made == and != into constexpr functions since they are simple enough to be. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::getCounterDirectives const): Deleted. Caller can handle this just fine without a helper function. * rendering/style/RenderStyle.h: Ditto. 2018-01-09 Myles C. Maxfield <mmaxfield@apple.com> font-display:fallback can cause a visual flash (which is supposed to be impossible) https://bugs.webkit.org/show_bug.cgi?id=181374 Reviewed by Simon Fraser. A FontCascade represents an entire font-family fallback list, but sometimes we need to pull out a single representative font from the list to calculate things like line height. Previously, if the first item in the font-family list was in the middle of being downloaded, this representative font was hardcoded to be Times. However, when actually laying out and drawing the glyphs, we have logic to skip the interstitial Times if there are any installed fonts present in the font-family list (so you wouldn't ever actually see Times). This means that line height (among other things) was being calculated as if Times was used, but in reality, some other font from the font-family list was being used. Alone, this isn't a huge problem, but font-display:fallback makes a font transition between "timed out" and "failed," and when the font hits the failed state, the representative font skips over the cancelled item and hits the next item in the fallback list. This means that line heights will change, which causes a visual flash, even when font-display:fallback is specified. The solution is simply to educate the logic which identifies this representative font so that it understands what to do for currently-loading fonts. Tests: fast/text/font-display/swap-flash.html * platform/graphics/FontCascadeFonts.h: (WebCore::FontCascadeFonts::primaryFont): * rendering/line/BreakingContext.h: (WebCore::textWidth): 2018-01-04 Filip Pizlo <fpizlo@apple.com> CodeBlocks should be in IsoSubspaces https://bugs.webkit.org/show_bug.cgi?id=180884 Reviewed by Saam Barati. No new tests because no new behavior. Adopting new parallel constraint API, so that more of the logic of doing parallel constraint solving is shared between the DOM's output constraints and JSC's output constraints. * bindings/js/DOMGCOutputConstraint.cpp: (WebCore::DOMGCOutputConstraint::executeImpl): (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted. (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted. * bindings/js/DOMGCOutputConstraint.h: 2018-01-08 Simon Fraser <simon.fraser@apple.com> Clean up Marquee-related enums https://bugs.webkit.org/show_bug.cgi?id=181347 Reviewed by Anders Carlsson. Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative values in the MarqueeDirection and do manual reverse direction mapping. Make some member functions of RenderMarquee private. Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so allows us to use modern initialization. No behavior change. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator MarqueeBehavior const): (WebCore::CSSPrimitiveValue::operator MarqueeDirection const): (WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted. (WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted. * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustRenderStyle): * rendering/RenderBox.cpp: (WebCore::RenderBox::sizesLogicalWidthToFitContent const): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderMarquee.cpp: (WebCore::RenderMarquee::RenderMarquee): (WebCore::reverseDirection): (WebCore::RenderMarquee::direction const): (WebCore::RenderMarquee::isHorizontal const): (WebCore::RenderMarquee::computePosition): (WebCore::RenderMarquee::start): (WebCore::RenderMarquee::updateMarqueePosition): (WebCore::RenderMarquee::updateMarqueeStyle): (WebCore::RenderMarquee::timerFired): * rendering/RenderMarquee.h: * rendering/style/RenderStyle.h: (WebCore::RenderStyle::marqueeBehavior const): (WebCore::RenderStyle::marqueeDirection const): (WebCore::RenderStyle::setMarqueeDirection): (WebCore::RenderStyle::setMarqueeBehavior): (WebCore::RenderStyle::initialMarqueeBehavior): (WebCore::RenderStyle::initialMarqueeDirection): * rendering/style/RenderStyleConstants.h: * rendering/style/StyleMarqueeData.cpp: (WebCore::StyleMarqueeData::StyleMarqueeData): * rendering/style/StyleMarqueeData.h: 2018-01-09 Jer Noble <jer.noble@apple.com> Many CVDisplayLink threads created and destroyed while watching a YouTube video https://bugs.webkit.org/show_bug.cgi?id=181396 Reviewed by Simon Fraser. When watching some YouTube videos (or any video with default controls), event handlers for the "timeupdate" event which use rAF will cause the underlying platform objects to be destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to excessive rAF platform object turnover. * platform/Logging.h: * platform/graphics/DisplayRefreshMonitor.h: (WebCore::DisplayRefreshMonitor::shouldBeTerminated const): * platform/graphics/DisplayRefreshMonitor.cpp: (WebCore::DisplayRefreshMonitor::displayDidRefresh): * platform/graphics/DisplayRefreshMonitorManager.cpp: (WebCore::DisplayRefreshMonitorManager::createMonitorForClient): (WebCore::DisplayRefreshMonitorManager::displayDidRefresh): 2018-01-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderElement addChild mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181451 <rdar://problem/36385562> Reviewed by Antti Koivisto. This is about moving code, no cleanup and/or normalization (unfortunately it also means some temporary changes). No change in functionality. * rendering/RenderElement.cpp: (WebCore::RenderElement::addChild): (WebCore::RenderElement::childRequiresTable const): Deleted. * rendering/RenderElement.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChildToRenderElement): (WebCore::RenderTreeBuilder::childRequiresTable): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation): (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): (WebCore::RenderTreeBuilder::Inline::newChildIsInline): (WebCore::newChildIsInline): Deleted. * rendering/updating/RenderTreeBuilderInline.h: 2018-01-09 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r226531. This caused test failures on macOS WK2. Reverted changeset: "Use no-cache fetch mode when loading main documents with location.reload()" https://bugs.webkit.org/show_bug.cgi?id=181285 https://trac.webkit.org/changeset/226531 2018-01-09 Michael Saboff <msaboff@apple.com> Unreviewed, rolling out r226600 and r226603 https://bugs.webkit.org/show_bug.cgi?id=181351 Add a DOM gadget for Spectre testing * dom/Comment.cpp: (WebCore::Comment::Comment): (WebCore::Comment::setReadLength): Deleted. (WebCore::Comment::charCodeAt): Deleted. (WebCore::Comment::clflushReadLength): Deleted. * dom/Comment.h: * dom/Comment.idl: * page/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): Deleted. * page/RuntimeEnabledFeatures.h: 2018-01-09 Don Olmstead <don.olmstead@sony.com> Add additional WEBCORE_EXPORTs https://bugs.webkit.org/show_bug.cgi?id=181414 Reviewed by Alex Christensen. No new tests. No change in behavior. * dom/Document.h: * dom/ViewportArguments.h: * page/DOMWindow.h: * page/FrameView.h: * page/PageOverlayController.h: * platform/ContextMenuItem.h: * platform/Pasteboard.h: * platform/SharedBuffer.h: * platform/UserAgent.h: * platform/graphics/GLContext.h: * platform/graphics/GraphicsContext.h: * platform/graphics/GraphicsLayerTransform.h: * platform/graphics/PlatformDisplay.h: * platform/graphics/cairo/BackingStoreBackendCairoImpl.h: * platform/graphics/cairo/PlatformContextCairo.h: * platform/graphics/cairo/RefPtrCairo.h: * platform/graphics/nicosia/NicosiaBuffer.h: * platform/graphics/nicosia/NicosiaPaintingEngine.h: * platform/graphics/texmap/TextureMapper.h: * platform/graphics/texmap/TextureMapperAnimation.h: * platform/graphics/texmap/TextureMapperBackingStore.h: * platform/graphics/texmap/TextureMapperFPSCounter.h: * platform/graphics/texmap/TextureMapperLayer.h: (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted. (WebCore::TextureMapperLayer::setID): Deleted. (WebCore::TextureMapperLayer::id): Deleted. (WebCore::TextureMapperLayer:: const): Deleted. (WebCore::TextureMapperLayer::setScrollClient): Deleted. (WebCore::TextureMapperLayer::setIsScrollable): Deleted. (WebCore::TextureMapperLayer::isScrollable const): Deleted. (WebCore::TextureMapperLayer::textureMapper const): Deleted. (WebCore::TextureMapperLayer::setTextureMapper): Deleted. (WebCore::TextureMapperLayer::drawsContent const): Deleted. (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted. (WebCore::TextureMapperLayer::size const): Deleted. (WebCore::TextureMapperLayer::opacity const): Deleted. (WebCore::TextureMapperLayer::transform const): Deleted. (WebCore::TextureMapperLayer::hasFilters const): Deleted. (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted. (WebCore::TextureMapperLayer::fixedToViewport const): Deleted. (WebCore::TextureMapperLayer::rootLayer const): Deleted. (WebCore::TextureMapperLayer::texture): Deleted. (WebCore::TextureMapperLayer::adjustedPosition const): Deleted. (WebCore::TextureMapperLayer::layerRect const): Deleted. (WebCore::TextureMapperLayer::State::State): Deleted. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h: * platform/graphics/texmap/TextureMapperTile.h: * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted. (WebCore::CoordinatedGraphicsLayer::id const): Deleted. (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted. (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted. * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h: (WebCore::CoordinatedImageBacking::id const): Deleted. * platform/graphics/texmap/coordinated/TiledBackingStore.h: * platform/graphics/texmap/coordinated/UpdateAtlas.h: * platform/network/AuthenticationChallengeBase.h: * platform/network/CredentialBase.h: * platform/network/ProtectionSpaceBase.h: * platform/network/curl/SocketStreamHandleImpl.h: * replay/UserInputBridge.h: 2018-01-09 Basuke Suzuki <Basuke.Suzuki@sony.com> [Curl] Move FormData related tasks into new CurlFormDataStream class. https://bugs.webkit.org/show_bug.cgi?id=181106 Reviewed by Alex Christensen. No new tests because no behavior change. * platform/Curl.cmake: * platform/network/curl/CurlFormDataStream.cpp: Added. (WebCore::CurlFormDataStream::CurlFormDataStream): (WebCore::CurlFormDataStream::~CurlFormDataStream): (WebCore::CurlFormDataStream::clean): (WebCore::CurlFormDataStream::shouldUseChunkTransfer): (WebCore::CurlFormDataStream::totalSize): (WebCore::CurlFormDataStream::computeContentLength): (WebCore::CurlFormDataStream::read): (WebCore::CurlFormDataStream::readFromFile): (WebCore::CurlFormDataStream::readFromData): * platform/network/curl/CurlFormDataStream.h: Renamed from Source/WebCore/platform/network/curl/FormDataStreamCurl.h. (WebCore::CurlFormDataStream::elementSize): (WebCore::CurlFormDataStream::totalReadSize): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::CurlRequest): (WebCore::CurlRequest::willSendData): (WebCore::CurlRequest::finalizeTransfer): (WebCore::CurlRequest::setupPUT): (WebCore::CurlRequest::setupPOST): (WebCore::CurlRequest::setupSendData): (WebCore::CurlRequest::resolveBlobReferences): Deleted. (WebCore::CurlRequest::setupFormData): Deleted. * platform/network/curl/CurlRequest.h: * platform/network/curl/FormDataStreamCurl.cpp: Removed. 2018-01-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181443 <rdar://problem/36380228> Reviewed by Antti Koivisto. This is about moving code, no cleanup and/or normalization (unfortunately it also means some temporary changes). No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/mathml/RenderMathMLFenced.cpp: (WebCore::RenderMathMLFenced::addChild): (WebCore::RenderMathMLFenced::createMathMLOperator): Deleted. (WebCore::RenderMathMLFenced::makeFences): Deleted. * rendering/mathml/RenderMathMLFenced.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::mathMLBuilder): 2018-01-09 Antti Koivisto <antti@apple.com> Blank page except for inner iframes because pending stylesheets cause style.isNotFinal() to be true https://bugs.webkit.org/show_bug.cgi?id=180940 <rdar://problem/36116507> Reviewed by Darin Adler. Test: http/tests/local/loading-stylesheet-import-remove.html If a <link> referencing a stylesheet containing an @import that was still loading was removed from the document, the loading state was never cleared. For head stylesheets this blocked rendering permanently. Test reduction by Justin Ridgewell. * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::removedFromAncestor): Test if the stylesheet it loading before clearing the pointer. 2018-01-09 Dan Bernstein <mitz@apple.com> Removed some empty directories that were left behind * Modules/indieui: Removed. * Modules/vibration: Removed. * platform/graphics/ca/mac: Removed. * platform/mediastream/gstreamer: Removed. 2018-01-09 Antoine Quint <graouts@apple.com> Refactor timing function solving code https://bugs.webkit.org/show_bug.cgi?id=181428 Reviewed by Dean Jackson. We have duplicated code to solve "cubic" and "steps" timing functions in AnimationBase and TextureMapperAnimation, and we will soon need similar code to deal with timing functions in Web Animations. We move this code into TimingFunction with a single transformTime() function that can be called directly on the timing function rather than having callers figure out what type timing functions are to solve them. No test as there shouldn't be any behavior change. * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::progress const): (WebCore::solveEpsilon): Deleted. (WebCore::solveCubicBezierFunction): Deleted. (WebCore::solveStepsFunction): Deleted. (WebCore::solveSpringFunction): Deleted. * platform/animation/TimingFunction.cpp: (WebCore::TimingFunction::transformTime const): * platform/animation/TimingFunction.h: * platform/graphics/texmap/TextureMapperAnimation.cpp: (WebCore::TextureMapperAnimation::apply): (WebCore::solveEpsilon): Deleted. (WebCore::solveCubicBezierFunction): Deleted. (WebCore::solveStepsFunction): Deleted. (WebCore::applyTimingFunction): Deleted. 2018-01-09 Michael Catanzaro <mcatanzaro@igalia.com> Unreviewed, silence -Wunused-parameter warning * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setupNewlyCreatedServiceWorker): 2018-01-09 Said Abou-Hallawa <sabouhallawa@apple.com> Check Image::m_image is not null in ImageLoader::decode() https://bugs.webkit.org/show_bug.cgi?id=180386 <rdar://problem/34634483> Reviewed by Tim Horton. Ensure ImageLoader::m_image is not null before referencing it. * loader/ImageLoader.cpp: (WebCore::ImageLoader::decode): 2018-01-09 Yusuke Suzuki <utatane.tea@gmail.com> [FreeType] Use FastMalloc for FreeType https://bugs.webkit.org/show_bug.cgi?id=181387 Reviewed by Michael Catanzaro. Add custom memory allocator for FreeType to use FastMalloc. * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: (WebCore::initializeFreeTypeLibrary): (WebCore::createFontCustomPlatformData): 2018-01-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderTable* addChild mutation logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181424 <rdar://problem/36368628> Reviewed by Antti Koivisto. This is about moving code, no cleanup and/or normalization (unfortunately it also means some temporary changes). Covered by existing tests. * rendering/RenderTable.cpp: (WebCore::RenderTable::addChild): * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChildToRenderTable): (WebCore::RenderTreeBuilder::insertChildToRenderTableSection): (WebCore::RenderTreeBuilder::insertChildToRenderTableRow): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::insertChild): * rendering/updating/RenderTreeBuilderTable.h: 2018-01-09 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Transition Render*::addChild() calls to RenderTreeBuilder::insertChildToRender*() https://bugs.webkit.org/show_bug.cgi?id=181407 <rdar://problem/36361176> Reviewed by Antti Koivisto. Eventually all mutation will be going through the RenderTreeBuilder. No change in functionality. * rendering/RenderGrid.cpp: (WebCore::RenderGrid::addChild): * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::rubyBaseSafe): * rendering/updating/RenderTreeBuilderBlockFlow.cpp: (WebCore::RenderTreeBuilder::BlockFlow::insertChild): * rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): 2018-01-09 Philippe Normand <pnormand@igalia.com> [GStreamer] Ensure SleepDisabler is not held by pages in page cache https://bugs.webkit.org/show_bug.cgi?id=180197 Reviewed by Eric Carlson. The sleep disabler is now checked again whenever the media player playback state or other characteristic has changed in the media engine. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged): Check if the sleep disabler state needs to be updated or not. (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto. (WebCore::HTMLMediaElement::shouldDisableSleep const): Enable sleep disabler for GTK and WPE ports. 2018-01-09 Philippe Normand <pnormand@igalia.com> [GStreamer] Missing notifications to player client https://bugs.webkit.org/show_bug.cgi?id=181432 Reviewed by Carlos Garcia Campos. We now properly emit playback state changes and characteristic updates to the client when the pipeline state changes and when audio/video tracks changes are detected. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): This debug message appears too often in logs. Demote. (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): Ditto. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Emit charasteristicChanged notification. (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto. (WebCore::MediaPlayerPrivateGStreamer::updateStates): Keep track of old and current pipeline state. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 2018-01-09 Youenn Fablet <youenn@apple.com> Add CSP support to service workers https://bugs.webkit.org/show_bug.cgi?id=181385 Reviewed by Chris Dumez. Covered by rebased tests. Added recovery of CSP information from WorkerScriptLoader. Added plumbing to pass the CSP information to Service Workers. Did not add persistency support for the CSP information as this requires changing the SQL database schema. This will be done in a follow-up. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::contentSecurityPolicy const): * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::finishedFetchingScript): (WebCore::SWClientConnection::failedFetchingScript): * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::jobFailedWithException): (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerContextData.cpp: (WebCore::ServiceWorkerContextData::isolatedCopy const): * workers/service/ServiceWorkerContextData.h: (WebCore::ServiceWorkerContextData::encode const): (WebCore::ServiceWorkerContextData::decode): * workers/service/ServiceWorkerFetchResult.h: (WebCore::ServiceWorkerFetchResult::encode const): (WebCore::ServiceWorkerFetchResult::decode): * workers/service/ServiceWorkerGlobalScope.cpp: (WebCore::ServiceWorkerGlobalScope::create): * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::notifyFinished): * workers/service/ServiceWorkerJobClient.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): (WebCore::ServiceWorkerThread::createWorkerGlobalScope): * workers/service/server/RegistrationDatabase.cpp: (WebCore::v1RecordsTableSchema): (WebCore::RegistrationDatabase::importRecords): * workers/service/server/SWServer.cpp: (WebCore::SWServer::updateWorker): (WebCore::SWServer::installContextData): * workers/service/server/SWServer.h: * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptFetchFinished): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::SWServerWorker): (WebCore::m_contentSecurityPolicy): (WebCore::SWServerWorker::contextData const): * workers/service/server/SWServerWorker.h: 2018-01-09 Antoine Quint <graouts@apple.com> Provide a method to obtain a CSS value from a RenderStyle by CSSPropertyID https://bugs.webkit.org/show_bug.cgi?id=181429 Reviewed by Antti Koivisto. The KeyframeEffect.getKeyframes() method from Web Animations requires that we return all styles applied at a given animation effect keyframe. When we parse keyframes, we create RenderStyle objects that are stored in a KeyframeList, as well as a list of CSSPropertyIDs that are animated. In order to provide the list of animated properties and their values when calling getKeyframes(), we need to be able to read back from the RenderStyle we create. As a first step towards this goal, we factor some code in ComputedStyleExtractor::propertyValue() out into a new method ComputedStyleExtractor::valueForPropertyinStyle() which takes in an explicit RenderStyle. No test as this is simply refactoring that doesn't change or add behavior. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSComputedStyleDeclaration.h: 2018-01-09 Youenn Fablet <youenn@apple.com> SWClientConnection should not keep references to service worker jobs https://bugs.webkit.org/show_bug.cgi?id=181381 Reviewed by Chris Dumez. Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds. Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread). Instead pass job identifiers and related data to the main thread. Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed. * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::scheduleJob): (WebCore::SWClientConnection::failedFetchingScript): (WebCore::SWClientConnection::postTaskForJob): (WebCore::SWClientConnection::jobRejectedInServer): (WebCore::SWClientConnection::registrationJobResolvedInServer): (WebCore::SWClientConnection::unregistrationJobResolvedInServer): (WebCore::SWClientConnection::startScriptFetchForServer): (WebCore::SWClientConnection::clearPendingJobs): (WebCore::SWClientConnection::finishedFetchingScript): Deleted. * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::scheduleJob): (WebCore::ServiceWorkerContainer::startScriptFetchForJob): (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): (WebCore::ServiceWorkerContainer::jobFailedLoadingScript): * workers/service/ServiceWorkerContainer.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::rejectJob): (WebCore::SWServer::resolveRegistrationJob): (WebCore::SWServer::resolveUnregistrationJob): (WebCore::SWServer::startScriptFetch): * workers/service/server/SWServer.h: 2018-01-09 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r224460): Text fields sometimes get "messed up" https://bugs.webkit.org/show_bug.cgi?id=181115 Reviewed by Zalan Bujtas. Add the scroll position to paint offset before computing the clip rectangle. Before r224460, scroll position was substracted after the clip rectangle was computed. * rendering/LayoutState.cpp: (WebCore::LayoutState::computeClipRect): 2018-01-09 Ali Juma <ajuma@chromium.org> Implement VisualViewport API events https://bugs.webkit.org/show_bug.cgi?id=179386 Reviewed by Frédéric Wang. Implement the events (resize and scroll) defined by the Visual Viewport API (https://wicg.github.io/visual-viewport/#events). This is behind the VisualViewportAPI experimental feature flag. In order to detect when events need to be fired, change the computation of Visual Viewport attributes to happen whenever the layout viewport is updated rather than only on-demand. Tests: fast/visual-viewport/resize-event-fired-window-resized.html fast/visual-viewport/resize-event-fired.html fast/visual-viewport/scroll-event-fired.html * dom/Document.cpp: (WebCore::Document::addListenerTypeIfNeeded): Add support for tracking resize event listeners. * dom/Document.h: * dom/DocumentEventQueue.cpp: (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent): (WebCore::DocumentEventQueue::enqueueScrollEvent): Factored out of enqueueOrDispatchScrollEvent so that this logic can be reused for Visual Viewport scroll events. (WebCore::DocumentEventQueue::enqueueResizeEvent): (WebCore::DocumentEventQueue::pendingEventTimerFired): * dom/DocumentEventQueue.h: * page/FrameView.cpp: (WebCore::FrameView::updateLayoutViewport): * page/VisualViewport.cpp: (WebCore::VisualViewport::addEventListener): (WebCore::layoutIfNonNull): (WebCore::VisualViewport::offsetLeft const): Remove attribute computation logic since this now happens during update(). (WebCore::VisualViewport::offsetTop const): Ditto. (WebCore::VisualViewport::pageLeft const): Ditto. (WebCore::VisualViewport::pageTop const): Ditto. (WebCore::VisualViewport::width const): Ditto. (WebCore::VisualViewport::height const): Ditto. (WebCore::VisualViewport::scale const): (WebCore::VisualViewport::update): Added. Computes all of the Visual Viewport attributes and determines whether events need to be fired. (WebCore::VisualViewport::enqueueResizeEvent): (WebCore::VisualViewport::enqueueScrollEvent): (WebCore::getFrameViewAndLayoutIfNonNull): Deleted. * page/VisualViewport.h: 2018-01-09 Yacine Bandou <yacine.bandou_ext@softathome.com> [EME] Add the CENC initData support in ClearKey CDM https://bugs.webkit.org/show_bug.cgi?id=180081 Reviewed by Xabier Rodriguez-Calvar. Add the "cenc" initDataType support in ClearKey CDM. Parse the CENC initData and extract the KIDs by following the W3C spec https://www.w3.org/TR/eme-initdata-cenc/#common-system Tests: media/encrypted-media/clearKey/clearKey-message-cenc-event.html media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::extractKeyidsLocationFromCencInitData): (WebCore::isCencInitData): (WebCore::extractKeyidsFromCencInitData): (WebCore::CDMPrivateClearKey::supportsInitDataType const): (WebCore::CDMPrivateClearKey::supportsInitData const): (WebCore::CDMInstanceClearKey::requestLicense): 2018-01-09 Zan Dobersek <zdobersek@igalia.com> [Cairo] Pass state values directly to Cairo operations https://bugs.webkit.org/show_bug.cgi?id=181389 Reviewed by Carlos Garcia Campos. Instead of passing reference to the GraphicsContextState object to various Cairo operations, only pass the required state values. This makes it explicit what state values are used in these operations, at the expense of some long parameter lists, but this will be better addressed by future refactoring of this code into more concise functions. No new tests -- no change in functionality. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawGlyphsShadow): (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth): (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth): (WebCore::Cairo::drawGlyphs): (WebCore::Cairo::drawRect): (WebCore::Cairo::drawLine): (WebCore::Cairo::drawEllipse): * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/FontCairo.cpp: (WebCore::FontCascade::drawGlyphs): * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::drawRect): (WebCore::GraphicsContext::drawLine): (WebCore::GraphicsContext::drawEllipse): 2018-01-09 Ryosuke Niwa <rniwa@webkit.org> Release assert in addResourceTiming when a cache resource is requested during style recalc https://bugs.webkit.org/show_bug.cgi?id=181137 <rdar://problem/35666574> Reviewed by Simon Fraser. Make the dispatching of resourcetimingbufferfull event asynchronous to avoid dispatching it synchronously during a style resolution when CachedResourceLoader::requestImage requests a previously loaded image. We now schedule a timer when the resource timing buffer becomes full, and dispatch the event when the timer fires. Meanwhile, we have a backup buffer to which additional resource timing entries would be added. Once the event is dispatched, we refill the buffer exposed to author scripts. When refilling the buffer results in it becoming full again, we keep repeating the process of firing resourcetimingbufferfull and re-filling the buffer until either we stop making progress (i.e. the script didn't increase the number of empty entires in the buffer) or the backup buffer (at the time we started this process) becomes empty. Also fixed a bug that we were firing resourcetimingbufferfull event when the last entry that fits within the buffer size was added instead of when an entry is being added to an already full buffer. To make this work, the patch introduces m_resourceTimingBufferFullFlag, representing the concept "resource timing buffer full" flag in the resource timing specification. Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-crash.html * page/Performance.cpp: (WebCore::Performance::Performance): (WebCore::Performance::clearResourceTimings): (WebCore::Performance::setResourceTimingBufferSize): (WebCore::Performance::addResourceTiming): (WebCore::Performance::resourceTimingBufferFullTimerFired): * page/Performance.h: 2018-01-08 Chris Nardi <csnardi1@gmail.com> ::first-letter incorrectly selects grapheme pairs https://bugs.webkit.org/show_bug.cgi?id=181315 Reviewed by Darin Adler. Grapheme pairs were incorrectly selected by ::first-letter. This change fixes their selection. Tests: Updated fast/css/first-letter-punctuation.html and imported LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-004.html * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::isPunctuationForFirstLetter): (WebCore::shouldSkipForFirstLetter): (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): 2018-01-08 Darin Adler <darin@apple.com> Special list-item counter starts from an incorrect number for ::before and ::after https://bugs.webkit.org/show_bug.cgi?id=181084 Reviewed by Zalan Bujtas. Test: fast/css/counters/counter-list-item.html * Sources.txt: Removed CounterDirectives.cpp. * WebCore.xcodeproj/project.pbxproj: Ditto. * css/CSSComputedStyleDeclaration.cpp: (WebCore::counterToCSSValue): Updated for changes to the CounterDirectives struct. * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInheritCounter): Ditto. (WebCore::StyleBuilderCustom::applyValueCounter): Ditto. * html/HTMLLIElement.cpp: (WebCore::HTMLLIElement::parseValue): Call setExplicitValue(std::nullopt) instead of clearExplicitValue since we are using std::optional now. * rendering/RenderCounter.cpp: (WebCore::listItemCounterDirectives): Added. Computes the counter directives that express the effects on the list-item counter from list item and list elements. Used something as close to what the CSS 3 draft says as possible. This uses a negative increment when creating a list to counteract the positive increment done by a list element, except in the case of an unordered list. This is where the bug fix actually lies. Also fixed handling of reversed ordered lists at the same time. (WebCore::planCounter): Refactored to use the function above. Also changed the code to pay attention to both the counter directives and the implicit ones from list item and list elements, getting as close as possible to what the specification seems to call for. * rendering/RenderListItem.cpp: (WebCore::RenderListItem::RenderListItem): Since we are using std::optional and no longer using bit fields, simplified the constructor for each list item. (WebCore::RenderListItem::calcValue const): Deleted. (WebCore::RenderListItem::updateValueNow const): Merged in all the code from the old calcValue function, but it is also simpler now since m_value is std::optional. (WebCore::RenderListItem::updateValue): Updated to use std::optional. (WebCore::RenderListItem::setExplicitValue): Ditto. (WebCore::RenderListItem::clearExplicitValue): Deleted. (WebCore::RenderListItem::updateListMarkerNumbers): Updated to use std::optional. (WebCore::RenderListItem::isInReversedOrderedList const): Added. This is used by the counter code so it can decrement instead of incrementing. * rendering/RenderListItem.h: Updated to use std::optional. Also marked functions final instead of override and initialized m_notInList after making it not be a bitfield any more. * rendering/style/CounterDirectives.cpp: Removed. * rendering/style/CounterDirectives.h: Removed most of the CounterDirectives class and replaced it with a struct with two std::optional. Added an addClamped function so the counter code can share it with the addIncrementValue function. If we want to make a faster version that doesn't use double, we can come back and do that. Also moved the == function to the header since the implementation is so trivial. * rendering/style/StyleAllInOne.cpp: Removed CounterDirectives.cpp. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Updated to use std::make_unique directly instead of using a clone function. 2018-01-08 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings https://bugs.webkit.org/show_bug.cgi?id=181420 <rdar://problem/36365827> Reviewed by Alex Christensen. Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment elements in the DOM to _WKAttachments delivered via Objective-C SPI. Adjusted existing tests in WKAttachmentTests. * html/HTMLAttachmentElement.idl: 2018-01-08 Don Olmstead <don.olmstead@sony.com> AccessibilityARIAGrid does not compile when accessibility is disabled https://bugs.webkit.org/show_bug.cgi?id=181418 <rdar://problem/36365398> Reviewed by Chris Fleizach. No new tests. No change in behavior. * accessibility/AccessibilityARIAGrid.cpp: 2018-01-08 Commit Queue <commit-queue@webkit.org> Unreviewed, rolling out r226532 and r226540. https://bugs.webkit.org/show_bug.cgi?id=181422 jessie says basic browsing does not seem to work (Requested by alexchristensen on #webkit). Reverted changesets: "Add CSP support to service workers" https://bugs.webkit.org/show_bug.cgi?id=181385 https://trac.webkit.org/changeset/226532 "SWClientConnection should not keep references to service worker jobs" https://bugs.webkit.org/show_bug.cgi?id=181381 https://trac.webkit.org/changeset/226540 2018-01-08 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Expose file name and content type of WKAttachment https://bugs.webkit.org/show_bug.cgi?id=181390 <rdar://problem/36336837> Reviewed by Tim Horton. Add new structs in AttachmentTypes.h and refactor HTMLAttachmentElement::requestData to requestInfo. See below for more details. Augmented existing API tests in WKAttachmentTests. * html/AttachmentTypes.h: Add a struct to represent a snapshot of information about an attachment element. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::requestInfo): (WebCore::HTMLAttachmentElement::requestData): Deleted. * html/HTMLAttachmentElement.h: Change requestData to requestInfo. Instead of fetching and delivering data via callback, requestInfo returns an AttachmentInfo. * rendering/RenderThemeIOS.mm: (WebCore::RenderAttachmentInfo::addLine): (WebCore::RenderAttachmentInfo::buildWrappedLines): (WebCore::RenderAttachmentInfo::buildSingleLine): (WebCore::RenderAttachmentInfo::RenderAttachmentInfo): (WebCore::RenderThemeIOS::attachmentBaseline const): (WebCore::paintAttachmentIcon): (WebCore::paintAttachmentText): (WebCore::paintAttachmentProgress): (WebCore::attachmentBorderPath): (WebCore::RenderThemeIOS::paintAttachment): (WebCore::AttachmentInfo::addLine): Deleted. (WebCore::AttachmentInfo::buildWrappedLines): Deleted. (WebCore::AttachmentInfo::buildSingleLine): Deleted. (WebCore::AttachmentInfo::AttachmentInfo): Deleted. Rename AttachmentInfo to RenderAttachmentInfo to resolve a name conflict with the new AttachmentInfo struct. 2018-01-08 Saam Barati <sbarati@apple.com> Speculative build fix after r226600. We only use clflush on x86 and the `asm volatile` syntax is not available in the Windows build. No new tests because this is a build fix. * dom/Comment.cpp: (WebCore::Comment::clflushReadLength): 2018-01-08 Michael Saboff <msaboff@apple.com> Add a DOM gadget for Spectre testing https://bugs.webkit.org/show_bug.cgi?id=181351 Reviewed by Saam Barati. This change is used to test Spectre mitigations. Added a side data array to the Comment DOM node to test for Spectre issues in the DOM layer. This additional functionality is disabled by default and must be enabled through the JSC option "enableSpectreGadgets". * dom/Comment.cpp: (WebCore::Comment::Comment): (WebCore::Comment::setReadLength): (WebCore::Comment::charCodeAt): (WebCore::Comment::clflushReadLength): * dom/Comment.h: * dom/Comment.idl: * page/RuntimeEnabledFeatures.cpp: (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): * page/RuntimeEnabledFeatures.h: 2018-01-08 Said Abou-Hallawa <sabouhallawa@apple.com> A canvas should not be tainted if it draws a data URL SVGImage with a <foreignObject> https://bugs.webkit.org/show_bug.cgi?id=180301 Reviewed by Dean Jackson. Don't taint the canvas if it draws a data URL SVGImage with a <foreignObject>. There should not be a cross-origin data leak in this case. Tests: svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html svg/as-image/svg-canvas-data-url-svg-with-foreign-object-not-tainted.html svg/as-image/svg-canvas-data-url-svg-with-image-not-tainted.html * html/ImageBitmap.cpp: (WebCore::taintsOrigin): * html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::wouldTaintOrigin): 2018-01-08 Don Olmstead <don.olmstead@sony.com> Simplify platform checks in Graphics Context https://bugs.webkit.org/show_bug.cgi?id=181344 Reviewed by Alex Christensen. No new tests. No change in behavior. * platform/graphics/ANGLEWebKitBridge.h: * platform/graphics/GLContext.h: * platform/graphics/GraphicsContext3D.h: * platform/graphics/OpenGLESShims.h: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::checkVaryingsPacking const): 2018-01-08 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move SVG addChild logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181405 <rdar://problem/36360476> Reviewed by Antti Koivisto. This is about moving the code, no cleanup and/or normalization (unfortunately it also means some temporary changes). No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::addChild): * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::addChild): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::addChild): * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::addChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChildToSVGContainer): (WebCore::RenderTreeBuilder::insertChildToSVGInline): (WebCore::RenderTreeBuilder::insertChildToSVGRoot): (WebCore::RenderTreeBuilder::insertChildToSVGText): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::SVGBuilder): * rendering/updating/RenderTreeBuilderSVG.cpp: Added. (WebCore::RenderTreeBuilder::SVG::SVG): (WebCore::RenderTreeBuilder::SVG::insertChild): * rendering/updating/RenderTreeBuilderSVG.h: Added. 2018-01-08 John Wilander <wilander@apple.com> Storage Access API: Remove access for all frames under a page when the page is closed https://bugs.webkit.org/show_bug.cgi?id=181398 <rdar://problem/36357879> Reviewed by Alex Christensen. No new tests. Discussed with Alex Christensen and we concluded that both a layout test and an API test would require a lot of work and we have existing tests for clearing out storage access for frames. * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): 2018-01-08 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r226385. The test introduced with this was a flaky since being added. Reverted changeset: "AX: when invert colors is on, double-invert certain media elements in UserAgentStyleSheet" https://bugs.webkit.org/show_bug.cgi?id=168447 https://trac.webkit.org/changeset/226385 2018-01-08 Youenn Fablet <youenn@apple.com> SWClientConnection should not keep references to service worker jobs https://bugs.webkit.org/show_bug.cgi?id=181381 Reviewed by Chris Dumez. Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds. Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread). Instead pass job identifiers and related data to the main thread. Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed. * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::scheduleJob): (WebCore::SWClientConnection::failedFetchingScript): (WebCore::SWClientConnection::postTaskForJob): (WebCore::SWClientConnection::jobRejectedInServer): (WebCore::SWClientConnection::registrationJobResolvedInServer): (WebCore::SWClientConnection::unregistrationJobResolvedInServer): (WebCore::SWClientConnection::startScriptFetchForServer): (WebCore::SWClientConnection::clearPendingJobs): (WebCore::SWClientConnection::finishedFetchingScript): Deleted. * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::scheduleJob): (WebCore::ServiceWorkerContainer::startScriptFetchForJob): (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): (WebCore::ServiceWorkerContainer::jobFailedLoadingScript): * workers/service/ServiceWorkerContainer.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::rejectJob): (WebCore::SWServer::resolveRegistrationJob): (WebCore::SWServer::resolveUnregistrationJob): (WebCore::SWServer::startScriptFetch): * workers/service/server/SWServer.h: 2018-01-08 Wenson Hsieh <wenson_hsieh@apple.com> Copying, pasting, and then deleting an attachment element breaks attachment data requests https://bugs.webkit.org/show_bug.cgi?id=181365 <rdar://problem/36340647> Reviewed by Tim Horton. Currently, copying and pasting an attachment element within the same document and then deleting backwards to remove the pasted attachment element causes the original attachment element to be inaccessible via SPI. This is because there are now two different attachment elements with the same unique identifier, such that Document, which keeps a map of all unique attachment identifiers to attachment elements, will lose track of the original attachment element. To fix this, we ensure that attachment elements should always have unique identifiers when they are inserted into the document. We make several small adjustments to accomplish this: 1. First, refactor HTMLAttachmentElement's unique identifier so that it no longer depends on the value of the "webkitattachmentid" attribute, and is instead just a member of HTMLAttachmentElement that is not exposed to DOM bindings. This means setting and querying an attachment element's uniqueIdentifier can be done without triggering any side effects, such as layout or mutation events. 2. Next, make "webkitattachmentid" a temporary attribute similar to "webkitattachmentpath" and "webkitattachmentbloburl", so that it is added only when generating a markup fragment for editing, and removed upon deserialization. 3. Lastly, shift the responsibility of assigning a unique identifier to an attachment away from places where we create attachment elements, and instead have Document enforce this when an attachment element is inserted. Tests: WKAttachmentTests.InsertAndRemoveDuplicateAttachment WKAttachmentTests.InsertDuplicateAttachmentAndUpdateData * dom/Document.cpp: (WebCore::Document::didInsertAttachmentElement): Assign the unique identifier of an attachment element that has been inserted. If the identifier already tracks an existing attachment element in the document or is missing, reassign the identifier to a new value. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragmentForImageAttachment): (WebCore::replaceRichContentWithAttachments): (WebCore::WebContentReader::readFilePaths): Remove calls to setUniqueIdentifier here, since Document will assign a unique identifier upon insertion. * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::appendCustomAttributes): (WebCore::createFragmentFromMarkup): Set the attachment's unique identifier to the value of the "webkitattachmentid" attribute. When moving existing attachments around in the DOM without duplication, this ensures that the attachment will be removed and reinserted in the document without triggering removal and insertion client delegate methods. When pasting an attachment element that has the same identifier as an existing attachment, we let Document realize that the attachment identifier already exists, and reassign it to a unique value. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::uniqueIdentifier const): Deleted. (WebCore::HTMLAttachmentElement::setUniqueIdentifier): Deleted. * html/HTMLAttachmentElement.h: 2018-01-08 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181348 <rdar://problem/36328117> Reviewed by Antti Koivisto. This is about moving the code, no cleanup and/or normalization (unfortunately it also means some temporary changes). No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::addChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::blockFlowBuilder): * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added. (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow): (WebCore::RenderTreeBuilder::BlockFlow::insertChild): * rendering/updating/RenderTreeBuilderBlockFlow.h: Added. 2018-01-08 Youenn Fablet <youenn@apple.com> Add CSP support to service workers https://bugs.webkit.org/show_bug.cgi?id=181385 Reviewed by Chris Dumez. Covered by rebased tests. Added recovery of CSP information from WorkerScriptLoader. Added plumbing to pass the CSP information to Service Workers. Added persistency support for the CSP information. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::contentSecurityPolicy const): * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::finishedFetchingScript): (WebCore::SWClientConnection::failedFetchingScript): * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::jobFailedWithException): (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript): * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerContextData.cpp: (WebCore::ServiceWorkerContextData::isolatedCopy const): * workers/service/ServiceWorkerContextData.h: (WebCore::ServiceWorkerContextData::encode const): (WebCore::ServiceWorkerContextData::decode): * workers/service/ServiceWorkerFetchResult.h: (WebCore::ServiceWorkerFetchResult::encode const): (WebCore::ServiceWorkerFetchResult::decode): * workers/service/ServiceWorkerGlobalScope.cpp: (WebCore::ServiceWorkerGlobalScope::create): * workers/service/ServiceWorkerGlobalScope.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::notifyFinished): * workers/service/ServiceWorkerJobClient.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): (WebCore::ServiceWorkerThread::createWorkerGlobalScope): * workers/service/server/RegistrationDatabase.cpp: (WebCore::v1RecordsTableSchema): (WebCore::RegistrationDatabase::openSQLiteDatabase): (WebCore::RegistrationDatabase::doPushChanges): (WebCore::RegistrationDatabase::importRecords): * workers/service/server/SWServer.cpp: (WebCore::SWServer::updateWorker): (WebCore::SWServer::installContextData): * workers/service/server/SWServer.h: * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptFetchFinished): * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::SWServerWorker): (WebCore::m_contentSecurityPolicy): (WebCore::SWServerWorker::contextData const): * workers/service/server/SWServerWorker.h: 2018-01-08 Youenn Fablet <youenn@apple.com> Use no-cache fetch mode when loading main documents with location.reload() https://bugs.webkit.org/show_bug.cgi?id=181285 Reviewed by Alex Christensen. Covered by rebased tests. Start to translate cache policy used for navigation as FetchOptions::Cache. This allows ensuring service workers receive the right cache mode when intercepting navigation loads. To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode. For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode, as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers. Keep reload mode for ReloadFromOrigin. * loader/DocumentLoader.cpp: (WebCore::toFetchOptionsCache): (WebCore::DocumentLoader::loadMainResource): * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadFrameRequest): (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::load): (WebCore::FrameLoader::reload): (WebCore::FrameLoader::defaultRequestCachingPolicy): (WebCore::FrameLoader::loadDifferentDocumentItem): * loader/NavigationScheduler.cpp: 2018-01-08 Youenn Fablet <youenn@apple.com> Stop exposing fetch and extendable events to window https://bugs.webkit.org/show_bug.cgi?id=181325 Reviewed by Chris Dumez. Covered by updated tests. Marked FetchEvent and ExtendableEvent as visible in ServiceWorker environments only. Moved related Internals testing routines to ServiceWorkerInternals. * testing/Internals.cpp: (WebCore::Internals::waitForFetchEventToFinish): Deleted. (WebCore::Internals::createBeingDispatchedFetchEvent): Deleted. * testing/Internals.h: * testing/Internals.idl: * testing/ServiceWorkerInternals.cpp: (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish): (WebCore::ServiceWorkerInternals::createBeingDispatchedFetchEvent): * testing/ServiceWorkerInternals.h: * testing/ServiceWorkerInternals.idl: * workers/service/ExtendableEvent.idl: * workers/service/FetchEvent.idl: 2018-01-08 Antti Koivisto <antti@apple.com> REGRESSION (r219145): Toggling layer borders on a static document no longer works immediately https://bugs.webkit.org/show_bug.cgi?id=176260 <rdar://problem/34219966> Reviewed by Simon Fraser. Optimization reveled bugs in debug indicator painting. Test: compositing/debug-borders-dynamic.html * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): (WebCore::GraphicsLayerCA::updateDebugIndicators): (WebCore::GraphicsLayerCA::updateDebugBorder): Deleted. - Rename to indicate this is not just about debug borders. - Trigger display so repaint counters get painted. This helper is only called when the indicators change. * platform/graphics/ca/GraphicsLayerCA.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags): Ensure we do compositing update on debug border change even when there is no layout. 2018-01-08 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderInline addChild logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181336 <rdar://problem/36324693> Reviewed by Antti Koivisto. This is about moving the code, no cleanup and/or normalization (unfortunately it also means some temporary changes). No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderInline.cpp: (WebCore::RenderInline::addChild): (WebCore::RenderInline::addChildIgnoringContinuation): (WebCore::RenderInline::childBecameNonInline): (WebCore::nextContinuation): Deleted. (WebCore::RenderInline::continuationBefore): Deleted. (WebCore::newChildIsInline): Deleted. (WebCore::RenderInline::cloneAsContinuation const): Deleted. (WebCore::RenderInline::splitInlines): Deleted. (WebCore::RenderInline::splitFlow): Deleted. (WebCore::canUseAsParentForContinuation): Deleted. (WebCore::RenderInline::addChildToContinuation): Deleted. * rendering/RenderInline.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChildToRenderInline): (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation): (WebCore::RenderTreeBuilder::splitFlow): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::inlineBuilder): * rendering/updating/RenderTreeBuilderInline.cpp: Added. (WebCore::canUseAsParentForContinuation): (WebCore::nextContinuation): (WebCore::continuationBefore): (WebCore::cloneAsContinuation): (WebCore::newChildIsInline): (WebCore::inFlowPositionedInlineAncestor): (WebCore::RenderTreeBuilder::Inline::Inline): (WebCore::RenderTreeBuilder::Inline::insertChild): (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation): (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): (WebCore::RenderTreeBuilder::Inline::splitFlow): (WebCore::RenderTreeBuilder::Inline::splitInlines): * rendering/updating/RenderTreeBuilderInline.h: Added. 2018-01-08 Zalan Bujtas <zalan@apple.com> [RenderTreeBuilder] Move RenderBlock addChild logic to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181319 <rdar://problem/36313464> Reviewed by Antti Koivisto. This is about moving the code, no cleanup and/or normalization (unfortunately it also means some temporary changes). No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addChild): (WebCore::RenderBlock::addChildIgnoringContinuation): (WebCore::RenderBlock::childBecameNonInline): (WebCore::RenderBlock::continuationBefore): Deleted. (WebCore::RenderBlock::addChildToContinuation): Deleted. (WebCore::getInlineRun): Deleted. (WebCore::RenderBlock::makeChildrenNonInline): Deleted. * rendering/RenderBlock.h: * rendering/RenderBox.cpp: (WebCore::markBoxForRelayoutAfterSplit): Deleted. (WebCore::RenderBox::splitAnonymousBoxesAroundChild): Deleted. * rendering/RenderBox.h: * rendering/RenderRubyBase.cpp: (WebCore::RenderRubyBase::moveChildren): (WebCore::RenderRubyBase::moveBlockChildren): * rendering/RenderTable.cpp: (WebCore::RenderTable::addChild): * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::markBoxForRelayoutAfterSplit): (WebCore::getInlineRun): (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChildToRenderBlock): (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation): (WebCore::RenderTreeBuilder::makeChildrenNonInline): (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::blockBuilder): * rendering/updating/RenderTreeBuilderBlock.cpp: Added. (WebCore::continuationBefore): (WebCore::RenderTreeBuilder::Block::Block): (WebCore::RenderTreeBuilder::Block::insertChild): (WebCore::RenderTreeBuilder::Block::insertChildToContinuation): (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): * rendering/updating/RenderTreeBuilderBlock.h: Added. 2018-01-08 Jeremy Jones <jeremyj@apple.com> Standard controls sometimes say video is in pip when it isnt. https://bugs.webkit.org/show_bug.cgi?id=181095 rdar://problem/36182687 Reviewed by Eric Carlson. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::exitFullscreen): 2018-01-08 Jer Noble <jer.noble@apple.com> REGRESSION: [iOS] ASSERTION FAILED: !node.isConnected() in WebCore::notifyNodeInsertedIntoDocument https://bugs.webkit.org/show_bug.cgi?id=181091 Reviewed by Darin Adler. Move the work previously performed in insertedIntoAncestor() into didFinishInsertingNode(). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::prepareForLoad): 2018-01-08 Zan Dobersek <zdobersek@igalia.com> [Cairo] Use isolated fill and stroke source containers https://bugs.webkit.org/show_bug.cgi?id=181386 Reviewed by Carlos Garcia Campos. Generate fill and stroke source objects upon invocation of various Cairo operations, initializing necessary data from the GraphicsContextState object. Cairo::FillSource and Cairo::StrokeSource structs are introduced, both being default-constructible as well as providing a constructor that accepts a GraphicsContextState object from which the appropriate resources are created. The FillSource and StrokeSource objects are then passed to PlatformContextCairo's prepareForFilling() and prepareForStroking() methods. Here the helper prepareCairoContextSource() function is now invoked with cairo_pattern_t objects as pattern or gradient sources, or the source color if neither cairo_pattern_t object is specified. The FillSource and StrokeSource constructors mimic the previous behavior of prepareCairoContextSource(). In case the source is a Pattern object, a cairo_pattern_t object is created from that. In case of FillSource, we also retrieve pattern size, transform and repetition information. In case the source os a Gradient object, we create a 'base' cairo_pattern_t object for a completely opaque alpha channel. Additionally, if the alpha value on the state is not 1, we create an alpha-adjusted cairo_pattern_t that is potentially used for any filling or stroking operation that has to preserve transparency. If neither Pattern or Gradient objects are set on the GraphicsContextState, we default to the current fill or stroke color. Overall, there's no change in behavior, this is simply a refactoring that enables us to construct Cairo objects for filling and stroking sources at the time of Cairo operation dispatch, instead of pulling down GraphicsContextState deeper into the Cairo-specific code. No new tests -- no change in functionality. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawPathShadow): (WebCore::Cairo::fillCurrentCairoPath): (WebCore::Cairo::FillSource::FillSource): (WebCore::Cairo::StrokeSource::StrokeSource): (WebCore::Cairo::fillRect): (WebCore::Cairo::fillRectWithRoundedHole): (WebCore::Cairo::fillPath): (WebCore::Cairo::strokeRect): (WebCore::Cairo::strokePath): (WebCore::Cairo::drawGlyphs): * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/FontCairo.cpp: (WebCore::FontCascade::drawGlyphs): * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::fillRect): (WebCore::GraphicsContext::strokeRect): (WebCore::GraphicsContext::fillRectWithRoundedHole): * platform/graphics/cairo/PlatformContextCairo.cpp: (WebCore::prepareCairoContextSource): (WebCore::PlatformContextCairo::prepareForFilling): (WebCore::PlatformContextCairo::prepareForStroking): (WebCore::PlatformContextCairo::clipForPatternFilling): * platform/graphics/cairo/PlatformContextCairo.h: 2018-01-08 Youenn Fablet <youenn@apple.com> navigator.onLine does not work inside service workers https://bugs.webkit.org/show_bug.cgi?id=181079 <rdar://problem/36178606> Reviewed by Darin Adler. Test: http/wpt/service-workers/online.https.html Added support for onLine by reusing a similar implementation as regular workers. Added ServiceWorkerInternals as an interface for an object exposed as self.internals in WTR. This object has currently one method to trigger change in the online/offline status. This allows writing a test for the onLine feature. Note that self.internals is inserted asynchronously after the script was evaluated. When writing a worker script using self.internals, one must make sure to use self.internals when initialized. online-worker.js for instance makes use of self.internals in a postMessage callback. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WorkerScriptController.h: * dom/ScriptExecutionContext.h: * testing/ServiceWorkerInternals.cpp: Added. (WebCore::ServiceWorkerInternals::ServiceWorkerInternals): (WebCore::ServiceWorkerInternals::setOnline): * testing/ServiceWorkerInternals.h: Added. * testing/ServiceWorkerInternals.idl: Added. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setupNewlyCreateServiceWorker): * testing/js/WebCoreTestSupport.h: * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::registerServiceWorkerThreadForInstall): (WebCore::SWContextManager::startedServiceWorker): * workers/service/context/SWContextManager.h: (WebCore::SWContextManager::setServiceWorkerCreationCallback): (WebCore::SWContextManager::workerByID): * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::ServiceWorkerThread): * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy): (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy): (WebCore::ServiceWorkerThreadProxy::networkStateChanged): (WebCore::ServiceWorkerThreadProxy::notifyNetworkStateChange): * workers/service/context/ServiceWorkerThreadProxy.h: 2018-01-08 Zan Dobersek <zdobersek@igalia.com> [Cairo] Contain shadow blur requirement state in a separate object https://bugs.webkit.org/show_bug.cgi?id=181380 Reviewed by Carlos Garcia Campos. Instead of picking up the necessary state parameters from a GraphicsContextState object, store the necessary parameters in a helper ShadowBlurUsage struct. Mimicking the mustUseShadowBlur() function that is being removed, values of the shadow color, shadow blur, and shadow transform ignorance are stored there. Additionally, the required() method accepts a PlatformContextCairo object through which it can retrieve the current CTM and determine whether it's an identity, finally deciding whether shadow blur can or cannot be ignored. Goal of this change is to limit usage of GraphicsContextState directly in operations implemented inside the Cairo namespace. Instead, the state parameters should be passed directly, or an equivalent but limited state object should be constructed for invocation of such operations. This is likely only an intermediate solution. It's possible it will be replaced by a more complete shadow state struct that would be used for any operation that is required to draw shadows, if necessary. No new tests -- no change in functionality. * platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawGlyphsShadow): (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): (WebCore::Cairo::ShadowBlurUsage::required const): (WebCore::Cairo::fillRectWithRoundedHole): (WebCore::Cairo::drawGlyphs): (WebCore::Cairo::mustUseShadowBlur): Deleted. * platform/graphics/cairo/CairoOperations.h: * platform/graphics/cairo/FontCairo.cpp: (WebCore::FontCascade::drawGlyphs): * platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::fillRectWithRoundedHole): 2018-01-08 Philippe Normand <pnormand@igalia.com> [GStreamer][Soup] Remove dead getCreateOrReadBuffer code path https://bugs.webkit.org/show_bug.cgi?id=181376 Reviewed by Carlos Garcia Campos. This code path is no longer used now that the GStreamer HTTP source element uses data coming directly from the network process. * SourcesGTK.txt: * SourcesWPE.txt: * loader/MediaResourceLoader.cpp: (WebCore::MediaResource::getOrCreateReadBuffer): Deleted. * loader/MediaResourceLoader.h: * loader/SubresourceLoader.h: * loader/cache/CachedRawResource.h: * loader/cache/CachedRawResourceClient.h: (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad): (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): Deleted. * loader/cache/CachedResource.h: (WebCore::CachedResource::getOrCreateReadBuffer): Deleted. * loader/soup/CachedRawResourceSoup.cpp: Removed. * loader/soup/SubresourceLoaderSoup.cpp: Removed. * platform/graphics/PlatformMediaResourceLoader.h: (WebCore::PlatformMediaResourceClient::loadFinished): (WebCore::PlatformMediaResourceClient::getOrCreateReadBuffer): Deleted. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (CachedResourceStreamingClient::getOrCreateReadBuffer): Deleted. * platform/network/ResourceHandleClient.h: (WebCore::ResourceHandleClient::getOrCreateReadBuffer): Deleted. * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::ResourceHandle::ensureReadBuffer): 2018-01-08 Zan Dobersek <zdobersek@igalia.com> and Carlos Garcia Campos <cgarcia@igalia.com> [GStreamer] use FastMalloc-based GstAllocator https://bugs.webkit.org/show_bug.cgi?id=165793 Reviewed by Philippe Normand. Add GstAllocatorFastMalloc, a GstAllocator implementation using fast malloc. It's only used when fast malloc is enabled and can be disabled using an environment variable for debugging purposes. * platform/GStreamer.cmake: * platform/graphics/gstreamer/GStreamerUtilities.cpp: (WebCore::initializeGStreamer): * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: Added. (gstMemoryFastMallocNew): (gstAllocatorFastMallocAlloc): (gstAllocatorFastMallocFree): (gstAllocatorFastMallocMemMap): (gstAllocatorFastMallocMemUnmap): (gstAllocatorFastMallocMemCopy): (gstAllocatorFastMallocMemShare): (gstAllocatorFastMallocMemIsSpan): (gst_allocator_fast_malloc_class_init): (gst_allocator_fast_malloc_init): * platform/graphics/gstreamer/GstAllocatorFastMalloc.h: Added. 2018-01-07 Ms2ger <Ms2ger@igalia.com> Implement createImageBitmap(ImageBitmap) https://bugs.webkit.org/show_bug.cgi?id=181287 Reviewed by Darin Adler. Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html * html/ImageBitmap.cpp: (WebCore::ImageBitmap::createPromise): 2018-01-07 Ryosuke Niwa <rniwa@webkit.org> Reduce the precision of "high" resolution time to 1ms https://bugs.webkit.org/show_bug.cgi?id=180910 <rdar://problem/36085943> Reviewed by Saam Barati. Reduced the high prevision time's resolution to 1ms, the same precision as Date.now(). Also fixed the bug in fillRTCStats that we weren't reducing the time resolution in RTCStats dictionaries. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::fillRTCStats): * page/Performance.cpp: (WebCore::Performance::reduceTimeResolution): 2018-01-06 Simon Fraser <simon.fraser@apple.com> Possible crash computing event regions https://bugs.webkit.org/show_bug.cgi?id=181368 rdar://problem/34847081 Reviewed by Zalan Bujtas. Don't trigger layout in Element::absoluteEventHandlerBounds(), since this can run arbirary script which might delete elements or re-enter Document::absoluteRegionForEventTargets(). It's OK to not trigger layout, because if layout is dirty, the next layout will update event regions again. Add a LayoutDisallowedScope to check that Document::absoluteRegionForEventTargets() doesn't trigger layout, and move the check for LayoutDisallowedScope::isLayoutAllowed() from Document::updateLayout() to LayoutContext::layout(), since some layouts don't happen via the former (e.g. the one being removed here). The test checks that the assertion does not fire. I was not able to get a reliable test for any crash. Test: fast/events/event-handler-regions-layout.html * dom/Document.cpp: (WebCore::Document::updateLayout): (WebCore::Document::absoluteRegionForEventTargets): * dom/Element.cpp: (WebCore::Element::absoluteEventHandlerBounds): * page/LayoutContext.cpp: (WebCore::LayoutContext::layout): * rendering/LayoutDisallowedScope.h: Move the #ifdefs around to avoid defining the enum twice. (WebCore::LayoutDisallowedScope::LayoutDisallowedScope): (WebCore::LayoutDisallowedScope::isLayoutAllowed): 2018-01-06 Simon Fraser <simon.fraser@apple.com> Crash under RenderLayer::scrollTo() with marquee https://bugs.webkit.org/show_bug.cgi?id=181349 rdar://problem/36190168 Reviewed by Zalan Bujtas. Don't call updateWidgetPositions() synchonously during RenderLayer scrolling, because it can run arbitrary script which may trigger destruction of this RenderLayer. Instead, queue up updateWidgetPositions() on a zero-delay timer. Under some circumstances this may allow a paint to occur before the widgets have been updated (which could be fixed with a more invasive change), but in practice I saw no painting issues with plug-ins or iframes inside overflow scroll, in WebKit or LegacyWebKit. Test: fast/scrolling/marquee-scroll-crash.html * page/FrameView.cpp: (WebCore::FrameView::FrameView): (WebCore::FrameView::updateWidgetPositions): (WebCore::FrameView::scheduleUpdateWidgetPositions): (WebCore::FrameView::updateWidgetPositionsTimerFired): * page/FrameView.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollTo): 2018-01-05 Dean Jackson <dino@apple.com> Accurately clip copyTexImage2D and copyTexSubImage2D https://bugs.webkit.org/show_bug.cgi?id=181356 <rdar://problem/35083877> Reviewed by Eric Carlson. The code to make sure copyTexSubImage2D and copyTexImage2D will not try to read out of bounds had a bad bug introduced here: https://bugs.webkit.org/show_bug.cgi?id=51421 With appropriate parameters, it would produce a rectangle with negative dimensions. Most GL drivers just ignored this, but some are not happy. Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d-bad-input.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::clip2D): Reimplement this in a more sane manner, and use checked arithmetic while here. * html/canvas/WebGLRenderingContextBase.h: (WebCore::clip1D): Deleted. (WebCore::clip2D): Deleted. 2018-01-06 Antti Koivisto <antti@apple.com> Use WeakPtr for RenderTreePosition::m_nextSibling https://bugs.webkit.org/show_bug.cgi?id=181363 Reviewed by Zalan Bujtas. For safety. In most cases it is null and won't cause us to instantiate WeakReferences for many new objects. * rendering/updating/RenderTreePosition.cpp: (WebCore::RenderTreePosition::computeNextSibling): * rendering/updating/RenderTreePosition.h: (WebCore::RenderTreePosition::RenderTreePosition): (WebCore::RenderTreePosition::nextSibling const): 2018-01-05 David Kilzer <ddkilzer@apple.com> Re-enable -Wcast-qual in WebCore for Apple ports <https://webkit.org/b/177895> <rdar://problem/34960830> Reviewed by Joseph Pecoraro. * Configurations/Base.xcconfig: (WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to arguments. * crypto/mac/SerializedCryptoKeyWrapMac.mm: (WebCore::createAndStoreMasterKey): - Use checked_cf_cast<SecACLRef>(). * editing/cocoa/DataDetection.mm: (WebCore::detectItemAtPositionWithRange): - Manually cast CFTypeRef to DDResultRef until DDResultGetTypeID() is available as SPI. * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::initElementsFromArray): - Use checked_cf_cast<IOHIDElementRef>(). * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::createImageSample): (WebCore::CMSampleBufferIsRandomAccess): (WebCore::CMSampleBufferIsNonDisplaying): (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const): - Use checked_cf_cast<CFMutableDictionaryRef>() and checked_cf_cast<CFDictionaryRef>(). * platform/graphics/cocoa/IOSurface.h: (WebCore::IOSurface::asLayerContents): - Use reinterpret_cast<id>() to cast from IOSurfaceRef to id. * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::getFirstVideoFrame): (WebCore::WebCoreDecompressionSession::automaticDequeue): (WebCore::WebCoreDecompressionSession::imageForTime): (WebCore::WebCoreDecompressionSession::getDecodeTime): (WebCore::WebCoreDecompressionSession::getPresentationTime): (WebCore::WebCoreDecompressionSession::getDuration): - Use checked_cf_cast<CMSampleBufferRef>(). * platform/graphics/Font.h: (WebCore::Font::m_kernedCFStringAttributes): (WebCore::Font::m_nonKernedCFStringAttributes): - Change type from RetainPtr<CFDictionaryRef> to RetainPtr<CFMutableDictionaryRef> since that's what they are. * platform/graphics/mac/SimpleFontDataCoreText.cpp: (WebCore::Font::getCFStringAttributes const): - Replace local `mutableAttributes` variable with `attributesDictionary.get()` since it returns the correct type now. * platform/ios/wak/WAKView.mm: (-[WAKView _initWithViewRef:]): (_WAKCopyWrapper): * platform/ios/wak/WKView.mm: (_WKViewClearSuperview): (WKViewFirstChild): (WKViewNextSibling): - Use static_cast<WKViewRef>(const_cast<void*>()) to convert const void* variable to WKViewRef. * platform/mac/PasteboardMac.mm: (WebCore::flipImageSpec): (WebCore::setDragImageImpl): - Use const_cast<> to remove 'const' modifier from unsigned char pointers. This regressed while -Wcast-qual was disabled for WebCore. * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): - Use checked_cf_cast<SecACLRef>(). * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp: (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame): - Use checked_cf_cast<CFMutableDictionaryRef>(). * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::copyCONNECTProxyResponse): - Use checked_cf_cast<CFHTTPMessageRef>(). * platform/network/cocoa/ResourceResponseCocoa.mm: (WebCore::ResourceResponse::platformCertificateInfo const): - Use checked_cf_cast<SecTrustRef>(). * platform/network/mac/CertificateInfoMac.mm: (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const): (WebCore::CertificateInfo::dump const): - Use checked_cf_cast<SecCertificateRef>(). * testing/cocoa/WebArchiveDumpSupport.mm: (WebCoreTestSupport::createCFURLResponseFromResponseData): - Use checked_cf_cast<>() for CFMutable* types. 2018-01-05 John Wilander <wilander@apple.com> Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page https://bugs.webkit.org/show_bug.cgi?id=181357 <rdar://problem/36331031> Reviewed by Alex Christensen. No new tests. The only changed functionality that isn't covered by existing tests is cross-origin iframes in the same partition should be handled as already having access. This cannot be tested in layout tests since they don't support subdomains. This change does the following: - Changes function and message names to reflect how this feature was eventually implemented, i.e. access per frame. - Makes it explicit that the UI process is only involved in granting storage access and not removing storage access. The latter is done directly by the web process. - Simplifies the network process' entry map since only needs to be able to give access to one domain in one frame at a time. Access goes away on frame navigation so there can only be one domain at a time per frame. Also, the map now uses pageIDs as main keys to prepare for efficient access removal for all frames under a page. - Fixes a bug in so that a cross-origin iframe with the same partition as the top frame correctly is handled as already having access. * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::cookieStoragePartition const): The only change here is the changed named of the call to NetworkStorageSession::hasStorageAccessForFrame(). (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): (WebCore::NetworkStorageSession::grantStorageAccessForFrame): (WebCore::NetworkStorageSession::removeStorageAccessForFrame): (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted. (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted. (WebCore::NetworkStorageSession::removeStorageAccess): Deleted. 2018-01-05 Youenn Fablet <youenn@apple.com> Implement Cache API partitioning based on ClientOrigin https://bugs.webkit.org/show_bug.cgi?id=181240 Reviewed by Alex Christensen. Covered by updated tests. Previously, cache storage was partitioned according the origin of the client, represented as a String. We now partition according both client and top origins, represented as a ClientOrigin Minor refactoring to use more makePendingActivity. Added support for IPC serialization of ClientOrigin. Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation. * Modules/cache/CacheStorageConnection.cpp: (WebCore::CacheStorageConnection::open): (WebCore::CacheStorageConnection::retrieveCaches): * Modules/cache/CacheStorageConnection.h: (WebCore::CacheStorageConnection::clearMemoryRepresentation): (WebCore::CacheStorageConnection::doOpen): (WebCore::CacheStorageConnection::doRetrieveCaches): * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::origin const): (WebCore::DOMCacheStorage::retrieveCaches): (WebCore::DOMCacheStorage::open): (WebCore::DOMCacheStorage::remove): * Modules/cache/DOMCacheStorage.h: * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::WorkerCacheStorageConnection::doOpen): (WebCore::WorkerCacheStorageConnection::doRetrieveCaches): * Modules/cache/WorkerCacheStorageConnection.h: * page/ClientOrigin.h: (WebCore::ClientOrigin::isolatedCopy const): (WebCore::ClientOrigin::encode const): (WebCore::ClientOrigin::decode): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::toString const): (WebCore::SecurityOriginData::debugString const): Deleted. * page/SecurityOriginData.h: (WebCore::SecurityOriginData::debugString const): * testing/Internals.cpp: (WebCore::Internals::clearCacheStorageMemoryRepresentation): 2018-01-05 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Add a way to write blob data to a file URL from the UI process https://bugs.webkit.org/show_bug.cgi?id=181236 Reviewed by Brady Eidson. Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199. * page/DragController.cpp: (WebCore::DragController::dragAttachmentElement): * platform/PromisedBlobInfo.h: Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to the UI process. However, the new approach I'm taking just has the UI process tell the network process to write a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary. (WebCore::PromisedBlobData::hasData const): Deleted. (WebCore::PromisedBlobData::hasFile const): Deleted. (WebCore::PromisedBlobData::operator bool const): Deleted. (WebCore::PromisedBlobData::fulfills const): Deleted. * platform/network/BlobRegistryImpl.cpp: (WebCore::BlobRegistryImpl::populateBlobsForFileWriting): Introduce a new helper to build a list of blob data for file writing. (WebCore::writeFilePathsOrDataBuffersToFile): Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle. Automatically closes the given file handle upon exit. (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles): (WebCore::BlobRegistryImpl::writeBlobToFilePath): Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and refactor both methods to use the helpers. * platform/network/BlobRegistryImpl.h: 2018-01-05 Alex Christensen <achristensen@webkit.org> Forbid < and > in URL hosts https://bugs.webkit.org/show_bug.cgi?id=181308 <rdar://problem/36012757> Reviewed by Tim Horton. https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should. Firefox fails to parse URLs with < or > in the host. Chrome percent encodes them. Safari needs to do something. The web platform tests are unclear on this case, and they will need to be updated with the specification. They do show a change in behavior, though. * platform/URLParser.cpp: Add < and > to the list of forbidden host code points. 2018-01-05 Eric Carlson <eric.carlson@apple.com> [MediaStream] Add Mac screen capture source https://bugs.webkit.org/show_bug.cgi?id=181333 <rdar://problem/36323219> Reviewed by Dean Jackson. * SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm. * WebCore.xcodeproj/project.pbxproj: Ditto. * platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used. * platform/cocoa/CoreVideoSoftLink.h: * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp: (WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices. (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display reconfiguration callbacks. (WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations. (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to get list of active screens. (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen ID, return CaptureDevice. * platform/mediastream/mac/DisplayCaptureManagerCocoa.h: * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: (WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture on macOS. Implement Mac screen capture with CGDisplayStream. * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added. (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface): (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=): (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const): * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added. (WebCore::roundUpToMacroblockMultiple): (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID): (WebCore::ScreenDisplayCaptureSourceMac::create): (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac): (WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac): (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): (WebCore::ScreenDisplayCaptureSourceMac::startProducingData): (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData): (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface): (WebCore::ScreenDisplayCaptureSourceMac::generateFrame): (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): (WebCore::ScreenDisplayCaptureSourceMac::applySize): (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate): (WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration): (WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured): (WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack): (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): 2018-01-05 Don Olmstead <don.olmstead@sony.com> [curl] Can't load file:// URL with a URL fragment identifier https://bugs.webkit.org/show_bug.cgi?id=181170 Reviewed by Alex Christensen. No new tests. No change in behavior. * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::invokeDidReceiveResponseForFile): 2018-01-05 Don Olmstead <don.olmstead@sony.com> TextCodec uses std::array but does not include it https://bugs.webkit.org/show_bug.cgi?id=181340 Reviewed by Alex Christensen. No new tests. No change in behavior. * platform/text/TextCodec.h: 2018-01-05 Said Abou-Hallawa <sabouhallawa@apple.com> SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating https://bugs.webkit.org/show_bug.cgi?id=181316 <rdar://problem/36147545> Reviewed by Simon Fraser. This is a speculative change to fix a crash which appeared after r226065. The crash is very intermittent and sometimes very hard to reproduce. The basic code analysis did not show how this crash can even happen. * svg/SVGAnimatedTypeAnimator.h: (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>, we need to detach the wrappers of the animated property if the animated values are going to change. This is similar to what we did in resetFromBaseValue(). * svg/properties/SVGAnimatedListPropertyTearOff.h: (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded): 2018-01-05 Matt Lewis <jlewis3@apple.com> Unreviewed, rolling out r226401. This caused timeouts on multiple platforms. Reverted changeset: "Implement Cache API partitioning based on ClientOrigin" https://bugs.webkit.org/show_bug.cgi?id=181240 https://trac.webkit.org/changeset/226401 2018-01-05 Dan Bernstein <mitz@apple.com> Fixed the build following AppKit API deprecations in a recent SDKs * platform/mac/PasteboardMac.mm: (WebCore::setDragImageImpl): Suppressed deprecation warnings. * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): Ditto. 2018-01-05 Joseph Pecoraro <pecoraro@apple.com> ServiceWorkers: Enable UserTiming / ResourceTiming https://bugs.webkit.org/show_bug.cgi?id=181297 <rdar://problem/36307306> Reviewed by Youenn Fablet. Tests: http/tests/workers/service/service-worker-resource-timing.https.html http/tests/workers/service/service-worker-user-timing.https.html * loader/ResourceTiming.cpp: (WebCore::ResourceTiming::ResourceTiming): We used to clear extra NetworkLoadMetrics data early on. However, for Workers we want to pass the complete NetworkLoadMetrics to the Worker so that a Worker inspector has access to it. * page/PerformanceResourceTiming.cpp: (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): Instead move the clearing of extra data to here, when the NetworkLoadMetrics have finally settled into being used only for a performance entry. 2018-01-04 Philippe Normand <pnormand@igalia.com> [EME][GStreamer] Fix wrong ifdef https://bugs.webkit.org/show_bug.cgi?id=181289 Reviewed by Alex Christensen. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove the ENCRYPTED_MEDIA ifdef from the VIDEO_TRACK ifdef block. Both have nothing to do together. 2018-01-05 Fujii Hironori <Hironori.Fujii@sony.com> [Cairo] Canvas: Path::clear should clear its transform https://bugs.webkit.org/show_bug.cgi?id=181320 Reviewed by Carlos Garcia Campos. Path of Cairo port has its cairo context. Path::clear() didn't clear the transform matrix of the context. Test: fast/canvas/reset-scaling-by-height-change.html * platform/graphics/cairo/PathCairo.cpp: (WebCore::Path::clear): Reset the transform matrix of Path. 2018-01-04 Devin Rousso <webkit@devinrousso.com> Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic https://bugs.webkit.org/show_bug.cgi?id=180770 Reviewed by Joseph Pecoraro. No change in functionality. * html/HTMLCanvasElement.h: * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::createContext2d): (WebCore::HTMLCanvasElement::createContextWebGL): (WebCore::HTMLCanvasElement::createContextWebGPU): (WebCore::HTMLCanvasElement::createContextBitmapRenderer): (WebCore::HTMLCanvasElement::reset): (WebCore::HTMLCanvasElement::paint): (WebCore::HTMLCanvasElement::setImageBuffer const): (WebCore::HTMLCanvasElement::addObserver): Deleted. (WebCore::HTMLCanvasElement::removeObserver): Deleted. (WebCore::HTMLCanvasElement::cssCanvasClients): Deleted. (WebCore::HTMLCanvasElement::notifyObserversCanvasChanged): Deleted. * html/OffscreenCanvas.h: * html/canvas/CanvasRenderingContext.h: * html/canvas/CanvasRenderingContext.cpp: * html/canvas/CanvasRenderingContext2D.h: * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::create): * html/canvas/CanvasRenderingContext2DBase.h: * html/canvas/ImageBitmapRenderingContext.h: * html/canvas/ImageBitmapRenderingContext.cpp: (WebCore::ImageBitmapRenderingContext::create): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::create): * html/canvas/WebGLRenderingContext.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::create): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): * html/canvas/WebGPURenderingContext.cpp: (WebCore::WebGPURenderingContext::create): Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each context, we can make the constructors private and force the usage of static `create` functions. This way, we have access to the fully constructed object and have a guaranteed path for creation. * html/CanvasBase.h: * html/CanvasBase.cpp: (WebCore::CanvasBase::~CanvasBase): (WebCore::CanvasBase::renderingContext const): (WebCore::CanvasBase::addObserver): (WebCore::CanvasBase::removeObserver): (WebCore::CanvasBase::notifyObserversCanvasChanged): (WebCore::CanvasBase::notifyObserversCanvasResized): (WebCore::CanvasBase::notifyObserversCanvasDestroyed): (WebCore::CanvasBase::cssCanvasClients const): * Modules/mediastream/CanvasCaptureMediaStreamTrack.h: * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed): (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): * css/CSSCanvasValue.h: Move the CanvasObserver class to CanvasBase so that it can also be used for OffscreenCanvas. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext): (WebCore::InspectorInstrumentation::didChangeCanvasMemory): (WebCore::InspectorInstrumentation::recordCanvasAction): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame): (WebCore::InspectorInstrumentation::didEnableExtension): (WebCore::InspectorInstrumentation::didCreateProgram): (WebCore::InspectorInstrumentation::willDeleteProgram): (WebCore::InspectorInstrumentation::isShaderProgramDisabled): (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas): (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted. * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl): (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl): (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl): (WebCore::InspectorInstrumentation::didEnableExtensionImpl): (WebCore::InspectorInstrumentation::didCreateProgramImpl): (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted. * inspector/agents/InspectorCanvasAgent.h: * inspector/agents/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::enable): (WebCore::InspectorCanvasAgent::requestNode): (WebCore::InspectorCanvasAgent::requestContent): (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes): (WebCore::contextAsScriptValue): (WebCore::InspectorCanvasAgent::resolveCanvasContext): (WebCore::InspectorCanvasAgent::startRecording): (WebCore::InspectorCanvasAgent::stopRecording): (WebCore::InspectorCanvasAgent::updateShader): (WebCore::InspectorCanvasAgent::frameNavigated): (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes): (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext): (WebCore::InspectorCanvasAgent::didChangeCanvasMemory): (WebCore::InspectorCanvasAgent::recordCanvasAction): (WebCore::InspectorCanvasAgent::canvasDestroyed): (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame): (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas): (WebCore::InspectorCanvasAgent::didEnableExtension): (WebCore::InspectorCanvasAgent::didCreateProgram): (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired): (WebCore::InspectorCanvasAgent::clearCanvasData): (WebCore::InspectorCanvasAgent::unbindCanvas): (WebCore::InspectorCanvasAgent::findInspectorCanvas): (WebCore::InspectorCanvasAgent::unbindProgram): (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted. * inspector/InspectorCanvas.h: * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::create): (WebCore::InspectorCanvas::InspectorCanvas): (WebCore::InspectorCanvas::canvasElement): (WebCore::InspectorCanvas::resetRecordingData): (WebCore::InspectorCanvas::recordAction): (WebCore::InspectorCanvas::buildObjectForCanvas): (WebCore::InspectorCanvas::getCanvasContentAsDataURL): (WebCore::InspectorCanvas::buildInitialState): (WebCore::InspectorCanvas::~InspectorCanvas): Deleted. * inspector/InspectorShaderProgram.h: * inspector/InspectorShaderProgram.cpp: (WebCore::InspectorShaderProgram::context const): * page/PageConsoleClient.cpp: (WebCore::PageConsoleClient::record): (WebCore::PageConsoleClient::recordEnd): * dom/Document.h: * dom/Document.cpp: (WebCore::Document::getCSSCanvasElement): (WebCore::Document::nameForCSSCanvasElement const): We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming it is not an OffscreenCanvas) when we need it. 2018-01-04 Chris Fleizach <cfleizach@apple.com> AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties https://bugs.webkit.org/show_bug.cgi?id=180361 Reviewed by Zalan Bujtas. Change speak -> speakAs, and allow a combination of properties. Tests: Updated accessibility/mac/css-speech-speak.html * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::speakAsProperty const): (WebCore::AccessibilityObject::speakProperty const): Deleted. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::speakAsProperty const): (WebCore::AccessibilityRenderObject::speakProperty const): Deleted. * accessibility/AccessibilityRenderObject.h: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilitySpeechHint]): * accessibility/mac/WebAccessibilityObjectWrapperBase.h: * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): * css/CSSComputedStyleDeclaration.cpp: (WebCore::speakAsToCSSValue): (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ESpeakAs const): (WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted. * css/CSSProperties.json: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertSpeakAs): * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * css/parser/CSSPropertyParser.cpp: (WebCore::consumeSpeakAs): (WebCore::CSSPropertyParser::parseSingleValue): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::speakAs const): (WebCore::RenderStyle::setSpeakAs): (WebCore::RenderStyle::initialSpeakAs): (WebCore::RenderStyle::speak const): Deleted. (WebCore::RenderStyle::setSpeak): Deleted. (WebCore::RenderStyle::initialSpeak): Deleted. * rendering/style/RenderStyleConstants.h: (WebCore::operator| ): (WebCore::operator|= ): * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * rendering/style/StyleRareInheritedData.h: 2018-01-04 Brian Burg <bburg@apple.com> Web Inspector: Capture Element Screenshot looks fuzzy https://bugs.webkit.org/show_bug.cgi?id=175734 <rdar://problem/33803377> Reviewed by Joseph Pecoraro and Simon Fraser. Screenshots taken by Web Inspector were being downscaled from the internal size to the logical size, causing them to be blurry when later upscaled to the internal size. Replace ScaleBehavior { Scaled, Unscaled } with PreserveResolution { No, Yes }. This is a lot less confusing to read both inside ImageBuffer and at its use sites. Remove unused CoordinateSystem argument for ImageBuffer::toDataURL, and replace it with PreserveResolution. Plumb PreserveResolution into toCFData so that PreserveResolution::Yes will preserve the internal size of the image buffer, just as it does in other methods that take PreserveResolution. At the use site in InspectorPageAgent, always request PreserveResolution::Yes snapshots when taking an element screenshot. For now, keep using downscaled (smaller) snapshots when capturing canvas previews, as the previews are not full-size. Test: inspector/page/hidpi-snapshot-size.html * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::makePresentationCopy): (WebCore::HTMLCanvasElement::copiedImage const): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::createPattern): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::snapshotNode): (WebCore::InspectorPageAgent::snapshotRect): * page/TextIndicator.cpp: (WebCore::takeSnapshot): * platform/DragImage.cpp: (WebCore::createDragImageFromSnapshot): * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::drawPattern): * platform/graphics/ImageBuffer.h: * platform/graphics/cairo/ImageBufferCairo.cpp: (WebCore::ImageBuffer::sinkIntoImage): (WebCore::ImageBuffer::copyImage const): (WebCore::ImageBuffer::toDataURL const): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::createBitmapImageAfterScalingIfNeeded): (WebCore::ImageBuffer::copyImage const): (WebCore::ImageBuffer::sinkIntoImage): (WebCore::ImageBuffer::toDataURL const): (WebCore::ImageBuffer::toData const): (WebCore::ImageBuffer::toCFData const): * platform/graphics/gtk/ImageBufferGtk.cpp: (WebCore::ImageBuffer::toDataURL const): * platform/graphics/win/ImageBufferDirect2D.cpp: (WebCore::ImageBuffer::copyImage const): (WebCore::ImageBuffer::sinkIntoImage): (WebCore::ImageBuffer::toDataURL const): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::drawPatternForContainer): 2018-01-04 John Wilander <wilander@apple.com> Storage Access API: Turn feature on by default in Settings.yaml https://bugs.webkit.org/show_bug.cgi?id=181298 <rdar://problem/36302506> Reviewed by Brent Fulgham. No new tests. This is just a feature settings change. * page/Settings.yaml: 2018-01-04 Zalan Bujtas <zalan@apple.com> WebContent process crashes while loading https://www.classicspecs.com https://bugs.webkit.org/show_bug.cgi?id=181290 <rdar://problem/36225906> Reviewed by Simon Fraser. Floats can overhang multiple blocks (they are called intruding floats). Each block keeps track of such intruding floats. When an overhanging float box is destroyed, we need to deregister it from all those blocks. We do it by walking up the ancestor block chain and check if the parent (grandparent etc) block still contains this float. Once we find the topmost block, we start deregistering it by traversing back on the descendant blocks. Normally we do it in RenderElement::takeChildInternal right before the box is getting detached. However in certain cases (like when the float's parent happens to be an anonymous wrapper) by the time we get to ::takeChildInternal the subtree is already detached and we can't access all the ancestors. This patch ensure that the floating box is still attached during de-registration. Test: fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html * rendering/RenderObject.cpp: (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers): 2018-01-04 Eric Carlson <eric.carlson@apple.com> [MediaStream] Add Mock screen capture source https://bugs.webkit.org/show_bug.cgi?id=181291 <rdar://problem/36298164> Reviewed by Dean Jackson. Tests: http/tests/media/media-stream/get-display-media-prompt.html GetDisplayMediaTest.BasicPrompt GetDisplayMediaTest.Constraints * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::MediaDevices): Add static_assert to ensure MediaDevices::DisplayCaptureSurfaceType and RealtimeMediaSourceSettings::DisplaySurfaceType values are equivalent. (WebCore::MediaDevices::getSupportedConstraints): Remove bogus code. * Modules/mediastream/MediaDevices.h: Add DisplayCaptureSurfaceType. * Modules/mediastream/MediaDevices.idl: Ditto. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::getSettings const): Add a FIXME. * Modules/mediastream/MediaStreamTrack.h: Add displaySurface and logicalSurface. * Modules/mediastream/MediaTrackSupportedConstraints.h: Remove displaySurface and logicalSurface. * Modules/mediastream/MediaTrackSupportedConstraints.idl: * SourcesCocoa.txt: Add DisplayCaptureManagerCocoa.cpp and DisplayCaptureSourceCocoa.cpp. * WebCore.xcodeproj/project.pbxproj: Ditto. * platform/mediastream/CaptureDevice.h: (WebCore::CaptureDevice::encode const): Add. (WebCore::CaptureDevice::decode): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): Include display capture "devices". (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Deal with display capture devices. (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): Ditto. * platform/mediastream/RealtimeMediaSourceCenter.h: * platform/mediastream/RealtimeMediaSourceSettings.h: (WebCore::RealtimeMediaSourceSettings::displaySurface const): Return a DisplaySurfaceType. (WebCore::RealtimeMediaSourceSettings::setDisplaySurface): Take a DisplaySurfaceType. * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp: (WebCore::DisplayCaptureManagerCocoa::singleton): (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): (WebCore::DisplayCaptureManagerCocoa::captureDevices): (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID): * platform/mediastream/mac/DisplayCaptureManagerCocoa.h: * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: Added. (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa): (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa): (WebCore::DisplayCaptureSourceCocoa::capabilities const): (WebCore::DisplayCaptureSourceCocoa::settings const): (WebCore::DisplayCaptureSourceCocoa::settingsDidChange): (WebCore::DisplayCaptureSourceCocoa::startProducingData): (WebCore::DisplayCaptureSourceCocoa::stopProducingData): (WebCore::DisplayCaptureSourceCocoa::elapsedTime): (WebCore::DisplayCaptureSourceCocoa::applyFrameRate): (WebCore::DisplayCaptureSourceCocoa::emitFrame): * platform/mediastream/mac/DisplayCaptureSourceCocoa.h: * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: (WebCore::RealtimeMediaSourceCenterMac::displayCaptureDeviceManager): New. * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: * platform/mock/MockRealtimeMediaSource.cpp: (WebCore::deviceMap): Add screen capture "devices". (WebCore::MockRealtimeMediaSource::displayDevices): New. * platform/mock/MockRealtimeMediaSource.h: * platform/mock/MockRealtimeMediaSourceCenter.cpp: Clean up includes. * platform/mock/MockRealtimeMediaSourceCenter.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Mock two screen devices. (WebCore::MockRealtimeVideoSource::updateSettings): Deal with mock screens. (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto. (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto. (WebCore::MockRealtimeVideoSource::drawText): Ditto. (WebCore::MockRealtimeVideoSource::generateFrame): Ditto. * platform/mock/MockRealtimeVideoSource.h: (WebCore::MockRealtimeVideoSource::mockCamera const): (WebCore::MockRealtimeVideoSource::mockScreen const): 2018-01-04 Youenn Fablet <youenn@apple.com> FetchResponse should set its internal response text encoding name https://bugs.webkit.org/show_bug.cgi?id=181284 Reviewed by Alex Christensen. Covered by rebased test. * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): Set response text encoding based on content type charset. 2018-01-04 John Wilander <wilander@apple.com> Storage Access API: Remove JavaScript confirm() prompt from Document::requestStorageAccess() https://bugs.webkit.org/show_bug.cgi?id=181276 <rdar://problem/36290463> Reviewed by Alex Christensen. No new tests. Existing test expectations updated. * dom/Document.cpp: (WebCore::Document::requestStorageAccess): 2018-01-04 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Issues with Ahem's ex / x-height https://bugs.webkit.org/show_bug.cgi?id=180581 Reviewed by Michael Catanzaro. Get the x-height value from the TT_OS2 table if available. Fixes: fast/text/break-word-pre-wrap.html imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-shape-arguments-000.html * platform/graphics/freetype/SimpleFontDataFreeType.cpp: (WebCore::Font::platformInit): 2018-01-04 Philippe Normand <pnormand@igalia.com> Unreviewed, GTK build fix attempt after r226357 * platform/graphics/gstreamer/GStreamerUtilities.h: The GST_BUFFER_DTS_OR_PTS macro was added in GStreamer 1.8 but old versions of Debian might not have this release yet. 2018-01-04 Youenn Fablet <youenn@apple.com> Implement Cache API partitioning based on ClientOrigin https://bugs.webkit.org/show_bug.cgi?id=181240 Reviewed by Alex Christensen. Covered by updated tests. Previously, cache storage was partitioned according the origin of the client, represented as a String. We now partition according both client and top origins, represented as a ClientOrigin Minor refactoring to use more makePendingActivity. Added support for IPC serialization of ClientOrigin. Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation. * Modules/cache/CacheStorageConnection.cpp: (WebCore::CacheStorageConnection::open): (WebCore::CacheStorageConnection::retrieveCaches): * Modules/cache/CacheStorageConnection.h: (WebCore::CacheStorageConnection::clearMemoryRepresentation): (WebCore::CacheStorageConnection::doOpen): (WebCore::CacheStorageConnection::doRetrieveCaches): * Modules/cache/DOMCacheStorage.cpp: (WebCore::DOMCacheStorage::origin const): (WebCore::DOMCacheStorage::retrieveCaches): (WebCore::DOMCacheStorage::open): (WebCore::DOMCacheStorage::remove): * Modules/cache/DOMCacheStorage.h: * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::WorkerCacheStorageConnection::doOpen): (WebCore::WorkerCacheStorageConnection::doRetrieveCaches): * Modules/cache/WorkerCacheStorageConnection.h: * page/ClientOrigin.h: (WebCore::ClientOrigin::isolatedCopy const): (WebCore::ClientOrigin::encode const): (WebCore::ClientOrigin::decode): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::toString const): (WebCore::SecurityOriginData::debugString const): Deleted. * page/SecurityOriginData.h: (WebCore::SecurityOriginData::debugString const): * testing/Internals.cpp: (WebCore::Internals::clearCacheStorageMemoryRepresentation): 2018-01-04 Youenn Fablet <youenn@apple.com> Service Worker should expose redirect mode for navigation loads as manual https://bugs.webkit.org/show_bug.cgi?id=181067 Reviewed by Alex Christensen. Covered by rebased tests. * loader/CrossOriginAccessControl.cpp: Removing ContentType header only if affecting CORS checks. This allows extending header filtering in service worker to all modes, including Navigate. * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Ideally, document loading code should set redirect to manual. Since it is not the case yet and that would require changes to various places, manual is set before exposing the corresponding fetch event. 2018-01-04 Youenn Fablet <youenn@apple.com> ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope should be a no-op if worker is being terminated https://bugs.webkit.org/show_bug.cgi?id=181245 Reviewed by Alex Christensen. Stop appending tasks to a terminating worker and returning false in that case. This mirrors what is done for regular workers. * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::terminateWorker): * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope): * workers/service/context/ServiceWorkerThreadProxy.h: 2018-01-04 Youenn Fablet <youenn@apple.com> Cancel pending script loads when service worker is being terminated https://bugs.webkit.org/show_bug.cgi?id=181250 Reviewed by Alex Christensen. Covered by service worker tests no longer crashing in ASAN builds. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::notifyFinished): Clearing loader when finished. (WebCore::WorkerScriptLoader::cancel): Implementing cancel of a script loader by cancelling the underlying threadable loader. * workers/WorkerScriptLoader.h: * workers/service/ServiceWorkerContainer.cpp: Canceling loads of all pending jobs. (WebCore::ServiceWorkerContainer::stop): * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::cancelPendingLoad): * workers/service/ServiceWorkerJob.h: 2018-01-04 Youenn Fablet <youenn@apple.com> Implement https://fetch.spec.whatwg.org/#main-fetch default referrer policy setting https://bugs.webkit.org/show_bug.cgi?id=181239 Reviewed by Alex Christensen. Covered by updated and rebased test. Setting the request referrer policy to the Document referrer policy if no one is set. If Document has no referrer policy, use no-referrer-when-downgrade as per the spec. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::updateHTTPRequestHeaders): (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceLoader.h: * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::updateReferrerPolicy): (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders): * loader/cache/CachedResourceRequest.h: 2018-01-03 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Create attachment elements when dropping files on iOS https://bugs.webkit.org/show_bug.cgi?id=181192 <rdar://problem/36280945> Reviewed by Tim Horton. Implements support for dropping data as attachment elements on iOS. See comments below for more detail. Tests: WKAttachmentTests.InsertDroppedRichAndPlainTextFilesAsAttachments WKAttachmentTests.InsertDroppedZipArchiveAsAttachment WKAttachmentTests.InsertDroppedItemProvidersInOrder * WebCore.xcodeproj/project.pbxproj: * editing/WebContentReader.cpp: (WebCore::WebContentReader::ensureFragment): Add a new helper to create the WebContentReader's fragment, if it hasn't already been created. * editing/WebContentReader.h: * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readFilePaths): Rename readFilenames to readFilePaths (which better reflects its parameters, which are file paths). Also, move the implementation of readFilePaths to shared iOS/macOS code in WebContentReaderCocoa, and remove the stub implementation on iOS. There's a bit of code here that I kept macOS-only which deals with inserting file paths as plain text in editable areas, but it's unclear to me why and if WebKit clients currently find this useful, so I left a FIXME to investigate removing this altogether. Code for handling this plain text insertion of file paths on Mac was introduced in r67403. * editing/ios/WebContentReaderIOS.mm: (WebCore::WebContentReader::readFilenames): Deleted. * editing/mac/WebContentReaderMac.mm: (WebCore::WebContentReader::readFilenames): Deleted. * page/mac/DragControllerMac.mm: (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod const): Teach DragController to accept all types conforming to "public.item" and "public.content" on iOS, only when attachment elements are enabled. This allows us to load content from item providers that we otherwise would not have loaded, since we now have the ability to fall back to attachment element insertion if the type is not have a default representation using standard web content. * platform/Pasteboard.h: * platform/PasteboardItemInfo.h: Added. (WebCore::PasteboardItemInfo::encode const): (WebCore::PasteboardItemInfo::decode): Add PasteboardItemInfo, a struct that describes an item on the pasteboard. Also, implement encoding and decoding support for PasteboardItemInfo. So far, the item info only describes file information about the pasteboard item, and flags indicating whether the item prefers attachment or inline presentation. * platform/PasteboardStrategy.h: Replace getFilenamesForDataInteraction with informationForItemAtIndex. Instead of returning all of the file paths associated with any item on the pasteboard, fetch a PasteboardItemInfo at a given item index, which includes information about the file path as well as some other metadata we'll need when deciding how to read pasteboard contents as a document fragment. * platform/PlatformPasteboard.h: * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::read): * platform/ios/AbstractPasteboard.h: * platform/ios/PasteboardIOS.mm: (WebCore::Pasteboard::read): (WebCore::Pasteboard::readRespectingUTIFidelities): Teach the iOS Pasteboard to read web content using attachment elements, if enabled. There are two scenarios in which we would want to insert an attachment element: (1) The item provider uses a preferred presentation style of attachment, in which case we bail out of trying to handle the drop using the default mechanisms, and simply insert it as an attachment. We need this to deal with the case where we drop text or HTML files from the Files app, so that we don't try and insert the contents of the text or HTML as inline web content. (2) The item provider doesn't have a preferred attachment presentation style, but there's nothing WebKit would otherwise do with the dropped content, so insert an attachment element as a fallback. Examples where this is relevant are dropping a PDF or ZIP archive without attachment presentation style explicitly set. We first check if we fall into case (1). If so, we can bail early by inserting an attachment; otherwise, we proceed normally and see if we can read the contents of the drop as web content. If, at the end of default drop handling, we don't still have a way to represent the dropped content, enter case (2). (WebCore::Pasteboard::readFilePaths): (WebCore::Pasteboard::readFilenames): Deleted. Rename readFilenames to readFilePaths, and reimplement it using informationForItemAtIndex. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::pasteboardItemPresentationStyle): (WebCore::PlatformPasteboard::informationForItemAtIndex): (WebCore::PlatformPasteboard::filenamesForDataInteraction): Deleted. Implement informationForItemAtIndex and remove filenamesForDataInteraction. As before, we ask the pasteboard (i.e. WebItemProviderPasteboard) for information about dropped file URLs. This time, we limit this to a single file, so we don't end up creating multiple attachment elements for each representation of a single item provider. See below for -preferredFileUploadURLAtIndex:fileType: for more detail. * platform/ios/WebItemProviderPasteboard.h: * platform/ios/WebItemProviderPasteboard.mm: (-[WebItemProviderLoadResult initWithItemProvider:typesToLoad:]): (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]): Remove this synthesized instance variable and instead just check the item provider's preferredPresentationStyle. (-[WebItemProviderLoadResult description]): Add a verbose -description to the load result object. Useful for debugging what was content was loaded from an item provider on drop. (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]): Return the highest fidelity loaded type identifier for a given item. (-[WebItemProviderPasteboard allDroppedFileURLs]): (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]): Prefer flat RTFD to RTFD. In the case where attachments are enabled and we're accepting all types of content using attachment elements as a fallback representation, if the source writes attributed strings to the pasteboard with com.apple.rtfd at a higher fidelity than com.apple.flat-rtfd, we'll end up loading only com.apple.rtfd and dropping the text as an attachment element because we cannot convert the dropped content to markup. Instead, if flat RTFD is present in the item provider, always prefer that over RTFD so that dropping as regular web content isn't overridden when attachment elements are enabled. (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]): (-[WebItemProviderPasteboard droppedFileURLs]): Deleted. * platform/mac/DragDataMac.mm: (WebCore::DragData::containsCompatibleContent const): DragData::containsCompatibleContent should be true when attachment elements are enabled, and there are files we can drop as attachment elements. * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::read): (WebCore::Pasteboard::readFilePaths): (WebCore::Pasteboard::readFilenames): Deleted. 2018-01-03 Ting-Wei Lan <lantw44@gmail.com> Replace hard-coded paths in shebangs with #!/usr/bin/env https://bugs.webkit.org/show_bug.cgi?id=181040 Reviewed by Alex Christensen. * bindings/scripts/InFilesCompiler.pm: * bindings/scripts/InFilesParser.pm: * bindings/scripts/generate-bindings-all.pl: * bindings/scripts/generate-bindings.pl: * bindings/scripts/preprocess-idls.pl: * css/make-css-file-arrays.pl: * css/makeprop.pl: * css/makevalues.pl: * dom/make_event_factory.pl: * dom/make_names.pl: * extract-localizable-strings.pl: * make-hash-tools.pl: 2018-01-03 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Add plumbing for starting a drag with promised blob data https://bugs.webkit.org/show_bug.cgi?id=181201 Reviewed by Tim Horton. Adds logic to allow dragging an attachment element as a file by sending promised blob information to the UI process. See comments below for more detail. The only change in behavior is that dragging an attachment element will no longer write web content and injected bundle data to the pasteboard if the attachment element's file attribute is nonnull. This will cause one existing WK1 layout test to fail, but will otherwise not affect any attachment editing clients. On iOS, attachment elements in the Mail viewer can be dragged, but each attachment's file is null, so we fall back to current behavior; on macOS, Mail currently overrides the drag completely, beginning at -mouseDown:, so this doesn't make a difference to macOS Mail either. * editing/Editor.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::getPasteboardTypesAndDataForAttachment): Add a helper method to retrieve an attachment element as web archive data, for moving attachments within the same document. Also gives the injected editor bundle a chance to supply custom pasteboard types. * loader/EmptyClients.cpp: * page/DragClient.h: (WebCore::DragClient::prepareToDragPromisedBlob): Add new DragClient methods to send information about a promised blob to the UI process. * page/DragController.cpp: (WebCore::DragController::startDrag): Call dragAttachmentElement when starting a drag on an attachment element. (WebCore::DragController::dragAttachmentElement): Try to begin dragging a given attachment element, propagating promised blob information to the client layers. Returns true iff the attachment is backed by blob data (i.e. the file is nonnull). * platform/PromisedBlobInfo.h: Add a list of additional types and data to PromisedBlobInfo. In addition to the promised blob info, this would allow injected bundle data and other private types alongside the main attachment data on the pasteboard. 2018-01-03 Simon Fraser <simon.fraser@apple.com> Remove the 'resolutionScale' parameter from ImageBufferDataCG get/putBytes https://bugs.webkit.org/show_bug.cgi?id=181268 Reviewed by Alex Christensen. These functions were always called with resolutionScale=1. * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::getUnmultipliedImageData const): (WebCore::ImageBuffer::getPremultipliedImageData const): (WebCore::ImageBuffer::putByteArray): * platform/graphics/cg/ImageBufferDataCG.cpp: (WebCore::ImageBufferData::getData const): (WebCore::ImageBufferData::putData): (WebCore::affineWarpBufferData): Deleted. * platform/graphics/cg/ImageBufferDataCG.h: 2018-01-03 John Wilander <wilander@apple.com> Storage Access API: Refactor XPC for access removal to go straight from the web process to the network process https://bugs.webkit.org/show_bug.cgi?id=181270 <rdar://problem/36289544> Reviewed by Alex Christensen. No new tests. Existing test re-enabled. This change refactors how the web process tells the network process to remove storage access. Previously, this was done over the UI process just like requests for storage access. But since no further reasoning is needed, the message should go straight from the web process to the network process for performance reasons and to minimize the risk of a race. As a consequence, the XPC code for storage access removal in the UI process is deleted. * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::cookieStoragePartition const): Removes the storageAccessAPIEnabled check since the flag doesn't get propagated when the network process is created. Figuring this out will take some work which is unnecessary when we already gate access to the feature in Document.idl. 2018-01-03 James Craig <jcraig@apple.com> AX: when invert colors is on, double-invert certain media elements in UserAgentStyleSheet https://bugs.webkit.org/show_bug.cgi?id=168447 <rdar://problem/30559874> Reviewed by Simon Fraser. Double-invert video when platform 'invert colors' setting is enabled. Behavior matches current 'Smart Invert' feature of Safari Reader on macOS/iOS and other iOS native apps. Tests: accessibility/smart-invert-reference.html accessibility/smart-invert.html * Modules/modern-media-controls/controls/media-controls.css: (@media (inverted-colors)): (:host): (picture): * css/html.css: (@media (inverted-colors)): (video): 2018-01-03 Youenn Fablet <youenn@apple.com> LayoutTest http/tests/media/media-stream/disconnected-frame.html to consistently fail an assertion: !m_adoptionIsRequired https://bugs.webkit.org/show_bug.cgi?id=181264 Reviewed by Eric Carlson. Covered by http/tests/media/media-stream/disconnected-frame.html not crashing anymore in Debug builds. Calling suspendIfNeeded in create method instead of constructor. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::create): (WebCore::UserMediaRequest::UserMediaRequest): 2018-01-03 Antti Koivisto <antti@apple.com> Remove DeprecatedCSSOMValue::equals https://bugs.webkit.org/show_bug.cgi?id=181241 Reviewed by Zalan Bujtas. This is dead code. * css/DeprecatedCSSOMValue.cpp: (WebCore::compareCSSOMValues): Deleted. (WebCore::DeprecatedCSSOMValue::equals const): Deleted. * css/DeprecatedCSSOMValue.h: (WebCore::DeprecatedCSSOMValue::operator== const): Deleted. (WebCore::DeprecatedCSSOMComplexValue::equals const): Deleted. * css/DeprecatedCSSOMValueList.cpp: (WebCore::DeprecatedCSSOMValueList::equals const): Deleted. * css/DeprecatedCSSOMValueList.h: 2018-01-03 Simon Fraser <simon.fraser@apple.com> feLighting is broken with primitiveUnits="objectBoundingBox" https://bugs.webkit.org/show_bug.cgi?id=181197 Reviewed by Tim Horton. With <filter primitiveUnits="objectBoundingBox"> we need to convert the coordinates of fePointLights and feSpotLights into user space coordinates. Following https://www.w3.org/TR/SVG/filters.html#FilterElementPrimitiveUnitsAttribute this is done by treating them as fractions of the bounding box on the referencing element, with treatment for z following https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage To do this, store the bounds of the referencing elemenet on SVGFilterBuilder as targetBoundingBox, and store the primitiveUnits type. Then do the conversion of lighting coordinates in SVGFESpecularLightingElement::build() and SVGFEDiffuseLightingElement::build(). Remove SVGFELightElement::findLightSource(), since we need to be able to pass the SVGFilterBuilder to the lightSource() function so hoist the code up. Tests: svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox.svg svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox-expected.svg svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox.svg svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox.svg * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::buildPrimitives const): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::build): * svg/SVGFEDistantLightElement.cpp: (WebCore::SVGFEDistantLightElement::lightSource const): * svg/SVGFEDistantLightElement.h: * svg/SVGFELightElement.cpp: (WebCore::SVGFELightElement::findLightSource): Deleted. * svg/SVGFELightElement.h: * svg/SVGFEPointLightElement.cpp: (WebCore::SVGFEPointLightElement::lightSource const): * svg/SVGFEPointLightElement.h: * svg/SVGFESpecularLightingElement.cpp: (WebCore::SVGFESpecularLightingElement::build): * svg/SVGFESpotLightElement.cpp: (WebCore::SVGFESpotLightElement::lightSource const): * svg/SVGFESpotLightElement.h: * svg/graphics/filters/SVGFilterBuilder.h: (WebCore::SVGFilterBuilder::setTargetBoundingBox): (WebCore::SVGFilterBuilder::targetBoundingBox const): (WebCore::SVGFilterBuilder::primitiveUnits const): (WebCore::SVGFilterBuilder::setPrimitiveUnits): 2018-01-03 Antti Koivisto <antti@apple.com> Crash beneath CSSValue::equals @ csas.cz https://bugs.webkit.org/show_bug.cgi?id=181243 <rdar://problem/35990826> Reviewed by Alex Christensen. Test: fast/text/oblique-degree-equals-crash.html * css/CSSFontStyleValue.cpp: (WebCore::CSSFontStyleValue::equals const): Null check both oblique pointers. 2018-01-03 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies) https://bugs.webkit.org/show_bug.cgi?id=180979 <rdar://problem/36146670> Reviewed by Matt Baker. * platform/graphics/cocoa/FontCacheCoreText.cpp: (fontNameIsSystemFont): (WebCore::FontCache::systemFontFamilies): Switch to the original Mac algorithm before r180979 that uses CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't available on iOS but now it is. This is a performance improvement on both platforms, but significantly so on macOS. It also finds more, valid, family names. 2018-01-03 Michael Catanzaro <mcatanzaro@igalia.com> ASSERTION FAILED: !source || is<Target>(*source) in CoordinatedGraphicsLayer::removeFromParent https://bugs.webkit.org/show_bug.cgi?id=166568 Reviewed by Simon Fraser. When a GraphicsLayer has a mask layer, it fails to properly unparent the mask layer before it is destroyed. This leaves the mask layer with a dangling parent pointer. Fix it, while taking care not to introduce yet another virtual function call during the execution of the destructor. * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::willBeDestroyed): 2018-01-03 Simon Fraser <simon.fraser@apple.com> SVG lighting filter lights are in the wrong coordinate system https://bugs.webkit.org/show_bug.cgi?id=181147 Reviewed by Zalan Bujtas. Point and spot light coordinates weren't being converted into buffer-relative coordinates before being fed into the lighting math, resulting in incorrect light rendering on Retina devices, and when the filter primitive region was clipped. Fix by storing absoluteUnclippedSubregion on FilterEffect, which allows us to map lighting points from user space coordinates into the coordinates of the buffer being used for rendering. Also scale the light z coordinate by doing a dummy point mapping in x. Rename members of PointLightSource and SpotLightSource to make it clear which coordinate system they are in. Tests include HiDPI tests. Tests: svg/filters/fePointLight-coordinates-expected.svg svg/filters/fePointLight-coordinates.svg svg/filters/feSpotLight-coordinates-expected.svg svg/filters/feSpotLight-coordinates.svg svg/filters/hidpi/fePointLight-coordinates-expected.svg svg/filters/hidpi/fePointLight-coordinates.svg svg/filters/hidpi/feSpotLight-coordinates-expected.svg svg/filters/hidpi/feSpotLight-coordinates.svg * platform/graphics/FloatPoint3D.h: Make it easy to get and set the X and Y coords as a FloatPoint. (WebCore::FloatPoint3D::xy const): (WebCore::FloatPoint3D::setXY): * platform/graphics/GeometryUtilities.cpp: (WebCore::mapPoint): (WebCore::mapRect): * platform/graphics/GeometryUtilities.h: Helper to make a point between rects. * platform/graphics/filters/DistantLightSource.cpp: (WebCore::DistantLightSource::initPaintingData): * platform/graphics/filters/DistantLightSource.h: * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::mapPointFromUserSpaceToBuffer const): * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::setUnclippedAbsoluteSubregion): * platform/graphics/filters/LightSource.h: * platform/graphics/filters/PointLightSource.cpp: (WebCore::PointLightSource::initPaintingData): (WebCore::PointLightSource::computePixelLightingData const): (WebCore::PointLightSource::setX): (WebCore::PointLightSource::setY): (WebCore::PointLightSource::setZ): * platform/graphics/filters/PointLightSource.h: (WebCore::PointLightSource::position const): (WebCore::PointLightSource::PointLightSource): * platform/graphics/filters/SpotLightSource.cpp: (WebCore::SpotLightSource::initPaintingData): (WebCore::SpotLightSource::computePixelLightingData const): (WebCore::SpotLightSource::setX): (WebCore::SpotLightSource::setY): (WebCore::SpotLightSource::setZ): (WebCore::SpotLightSource::setPointsAtX): (WebCore::SpotLightSource::setPointsAtY): (WebCore::SpotLightSource::setPointsAtZ): * platform/graphics/filters/SpotLightSource.h: (WebCore::SpotLightSource::position const): (WebCore::SpotLightSource::direction const): (WebCore::SpotLightSource::SpotLightSource): * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::buildPrimitives const): * rendering/svg/RenderSVGResourceFilterPrimitive.cpp: (WebCore::RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion): 2018-01-03 Youenn Fablet <youenn@apple.com> Select service worker for documents with data/blob URLS https://bugs.webkit.org/show_bug.cgi?id=181213 Reviewed by Alex Christensen. Covered by updated test. Reusing the service worker of the parent for blob/data URL documents. * loader/DocumentLoader.cpp: (WebCore::isLocalURL): (WebCore::DocumentLoader::commitData): 2018-01-03 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, rolling out r226352. Breaks Sierra and El Capitan builds. Reverted changeset: "Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)" https://bugs.webkit.org/show_bug.cgi?id=180979 https://trac.webkit.org/changeset/226352 2018-01-03 Philippe Normand <pnormand@igalia.com> [GStreamer] The bus synchronous handler should be in the base player class https://bugs.webkit.org/show_bug.cgi?id=181237 Reviewed by Carlos Garcia Campos. Because this is where video rendering is handled. No new tests, this is only a refactoring. * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline): 2018-01-03 Philippe Normand <pnormand@igalia.com> [GStreamer] move MediaSample implementation out of mse/ https://bugs.webkit.org/show_bug.cgi?id=179165 Reviewed by Carlos Garcia Campos. This module isn't specific to MSE and can potentially be reused elsewhere, for WebRTC for instance. Additionally the ::platformSample() method was implemented and the code was cleaned up. * platform/GStreamer.cmake: * platform/MediaSample.h: * platform/graphics/gstreamer/GStreamerMediaSample.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp. (WebCore::GStreamerMediaSample::platformSample): * platform/graphics/gstreamer/GStreamerMediaSample.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h. * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: (WebCore::PlaybackPipeline::enqueueSample): 2018-01-03 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix resource load stats tests on GLib based ports after r226355. The monitor can be created in the work queue thread too. * platform/glib/FileMonitorGLib.cpp: (WebCore::FileMonitor::FileMonitor): 2018-01-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Crash destroying WebCore::FileMonitor https://bugs.webkit.org/show_bug.cgi?id=181138 Reviewed by Michael Catanzaro. Ensure that platform file monitor is always created and destroyed in the work queue thread synchronously. * platform/FileMonitor.h: * platform/glib/FileMonitorGLib.cpp: (WebCore::FileMonitor::FileMonitor): (WebCore::FileMonitor::~FileMonitor): (WebCore::FileMonitor::didChange): 2018-01-02 Joseph Pecoraro <pecoraro@apple.com> Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies) https://bugs.webkit.org/show_bug.cgi?id=180979 <rdar://problem/36146670> Reviewed by Matt Baker. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::systemFontFamilies): Switch to the original Mac algorithm before r180979 that uses CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't available on iOS but now it is. This is a performance improvement on both platforms, but significantly so on macOS. It also finds more, valid, family names. 2018-01-02 Yusuke Suzuki <utatane.tea@gmail.com> Unreviewed, fix GCC warning by using #include https://bugs.webkit.org/show_bug.cgi?id=181189 This file is included in C++ files. Use #include instead of #import to suppress warning in GCC. * platform/PromisedBlobInfo.h: 2017-12-28 Yusuke Suzuki <utatane.tea@gmail.com> Remove std::chrono completely https://bugs.webkit.org/show_bug.cgi?id=181186 Reviewed by Alex Christensen. Use MonotonicTime, WallTime, and Seconds instead. Changes are mechanical ones. But persistent network cache data is changed. So we bump the version number of the cache storage. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): (WebCore::IDBServer::removeAllDatabasesForOriginPath): (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince): (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins): * Modules/indexeddb/server/IDBServer.h: * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): * Modules/webdatabase/DatabaseTracker.h: * dom/Document.cpp: (WebCore::Document::lastModified): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::clearMediaCache): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::clearMediaCache): * loader/CrossOriginPreflightResultCache.cpp: (WebCore::parseAccessControlMaxAge): (WebCore::CrossOriginPreflightResultCacheItem::parse): (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const): * loader/CrossOriginPreflightResultCache.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): (WebCore::CachedResource::freshnessLifetime const): (WebCore::CachedResource::responseReceived): (WebCore::CachedResource::updateResponseAfterRevalidation): * loader/cache/CachedResource.h: * platform/FileSystem.cpp: (WebCore::FileSystem::getFileModificationTime): * platform/FileSystem.h: * platform/SearchPopupMenu.h: * platform/cocoa/SearchPopupMenuCocoa.h: * platform/cocoa/SearchPopupMenuCocoa.mm: (WebCore::toSystemClockTime): (WebCore::toNSDateFromSystemClock): (WebCore::removeRecentlyModifiedRecentSearches): * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::clearMediaCache): * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::clearMediaCache): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::toSystemClockTime): (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache): * platform/graphics/mac/MediaPlayerPrivateQTKit.h: * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivateQTKit::clearMediaCache): * platform/network/CacheValidation.cpp: (WebCore::computeCurrentAge): (WebCore::computeFreshnessLifetimeForHTTPFamily): (WebCore::updateRedirectChainStatus): (WebCore::redirectChainAllowsReuse): (WebCore::parseCacheControlDirectives): * platform/network/CacheValidation.h: (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus): * platform/network/HTTPParsers.cpp: (WebCore::parseHTTPDate): * platform/network/HTTPParsers.h: * platform/network/PlatformCookieJar.h: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::cacheControlMaxAge const): (WebCore::parseDateValueInHeader): (WebCore::ResourceResponseBase::date const): (WebCore::ResourceResponseBase::age const): (WebCore::ResourceResponseBase::expires const): (WebCore::ResourceResponseBase::lastModified const): * platform/network/ResourceResponseBase.h: * platform/network/cf/CookieJarCFNet.cpp: (WebCore::deleteAllCookiesModifiedSince): * platform/network/curl/CookieJarCurl.cpp: (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince): (WebCore::deleteAllCookiesModifiedSince): * platform/network/curl/CookieJarCurl.h: * platform/network/curl/CurlCacheEntry.cpp: (WebCore::CurlCacheEntry::CurlCacheEntry): (WebCore::CurlCacheEntry::isCached): (WebCore::CurlCacheEntry::parseResponseHeaders): * platform/network/curl/CurlCacheEntry.h: * platform/network/mac/CookieJarMac.mm: (WebCore::deleteAllCookiesModifiedSince): * platform/network/soup/CookieJarSoup.cpp: (WebCore::deleteAllCookiesModifiedSince): * platform/win/SearchPopupMenuWin.cpp: (WebCore::SearchPopupMenuWin::loadRecentSearches): * rendering/RenderSearchField.cpp: (WebCore::RenderSearchField::addSearchResult): 2018-01-02 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Introduce data structures and IPC support for writing promised blobs https://bugs.webkit.org/show_bug.cgi?id=181189 Reviewed by Tim Horton. Introduces a new header containing structs to be used for writing blob data when dragging. PromisedBlobInfo represents information needed to declare data on the pasteboard that will eventually be provided via a Blob. This includes the type and filename of the Blob-backed content. PromisedBlobData represents information needed to actually deliver the Blob's content to the platform, and is sent some time after its corresponding PromisedBlobInfo. The content may either be in the form of a file path (as is the case using the previous declareAndWriteAttachment codepath) or a data buffer (which we would use if the Blob is not already backed by a file on disk). No new tests, since there is no observable change in functionality yet. * WebCore.xcodeproj/project.pbxproj: * platform/PromisedBlobInfo.h: Added. (WebCore::PromisedBlobInfo::operator bool const): (WebCore::PromisedBlobData::hasData const): (WebCore::PromisedBlobData::hasFile const): (WebCore::PromisedBlobData::operator bool const): (WebCore::PromisedBlobData::fulfills const): 2018-01-02 Brady Eidson <beidson@apple.com> Make MessagePortChannel::takeAllMessagesFromRemote asynchronous. https://bugs.webkit.org/show_bug.cgi?id=181205 Reviewed by Alex Christensen. No new tests (No behavior change) This is needed for the ongoing WK2 MessagePort work. For WK1 in-process MessagePorts it is still synchronous; no behavior change. * dom/InProcessMessagePortChannel.cpp: (WebCore::InProcessMessagePortChannel::takeAllMessagesFromRemote): * dom/InProcessMessagePortChannel.h: * dom/MessagePort.cpp: (WebCore::MessagePort::dispatchMessages): * dom/MessagePortChannel.h: 2018-01-02 Jiewen Tan <jiewen_tan@apple.com> Add a WebAuthentication runtime feature flag https://bugs.webkit.org/show_bug.cgi?id=181220 <rdar://problem/36055305> Reviewed by Brent Fulgham. This patch basically renames the CredentialManagement runtime feature flag into WebAuthentication runtime feature flag. No tests. * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/PublicKeyCredential.idl: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setWebAuthenticationEnabled): (WebCore::RuntimeEnabledFeatures::webAuthenticationEnabled const): (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Deleted. (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled const): Deleted. 2018-01-02 Wenson Hsieh <wenson_hsieh@apple.com> [Attachment Support] Don't Blob-convert images and attachments with https:, http: or data: urls https://bugs.webkit.org/show_bug.cgi?id=181143 <rdar://problem/36200381> Reviewed by Tim Horton. Clients such as Mail would expect pasting or dropping an image with src="https://..." to result in the source URL being preserved (i.e. staying as remote images) instead of creating image attachments out of them. This patch hooks into the shouldConvertToBlob() check added in r226272 so that it applies to attachment element replacement as well. Test: WKAttachmentTests.DoNotInsertDataURLImagesAsAttachments * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::shouldConvertToBlob): (WebCore::replaceRichContentWithAttachments): 2018-01-02 Brady Eidson <beidson@apple.com> Identify MessagePorts by a globally unique MessagePortIdentifier. https://bugs.webkit.org/show_bug.cgi?id=181172 Reviewed by Alex Christensen. No new tests (Behavior change covered by all existing tests). This cleans up the abstract MessagePortChannel interface to be in terms of identifiers instead of actual MessagePort objects. The identifiers are compounded with the current ProcessIdentifier meaning they are global across all processes for the running UI process, enabling easy cross-process communication. (Actual cross-process communication comes in a followup) * WebCore.xcodeproj/project.pbxproj: * dom/InProcessMessagePortChannel.cpp: (WebCore::InProcessMessagePortChannel::createChannelBetweenPorts): (WebCore::InProcessMessagePortChannel::isConnectedTo): (WebCore::InProcessMessagePortChannel::entangleWithRemoteIfOpen): (WebCore::InProcessMessagePortChannel::entangleIfOpen): Deleted. * dom/InProcessMessagePortChannel.h: * dom/MessageChannel.cpp: (WebCore::MessageChannel::MessageChannel): (WebCore::m_port2): * dom/MessagePort.cpp: (WebCore::allMessagePortsLock): (WebCore::MessagePort::ref const): (WebCore::MessagePort::deref const): (WebCore::MessagePort::existingMessagePortForIdentifier): (WebCore::MessagePort::MessagePort): (WebCore::MessagePort::~MessagePort): (WebCore::MessagePort::postMessage): (WebCore::MessagePort::entangleWithRemote): (WebCore::MessagePort::entanglePorts): (WebCore::MessagePort::entangle): Deleted. * dom/MessagePort.h: * dom/MessagePortChannel.h: * dom/MessagePortIdentifier.h: Added. (WebCore::operator==): (WebCore::MessagePortIdentifier::encode const): (WebCore::MessagePortIdentifier::decode): (WebCore::MessagePortIdentifier::hash const): (WTF::MessagePortIdentifierHash::hash): (WTF::MessagePortIdentifierHash::equal): (WTF::HashTraits<WebCore::MessagePortIdentifier>::emptyValue): (WTF::HashTraits<WebCore::MessagePortIdentifier>::constructDeletedValue): (WTF::HashTraits<WebCore::MessagePortIdentifier>::isDeletedValue): 2018-01-02 Youenn Fablet <youenn@apple.com> Memory cache should not reuse resources with different credential fetch option https://bugs.webkit.org/show_bug.cgi?id=181212 Reviewed by Alex Christensen. Covered by rebased test. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::determineRevalidationPolicy const): 2018-01-02 Jiewen Tan <jiewen_tan@apple.com> Update Credential Management API for WebAuthentication https://bugs.webkit.org/show_bug.cgi?id=181082 <rdar://problem/36055239> Reviewed by Brent Fulgham. Part 2/2 This patch implements Core API from Credential Management API: https://www.w3.org/TR/credential-management-1/#core. which is required by WebAuthN. It also sets the CredentialManagement runtime flag to enable testing. Note that it introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, which cannot be instantiated. Tests: http/wpt/credential-management/credentialscontainer-create-basics.https.html http/wpt/credential-management/credentialscontainer-get-basics.https.html http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html http/wpt/credential-management/idl.https.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.cpp: (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::type const): * Modules/credentialmanagement/BasicCredential.h: (WebCore::BasicCredential::discovery const): * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::isSameOriginWithItsAncestors): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess): * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::create): (WebCore::CredentialsContainer::CredentialsContainer): Deleted. * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.cpp: (WebCore::NavigatorCredentials::credentials): * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/PublicKeyCredential.cpp: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::collectFromCredentialStore): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::store): (WebCore::PublicKeyCredential::create): * Modules/webauthn/PublicKeyCredential.h: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. * Modules/webauthn/PublicKeyCredential.idl: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * page/RuntimeEnabledFeatures.h: 2018-01-02 Oleksandr Skachkov <gskachkov@gmail.com> WebAssembly: sending module to iframe fails https://bugs.webkit.org/show_bug.cgi?id=179263 Reviewed by JF Bastien. Allow use WebAssembly.Module as input parameters for postMessage in window and iframe object. To prevent sending message to iframe that is not ready, in iframe-* test we are waiting message from iframe only after that we send message to it. Tests: wasm/iframe-parent-postmessage.html wasm/iframe-postmessage.html wasm/window-postmessage.html * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal): * bindings/js/SerializedScriptValue.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::postMessage): == Rolled over to ChangeLog-2018-01-01 ==