AX: Improve performance of addChildren()/childrenChanged()
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-04-29  Nan Wang  <n_wang@apple.com>
2
3         AX: Improve performance of addChildren()/childrenChanged()
4         https://bugs.webkit.org/show_bug.cgi?id=171443
5
6         Reviewed by Chris Fleizach.
7
8         There's a lot of unnecessary work happening when childrenChanged() is being called.
9         Some of the improvements here:
10         1. When childrenChanged() is being called on some element, we are marking its parent
11            chain dirty. However, in the addChild() method we are then clearing each child of
12            that 'dirty' parent, eventually making the entire tree dirty. 
13            Added a m_subTreeDirty flag and using the needsToUpdateChildren() check to make sure
14            we are only clearing the right chain without updating the unchanged siblings.
15         2. In the addChild() method we are calling accessibilityIsIgnored() on each child and that 
16            might lead to going up the parent chain again to get necessary information. 
17            Since we are already traversing the tree from top to bottom to add children, added a 
18            struct to store the information and pass it to the child so to avoid unnecessary traversal.
19         3. Reduced the amount work of ARIA text controls perform when updating its parents in childrenChanged() 
20            so that we don't update a big portion of the tree while typing.
21
22         No new tests since this didn't change any functionality. 
23
24         * accessibility/AccessibilityNodeObject.cpp:
25         (WebCore::AccessibilityNodeObject::AccessibilityNodeObject):
26         (WebCore::AccessibilityNodeObject::childrenChanged):
27         (WebCore::AccessibilityNodeObject::insertChild):
28         (WebCore::AccessibilityNodeObject::addChildren):
29         (WebCore::AccessibilityNodeObject::isDescendantOfBarrenParent):
30         * accessibility/AccessibilityNodeObject.h:
31         * accessibility/AccessibilityObject.cpp:
32         (WebCore::AccessibilityObject::AccessibilityObject):
33         (WebCore::AccessibilityObject::defaultObjectInclusion):
34         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
35         * accessibility/AccessibilityObject.h:
36         (WebCore::AccessibilityIsIgnoredFromParentData::AccessibilityIsIgnoredFromParentData):
37         (WebCore::AccessibilityIsIgnoredFromParentData::isNull):
38         (WebCore::AccessibilityObject::setNeedsToUpdateSubTree):
39         (WebCore::AccessibilityObject::needsToUpdateChildren):
40         (WebCore::AccessibilityObject::setIsIgnoredFromParentData):
41         * accessibility/AccessibilityRenderObject.cpp:
42         (WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
43         (WebCore::AccessibilityRenderObject::addChildren):
44         * accessibility/AccessibilityRenderObject.h:
45         (WebCore::AccessibilityRenderObject::setRenderObject):
46         (WebCore::AccessibilityRenderObject::needsToUpdateChildren): Deleted.
47
48 2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
49
50         Move WebCore CPUTime to WTF and implement it in all the platforms
51         https://bugs.webkit.org/show_bug.cgi?id=171477
52
53         Reviewed by Chris Dumez.
54
55         Move CPUTime to WTF. And rename getCPUTime to CPUTime::get().
56
57         * CMakeLists.txt:
58         * PlatformMac.cmake:
59         * WebCore.xcodeproj/project.pbxproj:
60         * page/ChromeClient.h:
61         * page/PerformanceMonitor.cpp:
62         (WebCore::PerformanceMonitor::PerformanceMonitor):
63         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
64         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
65         (WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
66         * page/PerformanceMonitor.h:
67         * platform/CPUMonitor.cpp:
68         (WebCore::CPUMonitor::setCPULimit):
69         (WebCore::CPUMonitor::timerFired):
70         * platform/CPUMonitor.h:
71
72 2017-04-28  Per Arne Vollan  <pvollan@apple.com>
73
74         Crash under WebCore::AccessibilityRenderObject::handleAriaExpandedChanged().
75         https://bugs.webkit.org/show_bug.cgi?id=171427
76         rdar://problem/31863417
77
78         Reviewed by Brent Fulgham.
79
80         The AccessibilityRenderObject object might delete itself in handleAriaExpandedChanged() under the call
81         to the parentObject() method. This will cause a crash when accessing the object later in this method.
82         Protect the current object while executing arbitrary event code.
83
84         Test: accessibility/accessibility-crash-setattribute.html
85
86         * accessibility/AccessibilityRenderObject.cpp:
87         (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
88
89 2017-04-28  Chris Dumez  <cdumez@apple.com>
90
91         Diagnostic logging of navigations is too verbose
92         https://bugs.webkit.org/show_bug.cgi?id=171455
93         <rdar://problem/31543815>
94
95         Reviewed by Andreas Kling.
96
97         Diagnostic logging of navigation is too verbose. We log things that are not actually user
98         navigations (e.g. speculative loads, bookmark icon fetches, ...). To address the issue,
99         we now only log *observable* loads. We do so by only logging if the page is visible or
100         if it becomes visible.
101
102         * loader/FrameLoader.cpp:
103         (WebCore::FrameLoader::loadWithDocumentLoader):
104         (WebCore::logNavigation): Deleted.
105         * page/Page.cpp:
106         (WebCore::Page::setIsVisibleInternal):
107         (WebCore::Page::logNavigation):
108         (WebCore::Page::mainFrameLoadStarted):
109         * page/Page.h:
110
111 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
112
113         AX: ARIA "region" role which lacks an accessible name should not be treated as a landmark
114         https://bugs.webkit.org/show_bug.cgi?id=171180
115
116         Reviewed by Chris Fleizach.
117
118         Remove mapping of LandmarkRegionRole for regions which lack an accessible name.
119         Doing so had a side effect of causing a number of DPub ARIA roles to stop being
120         mapped as ARIA landmarks. This is due to our internal role mappings, namely
121         treating the DPub ARIA landmark roles as if they were regions. Because DPub's
122         landmarks do not subclass region, and do not have the same name-from-author
123         requirement as region, create a new LandmarkDocRegionRole AccessibilityRole and
124         map DPub ARIA's generic landmarks to it.
125
126         No new tests because we already have sufficient coverage. Several existing
127         tests were given additional test cases to cover named and unnamed regions,
128         and test expectations updated accordingly.
129
130         * accessibility/AccessibilityNodeObject.cpp:
131         (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute):
132         * accessibility/AccessibilityObject.cpp:
133         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
134         (WebCore::AccessibilityObject::isLandmark):
135         (WebCore::initializeRoleMap):
136         (WebCore::AccessibilityObject::computedRoleString):
137         * accessibility/AccessibilityObject.h:
138         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
139         (atkRole):
140         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
141         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
142         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
143         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
144         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
145         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
146         (createAccessibilityRoleMap):
147         (-[WebAccessibilityObjectWrapper subrole]):
148
149 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
150
151         Enhance showLayerTree() to show fragments
152         https://bugs.webkit.org/show_bug.cgi?id=171469
153
154         Reviewed by Zalan Bujtas.
155
156         Have showLayerTree() dump fragments, like:
157
158              normal flow list(1)
159               layer 0x11c1879c0 at (0,0) size 700x1858 backgroundClip at (0,0) size 2120x779 clip at (0,0) size 2120x779
160                    fragment 0: bounds in layer at (0,0) size 700x1858 fragment bounds at (0,0) size 700x779
161                    fragment 1: bounds in layer at (710,-779) size 700x1858 fragment bounds at (710,0) size 700x779
162                    fragment 2: bounds in layer at (1420,-1558) size 700x1858 fragment bounds at (1420,0) size 700x300
163                 RenderMultiColumnFlowThread 0x11f1f3340 at (0,0) size 700x1858
164
165         We want these to show before the child renderers, so factor that code into writeLayerRenderers().
166         
167         Overloading of write() for layers doesn't help anyone, so call it writeLayer() for searchability.
168
169         * rendering/RenderLayer.cpp:
170         (WebCore::showLayerTree):
171         * rendering/RenderLayer.h:
172         * rendering/RenderTreeAsText.cpp:
173         (WebCore::writeLayer):
174         (WebCore::writeLayerRenderers):
175         (WebCore::writeLayers):
176         * rendering/RenderTreeAsText.h:
177
178 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
179
180         Modernize RenderTreeAsText code
181         https://bugs.webkit.org/show_bug.cgi?id=171458
182
183         Reviewed by Zalan Bujtas.
184
185         Use modern loops. More references to render objects and layers.
186
187         * rendering/RenderTreeAsText.cpp:
188         (WebCore::write):
189         (WebCore::writeRenderNamedFlowThreads):
190         (WebCore::writeLayers):
191         (WebCore::writeSelection):
192         (WebCore::externalRepresentation):
193
194 2017-04-28  Wenson Hsieh  <wenson_hsieh@apple.com>
195
196         Fix and re-enable data interaction unit tests
197         https://bugs.webkit.org/show_bug.cgi?id=171446
198         <rdar://problem/31820646>
199
200         Reviewed by Tim Horton.
201
202         Three small tweaks to get all data interaction tests passing again (changes detailed below).
203         Fixes a failing unit test: DataInteractionTests.RespectsExternalSourceFidelityRankings.
204
205         * page/mac/DragControllerMac.mm:
206
207         When dropping in a plain text editable area, don't consider kUTTypeText to be a UTI supported by the destination.
208         This is because doing so would cause rich text UTIs, such as kUTTypeHTML, to match, so that the plain text area
209         would report HTML as a preferred UTI type to load when dropping rich content over it. What we want to check for
210         conformance here is really kUTTypePlainText.
211
212         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
213         * platform/Pasteboard.h:
214         * platform/ios/PasteboardIOS.mm:
215
216         The default Pasteboard constructor no longer makes a sync call to the UI process to get the change count.
217         Instead, we introduce a new constructor that takes and sets the change count. This default constructor was used
218         from three places: Pasteboard::createForCopyAndPaste, Pasteboard::createPrivate and StaticPasteboard::create.
219
220         The first two call sites have been refactored to first fetch the change count from the UI process and then pass
221         it in to the constructor.
222
223         (WebCore::changeCountForPasteboard):
224         (WebCore::Pasteboard::Pasteboard):
225         (WebCore::Pasteboard::createForCopyAndPaste):
226         (WebCore::Pasteboard::createPrivate):
227         (WebCore::Pasteboard::readString):
228         (WebCore::Pasteboard::types):
229         * platform/mac/DragDataMac.mm:
230         (WebCore::typeIsAppropriateForSupportedTypes):
231         (WebCore::DragData::updatePreferredTypeIdentifiers):
232
233         Remove the two-pass heuristic. Instead, we should follow this policy: "select the highest fidelity UTI that
234         conforms to one of the destination's supported types".
235
236         * platform/mac/PasteboardMac.mm:
237         (WebCore::Pasteboard::Pasteboard):
238
239 2017-04-28  Dean Jackson  <dino@apple.com>
240
241         App crashing: Dispatch queue: com.apple.root.user-interactive-qos / vBoxConvolve / WebCore::FEGaussianBlur::platformApplySoftware()
242         https://bugs.webkit.org/show_bug.cgi?id=171461
243         <rdar://problem/30534722>
244
245         Reviewed by Eric Carlson.
246
247         We're getting reports of crashes in this function, caused by null or empty data being
248         passed to vImage. Guard against this, in a way that will ASSERT in debug builds if
249         anyone comes across it.
250
251         Test: css3/filters/blur-various-radii.html
252
253         * platform/graphics/filters/FEGaussianBlur.cpp:
254         (WebCore::accelerateBoxBlur): Return early if things don't look good.
255
256 2017-04-28  Chris Dumez  <cdumez@apple.com>
257
258         Stop using legacy ClientRect / ClientRectList in Internals
259         https://bugs.webkit.org/show_bug.cgi?id=171412
260
261         Reviewed by Simon Fraser.
262
263         Stop using legacy ClientRect / ClientRectList in Internals amd use the
264         newer DOMRect instead.
265
266         * dom/DOMRect.idl:
267         * page/Page.cpp:
268         (WebCore::Page::nonFastScrollableRects):
269         (WebCore::Page::touchEventRectsForEvent):
270         (WebCore::Page::passiveTouchEventListenerRects):
271         * page/Page.h:
272         * testing/Internals.cpp:
273         (WebCore::Internals::absoluteCaretBounds):
274         (WebCore::Internals::boundingBox):
275         (WebCore::Internals::inspectorHighlightRects):
276         (WebCore::Internals::layoutViewportRect):
277         (WebCore::Internals::visualViewportRect):
278         (WebCore::Internals::touchEventRectsForEvent):
279         (WebCore::Internals::passiveTouchEventListenerRects):
280         (WebCore::Internals::nonFastScrollableRects):
281         (WebCore::Internals::selectionBounds):
282         * testing/Internals.h:
283         * testing/Internals.idl:
284
285 2017-04-28  Youenn Fablet  <youenn@apple.com>
286
287         getUserMedia video streams should follow device orientation
288         https://bugs.webkit.org/show_bug.cgi?id=171284
289
290         Reviewed by Eric Carlson.
291
292         Only really affects AVVideoCaptureSource on iOS. Manually testing the following cases:
293         - Mac: no change of behavior
294         - iOS: page loaded in portrait, video is portrait. page loaded in landscape, video is landscape
295         - iOS: changing the device orientation makes the video samples to be moved to landscape/portrait.
296         - Same tests as above with peer connection.
297
298         Making Document having an OrientationNotifier that AVVideoCaptureSources get registered to.
299         Making AVVideoCaptureSource an OrientationNotifier::Observer so that it can changes width/height if needed.
300
301         Refactoring to specialize CaptureFactory in VideoCaptureFactory and AudioCaptureFactory.
302         Refactoring to return a CaptureSourceOrError instead of passing an out parameter plus returning a RefPtr.
303
304         * Modules/mediastream/UserMediaRequest.cpp:
305         (WebCore::UserMediaRequest::allow):
306         * WebCore.xcodeproj/project.pbxproj:
307         * dom/Document.cpp:
308         (WebCore::Document::orientationChanged):
309         * dom/Document.h:
310         * page/Frame.cpp:
311         (WebCore::Frame::orientationChanged):
312         * platform/OrientationNotifer.h: Copied from Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h.
313         (WebCore::OrientationNotifier::Observer::setNotifier):
314         (WebCore::OrientationNotifier::Observer::~Observer):
315         (WebCore::OrientationNotifier::orientationChanged):
316         (WebCore::OrientationNotifier::addObserver):
317         (WebCore::OrientationNotifier::removeObserver):
318         * platform/mediastream/MediaStreamPrivate.cpp:
319         (WebCore::MediaStreamPrivate::monitorOrientation):
320         * platform/mediastream/MediaStreamPrivate.h:
321         * platform/mediastream/RealtimeMediaSource.h:
322         (WebCore::CaptureSourceOrError::CaptureSourceOrError):
323         (WebCore::CaptureSourceOrError::operator bool):
324         (WebCore::CaptureSourceOrError::source):
325         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
326         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
327         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
328         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
329         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
330         * platform/mediastream/RealtimeMediaSourceCenter.h:
331         (WebCore::RealtimeMediaSourceCenter::defaultAudioFactory):
332         (WebCore::RealtimeMediaSourceCenter::defaultVideoFactory):
333         (WebCore::RealtimeMediaSourceCenter::audioFactory):
334         (WebCore::RealtimeMediaSourceCenter::videoFactory):
335         * platform/mediastream/mac/AVAudioCaptureSource.h:
336         * platform/mediastream/mac/AVAudioCaptureSource.mm:
337         (WebCore::AVAudioCaptureSource::create):
338         (WebCore::AVAudioCaptureSource::factory):
339         * platform/mediastream/mac/AVVideoCaptureSource.h:
340         * platform/mediastream/mac/AVVideoCaptureSource.mm:
341         (WebCore::AVVideoCaptureSource::create):
342         (WebCore::AVVideoCaptureSource::factory):
343         (WebCore::AVVideoCaptureSource::monitorOrientation):
344         (WebCore::AVVideoCaptureSource::orientationChanged):
345         (WebCore::AVVideoCaptureSource::processNewFrame):
346         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
347         (WebCore::CoreAudioCaptureSource::create):
348         (WebCore::CoreAudioCaptureSource::factory):
349         * platform/mediastream/mac/CoreAudioCaptureSource.h:
350         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
351         (WebCore::MockRealtimeAudioSource::create):
352         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
353         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
354         (WebCore::MockRealtimeVideoSource::create):
355         (WebCore::MockRealtimeVideoSourceMac::orientationChanged):
356         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
357         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
358         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
359         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
360         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
361         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
362         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
363         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
364         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
365         * platform/mock/MockRealtimeAudioSource.cpp:
366         (WebCore::MockRealtimeAudioSource::create):
367         (WebCore::MockRealtimeAudioSource::factory):
368         * platform/mock/MockRealtimeAudioSource.h:
369         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
370         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
371         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
372         (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
373         (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
374         * platform/mock/MockRealtimeMediaSourceCenter.h:
375         * platform/mock/MockRealtimeVideoSource.cpp:
376         (WebCore::MockRealtimeVideoSource::create):
377         (WebCore::MockRealtimeVideoSource::factory):
378         * platform/mock/MockRealtimeVideoSource.h:
379
380 2017-04-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
381
382         Unify how BitmapImage handles the availability of a decoded for large and animated images
383         https://bugs.webkit.org/show_bug.cgi?id=171410
384
385         Reviewed by Simon Fraser.
386
387         Rename some functions which are related to animation frame availability.
388         Make BitmapImage call ImageObserver::imageFrameAvailable() whenever a 
389         frame is available regardless it is for an animated or for a large image.
390
391         * html/HTMLMediaElement.cpp:
392         (WebCore::HTMLMediaElement::isVisibleInViewport):
393         * html/MediaElementSession.cpp:
394         (WebCore::MediaElementSession::autoplayPermitted):
395         (WebCore::isMainContentForPurposesOfAutoplay):
396         * loader/cache/CachedImage.cpp:
397         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
398         (WebCore::CachedImage::imageFrameAvailable):
399         (WebCore::CachedImage::usesImageContainerSize): Deleted.
400         (WebCore::CachedImage::imageHasRelativeWidth): Deleted.
401         (WebCore::CachedImage::imageHasRelativeHeight): Deleted.
402         (WebCore::CachedImage::CachedImageObserver::animationAdvanced): Deleted.
403         (WebCore::CachedImage::animationAdvanced): Deleted.
404         * loader/cache/CachedImage.h:
405         * loader/cache/CachedImageClient.h:
406         (WebCore::CachedImageClient::imageFrameAvailable):
407         (WebCore::CachedImageClient::newImageAnimationFrameAvailable): Deleted.
408         * platform/graphics/BitmapImage.cpp:
409         (WebCore::BitmapImage::internalAdvanceAnimation):
410         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
411         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Deleted.
412         * platform/graphics/BitmapImage.h:
413         * platform/graphics/Image.h:
414         (WebCore::Image::imageFrameAvailableAtIndex):
415         (WebCore::Image::newFrameNativeImageAvailableAtIndex): Deleted.
416         * platform/graphics/ImageFrameCache.cpp:
417         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex):
418         * platform/graphics/ImageObserver.h:
419         * platform/graphics/ImageTypes.h:
420         * rendering/RenderElement.cpp:
421         (WebCore::RenderElement::RenderElement):
422         (WebCore::RenderElement::shouldRepaintInVisibleRect):
423         (WebCore::RenderElement::imageFrameAvailable):
424         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
425         (WebCore::shouldRepaintForImageAnimation): Deleted.
426         (WebCore::RenderElement::newImageAnimationFrameAvailable): Deleted.
427         * rendering/RenderElement.h:
428         * rendering/RenderView.cpp:
429         (WebCore::RenderView::updateVisibleViewportRect):
430         * svg/graphics/SVGImageClients.h:
431
432 2017-04-28  Jeremy Jones  <jeremyj@apple.com>
433
434         ARGUMENT BAD: time, time >= 0
435         https://bugs.webkit.org/show_bug.cgi?id=164336
436         rdar://problem/29314891
437
438         Reviewed by Eric Carlson.
439
440         Handle invalid duration and current time when calculating remaining time.
441
442         Test media/modern-media-controls/pip-support/pip-support-click.html now works without a workaround
443         in media/modern-media-controls/pip-support/pip-support-enabled.html
444
445         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
446         (-[WebVideoFullscreenHUDWindowController remainingTimeText]):
447
448 2017-04-28  Daniel Bates  <dabates@apple.com>
449
450         Add WebCore::protocolIsJavaScript(StringView)
451         https://bugs.webkit.org/show_bug.cgi?id=171396
452
453         Reviewed by Alex Christensen.
454
455         Add an overload of WebCore::protocolIsJavaScript() that takes a StringView to
456         avoid the need for a caller to allocate a new String object when converting
457         from a StringView to a String. We are not using this functionality at the moment,
458         but we will in the patch for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
459
460         No functionality has changed. So, no new tests.
461
462         * platform/URL.cpp: Remove an outdated comment about protocolIs(StringView, const char*).
463         This overload was removed in r212508.
464         (WebCore::protocolIsInternal): Added.
465         (WebCore::protocolIs): Implemented in terms of WebCore::protocolIsInternal().
466         (WebCore::URL::protocolIs): Ditto.
467         (WebCore::protocolIsJavaScript): Added; overload that takes a StringView.
468         (WebCore::mimeTypeFromDataURL): Modified to use WebCore::protocolIsInternal().
469         * platform/URL.h:
470
471 2017-04-28  Andy Estes  <aestes@apple.com>
472
473         [macOS] WebPlaybackControlsManager needs to know when the selected text or audio track changes
474         https://bugs.webkit.org/show_bug.cgi?id=171434
475         <rdar://problem/31887922>
476
477         Reviewed by Eric Carlson.
478
479         * dom/GenericEventQueue.cpp:
480         (WebCore::GenericEventQueue::hasPendingEventsOfType): Added to check if a pending event
481         exists of a certain type.
482         * dom/GenericEventQueue.h:
483         * html/HTMLMediaElement.cpp:
484         (WebCore::HTMLMediaElement::setSelectedTextTrack): Even if no track modes change, fire a
485         change event when the track to select is off or automatic so that
486         WebPlaybackSessionModelMediaElement detects the change.
487         * html/track/TrackListBase.cpp:
488         (TrackListBase::isChangeEventScheduled): Returns true if m_asyncEventQueue has a pending
489         change event.
490         * html/track/TrackListBase.h:
491         * platform/cocoa/WebPlaybackSessionModel.h:
492         (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionIndexChanged):
493         (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionIndexChanged):
494         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
495         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
496         (WebCore::WebPlaybackSessionModelMediaElement::setMediaElement): Registered/unregistered for
497         the change event on the audio and text tracks.
498         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName): Called
499         updateMediaSelectionIndices() when the change event fires.
500         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionOptions): Renamed from
501         updateLegibleOptions().
502         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionIndices): Called
503         audioMediaSelectionIndexChanged() and legibleMediaSelectionIndexChanged() on m_clients with
504         the updated indices.
505         (WebCore::WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex): Fixed a bug
506         where selectedIndex would never be set to offIndex if offIndex is 0 (which it usually is).
507         (WebCore::WebPlaybackSessionModelMediaElement::updateLegibleOptions): Renamed to
508         updateMediaSelectionOptions().
509         * platform/mac/WebPlaybackControlsManager.h:
510         * platform/mac/WebPlaybackControlsManager.mm:
511         (-[WebPlaybackControlsManager setAudioMediaSelectionIndex:]): Set
512         _currentAudioTouchBarMediaSelectionOption to the object at selectedIndex and manually
513         triggered a KVO notification. We can't call -setCurrentAudioTouchBarMediaSelectionOption:
514         here since that will send a message back to the Web process.
515         (-[WebPlaybackControlsManager setLegibleMediaSelectionIndex:]): Ditto for
516         _currentLegibleTouchBarMediaSelectionOption.
517         * platform/mac/WebPlaybackSessionInterfaceMac.h:
518         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
519         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionIndexChanged): Called
520         -[WebPlaybackControlsManager setAudioMediaSelectionIndex:].
521         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionIndexChanged): Called
522         -[WebPlaybackControlsManager setLegibleMediaSelectionIndex:].
523
524 2017-04-28  Chris Dumez  <cdumez@apple.com>
525
526         Range.getClientRects() / getBoundingClientRect() should return DOMRect types
527         https://bugs.webkit.org/show_bug.cgi?id=171393
528
529         Reviewed by Simon Fraser.
530
531         Range.getClientRects() / getBoundingClientRect() should return DOMRect types:
532         - https://drafts.csswg.org/cssom-view/#extensions-to-the-range-interface
533
534         Test: fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html
535
536         * CMakeLists.txt:
537         * WebCore.xcodeproj/project.pbxproj:
538         * dom/DOMRect.cpp: Copied from Source/WebCore/dom/DOMRect.h.
539         (WebCore::createDOMRectVector):
540         * dom/DOMRect.h:
541         * dom/Element.cpp:
542         (WebCore::Element::getClientRects):
543         * dom/Range.cpp:
544         (WebCore::Range::getClientRects):
545         (WebCore::Range::getBoundingClientRect):
546         * dom/Range.h:
547         * dom/Range.idl:
548
549 2017-04-28  Chris Dumez  <cdumez@apple.com>
550
551         Tweak window.open features argument tokenizer to match HTML standard and Edge
552         https://bugs.webkit.org/show_bug.cgi?id=170548
553
554         Reviewed by Geoffrey Garen.
555
556         Update window.open() features argument tokenizer to match HTML standard:
557         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
558
559         Also update window.open() to return null instead of the window when
560         the 'noopener' feature is activated, as per:
561         - https://html.spec.whatwg.org/#dom-open (Step 10)
562
563         No new tests, rebaselined existing test.
564
565         * page/DOMWindow.cpp:
566         (WebCore::DOMWindow::createWindow):
567         Update window.open() to return null instead of the window when
568         the 'noopener' feature is activated, as per:
569         - https://html.spec.whatwg.org/#dom-open (Step 10)
570
571         * page/WindowFeatures.cpp:
572         (WebCore::isSeparator):
573         Treat all ASCII spaces as feature separators, as per:
574         - https://html.spec.whatwg.org/#feature-separator
575         This has the effect of adding U+000C (FormFeed) as a separator.
576
577         (WebCore::processFeaturesString):
578         Align tokenizing code with the specification:
579         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
580         In particular, the following changes were made:
581         - After the key, skip to first '=', but don't skip past a ',' or a non-separator.
582           The "or a non-separator" part is new in the spec (step 3.6.1) and is now implemented.
583         - After looking for the '=', only treat what follows as a value if the current character
584           is a separator. This is as per step 7 in the spec.
585         These changes now cause us to parse 'foo noopener=1' as ('foo', ''), ('noopener', '1').
586
587 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
588
589         Implement ondevicechange
590         https://bugs.webkit.org/show_bug.cgi?id=169872
591
592         Unreviewed, remove some dead code accidentally committed in r215929.
593
594         * platform/mediastream/CaptureDeviceManager.cpp:
595
596 2017-04-28  Chris Dumez  <cdumez@apple.com>
597
598         Update DOMTokenList.replace() to match the latest DOM specification
599         https://bugs.webkit.org/show_bug.cgi?id=171388
600
601         Reviewed by Alex Christensen.
602
603         Update DOMTokenList.replace() to match the latest DOM specification after:
604         - https://github.com/whatwg/dom/issues/442
605         - https://github.com/whatwg/infra/pull/126
606
607         The latest spec text is at:
608         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
609         - https://infra.spec.whatwg.org/#set-replace
610
611         The behavior change in this patch causes (a, b, c).replace(a, c) to return
612         (c, b) instead of (b, c). This new behavior is aligned with Firefox as well.
613
614         No new tests, updated existing test.
615
616         * html/DOMTokenList.cpp:
617         (WebCore::DOMTokenList::replace):
618
619 2017-04-28  Brady Eidson  <beidson@apple.com>
620
621         Start of support for multiple WebsiteDataStore/SessionIDs per process
622         https://bugs.webkit.org/show_bug.cgi?id=171422
623
624         Reviewed by Geoffrey Garen.
625
626         Covered by API tests.
627
628         * platform/network/NetworkStorageSession.h:
629         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
630         (WebCore::NetworkStorageSession::ensureSession):
631         * platform/spi/cf/CFNetworkSPI.h:
632
633 2017-04-28  Chris Dumez  <cdumez@apple.com>
634
635         URLSearchParams should be reflective
636         https://bugs.webkit.org/show_bug.cgi?id=171345
637
638         Reviewed by Alex Christensen.
639
640         There was a bug in our implementation of [1] where we would replace
641         '+' with 0x20 *after* URL-decoding the string, instead of *before*.
642         This was causing us to replace URL-encoded '+' characters with 0x20.
643
644         [1] https://url.spec.whatwg.org/#concept-urlencoded-parser
645
646         No new tests, updated existing test.
647
648         * platform/URLParser.cpp:
649
650 2017-04-28  Youenn Fablet  <youenn@apple.com>
651
652         Adding a runtime flag specific to MediaDevices
653         https://bugs.webkit.org/show_bug.cgi?id=171433
654
655         Reviewed by Geoffrey Garen.
656
657         Covered by existing tests.
658
659         Adding a preference for MediaDevices.
660         Setting media devices runtime flag to false by default.
661         Setting peer connection and media stream flags to true by default.
662         Activating mediaDevices and getUserMedia Navigator properties based on media devices flag.
663
664         * Modules/mediastream/NavigatorMediaDevices.idl:
665         * Modules/mediastream/NavigatorUserMedia.idl:
666         * page/RuntimeEnabledFeatures.cpp:
667         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
668         * page/RuntimeEnabledFeatures.h:
669         (WebCore::RuntimeEnabledFeatures::mediaDevicesEnabled):
670         (WebCore::RuntimeEnabledFeatures::setMediaDevicesEnabled):
671
672 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
673
674         Implement ondevicechange
675         https://bugs.webkit.org/show_bug.cgi?id=169872
676
677         Unreviewed, fix test crash.
678
679         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
680         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): "nextToken" must be static.
681
682 2017-04-28  Dean Jackson  <dino@apple.com>
683
684         [WebGPU] Label MTLCommandQueues with a prefix for internal telemetry
685         https://bugs.webkit.org/show_bug.cgi?id=171441
686         <rdar://problem/31826915>
687
688         Reviewed by Tim Horton.
689
690         Prefix any label that is set by the WebGPU API so that
691         our telemetry can identify the use. Don't expose that
692         prefix to the API though.
693
694         New API Test: GPUCommandQueue
695
696         * platform/graphics/cocoa/GPUCommandQueueMetal.mm:
697         (WebCore::GPUCommandQueue::GPUCommandQueue):
698         (WebCore::GPUCommandQueue::label):
699         (WebCore::GPUCommandQueue::setLabel):
700
701 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
702
703         [ATK] aria-modal="true" should be exposed via ATK_STATE_MODAL
704         https://bugs.webkit.org/show_bug.cgi?id=171188
705
706         Reviewed by Chris Fleizach.
707
708         Include ATK_STATE_MODAL in the AtkObject's state set if the accessible
709         element's node is the current ARIA modal node.
710
711         Test: accessibility/gtk/aria-modal-state-exposed.html
712
713         * accessibility/AccessibilityObject.cpp:
714         (WebCore::AccessibilityObject::isAriaModalNode):
715         * accessibility/AccessibilityObject.h:
716         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
717         (setAtkStateSetFromCoreObject):
718
719 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
720
721         Implement ondevicechange
722         https://bugs.webkit.org/show_bug.cgi?id=169872
723         <rdar://problem/28945035>
724
725         Reviewed by Jer Noble.
726
727         Test: fast/mediastream/device-change-event.html
728
729         * Modules/mediastream/MediaDevices.cpp:
730         (WebCore::MediaDevices::MediaDevices): Register for devicechange callbacks.
731         (WebCore::MediaDevices::~MediaDevices): Unregister.
732         (WebCore::MediaDevices::scheduledEventTimerFired):
733         * Modules/mediastream/MediaDevices.h:
734         * Modules/mediastream/MediaDevices.idl:
735
736         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
737         (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): Remove unnecessary instance variables.
738         * Modules/mediastream/MediaDevicesEnumerationRequest.h:
739
740         * Modules/mediastream/MediaDevicesRequest.cpp:
741         (WebCore::MediaDevicesRequest::start): Remove m_idHashSalt, it isn't used. RealtimeMediaSourceCenter
742         now has the method to hash ids and group IDs.
743         (WebCore::hashString): Deleted.
744         (WebCore::MediaDevicesRequest::hashID): Deleted.
745         * Modules/mediastream/MediaDevicesRequest.h:
746
747         * dom/Document.h:
748         (WebCore::Document::setDeviceIDHashSalt):
749         (WebCore::Document::deviceIDHashSalt):
750
751         * dom/EventNames.h: Add devicechange.
752
753         * dom/EventTargetFactory.in: Add MediaDevices.
754
755         * html/HTMLAttributeNames.in: Add ondevicechange.
756
757         * platform/mediastream/CaptureDeviceManager.cpp:
758         (WebCore::CaptureDeviceManager::captureDeviceFromPersistentID): Renamed from captureDeviceFromDeviceID
759         and changed to return a std::optional<CaptureDevice>.
760         (WebCore::CaptureDeviceManager::captureDeviceFromDeviceID): Deleted.
761
762         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
763         (WebCore::addStringToSHA): New, add string bytes to SHA1. Moved from MediaDevicesRequest
764         so we can use for in testing.
765         (WebCore::RealtimeMediaSourceCenter::hashStringWithSalt): Generate hash for a string with a
766         salt. Moved from MediaDevicesRequest so we can use for in testing.
767         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithUniqueID): Find a CaptureDevice given 
768         a unique ID and the process hash salt.
769         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled): Enable/disable a device. Used for
770         layout tests only.
771         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): Add a devices changed listener.
772         (WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver): Remove a listener.
773         (WebCore::RealtimeMediaSourceCenter::captureDevicesChanged): Notify listeners.
774         * platform/mediastream/RealtimeMediaSourceCenter.h:
775
776         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
777         (WebCore::AVCaptureDeviceManager::addDevicesChangedObserver): Update for change to captureDeviceFromDeviceID.
778
779         * platform/mock/MockRealtimeMediaSource.cpp:
780         (WebCore::MockRealtimeMediaSource::audioDevices): All devices are enabled by default.
781         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
782
783         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
784         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): Drive-by cleanup: use the vector
785         of devices instead of making assumptions about the number.
786         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices): Only include enabled devices.
787         (WebCore::MockRealtimeMediaSourceCenter::setDeviceEnabled): Enable or disable a device.
788         * platform/mock/MockRealtimeMediaSourceCenter.h:
789
790         * testing/Internals.cpp:
791         (WebCore::Internals::setMediaDeviceState): Enable or disable a mock capture device.
792         * testing/Internals.h:
793         * testing/Internals.idl:
794
795 2017-04-28  Alex Christensen  <achristensen@webkit.org>
796
797         Fix memory corruption issue after r215883.
798         https://bugs.webkit.org/show_bug.cgi?id=171365
799
800         Reviewed by Brady Eidson.
801
802         This fixes a crash when starting WebKit2.
803
804         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
805         (WebCore::NetworkStorageSession::NetworkStorageSession):
806         Initialize m_platformCookieStorage with the default constructor of RetainPtr,
807         then call NetworkStorageSession::cookieStorage which checks m_platformCookieStorage
808         for null.  It was checking uninitialized memory when we had m_platformCookieStorage
809         in the initializer list.
810
811 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
812
813         AX: Implement aria-value support for focusable separators
814         https://bugs.webkit.org/show_bug.cgi?id=171169
815
816         Reviewed by Chris Fleizach.
817
818         Add SplitterRole to the roles which support range value and are considered a range
819         control, as long as the SplitterRole element is focusable. Also replace ATK's role-
820         based check with a call to supportsRangeValue() when determining if the AtkValue
821         interface should be implemented.
822
823         Test: accessibility/separator-values.html
824
825         * accessibility/AccessibilityObject.cpp:
826         (WebCore::AccessibilityObject::isRangeControl):
827         (WebCore::AccessibilityObject::supportsRangeValue):
828         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
829         (getInterfaceMaskFromObject):
830
831 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
832
833         [ATK] GridCellRole should implement AtkTableCell (regression?)
834         https://bugs.webkit.org/show_bug.cgi?id=171179
835
836         Reviewed by Chris Fleizach.
837
838         Add GridCellRole to the group of roles which should implement AtkTableCell.
839
840         Test: accessibility/gtk/interface-table-cell.html
841
842         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
843         (getInterfaceMaskFromObject):
844
845 2017-04-28  Miguel Gomez  <magomez@igalia.com>
846
847         REGRESSION(r215211): [GTK] Several webgl related tests are failing
848         https://bugs.webkit.org/show_bug.cgi?id=170730
849
850         Reviewed by Said Abou-Hallawa.
851
852         There is a wrong situation in the image decoders where the complete data has been assigned
853         to them but the size of the image hasn't been decoded yet. This is causing rendering
854         issues in webgl when decoding the images used as textures. To fix this, we refactor how the
855         encoded data status is stored to avoid that situation: the status is handled completely
856         by ImageDecoder.h, and it's the one forcing the decode of the size when data gets assigned
857         to the decoders.
858
859         Covered by existent tests.
860
861         * platform/image-decoders/ImageDecoder.h:
862         (WebCore::ImageDecoder::isAllDataReceived):
863         (WebCore::ImageDecoder::setData):
864         (WebCore::ImageDecoder::encodedDataStatus):
865         (WebCore::ImageDecoder::isSizeAvailable):
866         (WebCore::ImageDecoder::setSize):
867         (WebCore::ImageDecoder::setFailed):
868         (WebCore::ImageDecoder::failed):
869         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
870         (WebCore::BMPImageDecoder::frameBufferAtIndex):
871         (WebCore::BMPImageDecoder::decode):
872         (WebCore::BMPImageDecoder::encodedDataStatus): Deleted.
873         * platform/image-decoders/bmp/BMPImageDecoder.h:
874         * platform/image-decoders/gif/GIFImageDecoder.cpp:
875         (WebCore::GIFImageDecoder::frameCount):
876         (WebCore::GIFImageDecoder::frameBufferAtIndex):
877         (WebCore::GIFImageDecoder::decode):
878         (WebCore::GIFImageDecoder::encodedDataStatus): Deleted.
879         * platform/image-decoders/gif/GIFImageDecoder.h:
880         * platform/image-decoders/ico/ICOImageDecoder.cpp:
881         (WebCore::ICOImageDecoder::setData):
882         (WebCore::ICOImageDecoder::frameCount):
883         (WebCore::ICOImageDecoder::frameBufferAtIndex):
884         (WebCore::ICOImageDecoder::setDataForPNGDecoderAtIndex):
885         (WebCore::ICOImageDecoder::decode):
886         (WebCore::ICOImageDecoder::decodeAtIndex):
887         (WebCore::ICOImageDecoder::encodedDataStatus): Deleted.
888         * platform/image-decoders/ico/ICOImageDecoder.h:
889         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
890         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
891         (WebCore::JPEGImageDecoder::decode):
892         (WebCore::JPEGImageDecoder::encodedDataStatus): Deleted.
893         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
894         * platform/image-decoders/png/PNGImageDecoder.cpp:
895         (WebCore::PNGImageDecoder::frameBufferAtIndex):
896         (WebCore::PNGImageDecoder::decode):
897         (WebCore::PNGImageDecoder::encodedDataStatus): Deleted.
898         * platform/image-decoders/png/PNGImageDecoder.h:
899         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
900         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
901         (WebCore::WEBPImageDecoder::decode):
902         (WebCore::WEBPImageDecoder::encodedDataStatus): Deleted.
903         * platform/image-decoders/webp/WEBPImageDecoder.h:
904
905 2017-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
906
907         Move UUID from WebCore/platform to WTF
908         https://bugs.webkit.org/show_bug.cgi?id=171372
909
910         Reviewed by Michael Catanzaro.
911
912         UUID only contains createCanonicalUUIDString() that is platform independent and doesn't depend on anything from
913         WebCore, only from WTF.
914
915         * CMakeLists.txt:
916         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
917         * Modules/mediacontrols/MediaControlsHost.cpp:
918         * Modules/mediastream/RTCPeerConnection.cpp:
919         * Modules/webaudio/MediaStreamAudioSource.cpp:
920         * Modules/webdatabase/DatabaseTracker.cpp:
921         * WebCore.order:
922         * WebCore.xcodeproj/project.pbxproj:
923         * editing/mac/EditorMac.mm:
924         * fileapi/BlobURL.cpp:
925         * loader/appcache/ApplicationCacheHost.cpp:
926         * loader/appcache/ApplicationCacheStorage.cpp:
927         * platform/URL.cpp:
928         * platform/glib/FileSystemGlib.cpp:
929         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
930         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
931         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
932         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
933         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
934         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
935         * platform/mediastream/CaptureDeviceManager.cpp:
936         * platform/mediastream/MediaStreamPrivate.h:
937         * platform/mediastream/MediaStreamTrackPrivate.cpp:
938         * platform/mediastream/RealtimeMediaSource.cpp:
939         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
940         * platform/mediastream/mac/AVMediaCaptureSource.mm:
941         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
942         * platform/mock/MockRealtimeAudioSource.cpp:
943         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
944         * platform/mock/MockRealtimeVideoSource.cpp:
945         * testing/MockCDMFactory.cpp:
946
947 2017-04-27  Alex Christensen  <achristensen@webkit.org>
948
949         Make navigation policy checking more robust
950         https://bugs.webkit.org/show_bug.cgi?id=171409
951         <rdar://problem/31489248>
952
953         Reviewed by Geoffrey Garen.
954
955         No change in behavior.  Just added a protectedThis to a lambda and made the functions non-copyable.
956
957         * loader/DocumentLoader.cpp:
958         (WebCore::DocumentLoader::willSendRequest):
959         * loader/PolicyCallback.cpp:
960         (WebCore::PolicyCallback::set):
961         (WebCore::PolicyCallback::clear): Deleted.
962         * loader/PolicyCallback.h:
963         * loader/PolicyChecker.cpp:
964         (WebCore::PolicyChecker::cancelCheck):
965         (WebCore::PolicyChecker::stopCheck):
966         (WebCore::PolicyChecker::continueAfterNavigationPolicy):
967         (WebCore::PolicyChecker::continueAfterNewWindowPolicy):
968         (WebCore::PolicyChecker::continueAfterContentPolicy):
969
970 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
971
972         Data interaction should not load pasteboard content before performing the data operation
973         https://bugs.webkit.org/show_bug.cgi?id=171414
974         <rdar://problem/31878197>
975
976         Reviewed by Tim Horton.
977
978         When interacting with a link, we should not try to fetch pasteboard contents for the URL UTI type before
979         performing the data operation. Teaches DragController to know whether it is allowed to load data from the
980         dragging pasteboard, and uses this information in DragController::dragOperation to determine whether to use
981         DragData::containsURLTypeIdentifier or DragData::containsURL.
982
983         * page/DragController.cpp:
984         (WebCore::DragController::DragController):
985         (WebCore::DragController::performDragOperation):
986         * page/DragController.h:
987         (WebCore::DragController::canLoadDataFromDraggingPasteboard):
988         * page/mac/DragControllerMac.mm:
989         (WebCore::DragController::dragOperation):
990         * platform/DragData.h:
991         * platform/ios/WebItemProviderPasteboard.mm:
992         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
993         * platform/mac/DragDataMac.mm:
994         (WebCore::DragData::containsURLTypeIdentifier):
995
996 2017-04-27  Joseph Pecoraro  <pecoraro@apple.com>
997
998         Support for promise rejection events (unhandledrejection)
999         https://bugs.webkit.org/show_bug.cgi?id=150358
1000         <rdar://problem/28441651>
1001
1002         Reviewed by Saam Barati.
1003
1004         Patch by Joseph Pecoraro and Yusuke Suzuki.
1005
1006         Implement support for the `onunhandledrejection` and `rejectionhandled` events.
1007         They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook:
1008         https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker
1009         https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections
1010
1011         This is currently implemented only for Documents and not yet Web Workers.
1012
1013         Tests: js/dom/unhandled-promise-rejection-basic.html
1014                js/dom/unhandled-promise-rejection-bindings-type-error.html
1015                js/dom/unhandled-promise-rejection-console-no-report.html
1016                js/dom/unhandled-promise-rejection-console-report.html
1017                js/dom/unhandled-promise-rejection-handle-during-event.html
1018                js/dom/unhandled-promise-rejection-handle-in-handler.html
1019                js/dom/unhandled-promise-rejection-handle.html
1020                js/dom/unhandled-promise-rejection-order.html
1021
1022         * CMakeLists.txt:
1023         * DerivedSources.cpp:
1024         * DerivedSources.make:
1025         * WebCore.xcodeproj/project.pbxproj:
1026         * dom/DOMAllInOne.cpp:
1027         New files.
1028
1029         * bindings/scripts/CodeGenerator.pm:
1030         (IsPromiseType):
1031         * bindings/scripts/CodeGeneratorJS.pm:
1032         (AddToIncludesForIDLType):
1033         (GetBaseIDLType):
1034         Binding support for Promise<T> attributes.
1035
1036         * bindings/js/JSDOMConvert.h:
1037         * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h.
1038         (WebCore::Converter<IDLPromise<T>>::convert):
1039         (WebCore::JSConverter<IDLPromise<T>>::convert):
1040         Promise<T> binding conversion is currently unimplemented, which only means
1041         web developers creating their own PromiseRejectionEvent will not get
1042         autowrapping of values assigned to `promise` in event initialization.
1043         Engine generated events will have expected behavior.
1044
1045         * bindings/js/JSDOMWindowBase.cpp:
1046         (WebCore::JSDOMWindowBase::promiseRejectionTracker):
1047         * bindings/js/JSDOMWindowBase.h:
1048         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1049         Implement HostPromiseRejectionTracker hook for Document but not Worker.
1050         Passes through to the ScriptExecutionContext's tracker.
1051
1052         * bindings/js/JSMainThreadExecState.cpp:
1053         (WebCore::JSMainThreadExecState::didLeaveScriptContext):
1054         * bindings/js/JSMainThreadExecState.h:
1055         (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
1056         When completing script execution and performing microtasks notify
1057         about rejected promises. Technically this should go inside of
1058         performing a microtask checkpoint, except lacking EventLoop
1059         concepts we use ScriptExecutionState.
1060
1061         * dom/EventNames.h:
1062         * dom/EventNames.in:
1063         * dom/PromiseRejectionEvent.cpp: Added.
1064         (WebCore::PromiseRejectionEvent::PromiseRejectionEvent):
1065         (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent):
1066         * dom/PromiseRejectionEvent.h: Added.
1067         * dom/PromiseRejectionEvent.idl: Added.
1068         New PromiseRejectionEvent event interface.
1069
1070         * dom/GlobalEventHandlers.idl:
1071         New onunhandledrejection and onrejectionhandled.
1072
1073         * dom/RejectedPromiseTracker.cpp: Added.
1074         (WebCore::RejectedPromise::RejectedPromise):
1075         (WebCore::RejectedPromise::globalObject):
1076         (WebCore::RejectedPromise::promise):
1077         (WebCore::UnhandledPromise::UnhandledPromise):
1078         (WebCore::UnhandledPromise::callStack):
1079         (WebCore::RejectedPromiseTracker::RejectedPromiseTracker):
1080         (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker):
1081         (WebCore::createScriptCallStackFromReason):
1082         (WebCore::RejectedPromiseTracker::promiseRejected):
1083         (WebCore::RejectedPromiseTracker::promiseHandled):
1084         (WebCore::RejectedPromiseTracker::processQueueSoon):
1085         (WebCore::RejectedPromiseTracker::reportUnhandledRejections):
1086         (WebCore::RejectedPromiseTracker::reportRejectionHandled):
1087         * dom/RejectedPromiseTracker.h: Added.
1088         Track and report rejected promises. The promises are tracked weakly
1089         allowing them to be collected before they are reported. When reporting
1090         we dispatch PromiseRejectionEvent events, and if the default is not
1091         prevented we log a message to the console.
1092
1093         * dom/ScriptExecutionContext.cpp:
1094         (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
1095         (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow):
1096         * dom/ScriptExecutionContext.h:
1097         (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker):
1098         Each ScriptExecutionContext can own a rejected promise tracker.
1099
1100         * html/HTMLMediaElement.cpp:
1101         (WebCore::HTMLMediaElement::pauseInternal):
1102         https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps
1103         Internal pause steps say to timeupdate, pause, and rejecting pending play promises
1104         should all happen in a queued task. Here the first two actions are already scheduled
1105         on tasks, but rejecting play promises was not being done in a task, so this makes
1106         that change.
1107
1108         * Modules/streams/ReadableStream.js:
1109         (pipeThrough):
1110         * Modules/streams/ReadableStreamInternals.js:
1111         (readableStreamReaderGenericInitialize):
1112         (readableStreamError):
1113         (readableStreamReaderGenericRelease):
1114         Satisfy parts of the Streams specification which state to set the
1115         [[PromiseIsHandled]] internal state of promises created internally
1116         by the Streams APIs. This prevents some internal promises from
1117         appearing as unhandled promise rejections.
1118
1119 2017-04-27  Chris Dumez  <cdumez@apple.com>
1120
1121         Align colspan/rowspan limits with the latest HTML specification
1122         https://bugs.webkit.org/show_bug.cgi?id=171322
1123
1124         Reviewed by Darin Adler.
1125
1126         Align colspan/rowspan limits with the latest HTML specification after:
1127         - https://github.com/whatwg/html/pull/1993
1128
1129         The following changes were made:
1130         - Our rowspan limit was raised from 8190 to 65534
1131         - A colspan limit of 1000 was introduced. Blink has UseCounter data showing that
1132           colspans over 1000 are extremely rare and Gecko has data showing that when we
1133           get a colspan greater than 1000, it is usually a bug. Therefore, this change
1134           should be fine.
1135         - The limits are now properly reflected via the IDL attributes instead of lying
1136           to the Web about the colspan / rowspan we are using internally.
1137
1138         Test: imported/w3c/web-platform-tests/html/semantics/tabular-data/processing-model-1/span-limits.html
1139
1140         * html/HTMLTableCellElement.cpp:
1141         (WebCore::HTMLTableCellElement::colSpan):
1142         (WebCore::HTMLTableCellElement::rowSpan):
1143         (WebCore::HTMLTableCellElement::rowSpanForBindings):
1144         (WebCore::HTMLTableCellElement::setColSpan):
1145         * html/HTMLTableCellElement.h:
1146         * html/HTMLTableCellElement.idl:
1147         * html/parser/HTMLParserIdioms.cpp:
1148         (WebCore::parseHTMLIntegerInternal):
1149         (WebCore::parseHTMLInteger):
1150         (WebCore::parseHTMLNonNegativeInteger):
1151         (WebCore::parseValidHTMLNonNegativeIntegerInternal):
1152         (WebCore::parseHTTPRefreshInternal):
1153         * html/parser/HTMLParserIdioms.h:
1154         (WebCore::parseHTMLInteger):
1155         (WebCore::parseHTMLNonNegativeInteger):
1156
1157         (WebCore::clampHTMLNonNegativeIntegerToRange):
1158         Add utility function to implement:
1159         - https://html.spec.whatwg.org/#clamped-to-the-range
1160
1161 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1162
1163         WKUIDelegatePrivate needs a hook to vend data used to initialize item providers for data interaction
1164         https://bugs.webkit.org/show_bug.cgi?id=171386
1165         <rdar://problem/31557237>
1166
1167         Reviewed by Beth Dakin.
1168
1169         Teach WebItemProviderPasteboard to remember what WebItemProviderRegistrationInfoList it was initialized with
1170         when beginning a drag. This information is cleared out the next time the list of item providers is set to
1171         something different, which happens when the data interaction session concludes.
1172
1173         * platform/ios/WebItemProviderPasteboard.h:
1174         * platform/ios/WebItemProviderPasteboard.mm:
1175         (-[WebItemProviderPasteboard init]):
1176         (-[WebItemProviderPasteboard setItemProviders:]):
1177         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
1178         (-[WebItemProviderPasteboard registrationInfoAtIndex:]):
1179         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
1180
1181 2017-04-27  Brady Eidson  <beidson@apple.com>
1182
1183         Refactor SessionID to support multiple non-ephemeral (persistent) sessions.
1184         https://bugs.webkit.org/show_bug.cgi?id=171367
1185
1186         Reviewed by Andy Estes.
1187
1188         This is also a nice general cleanup of SessionID, including privatizing the "arbitrary number" constructor
1189         and moving encode/decode into the class.
1190
1191         No new tests (Refactor, no behavior change yet).
1192
1193         * CMakeLists.txt:
1194         * WebCore.xcodeproj/project.pbxproj:
1195         
1196         * page/SessionID.cpp: Added.
1197         (WebCore::SessionID::generatePersistentSessionID):
1198         (WebCore::SessionID::generateEphemeralSessionID):
1199         (WebCore::SessionID::enableGenerationProtection):
1200         
1201         * page/SessionID.h:
1202         (WebCore::SessionID::SessionID):
1203         (WebCore::SessionID::emptySessionID):
1204         (WebCore::SessionID::hashTableDeletedValue):
1205         (WebCore::SessionID::defaultSessionID):
1206         (WebCore::SessionID::legacyPrivateSessionID):
1207         (WebCore::SessionID::isValid):
1208         (WebCore::SessionID::isEphemeral):
1209         (WebCore::SessionID::encode):
1210         (WebCore::SessionID::decode):
1211         (WTF::HashTraits<WebCore::SessionID>::constructDeletedValue):
1212         (WTF::HashTraits<WebCore::SessionID>::isDeletedValue):
1213
1214 2017-04-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
1215
1216         Attempt to fix a PLT regression on Mac
1217         <rdar://problem/31826998>
1218
1219         Unreviewed.
1220
1221         Disable passing the TypeIdentifierHint to CGImageSourceCreateIncremental()
1222         on Mac for now.
1223
1224         * platform/graphics/cg/ImageDecoderCG.cpp:
1225         (WebCore::ImageDecoder::ImageDecoder):
1226
1227 2017-04-27  Daniel Bates  <dabates@apple.com>
1228
1229         Rename callerDOMWindow()/CallerDocument to incumbentDOMWindow()/IncumbentDocument
1230         https://bugs.webkit.org/show_bug.cgi?id=171145
1231
1232         Reviewed by Saam Barati.
1233
1234         Standardize on the terminology "incumbent" to refer to "most-recently-entered author
1235         function or script on the stack, or the author function or script that originally
1236         scheduled the currently-running callback" (1).
1237
1238         [1] <https://html.spec.whatwg.org/multipage/webappapis.html#realms-settings-objects-global-objects> (27 April 2017)
1239
1240         * bindings/js/JSDOMWindowBase.cpp:
1241         (WebCore::incumbentDOMWindow):
1242         (WebCore::callerDOMWindow): Deleted.
1243         * bindings/js/JSDOMWindowBase.h:
1244         * bindings/scripts/CodeGeneratorJS.pm:
1245         (GenerateCallWith):
1246         * bindings/scripts/test/JS/JSTestObj.cpp:
1247         (WebCore::jsTestObjPrototypeFunctionWithCallerDocumentArgumentCaller):
1248         (WebCore::jsTestObjPrototypeFunctionWithCallerWindowArgumentCaller):
1249         * bindings/scripts/test/TestObj.idl:
1250         * page/DOMWindow.idl:
1251
1252 2017-04-27  Youenn Fablet  <youenn@apple.com>
1253
1254         LayoutTest webrtc/datachannel/datachannel-event.html is a flaky crash
1255         https://bugs.webkit.org/show_bug.cgi?id=171092
1256         <rdar://problem/31748066>
1257
1258         Reviewed by Eric Carlson.
1259
1260         Covered by manual testing on iterating on the crashing tests.
1261         With the patch, they appear to no longer crash.
1262
1263         The current RTCPeerConnection/RTCController was expecting that peer connections would be stopped before the controller.
1264         This assumption is sometimes wrong.
1265         Adding clean-up on both sides so that if controller goes away, it notifies its peer connections that they are unregistered.
1266
1267         * Modules/mediastream/RTCController.cpp:
1268         (WebCore::RTCController::~RTCController):
1269         * Modules/mediastream/RTCController.h:
1270         * Modules/mediastream/RTCPeerConnection.cpp:
1271         (WebCore::RTCPeerConnection::create):
1272         (WebCore::RTCPeerConnection::~RTCPeerConnection):
1273         (WebCore::RTCPeerConnection::doStop):
1274         (WebCore::RTCPeerConnection::registerToController):
1275         (WebCore::RTCPeerConnection::unregisterFromController):
1276         (WebCore::RTCPeerConnection::rtcController): Deleted.
1277         * Modules/mediastream/RTCPeerConnection.h:
1278
1279 2017-04-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
1280
1281         REGRESSION(r213764): Async decoding of animated images is disabled for ImageDocument
1282         https://bugs.webkit.org/show_bug.cgi?id=170333
1283
1284         Reviewed by Simon Fraser.
1285
1286         The way the image drawing settings are transfered from the Settings to
1287         BitmapImage is problematic. The drawing settings are retrieved from the
1288         CachedImageObserver which store them in the constructor only if the
1289         CachedImage as a loader. In the case of ImageDocument, there isn't loader
1290         set in CachedImage so the settings of ImageDocument are not set. Also
1291         the CachedImage can be used after loading by another document which may
1292         have a different drawing settings.
1293
1294         The fix is to make BitmapImage reads the drawing settings every time it 
1295         is drawn as a foreground or background image in a RenderElement.
1296
1297         * html/canvas/CanvasRenderingContext2D.cpp:
1298         (WebCore::CanvasRenderingContext2D::drawImage):
1299         * loader/cache/CachedImage.cpp:
1300         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
1301         * loader/cache/CachedImage.h:
1302         * platform/graphics/BitmapImage.cpp:
1303         (WebCore::BitmapImage::setDrawingSettings):
1304         (WebCore::BitmapImage::draw):
1305         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): I was
1306         trying to disable the async image decoding temporarily but this way will
1307         even prevent testing it until it is enabled. Disable it through WK1 and
1308         WK2 preferences.
1309         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages):
1310         (WebCore::BitmapImage::advanceAnimation):
1311         * platform/graphics/BitmapImage.h:
1312         * platform/graphics/ImageObserver.h:
1313         * rendering/RenderBoxModelObject.cpp:
1314         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1315         * rendering/RenderImage.cpp:
1316         (WebCore::RenderImage::paintIntoRect):
1317
1318 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1319
1320         Performing data interaction with plain text into a contenteditable does not insert any content
1321         https://bugs.webkit.org/show_bug.cgi?id=171381
1322
1323         Reviewed by Tim Horton.
1324
1325         Attempt to read plain-text-conformant UTI types as kUTTypePlainText before reading them as kUTTypeText.
1326         This allows WebItemProviderPasteboard to properly materialize an NSString in -valuesForPasteboardType:
1327         inItemSet: using a pre-loaded NSData blob.
1328
1329         This scenario is covered by DataInteractionTests.ExternalSourceUTF8PlainTextOnly, but DataInteractionTests
1330         are temporarily disabled due to incompatibilities with the current internal SDK.
1331
1332         * platform/ios/PasteboardIOS.mm:
1333         (WebCore::readPasteboardWebContentDataForType):
1334
1335 2017-04-27  Chris Dumez  <cdumez@apple.com>
1336
1337         Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
1338         https://bugs.webkit.org/show_bug.cgi?id=171226
1339
1340         Reviewed by Simon Fraser.
1341
1342         Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
1343         as per:
1344         - https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
1345
1346         DOMRect is compatible with ClientRect, which we used to return so the risk should
1347         be low.
1348
1349         Tests: fast/css/DOMRect-attributes-prototype.html
1350                fast/css/DOMRect-serialization.html
1351                fast/dom/Element/getClientRects-return-type.html
1352
1353         * dom/ClientRectList.cpp:
1354         (WebCore::ClientRectList::ClientRectList):
1355         * dom/ClientRectList.h:
1356         (WebCore::ClientRectList::create):
1357         * dom/DOMRect.h:
1358         (WebCore::DOMRect::create):
1359         * dom/DOMRectReadOnly.h:
1360         * dom/Element.cpp:
1361         (WebCore::toDOMRectVector):
1362         (WebCore::Element::getClientRects):
1363         (WebCore::Element::getBoundingClientRect):
1364         * dom/Element.h:
1365         * dom/Element.idl:
1366         * html/track/VTTRegion.cpp:
1367         (WebCore::VTTRegion::displayLastTextTrackCueBox):
1368
1369 2017-04-27  Joanmarie Diggs  <jdiggs@igalia.com>
1370
1371         AX: Expose elements with the ARIA "feed" role
1372         https://bugs.webkit.org/show_bug.cgi?id=171184
1373
1374         Reviewed by Chris Fleizach.
1375
1376         Map elements with the "feed" role to the internal ApplicationGroupRole
1377         AccessibilityRole. This prevents them from being unexpectedly pruned from
1378         the accessibility tree, and causes them to be exposed with ATK_ROLE_PANEL
1379         in WebKitGtk and AXGroup in Safari.
1380
1381         No new tests needed. Instead, add the "feed" role to roles-exposed.html,
1382         xml-roles-exposed.html, and roles-computedRoleString.html.
1383
1384         * accessibility/AccessibilityObject.cpp:
1385         (WebCore::initializeRoleMap):
1386
1387 2017-04-27  Brady Eidson  <beidson@apple.com>
1388
1389         Update NetworkStorageSession to support multiple persistent sessions and explicitly set cookie storages.
1390         https://bugs.webkit.org/show_bug.cgi?id=171365
1391
1392         Reviewed by Andy Estes.
1393
1394         No new tests (No testable behavior change yet).
1395
1396         * platform/network/NetworkStorageSession.cpp:
1397         (WebCore::NetworkStorageSession::destroySession):
1398         * platform/network/NetworkStorageSession.h:
1399         
1400         * platform/network/NetworkStorageSessionStub.cpp:
1401         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1402         (WebCore::NetworkStorageSession::ensureSession):
1403         
1404         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1405         (WebCore::createCFStorageSessionForIdentifier):
1406         (WebCore::NetworkStorageSession::NetworkStorageSession):
1407         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1408         (WebCore::NetworkStorageSession::defaultStorageSession):
1409         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1410         (WebCore::NetworkStorageSession::ensureSession):
1411         (WebCore::NetworkStorageSession::cookieStorage):
1412         
1413         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1414         (WebCore::NetworkStorageSession::ensureSession):
1415         
1416         * platform/spi/cf/CFNetworkSPI.h:
1417
1418 2017-04-27  Zalan Bujtas  <zalan@apple.com>
1419
1420         Use text-shadow to visualize simple line layout coverage.
1421         https://bugs.webkit.org/show_bug.cgi?id=171379
1422
1423         Reviewed by Antti Koivisto.
1424
1425         It's more subtle (for everyday use).
1426
1427         * rendering/SimpleLineLayoutFunctions.cpp:
1428         (WebCore::SimpleLineLayout::paintFlow):
1429         (WebCore::SimpleLineLayout::paintDebugBorders): Deleted.
1430
1431 2017-04-27  Joanmarie Diggs  <jdiggs@igalia.com>
1432
1433         [ATK] ARIA alertdialogs should be exposed with ROLE_DIALOG
1434         https://bugs.webkit.org/show_bug.cgi?id=171187
1435
1436         Reviewed by Chris Fleizach.
1437
1438         Map ApplicationAlertDialogRole to ATK_ROLE_DIALOG. While ATK_ROLE_ALERT is
1439         appropriate as far as ATK is concerned, the Core Accessibility API Mappings
1440         map ARIA's alertdialog role to ATK_ROLE_DIALOG. We should be consistent
1441         with the spec. The fact that this is an alert dialog can still be obtained
1442         via the AtkObject attributes.
1443
1444         No new tests needed. Update the expectations for roles-exposed.html,
1445         xml-roles-exposed.html, and aria-mappings.html to reflect the change.
1446
1447         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1448         (atkRole):
1449
1450 2017-04-27  Antti Koivisto  <antti@apple.com>
1451
1452         Repeated layouts in Mail due to viewport units being used with auto-sizing
1453         https://bugs.webkit.org/show_bug.cgi?id=171371
1454         <rdar://problem/28780084>
1455
1456         Reviewed by Zalan Bujtas.
1457
1458         Test: css3/viewport-percentage-lengths/vh-auto-size.html
1459
1460         Auto-sizing code would adjust the size of the view in the beginning of layout(). This would
1461         end up invalidating style for elements that use vh units and we would perform main layout
1462         with unclean style. This would result in endless layout loops and hit assert on debug.
1463
1464         * page/FrameView.cpp:
1465         (WebCore::FrameView::availableContentSizeChanged):
1466
1467             Ensure we heve clean style after resize if we are in pre-layout.
1468
1469 2017-04-27  Alex Christensen  <achristensen@webkit.org>
1470
1471         Modernize Frame.h
1472         https://bugs.webkit.org/show_bug.cgi?id=171357
1473
1474         Reviewed by Andy Estes.
1475
1476         Frame.h has several std::unique_ptrs that are created in the constructor, never null,
1477         and destroyed in the destructor.  This is what WTF::UniqueRef is for, and using UniqueRef
1478         allows us to not check for null values because a UniqueRef can never be null.
1479         An interesting case was the EventHandler, which we explicitly set to nullptr in the destructor
1480         of MainFrame, a subclass of Frame.  We added this in r199181 to fix a crash tested by
1481         fast/events/wheel-event-destroys-frame.html and this improved lifetime also does not crash
1482         or assert in that test.
1483
1484         Using UniqueRef also requires const correctness, which this patch adds when necessary.
1485
1486         * accessibility/AccessibilityObject.cpp:
1487         (WebCore::AccessibilityObject::dispatchTouchEvent):
1488         * editing/DeleteSelectionCommand.cpp:
1489         (WebCore::DeleteSelectionCommand::calculateTypingStyleAfterDelete):
1490         * editing/Editor.cpp:
1491         (WebCore::Editor::isSelectTrailingWhitespaceEnabled):
1492         (WebCore::Editor::computeAndSetTypingStyle):
1493         * editing/Editor.h:
1494         * editing/FrameSelection.cpp:
1495         (WebCore::FrameSelection::contains):
1496         (WebCore::FrameSelection::copyTypingStyle):
1497         * editing/FrameSelection.h:
1498         (WebCore::FrameSelection::setTypingStyle):
1499         * loader/EmptyClients.cpp:
1500         * loader/FrameLoader.cpp:
1501         (WebCore::FrameLoader::clear):
1502         * page/EditorClient.h:
1503         * page/EventHandler.cpp:
1504         (WebCore::EventHandler::hitTestResultAtPoint):
1505         * page/EventHandler.h:
1506         * page/Frame.cpp:
1507         (WebCore::Frame::Frame):
1508         (WebCore::Frame::setView):
1509         (WebCore::Frame::injectUserScripts):
1510         * page/Frame.h:
1511         (WebCore::Frame::editor):
1512         (WebCore::Frame::eventHandler):
1513         (WebCore::Frame::selection):
1514         (WebCore::Frame::animation):
1515         (WebCore::Frame::script):
1516         (WebCore::Frame::eventHandlerPtr): Deleted.
1517         * page/MainFrame.cpp:
1518         (WebCore::MainFrame::~MainFrame):
1519         * replay/UserInputBridge.cpp:
1520         (WebCore::UserInputBridge::handleContextMenuEvent):
1521         * replay/UserInputBridge.h:
1522
1523 2017-04-27  Andy Estes  <aestes@apple.com>
1524
1525         Fix the macOS build.
1526
1527         * platform/mac/WebPlaybackControlsManager.h:
1528
1529 2017-04-27  Zalan Bujtas  <zalan@apple.com>
1530
1531         Text gets cut off when bailing out of simple line layout with widows.
1532         https://bugs.webkit.org/show_bug.cgi?id=171370
1533         <rdar://problem/31563414>
1534
1535         Reviewed by Antti Koivisto.
1536
1537         Normal line layout requires an extra layout to handle widows. See RenderBlockFlow::relayoutToAvoidWidows. 
1538
1539         Test: fast/multicol/simple-line-layout-widows-when-switching-over-to-normal-line-layout.html
1540
1541         * rendering/RenderBlockFlow.cpp:
1542         (WebCore::RenderBlockFlow::ensureLineBoxes):
1543
1544 2017-04-27  Dean Jackson  <dino@apple.com>
1545
1546         Use the correct modern-media-controls
1547         https://bugs.webkit.org/show_bug.cgi?id=171358
1548
1549         Reviewed by Antoine Quint.
1550
1551         * WebCore.xcodeproj/project.pbxproj:
1552
1553 2017-04-26  Dan Bernstein  <mitz@apple.com>
1554
1555         Reverted r215774.
1556
1557         That change wasn’t doing what it was intended to do and was inappropriate for WebCore.
1558
1559         * WebCore.xcodeproj/project.pbxproj:
1560
1561 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
1562
1563         Attempt to fix a PLT regression.
1564         <rdar://problem/31826998>
1565
1566         Unreviewed.
1567
1568         Disable passing the TypeIdentifierHint to CGImageSourceCreateIncremental()
1569         on iOS for now.
1570
1571         * platform/graphics/cg/ImageDecoderCG.cpp:
1572         (WebCore::ImageDecoder::ImageDecoder):
1573
1574 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
1575
1576         [ATK] ARIA buttons which have a popup should be ATK_ROLE_PUSH_BUTTON; not ATK_ROLE_COMBO_BOX
1577         https://bugs.webkit.org/show_bug.cgi?id=171182
1578
1579         Reviewed by Chris Fleizach.
1580
1581         Test: accessibility/gtk/button-with-aria-haspopup-is-not-a-combobox.html
1582
1583         WebCore Accessibility assigns PopUpButtonRole to collapsed select elements,
1584         which the ATK code correctly maps to ATK_ROLE_COMBO_BOX. It turns out that
1585         WebCore Accessibility also maps the ARIA button role to PopUpButtonRole if
1586         it also has aria-haspopup. Add a check to atkRole() so that the latter case
1587         is mapped to ATK_ROLE_PUSH_BUTTON.
1588
1589         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1590         (atkRole):
1591
1592 2017-04-26  Tim Horton  <timothy_horton@apple.com>
1593
1594         Should not drag x-apple-data-detectors links
1595         https://bugs.webkit.org/show_bug.cgi?id=171352
1596         <rdar://problem/31309081>
1597
1598         Reviewed by Beth Dakin.
1599
1600         Test: fast/events/do-not-drag-and-drop-data-detectors-link.html
1601
1602         These links are only meaningful in the context of the original document,
1603         so they should not be draggable.
1604
1605         * editing/cocoa/DataDetection.h:
1606         * editing/cocoa/DataDetection.mm:
1607         (WebCore::DataDetection::dataDetectorURLProtocol):
1608         (WebCore::DataDetection::isDataDetectorURL):
1609         * page/DragController.cpp:
1610         (WebCore::isDraggableLink):
1611         Disallow dragging of <a href="x-apple-data-detectors://..."> links.
1612
1613 2017-04-26  Tim Horton  <timothy_horton@apple.com>
1614
1615         Revert accidentally smushed commit.
1616
1617         * editing/cocoa/DataDetection.h:
1618         * editing/cocoa/DataDetection.mm:
1619         (WebCore::DataDetection::dataDetectorURLProtocol): Deleted.
1620         (WebCore::DataDetection::isDataDetectorURL): Deleted.
1621         * page/DragController.cpp:
1622         (WebCore::isDraggableLink):
1623         * platform/mac/DragImageMac.mm:
1624         (WebCore::createDragImageForLink):
1625
1626 2017-04-26  Alex Christensen  <achristensen@webkit.org>
1627
1628         REGRESSION (r215686): ASSERTION FAILED: data seen with webarchive/loading tests
1629         https://bugs.webkit.org/show_bug.cgi?id=171340
1630
1631         Reviewed by Brady Eidson.
1632
1633         This fixes a flaky assertion in webarchive/loading/missing-data.html
1634
1635         * platform/cf/SharedBufferCF.cpp:
1636         (WebCore::SharedBuffer::append):
1637         If there's no CFDataRef, there's no need to append data.
1638         This happens sometimes.
1639
1640 2017-04-26  Ryan Haddad  <ryanhaddad@apple.com>
1641
1642         Unreviewed, rolling out r215814.
1643
1644         The LayoutTest for this change is failing on ios-simulator and
1645         is flaky on macOS.
1646
1647         Reverted changeset:
1648
1649         "Response.blob() does not set the content-type based on the
1650         header value."
1651         https://bugs.webkit.org/show_bug.cgi?id=170849
1652         http://trac.webkit.org/changeset/215814
1653
1654 2017-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1655
1656         WebItemProviderPasteboard should not synchronously load provided data
1657         https://bugs.webkit.org/show_bug.cgi?id=171341
1658         <rdar://problem/31614010>
1659
1660         Reviewed by Tim Horton.
1661
1662         Refactors WebItemProviderPasteboard to not require asynchronously loading item provider data. To accomplish this,
1663         we ensure that before performing data interaction, the UTI type that the data operation target should consume is
1664         propagated to the UI process prior to the web process receiving the signal from the UI process to begin the
1665         data operation itself. This information is sent via WebPlatformStrategies::updatePreferredTypeIdentifiers, a new
1666         pasteboard helper function.
1667
1668         * page/DragController.cpp:
1669         (WebCore::DragController::DragController):
1670         (WebCore::dragIsHandledByDocument):
1671         (WebCore::DragController::performDragOperation):
1672         (WebCore::DragController::dragEnteredOrUpdated):
1673         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
1674         (WebCore::DragController::tryDocumentDrag):
1675
1676         Give DragHandlingMethod a richer representation of what type of action will be performed. DragController::
1677         updatePreferredTypeIdentifiersForDragHandlingMethod uses this to determine what kinds of UTIs are acceptable for
1678         the current drop session.
1679
1680         * page/DragController.h:
1681         (WebCore::DragController::documentIsHandlingNonDefaultDrag):
1682         * page/mac/DragControllerMac.mm:
1683         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
1684
1685         Updates the data interaction pasteboard's list of preferred type identifiers it should load upon data operation.
1686
1687         * platform/DragData.h:
1688         * platform/PasteboardStrategy.h:
1689         * platform/PlatformPasteboard.h:
1690         * platform/ios/AbstractPasteboard.h:
1691         * platform/ios/PlatformPasteboardIOS.mm:
1692         (WebCore::PlatformPasteboard::updatePreferredTypeIdentifiers):
1693         * platform/ios/WebItemProviderPasteboard.mm:
1694
1695         Introduce _preferredTypeIdentifiers, which -doAfterLoadingProvidedContentIntoFileURLs: uses as a hint when
1696         determining which UTI to load for an item provider. In the absence of preferred type identifiers, the default
1697         behavior is to use the highest fidelity type adhering to "public.content".
1698
1699         (-[WebItemProviderPasteboard init]):
1700         (-[WebItemProviderPasteboard updatePreferredTypeIdentifiers:]):
1701         (-[WebItemProviderPasteboard setItemProviders:]):
1702         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
1703         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
1704
1705         Remove calls to -createObjectOfClass: and -copyDataRepresentation:. Instead, rely solely on the loaded file URL
1706         to read and initialize data and objects from the pasteboard.
1707
1708         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
1709         (-[WebItemProviderPasteboard _tryToCreateObjectOfClass:usingProvider:]): Deleted.
1710         * platform/mac/DragDataMac.mm:
1711         (WebCore::DragData::updatePreferredTypeIdentifiers):
1712
1713 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
1714
1715         [ATK] Elements with a defined, non-false value for aria-current should expose ATK_STATE_ACTIVE
1716         https://bugs.webkit.org/show_bug.cgi?id=171163
1717
1718         Reviewed by Chris Fleizach.
1719
1720         Add ATK_STATE_ACTIVE to the state set of elements which have a valid, non-false
1721         value for aria-current, expose the value of via the "current" AtkObject attribute,
1722         and emit state-change notifications when the value of aria-current changes from
1723         non-false to false, or vice versa.
1724
1725         Tests: accessibility/gtk/aria-current-changed-notification.html
1726                accessibility/gtk/aria-current.html
1727
1728         * accessibility/AXObjectCache.cpp:
1729         (WebCore::AXObjectCache::handleAttributeChanged):
1730         * accessibility/AXObjectCache.h:
1731         * accessibility/AccessibilityObject.cpp:
1732         (WebCore::AccessibilityObject::supportsARIACurrent):
1733         (WebCore::AccessibilityObject::ariaCurrentValue):
1734         * accessibility/AccessibilityObject.h:
1735         * accessibility/atk/AXObjectCacheAtk.cpp:
1736         (WebCore::AXObjectCache::postPlatformNotification):
1737         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1738         (webkitAccessibleGetAttributes):
1739         (setAtkStateSetFromCoreObject):
1740         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1741         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Moved code returning
1742         string value for aria-current into AccessibilityObject:ariaCurrentValue().
1743
1744 2017-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1745
1746         WebItemProviderPasteboard should fetch preloaded assets from disk when possible
1747         https://bugs.webkit.org/show_bug.cgi?id=171320
1748         <rdar://problem/31614010>
1749
1750         Reviewed by Tim Horton.
1751
1752         Adds a mechanism to WebItemProviderPasteboard to remember the temporary file URLs of assets it has loaded using
1753         doAfterLoadingProvidedContentIntoFileURLs:. When retrieving data from the pasteboard, we then see if we can
1754         first fetch serialized data straight from disk instead of having to go through the item provider in both
1755         -dataForPasteboardType:inItemSet: and -valuesForPasteboardType:inItemSet:.
1756
1757         See below annotations for more detail.
1758
1759         * platform/ios/AbstractPasteboard.h:
1760         * platform/ios/PlatformPasteboardIOS.mm:
1761         (WebCore::PlatformPasteboard::filenamesForDataInteraction):
1762         * platform/ios/WebItemProviderPasteboard.h:
1763         * platform/ios/WebItemProviderPasteboard.mm:
1764
1765         Introduces _typeToFileURLMaps, an array of dictionaries. A dictionary at the ith index of this array represents
1766         a mapping of UTIs to loaded temo file URLs for the ith UIItemProvider in the _itemProviders array. Before data
1767         interaction is performed, all entries in this array will be empty.
1768
1769         (-[WebItemProviderPasteboard init]):
1770         (-[WebItemProviderPasteboard setItemProviders:]):
1771         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
1772         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
1773         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
1774
1775         Consult any loaded assets on disk before hitting UIItemProviders via the new
1776         -_preLoadedDataConformingToType:forItemProviderAtIndex: helper method.
1777
1778         (-[WebItemProviderPasteboard _tryToCreateObjectOfClass:usingProvider:]):
1779         (-[WebItemProviderPasteboard fileURLsForDataInteraction]):
1780
1781         Traverse _typeToFileURLMaps to collect all file URLs.
1782
1783         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
1784
1785         Refactored to populate and set _typeToFileURLMaps when loading completes, rather than an array of file URLs.
1786
1787         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]): Deleted.
1788         (-[WebItemProviderPasteboard filenamesForDataInteraction]): Deleted.
1789
1790         Correct an erroneously named method (replaces filenames with fileURLs).
1791
1792 2017-04-26  Youenn Fablet  <youenn@apple.com>
1793
1794         LayoutTest webrtc/datachannel/basic.html is a flaky crash
1795         https://bugs.webkit.org/show_bug.cgi?id=170154
1796         <rdar://problem/31288423>
1797
1798         Reviewed by Geoffrey Garen.
1799
1800         Before the patch, we are setting the channel handler client to null and then unregistering from observer to
1801         libwebrtc data channel. Since this happens in two different threads, there might be a timing issue.
1802
1803         Removing this risk by first unregistering (done synchronously on the other thread), before setting client to null.
1804         Made some clean-up related refactoring.
1805
1806         * Modules/mediastream/RTCDataChannel.cpp:
1807         (WebCore::RTCDataChannel::create):
1808         (WebCore::RTCDataChannel::close):
1809         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
1810         (WebCore::LibWebRTCDataChannelHandler::setClient):
1811         (WebCore::LibWebRTCDataChannelHandler::close):
1812         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1813         * platform/mediastream/RTCDataChannelHandler.h:
1814         * platform/mock/RTCDataChannelHandlerMock.cpp:
1815         (WebCore::RTCDataChannelHandlerMock::setClient):
1816         * platform/mock/RTCDataChannelHandlerMock.h:
1817
1818 2017-04-26  Alex Christensen  <achristensen@webkit.org>
1819
1820         Make user script injection more robust
1821         https://bugs.webkit.org/show_bug.cgi?id=171339
1822         <rdar://problem/30643691>
1823
1824         Reviewed by Geoffrey Garen.
1825
1826         * loader/EmptyClients.cpp:
1827         * page/Frame.cpp:
1828         (WebCore::Frame::injectUserScripts):
1829         * page/UserContentController.cpp:
1830         (WebCore::UserContentController::forEachUserScript):
1831         (WebCore::UserContentController::forEachUserStyleSheet):
1832         (WebCore::UserContentController::forEachUserMessageHandler):
1833         * page/UserContentController.h:
1834         * page/UserContentProvider.h:
1835
1836 2017-04-26  Zalan Bujtas  <zalan@apple.com>
1837
1838         RTL: recent searches popover is displayed in incorrect location
1839         https://bugs.webkit.org/show_bug.cgi?id=171338
1840         <rdar://problem/31377807>
1841
1842         Reviewed by Dean Jackson.
1843
1844         Compute the absolute coordinates for the popup the same way we do for the select dropdown.
1845
1846         * rendering/RenderSearchField.cpp:
1847         (WebCore::RenderSearchField::showPopup):
1848
1849 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
1850
1851         Restrict WebKit image formats to a known whitelist
1852         https://bugs.webkit.org/show_bug.cgi?id=170700
1853
1854         Reviewed by Tim Horton.
1855
1856         If the image format is not supported, the load should be canceled and the
1857         image is marked a broken image.
1858
1859         Test: fast/images/image-formats-support.html
1860
1861         * loader/cache/CachedImage.cpp:
1862         (WebCore::CachedImage::addIncrementalDataBuffer):
1863         (WebCore::CachedImage::setImageDataBuffer):
1864         (WebCore::CachedImage::finishLoading):
1865         * loader/cache/CachedImage.h:
1866
1867 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
1868
1869         [ATK] Implement support for new ARIA 1.1 values of aria-haspopup
1870         https://bugs.webkit.org/show_bug.cgi?id=171164
1871
1872         Reviewed by Chris Fleizach.
1873
1874         In ARIA 1.1, aria-haspopup's value type changed from true/false to a token.
1875         Values: true, false (default, unless it's a combobox), dialog, grid, listbox
1876         (default for combobox), menu, and tree. Any value of aria-haspopup that is
1877         not included in the list of allowed values, including an empty string, must
1878         be treated as if the value false had been provided.
1879
1880         Add AccessibilityObject::ariaPopupValue() to validate the value, handle implicit
1881         values, and give platform assistive technologies a means to access that value.
1882
1883         If there is a valid, non-false value of aria-haspopup, include ATK_STATE_HAS_POPUP
1884         in the AtkStateSet. Lastly, expose the value (rather than true/false) via the "haspop"
1885         AtkObject attribute.
1886
1887         Test: accessibility/gtk/aria-haspopup.html
1888
1889         * accessibility/AccessibilityObject.h:
1890         (WebCore::AccessibilityObject::ariaPopupValue):
1891         (WebCore::AccessibilityObject::supportsARIAHasPopup):
1892         * accessibility/AccessibilityRenderObject.cpp:
1893         (WebCore::AccessibilityRenderObject::ariaHasPopup):
1894         * accessibility/AccessibilityRenderObject.h:
1895         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1896         (webkitAccessibleGetAttributes):
1897         (setAtkStateSetFromCoreObject):
1898
1899 2017-04-26  Alex Christensen  <achristensen@webkit.org>
1900
1901         Fix CMake build.
1902
1903         * PlatformMac.cmake:
1904
1905 2017-04-26  Antti Koivisto  <antti@apple.com>
1906
1907         Enable expired-only reload policy on Mac and iOS
1908         https://bugs.webkit.org/show_bug.cgi?id=171264
1909         <rdar://problem/31807637>
1910
1911         Reviewed by Andreas Kling.
1912
1913         Limit the behavior to http and data URLs (where we explicitly know about expiration).
1914
1915         * html/HTMLLinkElement.cpp:
1916         (WebCore::HTMLLinkElement::setCSSStyleSheet):
1917         * loader/FrameLoader.cpp:
1918         (WebCore::FrameLoader::subresourceCachePolicy):
1919
1920             Pass the URL so we can test for protocol.
1921
1922         * loader/FrameLoader.h:
1923         * loader/NavigationAction.cpp:
1924         (WebCore::navigationType):
1925
1926             Test for reload navigation type correctly.
1927
1928         * loader/cache/CachedResource.cpp:
1929         (WebCore::CachedResource::load):
1930         * loader/cache/CachedResourceLoader.cpp:
1931         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
1932         (WebCore::CachedResourceLoader::cachePolicy):
1933         * loader/cache/CachedResourceLoader.h:
1934
1935 2017-04-26  WebKit Contributor  <webkitcontrib@gmail.com>
1936
1937         Response.blob() does not set the content-type based on the header value.
1938         https://bugs.webkit.org/show_bug.cgi?id=170849
1939
1940         Reviewed by Alex Christensen.
1941
1942         The Fetch API specification requires setting the blob contentType
1943         using the Content-Type header value, if present.  Previously the
1944         FetchResponse class only called updateContentType() when first
1945         created even though all the headers were not available.  Call
1946         updateContentType() again after the headers are populated.
1947
1948         This change allows WebKit to pass the "Consume response's body: from
1949         fetch to blob" case in the WPT response-consume.html test.
1950
1951         Test: http://w3c-test.org/fetch/api/response/response-consume.html
1952
1953         * Modules/fetch/FetchResponse.cpp:
1954         (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Modified to
1955         call FetchBodyOwner::updateContentType() after filling m_headers.
1956
1957 2017-04-26  Andy Estes  <aestes@apple.com>
1958
1959         Try to fix the macOS Sierra build.
1960
1961         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
1962
1963 2017-04-26  Andy Estes  <aestes@apple.com>
1964
1965         [macOS] Add picture-in-picture support to WebPlaybackControlsManager
1966         https://bugs.webkit.org/show_bug.cgi?id=171328
1967         <rdar://problem/29875010>
1968
1969         Reviewed by Jer Noble.
1970
1971         * platform/cocoa/WebPlaybackSessionModel.h:
1972         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
1973         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1974         (WebCore::WebPlaybackSessionModelMediaElement::togglePictureInPicture): If the media element
1975         is currently in PiP fullscreen mode, exit fullscreen. Otherwise, enter PiP fullscreen mode.
1976         * platform/mac/WebPlaybackControlsManager.h:
1977         * platform/mac/WebPlaybackControlsManager.mm:
1978         (-[WebPlaybackControlsManager canTogglePictureInPicture]): Added. Returns YES if
1979         -allowsPictureInPicturePlayback returns YES.
1980         (-[WebPlaybackControlsManager togglePictureInPicture]): Added. Calls
1981         WebPlaybackSessionModel::togglePictureInPicture().
1982         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
1983         (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen): Added a call to
1984         -[WebPlaybackControlsManager setPictureInPictureActive:YES].
1985         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen): Added a call to
1986         -[WebPlaybackControlsManager setPictureInPictureActive:NO].
1987         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): Ditto.
1988         * platform/spi/cocoa/AVKitSPI.h: Declared new SPI on AVTouchBarPlaybackControlsControlling.
1989
1990 2017-04-25  Dean Jackson  <dino@apple.com>
1991
1992         [Color] Make gradients work with ExtendedColors
1993         https://bugs.webkit.org/show_bug.cgi?id=171315
1994         <rdar://problems/31830177>
1995
1996         Reviewed by Antoine Quint.
1997
1998         Allow gradients to hold Color objects, and thus
1999         handle ExtendedColor. Implement the backend for
2000         CoreGraphics.
2001
2002         Test: css3/color/gradients.html
2003
2004         * platform/graphics/Gradient.cpp:
2005         (WebCore::Gradient::addColorStop): Just copy the Color now.
2006         (WebCore::compareStops): Handle rename of stop to offset.
2007         (WebCore::Gradient::hasAlpha): Use Color's helper.
2008         * platform/graphics/Gradient.h:
2009         (WebCore::Gradient::ColorStop::ColorStop): Rename stop
2010         to offset, and store a Color rather than four floating
2011         point values.
2012         * platform/graphics/cairo/GradientCairo.cpp:
2013         (WebCore::Gradient::platformGradient):
2014         * platform/graphics/cg/GradientCG.cpp:
2015         (WebCore::Gradient::platformGradient): Use the CG method
2016         that can handle CGColorRefs with ColorSpace values, and
2017         pass the Extended sRGB space which should be no change for
2018         all existing gradients but also handle ColorSpaces like
2019         Display P3.
2020         * platform/graphics/win/GradientDirect2D.cpp:
2021         (WebCore::Gradient::generateGradient):
2022         * svg/SVGGradientElement.cpp:
2023         (WebCore::SVGGradientElement::buildStops):
2024
2025 2017-04-25  Alex Christensen  <achristensen@webkit.org>
2026
2027         Encoded filename should be decoded for WKContentExtension.identifier
2028         https://bugs.webkit.org/show_bug.cgi?id=171316
2029
2030         Reviewed by Andy Estes.
2031
2032         * platform/FileSystem.h:
2033
2034 2017-04-26  Frederic Wang  <fwang@igalia.com>
2035
2036         Fix typo in RenderFrameBase
2037         https://bugs.webkit.org/show_bug.cgi?id=171324
2038
2039         Reviewed by Zalan Bujtas.
2040
2041         No new tests, behavior unchanged.
2042
2043         * rendering/RenderFrameBase.cpp:
2044         (WebCore::RenderFrameBase::layoutWithFlattening):
2045         (WebCore::RenderFrameBase::performLayoutWithFlattening):
2046         (WebCore::RenderFrameBase::peformLayoutWithFlattening): Deleted.
2047         * rendering/RenderFrameBase.h:
2048
2049 2017-04-26  Zalan Bujtas  <zalan@apple.com>
2050
2051         Forced page break on :after triggers infinite loop in column balancing
2052         https://bugs.webkit.org/show_bug.cgi?id=171309
2053         rdar://problem/26285884
2054
2055         Reviewed by David Hyatt.
2056
2057         Stop trying to balance the columns when the forced page breaks >= the number of
2058         columns even when this number is 1. Content will always overflow to the next page.
2059         see https://chromium.googlesource.com/chromium/src/+/fbbebf38cefb2712c912581eccb046ef363ec84e%5E%21/#F2 
2060
2061         Test: fast/multicol/infinite-loop-when-forced-break.html
2062
2063         * rendering/RenderMultiColumnSet.cpp:
2064         (WebCore::RenderMultiColumnSet::calculateBalancedHeight):
2065
2066 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
2067
2068         Attempt to fix a JetStream regression.
2069         <rdar://problem/31742414>
2070
2071         Unreviewed.
2072
2073         Disable async decoding for large images till the flickering bug wk170640
2074         is fixed.
2075
2076         * platform/graphics/BitmapImage.cpp:
2077         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages):
2078
2079 2017-04-26  Ryan Haddad  <ryanhaddad@apple.com>
2080
2081         Unreviewed, rolling out r215767.
2082
2083         The LayoutTest for this change is a flaky failure.
2084
2085         Reverted changeset:
2086
2087         "Restrict WebKit image formats to a known whitelist"
2088         https://bugs.webkit.org/show_bug.cgi?id=170700
2089         http://trac.webkit.org/changeset/215767
2090
2091 2017-04-26  Dave Hyatt  <hyatt@apple.com>
2092
2093         Improve wavy underline rendering
2094         https://bugs.webkit.org/show_bug.cgi?id=171281
2095
2096         Reviewed by Sam Weinig.
2097
2098         Change wavy underline rendering to use font size instead of stroke
2099         thickness as a way to tune it. Cut the extra offset from 2 to 1.
2100         Change the parameters to make the line flatter and to make the proportion
2101         of the wave that renders underneath a glyph the same.
2102
2103         * rendering/TextDecorationPainter.cpp:
2104         (WebCore::strokeWavyTextDecoration):
2105         (WebCore::TextDecorationPainter::paintTextDecoration):
2106         * style/InlineTextBoxStyle.cpp:
2107         (WebCore::getWavyStrokeParameters):
2108         (WebCore::visualOverflowForDecorations):
2109         * style/InlineTextBoxStyle.h:
2110         (WebCore::wavyOffsetFromDecoration):
2111
2112 2017-04-24  Sergio Villar Senin  <svillar@igalia.com>
2113
2114         [css-grid] Remove most of the usage of SizingOperation
2115         https://bugs.webkit.org/show_bug.cgi?id=171225
2116
2117         Reviewed by Darin Adler.
2118
2119         SizingOperation was added as a way to modify the behaviour of the track sizing algorithm
2120         with the specifics for intrinsic size computations. The problem is that although intrinsic
2121         size computation does imply indefinite sizes, the opposite is not always true. For example,
2122         a grid container with height:auto would compute the row sizes with an indefinite size but is
2123         not part of the intrinsic size (preferred widths) computation.
2124
2125         That's why it was wrongly used in some parts of the current code, in most of the cases is
2126         more than enough to check whether the available space is indefinite or not. In order to do
2127         that we have to keep both available sizes (height & width) around all the time to properly
2128         support orthogonal flows.
2129
2130         This change does not imply any change in behaviour.
2131
2132         * rendering/GridTrackSizingAlgorithm.cpp:
2133         (WebCore::GridTrackSizingAlgorithm::setAvailableSpace):
2134         (WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize):
2135         (WebCore::GridTrackSizingAlgorithm::initialBaseSize):
2136         (WebCore::GridTrackSizingAlgorithm::initialGrowthLimit):
2137         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
2138         (WebCore::GridTrackSizingAlgorithm::increaseSizesToAccommodateSpanningItems):
2139         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild):
2140         (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild):
2141         (WebCore::GridTrackSizingAlgorithm::gridTrackSize):
2142         (WebCore::IndefiniteSizeStrategy::findUsedFlexFraction):
2143         (WebCore::IndefiniteSizeStrategy::recomputeUsedFlexFractionIfNeeded):
2144         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
2145         (WebCore::GridTrackSizingAlgorithm::setup):
2146         (WebCore::GridTrackSizingAlgorithm::reset):
2147         * rendering/GridTrackSizingAlgorithm.h:
2148         (WebCore::GridTrackSizingAlgorithmStrategy::availableSpace):
2149         * rendering/RenderGrid.cpp:
2150         (WebCore::RenderGrid::availableSpaceForGutters):
2151         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
2152         (WebCore::RenderGrid::computeTrackSizesForDefiniteSize):
2153         (WebCore::RenderGrid::layoutBlock):
2154         (WebCore::RenderGrid::gridGap):
2155         (WebCore::RenderGrid::guttersSize):
2156         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
2157         (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize):
2158         (WebCore::RenderGrid::computeAutoRepeatTracksCount):
2159         (WebCore::RenderGrid::placeItemsOnGrid):
2160         (WebCore::RenderGrid::trackSizesForComputedStyle):
2161         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
2162         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
2163         (WebCore::RenderGrid::populateGridPositionsForDirection):
2164         (WebCore::RenderGrid::columnAxisOffsetForChild):
2165         (WebCore::RenderGrid::rowAxisOffsetForChild):
2166         (WebCore::RenderGrid::gridGapForDirection): Deleted.
2167         * rendering/RenderGrid.h:
2168
2169 2017-04-26  Frederic Wang  <fwang@igalia.com>
2170
2171         Remove Document::*FrameElementsShouldIgnoreScrolling
2172         https://bugs.webkit.org/show_bug.cgi?id=171271
2173
2174         Reviewed by Chris Dumez.
2175
2176         setFrameElementsShouldIgnoreScrolling and frameElementsShouldIgnoreScrolling were
2177         introduced bug 23072 in order to work around a bug in the Dictionary application.
2178         However, this was removed in bug 132095 and hence the functions are no longer necessary.
2179
2180         No new tests.
2181
2182         * dom/Document.h:
2183         (WebCore::Document::setFrameElementsShouldIgnoreScrolling): Deleted.
2184         (WebCore::Document::frameElementsShouldIgnoreScrolling): Deleted.
2185         * html/HTMLFrameElementBase.cpp:
2186         (WebCore::HTMLFrameElementBase::parseAttribute):
2187
2188 2017-04-26  Zan Dobersek  <zdobersek@igalia.com>
2189
2190         [GCrypt] CryptoKeyRSA: implement create(), keySizeInBits(), buildAlgorithm(), exportData()
2191         https://bugs.webkit.org/show_bug.cgi?id=171213
2192
2193         Reviewed by Michael Catanzaro.
2194
2195         CryptoKeyRSA::create() validates the specified key type along with the
2196         provided data. If everything is OK, it then proceeds to build the key
2197         of the appropriate type through an s-expression that is constructed with
2198         the necessary data. We don't currently support creating private keys
2199         with any additional prime information (apart from p and q).
2200
2201         CryptoKeyRSA::keySizeInBits() calls the helper getRSAModulusLength()
2202         function that find the modulus MPI in the key s-expression and returns
2203         the modulus data length in bits.
2204
2205         CryptoKeyRSA::buildAlgorithm() returns KeyAlgorithm that's constructed
2206         from the appropriate name, this key's modulus length, and this key's
2207         public exponent data. It also specifies the hash if there is such a
2208         restriction for this key.
2209
2210         CryptoKeyRSA::exportData() returns a properly-constructed
2211         CryptoKeyDataRSAComponents object. The public modulus and exponent are
2212         used in case the key is public. If the key is private, the secret
2213         exponent and the p and q prime numbers are retrieved in MPI format.
2214         They're then used to calculate the dp, dq and qi parameters that are
2215         exported in the JWK format. Note that libgcrypt internally switches
2216         the p and q prime numbers such that p < q, but the Web Crypto
2217         specification and the dependant RFCs expect that q < p. We address
2218         this by simply switching the roles of the two primes and follow the
2219         usual q < p assumption when exporting the primes and computing the
2220         dependant exponents and coefficients.
2221
2222         No new tests -- existing ones cover this but don't work yet due to missing
2223         RSA-related CryptoAlgorithm implementations.
2224
2225         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2226         (WebCore::getRSAModulusLength):
2227         (WebCore::getParameterMPIData):
2228         (WebCore::getRSAKeyParameter):
2229         (WebCore::CryptoKeyRSA::create):
2230         (WebCore::CryptoKeyRSA::keySizeInBits):
2231         (WebCore::CryptoKeyRSA::buildAlgorithm):
2232         (WebCore::CryptoKeyRSA::exportData):
2233
2234 2017-04-25  Jiewen Tan  <jiewen_tan@apple.com>
2235
2236         [WebCrypto] Enhance ways to convert an ECDSA signature binary into DER format
2237         https://bugs.webkit.org/show_bug.cgi?id=171287
2238         <rdar://problem/31735332>
2239
2240         Reviewed by Brent Fulgham.
2241
2242         Covered by existing tests.
2243
2244         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
2245         (WebCore::verifyECDSA):
2246
2247 2017-04-25  Brent Fulgham  <bfulgham@apple.com>
2248
2249         Relax the event firing ASSERT for Attr changes
2250         https://bugs.webkit.org/show_bug.cgi?id=171236
2251         <rdar://problem/30516349>
2252
2253         Reviewed by Dean Jackson.
2254
2255         The assertions added in Bug 167318 were overly strict, and trigger for valid behavior.
2256         Relax the assertion preventing event dispatch for the case of Attr elements at the
2257         end of childrenChanged.
2258
2259         Test: fast/dom/HTMLLinkElement/event-while-removing-attribute.html
2260
2261         * dom/Attr.cpp:
2262         (WebCore::Attr::childrenChanged):
2263
2264 2017-04-25  John Wilander  <wilander@apple.com>
2265
2266         Resource Load Statistics: Introduce shorter time-to-live for cookie partition whitelisting
2267         https://bugs.webkit.org/show_bug.cgi?id=171295
2268         <rdar://problem/31823818>
2269
2270         Reviewed by Brent Fulgham.
2271
2272         Test: http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html
2273
2274         * loader/ResourceLoadObserver.cpp:
2275         (WebCore::reduceTimeResolutionToOneDay): Deleted.
2276         (WebCore::reduceTimeResolution):
2277             Changed name to no longer lock this to a specific resolution.
2278         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2279             Now calls WebCore::reduceTimeResolution().
2280         (WebCore::ResourceLoadObserver::setTimeToLiveCookiePartitionFree):
2281             Added for testing purposes.
2282         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
2283             Added for testing purposes.
2284         * loader/ResourceLoadObserver.h:
2285         * loader/ResourceLoadStatisticsStore.cpp:
2286         (WebCore::shouldPartitionCookies):
2287             Static inline convenience function.
2288         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
2289             Now decides whether a domain should get partitioned cookies
2290             based on timeToLiveCookiePartitionFree.
2291             Removed clearFirst parameter since it's not needed here
2292             and it introduced complexity in keeping the store and the
2293             network process cache in sync.
2294         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
2295             Added for testing purposes.
2296         * loader/ResourceLoadStatisticsStore.h:
2297
2298 2017-04-25  Saam Barati  <sbarati@apple.com>
2299
2300         JSArray::isArrayPrototypeIteratorProtocolFastAndNonObservable is wrong because it does not do the necessary checks on the base object
2301         https://bugs.webkit.org/show_bug.cgi?id=171150
2302         <rdar://problem/31771880>
2303
2304         Reviewed by Sam Weinig.
2305
2306         This patch moves the sequence converters to use the now fixed
2307         JSArray::isArrayPrototypeIteratorProtocolFastAndNonObservable test
2308         inside JSC.
2309         
2310         This patch also fixes a few bugs:
2311         1. Converting to a sequence of numbers must prove that the JSArray
2312         is filled only with Int32/Double. If there is a chance the array
2313         contains objects, the conversion to a numeric IDLType can be observable
2314         (via valueOf()), and can change the iterator protocol.
2315         2. There are other conversions that can have side effects a-la valueOf().
2316         This patch introduces a new static constant in the various Converter
2317         classes that tell the sequence converter if the conversion operation
2318         can have JS side effects. If it does have side effects, we fall back to
2319         the generic conversion that uses the iterator protocol. If not, we can
2320         do a faster version that iterates over each element of the array,
2321         reading it directly, and converting it.
2322
2323         Tests: js/sequence-iterator-protocol-2.html
2324                js/sequence-iterator-protocol.html
2325
2326         * bindings/js/JSDOMConvertAny.h: Does not have side effects.
2327         * bindings/js/JSDOMConvertBase.h: We pessimistically assume inside DefaultConverter that converions have side effects.
2328         * bindings/js/JSDOMConvertBoolean.h: Does not have side effects.
2329         * bindings/js/JSDOMConvertCallbacks.h: Does not have side effects.
2330         * bindings/js/JSDOMConvertObject.h: Does not have side effects.
2331         * bindings/js/JSDOMConvertSequences.h:
2332         (WebCore::Detail::NumericSequenceConverter::convert):
2333         (WebCore::Detail::SequenceConverter::convert):
2334
2335 2017-04-25  Michael Saboff  <msaboff@apple.com>
2336
2337         Call bmalloc scavenger first when handling a memory pressure event
2338         https://bugs.webkit.org/show_bug.cgi?id=171289
2339
2340         Reviewed by Geoffrey Garen.
2341
2342         Let bmalloc free any pages to the OS that it can before doing anything else.
2343
2344         * page/MemoryRelease.cpp:
2345         (WebCore::releaseMemory):
2346
2347 2017-04-25  Dean Jackson  <dino@apple.com>
2348
2349         Skip WebKitAdditions for Safari Technology Preview media controls
2350         https://bugs.webkit.org/show_bug.cgi?id=171302
2351         <rdar://problem/31823256>
2352
2353         Reviewed by Simon Fraser.
2354
2355         Safari Technology Preview should use the same controls
2356         as OpenSource.
2357
2358         * WebCore.xcodeproj/project.pbxproj:
2359
2360 2017-04-25  Ryan Haddad  <ryanhaddad@apple.com>
2361
2362         Unreviewed, rolling out r215730.
2363
2364         The LayoutTest for this change is a flaky timeout on mac-wk1
2365         debug.
2366
2367         Reverted changeset:
2368
2369         "Enable expired-only reload policy on Mac and iOS"
2370         https://bugs.webkit.org/show_bug.cgi?id=171264
2371         http://trac.webkit.org/changeset/215730
2372
2373 2017-04-24  Matt Rajca  <mrajca@apple.com>
2374
2375         Indicate presence of audio when handling autoplay events.
2376         https://bugs.webkit.org/show_bug.cgi?id=171227
2377
2378         Reviewed by Alex Christensen.
2379
2380         Added API tests.
2381
2382         * html/HTMLMediaElement.cpp:
2383         (WebCore::HTMLMediaElement::handleAutoplayEvent):
2384         (WebCore::HTMLMediaElement::playInternal):
2385         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
2386         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
2387         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
2388         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture):
2389         * html/HTMLMediaElement.h:
2390         * page/AutoplayEvent.h:
2391         * page/ChromeClient.h:
2392
2393 2017-04-25  Aakash Jain  <aakash_jain@apple.com>
2394
2395         WebCore.framework should restrict allowable_clients
2396         https://bugs.webkit.org/show_bug.cgi?id=171260
2397
2398         Reviewed by Alexey Proskuryakov.
2399
2400         * Configurations/WebCore.xcconfig: Adding allowable_client to all platform, in order to restrict WebCore
2401         from being directly linked on any platform.
2402         Moved WebKitLegacy and WebCoreTestSupport to OTHER_LDFLAGS_BASE.
2403         Removed WebKit2 as allowable_client from mac.
2404         Added iTunesU, Casablanca and Remote to OTHER_LDFLAGS_BASE_ios for iTunes related projects.
2405         Added WebKit, TVBooks, DumpRenderTree, WebKitTestRunner and TestWebKitAPI to OTHER_LDFLAGS_BASE_ios.
2406
2407 2017-04-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
2408
2409         Restrict WebKit image formats to a known whitelist
2410         https://bugs.webkit.org/show_bug.cgi?id=170700
2411
2412         Reviewed by Tim Horton.
2413
2414         If the image format is not supported, the load should be canceled and the
2415         image is marked a broken image.
2416
2417         Test: fast/images/image-formats-support.html
2418
2419         * loader/cache/CachedImage.cpp:
2420         (WebCore::CachedImage::addIncrementalDataBuffer):
2421         (WebCore::CachedImage::setImageDataBuffer):
2422         (WebCore::CachedImage::finishLoading):
2423         * loader/cache/CachedImage.h:
2424
2425 2017-04-25  Youenn Fablet  <youenn@apple.com>
2426
2427         CoreAudioCaptureSource::suspend is asserting too often
2428         https://bugs.webkit.org/show_bug.cgi?id=171285
2429
2430         Reviewed by Eric Carlson.
2431
2432         No change of behavior.
2433
2434         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2435         (WebCore::CoreAudioCaptureSource::suspend): Moving the assertion to where it might be useful.
2436
2437 2017-04-25  Daniel Bates  <dabates@apple.com>
2438
2439         Use an OptionSet for compositing reasons bitmask
2440         https://bugs.webkit.org/show_bug.cgi?id=171153
2441
2442         Reviewed by Simon Fraser.
2443
2444         We should make use of OptionSet to represent the bitmask of the reasons a layer
2445         was composited instead of using an integer and bitwise operations.
2446
2447         * inspector/InspectorLayerTreeAgent.cpp:
2448         (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
2449         * rendering/RenderLayerCompositor.cpp:
2450         (WebCore::RenderLayerCompositor::reasonsForCompositing):
2451         (WebCore::RenderLayerCompositor::logReasonsForCompositing): Also fix code style issues;
2452         an else-if statement should be written as an if-statement when the prior if-statement
2453         concludes with a return statement.
2454         * rendering/RenderLayerCompositor.h:
2455
2456 2017-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
2457
2458         Supplementary Multilingual Plane Complex Scripts Rendered Incorrectly
2459         https://bugs.webkit.org/show_bug.cgi?id=171272
2460         <rdar://problem/30966764>
2461
2462         Reviewed by Zalan Bujtas.
2463
2464         These scripts need to take the complex text codepath.
2465
2466         Test: fast/text/kaithi.html
2467
2468         * platform/graphics/FontCascade.cpp:
2469         (WebCore::FontCascade::characterRangeCodePath):
2470
2471 2017-04-25  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2472
2473         [GTK] Revert r215745 (especulative build fix) after r215752.
2474         https://bugs.webkit.org/show_bug.cgi?id=170842
2475
2476         Unreviewed.
2477
2478         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2479         (WebCore::normalizeCharacters):
2480
2481 2017-04-25  Daniel Bates  <dabates@apple.com>
2482
2483         [Cocoa][Win] Enable of X-Content-Type-Options: nosniff header
2484         https://bugs.webkit.org/show_bug.cgi?id=136452
2485         <rdar://problem/23412620>
2486
2487         Reviewed by Brent Fulgham.
2488
2489         Enable support for X-Content-Type-Options: nosniff on Mac, iOS and Windows.
2490
2491         Additionally, honor X-Content-Type-Options: nosniff header for stylesheets as per
2492         <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff%3F> (30 March 2017).
2493
2494         Test: http/tests/security/contentTypeOptions/nosniff-dynamic-script-blocked.html
2495
2496         * Configurations/FeatureDefines.xcconfig:
2497         * css/StyleSheetContents.cpp:
2498         (WebCore::StyleSheetContents::parseAuthorStyleSheet): Log an error if the stylesheet
2499         has the nosniff header and does not have a valid MIME type. Also update code for
2500         renaming of MIMETypeCheck to MIMETypeCheckHint.
2501         (WebCore::StyleSheetContents::notifyLoadedSheet): If the stylesheet is blocked by
2502         nosniff then consider it analogous to a load error so that we dispatch a DOM error
2503         event at the <style>/<link> element.
2504         * dom/LoadableClassicScript.cpp:
2505         (WebCore::LoadableClassicScript::notifyFinished): Modified the wording of the error
2506         message when a script is disallowed by nosniff so as to more closely match the
2507         wording used when a stylesheet is disallowed by nonsniff.
2508         * loader/cache/CachedCSSStyleSheet.cpp:
2509         (WebCore::CachedCSSStyleSheet::sheetText): Update for renaming of MIMETypeCheck
2510         to MIMETypeCheckHint.
2511         (WebCore::CachedCSSStyleSheet::responseMIMEType): Added.
2512         (WebCore::CachedCSSStyleSheet::mimeTypeAllowedByNosniff): Added.
2513         (WebCore::CachedCSSStyleSheet::canUseSheet): Modified to check if the X-Content-Type-Options: nosniff
2514         header is in the HTTP response for the stylesheet. If it is then we can only use the stylesheet
2515         if its content-type is "text/css". Otherwise, apply the existing criterion for determining whether
2516         to to use the stylesheet.
2517         * loader/cache/CachedCSSStyleSheet.h: Rename MIMETypeCheck to MIMETypeCheckHint to better
2518         describe its purpose as a hint as to whether to enforce MIME type checking for the stylesheet.
2519         Processing of the HTTP header X-Content-Type-Options takes precedence over this hint.
2520         * loader/cache/CachedScript.h: Make mimeType() private.
2521
2522 2017-04-25  Daniel Bates  <dabates@apple.com>
2523
2524         [Cocoa][Win] Enable of X-Content-Type-Options: nosniff header
2525         https://bugs.webkit.org/show_bug.cgi?id=136452
2526         <rdar://problem/23412620>
2527
2528         Reviewed by Brent Fulgham.
2529
2530         Part 1
2531
2532         Enable X-Content-Type-Options: nosniff on Mac, iOS and Windows platforms.
2533
2534         * Configurations/FeatureDefines.xcconfig:
2535
2536 2017-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
2537
2538         [GTK] Build fix after r215737
2539         https://bugs.webkit.org/show_bug.cgi?id=170842
2540
2541         Unreviewed.
2542
2543         No new tests because there is no behavior change.
2544
2545         * platform/graphics/FontCascade.h:
2546         (WebCore::FontCascade::treatAsZeroWidthSpace):
2547         (WebCore::FontCascade::treatAsZeroWidthSpaceInComplexScript):
2548
2549 2017-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2550
2551         Remove an unnecessary -respondsToSelector: check after r215724
2552
2553         Rubber-stamped by Tim Horton.
2554
2555         Addresses review feedback from <https://bugs.webkit.org/show_bug.cgi?id=171156>. -[NSURL _title]
2556         will always for builds that need to access it.
2557
2558         * platform/ios/PlatformPasteboardIOS.mm:
2559         (WebCore::PlatformPasteboard::readURL):
2560
2561 2017-04-25  Antti Koivisto  <antti@apple.com>
2562
2563         REGRESSION (r215469): [ios-simulator-wk2] LayoutTest compositing/animation/animation-backing.html is a flaky failure
2564         https://bugs.webkit.org/show_bug.cgi?id=171060
2565         <rdar://problem/31771174>
2566
2567         Reviewed by Simon Fraser.
2568
2569         Accelerated transform animations move underlying layers without invalidating GraphicsLayers.
2570         To update tile coverage we need to commit such subtrees even if there are not other changes.
2571
2572         * platform/graphics/ca/GraphicsLayerCA.cpp:
2573         (WebCore::GraphicsLayerCA::GraphicsLayerCA):
2574         (WebCore::GraphicsLayerCA::needsCommit):
2575
2576             Commit subtrees with accelerated transform animations.
2577             Factor into a function.
2578
2579         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2580
2581             Track if descendants had any accelerated transform animations after commit.
2582
2583         * platform/graphics/ca/GraphicsLayerCA.h:
2584         (WebCore::GraphicsLayerCA::hasDescendantsWithRunningTransformAnimations):
2585         (WebCore::GraphicsLayerCA::setHasDescendantsWithRunningTransformAnimations):
2586
2587 2017-04-25  Eric Carlson  <eric.carlson@apple.com>
2588
2589         [MediaStream macOS] Unable to apply frameRate constraint
2590         https://bugs.webkit.org/show_bug.cgi?id=171279
2591
2592         Reviewed by Youenn Fablet.
2593
2594         No new tests, this doesn't affect the mock capture devices.
2595
2596         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2597         (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate): Cast frame rate
2598         ranges to int before comparing.
2599
2600 2017-04-25  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2601
2602         [GTK] Build fix after r215737
2603         https://bugs.webkit.org/show_bug.cgi?id=170842
2604
2605         Unreviewed.
2606
2607         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2608         (WebCore::normalizeCharacters):
2609
2610 2017-04-25  John Wilander  <wilander@apple.com>
2611
2612         Resource Load Statistics: Clear network process cache when clearing store
2613         https://bugs.webkit.org/show_bug.cgi?id=171256
2614         <rdar://problem/31802347>
2615
2616         Reviewed by Brent Fulgham.
2617
2618         Test that covers this code:
2619         http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html
2620
2621         * loader/ResourceLoadObserver.cpp:
2622         (WebCore::ResourceLoadObserver::clearInMemoryStore):
2623             Better name.
2624         (WebCore::ResourceLoadObserver::logUserInteraction):
2625             Now passes on the boolean parameter clearFirst to
2626             ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
2627         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
2628             Now takes and passes on the boolean parameter clearFirst to
2629             ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
2630         (WebCore::ResourceLoadObserver::statisticsStore): Deleted.
2631             This getter violated abstraction. The way it was used
2632             is now solved through dedicated functions.
2633         * loader/ResourceLoadObserver.h:
2634         * loader/ResourceLoadStatisticsStore.cpp:
2635         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
2636             Now passes on the boolean parameter clearFirst to
2637             ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
2638         (WebCore::ResourceLoadStatisticsStore::clearInMemory):
2639             Better name.
2640             Now triggers clearing of the associated network process cache.
2641         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
2642             Now calls clearInMemory().
2643         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
2644             Now expects a handler with the boolean parameter clearFirst.
2645         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
2646             Now takes and passes on the boolean parameter clearFirst to
2647             m_shouldPartitionCookiesForDomainsHandler().
2648         * loader/ResourceLoadStatisticsStore.h:
2649         (WebCore::ResourceLoadStatisticsStore::clear): Deleted.
2650         * platform/network/NetworkStorageSession.h:
2651             NetworkStorageSession::setShouldPartitionCookiesForHosts() now
2652             takes the boolean parameter clearFirst.
2653         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2654         (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
2655             Now clears m_topPrivatelyControlledDomainsForCookiePartitioning
2656             if the boolean parameter clearFirst is true.
2657
2658 2017-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
2659
2660         Add performance test for FontCache::systemFallbackForCharacters()
2661         https://bugs.webkit.org/show_bug.cgi?id=170842
2662
2663         Reviewed by Tim Horton.
2664
2665         No new tests because there is no behavior change.
2666
2667         * platform/graphics/FontCascade.h:
2668         (WebCore::FontCascade::treatAsZeroWidthSpace):
2669         (WebCore::FontCascade::treatAsZeroWidthSpaceInComplexScript): Deleted.
2670         * platform/graphics/WidthCache.h:
2671         (WebCore::WidthCache::add):
2672         (WebCore::WidthCache::addSlowCase):
2673
2674 2017-04-25  Chris Dumez  <cdumez@apple.com>
2675
2676         Content-Disposition header filename is ignored when 'download' attribute is specified in HTML
2677         https://bugs.webkit.org/show_bug.cgi?id=171239
2678         <rdar://problem/31789855>
2679
2680         Reviewed by Alex Christensen.
2681
2682         Add isAttachmentWithFilename() utility method to ResourceResponse to implement:
2683         - https://html.spec.whatwg.org/#as-a-download (Step 2)
2684
2685         Test: http/tests/download/anchor-download-attribute-content-disposition.html
2686
2687         * platform/network/ResourceResponseBase.cpp:
2688         (WebCore::ResourceResponseBase::isAttachmentWithFilename):
2689         * platform/network/ResourceResponseBase.h:
2690
2691 2017-04-25  Antti Koivisto  <antti@apple.com>
2692
2693         Enable expired-only reload policy on Mac and iOS
2694         https://bugs.webkit.org/show_bug.cgi?id=171264
2695         <rdar://problem/31807637>
2696
2697         Reviewed by Andreas Kling.
2698
2699         * loader/NavigationAction.cpp:
2700         (WebCore::navigationType):
2701
2702         Test for reload navigation type correctly.
2703
2704 2017-04-25  Miguel Gomez  <magomez@igalia.com>
2705
2706         Image decoders must have private constructors to avoid refcount misuse: ASSERTION FAILED: m_deletionHasBegun when destroying ImageDecoder
2707         https://bugs.webkit.org/show_bug.cgi?id=171211
2708
2709         Reviewed by Carlos Garcia Campos.
2710
2711         Add a create method to each of the decoders and set their constructors as private. Change
2712         ICOImageDecoder to store its internal PNG decoders as RefPtr and use the new create method, and
2713         change ImageDecoder to use the create methods as well.
2714
2715         Covered by existent tests.
2716
2717         * platform/image-decoders/ImageDecoder.cpp:
2718         (WebCore::ImageDecoder::create):
2719         * platform/image-decoders/bmp/BMPImageDecoder.h:
2720         * platform/image-decoders/gif/GIFImageDecoder.h:
2721         * platform/image-decoders/ico/ICOImageDecoder.cpp:
2722         (WebCore::ICOImageDecoder::decodeAtIndex):
2723         * platform/image-decoders/ico/ICOImageDecoder.h:
2724         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
2725         * platform/image-decoders/png/PNGImageDecoder.h:
2726         * platform/image-decoders/webp/WEBPImageDecoder.h:
2727
2728 2017-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
2729
2730         Build fix
2731
2732         Unreviewed.
2733
2734         No new tests because there is no behavior change.
2735
2736         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
2737         (WebCore::wrapSerializedCryptoKey):
2738         (WebCore::unwrapSerializedCryptoKey):
2739
2740 2017-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2741
2742         Support reading NSURL titles from the pasteboard when performing data interaction
2743         https://bugs.webkit.org/show_bug.cgi?id=171156
2744         <rdar://problem/31356937>
2745
2746         Reviewed by Tim Horton.
2747
2748         Support reading link titles from the pasteboard when performing data interaction. To do this, we refactor
2749         Pasteboard::readURL to take in an additional String& title which is ultimately plumbed to the PlatformPasteboard
2750         where it is set to the value of -[NSURL _title].
2751
2752         Test: DataInteractionTests.ExternalSourceTitledNSURL.
2753
2754         * editing/FrameSelection.h:
2755         * editing/ios/EditorIOS.mm:
2756         (WebCore::Editor::WebContentReader::readURL):
2757         * page/DragController.cpp:
2758         (WebCore::DragController::performDragOperation):
2759         (WebCore::DragController::concludeEditDrag):
2760
2761         Move calls to clearDragCaret() out of concludeEditDrag and into the call site, in performDragOperation after
2762         attempting to concludeEditDrag. This is done so that if the WebEditorClient queries whether the drag caret is
2763         in richly editable content for the purposes of generating a document fragment to insert, the answer will not
2764         always be false as a drop is occurring.
2765
2766         * platform/PasteboardStrategy.h:
2767         * platform/PlatformPasteboard.h:
2768         * platform/ios/PasteboardIOS.mm:
2769         (WebCore::Pasteboard::respectsUTIFidelities):
2770         (WebCore::Pasteboard::readString):
2771         * platform/ios/PlatformPasteboardIOS.mm:
2772         (WebCore::PlatformPasteboard::readURL):
2773
2774 2017-04-24  Andy VanWagoner  <thetalecrafter@gmail.com>
2775
2776         Clean up ICU headers
2777         https://bugs.webkit.org/show_bug.cgi?id=170997
2778
2779         Reviewed by JF Bastien.
2780
2781         Update all icu headers to 55.1
2782
2783         * icu/LICENSE: Update copyright
2784         * icu/README: Explain ICU headers for OS X better
2785         * icu/unicode/localpointer.h:
2786         (LocalPointer::LocalPointer):
2787         (LocalPointer::adoptInsteadAndCheckErrorCode):
2788         * icu/unicode/platform.h:
2789         * icu/unicode/putil.h:
2790         * icu/unicode/std_string.h:
2791         * icu/unicode/ubrk.h:
2792         * icu/unicode/uchar.h:
2793         * icu/unicode/ucnv.h:
2794         * icu/unicode/ucol.h:
2795         * icu/unicode/ucoleitr.h:
2796         * icu/unicode/uconfig.h:
2797         * icu/unicode/ucurr.h:
2798         * icu/unicode/uidna.h:
2799         * icu/unicode/uloc.h:
2800         * icu/unicode/umachine.h:
2801         * icu/unicode/unistr.h:
2802         (UnicodeString::getArrayStart):
2803         (UnicodeString::UnicodeString):
2804         (UnicodeString::hasShortLength):
2805         (UnicodeString::getShortLength):
2806         (UnicodeString::length):
2807         (UnicodeString::getCapacity):
2808         (UnicodeString::isBogus):
2809         (UnicodeString::isWritable):
2810         (UnicodeString::isBufferWritable):
2811         (UnicodeString::getBuffer):
2812         (UnicodeString::isEmpty):
2813         (UnicodeString::setZeroLength):
2814         (UnicodeString::setShortLength):
2815         (UnicodeString::setLength):
2816         (UnicodeString::setToEmpty):
2817         (UnicodeString::remove):
2818         * icu/unicode/urename.h:
2819         * icu/unicode/uscript.h:
2820         * icu/unicode/usearch.h:
2821         * icu/unicode/uset.h:
2822         * icu/unicode/ustring.h:
2823         * icu/unicode/utf8.h:
2824         * icu/unicode/utypes.h:
2825         * icu/unicode/uvernum.h:
2826
2827 2017-04-24  Jiewen Tan  <jiewen_tan@apple.com>
2828
2829         LayoutTests crypto/subtle/ecdsa-generate-key-sign-verify-p384.html and crypto/subtle/ecdsa-generate-key-sign-verify-p256.html are flaky failures
2830         https://bugs.webkit.org/show_bug.cgi?id=171059
2831         <rdar://problem/31734958>
2832
2833         Reviewed by Brent Fulgham.
2834
2835         Covered by existing tests.
2836
2837         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
2838         (WebCore::signECDSA):
2839         Enhance ways to convert the DER signatures produced from CommonCrypto to r||s.
2840
2841 2017-04-24  Manuel Rego Casasnovas  <rego@igalia.com>
2842
2843         [selectors4] :focus-within should use the flat tree
2844         https://bugs.webkit.org/show_bug.cgi?id=170899
2845
2846         Reviewed by Antti Koivisto.
2847
2848         This has been discussed in the following CSS WG issue:
2849         https://github.com/w3c/csswg-drafts/issues/1135
2850
2851         And the spec has been updated (https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo):
2852         "An element also matches :focus-within if one of its descendants in the flat tree
2853          (including non-element nodes, such as text nodes) matches the conditions for matching :focus."
2854
2855         Test: imported/w3c/web-platform-tests/css/selectors4/focus-within-shadow-006.html
2856
2857         * dom/Element.cpp:
2858         (WebCore::Element::setFocus): Use "flat tree" ("composed tree" in WebKit)
2859         to set focus-within flag.
2860
2861 2017-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
2862
2863         Respect fidelity order when reading web content from item providers
2864         https://bugs.webkit.org/show_bug.cgi?id=171155
2865         <rdar://problem/31356937>
2866
2867         Reviewed by Tim Horton.
2868
2869         Currently, when reading web content from pasteboards, we assume the old UIPasteboard/NSPasteboard model wherein
2870         the destination must determine which of the items is considered to have the highest fidelity for the purposes of
2871         inserting into an editable area. This destination-side fidelity ranking is determined solely by the NSArray
2872         returned from Pasteboard::supportedPasteboardTypes, which lists compatible types in order from highest fidelity
2873         to lowest fidelity. Pasteboard::read effectively iterates over this list of types in order, attempting to read
2874         highest fidelity types and bailing when it first successfully reads data.
2875
2876         However, when our pasteboard is backed by UIItemProviders, we should instead read pasteboard types in order of
2877         fidelity as specified by the source rather than the destination. To accomplish this, we introduce an alternate
2878         codepath, Pasteboard::readRespectingUTIFidelities, which we take if Pasteboard::respectsUTIFidelities is true
2879         (currently, this only applies for the purposes of data interaction). This version follows a different flow:
2880         for each item in the pasteboard, we ask for just the UTIs for that item, in order of fidelity. For each item,
2881         we then call readPasteboardWebContentDataForType to try and read data for that type, continuing until either
2882         all UTIs have been attempted, or reading was successful.
2883
2884         This patch makes two additional adjustments. First, we introduce Pasteboard::getTypesByFidelityForItemAtIndex,
2885         which is used by Pasteboard::readRespectingUTIFidelities when querying the list of supported UTIs for each
2886         pasteboard item, sorted by highest to lowest fidelity.
2887
2888         Secondly, we refactor logic to write to the item provider pasteboard in PlatformPasteboardIOS. Since we are
2889         now respecting fidelity rankings on the destination, the source must also register UTI types in the right
2890         fidelity order. While this was mostly achieved using our existing method of writing a list of object
2891         representations to the pasteboard and then all of the contents of a NSString => NSData dictionary containing
2892         private UTI data, this approach has two flaws:
2893         1.  We are unable to register high-priority custom types, followed by representing objects, followed by more
2894             lower-priority custom types, since we assume that all custom types follow all representing objects.
2895         2.  Since we're just iterating over a dictionary of NSString => NSData when registering custom UTI
2896             representations to the item provider, there cannot inherently be any fidelity ordering for custom types.
2897
2898         To address both of these issues, we introduce two new objects that encapsulate how we register data to the item
2899         provider pasteboard. WebItemProviderRegistrationInfo represents some data that can be registered to an item
2900         provider (either an object conforming to UIItemProviderWriting, or an NSString and NSData).
2901         WebItemProviderRegistrationInfoList represents a list of WebItemProviderRegistrationInfos in order of highest to
2902         lowest fidelity. In PlatformPasteboardIOS, we transform PasteboardWebContent, PasteboardImage, and PasteboardURL
2903         into a WebItemProviderRegistrationInfoList, which we then pass along to the WebItemProviderPasteboard. In
2904         WebItemProviderPasteboard, we traverse the list of WebItemProviderRegistrationInfos in the list and register
2905         each WebItemProviderRegistrationInfo's representing object or data to the item provider.
2906
2907         Test: DataInteractionTests.RespectsExternalSourceFidelityRankings.
2908
2909         * WebCore.xcodeproj/project.pbxproj:
2910         * platform/Pasteboard.h:
2911         * platform/PasteboardStrategy.h:
2912         * platform/PlatformPasteboard.h:
2913         * platform/ios/AbstractPasteboard.h:
2914         * platform/ios/AbstractPasteboard.mm: Removed.
2915
2916         Moves WebItemProviderData, formerly implemented in AbstractPasteboard.mm, into WebItemProviderPasteboard.mm.
2917         We can delete AbstractPasteboard.mm as a result.
2918
2919         * platform/ios/PasteboardIOS.mm:
2920         (WebCore::readPasteboardWebContentDataForType):
2921
2922         Pull out common logic for reading data given a UTI type from the pasteboard into the PasteboardWebContentReader.
2923         This is invoked from both the existing Pasteboard::read codepath, as well as the readRespectingUTIFidelities
2924         codepath.
2925
2926         (WebCore::Pasteboard::read):
2927
2928         Refactored to call the new readPasteboardWebContentDataForType helper. Behavior should not have changed, unless
2929         the pasteboard supports UTI fidelities.
2930
2931         (WebCore::Pasteboard::respectsUTIFidelities):
2932         (WebCore::Pasteboard::readRespectingUTIFidelities):
2933
2934         An alternative to Pasteboard::read that considers source-side fidelity rankings of UTIs.
2935
2936         * platform/ios/PlatformPasteboardIOS.mm:
2937         (WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex):
2938         (WebCore::PlatformPasteboard::writeObjectRepresentations):
2939
2940         Refactored to build a WebItemProviderRegistrationInfoList and pass it to the WebItemProviderPasteboard to
2941         register items and data.
2942
2943         (WebCore::PlatformPasteboard::write):
2944         * platform/ios/WebItemProviderPasteboard.h:
2945         * platform/ios/WebItemProviderPasteboard.mm:
2946         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]):
2947         (-[WebItemProviderRegistrationInfo representingObject]):
2948         (-[WebItemProviderRegistrationInfo typeIdentifier]):
2949         (-[WebItemProviderRegistrationInfo data]):
2950
2951         Represents a single calls to register data onto the item provider pasteboard. See
2952         WebItemProviderPasteboard.h header comments for more info.
2953
2954         (-[WebItemProviderRegistrationInfoList init]):
2955         (-[WebItemProviderRegistrationInfoList addData:forType:]):
2956         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
2957         (-[WebItemProviderRegistrationInfoList numberOfItems]):
2958         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
2959         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
2960
2961         Represents a series of calls to register representations onto the item provider pasteboard. See
2962         WebItemProviderPasteboard.h header comments for more info.
2963
2964         (-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]):
2965         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
2966         (-[WebItemProviderPasteboard setItemsFromObjectRepresentations:]): Deleted.
2967
2968 2017-04-24  Chris Dumez  <cdumez@apple.com>
2969
2970         Regression(r204605): support for "cp874" charset alias was inadvertently dropped which may cause issues on certain Thai sites
2971         https://bugs.webkit.org/show_bug.cgi?id=171128
2972         <rdar://problem/31526844>
2973
2974         Reviewed by Alexey Proskuryakov.
2975
2976         When using Thai as default language on MacOS, defaultTextEncodingNameForSystemLanguage()
2977         was returning "cp874" encoding with was dropped in r204605 for not being part of the
2978         encoding specification (https://encoding.spec.whatwg.org/#names-and-labels).
2979
2980         To address the issue, we map "cp874" encoding to the "dos-874" encoding which is
2981         properly recognized. Without this, this could lead to issue on WebSites that do not
2982         specify a charset.
2983
2984         * platform/text/TextEncodingRegistry.cpp:
2985         (WebCore::defaultTextEncodingNameForSystemLanguage):
2986
2987 2017-04-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
2988
2989         [CG] Provide a type identifier hint to the CGImageSource so getting the type identifier is more accurate
2990         https://bugs.webkit.org/show_bug.cgi?id=171042
2991
2992         Reviewed by Tim Horton.
2993
2994         The image URL can be used to get the type identifier hint. Without providing
2995         this hint, the image type identifier is not accurate for image formats.
2996
2997         Also add a function to the ImageDecoder class to get the typeIdentifier. Add
2998         all the pluming from the ImageDecoder till the Image class.
2999
3000         * WebCore.xcodeproj/project.pbxproj:
3001         * platform/graphics/BitmapImage.cpp:
3002         (WebCore::BitmapImage::destroyDecodedData):
3003         (WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded):
3004         (WebCore::BitmapImage::draw):
3005         (WebCore::BitmapImage::internalStartAnimation):
3006         (WebCore::BitmapImage::advanceAnimation):
3007         (WebCore::BitmapImage::internalAdvanceAnimation):
3008         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex):
3009         * platform/graphics/BitmapImage.h:
3010         * platform/graphics/Image.cpp:
3011         (WebCore::Image::sourceURL):
3012         * platform/graphics/Image.h: Change the sourceURL() to return a URL so CG can create CFURLRef from it.
3013         (WebCore::Image::uti):
3014         * platform/graphics/ImageFrameCache.cpp:
3015         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex):
3016         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
3017         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
3018         (WebCore::ImageFrameCache::stopAsyncDecodingQueue):
3019         (WebCore::ImageFrameCache::clearMetadata):
3020         (WebCore::ImageFrameCache::sourceURL):
3021         (WebCore::ImageFrameCache::encodedDataStatus):
3022         (WebCore::ImageFrameCache::uti):
3023         (WebCore::ImageFrameCache::filenameExtension):
3024         * platform/graphics/ImageFrameCache.h:
3025         * platform/graphics/ImageSource.cpp:
3026         (WebCore::ImageSource::ensureDecoderAvailable):
3027         * platform/graphics/ImageSource.h:
3028         (WebCore::ImageSource::uti):
3029         * platform/graphics/cg/ImageDecoderCG.cpp:
3030         (WebCore::ImageDecoder::ImageDecoder): Pass the type identifier hint to CGImageSourceCreateIncremental().
3031         (WebCore::ImageDecoder::uti):
3032         (WebCore::ImageDecoder::filenameExtension):
3033         (WebCore::ImageDecoder::frameHasAlphaAtIndex):
3034         (WebCore::ImageDecoder::createFrameImageAtIndex):
3035         * platform/graphics/cg/ImageDecoderCG.h:
3036         (WebCore::ImageDecoder::create):
3037         * platform/graphics/win/ImageDecoderDirect2D.cpp:
3038         (WebCore::ImageDecoder::encodedDataStatus):
3039         * platform/graphics/win/ImageDecoderDirect2D.h:
3040         (WebCore::ImageDecoder::create): Add an argument of type URL.
3041         * platform/image-decoders/ImageDecoder.cpp:
3042         (WebCore::ImageDecoder::create): Add an argument of type URL.
3043         * platform/image-decoders/ImageDecoder.h:
3044         (WebCore::ImageDecoder::encodedDataStatus): Make it const.
3045         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
3046         (WebCore::BMPImageDecoder::encodedDataStatus):
3047         * platform/image-decoders/bmp/BMPImageDecoder.h:
3048         * platform/image-decoders/gif/GIFImageDecoder.cpp:
3049         (WebCore::GIFImageDecoder::encodedDataStatus):
3050         * platform/image-decoders/gif/GIFImageDecoder.h:
3051         * platform/image-decoders/ico/ICOImageDecoder.cpp:
3052         (WebCore::ICOImageDecoder::encodedDataStatus):
3053         * platform/image-decoders/ico/ICOImageDecoder.h:
3054         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
3055         (WebCore::JPEGImageDecoder::encodedDataStatus):
3056         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
3057         * platform/image-decoders/png/PNGImageDecoder.cpp:
3058         (WebCore::PNGImageDecoder::encodedDataStatus):
3059         * platform/image-decoders/png/PNGImageDecoder.h:
3060         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
3061         (WebCore::WEBPImageDecoder::encodedDataStatus):
3062         * platform/image-decoders/webp/WEBPImageDecoder.h:
3063         * platform/spi/cg/ImageIOSPI.h: Added.
3064
3065 2017-04-24  Ryan Haddad  <ryanhaddad@apple.com>
3066
3067         Unreviewed build fix.
3068
3069         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
3070         (WebCore::encryptAES_GCM):
3071         (WebCore::decyptAES_GCM):
3072
3073 2017-04-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
3074
3075         Whitelist supported image MIME types
3076         https://bugs.webkit.org/show_bug.cgi?id=171077
3077
3078         Reviewed by Tim Horton.
3079
3080         Restrict the CG port image formats to a known whitelist. Build this list from image
3081         UTI's instead of MIME types, since the image UTI's is a superset of the MIME types.
3082         Use this list to build the list of supported image MIME types.
3083
3084         * PlatformAppleWin.cmake:
3085         * WebCore.xcodeproj/project.pbxproj:
3086         * platform/MIMETypeRegistry.cpp:
3087         (WebCore::initializeSupportedImageMIMETypes):
3088         * platform/graphics/cg/UTIRegistry.cpp: Added.
3089         (WebCore::allowedImageUTIs):
3090         (WebCore::isAllowedImageUTI):
3091         * platform/graphics/cg/UTIRegistry.h: Added.
3092
3093 2017-04-24  Nan Wang  <n_wang@apple.com>
3094
3095         AX: Crash at WebCore::AXObjectCache::characterOffsetForIndex(int, WebCore::AccessibilityObject const*) + 703
3096         https://bugs.webkit.org/show_bug.cgi?id=171247
3097
3098         Reviewed by Chris Fleizach.
3099
3100         Crashed because we were passing a nil node into rootAXEditableElement(). Fixed it by
3101         adding a null check.
3102
3103         Test: accessibility/mac/input-string-for-range-crash.html
3104
3105         * accessibility/AXObjectCache.cpp:
3106         (WebCore::AXObjectCache::characterOffsetForIndex):
3107
3108 2017-04-24  Youenn Fablet  <youenn@apple.com>
3109
3110         Set defaults video getUserMedia constraints
3111         https://bugs.webkit.org/show_bug.cgi?id=171127
3112
3113         Reviewed by Eric Carlson.
3114
3115         Test: fast/mediastream/getUserMedia-default.html
3116
3117         Adding default optional constraints for video size and frame rate if none is defined.
3118         Default is 640x480 30fps.
3119
3120         Doing some refactoring in MeddiaConstraintsImpl and MeddiaConstraintsData to use more move constructors.
3121
3122         * Modules/mediastream/MediaConstraintsImpl.cpp:
3123         (WebCore::defaultVideoConstraints):
3124         (WebCore::MediaConstraintsData::setDefaultVideoConstraints):
3125         (WebCore::MediaConstraintsImpl::create): Deleted.
3126         * Modules/mediastream/MediaConstraintsImpl.h:
3127         * Modules/mediastream/MediaDevices.cpp:
3128         (WebCore::MediaDevices::getUserMedia):
3129         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3130         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer): Fixing crash when setting frameRate.
3131
3132 2017-04-24  Chris Dumez  <cdumez@apple.com>
3133
3134         createElementNS() should now throw only InvalidCharacterError, not NamespaceError
3135         https://bugs.webkit.org/show_bug.cgi?id=171052
3136
3137         Reviewed by Sam Weinig.
3138
3139         Validating a qualified name should only throw InvalidCharacterError, not NamespaceError,
3140         after:
3141         - https://github.com/whatwg/dom/issues/319
3142         - https://github.com/w3c/web-platform-tests/issues/5161
3143         - https://github.com/whatwg/dom/issues/423
3144
3145         Latest spec:
3146         - https://dom.spec.whatwg.org/#validate
3147
3148         No new tests, updated web-platform-tests.
3149
3150         * dom/Document.cpp:
3151         (WebCore::Document::parseQualifiedName):
3152
3153 2017-04-24  Chris Dumez  <cdumez@apple.com>
3154
3155         REGRESSION (214503): Webkit crash under RenderElement::repaintForPausedImageAnimationsIfNeeded() when scrolling giphy pages
3156         https://bugs.webkit.org/show_bug.cgi?id=171243
3157         <rdar://problem/31715572>
3158
3159         Reviewed by Antti Koivisto.
3160
3161         After r214503, we would frequently crash when scrolling giphy pages because we were failing to call
3162         RenderView::removeRendererWithPausedImageAnimations(renderer, cachedImage) in some cases. This would
3163         cause a RenderElement to still be associated to a CachedImage in RenderView but not in practice.
3164         If the CachedImage then gets destroyed and the user scrolls, we end up calling
3165         RenderElement::repaintForPausedImageAnimationsIfNeeded() with a bad CachedImage.
3166
3167         StyleCachedImage was properly calling RenderView::removeRendererWithPausedImageAnimations() before
3168         unregistering the renderer as a client to the CachedImage. However, RenderImageResource was failing
3169         to do the same. To make this less error-prone, I added a didRemoveCachedImageClient(CachedImage&)
3170         function to the CachedImageClient interface. It is overriden in RenderElement only to call
3171         RenderView::removeRendererWithPausedImageAnimations().
3172
3173         Test: fast/images/animated-gif-scrolling-crash.html
3174
3175         * loader/cache/CachedImage.cpp:
3176         (WebCore::CachedImage::didRemoveClient):
3177         * loader/cache/CachedImageClient.h:
3178         (WebCore::CachedImageClient::didRemoveCachedImageClient):
3179         * rendering/RenderElement.cpp:
3180         (WebCore::RenderElement::didRemoveCachedImageClient):
3181         * rendering/RenderElement.h:
3182         * rendering/style/StyleCachedImage.cpp:
3183         (WebCore::StyleCachedImage::removeClient):
3184
3185 2017-04-24  Andy Estes  <aestes@apple.com>
3186
3187         [macOS] Fix two minor issues with MediaSelectionOption::Type
3188         https://bugs.webkit.org/show_bug.cgi?id=171235
3189
3190         Reviewed by Sam Weinig.
3191
3192         * platform/MediaSelectionOption.h: Gave type a default value, and added explicit
3193         constructors to make gcc and msvc happy.
3194         * platform/mac/WebPlaybackControlsManager.mm:
3195         (toAVTouchBarMediaSelectionOptionType): Added an ASSERT_NOT_REACHED if none of the switch
3196         cases match.
3197
3198 2017-04-24  Andy Estes  <aestes@apple.com>
3199
3200         [macOS] Enable media selection button on AVTouchBarScrubber
3201         https://bugs.webkit.org/show_bug.cgi?id=171149
3202         <rdar://problem/29875010>
3203
3204         Reviewed by Beth Dakin.
3205
3206         * platform/spi/cocoa/AVKitSPI.h:
3207
3208 2017-04-24  Alex Christensen  <achristensen@webkit.org>
3209
3210         Reduce copies and allocations in SharedBuffer::append
3211         https://bugs.webkit.org/show_bug.cgi?id=170956
3212
3213         Reviewed by Andreas Kling.
3214
3215         SharedBuffer was a mess of different data structures added over the years.
3216         SharedBuffer::append would allocate large Vector<char>s and call memcpy, and that
3217         is inefficient and causes crashes when large allocations fail, and the allocations
3218         and copies aren't even necessary.  There were also const correctness problems in
3219         ResourceLoader::addDataOrBuffer, and iterating a SharedBuffer was strange because
3220         sometimes we don't want to add unnecessary copies.
3221
3222         These problems are solved by making SharedBuffer a Vector of read-only data segments,
3223         which can be contained in various ways but we don't care because all we want to do is
3224         read them.  Appending SharedBuffers is now const correct because we just add to a
3225         Vector<Ref<DataSegment>> and neither SharedBuffer can write to the data.  Sometimes,
3226         though, we want all the data to be in continuous memory, and if there are multiple
3227         segments then the data needs to be copied once to a new segment.  We should audit the
3228         call sites of SharedBuffer::data and see if this is really necessary.
3229
3230         No change in functional behavior.  Fewer copies of the data are made when buffering
3231         data in the NetworkProcess.  No extra memory is allocated for bytes we think we might
3232         need to append in the future.  Data is now only copied into one buffer lazily as needed,
3233         which could slightly change when small delays from memcpy happen, but it's an overall
3234         improvement.  We could have a performance hit if we were to call append() then data()
3235         then append() then data() etc. but that doesn't happen in WebKit because we call append
3236         repeatedly when buffering the data then call data() once when reading the data.
3237
3238         * editing/cocoa/EditorCocoa.mm:
3239         (WebCore::archivedDataForAttributedString):
3240         (WebCore::Editor::selectionInWebArchiveFormat):
3241         (WebCore::Editor::dataInRTFDFormat):
3242         (WebCore::Editor::dataInRTFFormat):
3243         * editing/ios/EditorIOS.mm:
3244         (WebCore::Editor::WebContentReader::readURL):
3245         * editing/mac/EditorMac.mm:
3246         (WebCore::Editor::imageInWebArchiveFormat):
3247         * loader/TextTrackLoader.cpp:
3248         (WebCore::TextTrackLoader::processNewCueData):
3249         * loader/archive/cf/LegacyWebArchive.cpp:
3250         (WebCore::LegacyWebArchive::createResource):
3251         * loader/cache/CachedResource.cpp:
3252         (WebCore::CachedResource::tryReplaceEncodedData):
3253         * loader/cocoa/DiskCacheMonitorCocoa.mm:
3254         (WebCore::DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse):
3255         * platform/SharedBuffer.cpp:
3256         (WebCore::SharedBuffer::SharedBuffer):
3257         (WebCore::SharedBuffer::create):
3258         (WebCore::SharedBuffer::combineToOneSegment):
3259         (WebCore::SharedBuffer::data):
3260         (WebCore::SharedBuffer::createArrayBuffer):
3261         (WebCore::SharedBuffer::append):
3262         (WebCore::SharedBuffer::clear):
3263         (WebCore::SharedBuffer::copy):
3264         (WebCore::SharedBuffer::DataSegment::data):
3265         (WebCore::SharedBuffer::DataSegment::size):
3266         (WebCore::segmentIndex): Deleted.
3267         (WebCore::offsetInSegment): Deleted.
3268         (WebCore::allocateSegment): Deleted.
3269         (WebCore::freeSegment): Deleted.
3270         (WebCore::SharedBuffer::~SharedBuffer): Deleted.
3271         (WebCore::SharedBuffer::size): Deleted.
3272         (WebCore::SharedBuffer::duplicateDataBufferIfNecessary): Deleted.
3273         (WebCore::SharedBuffer::appendToDataBuffer): Deleted.
3274         (WebCore::SharedBuffer::clearDataBuffer): Deleted.
3275         (WebCore::SharedBuffer::copyBufferAndClear): Deleted.
3276         (WebCore::SharedBuffer::buffer): Deleted.
3277         (WebCore::SharedBuffer::getSomeData): Deleted.
3278         (WebCore::SharedBuffer::maybeTransferMappedFileData): Deleted.
3279         (WebCore::SharedBuffer::clearPlatformData): Deleted.
3280         (WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
3281         (WebCore::SharedBuffer::hasPlatformData): Deleted.
3282         (WebCore::SharedBuffer::platformData): Deleted.
3283         (WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
3284         * platform/SharedBuffer.h:
3285         (WebCore::SharedBuffer::create): Deleted.
3286         (WebCore::SharedBuffer::isEmpty): Deleted.
3287         * platform/SharedBufferChunkReader.cpp:
3288         (WebCore::SharedBufferChunkReader::nextChunk):
3289         (WebCore::SharedBufferChunkReader::peek):
3290         * platform/SharedBufferChunkReader.h:
3291         * platform/URLParser.cpp:
3292         (WebCore::URLParser::URLParser):
3293         * platform/cf/KeyedEncoderCF.cpp:
3294         (WebCore::KeyedEncoderCF::finishEncoding):
3295         * platform/cf/SharedBufferCF.cpp:
3296         (WebCore::SharedBuffer::SharedBuffer):
3297         (WebCore::SharedBuffer::createCFData):
3298         (WebCore::SharedBuffer::create):
3299         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
3300         (WebCore::SharedBuffer::append):
3301         (WebCore::SharedBuffer::wrapCFData): Deleted.
3302         (WebCore::SharedBuffer::hasPlatformData): Deleted.
3303         (WebCore::SharedBuffer::platformData): Deleted.
3304         (WebCore::SharedBuffer::platformDataSize): Deleted.
3305         (WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
3306         (WebCore::SharedBuffer::clearPlatformData): Deleted.
3307         (WebCore::SharedBuffer::tryReplaceContentsWithPlatformBuffer): Deleted.
3308         (WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
3309         (WebCore::SharedBuffer::copyBufferAndClear): Deleted.
3310         (WebCore::SharedBuffer::copySomeDataFromDataArray): Deleted.
3311         (WebCore::SharedBuffer::singleDataArrayBuffer): Deleted.
3312         (WebCore::SharedBuffer::maybeAppendDataArray): Deleted.
3313         * platform/cocoa/NetworkExtensionContentFilter.mm:
3314         (WebCore::NetworkExtensionContentFilter::replacementData):
3315         * platform/cocoa/ParentalControlsContentFilter.mm:
3316         (WebCore::ParentalControlsContentFilter::replacementData):
3317         * platform/cocoa/SharedBufferCocoa.mm:
3318         (-[WebCoreSharedBufferData initWithSharedBufferDataSegment:]):
3319         (-[WebCoreSharedBufferData length]):
3320         (-[WebCoreSharedBufferData bytes]):
3321         (WebCore::SharedBuffer::create):
3322         (WebCore::SharedBuffer::createCFData):
3323         (WebCore::SharedBuffer::createFromReadingFile):
3324         (WebCore::SharedBuffer::createNSDataArray):
3325         (-[WebCoreSharedBufferData initWithSharedBufferDataBuffer:]): Deleted.
3326         (WebCore::SharedBuffer::wrapNSData): Deleted.
3327         (WebCore::SharedBuffer::existingCFData): Deleted.
3328         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
3329         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
3330         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3331         (WebCore::FontPlatformData::openTypeTable):
3332         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3333         (ResourceHandleStreamingClient::didReceiveBuffer):
3334         * platform/graphics/mac/ImageMac.mm:
3335         (WebCore::Image::loadPlatformResource):
3336         * platform/image-decoders/ImageDecoder.cpp:
3337         (WebCore::ImageDecoder::create):
3338         * platform/image-decoders/png/PNGImageDecoder.cpp:
3339         (WebCore::PNGImageReader::decode):
3340         * platform/ios/PlatformPasteboardIOS.mm:
3341         (WebCore::PlatformPasteboard::readBuffer):
3342         * platform/mac/PasteboardMac.mm:
3343         (WebCore::writeFileWrapperAsRTFDAttachment):
3344         (WebCore::Pasteboard::write):
3345         * platform/mac/PlatformPasteboardMac.mm:
3346         (WebCore::PlatformPasteboard::bufferForType):
3347         * platform/network/BlobResourceHandle.cpp:
3348         (WebCore::BlobResourceHandle::notifyReceiveData):
3349         * platform/network/MIMEHeader.cpp:
3350         * platform/network/MIMEHeader.h:
3351         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3352         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
3353         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
3354         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData):
3355         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
3356         (-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]):
3357         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3358         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
3359         * platform/soup/SharedBufferSoup.cpp:
3360         (WebCore::SharedBuffer::SharedBuffer):
3361         (WebCore::SharedBuffer::createSoupBuffer):
3362         (WebCore::SharedBuffer::clearPlatformData): Deleted.
3363         (WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
3364         (WebCore::SharedBuffer::hasPlatformData): Deleted.
3365         (WebCore::SharedBuffer::platformData): Deleted.
3366         (WebCore::SharedBuffer::platformDataSize): Deleted.
3367         (WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
3368         (WebCore::SharedBuffer::tryReplaceContentsWithPlatformBuffer): Deleted.
3369
3370 2017-04-24  Dan Bernstein  <mitz@apple.com>
3371
3372         [Cocoa] Some ivars are needlessly @protected
3373         https://bugs.webkit.org/show_bug.cgi?id=171208
3374
3375         Reviewed by Anders Carlsson.
3376
3377         Made ivars @private where possible.
3378
3379         * platform/mac/WebCoreFullScreenPlaceholderView.h:
3380         * platform/mac/WebCoreFullScreenWarningView.h:
3381         * platform/mac/WebPlaybackControlsManager.h:
3382         * platform/network/cocoa/WebCoreNSURLSession.h:
3383
3384 2017-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3385
3386         [GTK] Switch to use ENABLE_REMOTE_INSPECTOR instead of ENABLE_INSPECTOR_SERVER for the remote inspector
3387         https://bugs.webkit.org/show_bug.cgi?id=166680
3388
3389         Reviewed by Michael Catanzaro.
3390
3391         Add PageDebuggable.cpp to the compilation.
3392
3393         * CMakeLists.txt:
3394
3395 2017-04-23  Commit Queue  <commit-queue@webkit.org>
3396
3397         Unreviewed, rolling out r215657 and r215676.
3398         https://bugs.webkit.org/show_bug.cgi?id=171201
3399
3400         Broke the build (Requested by ap on #webkit).
3401
3402         Reverted changesets:
3403
3404         "[macOS] Enable media selection button on AVTouchBarScrubber"
3405         https://bugs.webkit.org/show_bug.cgi?id=171149
3406         http://trac.webkit.org/changeset/215657
3407
3408         "Build fix after r215657."
3409         http://trac.webkit.org/changeset/215676
3410
3411 2017-04-23  Andy Estes  <aestes@apple.com>
3412
3413         [macOS] AVTouchBarMediaSelectionOptions should be created with the correct type
3414         https://bugs.webkit.org/show_bug.cgi?id=171192
3415         <rdar://problem/29875010>
3416
3417         Reviewed by Wenson Hsieh.
3418
3419         AVTouchBarMediaSelectionOption was always being created with type
3420         AVTouchBarMediaSelectionOptionTypeRegular, but we know if a TextTrack is really the legible
3421         off or legible auto track. This change plumbs that information into
3422         WebPlaybackControlsManager so that AVTouchBarMediaSelectionOptions can be created with the
3423         right AVTouchBarMediaSelectionOptionType. 
3424
3425         * WebCore.xcodeproj/project.pbxproj:
3426         * page/CaptionUserPreferences.cpp:
3427         (WebCore::CaptionUserPreferences::mediaSelectionOptionForTrack):
3428         * page/CaptionUserPreferences.h:
3429         * platform/MediaSelectionOption.h: Added.
3430         * platform/cocoa/WebPlaybackSessionModel.h:
3431         (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionOptionsChanged):
3432         (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionOptionsChanged):