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