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