326feb5d5d92fcbac4c8a83356536919b4db44d8
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-23  Antti Koivisto  <antti@apple.com>
2
3         Avoid unnecessary full style resolution in getComputedStyle for non-inherited properties
4         https://bugs.webkit.org/show_bug.cgi?id=163875
5
6         Reviewed by Andreas Kling.
7
8         Test: fast/css/getComputedStyle/getComputedStyle-style-resolution.html
9
10         * css/CSSComputedStyleDeclaration.cpp:
11         (WebCore::hasValidStyleForProperty):
12
13             For non-inherited properties we don't need to update style even if some ancestor style is invalid
14             as long as explicit 'inherit' is not being used.
15             We still need to update if we find out that the whole subtree we are in is invalid.
16
17         (WebCore::updateStyleIfNeededForProperty):
18
19             Pass the property.
20
21         (WebCore::ComputedStyleExtractor::customPropertyValue):
22         (WebCore::ComputedStyleExtractor::propertyValue):
23         (WebCore::CSSComputedStyleDeclaration::length):
24         (WebCore::elementOrItsAncestorNeedsStyleRecalc): Deleted.
25         (WebCore::updateStyleIfNeededForElement): Deleted.
26         * css/StyleResolver.cpp:
27         (WebCore::StyleResolver::colorFromPrimitiveValue):
28
29             Mark style as using explicit inheritance if 'currentcolor' value is used.
30
31 2016-10-24  Youenn Fablet  <youenn@apple.com>
32
33         ASSERTION FAILED: canvas()->securityOrigin()->toString() == cachedImage.origin()->toString()
34         https://bugs.webkit.org/show_bug.cgi?id=163242
35
36         Reviewed by Darin Adler.
37
38         Test: http/tests/security/cross-origin-cached-images-canvas.html
39
40         We were previously on Origin HTTP header to check whether requests were made from different origins.
41         This is fine for CORS enabled requests but not for GET no CORS requests since they will not have any Origin header.
42
43         Now that CachedResource and CachedResourceRequest own their origin, it is best to use these directly.
44
45         * loader/cache/CachedResourceLoader.cpp:
46         (WebCore::isRequestMatchingResourceOrigin):
47         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
48
49 2016-10-24  Youenn Fablet  <youenn@apple.com>
50
51         Remove CachedResource::passesSameOriginPolicyCheck
52         https://bugs.webkit.org/show_bug.cgi?id=163593
53
54         Reviewed by Andreas Kling.
55
56         No change of behavior.
57
58         Removing no-longer used code.
59
60         * loader/cache/CachedResource.cpp:
61         (WebCore::CachedResource::redirectReceived):
62         (WebCore::CachedResource::passesAccessControlCheck): Deleted.
63         (WebCore::CachedResource::passesSameOriginPolicyCheck): Deleted.
64         (WebCore::CachedResource::responseForSameOriginPolicyChecks): Deleted.
65         * loader/cache/CachedResource.h:
66         (WebCore::CachedResource::response):
67
68 2016-10-24  Youenn Fablet  <youenn@apple.com>
69
70         Redirections should be upgraded if CSP policy says so
71         https://bugs.webkit.org/show_bug.cgi?id=163544
72
73         Reviewed by Darin Adler.
74
75         Test: http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade-after-redirect.https.html
76
77         Introducing CachedResourceLoader::updateRequestAfterRedirection to do the checks that CachedResourceLoader is doing
78         to the initial request, but for redirection requests.
79
80         Implemented URL upgrade according CSP policy, as specified by fetch algorithm.
81         Minor refactoring in CachedResourceRequest to share some code.
82         Fixing some constness issues.
83
84         * loader/SubresourceLoader.cpp:
85         (WebCore::SubresourceLoader::willSendRequestInternal):
86         * loader/cache/CachedResourceLoader.cpp:
87         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
88         (WebCore::CachedResourceLoader::canRequestAfterRedirection):
89         (WebCore::CachedResourceLoader::updateRequestAfterRedirection):
90         * loader/cache/CachedResourceLoader.h:
91         * loader/cache/CachedResourceRequest.cpp:
92         (WebCore::upgradeInsecureResourceRequestIfNeeded):
93         (WebCore::CachedResourceRequest::upgradeInsecureRequestIfNeeded):
94         * loader/cache/CachedResourceRequest.h:
95
96 2016-10-22  Sam Weinig  <sam@webkit.org>
97
98         [WebIDL] Add IDLType based toJS conversion
99         https://bugs.webkit.org/show_bug.cgi?id=163861
100
101         Reviewed by Darin Adler.
102
103         Adds toJS<IDLType>() functions to be the new way of converting
104         from implementation types to JS types. These are implemented via
105         a similar mechanism to the convert<IDL>() functions, though specializations
106         of a JSConverter struct (rather than the Converter structs). This allows
107         us to support arbitrarily complex aggregate types easily (e.g. sequence<(Node or DOMString?)>).
108
109         * Modules/geolocation/Geoposition.idl:
110         * dom/Event.idl:
111         Add typedef for DOMTimeStamp. Eventually, our IDLParser should do this for us, but
112         for now it allows us to simplify the type system.
113
114         * bindings/js/JSDOMBinding.h:
115         (WebCore::JSValueTraits::arrayJSValue): Deleted.
116         (WebCore::JSValueTraits<String>::arrayJSValue): Deleted.
117         (WebCore::JSValueTraits<double>::arrayJSValue): Deleted.
118         (WebCore::JSValueTraits<float>::arrayJSValue): Deleted.
119         (WebCore::jsArray): Deleted.
120         (WebCore::jsFrozenArray): Deleted.
121         (WebCore::NativeValueTraits<String>::nativeValue): Deleted.
122         (WebCore::NativeValueTraits<unsigned>::nativeValue): Deleted.
123         (WebCore::NativeValueTraits<float>::nativeValue): Deleted.
124         (WebCore::NativeValueTraits<double>::nativeValue): Deleted.
125         (WebCore::toNullableJSNumber): Deleted.
126         (WebCore::toJSArray): Deleted.
127         (WebCore::toJSBoolean): Deleted.
128         (WebCore::toJSNumber): Deleted.
129         (WebCore::toJSString): Deleted.
130         Remove many now-unneeded conversion functions.
131
132         * bindings/js/JSDOMConvert.h:
133         (WebCore::toJS):
134         Add 5 primary toJS functions which take combinations of the following
135         arguments: ExecState, JSDOMGlobalObject, ThrowScope.  All take the value 
136         to be converted as well, except in the case of the throwScope ones, where
137         they take the value in an ExceptionOr<>.
138
139         To simplify the implementations of the JSConverter specializations, avoiding
140         the need for each one to implement their conversion up to 3 times (one for just
141         the value, one for the value and the ExecState, and one for the value, the ExecState
142         and the global object), each JSConverter instead specifies whether it's converter
143         needs an ExecState or global object via a static constexpr. We then use the 
144         JSConverterOverloader template, to call the correct function. This can probably be
145         improved in the future, by inferring the number of arguments needed via SFINAE, but
146         this seemed like a more straightforward first cut.
147
148         (WebCore::JSConverter<IDLNullable<T>>::convert):
149         (WebCore::JSConverter<IDLBoolean>::convert):
150         (WebCore::JSConverter<IDLInterface<T>>::convert):
151         (WebCore::JSConverter<IDLAny>::convert):
152         (WebCore::JSConverter<IDLByte>::convert):
153         (WebCore::JSConverter<IDLOctet>::convert):
154         (WebCore::JSConverter<IDLShort>::convert):
155         (WebCore::JSConverter<IDLUnsignedShort>::convert):
156         (WebCore::JSConverter<IDLLong>::convert):
157         (WebCore::JSConverter<IDLUnsignedLong>::convert):
158         (WebCore::JSConverter<IDLLongLong>::convert):
159         (WebCore::JSConverter<IDLUnsignedLongLong>::convert):
160         (WebCore::JSConverter<IDLFloat>::convert):
161         (WebCore::JSConverter<IDLUnrestrictedFloat>::convert):
162         (WebCore::JSConverter<IDLDouble>::convert):
163         (WebCore::JSConverter<IDLUnrestrictedDouble>::convert):
164         (WebCore::JSConverter<IDLDOMString>::convert):
165         (WebCore::JSConverter<IDLUSVString>::convert):
166         (WebCore::JSConverter<IDLSequence<T>>::convert):
167         (WebCore::JSConverter<IDLFrozenArray<T>>::convert):
168         (WebCore::JSConverter<IDLEnumeration<T>>::convert):
169         (WebCore::JSConverter<IDLUnion<T...>>::convert):
170         There is slightly more duplication than I would have liked, for instance we have a
171         specialization for each numeric type, even though they are all the same, but that is
172         something that can be improved going forward.
173
174         (WebCore::Converter<IDLUnion<T...>>::convert)
175         Fix the normal IDLUnion converter to work with boolean types. This was caught by the
176         test case I added via TypeConversions.idl.
177         
178         * bindings/js/JSDOMStringMapCustom.cpp:
179         (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate):
180         * bindings/js/JSDOMWindowCustom.cpp:
181         (WebCore::JSDOMWindow::setTimeout):
182         (WebCore::JSDOMWindow::setInterval):
183         * bindings/js/JSDataTransferCustom.cpp:
184         (WebCore::JSDataTransfer::types):
185         * bindings/js/JSMediaStreamTrackCustom.cpp:
186         (WebCore::JSMediaStreamTrack::getCapabilities):
187         * bindings/js/JSMutationCallback.cpp:
188         (WebCore::JSMutationCallback::call):
189         * bindings/js/JSSVGLengthCustom.cpp:
190         (WebCore::JSSVGLength::value):
191         Switch to use new toJS<> functions.
192
193         * bindings/scripts/CodeGeneratorJS.pm:
194         (AddStringifierOperationIfNeeded):
195         Fix stringifier function signature to contain an idlType.
196
197         (GenerateEnumerationsHeaderContent):
198         Remove now unnecessary JSValueTraits specializations.
199
200         (JSValueToNativeIsHandledByDOMConvert):
201         Renamed from IsHandledByDOMConvert, since that name is now ambiguous.
202
203         (JSValueToNative):
204         Update for new name of IsHandledByDOMConvert.
205
206         (NativeToJSValueIsHandledByDOMConvert):
207         Predicate guarding what types currently work with the new conversion system.
208
209         (NativeToJSValueDOMConvertNeedsState):
210         Predicate for determining if the ExecState is needed in the conversion function.
211
212         (NativeToJSValueDOMConvertNeedsGlobalObject):
213         Predicate for determining if the global object is needed in the conversion function.
214
215         (NativeToJSValue):
216         Move things around a little bit and start converting use the new toJS<> when possible.
217
218         * bindings/scripts/IDLParser.pm:
219         (parseAttributeOrOperationRest):
220         Fix a missing place where were not setting the idlType.
221  
222         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
223         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
224         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
225         * bindings/scripts/test/JS/JSTestCallback.cpp:
226         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
227         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
228         * bindings/scripts/test/JS/JSTestException.cpp:
229         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
230         * bindings/scripts/test/JS/JSTestInterface.cpp:
231         * bindings/scripts/test/JS/JSTestNode.cpp:
232         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
233         * bindings/scripts/test/JS/JSTestObj.cpp:
234         * bindings/scripts/test/JS/JSTestObj.h:
235         * bindings/scripts/test/JS/JSTestSerialization.cpp:
236         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
237         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
238         * bindings/scripts/test/JS/JSattribute.cpp:
239         Update test results.
240
241         * testing/TypeConversions.h:
242         (WebCore::TypeConversions::testUnion):
243         (WebCore::TypeConversions::setTestUnion):
244         (WebCore::TypeConversions::typeConversionsDictionarySequenceValue):
245         (WebCore::TypeConversions::typeConversionsDictionaryUnionValue):
246         * testing/TypeConversions.idl:
247         Add a testUnion attribute, now that we can return unions to JS.
248
249 2016-10-23  Zalan Bujtas  <zalan@apple.com>
250
251         Unreviewed, rolling out r207727.
252
253         broke 15 selection test cases.
254
255         Reverted changeset:
256
257         "Do not update selection rect on dirty lineboxes."
258         https://bugs.webkit.org/show_bug.cgi?id=163862
259         http://trac.webkit.org/changeset/207727
260
261 2016-10-23  Chris Dumez  <cdumez@apple.com>
262
263         addEventListener() / removeEventListener() should use a union for last parameter
264         https://bugs.webkit.org/show_bug.cgi?id=163863
265
266         Reviewed by Darin Adler.
267
268         addEventListener() / removeEventListener() should use a union for last parameter:
269         - https://dom.spec.whatwg.org/#eventtarget
270
271         No new tests, no Web-exposed behavior change.
272
273         * bindings/js/JSDOMConvert.h:
274         * dom/EventTarget.cpp:
275         (WebCore::EventTarget::addEventListenerForBindings):
276         (WebCore::EventTarget::removeEventListenerForBindings):
277         * dom/EventTarget.h:
278         * dom/EventTarget.idl:
279
280 2016-10-23  Zalan Bujtas  <zalan@apple.com>
281
282         Do not update selection rect on dirty lineboxes.
283         https://bugs.webkit.org/show_bug.cgi?id=163862
284         <rdar://problem/28813156>
285
286         Reviewed by Simon Fraser.
287
288         In addition to checking whether the renderer needs layout, we also need to check if its preferred
289         width is clean and stop computing the selection rects, if needed (while adding a renderer to the tree,
290         there's a transition phase where the parent's preferred width dirty bit is already set, but it does
291         not yet need layout).
292
293         Tests: fast/css-generated-content/dynamic-first-letter-selection-clear-crash.html
294
295         * rendering/RenderObject.cpp:
296         (WebCore::RenderObject::canUpdateSelectionOnRootLineBoxes):
297
298 2016-10-22  Myles C. Maxfield  <mmaxfield@apple.com>
299
300         ASSERTION FAILED: m_fonts in &WebCore::FontCascade::primaryFont
301         https://bugs.webkit.org/show_bug.cgi?id=163459
302
303         Reviewed by Darin Adler.
304
305         The CSS Units and Values spec states that font-relative units, when used
306         in the font-size property, are resolved against the parent element. When
307         calc() is specified, we were trying to resolve them against the current
308         element, which is impossible because of the circular dependency. Instead,
309         we should resolve against the parent style the same way as when calc() 
310         isn't specified.
311
312         Test: fast/text/font-size-calc.html
313
314         * css/StyleBuilderCustom.h:
315         (WebCore::StyleBuilderCustom::applyValueFontSize):
316
317 2016-10-22  Chris Dumez  <cdumez@apple.com>
318
319         [Web IDL] Two types are distinguishable for overload resolution if at most one of the two includes a nullable type
320         https://bugs.webkit.org/show_bug.cgi?id=163791
321
322         Reviewed by Sam Weinig.
323
324         Update overload resolution in the bindings generator so that 2 nullable types
325         are no longer considered as distinguishable, as per Web IDL:
326         - https://heycam.github.io/webidl/#dfn-distinguishable
327
328         * bindings/scripts/CodeGeneratorJS.pm:
329         (AreTypesDistinguishableForOverloadResolution):
330         * bindings/scripts/test/JS/JSTestObj.cpp:
331         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1):
332         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1Caller):
333         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2):
334         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2Caller):
335         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter):
336         * bindings/scripts/test/TestObj.idl:
337
338 2016-10-22  Chris Dumez  <cdumez@apple.com>
339
340         WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading
341         https://bugs.webkit.org/show_bug.cgi?id=163859
342
343         Reviewed by Darin Adler.
344
345         WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading:
346         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
347
348         No new tests, no Web-exposed behavior change.
349
350         * html/canvas/WebGL2RenderingContext.cpp:
351         (WebCore::WebGL2RenderingContext::texSubImage2D):
352         * html/canvas/WebGL2RenderingContext.h:
353         * html/canvas/WebGLRenderingContext.cpp:
354         (WebCore::WebGLRenderingContext::texSubImage2D):
355         * html/canvas/WebGLRenderingContext.h:
356         * html/canvas/WebGLRenderingContextBase.h:
357         * html/canvas/WebGLRenderingContextBase.idl:
358
359 2016-10-22  Dan Bernstein  <mitz@apple.com>
360
361         Dynamically-added backdrop filter to clip-path'd element with 3D transform renders incorrectly (without clip)
362         https://bugs.webkit.org/show_bug.cgi?id=163497
363
364         Reviewed by Simon Fraser.
365
366         Test: css3/filters/backdrop/dynamic-with-clip-path.html
367
368         * platform/graphics/ca/GraphicsLayerCA.cpp:
369         (WebCore::GraphicsLayerCA::ensureStructuralLayer): Added MaskLayerChanged to
370           structuralLayerChangeFlags to ensure that the mask layer is updated.
371
372 2016-10-22  Simon Fraser  <simon.fraser@apple.com>
373
374         Backdrop filter doesn't show if removed then re-added
375         https://bugs.webkit.org/show_bug.cgi?id=163860
376
377         Reviewed by Dan Bernstein.
378
379         When a backdrop filter is removed the re-added, updateBackdropFiltersRect() never
380         runs the second time because m_backdropFiltersRect doesn't change. However, we need
381         to run that code to size and position the newly re-created backdrop layer, so run
382         it explicitly if we just created the backdrop layer. This is similar to how
383         updateContentsImage() calls updateContentsRects().
384
385         Test: css3/filters/backdrop/add-remove-add-backdrop-filter.html
386
387         * platform/graphics/ca/GraphicsLayerCA.cpp:
388         (WebCore::GraphicsLayerCA::setBackdropFilters):
389         (WebCore::GraphicsLayerCA::updateBackdropFilters):
390
391 2016-10-22  Simon Fraser  <simon.fraser@apple.com>
392
393         Fix repainting of slow repaint objects in WK1 when page scale is applied
394         https://bugs.webkit.org/show_bug.cgi?id=163854
395
396         Reviewed by Zalan Bujtas.
397         
398         RenderObject::repaintSlowRepaintObject() always set the repaint container to the RenderView
399         if it was null. This is before the call to clippedOverflowRectForRepaint(). If that function
400         is called with a null repaintContainer, it maps the rect up through the RenderView's transform
401         (which represents page scale), which is what we want here. Passing the RenderView itself
402         stops the transform from being applied, which led to the bug.
403         
404         WebKit2 doesn't suffer from this bug because containerForRepaint() always returns the
405         composited RenderView.
406
407         Test: fast/repaint/zoomed-fixed-background.html
408
409         * rendering/RenderObject.cpp:
410         (WebCore::RenderObject::repaintSlowRepaintObject):
411
412 2016-10-22  Darin Adler  <darin@apple.com>
413
414         Move HTML canvas and tracks from ExceptionCode to Exception
415         https://bugs.webkit.org/show_bug.cgi?id=163853
416
417         Reviewed by Chris Dumez.
418
419         * WebCore.xcodeproj/project.pbxproj: Added CanvasPath.idl.
420
421         * bindings/js/JSWebGL2RenderingContextCustom.cpp: Tweaked a bit.
422
423         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
424         (WebCore::JSWebGLRenderingContextBase::getExtension): Tweaked a bit.
425         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter):
426         Removed unneeded exception handling.
427         (WebCore::JSWebGLRenderingContextBase::getParameter): Ditto.
428         (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Ditto.
429         (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Ditto.
430         (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Use a
431         modern for loop.
432         (WebCore::JSWebGLRenderingContextBase::getUniform): Removed unneeded
433         exception handling.
434
435         * html/HTMLCanvasElement.cpp:
436         (WebCore::HTMLCanvasElement::getContext): Pass a reference.
437         (WebCore::HTMLCanvasElement::reset): Use is<CanvasRenderingContext2D>.
438         (WebCore::HTMLCanvasElement::setUsesDisplayListDrawing): Ditto.
439         (WebCore::HTMLCanvasElement::setTracksDisplayListReplay) Ditto.:
440         (WebCore::HTMLCanvasElement::displayListAsText): Ditto.
441         (WebCore::HTMLCanvasElement::replayDisplayListAsText): Ditto.
442         (WebCore::HTMLCanvasElement::clearImageBuffer): Ditto.
443
444         * html/canvas/CanvasGradient.cpp:
445         (WebCore::CanvasGradient::CanvasGradient): Streamlined.
446         (WebCore::CanvasGradient::addColorStop): Use ExceptionOr.
447         * html/canvas/CanvasGradient.h: Updated for above changes.
448         * html/canvas/CanvasGradient.idl: Use non-legacy exception.
449
450         * html/canvas/CanvasPath.cpp:
451         (WebCore::CanvasPath::arcTo): Use ExceptionOr.
452         (WebCore::CanvasPath::arc): Ditto.
453         (WebCore::CanvasPath::ellipse): Ditto.
454         * html/canvas/CanvasPath.h: Updated for above changes.
455         * html/canvas/CanvasPath.idl: Use non-legacy exceptions.
456
457         * html/canvas/CanvasPattern.cpp:
458         (WebCore::CanvasPattern::create): Use Ref&&.
459         (WebCore::CanvasPattern::CanvasPattern): Ditto.
460         (WebCore::CanvasPattern::parseRepetitionType): Return a boolean
461         instead of using an ExceptionCode.
462         * html/canvas/CanvasPattern.h: Updated for above changes.
463
464         * html/canvas/CanvasRenderingContext.cpp:
465         (CanvasRenderingContext::wouldTaintOrigin): Reordered function so
466         that it's safe to call it on an image element without a cached
467         image, or a cached image without an underlying image.
468
469         * html/canvas/CanvasRenderingContext2D.cpp:
470         (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
471         Take a reference.
472         (WebCore::CanvasRenderingContext2D::drawImage): Use ExceptionOr.
473         (WebCore::CanvasRenderingContext2D::drawImageFromRect): Ditto.
474         (WebCore::CanvasRenderingContext2D::createLinearGradient): Ditto.
475         (WebCore::CanvasRenderingContext2D::createRadialGradient): Ditto.
476         (WebCore::CanvasRenderingContext2D::createPattern): Ditto.
477         (WebCore::CanvasRenderingContext2D::createImageData): Ditto.
478         (WebCore::CanvasRenderingContext2D::getImageData): Ditto.
479         (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD): Ditto.
480         (WebCore::CanvasRenderingContext2D::putImageData): Removed unneeded
481         ExceptionCode because this does not throw exceptions; the only one
482         was for non-finite numeric values but this is now handled by bindings.
483         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Ditto.
484         * html/canvas/CanvasRenderingContext2D.h: Updated for above.
485         * html/canvas/CanvasRenderingContext2D.idl: Use non-legacy exceptions
486         and removed exceptions entirely in other cases.
487
488         * html/canvas/OESVertexArrayObject.cpp:
489         (WebCore::OESVertexArrayObject::OESVertexArrayObject): Take a reference.
490         (WebCore::OESVertexArrayObject::~OESVertexArrayObject): Deleted.
491         (WebCore::OESVertexArrayObject::isVertexArrayOES): Use && instead of
492         multiple return statements.
493         (WebCore::OESVertexArrayObject::bindVertexArrayOES): Removed unneeded
494         ExceptionCode since this does not throw an exception.
495         * html/canvas/OESVertexArrayObject.h: Updated for above.
496         * html/canvas/OESVertexArrayObject.idl: Removed unneeded exception.
497
498         * html/canvas/WebGL2RenderingContext.cpp:
499         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
500         Removed unneeded ExceptionCode since this does not throw an exception.
501         (WebCore::WebGL2RenderingContext::texSubImage2DBase): Ditto.
502         (WebCore::WebGL2RenderingContext::texSubImage2DImpl): Ditto.
503         (WebCore::WebGL2RenderingContext::texSubImage2D): Removed unneeded
504         ExceptionCode for some overloads, for the others, use ExceptionOr
505         for the security exception. Moved security exception code here from
506         the validate functions.
507         (WebCore::WebGL2RenderingContext::validateTexFuncParameters): Removed
508         unneeded ExceptionCode.
509         (WebCore::WebGL2RenderingContext::getParameter): Ditto.
510         * html/canvas/WebGL2RenderingContext.h: Updated for above.
511
512         * html/canvas/WebGLRenderingContext.cpp:
513         (WebCore::WebGLRenderingContext::getExtension): Pass a reference.
514         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
515         Remvoed unneeded ExceptionCode since this does not throw an exception.
516         (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto.
517         (WebCore::WebGLRenderingContext::texSubImage2DImpl): Ditto.
518         (WebCore::WebGLRenderingContext::texSubImage2D): Removed unneeded
519         ExceptionCode for some overloads, for the others, use ExceptionOr
520         for the security exception. Moved security exception code here from
521         the validate functions.
522         (WebCore::WebGLRenderingContext::getParameter): Removed unneeded
523         ExceptionCode.
524         * html/canvas/WebGLRenderingContext.h: Updated for above changes.
525
526         * html/canvas/WebGLRenderingContextBase.cpp:
527         (WebCore::WebGLRenderingContextBase::texImage2DBase):
528         Remvoed unneeded ExceptionCode since this does not throw an exception.
529         (WebCore::WebGLRenderingContextBase::texImage2DImpl): Ditto.
530         (WebCore::WebGLRenderingContextBase::texImage2D): Removed unneeded
531         ExceptionCode for some overloads, for the others, use ExceptionOr
532         for the security exception. Moved security exception code here from
533         the validate functions.
534         (WebCore::WebGLRenderingContextBase::validateHTMLImageElement):
535         Moved the security exception out of here to the call sites.
536         (WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement): Ditto.
537         (WebCore::WebGLRenderingContextBase::validateHTMLVideoElement): Ditto.
538         * html/canvas/WebGLRenderingContextBase.h: Updated for above changes.
539         * html/canvas/WebGLRenderingContextBase.idl: Use non-legacy exceptions
540         in some cases and no exceptions at all in many others.
541
542         * html/shadow/MediaControlElements.cpp:
543         (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
544         Use a reference instead of a pointer.
545
546         * html/track/DataCue.h: Use pragma once.
547         * html/track/DataCue.idl: Use non-legacy exception for constructor
548         attribute, even though it is custom and so it has no effect.
549
550         * html/track/InbandDataTextTrack.cpp:
551         (WebCore::InbandDataTextTrack::create): Use RefPtr&&.
552         (WebCore::InbandDataTextTrack::InbandDataTextTrack): Ditto.
553         (WebCore::InbandDataTextTrack::addDataCue): Stop using
554         ASSERT_NO_EXCEPTION.
555         (WebCore::InbandDataTextTrack::removeDataCue): Stop using
556         IGNORE_EXCEPTION.
557         (WebCore::InbandDataTextTrack::removeCue): Use ExceptionOr.
558         Also use remove instead of find/remove.
559         * html/track/InbandDataTextTrack.h: Updated for above changes.
560
561         * html/track/InbandGenericTextTrack.cpp:
562         (WebCore::GenericTextTrackCueMap::GenericTextTrackCueMap): Deleted.
563         (WebCore::GenericTextTrackCueMap::~GenericTextTrackCueMap): Deleted.
564         (WebCore::GenericTextTrackCueMap::add): Take references intead of
565         pointers.
566         (WebCore::GenericTextTrackCueMap::find): Ditto. Also use get
567         instead of find.
568         (WebCore::GenericTextTrackCueMap::remove): Ditto. Also use take
569         instead of double hashing to both find and remove.
570         (WebCore::InbandGenericTextTrack::updateCueFromCueData): Stop using
571         IGNORE_EXCEPTION. Also got rid of code that is converting a double
572         to a long and then back to a double by using lround. Instead just
573         use std::round, which keeps it a double. But also, why does this need
574         to round?!
575         (WebCore::InbandGenericTextTrack::addGenericCue): Updated to use
576         reference to work with m_cueMap.
577         (WebCore::InbandGenericTextTrack::updateGenericCue): Ditto.
578         (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
579         (WebCore::InbandGenericTextTrack::removeCue): Use ExceptionOr.
580         (WebCore::InbandGenericTextTrack::newCuesParsed): Removed
581         ASSERT_NO_EXCEPTION.
582         * html/track/InbandGenericTextTrack.h: Updated for above changes.
583
584         * html/track/InbandWebVTTTextTrack.cpp:
585         (WebCore::InbandWebVTTTextTrack::newCuesParsed): Removed
586         ASSERT_NO_EXCEPTION.
587
588         * html/track/TextTrack.cpp:
589         (WebCore::TextTrack::addCue): Use ExcepctionOr.
590         (WebCore::TextTrack::removeCue): Ditto.
591         (WebCore::TextTrack::addRegion): Ditto.
592         (WebCore::TextTrack::removeRegion): Ditto.
593         * html/track/TextTrack.h: Updated for above changes.
594         * html/track/TextTrack.idl: Ditto.
595
596         * html/track/TextTrackCue.cpp:
597         (WebCore::TextTrackCue::cueShadowPseudoId): Moved this here
598         since it does not need to be inlined in the header.
599         (WebCore::TextTrackCue::~TextTrackCue): Deleted.
600         (WebCore::TextTrackCue::setStartTime): Removed ExceptionCode&
601         since the exceptions were for non-finite values, but this is
602         now handled by the bindings.
603         (WebCore::TextTrackCue::setEndTime): Ditto.
604         * html/track/TextTrackCue.h: Updated for the above.
605         * html/track/TextTrackCue.idl: Removed SetterMayThrowLegacyException
606         and made startTime and endTime be double rather than unrestricted double.
607
608         * html/track/TextTrackCueGeneric.cpp:
609         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
610         Use a reference instead of a pointer.
611         (WebCore::TextTrackCueGeneric::TextTrackCueGeneric): Initialize
612         m_defaultPosition in the class definition instead of here.
613         (WebCore::TextTrackCueGeneric::createDisplayTree): Return a Ref.
614         (WebCore::TextTrackCueGeneric::setLine): Use ExceptionOr.
615         (WebCore::TextTrackCueGeneric::setPosition): Ditto.
616         (WebCore::TextTrackCueGeneric::setFontSize): Updated since
617         displayTreeInternal() now returns a reference.
618         * html/track/TextTrackCueGeneric.h: Updated for above changes.
619         Also fixed some arguument types and made some more things private.
620
621         * html/track/VTTCue.cpp:
622         (WebCore::VTTCue::createDisplayTree): Return a Ref.
623         (WebCore::VTTCue::displayTreeInternal): Return a reference.
624         (WebCore::VTTCue::setVertical): Use ExceptionOr.
625         (WebCore::VTTCue::setLine): Ditto.
626         (WebCore::VTTCue::setPosition): Ditto.
627         (WebCore::VTTCue::setSize): Ditto.
628         (WebCore::VTTCue::setAlign): Ditto.
629         (WebCore::VTTCue::getDisplayTree): Return a reference.
630         (WebCore::VTTCue::removeDisplayTree): Updated since
631         displayTreeInternal returns a reference.
632         (WebCore::VTTCue::setFontSize): Ditto.
633         * html/track/VTTCue.h: Updated for the above.
634         * html/track/VTTCue.idl: Use non-legacy exceptions and also
635         restricted doubles.
636
637         * html/track/VTTRegion.cpp:
638         (WebCore::VTTRegion::VTTRegion): Moved default values all into
639         the class definition.
640         (WebCore::VTTRegion::setWidth): Removed the check for non-finite
641         since the bindings now handle that. Use ExcpetionOr.
642         (WebCore::VTTRegion::setHeight): Ditto.
643         (WebCore::VTTRegion::setRegionAnchorX): Ditto.
644         (WebCore::VTTRegion::setRegionAnchorY): Ditto.
645         (WebCore::VTTRegion::setViewportAnchorX): Ditto.
646         (WebCore::VTTRegion::setViewportAnchorY): Ditto.
647         (WebCore::upKeyword): Added. Shared by the code below.
648         (WebCore::VTTRegion::scroll): Rewrote to be simpler.
649         (WebCore::VTTRegion::setScroll): Rewrote to be simpler.
650         (WebCore::VTTRegion::updateParametersFromRegion): Read and
651         write data members directly to avoid awkward code that is otherwise
652         required just to copy from one object to the other. Also take a
653         const& instead of a pointer for the thing to update from.
654         (WebCore::VTTRegion::parseSettingValue): Use upKeyword.
655         (WebCore::VTTRegion::appendTextTrackCueBox): Take a Ref&&.
656         (WebCore::VTTRegion::getDisplayTree): Do the downcast to Document
657         here instead of using the helper function.
658         (WebCore::VTTRegion::prepareRegionDisplayTree): Ditto.
659         * html/track/VTTRegion.h: Updated for the above.
660         * html/track/VTTRegion.idl: Use non-legacy exceptions and also
661         use restricted dobules, not unrestricted.
662
663 2016-10-22  Chris Dumez  <cdumez@apple.com>
664
665         WebGLRenderingContextBase.texImage2D() should use a union instead of overloading
666         https://bugs.webkit.org/show_bug.cgi?id=163856
667
668         Reviewed by Darin Adler.
669
670         WebGLRenderingContextBase.texImage2D() should use a union instead of overloading:
671         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
672
673         * html/canvas/WebGLRenderingContextBase.cpp:
674         (WebCore::WebGLRenderingContextBase::texImage2D):
675         * html/canvas/WebGLRenderingContextBase.h:
676         * html/canvas/WebGLRenderingContextBase.idl:
677
678 2016-10-22  Antti Koivisto  <antti@apple.com>
679
680         REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed >20%
681         https://bugs.webkit.org/show_bug.cgi?id=163851
682
683         Reviewed by Darin Adler.
684
685         The test calls Scope::flushPendingUpdate a lot and nothing ever happens there.
686
687         Add a separate invalidity bit for descendant scopes and inline the fast path.
688
689         * style/StyleScope.cpp:
690         (WebCore::Style::Scope::flushPendingSelfUpdate):
691         (WebCore::Style::Scope::flushPendingDescendantUpdates):
692         (WebCore::Style::Scope::scheduleUpdate):
693         (WebCore::Style::Scope::flushPendingUpdate): Deleted.
694         * style/StyleScope.h:
695         (WebCore::Style::Scope::hasPendingUpdate):
696         (WebCore::Style::Scope::flushPendingUpdate):
697
698 2016-10-22  Darin Adler  <darin@apple.com>
699
700         Move SVG from ExceptionCode to Exception
701         https://bugs.webkit.org/show_bug.cgi?id=163837
702
703         Reviewed by Chris Dumez.
704
705         * WebCore.xcodeproj/project.pbxproj: Added SVGGraphicsElement.idl.
706
707         * bindings/js/JSSVGLengthCustom.cpp:
708         (WebCore::JSSVGLength::value): Use toJSNumber.
709         (WebCore::JSSVGLength::setValue): Use propagateException.
710         (WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.
711
712         * bindings/scripts/CodeGeneratorJS.pm:
713         (GenerateImplementation): Properly handle SetterMayThrowException
714         in the special case for SVG setters.
715
716         * rendering/style/SVGRenderStyle.h:
717         (WebCore::SVGRenderStyle::initialBaselineShiftValue): Removed
718         ASSERT_NO_EXCEPTION, no longer needed.
719         (WebCore::SVGRenderStyle::initialKerning): Ditto.
720
721         * svg/SVGAltGlyphElement.cpp:
722         (WebCore::SVGAltGlyphElement::setGlyphRef): Use ExceptionOr.
723         (WebCore::SVGAltGlyphElement::setFormat): Ditto.
724         (WebCore::SVGAltGlyphElement::hasValidGlyphElements): Tweaked a bit.
725         * svg/SVGAltGlyphElement.h: Updated for above changes.
726         * svg/SVGAltGlyphElement.idl: Use non-legacy exceptions.
727
728         * svg/SVGAngle.cpp:
729         (WebCore::SVGAngle::valueAsString): Removed unneeded String globals.
730         (WebCore::parseAngleType): Rewrote to be simpler and more direct.
731         (WebCore::SVGAngle::setValueAsString): Use ExceptionOr.
732         (WebCore::SVGAngle::newValueSpecifiedUnits): Ditto.
733         (WebCore::SVGAngle::convertToSpecifiedUnits): Ditto.
734         * svg/SVGAngle.h: Updated for above changes. Initialized data members
735         here in the class definite and removed constructor; default now works.
736         * svg/SVGAngle.idl: Use non-legacy exceptions.
737
738         * svg/SVGAnimateElementBase.cpp:
739         (WebCore::SVGAnimateElementBase::calculateAnimatedValue): Update since
740         CalcMode is now an enum class.
741         * svg/SVGAnimateMotionElement.cpp:
742         (WebCore::SVGAnimateMotionElement::SVGAnimateMotionElement): Ditto.
743
744         * svg/SVGAnimateTransformElement.cpp:
745         (WebCore::SVGAnimateTransformElement::hasValidAttributeType): Update
746         since AttributeType is now an enum class.
747
748         * svg/SVGAnimatedAngle.cpp:
749         (WebCore::SVGAnimatedAngleAnimator::calculateDistance): Removed
750         ASSERT_NO_EXCEPTION, no longer needed.
751
752         * svg/SVGAnimatedBoolean.idl: Use non-legacy exception.
753         * svg/SVGAnimatedEnumeration.idl: Ditto.
754         * svg/SVGAnimatedInteger.idl: Ditto.
755
756         * svg/SVGAnimatedLength.cpp:
757         (WebCore::sharedSVGLength): Deleted.
758         (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): Removed
759         ASSERT_NO_EXCEPTION, no longer needed.
760         (WebCore::parseLengthFromString): Ditto. Also rewrote to not use
761         a shared SVGLength; no benefit to doing that.
762         (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Ditto.
763         * svg/SVGAnimatedLengthList.cpp:
764         (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): Ditto.
765         (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): Ditto.
766
767         * svg/SVGAnimatedNumber.idl: Use non-legacy exception.
768         * svg/SVGAnimatedString.idl: Ditto.
769
770         * svg/SVGAnimatedType.cpp:
771         (WebCore::SVGAnimatedType::setValueAsString): Updated since
772         setValueAsString now uses ExceptionOr.
773
774         * svg/SVGAnimationElement.cpp:
775         (WebCore::SVGAnimationElement::SVGAnimationElement): Initialized scalars
776         in the class definition instead of here.
777         (WebCore::SVGAnimationElement::getSimpleDuration): Removed uneeded ExceptionCode&.
778         (WebCore::SVGAnimationElement::setCalcMode): Updated since CalcMode is now an enum class.
779         (WebCore::SVGAnimationElement::setAttributeType): Updated since AttributeType
780         is now an enum class.
781         (WebCore::SVGAnimationElement::shouldApplyAnimation): Ditto.
782         (WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced): Ditto.
783         (WebCore::SVGAnimationElement::calculatePercentForSpline): Ditto.
784         (WebCore::SVGAnimationElement::calculatePercentFromKeyPoints): Ditto.
785         (WebCore::SVGAnimationElement::calculatePercentForFromTo): Ditto.
786         (WebCore::SVGAnimationElement::currentValuesFromKeyPoints): Ditto.
787         (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): Ditto.
788         (WebCore::SVGAnimationElement::startedActiveInterval): Ditto.
789         (WebCore::SVGAnimationElement::updateAnimation): Ditto.
790         (WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): Ditto.
791
792         * svg/SVGAnimationElement.h: Changed CalcMode into an enum class.
793         Updated for above changes.
794
795         * svg/SVGAnimationElement.idl: Removed MayThrowLegacyException from
796         getSimpleDuration.
797
798         * svg/SVGColor.cpp:
799         (WebCore::SVGColor::SVGColor): Updated to take scalar in the straightforward
800         manner instead of constt SVGColorType&.
801         (WebCore::SVGColor::setRGBColor): Use ExceptionOr.
802         (WebCore::SVGColor::setRGBColorICCColor): Ditto.
803         (WebCore::SVGColor::setColor): Ditto.
804         * svg/SVGColor.h: Updated for above changes. Removed unneeded destructor.
805         * svg/SVGColor.idl: Use non-legacy exceptions.
806
807         * svg/SVGGlyphRefElement.cpp:
808         (WebCore::SVGGlyphRefElement::SVGGlyphRefElement): Initialize data members
809         in class definition, not here.
810         (WebCore::parseFloat): Added helper. Used in parseAttribute.
811         (WebCore::SVGGlyphRefElement::parseAttribute): Updated to use parseFloat helper.
812         (WebCore::SVGGlyphRefElement::glyphRef): Deleted.
813         (WebCore::SVGGlyphRefElement::setGlyphRef): Deleted.
814         (WebCore::SVGGlyphRefElement::setX): Removed unused Exception& argument.
815         (WebCore::SVGGlyphRefElement::setY): Ditto.
816         (WebCore::SVGGlyphRefElement::setDx): Ditto.
817         (WebCore::SVGGlyphRefElement::setDy): Ditto.
818         * svg/SVGGlyphRefElement.h: Updated for above changes.
819         * svg/SVGGlyphRefElement.idl: Use Reflect on glyphRef. Removed incorrect
820         SetterMayThrowLegacyException attributes for x, y, dx, and dy. Longer term
821         it might be nice to use [Reflect] on these too.
822
823         * svg/SVGGraphicsElement.idl: Use non-legacy exception.
824
825         * svg/SVGLength.cpp:
826         (WebCore::parseLengthType): Changed argument type since caller does not
827         need to know how many characters are consumed.
828         (WebCore::SVGLength::SVGLength): Removed IGNORE_EXCEPTION and ASSERT_NO_EXCEPTION.
829         Also removed the copy constructor, letting the compiler generate the default.
830         (WebCore::SVGLength::setValueAsString): Use ExceptionOr.
831         (WebCore::SVGLength::construct): Updated since setValueAsString uses ExceptionOr.
832         (WebCore::SVGLength::value): Ditto.
833         (WebCore::SVGLength::valueForBindings): Use ExceptionOr. Also renamed to
834         disambiguate with the version used outside of bindings.
835         (WebCore::SVGLength::setValue): Use ExceptionOr.
836         (WebCore::SVGLength::newValueSpecifiedUnits): Ditto.
837         (WebCore::SVGLength::convertToSpecifiedUnits): Ditto.
838         (WebCore::SVGLength::fromCSSPrimitiveValue): Updated since newValueSpecifiedUnits
839         uses ExceptionOr.
840         (WebCore::SVGLength::lengthModeForAnimatedLengthAttribute): Rewrote map generation
841         code to be more efficient and not unrolled. Only do one hash table lookup.
842         * svg/SVGLength.h: Updated for above changes.
843         * svg/SVGLength.idl: Use non-legacy exceptions.
844
845         * svg/SVGLengthContext.cpp:
846         (WebCore::SVGLengthContext::valueForLength): Update since function
847         uses ExceptionOr.
848         (WebCore::SVGLengthContext::convertValueToUserUnits): Use ExceptionOr.
849         (WebCore::SVGLengthContext::convertValueFromUserUnits): Ditto.
850         (WebCore::SVGLengthContext::convertValueFromUserUnitsToPercentage): Ditto.
851         (WebCore::SVGLengthContext::convertValueFromPercentageToUserUnits): Ditto.
852         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS): Ditto.
853         (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits): Ditto.
854         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEXS): Ditto.
855         (WebCore::SVGLengthContext::convertValueFromEXSToUserUnits): Ditto.
856         * svg/SVGLengthContext.h: Updatedfor above changes.
857
858         * svg/SVGLengthList.cpp:
859         (WebCore::SVGLengthList::parse): Updated since setValueAsString uses
860         ExceptionOr now.
861         * svg/SVGLengthList.h: Removed unneeded constructor.
862         * svg/SVGLengthList.idl: Use non-legacy exceptions.
863
864         * svg/SVGLocatable.cpp:
865         (WebCore::SVGLocatable::getTransformToElement): Use ExceptionOr.
866         * svg/SVGLocatable.h: Updated for above change.
867
868         * svg/SVGMarkerElement.h:
869         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
870         Updated since setValueAsString uses ExceptionOr now.
871
872         * svg/SVGMatrix.h: Use ExceptionOr.
873         * svg/SVGMatrix.idl: Use non-legacy exceptions.
874
875         * svg/SVGNumberList.h: Removed unneeded constructor.
876         * svg/SVGNumberList.idl: Use non-legacy exceptions.
877
878         * svg/SVGPaint.cpp:
879         (WebCore::SVGPaint::setPaint): Use ExceptionOr.
880         * svg/SVGPaint.h: Updated for above chagne.
881         * svg/SVGPaint.idl: Use non-legacy exception.
882
883         * svg/SVGPathSegList.h: Tweaked a bit.
884         * svg/SVGPathSegList.idl: Use non-legacy exceptions.
885
886         * svg/SVGPointList.h: Removed unneeded constructor.
887         * svg/SVGPointList.idl: Use non-legacy exceptions.
888
889         * svg/SVGPreserveAspectRatio.cpp:
890         (WebCore::SVGPreserveAspectRatio::setAlign): Use ExceptionOr.
891         (WebCore::SVGPreserveAspectRatio::setMeetOrSlice): Ditto.
892         * svg/SVGPreserveAspectRatio.h: Updated for above changes.
893         * svg/SVGPreserveAspectRatio.idl: Use non-legacy exceptions.
894
895         * svg/SVGSVGElement.cpp:
896         (WebCore::SVGSVGElement::currentView): Pass a reference.
897
898         * svg/SVGStringList.h: Tweaked a bit.
899         * svg/SVGStringList.idl: Use non-legacy exceptions.
900
901         * svg/SVGStyleElement.cpp:
902         (WebCore::SVGStyleElement::setType): Removed unneeded ExceptionCode&.
903         (WebCore::SVGStyleElement::setMedia): Ditto.
904         (WebCore::SVGStyleElement::setTitle): Deleted.
905         * svg/SVGStyleElement.h: Updated for above changes, and made the title
906         function override be private.
907         * svg/SVGStyleElement.idl: Use Reflect for title. Removed unneeded
908         SetterMayThrowLegacyException on all attributes.
909
910         * svg/SVGTextContentElement.cpp:
911         (WebCore::SVGTextContentElement::textLengthAnimated): Removed
912         ASSERT_NO_EXCEPTION, won't work any more.
913         (WebCore::SVGTextContentElement::getSubStringLength): Use ExceptionOr.
914         Also remove redundant call to updateLayoutIgnorePendingStylesheets,
915         called by getNumberOfChars.
916         (WebCore::SVGTextContentElement::getStartPositionOfChar): Ditto.
917         (WebCore::SVGTextContentElement::getEndPositionOfChar): Ditto.
918         (WebCore::SVGTextContentElement::getExtentOfChar): Ditto.
919         (WebCore::SVGTextContentElement::getRotationOfChar): Ditto.
920         (WebCore::SVGTextContentElement::selectSubString): Ditto.
921         * svg/SVGTextContentElement.h: Updated for above changes.
922         * svg/SVGTextContentElement.idl: Use non-legacy exceptions.
923
924         * svg/SVGTransformList.h: Removed unneeded constructor.
925         * svg/SVGTransformList.idl: Use non-legacy exceptions.
926
927         * svg/SVGViewSpec.cpp:
928         (WebCore::SVGViewSpec::SVGViewSpec): Updated to take a reference.
929         (WebCore::SVGViewSpec::setZoomAndPan): Use ExceptionOr.
930         (WebCore::SVGViewSpec::setTransformString): Deleted.
931         (WebCore::SVGViewSpec::viewBoxString): Use m_viewBox directly.
932         (WebCore::SVGViewSpec::preserveAspectRatioString): Use
933         m_preserveAspectRatio directly.
934         (WebCore::SVGViewSpec::viewTarget): Use is<SVGElement>.
935         (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Use
936         m_contextElement directly.
937         (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
938         Ditto.
939         (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Ditto.
940         (WebCore::SVGViewSpec::parseViewSpec): Set m_viewTargetString directly.
941         * svg/SVGViewSpec.h: Updated for above changes. Removed unneeded virtual
942         destructor, unneeded using for ref/deref, unused functions including
943         setTransformString, setViewTargetString, non-exception setZoomAndPan,
944         contextElement, viewBoxBaseValue, and preserveAspectRatioBaseValue.
945         * svg/SVGViewSpec.idl: Use non-legacy exceptions. Also specify
946         ImplementationLacksVTable.
947
948         * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
949         Use ExceptionOr.
950         * svg/properties/SVGAnimatedStaticPropertyTearOff.h: Ditto.
951         * svg/properties/SVGListProperty.h: Ditto.
952         * svg/properties/SVGListPropertyTearOff.h: Ditto.
953          * svg/properties/SVGPathSegListPropertyTearOff.cpp:
954         (WebCore::SVGPathSegListPropertyTearOff::clear): Ditto.
955         (WebCore::SVGPathSegListPropertyTearOff::getItem): Ditto.
956         (WebCore::SVGPathSegListPropertyTearOff::replaceItem): Ditto.
957         (WebCore::SVGPathSegListPropertyTearOff::removeItem): Ditto.
958         * svg/properties/SVGPathSegListPropertyTearOff.h: Ditto.
959         * svg/properties/SVGPropertyTearOff.h: Ditto. Also added an overload
960         of create that knows how to deal with exceptions.
961         * svg/properties/SVGStaticListPropertyTearOff.h: Ditto.
962         * svg/properties/SVGTransformListPropertyTearOff.h: Ditto.
963
964 2016-10-22  Chris Dumez  <cdumez@apple.com>
965
966         WebGLRenderingContextBase.bufferData() should use a union instead of overloading
967         https://bugs.webkit.org/show_bug.cgi?id=163795
968
969         Reviewed by Darin Adler.
970
971         WebGLRenderingContextBase.bufferData() / bufferSubData() should use a union
972         instead of overloading:
973         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
974
975         No new tests, no web-exposed behavior change.
976
977         * bindings/js/JSDOMConvert.h:
978         (WebCore::Converter<IDLInterface<T>>::convert):
979         * bindings/scripts/CodeGeneratorJS.pm:
980         (GenerateHeader):
981         * bindings/scripts/test/JS/JSInterfaceName.h:
982         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
983         * bindings/scripts/test/JS/JSTestCEReactions.h:
984         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
985         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
986         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
987         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
988         * bindings/scripts/test/JS/JSTestEventConstructor.h:
989         * bindings/scripts/test/JS/JSTestEventTarget.h:
990         * bindings/scripts/test/JS/JSTestException.h:
991         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
992         * bindings/scripts/test/JS/JSTestGlobalObject.h:
993         * bindings/scripts/test/JS/JSTestInterface.h:
994         * bindings/scripts/test/JS/JSTestIterable.h:
995         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
996         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
997         * bindings/scripts/test/JS/JSTestNode.h:
998         * bindings/scripts/test/JS/JSTestNondeterministic.h:
999         * bindings/scripts/test/JS/JSTestObj.h:
1000         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
1001         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
1002         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
1003         * bindings/scripts/test/JS/JSTestSerialization.h:
1004         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1005         * bindings/scripts/test/JS/JSTestTypedefs.h:
1006         * bindings/scripts/test/JS/JSattribute.h:
1007         * bindings/scripts/test/JS/JSreadonly.h:
1008         * html/canvas/WebGL2RenderingContext.cpp:
1009         (WebCore::WebGL2RenderingContext::bufferData):
1010         (WebCore::WebGL2RenderingContext::bufferSubData):
1011         * html/canvas/WebGLRenderingContextBase.cpp:
1012         (WebCore::WebGLRenderingContextBase::bufferData):
1013         (WebCore::WebGLRenderingContextBase::bufferSubData):
1014         * html/canvas/WebGLRenderingContextBase.h:
1015         * html/canvas/WebGLRenderingContextBase.idl:
1016
1017 2016-10-22  Darin Adler  <darin@apple.com>
1018
1019         [Cocoa] REGRESSION (r204508): Crash in init_WebCreateFragment when pasting (seen in multiple apps using legacy WebKit)
1020         https://bugs.webkit.org/show_bug.cgi?id=163839
1021
1022         Reviewed by Dan Bernstein.
1023
1024         * editing/cocoa/EditorCocoa.mm: Use the appropriate SOFT_LINK macros to find
1025         the WebKitLegacy platform in the correct location for iOS and macOS.
1026
1027 2016-10-22  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1028
1029         Bindings error message for missing required dictionary member should be more explicit
1030         https://bugs.webkit.org/show_bug.cgi?id=163665
1031
1032         Reviewed by Darin Adler.
1033
1034         Add throwRequiredMemberTypeError function to throw a TypeError exception with an error
1035         message indicating the missing required member.
1036
1037         No new test required, rebase existing tests.
1038
1039         * bindings/js/JSDOMBinding.cpp:
1040         (WebCore::throwRequiredMemberTypeError):
1041         * bindings/js/JSDOMBinding.h:
1042         * bindings/scripts/CodeGeneratorJS.pm:
1043         (GenerateDictionaryImplementationContent):
1044         * bindings/scripts/test/JS/JSTestObj.cpp:
1045         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1046
1047 2016-10-22  Ryosuke Niwa  <rniwa@webkit.org>
1048
1049         Upgrading custom element should enqueue attributeChanged and connected callbacks
1050         https://bugs.webkit.org/show_bug.cgi?id=163840
1051
1052         Reviewed by Darin Adler.
1053
1054         When upgrading a custom element, enqueue attributeChanged and connectedCallbacks as needed as specified
1055         in step 3 and 4 of: https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element
1056
1057         Test: fast/custom-elements/upgrading-enqueue-reactions.html
1058
1059         * bindings/js/JSCustomElementInterface.cpp:
1060         (WebCore::JSCustomElementInterface::upgradeElement): Enqueue 
1061         * dom/CustomElementReactionQueue.cpp:
1062         (WebCore::CustomElementReactionQueueItem::invoke): Don't invoke callbacks when the custom element had
1063         failed to upgrade.
1064         (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): Added.
1065         (WebCore::CustomElementReactionQueue::invokeAll): Upgrading a custom element may enqueue more reactions.
1066         Keep invoking reactions until the queue becomes empty.
1067         * dom/CustomElementReactionQueue.h:
1068         * dom/Range.idl: Added a forgotten CEReactions here.
1069
1070 2016-10-21  David Kilzer  <ddkilzer@apple.com>
1071
1072         Bug 163762: IntSize::area() should used checked arithmetic
1073         <https://webkit.org/b/163762>
1074
1075         Reviewed by Darin Adler.
1076
1077         No new tests since no change in nominal behavior.
1078
1079         * platform/graphics/IntSize.h:
1080         (WebCore::IntSize::area): Change to return a
1081         Checked<unsigned, T> value. Use WTF:: namespace to avoid
1082         including another header.
1083
1084         * platform/graphics/IntRect.h:
1085         (WebCore::IntRect::area): Ditto.
1086
1087         The remaining changes are to use the Checked<unsigned> return
1088         value of IntSize::area() and IntRect::area() correctly in
1089         context, in addition to items noted below.
1090
1091         * html/HTMLPlugInImageElement.cpp:
1092         (WebCore::HTMLPlugInImageElement::isTopLevelFullPagePlugin):
1093         Declare contentWidth and contentHeight as float values to
1094         prevent overflow when computing the area, and to make the
1095         inequality comparison in the return statement uses the same type
1096         for both sides.
1097         * html/ImageData.cpp:
1098         (WebCore::ImageData::ImageData):
1099         * html/MediaElementSession.cpp:
1100         (WebCore::isElementRectMostlyInMainFrame):
1101         * platform/graphics/ImageBackingStore.h:
1102         (WebCore::ImageBackingStore::setSize): Restructure logic to
1103         compute area only once.
1104         (WebCore::ImageBackingStore::clear):
1105         * platform/graphics/ImageFrame.h:
1106         (WebCore::ImageFrame::frameBytes):
1107         * platform/graphics/ImageSource.cpp:
1108         (WebCore::ImageSource::maximumSubsamplingLevel):
1109         * platform/graphics/ca/LayerPool.cpp:
1110         (WebCore::LayerPool::backingStoreBytesForSize):
1111         * platform/graphics/cg/ImageDecoderCG.cpp:
1112         (WebCore::ImageDecoder::frameBytesAtIndex):
1113         * platform/graphics/filters/FEGaussianBlur.cpp:
1114         (WebCore::FEGaussianBlur::platformApplySoftware):
1115         * platform/graphics/filters/FilterEffect.cpp:
1116         (WebCore::FilterEffect::asUnmultipliedImage):
1117         (WebCore::FilterEffect::asPremultipliedImage):
1118         (WebCore::FilterEffect::copyUnmultipliedImage):
1119         (WebCore::FilterEffect::copyPremultipliedImage):
1120         (WebCore::FilterEffect::createUnmultipliedImageResult):
1121         (WebCore::FilterEffect::createPremultipliedImageResult):
1122         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1123         (WebCore::ImageBufferData::getData): Update overflow check,
1124         rename local variable to numBytes, and compute numBytes once.
1125         * platform/graphics/win/ImageDecoderDirect2D.cpp:
1126         (WebCore::ImageDecoder::frameBytesAtIndex):
1127         * platform/image-decoders/ImageDecoder.cpp:
1128         (WebCore::ImageDecoder::frameBytesAtIndex):
1129         * platform/ios/LegacyTileLayerPool.mm:
1130         (WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize):
1131         * rendering/RenderLayerCompositor.cpp:
1132         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas):
1133         * rendering/shapes/Shape.cpp:
1134         (WebCore::Shape::createRasterShape):
1135
1136 2016-10-21  Gavin Barraclough  <barraclough@apple.com>
1137
1138         WebPageProxy should not need PageActivityState
1139         https://bugs.webkit.org/show_bug.cgi?id=163821
1140
1141         Reviewed by Geoff Garen.
1142
1143         The PageActivityState is currently plumbed back from WebCore up to the UI process, to
1144         determine whether to enabled process suppression. However the information it contains
1145         (whether a page load is ongoing, whether audio is playing) is already available via
1146         other means. Remove this use of PageActivityState.
1147
1148         * html/HTMLMediaElement.cpp:
1149         (WebCore::HTMLMediaElement::mediaState):
1150             - Fix a bug in how we compute IsPlayingAudio - if the volume of the MediaElement is
1151               set to zero, then audio is not playing (we were already checking muted).
1152         * page/ChromeClient.h:
1153             - removed setPageActivityState
1154         * page/Page.cpp:
1155         (WebCore::Page::setPageActivityState): Deleted.
1156             - setPageActivityState -> pageActivityStateChanged, remove call to ChromeClient
1157         * page/Page.h:
1158         (WebCore::Page::pageActivityStateChanged):
1159             - setPageActivityState -> pageActivityStateChanged
1160         * page/PageThrottler.cpp:
1161         (WebCore::PageThrottler::setActivityFlag):
1162             - setPageActivityState -> pageActivityStateChanged
1163
1164 2016-10-21  Chris Dumez  <cdumez@apple.com>
1165
1166         [Web ID] Overload resolution is wrong if one of the types is a nullable union
1167         https://bugs.webkit.org/show_bug.cgi?id=163816
1168
1169         Reviewed by Alex Christensen.
1170
1171         Overload resolution was wrong if one of the types was a nullable union. This
1172         is because we never considered the union type itself, only its subtypes.
1173         Therefore, we checked if any of the union's subtypes were nullable but we
1174         failed to check if the union itself was nullable.
1175
1176         See:
1177         - https://heycam.github.io/webidl/#es-overloads (Step 11.3.)
1178
1179         No new tests, extended bindings tests.
1180
1181         * bindings/scripts/CodeGeneratorJS.pm:
1182         (GetOverloadThatMatchesIgnoringUnionSubtypes):
1183         (GenerateOverloadedFunctionOrConstructor):
1184         * bindings/scripts/test/JS/JSTestObj.cpp:
1185         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1):
1186         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1Caller):
1187         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2):
1188         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2Caller):
1189         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion):
1190         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1):
1191         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Caller):
1192         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2):
1193         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2Caller):
1194         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion):
1195         * bindings/scripts/test/TestObj.idl:
1196
1197 2016-10-21  Eric Carlson  <eric.carlson@apple.com>
1198
1199         [MediaStream] Dynamically generate media capture sandbox extensions
1200         https://bugs.webkit.org/show_bug.cgi?id=154861
1201         <rdar://problem/24909411>
1202
1203         Reviewed by Tim Horton.
1204
1205         No new tests, some of these changes are covered by existing tests and some can only be tested
1206         with physical capture devices.
1207
1208         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: AVSampleBufferAudioRenderer
1209           and AVSampleBufferRenderSynchronizer are now declared in AVFoundationSPI.h.
1210
1211         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1212         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1213         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Initialize 
1214           AVSampleBufferRenderSynchronizer.
1215         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Fail if AVSampleBufferRenderSynchronizer
1216           isn't available.
1217         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Take a MediaSample&
1218           instead of a PlatformSample&.
1219         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Ditto.
1220         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Add the sample buffer display 
1221           later to the synchronizer.
1222         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Remove the sample buffer display 
1223           later from the synchronizer.
1224         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Start the synchronizer.
1225         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Stash the current clock time in 
1226           m_pausedTime, but leave the clock running. Pause the synchronizer.
1227         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime): Return the clock time
1228           when playing, m_pausedTime time when paused because we leave the clock running forever.
1229         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
1230
1231         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: AVSampleBufferAudioRenderer
1232           is now declared in AVFoundationSPI.h.
1233
1234         * platform/spi/mac/AVFoundationSPI.h: Add AVSampleBufferAudioRenderer and AVSampleBufferRenderSynchronizer.
1235
1236 2016-10-21  Commit Queue  <commit-queue@webkit.org>
1237
1238         Unreviewed, rolling out r207582.
1239         https://bugs.webkit.org/show_bug.cgi?id=163819
1240
1241         Not quite ready rdar://problem/28897179 (Requested by
1242         alexchristensen on #webkit).
1243
1244         Reverted changeset:
1245
1246         "Re-enable URLParser for non-Safari Cocoa apps after r207321"
1247         https://bugs.webkit.org/show_bug.cgi?id=163690
1248         http://trac.webkit.org/changeset/207582
1249
1250 2016-10-21  Gavin Barraclough  <barraclough@apple.com>
1251
1252         WebPage should take UserActivity directly for user input
1253         https://bugs.webkit.org/show_bug.cgi?id=163813
1254
1255         Reviewed by Anders Carlsson.
1256
1257         When we receive mouse/keyboard events in a page, we want to prevent AppNap. We currently do so
1258         via the PageThrottler. This patch is to just make the WebPage drive the UserActivity directly.
1259
1260         Two reasons to do so: (1) to cleanup & simplify for further refactoring. (2) The current code
1261         isn't really achieving the desired effect. The page setting the flag in the throttler to get
1262         the activity to be set is now a less effective way of achieving this goal, since the
1263         PageActivityState bounces back across to the UI process & then messages back to the WebContent
1264         process to take the UserActivity. These extra hops defeat the purpose of making sure the boost
1265         from the initial message isn't lost.
1266
1267         * page/PageThrottler.cpp:
1268         (WebCore::PageThrottler::PageThrottler):
1269         (WebCore::m_userInputHysteresis): Deleted.
1270         * page/PageThrottler.h:
1271         (WebCore::PageThrottler::didReceiveUserInput): Deleted.
1272             - removed PageActivityState::UserInputActivity, didReceiveUserInput, m_userInputHysteresis.
1273
1274 2016-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1275
1276         Support (insertFrom|deleteBy)Composition and (insert|delete)CompositionText inputTypes for InputEvents
1277         https://bugs.webkit.org/show_bug.cgi?id=163460
1278         <rdar://problem/28784142>
1279
1280         Reviewed by Darin Adler.
1281
1282         Adds basic support for the composition inputTypes in the InputEvent spec. See w3.org/TR/input-events,
1283         github.com/w3c/input-events/issues/41 and github.com/w3c/input-events/issues/42 for more details. While input
1284         events are fired in the correct order with respect to each other, additional work will be required to ensure
1285         that input events are fired in the correct order with respect to composition(start|update|end) events and
1286         textInput events. This is held off until the expected ordering of events is officially defined in the spec.
1287
1288         Tests: fast/events/before-input-events-prevent-insert-composition.html
1289                fast/events/before-input-events-prevent-recomposition.html
1290                fast/events/input-events-ime-composition.html
1291                fast/events/input-events-ime-recomposition.html
1292
1293         * editing/CompositeEditCommand.cpp:
1294         (WebCore::CompositeEditCommand::apply):
1295         * editing/CompositeEditCommand.h:
1296         (WebCore::CompositeEditCommand::isBeforeInputEventCancelable):
1297
1298         Adds a new virtual method hook for subclasses to mark their `beforeinput` events as non-cancelable (see
1299         TypingCommand::isBeforeInputEventCancelable). By default, `beforeinput` events are cancelable.
1300
1301         * editing/EditAction.h:
1302
1303         Adds 4 new EditActions corresponding to the 4 composition-related inputTypes. These are:
1304         EditActionTypingDeletePendingComposition    => "deleteCompositionText"
1305         EditActionTypingDeleteFinalComposition      => "deleteByComposition"
1306         EditActionTypingInsertPendingComposition    => "insertCompositionText"
1307         EditActionTypingInsertFinalComposition      => "insertFromComposition"
1308
1309         * editing/EditCommand.cpp:
1310         (WebCore::inputTypeNameForEditingAction):
1311         * editing/Editor.cpp:
1312         (WebCore::dispatchBeforeInputEvent):
1313         (WebCore::dispatchBeforeInputEvents):
1314         (WebCore::Editor::willApplyEditing):
1315         (WebCore::Editor::insertTextWithoutSendingTextEvent):
1316         (WebCore::Editor::setComposition):
1317
1318         In setComposition(text, mode), tweak the logic for committing a composition to always delete the selection
1319         before inserting the final composition text. In setComposition(text, underlines, start, end), catch the case
1320         where we're beginning to recompose an existing range in the DOM and delete the recomposed text first.
1321
1322         * editing/TypingCommand.cpp:
1323         (WebCore::editActionForTypingCommand):
1324         (WebCore::TypingCommand::TypingCommand):
1325         (WebCore::TypingCommand::deleteSelection):
1326
1327         Adds a TextCompositionType parameter so that call sites (see Editor::setComposition) can indicate what state the
1328         edited composition is in. This allows us to differentiate between deletion of finalized composition text in
1329         preparation of recomposing a range in the DOM, and deletion of composition text that has not yet been committed
1330         in preparation for inserting a finalized composition into the DOM.
1331
1332         (WebCore::TypingCommand::deleteKeyPressed):
1333         (WebCore::TypingCommand::forwardDeleteKeyPressed):
1334         (WebCore::TypingCommand::insertText):
1335         (WebCore::TypingCommand::insertLineBreak):
1336         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
1337         (WebCore::TypingCommand::insertParagraphSeparator):
1338         (WebCore::TypingCommand::isBeforeInputEventCancelable):
1339         (WebCore::TypingCommand::inputEventData):
1340         (WebCore::TypingCommand::willAddTypingToOpenCommand):
1341         * editing/TypingCommand.h:
1342
1343 2016-10-21  Dave Hyatt  <hyatt@apple.com>
1344
1345         [CSS Parser] Make sure shadow user agent sheets parse in UASheetMode
1346         https://bugs.webkit.org/show_bug.cgi?id=163810
1347
1348         Reviewed by Dean Jackson.
1349
1350         * dom/InlineStyleSheetOwner.cpp:
1351         (WebCore::parserContextForElement):
1352         (WebCore::makeInlineStyleSheetCacheKey):
1353         (WebCore::InlineStyleSheetOwner::createSheet):
1354         (WebCore::parserContextForForElement): Deleted.
1355
1356 2016-10-21  Jer Noble  <jer.noble@apple.com>
1357
1358         YouTube stalls when seeking beyond buffered range
1359         https://bugs.webkit.org/show_bug.cgi?id=162813
1360
1361         Reviewed by Eric Carlson.
1362
1363         When seeking a MediaPlayerPrivateMediaSourceAVFObjC, we will first seek the AVSampleBufferRenderSynchronizer,
1364         flush and enqueue non-displaying frames, enqueue regular frames, then begin playback. The above stall will occur
1365         when we enqueue so many non- displaying frames that the display layer is not ready for normal ones before
1366         playback begins. Then, when the synchronizer attempts to synchronize the enqueued audio and video renderers, the
1367         only available samples are back at the original media time, and so it "seeks" by updating the CMTimebase back to
1368         the original media time, causing playback to appear "stalled".  The overall solution is to "flush" the contents
1369         of the renderers before the seek, so that the synchronizer doesn't reset the currentTime, and to only restart
1370         the synchronizer when there are visible (or audible) samples available for display.
1371
1372         Breaking the fix down into sections:
1373
1374         = Don't enqueue too many non-displaying samples at once:
1375         - Rename SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples() to SourceBufferPrivate::flush(), and no longer
1376           pass in an array of non-displaying samples.
1377         - Add a new virtual method to MediaSample, createNonDisplayingCopy(), used by SourceBuffer to enqueue non-displaying
1378           samples.
1379         - in SourceBuffer::reenqueueMediaForTime(), use that new createNonDisplayingCopy() method to enqueue non-displaying
1380           samples in the same queue as regular samples.
1381
1382         * Modules/mediasource/SourceBuffer.cpp:
1383         (WebCore::SourceBuffer::provideMediaData):
1384         (WebCore::SourceBuffer::reenqueueMediaForTime):
1385         * platform/MediaSample.h:
1386         (WebCore::MediaSample::isNonDisplaying):
1387         * platform/graphics/SourceBufferPrivate.h:
1388         (WebCore::SourceBufferPrivate::flush):
1389         (WebCore::SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples): Renamed -> flush().
1390         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1391         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1392         (WebCore::CMSampleBufferIsNonDisplaying):
1393         (WebCore::MediaSampleAVFObjC::flags):
1394         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy):
1395         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1396         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1397         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
1398         (WebCore::createNonDisplayingCopy): Moved to MediaSampleAVFObjC.
1399         (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples): Renamed -> flush().
1400         * platform/mock/mediasource/MockBox.h:
1401         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1402         (WebCore::MockMediaSample::flags):
1403         (WebCore::MockMediaSample::createNonDisplayingCopy):
1404         * platform/mock/mediasource/MockSourceBufferPrivate.h:
1405
1406         = Don't start playing until all renderers have visible/audible samples:
1407         - SourceBufferPrivateAVFObjC will notify its associated MediaPlayerPrivateMediaSourceAVFObjC when
1408           it flushes and receives visible/audible samples.
1409         - The MediaPlayer will store audio renderers as keys to a HashMap which allows it to track which
1410           have available samples.
1411         - This requires changing all the places where we loop over the available renderers.
1412
1413         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1414         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1415         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1416         (WebCore::SourceBufferPrivateAVFObjC::flush):
1417         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
1418         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1419         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::allRenderersHaveAvailableSamples):
1420         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): Deleted.
1421         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1422         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1423         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
1424         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
1425         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame):
1426         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample):
1427         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples):
1428         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer):
1429         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer):
1430         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
1431         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking):
1432         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::shouldBePlaying):
1433         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
1434         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
1435         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1436         (WebCore::MediaSourcePrivateAVFObjC::willSeek):
1437         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1438
1439         = Don't display new samples mid-seek.
1440         - MediaSource should clear its m_pendingSeekTime ivar, which is used whyn SourceBuffer queries whether or not a
1441           seek is pending, when instructing its SourceBuffers to seekToTime().
1442         - This allows SourceBuffer to decline to enqueue new samples during a MediaSource seek operation.
1443
1444         * Modules/mediasource/MediaSource.cpp:
1445         (WebCore::MediaSource::completeSeek):
1446
1447 2016-10-20  Dean Jackson  <dino@apple.com>
1448
1449         SVG should not paint selection within a mask
1450         https://bugs.webkit.org/show_bug.cgi?id=163772
1451         <rdar://problem/28705129>
1452
1453         Reviewed by Simon Fraser.
1454
1455         When masking content, we shouldn't paint the text
1456         selection as we are rendering into the masking
1457         offscreen buffer.
1458
1459         Test: svg/masking/mask-should-not-paint-selection.html
1460
1461         * rendering/PaintPhase.h: Add a new behavior - PaintBehaviorSkipSelectionHighlight.
1462         * rendering/svg/SVGInlineTextBox.cpp:
1463         (WebCore::SVGInlineTextBox::paint): Don't update the selectionStyle if
1464         PaintBehaviorSkipSelectionHighlight is true.
1465         * rendering/svg/SVGRenderingContext.cpp:
1466         (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Add PaintBehaviorSkipSelectionHighlight
1467         to the PaintInfo.
1468
1469 2016-10-21  Chris Dumez  <cdumez@apple.com>
1470
1471         [Web IDL] MediaControlsHost has invalid operation overloads
1472         https://bugs.webkit.org/show_bug.cgi?id=163793
1473
1474         Reviewed by Darin Adler.
1475
1476         MediaControlsHost has invalid operation overloads:
1477         - sortedTrackListForMenu()
1478         - displayNameForTrack()
1479
1480         The parameter is nullable for both overloads which is not valid IDL.
1481
1482         - sortedTrackListForMenu(): The parameter is no longer nullable. This is a minor
1483           behavior change and it should be safe since this is Apple-specific and only
1484           called from mediaControlsApple.js which uses HTMLMediaElement.videoTracks and
1485           HTMLMediaElement.audioTracks as input, both of which are not nullable.
1486           Note that we could have also kept one of the parameters as nullable to not
1487           change behavior but allowing null does not seem useful here.
1488         - displayNameForTrack(): Use a union instead of overloading, no behavior change.
1489
1490         * Modules/mediacontrols/MediaControlsHost.cpp:
1491         (WebCore::MediaControlsHost::sortedTrackListForMenu):
1492         (WebCore::MediaControlsHost::displayNameForTrack):
1493         * Modules/mediacontrols/MediaControlsHost.h:
1494         * Modules/mediacontrols/MediaControlsHost.idl:
1495
1496 2016-10-21  Jeremy Jones  <jeremyj@apple.com>
1497
1498         Implement basic pointer lock behavior for WebKit and WebKit2.
1499         https://bugs.webkit.org/show_bug.cgi?id=162745
1500
1501         Reviewed by Simon Fraser.
1502
1503         When ENABLE_POINTER_LOCK is enabled, these tests now pass with DumpRenderTree.
1504         LayoutTests/pointer-lock/lock-already-locked.html
1505         LayoutTests/pointer-lock/lock-element-not-in-dom.html
1506         LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html
1507         LayoutTests/pointer-lock/mouse-event-api.html
1508
1509         Export pointer lock symbols and cancel pointer lock on "escape".
1510
1511         * dom/Document.h: Export symbols.
1512         * dom/Element.h: Export symbols.
1513         * page/EventHandler.cpp:
1514         (WebCore::EventHandler::keyEvent): Cancel pointer lock on "escape".
1515         * page/PointerLockController.cpp: Add missing include.
1516         * page/PointerLockController.h: Export symbols.
1517
1518 2016-10-21  Jer Noble  <jer.noble@apple.com>
1519
1520         WebCore::PlatformMediaSession::stopSession + 13
1521         https://bugs.webkit.org/show_bug.cgi?id=163799
1522
1523         Reviewed by Eric Carlson.
1524
1525         Because m_sessions can be mutated by removeSession() while iterating over m_sessions, and because
1526         PlatformMediaSessions are not refcounted, it is not enough to copy m_sessions into a copied Vector
1527         before iterating. Instead, wrap iteration of m_sessions in a convenience function, which sets an
1528         iteration counter which, when cleared, removes all null entries from m_session. In parallel, modify
1529         removeSession() to check this iteration counter, and replace the session with a null value rather
1530         than mutating the m_sessions vector itself.
1531
1532         * platform/audio/PlatformMediaSessionManager.cpp:
1533         (WebCore::PlatformMediaSessionManager::has):
1534         (WebCore::PlatformMediaSessionManager::activeAudioSessionRequired):
1535         (WebCore::PlatformMediaSessionManager::canProduceAudio):
1536         (WebCore::PlatformMediaSessionManager::removeSession):
1537         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
1538         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
1539         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
1540         (WebCore::PlatformMediaSessionManager::applicationWillEnterBackground):
1541         (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground):
1542         (WebCore::PlatformMediaSessionManager::systemWillSleep):
1543         (WebCore::PlatformMediaSessionManager::systemDidWake):
1544         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument):
1545         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess):
1546         (WebCore::PlatformMediaSessionManager::forEachSession):
1547         (WebCore::PlatformMediaSessionManager::anyOfSessions):
1548         * platform/audio/PlatformMediaSessionManager.h:
1549
1550 2016-10-21  Darin Adler  <darin@apple.com>
1551
1552         Move some more assorted classes from ExceptionCode to Exception
1553         https://bugs.webkit.org/show_bug.cgi?id=163775
1554
1555         Reviewed by Chris Dumez.
1556
1557         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
1558         (WebCore::WorkerGlobalScopeFetch::fetch): Remove unnecessary calls to
1559         WorkerGlobalScope::scriptExcutionObject, which just returns the scope itself.
1560
1561         * Modules/notifications/Notification.cpp: Added now-needed include.
1562         * Modules/webdatabase/DOMWindowWebDatabase.cpp: Ditto.
1563
1564         * WebCore.xcodeproj/project.pbxproj: Added WindowOrWorkerGlobalScope.idl.
1565
1566         * bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp:
1567         (WebCore::JSDedicatedWorkerGlobalScope::postMessage): Pass a reference instead
1568         of a pointer to handlePostMessage.
1569         * bindings/js/JSMessagePortCustom.cpp:
1570         (WebCore::JSMessagePort::postMessage): Ditto.
1571
1572         * bindings/js/JSMessagePortCustom.h: Use pragma once. Change handlePostMessage
1573         to take a reference to the object instead of a pointer, and also to use
1574         propagateException since postMessage now uses ExceptionOr.
1575
1576         * bindings/js/JSWorkerCustom.cpp:
1577         (WebCore::JSWorker::postMessage): Pass a reference instead of a pointer to
1578         handlePostMessage.
1579         (WebCore::constructJSWorker): Use the version of toJSNewlyCreated that handles
1580         propagating an exception from ExceptionOr.
1581
1582         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
1583         (WebCore::JSWorkerGlobalScope::visitAdditionalChildren): Use auto.
1584         Remove unnecessary round trip through the scriptExecutionContext function.
1585         (WebCore::JSWorkerGlobalScope::importScripts): Use reserveInitialCapacity and
1586         uncheckedAppend to build up the vector of strings. Use propagateException
1587         to deal with ExceptionOr result.
1588
1589         * dom/MessagePort.cpp:
1590         (WebCore::MessagePort::MessagePort): Initialize boolean data members in the
1591         class definition instead of here.
1592         (WebCore::MessagePort::postMessage): Use ExceptionOr.
1593         (WebCore::MessagePort::entangle): Use an rvalue reference.
1594         (WebCore::MessagePort::dispatchMessages): Use ExceptionOr.
1595         (WebCore::MessagePort::disentanglePorts): Ditto. Also use a more efficient
1596         idiom that does half as much hashing as the old algorithm, and got rid an
1597         unneeded local variable.
1598         (WebCore::MessagePort::entanglePorts): Use an rvalue reference.
1599         * dom/MessagePort.h: Updated for above changes.
1600
1601         * fileapi/FileReader.cpp:
1602         (WebCore::FileReader::create): Use auto.
1603         (WebCore::FileReader::FileReader): Initialize scalars in the class definition.
1604         (WebCore::FileReader::~FileReader): Call cancel on the loader directly
1605         instead of sharing code with the stop function.
1606         (WebCore::FileReader::stop): Moved the body of the terminate function here.
1607         (WebCore::FileReader::readAsArrayBuffer): Use ExceptionOr.
1608         (WebCore::FileReader::readAsBinaryString): Ditto.
1609         (WebCore::FileReader::readAsText): Ditto.
1610         (WebCore::FileReader::readAsDataURL): Ditto.
1611         (WebCore::FileReader::readInternal): Ditto. Also add a cast now that
1612         we derive privately from FileReaderLoaderClient.
1613         (WebCore::FileReader::abort): Call stop instead of terminate.
1614         (WebCore::FileReader::terminate): Deleted. Moved code into stop.
1615         (WebCore::FileReader::didReceiveData): Moved comment to where the constant is.
1616         * fileapi/FileReader.h: Updated for above changes. Made more functions private
1617         and used final instead of override.
1618         * fileapi/FileReader.idl: Use non-legacy exceptions.
1619
1620         * fileapi/FileReaderSync.cpp:
1621         (WebCore::FileReaderSync::readAsArrayBuffer): Use ExceptionOr.
1622         (WebCore::FileReaderSync::readAsBinaryString): Ditto.
1623         (WebCore::FileReaderSync::readAsText): Ditto.
1624         (WebCore::FileReaderSync::readAsDataURL): Ditto.
1625         (WebCore::FileReaderSync::startLoading): Ditto.
1626         (WebCore::FileReaderSync::startLoadingString): Added. Helper to cut down on
1627         repeated code in functions above.
1628         * fileapi/FileReaderSync.h: Updated for above changes.
1629         * fileapi/FileReaderSync.idl: Use non-legacy exceptions.
1630
1631         * page/Base64Utilities.cpp:
1632         (WebCore::Base64Utilities::btoa): Use ExceptionOr.
1633         (WebCore::Base64Utilities::atob): Ditto.
1634         * page/Base64Utilities.h: Updated for above changes.
1635
1636         * page/DOMWindow.cpp:
1637         (WebCore::DOMWindow::navigator): Pass a reference to the frame.
1638         (WebCore::DOMWindow::postMessage): Use ExceptionOr when calling
1639         MessagePort::disentanglePorts. Also udpated for changes to the
1640         PostMessageTimer.
1641
1642         * page/Navigator.cpp:
1643         (WebCore::Navigator::Navigator): Take a reference.
1644         (WebCore::shouldHideFourDot): Ditto
1645         (WebCore::Navigator::appVersion): Pass a reference.
1646         (WebCore::Navigator::plugins): Return a reference.
1647         (WebCore::Navigator::mimeTypes): Ditto.
1648         * page/Navigator.h: Updated for above changes. Also marked the
1649         class final and moved derivation from RefCounted to NavigatorBase.
1650
1651         * page/NavigatorBase.h: Addded derivation from RefCounted since
1652         both derived classes want that, and the destructor is already virtual.
1653
1654         * page/WindowOrWorkerGlobalScope.idl: Use non-legacy exceptions.
1655
1656         * page/WorkerNavigator.cpp:
1657         (WebCore::WorkerNavigator::~WorkerNavigator): Deleted.
1658
1659         * page/WorkerNavigator.h: Moved derivation from RefCounted to
1660         NavigatorBase. Also marked class final.
1661
1662         * workers/AbstractWorker.cpp:
1663         (WebCore::AbstractWorker::resolveURL): Use ExceptionOr.
1664         * workers/AbstractWorker.h: Updated for above changes.
1665
1666         * workers/DedicatedWorkerGlobalScope.cpp:
1667         (WebCore::DedicatedWorkerGlobalScope::create): Use RefPtr&&
1668         instead of PassRefPtr.
1669         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1670         Ditto.
1671         (WebCore::DedicatedWorkerGlobalScope::postMessage): Use ExceptionOr.
1672         (WebCore::DedicatedWorkerGlobalScope::importScripts): Ditto.
1673         * workers/DedicatedWorkerGlobalScope.h: Updated for above changes.
1674         * workers/DedicatedWorkerGlobalScope.idl: Use non-legacy exceptions.
1675
1676         * workers/Worker.cpp:
1677         (WebCore::Worker::create): Use ExceptionOr.
1678         (WebCore::Worker::postMessage): Ditto.
1679         * workers/Worker.h: Updated for above changes.
1680         * workers/Worker.idl: Use non-legacy exception.
1681
1682         * workers/WorkerGlobalScope.cpp:
1683         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Moved initialization
1684         of m_closing to class definition.
1685         (WebCore::WorkerGlobalScope::~WorkerGlobalScope): Removed call to
1686         deleted notifyObserversOfStop function.
1687         (WebCore::WorkerGlobalScope::importScripts): Use ExceptionOr. Also use
1688         reserveInitialCapacity and uncheckedAppend to build a vector.
1689         (WebCore::WorkerGlobalScope::addConsoleMessage): Use an rvalue reference.
1690         Also moved the body of one of the addMessageToWorkerConsole overloads into
1691         one of the overloads of this function, and changed the other to call addMessage.
1692         (WebCore::WorkerGlobalScope::addMessage): Moved the body of the other
1693         addMessageToWorkerConsole here.
1694         (WebCore::WorkerGlobalScope::addMessageToWorkerConsole): Deleted.
1695         (WebCore::WorkerGlobalScope::Observer::Observer): Deleted.
1696         (WebCore::WorkerGlobalScope::Observer::~Observer): Deleted.
1697         (WebCore::WorkerGlobalScope::Observer::stopObserving): Deleted.
1698         (WebCore::WorkerGlobalScope::registerObserver): Deleted.
1699         (WebCore::WorkerGlobalScope::unregisterObserver): Deleted.
1700         (WebCore::WorkerGlobalScope::notifyObserversOfStop): Deleted.
1701         * workers/WorkerGlobalScope.h: Removed unneeded includes. Moved many virtual
1702         function overrides into the private section. Marked many functions final instead
1703         of just override. Removed unused Observer class and m_workerObservers set.
1704
1705         * workers/WorkerThread.cpp:
1706         (WebCore::WorkerThread::stop): Removed call to deleted
1707         WorkerGlobalScope::notifyObserversOfStop function.
1708
1709 2016-10-21  Antti Koivisto  <antti@apple.com>
1710
1711         Tighten ComputedStyleExtractor to use Element instead of Node
1712         https://bugs.webkit.org/show_bug.cgi?id=163798
1713
1714         Reviewed by Andreas Kling.
1715
1716         Also make its functions non-const as they may compute style.
1717
1718         * css/CSSComputedStyleDeclaration.cpp:
1719         (WebCore::styleElementForNode):
1720         (WebCore::ComputedStyleExtractor::ComputedStyleExtractor):
1721
1722             If we are called with a Node figure out the style Element in constructor.
1723
1724         (WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword):
1725         (WebCore::ComputedStyleExtractor::useFixedFontDefaultSize):
1726         (WebCore::ComputedStyleExtractor::styledElement):
1727         (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
1728         (WebCore::CSSComputedStyleDeclaration::copyProperties):
1729         (WebCore::elementOrItsAncestorNeedsStyleRecalc):
1730
1731             Use composed tree iterator for increased correctness in shadow trees.
1732
1733         (WebCore::updateStyleIfNeededForElement):
1734         (WebCore::computeRenderStyleForProperty):
1735         (WebCore::ComputedStyleExtractor::customPropertyValue):
1736         (WebCore::ComputedStyleExtractor::customPropertyText):
1737         (WebCore::ComputedStyleExtractor::propertyValue):
1738         (WebCore::CSSComputedStyleDeclaration::length):
1739         (WebCore::CSSComputedStyleDeclaration::item):
1740         (WebCore::ComputedStyleExtractor::propertyMatches):
1741         (WebCore::ComputedStyleExtractor::copyProperties):
1742         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties):
1743         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand):
1744         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand):
1745         (WebCore::ComputedStyleExtractor::copyPropertiesInSet):
1746         (WebCore::CSSComputedStyleDeclaration::getPropertyValue):
1747         (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue):
1748         (WebCore::ComputedStyleExtractor::styledNode): Deleted.
1749         (WebCore::nodeOrItsAncestorNeedsStyleRecalc): Deleted.
1750         (WebCore::updateStyleIfNeededForNode): Deleted.
1751         * css/CSSComputedStyleDeclaration.h:
1752         * css/SVGCSSComputedStyleDeclaration.cpp:
1753         (WebCore::ComputedStyleExtractor::svgPropertyValue):
1754         * editing/EditingStyle.cpp:
1755         (WebCore::EditingStyle::removeEquivalentProperties):
1756         * editing/EditingStyle.h:
1757
1758 2016-10-21  Chris Dumez  <cdumez@apple.com>
1759
1760         WebGL2RenderingContext.texSubImage3D() should use a union instead of overloading
1761         https://bugs.webkit.org/show_bug.cgi?id=163792
1762
1763         Reviewed by Darin Adler.
1764
1765         WebGL2RenderingContext.texSubImage3D() should use a union instead of overloading for 
1766         - https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7 (for texSubImage3D)
1767         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 (for TexImageSource)
1768
1769         * html/canvas/WebGL2RenderingContext.cpp:
1770         (WebCore::WebGL2RenderingContext::texSubImage3D):
1771         * html/canvas/WebGL2RenderingContext.h:
1772         * html/canvas/WebGL2RenderingContext.idl:
1773
1774 2016-10-21  Zalan Bujtas  <zalan@apple.com>
1775
1776         Do not mutate the render tree while collecting selection repaint rects.
1777         https://bugs.webkit.org/show_bug.cgi?id=163800
1778         <rdar://problem/28806886>
1779
1780         Reviewed by David Hyatt.
1781
1782         RenderListItem not only mutates the tree while in layout but it also uses
1783         the old descendant context to find the insertion point.
1784         This patch strictly ensures that we only do it while in layout and never
1785         in other cases such as collecting repaint rects.
1786         This gets redundant when webkit.org/b/163789 is fixed.
1787
1788         Test: fast/lists/crash-when-list-marker-is-moved-during-selection.html
1789
1790         * rendering/RenderListItem.cpp:
1791         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded):
1792
1793 2016-10-21  Dave Hyatt  <hyatt@apple.com>
1794
1795         [CSS Parser] Support horizontal-bt writing mode
1796         https://bugs.webkit.org/show_bug.cgi?id=163797
1797
1798         Reviewed by Zalan Bujtas.
1799
1800         * css/parser/CSSParserFastPaths.cpp:
1801         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1802
1803 2016-10-20  Brent Fulgham  <bfulgham@apple.com>
1804
1805         [Win][Direct2D] Correct some memory leaks and other minor bugs
1806         https://bugs.webkit.org/show_bug.cgi?id=163769
1807
1808         Reviewed by Alex Christensen.
1809
1810         Several D2D handles were being leaked.
1811  
1812         Direct2D sometimes returns an infinite rect containing { -inf, -inf, FloatMax, FloatMax },
1813         sometimes { -FloatMax, -FloatMax, inf, inf }, and various combinations thereof. This caused
1814         most SVG drawing to decide no screen rect was contained in the "infinite rect" so nothing
1815         would be drawn.
1816         
1817         Tested by existing layout tests. 
1818
1819         * platform/graphics/GraphicsContext.h:
1820         * platform/graphics/win/FloatRectDirect2D.cpp:
1821         (WebCore::isInfiniteRect): Recognize various infinite rects in Windows.
1822         (WebCore::FloatRect::FloatRect): Convert a Windows infinite rect to the style
1823         we use inside WebKit.
1824         * platform/graphics/win/FontCascadeDirect2D.cpp:
1825         (WebCore::FontCascade::drawGlyphs): Use cached brushes if possible.
1826         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
1827         (WebCore::GlyphPage::fill): Don't terminate on this error case.
1828         * platform/graphics/win/GradientDirect2D.cpp:
1829         (WebCore::Gradient::generateGradient): Don't leak gradients.
1830         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1831         (WebCore::GraphicsContextPlatformPrivate::brushWithColor): Added.
1832         (WebCore::GraphicsContext::brushWithColor): Added.
1833         (WebCore::GraphicsContextPlatformPrivate::concatCTM): Perform transform multiplication
1834         in the right order (hint: it's not distributive).
1835         (WebCore::GraphicsContext::drawWithShadow): Use convenience method.
1836         (WebCore::GraphicsContext::fillRect): Ditto.
1837         (WebCore::GraphicsContext::platformFillRoundedRect): Ditto.
1838         (WebCore::GraphicsContext::clearRect): Ditto.
1839         (WebCore::GraphicsContext::setPlatformStrokeColor): Ditto.
1840         (WebCore::GraphicsContext::setPlatformFillColor): Ditto.
1841         * platform/graphics/win/PathDirect2D.cpp:
1842         (WebCore::Path::polygonPathFromPoints): No need to convert manually.
1843         (WebCore::Path::~Path): Don't leak ID2D1Geometry entities.
1844         (WebCore::Path::appendGeometry): Ditto.
1845         (WebCore::Path::createGeometryWithFillMode): Ditto.
1846         (WebCore::Path::Path): Ditto.
1847         (WebCore::Path::operator=): Ditto.
1848         (WebCore::Path::strokeBoundingRect): Provide an implementation.
1849         (WebCore::Path::addRect): No need for manual casting here.
1850
1851 2016-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1852
1853         Fix minor style issue in the signature of StaticRange::create
1854         https://bugs.webkit.org/show_bug.cgi?id=163786
1855         <rdar://problem/28853079>
1856
1857         Reviewed by Alex Christensen.
1858
1859         Change `Ref<WebCore::Node> &&` to `Ref<Node>&&`.
1860
1861         * dom/StaticRange.cpp:
1862         (WebCore::StaticRange::create):
1863
1864 2016-10-21  Dave Hyatt  <hyatt@apple.com>
1865
1866         [CSS Parser] Add support for -webkit-line-box-contain
1867         https://bugs.webkit.org/show_bug.cgi?id=163794
1868
1869         Reviewed by Zalan Bujtas.
1870
1871         * css/parser/CSSPropertyParser.cpp:
1872         (WebCore::consumeLineBoxContain):
1873         (WebCore::CSSPropertyParser::parseSingleValue):
1874
1875 2016-10-21  Dave Hyatt  <hyatt@apple.com>
1876
1877         [CSS Parser] Add support for @-webkit-region rules
1878         https://bugs.webkit.org/show_bug.cgi?id=163787
1879
1880         Reviewed by Zalan Bujtas.
1881
1882         * css/StyleRule.cpp:
1883         (WebCore::StyleRuleRegion::StyleRuleRegion):
1884         * css/StyleRule.h:
1885         * css/parser/CSSAtRuleID.cpp:
1886         (WebCore::cssAtRuleID):
1887         * css/parser/CSSAtRuleID.h:
1888         * css/parser/CSSParserImpl.cpp:
1889         (WebCore::CSSParserImpl::consumeAtRule):
1890         (WebCore::CSSParserImpl::consumePageRule):
1891         (WebCore::CSSParserImpl::consumeRegionRule):
1892         * css/parser/CSSParserImpl.h:
1893
1894 2016-10-21  David Kilzer  <ddkilzer@apple.com>
1895
1896         Bug 163757: Use IntSize::unclampedArea() in PDFDocumentImage::updateCachedImageIfNeeded()
1897         <https://webkit.org/b/163757>
1898
1899         Reviewed by Brent Fulgham.
1900
1901         No new tests since there is no change in nominal behavior.
1902
1903         * platform/graphics/cg/PDFDocumentImage.cpp:
1904         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Use
1905         IntSize::unclampedArea() where manual calculations were used
1906         previously.  Also gets rid of more safeCast<size_t>() use.
1907
1908 2016-10-21  Chris Dumez  <cdumez@apple.com>
1909
1910         [Web IDL] Support unions in our overload resolution algorithm
1911         https://bugs.webkit.org/show_bug.cgi?id=163764
1912
1913         Reviewed by Darin Adler.
1914
1915         Support unions in our overload resolution algorithm as per:
1916         - https://heycam.github.io/webidl/#es-overloads
1917         - https://heycam.github.io/webidl/#dfn-distinguishable
1918
1919         * bindings/scripts/CodeGeneratorJS.pm:
1920         (IsIDLTypeDistinguishableWithUnionForOverloadResolution):
1921         (AreTypesDistinguishableForOverloadResolution):
1922         (GetOverloadThatMatches):
1923         (GenerateOverloadedFunctionOrConstructor):
1924         * bindings/scripts/test/JS/JSTestObj.cpp:
1925         * bindings/scripts/test/TestObj.idl:
1926
1927 2016-10-21  Chris Dumez  <cdumez@apple.com>
1928
1929         AudioNode.connect(): First parameter should not be nullable
1930         https://bugs.webkit.org/show_bug.cgi?id=163773
1931
1932         Reviewed by Darin Adler.
1933
1934         AudioNode.connect()'s first parameter should not be nullable:
1935         - https://webaudio.github.io/web-audio-api/#idl-def-AudioNode.
1936
1937         We were throwing a SYNTAX_ERR when passing null, we now throw
1938         a TypeError instead.
1939
1940         No new tests, updated existing test.
1941
1942         * Modules/webaudio/AudioBasicInspectorNode.cpp:
1943         (WebCore::AudioBasicInspectorNode::connect):
1944         * Modules/webaudio/AudioBasicInspectorNode.h:
1945         * Modules/webaudio/AudioNode.cpp:
1946         (WebCore::AudioNode::connect):
1947         * Modules/webaudio/AudioNode.h:
1948         * Modules/webaudio/AudioNode.idl:
1949
1950 2016-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1951
1952         Implement InputEvent.getTargetRanges() for the input events spec
1953         https://bugs.webkit.org/show_bug.cgi?id=162947
1954         <rdar://problem/28853079>
1955
1956         Reviewed by Darin Adler.
1957
1958         Implements InputEvent.getTargetRanges(). See individual method changes below for more details. Adds a new hook
1959         for subclasses of CompositeEditCommand to vend a list of target StaticRanges when retrieving target ranges for
1960         an editing command on a contenteditable area.
1961
1962         Tests: fast/events/before-input-delete-empty-list-target-ranges.html
1963                fast/events/before-input-delete-text-target-ranges.html
1964                fast/events/before-input-replace-text-target-ranges.html
1965
1966         * CMakeLists.txt:
1967         * DerivedSources.make:
1968         * WebCore.xcodeproj/project.pbxproj:
1969
1970         Add StaticRange.idl, StaticRange.cpp and StaticRange.h.
1971
1972         * bindings/generic/RuntimeEnabledFeatures.h:
1973         (WebCore::RuntimeEnabledFeatures::setInputEventsEnabled):
1974         (WebCore::RuntimeEnabledFeatures::inputEventsEnabled):
1975
1976         Add a new runtime bindings flag for InputEvents and guard both InputEvent and StaticRange behind it.
1977
1978         * dom/DOMAllInOne.cpp:
1979         * dom/InputEvent.cpp:
1980         (WebCore::InputEvent::InputEvent):
1981         * dom/InputEvent.h:
1982         * dom/InputEvent.idl:
1983         * dom/StaticRange.cpp: Copied from Source/WebCore/dom/InputEvent.cpp.
1984         (WebCore::StaticRange::StaticRange):
1985         (WebCore::StaticRange::create):
1986         (WebCore::StaticRange::createFromRange):
1987
1988         Convenience method for creating a StaticRange from a Range's start/end container and offset.
1989
1990         (WebCore::StaticRange::startContainer):
1991         (WebCore::StaticRange::endContainer):
1992         (WebCore::StaticRange::collapsed):
1993         * dom/StaticRange.h: Copied from Source/WebCore/dom/InputEvent.cpp.
1994         (WebCore::StaticRange::startOffset):
1995         (WebCore::StaticRange::endOffset):
1996         * dom/StaticRange.idl: Copied from Source/WebCore/editing/ReplaceRangeWithTextCommand.h.
1997         * editing/CompositeEditCommand.cpp:
1998         (WebCore::CompositeEditCommand::willApplyCommand):
1999         (WebCore::CompositeEditCommand::targetRanges):
2000
2001         Virtual method that returns a list of target ranges which are associated with this command.
2002
2003         (WebCore::CompositeEditCommand::targetRangesForBindings):
2004
2005         Non-virtual method that calls the above targetRanges(). Takes whether or not the CompositeEditCommand is editing
2006         a textarea or plain text input into account.
2007
2008         (WebCore::CompositeEditCommand::moveParagraphs):
2009         * editing/CompositeEditCommand.h:
2010         * editing/EditCommand.cpp:
2011         (WebCore::EditCommand::frame):
2012         * editing/EditCommand.h:
2013         (WebCore::EditCommand::document):
2014         * editing/Editor.cpp:
2015         (WebCore::dispatchBeforeInputEvent):
2016         (WebCore::dispatchInputEvent):
2017         (WebCore::dispatchBeforeInputEvents):
2018
2019         Changed the `beforeinput` event dispatch to use the regular Node::dispatchEvent instead of dispatchScopedEvent.
2020         This is because if the page prevents the `beforeinput` event, we need to know immediately in order to bail from
2021         the default action.
2022
2023         (WebCore::dispatchInputEvents):
2024         (WebCore::Editor::willApplyEditing):
2025
2026         Added a list of static ranges as a parameter when calling on the Editor to dispatch `beforeinput` events.
2027         By default, this uses the composite edit command's targetRangesForBindings(), though it may be special cased
2028         by subclasses of CompositeEditCommand (see ReplaceRangeWithTextCommand, SpellingCorrectionCommand, and
2029         TypingCommand).
2030
2031         * editing/Editor.h:
2032         * editing/ReplaceRangeWithTextCommand.cpp:
2033         (WebCore::ReplaceRangeWithTextCommand::targetRanges):
2034         * editing/ReplaceRangeWithTextCommand.h:
2035         * editing/SpellingCorrectionCommand.cpp:
2036         (WebCore::SpellingCorrectionCommand::targetRanges):
2037         * editing/SpellingCorrectionCommand.h:
2038         * editing/TypingCommand.cpp:
2039         (WebCore::editActionIsDeleteByTyping):
2040         (WebCore::TypingCommand::shouldDeferWillApplyCommandUntilAddingTypingCommand):
2041         (WebCore::TypingCommand::willApplyCommand):
2042         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2043         (WebCore::TypingCommand::deleteKeyPressed):
2044         (WebCore::TypingCommand::forwardDeleteKeyPressed):
2045
2046         Moves the firing of the `beforeinput` until after the selection range to delete has been computed.
2047
2048         * editing/TypingCommand.h:
2049
2050 2016-10-21  Antti Koivisto  <antti@apple.com>
2051
2052         Style resolver should be updated lazily
2053         https://bugs.webkit.org/show_bug.cgi?id=163721
2054
2055         Reviewed by Andreas Kling.
2056
2057         Currently when stylesheets change in some way we generally update style resolvers and
2058         invalidate style immediately. We should do this lazily to avoid unnecessary work.
2059
2060         Also improve naming of the stylesheet invalidation functions and use more optimal functions in some places.
2061
2062         * css/CSSComputedStyleDeclaration.cpp:
2063         (WebCore::updateStyleIfNeededForNode):
2064         * css/CSSStyleSheet.cpp:
2065         (WebCore::CSSStyleSheet::didMutateRules):
2066         (WebCore::CSSStyleSheet::didMutate):
2067         (WebCore::CSSStyleSheet::setDisabled):
2068         * css/StyleResolver.cpp:
2069         (WebCore::StyleResolver::StyleResolver):
2070
2071             Initialize root style font with null font selector.
2072             This avoids hitting a CSSFontSelector assert in fast/media/mq-relative-constraints-08.html where
2073             media query evaluation requires font information before it is ready.
2074             Exposed by increased laziness in this patch.
2075
2076         * dom/Document.cpp:
2077         (WebCore::Document::setContentLanguage):
2078         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2079         (WebCore::Document::isPageBoxVisible):
2080         (WebCore::Document::pageSizeAndMarginsInPixels):
2081         (WebCore::Document::processHttpEquiv):
2082         (WebCore::Document::setSelectedStylesheetSet):
2083         (WebCore::Document::didInsertInDocumentShadowRoot):
2084         (WebCore::Document::didRemoveInDocumentShadowRoot):
2085         * dom/Document.h:
2086         (WebCore::Document::inDocumentShadowRoots):
2087
2088             Track all shadow roots in the document. This allows us to find and flush style scopes cheaply.
2089
2090         * dom/Element.cpp:
2091         (WebCore::Element::computedStyle):
2092         * dom/ExtensionStyleSheets.cpp:
2093         (WebCore::ExtensionStyleSheets::ExtensionStyleSheets):
2094         (WebCore::ExtensionStyleSheets::clearPageUserSheet):
2095         (WebCore::ExtensionStyleSheets::updatePageUserSheet):
2096         (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
2097         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
2098         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
2099         (WebCore::ExtensionStyleSheets::addDisplayNoneSelector):
2100         (WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet):
2101         (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired): Deleted.
2102
2103             Since updates are now done lazily we don't need a special timer for extension stylesheets.
2104
2105         * dom/ExtensionStyleSheets.h:
2106         * dom/ProcessingInstruction.cpp:
2107         (WebCore::ProcessingInstruction::checkStyleSheet):
2108         (WebCore::ProcessingInstruction::sheetLoaded):
2109         (WebCore::ProcessingInstruction::removedFrom):
2110         * dom/ShadowRoot.cpp:
2111         (WebCore::ShadowRoot::ShadowRoot):
2112         (WebCore::ShadowRoot::insertedInto):
2113         (WebCore::ShadowRoot::removedFrom):
2114         (WebCore::ShadowRoot::styleScope):
2115         * dom/ShadowRoot.h:
2116         * html/HTMLLinkElement.cpp:
2117         (WebCore::HTMLLinkElement::setDisabledState):
2118         (WebCore::HTMLLinkElement::parseAttribute):
2119         (WebCore::HTMLLinkElement::process):
2120         (WebCore::HTMLLinkElement::removePendingSheet):
2121         * html/HTMLStyleElement.cpp:
2122         (WebCore::HTMLStyleElement::parseAttribute):
2123         * inspector/InspectorCSSAgent.cpp:
2124         (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument):
2125         (WebCore::InspectorCSSAgent::forcePseudoState):
2126         (WebCore::InspectorCSSAgent::resetPseudoStates):
2127         * inspector/InspectorPageAgent.cpp:
2128         (WebCore::InspectorPageAgent::setEmulatedMedia):
2129         * page/Frame.cpp:
2130         (WebCore::Frame::setPrinting):
2131         * page/FrameView.cpp:
2132         (WebCore::FrameView::layout):
2133         (WebCore::FrameView::setPagination):
2134         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
2135         * page/Page.cpp:
2136         (WebCore::Page::setViewMode):
2137         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
2138         (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
2139         * style/StyleScope.cpp:
2140         (WebCore::Style::Scope::setPreferredStylesheetSetName):
2141         (WebCore::Style::Scope::setSelectedStylesheetSetName):
2142         (WebCore::Style::Scope::removePendingSheet):
2143         (WebCore::Style::Scope::removeStyleSheetCandidateNode):
2144         (WebCore::Style::Scope::activeStyleSheetsForInspector):
2145         (WebCore::Style::Scope::flushPendingUpdate):
2146
2147             Also flush descendant shadow roots.
2148
2149         (WebCore::Style::Scope::scheduleUpdate):
2150         (WebCore::Style::Scope::didChangeActiveStyleSheetCandidates):
2151
2152             Make lazy.
2153
2154         (WebCore::Style::Scope::didChangeStyleSheetContents):
2155
2156             Make lazy.
2157
2158         (WebCore::Style::Scope::didChangeStyleSheetEnvironment):
2159
2160             Environment changes also affect author shadow roots.
2161
2162         (WebCore::Style::Scope::styleSheetsForStyleSheetList):
2163         (WebCore::Style::Scope::scheduleActiveSetUpdate): Deleted.
2164         (WebCore::Style::Scope::didChangeCandidatesForActiveSet): Deleted.
2165         (WebCore::Style::Scope::didChangeContentsOrInterpretation): Deleted.
2166
2167             Improved naming of these and split didChangeContentsOrInterpretation into two separate functions.
2168
2169         * style/StyleScope.h:
2170         (WebCore::Style::Scope::styleSheetsForStyleSheetList): Deleted.
2171         (WebCore::Style::Scope::setPreferredStylesheetSetName): Deleted.
2172         (WebCore::Style::Scope::setSelectedStylesheetSetName): Deleted.
2173         * svg/SVGFontFaceElement.cpp:
2174         (WebCore::SVGFontFaceElement::rebuildFontFace):
2175         (WebCore::SVGFontFaceElement::removedFrom):
2176         * testing/Internals.cpp:
2177         (WebCore::Internals::resetToConsistentState):
2178
2179             Ensure that cationsStyleSheetOverride really becomes empty. Some tests rely on not having suprise
2180             inserted stylesheets. Previously this was racy and the patch affected order of things.
2181
2182         (WebCore::Internals::styleChangeType):
2183         * xml/XMLTreeViewer.cpp:
2184         (WebCore::XMLTreeViewer::transformDocumentToTreeView):
2185         * xml/parser/XMLDocumentParser.cpp:
2186         (WebCore::XMLDocumentParser::end):
2187         * xml/parser/XMLDocumentParserLibxml2.cpp:
2188         (WebCore::XMLDocumentParser::doEnd):
2189
2190 2016-10-21  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Adam Bergkvist  <adam.bergkvist@ericsson.com>
2191
2192         WebRTC: [OpenWebRTC] Move SDPProcessorScriptResource(Gtk) to openwebrtc directory
2193         https://bugs.webkit.org/show_bug.cgi?id=163778
2194
2195         Reviewed by Philippe Normand.
2196
2197         Move SDPProcessorScriptResourceGtk from the platform gtk directory to the port generic
2198         openwebrtc directory to make it usable by other ports. Also drop the Gtk-suffix.
2199
2200         No change of behavior.
2201
2202         * PlatformGTK.cmake:
2203         * platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp:
2204         (WebCore::SDPProcessorScriptResource::scriptString): Deleted.
2205         * platform/mediastream/openwebrtc/SDPProcessorScriptResource.cpp: Renamed from Source/WebCore/platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp.
2206         (WebCore::SDPProcessorScriptResource::scriptString):
2207
2208 2016-10-21  Miguel Gomez  <magomez@igalia.com>
2209
2210         [GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivateGStreamerBase::repaint
2211         https://bugs.webkit.org/show_bug.cgi?id=163511
2212
2213         Reviewed by Carlos Garcia Campos.
2214
2215         Perform the video repaint in the main thread when accelerated compositing is disabled. Added a new method to
2216         MediaPlayerClient to get whether accelerated compositing is enabled from the MediaPlayer. This is needed
2217         because mediaPlayerAcceleratedCompositingEnabled() will return false while HTMLMediaElement doesn't have a
2218         RenderVideo, even when accelerated compositing is enabled.
2219
2220         Covered by existent tests.
2221
2222         * html/HTMLMediaElement.cpp:
2223         (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
2224         * html/HTMLMediaElement.h:
2225         * platform/graphics/MediaPlayer.h:
2226         (WebCore::MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled):
2227         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2228         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
2229         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
2230         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2231         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2232
2233 2016-10-21  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2234
2235         WebRTC: [GTK] Add MediaEndpointOwr - an OpenWebRTC WebRTC backend
2236         https://bugs.webkit.org/show_bug.cgi?id=163327
2237
2238         Reviewed by Philippe Normand.
2239
2240         Add MediaEndpointOwr which is a MediaEndpoint implementation (WebRTC backend) based on
2241         OpenWebRTC [1]. The WebRTC backend can be tested with a manual test. Automatic testing
2242         is still done with MockMediaEndpoint.
2243
2244         [1] http://www.openwebrtc.org/
2245
2246         Testing: Added manual test (webrtc-one-tab-p2p.html)
2247
2248         * CMakeLists.txt:
2249         * platform/GStreamer.cmake:
2250         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: Added.
2251         (WebCore::createMediaEndpointOwr):
2252         (WebCore::MediaEndpointOwr::MediaEndpointOwr):
2253         (WebCore::MediaEndpointOwr::~MediaEndpointOwr):
2254         (WebCore::MediaEndpointOwr::setConfiguration):
2255         (WebCore::cryptoDataCallback):
2256         (WebCore::MediaEndpointOwr::generateDtlsInfo):
2257         (WebCore::MediaEndpointOwr::getDefaultAudioPayloads):
2258         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
2259         (WebCore::payloadsContainType):
2260         (WebCore::MediaEndpointOwr::filterPayloads):
2261         (WebCore::MediaEndpointOwr::updateReceiveConfiguration):
2262         (WebCore::findRtxPayload):
2263         (WebCore::MediaEndpointOwr::updateSendConfiguration):
2264         (WebCore::MediaEndpointOwr::addRemoteCandidate):
2265         (WebCore::MediaEndpointOwr::replaceMutedRemoteSourceMid):
2266         (WebCore::MediaEndpointOwr::createMutedRemoteSource):
2267         (WebCore::MediaEndpointOwr::replaceSendSource):
2268         (WebCore::MediaEndpointOwr::stop):
2269         (WebCore::MediaEndpointOwr::transceiverIndexForSession):
2270         (WebCore::MediaEndpointOwr::sessionMid):
2271         (WebCore::MediaEndpointOwr::matchTransceiverByMid):
2272         (WebCore::MediaEndpointOwr::dispatchNewIceCandidate):
2273         (WebCore::MediaEndpointOwr::dispatchGatheringDone):
2274         (WebCore::MediaEndpointOwr::processIceTransportStateChange):
2275         (WebCore::MediaEndpointOwr::dispatchDtlsFingerprint):
2276         (WebCore::MediaEndpointOwr::unmuteRemoteSource):
2277         (WebCore::MediaEndpointOwr::prepareSession):
2278         (WebCore::MediaEndpointOwr::prepareMediaSession):
2279         (WebCore::parseHelperServerUrl):
2280         (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers):
2281         (WebCore::MediaEndpointOwr::internalAddRemoteCandidate):
2282         (WebCore::gotCandidate):
2283         (WebCore::candidateGatheringDone):
2284         (WebCore::iceConnectionStateChange):
2285         (WebCore::gotIncomingSource):
2286         * platform/mediastream/openwebrtc/MediaEndpointOwr.h: Added.
2287         (WebCore::OwrTransceiver::create):
2288         (WebCore::OwrTransceiver::~OwrTransceiver):
2289         (WebCore::OwrTransceiver::mid):
2290         (WebCore::OwrTransceiver::session):
2291         (WebCore::OwrTransceiver::owrIceState):
2292         (WebCore::OwrTransceiver::setOwrIceState):
2293         (WebCore::OwrTransceiver::gotEndOfRemoteCandidates):
2294         (WebCore::OwrTransceiver::markGotEndOfRemoteCandidates):
2295         (WebCore::OwrTransceiver::OwrTransceiver):
2296         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
2297         (WebCore::RealtimeMediaSourceOwr::RealtimeMediaSourceOwr):
2298         (WebCore::RealtimeMediaSourceOwr::swapOutShallowSource):
2299         Add support for an initially muted source. This is used for early
2300         creation of remote sources.
2301
2302 2016-10-21  Javier Fernandez  <jfernandez@igalia.com>
2303
2304         [css-grid] Content Alignment broken with indefinite sized grid container
2305         https://bugs.webkit.org/show_bug.cgi?id=163724
2306
2307         Reviewed by Manuel Rego Casasnovas.
2308
2309         The Grid Tracks sizing algorithm receives as parameter the
2310         available space to be used as space for tracks. We hold a variable
2311         to store the remaining free space for each dimension.
2312
2313         When the grid container size is indefinite we can't compute the
2314         available free space after computing track sizes until such
2315         indefinite size is resolved.
2316
2317         No new tests, just added some additional test cases.
2318
2319         * rendering/RenderGrid.cpp:
2320         (WebCore::RenderGrid::layoutBlock): Compute freeSpace for Rows
2321         after doing layout and resolving the indefinite height.
2322
2323 2016-10-21  Jer Noble  <jer.noble@apple.com>
2324
2325         CRASH in SourceBuffer::sourceBufferPrivateDidReceiveSample + 2169
2326         https://bugs.webkit.org/show_bug.cgi?id=163735
2327
2328         Reviewed by Eric Carlson.
2329
2330         Test: media/media-source/media-source-sample-wrong-track-id.html
2331
2332         When SourceBuffer receives a sample in sourceBufferPrivateDidReceiveSample() containing
2333         a trackID not previously seen in an initialization segment, it creates a default TrackBuffer
2334         object to contain that track's samples. One of the fields in TrackBuffer, description, is
2335         normally filled out when an initialization segment is received, but with this default
2336         TrackBuffer, it's still null when it's checked later in sourceBufferPrivateDidReceiveSample().
2337
2338         Rather than adding a null-check on trackBuffer.description, drop any sample that has a 
2339         trackID which was not present during a previous initialization segment.
2340
2341         * Modules/mediasource/SourceBuffer.cpp:
2342         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2343
2344 2016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2345
2346         [GTK] Configures but fails to link with ENABLE_OPENGL=OFF
2347         https://bugs.webkit.org/show_bug.cgi?id=163449
2348
2349         Reviewed by Michael Catanzaro.
2350
2351         Only define sharingGLContext in PlatformDisplay if EGL or GLX are enabled.
2352
2353         * platform/graphics/PlatformDisplay.cpp:
2354         * platform/graphics/PlatformDisplay.h:
2355         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
2356         (WebCore::PlatformDisplayWayland::initialize):
2357         * platform/graphics/x11/PlatformDisplayX11.cpp:
2358         (WebCore::PlatformDisplayX11::~PlatformDisplayX11):
2359
2360 2016-10-20  Filip Pizlo  <fpizlo@apple.com>
2361
2362         The tracking of the coarse-grain Heap state (allocating or not, collector or not, eden vs full) should respect the orthogonality between allocating and collecting
2363         https://bugs.webkit.org/show_bug.cgi?id=163738
2364
2365         Reviewed by Geoffrey Garen.
2366
2367         No new tests because no change in behavior.
2368
2369         * bindings/js/GCController.cpp:
2370         (WebCore::GCController::garbageCollectNow):
2371
2372 2016-10-20  Chris Dumez  <cdumez@apple.com>
2373
2374         [Bindings] Start using signature->idlType instead of signature->type in the overload resolution code
2375         https://bugs.webkit.org/show_bug.cgi?id=163767
2376
2377         Reviewed by Darin Adler.
2378
2379         Start using signature->idlType instead of signature->type in the overload resolution code
2380         to prepare for union type support.
2381
2382         * bindings/scripts/CodeGeneratorJS.pm:
2383         (ComputeEffectiveOverloadSet):
2384         (AreTypesDistinguishableForOverloadResolution):
2385         (GetDistinguishingArgumentIndex):
2386         (GetOverloadThatMatches):
2387         (GenerateOverloadedFunctionOrConstructor):
2388
2389 2016-10-20  Myles C. Maxfield  <mmaxfield@apple.com>
2390
2391         Implement WebGL2 bufferData() and bufferSubData() methods
2392         https://bugs.webkit.org/show_bug.cgi?id=163759
2393
2394         Reviewed by Dean Jackson.
2395
2396         These new overloads simply clip the input array buffer.
2397
2398         Test: fast/canvas/webgl/bufferData-offset-length.html
2399
2400         * html/canvas/WebGL2RenderingContext.cpp:
2401         (WebCore::WebGL2RenderingContext::bufferData):
2402         (WebCore::WebGL2RenderingContext::bufferSubData):
2403         * html/canvas/WebGL2RenderingContext.h:
2404         * html/canvas/WebGL2RenderingContext.idl:
2405
2406 2016-10-20  Chris Dumez  <cdumez@apple.com>
2407
2408         "Download Linked File" context menu action should use 'download' attribute as suggested filename
2409         https://bugs.webkit.org/show_bug.cgi?id=163742
2410         <rdar://problem/28840734>
2411
2412         Reviewed by Darin Adler.
2413
2414         Add convenience method to HitTestResult to return the URL element's
2415         download attribute.
2416
2417         * rendering/HitTestResult.cpp:
2418         (WebCore::HitTestResult::URLElementDownloadAttribute):
2419         * rendering/HitTestResult.h:
2420
2421 2016-10-20  Nan Wang  <n_wang@apple.com>
2422
2423         AX: VoiceOver is not detecting ARIA treeview if it contains role="presentation"
2424         https://bugs.webkit.org/show_bug.cgi?id=163763
2425
2426         Reviewed by Chris Fleizach.
2427
2428         Test: accessibility/mac/aria-tree-with-presentation-role.html
2429
2430         Web authors sometimes use presentation role in the aria tree to hide elements. We should
2431         consider this a valid case if they specify tree items and groups correctly.
2432
2433         * accessibility/AccessibilityNodeObject.cpp:
2434         (WebCore::AccessibilityNodeObject::hierarchicalLevel):
2435         * accessibility/AccessibilityTree.cpp:
2436         (WebCore::AccessibilityTree::nodeHasTreeItemChild):
2437         (WebCore::AccessibilityTree::isTreeValid):
2438         * accessibility/AccessibilityTree.h:
2439
2440 2016-10-20  Myles C. Maxfield  <mmaxfield@apple.com>
2441
2442         Many WebGL functions which don't throw are marked as possibly throwing
2443         https://bugs.webkit.org/show_bug.cgi?id=163747
2444
2445         Reviewed by Dean Jackson.
2446
2447         Mechanically remove the exception code.
2448
2449         No new tests because there is no behavior change.
2450
2451         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2452         (WebCore::getObjectParameter):
2453         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders):
2454         (WebCore::JSWebGLRenderingContextBase::getProgramParameter):
2455         (WebCore::JSWebGLRenderingContextBase::getShaderParameter):
2456         (WebCore::JSWebGLRenderingContextBase::getUniform):
2457         (WebCore::dataFunctionf):
2458         (WebCore::dataFunctioni):
2459         (WebCore::dataFunctionMatrix):
2460         * html/canvas/WebGL2RenderingContext.cpp:
2461         (WebCore::WebGL2RenderingContext::texSubImage2D):
2462         * html/canvas/WebGLRenderingContext.cpp:
2463         (WebCore::WebGLRenderingContext::texSubImage2D):
2464         * html/canvas/WebGLRenderingContextBase.cpp:
2465         (WebCore::WebGLRenderingContextBase::activeTexture):
2466         (WebCore::WebGLRenderingContextBase::attachShader):
2467         (WebCore::WebGLRenderingContextBase::bindAttribLocation):
2468         (WebCore::WebGLRenderingContextBase::bindBuffer):
2469         (WebCore::WebGLRenderingContextBase::bindFramebuffer):
2470         (WebCore::WebGLRenderingContextBase::bindRenderbuffer):
2471         (WebCore::WebGLRenderingContextBase::bindTexture):
2472         (WebCore::WebGLRenderingContextBase::bufferData):
2473         (WebCore::WebGLRenderingContextBase::bufferSubData):
2474         (WebCore::WebGLRenderingContextBase::compileShader):
2475         (WebCore::WebGLRenderingContextBase::createShader):
2476         (WebCore::WebGLRenderingContextBase::detachShader):
2477         (WebCore::WebGLRenderingContextBase::disableVertexAttribArray):
2478         (WebCore::WebGLRenderingContextBase::drawArrays):
2479         (WebCore::WebGLRenderingContextBase::drawElements):
2480         (WebCore::WebGLRenderingContextBase::enableVertexAttribArray):
2481         (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer):
2482         (WebCore::WebGLRenderingContextBase::framebufferTexture2D):
2483         (WebCore::WebGLRenderingContextBase::getActiveAttrib):
2484         (WebCore::WebGLRenderingContextBase::getActiveUniform):
2485         (WebCore::WebGLRenderingContextBase::getAttachedShaders):
2486         (WebCore::WebGLRenderingContextBase::getBufferParameter):
2487         (WebCore::WebGLRenderingContextBase::getProgramParameter):
2488         (WebCore::WebGLRenderingContextBase::getProgramInfoLog):
2489         (WebCore::WebGLRenderingContextBase::getRenderbufferParameter):
2490         (WebCore::WebGLRenderingContextBase::getShaderParameter):
2491         (WebCore::WebGLRenderingContextBase::getShaderInfoLog):
2492         (WebCore::WebGLRenderingContextBase::getShaderPrecisionFormat):
2493         (WebCore::WebGLRenderingContextBase::getShaderSource):
2494         (WebCore::WebGLRenderingContextBase::getTexParameter):
2495         (WebCore::WebGLRenderingContextBase::getUniform):
2496         (WebCore::WebGLRenderingContextBase::getUniformLocation):
2497         (WebCore::WebGLRenderingContextBase::getVertexAttrib):
2498         (WebCore::WebGLRenderingContextBase::linkProgram):
2499         (WebCore::WebGLRenderingContextBase::readPixels):
2500         (WebCore::WebGLRenderingContextBase::shaderSource):
2501         (WebCore::WebGLRenderingContextBase::videoFrameToImage):
2502         (WebCore::WebGLRenderingContextBase::texImage2D):
2503         (WebCore::WebGLRenderingContextBase::uniform1f):
2504         (WebCore::WebGLRenderingContextBase::uniform1fv):
2505         (WebCore::WebGLRenderingContextBase::uniform1i):
2506         (WebCore::WebGLRenderingContextBase::uniform1iv):
2507         (WebCore::WebGLRenderingContextBase::uniform2f):
2508         (WebCore::WebGLRenderingContextBase::uniform2fv):
2509         (WebCore::WebGLRenderingContextBase::uniform2i):
2510         (WebCore::WebGLRenderingContextBase::uniform2iv):
2511         (WebCore::WebGLRenderingContextBase::uniform3f):
2512         (WebCore::WebGLRenderingContextBase::uniform3fv):
2513         (WebCore::WebGLRenderingContextBase::uniform3i):
2514         (WebCore::WebGLRenderingContextBase::uniform3iv):
2515         (WebCore::WebGLRenderingContextBase::uniform4f):
2516         (WebCore::WebGLRenderingContextBase::uniform4fv):
2517         (WebCore::WebGLRenderingContextBase::uniform4i):
2518         (WebCore::WebGLRenderingContextBase::uniform4iv):
2519         (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
2520         (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
2521         (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
2522         (WebCore::WebGLRenderingContextBase::useProgram):
2523         (WebCore::WebGLRenderingContextBase::validateProgram):
2524         (WebCore::WebGLRenderingContextBase::vertexAttribPointer):
2525         (WebCore::WebGLRenderingContextBase::restoreCurrentFramebuffer):
2526         (WebCore::WebGLRenderingContextBase::restoreCurrentTexture2D):
2527         * html/canvas/WebGLRenderingContextBase.h:
2528         * html/canvas/WebGLRenderingContextBase.idl:
2529
2530 2016-10-19  Myles C. Maxfield  <mmaxfield@apple.com>
2531
2532         [macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9
2533         https://bugs.webkit.org/show_bug.cgi?id=163374
2534
2535         Reviewed by Darin Adler.
2536
2537         Because of platform lack of support for variations in in-memory fonts,
2538         this feature should be disabled on the affected OSes.
2539
2540         No tests because there is no behavior change (on the relevant platforms).
2541
2542         * Configurations/FeatureDefines.xcconfig:
2543
2544 2016-10-20  Brady Eidson  <beidson@apple.com>
2545
2546         IndexedDB 2.0: Support IDBObjectStore name assignment.
2547         <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
2548
2549         Reviewed by Alex Christensen.
2550
2551         Tests: storage/indexeddb/modern/objectstore-rename-1-private.html
2552                storage/indexeddb/modern/objectstore-rename-1.html
2553
2554         Touches a *lot* of code sites, but none of them are particularly interesting.
2555         They are all just getting the new name spread out to all of the various objects that need it.
2556
2557         * Modules/indexeddb/IDBDatabase.cpp:
2558         (WebCore::IDBDatabase::renameObjectStore):
2559         * Modules/indexeddb/IDBDatabase.h:
2560
2561         * Modules/indexeddb/IDBObjectStore.cpp:
2562         (WebCore::IDBObjectStore::setName):
2563         * Modules/indexeddb/IDBObjectStore.h:
2564         * Modules/indexeddb/IDBObjectStore.idl:
2565
2566         * Modules/indexeddb/IDBTransaction.cpp:
2567         (WebCore::IDBTransaction::renameObjectStore):
2568         (WebCore::IDBTransaction::renameObjectStoreOnServer):
2569         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
2570         * Modules/indexeddb/IDBTransaction.h:
2571
2572         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2573         (WebCore::IDBClient::IDBConnectionProxy::renameObjectStore):
2574         * Modules/indexeddb/client/IDBConnectionProxy.h:
2575
2576         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2577         (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
2578         (WebCore::IDBClient::IDBConnectionToServer::didRenameObjectStore):
2579         * Modules/indexeddb/client/IDBConnectionToServer.h:
2580         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2581
2582         * Modules/indexeddb/server/IDBBackingStore.h:
2583
2584         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
2585         (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore):
2586         (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore):
2587         * Modules/indexeddb/server/IDBConnectionToClient.h:
2588         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
2589
2590         * Modules/indexeddb/server/IDBServer.cpp:
2591         (WebCore::IDBServer::IDBServer::renameObjectStore):
2592         * Modules/indexeddb/server/IDBServer.h:
2593
2594         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
2595         (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed):
2596         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
2597         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
2598
2599         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
2600         (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore):
2601         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
2602
2603         * Modules/indexeddb/server/MemoryObjectStore.h:
2604         (WebCore::IDBServer::MemoryObjectStore::rename):
2605
2606         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2607         (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
2608         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2609
2610         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2611         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
2612         (WebCore::IDBServer::UniqueIDBDatabase::performRenameObjectStore):
2613         (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameObjectStore):
2614         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2615
2616         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
2617         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameObjectStore):
2618         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
2619
2620         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
2621         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameObjectStore):
2622         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
2623
2624         * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
2625         (WebCore::IDBDatabaseInfo::renameObjectStore):
2626         * Modules/indexeddb/shared/IDBDatabaseInfo.h:
2627
2628         * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
2629         (WebCore::IDBObjectStoreInfo::rename):
2630
2631         * Modules/indexeddb/shared/IDBResultData.cpp:
2632         (WebCore::IDBResultData::renameObjectStoreSuccess):
2633         * Modules/indexeddb/shared/IDBResultData.h:
2634
2635         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2636         (WebCore::InProcessIDBServer::didRenameObjectStore):
2637         (WebCore::InProcessIDBServer::renameObjectStore):
2638         * Modules/indexeddb/shared/InProcessIDBServer.h:
2639
2640 2016-10-20  Chris Dumez  <cdumez@apple.com>
2641
2642         Make table.deleteRow(-1) a no-op when there are no rows
2643         https://bugs.webkit.org/show_bug.cgi?id=163746
2644
2645         Reviewed by Alex Christensen.
2646
2647         Make table.deleteRow(-1) a no-op when there are no rows, instead of throwing:
2648         - https://github.com/whatwg/html/pull/1924
2649
2650         This is more consistent with the behavior of tbody.deleteRow(-1) and
2651         tr.deleteCell(-1). This is also consistent with Gecko. Blink is doing the
2652         same change via:
2653         - https://codereview.chromium.org/2427963004/
2654
2655         No new tests, updated existing tests.
2656
2657         * html/HTMLTableElement.cpp:
2658         (WebCore::HTMLTableElement::deleteRow):
2659
2660 2016-10-20  Dave Hyatt  <hyatt@apple.com>
2661
2662         [CSS Parser] Make sure to handle prefixed transform-style
2663         https://bugs.webkit.org/show_bug.cgi?id=163756
2664
2665         Reviewed by Dean Jackson.
2666
2667         * css/parser/CSSParserFastPaths.cpp:
2668         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2669
2670 2016-10-20  Dave Hyatt  <hyatt@apple.com>
2671
2672         [CSS Parser] Fix crash when parsing -webkit-margin-collapse
2673         https://bugs.webkit.org/show_bug.cgi?id=163753
2674
2675         Reviewed by Dean Jackson.
2676
2677         * css/parser/CSSPropertyParser.cpp:
2678         (WebCore::CSSPropertyParser::parseShorthand):
2679
2680 2016-10-20  Chris Dumez  <cdumez@apple.com>
2681
2682         Passing a number as the pixel parameter to texImage2D() doesn't thrown an exception
2683         https://bugs.webkit.org/show_bug.cgi?id=163715
2684
2685         Reviewed by Darin Adler.
2686
2687         Enable strict type checking for typed arrays in the bindings, similarly
2688         do what we do for other wrapper types, as per Web IDL.
2689
2690         No new tests, updated existing tests.
2691
2692         * bindings/scripts/CodeGeneratorJS.pm:
2693         (GenerateImplementation):
2694         (GenerateParametersCheck):
2695
2696 2016-10-20  Myles C. Maxfield  <mmaxfield@apple.com>
2697
2698         Improve error message when passing a null ArrayBuffer to bufferData()
2699         https://bugs.webkit.org/show_bug.cgi?id=163745
2700
2701         Reviewed by Dean Jackson.
2702
2703         Test: fast/canvas/webgl/bufferData-nullable-array-buffer-view.html
2704
2705         Update the idl file to accept a nullable ArrayBuffer, and throw
2706         the relevant error with a more helpful error string.
2707
2708         * html/canvas/WebGLRenderingContextBase.cpp:
2709         (WebCore::WebGLRenderingContextBase::bufferData):
2710         * html/canvas/WebGLRenderingContextBase.h:
2711         * html/canvas/WebGLRenderingContextBase.idl:
2712
2713 2016-10-20  Zalan Bujtas  <zalan@apple.com>
2714
2715         Stop searching for first-letter containers at multi-column boundary.
2716         https://bugs.webkit.org/show_bug.cgi?id=163739
2717         <rdar://problem/28810750>
2718
2719         We should not cross the multi-column boundary while searching for the first-letter container.
2720         While moving first-letter renderers to a multi-column parent, it could result in finding the wrong
2721         container and end up adding a new wrapper under the original container (from where we are moving the renderers).    
2722
2723         Reviewed by David Hyatt.
2724
2725         Test: fast/css-generated-content/first-letter-move-to-multicolumn-crash.html
2726
2727         * rendering/RenderBoxModelObject.cpp:
2728         (WebCore::RenderBoxModelObject::moveChildrenTo):
2729         * rendering/RenderTextFragment.cpp:
2730         (WebCore::RenderTextFragment::blockForAccompanyingFirstLetter):
2731
2732 2016-10-19  Dean Jackson  <dino@apple.com>
2733
2734         Support CSS Shapes Level 1 without a prefix
2735         https://bugs.webkit.org/show_bug.cgi?id=163709
2736         <rdar://problem/28859369>
2737
2738         Reviewed by Myles Maxfield.
2739
2740         Support the unprefixed form of CSS Shapes, now that
2741         it is in CR.
2742
2743         We have a few failing tests:
2744
2745         - Some image-based shaping failures, now skipped.
2746           https://bugs.webkit.org/show_bug.cgi?id=163706
2747
2748         - Some false negatives, where my understanding
2749           of the CSS OM seems to suggest that the W3C tests
2750           are incorrect.
2751           https://bugs.webkit.org/show_bug.cgi?id=163708
2752
2753         Tests: imported/w3c/csswg-test/css-shapes-1
2754
2755         * css/CSSComputedStyleDeclaration.cpp:
2756         (WebCore::ComputedStyleExtractor::propertyValue):
2757         * css/CSSPropertyNames.in:
2758         * css/CSSValueKeywords.in:
2759         * css/parser/CSSParser.cpp:
2760         (WebCore::isSimpleLengthPropertyID):
2761         (WebCore::CSSParser::parseValue):
2762         * css/parser/CSSPropertyParser.cpp:
2763         (WebCore::CSSPropertyParser::parseSingleValue):
2764         * page/animation/CSSPropertyAnimation.cpp:
2765         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2766
2767 2016-10-20  Dave Hyatt  <hyatt@apple.com>
2768
2769         [CSS Parser] Fix region, column and page break parsing
2770         https://bugs.webkit.org/show_bug.cgi?id=163743
2771
2772         Reviewed by Simon Fraser.
2773
2774         * css/parser/CSSParserFastPaths.cpp:
2775         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2776         Add the missing values for break support.
2777
2778         * css/parser/CSSPropertyParser.cpp:
2779         (WebCore::isLegacyBreakProperty):
2780         (WebCore::CSSPropertyParser::parseValueStart):
2781         Add a special case for handling legacy break properties. Blink treats them like
2782         shorthands, but we can't do that without breaking the old parser, so for now
2783         we add a special case.
2784
2785         (WebCore::mapFromPageBreakBetween):
2786         (WebCore::mapFromColumnBreakBetween):
2787         (WebCore::mapFromRegionBreakBetween):
2788         Updated to have the AvoidXXX values (where XXX is Column/Page/Region).
2789
2790         (WebCore::CSSPropertyParser::parseShorthand):
2791         Remove the consumeLegacyBreak from the shorthand function, since we can't treat
2792         the legacy break properties as shorthands yet.
2793
2794 2016-10-20  Sam Weinig  <sam@webkit.org>
2795
2796         Add convenience function that combines WTF::visit(...) with WTF::makeVisitor(...)
2797         https://bugs.webkit.org/show_bug.cgi?id=163713
2798
2799         Reviewed by Dan Bernstein.
2800
2801         Switch uses of WTF::visit to use WTF::switchOn.
2802
2803         * dom/MessageEvent.cpp:
2804         (WebCore::MessageEvent::source):
2805         * dom/Node.cpp:
2806         (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
2807         (WebCore::Node::convertNodesOrStringsIntoNode):
2808         * html/HTMLSelectElement.cpp:
2809         (WebCore::HTMLSelectElement::add):
2810         * html/track/TrackEvent.cpp:
2811         (WebCore::TrackEvent::TrackEvent):
2812         * testing/TypeConversions.h:
2813         (WebCore::TypeConversions::typeConversionsDictionaryUnionType):
2814
2815 2016-10-20  Dave Hyatt  <hyatt@apple.com>
2816
2817         [CSS Parser] Fix font family parsing and add CSS region property parsing
2818         https://bugs.webkit.org/show_bug.cgi?id=163741
2819
2820         Reviewed by Zalan Bujtas.
2821
2822         * css/parser/CSSParser.cpp:
2823         (WebCore::isKeywordPropertyID):
2824         (WebCore::parseKeywordValue):
2825         (WebCore::CSSParser::parseValue):
2826         Modify the old CSSParser to have its own keyword check, since keywords were
2827         incorrectly added to the new parser when this check was consolidated. Column
2828         and region breaks are considered keyword properties by the old parser, but
2829         not by the new parser, since the new parser special cases them and maps them
2830         into the generic break property.
2831
2832         * css/parser/CSSParserFastPaths.cpp:
2833         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2834         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2835         Update for regions to make sure all the region properties are there. Remove the
2836         column and region break properties, since they're not supposed to be here in the
2837         new parser.
2838
2839         * css/parser/CSSPropertyParser.cpp:
2840         (WebCore::consumeFamilyName):
2841         Fix font parsing to make font family values so that fonts work.
2842
2843         (WebCore::consumeFlowProperty):
2844         Add a function for handling -webkit-flow-from and -webkit-flow-into.
2845
2846         (WebCore::CSSPropertyParser::parseSingleValue):
2847         Add support for the region properties.
2848
2849         (WebCore::mapFromRegionBreakBetween):
2850         (WebCore::mapFromColumnRegionOrPageBreakInside):
2851         (WebCore::mapFromLegacyBreakProperty):
2852         (WebCore::CSSPropertyParser::consumeLegacyBreakProperty):
2853         (WebCore::mapFromColumnOrPageBreakInside): Deleted.
2854         Update to handle the region break properties in the same way that column break
2855         properties are handled.
2856
2857 2016-10-20  Jer Noble  <jer.noble@apple.com>
2858
2859         CRASH in WebCore::MediaSource::seekToTime + 185
2860         https://bugs.webkit.org/show_bug.cgi?id=163652
2861
2862         Reviewed by Eric Carlson.
2863
2864         Test: media/media-source/media-source-seek-detach-crash.html
2865
2866         Add isClosed() checks (which are effectively m_private null-checks) everywhere m_private is
2867         dereferenced. The one place where m_private is cleared without setting the state to closed
2868         is stop(), so make stop() set the state to closed as well (without firing any events).
2869
2870         * Modules/mediasource/MediaSource.cpp:
2871         (WebCore::MediaSource::seekToTime):
2872         (WebCore::MediaSource::completeSeek):
2873         (WebCore::MediaSource::monitorSourceBuffers):
2874         (WebCore::MediaSource::streamEndedWithError):
2875         (WebCore::MediaSource::stop):
2876
2877 2016-10-20  Andreas Kling  <akling@apple.com>
2878
2879         Drop StyleResolver and SelectorQueryCache when entering PageCache.
2880         <https://webkit.org/b/154238>
2881
2882         Reviewed by Antti Koivisto.
2883
2884         Stop keeping these around for cached pages to save lots of memory.
2885         We can easily rebuild them if a cached navigation occurs, and this
2886         way we also don't need to worry about invalidating style for cached
2887         pages in all the right places.
2888
2889         Restoring a cached page will now lead to a forced style recalc.
2890         We don't try to defer this (beyond a zero-timer) since it's going
2891         to happen anyway, and it's nicer to front-load the cost rather than
2892         stuttering on the first user content interaction.
2893
2894         * dom/Document.cpp:
2895         (WebCore::Document::setPageCacheState):
2896         * history/CachedPage.cpp:
2897         (WebCore::CachedPage::restore):
2898         (WebCore::CachedPage::clear):
2899         * history/CachedPage.h:
2900         (WebCore::CachedPage::markForVisitedLinkStyleRecalc): Deleted.
2901         (WebCore::CachedPage::markForFullStyleRecalc): Deleted.
2902         * history/PageCache.cpp:
2903         (WebCore::PageCache::markPagesForVisitedLinkStyleRecalc): Deleted.
2904         (WebCore::PageCache::markPagesForFullStyleRecalc): Deleted.
2905         * history/PageCache.h:
2906         * page/Frame.cpp:
2907         (WebCore::Frame::setPageAndTextZoomFactors):
2908         * page/Page.cpp:
2909         (WebCore::Page::setViewScaleFactor):
2910         (WebCore::Page::setDeviceScaleFactor):
2911         (WebCore::Page::setPagination):
2912         (WebCore::Page::setPaginationLineGridEnabled):
2913         (WebCore::Page::setVisitedLinkStore):
2914
2915 2016-10-20  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2916
2917         [GTK] Build fix after r207616
2918         https://bugs.webkit.org/show_bug.cgi?id=163333
2919
2920         Reviewed by Carlos Garcia Campos.
2921
2922         EGL_PLATFORM_X11_KHR and EGL_PLATFORM_WAYLAND_KHR are not defined
2923         on the EGL headers shipped by Mesa 10.3 (shipped by Debian 8)
2924
2925         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
2926         (WebCore::PlatformDisplayWayland::initialize):
2927         * platform/graphics/x11/PlatformDisplayX11.cpp:
2928         (WebCore::PlatformDisplayX11::initializeEGLDisplay):
2929
2930 2016-10-20  Fujii Hironori  <Hironori.Fujii@sony.com>
2931
2932         [CMake] CMake does not support the dep files for implicit dependency
2933         https://bugs.webkit.org/show_bug.cgi?id=161433
2934
2935         Reviewed by Brent Fulgham.
2936
2937         Created a Perl script to generate all IDL bindings for CMake.
2938         This script can regenerate outdated bindings by based on the
2939         supplemental dependency and dep files created by
2940         '--write-dependencies' switch of generate-bindings.pl.
2941
2942         add_custom_target is used to invoke the script instead of
2943         add_custom_command because Ninja deletes all output files before
2944         executing the command in case of add_custom_command.
2945
2946         USES_TERMINAL option of add_custom_target has two effects:
2947         1) Not buffering output of the command
2948         2) Invoking the command in the special Ninja pool which inhibits parallel build
2949         One needs to use CMake 3.2 or later to enable this feature.
2950
2951         * CMakeLists.txt: Specified target names for
2952         GENERATE_BINDINGS. Added dependency for the targets.
2953         * bindings/scripts/generate-bindings-all.pl: Added.
2954
2955 2016-10-20  Adam Jackson  <ajax@redhat.com>
2956
2957         Prefer eglGetPlatformDisplay to eglGetDisplay
2958         https://bugs.webkit.org/show_bug.cgi?id=163333
2959
2960         Reviewed by Carlos Garcia Campos.
2961
2962         eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations
2963         do different things, in particular glvnd and Mesa behave differently. Fortunately there exists API to tell EGL
2964         what kind of display it is, so let's use it.
2965
2966         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
2967         (WebCore::PlatformDisplayWayland::initialize):
2968         * platform/graphics/x11/PlatformDisplayX11.cpp:
2969         (WebCore::PlatformDisplayX11::initializeEGLDisplay):
2970
2971 2016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2972
2973         [GTK] Avoid including egl.h headers in internal headers
2974         https://bugs.webkit.org/show_bug.cgi?id=163722
2975
2976         Reviewed by Žan Doberšek.
2977
2978         egl.h includes eglplatform.h that decides the native types for the platform at compile time. However, we support
2979         to build with X11 and Wayland at the same time and decide what to use at runtime. Currently GLContext.h includes
2980         eglplatform.h after wayland-egl.h if Wayland is enabled. That means that the wayland native types are used by
2981         default from all cpp files including GLContext.h. It currently works in X11 because we cast the value anyway and
2982         for example EGLNativeWindowType is a pointer in Wayland that can be casted to unsigned long in X11 to represent
2983         the X Window. This is very fragile in any case, we should avoid adding egl headers in our headers and only
2984         include it in cpp files. But we also need to ensure we don't use X11 and Wayland in the same cpp file.
2985
2986         * PlatformGTK.cmake:
2987         * platform/graphics/GLContext.cpp:
2988         (WebCore::GLContext::createContextForWindow):
2989         * platform/graphics/GLContext.h:
2990         * platform/graphics/egl/GLContextEGL.cpp:
2991         (WebCore::GLContextEGL::createWindowContext):
2992         (WebCore::GLContextEGL::createContext):
2993         (WebCore::GLContextEGL::~GLContextEGL):
2994         * platform/graphics/egl/GLContextEGL.h:
2995         * platform/graphics/egl/GLContextEGLWayland.cpp: Added.
2996         (WebCore::GLContextEGL::GLContextEGL):
2997         (WebCore::GLContextEGL::createWindowSurfaceWayland):
2998         (WebCore::GLContextEGL::createWaylandContext):
2999         (WebCore::GLContextEGL::destroyWaylandWindow):
3000         * platform/graphics/egl/GLContextEGLX11.cpp: Added.
3001         (WebCore::GLContextEGL::GLContextEGL):
3002         (WebCore::GLContextEGL::createWindowSurfaceX11):
3003         (WebCore::GLContextEGL::createPixmapContext):
3004         * platform/graphics/glx/GLContextGLX.cpp:
3005         (WebCore::GLContextGLX::createWindowContext):
3006         (WebCore::GLContextGLX::createContext):
3007         (WebCore::GLContextGLX::GLContextGLX):
3008         * platform/graphics/glx/GLContextGLX.h:
3009         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
3010         * platform/graphics/x11/PlatformDisplayX11.cpp:
3011
3012 2016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3013
3014         [GTK] Avoid strstr() when checking (E)GL extensions
3015         https://bugs.webkit.org/show_bug.cgi?id=161958
3016
3017         Reviewed by Žan Doberšek.
3018
3019         Add static method GLContext::isExtensionSupported() to properly search extenstions in the given extension
3020         list, and use it instead of strstr().
3021
3022         * platform/graphics/GLContext.cpp:
3023         (WebCore::GLContext::isExtensionSupported):
3024         * platform/graphics/GLContext.h:
3025         * platform/graphics/egl/GLContextEGL.cpp:
3026         (WebCore::GLContextEGL::createSurfacelessContext):
3027         * platform/graphics/glx/GLContextGLX.cpp:
3028         (WebCore::hasSGISwapControlExtension):
3029
3030 2016-10-20  Per Arne Vollan  <pvollan@apple.com>
3031
3032         [Win][Direct2D] Implement ImageBufferData::getData.
3033         https://bugs.webkit.org/show_bug.cgi?id=163668
3034
3035         Reviewed by Brent Fulgham.
3036
3037         Render data to a bitmap in system memory, which data can be read from.
3038
3039         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
3040         (WebCore::ImageBufferData::getData):
3041         * platform/graphics/win/ImageBufferDirect2D.cpp:
3042         (WebCore::ImageBuffer::ImageBuffer):
3043
3044 2016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3045
3046         Wrong use of EGL_DEPTH_SIZE
3047         https://bugs.webkit.org/show_bug.cgi?id=155536
3048
3049         Reviewed by Michael Catanzaro.
3050
3051         What happens here is that the driver doesn't implement EGL_DEPTH_SIZE and the default value, which is 0, is
3052         returned. Then XCreatePixmap fails because 0 is not a valid depth. The thing is that even if EGL_DEPTH_SIZE or
3053         EGL_BUFFER_SIZE returned a valid depth, it still might not be supported by the default screen and XCreatePixmap
3054         can fail. What we need to ensure is that the depth we pass is compatible with the X display, not only with the
3055         EGL config, to avoid failures when creating the pixmap. So, we can use EGL_NATIVE_VISUAL_ID instead, and
3056         then ask X for the visual info for that id. If it isn't found then we just return before creating the pixmap,
3057         but if the visual is found then we can be sure that the depth of the visual will not make the pixmap creation
3058         fail. However, with the driver I'm using it doesn't matter how we create the pixmap that eglCreatePixmapSurface
3059         always fails, again with X errors that are fatal by default. Since the driver is not free, I assume it doesn't
3060         support eglCreatePixmapSurface or it's just buggy, so the only option we have here is trap the x errors and
3061         ignore them. It turns out that the X errors are not fatal in this case, because eglCreatePixmapSurface ends up
3062         returning a surface, and since these are offscreen contexts, it doesn't really matter if they contain an
3063         invalid pixmap, because we never do swap buffer on them, so just ignoring the X errors fixes the crashes and
3064         makes everythig work. This patch adds a helper class XErrorTrapper that allows to trap XErrors and decide what
3065         to do with them (ignore, warn or crash) or even not consider a particular set of errors as errors.
3066
3067         * PlatformEfl.cmake: Add new file to compilation.
3068         * PlatformGTK.cmake: Ditto.
3069         * platform/graphics/egl/GLContextEGL.cpp:
3070         (WebCore::GLContextEGL::createPixmapContext): Use EGL_NATIVE_VISUAL_ID instead of EGL_DEPTH_SIZE to figure out
3071         the depth to be passed to XCreatePixmap. Also use the XErrorTrapper class to ignore all BadDrawable errors
3072         produced by eglCreatePixmapSurface() and only show a warning about all other X errors.
3073         * platform/graphics/x11/XErrorTrapper.cpp: Added.
3074         (WebCore::xErrorTrappersMap):
3075         (WebCore::XErrorTrapper::XErrorTrapper):
3076         (WebCore::XErrorTrapper::~XErrorTrapper):
3077         (WebCore::XErrorTrapper::errorCode):
3078         (WebCore::XErrorTrapper::errorEvent):
3079         * platform/graphics/x11/XErrorTrapper.h: Added.
3080         (WebCore::XErrorTrapper::XErrorTrapper):
3081
3082 2016-10-20  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
3083
3084         WebRTC: The MediaStreamTrackEvent init dictionary needs a required track member
3085         https://bugs.webkit.org/show_bug.cgi?id=146232
3086
3087         Update MediaStreamTrackEvent IDL as per specification.
3088
3089         Reviewed by Darin Adler.
3090
3091         No additional test required, rebase existings tests.
3092
3093         * Modules/mediastream/MediaStreamTrackEvent.idl:
3094
3095 2016-10-19  Antoine Quint  <graouts@apple.com>
3096
3097         [Modern Media Controls] Media Controller: mute support
3098         https://bugs.webkit.org/show_bug.cgi?id=163677
3099         <rdar://problem/28851582>
3100
3101         Reviewed by Dean Jackson.
3102
3103         We introduce the MuteSupport class which brings support for muting the media
3104         by clicking on the mute button in the media controls and correctly reflecting
3105         the media's muted state should the media be muted via the media API.
3106
3107         Tests: media/modern-media-controls/mute-support/mute-support-button-click.html
3108                media/modern-media-controls/mute-support/mute-support-media-api.html
3109                media/modern-media-controls/mute-support/mute-support-muted.html
3110
3111         * Modules/modern-media-controls/media/media-controller.js:
3112         (MediaController):
3113         * Modules/modern-media-controls/media/mute-support.js: Copied from Source/WebCore/Modules/modern-media-controls/media/media-controller.js.
3114         (MuteSupport.prototype.get control):
3115         (MuteSupport.prototype.get mediaEvents):
3116         (MuteSupport.prototype.buttonWasClicked):
3117         (MuteSupport.prototype.syncControl):
3118         (MuteSupport):
3119         * WebCore.xcodeproj/project.pbxproj:
3120         * rendering/RenderThemeMac.mm:
3121         (WebCore::RenderThemeMac::mediaControlsScript):
3122
3123 2016-10-19  Alex Christensen  <achristensen@webkit.org>
3124
3125         Revert r207151
3126         https://bugs.webkit.org/show_bug.cgi?id=163675
3127
3128         Reviewed by Brent Fulgham.
3129
3130         This code is still useful for comparison with Windows.  I'll remove it again soon.
3131
3132         No new tests.  No change in behavior.
3133
3134         * WebCore.xcodeproj/project.pbxproj:
3135         * WebCorePrefix.h:
3136         * loader/DocumentLoader.h:
3137         * loader/EmptyClients.h:
3138         * loader/FrameLoaderClient.h:
3139         * loader/ResourceLoader.cpp:
3140         (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
3141         * loader/ResourceLoader.h:
3142         * loader/SubresourceLoader.h:
3143         * loader/cf/ResourceLoaderCFNet.cpp:
3144         * loader/cocoa/SubresourceLoaderCocoa.mm:
3145         (WebCore::SubresourceLoader::willCacheResponse):
3146         * loader/mac/DocumentLoaderMac.cpp:
3147         * loader/mac/ResourceLoaderMac.mm:
3148         (WebCore::ResourceLoader::willCacheResponse):
3149         * page/mac/PageMac.mm:
3150         (WebCore::Page::platformInitialize):
3151         (WebCore::Page::addSchedulePair):
3152         (WebCore::Page::removeSchedulePair):
3153         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3154         (WebCore::WebCoreNSURLAuthenticationChallengeClient::create):
3155         (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient):
3156         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
3157         * platform/mac/WebCoreSystemInterface.h:
3158         * platform/network/NetworkStorageSession.h:
3159         * platform/network/ProtectionSpace.h:
3160         * platform/network/ProtectionSpaceBase.cpp:
3161         * platform/network/ResourceHandle.cpp:
3162         * platform/network/ResourceHandle.h:
3163         * platform/network/ResourceHandleClient.cpp:
3164         * platform/network/ResourceHandleClient.h:
3165         * platform/network/ResourceHandleInternal.h:
3166         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3167         * platform/network/ResourceRequestBase.cpp:
3168         * platform/network/cf/AuthenticationCF.cpp:
3169         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
3170         (WebCore::AuthenticationChallenge::setAuthenticationClient): Deleted.
3171         (WebCore::AuthenticationChallenge::authenticationClient): Deleted.
3172         (WebCore::AuthenticationChallenge::platformCompare): Deleted.
3173         (WebCore::createCF): Deleted.
3174         (WebCore::core): Deleted.
3175         * platform/network/cf/AuthenticationCF.h:
3176         * platform/network/cf/AuthenticationChallenge.h:
3177         * platform/network/cf/CookieJarCFNet.cpp:
3178         * platform/network/cf/CredentialStorageCFNet.cpp:
3179         (WebCore::CredentialStorage::getFromPersistentStorage):
3180         (WebCore::CredentialStorage::saveToPersistentStorage):
3181         * platform/network/cf/LoaderRunLoopCF.cpp:
3182         * platform/network/cf/LoaderRunLoopCF.h:
3183         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3184         (WebCore::NetworkStorageSession::cookieStorage):
3185         * platform/network/cf/ProtectionSpaceCFNet.cpp:
3186         * platform/network/cf/ProtectionSpaceCFNet.h:
3187         * platform/network/cf/ResourceError.h:
3188         * platform/network/cf/ResourceErrorCF.cpp:
3189         * platform/network/cf/ResourceHandleCFNet.cpp:
3190         (WebCore::shouldSniffConnectionProperty):
3191         (WebCore::ResourceHandle::createCFURLConnection):
3192         (WebCore::ResourceHandle::start):
3193         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
3194         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
3195         (WebCore::ResourceHandle::receivedCredential):
3196         (WebCore::ResourceHandle::schedule):
3197         (WebCore::ResourceHandle::unschedule):
3198         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
3199         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
3200         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3201         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
3202         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
3203         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
3204         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
3205         * platform/network/cf/ResourceRequest.h:
3206         (WebCore::ResourceRequest::encodingRequiresPlatformData):
3207         * platform/network/cf/ResourceRequestCFNet.cpp:
3208         (WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction):
3209         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
3210         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3211         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
3212         (WebCore::ResourceRequest::doUpdateResourceRequest):
3213         (WebCore::ResourceRequest::setStorageSession):
3214         * platform/network/cf/ResourceRequestCFNet.h:
3215         * platform/network/cf/ResourceResponse.h:
3216         * platform/network/cf/ResourceResponseCFNet.cpp:
3217         (WebCore::ResourceResponse::cfURLResponse):
3218         * platform/network/cf/SynchronousLoaderClientCFNet.cpp:
3219         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
3220         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
3221         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
3222         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
3223         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse):
3224         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
3225         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
3226         * platform/network/cocoa/CredentialCocoa.h:
3227         * platform/network/cocoa/CredentialCocoa.mm:
3228         (WebCore::Credential::Credential):
3229         (WebCore::Credential::cfCredential):
3230         * platform/network/cocoa/ProtectionSpaceCocoa.h:
3231         * platform/network/cocoa/ProtectionSpaceCocoa.mm:
3232         (WebCore::ProtectionSpace::ProtectionSpace):
3233         (WebCore::ProtectionSpace::cfSpace):
3234         * platform/network/cocoa/ResourceRequestCocoa.mm:
3235         (WebCore::ResourceRequest::nsURLRequest):
3236         * platform/network/cocoa/ResourceResponseCocoa.mm:
3237         (WebCore::ResourceResponse::platformCertificateInfo):
3238         (WebCore::ResourceResponse::nsURLResponse):
3239         (WebCore::ResourceResponse::ResourceResponse):
3240         * platform/network/ios/QuickLook.h:
3241         * platform/network/ios/QuickLook.mm:
3242         (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]):
3243         (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]):
3244         (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]):
3245         (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]):
3246         (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]):
3247         (-[WebQuickLookHandleAsDelegate detachHandle]):
3248         (WebCore::QuickLookHandle::create):
3249         (WebCore::QuickLookHandle::cfResponse):
3250         * platform/network/mac/AuthenticationMac.mm:
3251         (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]):
3252         (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]):
3253         (WebCore::core):
3254         (WebCore::mac):
3255         * platform/network/mac/CookieJarMac.mm:
3256         (WebCore::setCookiesFromDOM):
3257         (WebCore::addCookie):
3258         (WebCore::cookieStorage):
3259         * platform/network/mac/CredentialStorageMac.mm:
3260         * platform/network/mac/FormDataStreamMac.h:
3261         * platform/network/mac/FormDataStreamMac.mm:
3262         * platform/network/mac/ResourceErrorMac.mm:
3263         (NSErrorFromCFError):
3264         (WebCore::ResourceError::ResourceError):
3265         (WebCore::ResourceError::nsError):
3266         (WebCore::ResourceError::operator NSError *):
3267         * platform/network/mac/ResourceHandleMac.mm:
3268         (WebCore::ResourceHandle::getConnectionTimingData):
3269         * platform/network/mac/ResourceRequestMac.mm: Added.
3270         (WebCore::ResourceRequest::ResourceRequest):
3271         (WebCore::ResourceRequest::updateNSURLRequest):
3272         * platform/network/mac/SynchronousLoaderClient.mm:
3273         * platform/network/mac/WebCoreResourceHandleAsDelegate.h:
3274         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
3275         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
3276         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3277         * platform/network/mac/WebCoreURLResponse.mm:
3278         * platform/win/TemporaryLinkStubs.cpp:
3279         * testing/js/WebCoreTestSupportPrefix.h:
3280
3281 2016-10-19  Jer Noble  <jer.noble@apple.com>
3282
3283         REGRESSION (r206025): All YouTube videos play with black bars on all four sides
3284         https://bugs.webkit.org/show_bug.cgi?id=163308
3285
3286         Reviewed by Darin Adler.
3287
3288         Test: media/media-source/media-source-resize.html
3289
3290         After r206025, we do not fire resize events when the size change notification happens equal-
3291         to-or-before the current time, which can happen at the very beginning of a stream. Take care
3292         of this case by checking that the target time isn't actually in the past inside of
3293         sizeWillChangeAtTime(), and also always skip the boundary time observer when there was no
3294         previous size (such as after a flush due to a seek).
3295
3296         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3297         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3298         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
3299         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize):
3300         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3301         (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
3302         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
3303
3304 2016-10-19  Nan Wang  <n_wang@apple.com>
3305
3306         AX: [Mac] Mark element AXAPI should comform to specs
3307         https://bugs.webkit.org/show_bug.cgi?id=163707
3308
3309         Reviewed by Chris Fleizach.
3310
3311         Created a new role for mark elements on Mac and exposed the role
3312         description.
3313
3314         Changes are covered in modified test expectaions.
3315
3316         * English.lproj/Localizable.strings:
3317         * accessibility/AccessibilityObject.h:
3318         * accessibility/AccessibilityRenderObject.cpp:
3319         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
3320         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3321         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
3322         * accessibility/mac/AccessibilityObjectMac.mm:
3323         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
3324         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3325         (createAccessibilityRoleMap):
3326         (-[WebAccessibilityObjectWrapper roleDescription]):
3327         * platform/LocalizedStrings.cpp:
3328         (WebCore::AXMarkText):
3329         * platform/LocalizedStrings.h:
3330
3331 2016-10-19  Alex Christensen  <achristensen@webkit.org>
3332
3333         Re-enable URLParser for non-Safari Cocoa apps after r207321
3334         https://bugs.webkit.org/show_bug.cgi?id=163690
3335
3336         Reviewed by Darin Adler.
3337
3338         I disabled the URLParser for non-Safari applications in r207305
3339         to give me time to make URLParser more compatible, which I did in r207321
3340
3341         Updated some API tests which will be investigated in 
3342         https://bugs.webkit.org/show_bug.cgi?id=163127
3343
3344         * platform/URLParser.cpp:
3345         (WebCore::URLParser::setEnabled):
3346         (WebCore::URLParser::enabled):
3347         * testing/js/WebCoreTestSupport.cpp:
3348         (WebCoreTestSupport::setURLParserEnabled): Deleted.
3349         * testing/js/WebCoreTestSupport.h:
3350
3351 2016-10-19  Myles C. Maxfield  <mmaxfield@apple.com>
3352
3353         CSS font-variation-settings does not handle uppercase axis names in variable fonts
3354         https://bugs.webkit.org/show_bug.cgi?id=163546
3355
3356         Reviewed by Dean Jackson.
3357
3358         Remove the extra toASCIILower() call.
3359
3360         Test: fast/text/variations/case-axis-names.html
3361
3362         * css/parser/CSSParser.cpp:
3363         (WebCore::CSSParser::parseFontVariationTag):
3364
3365 2016-10-19  Anders Carlsson  <andersca@apple.com>
3366
3367         Remove m_redirectURLs from HistoryItem
3368         https://bugs.webkit.org/show_bug.cgi?id=163704
3369
3370         Reviewed by Dan Bernstein.
3371
3372         * history/HistoryItem.cpp:
3373         (WebCore::HistoryItem::HistoryItem):
3374         (WebCore::HistoryItem::reset):
3375         * history/HistoryItem.h:
3376
3377 2016-10-19  Joone Hur  <joone.hur@intel.com>
3378
3379         Add a plain space instead of &nbsp; between text nodes
3380         https://bugs.webkit.org/show_bug.cgi?id=123163
3381
3382         Reviewed by Ryosuke Niwa.
3383
3384         When we rebalance white spaces, &nbsp; can be added as space
3385         under some conditions. This patch adds a condition that the next
3386         sibling text node should not exist.
3387
3388         No new tests, updated existing test.
3389
3390         * editing/CompositeEditCommand.cpp:
3391         (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring):
3392         * editing/htmlediting.cpp:
3393         (WebCore::stringWithRebalancedWhitespace):
3394         * editing/htmlediting.h:
3395
3396 2016-10-19  Sam Weinig  <sam@webkit.org>
3397
3398         Add support for sequences and dictionaries in unions
3399         https://bugs.webkit.org/show_bug.cgi?id=163695
3400
3401         Reviewed by Chris Dumez.
3402
3403         Tests:
3404          - Updated js/dom/webidl-type-mapping.html
3405
3406         * bindings/generic/IDLTypes.h:
3407         Add additional helper predicates and fix formatting.
3408
3409         * bindings/js/JSDOMBinding.h:
3410         Export hasIteratorMethod for use in testing.
3411
3412         * bindings/js/JSDOMConvert.h:
3413         - Change return type of Converter<IDLDictionary<T>> to T, from Optional<T>.
3414         - Add support for unions conversion step 12 (parts 1-3).
3415
3416         * bindings/scripts/CodeGeneratorJS.pm:
3417         (GenerateDefaultValue):
3418         Support complex default value computations for unions using the convert infrastructure.
3419
3420         (GenerateParametersCheck):
3421         (GenerateConstructorDefinition):
3422         Remove incorrect .value() calls now that Converter<IDLDictionary<T>> returns T.
3423
3424         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3425         * bindings/scripts/test/JS/JSTestObj.cpp:
3426         Update bindings test results.
3427
3428         * testing/TypeConversions.h:
3429         (WebCore::TypeConversions::setTypeConversionsDictionary):
3430         (WebCore::TypeConversions::typeConversionsDictionaryLongValue):
3431         (WebCore::TypeConversions::typeConversionsDictionaryStringValue):
3432         (WebCore::TypeConversions::typeConversionsDictionarySequenceValue):
3433         (WebCore::TypeConversions::typeConversionsDictionaryUnionType):
3434         * testing/TypeConversions.idl:
3435         Add some complex types to allow testing IDL conversions from tests.
3436
3437 2016-10-19  Ryosuke Niwa  <rniwa@webkit.org>
3438
3439         Annotate more DOM and HTML IDLs with CEReactions
3440         https://bugs.webkit.org/show_bug.cgi?id=163653
3441
3442         Reviewed by Darin Adler.
3443
3444         Added CEReactions to more IDL files.
3445
3446         Test: fast/custom-elements/reactions-for-webkit-extensions.html
3447
3448         * bindings/js/JSDOMStringMapCustom.cpp:
3449         (WebCore::JSDOMStringMap::deleteProperty): Instantiate CustomElementReactionStack, which is equivalent to
3450         adding CEReactions in IDL.
3451         (WebCore::JSDOMStringMap::putDelegate): Ditto.
3452         * dom/Document.idl:
3453         * dom/Element.idl:
3454         * html/HTMLElement.idl:
3455         * page/DOMSelection.idl:
3456
3457 2016-10-19  Ryan Haddad  <ryanhaddad@apple.com>
3458
3459         Unreviewed, rolling out r207557.
3460
3461         This change caused animations/font-variations tests to time
3462         out on pre-Sierra Macs.
3463
3464         Reverted changeset:
3465
3466         "[macOS] [iOS] Disable variation fonts on macOS El Capitan and
3467         iOS 9"
3468         https://bugs.webkit.org/show_bug.cgi?id=163374
3469         http://trac.webkit.org/changeset/207557
3470
3471 2016-10-19  Dave Hyatt  <hyatt@apple.com>
3472
3473         [CSS Parser] Support -webkit-border-fit
3474         https://bugs.webkit.org/show_bug.cgi?id=163687
3475
3476         Reviewed by Zalan Bujtas.
3477
3478         Add support for -webkit-border-fit to isValidKeywordPropertyAndValue.
3479
3480         * css/parser/CSSParserFastPaths.cpp:
3481         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3482
3483 2016-10-19  Dave Hyatt  <hyatt@apple.com>
3484
3485         [CSS Parser] class and id parsing need to be case-insensitive in HTML quirks mode
3486         https://bugs.webkit.org/show_bug.cgi?id=163685
3487
3488         Reviewed by Zalan Bujtas.
3489
3490         Class and ID parsing should be case-insensitive in quirks mode. Apply the same hack
3491         that the old parser did and lowercase the class and ids in place.
3492
3493         * css/parser/CSSSelectorParser.cpp:
3494         (WebCore::CSSSelectorParser::consumeId):
3495         (WebCore::CSSSelectorParser::consumeClass):
3496
3497 2016-10-19  Nan Wang  <n_wang@apple.com>
3498
3499         AX: crash: com.apple.WebCore: WebCore::AccessibilityObject::findMatchingObjects + 600
3500         https://bugs.webkit.org/show_bug.cgi?id=163682
3501
3502         Reviewed by Chris Fleizach.
3503
3504         There's a null pointer crash when we ask for startObject->parentObjectUnignored() in
3505         AccessibilityObject::findMatchingObject. Added a null check for the startObject to fix that.
3506
3507         Test: accessibility/mac/search-predicate-crash.html
3508
3509         * accessibility/AccessibilityObject.cpp:
3510         (WebCore::AccessibilityObject::findMatchingObjects):
3511
3512 2016-10-19  David Kilzer  <ddkilzer@apple.com>
3513
3514         Bug 163670: Refine assertions in WebCore::ImageData constructors
3515         <https://webkit.org/b/163670>
3516         <rdar://problem/27497338>
3517
3518         Reviewed by Brent Fulgham.
3519
3520         No new tests because there is no change in nominal behavior.
3521
3522         * html/ImageData.cpp:
3523         (WebCore::ImageData::ImageData(const IntSize&)): Change to use
3524         ASSERT() since the worst-case scenario here is a nullptr deref.
3525         Switch to IntSize::area() to compute the area.
3526         (WebCore::ImageData::ImageData(const IntSize&, Ref<Uint8ClampedArray>&&)):
3527         Add ASSERT() identical to the previous constructor, and change
3528         ASSERT_WITH_SECURITY_IMPLICATION() to only fire when m_data is
3529         not nullptr and the length check fails.  Switch to
3530         IntSize::area() to compute the area.
3531
3532 2016-10-19  Myles C. Maxfield  <mmaxfield@apple.com>
3533
3534         [macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9
3535         https://bugs.webkit.org/show_bug.cgi?id=163374
3536
3537         Reviewed by Darin Adler.
3538
3539         Because of platform lack of support for variations in in-memory fonts,
3540         this feature should be disabled on the affected OSes.
3541
3542         No tests because there is no behavior change (on the relevant platforms).
3543
3544         * Configurations/FeatureDefines.xcconfig:
3545
3546 2016-10-19  Dave Hyatt  <hyatt@apple.com>
3547
3548         [CSS Parser] Fix background-position parsing
3549         https://bugs.webkit.org/show_bug.cgi?id=163681
3550
3551         Reviewed by Dean Jackson.
3552
3553         The new parser has a more efficient parsed representation of background positions. When
3554         background-position is "center" or when no length unit is specified for a dimension,
3555         then rather than creating a pair, the new parser makes a singleton primitive value.
3556
3557         Patch the StyleBuilder code to handle this case, resolving center to (left,50%) or
3558         (top,50%) as appropriate and also handling top/left without any associated length.
3559
3560         * css/CSSToStyleMap.cpp:
3561         (WebCore::CSSToStyleMap::mapFillXPosition):
3562         (WebCore::CSSToStyleMap::mapFillYPosition):
3563
3564 2016-10-19  Antoine Quint  <graouts@apple.com>
3565
3566         [Modern Media Controls] Media Controller: click-to-start support
3567         https://bugs.webkit.org/show_bug.cgi?id=163659
3568         <rdar://problem/28845656>
3569
3570         Reviewed by Dean Jackson.
3571
3572         We introduce the MediaControllerSupport class which will allow a number of media controller
3573         features to be implemented by subclasses each devoted to implementing a specific subset of
3574         media controller features. With this bug, we add the correct behavior for click-to-start,
3575         only showing the start button under the right circumstances.
3576
3577         A MediaController object indicates which media control to attach click event listeners to
3578         through the `control` property, and a list of media events it should register on the media
3579         element through the `mediaEvents` property. Then, as the user interacts with the specified
3580         control and the media, the Button delegation method `buttonWasClicked()` and the `syncControl()`
3581         methods are called to allow for the media state to be correctly set and represented in the
3582         media controls. Custom event handling for the specified events can also be achieved by
3583         subclassing the `handleEvent()` method.
3584
3585         Tests: media/modern-media-controls/start-support/start-support-audio.html
3586                media/modern-media-controls/start-support/start-support-autoplay.html
3587                media/modern-media-controls/start-support/start-support-click-to-start.html
3588                media/modern-media-controls/start-support/start-support-error.html
3589                media/modern-media-controls/start-support/start-support-fullscreen.html
3590                media/modern-media-controls/start-support/start-support-manual-play.html
3591                media/modern-media-controls/start-support/start-support-no-source.html
3592
3593         * Modules/modern-media-controls/media/media-controller-support.js: Added.
3594         (MediaControllerSupport):
3595         (MediaControllerSupport.prototype.get control):
3596         (MediaControllerSupport.prototype.get mediaEvents):
3597         (MediaControllerSupport.prototype.buttonWasClicked):
3598         (MediaControllerSupport.prototype.handleEvent):
3599         (MediaControllerSupport.prototype.syncControl):
3600         * Modules/modern-media-controls/media/media-controller.js:
3601         (MediaController):
3602         (MediaController.prototype.buttonWasClicked): Deleted.
3603         * Modules/modern-media-controls/media/start-support.js: Added.
3604         (StartSupport.prototype.get control):
3605         (StartSupport.prototype.get mediaEvents):
3606         (StartSupport.prototype.buttonWasClicked):
3607         (StartSupport.prototype.handleEvent):
3608         (StartSupport.prototype.syncControl):
3609         (StartSupport.prototype._shouldShowStartButton):
3610         (StartSupport):
3611
3612 2016-10-19  Aaron Chu  <aaron_chu@apple.com>
3613
3614         Web Inspector: AXI: expose computed tree node and heading level
3615         https://bugs.webkit.org/show_bug.cgi?id=130825
3616         <rdar://problem/16442349>
3617
3618         Reviewed by Joseph Pecoraro.
3619
3620         Exposing two new accessibility properties: Heading Level and Hierarchical Level.
3621
3622         Updated Test: LayoutTest/inspector/dom/getAccessibilityPropertiesForNode.html
3623
3624         * inspector/InspectorDOMAgent.cpp:
3625         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3626
3627 2016-10-19  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3628
3629         WebRTC: Implement MediaEndpointPeerConnection::stop()
3630         https://bugs.webkit.org/show_bug.cgi?id=163660
3631
3632         Reviewed by Philippe Normand.
3633
3634         Make MediaEndpointPeerConnection::stop() stop its MediaEndpoint.
3635
3636         Testing: This fix deals with cleanup and tearing down resources down in the platform layer
3637         and is not covered by automated tests. It is however observable in the manual test added
3638         in [1] where the remote videos should stop when the connections are closed.
3639
3640         [1] http://webkit.org/b/163327
3641
3642         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3643         (WebCore::MediaEndpointPeerConnection::stop):
3644
3645 2016-10-19  Dave Hyatt  <hyatt@apple.com>
3646
3647         [CSS Parser] Fix -webkit-mask-box-image parsing
3648         https://bugs.webkit.org/show_bug.cgi?id=163676
3649
3650         Reviewed by Dean Jackson.
3651
3652         -webkit-mask-box-image is not a shorthand in our current code, so treat it the same as the legacy
3653         -webkit-border-image.
3654
3655         * css/parser/CSSPropertyParser.cpp:
3656         (WebCore::CSSPropertyParser::parseSingleValue):
3657         (WebCore::CSSPropertyParser::parseShorthand):
3658
3659 2016-10-19  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3660
3661         [GTK][EFL] Build fix after r207543.
3662         https://bugs.webkit.org/show_bug.cgi?id=163671
3663
3664         Unreviewed.
3665
3666         Fix typo on the filename of the included header:
3667         Mac filesystem is case insensitive, but Linux filesystems are case sensitive.
3668
3669         * css/parser/CSSPropertyParser.cpp:
3670
3671 2016-10-19  Zalan Bujtas  <zalan@apple.com>
3672
3673         Use anonymous table row for new child at RenderTableRow::addChild() if available.
3674         https://bugs.webkit.org/show_bug.cgi?id=163651
3675         <rdar://problem/28705022>
3676
3677         Reviewed by David Hyatt.
3678
3679         We should try to prevent the continuation siblings from getting separated and inserted into
3680         wrapper renderers. It makes finding these continuation siblings difficult.
3681         This patch adds a checks for anonymous table rows so that we could find a closer common ancestor of
3682         beforeChild/new child. 
3683
3684         Test: fast/table/crash-when-table-has-continuation-and-content-inserted.html
3685
3686         * rendering/RenderObject.cpp:
3687         (WebCore::RenderObject::showRenderObject): Add continuation information.
3688         * rendering/RenderTableRow.cpp:
3689         (WebCore::RenderTableRow::addChild):
3690
3691 2016-10-19  Joseph Pecoraro  <pecoraro@apple.com>
3692
3693         Cleanup WebCore/workers
3694         https://bugs.webkit.org/show_bug.cgi?id=163635
3695
3696         Reviewed by Chris Dumez.
3697
3698         * workers/*:
3699         Cleanup like pragma once, nullptr, remove stale includes, declarations.
3700
3701 2016-10-19  Chris Dumez  <cdumez@apple.com>
3702
3703         MouseEvent's coordinates should be 0 for simulated clicks
3704         https://bugs.webkit.org/show_bug.cgi?id=163648
3705
3706         Reviewed by Darin Adler.
3707
3708         MouseEvent's coordinates should be 0 / 0 for simulated clicks triggered
3709         by JavaScript (i.e. via element.click()). This behavior matches Chrome
3710         and Firefox.
3711
3712         WebKit was computing actual coordinates for the element which was
3713         expensive, especially because computing  screenX / screenY required
3714         a synchronous IPC with the UI process.
3715
3716         Test: fast/events/element-click-no-coords.html
3717
3718         * dom/Element.cpp:
3719         (WebCore::Element::dispatchSimulatedClick):
3720         * dom/SimulatedClick.cpp:
3721         (WebCore::simulateMouseEvent):
3722         (WebCore::simulateClick):
3723         * dom/SimulatedClick.h:
3724         * html/HTMLElement.cpp:
3725         (WebCore::HTMLElement::click):
3726
3727 2016-10-19  Dave Hyatt  <hyatt@apple.com>
3728
3729         [CSS Parser] Fix transform parsing
3730         https://bugs.webkit.org/show_bug.cgi?id=163671
3731
3732         Reviewed by Dean Jackson.
3733
3734         The new parser turned function names into CSSValueIDs and made CSSFunctionValue store them. This
3735         meant it could be used to handle transform values, with the function name representing the
3736         transform operation efficiently as a CSSValueID.
3737
3738         The old parser, however, creates WebKitCSSTransformValues. This value does not exist in the new
3739         parser. Rather than forcing the old and new parser over to CSSFunctionValues, I opted to
3740         just make the new parser build WebkitCSSTransformValues too.
3741
3742         The main reason I did this is that WebkitCSSTransformValue is actually exposed to the Web via
3743         IDL. To be safe, I am not eliminating it (even though Blink has).
3744
3745         * css/parser/CSSPropertyParser.cpp:
3746         (WebCore::consumeTranslate3d):
3747         (WebCore::consumeNumbers):
3748         (WebCore::consumePerspective):
3749         (WebCore::transformOperationForCSSValueID):
3750         (WebCore::consumeTransformValue):
3751
3752 2016-10-19  Darin Adler  <darin@apple.com>
3753
3754         Move XPath from ExceptionCode to Exception
3755         https://bugs.webkit.org/show_bug.cgi?id=163656
3756
3757         Reviewed by Chris Dumez.
3758
3759         * dom/Document.cpp:
3760         (WebCore::Document::createExpression): Use ExceptionOr.
3761         (WebCore::Document::createNSResolver): Return Ref.
3762         (WebCore::Document::evaluate): Use ExceptionOr.
3763         * dom/Document.h: Updated for above changes.
3764         * dom/Document.idl: Use non-legacy exceptions for the functions above.
3765
3766         * inspector/InspectorNodeFinder.cpp:
3767         (WebCore::InspectorNodeFinder::searchUsingXPath): Call XPath functions
3768         with new interface.
3769
3770         * xml/DOMParser.cpp:
3771         (WebCore::DOMParser::DOMParser): Marked inline.
3772         (WebCore::DOMParser::create): Moved here from header.
3773         (WebCore::DOMParser::parseFromString): Use ExceptionOr.
3774         * xml/DOMParser.h: Updated for above changes.
3775         * xml/DOMParser.idl: Use non-legacy exception.
3776
3777         * xml/XPathEvaluator.cpp:
3778         (WebCore::XPathEvaluator::createExpression): Use ExceptionOr.
3779         (WebCore::XPathEvaluator::evaluate): Ditto.
3780         * xml/XPathEvaluator.h: Updated for above changes.
3781         * xml/XPathEvaluator.idl: Use non-legacy exceptions.
3782
3783         * xml/XPathExpression.cpp:
3784         (WebCore::XPathExpression::createExpression): Use ExceptionOr.
3785         (WebCore::XPathExpression::evaluate): Ditto.
3786         * xml/XPathExpression.h: Updated for above changes.
3787         * xml/XPathExpression.idl: Use non-legacy exceptions.
3788
3789         * xml/XPathGrammar.y: Added include of XPathStep.h.
3790
3791         * xml/XPathParser.cpp:
3792         (WebCore::XPath::Parser::Parser): Initialize three scalar data members
3793         in the class definition rather than here.
3794         (WebCore::XPath::Parser::parseStatement): Use ExceptionOr.
3795         * xml/XPathParser.h: Updated for above changes.
3796
3797         * xml/XPathResult.cpp:
3798         (WebCore::XPathResult::XPathResult): Use a reference rather than a
3799         pointer for the document. Alao initialize two scalar data members
3800         in the class definition rather than here.
3801         (WebCore::XPathResult::convertTo): Use ExceptionOr.
3802         (WebCore::XPathResult::numberValue): Ditto.
3803         (WebCore::XPathResult::stringValue): Ditto.
3804         (WebCore::XPathResult::booleanValue): Ditto.
3805         (WebCore::XPathResult::singleNodeValue): Ditto.
3806         (WebCore::XPathResult::snapshotLength): Ditto.
3807         (WebCore::XPathResult::iterateNext): Ditto.
3808         (WebCore::XPathResult::snapshotItem): Ditto.
3809         * xml/XPathResult.h: Updated for the changes above.
3810         * xml/XPathResult.idl: Use non-legacy exceptions.
3811
3812 2016-10-19  Nan Wang  <n_wang@apple.com>
3813
3814         AX: [Mac] Meter element should use AXValueDescription to descrbe the status of the value
3815         https://bugs.webkit.org/show_bug.cgi?id=163610
3816
3817         Reviewed by Chris Fleizach.
3818
3819         Exposed the goodness of the meter value in AXValueDescription.
3820
3821         Test: accessibility/mac/meter-gauge-value-description.html
3822
3823         * English.lproj/Localizable.strings:
3824         * accessibility/AccessibilityProgressIndicator.cpp:
3825         (WebCore::AccessibilityProgressIndicator::gaugeRegionValueDescription):
3826         * accessibility/AccessibilityProgressIndicator.h:
3827         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3828         (-[WebAccessibilityObjectWrapper valueDescriptionForMeter]):
3829         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3830         * platform/LocalizedStrings.cpp:
3831         (WebCore::AXMeterGaugeRegionOptimumText):
3832         (WebCore::AXMeterGaugeRegionSuboptimalText):
3833         (WebCore::AXMeterGaugeRegionLessGoodText):
3834         * platform/LocalizedStrings.h:
3835
3836 2016-10-19  Dave Hyatt  <hyatt@apple.com>
3837
3838         [CSS Parser] Fix named color parsing
3839         https://bugs.webkit.org/show_bug.cgi?id=163662
3840
3841         Reviewed by Zalan Bujtas.
3842
3843         Named color parsing in the old parser for extended colors relied on constructing a Color with the
3844         name and doing a lookup that way.
3845
3846         The new parser allows the back end to hold a primitive identifier value for extended colors.
3847
3848         StyleColor contains a helper function for looking up the correct color.
3849
3850         This patch switches both the old and the new parsers over to the new StyleColor function.
3851
3852         Also remove some asserts from the CSSSelectorList, since the new parser allows it to be empty and
3853         detects parsing failure that way.
3854
3855         * css/CSSSelectorList.cpp:
3856         (WebCore::CSSSelectorList::CSSSelectorList):
3857         (WebCore::CSSSelectorList::operator=):
3858         * css/StyleColor.cpp:
3859         (WebCore::StyleColor::isColorKeyword):
3860         * css/StyleResolver.cpp:
3861         (WebCore::StyleResolver::colorFromPrimitiveValue):
3862         (WebCore::colorForCSSValue): Deleted.
3863
3864 2016-10-19  Youenn Fablet  <youenn@apple.com>
3865
3866         Remove SecurityOrigin::taintsCanvas
3867         https://bugs.webkit.org/show_bug.cgi?id=163594
3868
3869         Reviewed by Darin Adler.
3870
3871         No change of behavior.
3872
3873         * html/canvas/CanvasRenderingContext.cpp:
3874         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
3875         * page/SecurityOrigin.cpp:
3876         (WebCore::SecurityOrigin::canReceiveDragData):
3877         (WebCore::SecurityOrigin::taintsCanvas): Deleted.
3878         * page/SecurityOrigin.h:
3879
3880 2016-10-18  Dave Hyatt  <hyatt@apple.com>
3881
3882         [CSS Parser] Fix compound selector parsing.
3883         https://bugs.webkit.org/show_bug.cgi?id=163649
3884
3885         Reviewed by Darin Adler.
3886
3887         The new CSS parser is failing to handle compound selectors. The code has an assumption that the
3888         first value in the RelationType enum is SubSelector. This patch changes the enum to have the same
3889         name used in Blink, RelationType, and to make the ordering be exactly the same.
3890
3891         * css/CSSSelector.h:
3892         (WebCore::CSSSelector::relation):
3893         (WebCore::CSSSelector::setRelation):
3894         * css/SelectorChecker.cpp:
3895         (WebCore::SelectorChecker::matchRecursively):
3896         (WebCore::canMatchHoverOrActiveInQuirksMode):
3897         (WebCore::SelectorChecker::determineLinkMatchType):
3898         * css/SelectorFilter.cpp:
3899         (WebCore::SelectorFilter::collectIdentifierHashes):
3900         * css/parser/CSSParserValues.cpp:
3901         (WebCore::CSSParserSelector::insertTagHistory):
3902         (WebCore::CSSParserSelector::appendTagHistory):
3903         * css/parser/CSSParserValues.h:
3904         (WebCore::CSSParserSelector::setRelation):
3905         * css/parser/CSSSelectorParser.cpp:
3906         (WebCore::CSSSelectorParser::consumeComplexSelector):
3907         (WebCore::CSSSelectorParser::consumeCombinator):
3908         * css/parser/CSSSelectorParser.h:
3909         * cssjit/SelectorCompiler.cpp:
3910         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
3911         (WebCore::SelectorCompiler::constructFragmentsInternal):
3912
3913 2016-10-19  Javier Fernandez  <jfernandez@igalia.com>
3914
3915         Web Inspector: Debugger buttons positioned incorrectly, align-content default value is unexpected
3916         https://bugs.webkit.org/show_bug.cgi?id=163572
3917
3918         Reviewed by Sergio Villar Senin.
3919
3920         We only allow the new CSS Box Alignment syntax when the Grid Layout
3921         feature is enabled. Due to flexbox backward compatibility we have
3922         implemented a different code path for the style initial/default values
3923         assignment. However, we have incorrectly resolved both align-content
3924         and justify-content to 'flex-start' when grid layout is disabled.
3925
3926         This patch changes the approach, so we set 'normal' (the value specified
3927         by the new syntax) for both properties, but using the values defined in
3928         the old syntax (Flexbox specification) at computed style resolution.
3929
3930         Since 'stretch' is the default value for the align-content property, this
3931         issue implies that any flexbox line with an undefined height will be
3932         laid out incorrectly, if not explicitly set via CSS, because flex items
3933         can't use the available height, even though they use 'stretch' for their
3934         'align-self' properties.
3935
3936         Test: css3/flexbox/flexbox-lines-must-be-stretched-by-default.html
3937
3938         * css/CSSComputedStyleDeclaration.cpp:
3939         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
3940         (WebCore::ComputedStyleExtractor::propertyValue):
3941         * rendering/style/RenderStyle.h:
3942         (WebCore::RenderStyle::initialContentAlignment):
3943
3944 2016-10-19  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3945
3946         [GTK] REGRESSION(r207396) Build broken with Clang.
3947         https://bugs.webkit.org/show_bug.cgi?id=163599
3948
3949         Suggested and reviewed by Darin Adler.
3950
3951         * css/CSSPrimitiveValue.cpp:
3952         (WebCore::CSSPrimitiveValue::getStringValue):
3953
3954 2016-10-19  Darin Adler  <darin@apple.com>
3955
3956         Try to fix build.
3957
3958         * page/PerformanceUserTiming.cpp: Add back class name; needed by some compiler versions.
3959
3960 2016-10-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3961
3962         Unreviewed. Fix the build after r207522.
3963
3964         * page/PerformanceUserTiming.cpp: Include PerformanceTiming.h.
3965
3966 2016-10-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3967
3968         Unreviewed. Fix the build after r207519.
3969
3970         The build error is:
3971         IDL ATTRIBUTE CHECKER ERROR: Unknown IDL attribute [PassContext] is found at TestRunner.idl.
3972
3973         Because PassContext was removed from IDLAttributes.txt in rr207519, but it's implemented by
3974         CodeGeneratorTestRunner.pm and used by TestRunner.idl.
3975
3976         * bindings/scripts/IDLAttributes.txt: Bring back PassContext.
3977
3978 2016-10-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3979
3980         Unreviewed. Fix the build with GCC 4.9 after r207463.
3981
3982         Add constructors to MediaConstraintsData.
3983
3984         * Modules/mediastream/MediaConstraintsImpl.h:
3985         (WebCore::MediaConstraintsData::MediaConstraintsData):
3986
3987 2016-10-19  Jer Noble  <jer.noble@apple.com>
3988
3989         [Mac][MSE] Movies with a 'mehd' box have a zero-duration
3990