WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-11  Chris Dumez  <cdumez@apple.com>
2
3         WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
4         https://bugs.webkit.org/show_bug.cgi?id=164644
5
6         Reviewed by Brady Eidson.
7
8         WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
9         as per:
10         - https://heycam.github.io/webidl/#es-attributes
11
12         This is because WorkerGlobalScope is not marked as [Global] or [PrimaryGlobal] in
13         the IDL:
14         - https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
15
16         DedicatedWorkerGlobalScope is the one that is marked as [Global] and that should
17         have its attributes on the instance:
18         - https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface
19
20         We were getting this mostly right, except for runtime-enabled attributes / operations
21         which would end up on the instance instead of the prototype. This patch adds support
22         for [PrimaryGlobal] / [Global] IDL extended attributes which determine the location
23         of properties. It also improves support for runtime-enabled properties so that they
24         can now be on either the instance or the prototype, exactly as if they were not
25         runtimed-enabled.
26
27         This gives us 100% pass rate on:
28         - http://w3c-test.org/IndexedDB/interfaces.worker.html
29
30         No new tests, updated existing test.
31
32         * bindings/scripts/CodeGeneratorJS.pm:
33         (IsGlobalOrPrimaryGlobalInterface):
34         (InterfaceRequiresAttributesOnInstance):
35         (AttributeShouldBeOnInstance):
36         (OperationShouldBeOnInstance):
37         (GenerateHeader):
38         (GeneratePropertiesHashTable):
39         (GenerateImplementation):
40         * bindings/scripts/IDLAttributes.txt:
41         * bindings/scripts/test/JS/JSInterfaceName.cpp:
42         (WebCore::JSInterfaceName::finishCreation):
43         * bindings/scripts/test/JS/JSInterfaceName.h:
44         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
45         (WebCore::JSTestActiveDOMObject::finishCreation):
46         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
47         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
48         (WebCore::JSTestCEReactions::finishCreation):
49         * bindings/scripts/test/JS/JSTestCEReactions.h:
50         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
51         (WebCore::JSTestCEReactionsStringifier::finishCreation):
52         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
53         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
54         (WebCore::JSTestClassWithJSBuiltinConstructor::finishCreation):
55         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
56         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
57         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::finishCreation):
58         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
59         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
60         (WebCore::JSTestCustomNamedGetter::finishCreation):
61         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
62         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
63         (WebCore::JSTestDOMJIT::finishCreation):
64         * bindings/scripts/test/JS/JSTestDOMJIT.h:
65         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
66         (WebCore::JSTestEventConstructor::finishCreation):
67         * bindings/scripts/test/JS/JSTestEventConstructor.h:
68         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
69         (WebCore::JSTestEventTarget::finishCreation):
70         * bindings/scripts/test/JS/JSTestEventTarget.h:
71         * bindings/scripts/test/JS/JSTestException.cpp:
72         (WebCore::JSTestException::finishCreation):
73         * bindings/scripts/test/JS/JSTestException.h:
74         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
75         (WebCore::JSTestGenerateIsReachable::finishCreation):
76         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
77         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
78         (WebCore::JSTestGlobalObject::finishCreation):
79         * bindings/scripts/test/JS/JSTestGlobalObject.h:
80         * bindings/scripts/test/JS/JSTestInterface.cpp:
81         (WebCore::JSTestInterface::finishCreation):
82         * bindings/scripts/test/JS/JSTestInterface.h:
83         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
84         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
85         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
86         * bindings/scripts/test/JS/JSTestIterable.cpp:
87         (WebCore::JSTestIterable::finishCreation):
88         * bindings/scripts/test/JS/JSTestIterable.h:
89         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
90         (WebCore::JSTestJSBuiltinConstructor::finishCreation):
91         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
92         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
93         (WebCore::JSTestMediaQueryListListener::finishCreation):
94         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
95         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
96         (WebCore::JSTestNamedConstructor::finishCreation):
97         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
98         * bindings/scripts/test/JS/JSTestNode.cpp:
99         (WebCore::JSTestNode::finishCreation):
100         * bindings/scripts/test/JS/JSTestNode.h:
101         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
102         (WebCore::JSTestNondeterministic::finishCreation):
103         * bindings/scripts/test/JS/JSTestNondeterministic.h:
104         * bindings/scripts/test/JS/JSTestObj.cpp:
105         (WebCore::JSTestObj::finishCreation):
106         * bindings/scripts/test/JS/JSTestObj.h:
107         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
108         (WebCore::JSTestOverloadedConstructors::finishCreation):
109         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
110         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
111         (WebCore::JSTestOverloadedConstructorsWithSequence::finishCreation):
112         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
113         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
114         (WebCore::JSTestOverrideBuiltins::finishCreation):
115         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
116         * bindings/scripts/test/JS/JSTestSerialization.cpp:
117         (WebCore::JSTestSerialization::finishCreation):
118         * bindings/scripts/test/JS/JSTestSerialization.h:
119         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
120         (WebCore::JSTestSerializedScriptValueInterface::finishCreation):
121         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
122         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
123         (WebCore::JSTestTypedefs::finishCreation):
124         * bindings/scripts/test/JS/JSTestTypedefs.h:
125         * bindings/scripts/test/TestGlobalObject.idl:
126         * page/DOMWindow.idl:
127         * workers/DedicatedWorkerGlobalScope.idl:
128
129 2016-11-11  Antti Koivisto  <antti@apple.com>
130
131         Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
132         https://bugs.webkit.org/show_bug.cgi?id=160864
133
134         Reviewed by Ryosuke Niwa.
135
136         Also fix similar issue with ::host
137
138         Test: fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html
139
140         * css/StyleInvalidationAnalysis.cpp:
141         (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded):
142
143             If we have ::slotted rules and encounter a <slot>, invalidate the slotted host children.
144
145         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
146
147             Invalidate the shadow host if we have ::host rules.
148
149         * css/StyleInvalidationAnalysis.h:
150         * dom/InlineStyleSheetOwner.cpp:
151         (WebCore::InlineStyleSheetOwner::createSheet):
152
153             Fix a bug where it was possible to mutate stylesheets in the inline stylesheet cache.
154             The included test covers this.
155
156         * style/StyleScope.cpp:
157         (WebCore::Style::Scope::updateActiveStyleSheets):
158
159             Handle the full invalidation case.
160
161 2016-11-11  Brady Eidson  <beidson@apple.com>
162
163         IndexedDB 2.0: "close pending flag" and firing blocked events all need fixing.
164         https://bugs.webkit.org/show_bug.cgi?id=164641
165
166         Reviewed by Alex Christensen.
167
168         No new tests (Covered by at least 3 existing tests).
169
170         * Modules/indexeddb/IDBDatabase.cpp:
171         (WebCore::IDBDatabase::close):
172         (WebCore::IDBDatabase::maybeCloseInServer):
173
174         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
175         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionPendingClose):
176         * Modules/indexeddb/client/IDBConnectionProxy.h:
177
178         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
179         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
180         * Modules/indexeddb/client/IDBConnectionToServer.h:
181         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
182
183         * Modules/indexeddb/server/IDBServer.cpp:
184         (WebCore::IDBServer::IDBServer::databaseConnectionPendingClose):
185         * Modules/indexeddb/server/IDBServer.h:
186
187         * Modules/indexeddb/server/ServerOpenDBRequest.cpp:
188         (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
189         (WebCore::IDBServer::ServerOpenDBRequest::notifyRequestBlocked): Deleted.
190         * Modules/indexeddb/server/ServerOpenDBRequest.h:
191         (WebCore::IDBServer::ServerOpenDBRequest::hasNotifiedBlocked): Deleted.
192
193         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
194         (WebCore::IDBServer::UniqueIDBDatabase::allConnectionsAreClosedOrClosing):
195         (WebCore::IDBServer::UniqueIDBDatabase::maybeNotifyConnectionsOfVersionChange):
196         (WebCore::IDBServer::UniqueIDBDatabase::notifyCurrentRequestConnectionClosedOrFiredVersionChangeEvent):
197         * Modules/indexeddb/server/UniqueIDBDatabase.h:
198
199         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
200         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionPendingCloseFromClient):
201         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
202         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionIsClosing):
203         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
204
205         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
206         (WebCore::InProcessIDBServer::databaseConnectionPendingClose):
207         * Modules/indexeddb/shared/InProcessIDBServer.h:
208
209 2016-11-11  Dave Hyatt  <hyatt@apple.com>
210
211         [CSS Parser] Fix time unit parsing
212         https://bugs.webkit.org/show_bug.cgi?id=164649
213
214         Reviewed by Dean Jackson.
215         
216         Make sure that a unitless value gets changed to milliseconds properly.
217
218         * css/parser/CSSPropertyParserHelpers.cpp:
219         (WebCore::CSSPropertyParserHelpers::consumeTime):
220
221 2016-11-11  Keith Rollin  <krollin@apple.com>
222
223         Reduce number of platformMemoryUsage calls
224         https://bugs.webkit.org/show_bug.cgi?id=164375
225
226         Reviewed by Andreas Kling.
227
228         platformMemoryUsage was being called all the time while logging the
229         results of various memory-purging operations. This logging is
230         subordinate to the needs of performance and so can be removed.
231         Behavior is now as follows:
232
233         - If memory-pressure relief logging is enabled, logging includes
234         memory usage information. On Cocoa, this logging is disabled by
235         default but can be enabled by setting LogMemoryJetsamDetails in
236         `defaults`.
237         - Otherwise, if release-logging is enabled (as it is on Cocoa),
238         abbreviated memory pressure relief logging is performed: the logging
239         lines are printed but without any memory usage information.
240         - Otherwise, no logging is performed.
241
242         No new tests -- no tests for logging.
243
244         * platform/MemoryPressureHandler.cpp:
245         (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
246         * platform/MemoryPressureHandler.h:
247         (WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger):
248         (WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
249
250 2016-11-11  Eric Carlson  <eric.carlson@apple.com>
251
252         [MediaStream] defer resolution of getUserMedia promise made in a background tab
253         https://bugs.webkit.org/show_bug.cgi?id=164643
254         <rdar://problem/29048317>
255
256         Reviewed by Brady Eidson.
257
258         Test: fast/mediastream/get-user-media-background-tab.html
259
260         Do not start producing data when the document does not allow media
261         to start playing. Instead, register with the document for a callback 
262         when playback is allowed and start then.
263         * Modules/mediastream/MediaStream.cpp:
264         (WebCore::MediaStream::~MediaStream):
265         (WebCore::MediaStream::mediaCanStart):
266         (WebCore::MediaStream::startProducingData):
267         (WebCore::MediaStream::stopProducingData):
268         (WebCore::MediaStream::pageMutedStateDidChange):
269         * Modules/mediastream/MediaStream.h:
270
271         * Modules/webaudio/AudioContext.cpp:
272         (WebCore::AudioContext::mediaCanStart): Deal with API change.
273         * Modules/webaudio/AudioContext.h:
274
275         * html/HTMLMediaElement.cpp:
276         (WebCore::HTMLMediaElement::mediaCanStart): Ditto.
277         * html/HTMLMediaElement.h:
278         * page/MediaCanStartListener.h:
279
280         * page/Page.cpp:
281         (WebCore::Page::takeAnyMediaCanStartListener): Return the listener and document.
282         (WebCore::Page::setCanStartMedia): Pass the document to the listener.
283         * page/Page.h:
284
285 2016-11-11  Zalan Bujtas  <zalan@apple.com>
286
287         RenderFlowThread's containing block cache should be invalidated before calling styleDidChange.
288         https://bugs.webkit.org/show_bug.cgi?id=164646
289
290         Reviewed by Simon Fraser.
291
292         We have to invalidate the containing block cache for RenderFlowThreads soon after the containing block context
293         changes. Invalidating it in RenderBlock::styleDidChange is too late since we might run some code in some
294         of the subclasses that use this stale containing block cache.  
295
296         No known behaviour change.
297
298         * rendering/RenderBlock.cpp:
299         (WebCore::RenderBlock::styleDidChange): This change could trigger double invalidation.
300         However running this code twice shouldn't impact performance greatly.
301         (WebCore::RenderBlock::resetFlowThreadContainingBlockAndChildInfoIncludingDescendants):
302         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
303         * rendering/RenderBlock.h:
304         * rendering/RenderElement.cpp:
305         (WebCore::RenderElement::setStyle): We don't need to call the invalidation from initializeStyle(), since
306         we don't yet have cache at that point.
307         * rendering/RenderInline.cpp:
308         (WebCore::RenderInline::splitInlines):
309
310 2016-11-11  Darin Adler  <darin@apple.com>
311
312         Move Node from ExceptionCode to ExceptionOr
313         https://bugs.webkit.org/show_bug.cgi?id=164515
314
315         Reviewed by Sam Weinig.
316
317         * bindings/js/JSHTMLSelectElementCustom.cpp:
318         (WebCore::selectElementIndexSetter): Call remove instead of removeByIndex.
319         Was renamed now that there is no conflict.
320
321         * bindings/js/JSNodeCustom.cpp:
322         (WebCore::JSNode::insertBefore): Use ExceptionOr.
323         (WebCore::JSNode::replaceChild): Ditto.
324         (WebCore::JSNode::removeChild): Ditto.
325         (WebCore::JSNode::appendChild): Ditto.
326
327         * dom/Attr.cpp:
328         (WebCore::Attr::Attr): Take a reference.
329         (WebCore::Attr::create): Ditto.
330         (WebCore::Attr::createTextChild): Use a Ref.
331         (WebCore::Attr::setPrefix): Use ExceptionOr.
332         (WebCore::Attr::setNodeValue): Ditto.
333         (WebCore::Attr::attachToElement): Take a reference.
334         * dom/Attr.h: Updated for above. Also made setPrefix private.
335
336         * dom/CharacterData.cpp:
337         (WebCore::CharacterData::setNodeValue): Use ExceptionOr.
338         * dom/CharacterData.h: Updated for the above.
339
340         * dom/ContainerNode.cpp:
341         (WebCore::collectChildrenAndRemoveFromOldParent): Use ExceptionOr.
342         (WebCore::checkAcceptChild): Ditto.
343         (WebCore::checkAcceptChildGuaranteedNodeTypes): Ditto.
344         (WebCore::ContainerNode::ensurePreInsertionValidity): Ditto.
345         (WebCore::checkPreReplacementValidity): Ditto.
346         (WebCore::ContainerNode::insertBefore): Ditto.
347         (WebCore::ContainerNode::replaceChild): Ditto.
348         (WebCore::ContainerNode::removeChild): Ditto.
349         (WebCore::ContainerNode::appendChild): Ditto.
350         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
351         (WebCore::ContainerNode::cloneChildNodes): Ditto.
352         (WebCore::ContainerNode::append): Ditto.
353         (WebCore::ContainerNode::prepend): Ditto.
354         * dom/ContainerNode.h: Updated for above changes.
355
356         * dom/Document.cpp:
357         (WebCore::Document::setTitle): Removed unneeded ASSERT_NO_EXCEPTION.
358         (WebCore::Document::setBodyOrFrameset): Removed unneeded ignored
359         exception code.
360
361         * dom/Element.cpp:
362         (WebCore::Element::setPrefix): Use ExceptionOr.
363         (WebCore::Element::setAttributeNode): Updated for changes to Attr.
364         (WebCore::Element::setAttributeNodeNS): Ditto.
365         (WebCore::Element::setOuterHTML): Use ExceptionOr.
366         (WebCore::Element::ensureAttr): Updated for changes to Attr.
367         (WebCore::Element::insertAdjacent): Use ExceptionOr.
368         * dom/Element.h: Updated for above.
369
370         * dom/Node.cpp:
371         (WebCore::Node::setNodeValue): Use ExceptionOr.
372         (WebCore::Node::insertBefore): Ditto.
373         (WebCore::Node::replaceChild): Ditto.
374         (WebCore::Node::removeChild): Ditto.
375         (WebCore::Node::appendChild): Ditto.
376         (WebCore::Node::convertNodesOrStringsIntoNode): Ditto.
377         (WebCore::Node::before): Ditto.
378         (WebCore::Node::after): Ditto.
379         (WebCore::Node::replaceWith): Ditto.
380         (WebCore::Node::remove): Ditto.
381         (WebCore::Node::cloneNodeForBindings): Ditto.
382         (WebCore::Node::setPrefix): Ditto.
383         (WebCore::Node::checkSetPrefix): Ditto.
384         (WebCore::Node::setTextContent): Ditto.
385         * dom/Node.h: Updated for above.
386         * dom/Node.idl: Use non-legacy exceptions.
387
388         * dom/Range.cpp:
389         (WebCore::Range::processContents): Use ExceptionOr.
390         (WebCore::processContentsBetweenOffsets): Ditto.
391         (WebCore::processNodes): Ditto.
392         (WebCore::processAncestorsAndTheirSiblings): Ditto.
393         (WebCore::Range::insertNode): Ditto.
394         (WebCore::Range::surroundContents): Ditto.
395
396         * dom/Text.cpp:
397         (WebCore::Text::splitText): Use ExceptionOr.
398         (WebCore::Text::replaceWholeText): Removed unneeded IGNORE_EXCEPTION.
399
400         * editing/AppendNodeCommand.cpp:
401         (WebCore::AppendNodeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
402         * editing/CompositeEditCommand.cpp:
403         (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt): Ditto.
404
405         * editing/EditorCommand.cpp:
406         (WebCore::executeInsertNode): Use ExceptionOr.
407
408         * editing/InsertNodeBeforeCommand.cpp:
409         (WebCore::InsertNodeBeforeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
410         * editing/MergeIdenticalElementsCommand.cpp:
411         (WebCore::MergeIdenticalElementsCommand::doApply): Ditto.
412         (WebCore::MergeIdenticalElementsCommand::doUnapply): Use ExceptionOr.
413
414         * editing/RemoveNodeCommand.cpp:
415         (WebCore::RemoveNodeCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
416         * editing/ReplaceNodeWithSpanCommand.cpp:
417         (WebCore::swapInNodePreservingAttributesAndChildren): Removed unneeded
418         ASSERT_NO_EXCEPTION.
419         * editing/ReplaceSelectionCommand.cpp:
420         (WebCore::ReplacementFragment::removeNode): Ditto.
421         (WebCore::ReplacementFragment::insertNodeBefore): Ditto.
422         (WebCore::ReplacementFragment::insertFragmentForTestRendering): Ditto.
423         (WebCore::ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment): Ditto.
424         (WebCore::ReplaceSelectionCommand::insertAsListItems): Ditto.
425
426         * editing/SplitElementCommand.cpp:
427         (WebCore::SplitElementCommand::executeApply): Use ExceptionOr.
428         (WebCore::SplitElementCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
429
430         * editing/SplitTextNodeCommand.cpp:
431         (WebCore::SplitTextNodeCommand::insertText1AndTrimText2): Use ExceptionOr.
432
433         * editing/WrapContentsInDummySpanCommand.cpp:
434         (WebCore::WrapContentsInDummySpanCommand::executeApply): Removed unneeded
435         IGNORE_EXCEPTION.
436         (WebCore::WrapContentsInDummySpanCommand::doUnapply): Ditto.
437
438         * editing/cocoa/EditorCocoa.mm:
439         (WebCore::Editor::styleForSelectionStart): Removed unneeded ASSERT_NO_EXCEPTION
440         and IGNORE_EXCEPTION.
441         * editing/htmlediting.cpp:
442         (WebCore::createTabSpanElement): Ditto.
443         * editing/markup.cpp:
444         (WebCore::fillContainerFromString): Ditto.
445         (WebCore::createFragmentFromText): Ditto.
446         (WebCore::removeElementFromFragmentPreservingChildren): Ditto.
447         (WebCore::replaceChildrenWithFragment): Use ExceptionOr.
448         (WebCore::replaceChildrenWithText): Ditto.
449
450         * editing/ios/EditorIOS.mm:
451         (WebCore::Editor::WebContentReader::addFragment): Removed unneeded exception
452         ignoring code.
453         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
454         (WebCore::Editor::setTextAsChildOfElement): Ditto.
455
456         * html/ColorInputType.cpp:
457         (WebCore::ColorInputType::createShadowSubtree): Removed unneeded
458         ASSERT_NO_EXCEPTION.
459
460         * html/FTPDirectoryDocument.cpp:
461         (WebCore::FTPDirectoryDocumentParser::appendEntry): Removed unneeded
462         IGNORE_EXCEPTION.
463         (WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
464         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
465         (WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.
466         * html/FileInputType.cpp:
467         (WebCore::FileInputType::createShadowSubtree): Ditto.
468
469         * html/HTMLAnchorElement.cpp:
470         (WebCore::HTMLAnchorElement::setText): Removed unneeded ASSERT_NO_EXCEPTION.
471         * html/HTMLDetailsElement.cpp:
472         (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot): Ditto.
473
474         * html/HTMLElement.cpp:
475         (WebCore::HTMLElement::textToFragment): Use ExceptionOr.
476         (WebCore::HTMLElement::setOuterText): Ditto.
477
478         * html/HTMLKeygenElement.cpp:
479         (WebCore::HTMLKeygenElement::HTMLKeygenElement): Removed unneeded
480         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
481         * html/HTMLMediaElement.cpp:
482         (WebCore::HTMLMediaElement::createMediaControls): Ditto.
483         * html/HTMLMeterElement.cpp:
484         (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot): Ditto.
485         * html/HTMLOptionElement.cpp:
486         (WebCore::HTMLOptionElement::createForJSConstructor): Use ExceptionOr.
487         (WebCore::HTMLOptionElement::setText): Removed unneeded
488         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
489
490         * html/HTMLOptionsCollection.cpp:
491         (WebCore::HTMLOptionsCollection::remove): Call remove, not removeByIndex,
492         since we were able to change the name.
493
494         * html/HTMLOutputElement.cpp:
495         (WebCore::HTMLOutputElement::setTextContentInternal): Removed unneeded
496         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
497         * html/HTMLProgressElement.cpp:
498         (WebCore::HTMLProgressElement::didAddUserAgentShadowRoot): Ditto.
499         * html/HTMLScriptElement.cpp:
500         (WebCore::HTMLScriptElement::setText): Ditto.
501
502         * html/HTMLSelectElement.cpp:
503         (WebCore::HTMLSelectElement::add): Use ExceptionOr.
504         (WebCore::HTMLSelectElement::remove): Renamed from removeByIndex since
505         there is no conflict with remove any more.
506         (WebCore::HTMLSelectElement::setOption): Call remove.
507         * html/HTMLSelectElement.h: Updated for above.
508         * html/HTMLSelectElement.idl: Got rid of ImplementedAs=removeByIndex.
509
510         * html/HTMLSummaryElement.cpp:
511         (WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot): Removed unneeded
512         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
513         * html/HTMLTableElement.cpp:
514         (WebCore::HTMLTableElement::HTMLTableElement): Initialize data members in
515         class definition instead of here.
516         (WebCore::HTMLTableElement::caption): Simplified using childrenOfType.
517         (WebCore::HTMLTableElement::setCaption): Use ExceptionOr.
518         (WebCore::HTMLTableElement::setTHead): Ditto.
519         (WebCore::HTMLTableElement::setTFoot): Ditto.
520         (WebCore::HTMLTableElement::deleteTFoot): Removed unneeded ASSERT_NO_EXCEPTION
521         and IGNORE_EXCEPTION.
522         (WebCore::HTMLTableElement::createTBody): Ditto.
523         (WebCore::HTMLTableElement::deleteCaption): Ditto.
524         (WebCore::HTMLTableElement::insertRow): Use ExceptionOr.
525         * html/HTMLTableElement.h: Updated for above.
526
527         * html/HTMLTableRowElement.cpp:
528         (WebCore::HTMLTableRowElement::insertCell): Use ExceptionOr.
529         (WebCore::HTMLTableRowElement::deleteCell): Ditto.
530         * html/HTMLTableSectionElement.cpp:
531         (WebCore::HTMLTableSectionElement::insertRow): Ditto.
532         (WebCore::HTMLTableSectionElement::deleteRow): Ditto.
533
534         * html/HTMLTextAreaElement.cpp:
535         (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Removed unneeded
536         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
537         (WebCore::HTMLTextAreaElement::setDefaultValue): Ditto.
538         (WebCore::HTMLTextAreaElement::updatePlaceholderText): Ditto.
539         * html/HTMLTextFormControlElement.cpp:
540         (WebCore::HTMLTextFormControlElement::setInnerTextValue): Ditto.
541         * html/HTMLTitleElement.cpp:
542         (WebCore::HTMLTitleElement::setText): Ditto.
543         * html/MediaDocument.cpp:
544         (WebCore::MediaDocumentParser::createDocumentStructure): Ditto.
545         (WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
546         * html/PluginDocument.cpp:
547         (WebCore::PluginDocumentParser::createDocumentStructure): Ditto.
548         * html/RangeInputType.cpp:
549         (WebCore::RangeInputType::createShadowSubtree): Ditto.
550         * html/SearchInputType.cpp:
551         (WebCore::SearchInputType::createShadowSubtree): Ditto.
552         * html/TextFieldInputType.cpp:
553         (WebCore::TextFieldInputType::createShadowSubtree): Ditto.
554         (WebCore::TextFieldInputType::updatePlaceholderText): Ditto.
555         (WebCore::TextFieldInputType::createContainer): Ditto.
556         (WebCore::TextFieldInputType::createAutoFillButton): Ditto.
557         * html/ValidationMessage.cpp:
558         (WebCore::ValidationMessage::setMessageDOMAndStartTimer): Ditto.
559         (WebCore::ValidationMessage::buildBubbleTree): Ditto.
560         (WebCore::ValidationMessage::deleteBubbleTree): Ditto.
561         * html/shadow/MediaControlElements.cpp:
562         (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.
563         * html/shadow/MediaControls.cpp:
564         (WebCore::MediaControls::createTextTrackDisplay): Ditto.
565
566         * html/shadow/MediaControlsApple.cpp:
567         (WebCore::MediaControlsApple::MediaControlsApple): Initialize data members
568         in class definition instead of here.
569         (WebCore::MediaControlsApple::tryCreateControls): Use ExceptionOr.
570         * html/shadow/MediaControlsApple.h: Updated for above.
571
572         * html/track/VTTCue.cpp:
573         (WebCore::VTTCue::copyWebVTTNodeToDOMTree): Removed unneeded ASSERT_NO_EXCEPTION
574         and IGNORE_EXCEPTION.
575         (WebCore::VTTCue::getDisplayTree): Ditto.
576         * html/track/VTTRegion.cpp:
577         (WebCore::VTTRegion::appendTextTrackCueBox): Ditto.
578
579         * inspector/DOMEditor.cpp: Use ExceptionOr in action classes.
580         (WebCore::DOMEditor::DOMEditor): Take a reference.
581         (WebCore::DOMEditor::insertBefore): Use ExceptionOr.
582         (WebCore::DOMEditor::removeChild): Ditto.
583         (WebCore::DOMEditor::setAttribute): Ditto.
584         (WebCore::DOMEditor::removeAttribute): Ditto.
585         (WebCore::DOMEditor::setOuterHTML): Ditto.
586         (WebCore::DOMEditor::replaceWholeText): Ditto.
587         (WebCore::DOMEditor::replaceChild): Ditto.
588         (WebCore::DOMEditor::setNodeValue): Ditto.
589         (WebCore::populateErrorString): Ditto.
590         * inspector/DOMEditor.h: Updated for above changes.
591
592         * inspector/DOMPatchSupport.cpp:
593         (WebCore::DOMPatchSupport::patchDocument): Updated to use references,
594         to use ExceptionOr, and to use a struct without a constructor for Digest.
595         (WebCore::DOMPatchSupport::DOMPatchSupport): Ditto.
596         (WebCore::DOMPatchSupport::patchNode): Ditto.
597         (WebCore::DOMPatchSupport::innerPatchNode): Ditto.
598         (WebCore::DOMPatchSupport::diff): Ditto.
599         (WebCore::DOMPatchSupport::innerPatchChildren): Ditto.
600         (WebCore::DOMPatchSupport::createDigest): Ditto.
601         (WebCore::DOMPatchSupport::insertBeforeAndMarkAsUsed): Ditto.
602         (WebCore::DOMPatchSupport::removeChildAndMoveToNew): Ditto.
603         (WebCore::DOMPatchSupport::markNodeAsUsed): Ditto.
604         * inspector/DOMPatchSupport.h: Updated for above.
605
606         * inspector/InspectorCSSAgent.cpp: Use ExceptionOr in the action classes.
607         (WebCore::InspectorCSSAgent::getStyleSheetText): Use ExceptionOr.
608         (WebCore::InspectorCSSAgent::setStyleSheetText): Ditto.
609         (WebCore::InspectorCSSAgent::setStyleText): Ditto.
610         (WebCore::InspectorCSSAgent::setRuleSelector): Ditto.
611         (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.
612         (WebCore::InspectorCSSAgent::addRule): Ditto.
613         * inspector/InspectorDOMAgent.cpp:
614         (WebCore::InspectorDOMAgent::didCreateFrontendAndBackend): Ditto.
615         (WebCore::InspectorDOMAgent::setAttributeValue): Ditto.
616         (WebCore::InspectorDOMAgent::setAttributesAsText): Ditto.
617         (WebCore::InspectorDOMAgent::removeAttribute): Ditto.
618         (WebCore::InspectorDOMAgent::setOuterHTML): Ditto.
619         (WebCore::InspectorDOMAgent::setNodeValue): Ditto.
620         (WebCore::InspectorDOMAgent::undo): Ditto.
621         (WebCore::InspectorDOMAgent::redo): Ditto.
622
623         * inspector/InspectorHistory.cpp:
624         (WebCore::InspectorHistory::Action::Action): Moved to header.
625         (WebCore::InspectorHistory::Action::~Action): Ditto.
626         (WebCore::InspectorHistory::Action::toString): Ditto.
627         (WebCore::InspectorHistory::Action::isUndoableStateMark): Ditto.
628         (WebCore::InspectorHistory::Action::mergeId): Ditto.
629         (WebCore::InspectorHistory::Action::merge): Ditto.
630         (WebCore::InspectorHistory::InspectorHistory): Deleted.
631         (WebCore::InspectorHistory::~InspectorHistory): Deleted.
632         (WebCore::InspectorHistory::perform): Updated exception handling.
633         (WebCore::InspectorHistory::markUndoableState): Ditto.
634         (WebCore::InspectorHistory::undo): Ditto.
635         (WebCore::InspectorHistory::redo): Ditto.
636         * inspector/InspectorHistory.h: Updated for above.
637
638         * inspector/InspectorPageAgent.cpp:
639         (WebCore::InspectorPageAgent::setDocumentContent): Use reference.
640
641         * inspector/InspectorStyleSheet.cpp:
642         (WebCore::InspectorStyle::text): Use ExceptionOr and renamed from
643         getText since this now has a return value.
644         (WebCore::InspectorStyle::populateAllProperties): Updated for above.
645         (WebCore::InspectorStyle::setText): Use ExceptionOr.
646         (WebCore::InspectorStyleSheet::setText): Ditto.
647         (WebCore::InspectorStyleSheet::ruleSelector): Ditto.
648         (WebCore::InspectorStyleSheet::setRuleSelector): Ditto.
649         (WebCore::InspectorStyleSheet::addRule): Ditto.
650         (WebCore::InspectorStyleSheet::deleteRule): Ditto.
651         (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): Ditto.
652         (WebCore::InspectorStyleSheet::buildObjectForStyle): Ditto.
653         (WebCore::InspectorStyleSheet::setStyleText): Ditto.
654         (WebCore::InspectorStyleSheet::text): Use ExceptionOr and renamed.
655         (WebCore::InspectorStyleSheet::checkPageStyleSheet): Deleted.
656         Just wrote this code inline in each place this was called since it's
657         just a single null check.
658         (WebCore::InspectorStyleSheetForInlineStyle::text): Use ExceptionOr
659         and renamed.
660         (WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Ditto.
661         (WebCore::InspectorStyle::getText): Deleted.
662         * inspector/InspectorStyleSheet.h: Updated for above changes.
663
664         * page/DragController.cpp:
665         (WebCore::documentFragmentFromDragData): Removed unneeded
666         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
667         * page/ios/FrameIOS.mm:
668         (WebCore::Frame::initWithSimpleHTMLDocument): Ditto.
669         * svg/SVGTRefElement.cpp:
670         (WebCore::SVGTRefElement::updateReferencedText): Ditto.
671         (WebCore::SVGTRefElement::detachTarget): Ditto.
672         * xml/XMLTreeViewer.cpp:
673         (WebCore::XMLTreeViewer::transformDocumentToTreeView): Ditto.
674
675 2016-11-10  Jiewen Tan  <jiewen_tan@apple.com>
676
677         Rename CryptoKeyUsage to CryptoKeyUsageBitmap and CryptoKey::Usage to CryptoKeyUsage
678         https://bugs.webkit.org/show_bug.cgi?id=164624
679         <rdar://problem/29210140>
680
681         Reviewed by Brent Fulgham.
682
683         This patch allows IDLType CryptoKeyUsage to be shared among different IDLs, i.e. CryptoKey.idl,
684         SubtleCrypto.idl and JsonWebKey.idl such that it can simplify the customized binding codes.
685
686         Covered by existing tests.
687
688         * CMakeLists.txt:
689         * DerivedSources.make:
690         * WebCore.xcodeproj/project.pbxproj:
691         * bindings/js/JSCryptoKeySerializationJWK.cpp:
692         * bindings/js/JSCryptoKeySerializationJWK.h:
693         * bindings/js/JSSubtleCryptoCustom.cpp:
694         (WebCore::toCryptoKeyUsageBitmap):
695         (WebCore::cryptoKeyUsageBitmapFromJSValue):
696         (WebCore::toKeyData):
697         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
698         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
699         (WebCore::cryptoKeyUsageFromString): Deleted.
700         (WebCore::cryptoKeyUsagesFromJSValue): Deleted.
701         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
702         * bindings/js/SerializedScriptValue.cpp:
703         * crypto/CryptoAlgorithm.cpp:
704         * crypto/CryptoAlgorithm.h:
705         * crypto/CryptoKey.cpp:
706         * crypto/CryptoKey.h:
707         * crypto/CryptoKey.idl:
708         * crypto/CryptoKeySerialization.h:
709         * crypto/CryptoKeyUsage.h:
710         * crypto/CryptoKeyUsage.idl: Added.
711         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
712         * crypto/JsonWebKey.h:
713         * crypto/JsonWebKey.idl:
714         * crypto/SubtleCrypto.idl:
715         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
716         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
717         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
718         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
719         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
720         * crypto/algorithms/CryptoAlgorithmHMAC.h:
721         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
722         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
723         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
724         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
725         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
726         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
727         * crypto/keys/CryptoKeyAES.cpp:
728         * crypto/keys/CryptoKeyAES.h:
729         * crypto/keys/CryptoKeyHMAC.cpp:
730         * crypto/keys/CryptoKeyHMAC.h:
731         * crypto/keys/CryptoKeyRSA.cpp:
732         * crypto/keys/CryptoKeyRSA.h:
733         * crypto/keys/CryptoKeySerializationRaw.cpp:
734         * crypto/keys/CryptoKeySerializationRaw.h:
735         * crypto/mac/CryptoKeyRSAMac.cpp:
736
737 2016-11-11  Dave Hyatt  <hyatt@apple.com>
738
739         [CSS Parser] Fix basic shape parsing
740         https://bugs.webkit.org/show_bug.cgi?id=164645
741
742         Reviewed by Dean Jackson.
743
744         * css/parser/CSSPropertyParser.cpp:
745         (WebCore::consumeBasicShape):
746
747 2016-11-11  Zalan Bujtas  <zalan@apple.com>
748
749         RenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMap::remove
750         https://bugs.webkit.org/show_bug.cgi?id=164639
751
752         Reviewed by Simon Fraser.
753
754         Also instead of asserting that the incoming renderer is not nullptr, we could just pass a reference in. 
755
756         No change in functionality.
757
758         * rendering/RenderBlock.cpp:
759         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
760         (WebCore::canComputeRegionRangeForBox):
761         (WebCore::RenderBlock::computeRegionRangeForBoxChild):
762         (WebCore::RenderBlock::estimateRegionRangeForBoxChild):
763         (WebCore::RenderBlock::updateRegionRangeForBoxChild):
764         * rendering/RenderBox.cpp:
765         (WebCore::RenderBox::hasRegionRangeInFlowThread):
766         * rendering/RenderElement.cpp:
767         (WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
768         * rendering/RenderFlowThread.cpp:
769         (WebCore::RenderFlowThread::removeFlowChildInfo):
770         (WebCore::RenderFlowThread::validateRegions):
771         (WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
772         (WebCore::RenderFlowThread::removeLineRegionInfo):
773         (WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
774         (WebCore::RenderFlowThread::setRegionRangeForBox):
775         (WebCore::RenderFlowThread::hasCachedRegionRangeForBox):
776         (WebCore::RenderFlowThread::computedRegionRangeForBox):
777         (WebCore::RenderFlowThread::checkLinesConsistency):
778         * rendering/RenderFlowThread.h:
779         * rendering/RenderMultiColumnFlowThread.cpp:
780         (WebCore::RenderMultiColumnFlowThread::setRegionRangeForBox):
781         * rendering/RenderMultiColumnFlowThread.h:
782         * rendering/RenderNamedFlowFragment.cpp:
783         (WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
784         * rendering/RenderNamedFlowFragment.h:
785         * rendering/RenderNamedFlowThread.cpp:
786         (WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
787         (WebCore::RenderNamedFlowThread::removeFlowChildInfo):
788         * rendering/RenderNamedFlowThread.h:
789         * rendering/RenderRegion.cpp:
790         (WebCore::RenderRegion::removeRenderBoxRegionInfo):
791         * rendering/RenderRegion.h:
792
793 2016-11-11  Megan Gardner  <megan_gardner@apple.com>
794
795         [Cocoa] Support wide gamut for Drag Image UI
796         https://bugs.webkit.org/show_bug.cgi?id=164490
797
798         Reviewed by Tim Horton.
799
800         Fixed an error in the support define for wide gamut on Mac.
801
802         The testing infrastructure to test this does not exist, and will be landing in another patch.
803
804         * platform/graphics/cg/GraphicsContextCG.cpp:
805         (WebCore::extendedSRGBColorSpaceRef):
806
807 2016-11-11  Beth Dakin  <bdakin@apple.com>
808
809         Get touch bar code building for open source builds
810         https://bugs.webkit.org/show_bug.cgi?id=164610
811
812         Reviewed by Wenson Hsieh.
813
814         * config.h:
815
816 2016-11-11  Dave Hyatt  <hyatt@apple.com>
817
818         [CSS Parser] Fix SVG markers and colors
819         https://bugs.webkit.org/show_bug.cgi?id=164640
820
821         Reviewed by Dean Jackson.
822
823         * css/StyleBuilderConverter.h:
824         (WebCore::StyleBuilderConverter::convertSVGColor):
825         * css/parser/CSSPropertyParser.cpp:
826         (WebCore::CSSPropertyParser::parseShorthand):
827
828 2016-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
829
830         Composition state should be cleared when changing focus to a non-editable element
831         https://bugs.webkit.org/show_bug.cgi?id=164595
832         <rdar://problem/26412551>
833
834         Reviewed by Enrica Casucci.
835
836         When canceling or confirming a composition, always ensure that the composition node and composition underlines
837         being tracked are reset, even when there is no current selection. This prevents us from getting into a bad state
838         where focus has already changed from an element with a pending composition to a different element and the
839         composition is canceled, but the Editor still maintains its composition node.
840
841         Test: editing/input/focus-change-with-marked-text.html
842
843         * editing/Editor.cpp:
844         (WebCore::Editor::setComposition):
845
846 2016-11-11  Dave Hyatt  <hyatt@apple.com>
847
848         [CSS Parser] Support -webkit-svg-shadow
849         https://bugs.webkit.org/show_bug.cgi?id=164637
850
851         Reviewed by Zalan Bujtas.
852
853         * css/parser/CSSPropertyParser.cpp:
854         (WebCore::CSSPropertyParser::parseSingleValue):
855
856 2016-11-11  Alejandro G. Castro  <alex@igalia.com>
857
858         [WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend in the UI process
859         https://bugs.webkit.org/show_bug.cgi?id=164010
860
861         Reviewed by Philippe Normand.
862
863         Move the capture of the sources for the OWR backend to the
864         WebProcess. In the UI we continue checking if the user allows
865         access to the audio and video capture. When device handling is
866         added in the future we will need some persistent ID and API to
867         pass from the UI process to the Web process.
868
869         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
870         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
871         Add the proper audio and video sources to allow the UI message to
872         be properly rendered. We are adding the specific devices, even
873         though the dialog just asks for general audio and video. There was
874         already a FIXME about improving this.
875         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): We are
876         capturing the devices here when the allowed message arrived from
877         the UI process. We store the completion handler to use it later
878         when the aync owr API finishes capture devices process.
879         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): We
880         now call the completion handler in this callback called when the
881         owr library finishes the capture of the devices. Now this happens
882         in the WebProcess for OWR port.
883         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
884         Add an attribute to store the completion handler.
885
886 2016-11-11  Manuel Rego Casasnovas  <rego@igalia.com>
887
888         [css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
889         https://bugs.webkit.org/show_bug.cgi?id=163450
890
891         Reviewed by Darin Adler.
892
893         The issue is that in the test case a simplifiedLayout() is performed.
894         So in RenderGrid::layoutBlock() we early return and the grid is not populated,
895         so the m_gridIsDirty flag is not cleared when we try to check the size of the grid
896         in RenderGrid::layoutPositionedObject().
897
898         We should avoid to do a simplified layout if we have to layout
899         some positioned grid items and the grid is dirty.
900
901         The problem was not only the ASSERT, but the current behavior was wrong too.
902         As we didn't do a proper layout of the grid container, the positioned item
903         won't be placed on the expected position. Added tests verifying this.
904
905         Tests: fast/css-grid-layout/grid-positioned-item-dynamic-change.html
906                fast/css-grid-layout/grid-simplified-layout-positioned.html
907
908         * rendering/RenderBlock.cpp:
909         (WebCore::RenderBlock::canPerformSimplifiedLayout): Check if we can perform or not
910         a simplified layout.
911         (WebCore::RenderBlock::simplifiedLayout): Extract initial check
912         into canPerformSimplifiedLayout().
913         * rendering/RenderBlock.h: Add new header for canPerformSimplifiedLayout().
914         * rendering/RenderGrid.cpp: Implement our own version of canPerformSimplifiedLayout()
915         to verify that the grid is not dirty if we have to layout some positioned items.
916         (WebCore::RenderGrid::canPerformSimplifiedLayout):
917         * rendering/RenderGrid.h: Add canPerformSimplifiedLayout() header.
918
919 2016-11-11  Antoine Quint  <graouts@apple.com>
920
921         [Modern Media Controls] Media Controller: media tracks control support
922         https://bugs.webkit.org/show_bug.cgi?id=164618
923         <rdar://problem/27989483>
924
925         Reviewed by Dean Jackson.
926
927         We introduce the TracksSupport class to only enable the media tracks button
928         in the media controls when text tracks and/or multiple audio tracks are available.
929
930         Tests: media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html
931                media/modern-media-controls/tracks-support/tracks-support-no-tracks.html
932                media/modern-media-controls/tracks-support/tracks-support-text-tracks.html
933
934         * Modules/modern-media-controls/js-files:
935         * Modules/modern-media-controls/media/media-controller.js:
936         (MediaController.prototype._updateControlsIfNeeded):
937         * Modules/modern-media-controls/media/tracks-support.js: Added.
938         (TracksSupport):
939         (TracksSupport.prototype.destroy):
940         (TracksSupport.prototype.get control):
941         (TracksSupport.prototype.get mediaEvents):
942         (TracksSupport.prototype.buttonWasClicked):
943         (TracksSupport.prototype.syncControl):
944         * WebCore.xcodeproj/project.pbxproj:
945
946 2016-11-10  Yusuke Suzuki  <utatane.tea@gmail.com>
947
948         [DOMJIT] DOMJIT accessor attribute in IDL should say like DOMJIT=Getter
949         https://bugs.webkit.org/show_bug.cgi?id=164632
950
951         Reviewed by Sam Weinig.
952
953         Currently, DOMJIT patchpoint is only allowed for getter in attributes.
954         To make it explicit, we use IDL attribute DOMJIT=Getter instead of
955         DOMJIT.
956
957         * bindings/scripts/CodeGeneratorJS.pm:
958         (GenerateHeader):
959         (GenerateImplementation):
960         * bindings/scripts/IDLAttributes.txt:
961         * bindings/scripts/test/TestDOMJIT.idl:
962         * dom/Document.idl:
963         * dom/Node.idl:
964
965 2016-11-10  Sam Weinig  <sam@webkit.org>
966
967         [SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio
968         https://bugs.webkit.org/show_bug.cgi?id=164622
969
970         Reviewed by Darin Adler.
971
972         Part 2 of moving special casing of SVG out of the bindings.
973
974         * CMakeLists.txt:
975         * WebCore.xcodeproj/project.pbxproj:
976         Add new files.
977
978         * bindings/scripts/CodeGenerator.pm:
979         (GenerateCompileTimeCheckForEnumsIfNeeded):
980         * bindings/scripts/IDLAttributes.txt:
981         Allow specifying a different scope for the constants to be declared in.
982         This allows us to have only one copy of the constants in the implementation
983         of SVGAngle/SVGAngleValue and SVGPreserveAspectRatio/SVGPreserveAspectRatioValue.
984
985         * loader/FrameLoader.cpp:
986         * rendering/svg/RenderSVGImage.h:
987         Remove unnecessary #include.
988
989         * svg/SVGAngle.h:
990         Remove redundant enum declaration.
991
992         * svg/SVGAngle.idl:
993         Specify a ConstantsScope of SVGAngleValue.
994
995         * rendering/svg/RenderSVGImage.cpp:
996         (WebCore::RenderSVGImage::updateImageViewport):
997         * svg/PatternAttributes.h:
998         (WebCore::PatternAttributes::preserveAspectRatio):
999         (WebCore::PatternAttributes::setPreserveAspectRatio):
1000         * svg/SVGAnimatedPreserveAspectRatio.cpp:
1001         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
1002         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
1003         * svg/SVGAnimatedPreserveAspectRatio.h:
1004         * svg/SVGAnimatedType.cpp:
1005         (WebCore::SVGAnimatedType::createPreserveAspectRatio):
1006         * svg/SVGAnimatedType.h:
1007         (WebCore::SVGAnimatedType::preserveAspectRatio):
1008         * svg/SVGFEImageElement.cpp:
1009         (WebCore::SVGFEImageElement::parseAttribute):
1010         * svg/SVGFitToViewBox.cpp:
1011         (WebCore::SVGFitToViewBox::viewBoxToViewTransform):
1012         * svg/SVGFitToViewBox.h:
1013         (WebCore::SVGFitToViewBox::parseAttribute):
1014         * svg/SVGImageElement.cpp:
1015         (WebCore::SVGImageElement::parseAttribute):
1016         * svg/SVGViewSpec.cpp:
1017         (WebCore::SVGViewSpec::preserveAspectRatioString):
1018         (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
1019         (WebCore::SVGViewSpec::reset):
1020         (WebCore::SVGViewSpec::parseViewSpec):
1021         * svg/SVGViewSpec.h:
1022         * svg/graphics/SVGImage.cpp:
1023         (WebCore::SVGImage::computeIntrinsicDimensions):
1024         * svg/graphics/filters/SVGFEImage.cpp:
1025         (WebCore::FEImage::FEImage):
1026         (WebCore::FEImage::createWithImage):
1027         (WebCore::FEImage::createWithIRIReference):
1028         * svg/graphics/filters/SVGFEImage.h:
1029         Replace SVGPreserveAspectRatio usage with SVGPreserveAspectRatioValue.
1030
1031         * svg/SVGPreserveAspectRatio.cpp: Removed.
1032         * svg/SVGPreserveAspectRatio.h: Replaced.
1033         * svg/SVGPreserveAspectRatio.idl:
1034         * svg/SVGPreserveAspectRatioValue.cpp: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.cpp.
1035         * svg/SVGPreserveAspectRatioValue.h: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.h.
1036         Rename SVGPreserveAspectRatio to SVGPreserveAspectRatioValue and add a new SVGPreserveAspectRatio
1037         that acts as the binding object. 
1038
1039 2016-11-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1040
1041         [DOMJIT] Document#body should have DOMJIT patchpoint
1042         https://bugs.webkit.org/show_bug.cgi?id=164627
1043
1044         Reviewed by Darin Adler.
1045
1046         This patch implements document.body accessor. To implement it, we need,
1047
1048         1. DOM traversing ability from ASM.
1049         2. Checking HTMLElement.
1050         3. Checking HTMLElement's localName.
1051
1052         The above features are already implemented in CSSJIT.
1053         We extract some of utilities from CSSJIT to share them with DOMJIT.
1054
1055         Test: js/dom/domjit-accessor-document-body.html
1056
1057         * cssjit/SelectorCompiler.cpp:
1058         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElement):
1059         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToNextAdjacentElement):
1060         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToPreviousAdjacentElement):
1061         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
1062         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching):
1063         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
1064         (WebCore::SelectorCompiler::jumpIfElementIsNotEmpty):
1065         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName):
1066         (WebCore::SelectorCompiler::testIsElementFlagOnNode): Deleted.
1067         (WebCore::SelectorCompiler::testIsHTMLFlagOnNode): Deleted.
1068         * dom/Document.idl:
1069         * dom/Element.h:
1070         * dom/QualifiedName.h:
1071         * domjit/DOMJITAbstractHeapRepository.yaml:
1072         * domjit/DOMJITHelpers.h:
1073         (WebCore::DOMJIT::branchTestIsElementFlagOnNode):
1074         (WebCore::DOMJIT::branchTestIsHTMLFlagOnNode):
1075         * domjit/JSDocumentDOMJIT.cpp:
1076         (WebCore::DocumentBodyDOMJIT::checkDOM):
1077         (WebCore::loadLocalName):
1078         (WebCore::DocumentBodyDOMJIT::callDOMGetter):
1079
1080 2016-11-10  John Wilander  <wilander@apple.com>
1081
1082         Remove unused parameter name to fix build error on iOS
1083         https://bugs.webkit.org/show_bug.cgi?id=163468
1084
1085         No review.
1086
1087         No new tests.
1088
1089         * platform/ios/PasteboardIOS.mm:
1090         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1091             Removed parameter name 'pasteboardURL' in unimplemented function.
1092
1093 2016-11-10  Chris Dumez  <cdumez@apple.com>
1094
1095         Speed up HTMLInputElement validation
1096         https://bugs.webkit.org/show_bug.cgi?id=164603
1097
1098         Reviewed by Ryosuke Niwa.
1099
1100         Speed up HTMLInputElement validation by doing 1 virtual function call
1101         instead of 9 and calling HTMLInputElement::value() only once per
1102         validation instead of 9 times. Calling value() is expensive because
1103         of sanitization.
1104
1105         No new tests, no Web-exposed behavior change.
1106
1107         * html/BaseCheckableInputType.cpp:
1108         (WebCore::BaseCheckableInputType::fallbackValue):
1109         * html/FormAssociatedElement.cpp:
1110         (WebCore::FormAssociatedElement::isValid):
1111         * html/FormAssociatedElement.h:
1112         * html/HTMLFormControlElement.cpp:
1113         (WebCore::HTMLFormControlElement::isValidFormControlElement):
1114         (WebCore::HTMLFormControlElement::updateValidity):
1115         * html/HTMLInputElement.cpp:
1116         (WebCore::HTMLInputElement::isValid):
1117         (WebCore::HTMLInputElement::value):
1118         * html/HTMLInputElement.h:
1119         * html/TextFieldInputType.cpp:
1120         (WebCore::limitLength):
1121         * html/ValidityState.idl:
1122
1123 2016-11-10  John Wilander  <wilander@apple.com>
1124
1125         Add link information to data transfer pasteboard for drag and drop links
1126         https://bugs.webkit.org/show_bug.cgi?id=163468
1127         <rdar://problem/20634630>
1128
1129         Reviewed by Brent Fulgham.
1130
1131         Test: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
1132         This test ensures data transfers still work for types 'text' and 'url', i.e. that we don't
1133         regress in-page use of the drag pasteboard.
1134
1135         * page/DragController.cpp:
1136         (WebCore::DragController::startDrag):
1137             Now adds trustworthy link information to the drag pasteboard.
1138         * platform/Pasteboard.h:
1139             New function declaration Pasteboard::writeTrustworthyWebURLsPboardType.
1140         * platform/efl/PasteboardEfl.cpp:
1141         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1142             Empty, i.e. not implemented.
1143         * platform/gtk/PasteboardGtk.cpp:
1144         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1145             Empty, i.e. not implemented.
1146         * platform/ios/PasteboardIOS.mm:
1147         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1148             Calls ASSERT_NOT_REACHED() to make sure we don't use this function before we have
1149             decided on a trustrworthy URL pasteboard type on iOS. Currently not used since we
1150             don't support drag & drop on iOS.
1151         * platform/mac/PasteboardMac.mm:
1152         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1153             Writes the given URL to the WebURLsWithTitlesPboardType. This pasteboard type
1154             serves as a trusted drop source.
1155         * platform/win/PasteboardWin.cpp:
1156         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
1157             Empty, i.e. not implemented.
1158
1159 2016-11-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
1160
1161         REGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to CG when decoding a sub-sampled large image
1162         https://bugs.webkit.org/show_bug.cgi?id=164617
1163
1164         Reviewed by Tim Horton.
1165
1166         This covered by the test fast/images/image-subsampling.html but it should
1167         run with --guard-malloc --repeat-each=10 to show the bug or to verify the
1168         fix.
1169
1170         imageSourceOptions() returns a non static RetainPtr<CFDictionaryRef> if
1171         the subsamplingLevel is not zero. Because we are assigning the raw pointer
1172         to a local variable in ImageDecoder::createFrameImageAtIndex(), CFRelease()
1173         is called for the CFDictionaryRef immediately after this assignment. This
1174         causes its memory to be freed in this case even before calling CG.
1175
1176         This bug does not happen if the subsamplingLevel is zero because we cache
1177         the returned value in a static NeverDestroyed<RetainPtr<CFDictionaryRef> in
1178         imageSourceOptions(). This cache prevents the CFDictionaryRef from being
1179         freed in ImageDecoder::createFrameImageAtIndex() no matter where CFRelease()
1180         is called.
1181
1182         The fix is hold the returned value in a RetainPtr<CFDictionaryRef>. This
1183         will ensure the CFDictionaryRef raw pointer is valid till the end of
1184         ImageDecoder::createFrameImageAtIndex().
1185
1186         * platform/graphics/cg/ImageDecoderCG.cpp:
1187         (WebCore::ImageDecoder::createFrameImageAtIndex): Ensure the pointer is retained.
1188
1189 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
1190
1191         [Win][Direct2D] Add transparency layer support
1192         https://bugs.webkit.org/show_bug.cgi?id=164614
1193
1194         Reviewed by Dean Jackson.
1195
1196         Provide a stackable implementation of transparency layers so that
1197         multiple layers with opacity draw propery.
1198
1199         Tested by fast/layers/opacity-stacking.html and others.
1200
1201         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1202         (WebCore::GraphicsContext::platformContext): Remove unneeded assertion.
1203         (WebCore::GraphicsContextPlatformPrivate::renderTarget): Return current context taking
1204         into account the presence of transparency layers.
1205         (WebCore::GraphicsContextPlatformPrivate::setAlpha): Added.
1206         (WebCore::GraphicsContextPlatformPrivate::currentGlobalAlpha): Get current global
1207         alpha for current layer.
1208         (WebCore::GraphicsContext::colorWithGlobalAlpha): Compute proper color taking into
1209         account the current layer.
1210         (WebCore::drawWithShadowHelper): Helper function to share code.
1211         (WebCore::GraphicsContext::drawWithShadow): Use new helper function.
1212         (WebCore::GraphicsContextPlatformPrivate::beginTransparencyLayer): Added.
1213         (WebCore::GraphicsContext::beginPlatformTransparencyLayer): Call new implementation.
1214         (WebCore::GraphicsContextPlatformPrivate::endTransparencyLayer): Added.
1215         (WebCore::GraphicsContext::endPlatformTransparencyLayer): Call new implementation.
1216         (WebCore::GraphicsContext::clearRect): Clear to transparent color.
1217         (WebCore::GraphicsContext::setPlatformAlpha): Pass new alpha on to any active
1218         transparency layer.
1219         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
1220         (WebCore::GraphicsContextPlatformPrivate::renderTarget): Deleted.
1221
1222 2016-11-10  Dean Jackson  <dino@apple.com>
1223
1224         Add CSS Color Level 4 to features.
1225
1226         * features.json:
1227
1228 2016-11-10  Zalan Bujtas  <zalan@apple.com>
1229
1230         Move update image calls to RenderElement::styleDidChange.
1231         https://bugs.webkit.org/show_bug.cgi?id=164623
1232
1233         Reviewed by Simon Fraser.
1234
1235         There should be no dependency on the image update between ::styleWillChange and ::styleDidChange.
1236
1237         Covered by existing tests.
1238
1239         * rendering/RenderElement.cpp:
1240         (WebCore::RenderElement::initializeStyle):
1241         (WebCore::RenderElement::setStyle):
1242         (WebCore::RenderElement::styleDidChange):
1243
1244 2016-11-10  Joseph Pecoraro  <pecoraro@apple.com>
1245
1246         After r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
1247         https://bugs.webkit.org/show_bug.cgi?id=164621
1248
1249         Reviewed by Youenn Fablet.
1250
1251         * inspector/InspectorPageAgent.cpp:
1252         (WebCore::InspectorPageAgent::cachedResource):
1253         CachedResourceLoader expects a sanitized URL.
1254
1255 2016-11-10  Brady Eidson  <beidson@apple.com>
1256
1257         IndexedDB 2.0 Support the IDBDatabase.onclose event.
1258         https://bugs.webkit.org/show_bug.cgi?id=164602
1259
1260         Reviewed by Alex Christensen.
1261
1262         No new tests (Covered by existing tests).
1263
1264         * Modules/indexeddb/IDBDatabase.cpp:
1265         (WebCore::IDBDatabase::connectionToServerLost): Fire "onclose" after "onerror"
1266         * Modules/indexeddb/IDBDatabase.idl:
1267
1268 2016-11-10  Ryosuke Niwa  <rniwa@webkit.org>
1269
1270         Copied text would contain text inside CDATA sections and comments
1271         https://bugs.webkit.org/show_bug.cgi?id=164578
1272         <rdar://problem/19834542>
1273
1274         Reviewed by Darin Adler.
1275
1276         The bug was caused by HTMLConverter::_traverseNode always including the content of a Text node.
1277         Since Comment and CDataSection nodes are also Text nodes, we need to exclude them.
1278
1279         In the long term, we should check the visibility of the text as done in MarkupAccumulator.
1280
1281         Test: editing/mac/attributed-string/comment-cdata-section.html
1282
1283         * editing/cocoa/HTMLConverter.mm:
1284         (HTMLConverter::_traverseNode):
1285
1286 2016-11-10  Eric Carlson  <eric.carlson@apple.com>
1287
1288         [MediaStream] apply constraints passed to getUserMedia()
1289         https://bugs.webkit.org/show_bug.cgi?id=164561
1290
1291         Reviewed by Youenn Fablet.
1292         <rdar://problem/29191384>
1293
1294         No new tests, updated existing tests.
1295
1296         * Modules/mediastream/UserMediaRequest.cpp:
1297         (WebCore::UserMediaRequest::allow): Pass constraints into createMediaStream instead of applying
1298           them after the stream has been created.
1299
1300         * WebCore.xcodeproj/project.pbxproj: Remove MediaConstraintsMock.cpp/.h.
1301
1302         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1303         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Remove a bogus assert.
1304         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Drive-by fix: a stream
1305           that is receiving media data is as ready as it will ever be so it's readyState should be
1306           at HAVE_ENOUGH_DATA.
1307
1308         Simplify CaptureDeviceManager by removing all code for constraint validation because some
1309         constraints can't be validated without a live capture device. Ports that are able to resolve
1310         constraints without creating a live source can do so in a derived capture device class.
1311         * platform/mediastream/CaptureDeviceManager.cpp:
1312         (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Return a list of UIDs, not a list
1313           of live sources, because that is all the caller will use. This will allows ports to avoid
1314           source creation in some cases.
1315         (CaptureDeviceManager::sourceWithUID): Add parameters for new source constraints and invalid
1316           constraint.
1317         (CaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
1318         (CaptureDeviceManager::bestDeviceForFacingMode): Deleted.
1319         (facingModeFromString): Deleted.
1320         (CaptureDeviceManager::sessionSupportsConstraint): Deleted.
1321         (CaptureDeviceManager::isSupportedFrameRate): Deleted.
1322         * platform/mediastream/CaptureDeviceManager.h:
1323         (WebCore::CaptureDeviceManager::defaultCaptureSession): Deleted.
1324
1325         * platform/mediastream/MediaConstraints.cpp:
1326         (WebCore::FlattenedConstraint::find): New, make it possible to examine resolved constraints.
1327         * platform/mediastream/MediaConstraints.h:
1328         (WebCore::NumericConstraint::fitnessDistance): Reject invalid constraints.
1329         (WebCore::NumericConstraint::valueForCapabilityRange): New, resolve a constraint for a 
1330           capability range.
1331         (WebCore::MediaTrackConstraintSetMap::width): Expose constraints held in the map.
1332         (WebCore::MediaTrackConstraintSetMap::height):
1333         (WebCore::MediaTrackConstraintSetMap::sampleRate):
1334         (WebCore::MediaTrackConstraintSetMap::sampleSize):
1335         (WebCore::MediaTrackConstraintSetMap::aspectRatio):
1336         (WebCore::MediaTrackConstraintSetMap::frameRate):
1337         (WebCore::MediaTrackConstraintSetMap::volume):
1338         (WebCore::MediaTrackConstraintSetMap::echoCancellation):
1339         (WebCore::MediaTrackConstraintSetMap::facingMode):
1340         (WebCore::MediaTrackConstraintSetMap::deviceId):
1341         (WebCore::MediaTrackConstraintSetMap::groupId):
1342
1343         Resolve and apply width, height, and frameRate all at once because the ability to support
1344         one may depend on the value of another.
1345         * platform/mediastream/RealtimeMediaSource.cpp:
1346         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): 
1347         (WebCore::applyNumericConstraint): Move the guts of the logic into valueForCapabilityRange.
1348         (WebCore::RealtimeMediaSource::applySizeAndFrameRate):
1349         (WebCore::RealtimeMediaSource::selectSettings):
1350         (WebCore::RealtimeMediaSource::supportsConstraints):
1351         (WebCore::RealtimeMediaSource::applyConstraints): Support null success/failure lambdas.
1352         * platform/mediastream/RealtimeMediaSource.h:
1353
1354         * platform/mediastream/RealtimeMediaSourceCenter.h:
1355         * platform/mediastream/mac/AVAudioCaptureSource.h:
1356         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1357         (WebCore::AVAudioCaptureSource::create): Add parameter for creation constraints.
1358         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource): Ditto.
1359
1360         Remove all constraint validation code, it is done by the audio and video capture sources. Add
1361         support for stream creation constraints.
1362         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1363         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1364         (WebCore::AVCaptureDeviceManager::captureDeviceList):
1365         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
1366         (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
1367         (WebCore::AVCaptureDeviceManager::sourceWithUID): Deleted.
1368         (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
1369         (WebCore::AVCaptureDeviceManager::defaultCaptureSession): Deleted.
1370         (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Deleted.
1371         (WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Deleted.
1372         (WebCore::AVCaptureDeviceManager::supportedConstraints): Deleted.
1373
1374         * platform/mediastream/mac/AVMediaCaptureSource.h:
1375         (WebCore::AVMediaCaptureSource::constraints): Deleted.
1376         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1377         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
1378         (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource):
1379         (WebCore::AVMediaCaptureSource::startProducingData):
1380         (WebCore::AVMediaCaptureSource::stopProducingData):
1381         (WebCore::AVMediaCaptureSource::beginConfiguration):
1382         (WebCore::AVMediaCaptureSource::commitConfiguration):
1383         (WebCore::AVMediaCaptureSource::capabilities):
1384         (WebCore::AVMediaCaptureSource::setupSession):
1385         (WebCore::AVMediaCaptureSource::reset):
1386
1387         Validate and apply constraints, support source creation constraints, initialize capabilities
1388         and supported constraints by examining device capabilities.
1389         * platform/mediastream/mac/AVVideoCaptureSource.h:
1390         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1391         (WebCore::AVVideoCaptureSource::create):
1392         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
1393         (WebCore::updateSizeMinMax):
1394         (WebCore::updateAspectRatioMinMax):
1395         (WebCore::AVVideoCaptureSource::initializeCapabilities):
1396         (WebCore::AVVideoCaptureSource::initializeSupportedConstraints):
1397         (WebCore::AVVideoCaptureSource::applySize):
1398         (WebCore::AVVideoCaptureSource::setPreset):
1399         (WebCore::AVVideoCaptureSource::applyFrameRate):
1400         (WebCore::AVVideoCaptureSource::applySizeAndFrameRate):
1401         (WebCore::AVVideoCaptureSource::setupCaptureSession):
1402         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
1403         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions):
1404         (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate):
1405
1406         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1407         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1408         (WebCore::MockRealtimeVideoSource::create): Apply creation constraints, return null if they
1409           can not be applied successfully.
1410         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
1411         (WebCore::MockRealtimeVideoSource::createMuted):
1412
1413         Update RealtimeMediaSourceCenters for API changes.
1414         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1415         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
1416         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
1417         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1418         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1419         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
1420         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
1421         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
1422         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
1423
1424         Mock media sources support constraint validation and application directly so "mock constraints"
1425         are no longer necessary.
1426         * platform/mock/MediaConstraintsMock.cpp: Removed.
1427         * platform/mock/MediaConstraintsMock.h: Removed.
1428         * platform/mock/MockRealtimeAudioSource.cpp:
1429         (WebCore::MockRealtimeAudioSource::create):
1430         (WebCore::MockRealtimeAudioSource::createMuted):
1431         (WebCore::MockRealtimeAudioSource::updateSettings):
1432         (WebCore::MockRealtimeAudioSource::initializeCapabilities):
1433         (WebCore::MockRealtimeAudioSource::initializeSupportedConstraints):
1434         * platform/mock/MockRealtimeAudioSource.h:
1435         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1436         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
1437         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
1438         * platform/mock/MockRealtimeMediaSourceCenter.h:
1439         * platform/mock/MockRealtimeVideoSource.cpp:
1440         (WebCore::MockRealtimeVideoSource::create):
1441         (WebCore::MockRealtimeVideoSource::createMuted):
1442         * platform/mock/MockRealtimeVideoSource.h:
1443         * platform/mock/RTCPeerConnectionHandlerMock.cpp:
1444
1445 2016-11-10  Alex Christensen  <achristensen@webkit.org>
1446
1447         Move SecurityOrigin::databaseIdentifier() to SecurityOriginData
1448         https://bugs.webkit.org/show_bug.cgi?id=164573
1449
1450         Reviewed by Brady Eidson.
1451
1452         No change in behavior.
1453
1454         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1455         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
1456         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
1457         (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot):
1458         * Modules/indexeddb/server/IDBServer.cpp:
1459         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
1460         * Modules/webdatabase/DatabaseTracker.cpp:
1461         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
1462         (WebCore::DatabaseTracker::hasEntryForDatabase):
1463         (WebCore::DatabaseTracker::originPath):
1464         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
1465         (WebCore::DatabaseTracker::databaseNamesForOriginNoLock):
1466         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
1467         (WebCore::DatabaseTracker::setDatabaseDetails):
1468         (WebCore::DatabaseTracker::originLockFor):
1469         (WebCore::DatabaseTracker::deleteOriginLockFor):
1470         (WebCore::DatabaseTracker::quotaForOriginNoLock):
1471         (WebCore::DatabaseTracker::setQuota):
1472         (WebCore::DatabaseTracker::addDatabase):
1473         (WebCore::DatabaseTracker::deleteOrigin):
1474         (WebCore::DatabaseTracker::deleteDatabase):
1475         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
1476         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
1477         (WebCore::getDatabaseIdentifier):
1478         * dom/Document.cpp:
1479         (WebCore::Document::origin):
1480         * html/HTMLMediaElement.cpp:
1481         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
1482         * loader/appcache/ApplicationCacheStorage.cpp:
1483         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
1484         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
1485         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
1486         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
1487         (WebCore::ApplicationCacheStorage::store):
1488         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
1489         * page/SecurityOrigin.cpp:
1490         (WebCore::SecurityOrigin::databaseIdentifier): Deleted.
1491         * page/SecurityOrigin.h:
1492         * page/SecurityOriginData.cpp:
1493         (WebCore::SecurityOriginData::databaseIdentifier):
1494         * page/SecurityOriginData.h:
1495
1496 2016-11-10  Zalan Bujtas  <zalan@apple.com>
1497
1498         RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants should be on RenderBlock.
1499         https://bugs.webkit.org/show_bug.cgi?id=164601
1500
1501         Reviewed by Simon Fraser.
1502
1503         FlowThread containing blocks are cached at RenderBlocks. It makes no sense to call the invalidate function on a RenderElement.
1504         Move invalidateFlowThreadContainingBlockIncludingDescendants to RenderBlock.
1505
1506         No change in functionality.
1507
1508         * rendering/RenderBlock.cpp:
1509         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
1510         * rendering/RenderBlock.h:
1511         * rendering/RenderElement.cpp:
1512         (WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
1513         * rendering/RenderElement.h:
1514         * rendering/RenderInline.cpp:
1515         (WebCore::RenderInline::splitInlines):
1516
1517 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
1518
1519         Local file restrictions should not block sessionStorage access.
1520         https://bugs.webkit.org/show_bug.cgi?id=155609
1521         <rdar://problem/25229461> 
1522
1523         Reviewed by Andy Estes.
1524
1525         Re-landing this fix that was lost when the localStorage change was rolled out.
1526
1527         Use of 'sessionStorage' is governed by SecurityOrigin with third party access
1528         set to 'ShouldAllowFromThirdParty::AlwaysAllowFromThirdParty'. We should not
1529         reject local files for this combination of arguments.
1530
1531         Tested by storage/domstorage/sessionstorage/blocked-file-access.html.
1532
1533         * page/SecurityOrigin.cpp:
1534         (WebCore::SecurityOrigin::canAccessStorage): For the case of sessionStorage,
1535         allow local file access.
1536
1537 2016-11-10  Daniel Bates  <dabates@apple.com>
1538
1539         REGRESSION (r195004): Scripts and plugins blocked for subsequent loads in same WebContent
1540         process after receiving HTTP 0.9 response
1541         https://bugs.webkit.org/show_bug.cgi?id=164387
1542         <rdar://problem/28987537>
1543
1544         Reviewed by Brent Fulgham.
1545
1546         Fixes an issue where the HTTP 0.9 sandbox persisted across subsequent loads in the same
1547         WebContent process.
1548
1549         Currently when an HTTP 0.9 response is received for a request made to a default port
1550         (e.g. 80) we apply a sandbox policy on the FrameLoader for the main resource that
1551         disallows scripts and plugins. A FrameLoader may be re-used for navigations. Therefore,
1552         the sandbox policy applied to one site may be applied to another site. Moreover the
1553         sandbox policy was applied to the FrameLoader of the main resource regardless of whether
1554         the HTTP response was for a subresource. Instead we should apply the sandbox on a per-
1555         Document basis and only if we receive an HTTP 0.9 response for the document when the
1556         corresponding HTTP request was made to a default port.
1557
1558         As a side benefit of this change, we emit exactly one console message to Web Inspector
1559         when the HTTP 0.9 sandbox is applied to a document as opposed to three console messages.
1560         Moreover, we only emit this console message when the document load is not blocked.
1561
1562         Test: http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation.html
1563
1564         * dom/Document.cpp:
1565         (WebCore::Document::initSecurityContext): Disallow scripts and plugins if an HTTP 0.9
1566         response was received for this document. Note that if this function is called for a
1567         document associated with an HTTP 0.9 response then the corresponding HTTP request was
1568         made to a default port. DocumentLoader::responseReceived() blocks the load for a document
1569         with an HTTP 0.9 response corresponding to an HTTP request made to a non-default port.
1570         This invariant is covered by the tests LayoutTests/http/tests/security/http-0.9/default-port-{plugin, script}-blocked.html.
1571         (WebCore::Document::shouldEnforceHTTP0_9Sandbox): Added. Returns whether an HTTP 0.9 response
1572         was received for this document.
1573         * dom/Document.h:
1574         * loader/DocumentLoader.cpp:
1575         (WebCore::DocumentLoader::responseReceived): Remove logic to apply sandbox policy to the
1576         FrameLoader associated with the main resource. We will apply the sandbox during initialization
1577         of the document.
1578         * loader/ResourceLoader.cpp:
1579         (WebCore::ResourceLoader::didReceiveResponse): Ditto.
1580         * loader/SubresourceLoader.cpp:
1581         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
1582
1583 2016-11-04  Jiewen Tan  <jiewen_tan@apple.com>
1584
1585         Update SubtleCrypto::importKey to match the latest spec
1586         https://bugs.webkit.org/show_bug.cgi?id=164446
1587         <rdar://problem/29123621>
1588
1589         Reviewed by Brent Fulgham.
1590
1591         This patch does following few things:
1592         1. It updates the SubtleCrypto::importKey method to match the latest spec:
1593            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey.
1594            It also refers to the latest Editor's Draft at a certain degree:
1595            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey.
1596         2. It implements importKey operations of following algorithms: AES-CBC, AES-KW,
1597            HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
1598         3. It fixes some minor problems of SubtleCrypto::generateKey.
1599         4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and
1600            CryptoKeyDataRSAComponents.
1601         5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both
1602            HmacKeyGenParams and HmacImportParams which are essentially the same.
1603         6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8.
1604         7. It also fixes the following bugs:
1605            https://bugs.webkit.org/show_bug.cgi?id=126033,
1606            https://bugs.webkit.org/show_bug.cgi?id=126034,
1607            https://bugs.webkit.org/show_bug.cgi?id=151308.
1608         P.S. We currently only support Raw and Jwk key format.
1609
1610         Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html
1611                crypto/subtle/aes-cbc-import-jwk-key-length-192.html
1612                crypto/subtle/aes-cbc-import-jwk-key-length-256.html
1613                crypto/subtle/aes-cbc-import-jwk-key-minimum.html
1614                crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html
1615                crypto/subtle/aes-cbc-import-raw-key-length-128.html
1616                crypto/subtle/aes-cbc-import-raw-key-length-192.html
1617                crypto/subtle/aes-cbc-import-raw-key-length-256.html
1618                crypto/subtle/aes-import-key-malformed-parameters.html
1619                crypto/subtle/aes-kw-import-jwk-key-length-128.html
1620                crypto/subtle/aes-kw-import-jwk-key-length-192.html
1621                crypto/subtle/aes-kw-import-jwk-key-length-256.html
1622                crypto/subtle/aes-kw-import-raw-key.html
1623                crypto/subtle/generate-key-malformed-parameters.html
1624                crypto/subtle/hmac-import-jwk-key-minimum.html
1625                crypto/subtle/hmac-import-jwk-key-non-extractable.html
1626                crypto/subtle/hmac-import-jwk-key-sha1.html
1627                crypto/subtle/hmac-import-jwk-key-sha224.html
1628                crypto/subtle/hmac-import-jwk-key-sha256.html
1629                crypto/subtle/hmac-import-jwk-key-sha384.html
1630                crypto/subtle/hmac-import-jwk-key-sha512.html
1631                crypto/subtle/hmac-import-malformed-parameters.html
1632                crypto/subtle/hmac-import-raw-key-customized-length.html
1633                crypto/subtle/hmac-import-raw-key.html
1634                crypto/subtle/import-key-malformed-parameters.html
1635                crypto/subtle/rsa-import-key-malformed-parameters.html
1636                crypto/subtle/rsa-oaep-import-jwk-private-key.html
1637                crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html
1638                crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html
1639                crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html
1640                crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html
1641                crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html
1642                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html
1643                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html
1644                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html
1645                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html
1646                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html
1647                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html
1648                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html
1649                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html
1650                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html
1651                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html
1652                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html
1653                crypto/workers/subtle/aes-import-jwk-key.html
1654                crypto/workers/subtle/aes-import-raw-key.html
1655                crypto/workers/subtle/hmac-import-jwk-key.html
1656                crypto/workers/subtle/hmac-import-raw-key.html
1657                crypto/workers/subtle/rsa-import-jwk-private-key.html
1658                crypto/workers/subtle/rsa-import-jwk-public-key.html
1659
1660         * CMakeLists.txt:
1661         * DerivedSources.make:
1662         * PlatformEfl.cmake:
1663         * PlatformGTK.cmake:
1664         * PlatformMac.cmake:
1665         * WebCore.xcodeproj/project.pbxproj:
1666         * bindings/js/JSSubtleCryptoCustom.cpp:
1667         (WebCore::normalizeCryptoAlgorithmParameters):
1668         (WebCore::cryptoKeyUsageFromString):
1669         (WebCore::cryptoKeyUsagesFromJSValue):
1670         (WebCore::toKeyData):
1671         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
1672         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
1673         (WebCore::JSSubtleCrypto::importKey):
1674         * crypto/CryptoAlgorithm.cpp:
1675         (WebCore::CryptoAlgorithm::importKey):
1676         * crypto/CryptoAlgorithm.h:
1677         * crypto/CryptoAlgorithmParameters.h:
1678         * crypto/JsonWebKey.h: Added.
1679         * crypto/JsonWebKey.idl: Added.
1680         * crypto/RsaOtherPrimesInfo.h: Added.
1681         * crypto/RsaOtherPrimesInfo.idl: Added.
1682         * crypto/SubtleCrypto.h:
1683         * crypto/SubtleCrypto.idl:
1684         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1685         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
1686         (WebCore::CryptoAlgorithmAES_CBC::importKey):
1687         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1688         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1689         (WebCore::CryptoAlgorithmAES_KW::generateKey):
1690         (WebCore::CryptoAlgorithmAES_KW::importKey):
1691         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1692         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1693         (WebCore::CryptoAlgorithmHMAC::generateKey):
1694         (WebCore::CryptoAlgorithmHMAC::importKey):
1695         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1696         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1697         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
1698         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1699         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1700         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
1701         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1702         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1703         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
1704         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1705         * crypto/keys/CryptoKeyAES.cpp:
1706         (WebCore::CryptoKeyAES::CryptoKeyAES):
1707         (WebCore::CryptoKeyAES::generate):
1708         (WebCore::CryptoKeyAES::importRaw):
1709         (WebCore::CryptoKeyAES::importJwk):
1710         * crypto/keys/CryptoKeyAES.h:
1711         * crypto/keys/CryptoKeyDataRSAComponents.cpp:
1712         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
1713         * crypto/keys/CryptoKeyDataRSAComponents.h:
1714         * crypto/keys/CryptoKeyHMAC.cpp:
1715         (WebCore::CryptoKeyHMAC::CryptoKeyHMAC):
1716         (WebCore::CryptoKeyHMAC::generate):
1717         (WebCore::CryptoKeyHMAC::importRaw):
1718         (WebCore::CryptoKeyHMAC::importJwk):
1719         (WebCore::CryptoKeyHMAC::buildAlgorithm):
1720         * crypto/keys/CryptoKeyHMAC.h:
1721         * crypto/keys/CryptoKeyRSA.cpp: Added.
1722         (WebCore::CryptoKeyRSA::importJwk):
1723         * crypto/keys/CryptoKeyRSA.h:
1724         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h.
1725         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added.
1726         * crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl.
1727         * crypto/parameters/RsaHashedImportParams.idl: Added.
1728
1729 2016-11-10  Brady Eidson  <beidson@apple.com>
1730
1731         IndexedDB 2.0: REGRESSION(r208467) Fix flaky crashes in IDB GC-related code.
1732         https://bugs.webkit.org/show_bug.cgi?id=164596
1733
1734         Reviewed by Eric Carlson.
1735
1736         No new tests (Covered by existing tests).
1737
1738         We can't just WTFMove the pointers from the deleted-IDBObject maps...
1739         We need to remove the entries, too.
1740
1741         * Modules/indexeddb/IDBObjectStore.cpp:
1742         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
1743
1744         * Modules/indexeddb/IDBTransaction.cpp:
1745         (WebCore::IDBTransaction::internalAbort):
1746
1747 2016-11-10  Youenn Fablet  <youennf@gmail.com>
1748
1749         MediaStreamTrack should use more Ref<> and less RefPtr<>
1750         https://bugs.webkit.org/show_bug.cgi?id=164560
1751
1752         Reviewed by Eric Carlson.
1753
1754         No change of behavior.
1755
1756         Make MediaStreamTrack take a Ref<>& instead of a reference.
1757         Using Ref<>&& instead of RefPtr<>&& in MediaStreamTrackPrivate.
1758         Updating constness of some methods accordingly.
1759
1760         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1761         (WebCore::MediaEndpointPeerConnection::createReceiver):
1762         * Modules/mediastream/MediaStreamTrack.cpp:
1763         (WebCore::MediaStreamTrack::create):
1764         (WebCore::MediaStreamTrack::MediaStreamTrack):
1765         (WebCore::MediaStreamTrack::clone):
1766         * Modules/mediastream/MediaStreamTrack.h:
1767         * Modules/webaudio/MediaStreamAudioSource.cpp:
1768         (WebCore::MediaStreamAudioSource::capabilities):
1769         (WebCore::MediaStreamAudioSource::settings):
1770         * Modules/webaudio/MediaStreamAudioSource.h:
1771         * platform/mediastream/MediaEndpoint.cpp:
1772         * platform/mediastream/MediaStreamPrivate.cpp:
1773         (WebCore::MediaStreamPrivate::create):
1774         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1775         (WebCore::MediaStreamTrackPrivate::create):
1776         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
1777         (WebCore::MediaStreamTrackPrivate::clone):
1778         * platform/mediastream/MediaStreamTrackPrivate.h:
1779         (WebCore::MediaStreamTrackPrivate::setMuted):
1780         (WebCore::MediaStreamTrackPrivate::source):
1781         * platform/mediastream/RealtimeMediaSource.h:
1782         * platform/mediastream/mac/AVMediaCaptureSource.h:
1783         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1784         (WebCore::AVMediaCaptureSource::initializeSettings):
1785         (WebCore::AVMediaCaptureSource::settings):
1786         (WebCore::AVMediaCaptureSource::initializeCapabilities):
1787         (WebCore::AVMediaCaptureSource::capabilities):
1788         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
1789         (WebCore::RealtimeMediaSourceOwr::capabilities):
1790         (WebCore::RealtimeMediaSourceOwr::settings):
1791         * platform/mock/MockRealtimeMediaSource.cpp:
1792         (WebCore::MockRealtimeMediaSource::initializeCapabilities):
1793         (WebCore::MockRealtimeMediaSource::capabilities):
1794         (WebCore::MockRealtimeMediaSource::initializeSettings):
1795         (WebCore::MockRealtimeMediaSource::settings):
1796         * platform/mock/MockRealtimeMediaSource.h:
1797
1798 2016-11-10  Per Arne Vollan  <pvollan@apple.com>
1799
1800         [Win32] Crash in layout tests.
1801         https://bugs.webkit.org/show_bug.cgi?id=164411
1802
1803         Reviewed by Mark Lam.
1804
1805         Use the calling convention expected by the callers of the generated functions.
1806
1807         * bindings/scripts/CodeGeneratorJS.pm:
1808         (GenerateImplementation):
1809         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1810         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute):
1811         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem):
1812         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute):
1813         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById):
1814         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName):
1815
1816 2016-11-10  Aaron Chu  <aaron_chu@apple.com>
1817
1818         Web Inspector: AXI: clarify button roles (e.g. toggle or popup button)
1819         https://bugs.webkit.org/show_bug.cgi?id=130726
1820         <rdar://problem/16420420>
1821
1822         Reviewed by Brian Burg.
1823
1824         Test: accessibility/ax-differentiate-button-types.html
1825
1826         Added special case logic to make sure PopUpButtonRole and ToggleButtonRole to user ButtonRole as role.
1827         Added an "isPopUpButton" property to be exposed to the Inspector's use.
1828
1829         * accessibility/AccessibilityObject.cpp:
1830         (WebCore::AccessibilityObject::computedRoleString):
1831         * inspector/InspectorDOMAgent.cpp:
1832         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
1833
1834 2016-11-10  Zan Dobersek  <zdobersek@igalia.com>
1835
1836         [EME] Add no-op Web-facing APIs
1837         https://bugs.webkit.org/show_bug.cgi?id=164028
1838
1839         Reviewed by Jer Noble.
1840
1841         Add no-op implementation of the Web-facing APIs as defined in
1842         the EME specification. This will be the basis for implementing
1843         the various algorithms the same specification defines, and for
1844         implementing the relevant platform abstractions.
1845
1846         Dictionaries and enumerations defined by the specification are
1847         defined in separate headers, and not in the implementation files
1848         for the class where they are used. This will ease their use
1849         across different implementation files.
1850
1851         BufferSource now exposes the Variant object it holds. This is
1852         needed to support the iterable property on the MediaKeyStatusMap
1853         class.
1854
1855         CodeGeneratorJS is fixed to support JS-to-native conversion of
1856         sequences of dictionaries.
1857
1858         * CMakeLists.txt:
1859         * DerivedSources.cpp:
1860         * DerivedSources.make:
1861         * Modules/encryptedmedia/MediaKeyMessageEvent.cpp: Added.
1862         (WebCore::MediaKeyMessageEvent::MediaKeyMessageEvent):
1863         (WebCore::MediaKeyMessageEvent::eventInterface):
1864         * Modules/encryptedmedia/MediaKeyMessageEvent.h: Added.
1865         * Modules/encryptedmedia/MediaKeyMessageEvent.idl: Added.
1866         * Modules/encryptedmedia/MediaKeyMessageEventInit.h: Added.
1867         (WebCore::MediaKeyMessageEventInit::MediaKeyMessageEventInit):
1868         * Modules/encryptedmedia/MediaKeyMessageType.h: Added.
1869         * Modules/encryptedmedia/MediaKeySession.cpp: Added.
1870         (WebCore::MediaKeySession::create):
1871         (WebCore::MediaKeySession::MediaKeySession):
1872         (WebCore::MediaKeySession::sessionId):
1873         (WebCore::MediaKeySession::expiration):
1874         (WebCore::MediaKeySession::keyStatuses):
1875         (WebCore::MediaKeySession::generateRequest):
1876         (WebCore::MediaKeySession::load):
1877         (WebCore::MediaKeySession::update):
1878         (WebCore::MediaKeySession::close):
1879         (WebCore::MediaKeySession::remove):
1880         (WebCore::MediaKeySession::hasPendingActivity):
1881         (WebCore::MediaKeySession::activeDOMObjectName):
1882         (WebCore::MediaKeySession::canSuspendForDocumentSuspension):
1883         (WebCore::MediaKeySession::stop):
1884         * Modules/encryptedmedia/MediaKeySession.h: Added.
1885         * Modules/encryptedmedia/MediaKeySession.idl: Added.
1886         * Modules/encryptedmedia/MediaKeySessionType.h: Added.
1887         * Modules/encryptedmedia/MediaKeyStatus.h: Added.
1888         * Modules/encryptedmedia/MediaKeyStatusMap.cpp: Added.
1889         (WebCore::MediaKeyStatusMap::size):
1890         (WebCore::MediaKeyStatusMap::has):
1891         (WebCore::MediaKeyStatusMap::get):
1892         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
1893         (WebCore::MediaKeyStatusMap::Iterator::next):
1894         * Modules/encryptedmedia/MediaKeyStatusMap.h: Added.
1895         (WebCore::MediaKeyStatusMap::create):
1896         (WebCore::MediaKeyStatusMap::createIterator):
1897         * Modules/encryptedmedia/MediaKeyStatusMap.idl: Added.
1898         * Modules/encryptedmedia/MediaKeySystemAccess.cpp: Added.
1899         (WebCore::MediaKeySystemAccess::keySystem):
1900         (WebCore::MediaKeySystemAccess::getConfiguration):
1901         (WebCore::MediaKeySystemAccess::createMediaKeys):
1902         * Modules/encryptedmedia/MediaKeySystemAccess.h: Added.
1903         (WebCore::MediaKeySystemAccess::create):
1904         * Modules/encryptedmedia/MediaKeySystemAccess.idl: Added.
1905         * Modules/encryptedmedia/MediaKeySystemConfiguration.h: Added.
1906         * Modules/encryptedmedia/MediaKeySystemConfiguration.idl: Added.
1907         * Modules/encryptedmedia/MediaKeySystemMediaCapability.h: Added.
1908         * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl: Added.
1909         * Modules/encryptedmedia/MediaKeys.cpp: Added.
1910         (WebCore::MediaKeys::createSession):
1911         (WebCore::MediaKeys::setServerCertificate):
1912         * Modules/encryptedmedia/MediaKeys.h: Added.
1913         (WebCore::MediaKeys::create):
1914         * Modules/encryptedmedia/MediaKeys.idl: Added.
1915         * Modules/encryptedmedia/MediaKeysRequirement.h: Added.
1916         * Modules/encryptedmedia/NavigatorEME.cpp: Added.
1917         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
1918         * Modules/encryptedmedia/NavigatorEME.h: Added.
1919         * Modules/encryptedmedia/NavigatorEME.idl: Added.
1920         * WebCore.xcodeproj/project.pbxproj:
1921         * bindings/js/BufferSource.h:
1922         (WebCore::BufferSource::BufferSource):
1923         (WebCore::BufferSource::variant):
1924         * bindings/js/JSMediaKeySessionCustom.cpp: Added.
1925         (WebCore::JSMediaKeySession::closed):
1926         * bindings/js/JSMediaKeySystemAccessCustom.cpp: Added.
1927         (WebCore::JSMediaKeySystemAccess::getConfiguration):
1928         * bindings/scripts/CodeGeneratorJS.pm:
1929         (GetNativeVectorInnerType):
1930         * dom/EventNames.h:
1931         * dom/EventNames.in:
1932         * dom/EventTargetFactory.in:
1933         * html/HTMLMediaElement.cpp:
1934         (WebCore::HTMLMediaElement::mediaKeys):
1935         (WebCore::HTMLMediaElement::setMediaKeys):
1936         * html/HTMLMediaElement.h:
1937         * html/HTMLMediaElement.idl:
1938         * html/MediaEncryptedEvent.cpp: Added.
1939         (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
1940         (WebCore::MediaEncryptedEvent::eventInterface):
1941         (WebCore::MediaEncryptedEvent::initDataType):
1942         (WebCore::MediaEncryptedEvent::initData):
1943         * html/MediaEncryptedEvent.h: Added.
1944         * html/MediaEncryptedEvent.idl: Added.
1945         * html/MediaEncryptedEventInit.h: Added.
1946         (WebCore::MediaEncryptedEventInit::MediaEncryptedEventInit):
1947
1948 2016-11-10  Antoine Quint  <graouts@apple.com>
1949
1950         [Modern Media Controls] Media Controller: update controls based on fullscreen playback on macOS
1951         https://bugs.webkit.org/show_bug.cgi?id=164554
1952         <rdar://problem/29183439>
1953
1954         Reviewed by Dean Jackson.
1955
1956         When toggling fullscreen on macOS, toggle between MacOSInlineMediaControls and MacOSFullscreenMediaControls.
1957         To facilitate this, support objects are created and destroyed when changing the controls in order for the
1958         right control objects to be hooked up to the media controller. A new destroy() method on MediaControllerSupport
1959         subclasses can be overridden to remove event listeners added by support objects in their constructor.
1960
1961         Test: media/modern-media-controls/media-controller/media-controller-fullscreen-change.html
1962
1963         * Modules/modern-media-controls/media/fullscreen-support.js:
1964         (FullscreenSupport.prototype.destroy):
1965         * Modules/modern-media-controls/media/media-controller-support.js:
1966         (MediaControllerSupport.prototype.destroy):
1967         * Modules/modern-media-controls/media/media-controller.js:
1968         (MediaController):
1969         (MediaController.prototype.get layoutTraits):
1970         (MediaController.prototype.handleEvent):
1971         (MediaController.prototype._updateControlsIfNeeded):
1972         (MediaController.prototype._controlsClass):
1973
1974 2016-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
1975
1976         [Linux] Memory values shown by memory pressure handler logger are not useful
1977         https://bugs.webkit.org/show_bug.cgi?id=164589
1978
1979         Reviewed by Michael Catanzaro.
1980
1981         We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process
1982         and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the
1983         time we see that there's no changes in memory usage in the logs.
1984         We should use the actual memory used by the process, memory that the process can release and then it's relevant
1985         for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS -
1986         (RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main
1987         different is that statm provides both resident and shared memory directly, but in number of pages, so we need to
1988         multiply by the size of the page.
1989         This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux
1990         memory sampler that is incorrectly parsing /proc/self/statm.
1991
1992         * platform/Linux.cmake: Add new files to compilation.
1993         * platform/linux/CurrentProcessMemoryStatus.cpp: Added.
1994         (WebCore::systemPageSize): Return the page size.
1995         (WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus.
1996         * platform/linux/CurrentProcessMemoryStatus.h: Added.
1997         * platform/linux/MemoryPressureHandlerLinux.cpp:
1998         (WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process
1999         in bytes.
2000         (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage().
2001
2002 2016-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2003
2004         MemoryPressureHandler shouldn't know how to release WebCore memory
2005         https://bugs.webkit.org/show_bug.cgi?id=160497
2006
2007         Reviewed by Michael Catanzaro.
2008
2009         All processes should set their own low memory handler, instead of leaving the web process using the default one
2010         that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the
2011         MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the
2012         WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer.
2013
2014         * CMakeLists.txt: Add new files to compilation.
2015         * PlatformMac.cmake: Ditto.
2016         * WebCore.xcodeproj/project.pbxproj: Ditto.
2017         * loader/FrameLoader.cpp:
2018         (WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation().
2019         * page/MemoryRelease.cpp: Added.
2020         (WebCore::releaseNoncriticalMemory):
2021         (WebCore::releaseCriticalMemory):
2022         (WebCore::releaseMemory):
2023         (WebCore::platformReleaseMemory):
2024         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
2025         (WebCore::registerMemoryReleaseNotifyCallbacks):
2026         * page/MemoryRelease.h: Added.
2027         * page/cocoa/MemoryReleaseCocoa.mm: Added.
2028         (WebCore::platformReleaseMemory):
2029         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
2030         (WebCore::registerMemoryReleaseNotifyCallbacks):
2031         * platform/MemoryPressureHandler.cpp:
2032         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
2033         (WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure):
2034         (WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set.
2035         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
2036         * platform/MemoryPressureHandler.h:
2037         (WebCore::MemoryPressureHandler::setLowMemoryHandler):
2038         (WebCore::MemoryPressureHandler::m_releaseMemoryBlock):
2039         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
2040         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
2041         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
2042         * platform/linux/MemoryPressureHandlerLinux.cpp:
2043         * platform/win/MemoryPressureHandlerWin.cpp:
2044         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
2045
2046 2016-11-08  Sergio Villar Senin  <svillar@igalia.com>
2047
2048         [css-grid] Fix fr tracks sizing under min|max-size constraints
2049         https://bugs.webkit.org/show_bug.cgi?id=150674
2050
2051         Reviewed by Darin Adler.
2052
2053         The min|max-sizes must be used to compute the flex fraction for indefinite free
2054         spaces. According to the spec "If using this flex fraction would cause the grid to be
2055         smaller than the grid container’s min-width/height (or larger than the grid container’s
2056         max-width/height), then redo this step, treating the free space as definite and the
2057         available grid space as equal to the grid container’s content box size when it’s sized to
2058         its min-width/height (max-width/height)."
2059
2060         This only affects indefinite heights because during layout both definite sizes and any kind
2061         of widths are properly constrained by min|max-width restrictions.
2062
2063         Tests: fast/css-grid-layout/flex-sizing-columns-min-max-width.html
2064                fast/css-grid-layout/flex-sizing-rows-min-max-height.html
2065
2066         * rendering/RenderGrid.cpp:
2067         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
2068         (WebCore::RenderGrid::computeFlexSizedTracksGrowth):
2069         * rendering/RenderGrid.h:
2070
2071 2016-11-10  Alejandro G. Castro  <alex@igalia.com>
2072
2073         [WebRTC] [OpenWebRTC] RTX default parameters broken after r207952
2074         https://bugs.webkit.org/show_bug.cgi?id=164541
2075
2076         Reviewed by Philippe Normand.
2077
2078         Fixed typo in refactoring.
2079
2080         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
2081         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
2082
2083 2016-11-08  Philippe Normand  <pnormand@igalia.com>
2084
2085         [WebRTC] white-list turns urls from the RTCConfiguration
2086         https://bugs.webkit.org/show_bug.cgi?id=164506
2087
2088         Reviewed by Alejandro G. Castro.
2089
2090         * Modules/mediastream/RTCConfiguration.cpp:
2091         (WebCore::validateIceServerURL): Add the turns URL scheme to the
2092         list of supported relay and signaling server protocols.
2093
2094 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
2095
2096         Web Inspector: DebuggerManager.Event.Resumed introduces test flakiness
2097         https://bugs.webkit.org/show_bug.cgi?id=161951
2098         <rdar://problem/28295767>
2099
2100         Reviewed by Brian Burg.
2101
2102         Covered by existing tests that would ASSERT otherwise.
2103
2104         * inspector/InspectorClient.cpp:
2105         (WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
2106         When paused on an exception in the inspected page and evaluating
2107         commands in the inspector frontend page (which evaluates JavaScript)
2108         we ASSERT when entering the Global DOM VM with an existing exception.
2109         This makes it so when we evaluate JavaScript in the frontend we
2110         suspend / ignore the state of the VM for the inspected page, and
2111         restore it when we return from the inspector.
2112
2113 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
2114
2115         Web Inspector: Associate Worker Resources with the Worker and not the Page
2116         https://bugs.webkit.org/show_bug.cgi?id=164342
2117         <rdar://problem/29075775>
2118
2119         Reviewed by Timothy Hatcher.
2120
2121         Test: inspector/worker/resources-in-worker.html
2122
2123         Provide a way to associate an initiator identifier with a ResourceRequest.
2124         This will allow Web Inspector to identify who started particular resource
2125         loads. This is important to associate Worker(...), importScript(...), and
2126         XMLHttpRequest / Fetch loads with that specific Worker.
2127
2128         * platform/network/ResourceRequestBase.cpp:
2129         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
2130         * platform/network/ResourceRequestBase.h:
2131         (WebCore::ResourceRequestBase::initiatorIdentifier):
2132         (WebCore::ResourceRequestBase::setInitiatorIdentifier):
2133         Optional initiator identifier. Currently used only be Web Inspector.
2134
2135         * dom/ScriptExecutionContext.h:
2136         (WebCore::ScriptExecutionContext::resourceRequestIdentifier):
2137         Non-page execution contexts, like WorkerGlobalScope, should provide
2138         a unique identifier that may be used to distinguish loads initiated
2139         from within that context.
2140
2141         * xml/XMLHttpRequest.cpp:
2142         (WebCore::XMLHttpRequest::createRequest):
2143         * Modules/fetch/FetchLoader.cpp:
2144         (WebCore::FetchLoader::start):
2145         * Modules/fetch/FetchRequest.cpp:
2146         (WebCore::FetchRequest::initializeWith):
2147         XHR / Fetch loads should include the ScriptExecutionContext's
2148         initiator identifier.
2149
2150         * workers/WorkerScriptLoader.cpp:
2151         (WebCore::WorkerScriptLoader::WorkerScriptLoader):
2152         (WebCore::WorkerScriptLoader::loadSynchronously):
2153         (WebCore::WorkerScriptLoader::loadAsynchronously):
2154         (WebCore::WorkerScriptLoader::createResourceRequest):
2155         * workers/WorkerScriptLoader.h:
2156         Provide a way to provide initiator identifier information for
2157         Worker script loads. Currently this is `new Worker(...)` and
2158         `importScripts(...)` resource loads.
2159
2160         * workers/Worker.cpp:
2161         (WebCore::Worker::Worker):
2162         (WebCore::Worker::create):
2163         * workers/Worker.h:
2164         * workers/WorkerGlobalScope.cpp:
2165         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
2166         (WebCore::WorkerGlobalScope::importScripts):
2167         * workers/WorkerGlobalScope.h:
2168         Give Worker itself the unique identifier, because `new Worker(...)`
2169         loads happen before the WorkerGlobalScript (ScriptExecutionContext)
2170         is actually created, but we want to associate it with this Worker.
2171
2172         * workers/DedicatedWorkerGlobalScope.cpp:
2173         (WebCore::DedicatedWorkerGlobalScope::create):
2174         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
2175         * workers/DedicatedWorkerGlobalScope.h:
2176         * workers/DedicatedWorkerThread.cpp:
2177         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
2178         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
2179         * workers/DedicatedWorkerThread.h:
2180         * workers/WorkerInspectorProxy.cpp:
2181         (WebCore::WorkerInspectorProxy::WorkerInspectorProxy):
2182         * workers/WorkerInspectorProxy.h:
2183         * workers/WorkerMessagingProxy.cpp:
2184         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
2185         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
2186         * workers/WorkerThread.cpp:
2187         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
2188         (WebCore::WorkerThread::WorkerThread):
2189         (WebCore::WorkerThread::workerThread):
2190         * workers/WorkerThread.h:
2191         Pass the MainThread's Worker identifier through to the WorkerGlobalScope
2192         created on the WorkerThread. They should be the same identifier.
2193
2194         * inspector/InspectorNetworkAgent.cpp:
2195         (WebCore::InspectorNetworkAgent::willSendRequest):
2196         * inspector/InspectorPageAgent.cpp:
2197         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
2198         Pass the initiator identifier data to the frontend. This identifier is
2199         equivalent to a "target identifier" in the frontend. Currently the only
2200         non-Page targets are Workers.
2201
2202         * loader/cache/CachedResourceLoader.cpp:
2203         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
2204         When using the memory cache we create a new resource request. Be sure
2205         to copy over useful inspector data, like the initiator identifier,
2206         from the original request.
2207
2208         * platform/network/cf/ResourceRequestCFNet.cpp:
2209         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
2210         When rebuilding a ResourceRequest from NSURLRequest, copy over the
2211         initiator identifier property that wouldn't otherwise have survived
2212         the transition.
2213
2214 2016-11-09  Brady Eidson  <beidson@apple.com>
2215
2216         IndexedDB 2.0: Clean up some exception ordering.
2217         https://bugs.webkit.org/show_bug.cgi?id=164566
2218
2219         Reviewed by Alex Christensen.
2220
2221         No new tests (Covered by existing tests).
2222
2223         * Modules/indexeddb/IDBCursor.cpp:
2224         (WebCore::IDBCursor::advance):
2225         (WebCore::IDBCursor::continueFunction):
2226
2227         * Modules/indexeddb/IDBObjectStore.cpp:
2228         (WebCore::IDBObjectStore::createIndex):
2229
2230 2016-11-09  Alex Christensen  <achristensen@webkit.org>
2231
2232         Unreviewed, rolling out r208438.
2233
2234         crashes
2235
2236         Reverted changeset:
2237
2238         "[WK2][NETWORK_SESSION] Add support for downloading file
2239         backed blobs"
2240         https://bugs.webkit.org/show_bug.cgi?id=164458
2241         http://trac.webkit.org/changeset/208438
2242
2243 2016-11-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2244
2245         Change the decoding for some animated images to be asynchronous
2246         https://bugs.webkit.org/show_bug.cgi?id=161566
2247
2248         Reviewed by Simon Fraser.
2249
2250         Tests: fast/images/slower-animation-than-decoding-image.html
2251                fast/images/slower-decoding-than-animation-image.html
2252                fast/images/stopped-animation-deleted-image.html
2253                
2254         Request the next frame before firing the animation timer. The asynchronous
2255         image decoding work queue notifies the BitmapImage when the frame finishes
2256         decoding. If the timer fires before the frame is decoded, no repaint will
2257         be requested. Only when the image frame is ready, the animation will be
2258         advanced and the image will be repainted.
2259
2260         * loader/cache/CachedImage.cpp:
2261         (WebCore::CachedImage::load): Cache the image settings in CachedImage.
2262         (WebCore::CachedImage::createImage): No need to pass allowSubsampling to BitmapImage. It can be retrieved through Image::imageObserver().
2263         (WebCore::CachedImage::changedInRect): Change the parameter to notifyObservers() to be a pointer.
2264         * loader/cache/CachedImage.h: Cache the settings: allowSubsampling, allowAsyncImageDecoding and showDebugBackground through m_loader.
2265         * platform/graphics/BitmapImage.cpp:
2266         (WebCore::BitmapImage::dataChanged): Fix a logging message.
2267         (WebCore::BitmapImage::draw): Store the current SubsamplingLevel to be used when requesting decoding the image of the next frame.
2268         Draw a debug rectangle if the next frame is missed because it is being decoded and the setting showDebugBackground is on.
2269         (WebCore::BitmapImage::startAnimation): Deleted. Moved to the header file.
2270         (WebCore::BitmapImage::internalStartAnimation): Added. Request asynchronous image decoding for the next frame if required. Return the
2271         result of starting the animation.
2272         (WebCore::BitmapImage::advanceAnimation): Call internalAdvanceAnimation() if the frame image is not being decoded. If it is being decoded
2273         and the setting showDebugBackground is on, force repaint so the debug rectangle is drawn.
2274         (WebCore::BitmapImage::internalAdvanceAnimation): This is the old body of advanceAnimation().
2275         (WebCore::BitmapImage::stopAnimation): Stop the asynchronous image decoding if it is started.
2276         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): This function is called from the async image decoding work queue when finishing decoding a native image frame.
2277         * platform/graphics/BitmapImage.h:
2278         (WebCore::BitmapImage::startAnimation): Added. It is now calls internalStartAnimation().
2279         * platform/graphics/Color.h: Define a constant for the yellow color.
2280         * platform/graphics/ImageFrameCache.cpp:
2281         (WebCore::ImageFrameCache::clearMetadata): Delete unreferenced member.
2282         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Return true if the frame is requested for async decoding.
2283         * platform/graphics/ImageFrameCache.h:
2284         * platform/graphics/ImageObserver.h:  Add virtual functions for allowSubsampling, allowAsyncImageDecoding and showDebugBackground.
2285         * platform/graphics/ImageSource.cpp:
2286         (WebCore::ImageSource::maximumSubsamplingLevel): Move checking allowSubsampling() to the caller BitmapImage::draw().
2287         * platform/graphics/ImageSource.h: Remove the setting allowSubsampling(); it can be retrieved from imageObserver().
2288         (WebCore::ImageSource::setAllowSubsampling): Deleted.
2289         * rendering/RenderImageResource.cpp:
2290         (WebCore::RenderImageResource::shutdown): Stop the animation of an image when shutting down the resource.
2291         * rendering/RenderImageResourceStyleImage.cpp:
2292         (WebCore::RenderImageResourceStyleImage::shutdown): Ditto.
2293         svg/graphics/SVGImageClients.h: Change the parameter to ImageObserver::changedInRect() to be a pointer.
2294         (WebCore::SVGImageChromeClient::invalidateContentsAndRootView):
2295         * testing/Internals.cpp:
2296         (WebCore::Internals::setImageFrameDecodingDuration): Sets a fixed frame decoding duration for testing.
2297         * testing/Internals.h:
2298         * testing/Internals.idl: Adds an internal option for ImageFrameDecodingDuration.
2299
2300 2016-11-04  Brent Fulgham  <bfulgham@apple.com>
2301
2302         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
2303         https://bugs.webkit.org/show_bug.cgi?id=155185
2304         <rdar://problem/11101440>
2305
2306         Reviewed by Brady Eidson.
2307
2308         Add a new quirk for localStorage that defaults to 'on'. When active, this quirk says that
2309         localStorage access should be granted, without needing to grant universal file access.
2310
2311         If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly
2312         grants universal file access.
2313
2314         Tests: storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk.html
2315                storage/domstorage/localstorage/blocked-file-access.html
2316
2317         * dom/Document.cpp:
2318         (WebCore::Document::initSecurityContext): Set localStorage quirk mode based on settings.
2319         * page/SecurityOrigin.cpp:
2320         (WebCore::SecurityOrigin::SecurityOrigin): Use more C++11 initializers.
2321         (WebCore::SecurityOrigin::canAccessStorage): If the origin is a local file, and we are NOT in
2322         localStorage quirks mode, and we have not been granted universal file access, prevent access
2323         to DOM localStorage.
2324         (WebCore::SecurityOrigin::setNeedsLocalStorageQuirk): Added.
2325         * page/SecurityOrigin.h:
2326         (WebCore::SecurityOrigin::needsLocalStorageQuirk): Added.
2327         * page/Settings.in:
2328         * workers/WorkerGlobalScope.cpp:
2329         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Make sure Workers know what the
2330         localStorage quirks mode is set to.
2331
2332 2016-11-09  Alex Christensen  <achristensen@webkit.org>
2333
2334         URLParser should not consider path of URLs with no host to start at the first slash after the colon
2335         https://bugs.webkit.org/show_bug.cgi?id=164555
2336
2337         Reviewed by Tim Horton.
2338
2339         When we see a url that is only scheme:// we treated the // as the path.  Firefox did this with unrecognized schemes,
2340         but based on https://github.com/whatwg/url/issues/148 they seem willing to change.  We had added similar behavior to
2341         URL::parse, and I added this to URLParser in r206783 which this effectively reverts.
2342
2343         Covered by API and layout tests.
2344
2345         * platform/URLParser.cpp:
2346         (WebCore::URLParser::parse):
2347         Don't move m_userStart to m_pathStart back by two when we see an empty host.
2348
2349 2016-11-09  Alex Christensen  <achristensen@webkit.org>
2350
2351         Simplify logic of SecurityOrigin::databaseIdentifier
2352         https://bugs.webkit.org/show_bug.cgi?id=164565
2353
2354         Reviewed by Brady Eidson.
2355
2356         No change in behavior.
2357
2358         SecurityOrigins with the file scheme need a special database identifier to be backwards-compatible with existing storage.
2359         Instead of determining whether this is a file SecurityOrigin at parsing time and only using that information when
2360         making the database identifier, just determine whether we need this quirk when making the database identifier.
2361         I'm planning to move this logic to SecurityOriginData in another patch.
2362
2363         * page/SecurityOrigin.cpp:
2364         (WebCore::SecurityOrigin::SecurityOrigin):
2365         (WebCore::SecurityOrigin::create):
2366         (WebCore::SecurityOrigin::databaseIdentifier):
2367         * page/SecurityOrigin.h:
2368
2369 2016-11-09  Jaehun Lim  <ljaehun.lim@samsung.com>
2370
2371         Unreviewed, build fix after r208460
2372
2373         isValidColorString() was renamed isValidSimpleColorString().
2374
2375         * html/ColorInputType.cpp:
2376         (WebCore::ColorInputType::suggestions):
2377
2378 2016-11-09  Anders Carlsson  <andersca@apple.com>
2379
2380         Fix STP build.
2381
2382         * WebCorePrefix.h:
2383
2384 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
2385
2386         Implement visual-viewport based position:fixed handling for Mac async scrolling
2387         https://bugs.webkit.org/show_bug.cgi?id=164495
2388
2389         Reviewed by Tim Horton.
2390
2391         Educate the scrolling tree about visual and layout viewports. This is runtime-switchable,
2392         so we push the enable flag to via the root state node, then push the layout viewport,
2393         and the min/max scroll position that contstrain it, through frame state nodes.
2394
2395         When a scroll happens, we compute a new layout viewport when the visual viewport hits
2396         an edge, and push that down through setScrollLayerPosition() since it's used to position
2397         fixed and sticky layers.
2398
2399         When the main thread gets notified about an async scroll, we set the new layout viewport
2400         on the FrameView, but do so in such a way that does not trigger layout. This is OK because
2401         we do a RenderLayer update which udpates all the layoutViewport-dependent state, and is
2402         necessary to avoid repaints every main thread update.
2403
2404         The iOS code is made to compile, but not work yet.
2405
2406         Tests: compositing/tiling/visiblerect-accumulated-offset.html
2407                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up.html
2408                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down.html
2409                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html
2410
2411         * page/FrameView.cpp:
2412         (WebCore::FrameView::setLayoutViewportOrigin):
2413         (WebCore::FrameView::updateLayoutViewport):
2414         (WebCore::FrameView::visualViewportRect):
2415         (WebCore::FrameView::unscaledMinimumScrollPosition):
2416         (WebCore::FrameView::scrollPositionChanged):
2417         * page/FrameView.h:
2418         * page/scrolling/AsyncScrollingCoordinator.cpp:
2419         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
2420         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
2421         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
2422         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
2423         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
2424         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled):
2425         * page/scrolling/AsyncScrollingCoordinator.h:
2426         (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
2427         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2428         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
2429         (WebCore::ScrollingStateFrameScrollingNode::setLayoutViewport):
2430         (WebCore::ScrollingStateFrameScrollingNode::setMinLayoutViewportOrigin):
2431         (WebCore::ScrollingStateFrameScrollingNode::setMaxLayoutViewportOrigin):
2432         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled):
2433         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
2434         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2435         * page/scrolling/ScrollingTree.cpp:
2436         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling):
2437         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
2438         (WebCore::ScrollingTree::commitTreeState):
2439         * page/scrolling/ScrollingTree.h:
2440         (WebCore::ScrollingTree::visualViewportEnabled):
2441         (WebCore::ScrollingTree::setVisualViewportEnabled):
2442         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2443         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
2444         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
2445         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2446         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport):
2447         (WebCore::ScrollingTreeFrameScrollingNode::minLayoutViewportOrigin):
2448         (WebCore::ScrollingTreeFrameScrollingNode::maxLayoutViewportOrigin):
2449         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2450         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints):
2451         * page/scrolling/ScrollingTreeScrollingNode.h:
2452         * page/scrolling/ThreadedScrollingTree.cpp:
2453         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
2454         * page/scrolling/ThreadedScrollingTree.h:
2455         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
2456         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
2457         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):
2458         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
2459         * page/scrolling/ios/ScrollingTreeIOS.cpp:
2460         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
2461         * page/scrolling/ios/ScrollingTreeIOS.h:
2462         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2463         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2464         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
2465         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
2466
2467 2016-11-09  Brady Eidson  <beidson@apple.com>
2468
2469         IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
2470         https://bugs.webkit.org/show_bug.cgi?id=164528
2471
2472         Reviewed by Alex Christensen.
2473
2474         No new tests (Covered by existing test).
2475
2476         * Modules/indexeddb/IDBDatabase.cpp:
2477         (WebCore::IDBDatabase::transaction): De-dupe the input names.
2478
2479 2016-11-09  Brady Eidson  <beidson@apple.com>
2480
2481         IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function.
2482         https://bugs.webkit.org/show_bug.cgi?id=164404
2483
2484         Reviewed by Alex Christensen.
2485
2486         Tests: storage/indexeddb/modern/idbcursor-continue-primary-key-1-private.html
2487                storage/indexeddb/modern/idbcursor-continue-primary-key-1.html
2488                Also covered by existing tests.
2489
2490         * Modules/indexeddb/IDBCursor.cpp:
2491         (WebCore::IDBCursor::continuePrimaryKey):
2492         (WebCore::IDBCursor::uncheckedIterateCursor):
2493         * Modules/indexeddb/IDBCursor.h:
2494         * Modules/indexeddb/IDBCursor.idl:
2495
2496         * Modules/indexeddb/IDBKeyData.h:
2497         (WebCore::IDBKeyData::operator>):
2498         (WebCore::IDBKeyData::operator<=):
2499         (WebCore::IDBKeyData::operator>=):
2500
2501         * Modules/indexeddb/server/MemoryCursor.h:
2502
2503         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
2504         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
2505
2506         * Modules/indexeddb/server/MemoryIndexCursor.cpp:
2507         (WebCore::IDBServer::MemoryIndexCursor::iterate):
2508         * Modules/indexeddb/server/MemoryIndexCursor.h:
2509
2510         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
2511         (WebCore::IDBServer::MemoryObjectStoreCursor::iterate):
2512         * Modules/indexeddb/server/MemoryObjectStoreCursor.h:
2513
2514         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2515         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
2516
2517         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
2518         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
2519         * Modules/indexeddb/server/SQLiteIDBCursor.h:
2520
2521         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
2522         (WebCore::IDBIterateCursorData::isolatedCopy):
2523         * Modules/indexeddb/shared/IDBIterateCursorData.h:
2524         (WebCore::IDBIterateCursorData::encode):
2525         (WebCore::IDBIterateCursorData::decode):
2526
2527 2016-11-09  Antoine Quint  <graouts@apple.com>
2528
2529         [Modern Media Controls] Media Controller: set status label according to media state
2530         https://bugs.webkit.org/show_bug.cgi?id=164557
2531         <rdar://problem/29184097>
2532
2533         Reviewed by Dean Jackson.
2534
2535         Correctly set the StatusLabel text based on the media loading and network state.
2536
2537         Tests: http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html
2538                http/tests/media/modern-media-controls/status-support/status-support-loading.html
2539                media/modern-media-controls/status-support/status-support-error.html
2540
2541         * Modules/modern-media-controls/js-files:
2542         * Modules/modern-media-controls/media/media-controller.js:
2543         (MediaController):
2544         * Modules/modern-media-controls/media/status-support.js: Added.
2545         (StatusSupport.prototype.get control):
2546         (StatusSupport.prototype.get mediaEvents):
2547         (StatusSupport.prototype.syncControl):
2548         (StatusSupport):
2549         * WebCore.xcodeproj/project.pbxproj:
2550
2551 2016-11-09  Zalan Bujtas  <zalan@apple.com>
2552
2553         No need to set setFlowThreadState on RenderText in createTextRenderer.
2554         https://bugs.webkit.org/show_bug.cgi?id=164559
2555
2556         Reviewed by Antti Koivisto.
2557
2558        setFlowThreadState in create*Renderer ensures that by the time we issue the initial call to
2559        styleWillChange/styleDidChange through initializeStyle, the state is already set.
2560        However since RenderText does not have its own style, it's sufficient to have the flow state set
2561        through the normal RenderElement::insertChildInternal code path.
2562
2563         No change in functionality.
2564
2565         * style/RenderTreeUpdater.cpp:
2566         (WebCore::createTextRenderer):
2567
2568 2016-11-09  Brady Eidson  <beidson@apple.com>
2569
2570         IndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion.
2571         https://bugs.webkit.org/show_bug.cgi?id=164504
2572
2573         Reviewed by Darin Adler.
2574
2575         No new tests (Refactor, no behavior change).
2576
2577         This patch literally just takes the "key" and "count" arguments and encapsulates them in a struct.
2578         That struct will then be easily expandable in the future (e.g. bug 164404).
2579
2580         * Modules/indexeddb/IDBCursor.cpp:
2581         (WebCore::IDBCursor::uncheckedIterateCursor):
2582         
2583         * Modules/indexeddb/IDBTransaction.cpp:
2584         (WebCore::IDBTransaction::iterateCursor):
2585         (WebCore::IDBTransaction::iterateCursorOnServer):
2586         * Modules/indexeddb/IDBTransaction.h:
2587         
2588         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2589         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
2590         * Modules/indexeddb/client/IDBConnectionProxy.h:
2591         
2592         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2593         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
2594         * Modules/indexeddb/client/IDBConnectionToServer.h:
2595         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2596         
2597         * Modules/indexeddb/server/IDBBackingStore.h:
2598         
2599         * Modules/indexeddb/server/IDBServer.cpp:
2600         (WebCore::IDBServer::IDBServer::iterateCursor):
2601         * Modules/indexeddb/server/IDBServer.h:
2602         
2603         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
2604         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
2605         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
2606         
2607         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2608         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
2609         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2610         
2611         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2612         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
2613         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
2614         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2615         
2616         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
2617         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
2618         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
2619         
2620         * Modules/indexeddb/shared/IDBIterateCursorData.cpp: Added.
2621         (WebCore::IDBIterateCursorData::isolatedCopy):
2622         * Modules/indexeddb/shared/IDBIterateCursorData.h: Added.
2623         (WebCore::IDBIterateCursorData::encode):
2624         (WebCore::IDBIterateCursorData::decode):
2625
2626         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2627         (WebCore::InProcessIDBServer::iterateCursor):
2628         * Modules/indexeddb/shared/InProcessIDBServer.h:
2629
2630         * CMakeLists.txt:
2631         * WebCore.xcodeproj/project.pbxproj:
2632
2633 2016-11-09  Ryosuke Niwa  <rniwa@webkit.org>
2634
2635         StyledElement::attributeChanged shouldn't do any work when the attribute value didn't change
2636         https://bugs.webkit.org/show_bug.cgi?id=129476
2637
2638         Reviewed by Andreas Kling.
2639
2640         Avoid calling styleAttributeChanged and setPresentationAttributeStyleIsDirty
2641         when the attribute value didn't change as in r164856.
2642
2643         * dom/StyledElement.cpp:
2644         (WebCore::StyledElement::attributeChanged):
2645
2646 2016-11-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2647
2648         [DOMJIT] Implement Node::ownerDocument
2649         https://bugs.webkit.org/show_bug.cgi?id=164004
2650
2651         Reviewed by Darin Adler.
2652
2653         Test: js/dom/domjit-accessor-owner-document.html
2654
2655         Still I cannot reproduce this crash in x64 environment, according to the crash log, it accesses 0x8 address.
2656         This can happen if document() accidentally returns nullptr. In the C++ ownerDocument implementation,
2657         if document() returns nullptr, it just returns nullptr. But in the DOMJIT implementation, we assume that
2658         document() won't return nullptr and access the member of it.
2659
2660         This patch aligns the DOMJIT implementation strictly to the C++ one.
2661
2662         * dom/Node.idl:
2663         * domjit/JSNodeDOMJIT.cpp:
2664         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM):
2665         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
2666
2667 2016-11-09  Sam Weinig  <sam@webkit.org>
2668
2669         [SVG] Start moving special casing of SVG out of the bindings - SVGAngle
2670         https://bugs.webkit.org/show_bug.cgi?id=164496
2671
2672         Reviewed by Darin Adler.
2673
2674         There is quite a bit of special casing of SVG types in the bindings that adds
2675         a lot of complexity and is relatively fragile, as it is based on type naming.
2676
2677         Instead of keeping the complexity in the bindings, I am going to move it into
2678         the implementation, where it has also longed to be. 
2679
2680         Starting small, with just SVGAngle. It has been split in two, with the existing
2681         SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name
2682         SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from 
2683         SVGPropertyTearOff<SVGAngleValue>).
2684
2685         * CMakeLists.txt:
2686         * WebCore.xcodeproj/project.pbxproj:
2687         Add SVGAngleValue.cpp
2688
2689         * bindings/scripts/CodeGenerator.pm:
2690         Remove SVGAngle as a special case.
2691
2692         * svg/SVGAngle.cpp: Removed.
2693         * svg/SVGAngle.h:
2694         Added. Implements the SVGAngle interface explicitly, getting to
2695         the SVGAngleValue through propertyReference().
2696
2697         * svg/SVGAngle.idl:
2698         * svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp.
2699         * svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h.
2700         Move old SVGAngle implementation to SVGAngleValue.
2701
2702         * svg/SVGAnimatedAngle.cpp:
2703         Replace SVGAngle usage with SVGAngleValue.
2704
2705         * svg/SVGAnimatedAngle.h:
2706         Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle>
2707         as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter.
2708
2709         * svg/SVGAnimatedLength.h:
2710         * svg/SVGAnimatedPreserveAspectRatio.h:
2711         * svg/SVGAnimatedRect.h:
2712         Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff.
2713
2714         * svg/SVGAnimatedType.cpp:
2715         (WebCore::SVGAnimatedType::createAngleAndEnumeration):
2716         * svg/SVGAnimatedType.h:
2717         (WebCore::SVGAnimatedType::angleAndEnumeration):
2718         Use SVGAngleValue.
2719
2720         * svg/SVGComponentTransferFunctionElement.h:
2721         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
2722
2723         * svg/SVGMarkerElement.cpp:
2724         (WebCore::SVGMarkerElement::parseAttribute):
2725         (WebCore::SVGMarkerElement::setOrient):
2726         Switch to take an SVGAngleValue.
2727
2728         (WebCore::SVGMarkerElement::setOrientToAngle):
2729         Update to pull the value out via propertyReference().
2730
2731         * svg/SVGMarkerElement.h:
2732         Switch to take an SVGAngleValue.
2733
2734         * svg/SVGLengthList.h:
2735         * svg/SVGNumberList.h:
2736         * svg/SVGPathSegList.h:
2737         * svg/SVGPointList.h:
2738         * svg/SVGStringList.h:
2739         * svg/SVGTransformList.h:
2740         Switch to using type aliases in SVGPropertyTraits and add an alias for
2741         ListItemTearOff.
2742
2743         * svg/SVGSVGElement.cpp:
2744         (WebCore::SVGSVGElement::createSVGAngle):
2745         * svg/SVGSVGElement.h:
2746         Change createSVGAngle to return a Ref<SVGAngle> and create one.
2747
2748         * svg/SVGSVGElement.idl:
2749         Annotate IDL to indicate that a new value is being returned.
2750
2751         * svg/SVGTransform.cpp:
2752         Remove unnecessary include of SVGAngle.h.
2753
2754         * svg/SVGViewSpec.cpp:
2755         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
2756
2757         * svg/properties/SVGAnimatedPropertyTearOff.h:
2758         Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the
2759         Property type from the TearOffType.
2760
2761         * svg/properties/SVGListProperty.h:
2762         * svg/properties/SVGListPropertyTearOff.h:
2763         Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property
2764         type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits.
2765
2766         * svg/properties/SVGPropertyTearOff.h:
2767         Make the PropertyType available by exposing it as a type alias.
2768
2769 2016-11-09  Darin Adler  <darin@apple.com>
2770
2771         Move Range from ExceptionCode to ExceptionOr
2772         https://bugs.webkit.org/show_bug.cgi?id=164457
2773
2774         Reviewed by Alex Christensen.
2775
2776         * accessibility/AXObjectCache.cpp:
2777         (WebCore::AXObjectCache::rangeForNodeContents): Update to use ExceptionOr,
2778         keeping behavior the same.
2779         (WebCore::characterOffsetsInOrder): Ditto.
2780         (WebCore::setRangeStartOrEndWithCharacterOffset): Changed argument to a
2781         reference instead of a pointer. Use a boolean return value to indicate
2782         success rather than an exception, since the callers don't need to know
2783         which exception it is.
2784         (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Updated for
2785         the above.
2786         (WebCore::AXObjectCache::nextBoundary): Ditto.
2787         (WebCore::AXObjectCache::previousBoundary): Ditto.
2788
2789         * accessibility/AccessibilityObject.cpp:
2790         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection):
2791         Update to use ExceptionOr, keeping behavior the same.
2792         * accessibility/AccessibilityRenderObject.cpp:
2793         (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange): Ditto.
2794         * accessibility/atk/WebKitAccessibleUtil.cpp:
2795         (selectionBelongsToObject): Ditto.
2796         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2797         (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Ditto.
2798         * dom/Node.cpp:
2799         (WebCore::Node::textRects): Ditto.
2800
2801         * dom/Range.cpp:
2802         (WebCore::Range::~Range): Remove old comment that no longer makes sense now
2803         that the detach function no longer does anything.
2804         (WebCore::checkForDifferentRootContainer): Updated to use ExceptionOr,
2805         keeping behavior the same.
2806         (WebCore::Range::setStart): Ditto.
2807         (WebCore::Range::setEnd): Ditto.
2808         (WebCore::Range::isPointInRange): Ditto.
2809         (WebCore::Range::comparePoint): Ditto.
2810         (WebCore::Range::compareNode): Ditto.
2811         (WebCore::top): Added helper function so that compareBoundaryPoints doesn't
2812         need to have two identical loops in it.
2813         (WebCore::Range::compareBoundaryPoints): Updated to use ExceptionOr,
2814         keeping behavior the same.
2815         (WebCore::Range::compareBoundaryPointsForBindings): Ditto. Also use a switch
2816         instead of relying on the order of the values to check for unsupported values.
2817         (WebCore::Range::boundaryPointsValid): Ditto.
2818         (WebCore::Range::deleteContents): Ditto.
2819         (WebCore::Range::intersectsNode): Ditto.
2820         (WebCore::Range::processContents): Ditto.
2821         (WebCore::deleteCharacterData): Ditto.
2822         (WebCore::processContentsBetweenOffsets): Ditto. Also changed to be a
2823         non-member function and private to this file instead of in the class.
2824         (WebCore::processNodes): Ditto. Also changed one argument to be a RefPtr
2825         since the code relies on using it after mutating the DOM.
2826         (WebCore::processAncestorsAndTheirSiblings): Ditto. Changed one argument type
2827         to use ExceptionOr so the caller doesn't have to check the exception first.
2828         (WebCore::Range::extractContents): Ditto.
2829         (WebCore::Range::cloneContents): Ditto.
2830         (WebCore::Range::insertNode): Ditto. Also fixed to only call nodeType once
2831         instead of three times.
2832         (WebCore::Range::toString): Ditto. Also fixed to call nodeType only once
2833         per node instead of twice, to use downcast instead of static_cast, and to
2834         use the word "node" instead of "n" for the local variable name.
2835         (WebCore::Range::createContextualFragment): Ditto.
2836         (WebCore::Range::checkNodeWOffset): Ditto.
2837         (WebCore::Range::setStartAfter): Ditto.
2838         (WebCore::Range::setEndBefore): Ditto.
2839         (WebCore::Range::setEndAfter): Ditto.
2840         (WebCore::Range::selectNode): Ditto.
2841         (WebCore::Range::selectNodeContents): Ditto.
2842         (WebCore::Range::surroundContents): Ditto.
2843         (WebCore::Range::setStartBefore): Ditto.
2844         (WebCore::Range::contains): Ditto. Except added code to handle exception
2845         case to return false without asserting because I saw at least one crash
2846         that seemed to imply this behavior was needed.
2847         (WebCore::rangesOverlap): Ditto.
2848         (WebCore::rangeOfContents): Ditto.
2849         (WebCore::Range::expand): Ditto.
2850         (WebCore::Range::getClientRects): Ditto.
2851         (WebCore::Range::getBoundingClientRect): Ditto.
2852         (WebCore::Range::borderAndTextQuads): Changed to use return value
2853         instead of out argument, since it's a private function used only
2854         within this class so it was easy to update all call sites.
2855         (WebCore::Range::boundingRect): Updated for above. Also renamed since
2856         there was no need for the name "internal" in this.
2857         (WebCore::Range::absoluteBoundingRect): Ditto.
2858         * dom/Range.h: Updated for above.
2859         * dom/Range.idl: Use non-legacy exceptions. Also changed the default value
2860         of the string argument to the expand function to the empty string rather
2861         than "undefined", because the function silently does nothing when passed
2862         any unrecognized string, and so this leaves behavior unchanged. I removed
2863         the comment saying that the "undefined" default is wrong.
2864
2865         * editing/AlternativeTextController.cpp:
2866         (WebCore::AlternativeTextController::applyAlternativeTextToRange): Updated
2867         to use ExceptionOr but behave the same.
2868         * editing/Editor.cpp:
2869         (WebCore::Editor::advanceToNextMisspelling): Ditto.
2870         (WebCore::Editor::markAndReplaceFor): Ditto.
2871         (WebCore::isFrameInRange): Ditto. Also made a few style tweaks.
2872         (WebCore::Editor::countMatchesForText): Ditto.
2873         * editing/EditorCommand.cpp:
2874         (WebCore::unionDOMRanges): Ditto.
2875         * editing/FrameSelection.cpp:
2876         (WebCore::FrameSelection::respondToNodeModification): Ditto.
2877         * editing/InsertListCommand.cpp:
2878         (WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
2879         * editing/TextCheckingHelper.cpp:
2880         (WebCore::TextCheckingParagraph::offsetTo): Ditto.
2881         * editing/TextCheckingHelper.h: Updated for above and also deleted
2882         unneeded private function checkingRange, which just churned the
2883         reference count unnecessarily; instead use m_checkingRange directly.
2884         * editing/TextIterator.cpp:
2885         (WebCore::TextIterator::getLocationAndLengthFromRange): Ditto.
2886         * editing/VisiblePosition.cpp:
2887         (WebCore::setStart): Ditto.
2888         (WebCore::setEnd): Ditto.
2889         * editing/VisibleSelection.cpp:
2890         (WebCore::makeSearchRange): Ditto.
2891
2892         * editing/VisibleUnits.cpp:
2893         (WebCore::suffixLengthForRange): Changed argument from RefPtr to
2894         a reference.
2895         (WebCore::prefixLengthForRange): Ditto.
2896         (WebCore::previousBoundary): Updated for ExceptionOr and the change
2897         above.
2898         (WebCore::nextBoundary): Ditto.
2899         * editing/VisibleUnits.h: Updated for above.
2900
2901         * editing/htmlediting.cpp:
2902         (WebCore::comparePositions): Updated to use ExceptionOr but behave
2903         the same.
2904         (WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
2905         (WebCore::isNodeVisiblyContainedWithin): Ditto.
2906         * editing/ios/EditorIOS.mm:
2907         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
2908         (WebCore::Editor::setTextAsChildOfElement): Ditto.
2909         * editing/mac/EditorMac.mm:
2910         (WebCore::Editor::adjustedSelectionRange): Ditto.
2911         * editing/markup.cpp:
2912         (WebCore::createMarkupInternal): Ditto.
2913         * page/ContextMenuController.cpp:
2914         (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
2915         * page/DOMSelection.cpp:
2916         (WebCore::DOMSelection::addRange): Ditto.
2917         (WebCore::DOMSelection::deleteFromDocument): Ditto.
2918         (WebCore::DOMSelection::containsNode): Ditto.
2919
2920         * page/EventHandler.cpp:
2921         (WebCore::EventHandler::dispatchMouseEvent): Updated for change to
2922         use ExceptionOr in Ragne::compareNode. Also refactored the function
2923         to make the logic a little mroe straightforward and nest less of it
2924         inside a loop.
2925
2926         * page/Page.cpp:
2927         (WebCore::Page::findStringMatchingRanges): Updated for ExceptionOr
2928         without changing behavior.
2929         * page/TextIndicator.cpp:
2930         (WebCore::hasNonInlineOrReplacedElements): Ditto.
2931         * rendering/RenderNamedFlowThread.cpp:
2932         (WebCore::RenderNamedFlowThread::getRanges): Ditto.
2933
2934 2016-11-09  Dave Hyatt  <hyatt@apple.com>
2935
2936         [CSS Parser] Fix grid layout parsing
2937         https://bugs.webkit.org/show_bug.cgi?id=164489
2938
2939         Reviewed by Dean Jackson.
2940
2941         * css/CSSValueKeywords.in:
2942         * css/parser/CSSPropertyParser.cpp:
2943         (WebCore::consumeFitContent):
2944         (WebCore::isGridTrackFixedSized):
2945         (WebCore::consumeGridTrackSize):
2946         (WebCore::consumeGridTrackRepeatFunction):
2947         (WebCore::consumeGridTrackList):
2948         (WebCore::isCustomIdentValue):
2949         (WebCore::CSSPropertyParser::consumeGridItemPositionShorthand):
2950         (WebCore::CSSPropertyParser::consumeGridAreaShorthand):
2951         (WebCore::consumeImplicitGridAutoFlow):
2952         (WebCore::CSSPropertyParser::consumeGridShorthand):
2953
2954 2016-11-09  Darin Adler  <darin@apple.com>
2955
2956         Move EventTarget from ExceptionCode to ExceptionOr
2957         https://bugs.webkit.org/show_bug.cgi?id=164465
2958
2959         Reviewed by Youenn Fablet.
2960
2961         * Modules/indexeddb/IDBRequest.h: Added now-needed forward
2962         class declarations.
2963         * Modules/webaudio/AudioContext.h: Ditto.
2964
2965         * bindings/js/JSEventListener.cpp:
2966         (WebCore::eventHandlerAttribute): Updated for name change of the
2967         attributeEventListener function.
2968         (WebCore::documentEventHandlerAttribute): Ditto.
2969         * dom/Document.cpp:
2970         (WebCore::Document::getWindowAttributeEventListener): Ditto.
2971
2972         * dom/EventTarget.cpp:
2973         (WebCore::EventTarget::setAttributeEventListener): Updated for
2974         name change.
2975         (WebCore::EventTarget::attributeEventListener): Ditto.
2976         (WebCore::EventTarget::dispatchEventForBindings): Use ExceptionOr.
2977         (WebCore::legacyType): Use null instead of empty for no type, since
2978         it's more efficient to check for null.
2979         (WebCore::EventTarget::fireEventListeners): Check for null.
2980         Also streamlined logic a little bit and removed a very old comment.
2981         (WebCore::EventTarget::eventListeners): Renamed from getEventListeners.
2982         * dom/EventTarget.h: Removed lots of unneeded declarations. Renamed
2983         some functions to remove get prefix. Updated for above changes.
2984         Moved one inline function out of the class header. Made the destructor
2985         for EventTarget be inline to make the destructors for derived classes
2986         slightly more efficient.
2987         * dom/EventTarget.idl: Use non-legacy exception.
2988
2989         * dom/Node.cpp:
2990         (WebCore::Node::didMoveToNewDocument): Updated for name change.
2991         * editing/ReplaceSelectionCommand.cpp:
2992         (WebCore::ReplacementFragment::ReplacementFragment): Ditto.
2993
2994         * inspector/InspectorCSSAgent.h: Added now-needed forward declaration.
2995
2996         * inspector/InspectorDOMAgent.cpp:
2997         (WebCore::InspectorDOMAgent::getEventListeners): Updated for name change.
2998
2999         * inspector/InspectorInstrumentation.h: Added now-needed forward declaration.
3000         * page/DOMWindow.h: Ditto.
3001         * xml/XMLHttpRequest.h: Ditto.
3002
3003 2016-11-09  Daniel Bates  <dabates@apple.com>
3004
3005         Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
3006         https://bugs.webkit.org/show_bug.cgi?id=164389
3007         <rdar://problem/29101072>
3008
3009         Reviewed by Alex Christensen.
3010
3011         Add test infrastructure to support registering an arbitrary port as the default port
3012         for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery,
3013         can be effected by whether the resource request was made using the default port for
3014         the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow
3015         a test to override the default port associated with a protocol so as to support
3016         testing these code paths using the existing port 8000 server started by run-webkit-httpd.
3017         Without window.internals.registerDefaultPortForProtocol() we would need to teach
3018         run-webkit-httpd to run a web server on port 80, which requires superuser privileges
3019         (since it is a privileged port number) and is more likely to interfere with an
3020         existing web server setup.
3021
3022         Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html
3023                http/tests/security/http-0.9/default-port-script-blocked.html
3024                http/tests/security/http-0.9/iframe-blocked.html
3025                http/tests/security/http-0.9/image-blocked.html
3026                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html
3027                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html
3028                http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html
3029                http/tests/security/http-0.9/worker-connect-src-blocked.html
3030                http/tests/security/http-0.9/worker-importScripts-blocked.html
3031                http/tests/security/http-0.9/xhr-asynchronous-blocked.html
3032
3033         * platform/URL.cpp:
3034         (WebCore::defaultPortForProtocolMapForTesting): Added.
3035         (WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the
3036         mapping used for testing.
3037         (WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map.
3038         We call this function from Internals::resetToConsistentState() so that the mapping is cleared between
3039         test runs.
3040         (WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing
3041         before consulting URLParser::defaultPortForProtocol().
3042         * platform/URL.h:
3043         * testing/Internals.cpp:
3044         (WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing.
3045         (WebCore::Internals::registerDefaultPortForProtocol): Added.
3046         * testing/Internals.h:
3047         * testing/Internals.idl: Added declaration for registerDefaultPortForProtocol().
3048
3049 2016-11-09  Sam Weinig  <sam@webkit.org>
3050
3051         [WebIDL] Add proper parsing for Promises
3052         https://bugs.webkit.org/show_bug.cgi?id=164497
3053
3054         Reviewed by Tim Horton.
3055
3056         * bindings/scripts/IDLParser.pm:
3057         (parseNonAnyType):
3058         (parseStringType):
3059         Require Promise types to declare the type they resolve to.
3060         
3061         * bindings/js/JSDOMPromise.h:
3062         Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
3063         overload of resolve that takes no arguments when in a DOMPromise<void>.
3064
3065         * Modules/applepay/ApplePaySession.idl:
3066         * Modules/fetch/DOMWindowFetch.idl:
3067         * Modules/fetch/FetchBody.idl:
3068         * Modules/fetch/FetchResponse.idl:
3069         * Modules/fetch/WorkerGlobalScopeFetch.idl:
3070         * Modules/mediastream/MediaDevices.idl:
3071         * Modules/mediastream/MediaStreamTrack.idl:
3072         * Modules/mediastream/RTCPeerConnection.idl:
3073         * Modules/mediastream/RTCRtpSender.idl:
3074         * Modules/mediastream/RTCStatsReport.idl:
3075         * Modules/streams/ReadableStream.idl:
3076         * Modules/streams/ReadableStreamDefaultReader.idl:
3077         * Modules/streams/ReadableStreamSource.idl:
3078         * Modules/streams/WritableStream.idl:
3079         * Modules/webaudio/AudioContext.idl:
3080         * bindings/scripts/test/TestNode.idl:
3081         * bindings/scripts/test/TestObj.idl:
3082         * crypto/SubtleCrypto.idl:
3083         * crypto/WebKitSubtleCrypto.idl:
3084         * css/FontFace.idl:
3085         * css/FontFaceSet.idl:
3086         * dom/CustomElementRegistry.idl:
3087         * html/HTMLMediaElement.idl:
3088         Update IDLs to specify the resolve type of promise types.
3089
3090         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3091         (WebCore::MediaEndpointPeerConnection::replaceTrack):
3092         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
3093         * Modules/mediastream/MediaStreamTrack.cpp:
3094         (WebCore::MediaStreamTrack::applyConstraints):
3095         * Modules/mediastream/MediaStreamTrack.h:
3096         * Modules/mediastream/PeerConnectionBackend.cpp:
3097         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
3098         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
3099         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
3100         * Modules/mediastream/PeerConnectionBackend.h:
3101         * Modules/streams/ReadableStreamSource.h:
3102         (WebCore::ReadableStreamSource::start):
3103         (WebCore::ReadableStreamSource::pull):
3104         (WebCore::ReadableStreamSource::startFinished):
3105         (WebCore::ReadableStreamSource::pullFinished):
3106         * Modules/webaudio/AudioContext.cpp:
3107         (WebCore::AudioContext::addReaction):
3108         (WebCore::AudioContext::setState):
3109         (WebCore::AudioContext::suspend):
3110         (WebCore::AudioContext::resume):
3111         (WebCore::AudioContext::close):
3112         * Modules/webaudio/AudioContext.h:
3113         * html/HTMLMediaElement.cpp:
3114         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
3115         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
3116         (WebCore::HTMLMediaElement::play):
3117         * html/HTMLMediaElement.h:
3118         Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t>
3119         and use the new resolve() overload.
3120
3121 2016-11-07  Brady Eidson  <beidson@apple.com>
3122
3123         Followup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction* be an IDBTransaction&
3124
3125         Rubberstamped by Alex Christensen.
3126
3127         No new tests (No behavior change).
3128
3129         * Modules/indexeddb/IDBObjectStore.cpp:
3130         (WebCore::IDBObjectStore::IDBObjectStore):
3131         (WebCore::IDBObjectStore::~IDBObjectStore):
3132         (WebCore::IDBObjectStore::hasPendingActivity):
3133         (WebCore::IDBObjectStore::name):
3134         (WebCore::IDBObjectStore::setName):
3135         (WebCore::IDBObjectStore::keyPath):
3136         (WebCore::IDBObjectStore::indexNames):
3137         (WebCore::IDBObjectStore::transaction):
3138         (WebCore::IDBObjectStore::autoIncrement):
3139         (WebCore::IDBObjectStore::openCursor):
3140         (WebCore::IDBObjectStore::openKeyCursor):
3141         (WebCore::IDBObjectStore::get):
3142         (WebCore::IDBObjectStore::putOrAdd):
3143         (WebCore::IDBObjectStore::doDelete):
3144         (WebCore::IDBObjectStore::clear):
3145         (WebCore::IDBObjectStore::createIndex):
3146         (WebCore::IDBObjectStore::index):
3147         (WebCore::IDBObjectStore::deleteIndex):
3148         (WebCore::IDBObjectStore::doCount):
3149         (WebCore::IDBObjectStore::getAll):
3150         (WebCore::IDBObjectStore::getAllKeys):
3151         (WebCore::IDBObjectStore::markAsDeleted):
3152         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
3153         (WebCore::IDBObjectStore::ref):
3154         (WebCore::IDBObjectStore::deref):
3155         * Modules/indexeddb/IDBObjectStore.h:
3156
3157 2016-11-09  Zalan Bujtas  <zalan@apple.com>
3158
3159         Move RenderNamedFlowThread nextRendererForElement logic to RenderTreeUpdater.
3160         https://bugs.webkit.org/show_bug.cgi?id=164503
3161
3162         Reviewed by Antti Koivisto.
3163
3164         When we insert a renderer into the render tree, we need to know both its parent
3165         and its next sibling. Normally the parent and the sibling are based on the DOM, but
3166         when this renderer is part of a flow thread, its insertion sibling is not necessarily the DOM sibling.
3167         To find the correct sibling, we call RenderNamedFlowThread's nextRendererForElement().
3168         RenderNamedFlowThread keeps track of its children so that it can compute the next sibling
3169         for the insertion point.
3170
3171         This patch eliminates the need for keeping track of the child renderers of each
3172         flow by moving the 'next sibling' logic to RenderTreePosition.
3173
3174         No change in functionality.
3175
3176         * rendering/RenderElement.cpp:
3177         (WebCore::RenderElement::insertedIntoTree):
3178         (WebCore::RenderElement::willBeDestroyed):
3179         (WebCore::RenderElement::removeFromRenderFlowThread):
3180         (WebCore::RenderElement::renderNamedFlowThreadWrapper): Deleted.
3181         * rendering/RenderElement.h:
3182         * rendering/RenderNamedFlowThread.cpp:
3183         (WebCore::RenderNamedFlowThread::nextRendererForElement): Deleted.
3184         (WebCore::RenderNamedFlowThread::addFlowChild): Deleted.
3185         (WebCore::RenderNamedFlowThread::removeFlowChild): Deleted.
3186         * rendering/RenderNamedFlowThread.h:
3187         * style/RenderTreePosition.cpp:
3188         (WebCore::RenderTreePosition::previousSiblingRenderer):
3189         (WebCore::RenderTreePosition::flowThreadInsertionContext):
3190         * style/RenderTreePosition.h:
3191         (WebCore::RenderTreePosition::RenderTreePosition):
3192         (WebCore::RenderTreePosition::parent):
3193         * style/RenderTreeUpdater.cpp:
3194         (WebCore::registerElementForFlowThreadIfNeeded): We need to registed the element even when it does not create renderer (display: none).
3195         (WebCore::RenderTreeUpdater::createRenderer):
3196         (WebCore::moveToFlowThreadIfNeeded): Deleted.
3197
3198 2016-11-09  Per Arne Vollan  <pvollan@apple.com>
3199
3200         [Win][Direct2D] Incomplete image decoding.
3201         https://bugs.webkit.org/show_bug.cgi?id=164511
3202
3203         Reviewed by Darin Adler.
3204
3205         Create native decoder when all image data has been received.
3206
3207         * platform/graphics/win/ImageDecoderDirect2D.cpp:
3208         (WebCore::ImageDecoder::setData):
3209
3210 2016-11-09  Beth Dakin  <bdakin@apple.com>
3211
3212         Attempted build fix.
3213
3214         * platform/spi/cocoa/AVKitSPI.h:
3215
3216 2016-11-09  Brady Eidson  <beidson@apple.com>
3217
3218         IndexedDB 2.0: Clean up more transaction abort behavior, including tweaks to Index/ObjectStore lifetime.
3219         https://bugs.webkit.org/show_bug.cgi?id=164466
3220
3221         Reviewed by Alex Christensen.
3222
3223         No new tests (Covered by existing tests that now pass).
3224         
3225         Previously, IDBIndex ref/deref didn't track a traditional ref count but instead kept the owning object store alive.
3226         Now, IDBObjectStore ref/deref do the same thing for the owning transaction.
3227         
3228         Now when a version change transaction is rolled back, some object stores and indexes get pulled out of the "deleted"
3229         set and get promoted back up into the "referenced" set.
3230         
3231         Now deleted object stores/indexes are considered opaque roots, as live objects in the deleted state *can* get back
3232         to the owning objects.
3233
3234         * CMakeLists.txt:
3235         * WebCore.xcodeproj/project.pbxproj:
3236
3237         * Modules/indexeddb/IDBIndex.cpp:
3238         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
3239
3240         * Modules/indexeddb/IDBObjectStore.cpp:
3241         (WebCore::IDBObjectStore::IDBObjectStore):
3242         (WebCore::IDBObjectStore::indexNames):
3243         (WebCore::IDBObjectStore::transaction):
3244         (WebCore::IDBObjectStore::openCursor):
3245         (WebCore::IDBObjectStore::openKeyCursor):
3246         (WebCore::IDBObjectStore::deleteIndex):
3247         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
3248         (WebCore::IDBObjectStore::visitReferencedIndexes):
3249         (WebCore::IDBObjectStore::ref):
3250         (WebCore::IDBObjectStore::deref):
3251         (WebCore::IDBObjectStore::create): Deleted.
3252         * Modules/indexeddb/IDBObjectStore.h:
3253
3254         * Modules/indexeddb/IDBTransaction.cpp:
3255         (WebCore::IDBTransaction::objectStore):
3256         (WebCore::IDBTransaction::transitionedToFinishing):
3257         (WebCore::IDBTransaction::internalAbort):
3258         (WebCore::IDBTransaction::createObjectStore):
3259         (WebCore::IDBTransaction::deleteObjectStore):
3260         (WebCore::IDBTransaction::visitReferencedObjectStores):
3261         * Modules/indexeddb/IDBTransaction.h:
3262         * Modules/indexeddb/IDBTransaction.idl:
3263
3264         * bindings/js/JSIDBTransactionCustom.cpp: Added.
3265         (WebCore::JSIDBTransaction::visitAdditionalChildren):
3266
3267 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
3268
3269         Allow customization of TextStream-based logging for geometry types
3270         https://bugs.webkit.org/show_bug.cgi?id=164460
3271
3272         Reviewed by Zalan Bujtas.
3273
3274         TextStream-based logging was constrained by the requirement to maintain compatibility
3275         with DRT-style output, which includes cumbersome rect logging ("at (5,0) size 40x40")
3276         and dumping LayoutRects as IntRects.
3277         
3278         Add some formatting flags so that other TextStream clients (e.g. logging) can have
3279         more readable output, and opt into automatic FormatNumberRespectingIntegers behavior.
3280         
3281         TextStreams whose output appears in test results are given flags to avoid behavior
3282         changes, but in the longer term test results should be updated.
3283
3284         * html/canvas/CanvasRenderingContext2D.cpp:
3285         (WebCore::CanvasRenderingContext2D::replayDisplayListAsText):
3286         * page/scrolling/ScrollingStateNode.cpp:
3287         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
3288         * platform/graphics/FloatPoint.cpp:
3289         (WebCore::operator<<):
3290         * platform/graphics/FloatRect.cpp:
3291         (WebCore::operator<<):
3292         * platform/graphics/GraphicsLayer.cpp:
3293         (WebCore::GraphicsLayer::layerTreeAsText):
3294         * platform/graphics/IntRect.cpp:
3295         (WebCore::operator<<):
3296         * platform/graphics/LayoutPoint.cpp:
3297         (WebCore::operator<<):
3298         * platform/graphics/LayoutRect.cpp:
3299         (WebCore::operator<<):
3300         * platform/graphics/ca/GraphicsLayerCA.cpp:
3301         (WebCore::GraphicsLayerCA::replayDisplayListAsText):
3302         * platform/graphics/displaylists/DisplayList.cpp:
3303         (WebCore::DisplayList::DisplayList::asText):
3304         * platform/text/TextStream.cpp:
3305         (WebCore::TextStream::operator<<):
3306         * platform/text/TextStream.h:
3307         (WebCore::TextStream::TextStream):
3308         (WebCore::TextStream::formattingFlags):
3309         (WebCore::TextStream::setFormattingFlags):
3310         (WebCore::TextStream::hasFormattingFlag):
3311         (WebCore::TextStream::increaseIndent):
3312         (WebCore::TextStream::decreaseIndent):
3313         * rendering/RenderTreeAsText.cpp:
3314         (WebCore::externalRepresentation):
3315         (WebCore::counterValueForElement):
3316
3317 2016-11-09  Zalan Bujtas  <zalan@apple.com>
3318
3319         RenderFlowThread::flowThreadRelativeWillBeRemoved should take RenderObject& instead of RenderObject*
3320         https://bugs.webkit.org/show_bug.cgi?id=164543
3321
3322         Reviewed by Simon Fraser.
3323
3324         No change in functionality.
3325
3326         * rendering/RenderBlockFlow.cpp:
3327         (WebCore::RenderBlockFlow::removeChild):
3328         * rendering/RenderFlowThread.h:
3329         * rendering/RenderMultiColumnFlowThread.cpp:
3330         (WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval):
3331         (WebCore::RenderMultiColumnFlowThread::flowThreadRelativeWillBeRemoved):
3332         * rendering/RenderMultiColumnFlowThread.h:
3333
3334 2016-11-09  Jer Noble  <jer.noble@apple.com>
3335
3336         REGRESSION (r208149): Media scrubber is not displayed in media controls
3337         https://bugs.webkit.org/show_bug.cgi?id=164514
3338
3339         Reviewed by Darin Adler.
3340
3341         Fixes broken Media Controls API tests.
3342
3343         Added a new PlatformMediaSessionType; need to add that same type to the TYPE_TRAITS section of 
3344         MediaElementSession.h so that is<> and downcast<> work correctly.
3345
3346         * html/MediaElementSession.h:
3347         (isType):
3348
3349 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3350
3351         When editing IME, `compositionend` events should fire after input events
3352         https://bugs.webkit.org/show_bug.cgi?id=164324
3353         <rdar://problem/29050438>
3354
3355         Reviewed by Darin Adler.
3356
3357         Moves where we dispatch `compositionend` events to after applying editing commands that fire `beforeinput` or
3358         `input` events. Also augments existing layout tests to verify the change.
3359
3360         * editing/Editor.cpp:
3361         (WebCore::Editor::setComposition):
3362
3363 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3364
3365         Setting foreground color when text is selected should fire an input event with color data
3366         https://bugs.webkit.org/show_bug.cgi?id=164241
3367         <rdar://problem/29032759>
3368
3369         Reviewed by Darin Adler.
3370
3371         Refactors Editor::applyStyle and Editor::applyParagraphStyle to handle beforeinput and input event dispatch.
3372         Instead of going through the ApplyStyleCommand to dispatch input events, override shouldDispatchInputEvents to
3373         return false. This strategy also has the effect of unifying the way input events are dispatched in applyStyle,
3374         in both codepaths where we computeAndSetTypingStyle and where we create and then apply a style command.
3375
3376         Test: fast/events/input-events-selection-forecolor-data.html
3377
3378         * editing/ApplyStyleCommand.h:
3379         * editing/Editor.cpp:
3380         (WebCore::inputEventDataForEditingStyleAndAction):
3381         (WebCore::Editor::applyStyle):
3382         (WebCore::Editor::applyParagraphStyle):
3383         (WebCore::Editor::computeAndSetTypingStyle):
3384
3385 2016-11-08  Dean Jackson  <dino@apple.com>
3386
3387         Rendering support for ExtendedColors
3388         https://bugs.webkit.org/show_bug.cgi?id=164443
3389         <rdar://problems/29123243>
3390
3391         Reviewed by Simon Fraser and Darin Adler.
3392
3393         Add support for rendering the new color() syntax, which
3394         ends up as an ExtendedColor.
3395
3396         In order to make rendering code a little more readable, I
3397         changed Color::hasAlpha to Color::isOpaque (since an alpha
3398         of 100% is still an alpha), and added a Color::isVisible
3399         helper (the color isn't completely transparent). These new
3400         helpers support ExtendedColor forms.
3401
3402         Support for painting gradients and blending between colors
3403         is still to come. I also added some FIXME comments
3404         to show other places that don't handle ExtendedColors yet.
3405
3406         Tests: css3/color/backgrounds-and-borders.html
3407                css3/color/box-shadows.html
3408                css3/color/canvas.html
3409                css3/color/composited-solid-backgrounds.html
3410                css3/color/text.html
3411
3412         * css/CSSGradientValue.cpp: Add some notes that this is broken.
3413         (WebCore::interpolate):
3414         (WebCore::CSSGradientValue::knownToBeOpaque):
3415
3416         * editing/EditingStyle.cpp: Use new Color helpers.
3417         (WebCore::isTransparentColorValue):
3418
3419         * editing/mac/EditorMac.mm: Use new Color helpers.
3420         (WebCore::Editor::fontAttributesForSelectionStart):
3421
3422         * html/ColorInputType.cpp: No need to use the Color class at all here.
3423         (WebCore::isValidSimpleColorString): Renamed from isValidColorString.
3424         (WebCore::ColorInputType::sanitizeValue):
3425         (WebCore::ColorInputType::typeMismatchFor):
3426         (WebCore::isValidColorString): Deleted.
3427
3428         * html/canvas/CanvasRenderingContext2D.cpp: New helpers.
3429         (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
3430         (WebCore::CanvasRenderingContext2D::didDraw):
3431
3432         * page/FrameView.cpp: Ditto.
3433         (WebCore::FrameView::recalculateScrollbarOverlayStyle):
3434         (WebCore::FrameView::hasOpaqueBackground):
3435         (WebCore::FrameView::setBaseBackgroundColor):
3436
3437         * platform/graphics/Color.cpp:
3438         (WebCore::differenceSquared): Support ExtendedColor, but also
3439         add a note to indicate that this method and its call sites
3440         should use floats.
3441         (WebCore::Color::serialized): New helper.
3442         (WebCore::Color::cssText): Ditto.
3443         (WebCore::Color::blend): Ditto.
3444         (WebCore::Color::blendWithWhite):
3445         (WebCore::Color::colorWithAlphaMultipliedBy): Implementation of new function.
3446         (WebCore::Color::colorWithAlpha): Ditto.
3447         (WebCore::Color::opaqueColor): New method to return an opaque version of the given color.
3448         (WebCore::blend):
3449         * platform/graphics/Color.h:
3450         (WebCore::Color::isOpaque): New helper that is !hasAlpha().
3451         (WebCore::Color::isVisible): New helper.
3452         (WebCore::Color::alphaAsFloat): Gets the alpha value as a float. This replaces
3453         a bunch of places that were calculating it manually each time. Meanwhile, we
3454         might consider always exposing the primaries as floats... or at least
3455         have that option.
3456         (WebCore::isBlackColor): New helper - it was used in a couple of places.
3457         (WebCore::isWhiteColor): Ditto.
3458         (WebCore::Color::hasAlpha): Deleted.
3459
3460         * platform/graphics/Gradient.cpp: Add FIXME.
3461         (WebCore::Gradient::addColorStop):
3462         * platform/graphics/Gradient.h:
3463
3464         * platform/graphics/GraphicsContext.cpp: Use new helpers.
3465         (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
3466         * platform/graphics/GraphicsContext.h:
3467         (WebCore::GraphicsContext::hasVisibleShadow):
3468
3469         * platform/graphics/Image.cpp: Ditto.
3470         (WebCore::Image::fillWithSolidColor):
3471
3472         * platform/graphics/ShadowBlur.cpp: Ditto.
3473         (WebCore::ShadowBlur::updateShadowBlurValues):
3474
3475         * platform/graphics/ca/GraphicsLayerCA.cpp: Ditto.
3476         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
3477
3478         * platform/graphics/cg/GradientCG.cpp:
3479         (WebCore::Gradient::platformGradient): Add a FIXME to note that we can
3480         add ExtendedColor support simply by using CGColors, rather than fetching
3481         the components ourselves.
3482
3483         * platform/graphics/cg/GraphicsContextCG.cpp: New helpers.
3484         (WebCore::calculateDrawingMode):
3485
3486         * platform/graphics/cocoa/FontCascadeCocoa.mm: New helpers.
3487         (WebCore::FontCascade::drawGlyphs):
3488
3489         * platform/graphics/mac/ColorMac.mm: Use the new helpers and Color::hash().
3490         (WebCore::nsColor):
3491
3492         * platform/graphics/texmap/TextureMapperGL.cpp: New helpers.
3493         (WebCore::TextureMapperGL::drawBorder):
3494
3495         * rendering/BorderEdge.cpp: Ditto.
3496         (WebCore::BorderEdge::obscuresBackgroundEdge):
3497         (WebCore::BorderEdge::obscuresBackground):
3498
3499         * rendering/RenderBox.cpp: Ditto.
3500         (WebCore::RenderBox::getBackgroundPaintedExtent):
3501         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect):
3502         (WebCore::RenderBox::backgroundHasOpaqueTopLayer):
3503
3504         * rendering/RenderBoxModelObject.cpp: Ditto.
3505         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
3506         (WebCore::colorNeedsAntiAliasAtCorner):
3507         (WebCore::willBeOverdrawn):
3508         (WebCore::RenderBoxModelObject::paintTranslucentBorderSides):
3509         (WebCore::RenderBoxModelObject::paintBorder):
3510         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground):
3511         (WebCore::RenderBoxModelObject::paintBoxShadow):
3512         * rendering/RenderElement.cpp:
3513         (WebCore::RenderElement::paintOutline):
3514         * rendering/RenderInline.cpp:
3515         (WebCore::RenderInline::paintOutline):
3516         * rendering/RenderLayerBacking.cpp:
3517         (WebCore::canCreateTiledImage):
3518         * rendering/RenderLayerCompositor.cpp:
3519         (WebCore::RenderLayerCompositor::viewHasTransparentBackground):
3520         * rendering/RenderMenuList.cpp:
3521         (RenderMenuList::getItemBackgroundColor):
3522         * rendering/RenderTheme.cpp:
3523         (WebCore::RenderTheme::disabledTextColor):
3524         * rendering/RenderView.cpp:
3525         (WebCore::RenderView::paintBoxDecorations):
3526         * rendering/TextDecorationPainter.cpp:
3527         (WebCore::TextDecorationPainter::paintTextDecoration):
3528         * rendering/TextPainter.cpp:
3529         (WebCore::TextPainter::paintTextWithShadows):
3530         * rendering/style/BorderValue.h:
3531         (WebCore::BorderValue::isTransparent):
3532         * rendering/style/RenderStyle.cpp:
3533         (WebCore::RenderStyle::visitedDependentColor):
3534         * rendering/style/RenderStyle.h:
3535         (WebCore::RenderStyle::hasBackground):
3536         * rendering/svg/RenderSVGResource.cpp:
3537         (WebCore::requestPaintingResource):
3538         * rendering/svg/SVGInlineTextBox.cpp:
3539         (WebCore::SVGInlineTextBox::paintSelectionBackground):
3540
3541         * svg/SVGAnimatedColor.cpp: Add a FIXME to note this is broken.
3542         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
3543
3544 2016-11-09  Antoine Quint  <graouts@apple.com>
3545
3546         [Modern Media Controls] UI Library: StatusLabel
3547         https://bugs.webkit.org/show_bug.cgi?id=164544
3548         <rdar://problem/29179541>
3549
3550         Reviewed by Dean Jackson.
3551
3552         We add a new StatusLabel class to display a string of text in place of the TimeControl.
3553         A followup patch will add the logic to display "Error", "Loading" and "Live Broadcast"
3554         test under the right media state.
3555
3556         Tests: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-status-label.html
3557                media/modern-media-controls/status-label/status-label.html
3558
3559         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
3560         (.media-controls.mac.inline .time-label,):
3561         (.media-controls.mac.inline .time-label): Deleted.
3562         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3563         (MacOSInlineMediaControls.prototype.layout):
3564         * Modules/modern-media-controls/controls/media-controls.js:
3565         (MediaControls.):
3566         * Modules/modern-media-controls/controls/status-label.css: Added.
3567         (.status-label):
3568         * Modules/modern-media-controls/controls/status-label.js: Added.
3569         (StatusLabel.prototype.get text):
3570         (StatusLabel.prototype.set text):
3571         (StatusLabel.prototype.commitProperty):
3572         * Modules/modern-media-controls/js-files:
3573         * WebCore.xcodeproj/project.pbxproj:
3574
3575 2016-11-09  Chris Dumez  <cdumez@apple.com>
3576
3577         [Mac] Stop using deprecated AppKit enumeration values
3578         https://bugs.webkit.org/show_bug.cgi?id=164494
3579
3580         Reviewed by Darin Adler.
3581
3582         Stop using deprecated AppKit enumeration values.
3583
3584         * editing/cocoa/HTMLConverter.mm:
3585         (HTMLConverter::computedAttributesForElement):
3586         (HTMLConverter::_processElement):
3587         (HTMLConverter::_addMarkersToList):
3588         * page/mac/EventHandlerMac.mm:
3589         (WebCore::EventHandler::keyEvent):
3590         (WebCore::lastEventIsMouseUp):
3591         (WebCore::EventHandler::passSubframeEventToSubframe):
3592         (WebCore::EventHandler::widgetDidHandleWheelEvent):
3593         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
3594         * page/mac/TextIndicatorWindow.mm:
3595         (WebCore::TextIndicatorWindow::setTextIndicator):
3596         * platform/graphics/mac/IconMac.mm:
3597         (WebCore::Icon::paint):
3598         * platform/mac/CursorMac.mm:
3599         (WebCore::createCustomCursor):
3600         * platform/mac/DragImageMac.mm:
3601         (WebCore::dissolveDragImageToFraction):
3602         (WebCore::createDragImageFromImage):
3603         * platform/mac/EventLoopMac.mm:
3604         (WebCore::EventLoop::cycle):
3605         * platform/mac/PasteboardMac.mm:
3606         (WebCore::Pasteboard::setDragImage):
3607         * platform/mac/PlatformEventFactoryMac.mm:
3608         (WebCore::globalPointForEvent):
3609         (WebCore::pointForEvent):
3610         (WebCore::mouseButtonForEvent):
3611         (WebCore::mouseEventTypeForEvent):
3612         (WebCore::clickCountForEvent):
3613         (WebCore::isKeypadEvent):
3614         (WebCore::windowsKeyCodeForKeyEvent):
3615         (WebCore::isKeyUpEvent):
3616         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
3617         * platform/mac/ScrollbarThemeMac.mm:
3618         (WebCore::scrollbarControlSizeToNSControlSize):
3619         * platform/mac/ThemeMac.mm:
3620         (-[WebCoreThemeView window]):
3621         (WebCore::controlSizeForFont):
3622         (WebCore::controlSizeFromPixelSize):
3623         (WebCore::setUpButtonCell):
3624         (WebCore::stepperControlSizeForFont):
3625         (WebCore::paintStepper):
3626         (WebCore::ThemeMac::minimumControlSize):
3627         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
3628         (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]):
3629         (-[WebVideoFullscreenHUDWindow performKeyEquivalent:]):
3630         (-[WebVideoFullscreenHUDWindowController init]):
3631         (-[WebVideoFullscreenHUDWindowController keyDown:]):
3632         (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
3633         * platform/mac/WebWindowAnimation.mm:
3634         (WebWindowAnimationDurationFromDuration):
3635         * rendering/RenderThemeMac.mm:
3636         (WebCore::RenderThemeMac::updateCachedSystemFontDescription):
3637         (WebCore::RenderThemeMac::controlSizeForFont):
3638         (WebCore::RenderThemeMac::controlSizeForCell):
3639         (WebCore::RenderThemeMac::controlSizeForSystemFont):
3640         (WebCore::RenderThemeMac::paintProgressBar):
3641         (WebCore::RenderThemeMac::popupMenuSize):
3642         (WebCore::RenderThemeMac::sliderThumbHorizontal):
3643         (WebCore::RenderThemeMac::sliderThumbVertical):
3644
3645 2016-11-08  Antoine Quint  <graouts@apple.com>
3646
3647         [Modern Media Controls] UI Library: iOS inline controls
3648         https://bugs.webkit.org/show_bug.cgi?id=164513
3649         <rdar://problem/27989475>
3650
3651         Reviewed by Dean Jackson.
3652
3653         We introduce a new IOSInlineMediaControls class which can be used to instantiate media controls
3654         for inline playback on iOS.
3655
3656         Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-buttons-styles.html
3657                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-constructor.html
3658                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-controls-bar-styles.html
3659                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-layout.html
3660                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-time-control-styles.html
3661                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html
3662
3663         * Modules/modern-media-controls/controls/ios-inline-media-controls.css: Added.
3664         (.media-controls.ios.inline > .controls-bar):
3665         (.media-controls.ios.inline .time-control):
3666         (.media-controls.ios.inline button):
3667         (.media-controls.ios.inline button:active):
3668         (.media-controls.ios.inline > .controls-bar button):
3669         (.media-controls.ios.inline .buttons-container.right):
3670         (.media-controls.ios.inline button.play-pause):
3671         (.media-controls.ios.inline button.skip-back):
3672         (.media-controls.ios.inline .scrubber.slider):
3673         (.media-controls.ios.inline button.airplay):
3674         (.media-controls.ios.inline button.pip):
3675         (.media-controls.ios.inline button.fullscreen):
3676         (.media-controls.ios.inline .time-label):
3677         (.media-controls.ios.inline .scrubber.slider > .fill):
3678         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
3679         * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Added.
3680         (IOSInlineMediaControls.prototype.layout):
3681         (IOSInlineMediaControls):
3682         * Modules/modern-media-controls/images/iOS/slider-thumb@2x.png: Added.
3683         * Modules/modern-media-controls/js-files:
3684         * WebCore.xcodeproj/project.pbxproj:
3685
3686 2016-11-09  Beth Dakin  <bdakin@apple.com>
3687
3688         Support TouchBar in WebKit
3689         https://bugs.webkit.org/show_bug.cgi?id=164437
3690         -and corresponding-
3691         rdar://problem/28876524
3692
3693         Reviewed by Darin Adler.
3694
3695         * WebCore.xcodeproj/project.pbxproj:
3696         * platform/spi/cocoa/AVKitSPI.h:
3697         * platform/spi/cocoa/NSTouchBarSPI.h: Added.
3698         * platform/spi/mac/NSSpellCheckerSPI.h:
3699
3700 2016-11-09  Chris Dumez  <cdumez@apple.com>
3701
3702         Use Blob URL instead of webkit-fake-url when pasting an image
3703         https://bugs.webkit.org/show_bug.cgi?id=49141
3704
3705         Reviewed by Darin Adler.
3706
3707         Use Blob URL instead of webkit-fake-url when pasting an image.
3708
3709         Tests: editing/pasteboard/paste-image-as-blob-url.html
3710                editing/pasteboard/paste-image-using-image-data.html
3711
3712         * editing/Editor.h:
3713         * editing/mac/EditorMac.mm:
3714         (WebCore::Editor::WebContentReader::readImage):
3715         (WebCore::Editor::createFragmentForImageAndURL):
3716
3717 2016-11-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3718
3719         Fix error message when SQLite initialization fails
3720         https://bugs.webkit.org/show_bug.cgi?id=164462
3721
3722         Reviewed by Darin Adler.
3723
3724         * platform/sql/SQLiteDatabase.cpp:
3725         (WebCore::initializeSQLiteIfNecessary):
3726
3727 2016-11-08  Antoine Quint  <graouts@apple.com>
3728
3729         [Modern Media Controls] UI Library: macOS fullscreen controls
3730         https://bugs.webkit.org/show_bug.cgi?id=164414
3731         <rdar://problem/27989474>
3732
3733         Reviewed by Dean Jackson.
3734
3735         We introduce a new MacOSFullscreenMediaControls class which can be used to instantiate media controls
3736         for fullscreen playback on macOS. These controls can be dragged by the user.
3737
3738         Tests: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html
3739                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html
3740                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html
3741                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html
3742                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-right-container-margin.html
3743                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html
3744                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-styles.html
3745
3746         * Modules/modern-media-controls/controls/button.js:
3747         (Button.prototype.set enabled):
3748
3749             Correctly notify the layoutDelegate when the enabled property changes, regardless of whether
3750             the flag is on.
3751
3752         * Modules/modern-media-controls/controls/icon-button.js:
3753         (IconButton.prototype._updateImage):
3754         (IconButton):
3755
3756             Correctly notify the layout delegate when the image metrics have changed so that it may perform
3757             a layout. This issues became apparent with the new tests on Yosemite and caused some flakyness.
3758
3759         * Modules/modern-media-controls/controls/icon-service.js:
3760         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
3761         (const.iconService.new.IconService):
3762
3763             Fix a typo.
3764
3765         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: Added.
3766         (.media-controls.mac.fullscreen > .controls-bar):
3767         (.media-controls.mac.fullscreen .volume.slider):
3768         (.media-controls.mac.fullscreen .buttons-container):
3769         (.media-controls.mac.fullscreen .buttons-container.center):
3770         (.media-controls.mac.fullscreen > .controls-bar button):
3771         (.media-controls.mac.fullscreen button.rewind):
3772         (.media-controls.mac.fullscreen button.play-pause):
3773         (.media-controls.mac.fullscreen button.forward):
3774         (.media-controls.mac.fullscreen .buttons-container.right):
3775         (.media-controls.mac.fullscreen button.airplay):
3776         (.media-controls.mac.fullscreen button.aspect-ratio):
3777         (.media-controls.mac.fullscreen button.pip):
3778         (.media-controls.mac.fullscreen button.tracks):
3779         (.media-controls.mac.fullscreen button.fullscreen):
3780         (.media-controls.mac.fullscreen .time-control):
3781         (.media-controls.mac.fullscreen .time-label):
3782         (.media-controls.mac.fullscreen .scrubber):
3783         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Added.
3784         (MacOSFullscreenMediaControls.prototype.layout):
3785         (MacOSFullscreenMediaControls):
3786         * Modules/modern-media-controls/controls/macos-media-controls.js:
3787         (MacOSMediaControls):
3788         
3789             Allow the layoutTraits property to be set to something other than just LayoutTraits.macOS
3790             so that MacOSFullscreenMediaControls may set the LayoutTraits.Fullscreen bit.
3791         
3792         * Modules/modern-media-controls/js-files:
3793         
3794             Add a reference to the new macos-fullscreen-media-controls.js file.
3795         
3796         * WebCore.xcodeproj/project.pbxproj:
3797
3798             Add references to the new macos-fullscreen-media-controls.js and
3799             macos-fullscreen-media-controls.css files.
3800
3801 2016-11-09  Chris Dumez  <cdumez@apple.com>
3802
3803         Shave 16 bytes off HTMLInputElement
3804         https://bugs.webkit.org/show_bug.cgi?id=164488
3805
3806         Reviewed by Sam Weinig.
3807
3808         Shave 16 bytes off HTMLInputElement (232 -> 216) by packing data members
3809         better.
3810
3811         * html/HTMLFormControlElement.h:
3812         * html/HTMLTextFormControlElement.cpp:
3813         (WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
3814         * html/HTMLTextFormControlElement.h:
3815
3816 2016-11-09  Youenn Fablet  <youenn@apple.com>
3817
3818         [WebRTC] Introduce asynchronous backend for other RTCPeerConnection API
3819         https://bugs.webkit.org/show_bug.cgi?id=164409
3820
3821         Reviewed by Eric Carlson.
3822
3823         Covered by existing tests.
3824
3825         Following on createOffer changes, applying the same changes to createAnswer, setLocalDescription, setRemoteDescription and addIceCandidate.
3826         Also refactored ICE candidate event generation (done at PeerConnectionBackend).
3827         Updated stop implementation to clean any promise that may be stored in PeerConnectionBackend.
3828
3829         The goal of this is to be more aligned with https://www.w3.org/TR/webrtc/.
3830         Implementation of the various functions such as //www.w3.org/TR/webrtc/#set-description would be done in PeerConnectionBackend.
3831         This will require additional code moved from MediaEndpointPeerConnection up to PeerConnectionBackend.
3832
3833         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3834         (WebCore::MediaEndpointPeerConnection::createOfferTask):
3835         (WebCore::MediaEndpointPeerConnection::doCreateAnswer):
3836         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
3837         (WebCore::MediaEndpointPeerConnection::doSetLocalDescription):
3838         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
3839         (WebCore::MediaEndpointPeerConnection::doSetRemoteDescription):
3840         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
3841         (WebCore::MediaEndpointPeerConnection::doAddIceCandidate):
3842         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
3843         (WebCore::MediaEndpointPeerConnection::doStop):
3844         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
3845         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
3846         (WebCore::MediaEndpointPeerConnection::createAnswer): Deleted.
3847         (WebCore::MediaEndpointPeerConnection::setLocalDescription): Deleted.
3848         (WebCore::MediaEndpointPeerConnection::setRemoteDescription): Deleted.
3849         (WebCore::MediaEndpointPeerConnection::addIceCandidate): Deleted.
3850         (WebCore::MediaEndpointPeerConnection::stop): Deleted.
3851         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState): Deleted.
3852         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState): Deleted.
3853         * Modules/mediastream/MediaEndpointPeerConnection.h:
3854         * Modules/mediastream/PeerConnectionBackend.cpp:
3855         (WebCore::PeerConnectionBackend::createOffer):
3856         (WebCore::PeerConnectionBackend::createOfferFailed):
3857         (WebCore::PeerConnectionBackend::createAnswer):
3858         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
3859         (WebCore::PeerConnectionBackend::createAnswerFailed):
3860         (WebCore::isLocalDescriptionTypeValidForState):
3861         (WebCore::PeerConnectionBackend::setLocalDescription):
3862         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
3863         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
3864         (WebCore::isRemoteDescriptionTypeValidForState):
3865         (WebCore::PeerConnectionBackend::setRemoteDescription):
3866         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
3867         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
3868         (WebCore::PeerConnectionBackend::addIceCandidate):
3869         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
3870         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
3871         (WebCore::PeerConnectionBackend::fireICECandidateEvent):
3872         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
3873         (WebCore::PeerConnectionBackend::stop):
3874         * Modules/mediastream/PeerConnectionBackend.h:
3875
3876 2016-11-09  Eric Carlson  <eric.carlson@apple.com>
3877
3878         [MediaStream][Mac] Mark captured video frames as ready for display immediately
3879         https://bugs.webkit.org/show_bug.cgi?id=164482
3880         <rdar://problem/29139073>
3881
3882         Reviewed by Jer Noble.
3883
3884         * platform/cf/CoreMediaSoftLink.cpp: Add new constant.
3885         * platform/cf/CoreMediaSoftLink.h:
3886
3887         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3888         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3889         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData):
3890           New, ask register for a callback when the sample buffer display layer is ready
3891           for more media data.
3892         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Don't change
3893           the sample timestamps, assume the caller has configured the sample correctly.
3894         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Don't
3895           drop frames when the display layer isn't ready.
3896         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Call stopRequestingMediaData.
3897         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
3898         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Deleted.
3899
3900         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3901         (WebCore::AVVideoCaptureSource::setupCaptureSession): Tell the video output to always discard
3902           late video frames, we don't need them.
3903         (WebCore::AVVideoCaptureSource::processNewFrame): Add a kCMSampleAttachmentKey_DisplayImmediately
3904           attachment.
3905
3906 2016-11-09  Joanmarie Diggs  <jdiggs@igalia.com>
3907
3908         AX: [ATK] Wrong selected element at a given index in a list box (redux)
3909         https://bugs.webkit.org/show_bug.cgi?id=164430
3910
3911         Reviewed by Darin Adler.
3912
3913         This essentially undoes the implementation change resulting from r164577.
3914         As stated in the ATK documentation, atk_selection_ref_selection() takes
3915         "a gint specifying the index in the selection set. (e.g. the ith selection
3916         as opposed to the ith child)." r164577 deliberately modified that, causing
3917         atk_selection_ref_selection() to treat the index as if it were the position
3918         with respect to all of the children. There is different API in ATK, namely
3919         atk_object_ref_accessible_child(), when the ith child from the set of all
3920         children is sought.
3921
3922         Tests: accessibility/aria-listbox-no-selection.html
3923                accessibility/native-listbox-no-selection.html
3924
3925         * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
3926         (optionFromSelection):
3927
3928 2016-11-09  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3929
3930         [EFL] Use libgcrypt instead of GnuTLS for CryptoDigest