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