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