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