Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-15  Jiewen Tan  <jiewen_tan@apple.com>
2
3         Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto
4         https://bugs.webkit.org/show_bug.cgi?id=172146
5         <rdar://problem/32122256>
6
7         Reviewed by Brent Fulgham.
8
9         In this patch, we replaces CryptoOperationData with BufferSource for WebKitSubtleCrypto in
10         the custom binding codes.
11
12         Test: crypto/webkitSubtle/import-export-raw-key-leak.html
13
14         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
15         (WebCore::JSWebKitSubtleCrypto::encrypt):
16         (WebCore::JSWebKitSubtleCrypto::decrypt):
17         (WebCore::JSWebKitSubtleCrypto::sign):
18         (WebCore::JSWebKitSubtleCrypto::verify):
19         (WebCore::JSWebKitSubtleCrypto::digest):
20         (WebCore::JSWebKitSubtleCrypto::importKey):
21         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
22         * crypto/WebKitSubtleCrypto.idl:
23
24 2017-05-17  Youenn Fablet  <youenn@apple.com>
25
26         Move-related refactoring on UserMediaPermissionRequestProxy
27         https://bugs.webkit.org/show_bug.cgi?id=172195
28
29         Reviewed by Alex Christensen.
30
31         No behavioral change.
32
33         * platform/mediastream/RealtimeMediaSourceCenter.h: Cleaning the function definition.
34
35 2017-05-17  David Kilzer  <ddkilzer@apple.com>
36
37         BlobDataFileReference::generateReplacementFile() should use mkstemp()
38         <https://webkit.org/b/172192>
39
40         Reviewed by Brent Fulgham.
41
42         * platform/network/mac/BlobDataFileReferenceMac.mm:
43         (WebCore::BlobDataFileReference::generateReplacementFile): Use
44         mkstemp().
45
46 2017-05-17  Matt Lewis  <jlewis3@apple.com>
47
48         Unreviewed, rolling out r216974.
49
50         Revision caused consistent timeouts on all platforms.
51
52         Reverted changeset:
53
54         "Add a RuntimeEnabledFeature for display: contents, defaulted
55         to false."
56         https://bugs.webkit.org/show_bug.cgi?id=171984
57         http://trac.webkit.org/changeset/216974
58
59 2017-05-17  Nan Wang  <n_wang@apple.com>
60
61         ASSERTION FAILED in WebCore::AccessibilityNodeObject::insertChild()
62         https://bugs.webkit.org/show_bug.cgi?id=171927
63         <rdar://problem/32109781>
64
65         Reviewed by Chris Fleizach.
66
67         The nextSibling() logic might include the continuation sibling that's not
68         the child of the current renderer. Make sure we only insert the valid child.
69
70         Test: accessibility/insert-children-assert.html
71
72         * accessibility/AccessibilityObject.cpp:
73         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
74         * accessibility/AccessibilityRenderObject.cpp:
75         (WebCore::AccessibilityRenderObject::nextSibling):
76
77 2017-05-17  Ryosuke Niwa  <rniwa@webkit.org>
78
79         getElementById can return a wrong elemnt when a matching element is removed during beforeload event
80         https://bugs.webkit.org/show_bug.cgi?id=171374
81
82         Reviewed by Brent Fulgham.
83
84         The bug was caused by HTMLLinkElement firing beforeload event inside insertedInto before the tree state is updated.
85         Delay the event dispatch to the post insertion callback.
86
87         Test: fast/html/link-element-removal-during-beforeload.html
88
89         * html/HTMLLinkElement.cpp:
90         (WebCore::HTMLLinkElement::insertedInto):
91         (WebCore::HTMLLinkElement::finishedInsertingSubtree):
92         * html/HTMLLinkElement.h:
93
94 2017-05-17  Alex Christensen  <achristensen@webkit.org>
95
96         Interacting with WKHTTPCookieStores before creating WKWebViews and WKProcessPools should affect cookies used
97         https://bugs.webkit.org/show_bug.cgi?id=171987
98
99         Reviewed by Brady Eidson.
100
101         Covered by new API tests.
102
103         * CMakeLists.txt:
104         * platform/Cookie.h:
105         (WebCore::Cookie::Cookie):
106         (WebCore::Cookie::isNull):
107         (WebCore::CookieHash::hash):
108         (WebCore::CookieHash::equal):
109         (WTF::HashTraits<WebCore::Cookie>::emptyValue):
110         (WTF::HashTraits<WebCore::Cookie>::constructDeletedValue):
111         (WTF::HashTraits<WebCore::Cookie>::isDeletedValue):
112         * platform/network/Cookie.cpp: Added.
113         (WebCore::Cookie::operator==):
114         (WebCore::Cookie::hash):
115         * platform/network/cocoa/CookieCocoa.mm:
116         (WebCore::Cookie::operator NSHTTPCookie *):
117         (WebCore::Cookie::operator==):
118         (WebCore::Cookie::hash):
119         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
120         (WebCore::NetworkStorageSession::setCookies):
121         Use NSHTTPCookie's hash and equality comparison to more closely match the NSHTTPCookie behavior.
122
123 2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
124
125         Add a RuntimeEnabledFeature for display: contents, defaulted to false.
126         https://bugs.webkit.org/show_bug.cgi?id=171984
127
128         Reviewed by Antti Koivisto.
129
130         The "defaulted to false" is not only because there are spec issues,
131         but because I ran the WPT suite, and there was a fair amount of
132         crashes and messed render trees.
133
134         * css/StyleResolver.cpp:
135         (WebCore::StyleResolver::adjustRenderStyle):
136         * page/RuntimeEnabledFeatures.h:
137         (WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
138         (WebCore::RuntimeEnabledFeatures::displayContentsEnabled):
139
140 2017-05-17  Antti Koivisto  <antti@apple.com>
141
142         Regression (198943): <marquee> shouldn't wrap text
143         https://bugs.webkit.org/show_bug.cgi?id=172217
144
145         Reviewed by Andreas Kling.
146
147         RenderMarquee::updateMarqueeStyle mutated the style and then expected it to inherit to children.
148         This doesn't work anymore because render tree construction is now separated from style resolution
149         where inheritance happens.
150
151         Test: fast/html/marquee-child-wrap.html
152
153         * css/StyleResolver.cpp:
154         (WebCore::StyleResolver::adjustRenderStyle):
155
156             Implement marquee hacks in adjustRenderStyle instead. This can't do the childrenInline check
157             the previous code had but it wasn't working anyway (there are no children when updateMarqueeStyle
158             gets called).
159
160         * rendering/RenderMarquee.cpp:
161         (WebCore::RenderMarquee::updateMarqueeStyle):
162
163             This no longer needs mutable style.
164
165 2017-05-16  David Kilzer  <ddkilzer@apple.com>
166
167         Remove C-style casts by using xmlDocPtr instead of void*
168         <https://webkit.org/b/172189>
169
170         Reviewed by Alex Christensen.
171
172         * dom/TransformSource.h: Fix whitespace indentation.
173         (typedef PlatformTransformSource): Use xmlDocPtr not void*.
174         * dom/TransformSourceLibxslt.cpp:
175         (WebCore::TransformSource::~TransformSource): Remove cast.
176         * xml/XSLStyleSheetLibxslt.cpp:
177         (WebCore::XSLStyleSheet::document): Remove cast.
178         * xml/XSLTProcessorLibxslt.cpp:
179         (WebCore::xmlDocPtrFromNode): Remove casts.
180         * xml/parser/XMLDocumentParser.h:
181         (WebCore::xmlDocPtrForString): Update declaration to return
182         xmlDocPtr not void*.
183         * xml/parser/XMLDocumentParserLibxml2.cpp:
184         (WebCore::XMLDocumentParser::doEnd): Change type of local
185         variable from void* to xmlDocPtr.
186         (WebCore::xmlDocPtrForString): Update to return xmlDocPtr
187         not void*.
188
189 2017-05-16  Sam Weinig  <sam@webkit.org>
190
191         Bring Notification.idl up to spec
192         https://bugs.webkit.org/show_bug.cgi?id=172156
193
194         Reviewed by Chris Dumez.
195
196         Test: http/tests/notifications/notification.html
197
198         * CMakeLists.txt:
199         * DerivedSources.make:
200         * WebCore.xcodeproj/project.pbxproj:
201         Add new files.
202
203         * Modules/notifications/Notification.cpp:
204         (WebCore::Notification::create):
205         (WebCore::Notification::Notification):
206         (WebCore::Notification::show):
207         (WebCore::directionString): Deleted.
208         (WebCore::Notification::permission): Deleted.
209         (WebCore::Notification::permissionString): Deleted.
210         * Modules/notifications/Notification.h:
211         * Modules/notifications/Notification.idl:
212         * Modules/notifications/NotificationClient.h:
213         * Modules/notifications/NotificationDirection.h: Added.
214         * Modules/notifications/NotificationPermission.h: Added.
215         * Modules/notifications/NotificationPermission.idl: Added.
216         * Modules/notifications/NotificationPermissionCallback.h:
217         * Modules/notifications/NotificationPermissionCallback.idl:
218         Bring up to spec, replacing DOMStrings with enums where appropriate and adding
219         additional readonly properties to Notification to mirror options provided
220         in construction.
221
222 2017-05-16  Zalan Bujtas  <zalan@apple.com>
223
224         Do not skip <slot> children when collecting content for innerText.
225         https://bugs.webkit.org/show_bug.cgi?id=172113
226         <rdar://problem/30362324>
227
228         Reviewed by Ryosuke Niwa and Brent Fulgham.
229
230         "display: contents" elements do not generate renderers but their children might.
231         This patch ensure that we don't skip them while collecting text content.  
232
233         Test: fast/text/inner-text-should-include-slot-subtree.html
234
235         * editing/TextIterator.cpp:
236         (WebCore::TextIterator::advance):
237
238 2017-05-16  Filip Pizlo  <fpizlo@apple.com>
239
240         GCController::garbageCollectNowIfNotDoneRecently should request Async Full GCs
241         https://bugs.webkit.org/show_bug.cgi?id=172204
242
243         Reviewed by Saam Barati.
244
245         No new tests because existing tests will tell us if there is a problem.
246         
247         The goal of this change is to reduce the likelihood that we block for a GC. We want it to be
248         benchmark-neutral.
249         
250         It's a 0.14% speed-up on JetStream with 24% probability.
251         
252         It's a 0.12% slow-down on PLT3 with 43% probability.
253         
254         So it's neutral on my machine.
255
256         * bindings/js/GCController.cpp:
257         (WebCore::GCController::garbageCollectNowIfNotDoneRecently):
258
259 2017-05-16  Tim Horton  <timothy_horton@apple.com>
260
261         [macOS] REGRESSION: Drag images for links with right-to-left titles are incorrect (172006)
262         https://bugs.webkit.org/show_bug.cgi?id=172006
263         <rdar://problem/32165137>
264
265         Reviewed by Dean Jackson.
266
267         * platform/mac/DragImageMac.mm:
268         (WebCore::LinkImageLayout::LinkImageLayout):
269         (WebCore::createDragImageForLink):
270         (WebCore::LinkImageLayout::addLine): Deleted.
271         * platform/spi/cocoa/CoreTextSPI.h:
272         Set and paint the entire frame as a single unit, making use of the
273         CTFrameMaximumNumberOfLines attribute to limit the number of lines.
274         This gives CoreText power over text alignment and makes RTL text lay
275         out correctly.
276
277 2017-05-16  Chris Dumez  <cdumez@apple.com>
278
279         Implement DOMMatrix / DOMMatrixReadOnly
280         https://bugs.webkit.org/show_bug.cgi?id=110001
281
282         Reviewed by Sam Weinig and Simon Fraser.
283
284         Implement DOMMatrix / DOMMatrixReadOnly as per:
285         - https://drafts.fxtf.org/geometry/#DOMMatrix
286
287         For now, these new types co-exist with WebKitCSSMatrix / SVGMatrix. However, in the future,
288         WebKitCSSMatrix / SVGMatrix are supposed to become aliases to DOMMatrix.
289
290         Most of it has been implemented. What remaining to be implemented is:
291         - Make WebKitCSSMatrix / SVGMatrix aliases to DOMMatrix
292         - DOMMatrix.fromFloat32Array() / fromFloat64Array()
293         - DOMMatrixReadOnly.fromFloat32Array() / fromFloat64Array() / toFloat32Array() / toFloat64Array()
294         - DOMMatrixReadOnly.transformPoint().
295
296         Tests: imported/w3c/web-platform-tests/css/geometry-1/*
297
298         * CMakeLists.txt:
299         * DerivedSources.make:
300         * WebCore.xcodeproj/project.pbxproj:
301
302         * bindings/scripts/CodeGeneratorJS.pm:
303         * bindings/scripts/test/JS/JSTestObj.cpp:
304         Fix a bug in the bindings generator causing the generator code for
305         "Constructor(optional (DOMString or sequence<unrestricted double>) init)" to be wrong
306         and not build.
307
308         * css/DOMMatrix.cpp: Added.
309         (WebCore::DOMMatrix::DOMMatrix):
310         (WebCore::DOMMatrix::fromMatrix):
311         (WebCore::DOMMatrix::multiplySelf):
312         (WebCore::DOMMatrix::preMultiplySelf):
313         (WebCore::DOMMatrix::translateSelf):
314         (WebCore::DOMMatrix::scaleSelf):
315         (WebCore::DOMMatrix::scale3dSelf):
316         (WebCore::DOMMatrix::rotateSelf):
317         (WebCore::DOMMatrix::rotateFromVectorSelf):
318         (WebCore::DOMMatrix::rotateAxisAngleSelf):
319         (WebCore::DOMMatrix::skewXSelf):
320         (WebCore::DOMMatrix::skewYSelf):
321         (WebCore::DOMMatrix::invertSelf):
322         (WebCore::DOMMatrix::setMatrixValueForBindings):
323         * css/DOMMatrix.h: Added.
324         (WebCore::DOMMatrix::create):
325         (WebCore::DOMMatrix::setA):
326         (WebCore::DOMMatrix::setB):
327         (WebCore::DOMMatrix::setC):
328         (WebCore::DOMMatrix::setD):
329         (WebCore::DOMMatrix::setE):
330         (WebCore::DOMMatrix::setF):
331         (WebCore::DOMMatrix::setM11):
332         (WebCore::DOMMatrix::setM12):
333         (WebCore::DOMMatrix::setM13):
334         (WebCore::DOMMatrix::setM14):
335         (WebCore::DOMMatrix::setM21):
336         (WebCore::DOMMatrix::setM22):
337         (WebCore::DOMMatrix::setM23):
338         (WebCore::DOMMatrix::setM24):
339         (WebCore::DOMMatrix::setM31):
340         (WebCore::DOMMatrix::setM32):
341         (WebCore::DOMMatrix::setM33):
342         (WebCore::DOMMatrix::setM34):
343         (WebCore::DOMMatrix::setM41):
344         (WebCore::DOMMatrix::setM42):
345         (WebCore::DOMMatrix::setM43):
346         (WebCore::DOMMatrix::setM44):
347         * css/DOMMatrix.idl: Added.
348         * css/DOMMatrixInit.h: Added.
349         * css/DOMMatrixInit.idl: Added.
350         * css/DOMMatrixReadOnly.cpp: Added.
351         (WebCore::DOMMatrixReadOnly::DOMMatrixReadOnly):
352         (WebCore::DOMMatrixReadOnly::validateAndFixup):
353         (WebCore::DOMMatrixReadOnly::fromMatrix):
354         (WebCore::DOMMatrixReadOnly::isIdentity):
355         (WebCore::DOMMatrixReadOnly::setMatrixValue):
356         (WebCore::DOMMatrixReadOnly::translate):
357         (WebCore::DOMMatrixReadOnly::flipX):
358         (WebCore::DOMMatrixReadOnly::flipY):
359         (WebCore::DOMMatrixReadOnly::multiply):
360         (WebCore::DOMMatrixReadOnly::scale):
361         (WebCore::DOMMatrixReadOnly::scale3d):
362         (WebCore::DOMMatrixReadOnly::rotate):
363         (WebCore::DOMMatrixReadOnly::rotateFromVector):
364         (WebCore::DOMMatrixReadOnly::rotateAxisAngle):
365         (WebCore::DOMMatrixReadOnly::skewX):
366         (WebCore::DOMMatrixReadOnly::skewY):
367         (WebCore::DOMMatrixReadOnly::inverse):
368         (WebCore::DOMMatrixReadOnly::toString):
369         * css/DOMMatrixReadOnly.h: Added.
370         (WebCore::DOMMatrixReadOnly::create):
371         (WebCore::DOMMatrixReadOnly::a):
372         (WebCore::DOMMatrixReadOnly::b):
373         (WebCore::DOMMatrixReadOnly::c):
374         (WebCore::DOMMatrixReadOnly::d):
375         (WebCore::DOMMatrixReadOnly::e):
376         (WebCore::DOMMatrixReadOnly::f):
377         (WebCore::DOMMatrixReadOnly::m11):
378         (WebCore::DOMMatrixReadOnly::m12):
379         (WebCore::DOMMatrixReadOnly::m13):
380         (WebCore::DOMMatrixReadOnly::m14):
381         (WebCore::DOMMatrixReadOnly::m21):
382         (WebCore::DOMMatrixReadOnly::m22):
383         (WebCore::DOMMatrixReadOnly::m23):
384         (WebCore::DOMMatrixReadOnly::m24):
385         (WebCore::DOMMatrixReadOnly::m31):
386         (WebCore::DOMMatrixReadOnly::m32):
387         (WebCore::DOMMatrixReadOnly::m33):
388         (WebCore::DOMMatrixReadOnly::m34):
389         (WebCore::DOMMatrixReadOnly::m41):
390         (WebCore::DOMMatrixReadOnly::m42):
391         (WebCore::DOMMatrixReadOnly::m43):
392         (WebCore::DOMMatrixReadOnly::m44):
393         (WebCore::DOMMatrixReadOnly::is2D):
394         (WebCore::DOMMatrixReadOnly::fromMatrixHelper):
395         * css/DOMMatrixReadOnly.idl: Added.
396         * css/WebKitCSSMatrix.h:
397         * css/WebKitCSSMatrix.idl:
398         * svg/SVGMatrix.h:
399         * svg/SVGMatrix.idl:
400
401 2017-05-16  Eric Carlson  <eric.carlson@apple.com>
402
403         [MediaStream] AudioSampleBufferList::zeroABL takes byte count, not sample count
404         https://bugs.webkit.org/show_bug.cgi?id=172194
405         <rdar://problem/32233799>
406
407         Reviewed by Jer Noble.
408
409         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
410         (WebCore::AudioTrackPrivateMediaStreamCocoa::render): Pass number of bytes to zero,
411         not number of samples.
412
413 2017-05-16  Mark Lam  <mark.lam@apple.com>
414
415         WorkerRunLoop::Task::performTask() needs to null check context->script() before use.
416         https://bugs.webkit.org/show_bug.cgi?id=172193
417         <rdar://problem/32225346>
418
419         Reviewed by Filip Pizlo.
420
421         According to https://build-safari.apple.com/results/Trunk%20Fuji%20GuardMalloc%20Production%20WK2%20Tests/r216929_459760e0918316187c8e52c6585a3a9ba9181204%20(12066)/results.html,
422         we see a crash with this crash trace:
423
424         Thread 13 Crashed:: WebCore: Worker
425         0 com.apple.WebCore        0x00000001099607b2 WebCore::WorkerScriptController::isTerminatingExecution() const + 18
426         1 com.apple.WebCore        0x000000010995ebbf WebCore::WorkerRunLoop::runCleanupTasks(WebCore::WorkerGlobalScope*) + 143
427         2 com.apple.WebCore        0x000000010995e80f WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 111
428         3 com.apple.WebCore        0x00000001099621b6 WebCore::WorkerThread::workerThread() + 742
429         4 com.apple.JavaScriptCore 0x000000010a964b92 WTF::threadEntryPoint(void*) + 178
430         5 com.apple.JavaScriptCore 0x000000010a964a69 WTF::wtfThreadEntryPoint(void*) + 121
431         6 libsystem_pthread.dylib  0x00007fffbdb5caab _pthread_body + 180
432         7 libsystem_pthread.dylib  0x00007fffbdb5c9f7 _pthread_start + 286
433         8 libsystem_pthread.dylib  0x00007fffbdb5c1fd thread_start + 13
434
435         ... and the crashing address is:
436
437         Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000022
438
439         0x0000000000000022 is the offset of m_scheduledTerminationMutex in the
440         WorkerScriptController.  This means that WorkerScriptController::isTerminatingExecution()
441         is passed a NULL this pointer.  This means that it's possible to have a race
442         where a WorkerRunLoop::Task gets enqueued beyond the Cleanup task that deletes the
443         context->script().  As a result, WorkerRunLoop::Task::performTask() (called by
444         runCleanupTasks()) may see a null context->script().
445
446         Hence, WorkerRunLoop::Task::performTask() should null check context->script()
447         before invoking the isTerminatingExecution() query on it.
448
449         No new tests because this is already covered by existing tests.
450
451         * workers/WorkerRunLoop.cpp:
452         (WebCore::WorkerRunLoop::Task::performTask):
453
454 2017-05-16  Youenn Fablet  <youenn@apple.com>
455
456         Modernize WebKit2 getUserMedia passing of parameters
457         https://bugs.webkit.org/show_bug.cgi?id=172161
458
459         Reviewed by Eric Carlson.
460
461         No change of behavior.
462
463         * platform/mediastream/RealtimeMediaSourceCenter.h: Using WTF::Function to enable capture Ref<>.
464
465 2017-05-16  Jeremy Jones  <jeremyj@apple.com>
466
467         Captions and subtitles not showing up in picture-in-picture for MSE content.
468         https://bugs.webkit.org/show_bug.cgi?id=172145
469
470         Reviewed by Eric Carlson.
471
472         No new tests as this has no affect on the DOM.
473
474         Add TextTrackRepresentation code from MediaPlayerPrivateAVFoundationObj to MediaPlayerPrivateMediaSourceAVFObjc.
475         This moves the TextTrackRepresentation platfrom layer into the fullscreen container layer when going into
476         pip for fullscreen, allowing the captions to be visible.
477
478         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
479         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
480         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
481         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
482         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
483         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation):
484         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
485         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
486
487 2017-05-16  David Kilzer  <ddkilzer@apple.com>
488
489         WebCore::leakCGColor() needs CF_RETURNS_RETAINED annotation
490         <https://webkit.org/b/172190>
491
492         Reviewed by Simon Fraser.
493
494         * platform/graphics/cg/ColorCG.cpp:
495         (WebCore::leakCGColor): Annotate with CF_RETURNS_RETAINED since
496         it does not follow the CF naming convention, which means the
497         expected behavior can't be inferred by the clang static
498         analyzer.
499
500 2017-05-16  Youenn Fablet  <youenn@apple.com>
501
502         RealtimeOutgoingVideoSource should support sinkWants for rotation
503         https://bugs.webkit.org/show_bug.cgi?id=172123
504         <rdar://problem/32200017>
505
506         Reviewed by Eric Carlson.
507
508         Covered by manual testing.
509
510         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
511         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): Triggering pixel rotation based on sink.
512         (WebCore::RealtimeOutgoingVideoSource::sendFrame): Doing the rotation using libwebrtc API.
513         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
514
515 2017-05-16  Myles C. Maxfield  <mmaxfield@apple.com>
516
517         REGRESSION(r212513): LastResort is platform-dependent, so its semantics should not be required to perform font loading correctly.
518         https://bugs.webkit.org/show_bug.cgi?id=168487
519
520         Reviewed by Antti Koivisto.
521
522         There are three ways a Web author can chain multiple font files together:
523         1. Multiple entries in the "src" descriptor in an @font-face rule
524         2. Multiple @font-face rules with the same "font-family" descriptor
525         3. Multiple entries in the "font-family" property on an element
526
527         Before r212513, the code which iterated across #2 and #3 above could have
528         triggered each item in the chain to download. r212513 tried to solve this
529         by using LastResort as the interstitial font used during downloads, because
530         LastResort supports every character and therefore solves #3 above. However,
531         this change had a few problems:
532
533         1. Previously, our code would try to avoid using the interstitial font for
534         layout or rendering whenever possible (because one of the chains above may
535         have named a local font which would be better to use). In order to use the
536         benefits of LastResort, I had to remove this avoidance logic and make
537         WebKit try to use the interstitial font as often as possible. However, due
538         to the large metrics of LastResort, this means that offsetWidth queries
539         during font loading would be wildly inaccurate, causing Google Docs to break.
540         2. It also means that canvas drawing during font loading would actually draw
541         LastResort, causing Bing maps to break.
542         3. LastResort is platform-specific, so only platforms which have it would
543         actually be able to load fonts correctly.
544
545         Instead, we should keep the older logic about avoiding using the
546         interstitial font so that loading has a better experience for the user.
547         We solve the unnecessary download problem by giving our loading code a
548         downloading policy enum, which has two values: allow downloads or forbid
549         downloads. Whenever our loading code returns the interstitial font, we
550         continue our search, but we change the policy to forbid downloads.
551
552         There is one piece of subtlety, though: It is more common for web authors
553         to put good fallbacks in the "font-family" property than in the "src"
554         descriptor inside @font-face. This means that we shouldn't exhaustively
555         search through the @font-face src list first. Instead, we should look
556         through the src list until we hit a non-local font, and then immediately
557         start looking through the other other chains.
558
559         Tests: fast/text/font-download-font-face-src-list.html
560                fast/text/font-download-font-family-property.html
561                fast/text/font-download-remote-fallback-all.html
562                fast/text/font-interstitial-invisible-width-while-loading.html
563                fast/text/font-weight-download-3.html
564                fast/text/web-font-load-fallback-during-loading-2.html
565                fast/text/web-font-load-invisible-during-loading.html
566
567         * css/CSSFontFace.cpp:
568         (WebCore::CSSFontFace::fontLoadEventOccurred): Implement support for
569         the font download policy.
570         (WebCore::CSSFontFace::setStatus): After 3 seconds of loading, we
571         will start drawing the fallback font. However, for testing, we have an
572         internal setting to make this switch happen immediately. This patch now
573         requires that this internal switch happen synchronously.
574         (WebCore::CSSFontFace::pump): Implement support for the font download
575         policy.
576         (WebCore::CSSFontFace::load): Ditto.
577         (WebCore::CSSFontFace::font): Ditto.
578         * css/CSSFontFace.h: Ditto.
579         * css/CSSFontSelector.cpp:
580         (WebCore::CSSFontSelector::beginLoadingFontSoon): Implement support for
581         synchronous font download timeouts.
582         * css/CSSSegmentedFontFace.cpp:
583         (WebCore::CSSSegmentedFontFace::fontRanges): Implement support for the
584         font download policy.
585         * platform/graphics/Font.cpp: Add new flag which represents if the
586         interstitial font was created after the 3 second timeout or before.
587         Previously, we would distinguish between these two cases by knowing
588         that one font was LastResort and the other font was a fallback. Now that
589         we're using fallback fonts on both sides of the 3 second timeout, we
590         now no longer know which one should be invisible. This new enum solves
591         this problem.
592         (WebCore::Font::Font):
593         (WebCore::Font::verticalRightOrientationFont):
594         (WebCore::Font::uprightOrientationFont):
595         * platform/graphics/Font.h: Ditto.
596         (WebCore::Font::create):
597         (WebCore::Font::origin):
598         (WebCore::Font::visibility):
599         * platform/graphics/FontCache.h:
600         * platform/graphics/FontCascade.cpp: We try to fall back to a local() font
601         during downloads, but there might not be one that we can use. Therefore, we
602         can't use the presence of the interstitial font to detect if we should paint
603         invisibly. Instead, we can move this logic into the font-specific part of
604         painting, and consult with the specific font to know if it was created from
605         a timed-out @font-face rule or not.
606         (WebCore::FontCascade::drawText):
607         (WebCore::shouldDrawIfLoading):
608         (WebCore::FontCascade::drawGlyphBuffer):
609         (WebCore::FontCascade::drawEmphasisMarks):
610         * platform/graphics/FontCascade.h:
611         * platform/graphics/FontCascadeFonts.cpp:
612         (WebCore::FontCascadeFonts::glyphDataForVariant): Implement the logic
613         described above where we switch the policy if we encounter the intestitial
614         font.
615         (WebCore::FontCascadeFonts::glyphDataForNormalVariant): Ditto.
616         (WebCore::glyphPageFromFontRanges): Ditto.
617         * platform/graphics/FontRanges.cpp: Implement support for the font download
618         policy.
619         (WebCore::FontRanges::Range::font):
620         (WebCore::FontRanges::glyphDataForCharacter):
621         (WebCore::FontRanges::fontForCharacter):
622         (WebCore::FontRanges::fontForFirstRange):
623         * platform/graphics/FontRanges.h:
624         * platform/graphics/FontSelector.h:
625         * platform/graphics/freetype/FontCacheFreeType.cpp:
626         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
627         * platform/graphics/mac/FontCacheMac.mm:
628         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
629         * platform/graphics/win/FontCacheWin.cpp:
630         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
631
632 2017-05-16  Zalan Bujtas  <zalan@apple.com>
633
634         Simple line layout: Move setCollapedWhitespaceWidth call to updateLineConstrains.
635         https://bugs.webkit.org/show_bug.cgi?id=172178
636
637         Reviewed by Antti Koivisto.
638
639         No change in functionality.
640
641         * rendering/SimpleLineLayout.cpp:
642         (WebCore::SimpleLineLayout::updateLineConstrains):
643         (WebCore::SimpleLineLayout::createLineRuns):
644
645 2017-05-16  Eric Carlson  <eric.carlson@apple.com>
646
647         [MediaStream] Return default device list until user gives permission to capture
648         https://bugs.webkit.org/show_bug.cgi?id=172168
649         <rdar://problem/31816884>
650
651         Reviewed by Youenn Fablet.
652
653         Test: fast/mediastream/media-devices-enumerate-devices.html
654
655         * Modules/mediastream/MediaDevicesRequest.cpp:
656         (WebCore::MediaDevicesRequest::filterDeviceList): Remove all but the "default" number of
657         devices of each type.
658         (WebCore::MediaDevicesRequest::start): Call filterDeviceList.
659         * Modules/mediastream/MediaDevicesRequest.h:
660
661 2017-05-16  Claudio Saavedra  <csaavedra@igalia.com>
662
663         Silent a few warnings about unused parameters
664         https://bugs.webkit.org/show_bug.cgi?id=172169
665
666         Reviewed by Sam Weinig.
667
668         * page/Page.cpp:
669         (WebCore::Page::mainFrameLoadStarted):
670         * platform/graphics/cairo/ImageBufferCairo.cpp:
671         (WebCore::ImageBuffer::toData):
672         * platform/network/ResourceRequestBase.cpp:
673         (WebCore::ResourceRequestBase::partitionName):
674
675 2017-05-16  Wenson Hsieh  <wenson_hsieh@apple.com>
676
677         WebItemProviderPasteboard should be robust when temporary files are missing path extensions
678         https://bugs.webkit.org/show_bug.cgi?id=172170
679
680         Reviewed by Tim Horton.
681
682         Makes a slight adjustment to the temporary file URLs are handled when using WebItemProviderPasteboard to load
683         data off of item providers. Previously, we would bail early and not load any data if the temporary URL is
684         missing an extension. Since the switch to NSItemProviders from UIItemProviders, some types of temporary files
685         generated by item providers are missing extensions, so this extra check is meaningless.
686
687         Covered by existing data interaction unit tests.
688
689         * platform/ios/WebItemProviderPasteboard.mm:
690         (temporaryFileURLForDataInteractionContent):
691         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
692
693 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
694
695         [WPE] GLContextEGL::createWPEContext() should fall back to pbuffer-based contexts when offscreen target provides no native window
696         https://bugs.webkit.org/show_bug.cgi?id=172162
697
698         Reviewed by Carlos Garcia Campos.
699
700         When creating an offscreen GLContext, the underlying implementation might
701         provide a mock native window that's to be used as the window target upon
702         which a window-based GLContext should be created. But we should also support
703         falling back to pbuffer-based GLContexts when the underlying implementation
704         can't provide such mock targets.
705
706         * platform/graphics/egl/GLContextEGLWPE.cpp:
707         (WebCore::GLContextEGL::createWPEContext):
708
709 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
710
711         [GLib] Name more GSource-based RunLoop::Timers
712         https://bugs.webkit.org/show_bug.cgi?id=172158
713
714         Reviewed by Carlos Garcia Campos.
715
716         * platform/glib/MainThreadSharedTimerGLib.cpp:
717         (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
718         Specify 'MainThreadSharedTimer' as the name of this GSource-based RunLoop::Timer.
719
720 2017-05-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
721
722         [Readable Streams API] Implement ReadableStreamBYOBReader releaseLock()
723         https://bugs.webkit.org/show_bug.cgi?id=172111
724
725         Reviewed by Chris Dumez.
726
727         Implemented ReadableStreamBYOBReader releaseLock():
728         - https://streams.spec.whatwg.org/#byob-reader-release-lock;
729         - https://streams.spec.whatwg.org/#readable-stream-reader-generic-release.
730
731         Added tests to check releaseLock behavior.
732
733         * Modules/streams/ReadableStreamBYOBReader.js:
734         (releaseLock): Implemented.
735         * Modules/streams/ReadableStreamInternals.js:
736         (readableStreamReaderGenericRelease): Aligned with spec.
737
738 2017-05-16  Carlos Garcia Campos  <cgarcia@igalia.com>
739
740         Unreviewed. Try to fix GTK+ build with MEDIA_STREAM enabled after r216918.
741
742         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
743         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
744
745 2017-05-16  Youenn Fablet  <youenn@apple.com>
746
747         Remove MediaConstraintsData and MediaConstraintsImpl
748         https://bugs.webkit.org/show_bug.cgi?id=172132
749
750         Reviewed by Eric Carlson.
751
752         No observable change of behavior.
753
754         Removing MediaConstraintsData and MediaConstraintsImpl allows simplifying the code.
755         Further simplified the code by making MediaConstraints no longer ref counted and now a struct.
756         Simplified some RealtimeMediaSource subclasses by removing unused MediaConstraints class members.
757
758         * CMakeLists.txt: Removing MediaConstraintsImpl.cpp.
759         * Modules/mediastream/MediaConstraintsImpl.cpp: Removed.
760         * Modules/mediastream/MediaConstraintsImpl.h: Removed.
761         * Modules/mediastream/MediaDevices.cpp:
762         (WebCore::createMediaConstraints):
763         (WebCore::MediaDevices::getUserMedia):
764         (WebCore::createMediaConstraintsImpl): Deleted.
765         * Modules/mediastream/MediaStreamTrack.cpp:
766         (WebCore::createMediaConstraints):
767         (WebCore::MediaStreamTrack::applyConstraints):
768         (WebCore::createMediaConstraintsImpl): Deleted.
769         * Modules/mediastream/MediaTrackConstraints.cpp:
770         (WebCore::createMediaConstraints):
771         (WebCore::createMediaConstraintsImpl): Deleted.
772         * Modules/mediastream/MediaTrackConstraints.h:
773         * Modules/mediastream/UserMediaRequest.cpp:
774         (WebCore::UserMediaRequest::start):
775         (WebCore::UserMediaRequest::UserMediaRequest):
776         (WebCore::UserMediaRequest::allow):
777         * Modules/mediastream/UserMediaRequest.h:
778         (WebCore::UserMediaRequest::audioConstraints):
779         (WebCore::UserMediaRequest::videoConstraints):
780         * WebCore.xcodeproj/project.pbxproj:
781         * platform/mediastream/MediaConstraints.cpp:
782         (WebCore::addDefaultVideoConstraints):
783         (WebCore::MediaConstraints::isConstraintSet):
784         (WebCore::MediaConstraints::setDefaultVideoConstraints):
785         * platform/mediastream/MediaConstraints.h:
786         (WebCore::MediaConstraints::~MediaConstraints): Deleted.
787         (WebCore::MediaConstraints::MediaConstraints): Deleted.
788         * platform/mediastream/MediaStreamConstraintsValidationClient.h:
789         * platform/mediastream/RealtimeMediaSource.cpp:
790         (WebCore::RealtimeMediaSource::selectSettings):
791         (WebCore::RealtimeMediaSource::supportsConstraints):
792         (WebCore::RealtimeMediaSource::applyConstraints):
793         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
794         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
795         * platform/mediastream/RealtimeMediaSourceCenter.h:
796         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
797         (WebCore::RealtimeIncomingAudioSource::supportedConstraints): Deleted.
798         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
799         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
800         (WebCore::RealtimeIncomingVideoSource::supportedConstraints): Deleted.
801         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
802         * platform/mock/MockRealtimeMediaSource.h:
803         (WebCore::MockRealtimeMediaSource::constraints): Deleted.
804
805 2017-05-16  Andy Estes  <aestes@apple.com>
806
807         [Cocoa] Tell NEFilterSource about the presenting app's PID
808         https://bugs.webkit.org/show_bug.cgi?id=172152
809         <rdar://problem/32197740>
810
811         Reviewed by Dan Bernstein.
812
813         * platform/cocoa/NetworkExtensionContentFilter.mm:
814         (WebCore::NetworkExtensionContentFilter::initialize):
815         * platform/spi/cocoa/NEFilterSourceSPI.h:
816
817 2017-05-16  Manuel Rego Casasnovas  <rego@igalia.com>
818
819         [css-grid] Fix static position of positioned grid items
820         https://bugs.webkit.org/show_bug.cgi?id=172108
821
822         Reviewed by Sergio Villar Senin.
823
824         This patch makes us follow the text on the spec
825         (https://drafts.csswg.org/css-grid/#static-position):
826         "The static position of an absolutely-positioned child
827          of a grid container is determined as if it were the sole grid item
828          in a grid area whose edges coincide with the padding edges
829          of the grid container."
830
831         Test: fast/css-grid-layout/absolute-positioning-grid-container-parent.html
832
833         * rendering/RenderGrid.cpp:
834         (WebCore::RenderGrid::prepareChildForPositionedLayout): Modified to avoid
835         including padding to match the spec behavior.
836
837 2017-05-16  Per Arne Vollan  <pvollan@apple.com>
838
839         Compile error, include file is not found.
840         https://bugs.webkit.org/show_bug.cgi?id=172105
841
842         Reviewed by Brent Fulgham.
843
844         Use __has_include to detect if include file exists.
845
846         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:
847
848 2017-05-15  Andy Estes  <aestes@apple.com>
849
850         Make the application PID available to WebCore
851         https://bugs.webkit.org/show_bug.cgi?id=172133
852
853         Reviewed by Andreas Kling.
854
855         * CMakeLists.txt:
856         * PlatformMac.cmake:
857         * WebCore.xcodeproj/project.pbxproj:
858         * platform/RuntimeApplicationChecks.cpp: Added.
859         (WebCore::presentingApplicationPIDOverride):
860         (WebCore::presentingApplicationPID): Returns the override PID if set, or getCurrentProcessID()
861         otherwise.
862         (WebCore::setPresentingApplicationPID):
863         * platform/RuntimeApplicationChecks.h:
864         * platform/cocoa/RuntimeApplicationChecksCocoa.mm: Renamed from Source/WebCore/platform/RuntimeApplicationChecks.mm.
865
866 2017-05-15  Antti Koivisto  <antti@apple.com>
867
868         RenderTheme does not need to be per-page
869         https://bugs.webkit.org/show_bug.cgi?id=172116
870         <rdar://problem/30426457>
871
872         Reviewed by Zalan Bujtas.
873
874         There are no implementations of RenderTheme::themeForPage that actually care about the page.
875         It can be replaced with a singleton, simplifying a bunch of code.
876
877         * Modules/mediacontrols/MediaControlsHost.cpp:
878         (WebCore::MediaControlsHost::shadowRootCSSText):
879         (WebCore::MediaControlsHost::base64StringForIconNameAndType):
880         * css/CSSDefaultStyleSheets.cpp:
881         (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
882         (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
883
884             Fix a potential crash if we get here when page is null (though it doesn't appear to repro on trunk).
885
886         * css/StyleColor.cpp:
887         (WebCore::StyleColor::colorFromKeyword):
888         * css/StyleResolver.cpp:
889         (WebCore::StyleResolver::adjustRenderStyle):
890         * css/parser/CSSParser.cpp:
891         (WebCore::CSSParser::parseSystemColor):
892         * css/parser/CSSParser.h:
893         * css/parser/CSSPropertyParser.cpp:
894         (WebCore::CSSPropertyParser::consumeSystemFont):
895         * editing/FrameSelection.cpp:
896         (WebCore::FrameSelection::updateAppearance):
897         * html/HTMLMediaElement.cpp:
898         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
899         * html/HTMLMeterElement.cpp:
900         (WebCore::HTMLMeterElement::createElementRenderer):
901         * html/HTMLSelectElement.cpp:
902         (WebCore::HTMLSelectElement::usesMenuList):
903         (WebCore::HTMLSelectElement::platformHandleKeydownEvent):
904         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
905         * html/HTMLTextFormControlElement.cpp:
906         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle):
907         * html/InputType.cpp:
908         (WebCore::InputType::themeSupportsDataListUI):
909         * html/TextFieldInputType.cpp:
910         (WebCore::TextFieldInputType::shouldHaveSpinButton):
911         (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
912         * html/canvas/CanvasRenderingContext2D.cpp:
913         (WebCore::CanvasRenderingContext2D::setStrokeColor):
914         (WebCore::CanvasRenderingContext2D::setFillColor):
915         * html/canvas/CanvasStyle.cpp:
916         (WebCore::parseColor):
917         (WebCore::parseColorOrCurrentColor):
918         (WebCore::CanvasStyle::createFromString):
919         * html/canvas/CanvasStyle.h:
920         * html/shadow/MediaControlElements.cpp:
921         (WebCore::MediaControlPanelElement::startTimer):
922         (WebCore::MediaControlPanelElement::makeOpaque):
923         (WebCore::MediaControlPanelElement::makeTransparent):
924         * html/shadow/MediaControls.cpp:
925         (WebCore::MediaControls::reset):
926         (WebCore::MediaControls::reportedError):
927         (WebCore::MediaControls::updateCurrentTimeDisplay):
928         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
929         (WebCore::ImageControlsButtonElementMac::tryCreate):
930         * page/MemoryRelease.cpp:
931         (WebCore::releaseNoncriticalMemory):
932         * page/Page.cpp:
933         (WebCore::Page::Page):
934         * page/Page.h:
935         (WebCore::Page::theme): Deleted.
936         * platform/wpe/RenderThemeWPE.cpp:
937         (WebCore::RenderTheme::singleton):
938         (WebCore::RenderTheme::themeForPage): Deleted.
939         * rendering/RenderEmbeddedObject.cpp:
940         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
941         * rendering/RenderObject.cpp:
942         (WebCore::RenderObject::theme):
943         * rendering/RenderTheme.cpp:
944         (WebCore::RenderTheme::focusRingColor):
945         * rendering/RenderTheme.h:
946         (WebCore::RenderTheme::defaultTheme): Deleted.
947         * rendering/RenderThemeGtk.cpp:
948         (WebCore::RenderTheme::singleton):
949         (WebCore::RenderTheme::themeForPage): Deleted.
950         * rendering/RenderThemeIOS.mm:
951         (WebCore::RenderTheme::singleton):
952         (WebCore::RenderTheme::themeForPage): Deleted.
953         * rendering/RenderThemeMac.mm:
954         (WebCore::RenderTheme::singleton):
955         (WebCore::RenderTheme::themeForPage): Deleted.
956         * rendering/RenderThemeWin.cpp:
957         (WebCore::RenderTheme::singleton):
958         (WebCore::RenderTheme::themeForPage): Deleted.
959         * rendering/TextPaintStyle.cpp:
960         (WebCore::computeTextPaintStyle):
961
962 2017-05-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
963
964         Do not delete asynchronously decoded frames for large images if their clients are in the viewport
965         https://bugs.webkit.org/show_bug.cgi?id=170640
966
967         Reviewed by Simon Fraser.
968
969         The image flickering problem happens when a large image is visible in the
970         view port and for some reason, the decoded frame gets destroyed. When this
971         image is repainted, BitmapImage::draw() does not find a valid decoded frame
972         for that image. It then requests an async decoding for the image and just
973         draws nothing in the image rectangle. Drawing no content between two drawing
974         phases in which the image is drawn causes the unwanted flickering.
975
976         To fix this issue we need to protect the decoded frames of all the images
977         in the view port from being destroyed. When BitmapImage::destroyDecodedData()
978         is called, it is going to check, through the ImageObserver, whether any
979         of its clients is visible. And if so, the current decoded frame won't be
980         destroyed.
981
982         Tests: Modifying existing tests.
983
984         * loader/cache/CachedImage.cpp:
985         (WebCore::CachedImage::CachedImageObserver::decodedSizeChanged):
986         (WebCore::CachedImage::CachedImageObserver::didDraw):
987         (WebCore::CachedImage::CachedImageObserver::canDestroyDecodedData):
988         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
989         (WebCore::CachedImage::CachedImageObserver::changedInRect):
990         (WebCore::CachedImage::decodedSizeChanged):
991         (WebCore::CachedImage::didDraw):
992         (WebCore::CachedImage::canDestroyDecodedData): Finds out whether it's okay
993         to discard the image decoded data or not.
994         (WebCore::CachedImage::imageFrameAvailable):
995         (WebCore::CachedImage::changedInRect):
996         * loader/cache/CachedImage.h:
997         * loader/cache/CachedImageClient.h:
998         (WebCore::CachedImageClient::canDestroyDecodedData):
999         * loader/cache/MemoryCache.cpp:
1000         (WebCore::MemoryCache::destroyDecodedDataForAllImages): This function is
1001         currently not used. Use in the internal destroyDecodedDataForAllImages()
1002         but unlike what CachedImage::destroyDecodedData() does, make it destroy
1003         the decoded frames without deleting the image itself.
1004         * loader/cache/MemoryCache.h:
1005         * platform/graphics/BitmapImage.cpp:
1006         (WebCore::BitmapImage::destroyDecodedData):
1007         (WebCore::BitmapImage::draw):
1008         (WebCore::BitmapImage::canDestroyCurrentFrameDecodedData): 
1009         (WebCore::BitmapImage::advanceAnimation):
1010         (WebCore::BitmapImage::internalAdvanceAnimation):
1011         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
1012         * platform/graphics/BitmapImage.h:
1013         * platform/graphics/GraphicsContext3D.cpp:
1014         (WebCore::GraphicsContext3D::packImageData):
1015         * platform/graphics/ImageFrameCache.cpp:
1016         (WebCore::ImageFrameCache::decodedSizeChanged):
1017         (ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): The assertion in this
1018         function is wrong. frameIsCompleteAtIndex() can be false when the an image
1019         decoding is requested but can be true when the decoding finishes.
1020         * platform/graphics/ImageObserver.h:
1021         * platform/graphics/cairo/ImageCairo.cpp:
1022         (WebCore::Image::drawPattern):
1023         * platform/graphics/cg/ImageCG.cpp:
1024         (WebCore::Image::drawPattern):
1025         * platform/graphics/cg/ImageDecoderCG.cpp:
1026         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
1027         * platform/graphics/cg/PDFDocumentImage.cpp:
1028         (WebCore::PDFDocumentImage::decodedSizeChanged):
1029         (WebCore::PDFDocumentImage::draw):
1030         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
1031         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
1032         * platform/graphics/win/ImageDirect2D.cpp:
1033         (WebCore::Image::drawPattern):
1034         * rendering/RenderElement.cpp:
1035         (WebCore::RenderElement::isVisibleInDocumentRect):
1036         (WebCore::RenderElement::isVisibleInViewport):
1037         (WebCore::RenderElement::imageFrameAvailable):
1038         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
1039         (WebCore::RenderElement::shouldRepaintInVisibleRect): Deleted. Function
1040         is renamed to isVisibleInViewport() for better readability.
1041         * rendering/RenderElement.h:
1042         * svg/graphics/SVGImage.cpp:
1043         (WebCore::SVGImage::draw):
1044         * svg/graphics/SVGImageClients.h:
1045         * testing/Internals.cpp:
1046         (WebCore::Internals::destroyDecodedDataForAllImages):
1047         * testing/Internals.h:
1048         * testing/Internals.idl:
1049
1050 2017-05-15  Youenn Fablet  <youenn@apple.com>
1051
1052         Simplify RealtimeMediaSource data production and state
1053         https://bugs.webkit.org/show_bug.cgi?id=171999
1054
1055         Reviewed by Eric Carlson.
1056
1057         RealtimeMediaSource takes 3 booleans:
1058         - m_isProducingData tells whether data is produced or not. In the case of capturing, it tells whether capture
1059           happens.
1060         - m_muted/m_enabled allows JS or WebKit level to start/stop the source.
1061
1062         Changed MediaStream capture state computation so that capture is reported as follows:
1063         - m_isProducing is true, capture is happenning and is active
1064         - m_muted is true, capture is happening but is inactive.
1065
1066         Except in the case of WebRTC incoming sources, for which sources may be created as muted as per the spec,
1067         all sources are unmuted, enabled and not producing data when created.
1068
1069         RealtimeMediaSource is now activable either by calling start/stop or by calling setMuted/setEnabled.
1070         This in turns will set the boolean values accordingly and will call the underlying
1071         startProducingData/stopProducingData methods doing the actual stuff.
1072
1073         Removing from all RealtimeMediaSource subclasses the handling of producing data.
1074         Making more methods non-virtual/member fields private to simplify the model.
1075
1076         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1077         (WebCore::CanvasCaptureMediaStreamTrack::Source::create):
1078         (WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
1079         (WebCore::CanvasCaptureMediaStreamTrack::Source::stopProducingData):
1080         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
1081         (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
1082         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
1083         * Modules/mediastream/MediaStream.cpp:
1084         (WebCore::MediaStream::mediaState):
1085         * platform/mediastream/MediaStreamTrackPrivate.h:
1086         (WebCore::MediaStreamTrackPrivate::startProducingData):
1087         (WebCore::MediaStreamTrackPrivate::stopProducingData):
1088         * platform/mediastream/RealtimeMediaSource.cpp:
1089         (WebCore::RealtimeMediaSource::setMuted):
1090         (WebCore::RealtimeMediaSource::notifyMutedChange):
1091         (WebCore::RealtimeMediaSource::setEnabled):
1092         (WebCore::RealtimeMediaSource::start):
1093         (WebCore::RealtimeMediaSource::stop):
1094         (WebCore::RealtimeMediaSource::requestStop):
1095         (WebCore::RealtimeMediaSource::reset): Deleted.
1096         * platform/mediastream/RealtimeMediaSource.h:
1097         * platform/mediastream/mac/AVMediaCaptureSource.h:
1098         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1099         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
1100         (WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange):
1101         (WebCore::AVMediaCaptureSource::reset): Deleted.
1102         (WebCore::AVMediaCaptureSource::isProducingData): Deleted.
1103         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1104         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
1105         (WebCore::CoreAudioCaptureSource::startProducingData):
1106         (WebCore::CoreAudioCaptureSource::stopProducingData):
1107         (WebCore::CoreAudioCaptureSource::audioSourceProvider):
1108         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1109         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1110         (WebCore::MockRealtimeAudioSourceMac::render):
1111         (WebCore::MockRealtimeAudioSource::createMuted): Deleted.
1112         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1113         (WebCore::MockRealtimeVideoSource::createMuted): Deleted.
1114         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1115         (WebCore::RealtimeIncomingAudioSource::create):
1116         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
1117         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
1118         (WebCore::RealtimeIncomingAudioSource::startProducingData):
1119         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
1120         (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
1121         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1122         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
1123         (WebCore::RealtimeIncomingVideoSource::create):
1124         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
1125         (WebCore::RealtimeIncomingVideoSource::startProducingData):
1126         (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
1127         (WebCore::RealtimeIncomingVideoSource::stopProducingData):
1128         (WebCore::RealtimeIncomingVideoSource::OnFrame):
1129         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
1130         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1131         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
1132         * platform/mock/MockMediaEndpoint.cpp:
1133         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
1134         (WebCore::MockMediaEndpoint::unmuteTimerFired):
1135         * platform/mock/MockRealtimeAudioSource.cpp:
1136         (WebCore::MockRealtimeAudioSource::createMuted):
1137         (WebCore::MockRealtimeAudioSource::startProducingData):
1138         (WebCore::MockRealtimeAudioSource::stopProducingData):
1139         * platform/mock/MockRealtimeAudioSource.h:
1140         * platform/mock/MockRealtimeMediaSource.cpp:
1141         (WebCore::MockRealtimeMediaSource::startProducingData): Deleted.
1142         (WebCore::MockRealtimeMediaSource::stopProducingData): Deleted.
1143         * platform/mock/MockRealtimeMediaSource.h:
1144         * platform/mock/MockRealtimeVideoSource.cpp:
1145         (WebCore::MockRealtimeVideoSource::createMuted):
1146         (WebCore::MockRealtimeVideoSource::startProducingData):
1147         (WebCore::MockRealtimeVideoSource::stopProducingData):
1148         (WebCore::MockRealtimeVideoSource::generateFrame):
1149         * platform/mock/MockRealtimeVideoSource.h:
1150
1151 2017-05-15  Myles C. Maxfield  <mmaxfield@apple.com>
1152
1153         Migrate Font constructor from bools to enums
1154         https://bugs.webkit.org/show_bug.cgi?id=172140
1155
1156         Reviewed by Tim Horton.
1157
1158         In https://bugs.webkit.org/show_bug.cgi?id=168487, I'm adding a new flag to Font. We can't
1159         keep having just a pile of bools in this class. Instead, we should be using enums.
1160
1161         No new tests because there is no behavior change.
1162
1163         * css/CSSFontFace.cpp:
1164         (WebCore::CSSFontFace::font):
1165         * css/CSSFontFaceSource.cpp:
1166         (WebCore::CSSFontFaceSource::font):
1167         * css/CSSSegmentedFontFace.cpp:
1168         * loader/cache/CachedFont.cpp:
1169         (WebCore::CachedFont::createFont):
1170         * platform/graphics/Font.cpp:
1171         (WebCore::Font::Font):
1172         (WebCore::Font::verticalRightOrientationFont):
1173         (WebCore::Font::uprightOrientationFont):
1174         (WebCore::Font::brokenIdeographFont):
1175         (WebCore::Font::description):
1176         (WebCore::Font::mathData):
1177         * platform/graphics/Font.h:
1178         (WebCore::Font::create):
1179         (WebCore::Font::origin):
1180         (WebCore::Font::isInterstitial):
1181         (WebCore::Font::widthForGlyph):
1182         (WebCore::Font::isCustomFont): Deleted.
1183         (WebCore::Font::isLoading): Deleted.
1184         * platform/graphics/FontRanges.cpp:
1185         * platform/graphics/cocoa/FontCocoa.mm:
1186         (WebCore::Font::platformInit):
1187         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1188         (WebCore::Font::platformCreateScaledFont):
1189         * platform/graphics/win/SimpleFontDataCGWin.cpp:
1190         (WebCore::Font::platformInit):
1191         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
1192         (WebCore::Font::platformInit):
1193         * platform/graphics/win/SimpleFontDataWin.cpp:
1194         (WebCore::Font::platformCreateScaledFont):
1195         (WebCore::Font::determinePitch):
1196         * rendering/SimpleLineLayout.cpp:
1197         (WebCore::SimpleLineLayout::canUseForFontAndText):
1198
1199 2017-05-15  Youenn Fablet  <youenn@apple.com>
1200
1201         WebRTC outgoing muted video sources should send black frames
1202         https://bugs.webkit.org/show_bug.cgi?id=170627
1203         <rdar://problem/31513869>
1204
1205         Reviewed by Eric Carlson.
1206
1207         Covered by updated test.
1208
1209         Instead of sending one black frame and then another one asynchronously,
1210         we use the timer to send a black frame every second when outgoing source is muted.
1211
1212         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1213         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
1214         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
1215         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames):
1216         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrame): Deleted.
1217         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1218         * testing/Internals.cpp:
1219         (WebCore::Internals::videoSampleAvailable):
1220
1221 2017-05-15  David Kilzer  <ddkilzer@apple.com>
1222
1223         Crash in libxml2.2.dylib: xmlDictReference
1224         <https://webkit.org/b/172086>
1225         <rdar://problem/23643436>
1226
1227         Reviewed by Daniel Bates.
1228
1229         Speculative fix and code clean-up based on source code
1230         inspection.  The fix for the crash is in two parts that change
1231         XSLStyleSheet::parseString():
1232         1. Always set m_stylesheetDoc to nullptr after freeing it via
1233            XSLStyleSheet::clearXSLStylesheetDocument().
1234         2. Add nullptr check before using m_stylesheetDoc from parent.
1235
1236         Broadly speaking, the changes are:
1237         - Extract code to reset m_stylesheetDoc into new private
1238           XSLStyleSheet::clearXSLStylesheetDocument() method.  There is
1239           a special contract between m_stylesheetDoc and
1240           m_stylesheetDocTaken that wasn't being followed every time.
1241           See comment in XSLStyleSheet::compileStyleSheet().
1242         - XSLStyleSheet::clearDocuments() now calls new
1243           clearXSLStylesheetDocument() method.  Previously, it was not
1244           checking or resetting m_stylesheetDocTaken, and it might have
1245           leaked an xmlDocPtr if m_stylesheetDoc was set and
1246           m_stylesheetDocTaken was false.
1247         - XSLStyleSheet::parseString() now calls new
1248           clearXSLStylesheetDocument() method.  Previously, it did not
1249           clear m_stylesheetDoc after freeing it, and it could return
1250           early due to a failure in xmlCreateMemoryParserCtxt().
1251         - In XSLStyleSheet::parseString() use checked arithmetic when
1252           calculating 'size' for xmlCreateMemoryParserCtxt() and
1253           xmlCtxtReadMemory().  This code used to do an implicit
1254           unsigned -> signed integer conversion that could overflow.
1255         - Always iterate m_children using an 'auto& import' variable.
1256
1257         * xml/XSLStyleSheet.h:
1258         (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add declaration.
1259         (WebCore::XSLStyleSheet::m_disabled): Add default initializer.
1260         (WebCore::XSLStyleSheet::m_stylesheetDoc): Ditto.
1261         (WebCore::XSLStyleSheet::m_stylesheetDocTaken): Ditto.
1262         (WebCore::XSLStyleSheet::m_parentStyleSheet): Ditto.
1263
1264         * xml/XSLStyleSheetLibxslt.cpp:
1265         (WebCore::XSLStyleSheet::XSLStyleSheet): Get rid of redundant
1266         initializers.  Set m_parentStyleSheet if needed.
1267         (WebCore::XSLStyleSheet::~XSLStyleSheet): Call
1268         clearXSLStylesheetDocument() instead of custom code.  Switch
1269         m_children fast iteration to use 'auto& import' variable.
1270         (WebCore::XSLStyleSheet::isLoading): Switch m_children fast
1271         iteration to use 'auto& import' variable.
1272         (WebCore::XSLStyleSheet::clearDocuments): Call
1273         clearXSLStylesheetDocument() instead of setting m_stylesheetDoc
1274         to nullptr.  This might fix an occasional xmlDocPtr leak.
1275         (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add.  This
1276         method always sets m_stylesheetDoc to nullptr (after freeing it
1277         if necessary) and sets m_stylesheetDocTaken to false.
1278         (WebCore::XSLStyleSheet::parseString): Call
1279         clearXSLStylesheetDocument().  Prior to this, m_stylesheetDoc
1280         might be left pointing to a freed value, and this method could
1281         return early if xmlCreateMemoryParserCtxt() failed.  Switch to
1282         using Checked<> to compute required buffer size to parse XSL
1283         stylesheet, and return early on overflow.  Clean up existing
1284         return statements to use boolean expressions.  Add nullptr check
1285         for m_parentStyleSheet->m_stylesheetDoc before using it.
1286         (WebCore::XSLStyleSheet::loadChildSheet): Get rid of local
1287         variable by calling loadSheet() from last array element.
1288         (WebCore::XSLStyleSheet::compileStyleSheet): Add debug assert
1289         that m_stylesheetDoc is not nullptr.
1290
1291 2017-05-15  Jer Noble  <jer.noble@apple.com>
1292
1293         Add experimental setting to allow document gesture interaction to fulfill media playback gesture requirement
1294         https://bugs.webkit.org/show_bug.cgi?id=172131
1295
1296         Reviewed by Eric Carlson.
1297
1298         Test: media/restricted-audio-playback-with-document-gesture.html
1299
1300         Move all calls to ScriptController::processingUserGestureForMedia() to the new Document equivalent. In Document,
1301         if the new setting is enabled, return true from processingUserGestureForMedia() if the top-level document has had
1302         a user gesture interaction.
1303
1304         * Modules/mediastream/MediaStream.cpp:
1305         (WebCore::MediaStream::processingUserGestureForMedia):
1306         * Modules/mediastream/MediaStream.h:
1307         * Modules/webaudio/AudioContext.cpp:
1308         (WebCore::AudioContext::processingUserGestureForMedia):
1309         (WebCore::AudioContext::willBeginPlayback):
1310         (WebCore::AudioContext::willPausePlayback):
1311         * Modules/webaudio/AudioContext.h:
1312         * dom/Document.cpp:
1313         (WebCore::Document::processingUserGestureForMedia):
1314         * dom/Document.h:
1315         * html/HTMLMediaElement.cpp:
1316         (WebCore::HTMLMediaElement::load):
1317         (WebCore::HTMLMediaElement::audioTrackEnabledChanged):
1318         (WebCore::HTMLMediaElement::seekWithTolerance):
1319         (WebCore::HTMLMediaElement::play):
1320         (WebCore::HTMLMediaElement::playInternal):
1321         (WebCore::HTMLMediaElement::pause):
1322         (WebCore::HTMLMediaElement::pauseInternal):
1323         (WebCore::HTMLMediaElement::setMuted):
1324         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
1325         (WebCore::HTMLMediaElement::processingUserGestureForMedia):
1326         * html/HTMLMediaElement.h:
1327         * html/MediaElementSession.cpp:
1328         (WebCore::MediaElementSession::playbackPermitted):
1329         (WebCore::MediaElementSession::dataLoadingPermitted):
1330         (WebCore::MediaElementSession::fullscreenPermitted):
1331         (WebCore::MediaElementSession::canShowControlsManager):
1332         (WebCore::MediaElementSession::showPlaybackTargetPicker):
1333         * page/Settings.in:
1334         * platform/audio/PlatformMediaSession.h:
1335
1336 2017-05-15  Jer Noble  <jer.noble@apple.com>
1337
1338         Only ever initialize LibWebRTCProvider's staticFactoryAndThreads() factories once.
1339         https://bugs.webkit.org/show_bug.cgi?id=172047
1340
1341         Reviewed by Youenn Fablet.
1342
1343         Wrap the initilization of the factories contained in staticFactoryAndThreads() in a call_once to ensure
1344         new factories aren't created every time it's called.
1345
1346         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1347         (WebCore::staticFactoryAndThreads):
1348
1349 2017-05-15  Joseph Pecoraro  <pecoraro@apple.com>
1350
1351         Web Inspector: CRASH seen with DOM.setOuterHTML when there is no documentElement
1352         https://bugs.webkit.org/show_bug.cgi?id=172135
1353         <rdar://problem/32175860>
1354
1355         Reviewed by Brian Burg.
1356
1357         Test: inspector/dom/setOuterHTML-no-document-element.html
1358
1359         * inspector/DOMPatchSupport.cpp:
1360         (WebCore::DOMPatchSupport::patchDocument):
1361         Null check the document element which might not exist.
1362
1363 2017-05-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
1364
1365         REGRESSION (216471): Infinite repaint-drawing loop when asynchronously decoding incomplete image frames
1366         https://bugs.webkit.org/show_bug.cgi?id=171900
1367
1368         Reviewed by Tim Horton.
1369
1370         -- Don't destroy incomplete decoded image frames for large images. This
1371         is to avoid flickering while decoding another image frame with the new
1372         data. The old incomplete image frame will be destroyed once the newer one
1373         finishes decoding.
1374
1375         -- Extend the enum ImageFrame::DecodingStatus by adding a new value called
1376         'Decoding'. This new value will never be cached in the ImageFrame::
1377         m_decodingStatus. Add a member m_currentFrameDecodingStatus to BitmapImage.
1378         The purpose of this member is to invalidate the current frame, without
1379         deleting it, when new encoded data is received.
1380
1381         -- Don't wait until the native image is decoded to cache the ImageFrame
1382         decodingStatus. There is a big chance that more data arrives between
1383         starting the decoding and finishing it such that the decoding changes
1384         from Partial to Complete. We need to prevent keeping incomplete ImageFrames
1385         cached because we mistakenly assume they are complete. To fix this issue
1386         we need to know the ImageFrame decodingStatus when the decoding is requested.
1387
1388         * platform/graphics/BitmapImage.cpp:
1389         (WebCore::BitmapImage::destroyDecodedData):
1390         (WebCore::BitmapImage::dataChanged):
1391         (WebCore::BitmapImage::draw):
1392         (WebCore::BitmapImage::internalStartAnimation): At the beginning of this 
1393         function we check whether the next frame is being decoded or not and we 
1394         return DecodingActive if it is. Let's handle the second check here also 
1395         before requesting the decoding of nextFrame. We need to check whether the
1396         nextFrame has a native image with decoded with the native size or not.
1397         (WebCore::BitmapImage::internalAdvanceAnimation):
1398         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
1399         * platform/graphics/BitmapImage.h:
1400         * platform/graphics/ImageFrame.cpp:
1401         (WebCore::ImageFrame::operator=):
1402         (WebCore::ImageFrame::setDecodingStatus):
1403         (WebCore::ImageFrame::decodingStatus):
1404         * platform/graphics/ImageFrame.h:
1405         (WebCore::ImageFrame::isInvalid):
1406         (WebCore::ImageFrame::isPartial):
1407         (WebCore::ImageFrame::isComplete):
1408         (WebCore::ImageFrame::setDecoding): Deleted.
1409         (WebCore::ImageFrame::decoding): Deleted.
1410         (WebCore::ImageFrame::isEmpty): Deleted.
1411         * platform/graphics/ImageFrameCache.cpp:
1412         (WebCore::ImageFrameCache::setNativeImage):
1413         (WebCore::ImageFrameCache::cacheMetadataAtIndex):
1414         (WebCore::ImageFrameCache::cacheNativeImageAtIndex):
1415         (WebCore::ImageFrameCache::cacheNativeImageAtIndexAsync):
1416         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
1417         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
1418         (WebCore::ImageFrameCache::stopAsyncDecodingQueue):
1419         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded):
1420         (WebCore::ImageFrameCache::frameDecodingStatusAtIndex):
1421         (WebCore::ImageFrameCache::cacheFrameMetadataAtIndex): Deleted.
1422         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Deleted.
1423         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Deleted.
1424         (WebCore::ImageFrameCache::frameIsCompleteAtIndex): Deleted.
1425         * platform/graphics/ImageFrameCache.h:
1426         (WebCore::ImageFrameCache::ImageFrameRequest::operator==):
1427         * platform/graphics/ImageSource.cpp:
1428         (WebCore::ImageSource::dataChanged):
1429         * platform/graphics/ImageSource.h:
1430         (WebCore::ImageSource::destroyIncompleteDecodedData):
1431         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Let the caller
1432         decide whether another request for the same image frame is allowed or not.
1433         (WebCore::ImageSource::frameDecodingStatusAtIndex):
1434         (WebCore::ImageSource::frameIsCompleteAtIndex): Deleted.
1435         * platform/image-decoders/ImageDecoder.cpp:
1436         (WebCore::ImageDecoder::frameDurationAtIndex):
1437         (WebCore::ImageDecoder::createFrameImageAtIndex):
1438         * platform/image-decoders/bmp/BMPImageReader.cpp:
1439         (WebCore::BMPImageReader::decodeBMP):
1440         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1441         (WebCore::GIFImageDecoder::clearFrameBufferCache):
1442         (WebCore::GIFImageDecoder::haveDecodedRow):
1443         (WebCore::GIFImageDecoder::frameComplete):
1444         (WebCore::GIFImageDecoder::initFrameBuffer):
1445         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1446         (WebCore::JPEGImageDecoder::outputScanlines):
1447         (WebCore::JPEGImageDecoder::jpegComplete):
1448         * platform/image-decoders/png/PNGImageDecoder.cpp:
1449         (WebCore::PNGImageDecoder::rowAvailable):
1450         (WebCore::PNGImageDecoder::pngComplete):
1451         (WebCore::PNGImageDecoder::clearFrameBufferCache):
1452         (WebCore::PNGImageDecoder::frameComplete):
1453         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1454         (WebCore::WEBPImageDecoder::decode):
1455
1456 2017-05-15  Chris Dumez  <cdumez@apple.com>
1457
1458         Align WebKitCSSMatrix stringifier with spec for DOMMatrix
1459         https://bugs.webkit.org/show_bug.cgi?id=172114
1460
1461         Reviewed by Simon Fraser.
1462
1463         Align WebKitCSSMatrix stringifier with spec for DOMMatrix after:
1464         - https://github.com/w3c/fxtf-drafts/pull/148
1465
1466         The following changes were made:
1467         - Use EcmaScript's ToString() to convert floating point values to string
1468         - Throw an invalid state error if the matrix contains non-finite values
1469         - Made WebKitCSSMatrix.toString enumerable as per [1].
1470
1471         [1] https://heycam.github.io/webidl/#es-stringifier
1472
1473         Test: fast/css/matrix-stringifier.html
1474
1475         * css/WebKitCSSMatrix.cpp:
1476         (WebCore::WebKitCSSMatrix::toString):
1477         * css/WebKitCSSMatrix.h:
1478         * css/WebKitCSSMatrix.idl:
1479         * platform/graphics/transforms/TransformationMatrix.cpp:
1480         (WebCore::TransformationMatrix::containsOnlyFiniteValues):
1481         * platform/graphics/transforms/TransformationMatrix.h:
1482
1483 2017-05-15  Mark Lam  <mark.lam@apple.com>
1484
1485         WorkerRunLoop::Task::performTask() should check !scriptController->isTerminatingExecution().
1486         https://bugs.webkit.org/show_bug.cgi?id=171775
1487         <rdar://problem/30975761>
1488
1489         Reviewed by Filip Pizlo.
1490
1491         Currently, WorkerThread::stop() calls scheduleExecutionTermination() to terminate
1492         JS execution first, followed by posting a cleanup task to the worker, and lastly,
1493         it invokes terminate() on the WorkerRunLoop.
1494
1495         As a result, before the run loop is terminated, the worker thread may observe the
1496         TerminatedExecutionException in JS code, bail out, see another JS task to run,
1497         re-enters the VM to run said JS code, and fails with an assertion due to the
1498         TerminatedExecutionException still being pending on VM entry.
1499
1500         WorkerRunLoop::Task::performTask() already has a check to only allow a task to
1501         run if and only if !runLoop.terminated() and the task is not a clean up task.
1502         We'll fix the above race by changing WorkerRunLoop::Task::performTask() to check
1503         !context->script()->isTerminatingExecution() instead of !runLoop.terminated().
1504         Since WorkerThread::stop() always scheduleExecutionTermination() before it
1505         terminates the run loop, !context->script()->isTerminatingExecution() implies
1506         !runLoop.terminated().
1507
1508         The only time that runLoop is terminated without scheduleExecutionTermination()
1509         being called is when WorkerThread::stop() is called before the WorkerThread has
1510         finished creating its WorkerGlobalScope.  In this scenario, WorkerThread::stop()
1511         will still terminate the run loop.  Hence, after the WorkerGlobalScope is created
1512         (in WorkerThread::workerThread()), we will check if the run loop has been
1513         terminated (i.e. stop() was called).  If so, we'll scheduleExecutionTermination()
1514         there, and guarantee that if runloop.terminated() is true, then
1515         context->script()->isTerminatingExecution() is also true.
1516
1517         Solutions that were considered but did not work (recorded for future reference):
1518
1519         1. In WorkerThread::stop(), call scheduleExecutionTermination() only after it
1520            posts the cleanup task and terminate the run loop.
1521
1522            This did not work because this creates a race where the worker thread may run
1523            the cleanup task before WorkerThread::stop() finishes.  As a result, the
1524            scriptController may be deleted before we get to invoke scheduleExecutionTermination()
1525            on it, thereby resulting in a use after free.
1526
1527            To make this work, we would have to change the life cycle management strategy
1528            of the WorkerScriptController.  This is a more risky change that we would
1529            want to take on at this time, and may also not be worth the gain.
1530
1531         2. Break scheduleExecutionTermination() up into 2 parts i.e. WorkerThread::stop()
1532            will:
1533            1. set the scriptControllers m_isTerminatingExecution flag before
1534               posting the cleanup task and terminating the run loop, and
1535            2. invoke VM::notifyNeedsTermination() after posting the cleanup task and
1536               terminating the run loop.
1537
1538            This requires that we protect the liveness of the VM until we can invoke
1539            notifyNeedsTermination() on it.
1540
1541            This did not work because:
1542            1. We may end up destructing the VM in WorkerThread::stop() i.e. in the main
1543               web frame, but only the worker thread holds the JS lock for the VM.
1544
1545               We can make the WorkerThread::stop() acquire the JS lock just before it
1546               releases the protected VM's RefPtr, but that would mean the main thread
1547               may be stuck waiting a bit for the worker thread to release its JSLock.
1548               This is not desirable.
1549
1550            2. In practice, changing the liveness period of the Worker VM relative to its
1551               WorkerScriptController and WorkerGlobalScope also has unexpected
1552               ramifications.  We observed many worker tests failing with assertion
1553               failures and crashes due to this change.
1554
1555            Hence, this approach is also a more risky change than it appears on the
1556            surface, and is not worth exploring at this time.
1557
1558         In the end, changing WorkerRunLoop::Task::performTask() to check for
1559         !scriptController->isTerminatingExecution() is the most straight forward solution
1560         that is easy to prove correct.
1561
1562         Also fixed a race in WorkerThread::workerThread() where it can delete the
1563         WorkerGlobalScope while WorkerThread::stop() is in the midst of accessing it.
1564         We now guard the the nullifying of m_workerGlobalScope with the
1565         m_threadCreationAndWorkerGlobalScopeMutex as well.
1566
1567         UPDATE: the only new thing in this patch for re-landing (vs one previously landed)
1568         is that instead of nullifying m_workerGlobalScope directly (thereby deleting the
1569         WorkerGlobalScope context), we'll swap it out and delete it only after we've
1570         unlocked the m_threadCreationAndWorkerGlobalScopeMutex.  This is needed because
1571         the destruction of the WorkerGlobalScope will cause the main thread to race against
1572         the worker thread to delete the WorkerThread object, and the WorkerThread object
1573         owns the mutex that we need to unlock after nullifying the m_workerGlobalScope
1574         field.
1575
1576         This issue is covered by an existing test that I just unskipped in TestExpectations.
1577
1578         * bindings/js/JSDOMPromiseDeferred.cpp:
1579         (WebCore::DeferredPromise::callFunction):
1580
1581         * bindings/js/WorkerScriptController.cpp:
1582         (WebCore::WorkerScriptController::scheduleExecutionTermination):
1583         - Added a check to do nothing and return early if the scriptController is already
1584           terminating execution.
1585
1586         * workers/WorkerRunLoop.cpp:
1587         (WebCore::WorkerRunLoop::runInMode):
1588         (WebCore::WorkerRunLoop::runCleanupTasks):
1589         (WebCore::WorkerRunLoop::Task::performTask):
1590
1591         * workers/WorkerRunLoop.h:
1592         - Made Task::performTask() private and make Task befriend the WorkerRunLoop class.
1593           This ensures that only the WorkerRunLoop may call performTask().
1594           Note: this change only formalizes and hardens a relationship that was already
1595           in place before this.
1596
1597         * workers/WorkerThread.cpp:
1598         (WebCore::WorkerThread::start):
1599         (WebCore::WorkerThread::workerThread):
1600         (WebCore::WorkerThread::stop):
1601         * workers/WorkerThread.h:
1602         - Renamed m_threadCreationMutex to m_threadCreationAndWorkerGlobalScopeMutex so
1603           that it more accurately describes what it guards.
1604
1605 2017-05-15  Myles C. Maxfield  <mmaxfield@apple.com>
1606
1607         Unicode characters which can't be rendered in any font are invisible
1608         https://bugs.webkit.org/show_bug.cgi?id=171942
1609         <rdar://problem/32054234>
1610
1611         Reviewed by Tim Horton.
1612
1613         There are some Unicode characters which don't have any font on the system which can render them.
1614         These characters should be drawn as the .notdef "tofu." This is for security and usability, as
1615         well as what Firefox and Chrome do. However, we still shouldn't draw characters with the
1616         Default_Ignorable_Code_Point property, because this is what CoreText does.
1617
1618         This behavior is also what the Unicode spec recommends: In UTR #36 Unicode Security Considerations:
1619         http://www.unicode.org/reports/tr36/#Recommendations_General
1620         "If there is no available glyph for a character, never show a simple "?" or omit the character."
1621
1622         Also relevant is the Unicode Standard section 5.3 Unknown and MIssing Characters, starting at page
1623         marked 203 in the following: http://www.unicode.org/versions/Unicode9.0.0/ch05.pdf
1624
1625         Tests: fast/text/default-ignorable.html
1626                fast/text/unknown-char-notdef.html
1627
1628         * platform/graphics/WidthIterator.cpp:
1629         (WebCore::characterMustDrawSomething):
1630
1631 2017-05-15  Timothy Horton  <timothy_horton@apple.com>
1632
1633         Null deref under WebContentReader::readURL when interacting with a file URL
1634         https://bugs.webkit.org/show_bug.cgi?id=172045
1635         <rdar://problem/25880647>
1636
1637         Reviewed by Wenson Hsieh.
1638
1639         * editing/ios/EditorIOS.mm:
1640         (WebCore::Editor::WebContentReader::readURL):
1641         The AppSupport soft link was wrong, as there is no such framework in /System/Library/Frameworks.
1642         Thus, any time we hit this codepath, the soft linked function would be null, and calling it would crash.
1643         Instead of just fixing the soft link, remove the code, because it does not seem necessary to
1644         special-case fileURLs to images in the media directory.
1645
1646 2017-05-15  Eric Carlson  <eric.carlson@apple.com>
1647
1648         ASSERTION FAILED: wasRemoved in WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver(DevicesChangedObserverToken)
1649         https://bugs.webkit.org/show_bug.cgi?id=171529
1650         <rdar://problem/31945791>
1651
1652         Reviewed by Jer Noble.
1653
1654         No new tests, fixes a crash in existing tests.
1655
1656         * Modules/mediastream/MediaDevices.cpp:
1657         (WebCore::MediaDevices::MediaDevices): Use a weak ptr.
1658
1659         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1660         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1661         (WebCore::observerMap):  Use a static hash map for observers because the
1662         source center can change at runtime.
1663         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver):
1664         (WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver):
1665         (WebCore::RealtimeMediaSourceCenter::captureDevicesChanged):
1666
1667 2017-05-15  Brent Fulgham  <bfulgham@apple.com>
1668
1669         [iOS WK1] Do not try to dispatch messages to subframes if their documents have not been constructed yet.
1670         https://bugs.webkit.org/show_bug.cgi?id=172059
1671         <rdar://problem/31963192>
1672
1673         Reviewed by Zalan Bujtas.
1674
1675         On iOS WK1 we can end up in an inconsistent state, where
1676         1. The web thread is inside a newly-injected iframe's document's constructor and
1677         2. waiting on a delegate callback on the main thread
1678         while the main thread
1679         (a) Evaluates arbitrary JavaScript that modifies storage which
1680         (b) Triggers an event dispatch.
1681  
1682         * storage/StorageEventDispatcher.cpp:
1683         (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents): If the sub-frame's document
1684         is in an inconsistent state, skip it.
1685         (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents): Ditto.
1686         (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames): Ditto.
1687         (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames): Ditto.
1688
1689 2017-05-15  Zalan Bujtas  <zalan@apple.com>
1690
1691         Simple line layout: Leading whitespace followed by a <br> produces an extra linebreak.
1692         https://bugs.webkit.org/show_bug.cgi?id=172076
1693
1694         Reviewed by Antti Koivisto.
1695
1696         When the collapsed whitespace does not fit the line, we need to push it to the next line
1697         so that we can decide whether any soft/hard linebreak should be skipped (to avoid double line breaks) or not.
1698
1699         Test: fast/text/simple-line-layout-leading-whitespace-with-soft-hard-linebreak.html
1700
1701         * rendering/SimpleLineLayout.cpp:
1702         (WebCore::SimpleLineLayout::consumeLineBreakIfNeeded): special handling <br>
1703         (WebCore::SimpleLineLayout::firstFragment): Now we need to deal with leading collapsed whitespace.
1704         (WebCore::SimpleLineLayout::createLineRuns): We need to push even the collapsed whitespace to the next line.
1705
1706 2017-05-15  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1707
1708         Invalid MediaSource duration value should throw TyperError instead of InvalidStateError
1709         https://bugs.webkit.org/show_bug.cgi?id=171653
1710
1711         Reviewed by Chris Dumez.
1712
1713         Modify MediaSource::setDuration to throw a TypeError when duration value is invalid as per MSE specification
1714         (https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-duration).
1715
1716         Update expectations of corresponding WPT test.
1717
1718         * Modules/mediasource/MediaSource.cpp:
1719         (WebCore::MediaSource::setDuration):
1720         (WebCore::MediaSource::setDurationInternal):
1721
1722 2017-05-15  Gwang Yoon Hwang  <yoon@igalia.com>
1723
1724         [CAIRO] Painting an image mask with a matrix above Pixman's limit breaks internal states of Cairo
1725         https://bugs.webkit.org/show_bug.cgi?id=169094
1726
1727         Reviewed by Žan Doberšek.
1728
1729         It is the same problem which addressed in r212431.
1730         In HiDPI situation, it happens easily due to the size of coordinates.
1731         Also, if this bug happens, it will break the rendering continuously
1732         since we are reusing graphics contexts to render webpages in same
1733         webview.
1734
1735         Test: fast/hidpi/hidpi-long-page-with-inset-element.html
1736
1737         * platform/graphics/cairo/PlatformContextCairo.cpp:
1738         (WebCore::PlatformContextCairo::pushImageMask):
1739         We can avoid the limit of the Pixman by reducing the source surface's
1740         size, and it will create a minimal pattern matrix.
1741
1742 2017-05-14  Zan Dobersek  <zdobersek@igalia.com>
1743
1744         Unreviewed build fix with newer Perl versions.
1745
1746         * bindings/scripts/CodeGeneratorJS.pm:
1747         (AddLegacyCallerOperationIfNeeded): Support for experimental push on scalar (and
1748         other auto-dereferencing) was removed in Perl 5.24. Instead, the LegacyCallers array
1749         has to be dereferenced when pushing new values to it.
1750
1751 2017-05-14  Sam Weinig  <sam@webkit.org>
1752
1753         [WebIDL/DOM] Remove need for custom bindings for HTMLAllCollection and bring up to spec
1754         https://bugs.webkit.org/show_bug.cgi?id=172095
1755
1756         Reviewed by Darin Adler.
1757
1758         - Adds support for the legacycaller WebIDL special annotation.
1759         - Updates implementation of HTMLAllCollection to match the current HTML spec.
1760
1761         Test: fast/dom/document-all.html
1762
1763         * CMakeLists.txt:
1764         * WebCore.xcodeproj/project.pbxproj:
1765         * bindings/js/JSBindingsAllInOne.cpp:
1766         * bindings/js/JSHTMLAllCollectionCustom.cpp: Removed.
1767         Removed JSHTMLAllCollectionCustom.cpp
1768
1769         * bindings/scripts/CodeGeneratorJS.pm:
1770         (GenerateInterface):
1771         (AddLegacyCallerOperationIfNeeded):
1772         Before code generation, clone all the legacycaller operations and put them
1773         in their own set, so they can form an overload set.
1774         
1775         (AddStringifierOperationIfNeeded):
1776         Use IDLParser::cloneType as the FIXME suggested.
1777
1778         (GenerateHeader):
1779         Group call related functionality together and use new IsCallable predicate.
1780
1781         (GenerateOverloadedFunctionOrConstructor):
1782         Generalize a little bit to allow the function being overloaded to be an overloaded legacycaller.
1783
1784         (GenerateImplementation):
1785         Add call to generate the legacycaller code.
1786
1787         (GenerateLegacyCallerDefinitions):
1788         (GenerateLegacyCallerDefinition):
1789         Generate the legacycaller definition, using GenerateArgumentsCountCheck, GenerateParametersCheck
1790         and GenerateImplementationFunctionCall to do all the heavy lifting.
1791
1792         (IsCallable):
1793         Add helper predicate for both custom calls and legacycaller.
1794
1795         * bindings/scripts/IDLParser.pm:
1796         (cloneType):.
1797         (cloneArgument):.
1798         (cloneOperation):
1799         Add cloning functions for IDLArgument and IDLOperation, and make IDLType's
1800         clone feasible for calling outside the package by removing the unneeded 
1801         self parameter.
1802
1803         * bindings/scripts/test/JS/JSTestObj.cpp
1804         * bindings/scripts/test/JS/JSTestObj.h
1805         * bindings/scripts/test/TestObj.idl:
1806         Add testing of legacycaller overloading.
1807
1808         * dom/Document.cpp:
1809         (WebCore::Document::allFilteredByName):
1810         * dom/Document.h:
1811         Add new collection access for the HTMLAllNamedSubCollection.
1812
1813         * html/CachedHTMLCollection.h:
1814         (WebCore::nameShouldBeVisibleInDocumentAll):
1815         Update list of tags to match the current spec.
1816
1817         * html/CollectionType.h:
1818         Add new type for HTMLAllNamedSubCollection.
1819
1820         * html/GenericCachedHTMLCollection.cpp:
1821         (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
1822         Specify that DocumentAllNamedItems does not want
1823         the default elementMatches.
1824  
1825         * html/HTMLAllCollection.cpp:
1826         (WebCore::HTMLAllCollection::namedOrIndexedItemOrItems):
1827         (WebCore::HTMLAllCollection::namedItemOrItems):
1828         (WebCore::HTMLAllNamedSubCollection::~HTMLAllNamedSubCollection):
1829         (WebCore::HTMLAllNamedSubCollection::elementMatches):
1830         * html/HTMLAllCollection.h:
1831         Move implementations from the custom binding, and re-implement to
1832         match the spec. Alternate names to item/namedItem were needed to not
1833         shadow the existing ones in HTMLCollection. HTMLAllNamedSubCollection
1834         is a simple HTMLCollection that matches on a name, following the rules
1835         of document.all about which tags can have name attributes.
1836
1837         * html/HTMLAllCollection.idl:
1838         Remove custom annotations and add legacycaller which is now supported.
1839
1840         * html/HTMLCollection.cpp:
1841         (WebCore::invalidationTypeExcludingIdAndNameAttributes):
1842         (WebCore::HTMLCollection::~HTMLCollection):
1843         Add DocumentAllNamedItems.
1844
1845 2017-05-14  Zalan Bujtas  <zalan@apple.com>
1846
1847         Remove unused lambda in TextFragmentIterator::TextFragment::split() and cleanup dependencies.
1848         https://bugs.webkit.org/show_bug.cgi?id=172089
1849
1850         Reviewed by David Kilzer.
1851
1852         * rendering/SimpleLineLayout.cpp:
1853         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
1854         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1855         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
1856         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
1857
1858 2017-05-13  David Kilzer  <ddkilzer@apple.com>
1859
1860         Unused lambda in JSWebKitSubtleCrypto::wrapKey()
1861         <https://webkit.org/b/172087>
1862
1863         Reviewed by Chris Dumez.
1864
1865         Fixes the following warning with newer clang:
1866
1867             Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp:594:35: error: lambda capture 'keyFormat' is not used [-Werror,-Wunused-lambda-capture]
1868                 auto exportSuccessCallback = [keyFormat, algorithm, parameters, wrappingKey, wrapper](const Vector<uint8_t>& exportedKeyData) mutable {
1869                                               ^
1870
1871         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1872         (WebCore::JSWebKitSubtleCrypto::wrapKey): Remove unused lambda.
1873
1874 2017-05-13  Eric Carlson  <eric.carlson@apple.com>
1875
1876         [MediaStream] deviceId constraint doesn't work with getUserMedia
1877         https://bugs.webkit.org/show_bug.cgi?id=171877
1878         <rdar://problem/31899730>
1879
1880         Reviewed by Jer Noble.
1881
1882         Test: fast/mediastream/get-user-media-device-id.html
1883
1884         * Modules/mediastream/MediaConstraintsImpl.h:
1885         (WebCore::MediaConstraintsData::MediaConstraintsData): Add a constructor that 
1886         takes a const MediaConstraints&.
1887
1888         * Modules/mediastream/MediaDevices.cpp:
1889         (WebCore::MediaDevices::~MediaDevices): m_deviceChangedToken is a std::optional<>.
1890         * Modules/mediastream/MediaDevices.h:
1891
1892         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
1893         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): Don't return
1894         NULL for the main frame so the origin matches that returned for a UserMediaRequest.
1895
1896         * Modules/mediastream/UserMediaController.h:
1897         (WebCore::UserMediaController::setDeviceIDHashSalt): Deleted, not used.
1898         (WebCore::UserMediaController::deviceIDHashSalt): Deleted, not used.
1899
1900         * Modules/mediastream/UserMediaRequest.cpp:
1901         (WebCore::UserMediaRequest::allow): Add device ID hash salt parameter, set it on
1902         constraints.
1903         * Modules/mediastream/UserMediaRequest.h:
1904
1905         * platform/mediastream/MediaConstraints.h:
1906         * platform/mediastream/RealtimeMediaSource.cpp:
1907         (WebCore::RealtimeMediaSource::fitnessDistance): ASSERT if called for DeviceId.
1908         (WebCore::RealtimeMediaSource::selectSettings): Special case DeviceId because it
1909         we have to hash the device ID before comparing, and because the DeviceId can't be
1910         changed so it should never be added to the flattened constraints.
1911         (WebCore::RealtimeMediaSource::supportsConstraints):
1912         (WebCore::RealtimeMediaSource::applyConstraints):
1913         * platform/mediastream/RealtimeMediaSource.h:
1914
1915         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1916         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Implement.
1917         * platform/mediastream/RealtimeMediaSourceCenter.h:
1918
1919         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
1920         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint): Deleted, unused.
1921         (WebCore::RealtimeMediaSourceSupportedConstraints::constraintFromName): Deleted, unused.
1922         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
1923
1924         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1925         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1926         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints): Pass device
1927         id, not empty string.
1928         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints): Deleted.
1929         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1930
1931         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1932         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints): Deleted.
1933         * platform/mock/MockRealtimeMediaSourceCenter.h:
1934
1935 2017-05-13  Chris Dumez  <cdumez@apple.com>
1936
1937         Stop using RefPtr::release()
1938         https://bugs.webkit.org/show_bug.cgi?id=172074
1939
1940         Reviewed by Geoffrey Garen.
1941
1942         * css/parser/CSSPropertyParser.cpp:
1943         (WebCore::FontVariantLigaturesParser::finalizeValue):
1944         (WebCore::FontVariantNumericParser::finalizeValue):
1945         * css/parser/CSSPropertyParserHelpers.cpp:
1946         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
1947         * loader/SubresourceLoader.cpp:
1948         (WebCore::SubresourceLoader::create):
1949         * loader/archive/mhtml/MHTMLArchive.cpp:
1950         (WebCore::MHTMLArchive::generateMHTMLData):
1951         * loader/archive/mhtml/MHTMLArchive.h:
1952         * loader/archive/mhtml/MHTMLParser.cpp:
1953         (WebCore::MHTMLParser::parseArchiveWithHeader):
1954         * platform/audio/ios/AudioFileReaderIOS.cpp:
1955         (WebCore::AudioFileReader::createBus):
1956         * platform/glib/SharedBufferGlib.cpp:
1957         (WebCore::SharedBuffer::createFromReadingFile):
1958         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
1959         (WebCore::CACFLayerTreeHost::create):
1960         * platform/graphics/cairo/CairoUtilities.cpp:
1961         (WebCore::copyCairoImageSurface):
1962         * platform/graphics/cairo/ImageBufferCairo.cpp:
1963         (WebCore::getImageData):
1964         * platform/graphics/gtk/IconGtk.cpp:
1965         (WebCore::Icon::createIconForFiles):
1966         * platform/graphics/win/FontCacheWin.cpp:
1967         (WebCore::FontCache::systemFallbackForCharacters):
1968         * platform/win/SharedBufferWin.cpp:
1969         (WebCore::SharedBuffer::createFromReadingFile):
1970
1971 2017-05-13  Javier Fernandez  <jfernandez@igalia.com>
1972
1973         [css-align] Implement the place-self shorthand
1974         https://bugs.webkit.org/show_bug.cgi?id=168846
1975
1976         Reviewed by Zalan Bujtas.
1977
1978         The CSS Box Alignment specification defines a new shorthand to set the
1979         Content Alignment properties (align-self and justify-self) at the
1980         same time.
1981
1982         This patch provides the implementation of the CSS parsing logic and the
1983         required regression tests.
1984
1985         Test: css3/parse-place-self.html
1986
1987         * css/CSSComputedStyleDeclaration.cpp:
1988         (WebCore::ComputedStyleExtractor::propertyValue):
1989         * css/CSSProperties.json:
1990         * css/StyleProperties.cpp:
1991         (WebCore::StyleProperties::getPropertyValue):
1992         * css/parser/CSSPropertyParser.cpp:
1993         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand):
1994         (WebCore::CSSPropertyParser::parseShorthand):
1995         * css/parser/CSSPropertyParser.h:
1996
1997 2017-05-13  Commit Queue  <commit-queue@webkit.org>
1998
1999         Unreviewed, rolling out r216801.
2000         https://bugs.webkit.org/show_bug.cgi?id=172072
2001
2002         Many memory corruption crashes on worker threads (Requested by
2003         ap on #webkit).
2004
2005         Reverted changeset:
2006
2007         "WorkerRunLoop::Task::performTask() should check
2008         !scriptController->isTerminatingExecution()."
2009         https://bugs.webkit.org/show_bug.cgi?id=171775
2010         http://trac.webkit.org/changeset/216801
2011
2012 2017-05-13  Zalan Bujtas  <zalan@apple.com>
2013
2014         AccessibilityRenderObject::textUnderElement needs to assert on unclean tree.
2015         https://bugs.webkit.org/show_bug.cgi?id=172065
2016
2017         Reviewed by Simon Fraser.
2018
2019         r192103 changed the assert logic incorrectly. If the tree is dirty, regardless of the renderer's type,
2020         TextIterator will end up forcing style update/layout on the render tree.
2021         The original assert would have hit with bug 171546 prior to r216726.
2022
2023         * accessibility/AccessibilityRenderObject.cpp:
2024         (WebCore::AccessibilityRenderObject::textUnderElement):
2025
2026 2017-05-12  Simon Fraser  <simon.fraser@apple.com>
2027
2028         event.clientX/clientY should be in layout viewport coordinates
2029         https://bugs.webkit.org/show_bug.cgi?id=172018
2030
2031         Reviewed by Zalan Bujtas.
2032
2033         Fix clientX and clientY on mouse events to be relative to the layout viewport, to match
2034         getBoundingClientRect(), getClientRects() and fixed-position objects.
2035
2036         Also minor cleanup of MouseRelatedEvent to use initializers.
2037
2038         Test: fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html
2039
2040         * dom/MouseRelatedEvent.cpp:
2041         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
2042         (WebCore::MouseRelatedEvent::init):
2043         (WebCore::MouseRelatedEvent::initCoordinates):
2044         (WebCore::contentsScrollOffset): Deleted.
2045         * dom/MouseRelatedEvent.h:
2046
2047 2017-05-12  Sam Weinig  <sam@webkit.org>
2048
2049         [WebIDL] Remove need for custom binding for Worker constructor
2050         https://bugs.webkit.org/show_bug.cgi?id=172050
2051
2052         Reviewed by Chris Dumez.
2053
2054         * CMakeLists.txt:
2055         * WebCore.xcodeproj/project.pbxproj:
2056         * bindings/js/JSWorkerCustom.cpp: Removed.
2057         Remove JSWorkerCustom.cpp
2058
2059         * bindings/scripts/CodeGeneratorJS.pm:
2060         (GenerateCallWith):
2061         * bindings/scripts/IDLAttributes.json:
2062         Add RuntimeFlags as a new option for the ConstructorCallWith extended attribute.
2063
2064         * workers/Worker.cpp:
2065         (WebCore::Worker::create):
2066         * workers/Worker.h:
2067         Update order of arguments to appease the generator.
2068
2069         * workers/Worker.idl:
2070         Add extended attributes for the constructor.
2071
2072 2017-05-12  Simon Fraser  <simon.fraser@apple.com>
2073
2074         The rects returned by Element/Range.getClientRects() should not be rounded
2075         https://bugs.webkit.org/show_bug.cgi?id=172057
2076
2077         Reviewed by Chris Dumez.
2078
2079         Fix createDOMRectVector() to not expand the rects to integer boundaries (which
2080         quad.enclosingBoundingBox() does), but to return rects with floating point
2081         values. This matches Chrome and Firefox, and matches getBoundingClientRect(),
2082         which does not integral snap.
2083
2084         * dom/DOMRect.cpp:
2085         (WebCore::createDOMRectVector):
2086
2087 2017-05-12  Jiewen Tan  <jiewen_tan@apple.com>
2088
2089         Elements should be inserted into a template element as its content's last child
2090         https://bugs.webkit.org/show_bug.cgi?id=171373
2091         <rdar://problem/31862949>
2092
2093         Reviewed by Ryosuke Niwa.
2094
2095         Before this change, our HTML parser obeys the following premises:
2096         1) A fostering child whose parent is a table should be inserted before its parent and under its grandparent.
2097         2) When inserting into a template element, an element should be inserted into its content.
2098
2099         Let's walk through the example:
2100         a) Before eventhandler takes place
2101         template
2102         table
2103             svg <- parser
2104         b) After eventhandler takes place
2105         template
2106             table
2107                 svg <- parser
2108         c) after parsing svg
2109         template
2110             content
2111                 svg
2112                 (table)
2113             table
2114
2115         Finally, in the example, the svg element will be inserted into the content of the template element while
2116         having its next sibling point to the table element. However, the table element is actually under the
2117         template element not its content.
2118
2119         This messy tree is constructed because the second premise is incompleted. It should be: When inserting into
2120         a template element, an element should be inserted into its content as its last child.
2121         Quoted from Step 3 of https://html.spec.whatwg.org/multipage/syntax.html#appropriate-place-for-inserting-a-node
2122         A correct tree will then looks like:
2123         template
2124             content
2125                 svg
2126             table
2127
2128         Tests: fast/dom/HTMLTemplateElement/insert-fostering-child-crash.html
2129                fast/dom/HTMLTemplateElement/insert-fostering-child.html
2130
2131         * html/parser/HTMLConstructionSite.cpp:
2132         (WebCore::insert):
2133         By nullifying task.nextChild, it will force the parser to append the element as task.parent's last child.
2134
2135 2017-05-12  Alex Christensen  <achristensen@webkit.org>
2136
2137         Rename WKContentExtension to WKContentRuleList
2138         https://bugs.webkit.org/show_bug.cgi?id=172053
2139         <rdar://problem/32141005>
2140
2141         Reviewed by Geoffrey Garen.
2142
2143         Covered by existing API tests.
2144
2145         * English.lproj/Localizable.strings:
2146
2147 2017-05-12  Timothy Horton  <timothy_horton@apple.com>
2148
2149         Don't use LinkPresentation URL shortening if it's not available
2150         https://bugs.webkit.org/show_bug.cgi?id=172064
2151         <rdar://problem/32169232>
2152
2153         Rubber-stamped by Wenson Hsieh.
2154
2155         * platform/mac/DragImageMac.mm:
2156         (WebCore::LinkImageLayout::LinkImageLayout):
2157         * platform/spi/cocoa/LinkPresentationSPI.h:
2158
2159 2017-05-11  Simon Fraser  <simon.fraser@apple.com>
2160
2161         Incorrect position when dragging jQuery Draggable elements with position fixed after pinch zoom
2162         https://bugs.webkit.org/show_bug.cgi?id=171113
2163         rdar://problem/31746516
2164
2165         Reviewed by Tim Horton.
2166
2167         Make getBoundingClientRect() and getClientRects() return rects which are relative to the layout
2168         viewport, rather than the visual viewport. This goes part of the way to fixing webkit.org/b/170981,
2169         which aims to make pinch-zoom invisible to web pages ("inert visual viewport"). It fixes issues on various
2170         sites like Facebook when zoomed.
2171
2172         Factor coordinate conversion code into functions on FrameView, which now documents
2173         the various coordinate systems in a big comment. Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale()
2174         and Document::adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale() are renamed and factored
2175         to use these helpers.
2176
2177         There are two behavior changes here:
2178
2179         1. FrameView::documentToClientOffset() now uses the origin of the layout viewport in the "document to client"
2180            coordinate mapping.
2181            
2182         2. The two document functions would apply the scale and offset in the wrong order. We need
2183            to first undo the effects of CSS zoom, page zoom and page scale, and then map from document
2184            to client coordinates.
2185
2186         Tests: fast/visual-viewport/client-rects-relative-to-layout-viewport.html
2187                fast/zooming/client-rects-with-css-and-page-zoom.html
2188
2189         * dom/Document.cpp:
2190         (WebCore::Document::convertAbsoluteToClientQuads):
2191         (WebCore::Document::convertAbsoluteToClientRect):
2192         (WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale): Deleted.
2193         (WebCore::Document::adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale): Deleted.
2194         * dom/Document.h:
2195         * dom/Element.cpp:
2196         (WebCore::Element::getClientRects):
2197         (WebCore::Element::getBoundingClientRect):
2198         * dom/Range.cpp:
2199         (WebCore::Range::borderAndTextQuads):
2200         * page/FrameView.cpp:
2201         (WebCore::FrameView::absoluteToDocumentScaleFactor):
2202         (WebCore::FrameView::absoluteToDocumentRect):
2203         (WebCore::FrameView::absoluteToDocumentPoint):
2204         (WebCore::FrameView::documentToClientOffset):
2205         (WebCore::FrameView::documentToClientRect):
2206         (WebCore::FrameView::documentToClientPoint):
2207         * page/FrameView.h:
2208         * platform/ScrollableArea.h: #pragma once
2209         * platform/Scrollbar.h: #pragma once
2210         * platform/Widget.h: #pragma once
2211
2212 2017-05-12  Mark Lam  <mark.lam@apple.com>
2213
2214         WorkerRunLoop::Task::performTask() should check !scriptController->isTerminatingExecution().
2215         https://bugs.webkit.org/show_bug.cgi?id=171775
2216         <rdar://problem/30975761>
2217
2218         Reviewed by Saam Barati.
2219
2220         Currently, WorkerThread::stop() calls scheduleExecutionTermination() to terminate
2221         JS execution first, followed by posting a cleanup task to the worker, and lastly,
2222         it invokes terminate() on the WorkerRunLoop.
2223
2224         As a result, before the run loop is terminated, the worker thread may observe the
2225         TerminatedExecutionException in JS code, bail out, see another JS task to run,
2226         re-enters the VM to run said JS code, and fails with an assertion due to the
2227         TerminatedExecutionException still being pending on VM entry.
2228
2229         WorkerRunLoop::Task::performTask() already has a check to only allow a task to
2230         run if and only if !runLoop.terminated() and the task is not a clean up task.
2231         We'll fix the above race by changing WorkerRunLoop::Task::performTask() to check
2232         !context->script()->isTerminatingExecution() instead of !runLoop.terminated().
2233         Since WorkerThread::stop() always scheduleExecutionTermination() before it
2234         terminates the run loop, !context->script()->isTerminatingExecution() implies
2235         !runLoop.terminated().
2236
2237         The only time that runLoop is terminated without scheduleExecutionTermination()
2238         being called is when WorkerThread::stop() is called before the WorkerThread has
2239         finished creating its WorkerGlobalScope.  In this scenario, WorkerThread::stop()
2240         will still terminate the run loop.  Hence, after the WorkerGlobalScope is created
2241         (in WorkerThread::workerThread()), we will check if the run loop has been
2242         terminated (i.e. stop() was called).  If so, we'll scheduleExecutionTermination()
2243         there, and guarantee that if runloop.terminated() is true, then
2244         context->script()->isTerminatingExecution() is also true.
2245
2246         Solutions that were considered but did not work (recorded for future reference):
2247
2248         1. In WorkerThread::stop(), call scheduleExecutionTermination() only after it
2249            posts the cleanup task and terminate the run loop.
2250
2251            This did not work because this creates a race where the worker thread may run
2252            the cleanup task before WorkerThread::stop() finishes.  As a result, the
2253            scriptController may be deleted before we get to invoke scheduleExecutionTermination()
2254            on it, thereby resulting in a use after free.
2255
2256            To make this work, we would have to change the life cycle management strategy
2257            of the WorkerScriptController.  This is a more risky change that we would
2258            want to take on at this time, and may also not be worth the gain.
2259
2260         2. Break scheduleExecutionTermination() up into 2 parts i.e. WorkerThread::stop()
2261            will:
2262            1. set the scriptControllers m_isTerminatingExecution flag before
2263               posting the cleanup task and terminating the run loop, and
2264            2. invoke VM::notifyNeedsTermination() after posting the cleanup task and
2265               terminating the run loop.
2266
2267            This requires that we protect the liveness of the VM until we can invoke
2268            notifyNeedsTermination() on it.
2269
2270            This did not work because:
2271            1. We may end up destructing the VM in WorkerThread::stop() i.e. in the main
2272               web frame, but only the worker thread holds the JS lock for the VM.
2273
2274               We can make the WorkerThread::stop() acquire the JS lock just before it
2275               releases the protected VM's RefPtr, but that would mean the main thread
2276               may be stuck waiting a bit for the worker thread to release its JSLock.
2277               This is not desirable.
2278
2279            2. In practice, changing the liveness period of the Worker VM relative to its
2280               WorkerScriptController and WorkerGlobalScope also has unexpected
2281               ramifications.  We observed many worker tests failing with assertion
2282               failures and crashes due to this change.
2283
2284            Hence, this approach is also a more risky change than it appears on the
2285            surface, and is not worth exploring at this time.
2286
2287         In the end, changing WorkerRunLoop::Task::performTask() to check for
2288         !scriptController->isTerminatingExecution() is the most straight forward solution
2289         that is easy to prove correct.
2290
2291         Also fixed a race in WorkerThread::workerThread() where it can delete the
2292         WorkerGlobalScope while WorkerThread::stop() is in the midst of accessing it.
2293         We now guard the the nullifying of m_workerGlobalScope with the
2294         m_threadCreationAndWorkerGlobalScopeMutex as well.
2295
2296         This issue is covered by an existing test that I just unskipped in TestExpectations.
2297
2298         * bindings/js/JSDOMPromiseDeferred.cpp:
2299         (WebCore::DeferredPromise::callFunction):
2300
2301         * bindings/js/WorkerScriptController.cpp:
2302         (WebCore::WorkerScriptController::scheduleExecutionTermination):
2303         - Added a check to do nothing and return early if the scriptController is already
2304           terminating execution.
2305
2306         * workers/WorkerRunLoop.cpp:
2307         (WebCore::WorkerRunLoop::runInMode):
2308         (WebCore::WorkerRunLoop::runCleanupTasks):
2309         (WebCore::WorkerRunLoop::Task::performTask):
2310
2311         * workers/WorkerRunLoop.h:
2312         - Made Task::performTask() private and make Task befriend the WorkerRunLoop class.
2313           This ensures that only the WorkerRunLoop may call performTask().
2314           Note: this change only formalizes and hardens a relationship that was already
2315           in place before this.
2316
2317         * workers/WorkerThread.cpp:
2318         (WebCore::WorkerThread::start):
2319         (WebCore::WorkerThread::workerThread):
2320         (WebCore::WorkerThread::stop):
2321         * workers/WorkerThread.h:
2322         - Renamed m_threadCreationMutex to m_threadCreationAndWorkerGlobalScopeMutex so
2323           that it more accurately describes what it guards.
2324
2325 2017-05-12  Zalan Bujtas  <zalan@apple.com>
2326
2327         [iOS WK1] Do not try to layout a subframe if its document has not been constructed yet.
2328         https://bugs.webkit.org/show_bug.cgi?id=172042
2329         <rdar://problem/32084098>
2330
2331         Reviewed by Antti Koivisto.
2332
2333         On iOS WK1 we can end up in an inconsistent state, where 
2334         1. the web thread is inside a newly injected iframe's document's c'tor and 
2335         2. waiting on a delegate callback on the main thread
2336         while the main thread
2337         1. executes a pending didLayout() task
2338         2. triggers layout on the newly injected iframe.
2339
2340         * rendering/RenderWidget.cpp:
2341         (WebCore::RenderWidget::updateWidgetPosition):
2342
2343 2017-05-11  Jiewen Tan  <jiewen_tan@apple.com>
2344
2345         Check existence of a page before accessing its plugins
2346         https://bugs.webkit.org/show_bug.cgi?id=171712
2347         <rdar://problem/32007806>
2348
2349         Reviewed by Brent Fulgham.
2350
2351         Test: plugins/navigator-plugin-crash.html
2352
2353         * plugins/DOMPlugin.cpp:
2354         (WebCore::DOMPlugin::item):
2355         (WebCore::DOMPlugin::namedItem):
2356
2357 2017-05-12  Simon Fraser  <simon.fraser@apple.com>
2358
2359         Add some logging for layer tree commits, and resize and orientation change events
2360         https://bugs.webkit.org/show_bug.cgi?id=172041
2361
2362         Reviewed by Tim Horton.
2363
2364         Add some logging that's useful during rotation investigations.
2365
2366         * dom/Document.cpp:
2367         (WebCore::Document::orientationChanged):
2368         * page/FrameView.cpp:
2369         (WebCore::FrameView::sendResizeEventIfNeeded):
2370
2371 2017-05-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2372
2373         [Readable Streams API] Add ReadableStreamBYOBReader closed getter
2374         https://bugs.webkit.org/show_bug.cgi?id=172024
2375
2376         Reviewed by Youenn Fablet.
2377
2378         Added tests to check closed getter behaviour.
2379
2380         * Modules/streams/ReadableStreamBYOBReader.js:
2381         (closed): Implemented.
2382
2383 2017-05-12  Andreas Kling  <akling@apple.com>
2384
2385         MediaResourceLoader shouldn't keep its HTMLMediaElement alive.
2386         https://bugs.webkit.org/show_bug.cgi?id=172032
2387         <rdar://problem/30816144>
2388
2389         Reviewed by Joseph Pecoraro.
2390
2391         Use a WeakPtr<HTMLMediaElement> in MediaResourceLoader instead, since the loader
2392         is retained by a NSURLSession object we hand over to AVFoundation.
2393
2394         This prevents AVFoundation from keeping entire documents alive outside our control.
2395
2396         * html/HTMLMediaElement.cpp:
2397         (WebCore::HTMLMediaElement::HTMLMediaElement):
2398         * html/HTMLMediaElement.h:
2399         (WebCore::HTMLMediaElement::createWeakPtr):
2400         * loader/MediaResourceLoader.cpp:
2401         (WebCore::MediaResourceLoader::MediaResourceLoader):
2402         (WebCore::MediaResourceLoader::requestResource):
2403         * loader/MediaResourceLoader.h:
2404
2405 2017-05-12  Andreas Kling  <akling@apple.com>
2406
2407         Memory pressure response should only do sync bmalloc scavenge in sync mode.
2408         https://bugs.webkit.org/show_bug.cgi?id=172035
2409
2410         Reviewed by Michael Saboff.
2411
2412         Only call WTF::releaseFastMallocFreeMemory() and his threading-related friends
2413         when releaseMemory() is invoked with Synchronous::Yes, or if it's a critical
2414         pressure response (maintaining the behavior added in r215775.)
2415
2416         * page/MemoryRelease.cpp:
2417         (WebCore::releaseMemory):
2418
2419 2017-05-12  Daniel Bates  <dabates@apple.com>
2420
2421         Cleanup: Use Ref instead of RefPtr to hold DOMWrapperWorld
2422         https://bugs.webkit.org/show_bug.cgi?id=171988
2423
2424         Reviewed by Chris Dumez.
2425
2426         * bindings/js/JSCustomElementInterface.cpp:
2427         (WebCore::JSCustomElementInterface::JSCustomElementInterface):
2428         (WebCore::JSCustomElementInterface::upgradeElement):
2429         (WebCore::JSCustomElementInterface::invokeCallback):
2430         * bindings/js/JSCustomElementInterface.h:
2431         * bindings/js/JSMutationCallback.cpp:
2432         (WebCore::JSMutationCallback::JSMutationCallback):
2433         (WebCore::JSMutationCallback::call):
2434         * bindings/js/JSMutationCallback.h:
2435         * bindings/js/ScheduledAction.cpp:
2436         (WebCore::ScheduledAction::ScheduledAction):
2437         (WebCore::ScheduledAction::execute):
2438         * bindings/js/ScheduledAction.h:
2439         (WebCore::ScheduledAction::ScheduledAction):
2440         * page/DOMWindowExtension.cpp:
2441         (WebCore::DOMWindowExtension::DOMWindowExtension):
2442         * page/DOMWindowExtension.h:
2443         (WebCore::DOMWindowExtension::world):
2444
2445 2017-05-12  Daniel Bates  <dabates@apple.com>
2446
2447         Cleanup: Make QueueTaskToEventLoopFunctionPtr take JSGlobalObject&
2448         https://bugs.webkit.org/show_bug.cgi?id=172021
2449
2450         Reviewed by Mark Lam.
2451
2452         * bindings/js/JSDOMGlobalObjectTask.cpp: Include header JSDOMGlobalObject.h.
2453         (WebCore::JSGlobalObjectTask::JSGlobalObjectTask): Change type of first argument from JSDOMGlobalObject*
2454         to JSDOMGlobalObject& and update code as necessary. Also, use C++11 brace initialization syntax
2455         for member initializer list.
2456         * bindings/js/JSDOMGlobalObjectTask.h: Remove header JSDOMGlobalObject.h and forward declare
2457         JSDOMGlobalObject and JSC::Microtask.
2458         * bindings/js/JSDOMWindowBase.cpp:
2459         (WebCore::JSDOMWindowMicrotaskCallback::create):
2460         (WebCore::JSDOMWindowMicrotaskCallback::JSDOMWindowMicrotaskCallback): Change type of first argument
2461         from JSDOMWindowBase* to JSDOMWindowBase& and update code as necessary. Also, use C++11 brace
2462         initialization syntax for member initializer list.
2463         (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
2464         * bindings/js/JSDOMWindowBase.h:
2465         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2466         (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
2467         * bindings/js/JSWorkerGlobalScopeBase.h:
2468
2469 2017-05-12  Jer Noble  <jer.noble@apple.com>
2470
2471         [MediaStream] Streams while play while page is in background can get "stuck" when page is forgrounded.
2472         https://bugs.webkit.org/show_bug.cgi?id=172022
2473
2474         Reviewed by Youenn Fablet.
2475
2476         When an AVSampleBufferDisplayLayer is disconnected from the CA renderer, none of its samples will be decoded
2477         and enqueued for rendering. Once the layer is attached to a renderer again, it's stuffed full of samples which
2478         will never be decoded as their decode time has long passed.
2479
2480         Pass the visibility state of the element through to the MediaPlayer so that MediaPlayerPrivateMediaStreamAVFObjC
2481         can flush its renderers when going from not visible -> visible.
2482
2483         * html/HTMLMediaElement.cpp:
2484         (WebCore::HTMLMediaElement::visibilityStateChanged):
2485         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2486         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2487         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible):
2488         * rendering/RenderVideo.cpp:
2489         (WebCore::RenderVideo::updatePlayer):
2490
2491 2017-05-12  Per Arne Vollan  <pvollan@apple.com>
2492
2493         Unreviewed Windows build fix.
2494
2495         * bindings/js/JSWebGLRenderingContextCustom.cpp:
2496
2497 2017-05-12  Antti Koivisto  <antti@apple.com>
2498
2499         Updating class name of a shadow host does not update the style applied by descendants of :host()
2500         https://bugs.webkit.org/show_bug.cgi?id=170762
2501         <rdar://problem/31572668>
2502
2503         Reviewed by Ryosuke Niwa.
2504
2505         We need to invalidate shadow tree style when host classes or attributes change if it may be
2506         affected by host rules.
2507
2508         Test: fast/shadow-dom/css-scoping-host-class-and-attribute-mutation.html
2509
2510         * css/RuleSet.cpp:
2511         (WebCore::isHostSelectorMatchingInShadowTree):
2512         (WebCore::RuleSet::addRule):
2513
2514             Check if we have :host selectors that affect shadow tree.
2515
2516         * css/RuleSet.h:
2517         (WebCore::RuleSet::hasHostPseudoClassRulesMatchingInShadowTree):
2518         * style/AttributeChangeInvalidation.cpp:
2519         (WebCore::Style::mayBeAffectedByHostRules):
2520         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
2521
2522             Invalidate the whole subtree if there is a class change that may affect shadow tree style.
2523
2524         * style/ClassChangeInvalidation.cpp:
2525         (WebCore::Style::mayBeAffectedByHostRules):
2526         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
2527         * style/IdChangeInvalidation.cpp:
2528         (WebCore::Style::mayBeAffectedByHostRules):
2529         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
2530
2531             Same for classes and ids.
2532             This should be refactored at some point to reduce copy-code.
2533
2534 2017-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2535
2536         [GTK] ASSERTION FAILED: !m_flushingLayers
2537         https://bugs.webkit.org/show_bug.cgi?id=172025
2538
2539         Reviewed by Žan Doberšek.
2540
2541         The problem is that syncImageBacking() is calling didChangeLayerState(). All sync methods are called by
2542         flushCompositingStateForThisLayerOnly() while flushing layers, so none of them should call didChange method that
2543         will schedule a new flush while flushing.
2544
2545         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2546         (WebCore::CoordinatedGraphicsLayer::syncImageBacking):
2547
2548 2017-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2549
2550         [GTK] GIF images are not properly loaded the first time
2551         https://bugs.webkit.org/show_bug.cgi?id=170432
2552
2553         Reviewed by Carlos Alberto Lopez Perez.
2554
2555         When the GIF image is loaded for the first time, it's always read from the network, and the decoder is usually
2556         fetched with chunks of data. Then the data is cached in disk by the network process, so that when loaded from
2557         the cache, the whole encoded data is available to fetch the encoder. The problem is that we are failing to
2558         decode the image when giving chunks of data, that's why it only happens the first time loaded. If the first
2559         chunk of data provided is enough to get some metadata, including the size, but not frame contents, the load fails
2560         in CachedImage::addIncrementalDataBuffer() because the EncodedDataStatus reported is SizeAvailable but
2561         Image::isNull() returns true. An Image is considered to be Null when its size is empty, and the size is
2562         calculated always using the first frame in ImageFrameCache. Since we still don't have frames, the image is
2563         always Null in this case. It is not expected that EncodedDataStatus returns SizeAvailable and the image is Null,
2564         that's why it's considered an error and the load finishes with a decode error. However, the non CG ImageDecoder
2565         has a m_size member to handle this particular case, and it's when m_size is set when EncodedDataStatus changes
2566         to SizeAvailable. We should return the ImageEncoder size as the ImageSize when we have a decoder but
2567         not frames yet.
2568
2569         Test: http/tests/images/gif-progressive-load.html
2570
2571         * platform/graphics/ImageFrameCache.cpp:
2572         (WebCore::ImageFrameCache::size): Return ImageDecoder::size() without caching it, if frame list is empty.
2573
2574 2017-05-12  Per Arne Vollan  <pvollan@apple.com>
2575
2576         The iBooks application is not able to get current position.
2577         https://bugs.webkit.org/show_bug.cgi?id=171982
2578         rdar://problem/29318409
2579
2580         Reviewed by Brent Fulgham.
2581
2582         Geolocation requests from iBooks are currently blocked. Make an exemption from the policy for iBooks.
2583
2584         No new tests since we currently can't mock the iBooks application bundle ID.
2585
2586         * Modules/geolocation/Geolocation.cpp:
2587         (WebCore::isRequestFromIBooks):
2588         (WebCore::Geolocation::shouldBlockGeolocationRequests):
2589
2590 2017-05-11  Per Arne Vollan  <pvollan@apple.com>
2591
2592         Geolocation requests should not be blocked when the security origin is local.
2593         https://bugs.webkit.org/show_bug.cgi?id=171857
2594         rdar://problem/29318409
2595
2596         Reviewed by Brent Fulgham.
2597
2598         Geolocation requests from security origins where the url scheme is registered as local,
2599         should not be blocked. This applies to the file url scheme, but also to other local url
2600         schemes.
2601
2602         Test: fast/misc/geolocation-local-security-origin.html
2603
2604         * Modules/geolocation/Geolocation.cpp:
2605         (WebCore::Geolocation::shouldBlockGeolocationRequests):
2606
2607 2017-05-11  Chris Dumez  <cdumez@apple.com>
2608
2609         Drop remaining uses of PassRefPtr in WebCore
2610         https://bugs.webkit.org/show_bug.cgi?id=172013
2611
2612         Reviewed by Yusuke Suzuki.
2613
2614         * bindings/js/ScriptController.cpp:
2615         (WebCore::ScriptController::createRootObject):
2616         * bindings/js/ScriptController.h:
2617         * bindings/js/ScriptControllerMac.mm:
2618         * bridge/objc/WebScriptObject.mm:
2619         (WebCore::createJSWrapper):
2620         (-[WebScriptObject _setImp:originRootObject:rootObject:]):
2621         (-[WebScriptObject _setOriginRootObject:andRootObject:]):
2622         (-[WebScriptObject _initWithJSObject:originRootObject:rootObject:]):
2623         * bridge/objc/WebScriptObjectPrivate.h:
2624
2625 2017-05-11  Zalan Bujtas  <zalan@apple.com>
2626
2627         RenderImageResource::hasImage is redundant and RenderImageResourceStyleImage's override is incorrect.
2628         https://bugs.webkit.org/show_bug.cgi?id=172010
2629         <rdar://problem/31086735>
2630
2631         Reviewed by Simon Fraser.
2632
2633         RenderImageResourceStyleImage::hasImage() always returns true even when ::cachedImage()
2634         returns nullptr (e.g. image is pending).
2635         Remove it and use cachedImage() instead.
2636
2637         Test: fast/images/missing-content-image-crash.html
2638
2639         * html/HTMLImageElement.cpp:
2640         (WebCore::HTMLImageElement::didAttachRenderers):
2641         * rendering/RenderImage.cpp:
2642         (WebCore::RenderImage::updateIntrinsicSizeIfNeeded):
2643         (WebCore::RenderImage::isShowingMissingOrImageError):
2644         (WebCore::RenderImage::hasNonBitmapImage):
2645         (WebCore::RenderImage::paintReplaced):
2646         (WebCore::RenderImage::paintIntoRect):
2647         (WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
2648         * rendering/RenderImageResource.h:
2649         (WebCore::RenderImageResource::cachedImage):
2650         (WebCore::RenderImageResource::hasImage): Deleted.
2651         * rendering/RenderImageResourceStyleImage.h:
2652         * rendering/svg/RenderSVGImage.cpp:
2653         (WebCore::RenderSVGImage::paint):
2654         * svg/SVGImageElement.cpp:
2655         (WebCore::SVGImageElement::hasSingleSecurityOrigin):
2656         (WebCore::SVGImageElement::didAttachRenderers):
2657
2658 2017-05-11  Zalan Bujtas  <zalan@apple.com>
2659
2660         AX: Defer text changes until after the tree is clean if needed.
2661         https://bugs.webkit.org/show_bug.cgi?id=171546
2662         <rdar://problem/31934942>
2663
2664         Reviewed by Simon Fraser.
2665
2666         While updating an accessibility object state, we might
2667         trigger unintentional style updates. This style update could
2668         end up destroying renderes that are still referenced by functions
2669         on the callstack.
2670         To avoid that, defer such changes and let AXObjectCache operate on a clean tree.         
2671
2672         Test: accessibility/crash-when-render-tree-is-not-clean.html
2673
2674         * accessibility/AXObjectCache.cpp:
2675         (WebCore::AXObjectCache::remove):
2676         (WebCore::AXObjectCache::handleAttributeChanged):
2677         (WebCore::AXObjectCache::labelChanged):
2678         (WebCore::AXObjectCache::performDeferredCacheUpdate):
2679         (WebCore::AXObjectCache::deferRecomputeIsIgnored):
2680         (WebCore::AXObjectCache::deferTextChangedIfNeeded):
2681         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted.
2682         (WebCore::AXObjectCache::deferTextChanged): Deleted.
2683         * accessibility/AXObjectCache.h: Decouple different type of changes.
2684         (WebCore::AXObjectCache::deferRecomputeIsIgnored):
2685         (WebCore::AXObjectCache::deferTextChangedIfNeeded):
2686         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted.
2687         (WebCore::AXObjectCache::deferTextChanged): Deleted.
2688         * rendering/RenderBlock.cpp:
2689         (WebCore::RenderBlock::deleteLines):
2690         * rendering/RenderBlockLineLayout.cpp:
2691         (WebCore::RenderBlockFlow::createAndAppendRootInlineBox):
2692         * rendering/RenderText.cpp:
2693         (WebCore::RenderText::setText):
2694
2695 2017-05-11  Chris Dumez  <cdumez@apple.com>
2696
2697         Drop remaining uses of PassRefPtr under platform/
2698         https://bugs.webkit.org/show_bug.cgi?id=172007
2699
2700         Reviewed by Geoffrey Garen.
2701
2702         * platform/graphics/wpe/ImageWPE.cpp:
2703         (WebCore::Image::loadPlatformResource):
2704         * platform/ios/LegacyTileGrid.h:
2705         * platform/ios/LegacyTileGrid.mm:
2706         (WebCore::LegacyTileGrid::tileForIndex):
2707         (WebCore::LegacyTileGrid::tileForPoint):
2708         * platform/ios/LegacyTileGridTile.h:
2709         (WebCore::LegacyTileGridTile::create):
2710         * platform/mediastream/RTCIceCandidateDescriptor.cpp:
2711         (WebCore::RTCIceCandidateDescriptor::create):
2712         * platform/mediastream/RTCIceCandidateDescriptor.h:
2713         * platform/mediastream/RTCPeerConnectionHandlerClient.h:
2714         * platform/mediastream/RTCSessionDescriptionDescriptor.cpp:
2715         (WebCore::RTCSessionDescriptionDescriptor::create):
2716         * platform/mediastream/RTCSessionDescriptionDescriptor.h:
2717         * platform/mediastream/RTCSessionDescriptionRequest.h:
2718         (WebCore::RTCSessionDescriptionRequest::extraData):
2719         (WebCore::RTCSessionDescriptionRequest::setExtraData):
2720         * platform/mediastream/RealtimeMediaSourceCenter.h:
2721         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2722         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2723         (WebCore::RealtimeMediaSourceCenterOwr::firstSource):
2724         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
2725         * platform/mock/DeviceOrientationClientMock.cpp:
2726         (WebCore::DeviceOrientationClientMock::setOrientation):
2727         * platform/mock/DeviceOrientationClientMock.h:
2728         * platform/mock/GeolocationClientMock.cpp:
2729         (WebCore::GeolocationClientMock::setPosition):
2730         * platform/mock/GeolocationClientMock.h:
2731         * platform/mock/RTCNotifiersMock.cpp:
2732         (WebCore::SessionRequestNotifier::SessionRequestNotifier):
2733         (WebCore::SessionRequestNotifier::fire):
2734         (WebCore::VoidRequestNotifier::VoidRequestNotifier):
2735         * platform/mock/RTCNotifiersMock.h:
2736         * platform/mock/TimerEventBasedMock.h:
2737         (WebCore::TimerEventBasedMock::removeEvent):
2738         (WebCore::TimerEvent::TimerEvent):
2739         (WebCore::TimerEvent::timerFired):
2740         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
2741         (WebCore::MockSourceBufferPrivateHasAudio):
2742         (WebCore::MockSourceBufferPrivateHasVideo):
2743         * platform/wpe/RenderThemeWPE.h:
2744
2745 2017-05-11  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2746
2747         [WPE] Stop using PassRefPtr in platform/graphics/wpe
2748         https://bugs.webkit.org/show_bug.cgi?id=171977
2749
2750         Unreviewed build fix after r216702.
2751
2752         * platform/graphics/wpe/ImageWPE.cpp:
2753         (WebCore::Image::loadPlatformResource):
2754
2755 2017-05-11  Youenn Fablet  <youenn@apple.com>
2756
2757         [iOS] Unset active media capture source when stopped capturing
2758         https://bugs.webkit.org/show_bug.cgi?id=171815
2759         <rdar://problem/32117885>
2760
2761         Reviewed by Eric Carlson.
2762
2763         Test: platform/ios/mediastream/getUserMedia-single-capture.html
2764
2765         Introducing SingleSourceFactory template class to be used by capture factories for iOS.
2766         This class ensures that only one source is active at a time.
2767         Update all capture sources accordingly.
2768         Ensure sources are no longer considered as active sources when being destroyed.
2769         Add support for mock sources and introducing m_isProducingData for them as well.
2770
2771         Update WebRTC outgoing source classes to handle the case of replaced track and resetting the enabled/mute
2772         state according the new source.
2773
2774         Update the way we handle timestamps for audio data. We now consider that we read/write as a flow.
2775         This allows smooth audio track replacing.
2776
2777         * platform/mediastream/RealtimeMediaSource.h:
2778         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2779         (WebCore::AVAudioCaptureSource::~AVAudioCaptureSource):
2780         (WebCore::AVAudioCaptureSourceFactory::setActiveSource): Deleted.
2781         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2782         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
2783         (WebCore::AVVideoCaptureSourceFactory::setActiveSource): Deleted.
2784         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2785         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
2786         (WebCore::CoreAudioCaptureSource::stopProducingData):
2787         (WebCore::CoreAudioCaptureSourceFactory::setActiveSource): Deleted.
2788         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2789         (WebCore::RealtimeOutgoingAudioSource::setSource):
2790         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2791         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2792         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2793         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2794         (WebCore::RealtimeOutgoingVideoSource::setSource):
2795         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
2796         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
2797         * platform/mock/MockRealtimeAudioSource.cpp:
2798         (WebCore::mockAudioCaptureSourceFactory):
2799         (WebCore::MockRealtimeAudioSource::factory):
2800         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
2801         (WebCore::MockRealtimeAudioSource::startProducingData):
2802         (WebCore::MockRealtimeAudioSource::stopProducingData):
2803         * platform/mock/MockRealtimeAudioSource.h:
2804         * platform/mock/MockRealtimeVideoSource.cpp:
2805         (WebCore::mockVideoCaptureSourceFactory):
2806         (WebCore::MockRealtimeVideoSource::factory):
2807         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource):
2808         (WebCore::MockRealtimeVideoSource::startProducingData):
2809         (WebCore::MockRealtimeVideoSource::stopProducingData):
2810         * platform/mock/MockRealtimeVideoSource.h:
2811         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource): Deleted.
2812
2813 2017-05-11  Timothy Horton  <timothy_horton@apple.com>
2814
2815         Fix the iOS build
2816
2817         * platform/spi/mac/NSSpellCheckerSPI.h:
2818
2819 2017-05-11  Matt Lewis  <jlewis3@apple.com>
2820
2821         Unreviewed, rolling out r216677.
2822
2823         Patch caused layout test crashes.
2824
2825         Reverted changeset:
2826
2827         "WorkerThread::stop() should call
2828         scheduleExecutionTermination() last."
2829         https://bugs.webkit.org/show_bug.cgi?id=171775
2830         http://trac.webkit.org/changeset/216677
2831
2832 2017-05-11  Don Olmstead  <don.olmstead@am.sony.com>
2833
2834         [CMake] Add HAVE check for regex.h
2835         https://bugs.webkit.org/show_bug.cgi?id=171950
2836
2837         Reviewed by Michael Catanzaro.
2838
2839         No new tests. No change in behavior.
2840
2841         * WebCorePrefix.h:
2842         * testing/js/WebCoreTestSupportPrefix.h:
2843
2844 2017-05-11  Tim Horton  <timothy_horton@apple.com>
2845
2846         Mail spins launching spell checker when typing
2847         https://bugs.webkit.org/show_bug.cgi?id=171986
2848         <rdar://problem/26305327>
2849
2850         Reviewed by Beth Dakin.
2851
2852         * platform/spi/mac/NSSpellCheckerSPI.h:
2853
2854 2017-05-11  Chris Dumez  <cdumez@apple.com>
2855
2856         Stop using PassRefPtr in platform/graphics
2857         https://bugs.webkit.org/show_bug.cgi?id=171977
2858
2859         Reviewed by Alex Christensen.
2860
2861         Stop using PassRefPtr in platform/graphics.
2862
2863         * css/CSSCrossfadeValue.cpp:
2864         (WebCore::CSSCrossfadeValue::image):
2865         * css/CSSFilterImageValue.cpp:
2866         (WebCore::CSSFilterImageValue::image):
2867         * loader/cache/CachedImage.cpp:
2868         (WebCore::CachedImage::brokenImage):
2869         (WebCore::CachedImage::image):
2870         (WebCore::CachedImage::imageForRenderer):
2871         * page/PageSerializer.cpp:
2872         (WebCore::PageSerializer::addImageToResources):
2873         * platform/ScrollView.cpp:
2874         (WebCore::ScrollView::paintPanScrollIcon):
2875         * platform/graphics/CrossfadeGeneratedImage.cpp:
2876         (WebCore::CrossfadeGeneratedImage::drawCrossfade):
2877         * platform/graphics/FontPlatformData.h:
2878         * platform/graphics/GraphicsContext.h:
2879         * platform/graphics/Image.cpp:
2880         (WebCore::Image::nullImage):
2881         * platform/graphics/Image.h:
2882         * platform/graphics/MediaPlayer.cpp:
2883         (WebCore::MediaPlayer::createResourceLoader):
2884         * platform/graphics/MediaPlayer.h:
2885         * platform/graphics/Pattern.cpp:
2886         (WebCore::Pattern::create):
2887         (WebCore::Pattern::Pattern):
2888         * platform/graphics/Pattern.h:
2889         * platform/graphics/PlatformTextTrack.h:
2890         (WebCore::PlatformTextTrack::create):
2891         (WebCore::PlatformTextTrack::createOutOfBand):
2892         (WebCore::PlatformTextTrack::captionMenuOffItem):
2893         (WebCore::PlatformTextTrack::captionMenuAutomaticItem):
2894         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
2895         (WebCore::InbandMetadataTextTrackPrivateAVF::create):
2896         (WebCore::InbandMetadataTextTrackPrivateAVF::addDataCue):
2897         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.h:
2898         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2899         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings):
2900         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:
2901         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
2902         (WebCore::MediaSelectionOptionAVFObjC::create):
2903         (WebCore::MediaSelectionGroupAVFObjC::create):
2904         (WebCore::MediaSelectionGroupAVFObjC::updateOptions):
2905         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h:
2906         (WebCore::InbandTextTrackPrivateAVCF::create):
2907         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.h:
2908         (WebCore::InbandTextTrackPrivateLegacyAVCF::create):
2909         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2910         (WebCore::WebCoreAVCFResourceLoader::create):
2911         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
2912         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
2913         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2914         (WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
2915         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2916         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2917         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
2918         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h:
2919         (WebCore::InbandTextTrackPrivateAVFObjC::create):
2920         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.h:
2921         (WebCore::InbandTextTrackPrivateLegacyAVFObjC::create):
2922         * platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h:
2923         (WebCore::OutOfBandTextTrackPrivateAVF::create):
2924         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
2925         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2926         (WebCore::WebCoreAVFResourceLoader::create):
2927         * platform/graphics/ca/GraphicsLayerCA.cpp:
2928         (WebCore::GraphicsLayerCA::createPlatformCALayer):
2929         (WebCore::GraphicsLayerCA::createPlatformCAAnimation):
2930         (WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
2931         (WebCore::GraphicsLayerCA::replicatedLayerRoot):
2932         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
2933         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
2934         (WebCore::GraphicsLayerCA::createBasicAnimation):
2935         (WebCore::GraphicsLayerCA::createKeyframeAnimation):
2936         (WebCore::GraphicsLayerCA::createSpringAnimation):
2937         * platform/graphics/ca/GraphicsLayerCA.h:
2938         (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
2939         * platform/graphics/ca/PlatformCAAnimation.h:
2940         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.h:
2941         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2942         (PlatformCAAnimationCocoa::create):
2943         (PlatformCAAnimationCocoa::copy):
2944         * platform/graphics/ca/win/AbstractCACFLayerTreeHost.h:
2945         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
2946         (WebCore::CACFLayerTreeHost::create):
2947         (WebCore::CACFLayerTreeHost::addPendingAnimatedLayer):
2948         * platform/graphics/ca/win/CACFLayerTreeHost.h:
2949         * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
2950         (PlatformCAAnimationWin::create):
2951         (PlatformCAAnimationWin::copy):
2952         * platform/graphics/ca/win/PlatformCAAnimationWin.h:
2953         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2954         (PlatformCALayerWin::addAnimationForKey):
2955         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
2956         (WebCore::WKCACFViewLayerTreeHost::create):
2957         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
2958         * platform/graphics/cairo/PatternCairo.cpp:
2959         (WebCore::Pattern::createPlatformPattern):
2960         * platform/graphics/cairo/PlatformContextCairo.cpp:
2961         (WebCore::PlatformContextCairo::clipForPatternFilling):
2962         * platform/graphics/cg/PDFDocumentImage.h:
2963         * platform/graphics/cg/PatternCG.cpp:
2964         (WebCore::Pattern::createPlatformPattern):
2965         * platform/graphics/filters/FEDiffuseLighting.cpp:
2966         (WebCore::FEDiffuseLighting::FEDiffuseLighting):
2967         (WebCore::FEDiffuseLighting::create):
2968         (WebCore::FEDiffuseLighting::lightSource):
2969         * platform/graphics/filters/FEDiffuseLighting.h:
2970         * platform/graphics/filters/FELighting.cpp:
2971         (WebCore::FELighting::FELighting):
2972         (WebCore::FELighting::drawLighting):
2973         * platform/graphics/filters/FELighting.h:
2974         * platform/graphics/filters/FESpecularLighting.cpp:
2975         (WebCore::FESpecularLighting::FESpecularLighting):
2976         (WebCore::FESpecularLighting::create):
2977         (WebCore::FESpecularLighting::lightSource):
2978         * platform/graphics/filters/FESpecularLighting.h:
2979         * platform/graphics/filters/FETile.cpp:
2980         (WebCore::FETile::platformApplySoftware):
2981         * platform/graphics/filters/FilterEffect.cpp:
2982         (WebCore::FilterEffect::asUnmultipliedImage):
2983         (WebCore::FilterEffect::asPremultipliedImage):
2984         * platform/graphics/filters/FilterEffect.h:
2985         * platform/graphics/filters/FilterOperation.cpp:
2986         (WebCore::ReferenceFilterOperation::setFilterEffect):
2987         (WebCore::BasicColorMatrixFilterOperation::blend):
2988         (WebCore::BasicComponentTransferFilterOperation::blend):
2989         (WebCore::BlurFilterOperation::blend):
2990         (WebCore::DropShadowFilterOperation::blend):
2991         * platform/graphics/filters/FilterOperation.h:
2992         (WebCore::FilterOperation::blend):
2993         (WebCore::PassthroughFilterOperation::create):
2994         (WebCore::ReferenceFilterOperation::create):
2995         * platform/graphics/gpu/Texture.cpp:
2996         (WebCore::Texture::create):
2997         * platform/graphics/gpu/Texture.h:
2998         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2999         * platform/graphics/gstreamer/ImageGStreamer.h:
3000         (WebCore::ImageGStreamer::createImage):
3001         (WebCore::ImageGStreamer::image):
3002         * platform/graphics/gstreamer/InbandMetadataTextTrackPrivateGStreamer.h:
3003         (WebCore::InbandMetadataTextTrackPrivateGStreamer::create):
3004         (WebCore::InbandMetadataTextTrackPrivateGStreamer::addGenericCue):
3005         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
3006         (WebCore::InbandTextTrackPrivateGStreamer::create):
3007         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3008         (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry):
3009         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3010         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
3011         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
3012         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
3013         (WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
3014         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
3015         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp:
3016         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
3017         (WebCore::PlaybackPipeline::enqueueSample):
3018         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
3019         * platform/graphics/gtk/ImageGtk.cpp:
3020         (WebCore::loadImageFromGResource):
3021         (WebCore::loadResourceSharedBuffer):
3022         (WebCore::loadMissingImageIconFromTheme):
3023         (WebCore::Image::loadPlatformResource):
3024         * platform/graphics/harfbuzz/HarfBuzzFace.cpp:
3025         (WebCore::FaceCacheEntry::create):
3026         * platform/graphics/harfbuzz/HarfBuzzFace.h:
3027         (WebCore::HarfBuzzFace::create):
3028         * platform/graphics/mac/ImageMac.mm:
3029         (WebCore::Image::loadPlatformResource):
3030         * platform/graphics/opentype/OpenTypeMathData.h:
3031         (WebCore::OpenTypeMathData::create):
3032         * platform/graphics/texmap/BitmapTexture.h:
3033         (WebCore::BitmapTexture::applyFilters):
3034         * platform/graphics/texmap/BitmapTextureGL.cpp:
3035         (WebCore::BitmapTextureGL::applyFilters):
3036         * platform/graphics/texmap/BitmapTextureGL.h:
3037         (WebCore::BitmapTextureGL::FilterInfo::FilterInfo):
3038         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
3039         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
3040         * platform/graphics/texmap/TextureMapper.cpp:
3041         (WebCore::TextureMapper::acquireTextureFromPool):
3042         * platform/graphics/texmap/TextureMapper.h:
3043         * platform/graphics/texmap/TextureMapperGL.cpp:
3044         (WebCore::TextureMapperGL::createTexture):
3045         * platform/graphics/texmap/TextureMapperGL.h:
3046         * platform/graphics/texmap/TextureMapperLayer.cpp:
3047         (WebCore::TextureMapperLayer::paintIntoSurface):
3048         (WebCore::commitSurface):
3049         (WebCore::TextureMapperLayer::paintWithIntermediateSurface):
3050         (WebCore::TextureMapperLayer::setBackingStore):
3051         * platform/graphics/texmap/TextureMapperLayer.h:
3052         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
3053         (WebCore::TextureMapperTiledBackingStore::create):
3054         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3055         (WebCore::CoordinatedGraphicsLayer::syncImageBacking):
3056         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3057         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
3058         (WebCore::CoordinatedImageBacking::create):
3059         (WebCore::CoordinatedImageBacking::CoordinatedImageBacking):
3060         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
3061         * platform/graphics/win/ImageWin.cpp:
3062         (WebCore::Image::loadPlatformResource):
3063         * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
3064         (WebCore::MediaPlayerPrivateFullscreenWindow::setRootChildLayer):
3065         * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h:
3066         * platform/graphics/win/PatternDirect2D.cpp:
3067         (WebCore::Pattern::createPlatformPattern):
3068         * platform/graphics/win/SharedGDIObject.h:
3069         (WebCore::SharedGDIObject::create):
3070         * rendering/FilterEffectRenderer.cpp:
3071         (WebCore::FilterEffectRenderer::build):
3072         * rendering/RenderImageResource.cpp:
3073         (WebCore::RenderImageResource::image):
3074         * rendering/RenderLayer.cpp:
3075         (WebCore::RenderLayer::drawPlatformResizerImage):
3076         * rendering/svg/RenderSVGResourcePattern.cpp:
3077         (WebCore::RenderSVGResourcePattern::buildPattern):
3078         * svg/SVGFEDiffuseLightingElement.cpp:
3079         (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
3080         (WebCore::SVGFEDiffuseLightingElement::build):
3081         * svg/SVGFESpecularLightingElement.cpp:
3082         (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
3083         (WebCore::SVGFESpecularLightingElement::build):
3084         * svg/graphics/SVGImageCache.cpp:
3085         (WebCore::SVGImageCache::imageForRenderer):
3086
3087 2017-05-11  Joseph Pecoraro  <pecoraro@apple.com>
3088
3089         Remove Vibration API
3090         https://bugs.webkit.org/show_bug.cgi?id=171766
3091
3092         Rubber-stamped by Alexey Proskuryakov.
3093
3094         * features.json:
3095         Mark the Vibration API as removed.
3096
3097         * CMakeLists.txt:
3098         * DerivedSources.cpp:
3099         * Modules/vibration/NavigatorVibration.cpp: Removed.
3100         * Modules/vibration/NavigatorVibration.h: Removed.
3101         * Modules/vibration/NavigatorVibration.idl: Removed.
3102         * Modules/vibration/Vibration.cpp: Removed.
3103         * Modules/vibration/Vibration.h: Removed.
3104         * Modules/vibration/VibrationClient.h: Removed.
3105         * testing/Internals.cpp:
3106         (WebCore::Internals::isVibrating): Deleted.
3107         * testing/Internals.h:
3108         * testing/Internals.idl:
3109
3110 2017-05-11  Dean Jackson  <dino@apple.com>
3111
3112         WebGLRenderingContext should implement WebGLRenderingContextBase
3113         https://bugs.webkit.org/show_bug.cgi?id=171961
3114         <rdar://problem/32124920>
3115
3116         Reviewed by Sam Weinig.
3117
3118         WebGLRenderingContext and WebGL2RenderingContext are both
3119         defined to "implement" WebGLRenderingContextBase. However, we
3120         were doing it via inheritance, which meant that some things
3121         were not visible on the WebGLRenderingContext prototype.
3122
3123         Test: fast/canvas/webgl/constants-on-interface.html
3124
3125         * WebCore.xcodeproj/project.pbxproj: Move the Custom.cpp files
3126         out of the GC-only area now they have real content.
3127
3128         * bindings/js/JSDocumentCustom.cpp: Handle the fact that we
3129         don't use the base class from the bindings, so we need to
3130         translate WebGL1 and WebGL2 contexts into the right JS classes.
3131         (WebCore::JSDocument::getCSSCanvasContext):
3132         * bindings/js/JSHTMLCanvasElementCustom.cpp:
3133         (WebCore::JSHTMLCanvasElement::getContext):
3134
3135         * bindings/js/JSWebGL2RenderingContextCustom.cpp: Implement the
3136         custom methods. In this case, we don't yet expose any
3137         extensions for WebGL 2.
3138         (WebCore::toJS):
3139         (WebCore::JSWebGL2RenderingContext::getExtension):
3140
3141         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: Removed.
3142
3143         * bindings/js/JSWebGLRenderingContextCustom.cpp:
3144         (WebCore::toJS):
3145         (WebCore::JSWebGLRenderingContext::getExtension):
3146
3147         * html/canvas/WebGL2RenderingContext.h: Make some things public.
3148         * html/canvas/WebGLRenderingContext.h: Ditto.
3149
3150         * html/canvas/WebGL2RenderingContext.idl: Use implements.
3151         * html/canvas/WebGLRenderingContext.idl: Ditto.
3152
3153         * testing/Internals.cpp: This now takes a WebGLRenderingContext.
3154         (WebCore::Internals::simulateWebGLContextChanged):
3155         * testing/Internals.h:
3156         * testing/Internals.idl:
3157
3158 2017-05-11  Andy Estes  <aestes@apple.com>
3159
3160         Fix a spelling mistake in ApplePayErrorCode
3161         https://bugs.webkit.org/show_bug.cgi?id=171981
3162         <rdar://problem/32136567>
3163
3164         Reviewed by Beth Dakin.
3165
3166         * Modules/applepay/ApplePayError.idl:
3167         * Modules/applepay/PaymentRequest.h:
3168
3169 2017-05-11  John Wilander  <wilander@apple.com>
3170
3171         Resource Load Statistics: Enable configuration through preferences
3172         https://bugs.webkit.org/show_bug.cgi?id=171949
3173         <rdar://problem/31894518>
3174
3175         Reviewed by Alex Christensen.
3176
3177         No new tests. Just an added setter.
3178
3179         * loader/ResourceLoadObserver.cpp:
3180         (WebCore::ResourceLoadObserver::setReducedTimestampResolution):
3181
3182 2017-05-11  Frederic Wang  <fwang@igalia.com>
3183
3184         Unify hasTouchScrollableOverflow/needsCompositedScrolling concepts
3185         https://bugs.webkit.org/show_bug.cgi?id=171974
3186
3187         Reviewed by Simon Fraser.
3188
3189         This commit moves the following pattern in a single RenderLayer::usesAcceleratedScrolling function:
3190         #if PLATFORM(IOS)
3191         ...hasTouchScrollableOverflow()...
3192         #else
3193         ...needsCompositedScrolling()...
3194         #endif
3195
3196         No new tests, behavior unchanged.
3197
3198         * rendering/RenderLayer.cpp:
3199         (WebCore::RenderLayer::usesAcceleratedScrolling): Introduce helper function.
3200         * rendering/RenderLayer.h: Declare the function.
3201         * rendering/RenderLayerBacking.cpp:
3202         (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling): Use the new function.
3203         (WebCore::RenderLayerBacking::updateConfiguration): Ditto.
3204         * rendering/RenderLayerCompositor.cpp:
3205         (WebCore::useCoordinatedScrollingForLayer): Ditto.
3206
3207 2017-05-11  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3208
3209         [Readable Streams API] Implement ReadableStreamBYOBReader cancel()
3210         https://bugs.webkit.org/show_bug.cgi?id=171919
3211
3212         Reviewed by Youenn Fablet.
3213
3214         Implemented ReadableStreamBYOBReader cancel() method.
3215
3216         Added tests checking cancel().
3217
3218         * Modules/streams/ReadableStreamBYOBReader.js:
3219         (cancel): Implemented.
3220         * Modules/streams/ReadableStreamInternals.js:
3221         (readableStreamError): Updated to support ReadableStreamBYOBReader case.
3222
3223 2017-05-11  Chris Dumez  <cdumez@apple.com>
3224
3225         Stop using PassRefPtr in WebGPU code
3226         https://bugs.webkit.org/show_bug.cgi?id=171965
3227
3228         Reviewed by Alex Christensen.
3229
3230         Stop using PassRefPtr in WebGPU code.
3231
3232         * html/canvas/WebGPUDrawable.cpp:
3233         (WebCore::WebGPUDrawable::WebGPUDrawable):
3234         * html/canvas/WebGPURenderingContext.cpp:
3235         (WebCore::WebGPURenderingContext::create):
3236         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
3237         * html/canvas/WebGPURenderingContext.h:
3238         * html/canvas/WebGPUTexture.cpp:
3239         (WebCore::WebGPUTexture::createFromDrawableTexture):
3240         (WebCore::WebGPUTexture::WebGPUTexture):
3241         * html/canvas/WebGPUTexture.h:
3242
3243 2017-05-11  Youenn Fablet  <youenn@apple.com>
3244
3245         Name WebRTC Threads
3246         https://bugs.webkit.org/show_bug.cgi?id=171975
3247
3248         Reviewed by Eric Carlson.
3249
3250         No change of behavior.
3251
3252         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
3253         (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule): Setting audio module thread name.
3254         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3255         (WebCore::initializePeerConnectionFactoryAndThreads): Setting signaling and networking thread names.
3256
3257 2017-05-11  Chris Dumez  <cdumez@apple.com>
3258
3259         Stop using PassRefPtr in platform/audio
3260         https://bugs.webkit.org/show_bug.cgi?id=171966
3261
3262         Reviewed by Ryosuke Niwa.
3263
3264         Stop using PassRefPtr in platform/audio.
3265
3266         * platform/audio/AudioBus.h:
3267         (WebCore::AudioBus::AudioBus):
3268         * platform/audio/AudioFileReader.h:
3269         * platform/audio/HRTFDatabaseLoader.cpp:
3270         (WebCore::HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary):
3271         * platform/audio/HRTFDatabaseLoader.h:
3272         * platform/audio/HRTFKernel.cpp:
3273         (WebCore::HRTFKernel::createInterpolatedKernel):
3274         * platform/audio/HRTFKernel.h:
3275         (WebCore::HRTFKernel::create):
3276         * platform/audio/glib/AudioBusGLib.cpp:
3277         (WebCore::AudioBus::loadPlatformResource):
3278         * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
3279         (WebCore::AudioFileReader::createBus):
3280         (WebCore::createBusFromAudioFile):
3281         (WebCore::createBusFromInMemoryAudioFile):
3282         * platform/audio/ios/AudioFileReaderIOS.cpp:
3283         (WebCore::AudioFileReader::createBus):
3284         (WebCore::createBusFromAudioFile):
3285         (WebCore::createBusFromInMemoryAudioFile):
3286         * platform/audio/ios/AudioFileReaderIOS.h:
3287         * platform/audio/mac/AudioBusMac.mm:
3288         (WebCore::AudioBus::loadPlatformResource):
3289         * platform/audio/mac/AudioFileReaderMac.cpp:
3290         (WebCore::AudioFileReader::createBus):
3291         (WebCore::createBusFromAudioFile):
3292         (WebCore::createBusFromInMemoryAudioFile):
3293         * platform/audio/mac/AudioFileReaderMac.h:
3294
3295 2017-05-11  Mark Lam  <mark.lam@apple.com>
3296
3297         WorkerThread::stop() should call scheduleExecutionTermination() last.
3298         https://bugs.webkit.org/show_bug.cgi?id=171775
3299         <rdar://problem/30975761>
3300
3301         Reviewed by Geoffrey Garen.
3302
3303         Currently, WorkerThread::stop() calls scheduleExecutionTermination() to terminate
3304         JS execution first, followed by posting a cleanup task to the worker, and lastly,
3305         it invokes terminate() on the WorkerRunLoop.
3306
3307         As a result, before run loop is terminate, the worker thread may observe the
3308         TerminatedExecutionException in JS code, bail out, see another JS task to run,
3309         re-enters the VM to run said JS code, and fails with an assertion due to the
3310         TerminatedExecutionException still being pending on VM entry.
3311
3312         WorkerRunLoop::Task::performTask() already has a check to only allow a task to
3313         run if and only if !runLoop.terminated() and the task is not a clean up task.
3314         We'll fix the above race by ensuring that having WorkerThread::stop() terminate
3315         the run loop before it scheduleExecutionTermination() which throws the
3316         TerminatedExecutionException.  This way, by the time JS code unwinds out of the
3317         VM due to the TerminatedExecutionException, runLoop.terminated() is guaranteed
3318         to be true and thereby prevents re-entry into the VM.
3319
3320         This issue is covered by an existing test that I just unskipped in TestExpectations.
3321
3322         * bindings/js/JSDOMPromiseDeferred.cpp:
3323         (WebCore::DeferredPromise::callFunction):
3324         * workers/WorkerThread.cpp:
3325         (WebCore::WorkerThread::stop):
3326
3327 2017-05-11  Chris Dumez  <cdumez@apple.com>
3328
3329         Drop custom bindings code for HTMLFormControlsCollection's named property getter
3330         https://bugs.webkit.org/show_bug.cgi?id=171964
3331
3332         Reviewed by Sam Weinig.
3333
3334         Drop custom bindings code for HTMLFormControlsCollection's named property getter as
3335         we are able to generate it.
3336
3337         No new tests, no expected Web-facing behavior change.
3338
3339         * CMakeLists.txt:
3340         * WebCore.xcodeproj/project.pbxproj:
3341         * bindings/js/JSBindingsAllInOne.cpp:
3342         * bindings/js/JSHTMLFormControlsCollectionCustom.cpp: Removed.
3343         * bindings/scripts/CodeGeneratorJS.pm:
3344         (GenerateNamedGetter):
3345         * html/HTMLFormControlsCollection.cpp:
3346         (WebCore::HTMLFormControlsCollection::namedItemOrItems):
3347         * html/HTMLFormControlsCollection.h:
3348         * html/HTMLFormControlsCollection.idl:
3349
3350 2017-05-10  Eric Carlson  <eric.carlson@apple.com>
3351
3352         [MediaStream] CoreAudioCaptureSource claims to never be muted
3353         https://bugs.webkit.org/show_bug.cgi?id=171946
3354         <rdar://problem/32111991>
3355
3356         Reviewed by Jer Noble.
3357
3358         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3359         (WebCore::CoreAudioCaptureSource::stopProducingData): Set m_muted to true.
3360
3361 2017-05-10  Jer Noble  <jer.noble@apple.com>
3362
3363         RELEASE_ASSERT at WebAudioSourceProviderAVFObjC::provideInput()
3364         https://bugs.webkit.org/show_bug.cgi?id=171711
3365
3366         Reviewed by Youenn Fablet.
3367
3368         Before iterating over the channels in either the WebAudioBufferList or the AudioBus, ensure
3369         we don't walk over the end of either by only iterating over the minimum length of either.
3370         Also, when the internal format of WebAudioSourceProviderAVFObjC changes, notify the
3371         MediaStreamAudioSourceNode that the number of channels and sample rate have changed.
3372
3373         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
3374         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
3375         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
3376
3377 2017-05-10  Andy Estes  <aestes@apple.com>
3378
3379         REGRESSION (r167845): ASSERT(!m_renderView.needsLayout()) in svg/custom/bug79798.html
3380         https://bugs.webkit.org/show_bug.cgi?id=132297
3381
3382         Reviewed by Simon Fraser.
3383
3384         We don't know why m_renderView needs layout in this case, but we know that we don't need to
3385         assert if the client hasn't set the ScrollableInnerFrameTrigger compositing trigger.
3386
3387         * rendering/RenderLayerCompositor.cpp:
3388         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame):
3389
3390 2017-05-10  Ryan Haddad  <ryanhaddad@apple.com>
3391
3392         Unreviewed, rolling out r216630.
3393
3394         This change caused assertion failures with webrtc LayoutTests.
3395
3396         Reverted changeset:
3397
3398         "RELEASE_ASSERT at
3399         WebAudioSourceProviderAVFObjC::provideInput()"
3400         https://bugs.webkit.org/show_bug.cgi?id=171711
3401         http://trac.webkit.org/changeset/216630
3402
3403 2017-05-09  Sam Weinig  <sam@webkit.org>
3404
3405         Remove support for legacy Notifications
3406         https://bugs.webkit.org/show_bug.cgi?id=171487
3407
3408         Reviewed by Jon Lee.
3409
3410         * CMakeLists.txt:
3411         * WebCore.xcodeproj/project.pbxproj:
3412         Remove files.
3413
3414         * Configurations/FeatureDefines.xcconfig:
3415         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.