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