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