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