2016-09-30 Babak Shafiei Merge follow up fix for rdar://problem/28567561. 2016-09-30 Anders Carlsson Follow up for Add CSS -webkit-appearance property for Apple Pay buttons Reviewed by Dan Bernstein. * css/CSSParser.cpp: (WebCore::isKeywordPropertyID): Add CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType. * rendering/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::paintApplePayButton): Make sure to reinitialize the text matrix. 2016-09-30 Babak Shafiei Merge r206181. rdar://problem/28408503 2016-09-20 Anders Carlsson Remove "in-store" from "-apple-pay-button-type" https://bugs.webkit.org/show_bug.cgi?id=162321 rdar://problem/28394581 Reviewed by Beth Dakin. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType): * css/CSSValueKeywords.in: * css/parser/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * rendering/RenderThemeCocoa.mm: (WebCore::toPKPaymentButtonType): * rendering/style/RenderStyleConstants.h: 2016-09-30 Babak Shafiei Merge r205992. rdar://problem/28567561 2016-09-15 Anders Carlsson Fix build. * platform/spi/cocoa/PassKitSPI.h: 2016-09-30 Babak Shafiei Merge r205980. rdar://problem/28567561 2016-09-14 Anders Carlsson Add CSS -webkit-appearance property for Apple Pay buttons https://bugs.webkit.org/show_bug.cgi?id=161986 Reviewed by Dean Jackson. Add a new -webkit-appearance property, "-apple-pay-button". Also, add two properties, "-apple-pay-button-type" and "-apple-pay-button-style". * WebCore.xcodeproj/project.pbxproj: Add RenderThemeCocoa.h and RenderThemeCocoa.mm. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType. * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ApplePayButtonStyle): (WebCore::CSSPrimitiveValue::operator ApplePayButtonType): Add ApplePayButtonStyle and ApplePayButtonType conversion routines. * css/CSSPropertyNames.in: Add -apple-pay-button-style and -apple-pay-button-type. * css/CSSValueKeywords.in: Add CSS values. * css/parser/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType. * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isKeywordPropertyID): Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType. (WebCore::isAppleLegacyCSSPropertyKeyword): New function that returns whether the CSS property should be rewritten to -webkit-. We want to rewrite -apple- but not -apple-pay-. (WebCore::cssPropertyID): Use the newly added isAppleLegacyCSSPropertyKeyword. (WebCore::isAppleLegacyCSSValueKeyword): Check for "-apple-pay-" in addition to "-apple-system-". * platform/ThemeTypes.h: Add ApplePayButtonPart. * platform/spi/cocoa/PassKitSPI.h: Add PKDrawApplePayButton declaration. * rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle): Handle ApplePayButtonPart. (WebCore::RenderTheme::paint): Handle ApplePayButtonPart. * rendering/RenderTheme.h: (WebCore::RenderTheme::adjustApplePayButtonStyle): (WebCore::RenderTheme::paintApplePayButton): Add new functions. * rendering/RenderThemeCocoa.h: Added. * rendering/RenderThemeCocoa.mm: Added. (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle): Adjust the minimum width and minimum height accordingly. (WebCore::toPKPaymentButtonStyle): (WebCore::toPKPaymentButtonType): Helper functions that convert our WebCore types to PK types. (WebCore::RenderThemeCocoa::paintApplePayButton): Call PKDrawApplePayButton. * rendering/RenderThemeIOS.h: * rendering/RenderThemeMac.h: Inherit from RenderThemeCocoa. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::applePayButtonStyle): (WebCore::RenderStyle::applePayButtonType): (WebCore::RenderStyle::setApplePayButtonStyle): (WebCore::RenderStyle::setApplePayButtonType): (WebCore::RenderStyle::initialApplePayButtonStyle): (WebCore::RenderStyle::initialApplePayButtonType): * rendering/style/RenderStyleConstants.h: * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator==): * rendering/style/StyleRareInheritedData.h: Add new style members for the button style and button type properties. 2016-09-26 Babak Shafiei Merge r206241. rdar://problem/28450514 2016-09-26 Babak Shafiei Merge r206238. rdar://problem/28450514 2016-09-21 Anders Carlsson support openPaymentSetup API on ApplePaySession object https://bugs.webkit.org/show_bug.cgi?id=162357 rdar://problem/26776939 Reviewed by Tim Horton. * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::openPaymentSetup): Perform security checks and then call into the PaymentCoordiantor. In its completion handler, we resolve the promise. * Modules/applepay/ApplePaySession.h: Add new members. * Modules/applepay/ApplePaySession.idl: Add openPaymentSetup declaration. * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::openPaymentSetup): Call through to the clients. * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinatorClient.h: Add new members. * loader/EmptyClients.cpp: Add new stub. * platform/spi/cocoa/PassKitSPI.h: Add SPI declaration. 2016-09-26 Babak Shafiei Merge r206350. rdar://problem/28115680 2016-09-23 Wenson Hsieh Media controls playhead does not animate smoothly while playing https://bugs.webkit.org/show_bug.cgi?id=162399 Reviewed by Beth Dakin. The media controls playhead currently does not animate smoothly during playback because we don't specify a playback rate when updating the WebPlaybackControlsManager's timing value. However, simply setting this timing value to the current playback rate (as known to the UI process) results in the UI process receiving multiple updates from the web process where the current time is equal (or even less than) the time at which media began to play, which results in the playhead seeking backwards to the start time multiple times when playing or resuming media. To address this, in WebCore, we inform the playback session model of the media time when playback begins (i.e. a `playing` or `play` event is fired). This message precedes both the "rate changed" and "current time changed" messages. Unit tests to be added in a future patch. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::notifyAboutPlaying): (WebCore::HTMLMediaElement::setReadyState): (WebCore::HTMLMediaElement::playInternal): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::playbackStartedTime): * platform/cocoa/WebPlaybackSessionModel.h: (WebCore::WebPlaybackSessionModelClient::playbackStartedTimeChanged): (WebCore::WebPlaybackSessionModelClient::bufferedTimeChanged): Deleted. * platform/cocoa/WebPlaybackSessionModelMediaElement.h: * platform/cocoa/WebPlaybackSessionModelMediaElement.mm: (WebPlaybackSessionModelMediaElement::updateForEventName): (WebPlaybackSessionModelMediaElement::playbackStartedTime): * platform/ios/WebVideoFullscreenControllerAVKit.mm: * platform/mac/WebPlaybackSessionInterfaceMac.h: * platform/mac/WebPlaybackSessionInterfaceMac.mm: (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged): (WebCore::WebPlaybackSessionInterfaceMac::rateChanged): (WebCore::WebPlaybackSessionInterfaceMac::beginScrubbing): (WebCore::WebPlaybackSessionInterfaceMac::endScrubbing): (WebCore::WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming): 2016-09-23 Babak Shafiei Merge r206322. rdar://problem/28435352 2016-09-23 Jer Noble Allow Seeking from the now playing controls https://bugs.webkit.org/show_bug.cgi?id=162498 Reviewed by Beth Dakin. We already have a handler for seek commands, we just need to register that handler with MediaRemote. * platform/mac/RemoteCommandListenerMac.mm: (WebCore::RemoteCommandListenerMac::updateSupportedCommands): 2016-09-23 Babak Shafiei Merge r204082. rdar://problem/27547583 2016-08-03 Eric Carlson [Mac][iOS] Adopt MediaRemote "seek to playback position" https://bugs.webkit.org/show_bug.cgi?id=160405 Reviewed by Dean Jackson. * platform/ios/RemoteCommandListenerIOS.mm: (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS): Fix a typo. 2016-09-23 Babak Shafiei Merge r203982. rdar://problem/27547583 2016-08-01 Eric Carlson [Mac][iOS] Adopt MediaRemote "seek to playback position" https://bugs.webkit.org/show_bug.cgi?id=160405 Reviewed by Dean Jackson. Test: media/remote-control-command-seek.html * Modules/webaudio/AudioContext.h: Update for didReceiveRemoteControlCommand argument change. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Support SeekToPlaybackPositionCommand. Drive by fix, support Stop command. (WebCore::HTMLMediaElement::supportsSeeking): New. * html/HTMLMediaElement.h: * platform/RemoteCommandListener.h: (WebCore::RemoteCommandListenerClient::didReceiveRemoteControlCommand): Add command argument. (WebCore::RemoteCommandListenerClient::supportsSeeking): New. (WebCore::RemoteCommandListener::updateSupportedCommands): Ditto. (WebCore::RemoteCommandListener::client): Ditto. * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::didReceiveRemoteControlCommand): Add command argument. (WebCore::PlatformMediaSession::supportsSeeking): New, pass through to client. * platform/audio/PlatformMediaSession.h: * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::setCurrentSession): Tell remote command listener to update supported commands. (WebCore::PlatformMediaSessionManager::currentSession): Make const. (WebCore::PlatformMediaSessionManager::didReceiveRemoteControlCommand): Add command argument. (WebCore::PlatformMediaSessionManager::supportsSeeking): New, pass through to session. * platform/audio/PlatformMediaSessionManager.h: * platform/ios/RemoteCommandListenerIOS.h: (WebCore::RemoteCommandListenerIOS::createWeakPtr): * platform/ios/RemoteCommandListenerIOS.mm: (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS): Support changePlaybackPositionCommand. (WebCore::RemoteCommandListenerIOS::~RemoteCommandListenerIOS): Remove seekToTime target. (WebCore::RemoteCommandListenerIOS::updateSupportedCommands): Update changePlaybackPositionCommand. * platform/mac/MediaRemoteSoftLink.cpp: * platform/mac/MediaRemoteSoftLink.h: * platform/mac/RemoteCommandListenerMac.h: * platform/mac/RemoteCommandListenerMac.mm: (WebCore::RemoteCommandListenerMac::updateSupportedCommands): New, split out of constructor. (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Split setup logic out into updateSupportedCommands. Support MRMediaRemoteCommandSeekToPlaybackPosition. Don't assert when receiving an unsupported command, it happens. Return error when a command isn't supported or fails. * testing/Internals.cpp: (WebCore::Internals::postRemoteControlCommand): Add command argument parameter. Support seektoplaybackposition. * testing/Internals.h: * testing/Internals.idl: 2016-09-23 Babak Shafiei Merge r206315. rdar://problem/28430615 2016-09-23 Wenson Hsieh MediaSessionManagerMac::nowPlayingEligibleSession() needs to honor the main content heuristic https://bugs.webkit.org/show_bug.cgi?id=162480 Reviewed by Jer Noble. Changes the implementation of nowPlayingEligibleSession to use bestMediaElementForShowingPlaybackControlsManager and also early return nullptr if the current tab the web process is hosted in is the active tab, and the window it is hosted in is the main window. This information is derived from the viewState flags in the Page of each tab -- whenever the (visible && active) state changes, the Page tells the global media session manager to update its Now Playing info. Then, when each MediaElementSession tries to determine whether it can show playback controls for the purposes of Now Playing, each session consults its page's visible and active state. If a page is both visible and active, no Now Playing controls are allowed for that media session. Also adds some slight adjustments to MediaSessionManagerMac::updateNowPlayingInfo, so we reset the title, rate and duration of the current active session when clearing out the now playing info. Likewise, when vending an active video, if the video information matches that of the current session, we mark m_nowPlayingActive anyways. These tweaks prevent us from getting in a bad state when switching between a tab with media and one without. Unit tests to come in a future patch. * html/HTMLMediaElement.cpp: (WebCore::mediaElementSessionInfoForSession): (WebCore::mediaSessionMayBeConfusedWithMainContent): (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): (WebCore::HTMLMediaElement::updatePlaybackControlsManager): (WebCore::bestMediaSessionForShowingPlaybackControlsManager): Deleted. * html/HTMLMediaElement.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager): (WebCore::MediaElementSession::pageAllowsNowPlayingControls): * html/MediaElementSession.h: * page/Page.cpp: (WebCore::Page::setViewState): (WebCore::Page::isVisibleAndActive): * page/Page.h: * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary): (WebCore::MediaSessionManagerMac::nowPlayingEligibleSession): (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): 2016-09-23 Babak Shafiei Merge r206272. rdar://problem/28339129 2016-09-22 Jer Noble Fullscreen controls inoperative in WebKitLegacy web views https://bugs.webkit.org/show_bug.cgi?id=162374 Reviewed by Eric Carlson. After r205365, the WebPlaybackSessionInterfaceAVKit was now created after the WebPlaybackSessionModel which fed it data, so it no longer received the burst of data upon creation. Instead, it should have always asked the model for its cached data as soon as it was connected to set up its inital state. * platform/ios/WebPlaybackSessionInterfaceAVKit.mm: (WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit): 2016-09-22 Babak Shafiei Merge r206193. rdar://problem/28376161 2016-09-20 Jer Noble Adopt MRMediaRemoteSetParentApplication. https://bugs.webkit.org/show_bug.cgi?id=162259 Reviewed by Anders Carlsson. Allow MediaSessionManagerMac to retrieve the correct parent application identifier from a PlatformMediaSession so that it can pass that identifier through to MediaRemote via MRMediaRemoteSetParentApplication. * Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::sourceApplicationIdentifier): * Modules/webaudio/AudioContext.h: * platform/audio/PlatformMediaSession.cpp: (WebCore::PlatformMediaSession::sourceApplicationIdentifier): * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::resetPlaybackSessionState): Deleted. * platform/audio/mac/MediaSessionManagerMac.mm: (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): * platform/mac/MediaRemoteSoftLink.cpp: * platform/mac/MediaRemoteSoftLink.h: 2016-09-22 Babak Shafiei Merge r206027. rdar://problem/28366812 2016-09-16 Per Arne Vollan [Win] Compile fix. https://bugs.webkit.org/show_bug.cgi?id=162059 Reviewed by Alex Christensen. If an include file exists in two places in the include paths, we can end up including the file twice, since #pragma once will not protect us against this. * PlatformWin.cmake: Put WebCore forwarding folder first in include list. 2016-09-16 Babak Shafiei Merge r206006. rdar://problem/27991573 2016-09-15 Brady Eidson WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources). and https://bugs.webkit.org/show_bug.cgi?id=162043 Reviewed by Brent Fulgham. No new tests (Not possible with current testing infrastructure). This adds the infrastructure for WebCore to track whether or not a CachedFrame had insecure content at the time it was cached, and then to report that back to the client when a CachedPage is restored. Since "has insecure content" is currently only tracked in the WK2 UI process, that is the only client of this code. * history/CachedFrame.cpp: (WebCore::CachedFrame::setHasInsecureContent): * history/CachedFrame.h: (WebCore::CachedFrame::hasInsecureContent): * loader/EmptyClients.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::dispatchDidCommitLoad): * loader/FrameLoader.h: * loader/FrameLoaderClient.h: * loader/FrameLoaderTypes.h: 2016-09-14 Babak Shafiei Merge r205938. rdar://problem/28227805 2016-09-14 Wenson Hsieh Media controls behave strangely when changing media sources https://bugs.webkit.org/show_bug.cgi?id=161914 Reviewed by Tim Horton. Addresses media controls flickering while changing the source of a media element. To accomplish this, we make the following changes to the media controls main content heuristic: - Prevent elements that are not mostly within the mainframe rect (or elements with empty rects) from showing media controls. Many websites that rely on same document navigation will move videos offscreen when navigating to a section of their site that does not play media. Without this check, we would not know to hide a video element on certain popular websites that use this technique, since the video has been interacted with in the past. - Rather than check whether a media element currently has video/audio sources, check whether it has ever had audio. Many websites will use the same media element across different videos and change only the source, and we should not prevent a media element from having media controls on grounds of having no audio or video in this case. - Rather than add user gesture and playback behavior restrictions before dispatching an ended event, add only the gesture restriction immediately, and add the playback restriction after waiting for a grace period only if the user has not interacted with the video since ending, and the video is not currently playing or about to play. This gives the user a chance to interact with the controls when a video ends, but also allows the page to load or begin playing a new video with the same media element without thrashing media control state. Adds 3 new API tests. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::mediaPlayerActiveSourceBuffersChanged): (WebCore::HTMLMediaElement::seekWithTolerance): (WebCore::HTMLMediaElement::beginScrubbing): (WebCore::HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary): (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): (WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::hasEverHadAudio): (WebCore::HTMLMediaElement::hasEverHadVideo): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager): (WebCore::isElementRectMostlyInMainFrame): * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerActiveSourceBuffersChanged): * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::notifyActiveSourceBuffersChanged): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::notifyActiveSourceBuffersChanged): * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer): (WebCore::MediaSourcePrivateAVFObjC::sourceBufferPrivateDidChangeActiveState): 2016-09-14 Babak Shafiei Merge r205870. rdar://problem/28225774 2016-09-13 Tim Horton Undoing a candidate insertion results in the replaced text being selected https://bugs.webkit.org/show_bug.cgi?id=161894 Reviewed by Simon Fraser. Test: editing/mac/spelling/accept-candidate-undo-does-not-select.html * WebCore.xcodeproj/project.pbxproj: * editing/ReplaceRangeWithTextCommand.cpp: Added. (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand): (WebCore::ReplaceRangeWithTextCommand::doApply): * editing/ReplaceRangeWithTextCommand.h: Added. (WebCore::ReplaceRangeWithTextCommand::create): Add a editor command that replaces a range with the given text. * editing/Editor.cpp: (WebCore::Editor::rangeForTextCheckingResult): (WebCore::Editor::handleAcceptedCandidate): (WebCore::Editor::selectTextCheckingResult): Deleted. * editing/Editor.h: Make use of the new editor command to do candidate insertion as a single composite operation, so that it is undone as a unit. Otherwise, undo ends up undoing the insertion, but not the selection, and we are left with the old text, selected, which is undesirable. 2016-09-12 Babak Shafiei Merge r205788. rdar://problem/28245097 2016-09-11 Tim Horton Candidates that don't end in spaces shouldn't have spaces arbitrarily appended to them https://bugs.webkit.org/show_bug.cgi?id=161846 Reviewed by Beth Dakin. Tests: editing/mac/spelling/accept-candidate-without-adding-space.html, editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html * editing/Editor.cpp: (WebCore::Editor::handleAcceptedCandidate): Stop appending a space just because the candidate doesn't end in a space. There are languages where that doesn't make sense, and the platform guarantees that candidates will always have spaces if they need them. Also, adjust the way we compute the AcceptedCandidate document marker range. There were two problems with the existing code: it expanded outward from the post-insertion cursor in *both* directions, instead of just backwards, and it used the length of the replaced text, not the length of the newly inserted text (more of the confusion mentioned in r205765). 2016-09-12 Babak Shafiei Merge r205154. rdar://problem/28233330 2016-08-29 Chris Dumez Regression(r204923): It should be possible to set 'Location.href' cross origin https://bugs.webkit.org/show_bug.cgi?id=161343 Reviewed by Ryosuke Niwa. It should be possible to set 'Location.href' cross origin: - https://html.spec.whatwg.org/#crossoriginproperties-(-o-) Firefox and Chrome allow this but we throw a SecurityError. We already allow setting crossOrigin.window.location which is equivalent. No new tests, updated existing test. * bindings/js/JSLocationCustom.cpp: (WebCore::JSLocation::putDelegate): Refactor the [Put] delegate so that it does not log a security error when setting 'href' attribute, given that setting it works as expected. This fixes a bug in shipping Safari where setting 'href' would work but log an error message anyway. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Add support for [DoNotCheckSecurityOnSetter] IDL extended attribute, in addition to the already supported [DoNotCheckSecurity] and [DoNotCheckSecurityOnGetter]. * page/Location.idl: Use [DoNotCheckSecurityOnSetter] on 'href' attribute as it can be set cross-origin. This fixes the regression introduced in r204923. 2016-09-12 Babak Shafiei Merge r204943. rdar://problem/28233330 2016-08-24 Ryan Haddad Rebaseline bindings tests after r204923. Unreviewed test gardening. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectExcitingAttr): (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): 2016-09-12 Babak Shafiei Merge r204923. rdar://problem/28233330 2016-08-24 Chris Dumez It should not be possible to access Location attributes cross origin https://bugs.webkit.org/show_bug.cgi?id=161125 Reviewed by Brent Fulgham. It should not be possible to access Location attributes cross origin: - https://html.spec.whatwg.org/#crossoriginproperties-(-o-) We allow access to replace() as per the specification and consistently with Firefox. The specification seems to indicate we should allow access to 'href' but Firefox does not and we previously did not so I am not allowing it in this patch. Test: http/tests/security/location-cross-origin.html * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): * page/Location.idl: 2016-09-12 Babak Shafiei Merge r205784. rdar://problem/28230123 2016-09-10 Wenson Hsieh Apple.com keynote does not display media controls https://bugs.webkit.org/show_bug.cgi?id=161833 Reviewed by Tim Horton. Tweaks the main content check so that we can distinguish between main content for the purposes of determining autoplay policy vs. main content for the purposes of showing media controls. Namely, we make the latter less restrictive than the former in terms of the maximum aspect ratio a video can have to be considered the right size for main content. New unit test in TestWebKitAPI. * html/HTMLMediaElement.cpp: (WebCore::mediaElementSessionInfoForSession): * html/MediaElementSession.cpp: (WebCore::MediaElementSession::canShowControlsManager): (WebCore::MediaElementSession::isLargeEnoughForMainContent): (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForMediaControls): (WebCore::isMainContentForPurposesOfAutoplay): (WebCore::isElementLargeEnoughForMainContent): (WebCore::MediaElementSession::updateIsMainContent): (WebCore::isMainContent): Deleted. * html/MediaElementSession.h: 2016-09-12 Babak Shafiei Merge r205765. rdar://problem/28033492 2016-09-09 Tim Horton Text replacement candidates don't always overwrite the entire original string https://bugs.webkit.org/show_bug.cgi?id=161779 Reviewed by Simon Fraser. New test: editing/mac/spelling/accept-candidate-replacing-multiple-words.html. * editing/Editor.cpp: (WebCore::Editor::contextRangeForCandidateRequest): Factor contextRangeForCandidateRequest out of the WebKits, into Editor. This just expands to paragraph boundaries from the cursor. (WebCore::Editor::selectTextCheckingResult): Add selectTextCheckingResult, which, given a TextCheckingResult, selects the range represented by the result's location and length, which indicate the portion of the context string that the result refers to. In the case of accepting a candidate, we want to select that range so that our insertion will overwrite it. (WebCore::Editor::handleAcceptedCandidate): Make use of selectTextCheckingResult instead of just assuming that we want to replace the word to the left of the insertion point. (WebCore::Editor::stringForCandidateRequest): Deleted. * editing/Editor.h: * testing/Internals.cpp: (WebCore::Internals::handleAcceptedCandidate): * testing/Internals.h: * testing/Internals.idl: Internals' handleAcceptedCandidate assumed (wrongly) that the length of a TextCheckerResult was the length of the candidate, when really it is the length of the text that the candidate would replace. Adjust this, and expose the replacement range to JavaScript, so we can test this. 2016-09-09 Babak Shafiei Merge r204456. rdar://problem/27860536 2016-08-14 Daniel Bates Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK https://bugs.webkit.org/show_bug.cgi?id=160725 Reviewed by Sam Weinig. * platform/cocoa/ThemeCocoa.mm: Unconditionally include header dlfcn.h as it exists in both the public iOS 9.3 SDK and iOS 10 beta SDK. * platform/spi/cocoa/CoreTextSPI.h: Add SPI declarations for constants that were used in r204107. * platform/spi/cocoa/PassKitSPI.h: Remove unnecessary #import statements when building with the Apple Internal SDK. Include header PassKit/PassKit.h when building for iOS. * platform/spi/cocoa/QuartzCoreSPI.h: No need to define CLayer.contentsFormat when building with the iOS 10 beta SDK as it is now part of the public API. 2016-09-09 Babak Shafiei Merge r203381. rdar://problem/27860536 2016-07-18 Anders Carlsson WebKit nightly fails to build on macOS Sierra https://bugs.webkit.org/show_bug.cgi?id=159902 rdar://problem/27365672 Reviewed by Tim Horton. * Modules/applepay/cocoa/PaymentCocoa.mm: * Modules/applepay/cocoa/PaymentContactCocoa.mm: * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: * Modules/applepay/cocoa/PaymentMethodCocoa.mm: Use new PassKitSPI header. * WebCore.xcodeproj/project.pbxproj: Add new PassKitSPI header. * icu/unicode/ucurr.h: Added. Add ucurr.h from ICU. * platform/spi/cocoa/PassKitSPI.h: Added. Add new PassKitSPI header. 2016-09-09 Babak Shafiei Merge r204107. rdar://problem/27860536 2016-08-03 Myles C. Maxfield [iOS] SF-Heavy is not accessible from web content https://bugs.webkit.org/show_bug.cgi?id=160522 Reviewed by Simon Fraser. The mappings we were using from CSS font-weight to CoreText font weight were inaccurate. Instead, these new mappings should be used. Test: fast/text/system-font-weight.html * platform/graphics/ios/FontCacheIOS.mm: (WebCore::systemFontModificationAttributes): 2016-09-09 Babak Shafiei Merge r205381. rdar://problem/27806012 2016-09-02 Beth Dakin Need to updateEditorState if an element change edit-ability without changing selection https://bugs.webkit.org/show_bug.cgi?id=161546 -and corresponding- rdar://problem/27806012 Reviewed by Ryosuke Niwa. Call into the client in case edited state needs to be updated. * editing/FrameSelection.cpp: (WebCore::FrameSelection::updateAppearanceAfterLayout): * loader/EmptyClients.h: * page/EditorClient.h: 2016-09-09 Babak Shafiei Merge r205365. rdar://problem/28020157 2016-07-08 Jer Noble Refactor WebPlaybackSessionModelMediaElement to be client based. https://bugs.webkit.org/show_bug.cgi?id=159580 Reviewed by Eric Carlson. Add client callback interfaces to both WebPlaybackSessionModel and WebVideoFullscreenModel, where each object can have multiple clients, and so the object will both store current values and also notify those clients when the values change. After this change, there is no need to have the models know about their associated interfaces explicitly. * platform/cocoa/WebPlaybackSessionInterface.h: * platform/cocoa/WebPlaybackSessionModel.h: (WebCore::WebPlaybackSessionModelClient::~WebPlaybackSessionModelClient): (WebCore::WebPlaybackSessionModelClient::durationChanged): (WebCore::WebPlaybackSessionModelClient::currentTimeChanged): (WebCore::WebPlaybackSessionModelClient::bufferedTimeChanged): (WebCore::WebPlaybackSessionModelClient::rateChanged): (WebCore::WebPlaybackSessionModelClient::seekableRangesChanged): (WebCore::WebPlaybackSessionModelClient::canPlayFastReverseChanged): (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionModelClient::externalPlaybackChanged): (WebCore::WebPlaybackSessionModelClient::wirelessVideoPlaybackDisabledChanged): * platform/cocoa/WebPlaybackSessionModelMediaElement.h: * platform/cocoa/WebPlaybackSessionModelMediaElement.mm: (WebPlaybackSessionModelMediaElement::setMediaElement): (WebPlaybackSessionModelMediaElement::updateForEventName): (WebPlaybackSessionModelMediaElement::addClient): (WebPlaybackSessionModelMediaElement::removeClient): (WebPlaybackSessionModelMediaElement::updateLegibleOptions): (WebPlaybackSessionModelMediaElement::observedEventNames): (WebPlaybackSessionModelMediaElement::eventNameAll): (WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions): (WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex): (WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex): (WebPlaybackSessionModelMediaElement::externalPlaybackEnabled): (WebPlaybackSessionModelMediaElement::externalPlaybackTargetType): (WebPlaybackSessionModelMediaElement::externalPlaybackLocalizedDeviceName): (WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled): (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface): Deleted. * platform/cocoa/WebVideoFullscreenInterface.h: * platform/cocoa/WebVideoFullscreenModel.h: (WebCore::WebVideoFullscreenModelClient::~WebVideoFullscreenModelClient): * platform/cocoa/WebVideoFullscreenModelVideoElement.h: (WebCore::WebVideoFullscreenModelVideoElement::create): (WebCore::WebVideoFullscreenModelVideoElement::playbackSessionModel): Deleted. * platform/cocoa/WebVideoFullscreenModelVideoElement.mm: (WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement): (WebVideoFullscreenModelVideoElement::setVideoElement): (WebVideoFullscreenModelVideoElement::updateForEventName): (WebVideoFullscreenModelVideoElement::addClient): (WebVideoFullscreenModelVideoElement::removeClient): (WebVideoFullscreenModelVideoElement::setHasVideo): (WebVideoFullscreenModelVideoElement::setVideoDimensions): (WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface): Deleted. * platform/ios/WebAVPlayerController.h: * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController resetState]): Deleted. * platform/ios/WebPlaybackSessionInterfaceAVKit.h: (WebCore::WebPlaybackSessionInterfaceAVKitClient::~WebPlaybackSessionInterfaceAVKitClient): Deleted. * platform/ios/WebPlaybackSessionInterfaceAVKit.mm: (WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit): (WebCore::WebPlaybackSessionInterfaceAVKit::~WebPlaybackSessionInterfaceAVKit): (WebCore::WebPlaybackSessionInterfaceAVKit::resetMediaState): (WebCore::WebPlaybackSessionInterfaceAVKit::durationChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::currentTimeChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::bufferedTimeChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::rateChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::seekableRangesChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::canPlayFastReverseChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::audioMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::legibleMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::externalPlaybackChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabledChanged): (WebCore::WebPlaybackSessionInterfaceAVKit::invalidate): (WebCore::WebPlaybackSessionInterfaceAVKit::setWebPlaybackSessionModel): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setDuration): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setCurrentTime): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setBufferedTime): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setRate): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setSeekableRanges): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setCanPlayFastReverse): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setAudioMediaSelectionOptions): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setLegibleMediaSelectionOptions): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setExternalPlayback): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::setWirelessVideoPlaybackDisabled): Deleted. (WebCore::WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabled): Deleted. * platform/ios/WebVideoFullscreenControllerAVKit.mm: (WebVideoFullscreenControllerContext::didSetupFullscreen): (WebVideoFullscreenControllerContext::didExitFullscreen): (WebVideoFullscreenControllerContext::didCleanupFullscreen): (WebVideoFullscreenControllerContext::durationChanged): (WebVideoFullscreenControllerContext::currentTimeChanged): (WebVideoFullscreenControllerContext::bufferedTimeChanged): (WebVideoFullscreenControllerContext::rateChanged): (WebVideoFullscreenControllerContext::hasVideoChanged): (WebVideoFullscreenControllerContext::videoDimensionsChanged): (WebVideoFullscreenControllerContext::seekableRangesChanged): (WebVideoFullscreenControllerContext::canPlayFastReverseChanged): (WebVideoFullscreenControllerContext::audioMediaSelectionOptionsChanged): (WebVideoFullscreenControllerContext::legibleMediaSelectionOptionsChanged): (WebVideoFullscreenControllerContext::externalPlaybackChanged): (WebVideoFullscreenControllerContext::wirelessVideoPlaybackDisabledChanged): (WebVideoFullscreenControllerContext::addClient): (WebVideoFullscreenControllerContext::removeClient): (WebVideoFullscreenControllerContext::requestFullscreenMode): (WebVideoFullscreenControllerContext::setVideoLayerFrame): (WebVideoFullscreenControllerContext::setVideoLayerGravity): (WebVideoFullscreenControllerContext::fullscreenModeChanged): (WebVideoFullscreenControllerContext::isVisible): (WebVideoFullscreenControllerContext::hasVideo): (WebVideoFullscreenControllerContext::videoDimensions): (WebVideoFullscreenControllerContext::play): (WebVideoFullscreenControllerContext::pause): (WebVideoFullscreenControllerContext::togglePlayState): (WebVideoFullscreenControllerContext::beginScrubbing): (WebVideoFullscreenControllerContext::endScrubbing): (WebVideoFullscreenControllerContext::seekToTime): (WebVideoFullscreenControllerContext::fastSeek): (WebVideoFullscreenControllerContext::beginScanningForward): (WebVideoFullscreenControllerContext::beginScanningBackward): (WebVideoFullscreenControllerContext::endScanning): (WebVideoFullscreenControllerContext::selectAudioMediaOption): (WebVideoFullscreenControllerContext::selectLegibleMediaOption): (WebVideoFullscreenControllerContext::duration): (WebVideoFullscreenControllerContext::currentTime): (WebVideoFullscreenControllerContext::bufferedTime): (WebVideoFullscreenControllerContext::isPlaying): (WebVideoFullscreenControllerContext::playbackRate): (WebVideoFullscreenControllerContext::seekableRanges): (WebVideoFullscreenControllerContext::canPlayFastReverse): (WebVideoFullscreenControllerContext::audioMediaSelectionOptions): (WebVideoFullscreenControllerContext::audioMediaSelectedIndex): (WebVideoFullscreenControllerContext::legibleMediaSelectionOptions): (WebVideoFullscreenControllerContext::legibleMediaSelectedIndex): (WebVideoFullscreenControllerContext::externalPlaybackEnabled): (WebVideoFullscreenControllerContext::externalPlaybackTargetType): (WebVideoFullscreenControllerContext::externalPlaybackLocalizedDeviceName): (WebVideoFullscreenControllerContext::wirelessVideoPlaybackDisabled): (WebVideoFullscreenControllerContext::setUpFullscreen): (WebVideoFullscreenControllerContext::exitFullscreen): (WebVideoFullscreenControllerContext::requestHideAndExitFullscreen): (WebVideoFullscreenControllerContext::resetMediaState): Deleted. (WebVideoFullscreenControllerContext::setDuration): Deleted. (WebVideoFullscreenControllerContext::setCurrentTime): Deleted. (WebVideoFullscreenControllerContext::setBufferedTime): Deleted. (WebVideoFullscreenControllerContext::setRate): Deleted. (WebVideoFullscreenControllerContext::setVideoDimensions): Deleted. (WebVideoFullscreenControllerContext::setSeekableRanges): Deleted. (WebVideoFullscreenControllerContext::setCanPlayFastReverse): Deleted. (WebVideoFullscreenControllerContext::setAudioMediaSelectionOptions): Deleted. (WebVideoFullscreenControllerContext::setLegibleMediaSelectionOptions): Deleted. (WebVideoFullscreenControllerContext::setExternalPlayback): Deleted. (WebVideoFullscreenControllerContext::setWirelessVideoPlaybackDisabled): Deleted. (WebVideoFullscreenSessionModel::play): Deleted. (WebVideoFullscreenSessionModel::pause): Deleted. (WebVideoFullscreenSessionModel::togglePlayState): Deleted. (WebVideoFullscreenSessionModel::beginScrubbing): Deleted. (WebVideoFullscreenSessionModel::endScrubbing): Deleted. (WebVideoFullscreenSessionModel::seekToTime): Deleted. (WebVideoFullscreenSessionModel::fastSeek): Deleted. (WebVideoFullscreenSessionModel::beginScanningForward): Deleted. (WebVideoFullscreenSessionModel::beginScanningBackward): Deleted. (WebVideoFullscreenSessionModel::endScanning): Deleted. (WebVideoFullscreenSessionModel::selectAudioMediaOption): Deleted. (WebVideoFullscreenSessionModel::selectLegibleMediaOption): Deleted. * platform/ios/WebVideoFullscreenInterfaceAVKit.h: * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: (WebVideoFullscreenInterfaceAVKit::~WebVideoFullscreenInterfaceAVKit): (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel): (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenChangeObserver): (WebVideoFullscreenInterfaceAVKit::hasVideoChanged): (WebVideoFullscreenInterfaceAVKit::videoDimensionsChanged): (WebVideoFullscreenInterfaceAVKit::externalPlaybackChanged): (WebVideoFullscreenInterfaceAVKit::resetMediaState): Deleted. (WebVideoFullscreenInterfaceAVKit::setDuration): Deleted. (WebVideoFullscreenInterfaceAVKit::setCurrentTime): Deleted. (WebVideoFullscreenInterfaceAVKit::setBufferedTime): Deleted. (WebVideoFullscreenInterfaceAVKit::setRate): Deleted. (WebVideoFullscreenInterfaceAVKit::setVideoDimensions): Deleted. (WebVideoFullscreenInterfaceAVKit::setSeekableRanges): Deleted. (WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse): Deleted. (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions): Deleted. (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions): Deleted. (WebVideoFullscreenInterfaceAVKit::setExternalPlayback): Deleted. (WebVideoFullscreenInterfaceAVKit::externalPlaybackEnabledChanged): Deleted. (WebVideoFullscreenInterfaceAVKit::setWirelessVideoPlaybackDisabled): Deleted. (WebVideoFullscreenInterfaceAVKit::wirelessVideoPlaybackDisabled): Deleted. * platform/mac/WebPlaybackSessionInterfaceMac.h: (WebCore::WebPlaybackSessionInterfaceMacClient::~WebPlaybackSessionInterfaceMacClient): Deleted. * platform/mac/WebPlaybackSessionInterfaceMac.mm: (WebCore::WebPlaybackSessionInterfaceMac::create): (WebCore::WebPlaybackSessionInterfaceMac::WebPlaybackSessionInterfaceMac): (WebCore::WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac): (WebCore::WebPlaybackSessionInterfaceMac::durationChanged): (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged): (WebCore::WebPlaybackSessionInterfaceMac::rateChanged): (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged): (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged): (WebCore::WebPlaybackSessionInterfaceMac::invalidate): (WebCore::WebPlaybackSessionInterfaceMac::setWebPlaybackSessionModel): Deleted. (WebCore::WebPlaybackSessionInterfaceMac::setClient): Deleted. (WebCore::WebPlaybackSessionInterfaceMac::setDuration): Deleted. (WebCore::WebPlaybackSessionInterfaceMac::setCurrentTime): Deleted. (WebCore::WebPlaybackSessionInterfaceMac::setRate): Deleted. (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges): Deleted. (WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions): Deleted. (WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions): Deleted. * platform/mac/WebVideoFullscreenInterfaceMac.h: * platform/mac/WebVideoFullscreenInterfaceMac.mm: (WebCore::WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac): (WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac): (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel): (WebCore::WebVideoFullscreenInterfaceMac::externalPlaybackChanged): (WebCore::WebVideoFullscreenInterfaceMac::hasVideoChanged): (WebCore::WebVideoFullscreenInterfaceMac::videoDimensionsChanged): (WebCore::WebVideoFullscreenInterfaceMac::setDuration): Deleted. (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime): Deleted. (WebCore::WebVideoFullscreenInterfaceMac::setRate): Deleted. (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges): Deleted. (WebCore::WebVideoFullscreenInterfaceMac::setAudioMediaSelectionOptions): Deleted. (WebCore::WebVideoFullscreenInterfaceMac::setLegibleMediaSelectionOptions): Deleted. (WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback): Deleted. (WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions): Deleted. 2016-09-09 Babak Shafiei Merge r205246. rdar://problem/28162589 2016-08-31 Antti Koivisto REGRESSION (r201701): Unable to copy from CodeMirror editor version used in Jenkins install website https://bugs.webkit.org/show_bug.cgi?id=161386 Reviewed by Dan Bernstein. This CodeMirror version uses a hidden