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