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