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