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