<input>.labels is empty if type changes from text->hidden->checkbox
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-16  Chris Dumez  <cdumez@apple.com>
2
3         <input>.labels is empty if type changes from text->hidden->checkbox
4         https://bugs.webkit.org/show_bug.cgi?id=168358
5
6         Reviewed by Ryosuke Niwa.
7
8         We were invalidating LabelsNodeLists on 'for' attribute change.
9         We now also invalidate them of 'type' attribute change since
10         HTMLInputElements whose type is 'hidden' do not support labels.
11
12         No new tests, updated existing test.
13
14         * dom/Document.h:
15         * dom/LiveNodeList.h:
16         (WebCore::shouldInvalidateTypeOnAttributeChange):
17         * html/LabelsNodeList.cpp:
18         (WebCore::LabelsNodeList::LabelsNodeList):
19
20 2017-02-16  Michael Catanzaro  <mcatanzaro@igalia.com>
21
22         Remove even more EFL from WebCore
23         https://bugs.webkit.org/show_bug.cgi?id=168485
24
25         Reviewed by Alex Christensen.
26
27         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
28         (webkitAccessibleGetAttributes):
29         (atkRole):
30         * css/StyleRule.cpp:
31         (WebCore::StyleRuleBase::copy):
32         * platform/ContextMenuItem.h:
33         * platform/graphics/OpenGLESShims.h:
34         * platform/graphics/PlatformDisplay.cpp:
35         (WebCore::PlatformDisplay::createPlatformDisplay):
36         * platform/graphics/PlatformDisplay.h:
37         * platform/graphics/cairo/ImageBufferCairo.cpp:
38         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
39         (WebCore::Font::platformInit):
40         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
41         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
42         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
43         (WebCore::GraphicsLayerTextureMapper::setContentsToImage):
44         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
45         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
46         * platform/network/soup/ResourceErrorSoup.cpp:
47         (WebCore::ResourceError::timeoutError):
48         * platform/network/soup/SoupNetworkSession.cpp:
49         (WebCore::SoupNetworkSession::setProxySettingsFromEnvironment): Deleted.
50         * platform/network/soup/SoupNetworkSession.h:
51
52 2017-02-16  Daniel Bates  <dabates@apple.com>
53
54         Remove Chromium-specific code to call FrameLoaderClient::redirectDataToPlugin(nullptr)
55         https://bugs.webkit.org/show_bug.cgi?id=168417
56         <rdar://problem/30541748>
57
58         Reviewed by Brent Fulgham.
59
60         Remove Chromium-specific code that was added in r125500 to call FrameLoaderClient::redirectDataToPlugin(nullptr)
61         in PluginDocument::detachFromPluginElement(). Calling redirectDataToPlugin() with nullptr was used by the
62         Chromium port to signify that the plugin document was being destroyed so that they could tear down their
63         plugin widget. And PluginDocument::detachFromPluginElement() is the only place that calls redirectDataToPlugin()
64         passing nullptr. No other port made use of this machinery and the Chromium port has long since been removed
65         from the Open Source WebKit Project. We should remove this code.
66
67         * html/PluginDocument.cpp:
68         (WebCore::PluginDocumentParser::appendBytes): Pass the plugin widget by reference.
69         (WebCore::PluginDocument::detachFromPluginElement): Remove call to FrameLoaderClient::redirectDataToPlugin().
70         This call was only used by the Chromium port as means to be notified when the plugin document was being
71         destroyed. No other port made use of this notification or needed such a notification.
72         * loader/EmptyClients.cpp: Change argument of redirectDataToPlugin() from Widget* to Widget& to convey
73         that this function always takes a valid Widget. Also remove unnecessary argument name as the data type
74         of the argument and the name of the function sufficiently describes the purpose of the argument.
75         * loader/FrameLoaderClient.h: Ditto.
76
77 2017-02-16  Myles C. Maxfield  <mmaxfield@apple.com>
78
79         font-weight in @font-face can cause a font to be downloaded even when it's not used
80         https://bugs.webkit.org/show_bug.cgi?id=168114
81         <rdar://problem/30301317>
82
83         Reviewed by Darin Adler.
84
85         There were two problems with our font loading code.
86
87         When we are in the middle of a download, we will use a special interstitial font,
88         and this special font has a flag set which will cause it to be invisible when it is
89         drawn. However, when we start using this font during the load, we give it a
90         unicode-range of U+0-0 which means that it will never be used, and fallback will
91         happen to other weights immediately. 
92
93         The second problem with the font loading code is that this interstital font is just
94         Times. Times doesn't support every character, which means that if we are trying
95         to render some exotic character, we fall back to other weights. The solution here
96         is to use LastResort as the interstitial font, because it supports all characters.
97         Because its metrics are reasonable and we don't ever actually paint this
98         interstitial font, this choice is no worse than Times.
99
100         Tests: fast/text/font-style-download.html
101                fast/text/font-weight-download-2.html
102                fast/text/font-weight-download.html
103                fast/text/font-weight-fallback.html
104
105         * css/CSSFontFace.cpp:
106         (WebCore::CSSFontFace::font):
107         * css/CSSSegmentedFontFace.cpp:
108         (WebCore::appendFont):
109         (WebCore::CSSSegmentedFontFace::fontRanges):
110         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Deleted.
111         * platform/graphics/Font.h:
112         (WebCore::Font::widthForGlyph):
113         * platform/graphics/FontCache.h:
114         * platform/graphics/freetype/FontCacheFreeType.cpp:
115         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
116         * platform/graphics/mac/FontCacheMac.mm:
117         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
118         * platform/graphics/win/FontCacheWin.cpp:
119         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
120
121 2017-02-16  Alex Christensen  <achristensen@webkit.org>
122
123         Remove EFL-specific files in Source.
124
125         Rubber-stamped by Anders Carlsson.
126
127         * editing/efl: Removed.
128         * page/efl: Removed.
129         * platform/audio/efl: Removed.
130         * platform/efl: Removed.
131         * platform/efl/DefaultTheme: Removed.
132         * platform/efl/DefaultTheme/widget: Removed.
133         * platform/efl/DefaultTheme/widget/button: Removed.
134         * platform/efl/DefaultTheme/widget/check: Removed.
135         * platform/efl/DefaultTheme/widget/combo: Removed.
136         * platform/efl/DefaultTheme/widget/entry: Removed.
137         * platform/efl/DefaultTheme/widget/progressbar: Removed.
138         * platform/efl/DefaultTheme/widget/radio: Removed.
139         * platform/efl/DefaultTheme/widget/scrollbar: Removed.
140         * platform/efl/DefaultTheme/widget/search: Removed.
141         * platform/efl/DefaultTheme/widget/search/cancel: Removed.
142         * platform/efl/DefaultTheme/widget/search/decoration: Removed.
143         * platform/efl/DefaultTheme/widget/search/field: Removed.
144         * platform/efl/DefaultTheme/widget/slider: Removed.
145         * platform/efl/DefaultTheme/widget/spinner: Removed.
146         * platform/gamepad/efl: Removed.
147         * platform/graphics/efl: Removed.
148         * platform/graphics/surfaces/efl: Removed.
149         * platform/network/efl: Removed.
150
151 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
152
153         Add WebUSB to features.json as a "Not Considering".
154
155         * features.json:
156
157 2017-02-16  Alex Christensen  <achristensen@webkit.org>
158
159         Remove old URL parser
160         https://bugs.webkit.org/show_bug.cgi?id=168483
161
162         Reviewed by Tim Horton.
163
164         * platform/URL.cpp:
165         (WebCore::isSchemeFirstChar):
166         (WebCore::isSchemeChar):
167         (WebCore::URL::URL):
168         (WebCore::URL::setProtocol):
169         (WebCore::URL::setHost):
170         (WebCore::URL::removePort):
171         (WebCore::URL::setPort):
172         (WebCore::URL::setHostAndPort):
173         (WebCore::URL::setUser):
174         (WebCore::URL::setPass):
175         (WebCore::URL::setFragmentIdentifier):
176         (WebCore::URL::setQuery):
177         (WebCore::URL::setPath):
178         (WebCore::URL::serialize):
179         (WebCore::isUserInfoChar): Deleted.
180         (WebCore::isHostnameChar): Deleted.
181         (WebCore::isIPv6Char): Deleted.
182         (WebCore::isPathSegmentEndChar): Deleted.
183         (WebCore::appendASCII): Deleted.
184         (WebCore::findFirstOf): Deleted.
185         (WebCore::checkEncodedString): Deleted.
186         (WebCore::URL::init): Deleted.
187         (WebCore::appendEscapingBadChars): Deleted.
188         (WebCore::escapeAndAppendNonHierarchicalPart): Deleted.
189         (WebCore::copyPathRemovingDots): Deleted.
190         (WebCore::hasSlashDotOrDotDot): Deleted.
191         (WebCore::URL::parse): Deleted.
192         (WebCore::cannotBeABaseURL): Deleted.
193         (WebCore::isDefaultPortForScheme): Deleted.
194         (WebCore::hostPortIsEmptyButCredentialsArePresent): Deleted.
195         (WebCore::isNonFileHierarchicalScheme): Deleted.
196         (WebCore::isCanonicalHostnameLowercaseForScheme): Deleted.
197         (WebCore::findHostnamesInMailToURL): Deleted.
198         (WebCore::findHostnameInHierarchicalURL): Deleted.
199         (WebCore::encodeHostnames): Deleted.
200         (WebCore::encodeRelativeString): Deleted.
201         (WebCore::substituteBackslashes): Deleted.
202         * platform/URLParser.cpp:
203         (WebCore::URLParser::URLParser):
204         (WebCore::URLParser::setEnabled): Deleted.
205         (WebCore::URLParser::enabled): Deleted.
206         * platform/URLParser.h:
207         * platform/cf/URLCF.cpp:
208         (WebCore::URL::URL):
209         * platform/mac/URLMac.mm:
210         (WebCore::URL::URL):
211
212 2017-02-16  Anders Carlsson  <andersca@apple.com>
213
214         Build fixes.
215
216         * page/gtk/EventHandlerGtk.cpp:
217         (WebCore::EventHandler::createDraggingDataTransfer):
218         * page/win/EventHandlerWin.cpp:
219         (WebCore::EventHandler::createDraggingDataTransfer):
220
221 2017-02-16  Anders Carlsson  <andersca@apple.com>
222
223         Remove EFL from WebCore
224         https://bugs.webkit.org/show_bug.cgi?id=168477
225
226         Reviewed by Brian Burg.
227
228         * accessibility/AccessibilityList.cpp:
229         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
230         * accessibility/AccessibilityNodeObject.cpp:
231         (WebCore::AccessibilityNodeObject::canSetValueAttribute):
232         * accessibility/AccessibilityObject.cpp:
233         (WebCore::AccessibilityObject::AccessibilityObject):
234         (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange):
235         * accessibility/AccessibilityObject.h:
236         * accessibility/AccessibilityRenderObject.cpp:
237         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
238         * accessibility/AccessibilityTableColumn.cpp:
239         (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored):
240         * accessibility/AccessibilityTableHeaderContainer.cpp:
241         (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored):
242         * crypto/CryptoKey.cpp:
243         * crypto/keys/CryptoKeyRSA.h:
244         * dom/Document.cpp:
245         (WebCore::Document::implicitClose):
246         * editing/Editor.cpp:
247         (WebCore::Editor::performCutOrCopy):
248         (WebCore::Editor::copyImage):
249         * editing/Editor.h:
250         * editing/FrameSelection.h:
251         * html/HTMLCanvasElement.cpp:
252         (WebCore::requiresAcceleratedCompositingForWebGL):
253         * inspector/InspectorFrontendHost.cpp:
254         (WebCore::InspectorFrontendHost::port):
255         * loader/HistoryController.cpp:
256         (WebCore::HistoryController::restoreScrollPositionAndViewState):
257         * loader/icon/IconDatabase.cpp:
258         (WebCore::IconDatabase::performURLImport):
259         * page/ContextMenuController.cpp:
260         (WebCore::ContextMenuController::contextMenuItemSelected):
261         (WebCore::ContextMenuController::populate):
262         (WebCore::ContextMenuController::checkOrEnableIfNeeded):
263         * page/DragController.cpp:
264         (WebCore::DragController::startDrag):
265         * page/EventHandler.cpp:
266         (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult):
267         * page/FrameView.cpp:
268         (WebCore::FrameView::layout):
269         * platform/ContextMenuItem.h:
270         * platform/Cursor.h:
271         * platform/DragData.h:
272         * platform/DragImage.h:
273         * platform/FileSystem.h:
274         * platform/LocalizedStrings.h:
275         * platform/MIMETypeRegistry.cpp:
276         (WebCore::initializeSupportedImageMIMETypesForEncoding):
277         * platform/NotImplemented.h:
278         * platform/Pasteboard.h:
279         * platform/PlatformKeyboardEvent.h:
280         * platform/PlatformMouseEvent.h:
281         * platform/PlatformSpeechSynthesizer.h:
282         * platform/PlatformWheelEvent.h:
283         * platform/Widget.h:
284         * platform/graphics/ANGLEWebKitBridge.h:
285         * platform/graphics/BitmapImage.h:
286         * platform/graphics/GraphicsContext3D.h:
287         * platform/graphics/Icon.h:
288         * platform/graphics/Image.h:
289         (WebCore::Image::getEvasObject): Deleted.
290         * platform/graphics/IntPoint.h:
291         * platform/graphics/IntRect.h:
292         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
293         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
294         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
295         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
296         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
297         (WebCore::Extensions3DOpenGL::supportsExtension):
298         * platform/graphics/opengl/Extensions3DOpenGL.h:
299         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
300         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
301         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
302         (WebCore::GraphicsContext3D::createForCurrentGLContext):
303         (WebCore::GraphicsContext3D::reshape):
304         (WebCore::GraphicsContext3D::createVertexArray):
305         (WebCore::GraphicsContext3D::deleteVertexArray):
306         (WebCore::GraphicsContext3D::isVertexArray):
307         (WebCore::GraphicsContext3D::bindVertexArray):
308         * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
309         * platform/network/NetworkStateNotifier.h:
310         * platform/posix/FileSystemPOSIX.cpp:
311         * rendering/RenderLayerCompositor.cpp:
312         (WebCore::RenderLayerCompositor::ensureRootLayer):
313         * rendering/RenderText.cpp:
314         (WebCore::RenderText::previousOffsetForBackwardDeletion):
315         * xml/XSLStyleSheetLibxslt.cpp:
316         * xml/XSLTExtensions.cpp:
317         * xml/XSLTProcessorLibxslt.cpp:
318         * xml/XSLTUnicodeSort.cpp:
319
320 2017-02-16  Zalan Bujtas  <zalan@apple.com>
321
322         Simple line layout: Add forced line layout info to coverage print.
323         https://bugs.webkit.org/show_bug.cgi?id=168470
324
325         Reviewed by Simon Fraser.
326
327         This is about potential vs. actual coverage:
328
329         Simple line layout potential coverage: 65.05%
330         Simple line layout actual coverage: 46.60%
331         Forced line layout blocks: 4 content length: 57(18.45%)
332
333         Not testable.
334
335         * rendering/SimpleLineLayout.cpp:
336         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
337
338 2017-02-16  Anders Carlsson  <andersca@apple.com>
339
340         Rename DataTransfer functions to indicate whether they are for dragging or dropping
341         https://bugs.webkit.org/show_bug.cgi?id=168478
342
343         Reviewed by Tim Horton.
344
345         * dom/DataTransfer.cpp:
346         (WebCore::DataTransfer::createForDrag):
347         (WebCore::DataTransfer::createForDrop):
348         (WebCore::DataTransfer::createForDragAndDrop): Deleted.
349         * dom/DataTransfer.h:
350         * page/DragController.cpp:
351         (WebCore::DragController::dragExited):
352         (WebCore::DragController::performDragOperation):
353         (WebCore::DragController::tryDHTMLDrag):
354         * page/mac/EventHandlerMac.mm:
355         (WebCore::EventHandler::createDraggingDataTransfer):
356
357 2017-02-16  Anders Carlsson  <andersca@apple.com>
358
359         Rename EventHandler::freeDataTransfer to invalidateDataTransfer
360         https://bugs.webkit.org/show_bug.cgi?id=168472
361
362         Reviewed by Tim Horton.
363
364         The code doesn't necessarily free the data transfer object, so rename the member function
365         to reflect that. Also, get rid of a goto.
366
367         * page/EventHandler.cpp:
368         (WebCore::EventHandler::invalidateDataTransfer):
369         (WebCore::EventHandler::dragSourceEndedAt):
370         (WebCore::EventHandler::handleDrag):
371         (WebCore::EventHandler::freeDataTransfer): Deleted.
372         * page/EventHandler.h:
373
374 2017-02-16  Alex Christensen  <achristensen@webkit.org>
375
376         Special URLs without a host are invalid
377         https://bugs.webkit.org/show_bug.cgi?id=168461
378
379         Reviewed by Tim Horton.
380
381         http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
382         of URLParser which already fails with urls like http:// and this was just an oversight.
383         Covered by newly passing web platform tests.  Updated API tests.
384
385         * platform/URLParser.cpp:
386         (WebCore::URLParser::parse):
387
388 2017-02-16  Zalan Bujtas  <zalan@apple.com>
389
390         Simple line layout: Add support for pagination.
391         https://bugs.webkit.org/show_bug.cgi?id=168355
392         <rdar://problem/30119769>
393
394         Reviewed by David Hyatt.
395
396         This patch adds basic support for paginated content including widows and orphans.
397
398         This is based on the normal line layout pagination logic. However there are 2 major
399         advantages here (and they allow us to have a much simpler logic):
400         1. all the lines are positioned by the time we start paginating them and
401         2. lines always have uniform heights. 
402
403         This is not enabled yet.
404
405         * rendering/RenderBlockFlow.h:
406         * rendering/SimpleLineLayout.cpp:
407         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
408         (WebCore::SimpleLineLayout::computeLineBreakIndex):
409         (WebCore::SimpleLineLayout::setPageBreakForLine):
410         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
411         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
412         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
413         (WebCore::SimpleLineLayout::create):
414         (WebCore::SimpleLineLayout::Layout::create):
415         (WebCore::SimpleLineLayout::Layout::Layout):
416         * rendering/SimpleLineLayout.h:
417         (WebCore::SimpleLineLayout::Layout::isPaginated):
418         (WebCore::SimpleLineLayout::Layout::struts):
419         * rendering/SimpleLineLayoutFunctions.h:
420         (WebCore::SimpleLineLayout::computeFlowHeight):
421         * rendering/SimpleLineLayoutResolver.h:
422         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
423
424 2017-02-11  Filip Pizlo  <fpizlo@apple.com>
425
426         The collector thread should only start when the mutator doesn't have heap access
427         https://bugs.webkit.org/show_bug.cgi?id=167737
428
429         Reviewed by Keith Miller.
430
431         Added new tests in JSTests and LayoutTests.
432         
433         The WebCore changes involve:
434         
435         - Refactoring around new header discipline.
436         
437         - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.
438
439         * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
440         * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
441         * ForwardingHeaders/heap/MachineStackMarker.h: Added.
442         * ForwardingHeaders/heap/RunningScope.h: Added.
443         * bindings/js/CommonVM.cpp:
444         * testing/Internals.cpp:
445         (WebCore::Internals::parserMetaData):
446         (WebCore::Internals::isReadableStreamDisturbed):
447         (WebCore::Internals::isGCRunning):
448         (WebCore::Internals::addGCFinalizationCallback):
449         (WebCore::Internals::stopSweeping):
450         (WebCore::Internals::startSweeping):
451         * testing/Internals.h:
452         * testing/Internals.idl:
453
454 2017-02-16  Jiewen Tan  <jiewen_tan@apple.com>
455
456         [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
457         https://bugs.webkit.org/show_bug.cgi?id=167026
458
459         Reviewed by Chris Dumez.
460
461         Covered by existing tests.
462
463         * bindings/js/JSSubtleCryptoCustom.cpp:
464         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
465         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
466         (WebCore::toJSValueFromJsonWebKey): Deleted.
467         * crypto/JsonWebKey.h:
468         * crypto/JsonWebKey.idl:
469         * crypto/RsaOtherPrimesInfo.idl:
470         Change std::optional<String> to String in order to use toJS<IDLDictionary<JsonWebKey>>.
471         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
472         (WebCore::CryptoAlgorithmAES_CBC::importKey):
473         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
474         (WebCore::CryptoAlgorithmAES_KW::importKey):
475         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
476         (WebCore::CryptoAlgorithmHMAC::importKey):
477         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
478         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
479         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
480         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
481         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
482         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
483         * crypto/keys/CryptoKeyAES.cpp:
484         (WebCore::CryptoKeyAES::importJwk):
485         Only check if key_ops contains all of the specified usages when key_ops field of jwk is present,
486         as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
487         * crypto/keys/CryptoKeyAES.h:
488         * crypto/keys/CryptoKeyHMAC.cpp:
489         (WebCore::CryptoKeyHMAC::importJwk):
490         * crypto/keys/CryptoKeyHMAC.h:
491         * crypto/keys/CryptoKeyRSA.cpp:
492         (WebCore::CryptoKeyRSA::importJwk):
493         Accommodate the change from std::optional<String> to String.
494         * crypto/mac/CryptoKeyRSAMac.cpp:
495         (WebCore::CryptoKeyRSA::create):
496         Add a null check for p.
497
498 2017-02-16  Antti Koivisto  <antti@apple.com>
499
500         Execute pending scripts asynchronously after stylesheet loads complete
501         https://bugs.webkit.org/show_bug.cgi?id=168367
502         rdar://problem/30561379
503
504         Reviewed by Andreas Kling.
505
506         The current synchronous execution is fragile and creates various problems.
507
508         * css/StyleSheetContents.cpp:
509         (WebCore::StyleSheetContents::checkLoaded):
510         * dom/ContainerNode.cpp:
511         (WebCore::ContainerNode::takeAllChildrenFrom):
512         (WebCore::ContainerNode::notifyChildInserted):
513         (WebCore::ContainerNode::removeChild):
514         (WebCore::ContainerNode::parserRemoveChild):
515         (WebCore::ContainerNode::removeChildren):
516
517             Remove various places where we would trigger delayed synchronous execution.
518
519         * dom/Document.cpp:
520         (WebCore::Document::Document):
521         (WebCore::Document::recalcStyle):
522
523             Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.
524
525         (WebCore::Document::didRemoveAllPendingStylesheet):
526
527             Call asynchronous script execution function.
528
529         * dom/Document.h:
530         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
531         (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
532         * dom/ScriptableDocumentParser.cpp:
533         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
534         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
535         (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):
536
537             Add a timer for executing pending scripts.
538
539         (WebCore::ScriptableDocumentParser::detach):
540         * dom/ScriptableDocumentParser.h:
541         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
542         * html/HTMLLinkElement.cpp:
543         (WebCore::HTMLLinkElement::removedFrom):
544         (WebCore::HTMLLinkElement::removePendingSheet):
545         * html/HTMLLinkElement.h:
546         * html/parser/HTMLDocumentParser.cpp:
547         (WebCore::HTMLDocumentParser::detach):
548         * loader/DocumentLoader.cpp:
549         (WebCore::DocumentLoader::isLoadingInAPISense):
550
551             Stay in loading state if we have a pending script. This matches existing behavior.
552
553         * style/StyleScope.cpp:
554         (WebCore::Style::Scope::removePendingSheet):
555         * style/StyleScope.h:
556
557 2017-02-16  Anders Carlsson  <andersca@apple.com>
558
559         Set the DHTML drag image in the DHTML type check
560         https://bugs.webkit.org/show_bug.cgi?id=168451
561
562         Reviewed by Wenson Hsieh.
563
564         * page/DragController.cpp:
565         (WebCore::DragController::startDrag):
566
567 2017-02-16  Anders Carlsson  <andersca@apple.com>
568
569         Begin removing EFL code from WebCore.
570
571         Rubber-stamped by Alex Christensen.
572
573         * PlatformEfl.cmake: Removed.
574         * editing/efl/EditorEfl.cpp: Removed.
575         * page/efl/DragControllerEfl.cpp: Removed.
576         * page/efl/EventHandlerEfl.cpp: Removed.
577         * platform/audio/efl/AudioBusEfl.cpp: Removed.
578         * platform/efl/CursorEfl.cpp: Removed.
579         * platform/efl/DefaultTheme/CMakeLists.txt: Removed.
580         * platform/efl/DefaultTheme/default.edc: Removed.
581         * platform/efl/DefaultTheme/widget/button/button.edc: Removed.
582         * platform/efl/DefaultTheme/widget/button/img_button_focus.png: Removed.
583         * platform/efl/DefaultTheme/widget/button/img_button_hover.png: Removed.
584         * platform/efl/DefaultTheme/widget/button/img_button_normal.png: Removed.
585         * platform/efl/DefaultTheme/widget/button/img_button_press.png: Removed.
586         * platform/efl/DefaultTheme/widget/check/check.edc: Removed.
587         * platform/efl/DefaultTheme/widget/check/img_check_bg_disabled.png: Removed.
588         * platform/efl/DefaultTheme/widget/check/img_check_bg_enabled.png: Removed.
589         * platform/efl/DefaultTheme/widget/check/img_check_off.png: Removed.
590         * platform/efl/DefaultTheme/widget/check/img_check_off_focus.png: Removed.
591         * platform/efl/DefaultTheme/widget/check/img_check_off_hover.png: Removed.
592         * platform/efl/DefaultTheme/widget/check/img_check_on.png: Removed.
593         * platform/efl/DefaultTheme/widget/check/img_check_on_focus.png: Removed.
594         * platform/efl/DefaultTheme/widget/check/img_check_on_hover.png: Removed.
595         * platform/efl/DefaultTheme/widget/combo/combo.edc: Removed.
596         * platform/efl/DefaultTheme/widget/combo/combo_focus.png: Removed.
597         * platform/efl/DefaultTheme/widget/combo/combo_focus_button.png: Removed.
598         * platform/efl/DefaultTheme/widget/combo/combo_focus_button_transparent.png: Removed.
599         * platform/efl/DefaultTheme/widget/combo/combo_focus_transparent.png: Removed.
600         * platform/efl/DefaultTheme/widget/combo/combo_hover.png: Removed.
601         * platform/efl/DefaultTheme/widget/combo/combo_hover_button.png: Removed.
602         * platform/efl/DefaultTheme/widget/combo/combo_hover_button_transparent.png: Removed.
603         * platform/efl/DefaultTheme/widget/combo/combo_hover_transparent.png: Removed.
604         * platform/efl/DefaultTheme/widget/combo/combo_normal.png: Removed.
605         * platform/efl/DefaultTheme/widget/combo/combo_normal_button.png: Removed.
606         * platform/efl/DefaultTheme/widget/combo/combo_normal_button_transparent.png: Removed.
607         * platform/efl/DefaultTheme/widget/combo/combo_normal_transparent.png: Removed.
608         * platform/efl/DefaultTheme/widget/combo/combo_press.png: Removed.
609         * platform/efl/DefaultTheme/widget/combo/combo_press_button.png: Removed.
610         * platform/efl/DefaultTheme/widget/combo/combo_press_button_transparent.png: Removed.
611         * platform/efl/DefaultTheme/widget/combo/combo_press_transparent.png: Removed.
612         * platform/efl/DefaultTheme/widget/combo/icon.png: Removed.
613         * platform/efl/DefaultTheme/widget/entry/entry.edc: Removed.
614         * platform/efl/DefaultTheme/widget/entry/img_focused.png: Removed.
615         * platform/efl/DefaultTheme/widget/entry/img_hovered.png: Removed.
616         * platform/efl/DefaultTheme/widget/entry/img_normal.png: Removed.
617         * platform/efl/DefaultTheme/widget/progressbar/bt_base.png: Removed.
618         * platform/efl/DefaultTheme/widget/progressbar/progressbar.edc: Removed.
619         * platform/efl/DefaultTheme/widget/progressbar/shelf_inset.png: Removed.
620         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_disabled.png: Removed.
621         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_enabled.png: Removed.
622         * platform/efl/DefaultTheme/widget/radio/img_radio_off.png: Removed.
623         * platform/efl/DefaultTheme/widget/radio/img_radio_off_focus.png: Removed.
624         * platform/efl/DefaultTheme/widget/radio/img_radio_off_hover.png: Removed.
625         * platform/efl/DefaultTheme/widget/radio/img_radio_on.png: Removed.
626         * platform/efl/DefaultTheme/widget/radio/img_radio_on_focus.png: Removed.
627         * platform/efl/DefaultTheme/widget/radio/img_radio_on_hover.png: Removed.
628         * platform/efl/DefaultTheme/widget/radio/radio.edc: Removed.
629         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar.edc: Removed.
630         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_horizontal.png: Removed.
631         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_vertical.png: Removed.
632         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_horizontal.png: Removed.
633         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_vertical.png: Removed.
634         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button.png: Removed.
635         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button2.png: Removed.
636         * platform/efl/DefaultTheme/widget/search/cancel/search_cancel.edc: Removed.
637         * platform/efl/DefaultTheme/widget/search/decoration/decoration_normal_button.png: Removed.
638         * platform/efl/DefaultTheme/widget/search/decoration/search_decoration.edc: Removed.
639         * platform/efl/DefaultTheme/widget/search/field/field_focused.png: Removed.
640         * platform/efl/DefaultTheme/widget/search/field/field_hovered.png: Removed.
641         * platform/efl/DefaultTheme/widget/search/field/field_normal.png: Removed.
642         * platform/efl/DefaultTheme/widget/search/field/search_field.edc: Removed.
643         * platform/efl/DefaultTheme/widget/slider/slider.edc: Removed.
644         * platform/efl/DefaultTheme/widget/slider/slider_fill_h.png: Removed.
645         * platform/efl/DefaultTheme/widget/slider/slider_fill_v.png: Removed.
646         * platform/efl/DefaultTheme/widget/slider/slider_h.png: Removed.
647         * platform/efl/DefaultTheme/widget/slider/slider_thumb_h.png: Removed.
648         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_h.png: Removed.
649         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_v.png: Removed.
650         * platform/efl/DefaultTheme/widget/slider/slider_thumb_v.png: Removed.
651         * platform/efl/DefaultTheme/widget/slider/slider_v.png: Removed.
652         * platform/efl/DefaultTheme/widget/spinner/sp_bg.png: Removed.
653         * platform/efl/DefaultTheme/widget/spinner/sp_down_default.png: Removed.
654         * platform/efl/DefaultTheme/widget/spinner/sp_down_hover.png: Removed.
655         * platform/efl/DefaultTheme/widget/spinner/sp_down_pressed.png: Removed.
656         * platform/efl/DefaultTheme/widget/spinner/sp_up_default.png: Removed.
657         * platform/efl/DefaultTheme/widget/spinner/sp_up_hover.png: Removed.
658         * platform/efl/DefaultTheme/widget/spinner/sp_up_pressed.png: Removed.
659         * platform/efl/DefaultTheme/widget/spinner/spinner.edc: Removed.
660         * platform/efl/DragDataEfl.cpp: Removed.
661         * platform/efl/DragImageEfl.cpp: Removed.
662         * platform/efl/EflInspectorUtilities.cpp: Removed.
663         * platform/efl/EflInspectorUtilities.h: Removed.
664         * platform/efl/EflKeyboardUtilities.cpp: Removed.
665         * platform/efl/EflKeyboardUtilities.h: Removed.
666         * platform/efl/EflScreenUtilities.cpp: Removed.
667         * platform/efl/EflScreenUtilities.h: Removed.
668         * platform/efl/ErrorsEfl.cpp: Removed.
669         * platform/efl/ErrorsEfl.h: Removed.
670         * platform/efl/EventLoopEfl.cpp: Removed.
671         * platform/efl/FileSystemEfl.cpp: Removed.
672         * platform/efl/LocalizedStringsEfl.cpp: Removed.
673         * platform/efl/MIMETypeRegistryEfl.cpp: Removed.
674         * platform/efl/MainThreadSharedTimerEfl.cpp: Removed.
675         * platform/efl/PasteboardEfl.cpp: Removed.
676         * platform/efl/PlatformKeyboardEventEfl.cpp: Removed.
677         * platform/efl/PlatformMouseEventEfl.cpp: Removed.
678         * platform/efl/PlatformScreenEfl.cpp: Removed.
679         * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp: Removed.
680         * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed.
681         * platform/efl/PlatformSpeechSynthesizerEfl.cpp: Removed.
682         * platform/efl/PlatformWheelEventEfl.cpp: Removed.
683         * platform/efl/ScrollbarThemeEfl.cpp: Removed.
684         * platform/efl/ScrollbarThemeEfl.h: Removed.
685         * platform/efl/SoundEfl.cpp: Removed.
686         * platform/efl/TemporaryLinkStubs.cpp: Removed.
687         * platform/efl/UserAgentEfl.cpp: Removed.
688         * platform/efl/WidgetEfl.cpp: Removed.
689         * platform/gamepad/efl/GamepadsEfl.cpp: Removed.
690         * platform/graphics/efl/CairoUtilitiesEfl.cpp: Removed.
691         * platform/graphics/efl/CairoUtilitiesEfl.h: Removed.
692         * platform/graphics/efl/EvasGLContext.cpp: Removed.
693         * platform/graphics/efl/EvasGLContext.h: Removed.
694         * platform/graphics/efl/EvasGLSurface.cpp: Removed.
695         * platform/graphics/efl/EvasGLSurface.h: Removed.
696         * platform/graphics/efl/GraphicsContext3DEfl.cpp: Removed.
697         * platform/graphics/efl/GraphicsContext3DPrivate.cpp: Removed.
698         * platform/graphics/efl/GraphicsContext3DPrivate.h: Removed.
699         * platform/graphics/efl/IconEfl.cpp: Removed.
700         * platform/graphics/efl/ImageBufferEfl.cpp: Removed.
701         * platform/graphics/efl/ImageEfl.cpp: Removed.
702         * platform/graphics/efl/IntPointEfl.cpp: Removed.
703         * platform/graphics/efl/IntRectEfl.cpp: Removed.
704         * platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp: Removed.
705         * platform/network/efl/NetworkStateNotifierEfl.cpp: Removed.
706         * rendering/RenderThemeEfl.cpp: Removed.
707         * rendering/RenderThemeEfl.h: Removed.
708
709 2017-02-16  Joseph Pecoraro  <pecoraro@apple.com>
710
711         [Resource Timing] Support Resource Timing in Workers
712         https://bugs.webkit.org/show_bug.cgi?id=168086
713         <rdar://problem/30430117>
714
715         Reviewed by Alex Christensen.
716
717         Worker's load resources through the Document that loaded them. However,
718         their PerformanceResourceTiming entries should be added to the Performance
719         object inside the Worker context, not the Document's context.
720
721         This change adds an InitiatorContext to ResourceLoadOptions so that loaders
722         can determine if the load was initiated by the Document or a Worker. This
723         allows loaders to then know if the ResourceTiming data they collect should
724         be added to the Document's Performance object or forwarded on to the Worker's.
725
726         This adds a new ThreadableLoaderClient method intended only for the purpose
727         of adding the ResourceTiming information to the Worker's Performance object.
728         Unlike other ThreadableLoaderClient methods that are bridged and forwarded
729         on to a client inside the worker (e.g. XMLHttpRequest or FetchLoader) this
730         method never needs to be handled by clients and can be uniformly handled by
731         the WorkerThreadableLoader itself.
732
733         We also add a new ResourceTiming object that encapsulates all of the data
734         ultimately needed for a PerformanceResourceTimingEntry object. This allows
735         for all of the information to be gathered while loading on the Document
736         before serializing across to the Worker. That includes the Timing-Allow-Origin
737         check which uses the SecurityOrigin of the Worker.
738
739         This also modernizes and addresses issues in the Resource Timing implementation.
740         Better handling cases like loading from the Cache, Synchronous Loads, and
741         improving initiatorType information.
742
743         Tests: imported/w3c/web-platform-tests/resource-timing/rt-cors.html
744                imported/w3c/web-platform-tests/resource-timing/rt-cors.worker.html
745                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-css.html
746                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-element.html
747                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-fetch.html
748                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-media.html
749                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-other.html
750                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-script-module.html
751                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-xmlhttprequest.html
752                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType.worker.html
753                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.html
754                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.worker.html
755                imported/w3c/web-platform-tests/resource-timing/rt-resource-errors.html
756                imported/w3c/web-platform-tests/resource-timing/rt-resource-ignored.html
757                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-frame.html
758                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-worker.html
759                imported/w3c/web-platform-tests/resource-timing/rt-serialization.html
760                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-frames.html
761                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-workers.html
762                performance-api/resource-timing-apis.html
763
764         * CMakeLists.txt:
765         * WebCore.xcodeproj/project.pbxproj:
766         New files.
767
768         * platform/network/NetworkLoadTiming.h:
769         (WebCore::NetworkLoadTiming::reset): Deleted.
770         We no longer need to reset.
771
772         * loader/ResourceTiming.cpp: Added.
773         (WebCore::passesTimingAllowCheck):
774         (WebCore::ResourceTiming::fromCache):
775         (WebCore::ResourceTiming::fromLoad):
776         (WebCore::ResourceTiming::fromSynchronousLoad):
777         (WebCore::ResourceTiming::ResourceTiming):
778         (WebCore::ResourceTiming::isolatedCopy):
779         * loader/ResourceTiming.h: Added.
780         (WebCore::ResourceTiming::url):
781         (WebCore::ResourceTiming::initiator):
782         (WebCore::ResourceTiming::loadTiming):
783         (WebCore::ResourceTiming::networkLoadTiming):
784         (WebCore::ResourceTiming::allowTimingDetails):
785         (WebCore::ResourceTiming::overrideInitiatorName):
786         (WebCore::ResourceTiming::ResourceTiming):
787         Class that encapsulates all of the data needed for a PerformanceResourceTiming entry.
788         There are three static constructors indicating the different ways this object can
789         be constructed and the different data available at the time of construction.
790
791         * loader/ResourceLoaderOptions.h:
792         Add the new InitiatorContext, default to Document.
793
794         * loader/ThreadableLoaderClient.h:
795         (WebCore::ThreadableLoaderClient::didFinishTiming):
796         New client method only used by WorkerThreadableLoader.
797
798         * loader/WorkerThreadableLoader.h:
799         * loader/WorkerThreadableLoader.cpp:
800         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
801         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishTiming):
802         All loads initiated in a WorkerThreadableLoader get identified as InitiatorContext::Worker.
803         Add timing information to the Performance object when received. No need to inform clients.
804
805         * loader/DocumentThreadableLoader.h:
806         * loader/DocumentThreadableLoader.cpp:
807         (WebCore::DocumentThreadableLoader::finishedTimingForWorkerLoad):
808         (WebCore::DocumentThreadableLoader::loadRequest):
809         Provide APIs to pass timing data on to a WorkerThreadableLoader.
810         Create ResourceTiming data for synchronous loads.
811
812         * loader/LoadTiming.h:
813         * loader/LoadTiming.cpp:
814         (WebCore::LoadTiming::isolatedCopy):
815         Add isolatedCopy to allow this data to be passed across to a Worker.
816
817         * loader/ResourceTimingInformation.h:
818         * loader/ResourceTimingInformation.cpp:
819         (WebCore::ResourceTimingInformation::shouldAddResourceTiming):
820         (WebCore::ResourceTimingInformation::addResourceTiming):
821         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
822         Refactor to remove unused / unnecessary bits. Extract out some helpful code.
823         Changed this to match when Blink decides when to add or ignore entries, however
824         this may change over time.
825
826         * loader/SubresourceLoader.cpp:
827         (WebCore::SubresourceLoader::didFinishLoading):
828         (WebCore::SubresourceLoader::notifyDone):
829         (WebCore::SubresourceLoader::reportResourceTiming):
830         * loader/SubresourceLoader.h:
831         * loader/cache/CachedRawResource.cpp:
832         (WebCore::CachedRawResource::finishedTimingForWorkerLoad):
833         * loader/cache/CachedRawResource.h:
834         * loader/cache/CachedRawResourceClient.h:
835         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
836         Plumbing to report timing information to Worker if this resource was loaded for a Worker.
837
838         * loader/cache/CachedResource.cpp:
839         (WebCore::CachedResource::CachedResource):
840         * loader/cache/CachedResource.h:
841         (WebCore::CachedResource::initiatorName):
842         Store the initiator name on the CachedResource like other data added to the original
843         CachedResourceRequest. This is a bit of a hack but follows an existing pattern, and
844         cleans up other hacks that worked around this later on.
845
846         * loader/cache/CachedResourceLoader.h:
847         * loader/cache/CachedResourceLoader.cpp:
848         (WebCore::CachedResourceLoader::requestResource):
849         (WebCore::CachedResourceLoader::revalidateResource):
850         (WebCore::CachedResourceLoader::loadResource):
851         Simply the creation of a ResourceTiming object for cache hits.
852         Report timing information to Worker if this resource was loaded for a Worker.
853
854         (WebCore::CachedResourceLoader::loadDone):
855         Eliminate this redundant point attempting to add a ResourceTiming entry.
856
857         * loader/cache/CachedResourceRequest.cpp:
858         (WebCore::CachedResourceRequest::initiatorName):
859         Update to match the spec. The fallback is "other".
860
861         * page/Performance.h:
862         * page/Performance.cpp:
863         (WebCore::Performance::setResourceTimingBufferSize):
864         (WebCore::Performance::addResourceTiming):
865         Update to support PerformanceObservers.
866         Update to match spec (event should bubble).
867
868         * page/PerformanceResourceTiming.h:
869         * page/PerformanceResourceTiming.cpp:
870         (WebCore::PerformanceResourceTiming::create):
871         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
872         (WebCore::PerformanceResourceTiming::fetchStart):
873         (WebCore::PerformanceResourceTiming::domainLookupStart):
874         (WebCore::PerformanceResourceTiming::domainLookupEnd):
875         (WebCore::PerformanceResourceTiming::connectStart):
876         (WebCore::PerformanceResourceTiming::connectEnd):
877         (WebCore::PerformanceResourceTiming::secureConnectionStart):
878         (WebCore::PerformanceResourceTiming::requestStart):
879         (WebCore::PerformanceResourceTiming::responseStart):
880         (WebCore::PerformanceResourceTiming::responseEnd):
881         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
882         Construct with a ResourceTiming object containing all the data we need for the entry.
883         Update to match spec for what is required, should fallback, should be zero, etc.
884
885         (WebCore::passesTimingAllowCheck): Deleted.
886         Extracted this to ResourceTiming creation time in the loading context,
887         since this can't be determined on the Worker context without also having
888         all of the header information from each resource response.
889
890         * page/PerformanceResourceTiming.idl:
891         Expose to Workers!
892
893 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
894
895         [JSC] Drop PassRefPtr in inspector/
896         https://bugs.webkit.org/show_bug.cgi?id=168420
897
898         Reviewed by Alex Christensen.
899
900         Use Ref<Inspector::ScriptArguments> and Ref<ScriptCallStack> as much as possible.
901         It drops some unnecessary null checks.
902
903         * bindings/scripts/CodeGeneratorJS.pm:
904         (GenerateCallWith):
905         * bindings/scripts/test/JS/JSTestObj.cpp:
906         (WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStackCaller):
907         * dom/ScriptExecutionContext.cpp:
908         (WebCore::ScriptExecutionContext::PendingException::PendingException):
909         * inspector/InspectorInstrumentation.cpp:
910         (WebCore::InspectorInstrumentation::consoleCountImpl):
911         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
912         (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
913         * inspector/InspectorInstrumentation.h:
914         (WebCore::InspectorInstrumentation::consoleCount):
915         (WebCore::InspectorInstrumentation::stopConsoleTiming):
916         (WebCore::InspectorInstrumentation::consoleTimeStamp):
917         * inspector/InspectorNetworkAgent.cpp:
918         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
919         * inspector/TimelineRecordFactory.cpp:
920         (WebCore::TimelineRecordFactory::createGenericRecord):
921         * inspector/WebInjectedScriptManager.cpp:
922         (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
923         * inspector/WebInjectedScriptManager.h:
924         * page/DOMWindow.cpp:
925         (WebCore::DOMWindow::postMessageTimerFired):
926         We dispatch appropriate addMessage function according to whether
927         `timer.stackTrace()` is nullptr.
928
929         * page/PageConsoleClient.cpp:
930         (WebCore::PageConsoleClient::addMessage):
931         (WebCore::PageConsoleClient::messageWithTypeAndLevel):
932         (WebCore::PageConsoleClient::count):
933         (WebCore::PageConsoleClient::timeEnd):
934         (WebCore::PageConsoleClient::timeStamp):
935         * page/PageConsoleClient.h:
936         * workers/WorkerConsoleClient.cpp:
937         (WebCore::WorkerConsoleClient::messageWithTypeAndLevel):
938         (WebCore::WorkerConsoleClient::count):
939         (WebCore::WorkerConsoleClient::timeEnd):
940         (WebCore::WorkerConsoleClient::timeStamp):
941         * workers/WorkerConsoleClient.h:
942         * workers/WorkerGlobalScope.cpp:
943         (WebCore::WorkerGlobalScope::addMessage):
944
945 2017-02-16  Chris Fleizach  <cfleizach@apple.com>
946
947         AX: Make form validation accessible on iOS
948         https://bugs.webkit.org/show_bug.cgi?id=168400
949
950         Reviewed by Chris Dumez.
951
952         Hide the popover content of form validation from accessibility (since its not interactable)
953         and instead announce the message.
954
955         * platform/ios/ValidationBubbleIOS.mm:
956         (WebCore::ValidationBubble::show):
957
958 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
959
960         Clean up use of some CALayer-related SPI
961         https://bugs.webkit.org/show_bug.cgi?id=168401
962
963         Reviewed by Tim Horton.
964
965         Use -setDrawsAsynchronously: rather than the old -setAcceleratesDrawing: SPI.
966
967         Remove CATiledLayer-related stuff from QuartzCoreSPI.h, since we don't use it any more.
968
969         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
970         (PlatformCALayerCocoa::acceleratesDrawing):
971         (PlatformCALayerCocoa::setAcceleratesDrawing):
972         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
973         (-[WebTiledBackingLayer setDrawsAsynchronously:]): This override passes the state
974         onto the TileController.
975         (-[WebTiledBackingLayer setAcceleratesDrawing:]): Deleted.
976         * platform/ios/LegacyTileGridTile.mm:
977         (WebCore::LegacyTileGridTile::LegacyTileGridTile):
978         * platform/spi/cocoa/QuartzCoreSPI.h:
979
980 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
981
982         Web Inspector: allow import() inside the inspector
983         https://bugs.webkit.org/show_bug.cgi?id=167457
984
985         Reviewed by Ryosuke Niwa.
986
987         When evaluating `import("...")`, we need the caller's context to resolve
988         the module specifier correctly. For example, if `import("./cocoa.js")` is
989         evaluated in the script "drinks/hot.js", this module name is resolved to
990         "drinks/cocoa.js". If the same import operator is evaluated in the script
991         "menu/all.js", the module specifier becomes "menu/cocoa.js".
992
993         Previously we reject the import operator if the caller does not have such
994         a context. These context is SourceOrigin and its ScriptFetcher. While they
995         are offered in the script tag and other code evaluations, the inspector
996         console does not offer that. These class are offered in the WebCore side
997         and we should not touch these classes in the JSC's inspector code.
998
999         Now we relax the above restriction. If the above caller information is not
1000         offered, we fallback to the default one. In the web page, we use the page's
1001         URL as the caller's source origin. This allows us to evaluate the import
1002         operator in the inspector console.
1003
1004         And as of r167698, the console recognizes `await import("...")` form. We use
1005         this to test this `import()` in the console functionality.
1006
1007         Test: inspector/controller/runtime-controller-import.html
1008
1009         * bindings/js/ScriptModuleLoader.cpp:
1010         (WebCore::ScriptModuleLoader::importModule):
1011
1012 2017-02-16  Miguel Gomez  <magomez@igalia.com>
1013
1014         [GTK] scroll with transparent background not repainted after scrollY >= 32768
1015         https://bugs.webkit.org/show_bug.cgi?id=154283
1016
1017         Reviewed by Carlos Garcia Campos.
1018
1019         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
1020         not able to draw anything when using transformation matrices with values bigger than 32768. When
1021         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
1022         draw anything in, which causes the reported transparent backgrounds.
1023
1024         The patch modifies the transformation matrices both from the current context and the pattern we
1025         are painting, to avoid them to hold values that cannot stored in 16 bits.
1026
1027         There's still the possibility that this happens, but it would require using a pattern with a size
1028         bigger than 32768.
1029
1030         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
1031
1032         Test: fast/backgrounds/background-repeat-long-scroll.html
1033
1034         * platform/graphics/cairo/CairoUtilities.cpp:
1035         (WebCore::drawPatternToCairoContext):
1036
1037 2017-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
1038
1039         [GTK] Images are never read from the clipboard
1040         https://bugs.webkit.org/show_bug.cgi?id=168419
1041
1042         Reviewed by Sergio Villar Senin.
1043
1044         We write images in the clipboard, but we don't read them.
1045
1046         Fixes: editing/pasteboard/paste-image-using-image-data.html
1047
1048         * editing/Editor.cpp:
1049         (WebCore::Editor::createFragmentForImageAndURL): Moved from EditorMac.mm since it's cross-platform code.
1050         * editing/Editor.h:
1051         * editing/gtk/EditorGtk.cpp:
1052         (WebCore::createFragmentFromPasteboardData): Check if there's an image in the selection, and use
1053         Editor::createFragmentForImageAndURL in that case.
1054         * editing/mac/EditorMac.mm:
1055         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
1056         * platform/gtk/PasteboardHelper.cpp:
1057         (WebCore::PasteboardHelper::getClipboardContents): Check also if there's an image in the clipboard.
1058
1059 2017-02-15  Jer Noble  <jer.noble@apple.com>
1060
1061         REGRESSION (r212311): NULL-dereference in HTMLMediaElement::prepareToPlay()
1062         https://bugs.webkit.org/show_bug.cgi?id=168404
1063         <rdar://problem/30547188>
1064
1065         Reviewed by Brian Weinstein.
1066
1067         Prior to r212311, m_player was always guaranteed to be initialized when calling
1068         prepareToPlay(). r212311 began calling prepareToPlay() on a subsequent run-loop iteration
1069         after creating m_player. So now check whether m_player is NULL before calling methods on it.
1070
1071         * html/HTMLMediaElement.cpp:
1072         (WebCore::HTMLMediaElement::prepareToPlay):
1073
1074 2017-02-15  Eric Carlson  <eric.carlson@apple.com>
1075
1076         [MediaStream] delete CaptureDeviceInfo struct
1077         https://bugs.webkit.org/show_bug.cgi?id=168395
1078
1079         The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
1080         add an "enabled" field to the later, delete the former, and switch all uses of
1081         CaptureDeviceInfo to CaptureDevice.
1082
1083         Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
1084         and CaptureDeviceManager::captureDeviceFromDeviceID.
1085         
1086         Reviewed by Sam Weinig.
1087
1088         No new tests, no behavior change.
1089
1090         * Modules/mediastream/MediaDevicesRequest.cpp:
1091         (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
1092         * platform/mediastream/CaptureDevice.h:
1093         (WebCore::CaptureDevice::CaptureDevice):
1094         (WebCore::CaptureDevice::type): Renamed from kind.
1095         (WebCore::CaptureDevice::setType):
1096         (WebCore::CaptureDevice::enabled): Added.
1097         (WebCore::CaptureDevice::setEnabled):
1098         (WebCore::CaptureDevice::kind): Deleted.
1099         (WebCore::CaptureDevice::setKind): Deleted.
1100
1101         * platform/mediastream/CaptureDeviceManager.cpp:
1102         (CaptureDeviceManager::getSourcesInfo):
1103         (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
1104         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
1105         (CaptureDeviceManager::sourceWithUID):
1106         * platform/mediastream/CaptureDeviceManager.h:
1107         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
1108         (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
1109
1110         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1111         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1112         (WebCore::AVCaptureDeviceManager::captureDevices):
1113         (WebCore::deviceIsAvailable):
1114         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
1115         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
1116         (WebCore::AVCaptureDeviceManager::deviceConnected):
1117         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
1118         (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
1119         (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
1120         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
1121         * platform/mock/MockRealtimeMediaSource.cpp:
1122         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
1123         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
1124
1125 2017-02-15  Sam Weinig  <sam@webkit.org>
1126
1127         [WebIDL] Remove custom conversion from FontFace code by using a Variant
1128         https://bugs.webkit.org/show_bug.cgi?id=168384
1129
1130         Reviewed by Alex Christensen.
1131
1132         Match the font face spec and use a union rather than any in the FontFace constructor.
1133
1134         Test: Added additional cases to fast/text/font-face-javascript.html.
1135
1136         * css/FontFace.cpp:
1137         (WebCore::FontFace::create):
1138         * css/FontFace.h:
1139         * css/FontFace.idl:
1140
1141 2017-02-15  Jer Noble  <jer.noble@apple.com>
1142
1143         Disabled Media Sources should render black/silence
1144         https://bugs.webkit.org/show_bug.cgi?id=168281
1145
1146         Reviewed by Eric Carlson.
1147
1148         Test: webrtc/video-disabled-black.html
1149
1150         Pass the enabled flag setting down from the MediaStreamTrackPrivate to its underlying
1151         source, including RealtimeMediaSource and RealtimeOutgoingAudio/VideoSource. When either
1152         enabled is cleared or muted is set, generate empty (black or silent) media, as opposed to
1153         pausing media or (worse) continuing to send generated media.
1154
1155         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1156         (WebCore::MediaStreamTrackPrivate::setEnabled):
1157         (WebCore::MediaStreamTrackPrivate::sourceEnabledChanged):
1158         * platform/mediastream/MediaStreamTrackPrivate.h:
1159         * platform/mediastream/RealtimeMediaSource.cpp:
1160         (WebCore::RealtimeMediaSource::setEnabled):
1161         * platform/mediastream/RealtimeMediaSource.h:
1162         (WebCore::RealtimeMediaSource::enabled):
1163         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1164         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1165         (WebCore::MockRealtimeAudioSourceMac::render):
1166         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1167         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
1168         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
1169         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1170         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1171         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1172         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
1173         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
1174         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1175         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1176         * platform/mock/MockRealtimeVideoSource.cpp:
1177         (WebCore::MockRealtimeVideoSource::generateFrame):
1178
1179 2017-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1180
1181         Editing history scripts should not add the contenteditable attribute or override key events
1182         https://bugs.webkit.org/show_bug.cgi?id=168389
1183         <rdar://problem/30529945>
1184
1185         Reviewed by Dan Bernstein.
1186
1187         Clients that hook into editing history tracking should handle setting the contenteditable attribute on the body
1188         rather than have the script add it to the body. Additionally, this script should NOT be overriding any keydown
1189         events. These were initially added for compatibility with a test harness early on, and should have been removed
1190         earlier.
1191
1192         * Scripts/DumpEditingHistory.js:
1193
1194 2017-02-15  Jer Noble  <jer.noble@apple.com>
1195
1196         Pass "RequiresCustomURLLoading" in AVURLAsset options dictionary
1197         https://bugs.webkit.org/show_bug.cgi?id=168381
1198
1199         Reviewed by Eric Carlson.
1200
1201         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1202         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
1203
1204 2017-02-15  Anders Carlsson  <andersca@apple.com>
1205
1206         Fix build.
1207
1208         * page/DragController.cpp:
1209         (WebCore::DragController::doSystemDrag):
1210
1211 2017-02-15  Anders Carlsson  <andersca@apple.com>
1212
1213         Modernize DragClient::startDrag somewhat
1214         https://bugs.webkit.org/show_bug.cgi?id=168379
1215
1216         Reviewed by Tim Horton.
1217
1218         Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
1219         instead of whether it's a link or not.
1220
1221         * loader/EmptyClients.cpp:
1222         * page/DragClient.h:
1223         * page/DragController.cpp:
1224         (WebCore::DragController::startDrag):
1225         (WebCore::DragController::doImageDrag):
1226         (WebCore::DragController::doSystemDrag):
1227         * page/DragController.h:
1228
1229 2017-02-15  Chris Dumez  <cdumez@apple.com>
1230
1231         Expose Symbol.toPrimitive / valueOf on Location instances
1232         https://bugs.webkit.org/show_bug.cgi?id=168295
1233
1234         Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
1235
1236         Expose Symbol.toPrimitive / valueOf on Location instances as per:
1237         - https://html.spec.whatwg.org/#the-location-interface
1238
1239         Firefox and Chrome already comply with the specification.
1240
1241         Tests: fast/dom/location-valueOf-after-object-prototype-update.html
1242                fast/dom/location-valueOf-after-object-prototype-update2.html
1243                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
1244                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
1245
1246         * bindings/scripts/CodeGeneratorJS.pm:
1247         (GenerateImplementation):
1248
1249 2017-02-15  Aakash Jain  <aakash_jain@apple.com>
1250
1251         Remove WebIOSEvent interface
1252         https://bugs.webkit.org/show_bug.cgi?id=168368
1253
1254         Reviewed by Tim Horton.
1255
1256         * platform/ios/WebEvent.h: Removed WebIOSEvent.
1257
1258 2017-02-15  Chris Dumez  <cdumez@apple.com>
1259
1260         [iOS] Form Validation Bubble should be sensitive to Dynamic Type
1261         https://bugs.webkit.org/show_bug.cgi?id=168291
1262         <rdar://problem/30508593>
1263
1264         Reviewed by Tim Horton.
1265
1266         Update ValidationBubble implementation on iOS to stop obeying the
1267         minimum font size setting, given that this setting is not exposed
1268         on iOS. Instead, we now rely on
1269         [UIFont preferredFontForTextStyle:UIFontTextStyleCallout], which
1270         will give us a font whose size obeys Dynamic Type [1] setting on iOS.
1271
1272         [1] https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/
1273
1274         No new tests, no easily testable.
1275
1276         * platform/ios/ValidationBubbleIOS.mm:
1277         (WebCore::ValidationBubble::ValidationBubble):
1278
1279 2017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>
1280
1281         [JSC] Drop PassRefPtr
1282         https://bugs.webkit.org/show_bug.cgi?id=168320
1283
1284         Reviewed by Saam Barati.
1285
1286         * bindings/js/ScriptSourceCode.h:
1287         (WebCore::ScriptSourceCode::ScriptSourceCode):
1288         Use Ref and pass it to SourceCode.
1289
1290         * replay/ReplayController.cpp:
1291         (WebCore::ReplayController::frameNavigated):
1292         Pass reference.
1293
1294 2017-02-15  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1295
1296         [GStreamer][MSE][EME] Handle protection event also at decryptor level
1297         https://bugs.webkit.org/show_bug.cgi?id=168316
1298
1299         Reviewed by Žan Doberšek.
1300
1301         So far in MSE pipeline we were handling the encryption events
1302         only when they arrived at the demuxer but this won't work in any
1303         kind of key renegotiation as the event will never arrive. Now we
1304         connect to the element messages, check for the drm id and send it
1305         to the private player for processing.
1306
1307         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1308         (WebCore::appendPipelineElementMessageCallback):
1309         (WebCore::AppendPipeline::AppendPipeline):
1310         (WebCore::AppendPipeline::handleElementMessage):
1311         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1312
1313 2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
1314
1315         [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
1316         https://bugs.webkit.org/show_bug.cgi?id=168362
1317
1318         Reviewed by Xabier Rodriguez-Calvar.
1319
1320         In MediaKeys::setServerCertificate(), when the CDM implementation
1321         doesn't support server certificates, it should resolve the promise
1322         with the 'false' value, as mandated by the specification, and not
1323         reject it.
1324
1325         A test case in mock-MediaKeys-setServerCertificate.html is updated.
1326
1327         * Modules/encryptedmedia/MediaKeys.cpp:
1328         (WebCore::MediaKeys::setServerCertificate):
1329
1330 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1331
1332         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
1333         https://bugs.webkit.org/show_bug.cgi?id=168115
1334
1335         Reviewed by Darin Adler.
1336
1337         In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
1338         fetch specification, but the uncommon headers are still combined with ", ".
1339
1340         * platform/network/HTTPHeaderMap.cpp:
1341         (WebCore::HTTPHeaderMap::add):
1342
1343 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
1344
1345         An assertion failure inside removeChildren
1346         https://bugs.webkit.org/show_bug.cgi?id=168069
1347
1348         Reviewed by Brent Fulgham.
1349
1350         The bug was caused by notifyRemovePendingSheet executing scripts synchronously where it shouldn't.
1351
1352         Removed the call to notifyRemovePendingSheetIfNeeded in notifyChildNodeRemoved. Instead, invoke it
1353         in its call sites when they're safe.
1354
1355         Test: http/tests/security/move-iframe-within-focus-handler-inside-removal.html
1356
1357         * dom/ContainerNode.cpp:
1358         (WebCore::ContainerNode::takeAllChildrenFrom):
1359         (WebCore::ContainerNode::notifyChildInserted):
1360         (WebCore::ContainerNode::removeChild):
1361         (WebCore::ContainerNode::parserRemoveChild):
1362         (WebCore::ContainerNode::replaceAllChildren):
1363         (WebCore::ContainerNode::removeChildren):
1364         * dom/ContainerNodeAlgorithms.cpp:
1365         (WebCore::notifyChildNodeRemoved):
1366
1367 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1368
1369         [GStreamer] Several tests are timing out after r212349
1370         https://bugs.webkit.org/show_bug.cgi?id=168359
1371
1372         Reviewed by Žan Doberšek.
1373
1374         This is because they are failing the cross origin check. Those tests are not using WebKitWebSrc, but
1375         GstFileSrc. I didn't consider the case of source not being a WebKitWebSrc.
1376
1377         Fixes several timeout instroduced in r212349.
1378
1379         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1380         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): Split the source check in two. First check if
1381         it's nullptr, and return false. Then check if it's a WebKitWebSrc and return true if it isn't.
1382
1383 2017-02-14  Brent Fulgham  <bfulgham@apple.com>
1384
1385         Revalidate URL after events that could trigger navigations
1386         https://bugs.webkit.org/show_bug.cgi?id=168071
1387         <rdar://problem/30450379>
1388
1389         Reviewed by Ryosuke Niwa.
1390
1391         When arbitary javascript runs during a load, we should revalidate
1392         the URLs involved to make sure they are still valid.
1393
1394         Tests: http/tests/plugins/navigation-during-load-embed.html
1395                http/tests/plugins/navigation-during-load.html
1396
1397         * html/HTMLEmbedElement.cpp:
1398         (WebCore::HTMLEmbedElement::updateWidget): Confirm we are still allowed to
1399         load the URL after executing JS callbacks.
1400         * html/HTMLFrameElementBase.cpp:
1401         (WebCore::HTMLFrameElementBase::isURLAllowed): Split existing function into
1402         existing protected method, and a new public method that checks a passed URL
1403         for validity.
1404         * html/HTMLFrameElementBase.h:
1405         * html/HTMLFrameOwnerElement.h:
1406         (WebCore::HTMLFrameOwnerElement::isURLAllowed):
1407         * html/HTMLObjectElement.cpp:
1408         (WebCore::HTMLObjectElement::updateWidget): Confirm we are still allowed to
1409         load the URL after executing JS callbacks.
1410         * loader/SubframeLoader.cpp:
1411         (WebCore::SubframeLoader::requestFrame): Ditto.
1412
1413 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1414
1415         [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin()
1416         https://bugs.webkit.org/show_bug.cgi?id=168322
1417
1418         Reviewed by Žan Doberšek.
1419
1420         It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track
1421         the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross
1422         origin redirection.
1423
1424         Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html
1425
1426         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1427         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin):
1428         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1429         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1430         (webKitWebSrcFinalize):
1431         (webKitWebSrcGetProperty):
1432         (webKitWebSrcStart):
1433         (webKitWebSrcQueryWithParent):
1434         (webKitWebSrcGetUri):
1435         (webKitWebSrcSetUri):
1436         (StreamingClient::handleResponseReceived):
1437         (ResourceHandleStreamingClient::wasBlocked):
1438         (ResourceHandleStreamingClient::cannotShowURL):
1439
1440 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1441
1442         Unreviewed, rolling out r211967.
1443
1444         Caused rendering issues in HiDPI
1445
1446         Reverted changeset:
1447
1448         "[GTK] scroll with transparent background not repainted after
1449         scrollY >= 32768"
1450         https://bugs.webkit.org/show_bug.cgi?id=154283
1451         http://trac.webkit.org/changeset/211967
1452
1453 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1454
1455         [GTK] Update cookie manager API to properly work with ephemeral sessions
1456         https://bugs.webkit.org/show_bug.cgi?id=168230
1457
1458         Reviewed by Michael Catanzaro.
1459
1460         Add implementation for deleteAllCookiesModifiedSince. Note that this only works when the timespan is 0, we need
1461         new libsoup API to support removing recently modified cookies.
1462
1463         * platform/network/soup/CookieJarSoup.cpp:
1464         (WebCore::deleteAllCookiesModifiedSince):
1465
1466 2017-02-14  Joseph Pecoraro  <pecoraro@apple.com>
1467
1468         [WebIDL] Improve serializer = { inherit }
1469         https://bugs.webkit.org/show_bug.cgi?id=168293
1470
1471         Reviewed by Youenn Fablet.
1472
1473         * bindings/scripts/CodeGeneratorJS.pm:
1474         (GenerateHeader):
1475         Expose a serialize() method on the interface.
1476
1477         (GenerateSerializerFunction):
1478         (GenerateSerializerAttributesForInterface): Deleted.
1479         Subclasses that have `serializer = { inherit }` can use
1480         their parent's serialize() method to get the initial object.
1481         We can now collapse everything back into a single function
1482         because we only generate code for our own attributes.
1483
1484         * bindings/scripts/test/JS/JSTestNode.cpp:
1485         (WebCore::JSTestNode::serialize):
1486         (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
1487         * bindings/scripts/test/JS/JSTestNode.h:
1488         * bindings/scripts/test/JS/JSTestObj.cpp:
1489         (WebCore::JSTestObj::serialize):
1490         (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
1491         * bindings/scripts/test/JS/JSTestObj.h:
1492         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1493         (WebCore::JSTestSerialization::serialize):
1494         (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
1495         * bindings/scripts/test/JS/JSTestSerialization.h:
1496         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1497         (WebCore::JSTestSerializationInherit::serialize):
1498         (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
1499         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
1500         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1501         (WebCore::JSTestSerializationInheritFinal::serialize):
1502         (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
1503         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
1504         Updated results.
1505
1506 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
1507
1508         Move methods from WebCoreThread.h to WebCoreThreadInternal.h
1509         https://bugs.webkit.org/show_bug.cgi?id=168326
1510
1511         Reviewed by Alexey Proskuryakov.
1512
1513         * platform/ios/wak/WebCoreThread.h: Move methods WebThreadRunLoop and WebThreadCurrentContext to WebCoreThreadInternal.h
1514         * platform/ios/wak/WebCoreThreadInternal.h: Ditto.
1515         * platform/ios/wak/WebCoreThreadRun.cpp: Removed WebCoreThread.h as it is already included by WebCoreThreadInternal.h
1516         * platform/ios/wak/WKGraphics.mm: Included WebCoreThreadInternal.h, it subsequently includes WebCoreThread.h
1517         * inspector/InspectorTimelineAgent.cpp: Ditto.
1518         * page/mac/PageMac.mm: Ditto.
1519         * platform/cf/MainThreadSharedTimerCF.cpp: Ditto.
1520         * platform/cocoa/MemoryPressureHandlerCocoa.mm: Ditto.
1521         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Ditto.
1522         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Ditto.
1523         * bindings/js/CommonVM.cpp: included WebCoreThreadInternal.h
1524
1525 2017-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1526
1527         [WK2] Support data interaction on links
1528         https://bugs.webkit.org/show_bug.cgi?id=168331
1529         <rdar://problem/30200837>
1530
1531         Reviewed by Tim Horton.
1532
1533         Adds support for data interaction on links at the WebCore layer, refactoring some drag-and-drop code on the Mac
1534         along the way. Also adds two new TestWebKitAPI unit tests in DataInteractionTests.mm: LinkToInput and
1535         BackgroundImageLinkToInput (see Tools/ChangeLog for more information).
1536
1537         * page/DragController.cpp:
1538         (WebCore::DragController::startDrag):
1539         (WebCore::DragController::doImageDrag):
1540         (WebCore::DragController::doSystemDrag):
1541
1542         Introduce platformAdjustDragImageForDeviceScaleFactor, and special-case drag images for links to anchor at the
1543         bottom center.
1544
1545         * platform/DragImage.cpp:
1546         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
1547
1548         Scale the drag image up by the device scale factor. In WebDragClient, we scale the image back down to the
1549         original size. It seems the reason we do this extra dance is because the image sizing heuristic in between
1550         assumes that the image dimensions are for a non-retina device, but this work should really not be necessary if
1551         we tweak the heuristic to account for deviceScaleFactor. We should address this in a separate patch.
1552
1553         * platform/DragImage.h:
1554         * platform/graphics/Path.h:
1555
1556 2017-02-14  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
1557
1558         [CURL] ResourceError created with error information should have default type Type::General
1559         https://bugs.webkit.org/show_bug.cgi?id=168345
1560
1561         Reviewed by Alex Christensen.
1562
1563         ResourceError has separate implementaion for each platform
1564         so that the interface should be same.
1565         On CURL port, the constructor with error information has
1566         different default value on `type` parameter. It is Type::Null but other implementaitons have Type::General.
1567         This causes some ResourceError is created inconsistent. 
1568
1569         * platform/network/curl/ResourceError.h:
1570         (WebCore::ResourceError::ResourceError):
1571
1572 2017-02-14  Youenn Fablet  <youennf@gmail.com>
1573
1574         [WebRTC] Add support for libwebrtc negotiation needed event
1575         https://bugs.webkit.org/show_bug.cgi?id=168267
1576
1577         Reviewed by Eric Carlson.
1578
1579         Test: webrtc/negotiatedneeded-event-addStream.html
1580
1581         Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
1582         This code handles the control of sending or not the negotiationneeded event.
1583
1584         Updating mock to use markAsNeedingNegotiation when streams are changed.
1585         Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.
1586
1587         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1588         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
1589         * Modules/mediastream/MediaEndpointPeerConnection.h:
1590         * Modules/mediastream/PeerConnectionBackend.cpp:
1591         (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
1592         * Modules/mediastream/PeerConnectionBackend.h:
1593         (WebCore::PeerConnectionBackend::isNegotiationNeeded):
1594         (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
1595         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1596         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
1597         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1598         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1599         * testing/MockLibWebRTCPeerConnection.cpp:
1600         (WebCore::MockLibWebRTCPeerConnection::AddStream):
1601         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
1602
1603 2017-02-14  Brady Eidson  <beidson@apple.com>
1604
1605         Unreviewed followup to r212330 to fix Debug builds
1606
1607         * loader/DocumentThreadableLoader.cpp:
1608         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Add call to relaxAdoptionRequirement().
1609
1610 2017-02-14  Matt Rajca  <mrajca@apple.com>
1611
1612         Website policies: iframes should respect the autoplay policy of the top-level document
1613         https://bugs.webkit.org/show_bug.cgi?id=168333
1614
1615         Reviewed by Alex Christensen.
1616
1617         API tests were added.
1618
1619         * html/HTMLMediaElement.cpp:
1620         (WebCore::HTMLMediaElement::HTMLMediaElement):
1621
1622 2017-02-14  Dean Jackson  <dino@apple.com>
1623
1624         Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower
1625         https://bugs.webkit.org/show_bug.cgi?id=168339
1626         <rdar://problem/30522092>
1627
1628         Reviewed by Simon Fraser.
1629
1630         Use a setting name that more clearly reflects what it is doing. It's not
1631         preferring to use the low-power GPU, it's forcing it.
1632
1633         * html/canvas/WebGLRenderingContextBase.cpp:
1634         (WebCore::WebGLRenderingContextBase::create):
1635         * page/Settings.in:
1636
1637 2017-02-14  Brady Eidson  <beidson@apple.com>
1638
1639         Speculative fix for: Crash in DocumentThreadableLoader::redirectReceived.
1640         <rdar://problem/29899473> and https://bugs.webkit.org/show_bug.cgi?id=168337
1641
1642         Reviewed by Geoffrey Garen.
1643
1644         No new tests (Unable to find a reproduction).
1645
1646         * loader/DocumentThreadableLoader.cpp:
1647         (WebCore::DocumentThreadableLoader::loadRequest):
1648
1649 2017-02-14  Youenn Fablet  <youenn@apple.com>
1650
1651         [WebRTC] Remove obsolete WebRTC stats API
1652         https://bugs.webkit.org/show_bug.cgi?id=167910
1653
1654         Reviewed by Alex Christensen.
1655
1656         No change of behavior as removed constructs are not functional.
1657         Removing RTCStatsResponse which no longer exists and made RTCStatsReport an empty container for now.
1658
1659         * CMakeLists.txt:
1660         * DerivedSources.cpp:
1661         * DerivedSources.make:
1662         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1663         (WebCore::MediaEndpointPeerConnection::getStats):
1664         * Modules/mediastream/MediaEndpointPeerConnection.h:
1665         * Modules/mediastream/PeerConnectionBackend.h:
1666         * Modules/mediastream/RTCPeerConnection.cpp:
1667         (WebCore::RTCPeerConnection::getStats):
1668         * Modules/mediastream/RTCStatsReport.cpp:
1669         (WebCore::RTCStatsReport::create): Deleted.
1670         (WebCore::RTCStatsReport::RTCStatsReport): Deleted.
1671         (WebCore::RTCStatsReport::names): Deleted.
1672         (WebCore::RTCStatsReport::local): Deleted.
1673         (WebCore::RTCStatsReport::remote): Deleted.
1674         (WebCore::RTCStatsReport::addStatistic): Deleted.
1675         * Modules/mediastream/RTCStatsReport.h:
1676         (WebCore::RTCStatsReport::create):
1677         (WebCore::RTCStatsReport::timestamp): Deleted.
1678         (WebCore::RTCStatsReport::id): Deleted.
1679         (WebCore::RTCStatsReport::type): Deleted.
1680         (WebCore::RTCStatsReport::stat): Deleted.
1681         * Modules/mediastream/RTCStatsReport.idl:
1682         * Modules/mediastream/RTCStatsResponse.cpp: Removed.
1683         * Modules/mediastream/RTCStatsResponse.h: Removed.
1684         * Modules/mediastream/RTCStatsResponse.idl: Removed.
1685         * WebCore.xcodeproj/project.pbxproj:
1686         * platform/mediastream/MediaEndpoint.h:
1687         (WebCore::MediaEndpoint::getStats):
1688         * platform/mediastream/RTCStatsRequest.h: Removed.
1689         * platform/mediastream/RTCStatsResponseBase.h: Removed.
1690
1691 2017-02-14  Karim H  <karim@karhm.com>
1692
1693         Removed unused methods of WebCore::FileStream
1694         https://bugs.webkit.org/show_bug.cgi?id=168025
1695
1696         Reviewed by Michael Catanzaro.
1697
1698         * fileapi/AsyncFileStream.cpp:
1699         (WebCore::AsyncFileStream::openForWrite): Deleted.
1700         (WebCore::AsyncFileStream::write): Deleted.
1701         (WebCore::AsyncFileStream::truncate): Deleted.
1702         * fileapi/AsyncFileStream.h:
1703         * platform/FileStream.cpp:
1704         (WebCore::FileStream::openForWrite): Deleted.
1705         (WebCore::FileStream::write): Deleted.
1706         (WebCore::FileStream::truncate): Deleted.
1707         * platform/FileStream.h:
1708
1709 2017-02-14  Chris Dumez  <cdumez@apple.com>
1710
1711         HTML Form Validation bubble should take minimum font size setting into consideration
1712         https://bugs.webkit.org/show_bug.cgi?id=168271
1713         <rdar://problem/29869869>
1714
1715         Reviewed by Simon Fraser.
1716
1717         HTML Form Validation bubble should take minimum font size setting into consideration
1718         for better accessibility.
1719
1720         Test: fast/forms/validation-message-minimum-font-size.html
1721
1722         * platform/ValidationBubble.h:
1723         (WebCore::ValidationBubble::create):
1724         (WebCore::ValidationBubble::fontSize):
1725         * platform/ios/ValidationBubbleIOS.mm:
1726         (WebCore::ValidationBubble::ValidationBubble):
1727         * platform/mac/ValidationBubbleMac.mm:
1728         (WebCore::ValidationBubble::ValidationBubble):
1729         Update the ValidationBubble constructor to take in Settings. For now, there is a
1730         single setting that is the minimum font size and that is taken into account when
1731         setting the font size of the validation bubble text.
1732
1733 2017-02-14  Eric Carlson  <eric.carlson@apple.com>
1734
1735         [MediaStream] add navigator.getUserMedia for compatibility with legacy content
1736         https://bugs.webkit.org/show_bug.cgi?id=168324
1737         <rdar://problem/30513125>
1738
1739         Reviewed by Youenn Fablet.
1740
1741         Tests: fast/mediastream/argument-types.html
1742                fast/mediastream/getusermedia.html
1743                fast/mediastream/webkitGetUserMedia-shadowing-then.html
1744
1745         * CMakeLists.txt:
1746         * DerivedSources.cpp:
1747         * DerivedSources.make:
1748         * Modules/mediastream/MediaDevices.idl:
1749         * Modules/mediastream/NavigatorUserMedia.idl: Added.
1750         * Modules/mediastream/NavigatorUserMedia.js: Added.
1751         * WebCore.xcodeproj/project.pbxproj:
1752         * bindings/js/WebCoreBuiltinNames.h:
1753         * page/Navigator.idl:
1754
1755 2017-02-14  Chris Dumez  <cdumez@apple.com>
1756
1757         Fallback to legacy type only when event is trusted
1758         https://bugs.webkit.org/show_bug.cgi?id=168301
1759
1760         Reviewed by Ryosuke Niwa.
1761
1762         Fallback to legacy type only when event is trusted as per a recent
1763         DOM specification change:
1764         - https://github.com/whatwg/dom/issues/404
1765         - https://github.com/whatwg/dom/pull/406
1766
1767         No new tests, rebaselined existing test.
1768
1769         * dom/EventTarget.cpp:
1770         (WebCore::legacyType):
1771         (WebCore::EventTarget::fireEventListeners):
1772
1773 2017-02-13  Dean Jackson  <dino@apple.com>
1774
1775         Rename preferLowPowerToHighPerformance to powerPreference
1776         https://bugs.webkit.org/show_bug.cgi?id=168269
1777         <rdar://problem/30504444>
1778
1779         Reviewed by Chris Dumez.
1780
1781         Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283.
1782
1783         Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean
1784         into a powerPreference enum taking three values. The implementation
1785         of the enum is in GraphicsContext3DAttributes.
1786
1787         While the name and values have changed, there should be no change in
1788         behaviour caused by this patch.
1789
1790         * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes
1791         enum GraphicsContext3DPowerPreference.
1792         * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum.
1793         * html/canvas/WebGLRenderingContextBase.cpp: Use the new values.
1794         (WebCore::WebGLRenderingContextBase::create):
1795         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
1796         * platform/WebGLStateTracker.cpp:
1797         * platform/WebGLStateTracker.h: Update the state tracker to use the new
1798         values.
1799         * platform/graphics/GraphicsContext3DAttributes.h:
1800         * platform/graphics/mac/GraphicsContext3DMac.mm:
1801         (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter.
1802         (WebCore::GraphicsContext3D::GraphicsContext3D):
1803
1804 2017-02-14  Youenn Fablet  <youennf@gmail.com>
1805
1806         [WebRTC] Implement description getters for libwebrtc RTCPeerConnection
1807         https://bugs.webkit.org/show_bug.cgi?id=168234
1808
1809         Reviewed by Alex Christensen.
1810
1811         Allows passing W3C webrtc tests.
1812
1813         Implementing localDescription/remoteDescription using libwebrtc backend.
1814         current and pending description getters are made the same as local/remote getters for the moment.
1815         This should be fixed when upgrading to latest libwebrtc revision.
1816
1817         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1818         (WebCore::toSessionDescriptionType):
1819         (WebCore::fromSessionDescriptionType):
1820         (WebCore::fromSessionDescription):
1821         (WebCore::LibWebRTCMediaEndpoint::localDescription):
1822         (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
1823         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
1824         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
1825         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1826         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1827         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
1828         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1829
1830 2017-02-14  Jeremy Jones  <jeremyj@apple.com>
1831
1832         When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
1833         https://bugs.webkit.org/show_bug.cgi?id=167815
1834         rdar://problem/27685077
1835
1836         Reviewed by Jer Noble.
1837
1838         Test: media/media-fullscreen-loop-inline.html
1839
1840         When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when
1841         allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested
1842         in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops.
1843
1844         * html/HTMLMediaElement.cpp:
1845         (WebCore::HTMLMediaElement::enterFullscreen):
1846         (WebCore::HTMLMediaElement::exitFullscreen):
1847         * html/HTMLMediaElement.h:
1848         (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added.
1849         * html/MediaElementSession.cpp:
1850         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
1851
1852 2017-02-14  Jer Noble  <jer.noble@apple.com>
1853
1854         Video elements with MediaSource objects set by srcObject are not cleared when srcObject is set to null
1855         https://bugs.webkit.org/show_bug.cgi?id=168268
1856
1857         Reviewed by Eric Carlson.
1858
1859         Test: fast/mediastream/MediaStream-MediaElement-setObject-null.html
1860
1861         Make the setSrcObject() operation compliant with the HTML spec. Since the specification defines
1862         srcObject in terms of either a MediaSource, MediaStream, or Blob object, add the variant typedef
1863         to HTMLMediaElement and move the definition out of the Modules/mediastream extension IDL and into
1864         HTMLMediaElement.idl. Then bring the "media elements load" and "resource selection" algorithms up
1865         to their most recent definitions in the HTML5 spec.
1866
1867         Drive-by fix: Allow the (admittedly weird) single-element-union type in IDL.
1868
1869         * CMakeLists.txt:
1870         * DerivedSources.cpp:
1871         * DerivedSources.make:
1872         * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Removed.
1873         * Modules/mediastream/HTMLMediaElementMediaStream.h: Removed.
1874         * Modules/mediastream/HTMLMediaElementMediaStream.idl: Removed.
1875         * WebCore.xcodeproj/project.pbxproj:
1876         * bindings/scripts/IDLParser.pm:
1877         (parseUnionType):
1878         * html/HTMLAudioElement.cpp:
1879         (WebCore::HTMLAudioElement::createForJSConstructor):
1880         * html/HTMLMediaElement.cpp:
1881         (WebCore::actionName):
1882         (WebCore::HTMLMediaElement::parseAttribute):
1883         (WebCore::HTMLMediaElement::insertedInto):
1884         (WebCore::HTMLMediaElement::scheduleDelayedAction):
1885         (WebCore::HTMLMediaElement::scheduleNextSourceChild):
1886         (WebCore::HTMLMediaElement::pendingActionTimerFired):
1887         (WebCore::HTMLMediaElement::setSrcObject):
1888         (WebCore::HTMLMediaElement::load):
1889         (WebCore::HTMLMediaElement::prepareForLoad):
1890         (WebCore::HTMLMediaElement::selectMediaResource):
1891         (WebCore::HTMLMediaElement::loadResource):
1892         (WebCore::HTMLMediaElement::playInternal):
1893         (WebCore::HTMLMediaElement::pauseInternal):
1894         (WebCore::HTMLMediaElement::sourceWasAdded):
1895         (WebCore::HTMLMediaElement::clearMediaPlayer):
1896         (WebCore::HTMLMediaElement::resume):
1897         (WebCore::HTMLMediaElement::mediaCanStart):
1898         (WebCore::HTMLMediaElement::createMediaPlayer):
1899         (WebCore::HTMLMediaElement::loadInternal): Deleted.
1900         * html/HTMLMediaElement.h:
1901         (WebCore::HTMLMediaElement::srcObject):
1902         * html/HTMLMediaElement.idl:
1903         * platform/ContentType.h:
1904
1905 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
1906
1907         Remove unused WebThreadContextIsCurrent method from WebCoreThread.h
1908         https://bugs.webkit.org/show_bug.cgi?id=168254
1909
1910         Reviewed by Dan Bernstein.
1911
1912         * platform/ios/wak/WebCoreThread.h: Removed unused WebThreadContextIsCurrent.
1913         * platform/ios/wak/WebCoreThread.mm:
1914         (WebThreadContextIsCurrent): Deleted.
1915
1916 2017-02-14  Alexey Proskuryakov  <ap@apple.com>
1917
1918         WebCore shouldn't export SystemMemory.h
1919         https://bugs.webkit.org/show_bug.cgi?id=168285
1920
1921         Reviewed by Alex Christensen.
1922
1923         * WebCore.xcodeproj/project.pbxproj:
1924
1925 2017-02-13  Filip Pizlo  <fpizlo@apple.com>
1926
1927         worker.postMessage should throw a TypeError if a SharedArrayBuffer is in the transfer list
1928         https://bugs.webkit.org/show_bug.cgi?id=168277
1929
1930         Reviewed by Mark Lam.
1931
1932         Test: workers/sab/postMessage-transfer-type-error.html
1933         
1934         This is a simple spec compliance change. The title says it all.
1935
1936         * bindings/js/SerializedScriptValue.cpp:
1937         (WebCore::SerializedScriptValue::create):
1938
1939 2017-02-14  Zan Dobersek  <zdobersek@igalia.com>
1940
1941         HTMLMediaElement: WebKitMediaKeys member name should be prefixed
1942         https://bugs.webkit.org/show_bug.cgi?id=168297
1943
1944         Reviewed by Xabier Rodriguez-Calvar.
1945
1946         Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
1947         so that it contains the legacy prefix, just like the API. This will make
1948         room for the MediaKeys member variable that will be implemented under
1949         the ENCRYPTED_MEDIA guards.
1950
1951         * html/HTMLMediaElement.cpp:
1952         (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
1953         (WebCore::HTMLMediaElement::webkitSetMediaKeys):
1954         * html/HTMLMediaElement.h:
1955         (WebCore::HTMLMediaElement::webkitKeys):
1956
1957 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1958
1959         [GTK] Make DragImageRef a RefPtr instead of a plain pointer
1960         https://bugs.webkit.org/show_bug.cgi?id=168296
1961
1962         Reviewed by Sergio Villar Senin.
1963
1964         Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.
1965
1966         * platform/DragImage.h:
1967         * platform/gtk/DragImageGtk.cpp:
1968         (WebCore::dragImageSize):
1969         (WebCore::deleteDragImage):
1970         (WebCore::scaleDragImage):
1971         (WebCore::dissolveDragImageToFraction):
1972         (WebCore::createDragImageFromImage):
1973         (WebCore::createDragImageIconForCachedImageFilename):
1974
1975 2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
1976
1977         [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
1978         https://bugs.webkit.org/show_bug.cgi?id=168015
1979
1980         Reviewed by Xabier Rodriguez-Calvar.
1981
1982         The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
1983         a defined Gstreamer log category, then the webkitmse category has been added to them.
1984         WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
1985         the .cpp file.
1986
1987         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
1988         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1989         Added webkitmse category and gst header.
1990         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
1991         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1992         Added webkitmediasrc category.
1993
1994 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1995
1996         CookieManager only works with the default session
1997         https://bugs.webkit.org/show_bug.cgi?id=168229
1998
1999         Reviewed by Alex Christensen.
2000
2001         Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
2002         sessions in the backends that support it.
2003
2004         * platform/network/CookieStorage.h:
2005         * platform/network/cf/CookieStorageCFNet.cpp:
2006         (WebCore::cookieChangeCallbackMap):
2007         (WebCore::notifyCookiesChanged):
2008         (WebCore::startObservingCookieChanges):
2009         (WebCore::stopObservingCookieChanges):
2010         * platform/network/mac/CookieStorageMac.mm:
2011         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
2012         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
2013         (WebCore::startObservingCookieChanges):
2014         (WebCore::stopObservingCookieChanges):
2015         * platform/network/soup/CookieStorageSoup.cpp:
2016         (WebCore::cookieChangeCallbackMap):
2017         (WebCore::soupCookiesChanged):
2018         (WebCore::startObservingCookieChanges):
2019         (WebCore::stopObservingCookieChanges):
2020
2021 2017-02-13  Antoine Quint  <graouts@apple.com>
2022
2023         REGRESSION: Update volume and scrubbing slider to match HI designs
2024         https://bugs.webkit.org/show_bug.cgi?id=168170
2025         <rdar://problem/28095266>
2026
2027         Reviewed by Dean Jackson.
2028
2029         We bring the designs of the control's background materials, scrubber and
2030         volume slider up to spec.
2031
2032         The first important set of changes is that, on macOS, the materials and colors
2033         were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
2034         appear vibrant against the media, and the controls bar, volume container
2035         and tracks menu now use a new BackgroundTint node to correctly apply both
2036         a backdrop-filter and blended tint above it.
2037
2038         The second important set of changes is the rendering of the sliders. Up to now
2039         we would simply style the <input type="range"> track and thumb, applying solid
2040         fills and strokes. We now draw sliders in two ways depending on the platform.
2041         
2042         On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
2043         set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
2044         set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
2045         no blend mode to obtain a pure white color, finally the thumb is rendered by the
2046         <input> element. We couldn't draw the pure white color with the track in the
2047         same <canvas> due to the "plus-darker" blend mode.
2048
2049         Test: media/modern-media-controls/background-tint/background-tint.html
2050
2051         * Modules/modern-media-controls/controls/airplay-button.css:
2052         (button.airplay.on):
2053         * Modules/modern-media-controls/controls/background-tint.css: Added.
2054         (.background-tint):
2055         (.background-tint,):
2056         (.background-tint > .blur):
2057         (.background-tint > .tint):
2058         * Modules/modern-media-controls/controls/background-tint.js: Added.
2059         (BackgroundTint):
2060         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2061         (.media-controls.ios.inline .scrubber.slider):
2062         (.media-controls.ios.inline .scrubber.slider > div):
2063         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
2064         (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
2065         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
2066         (.media-controls.mac.inline.compact .volume-slider-container):
2067         (.media-controls.mac.inline.compact .volume.slider):
2068         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.
2069         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
2070         (.media-controls.mac.fullscreen > .controls-bar):
2071         (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div):
2072         (.media-controls.mac.fullscreen .volume.slider):
2073         (.media-controls.mac.fullscreen button.volume-up):
2074         (.media-controls.mac.fullscreen button.rewind):
2075         (.media-controls.mac.fullscreen button.forward):
2076         (.media-controls.mac.fullscreen .buttons-container.right button):
2077         (.media-controls.mac.fullscreen .scrubber):
2078         (.media-controls.mac.fullscreen > .controls-bar button): Deleted.
2079         (.media-controls.mac.fullscreen button.airplay): Deleted.
2080         (.media-controls.mac.fullscreen button.aspect-ratio): Deleted.
2081         (.media-controls.mac.fullscreen button.pip): Deleted.
2082         (.media-controls.mac.fullscreen button.tracks): Deleted.
2083         (.media-controls.mac.fullscreen button.fullscreen): Deleted.
2084         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2085         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
2086         (.media-controls.mac.inline .scrubber.slider):
2087         (.media-controls.mac.inline .volume-slider-container):
2088         (.media-controls.mac.inline .volume-slider-container > .background-tint):
2089         (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
2090         (.media-controls.mac.inline .volume.slider):
2091         (.media-controls.mac.inline button): Deleted.
2092         (.media-controls.mac.inline button:active): Deleted.
2093         (.media-controls.mac.inline > .controls-bar button): Deleted.
2094         (.media-controls.mac.inline > .controls-bar,): Deleted.
2095         (.media-controls.mac.inline .volume-slider-container:before): Deleted.
2096         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2097         (MacOSInlineMediaControls.prototype.layout):
2098         * Modules/modern-media-controls/controls/macos-media-controls.css: Added.
2099         (.media-controls.mac button:active):
2100         (.media-controls.mac > .controls-bar button):
2101         (.media-controls.mac > .controls-bar .time-label):
2102         (.media-controls.mac > .controls-bar .slider > canvas):
2103         (.media-controls.mac > .controls-bar .slider > input::-webkit-slider-thumb):
2104         * Modules/modern-media-controls/controls/scrubber.css: Removed.
2105         * Modules/modern-media-controls/controls/scrubber.js:
2106         (Scrubber):
2107         (Scrubber.prototype.get buffered):
2108         (Scrubber.prototype.set buffered):
2109         (Scrubber.prototype.draw):
2110         (Scrubber.prototype._drawMacOS):
2111         (Scrubber.prototype._drawiOS):
2112         * Modules/modern-media-controls/controls/slider.css:
2113         (.slider):
2114         (.slider > canvas,):
2115         (.slider > canvas):
2116         (.slider > input):
2117         (.slider > input,): Deleted.
2118         (.slider > .fill): Deleted.
2119         (.slider > input::-webkit-slider-thumb): Deleted.
2120         * Modules/modern-media-controls/controls/slider.js:
2121         (Slider.prototype.set value):
2122         (Slider.prototype.set width):
2123         (Slider.prototype.commitProperty):
2124         (Slider.prototype.layout):
2125         (Slider.prototype.draw):
2126         (Slider.prototype._handleInputEvent):
2127         (Slider.prototype._handleChangeEvent):
2128         (addRoundedRect):
2129         (Slider.prototype._updateFill): Deleted.
2130         * Modules/modern-media-controls/controls/start-button.css:
2131         (button.start):
2132         * Modules/modern-media-controls/controls/time-control.js:
2133         * Modules/modern-media-controls/controls/time-label.css:
2134         (.time-label):
2135         * Modules/modern-media-controls/controls/tracks-panel.css:
2136         (.tracks-panel):
2137         (.tracks-panel > .background-tint > div):
2138         (.tracks-panel > section):
2139         (.tracks-panel > section:first-of-type):
2140         (.tracks-panel > section > h3):
2141         (.tracks-panel > section > ul):
2142         (.tracks-panel > section > ul > li):
2143         (.tracks-panel > section > ul > li:focus):
2144         (.tracks-panel > section > ul > li.selected:before):
2145         (.tracks-panel > section > ul > li.animated):
2146         (.tracks-panel-section): Deleted.
2147         (.tracks-panel-section:first-of-type): Deleted.
2148         (.tracks-panel-section > h3): Deleted.
2149         (.tracks-panel-section > ul): Deleted.
2150         (.tracks-panel-section > ul > li): Deleted.
2151         (.tracks-panel-section > ul > li:focus): Deleted.
2152         (.tracks-panel-section > ul > li.selected:before): Deleted.
2153         (.tracks-panel-section > ul > li.animated): Deleted.
2154         * Modules/modern-media-controls/controls/tracks-panel.js:
2155         (TracksPanel.prototype._childrenFromDataSource):
2156         (TracksPanel.prototype._childrenFromDataSource.): Deleted.
2157         * Modules/modern-media-controls/controls/volume-slider.js:
2158         (VolumeSlider):
2159         (VolumeSlider.prototype.handleEvent):
2160         (VolumeSlider.prototype.draw):
2161         * Modules/modern-media-controls/js-files:
2162         * Modules/modern-media-controls/media/scrubbing-support.js:
2163         (ScrubbingSupport.prototype.get mediaEvents):
2164         (ScrubbingSupport.prototype.syncControl):
2165         (ScrubbingSupport):
2166
2167 2017-02-13  Alex Christensen  <achristensen@webkit.org>
2168
2169         URLs with an invalid IPv4 address should be invalid
2170         https://bugs.webkit.org/show_bug.cgi?id=168260
2171
2172         Reviewed by Tim Horton.
2173
2174         All URL hosts are fed through the IPv4 parser.  https://webkit.org/ doesn't
2175         look enough like an IPv4 address to be considered an invalid IPv4 address, so 
2176         we continue to the String host processing.  http://127.0.0.257 does, though, and
2177         according to https://url.spec.whatwg.org/#concept-ipv4-parser parsing that URL
2178         should fail.
2179
2180         Covered by newly passing web platform tests.
2181
2182         * platform/URLParser.cpp:
2183         (WebCore::URLParser::parseIPv4Host):
2184         (WebCore::URLParser::parseHostAndPort):
2185         * platform/URLParser.h:
2186
2187 2017-02-13  Dan Bernstein  <mitz@apple.com>
2188
2189         Reverted r212275. It still breaks some Apple-internal builds.
2190
2191         * platform/spi/mac/TUCallSPI.h:
2192
2193 2017-02-13  Joseph Pecoraro  <pecoraro@apple.com>
2194
2195         Address ESLint warnings in modern-media-controls
2196         https://bugs.webkit.org/show_bug.cgi?id=168224
2197
2198         Reviewed by Alexey Proskuryakov.
2199
2200         * Modules/modern-media-controls/controls/controls-bar.js:
2201         * Modules/modern-media-controls/controls/fullscreen-button.js:
2202         * Modules/modern-media-controls/controls/layout-node.js:
2203         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2204         * Modules/modern-media-controls/controls/media-controls.js:
2205         * Modules/modern-media-controls/controls/scheduler.js:
2206         * Modules/modern-media-controls/controls/seek-button.js:
2207         * Modules/modern-media-controls/controls/tracks-panel.js:
2208         * Modules/modern-media-controls/controls/volume-slider.js:
2209         * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
2210         * Modules/modern-media-controls/gesture-recognizers/pinch.js:
2211         * Modules/modern-media-controls/media/fullscreen-support.js:
2212         * Modules/modern-media-controls/media/media-controller.js:
2213         * Modules/modern-media-controls/media/placard-support.js:
2214         * Modules/modern-media-controls/media/status-support.js:
2215         Address pedantic warnings.
2216
2217 2017-02-13  Dan Bernstein  <mitz@apple.com>
2218
2219         Restored changes from r212210 in a way that does not break the build.
2220
2221         * platform/spi/mac/TUCallSPI.h:
2222
2223 2017-02-13  Zalan Bujtas  <zalan@apple.com>
2224
2225         FontCascade::widthForSimpleText should skip applyTransforms() when kerning and ligatures are off.
2226         https://bugs.webkit.org/show_bug.cgi?id=168251
2227         <rdar://problem/30498102>
2228
2229         Reviewed by Antti Koivisto.
2230
2231         Covered by existing (perf)tests.
2232
2233         * platform/graphics/FontCascade.cpp:
2234         (WebCore::FontCascade::widthForSimpleText):
2235
2236 2017-02-12  Brian Burg  <bburg@apple.com>
2237
2238         Web Inspector: expose system user interface layout direction through InspectorFrontendHost
2239         https://bugs.webkit.org/show_bug.cgi?id=168209
2240         <rdar://problem/11573736>
2241
2242         Reviewed by Joseph Pecoraro.
2243
2244         Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
2245         properly set the UI directionality from system settings in PageClient, this will get inherited
2246         automatically by the Inspector's WebPage instance.
2247
2248         * inspector/InspectorFrontendClient.h:
2249         * inspector/InspectorFrontendClientLocal.cpp:
2250         (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
2251         * inspector/InspectorFrontendClientLocal.h:
2252
2253         * inspector/InspectorFrontendHost.h:
2254         * inspector/InspectorFrontendHost.idl:
2255         * inspector/InspectorFrontendHost.cpp:
2256         (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
2257         Expose the directionality to the frontend as "ltr" or "rtl" strings.
2258
2259 2017-02-13  Zalan Bujtas  <zalan@apple.com>
2260
2261         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
2262         https://bugs.webkit.org/show_bug.cgi?id=168247
2263         <rdar://problem/30497288>
2264
2265         Reviewed by Antti Koivisto.
2266
2267         The width of the run is supposed to be the same with or without the trailing whitespace.
2268
2269         Covered by performance test.
2270
2271         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2272         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
2273         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
2274         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2275
2276 2017-02-13  Karim H  <karim@karhm.com>
2277
2278         Added the other missing BSTR roles tag names.
2279         https://bugs.webkit.org/show_bug.cgi?id=165545
2280
2281         Reviewed by Chris Fleizach.
2282
2283         Test: accessibility/win/bstr-elements-role.html
2284
2285         * accessibility/AccessibilityRenderObject.cpp:
2286         (WebCore::shouldReturnTagNameAsRoleForMSAA):
2287
2288 2017-02-13  Youenn Fablet  <youennf@gmail.com>
2289
2290         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
2291         https://bugs.webkit.org/show_bug.cgi?id=168250
2292
2293         Reviewed by Alex Christensen.
2294
2295         Covered by webrtc tests in LayoutTests and in web-platform-tests.
2296         Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
2297         That way, it can create real libwebrtc backends whenever requested by tests.
2298
2299         Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
2300         In the future, we should make them no longer static.
2301
2302         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2303         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2304         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2305         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2306         * WebCore.xcodeproj/project.pbxproj:
2307         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
2308         (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
2309         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
2310         (WebCore::LibWebRTCProvider::factory):
2311         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
2312         (WebCore::createActualPeerConnection):
2313         (WebCore::LibWebRTCProvider::createPeerConnection):
2314         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2315         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
2316         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2317         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2318         * testing/Internals.cpp:
2319         * testing/MockLibWebRTCPeerConnection.cpp:
2320         (WebCore::useMockRTCPeerConnectionFactory):
2321         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
2322         (WebCore::releaseInNetworkThread):
2323         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
2324         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
2325         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
2326         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
2327
2328 2017-02-13  Anders Carlsson  <andersca@apple.com>
2329
2330         Simplify DragController::startDrag
2331         https://bugs.webkit.org/show_bug.cgi?id=168240
2332
2333         Reviewed by Tim Horton.
2334
2335         Use early returns instead of assigning to a variable that's returned at the end of the function.
2336
2337         * page/DragController.cpp:
2338         (WebCore::DragController::startDrag):
2339
2340 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
2341
2342         The current frame of an image should not deleted if another frame is asynchronously being decoded
2343         https://bugs.webkit.org/show_bug.cgi?id=167618
2344
2345         Reviewed by Simon Fraser.
2346
2347         Test: fast/images/animated-image-draw-while-decode.html
2348
2349         If the memory cache asks the BitmapImage to destroy all its frames while
2350         the next frame is being decoded, a thread contention may happen. This can
2351         happen when BitmapImage::draw() is called and the next frame is not ready
2352         yet for drawing, so the current frame has to be drawn. This will invoke
2353         a frame decoding in the same image from the drawing committing thread.
2354
2355         We can avoid that by destroying all the frames except the current frame if
2356         the image is asynchronously decoding its frames. This should not add extra
2357         memory overhead because building the image frame cache and then destroying
2358         it, when needed, is an on-going process. The frames will be allocated and
2359         decoded all the time and all of them can be destroyed except the current one.
2360         
2361         * platform/graphics/BitmapImage.cpp:
2362         (WebCore::BitmapImage::destroyDecodedData):
2363         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
2364         The logic of destroying the ImageFrames was split among BitmapImage, ImageSource
2365         and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache
2366         be responsible only for destroying a range of ImageFrames.
2367
2368         (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame
2369         is ready to be rendered if the next frame is being decoded.
2370         
2371         * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h.
2372
2373         * platform/graphics/ImageFrameCache.cpp:
2374         (WebCore::ImageFrameCache::destroyDecodedData):
2375         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted.
2376         * platform/graphics/ImageFrameCache.h:
2377         (WebCore::ImageFrameCache::destroyAllDecodedData):
2378         (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame):
2379         (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame):
2380         Make ImageFrameCache be responsible for destroying a range of ImageFrames.
2381         This range might include all the frames, all the frames but up to a specific
2382         frame, or all the frames but exclude one frame in the middle.
2383         
2384         * platform/graphics/ImageSource.cpp:
2385         (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear().
2386         The decision to call clearFrameBufferCache() or clear() is moved to
2387         BitmapImage::destroyDecodedData().
2388          
2389         (WebCore::ImageSource::destroyDecodedData): Deleted.
2390         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted.
2391         These functions are replaced by another set of functions in ImageSource.h.
2392         
2393         * platform/graphics/ImageSource.h:
2394         (WebCore::ImageSource::destroyAllDecodedData):
2395         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
2396         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
2397         (WebCore::ImageSource::hasDecodingQueue):
2398         These are new wrappers which call the corresponding ImageFrameCache functions.
2399
2400 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
2401
2402         [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
2403         https://bugs.webkit.org/show_bug.cgi?id=168256
2404
2405         Reviewed by Alex Christensen.
2406
2407         Use of this function is already behind a platform guard.
2408
2409         No new tests because there is no behavior change.
2410
2411         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2412         (SOFT_LINK): Deleted.
2413
2414 2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>
2415
2416         [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
2417         https://bugs.webkit.org/show_bug.cgi?id=165913
2418         <rdar://problem/30477222>
2419
2420         Reviewed by Joseph Pecoraro.
2421
2422         Covered by existing tests.
2423
2424         * page/Crypto.cpp:
2425         (WebCore::Crypto::webkitSubtle):
2426
2427 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
2428
2429         Call WKDestroyRenderingResources() on iOS when tabs are backgrounded
2430         https://bugs.webkit.org/show_bug.cgi?id=168261
2431         rdar://problem/30481079
2432
2433         Reviewed by Tim Horton.
2434
2435         Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore
2436         that do a framework include.
2437
2438         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
2439         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
2440         * platform/spi/cocoa/QuartzCoreSPI.h:
2441         * platform/spi/mac/NSViewSPI.h:
2442
2443 2017-02-13  Youenn Fablet  <youenn@apple.com>
2444
2445         ASSERTION FAILED: !m_bodyLoader
2446         https://bugs.webkit.org/show_bug.cgi?id=166986
2447
2448         Reviewed by Sam Weinig.
2449
2450         Refactoring to make the unset/set pending activity part of body loader.
2451         This allows ensuring to not forget to do that by simply deleting the body loader.
2452
2453         * Modules/fetch/FetchResponse.cpp:
2454         (WebCore::FetchResponse::fetch):
2455         (WebCore::FetchResponse::BodyLoader::didSucceed):
2456         (WebCore::FetchResponse::BodyLoader::didFail):
2457         (WebCore::FetchResponse::BodyLoader::BodyLoader):
2458         (WebCore::FetchResponse::BodyLoader::~BodyLoader):
2459         (WebCore::FetchResponse::stop):
2460         * Modules/fetch/FetchResponse.h:
2461
2462 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
2463
2464         Remove unused WebCoreThreadSafe.h
2465         https://bugs.webkit.org/show_bug.cgi?id=168236
2466
2467         Reviewed by Dan Bernstein.
2468
2469         * platform/ios/wak/WebCoreThreadSafe.h: Removed.
2470         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
2471         * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly
2472
2473 2017-02-13  Anders Carlsson  <andersca@apple.com>
2474
2475         Fix iOS build.
2476
2477         * platform/ios/DragImageIOS.mm:
2478         (WebCore::deleteDragImage):
2479
2480 2017-02-13  Sam Weinig  <sam@webkit.org>
2481
2482         Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
2483         https://bugs.webkit.org/show_bug.cgi?id=168249
2484
2485         Reviewed by Dean Jackson.
2486
2487         Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
2488
2489         * CMakeLists.txt:
2490         * WebCore.xcodeproj/project.pbxproj:
2491         * css/CSSAllInOne.cpp:
2492         * css/MediaQuery.h:
2493         * css/MediaQueryEvaluator.h:
2494         * css/MediaQueryExp.cpp: Removed.
2495         * css/MediaQueryExp.h: Removed.
2496         * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
2497         * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
2498         * css/parser/MediaQueryParser.h:
2499
2500 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
2501
2502         WAKResponder should be exported from WebCore
2503         https://bugs.webkit.org/show_bug.cgi?id=168245
2504
2505         Reviewed by Dan Bernstein.
2506
2507         * platform/ios/wak/WAKResponder.h:
2508
2509 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
2510
2511         Log to the History Channel in a few more places
2512         https://bugs.webkit.org/show_bug.cgi?id=168252
2513
2514         Reviewed by Brady Eidson.
2515
2516         *** Aliens ***
2517
2518         * loader/HistoryController.cpp:
2519         (WebCore::HistoryController::restoreScrollPositionAndViewState):
2520         (WebCore::HistoryController::updateForReload):
2521         * loader/NavigationScheduler.cpp:
2522         (WebCore::NavigationScheduler::scheduleHistoryNavigation):
2523         (WebCore::NavigationScheduler::timerFired):
2524         (WebCore::NavigationScheduler::cancel):
2525         * page/History.cpp:
2526         (WebCore::History::go):
2527
2528 2017-02-13  Alex Christensen  <achristensen@webkit.org>
2529
2530         Percent should be allowed in non-special URL hosts
2531         https://bugs.webkit.org/show_bug.cgi?id=168255
2532
2533         Reviewed by Tim Horton.
2534
2535         In the last few weeks, the spec has consolidated its sets of code points.
2536         Now forbidden host code points replace the old invalid host code points with
2537         the modification that percents are allowed in non-special hosts because we
2538         percent-encode non-ascii code points in non-special hosts.
2539         See https://url.spec.whatwg.org/#concept-opaque-host-parser
2540
2541         Covered by newly passing web platform tests.
2542
2543         * platform/URLParser.cpp:
2544         (WebCore::isC0Control):
2545         (WebCore::isInUserInfoEncodeSet):
2546         (WebCore::URLParser::hasForbiddenHostCodePoint):
2547         (WebCore::URLParser::parseHostAndPort):
2548         (WebCore::isInvalidDomainCharacter): Deleted.
2549         (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
2550         * platform/URLParser.h:
2551
2552 2017-02-13  Anders Carlsson  <andersca@apple.com>
2553
2554         Fix Windows build.
2555
2556         * platform/win/PasteboardWin.cpp:
2557         (WebCore::Pasteboard::setDragImage):
2558
2559 2017-02-13  Alex Christensen  <achristensen@webkit.org>
2560
2561         Fix Yosemite build after r211765
2562         https://bugs.webkit.org/show_bug.cgi?id=168246
2563         <rdar://problem/30494174>
2564
2565         Reviewed by Brady Eidson.
2566
2567         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2568         (SOFT_LINK):
2569
2570 2017-02-13  Anders Carlsson  <andersca@apple.com>
2571
2572         Add a DragImage class that wraps a DragImageRef
2573         https://bugs.webkit.org/show_bug.cgi?id=168131
2574
2575         Reviewed by Beth Dakin.
2576
2577         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
2578         various drag code paths possible. No functionality change.
2579
2580         * dom/DataTransfer.cpp:
2581         (WebCore::DataTransfer::updateDragImage):
2582         * page/DragController.cpp:
2583         (WebCore::DragController::startDrag):
2584         (WebCore::DragController::doImageDrag):
2585         (WebCore::DragController::doSystemDrag):
2586         * page/DragController.h:
2587         * platform/DragImage.cpp:
2588         (WebCore::DragImage::DragImage):
2589         (WebCore::DragImage::operator=):
2590         (WebCore::DragImage::~DragImage):
2591         * platform/DragImage.h:
2592         * platform/Pasteboard.h:
2593         * platform/StaticPasteboard.h:
2594         * platform/mac/PasteboardMac.mm:
2595         (WebCore::Pasteboard::setDragImage):
2596
2597 2017-02-13  Chris Dumez  <cdumez@apple.com>
2598
2599         Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree
2600         https://bugs.webkit.org/show_bug.cgi?id=168237
2601         <rdar://problem/30494165>
2602
2603         Reviewed by Gavin Barraclough.
2604
2605         Drop bad assertion under document::destroyRenderTree() that was introduced in r211455.
2606         The assertion seemed like a good idea but the issue is that CachedFrame::destroy()
2607         reset's the document's pageCacheState before calling Document::prepareForDestruction().
2608
2609         No new tests, this fixes assertion hits on our bots.
2610
2611         * dom/Document.cpp:
2612         (WebCore::Document::destroyRenderTree):
2613
2614 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
2615
2616         Update custom line breaking iterators to the latest version of Unicode
2617         https://bugs.webkit.org/show_bug.cgi?id=168182
2618
2619         Reviewed by Zalan Bujtas.
2620
2621         Clean up our breaking code to be more descriptive about the difference between
2622         line-break: auto vs line-break: loose | normal | strict. The only difference is
2623         that we have some hardcoded tables to speed up character iteration for
2624         line-break: auto.
2625
2626         Tests: TestWebKitAPI WebKit2.LineBreaking
2627
2628         * rendering/BreakLines.h:
2629         (WebCore::nextBreakablePosition):
2630         (WebCore::nextBreakablePositionIgnoringNBSP):
2631         (WebCore::nextBreakablePositionWithoutShortcut):
2632         (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
2633         (WebCore::isBreakable):
2634         (WebCore::nextBreakablePositionNonLoosely): Deleted.
2635         (WebCore::nextBreakablePositionLoosely): Deleted.
2636         (WebCore::nextBreakablePositionLoose): Deleted.
2637         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
2638         * rendering/RenderText.cpp:
2639         (WebCore::RenderText::computePreferredLogicalWidths):
2640         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2641         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
2642         * rendering/line/BreakingContext.h:
2643         (WebCore::BreakingContext::handleText):
2644         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
2645
2646 2017-02-13  Youenn Fablet  <youenn@apple.com>
2647
2648         Remove @getUserMedia identifier
2649         https://bugs.webkit.org/show_bug.cgi?id=168216
2650
2651         Reviewed by Sam Weinig.
2652
2653         No change of behavior.
2654
2655         * Modules/mediastream/MediaDevices.idl:
2656         * bindings/js/WebCoreBuiltinNames.h:
2657
2658 2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2659
2660         [GTK] Non-accelerated drawing is broken with HiDPI
2661         https://bugs.webkit.org/show_bug.cgi?id=168128
2662
2663         Reviewed by Michael Catanzaro.
2664
2665         When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
2666         layers are created to be notified about the device scale factor. That causes us to enter in accelerated
2667         compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
2668         enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
2669         doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
2670         mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
2671         overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
2672         installed, layers will be created with the current device scale factor anyway.
2673
2674         * page/PageOverlayController.cpp:
2675         (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.
2676
2677 2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>
2678
2679         REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
2680         https://bugs.webkit.org/show_bug.cgi?id=167771
2681
2682         Reviewed by Daniel Bates.
2683
2684         * loader/DocumentLoader.cpp:
2685         (WebCore::DocumentLoader::commitData):
2686
2687 2017-02-12  Dan Bernstein  <mitz@apple.com>
2688
2689         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2690
2691         * platform/spi/mac/TUCallSPI.h: Reverted to r212210.
2692
2693 2017-02-12  Dan Bernstein  <mitz@apple.com>
2694
2695         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2696
2697         * platform/spi/mac/TUCallSPI.h:
2698
2699 2017-02-12  Dan Bernstein  <mitz@apple.com>
2700
2701         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2702
2703         * platform/spi/mac/TUCallSPI.h:
2704
2705 2017-02-12  Dan Bernstein  <mitz@apple.com>
2706
2707         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2708
2709         * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
2710           equivalent.
2711
2712 2017-02-12  Dan Bernstein  <mitz@apple.com>
2713
2714         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2715
2716         * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
2717
2718 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
2719
2720         parserRemoveChild should unload subframes
2721         https://bugs.webkit.org/show_bug.cgi?id=168151
2722
2723         Reviewed by Darin Adler.
2724
2725         Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes.
2726
2727         Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965.
2728
2729         Tests: fast/parser/adoption-agency-clear-focus-range.html
2730                fast/parser/adoption-agency-unload-iframe-1.html
2731                fast/parser/adoption-agency-unload-iframe-2.html
2732
2733         * dom/ContainerNode.cpp:
2734         (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild.
2735
2736         Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges,
2737         the focused element, and other states in the document.
2738
2739         Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes
2740         instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have
2741         already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in
2742         response to the unload event we just dispatched.
2743
2744         Third, append these nodes using parserAppendChild to avoid dispatching mutation events.
2745
2746         (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion
2747         in each call site of willRemoveChild and willRemoveChildren.
2748         (WebCore::willRemoveChildren): Ditto.
2749         (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
2750         (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
2751         (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states.
2752
2753         * html/parser/HTMLConstructionSite.cpp:
2754         (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 
2755
2756 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
2757
2758         REGRESSION (r179497): Crash inside setAttributeNode
2759         https://bugs.webkit.org/show_bug.cgi?id=168161
2760         <rdar://problem/30451581>
2761
2762         Reviewed by Andreas Kling.
2763
2764         The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used
2765         to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts
2766         and mutated element's m_elementData.
2767
2768         Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData().
2769
2770         Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html
2771
2772         * dom/Element.cpp:
2773         (WebCore::Element::setAttributeNode):
2774
2775 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
2776
2777         Rebaseline bindings tests after r212207.
2778
2779         * bindings/scripts/test/JS/JSTestObj.cpp:
2780         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2781
2782 2017-02-12  Dan Bernstein  <mitz@apple.com>
2783
2784         [Cocoa] Some -respondsToSelector: checks are unnecessary
2785         https://bugs.webkit.org/show_bug.cgi?id=168183
2786
2787         Reviewed by Tim Horton.
2788
2789         * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
2790           change to WebKit2/Platform/mac/MenuUtilities.mm.
2791
2792         * editing/mac/DictionaryLookup.mm:
2793         (WebCore::showPopupOrCreateAnimationController): Removed check whether
2794           LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.
2795
2796         * platform/cocoa/NetworkExtensionContentFilter.mm:
2797         (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
2798           -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
2799           -setSourceAppBundleID:, which does not exist.
2800
2801         * platform/cocoa/ScrollController.mm:
2802         (systemUptime): Deleted.
2803         (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.
2804
2805         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2806         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.
2807
2808         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2809         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
2810         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
2811         (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
2812           -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
2813         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
2814           check.
2815
2816         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
2817         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.
2818
2819         * platform/graphics/mac/WebGLLayer.mm:
2820         (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.
2821
2822         * platform/mac/PlatformEventFactoryMac.mm:
2823         (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
2824           all code to handle that case that it doesn’t.
2825
2826         * platform/mac/WebVideoFullscreenController.mm:
2827         (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
2828           NSWindow responds to -isOnActiveSpace.
2829         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
2830           NSApplication responds to -setPresentationOptions:
2831
2832         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2833         (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
2834           unnecessary -respondsToSelector: check.
2835         (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
2836         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.
2837
2838         * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
2839           -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
2840           -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
2841
2842         * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
2843           sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
2844           unconditional declaration of sourceAppBundleID property, which doesn’t exist.
2845
2846         * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
2847
2848         * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
2849           from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
2850           Removed an unused declaration.
2851
2852         * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
2853           !USE(APPLE_INTERNAL_SDK) section.
2854
2855         * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
2856           Apple internal SDK. Cleaned up the declarations for the other case.
2857
2858         * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
2859           internal SDK.
2860
2861 2017-02-11  Sam Weinig  <sam@webkit.org>
2862
2863         Remove the remaining functions out of JSDOMBinding
2864         https://bugs.webkit.org/show_bug.cgi?id=168179
2865
2866         Reviewed by Darin Adler.
2867
2868         Move utility functions into more appropriate locations.
2869         - Move hasIteratorMethod to runtime/IteratorOperations.h
2870         - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
2871         - Move addImpureProperty to CommonVM
2872
2873         Remove toJS overload that took a Vector<T>. Replace it's usage
2874         with toJS<IDLSequence<T>> usage. To make this work, added two
2875         new types, IDLIDBKeyData and IDLIDBValue.
2876
2877         * Modules/indexeddb/IDBCursor.cpp:
2878         (WebCore::IDBCursor::setGetResult):
2879         * Modules/indexeddb/IDBRequest.cpp:
2880         (WebCore::IDBRequest::setResult):
2881         (WebCore::IDBRequest::setResultToStructuredClone):
2882         Adopt JSDOMConvert infrastructure for conversions using new types.
2883
2884         * bindings/IDLTypes.h:
2885         * bindings/js/JSDOMConvertIndexedDB.h:
2886         (WebCore::JSConverter<IDLIDBKeyData>::convert):
2887         (WebCore::JSConverter<IDLIDBValue>::convert):
2888         Add new types for IDBKeyData and IDBValue.
2889
2890         * bindings/js/CommonVM.cpp:
2891         (WebCore::addImpureProperty):
2892         * bindings/js/CommonVM.h:
2893         Move addImpureProperty here from JSDOMBinding.
2894
2895         * bindings/js/IDBBindingUtilities.cpp:
2896         (WebCore::idbKeyDataToScriptValue): Deleted.
2897         * bindings/js/IDBBindingUtilities.h:
2898         Remove unused idbKeyDataToScriptValue, and group like functions
2899         together.
2900
2901         * bindings/js/JSDOMBinding.cpp: Removed.
2902         * bindings/js/JSDOMBinding.h:
2903         (WebCore::nonCachingStaticFunctionGetter): Deleted.
2904         (WebCore::toJS): Deleted.
2905         Move/remove functions.
2906
2907         * bindings/js/JSDOMConvertUnion.h:
2908         Update for move of hasIteratorMethod to runtime/IteratorOperations.h
2909
2910         * bindings/js/JSDOMWindowCustom.cpp:
2911         * bindings/js/JSHTMLDocumentCustom.cpp:
2912         * bindings/js/JSLocationCustom.cpp:
2913         Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h
2914
2915         * bindings/js/JSSubtleCryptoCustom.cpp:
2916         Remove unneeded include of runtime/IteratorOperations.h
2917
2918         * bindings/scripts/CodeGeneratorJS.pm:
2919         (GenerateOverloadedFunctionOrConstructor):
2920         Include runtime/IteratorOperations when needing to distinguish a sequence.
2921
2922         * html/HTMLDocument.cpp:
2923         Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.
2924
2925 2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2926
2927         [GTK] Handle caps lock indicator in event modifiers
2928         https://bugs.webkit.org/show_bug.cgi?id=168186
2929
2930         Reviewed by Michael Catanzaro.
2931
2932         Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
2933         GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
2934         implementations to add the appropriate modifiers.
2935
2936         Fixes: fast/events/special-key-events-in-input-text.html
2937
2938         * platform/PlatformKeyboardEvent.h:
2939         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2940         (WebCore::modifiersForGdkKeyEvent):
2941         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
2942         * platform/gtk/PlatformMouseEventGtk.cpp:
2943         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
2944         * platform/gtk/PlatformWheelEventGtk.cpp:
2945         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
2946
2947 2017-02-11  Sam Weinig  <sam@webkit.org>
2948
2949         Remove custom bindings for XSLTProcessor.idl
2950         https://bugs.webkit.org/show_bug.cgi?id=168174
2951
2952         Reviewed by Andreas Kling.
2953
2954         * CMakeLists.txt:
2955         * WebCore.xcodeproj/project.pbxproj:
2956         * bindings/js/JSBindingsAllInOne.cpp:
2957         * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
2958         Remove file.
2959  
2960         * bindings/js/JSDOMBinding.cpp:
2961         (WebCore::jsStringOrUndefined): Deleted.
2962         * bindings/js/JSDOMBinding.h:
2963         Remove now unused jsStringOrUndefined.
2964
2965         * xml/XSLTProcessor.cpp:
2966         (WebCore::XSLTProcessor::setParameter):
2967         (WebCore::XSLTProcessor::getParameter):
2968         (WebCore::XSLTProcessor::removeParameter):
2969         * xml/XSLTProcessor.idl:
2970         Replace custom bindings bindings with early returns. One subtle difference
2971         between the custom bindings and this, is that getParameter will return 
2972         jsNull() rather than jsUndefined() for null String returns. This matches
2973         all other bindings.
2974
2975 2017-02-11  Olivier Blin  <olivier.blin@softathome.com>
2976
2977         [GStreamer][MSE][EME] Fix decryptor assignment
2978         https://bugs.webkit.org/show_bug.cgi?id=168122
2979
2980         Reviewed by Michael Catanzaro.
2981
2982         The new decryptor is a floating reference so we should not use the
2983         adopt GRefPtr constructor, but use the regular assignment operator
2984         that will sink the object (clear the floating flag).
2985
2986         This fixes assertions in debug build.
2987
2988         See previous pipeline fix in r210851 and WPE commit
2989         06020b18831e1c0eead34e2c1a5a4b7d026c227d.
2990
2991         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2992         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2993         Do not use adoptGRef(), it prevented the object from being sunk.
2994
2995 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
2996
2997         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
2998         https://bugs.webkit.org/show_bug.cgi?id=168177
2999
3000         Reviewed by Sam Weinig.
3001
3002         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
3003         when navigating within the page. If the URL had no fragment identifier, this code would
3004         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
3005         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
3006         the restores the scroll position from history.
3007         
3008         This scroll to 0,0 happened to be not visible to the page because of scroll event
3009         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
3010         by just returning early from FrameView::scrollToFragment() if there is no fragment,
3011         making sure to clear the document's CSSTarget.
3012
3013         * dom/Document.cpp:
3014         (WebCore::Document::setCSSTarget):
3015         * page/FrameView.cpp:
3016         (WebCore::FrameView::scrollToFragment):
3017         (WebCore::FrameView::scrollToAnchor):
3018
3019 2017-02-11  Chris Dumez  <cdumez@apple.com>
3020
3021         Implement URL's toJSON()
3022         https://bugs.webkit.org/show_bug.cgi?id=167979
3023
3024         Reviewed by Sam Weinig.
3025
3026         Implement URL's toJSON() as per:
3027         - https://url.spec.whatwg.org/#dom-url-tojson
3028
3029         This is already supported by Firefox.
3030
3031         Also, drop URLUtils.idl as it is no longer in the specification.
3032         Merge its content to DOMURL.idl as per the URL specification.
3033
3034         Finally, mark href attribute as stringifier and drop the toString()
3035         operation to match the specification. This fixes a bug where our
3036         toString property was not enumerable but should have been.
3037
3038         Tests: fast/url/url-tojson.html
3039                imported/w3c/web-platform-tests/url/url-tojson.html
3040
3041         * CMakeLists.txt:
3042         * DerivedSources.make:
3043         * WebCore.xcodeproj/project.pbxproj:
3044         * html/DOMURL.idl:
3045         * html/URLUtils.h:
3046         (WebCore::URLUtils<T>::toJSON):
3047         * html/URLUtils.idl: Removed.
3048
3049 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3050
3051         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
3052         https://bugs.webkit.org/show_bug.cgi?id=168163
3053
3054         Reviewed by Michael Catanzaro.
3055
3056         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
3057         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
3058         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
3059         what platforms should implement.
3060
3061         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
3062                fast/dom/HTMLAnchorElement/anchor-download.html
3063                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
3064                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
3065
3066         * platform/MIMETypeRegistry.cpp:
3067         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3068         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3069         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
3070         * platform/efl/MIMETypeRegistryEfl.cpp:
3071         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
3072         * platform/gtk/MIMETypeRegistryGtk.cpp:
3073         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
3074
3075 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3076
3077         Unreviewed. Update imageTitle translatable string.
3078
3079         To match mac port. Fixes fast/images/imageDocument-title.html.
3080
3081         * platform/gtk/LocalizedStringsGtk.cpp:
3082         (WebCore::imageTitle):
3083
3084 2017-02-10  John Wilander  <wilander@apple.com>
3085
3086         Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
3087         https://bugs.webkit.org/show_bug.cgi?id=167474
3088         <rdar://problem/24681808>
3089         <rdar://problem/24703286>
3090         <rdar://problem/30290270>
3091
3092         This patch does the following:
3093         1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
3094             does not provide the right data store.
3095         2. Introduces timeout for user interaction. A domain needs interaction every 30
3096             days to stay in that category.
3097         3. Adds grandfathered to the statistics model in preparation for grandfathering of
3098             existing data records.
3099         4. Adds test infrastructure to allow testing of the various rules in place for
3100             data records removal.
3101         5. Fixes various smaller bugs that were found as part of setting up the tests.
3102         6. Regresses the data records removal counting. We need to come up with a thread
3103             safe way of gathering removal statistics from more than one data store now
3104             that we potentially interact with multiple stores.
3105         7. Adds a first set of layout tests for resource load statistics.
3106
3107         Reviewed by Andy Estes.
3108
3109         Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
3110                http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
3111                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
3112                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
3113                http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
3114
3115         * dom/Document.cpp:
3116         (WebCore::Document::updateLastHandledUserGestureTimestamp):
3117             This now calls ResourceLoadObserver::logUserInteraction() every time since
3118             we want to keep track of the most recent user interaction.
3119         * loader/ResourceLoadObserver.cpp:
3120         (WebCore::ResourceLoadObserver::statisticsStore):
3121             New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
3122         (WebCore::reduceTimeResolutionToOneDay):
3123             Convenience function.
3124         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3125             Reduces time resolution for privacy reasons.
3126         (WebCore::ResourceLoadObserver::logUserInteraction):
3127         (WebCore::ResourceLoadObserver::clearUserInteraction):
3128         (WebCore::ResourceLoadObserver::hasHadUserInteraction):
3129         (WebCore::ResourceLoadObserver::setPrevalentResource):
3130         (WebCore::ResourceLoadObserver::isPrevalentResource):
3131         (WebCore::ResourceLoadObserver::clearPrevalentResource):
3132         (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
3133         (WebCore::ResourceLoadObserver::fireDataModificationHandler):
3134             New functions that allow WebKitTestRunner to stage exact
3135             statistics, fire the handler, and test the outcome.
3136         * loader/ResourceLoadObserver.h:
3137         * loader/ResourceLoadStatistics.cpp:
3138         (WebCore::ResourceLoadStatistics::encode):
3139         (WebCore::ResourceLoadStatistics::decode):
3140         (WebCore::ResourceLoadStatistics::toString):
3141         (WebCore::ResourceLoadStatistics::merge):
3142             Support for statistics mostRecentUserInteraction, grandfathered, and
3143             dataRecordsRemoved.
3144         * loader/ResourceLoadStatistics.h:
3145         * loader/ResourceLoadStatisticsStore.cpp:
3146         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
3147             New function that allows WebKitTestRunner to test 
3148             aging out of user interaction.
3149         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
3150             Now takes into account the timestamp and ages
3151             out user interaction.
3152         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
3153             Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
3154         * loader/ResourceLoadStatisticsStore.h:
3155
3156 2017-02-10  Sam Weinig  <sam@webkit.org>
3157
3158         [WebIDL] Cleanup XMLHttpRequest's bindings
3159         https://bugs.webkit.org/show_bug.cgi?id=168067
3160
3161         Reviewed by Chris Dumez.
3162
3163         * bindings/js/JSDOMBinding.cpp:
3164         (WebCore::jsOwnedStringOrNull): Deleted.
3165         * bindings/js/JSDOMBinding.h:
3166         Remove jsOwnedStringOrNull and inline it into it's one use
3167         in JSXMLHttpRequestCustom.
3168
3169         * bindings/js/JSXMLHttpRequestCustom.cpp:
3170         (WebCore::JSXMLHttpRequest::responseText):
3171         (WebCore::SendFunctor::SendFunctor): Deleted.
3172         (WebCore::SendFunctor::line): Deleted.
3173         (WebCore::SendFunctor::column): Deleted.
3174         (WebCore::SendFunctor::url): Deleted.
3175         (WebCore::SendFunctor::operator()): Deleted.
3176         (WebCore::JSXMLHttpRequest::send): Deleted.
3177         * xml/XMLHttpRequest.cpp:
3178         (WebCore::XMLHttpRequest::send):
3179         * xml/XMLHttpRequest.h:
3180         Remove custom send, replacing it with a single send implementation that
3181         takes a variant.
3182
3183         * xml/XMLHttpRequest.idl:
3184         Cleanup the IDL to better match the spec. Update correct types where trivial.
3185
3186 2017-02-10  Chris Dumez  <cdumez@apple.com>
3187
3188         document.origin doesn't match spec
3189         https://bugs.webkit.org/show_bug.cgi?id=168022
3190
3191         Reviewed by Sam Weinig.
3192
3193         Update document.origin to return the origin in the expected format:
3194         - https://dom.spec.whatwg.org/#dom-document-origin
3195
3196         Change: "https_webkit.org_0 -> "https://webkit.org".
3197
3198         The new behavior matches Firefox and Chrome.
3199
3200         No new tests, updated existing tests.
3201
3202         * dom/Document.cpp:
3203         (WebCore::Document::origin):
3204
3205 2017-02-10  Daniel Bates  <dabates@apple.com>
3206
3207         Attempt to fix the build following <https://trac.webkit.org/changeset/212173>
3208         (https://bugs.webkit.org/show_bug.cgi?id=166774)
3209
3210         * dom/Document.cpp:
3211         (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since
3212         the parameter cachedFrame is unused in non-debug build.
3213
3214 2017-02-10  Daniel Bates  <dabates@apple.com>
3215
3216         Detach frame from document when entering page cache
3217         https://bugs.webkit.org/show_bug.cgi?id=166774
3218         <rdar://problem/29904368>
3219
3220         Reviewed by Chris Dumez.
3221
3222         When a page enters the page cache it is unnecessary for it to hold a reference to its
3223         associated frame because subsequent interactions with the page do not need to make use
3224         of it. Once a page exits the page cache we associate it with its frame.
3225
3226         * dom/Document.cpp:
3227         (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame().
3228         (WebCore::Document::attachToCachedFrame): Added.
3229         (WebCore::Document::detachFromCachedFrame): Added.
3230         (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if
3231         we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to
3232         the former.
3233         (WebCore::Document::hasEverCalledWindowOpen): Deleted.
3234         (WebCore::Document::markHasCalledWindowOpen): Deleted.
3235         (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame.
3236         * dom/Document.h:
3237         (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed
3238         visibility from public to private and made this function inline.
3239         * history/CachedFrame.cpp:
3240         (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were
3241         removed from the page when it was in the page cache as there is no need to restore such frames.
3242         (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the
3243         frame tree.
3244         (WebCore::CachedFrame::CachedFrame): Detach from the frame.
3245         (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame.
3246         (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a
3247         frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for
3248         subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to
3249         detach the animation controller from the document as it is being destroyed. We have to do this here
3250         because the document does not have a frame. And Document::prepareForDestruction() only calls
3251         CSSAnimationController::detachFromDocument() if the document has a frame.
3252         * history/CachedFrame.h:
3253         * history/PageCache.cpp:
3254         (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open()
3255         or has an opener as it is feasible to keep such pages in the page cache.
3256         * html/HTMLFrameElementBase.cpp:
3257         (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit.
3258         * loader/FrameLoader.cpp:
3259         (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the
3260         page is not in- or about to enter- the page cache. A page in the page cache has finished loading
3261         and its active DOM objects are suspended. Also fix style nit in comment.
3262         (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to
3263         enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain
3264         that we protect the frame because stopAllLoaders() can cause the frame to be deallocated.
3265         * page/DOMWindow.cpp:
3266         (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this
3267         function will be removed.
3268         * page/DiagnosticLoggingKeys.cpp:
3269         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted.
3270         (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted.
3271         * page/DiagnosticLoggingKeys.h:
3272         * page/Page.cpp:
3273         (WebCore::Page::openedByWindowOpen): Deleted.
3274         * page/Page.h:
3275         * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener.
3276
3277 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
3278
3279         REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure
3280         https://bugs.webkit.org/show_bug.cgi?id=168054
3281
3282         Reviewed by Tim Horton.
3283
3284         When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects()
3285         to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects()
3286         ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer.
3287
3288         Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and
3289         viewport-constrained state as for its host layer (we already assume that their geometry matches).
3290
3291         Tested by compositing/masks/solid-color-masked.html
3292
3293         * platform/graphics/ca/GraphicsLayerCA.cpp:
3294         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
3295         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3296
3297 2017-02-10  Commit Queue  <commit-queue@webkit.org>
3298
3299         Unreviewed, rolling out r212154, r212154, and r212156.
3300         https://bugs.webkit.org/show_bug.cgi?id=168156
3301
3302         broke internal builds (Requested by smfr on #webkit).
3303
3304         Reverted changesets:
3305
3306         "Add a DragImage class that wraps a DragImageRef"
3307         https://bugs.webkit.org/show_bug.cgi?id=168131
3308         http://trac.webkit.org/changeset/212154
3309
3310         "Add a DragImage class that wraps a DragImageRef"
3311         https://bugs.webkit.org/show_bug.cgi?id=168131
3312         http://trac.webkit.org/changeset/212154
3313
3314         "Try to fix the iOS and Windows builds."
3315         http://trac.webkit.org/changeset/212156
3316
3317 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
3318
3319         Fix the !ENABLE(WEBGL) build
3320         https://bugs.webkit.org/show_bug.cgi?id=168112
3321
3322         Reviewed by Alex Christensen.
3323
3324         * html/canvas/WebGLRenderingContextBase.h:
3325
3326 2017-02-10  Youenn Fablet  <youenn@apple.com>
3327
3328         [Fetch API] fetch fails when undefined is passed as headers
3329         https://bugs.webkit.org/show_bug.cgi?id=168043
3330
3331         Reviewed by Geoffrey Garen.
3332
3333         Covered by updated test.
3334
3335         * Modules/fetch/FetchInternals.js:
3336         (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
3337
3338 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
3339
3340         Fix the !ENABLE(WEB_TIMING) build
3341         https://bugs.webkit.org/show_bug.cgi?id=168113
3342
3343         Reviewed by Alex Christensen.
3344
3345         * workers/WorkerGlobalScope.cpp:
3346         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
3347
3348 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
3349
3350         Update features.json for Performance Timing APIs
3351         https://bugs.webkit.org/show_bug.cgi?id=168148
3352
3353         Reviewed by Simon Fraser.
3354
3355         * features.json:
3356
3357 2017-02-10  Anders Carlsson  <andersca@apple.com>
3358
3359         Try to fix the iOS and Windows builds.
3360
3361         * platform/ios/DragImageIOS.mm:
3362         (WebCore::deleteDragImage):
3363         * platform/win/PasteboardWin.cpp:
3364         (WebCore::Pasteboard::setDragImage):
3365
3366 2017-02-10  Anders Carlsson  <andersca@apple.com>
3367
3368         Add a DragImage class that wraps a DragImageRef
3369         https://bugs.webkit.org/show_bug.cgi?id=168131
3370
3371         Reviewed by Beth Dakin.
3372
3373         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
3374         various drag code paths possible. No functionality change.
3375
3376         * dom/DataTransfer.cpp:
3377         (WebCore::DataTransfer::updateDragImage):
3378         * page/DragController.cpp:
3379         (WebCore::DragController::startDrag):
3380         (WebCore::DragController::doImageDrag):
3381         (WebCore::DragController::doSystemDrag):
3382         * page/DragController.h:
3383         * platform/DragImage.cpp:
3384         (WebCore::DragImage::DragImage):
3385         (WebCore::DragImage::operator=):
3386         (WebCore::DragImage::~DragImage):
3387         * platform/DragImage.h:
3388         * platform/Pasteboard.h:
3389         * platform/StaticPasteboard.h:
3390         * platform/mac/PasteboardMac.mm:
3391         (WebCore::Pasteboard::setDragImage):
3392
3393 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
3394
3395         Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
3396         https://bugs.webkit.org/show_bug.cgi?id=168127
3397         rdar://problem/30467120
3398
3399         Reviewed by Tim Horton.
3400         
3401         Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
3402         which forgot to hit masks and replica layers with a generic traverse() function, which
3403         is then used for setting 'inWindow' as well as resetting tracked repaints.
3404
3405         Tests: compositing/tiling/tiled-mask-inwindow.html
3406                compositing/tiling/tiled-reflection-inwindow.html
3407
3408         * page/PageOverlayController.cpp:
3409         (WebCore::PageOverlayController::layerWithDocumentOverlays):
3410         (WebCore::PageOverlayController::layerWithViewOverlays):
3411         * platform/graphics/GraphicsLayer.cpp:
3412         (WebCore::GraphicsLayer::setIsInWindow):
3413         (WebCore::GraphicsLayer::setReplicatedByLayer):
3414         (WebCore::GraphicsLayer::traverse):
3415         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
3416         * platform/graphics/GraphicsLayer.h:
3417         * rendering/RenderLayerCompositor.cpp:
3418         (WebCore::RenderLayerCompositor::setIsInWindow):
3419         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
3420         (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
3421
3422 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
3423
3424         Tiled layers are sometimes left with some tiles when outside the viewport
3425         https://bugs.webkit.org/show_bug.cgi?id=168104
3426         rdar://problem/30459055
3427
3428         Reviewed by Tim Horton.
3429
3430         When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we
3431         shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some
3432         tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect.
3433         
3434         Minor logging changes.
3435
3436         Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html
3437
3438         * platform/graphics/ca/TileGrid.cpp:
3439         (WebCore::TileGrid::revalidateTiles):
3440
3441 2017-02-10  Zalan Bujtas  <zalan@apple.com>
3442
3443         Mail hangs when removing multiple rows from large table.
3444         https://bugs.webkit.org/show_bug.cgi?id=168103
3445         <rdar://problem/30090186>
3446
3447         Reviewed by Ryosuke Niwa.
3448
3449         DeleteSelectionCommand::removeNode doesn't actually destroy table structure items,
3450         but instead it removes their content. In order to be able to continue editing the table after
3451         the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on
3452         each table item recursively.
3453         This patch delays the layout until after we've finished with the entire subtree delete (10x progression).
3454
3455         Performance test added.
3456
3457         * editing/DeleteSelectionCommand.cpp:
3458         (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
3459         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
3460         (WebCore::shouldRemoveContentOnly):
3461         (WebCore::DeleteSelectionCommand::removeNode):
3462         * editing/DeleteSelectionCommand.h:
3463
3464 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
3465
3466         [Resource Timing] Enable Resource Timing by default in Tests
3467         https://bugs.webkit.org/show_bug.cgi?id=168145
3468
3469         Reviewed by Ryosuke Niwa.
3470
3471         * loader/ResourceTimingInformation.cpp:
3472         (WebCore::ResourceTimingInformation::addResourceTiming):
3473         * testing/InternalSettings.cpp:
3474         (WebCore::InternalSettings::Backup::Backup):
3475         (WebCore::InternalSettings::Backup::restoreTo):
3476         (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
3477         * testing/InternalSettings.h:
3478         * testing/InternalSettings.idl:
3479         No longer needed for tests.
3480
3481 2017-02-10  Dan Bernstein  <mitz@apple.com>
3482
3483         [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
3484         https://bugs.webkit.org/show_bug.cgi?id=168097
3485
3486         Reviewed by Tim Horton.
3487
3488         Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
3489         indicate that changes should be agreed to by the delegate.
3490
3491         * editing/FrameSelection.cpp:
3492         (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
3493           shouldChangeSelection.
3494         * editing/FrameSelection.h:
3495
3496 2017-02-10  Jonathan Bedard  <jbedard@apple.com>
3497
3498         Removing LayoutTestRelay
3499         https://bugs.webkit.org/show_bug.cgi?id=165927
3500
3501         Reviewed by Daniel Bates.
3502         Part 2
3503
3504         LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
3505         simulators through simctl (iOS 10 and later), use this functionality instead.
3506
3507         * platform/RuntimeApplicationChecks.mm:
3508         (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.
3509
3510 2017-02-10  Youenn Fablet  <youenn@apple.com>
3511
3512         [WebRTC] Implement Outgoing libwebrtc audio source support
3513         https://bugs.webkit.org/show_bug.cgi?id=168118
3514
3515         Reviewed by Eric Carlson.
3516
3517         No new automated tests as we need the audio rendering to work to test the whole loop.
3518
3519         Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
3520         Capturing and pushing data happens in the capture thread.
3521         Pulling of converted data happens in libwebrtc thread.
3522
3523         Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.
3524
3525         * WebCore.xcodeproj/project.pbxproj:
3526         * platform/audio/WebAudioBufferList.cpp:
3527         (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
3528         * platform/audio/mac/AudioSampleBufferList.cpp:
3529         (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
3530         * platform/audio/mac/AudioSampleDataSource.cpp:
3531         (WebCore::AudioSampleDataSource::pushSamples):
3532         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
3533         * platform/audio/mac/AudioSampleDataSource.h:
3534         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
3535         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3536         (WebCore::libwebrtcAudioFormat):
3537         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
3538         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
3539         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3540         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
3541         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3542
3543 2017-02-10  Ryosuke Niwa  <rniwa@webkit.org>
3544
3545         HTMLConstructionSiteTask::Insert should never be called on a node with a parent
3546         https://bugs.webkit.org/show_bug.cgi?id=168099
3547
3548         Reviewed by Sam Weinig.
3549
3550         insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead
3551         of using HTMLConstructionSiteTask::Insert when fostering a child.
3552
3553         Also combine the step to take all children and re-parenting into a single task instead of
3554         separately issuing TakeAllChildren and Reparent tasks.
3555
3556         No new tests since this is a refactoring.
3557
3558         * html/parser/HTMLConstructionSite.cpp:
3559         (WebCore::insert): Now asserts that the child node never have a parent.
3560         (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here.
3561         (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask
3562         now that this function also does the reparenting.
3563         (WebCore::executeTask):
3564         (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren.
3565         (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild
3566         instead of calling fosterParent which uses Insert when fostering parents.
3567         (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren.
3568         * html/parser/HTMLConstructionSite.h:
3569         (WebCore::HTMLConstructionSiteTask:Operation):
3570         * html/parser/HTMLTreeBuilder.cpp:
3571         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
3572
3573 2017-02-10  Dave Hyatt  <hyatt@apple.com>
3574
3575         [CSS Parser] Make intercap property values serialize correctly
3576         https://bugs.webkit.org/show_bug.cgi?id=168073
3577
3578         Reviewed by Zalan Bujtas.
3579
3580         Fix CSS value keywords to preserve case when the value contains capital
3581         letters. Examples include optimizeSpeed, translateX, scaleY, etc.
3582
3583         * css/CSSPrimitiveValueMappings.h:
3584         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3585         (WebCore::CSSPrimitiveValue::operator EPointerEvents):
3586         (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
3587         (WebCore::CSSPrimitiveValue::operator EImageRendering):
3588         (WebCore::CSSPrimitiveValue::operator EColorInterpolation):
3589         (WebCore::CSSPrimitiveValue::operator EColorRendering):
3590         (WebCore::CSSPrimitiveValue::operator EShapeRendering):
3591         * css/MediaQueryEvaluator.cpp:
3592         (WebCore::colorGamutEvaluate):
3593         * css/SVGCSSValueKeywords.in:
3594         * css/TransformFunctions.cpp:
3595         (WebCore::transformOperationType):
3596         (WebCore::transformsForValue):
3597         * css/makevalues.pl:
3598         * css/parser/CSSParserFastPaths.cpp:
3599         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3600         (WebCore::parseTransformTranslateArguments):
3601         (WebCore::parseSimpleTransformValue):
3602         * css/parser/CSSPropertyParser.cpp:
3603         (WebCore::consumeTransformValue):
3604         * css/parser/CSSPropertyParserHelpers.cpp:
3605         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
3606
3607 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
3608
3609         [EME] Implement MediaKeySession::load()
3610         https://bugs.webkit.org/show_bug.cgi?id=168041
3611
3612         Reviewed by Xabier Rodriguez-Calvar.
3613
3614         Implement the MediaKeySession::load() method, tracing the steps as they
3615         are defined in the EME specification. The only exception is step 8.3,
3616         which requires additional facility that tracks currently open sessions
3617         and provides information whether for a given session ID there's already
3618         a MediaKeySession that's not yet been closed.
3619
3620         Session ID sanitization is done through the CDM::sanitizeSessionId()
3621         method, which relays the task to the CDMPrivate implementation.
3622
3623         The CDMInstance::loadSession() virtual method is called with the session
3624         type, sanitized ID, the Document's origin (in string form) and the
3625         callback that's invoked upon completion of the task. The callback
3626         checks whether the operation was successful, or examines the reason for
3627         the load failure in case it wasn't, rejecting the promise in the latter
3628         case either immediately or in the following task at the latest.
3629
3630         When the load was successful, the optional known keys, expiration time
3631         and message are handled appropriately, and the promise is resolved.
3632
3633         MockCDM::sanitizeSessionId() implementation only treats
3634         'valid-loaded-session' as a valid session ID.
3635         MockCDMInstance::loadSession() implementation is kept slim for now, only
3636         providing the 'license-renewal' message when invoking the passed-in
3637         callback. Known keys and expiration time will also be tested once the
3638         relevant MediaKeySession algorithms are implemented.
3639
3640         Test: media/encrypted-media/mock-MediaKeySession-load.html
3641
3642         * Modules/encryptedmedia/CDM.cpp:
3643         (WebCore::CDM::sanitizeSessionId):
3644         * Modules/encryptedmedia/CDM.h:
3645         * Modules/encryptedmedia/CDMInstance.h:
3646         * Modules/encryptedmedia/CDMPrivate.h:
3647         * Modules/encryptedmedia/MediaKeySession.cpp:
3648         (WebCore::MediaKeySession::load):
3649         * testing/MockCDMFactory.cpp:
3650         (WebCore::MockCDM::sanitizeSessionId):
3651         (WebCore::MockCDMInstance::loadSession):
3652         * testing/MockCDMFactory.h:
3653
3654 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
3655
3656         [EME] Implement MediaKeySession::sessionClosed()
3657         https://bugs.webkit.org/show_bug.cgi?id=168039
3658
3659         Reviewed by Xabier Rodriguez-Calvar.
3660
3661         Implement the 'session closed' algorithm for MediaKeySession by
3662         following the specified steps. After this algorithm is run, the
3663         session should be considered closed, which we track via the m_closed
3664         member variable on the class. This is set to true before the promise
3665         that's accessible through the 'closed' attribute is resolved.
3666
3667         Because the algorithm requires the CDM instance to store any record
3668         of key usage when the session's type is 'persistent-usage-record', the
3669         storeRecordOfKeyUsage() virtual method is added to the CDMInstance
3670         interface. MockCDMInstance implementation is left unimplemented for now.
3671
3672         JSMediaKeySession::closed() accessor now has a custom implementation
3673         that creates a deferred promise for that object if there's none yet, and
3674         shares it with the wrapped class through the registerClosedPromise()
3675         method, storing a reference to the promise in the m_closedPromise
3676         member variable, or resolving the promise immediately if the session was
3677         already closed.
3678
3679         Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.
3680
3681         * Modules/encryptedmedia/CDMInstance.h:
3682         * Modules/encryptedmedia/MediaKeySession.cpp:
3683         (WebCore::MediaKeySession::registerClosedPromise):
3684         (WebCore::MediaKeySession::sessionClosed):
3685         * Modules/encryptedmedia/MediaKeySession.h:
3686         * bindings/js/JSMediaKeySessionCustom.cpp:
3687         (WebCore::JSMediaKeySession::closed):
3688         * testing/MockCDMFactory.cpp:
3689         (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
3690         * testing/MockCDMFactory.h:
3691
3692 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
3693
3694         [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
3695         https://bugs.webkit.org/show_bug.cgi?id=167888
3696
3697         Reviewed by Xabier Rodriguez-Calvar.
3698
3699         Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
3700         KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
3701         A keystatuseschange event is fired on the MediaKeySession object afterwards.
3702         The queueing of the task that runs the 'attemp to resume playback' on the
3703         related HTMLMediaElement objects isn't done yet since that algorithm isn't
3704         implemented yet.
3705
3706         The statuses Vector is stored on the MediaKeySession object. That Vector is
3707         then exposed through the MediaKeyStatusMap object, each such object being
3708         unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
3709         thus keeps a reference to the session object as long as that object is alive,
3710         and queries the MediaKeySession::statuses() getter to access the Vector that
3711         contains status information for all the key IDs.
3712
3713         MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
3714         object and accesses the statuses by indexing into the status Vector of the
3715         related MediaKeySession object.
3716
3717         CDMInstance::updateLicense() now accepts the session ID string as the first
3718         argument, making it possible to specify which session should be updated.
3719
3720         MockCDMFactory::keysForSessionWithID() returns an optional reference to the
3721         Vector value in the session map that lists all the key IDs that are being
3722         stored for that session.
3723
3724         MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
3725         passed-in response data, and upon detecting that constructs a KeyStatusVector
3726         object containing all the keys for that session. KeyStatus::Usable is returned
3727         for each object at the moment, but this should be adjustable in the future
3728         through additional parameters passed through the response data. The Vector
3729         object is then passed to the callback and is then passed to the 'update key
3730         statuses' algorithm in MediaKeySession.
3731
3732         Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.
3733
3734         * Modules/encryptedmedia/CDMInstance.h:
3735         * Modules/encryptedmedia/MediaKeySession.cpp:
3736         (WebCore::MediaKeySession::MediaKeySession):
3737         (WebCore::MediaKeySession::~MediaKeySession):
3738         (WebCore::MediaKeySession::update):
3739         (WebCore::MediaKeySession::updateKeyStatuses):
3740         * Modules/encryptedmedia/MediaKeySession.h:
3741         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
3742         (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
3743         (WebCore::MediaKeyStatusMap::detachSession):
3744         (WebCore::MediaKeyStatusMap::size):
3745         (WebCore::keyIdsMatch):
3746         (WebCore::MediaKeyStatusMap::has):
3747         (WebCore::MediaKeyStatusMap::get):
3748         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
3749         (WebCore::MediaKeyStatusMap::Iterator::next):
3750         * Modules/encryptedmedia/MediaKeyStatusMap.h:
3751         (WebCore::MediaKeyStatusMap::create):
3752         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
3753         * testing/MockCDMFactory.cpp:
3754         (WebCore::MockCDMFactory::keysForSessionWithID):
3755         (WebCore::MockCDMInstance::updateLicense):
3756         * testing/MockCDMFactory.h:
3757
3758 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
3759
3760         Improve IOSurfacePool logging
3761         https://bugs.webkit.org/show_bug.cgi?id=168098
3762
3763         Reviewed by Tim Horton.
3764
3765         Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
3766         logging.
3767
3768         * platform/graphics/cg/IOSurfacePool.cpp:
3769         (WebCore::IOSurfacePool::takeSurface):
3770         (WebCore::IOSurfacePool::addSurface):
3771         (WebCore::IOSurfacePool::evict):
3772         (WebCore::IOSurfacePool::collectionTimerFired):
3773         (WebCore::IOSurfacePool::showPoolStatistics):
3774         * platform/graphics/cg/IOSurfacePool.h:
3775
3776 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3777
3778         Unreviewed, rolling out r212040.
3779
3780         Broke build.  I'm not surprised
3781
3782         Reverted changeset:
3783
3784         "[WebRTC][Mac] Activate libwebrtc"
3785         https://bugs.webkit.org/show_bug.cgi?id=167293
3786         http://trac.webkit.org/changeset/212040
3787
3788 2017-02-09  Chris Dumez  <cdumez@apple.com>
3789
3790         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
3791         https://bugs.webkit.org/show_bug.cgi?id=168077
3792         <rdar://problem/30412595>
3793
3794         Reviewed by Alex Christensen.
3795
3796         Add utility function to MIMETypeRegistry that appends an extension to
3797         a filename if necessary, based on a provided MIME type.
3798
3799         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
3800                http/tests/download/anchor-download-no-extension.html
3801
3802         * platform/MIMETypeRegistry.cpp:
3803         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3804         * platform/MIMETypeRegistry.h:
3805         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3806         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3807
3808 2017-02-09  Youenn Fablet  <youenn@apple.com>
3809
3810         [WebRTC][Mac] Activate libwebrtc
3811         https://bugs.webkit.org/show_bug.cgi?id=167293
3812
3813         Reviewed by Alex Christensen.
3814
3815         * Configurations/WebCore.xcconfig:
3816         * Configurations/WebCoreTestSupport.xcconfig:
3817
3818 2017-02-09  Philip Rogers  <pdr@google.com>
3819
3820         SVG clip-path references can clip out later content
3821         https://bugs.webkit.org/show_bug.cgi?id=164181
3822
3823         Reviewed by Said Abou-Hallawa.
3824
3825         RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
3826         clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
3827         and its caller restores it back so later content is not clipped as well.
3828
3829         This patch is based on a chromium patch by fs@opera.com:
3830         https://chromium.googlesource.com/chromium/src/+/b3f7e7d2c4afb3c7e5c7eb438ff5933cbe2109b3
3831
3832         Test: css3/masking/clip-path-reference-restore.html
3833
3834         * rendering/RenderLayer.cpp:
3835         (WebCore::RenderLayer::setupClipPath): Add a GC save and return true to restore. Also switch to downcast instead of static_cast.
3836
3837 2017-02-09  Filip Pizlo  <fpizlo@apple.com>
3838
3839         SharedArrayBuffer does not need to be in the transfer list
3840         https://bugs.webkit.org/show_bug.cgi?id=168079
3841
3842         Reviewed by Geoffrey Garen and Keith Miller.
3843
3844         Tests: workers/sab/multi-memory-multi-buffer.html
3845                workers/sab/multi-memory.html
3846                workers/sab/no-transfer.html
3847                workers/sab/postMessage-clones.html
3848                workers/sab/sent-from-worker-no-transfer.html
3849                workers/sab/sent-from-worker-transfer.html
3850
3851         The SAB API that we originally implemented required that SABs get put in transfer lists
3852         when they are sent to workers.
3853         
3854         The new SAB API that everyone is converging towards requires that you do not put the
3855         SAB in the transfer list. That's supposed to be an error. Instead, anytime that a SAB
3856         is part of any message to or from a dedicated worker then it is automatically shared.
3857         
3858         The new API provides a lot more clarity about what is supposed to happen in contexts
3859         that support transfering but don't support sharing.
3860         
3861         Right now this patch allows both styles to work, but I hope we can disable the transfer
3862         list capability soon.
3863
3864         * bindings/js/IDBBindingUtilities.cpp:
3865         (WebCore::deserializeIDBValueToJSValue):
3866         * bindings/js/JSMessageEventCustom.cpp:
3867         (WebCore::JSMessageEvent::data):
3868         * bindings/js/SerializedScriptValue.cpp:
3869         (WebCore::CloneSerializer::serialize):
3870         (WebCore::CloneSerializer::CloneSerializer):
3871         (WebCore::CloneSerializer::dumpIfTerminal):
3872         (WebCore::CloneDeserializer::deserialize):
3873         (WebCore::CloneDeserializer::CloneDeserializer):
3874         (WebCore::CloneDeserializer::readTerminal):
3875         (WebCore::SerializedScriptValue::SerializedScriptValue):
3876         (WebCore::SerializedScriptValue::create):
3877         (WebCore::SerializedScriptValue::deserialize):
3878         * bindings/js/SerializedScriptValue.h:
3879         (): Deleted.
3880         * dom/CustomEvent.cpp:
3881         (WebCore::CustomEvent::trySerializeDetail):
3882         * dom/ErrorEvent.cpp:
3883         (WebCore::ErrorEvent::trySerializeError):
3884         * dom/MessageEvent.cpp:
3885         (WebCore::MessageEvent::trySerializeData):
3886         * dom/PopStateEvent.cpp:
3887         (WebCore::PopStateEvent::trySerializeState):
3888         * workers/DedicatedWorkerGlobalScope.cpp:
3889         (WebCore::DedicatedWorkerGlobalScope::postMessage):
3890         * workers/Worker.cpp:
3891         (WebCore::Worker::postMessage):
3892
3893 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
3894
3895         Unreviewed build fix after r212025.
3896
3897         inDocument -> isConnected
3898
3899         * html/FormAssociatedElement.cpp:
3900         (WebCore::FormAssociatedElement::didMoveToNewDocument):
3901         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
3902         * html/HTMLFormElement.cpp:
3903         (WebCore::HTMLFormElement::formElementIndex):
3904
3905 2017-02-09  Chris Dumez  <cdumez@apple.com>
3906
3907         Make sure Event keeps its current target element alive
3908         https://bugs.webkit.org/show_bug.cgi?id=167885
3909         <rdar://problem/30376972>
3910
3911         Reviewed by Brent Fulgham.
3912
3913         Make sure Event keeps its current target element alive to avoid
3914         crashes if it is accessed by JS after it has been garbage collected.
3915
3916         Test: fast/events/currentTarget-gc-crash.html
3917
3918         * dom/Event.cpp:
3919         (WebCore::Event::setCurrentTarget):
3920         * dom/Event.h:
3921         (WebCore::Event::currentTarget):
3922
3923 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
3924
3925         Crash in render tree after dynamically mutating the slot value
3926         https://bugs.webkit.org/show_bug.cgi?id=167502
3927
3928         Reviewed by Antti Koivisto.
3929
3930         The crash was caused by attributeChanged not destructing the render tree after an assigned element had been
3931         removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to
3932         delete its render object as if the element had been removed from the DOM tree.
3933
3934         Tests: fast/html/details-summary-slot.html
3935                fast/shadow-dom/shadow-slot-attribute-change-crash.html
3936
3937         * dom/Element.cpp:
3938         (WebCore::Element::attributeChanged):
3939         * html/HTMLSummaryElement.cpp:
3940         (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value.
3941         (WebCore::HTMLSummaryElement::create): Use SummarySlotElement
3942
3943 2017-02-09  Antti Koivisto  <antti@apple.com>
3944
3945         Details element doesn't work correctly when mutating content between closing and opening
3946         https://bugs.webkit.org/show_bug.cgi?id=167310
3947
3948         Reviewed by Ryosuke Niwa.
3949
3950         Tests: fast/html/details-close-modify-open.html
3951                fast/shadow-dom/slot-remove-mutate-add.html
3952
3953         * dom/SlotAssignment.cpp:
3954         (WebCore::SlotAssignment::didChangeSlot):
3955
3956             Always reset the slot assignment when content is mutated.
3957
3958 2017-02-09  Chris Dumez  <cdumez@apple.com>
3959
3960         Crash under FormSubmission::create()
3961         https://bugs.webkit.org/show_bug.cgi?id=167200
3962         <rdar://problem/30096323>
3963
3964         Reviewed by Darin Adler.
3965
3966         The issue is that FormSubmission::create() was iterating over
3967         form.associatedElements() as was calling Element::appendFormData()
3968         in the loop. HTMLObjectElement::appendFormData() was calling
3969         pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous
3970         layout and can fire events (such as focus event) synchronously.
3971         Firing those events synchronously allows the JS to modify the
3972         form.associatedElements() vector we are currently iterating on.
3973
3974         To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad)
3975         in HTMLObjectElement::appendFormData() as we are not allowed to fire
3976         synchronous events at this point. I also added a security assertion
3977         in FormSubmission::create() to catch cases where we fire JS events
3978         while iterating over the form associated elements to more easily
3979         notice these things in the future.
3980
3981         Test: fast/forms/formsubmission-appendFormData-crash.html
3982
3983         * html/HTMLObjectElement.cpp:
3984         (WebCore::HTMLObjectElement::appendFormData):
3985         * loader/FormSubmission.cpp:
3986         (WebCore::FormSubmission::create):
3987
3988 2017-02-09  Chris Dumez  <cdumez@apple.com>
3989
3990         Crash under HTMLFormElement::registerFormElement()
3991         https://bugs.webkit.org/show_bug.cgi?id=167162
3992
3993         Reviewed by Ryosuke Niwa.