2017-12-22 Jeff Miller Update user-visible copyright strings to include 2018 https://bugs.webkit.org/show_bug.cgi?id=181141 Reviewed by Dan Bernstein. * Info.plist: 2017-12-30 Simon Fraser REGRESSION (r225122): fePointLights don't work https://bugs.webkit.org/show_bug.cgi?id=181142 Reviewed by Dan Bates. r225122 refactored the initialLightingData code, but failed to set the lighting color in the return value of PointLightSource::computePixelLightingData, so fePointLights always used black. Also fix a spelling error in initialLightingData. Tests: svg/filters/fePointLight-color.svg * platform/graphics/filters/DistantLightSource.cpp: (WebCore::DistantLightSource::initPaintingData): (WebCore::DistantLightSource::computePixelLightingData const): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): * platform/graphics/filters/LightSource.h: * platform/graphics/filters/PointLightSource.cpp: (WebCore::PointLightSource::computePixelLightingData const): * platform/graphics/filters/SpotLightSource.cpp: (WebCore::SpotLightSource::computePixelLightingData const): 2017-12-31 Simon Fraser Bottom right pixel of feDiffuseLighting has the wrong color https://bugs.webkit.org/show_bug.cgi?id=181203 Reviewed by Antti Koivisto. The lower right pixel of a feDiffuseLighting was the wrong color, because the kernel values didn't match the spec for the bottom right Y values. Test: svg/filters/feDiffuseLighting-bottomRightPixel.html * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::LightingData::bottomRightNormal const): 2017-12-30 Simon Fraser SVG lighting colors need to be converted into linearSRGB https://bugs.webkit.org/show_bug.cgi?id=181196 Reviewed by Dan Bates. SVG filters, like feLighting, that poke values directly into buffers rather than going through CG like feFlood, need to convert colors into the operating color space. So add conversion functions to go between linear and sRGB colors, and use these in feLighting, and in ImageBuffer (which is only used for non-CG platforms). Tests: svg/filters/feSpotLight-color.svg * platform/graphics/ColorUtilities.cpp: (WebCore::linearToSRGBColorComponent): (WebCore::sRGBToLinearColorComponent): (WebCore::linearToSRGBColor): (WebCore::sRGBToLinearColor): * platform/graphics/ColorUtilities.h: * platform/graphics/ImageBuffer.cpp: (WebCore::ImageBuffer::transformColorSpace): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::drawLighting): 2017-12-31 Jiewen Tan [WebCrypto] Avoid promises being destroyed in secondary threads https://bugs.webkit.org/show_bug.cgi?id=180499 Reviewed by Youenn Fablet. This patch adds pending promise queue to SubtleCrypto such that it no longer passes promises around different threads, which could cause crashes when promises are destroyed in secondary threads. Covered by existing tests. * crypto/SubtleCrypto.cpp: (WebCore::getPromise): (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: 2017-12-30 Dan Bernstein REGRESSION (r225494): Mouse pointer reappears shortly after hiding when scrolling using arrow keys https://bugs.webkit.org/show_bug.cgi?id=181193 Reviewed by Alexey Proskuryakov. * page/EventHandler.cpp: (WebCore::EventHandler::cancelAutoHideCursorTimer): Removed a call to unhide the cursor here. 2017-12-30 Wenson Hsieh [Attachment Support] Remove current macOS support for dragging file-backed attachments https://bugs.webkit.org/show_bug.cgi?id=181188 Reviewed by Dan Bernstein. Support for dragging attachments out as files on the NSPasteboard was introduced in r181760. However, this is (1) a macOS-specific implementation, and (2) does not support attachments whose files are backed by inline data rather than a filepath. As part of adding further WebKit attachment element support, subsequent patches will reimplement support for dragging attachment elements in a cross-Cocoa-platform way that also allows for either data- or file-backed blobs to be written to the pasteboard. No new functionality; no new tests. All existing layout and API tests still pass. * page/DragClient.h: (WebCore::DragClient::declareAndWriteDragImage): (WebCore::DragClient::declareAndWriteAttachment): Deleted. * page/DragController.cpp: (WebCore::DragController::startDrag): * page/DragController.h: (WebCore::DragController::draggingImageURL const): (WebCore::DragController::draggingAttachmentURL const): Deleted. * page/gtk/DragControllerGtk.cpp: (WebCore::DragController::declareAndWriteAttachment): Deleted. * page/mac/DragControllerMac.mm: (WebCore::DragController::declareAndWriteAttachment): Deleted. * page/win/DragControllerWin.cpp: (WebCore::DragController::declareAndWriteAttachment): Deleted. * rendering/HitTestResult.cpp: (WebCore::HitTestResult::absoluteAttachmentURL const): Deleted. * rendering/HitTestResult.h: 2017-12-28 Zalan Bujtas RenderTreeUpdater::GeneratedContent should hold a weak reference to RenderQuote. https://bugs.webkit.org/show_bug.cgi?id=181185 Reviewed by David Kilzer. Test: fast/css/content/content-quotes-crash-with-details.html * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo): * rendering/updating/RenderTreeUpdaterGeneratedContent.h: (): Deleted. 2017-12-28 Brady Eidson Add a ProcessIdentifier, vended from the UI process, to each child process https://bugs.webkit.org/show_bug.cgi?id=181155 Reviewed by Brent Fulgham. No new tests (Not yet testable) More than once we've needed to create an identifier for an object that is unique across all processes no matter which process it came from. Sometimes we have an object or proxy object to the UI, Storage, or Network process that allows us to augment a process-unique identifier to be globally unique. Due to multiple sessions even this isn't good enough. Other times we have to create more hair-brained solutions. In upcoming MessagePort work (Next step is https://bugs.webkit.org/show_bug.cgi?id=181172) there was no truly workable solution for this. By introducing a new ProcessIdentifier to each WK2 child processes that is guaranteed to be unique over the run of a given UI process, we can easily create an object in any process and identify it uniquely across all processes. Obviously "process identifier" brings to mind a processes PID but that isn't good enough. The number of PIDs on the system is fairly low and they are global across all processes on the system. It is easy to see how a given UI process that runs for long enough (such as a web browser that the user rarely quits) will start to run in to recycled PIDs, therefore breaking the uniqueness guarantee that is required. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * platform/Process.cpp: Added. (WebCore::Process::setIdentifier): Sets the process-wise identifier (to be used during WK2 child process initialization) (WebCore::Process::identifier): Get the process-wide identifier. * platform/Process.h: Added. 2017-12-28 Yusuke Suzuki Remove std::chrono if it is not used for ArgumentCoder or PersistentCoder https://bugs.webkit.org/show_bug.cgi?id=181174 Reviewed by Konstantin Tokarev. We would like to remove std::chrono as much as possible due to the danger of its overflow unawareness. This patch removes std::chrono if it is not used for ArgumentCoder or PersistentCoder. No behavior change. * fileapi/FileReader.cpp: (WebCore::FileReader::didReceiveData): * fileapi/FileReader.h: * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::showPaintRect): (WebCore::InspectorOverlay::updatePaintRectsTimerFired): * inspector/InspectorOverlay.h: * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::threadBody): * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation): * platform/network/curl/SocketStreamHandleImpl.h: * platform/network/curl/SocketStreamHandleImplCurl.cpp: (WebCore::SocketStreamHandleImpl::waitForAvailableData): (WebCore::SocketStreamHandleImpl::startThread): 2017-12-28 Fujii Hironori [Win][CMake] Use add_custom_command to copy each forwarding header files https://bugs.webkit.org/show_bug.cgi?id=180921 Reviewed by Brent Fulgham. No new tests because there is no behavior change. * PlatformWin.cmake: Use WEBKIT_MAKE_FORWARDING_HEADERS. 2017-12-27 Carlos Alberto Lopez Perez Build fix after r226299 https://bugs.webkit.org/show_bug.cgi?id=181160 Unreviewed build fix. No new tests, its a build fix. * platform/graphics/FontSelectionAlgorithm.h: Add missing include. 2017-12-26 Carlos Alberto Lopez Perez REGRESSION(r225769): Build error with constexpr std::max // std::min in libdstdc++4 https://bugs.webkit.org/show_bug.cgi?id=181160 Reviewed by Myles C. Maxfield. No new tests, its a build fix. * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: (WebCore::MediaPlayerPrivateAVFoundationCF::currentMediaTime const): Disambiguate usage of max (Use the version from stdlib). * platform/graphics/FontSelectionAlgorithm.h: (WebCore::FontSelectionValue::clampFloat): Use WTF::min and WTF::max for constexpr result. * platform/graphics/win/UniscribeController.cpp: (WebCore::UniscribeController::shapeAndPlaceItem): Disambiguate usage of min and max (Use the version from stdlib). 2017-12-25 Dan Bernstein [macOS] On Retina displays, icon used as drag image for large image is scaled down https://bugs.webkit.org/show_bug.cgi?id=181154 Reviewed by Wenson Hsieh. * page/DragController.cpp: (WebCore::DragController::doImageDrag): When using an icon for the drag image, also adjust its size for the device scale factor, like we do in the not-icon case. 2017-12-24 David Kilzer WebKit fixes to enable -Wstrict-prototypes for Safari Reviewed by Dan Bernstein. * platform/ios/wak/WebCoreThread.h: (WebThreadLockFromAnyThread): (WebThreadLockFromAnyThreadNoLog): (WebThreadUnlockFromAnyThread): (WebThreadUnlockGuardForMail): (WebThreadSetShouldYield): - Add 'void' to C function declarations. * platform/ios/wak/WebCoreThread.mm: (WebThreadLockFromAnyThread): (WebThreadLockFromAnyThreadNoLog): (WebThreadUnlockFromAnyThread): (WebThreadUnlockGuardForMail): - Add 'void' to C function implementations. * platform/ios/wak/WebCoreThreadRun.cpp: (class WebThreadBlock): Add 'void' to block declarations. Rename 'task' to 'block' for consistency. (_WebThreadRun): Add 'void' to block declaration. Make argument name match declaration by changing 'task' to 'block'. (WebThreadRun): Ditto. * platform/ios/wak/WebCoreThreadRun.h: (WebThreadRun): Add 'void' to block declaration. 2017-12-22 Antoine Quint [Web Animations] Implement Element.animate() https://bugs.webkit.org/show_bug.cgi?id=180402 Reviewed by Dean Jackson. Now that we have added support for play() (webkit.org/b/178932) on Animation and parsing of multiple keyframes (webkit.org/b/179708), we can add support Element.animate(). To support this simple task, we must add a series of new IDL interfaces to support option parameters for Element.animate() (KeyframeAnimationOptions), AnimationEffect (AnimationEffectTimingProperties), KeyframeEffect (KeyframeEffectOptions) and supporting types CompositeOperation, FillMode, IterationCompositeOperation and PlaybackDirection. While we do not support most parameters of those types, we at least define them for future support. To support the most used form of the Element.animate() constructor across the WPT tests, we add support for specifying the duration of an animation when constructing both a KeyframeEffect and calling Element.animate(), either via a property on an options dictionary or as a double value. The implementation of Element.animate() itself is relatively straightforward, we just need to create a supporting KeyframeEffect based on the options provided, then an Animation with that effect set on it, and finally call play(). We also fix one crash that came up in WPT tests where we would try to access the DOMWindow when none was available in http/wpt/web-animations/interfaces/Animatable/animate-no-browsing-context.html. * CMakeLists.txt: Add new IDL files. * DerivedSources.make: Add new IDL files. * Sources.txt: Add new generated JS bindings. * WebCore.xcodeproj/project.pbxproj: Add new IDL, header and C++ files. * animation/Animatable.idl: Expose the animate() method. * animation/AnimationEffectTiming.cpp: (WebCore::AnimationEffectTiming::setBindingsDuration): Make the duration property spec-compliant and expect the right kind of type (unrestricted double or DOMString). * animation/AnimationEffectTiming.h: * animation/AnimationEffectTiming.idl: * animation/AnimationEffectTimingProperties.h: Added. * animation/AnimationEffectTimingProperties.idl: Added. * animation/CompositeOperation.h: Added. * animation/CompositeOperation.idl: Added. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::currentTime): Check that there is DOMWindow before proceeding to querying the current time through it, fixes a newly-apparent crash. * animation/FillMode.h: Added. * animation/FillMode.idl: Added. * animation/IterationCompositeOperation.h: Added. * animation/IterationCompositeOperation.idl: Added. * animation/KeyframeAnimationOptions.h: Added. * animation/KeyframeAnimationOptions.idl: Added. * animation/KeyframeEffect.cpp: Update types that are no longer defined under KeyframeEffect. (WebCore::processIterableKeyframes): (WebCore::processPropertyIndexedKeyframes): (WebCore::KeyframeEffect::create): Add support for duration provided either directly as a double or through KeyframeEffectOptions. * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * animation/KeyframeEffectOptions.h: Added. * animation/KeyframeEffectOptions.idl: Added. * animation/PlaybackDirection.h: Added. * animation/PlaybackDirection.idl: Added. * dom/Element.cpp: (WebCore::Element::animate): Implement Element.animate(). * dom/Element.h: 2017-12-23 Minsheng Liu Add comments and improve code styles for RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren() and related functions https://bugs.webkit.org/show_bug.cgi?id=180923 Reviewed by Frédéric Wang. The patch improves the code for RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren() and related function, incorporating the following suggestions from bug 179682: - Remove several lines of trailing spaces. - Change several pointers to references. - Rewrite horizontalStretchyOperator() (formerly toHorizontalStretchyOperator()) to make it more conforming to WebKit's coding style. - Make unembellishedOperator() a const method. - Add comments for stretchHorizontalOperatorsAndLayoutChildren(). - Eliminate an unnecessary call to fixLayoutAfterStretch() in stretchHorizontalOperatorsAndLayoutChildren(). Add one more case for the test "mathml/opentype/munderover-stretch-width.html" to handle the corner case where all components of // are stretchy. Since there is no behavior change, no new test is required. * rendering/mathml/RenderMathMLBlock.h: (WebCore::RenderMathMLBlock::unembellishedOperator const): (WebCore::RenderMathMLBlock::unembellishedOperator): Deleted. * rendering/mathml/RenderMathMLFraction.cpp: (WebCore::RenderMathMLFraction::unembellishedOperator const): (WebCore::RenderMathMLFraction::unembellishedOperator): Deleted. * rendering/mathml/RenderMathMLFraction.h: * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::resetStretchSize): * rendering/mathml/RenderMathMLOperator.h: * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::unembellishedOperator const): (WebCore::RenderMathMLScripts::unembellishedOperator): Deleted. * rendering/mathml/RenderMathMLScripts.h: * rendering/mathml/RenderMathMLUnderOver.cpp: (WebCore::horizontalStretchyOperator): (WebCore::fixLayoutAfterStretch): (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren): (WebCore::RenderMathMLUnderOver::layoutBlock): (WebCore::toHorizontalStretchyOperator): Deleted. 2017-12-22 Wenson Hsieh Unreviewed, try to fix the build on recent SDKs after r226274. Unused variables captured in a lambda now cause warnings the latest SDKs. It seems that after r226274, the block in `SWContextManager::terminateWorker` no longer accesses `this->m_workerMap`, so `this` is now unused. * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::terminateWorker): 2017-12-22 Wenson Hsieh Fix build failures due to using deprecated AppKit symbols https://bugs.webkit.org/show_bug.cgi?id=181110 Reviewed by Dan Bernstein and Tim Horton. Fixes the build for recent SDKs (post-AppKit-deprecation) via a combination of adopting modern AppKit versions of deprecated interfaces, or folding deprecated symbols behind helper functions (for deprecated pasteboard types). Introduces LegacyNSPasteboardTypes.h, which contains functions to wrap around deprecated NSPasteboard types. This allows us to replace all deprecated NS*PboardTypes with calls to the helper functions, and limit -Wdeprecated-declarations of legacy pasteboard types to this new header. * WebCore.xcodeproj/project.pbxproj: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (CreateCGColorIfDifferent): * editing/mac/EditorMac.mm: (WebCore::Editor::takeFindStringFromSelection): (WebCore::Editor::dataSelectionForPasteboard): * platform/cocoa/PasteboardCocoa.mm: (WebCore::bitmapPNGFileType): (WebCore::cocoaTypeToImageType): (WebCore::convertTIFFToPNG): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayer::drawLayerContents): * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::GraphicsContext::drawLineForDocumentMarker): * platform/ios/wak/WAKAppKitStubs.h: * platform/mac/DragDataMac.mm: (WebCore::rtfPasteboardType): (WebCore::rtfdPasteboardType): (WebCore::stringPasteboardType): (WebCore::urlPasteboardType): (WebCore::htmlPasteboardType): (WebCore::colorPasteboardType): (WebCore::pdfPasteboardType): (WebCore::tiffPasteboardType): (WebCore::DragData::asFilenames const): (WebCore::DragData::containsPlainText const): (WebCore::DragData::containsCompatibleContent const): (WebCore::DragData::containsPromise const): (WebCore::DragData::asURL const): * platform/mac/DragImageMac.mm: (WebCore::createDragImageForLink): * platform/mac/LegacyNSPasteboardTypes.h: Added. (WebCore::legacyStringPasteboardType): (WebCore::legacyFilenamesPasteboardType): (WebCore::legacyTIFFPasteboardType): (WebCore::legacyRTFPasteboardType): (WebCore::legacyFontPasteboardType): (WebCore::legacyColorPasteboardType): (WebCore::legacyRTFDPasteboardType): (WebCore::legacyHTMLPasteboardType): (WebCore::legacyURLPasteboardType): (WebCore::legacyPDFPasteboardType): (WebCore::legacyFilesPromisePasteboardType): * platform/mac/LocalCurrentGraphicsContext.mm: (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext): * platform/mac/PasteboardMac.mm: (WebCore::writableTypesForURL): (WebCore::writableTypesForImage): (WebCore::Pasteboard::supportedFileUploadPasteboardTypes): (WebCore::Pasteboard::write): (WebCore::Pasteboard::writePlainText): (WebCore::writeURLForTypes): (WebCore::writeFileWrapperAsRTFDAttachment): (WebCore::Pasteboard::read): (WebCore::absoluteURLsFromPasteboardFilenames): (WebCore::Pasteboard::readPlatformValueAsString): (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType): (WebCore::Pasteboard::writeString): * platform/mac/PasteboardWriter.mm: (WebCore::createPasteboardWriter): * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::numberOfFiles const): (WebCore::pasteboardMayContainFilePaths): (WebCore::PlatformPasteboard::stringForType const): (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): (WebCore::PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite): (WebCore::PlatformPasteboard::color): (WebCore::PlatformPasteboard::setStringForType): * platform/mac/ThemeMac.mm: (WebCore::updateStates): (WebCore::createToggleButtonCell): (WebCore::drawCellFocusRingWithFrameAtTime): (WebCore::leakButtonCell): (WebCore::setUpButtonCell): (WebCore::paintButton): (WebCore::ThemeMac::inflateControlPaintRect const): * platform/mac/WebWindowAnimation.mm: (setScaledFrameForWindow): * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const): (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const): (WebCore::convertNSColorToColor): (WebCore::menuBackgroundColor): (WebCore::RenderThemeMac::updateCheckedState): (WebCore::RenderThemeMac::levelIndicatorStyleFor const): (WebCore::RenderThemeMac::levelIndicatorFor const): (WebCore::RenderThemeMac::servicesRolloverButtonCell const): 2017-12-22 Dan Bernstein Crash beneath ScriptedAnimationController::serviceScriptedAnimations after a requestAnimationFrame callback removes the requesting iframe https://bugs.webkit.org/show_bug.cgi?id=181132 Reviewed by Simon Fraser. Test: fast/animation/request-animation-frame-remove-iframe-in-callback.html * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceScriptedAnimations): Hold a reference to the document and pass that along to InspectorInstrumentation::willFireAnimationFrame rather than dereferencing the m_document member, which may have gotten cleared by an earlier callback. 2017-12-22 Chris Dumez importScripts() inside a service worker should ensure that the response has a JavaScript MIME type https://bugs.webkit.org/show_bug.cgi?id=181103 Reviewed by Youenn Fablet. importScripts() inside a service worker should ensure that the response has a JavaScript MIME type, as per: - https://w3c.github.io/ServiceWorker/#importscripts (step 6) No new tests, rebaselined existing test. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::importScripts): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::didReceiveResponse): * workers/WorkerScriptLoader.h: (WebCore::WorkerScriptLoader::responseMIMEType const): 2017-12-22 Chris Dumez [Service Workers] Implement "Soft Update" algorithm https://bugs.webkit.org/show_bug.cgi?id=180702 Reviewed by Youenn Fablet. Implement "Soft Update" algorithm: - https://w3c.github.io/ServiceWorker/#soft-update-algorithm Call softUpdate at the end of "Handle Fetch", as per: - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm No new tests, rebaselined existing test. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::postTaskTo): * dom/ScriptExecutionContext.h: * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::failedFetchingScript): (WebCore::SWClientConnection::registrationJobResolvedInServer): (WebCore::SWClientConnection::startScriptFetchForServer): * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::updateRegistration): (WebCore::ServiceWorkerContainer::jobFailedWithException): (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult): (WebCore::ServiceWorkerContainer::startScriptFetchForJob): (WebCore::ServiceWorkerContainer::jobFailedLoadingScript): * workers/service/ServiceWorkerContainer.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::ServiceWorkerJob): * workers/service/ServiceWorkerJob.h: (WebCore::ServiceWorkerJob::create): (WebCore::ServiceWorkerJob::data const): (WebCore::ServiceWorkerJob::promise): * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::softUpdate): * workers/service/ServiceWorkerRegistration.h: * workers/service/context/SWContextManager.cpp: (WebCore::SWContextManager::terminateWorker): (WebCore::SWContextManager::postTaskToServiceWorker): * workers/service/context/SWContextManager.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/context/ServiceWorkerFetch.h: * workers/service/server/SWServer.cpp: (WebCore::SWServer::startScriptFetch): * workers/service/server/SWServer.h: 2017-12-22 Zalan Bujtas [RenderTreeBuilder] Move RenderMenuList::addChild() tree mutation to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181130 Reviewed by Antti Koivisto. This patch also creates a dedicated class for form control related tree mutations. Covered by existing tests. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderButton.cpp: (WebCore::RenderButton::setInnerRenderer): Update the style here instead. * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::setInnerRenderer): (RenderMenuList::addChild): (RenderMenuList::showPopup): We should't really call showPopup on a detached renderer. (WebCore::RenderMenuList::createInnerBlock): Deleted. * rendering/RenderMenuList.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChild): (WebCore::createInnerRendererForButtonIfNeeded): Deleted. * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::formControlsBuilder): * rendering/updating/RenderTreeBuilderFormControls.cpp: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h. (WebCore::RenderTreeBuilder::FormControls::FormControls): (WebCore::RenderTreeBuilder::FormControls::createInnerRendererIfNeeded): * rendering/updating/RenderTreeBuilderFormControls.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h. 2017-12-21 Ryosuke Niwa REGRESSION(r223678): Cannot copy & paste a web page content into Yahoo! Mail https://bugs.webkit.org/show_bug.cgi?id=181114 Reviewed by Geoffrey Garen. Turns out converting all URLs to blob isn't Web compatible. Don't do this conversion on HTTP, HTTP, and data URLs since websites tend to have access to contents accessible via those protocols, and blob URL conversion would break Yahoo! Mail, Gmail, and other major online email services. We've also considered using data URLs instead of blob URLs for conversion but pasting a large image converted into a data URL seems to break WordPress (it stores an empty post instead of the one with the image) so it's not likely to be Web compatible either. This patch therefore disables the blob conversion in sanitizeMarkupWithArchive for HTTP, HTTPS, data URLs for cross-origin content, restoring the behavior prior to r223678. For contents converted from attributed strings, we continue to convert to blob URL since there is no other way for websites to read local files or images references by an in-memory web archive. Tests: http/tests/security/clipboard/copy-paste-html-cross-in-origin-iframe-across-origin.html * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::shouldConvertToBlob): Added. (WebCore::sanitizeMarkupWithArchive): 2017-12-22 Michael Catanzaro Credentials warning spam when running CodeGenerator.pm https://bugs.webkit.org/show_bug.cgi?id=181127 Unreviewed, update WebCore_IDL_INCLUDES. * CMakeLists.txt: 2017-12-22 Michael Catanzaro [GTK] Duplicated symbols in libjavascriptcoregtk and libwebkit2gtk can cause crashes in production builds https://bugs.webkit.org/show_bug.cgi?id=179914 Reviewed by Carlos Garcia Campos. * CMakeLists.txt: Test for WebCore_LIBRARY_TYPE rather than SHARED_CORE. 2017-12-22 Zalan Bujtas [RenderTreeBuilder] Move RenderButton::addChild() tree mutation to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181109 Reviewed by Antti Koivisto. Covered by existing tests. * rendering/RenderButton.cpp: (WebCore::RenderButton::setInnerRenderer): (WebCore::RenderButton::updateAnonymousChildStyle const): (WebCore::RenderButton::addChild): Deleted. * rendering/RenderButton.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::propagateStyleToAnonymousChildren): * rendering/RenderElement.h: (WebCore::RenderElement::updateAnonymousChildStyle const): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): 2017-12-22 Ms2ger REGRESSION(r226228) Build error with unqualified isfinite() in MediaCapabilities.cpp https://bugs.webkit.org/show_bug.cgi?id=181118 Unreviewed build fix. * Modules/mediacapabilities/MediaCapabilities.cpp: (WebCore::isValidVideoConfiguration): qualify the one unqualified isfinite() call. 2017-12-21 Youenn Fablet com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::UserMediaRequest::stop + 126 https://bugs.webkit.org/show_bug.cgi?id=181057 Unreviewed. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::stop): Fixed comment typo. 2017-12-21 Youenn Fablet ServiceWorkerThreadProxy should set the correct cookie and cache partitioning options https://bugs.webkit.org/show_bug.cgi?id=181000 Reviewed by Chris Dumez. Covered by rebased test. Add a way to set the domain for cache partition explicitly on a ScriptExecutionContext. This is used by ServiceWorkerThreadProxy document to mimick the fact that it may be a service worker used by iframes that have a cross origin top document. Updated code to use that new utility routine. * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::connect): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::domainForCachePartition const): * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::setDomainForCachePartition): * html/DOMURL.cpp: (WebCore::DOMURL::revokeObjectURL): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::cachedResource): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): * loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::create): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::setDomainForCachePartition): * testing/Internals.cpp: (WebCore::Internals::isLoadingFromMemoryCache): * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::topOriginURL): (WebCore::createPageForServiceWorker): (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy): * workers/service/context/ServiceWorkerThreadProxy.h: * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createRequest): 2017-12-21 Christopher Reid [WinCairo] fix build after r226245 https://bugs.webkit.org/show_bug.cgi?id=181113 Unreviewed build fix. No new tests, no change in behavior. * html/AttachmentTypes.h: Added an include for std::optional 2017-12-21 Brady Eidson Refactor MessagePortChannel family classes for an easier multi-process split. https://bugs.webkit.org/show_bug.cgi?id=180981 Reviewed by Andy Estes. No new tests (Refactor, no behavior change) - Make MessagePortChannel an abstract class instead of a wrapper around a mysterious "platform" class. - Implement the "in-process" channel for WK1 and WK2-for-now. - Other random cleanup and modernization of this code. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/InProcessMessagePortChannel.cpp: Added. (WebCore::InProcessMessagePortChannel::createChannelBetweenPorts): (WebCore::InProcessMessagePortChannel::create): (WebCore::InProcessMessagePortChannel::InProcessMessagePortChannel): (WebCore::InProcessMessagePortChannel::~InProcessMessagePortChannel): (WebCore::InProcessMessagePortChannel::postMessageToRemote): (WebCore::InProcessMessagePortChannel::takeAllMessagesFromRemote): (WebCore::InProcessMessagePortChannel::isConnectedTo): (WebCore::InProcessMessagePortChannel::entangleIfOpen): (WebCore::InProcessMessagePortChannel::disentangle): (WebCore::InProcessMessagePortChannel::hasPendingActivity): (WebCore::InProcessMessagePortChannel::locallyEntangledPort): (WebCore::InProcessMessagePortChannel::takeEntangledChannel): (WebCore::InProcessMessagePortChannel::close): (WebCore::InProcessMessagePortChannel::setRemotePort): * dom/InProcessMessagePortChannel.h: Added. (WebCore::InProcessMessagePortChannel::MessagePortQueue::create): (WebCore::InProcessMessagePortChannel::MessagePortQueue::takeAllMessages): (WebCore::InProcessMessagePortChannel::MessagePortQueue::appendAndCheckEmpty): (WebCore::InProcessMessagePortChannel::MessagePortQueue::isEmpty): (WebCore::InProcessMessagePortChannel::MessagePortQueue::MessagePortQueue): * dom/MessageChannel.cpp: (WebCore::MessageChannel::MessageChannel): * dom/MessageChannel.h: (WebCore::MessageChannel::create): (WebCore::MessageChannel::port1 const): (WebCore::MessageChannel::port2 const): * dom/MessagePort.cpp: (WebCore::MessagePort::postMessage): (WebCore::MessagePort::disentangle): (WebCore::MessagePort::entangle): (WebCore::MessagePort::hasPendingActivity const): * dom/MessagePort.h: * dom/MessagePortChannel.cpp: Added. (WebCore::MessagePortChannel::createChannelBetweenPorts): (WebCore::MessagePortChannel::MessagePortChannel): * dom/MessagePortChannel.h: (WebCore::MessagePortChannel::EventData::EventData): (WebCore::MessagePortChannel::~MessagePortChannel): * dom/default/PlatformMessagePortChannel.cpp: Removed. * dom/default/PlatformMessagePortChannel.h: Removed. * workers/service/context/ServiceWorkerThread.h: 2017-12-21 Ryosuke Niwa Rename NoEventDispatchAssertion to ScriptDisallowedScope https://bugs.webkit.org/show_bug.cgi?id=181102 Reviewed by Zalan Bujtas. Renamed the class. * WebCore.xcodeproj/project.pbxproj: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::canExecuteScripts): * dom/ContainerNode.cpp: (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion): (WebCore::ContainerNode::removeNodeWithScriptAssertion): (WebCore::executeNodeInsertionWithScriptAssertion): (WebCore::ContainerNode::removeDetachedChildren): (WebCore::ContainerNode::insertBeforeCommon): (WebCore::ContainerNode::appendChildCommon): (WebCore::ContainerNode::removeBetween): (WebCore::dispatchChildInsertionEvents): (WebCore::dispatchChildRemovalEvents): * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): (WebCore::notifyChildNodeRemoved): * dom/Document.cpp: (WebCore::Document::resolveStyle): (WebCore::isSafeToUpdateStyleOrLayout): (WebCore::Document::updateStyleIfNeeded): (WebCore::Document::nodeChildrenWillBeRemoved): (WebCore::Document::nodeWillBeRemoved): (WebCore::Document::dispatchWindowEvent): (WebCore::Document::dispatchWindowLoadEvent): (WebCore::Document::applyPendingXSLTransformsTimerFired): * dom/Element.cpp: (WebCore::Element::addShadowRoot): (WebCore::Element::attachAttributeNodeIfNeeded): (WebCore::Element::setAttributeNode): (WebCore::Element::setAttributeNodeNS): (WebCore::Element::dispatchFocusInEvent): (WebCore::Element::dispatchFocusOutEvent): * dom/ElementIteratorAssertions.h: (WebCore::ElementIteratorAssertions::ElementIteratorAssertions): * dom/EventDispatcher.cpp: (WebCore::EventDispatcher::dispatchEvent): * dom/EventTarget.cpp: (WebCore::EventTarget::fireEventListeners): * dom/NoEventDispatchAssertion.h: Removed. * dom/Node.cpp: (WebCore::Node::dispatchSubtreeModifiedEvent): (WebCore::Node::dispatchDOMActivateEvent): * dom/ScriptDisallowedScope.h: Copied from Source/WebCore/dom/NoEventDispatchAssertion.h. (WebCore::ScriptDisallowedScope::ScriptDisallowedScope): (WebCore::ScriptDisallowedScope::~ScriptDisallowedScope): (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree): (WebCore::ScriptDisallowedScope::InMainThread::isScriptAllowed): (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Deleted. (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Deleted. (WebCore::NoEventDispatchAssertion::isEventAllowedInMainThread): Deleted. (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Deleted. (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Deleted. (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): Deleted. (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed): Deleted. (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Deleted. (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Deleted. (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Deleted. (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Deleted. (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::DisableAssertionsInScope): Deleted. (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::~DisableAssertionsInScope): Deleted. * dom/ScriptElement.cpp: (WebCore::ScriptElement::executeClassicScript): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension): (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): (WebCore::ScriptExecutionContext::resumeActiveDOMObjects): (WebCore::ScriptExecutionContext::stopActiveDOMObjects): * history/CachedPage.cpp: (WebCore::CachedPage::restore): * history/PageCache.cpp: (WebCore::PageCache::addIfCacheable): * html/HTMLElement.cpp: (WebCore::textToFragment): (WebCore::HTMLElement::setInnerText): * html/HTMLMediaElement.cpp: * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setInnerTextValue): * html/track/VTTCue.cpp: (WebCore::VTTCue::createCueRenderingTree): (WebCore::VTTCue::updateDisplayTree): (WebCore::VTTCue::removeDisplayTree): * loader/FormSubmission.cpp: * loader/cache/CachedSVGFont.cpp: (WebCore::CachedSVGFont::ensureCustomFontData): * page/LayoutContext.cpp: (WebCore::LayoutContext::layout): * rendering/RenderFrameBase.cpp: (WebCore::RenderFrameBase::performLayoutWithFlattening): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollRectToVisible): * svg/SVGTRefElement.cpp: (WebCore::SVGTRefElement::updateReferencedText): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::clearShadowTree): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::draw): 2017-12-21 Maciej Stachowiak Update Service Workers status to Supported in Preview https://bugs.webkit.org/show_bug.cgi?id=181093 Reviewed by Andy Estes. * features.json: 2017-12-21 Brent Fulgham Unreviewed test fix after r226224. Pasteboard data is more than a dictionary. We have to whitelist NSString and NSArray as well. Change method name to reflect that we take a whitelist of classes that are allowed to be unarchived in the call. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): Use revised method. (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto. 2017-12-21 Zalan Bujtas [RenderTreeBuilder] Move RenderRubyAsInline::addChild mutation to a RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181101 Reviewed by Antti Koivisto. * rendering/RenderRuby.cpp: (WebCore::isRubyBeforeBlock): Deleted. (WebCore::isRubyAfterBlock): Deleted. (WebCore::rubyBeforeBlock): Deleted. (WebCore::rubyAfterBlock): Deleted. (WebCore::createAnonymousRubyInlineBlock): Deleted. (WebCore::lastRubyRun): Deleted. (WebCore::RenderRubyAsInline::addChild): Deleted. * rendering/RenderRuby.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): * rendering/updating/RenderTreeBuilderRuby.h: 2017-12-21 Jiewen Tan Update Credential Management API for WebAuthentication https://bugs.webkit.org/show_bug.cgi?id=181082 Reviewed by Daniel Bates. Part 1/2 In this patch, it restructure a bit for existing Credential Management API codebase: 1. Rename the folder from credentials to credentialmanagement for better understanding. 2. Remove unneeded dummy codes, i.e. PasswordCredential and FederatedCredential. 3. Core API and layout tests are updated correspondingly as well. Rebaseline test results. * CMakeLists.txt: * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.cpp: Renamed from Source/WebCore/Modules/credentials/BasicCredential.cpp. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::type const): * Modules/credentialmanagement/BasicCredential.h: Renamed from Source/WebCore/Modules/credentials/BasicCredential.h. (WebCore::BasicCredential::id const): * Modules/credentialmanagement/BasicCredential.idl: Renamed from Source/WebCore/Modules/credentials/BasicCredential.idl. * Modules/credentialmanagement/CredentialCreationOptions.h: Renamed from Source/WebCore/Modules/credentials/CredentialData.h. * Modules/credentialmanagement/CredentialCreationOptions.idl: Renamed from Source/WebCore/Modules/credentials/CredentialData.idl. * Modules/credentialmanagement/CredentialRequestOptions.h: Renamed from Source/WebCore/Modules/credentials/CredentialRequestOptions.h. * Modules/credentialmanagement/CredentialRequestOptions.idl: Renamed from Source/WebCore/Modules/credentials/CredentialRequestOptions.idl. * Modules/credentialmanagement/CredentialsContainer.cpp: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.cpp. (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess): * Modules/credentialmanagement/CredentialsContainer.h: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.h. (WebCore::CredentialsContainer::create): (WebCore::CredentialsContainer::CredentialsContainer): * Modules/credentialmanagement/CredentialsContainer.idl: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.idl. * Modules/credentialmanagement/NavigatorCredentials.cpp: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.cpp. (WebCore::NavigatorCredentials::supplementName): (WebCore::NavigatorCredentials::credentials): (WebCore::NavigatorCredentials::from): * Modules/credentialmanagement/NavigatorCredentials.h: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.h. * Modules/credentialmanagement/NavigatorCredentials.idl: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.idl. * Modules/credentials/CredentialCreationOptions.h: Removed. * Modules/credentials/CredentialCreationOptions.idl: Removed. * Modules/credentials/CredentialUserData.h: Removed. * Modules/credentials/CredentialUserData.idl: Removed. * Modules/credentials/FederatedCredential.cpp: Removed. * Modules/credentials/FederatedCredential.h: Removed. * Modules/credentials/FederatedCredential.idl: Removed. * Modules/credentials/FederatedCredentialInit.h: Removed. * Modules/credentials/FederatedCredentialInit.idl: Removed. * Modules/credentials/FederatedCredentialRequestOptions.h: Removed. * Modules/credentials/FederatedCredentialRequestOptions.idl: Removed. * Modules/credentials/PasswordCredential.cpp: Removed. * Modules/credentials/PasswordCredential.h: Removed. * Modules/credentials/PasswordCredential.idl: Removed. * Modules/credentials/PasswordCredentialData.h: Removed. * Modules/credentials/PasswordCredentialData.idl: Removed. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: 2017-12-21 John Wilander Storage Access API: Allow requests from non-sandboxed iframes https://bugs.webkit.org/show_bug.cgi?id=181099 Reviewed by Brent Fulgham. No new tests. Changed existing tests. * dom/Document.cpp: (WebCore::Document::requestStorageAccess): 2017-12-21 Ryosuke Niwa Minor cleanup in WebContentReaderCocoa after r226213 https://bugs.webkit.org/show_bug.cgi?id=181104 Reviewed by Wenson Hsieh. Deployed early exists in the case of attachment replacements to make the code easier to read. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragmentAndAddResources): (WebCore::markupForFragmentInDocument): Extracted out of sanitizeMarkupWithArchive. (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readImage): Simplified the return logic. 2017-12-21 Zalan Bujtas [RenderTreeBuilder] Move RenderRubyAsBlock::addChild mutation to a RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181090 Reviewed by Antti Koivisto. This is in preparation for moving all ruby mutation code here. Covered by existing tests. * rendering/RenderRuby.cpp: (WebCore::RenderRubyAsBlock::addChild): Deleted. * rendering/RenderRuby.h: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::isAnonymousRubyInlineBlock): (WebCore::isRubyBeforeBlock): (WebCore::isRubyAfterBlock): (WebCore::isRubyChildForNormalRemoval): (WebCore::rubyBeforeBlock): (WebCore::rubyAfterBlock): (WebCore::createAnonymousRubyInlineBlock): (WebCore::lastRubyRun): (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild): * rendering/updating/RenderTreeBuilderRuby.h: 2017-12-21 Jeremy Jones Update FULLSCREEN_API feature defines. https://bugs.webkit.org/show_bug.cgi?id=181015 Reviewed by Tim Horton. Change enabled iphone sdk for FULLSCREEN_API. * Configurations/FeatureDefines.xcconfig: 2017-12-21 Chris Dumez ononline, onoffline and navigator.onLine don't work if Parallels or VMWare is installed https://bugs.webkit.org/show_bug.cgi?id=32327 Reviewed by Alexey Proskuryakov. When determining if we are online, ignore virtual interfaces added on the host machine by Parallels and VMWare. This is needed because those interfaces are always up, whether or not the virtual machine is running. This was causing navigator.onLine to always return true on the host machine when Parallels or VMWare was installed. Note that it is safe to ignore these interfaces and that it does not cause issues when running Safari inside the virtual machine because those virtual interfaces are only exposed on the host machine. Inside, the virtual machine, we see the usual en0 interface. * platform/network/mac/NetworkStateNotifierMac.cpp: (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): 2017-12-21 Zalan Bujtas [RenderTreeBuilder] Move repeating code to RenderTreeBuilder::insertInternal https://bugs.webkit.org/show_bug.cgi?id=181094 Reviewed by Antti Koivisto. * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): 2017-12-21 Jeremy Jones Build fix after r226223 https://bugs.webkit.org/show_bug.cgi?id=181088 Unreviewed. * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::exitFullscreen): 2017-12-21 John Wilander Storage Access API: Make DocumentLoader::willSendRequest() and WebFrameLoaderClient::detachedFromParent2() tell the network process to get rid of any sub frame access entries https://bugs.webkit.org/show_bug.cgi?id=180728 Reviewed by Youenn Fablet. Tests: http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html This change calls the network process to clear any storage access entries when a subframe navigates or is detached. * dom/Document.cpp: (WebCore::Document::hasStorageAccess): (WebCore::Document::requestStorageAccess): (WebCore::Document::hasFrameSpecificStorageAccess): (WebCore::Document::setHasFrameSpecificStorageAccess): * dom/Document.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): * loader/EmptyFrameLoaderClient.h: * loader/FrameLoaderClient.h: * platform/network/NetworkStorageSession.h: * platform/network/cf/NetworkStorageSessionCFNet.cpp: (WebCore::NetworkStorageSession::removeStorageAccess): 2017-12-21 Antoine Quint [Web Animations] Complete support for keyframe animations https://bugs.webkit.org/show_bug.cgi?id=179708 Reviewed by Dean Jackson. We implement section 5.10.3 "Processing a keyframes argument" of the Web Animations spec to handle multiple keyframes, rather than only two, provided either in iterable (ie. array) or property-index (ie. dictionary) form. Although we don't currently support timing function or composite operations, we parse them as well. While there are minimal test changes, there will be a host of changes in the next patch in which we turn Element.animate() on. * animation/KeyframeEffect.cpp: (WebCore::IDLAttributeNameToAnimationPropertyName): New utility to convert an IDL-parsed JS property into a WebCore CSSPropertyID. (WebCore::computeMissingKeyframeOffsets): Converts "null" offsets into computed offset values as specified in section 4.4.2. "Calculating computed keyframes". (WebCore::processIterableKeyframes): Process the iterable form of the keyframes argument. (WebCore::processKeyframeLikeObject): Process a keyframe-like object found in the property-indexed form. (WebCore::processPropertyIndexedKeyframes): Process the property-indexed form of the keyframes argument. (WebCore::KeyframeEffect::setKeyframes): Since this method and processKeyframes() share the same signature, we can just return the value from processKeyframes() directly. (WebCore::KeyframeEffect::processKeyframes): Process the keyframes argument as specified. (WebCore::KeyframeEffect::applyAtLocalTime): Delegate blending to the new setAnimatedPropertiesInStyle() since this task is now more complex due to handling of multiple keyframes. (WebCore::KeyframeEffect::getAnimatedStyle): Delegate blending to the new setAnimatedPropertiesInStyle() since this task is now more complex due to handling of multiple keyframes. (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Handle multiple and implicit start and end keyframes. * animation/KeyframeEffect.h: Add some new structures used for parsing purposes. * animation/KeyframeEffect.idl: Expose the CompositeOperation enum and the BasePropertyIndexedKeyframe dictionary used in processKeyframeLikeObject(). * css/CSSStyleDeclaration.cpp: (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName): * css/CSSStyleDeclaration.h: * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimation::isPropertyAnimatable): * page/animation/CSSPropertyAnimation.h: 2017-12-21 Jer Noble Add initial DOM support for Media Capabilities https://bugs.webkit.org/show_bug.cgi?id=181064 Reviewed by Eric Carlson. Test: media/mediacapabilities/mediacapabilities-types.html Add basic, cross-platform, DOM facing type and API support for Media Capabilities API. * bindings/scripts/CodeGenerator.pm: (WK_ucfirst): * CMakeLists.txt: * DerivedSources.make: * Modules/mediacapabilities/AudioConfiguration.h: Added. * Modules/mediacapabilities/AudioConfiguration.idl: Added. * Modules/mediacapabilities/MediaCapabilities.cpp: Added. (WebCore::bucketMIMETypes): (WebCore::isValidMIMEType): (WebCore::isValidVideoConfiguration): (WebCore::isValidAudioConfiguration): (WebCore::isValidMediaConfiguration): (WebCore::MediaCapabilities::decodingInfo): (WebCore::MediaCapabilities::encodingInfo): * Modules/mediacapabilities/MediaCapabilities.h: Added. * Modules/mediacapabilities/MediaCapabilities.idl: Added. * Modules/mediacapabilities/MediaCapabilitiesInfo.h: Added. (WebCore::MediaCapabilitiesInfo::supported const): (WebCore::MediaCapabilitiesInfo::setSupported): (WebCore::MediaCapabilitiesInfo::smooth const): (WebCore::MediaCapabilitiesInfo::setSmooth): (WebCore::MediaCapabilitiesInfo::powerEfficient const): (WebCore::MediaCapabilitiesInfo::setPowerEfficient): * Modules/mediacapabilities/MediaCapabilitiesInfo.idl: Added. * Modules/mediacapabilities/MediaConfiguration.h: Added. * Modules/mediacapabilities/MediaConfiguration.idl: Added. * Modules/mediacapabilities/MediaDecodingConfiguration.h: Added. * Modules/mediacapabilities/MediaDecodingConfiguration.idl: Added. * Modules/mediacapabilities/MediaDecodingType.h: Added. * Modules/mediacapabilities/MediaDecodingType.idl: Added. * Modules/mediacapabilities/MediaEncodingConfiguration.h: Added. * Modules/mediacapabilities/MediaEncodingConfiguration.idl: Added. * Modules/mediacapabilities/MediaEncodingType.h: Added. * Modules/mediacapabilities/MediaEncodingType.idl: Added. * Modules/mediacapabilities/NavigatorMediaCapabilities.cpp: Added. (WebCore::NavigatorMediaCapabilities::NavigatorMediaCapabilities): (WebCore::NavigatorMediaCapabilities::supplementName): (WebCore::NavigatorMediaCapabilities::from): (WebCore::NavigatorMediaCapabilities::mediaCapabilities): (WebCore::NavigatorMediaCapabilities::mediaCapabilities const): * Modules/mediacapabilities/NavigatorMediaCapabilities.h: Added. * Modules/mediacapabilities/NavigatorMediaCapabilities.idl: Added. * Modules/mediacapabilities/ScreenColorGamut.h: Added. * Modules/mediacapabilities/ScreenColorGamut.idl: Added. * Modules/mediacapabilities/ScreenLuminance.h: Added. (WebCore::ScreenLuminance::min const): (WebCore::ScreenLuminance::setMin): (WebCore::ScreenLuminance::max const): (WebCore::ScreenLuminance::setMax): (WebCore::ScreenLuminance::maxAverage const): (WebCore::ScreenLuminance::setMaxAverage): * Modules/mediacapabilities/ScreenLuminance.idl: Added. * Modules/mediacapabilities/VideoConfiguration.h: Added. * Modules/mediacapabilities/VideoConfiguration.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setMediaCapabilitiesEnabled): (WebCore::RuntimeEnabledFeatures::mediaCapabilitiesEnabled const): * page/Settings.yaml: 2017-12-21 Keith Rollin Add optional logging of per-resource cookie information https://bugs.webkit.org/show_bug.cgi?id=180883 Reviewed by Brent Fulgham. In order to support the tracking of the efficacy of Intelligent Tracking Protection, add some logging of the cookie information associated with each loaded resource. This logging is off by default and is enabled with `defaults write -g WebKitLogCookieInformation -bool true`. No new tests -- no new user functionality added. Only new logging has been added. * platform/Cookie.h: (WebCore::Cookie::Cookie): (WebCore::Cookie::isNull const): (WebCore::Cookie::encode const): (WebCore::Cookie::decode): * platform/network/cf/CookieJarCFNet.cpp: (WebCore::canonicalCookieTime): (WebCore::cookieCreatedTime): (WebCore::cookieExpirationTime): (WebCore::getRawCookies): * platform/network/cocoa/CookieCocoa.mm: (WebCore::cookieCreated): (WebCore::Cookie::Cookie): * platform/network/soup/CookieJarSoup.cpp: (WebCore::getRawCookies): 2017-12-21 Brent Fulgham Adopt new secure coding APIs in WebCore https://bugs.webkit.org/show_bug.cgi?id=178484 Reviewed by Eric Carlson. Switch to new NSKeyed[Un]Archiver methods that use NSSecureCoding by default. Most of the new API is wrapped in a set of convenience methods so we can build without the new API on older systems. No change in behavior. * editing/cocoa/EditorCocoa.mm: (WebCore::archivedDataForAttributedString): Use new convenience method to archive the string object. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::write): Use new secure API. (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto. 2017-12-21 Zalan Bujtas [RenderTreeBuilder] Move ruby mutation code to a dedicated class. https://bugs.webkit.org/show_bug.cgi?id=181066 Reviewed by Antti Koivisto. This is in preparation for moving all ruby mutation code here. No change in functionality. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::rubyRunInsertChild): Deleted. * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::rubyBuilder): * rendering/updating/RenderTreeBuilderRuby.cpp: Added. (WebCore::RenderTreeBuilder::Ruby::Ruby): (WebCore::RenderTreeBuilder::Ruby::insertChild): * rendering/updating/RenderTreeBuilderRuby.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h. 2017-12-21 Ms2ger Replace a FIXME comment in CanvasGradient::addColorStop(). https://bugs.webkit.org/show_bug.cgi?id=181034 Reviewed by Daniel Bates. Tests: LayoutTests/imported/w3c/canvas/2d.gradient.object.current.html * html/canvas/CanvasGradient.cpp: (WebCore::CanvasGradient::addColorStop): 2017-12-21 Jeremy Jones Enable picture-in-picture from inline element on suspend. https://bugs.webkit.org/show_bug.cgi?id=180942 rdar://problem/34745234 Reviewed by Jer Noble. When a element goes into element fullscreen mode, a descendant video element gains the ability to automatically enter picture-in-picture on application suspend. This adds support for video fullscreen standby mode, which creates a VideoFullscreenInterfaceAVKit so that it can trigger auto-pip on application suspend while the element is not actually presenting in video fullscreen mode. VideoFullscreenInterfaceAVKit has a new state transition system that will replace the existing one to enable the increased number and complexity of state transitions. Until we are ready to completely commit to this new code path, this implementation is conditionalized to keep the existing code path working. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enterFullscreen): (WebCore::HTMLMediaElement::exitFullscreen): (WebCore::HTMLMediaElement::setVideoFullscreenStandby): (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): * html/HTMLMediaElement.h: * page/ChromeClient.h: * platform/cocoa/VideoFullscreenChangeObserver.h: * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]): (-[WebAVPlayerLayer layoutSublayers]): (allocWebAVPictureInPicturePlayerLayerViewInstance): (allocWebAVPlayerLayerViewInstance): (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive): (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::enterFullscreen): (VideoFullscreenInterfaceAVKit::exitFullscreen): (VideoFullscreenInterfaceAVKit::cleanupFullscreen): (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): (VideoFullscreenInterfaceAVKit::preparedToReturnToInline): (VideoFullscreenInterfaceAVKit::mayAutomaticallyShowVideoPictureInPicture const): (VideoFullscreenInterfaceAVKit::willStartPictureInPicture): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture): (VideoFullscreenInterfaceAVKit::willStopPictureInPicture): (VideoFullscreenInterfaceAVKit::didStopPictureInPicture): (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler): (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): (VideoFullscreenInterfaceAVKit::setMode): (VideoFullscreenInterfaceAVKit::clearMode): (VideoFullscreenInterfaceAVKit::setHasVideoContentLayer): (VideoFullscreenInterfaceAVKit::setInlineRect): (VideoFullscreenInterfaceAVKit::doSetup): (VideoFullscreenInterfaceAVKit::finalizeSetup): (VideoFullscreenInterfaceAVKit::doEnterFullscreen): (VideoFullscreenInterfaceAVKit::doExitFullscreen): (VideoFullscreenInterfaceAVKit::exitFullscreenHandler): (VideoFullscreenInterfaceAVKit::enterFullscreenHandler): (VideoFullscreenInterfaceAVKit::returnToStandby): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::requestUpdateInlineRect): (VideoFullscreenControllerContext::requestVideoContentLayer): (VideoFullscreenControllerContext::returnVideoContentLayer): (VideoFullscreenControllerContext::didSetupFullscreen): (VideoFullscreenControllerContext::didExitFullscreen): (VideoFullscreenControllerContext::setUpFullscreen): 2017-12-20 Ryosuke Niwa DeferredLoadingScope incorrectly disabled images or enables deferred loading https://bugs.webkit.org/show_bug.cgi?id=181077 Reviewed by Wenson Hsieh. Fixed the bug that DeferredLoadingScope::~DeferredLoadingScope was checking the wrong flag for restoring the disabledness of images and deferred loading. Test: editing/pasteboard/pasting-with-images-disabled-should-not-enable-deferred-loading.html * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::DeferredLoadingScope::~DeferredLoadingScope): Fixed the bug. * testing/Internals.cpp: (WebCore::Internals::pageDefersLoading): Added for testing. * testing/Internals.h: * testing/Internals.idl: Added pageDefersLoading. 2017-12-20 Ryosuke Niwa isSafari check should take Safari Technology Preview into account https://bugs.webkit.org/show_bug.cgi?id=181076 Reviewed by Alex Christensen. Fixed isSafari() so that it returns true for Safari Technology Preview. This bug resulted in the custom pasteboard types not being enabled in Safari Technology Preview. In long term, we should eliminate these isSafari() checks. * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::MacApplication::isSafari): 2017-12-20 Wenson Hsieh [Attachment Support] Attachment replacement logic should not depend on subresource URL attribute replacement https://bugs.webkit.org/show_bug.cgi?id=181068 Reviewed by Ryosuke Niwa. Refactors attachment replacement logic, so that it doesn't require us to first replace element attributes that contain subresource URLs with blob URLs before performing attachment element replacement. See below comments for more detail. Covered by existing API tests in WKAttachmentTests. * editing/WebContentReader.h: (WebCore::BlobReplacementInfo::isEmpty const): Deleted. Remove BlobReplacementInfo. Instead, augment `replaceRichContentWithAttachments` so that it takes in the list of subresources directly and generates blobs for each subresource. * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::replaceSelectionWithAttributedString): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::shouldReplaceRichContentWithAttachments): (WebCore::createFragmentForImageAttachment): (WebCore::replaceRichContentWithAttachments): (WebCore::createFragmentAndAddResources): (WebCore::sanitizeMarkupWithArchive): In these helper functions that currently convert subresource URLs to blob URLs, if attachment elements are not defined out, and the runtime feature for attachment elements is enabled, then use an alternate codepath to adjust the markup (via replaceRichContentWithAttachments). Otherwise, fall back to default subresource URL conversion logic, which (at the moment) still converts subresources to blobs, but will soon be changed to emit data URLs instead. (WebCore::WebContentReader::readWebArchive): (WebCore::WebContentMarkupReader::readWebArchive): (WebCore::WebContentReader::readRTFD): (WebCore::WebContentMarkupReader::readRTFD): (WebCore::WebContentReader::readRTF): (WebCore::WebContentMarkupReader::readRTF): (WebCore::WebContentReader::readImage): Remove the createFragmentFromAttributedString helper and revert to just calling createFragmentAndAddResources. (WebCore::createFragmentFromAttributedString): Deleted. 2017-12-20 Eric Carlson [MediaStream] Add screen capture IDL and stub functions https://bugs.webkit.org/show_bug.cgi?id=181070 Reviewed by Youenn Fablet. Tests: fast/mediastream/screencapture-disabled.html fast/mediastream/screencapture-enabled.html * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::getDisplayMedia const): (WebCore::MediaDevices::getSupportedConstraints): * Modules/mediastream/MediaDevices.h: * Modules/mediastream/MediaDevices.idl: * Modules/mediastream/MediaTrackConstraints.cpp: (WebCore::convertToInternalForm): * Modules/mediastream/MediaTrackConstraints.h: * Modules/mediastream/MediaTrackConstraints.idl: * Modules/mediastream/MediaTrackSupportedConstraints.h: * Modules/mediastream/MediaTrackSupportedConstraints.idl: * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::start): (WebCore::UserMediaRequest::allow): (WebCore::UserMediaRequest::deny): * Modules/mediastream/UserMediaRequest.h: * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::screenCaptureEnabled const): (WebCore::RuntimeEnabledFeatures::setScreenCaptureEnabled): * platform/mediastream/CaptureDevice.h: * platform/mediastream/MediaConstraints.cpp: (WebCore::MediaTrackConstraintSetMap::set): * platform/mediastream/MediaConstraints.h: (WebCore::MediaTrackConstraintSetMap::displaySurface const): (WebCore::MediaTrackConstraintSetMap::logicalSurface const): (WebCore::MediaTrackConstraintSetMap::encode const): (WebCore::MediaTrackConstraintSetMap::decode): * platform/mediastream/MediaStreamRequest.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::fitnessDistance): (WebCore::RealtimeMediaSource::applyConstraint): (WebCore::RealtimeMediaSource::supportsConstraint const): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): * platform/mediastream/RealtimeMediaSourceSettings.h: (WebCore::RealtimeMediaSourceSettings::supportsDisplaySurface const): (WebCore::RealtimeMediaSourceSettings::displaySurface const): (WebCore::RealtimeMediaSourceSettings::setDisplaySurface): (WebCore::RealtimeMediaSourceSettings::supportsLogicalSurface const): (WebCore::RealtimeMediaSourceSettings::logicalSurface const): (WebCore::RealtimeMediaSourceSettings::setLogicalSurface): * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp: (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint const): * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h: (WebCore::RealtimeMediaSourceSupportedConstraints::supportsDisplaySurface const): (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsDisplaySurface): (WebCore::RealtimeMediaSourceSupportedConstraints::supportsLogicalSurface const): (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsLogicalSurface): (WebCore::RealtimeMediaSourceSupportedConstraints::encode const): (WebCore::RealtimeMediaSourceSupportedConstraints::decode): * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: * platform/mock/MockRealtimeVideoSource.cpp: * testing/InternalSettings.cpp: (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::setScreenCaptureEnabled): * testing/InternalSettings.h: * testing/InternalSettings.idl: 2017-12-20 Matt Lewis Unreviewed, rolling out r225656. The test has been a flaky timout since being added. Reverted changeset: "WebAssembly: sending module to iframe fails" https://bugs.webkit.org/show_bug.cgi?id=179263 https://trac.webkit.org/changeset/225656 2017-12-20 Don Olmstead [Win] Use WCharStringExtras functions in WebCore https://bugs.webkit.org/show_bug.cgi?id=180963 Reviewed by Alex Christensen. No new tests. No change in behavior. * platform/graphics/win/FontCacheWin.cpp: (WebCore::appendLinkedFonts): (WebCore::getLinkedFonts): (WebCore::FontCache::systemFallbackForCharacters): (WebCore::FontCache::fontFromDescriptionAndLogFont): * platform/graphics/win/FontCustomPlatformDataCairo.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): * platform/graphics/win/IconWin.cpp: (WebCore::Icon::createIconForFiles): * platform/network/win/DownloadBundleWin.cpp: (WebCore::DownloadBundle::appendResumeData): (WebCore::DownloadBundle::extractResumeData): * platform/text/win/LocaleWin.cpp: (WebCore::LCIDFromLocaleInternal): (WebCore::LCIDFromLocale): * platform/win/ClipboardUtilitiesWin.cpp: (WebCore::getWebLocData): (WebCore::createGlobalData): (WebCore::getFileDescriptorData): (WebCore::getURL): (WebCore::getCFData): (WebCore::setCFData): * platform/win/DragDataWin.cpp: (WebCore::DragData::asFilenames const): * platform/win/DragImageWin.cpp: (WebCore::createDragImageIconForCachedImageFilename): (WebCore::dragLabelFont): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::getFindData): (WebCore::FileSystem::createSymbolicLink): (WebCore::FileSystem::deleteFile): (WebCore::FileSystem::deleteEmptyDirectory): (WebCore::FileSystem::moveFile): (WebCore::FileSystem::pathByAppendingComponent): (WebCore::FileSystem::makeAllDirectories): (WebCore::FileSystem::pathGetFileName): (WebCore::FileSystem::openTemporaryFile): (WebCore::FileSystem::openFile): (WebCore::FileSystem::hardLinkOrCopyFile): * platform/win/MIMETypeRegistryWin.cpp: (WebCore::mimeTypeForExtension): (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::read): (WebCore::createGlobalHDropContent): * platform/win/PathWalker.cpp: (WebCore::PathWalker::PathWalker): * platform/win/SSLKeyGeneratorWin.cpp: (WebCore::WebCore::signedPublicKeyAndChallengeString): * platform/win/SharedBufferWin.cpp: (WebCore::SharedBuffer::createFromReadingFile): * rendering/RenderThemeWin.cpp: (WebCore::fillFontDescription): 2017-12-20 Youenn Fablet com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::UserMediaRequest::stop + 126 https://bugs.webkit.org/show_bug.cgi?id=181057 Reviewed by Eric Carlson. Covered by fast/mediastream tests to not crash anymore. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::stop): 2017-12-20 Brady Eidson Assertion failure in MessagePort::contextDestroyed in http/tests/security/MessagePort/event-listener-context.html, usually attributed to later tests. https://bugs.webkit.org/show_bug.cgi?id=94458 Reviewed by Chris Dumez. No new tests (Changed existing test to reliably crash before this change, and work after it) There was already a glaring FIXME that said "MessagePorts should be ActiveDOMObjects" It was right, and it fixes up this subtle lifetime issue. * dom/MessagePort.cpp: (WebCore::MessagePort::MessagePort): (WebCore::MessagePort::hasPendingActivity const): (WebCore::MessagePort::locallyEntangledPort const): (WebCore::MessagePort::activeDOMObjectName const): (WebCore::MessagePort::hasPendingActivity): Deleted. (WebCore::MessagePort::locallyEntangledPort): Deleted. * dom/MessagePort.h: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::~ScriptExecutionContext): (WebCore::ScriptExecutionContext::stopActiveDOMObjects): (WebCore::ScriptExecutionContext::hasPendingActivity const): 2017-12-20 Youenn Fablet Do not search for service worker registration in case of non HTTP navigation loads https://bugs.webkit.org/show_bug.cgi?id=180976 Unreviewed. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource): Removing unneeded spaces. 2017-12-20 Alex Christensen Remove some SVN files accidentally committed with r226160 https://bugs.webkit.org/show_bug.cgi?id=180934 * WebCore.xcodeproj/project.pbxproj.orig: Removed. * WebCore.xcodeproj/project.pbxproj.rej: Removed. 2017-12-20 Zalan Bujtas [RenderTreeBuilder] Replace remaining addChild calls with RenderTreeBuilder::insert https://bugs.webkit.org/show_bug.cgi?id=181044 Reviewed by Antti Koivisto. Covered by existing test cases. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addChildIgnoringContinuation): * rendering/RenderElement.cpp: (WebCore::RenderElement::addChildIgnoringContinuation): * rendering/RenderElement.h: (WebCore::RenderElement::addChildIgnoringContinuation): Deleted. 2017-12-20 Daniel Bates Cleanup: Dereference value of optional directly instead of using checked value in WebCore::subdivide() https://bugs.webkit.org/show_bug.cgi?id=181050 Reviewed by Simon Fraser. It is sufficient and more efficient to dereference a std::optional directly when we know that it has a value as opposed to using the checked dereference member function std::optional<>::value(). No functionality changed. So, no new tests. * rendering/MarkerSubrange.cpp: (WebCore::subdivide): 2017-12-20 Daniel Bates MarkerSubrange.SubdivideGrammarAndSelectionOverlap{Frontmost, FrontmostWithLongestEffectiveRange} are failing https://bugs.webkit.org/show_bug.cgi?id=181014 Reviewed by Simon Fraser. Fixes an issue in the subdivision algorithm where the returned subranges may not be paint order or reverse paint order when using the default overlap strategy (OverlapStrategy::None) and either OverlapStrategy::Frontmost or OverlapStrategy::FrontmostWithLongestEffectiveRange, respectively. Currently we compute the overlapping subranges up to some point p_i on the line by sweeping from the start of the line through all the unclosed subranges. The unclosed subranges are sorted along the line. That is, they are not sorted by paint order or reverse paint order. Therefore we must take care to ensure that we return the computed overlapping subranges with respect to paint order/reverse paint order. * rendering/MarkerSubrange.cpp: (WebCore::subdivide): 2017-12-20 Youenn Fablet LayoutTest imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=179137 Reviewed by Chris Dumez. Covered by unflaked test. * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::postTaskToLoader): ThreadableBlobRegistry is using callOnMainThread. Use it also for postTaskToLoader so that there is no race condition between registering a blob and reading it. 2017-12-20 Youenn Fablet Support service worker interception of request with blob body https://bugs.webkit.org/show_bug.cgi?id=181035 Reviewed by Chris Dumez. Covered by updated test. Add support for getting blob request bodies within service worker. Disable interception of requests with form datas. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::fromFormData): * Modules/fetch/FetchBody.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/context/ServiceWorkerFetch.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::postFetchTask): 2017-12-20 Jeremy Jones Send fullscreenChange earlier, in webkitWillEnterFullscreen https://bugs.webkit.org/show_bug.cgi?id=181016 Reviewed by Jer Noble. Sending the event earlier, allows pages to update their interface state before the fullscreen animation. * dom/Document.cpp: (WebCore::Document::webkitWillEnterFullScreenForElement): (WebCore::Document::webkitDidEnterFullScreenForElement): 2017-12-20 Daniel Bates Remove Alternative Presentation Button https://bugs.webkit.org/show_bug.cgi?id=180500 Reviewed by Simon Fraser. We no longer need the alternative presentation button. * Configurations/FeatureDefines.xcconfig: * DerivedSources.make: * English.lproj/Localizable.strings: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Element.h: * editing/Editor.cpp: (WebCore::Editor::clear): (WebCore::Editor::substituteWithAlternativePresentationButton): Deleted. (WebCore::Editor::removeAlternativePresentationButton): Deleted. (WebCore::Editor::elementsReplacedByAlternativePresentationButton): Deleted. (WebCore::Editor::didInsertAlternativePresentationButtonElement): Deleted. (WebCore::Editor::didRemoveAlternativePresentationButtonElement): Deleted. * editing/Editor.h: * editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Removed. * editing/cocoa/AlternativePresentationButtonSubstitution.h: Removed. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateType): (WebCore::HTMLInputElement::parseAttribute): (WebCore::HTMLInputElement::willAttachRenderers): (WebCore::HTMLInputElement::alternativePresentationButtonElement const): Deleted. (WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Deleted. (WebCore::HTMLInputElement::createInputType): Deleted. * html/HTMLInputElement.h: * html/InputType.h: (WebCore::InputType::alternativePresentationButtonElement const): Deleted. * html/InputTypeNames.cpp: (WebCore::InputTypeNames::alternativePresentationButton): Deleted. * html/InputTypeNames.h: * html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Removed. * html/shadow/cocoa/AlternativePresentationButtonElement.h: Removed. * html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Removed. * html/shadow/cocoa/AlternativePresentationButtonInputType.h: Removed. * page/ChromeClient.h: * platform/LocalizedStrings.cpp: (WebCore::AXAlternativePresentationButtonLabel): Deleted. (WebCore::alternativePresentationButtonTitle): Deleted. (WebCore::alternativePresentationButtonSubtitle): Deleted. * platform/LocalizedStrings.h: * testing/Internals.cpp: (WebCore::Internals::substituteWithAlternativePresentationButton): Deleted. (WebCore::Internals::removeAlternativePresentationButton): Deleted. (WebCore::Internals::elementsReplacedByAlternativePresentationButton): Deleted. * testing/Internals.h: * testing/Internals.idl: 2017-12-20 Chris Dumez Do not reuse resource for memory cache if selected service worker differs https://bugs.webkit.org/show_bug.cgi?id=181042 Reviewed by Youenn Fablet. No new tests, rebaselined existing test. * loader/cache/CachedResource.h: (WebCore::CachedResource::options const): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::determineRevalidationPolicy const): 2017-12-20 Youenn Fablet Do not search for service worker registration in case of non HTTP navigation loads https://bugs.webkit.org/show_bug.cgi?id=180976 Reviewed by Chris Dumez. Covered by manual testing using perf test app uploaded in https://bugs.webkit.org/show_bug.cgi?id=180929. In case we are sure there is no possiblity for getting a service worker, skip the search step. Simialrly, do not report any Document as a Service Worker client if it can never be controlled. A follow-up patch should handle the case of local URLs service worker selection. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource): (WebCore::DocumentLoader::commitData): 2017-12-20 Andy Estes [Apple Pay] Tell PassKit whether Apple Pay JS or Payment Request was used to start an Apple Pay session https://bugs.webkit.org/show_bug.cgi?id=181001 Reviewed by Tim Horton. * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): * Modules/applepay/ApplePaySessionPaymentRequest.h: (WebCore::ApplePaySessionPaymentRequest::requester const): (WebCore::ApplePaySessionPaymentRequest::setRequester): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::show): 2017-12-20 Zalan Bujtas [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTable::addChild to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181018 Reviewed by Antti Koivisto. This is in preparation for removing all tree mutation from renderering code. Covered by existing tests. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addChildIgnoringContinuation): * rendering/RenderTable.cpp: (WebCore::RenderTable::addChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild): * rendering/updating/RenderTreeBuilderTable.h: 2017-12-20 Frederic Wang Split layout of RenderMathMLRow into smaller steps https://bugs.webkit.org/show_bug.cgi?id=180348 Reviewed by Manuel Rego Casasnovas. Currently, RenderMathMLRow mixes too many steps in the same layout functions: layout children, calculate stretch size, stretch vertical operators, calculate final ascent/descent, handle out-of-flow positioned children, set logical height, set logical width for non-display tag, center display tag etc This situation is inherited from the old flexbox implementation but it makes difficult to read the code and to re-use layout & metrics calculation for follow-up work on -like elements (, , or ). See for example bug 160547 for or bug 161126 for . This patch rewrites RenderMathMLRow into smaller steps: - stretchVerticalOperatorsAndLayoutChildren() which calls layoutIfNeeded() or insertPositionedObject() on children and stretch vertical operators. - getContentBoundingBox() to determine the metrics of the mrow-like element without calling layout on children or positioning them, so that we can improve mrow-like element in the future. - layoutRowItems() which sets the position of children. Setting the logical width/height or centering children is now moved into layoutBlock() since derived class overriding layoutBlock() will do their own adjustment for width, height and positions. Test: mathml/mrow-preferred-width-with-out-of-flow-child.html The rest of the behavior is unchanged and already covered by existing tests. * rendering/mathml/RenderMathMLMenclose.cpp: (WebCore::RenderMathMLMenclose::layoutBlock): Use the new function and get contentWidth directly from getContentBoundingBox(). * rendering/mathml/RenderMathMLPadded.cpp: (WebCore::RenderMathMLPadded::layoutBlock): Ditto. * rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::layoutBlock): Ditto, also remove useless statement baseAscent = baseDescent. * rendering/mathml/RenderMathMLRow.cpp: (WebCore::toVerticalStretchyOperator): New helper function to cast to a vertical stretchy operator. (WebCore::RenderMathMLRow::stretchVerticalOperatorsAndLayoutChildren): New helper function to ensure layoutIfNeeded()/insertPositionedObject() is called on children and that the vertical operators are stretched. (WebCore::RenderMathMLRow::getContentBoundingBox const): New helper function to determine the width/ascent/descent to use for the mrow content. (WebCore::RenderMathMLRow::computePreferredLogicalWidths): Skip out-of-flow children in the preferred width calculation. This is verified by the new test. (WebCore::RenderMathMLRow::layoutRowItems): Only keep the positioning of children with the specified width and ascent. (WebCore::RenderMathMLRow::layoutBlock): Center children for tag and set the logical width in other cases. Also set the logical height here. (WebCore::RenderMathMLRow::computeLineVerticalStretch): Deleted. This work is included in stretchVerticalOperatorsAndLayoutChildren() now. * rendering/mathml/RenderMathMLRow.h: Update declaration of functions. 2017-12-20 Antti Koivisto Move list and multicolumn building code from RenderTreeUpdater to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=181021 Reviewed by Zalan Bujtas. RenderTreeUpdater::ListItem -> RenderTreeBuilder::List RenderTreeUpdater::MultiColumn -> RenderTreeBuilder::MultiColumn * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/TextAutoSizing.cpp: (WebCore::TextAutoSizingValue::adjustTextNodeSizes): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::updateAfterDescendants): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::listBuilder): (WebCore::RenderTreeBuilder::multiColumnBuilder): * rendering/updating/RenderTreeBuilderList.cpp: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterListItem.cpp. (WebCore::RenderTreeBuilder::List::List): (WebCore::RenderTreeBuilder::List::updateItemMarker): (WebCore::RenderTreeUpdater::ListItem::updateMarker): Deleted. * rendering/updating/RenderTreeBuilderList.h: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterListItem.h. * rendering/updating/RenderTreeBuilderMultiColumn.cpp: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterMultiColumn.cpp. (WebCore::RenderTreeBuilder::MultiColumn::MultiColumn): (WebCore::RenderTreeBuilder::MultiColumn::updateAfterDescendants): (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): (WebCore::RenderTreeUpdater::MultiColumn::update): Deleted. (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): Deleted. (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow): Deleted. * rendering/updating/RenderTreeBuilderMultiColumn.h: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterMultiColumn.h. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::commit): (WebCore::RenderTreeUpdater::updateAfterDescendants): * rendering/updating/RenderTreeUpdater.h: * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): * rendering/updating/RenderTreeUpdaterListItem.cpp: Removed. * rendering/updating/RenderTreeUpdaterListItem.h: Removed. * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Removed. * rendering/updating/RenderTreeUpdaterMultiColumn.h: Removed. 2017-12-20 Ms2ger REGRESSION(r226160) Build broken when MEDIA_STREAM is disabled with MediaStreamRequest namespace confusion https://bugs.webkit.org/show_bug.cgi?id=181026 Unreviewed build fix. * platform/mediastream/MediaStreamRequest.h: Fix namespace, unconditionally include header. 2017-12-20 Frederic Wang Refactor RenderMathMLFraction to remove members modified during layout https://bugs.webkit.org/show_bug.cgi?id=180151 Reviewed by Manuel Rego Casasnovas. Currently, RenderMathMLFraction has three LayoutUnit members m_defaultLineThickness, m_lineThickness and m_ascent that are set during layout. In the past such members have caused MathML rendering bugs due to update issues. This patch refactors the layout of MathML fractions so that it does not require to store and keep these LayoutUnit members up-to-date. New helper functions are introduced to perform the simple arithmetic calculations required. No new tests, behavior unchanged and already covered by existing tests. * rendering/mathml/RenderMathMLFraction.cpp: We add new helper functions to calculate line thickness values. This allows to remove updateLineThickness(), m_defaultLineThickness and m_lineThickness. We also introduce the ascentOverHorizontalAxis() helper function to calculate the ascent over the middle of its fraction bar or stack gap. This allows to remove the m_ascent member. (WebCore::RenderMathMLFraction::defaultLineThickness const): Helper function to calculate the default thickness of the fraction bar given in the MATH table or a fallback value. This replaces the use of m_defaultLineThickness. (WebCore::RenderMathMLFraction::lineThickness const): Helper function to resolve the actual thickness based on the @linethickness attribute and the default value. This replaces the use of m_lineThickness. (WebCore::RenderMathMLFraction::relativeLineThickness const): Rewrite this function using the new helper functions. (WebCore::RenderMathMLFraction::fractionParameters const): Make this const and replaces isStack() with !lineThickness(). (WebCore::RenderMathMLFraction::stackParameters const): Ditto. Also move from layoutBlock the adjustment of parameters to ensure a minimum gap. Doing so assumes that the fraction is valid so we add an ASSERT. (WebCore::RenderMathMLFraction::horizontalOffset const): Make this a const since it does not mutate anything. (WebCore::RenderMathMLFraction::ascentOverHorizontalAxis const): Move this code from layoutBlock() to determine the middle of the stack gap or of the fraction bar. This helper function replaces m_ascent - mathAxisHeight(). Note that the adjustment of topShiftUp is now done in stackParameters(). (WebCore::RenderMathMLFraction::layoutBlock): Remove the call to updateLineThickness(). Rely on stackParameters() and ascentOverHorizontalAxis() to perform the necessary calculation of bottomShiftDown and ascent respectively. (WebCore::RenderMathMLFraction::paint): Use lineThickness() and ascentOverHorizontalAxis() instead of m_lineThickness, m_ascent and isStack(). (WebCore::RenderMathMLFraction::firstLineBaseline const): Use ascentOverHorizontalAxis() and mathAxisHeight() instead of m_ascent. (WebCore::RenderMathMLFraction::updateLineThickness): Deleted. * rendering/mathml/RenderMathMLFraction.h: Declare new helper functions for line thickness values and ascent and remove the old LayoutUnit members. Make horizontalOffset(), fractionParameter() and stackParameters() const since they do not modify anything and the two last are used in the const function ascentOverHorizontalAxis(), itself used in firstLineBaseline(). 2017-12-20 Carlos Alberto Lopez Perez [GTK][Clang] Build fix after r226138 https://bugs.webkit.org/show_bug.cgi?id=180984 Unreviewed build fix. No new tests, its a build fix. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): 2017-12-20 Ryosuke Niwa REGRESSION(r222699): Drag & drop from a web page to Gmail fails https://bugs.webkit.org/show_bug.cgi?id=181019 Reviewed by Wenson Hsieh. The bug was caused by imageTypeToFakeFilename returning "image/png" instead of "image.png" for the filename for a PING image converted from a TIFF image. Fixed the bug by correcting this typo. Tests: PasteImage.PasteLegacyTIFFImage PasteImage.PasteTIFFImage * platform/cocoa/PasteboardCocoa.mm: (WebCore::imageTypeToFakeFilename): 2017-12-19 Myles C. Maxfield Refactor user-installed font setting for clarity https://bugs.webkit.org/show_bug.cgi?id=181013 Reviewed by Simon Fraser. Pave the way for https://bugs.webkit.org/show_bug.cgi?id=180951. This patch renames the Setting to not have so many grammatical negatives, and moves some CoreText-specific FontCache function signatures into a new FontCacheCoreText.h header file. It also uses the AllowUserInstalledFonts enum class in more places instead of the old boolean we were using, and puts this enum class in the common TextFlags.h header. No new tests because there is no behavior change. * WebCore.xcodeproj/project.pbxproj: * css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): * css/StyleResolver.cpp: (WebCore::StyleResolver::initializeFontStyle): * page/Settings.yaml: * platform/graphics/FontCache.h: (WebCore::SynthesisPair::SynthesisPair): Deleted. (WebCore::SynthesisPair::boldObliquePair const): Deleted. * platform/graphics/FontDescription.cpp: (WebCore::m_shouldAllowUserInstalledFonts): (WebCore::m_mayRepresentUserInstalledFont): Deleted. * platform/graphics/FontDescription.h: (WebCore::FontDescription::shouldAllowUserInstalledFonts const): (WebCore::FontDescription::setShouldAllowUserInstalledFonts): (WebCore::FontDescription::operator== const): (WebCore::FontDescription::mayRepresentUserInstalledFont const): Deleted. (WebCore::FontDescription::setMayRepresentUserInstalledFont): Deleted. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::singleton): (WebCore::FontDatabase::singletonAllowingUserInstalledFonts): (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts): (WebCore::FontDatabase::FontDatabase): (WebCore::platformFontLookupWithFamily): (WebCore::fontWithFamily): * platform/graphics/cocoa/FontCacheCoreText.h: Added. (WebCore::SynthesisPair::SynthesisPair): (WebCore::SynthesisPair::boldObliquePair const): * platform/text/TextFlags.h: * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): 2017-12-19 Youenn Fablet UserMediaRequest should stop a request when Document is being stopped https://bugs.webkit.org/show_bug.cgi?id=180962 Reviewed by Eric Carlson. Covered by fast/mediastream/destroy-document-while-enumerating-devices.html not crashing anymore under guardmalloc. Stopping to wait for the media stream to be active whenDocument goes away. * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::UserMediaRequest): (WebCore::UserMediaRequest::stop): (WebCore::UserMediaRequest::activeDOMObjectName const): (WebCore::UserMediaRequest::canSuspendForDocumentSuspension const): (WebCore::UserMediaRequest::contextDestroyed): Deleted. * Modules/mediastream/UserMediaRequest.h: 2017-12-19 Antti Koivisto Move first-letter building code to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=180992 Reviewed by Zalan Bujtas. All special case tree building logic should go to RenderTreeBuilder. - RenderTreeUpdater::FirstLetter -> RenderTreeBuilder::FirstLetter - Make the builder non-static and stop using RenderTreeBuilder::current() there. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/TextAutoSizing.cpp: (WebCore::TextAutoSizingValue::adjustTextNodeSizes): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::updateAfterDescendants): * rendering/updating/RenderTreeBuilder.h: (WebCore::RenderTreeBuilder::firstLetterBuilder): (WebCore::RenderTreeBuilder::tableBuilder): * rendering/updating/RenderTreeBuilderFirstLetter.cpp: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.cpp. (WebCore::supportsFirstLetter): (WebCore::RenderTreeBuilder::FirstLetter::FirstLetter): (WebCore::RenderTreeBuilder::FirstLetter::updateAfterDescendants): (WebCore::RenderTreeBuilder::FirstLetter::updateStyle): (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): (WebCore::updateFirstLetterStyle): Deleted. (WebCore::createFirstLetterRenderer): Deleted. (WebCore::RenderTreeUpdater::FirstLetter::update): Deleted. * rendering/updating/RenderTreeBuilderFirstLetter.h: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.h. * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateAfterDescendants): * rendering/updating/RenderTreeUpdater.h: * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Removed. * rendering/updating/RenderTreeUpdaterFirstLetter.h: Removed. 2017-12-19 Chris Dumez [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string https://bugs.webkit.org/show_bug.cgi?id=180991 Reviewed by Youenn Fablet. Extracting a body of type Blob should not set Content-Type to the empty string as per: - https://fetch.spec.whatwg.org/#concept-bodyinit-extract No new tests, rebaselined existing test. * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::extract): 2017-12-19 Commit Queue Unreviewed, rolling out r226094. https://bugs.webkit.org/show_bug.cgi?id=181012 No longer needed to build without error. (Requested by xenon on #webkit). Reverted changeset: "[GTK][WPE] Conditionalize libTASN1 use behind ENABLE_SUBTLE_CRYPTO in the CMake files" https://bugs.webkit.org/show_bug.cgi?id=180949 https://trac.webkit.org/changeset/226094 2017-12-19 Eric Carlson [MediaStream] Clean up RealtimeMediaSource interfaces https://bugs.webkit.org/show_bug.cgi?id=180934 Reviewed by Youenn Fablet. No new tests, updated http/tests/media/media-stream/disconnected-frame.html. Wrap video and audio constraints in a struct instead of passing both around as separate parameters. Cleanup up the interface to RealTimeMediaSourceCenter. * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::getUserMedia const): * Modules/mediastream/MediaDevicesRequest.cpp: (WebCore::MediaDevicesRequest::start): * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::create): (WebCore::UserMediaRequest::UserMediaRequest): (WebCore::UserMediaRequest::start): (WebCore::UserMediaRequest::allow): (WebCore::UserMediaRequest::contextDestroyed): * Modules/mediastream/UserMediaRequest.h: (WebCore::UserMediaRequest::request const): * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/CaptureDevice.h: (WebCore::CaptureDevice::persistentId const): (WebCore::CaptureDevice::label const): (WebCore::CaptureDevice::groupId const): (WebCore::CaptureDevice::type const): (WebCore::CaptureDevice::setPersistentId): Deleted. (WebCore::CaptureDevice::setLabel): Deleted. (WebCore::CaptureDevice::setGroupId): Deleted. (WebCore::CaptureDevice::setType): Deleted. * platform/mediastream/CaptureDeviceManager.cpp: (CaptureDeviceManager::getAudioSourcesInfo): Deleted. (CaptureDeviceManager::getVideoSourcesInfo): Deleted. (CaptureDeviceManager::deviceWithUID): Deleted. * platform/mediastream/CaptureDeviceManager.h: (WebCore::CaptureDeviceManager::captureDeviceWithPersistentID): (WebCore::CaptureDeviceManager::refreshCaptureDevices): * platform/mediastream/MediaStreamRequest.h: Copied from Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm. (WebCore::MediaStreamRequest::encode const): (WebCore::MediaStreamRequest::decode): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::createMediaStream): (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): * platform/mediastream/RealtimeMediaSourceCenter.h: * platform/mediastream/RealtimeMediaSourceSettings.h: * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm: (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h: * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm: (WebCore::AVAudioSessionCaptureDeviceManager::captureDevices): (WebCore::AVAudioSessionCaptureDeviceManager::captureDeviceWithPersistentID): * platform/mediastream/mac/AVCaptureDeviceManager.h: * platform/mediastream/mac/AVCaptureDeviceManager.mm: (WebCore::AVCaptureDeviceManager::captureDevicesInternal): (WebCore::AVCaptureDeviceManager::captureDevices): (WebCore::AVCaptureDeviceManager::refreshAVCaptureDevicesOfType): (WebCore::AVCaptureDeviceManager::refreshCaptureDevices): (WebCore::AVCaptureDeviceManager::deviceDisconnected): (WebCore::AVCaptureDeviceManager::getAudioSourcesInfo): Deleted. (WebCore::AVCaptureDeviceManager::getVideoSourcesInfo): Deleted. * platform/mediastream/mac/CoreAudioCaptureDevice.cpp: (WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice): * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: (WebCore::CoreAudioCaptureDeviceManager::captureDevices): (WebCore::CoreAudioCaptureDeviceManager::captureDeviceWithPersistentID): (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices): * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h: * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::MockRealtimeAudioSource::startProducingData): (WebCore::MockRealtimeAudioSource::createMuted): Deleted. * platform/mock/MockRealtimeAudioSource.h: * platform/mock/MockRealtimeMediaSource.cpp: (WebCore::deviceMap): (WebCore::MockRealtimeMediaSource::captureDeviceWithPersistentID): (WebCore::MockRealtimeMediaSource::audioDevices): (WebCore::MockRealtimeMediaSource::videoDevices): (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource): * platform/mock/MockRealtimeMediaSource.h: (WebCore::MockRealtimeMediaSource::device const): (WebCore::MockRealtimeMediaSource::deviceIndex): Deleted. * platform/mock/MockRealtimeMediaSourceCenter.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): (WebCore::MockRealtimeVideoSource::initializeCapabilities): (WebCore::MockRealtimeVideoSource::generateFrame): (WebCore::MockRealtimeVideoSource::createMuted): Deleted. * platform/mock/MockRealtimeVideoSource.h: 2017-12-19 Ryosuke Niwa Don't convert pasted content to use blob URL in WebKit1 https://bugs.webkit.org/show_bug.cgi?id=180969 Reviewed by Wenson Hsieh. Turns out that some WebKit1 clients are relying on being able to see the original URLs of the pasted content; e.g. not storing content referenced by HTTP/HTTPS protocol as opposed to local files. This patch restores the behavior prior to r223440 and r222839 for WebKit1 clients by overriding resources in DocumentLoader instead of converting URLs used in the pasted contents by blob URLs. In addition, this patch disables the pasteboard sanitization and custom data transfer types for WebKit1 clients as the feature poses a compatibility concern for WebKit1 clients. Tests: WebKitLegacy.AccessingImageInPastedRTFD WebKitLegacy.AccessingImageInPastedWebArchive * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragmentAndAddResources): (WebCore::WebContentReader::readWebArchive): * page/DeprecatedGlobalSettings.cpp: (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): 2017-12-19 Jer Noble Playing media elements which call "pause(); play()" will have the play promise rejected. https://bugs.webkit.org/show_bug.cgi?id=180781 Reviewed by Eric Carlson. Follow-up to address failing iOS API tests. Rather than skipping the call to prepareForLoad() in the case where media elements are not allowed to load data, unconditionally call prepareForLoad(), but conditionally call selectMediaResource() inside that function only if the media elemnet is allowed to load. This ensures that the MediaPlayer is created when play(), pause(), or load() are called during a user gesture later, and selectMediaResource() (which depends on having a non-null m_player) is called. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::parseAttribute): (WebCore::HTMLMediaElement::insertedIntoAncestor): (WebCore::HTMLMediaElement::load): (WebCore::HTMLMediaElement::prepareForLoad): (WebCore::HTMLMediaElement::playInternal): 2017-12-19 Timothy Hatcher Build failure in WebGL2 when Video feature is disabled https://bugs.webkit.org/show_bug.cgi?id=180946 Reviewed by Brian Burg. * html/canvas/WebGL2RenderingContext.h: Make TexImageSource conditional on ENABLE(VIDEO). * html/canvas/WebGL2RenderingContext.idl: Ditto. 2017-12-19 Chris Dumez scopeURL should start with the provided scriptURL https://bugs.webkit.org/show_bug.cgi?id=180983 Reviewed by Youenn Fablet. scopeURL should start with the provided scriptURL, as per: - https://w3c.github.io/ServiceWorker/#update (steps 7.8 to 7.18) No new tests, rebaselined existing tests. * platform/network/HTTPHeaderNames.in: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::didReceiveResponse): 2017-12-19 Zalan Bujtas [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableSection::addChild to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=180994 Reviewed by Antti Koivisto. This is in preparation for removing all tree mutation from renderering code. Covered by existing tests. * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): * rendering/updating/RenderTreeBuilderTable.cpp: (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild): * rendering/updating/RenderTreeBuilderTable.h: 2017-12-19 Daniel Bates Implement InlineTextBox painting using marker subranges https://bugs.webkit.org/show_bug.cgi?id=180984 Reviewed by David Hyatt. As a step towards implementing CSS Pseudo-Elements Module Level 4, explicitly decompose a text line into subrange objects that may be styled (say, to give the appearance of selected text) and painted. No functionality changed. So, no new tests. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::localSelectionRect const): Update comments. (WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const): (WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const): (WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange): Define a subclass to represent a marker subrange that has associated style information. We will make use of the style information when painting the subrange. (WebCore::createMarkerSubrangeFromSelectionInBox): Convenience function to instantiate a MarkerSubrange instance from the current selection of a specified text box. (WebCore::InlineTextBox::paint): Write in terms of MarkerSubrange. We keep composition backgrounds and composition underlines as special cases for now. We represent all other subranges of the line as MarkerSubrange instances, including unmarked text (i.e. non-selected text without an associated document marker). The subranges for the gaps between document markers and selection are implicitly created by subdividing the entire line. Support for PaintBehaviorExcludeSelection is implemented by subdividing the entire line with the selection subrange and then removing the selection subrange from the resulting list of subdivisions before painting with the resulting list. (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Renamed; formerly named paintDocumentMarkers. (WebCore::InlineTextBox::paintPlatformDocumentMarker): Renamed; formerly named paintDocumentMarker. (WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Convenience function to compute the style for unmarked text. (WebCore::InlineTextBox::resolveStyleForSubrange): Added (WebCore::InlineTextBox::subdivideAndResolveStyle): Subdivides the list of marker subranges and coalesces subranges of the same type (e.g. selection) or with the same style. The latter strategy preserves the optimization of drawing the text of the entire line in one draw command when we know that the selected text looks identical to non-selected text. This optimization was performed in TextPainter::paint(). (WebCore::InlineTextBox::collectSubrangesForDraggedContent): Added. (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Added. (WebCore::InlineTextBox::textOriginFromBoxRect const): Added. (WebCore::InlineTextBox::paintMarkerSubranges): (WebCore::InlineTextBox::paintTextSubrangeBackground): (WebCore::InlineTextBox::paintTextSubrangeForeground): (WebCore::InlineTextBox::paintTextSubrangeDecoration): Paint the marker subrange. (WebCore::InlineTextBox::paintCompositionBackground): Moved function to group it with the logic to paint composition underlines. Modified to pass clamped offsets to paintTextSubrangeBackground() as paintTextSubrangeBackground() now expects them. (WebCore::mirrorRTLSegment): Moved function to be above paintCompositionUnderline() as it is the only function that makes use of it. (WebCore::InlineTextBox::paintSelection): Deleted. (WebCore::InlineTextBox::paintTextMatchMarker): Deleted. (WebCore::InlineTextBox::paintDecoration): Deleted. (WebCore::InlineTextBox::paintDocumentMarker): Deleted; renamed to paintPlatformDocumentMarker. (WebCore::InlineTextBox::paintDocumentMarkers): Deleted; renamed to paintPlatformDocumentMarkers. * rendering/InlineTextBox.h: (WebCore::InlineTextBox::paintMarkerSubranges): Added. * rendering/MarkerSubrange.h: (WebCore::MarkerSubrange::isEmpty const): Added. (WebCore::MarkerSubrange::operator!= const): Added. (WebCore::MarkerSubrange::operator== const): Added. * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): Updated code as we no longer need to pass the text run length to TextPainter::paint(). Also modernize the code while I am here. * rendering/TextDecorationPainter.cpp: (WebCore::TextDecorationPainter::Styles::operator== const): Added. (WebCore::TextDecorationPainter::TextDecorationPainter): Modified to take an optional TextDecorationPainter::Styles instance as an argument and removed the unused parameter for PseudoId. * rendering/TextDecorationPainter.h: (WebCore::TextDecorationPainter::Styles::operator!= const): Added. * rendering/TextPaintStyle.cpp: (WebCore::TextPaintStyle::operator== const): Added. (WebCore::computeTextSelectionPaintStyle): Removed the now unused out-arguments paintSelectedTextOnly, paintSelectedTextSeparately, and paintNonSelectedTextOnly. The values stored in these out-arguments were intended to be used by the caller to minimize the number of drawing commands. The value of paintSelectedTextSeparately indicated whether selected text would look identical to non-selected text so that a caller could use one paint command to draw the entire line instead of issuing two or more drawing commands to paint non-selected and selected text separately. We now accomplish the same optimization by coalescing subrange styles in InlineTextBox::subdivideAndResolveStyle(). The value of paintNonSelectedTextOnly, as its name states, indicated whether a caller should only paint non-selected text and hence skip painting of selected text. This value was only used when painting dragged content (i.e. DocumentMarker::DraggedContent markers) and its effect is now more directly achieved by the dragged content logic in InlineTextBox::paint(). * rendering/TextPaintStyle.h: (WebCore::TextPaintStyle::operator!= const): Added. * rendering/TextPainter.cpp: (WebCore::TextPainter::paint): Implemented in terms TextPainter::paintRange() now that InlineTextBox::paint() optimizes for the number of drawing calls. See remarks for WebCore::computeTextSelectionPaintStyle() for more details. * rendering/TextPainter.h: Group together related member functions. (WebCore::TextPainter::setSelectionStyle): Deleted. (WebCore::TextPainter::setSelectionShadow): Deleted. 2017-12-19 Daniel Bates Add support for computing the frontmost longest effective marker subrange https://bugs.webkit.org/show_bug.cgi?id=180985 Reviewed by Dave Hyatt. Add a new subdivision overlap strategy to return the minimum list of maximal length non- overlapping subranges. We will make use of this strategy together with an algorithm to coalesce adjacent subranges with visually indistinct styles to minimize the total number of drawing commands needed to paint an entire line of text. We are not making use of this functionality now. We will make use of it to simplify the patch for . * rendering/MarkerSubrange.cpp: (WebCore::subdivide): * rendering/MarkerSubrange.h: 2017-12-19 Chris Dumez Handle Fetch should wait for the service worker's state to become activated https://bugs.webkit.org/show_bug.cgi?id=180959 Reviewed by Youenn Fablet. Handle Fetch should wait for the service worker's state to become activated when it is currently activating. Specification: - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (Step 16) No new tests, rebaselined existing test. * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::~SWServerWorker): (WebCore::SWServerWorker::whenActivated): (WebCore::SWServerWorker::setState): (WebCore::SWServerWorker::callWhenActivatedHandler): * workers/service/server/SWServerWorker.h: 2017-12-19 Yusuke Suzuki [YARR] Yarr should return ErrorCode instead of error messages (const char*) https://bugs.webkit.org/show_bug.cgi?id=180966 Reviewed by Mark Lam. Remove unnecessary String creation. No behavior change. * contentextensions/URLFilterParser.cpp: (WebCore::ContentExtensions::URLFilterParser::addPattern): 2017-12-19 Zalan Bujtas [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableRow::addChild to RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=180964 Reviewed by Antti Koivisto. This is in preparation for removing all tree mutation from renderering code. Covered by existing tests. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::insertChild): * rendering/updating/RenderTreeBuilder.h: * rendering/updating/RenderTreeBuilderTable.cpp: Added. (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild): * rendering/updating/RenderTreeBuilderTable.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h. 2017-12-19 Youenn Fablet Service Worker should not clean HTTP headers added by the application or by fetch specification before service worker interception https://bugs.webkit.org/show_bug.cgi?id=180939 Reviewed by Chris Dumez. Covered by modified WPT test. Add support to clean only specific headers in cleanHTTPRequestHeadersForAccessControl, renamed from cleanRedirectedRequestForAccessControl. Compute the list of headers to keep in DocumentThreadableLoader. Add a specific rule for Accept header which is set prior service worker interception and for HTTP headers set by DocumentThreadableLoader clients. * loader/CrossOriginAccessControl.cpp: (WebCore::httpHeadersToKeepFromCleaning): (WebCore::cleanRedirectedRequestForAccessControl): * loader/CrossOriginAccessControl.h: (WebCore::cleanRedirectedRequestForAccessControl): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): * loader/ResourceLoaderOptions.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/context/ServiceWorkerFetch.h: * workers/service/context/ServiceWorkerThread.cpp: (WebCore::ServiceWorkerThread::postFetchTask): * workers/service/context/ServiceWorkerThread.h: 2017-12-19 Andy Estes [Apple Pay] Stop maintaining a list of payment networks https://bugs.webkit.org/show_bug.cgi?id=180965 Reviewed by Tim Horton. Instead of maintaining the list of valid payment networks in WebCore, allow the client to provide the list when constructing a PaymentCoordinator. Then, use PaymentCoordinator's list to validate ApplePaySessionPaymentRequests. Validation will now be done case-insensitively since Cocoa clients will provide a list of network names that differ in capitalization from the names formerly accepted by WebCore. Added new test cases to http/tests/ssl/applepay/ApplePaySession.html. * Modules/applepay/ApplePayRequestBase.cpp: (WebCore::convertAndValidate): Changed to return a Vector of validated strings. (WebCore::validate): Renamed to convertAndValidate. * Modules/applepay/ApplePayRequestBase.h: * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): (WebCore::ApplePaySession::create): * Modules/applepay/ApplePaySessionPaymentRequest.cpp: (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork): Deleted. * Modules/applepay/ApplePaySessionPaymentRequest.h: * Modules/applepay/PaymentCoordinator.cpp: (WebCore::toHashSet): (WebCore::PaymentCoordinator::PaymentCoordinator): Converted availablePaymentNetworks to a case-insensitive HashSet and stored in m_availablePaymentNetworks. (WebCore::PaymentCoordinator::validatedPaymentNetwork const): Added special cases for "jcb" and "carteBancaire" for API compatibility. For other networks, checked m_availablePaymentNetworks. * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::show): * page/MainFrame.cpp: (WebCore::MainFrame::MainFrame): Constructed m_paymentCoordinator with configuration.availablePaymentNetworks. * page/PageConfiguration.h: * testing/Internals.cpp: (WebCore::Internals::Internals): * testing/MockPaymentCoordinator.cpp: * testing/MockPaymentCoordinator.h: 2017-12-19 Wenson Hsieh Unreviewed, try to fix the Windows build after r226097. * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::appendCustomAttributes): 2017-12-18 Andy Estes [Apple Pay] Only include phonetic name properties in ApplePayPaymentContact when version >= 3 https://bugs.webkit.org/show_bug.cgi?id=180925 Reviewed by Tim Horton. No tests possible. The fix involves converting PKContacts, which we can't create in our test harness. * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp: (WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent): * Modules/applepay/ApplePayPaymentAuthorizedEvent.h: * Modules/applepay/ApplePaySession.cpp: (WebCore::ApplePaySession::create): (WebCore::ApplePaySession::ApplePaySession): (WebCore::ApplePaySession::version const): (WebCore::ApplePaySession::didAuthorizePayment): (WebCore::ApplePaySession::didSelectShippingContact): * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp: (WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent): * Modules/applepay/ApplePayShippingContactSelectedEvent.h: * Modules/applepay/Payment.h: * Modules/applepay/PaymentContact.h: * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::supportsVersion const): (WebCore::PaymentCoordinator::supportsVersion): Deleted. * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentSession.h: * Modules/applepay/cocoa/PaymentCocoa.mm: (WebCore::convert): (WebCore::Payment::toApplePayPayment const): * Modules/applepay/cocoa/PaymentContactCocoa.mm: (WebCore::convert): (WebCore::PaymentContact::toApplePayPaymentContact const): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::document const): (WebCore::ApplePayPaymentHandler::paymentCoordinator const): (WebCore::ApplePayPaymentHandler::version const): (WebCore::ApplePayPaymentHandler::didAuthorizePayment): (WebCore::ApplePayPaymentHandler::didSelectShippingContact): (WebCore::ApplePayPaymentHandler::document): Deleted. (WebCore::ApplePayPaymentHandler::paymentCoordinator): Deleted. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: 2017-12-18 Wenson Hsieh [Attachment Support] The 'webkitattachmentbloburl' attribute should not persist after markup serialization https://bugs.webkit.org/show_bug.cgi?id=180924 Reviewed by Tim Horton. Work towards dragging Blob-backed attachment elements as files on iOS and Mac. It doesn't make sense for the attachment blob URL to stick around on the element after markup serialization, so this patch removes logic that eagerly sets the blob URL upon setting an attachment's File. Instead, we just append this attribute when generating markup. This patch also augments existing WKAttachmentTests to ensure that these attributes are not present. * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::appendCustomAttributes): (WebCore::createFragmentFromMarkup): * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::setFile): * rendering/HitTestResult.cpp: Fixes a related issue where an attachment is backed by Blob data (and not a file path) would specify "file:///" as its attachment file path in DragController when starting a drag. Instead, if there is no file path, fall back to the blob URL. This will be tested in a future patch once a WK2 dragging simulator for Mac is implemented, and support for dragging out Blob-backed attachments as (platform) files is implemented. (WebCore::HitTestResult::absoluteAttachmentURL const): 2017-12-18 Chris Dumez Default scope used when registering a service worker is wrong https://bugs.webkit.org/show_bug.cgi?id=180961 Reviewed by Youenn Fablet. The default scope we used when registering a service worker was wrong, it did not match: - https://w3c.github.io/ServiceWorker/#start-register (Step 4) This patch aligns our behavior with the specification. No new tests, rebaselined existing test. * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): 2017-12-18 Ryosuke Niwa Assertion hit in DocumentOrderedMap::get while removing a form element https://bugs.webkit.org/show_bug.cgi?id=137959 Reviewed by Brent Fulgham. The assertion failure was caused by FormAssociatedElement::findAssociatedForm calling TreeScope::getElementById for a form associated element inside FormAttributeTargetObserver::idTargetChanged during the removal of the owner form element, or the first non-form element with the matching ID. If there are other elements with the same ID in the removed tree at that moment, MapEntry's count for the ID can be higher than it needs to be since Element::removedFromAncestor has not been called on those elements yet. Fixed the bug by checking this condition explicitly. This patch introduces ContainerChildRemovalScope which keeps track of the container node from which a subtree was removed as well as the root of the removed subtree. DocumentOrderedMap::get then checks whether the matching element can be found in this removed subtree, and its isConnected() still returns true (the evidence that Element::removedFromAncestor has not been called) when count > 0 and there was no matching element in the tree scope. In the long term, we should refactor the way FormAssociatedElement and HTMLFormElement refers to each other and avoid calling DocumentOrderedMap::get before finish calling removedFromAncestor on the removed subtree. Tests: fast/forms/update-form-owner-in-moved-subtree-assertion-failure-5.html fast/forms/update-form-owner-in-moved-subtree-assertion-failure-6.html * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeRemoved): * dom/ContainerNodeAlgorithms.h: (WebCore::ContainerChildRemovalScope): Added. (WebCore::ContainerChildRemovalScope::ContainerChildRemovalScope): (WebCore::ContainerChildRemovalScope::~ContainerChildRemovalScope): (WebCore::ContainerChildRemovalScope::parentOfRemovedTree): (WebCore::ContainerChildRemovalScope::removedChild): (WebCore::ContainerChildRemovalScope::currentScope): * dom/DocumentOrderedMap.cpp: (WebCore::DocumentOrderedMap::get const): Added a special early exit when this function is called during a node removal. 2017-12-18 Timothy Hatcher [GTK][WPE] Conditionalize libTASN1 use behind ENABLE_SUBTLE_CRYPTO in the CMake files https://bugs.webkit.org/show_bug.cgi?id=180949 Reviewed by Carlos Alberto Lopez Perez. * PlatformGTK.cmake: Move the include path and library additions to conditional ENABLE_SUBTLE_CRYPTO section. * PlatformWPE.cmake: Ditto. 2017-12-18 Wenson Hsieh [Attachment Support] Support representing pasted or dropped content using attachment elements https://bugs.webkit.org/show_bug.cgi?id=180892 Reviewed by Tim Horton. Support dropping and pasting attributed strings that contain NSTextAttachments. Teaches replaceRichContentWithAttachmentsIfNecessary to replace object elements with attachments; see comments below for more details. Test: WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments * editing/WebContentReader.h: Add BlobReplacementInfo, which contains a map of blob URLs to replacement Blobs, as well as a map of blob URLs to replaced subresource URLs. (WebCore::BlobReplacementInfo::isEmpty const): * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::replaceSelectionWithAttributedString): * editing/cocoa/WebArchiveResourceFromNSAttributedString.h: * editing/cocoa/WebArchiveResourceFromNSAttributedString.mm: Implement -[WebArchiveResourceFromNSAttributedString MIMEType]. UIFoundation asks for -MIMEType in the process of generating markup from NSTextAttachments; this currently causes the web process to crash on an unrecognized selector. Additionally, work around , a UIFoundation bug in which all but a few hard-coded file extensions actually yield MIME types that are more specific than "application/octet-stream". This can safely be removed once is addressed. (-[WebArchiveResourceFromNSAttributedString MIMEType]): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachmentsIfNecessary): Try to replace object elements with attachments, and also tweak the title of the attachment's File to use the replaced subresource's filename if possible. Additionally, abstracts out information for replacing object or image elements (formerly a pair of { File, Element }) into a separate struct, and add a AttachmentDisplayMode parameter to determine whether the attachment should be presented in-line (in the case of images), or as an icon. (WebCore::attributesForAttributedStringConversion): Only exclude object elements from being generated from NSTextAttachments if the attachment element runtime feature is disabled, or !ENABLE(ATTACHMENT_ELEMENT). (WebCore::createFragmentAndAddResources): Additionally keep track of a mapping from blob URL => replaced subresource URL. In all the places where we previously only plumbed a map of blob URL => Blob, use a BlobReplacementInfo struct instead, which now includes a map from blob URL => replaced URL. (WebCore::sanitizeMarkupWithArchive): (WebCore::WebContentReader::readWebArchive): (WebCore::WebContentMarkupReader::readWebArchive): (WebCore::WebContentReader::readRTFD): (WebCore::WebContentMarkupReader::readRTFD): (WebCore::WebContentReader::readRTF): (WebCore::WebContentMarkupReader::readRTF): (WebCore::WebContentReader::readImage): 2017-12-18 Youenn Fablet Service worker served response tainting should keep its tainting https://bugs.webkit.org/show_bug.cgi?id=180952 Reviewed by Chris Dumez. Covered by rebased tests. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::setResponse): 2017-12-18 Wenson Hsieh Unreviewed, attempt to fix watch and TV builds after r226085 Explicitly include a header in WebContentReaderCocoa.mm. * editing/cocoa/WebContentReaderCocoa.mm: 2017-12-18 Brady Eidson Add ability to API test Service Workers via a custom protocol. https://bugs.webkit.org/show_bug.cgi?id=180911 Reviewed by Chris Dumez. Covered by API test ServiceWorkers.Basic This adds a set of "Service Workers can handle this" schemes to the scheme registry and uses it for SW decisions instead of a handful of previous techniques. * bindings/scripts/CodeGeneratorJS.pm: (NeedsRuntimeCheck): (GenerateRuntimeEnableConditionalString): * bindings/scripts/IDLAttributes.json: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::hasServiceWorkerScheme): * dom/ScriptExecutionContext.h: * page/NavigatorServiceWorker.idl: * platform/SchemeRegistry.cpp: (WebCore::serviceWorkerSchemesLock): (WebCore::serviceWorkerSchemes): (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle): (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme): (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme): * platform/SchemeRegistry.h: * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::runRegisterJob): 2017-12-18 Chris Dumez We should use "error" redirect mode for fetching service worker scripts https://bugs.webkit.org/show_bug.cgi?id=180950 Reviewed by Youenn Fablet. We should use "error" redirect mode for fetching service worker scripts, as per: - https://w3c.github.io/ServiceWorker/#update (Step 7.5) No new tests, rebaselined existing test. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): * workers/Worker.cpp: (WebCore::Worker::create): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): * workers/WorkerScriptLoader.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): 2017-12-18 Chris Dumez ExtendableMessageEvent constructor fails to initialize the 'source' attribute https://bugs.webkit.org/show_bug.cgi?id=180954 Reviewed by Youenn Fablet. No new tests, rebaselined existing test. * workers/service/ExtendableMessageEvent.cpp: (WebCore::ExtendableMessageEvent::ExtendableMessageEvent): 2017-12-18 Wenson Hsieh [Attachment Support] Insert images as inline attachments when pasting and dropping https://bugs.webkit.org/show_bug.cgi?id=180853 Reviewed by Tim Horton. Adds support for transforming dropped and pasted web content fragments prior to insertion, such that inline elements (so far, only images) are replaced with attachment elements that have an inline representation. See below comments for more detail. Tests: WKAttachmentTests.InsertPastedImageAsAttachment WKAttachmentTests.InsertPastedAttributedStringContainingImage WKAttachmentTestsMac.InsertPastedFileURLsAsAttachments WKAttachmentTestsIOS.InsertDroppedImageAsAttachment WKAttachmentTestsIOS.InsertDroppedAttributedStringContainingAttachment * editing/WebContentReader.h: * editing/cocoa/EditorCocoa.mm: (WebCore::Editor::replaceSelectionWithAttributedString): Add a new helper to replace elements in a DOM fragment with inline attachment elements instead, using the given Blobs. So far, we only replace image elements with these attachments, by mapping the source of each image to a Blob, and constructing a replacement attachment backed by a File constructed from the image's corresponding Blob. However, this mechanism can be generalized in the future to handle transformations from arbitrary elements to attachment elements capable of representing the same elements using inline display mode. This function is a noop if the attachment elements are disabled via runtime-enabled features. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::replaceRichContentWithAttachmentsIfNecessary): (WebCore::createFragmentAndAddResources): (WebCore::sanitizeMarkupWithArchive): Add out-params to both of these helper functions that capture the map of blob URLs to Blobs being used to replace subresource URLs in the pasted/dropped DOM fragment. (WebCore::WebContentReader::readWebArchive): (WebCore::WebContentMarkupReader::readWebArchive): (WebCore::createFragmentFromAttributedString): (WebCore::WebContentReader::readRTFD): (WebCore::WebContentMarkupReader::readRTFD): (WebCore::WebContentReader::readRTF): (WebCore::WebContentMarkupReader::readRTF): (WebCore::WebContentReader::readImage): In these places where we swap out subresource URLs for blob URLs, collect a map of blob URL => Blob, and use it to replace images in the DOM with attachments (if needed, and possible). * editing/mac/WebContentReaderMac.mm: (WebCore::WebContentReader::readFilenames): Augment existing logic to generate attachment elements when pasting or dropping file URLs, so that the generated attachment elements also have titles, subtitles, and content type information. * html/HTMLAttachmentElement.cpp: (WebCore::HTMLAttachmentElement::setFile): Add an optional second param, UpdateDisplayAttributes. If UpdateDisplayAttributes::Yes is passed in, then we set the elements's attributes that are displayed in the attachment representation (title, subtitle, and type) using the given File. (WebCore::HTMLAttachmentElement::updateFileWithData): (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary): Make a small tweak to correctly handle the case where an attachment with a content type that is a UTI is being displayed inline. Content type can either be a UTI or a MIME type, but the code to construct the shadow tree of an attachment element only handles MIME types. * html/HTMLAttachmentElement.h: 2017-12-18 Youenn Fablet SameOrigin and CORS fetch should fail on opaque responses served from ServiceWorker https://bugs.webkit.org/show_bug.cgi?id=180941 Reviewed by Chris Dumez. Covered by rebased tests. * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): 2017-12-18 Dean Jackson Make some functions in GraphicsContextCG use call_once for statics https://bugs.webkit.org/show_bug.cgi?id=180841 Reviewed by Antoine Quint. In preparation for making OffscreenCanvas operate inside a Worker, make sure GraphicsContext is thread safe. Change some functions that use a static to call_once. * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::sRGBColorSpaceRef): (WebCore::linearRGBColorSpaceRef): (WebCore::extendedSRGBColorSpaceRef): (WebCore::displayP3ColorSpaceRef): 2017-12-18 Chris Dumez ExtendableMessageEvent.data should return the value it was initialized to https://bugs.webkit.org/show_bug.cgi?id=180868 Reviewed by Geoffrey Garen. No new tests, rebaselined existing test. * bindings/js/JSExtendableMessageEventCustom.cpp: (WebCore::constructJSExtendableMessageEvent): * workers/service/ExtendableMessageEvent.cpp: (WebCore::ExtendableMessageEvent::ExtendableMessageEvent): * workers/service/ExtendableMessageEvent.idl: 2017-12-18 Megan Gardner Support Autoscrolling in contenteditable for WK2 https://bugs.webkit.org/show_bug.cgi?id=180789 Reviewed by Simon Frasier and Wenson Hsieh.. Activate the autoscrollController to scroll to the position provided to us by the UIProcess. Allows for scrolling in contentEditable for WebKit2 Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html * page/AutoscrollController.cpp: (WebCore::AutoscrollController::autoscrollTimerFired): * page/EventHandler.cpp: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startTextAutoscroll): (WebCore::EventHandler::cancelTextAutoscroll): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. 2017-12-18 Youenn Fablet Add support for response blob given to fetch events https://bugs.webkit.org/show_bug.cgi?id=180894 Reviewed by Darin Adler. Covered by updated test expectations. Adding support for getting a blob URL from a FormData that only contains one blob. Adding support to create a FetcLoader from a ServiceWorkerThreadProxy * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::start): (WebCore::FetchLoader::startLoadingBlobURL): * Modules/fetch/FetchLoader.h: * WebCore.xcodeproj/project.pbxproj: * platform/network/FormData.cpp: (WebCore::FormData::asBlobURL const): * platform/network/FormData.h: * workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::createBlobLoader): * workers/service/context/ServiceWorkerThreadProxy.h: 2017-12-18 Zalan Bujtas [SVG] Detach list wrappers before resetting the base value. https://bugs.webkit.org/show_bug.cgi?id=180912 Reviewed by Simon Fraser. Before resetting the animation value (and destroying the assigned SVG object -SVGLengthValue in this case), we need to check if there's an associated tear off wrapper for the said SVG object and make a copy of it. This is currently done in the wrong order through animValDidChange. Test: svg/animations/crash-when-animation-is-running-while-getting-value.html * svg/SVGAnimatedTypeAnimator.h: (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue): * svg/properties/SVGAnimatedPropertyTearOff.h: * svg/properties/SVGAnimatedStaticPropertyTearOff.h: (WebCore::SVGAnimatedStaticPropertyTearOff::synchronizeWrappersIfNeeded): 2017-12-18 Brady Eidson REGRESSION: ASSERTION FAILED: !m_importCompleted https://bugs.webkit.org/show_bug.cgi?id=180935 Unreviewed bot gardening. No new tests (Covered by existing tests) The ASSERT was invalid for database pushes failing to open databases like this, so skip it for that scenario. * workers/service/server/RegistrationStore.cpp: (WebCore::RegistrationStore::databaseFailedToOpen): * workers/service/server/SWServer.cpp: (WebCore::SWServer::registrationStoreDatabaseFailedToOpen): * workers/service/server/SWServer.h: 2017-12-18 Jer Noble Playing media elements which call "pause(); play()" will have the play promise rejected. https://bugs.webkit.org/show_bug.cgi?id=180781 Reviewed by Eric Carlson. Test: media/video-pause-play-resolve.html When scheduling a rejection or resolution of existing play promises, move() the existing promises into the block. This ensures that valid promises aren't added to the play promise vector between when a rejection is scheduled and when it runs. Drive-by fix: Don't return false from playInternal() just so the newly created promise will get rejected. The pause() command will reject the promise, so just make sure it's added to the m_pendingPlayPromises before calling playInternal(). Drive-by fix #2: The spec referenced by playInternal() and pauseInternal() doesn't say to call the "Media Element Load Algorithm" (i.e., prepareForLoad()); it says to call the "Resource Selection Algorithm" (i.e., selectMediaResource()). But fixing this bug caused an assertion crash when the resource selection task was fired and m_player was null. This was because the algorithm is being run at stop() time due to stop() calling pause(). The solution to this ASSERT is to stop the m_resourceSelectionTaskQueue in stop(). * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises): (WebCore::HTMLMediaElement::rejectPendingPlayPromises): (WebCore::HTMLMediaElement::resolvePendingPlayPromises): (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying): (WebCore::HTMLMediaElement::notifyAboutPlaying): (WebCore::HTMLMediaElement::noneSupported): (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks): (WebCore::HTMLMediaElement::play): (WebCore::HTMLMediaElement::playInternal): (WebCore::HTMLMediaElement::pauseInternal): (WebCore::HTMLMediaElement::stop): * html/HTMLMediaElement.h: 2017-12-18 Daniel Bates Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession: https://bugs.webkit.org/show_bug.cgi?id=180774 Reviewed by Tim Horton. Expose a way for an embedding client to query for the auto fill button type of a specific input element as it may not be feasible for a client to track such state themselves. For similar reasons track and expose SPI to query for the last auto fill button type for a specific field. Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::HTMLInputElement): (WebCore::HTMLInputElement::setShowAutoFillButton): Update the last auto fill button type. * html/HTMLInputElement.h: (WebCore::HTMLInputElement::lastAutoFillButtonType const): Added. * testing/Internals.cpp: (WebCore::toAutoFillButtonType): (WebCore::toInternalsAutoFillButtonType): (WebCore::Internals::autoFillButtonType): (WebCore::Internals::lastAutoFillButtonType): * testing/Internals.h: * testing/Internals.idl: Add functions for testing. 2017-12-17 John Wilander Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process https://bugs.webkit.org/show_bug.cgi?id=180681 Reviewed by Alex Christensen. Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html This change makes an asynchronous request to the network process to see if storage access has been granted for this frame, on this page, for this domain. * dom/Document.cpp: (WebCore::Document::hasStorageAccess): * page/ChromeClient.h: 2017-12-17 Chris Dumez Strip fragment identifier from ServiceWorker's scriptURL https://bugs.webkit.org/show_bug.cgi?id=180887 Reviewed by Darin Adler. Strip fragment identifier from ServiceWorker's scriptURL to match Firefox and Chrome. This behavior does not appear to be specified so I filed: - https://github.com/w3c/ServiceWorker/issues/1249 No new tests, rebaselined existing test. * workers/service/server/SWServerWorker.cpp: (WebCore::m_script): 2017-12-17 Antti Koivisto Move render tree updating related files under rendering/updating/ https://bugs.webkit.org/show_bug.cgi?id=180918 Reviewed by Darin Adler. * CMakeLists.txt: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/RenderTreeBuilder.cpp: Removed. * rendering/RenderTreeBuilder.h: Removed. * rendering/updating: Added. * rendering/updating/RenderTreeBuilder.cpp: Copied from Source/WebCore/rendering/RenderTreeBuilder.cpp. * rendering/updating/RenderTreeBuilder.h: Copied from Source/WebCore/rendering/RenderTreeBuilder.h. * rendering/updating/RenderTreePosition.cpp: Copied from Source/WebCore/style/RenderTreePosition.cpp. * rendering/updating/RenderTreePosition.h: Copied from Source/WebCore/style/RenderTreePosition.h. * rendering/updating/RenderTreeUpdater.cpp: Copied from Source/WebCore/style/RenderTreeUpdater.cpp. * rendering/updating/RenderTreeUpdater.h: Copied from Source/WebCore/style/RenderTreeUpdater.h. * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp. * rendering/updating/RenderTreeUpdaterFirstLetter.h: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.h. * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp. * rendering/updating/RenderTreeUpdaterGeneratedContent.h: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h. * rendering/updating/RenderTreeUpdaterListItem.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.cpp. * rendering/updating/RenderTreeUpdaterListItem.h: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.h. * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp. * rendering/updating/RenderTreeUpdaterMultiColumn.h: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.h. * style/RenderTreePosition.cpp: Removed. * style/RenderTreePosition.h: Removed. * style/RenderTreeUpdater.cpp: Removed. * style/RenderTreeUpdater.h: Removed. * style/RenderTreeUpdaterFirstLetter.cpp: Removed. * style/RenderTreeUpdaterFirstLetter.h: Removed. * style/RenderTreeUpdaterGeneratedContent.cpp: Removed. * style/RenderTreeUpdaterGeneratedContent.h: Removed. * style/RenderTreeUpdaterListItem.cpp: Removed. * style/RenderTreeUpdaterListItem.h: Removed. * style/RenderTreeUpdaterMultiColumn.cpp: Removed. * style/RenderTreeUpdaterMultiColumn.h: Removed. 2017-12-17 Yusuke Suzuki [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT https://bugs.webkit.org/show_bug.cgi?id=180917 Reviewed by Sam Weinig. Remove VM reference in CSSJIT. CSSJIT should not be bound to a specific VM. No behavior change. * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::ruleMatches): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::compileSelector): * cssjit/SelectorCompiler.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::compileSelector): (WebCore::SelectorDataList::execute const): * dom/SelectorQuery.h: 2017-12-16 Dan Bernstein WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:] https://bugs.webkit.org/show_bug.cgi?id=180613 Reviewed by Geoff Garen. Test: TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm * platform/ScrollView.h: Exported setScrollbarModes. 2017-12-16 Antti Koivisto Introduce RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=180817 Reviewed by Zalan Bujtas. RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous renderers. Renderer subtype specific render tree construction code will eventually move there. This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations. Future patches can then mechanically move the building code from renderers to RenderTreeBuilder. It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild) to RenderTreeBuilder as a test. * WebCore.xcodeproj/project.pbxproj: * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addChildToContinuation): (WebCore::RenderBlock::addChild): (WebCore::RenderBlock::addChildIgnoringContinuation): * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::addChild): * rendering/RenderBlockFlow.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildTo): * rendering/RenderButton.cpp: (WebCore::RenderButton::addChild): (WebCore::RenderButton::setText): * rendering/RenderButton.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::addChild): * rendering/RenderElement.h: (WebCore::RenderElement::addChildIgnoringContinuation): * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::wrapNewRenderer): (WebCore::RenderFullScreen::wrapExistingRenderer): (WebCore::RenderFullScreen::unwrapRenderer): (WebCore::RenderFullScreen::createPlaceholder): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::addChild): * rendering/RenderGrid.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::addChild): (WebCore::RenderInline::addChildIgnoringContinuation): (WebCore::RenderInline::splitInlines): (WebCore::RenderInline::splitFlow): (WebCore::RenderInline::addChildToContinuation): (WebCore::RenderInline::childBecameNonInline): * rendering/RenderInline.h: * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::createInnerBlock): (RenderMenuList::addChild): (RenderMenuList::setText): * rendering/RenderMenuList.h: * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::updateTextRenderer): (WebCore::RenderQuote::updateRenderer): * rendering/RenderQuote.h: * rendering/RenderRuby.cpp: (WebCore::RenderRubyAsInline::addChild): (WebCore::RenderRubyAsBlock::addChild): * rendering/RenderRuby.h: * rendering/RenderRubyBase.h: * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::rubyBaseSafe): (WebCore::RenderRubyRun::addChild): Deleted. * rendering/RenderRubyRun.h: * rendering/RenderTable.cpp: (WebCore::RenderTable::addChild): * rendering/RenderTable.h: * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): * rendering/RenderTableRow.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addChild): * rendering/RenderTableSection.h: * rendering/RenderTreeBuilder.cpp: Added. (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::~RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::rubyRunInsertChild): * rendering/RenderTreeBuilder.h: Added. (WebCore::RenderTreeBuilder::current): * rendering/TextAutoSizing.cpp: (WebCore::TextAutoSizingValue::adjustTextNodeSizes): * rendering/mathml/RenderMathMLFenced.cpp: (WebCore::RenderMathMLFenced::updateFromElement): (WebCore::RenderMathMLFenced::makeFences): (WebCore::RenderMathMLFenced::addChild): * rendering/mathml/RenderMathMLFenced.h: * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::addChild): * rendering/svg/RenderSVGContainer.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::addChild): * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::addChild): * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::addChild): * rendering/svg/RenderSVGText.h: * style/RenderTreePosition.cpp: (WebCore::RenderTreePosition::insert): Deleted. * style/RenderTreePosition.h: (WebCore::RenderTreePosition::RenderTreePosition): (WebCore::RenderTreePosition::nextSibling const): (WebCore::RenderTreePosition::canInsert const): Deleted. * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateAfterDescendants): (WebCore::RenderTreeUpdater::createRenderer): (WebCore::RenderTreeUpdater::createTextRenderer): (WebCore::RenderTreeUpdater::updateTextRenderer): (WebCore::createTextRenderer): Deleted. * style/RenderTreeUpdater.h: * style/RenderTreeUpdaterFirstLetter.cpp: (WebCore::updateFirstLetterStyle): (WebCore::createFirstLetterRenderer): * style/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo): (WebCore::createContentRenderers): (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): * style/RenderTreeUpdaterListItem.cpp: (WebCore::RenderTreeUpdater::ListItem::updateMarker): * style/RenderTreeUpdaterListItem.h: * style/RenderTreeUpdaterMultiColumn.cpp: (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow): 2017-12-16 Romain Bellessort [Readable Streams API] Fix filling of descriptor from queue https://bugs.webkit.org/show_bug.cgi?id=172717 Reviewed by Youenn Fablet. Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented, spec comprised a bug and code was not reachable. Spec has now been fixed and code can now be reached. [1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue No new tests (covered by WPT tests, whose expectations have been updated). * Modules/streams/ReadableByteStreamInternals.js: (readableByteStreamControllerFillDescriptorFromQueue): Updated. 2017-12-16 Brady Eidson Implement getting ServiceWorker registrations for the WKWebsiteDataStore API https://bugs.webkit.org/show_bug.cgi?id=180886 Reviewed by Chris Dumez. No new tests (API test coming soon). * workers/service/server/SWServer.cpp: (WebCore::SWServer::registrationStoreImportComplete): (WebCore::SWServer::SWServer): (WebCore::SWServer::getOriginsWithRegistrations): (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks): * workers/service/server/SWServer.h: 2017-12-16 Yusuke Suzuki Remove unnecessary boolean result of start() functions https://bugs.webkit.org/show_bug.cgi?id=180856 Reviewed by Darin Adler. No behavior change. * Modules/webaudio/AsyncAudioDecoder.cpp: (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder): * Modules/webdatabase/DatabaseContext.cpp: (WebCore::DatabaseContext::databaseThread): * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::start): Now `Thread::create` always succeeds (if it fails, WebKit crashes). DatabaseThread::start() now always returns true. So, we do not need to return bool. * Modules/webdatabase/DatabaseThread.h: * platform/network/curl/CurlDownload.cpp: (WebCore::CurlDownload::start): * platform/network/curl/CurlDownload.h: * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::start): * platform/network/curl/ResourceHandleCurlDelegate.cpp: (WebCore::ResourceHandleCurlDelegate::start): * platform/network/curl/ResourceHandleCurlDelegate.h: 2017-12-16 Chris Dumez Add optimization when updating a SW registration results in the exact same script https://bugs.webkit.org/show_bug.cgi?id=180891 Reviewed by Geoffrey Garen. Add optimization when updating a SW registration results in the exact same script: - https://w3c.github.io/ServiceWorker/#update-algorithm (step 8) No new tests, rebaselined existing test. * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::scriptFetchFinished): 2017-12-16 Youenn Fablet Service worker script fetch request should set the Service-Worker header https://bugs.webkit.org/show_bug.cgi?id=180889 Reviewed by Chris Dumez. Test: http/wpt/service-workers/check-service-worker-header.https.html Update WorkerScriptLoader to take a request instead of an URL. Updates Worker implementation and use it in ServiceWorkerJob to set the missing request header. * workers/Worker.cpp: (WebCore::Worker::create): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadAsynchronously): * workers/WorkerScriptLoader.h: * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): 2017-12-15 Ryan Haddad Unreviewed, rolling out r225969. This change introduced LayoutTest crashes. Reverted changeset: "Introduce RenderTreeBuilder" https://bugs.webkit.org/show_bug.cgi?id=180817 https://trac.webkit.org/changeset/225969 2017-12-15 Chris Dumez Support updating a service worker registration's updateViaCache flag https://bugs.webkit.org/show_bug.cgi?id=180888 Reviewed by Brady Eidson. Support updating a service worker registration's updateViaCache flag to match other browsers: - https://github.com/w3c/ServiceWorker/issues/1189 No new tests, rebaselined existing test. * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::setRegistrationUpdateViaCache): * workers/service/SWClientConnection.h: * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::setUpdateViaCache): * workers/service/ServiceWorkerRegistration.h: * workers/service/server/SWServer.h: * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::runRegisterJob): * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::setUpdateViaCache): * workers/service/server/SWServerRegistration.h: 2017-12-15 Ryan Haddad Unreviewed, rolling out r225941. This change introduced LayoutTest crashes and assertion failures. Reverted changeset: "Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic" https://bugs.webkit.org/show_bug.cgi?id=180770 https://trac.webkit.org/changeset/225941 2017-12-15 Ryosuke Niwa Add a release assert that Timer::m_wasDeleted is false in setNextFireTime https://bugs.webkit.org/show_bug.cgi?id=180860 Reviewed by David Kilzer. Turn an exist debug-only assertion into a release assertion to help diagnose a crash which appears to be caused by a freed timer getting scheduled back into the timer heap. * platform/Timer.cpp: (WebCore::TimerBase::~TimerBase): (WebCore::TimerBase::setNextFireTime): * platform/Timer.h: 2017-12-15 Simon Fraser Elements animated on-screen are missing sometimes https://bugs.webkit.org/show_bug.cgi?id=180773 rdar://problem/34923438 Reviewed by Zalan Bujtas. After r225310 it was still possible for elements to be missing backing store when brought on-screen via an animation. This occurred if a child element was outside the bounds of the element being animated. Fix by making sure that GraphicsLayer's "animatedExtent" took composited child layers into account. As for r225310, no test because this is timing sensitive and hard to reliably make a test for. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGeometry): 2017-12-15 Chris Dumez imported/w3c/web-platform-tests/service-workers/service-worker/update.https.html is sometimes crashing in Debug builds https://bugs.webkit.org/show_bug.cgi?id=180867 Reviewed by Brady Eidson. Fix assertion to make sure the worker is terminating if it is already in m_runningOrTerminatingWorkers. * workers/service/server/SWServer.cpp: (WebCore::SWServer::runServiceWorker): 2017-12-15 Chris Dumez Service Worker Registration promise is sometimes not rejected when the script load fails https://bugs.webkit.org/show_bug.cgi?id=180849 Reviewed by Brady Eidson. Service Worker Registration promise is sometimes not rejected when the script load fails. This was caused by the ServiceWorkerJob sometimes passing a null ResourceError to the StorageProcess, even though the load failed. No new tests, rebaselined exisiting tests. * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::notifyError): * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::notifyFinished): 2017-12-15 Youenn Fablet WebRTC Stats should not be console logged from a background thread https://bugs.webkit.org/show_bug.cgi?id=180845 Reviewed by Eric Carlson. Ensuring console log are done in the main thread. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): 2017-12-15 Antti Koivisto Introduce RenderTreeBuilder https://bugs.webkit.org/show_bug.cgi?id=180817 Reviewed by Zalan Bujtas. RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous renderers. Renderer subtype specific render tree construction code will eventually move there. This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations. Future patches can then mechanically move the building code from renderers to RenderTreeBuilder. It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild) to RenderTreeBuilder as a test. * WebCore.xcodeproj/project.pbxproj: * rendering/RenderBlock.cpp: (WebCore::RenderBlock::addChildToContinuation): (WebCore::RenderBlock::addChild): (WebCore::RenderBlock::addChildIgnoringContinuation): * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::addChild): * rendering/RenderBlockFlow.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildTo): * rendering/RenderButton.cpp: (WebCore::RenderButton::addChild): (WebCore::RenderButton::setText): * rendering/RenderButton.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::addChild): * rendering/RenderElement.h: (WebCore::RenderElement::addChildIgnoringContinuation): * rendering/RenderFullScreen.cpp: (WebCore::RenderFullScreen::wrapNewRenderer): (WebCore::RenderFullScreen::wrapExistingRenderer): (WebCore::RenderFullScreen::unwrapRenderer): (WebCore::RenderFullScreen::createPlaceholder): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::addChild): * rendering/RenderGrid.h: * rendering/RenderInline.cpp: (WebCore::RenderInline::addChild): (WebCore::RenderInline::addChildIgnoringContinuation): (WebCore::RenderInline::splitInlines): (WebCore::RenderInline::splitFlow): (WebCore::RenderInline::addChildToContinuation): (WebCore::RenderInline::childBecameNonInline): * rendering/RenderInline.h: * rendering/RenderMenuList.cpp: (WebCore::RenderMenuList::createInnerBlock): (RenderMenuList::addChild): (RenderMenuList::setText): * rendering/RenderMenuList.h: * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant): * rendering/RenderQuote.cpp: (WebCore::RenderQuote::updateTextRenderer): (WebCore::RenderQuote::updateRenderer): * rendering/RenderQuote.h: * rendering/RenderRuby.cpp: (WebCore::RenderRubyAsInline::addChild): (WebCore::RenderRubyAsBlock::addChild): * rendering/RenderRuby.h: * rendering/RenderRubyBase.h: * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::rubyBaseSafe): (WebCore::RenderRubyRun::addChild): Deleted. * rendering/RenderRubyRun.h: * rendering/RenderTable.cpp: (WebCore::RenderTable::addChild): * rendering/RenderTable.h: * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::addChild): * rendering/RenderTableRow.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addChild): * rendering/RenderTableSection.h: * rendering/RenderTreeBuilder.cpp: Added. (WebCore::RenderTreeBuilder::RenderTreeBuilder): (WebCore::RenderTreeBuilder::~RenderTreeBuilder): (WebCore::RenderTreeBuilder::insertChild): (WebCore::RenderTreeBuilder::rubyRunInsertChild): * rendering/RenderTreeBuilder.h: Added. (WebCore::RenderTreeBuilder::current): * rendering/TextAutoSizing.cpp: (WebCore::TextAutoSizingValue::adjustTextNodeSizes): * rendering/mathml/RenderMathMLFenced.cpp: (WebCore::RenderMathMLFenced::updateFromElement): (WebCore::RenderMathMLFenced::makeFences): (WebCore::RenderMathMLFenced::addChild): * rendering/mathml/RenderMathMLFenced.h: * rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::addChild): * rendering/svg/RenderSVGContainer.h: * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::addChild): * rendering/svg/RenderSVGInline.h: * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::addChild): * rendering/svg/RenderSVGRoot.h: * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::addChild): * rendering/svg/RenderSVGText.h: * style/RenderTreePosition.cpp: (WebCore::RenderTreePosition::insert): Deleted. * style/RenderTreePosition.h: (WebCore::RenderTreePosition::RenderTreePosition): (WebCore::RenderTreePosition::nextSibling const): (WebCore::RenderTreePosition::canInsert const): Deleted. * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateAfterDescendants): (WebCore::RenderTreeUpdater::createRenderer): (WebCore::RenderTreeUpdater::createTextRenderer): (WebCore::RenderTreeUpdater::updateTextRenderer): (WebCore::createTextRenderer): Deleted. * style/RenderTreeUpdater.h: * style/RenderTreeUpdaterFirstLetter.cpp: (WebCore::updateFirstLetterStyle): (WebCore::createFirstLetterRenderer): * style/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo): (WebCore::createContentRenderers): (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): * style/RenderTreeUpdaterListItem.cpp: (WebCore::RenderTreeUpdater::ListItem::updateMarker): * style/RenderTreeUpdaterListItem.h: * style/RenderTreeUpdaterMultiColumn.cpp: (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow): 2017-12-14 Youenn Fablet Implement . https://bugs.webkit.org/show_bug.cgi?id=178398 Reviewed by Eric Carlson. Use the decode-order sample cursor rather than the destination sample cursor when generating the CMSampleBuffer to decode. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex): 2017-10-17 Ryan Haddad Unreviewed, rolling out r223459. This change introduced LayoutTest failures. Reverted changeset: "WebGL clamps drawingBufferWidth to 4096 pixels on a 5120 monitor/canvas" https://bugs.webkit.org/show_bug.cgi?id=178223 https://trac.webkit.org/changeset/223459 2017-10-17 Youenn Fablet Add preliminary support for fetch event https://bugs.webkit.org/show_bug.cgi?id=178171 Reviewed by Chris Dumez. Test: http/wpt/service-workers/fetchEvent.https.html http/wpt/service-workers/extendableEvent.https.html Adding support for ExtendableEvent and FetchEvent as per https://w3c.github.io/ServiceWorker/v1/#extendableevent-interface and https://w3c.github.io/ServiceWorker/v1/#fetchevent-interface. Both events need to handle promises as method parameters. Beefing up DOMPromise for that purpose by exposing status, result and being able to call then. Adding a new DOMPromise create method that would be the base for https://heycam.github.io/webidl/#es-promise which might be implemented in the binding generator as a follow-up. This patch makes them exposed on Window for test purposes until they can be fully tested on ServiceWorker environment. It is also adding two internal methods for the same reason. These should be removed once events can be tested in its environment. * CMakeLists.txt: * DerivedSources.make: * Modules/fetch/FetchResponse.idl: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMPromise.cpp: Added. (WebCore::callFunction): (WebCore::DOMPromise::create): (WebCore::DOMPromise::whenSettled): (WebCore::DOMPromise::result const): (WebCore::DOMPromise::status const): * bindings/js/JSDOMPromise.h: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.in: * testing/Internals.cpp: (WebCore::Internals::waitFetchEventToFinish): (WebCore::Internals::waitExtendableEventToFinish): * testing/Internals.h: * testing/Internals.idl: * workers/service/ExtendableEvent.cpp: Added. (WebCore::ExtendableEvent::ExtendableEvent): (WebCore::ExtendableEvent::waitUntil): (WebCore::ExtendableEvent::addPendingPromise): * workers/service/ExtendableEvent.h: (WebCore::ExtendableEvent::onFinishedWaiting): (WebCore::ExtendableEvent::promiseSettled): * workers/service/ExtendableEvent.idl: Added. * workers/service/ExtendableEventInit.h: Added. * workers/service/ExtendableEventInit.idl: Added. * workers/service/FetchEvent.cpp: Added. (WebCore::FetchEvent::FetchEvent): (WebCore::FetchEvent::respondWith): (WebCore::FetchEvent::onResponse): (WebCore::FetchEvent::respondWithError): (WebCore::FetchEvent::processResponse): (WebCore::FetchEvent::promiseSettled): * workers/service/FetchEvent.h: * workers/service/FetchEvent.idl: 2017-10-17 Jer Noble Leak of one AVSampleCursor inside ImageDecoderAVFObjC::createFrameImageAtIndex() https://bugs.webkit.org/show_bug.cgi?id=178397 Reviewed by Eric Carlson. Explicitly wrap the return value of -copy in a RetainPtr. * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex): 2017-10-17 Youenn Fablet Cache API implementation should be able to compute storage size for WebKit client applications. https://bugs.webkit.org/show_bug.cgi?id=178350 Reviewed by Chris Dumez. * page/SecurityOriginData.h: (WebCore::SecurityOriginData::equals const): 2017-10-17 Daniel Bates ASSERTION FAILED: m_truncation != cFullTruncation in InlineTextBox::clampedOffset() https://bugs.webkit.org/show_bug.cgi?id=178322 Reviewed by Darin Adler. It is acceptable for InlineTextBox::clampedOffset() to be called for a fully truncated box, say a person clicks on the ellipsis in a truncated text run. Restore the behavior prior to r223259 and return the clamped offset. Test: fast/text/click-ellipsis-assertion-failure.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::clampedOffset const): 2017-10-17 Daniel Bates REGRESSION (r222670 and r222732): RTL truncated text may not be drawn https://bugs.webkit.org/show_bug.cgi?id=178278 Reviewed by Darin Adler. Revert r222732 and partially revert r222670. The underlying font rendering machinery implements text truncation by taking a TextRun object that represents all of the text in the line fragment and a subrange of the glyphs to render from this fragment. Only the glyphs in this subrange are drawn and they are drawn in the same position they would be in had the entire line fragment been drawn. Following r222670 InlineTextBox applies the truncation to the TextRun in InlineTextBox::text(). Together with r222732, which assumed that the number of glyphs to draw is equal to the length of the TextRun, a truncated text run would be drawn at the wrong position on screen and could give the impression that the text is not drawn. Instead InlineTextBox::text() should always return the text for the entire line fragment without considering truncation and when calling TextPainter::paint() we need to pass the truncated length of the line fragment. Test: fast/text/ellipsis-text-rtl.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paint): Compute the truncated length (number of glyphs) and pass this to TextPainter::paint() (WebCore::InlineTextBox::text const): Do not apply truncation to the text run. Truncation is implemented by telling the underlying font rendering machinery to paint the subrange of the text run that represents the non-truncated (visible) text. * rendering/InlineTextBox.h: * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::paintFlow): Pass the entire length of the text run as we did prior to r222732. * rendering/TextPainter.cpp: (WebCore::TextPainter::paint): Take a length that represents the number of glyphs to draw from the text run as we use to take prior to r222732. * rendering/TextPainter.h: 2017-10-17 Zalan Bujtas [FrameView::layout cleanup] Move text auto sizing logic to a separate function https://bugs.webkit.org/show_bug.cgi?id=178391 Reviewed by Antti Koivisto. No change in functionality. * page/FrameView.cpp: (WebCore::applyTextSizingIfNeeded): (WebCore::FrameView::layout): 2017-10-17 Yoshiaki Jitsukawa [Curl] Forward declaration "class Cookie;" in CookieJarCurl.h should be "struct Cookie;" https://bugs.webkit.org/show_bug.cgi?id=178378 Reviewed by Per Arne Vollan. No new tests. No change in behaviors. * platform/network/curl/CookieJarCurl.h: 2017-10-17 Zalan Bujtas [FrameView::layout cleanup] Merge InPreLayout blocks https://bugs.webkit.org/show_bug.cgi?id=178373 Reviewed by Antti Koivisto. Remove redundant comment and scoping. No change in functionality. * page/FrameView.cpp: (WebCore::FrameView::layout): 2017-10-17 Antti Koivisto Text nodes with display:contents parent should render as if they were wrapped in an unstyled https://bugs.webkit.org/show_bug.cgi?id=178332 Reviewed by Ryosuke Niwa. According to https://github.com/w3c/csswg-drafts/issues/1118
text
must result in green text even though div doesn't generate a box. This patch implements the behavior by wrapping text renderers with display:contents parent element in an anonymous inline box that receives its style by inheriting from the parent element. * dom/Document.cpp: (WebCore::Document::updateTextRenderer): * rendering/RenderElement.cpp: (WebCore::RenderElement::computeFirstLineStyle const): Synthesize the first line style in display:contents parent case. * rendering/RenderObject.cpp: (WebCore::findDestroyRootIncludingAnonymous): Factor into a function. (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Get rid of the anonymous wrapper if it exists. * rendering/RenderText.cpp: (WebCore::inlineWrapperForDisplayContentsMap): (WebCore::RenderText::RenderText): (WebCore::RenderText::willBeDestroyed): (WebCore::RenderText::inlineWrapperForDisplayContents): (WebCore::RenderText::setInlineWrapperForDisplayContents): Add a weak member (implemented as a rare data map) for holding the wrapper pointer. (WebCore::RenderText::findByDisplayContentsInlineWrapperCandidate): Helper to get the text renderer for a wrapper. * rendering/RenderText.h: * style/RenderTreeUpdater.cpp: (WebCore::createTextRenderer): (WebCore::RenderTreeUpdater::updateTextRenderer): Create the wrapper if needed. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveComposedTree): Compute the wrapper style by inheriting from the display:contents parent. * style/StyleUpdate.h: (WebCore::Style::TextUpdate::TextUpdate): 2017-10-17 Alicia Boya García [MSE][GStreamer] Insert parser elements in AppendPipeline when demuxing opus or Vorbis https://bugs.webkit.org/show_bug.cgi?id=178076 Reviewed by Xabier Rodriguez-Calvar. YouTube does not include durations in the WebM container for files containing Opus audio, so we need to read them from the contained stream. Fortunately, GStreamer has an element to do that: opusparse. The same thing happens with Vorbis contained in WebM files from the W3C tests, which should also be fixed by the GStreamer element vorbisparse. This patch adds an opusparse or vorbisparse element to the AppendPipeline at the sinkpad of the demuxer when either is found. Tests: updated expectations. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::AppendPipeline::appsinkNewSample): (WebCore::createOptionalParserForFormat): (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread): (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread): * platform/graphics/gstreamer/mse/AppendPipeline.h: * platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp: (WebCore::GStreamerMediaSample::GStreamerMediaSample): * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: (WebCore::PlaybackPipeline::attachTrack): 2017-10-17 Ms2ger Add WebGL2 texImage3D overloads. https://bugs.webkit.org/show_bug.cgi?id=178119 Reviewed by Ryosuke Niwa. No new tests: not much point in adding tests now; this method doesn't do anything anyway. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::texImage3D): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGL2RenderingContext.idl: 2017-10-17 Antti Koivisto Resolve ::before and ::after pseudo elements during style resolution https://bugs.webkit.org/show_bug.cgi?id=178339 Reviewed by Ryosuke Niwa. They are currently resolved during render tree building which creates problems with display:contents and animations. * dom/PseudoElement.cpp: (WebCore::PseudoElement::PseudoElement): Call InspectorInstrumentation from constructor. * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::Parent::Parent): (WebCore::RenderTreeUpdater::updateRenderTree): (WebCore::RenderTreeUpdater::pushParent): Push the full update to the parent stack. (WebCore::RenderTreeUpdater::popParent): (WebCore::RenderTreeUpdater::updateBeforeDescendants): (WebCore::RenderTreeUpdater::updateAfterDescendants): (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded): * style/RenderTreeUpdater.h: * style/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement): No need to resolve pseudo style, we have it already. (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement): (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement): Deleted. (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement): Deleted. * style/RenderTreeUpdaterGeneratedContent.h: * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): (WebCore::Style::TreeResolver::resolvePseudoStyle): Resolve pseudos. (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Make a private member function. (WebCore::Style::TreeResolver::resolveComposedTree): * style/StyleTreeResolver.h: * style/StyleUpdate.cpp: (WebCore::Style::Update::elementUpdates const): (WebCore::Style::Update::elementUpdates): Bundle the style update for an element and the associated before/after pseudos. (WebCore::Style::Update::elementStyle const): (WebCore::Style::Update::elementStyle): (WebCore::Style::Update::addElement): (WebCore::Style::Update::elementUpdate const): Deleted. (WebCore::Style::Update::elementUpdate): Deleted. * style/StyleUpdate.h: 2017-10-17 Keith Miller Change WebCore sources to work with unified source builds https://bugs.webkit.org/show_bug.cgi?id=178229 Rubber stamped by Tim Horton. This patch does the following: 1) Move all “using namespace ;” into the WebCore namespace (They used to go in the global namespace) and change to "using WebCore::;” in .mm files. 2) Move a bunch of the soft linking library/framework macros out of the .mm files since those caused name collision problems. 3) Fix minor other naming collisions. The problem with 1 in a unified source world is generic names often collide with system header names. For example, WebCore has a Rect class and that collided with a system header type elsewhere. This patch shouldn't change behavior so no new tests. * Configurations/FeatureDefines.xcconfig: * Modules/cache/CacheStorageConnection.cpp: * Modules/cache/DOMCache.cpp: * Modules/cache/DOMCacheStorage.cpp: * Modules/cache/WorkerCacheStorageConnection.cpp: * Modules/encryptedmedia/InitDataRegistry.cpp: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: * Modules/indexeddb/IDBCursor.cpp: * Modules/indexeddb/IDBFactory.cpp: * Modules/indexeddb/IDBIndex.cpp: * Modules/indexeddb/IDBKeyRange.cpp: * Modules/indexeddb/IDBObjectStore.cpp: * Modules/indexeddb/IDBRequest.cpp: * Modules/indexeddb/IDBTransaction.cpp: * Modules/indexeddb/server/MemoryObjectStore.cpp: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::setReadyState): (WebCore::toString): Deleted. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: (WebCore::jsValueWithAVMetadataItemInContext): * Modules/webdriver/NavigatorWebDriver.cpp: * PlatformAppleWin.cmake: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * accessibility/ios/AccessibilityObjectIOS.mm: (-[WAKView accessibilityIsIgnored]): Deleted. * accessibility/ios/WebAccessibilityObjectWrapperIOS.h: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WAKView accessibilityIsIgnored]): * accessibility/win/AXObjectCacheWin.cpp: * bindings/js/CommonVM.cpp: * bindings/js/DOMWrapperWorld.cpp: * bindings/js/GCController.cpp: * bindings/js/IDBBindingUtilities.cpp: * bindings/js/JSAudioTrackCustom.cpp: * bindings/js/JSAudioTrackListCustom.cpp: * bindings/js/JSBlobCustom.cpp: * bindings/js/JSCSSRuleCustom.cpp: * bindings/js/JSCSSRuleListCustom.cpp: * bindings/js/JSCSSStyleDeclarationCustom.cpp: * bindings/js/JSCallbackData.cpp: * bindings/js/JSCanvasRenderingContext2DCustom.cpp: * bindings/js/JSCustomElementInterface.cpp: * bindings/js/JSCustomElementRegistryCustom.cpp: * bindings/js/JSCustomEventCustom.cpp: * bindings/js/JSDOMBindingSecurity.cpp: * bindings/js/JSDOMBuiltinConstructorBase.cpp: * bindings/js/JSDOMConstructorBase.cpp: * bindings/js/JSDOMConstructorWithDocument.cpp: * bindings/js/JSDOMConvertDate.cpp: * bindings/js/JSDOMConvertNumbers.cpp: * bindings/js/JSDOMConvertStrings.cpp: * bindings/js/JSDOMConvertWebGL.cpp: * bindings/js/JSDOMExceptionHandling.cpp: * bindings/js/JSDOMGlobalObject.cpp: * bindings/js/JSDOMGlobalObjectTask.cpp: * bindings/js/JSDOMGuardedObject.cpp: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMQuadCustom.cpp: * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSDOMWindowProxy.cpp: * bindings/js/JSDOMWrapper.cpp: * bindings/js/JSDOMWrapperCache.cpp: * bindings/js/JSDeprecatedCSSOMValueCustom.cpp: * bindings/js/JSDocumentCustom.cpp: * bindings/js/JSDocumentFragmentCustom.cpp: * bindings/js/JSElementCustom.cpp: * bindings/js/JSErrorHandler.cpp: * bindings/js/JSEventCustom.cpp: * bindings/js/JSEventListener.cpp: * bindings/js/JSEventTargetCustom.cpp: * bindings/js/JSFileSystemEntryCustom.cpp: * bindings/js/JSHTMLCollectionCustom.cpp: * bindings/js/JSHTMLDocumentCustom.cpp: * bindings/js/JSHTMLTemplateElementCustom.cpp: * bindings/js/JSHistoryCustom.cpp: * bindings/js/JSIDBCursorCustom.cpp: * bindings/js/JSIDBCursorWithValueCustom.cpp: * bindings/js/JSIDBIndexCustom.cpp: * bindings/js/JSIDBObjectStoreCustom.cpp: * bindings/js/JSIDBTransactionCustom.cpp: * bindings/js/JSImageDataCustom.cpp: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLocationCustom.cpp: * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: * bindings/js/JSMessageEventCustom.cpp: * bindings/js/JSMessagePortCustom.cpp: * bindings/js/JSMutationObserverCustom.cpp: * bindings/js/JSNodeCustom.cpp: * bindings/js/JSNodeListCustom.cpp: * bindings/js/JSPerformanceEntryCustom.cpp: * bindings/js/JSPluginElementFunctions.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSReadableStreamPrivateConstructors.cpp: * bindings/js/JSReadableStreamSourceCustom.cpp: * bindings/js/JSSVGPathSegCustom.cpp: * bindings/js/JSTextTrackCueCustom.cpp: * bindings/js/JSTextTrackCustom.cpp: * bindings/js/JSTextTrackListCustom.cpp: * bindings/js/JSTrackCustom.cpp: * bindings/js/JSVideoTrackCustom.cpp: * bindings/js/JSVideoTrackListCustom.cpp: * bindings/js/JSWebGL2RenderingContextCustom.cpp: * bindings/js/JSWebGLRenderingContextCustom.cpp: * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp: * bindings/js/JSWebGPURenderingContextCustom.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkerGlobalScopeCustom.cpp: * bindings/js/JSXMLHttpRequestCustom.cpp: * bindings/js/JSXPathNSResolverCustom.cpp: * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::pipeTo): (WebCore::ReadableStream::tee): (WebCore::checkReadableStream): (WebCore::callFunction): Deleted. * bindings/js/ScheduledAction.cpp: * bindings/js/ScriptCachedFrameData.cpp: * bindings/js/ScriptController.cpp: * bindings/js/SerializedScriptValue.cpp: * bindings/js/StructuredClone.cpp: * bindings/js/WebCoreJSClientData.cpp: * bindings/js/WorkerScriptController.cpp: * bindings/scripts/CodeGeneratorJS.pm: (GenerateEnumerationImplementation): (GenerateImplementation): (GenerateDictionaryImplementation): (GenerateCallbackFunctionImplementation): (GenerateCallbackInterfaceImplementation): * 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/JSTestCallbackFunction.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/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * 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/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * 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: * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp: * bridge/IdentifierRep.cpp: * bridge/NP_jsobject.cpp: (ObjectMap::get): Deleted. (ObjectMap::add): Deleted. (ObjectMap::remove): Deleted. (objectMap): Deleted. (ObjectMap::RootObjectInvalidationCallback::operator()): Deleted. (getListFromVariantArgs): Deleted. (jsAllocate): Deleted. (jsDeallocate): Deleted. (_NPN_CreateNoScriptObject): Deleted. (_NPN_InvokeDefault): Deleted. (_NPN_Invoke): Deleted. (_NPN_Evaluate): Deleted. (_NPN_GetProperty): Deleted. (_NPN_SetProperty): Deleted. (_NPN_RemoveProperty): Deleted. (_NPN_HasProperty): Deleted. (_NPN_HasMethod): Deleted. (_NPN_SetException): Deleted. (_NPN_Enumerate): Deleted. (_NPN_Construct): Deleted. * bridge/NP_jsobject.h: * contentextensions/ContentExtensionParser.cpp: * crypto/SubtleCrypto.cpp: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): (WebCore::CryptoAlgorithmAES_CBC::importKey): (WebCore::CryptoAlgorithmAES_CBC::exportKey): * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: (WebCore::CryptoAlgorithmAES_CFB::encrypt): (WebCore::CryptoAlgorithmAES_CFB::decrypt): (WebCore::CryptoAlgorithmAES_CFB::importKey): (WebCore::CryptoAlgorithmAES_CFB::exportKey): * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp: (WebCore::parametersAreValid): (WebCore::CryptoAlgorithmAES_CTR::importKey): (WebCore::CryptoAlgorithmAES_CTR::exportKey): * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: (WebCore::tagLengthIsValid): (WebCore::CryptoAlgorithmAES_GCM::encrypt): (WebCore::CryptoAlgorithmAES_GCM::decrypt): (WebCore::CryptoAlgorithmAES_GCM::importKey): (WebCore::CryptoAlgorithmAES_GCM::exportKey): * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::importKey): (WebCore::CryptoAlgorithmAES_KW::exportKey): * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey): (WebCore::CryptoAlgorithmHMAC::exportKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::importKey): (WebCore::CryptoAlgorithmRSA_OAEP::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: (WebCore::CryptoAlgorithmRSA_PSS::importKey): (WebCore::CryptoAlgorithmRSA_PSS::exportKey): * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits): (WebCore::commonCryptoHMACAlgorithm): Deleted. * css/CSSBasicShapes.cpp: * css/CSSPrimitiveValue.cpp: * css/parser/CSSParser.cpp: * css/parser/CSSPropertyParser.cpp: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::positionFromThreeOrFourValues): (WebCore::CSSPropertyParserHelpers::consumePosition): (WebCore::CSSPropertyParserHelpers::createPrimitiveValuePair): Deleted. * dom/DOMQuad.cpp: * dom/Document.cpp: * dom/ErrorEvent.cpp: * dom/EventListenerMap.cpp: * dom/EventTarget.cpp: * dom/PromiseRejectionEvent.cpp: * dom/RejectedPromiseTracker.cpp: * dom/ScriptExecutionContext.cpp: * domjit/JSDocumentDOMJIT.cpp: * domjit/JSDocumentFragmentDOMJIT.cpp: * domjit/JSElementDOMJIT.cpp: * domjit/JSEventDOMJIT.cpp: * domjit/JSNodeDOMJIT.cpp: * editing/TextIterator.cpp: * editing/cocoa/HTMLConverter.mm: * history/CachedPage.cpp: * html/HTMLCanvasElement.cpp: * html/HTMLFontElement.cpp: * html/HTMLMediaElement.cpp: * html/HTMLSelectElement.cpp: * html/TypeAhead.cpp: * html/parser/HTMLSrcsetParser.cpp: (WebCore::tokenizeDescriptors): * html/parser/HTMLTokenizer.cpp: * html/parser/ParsingUtilities.h: (WebCore::isNotASCIISpace): * html/parser/XSSAuditorDelegate.cpp: * html/track/DataCue.cpp: * inspector/CommandLineAPIHost.cpp: * inspector/CommandLineAPIModule.cpp: * inspector/InspectorApplicationCacheAgent.cpp: * inspector/InspectorCSSAgent.cpp: * inspector/InspectorCanvas.cpp: * inspector/InspectorCanvasAgent.cpp: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorDOMAgent.cpp: * inspector/InspectorDOMDebuggerAgent.cpp: * inspector/InspectorDOMStorageAgent.cpp: * inspector/InspectorDatabaseAgent.cpp: * inspector/InspectorDatabaseResource.cpp: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorIndexedDBAgent.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorLayerTreeAgent.cpp: * inspector/InspectorMemoryAgent.cpp: * inspector/InspectorNetworkAgent.cpp: * inspector/InspectorOverlay.cpp: * inspector/InspectorPageAgent.cpp: * inspector/InspectorShaderProgram.cpp: * inspector/InspectorStyleSheet.cpp: * inspector/InspectorTimelineAgent.cpp: * inspector/InspectorWorkerAgent.cpp: * inspector/InstrumentingAgents.cpp: * inspector/NetworkResourcesData.cpp: * inspector/PageConsoleAgent.cpp: * inspector/PageDebuggerAgent.cpp: * inspector/PageHeapAgent.cpp: * inspector/PageRuntimeAgent.cpp: * inspector/PageScriptDebugServer.cpp: * inspector/TimelineRecordFactory.cpp: * inspector/WebConsoleAgent.cpp: * inspector/WebDebuggerAgent.cpp: * inspector/WebHeapAgent.cpp: * inspector/WebInjectedScriptHost.cpp: * inspector/WebInjectedScriptManager.cpp: * inspector/WorkerConsoleAgent.cpp: * inspector/WorkerDebuggerAgent.cpp: * inspector/WorkerInspectorController.cpp: * inspector/WorkerRuntimeAgent.cpp: * inspector/WorkerScriptDebugServer.cpp: * loader/FTPDirectoryParser.cpp: * loader/TextResourceDecoder.cpp: * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.cpp: * page/ContextMenuController.cpp: * page/DOMWindow.cpp: * page/Navigator.cpp: * page/PageConsoleClient.cpp: * page/PageDebuggable.cpp: * page/cocoa/ResourceUsageOverlayCocoa.mm: * page/csp/ContentSecurityPolicy.cpp: * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::isNotASCIISpace): Deleted. * page/csp/ContentSecurityPolicyMediaListDirective.cpp: (WebCore::isNotASCIISpace): Deleted. * page/scrolling/ios/ScrollingTreeIOS.cpp: * page/scrolling/ios/ScrollingTreeIOS.h: * page/scrolling/mac/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): (WebCore::operator*): Deleted. * page/scrolling/mac/ScrollingTreeStickyNode.mm: (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): (WebCore::operator*): Deleted. * platform/Length.cpp: * platform/URL.cpp: (WebCore::isSchemeFirstChar): (WebCore::isSchemeChar): (WebCore::isBadChar): (WebCore::isTabNewline): * platform/audio/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::WebAudioBufferList): * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pushSamples): * platform/cf/CoreMediaSoftLink.cpp: Removed. * platform/cf/CoreMediaSoftLink.h: Removed. * platform/encryptedmedia/clearkey/CDMClearKey.cpp: * platform/graphics/FloatPolygon.cpp: (WebCore::areCollinearPoints): (WebCore::FloatPolygon::FloatPolygon): (WebCore::VertexPair::intersection const): (WebCore::determinant): Deleted. * platform/graphics/FontCache.cpp: * platform/graphics/FontCascade.cpp: * platform/graphics/GraphicsContext3DPrivate.cpp: * platform/graphics/WidthIterator.cpp: * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: (WebCore::AudioSourceProviderAVFObjC::process): * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer): * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm: (WebCore::assetTrackMeetsHardwareDecodeRequirements): * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::readSampleMetadata): (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: * platform/graphics/ca/win/WebTiledBackingLayerWin.cpp: * platform/graphics/cairo/GraphicsContextCairo.cpp: * platform/graphics/cairo/ImageBufferCairo.cpp: * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::ImageBuffer): (WebCore::releaseImageData): Deleted. * platform/graphics/cg/ImageBufferDataCG.h: * platform/graphics/cocoa/WebCoreDecompressionSession.mm: * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: * platform/graphics/opentype/OpenTypeMathData.cpp: * platform/graphics/opentype/OpenTypeVerticalData.cpp: * platform/graphics/transforms/MatrixTransformOperation.cpp: (WebCore::MatrixTransformOperation::blend): (WebCore::createOperation): Deleted. * platform/graphics/win/FontPlatformDataCairoWin.cpp: * platform/graphics/win/FontWin.cpp: * platform/graphics/win/GraphicsContextCGWin.cpp: * platform/graphics/win/GraphicsContextCairoWin.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/graphics/win/GraphicsContextWin.cpp: * platform/graphics/win/UniscribeController.cpp: * platform/image-decoders/ScalableImageDecoder.cpp: (): Deleted. * platform/ios/LegacyTileLayer.mm: (-[LegacyTileHostLayer renderInContext:]): * platform/ios/PlaybackSessionInterfaceAVKit.mm: * platform/ios/ScrollAnimatorIOS.mm: * platform/ios/VideoFullscreenInterfaceAVKit.mm: * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController skipBackwardThirtySeconds:]): (-[WebAVPlayerController gotoEndOfSeekableRanges:]): (-[WebAVPlayerController canSeekToBeginning]): (-[WebAVPlayerController canSeekToEnd]): (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]): (-[WebAVPlayerController updateMinMaxTiming]): * platform/ios/WebEvent.mm: * platform/ios/WebItemProviderPasteboard.mm: * platform/ios/wak/WKContentObservation.cpp: * platform/mac/KeyEventMac.mm: * platform/mac/PlaybackSessionInterfaceMac.mm: (WebCore::timeRangesToArray): * platform/mac/ScrollAnimatorMac.mm: (macScrollbarTheme): Deleted. (scrollerImpForScrollbar): Deleted. * platform/mac/ScrollbarThemeMac.mm: (WebCore::scrollbarMap): * platform/mac/VideoFullscreenInterfaceMac.mm: * platform/mac/WebCoreFullScreenPlaceholderView.mm: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::dataForURLComponentType): * platform/mac/WebPlaybackControlsManager.mm: * platform/mac/WebVideoFullscreenController.mm: (SOFT_LINK_CLASS): Deleted. * platform/mac/WebVideoFullscreenHUDWindowController.mm: * platform/mac/WebWindowAnimation.mm: (WebWindowAnimationDurationFromDuration): Deleted. (scaledRect): Deleted. (squaredDistance): Deleted. * platform/mediastream/RealtimeOutgoingVideoSource.cpp: * platform/mediastream/mac/AVCaptureDeviceManager.mm: * platform/mediastream/mac/AVMediaCaptureSource.mm: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::applyFrameRate): (WebCore::AVVideoCaptureSource::processNewFrame): * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: * platform/mediastream/mac/CoreAudioCaptureDevice.cpp: * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: * platform/mediastream/mac/CoreAudioCaptureSource.cpp: * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: * platform/network/HTTPParsers.cpp: * platform/text/LocaleICU.cpp: * platform/text/TextCodecLatin1.cpp: * platform/text/TextCodecUTF8.cpp: * platform/text/TextEncodingRegistry.cpp: * platform/text/win/LocaleWin.cpp: * platform/win/BString.cpp: * platform/win/KeyEventWin.cpp: * platform/win/ScrollbarThemeWin.cpp: * rendering/BidiRun.cpp: * rendering/FloatingObjects.cpp: * rendering/RenderBlock.cpp: * rendering/RenderListMarker.cpp: * rendering/RenderQuote.cpp: * rendering/RenderText.cpp: * rendering/RenderThemeWin.cpp: * testing/Internals.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/WorkerConsoleClient.cpp: * workers/WorkerGlobalScope.cpp: * workers/WorkerInspectorProxy.cpp: * xml/SoftLinkLibxslt.cpp: Added. * xml/SoftLinkLibxslt.h: Added. * xml/XPathGrammar.cpp: * xml/XPathParser.cpp: * xml/XSLStyleSheetLibxslt.cpp: * xml/XSLTExtensions.cpp: * xml/XSLTProcessorLibxslt.cpp: * xml/XSLTUnicodeSort.cpp: (xsltTransformErrorTrampoline): (WebCore::xsltUnicodeSortFunction): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::updateLeafTextNode): (WebCore::toString): Deleted. 2017-10-16 Wenson Hsieh Allow reading data and blob URLs via DataTransfer when the pasteboard contains files https://bugs.webkit.org/show_bug.cgi?id=178377 Reviewed by Ryosuke Niwa. Adds data and blob URLs, alongside http(s), as URL protocols safe to expose to bindings. Test: editing/pasteboard/drag-drop-href-as-url.html * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): 2017-10-16 Ryosuke Niwa Strip away event handlers and JavaScript URLs when copying https://bugs.webkit.org/show_bug.cgi?id=178375 Reviewed by Wenson Hsieh. Don't serialize event handlers and URLs with javascript protocol when serializing HTML since they're not safe to be pasted elsewhere. Test: editing/pasteboard/copying-html-strips-javascript-url-and-event-handler.html * dom/Element.cpp: (WebCore::Element::isEventHandlerAttribute const): (WebCore::isEventHandlerAttribute): Deleted. * dom/Element.h: * editing/markup.cpp: (WebCore::StyledMarkupAccumulator::appendElement): 2017-10-16 Dean Jackson WebGL clamps drawingBufferWidth to 4096 pixels on a 5120 monitor/canvas https://bugs.webkit.org/show_bug.cgi?id=178223 Reviewed by Antoine Quint. Remove the limit of 4k on the width/height of the renderbuffer. Test: fast/canvas/webgl/large-drawing-buffer-resize.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::reshape): 2017-10-16 Ryosuke Niwa Assert that Node::insertedInto doesn't fire an event https://bugs.webkit.org/show_bug.cgi?id=178376 Reviewed by Daniel Bates. Fixed the assertion in notifyChildNodeInserted since this function MUST NOT dispatch an event, and moved a bunch of event-dispatching code from Node::insertedInto into Node::finishedInsertingSubtree. No new tests since the existing tests cover the behavioral change. * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): Fixed the assertion. * dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::insertedInto): (WebCore::ProcessingInstruction::finishedInsertingSubtree): Extracted from insertedInto since checkStyleSheet can dispatch an event. * dom/ProcessingInstruction.h: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::insertedInto): (WebCore::HTMLBodyElement::finishedInsertingSubtree): Extracted from insertedInto since setIntegralAttribute could dispatch DOMAttrModified synchronously. * html/HTMLBodyElement.h: 2017-10-16 Chris Dumez ServiceWorkerRegistration should subclass RefCounted<> https://bugs.webkit.org/show_bug.cgi?id=178374 Reviewed by Ryosuke Niwa. ServiceWorkerRegistration should subclass RefCounted<> or we end up with an infinite recursion when constructing such object. This is because ServiceWorkerRegistration subclasses EventTargetWithInlineData which implements ref() / deref() by calling refEventTarget() / derefEventTarget(). refEventTarget() / derefEventTarget() are implemented in ServiceWorkerRegistration so that they call ref() / deref() (which ends up being EventTarget's methods). * workers/service/ServiceWorkerRegistration.h: 2017-10-16 Jer Noble ImageDecoderAVFObjC fails to create more CMSampleBuffers after creating about 32MB worth. https://bugs.webkit.org/show_bug.cgi?id=178360 Reviewed by Eric Carlson. AVSampleBufferGenerator has a constrained memory pool of about 32MB in size. Once CMSampleBuffers representing about 32MB of memory are allocated, no more can be created until previously created ones are released. So rather than (only) creating the sample buffers up front in readSampleMetadata(), also create them dynamically, if missing, in createFrameImageAtIndex(...) and release them in storeSampleBuffer(...) after they have been decoded. Drive-by fix: the expected content length was never actually set by the owner of ImageDecoderAVFObjC. Now that the expected content length is available, we don't have to wait until the data is complete to respond to requests. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::ensureDecoderAvailable): * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h: * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (SOFT_LINK_POINTER_OPTIONAL): (-[WebCoreSharedBufferResourceLoaderDelegate canFulfillRequest:]): (-[WebCoreSharedBufferResourceLoaderDelegate fulfillRequest:]): (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]): (WebCore::imageDecoderAssetOptions): (WebCore::ImageDecoderAVFObjC::firstEnabledTrack): (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex): (WebCore::ImageDecoderAVFObjC::setExpectedContentSize): 2017-10-12 Matt Rajca Add API support for quirk that lets an arbitrary click allow auto-play. https://bugs.webkit.org/show_bug.cgi?id=178227 Reviewed by Alex Christensen. Added API test. Instead of hardcoding sites in WebCore, let API clients control which websites opt into the quirk that lets an arbitrary click allow auto-play via website policies. * html/MediaElementSession.cpp: (WebCore::needsArbitraryUserGestureAutoplayQuirk): * loader/DocumentLoader.h: 2017-10-16 Chris Dumez DOMQuad.p1 / p2 / p3 / p4 should behave as [SameObject] https://bugs.webkit.org/show_bug.cgi?id=178366 Reviewed by Youenn Fablet. DOMQuad.p1 / p2 / p3 / p4 should behave as [SameObject]. We attempted to do so using JSDOMQuad::visitAdditionalChildren() but the code did not work because we failed to generate a "isReachableFromOpaqueRoots()" function for JSDOMPoint. Test: fast/css/DOMQuad-points-SameObject.html * dom/DOMPoint.idl: 2017-10-16 Andy Estes [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError https://bugs.webkit.org/show_bug.cgi?id=178191 Reviewed by Tim Horton. Added test cases to http/tests/ssl/applepay/ApplePaySession.html. * Modules/applepay/ApplePayError.idl: * Modules/applepay/ApplePayPaymentContact.h: * Modules/applepay/ApplePayPaymentContact.idl: * Modules/applepay/ApplePaySessionPaymentRequest.h: * Modules/applepay/cocoa/PaymentContactCocoa.mm: (WebCore::subLocality): (WebCore::setSubLocality): (WebCore::subAdministrativeArea): (WebCore::setSubAdministrativeArea): (WebCore::convert): 2017-10-16 Alex Christensen Allow modern decoding of URLs https://bugs.webkit.org/show_bug.cgi?id=178265 Reviewed by Chris Dumez. * platform/URL.h: (WebCore::URL::decode): 2017-10-16 Ryan Haddad Unreviewed, rolling out r223425. This change broke internal builds. Reverted changeset: "Remove unnecessary include from Document.h" https://bugs.webkit.org/show_bug.cgi?id=178247 https://trac.webkit.org/changeset/223425 2017-10-16 Maureen Daum If an origin doesn't have databases in the Databases table we should still remove its information from disk in DatabaseTracker::deleteOrigin() https://bugs.webkit.org/show_bug.cgi?id=178281 Reviewed by Brent Fulgham. New test: DatabaseTracker.DeleteOriginWithMissingEntryInDatabasesTable * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::deleteOrigin): If databaseNames is empty, don't bail early. Instead, delete everything in the directory containing the databases for this origin. This condition indicates that we previously tried to remove the origin but didn't get all of the way through the deletion process. Because we have lost track of the databases for this origin, we can assume that no other process is accessing them. This means it should be safe to delete them outright. 2017-10-16 Youenn Fablet [FETCH] Remove Request.type getter https://bugs.webkit.org/show_bug.cgi?id=177798 Reviewed by Chris Dumez. Tests: imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html Removing FetchRequest type getter. Merging Type and Destination as per https://fetch.spec.whatwg.org/#concept-request-destination. Setting destination of request within CachedResourceLoader as this will be useful to Service Workers. * Modules/fetch/FetchRequest.h: * Modules/fetch/FetchRequest.idl: * loader/FetchOptions.h: (WebCore::FetchOptions::isolatedCopy const): (WebCore::FetchOptions::FetchOptions): (WebCore::FetchOptions::encode const): (WebCore::FetchOptions::decode): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoaderOptions::isolatedCopy const): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestImage): (WebCore::CachedResourceLoader::requestFont): (WebCore::CachedResourceLoader::requestTextTrack): (WebCore::CachedResourceLoader::requestCSSStyleSheet): (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): (WebCore::CachedResourceLoader::requestScript): (WebCore::CachedResourceLoader::requestXSLStyleSheet): (WebCore::CachedResourceLoader::requestMedia): (WebCore::CachedResourceLoader::requestIcon): (WebCore::CachedResourceLoader::requestRawResource): (WebCore::CachedResourceLoader::requestBeaconResource): (WebCore::CachedResourceLoader::requestMainResource): * loader/cache/CachedResourceRequest.cpp: (WebCore::CachedResourceRequest::setDestinationIfNotSet): * loader/cache/CachedResourceRequest.h: 2017-10-15 Ryosuke Niwa Cannot access images included in the content pasted from Microsoft Word https://bugs.webkit.org/show_bug.cgi?id=124391 Reviewed by Antti Koivisto. The bug is caused by the fact Microsoft Word generates HTML content which references an image using file URL. Because the websites don't have access to arbtirary file URLs, this prevents editors such as TinyMCE to save those images. This patch fixes the problem by converting file URLs for images and all other subresources in the web archive generated by Microsoft Word by blob URLs like r222839 for RTF/RTFD and r222119 for images. To avoid revealing privacy sensitive information such as the absolute local file path to the user's home directory Microsoft Word and other applications in the system includes in the web archive placed in the system pasteboard, this patch also introduces the mechanism to sanitize when the HTML content is read by DataTransfer's getData. This patch also introduces the sanitization for when writing HTML into the pasteboard since other applications in the syste which is capable to processing web archives are not necessarily equipped to pretect itself and the rest of the system from potentially dangerous JavaScript included in the web archive placed in the system pasteboard. Finally, this patch expands the list of clipboard types that are exposed as "text/html" to the Web platform by adding the capability to convert RTF, RTFD, and web archive into HTML markup by introducing WebContentMarkupReader, a new subclass of PasteboardWebContentReader which creates a HTML markup instead of a document fragment. Most of the sanitization process happens in this new class, and will be expanded to WebContentReader to make pasting safer. Tests: editing/pasteboard/data-transfer-get-data-on-pasting-html-uses-blob-url.html editing/pasteboard/data-transfer-set-data-sanitizes-html-when-copying-in-null-origin.html editing/pasteboard/data-transfer-set-data-sanitizes-html-when-copying.html editing/pasteboard/data-transfer-set-data-sanitlize-html-when-dragging-in-null-origin.html http/tests/security/clipboard/copy-paste-html-across-origin-sanitizes-html.html CopyHTML.Sanitizes DataInteractionTests.DataTransferSanitizeHTML PasteRTF.ExposesHTMLTypeInDataTransfer PasteRTFD.ExposesHTMLTypeInDataTransfer PasteRTFD.ImageElementUsesBlobURLInHTML PasteWebArchive.ExposesHTMLTypeInDataTransfer * dom/DataTransfer.cpp: (WebCore::originIdentifierForDocument): Moved to Document::originIdentifierForPasteboard. (WebCore::DataTransfer::createForCopyAndPaste): (WebCore::DataTransfer::getDataForItem const): Use WebContentMarkupReader read HTMl content so that we can read web arhive, RTF, and RTFD as text/html. (WebCore::DataTransfer::getData const): (WebCore::DataTransfer::setData): (WebCore::DataTransfer::setDataFromItemList): Sanitize the HTML before placing into the system pasteboard. (WebCore::DataTransfer::createForDragStartEvent): (WebCore::DataTransfer::createForDrop): (WebCore::DataTransfer::createForUpdatingDropTarget): * dom/DataTransfer.h: * dom/DataTransfer.idl: * dom/DataTransferItem.cpp: (WebCore::DataTransferItem::getAsString const): * dom/Document.cpp: (WebCore::Document::originIdentifierForPasteboard): Renamed from uniqueIdentifier. Moved the code to use the origin string and then falling back to the UUID here from originIdentifierForDocument in DataTransfer.cpp. * dom/Document.h: * editing/WebContentReader.cpp: (WebCore::WebContentMarkupReader::shouldSanitize const): Added. * editing/WebContentReader.h: (WebCore::WebContentMarkupReader): Added. (WebCore::WebContentMarkupReader::WebContentMarkupReader): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::createFragmentFromWebArchive): Extracted out of WebContentReader::readWebArchive to share code. (WebCore::WebContentReader::readWebArchive): (WebCore::WebContentMarkupReader::readWebArchive): Added. Reads the web archive, replace all subresource URLs by blob URLs, and re-generate the markup using our copy & paste code. The last step is requied to strip away any privacy sensitive information as well as potentially dangerous JavaScript code. (WebCore::stripMicrosoftPrefix): Extracted out of WebContentReader::readHTML to share code. (WebCore::WebContentReader::readHTML): (WebCore::WebContentMarkupReader::readHTML): Added. Only sanitize the markup when it comes from a different origin. (WebCore::WebContentReader::readRTFD): Added a nullity check for frame.document(). (WebCore::WebContentMarkupReader::readRTFD): Added. (WebCore::WebContentMarkupReader::readRTF): Added. * editing/markup.h: * editing/markup.cpp: (WebCore::createPageForSanitizingWebContent): Added. (WebCore::sanitizeMarkup): Added. This function "pastes" the markup into a new isolated document then reserializes using our serialization code for copy. It strips away all invisible information such as comments, and strips away event handlers and script elements to remove potentially dangerous scripts. * platform/Pasteboard.h: * platform/ios/PasteboardIOS.mm: (WebCore::Pasteboard::readPasteboardWebContentDataForType): Now that this code can be called by DataTransfer, added the checks for the change count to make sure we stop letting web content read if the pasteboard had been changed by some other applications. To do this, turned this function into a member of Pasteboard. Also changed the return type to an enum with tri-state to exist the loop early in the call sites. (WebCore::Pasteboard::read): (WebCore::Pasteboard::readRespectingUTIFidelities): * platform/ios/PlatformPasteboardIOS.mm: (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Treat RTF, RTFD, and web archive as HTML. * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::read): Add the change count checks now that this code can be called by DataTransfer. * platform/mac/PlatformPasteboardMac.mm: (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Treat RTF, RTFD, and web archive as HTML. 2017-10-16 Ryan Haddad Unreviewed attempt to fix the Windows debug build. * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::deleteOrigin): 2017-10-16 Chris Dumez Log using differential privacy domains where the WebContent process crashes https://bugs.webkit.org/show_bug.cgi?id=178346 Reviewed by Alex Christensen. Add new diagnostic logging key for domain causing crashes. * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::domainCausingCrashKey): * page/DiagnosticLoggingKeys.h: 2017-10-16 Sam Weinig [Settings] Remove all custom code from Settings.h/cpp https://bugs.webkit.org/show_bug.cgi?id=178330 Reviewed by Simon Fraser. Removes the two remaining functions out of Settings paving the way for the file to be generated. - pageDestroyed was moved down into SettingsBase. - effectiveFrameFlattening was moved to FrameView (to reduce the need for additional includes, the FrameFlattening enum was converted to an enum class to allow it to be forward declared). Also moves default values into SettingsDefaultValues.h * WebCore.xcodeproj/project.pbxproj: Add new files. * page/FrameView.cpp: * page/FrameView.h: Move effectiveFrameFlattening function here from Settings. * page/Settings.cpp: * page/Settings.h: Move effectiveFrameFlattening, pageDestroyed and default values out. * page/Settings.in: Update for turning FrameFlattening into an enum class. * page/SettingsBase.h: Turn FrameFlattening into an enum class and move pageDestroyed here. * page/SettingsDefaultValues.h: Added. Move all the default values from Settings here. * rendering/RenderFrameSet.cpp: * rendering/RenderIFrame.cpp: * rendering/RenderView.cpp: Get effectiveFrameFlattening from the FrameView. * testing/InternalSettings.cpp: * testing/InternalSettings.h: Update now that FrameFlattening is an enum class. 2017-10-16 Maureen Daum If we fail to delete any database file, don't remove its information from the tracker database and https://bugs.webkit.org/show_bug.cgi?id=178251 Reviewed by Brady Eidson. New tests: DatabaseTracker.DeleteDatabase DatabaseTracker.DeleteDatabaseWhenDatabaseDoesNotExist DatabaseTracker.DeleteOrigin DatabaseTracker.DeleteOriginWhenDeletingADatabaseFails DatabaseTracker.DeleteOriginWhenDatabaseDoesNotExist * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): If the database doesn't exist, we previously deleted it but failed to remove the information from the tracker database. We still want to delete all of the information associated with this database from the tracker database, so add it to databaseNamesToDelete. (WebCore::DatabaseTracker::deleteOrigin): If a database doesn't exist, don't try to delete it. We don't need to, but more importantly, deleteDatabaseFile() will fail if the database doesn't exist, which will cause us to incorrectly think we failed to remove database information from disk. If we actually fail to delete any database file, return before we remove the origin information from the tracker database so we don't lose track of the database. (WebCore::DatabaseTracker::deleteDatabase): If a database doesn't exist, don't try to delete it. We don't need to, but also it will cause us to incorrectly think that we were unable to delete a database, so we would bail before we remove the database information from the tracker database. We want to remove the database information from the tracker database because the database doesn't exist. * Modules/webdatabase/DatabaseTracker.h: Expose fullPathForDatabase() for use by tests. * platform/Logging.h: Add a logging channel. 2017-10-16 Alex Christensen Remove unnecessary include from Document.h https://bugs.webkit.org/show_bug.cgi?id=178247 Reviewed by Darin Adler. * dom/Document.cpp: (WebCore::Document::hasTouchEventHandlers const): (WebCore::Document::touchEventTargetsContain const): * dom/Document.h: (WebCore::Document::hasTouchEventHandlers const): Deleted. (WebCore::Document::touchEventTargetsContain const): Deleted. 2017-10-16 Alex Christensen Fix iOS build after r223422 https://bugs.webkit.org/show_bug.cgi?id=178251 * Modules/webdatabase/DatabaseManager.h: 2017-10-16 Maureen Daum We should wrap the removal of information from the tracker database in a transaction in DatabaseTracker::deleteOrigin() https://bugs.webkit.org/show_bug.cgi?id=178274 Reviewed by Tim Horton. * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::deleteOrigin): Wrap the removal of information from the tracker database in a transaction so that we don't end up in a case where only one of the tables contains information about an origin. If anything goes wrong when we're modifying the tracker database, rollback the transaction before bailing. 2017-10-16 Ryan Haddad Unreviewed, rolling out r223419. This change broke the Windows build. Reverted changeset: "If we fail to delete any database file, don't remove its information from the tracker database" https://bugs.webkit.org/show_bug.cgi?id=178251 https://trac.webkit.org/changeset/223419 2017-10-16 Maureen Daum If we fail to delete any database file, don't remove its information from the tracker database and https://bugs.webkit.org/show_bug.cgi?id=178251 Reviewed by Brady Eidson. New tests: DatabaseTracker.DeleteDatabase DatabaseTracker.DeleteDatabaseWhenDatabaseDoesNotExist DatabaseTracker.DeleteOrigin DatabaseTracker.DeleteOriginWhenDeletingADatabaseFails DatabaseTracker.DeleteOriginWhenDatabaseDoesNotExist * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): If the database doesn't exist, we previously deleted it but failed to remove the information from the tracker database. We still want to delete all of the information associated with this database from the tracker database, so add it to databaseNamesToDelete. (WebCore::DatabaseTracker::deleteOrigin): If a database doesn't exist, don't try to delete it. We don't need to, but more importantly, deleteDatabaseFile() will fail if the database doesn't exist, which will cause us to incorrectly think we failed to remove database information from disk. If we actually fail to delete any database file, return before we remove the origin information from the tracker database so we don't lose track of the database. (WebCore::DatabaseTracker::deleteDatabase): If a database doesn't exist, don't try to delete it. We don't need to, but also it will cause us to incorrectly think that we were unable to delete a database, so we would bail before we remove the database information from the tracker database. We want to remove the database information from the tracker database because the database doesn't exist. * Modules/webdatabase/DatabaseTracker.h: Expose fullPathForDatabase() for use by tests. * platform/Logging.h: Add a logging channel. 2017-10-16 Brent Fulgham REGRESSION(223307): ASSERTION in WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution https://bugs.webkit.org/show_bug.cgi?id=178342 Reviewed by Chris Dumez. In r223307 I mistakenly used 'topDocument->topDocument()' because of a copy/paste error. I should have just used 'topDocument'. Tests: CommandBackForwardTestWKWebView in TestWebKitAPI. * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): We might enter this routine at a time where there is no page. If so, we should return early and not log credit. * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): Correct the argument passed to the log function. 2017-10-15 Filip Pizlo Make some asserts into release asserts https://bugs.webkit.org/show_bug.cgi?id=178324 Reviewed by Saam Barati. No new tests because no change in behavior. This introduces some release asserts. Perf testing shows that it's neutral. So, we get some extra safety without losing any perf. * dom/ContainerNodeAlgorithms.cpp: (WebCore::notifyChildNodeInserted): * dom/Document.cpp: (WebCore::Document::adoptNode): (WebCore::Document::frameDestroyed): (WebCore::Document::attachToCachedFrame): (WebCore::Document::detachFromCachedFrame): (WebCore::Document::prepareForDestruction): (WebCore::Document::dispatchWindowEvent): (WebCore::Document::dispatchWindowLoadEvent): (WebCore::Document::applyQuickLookSandbox): * dom/DocumentOrderedMap.cpp: (WebCore::DocumentOrderedMap::add): (WebCore::DocumentOrderedMap::remove): (WebCore::DocumentOrderedMap::get const): (WebCore:: const): * dom/Node.cpp: (WebCore::Node::~Node): (WebCore::DidMoveToNewDocumentAssertionScope::~DidMoveToNewDocumentAssertionScope): (WebCore::DidMoveToNewDocumentAssertionScope::didRecieveCall): (WebCore::moveNodeToNewDocument): (WebCore::moveShadowTreeToNewDocument): (WebCore::Node::moveTreeToNewScope): (WebCore::Node::didMoveToNewDocument): (WebCore::Node::dispatchSubtreeModifiedEvent): (WebCore::Node::dispatchDOMActivateEvent): 2017-10-16 Alejandro G. Castro Make RealtimeIncomingAudioSources and RealtimeOutgoingAudioSources port agnostic https://bugs.webkit.org/show_bug.cgi?id=177928 Reviewed by Youenn Fablet. Refactor the RealtimeIncomingAudioSource and RealtimeOutgoingAudioSource classes, move the mac specific code to a different class. This way we can use them from other ports. No new tests, we are not adding new functionality just refactoring. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/RealtimeIncomingAudioSource.cpp: Copied from Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h. Just the port agnostic parts. * platform/mediastream/RealtimeIncomingAudioSource.h: Copied from Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h. Ditto. * platform/mediastream/RealtimeOutgoingAudioSource.cpp: Copied from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp. Ditto. * platform/mediastream/RealtimeOutgoingAudioSource.h: Copied from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.h. Ditto. * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: Added, it adds Cocoa code parts from original Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.cpp. (WebCore::RealtimeIncomingAudioSource::create): Moved this function from the RealtimeOutgoingAudioSource.cpp file to avoid including the Cocoa file there. * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h: Added Cocoa code from original Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h. * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: Added Cocoa code from original Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp. (WebCore::RealtimeOutgoingAudioSource::create): Moved this function from the RealtimeOutgoingAudioSource.cpp file to avoid including the Cocoa file there. * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: Added Cocoa code from the original Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.h. 2017-10-16 Wenson Hsieh Unreviewed, fix the tvOS build after r223340. Add a new #define in PlatformPasteboardIOS.mm for item provider support, and guard usages of WebItemProviderPasteboard using it. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::pasteboardMayContainFilePaths): (WebCore::PlatformPasteboard::readURL): 2017-10-16 Ryan Haddad Unreviewed, rolling out r223271. This change introduced LayoutTest failures on WK1. Reverted changeset: "Use asynchronous ResourceHandleClient calls for WebKit1" https://bugs.webkit.org/show_bug.cgi?id=160677 https://trac.webkit.org/changeset/223271 2017-10-16 Alejandro G. Castro Make RealtimeIncomingVideoSources and RealtimeOutgoingVideoSources port agnostic https://bugs.webkit.org/show_bug.cgi?id=177869 Reviewed by Youenn Fablet. Refactor the RealtimeIncomingVideoSource and RealtimeOutgoingVideoSource classes, move the cocoa specific code to a different class. This way we can use them from other ports. No new functionality, just a refactor. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * platform/mediastream/RealtimeIncomingVideoSource.cpp: Moved from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h. Just the port agnostic parts. * platform/mediastream/RealtimeIncomingVideoSource.h: Moved from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h. DItto * platform/mediastream/RealtimeOutgoingVideoSource.cpp: Moved from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp. Ditto * platform/mediastream/RealtimeOutgoingVideoSource.h: Moved from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h. Ditto * platform/mediastream/mac/RealtimeIncomingVideoSourceMac.cpp: Added, it adds the Cocoa specific parts from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.cpp. (WebCore::RealtimeIncomingVideoSource::create): Moved this function from the base class, it allows avoiding the include. * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: Added, cocoa dependent code from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h. (WebCore::RealtimeOutgoingVideoSource::create): Moved this funtion from the base class, now we can use the Cocoa create without including it in the base class. * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: Added, cocoa dependent code. * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h: Added, cocoa dependent code. 2017-10-16 Manuel Rego Casasnovas Don't use intrinsic width if our container's width is zero https://bugs.webkit.org/show_bug.cgi?id=178073 Reviewed by Sergio Villar Senin. Based on Blink r173212 by . https://chromium.googlesource.com/chromium/src/+/1592e8a1e8e56dfa6e5d709c50b129ae659c2fad Since at least r798 we use a replaced element's intrinsic width if its containing block has a width of zero. As a result our rendering of width100percent-image.html has disagreed with all other browsers and we display replaced elements when they should be invisible. Test: fast/replaced/container-width-zero.html * rendering/RenderBox.cpp: (WebCore::RenderBox::computeReplacedLogicalWidthUsing const): If our container has zero width then let our width be zero too. 2017-10-16 Wenson Hsieh On ToT, event.dataTransfer.getData("text/uri-list") returns an empty string when dragging an image https://bugs.webkit.org/show_bug.cgi?id=178301 Reviewed by Darin Adler. After r222656, we consider images on the pasteboard to be files. This causes DataTransfer.getData to return the empty string for all types, which brings back https://bugs.webkit.org/show_bug.cgi?id=170637. To allow pages to access the URL part of a dragged image, we exempt "text/uri-list" from our heurstics to hide pasteboard data which may contain files, and return the URL as long as its protocol is either HTTP or HTTPS. Tweaked an existing layout test to cover this scenario, as well as the scenario in which the dragged image links to a file URL (in which case we should avoid exposing the data). Test: editing/pasteboard/drag-drop-href-as-url.html DataInteractionTests.DataTransferGetDataWhenDroppingImageWithHTTPURL * dom/DataTransfer.cpp: (WebCore::DataTransfer::getDataForItem const): When the pasteboard contains files, allow data for "text/uri-list" to be returned, as long as the URL string has a white-listed protocol (currently, this is just http and https). (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const): (WebCore::DataTransfer::setData): (WebCore::DataTransfer::types const): When the pasteboard contains files, allow "text/uri-list" to be added, alongside the "Files" type, if it would have been exposed in the list of safe DOM types. * dom/DataTransfer.h: * platform/Pasteboard.cpp: (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles): Add a new helper method to determine whether it is safe to expose an URL string as "text/uri-list" to bindings, if the pasteboard contains files. While this currently checks whether or not the URL is in the HTTP family, we may want to consider tweaking this to blacklist the "file" protocol instead, and allow all other valid URLs by default. * platform/Pasteboard.h: * platform/PlatformPasteboard.h: * platform/ios/PlatformPasteboardIOS.mm: (WebCore::pasteboardMayContainFilePaths): (WebCore::PlatformPasteboard::stringForType const): Mark stringForType as const, and also teach stringForType to return the null string for the platform URL type if the pasteboard might contain file paths. (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Before coercing a platform type to "text/uri-list" when building the list of DOM-safe types, check that the stringForType is not the empty string, in which case we don't expose the type to the DOM at all. This ensures that in cases where the URL might reveal a file path, we don't advertise "text/uri-list" as a type. We adopt a similar strategy on iOS. (WebCore::PlatformPasteboard::stringForType): Deleted. * platform/mac/PlatformPasteboardMac.mm: (WebCore::pasteboardMayContainFilePaths): (WebCore::PlatformPasteboard::stringForType const): (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): (WebCore::PlatformPasteboard::stringForType): Deleted. 2017-10-16 Frederic Wang Use auto/nullptr in scrolling code https://bugs.webkit.org/show_bug.cgi?id=178306 Reviewed by Carlos Garcia Campos. This patch modifies the scrolling code to use the auto keyword when possible. It also replaces '0' with 'nullptr' for the return value of ScrollingStateTree::stateNodeForID. No new tests, behavior unchanged. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): (WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode): (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode): (WebCore::AsyncScrollingCoordinator::updateNodeLayer): (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints): (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons): (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition): (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices): * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView const): (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const): (WebCore::ScrollingCoordinator::scrollLayerForFrameView): (WebCore::ScrollingCoordinator::headerLayerForFrameView): (WebCore::ScrollingCoordinator::footerLayerForFrameView): (WebCore::ScrollingCoordinator::counterScrollingLayerForFrameView): (WebCore::ScrollingCoordinator::insetClipLayerForFrameView): (WebCore::ScrollingCoordinator::contentShadowLayerForFrameView): (WebCore::ScrollingCoordinator::rootContentLayerForFrameView): (WebCore::ScrollingCoordinator::handleWheelEventPhase): (WebCore::ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects const): (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasonsForAllFrames): (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText const): * page/scrolling/ScrollingStateFixedNode.cpp: (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect): * page/scrolling/ScrollingStateStickyNode.cpp: (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect): * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const): (WebCore::ScrollingStateTree::attachNode): (WebCore::ScrollingStateTree::detachNode): (WebCore::ScrollingStateTree::removeNodeAndAllDescendants): (WebCore::ScrollingStateTree::stateNodeForID const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::updateTreeFromStateNode): * page/scrolling/ScrollingTreeNode.cpp: (WebCore::ScrollingTreeNode::enclosingFrameNode const): * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp: (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree): (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer): (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints): (WebCore::ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange): (WebCore::ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea): 2017-10-16 Fujii Hironori A lot of "Can't stat WebCore/animation: No such file or directory" since r223328 https://bugs.webkit.org/show_bug.cgi?id=178326 Unreviewed build fix The directory WebCore/animation was removed in r223328. No new tests because there is no behavior change. * CMakeLists.txt: Removed animation from WebCore_INCLUDE_DIRECTORIES and WebCore_IDL_INCLUDES. * DerivedSources.make: Removed animation from VPATH and IDL_INCLUDES 2017-10-16 Frederic Wang Replace some ScrollingTreeNode::nodeType() calls with is*Node() https://bugs.webkit.org/show_bug.cgi?id=178259 Reviewed by Darin Adler. No new tests, behavior unchanged. * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const): * page/scrolling/ScrollingStateNode.h: (WebCore::ScrollingStateNode::isScrollingNode const): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::updateTreeFromStateNode): * page/scrolling/ScrollingTreeNode.cpp: (WebCore::ScrollingTreeNode::enclosingFrameNode const): * page/scrolling/ScrollingTreeNode.h: (WebCore::ScrollingTreeNode::isScrollingNode const): 2017-10-16 Tomas Popela DataTransfer.cpp triggers -Wunused-but-set-variable https://bugs.webkit.org/show_bug.cgi?id=178209 Reviewed by Wenson Hsieh. Use the ASSERT_UNUSED to silence it. * dom/DataTransfer.cpp: (WebCore::DataTransfer::filesFromPasteboardAndItemList const): 2017-10-15 Sam Weinig [Settings] Split non-macro generated parts of Settings into SettingsBase base class https://bugs.webkit.org/show_bug.cgi?id=178321 Reviewed by Darin Adler. Working towards getting generated Settings working again, but in smaller patches, split non-generated part off into SettingsBase as a first step. One function, effectiveFrameFlattening(), needs to remain in Settings for now, as it directly references a macro generated function, frameFlattening(). * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * page/Page.h: * page/Settings.cpp: * page/Settings.h: * page/SettingsBase.h: Copied from Source/WebCore/page/Settings.h. * page/cocoa/SettingsBaseCocoa.mm: Copied from Source/WebCore/page/cocoa/SettingsCocoa.mm. * page/cocoa/SettingsCocoa.mm: Removed. 2017-10-15 Yusuke Suzuki [JSC] Perform module specifier validation at parsing time https://bugs.webkit.org/show_bug.cgi?id=178256 Reviewed by Darin Adler. No behavior change in the current implementation. * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderResolve): * bindings/js/JSDOMWindowBase.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::resolve): * bindings/js/ScriptModuleLoader.h: 2017-10-15 Chris Dumez DOMTokenList shouldn't add empty attributes https://bugs.webkit.org/show_bug.cgi?id=178280 Reviewed by Ryosuke Niwa. Follow-up to r223306, reverse the check conditions to avoid attribute lookup when possible. Also use m_tokens instead of tokens() to avoid unnecessary branch. * html/DOMTokenList.cpp: (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens): 2017-10-15 Darin Adler UTF-8 decoding produces one replacement character per byte; Encoding standard requires one replacement character per illegal sequence instead https://bugs.webkit.org/show_bug.cgi?id=178207 Reviewed by Sam Weinig. * platform/text/TextCodecUTF8.cpp: (WebCore::TextCodecUTF8::create): Deleted. Use a lambda instead. (WebCore::TextCodecUTF8::registerCodecs): Use a lambda. (WebCore::nonASCIISequenceLength): Changed to return 0 instead of 2 for the range 80-C1 since none of those are valid sequence leading characters. (WebCore::decodeNonASCIISequence): Changed the length argument to be in/out so the caller knows how much of the sequence we decoded for failure cases. Simplified the length 2 section. (WebCore::TextCodecUTF8::handleError): Deleted. (WebCore::TextCodecUTF8::handlePartialSequence): Changed this into a pair of plain functions rather than two template function specializations since the two functions are rather different. For the one-byte version, got rid of the unused arguments. For the two-byte version, got rid of the ignored return value, stopped using the handleError function since each error case needs to be handled differently. In each error case consume the entire incorrect sequence instead of just one byte. (WebCore::TextCodecUTF8::decode): Updated for the above change, and changed the non-partial incorrect sequence to consume the entire incorrect sequence instead of just one byte. Also use WTF prefixes explicitly so we don't have to do "using namespace". (WebCore::TextCodecUTF8::encode): Got rid of unneeded type punning, and added some inline capacity to save one memory allocation when encoding shorter strings. * platform/text/TextCodecUTF8.h: Use pragma once. Intialize m_partialSequenceSize where it is defined and let the compiler generate the constructor. Updated for the changes above. * platform/text/TextEncoding.h: Export a constructor now used by a unit test. * platform/text/TextEncodingRegistry.h: Export newTextCodec, now used by a unit test. 2017-10-14 Antoine Quint Remove all Web Animations code https://bugs.webkit.org/show_bug.cgi?id=178273 Reviewed by Sam Weinig. We remove all existing code related to Web Animations which does not include any functionality, only stubs. This leaves the build and runtime flags, we'll start a complete implementation from scratch. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * animation/Animatable.idl: Removed. * animation/AnimationEffect.cpp: Removed. * animation/AnimationEffect.h: Removed. * animation/AnimationEffect.idl: Removed. * animation/AnimationTimeline.cpp: Removed. * animation/AnimationTimeline.h: Removed. * animation/AnimationTimeline.idl: Removed. * animation/DocumentAnimation.cpp: Removed. * animation/DocumentAnimation.h: Removed. * animation/DocumentAnimation.idl: Removed. * animation/DocumentTimeline.cpp: Removed. * animation/DocumentTimeline.h: Removed. * animation/DocumentTimeline.idl: Removed. * animation/KeyframeEffect.cpp: Removed. * animation/KeyframeEffect.h: Removed. * animation/KeyframeEffect.idl: Removed. * animation/WebAnimation.cpp: Removed. * animation/WebAnimation.h: Removed. * animation/WebAnimation.idl: Removed. * bindings/js/JSAnimationTimelineCustom.cpp: Removed. * bindings/js/JSBindingsAllInOne.cpp: * bindings/js/WebCoreBuiltinNames.h: * dom/Element.cpp: (WebCore::Element::getAnimations): Deleted. * dom/Element.h: * dom/Element.idl: 2017-10-14 Devin Rousso Web Inspector: provide a way to enable/disable event listeners https://bugs.webkit.org/show_bug.cgi?id=177451 Reviewed by Joseph Pecoraro. Test: inspector/dom/setEventListenerDisabled.html * dom/EventTarget.cpp: (WebCore::EventTarget::fireEventListeners): Add InspectorInstrumentation call to isEventListenerDisabled. If true, the event listener's callback will not be called. * inspector/InspectorDOMAgent.h: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::discardBindings): (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setEventListenerDisabled): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::willRemoveEventListener): (WebCore::InspectorDOMAgent::isEventListenerDisabled): Introduce a mapping of `EventListener*` to `InspectorEventListener`, a struct for uniquely identifying event listeners so they can be referenced from the frontend. We only add items to this mapping when `getEventListenersForNode` is called, as that is when EventListener data is sent to the frontend. This allows us to defer creating an Inspector "mirror" object for each EventListener until it is needed. Items are removed whenever an event listener is removed or when the document changes. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::isEventListenerDisabled): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::willRemoveEventListenerImpl): (WebCore::InspectorInstrumentation::isEventListenerDisabledImpl): Pass additional parameters to InspectorDOMAgent so it can determine if the event listener actually exists. If not, don't dispatch an event to the frontend as nothing will change. 2017-10-14 Sam Weinig Remove HashCountedSet's copyToVector functions https://bugs.webkit.org/show_bug.cgi?id=178215 Reviewed by Daniel Bates. * page/DeviceController.cpp: (WebCore::DeviceController::dispatchDeviceEvent): (WebCore::DeviceController::fireDeviceEvent): Replace use of HashCountedSet's copyToVector functions with copyToVector(hashCountedSet.values()). 2017-10-13 Jer Noble Performance: Skip texture upload if source image and destination texture haven't changed https://bugs.webkit.org/show_bug.cgi?id=178254 Reviewed by Dean Jackson. Update GraphicsContext3D to track which texture is bound to which texture unit, and also to track when those bound textures have their backing stores modified. This new "seed" value will be used to determine whether a given texture which has previously had image data uploaded to it needs to be re-updated. In VideoTextureCopierCV, track whether the texture's seed changed, whether the IOSurface is the same, whether the IOSurface's seed has changed, and whether the "flipY" parameter changed since the last time the copier was asked to upload to the texture. * platform/graphics/GraphicsContext3D.h: (WebCore::GraphicsContext3D::textureSeed): (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture): (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture): (WebCore::GraphicsContext3D::GraphicsContext3DState::setBoundTexture): * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): * platform/graphics/cv/VideoTextureCopierCV.h: (WebCore::VideoTextureCopierCV::lastTextureSeed): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::prepareTexture): (WebCore::GraphicsContext3D::bindTexture): (WebCore::GraphicsContext3D::texStorage2D): (WebCore::GraphicsContext3D::texStorage3D): (WebCore::GraphicsContext3D::framebufferTexture2D): (WebCore::GraphicsContext3D::texSubImage2D): (WebCore::GraphicsContext3D::compressedTexImage2D): (WebCore::GraphicsContext3D::compressedTexSubImage2D): (WebCore::GraphicsContext3D::createTexture): (WebCore::GraphicsContext3D::deleteTexture): (WebCore::GraphicsContext3D::texImage2DDirect): 2017-10-13 Per Arne Vollan [Win] When built with VS2017, MiniBrowser crashes on startup. https://bugs.webkit.org/show_bug.cgi?id=175209 Reviewed by Daniel Bates. Generated StaticStringImpl objects are not initialized compile-time with VS2017. When compiling with VS2017, the global, static, StaticStringImpl objects needs to be defined with the constexpr specifier, in order for the objects to be initialized at compile time. Since the StaticStringImpl objects will be const then, we need to be able to create an AtomicString object from a const StaticStringImpl object. This constructor has been added to the AtomicString class. No new tests, covered by existing tests. * bindings/scripts/StaticString.pm: (GenerateStrings): (GenerateStringAsserts): * dom/QualifiedName.cpp: (WebCore::createQualifiedName): * dom/QualifiedName.h: * dom/make_names.pl: (printDefinitions): 2017-10-13 Brent Fulgham Protect FrameView during style calculations https://bugs.webkit.org/show_bug.cgi?id=178300 Reviewed by Ryosuke Niwa. Protect the FrameView during layout and style updates in case arbitrary script is run that might clear it. Test: fast/html/marquee-reparent-check.html * page/FrameView.cpp: (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): 2017-10-13 Per Arne Vollan Crash under ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData https://bugs.webkit.org/show_bug.cgi?id=178279 Reviewed by Alex Christensen. Check if the connection is valid before calling ResourceHandleClient::didSendData. No new tests, covered by existing tests. * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData): 2017-10-13 Brent Fulgham CMD+R / CMD+Q keyboard shortcuts are treated as user interaction with page https://bugs.webkit.org/show_bug.cgi?id=178183 Reviewed by Ryosuke Niwa. Key events are granted user interaction credit (in terms of updating the last time of user interaction), even if the key event was not handled. Instead, we should defer granting access until the key event has been handled. Add a new default constructor argument to UserGestureIndicator to be used when handling key events, so we can delay a decision about whether to grant ResourceLoadStatistics 'hasHadUserInteraction' until we confirm that the event was handled by the page. This change does not affect other aspects of user interaction. Tests: fast/events http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown.html * dom/UserGestureIndicator.cpp: (WebCore::UserGestureIndicator::UserGestureIndicator): Add check based on constructor argument. Also: Drive by fix to avoid calling 'currentToken' when not on the main thread. * dom/UserGestureIndicator.h: * page/EventHandler.cpp: (WebCore::EventHandler::keyEvent): If the key event was handled, grant user interaction credit for ResourceLoadStatistics processing. (WebCore::EventHandler::internalKeyEvent): Use the new UserGestureIndicator constructor argument. 2017-10-13 Chris Dumez DOMTokenList shouldn't add empty attributes https://bugs.webkit.org/show_bug.cgi?id=178280 Reviewed by Ryosuke Niwa. DOMTokenList shouldn't add empty attributes after: - https://github.com/whatwg/dom/pull/488 Firefox and Chrome follow the latest spec. No new tests, updating existing test. * html/DOMTokenList.cpp: (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens): Implement the first step of https://dom.spec.whatwg.org/#concept-dtl-update 2017-10-13 Jer Noble Unreviewed build fix; wrap more functions in USE(IOSURFACE) so that they do not generate "unused function" errors. * platform/graphics/cv/VideoTextureCopierCV.cpp: 2017-10-13 Jer Noble One last unreviewed build fix; since the IOSurface APIs don't exist at all on the simulator, just wrap the entirety of the implementation of copyImageToPlatformTexture() in a #if USE(IOSURFACE) check. * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): 2017-10-13 Jer Noble Unreviewed build fix for the previous build fix; use the right PAL path for IOSurfaceSPI.h. * platform/graphics/cv/VideoTextureCopierCV.cpp: 2017-10-13 Jer Noble Unreviewed build fix; add definitions for IOSurface methods missing on some platforms. * platform/graphics/cv/VideoTextureCopierCV.cpp: 2017-10-13 Alex Christensen Remove Editor::simplifyMarkup https://bugs.webkit.org/show_bug.cgi?id=178271 Reviewed by Wenson Hsieh. An API test became flaky, and it turns out this isn't used anywhere, so let's remove it! It was used in Mountain Lion, Mavericks, and Yosemite, but not since then. See * editing/Editor.cpp: (WebCore::Editor::simplifyMarkup): Deleted. * editing/Editor.h: 2017-10-13 Jer Noble Unreviewed build fix; forward declare the type of IOSurfaceRef. * platform/cocoa/CoreVideoSoftLink.cpp: * platform/cocoa/CoreVideoSoftLink.h: 2017-10-13 Jer Noble Unreviewed build fix; add soft link macros for newly called CoreVideo methods. * platform/cocoa/CoreVideoSoftLink.cpp: * platform/cocoa/CoreVideoSoftLink.h: 2017-10-13 Jer Noble Unreviewed build fix; add UNUSED_PARAM macros. * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::GraphicsContext3D::texImageIOSurface2D): 2017-10-13 Jer Noble Performance: do pixel conformance and texturing in a single step. https://bugs.webkit.org/show_bug.cgi?id=178219 Reviewed by Dean Jackson. No new tests; performance improvements should have no behavior change. Rather than asking the VTDecompressionSession to conform the output CVPixelBuffer into a pixel format compatible with OpenGL (& ES), don't constrain the output at all, and only do a conformance step if the output is not already compatible with OpenGL. This eliminates one copy (in hardware) operation. Move the TextureCacheCV object into VideoTextureCopierCV; it will be conditionally used to create the texture if the pixel buffer is compatible. Refactor copyVideoTextureToPlatformTexture(CVOpenGLTextureRef) in VideoTextureCopierCV. The new entry point, copyImageToPlatformTexture(), will attempt to use the texture cache first, and call a new common copyVideoTextureToPlatformTexture(Platform3DObject) with the result. The new copyImageToPlatformTexture() will pull planar YUV frames into two textures, and combine the two with a color transfer function when drawing to the output texture. * platform/graphics/GraphicsContext3D.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::copyVideoTextureToPlatformTexture): * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: (WebCore::GraphicsContext3D::texImageIOSurface2D): * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample): * platform/graphics/cv/TextureCacheCV.h: * platform/graphics/cv/TextureCacheCV.mm: (WebCore::TextureCacheCV::textureFromImage): * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::pixelRangeFromPixelFormat): (WebCore::transferFunctionFromString): (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction): (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV): (WebCore::VideoTextureCopierCV::initializeUVContextObjects): (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): * platform/graphics/cv/VideoTextureCopierCV.h: 2017-10-13 Romain Bellessort [Readable Streams API] Align queue with spec for ReadableStreamDefaultController https://bugs.webkit.org/show_bug.cgi?id=178082 Reviewed by Xabier Rodriguez-Calvar. Implemented new queue behavior for dequeueValue (used by ReadableStreamDefaultController), which fixes rounding errors (as described in https://github.com/whatwg/streams/pull/661). Also aligned ReadableByteStreamController queue so that both queues are implemented in the same way. No new tests (covered by existing tests, especially WPT tests that now pass). * Modules/streams/ReadableByteStreamInternals.js: (privateInitializeReadableByteStreamController): Aligned queue with RSDC. (readableByteStreamControllerCancel): Aligned queue with RSDC. (readableByteStreamControllerError): Aligned queue with RSDC. (readableByteStreamControllerClose): Aligned queue with RSDC. (readableByteStreamControllerHandleQueueDrain): Aligned queue with RSDC. (readableByteStreamControllerPull): Aligned queue with RSDC. (readableByteStreamControllerEnqueue): Aligned queue with RSDC. (readableByteStreamControllerEnqueueChunk): Aligned queue with RSDC. (readableByteStreamControllerProcessPullDescriptors): Aligned queue with RSDC. (readableByteStreamControllerFillDescriptorFromQueue): Aligned queue with RSDC. (readableByteStreamControllerPullInto): Aligned queue with RSDC. * Modules/streams/StreamInternals.js: (dequeueValue): Updated to match spec. * bindings/js/WebCoreBuiltinNames.h: Removed now useless "totalQueuedBytes". 2017-10-13 Wenson Hsieh "text/html" data is not exposed when dragging and dropping across origins https://bugs.webkit.org/show_bug.cgi?id=178253 Reviewed by Ryosuke Niwa. Minor tweak to DataTransfer::setDataFromItemList to allow "text/html" written from bindings to transfer across origins without requiring a sanitized representation. Currently, sanitizedData is null, which limits "text/html" to being treated as custom data, inaccessible across origins. We should instead treat markup supplied via bindings the same way as we do "text/plain" supplied via bindings. Modified Tests: editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html * dom/DataTransfer.cpp: (WebCore::DataTransfer::setDataFromItemList): 2017-10-12 Brady Eidson SW "Hello world". https://bugs.webkit.org/show_bug.cgi?id=178187 Reviewed by Andy Estes. No new tests (Covered by changes to existing tests). With this patch, SW scripts are actually compiled and run inside a ServiceWorkerGlobalScope environment in the SW context process. * WebCore.xcodeproj/project.pbxproj: * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::initScript): * dom/EventTargetFactory.in: * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::isServiceWorkerGlobalScope const): * workers/service/ServiceWorkerContextData.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp. (WebCore::ServiceWorkerContextData::isolatedCopy const): * workers/service/ServiceWorkerContextData.h: (WebCore::ServiceWorkerContextData::encode const): (WebCore::ServiceWorkerContextData::decode): * workers/service/ServiceWorkerGlobalScope.cpp: (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope): (WebCore::ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope): (WebCore::ServiceWorkerGlobalScope::registration): (WebCore::ServiceWorkerGlobalScope::eventTargetInterface const): * workers/service/ServiceWorkerGlobalScope.h: (WebCore::ServiceWorkerGlobalScope::create): (WebCore::ServiceWorkerGlobalScope::serverConnectionIdentifier const): * workers/service/context/SWContextManager.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp. (WebCore::SWContextManager::singleton): (WebCore::SWContextManager::SWContextManager): (WebCore::SWContextManager::startServiceWorkerContext): * workers/service/context/SWContextManager.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h. * workers/service/context/ServiceWorkerThread.cpp: Added. (WebCore::ServiceWorkerThreadProxy::sharedDummyProxy): (WebCore::ServiceWorkerThread::ServiceWorkerThread): (WebCore::m_workerObjectProxy): (WebCore::ServiceWorkerThread::~ServiceWorkerThread): (WebCore::ServiceWorkerThread::createWorkerGlobalScope): (WebCore::ServiceWorkerThread::runEventLoop): * workers/service/context/ServiceWorkerThread.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h. (WebCore::ServiceWorkerThread::create): (WebCore::ServiceWorkerThread::workerObjectProxy const): * workers/service/server/SWServer.cpp: (WebCore::SWServer::createWorker): 2017-10-12 Alex Christensen Use asynchronous ResourceHandleClient calls for WebKit1 https://bugs.webkit.org/show_bug.cgi?id=160677 Reviewed by Brady Eidson. Covered by existing tests. * PlatformAppleWin.cmake: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::willSendRequestAsync): (WebCore::ResourceLoader::didReceiveResponseAsync): (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): * loader/ResourceLoader.h: * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didReceiveResponseAsync): (WebCore::ApplicationCacheGroup::willSendRequestAsync): (WebCore::ApplicationCacheGroup::canAuthenticateAgainstProtectionSpaceAsync): (WebCore::ApplicationCacheGroup::didReceiveResponse): Deleted. * loader/appcache/ApplicationCacheGroup.h: * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::continueDidReceiveResponse): (WebCore::BlobResourceHandle::getSizeForNext): (WebCore::BlobResourceHandle::notifyResponseOnSuccess): (WebCore::BlobResourceHandle::notifyResponseOnError): * platform/network/PingHandle.h: * platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::didReceiveResponse): (WebCore::ResourceHandle::usesAsyncCallbacks): Deleted. * platform/network/ResourceHandle.h: * platform/network/ResourceHandleClient.cpp: (WebCore::ResourceHandleClient::~ResourceHandleClient): (WebCore::ResourceHandleClient::willSendRequest): Deleted. (WebCore::ResourceHandleClient::willSendRequestAsync): Deleted. (WebCore::ResourceHandleClient::didReceiveResponseAsync): Deleted. (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync): Deleted. * platform/network/ResourceHandleClient.h: (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge): (WebCore::ResourceHandleClient::didReceiveResponse): Deleted. (WebCore::ResourceHandleClient::usesAsyncCallbacks): Deleted. (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpace): Deleted. * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/SynchronousLoaderClient.cpp: (WebCore::SynchronousLoaderClient::willSendRequestAsync): (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync): (WebCore::SynchronousLoaderClient::didReceiveResponseAsync): (WebCore::SynchronousLoaderClient::didFinishLoading): (WebCore::SynchronousLoaderClient::didFail): (WebCore::SynchronousLoaderClient::willSendRequest): Deleted. (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace): Deleted. (WebCore::SynchronousLoaderClient::didReceiveResponse): Deleted. * platform/network/SynchronousLoaderClient.h: * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::ResourceHandle::createCFURLConnection): (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::willSendRequest): (WebCore::ResourceHandle::shouldUseCredentialStorage): (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace): (WebCore::ResourceHandle::platformLoadResourceSynchronously): * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::releaseHandle): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace): (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace): * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Removed. * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: Removed. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::start): (WebCore::ResourceHandle::schedule): (WebCore::ResourceHandle::makeDelegate): (WebCore::ResourceHandle::delegate): (WebCore::ResourceHandle::platformLoadResourceSynchronously): (WebCore::ResourceHandle::willSendRequest): (WebCore::ResourceHandle::continueWillSendRequest): (WebCore::ResourceHandle::continueDidReceiveResponse): (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace): (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace): (WebCore::ResourceHandle::continueWillCacheResponse): (WebCore::ResourceHandle::shouldUseCredentialStorage): Deleted. * platform/network/mac/WebCoreResourceHandleAsDelegate.h: Removed. * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Removed. * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): 2017-10-12 Chris Dumez [Mac] Add support for MouseEvent.buttons https://bugs.webkit.org/show_bug.cgi?id=178214 Reviewed by Ryosuke Niwa. Add support for MouseEvent.buttons on Mac as per: - https://www.w3.org/TR/uievents/#ref-for-dom-mouseevent-buttons-1 This is supported by Firefox and Chrome already. No new tests, rebaselined existing test. * dom/Element.cpp: (WebCore::Element::dispatchMouseEvent): * dom/MouseEvent.cpp: (WebCore::MouseEvent::create): (WebCore::MouseEvent::MouseEvent): * dom/MouseEvent.h: (WebCore::MouseEvent::buttons const): * dom/MouseEvent.idl: * dom/MouseEventInit.h: * dom/MouseEventInit.idl: * dom/SimulatedClick.cpp: * dom/WheelEvent.cpp: * page/EventHandler.cpp: (WebCore::EventHandler::dispatchDragEvent): * platform/PlatformMouseEvent.h: (WebCore::PlatformMouseEvent::buttons const): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::currentlyPressedMouseButtons): (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): 2017-10-12 David Kilzer [iOS] Fix -Wunused-lambda-capture warnings in WebCore/WebKit with new clang compiler Reviewed by Chris Fleizach. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityArticleAncestor]): - Remove unused lambda variable 'self'. 2017-10-12 Daniel Bates Mark more InlineBox member functions as const https://bugs.webkit.org/show_bug.cgi?id=178217 Reviewed by Andy Estes. * rendering/InlineBox.cpp: (WebCore::InlineBox::locationIncludingFlipping const): Mark as const. Also fix some style nits while I am here. (WebCore::InlineBox::flipForWritingMode const): Mark as const. (WebCore::InlineBox::locationIncludingFlipping): Deleted. (WebCore::InlineBox::flipForWritingMode): Deleted. * rendering/InlineBox.h: 2017-10-12 Daniel Bates Teach InlineTextBox::clampOffset() about combined text and hyphenation https://bugs.webkit.org/show_bug.cgi?id=178032 Reviewed by Zalan Bujtas. Treat combined text and the last character of a word halve plus hyphen as single units. With regards to combined text, ideally we would allow arbitrary selection inside combined text. Currently we do not support selection of combined text. To simplify the process of adding support for selecting combined text we treat combined text as a single unit. Once we are confident that we correctly implemented such support we can re-evaluate allowing arbitrary selection of combined text. With regards to treating the last character of a word halve plus hyphen as a single unit. This patch extends the targeted fix made for document markers in r223013 to all code that makes use of clamped offsets as a result the selection rect for inline boxes more accurately reflect the rectangle(s) that make up the painted selection. This is a step towards reconciling the difference between the computation of the rectangle that represents an arbitrary selection and the code that paints the active selection as part of . * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::localSelectionRect const): Compute text run, including combined text or hyphens due to line wrapping now that specified start and end positions are clamped with respect to combined text and hyphens (computed earlier in this function). Only measure the text represented by the selection if the start position > 0 or the end position is not equal to the length of the run. (WebCore::InlineTextBox::paint): Remove unnecessary code to fix up the selection start and end positions based on the truncation offset as this is done by clampedOffset(), called by selectionStartEnd(). (WebCore::InlineTextBox::clampedOffset const): Modified to adjust the clamped offset with respect to truncation as well as treat combined text or a trailing word halve plus hyphen as single units. Assert that we are not fully truncated because it does not make sense to be computing the clamped offset in such a situation since nothing should be painted. (WebCore::InlineTextBox::selectionStartEnd const): Modified to compute the end of an inside selection using clampedOffset() to account for truncation, combined text or a hyphen. We already are using clampedOffset() when computing the start and end position for all other selection states. (WebCore::InlineTextBox::paintSelection): Compute text run, including combined text or hyphens due to line wrapping now that specified start and end positions are clamped with respect to combined text and hyphens (computed earlier in this function). Remove unnecessary code to adjust selection end point with respect to truncation, combined text, or an added hyphen now that selectionStartEnd() takes care of this (via clampedOffset()). (WebCore::InlineTextBox::paintTextSubrangeBackground): Compute text run, including combined text or hyphens due to line wrapping now that specified start and end positions are clamped with respect to combined text and hyphens (computed earlier in this function). (WebCore::InlineTextBox::paintDocumentMarker): Compute text run, including combined text now that specified start and end positions are clamped with respect to combined text (computed earlier in this function). Also remove unnecessary code to adjust end offset of the marker with respect to truncation and length of the text run as clampedOffset() now does this for us. 2017-10-11 Simon Fraser Don't assert if mix-blend-mode is set to a non-separable blend mode on a composited layer https://bugs.webkit.org/show_bug.cgi?id=178196 rdar://problem/34942337 Reviewed by Dan Bates. Core Animation doesn't support non-separable blend modes (hue, saturation, color, luminosity) on layers, but don't assert if we try to use them. Test: compositing/filters/blend-mode-saturation.html * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (PlatformCAFilters::setBlendingFiltersOnLayer): 2017-10-12 John Wilander ResourceLoadObserver::logFrameNavigation() should use redirectResponse.url() https://bugs.webkit.org/show_bug.cgi?id=175257 Reviewed by Brent Fulgham. This patch was joint work between Michael Specter and John Wilander. Tests: http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::willSendRequest): Now sends redirectResponse.url() to WebCore::ResourceLoadObserver::logFrameNavigation(). * loader/ResourceLoadObserver.cpp: (WebCore::ResourceLoadObserver::logFrameNavigation): Now receives the redirect response URL from WebCore::DocumentLoader(). (WebCore::ResourceLoadObserver::nonNullOwnerURL const): New function to traverse the frame chain upward and find the first non-null URL. * loader/ResourceLoadObserver.h: 2017-10-12 Frederic Wang Use less specific cast in ScrollingTree::scrollPositionChangedViaDelegatedScrolling https://bugs.webkit.org/show_bug.cgi?id=178211 Reviewed by Simon Fraser. No new tests, behavior is not changed. ScrollingTree::scrollPositionChangedViaDelegatedScrolling is a generic function that applies to scrolling nodes. Casting to more specific ScrollingTreeOverflowScrollingNodes is however not necessary to implement it. This patch moves to the least specific cast necessary so that this function will be usable for async scrolling of non-main frames in the future. Note that the function is currently only called from ScrollingTreeScrollingNodeDelegateIOS which in turn is only used by the ScrollingTreeScrollingOverflowNodeIOS class and so code behavior is not changed. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Only cast the node to ScrollingTreeScrollingNode. 2017-10-11 Sam Weinig Remove out-parameter variants of copyToVector https://bugs.webkit.org/show_bug.cgi?id=178155 Reviewed by Tim Horton. * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::stopTimersForOneShots): (WebCore::Geolocation::cancelAllRequests): (WebCore::Geolocation::handleError): (WebCore::Geolocation::makeSuccessCallbacks): * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::transaction): * Modules/indexeddb/IDBGetAllResult.cpp: (WebCore::IDBGetAllResult::allBlobFilePaths const): * Modules/indexeddb/server/MemoryIndex.cpp: (WebCore::IDBServer::MemoryIndex::notifyCursorsOfValueChange): (WebCore::IDBServer::MemoryIndex::notifyCursorsOfAllRecordsChanged): * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::dispatchInvalidationCallbacks): * dom/Document.cpp: (WebCore::Document::moveNodeIteratorsToNewDocument): (WebCore::Document::resume): (WebCore::Document::didAssociateFormControlsTimerFired): * dom/IdTargetObserverRegistry.cpp: (WebCore::IdTargetObserverRegistry::notifyObserversInternal): * dom/MutationObserver.cpp: (WebCore::MutationObserver::notifyMutationObservers): * dom/Node.cpp: (WebCore::Document::invalidateNodeListAndCollectionCaches): * dom/RadioButtonGroups.cpp: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::dispatchMessagePortEvents): (WebCore::ScriptExecutionContext::stopActiveDOMObjects): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): (WebCore::ApplicationCacheGroup::deliverDelayedMainResources): * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::forEachResource): (WebCore::MemoryCache::pruneDeadResourcesToSize): * page/DOMWindow.cpp: (WebCore::DOMWindow::willDestroyCachedFrame): (WebCore::DOMWindow::willDestroyDocumentInFrame): (WebCore::DOMWindow::willDetachDocumentFromFrame): (WebCore::DOMWindow::disconnectDOMWindowProperties): (WebCore::DOMWindow::reconnectDOMWindowProperties): * page/FrameView.cpp: (WebCore::collectAndProtectWidgets): * page/MemoryRelease.cpp: (WebCore::releaseCriticalMemory): * page/Performance.cpp: (WebCore::Performance::queueEntry): * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::typesForLegacyUnsafeBindings): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::systemFontFamilies): * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): * platform/ios/WebCoreMotionManager.mm: (-[WebCoreMotionManager sendAccelerometerData:]): (-[WebCoreMotionManager sendMotionData:withHeading:]): * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSession invalidateAndCancel]): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction): * rendering/RenderBlockLineLayout.cpp: (WebCore::setLogicalWidthForTextRun): * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::FlexBoxIterator::next): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::paintObject): Replace out-parameter based copyToVector, with one that returns a Vector. 2017-10-12 Yusuke Suzuki Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. 2017-10-12 Tomas Popela Unreviewed, fix compilation warning warning: extra tokens at end of #endif directive [-Wendif-labels] * rendering/RenderMediaControls.h: 2017-10-11 Brent Fulgham Correct nullptr deref in selection handling. https://bugs.webkit.org/show_bug.cgi?id=178189 Reviewed by Ryosuke Niwa. The VisibleSelection::toNormalizedRange returns nullptr for certain conditions (e.g., 'isNone' and 'isOrphaned' cases). It's possible to crash the WebProcess by executing a code path with an orphaned selection range. The return value of 'toNormalizedRange' is checked for nullptr in many places, but not everywhere. This patch adds those missing nullptr checks. * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]): * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss): * editing/EditingStyle.cpp: (WebCore::EditingStyle::styleAtSelectionStart): * editing/Editor.cpp: (WebCore::Editor::misspelledWordAtCaretOrRange const): * page/DOMSelection.cpp: (WebCore::DOMSelection::containsNode const): * page/DragController.cpp: (WebCore::DragController::concludeEditDrag): 2017-10-11 Ryan Haddad Unreviewed, rolling out r223215. This change broke the Sierra build. Reverted changeset: "[Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact" https://bugs.webkit.org/show_bug.cgi?id=178191 https://trac.webkit.org/changeset/223215 2017-10-11 Chris Dumez XMLHttpRequest: do not sniff text/html, and do not sniff XML when responseType is set to "text" https://bugs.webkit.org/show_bug.cgi?id=168724 Reviewed by Ryosuke Niwa. WebKit enabled HTML / XML charset detection for HTML-ish / XML-ish responses even when response type is text, which does not match the specification. This patch is based on the following Blink patch by Yutaka Hirano : - https://chromium.googlesource.com/chromium/src.git/+/47e4fc53e6d68c0a788fcc26de598b9e3848033f Tests: imported/w3c/web-platform-tests/XMLHttpRequest/responsetext-decoding.htm imported/w3c/web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createDecoder const): (WebCore::XMLHttpRequest::didReceiveData): * xml/XMLHttpRequest.h: 2017-10-11 Andy Estes [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact https://bugs.webkit.org/show_bug.cgi?id=178191 Reviewed by Tim Horton. Added test cases to http/tests/ssl/applepay/ApplePaySession.html. * Modules/applepay/ApplePayPaymentContact.h: * Modules/applepay/ApplePayPaymentContact.idl: * Modules/applepay/cocoa/PaymentContactCocoa.mm: (WebCore::convert): 2017-10-11 Youenn Fablet Add API to clean CacheStorage data https://bugs.webkit.org/show_bug.cgi?id=178034 Reviewed by Chris Dumez. Test: http/tests/cache-storage/cache-clearing.https.html * platform/FileSystem.h: 2017-10-11 David Kilzer Part 2: Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler Reviewed by Chris Dumez. * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::WorkerCacheStorageConnection::doRemove): - Change ASSERT() to ASSERT_UNUSED() to suppress warnings about unused lambda capture for 'cacheIdentifier' in Release builds. * bridge/objc/objc_class.mm: (JSC::Bindings::ObjcClass::classForIsA): Change C-style cast into reinterpret_cast and const_cast to go from CFTypeRef to ObjcClass*. * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::castDataArgumentToCCRSACryptorCreateFromDataIfNeeded): Add. Introduce method to add a required const_cast for older OSes since the signature of CCRSACryptorCreateFromData() changed in iOS 11 & High Sierra. (WebCore::CryptoKeyRSA::create): Use castDataArgumentToCCRSACryptorCreateFromDataIfNeeded(). * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Remove unused lambda capture for 'status'. 2017-10-11 Chris Dumez [Geolocation] Expose Coordinates.floorLevel https://bugs.webkit.org/show_bug.cgi?id=178173 Reviewed by Ryosuke Niwa. Expose Coordinates.floorLevel via the Geolocation API. This is currently a WebKit-specific extension and it is only populated on iOS / WKTR / DRT. It is null on other platforms. Test: fast/dom/Geolocation/floorLevel.html * Modules/geolocation/Coordinates.h: (WebCore::Coordinates::floorLevel const): * Modules/geolocation/Coordinates.idl: * Modules/geolocation/GeolocationPosition.h: (WebCore::GeolocationPosition::encode const): (WebCore::GeolocationPosition::decode): * Modules/geolocation/ios/GeolocationPositionIOS.mm: (WebCore::GeolocationPosition::GeolocationPosition): * page/Settings.in: 2017-10-11 Simon Fraser Avoid triggering layout from style change https://bugs.webkit.org/show_bug.cgi?id=178184 rdar://problem/34699113 Reviewed by Zalan Bujtas. It's bad for RenderBox::styleDidChange() to scroll RenderLayers, because that can trigger layout via FrameView::updateWidgetPositions() and ScrollingCoordinator::absoluteEventTrackingRegions(). So postpone the scrolling until after layout. Test: fast/scrolling/adjust-scroll-offset-on-zoom.html * rendering/RenderBox.cpp: (WebCore::RenderBox::styleDidChange): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateLayerPositions): (WebCore::RenderLayer::setPostLayoutScrollPosition): (WebCore::RenderLayer::applyPostLayoutScrollPositionIfNeeded): * rendering/RenderLayer.h: 2017-10-11 Youenn Fablet Bump default cache storage quota to 20MB https://bugs.webkit.org/show_bug.cgi?id=178132 Reviewed by Alex Christensen. Covered by http/wpt/cache-storage/cache-quota.any.html. * platform/network/NetworkStorageSession.h: (WebCore::NetworkStorageSession::cacheStoragePerOriginQuota const): (WebCore::NetworkStorageSession::setCacheStoragePerOriginQuota): 2017-10-11 Myles C. Maxfield Allow PAL to log messages https://bugs.webkit.org/show_bug.cgi?id=171523 Reviewed by Alex Christensen. Make the model of WebCore/PAL match the model of WebKit/WebCore. This is because PAL will need to log things (because existing files in WebCore/platform need to log things). No new tests because there is no behavior change. * WebCore.xcodeproj/project.pbxproj: * page/mac/PageMac.mm: (WebCore::Page::platformInitialize): * platform/Logging.cpp: (WebCore::registerNotifyCallback): Deleted. * platform/Logging.h: * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForWithReason): 2017-10-11 Chris Dumez Unreviewed, fix build with some SDKs. Stop capturing |this| unnecessarily in lambda. * Modules/entriesapi/FileSystemDirectoryEntry.cpp: (WebCore::FileSystemDirectoryEntry::getEntry): 2017-10-11 Chris Dumez Unreviewed, fix build with some SDKs. Stop capturing |this| unnecessarily in lambda. * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::getFile): 2017-10-11 Daniel Bates Extract logic to paint composition underlines to its own function https://bugs.webkit.org/show_bug.cgi?id=178038 Reviewed by Zalan Bujtas. No functionality changed. So, no new tests. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paint): Modified to call paintCompositionUnderlines(). (WebCore::InlineTextBox::paintCompositionUnderlines const): Added; extract code from InlineTextBox::paint() and modernized it. (WebCore::InlineTextBox::paintCompositionUnderline const): Added. (WebCore::InlineTextBox::paintCompositionUnderline): Deleted; made const. * rendering/InlineTextBox.h: 2017-10-11 Daniel Bates InlineTextBox::isSelected() should only return true for a non-empty selection and remove incorrect FIXME from InlineTextBox::localSelectionRect() https://bugs.webkit.org/show_bug.cgi?id=160786 Reviewed by Zalan Bujtas. Partial revert of r204400 in InlineTextBox::{isSelected, localSelectionRect}(). The function InlineTextBox::isSelected() should only return true for a non-empty selection. Also remove an incorrect FIXME added to InlineTextBox::localSelectionRect() that questioned whether it was correct for it to return an empty rectangle. It is correct for it to return such a rectangle because this function is used to implement Element.getClientRects(). And Element.getClientRects() can return a rectangle with zero width or zero height by step 3 of algorithm getClientRects() of section Extensions to the Element interface of the CSSOM View Module spec., (Editor's Draft, 15 September 2017). * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::isSelected const): Only return true for a non-empty selection and remove unnecessary FIXME. Also rename variables to improve readability. (WebCore::InlineTextBox::localSelectionRect const): Remove inaccurate FIXME comment. * rendering/InlineTextBox.h: 2017-10-11 Ryosuke Niwa Sanitize URL in pasteboard for other applications and cross origin content https://bugs.webkit.org/show_bug.cgi?id=178060 Reviewed by Wenson Hsieh. This patch introduces the sanitization of URL when written from a web content to prevent web content from exploiting the URL parser of other applications in the system particularly of those that actively monitor system pasteboard (a.k.a. clipboard on non-Cocoa platforms) and decode or otherwise process URLs. Because the Web compatibility requires that DataTransfer exposes the original URL to any document in the same origin as the one which wrote the URL into the pasteboard, we store a string which uniquely identifies the origin of an originating document into our custom pasteboard data. Note that we expose any URL which didn't come from WebKit since we don't expect URLs to reveal privacy sensitive information. We use UUID for the origin identifier of a null origin document. An alternative approach is to store the pasteboard data from the same origin into the document and invalidate it when the system pasteboard changes. However, Pasteboard object cannot know about Document (as Pasteboard is a platform object and Document is a WebCore object), this turns out be quite tricky as there are multiple places where we create Pasteboard objects, and they all need to be aware of this special same origin Pasteboard object that hangs off of Document. Also, this approach would result in the same origin code paths to diverge between null origin and non-null origin documents. Tests: editing/pasteboard/data-transfer-get-data-on-copying-pasting-malformed-url-in-same-document.html editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html http/tests/security/clipboard/copy-paste-url-across-origin-sanitizes-url.html CopyURL.ValidURL CopyURL.UnescapedURL CopyURL.MalformedURL DataInteractionTests.DataTransferSetDataValidURL DataInteractionTests.DataTransferSetDataUnescapedURL DataInteractionTests.DataTransferSetDataInvalidURL * dom/DataTransfer.cpp: (WebCore::originForDocument): Extracted from createForCopyAndPaste. (WebCore::DataTransfer::createForCopyAndPaste): (WebCore::DataTransfer::getDataForItem const): Read the URL from the custom data when the originating content is of the same origin. When the originating content is cross origin, or there is no custom data (e.g. written by another native application; or sanitization didn't result in any difference), then callback to native value. (WebCore::DataTransfer::setDataFromItemList): Sanitize the URL before writing it to the native pasteboard. Store the original value if the sanitization resulted in any difference. (WebCore::DataTransfer::types const): (WebCore::DataTransfer::commitToPasteboard): Moved the code to write custom data to Pasteboard since we need to write the origin string with it. (WebCore::DataTransfer::createForDragStartEvent): Added Document as an argument to compute the origin string. (WebCore::DataTransfer::createForDrop): Ditto. (WebCore::DataTransfer::createForUpdatingDropTarget): (WebCore::DataTransfer::moveDragState): * dom/DataTransfer.h: * dom/Document.cpp: (WebCore::Document::uniqueIdentifier): Added. See above. * dom/Document.h: * editing/Editor.cpp: (WebCore::createDataTransferForClipboardEvent): (WebCore::dispatchClipboardEvent): * page/DragController.cpp: (WebCore::DragController::dispatchTextInputEventFor): * page/EventHandler.cpp: (WebCore::EventHandler::performDragAndDrop): (WebCore::EventHandler::handleDrag): * platform/Pasteboard.h: * platform/PasteboardStrategy.h: * platform/PlatformPasteboard.h: * platform/StaticPasteboard.cpp: (WebCore::StaticPasteboard::takeCustomData): Moved the logic to write to native pasteboard to DataTransfer. * platform/StaticPasteboard.h: * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::typesSafeForBindings): (WebCore::Pasteboard::readStringInCustomData): Rewritten using readCustomData. See below. (WebCore::Pasteboard::readOrigin): Added. (WebCore::Pasteboard::readCustomData): Added. Populates the cache. Because a single Pasteboard object is never allowed to read values once its content is updated by other applications, we can permanently cache the result. * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::typesSafeForBindings): Now takes the unused origin string. (WebCore::Pasteboard::readOrigin): Added. * platform/gtk/PlatformPasteboardGtk.cpp: (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Now takes the unused origin string. * platform/ios/PlatformPasteboardIOS.mm: (WebCore::originKeyKeyForTeamData): Added. (WebCore::customTypesKeyForTeamData): Added. Replaces the use of PasteboardCustomData::cocoaType() in the team data for clarity since the team data key isn't same as the pasteboard type. We don't have to worry about the backwards compatibility since drag & drop session doesn't persist across iOS upgrades, and there is no publicly released iOS with this team data support. (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Read the origin string and the custom data off the team data. Don't expose custom types that are written by cross origin documents. (WebCore::PlatformPasteboard::write): Add the orign string with custom pasteboard types in the team data. (WebCore::PlatformPasteboard::readURL): Fixed a bug that this function was not reading NSURL when UIPasteboard serializes NSURL as a plist. This code is exercised by CopyURL.ValidURL. * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Don't add custom pasteboard types that are added by cross origin documents. * platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::typesSafeForBindings): Now takes the unused origin string. (WebCore::Pasteboard::readOrigin): Added. * platform/wpe/PasteboardWPE.cpp: (WebCore::Pasteboard::typesSafeForBindings): Now takes the unused origin string. (WebCore::Pasteboard::readOrigin): Added. * platform/wpe/PlatformPasteboardWPE.cpp: (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Now takes the unused origin string. 2017-10-11 Antti Koivisto Remove some obsolete layout assertions https://bugs.webkit.org/show_bug.cgi?id=178170 Reviewed by Zalan Bujtas. We have strong assertions against render tree mutation functions being called in layout. These are unnecessary. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::moveChildTo): * rendering/RenderElement.cpp: (WebCore::RenderElement::takeChildInternal): * rendering/RenderElement.h: * rendering/RenderListItem.cpp: (WebCore::RenderListItem::layout): * rendering/RenderListItem.h: 2017-10-11 Andy Estes [Payment Request] Implement Apple Pay merchant validation https://bugs.webkit.org/show_bug.cgi?id=178159 Reviewed by Brady Eidson. When ApplePayPaymentHandler::validateMerchant() is called, dispatch the applepayvalidatemerchant event to the PaymentRequest object. The event object is an ApplePayMerchantValidationEvent, on which the client calls complete() with a merchant session. Test: http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html * DerivedSources.make: * Modules/applepay/ApplePayValidateMerchantEvent.h: * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp: Added. (WebCore::ApplePayMerchantValidationEvent::create): (WebCore::ApplePayMerchantValidationEvent::ApplePayMerchantValidationEvent): (WebCore::ApplePayMerchantValidationEvent::complete): (WebCore::ApplePayMerchantValidationEvent::eventInterface const): * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h: Added. * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl: Added. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::validateMerchant): * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: * Modules/paymentrequest/PaymentRequest.idl: * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * dom/EventNames.in: * testing/Internals.cpp: (WebCore::Internals::Internals): * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::MockPaymentCoordinator): (WebCore::MockPaymentCoordinator::showPaymentUI): * testing/MockPaymentCoordinator.h: 2017-10-11 Chris Dumez Modernize Geolocation code https://bugs.webkit.org/show_bug.cgi?id=178148 Reviewed by Ryosuke Niwa. Modernize Geolocation code: - Use std::optional<> instead of separate boolean members - Make GeolocationPosition a simple struct that can be passed via IPC - Replace WebGeolocationPosition::Data with GeolocationPosition - Move logic to construct a GeolocationPosition from a CLLocation on iOS in one place to avoid code duplication. * Modules/geolocation/Coordinates.cpp: (WebCore::Coordinates::Coordinates): * Modules/geolocation/Coordinates.h: (WebCore::Coordinates::create): (WebCore::Coordinates::isolatedCopy const): (WebCore::Coordinates::latitude const): (WebCore::Coordinates::longitude const): (WebCore::Coordinates::altitude const): (WebCore::Coordinates::accuracy const): (WebCore::Coordinates::altitudeAccuracy const): (WebCore::Coordinates::heading const): (WebCore::Coordinates::speed const): * Modules/geolocation/Geolocation.cpp: (WebCore::createGeoposition): (WebCore::Geolocation::lastPosition): * Modules/geolocation/GeolocationClient.h: * Modules/geolocation/GeolocationController.cpp: (WebCore::GeolocationController::positionChanged): (WebCore::GeolocationController::lastPosition): * Modules/geolocation/GeolocationController.h: * Modules/geolocation/GeolocationPosition.h: (WebCore::GeolocationPosition::GeolocationPosition): The default constructor is only needed by our IPC decoding code. (WebCore::GeolocationPosition::encode const): (WebCore::GeolocationPosition::decode): * Modules/geolocation/ios/GeolocationPositionIOS.mm: Copied from Source/WebCore/Modules/geolocation/Coordinates.cpp. (WebCore::GeolocationPosition::GeolocationPosition): * WebCore.xcodeproj/project.pbxproj: * platform/mock/GeolocationClientMock.cpp: (WebCore::GeolocationClientMock::lastPosition): (WebCore::GeolocationClientMock::controllerTimerFired): * platform/mock/GeolocationClientMock.h: 2017-10-11 Brady Eidson Add a SW context process (where SW scripts will actually execute). https://bugs.webkit.org/show_bug.cgi?id=178156 Reviewed by Andy Estes. No new tests (Covered by changes to existing tests). This patch adds an auxiliary "ServiceWorker context" WebProcess to a WebProcessPool. This process is where ServiceWorker scripts will execute, separate from the client WebProcess hosting the page(s) they are serving. This patch also adds all of the plumbing to pass along a fetched service worker script to this context WebProcess, as well as message back failure to actually start the script so we can test. Touches lots of code sites but is basically just a lot of plumbing. * WebCore.xcodeproj/project.pbxproj: * workers/service/ServiceWorkerContextData.h: Copied from Source/WebCore/workers/service/server/SWServerWorker.h. (WebCore::ServiceWorkerContextData::encode const): (WebCore::ServiceWorkerContextData::decode): * workers/service/server/SWServer.cpp: (WebCore::SWServer::Connection::finishFetchingScriptInServer): (WebCore::SWServer::Connection::scriptContextFailedToStart): (WebCore::SWServer::scriptFetchFinished): (WebCore::SWServer::scriptContextFailedToStart): (WebCore::SWServer::createWorker): * workers/service/server/SWServer.h: * workers/service/server/SWServerRegistration.cpp: (WebCore::SWServerRegistration::scriptFetchFinished): (WebCore::SWServerRegistration::scriptContextFailedToStart): * workers/service/server/SWServerRegistration.h: * workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::SWServerWorker): (WebCore::SWServerWorker::~SWServerWorker): * workers/service/server/SWServerWorker.h: (WebCore::SWServerWorker::create): (WebCore::SWServerWorker::scriptURL const): (WebCore::SWServerWorker::script const): (WebCore::SWServerWorker::type const): (WebCore::SWServerWorker::workerID const): 2017-10-11 Joanmarie Diggs [ATK] Expose value of aria-keyshortcuts as object attribute https://bugs.webkit.org/show_bug.cgi?id=171175 Reviewed by Chris Fleizach. Expose the author-provided string through the "keyshortcuts" object attribute. Test: accessibility/gtk/aria-keyshortcuts.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::ariaKeyShortcutsValue const): * accessibility/AccessibilityObject.h: * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (webkitAccessibleGetAttributes): * html/HTMLAttributeNames.in: 2017-10-11 Yusuke Suzuki [JSC] Drop Instantiate hook in ES6 module loader https://bugs.webkit.org/show_bug.cgi?id=178162 Reviewed by Sam Weinig. Drop instantiate hooks. No behavior change. * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: 2017-10-11 Alicia Boya García [MSE][GStreamer] Add dump of append pipeline https://bugs.webkit.org/show_bug.cgi?id=178074 Reviewed by Xabier Rodriguez-Calvar. Enable dump of AppendPipeline. * platform/graphics/gstreamer/mse/AppendPipeline.cpp: (WebCore::appendPipelineStateChangeMessageCallback): (WebCore::AppendPipeline::AppendPipeline): (WebCore::AppendPipeline::handleStateChangeMessage): * platform/graphics/gstreamer/mse/AppendPipeline.h: 2017-09-27 Frederic Wang [iOS] Do not flatten frames when async frame scrolling is enabled https://bugs.webkit.org/show_bug.cgi?id=173704 Reviewed by Simon Fraser. This patch disables frame flattening when async frame scrolling is enabled on iOS, as otherwise you can not scroll them. Once iframe scrolling is implemented in iOS (bug 149264), developers and beta testers will be able to check it by enabling "Async Frame Scrolling" in the "Experimental WebKit Features" menu of Safari iOS. Test: platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html * page/FrameView.cpp: (WebCore::FrameView::frameFlatteningEnabled): Use effectiveFrameFlattening() * page/Settings.cpp: (WebCore::Settings::effectiveFrameFlattening): New function to return frameFlattening() or do some exceptions on iOS. * page/Settings.h: Declare effectiveFrameFlattening. * rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::flattenFrameSet): Use effectiveFrameFlattening() * rendering/RenderIFrame.cpp: (WebCore::RenderIFrame::flattenFrame): Ditto. * rendering/RenderView.cpp: (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Ditto. 2017-10-10 Xabier Rodriguez Calvar [GStreamer] Fix double seek requested by downloadbuffer GStreamer element in webkibwebsrc https://bugs.webkit.org/show_bug.cgi?id=178079 Reviewed by Žan Doberšek. When the downloadbuffer GStreamer element requests two seeks too close to each other there's some rare race condition where our source answers that it is not seekable and ends up with downloadbuffer element to seek beyond the file size, which causes the server to issue a 416 HTTP error code eventually, causing our MediaPlayer to stop. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (webKitWebSrcStop): We only unset he seekable attribute if we are not seeking. 2017-10-10 Ryosuke Niwa Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=178154 Reviewed by Wenson Hsieh. Extracted the logic to compute the default enabled-ness of custom pasteboard data as Settings::defaultCustomPasteboardDataEnabled() to be called by WebKit1 and WebKit2 layers. * page/Settings.cpp: (WebCore::Settings::defaultCustomPasteboardDataEnabled): Extracted from customPasteboardDataEnabled. (WebCore::Settings::customPasteboardDataEnabled): Deleted. Now inlined in the header file. * page/Settings.h: (WebCore::Settings::customPasteboardDataEnabled): * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::read): Fixed a bug that we were adding MIME type to the map before checking that we could actually read the buffer. We shouldn't skip a type (NSTIFFPboardType and kUTTypeTIFF for now) if an equivalent type had failed to read. 2017-10-10 Andy Estes [Payment Request] Validate that all PaymentCurrencyAmounts use the same currency code when using Apple Pay https://bugs.webkit.org/show_bug.cgi?id=178150 Reviewed by Tim Horton. Apple Pay requires a single currency code, but the Payment Request API allows the client to specify a currency code for each PaymentCurrencyAmount. Instead of having a required currencyCode property on ApplePayRequest and ignoring the currency property on PaymentCurrencyAmount, validate that all PaymentCurrencyAmounts use the same currency code and use that as ApplePaySessionPaymentRequest's currencyCode. Added test cases to http/tests/ssl/applepay/PaymentRequest.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/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::validate): (WebCore::convertAndValidate): (WebCore::ApplePayPaymentHandler::show): * Modules/applepay/paymentrequest/ApplePayRequest.idl: 2017-10-10 Andy Estes [Payment Request] Implement PaymentRequest.canMakePayment() https://bugs.webkit.org/show_bug.cgi?id=178048 Reviewed by Youenn Fablet. Test: http/tests/paymentrequest/payment-request-canmakepayment-method.https.html * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::ApplePayPaymentHandler::convertData): Moved ApplePayRequest-to-ApplePaySessionPaymentRequest conversion from here to show(). (WebCore::ApplePayPaymentHandler::show): Returned an exception if ApplePaySessionPaymentRequest conversion fails. (WebCore::shouldDiscloseApplePayCapability): Checked if we are in an ephimeral session or if Settings::applePayCapabilityDisclosureAllowed() is false. (WebCore::ApplePayPaymentHandler::canMakePayment): Called PaymentCoordinator::canMakePayments() or PaymentCoordinator::canMakePaymentsWithActiveCard() depending on shouldDiscloseApplePayCapability(). * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: * Modules/applepay/paymentrequest/ApplePayRequest.h: * Modules/applepay/paymentrequest/ApplePayRequest.idl: Defined merchantIdentifier. * Modules/paymentrequest/PaymentHandler.h: * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::parse): Moved JSON-parsing to here from show(). (WebCore::PaymentRequest::show): Returned the exception from PaymentHandler::show(). (WebCore::PaymentRequest::canMakePayment): For each payment method, try to create a PaymentHandler. For the first valid PaymentHandler, call canMakePayment() and pass a lambda that resolves the promise. * Modules/paymentrequest/PaymentRequest.h: * Modules/paymentrequest/PaymentRequest.idl: Added CallWith=Document annotations to show() and canMakePayment(). 2017-10-10 Chris Dumez Unreviewed, really fix the build with certain SDKs. Follow-up to r223154, which fixed the wrong lambda. * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::getEntry): (WebCore::DOMFileSystem::getFile): 2017-10-10 Chris Dumez Unreviewed, fix build with certain SDKs. Stop capturing |this| unnecessarily in lambda. * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::getEntry): 2017-10-10 Matt Lewis Unreviewed, rolling out r223148. This caused build failures. Reverted changeset: "Fix MSVC build with ENCRYPTED_MEDIA enabled" https://bugs.webkit.org/show_bug.cgi?id=177803 http://trac.webkit.org/changeset/223148 2017-10-10 Zalan Bujtas AccessibilityRenderObject should not hold a raw pointer to RenderObject https://bugs.webkit.org/show_bug.cgi?id=178144 Reviewed by Chris Fleizach. m_renderer's lifetime is not directly tied to the AX wrapper object's lifetime. Covered by existing tests. * accessibility/AccessibilityListBox.cpp: (WebCore::AccessibilityListBox::elementAccessibilityHitTest const): * accessibility/AccessibilityMathMLElement.cpp: (WebCore::AccessibilityMathMLElement::isMathFenceOperator const): (WebCore::AccessibilityMathMLElement::isMathSeparatorOperator const): (WebCore::AccessibilityMathMLElement::mathLineThickness const): * accessibility/AccessibilityMenuList.cpp: (WebCore::AccessibilityMenuList::press): (WebCore::AccessibilityMenuList::isCollapsed const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::AccessibilityRenderObject): (WebCore::AccessibilityRenderObject::renderBoxModelObject const): (WebCore::AccessibilityRenderObject::setRenderer): (WebCore::AccessibilityRenderObject::previousSibling const): (WebCore::AccessibilityRenderObject::anchorElement const): (WebCore::AccessibilityRenderObject::helpText const): (WebCore::AccessibilityRenderObject::boundingBoxRect const): (WebCore::AccessibilityRenderObject::supportsPath const): (WebCore::AccessibilityRenderObject::elementPath const): (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): (WebCore::AccessibilityRenderObject::index const): (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged): (WebCore::AccessibilityRenderObject::observableObject const): (WebCore::AccessibilityRenderObject::determineAccessibilityRole): (WebCore::AccessibilityRenderObject::textChanged): (WebCore::AccessibilityRenderObject::remoteSVGRootElement const): (WebCore::AccessibilityRenderObject::roleValueForMSAA const): (WebCore::AccessibilityRenderObject::getScrollableAreaIfScrollable const): (WebCore::AccessibilityRenderObject::scrollTo const): * accessibility/AccessibilityRenderObject.h: (WebCore::AccessibilityRenderObject::setRenderObject): * accessibility/AccessibilitySlider.cpp: (WebCore::AccessibilitySlider::elementAccessibilityHitTest const): * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::addChildren): * accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::computeAccessibilityIsIgnored const): (WebCore::AccessibilityTableCell::parentTable const): (WebCore::AccessibilityTableCell::rowIndexRange const): (WebCore::AccessibilityTableCell::columnIndexRange const): (WebCore::AccessibilityTableCell::titleUIElement const): 2017-10-10 Sam Weinig Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values()) https://bugs.webkit.org/show_bug.cgi?id=178102 Reviewed by Tim Horton. * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::Watchers::getNotifiersVector const): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::connectionClosedFromServer): * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): * Modules/mediastream/MediaStream.cpp: (WebCore::MediaStream::getTracks const): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::windowProxies): * css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::item const): * dom/Document.cpp: (WebCore::Document::prepareForDestruction): * dom/DocumentMarkerController.cpp: (WebCore::DocumentMarkerController::removeMarkers): * inspector/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): * inspector/NetworkResourcesData.cpp: * loader/DocumentLoader.cpp: (WebCore::cancelAll): (WebCore::setAllDefersLoading): (WebCore::areAllLoadersPageCacheAcceptable): * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::forEachSessionResource): * loader/mac/DocumentLoaderMac.cpp: (WebCore::scheduleAll): (WebCore::unscheduleAll): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::notifyObservers): * platform/mediastream/MediaStreamPrivate.cpp: (WebCore::MediaStreamPrivate::tracks const): Replace copyKeysToVector / copyValuesToVector with copyToVector(map.keys()) / copyToVector(map.values()) 2017-10-10 Yoshiaki Jitsukawa Fix MSVC build with ENCRYPTED_MEDIA enabled https://bugs.webkit.org/show_bug.cgi?id=177803 Reviewed by Alex Christensen. As a workaround for MSVC, a weak pointer of "this" is captured at the outermost lambda expression. * Modules/encryptedmedia/MediaKeySession.cpp: (WebCore::MediaKeySession::generateRequest): (WebCore::MediaKeySession::load): (WebCore::MediaKeySession::update): (WebCore::MediaKeySession::close): (WebCore::MediaKeySession::remove): * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::CDMInstanceClearKey::updateLicense): (WebCore::CDMInstanceClearKey::loadSession): (WebCore::CDMInstanceClearKey::removeSessionData): 2017-10-10 Joanmarie Diggs AX: [ATK] ARIA form role should be mapped to ATK_ROLE_LANDMARK; not ATK_ROLE_FORM https://bugs.webkit.org/show_bug.cgi?id=178137 Reviewed by Chris Fleizach. Expose the ARIA form role as ATK_ROLE_LANDMARK; continue to expose the HTML form element as ATK_ROLE_FORM. No new tests needed due to existing coverage. Update expectations for roles-exposed.html. * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (atkRole): 2017-10-10 Matt Rajca Respect audio rate change restrictions in HTMLMediaElement::setVolume. https://bugs.webkit.org/show_bug.cgi?id=178140 Reviewed by Eric Carlson. Tests: media/audio-playback-volume-changes-with-restrictions-and-user-gestures.html media/audio-playback-volume-changes-with-restrictions.html It's currently possible for a website to start auto-playing media with a zero volume and then programmatically set the volume to a non-zero value without a user gesture. This code path didn't have to be considered previously because volume changes are not supported on iOS. We currently pause media when an audio track comes in after an element has already started playing silently in mediaPlayerDidAddAudioTrack. This patch does the same when a non-zero volume is set after a media element already began playing silently and there is an audio rate change restriction. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setVolume): 2017-10-10 Ryosuke Niwa Loading should be disabled while constructing the fragment in WebContentReader::readWebArchive https://bugs.webkit.org/show_bug.cgi?id=178118 Reviewed by Antti Koivisto. Disable image loading while constructing the document fragment in WebContentReader::readWebArchive as we do in createFragmentAndAddResources for RTF/RTFD. This refactoring is needed to start using blob URL in the pasted document fragment for webkit.org/b/124391. Also modified WebContentReader::readWebArchive to take a reference to SharedBuffer instead of a pointer. No new tests since existing tests have been updated to cover this behavior change. * editing/WebContentReader.h: * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readWebArchive): Use DeferredLoadingScope to disable the loader and images while constructing the document fragment. * platform/Pasteboard.h: * platform/ios/PasteboardIOS.mm: (WebCore::readPasteboardWebContentDataForType): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::read): 2017-10-10 Antti Koivisto Layers should be destroyed by RenderLayerModelObject https://bugs.webkit.org/show_bug.cgi?id=178139 Reviewed by Simon Fraser. Clean up some FIXMEs. * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::willBeDestroyed): (WebCore::RenderLayerModelObject::destroyLayer): * rendering/RenderLayerModelObject.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::willBeDestroyed): 2017-10-10 Chris Dumez Entries API should recognize path starting with 2 slashes as valid absolute path https://bugs.webkit.org/show_bug.cgi?id=178135 Reviewed by Ryosuke Niwa. Entries API should recognize paths starting with 2 slashes as valid absolute paths to match Chrome's behavior. See https://github.com/WICG/entries-api/commit/990454758005a6039655835503d551015e346d9d This was causing us to fail some manual web-platform-tests. No new tests, updated existing tests. * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::isValidPathSegment): (WebCore::isZeroOrMorePathSegmentsSeparatedBySlashes): (WebCore::isValidRelativeVirtualPath): (WebCore::isValidVirtualPath): 2017-10-10 Matt Lewis Unreviewed, rolling out r223110. This caused consistent failures and timeouts on multiple platforms. Reverted changeset: "Delete button doesn't fully delete certain emoji" https://bugs.webkit.org/show_bug.cgi?id=178096 http://trac.webkit.org/changeset/223110 2017-10-10 Antti Koivisto RenderObject::destroy() should only be invoked after renderer has been removed from the tree https://bugs.webkit.org/show_bug.cgi?id=178075 Reviewed by Zalan Bujtas. This patch fixes the remaining cases where the renderer is still in the tree while destroy() is called and adds the assert. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::removeLeftoverAnonymousBlock): (WebCore::RenderBlock::takeChild): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::willBeDestroyed): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::~RenderLayer): Null the parent pointers for m_scrollCorner/m_resizer. (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::willBeDestroyed): (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers): (WebCore::RenderObject::destroy): Use RELEASE_ASSERT as these are cheap and important checks. Also turn isBeingDestroyed test into RELEASE_ASSERT. Remove AX call that no longer does anything. (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers): Deleted. * rendering/RenderObject.h: * rendering/RenderRubyBase.cpp: (WebCore::RenderRubyBase::moveBlockChildren): * rendering/RenderTableRow.cpp: (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows): Deleted. Renamed and made this no longer destroy itself. The caller now takes care of that. Removed an unnecessary lambda. * rendering/RenderTableRow.h: * style/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): (WebCore::RenderTreeUpdater::tearDownRenderer): * style/RenderTreeUpdaterListItem.cpp: (WebCore::RenderTreeUpdater::ListItem::updateMarker): 2017-10-09 Antti Koivisto Add isContinuation bit https://bugs.webkit.org/show_bug.cgi?id=178084 Reviewed by Zalan Bujtas. Currently continuations are identified indirectly by comparing renderer pointer with the element renderer pointer. This is bug prone and fails to cover anonymous continuations. * accessibility/AccessibilityRenderObject.cpp: (WebCore::firstChildConsideringContinuation): (WebCore::startOfContinuations): (WebCore::firstChildIsInlineContinuation): (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): Ignore first-letter fragment. This worked before because first-letter renderers were mistakenly considered inline element continuations (see below). * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::setContinuation): * rendering/RenderElement.cpp: (WebCore::RenderElement::RenderElement): * rendering/RenderElement.h: (WebCore::RenderElement::hasContinuation const): (WebCore::RenderElement::isContinuation const): (WebCore::RenderElement::setIsContinuation): The new bit. (WebCore::RenderElement::isElementContinuation const): (WebCore::RenderElement::isInlineElementContinuation const): * rendering/RenderInline.cpp: (WebCore::RenderInline::addChildIgnoringContinuation): (WebCore::RenderInline::cloneAsContinuation const): (WebCore::RenderInline::splitInlines): (WebCore::RenderInline::childBecameNonInline): (WebCore::RenderInline::clone const): Deleted. * rendering/RenderInline.h: * rendering/RenderObject.h: (WebCore::RenderObject::isAnonymousBlock const): (WebCore::RenderObject::isElementContinuation const): Deleted. The old continuation test was 'node() && node()->renderer() != this' This was fragile as nulling the renderer will make it fail. It was also wrong for first-letter renderers (isElementContinuation was true for them). (WebCore::RenderObject::isInlineElementContinuation const): Deleted. Move to RenderElement. (WebCore::RenderObject::isBlockElementContinuation const): Deleted. 2017-10-10 Joanmarie Diggs AX: [ATK] STATE_CHECKABLE should be removed from radio buttons in radiogroups with aria-readonly="true" https://bugs.webkit.org/show_bug.cgi?id=177931 Reviewed by Chris Fleizach. Add a check in canSetValueAttribute() for readonly radiogroup ancestors of radio buttons. Test: accessibility/gtk/aria-readonly-radiogroup.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::canSetValueAttribute const): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::radioGroupAncestor const): * accessibility/AccessibilityObject.h: 2017-10-09 Chris Dumez Calling fileSystemDirectoryEntry.getDirectory() with empty path should not fail https://bugs.webkit.org/show_bug.cgi?id=178114 Reviewed by Ryosuke Niwa. Calling fileSystemDirectoryEntry.getDirectory() with empty/null/undefined path should not fail as per: - https://wicg.github.io/entries-api/#dom-filesystemdirectoryentry-getdirectory The empty string is a valid path as per: - https://wicg.github.io/entries-api/#valid-path This aligns out behavior with Chrome. No new tests, updated existing test. * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::isValidVirtualPath): (WebCore::resolveRelativeVirtualPath): 2017-10-09 Chris Dumez It should not be possible to submit a form that is disconnected https://bugs.webkit.org/show_bug.cgi?id=178099 Reviewed by Sam Weinig. It should not be possible to submit a form that is disconnected. Both Firefox and Chrome agree with the specification. This is as per: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm (step 1) which refers to: https://html.spec.whatwg.org/multipage/links.html#cannot-navigate Form cannot navigate when it is disconnected. No new tests, rebaselined existing tests. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::prepareForSubmission): 2017-10-09 Myles C. Maxfield Delete button doesn't fully delete certain emoji https://bugs.webkit.org/show_bug.cgi?id=178096 Reviewed by Simon Fraser. System infrastructure for handling emoji changes every year. Instead of having custom code to specifically walk over codepoints, we should delegate to the system handling. Test: editing/deleting/delete-emoji.html * rendering/RenderText.cpp: (WebCore::RenderText::previousOffset const): (WebCore::RenderText::previousOffsetForBackwardDeletion const): (WebCore::RenderText::nextOffset const): (WebCore::isHangulLVT): Deleted. (WebCore::isMark): Deleted. (WebCore::isRegionalIndicator): Deleted. (WebCore::isInArmenianToLimbuRange): Deleted. 2017-10-09 Said Abou-Hallawa Image data should be coalesced if it comes in small chunks before updating the ImageSource https://bugs.webkit.org/show_bug.cgi?id=175890 Reviewed by Simon Fraser. Coalesce the updates, which an Image makes when receiving encoded data in small chunks, for all platforms. Ensure the clients of the CachedImage won't be notified unless an update in the ImageSource happens. I need to change some functions' names to better implement this patch. The names of these functions have been confusing: CachedImage::addData(SharedBuffer&) CachedImage::addDataBuffer(const char* data, unsigned) CachedImage::addIncrementalDataBuffer(SharedBuffer&) The image data is not buffered incrementally into the CachedImage. When new data is received, SubresourceLoader calls CachedImage to "update" its m_data with either a SharedBuffer or a data pointer. In either case the SharedBuffer or the pointer contains all the loaded data. SubresourceLoader calls CachedImage to update its m_data, to ensure its m_image is created and to notify its clients with the new data. The verb "add" in the functions' name is misleading. I am suggesting the following names instead: CachedImage::updateBuffer(SharedBuffer&) CachedImage::updateData(const char*, unsigned) CachedImage::doUpdateBuffer(SharedBuffer&) The first two are the virtual ones. They are called form SubresourceLoader. The third one is the internal implementation to update the m_data member. The same names will be used in the following classes: CachedResource which is the base class of CachedImage CachedRawResource which is derived from CachedResource CachedTextTrack which is derived from CachedResource * html/ImageDocument.cpp: (WebCore::ImageDocument::updateDuringParsing): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didReceiveDataOrBuffer): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::clearImage): Reset the update back off members. (WebCore::CachedImage::doUpdateBuffer): Don't update CachedImage with the new data if it comes in small chunks with fast rate. (WebCore::CachedImage::shouldDeferUpdateImageData const): This code is moved from ImageSource::dataChanged(). (WebCore::CachedImage::didUpdateImageData): Ditto. (WebCore::CachedImage::updateImageData): (WebCore::CachedImage::updateBuffer): (WebCore::CachedImage::updateData): (WebCore::CachedImage::finishLoading): (WebCore::CachedImage::addIncrementalDataBuffer): Deleted. (WebCore::CachedImage::setImageDataBuffer): Deleted. (WebCore::CachedImage::addDataBuffer): Deleted. (WebCore::CachedImage::addData): Deleted. * loader/cache/CachedImage.h: * loader/cache/CachedRawResource.cpp: (WebCore::CachedRawResource::updateBuffer): (WebCore::CachedRawResource::updateData): (WebCore::CachedRawResource::addDataBuffer): Deleted. (WebCore::CachedRawResource::addData): Deleted. * loader/cache/CachedRawResource.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::updateBuffer): (WebCore::CachedResource::updateData): (WebCore::CachedResource::addDataBuffer): Deleted. (WebCore::CachedResource::addData): Deleted. * loader/cache/CachedResource.h: * loader/cache/CachedTextTrack.cpp: (WebCore::CachedTextTrack::doUpdateBuffer): Rename updateData() to doUpdateBuffer(). (WebCore::CachedTextTrack::updateBuffer): Rename addDataBuffer() to updateBuffer(). (WebCore::CachedTextTrack::finishLoading): Call the internal function doUpdateBuffer(). (WebCore::CachedTextTrack::updateData): Deleted. (WebCore::CachedTextTrack::addDataBuffer): Deleted. * loader/cache/CachedTextTrack.h: * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::dataChanged): Move the update back off code to CachedImage::updateData(). * platform/graphics/ImageSource.h: 2017-10-09 Michael Saboff Implement RegExp Unicode property escapes https://bugs.webkit.org/show_bug.cgi?id=172069 Reviewed by JF Bastien. Refactoring change - Added BuiltInCharacterClassID:: prefix to uses of the enum. * contentextensions/URLFilterParser.cpp: (WebCore::ContentExtensions::PatternParser::atomBuiltInCharacterClass): 2017-10-09 Andy Estes [Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide() https://bugs.webkit.org/show_bug.cgi?id=178043 Reviewed by Tim Horton. Tests: http/tests/paymentrequest/payment-request-abort-method.https.html http/tests/paymentrequest/payment-request-show-method.https.html * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentSession.h: Virtually inherited from PaymentSessionBase to accommodate ApplePayPaymentHandler inheriting from both this and PaymentHandler. (WebCore::PaymentSession::~PaymentSession): Deleted. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::paymentCoordinator): Virtually inherited from PaymentSessionBase to accommodate ApplePayPaymentHandler inheriting from both this and PaymentSession. (WebCore::ApplePayPaymentHandler::hasActiveSession): Added. Calls PaymentCoordinator::hasActiveSession(). (WebCore::ApplePayPaymentHandler::show): Added. Calls PaymentCoordinator::beginPaymentSession(). (WebCore::ApplePayPaymentHandler::hide): Added. Calls PaymentCoordinator::abortPaymentSession(). * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: Inherited from PaymentSession in addition to PaymentHandler so that this can be PaymentCoordinator active session. * Modules/paymentrequest/PaymentHandler.cpp: (WebCore::PaymentHandler::create): (WebCore::PaymentHandler::hasActiveSession): * Modules/paymentrequest/PaymentHandler.h: * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::~PaymentRequest): (WebCore::PaymentRequest::show): Rejected the promise if PaymentCoordinator has an active session. (WebCore::PaymentRequest::abort): Called stop(). (WebCore::PaymentRequest::canSuspendForDocumentSuspension const): Returned true if state is Interactive and there is an active handler showing. (WebCore::PaymentRequest::stop): Hid the active session if it's showing, then set state to Closed and rejected the show promise. * Modules/paymentrequest/PaymentRequest.h: * Modules/paymentrequest/PaymentSessionBase.h: Added. Inherits from RefCounted and defines a virtual destructor. This allows subclasses to virtually inherit a single ref-count to support multiple inheritance. * WebCore.xcodeproj/project.pbxproj: * bindings/scripts/CodeGeneratorJS.pm: (GetGnuVTableOffsetForType): Added ApplePaySession to the list of classes that need a vtable offset of 3. * page/MainFrame.cpp: (WebCore::MainFrame::setPaymentCoordinator): Added a setter for m_paymentCoordinator. * page/MainFrame.h: * testing/Internals.cpp: (WebCore::Internals::Internals): Set the main frame's payment coordinator to a new PaymentCoordinator with MockPaymentCoordinator as its client. * testing/MockPaymentCoordinator.cpp: Added a mock PaymentCoordinatorClient for testing. (WebCore::MockPaymentCoordinator::supportsVersion): (WebCore::MockPaymentCoordinator::canMakePayments): (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard): (WebCore::MockPaymentCoordinator::openPaymentSetup): (WebCore::MockPaymentCoordinator::showPaymentUI): (WebCore::MockPaymentCoordinator::paymentCoordinatorDestroyed): * testing/MockPaymentCoordinator.h: Added. 2017-10-09 Youenn Fablet Add quota to cache API https://bugs.webkit.org/show_bug.cgi?id=177552 Reviewed by Alex Christensen. Tests: http/wpt/cache-storage/cache-quota.any.html Storing padded opaque response body sizes within FetchResponse and CacheStorageConnection. See https://github.com/whatwg/storage/issues/31 for the rationale about this padding. Storing in CacheStorageConnection is needed for handling cloned network fetched created responses. Storing in FetchResponse is needed for handling cloned cache-storage created opaque responses. Adding internals to query and set the fuzzed size of a response. * Modules/cache/CacheStorageConnection.cpp: (WebCore::computeRealBodySize): (WebCore::CacheStorageConnection::computeRecordBodySize): (WebCore::CacheStorageConnection::setResponseBodySizeWithPadding): (WebCore::CacheStorageConnection::responseBodySizeWithPadding const): * Modules/cache/CacheStorageConnection.h: * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::toConnectionRecord): (WebCore::DOMCache::updateRecords): * Modules/cache/DOMCache.h: * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::errorToException): (WebCore::DOMCacheEngine::Record::copy const): * Modules/cache/DOMCacheEngine.h: * Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::toCrossThreadRecordData): (WebCore::fromCrossThreadRecordData): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::clone): (WebCore::FetchResponse::BodyLoader::didReceiveResponse): * Modules/fetch/FetchResponse.h: * Modules/fetch/FetchResponse.idl: * testing/Internals.cpp: (WebCore::Internals::setResponseSizeWithPadding): (WebCore::Internals::responseSizeWithPadding const): * testing/Internals.h: * testing/Internals.idl: 2017-10-09 Zalan Bujtas Remove redundant RenderObject::virtualContinuation https://bugs.webkit.org/show_bug.cgi?id=178091 Reviewed by Antti Koivisto. virtualContinuation sounds like a feature of continuation, while it's just a (not super useful)helper override. No change in functionality. * rendering/RenderBlock.cpp: (WebCore::canMergeContiguousAnonymousBlocks): (WebCore::RenderBlock::takeChild): * rendering/RenderBlock.h: * rendering/RenderInline.h: * rendering/RenderObject.h: (WebCore::RenderObject::isBlockElementContinuation const): (WebCore::RenderObject::virtualContinuation const): Deleted. 2017-10-09 Dean Jackson [WebGL] Third IOSurface buffer might be allocated with the wrong size https://bugs.webkit.org/show_bug.cgi?id=178092 Reviewed by Jer Noble. If the WebGL canvas resizes after the third buffer was allocated, it was never getting told that its backing store should be thrown away. * platform/graphics/cocoa/WebGLLayer.mm: Allocate the third buffer at the same time as the first two. (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): (-[WebGLLayer bindFramebufferToNextAvailableSurface]): 2017-10-09 Sam Weinig Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector https://bugs.webkit.org/show_bug.cgi?id=178072 Reviewed by Darin Adler. * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h: (WebCore::MediaSelectionGroupAVFObjC::options): Update for type change for HashMap::values(). 2017-10-09 Wenson Hsieh Unreviewed, another build fix attempt after r223031 The default constructor of DragTargetResponse is also invoked via initializer list in EventHandler.cpp, so we'll need to explicitly declare this constructor in the header. * page/EventHandler.h: 2017-10-09 Ryan Haddad Unreviewed, rolling out r223021. LayoutTests added with this change are failing. Reverted changeset: "[Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide()" https://bugs.webkit.org/show_bug.cgi?id=178043 http://trac.webkit.org/changeset/223021 2017-10-09 Jeremy Jones Blurry captions on retina screens. https://bugs.webkit.org/show_bug.cgi?id=177560 rdar://problem/17913388 Reviewed by Jer Noble. No new tests because the contents scale of the captions layer is not exposed to the DOM. The captions layer contents scale needs to take into account the device screen scale to get the correct resolution for captions. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): (WebCore::MediaControlTextTrackContainerElement::updateSizes): 2017-10-09 Wenson Hsieh Unreviewed, fix the Windows build after r223031 Speculative build fix; no change in behavior. * page/EventHandler.h: (WebCore::EventHandler::DragTargetResponse::DragTargetResponse): 2017-10-09 Alex Christensen Reduce includes in Document.h https://bugs.webkit.org/show_bug.cgi?id=178035 Reviewed by Darin Adler. * dom/Document.h: 2017-10-09 Joanmarie Diggs AX: [ATK] Explicitly-set aria-sort value of "none" should be exposed as an object attribute https://bugs.webkit.org/show_bug.cgi?id=177955 Reviewed by Chris Fleizach. Expose "none" as the value of aria-sort when the attribute is present and not one of the other valid sort types. Also add a new AccessibilitySortDirection, SortDirectionInvalid. This is currently only being used when the sort direction is sought for a role which does not support this ARIA attribute, but might come in handy if we want to add further sanity checks on the author-provided values. Test: accessibility/gtk/aria-sort-values.html * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::sortDirection const): * accessibility/AccessibilityObject.h: * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (webkitAccessibleGetAttributes): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]): 2017-10-09 Robin Morisset Make the names of the options consistent https://bugs.webkit.org/show_bug.cgi?id=177933 Reviewed by Saam Barati. No functional change, just fixing comments. * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::buffered const): (WebCore::MediaSource::monitorSourceBuffers): * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::process): * bindings/scripts/generate-bindings.pl: * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustRenderStyle): * editing/BreakBlockquoteCommand.cpp: (WebCore::BreakBlockquoteCommand::doApply): * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply): * editing/VisibleSelection.cpp: (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): * editing/VisibleUnits.cpp: (WebCore::closestWordBoundaryForPosition): * html/parser/AtomicHTMLToken.h: * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::end): * inspector/InspectorOverlayPage.js: (reset): * page/ViewportConfiguration.cpp: (WebCore::ViewportConfiguration::layoutWidth const): (WebCore::ViewportConfiguration::layoutHeight const): * platform/graphics/FloatPolygon.h: * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): * platform/graphics/filters/FilterOperation.h: * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: (WebCore::GraphicsContext3D::texImage2D): * platform/mac/WidgetMac.mm: (WebCore::safeRemoveFromSuperview): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::collapseMarginsWithChildInfo): * rendering/RenderBlockFlow.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::computePositionedLogicalWidthReplaced const): * rendering/RenderObject.cpp: (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const): * rendering/RenderTheme.cpp: (WebCore::RenderTheme::disabledTextColor const): * style/ClassChangeInvalidation.cpp: (WebCore::Style::computeClassChange): * style/StyleScope.cpp: (WebCore::Style::Scope::didChangeStyleSheetEnvironment): * svg/SVGAltGlyphDefElement.cpp: (WebCore::SVGAltGlyphDefElement::hasValidGlyphElements const): 2017-10-09 Adrian Perez de Castro [WPE][GTK] Propagate libepoxy compiler flags obtained from pkg-config https://bugs.webkit.org/show_bug.cgi?id=178081 Reviewed by Carlos Alberto Lopez Perez. No new tests needed. * CMakeLists.txt: Use ${LIBEPOXY_DEFINITIONS} for building WebCore. 2017-10-09 Romain Bellessort [Readable Streams API] Implement canCloseOrEnqueue https://bugs.webkit.org/show_bug.cgi?id=178005 Reviewed by Youenn Fablet. Implemented readableStreamDefaultControllerCanCloseOrEnqueue [1]. This is just a refactoring (based on spec) aiming at factorizing a set of tests that are done at multiple places. [1] https://streams.spec.whatwg.org/#readable-stream-default-controller-can-close-or-enqueue No new tests (refactoring, no new behavior). * Modules/streams/ReadableStreamDefaultController.js: (enqueue): Updated. (close): Updated. * Modules/streams/ReadableStreamInternals.js: (readableStreamDefaultControllerClose): Updated. (readableStreamDefaultControllerCanCloseOrEnqueue): Added. 2017-10-05 Frederic Wang Remove WOFF2 from Source/ThirdParty. https://bugs.webkit.org/show_bug.cgi?id=177862 Reviewed by Michael Catanzaro. No new tests, already covered by existing tests. * CMakeLists.txt: Use the system brotli/woff2 headers/libraries. 2017-10-08 Darin Adler Update HTMLOListElement.start to behavior from latest HTML specification https://bugs.webkit.org/show_bug.cgi?id=178057 Reviewed by Chris Dumez. * html/HTMLOListElement.cpp: (optionalValue): Added. Helper function that we can put into Expected.h later if we like; makes it easier to turn Expected into std::optional. (WebCore::HTMLOListElement::HTMLOListElement): Moved data member initialization into class definition so it doesn't have to be done here. (WebCore::HTMLOListElement::parseAttribute): Simplified using the new optionalValue function. Moved the call to update values in here since it's a trivial one-liner (albeit done twice). (WebCore::HTMLOListElement::updateItemValues): Deleted. Moved this into the parseAttribute function. (WebCore::HTMLOListElement::itemCount): Updated to use std::optional instead of a separate m_shouldRecalculateItemCount flag. Also inlined the recalculateItemCount function since it's a trivial one-liner. (WebCore::HTMLOListElement::itemCountAfterLayout): Deleted. The only use of this was to implement the now-obsolete behavior of the start attribute. (WebCore::HTMLOListElement::recalculateItemCount): Deleted. Moved this into the itemCount function. * html/HTMLOListElement.h: Changed startForBindings to return 1 when start is not specified; this what the HTML specification now calls for. Updated for the changes above. Merged m_itemCount and m_shouldRecalculateItemCount into a single optional m_itemCount, and made it mutable so it can be computed as a side effect of calling the const member function start. 2017-10-08 Darin Adler Fix bugs related to setting reflected floating point DOM attributes https://bugs.webkit.org/show_bug.cgi?id=178061 Reviewed by Sam Weinig. * html/HTMLProgressElement.cpp: (WebCore::HTMLProgressElement::setValue): Changed the semantics to match what the HTML specification calls for. When a caller passes a negative number or zero, the value does get set on the element. Negative numbers are not allowed when you get the current value, but are allowed to be set. (WebCore::HTMLProgressElement::setMax): Changed the semantics to match what the HTML specification calls for. When a caller passes a negative number or zero, this should leave the attribute unchanged. * html/shadow/MediaControlElementTypes.cpp: (WebCore::MediaControlVolumeSliderElement::setVolume): Use String::numberToStringECMAScript instead of String::number since that is what we want any time we are setting an attribute value from a floating point value. * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlTimelineElement::setPosition): Ditto. (WebCore::MediaControlTimelineElement::setDuration): Removed unneeded check of std::isfinite since the single caller already checks that. 2017-10-08 Wenson Hsieh DataTransfer.items does not contain items for custom types supplied via add or setData https://bugs.webkit.org/show_bug.cgi?id=178016 Reviewed by Darin Adler. Minor tweaks to expose pasteboard types and data through DataTransfer's item list. This patch fixes two primary issues: (1) custom pasteboard data is not exposed through the item list in any way, and (2) the "Files" compatibility type is exposed as a separate data transfer item of kind 'string' when dropping or pasting files. Tests: editing/pasteboard/data-transfer-items-add-custom-data.html editing/pasteboard/data-transfer-items-drop-file.html * dom/DataTransfer.cpp: (WebCore::normalizeType): Use stripLeadingAndTrailingHTMLSpaces instead of stripWhitespace. (WebCore::shouldReadOrWriteTypeAsCustomData): (WebCore::DataTransfer::getDataForItem const): (WebCore::DataTransfer::getData const): Add getDataForItem, a version of getData that does not normalize types before reading from the pasteboard. This normalization step is only needed for backwards compatibility with legacy types (such as "text" and "url") written to and read from using getData and setData; when using DataTransferItemList.add to set data, adding data for these types should instead write as custom pasteboard data. (WebCore::DataTransfer::setDataFromItemList): (WebCore::DataTransfer::types const): (WebCore::DataTransfer::typesForItemList const): Add typesForItemList, which fetches the list of types to expose as items on the DataTransfer. Importantly, this does not include the "Files" type added for compatibility when accessing DataTransfer.types, instead returning an empty array. The actual files are added separately, by iterating over DataTransfer's files in ensureItems. Note that when starting a drag or copying, we will still expose the full list of file and string types to bindings and not just file-backed items. Since all of this information is supplied by the page in the first place, we don't have to worry about exposing information, such as file paths, that may exist on the pasteboard. * dom/DataTransfer.h: * dom/DataTransferItem.cpp: (WebCore::DataTransferItem::getAsString const): * dom/DataTransferItemList.cpp: (WebCore::shouldExposeTypeInItemList): (WebCore::DataTransferItemList::add): (WebCore::DataTransferItemList::ensureItems const): (WebCore::isSupportedType): Deleted. 2017-10-08 Darin Adler CustomElementRegistry.define was throwing a JavaScript syntax error instead of a DOM syntax error https://bugs.webkit.org/show_bug.cgi?id=178055 Reviewed by Sam Weinig. Both the JavaScript language and the DOM have "syntax error" exceptions, but they are not the same thing. Also, since the time a while back where we moved JavaScript error handling to use WebCore::Exception and WebCore::ExceptionOr, there are a number of functions that are no longer used and can be deleted. * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::validateCustomElementNameAndThrowIfNeeded): Call throwDOMSyntaxError instead of throwSyntaxError. * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::reportDeprecatedGetterError): Deleted. Unused. (WebCore::reportDeprecatedSetterError): Deleted. Unused. (WebCore::throwNotSupportedError): Deleted the overload without an error message, since it's unused. Changed the other overload to take an ASCIILiteral, since that is what all the callers need. (WebCore::throwInvalidStateError): Take ASCIILiteral as above. (WebCore::throwArrayElementTypeError): Deleted. Unused. (WebCore::throwDOMSyntaxError): Added an ASCIILiteral message argument. This function was unused; it's now being used above, always with a literal message. (WebCore::throwIndexSizeError): Deleted. Unused. (WebCore::throwTypeMismatchError): Deleted. Unused. * bindings/js/JSDOMExceptionHandling.h: Updated for the changes above. * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): Fixed a typo in the error message. 2017-10-08 Ryosuke Niwa dragenter and dragleave shouldn't use the same data transfer object https://bugs.webkit.org/show_bug.cgi?id=178056 Reviewed by Darin Adler. This patch fixes the bug that we were using a single DataTransfer to fire dragleave and dragenter events when the drag target moves from one element to another. It alos refactors DragController and EventHandler code so that the construction of DataTransfer object happens in EventHandler instead of DragController, and extracts createForUpdatingDropTarget out of createForDrop to have a better encapsulation over the data store mode. drag related functions in EventHandler now takes std::unique_ptr&&, drag operation mask set by the drag source, and a boolean indicating whether this drag & drop is for files or not. updateDragAndDrop takes a closure which makes a pasteboard because it has to create two instances of DataTransfer one for dragleave event and another one for dragenter event in some cases. Test: editing/pasteboard/data-transfer-is-unique-for-dragenter-and-dragleave.html * dom/DataTransfer.cpp: (WebCore::DataTransfer::createForDrop): Now takes Pasteboard instead of DragData. (WebCore::DataTransfer::createForUpdatingDropTarget): Extracted out of createForDrop. Moved the code to use Readonly mode in dashboad here from createDataTransferToUpdateDrag in DragController.cpp. * dom/DataTransfer.h: * page/DragController.cpp: (WebCore::createDataTransferToUpdateDrag): Deleted. (WebCore::DragController::dragExited): (WebCore::DragController::performDragOperation): (WebCore::DragController::tryDHTMLDrag): * page/EventHandler.cpp: (WebCore::EventHandler::dispatchDragEvent): Made this fucntion take DataTransfer& instead of DataTransfer*. (WebCore::findDropZone): Ditto. (WebCore::EventHandler::dispatchDragEnterOrDragOverEvent): Added. (WebCore::EventHandler::updateDragAndDrop): (WebCore::EventHandler::cancelDragAndDrop): (WebCore::EventHandler::performDragAndDrop): (WebCore::EventHandler::dispatchDragSrcEvent): (WebCore::EventHandler::dispatchDragStartEventOnSourceElement): * page/EventHandler.h: 2017-10-08 Jer Noble SourceBuffer remove throws out way more content than requested https://bugs.webkit.org/show_bug.cgi?id=177884 Reviewed by Darin Adler. Test: media/media-source/media-source-remove-too-much.html The end parameter is exclusive, not inclusive, of the range to be removed. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::removeCodedFrames): 2017-10-08 Brent Fulgham Nullptr deref in WebCore::Node::computeEditability https://bugs.webkit.org/show_bug.cgi?id=177905 Reviewed by Darin Adler. Script can run when setting focus, because a blur event and a focus event are generated. A handler for one of these events can cause the focused element to be cleared. We should handle this possibility gracefully. Test: fast/dom/focus-shift-crash.html * dom/Document.cpp: (WebCore::Document::setFocusedElement): 2017-10-07 Darin Adler Update Document.createEvent for recent DOM specification changes https://bugs.webkit.org/show_bug.cgi?id=178052 Reviewed by Chris Dumez. * dom/BeforeUnloadEvent.cpp: (WebCore::BeforeUnloadEvent::BeforeUnloadEvent): Added a constructor for createForBindings. (WebCore::BeforeUnloadEvent::~BeforeUnloadEvent): Deleted. Just let the compiler generate this. * dom/BeforeUnloadEvent.h: Added createForBindings. Also made more things private. * dom/Document.cpp: (WebCore::Document::createEvent): Updated comments for clarity. Responding to changes to the DOM specification, added support for "beforeunloadevent", "focusevent", and "svgevents", moved "keyboardevents" and "popstateevent" into the list of strings we should remove, and moved "compositionevent", "devicemotionevent", "deviceorientationevent", "hashchangeevent", "storageevent", and "textevent" into the list of strings we should keep. * dom/Event.h: Added a virtual setRelatedTarget alongside the virtual relatedTarget to allow us to clean up the code that manipulates it. * dom/EventContext.cpp: (WebCore::MouseOrFocusEventContext::handleLocalEvents const): Call the virtual setRelatedTarget instead of doing a little type casting dance. * dom/FocusEvent.h: Added createForBindings. Made more functions private and changed setRelatedTarget into a private final override. * dom/MouseEvent.h: Changed setRelatedTarget into a private final override. 2017-10-07 Andy Estes [Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide() https://bugs.webkit.org/show_bug.cgi?id=178043 Reviewed by Tim Horton. Tests: http/tests/paymentrequest/payment-request-abort-method.https.html http/tests/paymentrequest/payment-request-show-method.https.html * Modules/applepay/PaymentSession.h: Virtually inherited from PaymentSessionBase to accommodate ApplePayPaymentHandler inheriting from both this and PaymentHandler. (WebCore::PaymentSession::~PaymentSession): Deleted. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::paymentCoordinator): Virtually inherited from PaymentSessionBase to accommodate ApplePayPaymentHandler inheriting from both this and PaymentSession. (WebCore::ApplePayPaymentHandler::hasActiveSession): Added. Calls PaymentCoordinator::hasActiveSession(). (WebCore::ApplePayPaymentHandler::show): Added. Calls PaymentCoordinator::beginPaymentSession(). (WebCore::ApplePayPaymentHandler::hide): Added. Calls PaymentCoordinator::abortPaymentSession(). * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: Inherited from PaymentSession in addition to PaymentHandler so that this can be PaymentCoordinator active session. * Modules/paymentrequest/PaymentHandler.cpp: (WebCore::PaymentHandler::create): (WebCore::PaymentHandler::hasActiveSession): * Modules/paymentrequest/PaymentHandler.h: * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::~PaymentRequest): (WebCore::PaymentRequest::show): Rejected the promise if PaymentCoordinator has an active session. (WebCore::PaymentRequest::abort): Called stop(). (WebCore::PaymentRequest::canSuspendForDocumentSuspension const): Returned true if state is Interactive and there is an active handler showing. (WebCore::PaymentRequest::stop): Hid the active session if it's showing, then set state to Closed and rejected the show promise. * Modules/paymentrequest/PaymentRequest.h: * Modules/paymentrequest/PaymentSessionBase.h: Added. Inherits from RefCounted and defines a virtual destructor. This allows subclasses to virtually inherit a single ref-count to support multiple inheritance. * WebCore.xcodeproj/project.pbxproj: * bindings/scripts/CodeGeneratorJS.pm: (GetGnuVTableOffsetForType): Added ApplePaySession to the list of classes that need a vtable offset of 3. 2017-10-07 Ryosuke Niwa WebContentReader::readHTML should be shared between macOS and iOS https://bugs.webkit.org/show_bug.cgi?id=178044 Reviewed by Wenson Hsieh. Merged the implementations for WebContentReader::readHTML between macOS and iOS. * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::WebContentReader::readHTML): * editing/ios/WebContentReaderIOS.mm: (WebCore::WebContentReader::readHTML): Deleted. * editing/mac/WebContentReaderMac.mm: (WebCore::WebContentReader::readHTML): Deleted. 2017-10-06 Zalan Bujtas RenderTable should not hold a collection of raw pointers to RenderTableCaption https://bugs.webkit.org/show_bug.cgi?id=178026 Reviewed by Simon Fraser. Similar to sections, RenderTable should not store captions as raw pointers. Their lifetimes are not guaranteed to be sync with the RenderTable's. Covered by existing tests. * rendering/RenderTable.cpp: (WebCore::RenderTable::addCaption): (WebCore::RenderTable::removeCaption): (WebCore::RenderTable::addOverflowFromChildren): * rendering/RenderTable.h: * rendering/RenderTableCaption.cpp: (WebCore::RenderTableCaption::insertedIntoTree): (WebCore::RenderTableCaption::willBeRemovedFromTree): 2017-10-06 Daniel Bates Spelling error annotation should encompass hyphen in misspelled word that wraps across multiple lines https://bugs.webkit.org/show_bug.cgi?id=177980 Reviewed by Simon Fraser. On macOS the spelling and grammar annotations for a word or word phrase encompass hyphenations added because the word or word phrase wraps across more than one line. The effect tends to be more aesthetically pleasing and consistent with how these annotations would be pointed out by a person in conversation: by identify the word or phrase that has a spelling or grammar issue regardless of whether that word or phrase is broken into halves due to line wrapping. The same argument applies to other annotations on macOS, including text matches. Therefore, we should always include any hyphens encompassed by a marker that were added due to line wrapping when painting the marker. Test: editing/spelling/spelling-marker-includes-hyphen.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintDocumentMarker): Compute the text run including any added hyphens. If a hyphen was added then the inline text box represents that text up to the hyphen. Adjust the end position of the marker to be the length of the text run if its greater than or equal to the length of the text box. 2017-10-06 Zalan Bujtas RenderTable should not hold a collection of raw pointers to RenderTableCol https://bugs.webkit.org/show_bug.cgi?id=178030 Reviewed by Simon Fraser. In addition to the m_columnRenderersValid flag, this patch ensures that we don't dereference stale column renderers even when the flag is out of sync. Covered by existing tests. * rendering/RenderTable.cpp: (WebCore::RenderTable::updateColumnCache const): (WebCore::RenderTable::slowColElement const): * rendering/RenderTable.h: 2017-10-06 Zalan Bujtas RootInlineBox should not hold a collection of raw pointers to RenderBox https://bugs.webkit.org/show_bug.cgi?id=178025 Reviewed by Simon Fraser. There are already some assertions in place to check if the renderers are valid. Covered by existing test cases. * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlockFlow::reattachCleanLineFloats): (WebCore::RenderBlockFlow::determineStartPosition): (WebCore::RenderBlockFlow::determineEndPosition): * rendering/RootInlineBox.h: (WebCore::RootInlineBox::appendFloat): (WebCore::RootInlineBox::floatsPtr): 2017-10-06 Zalan Bujtas Continuation map should not hold a raw pointer https://bugs.webkit.org/show_bug.cgi?id=178021 Reviewed by Simon Fraser. This patch ensures proper lifetime management for renderers stored in the Continuation map (currently they rely on the correctness of addChild/takeChild methods). Covered by existing tests. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::continuation const): (WebCore::RenderBoxModelObject::setContinuation): 2017-10-06 Commit Queue Unreviewed, rolling out r222791 and r222873. https://bugs.webkit.org/show_bug.cgi?id=178031 Caused crashes with workers/wasm LayoutTests (Requested by ryanhaddad on #webkit). Reverted changesets: "WebAssembly: no VM / JS version of everything but Instance" https://bugs.webkit.org/show_bug.cgi?id=177473 http://trac.webkit.org/changeset/222791 "WebAssembly: address no VM / JS follow-ups" https://bugs.webkit.org/show_bug.cgi?id=177887 http://trac.webkit.org/changeset/222873 2017-10-06 Alex Christensen Add more infrastructure to apply custom header fields to same-origin requests https://bugs.webkit.org/show_bug.cgi?id=177629 Reviewed by Ryosuke Niwa. Covered by new API tests. * loader/DocumentLoader.h: (WebCore::DocumentLoader::customHeaderFields): * loader/HTTPHeaderField.cpp: (WebCore::HTTPHeaderField::create): (WebCore::HTTPHeaderField::HTTPHeaderField): Deleted. * loader/HTTPHeaderField.h: (WebCore::HTTPHeaderField::encode const): (WebCore::HTTPHeaderField::decode): Change HTTPHeaderField from one String containing the name and value to a string for the name and another for value. This matches HTTPHeaderMap and NSURLRequest more closely where names and values are treated as separate Strings. * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestResource): If the DocumentLoader has custom header fields from the WebsitePolicies, apply them to any same-origin requests. * loader/cache/CachedResourceRequest.h: (WebCore::CachedResourceRequest::resourceRequest): * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setCachePolicy): (WebCore::ResourceRequestBase::setTimeoutInterval): (WebCore::ResourceRequestBase::setHTTPMethod): (WebCore::ResourceRequestBase::setHTTPHeaderField): (WebCore::ResourceRequestBase::clearHTTPAuthorization): (WebCore::ResourceRequestBase::clearHTTPContentType): (WebCore::ResourceRequestBase::clearHTTPReferrer): (WebCore::ResourceRequestBase::clearHTTPOrigin): (WebCore::ResourceRequestBase::clearHTTPUserAgent): (WebCore::ResourceRequestBase::clearHTTPAccept): (WebCore::ResourceRequestBase::clearHTTPAcceptEncoding): (WebCore::ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray): (WebCore::ResourceRequestBase::setHTTPBody): (WebCore::ResourceRequestBase::setAllowCookies): (WebCore::ResourceRequestBase::setPriority): (WebCore::ResourceRequestBase::addHTTPHeaderFieldIfNotPresent): (WebCore::ResourceRequestBase::addHTTPHeaderField): (WebCore::ResourceRequestBase::setHTTPHeaderFields): non-HTTP/HTTPS ResourceRequests need to be updated, too, if header fields are added. Skipping updating non-HTTP/HTTPS ResourceRequests is not a valid shortcut, and with the growing importance of custom schemes with our new public API, we should update ResourceRequests of custom schemes correctly. 2017-10-06 Sam Weinig Add basic support for getting a ImageBitmapRenderingContext https://bugs.webkit.org/show_bug.cgi?id=177983 Reviewed by Dean Jackson. Add initial support for ImageBitmapRenderingContext. * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: Add new files. * dom/Document.cpp: * dom/Document.h: * dom/Document.idl: Add ImageBitmapRenderingContext to RenderingContext variant so it wil be able to be used with Document.getCSSCanvasContext. * html/HTMLCanvasElement.h: * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::setHeight): (WebCore::HTMLCanvasElement::setWidth): Throw an exception if the context is in the placeholder mode (which we signify via a special PlaceholderRenderingContext) as speced. This can't currently be hit, as setting a placeholder requires offscreen canvas support, coming soon. (WebCore::HTMLCanvasElement::getContext): Re-work to match the spec's matrix of options, adding in support for 'bitmaprenderer'/ ImageBitmapRenderingContext type as well as the placeholder mode. (WebCore::HTMLCanvasElement::createContext2d): (WebCore::HTMLCanvasElement::getContext2d): (WebCore::HTMLCanvasElement::isWebGLType): (WebCore::HTMLCanvasElement::createContextWebGL): (WebCore::HTMLCanvasElement::getContextWebGL): (WebCore::HTMLCanvasElement::createContextWebGPU): (WebCore::HTMLCanvasElement::getContextWebGPU): (WebCore::HTMLCanvasElement::isBitmapRendererType): (WebCore::HTMLCanvasElement::createContextBitmapRenderer): (WebCore::HTMLCanvasElement::getContextBitmapRenderer): Split creation out of the get functions so it can be called by getContext, where we know if the canvas is null or not. * html/HTMLCanvasElement.idl: Add ImageBitmapRenderingContext to RenderingContext variant so it wil be able to be used with HTMLCanvasElement.getContext. * html/canvas/CanvasRenderingContext.h: (WebCore::CanvasRenderingContext::isBitmapRenderer const): (WebCore::CanvasRenderingContext::isPlaceholder const): Add predicates for ImageBitmapRenderingContext and PlaceholderRenderingContext. * html/canvas/ImageBitmapRenderingContext.cpp: Added. (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext): * html/canvas/ImageBitmapRenderingContext.h: Added. * html/canvas/ImageBitmapRenderingContext.idl: Added. * html/canvas/PlaceholderRenderingContext.cpp: Added. (WebCore::PlaceholderRenderingContext::PlaceholderRenderingContext): * html/canvas/PlaceholderRenderingContext.h: Added. Add stubbed out implementations for the new contexts. 2017-10-06 Jer Noble Netflix playback fails with S7353 error https://bugs.webkit.org/show_bug.cgi?id=178023 Reviewed by Dean Jackson. On certain platforms, WebCoreDecompressionSession will fail to produce CVImageBuffers when presented with encrypted content. On those platforms, the seek() command will fail, because frames at the destination time cannot be decoded. This occurs for Netflix because the