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