File inputs only accept UTI types that can be inserted into contenteditable areas...
[WebKit.git] / Source / WebCore / ChangeLog
1 2017-04-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         File inputs only accept UTI types that can be inserted into contenteditable areas when dropping
4         https://bugs.webkit.org/show_bug.cgi?id=171177
5         <rdar://problem/31765379>
6
7         Reviewed by Andy Estes.
8
9         Currently, DragController::canProcessDrag bails immediately with `false` if the drag data does not contain
10         compatible content. However, if we are dragging over a file input, we want the presence of files in the drag
11         data to take priority. To fix this, we teach DragData::containsCompatibleContent to take the purpose of the drag
12         into account (by default, this is Editing, but when dragging over a file input, this becomes FileUpload). We
13         then consider DragData to have compatible content for the purpose of file uploading if it contains any files.
14
15         Test: DataInteractionTests.ExternalSourceJSONToFileInput.
16
17         * page/DragController.cpp:
18         (WebCore::DragController::canProcessDrag):
19         * platform/DragData.h:
20         * platform/gtk/DragDataGtk.cpp:
21         (WebCore::DragData::containsCompatibleContent):
22         * platform/mac/DragDataMac.mm:
23         (WebCore::DragData::containsCompatibleContent):
24         * platform/win/DragDataWin.cpp:
25         (WebCore::DragData::containsCompatibleContent):
26
27 2017-04-22  Eric Carlson  <eric.carlson@apple.com>
28
29         [MediaStream] Fix regression caused by r215626
30         https://bugs.webkit.org/show_bug.cgi?id=171168
31         <rdar://problem/31774787>
32
33         Reviewed by Antoine Quint.
34
35         No new tests, fixes fast/mediastream/MediaStream-page-muted.html
36
37         * Modules/mediastream/MediaStream.cpp:
38         (WebCore::MediaStream::mediaState): Test muted before m_isProducingData because if both are 
39         true we want to report that the stream is muted.
40
41 2017-04-21  Zalan Bujtas  <zalan@apple.com>
42
43         Do not measure large chunk of text repeatedly during mid-word breaking.
44         https://bugs.webkit.org/show_bug.cgi?id=171065
45         <rdar://problem/31630245>
46
47         Reviewed by Antti Koivisto.
48
49         This patch reduces redundant text measuring for mid-word breaking by
50         1. Adjusting the range for the binary search when the text fragment is longer than the available width
51         2. Preserving the width value for the left side of the split fragment (computed during the binary search) so
52         that when the fragment is being split we don't need to re-measure it
53         3. Checking if the right side fits the next line and only adjust the width (by re-measuring the text) for
54         kerning/ligature if it does (if it does not fit, we'll end up re-measuring some part of it
55         during the next split)
56
57         Performance test has already been added.
58
59         * rendering/SimpleLineLayout.cpp:
60         (WebCore::SimpleLineLayout::hyphenPositionForFragment):
61         (WebCore::SimpleLineLayout::split): binary search with adjusting the range and preserving the width for the left side.
62         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
63         (WebCore::SimpleLineLayout::FragmentForwardIterator::FragmentForwardIterator): Deleted.
64         (WebCore::SimpleLineLayout::FragmentForwardIterator::operator++): Deleted.
65         (WebCore::SimpleLineLayout::FragmentForwardIterator::operator!=): Deleted.
66         (WebCore::SimpleLineLayout::FragmentForwardIterator::operator==): Deleted.
67         (WebCore::SimpleLineLayout::FragmentForwardIterator::operator*): Deleted.
68         (WebCore::SimpleLineLayout::begin): Deleted.
69         (WebCore::SimpleLineLayout::end): Deleted.
70         * rendering/SimpleLineLayoutTextFragmentIterator.h:
71         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
72         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
73
74 2017-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
75
76         Support writing link titles to the pasteboard when beginning data interaction on a link
77         https://bugs.webkit.org/show_bug.cgi?id=171154
78         <rdar://problem/31356937>
79
80         Reviewed by Andy Estes.
81
82         Currently, when writing NSURLs to the pasteboard, we only write a String to the pasteboard corresponding to
83         kUTTypeURL. This means richer data associated with the link (in this case, the title) are not captured when
84         writing to the pasteboard. To address this, we introduce a new codepath for writing links to the pasteboard that
85         mirrors the way PasteboardImage and PasteboardWebContent are written to the pasteboard.
86
87         Test: Augmented DataInteractionTests.LinkToInput.
88
89         * platform/PasteboardStrategy.h:
90         * platform/PlatformPasteboard.h:
91
92         Add plumbing support for writing PasteboardURLs.
93
94         * platform/ios/PasteboardIOS.mm:
95         (WebCore::Pasteboard::write):
96         * platform/ios/PlatformPasteboardIOS.mm:
97         (WebCore::PlatformPasteboard::writeObjectRepresentations):
98
99         Teach PlatformPasteboard to also set the _title attribute of the NSURL when creating an NSURL representation
100         for registering with the shared WebItemProviderPasteboard.
101
102         (WebCore::PlatformPasteboard::write):
103         * platform/ios/WebItemProviderPasteboard.mm:
104
105         Remove deprecation guards and replace deprecated method calls with the latest undeprecated versions.
106
107         (-[WebItemProviderPasteboard setItemsFromObjectRepresentations:]):
108
109 2017-04-21  Michael Catanzaro  <mcatanzaro@igalia.com>
110
111         Unreviewed, rolling out r215608.
112
113         Hundreds of test failures on GTK bot
114
115         Reverted changeset:
116
117         "Reduce copies and allocations in SharedBuffer::append"
118         https://bugs.webkit.org/show_bug.cgi?id=170956
119         http://trac.webkit.org/changeset/215608
120
121 2017-04-21  Zalan Bujtas  <zalan@apple.com>
122
123         REGRESSION(r205374): <li> content inside <ul> should mid-word wrap when word-break: break-word is present.
124         https://bugs.webkit.org/show_bug.cgi?id=171108
125         <rdar://problem/30271747>
126
127         Reviewed by Dan Bernstein.
128
129         This patch ensures that we search for mid-word breaks when a zero sized element has been committed on the line
130         unless it's an image or some other replaced element with special properties (e.g. list-style: inside).  
131
132         Tests: fast/replaced/ul-li-word-break-break-word.html
133                fast/replaced/zero-width-image-force-linebreak.html
134
135         * rendering/line/BreakingContext.h:
136         (WebCore::BreakingContext::handleReplaced):
137         (WebCore::BreakingContext::handleText): This matches pre-r205374 behaviour, but it's explicit about whether a 
138         replaced width has already been committed on the current line.
139         * rendering/line/LineWidth.cpp:
140         (WebCore::LineWidth::commit):
141         * rendering/line/LineWidth.h:
142         (WebCore::LineWidth::hasCommittedReplaced):
143         (WebCore::LineWidth::addUncommittedReplacedWidth): These 2 last functions were removed with r205374 (and now I am adding them back). 
144
145 2017-04-21  Jer Noble  <jer.noble@apple.com>
146
147         [MediaCapture] Improvements to CoreAudioCaptureSource
148         https://bugs.webkit.org/show_bug.cgi?id=171146
149
150         Reviewed by Eric Carlson.
151
152         Various interlocking improvements to CoreAudioCaptureSource:
153
154         - Allow the volume, sampleRate, and echoCancellation settings to be applied to the source.
155         - Update the values returned via settings() when these values change.
156         - Obey the sampleRate and echoCancellation settings when creating the VPIO unit.
157         - Because AudioUnitRender() mutates the passed in AudioBufferList, reset it immediately before calling.
158
159         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
160         (WebCore::CoreAudioCaptureSource::create):
161         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
162         (WebCore::CoreAudioCaptureSource::preferredSampleRate):
163         (WebCore::CoreAudioCaptureSource::preferredIOBufferSize):
164         (WebCore::CoreAudioCaptureSource::configureMicrophoneProc):
165         (WebCore::CoreAudioCaptureSource::configureSpeakerProc):
166         (WebCore::CoreAudioCaptureSource::processMicrophoneSamples):
167         (WebCore::CoreAudioCaptureSource::setupAudioUnits):
168         (WebCore::CoreAudioCaptureSource::stopProducingData):
169         (WebCore::CoreAudioCaptureSource::settings):
170         (WebCore::CoreAudioCaptureSource::settingsDidChange):
171         (WebCore::CoreAudioCaptureSource::preferredIOBufferDuration): Deleted.
172         * platform/mediastream/mac/CoreAudioCaptureSource.h:
173
174 2017-04-21  Youenn Fablet  <youenn@apple.com>
175
176         com.apple.WebCore: non-virtual thunk to WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange + 39
177         https://bugs.webkit.org/show_bug.cgi?id=171087
178         <rdar://problem/31739051>
179
180         Reviewed by Eric Carlson.
181
182         Covered by existing tests.
183         No test added as this behavior is really libwebrtc specific and cannot be triggered easily.
184
185         * Modules/mediastream/RTCDataChannel.cpp:
186         (WebCore::RTCDataChannel::close): Stopping observing libwebrtc data channel before closing it.
187         This ensures we will stop getting notified as soon as there is no more interest.
188         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
189         (WebCore::LibWebRTCDataChannelHandler::OnStateChange): libwebrtc can still notify us even though we said we were
190         not interested. Ensuring we do not call the client if we are no longer interested.
191         (WebCore::LibWebRTCDataChannelHandler::OnMessage): Ditto.
192         (WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): Ditto.
193
194 2017-04-21  Andy Estes  <aestes@apple.com>
195
196         [macOS] Enable media selection button on AVTouchBarScrubber
197         https://bugs.webkit.org/show_bug.cgi?id=171149
198         <rdar://problem/29875010>
199
200         Reviewed by Beth Dakin.
201
202         * platform/spi/cocoa/AVKitSPI.h:
203
204 2017-04-21  Andy Estes  <aestes@apple.com>
205
206         [macOS] Name WebPlaybackControlsManager delegate methods correctly depending on OS version
207         https://bugs.webkit.org/show_bug.cgi?id=171147
208         <rdar://problem/29875010>
209
210         Reviewed by Beth Dakin.
211
212         On macOS 10.12, WebPlaybackControlsManager conforms to
213         AVFunctionBarPlaybackControlsControlling, but on 10.13 it conforms to
214         AVTouchBarPlaybackControlsControlling. These protocols are near-identical, except for
215         instances of "FunctionBar" in method names are renamed to "TouchBar". This patch updates to
216         the new method names, and generally renames things with "FunctionBar" to "TouchBar".
217
218         * platform/mac/WebPlaybackControlsManager.h:
219         * platform/mac/WebPlaybackControlsManager.mm:
220         (-[WebPlaybackControlsManager generateTouchBarThumbnailsForTimes:tolerance:size:thumbnailHandler:]):
221         (-[WebPlaybackControlsManager generateTouchBarAudioAmplitudeSamples:completionHandler:]):
222         (-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
223         (-[WebPlaybackControlsManager beginTouchBarScrubbing]):
224         (-[WebPlaybackControlsManager endTouchBarScrubbing]):
225         (-[WebPlaybackControlsManager generateFunctionBarThumbnailsForTimes:size:completionHandler:]):
226         (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
227         (-[WebPlaybackControlsManager canBeginFunctionBarScrubbing]):
228         (-[WebPlaybackControlsManager beginFunctionBarScrubbing]):
229         (-[WebPlaybackControlsManager endFunctionBarScrubbing]):
230         (-[WebPlaybackControlsManager audioTouchBarMediaSelectionOptions]):
231         (-[WebPlaybackControlsManager setAudioTouchBarMediaSelectionOptions:]):
232         (-[WebPlaybackControlsManager currentAudioTouchBarMediaSelectionOption]):
233         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
234         (-[WebPlaybackControlsManager legibleTouchBarMediaSelectionOptions]):
235         (-[WebPlaybackControlsManager setLegibleTouchBarMediaSelectionOptions:]):
236         (-[WebPlaybackControlsManager currentLegibleTouchBarMediaSelectionOption]):
237         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
238         (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
239         (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
240         (-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]): Deleted.
241         (-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]): Deleted.
242         (-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]): Deleted.
243         (-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]): Deleted.
244         (-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]): Deleted.
245         (-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]): Deleted.
246         (-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]): Deleted.
247         (-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]): Deleted.
248
249 2017-04-21  Jer Noble  <jer.noble@apple.com>
250
251         Make CoreAudioCaptureDevice stackable.
252         https://bugs.webkit.org/show_bug.cgi?id=171097
253
254         Reviewed by Eric Carlson.
255
256         There's no real reason to keep CoreAudioCaptureDevice from being created on the stack. 
257         Make it un-RefCounted, and have it's static factory method return an std::optional rather
258         than a RefPtr.
259
260         Drive-by fix: clean up the factory method of CoreAudioCaptureSource a bit.
261
262         * platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
263         (WebCore::CoreAudioCaptureDevice::create):
264         (WebCore::CoreAudioCaptureDevice::deviceID): Deleted.
265         * platform/mediastream/mac/CoreAudioCaptureDevice.h:
266         (WebCore::CoreAudioCaptureDevice::deviceID):
267         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
268         (WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
269         (WebCore::CoreAudioCaptureDeviceManager::coreAudioDeviceWithUID):
270         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
271         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
272         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
273         (WebCore::CoreAudioCaptureSource::create):
274         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
275         * platform/mediastream/mac/CoreAudioCaptureSource.h:
276
277 2017-04-21  Eric Carlson  <eric.carlson@apple.com>
278
279         [MediaStream iOS] Release capture session when not producing data
280         https://bugs.webkit.org/show_bug.cgi?id=171148
281         <rdar://problem/29265868>
282
283         Reviewed by Jer Noble.
284
285         On iOS, only one AVCaptureSession can be active at a time, so release a session whenever
286         it is told to stop producing data. The session will recreated if the capture source if/when
287         told to produce data again.
288
289         * platform/mediastream/mac/AVMediaCaptureSource.mm:
290         (WebCore::AVMediaCaptureSource::stopProducingData): Clear m_session to release the session.
291         It will be re-allocated if startProducingData is called later.
292
293 2017-04-21  Aaron Chu  <aaron_chu@apple.com>
294
295         AX: FKA: Buttons need a visible focus indicator
296         https://bugs.webkit.org/show_bug.cgi?id=171040
297         <rdar://problem/30922548>
298
299         Reviewed by Antoine Quint.
300
301         Added a background color for the focus state of the icon buttons in modern media controls.
302
303         Test: media/modern-media-controls/icon-button/icon-button-focus-state.html
304
305         * Modules/modern-media-controls/controls/icon-button.css:
306         (button.icon:focus):
307
308 2017-03-22  Matt Rajca  <mrajca@apple.com>
309
310         Consider muting audio hardware a form of autoplay interference.
311         https://bugs.webkit.org/show_bug.cgi?id=169971
312
313         Reviewed by Eric Carlson.
314
315         If the user mutes audio hardware and a media element is auto-playing, consider that
316         as a form of auto-play interference that we tell clients about.
317
318         * html/HTMLMediaElement.cpp:
319         (WebCore::HTMLMediaElement::HTMLMediaElement):
320         (WebCore::HTMLMediaElement::~HTMLMediaElement):
321         (WebCore::HTMLMediaElement::hardwareMutedStateDidChange):
322         * html/HTMLMediaElement.h:
323         * platform/audio/AudioSession.h:
324         (WebCore::AudioSession::MutedStateObserver::~MutedStateObserver):
325         * platform/audio/mac/AudioSessionMac.cpp:
326         (WebCore::AudioSession::isMuted):
327         (WebCore::muteProcess):
328         (WebCore::AudioSession::handleMutedStateChange):
329         (WebCore::AudioSession::addMutedStateObserver):
330         (WebCore::AudioSession::removeMutedStateObserver):
331
332 2017-04-21  Chris Dumez  <cdumez@apple.com>
333
334         Regression(r206240): XMLSerializer.serializeToString() does not properly escape '<' / '>' in attribute values
335         https://bugs.webkit.org/show_bug.cgi?id=171132
336         <rdar://problem/31426752>
337
338         Reviewed by Ryosuke Niwa.
339
340         Use XMLSerialization [1] in MarkupAccumulator::appendAttribute() when inXMLFragmentSerialization()
341         returns true, even if the node's associated document is an HTML document. When XMLSerializer.serializeToString()
342         is called on a Node, we want XML serialization, even if the node comes from an HTML document.
343
344         [1] https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization
345
346         Test: fast/dom/XMLSerializer-serializeToString-entities.html
347
348         * editing/MarkupAccumulator.cpp:
349         (WebCore::MarkupAccumulator::appendAttributeValue):
350         (WebCore::MarkupAccumulator::appendAttribute):
351         * editing/MarkupAccumulator.h:
352
353 2017-04-20  Sam Weinig  <sam@webkit.org>
354
355         Split cryptographic digest computation and parsing out of CSP code so it can be reused
356         https://bugs.webkit.org/show_bug.cgi?id=171076
357
358         Reviewed by Chris Dumez.
359
360         Factor out cryptographic digest parsing from Content Security Policy code
361         so that it can be reused for the Subresource Integrity implementation.
362
363         * CMakeLists.txt:
364         * WebCore.xcodeproj/project.pbxproj:
365         Add new files.
366
367         * html/parser/ParsingUtilities.h:
368         (WebCore::skipExactlyIgnoringASCIICase):
369         Add parsing helper to match / skip over a constant string, using IgnoringASCIICase semantics.
370
371         * loader/ResourceCryptographicDigest.cpp: Added.
372         (WebCore::parseHashAlgorithmAdvancingPosition):
373         (WebCore::parseCryptographicDigestImpl):
374         (WebCore::parseCryptographicDigest):
375         Move parsing of cryptographic-digest strings from ContentSecurityPolicySourceList.cpp
376         and optimize it a little by avoiding String allocations and generalizing it so that it
377         can parse either UChars or LChars.
378
379         * loader/ResourceCryptographicDigest.h: Added.
380         (WebCore::ResourceCryptographicDigest::operator==):
381         (WebCore::ResourceCryptographicDigest::operator!=):
382         (WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::Hash::hash):
383         (WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::Hash::equal):
384         (WTF::HashTraits<WebCore::ResourceCryptographicDigest>::emptyValue):
385         (WTF::HashTraits<WebCore::ResourceCryptographicDigest>::constructDeletedValue):
386         (WTF::HashTraits<WebCore::ResourceCryptographicDigest>::isDeletedValue):
387         Add a struct (rather than using a std::pair) to represent the digest + algorithm. And add
388         HashTraits so it can be used as HashMap.
389         
390         * page/csp/ContentSecurityPolicy.cpp:
391         (WebCore::ContentSecurityPolicy::findHashOfContentInPolicies):
392         (WebCore::toCryptoDigestAlgorithm): Deleted.
393         Move algorithm conversion to ResourceCryptographicDigest.cpp. Make use of new 
394         cryptographicDigestForBytes function to do hashing.
395
396         * page/csp/ContentSecurityPolicy.h:
397         * page/csp/ContentSecurityPolicyHash.h:
398         (WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::hash): Deleted.
399         (WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::equal): Deleted.
400         Remove HashTraits for the digest, this is now handled by ResourceCryptographicDigest. 
401         To keep things relatively straight-forward, redefine ContentSecurityPolicyHashAlgorithm
402         and ContentSecurityPolicyHash in terms of ResourceCryptographicDigest, so that less code
403         has to be changed all at once. In a later pass, if wanted, we can remove these using 
404         declarations.
405
406         * page/csp/ContentSecurityPolicySourceList.cpp:
407         (WebCore::isNonceCharacter):
408         Use renamed isBase64OrBase64URLCharacter predicate.
409
410         (WebCore::ContentSecurityPolicySourceList::parseHashSource):
411         Rework using ResourceCryptographicDigest parsing. Quotation and maximum digest
412         length have been kept here, as they are not applicable to other uses of 
413         the digest, specifically Subresource Integrity.
414
415 2017-04-21  Jer Noble  <jer.noble@apple.com>
416
417         Unreviewed fix after r215624; null-deref crash.
418
419         Make sure to call reset() inside each constructor.
420
421         * platform/audio/WebAudioBufferList.cpp:
422         (WebCore::WebAudioBufferList::WebAudioBufferList):
423
424 2017-04-21  Anders Carlsson  <andersca@apple.com>
425
426         Stop using deprecated APIs, part 5
427         https://bugs.webkit.org/show_bug.cgi?id=171134
428         rdar://problem/31589635
429
430         Reviewed by Tim Horton.
431
432         * Modules/applepay/ApplePaySession.cpp:
433         (WebCore::convertAndValidate):
434         Stop using the toPaymentAuthorizationStatus. Convert the passed in status results to the remaining
435         PaymentAuthorizationStatus values, and add errors if needed.
436
437         (WebCore::toPaymentAuthorizationStatus):
438         This function is no longer used.
439
440         * Modules/applepay/PaymentAuthorizationStatus.h:
441         Remove deprecated status values. We can achieve the same results with errors now.
442
443         * Modules/applepay/PaymentRequest.cpp:
444         (WebCore::isFinalStateResult):
445         Remove deprecated status values.
446
447         * Modules/applepay/PaymentRequest.h:
448         Remove deprecated status values.
449
450 2017-04-21  Per Arne Vollan  <pvollan@apple.com>
451
452         Validate vImage arguments
453         https://bugs.webkit.org/show_bug.cgi?id=171109
454         rdar://problem/30236606
455
456         Reviewed by Brent Fulgham.
457
458         When writing data to a canvas context, clip the source rectangle to the data rectangle
459         to make sure we will not attempt to read data outside of the buffer.
460
461         Test: fast/canvas/canvas-crash.html
462
463         * html/canvas/CanvasRenderingContext2D.cpp:
464         (WebCore::CanvasRenderingContext2D::putImageData):
465
466 2017-04-21  David Kilzer  <ddkilzer@apple.com>
467
468         Switch from -std=gnu++11 to -std=gnu++14 for consistency in DerivedSources.make
469         <https://webkit.org/b/171122>
470
471         Reviewed by Brent Fulgham.
472
473         * DerivedSources.make: Switch to -std=gnu++14 for preprocessing
474         headers to check for build settings.
475
476 2017-04-21  Jer Noble  <jer.noble@apple.com>
477
478         [MediaCapture][iOS] AVAudioSession must be active and the correct category before IO AudioUnits start producing data.
479         https://bugs.webkit.org/show_bug.cgi?id=171095
480
481         Reviewed by Youenn Fablet.
482
483         If an input audio unit is asked to start before the AVAudioSession is in a recording category and active,
484         CoreAudio will return an error stating that no input device is available.
485
486         The PlatformMediaSessionManager will automatically set the category of and activate the AVAudioSession when one
487         of its associated MediaStreams has a capturing RealtimeMediaSource and is currently producing data.  To solve
488         the chicken-or-egg problem of activating the AVAudioSession before the source produces data, move the state bit
489         of "producing data" directly into MediaStreams, and notify the PlatformMediaSessionManager that capturing is
490         occurring after flipping that bit, but before asking the constituent tracks to begin producing data.
491
492         In places (i.e. UserMediaRequest) where we previously told a stream's tracks to begin producing data, instead
493         allow the stream to handle that by telling it to produce data directly.
494
495         * Modules/mediastream/MediaStream.cpp:
496         (WebCore::MediaStream::startProducingData):
497         (WebCore::MediaStream::stopProducingData):
498         (WebCore::MediaStream::mediaState):
499         (WebCore::MediaStream::mediaType):
500         (WebCore::MediaStream::characteristics):
501         (WebCore::MediaStream::canProduceAudio):
502         * Modules/mediastream/MediaStream.h:
503         * Modules/mediastream/UserMediaRequest.cpp:
504         (WebCore::UserMediaRequest::allow):
505         * platform/mediastream/mac/CoreAudioCaptureSource.h:
506
507 2017-04-21  Jer Noble  <jer.noble@apple.com>
508
509         Add a method to retrieve the current I/O buffer size from AudioSession
510         https://bugs.webkit.org/show_bug.cgi?id=171126
511
512         Reviewed by Eric Carlson.
513
514         There is an existing method to get and set the preferred I/O buffer size; add a matching method to return
515         the acutal I/O buffer size.
516
517         * platform/audio/AudioSession.cpp:
518         (WebCore::AudioSession::bufferSize):
519         * platform/audio/AudioSession.h:
520         * platform/audio/ios/AudioSessionIOS.mm:
521         (WebCore::AudioSession::bufferSize):
522         * platform/audio/mac/AudioSessionMac.cpp:
523         (WebCore::AudioSession::bufferSize):
524
525 2017-04-21  Jer Noble  <jer.noble@apple.com>
526
527         Make AudioSampleBufferList::reset() less expensive.
528         https://bugs.webkit.org/show_bug.cgi?id=171124
529
530         Reviewed by Eric Carlson.
531
532         Previously, AudioSampleBufferList would reallocate its constituent WebAudioBufferList every time reset() was
533         called. Instead, add a reset() method to WebAudioBufferList which re-initializes its AudioBufferList (which is a
534         simple memcpy of a 24-byte struct), reusing the existing memory buffers.
535
536         While making these changes, we'll also take the opportunity to clean up the AudioSampleBufferList class by
537         making some of its members into UniqueRefs instead of unique_ptrs, thus removing the possibility of null-
538         dereferences.
539
540         * platform/audio/WebAudioBufferList.cpp:
541         (WebCore::WebAudioBufferList::WebAudioBufferList):
542         (WebCore::WebAudioBufferList::reset):
543         * platform/audio/WebAudioBufferList.h:
544         * platform/audio/mac/AudioSampleBufferList.cpp:
545         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
546         (WebCore::AudioSampleBufferList::applyGain):
547         (WebCore::AudioSampleBufferList::mixFrom):
548         (WebCore::AudioSampleBufferList::reset):
549         (WebCore::AudioSampleBufferList::zero):
550         (WebCore::AudioSampleBufferList::~AudioSampleBufferList): Deleted.
551         * platform/audio/mac/AudioSampleBufferList.h:
552         (WebCore::AudioSampleBufferList::bufferList):
553
554 2017-04-21  Jer Noble  <jer.noble@apple.com>
555
556         Fix some spurious ASSERTs when working with capturing media elements
557         https://bugs.webkit.org/show_bug.cgi?id=171096
558
559         Reviewed by Youenn Fablet.
560
561         Two related ASSERTS:
562
563         1) When we added a new PlatformMediaSession MediaType (MediaStreamCapturingAudio), we did not update all the
564         places that validated the enum. This would lead to spurious ASSERTs when an element capturing audio would
565         fail various checks to enusre it's type's validity.
566
567         2) Audio elements will ASSERT when they change page visibility, as they do not have a renderer which implements
568         visibleInViewportStateChanged(). So opt out of visibility-state checking for non-video media elements.
569
570         * html/MediaElementSession.cpp:
571         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):
572         * platform/audio/PlatformMediaSessionManager.cpp:
573         (WebCore::PlatformMediaSessionManager::resetRestrictions):
574         (WebCore::PlatformMediaSessionManager::addRestriction):
575         (WebCore::PlatformMediaSessionManager::removeRestriction):
576         (WebCore::PlatformMediaSessionManager::restrictions):
577         * platform/audio/PlatformMediaSessionManager.h:
578
579 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
580
581         [cmake] WTF target should not have wtf and subdirectries in public interface
582         https://bugs.webkit.org/show_bug.cgi?id=171115
583
584         Reviewed by Michael Catanzaro.
585
586         In r209665 WEBCORE_FRAMEWORK macro started to export INCLUDE_DIRECTORIES of
587         targets as their public interface, so that linked targets can use them
588         implicitly without copying directory lists around. This matches existing
589         practice for all targets except WTF, headers from which are always included
590         with full path starting from "<wtf/...".
591
592         Since r209665 it became possible to include headers from wtf or its
593         subdirectories in CMake builds without using "<wtf/..." path. It should
594         not be allowed.
595
596         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp: Fix
597         incorrect include of WTF header.
598
599 2017-04-21  Gwang Yoon Hwang  <yoon@igalia.com>
600
601         Do not paint the border of the box if the dirty region does not intersect with border area
602         https://bugs.webkit.org/show_bug.cgi?id=170988
603
604         Reviewed by Simon Fraser.
605
606         No new tests, since there is no change in behavior.
607
608         * platform/graphics/GeometryUtilities.cpp:
609         (WebCore::ellipseContainsPoint):
610         Checks if a point is within an ellipse.
611
612         * platform/graphics/GeometryUtilities.h:
613         Replace header-guards with #pragma once.
614
615         * platform/graphics/RoundedRect.cpp:
616         (WebCore::RoundedRect::contains):
617         Implemented to know the dirty rectangle intersects with rounded rectangle or not.
618         * platform/graphics/RoundedRect.h:
619         * rendering/RenderBoxModelObject.cpp:
620         (WebCore::RenderBoxModelObject::paintBorder):
621         When typing in decorated text box, the dirty rect generated only for the
622         inside of the text box, not for the decorations.  So we can avoid the
623         calculations to draw borders if the inner border totally covers the
624         target surface. It will optimize the rendering process since we don't
625         have to render border decorations whenever we type somethings in side of
626         the text input element.
627
628 2017-04-21  Anders Carlsson  <andersca@apple.com>
629
630         Remove another use of toPaymentAuthorizationStatus
631         https://bugs.webkit.org/show_bug.cgi?id=171114
632
633         Reviewed by Dan Bernstein.
634
635         * Modules/applepay/ApplePaySession.cpp:
636         (WebCore::ApplePaySession::completeShippingContactSelection):
637
638 2017-04-21  Alex Christensen  <achristensen@webkit.org>
639
640         Reduce copies and allocations in SharedBuffer::append
641         https://bugs.webkit.org/show_bug.cgi?id=170956
642
643         Reviewed by Andreas Kling.
644
645         SharedBuffer was a mess of different data structures added over the years.
646         SharedBuffer::append would allocate large Vector<char>s and call memcpy, and that
647         is inefficient and causes crashes when large allocations fail, and the allocations
648         and copies aren't even necessary.  There were also const correctness problems in
649         ResourceLoader::addDataOrBuffer, and iterating a SharedBuffer was strange because
650         sometimes we don't want to add unnecessary copies.
651
652         These problems are solved by making SharedBuffer a Vector of read-only data segments,
653         which can be contained in various ways but we don't care because all we want to do is
654         read them.  Appending SharedBuffers is now const correct because we just add to a
655         Vector<Ref<DataSegment>> and neither SharedBuffer can write to the data.  Sometimes,
656         though, we want all the data to be in continuous memory, and if there are multiple
657         segments then the data needs to be copied once to a new segment.  We should audit the
658         call sites of SharedBuffer::data and see if this is really necessary.
659
660         No change in functional behavior.  Fewer copies of the data are made when buffering
661         data in the NetworkProcess.  No extra memory is allocated for bytes we think we might
662         need to append in the future.  Data is now only copied into one buffer lazily as needed,
663         which could slightly change when small delays from memcpy happen, but it's an overall
664         improvement.  We could have a performance hit if we were to call append() then data()
665         then append() then data() etc. but that doesn't happen in WebKit because we call append
666         repeatedly when buffering the data then call data() once when reading the data.
667
668         * editing/cocoa/EditorCocoa.mm:
669         (WebCore::archivedDataForAttributedString):
670         (WebCore::Editor::selectionInWebArchiveFormat):
671         (WebCore::Editor::dataInRTFDFormat):
672         (WebCore::Editor::dataInRTFFormat):
673         * editing/ios/EditorIOS.mm:
674         (WebCore::Editor::WebContentReader::readURL):
675         * editing/mac/EditorMac.mm:
676         (WebCore::Editor::imageInWebArchiveFormat):
677         * loader/TextTrackLoader.cpp:
678         (WebCore::TextTrackLoader::processNewCueData):
679         * loader/archive/cf/LegacyWebArchive.cpp:
680         (WebCore::LegacyWebArchive::createResource):
681         * loader/cache/CachedResource.cpp:
682         (WebCore::CachedResource::tryReplaceEncodedData):
683         * loader/cocoa/DiskCacheMonitorCocoa.mm:
684         (WebCore::DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse):
685         * platform/SharedBuffer.cpp:
686         (WebCore::SharedBuffer::SharedBuffer):
687         (WebCore::SharedBuffer::create):
688         (WebCore::SharedBuffer::combineToOneSegment):
689         (WebCore::SharedBuffer::data):
690         (WebCore::SharedBuffer::createArrayBuffer):
691         (WebCore::SharedBuffer::append):
692         (WebCore::SharedBuffer::clear):
693         (WebCore::SharedBuffer::copy):
694         (WebCore::SharedBuffer::DataSegment::data):
695         (WebCore::SharedBuffer::DataSegment::size):
696         (WebCore::segmentIndex): Deleted.
697         (WebCore::offsetInSegment): Deleted.
698         (WebCore::allocateSegment): Deleted.
699         (WebCore::freeSegment): Deleted.
700         (WebCore::SharedBuffer::~SharedBuffer): Deleted.
701         (WebCore::SharedBuffer::size): Deleted.
702         (WebCore::SharedBuffer::duplicateDataBufferIfNecessary): Deleted.
703         (WebCore::SharedBuffer::appendToDataBuffer): Deleted.
704         (WebCore::SharedBuffer::clearDataBuffer): Deleted.
705         (WebCore::SharedBuffer::copyBufferAndClear): Deleted.
706         (WebCore::SharedBuffer::buffer): Deleted.
707         (WebCore::SharedBuffer::getSomeData): Deleted.
708         (WebCore::SharedBuffer::maybeTransferMappedFileData): Deleted.
709         (WebCore::SharedBuffer::clearPlatformData): Deleted.
710         (WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
711         (WebCore::SharedBuffer::hasPlatformData): Deleted.
712         (WebCore::SharedBuffer::platformData): Deleted.
713         (WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
714         * platform/SharedBuffer.h:
715         (WebCore::SharedBuffer::create): Deleted.
716         (WebCore::SharedBuffer::isEmpty): Deleted.
717         * platform/SharedBufferChunkReader.cpp:
718         (WebCore::SharedBufferChunkReader::nextChunk):
719         (WebCore::SharedBufferChunkReader::peek):
720         * platform/SharedBufferChunkReader.h:
721         * platform/URLParser.cpp:
722         (WebCore::URLParser::URLParser):
723         * platform/cf/KeyedEncoderCF.cpp:
724         (WebCore::KeyedEncoderCF::finishEncoding):
725         * platform/cf/SharedBufferCF.cpp:
726         (WebCore::SharedBuffer::SharedBuffer):
727         (WebCore::SharedBuffer::createCFData):
728         (WebCore::SharedBuffer::create):
729         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
730         (WebCore::SharedBuffer::append):
731         (WebCore::SharedBuffer::wrapCFData): Deleted.
732         (WebCore::SharedBuffer::hasPlatformData): Deleted.
733         (WebCore::SharedBuffer::platformData): Deleted.
734         (WebCore::SharedBuffer::platformDataSize): Deleted.
735         (WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
736         (WebCore::SharedBuffer::clearPlatformData): Deleted.
737         (WebCore::SharedBuffer::tryReplaceContentsWithPlatformBuffer): Deleted.
738         (WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
739         (WebCore::SharedBuffer::copyBufferAndClear): Deleted.
740         (WebCore::SharedBuffer::copySomeDataFromDataArray): Deleted.
741         (WebCore::SharedBuffer::singleDataArrayBuffer): Deleted.
742         (WebCore::SharedBuffer::maybeAppendDataArray): Deleted.
743         * platform/cocoa/NetworkExtensionContentFilter.mm:
744         (WebCore::NetworkExtensionContentFilter::replacementData):
745         * platform/cocoa/ParentalControlsContentFilter.mm:
746         (WebCore::ParentalControlsContentFilter::replacementData):
747         * platform/cocoa/SharedBufferCocoa.mm:
748         (-[WebCoreSharedBufferData initWithSharedBufferDataSegment:]):
749         (-[WebCoreSharedBufferData length]):
750         (-[WebCoreSharedBufferData bytes]):
751         (WebCore::SharedBuffer::create):
752         (WebCore::SharedBuffer::createCFData):
753         (WebCore::SharedBuffer::createFromReadingFile):
754         (WebCore::SharedBuffer::createNSDataArray):
755         (-[WebCoreSharedBufferData initWithSharedBufferDataBuffer:]): Deleted.
756         (WebCore::SharedBuffer::wrapNSData): Deleted.
757         (WebCore::SharedBuffer::existingCFData): Deleted.
758         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
759         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
760         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
761         (WebCore::FontPlatformData::openTypeTable):
762         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
763         (ResourceHandleStreamingClient::didReceiveBuffer):
764         * platform/graphics/mac/ImageMac.mm:
765         (WebCore::Image::loadPlatformResource):
766         * platform/image-decoders/ImageDecoder.cpp:
767         (WebCore::ImageDecoder::create):
768         * platform/image-decoders/png/PNGImageDecoder.cpp:
769         (WebCore::PNGImageReader::decode):
770         * platform/ios/PlatformPasteboardIOS.mm:
771         (WebCore::PlatformPasteboard::readBuffer):
772         * platform/mac/PasteboardMac.mm:
773         (WebCore::writeFileWrapperAsRTFDAttachment):
774         (WebCore::Pasteboard::write):
775         * platform/mac/PlatformPasteboardMac.mm:
776         (WebCore::PlatformPasteboard::bufferForType):
777         * platform/network/BlobResourceHandle.cpp:
778         (WebCore::BlobResourceHandle::notifyReceiveData):
779         * platform/network/MIMEHeader.cpp:
780         * platform/network/MIMEHeader.h:
781         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
782         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
783         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
784         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData):
785         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
786         (-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]):
787         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
788         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
789         * platform/soup/SharedBufferSoup.cpp:
790         (WebCore::SharedBuffer::SharedBuffer):
791         (WebCore::SharedBuffer::createSoupBuffer):
792         (WebCore::SharedBuffer::clearPlatformData): Deleted.
793         (WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
794         (WebCore::SharedBuffer::hasPlatformData): Deleted.
795         (WebCore::SharedBuffer::platformData): Deleted.
796         (WebCore::SharedBuffer::platformDataSize): Deleted.
797         (WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
798         (WebCore::SharedBuffer::tryReplaceContentsWithPlatformBuffer): Deleted.
799
800 2017-04-21  Timothy Horton  <timothy_horton@apple.com>
801
802         Expose obscured insets to web content (as "safe area insets")
803         https://bugs.webkit.org/show_bug.cgi?id=171013
804         <rdar://problem/31564652>
805
806         Reviewed by Wenson Hsieh and Dave Hyatt.
807
808         Tests: fast/css/variables/constants/invalid-constant-name-fallback.html
809                fast/css/variables/constants/ios/safe-area-inset-set.html
810                fast/css/variables/constants/safe-area-inset-cannot-override.html
811                fast/css/variables/constants/safe-area-inset-zero.html
812
813         * CMakeLists.txt:
814         * WebCore.xcodeproj/project.pbxproj:
815         * css/CSSValueKeywords.in:
816         * css/CSSVariableData.cpp:
817         (WebCore::CSSVariableData::checkVariablesForCyclesWithRange):
818         (WebCore::CSSVariableData::resolveTokenRange):
819         * css/parser/CSSVariableParser.cpp:
820         (WebCore::isValidConstantName):
821         (WebCore::classifyBlock):
822         (WebCore::isValidConstantReference):
823         Add a constant() function, which takes both custom properties and
824         arbitrary idents which are looked up in ConstantPropertyMap, allowing
825         fallback from the arbitrary, UA-defined idents to custom properties.
826
827         * dom/ConstantPropertyMap.cpp: Added.
828         (WebCore::ConstantPropertyMap::ConstantPropertyMap):
829         (WebCore::ConstantPropertyMap::values):
830         (WebCore::ConstantPropertyMap::nameForProperty):
831         (WebCore::ConstantPropertyMap::setValueForProperty):
832         (WebCore::ConstantPropertyMap::buildValues):
833         (WebCore::variableDataForSafeAreaInset):
834         (WebCore::ConstantPropertyMap::didChangeObscuredInsets):
835         * dom/ConstantPropertyMap.h: Added.
836         Keep a mapping of UA-defined "constants", which can be looked up
837         from CSS via the aforementioned function. For now, this mapping
838         includes only safe-area-inset-{top, right, bottom, left}, which
839         expose the obscured insets (now that they can be painted into via
840         the viewport parameter clip-to-safe-area-inset=no).
841
842         * dom/Document.cpp:
843         (WebCore::Document::Document):
844         (WebCore::Document::didChangeObscuredInsets):
845         * dom/Document.h:
846         (WebCore::Document::constantProperties):
847         * page/Page.cpp:
848         (WebCore::Page::setObscuredInsets):
849         * page/Page.h:
850         (WebCore::Page::setObscuredInsets): Deleted.
851         Make setObscuredInsets and related storage not iOS-specific, though
852         nothing from the other platforms yet calls this code.
853
854         * style/StyleResolveForDocument.cpp:
855         (WebCore::Style::resolveForDocument):
856         Grab the constant properties from ConstantPropertyMap and plop them into
857         the CustomPropertyValueMap. Constant properties aren't allowed to start
858         with --, and variable properties must, so there is no opportunity here
859         for exposing things to var() (or allowing custom properties to override
860         UA-defined constant properties).
861
862 2017-04-20  Konstantin Tokarev  <annulen@yandex.ru>
863
864         [cmake] Define FORWARDING_HEADERS_DIR in WebKitFS and use it everywhere
865         https://bugs.webkit.org/show_bug.cgi?id=171071
866
867         Reviewed by Michael Catanzaro.
868
869         "${DERIVED_SOURCES_DIR}/ForwardingHeaders" path occurs very often in the
870         build system files. GTK-specifc FORWARDING_HEADERS_DIR variable should
871         be available for all ports.
872
873         * CMakeLists.txt:
874         * PlatformMac.cmake:
875         * PlatformWin.cmake:
876         * PlatformWinCairo.cmake:
877
878 2017-04-20  Commit Queue  <commit-queue@webkit.org>
879
880         Unreviewed, rolling out r215597.
881         https://bugs.webkit.org/show_bug.cgi?id=171102
882
883         Made all tests crash under GuardMalloc (Requested by ap on
884         #webkit).
885
886         Reverted changeset:
887
888         "Expose obscured insets to web content (as "safe area
889         insets")"
890         https://bugs.webkit.org/show_bug.cgi?id=171013
891         http://trac.webkit.org/changeset/215597
892
893 2017-04-20  Dean Jackson  <dino@apple.com>
894
895         Add Web Sharing to the features under consideration.
896
897         * features.json:
898
899 2017-04-20  Dean Jackson  <dino@apple.com>
900
901         Add Scroll Anchoring to features under consideration.
902
903         * features.json:
904
905 2017-04-20  Konstantin Tokarev  <annulen@yandex.ru>
906
907         Remove unused lamda captures
908         https://bugs.webkit.org/show_bug.cgi?id=171098
909
910         Reviewed by Yusuke Suzuki.
911
912         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
913         (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
914         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
915         (WebCore::IDBServer::UniqueIDBDatabase::activateTransactionInBackingStore):
916         * loader/ResourceLoadStatisticsStore.cpp:
917         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
918         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
919
920 2017-04-20  Timothy Horton  <timothy_horton@apple.com>
921
922         Expose obscured insets to web content (as "safe area insets")
923         https://bugs.webkit.org/show_bug.cgi?id=171013
924         <rdar://problem/31564652>
925
926         Reviewed by Wenson Hsieh and Dave Hyatt.
927
928         Tests: fast/css/variables/constants/invalid-constant-name-fallback.html
929                fast/css/variables/constants/ios/safe-area-inset-set.html
930                fast/css/variables/constants/safe-area-inset-cannot-override.html
931                fast/css/variables/constants/safe-area-inset-zero.html
932
933         * CMakeLists.txt:
934         * WebCore.xcodeproj/project.pbxproj:
935         * css/CSSValueKeywords.in:
936         * css/CSSVariableData.cpp:
937         (WebCore::CSSVariableData::checkVariablesForCyclesWithRange):
938         (WebCore::CSSVariableData::resolveTokenRange):
939         * css/parser/CSSVariableParser.cpp:
940         (WebCore::isValidConstantName):
941         (WebCore::classifyBlock):
942         (WebCore::isValidConstantReference):
943         Add a constant() function, which takes both custom properties and
944         arbitrary idents which are looked up in ConstantPropertyMap, allowing
945         fallback from the arbitrary, UA-defined idents to custom properties.
946
947         * dom/ConstantPropertyMap.cpp: Added.
948         (WebCore::ConstantPropertyMap::ConstantPropertyMap):
949         (WebCore::ConstantPropertyMap::values):
950         (WebCore::ConstantPropertyMap::nameForProperty):
951         (WebCore::ConstantPropertyMap::setValueForProperty):
952         (WebCore::ConstantPropertyMap::buildValues):
953         (WebCore::variableDataForSafeAreaInset):
954         (WebCore::ConstantPropertyMap::didChangeObscuredInsets):
955         * dom/ConstantPropertyMap.h: Added.
956         Keep a mapping of UA-defined "constants", which can be looked up
957         from CSS via the aforementioned function. For now, this mapping
958         includes only safe-area-inset-{top, right, bottom, left}, which
959         expose the obscured insets (now that they can be painted into via
960         the viewport parameter clip-to-safe-area-inset=no).
961
962         * dom/Document.cpp:
963         (WebCore::Document::Document):
964         (WebCore::Document::didChangeObscuredInsets):
965         * dom/Document.h:
966         (WebCore::Document::constantProperties):
967         * page/Page.cpp:
968         (WebCore::Page::setObscuredInsets):
969         * page/Page.h:
970         (WebCore::Page::setObscuredInsets): Deleted.
971         Make setObscuredInsets and related storage not iOS-specific, though
972         nothing from the other platforms yet calls this code.
973
974         * style/StyleResolveForDocument.cpp:
975         (WebCore::Style::resolveForDocument):
976         Grab the constant properties from ConstantPropertyMap and plop them into
977         the CustomPropertyValueMap. Constant properties aren't allowed to start
978         with --, and variable properties must, so there is no opportunity here
979         for exposing things to var() (or allowing custom properties to override
980         UA-defined constant properties).
981
982 2017-04-20  Anders Carlsson  <andersca@apple.com>
983
984         Remove one use of toPaymentAuthorizationStatus
985         https://bugs.webkit.org/show_bug.cgi?id=171086
986
987         Reviewed by Tim Horton.
988
989         Just switch on the individual ApplePaySession::STATUS_ values.
990
991         * Modules/applepay/ApplePaySession.cpp:
992         (WebCore::ApplePaySession::completeShippingMethodSelection):
993
994 2017-04-20  Fujii Hironori  <Hironori.Fujii@sony.com>
995
996         [WinCairo] Fix build break after updating ANGLE
997         https://bugs.webkit.org/show_bug.cgi?id=170980
998
999         Reviewed by Brent Fulgham.
1000
1001         By stopping using SoftLinking for ANGLE, some changes are needed
1002         for WebCore and WebKit.
1003           - Define a macro 'GL_GLEXT_PROTOTYPES' before #include <GLES2/gl2.h> or <GLES2/gl2ext.h>.
1004           - Link libEGL import library explicitly.
1005
1006         * PlatformWin.cmake: Link libEGL to WebCore.
1007         * platform/graphics/PlatformDisplay.cpp:
1008         (WebCore::PlatformDisplay::initializeEGLDisplay): Removed the code for SoftLinking.
1009         * platform/graphics/GLContext.cpp: Define GL_GLEXT_PROTOTYPES.
1010         * platform/graphics/egl/GLContextEGL.cpp: Ditto.
1011         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: Ditto.
1012         * platform/graphics/opengl/Extensions3DOpenGLES.h: Ditto.
1013         * platform/graphics/opengl/TemporaryOpenGLSetting.cpp: Ditto.
1014         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp: Ditto.
1015
1016 2017-04-20  Matt Baker  <mattbaker@apple.com>
1017
1018         Web Inspector: Add regular expression support to XHR breakpoints
1019         https://bugs.webkit.org/show_bug.cgi?id=170099
1020         <rdar://problem/31558082>
1021
1022         Reviewed by Joseph Pecoraro.
1023
1024         * inspector/InspectorDOMDebuggerAgent.cpp:
1025         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint):
1026         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
1027         Use ContentSearchUtilities for both Text and RegularExpression breakpoints.
1028
1029         * inspector/InspectorDOMDebuggerAgent.h:
1030         Associate XHR breakpoint with a type.
1031
1032 2017-04-20  Eric Carlson  <eric.carlson@apple.com>
1033
1034         [MediaStream] Cleanup and simplify CoreAudioCaptureSource
1035         https://bugs.webkit.org/show_bug.cgi?id=171064
1036
1037         There is no need for a mutex to guard against internal state changes because we
1038         don't currently change configuration after the audio unit is allocated. Once
1039         we do support reconfiguration on the fly, we can just stop the output unit before
1040         changing configuration because the I/O proc isn't called if the output unit
1041         is stopped, and AudioOutputUnitStop blocks until the audio device has stopped.
1042         
1043         Reviewed by Jer Noble.
1044
1045         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1046         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource): Call cleanupAudioUnits
1047         instead of duplicating logic. 
1048         (WebCore::CoreAudioCaptureSource::preferredIOBufferDuration): Change preferred
1049         duration from 20ms to 40ms.
1050         (WebCore::CoreAudioCaptureSource::configureMicrophoneProc): Set mSampleRate to the
1051         preferred sample rate if it is 0.
1052         (WebCore::CoreAudioCaptureSource::configureSpeakerProc): Ditto.
1053         (WebCore::CoreAudioCaptureSource::provideSpeakerData): Only increment counter and
1054         check timestamps in debug builds.
1055         (WebCore::CoreAudioCaptureSource::processMicrophoneSamples): Ditto.
1056         (WebCore::CoreAudioCaptureSource::cleanupAudioUnits): We only need the audio unit
1057         name in debug builds.
1058         (WebCore::CoreAudioCaptureSource::setupAudioUnits): Ditto. No more internal state
1059         lock. Don't try to get the default input device on iOS.
1060         (WebCore::CoreAudioCaptureSource::startProducingData): No more internal state lock.
1061         Assert if not called on the main thread.
1062         (WebCore::CoreAudioCaptureSource::stopProducingData): Ditto.
1063         (WebCore::CoreAudioCaptureSource::suspend): Ditto.
1064         (WebCore::CoreAudioCaptureSource::resume): Ditto.
1065         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1066
1067 2017-04-20  Eric Carlson  <eric.carlson@apple.com>
1068
1069         [MediaStream iOS] Hold process assertion while media capture is active
1070         https://bugs.webkit.org/show_bug.cgi?id=171017
1071         <rdar://problem/31719177>
1072
1073         Reviewed by Dean Jackson.
1074
1075         * page/ActivityState.h: Add IsCapturingMedia flag.
1076
1077         * page/Page.cpp:
1078         (WebCore::Page::updateTimerThrottlingState): Enable timer throttling when capture is active
1079         like we do when playing audio.
1080         (WebCore::Page::setActivityState): Ditto.
1081
1082         * page/PerformanceMonitor.cpp:
1083         (WebCore::PerformanceMonitor::updateProcessStateForMemoryPressure): A process is active when
1084         capturing media, as it is when playing audio.
1085
1086 2017-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1087
1088         Inline anchor elements cannot be dragged when starting the drag from a block descendant
1089         https://bugs.webkit.org/show_bug.cgi?id=171062
1090         <rdar://problem/31697835>
1091
1092         Reviewed by Tim Horton.
1093
1094         Tweaks DragController::draggableElement to traverse the DOM instead of the render tree when finding a draggable
1095         element. This prevents us from skipping elements that are in the DOM ancestor chain, but appear as siblings to
1096         the hit-tested node's renderer in the render tree.
1097
1098         There was also previously a check to ensure that we skip anonymous RenderObjects while traversing up the chain,
1099         but this is no longer necessary fter this change, since all the elements we traverse in the DOM should have
1100         renderers that are not anonymous.
1101
1102         Test: fast/events/drag-and-drop-link-containing-block.html
1103
1104         * page/DragController.cpp:
1105         (WebCore::DragController::draggableElement):
1106
1107 2017-04-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1108
1109         -Wformat warning on HistoryController.cpp:295:5
1110         https://bugs.webkit.org/show_bug.cgi?id=171028
1111
1112         Reviewed by Daniel Bates.
1113
1114         Need to cast WebCore::FrameLoadType to int before using it in printf.
1115
1116         * loader/HistoryController.cpp:
1117         (WebCore::HistoryController::goToItem):
1118
1119 2017-04-20  Per Arne Vollan  <pvollan@apple.com>
1120
1121         The toleranceBefore parameter in the AVPlayerItem method seekToTime should not be negative.
1122         https://bugs.webkit.org/show_bug.cgi?id=171063
1123
1124         Reviewed by Eric Carlson.
1125
1126         The AVPlayerItem method seekToTime will throw an exception if toleranceBefore is negative.
1127
1128         No new tests since the change is a sanity check.
1129
1130         * html/HTMLMediaElement.cpp:
1131         (WebCore::HTMLMediaElement::seekTask):
1132         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1133         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
1134
1135 2017-04-20  Anders Carlsson  <andersca@apple.com>
1136
1137         Replace isFinalStateStatus with isFinalStateResult
1138         https://bugs.webkit.org/show_bug.cgi?id=171072
1139         rdar://problem/31589635
1140
1141         Reviewed by Tim Horton.
1142
1143         This will let us get rid of some of the status enum declarations.
1144
1145         * Modules/applepay/ApplePaySession.cpp:
1146         (WebCore::ApplePaySession::completePayment):
1147         * Modules/applepay/PaymentAuthorizationStatus.h:
1148         (WebCore::isFinalStateStatus): Deleted.
1149         * Modules/applepay/PaymentCoordinator.cpp:
1150         (WebCore::PaymentCoordinator::completePaymentSession):
1151         * Modules/applepay/PaymentRequest.cpp:
1152         (WebCore::isFinalStateResult):
1153         * Modules/applepay/PaymentRequest.h:
1154
1155 2017-04-20  Brent Fulgham  <bfulgham@apple.com>
1156
1157         [Win] REGRESSION(r215486): Windows Release build is broken
1158         https://bugs.webkit.org/show_bug.cgi?id=171024
1159         <rdar://problem/31722618>
1160
1161         Reviewed by Mark Lam.
1162
1163         Add missing include needed for clean Release build on Windows (proper
1164         fix found by Fujii Hironori).
1165
1166         * bindings/js/JSDOMGlobalObject.h:
1167
1168 2017-04-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
1169
1170         CachedImage should cancel loading images for unsupported/unknown types
1171         https://bugs.webkit.org/show_bug.cgi?id=170697
1172
1173         Reviewed by Youenn Fablet.
1174
1175         Currently when the image decoder detects an error with the incoming encoded
1176         data of an image, we mark the image to be a broken image. But the network
1177         process keeps feeding the web process with the rest of the data. We should
1178         cancel loading the rest of the data to save network bandwidth and CPU time
1179         loading and processing useless data.
1180
1181         * loader/cache/CachedImage.cpp:
1182         (WebCore::CachedImage::addIncrementalDataBuffer):
1183         (WebCore::CachedImage::finishLoading):
1184
1185 2017-04-20  Aaron Chu  <aaron_chu@apple.com>
1186
1187         AX: Modern Media Controls Timeline slider should be operable
1188         https://bugs.webkit.org/show_bug.cgi?id=170250
1189
1190         Reviewed by Antoine Quint.
1191
1192         Added a "change" event listener and aria-valuetext to the slider so that when a
1193         VoiceOver user operates the timeline control, VO speaks the updated timestamp
1194
1195         Test: media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html
1196
1197         * English.lproj/modern-media-controls-localized-strings.js:
1198         * Modules/modern-media-controls/controls/scrubber.js:
1199         (Scrubber.prototype.set inputAccessibleLabel):
1200         (Scrubber.prototype._formatTime):
1201         * Modules/modern-media-controls/controls/slider.js:
1202         (Slider.prototype.handleEvent):
1203         (Slider.prototype._handleInputEvent): Deleted.
1204         * Modules/modern-media-controls/controls/time-control.js:
1205         (TimeControl.prototype.updateScrubberLabel):
1206         * Modules/modern-media-controls/controls/time-label.js:
1207         (TimeLabel.prototype.commitProperty):
1208         (TimeLabel.prototype._formattedTime):
1209         * Modules/modern-media-controls/main.js:
1210         (formatTimeByUnit):
1211         (unitizeTime):
1212
1213 2017-04-20  Andy Estes  <aestes@apple.com>
1214
1215         Fix indentation in AVKitSPI.h
1216         https://bugs.webkit.org/show_bug.cgi?id=171066
1217
1218         Reviewed by Jer Noble.
1219
1220         * platform/spi/cocoa/AVKitSPI.h:
1221
1222 2017-04-20  Jer Noble  <jer.noble@apple.com>
1223
1224         [MediaCapture] gUM() with CoreAudio fails if capturing audio in the UIProcess.
1225         https://bugs.webkit.org/show_bug.cgi?id=171021
1226
1227         Reviewed by Eric Carlson.
1228
1229         Refactor the creation of RealtimeMediaSources to take a persistent device ID rather
1230         than a CaptureDevice directly. This allows WebKit2 to iterate devices in the UIProcess
1231         rather than the WebProcess.
1232
1233         * platform/mediastream/RealtimeMediaSource.h:
1234         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1235         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1236         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1237         (WebCore::CoreAudioCaptureSource::create):
1238         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
1239         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1240         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1241         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
1242         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
1243         * platform/mock/MockRealtimeAudioSource.cpp:
1244         * platform/mock/MockRealtimeVideoSource.cpp:
1245
1246 2017-04-20  Tim Horton  <timothy_horton@apple.com>
1247
1248         Make it possible to request the non-expanded scrollbar width from ScrollbarTheme
1249         https://bugs.webkit.org/show_bug.cgi?id=171047
1250
1251         Reviewed by Sam Weinig.
1252
1253         No new tests, new behavior is not exposed in any way.
1254
1255         * platform/ScrollTypes.h:
1256         * platform/ScrollbarTheme.h:
1257         (WebCore::ScrollbarTheme::scrollbarThickness):
1258         * platform/gtk/ScrollbarThemeGtk.cpp:
1259         (WebCore::ScrollbarThemeGtk::scrollbarThickness):
1260         * platform/gtk/ScrollbarThemeGtk.h:
1261         * platform/ios/ScrollbarThemeIOS.h:
1262         * platform/ios/ScrollbarThemeIOS.mm:
1263         (WebCore::ScrollbarThemeIOS::scrollbarThickness):
1264         * platform/mac/ScrollbarThemeMac.h:
1265         * platform/mac/ScrollbarThemeMac.mm:
1266         (WebCore::ScrollbarThemeMac::scrollbarThickness):
1267         * platform/mock/ScrollbarThemeMock.cpp:
1268         (WebCore::ScrollbarThemeMock::scrollbarThickness):
1269         * platform/mock/ScrollbarThemeMock.h:
1270         * platform/win/ScrollbarThemeWin.cpp:
1271         (WebCore::ScrollbarThemeWin::scrollbarThickness):
1272         * platform/win/ScrollbarThemeWin.h:
1273         * rendering/RenderScrollbarTheme.h:
1274         On Mac, when the scrollbar is hovered, it gets bigger.
1275         Currently, scrollbarThickness always returns the big size.
1276         It should be possible to request the smaller, "regular" scrollbar size as well.
1277
1278 2017-04-20  Jon Lee  <jonlee@apple.com>
1279
1280         Update pip placard to "picture in picture"
1281         https://bugs.webkit.org/show_bug.cgi?id=171036
1282         rdar://problem/30201536
1283
1284         Reviewed by Antoine Quint.
1285
1286         Updated media/modern-media-controls/pip-placard/pip-placard.html
1287
1288         Update the text shown with the picture in picture placard.
1289
1290         * English.lproj/mediaControlsLocalizedStrings.js:
1291         * English.lproj/modern-media-controls-localized-strings.js:
1292         * Modules/mediacontrols/mediaControlsApple.js:
1293         (Controller.prototype.updatePictureInPicturePlaceholder):
1294         * Modules/modern-media-controls/controls/pip-placard.js:
1295         (PiPPlacard):
1296
1297 2017-04-20  Youenn Fablet  <youenn@apple.com>
1298
1299         RTCPeerConnection is stopping its backend twice sometimes
1300         https://bugs.webkit.org/show_bug.cgi?id=171043
1301
1302         Reviewed by Eric Carlson.
1303
1304         Test: webrtc/closing-peerconnection.html
1305
1306         Making sure we stop the backend only once.
1307         Adding an internals API to close the peer connection so as to replicate frame disconnection.
1308
1309         * Modules/mediastream/RTCPeerConnection.cpp:
1310         (WebCore::RTCPeerConnection::doClose):
1311         (WebCore::RTCPeerConnection::doStop):
1312         * Modules/mediastream/RTCPeerConnection.h:
1313         * testing/Internals.cpp:
1314         (WebCore::Internals::stopPeerConnection):
1315         * testing/Internals.h:
1316         * testing/Internals.idl:
1317
1318 2017-04-20  Antti Koivisto  <antti@apple.com>
1319
1320         Increase large animation cutoff
1321         https://bugs.webkit.org/show_bug.cgi?id=171051
1322         <rdar://problem/31731532>
1323
1324         Reviewed by Andreas Kling.
1325
1326         We currently switch to per-frame decoding if the animation is larger than 5MB. This is very
1327         power-inefficient and such animations are now common. The cutoff originates from 2007 (r20069),
1328         it is time update it.
1329
1330         Note that the normal low memory handling will still kill animation frames as needed.
1331
1332         * platform/graphics/BitmapImage.h:
1333
1334             Increase cutoff to 30MB. This is enough (with some room to spare) for animations on current
1335             tumblr.com/search/aww.
1336
1337             Also remove the separate cutoff value for iOS.
1338
1339 2017-04-20  Zan Dobersek  <zdobersek@igalia.com>
1340
1341         Register missing AES_CTR, ECDSA and HKDF algorithms in
1342         GCrypt's CryptoAlgorithmRegistry implementation.
1343
1344         Rubber-stamped by Carlos Alberto Lopez Perez.
1345
1346         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp:
1347         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
1348
1349 2017-04-20  Joanmarie Diggs  <jdiggs@igalia.com>
1350
1351         [ATK] Implement support for DPub ARIA roles
1352         https://bugs.webkit.org/show_bug.cgi?id=170679
1353
1354         Reviewed by Chris Fleizach.
1355
1356         Create two new WebCore AccessibilityRole values: TextGroup and ApplicationTextGroup.
1357         These roles make it possible for platforms to distinguish groups which are primarily
1358         intended to display textual content from groups which are primarily intended to hold
1359         user-interface objects. Use these roles to fix the ATK mapping of DPub's groups, which
1360         should be exposed as ATK_ROLE_SECTION; not ATK_ROLE_PANEL.
1361
1362         Modify the following WebCore AccessibilityRole mappings:
1363         - doc-abstract changed to ApplicationTextGroupRole because this DPub ARIA role does
1364           not subclass the ARIA landmark role
1365         - doc-biblioentry and doc-endnote changed to ListItemRole, because these DPub ARIA
1366           roles subclass the ARIA listitem role
1367         - doc-notice and doc-tip changed to DocumentNoteRole because these DPub ARIA roles
1368           subclass the ARIA note role
1369         - doc-pagebreak changed to SplitterRole because this DPub ARIA role subclasses the
1370           ARIA separator role
1371
1372         No new tests required: New test cases were added to xml-roles-exposed.html, and
1373         the platform expectations for roles-exposed.html were updated to reflect the
1374         correct mappings.
1375
1376         * accessibility/AccessibilityList.cpp:
1377         (WebCore::AccessibilityList::determineAccessibilityRole):
1378         * accessibility/AccessibilityNodeObject.cpp:
1379         (WebCore::AccessibilityNodeObject::isGroup):
1380         (WebCore::AccessibilityNodeObject::helpText):
1381         * accessibility/AccessibilityObject.cpp:
1382         (WebCore::AccessibilityObject::ariaTreeItemContent):
1383         (WebCore::initializeRoleMap):
1384         (WebCore::AccessibilityObject::computedRoleString):
1385         * accessibility/AccessibilityObject.h:
1386         * accessibility/AccessibilityRenderObject.cpp:
1387         (WebCore::AccessibilityRenderObject::helpText):
1388         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant):
1389         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1390         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1391         (webkitAccessibleGetAttributes):
1392         (atkRole):
1393         (roleIsTextType):
1394         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1395         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1396         (-[WebAccessibilityObjectWrapper containsUnnaturallySegmentedChildren]):
1397         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1398         (createAccessibilityRoleMap):
1399         (-[WebAccessibilityObjectWrapper subrole]):
1400
1401 2017-04-19  Youenn Fablet  <youenn@apple.com>
1402
1403         [Mac] Allow customizing H264 encoder
1404         https://bugs.webkit.org/show_bug.cgi?id=170829
1405
1406         Reviewed by Alex Christensen.
1407
1408         Using WebKitAdditions CreateCompressionSession if available.
1409
1410         * Configurations/FeatureDefines.xcconfig:
1411         * WebCore.xcodeproj/project.pbxproj:
1412         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: Added.
1413         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: Added.
1414         (WebCore::H264VideoToolboxEncoder::CreateCompressionSession):
1415         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
1416         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
1417
1418 2017-04-19  Eric Carlson  <eric.carlson@apple.com>
1419
1420         Another deadlock in CoreAudioCaptureSource
1421         https://bugs.webkit.org/show_bug.cgi?id=171001
1422
1423         Fix another regression introduced by r215201, plus make changes suggested
1424         in the review of 170771.
1425
1426         Reviewed by Youenn Fablet.
1427
1428         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1429         (WebCore::CoreAudioCaptureSource::configureSpeakerProc): Assert if the lock is no held.
1430         (WebCore::CoreAudioCaptureSource::provideSpeakerData): Don't reset the buffer.
1431         (WebCore::CoreAudioCaptureSource::processMicrophoneSamples): Take the state lock. Don't
1432         reset the buffer. No more microphone callbacks.
1433         (WebCore::CoreAudioCaptureSource::stopProducingData): Return early if the io unit isn't
1434         running. Drop the lock before calling setMuted to avoid another deadlock.
1435         (WebCore::CoreAudioCaptureSource::addMicrophoneDataConsumer): Deleted.
1436         (WebCore::CoreAudioCaptureSource::removeMicrophoneDataConsumer): Deleted.
1437         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1438
1439 2017-04-19  Anders Carlsson  <andersca@apple.com>
1440
1441         Stop using deprecated APIs, part 3
1442         https://bugs.webkit.org/show_bug.cgi?id=171003
1443         rdar://problem/31589635
1444         rdar://problem/31589635
1445
1446         Reviewed by Tim Horton.
1447
1448         * Modules/applepay/ApplePaySession.cpp:
1449         (WebCore::convertAndValidate):
1450         The status member variable has been removed from ApplePayShippingMethodUpdate.
1451
1452         (WebCore::ApplePaySession::completeShippingMethodSelection):
1453         If status is not STATUS_SUCCESS, cancel the payment session.
1454
1455         (WebCore::ApplePaySession::canSuspendForDocumentSuspension):
1456         (WebCore::ApplePaySession::canBegin):
1457         (WebCore::ApplePaySession::canAbort):
1458         (WebCore::ApplePaySession::canCancel):
1459         (WebCore::ApplePaySession::canCompleteShippingMethodSelection):
1460         (WebCore::ApplePaySession::canCompleteShippingContactSelection):
1461         (WebCore::ApplePaySession::canCompletePaymentMethodSelection):
1462         (WebCore::ApplePaySession::canCompletePayment):
1463         (WebCore::ApplePaySession::isFinalState):
1464         Add State::CancelRequested.
1465
1466         * Modules/applepay/ApplePayShippingMethodUpdate.h:
1467         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
1468         Remove status.
1469
1470         * Modules/applepay/PaymentCoordinator.cpp:
1471         (WebCore::PaymentCoordinator::cancelPaymentSession):
1472         Call through to the client.
1473
1474         * Modules/applepay/PaymentCoordinator.h:
1475         * Modules/applepay/PaymentCoordinatorClient.h:
1476         Add cancelPaymentSession().
1477
1478         * Modules/applepay/PaymentRequest.h:
1479         Remove status.
1480
1481         * loader/EmptyClients.cpp:
1482         Add new client member function.
1483
1484 2017-04-19  Eric Carlson  <eric.carlson@apple.com>
1485
1486         [MediaStream] Limit capture to one tab at a time
1487         https://bugs.webkit.org/show_bug.cgi?id=171009
1488
1489         Reviewed by Jon Lee.
1490
1491         No new tests yet, filed bug 171011.
1492
1493         * Modules/mediastream/MediaStreamTrack.cpp:
1494         (WebCore::MediaStreamTrack::stopTrack): Drive-by fix: renamed from stopProducingData
1495         because stopProducingData is a method in RealtimeMediaSource that does something different.
1496         (WebCore::MediaStreamTrack::stop): Call stopTrack.
1497         (WebCore::MediaStreamTrack::stopProducingData): Deleted.
1498         * Modules/mediastream/MediaStreamTrack.h:
1499         * Modules/mediastream/MediaStreamTrack.idl:
1500
1501         * Modules/mediastream/RTCRtpSender.cpp:
1502         (WebCore::RTCRtpSender::replaceTrack): Update for rename.
1503
1504         * platform/mediastream/MediaStreamPrivate.cpp:
1505         (WebCore::MediaStreamPrivate::muted): Drive-by fix: a track that has ended but 
1506         which is not muted will never produce data.
1507
1508 2017-04-19  Alex Christensen  <achristensen@webkit.org>
1509
1510         Parsing large XML strings fails
1511         https://bugs.webkit.org/show_bug.cgi?id=170999
1512         <rdar://problem/17336267>
1513
1514         Reviewed by Brady Eidson.
1515
1516         Test: fast/dom/xml-large.html
1517
1518         * xml/parser/XMLDocumentParserLibxml2.cpp:
1519         (WebCore::XMLParserContext::createStringParser):
1520         (WebCore::XMLParserContext::createMemoryParser):
1521         Allow huge XML strings. They work fine in Chrome and Firefox.
1522
1523 2017-04-19  Chris Fleizach  <cfleizach@apple.com>
1524
1525         AX: <hr> should use a different role description than interactive separators
1526         https://bugs.webkit.org/show_bug.cgi?id=170317
1527         <rdar://problem/31363024>
1528
1529         Reviewed by Joanmarie Diggs.
1530
1531         Users are confused with WebKit's accessibility description of separators. 
1532         We should call these what they are, horizontal rules.
1533
1534         Updated test: accessibility/mac/hr-element-expected.txt
1535
1536         * English.lproj/Localizable.strings:
1537         * accessibility/AccessibilityRenderObject.cpp:
1538         (WebCore::AccessibilityRenderObject::orientation):
1539         * platform/cocoa/LocalizedStringsCocoa.mm:
1540         (WebCore::AXHorizontalRuleDescriptionText):
1541
1542 2017-04-19  Anders Carlsson  <andersca@apple.com>
1543
1544         Rename cancelPayment to cancelPaymentSession
1545         https://bugs.webkit.org/show_bug.cgi?id=171007
1546
1547         Reviewed by Tim Horton.
1548
1549         * Modules/applepay/ApplePaySession.cpp:
1550         (WebCore::ApplePaySession::didCancelPaymentSession):
1551         (WebCore::ApplePaySession::didCancelPayment): Deleted.
1552         * Modules/applepay/ApplePaySession.h:
1553         * Modules/applepay/PaymentCoordinator.cpp:
1554         (WebCore::PaymentCoordinator::didCancelPaymentSession):
1555         (WebCore::PaymentCoordinator::didCancelPayment): Deleted.
1556         * Modules/applepay/PaymentCoordinator.h:
1557
1558 2017-04-19  Joseph Pecoraro  <pecoraro@apple.com>
1559
1560         ASAN Crash running LayoutTests/inspector/worker tests
1561         https://bugs.webkit.org/show_bug.cgi?id=170967
1562         <rdar://problem/31256437>
1563
1564         Reviewed by Alex Christensen.
1565
1566         * workers/WorkerMessagingProxy.h:
1567         * workers/WorkerMessagingProxy.cpp:
1568         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
1569         (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal):
1570         Make the MessagingProxy thread safe ref counted. Since it used to
1571         delete itself, turn this into a ref (implicit on construction)
1572         and deref (replacing delete this).
1573
1574         (WebCore::WorkerMessagingProxy::postMessageToPageInspector):
1575         When dispatching have the lambda implicitly ref/deref with the
1576         lambda to keep the proxy alive while a lambda is queued.
1577
1578 2017-04-19  Brent Fulgham  <bfulgham@apple.com>
1579
1580         [iOS, macOS] Guard against passing nullptr to vImagePremultiplyData
1581         https://bugs.webkit.org/show_bug.cgi?id=170912
1582         <rdar://problem/30565800>
1583
1584         Reviewed by Brady Eidson.
1585
1586         * platform/graphics/cg/ImageBufferDataCG.cpp:
1587         (WebCore::affineWarpBufferData): Assert if we passed nullptr buffers.
1588         (WebCore::transferData): Ditto.
1589         (WebCore::ImageBufferData::getData): Check for nullptr data member and avoid passing to vImage routines.
1590         (WebCore::ImageBufferData::putData): Ditto.
1591
1592 2017-04-19  Dave Hyatt  <hyatt@apple.com>
1593
1594         Remove bogus assert for :not.
1595         https://bugs.webkit.org/show_bug.cgi?id=170995
1596         <rdar://problem/29693115>
1597
1598         Reviewed by Zalan Bujtas.
1599
1600         * css/parser/CSSSelectorParser.cpp:
1601
1602 2017-04-19  Antoine Quint  <graouts@apple.com>
1603
1604         [Modern Media Controls] Allow non-PNG resources
1605         https://bugs.webkit.org/show_bug.cgi?id=170992
1606         <rdar://problem/31706590>
1607
1608         Reviewed by Dean Jackson.
1609
1610         Instead of passing in a name and a platform to MediaControlsHost::base64StringForIconAndPlatform(),
1611         we now pass in a name and a type to MediaControlsHost::base64StringForIconNameAndType(). We've removed
1612         the need to provide a platform by copying the resources directly under "Resources/modern-media-controls"
1613         insted of "Resources/modern-media-controls/platform-name-here", and now we provide a type so that it
1614         may be passed down to -[NSBundle pathForResource:ofType:inDirectory:].
1615
1616         * Modules/mediacontrols/MediaControlsHost.cpp:
1617         (WebCore::MediaControlsHost::base64StringForIconNameAndType):
1618         (WebCore::MediaControlsHost::base64StringForIconAndPlatform): Deleted.
1619         * Modules/mediacontrols/MediaControlsHost.h:
1620         * Modules/mediacontrols/MediaControlsHost.idl:
1621         * Modules/modern-media-controls/controls/icon-service.js:
1622         (const.iconService.new.IconService.prototype.imageForIconNameAndLayoutTraits):
1623         * WebCore.xcodeproj/project.pbxproj:
1624         * rendering/RenderTheme.h:
1625         (WebCore::RenderTheme::mediaControlsBase64StringForIconNameAndType):
1626         (WebCore::RenderTheme::mediaControlsBase64StringForIconAndPlatform): Deleted.
1627         * rendering/RenderThemeIOS.h:
1628         * rendering/RenderThemeIOS.mm:
1629         (WebCore::RenderThemeIOS::mediaControlsBase64StringForIconNameAndType):
1630         (WebCore::RenderThemeIOS::mediaControlsBase64StringForIconAndPlatform): Deleted.
1631         * rendering/RenderThemeMac.h:
1632         * rendering/RenderThemeMac.mm:
1633         (WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType):
1634         (WebCore::RenderThemeMac::mediaControlsBase64StringForIconAndPlatform): Deleted.
1635
1636 2017-04-19  Antti Koivisto  <antti@apple.com>
1637
1638         Avoid repaints for invisible animations on tumblr.com/search/aww
1639         https://bugs.webkit.org/show_bug.cgi?id=170986
1640         <rdar://problem/28644580>
1641
1642         Reviewed by Andreas Kling.
1643
1644         Test: fast/repaint/mutate-non-visible.html
1645
1646         * rendering/style/RenderStyle.cpp:
1647         (WebCore::requiresPainting):
1648         (WebCore::RenderStyle::changeRequiresRepaint):
1649
1650             If an element is invisible it does not require repaint even if something else changes.
1651
1652 2017-04-19  Dean Jackson  <dino@apple.com>
1653
1654         Non-muxable GPUs shouldn't allow offline rendering
1655         https://bugs.webkit.org/show_bug.cgi?id=170984
1656         <rdar://problem/31614406>
1657
1658         Reviewed by Myles Maxfield.
1659
1660         Setting the kCGLPFAAllowOfflineRenderers flag doesn't do any
1661         harm on devices that only have one GPU. It's also what we
1662         want on devices that can mux between GPUs. However, we were
1663         also setting it unconditionally on devices with multiple
1664         GPUs that have issues muxing.
1665
1666         * platform/graphics/mac/GraphicsContext3DMac.mm:
1667         (WebCore::setPixelFormat): Add a test for hasMuxableGPU.
1668
1669 2017-04-18  Youenn Fablet  <youenn@apple.com>
1670
1671         RTCOfferOptions iceRestart should be supported
1672         https://bugs.webkit.org/show_bug.cgi?id=170966
1673
1674         Reviewed by Alex Christensen.
1675
1676         No ability to test iceRestart as of now.
1677         Passing iceRestart value to libwebrtc.
1678         Passing also voiceActivityDetection value to libwebrtc.
1679         Updating mock to use the new overloaded CreateOffer method.
1680
1681         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1682         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
1683         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1684         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1685         (WebCore::LibWebRTCPeerConnectionBackend::doCreateOffer):
1686         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1687         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
1688         * testing/MockLibWebRTCPeerConnection.cpp:
1689         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
1690         * testing/MockLibWebRTCPeerConnection.h:
1691
1692 2017-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1693
1694         [WK2] Support DataTransfer::files() when performing a DHTML data interaction
1695         https://bugs.webkit.org/show_bug.cgi?id=170880
1696         <rdar://problem/31314689>
1697
1698         Reviewed by Tim Horton.
1699
1700         Adds support for fetching files from the DataTransfer when performing a data interaction operation handled by
1701         JavaScript. There are two changes we make here to achieve this:
1702
1703         First, we teach the Pasteboard on iOS to know what file paths hold the item provider contents used in the
1704         current data interaction operation. On iOS, Pasteboard::readFilenames is currently hard-coded to return an empty
1705         vector. To fix this, we add logic to the iOS Pasteboard to remember what the paths of all files that were
1706         successfully loaded from item providers as the data interaction is taking place. This ensures that at the
1707         WebCore layer, the implementation of Pasteboard::readFilenames on Mac and iOS is similar -- they both call out
1708         to the client layer in order to read file paths off of their respective pasteboards. Once in the client layer
1709         (WebKit1 or WebKit2) we then call into PlatformPasteboard::filenamesForDataInteraction, which then calls into
1710         WebItemProviderPasteboard if applicable.
1711
1712         The second tweak is to propagate information about whether the document is preventing default data interaction
1713         behavior to the client layer. This prevents us from having to save pasteboard content when performing data
1714         interaction in cases where file information is not needed (i.e. the default behavior is being performed, and
1715         the target is not a file input). This also avoids compatibility issues with insertion animations when performing
1716         data interaction in editable areas, due to the extra time spent loading item provider data into a temporary
1717         file.
1718
1719         Unit tests in <https://bugs.webkit.org/show_bug.cgi?id=170903>.
1720
1721         * page/DragController.cpp:
1722         (WebCore::DragController::DragController):
1723         (WebCore::DragController::performDragOperation):
1724         (WebCore::DragController::dragEnteredOrUpdated):
1725         (WebCore::DragController::tryDocumentDrag):
1726
1727         Refactor DragController::tryDocumentDrag to return a DragHandlingMethod. This method currently returns either
1728         true or false; this patch changes it to return a DragHandlingMethod, which is either None (the equivalent of
1729         returning false before the patch), Default (indicating that the drop destination is allowing default handling),
1730         or NonDefault, which indicates that the drop destination has explicitly prevented default.
1731
1732         * page/DragController.h:
1733         (WebCore::DragController::documentIsHandlingNonDefaultDrag):
1734
1735         Used by WebPage when sending an IPC response after handling dragentered or dragupdated.
1736
1737         * platform/PasteboardStrategy.h:
1738         * platform/PlatformPasteboard.h:
1739         * platform/ios/AbstractPasteboard.h:
1740         * platform/ios/PasteboardIOS.mm:
1741         (WebCore::Pasteboard::readFilenames):
1742         * platform/ios/PlatformPasteboardIOS.mm:
1743         (WebCore::PlatformPasteboard::filenamesForDataInteraction):
1744         * platform/ios/WebItemProviderPasteboard.h:
1745         * platform/ios/WebItemProviderPasteboard.mm:
1746
1747         WebItemProviderPasteboard now remembers the file URLs of successfully loaded item provider content when a data
1748         interaction is being performed. The new filenamesForDataInteraction property returns the array of data
1749         interaction file URLs which have been propagated to the web process along with sandbox extensions. This state
1750         is cleaned up when list of item providers change (i.e. when the data interaction operation is finished, or if
1751         the web content process crashes, etc.)
1752
1753         (-[WebItemProviderPasteboard init]):
1754         (-[WebItemProviderPasteboard setItemProviders:]):
1755         (-[WebItemProviderPasteboard filenamesForDataInteraction]):
1756         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
1757
1758 2017-04-18  Dean Jackson  <dino@apple.com>
1759
1760         Cairo build fix.
1761         https://bugs.webkit.org/show_bug.cgi?id=170941
1762
1763         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1764         (WebCore::GraphicsContext3D::GraphicsContext3D):
1765
1766 2017-04-18  Ryan Haddad  <ryanhaddad@apple.com>
1767
1768         Rebaseline bindings tests after r215486.
1769
1770         Unreviewed test gardening.
1771
1772         * bindings/scripts/test/JS/JSTestObj.cpp:
1773         (WebCore::jsTestObjOnfooGetter):
1774         (WebCore::jsTestObjOnwebkitfooGetter):
1775
1776 2017-04-18  Dean Jackson  <dino@apple.com>
1777
1778         Attempted build fix. Add/remove some files from ANGLE.
1779
1780         * CMakeLists.txt:
1781
1782 2017-04-18  Dean Jackson  <dino@apple.com>
1783
1784         Update ANGLE
1785         https://bugs.webkit.org/show_bug.cgi?id=170941
1786         <rdar://problem/31633999>
1787
1788         Reviewed by Alex Christensen.
1789
1790         * platform/graphics/ANGLEWebKitBridge.cpp:
1791         (WebCore::getSymbolInfo):
1792         (WebCore::ANGLEWebKitBridge::ANGLEWebKitBridge):
1793         (WebCore::ANGLEWebKitBridge::cleanupCompilers):
1794         (WebCore::ANGLEWebKitBridge::compileShaderSource):
1795         * platform/graphics/mac/GraphicsContext3DMac.mm:
1796         (WebCore::GraphicsContext3D::GraphicsContext3D):
1797         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1798         (WebCore::GraphicsContext3D::checkVaryingsPacking):
1799
1800 2017-04-18  John Wilander  <wilander@apple.com>
1801
1802         Make WebCore::topPrivatelyControlledDomain() return "localhost" for localhost
1803         https://bugs.webkit.org/show_bug.cgi?id=170798
1804         <rdar://problem/31595108>
1805
1806         Reviewed by Alex Christensen.
1807
1808         API test augmented.
1809
1810         * platform/mac/PublicSuffixMac.mm:
1811         (WebCore::topPrivatelyControlledDomain):
1812             Now returns the lowercase top privately controlled
1813             domain including "localhost" for the host localhost.
1814
1815 2017-04-18  Brent Fulgham  <bfulgham@apple.com>
1816
1817         JSEventListener::m_isolatedWorld should be a Ref
1818         https://bugs.webkit.org/show_bug.cgi?id=170910
1819         <rdar://problem/30470332>
1820
1821         Reviewed by Alex Christensen.
1822
1823         Since m_isolatedWorld should never be nullptr, change the implementation of m_isolatedWorld
1824         from a RefPtr to a Ref, and adjust the various call sites to support this change.
1825
1826         This should help us catch any changes that permit the isolatedWorld to be set to nullptr.
1827
1828         No new tests since there should be no change in behavior.
1829
1830         * bindings/js/JSEventListener.cpp:
1831         (WebCore::JSEventListener::JSEventListener):
1832         (WebCore::JSEventListener::initializeJSFunction):
1833         (WebCore::JSEventListener::handleEvent):
1834         * bindings/js/JSEventListener.h:
1835         (WebCore::JSEventListener::cast):
1836         (WebCore::JSEventListener::isolatedWorld):
1837         (WebCore::JSEventListener::jsFunction):
1838
1839 2017-04-18  Brent Fulgham  <bfulgham@apple.com>
1840
1841         Correct handling of isolatedWorld in event handling
1842         https://bugs.webkit.org/show_bug.cgi?id=65589
1843         <rdar://problem/24097804>
1844
1845         Reviewed by Geoffrey Garen.
1846
1847         This patch was inspired by Adam's original patch as well as the
1848         following Blink change:
1849         https://src.chromium.org/viewvc/blink?revision=152377&view=revision
1850
1851         Thread isolatedWorld state through event handling logic.
1852
1853         Tests: fast/dom/event-attrs-isolated-world.html
1854                http/tests/security/isolatedWorld/onclick-attribute.html
1855
1856         * bindings/js/JSEventListener.cpp:
1857         (WebCore::JSEventListener::initializeJSFunction):
1858         (WebCore::JSEventListener::world):
1859         (WebCore::eventHandlerAttribute):
1860         (WebCore::setEventHandlerAttribute):
1861         (WebCore::windowEventHandlerAttribute):
1862         (WebCore::setWindowEventHandlerAttribute):
1863         (WebCore::documentEventHandlerAttribute):
1864         (WebCore::setDocumentEventHandlerAttribute):
1865         * bindings/js/JSEventListener.h:
1866         * bindings/scripts/CodeGeneratorJS.pm:
1867         (GenerateImplementation):
1868         * dom/Document.cpp:
1869         (WebCore::Document::setWindowAttributeEventListener):
1870         (WebCore::Document::getWindowAttributeEventListener):
1871         * dom/Document.h:
1872         * dom/Element.cpp:
1873         (WebCore::Element::setAttributeEventListener):
1874         * dom/EventTarget.cpp:
1875         (WebCore::EventTarget::setAttributeEventListener):
1876         (WebCore::EventTarget::attributeEventListener):
1877         * dom/EventTarget.h:
1878         * editing/ReplaceSelectionCommand.cpp:
1879         (WebCore::ReplacementFragment::ReplacementFragment):
1880         * html/HTMLBodyElement.cpp:
1881         (WebCore::HTMLBodyElement::parseAttribute):
1882         * html/HTMLFrameSetElement.cpp:
1883         (WebCore::HTMLFrameSetElement::parseAttribute):
1884         * svg/SVGSVGElement.cpp:
1885         (WebCore::SVGSVGElement::parseAttribute):
1886
1887 2017-04-18  Jeremy Jones  <jeremyj@apple.com>
1888
1889         Deadlock in CoreAudioCaptureSource
1890         https://bugs.webkit.org/show_bug.cgi?id=170771
1891         rdar://problem/31578919
1892
1893         Reviewed by Eric Carlson.
1894
1895         Fixes a regression introduced by r215201.
1896
1897         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1898         (WebCore::CoreAudioCaptureSource::startProducingData):
1899         (WebCore::CoreAudioCaptureSource::stopProducingData):
1900
1901 2017-04-18  Anders Carlsson  <andersca@apple.com>
1902
1903         Stop using deprecated APIs, part 2
1904         https://bugs.webkit.org/show_bug.cgi?id=170965
1905         rdar://problem/31589635
1906
1907         Reviewed by Tim Horton.
1908
1909         * Modules/applepay/ApplePaySession.cpp:
1910         (WebCore::convertAndValidate):
1911         No need to convert the status anymore.
1912
1913         (WebCore::ApplePaySession::completeShippingContactSelection):
1914         Create an ApplePayError given the status.
1915
1916         * Modules/applepay/ApplePayShippingContactUpdate.h:
1917         Remove the status member variable.
1918
1919         * Modules/applepay/PaymentRequest.h:
1920         Remove the status member variable.
1921
1922 2017-04-18  Tim Horton  <timothy_horton@apple.com>
1923
1924         Safari crash when clicking phone number data detector popover button
1925         https://bugs.webkit.org/show_bug.cgi?id=170936
1926         <rdar://problem/31416570>
1927
1928         Reviewed by Wenson Hsieh.
1929
1930         * platform/spi/mac/DataDetectorsSPI.h:
1931         Soft-link the phone number key from the correct framework.
1932
1933 2017-04-17  Sam Weinig  <sam@webkit.org>
1934
1935         [WebIDL] Make annotated types first class allowing them to be used in sequences and unions
1936         https://bugs.webkit.org/show_bug.cgi?id=170926
1937
1938         Reviewed by Chris Dumez.
1939
1940         - Adds IDL types for WebIDL annotated types:
1941             [Clamp] T -> IDLClampAdaptor<T>
1942             [EnforceRange] T -> IDLEnforceRangeAdaptor<T>
1943             [TreatNullAs=EmptyString] T -> IDLTreatNullAsEmptyAdaptor<T>
1944         - Adds additional adaptors for existing specializations
1945             [AtomicString] T -> IDLAtomicStringAdaptor<T>
1946             [RequiresExistingAtomicString] T -> IDLRequiresExistingAtomicStringAdaptor<T>
1947         - Removes the need for IntegerConversionConfiguration and StringConversionConfiguration
1948           overloads of convert().
1949         - Allows the use of annotated types as subtypes, such as in sequences and unions.
1950
1951         * bindings/IDLTypes.h:
1952         Add new types:
1953             - IDLClampAdaptor
1954             - IDLEnforceRangeAdaptor
1955             - IDLTreatNullAsEmptyAdaptor
1956             - IDLAtomicStringAdaptor
1957             - IDLRequiresExistingAtomicStringAdaptor
1958         Add new predicates for matching strings and strings/enumerations.
1959
1960         * bindings/js/JSDOMConvertNullable.h:
1961         Remove now unnecessary overloads of convert that took IntegerConversionConfiguration
1962         and StringConversionConfiguration.
1963
1964         * bindings/js/JSDOMConvertNumbers.cpp:
1965         * bindings/js/JSDOMConvertNumbers.h:
1966         Replace individually named conversion functions with explicit template specializations
1967         based on type.
1968         (WebCore::Converter<IDLByte>::convert):
1969         (WebCore::Converter<IDLOctet>::convert):
1970         (WebCore::Converter<IDLShort>::convert):
1971         (WebCore::Converter<IDLUnsignedShort>::convert):
1972         (WebCore::Converter<IDLLong>::convert):
1973         (WebCore::Converter<IDLUnsignedLong>::convert):
1974         (WebCore::Converter<IDLLongLong>::convert):
1975         (WebCore::Converter<IDLUnsignedLongLong>::convert):
1976         Simplify convert functions for normal integer converters to only handle
1977         the normal case. 
1978
1979         (WebCore::Converter<IDLClampAdaptor<T>>::convert):
1980         (WebCore::JSConverter<IDLClampAdaptor<T>>::convert):
1981         (WebCore::Converter<IDLEnforceRangeAdaptor<T>>::convert):
1982         (WebCore::JSConverter<IDLEnforceRangeAdaptor<T>>::convert):
1983         Add converters for the new annotated types that call into the new
1984         template specialized conversion functions.
1985
1986         * bindings/js/JSDOMConvertStrings.h:
1987         (WebCore::Converter<IDLDOMString>::convert):
1988         (WebCore::Converter<IDLByteString>::convert):
1989         (WebCore::Converter<IDLUSVString>::convert):
1990         Remove no longer needed StringConversionConfiguration parameter.
1991
1992         (WebCore::Converter<IDLTreatNullAsEmptyAdaptor<T>>::convert):
1993         (WebCore::JSConverter<IDLTreatNullAsEmptyAdaptor<T>>::convert):
1994         (WebCore::Converter<IDLAtomicStringAdaptor<T>>::convert):
1995         (WebCore::JSConverter<IDLAtomicStringAdaptor<T>>::convert):
1996         (WebCore::Converter<IDLRequiresExistingAtomicStringAdaptor<T>>::convert):
1997         (WebCore::JSConverter<IDLRequiresExistingAtomicStringAdaptor<T>>::convert):
1998         Add converters for new annotated types. Statically assert that the atomic string
1999         adaptors only work for DOMString at present.
2000
2001         * bindings/js/JSDOMConvertUnion.h:
2002         Update union code to fix a long standing FIXME, treating enumerations as strings
2003         for the purposes of the union algorithm, and using the new predicate that works
2004         with the slightly more complicated IDLString type (e.g. it can now either be a String
2005         or an AtomicString).
2006
2007         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
2008         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
2009         * bindings/js/JSDocumentCustom.cpp:
2010         * bindings/js/JSEventListener.cpp:
2011         * bindings/js/JSHTMLCanvasElementCustom.cpp:
2012         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
2013         * bindings/js/JSNodeFilterCustom.cpp:
2014         * bindings/js/JSSubtleCryptoCustom.cpp:
2015         Remove explicit passing of Normal for the conversion configuration
2016         and use new adaptors where appropriate.
2017
2018         * bindings/scripts/CodeGeneratorJS.pm:
2019         (IsAnnotatedType):
2020         (GetAnnotatedIDLType):
2021         (GetIDLType):
2022         (JSValueToNative):
2023         (UnsafeToNative):
2024         (GetIntegerConversionConfiguration): Deleted.
2025         (GetStringConversionConfiguration): Deleted.
2026         Replace passing conversion configuration and specializing for atomic string
2027         with annotated types.
2028
2029         * bindings/scripts/IDLParser.pm:
2030         (parseUnionMemberType):
2031         Fix parser error where we weren't parsing extended attributes for a union correctly.
2032
2033         * bindings/scripts/test/JS/JSMapLike.cpp:
2034         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2035         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2036         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2037         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2038         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2039         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2040         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2041         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2042         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2043         * bindings/scripts/test/JS/JSTestInterface.cpp:
2044         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2045         * bindings/scripts/test/JS/JSTestNode.cpp:
2046         * bindings/scripts/test/JS/JSTestObj.cpp:
2047         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2048         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2049         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2050         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2051         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2052         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2053         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2054         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2055         Update tests for changes to integer and string conversion.
2056
2057         * domjit/DOMJITIDLConvert.h:
2058         * domjit/DOMJITIDLType.h:
2059         * domjit/DOMJITIDLTypeFilter.h:
2060         Add specializations for AtomicString related adaptors.
2061
2062         * testing/TypeConversions.h:
2063         * testing/TypeConversions.idl:
2064         - Re-arrange integer attributes to be in size order, and add [Clamp] variants. 
2065         - Replace function taking a dictionary + attributes to inspect it
2066           with a dictionary attribute. This has been supported for a while
2067           and makes the test much clearer (this includes the enum used for
2068           inspecting the union in the dictionary).
2069         - Add additional test unions that exercise annotated types as subtypes.
2070         - Add additional dictionary items that exercise annotated types as subtypes.
2071
2072 2017-04-18  Antti Koivisto  <antti@apple.com>
2073
2074         Enable optimized layer flushes on iOS
2075         https://bugs.webkit.org/show_bug.cgi?id=170938
2076         <rdar://problem/31677395>
2077
2078         Reviewed by Simon Fraser.
2079
2080         Test: compositing/ios/overflow-scroll-touch-tiles.html
2081
2082         * platform/graphics/GraphicsLayer.h:
2083         (WebCore::GraphicsLayer::setApproximatePosition):
2084
2085             Make virtual.
2086
2087         (WebCore::GraphicsLayer::flushCompositingState):
2088         * platform/graphics/ca/GraphicsLayerCA.cpp:
2089         (WebCore::GraphicsLayerCA::syncPosition):
2090
2091             Rename PositionChanged enum value to more descriptive NeedsComputeVisibleAndCoverageRect.
2092
2093         (WebCore::GraphicsLayerCA::setApproximatePosition):
2094         (WebCore::GraphicsLayerCA::syncBoundsOrigin):
2095
2096             Like syncPosition make these invalidate the geometry without scheduling a flush. This is needed
2097             so when flush happens we don't just optimize it away. Tile coverage depends on position and bounds.
2098
2099         (WebCore::GraphicsLayerCA::flushCompositingState):
2100
2101             Remove FlushScope argument.
2102             Disable optimization on WK1 due to some UIKit interactions.
2103
2104         * platform/graphics/ca/GraphicsLayerCA.h:
2105         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2106         (WebCore::GraphicsLayerTextureMapper::flushCompositingState):
2107         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2108
2109 2017-04-18  Tim Horton  <timothy_horton@apple.com>
2110
2111         Try to fix the iOS Debug build
2112
2113         * platform/LengthBox.h:
2114
2115 2017-04-18  Andreas Kling  <akling@apple.com>
2116
2117         Break Document::m_associatedFormControls reference cycle.
2118         <https://webkit.org/b/170946>
2119
2120         Reviewed by Antti Koivisto.
2121
2122         There was a race between didAssociateFormControls() and didAssociateFormControlsTimerFired()
2123         where detaching Document from its frame between the two would lead to an unbreakable reference
2124         cycle between Document and its form elements.
2125
2126         Solve this by clearing the set of associated form elements in removedLastRef(), where we clear
2127         all the other strong smart pointers to elements.
2128
2129         * dom/Document.cpp:
2130         (WebCore::Document::removedLastRef):
2131
2132 2017-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
2133
2134         [css-grid] Add support for percentage gaps
2135         https://bugs.webkit.org/show_bug.cgi?id=170764
2136
2137         Reviewed by Sergio Villar Senin.
2138
2139         Part of the code to support percentage gaps was already imported
2140         from Blink in r213149 (bug #168657). However parsing was not enabled yet,
2141         so some pieces were missing.
2142
2143         This patch accepts percentages in the parsing of grid-column-gap and
2144         grid-row-gap properties, and the grid-gap shorthand.
2145         On top of that it gets rid of GridTrackSizingAlgorithm::sizingOperation()
2146         method as it's not needed. And instead it passes the specific operation
2147         to each call to RenderGrid::guttersSize(), otherwise we would be getting
2148         wrong results.
2149
2150         Test: fast/css-grid-layout/grid-gutters-as-percentage.html
2151
2152         * css/parser/CSSPropertyParser.cpp:
2153         (WebCore::CSSPropertyParser::parseSingleValue): Add support for
2154         percentage values.
2155         (WebCore::CSSPropertyParser::parseShorthand): Ditto.
2156         * rendering/GridTrackSizingAlgorithm.cpp:
2157         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
2158         Pass the specific sizing operation.
2159         * rendering/GridTrackSizingAlgorithm.h: Remove sizingOperation().
2160         * rendering/RenderGrid.cpp:
2161         (WebCore::RenderGrid::computeTrackBasedLogicalHeight): Pass the specific
2162         sizing operation.
2163         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize): Ditto.
2164         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize): Ditto.
2165         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
2166
2167 2017-04-18  Per Arne Vollan  <pvollan@apple.com>
2168
2169         Add fallback fonts to video captions stylesheet.
2170         https://bugs.webkit.org/show_bug.cgi?id=170495
2171
2172         Reviewed by Eric Carlson.
2173
2174         The kCTFontCascadeListAttribute key is used to obtain the cascade list for a font reference.
2175
2176         I have not added a test, since CaptionUserPreferences::testingMode() returns true when running tests,
2177         preventing this code path from being executed.
2178
2179         * page/CaptionUserPreferencesMediaAF.cpp:
2180         (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
2181         * platform/spi/win/CoreTextSPIWin.h:
2182
2183 2017-04-18  Miguel Gomez  <magomez@igalia.com>
2184
2185         [GTK+] Crash in WebCore::ImageFrame::ImageFrame()
2186         https://bugs.webkit.org/show_bug.cgi?id=170332
2187
2188         Reviewed by Carlos Garcia Campos.
2189
2190         When decoding a PNG image, don't reset the number of frames to 1 when there's a decoding error. Doing
2191         so causes a crash if the number of frames we reported before is bigger than 1.
2192
2193         Test: fast/images/bad-png-missing-fdat.html
2194
2195         * platform/image-decoders/png/PNGImageDecoder.cpp:
2196         (WebCore::PNGImageDecoder::fallbackNotAnimated):
2197
2198 2017-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2199
2200         [GLIB] Define priorities also for async network IO tasks
2201         https://bugs.webkit.org/show_bug.cgi?id=170905
2202
2203         Reviewed by Žan Doberšek.
2204
2205         * platform/network/soup/ResourceHandleSoup.cpp:
2206         (WebCore::redirectSkipCallback):
2207         (WebCore::sendRequestCallback):
2208         (WebCore::continueAfterDidReceiveResponse):
2209         (WebCore::readCallback):
2210         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2211         (WebCore::SocketStreamHandleImpl::connected):
2212         (WebCore::SocketStreamHandleImpl::readBytes):
2213
2214 2017-04-17  Zan Dobersek  <zdobersek@igalia.com>
2215
2216         Unreviewed build fix for !ENABLE(MEDIA_STREAM) configurations.
2217
2218         * html/MediaElementSession.cpp:
2219         (WebCore::MediaElementSession::playbackPermitted): Guard the use of
2220         HTMLMediaElement::hasMediaStreamSrcObject() with ENABLE(MEDIA_STREAM).
2221
2222 2017-04-17  Alex Christensen  <achristensen@webkit.org>
2223
2224         Allow Variants of RetainPtrs
2225         https://bugs.webkit.org/show_bug.cgi?id=170923
2226
2227         Reviewed by Tim Horton and Sam Weinig.
2228
2229         No change in behavior.  Just updated the one class that used RetainPtr::operator& to cleanly initialize
2230         RetainPtrs instead of taking the address of a smart pointer and forcing a value inside of it.
2231
2232         * platform/mac/SSLKeyGeneratorMac.mm:
2233         (WebCore::signedPublicKeyAndChallengeString):
2234
2235 2017-04-17  Fujii Hironori  <Hironori.Fujii@sony.com>
2236
2237         [WinCairo] 'WebCore::GraphicsLayerTextureMapper::flushCompositingStated': method with override specifier 'override' did not override any base class methods
2238         https://bugs.webkit.org/show_bug.cgi?id=170928
2239
2240         Reviewed by Simon Fraser.
2241
2242         Apply the same change of CoordinatedGraphicsLayer.{cpp,h} of r215410 to GraphicsLayerTextureMapper.{cpp,h}.
2243
2244         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2245         (WebCore::GraphicsLayerTextureMapper::flushCompositingState): Added the second argument.
2246         * platform/graphics/texmap/GraphicsLayerTextureMapper.h: Ditto.
2247
2248 2017-04-17  Timothy Horton  <timothy_horton@apple.com>
2249
2250         Plumb all four obscured insets to WebCore, instead of just top/left
2251         https://bugs.webkit.org/show_bug.cgi?id=170913
2252
2253         Reviewed by Wenson Hsieh.
2254
2255         No new tests, no observable behavior change yet.
2256
2257         In preparation for a future patch (for rdar://problem/31564652), plumb
2258         all four obscured insets to WebCore/the Web Content process, instead of
2259         just the top and left insets.
2260
2261         * history/HistoryItem.cpp:
2262         (WebCore::HistoryItem::HistoryItem):
2263         * history/HistoryItem.h:
2264         (WebCore::HistoryItem::obscuredInsets):
2265         (WebCore::HistoryItem::setObscuredInsets):
2266         (WebCore::HistoryItem::obscuredInset): Deleted.
2267         (WebCore::HistoryItem::setObscuredInset): Deleted.
2268         * loader/HistoryController.cpp:
2269         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
2270         * page/Page.h:
2271         (WebCore::Page::obscuredInsets):
2272         (WebCore::Page::setObscuredInsets):
2273         (WebCore::Page::obscuredInset): Deleted.
2274         (WebCore::Page::setObscuredInset): Deleted.
2275         Adopt FloatBoxExtent for obscuredInsets (and adjust pluralization).
2276
2277 2017-04-17  Joseph Pecoraro  <pecoraro@apple.com>
2278
2279         Web Inspector: Doesn't show size of compressed content correctly
2280         https://bugs.webkit.org/show_bug.cgi?id=155112
2281         <rdar://problem/25006728>
2282
2283         Reviewed by Alex Christensen and Timothy Hatcher.
2284
2285         Tests: http/tests/inspector/network/resource-sizes-disk-cache.html
2286                http/tests/inspector/network/resource-sizes-memory-cache.html
2287                http/tests/inspector/network/resource-sizes-network.html
2288
2289         * inspector/InspectorNetworkAgent.cpp:
2290         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
2291         * platform/network/NetworkLoadMetrics.h:
2292         (WebCore::NetworkLoadMetrics::isolatedCopy):
2293         (WebCore::NetworkLoadMetrics::reset):
2294         (WebCore::NetworkLoadMetrics::clearNonTimingData):
2295         (WebCore::NetworkLoadMetrics::operator==):
2296         (WebCore::NetworkLoadMetrics::encode):
2297         (WebCore::NetworkLoadMetrics::decode):
2298         * platform/spi/cf/CFNetworkSPI.h:
2299
2300 2017-04-17  Youenn Fablet  <youenn@apple.com>
2301
2302         Enable video autoplay when getUserMedia is on
2303         https://bugs.webkit.org/show_bug.cgi?id=170919
2304
2305         Reviewed by Geoffrey Garen.
2306
2307         Test: webrtc/video-autoplay.html
2308
2309         * dom/Document.h:
2310         (WebCore::Document::isCapturing):
2311         * html/HTMLMediaElement.h:
2312         (WebCore::HTMLMediaElement::hasMediaStreamSrcObject):
2313         * html/MediaElementSession.cpp:
2314         (WebCore::MediaElementSession::playbackPermitted): Allowing playback if getUserMedia is capturing audio or video
2315         on the document and if element is rendering MediaStream based content.
2316         * page/MediaProducer.h:
2317         (WebCore::MediaProducer::isCapturing):
2318
2319 2017-04-17  Alex Christensen  <achristensen@webkit.org>
2320
2321         Fix CMake build.
2322
2323         * PlatformMac.cmake:
2324
2325 2017-04-17  Anders Carlsson  <andersca@apple.com>
2326
2327         Stop using deprecated APIs, part 1
2328         https://bugs.webkit.org/show_bug.cgi?id=170915
2329         rdar://problem/31589635
2330
2331         Reviewed by Tim Horton.
2332
2333         Get rid of the status parameter from ApplePayPaymentMethodUpdate.
2334
2335         * Modules/applepay/ApplePayPaymentMethodUpdate.h:
2336         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
2337         * Modules/applepay/ApplePaySession.cpp:
2338         (WebCore::convertAndValidate):
2339         (WebCore::ApplePaySession::completePaymentMethodSelection):
2340         * Modules/applepay/PaymentRequest.h:
2341
2342 2017-04-17  Youenn Fablet  <youenn@apple.com>
2343
2344         Disable outdated WritableStream API
2345         https://bugs.webkit.org/show_bug.cgi?id=170749
2346         <rdar://problem/31446233>
2347
2348         Reviewed by Alex Christensen.
2349
2350         No change of behavior.
2351         Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by:
2352         - A STREAMS_API compilation flag.
2353         - A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT.
2354
2355         * Configurations/FeatureDefines.xcconfig:
2356         * Modules/fetch/FetchBody.cpp:
2357         * Modules/fetch/FetchBody.h:
2358         * Modules/fetch/FetchBodyOwner.cpp:
2359         (WebCore::FetchBodyOwner::isDisturbedOrLocked):
2360         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
2361         (WebCore::FetchBodyOwner::blobLoadingFailed):
2362         (WebCore::FetchBodyOwner::blobChunk):
2363         * Modules/fetch/FetchBodyOwner.h:
2364         * Modules/fetch/FetchResponse.cpp:
2365         (WebCore::FetchResponse::BodyLoader::didSucceed):
2366         (WebCore::FetchResponse::BodyLoader::didFail):
2367         (WebCore::FetchResponse::BodyLoader::didReceiveData):
2368         * Modules/fetch/FetchResponse.h:
2369         * Modules/fetch/FetchResponse.idl:
2370         * Modules/fetch/FetchResponseSource.cpp:
2371         * Modules/fetch/FetchResponseSource.h:
2372         * Modules/streams/ByteLengthQueuingStrategy.idl:
2373         * Modules/streams/ByteLengthQueuingStrategy.js:
2374         * Modules/streams/CountQueuingStrategy.idl:
2375         * Modules/streams/CountQueuingStrategy.js:
2376         * Modules/streams/ReadableByteStreamController.idl:
2377         * Modules/streams/ReadableByteStreamController.js:
2378         * Modules/streams/ReadableByteStreamInternals.js:
2379         * Modules/streams/ReadableStream.idl:
2380         * Modules/streams/ReadableStream.js:
2381         (initializeReadableStream): Using readableByteStreamAPI runtime flag directly.
2382         * Modules/streams/ReadableStreamBYOBRequest.idl:
2383         * Modules/streams/ReadableStreamBYOBRequest.js:
2384         * Modules/streams/ReadableStreamDefaultController.idl:
2385         * Modules/streams/ReadableStreamDefaultController.js:
2386         * Modules/streams/ReadableStreamDefaultReader.idl:
2387         * Modules/streams/ReadableStreamDefaultReader.js:
2388         * Modules/streams/ReadableStreamInternals.js:
2389         * Modules/streams/ReadableStreamSource.h:
2390         * Modules/streams/ReadableStreamSource.idl:
2391         * Modules/streams/StreamInternals.js:
2392         * Modules/streams/WritableStream.idl:
2393         * Modules/streams/WritableStream.js:
2394         * Modules/streams/WritableStreamInternals.js:
2395         * bindings/js/JSDOMGlobalObject.cpp:
2396         (WebCore::isReadableByteStreamAPIEnabled):
2397         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
2398         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2399         (WebCore::constructJSReadableStreamBYOBRequest):
2400         (WebCore::JSBuiltinReadableStreamBYOBRequestPrivateConstructor::initializeExecutable):
2401         (WebCore::createReadableStreamBYOBRequestPrivateConstructor):
2402         * bindings/js/JSReadableStreamPrivateConstructors.h:
2403         * bindings/js/JSReadableStreamSourceCustom.cpp:
2404         * bindings/js/ReadableStreamDefaultController.cpp:
2405         * bindings/js/ReadableStreamDefaultController.h:
2406         * bindings/js/WebCoreBuiltinNames.h:
2407         * page/RuntimeEnabledFeatures.h:
2408         (WebCore::RuntimeEnabledFeatures::setReadableByteStreamAPIEnabled):
2409         (WebCore::RuntimeEnabledFeatures::readableByteStreamAPIEnabled):
2410         (WebCore::RuntimeEnabledFeatures::setWritableStreamAPIEnabled):
2411         (WebCore::RuntimeEnabledFeatures::writableStreamAPIEnabled):
2412         * testing/Internals.cpp:
2413         * testing/Internals.h:
2414         * testing/Internals.idl:
2415
2416 2017-04-17  Tim Horton  <timothy_horton@apple.com>
2417
2418         Provide a viewport parameter to disable clipping to the safe area
2419         https://bugs.webkit.org/show_bug.cgi?id=170766
2420         <rdar://problem/31564634>
2421
2422         Reviewed by Beth Dakin.
2423
2424         Tests: tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html,
2425                tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html,
2426
2427         * dom/ViewportArguments.cpp:
2428         (WebCore::ViewportArguments::resolve):
2429         (WebCore::setViewportFeature):
2430         * dom/ViewportArguments.h:
2431         (WebCore::ViewportArguments::operator==):
2432         * page/ViewportConfiguration.cpp:
2433         (WebCore::ViewportConfiguration::updateConfiguration):
2434         (WebCore::operator<<):
2435         (WebCore::ViewportConfiguration::description):
2436         * page/ViewportConfiguration.h:
2437         (WebCore::ViewportConfiguration::Parameters::Parameters):
2438         (WebCore::ViewportConfiguration::clipToSafeArea):
2439         Add viewport parameter.
2440
2441         * page/ChromeClient.h:
2442         * page/FrameView.h:
2443         * page/FrameView.cpp:
2444         (WebCore::FrameView::enableSpeculativeTilingIfNeeded):
2445         If not clipping to the safe area, enable "speculative" tiling immediately,
2446         because the margin tiles can be visible immediately.
2447
2448         (WebCore::FrameView::hasExtendedBackgroundRectForPainting):
2449         (WebCore::FrameView::updateTilesForExtendedBackgroundMode):
2450         Don't check the setting here; just respect the mode that is computed
2451         by calculateExtendedBackgroundMode.
2452
2453         (WebCore::FrameView::calculateExtendedBackgroundMode):
2454         If the viewport parameter was set, add margin tiles on both axes.
2455
2456         (WebCore::FrameView::setClipToSafeArea):
2457         Notify ChromeClient of the change, and re-compute the margin tile mode.
2458
2459         * rendering/RenderLayerCompositor.h:
2460         * rendering/RenderLayerCompositor.cpp:
2461         Factor out code that decides whether the content layer clips to bounds,
2462         and make it take the new viewport parameter into account.
2463
2464         * rendering/RenderObject.cpp:
2465         Don't clip RenderView repaints to RenderView's GraphicsLayer bounds if
2466         clip-to-safe-area is off, just like we do for slow-repaint objects in
2467         extended background mode.
2468
2469 2017-04-17  Dan Bernstein  <mitz@apple.com>
2470
2471         [Cocoa] Move isNullFunctionPointer down into WTF
2472         https://bugs.webkit.org/show_bug.cgi?id=170892
2473
2474         Reviewed by Sam Weinig.
2475
2476         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2477         (WebCore::LibWebRTCProvider::webRTCAvailable): Changed to use WTF::isNullFunctionPointer,
2478           and removed the static variable, so instead of loading from the initialization guard,
2479           branching, then loading from the variable itself, we just load from the function pointer.
2480         (WebCore::isNullFunctionPointer): Deleted.
2481
2482 2017-04-14  Jiewen Tan  <jiewen_tan@apple.com>
2483
2484         [WebCrypto] Add support for ECDSA
2485         https://bugs.webkit.org/show_bug.cgi?id=170789
2486         <rdar://problem/31588604>
2487
2488         Reviewed by Brent Fulgham.
2489
2490         This patch implements ECDSA according to the spec: https://www.w3.org/TR/WebCryptoAPI/#ecdsa.
2491         Supported operations include sign, verify, generateKey, importKey and exportKey.
2492
2493         Tests: crypto/subtle/ecdh-generate-export-key-pkcs8-p256.html
2494                crypto/subtle/ecdh-generate-export-key-pkcs8-p384.html
2495                crypto/subtle/ecdsa-generate-export-jwk-key.html
2496                crypto/subtle/ecdsa-generate-export-key-pkcs8.html
2497                crypto/subtle/ecdsa-generate-export-key-raw.html
2498                crypto/subtle/ecdsa-generate-export-key-spki.html
2499                crypto/subtle/ecdsa-generate-key-sign-verify-p256.html
2500                crypto/subtle/ecdsa-generate-key-sign-verify-p384.html
2501                crypto/subtle/ecdsa-generate-key.html
2502                crypto/subtle/ecdsa-import-jwk-private-key.html
2503                crypto/subtle/ecdsa-import-jwk-public-key-alg-256.html
2504                crypto/subtle/ecdsa-import-jwk-public-key-alg-384.html
2505                crypto/subtle/ecdsa-import-jwk-public-key.html
2506                crypto/subtle/ecdsa-import-key-sign-p256.html
2507                crypto/subtle/ecdsa-import-key-sign-p384.html
2508                crypto/subtle/ecdsa-import-key-verify-p256.html
2509                crypto/subtle/ecdsa-import-key-verify-p384.html
2510                crypto/subtle/ecdsa-import-pkcs8-key.html
2511                crypto/subtle/ecdsa-import-raw-key.html
2512                crypto/subtle/ecdsa-import-spki-key.html
2513                crypto/subtle/ecdsa-verify-malformed-parameters.html
2514                crypto/workers/subtle/ecdsa-import-key-sign.html
2515                crypto/workers/subtle/ecdsa-import-key-verify.html
2516
2517         * CMakeLists.txt:
2518         * DerivedSources.make:
2519         * PlatformGTK.cmake:
2520         * PlatformMac.cmake:
2521         * WebCore.xcodeproj/project.pbxproj:
2522         * bindings/js/JSSubtleCryptoCustom.cpp:
2523         (WebCore::normalizeCryptoAlgorithmParameters):
2524         (WebCore::jsSubtleCryptoFunctionSignPromise):
2525         (WebCore::jsSubtleCryptoFunctionVerifyPromise):
2526         Add missing parameters.
2527         * crypto/CommonCryptoUtilities.h:
2528         * crypto/CryptoAlgorithm.cpp:
2529         (WebCore::CryptoAlgorithm::sign):
2530         (WebCore::CryptoAlgorithm::verify):
2531         * crypto/CryptoAlgorithm.h:
2532         Add missing parameters.
2533         * crypto/CryptoAlgorithmParameters.h:
2534         * crypto/algorithms/CryptoAlgorithmECDSA.cpp: Added.
2535         (WebCore::CryptoAlgorithmECDSA::create):
2536         (WebCore::CryptoAlgorithmECDSA::identifier):
2537         (WebCore::CryptoAlgorithmECDSA::sign):
2538         (WebCore::CryptoAlgorithmECDSA::verify):
2539         (WebCore::CryptoAlgorithmECDSA::generateKey):
2540         (WebCore::CryptoAlgorithmECDSA::importKey):
2541         (WebCore::CryptoAlgorithmECDSA::exportKey):
2542         * crypto/algorithms/CryptoAlgorithmECDSA.h: Added.
2543         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2544         (WebCore::CryptoAlgorithmHMAC::sign):
2545         (WebCore::CryptoAlgorithmHMAC::verify):
2546         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2547         Add missing parameters.
2548         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2549         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2550         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2551         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2552         Add missing parameters.
2553         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp: Added.
2554         (WebCore::CryptoAlgorithmECDSA::platformSign):
2555         (WebCore::CryptoAlgorithmECDSA::platformVerify):
2556         * crypto/mac/CommonCryptoDERUtilities.cpp: Added.
2557         (WebCore::bytesUsedToEncodedLength):
2558         (WebCore::extraBytesNeededForEncodedLength):
2559         (WebCore::addEncodedASN1Length):
2560         (WebCore::bytesNeededForEncodedLength):
2561         * crypto/mac/CommonCryptoDERUtilities.h:
2562         (WebCore::bytesUsedToEncodedLength): Deleted.
2563         (WebCore::extraBytesNeededForEncodedLength): Deleted.
2564         (WebCore::addEncodedASN1Length): Deleted.
2565         (WebCore::bytesNeededForEncodedLength): Deleted.
2566         Move implementations to a .cpp file.
2567         * crypto/mac/CryptoAlgorithmECDSAMac.cpp: Added.
2568         (WebCore::cryptoDigestAlgorithm):
2569         (WebCore::signECDSA):
2570         (WebCore::verifyECDSA):
2571         (WebCore::CryptoAlgorithmECDSA::platformSign):
2572         (WebCore::CryptoAlgorithmECDSA::platformVerify):
2573         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
2574         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
2575         * crypto/parameters/CryptoAlgorithmEcdsaParams.h: Added.
2576         * crypto/parameters/EcdsaParams.idl: Added.
2577
2578 2017-04-17  Jeremy Jones  <jeremyj@apple.com>
2579
2580         Refactor enumerateDevices to allow separate CaptureDeviceManagers for audio and video.
2581         https://bugs.webkit.org/show_bug.cgi?id=170778
2582
2583         Reviewed by Eric Carlson.
2584
2585         Add CoreAudioCaptureDeviceManager to enumerate CoreAudio devices.
2586
2587         Refactor RealtimeMediaSourceCenter and RealtimeMediaSourceCenterMac to provide independent audio and video capture device managers
2588         and the abiliity to override the capture device managers.
2589
2590         CoreAudioCaptureSource now uses CoreAudioCaptureDeviceManager to use the specified device instead of the default one. 
2591
2592         * WebCore.xcodeproj/project.pbxproj:
2593         * platform/mediastream/CaptureDeviceManager.cpp:
2594         (CaptureDeviceManager::getAudioSourcesInfo):
2595         (CaptureDeviceManager::getVideoSourcesInfo):
2596         (CaptureDeviceManager::getSourcesInfo): Deleted.
2597         * platform/mediastream/CaptureDeviceManager.h:
2598         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2599         (WebCore::RealtimeMediaSourceCenter::setAudioCaptureDeviceManager):
2600         (WebCore::RealtimeMediaSourceCenter::unsetAudioCaptureDeviceManager):
2601         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureDeviceManager):
2602         (WebCore::RealtimeMediaSourceCenter::unsetVideoCaptureDeviceManager):
2603         * platform/mediastream/RealtimeMediaSourceCenter.h:
2604         (WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureDeviceManager):
2605         (WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureDeviceManager):
2606         (WebCore::RealtimeMediaSourceCenter::audioCaptureDeviceManager):
2607         (WebCore::RealtimeMediaSourceCenter::videoCaptureDeviceManager):
2608         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2609         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2610         (WebCore::AVCaptureDeviceManager::refreshAVCaptureDevicesOfType):
2611         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
2612         (WebCore::AVCaptureDeviceManager::getAudioSourcesInfo):
2613         (WebCore::AVCaptureDeviceManager::getVideoSourcesInfo):
2614         (WebCore::AVCaptureDeviceManager::setUseAVFoundationAudioCapture): Deleted.
2615         (WebCore::AVCaptureDeviceManager::getSourcesInfo): Deleted.
2616         * platform/mediastream/mac/CoreAudioCaptureDevice.cpp: Added.
2617         (WebCore::getDeviceInfo):
2618         (WebCore::CoreAudioCaptureDevice::create):
2619         (WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
2620         (WebCore::CoreAudioCaptureDevice::deviceID):
2621         (WebCore::CoreAudioCaptureDevice::deviceClock):
2622         (WebCore::CoreAudioCaptureDevice::isAlive):
2623         * platform/mediastream/mac/CoreAudioCaptureDevice.h: Copied from Source/WebCore/platform/mediastream/CaptureDeviceManager.h.
2624         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: Added.
2625         (WebCore::CoreAudioCaptureDeviceManager::singleton):
2626         (WebCore::CoreAudioCaptureDeviceManager::captureDevices):
2627         (WebCore::deviceHasInputStreams):
2628         (WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
2629         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
2630         (WebCore::CoreAudioCaptureDeviceManager::devicesChanged):
2631         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h: Copied from Source/WebCore/platform/mediastream/CaptureDeviceManager.h.
2632         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2633         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
2634         (WebCore::CoreAudioCaptureSource::startProducingData):
2635         (WebCore::CoreAudioCaptureSource::stopProducingData):
2636         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2637         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
2638         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
2639         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
2640         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamDevices):
2641         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2642
2643 2017-04-17  Ryan Haddad  <ryanhaddad@apple.com>
2644
2645         Unreviewed, rolling out r215366.
2646
2647         This test is failing on performance bots.
2648
2649         Reverted changeset:
2650
2651         "Add performance test for asking the platform for a font for
2652         U+2060 WORD JOINER"
2653         https://bugs.webkit.org/show_bug.cgi?id=170842
2654         http://trac.webkit.org/changeset/215366
2655
2656 2017-04-17  Youenn Fablet  <youenn@apple.com>
2657
2658         RTCPeerConnection addTrack does not require a stream parameter
2659         https://bugs.webkit.org/show_bug.cgi?id=170894
2660
2661         Reviewed by Alex Christensen.
2662
2663         Test: webrtc/video-addTrack.html
2664
2665         * Modules/mediastream/RTCPeerConnection.cpp:
2666         (WebCore::RTCPeerConnection::addTrack): Removing obsolete error throwing.
2667
2668 2017-04-17  Youenn Fablet  <youenn@apple.com>
2669
2670         Add an external libwebrtc encoder factory in WebCore
2671         https://bugs.webkit.org/show_bug.cgi?id=170883
2672
2673         Reviewed by Alex Christensen.
2674
2675         No change of behavior, WebCore factory instantiating the default libwebrtc H264 encoder.
2676
2677         * WebCore.xcodeproj/project.pbxproj:
2678         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2679         (WebCore::staticFactoryAndThreads):
2680         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: Added.
2681         (WebCore::VideoToolboxVideoEncoderFactory::CreateVideoEncoder):
2682         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
2683         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h: Added.
2684
2685 2017-04-17  Antti Koivisto  <antti@apple.com>
2686
2687         GraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without changes
2688         https://bugs.webkit.org/show_bug.cgi?id=170851
2689
2690         Reviewed by Simon Fraser.
2691
2692         With lots of layers this can be very slow as it always traverses the entire layer tree.
2693         For example GIF animations on tumblr.com trigger expensive commits where almost nothing changes.
2694
2695         This patch adds m_hasDescendantsWithUncommittedChanges bit to GraphicsLayerCA. With this
2696         we can avoid descending to branches without changes when committing.
2697
2698         This patch enabled the optimization on Mac.
2699
2700         * platform/graphics/ca/GraphicsLayerCA.cpp:
2701         (WebCore::GraphicsLayerCA::GraphicsLayerCA::syncPosition):
2702
2703             Set PositionChanged flag when syncing layer position. This flag does nothing except makes
2704             next commit to update the coverage rect (so tiling gets updated).
2705
2706         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
2707
2708             Do all setting of m_uncommittedChanges bits via addUncommittedChanges function.
2709
2710         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2711
2712             Bail out if neither the current layer nor any of its descendants have any uncommited changes
2713             and none of the ancestors had changes.
2714
2715         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2716         (WebCore::GraphicsLayerCA::ensureStructuralLayer):
2717         (WebCore::GraphicsLayerCA::changeLayerTypeTo):
2718         (WebCore::GraphicsLayerCA::addUncommittedChanges):
2719
2720             Set m_hasDescendantsWithUncommittedChanges bit in ancestors when mutating m_uncommittedChanges.
2721
2722         (WebCore::GraphicsLayerCA::noteLayerPropertyChanged):
2723         * platform/graphics/ca/GraphicsLayerCA.h:
2724         (WebCore::RenderLayerCompositor::frameViewDidScroll):
2725
2726             Tell the scrolling layer that it needs to recompute coverage.
2727             This also schedules a layer flush so no need to do that separately.
2728
2729 2017-04-16  Chris Dumez  <cdumez@apple.com>
2730
2731         CMD+R / CMD+Q is considered as user interaction and beforeunload alert is shown
2732         https://bugs.webkit.org/show_bug.cgi?id=169995
2733         <rdar://problem/23798897>
2734
2735         Reviewed by Sam Weinig.
2736
2737         Any key event was considered as user interaction with the page, which meant that they
2738         would allow beforeunload alerts to be shown even when they do not represent actual
2739         user interaction (e.g CMD+R / CMD+Q / CMD+T keyboard shortcuts).
2740
2741         To address the issue, we now only treat as user interaction with the page key events
2742         that are actually handled by the page (i.e. handled by JS, typed into a field, ...).
2743
2744         Tests: fast/events/beforeunload-alert-handled-keydown.html
2745                fast/events/beforeunload-alert-unhandled-keydown.html
2746
2747         * dom/Document.h:
2748         (WebCore::Document::setUserDidInteractWithPage):
2749         (WebCore::Document::userDidInteractWithPage):
2750         * dom/UserGestureIndicator.cpp:
2751         (WebCore::UserGestureIndicator::UserGestureIndicator):
2752         * loader/FrameLoader.cpp:
2753         (WebCore::shouldAskForNavigationConfirmation):
2754         * page/EventHandler.cpp:
2755         (WebCore::EventHandler::keyEvent):
2756         (WebCore::EventHandler::internalKeyEvent):
2757         * page/EventHandler.h:
2758
2759 2017-04-16  Sam Weinig  <sam@webkit.org>
2760
2761         [WebIDL] Switch IDLAttributes.txt over to a more structured format so that more information can be added for each attribute
2762         https://bugs.webkit.org/show_bug.cgi?id=170843
2763
2764         Reviewed by Chris Dumez.
2765
2766         - Converts IDLAttributes.txt to IDLAttributes.json, and adds additional
2767           information for each attribute about what contexts they are valid in 
2768           which is checked by the parser.
2769         - Removes CustomSetPrototype which was unused, and Immutable which did 
2770           nothing. 
2771
2772         * DerivedSources.make:
2773         Update extension of IDLAttributes to .json
2774
2775         * WebCore.xcodeproj/project.pbxproj:
2776         Update project file for new file name and add some missing IDL files.
2777
2778         * bindings/scripts/CodeGenerator.pm:
2779         Store the processed IDLAttributes in the code generator, so it can
2780         be used for any additional Parser instantiations.
2781
2782         * bindings/scripts/CodeGeneratorJS.pm:
2783         (GenerateHeader):
2784         Remove support for CustomSetPrototype. Nobody is using it.
2785
2786         * bindings/scripts/IDLAttributes.json: Copied from Source/WebCore/bindings/scripts/IDLAttributes.txt.
2787         * bindings/scripts/IDLAttributes.txt: Removed.
2788         Rename IDLAttributes.txt -> IDLAttributes.json and move the data
2789         into a more structured format. For now each extended attribute can
2790         have the following fields:
2791             Required:
2792                 'contextsAllowed' -> Non-empty array of strings from the contexts array.
2793
2794             Optional:
2795                 'values' -> Non-empty array of strings allowed after the equal (=) sign in 
2796                    the extended attribute. Like before, an empty string indicates it is 
2797                    ok to not have a value and a star (*) indicates any string is allowed.
2798                    Not providing a values property at all indicates that no value is
2799                    allowed.
2800
2801                 'standard' -> An object with information about the standard this attribute
2802                    comes from. Should only be added to attributes that come from standards.
2803
2804                 'unsupported' -> A boolean with value true, indicating this property is not
2805                    yet supported. Should only be used for standard attributes.
2806
2807                 'notes' -> A string with notes explaining something about this attribute.
2808         
2809         * bindings/scripts/IDLParser.pm:
2810         Pass and store the processed extended attribute map to the parser, and use it
2811         validate that extended attributes being added to things are appropriate for the
2812         context. Fix FIXME in isExtendedAttributeApplicableToTypes by using the map to 
2813         implement the predicate, rather than hard coding the list.
2814
2815         * bindings/scripts/generate-bindings.pl:
2816         (generateEmptyHeaderAndCpp):
2817         (loadIDLAttributes): Deleted.
2818         (checkIDLAttributes): Deleted.
2819         (checkIfIDLAttributesExists): Deleted.
2820         Make specifying an IDL attributes file required. Switch to processing it
2821         as a JSON file, and having the parser validate attributes.
2822
2823         * bindings/scripts/test/JS/JSTestObj.cpp:
2824         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2825         * bindings/scripts/test/TestImplements.idl:
2826         * bindings/scripts/test/TestObj.idl:
2827         * bindings/scripts/test/TestSupplemental.idl:
2828         * bindings/scripts/test/TestTypedefs.idl:
2829         - Remove use of Immutable extended attribute in the tests, as it does nothing.
2830         - Remove use of the made up ReadOnly attribute, as the tests now use the IDLAttributes
2831           file to validate that the attributes are supported, so this would otherwise fail.
2832
2833         * css/WebKitCSSMatrix.idl:
2834         * svg/SVGZoomEvent.idl:
2835         - Remove use of the Immutable extended attribute, as it does nothing.
2836
2837         * page/NavigatorID.idl:
2838         * page/NavigatorLanguage.idl:
2839         - Remove use of the Nondeterministic extended attribute, as it does nothing.
2840
2841         * Modules/mediasource/SourceBufferList.idl:
2842         Remove use of CallWith on the interface. It is illegal, and does nothing.
2843
2844         * animation/KeyframeEffect.idl:
2845         * animation/WebAnimation.idl:
2846         Remove use of [Default=Undefined]. This construct does nothing and now
2847         correctly fails to parse. 
2848
2849 2017-04-15  Alex Christensen  <achristensen@webkit.org>
2850
2851         Fix Windows build after r215396.
2852         https://bugs.webkit.org/show_bug.cgi?id=170828
2853
2854         * platform/graphics/win/FontPlatformDataWin.cpp:
2855         (WebCore::FontPlatformData::openTypeTable):
2856
2857 2017-04-15  Alex Christensen  <achristensen@webkit.org>
2858
2859         Remove unused SharedBuffer constructor
2860         https://bugs.webkit.org/show_bug.cgi?id=170828
2861
2862         Reviewed by Brady Eidson.
2863
2864         * platform/SharedBuffer.cpp:
2865         (WebCore::SharedBuffer::append):
2866         * platform/SharedBuffer.h:
2867         (WebCore::SharedBuffer::create):
2868         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
2869         (WebCore::FontPlatformData::openTypeTable):
2870         * platform/graphics/win/FontPlatformDataWin.cpp:
2871         (WebCore::FontPlatformData::openTypeTable):
2872
2873 2017-04-15  Commit Queue  <commit-queue@webkit.org>
2874
2875         Unreviewed, rolling out r215393.
2876         https://bugs.webkit.org/show_bug.cgi?id=170876
2877
2878         breaks scrollable iframes on ios (Requested by anttik on
2879         #webkit).
2880
2881         Reverted changeset:
2882
2883         "GraphicsLayerCA::recursiveCommitChanges should not descend
2884         into subtrees without changes"
2885         https://bugs.webkit.org/show_bug.cgi?id=170851
2886         http://trac.webkit.org/changeset/215393
2887
2888 2017-04-14  Antti Koivisto  <antti@apple.com>
2889
2890         GraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without changes
2891         https://bugs.webkit.org/show_bug.cgi?id=170851
2892
2893         Reviewed by Simon Fraser.
2894
2895         With lots of layers this can be very slow as it always traverses the entire layer tree.
2896         For example GIF animations on tumblr.com trigger expensive commits where almost nothing changes.
2897
2898         This patch adds m_hasDescendantsWithUncommittedChanges bit to GraphicsLayerCA. With this
2899         we can avoid descending to branches without changes when committing.
2900
2901         * platform/graphics/ca/GraphicsLayerCA.cpp:
2902         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
2903
2904             Do all setting of m_uncommittedChanges bits via addUncommittedChanges function.
2905
2906         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2907
2908             Bail out if neither the current layer nor any of its descendants have any uncommited changes
2909             and none of the ancestors had changes.
2910
2911         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2912         (WebCore::GraphicsLayerCA::ensureStructuralLayer):
2913         (WebCore::GraphicsLayerCA::changeLayerTypeTo):
2914         (WebCore::GraphicsLayerCA::addUncommittedChanges):
2915
2916             Set m_hasDescendantsWithUncommittedChanges bit in ancestors when mutating m_uncommittedChanges.
2917
2918         (WebCore::GraphicsLayerCA::noteLayerPropertyChanged):
2919         * platform/graphics/ca/GraphicsLayerCA.h:
2920         (WebCore::RenderLayerCompositor::frameViewDidScroll):
2921
2922             Tell the scrolling layer that it needs to recompute coverage.
2923             This also schedules a layer flush so no need to do that separately.
2924
2925 2017-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2926
2927         [WK2] Support data interaction of files into file inputs
2928         https://bugs.webkit.org/show_bug.cgi?id=170803
2929         <rdar://problem/31286130>
2930
2931         Reviewed by Tim Horton.
2932
2933         Adds remaining support to allow data interaction of files onto inputs of type file. See per-change annotations
2934         for more details. Unit tests to be added in the next patch.
2935
2936         * platform/PasteboardStrategy.h:
2937         * platform/PlatformPasteboard.h:
2938         * platform/ios/AbstractPasteboard.h:
2939         * platform/ios/PlatformPasteboardIOS.mm:
2940         (WebCore::PlatformPasteboard::numberOfFiles):
2941         * platform/ios/WebItemProviderPasteboard.mm:
2942
2943         Implements numberOfFiles by counting the number of item providers that may be represented as a file, which
2944         includes all item providers that contain at least one content UTI type.
2945
2946         (-[WebItemProviderPasteboard numberOfFiles]):
2947
2948         Adds boilerplate plumbing to fetch the number of files available on the pasteboard. On Mac, logic that
2949         previously existed in DragData::numberOfFiles to query the number of files available in the pasteboard is now
2950         on PlatformPasteboard instead, which both makes the implementation of DragData::numberOfFiles platform-invariant,
2951         and also saves us one synchronous IPC call to the UI process in the WebKit2 implementation.
2952
2953         * platform/mac/DragDataMac.mm:
2954         (WebCore::DragData::containsFiles):
2955         (WebCore::DragData::numberOfFiles):
2956         (WebCore::DragData::asFilenames):
2957
2958         Add support for recognizing objects in the pasteboard that may be represented by files, and therefore may be
2959         uploaded via file input. Following suit with behavior elsewhere on the platform, we consider item providers able
2960         to be represented by a file if they contain at least one content UTI type.
2961
2962         * platform/mac/PlatformPasteboardMac.mm:
2963
2964         Logic previously in DragData::numberOfFiles to get and then count all file path names in the pasteboard has been
2965         moved here instead, and no longer needs to go through the pasteboard proxy.
2966
2967         (WebCore::PlatformPasteboard::numberOfFiles):
2968
2969 2017-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2970
2971         Unreviewed, fix the build after r215389
2972
2973         Use WebCore::createTemporaryDirectory instead of -_webkit_createTemporaryDirectoryWithTemplatePrefix:.
2974
2975         * platform/ios/WebItemProviderPasteboard.mm:
2976         (temporaryFileURLForDataInteractionContent):
2977
2978 2017-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2979
2980         Implement a way in WebItemProviderPasteboard to perform actions after file loading completes
2981         https://bugs.webkit.org/show_bug.cgi?id=170839
2982         <rdar://problem/31286130>
2983
2984         Reviewed by Tim Horton, Andy Estes, and Dan Bernstein.
2985
2986         Introduces -[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:], which performs an action
2987         after all item providers which are able to provide content are done loading their content into temporary file
2988         URLs. If no item providers have available data, we will immediately invoke the action with an empty URL array.
2989
2990         For each item provider with data, we save the local URL returned in the load completion block to a randomly
2991         generated path in the container's temporary directory. When all files are finished loading, we then invoke the
2992         action with all file URLs that successfully loaded.
2993
2994         No new tests, since there is no change in behavior.
2995
2996         * platform/ios/WebItemProviderPasteboard.h:
2997         * platform/ios/WebItemProviderPasteboard.mm:
2998         (temporaryFileURLForDataInteractionContent):
2999         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
3000
3001 2017-04-14  Nikita Vasilyev  <nvasilyev@apple.com>
3002
3003         Web Inspector: WebSockets: messages with non-latin letters are displayed incorrectly
3004         https://bugs.webkit.org/show_bug.cgi?id=170760
3005
3006         Reviewed by Joseph Pecoraro.
3007
3008         Add payloadLength property, which is used to display size. When payloadLength is unavailable,
3009         it is calculated from payloadData by Web Inspector frontend.
3010
3011         This fixes <webkit.org/b/170609> Web Inspector: WebSockets: Transferred size is incorrect.
3012
3013         Tests: http/tests/websocket/tests/hybi/inspector/binary.html
3014                http/tests/websocket/tests/hybi/inspector/send-and-receive.html
3015
3016         * inspector/InspectorNetworkAgent.cpp:
3017         (WebCore::InspectorNetworkAgent::didReceiveWebSocketFrame):
3018         (WebCore::InspectorNetworkAgent::didSendWebSocketFrame):
3019
3020 2017-04-14  Mark Lam  <mark.lam@apple.com>
3021
3022         Update architectures in xcconfig files.
3023         https://bugs.webkit.org/show_bug.cgi?id=170867
3024         <rdar://problem/31628104>
3025
3026         Reviewed by Joseph Pecoraro.
3027
3028         No new tests needed.  Only updating xcconfig files.
3029
3030         * Configurations/Base.xcconfig:
3031         * Configurations/FeatureDefines.xcconfig:
3032
3033 2017-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3034
3035         [WK2] Support Icon creation from file URLs on iOS
3036         https://bugs.webkit.org/show_bug.cgi?id=170809
3037         <rdar://problem/31286130>
3038
3039         Reviewed by Tim Horton.
3040
3041         Minor tweaks and refactoring to support displaying a WebCore::Icon from a list of filepaths on iOS. Please see
3042         below annotations for more details. No new tests yet, as behavior on Mac should not have changed, and behavior
3043         on iOS will not change until later patches land. Tests will be added in a later patch.
3044
3045         Most of the changes here remove platform special-casing in FileInputType for iOS and Mac, refactoring the code
3046         such that it works for both platforms while preserving behavior.
3047
3048         * html/FileInputType.cpp:
3049         (WebCore::FileInputType::~FileInputType):
3050         (WebCore::FileInputType::setFiles):
3051         (WebCore::FileInputType::filesChosen):
3052         * html/FileInputType.h:
3053
3054         Un-guard m_fileIconLoader on iOS, and un-guard m_displayString for Mac. Consolidate logic in both version of
3055         filesChosen and remove the iOS-specific version. Behavior when passing in an empty display string and null Icon
3056         will be the same as that of the existing filesChosen method on Mac. Also, introduce a version of setFiles that
3057         takes an additional RequestIcon enum that indicates whether or not to additionally use the new filepaths to
3058         request an Icon update. filesChosen invokes this with RequestIcon::No if a non-null Icon was specified, as is
3059         the case when uploading a file via the image picker on iOS.
3060
3061         * html/HTMLInputElement.cpp:
3062         (WebCore::HTMLInputElement::displayString):
3063         * html/HTMLInputElement.h:
3064         * html/InputType.cpp:
3065         * html/InputType.h:
3066         * loader/EmptyClients.h:
3067         * page/ChromeClient.h:
3068
3069         Introduce ChromeClient::createIconForFiles, which generates an icon representing the content at a list of file
3070         paths. See WebKit and WebKit2 ChangeLogs for more details.
3071
3072         * platform/FileChooser.h:
3073         (WebCore::FileChooserClient::filesChosen):
3074         * rendering/RenderFileUploadControl.cpp:
3075         (WebCore::RenderFileUploadControl::fileTextValue):
3076
3077         Remove platform special-casing when generating the text to display when uploading a file. If a displayString
3078         is specified, then we use the contents of the displayString; otherwise, fall back to using the input element's
3079         FileList to compute the display string.
3080
3081 2017-04-14  Brady Eidson  <beidson@apple.com>
3082
3083         Fix basic WKURLSchemeHandler bugs.
3084         <rdar://problem/30647559> and https://bugs.webkit.org/show_bug.cgi?id=170862
3085
3086         Reviewed by Andy Estes.
3087
3088         Covered by new API tests.
3089
3090         * loader/SubresourceLoader.cpp:
3091         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
3092
3093 2017-04-14  Jiewen Tan  <jiewen_tan@apple.com>
3094
3095         [WebCrypto] Support HKDF
3096         https://bugs.webkit.org/show_bug.cgi?id=170636
3097         <rdar://problem/23539827>
3098
3099         Reviewed by Brent Fulgham.
3100
3101         This patch implements HKDF according to the spec: https://www.w3.org/TR/WebCryptoAPI/#hkdf.
3102         Supported operations include deriveKey, deriveBits, importKey and getKeyLength.
3103
3104         Tests: crypto/subtle/ecdh-import-key-derive-hkdf-key.html
3105                crypto/subtle/hkdf-derive-bits-malformed-parametrs.html
3106                crypto/subtle/hkdf-import-key-derive-bits.html
3107                crypto/subtle/hkdf-import-key-derive-hmac-key.html
3108                crypto/subtle/hkdf-import-key-malformed-parameters.html
3109                crypto/subtle/hkdf-import-key.html
3110                crypto/workers/subtle/hkdf-import-key-derive-bits.html
3111                crypto/workers/subtle/hkdf-import-key-derive-hmac-key.html
3112                crypto/workers/subtle/hkdf-import-key.html
3113
3114         * CMakeLists.txt:
3115         * DerivedSources.make:
3116         * PlatformGTK.cmake:
3117         * PlatformMac.cmake:
3118         * WebCore.xcodeproj/project.pbxproj:
3119         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
3120         (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
3121         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
3122         (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign):
3123         (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
3124         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest):
3125         (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey):
3126         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey):
3127         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits):
3128         (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
3129         (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey):
3130         Rename HKDF_CTR to HKDF.
3131         * bindings/js/JSSubtleCryptoCustom.cpp:
3132         (WebCore::normalizeCryptoAlgorithmParameters):
3133         * bindings/js/SerializedScriptValue.cpp:
3134         (WebCore::CloneSerializer::write):
3135         (WebCore::CloneDeserializer::read):
3136         Rename HKDF_CTR to HKDF.
3137         * crypto/CommonCryptoUtilities.h:
3138         * crypto/CryptoAlgorithmIdentifier.h:
3139         * crypto/CryptoAlgorithmParameters.h:
3140         * crypto/algorithms/CryptoAlgorithmHKDF.cpp: Added.
3141         (WebCore::CryptoAlgorithmHKDF::create):
3142         (WebCore::CryptoAlgorithmHKDF::identifier):
3143         (WebCore::CryptoAlgorithmHKDF::deriveBits):
3144         (WebCore::CryptoAlgorithmHKDF::importKey):
3145         (WebCore::CryptoAlgorithmHKDF::getKeyLength):
3146         * crypto/algorithms/CryptoAlgorithmHKDF.h: Added.
3147         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp: Added.
3148         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
3149         * crypto/mac/CryptoAlgorithmHKDFMac.cpp: Added.
3150         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
3151         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
3152         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
3153         * crypto/parameters/CryptoAlgorithmHkdfParams.h: Added.
3154         * crypto/parameters/HkdfParams.idl: Added.
3155
3156 2017-04-14  Zalan Bujtas  <zalan@apple.com>
3157
3158         text-align start / end failure in table cells
3159         https://bugs.webkit.org/show_bug.cgi?id=141417
3160         <rdar://problem/31051672>
3161
3162         Reviewed by Antti Koivisto.
3163
3164         Apply "text-align: center" on th elements when parent's computed value for the 'text-align' property
3165         is its initial value, unless it is explicitly set.
3166
3167         Test: fast/table/center-th-when-parent-has-initial-text-align.html
3168
3169         * css/CSSProperties.json:
3170         * css/StyleBuilderCustom.h:
3171         (WebCore::StyleBuilderCustom::applyInitialTextAlign):
3172         (WebCore::StyleBuilderCustom::applyValueTextAlign):
3173         * css/StyleResolver.cpp:
3174         (WebCore::StyleResolver::adjustRenderStyle):
3175         (WebCore::StyleResolver::applyProperty):
3176         * rendering/style/RenderStyle.h:
3177         (WebCore::RenderStyle::hasExplicitlySetTextAlign):
3178         (WebCore::RenderStyle::setHasExplicitlySetTextAlign):
3179         (WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetTextAlign):
3180         (WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetTextAlign):
3181
3182 2017-04-14  Andy Estes  <aestes@apple.com>
3183
3184         [ios-simulator] API test WebKit2.DataDetectionReferenceDate timing out
3185         https://bugs.webkit.org/show_bug.cgi?id=161967
3186
3187         Reviewed by Alexey Proskuryakov.
3188
3189         DataDetectorsCoreSPI.h defined DDQueryOffset as a struct of two CFIndexes, which is 16 bytes
3190         on LP64, but the struct is actually defined as two CFIndex-typed 32-bit bitfields, which is
3191         8 bytes on LP64. This breaks the ABI on Public SDK builds when calling functions that take
3192         or return DDQueryOffsets.
3193
3194         * platform/spi/cocoa/DataDetectorsCoreSPI.h: Updated the DDQueryOffset definition for
3195         Public SDK builds, and added a static_assert to detect future size changes at compile time.
3196
3197 2017-04-14  Konstantin Tokarev  <annulen@yandex.ru>
3198
3199         Removed unused and unimplemented methods from MediaPlayer
3200         https://bugs.webkit.org/show_bug.cgi?id=170848
3201
3202         Reviewed by Jer Noble.
3203
3204         No new tests needed.
3205
3206         * platform/graphics/MediaPlayer.h:
3207
3208 2017-04-14  Myles C. Maxfield  <mmaxfield@apple.com>
3209
3210         Add performance test for asking the platform for a font for U+2060 WORD JOINER
3211         https://bugs.webkit.org/show_bug.cgi?id=170842
3212
3213         Reviewed by Tim Horton.
3214
3215         No new tests because there is no behavior change.
3216
3217         * platform/graphics/WidthCache.h:
3218         (WebCore::WidthCache::add):
3219         (WebCore::WidthCache::addSlowCase):
3220
3221 2017-04-14  Ryan Haddad  <ryanhaddad@apple.com>
3222
3223         Unreviewed, rolling out r215350.
3224
3225         This change broke the Windows build.
3226
3227         Reverted changeset:
3228
3229         "Remove unused SharedBuffer constructor"
3230         https://bugs.webkit.org/show_bug.cgi?id=170828
3231         http://trac.webkit.org/changeset/215350
3232
3233 2017-04-14  Jer Noble  <jer.noble@apple.com>
3234
3235         [MediaSource] Push capabilities across process boundary during UIProcess capture.
3236         https://bugs.webkit.org/show_bug.cgi?id=170814
3237
3238         Reviewed by Eric Carlson.
3239
3240         There's no real reason for RealtimeMediaSourceCapabilities to be RefCounted nor to keep them from
3241         being created on the stack. So in addition to making that class coder-compliant, change all the
3242         classes that vend capabilities to use a unique_ptr<> instead of a RefPtr<>.
3243
3244         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
3245         * Modules/webaudio/MediaStreamAudioSource.cpp:
3246         (WebCore::MediaStreamAudioSource::capabilities):
3247         * Modules/webaudio/MediaStreamAudioSource.h:
3248         * platform/mediastream/MediaEndpoint.cpp:
3249         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3250         (WebCore::MediaStreamTrackPrivate::capabilities):
3251         * platform/mediastream/MediaStreamTrackPrivate.h:
3252         * platform/mediastream/RealtimeMediaSource.h:
3253         * platform/mediastream/RealtimeMediaSourceCapabilities.h:
3254         (WebCore::CapabilityValueOrRange::encode):
3255         (WebCore::CapabilityValueOrRange::decode):
3256         (WebCore::RealtimeMediaSourceCapabilities::RealtimeMediaSourceCapabilities):
3257         (WebCore::RealtimeMediaSourceCapabilities::supportedConstraints):
3258         (WebCore::RealtimeMediaSourceCapabilities::setSupportedConstraints):
3259         (WebCore::RealtimeMediaSourceCapabilities::encode):
3260         (WebCore::RealtimeMediaSourceCapabilities::decode):
3261         (WebCore::RealtimeMediaSourceCapabilities::create): Deleted.
3262         * platform/mediastream/RealtimeMediaSourceSettings.h:
3263         * platform/mediastream/mac/AVMediaCaptureSource.h:
3264         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3265         (WebCore::AVMediaCaptureSource::initializeCapabilities):
3266         (WebCore::AVMediaCaptureSource::capabilities):
3267         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3268         (WebCore::CoreAudioCaptureSource::capabilities):
3269         * platform/mediastream/mac/CoreAudioCaptureSource.h:
3270         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
3271         (WebCore::RealtimeIncomingAudioSource::capabilities):
3272         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
3273         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
3274         (WebCore::RealtimeIncomingVideoSource::capabilities):
3275         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
3276         * platform/mock/MockRealtimeMediaSource.cpp:
3277         (WebCore::MockRealtimeMediaSource::initializeCapabilities):
3278         (WebCore::MockRealtimeMediaSource::capabilities):
3279         * platform/mock/MockRealtimeMediaSource.h:
3280         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
3281
3282 2017-04-13  Saam Barati  <sbarati@apple.com>
3283
3284         WebAssembly: We should be able to postMessage a JSWebAssemblyModule
3285         https://bugs.webkit.org/show_bug.cgi?id=170573
3286
3287         Reviewed by Filip Pizlo.
3288
3289         This patch's main purpose is to implement postMessage of JSWebAssemblyModule.
3290         The spec text describing the behavior is: https://github.com/WebAssembly/design/blob/master/JS.md#structured-clone-of-a-webassemblymodule
3291         We only allow for JSWebAssemblyModule to be serialized in the postMessage
3292         context. More work needs to be done to make it valid to store a module in
3293         IndexDB.
3294         
3295         All that is needed to serialize a JSWebAssemblyModule is grab a Ref
3296         to its underlying Wasm::Module. So, when doing a postMessage, all we
3297         do is grab this Ref, and then re-create the JSWebAssemblyModule from
3298         the Wasm::Module in the new VM/global object. Because the code for
3299         Wasm::Module is VM-independent, this is all that's needed. This turned
3300         out nicely, because it requires little knowledge from WebCore about
3301         what it means to clone a JSWebAssemblyModule.
3302         
3303         
3304         The second significant part of this patch is teaching WorkerRunLoop about
3305         the various timers inside JSC. Before, the WorkerRunLoop wouldn't always
3306         wake up to address JSC timers. I noticed this bug when I was writing
3307         tests to make sure that Wasm was running concurrently in different
3308         workers. The bug is that the WorkerRunLoop's message queue has no insight
3309         into a timer being scheduled. This effected the PromiseDeferredTimer that
3310         Wasm uses, as well as the various GC timers that Heap uses. Now, WorkerRunLoop
3311         will set itself up to be notified when timers are set. When a timer is
3312         set, the WorkerRunLoop will perform an iteration to to reset its top
3313         level MessageQueue timeout to be no longer than the next timer fire date.
3314
3315         Tests: storage/indexeddb/wasm-exceptions.html
3316                workers/wasm-hashset-many.html
3317                workers/wasm-hashset.html
3318                workers/wasm-long-compile-many.html
3319                workers/wasm-long-compile.html
3320
3321         * ForwardingHeaders/heap/GCActivityCallback.h: Added.
3322         * ForwardingHeaders/runtime/JSRunLoopTimer.h: Added.
3323         * ForwardingHeaders/runtime/PromiseDeferredTimer.h: Added.
3324         * ForwardingHeaders/wasm: Added.
3325         * ForwardingHeaders/wasm/js: Added.
3326         * ForwardingHeaders/wasm/js/JSWebAssemblyModule.h: Added.
3327         * bindings/js/SerializedScriptValue.cpp:
3328         (WebCore::CloneSerializer::serialize):
3329         (WebCore::CloneSerializer::CloneSerializer):
3330         (WebCore::CloneSerializer::dumpIfTerminal):
3331         (WebCore::CloneDeserializer::deserialize):
3332         (WebCore::CloneDeserializer::CloneDeserializer):
3333         (WebCore::CloneDeserializer::readTerminal):
3334         (WebCore::SerializedScriptValue::SerializedScriptValue):
3335         (WebCore::SerializedScriptValue::create):
3336         (WebCore::SerializedScriptValue::deserialize):
3337         * bindings/js/SerializedScriptValue.h:
3338         * bindings/js/WorkerScriptController.cpp:
3339         (WebCore::WorkerScriptController::addTimerSetNotification):
3340         (WebCore::WorkerScriptController::removeTimerSetNotification):
3341         * bindings/js/WorkerScriptController.h:
3342         * workers/WorkerRunLoop.cpp:
3343         (WebCore::WorkerRunLoop::runInMode):
3344
3345 2017-04-13  Dean Jackson  <dino@apple.com>
3346
3347         Large negative animation-delays may not work depending on machine uptime
3348         https://bugs.webkit.org/show_bug.cgi?id=166962
3349         <rdar://problem/30091526>
3350
3351         Reviewed by Tim Horton.
3352
3353         If you set a really negative animation delay, it would cause
3354         AnimationBase::m_startTime to become negative, because the delay
3355         value was "bigger" than monotonicallyIncreasingTime.
3356
3357         However, the state machine was using -1 to mean that the start time
3358         hadn't yet been set. Classic cmarrin!
3359
3360         Replace all the special values with std::optional, and use nullopt
3361         to mean the value doesn't exist yet.
3362
3363         Test: animations/large-negative-delay.html
3364
3365         * page/animation/AnimationBase.cpp:
3366         (WebCore::AnimationBase::updateStateMachine):
3367         (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
3368         (WebCore::AnimationBase::getTimeToNextEvent):
3369         (WebCore::AnimationBase::freezeAtTime):
3370         (WebCore::AnimationBase::getElapsedTime):
3371         * page/animation/AnimationBase.h: Use std::optional.
3372         (WebCore::AnimationBase::paused):
3373
3374 2017-04-13  Alex Christensen  <achristensen@webkit.org>
3375
3376         Remove unused SharedBuffer constructor
3377         https://bugs.webkit.org/show_bug.cgi?id=170828
3378
3379         Reviewed by Brady Eidson.
3380
3381         * platform/SharedBuffer.cpp:
3382         (WebCore::SharedBuffer::append):
3383         * platform/SharedBuffer.h:
3384         (WebCore::SharedBuffer::create):
3385
3386 2017-04-13  Antti Koivisto  <antti@apple.com>
3387
3388         Don't invalidate composition for style changes in non-composited layers
3389         https://bugs.webkit.org/show_bug.cgi?id=170805
3390         <rdar://problem/31606185>
3391
3392         Reviewed by Simon Fraser.
3393
3394         Test: compositing/updates/animation-non-composited.html
3395
3396         In most cases they can't affect composition. Composition updates are expensive, this can
3397         save a lot of work (tumblr.com animations hit this at the moment).
3398
3399         * rendering/RenderElement.h:
3400         (WebCore::RenderElement::createsGroup):
3401         (WebCore::RenderElement::createsGroupForStyle):
3402
3403             Factor to a static function so we can test style directly.
3404
3405         * rendering/RenderLayerCompositor.cpp:
3406         (WebCore::RenderLayerCompositor::layerStyleChanged):
3407         (WebCore::RenderLayerCompositor::styleChangeMayAffectIndirectCompositingReasons):
3408
3409             Test if style change might cause compositing change that can't be determined without compositing update.
3410
3411         * rendering/RenderLayerCompositor.h:
3412
3413 2017-04-13  JF Bastien  <jfbastien@apple.com>
3414
3415         WebAssembly: manage memory better
3416         https://bugs.webkit.org/show_bug.cgi?id=170628
3417
3418         Reviewed by Keith Miller, Michael Saboff.
3419
3420         Re-use a VM tag which was intended for JavaScript core, was then
3421         used by our GC, and is now unused. If I don't do this then
3422         WebAssembly fast memories will make vmmap look super weird because
3423         it'll look like multi-gigabyte of virtual memory are allocated as
3424         part of our process' regular memory!
3425
3426         Separately I need to update vmmap and other tools to print the
3427         right name. Right now this tag gets identified as "JS garbage
3428         collector".
3429
3430         * page/ResourceUsageData.cpp:
3431         (WebCore::ResourceUsageData::ResourceUsageData):
3432         * page/ResourceUsageData.h:
3433         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3434         (WebCore::HistoricResourceUsageData::HistoricResourceUsageData):
3435         * page/cocoa/ResourceUsageThreadCocoa.mm:
3436         (WebCore::displayNameForVMTag):
3437         (WebCore::categoryForVMTag):
3438
3439 2017-04-13  Ryosuke Niwa  <rniwa@webkit.org>
3440
3441         Update the comments for the number of bits in RenderStyle::InheritedFlags.
3442
3443         Rubber-stamped by Zalan Bujtas
3444
3445         * rendering/style/RenderStyle.h:
3446
3447 2017-04-13  Myles C. Maxfield  <mmaxfield@apple.com>
3448
3449         Addressing post-review comment after r215314.
3450         https://bugs.webkit.org/show_bug.cgi?id=169015
3451
3452         Reviewed by Alexey Proskuryakov.
3453
3454         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3455         (WebCore::FontDatabase::fontForPostScriptName):
3456
3457 2017-04-13  Sam Weinig  <sam@webkit.org>
3458
3459         [WebIDL] Add support for extended attributes on types in WebIDL
3460         https://bugs.webkit.org/show_bug.cgi?id=170759
3461
3462         Reviewed by Alex Christensen.
3463
3464         - Update parsing for WebIDL grammar changes.
3465         - Adds an extended attributes hash to IDLType that is filled according
3466           to the WebIDL annotated type rules.
3467         - Updates code generation to take advantage of IDLType's extended attribute
3468           simplifying some existing code.
3469         - Update IDLs in the project to adhere to the new grammar.
3470           
3471         * Modules/indexeddb/IDBFactory.idl:
3472         * Modules/indexeddb/IDBIndex.idl:
3473         * Modules/indexeddb/IDBKeyRange.idl:
3474         * Modules/indexeddb/IDBObjectStore.idl:
3475         * Modules/websockets/WebSocket.idl:
3476         * crypto/parameters/AesCtrParams.idl:
3477         * crypto/parameters/AesKeyParams.idl:
3478         * crypto/parameters/Pbkdf2Params.idl:
3479         * crypto/parameters/RsaKeyGenParams.idl:
3480         * testing/TypeConversions.idl:
3481         Update for grammar change.
3482
3483         * bindings/scripts/CodeGeneratorJS.pm:
3484         (GenerateDefaultValue):
3485         (GetBaseIDLType):
3486         (GetIDLType):
3487         (GetIntegerConversionConfiguration):
3488         (GetStringConversionConfiguration):
3489         (JSValueToNative):
3490         (UnsafeToNative):
3491         (NativeToJSValueDOMConvertNeedsState):
3492         (NativeToJSValueDOMConvertNeedsGlobalObject):
3493         (NativeToJSValue):
3494         Remove the need for the type's context in many places since type
3495