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