ec7faadbfd413652c8d76dbb502402ba62ea03ca
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-01  Chris Dumez  <cdumez@apple.com>
2
3         REGRESSION(r205136): {}.toString.call(crossOriginWindow) should not throw
4         https://bugs.webkit.org/show_bug.cgi?id=167681
5         <rdar://problem/30301117>
6
7         Reviewed by Mark Lam.
8
9         As per https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-):
10         """
11         If P is @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return
12         PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
13         """
14
15         We now implement this behavior instead of throwing.
16
17         Test: http/tests/security/symbols-cross-origin.html
18
19         * bindings/js/JSDOMWindowCustom.cpp:
20         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
21         * bindings/js/JSLocationCustom.cpp:
22         (WebCore::JSLocation::getOwnPropertySlotDelegate):
23
24 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
25
26         Correct "filesHaveSameVolume" predicate
27         https://bugs.webkit.org/show_bug.cgi?id=167696
28         <rdar://problem/30298722>
29
30         Reviewed by David Kilzer.
31
32         We are passing %-encoded strings to the underlying operating system's file system APIs.
33         This doesn't work. Instead, we need to present a decoded version of the file path
34         that matches what the system APIs expect.
35
36         Tested by new TestWebKitAPI Test.
37
38         * platform/FileSystem.cpp:
39         (WebCore::filesHaveSameVolume): Make sure the file paths we give to the underlying
40         operating system are not percent encoded.
41         * platform/FileSystem.h: Export 'filesHaveSameVolume' for use by testing system.
42
43 2017-02-01  Antoine Quint  <graouts@apple.com>
44
45         [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
46         https://bugs.webkit.org/show_bug.cgi?id=165319
47         <rdar://problem/30284104>
48
49         Reviewed by Dean Jackson.
50
51         Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks-
52         support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue
53         is that animations are suspended by media/controls/track-menu.html with a call to
54         internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations().
55         Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because
56         the selection animation for the tracks panel menu item that is clicked never completes and the delegate
57         to notify that an item in the tracks panel was selected is never fired, which leads to the test failure.
58
59         We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current
60         document, rather than calling into AnimationController::suspendAnimations() which would do just that,
61         but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent
62         document load.
63
64         * dom/Document.cpp:
65         (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer
66         associated with an AnimationController.
67         * page/animation/AnimationController.cpp:
68         (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case
69         the document its renderer is associated with is suspended. This is required since previously CompositeAnimations
70         would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no
71         document to use as a basis to query its suspended state in that constructor.
72         (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument):
73         (WebCore::AnimationControllerPrivate::detachFromDocument):
74         (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument):
75         (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument):
76         (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended):
77         (WebCore::AnimationController::animationsAreSuspendedForDocument):
78         (WebCore::AnimationController::detachFromDocument):
79         * page/animation/AnimationController.h:
80         * page/animation/AnimationControllerPrivate.h:
81         * testing/Internals.cpp:
82         (WebCore::Internals::animationsAreSuspended):
83         (WebCore::Internals::suspendAnimations):
84         (WebCore::Internals::resumeAnimations):
85
86 2017-02-01  Ryan Haddad  <ryanhaddad@apple.com>
87
88         Unreviewed build fix after r211488.
89
90         * accessibility/AXObjectCache.h: Removed property svn:executable.
91
92 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
93
94         Unreviewed build fix.
95
96         * html/HTMLMediaElement.h: Removed property svn:executable.
97
98 2017-02-01  Jer Noble  <jer.noble@apple.com>
99
100         NULL-deref crash in TextTrack::removeCue()
101         https://bugs.webkit.org/show_bug.cgi?id=167615
102
103         Reviewed by Eric Carlson.
104
105         Test: http/tests/media/track-in-band-hls-metadata-crash.html
106
107         Follow-up to r211401. When passing around a reference to an object, the assumption is that
108         the caller is retaining the underlying object. This breaks down for
109         InbandDataTextTrack::removeDataCue(), which releases its own ownership of the cue object,
110         then passes the reference to that object to its superclass to do further remove steps. The
111         retain count of the cue can thus drop to zero within the scope of
112         InbandTextTrack::removeCue(). Use "take" semantics to remove the cue from the
113         m_incompleteCueMap without releasing ownership, and pass a reference to that retained object
114         on to removeCue(), guaranteeing that the cue will not be destroyed until after the
115         romeveDataCue() method returns.
116
117         * html/track/InbandDataTextTrack.cpp:
118         (WebCore::InbandDataTextTrack::removeDataCue):
119
120 2017-02-01  Nan Wang  <n_wang@apple.com>
121
122         AX: Incorrect range from index and length in text controls when there are newlines
123         https://bugs.webkit.org/show_bug.cgi?id=167677
124         <rdar://problem/30300099>
125
126         Reviewed by Chris Fleizach.
127
128         When there are newlines in text controls, the VisiblePosition that is created
129         from the index could be wrong. Because the index doesn't include the information 
130         regarding a position's affinity. Fixed it by using CharacterOffset instead, since
131         it doesn't require that information.
132
133         Test: accessibility/mac/range-for-contenteditable-newline.html
134
135         * accessibility/AXObjectCache.cpp:
136         (WebCore::AXObjectCache::traverseToOffsetInRange):
137         (WebCore::AXObjectCache::nextCharacterOffset):
138         (WebCore::AXObjectCache::characterOffsetForIndex):
139
140 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
141
142         AXObjectCache is missing two functions at link time when !HAVE(ACCESSIBILITY)
143         https://bugs.webkit.org/show_bug.cgi?id=167691
144
145         Reviewed by Chris Fleizach.
146
147         * accessibility/AXObjectCache.h:
148         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Added empty stub.
149         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Added empty stub.
150
151 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
152
153         HTMLMediaElement.h fails to build when ENABLE(MEDIA_CONTROLS_SCRIPT) is false
154         https://bugs.webkit.org/show_bug.cgi?id=167689
155
156         Reviewed by Joseph Pecoraro.
157
158         * html/HTMLMediaElement.h: Move mediaControlsHost() into the ENABLE(MEDIA_CONTROLS_SCRIPT)
159         block that is just above it to match m_mediaControlsHost.
160
161 2017-02-01  Romain Bellessort  <romain.bellessort@crf.canon.fr>
162
163         [Readable Streams API] Implement ReadableByteStreamController pull()
164         https://bugs.webkit.org/show_bug.cgi?id=167593
165
166         Reviewed by Youenn Fablet.
167
168         Implemented pull() method for ReadableByteStreamController. Also updated
169         pendingPullIntos attribute, which was a more complex object than necessary
170         (an array is enough).
171
172         Added 2 tests that allow covering most of new code. Code not yet tested will
173         become reachable as the rest of the spec is implemented (new tests will then
174         be added).
175
176         * Modules/streams/ReadableByteStreamInternals.js:
177         (privateInitializeReadableByteStreamController): Updated pendingPullIntos.
178         (readableByteStreamControllerCancel): Updated pendingPullIntos.
179         (readableByteStreamControllerClose): Updated pendingPullIntos.
180         (readableByteStreamControllerHandleQueueDrain): Added.
181         (readableByteStreamControllerPull): Added.
182
183 2017-02-01  Enrique Ocaña González  <eocanha@igalia.com>
184
185         [GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
186         https://bugs.webkit.org/show_bug.cgi?id=166529
187
188         Reviewed by Xabier Rodriguez-Calvar.
189
190         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
191         (WebCore::AppendPipeline::AppendPipeline): Don't use the "always-honor-tfdt" property
192         in qtdemux anymore.
193
194 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
195
196         Unreviewed, build fix for macOS and iOS ports, part 2
197
198         Annotate the function with static.
199
200         * bindings/js/ScriptModuleLoader.cpp:
201         (WebCore::rejectToPropagateNetworkError):
202
203 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
204
205         Unreviewed, build fix for macOS and iOS ports
206
207         * bindings/js/ModuleFetchFailureKind.h: Renamed from Source/ModuleFetchFailureKind.h.
208
209 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
210
211         Propagate networking errors correctly for import() operator
212         https://bugs.webkit.org/show_bug.cgi?id=167501
213
214         Reviewed by Ryosuke Niwa.
215
216         We use the promise chain inside the module loader pipeline.
217         The problem is that,
218
219         1. The errors of loading module scripts are propagated through the promise's rejection.
220         2. Some module related errors like syntax error (when scanning module dependencies) are
221            reported at loading time (evaluating time). These errors are propagated through the
222            promise rejections and dumped to the console. LoadableModuleScript set catch handler
223            for that and print these errors to the console for ScriptElement.
224         3. Some of errors are already reported to the console. For example, networking errors
225            are reported by the CachedModuleLoader.
226         4. But there is no way to distinguish between (2) and (3) at the catch handler.
227
228         Previously, we propagate the special symbol for the already reported errors to distinguish
229         that. This was OK because these errors cannot be catched by the user code. However,
230         recent `import()` call needs to expose these errors to the user code. So now, accidentally,
231         the special purpose symbol is exposed.
232
233         Instead of propagating the special symbol, this patch just propagates the errors. But these
234         error objects are annotated with the private symbol. So these errors can be distinguished
235         from the other ones.
236
237         Currently, we do not have the way to expose the error details to the client of the
238         CachedScript. So we just report the error with the failed / canceled. This should be
239         more descriptive error messages in the separate patch[1].
240
241         [1]: https://bugs.webkit.org/show_bug.cgi?id=167553
242
243         Tests: http/tests/security/mixedContent/import-insecure-script-in-iframe.html
244                js/dom/modules/import-not-found-error.html
245
246         * WebCore.xcodeproj/project.pbxproj:
247         * bindings/js/JSDOMPromise.h:
248         (WebCore::DeferredPromise::resolveWithCallback):
249         (WebCore::DeferredPromise::rejectWithCallback):
250         * bindings/js/ScriptController.cpp:
251         (WebCore::ScriptController::setupModuleScriptHandlers):
252         * bindings/js/ScriptController.h:
253         (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol): Deleted.
254         (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol): Deleted.
255         * bindings/js/ScriptModuleLoader.cpp:
256         (WebCore::rejectToPropagateNetworkError):
257         (WebCore::ScriptModuleLoader::fetch):
258         (WebCore::ScriptModuleLoader::notifyFinished):
259         * bindings/js/WebCoreBuiltinNames.h:
260
261 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
262
263         Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
264         https://bugs.webkit.org/show_bug.cgi?id=167525
265         <rdar://problem/30270210>
266
267         Reviewed by Ryosuke Niwa.
268
269         Test: fast/events/input-events-insert-newlines-after-mutation.html
270
271         Reverts an unintended change made while refactoring code for input events that caused input events to be
272         dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in
273         CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within*
274         the scope by calling typingAddedToOpenCommand.
275
276         Instead, TypingCommands should always dispatch events
277         synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change
278         than we should currently allow, so we should revert to our old behavior for the time being.
279
280         * editing/Editor.cpp:
281
282 2017-01-31  Zalan Bujtas  <zalan@apple.com>
283
284         Simple line layout: Do not assert on zero length/width trailing whitespace.
285         https://bugs.webkit.org/show_bug.cgi?id=167679
286
287         Reviewed by Simon Fraser.
288
289         It's valid to have an zero length/width trailing whitespace.
290
291         Covered by existing tests.
292
293         * rendering/SimpleLineLayout.cpp:
294         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace): Zero length -> nothing to do.
295         Zero width with length > 0 (font-size: 0) -> remove trailing run.
296
297 2017-01-31  Alex Christensen  <achristensen@webkit.org>
298
299         Fix debug libwebrtc build after r211439
300         https://bugs.webkit.org/show_bug.cgi?id=167572
301
302         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
303         (WebCore::LibWebRTCAudioModule::OnMessage):
304
305 2017-01-31  Zalan Bujtas  <zalan@apple.com>
306
307         Simple line layout: Collect fragments in LineState only when needed for post-processing.
308         https://bugs.webkit.org/show_bug.cgi?id=167655
309         <rdar://problem/30290592>
310
311         Reviewed by Antti Koivisto.
312
313         The fragments we need to keep around for basic line breaking are the last and last non-whitespace fragments.
314         However in certain cases such as text-align: justify, we have to traverse the entire line
315         at post-processing which requires all the fragments on the current line.
316         This patch speeds up the basic line handling by using m_fragment list only for the special cases.
317         It improves PerformanceTests/Layout/simple-line-layout-non-repeating-text.html by ~7% (local measurement)
318         median: 114.25 runs/s -> median: 122.16 runs
319
320         Covered by existing tests.
321
322         * rendering/SimpleLineLayout.cpp:
323         (WebCore::SimpleLineLayout::LineState::setNeedsAllFragments):
324         (WebCore::SimpleLineLayout::LineState::hasTrailingWhitespace):
325         (WebCore::SimpleLineLayout::LineState::lastFragment):
326         (WebCore::SimpleLineLayout::LineState::expansionOpportunityCount):
327         (WebCore::SimpleLineLayout::LineState::isEmpty):
328         (WebCore::SimpleLineLayout::LineState::endPositionForCollapsedFragment):
329         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): Track uncompleted width.
330         (WebCore::SimpleLineLayout::LineState::revertToLastCompleteFragment):
331         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
332         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
333         (WebCore::SimpleLineLayout::updateLineConstrains): Set the slow path for text-align: justify.
334         (WebCore::SimpleLineLayout::createLineRuns):
335         (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
336         (WebCore::SimpleLineLayout::createTextRuns):
337         * rendering/SimpleLineLayoutTextFragmentIterator.h:
338         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isValid):
339         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::length):
340
341 2017-01-31  Chris Dumez  <cdumez@apple.com>
342
343         com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::FrameView::didDestroyRenderTree
344         https://bugs.webkit.org/show_bug.cgi?id=167665
345         <rdar://problem/30241193>
346
347         Reviewed by Andreas Kling.
348
349         When destroying a PageCache entry, we would call Document::prepareFromDestruction()
350         which would destroy the render tree and then call FrameView::didDestroyRenderTree().
351         We would sometimes hit the ASSERT(m_widgetsInRenderTree.isEmpty()) assertion in
352         didDestroyRenderTree(). This indicates that there are still RenderWidgets associated
353         with the FrameView even though we claim we already destroyed the render tree.
354
355         The reason for this is that, in the PageCache context, the top document's frame is
356         reused on navigation and may not be associated with a new document that is currently
357         displayed, has a render tree (and possible RenderWidgets). The solution proposed is
358         to stop calling FrameView::didDestroyRenderTree() in Document::prepareFromDestruction()
359         if the frame's document is not |this|. This happens when the document is destroyed
360         while in PageCache. We do not want to mess with the frame / frameview in this case
361         since they are no longer associated to the present document anymore.
362
363         No new tests, already covered by existing tests which currently crash flakily.
364
365         * dom/Document.cpp:
366         (WebCore::Document::destroyRenderTree):
367
368 2017-01-31  Sam Weinig  <sam@webkit.org>
369
370         Remove unused/rarely used bindings helpers
371         https://bugs.webkit.org/show_bug.cgi?id=167648
372
373         Reviewed by Anders Carlsson.
374
375         * bindings/js/JSDOMBinding.cpp:
376         * bindings/js/JSDOMBinding.h:
377         (WebCore::jsString): Deleted.
378         (WebCore::jsStringOrUndefined): Deleted.
379         (WebCore::finiteInt32Value): Deleted.
380         (WebCore::toJS): Deleted.
381         Remove unused functions. The toJS overrides can be replaced with their
382         modern JSDOMConvert counterparts.
383         
384         * bindings/js/JSDOMExceptionHandling.h:
385         (WebCore::toJS): Deleted.
386         (WebCore::toJSNewlyCreated): Deleted.
387         Remove unused functions.
388
389         * bindings/js/JSDOMIterator.h:
390         Add more specific include of JSDOMConvert.h to fix compile.
391
392         * bindings/js/JSDOMPromise.cpp:
393         (WebCore::DeferredPromise::reject):
394         Create the Symbol directly, instead of using the toJS override.
395
396         * bindings/js/JSWorkerCustom.cpp:
397         (WebCore::constructJSWorker):
398         Use JSDOMConvert toJS function.
399
400         * bindings/js/JSXMLHttpRequestCustom.cpp:
401         (WebCore::JSXMLHttpRequest::retrieveResponse):
402         Use JSDOMConvert toJS functions.
403
404         * bindings/js/ScriptController.h:
405         Add missing forward declaration of URL.
406
407         * bindings/js/ScriptModuleLoader.cpp:
408         (WebCore::ScriptModuleLoader::resolve):
409         Create the Symbol directly, instead of using the toJS override.
410
411         * html/HTMLPlugInImageElement.cpp:
412         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
413         Use JSDOMConvert toJS functions.
414
415 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
416
417         WebItemProviderPasteboard should be robust when UIItemProvider fails to initialize an object
418         https://bugs.webkit.org/show_bug.cgi?id=167663
419         <rdar://problem/30294240>
420
421         Reviewed by Tim Horton.
422
423         Adds a nil check for the result of -createObjectOfClass:error:.
424
425         * platform/ios/WebItemProviderPasteboard.mm:
426         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
427         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]):
428
429 2017-01-31  Keith Rollin  <krollin@apple.com>
430
431         Variable used after it's been WTFMove'd
432         https://bugs.webkit.org/show_bug.cgi?id=167658
433
434         Reviewed by Chris Dumez.
435
436         Rather than WTFMoving the variable as part of passing it to a function
437         that takes an RValue-ref, call copyRef to provide the RValue-ref. This
438         preserves the original variable for later use in the function.
439
440         No new tests -- this issue was found by inspection. It's not apparent
441         what the side-effect of this bug is or how a test would verify it.
442
443         * loader/SubresourceLoader.cpp:
444         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
445
446 2017-01-31  Anders Carlsson  <andersca@apple.com>
447
448         Apple Pay button does nothing on nytimes.com
449         https://bugs.webkit.org/show_bug.cgi?id=167664
450         rdar://problem/30273885
451
452         Reviewed by Sam Weinig.
453
454         Separate line item validation into convertAndValidateTotal and convertAndValidate. The former
455         works on totals (which require an amount), and the latter works on regular line items that do not require an amount
456         if the item type is "pending".
457
458         * Modules/applepay/ApplePaySession.cpp:
459         (WebCore::convertAndValidateTotal):
460         (WebCore::convertAndValidate):
461         Only check the amount if the type is not pending.
462
463         (WebCore::ApplePaySession::completeShippingMethodSelection):
464         (WebCore::ApplePaySession::completeShippingContactSelection):
465         (WebCore::ApplePaySession::completePaymentMethodSelection):
466         Call convertAndValidateTotal for totals.
467
468 2017-01-31  Youenn Fablet  <youenn@apple.com>
469
470         [WebRTC] Add a libwebrtc AudioModule specific to WebKit
471         https://bugs.webkit.org/show_bug.cgi?id=167572
472
473         Reviewed by Alex Christensen.
474
475         To be covered by webrtc audio tests.
476         Adding an AudioModule to circumvent the default LibWebRTC Audio Module which does the audio directly.
477         The implementation of the AudioModule is restricted to enable fueling the incoming audio tracks with incoming data.
478         Code inspired from https://chromium.googlesource.com/chromium/src/+/master/remoting/protocol/webrtc_audio_module.h
479
480         * WebCore.xcodeproj/project.pbxproj:
481         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: Added.
482         (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule):
483         (WebCore::LibWebRTCAudioModule::RegisterAudioCallback):
484         (WebCore::LibWebRTCAudioModule::OnMessage):
485         (WebCore::LibWebRTCAudioModule::StartPlayout):
486         (WebCore::LibWebRTCAudioModule::StopPlayout):
487         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
488         (WebCore::LibWebRTCAudioModule::PollFromSource):
489         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Added.
490         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp:
491         (WebCore::ThreadMessageData::ThreadMessageData):
492         (WebCore::initializePeerConnectionFactoryAndThreads):
493
494 2017-01-31  Jessie Berlin  <jberlin@webkit.org>
495
496         Build fix.
497
498         * editing/mac/EditorMac.mm:
499         (WebCore::Editor::pasteWithPasteboard):
500         (WebCore::Editor::takeFindStringFromSelection):
501         (WebCore::Editor::replaceNodeFromPasteboard):
502         * page/mac/EventHandlerMac.mm:
503         (WebCore::EventHandler::createDraggingDataTransfer):
504         * platform/mac/PasteboardMac.mm:
505         (WebCore::Pasteboard::createForCopyAndPaste):
506         (WebCore::Pasteboard::createForDragAndDrop):
507
508 2017-01-31  Eric Carlson  <eric.carlson@apple.com>
509
510         [Mac] Add an audio stream description class
511         https://bugs.webkit.org/show_bug.cgi?id=167639
512
513         Reviewed by Youenn Fablet.
514
515         No new tests, the new class is not used yet.
516
517         * WebCore.xcodeproj/project.pbxproj:
518         * platform/audio/AudioStreamDescription.h: Added.
519         (WebCore::AudioStreamDescription::isPCM):
520         * platform/audio/mac/CAAudioStreamDescription.cpp: Added.
521         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
522         (WebCore::CAAudioStreamDescription::platformDescription):
523         (WebCore::CAAudioStreamDescription::format):
524         (WebCore::toCAAudioStreamDescription):
525         (WebCore::CAAudioStreamDescription::operator==):
526         (WebCore::operator==):
527         * platform/audio/mac/CAAudioStreamDescription.h: Added.
528         (WebCore::operator!=):
529         (WebCore::CAAudioStreamDescription::bytesPerFrame):
530         (WebCore::CAAudioStreamDescription::bytesPerPacket):
531         (WebCore::CAAudioStreamDescription::formatFlags):
532         (WebCore::CAAudioStreamDescription::operator==):
533         (WebCore::CAAudioStreamDescription::operator!=):
534         (WebCore::CAAudioStreamDescription::streamDescription):
535
536 2017-01-31  Youenn Fablet  <youenn@apple.com>
537
538         RTCPeerConnection methods can take dictionaries as input
539         https://bugs.webkit.org/show_bug.cgi?id=167590
540
541         Reviewed by Alex Christensen.
542
543         Test: webrtc/rtcpeerconnection-error-messages.html
544
545         Made addIceCandidate/setRemoteDescription/setLocalDescription take either dictionaries or objects as parameter.
546         Spec only mandates this for addIceCandidate, but sites may be using the old version for setRemoteDescription and setLocalDescription.
547
548         Updated RTCPeerConnection methods error messages.
549
550         * Modules/mediastream/RTCPeerConnection.js:
551         (getLocalStreams):
552         (getStreamById):
553         (addStream):
554         (createOffer):
555         (createAnswer):
556         (setLocalDescription):
557         (setRemoteDescription):
558         (addIceCandidate):
559         (getStats):
560         * Modules/mediastream/RTCPeerConnectionInternals.js:
561
562 2017-01-31  Simon Fraser  <simon.fraser@apple.com>
563
564         REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works
565         https://bugs.webkit.org/show_bug.cgi?id=167630
566         rdar://problem/30091558
567
568         Reviewed by Zalan Bujtas.
569         
570         r209411 added special handling for scrolling inside position:fixed, but cut off all scrolling, breaking
571         overflow:scroll inside position:fixed. Fix by only handling the position:fixed case when we get to 
572         the root layer, which is where we scroll the document.
573
574         Test: fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html
575
576         * rendering/RenderLayer.cpp:
577         (WebCore::RenderLayer::getRectToExpose):
578
579 2017-01-31  Zan Dobersek  <zdobersek@igalia.com>
580
581         [EME] InitDataRegistry should use base64url encoding and decoding for keyids
582         https://bugs.webkit.org/show_bug.cgi?id=167592
583
584         Reviewed by Jer Noble.
585
586         In InitDataRegistry, WTF::base64URLEncode() and WTF::base64URLDecode() should
587         be used to encode and decode the 'keyids' initialization data format, as
588         required by the relevant specification.
589         https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html#format
590
591         Relevant test case was added to media/encrypted-media/mock-MediaKeySession-generateRequest.html.
592
593         * Modules/encryptedmedia/InitDataRegistry.cpp:
594         (WebCore::extractKeyIDsKeyids):
595         (WebCore::sanitizeKeyids):
596
597 2017-01-31  Joseph Pecoraro  <pecoraro@apple.com>
598
599         Performance Timeline: Add serializer to PerformanceEntry
600         https://bugs.webkit.org/show_bug.cgi?id=167632
601
602         Reviewed by Ryosuke Niwa.
603
604         Test: performance-api/performance-timeline-serializers.html
605
606         * page/PerformanceEntry.idl:
607
608 2017-01-31  Chris Fleizach  <cfleizach@apple.com>
609
610         AX: enable search predication for iOS
611         https://bugs.webkit.org/show_bug.cgi?id=167558
612         <rdar://problem/30251367>
613
614         Reviewed by Joanmarie Diggs.
615
616         Move the code to support accessibility searching into a shared place so it can be used by iOS.
617
618         Test: accessibility/ios-simulator/ios-search-predicate.html
619
620         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
621         (-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
622         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
623         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
624         (convertToNSArray):
625         (createAccessibilitySearchKeyMap):
626         (accessibilitySearchKeyForString):
627         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
628         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
629         (createAccessibilitySearchKeyMap): Deleted.
630         (accessibilitySearchKeyForString): Deleted.
631         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute): Deleted.
632         (convertToNSArray): Deleted.
633
634 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
635
636         [WebIDL] Add support for inherit serializer attribute
637         https://bugs.webkit.org/show_bug.cgi?id=167274
638
639         Reviewed by Darin Adler.
640
641         Support for serializer { inherit }, which will be used by Resource Timing.
642         https://heycam.github.io/webidl/#idl-serializers
643
644         * bindings/scripts/CodeGenerator.pm:
645         (GetInterfaceForAttribute):
646         (IsSerializableAttribute):
647         Determine if an attribute is serializable at generation time so we can
648         verify types. This allows us to support typedefs. We don't yet support
649         serializing an attribute that is itself a serializable interface.
650
651         * bindings/scripts/CodeGeneratorJS.pm:
652         (GenerateSerializerFunction):
653         (GenerateSerializerAttributesForInterface):
654         Generate inherited attributes first, then generate our own list.
655         Explicitly provided attribute names are expected to be serializable,
656         so produce an error if they are not.
657
658         * bindings/scripts/IDLParser.pm:
659         (parseSerializationAttributes):
660         Update parsing of serializer attributes to allow for multiple
661         special strings. The spec does not precisely define where the
662         special "attribute" keyword is allowed.
663
664         (applyMemberList):
665         (isSerializableAttribute): Deleted.
666         Move serializable attribute checking to generation.
667
668         * bindings/scripts/test/JS/JSTestSerialization.cpp:
669         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: Added.
670         * bindings/scripts/test/JS/JSTestSerializationInherit.h: Added.
671         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: Added.
672         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h: Added.
673         The toJSON implementations are the most interesting.
674
675         * bindings/scripts/test/TestSerialization.idl:
676         Extend this test for typedefed attributes that are serializable.
677         Change TestNode (a serializable Interface) to TestException (an
678         unserializable Interface) for expected behavior of an
679         unserializable attribute.
680
681         * bindings/scripts/test/TestSerializationInherit.idl:
682         Test for { inherit, attribute }.
683
684         * bindings/scripts/test/TestSerializationInheritFinal.idl:
685         Test for { inherit, attribute_names... }, and multi-level inherit.
686
687 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
688
689         Implement PerformanceObserver
690         https://bugs.webkit.org/show_bug.cgi?id=167546
691         <rdar://problem/30247959>
692
693         Reviewed by Ryosuke Niwa.
694
695         This implements PerformanceObserver from Performance Timeline Level 2:
696         https://w3c.github.io/performance-timeline/
697
698         Tests: performance-api/performance-observer-api.html
699                performance-api/performance-observer-basic.html
700                performance-api/performance-observer-callback-mutate.html
701                performance-api/performance-observer-callback-task.html
702                performance-api/performance-observer-entry-sort.html
703                performance-api/performance-observer-exception.html
704                performance-api/performance-observer-nested.html
705                performance-api/performance-observer-order.html
706                performance-api/performance-observer-periodic.html
707                performance-api/performance-timeline-api.html
708
709         * CMakeLists.txt:
710         * DerivedSources.make:
711         * WebCore.xcodeproj/project.pbxproj:
712         New files.
713
714         * page/Performance.h:
715         * page/Performance.cpp:
716         (WebCore::Performance::mark):
717         (WebCore::Performance::measure):
718         (WebCore::Performance::registerPerformanceObserver):
719         (WebCore::Performance::unregisterPerformanceObserver):
720         (WebCore::Performance::queueEntry):
721         Register PerformanceObservers with the Performance object.
722         When new PerformanceEntries are created (Mark and Measure
723         right now) check them against observers.
724
725         * page/PerformanceEntry.cpp:
726         (WebCore::PerformanceEntry::PerformanceEntry):
727         (WebCore::PerformanceEntry::typeForEntryTypeString):
728         * page/PerformanceEntry.h:
729         (WebCore::PerformanceEntry::type):
730         Give PerformanceEntry a convenience enum for easy comparison
731         and to know if it is one of the built-in known types (which the
732         PerformanceObserver API takes into account).
733
734         * page/PerformanceObserver.cpp: Added.
735         (WebCore::PerformanceObserver::PerformanceObserver):
736         (WebCore::PerformanceObserver::observe):
737         (WebCore::PerformanceObserver::disconnect):
738         (WebCore::PerformanceObserver::queueEntry):
739         (WebCore::PerformanceObserver::deliver):
740         * page/PerformanceObserver.h:
741         (WebCore::PerformanceObserver::create):
742         (WebCore::PerformanceObserver::typeFilter):
743         - TypeErrors on observe bad behavior
744         - Completely replace types filter on observe
745         - Handle register and unregister
746         - Handle calling the callback
747
748         * page/PerformanceObserverCallback.idl: Added.
749         * page/PerformanceObserverEntryList.cpp: Added.
750         (WebCore::PerformanceObserverEntryList::PerformanceObserverEntryList):
751         (WebCore::PerformanceObserverEntryList::getEntries):
752         (WebCore::PerformanceObserverEntryList::getEntriesByType):
753         (WebCore::PerformanceObserverEntryList::getEntriesByName):
754         * page/PerformanceObserverEntryList.h:
755         (WebCore::PerformanceObserverEntryList::create):
756         * page/PerformanceObserverEntryList.idl: Added.
757         Implement sorting and filtering of entries.
758
759         * page/PerformanceObserver.idl: Added.
760         * page/PerformanceObserverCallback.h:
761         (WebCore::PerformanceObserverCallback::~PerformanceObserverCallback):
762         Mostly autogenerated.
763
764         * page/PerformanceUserTiming.cpp:
765         (WebCore::UserTiming::mark):
766         (WebCore::UserTiming::measure):
767         * page/PerformanceUserTiming.h:
768         Update these to return the entry so it can be passed on to
769         any interested PerformanceObservers.
770
771 2017-01-30  Youenn Fablet  <youenn@apple.com>
772
773         [WebRTC] getStats does not support legacy callback
774         https://bugs.webkit.org/show_bug.cgi?id=167617
775
776         Reviewed by Alex Christensen.
777
778         Covered by updated tests.
779
780         * Modules/mediastream/RTCPeerConnection.cpp:
781         (WebCore::RTCPeerConnection::getStats):
782         (WebCore::RTCPeerConnection::privateGetStats): Deleted.
783         * Modules/mediastream/RTCPeerConnection.h:
784         * Modules/mediastream/RTCPeerConnection.idl:
785         * Modules/mediastream/RTCPeerConnection.js:
786         (addIceCandidate):
787         (getStats): Deleted.
788
789 2017-01-30  Sam Weinig  <sam@webkit.org>
790
791         JSDOMBinding is too big. Split it up!
792         https://bugs.webkit.org/show_bug.cgi?id=167601
793
794         Reviewed by Darin Adler.
795
796         Splits JSDOMBinding.h/cpp up a bit by splitting out:
797         - JSDOMBindingCaller.h
798         - JSDOMBindingSecurity.h/cpp
799         - JSDOMExceptionHandling.h/cpp
800         - JSDOMWrapperCache.h/cpp
801
802         Also:
803         - Moves all constructor objects to JSDOMConstructor.h/cpp,  
804         - Moves special DOMWindow accessors to JSDOMWindowBase.
805         - Deletes unused CallbackFunction.h/cpp
806
807         * CMakeLists.txt:
808         * Modules/webdatabase/Database.cpp:
809         * WebCore.xcodeproj/project.pbxproj:
810         * bindings/js/CallbackFunction.cpp: Removed.
811         * bindings/js/CallbackFunction.h: Removed.
812         * bindings/js/DOMConstructorWithDocument.h: Removed.
813         * bindings/js/JSCryptoCustom.cpp:
814         * bindings/js/JSCustomXPathNSResolver.cpp:
815         * bindings/js/JSDOMBinding.cpp:
816         * bindings/js/JSDOMBinding.h:
817         * bindings/js/JSDOMBindingCaller.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
818         * bindings/js/JSDOMBindingSecurity.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
819         * bindings/js/JSDOMBindingSecurity.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
820         * bindings/js/JSDOMConstructor.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
821         * bindings/js/JSDOMConstructor.h:
822         * bindings/js/JSDOMConvert.h:
823         * bindings/js/JSDOMExceptionHandling.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
824         * bindings/js/JSDOMExceptionHandling.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
825         * bindings/js/JSDOMWindowBase.cpp:
826         (WebCore::callerDOMWindow): Moved from JSDOMBinding.h
827         (WebCore::activeDOMWindow): Moved from JSDOMBinding.h
828         (WebCore::firstDOMWindow): Moved from JSDOMBinding.h
829         * bindings/js/JSDOMWindowBase.h:
830         * bindings/js/JSDOMWindowCustom.cpp:
831         * bindings/js/JSDOMWindowProperties.cpp:
832         * bindings/js/JSDOMWrapperCache.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
833         * bindings/js/JSDOMWrapperCache.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
834         * bindings/js/JSEventTargetCustom.h:
835         * bindings/js/JSHTMLElementCustom.cpp:
836         * bindings/js/JSLocationCustom.cpp:
837         * bindings/js/JSMutationObserverCustom.cpp:
838         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
839         * bindings/js/JSStorageCustom.cpp:
840         * bindings/js/JSWorkerCustom.cpp:
841         * bindings/js/JSXPathNSResolverCustom.cpp:
842         * bindings/js/ScheduledAction.cpp:
843         * bindings/js/ScriptController.cpp:
844         * bindings/js/ScriptController.h:
845         * bindings/js/ScriptGlobalObject.cpp:
846         (WebCore::ScriptGlobalObject::set):
847         * bindings/js/StructuredClone.cpp:
848         * bindings/scripts/CodeGeneratorJS.pm:
849         (GenerateImplementation):
850         (GenerateCallWith):
851         (GenerateParametersCheck):
852         (GenerateCallbackImplementationContent):
853         (NativeToJSValue):
854         * bridge/objc/WebScriptObject.mm:
855         * html/HTMLFrameElementBase.cpp:
856         * html/HTMLVideoElement.cpp:
857         * inspector/InspectorController.cpp:
858         * inspector/InspectorDOMAgent.cpp:
859         * inspector/PageScriptDebugServer.cpp:
860         * inspector/WorkerScriptDebugServer.cpp:
861
862 2017-01-30  Andy Estes  <aestes@apple.com>
863
864         [QuickLook] FrameLoaderClient should return the new QuickLookHandleClient it creates
865         https://bugs.webkit.org/show_bug.cgi?id=167625
866
867         Reviewed by Andreas Kling.
868
869         QuickLookHandleClients were being created by QuickLookHandle calling
870         FrameLoaderClient::didCreateQuickLookHandle() then having the FrameLoaderClient create a new
871         QuickLookHandleClient and set it using QuickLookHandle::setClient().
872
873         Since all FrameLoaderClient::didCreateQuickLookHandle() does is create a new
874         QuickLookHandleClient, this patch changes the FrameLoaderClient function to return the new
875         QuickLookHandleClient directly and removes the API from QuickLookHandle to set a client.
876         This also removes previewFileName() and previewUTI() from QuickLookHandle and instead passes
877         these as arguments to the FrameLoaderClient.
878
879         No change in behavior. Covered by existing tests.
880
881         * loader/EmptyClients.cpp: Added an implementation of createQuickLookHandleClient() that
882         returns nullptr.
883         * loader/FrameLoaderClient.h: Declared createQuickLookHandleClient() and removed
884         didCreateQuickLookHandle().
885         * loader/ios/QuickLook.h: Removed setClient(), previewFileName(), and previewUTI().
886         * loader/ios/QuickLook.mm: Removed testingOrEmptyClient().
887         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Set _client
888         to testingClient() if it exists, otherwise set it to the client returned by
889         FrameLoaderClient::createQuickLookHandleClient() it non-null, otherwise set it to
890         emptyClient().
891         (testingOrEmptyClient): Deleted.
892         (-[WebPreviewLoader setClient:]): Deleted.
893         (-[WebPreviewLoader converter]): Deleted.
894         (WebCore::QuickLookHandle::setClient): Deleted.
895         (WebCore::QuickLookHandle::previewFileName): Deleted.
896         (WebCore::QuickLookHandle::previewUTI): Deleted.
897
898 2017-01-30  Jer Noble  <jer.noble@apple.com>
899
900         NULL-deref crash in TextTrack::removeCue()
901         https://bugs.webkit.org/show_bug.cgi?id=167615
902
903         Reviewed by Eric Carlson.
904
905         It's possible for a track to be removed which was never actually added to the cue list.
906         Specifically, if an in-band track with a negative start or end time was parsed, it would
907         have been rejected by TextTrack::addCue(). When it comes time to flush those in-band cues,
908         TextTrack::m_cues will still be NULL. Rather than ASSERT in this case, we should revert the
909         behavior added in r210319 and throw an exception.
910
911         * html/track/TextTrack.cpp:
912         (WebCore::TextTrack::removeCue):
913
914 2017-01-30  Andreas Kling  <akling@apple.com>
915
916         Fix CMSampleBuffer leak in MediaSampleAVFObjC::createNonDisplayingCopy().
917         <https://webkit.org/b/167621>
918
919         Reviewed by Andy Estes.
920
921         We were failing to adopt the CMSampleBuffer after copying it. Seen on leaks bot.
922
923         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
924         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy):
925
926 2017-01-30  Andy Estes  <aestes@apple.com>
927
928         [QuickLook] QLPreviewConverter and QuickLookHandle have different lifetime requirements
929         https://bugs.webkit.org/show_bug.cgi?id=167609
930
931         Reviewed by Andreas Kling.
932         
933         Currently, QuickLookHandles are owned by DocumentLoader so that the underlying
934         QLPreviewConverter stays alive to service subresource requests. However, the QuickLookHandle
935         itself only needs to live long enough to handle the main resource load. And in a follow-on
936         patch we will need to create QLPreviewConverters independent of QuickLookHandle.
937
938         This patch moves ownership of QuickLookHandle from DocumentLoader to ResourceLoader. It also
939         creates a C++ wrapper around QLPreviewConverter and teaches QuickLookHandle to transfer
940         ownership of the wrapper to DocumentLoader once the main resource conversion is complete.
941
942         No change in behavior. Covered by existing tests.
943
944         * WebCore.xcodeproj/project.pbxproj: Added PreviewConverter.{h,mm}.
945         * loader/DocumentLoader.cpp:
946         (WebCore::DocumentLoader::setPreviewConverter): Renamed from setQuickLookHandle().
947         (WebCore::DocumentLoader::previewConverter): Renamed from quickLookHandle().
948         (WebCore::DocumentLoader::setQuickLookHandle): Renamed to setPreviewConverter().
949         * loader/DocumentLoader.h:
950         (WebCore::DocumentLoader::quickLookHandle): Renamed to quickLookHandle().
951         * loader/ResourceLoader.cpp:
952         (WebCore::ResourceLoader::willSendRequestInternal): Changed to call PreviewConverter::safeRequest().
953         (WebCore::ResourceLoader::isQuickLookResource): Changed to check if m_quickLookHandle is null.
954         (WebCore::ResourceLoader::didCreateQuickLookHandle): Deleted.
955         * loader/ResourceLoader.h:
956         * loader/SubresourceLoader.cpp:
957         (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Changed to access m_quickLookHandle.
958         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
959         (WebCore::SubresourceLoader::didReceiveData): Ditto.
960         (WebCore::SubresourceLoader::didReceiveBuffer): Ditto.
961         (WebCore::SubresourceLoader::didFinishLoading): Ditto.
962         (WebCore::SubresourceLoader::didFail): Ditto.
963         * loader/cache/CachedRawResource.cpp:
964         (WebCore::CachedRawResource::finishLoading): Wrapped the call to ResourceLoader::isQuickLookResource() in USE(QUICK_LOOK).
965         * loader/ios/QuickLook.h: Renamed m_converter to m_previewLoader.
966         * loader/ios/QuickLook.mm: Renamed WebPreviewConverter to WebPreviewLoader.
967         (WebCore::registerQLPreviewConverterIfNeeded): Created a PreviewConverter instead of a QLPreviewConverter.
968         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Ditto.
969         (-[WebPreviewLoader appendDataArray:]): Accessed the QLPreviewConverter from the PreviewConverter.
970         (-[WebPreviewLoader finishedAppending]): Ditto.
971         (-[WebPreviewLoader failed]): Ditto.
972         (-[WebPreviewLoader converter]): Renamed from platformConverter. Returns a pointer to the PreviewConverter.
973         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Moved _converter to DocumentLoader.
974         (-[WebPreviewLoader connection:didFailWithError:]): Created a PreviewConverter instead of a QLPreviewConverter.
975         (WebCore::QuickLookHandle::QuickLookHandle): Called FrameLoaderClient::didCreateQuickLookHandle() instead of going through FrameLoader.
976         (WebCore::QuickLookHandle::didReceiveData): Renamed m_converter to m_previewLoader.
977         (WebCore::QuickLookHandle::didReceiveBuffer): Ditto.
978         (WebCore::QuickLookHandle::didFinishLoading): Ditto.
979         (WebCore::QuickLookHandle::didFail): Ditto.
980         (WebCore::QuickLookHandle::setClient): Ditto.
981         (WebCore::QuickLookHandle::previewFileName): Ditto.
982         (WebCore::QuickLookHandle::previewUTI): Ditto.
983         (WebCore::QuickLookHandle::willSendRequest): Deleted.
984         * platform/ios/QuickLookSoftLink.h: Removed soft-linking of QLPreviewConverter and kQLPreviewOptionPasswordKey.
985         * platform/ios/QuickLookSoftLink.mm: Ditto.
986         * platform/network/ios/PreviewConverter.h: Added.
987         (WebCore::PreviewConverter::platformConverter): Added. Returns the underlying QLPreviewConverter.
988         * platform/network/ios/PreviewConverter.mm: Added.
989         (WebCore::optionsWithPassword): Creates a dictionary with the kQLPreviewOptionPasswordKey option set if password is non-null.
990         (WebCore::PreviewConverter::PreviewConverter): Added constructors for the delegate/response and data/uti cases.
991         (WebCore::PreviewConverter::safeRequest): Wraps -[QLPreviewConverter safeRequestForRequest:].
992         (WebCore::PreviewConverter::previewRequest): Wraps -[QLPreviewConverter previewRequest].
993         (WebCore::PreviewConverter::previewResponse): Wraps -[QLPreviewConverter previewResponse].
994         (WebCore::PreviewConverter::previewFileName): Wraps -[QLPreviewConverter previewFileName].
995         (WebCore::PreviewConverter::previewUTI): Wraps -[QLPreviewConverter previewUTI].
996
997 2017-01-30  Chris Dumez  <cdumez@apple.com>
998
999         Drop legacy Attributes.isId attribute
1000         https://bugs.webkit.org/show_bug.cgi?id=167603
1001
1002         Reviewed by Ryosuke Niwa.
1003
1004         Drop legacy Attributes.isId attribute.
1005
1006         This attribute is not in the specification:
1007         - https://dom.spec.whatwg.org/#interface-attr
1008
1009         Both Firefox and Chrome currently do not expose this attribute.
1010
1011         No new tests, rebaselined existing test.
1012
1013         * dom/Attr.cpp:
1014         * dom/Attr.h:
1015         * dom/Attr.idl:
1016
1017 2017-01-30  Zalan Bujtas  <zalan@apple.com>
1018
1019         Simple line layout: Small tweaks to improve performance.
1020         https://bugs.webkit.org/show_bug.cgi?id=167611
1021         <rdar://problem/30274294>
1022
1023         Reviewed by Simon Fraser.
1024
1025         This is ~10% progression on the attached test case (paragraphs with non-redundant content).
1026         median: 102.08 runs/s -> median: 114.25 runs/s
1027
1028         * rendering/SimpleLineLayout.cpp:
1029         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
1030         * rendering/SimpleLineLayoutFlowContents.cpp:
1031         (WebCore::SimpleLineLayout::initializeSegments):
1032         (WebCore::SimpleLineLayout::FlowContents::FlowContents):
1033         * rendering/SimpleLineLayoutFlowContents.h:
1034         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1035         (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition):
1036         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
1037         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1038
1039 2017-01-30  Chris Dumez  <cdumez@apple.com>
1040
1041         Drop legacy constants on Event interface
1042         https://bugs.webkit.org/show_bug.cgi?id=167602
1043
1044         Reviewed by Sam Weinig.
1045
1046         Drop legacy constants on Event interface:
1047         MOUSEDOWN, MOUSEUP, MOUSEOVER, MOUSEOUT, MOUSEMOVE, MOUSEDRAG,
1048         CLICK, DBLCLICK, KEYDOWN, KEYUP, KEYPRESS, DRAGDROP, FOCUS,
1049         BLUR, SELECT, and CHANGE.
1050
1051         Those constants are not used for anything, they are not in the
1052         specification and Chrome / Firefox do not have them.
1053
1054         No new tests, rebaselined existing test.
1055
1056         * dom/Event.idl:
1057
1058 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1059
1060         [iOS] position:fixed inside touch-scrollable overflow is mispositioned
1061         https://bugs.webkit.org/show_bug.cgi?id=167604
1062         rdar://problem/29500273
1063
1064         Reviewed by Zalan Bujtas.
1065         
1066         For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs
1067         to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with
1068         box-shadow, for example.
1069         
1070         Also make the compositing log output a little easier to read.
1071
1072         Test: compositing/scrolling/fixed-inside-scroll.html
1073
1074         * rendering/RenderLayerBacking.cpp:
1075         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
1076         * rendering/RenderLayerCompositor.cpp:
1077         (WebCore::RenderLayerCompositor::logLayerInfo):
1078
1079 2017-01-30  Jer Noble  <jer.noble@apple.com>
1080
1081         NULL-deref crash at PlatformMediaSession::endInterruption
1082         https://bugs.webkit.org/show_bug.cgi?id=167595
1083
1084         Reviewed by Eric Carlson.
1085
1086         Use the same, NULL-aware forEachSession() iterator rather than iterating over m_sessions directly.
1087
1088         * platform/audio/PlatformMediaSessionManager.cpp:
1089         (WebCore::PlatformMediaSessionManager::beginInterruption):
1090         (WebCore::PlatformMediaSessionManager::endInterruption):
1091
1092 2017-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
1093
1094         Correct spacing regression on inter-element complex path shaping on some fonts
1095         https://bugs.webkit.org/show_bug.cgi?id=166013
1096
1097         Reviewed by Simon Fraser.
1098
1099         This patch brings the implementation of ComplexTextController in-line with the
1100         design at https://trac.webkit.org/wiki/ComplexTextController. Previously,
1101         ComplexTextController had a few problems:
1102         - The total width computed by ComplexTextController didn't match the width if
1103         you iterated over the entire string and added up the advances
1104         - FontCascade::getGlyphsAndAdvancesForComplexText() tried to compensate for
1105         the above by construing the concepts of paint advances as distinct from layout
1106         advances
1107         - Initial advances were considered part of layout sometimes and part of painting
1108         other times, depending on which function reports the information
1109         - For RTL runs, the wrong origin was added to the initial advance, and the origin
1110         should have been subtracted instead of added
1111
1112         This patch exhaustively updates every function in ComplexTextController to be
1113         consistent with the design linked to above. This design solves all of these
1114         problems.
1115
1116         Tests: ComplexTextControllerTest.InitialAdvanceWithLeftRunInRTL
1117                ComplexTextControllerTest.InitialAdvanceInRTL
1118                ComplexTextControllerTest.InitialAdvanceWithLeftRunInLTR
1119                ComplexTextControllerTest.InitialAdvanceInLTR
1120                ComplexTextControllerTest.InitialAdvanceInRTLNoOrigins
1121                ComplexTextControllerTest.LeadingExpansion
1122                ComplexTextControllerTest.VerticalAdvances
1123
1124         * platform/graphics/GlyphBuffer.h:
1125         (WebCore::GlyphBuffer::setLeadingExpansion): Deleted. No longer necessary.
1126         (WebCore::GlyphBuffer::leadingExpansion): Deleted. Ditto.
1127         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1128         (WebCore::FontCascade::adjustSelectionRectForComplexText): Removed use of
1129         unnecessary leadingExpansion().
1130         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText): This function needs
1131         to compute paint advances, which means that it can't base this information off
1132         of layout advances. This function uses the trick mentioned at the end of the
1133         above link to compute the paint offset of an arbitrary glyph in the middle of
1134         an RTL run.
1135         * platform/graphics/mac/ComplexTextController.cpp:
1136         (WebCore::ComplexTextController::computeExpansionOpportunity): Refactored for
1137         testing.
1138         (WebCore::ComplexTextController::ComplexTextController): Ditto.
1139         (WebCore::ComplexTextController::finishConstruction): Ditto.
1140         (WebCore::ComplexTextController::offsetForPosition): This function operates on
1141         layout advances, and the initial layout advance is already added into the
1142         m_adjustedBaseAdvances vector by adjustGlyphsAndAdvances(). Therefore, there is
1143         no need to add it again here.
1144         (WebCore::ComplexTextController::advance): This function had completely busted
1145         logic about the relationship between initial advances and the first origin in
1146         each run. Because of the fortunate choice of only representing layout advances 
1147         in m_adjustedBaseAdvances, this entire block can be removed and the raw paint
1148         initial advance can be reported to the GlyphBuffer. Later in the function, we
1149         have to update the logic about how to compute a paint advance given a layout
1150         advance and some origins. In particular, there are two tricky pieces here: 1.
1151         The layout advance for the first glyph is equal to (initial advance - first
1152         origin + first Core Text advance, so computing the paint offset must cancel out
1153         the initial layout offset, and 2. the last paint advance in a run must actually
1154         end up at the position of the first glyph in the next run, so the next run's
1155         initial advance must be queried.
1156         (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Previously, we
1157         represented an initial advance of a successive run by just adding it to the
1158         previous run's last advance. However, this is incompatible with the new model
1159         presented in the link above, so we remove this section. We also have to add in
1160         the logic that the layout advance for the first glyph is equal to the formula
1161         presented above.
1162         * platform/graphics/mac/ComplexTextController.h:
1163         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance): Adjust comment
1164         to reflect reality.
1165         (WebCore::ComplexTextController::leadingExpansion): Deleted.
1166
1167 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1168
1169         Fixed elements should not rubber-band in WK2, nor remain at negative offsets
1170         https://bugs.webkit.org/show_bug.cgi?id=167484
1171         rdar://problem/29453068
1172
1173         Reviewed by Dean Jackson.
1174
1175         There were various problems with the layout rect computation:
1176         1. It ignored the scrollBehaviorForFixedElements() which we use to avoid rubber-banding fixed
1177            elements in WK2, but allow in WK1, so make use of that.
1178         2. Sometimes layouts/paints of fixed elements would be triggered when coalesced calls to
1179            AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll() failed to
1180            copy the layoutViewportOrigin to the scheduled update.
1181         3. The layout viewport could be left with a negative top/left after rubber-banding.
1182         
1183         Also add a way to do unconstrained scrollTo(), so that a test can call window.scrollTo(-10, -10) to
1184         simulate rubberbanding.
1185
1186         Tests: fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html
1187                fast/visual-viewport/rubberbanding-viewport-rects.html
1188
1189         * page/FrameView.cpp:
1190         (WebCore::FrameView::computeLayoutViewportOrigin): Handle ScrollBehaviorForFixedElements, incorporating it
1191         into logic that clamps layoutViewportOrigin between min/max when rubberbanding is not allowed, or not in progress.
1192         (WebCore::FrameView::updateLayoutViewport): Pass in scrollBehaviorForFixedElements().
1193         (WebCore::FrameView::visibleDocumentRect): The clamping here was preventing the visible rect from
1194         escaping the document bounds, which caused fixed elements to bounce with rubber-banding, so remove the clamping,
1195         and fix the logic to allow rubber-banding while taking headers and footers into account.
1196         * page/FrameView.h:
1197         * page/scrolling/AsyncScrollingCoordinator.cpp:
1198         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): layoutViewportOrigin has to
1199         be pushed onto the scheduled update, just like scroll position.
1200         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1201         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): Pass in m_behaviorForFixed.
1202         * platform/ScrollView.cpp:
1203         (WebCore::ScrollView::ScrollView):
1204         (WebCore::ScrollView::adjustScrollPositionWithinRange):
1205         (WebCore::ScrollView::setScrollOffset):
1206         * platform/ScrollView.h:
1207         (WebCore::ScrollView::setAllowsUnclampedScrollPositionForTesting):
1208         (WebCore::ScrollView::allowsUnclampedScrollPosition):
1209         * testing/InternalSettings.cpp:
1210         (WebCore::InternalSettings::setAllowUnclampedScrollPosition):
1211         * testing/InternalSettings.h:
1212         * testing/InternalSettings.idl:
1213
1214 2017-01-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1215
1216         Web content process crashes when initiating a drag on a very large image
1217         https://bugs.webkit.org/show_bug.cgi?id=167564
1218
1219         Reviewed by Beth Dakin.
1220
1221         If we begin dragging an image element that is too large to show the cached image for, we will show an image file
1222         icon instead of the cached image. This may return null if createDragImageIconForCachedImageFilename is
1223         unimplemented, so in the meantime, we should not assume that dragImage will always exist before calling into
1224         doSystemDrag in doImageDrag and bail from the drag operation if that is the case.
1225
1226         * page/DragController.cpp:
1227         (WebCore::DragController::doImageDrag):
1228
1229 2017-01-30  Chris Dumez  <cdumez@apple.com>
1230
1231         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
1232         https://bugs.webkit.org/show_bug.cgi?id=167536
1233
1234         Reviewed by Darin Adler.
1235
1236         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
1237         instead of a string. The value needs to be numeric and the current API is error-prone.
1238
1239         * html/HTMLMediaElement.cpp:
1240         (WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad):
1241         * loader/EmptyClients.cpp:
1242         * page/DiagnosticLoggingClient.h:
1243
1244 2017-01-30  Ryan Haddad  <ryanhaddad@apple.com>
1245
1246         Unreviewed, rollout r211235 Pointer lock events should be delivered directly to the target element.
1247
1248         The LayoutTest for this change is frequently failing.
1249
1250         * page/EventHandler.cpp:
1251         (WebCore::EventHandler::handleMousePressEvent):
1252         (WebCore::EventHandler::handleMouseDoubleClickEvent):
1253         (WebCore::EventHandler::handleMouseMoveEvent):
1254         (WebCore::EventHandler::handleMouseReleaseEvent):
1255         (WebCore::EventHandler::handleMouseForceEvent):
1256         (WebCore::EventHandler::handleWheelEvent):
1257         * page/PointerLockController.cpp:
1258         (WebCore::PointerLockController::isLocked): Deleted.
1259         (WebCore::PointerLockController::dispatchLockedWheelEvent): Deleted.
1260         * page/PointerLockController.h:
1261
1262 2017-01-30  Antoine Quint  <graouts@apple.com>
1263
1264         LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html is flaky
1265         https://bugs.webkit.org/show_bug.cgi?id=167254
1266         <rdar://problem/30259293>
1267
1268         Reviewed by Dean Jackson.
1269
1270         When we would identify that we need to prolong an existing auto-hide timer, when the previous
1271         auto-hide timer was marked as non-cancelable, calling _cancelAutoHideTimer() would not actually
1272         cancel the previous timer, which would let it fire and hide the controls bar. We now have two
1273         methods, _cancelAutoHideTimer() which always cancels the current auto-hide timer, and
1274         _cancelNonEnforcedAutoHideTimer() which is used from all other existing call sites, which only
1275         cancels the current auto-hide timer if it was marked as cancelable. This, and revised timing in
1276         the test itself, make media/modern-media-controls/media-controller/media-controller-auto-hide-
1277         mouse-leave-after-play.html a lot more reliable.
1278
1279         We also make a small drive-by fix where we ensure the "autoHideDelay" property is set first so
1280         that setting other members which may set a timer do not used an undefined value for the auto-hide
1281         timer delay.
1282
1283         * Modules/modern-media-controls/controls/controls-bar.js:
1284         (ControlsBar.prototype.set visible):
1285         (ControlsBar.prototype.handleEvent):
1286         (ControlsBar.prototype._cancelNonEnforcedAutoHideTimer):
1287         (ControlsBar.prototype._cancelAutoHideTimer):
1288
1289 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1290
1291         REGRESSION(r202615?): [GStreamer] ASSERTION FAILED: isMainThread() in WebCore::BuiltinResourceHandleConstructorMap& WebCore::builtinResourceHandleConstructorMap()
1292         https://bugs.webkit.org/show_bug.cgi?id=167003
1293
1294         Reviewed by Michael Catanzaro.
1295
1296         Add a way to create a ResourceHandle for a given SoupNetworkSession and use it in the GStreamer streaming client
1297         to ensure both the session and the handle are created and destroyed in the secondary thread. This way we also
1298         avoid using the default session for downloading HLS fragments.
1299
1300         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1301         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Create a SoupNetworkSession and pass it to ResourceHandle::create().
1302         * platform/network/ResourceHandle.h: Add create and constructor to receive a SoupNetworkSession.
1303         * platform/network/ResourceHandleInternal.h: Add SoupNetworkSession member.
1304         * platform/network/soup/ResourceHandleSoup.cpp:
1305         (WebCore::ResourceHandleInternal::soupSession): Return the SoupNetworkSession if not nullptr.
1306         (WebCore::ResourceHandle::create): Create a ResourceHandle without trying to use any builtin constructor and
1307         using the given SoupNetworkSession.
1308         (WebCore::ResourceHandle::ResourceHandle): Set the SoupNetworkSession if early request validations didn't fail.
1309
1310 2017-01-30  Youenn Fablet  <youennf@gmail.com>
1311
1312         [WebRTC] Add support for libwebrtc data channel
1313         https://bugs.webkit.org/show_bug.cgi?id=167489
1314
1315         Reviewed by Alex Christensen.
1316
1317         Partially covered by webrtc/datachannel/basic.html but not yet enabled on bots.
1318
1319         Introducing LibWebRTCDataChannelHandler as the integration layer between WebCore (RTCDataChannel)
1320         and libwebrtc (DataChannelObserver).
1321
1322         * Modules/mediastream/RTCDataChannel.cpp:
1323         (WebCore::RTCDataChannel::create):
1324         (WebCore::RTCDataChannel::RTCDataChannel):
1325         (WebCore::RTCDataChannel::bufferedAmount):
1326         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
1327         * Modules/mediastream/RTCDataChannel.h:
1328         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: Added.
1329         (WebCore::LibWebRTCDataChannelHandler::~LibWebRTCDataChannelHandler):
1330         (WebCore::LibWebRTCDataChannelHandler::setClient):
1331         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
1332         (WebCore::LibWebRTCDataChannelHandler::sendRawData):
1333         (WebCore::LibWebRTCDataChannelHandler::close):
1334         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
1335         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
1336         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1337         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1338         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
1339         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
1340         (): Deleted.
1341         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1342         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
1343         * dom/EventNames.h:
1344         * platform/mediastream/RTCDataChannelHandler.h:
1345         * platform/mediastream/RTCDataChannelHandlerClient.h:
1346         * platform/mock/RTCDataChannelHandlerMock.h:
1347
1348 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1349
1350         Several web timing tests crash in GTK+ and AppleWin bots
1351         https://bugs.webkit.org/show_bug.cgi?id=167577
1352
1353         Reviewed by Ryosuke Niwa.
1354
1355         The problem is that entry is used in both the key, to get name, and in the value with WTFMove. So, the name is
1356         invalidated by the move. It could be fixed by simply copying the name, instead of using entry->name, but I think
1357         that code could be simplified using HashMap::ensure and then we don't need any string copy, nor even the static
1358         insertPerformanceEntry().
1359
1360         Fix crashes in several imported/w3c/web-platform-tests/user-timing/ tests.
1361
1362         * page/PerformanceUserTiming.cpp:
1363         (WebCore::UserTiming::mark):
1364         (WebCore::UserTiming::measure):
1365         (WebCore::insertPerformanceEntry): Deleted.
1366
1367 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1368
1369         [Threaded Compositor] Crash in GraphicsContext3D::deleteTexture when destroying TextureMapperPlatformLayerProxy
1370         https://bugs.webkit.org/show_bug.cgi?id=167575
1371
1372         Reviewed by Žan Doberšek.
1373
1374         We should clear all the buffers on invalidate to ensure we don't have textures alive after CoordinatedGraphicsScene::purgeGLResources().
1375
1376         Fix crash in media/video-poster-background.html.
1377
1378         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1379         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear current, pending and all used buffers.
1380
1381 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1382
1383         [Threaded Compositor] Crash on WebCore::GLContext::version()
1384         https://bugs.webkit.org/show_bug.cgi?id=167559
1385
1386         Reviewed by Michael Catanzaro.
1387
1388         Fixes crashes in several media tests.
1389
1390         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1391         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear m_compositorThreadUpdateTimer and call the update function.
1392
1393 2017-01-29  Nan Wang  <n_wang@apple.com>
1394
1395         AX: WKContentView needs to implement UITextInput methods to make speak selection highlighting work
1396         https://bugs.webkit.org/show_bug.cgi?id=166955
1397
1398         Reviewed by Ryosuke Niwa.
1399
1400         Created a new version of Range::collectSelectionRect() that returns rects for each
1401         line, so that Speak Selection doesn't need to handle searching for soft line breaks.
1402         Also added a variant of findPlainText to search for the closest matched range to the given position.
1403
1404         Test: editing/text-iterator/range-of-string-closest-to-position.html
1405
1406         * dom/Range.cpp:
1407         (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
1408         (WebCore::Range::collectSelectionRects):
1409         * dom/Range.h:
1410         * editing/TextIterator.cpp:
1411         (WebCore::findPlainTextMatches):
1412         (WebCore::updateSearchBuffer):
1413         (WebCore::findIteratorOptions):
1414         (WebCore::rangeMatches):
1415         (WebCore::findClosestPlainText):
1416         (WebCore::findPlainText):
1417         (WebCore::findPlainTextOffset): Deleted.
1418         * editing/TextIterator.h:
1419         * editing/htmlediting.h:
1420         * testing/Internals.cpp:
1421         (WebCore::Internals::rangeOfStringNearLocation):
1422         * testing/Internals.h:
1423         * testing/Internals.idl:
1424
1425 2017-01-29  Andy Estes  <aestes@apple.com>
1426
1427         [QuickLook] Add a WebPreference to enable saving QuickLook documents in WebKitLegacy
1428         https://bugs.webkit.org/show_bug.cgi?id=167563
1429         <rdar://problem/30253207>
1430
1431         Reviewed by Andreas Kling.
1432
1433         * loader/ios/QuickLook.h: Removed unused declarations.
1434         (WebCore::QuickLookHandle::firstRequestURL): Deleted.
1435         * loader/ios/QuickLook.mm:
1436         (WebCore::removeQLPreviewConverterForURL): Stopped deleting the temporary file here; that's
1437         now done in QuickLookDocumentWriter.
1438         (addQLPreviewConverterWithFileForURL): Changed from an exported function to a static
1439         function since it's now only called inside QuickLook.mm.
1440         (WebCore::QuickLookHandle::QuickLookHandle): Stopped initializing m_firstRequestURL.
1441         (WebCore::addQLPreviewConverterWithFileForURL): Deleted.
1442         (WebCore::qlPreviewConverterFileNameForURL): Deleted.
1443         (WebCore::qlPreviewConverterUTIForURL): Deleted.
1444         (WebCore::QuickLookHandle::previewRequestURL): Deleted.
1445         (WebCore::QuickLookHandle::converter): Deleted.
1446
1447 2017-01-29  Zalan Bujtas  <zalan@apple.com>
1448
1449         Simple line layout: PerformanceTests/Layout/simple-line-layout-innertext.html regressed at r211108
1450         https://bugs.webkit.org/show_bug.cgi?id=167562
1451
1452         Reviewed by Antti Koivisto.
1453
1454         Apparently RunResolver::Run::constructStringForHyphenIfNeeded() is in a superhot codepath.
1455         The Run should not have any additional members anyway, so let's construct the hyphenated
1456         string on demand.
1457         Progression on simple-line-layout-innertext.html is from ~34runs/sec back to ~50runs/sec.
1458
1459         Covered by existing text.
1460
1461         * rendering/RenderTreeAsText.cpp:
1462         (WebCore::writeSimpleLine):
1463         * rendering/SimpleLineLayoutFunctions.cpp:
1464         (WebCore::SimpleLineLayout::paintFlow):
1465         * rendering/SimpleLineLayoutResolver.cpp:
1466         (WebCore::SimpleLineLayout::RunResolver::Run::Run):
1467         (WebCore::SimpleLineLayout::RunResolver::Run::textWithHyphen):
1468         (WebCore::SimpleLineLayout::RunResolver::Run::text):
1469         (WebCore::SimpleLineLayout::RunResolver::Run::constructStringForHyphenIfNeeded): Deleted.
1470         * rendering/SimpleLineLayoutResolver.h:
1471
1472 2017-01-28  Tim Horton  <timothy_horton@apple.com>
1473
1474         Don't flash a tap highlight for the entirety of an editable WKWebView
1475         https://bugs.webkit.org/show_bug.cgi?id=167486
1476         <rdar://problem/30193996>
1477
1478         Reviewed by Dan Bernstein.
1479
1480         * dom/Document.h:
1481         Export.
1482
1483 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1484
1485         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
1486         https://bugs.webkit.org/show_bug.cgi?id=167555
1487
1488         Reviewed by Dan Bernstein.
1489
1490         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
1491         USE(APPLE_INTERNAL_SDK) instead.
1492
1493         * page/ios/EventHandlerIOS.mm:
1494         * platform/ios/DragImageIOS.mm:
1495         * platform/ios/PasteboardIOS.mm:
1496         * platform/mac/DragDataMac.mm:
1497
1498 2017-01-28  Yoav Weiss  <yoav@yoav.ws>
1499
1500         Add Link Preload as an off-by-default experimental feature menu item.
1501         https://bugs.webkit.org/show_bug.cgi?id=167201
1502
1503         Reviewed by Ryosuke Niwa.
1504
1505         Removed the explicit setting of the Link Preload experimental feature,
1506         as it is now on by default for testing.
1507
1508         No new tests as this just removes methods from settings.
1509
1510         * testing/InternalSettings.cpp:
1511         (WebCore::InternalSettings::Backup::Backup):
1512         (WebCore::InternalSettings::Backup::restoreTo):
1513         * testing/InternalSettings.h:
1514         * testing/InternalSettings.idl:
1515
1516 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
1517
1518         Fix typo in error message
1519         https://bugs.webkit.org/show_bug.cgi?id=167554
1520
1521         Reviewed by Sam Weinig.
1522
1523         * bindings/scripts/CodeGenerator.pm:
1524         (GetEnumByType):
1525
1526 2017-01-28  Antoine Quint  <graouts@apple.com>
1527
1528         [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
1529         https://bugs.webkit.org/show_bug.cgi?id=167552
1530         <rdar://problem/29601646>
1531
1532         Reviewed by Eric Carlson.
1533
1534         In the case of media documents, there is a built-in behavior, implemented in MediaDocument::defaultEventHandler(),
1535         that toggles playback when clicking or double-clicking the video. We disable this behavior by adding a "click" event
1536         handler on the entire media shadow root and calling "preventDefault()".
1537
1538         Test: media/modern-media-controls/media-documents/click-on-video-should-not-pause.html
1539
1540         * Modules/modern-media-controls/media/media-controller.js:
1541         (MediaController):
1542         (MediaController.prototype.handleEvent):
1543         (MediaController.prototype._containerWasClicked):
1544
1545 2017-01-28  Dan Bernstein  <mitz@apple.com>
1546
1547         [Xcode] Clean up PAL and WebCore’s build settings a little
1548         https://bugs.webkit.org/show_bug.cgi?id=167292
1549
1550         Reviewed by Sam Weinig.
1551
1552         * Configurations/Base.xcconfig: Simplified the definition of
1553           GCC_WARN_64_TO_32_BIT_CONVERSION, removed the unused build setting PREBINDING, removed
1554           a duplicate definition of GCC_GENERATE_DEBUGGING_SYMBOLS, and removed definitions specific
1555           to OS X versions that are no longer supported.
1556
1557         * Configurations/DebugRelease.xcconfig: Removed definitions specific to OS X versions
1558           that are no longer supported.
1559
1560 2017-01-28  Zalan Bujtas  <zalan@apple.com>
1561
1562         Resolve beforeChild's render tree position before calling addChildIgnoringContinuation.
1563         https://bugs.webkit.org/show_bug.cgi?id=167540
1564         <rdar://problem/30126535>
1565
1566         Reviewed by Simon Fraser.
1567
1568         Use the actual render tree position for the beforeChild when inside a flow thread.
1569
1570         Test: fast/multicol/assert-on-continuation-with-spanner.html
1571
1572         * rendering/RenderBlockFlow.cpp:
1573         (WebCore::RenderBlockFlow::addChild):
1574         * rendering/RenderInline.cpp:
1575         (WebCore::RenderInline::addChild):
1576         * rendering/RenderMultiColumnFlowThread.cpp:
1577         (WebCore::RenderMultiColumnFlowThread::resolveMovedChild):
1578
1579 2017-01-28  Andreas Kling  <akling@apple.com>
1580
1581         Avoid synchronous style recalc in dispatchUnloadEvents().
1582         <https://webkit.org/b/167551>
1583
1584         Reviewed by Antti Koivisto.
1585
1586         It shouldn't be necessary to force a synchronous style resolution in an unloading document.
1587         This call has been here since the import of KHTMLPart.
1588
1589         * loader/FrameLoader.cpp:
1590         (WebCore::FrameLoader::dispatchUnloadEvents):
1591
1592 2017-01-28  Andreas Kling  <akling@apple.com>
1593
1594         REGRESSION(r196383): Automatic shrink-to-fit of RuleSet no longer works.
1595         <https://webkit.org/b/167543>
1596
1597         Reviewed by Antti Koivisto.
1598
1599         Re-enable the automatic shrink-to-fit optimization in RuleSet.
1600         This was disabled accidentally, which I discovered while investigating
1601         the memory footprint of extension stylesheets.
1602
1603         * css/RuleSet.h:
1604
1605 2017-01-28  Antti Koivisto  <antti@apple.com>
1606
1607         Give scripts 'high' load priority
1608         https://bugs.webkit.org/show_bug.cgi?id=167550
1609
1610         Reviewed by Andreas Kling.
1611
1612         For historical reasons it is currently 'medium', same as web fonts and some other non-parsing blocking things.
1613
1614         * loader/cache/CachedResource.cpp:
1615         (WebCore::CachedResource::defaultPriorityForResourceType):
1616
1617 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
1618
1619         Add User Timing Experimental Feature
1620         https://bugs.webkit.org/show_bug.cgi?id=167542
1621         <rdar://problem/22746307>
1622
1623         Reviewed by Ryosuke Niwa.
1624
1625         * page/RuntimeEnabledFeatures.h:
1626         (WebCore::RuntimeEnabledFeatures::performanceTimelineEnabled):
1627         * page/Performance.idl:
1628         * page/PerformanceEntry.idl:
1629         Make a better RuntimeEnabledFeature named "PerformanceTiming" which
1630         is enabled if either UserTiming or ResourceTiming is enabled. This
1631         will then expose the APIs that are only useful when at least one of
1632         the APIs are available.
1633
1634         * page/PerformanceEntry.cpp:
1635         (WebCore::PerformanceEntry::name): Deleted.
1636         (WebCore::PerformanceEntry::entryType): Deleted.
1637         (WebCore::PerformanceEntry::startTime): Deleted.
1638         (WebCore::PerformanceEntry::duration): Deleted.
1639         * page/PerformanceEntry.h:
1640         (WebCore::PerformanceEntry::name):
1641         (WebCore::PerformanceEntry::entryType):
1642         (WebCore::PerformanceEntry::startTime):
1643         (WebCore::PerformanceEntry::duration):
1644         Inline simple accessors.
1645
1646         * page/PerformanceUserTiming.cpp:
1647         (WebCore::UserTiming::measure):
1648         Fix a bug introduced by ExceptionOr refactoring.
1649
1650         (WebCore::UserTiming::clearMarks):
1651         (WebCore::UserTiming::clearMeasures):
1652         (WebCore::clearPerformanceEntries):
1653         (WebCore::clearPeformanceEntries): Deleted.
1654         Fix method name typo.
1655
1656 2017-01-27  Dan Bernstein  <mitz@apple.com>
1657
1658         Ignore Xcode’s project.xcworkspace and userdata directories in this new project like we do
1659         in other projects.
1660
1661         * PAL/PAL.xcodeproj: Added property svn:ignore.
1662
1663 2017-01-27  Andy Estes  <aestes@apple.com>
1664
1665         Fix the iOS build when USE(QUICK_LOOK) is disabled.
1666
1667         * testing/Internals.cpp:
1668         (WebCore::Internals::setQuickLookPassword):
1669         * testing/Internals.h:
1670
1671 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1672
1673         setTimeout / setInterval's string execution should inherit SourceOrigin correctly
1674         https://bugs.webkit.org/show_bug.cgi?id=167097
1675
1676         Reviewed by Darin Adler.
1677
1678         Tests: js/dom/modules/import-from-set-interval.html
1679                js/dom/modules/import-from-set-timeout.html
1680
1681         * bindings/js/ScriptController.cpp:
1682         (WebCore::ScriptController::executeScriptInWorld):
1683
1684 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1685
1686         Merge CachedModuleScript and LoadableModuleScript
1687         https://bugs.webkit.org/show_bug.cgi?id=167500
1688
1689         Reviewed by Darin Adler.
1690
1691         CachedModuleScript becomes duplicate with LoadableModuleScript.
1692         And CachedModuleScript does not offer any meaningful functionality
1693         to LoadableModuleScript.
1694         This patch merges CachedModuleScript to LoadableModuleScript.
1695
1696         No behavior change.
1697
1698         * CMakeLists.txt:
1699         * WebCore.xcodeproj/project.pbxproj:
1700         * bindings/js/CachedModuleScript.cpp: Removed.
1701         * bindings/js/CachedModuleScript.h: Removed.
1702         * bindings/js/CachedModuleScriptClient.h: Removed.
1703         * bindings/js/JSBindingsAllInOne.cpp:
1704         * bindings/js/ScriptController.cpp:
1705         (WebCore::ScriptController::loadModuleScriptInWorld):
1706         (WebCore::ScriptController::loadModuleScript):
1707         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1708         (WebCore::ScriptController::linkAndEvaluateModuleScript):
1709         (WebCore::ScriptController::setupModuleScriptHandlers):
1710         * bindings/js/ScriptController.h:
1711         * dom/LoadableModuleScript.cpp:
1712         (WebCore::LoadableModuleScript::create):
1713         (WebCore::LoadableModuleScript::LoadableModuleScript):
1714         (WebCore::LoadableModuleScript::~LoadableModuleScript):
1715         (WebCore::LoadableModuleScript::isLoaded):
1716         (WebCore::LoadableModuleScript::error):
1717         (WebCore::LoadableModuleScript::wasCanceled):
1718         (WebCore::LoadableModuleScript::notifyLoadCompleted):
1719         (WebCore::LoadableModuleScript::notifyLoadFailed):
1720         (WebCore::LoadableModuleScript::notifyLoadWasCanceled):
1721         (WebCore::LoadableModuleScript::execute):
1722         (WebCore::LoadableModuleScript::load):
1723         (WebCore::LoadableModuleScript::notifyFinished): Deleted.
1724         * dom/LoadableModuleScript.h:
1725         * dom/ScriptElement.cpp:
1726         (WebCore::ScriptElement::executeModuleScript):
1727         * dom/ScriptElement.h:
1728
1729 2017-01-27  Michael Saboff  <msaboff@apple.com>
1730
1731         JSCustomElementInterface::invokeCallback can be called with a null callback because Weak<>
1732         https://bugs.webkit.org/show_bug.cgi?id=167522
1733
1734         Reviewed by Filip Pizlo.
1735
1736         Added all provided callbacks to the global object with a private name the same way 
1737         that the constructor was added.  This will keep these callbacks from being GC'ed.
1738
1739         * bindings/js/JSCustomElementRegistryCustom.cpp:
1740         (WebCore::JSCustomElementRegistry::define):
1741
1742 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
1743
1744         [Cocoa] Prepare ComplexTextController for unit testing
1745         https://bugs.webkit.org/show_bug.cgi?id=167493
1746
1747         Reviewed by Simon Fraser.
1748
1749         Addressing post-review comments from Simon Fraser.
1750
1751         * platform/graphics/FontCascade.h:
1752         * platform/graphics/mac/ComplexTextController.h:
1753         (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
1754         * platform/graphics/mac/ComplexTextControllerCoreText.h:
1755         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
1756
1757 2017-01-27  Simon Fraser  <simon.fraser@apple.com>
1758
1759         Element with a backdrop-filter and a mask may not correctly mask the backdrop
1760         https://bugs.webkit.org/show_bug.cgi?id=167456
1761         rdar://problem/29320059
1762
1763         Reviewed by Antoine Quint.
1764
1765         If a layer had a backdrop filter, but also corner radii that triggered using a mask layer,
1766         then the call to updateClippingStrategy() in GraphicsLayerCA::updateBackdropFiltersRect() would
1767         set the backdrop layer's mask, but GraphicsLayerCA::updateMaskLayer() would promptly then set
1768         the mask layer back to nil.
1769
1770         Fix by having GraphicsLayerCA::updateMaskLayer() put the mask on the structural layer, if there
1771         is one. We always have a structural layer with backdrops, so this will mask both the layer
1772         and the backdrop.
1773
1774         Test: css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html
1775
1776         * platform/graphics/ca/GraphicsLayerCA.cpp:
1777         (WebCore::GraphicsLayerCA::updateMaskLayer):
1778         * platform/graphics/mac/WebLayer.mm:
1779         (-[CALayer _descriptionWithPrefix:]): Dump the mask layer.
1780
1781 2017-01-27  Chris Dumez  <cdumez@apple.com>
1782
1783         Fix remaining bad uses of logDiagnosticMessageWithValue()
1784         https://bugs.webkit.org/show_bug.cgi?id=167526
1785
1786         Reviewed by Alex Christensen.
1787
1788         Drop unused keys, add new ones.
1789
1790         * page/DiagnosticLoggingKeys.cpp:
1791         (WebCore::DiagnosticLoggingKeys::networkCacheFailureReasonKey):
1792         (WebCore::DiagnosticLoggingKeys::networkCacheUnusedReasonKey):
1793         (WebCore::DiagnosticLoggingKeys::networkCacheReuseFailureKey):
1794         (WebCore::DiagnosticLoggingKeys::backNavigationDeltaKey):
1795         (WebCore::DiagnosticLoggingKeys::userZoomActionKey):
1796         (WebCore::DiagnosticLoggingKeys::deltaKey): Deleted.
1797         (WebCore::DiagnosticLoggingKeys::backNavigationKey): Deleted.
1798         (WebCore::DiagnosticLoggingKeys::requestKey): Deleted.
1799         (WebCore::DiagnosticLoggingKeys::unusableCachedEntryKey): Deleted.
1800         (WebCore::DiagnosticLoggingKeys::userKey): Deleted.
1801         (WebCore::DiagnosticLoggingKeys::zoomedKey): Deleted.
1802         (WebCore::DiagnosticLoggingKeys::notInCacheKey): Deleted.
1803         * page/DiagnosticLoggingKeys.h:
1804
1805 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
1806
1807         Proclaim that we are considering font-display, rhythmic sizing, and text decoration level 4
1808         https://bugs.webkit.org/show_bug.cgi?id=167340
1809
1810         Reviewed by Saam Barati.
1811
1812         * features.json:
1813
1814 2017-01-27  Chris Dumez  <cdumez@apple.com>
1815
1816         Fix diagnostic logging under loader/
1817         https://bugs.webkit.org/show_bug.cgi?id=167512
1818
1819         Reviewed by Alex Christensen.
1820
1821         Fix diagnostic logging under loader/. We should not be using logDiagnosticLoggingWithValue()
1822         without a numeric value.
1823
1824         * loader/ResourceLoader.cpp:
1825         (WebCore::logResourceResponseSource):
1826         * loader/SubresourceLoader.cpp:
1827         (WebCore::logResourceLoaded):
1828         * loader/cache/CachedResourceLoader.cpp:
1829         (WebCore::logMemoryCacheResourceRequest):
1830         (WebCore::CachedResourceLoader::requestResource):
1831         (WebCore::logRevalidation):
1832         * page/DiagnosticLoggingKeys.cpp:
1833         (WebCore::DiagnosticLoggingKeys::memoryCacheEntryDecisionKey):
1834         (WebCore::DiagnosticLoggingKeys::memoryCacheUsageKey):
1835         (WebCore::DiagnosticLoggingKeys::cachedResourceRevalidationReasonKey):
1836         (WebCore::DiagnosticLoggingKeys::resourceLoadedKey):
1837         (WebCore::DiagnosticLoggingKeys::resourceResponseSourceKey):
1838         * page/DiagnosticLoggingKeys.h:
1839
1840 2017-01-27  Chris Dumez  <cdumez@apple.com>
1841
1842         Fix diagnostic logging in media code
1843         https://bugs.webkit.org/show_bug.cgi?id=167510
1844
1845         Reviewed by Alex Christensen.
1846
1847         Fix diagnostic logging in media code. It should not use logDiagnosticMessageWithValue()
1848         with a non-numeric value.
1849
1850         * html/HTMLMediaElement.cpp:
1851         (WebCore::HTMLMediaElement::loadResource):
1852         (WebCore::HTMLMediaElement::updatePlayState):
1853
1854 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
1855
1856         [Cocoa] Prepare ComplexTextController for unit testing
1857         https://bugs.webkit.org/show_bug.cgi?id=167493
1858
1859         Reviewed by Dean Jackson.
1860
1861         ComplexTextController has three phases:
1862         1. Interrogate Core Text about some text
1863         2. Compute layout advances and paint advances from the information retrieved from
1864         Core Text
1865         3. Iterate through the layout advances or paint advances.
1866
1867         This patch tests phases 2 and 3 by chopping ComplexTextController between
1868         phases 1 and 2, and injecting foreign metrics from a unit test. These metrics
1869         have been gathered from real-world uses; however, a layout test is not appropriate
1870         because the fonts which produced these metrics are not licensed appropriately.
1871         The tests can enforce the correct behavior by using ComplexTextController's
1872         public API.
1873
1874         This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=166013.
1875         However, the fix for that bug is quite large, so I've split out this smaller piece
1876         to ease the reviewing burden. The tests I've added are disabled for now (because
1877         they fail), but will be enabled by the fix to that bug.
1878
1879         No new tests because there is no behavior change.
1880
1881         * WebCore.xcodeproj/project.pbxproj:
1882         * platform/graphics/FontCascade.h:
1883         * platform/graphics/FontDescription.h:
1884         * platform/graphics/mac/ComplexTextController.cpp:
1885         (WebCore::ComplexTextController::ComplexTextController):
1886         (WebCore::ComplexTextController::finishConstruction):
1887         * platform/graphics/mac/ComplexTextController.h:
1888         (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
1889         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1890         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
1891
1892 2017-01-27  Zalan Bujtas  <zalan@apple.com>
1893
1894         Simple line layout: Do not bail out on -webkit-line-box-contain: block glyphs unless text overflows vertically.
1895         https://bugs.webkit.org/show_bug.cgi?id=167481
1896         <rdar://problem/30180150>
1897
1898         Reviewed by Antti Koivisto.
1899
1900         Since -webkit-line-box-contain: glyphs requires variable line height support, we can use simple line layout
1901         only when each line happen to have the same height ('block' property value is set, glyphs do not overflow the block line height).  
1902
1903         Test: fast/text/simple-line-layout-line-box-contain-glyphs.html
1904
1905         * rendering/SimpleLineLayout.cpp:
1906         (WebCore::SimpleLineLayout::canUseForText):
1907         (WebCore::SimpleLineLayout::canUseForFontAndText):
1908         (WebCore::SimpleLineLayout::canUseForStyle):
1909         (WebCore::SimpleLineLayout::printReason):
1910
1911 2017-01-27  Chris Dumez  <cdumez@apple.com>
1912
1913         Fix PageCache diagnostic logging
1914         https://bugs.webkit.org/show_bug.cgi?id=167508
1915
1916         Reviewed by Sam Weinig.
1917
1918         Fix PageCache diagnostic logging. It should not call logDiagnosticMessageWithValue()
1919         with a non-numeric value. Use logDiagnosticMessage() instead.
1920
1921         * history/PageCache.cpp:
1922         (WebCore::logPageCacheFailureDiagnosticMessage):
1923         (WebCore::canCacheFrame):
1924         * page/DiagnosticLoggingKeys.cpp:
1925         (WebCore::DiagnosticLoggingKeys::pageCacheFailureKey):
1926         (WebCore::DiagnosticLoggingKeys::successKey): Deleted.
1927         (WebCore::DiagnosticLoggingKeys::failureKey): Deleted.
1928         * page/DiagnosticLoggingKeys.h:
1929
1930 2017-01-27  Devin Rousso  <dcrousso+webkit@gmail.com>
1931
1932         Styles should not show background-repeat-x/y, or -webkit-mask-repeat-x/y
1933         https://bugs.webkit.org/show_bug.cgi?id=167255
1934
1935         Reviewed by Joseph Pecoraro.
1936
1937         Test: inspector/css/css-property.html
1938
1939         * css/makeprop.pl:
1940         (addProperty):
1941         Add a generated function `isInternalCSSProperty` that checks the given CSSPropertyID against
1942         a derived list of properties from CSSProperties.json with "internal-only".
1943
1944         * inspector/InspectorCSSAgent.cpp:
1945         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
1946         * inspector/InspectorStyleSheet.cpp:
1947         (WebCore::InspectorStyle::styleWithProperties):
1948         Only pass CSS property payloads to the frontend if they are not internal.
1949
1950 2017-01-27  Antti Koivisto  <antti@apple.com>
1951
1952         Implement Cache-control: immutable
1953         https://bugs.webkit.org/show_bug.cgi?id=167497
1954
1955         Reviewed by Chris Dumez.
1956
1957         Cache-control value 'immutable' indicates that a subresource does not change and so does not need to be
1958         revalidated on a normal reload. This can significantly speed up reloads and reduce network traffic.
1959
1960         It is has been implemented in Firefox and is already used by Facebook.
1961
1962         https://tools.ietf.org/html/draft-mcmanus-immutable-00
1963         https://hacks.mozilla.org/2017/01/using-immutable-caching-to-speed-up-the-web/
1964
1965         This patch implements Cache-control: immutable for memory cache only. A disk cache implementation
1966         doesn't seem necessary as the resource is basically always expected to be in memory cache on reload.
1967
1968         Immutable is only supported for https as suggested by the draft specification (and Gecko implementation).
1969
1970         Test: http/tests/cache/cache-control-immutable-http.html
1971               http/tests/cache/cache-control-immutable-https.html
1972
1973         * loader/cache/CachedResource.cpp:
1974         (WebCore::CachedResource::makeRevalidationDecision):
1975
1976             On normal reloads (CachePolicyRevalidate) of https resources check for 'Cache-control: immutable'.
1977             If the resource is not expired don't revalidate it.
1978
1979         * platform/network/CacheValidation.cpp:
1980         (WebCore::parseCacheControlDirectives):
1981         * platform/network/CacheValidation.h:
1982         * platform/network/ResourceResponseBase.cpp:
1983         (WebCore::ResourceResponseBase::cacheControlContainsImmutable):
1984         * platform/network/ResourceResponseBase.h:
1985
1986 2017-01-27  Youenn Fablet  <youennf@gmail.com>
1987
1988         [WebRTC] Use MediaEndPointPeerConnection if not using libwebrtc
1989         https://bugs.webkit.org/show_bug.cgi?id=167504
1990
1991         Reviewed by Alex Christensen.
1992
1993         No change of behavior.
1994
1995         * Modules/mediastream/MediaEndpointPeerConnection.cpp: If libwebrtc, we should use libwebrtc peer connection backend.
1996
1997 2017-01-27  Ryan Haddad  <ryanhaddad@apple.com>
1998
1999         Rebaseline bindings tests after r211238.
2000
2001         Unreviewed test gardening.
2002
2003         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2004         (WebCore::JSTestDOMJIT::visitChildren):
2005         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2006         (WebCore::JSTestEventTarget::visitChildren):
2007         * bindings/scripts/test/JS/JSTestNode.cpp:
2008         (WebCore::JSTestNode::visitChildren):
2009
2010 2017-01-25  Sergio Villar Senin  <svillar@igalia.com>
2011
2012         [css-grid] Move Grid class out of RenderGrid
2013         https://bugs.webkit.org/show_bug.cgi?id=167418
2014
2015         Reviewed by Antti Koivisto.
2016
2017         The RenderGrid should be able to use different implementations of
2018         the Grid class. The latter is big enough to be in its own file. That
2019         would help on the effort of moving the grid track sizing algorithm
2020         out of RenderGrid too.
2021
2022         No new tests required as we're just moving code.
2023
2024         * CMakeLists.txt:
2025         * rendering/Grid.cpp: Added.
2026         (WebCore::Grid::Grid):
2027         (WebCore::Grid::numTracks):
2028         (WebCore::Grid::ensureGridSize):
2029         (WebCore::Grid::insert):
2030         (WebCore::Grid::setSmallestTracksStart):
2031         (WebCore::Grid::smallestTrackStart):
2032         (WebCore::Grid::gridItemArea):
2033         (WebCore::Grid::setGridItemArea):
2034         (WebCore::Grid::setAutoRepeatTracks):
2035         (WebCore::Grid::autoRepeatTracks):
2036         (WebCore::Grid::setAutoRepeatEmptyColumns):
2037         (WebCore::Grid::setAutoRepeatEmptyRows):
2038         (WebCore::Grid::hasAutoRepeatEmptyTracks):
2039         (WebCore::Grid::isEmptyAutoRepeatTrack):
2040         (WebCore::Grid::autoRepeatEmptyTracks):
2041         (WebCore::Grid::gridItemSpan):
2042         (WebCore::Grid::setNeedsItemsPlacement):
2043         (WebCore::GridIterator::GridIterator):
2044         (WebCore::GridIterator::nextGridItem):
2045         (WebCore::GridIterator::isEmptyAreaEnough):
2046         (WebCore::GridIterator::nextEmptyGridArea):
2047         * rendering/Grid.h: Added.
2048         * rendering/RenderGrid.cpp:
2049         (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat):
2050         (WebCore::RenderGrid::Grid::numTracks): Deleted.
2051         (WebCore::RenderGrid::Grid::ensureGridSize): Deleted.
2052         (WebCore::RenderGrid::Grid::insert): Deleted.
2053         (WebCore::RenderGrid::Grid::setSmallestTracksStart): Deleted.
2054         (WebCore::RenderGrid::Grid::smallestTrackStart): Deleted.
2055         (WebCore::RenderGrid::Grid::gridItemArea): Deleted.
2056         (WebCore::RenderGrid::Grid::setGridItemArea): Deleted.
2057         (WebCore::RenderGrid::Grid::setAutoRepeatTracks): Deleted.
2058         (WebCore::RenderGrid::Grid::autoRepeatTracks): Deleted.
2059         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyColumns): Deleted.
2060         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyRows): Deleted.
2061         (WebCore::RenderGrid::Grid::hasAutoRepeatEmptyTracks): Deleted.
2062         (WebCore::RenderGrid::Grid::isEmptyAutoRepeatTrack): Deleted.
2063         (WebCore::RenderGrid::Grid::autoRepeatEmptyTracks): Deleted.
2064         (WebCore::RenderGrid::Grid::gridItemSpan): Deleted.
2065         (WebCore::RenderGrid::Grid::setNeedsItemsPlacement): Deleted.
2066         (WebCore::RenderGrid::GridIterator::GridIterator): Deleted.
2067         (WebCore::RenderGrid::GridIterator::nextGridItem): Deleted.
2068         (WebCore::RenderGrid::GridIterator::isEmptyAreaEnough): Deleted.
2069         (WebCore::RenderGrid::GridIterator::nextEmptyGridArea): Deleted.
2070         * rendering/RenderGrid.h:
2071
2072 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
2073
2074         Implement dynamic-import for WebCore
2075         https://bugs.webkit.org/show_bug.cgi?id=166926
2076
2077         Reviewed by Ryosuke Niwa.
2078
2079         This patch introduces browser side dynamic-import implementation.
2080         The dynamic-import is new ES feature which is now stage 3.
2081         The JSC shell already implements it.
2082
2083         The dynamic-import allows us to kick module loading in a dynamic manner.
2084         For example, you can write,
2085
2086             await module = import(`${HOST}/hello.js`);
2087
2088         The dynamic `import` operator (this is not a function) returns a promise with
2089         module namespace object if the module loading succeeds. Otherwise, it returns
2090         a rejected promise.
2091
2092         And importantly, this feature allows us to kick module loading from classic script.
2093         Previously, module loading can be only used from <script type="module"> tag. And
2094         all the module loading is done statically.
2095
2096         * CMakeLists.txt:
2097         * WebCore.xcodeproj/project.pbxproj:
2098         * bindings/js/CachedModuleScriptLoader.cpp:
2099         (WebCore::CachedModuleScriptLoader::load):
2100         * bindings/js/CachedScriptFetcher.cpp:
2101         (WebCore::CachedScriptFetcher::create):
2102         (WebCore::CachedScriptFetcher::requestModuleScript):
2103         requestModuleScript function is used only when loading a new module script.
2104         So, LoadableClassicScript should use requestScriptWithCache to load itself.
2105         We pass String() for cross origin mode for null cross origin attribute as
2106         specified.
2107
2108         (WebCore::CachedScriptFetcher::requestScriptWithCache):
2109         * bindings/js/CachedScriptFetcher.h:
2110         (WebCore::CachedScriptFetcher::CachedScriptFetcher):
2111         * bindings/js/JSDOMWindowBase.cpp:
2112         (WebCore::JSDOMWindowBase::moduleLoaderImportModule):
2113         * bindings/js/JSDOMWindowBase.h:
2114         * bindings/js/JSLazyEventListener.cpp:
2115         (WebCore::JSLazyEventListener::initializeJSFunction):
2116         * bindings/js/ScriptController.cpp:
2117         (WebCore::ScriptController::executeScript):
2118         * bindings/js/ScriptModuleLoader.cpp:
2119         (WebCore::resolveModuleSpecifier):
2120         Extract the part of resolving module specifier to a static function to use
2121         it in ScriptModuleLoader::resolve and ScriptModuleLoader::importModule.
2122
2123         (WebCore::ScriptModuleLoader::resolve):
2124         (WebCore::rejectPromise):
2125         (WebCore::ScriptModuleLoader::importModule):
2126         New hook moduleLoaderImportModule is implemented. This hook is called when
2127         `import` operator is used. This hook is responsible to
2128             1. resolve the module name to obtain module specifier. (like, resolve the
2129                 relative URL to get absolute URL.)
2130             2. kick module loading with the resolved specifier.
2131         When resolving the module name, the referrer information is needed.
2132         For example, "./script.js" will be resolved to "http://example.com/script.js" if
2133         the referrer module specifier is "http://example.com/".
2134         If `import("./script.js")` is executed in the classic script
2135         src="http://example.com/test.js", it starts loading "http://example.com/script.js".
2136         So the information of the caller of `import` operator is necessary here.
2137         This appropriate referrer is propagated by SourceOrigin.
2138
2139         * bindings/js/ScriptModuleLoader.h:
2140         * dom/InlineClassicScript.h:
2141         * dom/LoadableClassicScript.cpp:
2142         (WebCore::LoadableClassicScript::load):
2143         * dom/LoadableClassicScript.h:
2144         * dom/LoadableModuleScript.h:
2145         * dom/LoadableScript.h:
2146         (WebCore::LoadableScript::LoadableScript):
2147         (WebCore::LoadableScript::isClassicScript): Deleted.
2148         (WebCore::LoadableScript::isModuleScript): Deleted.
2149         * dom/ScriptElement.h:
2150         * dom/ScriptElementCachedScriptFetcher.cpp: Copied from Source/WebCore/dom/InlineClassicScript.h.
2151         (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript):
2152         This requestModuleScript will be used when the script tag (or modules imported from the script tag) uses `import` operator.
2153         In classic scripts, `crossorigin` mode always becomes "omit" while module scripts
2154         propagate the original `crossorigin` value.
2155
2156         * dom/ScriptElementCachedScriptFetcher.h: Copied from Source/WebCore/bindings/js/CachedScriptFetcher.h.
2157         (WebCore::ScriptElementCachedScriptFetcher::crossOriginMode):
2158         (WebCore::ScriptElementCachedScriptFetcher::ScriptElementCachedScriptFetcher):
2159
2160 2017-01-26  Chris Dumez  <cdumez@apple.com>
2161
2162         Revert r210474 it is no longer needed
2163         https://bugs.webkit.org/show_bug.cgi?id=167487
2164
2165         Reviewed by Daniel Bates.
2166
2167         Revert r210474 it is no longer needed after r211254.
2168
2169         * dom/Document.cpp:
2170         (WebCore::Document::canNavigate):
2171         * html/HTMLAnchorElement.cpp:
2172         (WebCore::HTMLAnchorElement::handleClick):
2173         * html/HTMLLinkElement.cpp:
2174         (WebCore::HTMLLinkElement::handleClick):
2175         * loader/FrameLoader.cpp:
2176         (WebCore::FrameLoader::urlSelected):
2177         (WebCore::FrameLoader::submitForm):
2178         (WebCore::FrameLoader::loadFrameRequest):
2179         * mathml/MathMLElement.cpp:
2180         (WebCore::MathMLElement::defaultEventHandler):
2181         * svg/SVGAElement.cpp:
2182         (WebCore::SVGAElement::defaultEventHandler):
2183
2184 2017-01-26  Youenn Fablet  <youennf@gmail.com>
2185
2186         [WebRTC] Implement WebRTC PeerConnection backend based on libwebrtc
2187         https://bugs.webkit.org/show_bug.cgi?id=167289
2188
2189         Reviewed by Alex Christensen.
2190
2191         Introducing an initial implementation of WebRTC peer connection backend based on LibWebRTC.
2192         This is done behind a compilation flag which is off by default, until the implementation is ready.
2193
2194         The backend implements the PeerConnectionBackend API.
2195         The implementation is split into LibWebRTCPeerConnectionBackend which contains mostly generic code and
2196         passes the real work to LibWebRTCMediaEndpoint.
2197         The latter class is implementing the API using LibWebRTC.
2198
2199         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: Added.
2200         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
2201         (WebCore::sessionDescriptionType):
2202         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
2203         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
2204         (WebCore::LibWebRTCMediaEndpoint::addPendingIceCandidates):
2205         (WebCore::streamId):
2206         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2207         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2208         (WebCore::LibWebRTCMediaEndpoint::getStats):
2209         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector):
2210         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
2211         (WebCore::signalingState):
2212         (WebCore::LibWebRTCMediaEndpoint::OnSignalingChange):
2213         (WebCore::trackId):
2214         (WebCore::createMediaStreamTrack):
2215         (WebCore::LibWebRTCMediaEndpoint::addStream):
2216         (WebCore::LibWebRTCMediaEndpoint::OnAddStream):
2217         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
2218         (WebCore::LibWebRTCMediaEndpoint::OnDataChannel):
2219         (WebCore::LibWebRTCMediaEndpoint::stop):
2220         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
2221         (WebCore::iceConnectionState):
2222         (WebCore::LibWebRTCMediaEndpoint::OnIceConnectionChange):
2223         (WebCore::LibWebRTCMediaEndpoint::OnIceGatheringChange):
2224         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
2225         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidatesRemoved):
2226         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
2227         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
2228         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionSucceeded):
2229         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
2230         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionSucceeded):
2231         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
2232         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: Added.
2233         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: Added.
2234         (WebCore::createLibWebRTCPeerConnectionBackend):
2235         (WebCore::libWebRTCProvider):
2236         (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
2237         (WebCore::configurationFromMediaEndpointConfiguration):
2238         (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
2239         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
2240         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
2241         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
2242         (WebCore::LibWebRTCPeerConnectionBackend::doCreateOffer):
2243         (WebCore::LibWebRTCPeerConnectionBackend::doCreateAnswer):
2244         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
2245         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
2246         (WebCore::LibWebRTCPeerConnectionBackend::markAsNeedingNegotiation):
2247         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
2248         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
2249         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: Added.
2250         * WebCore.xcodeproj/project.pbxproj:
2251
2252 2017-01-26  Chris Dumez  <cdumez@apple.com>
2253
2254         Crash when navigating back to a page in PacheCache when one of its frames has been removed
2255         https://bugs.webkit.org/show_bug.cgi?id=167421
2256         <rdar://problem/30188490>
2257
2258         Reviewed by Darin Adler.
2259
2260         Disallow page caching of a page if:
2261         1. The main window has an opener (i.e. it was opened via window.open)
2262         2. It has ever used window.open()
2263
2264         This is because allowing page caching in this case would allow such
2265         windows to script each other even after one of them entered Page
2266         Cache. Allowing this is dangerous and easily causes crashes.
2267
2268         This is a short term workaround until we find a better solution to
2269         the problem. One issue is this workaround is that navigating back
2270         to a page that has an opener or used window.open() will not longer
2271         get the page from PageCache. As a result, state may be lost upon
2272         navigating back. However, we never guarantee that pages get page
2273         cached, and Chrome does not have a PageCache.
2274
2275         Tests: fast/history/page-cache-after-window-open.html
2276                fast/history/page-cache-back-navigation-crash.html
2277                fast/history/page-cache-with-opener.html
2278
2279         * dom/Document.cpp:
2280         (WebCore::Document::hasEverCalledWindowOpen):
2281         (WebCore::Document::markHasCalledWindowOpen):
2282         * dom/Document.h:
2283         * history/PageCache.cpp:
2284         (WebCore::canCachePage):
2285         * page/DOMWindow.cpp:
2286         (WebCore::DOMWindow::createWindow):
2287         * page/DiagnosticLoggingKeys.cpp:
2288         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey):
2289         (WebCore::DiagnosticLoggingKeys::hasOpenerKey):
2290         * page/DiagnosticLoggingKeys.h:
2291         * page/Page.cpp:
2292         (WebCore::Page::openedByWindowOpen):
2293         * page/Page.h:
2294         * page/Settings.in:
2295
2296 2017-01-26  Youenn Fablet  <youennf@gmail.com>
2297
2298         [WebRTC] Add a LibWebRTC mock for testing
2299         https://bugs.webkit.org/show_bug.cgi?id=167429
2300
2301         Reviewed by Alex Christensen.
2302
2303         Covered by updated tests although feature is behind a flag, off by default.
2304         MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC,
2305         without reyling on it and controlling the way that the peer connections will behave.
2306         Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback.
2307
2308         Tests: fast/mediastream/getUserMedia-webaudio.html
2309                webrtc/datachannel/basic.html
2310                webrtc/video.html
2311
2312         * WebCore.xcodeproj/project.pbxproj:
2313         * testing/Internals.cpp:
2314         (WebCore::Internals::Internals):
2315         (WebCore::Internals::useMockRTCPeerConnectionFactory):
2316         * testing/Internals.h:
2317         * testing/Internals.idl:
2318         * testing/MockLibWebRTCPeerConnection.cpp: Added.
2319         (WebCore::useMockRTCPeerConnectionFactory):
2320         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates):
2321         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
2322         (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState):
2323         (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription):
2324         (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory):
2325         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
2326         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream):
2327         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
2328         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
2329         (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel):
2330         (WebCore::MockLibWebRTCPeerConnection::AddStream):
2331         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
2332         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
2333         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
2334         * testing/MockLibWebRTCPeerConnection.h: Added.
2335         (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection):
2336         (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection):
2337         (WebCore::MockLibWebRTCPeerConnection::local_streams):
2338         (WebCore::MockLibWebRTCPeerConnection::remote_streams):
2339         (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender):
2340         (WebCore::MockLibWebRTCPeerConnection::GetStats):
2341         (WebCore::MockLibWebRTCPeerConnection::local_description):
2342         (WebCore::MockLibWebRTCPeerConnection::remote_description):
2343         (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate):
2344         (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver):
2345         (WebCore::MockLibWebRTCPeerConnection::signaling_state):
2346         (WebCore::MockLibWebRTCPeerConnection::ice_connection_state):
2347         (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state):
2348         (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog):
2349         (WebCore::MockLibWebRTCPeerConnection::Close):
2350         (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription):
2351         (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate):
2352         (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack):
2353         (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack):
2354         (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel):
2355         (WebCore::MockLibWebRTCPeerConnectionFactory::create):
2356
2357 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
2358
2359         Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture
2360         https://bugs.webkit.org/show_bug.cgi?id=167126
2361
2362         Reviewed by Jon Lee.
2363
2364         Enabled pointer-lock/locked-element-removed-from-dom.html for WK2.
2365         Not enable in WK1 because of https://bugs.webkit.org/show_bug.cgi?id=167127
2366
2367         This change allows a page to lock the pointer again without a user gesture if it was unlocked by
2368         the page and not by the user. See https://www.w3.org/TR/2016/REC-pointerlock-20161027/ 5.1 Methods
2369
2370         * page/PointerLockController.cpp:
2371
2372         When a document acquires pointer lock with a user gesture, that document is allowed to request pointer lock again
2373         until the user takes an action to end pointer lock. We know it is a user action because user actions always
2374         call requestPointerUnlockAndForceCursorVisible().
2375
2376         When the page requests a pointer unlock (via requestPointerUnlock), that document is allowed to continue to relock
2377         the page. This continues until there is either an unlock request form the user 
2378         via requestPointerUnlockAndForceCursorVisible or a didLosePointerLock without a pointer unlock request.
2379
2380         (WebCore::PointerLockController::PointerLockController):
2381         (WebCore::PointerLockController::requestPointerLock):
2382         (WebCore::PointerLockController::requestPointerUnlock):
2383         (WebCore::PointerLockController::requestPointerUnlockAndForceCursorVisible):
2384         (WebCore::PointerLockController::elementRemoved):
2385         (WebCore::PointerLockController::documentDetached):
2386         (WebCore::PointerLockController::didAcquirePointerLock):
2387         (WebCore::PointerLockController::didLosePointerLock):
2388         (WebCore::PointerLockController::clearElement):
2389         * page/PointerLockController.h:
2390
2391 2017-01-26  Andy Estes  <aestes@apple.com>
2392
2393         [QuickLook] REGRESSION (WebKit2): Requests are made to invalid x-apple-ql-id: URLs
2394         https://bugs.webkit.org/show_bug.cgi?id=167453
2395
2396         Reviewed by Brent Fulgham.
2397
2398         Requests to x-apple-ql-id: URLs should be filtered by
2399         -[QLPreviewConverter safeRequestForRequest:]. This method checks that the URL is one of the
2400         ones generated for the current preview, and changes it to "about:" if it isn't.
2401
2402         WebCore::safeQLURLForDocumentURLAndResourceURL() was responsible for finding the
2403         QLPreviewConverter instance to use by looking it up in an NSMutableDictionary using the
2404         document URL as a key. In WebKit1, this dictionary was populated by the
2405         QuickLookHandleClient when new QuickLookHandles were created, but the WebKit2
2406         QuickLookHandleClient never did this. As a result, requests to invalid URLs were not being
2407         rewritten.
2408
2409         An easy way to load a QuickLook document with invalid URLs is to create an HTML file with a
2410         Microsoft Office extension (e.g. .xls); QuickLook, iWork, and Office support opening HTML
2411         files with Office document extensions. In r207155 we applied a Content Security Policy to
2412         QuickLook documents that only allows x-apple-ql-id: resources to load. This blocked
2413         cross-origin requests from loading, but same-origin requests to URLs that weren't generated
2414         by QLPreviewConverter were still allowed to load.
2415
2416         This change blocks these URLs by calling -[QLPreviewConverter safeRequestForRequest:] in a
2417         way that works for both WebKit1 and WebKit2.
2418
2419         After implementing QuickLook for WebKit2, we found a bug when loading HTML-as-Office
2420         documents (webkit.org/b/135651) that presented as a nil MIME type in the preview
2421         NSURLResponse returned by QLPreviewConverter. Unfortunately r172159 papered over the actual
2422         bug by failing to load previews with nil MIME types.
2423
2424         The real issue was that we were asking for the preview response before QuickLook had
2425         received enough data to determine a MIME type, so this change also removes the bad fix from
2426         r172159 and instead waits until QuickLook has converted the document to ask for its preview
2427         response. This restores the ability to load HTML files with Office document extensions.
2428         These two fixes are combined in a single patch because I don't know how to create an invalid
2429         QuickLook URL for testing without loading an HTML-as-Office document.
2430
2431         Test: quicklook/invalid-ql-id-url.html
2432
2433         * loader/ResourceLoader.cpp:
2434         (WebCore::ResourceLoader::willSendRequestInternal): Called
2435         QuickLookHandle::willSendRequest() if m_documentLoader has a QuickLookHandle.
2436         * loader/cache/CachedResource.cpp:
2437         (WebCore::CachedResource::load): Removed the call to
2438         WebCore::safeQLURLForDocumentURLAndResourceURL().
2439         * loader/ios/QuickLook.h: Removed safeQLURLForDocumentURLAndResourceURL() and declared
2440         QuickLookHandle::willSendRequest().
2441         * loader/ios/QuickLook.mm: Removed _previewResponse and _hasFailed ivars from
2442         WebPreviewConverter.
2443         (-[WebPreviewConverter initWithResourceLoader:resourceResponse:quickLookHandle:]): Stopped
2444         setting _previewResponse.
2445         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Only emptied _bufferedDataArray
2446         if we haven't already called -_sendDidReceiveResponseIfNecessary; removed the check for a
2447         nil _previewResponse MIME type; accessed -[QLPreviewConverter previewResponse] now that the
2448         document has been converted and asserted its MIME type is non-nil.
2449         (-[WebPreviewConverter connection:didReceiveData:lengthReceived:]): Removed _hasFailed check.
2450         (-[WebPreviewConverter connectionDidFinishLoading:]): Ditto.
2451         (isQuickLookPasswordError): Moved the check for password failure errors to here from
2452         -connection:didFailWithError: for better readability.
2453         (-[WebPreviewConverter connection:didFailWithError:]): Removed _hasFailed check and used
2454         more early returns.
2455         (WebCore::QuickLookHandle::willSendRequest): Filtered the request through
2456         -[QLPreviewConverter safeRequestWithRequest:] if the request URL's scheme is x-apple-ql-id:.
2457         (WebCore::safeQLURLForDocumentURLAndResourceURL): Deleted.
2458
2459 2017-01-26  Keith Miller  <keith_miller@apple.com>
2460
2461         classInfo should take a VM so it is not materialized from the object on each call
2462         https://bugs.webkit.org/show_bug.cgi?id=167424
2463
2464         Rubber Stamped by Michael Saboff.
2465
2466         Previously, classInfo() would get the VM from the target's
2467         MarkedBlock.  Most callers already have a VM on hand, so it is
2468         wasteful to compute the VM from the marked block every time. This
2469         patch refactors some of the most common callers of classInfo(),
2470         jsDynamicCast and inherits to take a VM as well.
2471
2472         * Modules/fetch/FetchBody.cpp:
2473         (WebCore::FetchBody::extract):
2474         * Modules/plugins/QuickTimePluginReplacement.mm:
2475         (WebCore::QuickTimePluginReplacement::installReplacement):
2476         * bindings/js/IDBBindingUtilities.cpp:
2477         (WebCore::createIDBKeyFromValue):
2478         * bindings/js/JSCommandLineAPIHostCustom.cpp:
2479         (WebCore::JSCommandLineAPIHost::getEventListeners):
2480         (WebCore::JSCommandLineAPIHost::databaseId):
2481         (WebCore::JSCommandLineAPIHost::storageId):
2482         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
2483         (WebCore::JSCryptoAlgorithmDictionary::parseAlgorithmIdentifier):
2484         (WebCore::createRsaKeyGenParams):
2485         * bindings/js/JSCryptoCustom.cpp:
2486         (WebCore::JSCrypto::getRandomValues):
2487         * bindings/js/JSCryptoOperationData.cpp:
2488         (WebCore::cryptoOperationDataFromJSValue):
2489         * bindings/js/JSCustomElementInterface.cpp:
2490         (WebCore::constructCustomElementSynchronously):
2491         (WebCore::JSCustomElementInterface::upgradeElement):
2492         * bindings/js/JSDOMBinding.cpp:
2493         (WebCore::valueToDate):
2494         (WebCore::reportException):
2495         (WebCore::retrieveErrorMessage):
2496         * bindings/js/JSDOMBinding.h:
2497         (WebCore::castThisValue):
2498         (WebCore::toPossiblySharedArrayBufferView):
2499         (WebCore::toUnsharedArrayBufferView):
2500         (WebCore::toPossiblySharedInt8Array):
2501         (WebCore::toPossiblySharedInt16Array):
2502         (WebCore::toPossiblySharedInt32Array):
2503         (WebCore::toPossiblySharedUint8Array):
2504         (WebCore::toPossiblySharedUint8ClampedArray):
2505         (WebCore::toPossiblySharedUint16Array):
2506         (WebCore::toPossiblySharedUint32Array):
2507         (WebCore::toPossiblySharedFloat32Array):
2508         (WebCore::toPossiblySharedFloat64Array):
2509         (WebCore::toUnsharedInt8Array):
2510         (WebCore::toUnsharedInt16Array):
2511         (WebCore::toUnsharedInt32Array):
2512         (WebCore::toUnsharedUint8Array):
2513         (WebCore::toUnsharedUint8ClampedArray):
2514         (WebCore::toUnsharedUint16Array):
2515         (WebCore::toUnsharedUint32Array):
2516         (WebCore::toUnsharedFloat32Array):
2517         (WebCore::toUnsharedFloat64Array):
2518         (WebCore::toRefNativeArray):
2519         * bindings/js/JSDOMConstructor.h:
2520         (WebCore::JSDOMConstructorNotConstructable<JSClass>::finishCreation):
2521         (WebCore::JSDOMConstructor<JSClass>::finishCreation):
2522         (WebCore::JSDOMNamedConstructor<JSClass>::finishCreation):
2523         (WebCore::JSBuiltinConstructor<JSClass>::finishCreation):
2524         * bindings/js/JSDOMConvert.h:
2525         (WebCore::Converter<IDLInterface<T>>::convert):
2526         (WebCore::Converter<IDLXPathNSResolver<T>>::convert):
2527         * bindings/js/JSDOMGlobalObject.cpp:
2528         (WebCore::JSDOMGlobalObject::finishCreation):
2529         (WebCore::JSDOMGlobalObject::scriptExecutionContext):
2530         * bindings/js/JSDOMIterator.h:
2531         (WebCore::IteratorTraits>::next):
2532         (WebCore::IteratorTraits>::finishCreation):
2533         * bindings/js/JSDOMWindowBase.cpp:
2534         (WebCore::JSDOMWindowBase::finishCreation):
2535         (WebCore::toJSDOMWindow):
2536         * bindings/js/JSDOMWindowBase.h:
2537         * bindings/js/JSDOMWindowCustom.cpp:
2538         (WebCore::jsDOMWindowWebKit):
2539         (WebCore::JSDOMWindow::toWrapped):
2540         * bindings/js/JSDOMWindowShell.cpp:
2541         (WebCore::JSDOMWindowShell::finishCreation):
2542         (WebCore::JSDOMWindowShell::toWrapped):
2543         * bindings/js/JSDOMWindowShell.h:
2544         * bindings/js/JSDocumentCustom.cpp:
2545         (WebCore::cachedDocumentWrapper):
2546         (WebCore::JSDocument::createTouchList):
2547         * bindings/js/JSDynamicDowncast.h:
2548         (WebCore::JSDynamicCastTrait::cast):
2549         (WebCore::JSDynamicCastTrait<JSNode>::cast):
2550         (WebCore::JSDynamicCastTrait<JSElement>::cast):
2551         (WebCore::JSDynamicCastTrait<JSDocument>::cast):
2552         (WebCore::JSDynamicCastTrait<JSEvent>::cast):
2553         (WebCore::jsDynamicDowncast):
2554         * bindings/js/JSEventListener.cpp:
2555         (WebCore::JSEventListener::handleEvent):
2556         * bindings/js/JSEventTargetCustom.cpp:
2557         (WebCore::JSEventTarget::toWrapped):
2558         (WebCore::jsEventTargetCast):
2559         * bindings/js/JSEventTargetCustom.h:
2560         (WebCore::BindingCaller<JSEventTarget>::callOperation):
2561         * bindings/js/JSExceptionBase.cpp:
2562         (WebCore::toExceptionBase):
2563         * bindings/js/JSExceptionBase.h:
2564         * bindings/js/JSInspectorFrontendHostCustom.cpp:
2565         (WebCore::populateContextMenuItems):
2566         (WebCore::JSInspectorFrontendHost::showContextMenu):
2567         * bindings/js/JSNodeCustom.cpp:
2568         (WebCore::JSNode::insertBefore):
2569         (WebCore::JSNode::replaceChild):
2570         (WebCore::JSNode::removeChild):
2571         (WebCore::JSNode::appendChild):
2572         (WebCore::JSNode::pushEventHandlerScope):
2573         * bindings/js/JSPluginElementFunctions.cpp:
2574         (WebCore::pluginElementPropertyGetter):
2575         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2576         (WebCore::constructJSReadableStreamDefaultReader):
2577         * bindings/js/JSReadableStreamSourceCustom.cpp:
2578         (WebCore::startReadableStream):
2579         (WebCore::JSReadableStreamSource::start):
2580         (WebCore::pullReadableStream):
2581         * bindings/js/JSSubtleCryptoCustom.cpp:
2582         (WebCore::toCryptoKey):
2583         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
2584         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
2585         (WebCore::jsSubtleCryptoFunctionSignPromise):
2586         (WebCore::jsSubtleCryptoFunctionVerifyPromise):
2587         (WebCore::jsSubtleCryptoFunctionDigestPromise):
2588         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
2589         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise):
2590         * bindings/js/JSTrackCustom.cpp:
2591         (WebCore::toTrack): Deleted.
2592         * bindings/js/JSTrackCustom.h:
2593         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2594         (WebCore::JSWebKitSubtleCrypto::encrypt):
2595         (WebCore::JSWebKitSubtleCrypto::decrypt):
2596         (WebCore::JSWebKitSubtleCrypto::sign):
2597         (WebCore::JSWebKitSubtleCrypto::verify):
2598         (WebCore::JSWebKitSubtleCrypto::exportKey):
2599         (WebCore::JSWebKitSubtleCrypto::wrapKey):
2600         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
2601         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2602         (WebCore::JSWorkerGlobalScopeBase::finishCreation):
2603         (WebCore::toJSDedicatedWorkerGlobalScope):
2604         (WebCore::toJSWorkerGlobalScope):
2605         * bindings/js/JSWorkerGlobalScopeBase.h:
2606         * bindings/js/JSXMLHttpRequestCustom.cpp:
2607         (WebCore::JSXMLHttpRequest::send):
2608         * bindings/js/JSXPathNSResolverCustom.cpp:
2609         (WebCore::JSXPathNSResolver::toWrapped):
2610         * bindings/js/ScriptController.cpp:
2611         (WebCore::ScriptController::setupModuleScriptHandlers):
2612         * bindings/js/ScriptModuleLoader.cpp:
2613         (WebCore::ScriptModuleLoader::fetch):
2614         (WebCore::ScriptModuleLoader::evaluate):
2615         * bindings/js/ScriptState.cpp:
2616         (WebCore::domWindowFromExecState):
2617         (WebCore::scriptExecutionContextFromExecState):
2618         * bindings/js/SerializedScriptValue.cpp:
2619         (WebCore::CloneSerializer::isArray):
2620         (WebCore::CloneSerializer::isMap):
2621         (WebCore::CloneSerializer::isSet):
2622         (WebCore::CloneSerializer::dumpArrayBufferView):
2623         (WebCore::CloneSerializer::dumpIfTerminal):
2624         (WebCore::CloneSerializer::serialize):
2625         (WebCore::CloneDeserializer::CloneDeserializer):
2626         (WebCore::CloneDeserializer::readArrayBufferView):
2627         (WebCore::CloneDeserializer::readTerminal):
2628         (WebCore::transferArrayBuffers):
2629         (WebCore::SerializedScriptValue::create):
2630         * bindings/js/StructuredClone.cpp:
2631         (WebCore::structuredCloneArrayBuffer):
2632         (WebCore::structuredCloneArrayBufferView):
2633         * bindings/js/WorkerScriptController.cpp:
2634         (WebCore::WorkerScriptController::evaluate):
2635         * bindings/scripts/CodeGeneratorJS.pm:
2636         (GenerateHeader):
2637         (GenerateOverloadedFunctionOrConstructor):
2638         (GenerateImplementation):
2639         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2640         (WebCore::JSInterfaceName::finishCreation):
2641         (WebCore::jsInterfaceNameConstructor):
2642         (WebCore::setJSInterfaceNameConstructor):
2643         (WebCore::JSInterfaceName::toWrapped):
2644         * bindings/scripts/test/JS/JSInterfaceName.h:
2645         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2646         (WebCore::JSTestActiveDOMObject::finishCreation):
2647         (WebCore::BindingCaller<JSTestActiveDOMObject>::castForAttribute):
2648         (WebCore::BindingCaller<JSTestActiveDOMObject>::castForOperation):
2649         (WebCore::jsTestActiveDOMObjectConstructor):
2650         (WebCore::setJSTestActiveDOMObjectConstructor):
2651         (WebCore::JSTestActiveDOMObject::toWrapped):
2652         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
2653         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2654         (WebCore::JSTestCEReactions::finishCreation):
2655         (WebCore::BindingCaller<JSTestCEReactions>::castForAttribute):
2656         (WebCore::BindingCaller<JSTestCEReactions>::castForOperation):
2657         (WebCore::jsTestCEReactionsConstructor):
2658         (WebCore::setJSTestCEReactionsConstructor):
2659         (WebCore::JSTestCEReactions::toWrapped):
2660         * bindings/scripts/test/JS/JSTestCEReactions.h:
2661         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2662         (WebCore::JSTestCEReactionsStringifier::finishCreation):
2663         (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForAttribute):
2664         (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForOperation):
2665         (WebCore::jsTestCEReactionsStringifierConstructor):
2666         (WebCore::setJSTestCEReactionsStringifierConstructor):
2667         (WebCore::JSTestCEReactionsStringifier::toWrapped):
2668         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
2669         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2670         (WebCore::JSTestClassWithJSBuiltinConstructor::finishCreation):
2671         (WebCore::jsTestClassWithJSBuiltinConstructorConstructor):
2672         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
2673         (WebCore::JSTestClassWithJSBuiltinConstructor::toWrapped):
2674         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
2675         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2676         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::finishCreation):
2677         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
2678         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
2679         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped):
2680         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
2681         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2682         (WebCore::JSTestCustomNamedGetter::finishCreation):
2683         (WebCore::BindingCaller<JSTestCustomNamedGetter>::castForOperation):
2684         (WebCore::jsTestCustomNamedGetterConstructor):
2685         (WebCore::setJSTestCustomNamedGetterConstructor):
2686         (WebCore::JSTestCustomNamedGetter::toWrapped):
2687         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
2688         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2689         (WebCore::JSTestDOMJIT::finishCreation):
2690         (WebCore::BindingCaller<JSTestDOMJIT>::castForAttribute):
2691         (WebCore::BindingCaller<JSTestDOMJIT>::castForOperation):
2692         (WebCore::jsTestDOMJITConstructor):
2693         (WebCore::setJSTestDOMJITConstructor):
2694         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2695         (WebCore::JSTestEventConstructor::finishCreation):
2696         (WebCore::BindingCaller<JSTestEventConstructor>::castForAttribute):
2697         (WebCore::jsTestEventConstructorConstructor):
2698         (WebCore::setJSTestEventConstructorConstructor):
2699         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2700         (WebCore::JSTestEventTarget::finishCreation):
2701         (WebCore::BindingCaller<JSTestEventTarget>::castForOperation):
2702         (WebCore::jsTestEventTargetConstructor):
2703         (WebCore::setJSTestEventTargetConstructor):
2704         (WebCore::JSTestEventTarget::toWrapped):
2705         * bindings/scripts/test/JS/JSTestEventTarget.h:
2706         * bindings/scripts/test/JS/JSTestException.cpp:
2707         (WebCore::JSTestException::finishCreation):
2708         (WebCore::BindingCaller<JSTestException>::castForAttribute):
2709         (WebCore::jsTestExceptionConstructor):
2710         (WebCore::setJSTestExceptionConstructor):
2711         (WebCore::JSTestException::toWrapped):
2712         * bindings/scripts/test/JS/JSTestException.h:
2713         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2714         (WebCore::JSTestGenerateIsReachable::finishCreation):
2715         (WebCore::jsTestGenerateIsReachableConstructor):
2716         (WebCore::setJSTestGenerateIsReachableConstructor):
2717         (WebCore::JSTestGenerateIsReachable::toWrapped):
2718         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
2719         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2720         (WebCore::JSTestGlobalObject::finishCreation):
2721         (WebCore::BindingCaller<JSTestGlobalObject>::castForAttribute):
2722         (WebCore::BindingCaller<JSTestGlobalObject>::castForOperation):
2723         (WebCore::jsTestGlobalObjectConstructor):
2724         (WebCore::setJSTestGlobalObjectConstructor):
2725         (WebCore::JSTestGlobalObject::toWrapped):
2726         * bindings/scripts/test/JS/JSTestGlobalObject.h:
2727         * bindings/scripts/test/JS/JSTestInterface.cpp:
2728         (WebCore::JSTestInterface::finishCreation):
2729         (WebCore::BindingCaller<JSTestInterface>::castForAttribute):
2730         (WebCore::BindingCaller<JSTestInterface>::castForOperation):
2731         (WebCore::jsTestInterfaceConstructor):
2732         (WebCore::setJSTestInterfaceConstructor):
2733         (WebCore::JSTestInterface::toWrapped):
2734         * bindings/scripts/test/JS/JSTestInterface.h:
2735         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2736         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
2737         (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute):
2738         (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
2739         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
2740         (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
2741         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
2742         * bindings/scripts/test/JS/JSTestIterable.cpp:
2743         (WebCore::JSTestIterable::finishCreation):
2744         (WebCore::BindingCaller<JSTestIterable>::castForOperation):
2745         (WebCore::jsTestIterableConstructor):
2746         (WebCore::setJSTestIterableConstructor):
2747         (WebCore::JSTestIterable::toWrapped):
2748         * bindings/scripts/test/JS/JSTestIterable.h:
2749         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2750         (WebCore::JSTestJSBuiltinConstructor::finishCreation):
2751         (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForAttribute):
2752         (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForOperation):
2753         (WebCore::jsTestJSBuiltinConstructorConstructor):
2754         (WebCore::setJSTestJSBuiltinConstructorConstructor):
2755         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2756         (WebCore::JSTestMediaQueryListListener::finishCreation):
2757         (WebCore::BindingCaller<JSTestMediaQueryListListener>::castForOperation):
2758         (WebCore::jsTestMediaQueryListListenerConstructor):
2759         (WebCore::setJSTestMediaQueryListListenerConstructor):
2760         (WebCore::JSTestMediaQueryListListener::toWrapped):
2761         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
2762         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2763         (WebCore::JSTestNamedConstructor::finishCreation):
2764         (WebCore::jsTestNamedConstructorConstructor):
2765         (WebCore::setJSTestNamedConstructorConstructor):
2766         (WebCore::JSTestNamedConstructor::toWrapped):
2767         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
2768         * bindings/scripts/test/JS/JSTestNode.cpp:
2769         (WebCore::JSTestNode::finishCreation):
2770         (WebCore::BindingCaller<JSTestNode>::castForAttribute):
2771         (WebCore::BindingCaller<JSTestNode>::castForOperation):
2772         (WebCore::jsTestNodeConstructor):
2773         (WebCore::setJSTestNodeConstructor):
2774         * bindings/scripts/test/JS/JSTestObj.cpp:
2775         (WebCore::JSTestObj::finishCreation):
2776         (WebCore::BindingCaller<JSTestObj>::castForAttribute):
2777         (WebCore::BindingCaller<JSTestObj>::castForOperation):
2778         (WebCore::jsTestObjConstructor):
2779         (WebCore::setJSTestObjConstructor):
2780         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
2781         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
2782         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion):
2783         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions):
2784         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion):
2785         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion):
2786         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter):
2787         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction):
2788         (WebCore::JSTestObj::toWrapped):
2789         * bindings/scripts/test/JS/JSTestObj.h:
2790         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2791         (WebCore::JSTestOverloadedConstructorsConstructor::construct):
2792         (WebCore::JSTestOverloadedConstructors::finishCreation):
2793         (WebCore::jsTestOverloadedConstructorsConstructor):
2794         (WebCore::setJSTestOverloadedConstructorsConstructor):
2795         (WebCore::JSTestOverloadedConstructors::toWrapped):
2796         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
2797         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2798         (WebCore::JSTestOverloadedConstructorsWithSequence::finishCreation):
2799         (WebCore::jsTestOverloadedConstructorsWithSequenceConstructor):
2800         (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor):
2801         (WebCore::JSTestOverloadedConstructorsWithSequence::toWrapped):
2802         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
2803         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2804         (WebCore::JSTestOverrideBuiltins::finishCreation):
2805         (WebCore::BindingCaller<JSTestOverrideBuiltins>::castForOperation):
2806         (WebCore::jsTestOverrideBuiltinsConstructor):
2807         (WebCore::setJSTestOverrideBuiltinsConstructor):
2808         (WebCore::JSTestOverrideBuiltins::toWrapped):
2809         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
2810         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2811         (WebCore::JSTestSerialization::finishCreation):
2812         (WebCore::BindingCaller<JSTestSerialization>::castForAttribute):
2813         (WebCore::BindingCaller<JSTestSerialization>::castForOperation):
2814         (WebCore::jsTestSerializationConstructor):
2815         (WebCore::setJSTestSerializationConstructor):
2816         (WebCore::JSTestSerialization::toWrapped):
2817         * bindings/scripts/test/JS/JSTestSerialization.h:
2818         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2819         (WebCore::JSTestSerializedScriptValueInterface::finishCreation):
2820         (WebCore::BindingCaller<JSTestSerializedScriptValueInterface>::castForAttribute):
2821         (WebCore::BindingCaller<JSTestSerializedScriptValueInterface>::castForOperation):
2822         (WebCore::jsTestSerializedScriptValueInterfaceConstructor):
2823         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
2824         (WebCore::JSTestSerializedScriptValueInterface::toWrapped):
2825         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
2826         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2827         (WebCore::JSTestTypedefs::finishCreation):
2828         (WebCore::BindingCaller<JSTestTypedefs>::castForAttribute):
2829         (WebCore::BindingCaller<JSTestTypedefs>::castForOperation):
2830         (WebCore::jsTestTypedefsConstructor):
2831         (WebCore::setJSTestTypedefsConstructor):
2832         (WebCore::JSTestTypedefs::toWrapped):
2833         * bindings/scripts/test/JS/JSTestTypedefs.h:
2834         * bridge/c/CRuntimeObject.cpp:
2835         (JSC::Bindings::CRuntimeObject::finishCreation):
2836         * bridge/c/c_instance.cpp:
2837         (JSC::Bindings::CRuntimeMethod::finishCreation):
2838         (JSC::Bindings::CInstance::invokeMethod):
2839         * bridge/c/c_utility.cpp:
2840         (JSC::Bindings::convertValueToNPVariant):
2841         * bridge/objc/ObjCRuntimeObject.mm:
2842         (JSC::Bindings::ObjCRuntimeObject::finishCreation):
2843         * bridge/objc/WebScriptObject.mm:
2844         (-[WebScriptObject setValue:forKey:]):
2845         (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
2846         * bridge/objc/objc_instance.mm:
2847         (ObjCRuntimeMethod::finishCreation):
2848         (ObjcInstance::invokeMethod):
2849         * bridge/objc/objc_runtime.mm:
2850         (JSC::Bindings::ObjcFallbackObjectImp::finishCreation):
2851         (JSC::Bindings::callObjCFallbackObject):
2852         * bridge/runtime_array.cpp:
2853         (JSC::RuntimeArray::finishCreation):
2854         (JSC::RuntimeArray::lengthGetter):
2855         * bridge/runtime_method.cpp:
2856         (JSC::RuntimeMethod::finishCreation):
2857         (JSC::RuntimeMethod::lengthGetter):
2858         (JSC::callRuntimeMethod):
2859         * bridge/runtime_object.cpp:
2860         (JSC::Bindings::RuntimeObject::finishCreation):
2861         (JSC::Bindings::callRuntimeObject):
2862         (JSC::Bindings::callRuntimeConstructor):
2863         * css/FontFace.cpp:
2864         (WebCore::FontFace::create):
2865         * html/HTMLMediaElement.cpp:
2866         (WebCore::controllerJSValue):
2867         (WebCore::HTMLMediaElement::updateCaptionContainer):
2868         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
2869         * inspector/InspectorController.cpp:
2870         (WebCore::InspectorController::canAccessInspectedScriptState):
2871         * inspector/InspectorDOMAgent.cpp:
2872         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
2873         (WebCore::InspectorDOMAgent::scriptValueAsNode):
2874         * inspector/WebInjectedScriptHost.cpp:
2875         (WebCore::WebInjectedScriptHost::subtype):
2876         (WebCore::WebInjectedScriptHost::isHTMLAllCollection):
2877         * inspector/WebInjectedScriptHost.h:
2878
2879 2017-01-26  Dean Jackson  <dino@apple.com>
2880
2881         WebGL content in Safari sticks to GPU that it was started on, sometimes causing extra battery drain and difficulty interacting with UI
2882         https://bugs.webkit.org/show_bug.cgi?id=167477
2883         <rdar://problem/29956321>
2884
2885         Reviewed by Tim Horton.
2886
2887         We were not implementing the recommended approach to properly handle
2888         GPU switching, causing some contexts to remain on a GPU and slow
2889         down the machine's UI. It also could stop the discrete GPU from
2890         turning off.
2891
2892         Register for CGL's display reconfiguration notification, so that we
2893         can alert any active CGLContexts and cause them to update.
2894
2895         The code change here doesn't lend itself to automated testing because
2896         it is specific to hardware with multiple GPUs, relies on some separate
2897         tools to detect which GPU is active, and an external method of triggering
2898         a GPU switch. It's best tested by the manual workflow in Radar.
2899
2900         * platform/graphics/GraphicsContext3D.h: Add a macOS-specific update
2901         call.
2902         * platform/graphics/mac/GraphicsContext3DMac.mm:
2903         (WebCore::displayWasReconfigured): The callback for display reconfigurations.
2904         (WebCore::addActiveContext): Helper to keep track of active contexts, so we
2905         can register/unregister the callback when necessary.
2906         (WebCore::removeActiveContext):
2907         (WebCore::GraphicsContext3D::create): Use the new helpers.
2908         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2909         (WebCore::GraphicsContext3D::updateCGLContext): Tell the CGLContextRef to update.
2910
2911 2017-01-26  Commit Queue  <commit-queue@webkit.org>
2912
2913         Unreviewed, rolling out r210328.
2914         https://bugs.webkit.org/show_bug.cgi?id=167476
2915
2916         Blocking bug is fixed <rdar://problem/29957753> (Requested by
2917         keith_miller on #webkit).
2918
2919         Reverted changeset:
2920
2921         "Disable smooth playhead animation for main content media in
2922         the Touch Bar"
2923         https://bugs.webkit.org/show_bug.cgi?id=166715
2924         http://trac.webkit.org/changeset/210328
2925
2926 2017-01-26  Joseph Pecoraro  <pecoraro@apple.com>
2927
2928         Web Inspector: iOS: Memory timeline shows impossible values for Page size (underflowed)
2929         https://bugs.webkit.org/show_bug.cgi?id=167468
2930         <rdar://problem/30099051>
2931
2932         Reviewed by Andreas Kling.
2933
2934         * page/cocoa/ResourceUsageThreadCocoa.mm:
2935         (WebCore::vmPageSize):
2936         This value matches the sysctl value we were attempting to access, and is
2937         the most appropriate when dealing with mach APIs, as we are using here.
2938
2939 2017-01-26  Jer Noble  <jer.noble@apple.com>
2940
2941         Autoplay muted videos stop playback of any streaming app in the background
2942         https://bugs.webkit.org/show_bug.cgi?id=163993
2943         <rdar://problem/29020431>
2944
2945         Reviewed by Eric Carlson.
2946
2947         Added test in TestWebKitAPI, WebKit1.AudioSessionCategoryIOS.
2948
2949         Previously, we would set the audio session category to "playback" if there was a media-
2950         element-type media session, and if there was a session capable of playing audio. But because
2951         this was an "or" operation, we would incorrectly set the category to "playback" if there was
2952         a video element incapable of rendering audio (due to being muted, without an audio track,
2953         etc.), and also a session capable of producing audio, such as WebAudio.
2954
2955         With this change, this turns into an "and" operation; there must be a media element capable
2956         of rendering audio in order to switch the audio session category to "playback".
2957
2958         Additionally, we no longer cache the value of "canProduceAudio()"; it's queried directly
2959         whenever updateSessionState() is called.
2960
2961         * Modules/webaudio/AudioContext.cpp:
2962         (WebCore::AudioContext::constructCommon):
2963         * Modules/webaudio/AudioContext.h:
2964         * html/HTMLMediaElement.cpp:
2965         (WebCore::HTMLMediaElement::insertedInto):
2966         (WebCore::HTMLMediaElement::loadResource):
2967         (WebCore::HTMLMediaElement::setMuted):
2968         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
2969         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2970         (WebCore::HTMLMediaElement::clearMediaPlayer):
2971         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
2972         (WebCore::HTMLMediaElement::presentationType):
2973         (WebCore::HTMLMediaElement::characteristics):
2974         (WebCore::HTMLMediaElement::canProduceAudio):
2975         * html/HTMLMediaElement.h:
2976         * platform/audio/PlatformMediaSession.cpp:
2977         (WebCore::PlatformMediaSession::activeAudioSessionRequired):
2978         (WebCore::PlatformMediaSession::canProduceAudio):
2979         (WebCore::PlatformMediaSession::canProduceAudioChanged):
2980         (WebCore::PlatformMediaSession::setCanProduceAudio): Deleted.
2981         * platform/audio/PlatformMediaSession.h:
2982         (WebCore::PlatformMediaSessionClient::canProduceAudio):
2983         (WebCore::PlatformMediaSession::canProduceAudio): Deleted.
2984         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2985         (PlatformMediaSessionManager::updateSessionState):
2986
2987 2017-01-26  Filip Pizlo  <fpizlo@apple.com>
2988
2989         EventTarget should visit the JSEventListeners using visitAdditionalChildren
2990         https://bugs.webkit.org/show_bug.cgi?id=167462
2991
2992         Reviewed by Michael Saboff.
2993
2994         No new tests because this is already caught by existing testing. This would show up as ASSERTs
2995         in debug, and we suspect it might be at fault for null deref crashes.
2996         
2997         Previously, EventTarget would have its event listeners visited by its subclasses' visitChildren
2998         methods. Every subclass of EventTarget would call EventTarget's visitJSEventListeners. For
2999         example, this means that if JSFoo has seven classes between it and JSEventTarget in the JSCell
3000         class hierarchy, then JSFoo::visitChildren would end up calling visitJSEventListeners seven extra
3001         times.
3002         
3003         Also, the weird way that visitJSEventListeners was called meant that it was not part of the GC's
3004         output constraint processing. This meant that it would not be called when the GC tried to
3005         terminate. So, if something about the event listener changes during a GC cycle, the GC would
3006         potentially fail to mark one of the references.
3007         
3008         Both problems can be solved by simply moving the call to visitJSEventListeners into
3009         visitAdditionalChildren.
3010
3011         * bindings/js/JSDOMWindowCustom.cpp:
3012         (WebCore::JSDOMWindow::visitAdditionalChildren):
3013         * bindings/js/JSEventTargetCustom.cpp:
3014         (WebCore::JSEventTarget::visitAdditionalChildren):
3015         * bindings/scripts/CodeGeneratorJS.pm:
3016         (GenerateImplementation):
3017         * dom/EventTarget.idl:
3018
3019 2017-01-26  Andy Estes  <aestes@apple.com>
3020
3021         [QuickLook] Create temporary files with NSFileProtectionCompleteUnlessOpen
3022         https://bugs.webkit.org/show_bug.cgi?id=167455
3023         <rdar://problem/12499118>
3024
3025         Reviewed by David Kilzer.
3026
3027         Add the NSFileProtectionKey attribute with value NSFileProtectionCompleteUnlessOpen to
3028         temporary directories created for QuickLook files. Also:
3029
3030         1. Stop calling -[NSFileManager _web_pathWithUniqueFilenameForPath:], since the temporary
3031         directory is already unique and only one file will be placed inside it.
3032         2. Create the temporary file with -[NSFileManager _web_createFileAtPath:contents:attributes:]
3033         instead of with -[NSFileManager _web_createFileAtPathWithIntermediateDirectories:contents:attributes:directoryAttributes:],
3034         since the intermediate directories were already created by createTemporaryDirectory().
3035         3. Explicitly set the temporary directory's attributes with
3036         -[NSFileManager setAttributes:ofItemAtPath:error:].
3037         4. Append the lastPathComponent of fileName to downloadDirectory to ensure fileName isn't
3038         really a relative path.
3039
3040         * loader/ios/QuickLook.h: Stopped declaring QLFileAttributes() and QLDirectoryAttributes().
3041         * loader/ios/QuickLook.mm:
3042         (WebCore::temporaryFileAttributes): Renamed from QLFileAttributes().
3043         (WebCore::temporaryDirectoryAttributes): Renamed from QLDirectoryAttributes().
3044         (WebCore::createTemporaryFileForQuickLook):
3045         (WebCore::QLFileAttributes): Deleted.
3046         (WebCore::QLDirectoryAttributes): Deleted.
3047         * platform/spi/cocoa/NSFileManagerSPI.h: Declared -_web_createFileAtPath:contents:attributes:
3048         and removed declarations for -_web_createFileAtPathWithIntermediateDirectories:contents:attributes:directoryAttributes:
3049         and -_web_pathWithUniqueFilenameForPath:
3050
3051 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
3052
3053         Pointer lock events should be delivered directly to the target element
3054         https://bugs.webkit.org/show_bug.cgi?id=167134
3055
3056         Reviewed by Jon Lee.
3057
3058         pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests.
3059
3060         When pointer is locked on an element, route mouse events directly to the target element, instead of 
3061         doing the normal event disptach.
3062
3063         * page/EventHandler.cpp:
3064         (WebCore::EventHandler::handleMousePressEvent):
3065         (WebCore::EventHandler::handleMouseDoubleClickEvent):
3066         (WebCore::EventHandler::handleMouseMoveEvent):
3067         (WebCore::EventHandler::handleMouseReleaseEvent):
3068         (WebCore::EventHandler::handleMouseForceEvent):
3069         (WebCore::EventHandler::handleWheelEvent):
3070         * page/PointerLockController.cpp:
3071         (WebCore::PointerLockController::isLocked): Added.
3072         (WebCore::PointerLockController::dispatchLockedWheelEvent): Added.
3073         * page/PointerLockController.h:
3074
3075 2017-01-26  Chris Dumez  <cdumez@apple.com>
3076
3077         Fix CPU / Memory diagnostic logging in PerformanceMonitor
3078         https://bugs.webkit.org/show_bug.cgi?id=167469
3079         <rdar://problem/30220959>
3080
3081         Reviewed by Alex Christensen.
3082
3083         Fix CPU / Memory diagnostic logging in PerformanceMonitor to use logDiagnosticMessage()
3084         instead of logDiagnosticMessageWithValue(). logDiagnosticMessageWithValue() should only
3085         be used with numeric values but we already take care of the bucketing on our side.
3086
3087         * page/DiagnosticLoggingClient.h:
3088         * page/DiagnosticLoggingKeys.cpp:
3089         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey):
3090         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey):
3091         (WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey):
3092         (WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey):
3093         (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey):
3094         (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey):
3095         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey): Deleted.
3096         (WebCore::DiagnosticLoggingKeys::postPageLoadKey): Deleted.
3097         (WebCore::DiagnosticLoggingKeys::memoryUsageKey): Deleted.
3098         * page/DiagnosticLoggingKeys.h:
3099         * page/PerformanceMonitor.cpp:
3100         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
3101         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
3102         (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
3103         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
3104
3105 2017-01-26  Brady Eidson  <beidson@apple.com>
3106
3107         Gamepads: Some DPads are still not exposed in the HID backend.
3108         rdar://problem/30217518 and https://bugs.webkit.org/show_bug.cgi?id=167465
3109
3110         Reviewed by Alex Christensen.
3111
3112         No new tests (Currently unable to test HID backend directly)
3113
3114         * platform/gamepad/mac/HIDGamepad.cpp:
3115         (WebCore::HIDGamepad::maybeAddButton): Allow GenericDesktop paged elements that are DPads to be buttons.
3116
3117 2017-01-26  Commit Queue  <commit-queue@webkit.org>
3118
3119         Unreviewed, rolling out r210095.
3120         https://bugs.webkit.org/show_bug.cgi?id=167464
3121
3122         broke tiling on mac (Requested by thorton on #webkit).
3123
3124         Reverted changeset:
3125
3126         "TileGrid revalidates tiles twice during flush, first with
3127         wrong visible rect"
3128         https://bugs.webkit.org/show_bug.cgi?id=166406
3129         http://trac.webkit.org/changeset/210095
3130
3131 2017-01-26  Chris Dumez  <cdumez@apple.com>
3132
3133         Fix WebGL diagnostic logging
3134         https://bugs.webkit.org/show_bug.cgi?id=167463
3135         <rdar://problem/30216981>
3136
3137         Reviewed by Alex Christensen.
3138
3139         Fix WebGL diagnostic logging so that it no longer uses logDiagnosticMessageWithValue().
3140         This is because the value apparently needs to be numeric on Mac.
3141
3142         * html/canvas/WebGLRenderingContextBase.cpp:
3143         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
3144         * page/DiagnosticLoggingKeys.cpp:
3145         (WebCore::DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey):
3146         (WebCore::WebCore::DiagnosticLoggingKeys::webGLStateKey):
3147         (WebCore::DiagnosticLoggingKeys::stateKey): Deleted.
3148         (WebCore::DiagnosticLoggingKeys::handlesContextLossKey): Deleted.
3149         (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey): Deleted.
3150         * page/DiagnosticLoggingKeys.h:
3151
3152 2017-01-26  Zalan Bujtas  <zalan@apple.com>
3153
3154         Simple line layout: Add support for -webkit-hyphenate-limit-lines
3155         https://bugs.webkit.org/show_bug.cgi?id=167446
3156         <rdar://problem/30194030>
3157
3158         Reviewed by Antti Koivisto.
3159
3160         Now we can set the limit on the number of lines that a word can split across through hyphenation.
3161
3162         Tests: fast/text/simple-line-layout-hyphen-limit-lines.html
3163                fast/text/simple-line-layout-hyphen-limit-lines2.html
3164
3165         * rendering/SimpleLineLayout.cpp:
3166         (WebCore::SimpleLineLayout::canUseForStyle):
3167         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
3168         (WebCore::SimpleLineLayout::printReason):
3169         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3170         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
3171         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3172         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::TextFragment):
3173         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::wrappingWithHyphenCounter):
3174         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen): The right side of the split has +1 on the wrapping counter.
3175
3176 2017-01-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3177
3178         Add support for recognizing data interaction gestures in WebKit2
3179         https://bugs.webkit.org/show_bug.cgi?id=167444
3180
3181         Reviewed by Beth Dakin.
3182
3183         Minor tweaks to pasteboard code to support data interaction.
3184
3185         * WebCore.xcodeproj/project.pbxproj:
3186         * platform/PlatformPasteboard.h:
3187         * platform/ios/PasteboardIOS.mm:
3188         (WebCore::Pasteboard::read):
3189         * platform/ios/PlatformPasteboardIOS.mm:
3190         (WebCore::PlatformPasteboard::PlatformPasteboard):
3191
3192         If the pasteboard is the special data interaction type, use the shared item provider pasteboard; otherwise,
3193         fall back to the general pasteboard.
3194
3195         (WebCore::PlatformPasteboard::getTypes):
3196
3197         Actually populate the list of available types using available pasteboardTypes.
3198
3199         (WebCore::PlatformPasteboard::write):
3200
3201         Add UTF8 plaintext type (kUTTypeUTF8PlainText) when vending data representations of rich text.
3202
3203         * platform/ios/WebItemProviderPasteboard.mm:
3204         (-[WebItemProviderPasteboard setItems:]):
3205         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
3206         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3207
3208         Move off of deprecated methods when retrieving and supplying data to the item provider pasteboard.
3209
3210         * platform/spi/ios/UIKitSPI.h:
3211
3212 2017-01-26  Matt Rajca  <mrajca@apple.com>
3213
3214         Notify clients when the user plays media otherwise prevented from autoplaying
3215         https://bugs.webkit.org/show_bug.cgi?id=167390
3216
3217         Reviewed by Alex Christensen.
3218
3219         The API is tested.
3220
3221         * html/HTMLMediaElement.cpp:
3222         (WebCore::HTMLMediaElement::playInternal):
3223         * page/ChromeClient.h:
3224
3225 2017-01-26  Enrique Ocaña González  <eocanha@igalia.com>
3226
3227         [GStreamer] ASSERTION FAILED: !g_object_is_floating(ptr) in adoptGRef(GstContext* ptr)
3228         https://bugs.webkit.org/show_bug.cgi?id=167458
3229
3230         Reviewed by Xabier Rodriguez-Calvar.
3231
3232         GstContext is a mini_object, not a GObject. Therefore it shouldn't (and can't) be checked for floatingness.
3233
3234         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
3235         (WTF::adoptGRef): Removed incorrect assertion.
3236
3237 2017-01-26  Zalan Bujtas  <zalan@apple.com>
3238
3239         Simple line layout: Add support for -webkit-hyphenate-limit-after and -webkit-hyphenate-limit-before
3240         https://bugs.webkit.org/show_bug.cgi?id=167439
3241         <rdar://problem/30180184>
3242
3243         Reviewed by Antti Koivisto.
3244
3245         Implement pre and post hyphen length constrains for simple line layout.
3246
3247         Tests: fast/text/simple-line-layout-hyphen-limit-after.html
3248                fast/text/simple-line-layout-hyphen-limit-before.html
3249
3250         * rendering/SimpleLineLayout.cpp:
3251         (WebCore::SimpleLineLayout::canUseForStyle):
3252         (WebCore::SimpleLineLayout::printReason):
3253         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3254         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): Same as normal line layout default values.
3255         (WebCore::SimpleLineLayout::TextFragmentIterator::lastHyphenPosition):
3256         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3257
3258 2017-01-26  Brady Eidson  <beidson@apple.com>
3259
3260         Gamepad support shows wrong values for PS4 controllers (D-pad is missing).
3261         <rdar://problem/29578619> and https://bugs.webkit.org/show_bug.cgi?id=165588
3262
3263         Reviewed by Alex Christensen.
3264
3265         No new tests (Currently unable to test HID backend directly)
3266
3267         DPads report their HID type as "a button", but their HID usage is "Hatswitch".
3268         This patch adds a new element type that maps a "hatswitch" value to 4 additional buttons.
3269         
3270         * platform/gamepad/mac/HIDGamepad.cpp:
3271         (WebCore::HIDGamepad::initElements):
3272         (WebCore::HIDGamepad::initElementsFromArray):
3273         (WebCore::HIDGamepad::maybeAddButton):
3274         (WebCore::HIDGamepad::maybeAddDPad):
3275         (WebCore::HIDGamepad::maybeAddAxis):
3276         (WebCore::fillInButtonValues):
3277         (WebCore::HIDGamepad::valueChanged):
3278
3279         * platform/gamepad/mac/HIDGamepad.h:
3280         (WebCore::HIDGamepadElement::isDPad):
3281         (WebCore::HIDGamepadDPad::HIDGamepadDPad):
3282         (WebCore::HIDGamepadDPad::normalizedValue):
3283
3284 2017-01-26  Antoine Quint  <graouts@apple.com>
3285
3286         [Modern Media Controls] Hiding controls, changing their width and showing them again shows an incorrect layout
3287         https://bugs.webkit.org/show_bug.cgi?id=167160
3288         <rdar://problem/29612318>
3289
3290         Reviewed by Dean Jackson.
3291
3292         When we toggle visibility of the controls bar, we notify the hosting media controls and in the case of the
3293         macOS inline media controls, we update the controls layout which would have failed to run last time it tried
3294         due to the controls bar being hidden.
3295
3296         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-resize-with-hidden-controls-bar.html
3297
3298         * Modules/modern-media-controls/controls/controls-bar.js:
3299         (ControlsBar.prototype.set visible):
3300         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3301         (MacOSInlineMediaControls.prototype.controlsBarVisibilityDidChange):
3302         * Modules/modern-media-controls/controls/media-controls.js:
3303         (MediaControls.prototype.controlsBarVisibilityDidChange):
3304
3305 2017-01-26  Csaba Osztrogonác  <ossy@webkit.org>
3306
3307         [Mac][cmake] Unreviewed speculative buildfix after r211161.
3308         https://bugs.webkit.org/show_bug.cgi?id=167294
3309
3310         * PlatformMac.cmake:
3311
3312 2017-01-26  Zan Dobersek  <zdobersek@igalia.com>
3313
3314         ImageBufferCairo: cairo_image_surface should use bmalloc-allocated memory
3315         https://bugs.webkit.org/show_bug.cgi?id=165751
3316
3317         Reviewed by Carlos Garcia Campos.
3318
3319         Allocate the underlying memory for cairo_image_surface objects through FastMalloc.
3320         This way we can steer such large allocations away from the default libc allocator.
3321
3322         Objects of this class can create Cairo surfaces that need as much as 4MB of memory
3323         for the underlying pixel buffer. Allocating such objects through the default
3324         libc allocator can lead to increased memory usage because of non-optimal allocation
3325         strategy in libc. In contrast, bmalloc performs large allocations by directly using
3326         mmap() to reserve the necessary memory.
3327
3328         The improvements can be significant. On nytimes.com, with the threaded version of
3329         the CoordinatedGraphics system, the memory consumption can drop by roughly 20%.
3330
3331         * platform/graphics/cairo/ImageBufferCairo.cpp:
3332         (WebCore::ImageBuffer::ImageBuffer): Zero-allocate the necessary memory via FastMalloc.
3333         Tie that memory lifetime to the lifetime of the surface by using
3334         cairo_surface_set_user_data() with the specific user data key.
3335
3336 2017-01-26  Miguel Gomez  <magomez@igalia.com>
3337
3338         [GTK] WebProcess from WebKitGtk+ 2.15.3 SIGSEVs in WebCore::GraphicsContext3D::drawArrays(unsigned int, int, int) at Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:740
3339         https://bugs.webkit.org/show_bug.cgi?id=167296
3340
3341         Reviewed by Sergio Villar Senin.
3342
3343         Use a VBO to pass the vertex data when using the stencil for clipping. Passing a custom array without
3344         using an VBO is deprecated when using OpenGL >= 3.0 and a Core profile.
3345
3346         No behaviour change, no new tests.
3347
3348         * platform/graphics/texmap/TextureMapperGL.cpp:
3349         (WebCore::TextureMapperGL::beginClip):
3350
3351 2017-01-25  Ryosuke Niwa  <rniwa@webkit.org>
3352
3353         Crash under DOMSelection::deleteFromDocument()
3354         https://bugs.webkit.org/show_bug.cgi?id=167232
3355
3356         Reviewed by Chris Dumez.
3357
3358         The crash was caused by DOMSelection's deleteFromDocument() mutating contents inside the user-agent
3359         shadow tree of an input element when the text field is readonly. Fixed the bug by exiting early
3360         whenever the selection is inside a shadow tree since getSelection().getRangeAt(0) always returns
3361         a range outside the input element or any shadow tree for that matter.
3362
3363         New behavior matches that of Gecko. The working draft spec of which I'm the editor states that
3364         deleteFromDocument() must invoke Range's deleteContents() on the associated range, which is
3365         the collapsed range returned by getSelection().getRangeAt(0) in the spec:
3366         https://www.w3.org/TR/2016/WD-selection-api-20160921/#widl-Selection-deleteFromDocument-void
3367         And Range's deleteContents() immediately terminates in step 1 when start and end are identical:
3368         https://dom.spec.whatwg.org/commit-snapshots/6b7621282c2e3b222ac585650e484abf4c0a416b/
3369
3370         Note that Range's DOM mutating methods are not available inside an user-agent shadow tree because
3371         WebKit never returns a Range whose end boundary points are inside the tree to author scripts.
3372         Editing commands (ones executable from document.execCommand) that mutate DOM like this check whether
3373         the content is editable or not. Since VisibleSelection's validate() function makes sure the selection
3374         is either entirely within or outside of an root editable element (editing host in the W3C spec lingo),
3375         editing commands should never mutate a random node inside an user-agent shadow tree.
3376
3377         Test: editing/selection/deleteFromDocument-shadow-tree-crash.html
3378
3379         * page/DOMSelection.cpp:
3380         (WebCore::DOMSelection::deleteFromDocument):
3381
3382 2017-01-25  Ryan Haddad  <ryanhaddad@apple.com>
3383
3384         Unreviewed, rolling out r211193.
3385
3386         This change broke internal builds.
3387
3388         Reverted changeset:
3389
3390         "Notify clients when the user plays media otherwise prevented
3391         from autoplaying"
3392         https://bugs.webkit.org/show_bug.cgi?id=167390
3393         http://trac.webkit.org/changeset/211193
3394
3395 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3396
3397         Add infrastructure to support data interaction in WebKit2
3398         https://bugs.webkit.org/show_bug.cgi?id=167443
3399
3400         Reviewed by Simon Fraser.
3401
3402         Adds support in WebCore to determine whether there is interactive data at a given position. No new tests, since
3403         there should be no behavior change yet.
3404
3405         * page/EventHandler.h:
3406         * page/Page.cpp:
3407         (WebCore::Page::hasDataInteractionAtPosition):
3408         * page/Page.h:
3409
3410 2017-01-25  Matt Rajca  <mrajca@apple.com>
3411
3412         Notify clients when the user plays media otherwise prevented from autoplaying
3413         https://bugs.webkit.org/show_bug.cgi?id=167390
3414
3415         Reviewed by Alex Christensen.
3416
3417         The API is tested.
3418
3419         * html/HTMLMediaElement.cpp:
3420         (WebCore::HTMLMediaElement::playInternal):
3421         * page/ChromeClient.h:
3422
3423 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3424
3425         Refactor drag and drop implementation on Mac
3426         https://bugs.webkit.org/show_bug.cgi?id=167427
3427
3428         Reviewed by Enrica Casucci.
3429
3430         Refactors some code around drag and drop on Mac, and cleans up some other related code as needed. This patch
3431         should result in no behavior change.
3432
3433         * dom/DataTransfer.cpp:
3434         * page/EventHandler.cpp:
3435         * page/ios/EventHandlerIOS.mm:
3436         (WebCore::EventHandler::eventLoopHandleMouseDragged):
3437         * page/mac/EventHandlerMac.mm:
3438         * platform/DragImage.cpp:
3439         * platform/Pasteboard.h:
3440         * platform/ios/DragImageIOS.mm:
3441         * platform/ios/PasteboardIOS.mm:
3442         * platform/mac/DragDataMac.mm:
3443         (rtfPasteboardType):
3444         (rtfdPasteboardType):
3445         (stringPasteboardType):
3446         (urlPasteboardType):
3447         (htmlPasteboardType):
3448         (colorPasteboardType):
3449         (pdfPasteboardType):
3450         (tiffPasteboardType):
3451         (WebCore::DragData::DragData):
3452         (WebCore::DragData::containsColor):
3453         (WebCore::DragData::containsFiles):
3454         (WebCore::DragData::numberOfFiles):
3455         (WebCore::DragData::asFilenames):
3456         (WebCore::DragData::containsPlainText):
3457         (WebCore::DragData::containsCompatibleContent):
3458         (WebCore::DragData::containsPromise):
3459         (WebCore::DragData::asURL):
3460         * platform/mac/DragImageMac.mm:
3461
3462 2017-01-25  Youenn Fablet  <youenn@apple.com>
3463
3464         [WebRTC] Add support for incoming and outgoing libwebrtc audio tracks
3465         https://bugs.webkit.org/show_bug.cgi?id=167438
3466
3467         Reviewed by Eric Carlson.
3468
3469         RealtimeIncomingAudioSource consumes audio buffers given by libwebrtc.
3470         RealtimeOutgoingAudioSource consumes audio buffers from WebCore tracks (capture typically) and feeds libwebrtc with them.
3471         To be covered by Layout/mock tests once LibWebRTC peer connection will be added.
3472         These are only skeletons right now, the conversion between WebCore and LibWebRTC data is not yet implemented.
3473
3474         * WebCore.xcodeproj/project.pbxproj:
3475         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp: Added.
3476         (WebCore::RealtimeIncomingAudioSource::create):
3477         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
3478         (WebCore::RealtimeIncomingAudioSource::OnData):
3479         (WebCore::RealtimeIncomingAudioSource::startProducingData):
3480         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
3481         (WebCore::RealtimeIncomingAudioSource::capabilities):
3482         (WebCore::RealtimeIncomingAudioSource::settings):
3483         (WebCore::RealtimeIncomingAudioSource::supportedConstraints):
3484         (WebCore::RealtimeIncomingAudioSource::addObserver):
3485         (WebCore::RealtimeIncomingAudioSource::removeObserver):
3486         (WebCore::RealtimeIncomingAudioSource::start):
3487         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
3488         * platform/mediastream/mac/RealtimeIncomingAudioSource.h: Added.
3489         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: Added.
3490         (WebCore::RealtimeOutgoingAudioSource::sourceHasMoreMediaData):
3491         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: Added.
3492
3493 2017-01-25  Youenn Fablet  <youenn@apple.com>
3494
3495         [WebRTC] Add support for libwebrtc video incoming and outgoing video tracks
3496         https://bugs.webkit.org/show_bug.cgi?id=167432
3497
3498         Reviewed by Eric Carlson.
3499
3500         Not covered by tests right now, this will be covered by layout/mock tests.
3501         RealtimeIncomingVideoSource consumes video frames given by libwebrtc.
3502         RealtimeOutgoingVideoSource consumes video frames from WebCore tracks (capture typically) and feeds libwebrtc with them.
3503
3504         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp: Added.
3505         (WebCore::RealtimeIncomingVideoSource::create):
3506         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
3507         (WebCore::RealtimeIncomingVideoSource::startProducingData):
3508         (WebCore::RealtimeIncomingVideoSource::stopProducingData):
3509         (WebCore::RealtimeIncomingVideoSource::OnFrame):
3510         (WebCore::RealtimeIncomingVideoSource::processNewSample):
3511         (WebCore::drawImage):
3512         (WebCore::RealtimeIncomingVideoSource::currentFrameImage):
3513         (WebCore::RealtimeIncomingVideoSource::paintCurrentFrameInContext):
3514         (WebCore::RealtimeIncomingVideoSource::capabilities):
3515         (WebCore::RealtimeIncomingVideoSource::settings):
3516         (WebCore::RealtimeIncomingVideoSource::supportedConstraints):
3517         * platform/mediastream/mac/RealtimeIncomingVideoSource.h: Added.
3518         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: Added.
3519         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
3520         (WebCore::RealtimeOutgoingVideoSource::GetStats):
3521         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
3522         (WebCore::RealtimeOutgoingVideoSource::RemoveSink):
3523         (WebCore::RealtimeOutgoingVideoSource::sourceHasMoreMediaData):
3524         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: Added.
3525
3526 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3527
3528         Introduce an item-provider-based pasteboard wrapper
3529         https://bugs.webkit.org/show_bug.cgi?id=167410
3530
3531         Reviewed by Enrica Casucci.
3532
3533         Introduces WebItemProviderPasteboard, a pasteboard-like object backed by a number of item providers. No new
3534         tests, since there is no behavior change.
3535
3536         * WebCore.xcodeproj/project.pbxproj:
3537         * platform/ios/AbstractPasteboard.h: Copied from Source/WebCore/platform/spi/ios/UIKitSPI.h.
3538         * platform/ios/WebItemProviderPasteboard.h: Copied from Source/WebCore/platform/spi/ios/UIKitSPI.h.
3539         * platform/ios/WebItemProviderPasteboard.mm: Added.
3540         (isRichTextType):
3541         (isStringType):
3542         (isURLType):
3543         (isColorType):
3544         (isImageType):
3545         (+[WebItemProviderPasteboard sharedInstance]):
3546         (-[WebItemProviderPasteboard init]):
3547         (-[WebItemProviderPasteboard dealloc]):
3548         (-[WebItemProviderPasteboard pasteboardTypes]):
3549         (-[WebItemProviderPasteboard setItemProviders:]):
3550         (-[WebItemProviderPasteboard numberOfItems]):
3551         (-[WebItemProviderPasteboard setItems:]):
3552         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
3553         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3554         (-[WebItemProviderPasteboard changeCount]):
3555         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
3556         * platform/spi/ios/UIKitSPI.h:
3557
3558 2017-01-25  Konstantin Tokarev  <annulen@yandex.ru>
3559
3560         Removed leftovers of pre-2015 VisualStudio support
3561         https://bugs.webkit.org/show_bug.cgi?id=167434
3562
3563         Reviewed by Alex Christensen.
3564
3565         No new tests needed.
3566
3567         * platform/graphics/filters/FEConvolveMatrix.cpp: Replaced MSC_VER
3568         usage with COMPILER(MSVC)
3569
3570 2017-01-25  Youenn Fablet  <youenn@apple.com>
3571
3572         Fixing typos in r211161
3573         https://bugs.webkit.org/show_bug.cgi?id=167433
3574
3575         Reviewed by Alex Christensen.
3576
3577         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3578
3579 2017-01-25  Simon Fraser  <simon.fraser@apple.com>
3580
3581         Revert r210882, removing support for background-repeat-x/y
3582         https://bugs.webkit.org/show_bug.cgi?id=167223
3583
3584         Reviewed by Myles C. Maxfield.
3585         
3586         Followup from r211149; I missed part of the patch when committing.
3587
3588         * css/parser/CSSParserFastPaths.cpp:
3589         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3590
3591 2017-01-25  Youenn Fablet  <youennf@gmail.com>
3592
3593         [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
3594         https://bugs.webkit.org/show_bug.cgi?id=167294
3595
3596         Reviewed by Alex Christensen.
3597
3598         Introducing LibWebRTCMacros.h which should be included before any libwebrtc header.
3599
3600         Introducing LibWebRTCProvider as the abstraction allowing to suport WK1 and WK2 libwebrtc-based WebRTC endpoints.
3601         It  will create a libwebrtc peerconnection object differently in WK1 and WK2 as networking will be done differently.
3602
3603         LibWebRTCUtils contains routines used by WK1 and WK2 RTC providers to create the libwebrtc peerconnection object
3604         and implement the necessary functionalities for it.
3605
3606         Updating PageConfiguration accordingly.
3607
3608         * WebCore.xcodeproj/project.pbxproj:
3609         * page/Page.cpp:
3610         (WebCore::Page::Page):
3611         * page/Page.h:
3612         (WebCore::Page::libWebRTCProvider):
3613         * page/PageConfiguration.cpp:
3614         (WebCore::PageConfiguration::PageConfiguration):
3615         * page/PageConfiguration.h:
3616         * platform/mediastream/libwebrtc/LibWebRTCMacros.h: Added.
3617         * platform/mediastream/libwebrtc/LibWebRTCProvider.h: Added.
3618         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp: Added.
3619         (WebCore::staticFactoryAndThreads):
3620         (WebCore::ThreadMessageData::ThreadMessageData):
3621         (WebCore::PeerConnectionFactoryAndThreads::OnMessage):
3622         (WebCore::callOnWebRTCNetworkThread):
3623         (WebCore::initializePeerConnectionFactoryAndThreads):
3624         (WebCore::initializeLibWebRTCInternalsWithSocketServer):
3625         (WebCore::peerConnectionFactory):
3626         (WebCore::createPeerConnection):
3627         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Added.
3628         * svg/graphics/SVGImage.cpp:
3629         (WebCore::SVGImage::dataChanged):
3630
3631 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3632
3633         Add support for named pasteboards, pasteboard strategies and platform pasteboards
3634         https://bugs.webkit.org/show_bug.cgi?id=167404
3635
3636         Reviewed by Enrica Casucci.
3637
3638         Refactors some pasteboard-related code to plumb the name of the pasteboard across from WebCore to the client
3639         layer. No new tests, because there should be no change in behavior.
3640
3641         * platform/DragData.h:
3642         * platform/Pasteboard.h:
3643         * platform/PasteboardStrategy.h:
3644         * platform/PlatformPasteboard.h:
3645         * platform/ios/PasteboardIOS.mm:
3646         (WebCore::Pasteboard::Pasteboard):
3647         (WebCore::Pasteboard::write):
3648         (WebCore::Pasteboard::writePlainText):
3649         (WebCore::Pasteboard::read):
3650         (WebCore::Pasteboard::hasData):
3651         (WebCore::Pasteboard::clear):
3652         (WebCore::Pasteboard::readString):
3653         (WebCore::Pasteboard::writeString):
3654         (WebCore::Pasteboard::types):
3655
3656 2017-01-25  Antoine Quint  <graouts@apple.com>
3657
3658         LayoutTest media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html is flaky
3659         https://bugs.webkit.org/show_bug.cgi?id=167253
3660
3661         Reviewed by Jon Lee.
3662
3663         An IconButton loads its image asynchronously and waits for its load to obtain metrics. Once that happens,
3664         its layout delegate needs to be notified that it needs a new layout. The test was a flaky failure because
3665         the images would sometime load prior to layout, and sometime after, which would cause a failure. The test
3666         is now robust with a controls layout happening after all buttons had loaded.
3667
3668         * Modules/modern-media-controls/controls/icon-button.js:
3669         (IconButton.prototype._updateImage):
3670         (IconButton):
3671
3672 2017-01-25  Timothy Hatcher  <timothy@hatcher.name>
3673
3674         Fix the !HAVE(ACCESSIBILITY) build by properly instantiating AXObjectCache member timers.
3675
3676         * accessibility/AXObjectCache.h:
3677         (WebCore::AXObjectCache::AXObjectCache):
3678
3679 2017-01-25  Chris Dumez  <cdumez@apple.com>
3680
3681         Measure how common it is for content to deal with WebGL context loss
3682         https://bugs.webkit.org/show_bug.cgi?id=166866
3683         <rdar://problem/30171195>
3684
3685         Reviewed by Alex Christensen.
3686
3687         Add diagnostic logging to measure how common it is for sites to handle
3688         WebGL context loss via the webglcontextlost & webglcontextrestored
3689         events.
3690
3691         * html/canvas/WebGLRenderingContextBase.cpp:
3692         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
3693         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
3694         * html/canvas/WebGLRenderingContextBase.h:
3695         * page/DiagnosticLoggingKeys.cpp:
3696         (WebCore::DiagnosticLoggingKeys::noKey):
3697         (WebCore::DiagnosticLoggingKeys::yesKey):
3698         (WebCore::DiagnosticLoggingKeys::handlesContextLossKey):
3699         * page/DiagnosticLoggingKeys.h:
3700
3701 2017-01-25  Simon Fraser  <simon.fraser@apple.com>
3702
3703         Revert r210882, removing support for background-repeat-x/y
3704         https://bugs.webkit.org/show_bug.cgi?id=167223
3705
3706         Reviewed by Myles Maxfield.
3707
3708         CSSPropertyBackgroundRepeatX and CSSPropertyBackgroundRepeatY only exist to make it easier
3709         to parse CSSPropertyBackgroundRepeat as if it were a shorthand; they were never intended to
3710         be web-exposed. r210882 mistakenly expose them to the web, so undo that patch, and annotate
3711         the properties in CSSProperties.json with a flag which indicates their special status.
3712
3713         In addition, remove background-repeat-x/y from the list of properties allowed in video cues,
3714         since these are not valid properties.
3715
3716         * css/CSSProperties.json:
3717         * css/StyleResolver.cpp:
3718         (WebCore::StyleResolver::isValidCueStyleProperty):
3719         * css/makeprop.pl:
3720         (addProperty):
3721         * css/parser/CSSParserFastPaths.cpp:
3722         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3723
3724 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3725
3726         [GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145
3727         https://bugs.webkit.org/show_bug.cgi?id=165656
3728
3729         Reviewed by Michael Catanzaro.
3730
3731         Also return the base error code from PlatformDisplayX11::supportsXDamage().
3732
3733         * platform/graphics/x11/PlatformDisplayX11.cpp:
3734         (WebCore::PlatformDisplayX11::supportsXDamage):
3735         * platform/graphics/x11/PlatformDisplayX11.h:
3736
3737 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3738
3739         Unreviewed. Fix 32 bit build after r211140.
3740
3741         Include glib-object.h instead of forward declaring GType.
3742
3743         * platform/network/soup/SoupNetworkSession.h:
3744
3745 2017-01-25  Miguel Gomez  <magomez@igalia.com>
3746
3747         [GTK] The inspector is broken when AC support is disabled
3748         https://bugs.webkit.org/show_bug.cgi?id=165237
3749
3750         Reviewed by Carlos Garcia Campos.
3751
3752         Ensure that PageOverlayController destroys its root GraphicsLayers when leaving AC. They
3753         will be recreated if we enter AC again, avoiding a crash because the layers don't belong to
3754         the appropriate compositor. Also, don't append the document overlay layers if we are not
3755         in compositing mode.
3756
3757         No new tests added.
3758
3759         * page/PageOverlayController.cpp:
3760         (WebCore::PageOverlayController::willDetachRootLayer):
3761         * page/PageOverlayController.h:
3762         * rendering/RenderLayerCompositor.cpp:
3763         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
3764         (WebCore::RenderLayerCompositor::detachRootLayer):
3765
3766 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3767
3768         [SOUP] Custom protocols don't work in private browsing mode
3769         https://bugs.webkit.org/show_bug.cgi?id=167236
3770
3771         Reviewed by Sergio Villar Senin.
3772
3773         Add static method to set the global custom protocols request type and setup method to add the feature to the session.
3774
3775         * platform/network/soup/SoupNetworkSession.cpp:
3776         (WebCore::SoupNetworkSession::SoupNetworkSession):
3777         (WebCore::SoupNetworkSession::setCustomProtocolRequestType):
3778         (WebCore::SoupNetworkSession::setupCustomProtocols):
3779         * platform/network/soup/SoupNetworkSession.h:
3780
3781 2017-01-25  Ryosuke Niwa  <rniwa@webkit.org>
3782
3783         collectMatchingElementsInFlatTree should not find elements inside an user agent shadow tree
3784         https://bugs.webkit.org/show_bug.cgi?id=167409
3785
3786         Reviewed by Antti Koivisto.
3787
3788         The bug was caused by collectMatchingElementsInFlatTree including elements inside an user agent shadow tree
3789         even though it shouldn't. Fixed the bug by checking that condition.
3790
3791         Also added matchingElementInFlatTree to find the first element matching a selector as opposed to all,
3792         again, only exposed in a world which forces all shadow trees to be accessible.
3793
3794         * page/DOMWindow.cpp:
3795         (WebCore::selectorQueryInFrame):
3796         (WebCore::DOMWindow::collectMatchingElementsInFlatTree):
3797         (WebCore::DOMWindow::matchingElementInFlatTree):
3798         * page/DOMWindow.h:
3799         * page/DOMWindow.idl:
3800
3801 2017-01-24  Alex Christensen  <achristensen@webkit.org>
3802
3803         REGRESSION (r208902): URLWithUserTypedString returns nil with file URLs
3804         https://bugs.webkit.org/show_bug.cgi?id=167402
3805         <rdar://problem/29896656>
3806
3807         Reviewed by Ryosuke Niwa.
3808
3809         Covered by a new API test.
3810
3811         * platform/mac/WebCoreNSURLExtras.mm:
3812         (WebCore::mapHostNameWithRange):
3813         uidna_IDNToASCII succeeds when length is 0.
3814         uidna_nameToASCII fails when length is 0.
3815         This causes bad things to happen with file URLs, which have no host, so their host length is 0.
3816         This makes us match behavior before r208902.
3817
3818 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3819
3820         Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature
3821         https://bugs.webkit.org/show_bug.cgi?id=167394
3822
3823         Reviewed by Ryosuke Niwa.
3824
3825         All of the Performance Timing specifications are highly coupled.
3826         So let make WEB_TIMING encompass them all:
3827
3828             - High Resolution Time (window.performance)
3829             - Performance Timeline (PerformanceEntry, PerformanceObserver)
3830             - Navigation Timing ("navigation" entries)
3831             - Resource Timing ("resource" entries)
3832             - User Timing ("mark" / "measure" entries)
3833
3834         We can then turn on and off individual pieces as runtime features,
3835         such as Resource Timing, User Timing, and Performance Observer.
3836
3837         * DerivedSources.make:
3838         * WebCore.xcodeproj/project.pbxproj:
3839         Add User Timing files that are now included in WEB_TIMING builds.
3840
3841         * page/RuntimeEnabledFeatures.h:
3842         (WebCore::RuntimeEnabledFeatures::setUserTimingEnabled):
3843         (WebCore::RuntimeEnabledFeatures::userTimingEnabled):
3844         Add a runtime feature for user timing. Disabled by default.
3845
3846         * Configurations/FeatureDefines.xcconfig:
3847         * PAL/Configurations/FeatureDefines.xcconfig:
3848         * bindings/js/JSPerformanceEntryCustom.cpp:
3849         (WebCore::toJSNewlyCreated):
3850         * page/Performance.cpp:
3851         (WebCore::Performance::getEntries):
3852         (WebCore::Performance::getEntriesByType):
3853         (WebCore::Performance::getEntriesByName):
3854         (WebCore::Performance::mark):
3855         (WebCore::Performance::clearMarks):
3856         (WebCore::Performance::measure):
3857         (WebCore::Performance::clearMeasures):
3858         (WebCore::Performance::webkitMark): Deleted.
3859         (WebCore::Performance::webkitClearMarks): Deleted.
3860         (WebCore::Performance::webkitMeasure): Deleted.
3861         (WebCore::Performance::webkitClearMeasures): Deleted.
3862         * page/Performance.h:
3863         * page/Performance.idl:
3864         * page/PerformanceMark.h:
3865         * page/PerformanceMark.idl:
3866         * page/PerformanceMeasure.h:
3867         * page/PerformanceMeasure.idl:
3868         * page/PerformanceUserTiming.cpp:
3869         * page/PerformanceUserTiming.h:
3870         Convert USER_TIMING to WEB_TIMING.
3871         Drop webkit prefixed legacy names.
3872
3873 2017-01-24  Antoine Quint  <graouts@apple.com>
3874
3875         LayoutTest media/modern-media-controls/tracks-panel/tracks-panel-hide.html is a flaky timeout
3876         https://bugs.webkit.org/show_bug.cgi?id=167311
3877
3878         Reviewed by Dean Jackson.
3879
3880         Ensure we have a chance to start the transition (on the next frame) before registering for an event
3881         tracking its completion.
3882
3883         * Modules/modern-media-controls/controls/tracks-panel.js:
3884         (TracksPanel.prototype.hide):
3885
3886 2017-01-24  Simon Fraser  <simon.fraser@apple.com>
3887
3888         [iOS WK2] Avoid IOSurface readback for snapshot creation
3889         https://bugs.webkit.org/show_bug.cgi?id=167397
3890         rdar://problem/30174873
3891
3892         Reviewed by Tim Horton.
3893
3894         Export sinkIntoImage().
3895
3896         * platform/graphics/cocoa/IOSurface.h:
3897
3898 2017-01-24  Brent Fulgham  <bfulgham@apple.com>
3899
3900         Bug 167392: REGRESSION(r210531): Relax same-volume display requirement for iOS
3901         https://bugs.webkit.org/show_bug.cgi?id=167392
3902         <rdar://problem/30074665>
3903
3904         Reviewed by Brady Eidson.
3905
3906         * page/SecurityOrigin.cpp:
3907         (WebCore::SecurityOrigin::canDisplay): Exclude the new check when building on iOS.
3908
3909 2017-01-24  Andreas Kling  <akling@apple.com>
3910
3911         Add memory footprint reporting using diagnostic logging.
3912         <https://webkit.org/b/167285>
3913         <rdar://problem/30151767>
3914
3915         Reviewed by Chris Dumez.
3916
3917         Add some basic logging of physical memory footprint post-load and post-backgrounding.
3918         The logging works similarly to the CPU usage logging, though with slightly longer
3919         delays to allow the measurement to stabilize.
3920
3921         * page/DiagnosticLoggingKeys.cpp:
3922         (WebCore::DiagnosticLoggingKeys::memoryUsageKey):
3923         (WebCore::DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey):
3924         * page/DiagnosticLoggingKeys.h:
3925         * page/PerformanceLogging.cpp:
3926         (WebCore::PerformanceLogging::physicalFootprint):
3927         * page/PerformanceLogging.h:
3928         * page/PerformanceMonitor.cpp:
3929         (WebCore::PerformanceMonitor::PerformanceMonitor):
3930         (WebCore::PerformanceMonitor::didFinishLoad):
3931         (WebCore::PerformanceMonitor::activityStateChanged):
3932         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
3933         (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
3934         * page/PerformanceMonitor.h:
3935         * page/Settings.h:
3936         (WebCore::Settings::isPostLoadMemoryUsageMeasurementEnabled):
3937         (WebCore::Settings::isPostBackgroundingMemoryUsageMeasurementEnabled):
3938         * page/cocoa/PerformanceLoggingCocoa.mm:
3939         (WebCore::PerformanceLogging::physicalFootprint):
3940
3941 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3942
3943         Remove always true unsafePluginPastingEnabled setting
3944         https://bugs.webkit.org/show_bug.cgi?id=167360
3945
3946         Reviewed by Andreas Kling.
3947
3948         Setting added by Chromium and never used by other ports.
3949
3950         * dom/ScriptableDocumentParser.cpp:
3951         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
3952         * page/Settings.in:
3953
3954 2017-01-24  Anders Carlsson  <andersca@apple.com>
3955
3956         When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!)
3957         https://bugs.webkit.org/show_bug.cgi?id=167391
3958         rdar://problem/29857388
3959
3960         Reviewed by Sam Weinig.
3961
3962         * page/Page.cpp:
3963         (WebCore::Page::refreshPlugins):
3964         Remove an unused variable.
3965
3966         * plugins/PluginInfoProvider.cpp:
3967         (WebCore::PluginInfoProvider::refresh):
3968         Make sure to call refreshPlugins(). Instead of reloading subframes, just reload all the main frames with
3969         subframes that contain plug-ins.
3970
3971 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3972
3973         Clean up Performance IDL interfaces so they are easier to read
3974         https://bugs.webkit.org/show_bug.cgi?id=167378
3975
3976         Reviewed by Sam Weinig.
3977
3978         * page/Performance.idl:
3979         * page/PerformanceEntry.idl:
3980         * page/PerformanceMark.idl:
3981         * page/PerformanceMeasure.idl:
3982         Update spec links and use a typedef to match specs.