0296c5e56de20de8180f001e397ac6a0a65d8302
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-03  Jer Noble  <jer.noble@apple.com>
2
3         Make the VPIO audio unit a singleton, shared between multiple CaptureSources
4         https://bugs.webkit.org/show_bug.cgi?id=171622
5
6         Reviewed by Eric Carlson.
7
8         Move the implemnetation of CoreAudioCaptureSource into a shared singleton class, CoreAudioSharedUnit,
9         which will send audio to each of it's client CoreAudioCaptureSources. The first registered client will
10         define the settings used by the shared unit.
11
12         Drive-by fixes: Fix up setUseAVFoundationAudioCapture() to always accept the first value set.
13
14         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
15         (WebCore::CoreAudioSharedUnit::isProducingData):
16         (WebCore::CoreAudioSharedUnit::microphoneFormat):
17         (WebCore::CoreAudioSharedUnit::singleton):
18         (WebCore::CoreAudioSharedUnit::addClient):
19         (WebCore::CoreAudioSharedUnit::removeClient):
20         (WebCore::CoreAudioSharedUnit::addEchoCancellationSource):
21         (WebCore::CoreAudioSharedUnit::removeEchoCancellationSource):
22         (WebCore::CoreAudioSharedUnit::preferredIOBufferSize):
23         (WebCore::CoreAudioSharedUnit::setupAudioUnits):
24         (WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
25         (WebCore::CoreAudioSharedUnit::configureSpeakerProc):
26         (WebCore::CoreAudioSharedUnit::checkTimestamps):
27         (WebCore::CoreAudioSharedUnit::provideSpeakerData):
28         (WebCore::CoreAudioSharedUnit::speakerCallback):
29         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
30         (WebCore::CoreAudioSharedUnit::microphoneCallback):
31         (WebCore::CoreAudioSharedUnit::cleanupAudioUnits):
32         (WebCore::CoreAudioSharedUnit::startProducingData):
33         (WebCore::CoreAudioSharedUnit::stopProducingData):
34         (WebCore::CoreAudioSharedUnit::suspend):
35         (WebCore::CoreAudioSharedUnit::defaultInputDevice):
36         (WebCore::CoreAudioCaptureSource::create):
37         (WebCore::CoreAudioCaptureSource::factory):
38         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
39         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
40         (WebCore::CoreAudioCaptureSource::addEchoCancellationSource):
41         (WebCore::CoreAudioCaptureSource::removeEchoCancellationSource):
42         (WebCore::CoreAudioCaptureSource::startProducingData):
43         (WebCore::CoreAudioCaptureSource::stopProducingData):
44         (WebCore::CoreAudioCaptureSource::audioSourceProvider):
45         (WebCore::CoreAudioCaptureSource::preferredSampleRate): Deleted.
46         (WebCore::CoreAudioCaptureSource::preferredIOBufferSize): Deleted.
47         (WebCore::CoreAudioCaptureSource::configureMicrophoneProc): Deleted.
48         (WebCore::CoreAudioCaptureSource::configureSpeakerProc): Deleted.
49         (WebCore::CoreAudioCaptureSource::checkTimestamps): Deleted.
50         (WebCore::CoreAudioCaptureSource::provideSpeakerData): Deleted.
51         (WebCore::CoreAudioCaptureSource::speakerCallback): Deleted.
52         (WebCore::CoreAudioCaptureSource::processMicrophoneSamples): Deleted.
53         (WebCore::CoreAudioCaptureSource::microphoneCallback): Deleted.
54         (WebCore::CoreAudioCaptureSource::cleanupAudioUnits): Deleted.
55         (WebCore::CoreAudioCaptureSource::defaultInputDevice): Deleted.
56         (WebCore::CoreAudioCaptureSource::setupAudioUnits): Deleted.
57         (WebCore::CoreAudioCaptureSource::suspend): Deleted.
58         (WebCore::CoreAudioCaptureSource::resume): Deleted.
59         * platform/mediastream/mac/CoreAudioCaptureSource.h:
60         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
61         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
62
63 2017-05-03  Jer Noble  <jer.noble@apple.com>
64
65         getUserMedia() fails because devices list is empty / inactive
66         https://bugs.webkit.org/show_bug.cgi?id=171626
67
68         Reviewed by Eric Carlson.
69
70         When creating a AVAudioSessionCaptureDevice, set the device's enabled state to true if the port description
71         has any items in its dataSources property (which is the best analogue to "isActive" we have in AVAudioSession).
72
73         Also, when creating the generic list of CaptureDevices, use the copy constructor to ensure the enabled state
74         gets copied to the new generic device.
75
76         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
77         (WebCore::AVAudioSessionCaptureDevice::create):
78         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
79         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
80
81 2017-05-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
82
83         Implement the imageready event to reliably test the async image decoding
84         https://bugs.webkit.org/show_bug.cgi?id=171016
85
86         Reviewed by Simon Fraser.
87
88         The event will be fired for each client of the image. Firing the event
89         will happen after finishing the decoding and repainting the client.
90
91         Existing tests will be modified in a separate patch to use this event.
92
93         * dom/Element.cpp:
94         (WebCore::Element::dispatchWebKitImageReadyEventForTesting):
95         * dom/Element.h:
96         * page/Settings.in:
97         * rendering/RenderElement.cpp:
98         (WebCore::RenderElement::imageFrameAvailable):
99
100 2017-05-03  Tim Horton  <timothy_horton@apple.com>
101
102         Maintain interaction information URL as a URL, not a string
103         https://bugs.webkit.org/show_bug.cgi?id=171623
104
105         Reviewed by Simon Fraser.
106
107         No new tests, not a behavior change.
108
109         * platform/URL.h:
110
111 2017-05-03  Yoav Weiss  <yoav@yoav.ws>
112
113         Link preload HTMLPreloadScanner support
114         https://bugs.webkit.org/show_bug.cgi?id=170747
115
116         Reviewed by Youenn Fablet.
117
118         Test: http/tests/preload/preloadscanner_download_resources.html
119
120         * html/parser/HTMLPreloadScanner.cpp:
121         (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner): Initialize link preload flag.
122         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): Create a request only if the type is known (so ignore
123         preloads with unknown type).
124         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Add handling for link preload and the `as` attribute.
125         (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet): Get LinkRelAttribute as input.
126         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType): Return an std::optional, in case the preload type is unknown.
127         (WebCore::TokenPreloadScanner::StartTagScanner::shouldPreload): Return true for the link preload case.
128         * loader/cache/CachedResourceLoader.cpp:
129         (WebCore::CachedResourceLoader::preload): Return the resource rather than a nullptr if it's already in m_preloads.
130
131 2017-05-03  Michael Catanzaro  <mcatanzaro@igalia.com>
132
133         YouTube user agent quirk breaks new YouTube
134         https://bugs.webkit.org/show_bug.cgi?id=171603
135
136         Reviewed by Carlos Garcia Campos.
137
138         Our user agent quirk to make YouTube 360 work breaks the new YouTube UI, causing it to
139         attempt to use the obsolete custom elements v0 API. WebKit only supports the v1 API. We
140         have to remove this quirk.
141
142         Note this does not affect Safari as Apple ports don't use our user agent quirks.
143
144         * platform/UserAgentQuirks.cpp:
145         (WebCore::urlRequiresChromeBrowser):
146
147 2017-05-03  Joseph Pecoraro  <pecoraro@apple.com>
148
149         Web Inspector: 404 Image Load does not appear as a failure in Web Inspector
150         https://bugs.webkit.org/show_bug.cgi?id=171587
151         <rdar://problem/13222846>
152
153         Reviewed by Matt Baker.
154
155         * inspector/InspectorPageAgent.h:
156         * inspector/InspectorPageAgent.cpp:
157         (WebCore::InspectorPageAgent::cachedResourceContent):
158         (WebCore::prepareCachedResourceBuffer): Deleted.
159         Inline the function to make this less confusing.
160
161         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
162         Treat a DecodeError as a failure.
163
164 2017-05-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
165
166         Async image decoding should be disabled for snapshots, printing and preview
167         https://bugs.webkit.org/show_bug.cgi?id=171467
168  
169         Reviewed by Simon Fraser.
170  
171         Asynchronous image decoding should only be used for window display where
172         RenderElements can be repainted and painted. For cases where there is only
173         one chance to draw the image, synchronous decoding should be used. 
174
175         * rendering/RenderBoxModelObject.cpp:
176         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
177         * rendering/RenderImage.cpp:
178         (WebCore::RenderImage::paintIntoRect):
179
180 2017-05-03  Nan Wang  <n_wang@apple.com>
181
182         AX: VO skips cells after cell with aria-colspan
183         https://bugs.webkit.org/show_bug.cgi?id=171579
184
185         Reviewed by Chris Fleizach.
186
187         We should consider the previous cells' column span value when
188         calculating the column index.
189
190         Test: accessibility/mac/aria-grid-column-span.html
191
192         * accessibility/AccessibilityARIAGridCell.cpp:
193         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
194
195 2017-05-03  Jiewen Tan  <jiewen_tan@apple.com>
196
197         ASSERTION FAILED: m_scriptExecutionContext->isContextThread() seen with LayoutTest crypto/workers/crypto-random-values-limits-worker.html
198         https://bugs.webkit.org/show_bug.cgi?id=171462
199         <rdar://problem/31906859>
200
201         Reviewed by Brent Fulgham.
202
203         Covered by existing tests.
204
205         * workers/WorkerGlobalScope.cpp:
206         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
207         Clear Crypto early in destruction since its ContextDestructionObserver
208         destruction makes checks about the WorkerThread.
209
210 2017-05-03  Zalan Bujtas  <zalan@apple.com>
211
212         RenderSearchField should not use isTextField() in SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT
213         https://bugs.webkit.org/show_bug.cgi?id=171608
214
215         Reviewed by Simon Fraser.
216
217         isTextField() is true for any generic single line text control.
218
219         * rendering/RenderObject.h:
220         (WebCore::RenderObject::isSearchField):
221         * rendering/RenderSearchField.h:
222
223 2017-05-03  Frederic Wang  <fwang@igalia.com>
224
225         Remove ScrollingCoordinator::supportsFixedPositionLayers()
226         https://bugs.webkit.org/show_bug.cgi?id=171557
227
228         Reviewed by Simon Fraser.
229
230         No new tests, behavior is not changed.
231
232         * page/FrameView.cpp:
233         (WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling):
234         * page/scrolling/AsyncScrollingCoordinator.cpp:
235         (WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
236         * page/scrolling/AsyncScrollingCoordinator.h:
237         * page/scrolling/ScrollingCoordinator.cpp:
238         (WebCore::ScrollingCoordinator::synchronousScrollingReasons):
239         * page/scrolling/ScrollingCoordinator.h:
240         (WebCore::ScrollingCoordinator::supportsFixedPositionLayers): Deleted.
241         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
242         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateViewportConstrainedNode):
243         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h:
244         (): Deleted.
245         * rendering/RenderLayerCompositor.cpp:
246         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
247
248 2017-05-03  Chris Dumez  <cdumez@apple.com>
249
250         Use PassRefPtr less in CompositeEditCommand
251         https://bugs.webkit.org/show_bug.cgi?id=171590
252
253         Reviewed by Sam Weinig.
254
255         Use PassRefPtr less in CompositeEditCommand.
256
257         * CMakeLists.txt:
258         * WebCore.xcodeproj/project.pbxproj:
259         * editing/ApplyStyleCommand.cpp:
260         (WebCore::hasNoAttributeOrOnlyStyleAttribute):
261         (WebCore::isStyleSpanOrSpanWithOnlyStyleAttribute):
262         (WebCore::isSpanWithoutAttributesOrUnstyledStyleSpan):
263         (WebCore::isEmptyFontTag):
264         (WebCore::ApplyStyleCommand::doApply):
265         (WebCore::ApplyStyleCommand::applyBlockStyle):
266         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
267         (WebCore::dummySpanAncestorForNode):
268         (WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
269         (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
270         (WebCore::ApplyStyleCommand::applyInlineStyle):
271         (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
272         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
273         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
274         (WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
275         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
276         (WebCore::ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes):
277         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
278         (WebCore::ApplyStyleCommand::removeCSSStyle):
279         (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
280         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
281         (WebCore::ApplyStyleCommand::removeInlineStyle):
282         (WebCore::ApplyStyleCommand::shouldSplitTextElement):
283         (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
284         (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
285         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
286         (WebCore::ApplyStyleCommand::addBlockStyle):
287         (WebCore::ApplyStyleCommand::joinChildTextNodes):
288         * editing/ApplyStyleCommand.h:
289         (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
290         * editing/CompositeEditCommand.cpp:
291         (WebCore::CompositeEditCommand::removeChildrenInRange):
292         (WebCore::CompositeEditCommand::mergeIdenticalElements):
293         (WebCore::CompositeEditCommand::insertTextIntoNode):
294         (WebCore::CompositeEditCommand::deleteTextFromNode):
295         (WebCore::CompositeEditCommand::replaceTextInNode):
296         (WebCore::CompositeEditCommand::replaceSelectedTextInNode):
297         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
298         (WebCore::CompositeEditCommand::removeNodeAttribute):
299         (WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
300         (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring):
301         (WebCore::CompositeEditCommand::prepareWhitespaceAtPositionForSplit):
302         (WebCore::CompositeEditCommand::deleteInsignificantText):
303         (WebCore::CompositeEditCommand::removePlaceholderAt):
304         (WebCore::CompositeEditCommand::cleanupAfterDeletion):
305         (WebCore::CompositeEditCommand::moveParagraphs):
306         * editing/CompositeEditCommand.h:
307         * editing/DeleteFromTextNodeCommand.cpp:
308         (WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
309         (WebCore::DeleteFromTextNodeCommand::doApply):
310         (WebCore::DeleteFromTextNodeCommand::doUnapply):
311         (WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
312         * editing/DeleteFromTextNodeCommand.h:
313         (WebCore::DeleteFromTextNodeCommand::create):
314         * editing/DeleteSelectionCommand.cpp:
315         (WebCore::DeleteSelectionCommand::deleteTextFromNode):
316         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
317         (WebCore::DeleteSelectionCommand::fixupWhitespace):
318         * editing/DeleteSelectionCommand.h:
319         * editing/EditingAllInOne.cpp:
320         * editing/EditingStyle.cpp:
321         (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
322         (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl):
323         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
324         (WebCore::EditingStyle::wrappingStyleForSerialization):
325         (WebCore::styleFromMatchedRulesForElement):
326         (WebCore::EditingStyle::mergeStyleFromRules):
327         (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
328         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
329         (WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
330         * editing/EditingStyle.h:
331         * editing/IndentOutdentCommand.cpp:
332         (WebCore::IndentOutdentCommand::tryIndentingAsListItem):
333         * editing/InsertIntoTextNodeCommand.cpp:
334         (WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
335         (WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
336         * editing/InsertIntoTextNodeCommand.h:
337         (WebCore::InsertIntoTextNodeCommand::create):
338         * editing/InsertLineBreakCommand.cpp:
339         (WebCore::InsertLineBreakCommand::doApply):
340         * editing/InsertListCommand.cpp:
341         (WebCore::InsertListCommand::mergeWithNeighboringLists):
342         (WebCore::InsertListCommand::listifyParagraph):
343         * editing/InsertParagraphSeparatorCommand.cpp:
344         (WebCore::InsertParagraphSeparatorCommand::doApply):
345         * editing/InsertTextCommand.cpp:
346         (WebCore::InsertTextCommand::performOverwrite):
347         (WebCore::InsertTextCommand::doApply):
348         (WebCore::InsertTextCommand::insertTab):
349         * editing/MergeIdenticalElementsCommand.cpp:
350         (WebCore::MergeIdenticalElementsCommand::MergeIdenticalElementsCommand):
351         (WebCore::MergeIdenticalElementsCommand::doApply):
352         (WebCore::MergeIdenticalElementsCommand::doUnapply):
353         (WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
354         * editing/MergeIdenticalElementsCommand.h:
355         (WebCore::MergeIdenticalElementsCommand::create):
356         * editing/RemoveCSSPropertyCommand.cpp: Removed.
357         * editing/RemoveCSSPropertyCommand.h: Removed.
358         * editing/ReplaceSelectionCommand.cpp:
359         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
360         (WebCore::ReplaceSelectionCommand::doApply):
361         (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
362         (WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
363         * editing/markup.cpp:
364         (WebCore::StyledMarkupAccumulator::appendElement):
365         (WebCore::styleFromMatchedRulesAndInlineDecl):
366         (WebCore::createMarkupInternal):
367
368 2017-05-03  Joanmarie Diggs  <jdiggs@igalia.com>
369
370         AX: Treat cells with ARIA table cell properties as cells
371         https://bugs.webkit.org/show_bug.cgi?id=171178
372
373         Reviewed by Chris Fleizach.
374
375         Add the following checks to heuristics in AccessibilityTable::isDataTable():
376         1. If the author has provided a valid aria-rowcount or aria-colcount value on
377            the table element, expose it as a data table.
378         2. If the author has provided a valid aria-colindex or aria-rowindex on the
379            cell element, expose it as a data table.
380         3. If the author has provided a valid aria-rowindex on the row element, expose
381            it as a data table.
382         4. If the author has provided a value for aria-colspan or aria-rowspan on a cell,
383            expose it as a data table (even though we are supposed to ignore the value for
384            the purpose of exposing the span via platform accessibility APIs)
385
386         Remove the heuristic that a table with only one cell is "not a good AXTable candidate."
387         It prevents us from ever doing the above checks.
388
389         Test: accessibility/minimal-table-with-aria-is-data-table.html
390
391         * accessibility/AccessibilityTable.cpp:
392         (WebCore::AccessibilityTable::isDataTable):
393
394 2017-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
395
396         [Cairo] Handle extended colors in gradients
397         https://bugs.webkit.org/show_bug.cgi?id=171596
398
399         Reviewed by Michael Catanzaro.
400
401         Check if every gradient color step is an extended color and use asExtended() instead of getRGBA() in such case.
402
403         Fixes: css3/color/gradients.html
404
405         * platform/graphics/cairo/GradientCairo.cpp:
406         (WebCore::Gradient::platformGradient):
407
408 2017-05-03  Daniel Bates  <dabates@apple.com>
409
410         Abandon the current load once the provisional loader detaches from the frame
411         https://bugs.webkit.org/show_bug.cgi?id=171577
412         <rdar://problem/31581227>
413
414         Reviewed by Brent Fulgham and Brady Eidson.
415
416         We detach all child frames as part of setting our document loader to the provisional
417         document loader when committing a load for a frame. Detaching child frames invokes
418         the unload event handler on the child frames that can run arbitrary JavaScript script.
419         Among other things, such script can initiate a new load in the frame whose current
420         load is being committed. We should stop processing the current load as soon as we
421         detect that updating our document loader has started a new provisional load.
422
423         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash.html
424
425         * loader/FrameLoader.cpp:
426         (WebCore::FrameLoader::transitionToCommitted):
427
428 2017-05-03  Daniel Bates  <dabates@apple.com>
429
430         Cleanup: Remove out-of-date comment and null check from DocumentLoader::detachFromFrame()
431         https://bugs.webkit.org/show_bug.cgi?id=171604
432
433         Reviewed by Brady Eidson.
434
435         We no longer want to passively allow DocumentLoader::detachFromFrame() to be called twice.
436         It does not make sense to be called twice and should never be called twice. A release assert
437         in DocumentLoader::cancelPolicyCheckIfNeeded() (added in r187558) called by DocumentLoader::detachFromFrame()
438         enforces this invariant. Therefore we can remove the null check of DocumentLoader::m_frame
439         and the comment that explains the purpose of this null check from DocumentLoader::detachFromFrame().
440
441         * loader/DocumentLoader.cpp:
442         (WebCore::DocumentLoader::detachFromFrame):
443
444 2017-05-03  Ryan Haddad  <ryanhaddad@apple.com>
445
446         Unreviewed attempt to fix the Windows build after r216117.
447         https://bugs.webkit.org/show_bug.cgi?id=171601
448
449         * css/CSSAllInOne.cpp:
450
451 2017-05-03  Antti Koivisto  <antti@apple.com>
452
453         Rename StyleInvalidationAnalysis to Style::Invalidator
454         https://bugs.webkit.org/show_bug.cgi?id=171601
455
456         Reviewed by Žan Doberšek.
457
458         Also move it to the 'style' directory.
459
460         * CMakeLists.txt:
461         * WebCore.xcodeproj/project.pbxproj:
462         * css/StyleInvalidationAnalysis.cpp: Removed.
463         * css/StyleInvalidationAnalysis.h: Removed.
464         * dom/ExtensionStyleSheets.cpp:
465         * style/AttributeChangeInvalidation.cpp:
466         (WebCore::Style::AttributeChangeInvalidation::invalidateDescendants):
467         * style/ClassChangeInvalidation.cpp:
468         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle):
469         * style/StyleInvalidator.cpp: Copied from Source/WebCore/css/StyleInvalidationAnalysis.cpp.
470         (WebCore::Style::Invalidator::Invalidator):
471         (WebCore::Style::Invalidator::invalidateIfNeeded):
472         (WebCore::Style::Invalidator::invalidateStyleForTree):
473         (WebCore::Style::Invalidator::invalidateStyle):
474         (WebCore::shouldDirtyAllStyle): Deleted.
475         (WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis): Deleted.
476         (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): Deleted.
477         (WebCore::StyleInvalidationAnalysis::invalidateStyleForTree): Deleted.
478         (WebCore::StyleInvalidationAnalysis::invalidateStyle): Deleted.
479         * style/StyleInvalidator.h: Copied from Source/WebCore/css/StyleInvalidationAnalysis.h.
480         (WebCore::StyleInvalidationAnalysis::dirtiesAllStyle): Deleted.
481         (WebCore::StyleInvalidationAnalysis::hasShadowPseudoElementRulesInAuthorSheet): Deleted.
482         * style/StyleScope.cpp:
483         (WebCore::Style::Scope::resolver):
484         (WebCore::Style::Scope::analyzeStyleSheetChange):
485
486 2017-05-02  Andrew Gold  <agold@apple.com>
487
488         Typo in AVAudioSessionCaptureDeviceManager.mm
489         https://bugs.webkit.org/show_bug.cgi?id=171572
490
491         Reviewed by Jer Noble.
492
493         We attempt to call +[AVAudioSession sharedSession], but the actual method is 
494         called +[AVAudioSession sharedInstance].
495
496         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
497         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
498
499 2017-05-02  Simon Fraser  <simon.fraser@apple.com>
500
501         Improve scrolling tree logging
502         https://bugs.webkit.org/show_bug.cgi?id=171574
503
504         Reviewed by Tim Horton.
505
506         Make a call to showScrollingStateTree() print debugging-related information like node and layer IDs.
507         Required fixing scrolling state tree nodes to respect ScrollingStateTreeAsTextBehavior, and fixing
508         fixed and sticky nodes to call super.
509
510         Also enhance compositing logging to show layer IDs, and to log for layer scrolling tree registration.
511
512         * page/scrolling/AsyncScrollingCoordinator.cpp:
513         (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
514         * page/scrolling/AsyncScrollingCoordinator.h:
515         * page/scrolling/ScrollingCoordinator.cpp:
516         (WebCore::ScrollingCoordinator::scrollingStateTreeAsText):
517         * page/scrolling/ScrollingCoordinator.h:
518         * page/scrolling/ScrollingStateFixedNode.cpp:
519         (WebCore::ScrollingStateFixedNode::dumpProperties):
520         * page/scrolling/ScrollingStateNode.cpp:
521         (WebCore::ScrollingStateNode::dumpProperties):
522         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
523         * page/scrolling/ScrollingStateNode.h:
524         * page/scrolling/ScrollingStateScrollingNode.cpp:
525         (WebCore::ScrollingStateScrollingNode::dumpProperties):
526         * page/scrolling/ScrollingStateStickyNode.cpp:
527         (WebCore::ScrollingStateStickyNode::dumpProperties):
528         * page/scrolling/ScrollingStateTree.cpp:
529         (showScrollingStateTree):
530         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
531         (WebCore::ScrollingCoordinatorMac::commitTreeState):
532         * rendering/RenderLayerBacking.cpp:
533         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
534         * rendering/RenderLayerCompositor.cpp:
535         (WebCore::RenderLayerCompositor::logLayerInfo):
536         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
537
538 2017-05-02  Daniel Bates  <dabates@apple.com>
539
540         Using StringView.split() instead of String.split() in some places
541         https://bugs.webkit.org/show_bug.cgi?id=170925
542
543         Reviewed by Darin Adler and Sam Weinig.
544
545         Replace some uses of String.split() with StringView.split() (added in r211087) as the latter
546         avoids the need to allocate an intermediary Vector of substrings. Instead StringView.split()
547         returns an iterator for traversing the substrings.
548
549         No functionality changed. So, no new tests.
550
551         * accessibility/AccessibilityObject.cpp: Convert some typedefs to modern C++ using declarations.
552         (WebCore::AccessibilityObject::ariaRoleToWebCoreRole): Modified code to use StringView.split().
553         (WebCore::AccessibilityObject::elementsFromAttribute): Ditto.
554         * dom/TreeScope.cpp:
555         (WebCore::TreeScope::getElementById): Added.
556         * dom/TreeScope.h:
557         * html/LinkRelAttribute.cpp:
558         (WebCore::LinkRelAttribute::LinkRelAttribute): Modified code to use StringView.split().
559         * html/parser/XSSAuditor.cpp:
560         (WebCore::semicolonSeparatedValueContainsJavaScriptURL): Ditto.
561         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
562         (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): Ditto.
563         * platform/network/CacheValidation.cpp:
564         (WebCore::collectVaryingRequestHeaders): Simplify code by using the String.split(UChar, Vector<String>&) overload.
565         * svg/SVGAnimationElement.cpp:
566         (WebCore::parseKeyTimes): Modified code to use StringView.split().
567         * svg/SVGToOTFFontConversion.cpp:
568         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto.
569         * testing/Internals.cpp:
570         (WebCore::Internals::setMediaSessionRestrictions): Ditto.
571         (WebCore::Internals::setMediaElementRestrictions): Ditto.
572         (WebCore::Internals::setAudioContextRestrictions): Ditto.
573         (WebCore::Internals::setPageMuted): Ditto.
574         * testing/Internals.h:
575
576 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
577
578         [GTK] Drop coordinated surfaces from the compositing thread as soon as possible
579         https://bugs.webkit.org/show_bug.cgi?id=171544
580
581         Reviewed by Žan Doberšek.
582
583         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
584         Remove atlasesToRemove from the GraphicsState. It is not a commit
585         state anymore.
586
587 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
588
589         [GTK] Recycle textures while handling tiles
590         https://bugs.webkit.org/show_bug.cgi?id=171541
591
592         Reviewed by Žan Doberšek.
593
594         * platform/graphics/texmap/TextureMapperTile.h:
595         Modified m_texture as a protected member to avoid unnessary
596         refcountings from the CoordinatedBackingStore.
597         * platform/graphics/texmap/coordinated/CoordinatedSurface.h:
598         Use reference instead of RefPtr to pass BitmapTexture
599
600         No new tests since there should be no change in behavior.
601
602 2017-05-02  Zalan Bujtas  <zalan@apple.com>
603
604         Defer AX cache update when text content changes until after layout is finished.
605         https://bugs.webkit.org/show_bug.cgi?id=171429
606         <rdar://problem/31885984>
607
608         Reviewed by Simon Fraser.
609
610         When the content of the RenderText changes (even as the result of a text-transform change)
611         instead of updating the AX cache eagerly (and trigger layout on a half-backed render tree)
612         we should just defer it until after the subsequent layout is done. 
613
614         Test: accessibility/crash-while-adding-text-child-with-transform.html
615
616         * accessibility/AXObjectCache.cpp:
617         (WebCore::AXObjectCache::remove):
618         (WebCore::AXObjectCache::performDeferredCacheUpdate):
619         (WebCore::AXObjectCache::recomputeDeferredIsIgnored):
620         (WebCore::AXObjectCache::deferTextChanged):
621         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted.
622         * accessibility/AXObjectCache.h:
623         (WebCore::AXObjectCache::deferTextChanged):
624         (WebCore::AXObjectCache::performDeferredCacheUpdate):
625         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted.
626         * page/FrameView.cpp:
627         (WebCore::FrameView::performPostLayoutTasks):
628         * rendering/RenderText.cpp:
629         (WebCore::RenderText::setText):
630
631 2017-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
632
633         Remove an extraneous call to dispatch_group_async in WebItemProviderPasteboard.mm
634         https://bugs.webkit.org/show_bug.cgi?id=171561
635
636         Reviewed by Tim Horton.
637
638         In -[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:], the lifetime of the dispatch group
639         `fileLoadingGroup` is already guarded by dispatch_group_enter/leave calls when beginning and concluding an
640         item provider load, respectively. As such, the call to dispatch_group_async serves no purpose and should be removed.
641
642         No new tests, since there is no change in behavior.
643
644         * platform/ios/WebItemProviderPasteboard.mm:
645         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
646
647 2017-05-02  Youenn Fablet  <youenn@apple.com>
648
649         [LibWebRTC] Set explicitly logging level in debug mode
650         https://bugs.webkit.org/show_bug.cgi?id=171562
651
652         Reviewed by Eric Carlson.
653
654         No change of behavior.
655
656         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
657         (WebCore::initializePeerConnectionFactoryAndThreads): Setting explictly LibWebRTC logging to Info level for
658         debug builds if WebRTC channel is on.
659
660 2017-05-02  Joanmarie Diggs  <jdiggs@igalia.com>
661
662         AX: Update implementation of aria-orientation
663         https://bugs.webkit.org/show_bug.cgi?id=171166
664
665         Reviewed by Chris Fleizach.
666
667         Update AccessibilityRenderObject::orientation() to be consistent with what is
668         in the ARIA 1.1 spec. Also add an isTreeGrid() convenience method to be consistent
669         with what we do for other roles.
670
671         Test: accessibility/aria-orientation.html
672
673         * accessibility/AccessibilityARIAGridRow.cpp:
674         (WebCore::AccessibilityARIAGridRow::isARIATreeGridRow):
675         * accessibility/AccessibilityObject.h:
676         (WebCore::AccessibilityObject::isTreeGrid):
677         * accessibility/AccessibilityRenderObject.cpp:
678         (WebCore::AccessibilityRenderObject::orientation):
679
680 2017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
681
682         REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
683         https://bugs.webkit.org/show_bug.cgi?id=169517
684         <rdar://problem/30652443>
685
686         Reviewed by Dean Jackson.
687
688         FontCascade::getGlyphsAndAdvancesForComplexText() is tasked with calculating paint advances for a
689         subrange of RTL text. It does this by creating a ComplexTextController, telling it to iterate to
690         the beginning of the subrange (outputting to a GlyphBuffer), then telling it to iterate to the end
691         of the subrange (outputting to another GlyphBuffer). Because the text is RTL, the sum of the
692         advances gathered so far is the distance from the right edge of the text to the left edge of the
693         subrange (because we advance in logical order). Therefore, the x-coordinate we are at now is the
694         total width minus the sum of both of the GlyphBuffers. For some reason, when I wrote this code I
695         forgot to add in the contribution from the first GlyphBuffer. Unfortunately, this particular
696         codepath is rarely hit in practice and completely untested, which made me miss it when I wrote it.
697
698         Test: fast/text/complex-text-selection.html
699
700         * platform/graphics/cocoa/FontCascadeCocoa.mm:
701         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
702
703 2017-05-02  Chris Dumez  <cdumez@apple.com>
704
705         [macOS] Flaky Crash under EventTarget::fireEventListeners on imported/blink/paint/deprecatedpaintlayer/non-self-painting-layer-overrides-visibility.html
706         https://bugs.webkit.org/show_bug.cgi?id=171406
707         <rdar://problem/30945281>
708
709         Reviewed by Eric Carlson.
710
711         I was unfortunately unable to reproduce the flaky crash locally. However, the crash trace
712         indicates that one of the EventTarget::scriptExecutionContext() overrides is returning a
713         stale ScriptExecutionContext pointer. Since a GenericEventQueue is involved, the EventTarget
714         is likely a media-related object. I therefore audited media classes that override
715         EventTarget::scriptExecutionContext() and found several that look unsafe. I am fixing those
716         by having them override ContextDestructionObserver, instead of having a raw
717         ScriptExecutionContext pointer member. This makes sure the pointer gets nulled out whenever
718         the scriptexecutioncontext gets destroyed, ensuring that those classes's
719         EventTarget::scriptExecutionContext() overrides can never return a stale pointer.
720
721         * Modules/mediasource/SourceBufferList.cpp:
722         (WebCore::SourceBufferList::SourceBufferList):
723         * Modules/mediasource/SourceBufferList.h:
724         * html/track/TextTrack.cpp:
725         (WebCore::TextTrack::TextTrack):
726         * html/track/TextTrack.h:
727         * html/track/TrackListBase.cpp:
728         (TrackListBase::TrackListBase):
729         * html/track/TrackListBase.h:
730
731 2017-05-02  Antti Koivisto  <antti@apple.com>
732
733         Document style resolvers should share user rulesets
734         https://bugs.webkit.org/show_bug.cgi?id=171549
735
736         Reviewed by Andreas Kling.
737
738         Large user stylesheets (like those used by ad blockers) can end up using lots of memory if
739         a document uses large number of shadow trees. User style is inherently per-document and
740         the resulting rulesets can be shared between the document and the shadow trees.
741
742         * css/DocumentRuleSets.cpp:
743         (WebCore::DocumentRuleSets::DocumentRuleSets):
744         (WebCore::DocumentRuleSets::userStyle):
745
746             Return per-document user style for shadow trees.
747
748         (WebCore::DocumentRuleSets::collectFeatures):
749         * css/DocumentRuleSets.h:
750         (WebCore::DocumentRuleSets::setUsesSharedUserStyle):
751         (WebCore::DocumentRuleSets::userStyle): Deleted.
752         * css/StyleResolver.cpp:
753         (WebCore::StyleResolver::StyleResolver):
754         (WebCore::StyleResolver::initializeUserStyle):
755
756             Separate user style initialization from construction.
757
758         * css/StyleResolver.h:
759         * style/StyleScope.cpp:
760         (WebCore::Style::Scope::resolver):
761
762             Don't initialize user style for user agents shadow trees.
763
764 2017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
765
766         Font Loading API specifies font is loaded but sizing of font after load reports inconsistent values
767         https://bugs.webkit.org/show_bug.cgi?id=168533
768
769         Reviewed by Zalan Bujtas.
770
771         Previously, we were marking all local() fonts as immediately successful,
772         regardless of whether or not they were present on the system. Instead, we
773         should use the load() function to make this determination and mark the font
774         as failed if it doesn't exist. (This is, after all, the whole point of the
775         load() function). This brings us in-line with Firefox's and Chrome's
776         behavior.
777
778         Test: fast/text/font-loading-local.html
779
780         * css/CSSFontFace.cpp:
781         (WebCore::CSSFontFace::pump): Remote loading requires the FontSelector,
782         but it isn't available for local fonts. Now that load() is called for both
783         local and remote fonts, the ASSERT() should be lowered into the load()
784         function and scoped to just the case where we have a remote font.
785         (WebCore::CSSFontFace::font): Ditto.
786         * css/CSSFontFaceSource.cpp:
787         (WebCore::CSSFontFaceSource::CSSFontFaceSource): Don't immediatley set
788         the success/failure state for local fonts.
789         (WebCore::CSSFontFaceSource::load): Move loading logic from font() to
790         load(). None of this code is new; it just is moved.
791         (WebCore::CSSFontFaceSource::font): Delete code moved to load().
792         * css/CSSFontFaceSource.h:
793         * css/FontFace.cpp:
794         (WebCore::FontFace::create):
795
796 2017-05-02  Youenn Fablet  <youenn@apple.com>
797
798         Allow media stream based videos with sound to autoplay if the page is already playing sound
799         https://bugs.webkit.org/show_bug.cgi?id=171447
800
801         Reviewed by Eric Carlson.
802
803         Test: http/tests/media/autoplay-if-audio-is-playing.html for ensuring non-mediastream based video will not autoplay.
804         Manual testing for the autoplay of media stream based videos since such a test should happen without using getUserMedia.
805
806         * html/MediaElementSession.cpp:
807         (WebCore::MediaElementSession::playbackPermitted):
808
809 2017-05-02  Chris Dumez  <cdumez@apple.com>
810
811         Use PassRefPtr less in editing code
812         https://bugs.webkit.org/show_bug.cgi?id=171534
813
814         Reviewed by Geoffrey Garen.
815
816         Use PassRefPtr less in editing code.
817
818         * editing/AppendNodeCommand.cpp:
819         (WebCore::AppendNodeCommand::AppendNodeCommand):
820         (WebCore::AppendNodeCommand::getNodesInCommand):
821         * editing/AppendNodeCommand.h:
822         (WebCore::AppendNodeCommand::create):
823         * editing/ApplyStyleCommand.cpp:
824         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
825         (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange):
826         * editing/BreakBlockquoteCommand.cpp:
827         (WebCore::BreakBlockquoteCommand::doApply):
828         * editing/CompositeEditCommand.cpp:
829         (WebCore::CompositeEditCommand::insertNodeBefore):
830         (WebCore::CompositeEditCommand::insertNodeAfter):
831         (WebCore::CompositeEditCommand::insertNodeAt):
832         (WebCore::CompositeEditCommand::appendNode):
833         (WebCore::CompositeEditCommand::moveRemainingSiblingsToNewParent):
834         (WebCore::CompositeEditCommand::mergeIdenticalElements):
835         (WebCore::CompositeEditCommand::insertNodeAtTabSpanPosition):
836         (WebCore::CompositeEditCommand::appendBlockPlaceholder):
837         (WebCore::CompositeEditCommand::insertBlockPlaceholder):
838         (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
839         (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt):
840         (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
841         (WebCore::CompositeEditCommand::moveParagraphs):
842         * editing/CompositeEditCommand.h:
843         * editing/CreateLinkCommand.cpp:
844         (WebCore::CreateLinkCommand::doApply):
845         * editing/DeleteSelectionCommand.cpp:
846         (WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss):
847         (WebCore::DeleteSelectionCommand::mergeParagraphs):
848         * editing/FormatBlockCommand.cpp:
849         (WebCore::FormatBlockCommand::formatRange):
850         * editing/IndentOutdentCommand.cpp:
851         (WebCore::IndentOutdentCommand::tryIndentingAsListItem):
852         (WebCore::IndentOutdentCommand::indentIntoBlockquote):
853         (WebCore::IndentOutdentCommand::outdentParagraph):
854         * editing/InsertLineBreakCommand.cpp:
855         (WebCore::InsertLineBreakCommand::doApply):
856         * editing/InsertLineBreakCommand.h:
857         * editing/InsertListCommand.cpp:
858         (WebCore::InsertListCommand::fixOrphanedListChild):
859         (WebCore::InsertListCommand::doApplyForSingleParagraph):
860         (WebCore::InsertListCommand::unlistifyParagraph):
861         (WebCore::InsertListCommand::listifyParagraph):
862         * editing/InsertListCommand.h:
863         * editing/InsertNodeBeforeCommand.cpp:
864         (WebCore::InsertNodeBeforeCommand::InsertNodeBeforeCommand):
865         (WebCore::InsertNodeBeforeCommand::doApply):
866         (WebCore::InsertNodeBeforeCommand::doUnapply):
867         (WebCore::InsertNodeBeforeCommand::getNodesInCommand):
868         * editing/InsertNodeBeforeCommand.h:
869         (WebCore::InsertNodeBeforeCommand::create):
870         * editing/InsertParagraphSeparatorCommand.cpp:
871         (WebCore::InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock):
872         (WebCore::InsertParagraphSeparatorCommand::doApply):
873         * editing/InsertParagraphSeparatorCommand.h:
874         * editing/InsertTextCommand.cpp:
875         (WebCore::InsertTextCommand::positionInsideTextNode):
876         (WebCore::InsertTextCommand::insertTab):
877         * editing/ModifySelectionListLevel.cpp:
878         (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeBefore):
879         (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeAfter):
880         (WebCore::ModifySelectionListLevelCommand::appendSiblingNodeRange):
881         (WebCore::IncreaseSelectionListLevelCommand::doApply):
882         * editing/RemoveNodePreservingChildrenCommand.cpp:
883         (WebCore::RemoveNodePreservingChildrenCommand::doApply):
884         * editing/ReplaceSelectionCommand.cpp:
885         (WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
886         (WebCore::ReplaceSelectionCommand::mergeEndIfNeeded):
887         (WebCore::ReplaceSelectionCommand::doApply):
888         (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
889         (WebCore::ReplaceSelectionCommand::insertAsListItems):
890         * editing/SimplifyMarkupCommand.cpp:
891         (WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove):
892
893 2017-05-02  Ben Kelly <ben@wanderview.com>
894
895         Set Response.blob() type correctly when body is a ReadableStream.
896         https://bugs.webkit.org/show_bug.cgi?id=171489
897
898         Reviewed by Youenn Fablet
899
900         The Fetch API specification requires setting the blob contentType
901         using the Content-Type header value, if present.  Currently WebKit
902         only sets the type on the FetchBodyConsumer when FetchBody::blob()
903         is called.  Unfortunately, this is never called if the body is
904         actually a ReadableStream.
905
906         This change allows WebKit to pass the "Consume response's body: from
907         stream to blob" case in the WPT response-consume.html test.
908
909         Test: http://w3c-test.org/fetch/api/response/response-consume.html
910
911         * Modules/fetch/FetchResponse.cpp:
912         (WebCore::FetchResponse::startConsumingStream): Modified to call
913         FetchBodyConsumer::setContentType() before processing the stream.
914
915 2017-05-02  Ryan Haddad  <ryanhaddad@apple.com>
916
917         Unreviewed, rolling out r216069.
918
919         This change broke the build.
920
921         Reverted changeset:
922
923         "Document style resolvers should share user rulesets"
924         https://bugs.webkit.org/show_bug.cgi?id=171549
925         http://trac.webkit.org/changeset/216069
926
927 2017-05-02  Antti Koivisto  <antti@apple.com>
928
929         Document style resolvers should share user rulesets
930         https://bugs.webkit.org/show_bug.cgi?id=171549
931
932         Reviewed by Andreas Kling.
933
934         Large user stylesheets (like those used by ad blockers) can end up using lots of memory if
935         a document uses large number of shadow trees. User style is inherently per-document and
936         the resulting rulesets can be shared between the document and the shadow trees.
937
938         * css/DocumentRuleSets.cpp:
939         (WebCore::DocumentRuleSets::DocumentRuleSets):
940         (WebCore::DocumentRuleSets::userStyle):
941
942             Return per-document user style for shadow trees.
943
944         (WebCore::DocumentRuleSets::collectFeatures):
945         * css/DocumentRuleSets.h:
946         (WebCore::DocumentRuleSets::setUsesSharedUserStyle):
947         (WebCore::DocumentRuleSets::userStyle): Deleted.
948         * css/StyleResolver.cpp:
949         (WebCore::StyleResolver::StyleResolver):
950         (WebCore::StyleResolver::initializeUserStyle):
951
952             Separate user style initialization from construction.
953
954         * css/StyleResolver.h:
955         * style/StyleScope.cpp:
956         (WebCore::Style::Scope::resolver):
957
958             Don't initialize user style for user agents shadow trees.
959
960 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
961
962         [GTK] Remove undefined nativeImage method from the ImageBuffer's header
963         https://bugs.webkit.org/show_bug.cgi?id=171502
964
965         Unreviewed, remove a dead code accidentally committed in r194630.
966
967         * platform/graphics/ImageBuffer.h: Remove nativeImage method.
968         It is accidentally added during a refectorying at r194630, and there is
969         no definition for this method.
970
971 2017-05-02  Carlos Garcia Campos  <cgarcia@igalia.com>
972
973         [GStreamer] Dailymotion live stream videos don't play
974         https://bugs.webkit.org/show_bug.cgi?id=170767
975
976         Reviewed by Sergio Villar Senin.
977
978         The video shows a message saying that an error occurred and nothing is played. There are actually several
979         problems with dailymotion. The main issue is that URLs are redirected by the server, and GStreamer needs to
980         know the redirected URL. Once GStreamer knows the redirected URL the error message no longer appears, the video
981         starts but it always stops after a few seconds. This is because the source receives an early EOS while still
982         downloading the fragments. The reason of the early EOS is because dailymotion sends a wrong Content-Length header,
983         something that is expected to happen and we correctly handle that case when receiving the data, by updating the
984         size accordingly if the bytes received are longer than the expected content length. This particular case
985         doesn't work well with GStreamer automatic EOS handling, which is the default. At some point, GStreamer detects
986         that the bytes received are at least the expected ones and emits a GST_EVENT_EOS that the GstUriDownloader
987         handles finishing the download early. We should always disable automatic EOS, since we know when EOS actually
988         happens and we already call gst_app_src_end_of_stream(). This patch also emits a GST_EVENT_CUSTOM_DOWNSTREAM_STICKY
989         event to let GStreamer know about the HTTP headers sent and received.
990
991         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
992         (webkit_web_src_init): Disable automatic EOS.
993         (webKitWebSrcGetProperty): Return the redirected URL in case of redirection.
994         (webKitWebSrcStart): Pass the ResourceRequest to the stream clients.
995         (webKitWebSrcQueryWithParent): Set the redirected URL in the query in case of redirection.
996         (webKitWebSrcSetUri): Clear also the redirected URL when setting a new URI.
997         (StreamingClient::StreamingClient): Use GRefPtr for the source and initialize the request too.
998         (StreamingClient::~StreamingClient): Remove explicit unref.
999         (StreamingClient::createReadBuffer):
1000         (StreamingClient::handleResponseReceived): Initialize the redirected URL in case of redirection. Create and push
1001         the HTTP headers event.
1002         (StreamingClient::handleDataReceived):
1003         (StreamingClient::handleNotifyFinished):
1004         (CachedResourceStreamingClient::CachedResourceStreamingClient):
1005         (CachedResourceStreamingClient::responseReceived):
1006         (CachedResourceStreamingClient::accessControlCheckFailed):
1007         (CachedResourceStreamingClient::loadFailed):
1008         (ResourceHandleStreamingClient::ResourceHandleStreamingClient):
1009         (ResourceHandleStreamingClient::didFail):
1010         (ResourceHandleStreamingClient::wasBlocked):
1011         (ResourceHandleStreamingClient::cannotShowURL):
1012
1013 2017-05-02  Youenn Fablet  <youenn@apple.com>
1014
1015         Adding logging to RTCPeerConnection to allow WebRTC application debugging
1016         https://bugs.webkit.org/show_bug.cgi?id=171531
1017
1018         Reviewed by Jon Lee.
1019
1020         No change of behavior.
1021         This allows easier debugging of webrtc-enabled web pages.
1022
1023         * Modules/mediastream/PeerConnectionBackend.cpp:
1024         (WebCore::PeerConnectionBackend::createOfferSucceeded):
1025         (WebCore::PeerConnectionBackend::createOfferFailed):
1026         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1027         (WebCore::PeerConnectionBackend::createAnswerFailed):
1028         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1029         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
1030         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1031         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
1032         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1033         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1034         (WebCore::PeerConnectionBackend::newICECandidate):
1035         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
1036         * Modules/mediastream/RTCPeerConnection.cpp:
1037         (WebCore::RTCPeerConnection::queuedCreateOffer):
1038         (WebCore::RTCPeerConnection::queuedCreateAnswer):
1039         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
1040         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
1041         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
1042
1043 2017-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1044
1045         [GTK] Crash at WebCore::ResourceHandle::clearClient() when streaming live video from dailymotion
1046         https://bugs.webkit.org/show_bug.cgi?id=169725
1047
1048         Reviewed by Michael Catanzaro.
1049
1050         Make ResourceHandleStreamingClient refcounted and add an invalidate method to do the cleanup in the networking
1051         thread while keeping a reference.
1052
1053         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1054         (webKitWebSrcStop): Call invalidate before reseting client pointer.
1055         (webKitWebSrcStart): Ditto.
1056         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Remove all cleanup code after the run loop run call.
1057         (ResourceHandleStreamingClient::~ResourceHandleStreamingClient): Just detach the thread.
1058         (ResourceHandleStreamingClient::invalidate): Schedule a task on the networking thread to clean up and fiish the
1059         run loop, protecting this.
1060         (ResourceHandleStreamingClient::setDefersLoading): Protect this.
1061         (ResourceHandleStreamingClient::didReceiveResponse): Do nothing if client was invalidated.
1062         (ResourceHandleStreamingClient::didReceiveBuffer): Ditto.
1063         (ResourceHandleStreamingClient::didFinishLoading): Ditto.
1064
1065 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
1066
1067         [GCrypt] ECDSA signing and verification support
1068         https://bugs.webkit.org/show_bug.cgi?id=171103
1069
1070         Reviewed by Carlos Garcia Campos.
1071
1072         Implement WebCrypto ECDSA support for configurations that
1073         are using libgcrypt.
1074
1075         For signing, the provided data is first hashed with the specified
1076         digest algorithm and embedded into a data s-expression. It's then
1077         passed to gcry_pk_sign() along with the private key, returning a
1078         sig-val s-expression. The r and s parameters are then retrieved from
1079         that sig-val and their data extracted and concatenated in the output
1080         Vector<>.
1081
1082         For verification, the data is again hashed and embedded into a data
1083         s-expression. The r and s parameters are extracted from the passed-in
1084         signature Vector<> and embedded into a sig-val s-expression. The data
1085         and sig-val s-expressions are then passed to gcry_pk_verify() along
1086         with the public key. The verification succeeds if no error is returned
1087         and fails if the returned error code is GPG_ERR_BAD_SIGNATURE.
1088
1089         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
1090         (WebCore::hashCryptoDigestAlgorithm):
1091         (WebCore::hashAlgorithmName):
1092         (WebCore::mpiData):
1093         (WebCore::gcryptSign):
1094         (WebCore::gcryptVerify):
1095         (WebCore::CryptoAlgorithmECDSA::platformSign):
1096         (WebCore::CryptoAlgorithmECDSA::platformVerify):
1097
1098 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
1099
1100         [GCrypt] HKDF bit derivation support
1101         https://bugs.webkit.org/show_bug.cgi?id=171074
1102
1103         Reviewed by Michael Catanzaro.
1104
1105         Implement bit derivation support for the HKDF algorithm for configurations
1106         that use libgcrypt.
1107
1108         libgcrypt doesn't provide HKDF support out of the box, so we have to
1109         implement the two steps manually. In the first one, we retrieve the
1110         pseudo-random key by using the specified MAC algorithm with the salt data
1111         as the key and the key data as the input keying material.
1112
1113         In the expand step, we do the required amount of iterations to derive
1114         a sufficient amount of data, using the same MAC algorithm with the
1115         pseudo-random key from the previous step on the data we compose from the
1116         previous block data, the info data, and the current iteration value. The
1117         resulting blocks are appended together until they can be clipped to the
1118         desired output length.
1119
1120         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
1121         (WebCore::macAlgorithmForHashFunction):
1122         (WebCore::gcryptDeriveBits):
1123         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
1124
1125 2017-05-01  Zan Dobersek  <zdobersek@igalia.com>
1126
1127         [GCrypt] ECDH bit derivation support
1128         https://bugs.webkit.org/show_bug.cgi?id=171070
1129
1130         Reviewed by Michael Catanzaro.
1131
1132         Implement bit derivation support for the ECDH algorithm for configurations
1133         that use libgcrypt.
1134
1135         This is done by retrieving the private key data and wrapping it in a new
1136         data s-expression. That's then encrypted with the public key, and the
1137         returned s-expression contains the shared point data. That data is then
1138         decoded into an EC point, from which the x-coordinate is retrieved. This
1139         coordinate data is finally our bit derivation result.
1140
1141         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
1142         (WebCore::gcryptDerive):
1143         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
1144
1145 2017-05-01  Youenn Fablet  <youenn@apple.com>
1146
1147         Ensure RealtimeOutgoingVideoSource sends a black frame when its related source is muted
1148         https://bugs.webkit.org/show_bug.cgi?id=171497
1149
1150         Reviewed by Eric Carlson.
1151
1152         Covered by updated test.
1153
1154         When the track is being muted or disabled, send a black frame explicitly.
1155         VideoToolBox sometimes does not output a frame until it receives the other.
1156         That is why we end up sending two frames, the second asynchronously so that libwebrtc will not skip it.
1157         Also storing the rotation so that we keep the same rotation for black frames.
1158         Storing width and height for consistency as well.
1159
1160         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1161         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
1162         (WebCore::RealtimeOutgoingVideoSource::setSource):
1163         (WebCore::RealtimeOutgoingVideoSource::stop):
1164         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
1165         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
1166         (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource):
1167         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrame):
1168         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
1169         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1170         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1171
1172 2017-05-01  Joseph Pecoraro  <pecoraro@apple.com>
1173
1174         Simplify Resource Timing handling of cached resource
1175         https://bugs.webkit.org/show_bug.cgi?id=171526
1176
1177         Reviewed by Youenn Fablet.
1178
1179         * loader/DocumentThreadableLoader.cpp:
1180         (WebCore::DocumentThreadableLoader::loadRequest):
1181         * loader/SubresourceLoader.cpp:
1182         (WebCore::SubresourceLoader::init):
1183         (WebCore::SubresourceLoader::reportResourceTiming):
1184         Use auto in ResourceTiming construction.
1185         Eliminate an outdated comment.
1186
1187         * loader/cache/CachedResourceLoader.cpp:
1188         (WebCore::CachedResourceLoader::requestResource):
1189         We can avoid the checks around the request.origin. It should already
1190         be the cases we were checking and asserting because of login in
1191         CachedResourceLoader::prepareFetch.
1192
1193 2017-05-01  Ryan Haddad  <ryanhaddad@apple.com>
1194
1195         Unreviewed, rolling out r216024.
1196
1197         This change caused ios-simulator LayoutTests to exit early
1198         with assertion failures.
1199
1200         Reverted changeset:
1201
1202         "Add audio device change notifications to AudioSession."
1203         https://bugs.webkit.org/show_bug.cgi?id=171403
1204         http://trac.webkit.org/changeset/216024
1205
1206 2017-05-01  Timothy Horton  <timothy_horton@apple.com>
1207
1208         Expose viewport-fit instead of clip-to-safe-area
1209         https://bugs.webkit.org/show_bug.cgi?id=171503
1210         <rdar://problem/31918249>
1211
1212         Reviewed by Simon Fraser.
1213
1214         Tests: fast/viewport/ios/viewport-fit-auto.html
1215                fast/viewport/ios/viewport-fit-contain.html
1216                fast/viewport/ios/viewport-fit-cover.html
1217
1218         * dom/ConstantPropertyMap.cpp:
1219         (WebCore::ConstantPropertyMap::buildValues):
1220         (WebCore::ConstantPropertyMap::updateConstantsForUnobscuredSafeAreaInsets):
1221         (WebCore::ConstantPropertyMap::didChangeSafeAreaInsets):
1222         (WebCore::ConstantPropertyMap::updateConstantsForObscuredInsets): Deleted.
1223         (WebCore::ConstantPropertyMap::didChangeObscuredInsets): Deleted.
1224         * dom/ConstantPropertyMap.h:
1225         Retrieve the safe area insets from page, instead of assuming that we should
1226         just expose the entire obscured inset. Also, do some renames.
1227
1228         * dom/ViewportArguments.cpp:
1229         (WebCore::ViewportArguments::resolve):
1230         (WebCore::parseViewportFitValue):
1231         (WebCore::setViewportFeature):
1232         * dom/ViewportArguments.h:
1233         (WebCore::ViewportArguments::operator==):
1234         * page/ChromeClient.h:
1235         * page/FrameView.cpp:
1236         (WebCore::FrameView::enableSpeculativeTilingIfNeeded):
1237         (WebCore::FrameView::calculateExtendedBackgroundMode):
1238         (WebCore::FrameView::setClipToSafeArea): Deleted.
1239         * page/FrameView.h:
1240         * page/ViewportConfiguration.cpp:
1241         (WebCore::ViewportConfiguration::updateConfiguration):
1242         (WebCore::operator<<):
1243         (WebCore::ViewportConfiguration::description):
1244         (WebCore::ViewportConfiguration::dump):
1245         * page/ViewportConfiguration.h:
1246         (WebCore::ViewportConfiguration::avoidsUnsafeArea):
1247         (WebCore::ViewportConfiguration::Parameters::Parameters):
1248         (WebCore::ViewportConfiguration::clipToSafeArea): Deleted.
1249         * rendering/RenderLayerCompositor.cpp:
1250         (WebCore::RenderLayerCompositor::updateRootContentLayerClipping):
1251         * rendering/RenderObject.cpp:
1252         (WebCore::RenderObject::repaintUsingContainer):
1253         Un-do changes to support clip-to-safe-area, and instead implement
1254         a new viewport-fit argument in the viewport meta tag, which takes
1255         "auto", "contain", and "cover". "auto" and "contain" cause web content
1256         to lay out excluding the safe area inset from the layout size, while
1257         "cover" causes web content to expand into the unsafe area.
1258
1259         * page/Page.cpp:
1260         (WebCore::Page::setUnobscuredSafeAreaInsets):
1261         (WebCore::Page::setObscuredInsets): Deleted.
1262         * page/Page.h:
1263         (WebCore::Page::setObscuredInsets):
1264         (WebCore::Page::unobscuredSafeAreaInsets):
1265         Keep safe area and obscured insets separately.
1266
1267 2017-05-01  Chris Dumez  <cdumez@apple.com>
1268
1269         Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
1270         https://bugs.webkit.org/show_bug.cgi?id=171499
1271
1272         Reviewed by Sam Weinig.
1273
1274         Documents created using DOMParser.parseFromString should inherit their context document's
1275         origin / URL:
1276         - https://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring
1277
1278         Test: fast/dom/domparser-parsefromstring-origin.html
1279
1280         * xml/DOMParser.cpp:
1281         (WebCore::DOMParser::parseFromString):
1282
1283 2017-05-01  Ross Kirsling  <ross.kirsling@sony.com>
1284
1285         Web Inspector: ASSERT(!m_startedComposite) fails when recording on non-Cocoa Timeline
1286         https://bugs.webkit.org/show_bug.cgi?id=171363
1287
1288         Reviewed by Matt Baker.
1289
1290         * page/FrameView.cpp:
1291         (WebCore::FrameView::flushCompositingStateIncludingSubframes): Add PLATFORM(COCOA) guard.
1292
1293 2017-05-01  David Kilzer  <ddkilzer@apple.com>
1294
1295         Stop using strcpy() in fullyQualifiedInfoTableName() from Database.cpp
1296         <https://webkit.org/b/171517>
1297
1298         Reviewed by Brady Eidson.
1299
1300         * Modules/webdatabase/Database.cpp:
1301         (WebCore::fullyQualifiedInfoTableName): Switch from strcpy() to
1302         snprintf().
1303
1304 2017-05-01  Chris Fleizach  <cfleizach@apple.com>
1305
1306         AX: Support time@datetime for verbosity clarification of dates, times, and durations
1307         https://bugs.webkit.org/show_bug.cgi?id=171498
1308         <rdar://problem/12985540>
1309
1310         Reviewed by Joanmarie Diggs.
1311
1312         Expose the datetime attribute value.
1313
1314         Test: accessibility/datetime-attribute.html
1315
1316         * accessibility/AccessibilityObject.cpp:
1317         (WebCore::AccessibilityObject::datetimeAttributeValue):
1318         * accessibility/AccessibilityObject.h:
1319         * accessibility/AccessibilityRenderObject.cpp:
1320         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
1321         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1322         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1323         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1324         (-[WebAccessibilityObjectWrapper accessibilityDatetimeValue]):
1325         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1326         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
1327         (createAccessibilityRoleMap):
1328         (-[WebAccessibilityObjectWrapper subrole]):
1329         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1330
1331 2017-05-01  Joseph Pecoraro  <pecoraro@apple.com>
1332
1333         RejectedPromiseTracker should produce better callstacks and avoid capturing callstacks unless there is a debugger/inspector
1334         https://bugs.webkit.org/show_bug.cgi?id=171416
1335         <rdar://problem/31899425>
1336
1337         Reviewed by Saam Barati and Brian Burg.
1338
1339         Test: inspector/console/message-stack-trace.html
1340
1341         * dom/RejectedPromiseTracker.cpp:
1342         (WebCore::UnhandledPromise::UnhandledPromise):
1343         (WebCore::UnhandledPromise::callStack):
1344         Switch to RefPtr to allow not capturing the stack.
1345
1346         (WebCore::createScriptCallStackFromReason):
1347         Use the VM's lastException if the value in the exception is the
1348         rejected promise value. Using the Exception call stack is important
1349         because uncaught exceptions in promise rejections trigger a built-in
1350         try/catch and re-enter JavaScript before passing the Error through
1351         to the RejectionTracker. When possible, we don't want to capture the
1352         new stack originating from the try/catch. Instead, we want the stack
1353         from before the try/catch when the error was created.
1354
1355         * dom/ScriptExecutionContext.h:
1356         * dom/ScriptExecutionContext.cpp:
1357         (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
1358         Switch to a pointer since the stack could be empty.
1359
1360 2017-05-01  Jer Noble  <jer.noble@apple.com>
1361
1362         Unreviewed build fix after r216033.
1363
1364         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1365         (WebCore::CoreAudioCaptureSource::create):
1366
1367 2017-05-01  Jer Noble  <jer.noble@apple.com>
1368
1369         Use AVAudioSession to enumerate audio capture devices on iOS
1370         https://bugs.webkit.org/show_bug.cgi?id=170861
1371         <rdar://problem/31653658>
1372
1373         Reviewed by Eric Carlson.
1374
1375         Hook up the new AVAudioSessionCaptureDeviceManager class to CoreAudioCaptureSource and to the (increasingly ill-named)
1376         RealtimeMediaSourceCenterMac.
1377
1378         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1379         (WebCore::CoreAudioCaptureSource::create):
1380         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1381         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
1382
1383 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
1384
1385         [ATK] Expose values of aria-rowcount, aria-colcount, aria-rowindex, aria-colindex, aria-rowspan, and aria-colspan as object attributes
1386         https://bugs.webkit.org/show_bug.cgi?id=171496
1387
1388         Reviewed by Chris Fleizach.
1389
1390         Expose valid, author-provided values as an object attribute. In order to distinguish
1391         author-provided values from the default returned by WebCore Accessibility (1), change
1392         the default return value to -1. We cannot return 0 because the ARIA spec states that
1393         0 is a valid value for authors to provide to indicate that the cell spans the remaining
1394         rows in the row group.
1395
1396         Also removed some legacy code. The "layout-guess" attribute was needed and expected
1397         as a way for AT-SPI2-based assistive technologies to identify layout tables. WebCore
1398         Accessibility does not expose tables which are purely for layout as accessible tables,
1399         and WebKitGtk uses that implementation, thus this attribute is no longer relevant.
1400
1401         No new tests. Unskipped existing test which is now passing.
1402
1403         * accessibility/AccessibilityARIAGridCell.cpp:
1404         (WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex):
1405         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
1406         * accessibility/AccessibilityTableCell.cpp:
1407         (WebCore::AccessibilityTableCell::ariaColumnSpan):
1408         (WebCore::AccessibilityTableCell::ariaRowSpan):
1409         * accessibility/AccessibilityTableCell.h:
1410         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1411         (webkitAccessibleGetAttributes):
1412
1413 2017-05-01  Jer Noble  <jer.noble@apple.com>
1414
1415         Add audio device change notifications to AudioSession.
1416         https://bugs.webkit.org/show_bug.cgi?id=171403
1417
1418         Reviewed by Eric Carlson.
1419
1420         Add notifications to AudioSession which fire when the current input and output audio devices
1421         change. Also add a notification when audio services are lost (which will only fire on iOS).
1422         Take this opportunity to make the existing hardwareMutedStateDidChange() notification be
1423         platform agnostic, to move the outputDeviceSupportsLowPowerMode() code from AudioHardwareListener,
1424         and to do a few more clean-ups of the AudioSession code.
1425
1426         * WebCore.xcodeproj/project.pbxproj:
1427         * html/HTMLMediaElement.cpp:
1428         (WebCore::HTMLMediaElement::HTMLMediaElement):
1429         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1430         * html/HTMLMediaElement.h:
1431         * platform/audio/AudioSession.cpp:
1432         (WebCore::AudioSession::AudioSession):
1433         * platform/audio/AudioSession.h:
1434         (WebCore::AudioSession::Observer::hardwareMutedStateDidChange):
1435         (WebCore::AudioSession::Observer::audioInputDeviceChanged):
1436         (WebCore::AudioSession::Observer::audioOutputDeviceChanged):
1437         (WebCore::AudioSession::Observer::audioServicesLost):
1438         (WebCore::AudioSession::Observer::audioServicesReset):
1439         (WebCore::AudioSession::MutedStateObserver::~MutedStateObserver): Deleted.
1440         * platform/audio/ios/AudioSessionIOS.mm:
1441         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
1442         (WebCore::AudioSession::AudioSession):
1443         (WebCore::AudioSession::setCategoryOverride):
1444         (WebCore::AudioSession::categoryOverride):
1445         (WebCore::AudioSession::isMuted):
1446         (WebCore::AudioSession::outputDeviceSupportsLowPowerMode):
1447         (WebCore::AudioSession::addObserver):
1448         (WebCore::AudioSession::removeObserver):
1449         * platform/audio/mac/AudioSessionMac.mm: Renamed from Source/WebCore/platform/audio/mac/AudioSessionMac.cpp.
1450         (WebCore::defaultDevice):
1451         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
1452         (WebCore::AudioSession::AudioSession):
1453         (WebCore::AudioSession::~AudioSession):
1454         (WebCore::AudioSession::category):
1455         (WebCore::AudioSession::setCategory):
1456         (WebCore::AudioSession::categoryOverride):
1457         (WebCore::AudioSession::setCategoryOverride):
1458         (WebCore::AudioSession::sampleRate):
1459         (WebCore::AudioSession::bufferSize):
1460         (WebCore::AudioSession::numberOfOutputChannels):
1461         (WebCore::AudioSession::tryToSetActive):
1462         (WebCore::AudioSession::preferredBufferSize):
1463         (WebCore::AudioSession::setPreferredBufferSize):
1464         (WebCore::AudioSession::isMuted):
1465         (WebCore::currentDeviceSupportsLowPowerBufferSize):
1466         (WebCore::AudioSession::outputDeviceSupportsLowPowerMode):
1467         (WebCore::AudioSession::addObserver):
1468         (WebCore::AudioSession::removeObserver):
1469
1470 2017-05-01  Chris Dumez  <cdumez@apple.com>
1471
1472         Do not dispatch SVG load event in frameless documents
1473         https://bugs.webkit.org/show_bug.cgi?id=171505
1474         <rdar://problem/31799776>
1475
1476         Reviewed by Andreas Kling.
1477
1478         We should not dispatch SVG load events in frameless documents. <https://trac.webkit.org/changeset/173028/webkit>
1479         took care of most load events but forgot the SVG load event.
1480
1481         Test: fast/dom/domparser-parsefromstring-svg-load-event.html
1482
1483         * dom/Document.cpp:
1484         (WebCore::Document::implicitClose):
1485
1486 2017-05-01  Chris Dumez  <cdumez@apple.com>
1487
1488         Remove some usage of PassRefPtr in editing code
1489         https://bugs.webkit.org/show_bug.cgi?id=171490
1490
1491         Reviewed by Darin Adler.
1492
1493         Remove some usage of PassRefPtr in editing code.
1494
1495         * dom/DocumentMarkerController.cpp:
1496         (WebCore::DocumentMarkerController::markersInRange):
1497         (DocumentMarkerController::hasMarkers):
1498         (DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
1499         * dom/DocumentMarkerController.h:
1500         * editing/AlternativeTextController.cpp:
1501         (WebCore::AlternativeTextController::isSpellingMarkerAllowed):
1502         (WebCore::AlternativeTextController::show):
1503         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
1504         (WebCore::AlternativeTextController::timerFired):
1505         (WebCore::AlternativeTextController::handleAlternativeTextUIResult):
1506         (WebCore::AlternativeTextController::recordAutocorrectionResponse):
1507         (WebCore::AlternativeTextController::markReversed):
1508         (WebCore::AlternativeTextController::markCorrection):
1509         (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection):
1510         (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult):
1511         (WebCore::AlternativeTextController::applyDictationAlternative):
1512         * editing/AlternativeTextController.h:
1513         (WebCore::AlternativeTextController::UNLESS_ENABLED):
1514         * editing/ApplyStyleCommand.cpp:
1515         (WebCore::createFontElement):
1516         (WebCore::createStyleSpanElement):
1517         (WebCore::ApplyStyleCommand::ApplyStyleCommand):
1518         (WebCore::copyStyleOrCreateEmpty):
1519         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
1520         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
1521         (WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
1522         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
1523         (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
1524         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
1525         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
1526         (WebCore::ApplyStyleCommand::removeInlineStyle):
1527         (WebCore::ApplyStyleCommand::shouldSplitTextElement):
1528         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
1529         (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
1530         (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange):
1531         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
1532         * editing/ApplyStyleCommand.h:
1533         (WebCore::ApplyStyleCommand::create):
1534         (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
1535         * editing/CompositeEditCommand.cpp:
1536         (WebCore::CompositeEditCommand::applyCommandToComposite):
1537         (WebCore::CompositeEditCommand::applyStyledElement):
1538         (WebCore::CompositeEditCommand::removeStyledElement):
1539         (WebCore::CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes):
1540         (WebCore::CompositeEditCommand::inputText):
1541         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
1542         (WebCore::CompositeEditCommand::pushAnchorElementDown):
1543         * editing/CompositeEditCommand.h:
1544         * editing/DeleteSelectionCommand.cpp:
1545         (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection):
1546         * editing/DictationCommand.cpp:
1547         (WebCore::DictationCommand::insertTextRunWithoutNewlines):
1548         * editing/EditingStyle.cpp:
1549         (WebCore::copyEditingProperties):
1550         (WebCore::copyPropertiesFromComputedStyle):
1551         (WebCore::extractPropertyValue):
1552         (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
1553         (WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue):
1554         (WebCore::EditingStyle::setStyle):
1555         (WebCore::EditingStyle::copy):
1556         (WebCore::EditingStyle::extractAndRemoveBlockProperties):
1557         (WebCore::EditingStyle::extractAndRemoveTextDirection):
1558         (WebCore::EditingStyle::mergeInlineStyleOfElement):
1559         (WebCore::extractEditingProperties):
1560         (WebCore::EditingStyle::styleAtSelectionStart):
1561         (WebCore::getPropertiesNotIn):
1562         * editing/EditingStyle.h:
1563         * editing/Editor.cpp:
1564         (WebCore::Editor::handleTextEvent):
1565         (WebCore::Editor::replaceSelectionWithFragment):
1566         (WebCore::Editor::insertOrderedList):
1567         (WebCore::Editor::insertUnorderedList):
1568         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
1569         (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
1570         (WebCore::Editor::markAndReplaceFor):
1571         (WebCore::Editor::changeBackToReplacedString):
1572         (WebCore::Editor::updateMarkersForWordsAffectedByEditing):
1573         (WebCore::Editor::rangeForPoint):
1574         * editing/Editor.h:
1575         * editing/ModifySelectionListLevel.cpp:
1576         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevel):
1577         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered):
1578         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered):
1579         * editing/ModifySelectionListLevel.h:
1580         * editing/SpellChecker.cpp:
1581         (WebCore::SpellChecker::requestCheckingFor):
1582         (WebCore::SpellChecker::didCheckSucceed):
1583         * editing/SpellChecker.h:
1584         (WebCore::SpellCheckRequest::checkingRange):
1585         (WebCore::SpellCheckRequest::paragraphRange):
1586         (WebCore::SpellCheckRequest::rootEditableElement):
1587         * editing/SpellingCorrectionCommand.cpp:
1588         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
1589         (WebCore::SpellingCorrectionCommand::willApplyCommand):
1590         (WebCore::SpellingCorrectionCommand::doApply):
1591         (WebCore::SpellingCorrectionCommand::targetRanges):
1592         * editing/SpellingCorrectionCommand.h:
1593         (WebCore::SpellingCorrectionCommand::create):
1594         * editing/SurroundingText.h:
1595         * editing/TextCheckingHelper.cpp:
1596         (WebCore::TextCheckingParagraph::expandRangeToNextEnd):
1597         (WebCore::TextCheckingParagraph::rangeLength):
1598         (WebCore::TextCheckingParagraph::paragraphRange):
1599         (WebCore::TextCheckingParagraph::subrange):
1600         (WebCore::TextCheckingParagraph::offsetTo):
1601         (WebCore::TextCheckingParagraph::offsetAsRange):
1602         (WebCore::TextCheckingParagraph::text):
1603         (WebCore::TextCheckingParagraph::checkingStart):
1604         * editing/TextCheckingHelper.h:
1605         * editing/TypingCommand.cpp:
1606         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
1607         * editing/cocoa/HTMLConverter.mm:
1608         (HTMLConverterCaches::computedStylePropertyForElement):
1609         (HTMLConverterCaches::inlineStylePropertyForElement):
1610         * page/ios/FrameIOS.mm:
1611         (WebCore::Frame::interpretationsForCurrentRoot):
1612
1613 2017-05-01  Jer Noble  <jer.noble@apple.com>
1614
1615         Add notifications from CaptureDeviceManager (and subclasses) when device lists change
1616         https://bugs.webkit.org/show_bug.cgi?id=171442
1617
1618         Reviewed by Youenn Fablet.
1619
1620         Add a new callback-based notification to CaptureDeviceManager which fires when the underlying list
1621         of devices changes. Add support for enumerating AVAudioSession capture devices.
1622
1623         * WebCore.xcodeproj/project.pbxproj:
1624         * platform/mediastream/CaptureDeviceManager.cpp:
1625         (nextObserverToken):
1626         (CaptureDeviceManager::addCaptureDeviceChangedObserver):
1627         (CaptureDeviceManager::removeCaptureDeviceChangedObserver):
1628         * platform/mediastream/CaptureDeviceManager.h:
1629         * platform/mediastream/ios/AVAudioSessionCaptureDevice.h: Added.
1630         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm: Added.
1631         (WebCore::AVAudioSessionCaptureDevice::create):
1632         (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
1633         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h: Added.
1634         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm: Added.
1635         (-[WebAVAudioSessionAvailableInputsListener initWithCallback:]):
1636         (-[WebAVAudioSessionAvailableInputsListener invalidate]):
1637         (-[WebAVAudioSessionAvailableInputsListener observeValueForKeyPath:ofObject:change:context:]):
1638         (WebCore::AVAudioSessionCaptureDeviceManager::singleton):
1639         (WebCore::AVAudioSessionCaptureDeviceManager::captureDevices):
1640         (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionCaptureDevices):
1641         (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionDeviceWithUID):
1642         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
1643         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1644         (WebCore::AVCaptureDeviceManager::deviceConnected):
1645         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
1646         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
1647         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
1648         (WebCore::CoreAudioCaptureDeviceManager::devicesChanged):
1649
1650 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
1651
1652         AX: AccessibilityTable::ariaRowCount() and ariaColumnCount() should not return -1 unless that is the author-provided value
1653         https://bugs.webkit.org/show_bug.cgi?id=171475
1654
1655         Reviewed by Chris Fleizach.
1656
1657         If the author has provided a valid value, return it. Otherwise, return 0.
1658
1659         No new tests needed. Update existing test expectations to reflect the change.
1660
1661         * accessibility/AccessibilityTable.cpp:
1662         (WebCore::AccessibilityTable::ariaColumnCount):
1663         (WebCore::AccessibilityTable::ariaRowCount):
1664
1665 2017-05-01  Joanmarie Diggs  <jdiggs@igalia.com>
1666
1667         AX: Implement support for ARIA "figure" and "term" roles; update AXRoleDescription mapping for "feed" role
1668         https://bugs.webkit.org/show_bug.cgi?id=171183
1669
1670         Reviewed by Chris Fleizach.
1671
1672         Create FeedRole, FigureRole, and TermRole and map them on the Mac and Gtk
1673         ports. Also rename AccessibilityObject::isFigure() to isFigureElement()
1674         for clarity as this method is specific to the HTML element and not the role.
1675
1676         No new tests needed: We have existing tests that cover mappings. Add new test cases
1677         to roles-exposed.html, xml-roles-exposed.html, and roles-computedRoleString.html.
1678
1679         * English.lproj/Localizable.strings:
1680         * accessibility/AccessibilityNodeObject.cpp:
1681         (WebCore::AccessibilityNodeObject::captionForFigure):
1682         (WebCore::AccessibilityNodeObject::alternativeText):
1683         * accessibility/AccessibilityObject.cpp:
1684         (WebCore::initializeRoleMap):
1685         (WebCore::AccessibilityObject::isFigureElement): Added.
1686         (WebCore::AccessibilityObject::isFigure): Deleted.
1687         * accessibility/AccessibilityObject.h:
1688         * accessibility/AccessibilityRenderObject.cpp:
1689         (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
1690         (WebCore::AccessibilityRenderObject::titleUIElement):
1691         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
1692         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1693         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1694         (atkRole):
1695         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1696         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1697         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1698         (createAccessibilityRoleMap):
1699         (-[WebAccessibilityObjectWrapper subrole]):
1700         (-[WebAccessibilityObjectWrapper roleDescription]):
1701         * platform/LocalizedStrings.cpp:
1702         (WebCore::AXFeedText):
1703         * platform/LocalizedStrings.h:
1704
1705 2017-04-30  Chris Dumez  <cdumez@apple.com>
1706
1707         Drop support for legacy ClientRect / ClientRectList
1708         https://bugs.webkit.org/show_bug.cgi?id=171418
1709
1710         Reviewed by Sam Weinig.
1711
1712         Drop support for legacy ClientRect / ClientRectList types now we use
1713         DOMRect everywhere.
1714
1715         * CMakeLists.txt:
1716         * DerivedSources.cpp:
1717         * DerivedSources.make:
1718         * WebCore.xcodeproj/project.pbxproj:
1719         * dom/ClientRect.cpp: Removed.
1720         * dom/ClientRect.h: Removed.
1721         * dom/ClientRect.idl: Removed.
1722         * dom/ClientRectList.cpp: Removed.
1723         * dom/ClientRectList.h: Removed.
1724         * dom/ClientRectList.idl: Removed.
1725         * dom/DOMAllInOne.cpp:
1726         * dom/Element.cpp:
1727         * html/HTMLMediaElement.cpp:
1728         * html/track/VTTRegion.cpp:
1729         * page/DragController.cpp:
1730
1731 2017-04-30  Zalan Bujtas  <zalan@apple.com>
1732
1733         Initialize a new layout state while bailing out of simple line layout only when needed.
1734         https://bugs.webkit.org/show_bug.cgi?id=171481
1735         <rdar://problem/31906382>
1736
1737         '-webkit-border-fit: lines' requires inline box tree.
1738         We normally bail out of simple line layout early when we see this property. 
1739         When this property is dynamically set and we already have a simple line layout context,
1740         RenderBlockFlow::ensureLineBoxes() takes care of the switch by calling layoutLineBoxes().
1741         This patch makes sure that we create the layout state for this (forced)line layout only when
1742         we don't yet have one.
1743
1744         Reviewed by Antti Koivisto.
1745
1746         Test: fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html
1747
1748         * rendering/RenderBlockFlow.cpp:
1749         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
1750         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
1751         (WebCore::RenderBlockFlow::ensureLineBoxes):
1752         * rendering/RenderView.cpp:
1753         (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded):
1754         (WebCore::RenderView::pushLayoutStateForPagination): Deleted.
1755         * rendering/RenderView.h:
1756
1757 2017-04-30  Dan Bernstein  <mitz@apple.com>
1758
1759         Tried to fix the iOS build after r215992
1760
1761         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1762
1763 2017-04-30  Brady Eidson  <beidson@apple.com>
1764
1765         Fix r215991
1766         https://bugs.webkit.org/show_bug.cgi?id=171483
1767
1768         Unreviewed.
1769
1770         * platform/spi/cf/CFNetworkSPI.h:
1771
1772 2017-04-30  Dan Bernstein  <mitz@apple.com>
1773
1774         Tried to fix the iOS build after r215992
1775
1776         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1777         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
1778         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
1779
1780 2017-04-30  Dan Bernstein  <mitz@apple.com>
1781
1782         [Cocoa] Replaces uses of [get…() alloc] with alloc…Instance()
1783         https://bugs.webkit.org/show_bug.cgi?id=171485
1784
1785         Reviewed by Geoffrey Garen.
1786
1787         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
1788         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
1789         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1790         (WebCore::MediaPlaybackTargetPickerMac::devicePicker):
1791         * platform/ios/ValidationBubbleIOS.mm:
1792         (-[WebValidationBubbleTapRecognizer initWithPopoverController:]):
1793         (WebCore::ValidationBubble::ValidationBubble):
1794         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1795         (WebVideoFullscreenControllerContext::setUpFullscreen):
1796         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1797         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
1798         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
1799         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
1800         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
1801         * platform/network/ios/PreviewConverter.mm:
1802         (WebCore::PreviewConverter::PreviewConverter):
1803         * rendering/RenderThemeIOS.mm:
1804         (WebCore::iconForAttachment):
1805
1806 2017-04-30  Brady Eidson  <beidson@apple.com>
1807
1808         Updates to _WKWebsiteDataStoreConfiguration cookie storage location SPI.
1809         <rdar://problem/31906397> and https://bugs.webkit.org/show_bug.cgi?id=171483
1810
1811         Reviewed by Geoff Garen (and kind of Andy Estes).
1812
1813         No new tests (Covered by API test).
1814
1815         * platform/spi/cf/CFNetworkSPI.h:
1816
1817 2017-04-30  Dan Bernstein  <mitz@apple.com>
1818
1819         <rdar://problem/31906525> WebCore-7604.1.19 has failed to build
1820
1821         * platform/ios/WebItemProviderPasteboard.mm:
1822         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Resolved type ambiguity
1823           by using allocUIItemProviderInstance() instead of [getUIItemProviderClass() alloc].
1824
1825 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
1826
1827         [ATK] Implement support for aria-autocomplete
1828         https://bugs.webkit.org/show_bug.cgi?id=171167
1829
1830         Reviewed by Chris Fleizach.
1831
1832         Expose ATK_STATE_SUPPORTS_AUTOCOMPLETION in the state set, and the value
1833         of aria-autocomplete as an object attribute, for elements which indicate
1834         they support autocompletion.
1835
1836         Test: accessibility/gtk/aria-autocomplete.html
1837
1838         * accessibility/AccessibilityObject.cpp:
1839         (WebCore::AccessibilityObject::supportsARIAAutoComplete):
1840         (WebCore::AccessibilityObject::ariaAutoCompleteValue):
1841         * accessibility/AccessibilityObject.h:
1842         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1843         (webkitAccessibleGetAttributes):
1844         (setAtkStateSetFromCoreObject):
1845         * html/HTMLAttributeNames.in:
1846
1847 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
1848
1849         [ATK] ARIA treegrid role should be exposed as ATK_ROLE_TREE_TABLE; not ATK_ROLE_TABLE
1850         https://bugs.webkit.org/show_bug.cgi?id=171170
1851
1852         Reviewed by Chris Fleizach.
1853
1854         AccessibilityTable::roleValue() was returning GridRole for both grid and treegrid.
1855         Change this so that GridRole is returned for grid and TreeGridRole is returned for
1856         treegrid. Add TreeGridRole to, or call isTable() in, methods where the behavior
1857         should be the same as GridRole.
1858
1859         Test: accessibility/gtk/interface-table.html
1860
1861         * accessibility/AccessibilityRenderObject.cpp:
1862         (WebCore::AccessibilityRenderObject::selectedChildren):
1863         * accessibility/AccessibilityTable.cpp:
1864         (WebCore::AccessibilityTable::roleValue):
1865         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1866         (atkRole):
1867         (getInterfaceMaskFromObject):
1868         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1869         (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]):
1870         (-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
1871         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1872         (createAccessibilityRoleMap):
1873
1874 2017-04-30  Joanmarie Diggs  <jdiggs@igalia.com>
1875
1876         [ATK] Emit object:state-changed:busy event when aria-busy value changes
1877         https://bugs.webkit.org/show_bug.cgi?id=171181
1878
1879         Reviewed by Chris Fleizach.
1880
1881         Emit object:state-changed:busy for AXElementBusyChanged notifications.
1882
1883         Test: accessibility/gtk/aria-busy-changed-notification.html
1884
1885         * accessibility/atk/AXObjectCacheAtk.cpp:
1886         (WebCore::AXObjectCache::postPlatformNotification):
1887
1888 2017-04-29  Joseph Pecoraro  <pecoraro@apple.com>
1889
1890         Zero out PerformanceResourceTiming properties for cached cross-origin responses without Timing-Allow-Origin
1891         https://bugs.webkit.org/show_bug.cgi?id=171394
1892
1893         Reviewed by Youenn Fablet.
1894
1895         * loader/ResourceTiming.cpp:
1896         (WebCore::ResourceTiming::fromCache):
1897         (WebCore::ResourceTiming::ResourceTiming):
1898         * loader/ResourceTiming.h:
1899         * loader/cache/CachedResourceLoader.cpp:
1900         (WebCore::CachedResourceLoader::requestResource):
1901         Include the timing-allow-origin check for cached responses.
1902         Also, avoid including an extra entry for an ongoing cached resource
1903         load, since when that load completes it should be reported.
1904
1905 2017-04-29  Youenn Fablet  <youenn@apple.com>
1906
1907         Readd assertion removed accidentally in r215955
1908         https://bugs.webkit.org/show_bug.cgi?id=171466
1909
1910         Reviewed by Eric Carlson.
1911
1912         Unreviewed.
1913
1914         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1915         (WebCore::MockRealtimeVideoSourceMac::orientationChanged): Improved FIXME after review.
1916
1917 2017-04-29  Andy Estes  <aestes@apple.com>
1918
1919         [macOS] Picture-in-picture should be disabled in WebPlaybackControlsManager during external media playback
1920         https://bugs.webkit.org/show_bug.cgi?id=171468
1921         <rdar://problem/31900349>
1922
1923         Reviewed by Eric Carlson.
1924
1925         * platform/mac/WebPlaybackControlsManager.h: Declared canTogglePictureInPicture as a
1926         readwrite property.
1927         * platform/mac/WebPlaybackControlsManager.mm: Synthesize canTogglePictureInPicture.
1928         (-[WebPlaybackControlsManager canTogglePictureInPicture]): Deleted.
1929         * platform/mac/WebPlaybackSessionInterfaceMac.h:
1930         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1931         (WebCore::WebPlaybackSessionInterfaceMac::externalPlaybackChanged): Called
1932         -[WebPlaybackControlsManager setCanTogglePictureInPicture:].
1933
1934 2017-04-29  Simon Fraser  <simon.fraser@apple.com>
1935
1936         Fix tests broken by r215964.
1937
1938         Fix copy-paste error that caused the wrong paint phase to get passed to the fire writeLayerRenderers()
1939         call, causing extra renderer dumping.
1940
1941         Also remove unused default arguments.
1942
1943         * rendering/RenderTreeAsText.cpp:
1944         (WebCore::writeLayerRenderers):
1945         (WebCore::writeLayers):
1946
1947 2017-04-28  Zalan Bujtas  <zalan@apple.com>
1948
1949         iBooks text can overlap, sometimes columns are shifted splitting words.
1950         https://bugs.webkit.org/show_bug.cgi?id=171472
1951         <rdar://problem/31096037>
1952
1953         Reviewed by Antti Koivisto.
1954
1955         Instead of just checking if the glyph is taller than the line, we need to ensure that both the
1956         ascent and the descent have enough space (this is for -webkit-line-box-contain: glyph).
1957
1958         Test: fast/text/simple-line-layout-glyph-overflows-line.html
1959
1960         * rendering/SimpleLineLayout.cpp:
1961         (WebCore::SimpleLineLayout::canUseForText): compute the available space for the ascent/descent
1962         and check them against the ceil-ed(see FontCascade::floatWidthForSimpleText) glyph min/max y.
1963
1964 2017-04-29  Nan Wang  <n_wang@apple.com>
1965
1966         AX: Improve performance of addChildren()/childrenChanged()
1967         https://bugs.webkit.org/show_bug.cgi?id=171443
1968
1969         Reviewed by Chris Fleizach.
1970
1971         There's a lot of unnecessary work happening when childrenChanged() is being called.
1972         Some of the improvements here:
1973         1. When childrenChanged() is being called on some element, we are marking its parent
1974            chain dirty. However, in the addChild() method we are then clearing each child of
1975            that 'dirty' parent, eventually making the entire tree dirty. 
1976            Added a m_subTreeDirty flag and using the needsToUpdateChildren() check to make sure
1977            we are only clearing the right chain without updating the unchanged siblings.
1978         2. In the addChild() method we are calling accessibilityIsIgnored() on each child and that 
1979            might lead to going up the parent chain again to get necessary information. 
1980            Since we are already traversing the tree from top to bottom to add children, added a 
1981            struct to store the information and pass it to the child so to avoid unnecessary traversal.
1982         3. Reduced the amount work of ARIA text controls perform when updating its parents in childrenChanged() 
1983            so that we don't update a big portion of the tree while typing.
1984
1985         No new tests since this didn't change any functionality. 
1986
1987         * accessibility/AccessibilityNodeObject.cpp:
1988         (WebCore::AccessibilityNodeObject::AccessibilityNodeObject):
1989         (WebCore::AccessibilityNodeObject::childrenChanged):
1990         (WebCore::AccessibilityNodeObject::insertChild):
1991         (WebCore::AccessibilityNodeObject::addChildren):
1992         (WebCore::AccessibilityNodeObject::isDescendantOfBarrenParent):
1993         * accessibility/AccessibilityNodeObject.h:
1994         * accessibility/AccessibilityObject.cpp:
1995         (WebCore::AccessibilityObject::AccessibilityObject):
1996         (WebCore::AccessibilityObject::defaultObjectInclusion):
1997         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
1998         * accessibility/AccessibilityObject.h:
1999         (WebCore::AccessibilityIsIgnoredFromParentData::AccessibilityIsIgnoredFromParentData):
2000         (WebCore::AccessibilityIsIgnoredFromParentData::isNull):
2001         (WebCore::AccessibilityObject::setNeedsToUpdateSubTree):
2002         (WebCore::AccessibilityObject::needsToUpdateChildren):
2003         (WebCore::AccessibilityObject::setIsIgnoredFromParentData):
2004         * accessibility/AccessibilityRenderObject.cpp:
2005         (WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
2006         (WebCore::AccessibilityRenderObject::addChildren):
2007         * accessibility/AccessibilityRenderObject.h:
2008         (WebCore::AccessibilityRenderObject::setRenderObject):
2009         (WebCore::AccessibilityRenderObject::needsToUpdateChildren): Deleted.
2010
2011 2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
2012
2013         Move WebCore CPUTime to WTF and implement it in all the platforms
2014         https://bugs.webkit.org/show_bug.cgi?id=171477
2015
2016         Reviewed by Chris Dumez.
2017
2018         Move CPUTime to WTF. And rename getCPUTime to CPUTime::get().
2019
2020         * CMakeLists.txt:
2021         * PlatformMac.cmake:
2022         * WebCore.xcodeproj/project.pbxproj:
2023         * page/ChromeClient.h:
2024         * page/PerformanceMonitor.cpp:
2025         (WebCore::PerformanceMonitor::PerformanceMonitor):
2026         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
2027         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
2028         (WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
2029         * page/PerformanceMonitor.h:
2030         * platform/CPUMonitor.cpp:
2031         (WebCore::CPUMonitor::setCPULimit):
2032         (WebCore::CPUMonitor::timerFired):
2033         * platform/CPUMonitor.h:
2034
2035 2017-04-28  Per Arne Vollan  <pvollan@apple.com>
2036
2037         Crash under WebCore::AccessibilityRenderObject::handleAriaExpandedChanged().
2038         https://bugs.webkit.org/show_bug.cgi?id=171427
2039         rdar://problem/31863417
2040
2041         Reviewed by Brent Fulgham.
2042
2043         The AccessibilityRenderObject object might delete itself in handleAriaExpandedChanged() under the call
2044         to the parentObject() method. This will cause a crash when accessing the object later in this method.
2045         Protect the current object while executing arbitrary event code.
2046
2047         Test: accessibility/accessibility-crash-setattribute.html
2048
2049         * accessibility/AccessibilityRenderObject.cpp:
2050         (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
2051
2052 2017-04-28  Chris Dumez  <cdumez@apple.com>
2053
2054         Diagnostic logging of navigations is too verbose
2055         https://bugs.webkit.org/show_bug.cgi?id=171455
2056         <rdar://problem/31543815>
2057
2058         Reviewed by Andreas Kling.
2059
2060         Diagnostic logging of navigation is too verbose. We log things that are not actually user
2061         navigations (e.g. speculative loads, bookmark icon fetches, ...). To address the issue,
2062         we now only log *observable* loads. We do so by only logging if the page is visible or
2063         if it becomes visible.
2064
2065         * loader/FrameLoader.cpp:
2066         (WebCore::FrameLoader::loadWithDocumentLoader):
2067         (WebCore::logNavigation): Deleted.
2068         * page/Page.cpp:
2069         (WebCore::Page::setIsVisibleInternal):
2070         (WebCore::Page::logNavigation):
2071         (WebCore::Page::mainFrameLoadStarted):
2072         * page/Page.h:
2073
2074 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
2075
2076         AX: ARIA "region" role which lacks an accessible name should not be treated as a landmark
2077         https://bugs.webkit.org/show_bug.cgi?id=171180
2078
2079         Reviewed by Chris Fleizach.
2080
2081         Remove mapping of LandmarkRegionRole for regions which lack an accessible name.
2082         Doing so had a side effect of causing a number of DPub ARIA roles to stop being
2083         mapped as ARIA landmarks. This is due to our internal role mappings, namely
2084         treating the DPub ARIA landmark roles as if they were regions. Because DPub's
2085         landmarks do not subclass region, and do not have the same name-from-author
2086         requirement as region, create a new LandmarkDocRegionRole AccessibilityRole and
2087         map DPub ARIA's generic landmarks to it.
2088
2089         No new tests because we already have sufficient coverage. Several existing
2090         tests were given additional test cases to cover named and unnamed regions,
2091         and test expectations updated accordingly.
2092
2093         * accessibility/AccessibilityNodeObject.cpp:
2094         (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute):
2095         * accessibility/AccessibilityObject.cpp:
2096         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
2097         (WebCore::AccessibilityObject::isLandmark):
2098         (WebCore::initializeRoleMap):
2099         (WebCore::AccessibilityObject::computedRoleString):
2100         * accessibility/AccessibilityObject.h:
2101         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2102         (atkRole):
2103         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2104         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
2105         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
2106         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2107         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
2108         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2109         (createAccessibilityRoleMap):
2110         (-[WebAccessibilityObjectWrapper subrole]):
2111
2112 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
2113
2114         Enhance showLayerTree() to show fragments
2115         https://bugs.webkit.org/show_bug.cgi?id=171469
2116
2117         Reviewed by Zalan Bujtas.
2118
2119         Have showLayerTree() dump fragments, like:
2120
2121              normal flow list(1)
2122               layer 0x11c1879c0 at (0,0) size 700x1858 backgroundClip at (0,0) size 2120x779 clip at (0,0) size 2120x779
2123                    fragment 0: bounds in layer at (0,0) size 700x1858 fragment bounds at (0,0) size 700x779
2124                    fragment 1: bounds in layer at (710,-779) size 700x1858 fragment bounds at (710,0) size 700x779
2125                    fragment 2: bounds in layer at (1420,-1558) size 700x1858 fragment bounds at (1420,0) size 700x300
2126                 RenderMultiColumnFlowThread 0x11f1f3340 at (0,0) size 700x1858
2127
2128         We want these to show before the child renderers, so factor that code into writeLayerRenderers().
2129         
2130         Overloading of write() for layers doesn't help anyone, so call it writeLayer() for searchability.
2131
2132         * rendering/RenderLayer.cpp:
2133         (WebCore::showLayerTree):
2134         * rendering/RenderLayer.h:
2135         * rendering/RenderTreeAsText.cpp:
2136         (WebCore::writeLayer):
2137         (WebCore::writeLayerRenderers):
2138         (WebCore::writeLayers):
2139         * rendering/RenderTreeAsText.h:
2140
2141 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
2142
2143         Modernize RenderTreeAsText code
2144         https://bugs.webkit.org/show_bug.cgi?id=171458
2145
2146         Reviewed by Zalan Bujtas.
2147
2148         Use modern loops. More references to render objects and layers.
2149
2150         * rendering/RenderTreeAsText.cpp:
2151         (WebCore::write):
2152         (WebCore::writeRenderNamedFlowThreads):
2153         (WebCore::writeLayers):
2154         (WebCore::writeSelection):
2155         (WebCore::externalRepresentation):
2156
2157 2017-04-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2158
2159         Fix and re-enable data interaction unit tests
2160         https://bugs.webkit.org/show_bug.cgi?id=171446
2161         <rdar://problem/31820646>
2162
2163         Reviewed by Tim Horton.
2164
2165         Three small tweaks to get all data interaction tests passing again (changes detailed below).
2166         Fixes a failing unit test: DataInteractionTests.RespectsExternalSourceFidelityRankings.
2167
2168         * page/mac/DragControllerMac.mm:
2169
2170         When dropping in a plain text editable area, don't consider kUTTypeText to be a UTI supported by the destination.
2171         This is because doing so would cause rich text UTIs, such as kUTTypeHTML, to match, so that the plain text area
2172         would report HTML as a preferred UTI type to load when dropping rich content over it. What we want to check for
2173         conformance here is really kUTTypePlainText.
2174
2175         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
2176         * platform/Pasteboard.h:
2177         * platform/ios/PasteboardIOS.mm:
2178
2179         The default Pasteboard constructor no longer makes a sync call to the UI process to get the change count.
2180         Instead, we introduce a new constructor that takes and sets the change count. This default constructor was used
2181         from three places: Pasteboard::createForCopyAndPaste, Pasteboard::createPrivate and StaticPasteboard::create.
2182
2183         The first two call sites have been refactored to first fetch the change count from the UI process and then pass
2184         it in to the constructor.
2185
2186         (WebCore::changeCountForPasteboard):
2187         (WebCore::Pasteboard::Pasteboard):
2188         (WebCore::Pasteboard::createForCopyAndPaste):
2189         (WebCore::Pasteboard::createPrivate):
2190         (WebCore::Pasteboard::readString):
2191         (WebCore::Pasteboard::types):
2192         * platform/mac/DragDataMac.mm:
2193         (WebCore::typeIsAppropriateForSupportedTypes):
2194         (WebCore::DragData::updatePreferredTypeIdentifiers):
2195
2196         Remove the two-pass heuristic. Instead, we should follow this policy: "select the highest fidelity UTI that
2197         conforms to one of the destination's supported types".
2198
2199         * platform/mac/PasteboardMac.mm:
2200         (WebCore::Pasteboard::Pasteboard):
2201
2202 2017-04-28  Dean Jackson  <dino@apple.com>
2203
2204         App crashing: Dispatch queue: com.apple.root.user-interactive-qos / vBoxConvolve / WebCore::FEGaussianBlur::platformApplySoftware()
2205         https://bugs.webkit.org/show_bug.cgi?id=171461
2206         <rdar://problem/30534722>
2207
2208         Reviewed by Eric Carlson.
2209
2210         We're getting reports of crashes in this function, caused by null or empty data being
2211         passed to vImage. Guard against this, in a way that will ASSERT in debug builds if
2212         anyone comes across it.
2213
2214         Test: css3/filters/blur-various-radii.html
2215
2216         * platform/graphics/filters/FEGaussianBlur.cpp:
2217         (WebCore::accelerateBoxBlur): Return early if things don't look good.
2218
2219 2017-04-28  Chris Dumez  <cdumez@apple.com>
2220
2221         Stop using legacy ClientRect / ClientRectList in Internals
2222         https://bugs.webkit.org/show_bug.cgi?id=171412
2223
2224         Reviewed by Simon Fraser.
2225
2226         Stop using legacy ClientRect / ClientRectList in Internals amd use the
2227         newer DOMRect instead.
2228
2229         * dom/DOMRect.idl:
2230         * page/Page.cpp:
2231         (WebCore::Page::nonFastScrollableRects):
2232         (WebCore::Page::touchEventRectsForEvent):
2233         (WebCore::Page::passiveTouchEventListenerRects):
2234         * page/Page.h:
2235         * testing/Internals.cpp:
2236         (WebCore::Internals::absoluteCaretBounds):
2237         (WebCore::Internals::boundingBox):
2238         (WebCore::Internals::inspectorHighlightRects):
2239         (WebCore::Internals::layoutViewportRect):
2240         (WebCore::Internals::visualViewportRect):
2241         (WebCore::Internals::touchEventRectsForEvent):
2242         (WebCore::Internals::passiveTouchEventListenerRects):
2243         (WebCore::Internals::nonFastScrollableRects):
2244         (WebCore::Internals::selectionBounds):
2245         * testing/Internals.h:
2246         * testing/Internals.idl:
2247
2248 2017-04-28  Youenn Fablet  <youenn@apple.com>
2249
2250         getUserMedia video streams should follow device orientation
2251         https://bugs.webkit.org/show_bug.cgi?id=171284
2252
2253         Reviewed by Eric Carlson.
2254
2255         Only really affects AVVideoCaptureSource on iOS. Manually testing the following cases:
2256         - Mac: no change of behavior
2257         - iOS: page loaded in portrait, video is portrait. page loaded in landscape, video is landscape
2258         - iOS: changing the device orientation makes the video samples to be moved to landscape/portrait.
2259         - Same tests as above with peer connection.
2260
2261         Making Document having an OrientationNotifier that AVVideoCaptureSources get registered to.
2262         Making AVVideoCaptureSource an OrientationNotifier::Observer so that it can changes width/height if needed.
2263
2264         Refactoring to specialize CaptureFactory in VideoCaptureFactory and AudioCaptureFactory.
2265         Refactoring to return a CaptureSourceOrError instead of passing an out parameter plus returning a RefPtr.
2266
2267         * Modules/mediastream/UserMediaRequest.cpp:
2268         (WebCore::UserMediaRequest::allow):
2269         * WebCore.xcodeproj/project.pbxproj:
2270         * dom/Document.cpp:
2271         (WebCore::Document::orientationChanged):
2272         * dom/Document.h:
2273         * page/Frame.cpp:
2274         (WebCore::Frame::orientationChanged):
2275         * platform/OrientationNotifer.h: Copied from Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h.
2276         (WebCore::OrientationNotifier::Observer::setNotifier):
2277         (WebCore::OrientationNotifier::Observer::~Observer):
2278         (WebCore::OrientationNotifier::orientationChanged):
2279         (WebCore::OrientationNotifier::addObserver):
2280         (WebCore::OrientationNotifier::removeObserver):
2281         * platform/mediastream/MediaStreamPrivate.cpp:
2282         (WebCore::MediaStreamPrivate::monitorOrientation):
2283         * platform/mediastream/MediaStreamPrivate.h:
2284         * platform/mediastream/RealtimeMediaSource.h:
2285         (WebCore::CaptureSourceOrError::CaptureSourceOrError):
2286         (WebCore::CaptureSourceOrError::operator bool):
2287         (WebCore::CaptureSourceOrError::source):
2288         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2289         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2290         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2291         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
2292         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
2293         * platform/mediastream/RealtimeMediaSourceCenter.h:
2294         (WebCore::RealtimeMediaSourceCenter::defaultAudioFactory):
2295         (WebCore::RealtimeMediaSourceCenter::defaultVideoFactory):
2296         (WebCore::RealtimeMediaSourceCenter::audioFactory):
2297         (WebCore::RealtimeMediaSourceCenter::videoFactory):
2298         * platform/mediastream/mac/AVAudioCaptureSource.h:
2299         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2300         (WebCore::AVAudioCaptureSource::create):
2301         (WebCore::AVAudioCaptureSource::factory):
2302         * platform/mediastream/mac/AVVideoCaptureSource.h:
2303         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2304         (WebCore::AVVideoCaptureSource::create):
2305         (WebCore::AVVideoCaptureSource::factory):
2306         (WebCore::AVVideoCaptureSource::monitorOrientation):
2307         (WebCore::AVVideoCaptureSource::orientationChanged):
2308         (WebCore::AVVideoCaptureSource::processNewFrame):
2309         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2310         (WebCore::CoreAudioCaptureSource::create):
2311         (WebCore::CoreAudioCaptureSource::factory):
2312         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2313         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2314         (WebCore::MockRealtimeAudioSource::create):
2315         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
2316         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2317         (WebCore::MockRealtimeVideoSource::create):
2318         (WebCore::MockRealtimeVideoSourceMac::orientationChanged):
2319         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2320         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
2321         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
2322         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
2323         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
2324         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2325         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2326         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
2327         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
2328         * platform/mock/MockRealtimeAudioSource.cpp:
2329         (WebCore::MockRealtimeAudioSource::create):
2330         (WebCore::MockRealtimeAudioSource::factory):
2331         * platform/mock/MockRealtimeAudioSource.h:
2332         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2333         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
2334         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
2335         (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
2336         (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
2337         * platform/mock/MockRealtimeMediaSourceCenter.h:
2338         * platform/mock/MockRealtimeVideoSource.cpp:
2339         (WebCore::MockRealtimeVideoSource::create):
2340         (WebCore::MockRealtimeVideoSource::factory):
2341         * platform/mock/MockRealtimeVideoSource.h:
2342
2343 2017-04-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
2344
2345         Unify how BitmapImage handles the availability of a decoded for large and animated images
2346         https://bugs.webkit.org/show_bug.cgi?id=171410
2347
2348         Reviewed by Simon Fraser.
2349
2350         Rename some functions which are related to animation frame availability.
2351         Make BitmapImage call ImageObserver::imageFrameAvailable() whenever a 
2352         frame is available regardless it is for an animated or for a large image.
2353
2354         * html/HTMLMediaElement.cpp:
2355         (WebCore::HTMLMediaElement::isVisibleInViewport):
2356         * html/MediaElementSession.cpp:
2357         (WebCore::MediaElementSession::autoplayPermitted):
2358         (WebCore::isMainContentForPurposesOfAutoplay):
2359         * loader/cache/CachedImage.cpp:
2360         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
2361         (WebCore::CachedImage::imageFrameAvailable):
2362         (WebCore::CachedImage::usesImageContainerSize): Deleted.
2363         (WebCore::CachedImage::imageHasRelativeWidth): Deleted.
2364         (WebCore::CachedImage::imageHasRelativeHeight): Deleted.
2365         (WebCore::CachedImage::CachedImageObserver::animationAdvanced): Deleted.
2366         (WebCore::CachedImage::animationAdvanced): Deleted.
2367         * loader/cache/CachedImage.h:
2368         * loader/cache/CachedImageClient.h:
2369         (WebCore::CachedImageClient::imageFrameAvailable):
2370         (WebCore::CachedImageClient::newImageAnimationFrameAvailable): Deleted.
2371         * platform/graphics/BitmapImage.cpp:
2372         (WebCore::BitmapImage::internalAdvanceAnimation):
2373         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
2374         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Deleted.
2375         * platform/graphics/BitmapImage.h:
2376         * platform/graphics/Image.h:
2377         (WebCore::Image::imageFrameAvailableAtIndex):
2378         (WebCore::Image::newFrameNativeImageAvailableAtIndex): Deleted.
2379         * platform/graphics/ImageFrameCache.cpp:
2380         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex):
2381         * platform/graphics/ImageObserver.h:
2382         * platform/graphics/ImageTypes.h:
2383         * rendering/RenderElement.cpp:
2384         (WebCore::RenderElement::RenderElement):
2385         (WebCore::RenderElement::shouldRepaintInVisibleRect):
2386         (WebCore::RenderElement::imageFrameAvailable):
2387         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
2388         (WebCore::shouldRepaintForImageAnimation): Deleted.
2389         (WebCore::RenderElement::newImageAnimationFrameAvailable): Deleted.
2390         * rendering/RenderElement.h:
2391         * rendering/RenderView.cpp:
2392         (WebCore::RenderView::updateVisibleViewportRect):
2393         * svg/graphics/SVGImageClients.h:
2394
2395 2017-04-28  Jeremy Jones  <jeremyj@apple.com>
2396
2397         ARGUMENT BAD: time, time >= 0
2398         https://bugs.webkit.org/show_bug.cgi?id=164336
2399         rdar://problem/29314891
2400
2401         Reviewed by Eric Carlson.
2402
2403         Handle invalid duration and current time when calculating remaining time.
2404
2405         Test media/modern-media-controls/pip-support/pip-support-click.html now works without a workaround
2406         in media/modern-media-controls/pip-support/pip-support-enabled.html
2407
2408         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
2409         (-[WebVideoFullscreenHUDWindowController remainingTimeText]):
2410
2411 2017-04-28  Daniel Bates  <dabates@apple.com>
2412
2413         Add WebCore::protocolIsJavaScript(StringView)
2414         https://bugs.webkit.org/show_bug.cgi?id=171396
2415
2416         Reviewed by Alex Christensen.
2417
2418         Add an overload of WebCore::protocolIsJavaScript() that takes a StringView to
2419         avoid the need for a caller to allocate a new String object when converting
2420         from a StringView to a String. We are not using this functionality at the moment,
2421         but we will in the patch for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
2422
2423         No functionality has changed. So, no new tests.
2424
2425         * platform/URL.cpp: Remove an outdated comment about protocolIs(StringView, const char*).
2426         This overload was removed in r212508.
2427         (WebCore::protocolIsInternal): Added.
2428         (WebCore::protocolIs): Implemented in terms of WebCore::protocolIsInternal().
2429         (WebCore::URL::protocolIs): Ditto.
2430         (WebCore::protocolIsJavaScript): Added; overload that takes a StringView.
2431         (WebCore::mimeTypeFromDataURL): Modified to use WebCore::protocolIsInternal().
2432         * platform/URL.h:
2433
2434 2017-04-28  Andy Estes  <aestes@apple.com>
2435
2436         [macOS] WebPlaybackControlsManager needs to know when the selected text or audio track changes
2437         https://bugs.webkit.org/show_bug.cgi?id=171434
2438         <rdar://problem/31887922>
2439
2440         Reviewed by Eric Carlson.
2441
2442         * dom/GenericEventQueue.cpp:
2443         (WebCore::GenericEventQueue::hasPendingEventsOfType): Added to check if a pending event
2444         exists of a certain type.
2445         * dom/GenericEventQueue.h:
2446         * html/HTMLMediaElement.cpp:
2447         (WebCore::HTMLMediaElement::setSelectedTextTrack): Even if no track modes change, fire a
2448         change event when the track to select is off or automatic so that
2449         WebPlaybackSessionModelMediaElement detects the change.
2450         * html/track/TrackListBase.cpp:
2451         (TrackListBase::isChangeEventScheduled): Returns true if m_asyncEventQueue has a pending
2452         change event.
2453         * html/track/TrackListBase.h:
2454         * platform/cocoa/WebPlaybackSessionModel.h:
2455         (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionIndexChanged):
2456         (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionIndexChanged):
2457         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
2458         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2459         (WebCore::WebPlaybackSessionModelMediaElement::setMediaElement): Registered/unregistered for
2460         the change event on the audio and text tracks.
2461         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName): Called
2462         updateMediaSelectionIndices() when the change event fires.
2463         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionOptions): Renamed from
2464         updateLegibleOptions().
2465         (WebCore::WebPlaybackSessionModelMediaElement::updateMediaSelectionIndices): Called
2466         audioMediaSelectionIndexChanged() and legibleMediaSelectionIndexChanged() on m_clients with
2467         the updated indices.
2468         (WebCore::WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex): Fixed a bug
2469         where selectedIndex would never be set to offIndex if offIndex is 0 (which it usually is).
2470         (WebCore::WebPlaybackSessionModelMediaElement::updateLegibleOptions): Renamed to
2471         updateMediaSelectionOptions().
2472         * platform/mac/WebPlaybackControlsManager.h:
2473         * platform/mac/WebPlaybackControlsManager.mm:
2474         (-[WebPlaybackControlsManager setAudioMediaSelectionIndex:]): Set
2475         _currentAudioTouchBarMediaSelectionOption to the object at selectedIndex and manually
2476         triggered a KVO notification. We can't call -setCurrentAudioTouchBarMediaSelectionOption:
2477         here since that will send a message back to the Web process.
2478         (-[WebPlaybackControlsManager setLegibleMediaSelectionIndex:]): Ditto for
2479         _currentLegibleTouchBarMediaSelectionOption.
2480         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2481         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2482         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionIndexChanged): Called
2483         -[WebPlaybackControlsManager setAudioMediaSelectionIndex:].
2484         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionIndexChanged): Called
2485         -[WebPlaybackControlsManager setLegibleMediaSelectionIndex:].
2486
2487 2017-04-28  Chris Dumez  <cdumez@apple.com>
2488
2489         Range.getClientRects() / getBoundingClientRect() should return DOMRect types
2490         https://bugs.webkit.org/show_bug.cgi?id=171393
2491
2492         Reviewed by Simon Fraser.
2493
2494         Range.getClientRects() / getBoundingClientRect() should return DOMRect types:
2495         - https://drafts.csswg.org/cssom-view/#extensions-to-the-range-interface
2496
2497         Test: fast/dom/Range/getBoundingClientRect-getClientRects-return-type.html
2498
2499         * CMakeLists.txt:
2500         * WebCore.xcodeproj/project.pbxproj:
2501         * dom/DOMRect.cpp: Copied from Source/WebCore/dom/DOMRect.h.
2502         (WebCore::createDOMRectVector):
2503         * dom/DOMRect.h:
2504         * dom/Element.cpp:
2505         (WebCore::Element::getClientRects):
2506         * dom/Range.cpp:
2507         (WebCore::Range::getClientRects):
2508         (WebCore::Range::getBoundingClientRect):
2509         * dom/Range.h:
2510         * dom/Range.idl:
2511
2512 2017-04-28  Chris Dumez  <cdumez@apple.com>
2513
2514         Tweak window.open features argument tokenizer to match HTML standard and Edge
2515         https://bugs.webkit.org/show_bug.cgi?id=170548
2516
2517         Reviewed by Geoffrey Garen.
2518
2519         Update window.open() features argument tokenizer to match HTML standard:
2520         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
2521
2522         Also update window.open() to return null instead of the window when
2523         the 'noopener' feature is activated, as per:
2524         - https://html.spec.whatwg.org/#dom-open (Step 10)
2525
2526         No new tests, rebaselined existing test.
2527
2528         * page/DOMWindow.cpp:
2529         (WebCore::DOMWindow::createWindow):
2530         Update window.open() to return null instead of the window when
2531         the 'noopener' feature is activated, as per:
2532         - https://html.spec.whatwg.org/#dom-open (Step 10)
2533
2534         * page/WindowFeatures.cpp:
2535         (WebCore::isSeparator):
2536         Treat all ASCII spaces as feature separators, as per:
2537         - https://html.spec.whatwg.org/#feature-separator
2538         This has the effect of adding U+000C (FormFeed) as a separator.
2539
2540         (WebCore::processFeaturesString):
2541         Align tokenizing code with the specification:
2542         - https://html.spec.whatwg.org/#concept-window-open-features-tokenize
2543         In particular, the following changes were made:
2544         - After the key, skip to first '=', but don't skip past a ',' or a non-separator.
2545           The "or a non-separator" part is new in the spec (step 3.6.1) and is now implemented.
2546         - After looking for the '=', only treat what follows as a value if the current character
2547           is a separator. This is as per step 7 in the spec.
2548         These changes now cause us to parse 'foo noopener=1' as ('foo', ''), ('noopener', '1').
2549
2550 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
2551
2552         Implement ondevicechange
2553         https://bugs.webkit.org/show_bug.cgi?id=169872
2554
2555         Unreviewed, remove some dead code accidentally committed in r215929.
2556
2557         * platform/mediastream/CaptureDeviceManager.cpp:
2558
2559 2017-04-28  Chris Dumez  <cdumez@apple.com>
2560
2561         Update DOMTokenList.replace() to match the latest DOM specification
2562         https://bugs.webkit.org/show_bug.cgi?id=171388
2563
2564         Reviewed by Alex Christensen.
2565
2566         Update DOMTokenList.replace() to match the latest DOM specification after:
2567         - https://github.com/whatwg/dom/issues/442
2568         - https://github.com/whatwg/infra/pull/126
2569
2570         The latest spec text is at:
2571         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
2572         - https://infra.spec.whatwg.org/#set-replace
2573
2574         The behavior change in this patch causes (a, b, c).replace(a, c) to return
2575         (c, b) instead of (b, c). This new behavior is aligned with Firefox as well.
2576
2577         No new tests, updated existing test.
2578
2579         * html/DOMTokenList.cpp:
2580         (WebCore::DOMTokenList::replace):
2581
2582 2017-04-28  Brady Eidson  <beidson@apple.com>
2583
2584         Start of support for multiple WebsiteDataStore/SessionIDs per process
2585         https://bugs.webkit.org/show_bug.cgi?id=171422
2586
2587         Reviewed by Geoffrey Garen.
2588
2589         Covered by API tests.
2590
2591         * platform/network/NetworkStorageSession.h:
2592         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2593         (WebCore::NetworkStorageSession::ensureSession):
2594         * platform/spi/cf/CFNetworkSPI.h:
2595
2596 2017-04-28  Chris Dumez  <cdumez@apple.com>
2597
2598         URLSearchParams should be reflective
2599         https://bugs.webkit.org/show_bug.cgi?id=171345
2600
2601         Reviewed by Alex Christensen.
2602
2603         There was a bug in our implementation of [1] where we would replace
2604         '+' with 0x20 *after* URL-decoding the string, instead of *before*.
2605         This was causing us to replace URL-encoded '+' characters with 0x20.
2606
2607         [1] https://url.spec.whatwg.org/#concept-urlencoded-parser
2608
2609         No new tests, updated existing test.
2610
2611         * platform/URLParser.cpp:
2612
2613 2017-04-28  Youenn Fablet  <youenn@apple.com>
2614
2615         Adding a runtime flag specific to MediaDevices
2616         https://bugs.webkit.org/show_bug.cgi?id=171433
2617
2618         Reviewed by Geoffrey Garen.
2619
2620         Covered by existing tests.
2621
2622         Adding a preference for MediaDevices.
2623         Setting media devices runtime flag to false by default.
2624         Setting peer connection and media stream flags to true by default.
2625         Activating mediaDevices and getUserMedia Navigator properties based on media devices flag.
2626
2627         * Modules/mediastream/NavigatorMediaDevices.idl:
2628         * Modules/mediastream/NavigatorUserMedia.idl:
2629         * page/RuntimeEnabledFeatures.cpp:
2630         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
2631         * page/RuntimeEnabledFeatures.h:
2632         (WebCore::RuntimeEnabledFeatures::mediaDevicesEnabled):
2633         (WebCore::RuntimeEnabledFeatures::setMediaDevicesEnabled):
2634
2635 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
2636
2637         Implement ondevicechange
2638         https://bugs.webkit.org/show_bug.cgi?id=169872
2639
2640         Unreviewed, fix test crash.
2641
2642         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2643         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): "nextToken" must be static.
2644
2645 2017-04-28  Dean Jackson  <dino@apple.com>
2646
2647         [WebGPU] Label MTLCommandQueues with a prefix for internal telemetry
2648         https://bugs.webkit.org/show_bug.cgi?id=171441
2649         <rdar://problem/31826915>
2650
2651         Reviewed by Tim Horton.
2652
2653         Prefix any label that is set by the WebGPU API so that
2654         our telemetry can identify the use. Don't expose that
2655         prefix to the API though.
2656
2657         New API Test: GPUCommandQueue
2658
2659         * platform/graphics/cocoa/GPUCommandQueueMetal.mm:
2660         (WebCore::GPUCommandQueue::GPUCommandQueue):
2661         (WebCore::GPUCommandQueue::label):
2662         (WebCore::GPUCommandQueue::setLabel):
2663
2664 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
2665
2666         [ATK] aria-modal="true" should be exposed via ATK_STATE_MODAL
2667         https://bugs.webkit.org/show_bug.cgi?id=171188
2668
2669         Reviewed by Chris Fleizach.
2670
2671         Include ATK_STATE_MODAL in the AtkObject's state set if the accessible
2672         element's node is the current ARIA modal node.
2673
2674         Test: accessibility/gtk/aria-modal-state-exposed.html
2675
2676         * accessibility/AccessibilityObject.cpp:
2677         (WebCore::AccessibilityObject::isAriaModalNode):
2678         * accessibility/AccessibilityObject.h:
2679         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2680         (setAtkStateSetFromCoreObject):
2681
2682 2017-04-28  Eric Carlson  <eric.carlson@apple.com>
2683
2684         Implement ondevicechange
2685         https://bugs.webkit.org/show_bug.cgi?id=169872
2686         <rdar://problem/28945035>
2687
2688         Reviewed by Jer Noble.
2689
2690         Test: fast/mediastream/device-change-event.html
2691
2692         * Modules/mediastream/MediaDevices.cpp:
2693         (WebCore::MediaDevices::MediaDevices): Register for devicechange callbacks.
2694         (WebCore::MediaDevices::~MediaDevices): Unregister.
2695         (WebCore::MediaDevices::scheduledEventTimerFired):
2696         * Modules/mediastream/MediaDevices.h:
2697         * Modules/mediastream/MediaDevices.idl:
2698
2699         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
2700         (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): Remove unnecessary instance variables.
2701         * Modules/mediastream/MediaDevicesEnumerationRequest.h:
2702
2703         * Modules/mediastream/MediaDevicesRequest.cpp:
2704         (WebCore::MediaDevicesRequest::start): Remove m_idHashSalt, it isn't used. RealtimeMediaSourceCenter
2705         now has the method to hash ids and group IDs.
2706         (WebCore::hashString): Deleted.
2707         (WebCore::MediaDevicesRequest::hashID): Deleted.
2708         * Modules/mediastream/MediaDevicesRequest.h:
2709
2710         * dom/Document.h:
2711         (WebCore::Document::setDeviceIDHashSalt):
2712         (WebCore::Document::deviceIDHashSalt):
2713
2714         * dom/EventNames.h: Add devicechange.
2715
2716         * dom/EventTargetFactory.in: Add MediaDevices.
2717
2718         * html/HTMLAttributeNames.in: Add ondevicechange.
2719
2720         * platform/mediastream/CaptureDeviceManager.cpp:
2721         (WebCore::CaptureDeviceManager::captureDeviceFromPersistentID): Renamed from captureDeviceFromDeviceID
2722         and changed to return a std::optional<CaptureDevice>.
2723         (WebCore::CaptureDeviceManager::captureDeviceFromDeviceID): Deleted.
2724
2725         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2726         (WebCore::addStringToSHA): New, add string bytes to SHA1. Moved from MediaDevicesRequest
2727         so we can use for in testing.
2728         (WebCore::RealtimeMediaSourceCenter::hashStringWithSalt): Generate hash for a string with a
2729         salt. Moved from MediaDevicesRequest so we can use for in testing.
2730         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithUniqueID): Find a CaptureDevice given 
2731         a unique ID and the process hash salt.
2732         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled): Enable/disable a device. Used for
2733         layout tests only.
2734         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver): Add a devices changed listener.
2735         (WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver): Remove a listener.
2736         (WebCore::RealtimeMediaSourceCenter::captureDevicesChanged): Notify listeners.
2737         * platform/mediastream/RealtimeMediaSourceCenter.h:
2738
2739         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2740         (WebCore::AVCaptureDeviceManager::addDevicesChangedObserver): Update for change to captureDeviceFromDeviceID.
2741
2742         * platform/mock/MockRealtimeMediaSource.cpp:
2743         (WebCore::MockRealtimeMediaSource::audioDevices): All devices are enabled by default.
2744         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
2745
2746         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2747         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): Drive-by cleanup: use the vector
2748         of devices instead of making assumptions about the number.
2749         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices): Only include enabled devices.
2750         (WebCore::MockRealtimeMediaSourceCenter::setDeviceEnabled): Enable or disable a device.
2751         * platform/mock/MockRealtimeMediaSourceCenter.h:
2752
2753         * testing/Internals.cpp:
2754         (WebCore::Internals::setMediaDeviceState): Enable or disable a mock capture device.
2755         * testing/Internals.h:
2756         * testing/Internals.idl:
2757
2758 2017-04-28  Alex Christensen  <achristensen@webkit.org>
2759
2760         Fix memory corruption issue after r215883.
2761         https://bugs.webkit.org/show_bug.cgi?id=171365
2762
2763         Reviewed by Brady Eidson.
2764
2765         This fixes a crash when starting WebKit2.
2766
2767         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2768         (WebCore::NetworkStorageSession::NetworkStorageSession):
2769         Initialize m_platformCookieStorage with the default constructor of RetainPtr,
2770         then call NetworkStorageSession::cookieStorage which checks m_platformCookieStorage
2771         for null.  It was checking uninitialized memory when we had m_platformCookieStorage
2772         in the initializer list.
2773
2774 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
2775
2776         AX: Implement aria-value support for focusable separators
2777         https://bugs.webkit.org/show_bug.cgi?id=171169
2778
2779         Reviewed by Chris Fleizach.
2780
2781         Add SplitterRole to the roles which support range value and are considered a range
2782         control, as long as the SplitterRole element is focusable. Also replace ATK's role-
2783         based check with a call to supportsRangeValue() when determining if the AtkValue
2784         interface should be implemented.
2785
2786         Test: accessibility/separator-values.html
2787
2788         * accessibility/AccessibilityObject.cpp:
2789         (WebCore::AccessibilityObject::isRangeControl):
2790         (WebCore::AccessibilityObject::supportsRangeValue):
2791         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2792         (getInterfaceMaskFromObject):
2793
2794 2017-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
2795
2796         [ATK] GridCellRole should implement AtkTableCell (regression?)
2797         https://bugs.webkit.org/show_bug.cgi?id=171179
2798
2799         Reviewed by Chris Fleizach.
2800
2801         Add GridCellRole to the group of roles which should implement AtkTableCell.
2802
2803         Test: accessibility/gtk/interface-table-cell.html
2804
2805         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2806         (getInterfaceMaskFromObject):
2807
2808 2017-04-28  Miguel Gomez  <magomez@igalia.com>
2809
2810         REGRESSION(r215211): [GTK] Several webgl related tests are failing
2811         https://bugs.webkit.org/show_bug.cgi?id=170730
2812
2813         Reviewed by Said Abou-Hallawa.
2814
2815         There is a wrong situation in the image decoders where the complete data has been assigned
2816         to them but the size of the image hasn't been decoded yet. This is causing rendering
2817         issues in webgl when decoding the images used as textures. To fix this, we refactor how the
2818         encoded data status is stored to avoid that situation: the status is handled completely
2819         by ImageDecoder.h, and it's the one forcing the decode of the size when data gets assigned
2820         to the decoders.
2821
2822         Covered by existent tests.
2823
2824         * platform/image-decoders/ImageDecoder.h:
2825         (WebCore::ImageDecoder::isAllDataReceived):
2826         (WebCore::ImageDecoder::setData):
2827         (WebCore::ImageDecoder::encodedDataStatus):
2828         (WebCore::ImageDecoder::isSizeAvailable):
2829         (WebCore::ImageDecoder::setSize):
2830         (WebCore::ImageDecoder::setFailed):
2831         (WebCore::ImageDecoder::failed):
2832         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
2833         (WebCore::BMPImageDecoder::frameBufferAtIndex):
2834         (WebCore::BMPImageDecoder::decode):
2835         (WebCore::BMPImageDecoder::encodedDataStatus): Deleted.
2836         * platform/image-decoders/bmp/BMPImageDecoder.h:
2837         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2838         (WebCore::GIFImageDecoder::frameCount):
2839         (WebCore::GIFImageDecoder::frameBufferAtIndex):
2840         (WebCore::GIFImageDecoder::decode):
2841         (WebCore::GIFImageDecoder::encodedDataStatus): Deleted.
2842         * platform/image-decoders/gif/GIFImageDecoder.h:
2843         * platform/image-decoders/ico/ICOImageDecoder.cpp:
2844         (WebCore::ICOImageDecoder::setData):
2845         (WebCore::ICOImageDecoder::frameCount):
2846         (WebCore::ICOImageDecoder::frameBufferAtIndex):
2847         (WebCore::ICOImageDecoder::setDataForPNGDecoderAtIndex):
2848         (WebCore::ICOImageDecoder::decode):
2849         (WebCore::ICOImageDecoder::decodeAtIndex):
2850         (WebCore::ICOImageDecoder::encodedDataStatus): Deleted.
2851         * platform/image-decoders/ico/ICOImageDecoder.h:
2852         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
2853         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
2854         (WebCore::JPEGImageDecoder::decode):
2855         (WebCore::JPEGImageDecoder::encodedDataStatus): Deleted.
2856         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
2857         * platform/image-decoders/png/PNGImageDecoder.cpp:
2858         (WebCore::PNGImageDecoder::frameBufferAtIndex):
2859         (WebCore::PNGImageDecoder::decode):
2860         (WebCore::PNGImageDecoder::encodedDataStatus): Deleted.
2861         * platform/image-decoders/png/PNGImageDecoder.h:
2862         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
2863         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
2864         (WebCore::WEBPImageDecoder::decode):
2865         (WebCore::WEBPImageDecoder::encodedDataStatus): Deleted.
2866         * platform/image-decoders/webp/WEBPImageDecoder.h:
2867
2868 2017-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2869
2870         Move UUID from WebCore/platform to WTF
2871         https://bugs.webkit.org/show_bug.cgi?id=171372
2872
2873         Reviewed by Michael Catanzaro.
2874
2875         UUID only contains createCanonicalUUIDString() that is platform independent and doesn't depend on anything from
2876         WebCore, only from WTF.
2877
2878         * CMakeLists.txt:
2879         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
2880         * Modules/mediacontrols/MediaControlsHost.cpp:
2881         * Modules/mediastream/RTCPeerConnection.cpp:
2882         * Modules/webaudio/MediaStreamAudioSource.cpp:
2883         * Modules/webdatabase/DatabaseTracker.cpp:
2884         * WebCore.order:
2885         * WebCore.xcodeproj/project.pbxproj:
2886         * editing/mac/EditorMac.mm:
2887         * fileapi/BlobURL.cpp:
2888         * loader/appcache/ApplicationCacheHost.cpp:
2889         * loader/appcache/ApplicationCacheStorage.cpp:
2890         * platform/URL.cpp:
2891         * platform/glib/FileSystemGlib.cpp:
2892         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
2893         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2894         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
2895         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2896         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2897         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2898         * platform/mediastream/CaptureDeviceManager.cpp:
2899         * platform/mediastream/MediaStreamPrivate.h:
2900         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2901         * platform/mediastream/RealtimeMediaSource.cpp:
2902         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2903         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2904         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2905         * platform/mock/MockRealtimeAudioSource.cpp:
2906         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2907         * platform/mock/MockRealtimeVideoSource.cpp:
2908         * testing/MockCDMFactory.cpp:
2909
2910 2017-04-27  Alex Christensen  <achristensen@webkit.org>
2911
2912         Make navigation policy checking more robust
2913         https://bugs.webkit.org/show_bug.cgi?id=171409
2914         <rdar://problem/31489248>
2915
2916         Reviewed by Geoffrey Garen.
2917
2918         No change in behavior.  Just added a protectedThis to a lambda and made the functions non-copyable.
2919
2920         * loader/DocumentLoader.cpp:
2921         (WebCore::DocumentLoader::willSendRequest):
2922         * loader/PolicyCallback.cpp:
2923         (WebCore::PolicyCallback::set):
2924         (WebCore::PolicyCallback::clear): Deleted.
2925         * loader/PolicyCallback.h:
2926         * loader/PolicyChecker.cpp:
2927         (WebCore::PolicyChecker::cancelCheck):
2928         (WebCore::PolicyChecker::stopCheck):
2929         (WebCore::PolicyChecker::continueAfterNavigationPolicy):
2930         (WebCore::PolicyChecker::continueAfterNewWindowPolicy):
2931         (WebCore::PolicyChecker::continueAfterContentPolicy):
2932
2933 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2934
2935         Data interaction should not load pasteboard content before performing the data operation
2936         https://bugs.webkit.org/show_bug.cgi?id=171414
2937         <rdar://problem/31878197>
2938
2939         Reviewed by Tim Horton.
2940
2941         When interacting with a link, we should not try to fetch pasteboard contents for the URL UTI type before
2942         performing the data operation. Teaches DragController to know whether it is allowed to load data from the
2943         dragging pasteboard, and uses this information in DragController::dragOperation to determine whether to use
2944         DragData::containsURLTypeIdentifier or DragData::containsURL.
2945
2946         * page/DragController.cpp:
2947         (WebCore::DragController::DragController):
2948         (WebCore::DragController::performDragOperation):
2949         * page/DragController.h:
2950         (WebCore::DragController::canLoadDataFromDraggingPasteboard):
2951         * page/mac/DragControllerMac.mm:
2952         (WebCore::DragController::dragOperation):
2953         * platform/DragData.h:
2954         * platform/ios/WebItemProviderPasteboard.mm:
2955         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
2956         * platform/mac/DragDataMac.mm:
2957         (WebCore::DragData::containsURLTypeIdentifier):
2958
2959 2017-04-27  Joseph Pecoraro  <pecoraro@apple.com>
2960
2961         Support for promise rejection events (unhandledrejection)
2962         https://bugs.webkit.org/show_bug.cgi?id=150358
2963         <rdar://problem/28441651>
2964
2965         Reviewed by Saam Barati.
2966
2967         Patch by Joseph Pecoraro and Yusuke Suzuki.
2968
2969         Implement support for the `onunhandledrejection` and `rejectionhandled` events.
2970         They dispatch a new PromiseRejectionEvent using the ES6 HostPromiseRejectionTracker hook:
2971         https://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker
2972         https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections
2973
2974         This is currently implemented only for Documents and not yet Web Workers.
2975
2976         Tests: js/dom/unhandled-promise-rejection-basic.html
2977                js/dom/unhandled-promise-rejection-bindings-type-error.html
2978                js/dom/unhandled-promise-rejection-console-no-report.html
2979                js/dom/unhandled-promise-rejection-console-report.html
2980                js/dom/unhandled-promise-rejection-handle-during-event.html
2981                js/dom/unhandled-promise-rejection-handle-in-handler.html
2982                js/dom/unhandled-promise-rejection-handle.html
2983                js/dom/unhandled-promise-rejection-order.html
2984
2985         * CMakeLists.txt:
2986         * DerivedSources.cpp:
2987         * DerivedSources.make:
2988         * WebCore.xcodeproj/project.pbxproj:
2989         * dom/DOMAllInOne.cpp:
2990         New files.
2991
2992         * bindings/scripts/CodeGenerator.pm:
2993         (IsPromiseType):
2994         * bindings/scripts/CodeGeneratorJS.pm:
2995         (AddToIncludesForIDLType):
2996         (GetBaseIDLType):
2997         Binding support for Promise<T> attributes.
2998
2999         * bindings/js/JSDOMConvert.h:
3000         * bindings/js/JSDOMConvertPromise.h: Copied from Source/JavaScriptCore/runtime/JSPromise.h.
3001         (WebCore::Converter<IDLPromise<T>>::convert):
3002         (WebCore::JSConverter<IDLPromise<T>>::convert):
3003         Promise<T> binding conversion is currently unimplemented, which only means
3004         web developers creating their own PromiseRejectionEvent will not get
3005         autowrapping of values assigned to `promise` in event initialization.
3006         Engine generated events will have expected behavior.
3007
3008         * bindings/js/JSDOMWindowBase.cpp:
3009         (WebCore::JSDOMWindowBase::promiseRejectionTracker):
3010         * bindings/js/JSDOMWindowBase.h:
3011         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3012         Implement HostPromiseRejectionTracker hook for Document but not Worker.
3013         Passes through to the ScriptExecutionContext's tracker.
3014
3015         * bindings/js/JSMainThreadExecState.cpp:
3016         (WebCore::JSMainThreadExecState::didLeaveScriptContext):
3017         * bindings/js/JSMainThreadExecState.h:
3018         (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
3019         When completing script execution and performing microtasks notify
3020         about rejected promises. Technically this should go inside of
3021         performing a microtask checkpoint, except lacking EventLoop
3022         concepts we use ScriptExecutionState.
3023
3024         * dom/EventNames.h:
3025         * dom/EventNames.in:
3026         * dom/PromiseRejectionEvent.cpp: Added.
3027         (WebCore::PromiseRejectionEvent::PromiseRejectionEvent):
3028         (WebCore::PromiseRejectionEvent::~PromiseRejectionEvent):
3029         * dom/PromiseRejectionEvent.h: Added.
3030         * dom/PromiseRejectionEvent.idl: Added.
3031         New PromiseRejectionEvent event interface.
3032
3033         * dom/GlobalEventHandlers.idl:
3034         New onunhandledrejection and onrejectionhandled.
3035
3036         * dom/RejectedPromiseTracker.cpp: Added.
3037         (WebCore::RejectedPromise::RejectedPromise):
3038         (WebCore::RejectedPromise::globalObject):
3039         (WebCore::RejectedPromise::promise):
3040         (WebCore::UnhandledPromise::UnhandledPromise):
3041         (WebCore::UnhandledPromise::callStack):
3042         (WebCore::RejectedPromiseTracker::RejectedPromiseTracker):
3043         (WebCore::RejectedPromiseTracker::~RejectedPromiseTracker):
3044         (WebCore::createScriptCallStackFromReason):
3045         (WebCore::RejectedPromiseTracker::promiseRejected):
3046         (WebCore::RejectedPromiseTracker::promiseHandled):
3047         (WebCore::RejectedPromiseTracker::processQueueSoon):
3048         (WebCore::RejectedPromiseTracker::reportUnhandledRejections):
3049         (WebCore::RejectedPromiseTracker::reportRejectionHandled):
3050         * dom/RejectedPromiseTracker.h: Added.
3051         Track and report rejected promises. The promises are tracked weakly
3052         allowing them to be collected before they are reported. When reporting
3053         we dispatch PromiseRejectionEvent events, and if the default is not
3054         prevented we log a message to the console.
3055
3056         * dom/ScriptExecutionContext.cpp:
3057         (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
3058         (WebCore::ScriptExecutionContext::ensureRejectedPromiseTrackerSlow):
3059         * dom/ScriptExecutionContext.h:
3060         (WebCore::ScriptExecutionContext::ensureRejectedPromiseTracker):
3061         Each ScriptExecutionContext can own a rejected promise tracker.
3062
3063         * html/HTMLMediaElement.cpp:
3064         (WebCore::HTMLMediaElement::pauseInternal):
3065         https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps
3066         Internal pause steps say to timeupdate, pause, and rejecting pending play promises
3067         should all happen in a queued task. Here the first two actions are already scheduled
3068         on tasks, but rejecting play promises was not being done in a task, so this makes
3069         that change.
3070
3071         * Modules/streams/ReadableStream.js:
3072         (pipeThrough):
3073         * Modules/streams/ReadableStreamInternals.js:
3074         (readableStreamReaderGenericInitialize):
3075         (readableStreamError):
3076         (readableStreamReaderGenericRelease):
3077         Satisfy parts of the Streams specification which state to set the
3078         [[PromiseIsHandled]] internal state of promises created internally
3079         by the Streams APIs. This prevents some internal promises from
3080         appearing as unhandled promise rejections.
3081
3082 2017-04-27  Chris Dumez  <cdumez@apple.com>
3083
3084         Align colspan/rowspan limits with the latest HTML specification
3085         https://bugs.webkit.org/show_bug.cgi?id=171322
3086
3087         Reviewed by Darin Adler.
3088
3089         Align colspan/rowspan limits with the latest HTML specification after:
3090         - https://github.com/whatwg/html/pull/1993
3091
3092         The following changes were made:
3093         - Our rowspan limit was raised from 8190 to 65534
3094         - A colspan limit of 1000 was introduced. Blink has UseCounter data showing that
3095           colspans over 1000 are extremely rare and Gecko has data showing that when we
3096           get a colspan greater than 1000, it is usually a bug. Therefore, this change
3097           should be fine.
3098         - The limits are now properly reflected via the IDL attributes instead of lying
3099           to the Web about the colspan / rowspan we are using internally.
3100
3101         Test: imported/w3c/web-platform-tests/html/semantics/tabular-data/processing-model-1/span-limits.html
3102
3103         * html/HTMLTableCellElement.cpp:
3104         (WebCore::HTMLTableCellElement::colSpan):
3105         (WebCore::HTMLTableCellElement::rowSpan):
3106         (WebCore::HTMLTableCellElement::rowSpanForBindings):
3107         (WebCore::HTMLTableCellElement::setColSpan):
3108         * html/HTMLTableCellElement.h:
3109         * html/HTMLTableCellElement.idl:
3110         * html/parser/HTMLParserIdioms.cpp:
3111         (WebCore::parseHTMLIntegerInternal):
3112         (WebCore::parseHTMLInteger):
3113         (WebCore::parseHTMLNonNegativeInteger):
3114         (WebCore::parseValidHTMLNonNegativeIntegerInternal):
3115         (WebCore::parseHTTPRefreshInternal):
3116         * html/parser/HTMLParserIdioms.h:
3117         (WebCore::parseHTMLInteger):
3118         (WebCore::parseHTMLNonNegativeInteger):
3119
3120         (WebCore::clampHTMLNonNegativeIntegerToRange):
3121         Add utility function to implement:
3122         - https://html.spec.whatwg.org/#clamped-to-the-range
3123
3124 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3125
3126         WKUIDelegatePrivate needs a hook to vend data used to initialize item providers for data interaction
3127         https://bugs.webkit.org/show_bug.cgi?id=171386
3128         <rdar://problem/31557237>
3129
3130         Reviewed by Beth Dakin.
3131
3132         Teach WebItemProviderPasteboard to remember what WebItemProviderRegistrationInfoList it was initialized with
3133         when beginning a drag. This information is cleared out the next time the list of item providers is set to
3134         something different, which happens when the data interaction session concludes.
3135
3136         * platform/ios/WebItemProviderPasteboard.h:
3137         * platform/ios/WebItemProviderPasteboard.mm:
3138         (-[WebItemProviderPasteboard init]):
3139         (-[WebItemProviderPasteboard setItemProviders:]):
3140         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
3141         (-[WebItemProviderPasteboard registrationInfoAtIndex:]):
3142         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
3143
3144 2017-04-27  Brady Eidson  <beidson@apple.com>
3145
3146         Refactor SessionID to support multiple non-ephemeral (persistent) sessions.
3147         https://bugs.webkit.org/show_bug.cgi?id=171367
3148
3149         Reviewed by Andy Estes.
3150
3151         This is also a nice general cleanup of SessionID, including privatizing the "arbitrary number" constructor
3152         and moving encode/decode into the class.
3153
3154         No new tests (Refactor, no behavior change yet).
3155
3156         * CMakeLists.txt:
3157         * WebCore.xcodeproj/project.pbxproj:
3158         
3159         * page/SessionID.cpp: Added.
3160         (WebCore::SessionID::generatePersistentSessionID):
3161         (WebCore::SessionID::generateEphemeralSessionID):
3162         (WebCore::SessionID::enableGenerationProtection):
3163         
3164         * page/SessionID.h:
3165         (WebCore::SessionID::SessionID):
3166         (WebCore::SessionID::emptySessionID):
3167         (WebCore::SessionID::hashTableDeletedValue):
3168         (WebCore::SessionID::defaultSessionID):
3169         (WebCore::SessionID::legacyPrivateSessionID):
3170         (WebCore::SessionID::isValid):
3171         (WebCore::SessionID::isEphemeral):
3172         (WebCore::SessionID::encode):
3173         (WebCore::SessionID::decode):
3174         (WTF::HashTraits<WebCore::SessionID>::constructDeletedValue):
3175         (WTF::HashTraits<WebCore::SessionID>::isDeletedValue):
3176
3177 2017-04-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
3178
3179         Attempt to fix a PLT regression on Mac
3180         <rdar://problem/31826998>
3181
3182         Unreviewed.
3183
3184         Disable passing the TypeIdentifierHint to CGImageSourceCreateIncremental()
3185         on Mac for now.
3186
3187         * platform/graphics/cg/ImageDecoderCG.cpp:
3188         (WebCore::ImageDecoder::ImageDecoder):
3189
3190 2017-04-27  Daniel Bates  <dabates@apple.com>
3191
3192         Rename callerDOMWindow()/CallerDocument to incumbentDOMWindow()/IncumbentDocument
3193         https://bugs.webkit.org/show_bug.cgi?id=171145
3194
3195         Reviewed by Saam Barati.
3196
3197         Standardize on the terminology "incumbent" to refer to "most-recently-entered author
3198         function or script on the stack, or the author function or script that originally
3199         scheduled the currently-running callback" (1).
3200
3201         [1] <https://html.spec.whatwg.org/multipage/webappapis.html#realms-settings-objects-global-objects> (27 April 2017)
3202
3203         * bindings/js/JSDOMWindowBase.cpp:
3204         (WebCore::incumbentDOMWindow):
3205         (WebCore::callerDOMWindow): Deleted.
3206         * bindings/js/JSDOMWindowBase.h:
3207         * bindings/scripts/CodeGeneratorJS.pm:
3208         (GenerateCallWith):
3209         * bindings/scripts/test/JS/JSTestObj.cpp:
3210         (WebCore::jsTestObjPrototypeFunctionWithCallerDocumentArgumentCaller):
3211         (WebCore::jsTestObjPrototypeFunctionWithCallerWindowArgumentCaller):
3212         * bindings/scripts/test/TestObj.idl:
3213         * page/DOMWindow.idl:
3214
3215 2017-04-27  Youenn Fablet  <youenn@apple.com>
3216
3217         LayoutTest webrtc/datachannel/datachannel-event.html is a flaky crash
3218         https://bugs.webkit.org/show_bug.cgi?id=171092
3219         <rdar://problem/31748066>
3220
3221         Reviewed by Eric Carlson.
3222
3223         Covered by manual testing on iterating on the crashing tests.
3224         With the patch, they appear to no longer crash.
3225
3226         The current RTCPeerConnection/RTCController was expecting that peer connections would be stopped before the controller.
3227         This assumption is sometimes wrong.
3228         Adding clean-up on both sides so that if controller goes away, it notifies its peer connections that they are unregistered.
3229
3230         * Modules/mediastream/RTCController.cpp:
3231         (WebCore::RTCController::~RTCController):
3232         * Modules/mediastream/RTCController.h:
3233         * Modules/mediastream/RTCPeerConnection.cpp:
3234         (WebCore::RTCPeerConnection::create):
3235         (WebCore::RTCPeerConnection::~RTCPeerConnection):
3236         (WebCore::RTCPeerConnection::doStop):
3237         (WebCore::RTCPeerConnection::registerToController):
3238         (WebCore::RTCPeerConnection::unregisterFromController):
3239         (WebCore::RTCPeerConnection::rtcController): Deleted.
3240         * Modules/mediastream/RTCPeerConnection.h:
3241
3242 2017-04-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
3243
3244         REGRESSION(r213764): Async decoding of animated images is disabled for ImageDocument
3245         https://bugs.webkit.org/show_bug.cgi?id=170333
3246
3247         Reviewed by Simon Fraser.
3248
3249         The way the image drawing settings are transfered from the Settings to
3250         BitmapImage is problematic. The drawing settings are retrieved from the
3251         CachedImageObserver which store them in the constructor only if the
3252         CachedImage as a loader. In the case of ImageDocument, there isn't loader
3253         set in CachedImage so the settings of ImageDocument are not set. Also
3254         the CachedImage can be used after loading by another document which may
3255         have a different drawing settings.
3256
3257         The fix is to make BitmapImage reads the drawing settings every time it 
3258         is drawn as a foreground or background image in a RenderElement.
3259
3260         * html/canvas/CanvasRenderingContext2D.cpp:
3261         (WebCore::CanvasRenderingContext2D::drawImage):
3262         * loader/cache/CachedImage.cpp:
3263         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
3264         * loader/cache/CachedImage.h:
3265         * platform/graphics/BitmapImage.cpp:
3266         (WebCore::BitmapImage::setDrawingSettings):
3267         (WebCore::BitmapImage::draw):
3268         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): I was
3269         trying to disable the async image decoding temporarily but this way will
3270         even prevent testing it until it is enabled. Disable it through WK1 and
3271         WK2 preferences.
3272         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages):
3273         (WebCore::BitmapImage::advanceAnimation):
3274         * platform/graphics/BitmapImage.h:
3275         * platform/graphics/ImageObserver.h:
3276         * rendering/RenderBoxModelObject.cpp:
3277         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
3278         * rendering/RenderImage.cpp:
3279         (WebCore::RenderImage::paintIntoRect):
3280
3281 2017-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3282
3283         Performing data interaction with plain text into a contenteditable does not insert any content
3284         https://bugs.webkit.org/show_bug.cgi?id=171381
3285
3286         Reviewed by Tim Horton.
3287
3288         Attempt to read plain-text-conformant UTI types as kUTTypePlainText before reading them as kUTTypeText.
3289         This allows WebItemProviderPasteboard to properly materialize an NSString in -valuesForPasteboardType:
3290         inItemSet: using a pre-loaded NSData blob.
3291
3292         This scenario is covered by DataInteractionTests.ExternalSourceUTF8PlainTextOnly, but DataInteractionTests
3293         are temporarily disabled due to incompatibilities with the current internal SDK.
3294
3295         * platform/ios/PasteboardIOS.mm:
3296         (WebCore::readPasteboardWebContentDataForType):
3297
3298 2017-04-27  Chris Dumez  <cdumez@apple.com>
3299
3300         Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
3301         https://bugs.webkit.org/show_bug.cgi?id=171226
3302
3303         Reviewed by Simon Fraser.
3304
3305         Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
3306         as per:
3307         - https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
3308
3309         DOMRect is compatible with ClientRect, which we used to return so the risk should
3310         be low.
3311
3312         Tests: fast/css/DOMRect-attributes-prototype.html
3313                fast/css/DOMRect-serialization.html
3314                fast/dom/Element/getClientRects-return-type.html
3315
3316         * dom/ClientRectList.cpp:
3317         (WebCore::ClientRectList::ClientRectList):
3318         * dom/ClientRectList.h:
3319         (WebCore::ClientRectList::create):
3320         * dom/DOMRect.h:
3321         (WebCore::DOMRect::create):
3322         * dom/DOMRectReadOnly.h:
3323         * dom/Element.cpp:
3324         (WebCore::toDOMRectVector):
3325         (WebCore::Element::getClientRects):
3326         (WebCore::Element::getBoundingClientRect):
3327         * dom/Element.h:
3328         * dom/Element.idl:
3329         * html/track/VTTRegion.cpp:
3330         (WebCore::VTTRegion::displayLastTextTrackCueBox):
3331
3332 2017-04-27  Joanmarie Diggs  <jdiggs@igalia.com>
3333
3334         AX: Expose elements with the ARIA "feed" role
3335         https://bugs.webkit.org/show_bug.cgi?id=171184
3336
3337         Reviewed by Chris Fleizach.
3338
3339         Map elements with the "feed" role to the internal ApplicationGroupRole
3340         AccessibilityRole. This prevents them from being unexpectedly pruned from
3341         the accessibility tree, and causes them to be exposed with ATK_ROLE_PANEL
3342         in WebKitGtk and AXGroup in Safari.
3343
3344         No new tests needed. Instead, add the "feed" role to roles-exposed.html,
3345         xml-roles-exposed.html, and roles-computedRoleString.html.
3346
3347         * accessibility/AccessibilityObject.cpp:
3348         (WebCore::initializeRoleMap):
3349
3350 2017-04-27  Brady Eidson  <beidson@apple.com>
3351
3352         Update NetworkStorageSession to support multiple persistent sessions and explicitly set cookie storages.
3353         https://bugs.webkit.org/show_bug.cgi?id=171365
3354
3355         Reviewed by Andy Estes.
3356
3357         No new tests (No testable behavior change yet).
3358
3359         * platform/network/NetworkStorageSession.cpp:
3360         (WebCore::NetworkStorageSession::destroySession):
3361         * platform/network/NetworkStorageSession.h:
3362         
3363         * platform/network/NetworkStorageSessionStub.cpp:
3364         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
3365         (WebCore::NetworkStorageSession::ensureSession):
3366         
3367         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3368         (WebCore::createCFStorageSessionForIdentifier):
3369         (WebCore::NetworkStorageSession::NetworkStorageSession):
3370         (WebCore::NetworkStorageSession::switchToNewTestingSession):
3371         (WebCore::NetworkStorageSession::defaultStorageSession):
3372         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
3373         (WebCore::NetworkStorageSession::ensureSession):
3374         (WebCore::NetworkStorageSession::cookieStorage):
3375         
3376         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3377         (WebCore::NetworkStorageSession::ensureSession):
3378         
3379         * platform/spi/cf/CFNetworkSPI.h:
3380
3381 2017-04-27  Zalan Bujtas  <zalan@apple.com>
3382
3383         Use text-shadow to visualize simple line layout coverage.
3384         https://bugs.webkit.org/show_bug.cgi?id=171379
3385
3386         Reviewed by Antti Koivisto.
3387
3388         It's more subtle (for everyday use).
3389
3390         * rendering/SimpleLineLayoutFunctions.cpp:
3391         (WebCore::SimpleLineLayout::paintFlow):
3392         (WebCore::SimpleLineLayout::paintDebugBorders): Deleted.
3393
3394 2017-04-27  Joanmarie Diggs  <jdiggs@igalia.com>
3395
3396         [ATK] ARIA alertdialogs should be exposed with ROLE_DIALOG
3397         https://bugs.webkit.org/show_bug.cgi?id=171187
3398
3399         Reviewed by Chris Fleizach.
3400
3401         Map ApplicationAlertDialogRole to ATK_ROLE_DIALOG. While ATK_ROLE_ALERT is
3402         appropriate as far as ATK is concerned, the Core Accessibility API Mappings
3403         map ARIA's alertdialog role to ATK_ROLE_DIALOG. We should be consistent
3404         with the spec. The fact that this is an alert dialog can still be obtained
3405         via the AtkObject attributes.
3406
3407         No new tests needed. Update the expectations for roles-exposed.html,
3408         xml-roles-exposed.html, and aria-mappings.html to reflect the change.
3409
3410         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3411         (atkRole):
3412
3413 2017-04-27  Antti Koivisto  <antti@apple.com>
3414
3415         Repeated layouts in Mail due to viewport units being used with auto-sizing
3416         https://bugs.webkit.org/show_bug.cgi?id=171371
3417         <rdar://problem/28780084>
3418
3419         Reviewed by Zalan Bujtas.
3420
3421         Test: css3/viewport-percentage-lengths/vh-auto-size.html
3422
3423         Auto-sizing code would adjust the size of the view in the beginning of layout(). This would
3424         end up invalidating style for elements that use vh units and we would perform main layout
3425         with unclean style. This would result in endless layout loops and hit assert on debug.
3426
3427         * page/FrameView.cpp:
3428         (WebCore::FrameView::availableContentSizeChanged):
3429
3430             Ensure we heve clean style after resize if we are in pre-layout.
3431
3432 2017-04-27  Alex Christensen  <achristensen@webkit.org>
3433
3434         Modernize Frame.h
3435         https://bugs.webkit.org/show_bug.cgi?id=171357
3436
3437         Reviewed by Andy Estes.
3438
3439         Frame.h has several std::unique_ptrs that are created in the constructor, never null,
3440         and destroyed in the destructor.  This is what WTF::UniqueRef is for, and using UniqueRef
3441         allows us to not check for null values because a UniqueRef can never be null.
3442         An interesting case was the EventHandler, which we explicitly set to nullptr in the destructor
3443         of MainFrame, a subclass of Frame.  We added this in r199181 to fix a crash tested by
3444         fast/events/wheel-event-destroys-frame.html and this improved lifetime also does not crash
3445         or assert in that test.
3446
3447         Using UniqueRef also requires const correctness, which this patch adds when necessary.
3448
3449         * accessibility/AccessibilityObject.cpp:
3450         (WebCore::AccessibilityObject::dispatchTouchEvent):
3451         * editing/DeleteSelectionCommand.cpp:
3452         (WebCore::DeleteSelectionCommand::calculateTypingStyleAfterDelete):
3453         * editing/Editor.cpp:
3454         (WebCore::Editor::isSelectTrailingWhitespaceEnabled):
3455         (WebCore::Editor::computeAndSetTypingStyle):
3456         * editing/Editor.h:
3457         * editing/FrameSelection.cpp:
3458         (WebCore::FrameSelection::contains):
3459         (WebCore::FrameSelection::copyTypingStyle):
3460         * editing/FrameSelection.h:
3461         (WebCore::FrameSelection::setTypingStyle):
3462         * loader/EmptyClients.cpp:
3463         * loader/FrameLoader.cpp:
3464         (WebCore::FrameLoader::clear):
3465         * page/EditorClient.h:
3466         * page/EventHandler.cpp:
3467         (WebCore::EventHandler::hitTestResultAtPoint):
3468         * page/EventHandler.h:
3469         * page/Frame.cpp:
3470         (WebCore::Frame::Frame):
3471         (WebCore::Frame::setView):
3472         (WebCore::Frame::injectUserScripts):
3473         * page/Frame.h:
3474         (WebCore::Frame::editor):
3475         (WebCore::Frame::eventHandler):
3476         (WebCore::Frame::selection):
3477         (WebCore::Frame::animation):
3478         (WebCore::Frame::script):
3479         (WebCore::Frame::eventHandlerPtr): Deleted.
3480         * page/MainFrame.cpp:
3481         (WebCore::MainFrame::~MainFrame):
3482         * replay/UserInputBridge.cpp:
3483         (WebCore::UserInputBridge::handleContextMenuEvent):
3484         * replay/UserInputBridge.h:
3485
3486 2017-04-27  Andy Estes  <aestes@apple.com>
3487
3488         Fix the macOS build.
3489
3490         * platform/mac/WebPlaybackControlsManager.h:
3491
3492 2017-04-27  Zalan Bujtas  <zalan@apple.com>
3493
3494         Text gets cut off when bailing out of simple line layout with widows.
3495         https://bugs.webkit.org/show_bug.cgi?id=171370
3496         <rdar://problem/31563414>
3497
3498         Reviewed by Antti Koivisto.
3499
3500         Normal line layout requires an extra layout to handle widows. See RenderBlockFlow::relayoutToAvoidWidows. 
3501
3502         Test: fast/multicol/simple-line-layout-widows-when-switching-over-to-normal-line-layout.html
3503
3504         * rendering/RenderBlockFlow.cpp:
3505         (WebCore::RenderBlockFlow::ensureLineBoxes):
3506
3507 2017-04-27  Dean Jackson  <dino@apple.com>
3508
3509         Use the correct modern-media-controls
3510         https://bugs.webkit.org/show_bug.cgi?id=171358
3511
3512         Reviewed by Antoine Quint.
3513
3514         * WebCore.xcodeproj/project.pbxproj:
3515
3516 2017-04-26  Dan Bernstein  <mitz@apple.com>
3517
3518         Reverted r215774.
3519
3520         That change wasn’t doing what it was intended to do and was inappropriate for WebCore.
3521
3522         * WebCore.xcodeproj/project.pbxproj:
3523
3524 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
3525
3526         Attempt to fix a PLT regression.
3527         <rdar://problem/31826998>
3528
3529         Unreviewed.
3530
3531         Disable passing the TypeIdentifierHint to CGImageSourceCreateIncremental()
3532         on iOS for now.
3533
3534         * platform/graphics/cg/ImageDecoderCG.cpp:
3535         (WebCore::ImageDecoder::ImageDecoder):
3536
3537 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
3538
3539         [ATK] ARIA buttons which have a popup should be ATK_ROLE_PUSH_BUTTON; not ATK_ROLE_COMBO_BOX
3540         https://bugs.webkit.org/show_bug.cgi?id=171182
3541
3542         Reviewed by Chris Fleizach.
3543
3544         Test: accessibility/gtk/button-with-aria-haspopup-is-not-a-combobox.html
3545
3546         WebCore Accessibility assigns PopUpButtonRole to collapsed select elements,
3547         which the ATK code correctly maps to ATK_ROLE_COMBO_BOX. It turns out that
3548         WebCore Accessibility also maps the ARIA button role to PopUpButtonRole if
3549         it also has aria-haspopup. Add a check to atkRole() so that the latter case
3550         is mapped to ATK_ROLE_PUSH_BUTTON.
3551
3552         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3553         (atkRole):
3554
3555 2017-04-26  Tim Horton  <timothy_horton@apple.com>
3556
3557         Should not drag x-apple-data-detectors links
3558         https://bugs.webkit.org/show_bug.cgi?id=171352
3559         <rdar://problem/31309081>
3560
3561         Reviewed by Beth Dakin.
3562
3563         Test: fast/events/do-not-drag-and-drop-data-detectors-link.html
3564
3565         These links are only meaningful in the context of the original document,
3566         so they should not be draggable.
3567
3568         * editing/cocoa/DataDetection.h:
3569         * editing/cocoa/DataDetection.mm:
3570         (WebCore::DataDetection::dataDetectorURLProtocol):
3571         (WebCore::DataDetection::isDataDetectorURL):
3572         * page/DragController.cpp:
3573         (WebCore::isDraggableLink):
3574         Disallow dragging of <a href="x-apple-data-detectors://..."> links.
3575
3576 2017-04-26  Tim Horton  <timothy_horton@apple.com>
3577
3578         Revert accidentally smushed commit.
3579
3580         * editing/cocoa/DataDetection.h:
3581         * editing/cocoa/DataDetection.mm:
3582         (WebCore::DataDetection::dataDetectorURLProtocol): Deleted.
3583         (WebCore::DataDetection::isDataDetectorURL): Deleted.
3584         * page/DragController.cpp:
3585         (WebCore::isDraggableLink):
3586         * platform/mac/DragImageMac.mm:
3587         (WebCore::createDragImageForLink):
3588
3589 2017-04-26  Alex Christensen  <achristensen@webkit.org>
3590
3591         REGRESSION (r215686): ASSERTION FAILED: data seen with webarchive/loading tests
3592         https://bugs.webkit.org/show_bug.cgi?id=171340
3593
3594         Reviewed by Brady Eidson.
3595
3596         This fixes a flaky assertion in webarchive/loading/missing-data.html
3597
3598         * platform/cf/SharedBufferCF.cpp:
3599         (WebCore::SharedBuffer::append):
3600         If there's no CFDataRef, there's no need to append data.
3601         This happens sometimes.
3602
3603 2017-04-26  Ryan Haddad  <ryanhaddad@apple.com>
3604
3605         Unreviewed, rolling out r215814.
3606
3607         The LayoutTest for this change is failing on ios-simulator and
3608         is flaky on macOS.
3609
3610         Reverted changeset:
3611
3612         "Response.blob() does not set the content-type based on the
3613         header value."
3614         https://bugs.webkit.org/show_bug.cgi?id=170849
3615         http://trac.webkit.org/changeset/215814
3616
3617 2017-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3618
3619         WebItemProviderPasteboard should not synchronously load provided data
3620         https://bugs.webkit.org/show_bug.cgi?id=171341
3621         <rdar://problem/31614010>
3622
3623         Reviewed by Tim Horton.
3624
3625         Refactors WebItemProviderPasteboard to not require asynchronously loading item provider data. To accomplish this,
3626         we ensure that before performing data interaction, the UTI type that the data operation target should consume is
3627         propagated to the UI process prior to the web process receiving the signal from the UI process to begin the
3628         data operation itself. This information is sent via WebPlatformStrategies::updatePreferredTypeIdentifiers, a new
3629         pasteboard helper function.
3630
3631         * page/DragController.cpp:
3632         (WebCore::DragController::DragController):
3633         (WebCore::dragIsHandledByDocument):
3634         (WebCore::DragController::performDragOperation):
3635         (WebCore::DragController::dragEnteredOrUpdated):
3636         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
3637         (WebCore::DragController::tryDocumentDrag):
3638
3639         Give DragHandlingMethod a richer representation of what type of action will be performed. DragController::
3640         updatePreferredTypeIdentifiersForDragHandlingMethod uses this to determine what kinds of UTIs are acceptable for
3641         the current drop session.
3642
3643         * page/DragController.h:
3644         (WebCore::DragController::documentIsHandlingNonDefaultDrag):
3645         * page/mac/DragControllerMac.mm:
3646         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod):
3647
3648         Updates the data interaction pasteboard's list of preferred type identifiers it should load upon data operation.
3649
3650         * platform/DragData.h:
3651         * platform/PasteboardStrategy.h:
3652         * platform/PlatformPasteboard.h:
3653         * platform/ios/AbstractPasteboard.h:
3654         * platform/ios/PlatformPasteboardIOS.mm:
3655         (WebCore::PlatformPasteboard::updatePreferredTypeIdentifiers):
3656         * platform/ios/WebItemProviderPasteboard.mm:
3657
3658         Introduce _preferredTypeIdentifiers, which -doAfterLoadingProvidedContentIntoFileURLs: uses as a hint when
3659         determining which UTI to load for an item provider. In the absence of preferred type identifiers, the default
3660         behavior is to use the highest fidelity type adhering to "public.content".
3661
3662         (-[WebItemProviderPasteboard init]):
3663         (-[WebItemProviderPasteboard updatePreferredTypeIdentifiers:]):
3664         (-[WebItemProviderPasteboard setItemProviders:]):
3665         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
3666         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3667
3668         Remove calls to -createObjectOfClass: and -copyDataRepresentation:. Instead, rely solely on the loaded file URL
3669         to read and initialize data and objects from the pasteboard.
3670
3671         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
3672         (-[WebItemProviderPasteboard _tryToCreateObjectOfClass:usingProvider:]): Deleted.
3673         * platform/mac/DragDataMac.mm:
3674         (WebCore::DragData::updatePreferredTypeIdentifiers):
3675
3676 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
3677
3678         [ATK] Elements with a defined, non-false value for aria-current should expose ATK_STATE_ACTIVE
3679         https://bugs.webkit.org/show_bug.cgi?id=171163
3680
3681         Reviewed by Chris Fleizach.
3682
3683         Add ATK_STATE_ACTIVE to the state set of elements which have a valid, non-false
3684         value for aria-current, expose the value of via the "current" AtkObject attribute,
3685         and emit state-change notifications when the value of aria-current changes from
3686         non-false to false, or vice versa.
3687
3688         Tests: accessibility/gtk/aria-current-changed-notification.html
3689                accessibility/gtk/aria-current.html
3690
3691         * accessibility/AXObjectCache.cpp:
3692         (WebCore::AXObjectCache::handleAttributeChanged):
3693         * accessibility/AXObjectCache.h:
3694         * accessibility/AccessibilityObject.cpp:
3695         (WebCore::AccessibilityObject::supportsARIACurrent):
3696         (WebCore::AccessibilityObject::ariaCurrentValue):
3697         * accessibility/AccessibilityObject.h:
3698         * accessibility/atk/AXObjectCacheAtk.cpp:
3699         (WebCore::AXObjectCache::postPlatformNotification):
3700         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3701         (webkitAccessibleGetAttributes):
3702         (setAtkStateSetFromCoreObject):
3703         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3704         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Moved code returning
3705         string value for aria-current into AccessibilityObject:ariaCurrentValue().
3706
3707 2017-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3708
3709         WebItemProviderPasteboard should fetch preloaded assets from disk when possible
3710         https://bugs.webkit.org/show_bug.cgi?id=171320
3711         <rdar://problem/31614010>
3712
3713         Reviewed by Tim Horton.
3714
3715         Adds a mechanism to WebItemProviderPasteboard to remember the temporary file URLs of assets it has loaded using
3716         doAfterLoadingProvidedContentIntoFileURLs:. When retrieving data from the pasteboard, we then see if we can
3717         first fetch serialized data straight from disk instead of having to go through the item provider in both
3718         -dataForPasteboardType:inItemSet: and -valuesForPasteboardType:inItemSet:.
3719
3720         See below annotations for more detail.
3721
3722         * platform/ios/AbstractPasteboard.h:
3723         * platform/ios/PlatformPasteboardIOS.mm:
3724         (WebCore::PlatformPasteboard::filenamesForDataInteraction):
3725         * platform/ios/WebItemProviderPasteboard.h:
3726         * platform/ios/WebItemProviderPasteboard.mm:
3727
3728         Introduces _typeToFileURLMaps, an array of dictionaries. A dictionary at the ith index of this array represents
3729         a mapping of UTIs to loaded temo file URLs for the ith UIItemProvider in the _itemProviders array. Before data
3730         interaction is performed, all entries in this array will be empty.
3731
3732         (-[WebItemProviderPasteboard init]):
3733         (-[WebItemProviderPasteboard setItemProviders:]):
3734         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
3735         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
3736         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3737
3738         Consult any loaded assets on disk before hitting UIItemProviders via the new
3739         -_preLoadedDataConformingToType:forItemProviderAtIndex: helper method.
3740
3741         (-[WebItemProviderPasteboard _tryToCreateObjectOfClass:usingProvider:]):
3742         (-[WebItemProviderPasteboard fileURLsForDataInteraction]):
3743
3744         Traverse _typeToFileURLMaps to collect all file URLs.
3745
3746         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
3747
3748         Refactored to populate and set _typeToFileURLMaps when loading completes, rather than an array of file URLs.
3749
3750         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]): Deleted.
3751         (-[WebItemProviderPasteboard filenamesForDataInteraction]): Deleted.
3752
3753         Correct an erroneously named method (replaces filenames with fileURLs).
3754
3755 2017-04-26  Youenn Fablet  <youenn@apple.com>
3756
3757         LayoutTest webrtc/datachannel/basic.html is a flaky crash
3758         https://bugs.webkit.org/show_bug.cgi?id=170154
3759         <rdar://problem/31288423>
3760
3761         Reviewed by Geoffrey Garen.
3762
3763         Before the patch, we are setting the channel handler client to null and then unregistering from observer to
3764         libwebrtc data channel. Since this happens in two different threads, there might be a timing issue.
3765
3766         Removing this risk by first unregistering (done synchronously on the other thread), before setting client to null.
3767         Made some clean-up related refactoring.
3768
3769         * Modules/mediastream/RTCDataChannel.cpp:
3770         (WebCore::RTCDataChannel::create):
3771         (WebCore::RTCDataChannel::close):
3772         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
3773         (WebCore::LibWebRTCDataChannelHandler::setClient):
3774         (WebCore::LibWebRTCDataChannelHandler::close):
3775         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
3776         * platform/mediastream/RTCDataChannelHandler.h:
3777         * platform/mock/RTCDataChannelHandlerMock.cpp:
3778         (WebCore::RTCDataChannelHandlerMock::setClient):
3779         * platform/mock/RTCDataChannelHandlerMock.h:
3780
3781 2017-04-26  Alex Christensen  <achristensen@webkit.org>
3782
3783         Make user script injection more robust
3784         https://bugs.webkit.org/show_bug.cgi?id=171339
3785         <rdar://problem/30643691>
3786
3787         Reviewed by Geoffrey Garen.
3788
3789         * loader/EmptyClients.cpp:
3790         * page/Frame.cpp:
3791         (WebCore::Frame::injectUserScripts):
3792         * page/UserContentController.cpp:
3793         (WebCore::UserContentController::forEachUserScript):
3794         (WebCore::UserContentController::forEachUserStyleSheet):
3795         (WebCore::UserContentController::forEachUserMessageHandler):
3796         * page/UserContentController.h:
3797         * page/UserContentProvider.h:
3798
3799 2017-04-26  Zalan Bujtas  <zalan@apple.com>
3800
3801         RTL: recent searches popover is displayed in incorrect location
3802         https://bugs.webkit.org/show_bug.cgi?id=171338
3803         <rdar://problem/31377807>
3804
3805         Reviewed by Dean Jackson.
3806
3807         Compute the absolute coordinates for the popup the same way we do for the select dropdown.
3808
3809         * rendering/RenderSearchField.cpp:
3810         (WebCore::RenderSearchField::showPopup):
3811
3812 2017-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
3813
3814         Restrict WebKit image formats to a known whitelist
3815         https://bugs.webkit.org/show_bug.cgi?id=170700
3816
3817         Reviewed by Tim Horton.
3818
3819         If the image format is not supported, the load should be canceled and the
3820         image is marked a broken image.
3821
3822         Test: fast/images/image-formats-support.html
3823
3824         * loader/cache/CachedImage.cpp:
3825         (WebCore::CachedImage::addIncrementalDataBuffer):
3826         (WebCore::CachedImage::setImageDataBuffer):
3827         (WebCore::CachedImage::finishLoading):
3828         * loader/cache/CachedImage.h:
3829
3830 2017-04-26  Joanmarie Diggs  <jdiggs@igalia.com>
3831
3832         [ATK] Implement support for new ARIA 1.1 values of aria-haspopup
3833         https://bugs.webkit.org/show_bug.cgi?id=171164
3834
3835         Reviewed by Chris Fleizach.
3836
3837         In ARIA 1.1, aria-haspopup's value type changed from true/false to a token.
3838         Values: true, false (default, unless it's a combobox), dialog, grid, listbox
3839         (default for combobox), menu, and tree. Any value of aria-haspopup that is
3840         not included in the list of allowed values, including an empty string, must
3841         be treated as if the value false had been provided.
3842
3843         Add AccessibilityObject::ariaPopupValue() to validate the value, handle implicit
3844         values, and give platform assistive technologies a means to access that value.
3845
3846         If there is a valid, non-false value of aria-haspopup, include ATK_STATE_HAS_POPUP
3847         in the AtkStateSet. Lastly, expose the value (rather than true/false) via the "haspop"
3848         AtkObject attribute.
3849
3850         Test: accessibility/gtk/aria-haspopup.html
3851
3852         * accessibility/AccessibilityObject.h:
3853         (WebCore::AccessibilityObject::ariaPopupValue):
3854         (WebCore::AccessibilityObject::supportsARIAHasPopup):
3855         * accessibility/AccessibilityRenderObject.cpp:
3856         (WebCore::AccessibilityRenderObject::ariaHasPopup):
3857         * accessibility/AccessibilityRenderObject.h:
3858         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3859         (webkitAccessibleGetAttributes):
3860         (setAtkStateSetFromCoreObject):
3861
3862 2017-04-26  Alex Christensen  <achristensen@webkit.org>
3863
3864         Fix CMake build.
3865
3866         * PlatformMac.cmake:
3867
3868 2017-04-26  Antti Koivisto  <antti@apple.com>
3869
3870         Enable expired-only reload policy on Mac and iOS
3871         https://bugs.webkit.org/show_bug.cgi?id=171264
3872         <rdar://problem/31807637>
3873
3874         Reviewed by Andreas Kling.
3875
3876         Limit the behavior to http and data URLs (where we explicitly know about expiration).
3877
3878         * html/HTMLLinkElement.cpp:
3879         (WebCore::HTMLLinkElement::setCSSStyleSheet):
3880         * loader/FrameLoader.cpp:
3881         (WebCore::FrameLoader::subresourceCachePolicy):
3882
3883             Pass the URL so we can test for protocol.
3884
3885         * loader/FrameLoader.h:
3886         * loader/NavigationAction.cpp:
3887         (WebCore::navigationType):
3888
3889             Test for reload navigation type correctly.
3890
3891         * loader/cache/CachedResource.cpp:
3892         (WebCore::CachedResource::load):
3893         * loader/cache/CachedResourceLoader.cpp:
3894         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
3895         (WebCore::CachedResourceLoader::cachePolicy):
3896         * loader/cache/CachedResourceLoader.h:
3897
3898 2017-04-26  WebKit Contributor  <webkitcontrib@gmail.com>
3899
3900         Response.blob() does not set the content-type based on the header value.
3901         https://bugs.webkit.org/show_bug.cgi?id=170849
3902
3903         Reviewed by Alex Christensen.
3904
3905         The Fetch API specification requires setting the blob contentType
3906         using the Content-Type header value, if present.  Previously the
3907         FetchResponse class only called updateContentType() when first
3908         created even though all the headers were not available.  Call
3909         updateContentType() again after the headers are populated.
3910
3911         This change allows WebKit to pass the "Consume response's body: from
3912         fetch to blob" case in the WPT response-consume.html test.
3913
3914         Test: http://w3c-test.org/fetch/api/response/response-consume.html
3915
3916         * Modules/fetch/FetchResponse.cpp:
3917         (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Modified to
3918         call FetchBodyOwner::updateContentType() after filling m_headers.
3919
3920 2017-04-26  Andy Estes  <aestes@apple.com>
3921
3922         Try to fix the macOS Sierra build.
3923
3924         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
3925
3926 2017-04-26  Andy Estes  <aestes@apple.com>
3927
3928         [macOS] Add picture-in-picture support to WebPlaybackControlsManager
3929         https://bugs.webkit.org/show_bug.cgi?id=171328
3930         <rdar://problem/29875010>
3931
3932         Reviewed by Jer Noble.
3933
3934         * platform/cocoa/WebPlaybackSessionModel.h:
3935         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
3936         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
3937         (WebCore::WebPlaybackSessionModelMediaElement::togglePictureInPicture): If the media element
3938         is currently in PiP fullscreen mode, exit fullscreen. Otherwise, enter PiP fullscreen mode.
3939         * platform/mac/WebPlaybackControlsManager.h:
3940         * platform/mac/WebPlaybackControlsManager.mm:
3941         (-[WebPlaybackControlsManager canTogglePictureInPicture]): Added. Returns YES if
3942         -allowsPictureInPicturePlayback returns YES.
3943         (-[WebPlaybackControlsManager togglePictureInPicture]): Added. Calls
3944         WebPlaybackSessionModel::togglePictureInPicture().
3945         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
3946         (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen): Added a call to
3947         -[WebPlaybackControlsManager setPictureInPictureActive:YES].
3948         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen): Added a call to
3949         -[WebPlaybackControlsManager setPictureInPictureActive:NO].
3950         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): Ditto.
3951         * platform/spi/cocoa/AVKitSPI.h: Declared new SPI on AVTouchBarPlaybackControlsControlling.
3952
3953 2017-04-25  Dean Jackson  <dino@apple.com>
3954
3955         [Color] Make gradients work with ExtendedColors
3956         https://bugs.webkit.org/show_bug.cgi?id=171315
3957         <rdar://problems/31830177>
3958
3959         Reviewed by Antoine Quint.
3960
3961         Allow gradients to hold Color objects, and thus
3962         handle ExtendedColor. Implement the backend for
3963         CoreGraphics.
3964
3965         Test: css3/color/gradients.html
3966
3967         * platform/graphics/Gradient.cpp:
3968         (WebCore::Gradient::addColorStop): Just copy the Color now.
3969         (WebCore::compareStops): Handle rename of stop to offset.
3970         (WebCore::Gradient::hasAlpha): Use Color's helper.
3971         * platform/graphics/Gradient.h:
3972         (WebCore::Gradient::ColorStop::ColorStop): Rename stop
3973         to offset, and store a Color rather than four floating
3974         point values.
3975         * platform/graphics/cairo/GradientCairo.cpp:
3976         (WebCore::Gradient::platformGradient):
3977         * platform/graphics/cg/GradientCG.cpp:
3978         (WebCore::Gradient::platformGradient): Use the CG method
3979         that can handle CGColorRefs with ColorSpace values, and
3980         pass the Extended sRGB space which should be no change for
3981         all existing gradients but also handle ColorSpaces like
3982         Display P3.
3983         * platform/graphics/win/GradientDirect2D.cpp:
3984         (WebCore::Gradient::generateGradient):
3985         * svg/SVGGradientElement.cpp:
3986         (WebCore::SVGGradientElement::buildStops):
3987
3988 2017-04-25  Alex Christensen  <achristensen@webkit.org>
3989
3990         Encoded filename should be decoded for WKContentExtension.identifier
3991         https://bugs.webkit.org/show_bug.cgi?id=171316
3992
3993         Reviewed by Andy Estes.
3994
3995         * platform/FileSystem.h:
3996
3997 2017-04-26  Frederic Wang  <fwang@igalia.com>
3998
3999         Fix typo in RenderFrameBase
4000         https://bugs.webkit.org/show_bug.cgi?id=171324
4001
4002         Reviewed by Zalan Bujtas.
4003
4004         No new tests, behavior unchanged.
4005
4006         * rendering/RenderFrameBase.cpp:
4007         (WebCore::RenderFrameBase::layoutWithFlattening):
4008         (WebCore::RenderFrameBase::performLayoutWithFlattening):
4009         (WebCore::RenderFrameBase::peformLayoutWithFlattening): Deleted.
4010         * rendering/RenderFrameBase.h:
4011
4012 2017-04-26  Zalan Bujtas  <zalan@apple.com>
4013
4014         Forced page break on :after triggers infinite loop in column balancing
4015         https://bugs.webkit.org/show_bug.cgi?id=171309
4016         rdar://problem/26285884