ba648cae41a122b5d9070b9e12843a3e83a65c25
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-11  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r182947.
4         https://bugs.webkit.org/show_bug.cgi?id=166922
5
6         Caused huge memory leak see https://webkit.org/b/166884
7         (Requested by KaL on #webkit).
8
9         Reverted changeset:
10
11         "[GStreamer] Silent WebAudio buffers support"
12         https://bugs.webkit.org/show_bug.cgi?id=143869
13         http://trac.webkit.org/changeset/182947
14
15 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
16
17         Unreviewed, rolling out r210579.
18
19         That was not the right fix
20
21         Reverted changeset:
22
23         "Unreviewed GTK buildfix after r210571."
24         http://trac.webkit.org/changeset/210579
25
26 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
27
28         Unreviewed. Fix GTK+ build after r210571.
29
30         Add getFileDeviceId implementation to FileSystemGlib.cpp.
31
32         * platform/glib/FileSystemGlib.cpp:
33         (WebCore::getFileDeviceId):
34
35 2017-01-11  Csaba Osztrogonác  <ossy@webkit.org>
36
37         Unreviewed GTK buildfix after r210571.
38
39         * PlatformGTK.cmake:
40
41 2017-01-10  Yusuke Suzuki  <utatane.tea@gmail.com>
42
43         Implement JSSourceCode to propagate SourceCode in module pipeline
44         https://bugs.webkit.org/show_bug.cgi?id=166861
45
46         Reviewed by Saam Barati.
47
48         Now SourceOrigin is correctly propagated through the module pipeline.
49         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
50         is updated.
51
52         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
53         * bindings/js/JSDOMPromise.h:
54         (WebCore::DeferredPromise::resolveWithCallback):
55         * bindings/js/ScriptModuleLoader.cpp:
56         (WebCore::ScriptModuleLoader::notifyFinished):
57
58 2017-01-10  Brent Fulgham  <bfulgham@apple.com>
59
60         File scheme should not allow access of a resource on a different volume.
61         https://bugs.webkit.org/show_bug.cgi?id=158552
62         <rdar://problem/15307582>
63
64         Reviewed by Alex Christensen.
65
66         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
67         on a different storage device (volume) unless universal access is enabled.
68
69         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
70         where the device changes in the midst of a load.
71
72         Also properly reflect that SecurityOrigin is never null by passing as a reference,
73         rather than as a pointer.
74
75         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
76
77         * page/SecurityOrigin.cpp:
78         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
79         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
80         the same storage volume.
81         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
82         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
83         * page/SecurityOrigin.h:
84         * platform/FileSystem.cpp:
85         (WebCore::filesHaveSameVolume): Added.
86         * platform/FileSystem.h:
87         * platform/network/cocoa/ResourceRequestCocoa.mm:
88         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
89         the storage device at the time of the start of the load so we can trigger a failure if this
90         changes during the load operation.
91         * platform/posix/FileSystemPOSIX.cpp:
92         (WebCore::getFileDeviceId): Added.
93         * platform/win/FileSystemWin.cpp:
94         (WebCore::getFileDeviceId): Added.
95
96 2017-01-10  Sam Weinig  <sam@webkit.org>
97
98         [WebIDL] Remove most of the custom bindings for the WebGL code
99         https://bugs.webkit.org/show_bug.cgi?id=166834
100
101         Reviewed by Alex Christensen.
102
103         Removes all but one custom getter (getExtension) from the WebGL code.
104
105         * Modules/indexeddb/IDBKeyRange.idl:
106         Replace use of non-standard type, with new OverrideIDLType extended attribute, allowing us
107         to stay more consistent with the IDL files spec's provide.
108
109         * WebCore.xcodeproj/project.pbxproj:
110         Move JSWebGL2RenderingContextCustom to the GC/Wrapping only group.
111
112         * bindings/IDLTypes.h:
113         Add IDLWebGLAny, and simplify IDLIDBKey to not be templatized.
114
115         * bindings/js/JSDOMConvert.h:
116         (WebCore::Converter<IDLLong>::convert):
117         (WebCore::Converter<IDLFloat>::convert):
118         (WebCore::Converter<IDLUnrestrictedFloat>::convert):
119         (WebCore::Converter<IDLDouble>::convert):
120         (WebCore::Converter<IDLUnrestrictedDouble>::convert):
121         Add overloads of convert that convert a double to the numeric type.
122
123         (WebCore::Detail::GenericSequenceConverter::convert):
124         Add optimized specialization for JSArrays that does not use the iterator protocol.
125
126         (WebCore::Detail::NumericSequenceConverter::convert):
127         Add an even more optimized specialization for numeric types, which checks to see
128         if the array's butterfly has an optimized shape, and extracts the numeric values
129         from that.
130
131         (WebCore::Detail::SequenceConverter::convert):
132         (WebCore::Detail::SequenceConverter<IDLLong>::convert):
133         (WebCore::Detail::SequenceConverter<IDLFloat>::convert):
134         (WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
135         (WebCore::Detail::SequenceConverter<IDLDouble>::convert):
136         (WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
137         Select the right specialization based on type.
138
139         (WebCore::Converter<IDLSequence<T>>::convert):
140         (WebCore::Converter<IDLFrozenArray<T>>::convert):
141         Rename converter to be more accurate.
142
143         (WebCore::JSConverter<IDLWebGLAny>::convert):
144         Added. Calls through to converter in WebGLAny.h. We should replace this with a
145         call to the IDLUnion JSConverter when feasible.
146
147         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
148         (WebCore::JSWebGL2RenderingContext::getInternalformatParameter): Deleted.
149         (WebCore::JSWebGL2RenderingContext::getQueryParameter): Deleted.
150         (WebCore::JSWebGL2RenderingContext::getSamplerParameter): Deleted.
151         (WebCore::JSWebGL2RenderingContext::getSyncParameter): Deleted.
152         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Deleted.
153         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockParameter): Deleted.
154         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockName): Deleted.
155         Remove unnecessary custom functions.
156
157         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
158         (WebCore::objectParameter): Deleted.
159         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Deleted.
160         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Deleted.
161         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Deleted.
162         (WebCore::JSWebGLRenderingContextBase::getParameter): Deleted.
163         (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Deleted.
164         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Deleted.
165         (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Deleted.
166         (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Deleted.
167         (WebCore::JSWebGLRenderingContextBase::getTexParameter): Deleted.
168         (WebCore::JSWebGLRenderingContextBase::getUniform): Deleted.
169         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Deleted.
170         (WebCore::toNumberVector): Deleted.
171         (WebCore::functionForUniform): Deleted.
172         (WebCore::dataFunctionf): Deleted.
173         (WebCore::dataFunctioni): Deleted.
174         (WebCore::dataFunctionMatrix): Deleted.
175         (WebCore::JSWebGLRenderingContextBase::uniform1fv): Deleted.
176         (WebCore::JSWebGLRenderingContextBase::uniform1iv): Deleted.
177         (WebCore::JSWebGLRenderingContextBase::uniform2fv): Deleted.
178         (WebCore::JSWebGLRenderingContextBase::uniform2iv): Deleted.
179         (WebCore::JSWebGLRenderingContextBase::uniform3fv): Deleted.
180         (WebCore::JSWebGLRenderingContextBase::uniform3iv): Deleted.
181         (WebCore::JSWebGLRenderingContextBase::uniform4fv): Deleted.
182         (WebCore::JSWebGLRenderingContextBase::uniform4iv): Deleted.
183         (WebCore::JSWebGLRenderingContextBase::uniformMatrix2fv): Deleted.
184         (WebCore::JSWebGLRenderingContextBase::uniformMatrix3fv): Deleted.
185         (WebCore::JSWebGLRenderingContextBase::uniformMatrix4fv): Deleted.
186         (WebCore::JSWebGLRenderingContextBase::vertexAttrib1fv): Deleted.
187         (WebCore::JSWebGLRenderingContextBase::vertexAttrib2fv): Deleted.
188         (WebCore::JSWebGLRenderingContextBase::vertexAttrib3fv): Deleted.
189         (WebCore::JSWebGLRenderingContextBase::vertexAttrib4fv): Deleted.
190         Remove unnecessary custom functions.
191
192         * bindings/scripts/CodeGenerator.pm:
193         (IsBuiltinType):
194         Remove specialization of IDBKey.
195
196         * bindings/scripts/CodeGeneratorJS.pm:
197         (GetBaseIDLType):
198         (GetIDLType):
199         (NativeToJSValueDOMConvertNeedsState):
200         (NativeToJSValueDOMConvertNeedsGlobalObject):
201         (NativeToJSValue):
202         Allow IDL files to override the type of signature using a new OverrideIDLType
203         extended attribute. Currently this only works conversion to JS, but could be
204         extended to support more.
205
206         * bindings/scripts/IDLAttributes.txt:
207         Add OverrideIDLType.
208
209         * html/canvas/WebGL2RenderingContext.idl:
210         Add OverrideIDLType=IDLWebGLAny annotations to remove the need for custom functions.
211
212         * html/canvas/WebGLAny.cpp:
213         (WebCore::convertToJSValue):
214         (WebCore::toJS): Deleted.
215         * html/canvas/WebGLAny.h:
216         Rename the toJS function to convertToJSValue to avoid a template specialization issue.
217
218         * html/canvas/WebGLRenderingContextBase.cpp:
219         (WebCore::WebGLRenderingContextBase::getAttachedShaders):
220         Update signature to match IDL, replacing bool return value plus out parameter with an
221         optional return value. Modernize the code a bit.
222
223         (WebCore::WebGLRenderingContextBase::uniform2f):
224         (WebCore::WebGLRenderingContextBase::uniform3f):
225         (WebCore::WebGLRenderingContextBase::uniform4f):
226         (WebCore::WebGLRenderingContextBase::uniform1i):
227         (WebCore::WebGLRenderingContextBase::uniform3i):
228         (WebCore::WebGLRenderingContextBase::uniform4i):
229         (WebCore::WebGLRenderingContextBase::uniform1fv):
230         (WebCore::WebGLRenderingContextBase::uniform2fv):
231         (WebCore::WebGLRenderingContextBase::uniform3fv):
232         (WebCore::WebGLRenderingContextBase::uniform4fv):
233         (WebCore::WebGLRenderingContextBase::uniform1iv):
234         (WebCore::WebGLRenderingContextBase::uniform2iv):
235         (WebCore::WebGLRenderingContextBase::uniform3iv):
236         (WebCore::WebGLRenderingContextBase::uniform4iv):
237         (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
238         (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
239         (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
240         (WebCore::WebGLRenderingContextBase::vertexAttrib4f):
241         (WebCore::WebGLRenderingContextBase::vertexAttrib1fv):
242         (WebCore::WebGLRenderingContextBase::vertexAttrib2fv):
243         (WebCore::WebGLRenderingContextBase::vertexAttrib3fv):
244         (WebCore::WebGLRenderingContextBase::vertexAttrib4fv):
245         (WebCore::WebGLRenderingContextBase::validateUniformParameters):
246         (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
247         (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
248         * html/canvas/WebGLRenderingContextBase.h:
249         (WebCore::WebGLRenderingContextBase::TypedList::TypedList):
250         (WebCore::WebGLRenderingContextBase::TypedList::data):
251         (WebCore::WebGLRenderingContextBase::TypedList::length):
252         Re-order/group to match order in the IDL file. Remove overloads taking a pointer and 
253         length, and replace it by having the main function take a specialized TypedList. TypedList
254         allows the bindings to pass the correct Variant type, but then the code to only think in
255         terms of the data() and length() functions.
256
257         * html/canvas/WebGLRenderingContextBase.idl:
258         Remove [Custom] annotations and re-order/group to match the spec. Update types of uniform*fv/iv
259         functions to take typedef'd unions.
260
261 2017-01-10  Ryosuke Niwa  <rniwa@webkit.org>
262
263         :active and :hover states may not be updated across slots
264         https://bugs.webkit.org/show_bug.cgi?id=166881
265         <rdar://problem/29944582>
266
267         Reviewed by Antti Koivisto.
268
269         The bug was caused by updateHoverActiveState not updating :hover and :active states on elements
270         when nodes are assigned to slots because they were walking up the tree using parentOrShadowHostElement
271         and parentNode. Fixed the bug by using parentElementInComposedTree instead since :hover and :active
272         states need to be updated in accordance with the render tree, which is created from the "flat tree"
273         or the "composed tree" in WebKit's terminology (this is old terminology in the spec).
274
275         Tests: fast/shadow-dom/clear-active-state-in-shadow.html
276                fast/shadow-dom/hover-over-nested-slotted-content.html
277
278         * dom/Document.cpp:
279         (WebCore::Document::updateHoverActiveState): Fixed the bug.
280         * dom/Node.cpp:
281         (WebCore::Node::parentElementInComposedTree): Added.
282         * dom/Node.h:
283
284 2017-01-10  Keith Rollin  <krollin@apple.com>
285
286         Missing logging in IconLoader::startLoading
287         https://bugs.webkit.org/show_bug.cgi?id=166904
288
289         Reviewed by Sam Weinig.
290
291         The LOG_ERROR in startLoading references 'resourceRequest', which has
292         been WTF::Moved as part of a preceding function call. As such, the
293         logging statement doesn't print out a possibly useful URL. Fix this by
294         making a copy of the URL before it's affected by the Move.
295
296         No new tests -- change only affects logging code.
297
298         * loader/icon/IconLoader.cpp:
299         (WebCore::IconLoader::startLoading):
300
301 2017-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
302
303         Implement "proximity" scroll snapping
304         https://bugs.webkit.org/show_bug.cgi?id=135994
305         <rdar://problem/18162418>
306
307         Reviewed by Dean Jackson.
308
309         Adds support for proximity scroll snapping. To do this, we introduce scroll offset ranges, a list of scroll
310         offset ranges that are plumbed alongside the list of scroll snap offsets. Similar to a snap offset, a snap
311         offset range contains scroll offsets on which scrolling is allowed to come to a rest within a scroll snapping
312         container. However, unlike normal snap offsets, scrolling may only come to rest within a snap offset range if
313         the predicted scroll offset already lies within the range. The new algorithm for selecting a target scroll snap
314         position given a destination offset is now:
315
316         -   If the scroll destination lies within a snap offset range, return the scroll destination
317         -   Otherwise, compute the nearest lower/upper snap offsets and lower/upper snap offset ranges
318         -   If scrolling ended with no velocity, return the nearest snap offset
319         -   If scrolling ended with positive velocity, choose the upper snap offset only if there is no snap offset
320             range in between the scroll destination and the snap offset; else, choose the lower snap offset
321         -   If scrolling ended with negative velocity, choose the lower snap offset only if there is no snap offset
322             range in between the scroll destination and the snap offset; else, choose the upper snap offset
323
324         The extra rule accounting for scroll offset ranges in between the scroll destination and a potential snap offset
325         handles the corner case where the user scrolls with momentum very lightly away from a snap offset, such that the
326         predicted scroll destination is still within proximity of the snap offset. In this case, the regular (mandatory
327         scroll snapping) behavior would be to snap to the next offset in the direction of momentum scrolling, but
328         instead, it is more intuitive to return to the original snap position.
329
330         We also move scrolling prediction logic into ScrollingMomentumCalculator and adopt the platform
331         _NSScrollingMomentumCalculator's destinationOrigin property when computing the predicted scroll destination.
332         Previously, we were simply multiplying by an empirically-derived constant to approximate the scroll destination,
333         but now that we are supporting proximity scroll snapping, we need more exact scroll destinaton prediction in
334         order to make sure that scrolling to a snap offset range feels natural.
335
336         Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-then-proximity.html
337                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe.html
338                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-overflow.html
339
340         * WebCore.xcodeproj/project.pbxproj:
341         * page/scrolling/AsyncScrollingCoordinator.cpp:
342         (WebCore::setStateScrollingNodeSnapOffsetsAsFloat):
343         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
344         (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
345
346         Make boilerplate changes to plumb lists of horizontal and vertical snap offset ranges alongside the lists of
347         horizontal and vertical snap offsets.
348
349         * page/scrolling/AxisScrollSnapOffsets.cpp:
350         (WebCore::snapOffsetRangesToString):
351         (WebCore::indicesOfNearestSnapOffsetRanges):
352         (WebCore::indicesOfNearestSnapOffsets):
353         (WebCore::adjustAxisSnapOffsetsForScrollExtent):
354         (WebCore::computeAxisProximitySnapOffsetRanges):
355         (WebCore::updateSnapOffsetsForScrollableArea):
356         (WebCore::closestSnapOffset):
357
358         Adjust the snap offset selection algorithm to take snap offset ranges into account. See above for more details.
359         Additionally, augment snap offset update logic to emit snap offset ranges for proximity scroll snapping. To do
360         this, we run the following steps on the final list of processed snap offsets:
361         -   Compute the proximity distance, which (for now) is arbitrarily 0.3 * the length or width of the scroll snap
362             port, depending on whether scroll snapping is taking place in the X or Y axis.
363         -   For each pair of adjacent snap offsets, if they are more than 2 * proximity distance away from each other,
364             emit a snap offset range starting from (lower snap offset + proximity distance) and ending on (upper snap
365             offset + proximity distance).
366
367         * page/scrolling/AxisScrollSnapOffsets.h:
368         (WebCore::closestSnapOffset): Deleted.
369         * page/scrolling/ScrollSnapOffsetsInfo.h:
370
371         Introduce ScrollSnapOffsetsInfo, a struct which contains data relevant to scroll snapping. This includes
372         vertical and horizontal snap offsets, as well as vertical and horizontal snap offset ranges. Snap offset ranges
373         consist of a vector of ranges of scroll offsets.
374
375         * page/scrolling/ScrollingCoordinator.h:
376         * page/scrolling/ScrollingMomentumCalculator.cpp:
377         (WebCore::projectedInertialScrollDistance):
378         (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator):
379         (WebCore::ScrollingMomentumCalculator::setRetargetedScrollOffset):
380         (WebCore::ScrollingMomentumCalculator::predictedDestinationOffset):
381         (WebCore::ScrollingMomentumCalculator::create):
382         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
383         (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator):
384         (WebCore::BasicScrollingMomentumCalculator::linearlyInterpolatedOffsetAtProgress):
385         (WebCore::BasicScrollingMomentumCalculator::initializeInterpolationCoefficientsIfNecessary):
386         (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve):
387         * page/scrolling/ScrollingMomentumCalculator.h:
388         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffset):
389         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffsetDidChange):
390
391         Currently, the ScrollingMomentumCalculator is responsible for taking an initial position, initial velocity, and
392         target position and animating the scroll offset from the initial to target position. Now, we refactor the
393         ScrollingMomentumCalculator interface to no longer take a target offset upon initialization, and instead compute
394         the predicted scroll destination given initial position and velocity; clients of the ScrollingMomentumCalculator
395         then use this predicted scroll destination to compute a retargeted scroll offset and then call
396         setRetargetedScrollOffset on the calculator, which sets up an animation curve to the new retargeted offset. This
397         allows both the AppKit-based scrolling momentum calculator and platform-invariant momentum calculator to be used
398         interchangeably, while still allowing them to compute a destination offset from initial parameters of the
399         scroll.
400
401         * page/scrolling/ScrollingStateScrollingNode.cpp:
402         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
403         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsets):
404         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsets):
405         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsetRanges):
406         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsetRanges):
407         * page/scrolling/ScrollingStateScrollingNode.h:
408         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsets):
409         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsets):
410         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsetRanges):
411         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsetRanges):
412         * page/scrolling/ScrollingTreeScrollingNode.cpp:
413         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
414         (WebCore::ScrollingTreeScrollingNode::dumpProperties):
415         * page/scrolling/ScrollingTreeScrollingNode.h:
416         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets):
417         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets):
418         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges):
419         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges):
420
421         Add more boilerplate support for snap offset ranges.
422
423         * page/scrolling/mac/ScrollingMomentumCalculatorMac.h:
424         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
425         (WebCore::ScrollingMomentumCalculator::create):
426         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
427         (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac):
428         (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime):
429         (WebCore::ScrollingMomentumCalculatorMac::predictedDestinationOffset):
430         (WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange):
431         (WebCore::ScrollingMomentumCalculatorMac::animationDuration):
432         (WebCore::ScrollingMomentumCalculatorMac::requiresMomentumScrolling):
433         (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator):
434
435         Hook into AppKit momentum scroll offset prediction.
436
437         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
438         (WebCore::convertToLayoutUnits):
439         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
440         * platform/ScrollableArea.cpp:
441         (WebCore::ScrollableArea::ensureSnapOffsetsInfo):
442         (WebCore::ScrollableArea::horizontalSnapOffsets):
443         (WebCore::ScrollableArea::horizontalSnapOffsetRanges):
444         (WebCore::ScrollableArea::verticalSnapOffsetRanges):
445         (WebCore::ScrollableArea::verticalSnapOffsets):
446         (WebCore::ScrollableArea::setHorizontalSnapOffsets):
447         (WebCore::ScrollableArea::setVerticalSnapOffsets):
448         (WebCore::ScrollableArea::setHorizontalSnapOffsetRanges):
449         (WebCore::ScrollableArea::setVerticalSnapOffsetRanges):
450         (WebCore::ScrollableArea::clearHorizontalSnapOffsets):
451         (WebCore::ScrollableArea::clearVerticalSnapOffsets):
452         * platform/ScrollableArea.h:
453         (WebCore::ScrollableArea::horizontalSnapOffsets): Deleted.
454         (WebCore::ScrollableArea::verticalSnapOffsets): Deleted.
455         * platform/cocoa/ScrollController.h:
456         * platform/cocoa/ScrollController.mm:
457         (WebCore::ScrollController::processWheelEventForScrollSnap):
458
459         Fix an issue where initial scrolling velocity would be set to zero at the end of a drag gesture.
460
461         (WebCore::ScrollController::updateScrollSnapState):
462         (WebCore::ScrollController::updateScrollSnapPoints):
463         (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
464         * platform/cocoa/ScrollSnapAnimatorState.h:
465         (WebCore::ScrollSnapAnimatorState::snapOffsetsForAxis):
466         (WebCore::ScrollSnapAnimatorState::snapOffsetRangesForAxis):
467         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsAndPositionRangesForAxis):
468         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsForAxis): Deleted.
469         * platform/cocoa/ScrollSnapAnimatorState.mm:
470         (WebCore::ScrollSnapAnimatorState::setupAnimationForState):
471         (WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset):
472         (WebCore::projectedInertialScrollDistance): Deleted.
473         * rendering/RenderLayerCompositor.cpp:
474         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
475         * testing/Internals.cpp:
476         (WebCore::Internals::setPlatformMomentumScrollingPredictionEnabled):
477
478         Add a new hook for layout tests to force scrolling momentum calculators to use the platform-invariant momentum
479         scrolling prediction heuristic instead of the platform-dependent one.
480
481         (WebCore::Internals::scrollSnapOffsets):
482         * testing/Internals.h:
483         * testing/Internals.idl:
484
485 2017-01-10  Chris Dumez  <cdumez@apple.com>
486
487         Make Event.initEvent()'s first parameter mandatory
488         https://bugs.webkit.org/show_bug.cgi?id=166894
489
490         Reviewed by Alex Christensen.
491
492         Make Event.initEvent()'s first parameter mandatory. As per the
493         specification, all parameters should be mandatory and we are
494         currently dicussing the possibility of making them optional in
495         the specification. However, having the first parameter optional
496         makes little sense as it would set the event's type to the string
497         "undefined".
498
499         Test: fast/events/initEvent-parameters.html
500
501         * dom/Event.idl:
502
503 2017-01-10  Commit Queue  <commit-queue@webkit.org>
504
505         Unreviewed, rolling out r210537.
506         https://bugs.webkit.org/show_bug.cgi?id=166903
507
508         This change introduced JSC test failures (Requested by
509         ryanhaddad on #webkit).
510
511         Reverted changeset:
512
513         "Implement JSSourceCode to propagate SourceCode in module
514         pipeline"
515         https://bugs.webkit.org/show_bug.cgi?id=166861
516         http://trac.webkit.org/changeset/210537
517
518 2017-01-10  Chris Dumez  <cdumez@apple.com>
519
520         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
521         https://bugs.webkit.org/show_bug.cgi?id=166876
522         <rdar://problem/29939970>
523
524         Reviewed by Ryosuke Niwa.
525
526         Add a code comment to clarify fix that was made in r210536.
527
528         * html/ImageDocument.cpp:
529         (WebCore::ImageDocument::createDocumentStructure):
530
531 2017-01-10  Jer Noble  <jer.noble@apple.com>
532
533         Add support for MediaKeys.generateRequest().
534         https://bugs.webkit.org/show_bug.cgi?id=166880
535
536         Reviewed by Xabier Rodriguez-Calvar.
537
538         Test: media/encrypted-media/mock-MediaKeySession-generateRequest.html
539
540         Implement MediaKeySession::generateRequest(). This requires some additions
541         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
542         implement mock support for testing. Additionally, add an InitDataRegistry
543         object which can sanitize and extract key data from various initData types.
544         (At the moment, only the "keyids" initData type is implemented.)
545
546         Drive-by fixes: Change all instances of initDataType from String -> AtomicString.
547         Add "const" flags to all CDMPrivate methods that might be called from a const
548         reference.
549
550         * CMakeLists.txt:
551         * Modules/encryptedmedia/CDM.cpp:
552         (WebCore::CDM::supportsInitDataType):
553         (WebCore::CDM::sanitizeInitData):
554         (WebCore::CDM::supportsInitData):
555         * Modules/encryptedmedia/CDM.h:
556         * Modules/encryptedmedia/CDMInstance.h:
557         * Modules/encryptedmedia/CDMPrivate.h:
558         * Modules/encryptedmedia/InitDataRegistry.cpp: Added.
559         (WebCore::extractKeyIDsKeyids):
560         (WebCore::sanitizeKeyids):
561         (WebCore::sanitizeCenc):
562         (WebCore::extractKeyIDsCenc):
563         (WebCore::sanitizeWebM):
564         (WebCore::extractKeyIDsWebM):
565         (WebCore::InitDataRegistry::shared):
566         (WebCore::InitDataRegistry::InitDataRegistry):
567         (WebCore::InitDataRegistry::sanitizeInitData):
568         (WebCore::InitDataRegistry::extractKeyIDs):
569         (WebCore::InitDataRegistry::registerInitDataType):
570         * Modules/encryptedmedia/InitDataRegistry.h:
571         * Modules/encryptedmedia/MediaKeySession.cpp:
572         (WebCore::messageEventName):
573         (WebCore::MediaKeySession::MediaKeySession):
574         (WebCore::MediaKeySession::generateRequest):
575         (WebCore::MediaKeySession::enqueueMessage):
576         * Modules/encryptedmedia/MediaKeySession.h:
577         * Modules/encryptedmedia/MediaKeys.cpp:
578         (WebCore::MediaKeys::setServerCertificate):
579         * WebCore.xcodeproj/project.pbxproj:
580         * testing/MockCDMFactory.cpp:
581         (WebCore::MockCDMFactory::addKeysToSessionWithID):
582         (WebCore::MockCDMFactory::setSupportedDataTypes):
583         (WebCore::MockCDM::supportsInitDataType):
584         (WebCore::MockCDM::supportsConfiguration):
585         (WebCore::MockCDM::supportsConfigurationWithRestrictions):
586         (WebCore::MockCDM::supportsSessionTypeWithConfiguration):
587         (WebCore::MockCDM::supportsRobustness):
588         (WebCore::MockCDM::distinctiveIdentifiersRequirement):
589         (WebCore::MockCDM::persistentStateRequirement):
590         (WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable):
591         (WebCore::MockCDM::supportsInitData):
592         (WebCore::MockCDMInstance::setServerCertificate):
593         (WebCore::MockCDMInstance::requestLicense):
594         * testing/MockCDMFactory.h:
595         (WebCore::MockCDMFactory::supportedDataTypes):
596         (WebCore::MockCDMFactory::hasSessionWithID):
597         (WebCore::MockCDMFactory::removeSessionWithID):
598         (WebCore::MockCDMFactory::setSupportedDataTypes): Deleted.
599
600 2017-01-10  Jer Noble  <jer.noble@apple.com>
601
602         Add support for MediaKeys.createSession().
603         https://bugs.webkit.org/show_bug.cgi?id=166796
604
605         Reviewed by Eric Carlson.
606
607         Test: media/encrypted-media/mock-MediaKeys-createSession.html
608
609         Implement MediaKeys::createSession(). This requires some additions to
610         CDM, CDMPrivate, and CDMInstance to support platform adoption and to
611         implement mock support for testing. Because the CDMInstance will now
612         be shared between MediaKeys and MediaKeySession, it cannot be a unique_ptr.
613         Make CDMInterface ref-counted and store it as a Ref.
614
615         * Modules/encryptedmedia/CDM.cpp:
616         (WebCore::CDM::createInstance):
617         (WebCore::CDM::supportsSessions):
618         * Modules/encryptedmedia/CDM.h:
619         * Modules/encryptedmedia/CDMInstance.h:
620         * Modules/encryptedmedia/CDMPrivate.h:
621         * Modules/encryptedmedia/MediaKeySession.cpp:
622         (WebCore::MediaKeySession::create):
623         (WebCore::MediaKeySession::MediaKeySession):
624         (WebCore::MediaKeySession::sessionId):
625         (WebCore::MediaKeySession::expiration):
626         (WebCore::MediaKeySession::keyStatuses):
627         * Modules/encryptedmedia/MediaKeySession.h:
628         * Modules/encryptedmedia/MediaKeySessionType.idl:
629         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
630         (WebCore::MediaKeySystemAccess::createMediaKeys):
631         * Modules/encryptedmedia/MediaKeys.cpp:
632         (WebCore::MediaKeys::MediaKeys):
633         (WebCore::MediaKeys::createSession):
634         * Modules/encryptedmedia/MediaKeys.h:
635         (WebCore::MediaKeys::create):
636         * Modules/encryptedmedia/MediaKeys.idl:
637
638 2017-01-10  Jer Noble  <jer.noble@apple.com>
639
640         Add support for MediaKeys.setServerCertificate()
641         https://bugs.webkit.org/show_bug.cgi?id=166772
642
643         Reviewed by Darin Adler.
644
645         Test: media/encrypted-media/mock-MediaKeys-setServerCertificate.html
646
647         Implement MediaKeys::setServerCertificate(). This requires some additions
648         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
649         implement mock support for testing.
650
651         * Modules/encryptedmedia/CDM.cpp:
652         (WebCore::CDM::supportsServerCertificates):
653         * Modules/encryptedmedia/CDM.h:
654         * Modules/encryptedmedia/CDMInstance.h:
655         * Modules/encryptedmedia/CDMPrivate.h:
656         * Modules/encryptedmedia/MediaKeys.cpp:
657         (WebCore::MediaKeys::setServerCertificate):
658         * Modules/encryptedmedia/MediaKeys.h:
659         * testing/MockCDMFactory.cpp:
660         (WebCore::MockCDM::supportsServerCertificates):
661         (WebCore::MockCDMInstance::setServerCertificate):
662         * testing/MockCDMFactory.h:
663         (WebCore::MockCDMFactory::supportsServerCertificates):
664         (WebCore::MockCDMFactory::setSupportsServerCertificates):
665         * testing/MockCDMFactory.idl:
666
667 2017-01-10  Youenn Fablet  <youenn@apple.com>
668
669         CachedScript cloning does not clone encodedSize
670         https://bugs.webkit.org/show_bug.cgi?id=166865
671
672         Reviewed by Darin Adler.
673
674         Covered by updated test.
675
676         * loader/cache/CachedResource.cpp:
677         (WebCore::CachedResource::setBodyDataFrom): set encoded size based on being cloned resource.
678         * loader/cache/CachedScript.cpp:
679         (WebCore::CachedScript::script):
680         (WebCore::CachedScript::setBodyDataFrom): Making use of CachedResource::setBodyDataFrom for complete cloning.
681
682 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
683
684         Unreviewed. Remove the unused gReadyStateTimerInterval global from
685         the MediaPlayerPrivateGStreamerMSE implementation file as it's only
686         springing up a compiler warning.
687
688         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
689
690 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
691
692         [CoordinatedGraphics] TextureMapperPlatformLayerProxy is constantly getting activated
693         https://bugs.webkit.org/show_bug.cgi?id=166856
694
695         Reviewed by Michael Catanzaro.
696
697         When CoordinatedGraphicsLayer::setContentsNeedsDisplay() is called, currently with
698         the threaded CoordinatedGraphics mode the platform layer is marked for synchronizing.
699         This means that at flush-time this layer swaps the buffer of the wrapped platform
700         layer and updates the layer state to indicate that the underlying
701         TextureMapperPlatformLayerProxy object has to be activated on the composition thread.
702
703         This current logic results in the TextureMapperPlatformLayerProxy object being
704         reactivated for every display request that arrives via setContentsNeedsDisplay().
705         This is pretty wasteful since this activation heap-allocates a RunLoop::Timer object
706         which internally also locks up the GLib main context to attach a new source, and
707         that's only after the source on the previous RunLoop::Timer was detached before
708         that RunLoop::Timer was destroyed.
709
710         To avoid this, CoordinatedGraphicsLayer::setContentsNeedsDisplay() sets a new flag,
711         m_shouldUpdatePlatformLayer. During flush, this flag is checked in
712         CoordinatedGraphicsLayer::updatePlatformLayer(), with the buffer swap performed in
713         case it's set. CoordinatedGraphicsLayer::syncPlatformLayer() now only sets the
714         platform layer proxy object for that layer's state.
715
716         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
717         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
718         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
719         (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
720         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
721         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
722         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
723
724 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
725
726         [TexMap] Use WTF::Function in TextureMapperPlatformLayerProxy
727         https://bugs.webkit.org/show_bug.cgi?id=166853
728
729         Reviewed by Michael Catanzaro.
730
731         Use WTF::Function in the TextureMapperPlatformLayerProxy, instead of
732         the std::function bloat.
733
734         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
735         (WebCore::TextureMapperPlatformLayerProxy::scheduleUpdateOnCompositorThread):
736         (WebCore::TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired):
737         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
738
739 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
740
741         [TextureMapper] TextureMapperPlatformLayerProxy::swapBuffers() should hold the lock throughout invocation
742         https://bugs.webkit.org/show_bug.cgi?id=166852
743
744         Reviewed by Michael Catanzaro.
745
746         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
747         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer): Append to previous buffer
748         to the m_usedBuffers Vector while the object's lock is held. Everywhere else the
749         m_usedBuffers Vector is used under the lock, no reason to not do the same here.
750
751 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
752
753         Implement JSSourceCode to propagate SourceCode in module pipeline
754         https://bugs.webkit.org/show_bug.cgi?id=166861
755
756         Reviewed by Saam Barati.
757
758         Now SourceOrigin is correctly propagated through the module pipeline.
759         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
760         is updated.
761
762         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
763         * bindings/js/JSDOMPromise.h:
764         (WebCore::DeferredPromise::resolveWithCallback):
765         * bindings/js/ScriptModuleLoader.cpp:
766         (WebCore::ScriptModuleLoader::notifyFinished):
767
768 2017-01-09  Chris Dumez  <cdumez@apple.com>
769
770         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
771         https://bugs.webkit.org/show_bug.cgi?id=166876
772         <rdar://problem/29939970>
773
774         Reviewed by Tim Horton.
775
776         ImageDocument title no longer included the size of the image after r189555.
777         This is because Document::setTitle() is a no-op if the document does not
778         have a <head> element. To address the issue, we now include a <head>
779         element in ImageDocuments so that their title element properly gets added
780         to it.
781
782         Test: fast/images/imageDocument-title.html
783
784         * html/ImageDocument.cpp:
785         (WebCore::ImageDocument::createDocumentStructure):
786
787 2017-01-09  Zalan Bujtas  <zalan@apple.com>
788
789         ASSERTION FAILED: newLogicalTop >= logicalTop in WebCore::RenderBlockFlow::getClearDelta
790         https://bugs.webkit.org/show_bug.cgi?id=151202
791         <rdar://problem/27711822>
792
793         Reviewed by Myles C. Maxfield.
794
795         FindNextFloatLogicalBottomAdapter uses LayoutUnit::max() to flag m_nextLogicalBottom uninitialized.        
796         However LayoutUnit::max() can also be a valid value for m_nextLogicalBottom.
797         FindNextFloatLogicalBottomAdapter::nextLogicalBottom() returns 0 instead of the actual value when
798         it sees m_nextLogicalBottom uninitialized. In certain cases, it confuses the caller and we end up
799         with a runaway loop.
800
801         Test: fast/block/float/assert-when-line-has-not-enough-space-left.html
802
803         * rendering/FloatingObjects.cpp:
804         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
805         (WebCore::FindNextFloatLogicalBottomAdapter::highValue):
806         (WebCore::FindNextFloatLogicalBottomAdapter::nextLogicalBottom):
807         (WebCore::FindNextFloatLogicalBottomAdapter::nextShapeLogicalBottom):
808         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
809
810 2017-01-09  Ryan Haddad  <ryanhaddad@apple.com>
811
812         Unreviewed, rolling out r210531.
813
814         This change broke the 32-bit macOS build and caused LayoutTest
815         failures.
816
817         Reverted changeset:
818
819         "File scheme should not allow access of a resource on a
820         different volume."
821         https://bugs.webkit.org/show_bug.cgi?id=158552
822         http://trac.webkit.org/changeset/210531
823
824 2017-01-09  Chris Dumez  <cdumez@apple.com>
825
826         [iOS] Drop VNodeTracker
827         https://bugs.webkit.org/show_bug.cgi?id=166868
828         <rdar://problem/29937587>
829
830         Reviewed by Andreas Kling.
831
832         Drop VNodeTracker on iOS. This was introduced a while back to try and
833         address vnode exhaustion issues in long running page load tests.
834         However, there was no evidence that the VNodeTracker functionality
835         helped so there is little point in keeping the extra code complexity.
836
837         * WebCore.xcodeproj/project.pbxproj:
838         * platform/SharedBuffer.h:
839         * platform/VNodeTracker.cpp: Removed.
840         * platform/VNodeTracker.h: Removed.
841         * platform/cf/SharedBufferCF.cpp:
842         (WebCore::SharedBuffer::SharedBuffer):
843         * platform/cocoa/VNodeTrackerCocoa.cpp: Removed.
844
845 2017-01-09  Brent Fulgham  <bfulgham@apple.com>
846
847         File scheme should not allow access of a resource on a different volume.
848         https://bugs.webkit.org/show_bug.cgi?id=158552
849         <rdar://problem/15307582>
850
851         Reviewed by Alex Christensen.
852
853         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
854         on a different storage device (volume) unless universal access is enabled.
855
856         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
857         where the device changes in the midst of a load.
858
859         Also properly reflect that SecurityOrigin is never null by passing as a reference,
860         rather than as a pointer.
861
862         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
863
864         * page/SecurityOrigin.cpp:
865         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
866         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
867         the same storage volume.
868         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
869         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
870         * page/SecurityOrigin.h:
871         * platform/FileSystem.cpp:
872         (WebCore::filesHaveSameVolume): Added.
873         * platform/FileSystem.h:
874         * platform/network/cocoa/ResourceRequestCocoa.mm:
875         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
876         the storage device at the time of the start of the load so we can trigger a failure if this
877         changes during the load operation.
878         * platform/posix/FileSystemPOSIX.cpp:
879         (WebCore::getFileDeviceId): Added.
880         * platform/win/FileSystemWin.cpp:
881         (WebCore::getFileDeviceId): Added.
882
883 2017-01-09  Tim Horton  <timothy_horton@apple.com>
884
885         Unindenting text inside a blockquote can result in the text being reordered
886         https://bugs.webkit.org/show_bug.cgi?id=166813
887
888         Reviewed by Darin Adler and Ryosuke Niwa.
889
890         Test: editing/execCommand/unindent-nested-blockquote-with-inner-div.html
891
892         * editing/IndentOutdentCommand.cpp:
893         (WebCore::IndentOutdentCommand::outdentParagraph):
894         Start splitting the tree at the beginning of the content being unindented,
895         not at the containing block flow element, which could e.g. contain other
896         elements (or even other blockquotes).
897
898 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
899
900         [JSC] Prototype dynamic-import
901         https://bugs.webkit.org/show_bug.cgi?id=165724
902
903         Reviewed by Saam Barati.
904
905         We do not set a handler for import for now.
906         So dynamic import feature is only enabled in the JSC shell right now.
907
908         * bindings/js/JSDOMWindowBase.cpp:
909         * bindings/js/JSWorkerGlobalScopeBase.cpp:
910
911 2017-01-09  Youenn Fablet  <youennf@gmail.com>
912
913         Merging ThreadableLoader redundant options on filtering responses
914
915         Merge OpaqueResponseBodyPolicy and ResponseFilteringPolicy ThreadableLoader options
916         https://bugs.webkit.org/show_bug.cgi?id=166843
917
918         Reviewed by Darin Adler.
919
920         Covered by existing tests.
921
922         Removing OpaqueResponseBodyPolicy option.
923         When ResponseFilteringPolicy is set to Enable, the body is filtered out in DocumentThreadableLoader.
924
925         * Modules/fetch/FetchLoader.cpp:
926         (WebCore::FetchLoader::start):
927         * loader/DocumentThreadableLoader.cpp:
928         (WebCore::DocumentThreadableLoader::didReceiveResponse): Implementing body filtering based on ResponseFilteringPolicy option.
929         * loader/ThreadableLoader.cpp:
930         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
931         * loader/ThreadableLoader.h:
932         * loader/WorkerThreadableLoader.cpp:
933         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
934         * workers/WorkerScriptLoader.cpp:
935         (WebCore::WorkerScriptLoader::loadSynchronously):
936         (WebCore::WorkerScriptLoader::loadAsynchronously):
937         * xml/XMLHttpRequest.cpp:
938         (WebCore::XMLHttpRequest::createRequest):
939
940 2017-01-09  Daniel Bates  <dabates@apple.com>
941
942         Evaluating window named element may return wrong result
943         https://bugs.webkit.org/show_bug.cgi?id=166792
944         <rdar://problem/29801059>
945
946         Reviewed by Chris Dumez.
947
948         * bindings/js/JSDOMWindowProperties.cpp:
949         (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter):
950
951 2017-01-09  Chris Dumez  <cdumez@apple.com>
952
953         REGRESSION(r178955): Touching Settings.in doesn't cause JSInternalSettingsGenerated.cpp to be updated on first build
954         https://bugs.webkit.org/show_bug.cgi?id=166814
955
956         Reviewed by Darin Adler.
957
958         Stop using .INTERMEDIATE in DerivedSources.make was it seems to break dependency
959         chains for some reason. We started using .INTERMEDIATE for scripts that generate
960         several targets when run a single time. It avoided running the script several
961         times (once per target) unnecessarily, and fixed issues with parallel builds.
962
963         To address the same issue without using .INTERMEDIATE, we now use pattern rules
964         (i.e. rules that have '%'). As per the documentation [1]:
965         "Pattern rules may have more than one target. Unlike normal rules, this does not
966          act as many different rules with the same prerequisites and recipe. If a pattern
967          rule has multiple targets, make knows that the rule’s recipe is responsible for
968          making all of the targets. The recipe is executed only once to make all the
969          targets".
970
971          We are therefore solving the same problem as with .INTERMEDIATE. However, I have
972          confirmed that using pattern rules does not break dependency chains. For example,
973          modifying Settings.in re-generates both InternalSettingsGenerated.idl *and*
974          JSInternalSettingsGenerated.cpp.
975
976          [1] https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html#Pattern-Intro
977
978         * DerivedSources.make:
979
980 2017-01-09  Commit Queue  <commit-queue@webkit.org>
981
982         Unreviewed, rolling out r210493 and r210495.
983         https://bugs.webkit.org/show_bug.cgi?id=166842
984
985         Causes makeprops.pl to run on every build (Requested by smfr
986         on #webkit).
987
988         Reverted changesets:
989
990         "Avoid triggering rebuilds for minor changes of
991         CSSProperties.json"
992         https://bugs.webkit.org/show_bug.cgi?id=166810
993         http://trac.webkit.org/changeset/210493
994
995         "Avoid triggering rebuilds for minor changes of
996         CSSProperties.json"
997         https://bugs.webkit.org/show_bug.cgi?id=166810
998         http://trac.webkit.org/changeset/210495
999
1000 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1001
1002         [GTK] Should support key and code properties on keyboard events
1003         https://bugs.webkit.org/show_bug.cgi?id=166759
1004
1005         Reviewed by Carlos Garcia Campos.
1006
1007         This change fixes a bunch of tests which are currently failing, such as:
1008         - fast/events/arrow-keys-on-body.html
1009         - fast/events/constructors/keyboard-event-constructor.html
1010         - fast/events/key-events-in-input-button.html
1011         - fast/events/key-events-in-input-text.html
1012         - fast/events/keyboardevent-code.html
1013         - fast/events/keyboardevent-key.html
1014
1015         * platform/PlatformKeyboardEvent.h:
1016         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1017         (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): match web key value
1018         to GDK key symbol.
1019         (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): match web key code
1020         to hardware code as reported by GDK.
1021         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): add web key value and
1022         code to the keyboard event upon creation.
1023
1024 2017-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1025
1026         [GTK] WebProcess from WebKitGtk+ 2.15.2 SIGSEGVs in std::unique_ptr<SoupBuffer, WTF::GPtrDeleter<SoupBuffer> >::get() const () at /usr/include/c++/6/bits/unique_ptr.h:305
1027         https://bugs.webkit.org/show_bug.cgi?id=165848
1028
1029         Reviewed by Michael Catanzaro.
1030
1031         In r208881 several locks were added to ImageDecoder to prevent frameBufferAtIndex() from being called by multiple
1032         threads at the same time, but I forgot isSizeAvailable() also calls frameBufferAtIndex(). However, what we
1033         really need to protect is the GIFImageDecoder, to never allow decoding from more than one thread at the same
1034         time. This patch reverts r208881 and adds a lock to GIFImageDecoder::decode() instead.
1035
1036         * platform/image-decoders/ImageDecoder.cpp:
1037         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
1038         (WebCore::ImageDecoder::frameDurationAtIndex):
1039         (WebCore::ImageDecoder::createFrameImageAtIndex):
1040         * platform/image-decoders/ImageDecoder.h:
1041         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1042         (WebCore::GIFImageDecoder::decode):
1043         * platform/image-decoders/gif/GIFImageDecoder.h:
1044
1045 2017-01-09  Alejandro G. Castro  <alex@igalia.com>
1046
1047         [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
1048         https://bugs.webkit.org/show_bug.cgi?id=165316
1049
1050         Reviewed by Philippe Normand.
1051
1052         Fixed the ended support of the video element in the OWR player and
1053         fixed the videoTracks support. Now the OW player properly adds and
1054         removes the audio and video tracks. Added the getSettings support
1055         to the mediastream interface. Solved also the size handling in
1056         some of the enable/muted situations.
1057
1058         Unskipping fast/mediastream/MediaStream-video-element-track-stop.html.
1059
1060         * platform/GStreamer.cmake: Added the new
1061         RealtimeMediaSourceOwr.cpp with the new code handling the
1062         settings.
1063         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
1064         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
1065         Release the new video and audio maps that creates a relationship
1066         of the mediastream tracks with the mediatracks of the video element.
1067         (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to
1068         false when we start playing.
1069         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media
1070         tracks to the player so that the videoTracks API returns it, and
1071         add an entry in the map to be able to restore it using the
1072         mediastream track.
1073         (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks):
1074         Move some part of the stop function to this one in order to use it
1075         in pause method and avoid changing the video selection in that
1076         case.
1077         (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the
1078         function disableMediaTracks and we also change teh selected
1079         videoTrack.
1080         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For
1081         videoTrack reset the size and the selected element. In case there
1082         is no media playing we Make sure we set the ended variable to true
1083         and call the timeChange to modify the state of the player.
1084         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
1085         Handle properly the situation when the user changed the enabled
1086         value, we disable the media.
1087         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Modify the
1088         size of the source.
1089         (WebCore::MediaPlayerPrivateGStreamerOwr::naturalSize): Overrided
1090         to make sure we return a size even when the sample is not ready
1091         for gst.
1092         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
1093         Added the ended attribute and the maps.
1094         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
1095         (WebCore::MediaEndpointOwr::createMutedRemoteSource): Use the new
1096         realtime video and audio sources classes, this new classes
1097         implement the settings of each type of media element.
1098         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1099         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
1100         Use the new audio and video source classes instead of the general
1101         one in order to handle the settings properly.
1102         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Added
1103         (WebCore::RealtimeMediaSourceOwr::settings): Initialize using the
1104         subclass and return the new currentSettings attribute.
1105         (WebCore::RealtimeMediaSourceOwr::supportedConstraints): Call the
1106         subclass initialization of the supportedSettings.
1107         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
1108         (WebCore::RealtimeMediaSourceOwr::initializeSettings): Added to
1109         initialize the settings before returning the value. Implemented in
1110         the subclass.
1111         (WebCore::RealtimeMediaSourceOwr::initializeSupportedConstraints):
1112         Added to initialize the supported settings of the
1113         media. Implemented in the subclass.
1114         (WebCore::RealtimeMediaSourceOwr::settings): Moved to the cpp
1115         file, implemented using the initialize functions of the subclass
1116         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Added
1117         this new class to handle the settings of the video elements. The
1118         class initializes the settings and the supportedSettings.
1119         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Added
1120         this new class to handle the settings of the audio elements. The
1121         class initializes the settings and the supportedSettings.
1122
1123
1124 2017-01-08  Konstantin Tokarev  <annulen@yandex.ru>
1125
1126         Introduce CPU(X86_SSE2) instead of various SSE2 checks
1127         https://bugs.webkit.org/show_bug.cgi?id=166808
1128
1129         Reviewed by Michael Catanzaro.
1130
1131         Now copyLCharsFromUCharSource can use SSE2 implementation on non-Darwin
1132         OSes, and all SSE2 code paths are available for MSVC on x86 if /arch:SSE2
1133         or higher is enabled, and for MSVC on x86_64.
1134
1135         No new tests needed.
1136
1137         * platform/audio/SincResampler.cpp:
1138         (WebCore::SincResampler::process):
1139         * platform/audio/VectorMath.cpp:
1140         (WebCore::VectorMath::vsma):
1141         (WebCore::VectorMath::vsmul):
1142         (WebCore::VectorMath::vadd):
1143         (WebCore::VectorMath::vmul):
1144         (WebCore::VectorMath::zvmul):
1145         (WebCore::VectorMath::vsvesq):
1146         (WebCore::VectorMath::vmaxmgv):
1147
1148 2017-01-07  Simon Fraser  <simon.fraser@apple.com>
1149
1150         Avoid triggering rebuilds for minor changes of CSSProperties.json
1151         https://bugs.webkit.org/show_bug.cgi?id=166810
1152
1153         Post-review cleanup suggested by Darin Adler.
1154
1155         * css/makeprop.pl:
1156
1157 2017-01-07  Simon Fraser  <simon.fraser@apple.com>
1158
1159         Avoid triggering rebuilds for minor changes of CSSProperties.json
1160         https://bugs.webkit.org/show_bug.cgi?id=166810
1161
1162         Reviewed by Daniel Bates.
1163
1164         We expect to make lots of metadata-related changes to CSSProperties.json, and
1165         these should not trigger rebuilds.
1166         
1167         Have makeprop.pl write to temporary files first, then only replace the generated
1168         files if the contents differ.
1169
1170         * css/makeprop.pl:
1171         (replaceFileIfChanged):
1172
1173 2017-01-06  Darin Adler  <darin@apple.com>
1174
1175         Remove PassRefPtr use from "inspector", "platform/sql", and "platform/text"
1176         https://bugs.webkit.org/show_bug.cgi?id=166797
1177
1178         Reviewed by Alex Christensen.
1179
1180         * Modules/webdatabase/Database.cpp:
1181         (WebCore::Database::performOpenAndVerify): Pass a reference instead of a pointer.
1182
1183         * dom/Document.cpp:
1184         (WebCore::canonicalizedTitle): Map backslashes to currency symbols inside the
1185         existing loop through the characters instead of calling a function confusingly
1186         named "displayBuffer" to do it. More straightforward, possibly more efficient,
1187         one less function.
1188         (WebCore::Document::displayStringModifiedByEncoding): Call replace to map
1189         backslashes to currency symbols instead of calling a special displayString
1190         function. There was no real benefit to using that function; the String::replace
1191         function has all the same optimizations, and this was also the only call site.
1192
1193         * editing/SpellChecker.cpp:
1194         (WebCore::SpellChecker::invokeRequest): Pass a reference instead of a pointer.
1195
1196         * inspector/InspectorOverlay.cpp:
1197         (WebCore::InspectorOverlay::overlayPage): Call createEmptyEditorClient instead
1198         of using the class EmptyEditorClient directly.
1199
1200         * loader/EmptyClients.cpp: Moved most of the empty clients here from the header.
1201         Also made lots more things private.
1202         (WebCore::createEmptyEditorClient): Added.
1203         (WebCore::emptyDiagnosticLoggingClient): Added.
1204         * loader/EmptyClients.h: Updated for above changes. Made more things private.
1205
1206         * page/DatabaseProvider.h: Removed unneeded include.
1207         * page/MainFrame.cpp: Ditto.
1208
1209         * page/Page.cpp:
1210         (WebCore::Page::diagnosticLoggingClient): Call emptyDiagnosticLoggingClient
1211         instead of using the class EmptyDiagnosticLoggingClient directly.
1212
1213         * platform/sql/SQLiteDatabase.cpp:
1214         (WebCore::SQLiteDatabase::setAuthorizer): Take a reference instead of a
1215         PassRefPtr.
1216         * platform/sql/SQLiteDatabase.h: Updated for above.
1217
1218         * platform/text/BidiContext.cpp:
1219         (WebCore::BidiContext::BidiContext): Moved this function here from the header.
1220         (WebCore::copyContextAndRebaselineLevel): Return a Ref instead of a PassRefPtr,
1221         and take a reference rather than a raw pointer.
1222         (WebCore::BidiContext::copyStackRemovingUnicodeEmbeddingContexts): Return a
1223         Ref instead of a PassRefPtr.
1224         * platform/text/BidiContext.h: Updated for the above changes.
1225
1226         * platform/text/BidiResolver.h: Simplify initialization, use more references,
1227         auto, modern for loops, refer to derived class as that rather than the non-C++
1228         term subclass.
1229
1230         * platform/text/TextCheckerClient.h: Changd argument from PassRefPtr to a
1231         reference.
1232
1233         * platform/text/TextEncoding.h:
1234         (WebCore::TextEncoding::displayString): Deleted.
1235         (WebCore::TextEncoding::displayBuffer): Deleted.
1236
1237         * rendering/RootInlineBox.cpp: Style tweaks and use a modern for loop.
1238
1239         * svg/graphics/SVGImage.cpp:
1240         (WebCore::SVGImage::dataChanged): Call createEmptyEditorClient instead
1241         of using the class EmptyEditorClient directly.
1242
1243 2017-01-07  Andy Estes  <aestes@apple.com>
1244
1245         [QuickLook] Update quicklook test expectations
1246         https://bugs.webkit.org/show_bug.cgi?id=166798
1247         <rdar://problem/26477735>
1248
1249         Reviewed by Alex Christensen.
1250
1251         QuickLook uses UUIDs to generate x-apple-ql-id: URLs, so they will differ each time a
1252         document is previewed. Since these URLs are included in QuickLook layout test results,
1253         WebArchiveDumpSupport needs to replace them with predictable values when dumping a web
1254         archive.
1255
1256         * testing/cocoa/WebArchiveDumpSupport.mm:
1257         (WebCoreTestSupport::quickLookURLReplacements): Created a static Vector of CFStringRef pairs
1258         to store x-apple-ql-id: URLs and their replacement values.
1259         (WebCoreTestSupport::normalizeWebResourceURL): If the URL starts with “x-apple-ql-id://”,
1260         replace the text between the scheme and the file extension with “resource”. Store the
1261         original URL along with its replacement in quickLookURLReplacements().
1262         (WebCoreTestSupport::createXMLStringFromWebArchiveData): Replaced all QuickLook URLs in the
1263         final XML text with their replacement URLs. 
1264
1265 2017-01-07  Andy Estes  <aestes@apple.com>
1266
1267         [QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
1268         https://bugs.webkit.org/show_bug.cgi?id=166713
1269
1270         Reviewed by Alex Christensen.
1271
1272         QuickLook conversion was originally implemented by intercepting document loads at the
1273         ResourceHandle level, with separate paths for NSURLConnection and CFURLConnection handles.
1274         When QuickLook was ported to WebKit2, a third path was added in WebResourceLoader.
1275         
1276         This change removes these three separate paths and implements a single conversion path in
1277         SubresourceLoader, where QuickLook can intercept document loads regardless of the networking
1278         API being used.
1279
1280         No change in behavior. Covered by existing tests.
1281
1282         * loader/ResourceLoader.h: Removed override from didCreateQuickLookHandle() since this
1283         function is no longer declared in ResourceHandleClient.
1284         * loader/SubresourceLoader.cpp:
1285         (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Added a helper
1286         function to check if a QuickLookHandle should be created for a response.
1287         (WebCore::SubresourceLoader::didReceiveResponse): Created a QuickLookHandle if necessary
1288         and stored it in the DocumentLoader.
1289         (WebCore::SubresourceLoader::didReceiveData): If there is a QuickLookHandle, call
1290         QuickLookHandle::didReceiveBuffer(), and return early if QuickLook is converting.
1291         (WebCore::SubresourceLoader::didReceiveBuffer): Ditto for QuickLookHandle::didReceiveBuffer().
1292         (WebCore::SubresourceLoader::didFinishLoading): Ditto for QuickLookHandle::didFinishLoading().
1293         (WebCore::SubresourceLoader::didFail): If there is a QuickLookHandle, call QuickLookHandle::didFail().
1294         * loader/SubresourceLoader.h: Declared shouldCreateQuickLookHandleForResponse().
1295         * loader/ios/QuickLook.h: Removed declarations used by the ResourceHandles and declared new
1296         functions used by SubresourceLoader.
1297         * loader/ios/QuickLook.mm:
1298         (WebCore::QuickLookHandle::QuickLookHandle): Removed the NSURLConnection * parameter, since
1299         we’d now always pass nil.
1300         (WebCore::QuickLookHandle::create): Removed create() functions used by ResourceHandles.
1301         (WebCore::QuickLookHandle::didReceiveData): Added. Copies the data into an NSData, wraps it
1302         in an NSArray, and passes it to didReceiveDataArray().
1303         (WebCore::QuickLookHandle::didReceiveBuffer): Added. Creates a NSArray of NSData from the
1304         SharedBuffer and passes it to didReceiveDataArray().
1305         (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
1306         (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
1307         (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
1308         (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
1309         (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
1310         (-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
1311         (WebCore::QuickLookHandle::cfResponse): Deleted.
1312         (WebCore::QuickLookHandle::didReceiveDataArray): Passed dataArray to m_converter and m_client.
1313         * platform/SharedBuffer.h: Const-qualified createNSDataArray().
1314         * platform/cocoa/SharedBufferCocoa.mm:
1315         (WebCore::SharedBuffer::createNSDataArray): Ditto.
1316         * platform/network/ResourceHandle.cpp: Stopped including QuickLook.h.
1317         * platform/network/ResourceHandle.h: Removed m_quickLook.
1318         (WebCore::ResourceHandle::quickLookHandle): Deleted.
1319         * platform/network/ResourceHandleClient.h:
1320         (WebCore::ResourceHandleClient::didCreateQuickLookHandle): Deleted.
1321         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
1322         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Removed QuickLook code.
1323         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData): Ditto.
1324         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading): Ditto.
1325         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFail): Ditto.
1326         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray): Ditto.
1327         * platform/network/mac/ResourceHandleMac.mm:
1328         (WebCore::ResourceHandle::setQuickLookHandle): Deleted.
1329         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
1330         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Removed QuickLook code.
1331         (-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]): Ditto.
1332         (-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]): Ditto.
1333         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]): Ditto.
1334         (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]): Ditto.
1335
1336 2017-01-06  Daniel Bates  <dabates@apple.com>
1337
1338         Ensure navigation only allowed for documents not in the page cache
1339         https://bugs.webkit.org/show_bug.cgi?id=166773
1340         <rdar://problem/29762809>
1341
1342         Reviewed by Brent Fulgham.
1343
1344         It is wise to ensure that navigation is only allowed when initiated from a document that
1345         is not in- or about to be put in- the page cache. Such a navigation would surprise a
1346         person that had navigated away from the initiating document among other issues.
1347
1348         * dom/Document.cpp:
1349         (WebCore::Document::canNavigate): Only allow navigation if the document is not in the
1350         page cache.
1351         * html/HTMLAnchorElement.cpp:
1352         (WebCore::HTMLAnchorElement::handleClick): Ditto.
1353         * html/HTMLLinkElement.cpp:
1354         (WebCore::HTMLLinkElement::handleClick): Ditto.
1355         * loader/FrameLoader.cpp:
1356         (WebCore::FrameLoader::urlSelected): Assert triggering event's document is not in the
1357         page cache.
1358         (WebCore::FrameLoader::submitForm): Allow submission if the document is not in the
1359         page cache.
1360         (WebCore::FrameLoader::loadFrameRequest): Assert triggering event's document is not in
1361         the page cache.
1362         * mathml/MathMLElement.cpp:
1363         (WebCore::MathMLElement::defaultEventHandler): Only allow navigation if the document is
1364         not in the page cache.
1365         * svg/SVGAElement.cpp:
1366         (WebCore::SVGAElement::defaultEventHandler): Ditto.
1367
1368 2017-01-06  Jer Noble  <jer.noble@apple.com>
1369
1370         Crash in WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime(const MediaTime&, const FloatSize&)::block_invoke
1371         https://bugs.webkit.org/show_bug.cgi?id=166738
1372
1373         Reviewed by Eric Carlson.
1374
1375         AVFoundation can potentially call the same boundary time observer multiple times, and
1376         in that case, it's possible that the observer queue will be empty when we attempt
1377         to remove the first item from the queue. There's an ASSERT() in Deque for this case,
1378         but we need to explicitly protect against this case.
1379
1380         Drive-by fix: Explicitly unregister the observer before releasing it.
1381
1382         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1383         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
1384
1385 2017-01-06  Joseph Pecoraro  <pecoraro@apple.com>
1386
1387         REGRESSION(r208886) Web Inspector: Toggling CSS Properties in Styles Sidebar (comment / uncomment)
1388         https://bugs.webkit.org/show_bug.cgi?id=166786
1389         <rdar://problem/29767412>
1390
1391         Reviewed by Brian Burg.
1392
1393         * inspector/InspectorStyleSheet.cpp:
1394         (WebCore::InspectorStyle::populateAllProperties):
1395         Match earlier behavior and don't send the frontend information about
1396         disabled (commented out) properties. Follow-up later to send this
1397         information when implementing proper handling of them in the frontend.
1398
1399 2017-01-06  Sam Weinig  <sam@webkit.org>
1400
1401         [WebIDL] Remove custom bindings from CanvasRenderingContext2D
1402         https://bugs.webkit.org/show_bug.cgi?id=166793
1403
1404         Reviewed by Darin Adler.
1405
1406         * WebCore.xcodeproj/project.pbxproj:
1407         Move JSCanvasRenderingContext2DCustom.cpp to the GC only group.
1408
1409         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
1410         (WebCore::toJS): Deleted.
1411         (WebCore::toHTMLCanvasStyle): Deleted.
1412         (WebCore::JSCanvasRenderingContext2D::strokeStyle): Deleted.
1413         (WebCore::JSCanvasRenderingContext2D::setStrokeStyle): Deleted.
1414         (WebCore::JSCanvasRenderingContext2D::fillStyle): Deleted.
1415         (WebCore::JSCanvasRenderingContext2D::setFillStyle): Deleted.
1416         Remove non-GC related custom bindings.
1417
1418         * html/canvas/CanvasRenderingContext2D.cpp:
1419         (WebCore::CanvasRenderingContext2D::setStrokeStyle):
1420         (WebCore::CanvasRenderingContext2D::setFillStyle):
1421         (WebCore::toStyle):
1422         (WebCore::CanvasRenderingContext2D::strokeStyle):
1423         (WebCore::CanvasRenderingContext2D::fillStyle):
1424         * html/canvas/CanvasRenderingContext2D.h:
1425         * html/canvas/CanvasRenderingContext2D.idl:
1426         Made existing setStrokeStyle/setFillStyle functions (which take CanvasStyle's) 
1427         private, and implemented new ones that operate on Variants, matching the spec.
1428
1429 2017-01-05  Darin Adler  <darin@apple.com>
1430
1431         Remove PassRefPtr use from "rendering" directory, other improvements
1432         https://bugs.webkit.org/show_bug.cgi?id=166717
1433
1434         Reviewed by Sam Weinig.
1435
1436         * css/CSSComputedStyleDeclaration.cpp:
1437         (WebCore::shapePropertyValue): Use auto.
1438         * css/CSSFilterImageValue.cpp:
1439         (WebCore::CSSFilterImageValue::image): Use auto. Pass references.
1440         (WebCore::CSSFilterImageValue::filterImageChanged): Use modern for loop.
1441
1442         * css/StyleBuilderConverter.h:
1443         (WebCore::StyleBuilderConverter::convertShapeValue): Use overloaded
1444         ShapeValue::create function instead of differently named functions.
1445         * page/animation/CSSPropertyAnimation.cpp:
1446         (WebCore::blendFunc): Ditto.
1447
1448         * platform/graphics/filters/Filter.h: Added a protected constructor that takes
1449         a filter resolution.
1450
1451         * rendering/FilterEffectRenderer.cpp:
1452         (WebCore::FilterEffectRenderer::FilterEffectRenderer): Use new constructor so
1453         we don't have to call setFilterResolution and can initialize m_sourceGraphic.
1454         (WebCore::FilterEffectRenderer::create): Moved here from the header.
1455         (WebCore::FilterEffectRenderer::buildReferenceFilter): Take references and not
1456         PssRefPtr. Use auto and references.
1457         (WebCore::FilterEffectRenderer::build): Take a reference. Updated to work with
1458         references rather than pointer. Use auto.
1459         (WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Use early return.
1460         (WebCore::FilterEffectRenderer::clearIntermediateResults): Use modern for loop.
1461         (WebCore::FilterEffectRenderer::apply): Use references.
1462         (WebCore::FilterEffectRenderer::output): Moved here from header.
1463         (WebCore::FilterEffectRenderer::setMaxEffectRects): Moved here from header.
1464         (WebCore::FilterEffectRenderer::outputRect): Moved here from header.
1465         (WebCore::FilterEffectRendererHelper::prepareFilterEffect): Take references.
1466         (WebCore::FilterEffectRendererHelper::beginFilterEffect): Use auto and references.
1467         (WebCore::FilterEffectRendererHelper::applyFilterEffect): Ditto.
1468         * rendering/FilterEffectRenderer.h: Updated for the above changes. Made a lot more
1469         things private.
1470
1471         * rendering/RenderLayer.cpp:
1472         (WebCore::RenderLayer::filterPainter): Added. Helper so setupFilters does not
1473         have to do things twice.
1474         (WebCore::RenderLayer::hasFilterThatIsPainting): Updated to call filterPainter.
1475         (WebCore::RenderLayer::setupFilters): Ditto.
1476         (WebCore::RenderLayer::calculateClipRects): Pass reference.
1477         * rendering/RenderLayer.h: Updated for the above changes.
1478
1479         * rendering/style/ContentData.cpp:
1480         (WebCore::ContentData::clone): Use auto.
1481         (WebCore::ImageContentData::createContentRenderer): Updated for reference.
1482         * rendering/style/ContentData.h: Use Ref&& instead of PassRefPtr. Made more
1483         things private.
1484
1485         * rendering/style/NinePieceImage.cpp:
1486         (WebCore::NinePieceImage::defaultData): Made this a static member so it can
1487         get at the now-private class NinePieceImage::Data.
1488         (WebCore::NinePieceImage::NinePieceImage): Use RefPtr&& instead of PassRefPtr.
1489         Use construction instead of calling m_data.access() over and over again.
1490         (WebCore::NinePieceImage::Data::Data): Renamed from NinePieceImageData.
1491         Moved initialization to class definition. Added a new overload for the normal
1492         creation case.
1493         (WebCore::NinePieceImage::Data::create): Ditto.
1494         (WebCore::NinePieceImage::Data::copy): Ditto.
1495         (WebCore::NinePieceImage::Data::operator==): Ditto.
1496         * rendering/style/NinePieceImage.h: Cut down on includes. Moved the class
1497         named NinePieceImageData in to become the private struct NinePieceImage::Data.
1498
1499         * rendering/style/RenderStyle.cpp:
1500         (WebCore::RenderStyle::setContent): Pass Ref&& instead of RefPtr&& when
1501         creating ImageContentData.
1502
1503         * rendering/style/ShapeValue.cpp:
1504         (WebCore::ShapeValue::isImageValid): Tighten up by using data member directly
1505         and using a local variabel.
1506         (WebCore::pointersOrValuesEqual): Deleted.
1507         (WebCore::ShapeValue::operator==): Use arePointingToEqualData instead the
1508         above deleted function template. Wrote as a single return statement for clarity.
1509         * rendering/style/ShapeValue.h: Changed all the create function names to just
1510         create, using overloading instead of separate names. Use Ref&& instead of PassRefPtr.
1511         Removed unused constructor that took a type but no data.
1512
1513 2017-01-06  Chris Dumez  <cdumez@apple.com>
1514
1515         Regression(r189230): DOM Callbacks may use wrong global object
1516         https://bugs.webkit.org/show_bug.cgi?id=166784
1517
1518         Reviewed by Mark Lam.
1519
1520         DOM Callbacks could end up using the wrong global object after r189230
1521         because we were getting the globalObject from the callback object
1522         instead of the one at the point the callback object was passed in by
1523         JavaScript. This patch fixes the issue.
1524
1525         Test: fast/frames/frame-window-as-callback.html
1526
1527         * bindings/js/JSCallbackData.cpp:
1528         (WebCore::JSCallbackData::invokeCallback):
1529         * bindings/js/JSCallbackData.h:
1530         (WebCore::JSCallbackData::globalObject):
1531         (WebCore::JSCallbackData::JSCallbackData):
1532         (WebCore::JSCallbackDataStrong::JSCallbackDataStrong):
1533         (WebCore::JSCallbackDataStrong::callback):
1534         (WebCore::JSCallbackDataStrong::invokeCallback):
1535         (WebCore::JSCallbackDataWeak::JSCallbackDataWeak):
1536         (WebCore::JSCallbackDataWeak::callback):
1537         (WebCore::JSCallbackDataWeak::invokeCallback):
1538         * bindings/scripts/CodeGeneratorJS.pm:
1539         (GenerateCallbackImplementationContent):
1540
1541 2017-01-06  Andy Estes  <aestes@apple.com>
1542
1543         [Cocoa] Consolidate duplicate copies of WebArchiveDumpSupport in DRT and WKTR into WebCoreTestSupport
1544         https://bugs.webkit.org/show_bug.cgi?id=166789
1545
1546         Reviewed by Alex Christensen.
1547
1548         There were duplicate implementations of WebArchiveDumpSupport in DumpRenderTree and
1549         WebKitTestRunner. This change consolidates these into a single implementation in
1550         WebCoreTestSupport.
1551
1552         * PlatformMac.cmake: Added WebArchiveDumpSupport.mm to WebCoreTestSupport.
1553         * WebCore.xcodeproj/project.pbxproj: Ditto. Also made WebArchiveDumpSupport.h a Private header.
1554         * platform/spi/cf/CFNetworkSPI.h: Moved CFNetwork forward declarations from
1555         WebArchiveDumpSupport to here.
1556         * testing/cocoa/WebArchiveDumpSupport.h: Added.
1557         * testing/cocoa/WebArchiveDumpSupport.mm: Merged WebArchiveDumpSupport.cpp and
1558         WebArchiveDumpSupport{Cocoa,Mac}.mm into a single file.
1559
1560 2017-01-06  Tim Horton  <timothy_horton@apple.com>
1561
1562         Minor cleanups to IndentOutdentCommand and related code
1563         https://bugs.webkit.org/show_bug.cgi?id=166791
1564
1565         Reviewed by Simon Fraser.
1566
1567         * editing/IndentOutdentCommand.cpp:
1568         (WebCore::IndentOutdentCommand::IndentOutdentCommand):
1569         (WebCore::IndentOutdentCommand::outdentRegion):
1570         * editing/IndentOutdentCommand.h:
1571         (WebCore::IndentOutdentCommand::create):
1572         Remove the unused m_marginInPixels and fix the copyright header.
1573
1574 2017-01-06  Alex Christensen  <achristensen@webkit.org>
1575
1576         Fix WinCairo build after r210319.
1577         https://bugs.webkit.org/show_bug.cgi?id=166635
1578
1579         * DerivedSources.cpp:
1580         A toJS call was ambiguous, but only if the generated IndexedDB bindings are compiled all-in-one in DerivedSources.cpp.
1581         Compiling these few files separately (which happens automatically in the CMake build) fixes the build and won't increase
1582         the total object files beyond MSVC's current 2GB limit.
1583         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
1584         (WebCore::JSWebGLRenderingContextBaseOwner::isReachableFromOpaqueRoots):
1585         Unknown was an ambiguous symbol.  It's also defined in winioctl.h.
1586
1587 2017-01-06  Zalan Bujtas  <zalan@apple.com>
1588
1589         Text highlight causes Yoon Gothic webfont to reflow.
1590         https://bugs.webkit.org/show_bug.cgi?id=166753
1591
1592         Reviewed by Darin Adler.
1593
1594         Add word-break: keep-all; support for CJK and breaking NBSPs.
1595
1596         Add test later. Need to figure out what font file to use.
1597
1598         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1599         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
1600         (WebCore::SimpleLineLayout::TextFragmentIterator::nextBreakablePosition): Use BreakingContext's helper functions
1601         to figure out the next breakable position.
1602         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
1603         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1604
1605 2017-01-06  Joseph Pecoraro  <pecoraro@apple.com>
1606
1607         Add some missing longhand properties to CSSComputedStyleDeclaration and fix default values
1608         https://bugs.webkit.org/show_bug.cgi?id=166674
1609         <rdar://problem/6026159>
1610
1611         Reviewed by Darin Adler.
1612
1613         * css/CSSComputedStyleDeclaration.cpp:
1614         Add some missing longhand properties to the list of all longhand properties.
1615
1616         (WebCore::counterToCSSValue):
1617         The default value for counter-increment and counter-reset should be "none"
1618         not the empty string.
1619
1620 2017-01-06  Chris Dumez  <cdumez@apple.com>
1621
1622         [Form Validation] "character" in maxlength validation message should be singular when maxlength is 1
1623         https://bugs.webkit.org/show_bug.cgi?id=166712
1624         <rdar://problem/29872292>
1625
1626         Reviewed by Darin Adler.
1627
1628         Fix validation message to use singular form of "character" when maxLength value is 1.
1629
1630         Test: fast/forms/validation-message-maxLength.html
1631
1632         * English.lproj/Localizable.strings:
1633         * English.lproj/Localizable.stringsdict: Added.
1634         * WebCore.xcodeproj/project.pbxproj:
1635         * extract-localizable-strings.pl:
1636         * platform/LocalizedStrings.cpp:
1637         * platform/LocalizedStrings.h:
1638         * platform/cocoa/LocalizedStringsCocoa.mm:
1639         (WebCore::localizedNString):
1640         (WebCore::localizedString):
1641         (WebCore::validationMessageTooLongText):
1642
1643 2017-01-06  Jer Noble  <jer.noble@apple.com>
1644
1645         Add support for MediaKeySystemAccess.createMediaKeys()
1646         https://bugs.webkit.org/show_bug.cgi?id=166749
1647
1648         Reviewed by Eric Carlson.
1649
1650         Test: media/encrypted-media/mock-MediaKeySystemAccess.html
1651
1652         Implement MediaKeySystemAccess::createMediaKeys(). This requires some
1653         additions to CDM, CDMPrivate, and a new interface CDMInstance to support
1654         eventual platform adoption and to implement mock support for testing.
1655
1656         * Modules/encryptedmedia/CDM.cpp:
1657         (WebCore::CDM::loadAndInitialize):
1658         (WebCore::CDM::createInstance):
1659         * Modules/encryptedmedia/CDM.h:
1660         * Modules/encryptedmedia/CDMInstance.h:
1661         (WebCore::CDMInstance::~CDMInstance):
1662         * Modules/encryptedmedia/CDMPrivate.h:
1663         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
1664         (WebCore::MediaKeySystemAccess::createMediaKeys):
1665         * Modules/encryptedmedia/MediaKeySystemAccess.h:
1666         * Modules/encryptedmedia/MediaKeys.cpp:
1667         (WebCore::MediaKeys::MediaKeys):
1668         * Modules/encryptedmedia/MediaKeys.h:
1669         (WebCore::MediaKeys::create):
1670         * Modules/encryptedmedia/MediaKeys.idl:
1671         * Modules/encryptedmedia/NavigatorEME.cpp:
1672         (WebCore::tryNextSupportedConfiguration):
1673         * WebCore.xcodeproj/project.pbxproj:
1674         * testing/MockCDMFactory.cpp:
1675         (WebCore::MockCDM::MockCDM):
1676         (WebCore::MockCDM::createInstance):
1677         (WebCore::MockCDM::loadAndInitialize):
1678         (WebCore::MockCDMInstance::MockCDMInstance):
1679         (WebCore::MockCDMInstance::initializeWithConfiguration):
1680         (WebCore::MockCDMInstance::setDistinctiveIdentifiersAllowed):
1681         (WebCore::MockCDMInstance::setPersistentStateAllowed):
1682         * testing/MockCDMFactory.h:
1683         (WebCore::MockCDMFactory::canCreateInstances):
1684         (WebCore::MockCDMFactory::setCanCreateInstances):
1685         (WebCore::MockCDM::factory):
1686         * testing/MockCDMFactory.idl:
1687
1688 2017-01-06  Andreas Kling  <akling@apple.com>
1689
1690         Give RenderObject a Page& getter.
1691         <https://webkit.org/b/166735>
1692
1693         Reviewed by Darin Adler.
1694
1695         The render tree should now only ever be live while in a Frame that's connected to a Page.
1696         Hence we can give RenderObject a Page& getter and simplify a lot of code that previously
1697         had to get the Page from Document (or Frame) and perform null checks on it.
1698
1699         * dom/Document.cpp:
1700         (WebCore::Document::destroyRenderTree): Assert that the Page is present when we tear the render tree down.
1701
1702         * page/Frame.cpp:
1703         (WebCore::Frame::willDetachPage): Assert that there's no render tree when we're about to detach from the Page.
1704         Also added a comment explaining the two main ways that render trees die.
1705
1706         * rendering/RenderObject.h:
1707         (WebCore::RenderObject::page): Added. So neat!
1708
1709         * accessibility/AccessibilityRenderObject.cpp:
1710         (WebCore::AccessibilityRenderObject::estimatedLoadingProgress):
1711         * rendering/ImageQualityController.cpp:
1712         (WebCore::ImageQualityController::chooseInterpolationQuality):
1713         * rendering/InlineTextBox.cpp:
1714         (WebCore::InlineTextBox::paint):
1715         * rendering/RenderAttachment.cpp:
1716         (WebCore::RenderAttachment::layout):
1717         (WebCore::RenderAttachment::baselinePosition):
1718         * rendering/RenderBlock.cpp:
1719         (WebCore::RenderBlock::paintCaret):
1720         * rendering/RenderBox.cpp:
1721         (WebCore::RenderBox::styleDidChange):
1722         (WebCore::setupWheelEventTestTrigger):
1723         (WebCore::RenderBox::setScrollLeft):
1724         (WebCore::RenderBox::setScrollTop):
1725         * rendering/RenderElement.cpp:
1726         (WebCore::RenderElement::paintFocusRing):
1727         * rendering/RenderEmbeddedObject.cpp:
1728         (WebCore::shouldUnavailablePluginMessageBeButton):
1729         (WebCore::RenderEmbeddedObject::paint):
1730         (WebCore::RenderEmbeddedObject::paintReplaced):
1731         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
1732         (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
1733         (WebCore::RenderEmbeddedObject::getCursor):
1734         * rendering/RenderHTMLCanvas.cpp:
1735         (WebCore::RenderHTMLCanvas::paintReplaced):
1736         * rendering/RenderIFrame.cpp:
1737         (WebCore::RenderIFrame::flattenFrame):
1738         * rendering/RenderImage.cpp:
1739         (WebCore::RenderImage::paintReplaced):
1740         (WebCore::RenderImage::paintAreaElementFocusRing):
1741         * rendering/RenderLayer.cpp:
1742         (WebCore::RenderLayer::~RenderLayer):
1743         (WebCore::RenderLayer::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
1744         (WebCore::RenderLayer::scrollRectToVisible):
1745         (WebCore::RenderLayer::isActive):
1746         (WebCore::RenderLayer::didStartScroll):
1747         (WebCore::RenderLayer::didEndScroll):
1748         (WebCore::RenderLayer::didUpdateScroll):
1749         (WebCore::RenderLayer::createScrollbar):
1750         (WebCore::RenderLayer::setupFontSubpixelQuantization):
1751         (WebCore::RenderLayer::calculateClipRects):
1752         * rendering/RenderLayer.h:
1753         * rendering/RenderLayerBacking.cpp:
1754         (WebCore::RenderLayerBacking::RenderLayerBacking):
1755         (WebCore::RenderLayerBacking::createGraphicsLayer):
1756         (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
1757         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
1758         (WebCore::RenderLayerBacking::paintContents):
1759         (WebCore::RenderLayerBacking::shouldAggressivelyRetainTiles):
1760         (WebCore::RenderLayerBacking::shouldTemporarilyRetainTileCohorts):
1761         (WebCore::RenderLayerBacking::useGiantTiles):
1762         (WebCore::RenderLayerBacking::verifyNotPainting):
1763         (WebCore::RenderLayerBacking::startAnimation):
1764         (WebCore::scrollingCoordinatorFromLayer): Deleted.
1765         * rendering/RenderLayerCompositor.cpp:
1766         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
1767         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
1768         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
1769         (WebCore::updateScrollingLayerWithClient):
1770         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
1771         (WebCore::RenderLayerCompositor::notifyFlushBeforeDisplayRefresh):
1772         (WebCore::RenderLayerCompositor::layerTiledBackingUsageChanged):
1773         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1774         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
1775         (WebCore::RenderLayerCompositor::layerBecameNonComposited):
1776         (WebCore::RenderLayerCompositor::updateBacking):
1777         (WebCore::RenderLayerCompositor::pageScaleFactor):
1778         (WebCore::RenderLayerCompositor::zoomedOutPageScaleFactor):
1779         (WebCore::RenderLayerCompositor::contentsScaleMultiplierForNewTiles):
1780         (WebCore::RenderLayerCompositor::updateLayerForHeader):
1781         (WebCore::RenderLayerCompositor::updateLayerForFooter):
1782         (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
1783         (WebCore::RenderLayerCompositor::attachRootLayer):
1784         (WebCore::RenderLayerCompositor::detachRootLayer):
1785         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
1786         (WebCore::RenderLayerCompositor::registerAllScrollingLayers):
1787         (WebCore::RenderLayerCompositor::scrollingCoordinator):
1788         (WebCore::RenderLayerCompositor::graphicsLayerFactory):
1789         (WebCore::RenderLayerCompositor::createDisplayRefreshMonitor):
1790         (WebCore::RenderLayerCompositor::page):
1791         * rendering/RenderLayerCompositor.h:
1792         * rendering/RenderListBox.cpp:
1793         (WebCore::setupWheelEventTestTrigger):
1794         (WebCore::RenderListBox::setScrollTop):
1795         (WebCore::RenderListBox::isActive):
1796         (WebCore::RenderListBox::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
1797         (WebCore::RenderListBox::createScrollbar):
1798         * rendering/RenderObject.cpp:
1799         (WebCore::RenderObject::theme):
1800         * rendering/RenderObject.h:
1801         (WebCore::RenderObject::page):
1802         * rendering/RenderSearchField.cpp:
1803         (WebCore::RenderSearchField::addSearchResult):
1804         (WebCore::RenderSearchField::showPopup):
1805         (WebCore::RenderSearchField::valueChanged):
1806         * rendering/RenderSnapshottedPlugIn.cpp:
1807         (WebCore::RenderSnapshottedPlugIn::updateSnapshot):
1808         * rendering/RenderTheme.cpp:
1809         (WebCore::RenderTheme::paint):
1810         (WebCore::RenderTheme::updateControlStatesForRenderer):
1811         (WebCore::RenderTheme::isActive):
1812         * rendering/RenderThemeMac.mm:
1813         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
1814         (WebCore::RenderThemeMac::paintSliderThumb):
1815         * rendering/RenderVideo.cpp:
1816         (WebCore::RenderVideo::paintReplaced):
1817         * rendering/RenderView.cpp:
1818         (WebCore::RenderView::pageNumberForBlockProgressionOffset):
1819         (WebCore::RenderView::pageCount):
1820         * rendering/svg/RenderSVGRoot.cpp:
1821         (WebCore::RenderSVGRoot::paintReplaced):
1822         * style/StyleResolveForDocument.cpp:
1823         (WebCore::Style::resolveForDocument):
1824
1825 2017-01-05  Zalan Bujtas  <zalan@apple.com>
1826
1827         TextFragmentIterator::runWidth does not need typename CharacterType<> anymore.
1828         https://bugs.webkit.org/show_bug.cgi?id=166751
1829
1830         Reviewed by Simon Fraser.
1831
1832         No change in functionality.
1833
1834         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1835         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
1836         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1837
1838 2017-01-05  Ryosuke Niwa  <rniwa@webkit.org>
1839
1840         Finding text doesn't work across shadow boundary
1841         https://bugs.webkit.org/show_bug.cgi?id=158503
1842
1843         Reviewed by Antti Koivisto.
1844
1845         Added a new TextIterator behavior flag, TextIteratorTraversesFlatTree, which makes TextIterator traverse
1846         the flat tree instead of the DOM tree, and made this behavior default in findPlainText.
1847
1848         Also added a new find options flag, DoNotTraverseFlatTree, to suppress this behavior in window.find(~)
1849         and execCommand('FindString', false, ~) as they should not be able to peek information inside shadow trees.
1850         Unfortunately these APIs have been deprecated in the standards so there is no specification to follow.
1851
1852         For now, we don't support finding a word or a keyword across a shadow boundary as this would require
1853         making rangeOfString and other related functions return a Range-like object that can cross shadow boundaries.
1854
1855         Also added internals.rangeOfString to test Editor::rangeOfString, and replaced the bit-flag arguments
1856         to internals.countMatchesForText and internals.countFindMatches by an array of strings for better portability.
1857
1858         Test: editing/text-iterator/find-string-on-flat-tree.html
1859
1860         * editing/Editor.cpp:
1861         (WebCore::Editor::rangeOfString): Use the modern containingShadowRoot instead of nonBoundaryShadowTreeRootNode
1862         since the start container can be a shadow root, which nonBoundaryShadowTreeRootNode asserts not be the case.
1863         * editing/Editor.h:
1864         * editing/EditorCommand.cpp:
1865         (WebCore::executeFindString): Don't traverse across shadow boundaries.
1866         * editing/FindOptions.h: Added DoNotTraverseFlatTree.
1867         * editing/TextIterator.cpp:
1868         (WebCore::assignedAuthorSlot): Added.
1869         (WebCore::authorShadowRoot): Added.
1870         (WebCore::firstChildInFlatTreeIgnoringUserAgentShadow): Added.
1871         (WebCore::nextSiblingInFlatTreeIgnoringUserAgentShadow): Added.
1872         (WebCore::firstChild): Added. Traverses the flat tree when TextIteratorTraversesFlatTree is set.
1873         (WebCore::nextSibling): Ditto.
1874         (WebCore::parentNodeOrShadowHost): Ditto.
1875         (WebCore::TextIterator::advance): Don't set m_handledChildren to true when the current node has display: contents.
1876         (WebCore::findPlainText): Use TextIteratorTraversesFlatTree unless DoNotTraverseFlatTree is set.
1877         * editing/TextIteratorBehavior.h: Added TextIteratorTraversesFlatTree.
1878         * page/DOMWindow.cpp:
1879         (WebCore::DOMWindow::find): Don't traverse across shadow boundaries.
1880         * testing/Internals.cpp:
1881         (WebCore::parseFindOptions): Added.
1882         (WebCore::Internals::rangeOfString): Added.
1883         (WebCore::Internals::countMatchesForText): Replaced the find options by an array of strings instead of a bit mask.
1884         (WebCore::Internals::countFindMatches): Ditto.
1885         * testing/Internals.h:
1886         * testing/Internals.idl: Added rangeOfString, and replaced find options bit-flag in countMatchesForText and
1887         countFindMatches by an array of strings so that the tests themselves don't rely on a specific value of each bit flag.
1888
1889 2017-01-05  Chris Dumez  <cdumez@apple.com>
1890
1891         [Form Validation] lengthy validation messages should be truncated with an ellipsis
1892         https://bugs.webkit.org/show_bug.cgi?id=166747
1893         <rdar://problem/29872021>
1894
1895         Reviewed by Simon Fraser.
1896
1897         Lengthy HTML validation messages should be truncated with an ellipsis.
1898         Previously, they were truncated but there was no ellipsis.
1899
1900         No new tests, not easily testable. Manually tested on
1901         - http://codepen.io/cdumez/full/zoOZmZ/ (last field)
1902
1903         * platform/ios/ValidationBubbleIOS.mm:
1904         (WebCore::ValidationBubble::ValidationBubble):
1905         * platform/mac/ValidationBubbleMac.mm:
1906         (WebCore::ValidationBubble::ValidationBubble):
1907
1908 2017-01-05  Simon Fraser  <simon.fraser@apple.com>
1909
1910         Radio buttons have a fixed border radius making them look square when resized
1911         https://bugs.webkit.org/show_bug.cgi?id=148676
1912         rdar://problem/29889892
1913
1914         Reviewed by Tim Horton.
1915
1916         Change the 8px border-radius of iOS radio buttons to 50% so they remain circular
1917         when the page overrides the size.
1918
1919         Test: fast/forms/ios/large-radio-button-is-round.html
1920
1921         * css/html.css:
1922         (#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS):
1923
1924 2017-01-05  Myles C. Maxfield  <mmaxfield@apple.com>
1925
1926         CoreText variation axis identifiers don't work with 64-bit numbers
1927         https://bugs.webkit.org/show_bug.cgi?id=166745
1928         <rdar://problem/29856541>
1929         <rdar://problem/29848883>
1930
1931         Reviewed by Tim Horton.
1932
1933         There is a bug where some CFNumbers are getting garbage results when
1934         being placed into a 64-bit field. Luckily, we don't need the full
1935         64-bits; 32-bits is sufficient.
1936
1937         Test: fast/text/international/system-language/hindi-system-font-punctuation.html
1938
1939         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1940         (WebCore::defaultVariationValues):
1941
1942 2017-01-05  Zalan Bujtas  <zalan@apple.com>
1943
1944         Start hittesting a clean tree in RenderEmbeddedObject::isReplacementObscured
1945         https://bugs.webkit.org/show_bug.cgi?id=166743
1946         <rdar://problem/29024384>
1947
1948         Reviewed by Simon Fraser.
1949
1950         Unable to reproduce.
1951
1952         * rendering/RenderEmbeddedObject.cpp:
1953         (WebCore::RenderEmbeddedObject::isReplacementObscured):
1954
1955 2017-01-04  Ryosuke Niwa  <rniwa@webkit.org>
1956
1957         Crash inside Editor::styleForSelectionStart
1958         https://bugs.webkit.org/show_bug.cgi?id=166710
1959
1960         Reviewed by Chris Dumez.
1961
1962         Added a null pointer check. This crash can happen when the DOM is mutated as editorState tries
1963         to compute the style at the selection start.
1964
1965         No new tests since there is no reproducible test case, and I couldn't come up with one either.
1966         This crash seems to retire some intricate dependency between when DOM is mutated, selection is
1967         updated, and then performPostLayoutTasks ends up updating the editor state in response to
1968         the element's editabilty changing.
1969
1970         * editing/cocoa/EditorCocoa.mm:
1971         (WebCore::Editor::styleForSelectionStart):
1972
1973 2017-01-05  Ryan Haddad  <ryanhaddad@apple.com>
1974
1975         Unreviewed, rolling out r210370.
1976
1977         This change caused hundreds of LayoutTest failures on Sierra.
1978
1979         Reverted changeset:
1980
1981         "[Cocoa] Variation fonts without variations specified are not
1982         rendered as if the default variations were specified"
1983         https://bugs.webkit.org/show_bug.cgi?id=166672
1984         http://trac.webkit.org/changeset/210370
1985
1986 2017-01-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1987
1988         [SOUP] Network process crash in WebKit::CustomProtocolManagerImpl::didFailWithError
1989         https://bugs.webkit.org/show_bug.cgi?id=165082
1990
1991         Reviewed by Alex Christensen.
1992
1993         Simplified WebKitSoupRequestGenericClient.
1994
1995         * platform/network/soup/WebKitSoupRequestGeneric.cpp:
1996         (webkitSoupRequestGenericSendAsync):
1997         (webkitSoupRequestGenericSendFinish):
1998         (webkitSoupRequestGenericGetRequest):
1999         * platform/network/soup/WebKitSoupRequestGeneric.h:
2000         * platform/network/soup/WebKitSoupRequestGenericClient.h:
2001
2002 2017-01-05  Chris Dumez  <cdumez@apple.com>
2003
2004         Turn preferLowPowerWebGLRendering setting on by default
2005         https://bugs.webkit.org/show_bug.cgi?id=166737
2006         <rdar://problem/29870033>
2007
2008         Reviewed by Dean Jackson.
2009
2010         Temporarily turn preferLowPowerWebGLRendering setting on by default until
2011         we deal better with WebGL content in background tabs.
2012
2013         * page/Settings.in:
2014
2015 2017-01-05  Myles C. Maxfield  <mmaxfield@apple.com>
2016
2017         [Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
2018         https://bugs.webkit.org/show_bug.cgi?id=166672
2019         <rdar://problem/29779119>
2020         <rdar://problem/29848883>
2021
2022         Reviewed by Simon Fraser.
2023
2024         CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
2025         a specified variation value are rendered as if the minimum value is specified,
2026         rather than the default value. The solution is to apply default values where
2027         they are omitted.
2028
2029         Test: fast/text/variations/advances.html
2030
2031         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2032         (WebCore::preparePlatformFont):
2033
2034 2017-01-05  Zalan Bujtas  <zalan@apple.com>
2035
2036         Mark the dedicated root linebox for trailing floats in empty inlines dirty.
2037         https://bugs.webkit.org/show_bug.cgi?id=166732
2038         <rdar://problem/29100419>
2039
2040         Reviewed by Antti Koivisto.
2041
2042         We normally attach floating boxes to the last root linebox. However when the floatbox is preceded by a <br>
2043         we generate a dedicated root linebox (TrailingFloatsRootInlineBox) for the floatbox.
2044         When this floatbox is a RenderInline descendant and this RenderInline does not generate lineboxes (it's ancestor RenderBlockFlow does)
2045         we have to make sure that this special root linebox gets marked dirty when the associated floatbox changes.
2046         (Unfortunately through the recursive calls on dirtyLinesFromChangedChild(), we lose the information about
2047         the "changed child" since the inlines propagates the marking logic to the RenderBlockFlow, see FIXME.)
2048
2049         Test: fast/inline/trailing-floats-inline-crash2.html
2050
2051         * rendering/RenderLineBoxList.cpp:
2052         (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
2053
2054 2017-01-05  Antoine Quint  <graouts@apple.com>
2055
2056         [Cocoa] Both modern-media-controls/images/iOS modern-media-controls/images/macOS are installed on both platforms
2057         https://bugs.webkit.org/show_bug.cgi?id=163871
2058
2059         Reviewed by Eric Carlson.
2060
2061         We now only copy modern media controls images, if any, for the current platform.
2062
2063         * WebCore.xcodeproj/project.pbxproj:
2064
2065 2017-01-05  Keith Rollin  <krollin@apple.com>
2066
2067         Add WebCore::URL::protocolHostAndPort
2068         https://bugs.webkit.org/show_bug.cgi?id=166426
2069
2070         Reviewed by Alex Christensen.
2071
2072         Added to support record/replay mechanism, which needs it in order to
2073         implement fuzzy-matching of URLs that are similar to each other but
2074         that nonetheless come from the same source/host.
2075
2076         Updated TestWebKitAPI/Tests/WebCore/URL.cpp.
2077
2078         * platform/URL.cpp:
2079         (WebCore::URL::protocolHostAndPort):
2080         * platform/URL.h:
2081
2082 2017-01-05  Chris Dumez  <cdumez@apple.com>
2083
2084         Form validation: Align email validation with the latest HTML specification
2085         https://bugs.webkit.org/show_bug.cgi?id=166697
2086         <rdar://problem/29870245>
2087
2088         Reviewed by Alex Christensen.
2089
2090         Align email validation with the latest HTML specification:
2091         - https://html.spec.whatwg.org/#valid-e-mail-address
2092
2093         It particular, the following changes were made:
2094         - The first and last character of the domain now needs to be a letter or a digit
2095         - Parts of the domain can only be 63 characters in length
2096
2097         No new tests, extended existing test.
2098
2099         * html/EmailInputType.cpp:
2100
2101 2017-01-05  Enrica Casucci  <enrica@apple.com>
2102
2103         Support File Promise during drag for macOS.
2104         https://bugs.webkit.org/show_bug.cgi?id=165204
2105         rdar://problem/19595567
2106
2107         Reviewed by Tim Horton.
2108
2109         Adds the support for handling File Promise type during
2110         drag. DragData now has the knowledge of the NSFilesPromisePboardType and
2111         checks for the data type during drag.
2112
2113         * page/mac/DragControllerMac.mm:
2114         (WebCore::DragController::dragOperation):
2115         * platform/DragData.h:
2116         (WebCore::DragData::setFileNames):
2117         (WebCore::DragData::fileNames):
2118         * platform/mac/DragDataMac.mm:
2119         (WebCore::DragData::containsFiles):
2120         (WebCore::DragData::numberOfFiles):
2121         (WebCore::DragData::asFilenames):
2122         (WebCore::DragData::containsCompatibleContent):
2123         (WebCore::DragData::containsPromise):
2124         (WebCore::DragData::asURL):
2125
2126 2017-01-05  Per Arne Vollan  <pvollan@apple.com>
2127
2128         [Win] Compile error.
2129         https://bugs.webkit.org/show_bug.cgi?id=166726
2130
2131         Reviewed by Alex Christensen.
2132
2133         Add include folder.
2134
2135         * CMakeLists.txt:
2136
2137 2017-01-05  Milan Crha  <mcrha@redhat.com>
2138
2139         [SOUP] AddressSanitizer: heap-use-after-free under WTF::String::fromUTF8()
2140         https://bugs.webkit.org/show_bug.cgi?id=166722
2141
2142         Reviewed by Alex Christensen.
2143
2144         * platform/soup/PublicSuffixSoup.cpp:
2145         (WebCore::topPrivatelyControlledDomain):
2146         Use a variable to hold UTF-8 version of the domain, because
2147         the soup_tld_get_base_domain() returns a pointer into the passed-in
2148         string, which could be freed due to the temporary object being freed.
2149
2150 2017-01-05  Andreas Kling  <akling@apple.com>
2151
2152         Remove some unnecessary page cache checks in render tree code.
2153         <https://webkit.org/b/166728>
2154
2155         Reviewed by Antti Koivisto.
2156
2157         There is no render tree in the page cache, so we don't need to be checking
2158         for it in renderer code.
2159
2160         * rendering/RenderElement.cpp:
2161         (WebCore::shouldRepaintForImageAnimation):
2162         (WebCore::RenderElement::newImageAnimationFrameAvailable):
2163         * rendering/RenderImage.cpp:
2164         (WebCore::RenderImage::imageChanged):
2165         * rendering/RenderObject.cpp:
2166         (WebCore::printRenderTreeForLiveDocuments):
2167         (WebCore::printLayerTreeForLiveDocuments):
2168         * rendering/RenderView.cpp:
2169         (WebCore::RenderView::lazyRepaintTimerFired):
2170
2171 2017-01-05  Andreas Kling  <akling@apple.com>
2172
2173         REGRESSION(r210226): overflow:scroll scroll position not restored on back navigation
2174         <https://webkit.org/b/166724>
2175
2176         Reviewed by Antti Koivisto.
2177
2178         Before r210226, the render tree being torn down and the document being destroyed
2179         were roughly the same thing, since they would always happen together, from the
2180         render tree's perspective.
2181
2182         Changing this caused us to skip over the code that saves the scroll position
2183         for an element's RenderLayer when going into the page cache. Navigating back to
2184         that page would then scroll the layer to (0,0) instead of the previous position.
2185
2186         The fix is simply to remove the check for documentBeingDestroyed() in ~RenderLayer().
2187         Note that two checks are being removed, there was also a weird "optimization"
2188         to avoid nulling out EventHandler's m_resizeLayer if it points to this layer.
2189         That pointer would eventually get nulled out in EventHandler::clear() anyway,
2190         but it feels better to not let that pointer dangle.
2191
2192         Test: fast/scrolling/page-cache-back-overflow-scroll-restore.html
2193
2194         * rendering/RenderLayer.cpp:
2195         (WebCore::RenderLayer::~RenderLayer):
2196
2197 2017-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2198
2199         Disable smooth playhead animation for main content media in the Touch Bar
2200         https://bugs.webkit.org/show_bug.cgi?id=166715
2201         <rdar://problem/29870673>
2202
2203         Reviewed by Eric Carlson.
2204
2205         Passing in a non-zero playback rate to WebPlaybackControlsManager's timing property causes unintended effects
2206         further down the stack. Please see the Radar for more details.
2207
2208         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2209         (WebCore::WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
2210
2211 2017-01-05  Andreas Kling  <akling@apple.com>
2212
2213         Fix iOS build due to missing #include's.
2214
2215         * history/CachedFrame.cpp:
2216
2217 2017-01-05  Andreas Kling  <akling@apple.com>
2218
2219         Remove ChromeClient::needTouchEvents().
2220         <https://webkit.org/b/166723>
2221
2222         Rubber-stamped by Antti Koivisto.
2223
2224         Remove this hook since it's a no-op in every port.
2225
2226         * dom/Document.cpp:
2227         (WebCore::Document::didBecomeCurrentDocumentInFrame):
2228         (WebCore::Document::didAddTouchEventHandler):
2229         (WebCore::Document::didRemoveTouchEventHandler):
2230         * history/CachedFrame.cpp:
2231         (WebCore::CachedFrameBase::restore):
2232         * loader/EmptyClients.h:
2233         * loader/FrameLoader.cpp:
2234         (WebCore::FrameLoader::transitionToCommitted):
2235         * page/ChromeClient.h:
2236
2237 2017-01-05  Darin Adler  <darin@apple.com>
2238
2239         Remove PassRefPtr use from "bindings/scripts", "svg", "testing", and "workers"
2240         https://bugs.webkit.org/show_bug.cgi?id=166718
2241
2242         Reviewed by Alex Christensen.
2243
2244         * bindings/scripts/test/JS/JSFloat64Array.cpp: Removed. Stale unused test
2245         result expectation file.
2246         * bindings/scripts/test/JS/JSFloat64Array.h: Ditto.
2247
2248         * svg/SVGElement.cpp:
2249         (WebCore::SVGElement::removeEventListener): Fix comment that incorrectly
2250         mentions PassRefPtr.
2251
2252         * testing/Internals.cpp:
2253         (WebCore::Internals::computedStyleIncludingVisitedInfo): Return Ref instead
2254         of RefPtr.
2255         (WebCore::Internals::serializeObject): Ditto.
2256         (WebCore::Internals::deserializeBuffer): Ditto.
2257         (WebCore::Internals::observeGC): Streamlined code a bit.
2258         * testing/Internals.h: Updated for above changes.
2259         * testing/Internals.idl: Marked various function results as nullable.
2260
2261         * workers/DedicatedWorkerThread.cpp:
2262         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Take a RefPtr&&
2263         instead of a PassRefPtr.
2264         * workers/DedicatedWorkerThread.h: Updated for above change.
2265
2266         * workers/Worker.cpp:
2267         (WebCore::Worker::Worker): Passs a reference to WorkerGlobalScopeProxy::create.
2268         (WebCore::Worker::~Worker): Updated since m_contentProxy is a reference.
2269         (WebCore::Worker::postMessage): Ditto.
2270         (WebCore::Worker::terminate): Ditto.
2271         (WebCore::Worker::hasPendingActivity): Ditto.
2272         (WebCore::Worker::notifyNetworkStateChange): Ditto.
2273         (WebCore::Worker::notifyFinished): Ditto.
2274         * workers/Worker.h: Made m_contextProxy a reference rather than a pointer.
2275
2276         * workers/WorkerGlobalScopeProxy.h: Reduced includes. Made destructor
2277         protected instead of public since this class destroys itself.
2278
2279         * workers/WorkerMessagingProxy.cpp:
2280         (WebCore::WorkerGlobalScopeProxy::create): Take and return a reference.
2281         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): Moved most initialization
2282         to the calass definition. Take a reference instead of a pointer.
2283         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Use auto.
2284         (WebCore::WorkerMessagingProxy::workerThreadCreated): Take a reference
2285         rather than a PassRefPtr.
2286         * workers/WorkerMessagingProxy.h: Updated for above changes.
2287         (WebCore::WorkerMessagingProxy::askedToTerminate): Deleted.
2288         (WebCore::WorkerMessagingProxy::workerObject): Deleted.
2289
2290         * workers/WorkerThread.h: Take a RefPtr&& instead of a PassRefPtr.
2291
2292 2017-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2293
2294         Unreviewed. Addressing post-review comments after r21005.
2295
2296         Simplify cairo_glyph_t initialization as suggested by Said.
2297
2298         * platform/graphics/cairo/FontCairo.cpp:
2299         (WebCore::CairoGlyphToPathTranslator::path):
2300
2301 2017-01-04  Manuel Rego Casasnovas  <rego@igalia.com>
2302
2303         [css-grid] Fix crash clamping grid lines
2304         https://bugs.webkit.org/show_bug.cgi?id=166637
2305
2306         Reviewed by Darin Adler.
2307
2308         Avoid issues with very big values for the grid lines clamping them on GridPosition.
2309
2310         Test: fast/css-grid-layout/grid-position-crash.html
2311
2312         * rendering/style/GridArea.h: Move kGridMaxTracks definition to GridPosition.
2313         * rendering/style/GridPosition.h:
2314         (WebCore::GridPosition::setExplicitPosition): Use new setIntegerPosition().
2315         (WebCore::GridPosition::setSpanPosition): Ditto.
2316         (WebCore::GridPosition::setIntegerPosition): Clamp the position using kGridMaxTracks.
2317
2318 2017-01-04  Darin Adler  <darin@apple.com>
2319
2320         Remove PassRefPtr use from the "html" directory, other improvements
2321         https://bugs.webkit.org/show_bug.cgi?id=166635
2322
2323         Reviewed by Alex Christensen.
2324
2325         * CMakeLists.txt: Removed the duplicate copies of all the WebGL-specific files
2326         in the main list of source files; there is no value in listing them twice.
2327         Replaced WebGLGetInfo.cpp with WebGLAny.cpp.
2328
2329         * Modules/mediasource/MediaSource.cpp:
2330         (WebCore::MediaSource::removeSourceBuffer): Updates since the tracks functions
2331         return references now.
2332
2333         * Modules/mediasource/SourceBuffer.cpp:
2334         (WebCore::SourceBuffer::sourceBufferPrivateFastSeekTimeForMediaTime): Removed
2335         unneeded SourceBufferPrivate* argument.
2336         (WebCore::SourceBuffer::appendBufferTimerFired): Ditto.
2337         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): Ditto.
2338         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Ditto.
2339         (WebCore::SourceBuffer::videoTracks): Return a reference rather than a pointer.
2340         (WebCore::SourceBuffer::audioTracks): Ditto.
2341         (WebCore::SourceBuffer::textTracks): Ditto.
2342         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
2343         Removed unneeded SourceBufferPrivate* argument.
2344         (WebCore::SourceBuffer::validateInitializationSegment): Updated since tracks
2345         functions now return a pointer.
2346         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Removed unneeded
2347         SourceBufferPrivate* argument.
2348         (WebCore::SourceBuffer::sourceBufferPrivateHasAudio): Ditto.
2349         (WebCore::SourceBuffer::sourceBufferPrivateHasVideo): Ditto.
2350         (WebCore::SourceBuffer::videoTrackSelectedChanged): Take a reference rather than
2351         a pointer.
2352         (WebCore::SourceBuffer::audioTrackEnabledChanged): Ditto.
2353         (WebCore::SourceBuffer::textTrackModeChanged): Ditto.
2354         (WebCore::SourceBuffer::textTrackAddCue): Ditto.
2355         (WebCore::SourceBuffer::textTrackAddCues): Ditto.
2356         (WebCore::SourceBuffer::textTrackRemoveCue): Ditto.
2357         (WebCore::SourceBuffer::textTrackRemoveCues): Ditto.
2358         (WebCore::SourceBuffer::textTrackKindChanged): Ditto.
2359         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples): Ditto.
2360         (WebCore::SourceBuffer::provideMediaData): Ditto.
2361         (WebCore::SourceBuffer::reenqueueMediaForTime): Ditto.
2362         * Modules/mediasource/SourceBuffer.h: Updated for above changes.
2363
2364         * WebCore.xcodeproj/project.pbxproj: Replaced WebGLGetInfo with WebGLAny.
2365
2366         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
2367         (WebCore::toHTMLCanvasStyle): Removed explicit cast to CanvasStyle and unneeded
2368         conversion to a pointer since CanvasStyle constructors now take references.
2369
2370         * bindings/js/JSPluginElementFunctions.cpp:
2371         (WebCore::pluginInstance): Updated since bindingsInstance now returns a raw pointer.
2372         (WebCore::pluginScriptObject): Ditto.
2373
2374         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
2375         (WebCore::toJS): Moved to WebGLAny.h/cpp.
2376         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Updated since the toJS
2377         function in WebGLAny.h takes references, not pointers.
2378
2379         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: Removed quite a few unneeded
2380         includes and got rid of a lot of unneeded JSC prefixes.
2381         (WebCore::toJS): Moved to WebGLAny.h/cpp.
2382         (WebCore::toJSNewlyCreated):
2383         (WebCore::objectParameter): Renamed from getObjectParameter and also changed to
2384         take a pointer to member function so we don't need an enum and a switch statement.
2385         (WebCore::toJS): Changed to take references rather than pointers.
2386         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Use a modern for loop.
2387         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Use objectParameter.
2388         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Ditto.
2389         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Ditto.
2390         (WebCore::toNumberVector): Renamed from toVector, since this is specifically for
2391         vectors of numbers. Use uncheckedAppend instead of assignment.
2392         (WebCore::functionForUniform): Marked this inline.
2393         (WebCore::dataFunctionf): Updated for above changes.
2394         (WebCore::dataFunctioni): Ditto.
2395         (WebCore::dataFunctionMatrix): Ditto.
2396
2397         * bindings/js/ScriptModuleLoader.cpp:
2398         (WebCore::ScriptModuleLoader::fetch): Moved assertions to the top of the function.
2399         Also added a FIXME because it's unclear why these assertions are correct. Updated
2400         to use downcastScriptElement instead of toScriptElementIfPossible.
2401
2402         * dom/Document.h: Sorted list of forward-declared classes. Removed duplicate
2403         forward declaration of ScriptModuleLoader.
2404
2405         * dom/PendingScript.cpp:
2406         (WebCore::PendingScript::create): Take a ScriptElement instead of an Element.
2407         (WebCore::PendingScript::PendingScript): Ditto.
2408         (WebCore::PendingScript::loadableScript): Moved inline to header and made inline.
2409         (WebCore::PendingScript::setClient): Take a reference instead of a pointer.
2410         * dom/PendingScript.h: UPdated for above changes.
2411
2412         * dom/ScriptElement.cpp:
2413         (WebCore::ScriptElement::prepareScript): Pass a reference instead of a pointer.
2414         (WebCore::ScriptElement::ref): Added. Forwards ref/deref to the underlying element
2415         so we can use Ref and RefPtr with this class.
2416         (WebCore::ScriptElement::deref): Ditto.
2417         (WebCore::isScriptElement): Added. Replaces one of the two uses of
2418         toScriptElementIfPossible, and is similar in style to is<Element>.
2419         (WebCore::downcastScriptElement): Ditto, but for downcast.
2420         * dom/ScriptElement.h: Updated for above changes.
2421
2422         * dom/ScriptRunner.cpp:
2423         (WebCore::ScriptRunner::queueScriptForExecution): Take reference rather than
2424         pointer, and pass ScriptElement rather than Element.
2425         (WebCore::ScriptRunner::notifyFinished): Ditto.
2426         (WebCore::ScriptRunner::timerFired): Ditto.
2427         * dom/ScriptRunner.h: Updated for above changes.
2428
2429         * html/FileInputType.cpp:
2430         (WebCore::FileInputType::files): Updated since m_fileList is a Ref.
2431         (WebCore::FileInputType::createFileList): Updated to return a Ref instead of
2432         a PassRefPtr. Also use reserveInitialCapacity/uncheckedAppend.
2433         (WebCore::FileInputType::requestIcon): Updated since the updateRendering
2434         function is now called iconLoaded. Also use references instead of pointers.
2435         (WebCore::FileInputType::setFiles): Take a RefPtr&& insted of a PassRefPtr.
2436         Also put some conditional code inside an #if.
2437         (WebCore::FileInputType::filesChosen): Updated for function name change.
2438         (WebCore::FileInputType::iconLoaded): Renamed from updateRendering.
2439         Changed argument to RefPtr&& from PassRefPtr.
2440         (WebCore::FileInputType::defaultToolTip): Got rid of unneeded local variable
2441         and used the correct type, unsigned, rather than size_t.
2442         * html/FileInputType.h: Updated for the above changes, use final instead
2443         of override, and use Ref instead of RefPtr.
2444
2445         * html/HTMLElement.cpp:
2446         (WebCore::HTMLElement::form): Renamed from virtualForm.
2447         * html/HTMLElement.h: Replaced the form/virtualForm pair of functions with
2448         just a form function. The old design dates back before we had "final" for
2449         virtual functions, and now we can just use that instead.
2450
2451         * html/HTMLFormControlElement.cpp:
2452         (WebCore::HTMLFormControlElement::virtualForm): Deleted.
2453         * html/HTMLFormControlElement.h: Mark the form function final, since it's
2454         now both an inline function in this class, and an override of a virtual
2455         function inherited from the base class. Deleted the virtualForm function.
2456
2457         * html/HTMLInputElement.cpp:
2458         (WebCore::HTMLInputElement::defaultEventHandler): Removed use of the
2459         formForSubmission function, which was just another way to get the same
2460         thing as the form function; perhaps they were different in the past.
2461         (WebCore::HTMLInputElement::setFiles): Take a RefPtr&& rather than a PassRefPtr.
2462         * html/HTMLInputElement.h: Updated for the above.
2463
2464         * html/HTMLLabelElement.cpp:
2465         (WebCore::HTMLLabelElement::control): Made this const.
2466         (WebCore::HTMLLabelElement::form): Made this const, so it can be used to
2467         override the const form function from the base class.
2468         * html/HTMLLabelElement.h: Marked the form function final, since we want it
2469         to override the form function inherited from HTMLElement.
2470
2471         * html/HTMLLegendElement.cpp:
2472         (WebCore::HTMLLegendElement::form): Renamed from virtualForm.
2473         * html/HTMLLegendElement.h: Override form instead of virtualForm and mark it final
2474         This makes things more efficient if someone calls form directly on this class;
2475         before it would make an unnecessary virtual function call.
2476
2477         * html/HTMLMediaElement.cpp:
2478         (WebCore::TrackDisplayUpdateScope::TrackDisplayUpdateScope): Take a reference
2479         rather than a pointer.
2480         (WebCore::TrackDisplayUpdateScope::~TrackDisplayUpdateScope): Ditto.
2481         (WebCore::eventTimeCueCompare): Compare the cues the same way the cue list would
2482         rather than using cueIndex.
2483         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Take a reference.
2484         (WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
2485         (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Ditto.
2486         (WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
2487         (WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
2488         (WebCore::HTMLMediaElement::textTrackRemoveCues): Ditto.
2489         (WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
2490         (WebCore::HTMLMediaElement::textTrackRemoveCue): Ditto.
2491         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Pass references.
2492         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Ditto.
2493         (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Ditto.
2494         (WebCore::HTMLMediaElement::removeTextTrack): Ditto.
2495         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks): Ditto.
2496         (WebCore::HTMLMediaElement::setController): Take a RefPtr&& instead of PassRefPtr.
2497         * html/HTMLMediaElement.h: Updated for above changes.
2498
2499         * html/HTMLObjectElement.cpp:
2500         (WebCore::HTMLObjectElement::virtualForm): Deleted.
2501         * html/HTMLObjectElement.h: Made the form function inline and final, which
2502         achieves the same thing we did before with using, but without requiring the
2503         separate virtualForm function, now deleted.
2504
2505         * html/HTMLOptionElement.cpp:
2506         (WebCore::HTMLOptionElement::collectOptionInnerText): Use isScriptElement
2507         instead of toScriptElementIfPossible.
2508
2509         * html/HTMLPlugInElement.cpp:
2510         (WebCore::HTMLPlugInElement::bindingsInstance): Renamed from getInstance and
2511         changed the return type to a raw pointer.
2512         * html/HTMLPlugInElement.h: Updated for the above changes. Also changed the
2513         updateSnapshot function to take a raw pointer instead of a PassRefPtr.
2514
2515         * html/HTMLPlugInImageElement.cpp:
2516         (WebCore::HTMLPlugInImageElement::createElementRenderer): Pass a pointer
2517         to updateSnapshot.
2518         (WebCore::HTMLPlugInImageElement::updateSnapshot): Updated to take a raw
2519         pointer instead of a PassRefPtr.
2520         * html/HTMLPlugInImageElement.h: Updated for above changes.
2521
2522         * html/HTMLScriptElement.h: Added using to resolve the ambiguity with the
2523         ref/deref from HTMLElement and from ScriptElement.
2524
2525         * html/HTMLTextFormControlElement.cpp:
2526         (WebCore::HTMLTextFormControlElement::selection): Return a RefPtr instead
2527         of a PassRefPtr.
2528         * html/HTMLTextFormControlElement.h: Updated for above changes.
2529
2530         * html/HTMLTrackElement.cpp:
2531         (WebCore::HTMLTrackElement::textTrackKindChanged): Take a reference.
2532         (WebCore::HTMLTrackElement::textTrackModeChanged): Ditto.
2533         (WebCore::HTMLTrackElement::textTrackAddCues): Ditto.
2534         (WebCore::HTMLTrackElement::textTrackRemoveCues): Ditto.
2535         (WebCore::HTMLTrackElement::textTrackAddCue): Ditto.
2536         (WebCore::HTMLTrackElement::textTrackRemoveCue): Ditto.
2537         * html/HTMLTrackElement.h: Updated for above changes.
2538
2539         * html/InputType.cpp:
2540         (WebCore::InputType::formForSubmission): Deleted.
2541         (WebCore::InputType::setFiles): Take a RefPtr&& instead of a PassRefPtr.
2542         * html/InputType.h: Updated for above changes.
2543
2544         * html/PluginDocument.cpp:
2545         (WebCore::PluginDocumentParser::createDocumentStructure): Pass a reference.
2546         (WebCore::PluginDocument::setPluginElement): Take a reference rather than
2547         a PassRefPtr.
2548         * html/PluginDocument.h: Updated for above changes.
2549
2550         * html/canvas/CanvasRenderingContext2D.cpp:
2551         (WebCore::CanvasRenderingContext2D::setStrokeStyle): Pass a reference.
2552         (WebCore::CanvasRenderingContext2D::setFillStyle): Ditto.
2553         (WebCore::CanvasRenderingContext2D::drawTextInternal): Ditto.
2554
2555         * html/canvas/CanvasStyle.cpp:
2556         (WebCore::CanvasStyle::CanvasStyle): Rewrite all constructors to use the
2557         m_style variant instead of separate m_type and other data members. Also
2558         change from PassRefPtr to a reference.
2559         (WebCore::CanvasStyle::createFromString): Update to use the variant.
2560         (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): Ditto.
2561         (WebCore::CanvasStyle::isEquivalentColor): Ditto.
2562         (WebCore::CanvasStyle::isEquivalentRGBA): Ditto.
2563         (WebCore::CanvasStyle::isEquivalentCMYKA): Ditto.
2564         (WebCore::CanvasStyle::CanvasStyle): Deleted copy constructor; the compiler
2565         can now generate a correct copy or move constructor.
2566         (WebCore::CanvasStyle::~CanvasStyle): Deleted. Compiler generates this
2567         properly now without help from us.
2568         (WebCore::CanvasStyle::operator=): Deleted. The compiler can now generate
2569         a correct copy of move assignment operator.
2570         (WebCore::CanvasStyle::applyStrokeColor): Updated to take a reference and
2571         use the variant.
2572         (WebCore::CanvasStyle::applyFillColor): Ditto.
2573
2574         * html/canvas/CanvasStyle.h: Redid this class to use a variant instead of
2575         a type enumeration and a union.
2576
2577         * html/canvas/OESVertexArrayObject.cpp:
2578         (WebCore::OESVertexArrayObject::createVertexArrayOES): Updated use of enum
2579         since it's now an enum class.
2580
2581         * html/canvas/WebGL2RenderingContext.cpp:
2582         (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): Use Ref&& instead of
2583         RefPtr&& for the GraphicsContext3D.
2584         (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects): Updated enum
2585         and also use references.
2586         (WebCore::WebGL2RenderingContext::getInternalformatParameter): Use nullptr to
2587         return null rather than the old idiom (default-constructed WebGLGetInfo).
2588         (WebCore::WebGL2RenderingContext::texStorage2D): Ditto.
2589         (WebCore::WebGL2RenderingContext::getQueryParameter): Ditto.
2590         (WebCore::WebGL2RenderingContext::getSamplerParameter): Ditto.
2591         (WebCore::WebGL2RenderingContext::getSyncParameter): Ditto.
2592         (WebCore::WebGL2RenderingContext::getIndexedParameter): Ditto.
2593         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter): Ditto.
2594         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName): Ditto.
2595         (WebCore::WebGL2RenderingContext::createVertexArray): Updated enum and also
2596         use reference.
2597         (WebCore::WebGL2RenderingContext::getExtension): Rearranged logic in three ways:
2598         (1) Moved checks for whether an extension is supported inside the case for that
2599         extension, rather than combining the extension name check with the extensions
2600         enabled check. (2) Used the new enableSupportedExtension function to simplify
2601         many of the checks to avoid repeating the extension name twice. (3) Changed the
2602         idiom so we set the pointers to nullptr explicitly, preparing for a future where
2603         we might make the extension pointers use std::optional so we can cache a negative
2604         for each extension too, not just a positive result.
2605         (WebCore::WebGL2RenderingContext::getSupportedExtensions): Use ASCIILiteral.
2606         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter): Use nullptr
2607         as above. For non-null types, return the object without converting, letting the
2608         WebGLAny class handle things, except for enumerations, which we need to explicitly
2609         static_cast to an integral type, and things that will be stored in the variant in
2610         a RefPtr, where we use makeRefPtr.
2611         (WebCore::WebGL2RenderingContext::validateFramebufferFuncParameters):
2612         Simplified and clarified the handling of COLOR_ATTACHMENT.
2613         (WebCore::WebGL2RenderingContext::getParameter): Return WebGLAny, same idiom as
2614         described above for getFramebufferAttachmentParameter.
2615         * html/canvas/WebGL2RenderingContext.h: Updated for above changes.
2616
2617         * html/canvas/WebGLAny.cpp: Added.
2618         (WebCore::toJS): Handles conversion to JavaScript types. This function is based
2619         on the existing toJS functions from the two classes that were using WebGLGetInfo.
2620         Eventually we can probably just get the bindings to automatically generate this,
2621         but there is some work to do to get to that point.
2622         * html/canvas/WebGLAny.h: Added. This type, a variant, replaces the WebGLGetInfo
2623         class. Also includes the toJS function, which is the real point of this type, since
2624         it's about returning a variant mapped appropriately to JavaScript types.
2625
2626         * html/canvas/WebGLContextGroup.cpp:
2627         (WebCore::WebGLContextGroup::getAGraphicsContext3D): Changed to return a reference.
2628         Droped unnecessary local variable with a long type name.
2629         (WebCore::WebGLContextGroup::addContext): Take a reference.
2630         (WebCore::WebGLContextGroup::removeContext): Ditto.
2631         (WebCore::WebGLContextGroup::removeObject): Ditto.
2632         (WebCore::WebGLContextGroup::addObject): Ditto.
2633         (WebCore::WebGLContextGroup::detachAndRemoveAllObjects): Dropped unnecessary
2634         local variable with a long type name.
2635         * html/canvas/WebGLContextGroup.h: Updated for above changes.
2636
2637         * html/canvas/WebGLContextObject.cpp:
2638         (WebCore::WebGLContextObject::~WebGLContextObject): Pass references.
2639         (WebCore::WebGLContextObject::detachContext): Ditto.
2640
2641         * html/canvas/WebGLGetInfo.cpp: Removed.
2642         * html/canvas/WebGLGetInfo.h: Removed.
2643
2644         * html/canvas/WebGLRenderingContext.cpp:
2645         (WebCore::WebGLRenderingContext::WebGLRenderingContext): Take a Ref&& instead
2646         of as PassRefPtr.
2647         (WebCore::WebGLRenderingContext::initializeVertexArrayObjects): Updated enum
2648         and also use references.
2649         (WebCore::WebGLRenderingContext::getExtension): Rearranged logic in three ways:
2650         (1) Moved checks for whether an extension is supported inside the case for that
2651         extension, rather than combining the extension name check with the extensions
2652         enabled check. (2) Used the new enableSupportedExtension function to simplify
2653         many of the checks to avoid repeating the extension name twice. (3) Changed the
2654         idiom so we set the pointers to nullptr explicitly, preparing for a future where
2655         we might make the extension pointers use std::optional so we can cache a negative
2656         for each extension too, not just a positive result.
2657         (WebCore::WebGLRenderingContext::getSupportedExtensions): Use ASCIILiteral.
2658         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): Use nullptr
2659         as above. For non-null types, return the object without converting, letting the
2660         WebGLAny class handle things, except for enumerations, which we need to explicitly
2661         static_cast to an integral type, and things that will be stored in the variant in
2662         a RefPtr, where we use makeRefPtr.
2663         (WebCore::WebGLRenderingContext::validateFramebufferFuncParameters):
2664         Simplified and clarified the handling of COLOR_ATTACHMENT adding a FIXME about
2665         something questionable.
2666         (WebCore::WebGLRenderingContext::getParameter): Return WebGLAny, same idiom as
2667         described above for getFramebufferAttachmentParameter.
2668         * html/canvas/WebGLRenderingContext.h: Updated for above changes.
2669
2670         * html/canvas/WebGLRenderingContextBase.cpp:
2671         (WebCore::WebGLRenderingContextBase::create): Updated to pass references
2672         instead of pointers in a couple cases
2673         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): Changed graphics
2674         context argument type from RefPtr&& to Ref&&. Also moved initialization of scalars
2675         from the constructor to the class definition.
2676         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase): Pass a reference.
2677         (WebCore::WebGLRenderingContextBase::createBuffer): Pass a reference instead of a pointer.
2678         (WebCore::WebGLRenderingContextBase::createFramebuffer): Ditto.
2679         (WebCore::WebGLRenderingContextBase::createTexture): Ditto.
2680         (WebCore::WebGLRenderingContextBase::createProgram): Ditto.
2681         (WebCore::WebGLRenderingContextBase::createRenderbuffer): Ditto.
2682         (WebCore::WebGLRenderingContextBase::createShader): Ditto.
2683         (WebCore::WebGLRenderingContextBase::deleteBuffer): Ditto.
2684         (WebCore::WebGLRenderingContextBase::getBufferParameter): Update to use WebGLAny.
2685         (WebCore::WebGLRenderingContextBase::getProgramParameter): Ditto.
2686         (WebCore::WebGLRenderingContextBase::getRenderbufferParameter): Ditto.
2687         (WebCore::WebGLRenderingContextBase::getShaderParameter): Ditto.
2688         (WebCore::WebGLRenderingContextBase::getTexParameter): Ditto.
2689         (WebCore::WebGLRenderingContextBase::getUniform): Ditto.
2690         (WebCore::WebGLRenderingContextBase::getVertexAttrib): Ditto.
2691         (WebCore::WebGLRenderingContextBase::getVertexAttribOffset): Removed unnneed
2692         type casts.
2693         (WebCore::WebGLRenderingContextBase::vertexAttribPointer): Pass a reference.
2694         (WebCore::WebGLRenderingContextBase::removeSharedObject): Take a reference.
2695         (WebCore::WebGLRenderingContextBase::addSharedObject): Ditto.
2696         (WebCore::WebGLRenderingContextBase::removeContextObject): Ditto.
2697         (WebCore::WebGLRenderingContextBase::addContextObject): Ditto.
2698         (WebCore::WebGLRenderingContextBase::getBooleanParameter): Changed return type;
2699         connversion to WebGLAny can happen at the point of use.
2700         (WebCore::WebGLRenderingContextBase::getBooleanArrayParameter): Ditto.
2701         (WebCore::WebGLRenderingContextBase::getFloatParameter): Ditto.
2702         (WebCore::WebGLRenderingContextBase::getIntParameter): Ditto.
2703         (WebCore::WebGLRenderingContextBase::getUnsignedIntParameter): Ditto.
2704         (WebCore::WebGLRenderingContextBase::getInt64Parameter): Ditto.
2705         (WebCore::WebGLRenderingContextBase::getWebGLFloatArrayParameter): Ditto.
2706         (WebCore::WebGLRenderingContextBase::getWebGLIntArrayParameter): Ditto.
2707         (WebCore::WebGLRenderingContextBase::validateBufferDataParameters): Use
2708         optional to simplify logic and get rid of a boolean.
2709         (WebCore::WebGLRenderingContextBase::enableSupportedExtension): Added.
2710         Helper used by the getExtension functions.
2711         * html/canvas/WebGLRenderingContextBase.h: Updated for the above changes.
2712         Also changed setBoundVertexArrayObject to take a raw pointer instead of
2713         as PassRefPtr.
2714
2715         * html/canvas/WebGLSharedObject.cpp:
2716         (WebCore::WebGLSharedObject::~WebGLSharedObject): Pass a reference.
2717         (WebCore::WebGLSharedObject::detachContextGroup): Ditto.
2718         (WebCore::WebGLSharedObject::getAGraphicsContext3D): Updated since the
2719         underlying getAGraphicsContext3D function now returns a reference.
2720
2721         * html/canvas/WebGLSharedObject.h: Removed many unused "is" virtual functions.
2722         * html/canvas/WebGLTransformFeedback.h: Ditto.
2723
2724         * html/canvas/WebGLVertexArrayObject.cpp:
2725         (WebCore::WebGLVertexArrayObject::create): Updated for new type enumeration.
2726         (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject): Ditto.
2727         (WebCore::WebGLVertexArrayObject::deleteObjectImpl): Ditto.
2728         * html/canvas/WebGLVertexArrayObject.h: Updated for above changes.
2729
2730         * html/canvas/WebGLVertexArrayObjectBase.cpp:
2731         (WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase): Updated for new
2732         type enumeration and moved initialization to class definition.
2733         (WebCore::WebGLVertexArrayObjectBase::setElementArrayBuffer): Changed argument to
2734         raw pointer instead of PassRefPtr.
2735         (WebCore::WebGLVertexArrayObjectBase::setVertexAttribState): Changed argument to
2736         reference instead of PassRefPtr.
2737         (WebCore::WebGLVertexArrayObjectBase::unbindBuffer): Changed arugment type to
2738         reference instead of PassRefPtr.
2739         (WebCore::WebGLVertexArrayObjectBase::setVertexAttribDivisor): Removed unneeded
2740         local variable.
2741         * html/canvas/WebGLVertexArrayObjectBase.h: Updated for above changes.
2742         Replaced VAOType with Type. Used class member initialization.
2743
2744         * html/canvas/WebGLVertexArrayObjectOES.cpp:
2745         (WebCore::WebGLVertexArrayObjectOES::create): Updated for new type enumeration.
2746         (WebCore::WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES): Ditto.
2747         (WebCore::WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES) Ditto.:
2748         (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl): Ditto.
2749         * html/canvas/WebGLVertexArrayObjectOES.h: Updated for above changes.
2750
2751         * html/forms/FileIconLoader.cpp:
2752         (WebCore::FileIconLoader::iconLoaded): Renamed from notifyFinished. Also changed
2753         the name of the function this calls to iconLoaded. Changed the arguemnt to
2754         RefPtr&& instead of PassRefPtr.
2755         * html/forms/FileIconLoader.h: Updated for above changes.
2756
2757         * html/parser/HTMLConstructionSite.cpp:
2758         (WebCore::HTMLConstructionSite::attachLater): Use isScriptElement instead of
2759         toScriptElementIfPossible.
2760         (WebCore::HTMLConstructionSite::insertForeignElement): Ditto.
2761
2762         * html/parser/HTMLDocumentParser.cpp:
2763         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Pass script
2764         element as a Ref rather than RefPtr.
2765         (WebCore::HTMLDocumentParser::watchForLoad): Pass a reference instead of a pointer.
2766
2767         * html/parser/HTMLScriptRunner.cpp:
2768         (WebCore::HTMLScriptRunner::executeParsingBlockingScript): Deleted. Moved the code
2769         into the single call site, execute ParsingBlockingScripts.
2770         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Changed argument
2771         type to a reference from a RefPtr; this funtion was not taking ownership. Also remove
2772         call to toScriptElementIfPossible,
2773         since pending scripts now contains script elements already.
2774         (WebCore::HTMLScriptRunner::execute): Changed argument type to Ref<ScriptElement>&&
2775         from PassRefPtr<Element>.
2776         (WebCore::HTMLScriptRunner::executeParsingBlockingScripts): Moved code here from
2777         executeParsingBlockingScript. Also pass a reference.
2778         (WebCore::HTMLScriptRunner::executeScriptsWaitingForParsing): Pass a reference.
2779         (WebCore::requestPendingScript): Changed argument type to ScriptElement& from
2780         Element*.
2781         (WebCore::HTMLScriptRunner::requestParsingBlockingScript): Ditto.
2782         (WebCore::HTMLScriptRunner::requestDeferredScript): Ditto.
2783         (WebCore::HTMLScriptRunner::runScript): Ditto.
2784         * html/parser/HTMLScriptRunner.h: Updated for above changes.
2785
2786         * html/parser/HTMLTreeBuilder.cpp:
2787         (WebCore::HTMLTreeBuilder::takeScriptToProcess): Changed return type from
2788         RefPtr<Element> to RefPtr<ScriptElement>.
2789         (WebCore::HTMLTreeBuilder::processEndTag): Downcast the script element to
2790         HTMLScriptElement so we can store it as a ScriptElement.
2791         (WebCore::HTMLTreeBuilder::processTokenInForeignContent): Downcast the script
2792         element to SVGScriptElement so we can store it as a script element.
2793         * html/parser/HTMLTreeBuilder.h: Updated for above changes. Changed the type
2794         of m_scriptToProcess to RefPtr<ScriptElement>.
2795
2796         * html/parser/TextDocumentParser.cpp: Added now-needed include.
2797
2798         * html/parser/XSSAuditorDelegate.cpp:
2799         (WebCore::XSSAuditorDelegate::generateViolationReport): Changed return type
2800         to Ref from PassRefPtr.
2801         * html/parser/XSSAuditorDelegate.h: Updated for above.
2802
2803         * html/track/AudioTrack.cpp:
2804         (WebCore::AudioTrack::AudioTrack): Take references.
2805         (WebCore::AudioTrack::setPrivate): Ditto.
2806         (WebCore::AudioTrack::setEnabled): Removed redundant code to do what the
2807         private setEnabled function is already going to do.
2808         (WebCore::AudioTrack::inbandTrackIndex): Removed assertion since m_private
2809         is now a Ref rather than RefPtr.
2810         (WebCore::AudioTrack::enabledChanged): Added an early exit so we will only
2811         call audioTrackEnabledChanged if m_enabled is actually changing. Also removed
2812         the unneeded track private argument.
2813         (WebCore::AudioTrack::idChanged): Ditto.
2814         (WebCore::AudioTrack::labelChanged): Ditto.
2815         (WebCore::AudioTrack::languageChanged): Ditto.
2816         (WebCore::AudioTrack::willRemove): Ditto.
2817         * html/track/AudioTrack.h: Updated for above changes.
2818
2819         * html/track/InbandDataTextTrack.cpp:
2820         (WebCore::InbandDataTextTrack::addDataCue): Removed inband text track private
2821         argument. Use contains instead of find/end.
2822         (WebCore::InbandDataTextTrack::updateDataCue): Ditto. Use get instead of find/end.
2823         (WebCore::InbandDataTextTrack::removeDataCue): Ditto.
2824         * html/track/InbandDataTextTrack.h: Updated for above changes.
2825
2826         * html/track/InbandGenericTextTrack.cpp:
2827         (WebCore::InbandGenericTextTrack::InbandGenericTextTrack): Take references.
2828         (WebCore::InbandGenericTextTrack::create): Ditto.
2829         (WebCore::InbandGenericTextTrack::updateCueFromCueData): Ditto.
2830         (WebCore::InbandGenericTextTrack::addGenericCue): Ditto. Also removed unused
2831         track private argument.
2832         (WebCore::InbandGenericTextTrack::updateGenericCue): Ditto.
2833         (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
2834         (WebCore::InbandGenericTextTrack::parseWebVTTCueData): Ditto.
2835         (WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Ditto.
2836         (WebCore::InbandGenericTextTrack::newRegionsParsed): Pass a reference.
2837         * html/track/InbandGenericTextTrack.h: Updated for above changes.
2838
2839         * html/track/InbandTextTrack.cpp:
2840         (WebCore::InbandTextTrack::create): Return a Ref instead of a PassRefPtr. Take
2841         references.
2842         (WebCore::InbandTextTrack::InbandTextTrack): Ditto.
2843         (WebCore::InbandTextTrack::setPrivate): Take a reference instead of a PassRefPtr.
2844         (WebCore::InbandTextTrack::isClosedCaptions): Removed check for null since m_private
2845         is now a Ref and so never null.
2846         (WebCore::InbandTextTrack::isSDH): Ditto.
2847         (WebCore::InbandTextTrack::containsOnlyForcedSubtitles): Ditto.
2848         (WebCore::InbandTextTrack::isMainProgramContent): Ditto.
2849         (WebCore::InbandTextTrack::isEasyToRead): Ditto.
2850         (WebCore::InbandTextTrack::inbandTrackIndex): Ditto.
2851         (WebCore::InbandTextTrack::inBandMetadataTrackDispatchType): Ditto.
2852         (WebCore::InbandTextTrack::idChanged): Removed unneeded track private argument.
2853         (WebCore::InbandTextTrack::labelChanged): Ditto.
2854         (WebCore::InbandTextTrack::languageChanged): Ditto.
2855         (WebCore::InbandTextTrack::willRemove): Ditto.
2856         (WebCore::InbandTextTrack::updateKindFromPrivate): Improved switch statement
2857         by removing default so we get a warning if we forget to handle a kind value.
2858         (WebCore::InbandTextTrack::startTimeVariance): Removed check for null.
2859         * html/track/InbandTextTrack.h: Updated for above changes. Changed m_private from
2860         a RefPtr to a Ref.
2861
2862         * html/track/InbandWebVTTTextTrack.cpp:
2863         (WebCore::InbandWebVTTTextTrack::InbandWebVTTTextTrack): Take references.
2864         (WebCore::InbandWebVTTTextTrack::create): Ditto.
2865         (WebCore::InbandWebVTTTextTrack::parseWebVTTCueData): Removed unneeded track
2866         private arguemnt.
2867         (WebCore::InbandWebVTTTextTrack::newRegionsParsed): Pass a reference.
2868         * html/track/InbandWebVTTTextTrack.h: Updated for above changes.
2869
2870         * html/track/LoadableTextTrack.cpp:
2871         (WebCore::LoadableTextTrack::newCuesAvailable): Pass references.
2872         (WebCore::LoadableTextTrack::newRegionsAvailable): Ditto.
2873
2874         * html/track/TextTrack.cpp:
2875         (WebCore::TextTrack::~TextTrack): Use references.
2876         (WebCore::TextTrack::setKind): Ditto.
2877         (WebCore::TextTrack::setMode): Ditto.
2878         (WebCore::TextTrack::removeAllCues): Ditto.
2879         (WebCore::TextTrack::activeCues): Ditto.
2880         (WebCore::TextTrack::addCue): Ditto.
2881         (WebCore::TextTrack::removeCue): Removed unneeded code to handle a cue
2882         that points to a track but is not in that track. Added a call to
2883         setIsActive(false) here instead of having the remove function do it.
2884         (WebCore::TextTrack::addRegion): Use references.
2885         (WebCore::TextTrack::removeRegion): Removed unneeded code to handle a
2886         region that points to a track but is not in that track.
2887         (WebCore::TextTrack::cueWillChange): Use references.
2888         (WebCore::TextTrack::cueDidChange): Ditto.
2889         (WebCore::TextTrack::setLanguage): Ditto.
2890         * html/track/TextTrack.h: Updated for above changes.
2891
2892         * html/track/TextTrackCue.cpp:
2893         (WebCore::TextTrackCue::TextTrackCue): Initialized the data members
2894         in the class definition.
2895         (WebCore::TextTrackCue::cueIndex): Deleted.
2896         (WebCore::TextTrackCue::invalidateCueIndex): Deleted.
2897         * html/track/TextTrackCue.h: Updated for the above. Removed m_cueIndex,
2898         because it is not a good design to store these and try to keep them up
2899         to date.
2900
2901         * html/track/TextTrackCueList.cpp:
2902         (WebCore::compareCues): Added. Helper for sorting and checking sorting.
2903         (WebCore::TextTrackCueList::TextTrackCueList): Deleted. Let the compiler
2904         generate this.
2905         (WebCore::TextTrackCueList::length): Moved to header.
2906         (WebCore::TextTrackCueList::cueIndex): Renamed from getCueIndex.
2907         Changed return type to unsigned rather than unsigned long.
2908         (WebCore::TextTrackCueList::item): Updated for name change.
2909         (WebCore::TextTrackCueList::getCueById): Ditto.
2910         (WebCore::TextTrackCueList::activeCues): Build the vector directly
2911         rather than wastefully adding with TextTrackCueList::add, which will
2912         try to sort.
2913         (WebCore::TextTrackCueList::add): Take a Ref&& instead of a PassRefPtr.
2914         Also, keep sorted using std::upper_bound instead of the recursive
2915         binary search this code was using before. Also remove the
2916         invalidateCueIndexes call since there are no cue indices any more.
2917         Also remove the boolean return value since no caller was using it.
2918         (WebCore::TextTrackCueList::remove): Take a reference instead of a
2919         pointer. Also remove the boolean return value since no caller was using it.
2920         (WebCore::TextTrackCueList::contains): Deleted. Was unused.
2921         (WebCore::TextTrackCueList::updateCueIndex): Reimplemented using the
2922         std::upper_bound and std::rotate operations. The old code that used
2923         remove and add was inefficient and also could cause a cue to be deallocated
2924         if something else wasn't holding a reference to the cue. Also changed to take
2925         a reference.
2926         (WebCore::TextTrackCueList::clear): Deleted. Was unused.
2927         (WebCore::TextTrackCueList::invalidateCueIndexes): Deleted. No longer
2928         needed since we don't store cue indices in the cues any more.
2929         * html/track/TextTrackCueList.h: Updated for the above changes.
2930
2931         * html/track/VTTRegionList.cpp:
2932         (WebCore::VTTRegionList::VTTRegionList): Deleted. Let the compiler
2933         generate this.
2934         (WebCore::VTTRegionList::length): Moved to header.
2935         (WebCore::VTTRegionList::item): Updated for name and type changes.
2936         (WebCore::VTTRegionList::getRegionById): Ditto.
2937         (WebCore::VTTRegionList::add): Changed to take a Ref&& instead of a
2938         PassRefPtr.
2939         (WebCore::VTTRegionList::remove): Updated.
2940         (WebCore::VTTRegionList::clear): Deleted. Was unused.
2941         * html/track/VTTRegionList.h: Updated for the above changes.
2942         * html/track/VTTRegionList.idl: Made return values nullable to reflect
2943         the actual semantic of the code.
2944
2945         * html/track/VideoTrack.cpp:
2946         (WebCore::VideoTrack::VideoTrack): Use references.
2947         (WebCore::VideoTrack::setPrivate): Ditto.
2948         (WebCore::VideoTrack::setSelected): Ditto.
2949         (WebCore::VideoTrack::inbandTrackIndex): Removed assertion since m_private
2950         is now a Ref instead of a RefPtr.
2951         (WebCore::VideoTrack::selectedChanged): Removed unneeded track private argument.
2952         (WebCore::VideoTrack::idChanged): Ditto.
2953         (WebCore::VideoTrack::labelChanged): Ditto.
2954         (WebCore::VideoTrack::languageChanged): Ditto.
2955         (WebCore::VideoTrack::willRemove): Ditto.
2956         (WebCore::VideoTrack::setKind): Updated to use reference.
2957         (WebCore::VideoTrack::setLanguage): Ditto.
2958         * html/track/VideoTrack.h: Updated for the above. Changed derivation to private.
2959         Removed unneeded defaultKindKeyword.
2960
2961         * loader/EmptyClients.h: Updated to use reference.
2962
2963         * loader/PingLoader.cpp:
2964         (WebCore::PingLoader::sendViolationReport): Take a Ref&& instead of RefPtr&&.
2965         * loader/PingLoader.h: Updated for above change.
2966
2967         * page/Chrome.cpp:
2968         (WebCore::Chrome::loadIconForFiles): Take a reference.
2969         * page/Chrome.h: Updated for above change.
2970         * page/ChromeClient.h: Ditto.
2971
2972         * page/csp/ContentSecurityPolicy.cpp:
2973         (WebCore::ContentSecurityPolicy::reportViolation): Use auto.
2974
2975         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2976         (WebPlaybackSessionModelMediaElement::selectAudioMediaOption): Simplified
2977         algorithm by removing unneeded direct call to audioTrackEnabledChanged,
2978         which will be called by setEnabled and doesn't need to be called again here.
2979         (WebPlaybackSessionModelMediaElement::selectLegibleMediaOption): Removed
2980         unhelpful assertion and unnneded initialization.
2981
2982         * platform/graphics/AudioTrackPrivate.h: Removed unnneeed track private
2983         argument and initialized data members where they are defined.
2984
2985         * platform/graphics/InbandTextTrackPrivateClient.h: Use Ref instead of
2986         PassRefPtr, initialize data members where they are defined, and removed
2987         the unneeded track private arguments from the client functions.
2988
2989         * platform/graphics/SourceBufferPrivate.h: Fixed functions that were taking
2990         AtomicString to take a const& instead. Use Ref&& instead of PassRefPtr.
2991
2992         * platform/graphics/SourceBufferPrivateClient.h: Removed unneded private pointer
2993         arguments from client functions.
2994
2995         * platform/graphics/TrackPrivateBase.h: Removed unneeded private pointers
2996         from client functions.
2997         * platform/graphics/VideoTrackPrivate: Ditto.
2998
2999         * platform/graphics/avfoundation/AudioTrackPrivateAVF.h: Use
3000         const AtomicString&.
3001
3002         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
3003         (WebCore::InbandMetadataTextTrackPrivateAVF::addDataCue): Updated for change to arguments.
3004         (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes): Ditto.
3005         (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues): Ditto.
3006         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
3007         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Ditto.
3008         (WebCore::InbandTextTrackPrivateAVF::resetCueValues): Ditto.
3009         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Ditto.
3010
3011         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.cpp:
3012         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::AudioTrackPrivateMediaSourceAVFObjC):
3013         Moved initialization of data memebrs to where they are defined.
3014         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::enabled): Deleted. No longer needed.
3015         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::setEnabled): Changed to use the enabled
3016         flag from the base class instead of a separate m_enabled in this class.
3017         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.h:
3018         Removed the enabled function and the m_enabled data member.
3019
3020         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: Marked functions
3021         final instead of override and updated arguemnts.
3022         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3023         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset): Updated for change
3024         to arguments.
3025         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame): Ditto.
3026         (WebCore::SourceBufferPrivateAVFObjC::appendCompleted): Ditto.
3027         (WebCore::SourceBufferPrivateAVFObjC::hasVideo): Ditto.
3028         (WebCore::SourceBufferPrivateAVFObjC::hasAudio): Ditto.
3029         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError): Ditto.
3030         (WebCore::SourceBufferPrivateAVFObjC::flush): Ditto.
3031         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
3032         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): Ditto.
3033         (WebCore::SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime): Ditto.
3034         (WebCore::SourceBufferPrivateAVFObjC::seekToTime): Ditto.
3035         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Ditto.
3036         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Ditto.
3037
3038         * platform/graphics/gstreamer/InbandMetadataTextTrackPrivateGStreamer.h: Updated for
3039         changes to arguments.
3040         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
3041         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample): Ditto.
3042         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
3043         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Ditto.
3044         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3045         (WebCore::AppendPipeline::appsinkNewSample): Ditto.
3046         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
3047         (WebCore::SourceBufferPrivateGStreamer::append): Ditto.
3048         (WebCore::SourceBufferPrivateGStreamer::flush): Ditto.
3049         (WebCore::SourceBufferPrivateGStreamer::enqueueSample): Ditto.
3050         (WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples): Ditto.
3051         (WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples): Ditto.
3052         (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples): Ditto.
3053         (WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples): Ditto.
3054         (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment): Ditto.
3055         (WebCore::SourceBufferPrivateGStreamer::didReceiveSample): Ditto.
3056         (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples): Ditto.
3057         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: Ditto.
3058         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
3059         (WebCore::MockSourceBufferPrivate::append): Ditto.
3060         (WebCore::MockSourceBufferPrivate::didReceiveInitializationSegment): Ditto.
3061         (WebCore::MockSourceBufferPrivate::didReceiveSample): Ditto.
3062         (WebCore::MockSourceBufferPrivate::enqueuedSamplesForTrackID): Ditto.
3063         (WebCore::MockSourceBufferPrivate::enqueueSample): Ditto.
3064         (WebCore::MockSourceBufferPrivate::hasVideo): Ditto.
3065         (WebCore::MockSourceBufferPrivate::hasAudio): Ditto.
3066         (WebCore::MockSourceBufferPrivate::fastSeekTimeForMediaTime): Ditto.
3067         (WebCore::MockSourceBufferPrivate::seekToTime): Ditto.
3068         * platform/mock/mediasource/MockSourceBufferPrivate.h: Ditto.
3069
3070         * rendering/RenderSnapshottedPlugIn.cpp:
3071         (WebCore::RenderSnapshottedPlugIn::updateSnapshot): Take raw pointer instead
3072         of PassRefPtr.
3073         * rendering/RenderSnapshottedPlugIn.h: Updated for above change.
3074
3075         * svg/SVGScriptElement.h: Added using to resolve the ambiguity with the
3076         ref/deref from SVGElement and from ScriptElement.
3077
3078         * xml/parser/XMLDocumentParser.cpp:
3079         (WebCore::XMLDocumentParser::notifyFinished): Updated to simplify since
3080         the pending script now has a script element.
3081
3082         * xml/parser/XMLDocumentParserLibxml2.cpp:
3083         (WebCore::XMLDocumentParser::startElementNs): Use isSciprtElement instead
3084         of toScriptElementIfPossible.
3085         (WebCore::XMLDocumentParser::endElementNs): Ditto. Also use downcastScriptElement.
3086
3087 2017-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3088
3089         Move editing history scripts to WebCore PrivateHeaders
3090         https://bugs.webkit.org/show_bug.cgi?id=166709
3091         <rdar://problem/29876612>
3092
3093         Reviewed by Dan Bernstein.
3094
3095         Move editing history scripts out of InternalScripts and into Scripts, and update the WebCore Copy Script build
3096         phase to copy the editing scripts into PrivateHeaders.
3097
3098         No new tests, because there should be no behavior change.
3099
3100         * Scripts/DumpEditingHistory.js: Renamed from Source/WebCore/InternalScripts/DumpEditingHistory.js.
3101         * Scripts/EditingHistoryUtil.js: Renamed from Source/WebCore/InternalScripts/EditingHistoryUtil.js.
3102         * WebCore.xcodeproj/project.pbxproj:
3103
3104 2017-01-04  Joseph Pecoraro  <pecoraro@apple.com>
3105
3106         Web Inspector: forced pseudo classes aren't cleared from inspected page when Inspector closes
3107         https://bugs.webkit.org/show_bug.cgi?id=108823
3108         <rdar://problem/13143550>
3109
3110         Reviewed by Timothy Hatcher.
3111
3112         * inspector/InspectorCSSAgent.h:
3113         * inspector/InspectorCSSAgent.cpp:
3114         (WebCore::InspectorCSSAgent::documentDetached):
3115         Clear the document from all of the different Document sets.
3116
3117         (WebCore::InspectorCSSAgent::didRemoveDocument): Deleted.
3118         Use documentDetached, which is more direct.
3119
3120         (WebCore::InspectorCSSAgent::forcePseudoState):
3121         Update the set of Documents with psuedo element changes. So when we
3122         reset forced styles we know which documents to refresh styles.
3123
3124         (WebCore::InspectorCSSAgent::resetPseudoStates):
3125         Use the list of documents we've already computed.
3126
3127         (WebCore::InspectorCSSAgent::didRemoveDOMNode):
3128         (WebCore::InspectorCSSAgent::didModifyDOMAttr):
3129         Change to take a reference and more data to avoid extra work.
3130
3131         * inspector/InspectorDOMAgent.h:
3132         * inspector/InspectorDOMAgent.cpp:
3133         (WebCore::InspectorDOMAgent::unbind):
3134         Eliminated didRemoveDocument.
3135
3136         (WebCore::InspectorDOMAgent::didModifyDOMAttr):
3137         (WebCore::InspectorDOMAgent::didRemoveDOMAttr):
3138         (WebCore::InspectorDOMAgent::styleAttributeInvalidated):
3139         Pass a references to the DOM listener client, these are never null.
3140
3141 2017-01-04  Myles C. Maxfield  <mmaxfield@apple.com>
3142
3143         Remove runtime flag for variation fonts
3144         https://bugs.webkit.org/show_bug.cgi?id=164251
3145
3146         Reviewed by Dean Jackson.
3147
3148         No new tests because there is no behavior change, but updated the following
3149         tests to stop setting the flag:
3150         - animations/font-variations/font-variation-settings-order.html:
3151         - animations/font-variations/font-variation-settings-unlike.html:
3152         - animations/font-variations/font-variation-settings.html:
3153         - fast/text/variations/duplicate.html:
3154         - fast/text/variations/exist.html:
3155         - fast/text/variations/getComputedStyle.html:
3156         - fast/text/variations/inheritance.html:
3157         - fast/text/variations/order.html:
3158         - fast/text/variations/outofbounds.html:
3159
3160         * css/CSSComputedStyleDeclaration.cpp:
3161         (WebCore::ComputedStyleExtractor::propertyValue):
3162         * css/parser/CSSParser.cpp:
3163         (WebCore::CSSParserContext::CSSParserContext):
3164         (WebCore::operator==):
3165         * css/parser/CSSParserMode.h:
3166         (WebCore::CSSParserContext::completeURL):
3167         (WebCore::CSSParserContextHash::hash):
3168         * css/parser/CSSPropertyParser.cpp:
3169         (WebCore::CSSPropertyParser::parseSingleValue):
3170         * page/Settings.in:
3171         * testing/InternalSettings.cpp:
3172         (WebCore::InternalSettings::Backup::Backup):
3173         (WebCore::InternalSettings::Backup::restoreTo):
3174         (WebCore::InternalSettings::variationFontsEnabled): Deleted.
3175         (WebCore::InternalSettings::setVariationFontsEnabled): Deleted.
3176         * testing/InternalSettings.h:
3177         * testing/InternalSettings.idl:
3178
3179 2017-01-04  Andy Estes  <aestes@apple.com>
3180
3181         [Cocoa] Teach SharedBuffer to return an NSArray of data segments to avoid flattening
3182         https://bugs.webkit.org/show_bug.cgi?id=166696
3183
3184         Reviewed by Tim Horton.
3185
3186         Existing methods of extracting NSData from a SharedBuffer require either merging or copying
3187         data segments. Since data segments are stored in CFDataRefs on Cocoa platforms, it should be
3188         possible to retrieve an NSArray of the segments without having to first flatten to a single
3189         buffer.
3190
3191         This patch implements such a method. This will be used in a follow-on patch, where I will
3192         need to pass SharedBuffer data to QuickLook via an NSArray of NSData.
3193
3194         New API test: SharedBufferTest.createNSDataArray.
3195
3196         * platform/SharedBuffer.h: Declared createNSArrayData(), and exported two functions needed
3197         by the API test.
3198         * platform/cocoa/SharedBufferCocoa.mm:
3199         (WebCore::SharedBuffer::createNSDataArray): Added. Returns m_cfData or a copy of m_fileData
3200         if either exist. Otherwise, adds m_buffer (wrapped in a WebCoreSharedBufferData object) and
3201         the objects in m_dataArray to a NSMutableArray and returns it.
3202
3203 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
3204
3205         Unreviewed, rolling out r210296.
3206
3207         This change broke macOS builds.
3208
3209         Reverted changeset:
3210
3211         "Check for the existence of
3212         AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h"
3213         https://bugs.webkit.org/show_bug.cgi?id=166691
3214         http://trac.webkit.org/changeset/210296
3215
3216 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
3217
3218         Unreviewed, rolling out r210287.
3219
3220         This change caused editing test failures on macOS.
3221
3222         Reverted changeset:
3223
3224         "Support File Promise during drag for macOS."
3225         https://bugs.webkit.org/show_bug.cgi?id=165204
3226         http://trac.webkit.org/changeset/210287
3227
3228 2017-01-04  Jer Noble  <jer.noble@apple.com>
3229
3230         Check for the existence of AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h
3231         https://bugs.webkit.org/show_bug.cgi?id=166691
3232
3233         Reviewed by Eric Carlson.
3234
3235         Move the declaration of AVSampleBufferDisplayLayer SPI into AVFoundationSPI.h and key off the presence of the _Private.h header.
3236
3237         Drive-by Fix: also check for the presence of AVSampleBufferRenderSynchronizer.h before re-declaring AVSampleBufferRenderSynchronizer.
3238
3239         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3240         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3241         * platform/spi/mac/AVFoundationSPI.h:
3242
3243 2017-01-04  Nan Wang  <n_wang@apple.com>
3244
3245         Many new HTML5 input types still exposed as generic AXTextfield
3246         https://bugs.webkit.org/show_bug.cgi?id=109017
3247         <rdar://problem/13658955>
3248
3249         Reviewed by Chris Fleizach.
3250
3251         Provided more detailed role description for input types that
3252         are exposed as standard text fields on the mac.
3253
3254         Changes are covered in modified test expectation.
3255
3256         * English.lproj/Localizable.strings:
3257         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3258         (-[WebAccessibilityObjectWrapper roleDescription]):
3259         * platform/LocalizedStrings.cpp:
3260         (WebCore::AXDateTimeFieldText):
3261         (WebCore::AXMonthFieldText):
3262         (WebCore::AXNumberFieldText):
3263         (WebCore::AXWeekFieldText):
3264         * platform/LocalizedStrings.h:
3265         * platform/efl/LocalizedStringsEfl.cpp:
3266         (WebCore::AXDateTimeFieldText):
3267         (WebCore::AXMonthFieldText):
3268         (WebCore::AXNumberFieldText):
3269         (WebCore::AXWeekFieldText):
3270         * platform/gtk/LocalizedStringsGtk.cpp:
3271         (WebCore::AXDateTimeFieldText):
3272         (WebCore::AXMonthFieldText):
3273         (WebCore::AXNumberFieldText):
3274         (WebCore::AXWeekFieldText):
3275
3276 2017-01-04  Sam Weinig  <sam@webkit.org>
3277
3278         Remove bindings/generic and distribute its contents appropriately
3279         https://bugs.webkit.org/show_bug.cgi?id=166700
3280
3281         Rubber-stamped by Alex Christensen.
3282
3283         * CMakeLists.txt:
3284         * DerivedSources.make:
3285         * PlatformMac.cmake:
3286         * PlatformWin.cmake:
3287         * WebCore.xcodeproj/project.pbxproj:
3288         * bindings/IDLTypes.h: Copied from Source/WebCore/bindings/generic/IDLTypes.h.
3289         * bindings/generic/ActiveDOMCallback.cpp: Removed.
3290         * bindings/generic/ActiveDOMCallback.h: Removed.
3291         * bindings/generic/IDLTypes.h: Removed.
3292         * bindings/generic/RuntimeEnabledFeatures.cpp: Removed.
3293         * bindings/generic/RuntimeEnabledFeatures.h: Removed.
3294         * dom/ActiveDOMCallback.cpp: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.cpp.
3295         * dom/ActiveDOMCallback.h: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.h.
3296         * page/RuntimeEnabledFeatures.cpp: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp.
3297         * page/RuntimeEnabledFeatures.h: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h.
3298         Move files around.
3299
3300 2017-01-04  Sam Weinig  <sam@webkit.org>
3301
3302         Add Exception accessor to ExceptionOr to remove unnecessary releases
3303         https://bugs.webkit.org/show_bug.cgi?id=166692
3304
3305         Reviewed by Alex Christensen.
3306
3307         * Modules/webdatabase/DatabaseManager.cpp:
3308         (WebCore::DatabaseManager::openDatabaseBackend):
3309         Use new exception() function.
3310
3311         * dom/ExceptionOr.h:
3312         (WebCore::ExceptionOr<ReturnType>::exception):
3313         (WebCore::ExceptionOr<void>::exception):
3314         Add exception() function which returns the exception without releasing it.
3315
3316 2016-01-04  Brent Fulgham  <bfulgham@apple.com>
3317
3318         Correct DOMWindow handling during FrameLoader::clear
3319         https://bugs.webkit.org/show_bug.cgi?id=166357
3320         <rdar://problem/29741862>
3321
3322         Reviewed by Andy Estes.
3323
3324         Make sure that we always clean up the DOM window when clearing Window properties, even if the document will
3325         remain in the page cache. Since 'clearWindowShell' is only used in FrameLoader, divide it's beahvior into
3326         two steps:
3327         
3328         1. Rename 'clearWindowShell' to 'clearWIndowShellsNotMatchingDOMWindow' to better describe its function.
3329         Switch to a modern C++ loop. Do not switch to the new DOMWindow here, but detach and clear existing
3330         DOMWindow connections.
3331
3332         2. Add a new method 'setDOMWindowForWindowShell'. Complete switch to the new DOMWindow.
3333
3334         This change allows us to disconnect the old DOMWindow, perform the 'setDocument(nullptr)' operation, and then
3335         connect to the new Window without leaving the loader in an inconsistent state.
3336
3337         * loader/bindings/js/ScriptController.cpp:
3338         (WebCore::clearWindowShellsNotMatchingDOMWindow): Renamed from 'clearWindowShell'
3339         (WebCore::setDOMWindowForWindowShell): Added.
3340         * loader/bindings/js/ScriptController.h:
3341         * loader/FrameLoader.cpp:
3342         (WebCore::FrameLoader::clear): Revise to use the new two-step DOMWindow switch logic.
3343
3344 2017-01-04  Enrica Casucci  <enrica@apple.com>
3345
3346         Support File Promise during drag for macOS.
3347         https://bugs.webkit.org/show_bug.cgi?id=165204
3348         rdar://problem/19595567
3349
3350         Reviewed by Tim Horton.
3351
3352         Adds the support for handling File Promise type during
3353         drag. DragData now has the knowledge of the NSFilesPromisePboardType and
3354         checks for the data type during drag.
3355
3356         * page/mac/DragControllerMac.mm:
3357         (WebCore::DragController::dragOperation):
3358         * platform/DragData.h:
3359         (WebCore::DragData::setFileNames):
3360         (WebCore::DragData::fileNames):
3361         * platform/mac/DragDataMac.mm:
3362         (WebCore::DragData::containsFiles):
3363         (WebCore::DragData::numberOfFiles):
3364         (WebCore::DragData::asFilenames):
3365         (WebCore::DragData::containsCompatibleContent):
3366         (WebCore::DragData::containsPromise):
3367         (WebCore::DragData::asURL):
3368
3369 2017-01-04  Chris Dumez  <cdumez@apple.com>
3370
3371         Assertion hit on redfin.com: ASSERTION FAILED: collection->length() > 1
3372         https://bugs.webkit.org/show_bug.cgi?id=166687
3373         <rdar://problem/29865854>
3374
3375         Reviewed by Darin Adler.
3376
3377         We were mistakenly calling Document::addWindowNamedItem() / Document::removeWindowNamedItem()
3378         for elements in Shadow DOMs. As a result, the windowNamedItem DocumentOrderedMap would
3379         contain elements in shadow DOMs. This would cause the assertion to be hit in window's
3380         named property getter because of the length mismatch between the windowNamedItem
3381         DocumentOrderedMap and the WindowNameCollection.
3382
3383         Tests: fast/shadow-dom/document-named-property.html
3384                fast/shadow-dom/window-named-property.html
3385
3386         * dom/Element.cpp:
3387         (WebCore::Element::updateNameForDocument):
3388         (WebCore::Element::updateIdForDocument):
3389         * html/HTMLImageElement.cpp:
3390         (WebCore::HTMLImageElement::parseAttribute):
3391         * html/HTMLObjectElement.cpp:
3392         (WebCore::HTMLObjectElement::updateDocNamedItem):
3393
3394 2017-01-04  John Wilander  <wilander@apple.com>
3395
3396         Validate the BCP47-ness of the language string passed to TrackBase::setLanguage()
3397         https://bugs.webkit.org/show_bug.cgi?id=123926
3398
3399         Reviewed by Jer Noble.
3400
3401         Test: media/media-source/only-bcp47-language-tags-accepted-as-valid.html
3402
3403         * html/HTMLMediaElement.cpp:
3404         (WebCore::HTMLMediaElement::configureTextTrackGroup):
3405             Log message now includes the valid BCP 47 language too.
3406         (WebCore::HTMLMediaElement::setSelectedTextTrack):
3407             Now sets preferred language to the valid BCP 47 language.
3408         * html/track/TextTrack.cpp:
3409         (WebCore::TextTrack::setLanguage):
3410             Removed fixme and aligned comments with new behavior.
3411         * html/track/TrackBase.cpp:
3412         (WebCore::TrackBase::TrackBase):
3413             Initializes m_validBCP47Language with language parameter.
3414         (WebCore::isValidBCP47LanguageTag):
3415             New convenience function.
3416         (WebCore::TrackBase::setLanguage):
3417             Sets m_validBCP47Language if the incoming tag is valid.
3418             Produces a console warning if the tag is invalid.
3419             The member m_language is set to the incoming tag regardless.
3420         (WebCore::TrackBase::validBCP47Language):
3421             New getter for valid language tag. To be used internally.
3422         * html/track/TrackBase.h:
3423             New AtomicString member m_validBCP47Language.
3424         (WebCore::TrackBase::setLanguage): Deleted.
3425         * html/track/VideoTrack.cpp:
3426         (WebCore::VideoTrack::setLanguage):
3427             Removed fixme and aligned comments with new behavior.
3428         * page/CaptionUserPreferences.cpp:
3429         (WebCore::trackDisplayName):
3430             Now uses the getter for BCP 47 language.
3431         (WebCore::CaptionUserPreferences::textTrackLanguageSelectionScore):
3432             Now uses the getter for BCP 47 language.
3433         * page/CaptionUserPreferencesMediaAF.cpp:
3434         (WebCore::buildDisplayStringForTrackBase):
3435             Now uses the getter for BCP 47 language.
3436         (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore):
3437             Now uses the getter for BCP 47 language.
3438         (WebCore::textTrackCompare):
3439             Now uses the getter for BCP 47 language.
3440         (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
3441             Now uses the getter for BCP 47 language.
3442
3443 2017-01-04  Joseph Pecoraro  <pecoraro@apple.com>
3444
3445         Web Inspector: Cross Origin importScripts() scripts lack source URL, causes issues with Inspector showing Resource
3446         https://bugs.webkit.org/show_bug.cgi?id=165569
3447         <rdar://problem/29607569>
3448
3449         Reviewed by Youenn Fablet.
3450
3451         Test: http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html
3452
3453         * Modules/fetch/FetchLoader.cpp:
3454         (WebCore::FetchLoader::start):
3455         * loader/DocumentThreadableLoader.cpp:
3456         (WebCore::DocumentThreadableLoader::didReceiveResponse):
3457         * loader/ThreadableLoader.cpp:
3458         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
3459         * loader/ThreadableLoader.h:
3460         * loader/WorkerThreadableLoader.cpp:
3461         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
3462         Add a new ThreadableLoader option to avoid filtering the response.
3463
3464         * workers/WorkerScriptLoader.cpp:
3465         (WebCore::WorkerScriptLoader::loadSynchronously):
3466         (WebCore::WorkerScriptLoader::loadAsynchronously):
3467         Disable filtering of the response. This is an internal load, we
3468         don't want to filter data that would be valuable later.
3469
3470 2017-01-03  Sam Weinig  <sam@webkit.org>
3471
3472         Remove final custom binding from IDBRequest
3473         https://bugs.webkit.org/show_bug.cgi?id=166671
3474
3475         Reviewed by Alex Christensen.
3476
3477         * CMakeLists.txt:
3478         * WebCore.xcodeproj/project.pbxproj:
3479         Remove JSIDBRequestCustom.cpp
3480
3481         * bindings/js/JSIDBRequestCustom.cpp: Removed.
3482
3483         * Modules/indexeddb/IDBRequest.cpp:
3484         (WebCore::IDBRequest::IDBRequest):
3485         (WebCore::IDBRequest::~IDBRequest):
3486         (WebCore::IDBRequest::result):
3487         (WebCore::IDBRequest::setSource):
3488         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
3489         (WebCore::IDBRequest::sourceIndexIdentifier):
3490         (WebCore::IDBRequest::requestedIndexRecordType):
3491         (WebCore::IDBRequest::setResult):
3492         (WebCore::IDBRequest::setResultToStructuredClone):
3493         (WebCore::IDBRequest::setResultToUndefined):
3494         (WebCore::IDBRequest::resultCursor):
3495         (WebCore::IDBRequest::willIterateCursor):
3496         (WebCore::IDBRequest::didOpenOrIterateCursor):
3497         (WebCore::IDBRequest::source): Deleted.
3498         (WebCore::IDBRequest::clearResult): Deleted.
3499         * Modules/indexeddb/IDBRequest.h:
3500         (WebCore::IDBRequest::source):
3501         (WebCore::IDBRequest::cursorResult): Deleted.
3502         (WebCore::IDBRequest::databaseResult): Deleted.
3503         (WebCore::IDBRequest::scriptResult): Deleted.
3504         Replace multiple member variables with Variants for source and result. Add a result
3505         member function that properly sets an exception if not "done".
3506
3507         * Modules/indexeddb/IDBRequest.idl:
3508         Remove CustomGetter annotation and add type.
3509
3510         * bindings/generic/IDLTypes.h:
3511         (WebCore::IDLAny::nullValue):
3512         (WebCore::IDLAny::isNullValue):
3513         (WebCore::IDLAny::extractValueFromNullable):
3514         * bindings/js/JSDOMConvert.h:
3515         (WebCore::Converter<IDLAny>::convert):
3516         Flesh out IDLAny to be implemented as a Strong<Unknown> when used in aggregate types,
3517         but still work with JSValue when passing as a parameter.
3518
3519         * inspector/InspectorIndexedDBAgent.cpp:
3520         Update for new return value of IDBRequest::result().
3521
3522 2017-01-04  Tim Horton  <timothy_horton@apple.com>
3523
3524         Provide a setting for clients to always prefer low-power WebGL
3525         https://bugs.webkit.org/show_bug.cgi?id=166675
3526         <rdar://problem/29834093>
3527
3528         Reviewed by Dan Bernstein.
3529
3530         No new tests; as noted in r204664, we don't know how to reliably test
3531         automatic graphics switching. One could use the manual test introduced
3532         in that commit; after this commit, with the setting switched on, on a
3533         dual-GPU machine that is actively using integrated graphics, that test
3534         should return the same result for both contexts.
3535
3536         * page/Settings.in:
3537         Add a setting to prefer low-power WebGL.
3538
3539         * html/canvas/WebGLRenderingContextBase.cpp:
3540         (WebCore::WebGLRenderingContextBase::create):
3541         If said setting is enabled, set preferLowPowerToHighPerformance.
3542
3543 2017-01-03  Ryosuke Niwa  <rniwa@webkit.org>
3544
3545         label element with tabindex >= 0 is not focusable
3546         https://bugs.webkit.org/show_bug.cgi?id=102780
3547         <rdar://problem/29796608>
3548
3549         Reviewed by Darin Adler.
3550
3551         Fixed the bug by removing the override for HTMLLabelElement::isFocusable which always returned false.
3552
3553         This is a behavior from r5532 but it doesn't match the latest HTML specification or that of Chrome
3554         and Firefox.
3555
3556         Also fixed an existing bug in HTMLLabelElement::focus and HTMLLegendElement::focus which focused
3557         the associated form control when there is one even if the element itself is focusable. Without this fix,
3558         traversing from control with shift+tab would break since focusing the label would move the focus back
3559         to the input element inside the label element.
3560
3561         Finally, fixed a bug in HTMLLegendElement::focus that we can call inFocus without updating layout first.
3562
3563         The fix was inspired by https://chromium.googlesource.com/chromium/src/+/085ad8697b1be50c4f93e296797a25a43a79bcfb
3564
3565         Test: fast/events/focus-label-legend-elements-with-tabindex.html
3566
3567         * html/HTMLLabelElement.cpp:
3568         (WebCore::HTMLLabelElement::focus):
3569         (WebCore::HTMLLabelElement::isFocusable): Deleted.
3570         * html/HTMLLabelElement.h:
3571         * html/HTMLLegendElement.cpp:
3572         (WebCore::HTMLLegendElement::focus):
3573
3574 2017-01-03  Tim Horton  <timothy_horton@apple.com>
3575
3576         NSSpellChecker's recordResponse isn't called for unseen automatic corrections
3577         https://bugs.webkit.org/show_bug.cgi?id=166450
3578         <rdar://problem/29447824>
3579
3580         Reviewed by Darin Adler.
3581
3582         Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html
3583
3584         * editing/AlternativeTextController.cpp:
3585         (WebCore::AlternativeTextController::recordAutocorrectionResponse):
3586         (WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted.
3587         * editing/AlternativeTextController.h:
3588         Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having
3589         a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection
3590         of the private overload of recordAutocorrectionResponseReversed, since there's only one caller.
3591
3592         * editing/Editor.cpp:
3593         (WebCore::Editor::markAndReplaceFor):
3594         Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection.
3595
3596         (WebCore::Editor::changeBackToReplacedString):
3597         Adopt recordAutocorrectionResponse.
3598
3599         * page/AlternativeTextClient.h:
3600         Add an "AutocorrectionAccepted" response type.
3601
3602 2017-01-03  Nan Wang  <n_wang@apple.com>
3603
3604         AX: Focus should jump into modal dialogs when one appears
3605         https://bugs.webkit.org/show_bug.cgi?id=166670
3606
3607         Reviewed by Chris Fleizach.
3608
3609         Added a timer to let focus jump into a modal dialog if the web
3610         author didn't handle the focus movement.
3611
3612         Test: accessibility/mac/aria-modal-auto-focus.html
3613
3614         * accessibility/AXObjectCache.cpp:
3615         (WebCore::AXObjectCache::AXObjectCache):
3616         (WebCore::AXObjectCache::~AXObjectCache):
3617         (WebCore::firstFocusableChild):
3618         (WebCore::AXObjectCache::focusAriaModalNode):
3619         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired):
3620         (WebCore::AXObjectCache::handleAriaModalChange):
3621         * accessibility/AXObjectCache.h:
3622         (WebCore::AXObjectCache::focusAriaModalNode):
3623
3624 2017-01-03  Andy Estes  <aestes@apple.com>
3625
3626         Rename SharedBufferMac.mm to SharedBufferCocoa.mm
3627         https://bugs.webkit.org/show_bug.cgi?id=166666
3628
3629         Reviewed by Tim Horton.
3630
3631         * PlatformMac.cmake:
3632         * WebCore.xcodeproj/project.pbxproj:
3633         * platform/cocoa/SharedBufferCocoa.mm: Renamed from Source/WebCore/platform/mac/SharedBufferMac.mm.
3634
3635 2017-01-03  Sam Weinig  <sam@webkit.org>
3636
3637         Re-implement ExceptionOr on top of WTF::Expected
3638         https://bugs.webkit.org/show_bug.cgi?id=166668
3639
3640         Reviewed by Alex Christensen.
3641
3642         As a first step towards using WTF::Expected instead of ExceptionOr,
3643         use Expected as an implementation detail, rather than Variant/std::optional. 
3644
3645         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3646         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3647         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3648         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3649         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3650         Add missing #include of Variant.h
3651
3652         * dom/ExceptionOr.h:
3653         (WebCore::ExceptionOr<ReturnType>::ExceptionOr):
3654         (WebCore::ExceptionOr<ReturnType>::hasException):
3655         (WebCore::ExceptionOr<ReturnType>::releaseException):
3656         (WebCore::ExceptionOr<ReturnType>::releaseReturnValue):
3657         (WebCore::ExceptionOr<void>::ExceptionOr):
3658         (WebCore::ExceptionOr<void>::hasException):
3659         (WebCore::ExceptionOr<void>::releaseException):
3660         Re-implement on top of Expected.
3661
3662 2017-01-03  Chris Dumez  <cdumez@apple.com>
3663
3664         Make setting Event's cancelBubble to false a no-op
3665         https://bugs.webkit.org/show_bug.cgi?id=166018
3666
3667         Reviewed by Ryosuke Niwa.
3668
3669         Align behavior of Event.cancelBubble with the latest DOM specification:
3670         - https://dom.spec.whatwg.org/#dom-event-cancelbubble
3671
3672         Setting it to true sets the 'stop propagation' flag to true and setting
3673         it to false is now a no-op.
3674
3675         Tests: imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
3676                imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
3677                imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html
3678
3679         * Modules/indexeddb/IDBEventDispatcher.cpp:
3680         (WebCore::IDBEventDispatcher::dispatch):
3681         * dom/Event.h:
3682         (WebCore::Event::cancelBubble):
3683         (WebCore::Event::setCancelBubble):
3684         * dom/EventDispatcher.cpp:
3685         (WebCore::dispatchEventInDOM):
3686
3687 2017-01-03  Jer Noble  <jer.noble@apple.com>
3688
3689         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
3690         https://bugs.webkit.org/show_bug.cgi?id=166421
3691         <rdar://problem/29782862>
3692
3693         Reviewed by Dan Bernstein.
3694
3695         Follow up after r210099; fix the __has_include directive to include the framework and fix the #import inside #if.
3696
3697         * platform/spi/mac/AVFoundationSPI.h:
3698
3699 2017-01-03  Andreas Kling  <akling@apple.com>
3700
3701         REGRESSION(r210226): fast/history/back-from-page-with-focused-iframe.html crashes under GuardMalloc
3702         <https://webkit.org/b/166657>
3703         <rdar://problem/29848806>
3704
3705         Reviewed by Antti Koivisto.
3706
3707         The problem was that tearDownRenderers() would cause commit Widget hierarchy updates
3708         before returning, which is just before Document clears its m_renderView pointer.
3709         This led to an awkward callback into Page::setActivityState() which ended up trying
3710         to clear the selection inside a partially dead render tree.
3711
3712         Fix this by adding a WidgetHierarchyUpdatesSuspensionScope to Document::destroyRenderTree()
3713         which ensures that Widget updates don't happen until after Document::m_renderView is cleared.
3714
3715         * dom/Document.cpp:
3716         (WebCore::Document::destroyRenderTree):
3717
3718 2017-01-03  Andreas Kling  <akling@apple.com>
3719
3720         Placeholder style mechanism leaks CSSFontSelector for first Document styled.
3721         <https://webkit.org/b/166652>
3722
3723         Reviewed by Antti Koivisto.
3724
3725         The placeholder style is used when we're resolving style for a non-rendered
3726         element, or any element before stylesheets have loaded.
3727
3728         An old optimization had us reusing the same style each time, which meant that
3729         since it was initialized with a font selector the first time, it kept that
3730         font selector alive forever.
3731
3732         As we have to clone the style anyway, fix this by just making a new style
3733         each time, using the current document's font selector.
3734
3735         * style/StyleTreeResolver.cpp:
3736         (WebCore::Style::makePlaceholderStyle):
3737         (WebCore::Style::TreeResolver::TreeResolver):
3738         (WebCore::Style::TreeResolver::styleForElement):
3739         (WebCore::Style::ensurePlaceholderStyle): Deleted.
3740         (WebCore::Style::isPlaceholderStyle): Deleted.
3741         * style/StyleTreeResolver.h:
3742
3743 2017-01-03  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3744
3745         A floating element within <li> overlaps with the marker
3746         https://bugs.webkit.org/show_bug.cgi?id=166528
3747
3748         Reviewed by Zalan Bujtas.
3749
3750         Merged from Blink (patch by trobhogan@gmail.com):
3751         https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d
3752         https://crbug.com/548616
3753
3754         Establish a list marker's offset before floats have been added to its line.
3755
3756         Computing the offset for a list marker after the rest of the objects on the line
3757         it is on have been laid out, means it will avoid floats it ought not to.
3758
3759         Instead, compute the offset when laying out the marker and cache it for use later.
3760
3761         Tests: fast/lists/list-marker-before-float-nested-rtl.html
3762                fast/lists/list-marker-before-float-nested.html
3763                fast/lists/list-marker-before-float-rtl.html
3764                fast/lists/list-marker-before-float.html
3765
3766         * rendering/RenderListItem.cpp:
3767         (WebCore::RenderListItem::positionListMarker):
3768         * rendering/RenderListMarker.cpp:
3769         (WebCore::RenderListMarker::RenderListMarker):
3770         (WebCore::RenderListMarker::layout):
3771         * rendering/RenderListMarker.h:
3772
3773 2017-01-03  Per Arne Vollan  <pvollan@apple.com>
3774
3775         [Win] Some xmlhttprequest tests are failing.
3776         https://bugs.webkit.org/show_bug.cgi?id=166638
3777
3778         Reviewed by Darin Adler.
3779
3780         The tests are failing because the request timeout is set to zero.
3781         When the timeout is set to zero, we should use the default timeout.
3782
3783         * platform/network/cf/ResourceRequestCFNet.cpp:
3784         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3785         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
3786
3787 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3788
3789         Unreviewed, follow-up fix for r210227
3790         https://bugs.webkit.org/show_bug.cgi?id=166586
3791
3792         Suggested in the above bug.
3793
3794         * bindings/scripts/StaticString.pm:
3795         (GenerateStrings):
3796
3797 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3798
3799         Use StaticStringImpl instead of StaticASCIILiteral
3800         https://bugs.webkit.org/show_bug.cgi?id=166586
3801
3802         Reviewed by Darin Adler.
3803
3804         * bindings/scripts/StaticString.pm:
3805         (GenerateStrings):
3806
3807 2017-01-02  Andreas Kling  <akling@apple.com>
3808
3809         Drop the render tree for documents in the page cache.
3810         <https://webkit.org/b/121798>
3811
3812         Reviewed by Antti Koivisto.
3813
3814         To save memory and reduce complexity, have documents tear down their render tree
3815         when entering the page cache. I've wanted to do this for a long time and it seems
3816         like we can actually do it now.
3817
3818         This patch will enable a number of clean-ups since it's no longer valid for renderers
3819         to exist while the document is in page cache.
3820
3821         * dom/Document.cpp:
3822         (WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
3823         since we will now be tearing down render trees right as they enter the page cache.
3824
3825         * dom/PageCache.cpp:
3826         (WebCore::destroyRenderTree):
3827         (WebCore::PageCache::addIfCacheable): Tear down the render tree right before setting
3828         the in-cache flag. The render tree is destroyed in bottom-up order to ensure that the
3829         main frame renderers die last.
3830
3831         * history/CachedFrame.cpp:
3832         (WebCore::CachedFrameBase::restore):
3833         * page/FrameView.h:
3834         * page/FrameView.cpp:
3835         (WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring
3836         a frame from the page cache. This dirties the scrolling tree, which was covered by tests.
3837
3838         * page/animation/AnimationBase.cpp:
3839         (WebCore::AnimationBase::setNeedsStyleRecalc):
3840         * page/animation/AnimationController.cpp:
3841         (WebCore::AnimationController::cancelAnimations): Make these no-ops if called
3842         while the render tree is being torn down. This fixes some assertion failures
3843         on layout tests and avoids pointless style invalidation.
3844
3845 2017-01-02  Andreas Kling  <akling@apple.com>
3846
3847         Discard media controls JS/CSS caches under memory pressure.
3848         <https://webkit.org/b/166639>
3849
3850         Reviewed by Antti Koivisto.
3851
3852         Add a RenderTheme::purgeCaches() virtual and teach the iOS and macOS implementations
3853         to drop their cached media controls JS/CSS strings there. The strings are only cleared
3854         if nothing else is referencing them, which gives us a decent "weak cache" behavior.
3855
3856         This sheds ~300kB memory on iOS with the current media controls.
3857
3858         * page/MemoryRelease.cpp:
3859         (WebCore::releaseNoncriticalMemory):
3860         * rendering/RenderTheme.h:
3861         (WebCore::RenderTheme::purgeCaches):
3862         * rendering/RenderThemeIOS.h:
3863         * rendering/RenderThemeIOS.mm:
3864         (WebCore::RenderThemeIOS::purgeCaches):
3865         * rendering/RenderThemeMac.h:
3866         * rendering/RenderThemeMac.mm:
3867         (WebCore::RenderThemeMac::purgeCaches):
3868
3869 2017-01-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3870
3871         [GTK] Since the memory pressure relief has been activated, my disk has a high usage and the desktop stalls
3872         https://bugs.webkit.org/show_bug.cgi?id=164052
3873
3874         Reviewed by Michael Catanzaro.
3875
3876         Check how much memory is freed by the memory pressure handler and wait for a long time if we didn't free that
3877         much.
3878
3879         * platform/linux/MemoryPressureHandlerLinux.cpp:
3880         (WebCore::MemoryPressureHandler::EventFDPoller::EventFDPoller):
3881
3882 2017-01-02  Chris Fleizach  <cfleizach@apple.com>
3883
3884         AX: Expose block quote level to iOS API
3885         https://bugs.webkit.org/show_bug.cgi?id=166629
3886         <rdar://problem/29834793>
3887
3888         Reviewed by Darin Adler.
3889
3890         Expose the blockquote level to iOS Accessbility API.
3891         Change the return type of blockquote level to unsigned.
3892
3893         Test: accessibility/ios-simulator/blockquote-level.html
3894
3895         * accessibility/AccessibilityObject.cpp:
3896         (WebCore::AccessibilityObject::blockquoteLevel):
3897         * accessibility/AccessibilityObject.h:
3898         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3899         (-[WebAccessibilityObjectWrapper accessibilityBlockquoteLevel]):
3900         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3901         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3902
3903 2017-01-01  Jeff Miller  <jeffm@apple.com>
3904
3905         Update user-visible copyright strings to include 2017
3906         https://bugs.webkit.org/show_bug.cgi?id=166278
3907
3908         Reviewed by Dan Bernstein.
3909
3910         * Info.plist:
3911
3912 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
3913
3914         GraphicsContextCairo: setMiterLimit() is missing the DisplayListRecorder diversion
3915         https://bugs.webkit.org/show_bug.cgi?id=166539
3916
3917         Reviewed by Michael Catanzaro.
3918
3919         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3920         (WebCore::GraphicsContext::setMiterLimit): Call the setMiterLimit() method on the
3921         m_displayListRecorder object when the GraphicsContext object is in recording mode.
3922
3923 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
3924
3925         Clean up GraphicsContext3D forward declarations, header inclusion
3926         https://bugs.webkit.org/show_bug.cgi?id=166537
3927