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