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