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